Project-Template/docs/architecture/scripts
null 876f09f488 fix(tools): doc-triggers found the repository by depth and left it
ROOT was `Path(__file__).resolve().parents[3]`, which is correct only while the
script sits at its template home, docs/architecture/scripts/. TOOLS.md tells an
adopting project to take scripts one at a time into its own scripts/, and from
<project>/scripts/doc-triggers.py that expression resolves to the *parent of the
project* -- outside the repository entirely.

The failure is silent and reads as a pass. main() opens with a `not DOCS.is_dir()`
guard that prints and returns 0, so an adopting project got exit 0 and one line
naming a directory two levels above the code it was asked about. The check that
enforces "update the triggered documents in the same commit as the code" had
quietly stopped running, in exactly the projects that took the template's advice.

That is the failure GUARDS.md opens with -- a guard that cannot fail is worse
than no guard, because it is trusted -- landed on the tool that polices the
documents. It could not be caught by running it here, because here parents[3] is
right; it takes a copy at the documented location to see it.

The root is now found rather than assumed: walk up from __file__ for a directory
holding both docs/ and .git, then either alone, then `git rev-parse
--show-toplevel`, then give up to the script's own parent. Both directories are
required before docs/ alone so that a repository vendoring a docs/ in some
subdirectory does not anchor on it.

Reproduced in a scratch repository with the script at scripts/, a document
governing src/**, and src/a.py staged: before, "no docs/ directory at <tmp>/docs";
after, the document and its trigger. The in-place layout is unchanged and still
fires DOC_TRUST_MAP.md, TOOLS.md and architecture/README.md.

Exit status is still always 0. This is a prompt, not a gate, so the fix belongs
in root resolution and not in the exit code.

closes #17

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-17 23:39:13 -05:00
..
audit-gate.mjs chore(repo): put the template under version control 2026-08-17 22:44:26 -05:00
backup.sh chore(repo): put the template under version control 2026-08-17 22:44:26 -05:00
check-env.sh chore(repo): put the template under version control 2026-08-17 22:44:26 -05:00
commit-mine.sh chore(repo): put the template under version control 2026-08-17 22:44:26 -05:00
controls.sh feat(ops): controls.sh, which controls this project actually has 2026-08-17 23:11:52 -05:00
dead-code.py chore(repo): put the template under version control 2026-08-17 22:44:26 -05:00
deploy.py chore(repo): put the template under version control 2026-08-17 22:44:26 -05:00
dev.sh chore(repo): put the template under version control 2026-08-17 22:44:26 -05:00
doc-claims.sh chore(repo): put the template under version control 2026-08-17 22:44:26 -05:00
doc-triggers.py fix(tools): doc-triggers found the repository by depth and left it 2026-08-17 23:39:13 -05:00
duplication.py chore(repo): put the template under version control 2026-08-17 22:44:26 -05:00
forgejo-issue.py chore(repo): put the template under version control 2026-08-17 22:44:26 -05:00
healthcheck.sh docs(template): the owner is _null 2026-08-17 22:47:56 -05:00
migrate.sh chore(repo): put the template under version control 2026-08-17 22:44:26 -05:00
preflight.sh feat(security): preflight.sh distinguishes present from in force 2026-08-17 23:30:37 -05:00
prove-guard.sh chore(repo): put the template under version control 2026-08-17 22:44:26 -05:00
release-notes.mjs chore(repo): put the template under version control 2026-08-17 22:44:26 -05:00
release.sh chore(repo): put the template under version control 2026-08-17 22:44:26 -05:00
restore-check.sh feat(ops): restore-check.sh, the other half of backup.sh 2026-08-17 23:07:36 -05:00
scaffold.sh fix(scaffold): new projects were missing two documents they reference 2026-08-17 23:34:12 -05:00
secrets.sh fix(secrets): the scanner printed the credential it found 2026-08-17 23:08:57 -05:00
status.sh chore(repo): put the template under version control 2026-08-17 22:44:26 -05:00
verify.sh chore(repo): put the template under version control 2026-08-17 22:44:26 -05:00