Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .claude/skills/ai-sdlc-gates/gates.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
{ "name": "AI-SDLC no private term in a public repository (skipped when private)", "script": "scripts/Check-PrivateTerms.ps1", "clause": "AI-SDLC", "mode": "Blocking" },
{ "name": "C05 a pointer names a section that is there", "script": "scripts/Check-DocSectionRefs.ps1", "clause": "C05", "mode": "Blocking" },
{ "name": "C05 both doc layers exist, and every unit has a page", "script": "scripts/Check-DocCoverage.ps1", "clause": "C05", "mode": "Blocking" },
{ "name": "Docs: no page was last checked longer ago than docs.lastCheckedMaxAgeDays (off by default)", "script": "scripts/Check-DocLastChecked.ps1", "clause": "C05", "mode": "Advisory" },
{ "name": "Allow rules of the installed packages are in .claude/settings.json", "script": "scripts/Sync-AllowRules.ps1", "clause": "AI-SDLC", "mode": "Advisory", "args": { "Check": true } }
],
"allow": [
Expand Down
5 changes: 3 additions & 2 deletions .claude/skills/ai-sdlc-gates/scripts/AiSdlcConfig.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@ $script:Defaults = [ordered]@{
routePageFolders = @('docs/api/')
}
docs = [ordered]@{
units = @()
unitExclude = @()
units = @()
unitExclude = @()
lastCheckedMaxAgeDays = 0
}
repoGates = @()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#requires -Version 7.4

Describe 'Check-DocLastChecked' {
BeforeAll {
$script:Gate = Join-Path $PSScriptRoot 'Check-DocLastChecked.ps1'

# A repository with aisdlc.json, AGENTS.md and a docs/ folder with the given pages.
function New-Repo {
param([string]$Json = '{}', [hashtable]$Pages = @{}, [string]$Agents = '# Agents')
$root = Join-Path $TestDrive ([guid]::NewGuid().ToString('n'))
New-Item -ItemType Directory -Path (Join-Path $root 'docs') -Force | Out-Null
Set-Content -LiteralPath (Join-Path $root 'aisdlc.json') -Value $Json
Set-Content -LiteralPath (Join-Path $root 'AGENTS.md') -Value $Agents
foreach ($name in $Pages.Keys) { Set-Content -LiteralPath (Join-Path $root 'docs' $name) -Value $Pages[$name] }
$root
}

function Invoke-Gate {
param([string]$Root, [switch]$Quiet)
$extra = @()
if ($Quiet) { $extra += '-Quiet' }
$output = & pwsh -NoProfile -File $script:Gate -RepoRoot $Root -Today '2026-11-09' @extra *>&1 | Out-String
[pscustomobject]@{ Code = $LASTEXITCODE; Output = $output }
}

$script:On = '{ "docs": { "lastCheckedMaxAgeDays": 30 } }'
$script:OldPage = @{ 'old.md' = @('# Old', '', 'The list. Last checked: 2026-09-01.') }
}

It 'is off by default, also with an old date' {
$r = Invoke-Gate (New-Repo -Pages $script:OldPage)
$r.Code | Should -Be 0
$r.Output | Should -Match 'off'
}

It 'counts <Name> as off' -ForEach @(
@{ Name = 'the string "30"'; Json = '{ "docs": { "lastCheckedMaxAgeDays": "30" } }' }
@{ Name = 'zero'; Json = '{ "docs": { "lastCheckedMaxAgeDays": 0 } }' }
@{ Name = 'a negative number'; Json = '{ "docs": { "lastCheckedMaxAgeDays": -5 } }' }
@{ Name = 'true'; Json = '{ "docs": { "lastCheckedMaxAgeDays": true } }' }
) {
$r = Invoke-Gate (New-Repo -Json $Json -Pages $script:OldPage)
$r.Code | Should -Be 0
$r.Output | Should -Match 'off'
}

It 'lists a date older than the setting, with the file, the line and the age' {
$r = Invoke-Gate (New-Repo -Json $script:On -Pages $script:OldPage)
$r.Code | Should -Be 1
$r.Output | Should -Match 'docs/old\.md:3 last checked 2026-09-01, 69 days ago'
}

It 'passes a date that is exactly the setting old, and a newer one' {
$r = Invoke-Gate (New-Repo -Json $script:On -Pages @{ 'edge.md' = 'Last checked: 2026-10-10'; 'new.md' = 'last checked 2026-11-08' })
$r.Code | Should -Be 0 -Because $r.Output
}

It 'reads AGENTS.md too' {
$r = Invoke-Gate (New-Repo -Json $script:On -Agents "# Agents`nLast checked: 2025-01-01")
$r.Code | Should -Be 1
$r.Output | Should -Match 'AGENTS\.md:2'
}

It 'leaves a page without a date alone' {
$r = Invoke-Gate (New-Repo -Json $script:On -Pages @{ 'plain.md' = '# Plain page' })
$r.Code | Should -Be 0
}

It 'prints nothing with -Quiet when nothing is too old, and the list when something is' {
(Invoke-Gate (New-Repo -Json $script:On -Pages @{ 'new.md' = 'Last checked: 2026-11-08' }) -Quiet).Output.Trim() | Should -BeNullOrEmpty
(Invoke-Gate (New-Repo -Pages $script:OldPage) -Quiet).Output.Trim() | Should -BeNullOrEmpty -Because 'off stays quiet as well'
(Invoke-Gate (New-Repo -Json $script:On -Pages $script:OldPage) -Quiet).Output | Should -Match 'docs/old\.md:3'
}

It 'is registered as an Advisory core gate' {
$gates = Get-Content -LiteralPath (Join-Path $PSScriptRoot '..' 'gates.json') -Raw | ConvertFrom-Json
$entry = @($gates.gates | Where-Object { $_.script -eq 'scripts/Check-DocLastChecked.ps1' })
$entry.Count | Should -Be 1
$entry[0].mode | Should -Be 'Advisory'
}
}
81 changes: 81 additions & 0 deletions .claude/skills/ai-sdlc-gates/scripts/Check-DocLastChecked.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#Requires -Version 7
<#
.SYNOPSIS
Docs lint: lists the pages whose facts were last checked too long ago.

.DESCRIPTION
A page that copies facts from the outside world (versions, hosts, lists) says when someone last
checked them, as "Last checked: 2026-11-09". This gate reads AGENTS.md and the doc layers in
aisdlc.json and lists every such date that is older than docs.lastCheckedMaxAgeDays, with the file
and the line. A page without such a date is left alone.

The setting is off by default. Only a positive whole number in aisdlc.json switches it on; any
other value, such as "30" as a string, counts as off.

Exit 0 when the setting is off or no date is too old, and 1 when one is. The gate is Advisory, so
the runner shows a finding as a warning. The pre-push hook runs this script itself with -Quiet, so
the warning also shows on a push, which never fails on it.

.PARAMETER RepoRoot
Repository root. Defaults to the folder that holds aisdlc.json, found from this script.

.PARAMETER Today
The date to measure the age against. Defaults to today. A test passes a fixed date.

.PARAMETER Quiet
Print nothing unless a date is too old. The pre-push hook uses it.

.EXAMPLE
pwsh .claude/skills/ai-sdlc-gates/scripts/Check-DocLastChecked.ps1
#>
[CmdletBinding()]
param(
[string]$RepoRoot,
[datetime]$Today = (Get-Date).Date,
[switch]$Quiet
)

Import-Module (Join-Path $PSScriptRoot 'AiSdlcConfig.psm1') -Force
if (-not $RepoRoot) { $RepoRoot = Find-AiSdlcRepoRoot -StartPath $PSScriptRoot }

$config = Get-AiSdlcConfig -RepoRoot $RepoRoot
$maxAge = $config.docs['lastCheckedMaxAgeDays']
if (-not (($maxAge -is [int] -or $maxAge -is [long]) -and $maxAge -gt 0)) {
if (-not $Quiet) { Write-Host 'Last checked: off. Set docs.lastCheckedMaxAgeDays in aisdlc.json to a number of days to switch it on.' }
exit 0
}

$files = [System.Collections.Generic.List[string]]::new()
$agents = Join-Path $RepoRoot $config.paths.agentsFile
if (Test-Path -LiteralPath $agents) { $files.Add($agents) }
foreach ($layer in @(Get-AiSdlcPath -Name docsRoots -RepoRoot $RepoRoot -Relative)) {
$dir = Join-Path $RepoRoot $layer
if (Test-Path -LiteralPath $dir) {
Get-ChildItem -LiteralPath $dir -Recurse -Include *.md, *.markdown -File | ForEach-Object { $files.Add($_.FullName) }
}
}

$pattern = [regex]'(?i)\blast checked:?\s*(\d{4}-\d{2}-\d{2})'
$old = [System.Collections.Generic.List[string]]::new()
foreach ($file in $files) {
$relative = [IO.Path]::GetRelativePath($RepoRoot, $file).Replace('\', '/')
$number = 0
foreach ($line in [IO.File]::ReadLines($file)) {
$number++
foreach ($match in $pattern.Matches($line)) {
$date = [datetime]::MinValue
if (-not [datetime]::TryParseExact($match.Groups[1].Value, 'yyyy-MM-dd', [cultureinfo]::InvariantCulture, 'None', [ref]$date)) { continue }
$age = ($Today.Date - $date.Date).Days
if ($age -gt $maxAge) { $old.Add("${relative}:$number last checked $($match.Groups[1].Value), $age days ago") }
}
}
}

if ($old.Count) {
Write-Host "Last checked: $($old.Count) page date(s) are older than $maxAge days (docs.lastCheckedMaxAgeDays):" -ForegroundColor Yellow
foreach ($o in $old) { Write-Host " $o" }
Write-Host 'FIX: Check those facts against their source, fix what changed, and set the date to today.'
exit 1
}
if (-not $Quiet) { Write-Host "Last checked: every date is at most $maxAge days old." }
exit 0
16 changes: 9 additions & 7 deletions .claude/skills/ai-sdlc-gates/sync-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
".claude/skills/adr-conventions/SKILL.md": "26e170df5a60858e25afe9176fa428f42affb1bb",
".claude/skills/ai-sdlc-gates/assets/actions/ai-sdlc-pr/action.yml": "f80ed84d896859668d74cd47bf327a714d383f8a",
".claude/skills/ai-sdlc-gates/assets/agents-core.md": "f7e45643bf0f5447d480b588784b2c599cc7f320",
".claude/skills/ai-sdlc-gates/gates.json": "cf6f5a2d284f0b22f0f4a89292037caed3e53c19",
".claude/skills/ai-sdlc-gates/scripts/AiSdlcConfig.psm1": "3d3449e30e25d842f355ce74a2150775ab8b3e0d",
".claude/skills/ai-sdlc-gates/gates.json": "d37c2ad2ae7c5d8982aa4ae2b02c931ea7268642",
".claude/skills/ai-sdlc-gates/scripts/AiSdlcConfig.psm1": "3c23847cfe4e9f3d43bf415ca834f464b04071b3",
".claude/skills/ai-sdlc-gates/scripts/AiSdlcConfig.Tests.ps1": "e5689b5deec495e74dc991786596903d70283263",
".claude/skills/ai-sdlc-gates/scripts/apm-version.json": "fbbd8a51e60e3a7e653a35bc9b959f2bf332ab74",
".claude/skills/ai-sdlc-gates/scripts/Build-DocsIndex.ps1": "64c6d651e638b0fe15d20cde02418e8021a5cdfc",
Expand All @@ -38,6 +38,8 @@
".claude/skills/ai-sdlc-gates/scripts/Check-DocCoverage.Tests.ps1": "4a0ec4a8a2e853dc747caed1fd52eab355795d74",
".claude/skills/ai-sdlc-gates/scripts/Check-DocEmDashes.ps1": "5bfba25e0161cef3f3d0afd7bff3f7c0f7cdd8e4",
".claude/skills/ai-sdlc-gates/scripts/Check-DocEmDashes.Tests.ps1": "c49f03dc79e512398464c9a635831d9484b6d8d5",
".claude/skills/ai-sdlc-gates/scripts/Check-DocLastChecked.ps1": "662d77429101dd307f62b4ba4b391c5678a2f453",
".claude/skills/ai-sdlc-gates/scripts/Check-DocLastChecked.Tests.ps1": "e435f161b0d0fafb3268e34ba149346029cb2273",
".claude/skills/ai-sdlc-gates/scripts/Check-DocLineCitations.ps1": "aa86e5e2370d5798f5fbb6984e6ad66d4d23235d",
".claude/skills/ai-sdlc-gates/scripts/Check-DocLineCitations.Tests.ps1": "dbab13ae6cf7594a5392655b00e01043023d8ba0",
".claude/skills/ai-sdlc-gates/scripts/Check-DocPersonNames.ps1": "931b28d5f8f50e660b2b4072f911feee86503435",
Expand Down Expand Up @@ -111,10 +113,10 @@
".claude/skills/ai-sdlc-handbook/references/constitution.md": "34e1aa1bd0af60f9975ee7236216a95d048e3b58",
".claude/skills/ai-sdlc-handbook/references/consumer-own.md": "3dd7f38e00b58f6d1c5b7c79a160a5ebfafdb3c1",
".claude/skills/ai-sdlc-handbook/references/context-management.md": "e284e60ca4d5e2624be79b5ce247e0662e430e3d",
".claude/skills/ai-sdlc-handbook/references/docs-wiki.md": "038477c9b704a5b545decfe5e3f3f9970d8d1f9d",
".claude/skills/ai-sdlc-handbook/references/docs-wiki.md": "37bdec92b7b65d58ce5d845385fdf9dc92cbcd6b",
".claude/skills/ai-sdlc-handbook/references/first-story.md": "be899eb395dafb2d704b8f0cb46bac1fb5e593c8",
".claude/skills/ai-sdlc-handbook/references/language.md": "ca703edeb9e07e28e32a39fbcc9116b64db444d8",
".claude/skills/ai-sdlc-handbook/references/layout.md": "69e6a7345ca838eb224aa1bc6e093f3699c9a28c",
".claude/skills/ai-sdlc-handbook/references/layout.md": "2d4692426dd0edfa2ffcd9c5f8379848823bb345",
".claude/skills/ai-sdlc-handbook/references/node-templates.md": "580c9c92c470a6abbaa0145cc3060ff1a11d247c",
".claude/skills/ai-sdlc-handbook/references/orchestration.md": "22373827d6ecd454d93cfb652f76c5204f3215e2",
".claude/skills/ai-sdlc-handbook/references/pattern.md": "f0f2a8cf3dac267cda0fd3783d86bddba5afc7c0",
Expand All @@ -130,7 +132,7 @@
".claude/skills/ai-sdlc-hooks/githooks/post-commit": "f18058f9a38efc164e13801d61bb05329a056109",
".claude/skills/ai-sdlc-hooks/githooks/post-merge": "bb373f33abd09294cda55d7fc4499f32672eb372",
".claude/skills/ai-sdlc-hooks/githooks/post-rewrite": "e4c187dffeeaba569901f3424fae476b17c14927",
".claude/skills/ai-sdlc-hooks/githooks/pre-push": "73b10f0197b87c9311542cbb93627c116aa28788",
".claude/skills/ai-sdlc-hooks/githooks/pre-push": "4061cda4b50922eb11ba925290c0cb4582806270",
".claude/skills/ai-sdlc-hooks/scripts/AiSdlcSetup.ps1": "52ffd325d13cd403e7bfea0de8098c530c129b65",
".claude/skills/ai-sdlc-hooks/scripts/AiSdlcSetup.Tests.ps1": "ef5b30f0811181462d354a61d3e64c19f0c305e2",
".claude/skills/ai-sdlc-hooks/scripts/Deny-AgentMerge.ps1": "535543b86886fcc582912ded5373b0bd3d756356",
Expand All @@ -156,12 +158,12 @@
".claude/skills/ai-sdlc-hooks/scripts/Invoke-PostEditCheck.Tests.ps1": "3429e18735428ab387ab58ae276d4195b32e7999",
".claude/skills/ai-sdlc-hooks/scripts/New-AiSdlcUpdatePullRequest.ps1": "b54f90deb751d0b0dbf8ee8fbc3f39b3300b3b3d",
".claude/skills/ai-sdlc-hooks/scripts/New-AiSdlcUpdatePullRequest.Tests.ps1": "77e4b627da13ea9887f3918f66bc5b33dfd91c56",
".claude/skills/ai-sdlc-hooks/scripts/PrePushHook.Tests.ps1": "e75c62d107109d55b8d48b9c208c1cf4ea0d5e67",
".claude/skills/ai-sdlc-hooks/scripts/PrePushHook.Tests.ps1": "b6b1e162200082e545ced70a584bd8ce8bb49f0a",
".claude/skills/ai-sdlc-hooks/scripts/Update-AiSdlc.ps1": "56abaf1de1c17bea94c26e128f8c41e275a74f87",
".claude/skills/ai-sdlc-hooks/scripts/Update-AiSdlc.Tests.ps1": "8db305e438bc7ee404eb5106eacbe5581738f148",
".claude/skills/ai-sdlc-hooks/scripts/WindowsLongPaths.ps1": "fa3d7f509b6f9a1a935178c1eaf0d1566b7afead",
".claude/skills/ai-sdlc-hooks/scripts/WindowsLongPaths.Tests.ps1": "21a220ca2ccc65a56ec427a6e74c5a5dbfbfd4ef",
".claude/skills/ai-sdlc-hooks/SKILL.md": "774efd3863941a94682a7c8dcf3573280d173790",
".claude/skills/ai-sdlc-hooks/SKILL.md": "475c187e39ed4bbc9731110380b927a45bf7d4b4",
".claude/skills/capture-learning/SKILL.md": "32300ce3189109b0d717f975623e8d7ccec1c821",
".claude/skills/convene-personas/SKILL.md": "449708a02206bec35a83d2f48ca6366c8b78e3a2",
".claude/skills/docs-wiki-conventions/SKILL.md": "0679512fa39815b63da6373ff29bb6eadc52ff24",
Expand Down
1 change: 1 addition & 0 deletions .claude/skills/ai-sdlc-handbook/references/docs-wiki.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ sources, then checked claim by claim before anything is merged.
| Check wiki integrity locally | `Invoke-LocalGates.ps1` and the pre-push hook (run `Check-DocsWiki.ps1`) | active |
| Enforce the no-em-dash house style | `Check-DocEmDashes.ps1` (via `Invoke-LocalGates.ps1`) | active, blocking in CI |
| Enforce the reading level (B2 sentences, B1 words) | `Check-DocReadingLevel.ps1` (via `Invoke-LocalGates.ps1`) | active, blocking |
| Warn when a page's `Last checked` date is too old | `Check-DocLastChecked.ps1` (via `Invoke-LocalGates.ps1` and the pre-push hook) | advisory, off until `docs.lastCheckedMaxAgeDays` is set |
| Check wiki integrity before merge | CI gate in the pull request workflow | active, blocking (orphans, broken links, index sync, page-to-page connectivity) |
| Check every pointer names a section that is there | `Check-DocSectionRefs.ps1` (via `Invoke-LocalGates.ps1`) | active, blocking |
| Check every documented row carries a fact | `Check-DocRowContent.ps1` (blocking gate; no graph needed) | active |
Expand Down
1 change: 1 addition & 0 deletions .claude/skills/ai-sdlc-handbook/references/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ installs. `AiSdlcConfig.psm1` takes each dependency whose path ends in `packs/<n
| `paths.privateTermsFile` | The private term list of the private-terms gate. Empty means `<knowledgeRoot>/ai-sdlc/private-terms.txt` | empty |
| `paths.discoveryRoot` | The folder of the discovery pages, for the `discovery` pack | `docs-functional/discovery` |
| `visibility` | `private` or `public`. The private-terms gate runs only on a `public` repository | `private` |
| `docs.lastCheckedMaxAgeDays` | A positive whole number switches on a warning for every `Last checked: <date>` in `AGENTS.md` and the doc layers that is older than this many days. The local gate run and the pre-push hook show it, and it never fails a push. Any other value counts as off. | `0` (off) |
| `docs.units` / `docs.unitExclude` | The units that need a page, when the list of the packs does not fit, and the unit paths left out on purpose | the packs' list / none |
| `paths.solution`, `paths.sourceRoot`, `paths.testRoot`, `paths.runSettings`, `paths.coverageBaseline`, `paths.packagesProps` | The .NET solution, its code, its tests and its coverage setup, for the `dotnet` pack | none |
| `commands.build` / `commands.test` | How to build and test the repository. The pre-flight runs `commands.test` from the repository root, unless a pack pre-flight runs the tests itself, as the dotnet pack does | none |
Expand Down
2 changes: 1 addition & 1 deletion .claude/skills/ai-sdlc-hooks/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The dotnet pack adds one more: `Deny-StaleGraphQuery.ps1` in `dotnet-code-graph`
(`Test-PushReceipt.ps1` in `ai-sdlc-gates`). The pre-flight ran the same gates on that content, and
the pull request build still runs them. A push that only deletes refs, or whose commits
the remote already has, runs no gate at all. Only the refs of the remote being pushed to count. Both
push hooks judge this with one rule, `Test-PushSendsNothingNew` in `PreflightReceipt.psm1`. It also shows the change-completeness report, which is advisory and never fails the push. On a network share, the gates run on a local checkout of the pushed commit, which is much faster. Last, it
push hooks judge this with one rule, `Test-PushSendsNothingNew` in `PreflightReceipt.psm1`. It also shows the change-completeness report and the `Last checked` report, which are advisory and never fail the push. On a network share, the gates run on a local checkout of the pushed commit, which is much faster. Last, it
hands the same ref lines on to `git lfs pre-push`, so the LFS objects are uploaded. The other
hooks refresh the code graph, and do nothing when the graph tooling is absent.
- `githooks/git-lfs-hook` is shared by `pre-push`, `post-checkout`, `post-commit` and `post-merge`.
Expand Down
7 changes: 7 additions & 0 deletions .claude/skills/ai-sdlc-hooks/githooks/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ run_gates() (
# so the -BlockingOnly run above leaves it out; this call keeps the report visible on every push,
# for every tool, without failing it.
completeness="${gate_root:-$repo_root}/.claude/skills/ai-sdlc-gates/scripts/Check-ChangeCompleteness.ps1"
# Advisory as well, for the same reason: lists the pages whose "Last checked" date is older than
# docs.lastCheckedMaxAgeDays. It prints nothing when the setting is off or every date is recent.
last_checked="${gate_root:-$repo_root}/.claude/skills/ai-sdlc-gates/scripts/Check-DocLastChecked.ps1"
if [ -f "$last_checked" ]; then
"$PWSH" -NoProfile -File "$last_checked" -Quiet || true
fi

if [ -f "$completeness" ]; then
"$PWSH" -NoProfile -File "$completeness" || true
fi
Expand Down
Loading
Loading