Context
packages/codev/src/lib/scaffold.ts was originally extracted in Maintenance Run 0004 to deduplicate logic shared between codev init and codev adopt — its header still says "Scaffold utilities for codev init and adopt commands". Since then it has drifted:
"Scaffold" implies creating new project structure, but the file now also handles in-place repair of existing projects. The name no longer matches the contents.
Proposed change
Extract gitignore-related helpers into a new file:
packages/codev/src/lib/gitignore.ts
Moves:
CODEV_GITIGNORE_ENTRIES constant
FULL_GITIGNORE_CONTENT constant
createGitignore() (used by init)
updateGitignore() (used by adopt)
backfillGitignore() (used by update)
- The internal
parseEntryLines() helper
- The
BackfillGitignoreResult / BackfillGitignoreOptions / UpdateGitignoreResult types
scaffold.ts keeps only the genuine scaffolding helpers — createUserDirs, copyConsultTypes, copyResourceTemplates, copyRootFiles, copyRoles, copyProtocols, copySkills, createProjectsDir, copyDirRecursive.
Acceptance criteria
Out of scope
- No behavior change. This is a pure file move + import update.
- No renaming of the functions themselves.
- Not pruning
scaffold.ts further (e.g. moving copyRoles to a roles.ts file). One refactor at a time.
Discovered while
Reviewing PR #881 (issue #880). The file's name vs. its current contents came up during post-merge discussion.
Context
packages/codev/src/lib/scaffold.tswas originally extracted in Maintenance Run 0004 to deduplicate logic shared betweencodev initandcodev adopt— its header still says "Scaffold utilities for codev init and adopt commands". Since then it has drifted:updateGitignore()was added for the adopt path — merging a Codev block into an existing.gitignore. Already not strictly "scaffolding."backfillGitignore()was added in Fix #880: gitignore .architect-role.md and add update-time backfill #881 for the update path — repairing stale state in long-lived projects. Definitely not scaffolding."Scaffold" implies creating new project structure, but the file now also handles in-place repair of existing projects. The name no longer matches the contents.
Proposed change
Extract gitignore-related helpers into a new file:
Moves:
CODEV_GITIGNORE_ENTRIESconstantFULL_GITIGNORE_CONTENTconstantcreateGitignore()(used by init)updateGitignore()(used by adopt)backfillGitignore()(used by update)parseEntryLines()helperBackfillGitignoreResult/BackfillGitignoreOptions/UpdateGitignoreResulttypesscaffold.tskeeps only the genuine scaffolding helpers —createUserDirs,copyConsultTypes,copyResourceTemplates,copyRootFiles,copyRoles,copyProtocols,copySkills,createProjectsDir,copyDirRecursive.Acceptance criteria
packages/codev/src/lib/gitignore.tscontains all gitignore-related exports listed abovescaffold.tsno longer references gitignore behaviorinit.ts,adopt.ts,update.ts, the test files)gitignore.test.ts(or split out ofscaffold.test.ts) — no test deleted or weakened, only relocatedtscclean, full test suite greenOut of scope
scaffold.tsfurther (e.g. movingcopyRolesto aroles.tsfile). One refactor at a time.Discovered while
Reviewing PR #881 (issue #880). The file's name vs. its current contents came up during post-merge discussion.