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
codeql.yml analyzes JavaScript when the only script is .template/check-markdown.mjs, and the job fails #671
v0.153.0 adds .template/check-markdown.mjs. In a project with no other JavaScript or TypeScript, codeql.yml's detect step sees that .mjs file and adds javascript-typescript to the matrix. CodeQL's JavaScript extractor never extracts the file, because it sits under a folder whose name starts with a dot. Analyze (javascript-typescript) then fails with:
CodeQL could not process any code written in JavaScript/TypeScript.
Seen on NCodeGroup/Coordination#97 (the update to v0.153.0): the job failed at 971a7b2, and the job log lists no .mjs file among the extracted files.
Fix
In the detect step, count only scripts outside dot-folders, so .template/ tooling alone doesn't turn on the JavaScript analysis. NCodeGroup/Coordination@ede0f5a does this:
$scripts=@($files-match'\.(js|jsx|mjs|cjs|ts|tsx|mts|cts)$'-notmatch'(^|/)\.[^/]+/')
if ($scripts.Count) { $languages.Add('javascript-typescript') }
A script under src/ still turns the analysis on, and a dot-file that isn't in a dot-folder, such as src/.eslintrc.js, still counts.
Acceptance
A project whose only script is .template/check-markdown.mjs gets actions and its other languages, without javascript-typescript.
A project with a tracked script outside dot-folders still gets javascript-typescript.
Autopilot: NCodeGroup/.github hits this too, updating from v0.141.0 to v0.153.0: it tracks no other JavaScript or TypeScript file, so after the update .template/check-markdown.mjs alone would add javascript-typescript to its CodeQL matrix. Its plan applies the detect-step workaround from this issue's Fix to its project-owned codeql.yml.
Autopilot: NCodeGroup/Extensions.DataProtection needs this too, updating from v0.145.1 to v0.153.0: its only script after the update is .template/check-markdown.mjs, and its project-owned codeql.yml has the same detect step, so Analyze (javascript-typescript) would fail. Its update plan takes NCodeGroup/Coordination@ede0f5a's workaround in codeql.yml (count only scripts outside dot-folders) until the template's fix lands; the fix can be checked there.
Autopilot: NCodeGroup/identity-platform needs this too, updating from v0.145.2 to v0.153.0: it tracks no other JavaScript or TypeScript file, so .template/check-markdown.mjs alone would add javascript-typescript to its project-owned codeql.yml matrix. Its plan applies the detect-step change above (-notmatch '(^|/)\.[^/]+/') to its own codeql.yml; the fix here should let it take the template's version again.
Autopilot: NCodeGroup/Mediator needs this too, updating from v0.145.1 to v0.153.0. It is public and its only script after the update is .template/check-markdown.mjs, so its project-owned codeql.yml would add javascript-typescript and fail Analyze (javascript-typescript). Its update plan applies the NCodeGroup/Coordination@ede0f5a change to its detect step (count only scripts outside dot-folders) as a project-owned edit, and checks the fix here once it lands in the template.
Autopilot: NCodeGroup/PasswordGenerator has the same exposure, updating from v0.145.0 to v0.153.0: its only tracked script after the update is .template/check-markdown.mjs, and its project-owned codeql.yml detect step matches \.(js|jsx|mjs|cjs|ts|tsx|mts|cts)$ over git ls-files, so it would add javascript-typescript. Its update plan applies the fix above (-notmatch '(^|/)\.[^/]+/') to its own codeql.yml as a workaround, citing this issue; the fix is checked there once this lands.
Autopilot: NCodeGroup/Collections.Providers hit this too, updating from v0.145.1 to v0.153.0 (NCodeGroup/Collections.Providers#38). Its only tracked script is .template/check-markdown.mjs, so codeql.yml's detect step added javascript-typescript and Analyze (javascript-typescript) failed with "CodeQL could not process any code written in JavaScript/TypeScript." The update pull request applies the dot-folder filter from NCodeGroup/Coordination@ede0f5a to its project-owned codeql.yml; please check the template's fix against this repository too.
Autopilot: NCodeGroup/NCode.ReparsePoints needs this too, updating from v0.145.2 to v0.154.0: its only tracked script after the update is .template/check-markdown.mjs, and its project-owned codeql.yml has the same detect step, so Analyze (javascript-typescript) would fail. Its update plan applies NCodeGroup/Coordination@ede0f5a's dot-folder filter (-notmatch '(^|/)\.[^/]+/') to its own codeql.yml until the template's fix is released; the fix can be checked there.
Fix three gaps the v0.153 and v0.154 template updates hit, and drop an exception whose date has passed. .template/Update-Project.ps1 and Adopt-Project.ps1 keep Copier's clone of the template in a cache folder of the run's own, so updates running at once on one PC no longer fail on a worktree race in Copier's shared mirror (#687). /plan-template-update's trial clone takes the project's own origin, so the trial prints the GitHub notes the real update step prints, such as the baseline note, and the update step stops escalating on them (#686). codeql.yml's detect step counts only scripts outside dot-folders, so .template/check-markdown.mjs alone no longer turns on a JavaScript analysis that fails (#671). Both code-review.yml files lose the NCode Review v1.7.0 cooldown exception now that 2026-11-30T21:24Z has passed (#644).
Context for the executor
Build: none (PowerShell and Node.js scripts, no compile step).
Test: each step's Done-when runs what it needs. & ./tests/Test-Template.ps1 -Only __none__ -Work <folder> runs every static check without rendering (about 30 seconds); -Only python adds one render with the CodeQL detect cases (about 35 seconds). tests/Test-ProjectUpdateHooks.ps1 and tests/Test-AdoptEdgeCases.ps1 take about 35 seconds each.
Set up in this worktree while planning: Copier 9.19.1 is on PATH (uv tool install copier==9.19.1, in /root/.local/bin), and tests/node/node_modules was installed with npm ci --ignore-scripts in tests/node. The main checkout has no root package.json, so nothing was installed there. Node.js on PATH is v22 while .node-version names v26; every suite above passed with it.
The template's files live under template/. The files under .claude/commands/, .github/prompts/, .github/skills/ and .github/agents/, in template/ and at the repository root, are generated from workflow/templates/ by ./tools/Update-Template.ps1: never edit them by hand.
Code comments and help text wrap at 120 columns. Docs pages under docs/ keep each line at 400 characters or fewer, one fact per bullet.
Tests print PASS <name> or FAIL <name> <detail> through their Check function; keep each new check's name exactly as the step gives it, because the Done-when commands match it.
Commit each step as Plan step N: <title>, staging only the files the step lists (git add -- <files>); never git add -A, never stage PLAN.md.
Gotchas:
A script or command never passes a relative path to a .NET method, such as [IO.File]::ReadAllText, [IO.File]::WriteAllText or [IO.Directory]::GetFiles: .NET resolves it against the process's folder, which Set-Location doesn't move and which in a Copilot session is the main checkout, not the plan's worktree. Use Get-Content -LiteralPath, Set-Content -LiteralPath or Get-ChildItem, or make the path absolute first with Join-Path (Get-Location) <path>.
Run tests/Test-Template.ps1 with -Only from PowerShell (& ./tests/Test-Template.ps1 -Only python), never as pwsh -File ... -Only a, b.
The suites keep their work folder when a check fails; the Done-when commands pass a -Work folder in the temp folder and delete it afterwards.
Steps 1, 3, 5 and 7 add tests that must FAIL until the next step fixes the code: their Done-when commands pass only while those tests fail. Don't fix the code in those steps.
Step 6's Done-when counts the changed files with git status, so run it before committing the step.
In PowerShell, assigning $null to $env:COPIER_CACHE_DIR removes the variable, so $env:COPIER_CACHE_DIR = $copierCacheBefore restores an unset variable too.
Update-Project.ps1 shares Copier's user cache, so updates running at once on one PC fail with a worktree race #687 root cause: Copier 9.19 clones a template it reads over a URL (_vcs.clone → _is_remote, true for https:// and file:// addresses) through one mirror per URL in COPIER_CACHE_DIR, else the user's cache, then runs git worktree add on that mirror for each render and git worktree prune when it refreshes it. Two updates on one PC share the mirror, so one run's add or prune reads the other's half-written worktree entry. Evidence: the issue's fatal: failed to read ...\worktrees\copier._vcs.clone.5j5hn1bp/commondir; Copier's _get_or_create_mirror and _clone_via_cache in the installed 9.19.1; and a run of tests/Test-ProjectUpdateHooks.ps1 left a <hash>.git mirror of the snapshot's file:/// URL in its COPIER_CACHE_DIR.
Update-Project.ps1 shares Copier's user cache, so updates running at once on one PC fail with a worktree race #687 fix: Update-Project.ps1 saves COPIER_CACHE_DIR, points it at copier-cache in its own $scratch folder as the first statement of its main try, and in the finally puts the saved value back before it deletes $scratch. Setting it before the hand-over means the target version's script, an older one too, inherits a cache of this run's own; a newer target saves and restores the outer run's value, so nesting is safe. Cost: one mirror clone of the template per run, which the template's size makes small. Adopt-Project.ps1 runs copier copy from the default https:// address the same way, so it gets the same treatment, with its own temp folder, as the issue asks.
Update-Project.ps1 shares Copier's user cache, so updates running at once on one PC fail with a worktree race #687 tests run the real update and adoption from the snapshot's file:/// URL, which Copier caches as it does a GitHub address, with COPIER_CACHE_DIR at an empty folder the run must leave empty and must restore. A fixture check proves the render from that URL leaves a mirror in COPIER_CACHE_DIR, so the empty folder means the run used its own cache.
/plan-template-update's trial prints no baseline note, which the real update prints in every GitHub project #686 fix: the trial points its clone's origin at the project's own (git remote get-url origin), rather than having the plan predict the note by hand. With it, the trial reads the same GitHub repository as the update step for every origin-driven output: the baseline note (Get-BaselineNote), codeql.yml's commands (Get-CodeQLWorkflowNote), a library's README repository answer and the maintainers-policy visibility read (Get-RepositoryAnswer, Get-RepositoryVisibility). Update-Project.ps1 never fetches or pushes, and origin/HEAD is a local ref that remote set-url doesn't touch. A project without an origin keeps the clone's folder origin, where both runs find no GitHub repository. The codeql.yml paragraph's "trial's clone has a folder as its origin" no longer holds, so it is reworded.
codeql.yml analyzes JavaScript when the only script is .template/check-markdown.mjs, and the job fails #671 root cause: the detect step in template/.github/workflows/codeql.yml.jinja adds javascript-typescript for any tracked file ending in a script extension, while CodeQL's JavaScript extractor skips every folder whose name starts with a dot, so a project whose only script is .template/check-markdown.mjs gets an Analyze job with no code. Evidence: the issue's Update from project-template v0.153.0 Coordination#97 job log, and six projects' update comments on the issue. Fix: NCodeGroup/Coordination@ede0f5a's filter, -notmatch '(^|/)\.[^/]+/', verified here: .template/check-markdown.mjs with .github/scripts/b.js counts 0, with src/.eslintrc.js counts 1, web/e.ts counts 1. codeql.yml is project-owned, so existing projects see the change in the update's diff and copy it; ADR-0044's decision, a language only where CodeQL has code to analyze, is unchanged, so no record changes.
Right after the line [IO.File]::WriteAllText((Join-Path $other '.git\hooks\pre-commit'), "#!/bin/shn"), add $mirrors = @(Get-ChildItem -LiteralPath $env:COPIER_CACHE_DIR -Directory -Filter '*.git' -ErrorAction SilentlyContinue)and the checkCheck 'fixture: Copier keeps a mirror of the snapshot''s file URL in COPIER_CACHE_DIR' ($mirrors.Count -gt 0) $env:COPIER_CACHE_DIR`.
In the check 'update: the root wrapper updates a project by -Path', replace ($LASTEXITCODE -eq 0) with ($updateExit -eq 0).
After the check 'update: leaves core.hooksPath alone when the clone has hooks in .git/hooks, and warns', add $shared = @(if (Test-Path -LiteralPath $sharedCache) { Get-ChildItem -LiteralPath $sharedCache -Force }) and Check 'update: the root wrapper''s update keeps Copier''s mirror out of the COPIER_CACHE_DIR it was given, and restores the variable (#687)' (($updateExit -eq 0) -and -not $shared -and $cacheAfter -eq $sharedCache) "exit=$updateExit shared=$($shared.Name -join ',') after=$cacheAfter".
Add to the comment-based help's .DESCRIPTION, at its end, before the "Prints PASS or FAIL" sentence: The root wrapper's update runs with COPIER_CACHE_DIR at an empty folder, which it must leave empty, keeping Copier's mirror in a folder of its own, and must put the variable back (#687). Wrap at 120 columns.
Pattern: the $env:GIT_CONFIG_COUNT save, try, finally restore earlier in the same file.
Done when: $w = Join-Path ([IO.Path]::GetTempPath()) 'plan-687-hooks'; $o = @(& ./tests/Test-ProjectUpdateHooks.ps1 -Work $w 2>&1 | ForEach-Object { "$_" }); $code = $LASTEXITCODE; Remove-Item -LiteralPath $w -Recurse -Force -ErrorAction SilentlyContinue; if ($code -and ($o -match '^FAIL update: the root wrapper''s update keeps Copier''s mirror out of the COPIER_CACHE_DIR') -and ($o -match '^PASS fixture: Copier keeps a mirror of the snapshot''s file URL') -and ($o -match '^PASS update: the root wrapper updates a project by -Path') -and -not ($o -match '^FAIL (?!update: the root wrapper''s update keeps Copier''s mirror)')) { exit 0 } else { exit 1 }
In Update-Project.ps1, right after the line $scratch = Join-Path ([IO.Path]::GetTempPath()) "project-template-update-$(...)", add a comment and $copierCacheBefore = $env:COPIER_CACHE_DIR. The comment says: Copier keeps a template it reads over a URL as a mirror in the user's cache and adds a worktree of it for each render, so updates running at once on one PC race on the mirror's worktree entries (Update-Project.ps1 shares Copier's user cache, so updates running at once on one PC fail with a worktree race #687); this run's mirror lives in $scratch, which the finally deletes after it puts COPIER_CACHE_DIR back; it is set before the hand-over, so the version handed over to, an older one too, keeps its mirror apart as well. Wrap at 120 columns.
As the first statement inside the try { that follows Push-Location -LiteralPath $project (before the comment # Read Git's output as UTF-8, ...): $env:COPIER_CACHE_DIR = Join-Path $scratch 'copier-cache'.
In that try's finally, right before the line if (Test-Path -LiteralPath $scratch) { Remove-Item -LiteralPath $scratch -Recurse -Force -ErrorAction SilentlyContinue }, add $env:COPIER_CACHE_DIR = $copierCacheBefore.
In docs/update-project.md, under ## How It Runs, right after the bullet that starts - It clones the template from the address in, add: - It points Copier's cache, \COPIER_CACHE_DIR`, at a folder in that temporary folder for the run and puts the variable back afterwards, so updates running at once on one PC never share Copier's mirror of the template.` (the backslashes only mark the code span here; write plain backticks).
In docs/tests.md, in the list under - A project's own \.template\Update-Project.ps1` hands the update over to the new version's script, right after the bullet - The root wrapper updates another project by `-Path`, add - The root wrapper's update keeps Copier's mirror out of the `COPIER_CACHE_DIR` it was given, in a folder of its own, and puts the variable back`.
Done when: $w = Join-Path ([IO.Path]::GetTempPath()) 'plan-687-hooks'; & ./tests/Test-ProjectUpdateHooks.ps1 -Work $w | Out-Null; $a = $LASTEXITCODE; Remove-Item -LiteralPath $w -Recurse -Force -ErrorAction SilentlyContinue; $w2 = Join-Path ([IO.Path]::GetTempPath()) 'plan-687-exit'; & ./tests/Test-UpdateExitCode.ps1 -Work $w2 | Out-Null; $b = $LASTEXITCODE; Remove-Item -LiteralPath $w2 -Recurse -Force -ErrorAction SilentlyContinue; node tests/node/comment-width.mjs check template/.template/Update-Project.ps1 | Out-Null; $c = $LASTEXITCODE; $f = 'template/.template/Update-Project.ps1'; if (-not $a -and -not $b -and -not $c -and (Select-String -LiteralPath $f -SimpleMatch -Pattern '$env:COPIER_CACHE_DIR = $copierCacheBefore' -Quiet) -and (Select-String -LiteralPath docs/update-project.md -SimpleMatch -Pattern 'so updates running at once on one PC never share Copier''s mirror of the template' -Quiet) -and (Select-String -LiteralPath docs/tests.md -SimpleMatch -Pattern 'The root wrapper''s update keeps Copier''s mirror out of the COPIER_CACHE_DIR it was given' -Quiet)) { exit 0 } else { exit 1 }
[ ] 3. Add a failing check that an adoption keeps Copier's cache to itself
Check 'own-cache: an adoption from the snapshot''s URL commits' ((git -C $ownCache log -1 --format=%s) -eq 'Adopt project-template v0.1.0') $ownCacheOut
Check 'own-cache: the adoption keeps Copier''s mirror out of the COPIER_CACHE_DIR it was given, and restores the variable (#687)' (-not $shared -and $cacheAfter -eq $sharedCache) "shared=$($shared.Name -join ',') after=$cacheAfter"
Add to the comment-based help's .DESCRIPTION, as its last sentence: An adoption from the snapshot's URL, which Copier clones through its mirror, runs with COPIER_CACHE_DIR at an empty folder, which it must leave empty, and must put the variable back (#687). Wrap at 120 columns.
Pattern: the failing fixture's adoption with -Data in the same file.
Done when: $w = Join-Path ([IO.Path]::GetTempPath()) 'plan-687-adopt'; $o = @(& ./tests/Test-AdoptEdgeCases.ps1 -Work $w 2>&1 | ForEach-Object { "$_" }); $code = $LASTEXITCODE; Remove-Item -LiteralPath $w -Recurse -Force -ErrorAction SilentlyContinue; if ($code -and ($o -match '^FAIL own-cache: the adoption keeps Copier''s mirror out of the COPIER_CACHE_DIR') -and ($o -match '^PASS own-cache: an adoption from the snapshot''s URL commits') -and -not ($o -match '^FAIL (?!own-cache: the adoption keeps Copier''s mirror)')) { exit 0 } else { exit 1 }
[ ] 4. Give each adoption a Copier cache of its own
In Adopt-Project.ps1, right after the line $outputEncoding = [Console]::OutputEncoding (just before Push-Location -LiteralPath $project), add a comment saying Copier keeps a template it reads over a URL, such as the default -Template, as a mirror in the user's cache and adds a worktree of it for each render, so adoptions and updates running at once on one PC race on the mirror's worktree entries (Update-Project.ps1 shares Copier's user cache, so updates running at once on one PC fail with a worktree race #687), and this run keeps its mirror in a folder of its own, which the finally deletes after it puts COPIER_CACHE_DIR back. Then $copierCacheBefore = $env:COPIER_CACHE_DIR and $copierCache = Join-Path ([IO.Path]::GetTempPath()) "project-template-adopt-copier-$([guid]::NewGuid().ToString('N').Substring(0, 8))". Keep each new comment line at 120 columns or fewer.
As the first statement inside the try { right after Push-Location -LiteralPath $project: $env:COPIER_CACHE_DIR = $copierCache.
In that try's finally (the last block of the file), after the [Console]::OutputEncoding restore line, add $env:COPIER_CACHE_DIR = $copierCacheBefore and if (Test-Path -LiteralPath $copierCache) { Remove-Item -LiteralPath $copierCache -Recurse -Force -ErrorAction SilentlyContinue }.
In docs/adopt-project.md, right below the heading ## How it works and above ### The Answers, add the paragraph: Copier keeps its clone of the template in a folder of the run's own: the script points \COPIER_CACHE_DIR` at it, deletes it afterwards and puts the variable back, so adoptions and updates running at once on one PC never share Copier's mirror of the template.` (write plain backticks), with a blank line before and after.
In docs/tests.md, in the tests/Test-AdoptEdgeCases.ps1 list, right after the bullet that starts - \notes`, whose own workflow runs CodeQL, add - An adoption from the snapshot's URL keeps Copier's mirror out of the `COPIER_CACHE_DIR` it was given, in a folder of its own, and puts the variable back`.
In the block that starts $updatePlanFiles = 'template\.claude\commands\plan-template-update.md', ..., add two strings to the second line's list, the one $m += @(Get-MissingText ($updatePlanFiles + 'template\.claude\commands\plan-issue.md', ...) ('git -C $scratch\project symbolic-ref ...', 'git -C $scratch\project remote set-head origin --delete')): 'if ($origin) { git -C $scratch\project remote set-url origin $origin }' and 'with the commands written for this project''s own GitHub repository'.
Right after that line, add: $m += @(foreach ($p in ($updatePlanFiles + 'template\.claude\commands\plan-issue.md', 'template\.github\prompts\plan-issue.prompt.md', 'template\.github\skills\plan-issue\SKILL.md')) { $full = Join-Path $repoRoot $p; if ((Test-Path -LiteralPath $full) -and [IO.File]::ReadAllText($full).Contains('has a folder as its origin')) { "${p}: still says the trial's clone has a folder as its origin" } }).
Rename that block's check to 'workflow: plan-template-update trials the update in a clone whose origin and origin/HEAD are the project''s, pins the version and plans the update with exit-code checks'.
Done when: $w = Join-Path ([IO.Path]::GetTempPath()) 'plan-687-template'; $o = @(& ./tests/Test-Template.ps1 -Only __none__ -Work $w 2>&1 | ForEach-Object { "$_" }); $code = $LASTEXITCODE; Remove-Item -LiteralPath $w -Recurse -Force -ErrorAction SilentlyContinue; $n = [regex]::Escape('workflow: plan-template-update trials the update in a clone whose origin and origin/HEAD are the project'); if ($code -and ($o -match "^FAIL $n") -and -not ($o -match "^FAIL (?!$n)")) { exit 0 } else { exit 1 }
[ ] 6. Point the trial clone's origin at the project's own, and regenerate
Files: workflow/templates/plan-template-update.md (edit), docs/update-project.md (edit), and the 12 generated plan-template-update and plan-issue files under template/ and the repository root (by ./tools/Update-Template.ps1)
Change:
In workflow/templates/plan-template-update.md, item 2 (**Trial run.**): right after the sentence that ends ... else { git -C $scratch\project remote set-head origin --delete }\``. and before Run the clone's update script with the target, insert: Its `origin` is the project's folder too, where the update finds no GitHub repository. The update step reads the project's own `origin`, and in a GitHub project prints notes written for that repository, such as the last one, which names `tools/Set-RepositoryBaseline.ps1 -Repo /`, and reads its visibility from GitHub. So point the clone's `origin` at the project's own as well: `$origin = "$(git remote get-url origin 2>$null)".Trim()`, then `if ($origin) { git -C $scratch\project remote set-url origin $origin }`.` (the backslashes before backticks only mark code spans here; write plain backticks).
In the same file, in the paragraph that starts When the trial adds \.github/workflows/codeql.yml`, replace with the commands written for `/`, since the trial's clone has a folder as its origin: the plan writes them for this project's own GitHub repository.withwith the commands written for this project's own GitHub repository, which the trial's clone has as its `origin`.` Leave the rest of the paragraph as it is.
Run ./tools/Update-Template.ps1.
In docs/update-project.md, under ## Plan an Update Instead, replace whose \origin/HEAD` it points where the project's own points, so the trial reads the same default branch as the update,withwhose `origin` and `origin/HEAD` it points where the project's own point, so the trial reads the same GitHub repository and default branch as the update and prints the same notes,`.
In codeql.yml.jinja's Detect the languages to analyze step, replace the line if (@($files -match '\.(js|jsx|mjs|cjs|ts|tsx|mts|cts)$').Count) { $languages.Add('javascript-typescript') } with these five lines, at the same 10-space indentation:
# CodeQL's JavaScript extractor skips every folder whose name starts with a dot, so a script only there, such
# as .template/check-markdown.mjs, would fail the analysis with no code to process: count only scripts outside
# such folders. A dot-file outside them, such as src/.eslintrc.js, still counts.
if ($scripts.Count) { $languages.Add('javascript-typescript') }
In docs/files.md, under the bullet - Its \CodeQL languages` job picks `actions` and, from the tracked files, ..., add the sub-bullet - It counts a script for `javascript-typescript` only outside folders whose names start with a dot, which CodeQL's JavaScript extractor skips, so `.template/check-markdown.mjs` alone turns no JavaScript analysis on`.
In docs/tests.md, right after the .github/workflows/dependency-review.yml block (after its bullet ending with its tag in a comment), add at the same indentation as - \.github/workflows/dependency-review.yml` on GitHub only: - `.github/workflows/codeql.yml`'s detect step, run on fixture repositories, picks each language from the tracked files, and `javascript-typescript` only for a script outside folders whose names start with a dot, such as `src/.eslintrc.js` but not `.template/check-markdown.mjs``.
Change: in both files, delete the three comment lines that start # v1.7.0 was released on 2026-11-27T21:24Z, under the three days ADR-0009 waits: it is pinned by that record's, # commented exception, because review-forks needs it, and this sentence goes once 2026-11-30T21:24Z has passed and # (NCodeGroup/project-template#644 removes it).. Keep the # line after them, so the paragraph ending say why. is followed by # and then the # review-forks: true (v1.7.0 on) paragraph. Change nothing else; the two files stay byte-identical, and both uses: NCodeGroup/code-review@... pins stay v1.7.0.
Change: ## [Unreleased] is empty. Right below it, with a blank line between, insert ## [0.154.2] - <date>, where <date> is what Get-Date -Format yyyy-MM-dd prints, then these groups and entries, each heading and entry separated by blank lines as in the ## [0.154.1] section, and leave ## [Unreleased] empty:
### Changed
- The \code-review.yml` a GitHub project with NCode Review gets, and this repository's own, no longer carry ADR-0009's commented exception for NCode Review v1.7.0, which the pin needed while v1.7.0 was under three days old; the pin stays v1.7.0. `code-review.yml` is the project's own, so an update shows the change to copy (#644, ADR-0009).`
### Fixed
- \.template/Update-Project.ps1` and `Adopt-Project.ps1` keep Copier's clone of the template in a folder of the run's own, pointing `COPIER_CACHE_DIR` at it and putting the variable back afterwards, so updates and adoptions running at once on one PC, such as agents updating many repositories, no longer fail with `fatal: failed to read ... commondir` on a worktree another run was adding to Copier's shared mirror (#687).`
- \/plan-template-update` points its trial clone's `origin` at the project's own, so the trial prints the notes the update step prints in a GitHub project, such as the last one, `tools/Set-RepositoryBaseline.ps1 -Repo /`, and `codeql.yml`'s commands for the project's own repository, and the update step no longer escalates on them (#686).`
- \.github/workflows/codeql.yml`'s detect step counts a JavaScript or TypeScript file only outside folders whose names start with a dot, which CodeQL's JavaScript extractor skips, so a project whose only script is `.template/check-markdown.mjs` no longer fails `Analyze (javascript-typescript)` with "CodeQL could not process any code written in JavaScript/TypeScript." `codeql.yml` is the project's own, so an update shows the change to copy (#671).`
(The backslashes before backticks only mark code spans in this plan; write plain backticks.)
At the end of the file, replace [unreleased]: https://github.com/NCodeGroup/project-template/compare/v0.154.1...HEAD with [unreleased]: https://github.com/NCodeGroup/project-template/compare/v0.154.2...HEAD, and add [0.154.2]: https://github.com/NCodeGroup/project-template/compare/v0.154.1...v0.154.2 right below it, above the [0.154.1]: line.
Update-Project.ps1 sets COPIER_CACHE_DIR before the hand-over and restores it in the finally before it deletes $scratch, and an update that throws or stops on a conflict (exit 1) still restores it and deletes the folder.
On Windows, the finally's Remove-Item -Recurse -Force deletes the run's Copier mirror, whose pack files Git may make read-only; the tests here run on Linux.
Adopt-Project.ps1's new folder is deleted on every path: a rollback, a failed build (exit 1), -NoCommit (return) and a commit.
The regenerated plan-template-update and plan-issue files differ from before only in the trial's origin sentence and the codeql.yml paragraph.
New-Project.ps1 shares Copier's user cache: New-Project.ps1 runs copier copy from the default https:// template address through Copier's shared mirror, as Update-Project.ps1 and Adopt-Project.ps1 did before Update-Project.ps1 shares Copier's user cache, so updates running at once on one PC fail with a worktree race #687, so projects created at once on one PC, such as by agents with -Defaults, can fail with the same worktree race; give it a COPIER_CACHE_DIR of its own for the run, restored and deleted afterwards.
Activity
polewskm commentedon Nov 30, 2026
Autopilot: NCodeGroup/.github hits this too, updating from v0.141.0 to v0.153.0: it tracks no other JavaScript or TypeScript file, so after the update
.template/check-markdown.mjsalone would addjavascript-typescriptto its CodeQL matrix. Its plan applies the detect-step workaround from this issue's Fix to its project-ownedcodeql.yml.polewskm commentedon Nov 30, 2026
Autopilot: NCodeGroup/Extensions.DataProtection needs this too, updating from v0.145.1 to v0.153.0: its only script after the update is
.template/check-markdown.mjs, and its project-ownedcodeql.ymlhas the same detect step, soAnalyze (javascript-typescript)would fail. Its update plan takes NCodeGroup/Coordination@ede0f5a's workaround incodeql.yml(count only scripts outside dot-folders) until the template's fix lands; the fix can be checked there.polewskm commentedon Nov 30, 2026
Autopilot: NCodeGroup/identity-platform needs this too, updating from v0.145.2 to v0.153.0: it tracks no other JavaScript or TypeScript file, so
.template/check-markdown.mjsalone would addjavascript-typescriptto its project-ownedcodeql.ymlmatrix. Its plan applies the detect-step change above (-notmatch '(^|/)\.[^/]+/') to its owncodeql.yml; the fix here should let it take the template's version again.polewskm commentedon Nov 30, 2026
Autopilot: NCodeGroup/Mediator needs this too, updating from v0.145.1 to v0.153.0. It is public and its only script after the update is
.template/check-markdown.mjs, so its project-ownedcodeql.ymlwould addjavascript-typescriptand failAnalyze (javascript-typescript). Its update plan applies the NCodeGroup/Coordination@ede0f5a change to its detect step (count only scripts outside dot-folders) as a project-owned edit, and checks the fix here once it lands in the template.polewskm commentedon Nov 30, 2026
Autopilot: NCodeGroup/PasswordGenerator has the same exposure, updating from v0.145.0 to v0.153.0: its only tracked script after the update is
.template/check-markdown.mjs, and its project-ownedcodeql.ymldetect step matches\.(js|jsx|mjs|cjs|ts|tsx|mts|cts)$overgit ls-files, so it would addjavascript-typescript. Its update plan applies the fix above (-notmatch '(^|/)\.[^/]+/') to its owncodeql.ymlas a workaround, citing this issue; the fix is checked there once this lands.polewskm commentedon Nov 30, 2026
Autopilot: NCodeGroup/Collections.Providers hit this too, updating from v0.145.1 to v0.153.0 (NCodeGroup/Collections.Providers#38). Its only tracked script is
.template/check-markdown.mjs, socodeql.yml's detect step addedjavascript-typescriptandAnalyze (javascript-typescript)failed with "CodeQL could not process any code written in JavaScript/TypeScript." The update pull request applies the dot-folder filter from NCodeGroup/Coordination@ede0f5a to its project-ownedcodeql.yml; please check the template's fix against this repository too.chore(agents): update to project-template v0.153.0 (#48)
polewskm commentedon Nov 30, 2026
Autopilot: NCodeGroup/NCode.ReparsePoints needs this too, updating from v0.145.2 to v0.154.0: its only tracked script after the update is
.template/check-markdown.mjs, and its project-ownedcodeql.ymlhas the same detect step, soAnalyze (javascript-typescript)would fail. Its update plan applies NCodeGroup/Coordination@ede0f5a's dot-folder filter (-notmatch '(^|/)\.[^/]+/') to its owncodeql.ymluntil the template's fix is released; the fix can be checked there.polewskm commentedon Dec 1, 2026
Plan snapshot. The working copy is
PLAN.mdin the plan's checkout; this comment is not updated as steps run.Plan: Copier cache, trial origin, CodeQL scripts and cooldown fixes (10 steps)
Plan: Copier cache, trial origin, CodeQL scripts and cooldown fixes
Issue: #687 #686 #671 #644
Release: v0.154.2
Goal
Fix three gaps the v0.153 and v0.154 template updates hit, and drop an exception whose date has passed.
.template/Update-Project.ps1andAdopt-Project.ps1keep Copier's clone of the template in a cache folder of the run's own, so updates running at once on one PC no longer fail on a worktree race in Copier's shared mirror (#687)./plan-template-update's trial clone takes the project's ownorigin, so the trial prints the GitHub notes the real update step prints, such as the baseline note, and the update step stops escalating on them (#686).codeql.yml's detect step counts only scripts outside dot-folders, so.template/check-markdown.mjsalone no longer turns on a JavaScript analysis that fails (#671). Bothcode-review.ymlfiles lose the NCode Review v1.7.0 cooldown exception now that 2026-11-30T21:24Z has passed (#644).Context for the executor
& ./tests/Test-Template.ps1 -Only __none__ -Work <folder>runs every static check without rendering (about 30 seconds);-Only pythonadds one render with the CodeQL detect cases (about 35 seconds).tests/Test-ProjectUpdateHooks.ps1andtests/Test-AdoptEdgeCases.ps1take about 35 seconds each.uv tool install copier==9.19.1, in/root/.local/bin), andtests/node/node_moduleswas installed withnpm ci --ignore-scriptsintests/node. The main checkout has no rootpackage.json, so nothing was installed there. Node.js on PATH is v22 while.node-versionnames v26; every suite above passed with it.template/. The files under.claude/commands/,.github/prompts/,.github/skills/and.github/agents/, intemplate/and at the repository root, are generated fromworkflow/templates/by./tools/Update-Template.ps1: never edit them by hand.docs/keep each line at 400 characters or fewer, one fact per bullet.PASS <name>orFAIL <name> <detail>through theirCheckfunction; keep each new check's name exactly as the step gives it, because the Done-when commands match it.Plan step N: <title>, staging only the files the step lists (git add -- <files>); nevergit add -A, never stagePLAN.md.[IO.File]::ReadAllText,[IO.File]::WriteAllTextor[IO.Directory]::GetFiles: .NET resolves it against the process's folder, whichSet-Locationdoesn't move and which in a Copilot session is the main checkout, not the plan's worktree. UseGet-Content -LiteralPath,Set-Content -LiteralPathorGet-ChildItem, or make the path absolute first withJoin-Path (Get-Location) <path>.tests/Test-Template.ps1with-Onlyfrom PowerShell (& ./tests/Test-Template.ps1 -Only python), never aspwsh -File ... -Only a, b.-Workfolder in the temp folder and delete it afterwards.git status, so run it before committing the step.$nullto$env:COPIER_CACHE_DIRremoves the variable, so$env:COPIER_CACHE_DIR = $copierCacheBeforerestores an unset variable too.Decisions
/ship-planrenumbers._vcs.clone→_is_remote, true forhttps://andfile://addresses) through one mirror per URL inCOPIER_CACHE_DIR, else the user's cache, then runsgit worktree addon that mirror for each render andgit worktree prunewhen it refreshes it. Two updates on one PC share the mirror, so one run's add or prune reads the other's half-written worktree entry. Evidence: the issue'sfatal: failed to read ...\worktrees\copier._vcs.clone.5j5hn1bp/commondir; Copier's_get_or_create_mirrorand_clone_via_cachein the installed 9.19.1; and a run oftests/Test-ProjectUpdateHooks.ps1left a<hash>.gitmirror of the snapshot'sfile:///URL in itsCOPIER_CACHE_DIR.Update-Project.ps1savesCOPIER_CACHE_DIR, points it atcopier-cachein its own$scratchfolder as the first statement of its maintry, and in thefinallyputs the saved value back before it deletes$scratch. Setting it before the hand-over means the target version's script, an older one too, inherits a cache of this run's own; a newer target saves and restores the outer run's value, so nesting is safe. Cost: one mirror clone of the template per run, which the template's size makes small.Adopt-Project.ps1runscopier copyfrom the defaulthttps://address the same way, so it gets the same treatment, with its own temp folder, as the issue asks.file:///URL, which Copier caches as it does a GitHub address, withCOPIER_CACHE_DIRat an empty folder the run must leave empty and must restore. A fixture check proves the render from that URL leaves a mirror inCOPIER_CACHE_DIR, so the empty folder means the run used its own cache.originat the project's own (git remote get-url origin), rather than having the plan predict the note by hand. With it, the trial reads the same GitHub repository as the update step for every origin-driven output: the baseline note (Get-BaselineNote),codeql.yml's commands (Get-CodeQLWorkflowNote), a library's READMErepositoryanswer and the maintainers-policy visibility read (Get-RepositoryAnswer,Get-RepositoryVisibility).Update-Project.ps1never fetches or pushes, andorigin/HEADis a local ref thatremote set-urldoesn't touch. A project without anoriginkeeps the clone's folder origin, where both runs find no GitHub repository. Thecodeql.ymlparagraph's "trial's clone has a folder as its origin" no longer holds, so it is reworded.template/.github/workflows/codeql.yml.jinjaaddsjavascript-typescriptfor any tracked file ending in a script extension, while CodeQL's JavaScript extractor skips every folder whose name starts with a dot, so a project whose only script is.template/check-markdown.mjsgets an Analyze job with no code. Evidence: the issue's Update from project-template v0.153.0 Coordination#97 job log, and six projects' update comments on the issue. Fix: NCodeGroup/Coordination@ede0f5a's filter,-notmatch '(^|/)\.[^/]+/', verified here:.template/check-markdown.mjswith.github/scripts/b.jscounts 0, withsrc/.eslintrc.jscounts 1,web/e.tscounts 1.codeql.ymlis project-owned, so existing projects see the change in the update's diff and copy it; ADR-0044's decision, a language only where CodeQL has code to analyze, is unchanged, so no record changes.# v1.7.0 was released onfrom bothcode-review.ymlfiles, as Remove the NCode Review v1.6.0 cooldown exception #535 did for v1.6.0; the pin stays v1.7.0. The cooldown ended at 2026-11-30T21:24Z, which has passed.Out of scope
New-Project.ps1, whose Copier run shares the user's cache too (listed under Follow-ups), and no locking of Copier's cache.COPIER_CACHE_DIR, beyond the checks the steps add.Update-Project.ps1's notes (Get-BaselineNote,Get-CodeQLWorkflowNote), and no run oftools/Set-RepositoryBaseline.ps1.codeql.yml's detect step, to ADR-0044 or any other decision record, and no new record..claude/or.github/(step 6 regenerates them), and no change todocs/layout.md.Steps
[ ] 1. Add a failing check that an update keeps Copier's cache to itself
tests/Test-ProjectUpdateHooks.ps1(edit)[IO.File]::WriteAllText((Join-Path $other '.git\hooks\pre-commit'), "#!/bin/shn"), add$mirrors = @(Get-ChildItem -LiteralPath $env:COPIER_CACHE_DIR -Directory -Filter '*.git' -ErrorAction SilentlyContinue)and the checkCheck 'fixture: Copier keeps a mirror of the snapshot''s file URL in COPIER_CACHE_DIR' ($mirrors.Count -gt 0) $env:COPIER_CACHE_DIR`.COPIER_CACHE_DIRat a folder it must leave empty, since each run keeps its own mirror (Update-Project.ps1 shares Copier's user cache, so updates running at once on one PC fail with a worktree race #687):$runnerCache = $env:COPIER_CACHE_DIR,$sharedCache = Join-Path $Work 'shared-copier-cache',$env:COPIER_CACHE_DIR = $sharedCache.$output = & (Join-Path $repoRoot 'Update-Project.ps1') -Path $other 3>&1 | Out-Stringastry { $output = & (Join-Path $repoRoot 'Update-Project.ps1') -Path $other 3>&1 | Out-String; $updateExit = $LASTEXITCODE; $cacheAfter = $env:COPIER_CACHE_DIR }thenfinally { $env:COPIER_CACHE_DIR = $runnerCache }.'update: the root wrapper updates a project by -Path', replace($LASTEXITCODE -eq 0)with($updateExit -eq 0).'update: leaves core.hooksPath alone when the clone has hooks in .git/hooks, and warns', add$shared = @(if (Test-Path -LiteralPath $sharedCache) { Get-ChildItem -LiteralPath $sharedCache -Force })andCheck 'update: the root wrapper''s update keeps Copier''s mirror out of the COPIER_CACHE_DIR it was given, and restores the variable (#687)' (($updateExit -eq 0) -and -not $shared -and $cacheAfter -eq $sharedCache) "exit=$updateExit shared=$($shared.Name -join ',') after=$cacheAfter"..DESCRIPTION, at its end, before the "Prints PASS or FAIL" sentence:The root wrapper's update runs with COPIER_CACHE_DIR at an empty folder, which it must leave empty, keeping Copier's mirror in a folder of its own, and must put the variable back (#687).Wrap at 120 columns.$env:GIT_CONFIG_COUNTsave,try,finallyrestore earlier in the same file.$w = Join-Path ([IO.Path]::GetTempPath()) 'plan-687-hooks'; $o = @(& ./tests/Test-ProjectUpdateHooks.ps1 -Work $w 2>&1 | ForEach-Object { "$_" }); $code = $LASTEXITCODE; Remove-Item -LiteralPath $w -Recurse -Force -ErrorAction SilentlyContinue; if ($code -and ($o -match '^FAIL update: the root wrapper''s update keeps Copier''s mirror out of the COPIER_CACHE_DIR') -and ($o -match '^PASS fixture: Copier keeps a mirror of the snapshot''s file URL') -and ($o -match '^PASS update: the root wrapper updates a project by -Path') -and -not ($o -match '^FAIL (?!update: the root wrapper''s update keeps Copier''s mirror)')) { exit 0 } else { exit 1 }[ ] 2. Give each update a Copier cache of its own
template/.template/Update-Project.ps1(edit),docs/update-project.md(edit),docs/tests.md(edit)Update-Project.ps1, right after the line$scratch = Join-Path ([IO.Path]::GetTempPath()) "project-template-update-$(...)", add a comment and$copierCacheBefore = $env:COPIER_CACHE_DIR. The comment says: Copier keeps a template it reads over a URL as a mirror in the user's cache and adds a worktree of it for each render, so updates running at once on one PC race on the mirror's worktree entries (Update-Project.ps1 shares Copier's user cache, so updates running at once on one PC fail with a worktree race #687); this run's mirror lives in$scratch, which the finally deletes after it putsCOPIER_CACHE_DIRback; it is set before the hand-over, so the version handed over to, an older one too, keeps its mirror apart as well. Wrap at 120 columns.try {that followsPush-Location -LiteralPath $project(before the comment# Read Git's output as UTF-8, ...):$env:COPIER_CACHE_DIR = Join-Path $scratch 'copier-cache'.try'sfinally, right before the lineif (Test-Path -LiteralPath $scratch) { Remove-Item -LiteralPath $scratch -Recurse -Force -ErrorAction SilentlyContinue }, add$env:COPIER_CACHE_DIR = $copierCacheBefore.docs/update-project.md, under## How It Runs, right after the bullet that starts- It clones the template from the address in, add:- It points Copier's cache, \COPIER_CACHE_DIR`, at a folder in that temporary folder for the run and puts the variable back afterwards, so updates running at once on one PC never share Copier's mirror of the template.` (the backslashes only mark the code span here; write plain backticks).docs/tests.md, in the list under- A project's own \.template\Update-Project.ps1` hands the update over to the new version's script, right after the bullet- The root wrapper updates another project by `-Path`, add- The root wrapper's update keeps Copier's mirror out of the `COPIER_CACHE_DIR` it was given, in a folder of its own, and puts the variable back`.$w = Join-Path ([IO.Path]::GetTempPath()) 'plan-687-hooks'; & ./tests/Test-ProjectUpdateHooks.ps1 -Work $w | Out-Null; $a = $LASTEXITCODE; Remove-Item -LiteralPath $w -Recurse -Force -ErrorAction SilentlyContinue; $w2 = Join-Path ([IO.Path]::GetTempPath()) 'plan-687-exit'; & ./tests/Test-UpdateExitCode.ps1 -Work $w2 | Out-Null; $b = $LASTEXITCODE; Remove-Item -LiteralPath $w2 -Recurse -Force -ErrorAction SilentlyContinue; node tests/node/comment-width.mjs check template/.template/Update-Project.ps1 | Out-Null; $c = $LASTEXITCODE; $f = 'template/.template/Update-Project.ps1'; if (-not $a -and -not $b -and -not $c -and (Select-String -LiteralPath $f -SimpleMatch -Pattern '$env:COPIER_CACHE_DIR = $copierCacheBefore' -Quiet) -and (Select-String -LiteralPath docs/update-project.md -SimpleMatch -Pattern 'so updates running at once on one PC never share Copier''s mirror of the template' -Quiet) -and (Select-String -LiteralPath docs/tests.md -SimpleMatch -Pattern 'The root wrapper''s update keeps Copier''s mirror out of theCOPIER_CACHE_DIRit was given' -Quiet)) { exit 0 } else { exit 1 }[ ] 3. Add a failing check that an adoption keeps Copier's cache to itself
tests/Test-AdoptEdgeCases.ps1(edit)$null = & (Join-Path $PSScriptRoot 'New-TemplateSnapshot.ps1') $tplwith$tplUrl = & (Join-Path $PSScriptRoot 'New-TemplateSnapshot.ps1') $tpl(the script prints the snapshot'sfile:///URL).notes:check and before the''line that precedes$env:COPIER_CACHE_DIR = $copierCache, add, with a comment saying Copier clones the snapshot's URL through its mirror, and the adoption runs withCOPIER_CACHE_DIRat a folder it must leave empty (Update-Project.ps1 shares Copier's user cache, so updates running at once on one PC fail with a worktree race #687):$runnerCache = $env:COPIER_CACHE_DIR,$sharedCache = Join-Path $Work 'shared-copier-cache'$ownCache = New-Fixture 'own-cache' @{ 'README.md' = "# Own Cachen" } 'https://github.com/example/own-cache.git'`$env:COPIER_CACHE_DIR = $sharedCachetry { $ownCacheOut = & $adopt -Path $ownCache -Template $tplUrl -Ref v0.1.0 -Data @{ stack = 'other'; build_command = ''; test_command = '' } -NoVerify 3>&1 | Out-String; $cacheAfter = $env:COPIER_CACHE_DIR }thenfinally { $env:COPIER_CACHE_DIR = $runnerCache }$shared = @(if (Test-Path -LiteralPath $sharedCache) { Get-ChildItem -LiteralPath $sharedCache -Force })Check 'own-cache: an adoption from the snapshot''s URL commits' ((git -C $ownCache log -1 --format=%s) -eq 'Adopt project-template v0.1.0') $ownCacheOutCheck 'own-cache: the adoption keeps Copier''s mirror out of the COPIER_CACHE_DIR it was given, and restores the variable (#687)' (-not $shared -and $cacheAfter -eq $sharedCache) "shared=$($shared.Name -join ',') after=$cacheAfter".DESCRIPTION, as its last sentence:An adoption from the snapshot's URL, which Copier clones through its mirror, runs with COPIER_CACHE_DIR at an empty folder, which it must leave empty, and must put the variable back (#687).Wrap at 120 columns.failingfixture's adoption with-Datain the same file.$w = Join-Path ([IO.Path]::GetTempPath()) 'plan-687-adopt'; $o = @(& ./tests/Test-AdoptEdgeCases.ps1 -Work $w 2>&1 | ForEach-Object { "$_" }); $code = $LASTEXITCODE; Remove-Item -LiteralPath $w -Recurse -Force -ErrorAction SilentlyContinue; if ($code -and ($o -match '^FAIL own-cache: the adoption keeps Copier''s mirror out of the COPIER_CACHE_DIR') -and ($o -match '^PASS own-cache: an adoption from the snapshot''s URL commits') -and -not ($o -match '^FAIL (?!own-cache: the adoption keeps Copier''s mirror)')) { exit 0 } else { exit 1 }[ ] 4. Give each adoption a Copier cache of its own
Adopt-Project.ps1(edit),docs/adopt-project.md(edit),docs/tests.md(edit)Adopt-Project.ps1, right after the line$outputEncoding = [Console]::OutputEncoding(just beforePush-Location -LiteralPath $project), add a comment saying Copier keeps a template it reads over a URL, such as the default-Template, as a mirror in the user's cache and adds a worktree of it for each render, so adoptions and updates running at once on one PC race on the mirror's worktree entries (Update-Project.ps1 shares Copier's user cache, so updates running at once on one PC fail with a worktree race #687), and this run keeps its mirror in a folder of its own, which the finally deletes after it putsCOPIER_CACHE_DIRback. Then$copierCacheBefore = $env:COPIER_CACHE_DIRand$copierCache = Join-Path ([IO.Path]::GetTempPath()) "project-template-adopt-copier-$([guid]::NewGuid().ToString('N').Substring(0, 8))". Keep each new comment line at 120 columns or fewer.try {right afterPush-Location -LiteralPath $project:$env:COPIER_CACHE_DIR = $copierCache.try'sfinally(the last block of the file), after the[Console]::OutputEncodingrestore line, add$env:COPIER_CACHE_DIR = $copierCacheBeforeandif (Test-Path -LiteralPath $copierCache) { Remove-Item -LiteralPath $copierCache -Recurse -Force -ErrorAction SilentlyContinue }.docs/adopt-project.md, right below the heading## How it worksand above### The Answers, add the paragraph:Copier keeps its clone of the template in a folder of the run's own: the script points \COPIER_CACHE_DIR` at it, deletes it afterwards and puts the variable back, so adoptions and updates running at once on one PC never share Copier's mirror of the template.` (write plain backticks), with a blank line before and after.docs/tests.md, in thetests/Test-AdoptEdgeCases.ps1list, right after the bullet that starts- \notes`, whose own workflow runs CodeQL, add- An adoption from the snapshot's URL keeps Copier's mirror out of the `COPIER_CACHE_DIR` it was given, in a folder of its own, and puts the variable back`.$w = Join-Path ([IO.Path]::GetTempPath()) 'plan-687-adopt'; & ./tests/Test-AdoptEdgeCases.ps1 -Work $w | Out-Null; $code = $LASTEXITCODE; Remove-Item -LiteralPath $w -Recurse -Force -ErrorAction SilentlyContinue; & ./tests/Test-Markdown.ps1 | Out-Null; $md = $LASTEXITCODE; $wide = @(Get-Content -LiteralPath Adopt-Project.ps1 | Where-Object { $_ -match 'COPIER_CACHE_DIR|#687' -and $_.Length -gt 120 }); if (-not $code -and -not $md -and -not $wide -and (Select-String -LiteralPath Adopt-Project.ps1 -SimpleMatch -Pattern '$env:COPIER_CACHE_DIR = $copierCacheBefore' -Quiet) -and (Select-String -LiteralPath docs/adopt-project.md -SimpleMatch -Pattern 'so adoptions and updates running at once on one PC never share Copier''s mirror' -Quiet) -and (Select-String -LiteralPath docs/tests.md -SimpleMatch -Pattern 'An adoption from the snapshot''s URL keeps Copier''s mirror out' -Quiet)) { exit 0 } else { exit 1 }[ ] 5. Add a failing check that plan-template-update's trial takes the project's origin
tests/Test-Template.ps1(edit)$updatePlanFiles = 'template\.claude\commands\plan-template-update.md', ..., add two strings to the second line's list, the one$m += @(Get-MissingText ($updatePlanFiles + 'template\.claude\commands\plan-issue.md', ...) ('git -C $scratch\project symbolic-ref ...', 'git -C $scratch\project remote set-head origin --delete')):'if ($origin) { git -C $scratch\project remote set-url origin $origin }'and'with the commands written for this project''s own GitHub repository'.$m += @(foreach ($p in ($updatePlanFiles + 'template\.claude\commands\plan-issue.md', 'template\.github\prompts\plan-issue.prompt.md', 'template\.github\skills\plan-issue\SKILL.md')) { $full = Join-Path $repoRoot $p; if ((Test-Path -LiteralPath $full) -and [IO.File]::ReadAllText($full).Contains('has a folder as its origin')) { "${p}: still says the trial's clone has a folder as its origin" } }).'workflow: plan-template-update trials the update in a clone whose origin and origin/HEAD are the project''s, pins the version and plans the update with exit-code checks'.$w = Join-Path ([IO.Path]::GetTempPath()) 'plan-687-template'; $o = @(& ./tests/Test-Template.ps1 -Only __none__ -Work $w 2>&1 | ForEach-Object { "$_" }); $code = $LASTEXITCODE; Remove-Item -LiteralPath $w -Recurse -Force -ErrorAction SilentlyContinue; $n = [regex]::Escape('workflow: plan-template-update trials the update in a clone whose origin and origin/HEAD are the project'); if ($code -and ($o -match "^FAIL $n") -and -not ($o -match "^FAIL (?!$n)")) { exit 0 } else { exit 1 }[ ] 6. Point the trial clone's origin at the project's own, and regenerate
workflow/templates/plan-template-update.md(edit),docs/update-project.md(edit), and the 12 generatedplan-template-updateandplan-issuefiles undertemplate/and the repository root (by./tools/Update-Template.ps1)workflow/templates/plan-template-update.md, item 2 (**Trial run.**): right after the sentence that ends... else { git -C $scratch\project remote set-head origin --delete }\``. and beforeRun the clone's update script with the target, insert:Its `origin` is the project's folder too, where the update finds no GitHub repository. The update step reads the project's own `origin`, and in a GitHub project prints notes written for that repository, such as the last one, which names `tools/Set-RepositoryBaseline.ps1 -Repo /`, and reads its visibility from GitHub. So point the clone's `origin` at the project's own as well: `$origin = "$(git remote get-url origin 2>$null)".Trim()`, then `if ($origin) { git -C $scratch\project remote set-url origin $origin }`.` (the backslashes before backticks only mark code spans here; write plain backticks).When the trial adds \.github/workflows/codeql.yml`, replacewith the commands written for `/`, since the trial's clone has a folder as its origin: the plan writes them for this project's own GitHub repository.withwith the commands written for this project's own GitHub repository, which the trial's clone has as its `origin`.` Leave the rest of the paragraph as it is../tools/Update-Template.ps1.docs/update-project.md, under## Plan an Update Instead, replacewhose \origin/HEAD` it points where the project's own points, so the trial reads the same default branch as the update,withwhose `origin` and `origin/HEAD` it points where the project's own point, so the trial reads the same GitHub repository and default branch as the update and prints the same notes,`.$w = Join-Path ([IO.Path]::GetTempPath()) 'plan-687-template'; & ./tests/Test-Template.ps1 -Only __none__ -Work $w | Out-Null; $code = $LASTEXITCODE; Remove-Item -LiteralPath $w -Recurse -Force -ErrorAction SilentlyContinue; $changed = @(git status --porcelain | ForEach-Object { $_.Substring(3) }); $gen = @($changed | Where-Object { $_ -match '^(template/)?\.(claude|github)/.*plan-(template-update|issue)' }); if (-not $code -and $changed.Count -eq 14 -and $gen.Count -eq 12 -and ($changed -contains 'workflow/templates/plan-template-update.md') -and ($changed -contains 'docs/update-project.md') -and (Select-String -LiteralPath docs/update-project.md -SimpleMatch -Pattern 'whoseoriginandorigin/HEADit points where the project''s own point' -Quiet)) { exit 0 } else { exit 1 }[ ] 7. Add failing CodeQL detect cases for scripts in dot-folders
tests/Test-Template.ps1(edit)$detectCases, after the'needs-a-build'entry, add two entries:'scripts only in dot-folders' = @{ Files = @('.template/check-markdown.mjs', '.github/scripts/b.js', 'README.md'); Expected = 'languages=["actions"]' }'a dot-file script outside dot-folders' = @{ Files = @('.template/check-markdown.mjs', 'src/.eslintrc.js', 'README.md'); Expected = 'languages=["actions","javascript-typescript"]' }$detectCasesentries.$w = Join-Path ([IO.Path]::GetTempPath()) 'plan-687-template'; $o = @(& ./tests/Test-Template.ps1 -Only python -Work $w 2>&1 | ForEach-Object { "$_" }); $code = $LASTEXITCODE; Remove-Item -LiteralPath $w -Recurse -Force -ErrorAction SilentlyContinue; $n = 'python: the CodeQL workflow''s detect step picks the languages for scripts only in dot-folders'; if ($code -and ($o -match "^FAIL $n") -and ($o -match '^PASS python: the CodeQL workflow''s detect step picks the languages for a dot-file script outside dot-folders') -and -not ($o -match "^FAIL (?!$n)")) { exit 0 } else { exit 1 }[ ] 8. Count only scripts outside dot-folders in codeql.yml's detect step
template/.github/workflows/codeql.yml.jinja(edit),docs/files.md(edit),docs/tests.md(edit)codeql.yml.jinja'sDetect the languages to analyzestep, replace the lineif (@($files -match '\.(js|jsx|mjs|cjs|ts|tsx|mts|cts)$').Count) { $languages.Add('javascript-typescript') }with these five lines, at the same 10-space indentation:# CodeQL's JavaScript extractor skips every folder whose name starts with a dot, so a script only there, such# as .template/check-markdown.mjs, would fail the analysis with no code to process: count only scripts outside# such folders. A dot-file outside them, such as src/.eslintrc.js, still counts.$scripts = @($files -match '\.(js|jsx|mjs|cjs|ts|tsx|mts|cts)$' -notmatch '(^|/)\.[^/]+/')if ($scripts.Count) { $languages.Add('javascript-typescript') }docs/files.md, under the bullet- Its \CodeQL languages` job picks `actions` and, from the tracked files, ..., add the sub-bullet- It counts a script for `javascript-typescript` only outside folders whose names start with a dot, which CodeQL's JavaScript extractor skips, so `.template/check-markdown.mjs` alone turns no JavaScript analysis on`.docs/tests.md, right after the.github/workflows/dependency-review.ymlblock (after its bullet endingwith its tag in a comment), add at the same indentation as- \.github/workflows/dependency-review.yml` on GitHub only:- `.github/workflows/codeql.yml`'s detect step, run on fixture repositories, picks each language from the tracked files, and `javascript-typescript` only for a script outside folders whose names start with a dot, such as `src/.eslintrc.js` but not `.template/check-markdown.mjs``.$w = Join-Path ([IO.Path]::GetTempPath()) 'plan-687-template'; $o = @(& ./tests/Test-Template.ps1 -Only python -Work $w 2>&1 | ForEach-Object { "$_" }); $code = $LASTEXITCODE; Remove-Item -LiteralPath $w -Recurse -Force -ErrorAction SilentlyContinue; node tests/node/comment-width.mjs check template/.github/workflows/codeql.yml.jinja | Out-Null; $c = $LASTEXITCODE; & ./tests/Test-Markdown.ps1 | Out-Null; $md = $LASTEXITCODE; if (-not $code -and -not $c -and -not $md -and @($o -match '^PASS python: the CodeQL workflow''s detect step picks the languages for (scripts only in dot-folders|a dot-file script outside dot-folders)').Count -eq 2 -and (Select-String -LiteralPath docs/files.md -SimpleMatch -Pattern 'alone turns no JavaScript analysis on' -Quiet) -and (Select-String -LiteralPath docs/tests.md -SimpleMatch -Pattern 'such assrc/.eslintrc.jsbut not.template/check-markdown.mjs' -Quiet)) { exit 0 } else { exit 1 }[ ] 9. Remove the NCode Review v1.7.0 cooldown exception
template/.github/workflows/code-review.yml(edit),.github/workflows/code-review.yml(edit)# v1.7.0 was released on 2026-11-27T21:24Z, under the three days ADR-0009 waits: it is pinned by that record's,# commented exception, because review-forks needs it, and this sentence goes once 2026-11-30T21:24Z has passedand# (NCodeGroup/project-template#644 removes it).. Keep the#line after them, so the paragraph endingsay why.is followed by#and then the# review-forks: true (v1.7.0 on)paragraph. Change nothing else; the two files stay byte-identical, and bothuses: NCodeGroup/code-review@...pins stay v1.7.0.$f = 'template/.github/workflows/code-review.yml', '.github/workflows/code-review.yml'; $hit = @($f | Where-Object { Select-String -LiteralPath $_ -SimpleMatch -Pattern 'v1.7.0 was released on' -Quiet }); $same = (Get-FileHash -LiteralPath $f[0]).Hash -eq (Get-FileHash -LiteralPath $f[1]).Hash; $before = @(git show "HEAD:$($f[0])").Count; $after = @(Get-Content -LiteralPath $f[0]).Count; $pins = @(Select-String -LiteralPath $f[0] -Pattern 'uses: NCodeGroup/code-review@[0-9a-f]{40} # v1\.7\.0$').Count; if (-not $hit -and $same -and $after -eq ($before - 3) -and $pins -eq 2) { exit 0 } else { exit 1 }[ ] 10. Write the v0.154.2 changelog section
CHANGELOG.md(edit)## [Unreleased]is empty. Right below it, with a blank line between, insert## [0.154.2] - <date>, where<date>is whatGet-Date -Format yyyy-MM-ddprints, then these groups and entries, each heading and entry separated by blank lines as in the## [0.154.1]section, and leave## [Unreleased]empty:### Changed- The \code-review.yml` a GitHub project with NCode Review gets, and this repository's own, no longer carry ADR-0009's commented exception for NCode Review v1.7.0, which the pin needed while v1.7.0 was under three days old; the pin stays v1.7.0. `code-review.yml` is the project's own, so an update shows the change to copy (#644, ADR-0009).`### Fixed- \.template/Update-Project.ps1` and `Adopt-Project.ps1` keep Copier's clone of the template in a folder of the run's own, pointing `COPIER_CACHE_DIR` at it and putting the variable back afterwards, so updates and adoptions running at once on one PC, such as agents updating many repositories, no longer fail with `fatal: failed to read ... commondir` on a worktree another run was adding to Copier's shared mirror (#687).`- \/plan-template-update` points its trial clone's `origin` at the project's own, so the trial prints the notes the update step prints in a GitHub project, such as the last one, `tools/Set-RepositoryBaseline.ps1 -Repo /`, and `codeql.yml`'s commands for the project's own repository, and the update step no longer escalates on them (#686).`- \.github/workflows/codeql.yml`'s detect step counts a JavaScript or TypeScript file only outside folders whose names start with a dot, which CodeQL's JavaScript extractor skips, so a project whose only script is `.template/check-markdown.mjs` no longer fails `Analyze (javascript-typescript)` with "CodeQL could not process any code written in JavaScript/TypeScript." `codeql.yml` is the project's own, so an update shows the change to copy (#671).`[unreleased]: https://github.com/NCodeGroup/project-template/compare/v0.154.1...HEADwith[unreleased]: https://github.com/NCodeGroup/project-template/compare/v0.154.2...HEAD, and add[0.154.2]: https://github.com/NCodeGroup/project-template/compare/v0.154.1...v0.154.2right below it, above the[0.154.1]:line.$s = pwsh -NoProfile -File .template/Get-PlanState.ps1 -NoFetch; & ./tests/Test-ChangelogHeadings.ps1 | Out-Null; $h = $LASTEXITCODE; & ./tests/Test-ScriptAnalyzer.ps1 | Out-Null; $a = $LASTEXITCODE; if (-not $h -and -not $a -and ($s -match '^changelog-version: v?0\.154\.2$') -and ($s -contains 'changelog-duplicates: -') -and (Select-String -LiteralPath CHANGELOG.md -SimpleMatch -Pattern '[0.154.2]: https://github.com/NCodeGroup/project-template/compare/v0.154.1...v0.154.2' -Quiet) -and (Select-String -LiteralPath CHANGELOG.md -SimpleMatch -Pattern '[unreleased]: https://github.com/NCodeGroup/project-template/compare/v0.154.2...HEAD' -Quiet) -and @(Select-String -LiteralPath CHANGELOG.md -Pattern '\(\[#(687|686|671|644)\]\(https://github\.com/NCodeGroup/project-template/issues/(687|686|671|644)\)').Count -eq 4) { exit 0 } else { exit 1 }Review checklist
Update-Project.ps1setsCOPIER_CACHE_DIRbefore the hand-over and restores it in thefinallybefore it deletes$scratch, and an update that throws or stops on a conflict (exit 1) still restores it and deletes the folder.finally'sRemove-Item -Recurse -Forcedeletes the run's Copier mirror, whose pack files Git may make read-only; the tests here run on Linux.Adopt-Project.ps1's new folder is deleted on every path: a rollback, a failed build (exit 1),-NoCommit(return) and a commit.plan-template-updateandplan-issuefiles differ from before only in the trial'soriginsentence and thecodeql.ymlparagraph./plan-template-updatetrials printing the baseline note (/plan-template-update's trial prints no baseline note, which the real update prints in every GitHub project #686), and each project named on codeql.yml analyzes JavaScript when the only script is .template/check-markdown.mjs, and the job fails #671 copying thecodeql.ymlchange from its update's diff. A project's/plan-template-updatetakes the change only once its update installs the new command and a new session loads it.Follow-ups
New-Project.ps1runscopier copyfrom the defaulthttps://template address through Copier's shared mirror, asUpdate-Project.ps1andAdopt-Project.ps1did before Update-Project.ps1 shares Copier's user cache, so updates running at once on one PC fail with a worktree race #687, so projects created at once on one PC, such as by agents with-Defaults, can fail with the same worktree race; give it aCOPIER_CACHE_DIRof its own for the run, restored and deleted afterwards.Generated by Claude Code
chore(agents): update to project-template v0.154.5 (#55)