`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>
65 lines
2.2 KiB
Python
65 lines
2.2 KiB
Python
"""Transport for the `wiki` domain — args in, delegate, format out.
|
|
|
|
Two verbs, deliberately not four. `wiki_sync` also holds `generate_wiki()`
|
|
(systems.db → system pages) and `import_from_wiki()` (pages → systems.db), and
|
|
neither is exposed: re-rendering today would delete ~10,700 lines of the
|
|
committed pages (see wiki_sync's docstring, T-1290). A verb is a promise that
|
|
running it is safe, and that one would not be. They come back when the
|
|
renderer reproduces the committed pages byte-for-byte.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
import typer
|
|
|
|
from tooling.core import cli, console
|
|
from tooling.core.command import command
|
|
|
|
app = cli.domain("wiki", "The wiki seed — fill rates and the GTTR hook.")
|
|
|
|
|
|
@app.callback()
|
|
def _domain() -> None:
|
|
"""Keeps `wiki` a group (Typer collapses a single-command app)."""
|
|
|
|
|
|
@app.command("stats")
|
|
@command
|
|
def stats() -> None:
|
|
"""Fill rates of the structured star-system columns in systems.db."""
|
|
from tooling.domains.wiki import wiki_sync
|
|
|
|
wiki_sync.stats()
|
|
|
|
|
|
@app.command("gttr-hook")
|
|
@command
|
|
def gttr_hook(
|
|
db: Path = typer.Option(None, "--db", help="systems.db to write (default: server/data/systems.db)."),
|
|
system: str = typer.Option(None, "--system", help="Only this system_id, e.g. 'GJ 71'."),
|
|
max_words: int = typer.Option(45, "--max-words", help="Soft cap on hook length."),
|
|
dry_run: bool = typer.Option(False, "--dry-run", help="Extract, write nothing."),
|
|
verbose: bool = typer.Option(False, "--verbose", help="Print every extracted hook."),
|
|
) -> None:
|
|
"""Extract each system's GTTR opening line into star_systems.gttr_hook.
|
|
|
|
Reads wiki/star-systems/<GJ-id>/gttr.md, takes the first **NAME**
|
|
paragraph, collapses and caps it. Re-run after editing any gttr.md.
|
|
"""
|
|
from tooling.domains.wiki import gttr_hook as service
|
|
|
|
counts = service.run(
|
|
db or service.DB_PATH,
|
|
system=system,
|
|
max_words=max_words,
|
|
dry_run=dry_run,
|
|
verbose=verbose,
|
|
)
|
|
written = "extracted, nothing written (dry run)" if dry_run else "written"
|
|
console.verdict(
|
|
f"gttr-hook: {counts['updated']} {written}, "
|
|
f"{counts['missing']} missing gttr.md, {counts['unmatched']} unmatched"
|
|
)
|