`reach wiki stats` and `reach wiki gttr-hook` replace tooling/db/wiki_sync.py and populate_gttr_hook.py. Both are output-identical to the originals: `stats` byte-for-byte, and all 301 extracted GTTR hooks line-for-line. wiki_sync.py moved whole, but generate_wiki() and import_from_wiki() are NOT verbs. Before porting, the old `--generate` was run against a clean tree to get a parity baseline. It changed all 301 system pages, +940 / -10,761, and was reverted at once. It deletes the Celestial Bodies / Stations blocks (owned by the Rust atlas sync, which it does not know about), deletes the Industries / Exports / Imports rows (nothing writes those any more), and rewrites star types where systems.db and the pages disagree. D-262, CLAUDE.md and the wiki skill all described it as the routine, prose-preserving render. CLAUDE.md and the skill now say not to run it; D-262 needs amending — T-1292. Provenance moves to tooling/archive/, with a README naming what each script did and why it is not run: - pql-migrate/ (the T-1271 ruling) - wiki-bootstrap/: assign-astro-ids + its catalog, migrate-s-to-gj, patch-core-sector (hardcodes a dead path), fill-missing-globes, generate-stubs and find-stubs (finds 0 stubs — Phase 1 is done), backfill_cultural_corridor (a raw systems.db patch script, outside D-262), and process-wiki-system-changes, whose last step is the destructive render Also: - stats() printed "run import first" and exited 0 when a table was missing; it now fails with a remedy. generate_wiki() counted created pages after writing them, so `created` was always 0. - tooling/godot-cold-parse and godot-parse-sweep were never retired after T-1283, and the pr-process skill still told agents to run them. Removed; the skill and parse_sweep.gd now name the reach verbs. - systems.db re-stamped: schema comments changed, and the stamp records the schema file's SHA for tamper detection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
84 lines
3.3 KiB
Python
84 lines
3.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Repoint decisions/ PATH references to the governance/ DQR tree (pql migration, Phase 1).
|
|
|
|
Operates on the active instruction layer (agent + skill markdown). Ordered, literal
|
|
string replacements — most-specific first, bare `decisions/` last so per-file paths
|
|
keep their decisions/ subdir. Does NOT touch command references (tooling/db/decision*,
|
|
decisions-sync) — those belong to the Phase 4 command cutover. Does NOT touch
|
|
historical archives (docs/sprints, docs/discussions, docs/workshops) or the separate
|
|
whatsinagame/ template distribution.
|
|
|
|
Default is a dry run. Pass --apply to write.
|
|
"""
|
|
import glob
|
|
import re
|
|
import sys
|
|
|
|
APPLY = "--apply" in sys.argv
|
|
|
|
# Ordered: specific globs/files first, per-domain D files next, bare dir LAST.
|
|
# The bare-dir rule is a regex with a negative lookbehind so it never re-matches
|
|
# the `decisions/` inside a `governance/decisions/...` path created by an earlier
|
|
# rule (which would corrupt it to `governance/governance/...`).
|
|
REPLACEMENTS = [
|
|
("decisions/questions-*.md", "governance/questions/*.md"),
|
|
("decisions/*.md", "governance/**/*.md"),
|
|
("decisions/README.md", "governance/README.md"),
|
|
("decisions/questions.md", "governance/README.md"),
|
|
("decisions/rejected.md", "governance/rejected/"),
|
|
("decisions/architecture.md", "governance/decisions/architecture.md"),
|
|
("decisions/content.md", "governance/decisions/content.md"),
|
|
("decisions/economics.md", "governance/decisions/economics.md"),
|
|
("decisions/perception.md", "governance/decisions/perception.md"),
|
|
("decisions/process.md", "governance/decisions/process.md"),
|
|
("decisions/scope.md", "governance/decisions/scope.md"),
|
|
(re.compile(r"(?<!governance/)decisions/"), "governance/"), # bare dir — must be last
|
|
]
|
|
|
|
# One-shot transform, already applied (decisions/ path refs -> governance/). The
|
|
# absolute paths below are the canonical main checkout where it was run; kept
|
|
# committed for provenance.
|
|
TARGETS = sorted(set(
|
|
glob.glob("/var/mnt/data/projects/settled-reach/main/.claude/agents/*.md")
|
|
+ glob.glob("/var/mnt/data/projects/settled-reach/main/.claude/skills/**/*.md", recursive=True)
|
|
))
|
|
|
|
|
|
def transform(text):
|
|
changes = []
|
|
for old, new in REPLACEMENTS:
|
|
if isinstance(old, re.Pattern):
|
|
n = len(old.findall(text))
|
|
if n:
|
|
text = old.sub(new, text)
|
|
changes.append((old.pattern, new, n))
|
|
elif old in text:
|
|
n = text.count(old)
|
|
text = text.replace(old, new)
|
|
changes.append((old, new, n))
|
|
return text, changes
|
|
|
|
|
|
def main():
|
|
print(f"=== repath_references.py ({'APPLY' if APPLY else 'DRY-RUN'}) ===\n")
|
|
total = 0
|
|
for path in TARGETS:
|
|
with open(path, encoding="utf-8") as fh:
|
|
text = fh.read()
|
|
new_text, changes = transform(text)
|
|
if not changes:
|
|
continue
|
|
rel = path.split("/main/", 1)[-1]
|
|
print(rel)
|
|
for old, new, n in changes:
|
|
print(f" {n}x {old!r} -> {new!r}")
|
|
total += n
|
|
if APPLY:
|
|
with open(path, "w", encoding="utf-8") as fh:
|
|
fh.write(new_text)
|
|
print(f"\n{total} replacement(s)." + ("" if APPLY else " (dry run — pass --apply)"))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|