Summary
Review init code, make sure we always prompt if data needs to be overwritten.
This isn't asserting that there is a bug in init, but more just making sure we review any cases that write out files to ensure that we don't ever clobber user data.
Architecture Context
Create internal/scaffold/writer.go with a FileWriter service that encapsulates the create-if-missing + skip-if-exists pattern. It replaces the inline file-write loop in cmd/waza/cmd_init.go:518-541. The FileWriter accepts a list of files to write, checks existence, creates missing files, and returns an inventory of outcomes. The inventory is always printed - not gated behind --verbose.
Today both cmd_init.go and cmd_new.go have independent file-write loops with subtly different skip logic. A shared writer ensures consistent behavior and makes the inventory output testable.
Core rule: waza init only creates files that don't exist. Existing files are never overwritten or merged. Load() already fills in runtime defaults for missing config sections.
Architecture doc: docs/init-config-consolidation/architecture.md
Acceptance Criteria
Summary
Review init code, make sure we always prompt if data needs to be overwritten.
This isn't asserting that there is a bug in init, but more just making sure we review any cases that write out files to ensure that we don't ever clobber user data.
Architecture Context
Create
internal/scaffold/writer.gowith aFileWriterservice that encapsulates the create-if-missing + skip-if-exists pattern. It replaces the inline file-write loop incmd/waza/cmd_init.go:518-541. TheFileWriteraccepts a list of files to write, checks existence, creates missing files, and returns an inventory of outcomes. The inventory is always printed - not gated behind--verbose.Today both
cmd_init.goandcmd_new.gohave independent file-write loops with subtly different skip logic. A shared writer ensures consistent behavior and makes the inventory output testable.Core rule:
waza initonly creates files that don't exist. Existing files are never overwritten or merged.Load()already fills in runtime defaults for missing config sections.Architecture doc:
docs/init-config-consolidation/architecture.mdAcceptance Criteria
internal/scaffold/writer.goexists with aFileWritertypeFileWriterreturns a structured inventory: each entry has path + outcome (created vs skipped)cmd/waza/cmd_init.gousesFileWriterinstead of its inline write loopwaza initin an empty directory creates all files and prints created marker for eachwaza initagain in the same directory skips all files and prints exists marker for each--verbose)internal/scaffold/writer_test.gocovers: create-if-missing, skip-if-exists, inventory output, directory creationTestInitCommand_NeverOverwritesandTestInitCommand_Idempotentstill passgo test ./...passes;golangci-lint runpasses