You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor: extract gitignore helpers out of scaffold.ts #882
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."
"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
New file packages/codev/src/lib/gitignore.ts contains all gitignore-related exports listed above
scaffold.ts no 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 of scaffold.test.ts) — no test deleted or weakened, only relocated
tsc clean, 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.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.
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