Repository navigation
Description
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:
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:
packages/codev/src/lib/gitignore.ts
Moves:
CODEV_GITIGNORE_ENTRIESconstantFULL_GITIGNORE_CONTENTconstantcreateGitignore()(used by init)updateGitignore()(used by adopt)backfillGitignore()(used by update)- The internal
parseEntryLines()helper - The
BackfillGitignoreResult/BackfillGitignoreOptions/UpdateGitignoreResulttypes
scaffold.ts keeps only the genuine scaffolding helpers — createUserDirs, copyConsultTypes, copyResourceTemplates, copyRootFiles, copyRoles, copyProtocols, copySkills, createProjectsDir, copyDirRecursive.
Acceptance criteria
- New file
packages/codev/src/lib/gitignore.tscontains all gitignore-related exports listed above -
scaffold.tsno longer references gitignore behavior - Import sites updated (
init.ts,adopt.ts,update.ts, the test files) - Existing test coverage moved to a new
gitignore.test.ts(or split out ofscaffold.test.ts) — no test deleted or weakened, only relocated -
tscclean, full test suite green
Out of scope
- No behavior change. This is a pure file move + import update.
- No renaming of the functions themselves.
- Not pruning
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.
Activity
amrmelsayed commentedon May 27, 2026
On it! Working on this with the PIR protocol (plan + dev-approval gates before PR).
[PIR #882] Plan draft
[PIR #882] Extract gitignore helpers out of scaffold.ts
[PIR #882] Thread: implementation complete
[PIR #882] Review + retrospective