Skip to content

codeql.yml analyzes JavaScript when the only script is .template/check-markdown.mjs, and the job fails #671

Done

Description

@polewskm

Problem

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.

Activity

  1. polewskm commented on Nov 30, 2026

    @polewskm
    CollaboratorAuthor

    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.

  2. polewskm commented on Nov 30, 2026

    @polewskm
    CollaboratorAuthor

    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.

  3. polewskm commented on Nov 30, 2026

    @polewskm
    CollaboratorAuthor

    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.

  4. polewskm commented on Nov 30, 2026

    @polewskm
    CollaboratorAuthor

    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.

  5. polewskm commented on Nov 30, 2026

    @polewskm
    CollaboratorAuthor

    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.

  6. polewskm commented on Nov 30, 2026

    @polewskm
    CollaboratorAuthor

    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.

  7. polewskm commented on Nov 30, 2026

    @polewskm
    CollaboratorAuthor

    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.

  8. polewskm commented on Dec 1, 2026

    @polewskm
    CollaboratorAuthor

    Plan snapshot. The working copy is PLAN.md in 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.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.
    • Issues Update-Project.ps1 shares Copier's user cache, so updates running at once on one PC fail with a worktree race #687 and /plan-template-update's trial prints no baseline note, which the real update prints in every GitHub project #686 name NCodeGroup/Mediator and NCodeGroup/.github in their Repositories callouts only to check the fix later; neither is attached or needed for any step, and neither was checked.
    • Conventions:
      • 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.

    Decisions

    Out of scope

    • No change to New-Project.ps1, whose Copier run shares the user's cache too (listed under Follow-ups), and no locking of Copier's cache.
    • No change to how the tests set COPIER_CACHE_DIR, beyond the checks the steps add.
    • No change to Update-Project.ps1's notes (Get-BaselineNote, Get-CodeQLWorkflowNote), and no run of tools/Set-RepositoryBaseline.ps1.
    • No change to the other languages of codeql.yml's detect step, to ADR-0044 or any other decision record, and no new record.
    • No change to the NCode Review pin, which stays v1.7.0.
    • No hand edit of a generated file under .claude/ or .github/ (step 6 regenerates them), and no change to docs/layout.md.

    Steps

    [ ] 1. Add a failing check that an update keeps Copier's cache to itself

    • Issue: Update-Project.ps1 shares Copier's user cache, so updates running at once on one PC fail with a worktree race #687
    • Files: tests/Test-ProjectUpdateHooks.ps1 (edit)
    • Change:
      • 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`.
      • Then, with a comment saying the update runs with COPIER_CACHE_DIR at 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.
      • Wrap the existing line $output = & (Join-Path $repoRoot 'Update-Project.ps1') -Path $other 3>&1 | Out-String as try { $output = & (Join-Path $repoRoot 'Update-Project.ps1') -Path $other 3>&1 | Out-String; $updateExit = $LASTEXITCODE; $cacheAfter = $env:COPIER_CACHE_DIR } then finally { $env:COPIER_CACHE_DIR = $runnerCache }.
      • 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 }

    [ ] 2. Give each update a Copier cache of its own

    • Issue: Update-Project.ps1 shares Copier's user cache, so updates running at once on one PC fail with a worktree race #687
    • Files: template/.template/Update-Project.ps1 (edit), docs/update-project.md (edit), docs/tests.md (edit)
    • Change:
      • 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

    • Issue: Update-Project.ps1 shares Copier's user cache, so updates running at once on one PC fail with a worktree race #687
    • Files: tests/Test-AdoptEdgeCases.ps1 (edit)
    • Change:
      • Replace $null = & (Join-Path $PSScriptRoot 'New-TemplateSnapshot.ps1') $tpl with $tplUrl = & (Join-Path $PSScriptRoot 'New-TemplateSnapshot.ps1') $tpl (the script prints the snapshot's file:/// URL).
      • After the last 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 with COPIER_CACHE_DIR at 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 = $sharedCache
        • try { $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 } then finally { $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') $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

    • Issue: Update-Project.ps1 shares Copier's user cache, so updates running at once on one PC fail with a worktree race #687
    • Files: Adopt-Project.ps1 (edit), docs/adopt-project.md (edit), docs/tests.md (edit)
    • Change:
      • 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`.
    • Done when: $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

    • Issue: /plan-template-update's trial prints no baseline note, which the real update prints in every GitHub project #686
    • Files: tests/Test-Template.ps1 (edit)
    • Change:
      • 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

    • Issue: /plan-template-update's trial prints no baseline note, which the real update prints in every GitHub project #686
    • 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,`.
    • Done when: $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 'whose originandorigin/HEAD it points where the project''s own point' -Quiet)) { exit 0 } else { exit 1 }

    [ ] 7. Add failing CodeQL detect cases for scripts in dot-folders

    • Issue: codeql.yml analyzes JavaScript when the only script is .template/check-markdown.mjs, and the job fails #671
    • Files: tests/Test-Template.ps1 (edit)
    • Change: in $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"]' }
    • Pattern: the existing $detectCases entries.
    • Done when: $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

    • Issue: codeql.yml analyzes JavaScript when the only script is .template/check-markdown.mjs, and the job fails #671
    • Files: template/.github/workflows/codeql.yml.jinja (edit), docs/files.md (edit), docs/tests.md (edit)
    • Change:
      • 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.
        • $scripts = @($files -match '\.(js|jsx|mjs|cjs|ts|tsx|mts|cts)$' -notmatch '(^|/)\.[^/]+/')
        • 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``.
    • Done when: $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 as src/.eslintrc.jsbut not.template/check-markdown.mjs' -Quiet)) { exit 0 } else { exit 1 }

    [ ] 9. Remove the NCode Review v1.7.0 cooldown exception

    • Issue: Remove the NCode Review v1.7.0 cooldown exception after 2026-11-30T21:24Z (blocked until then) #644
    • Files: template/.github/workflows/code-review.yml (edit), .github/workflows/code-review.yml (edit)
    • 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.
    • Done when: $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

    • Issue: Update-Project.ps1 shares Copier's user cache, so updates running at once on one PC fail with a worktree race #687 /plan-template-update's trial prints no baseline note, which the real update prints in every GitHub project #686 codeql.yml analyzes JavaScript when the only script is .template/check-markdown.mjs, and the job fails #671 Remove the NCode Review v1.7.0 cooldown exception after 2026-11-30T21:24Z (blocked until then) #644
    • Files: CHANGELOG.md (edit)
    • 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.
    • Done when: $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

    Follow-ups


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions