modified: .gitlab-ci.yml modified: bench/qa_questions.txt modified: bench/qa_sweep.py modified: bench/run.sh modified: docs/TICKETS.md modified: docs/_source/README.md modified: docs/_source/_ext/makefile_targets.py modified: docs/_source/api/cli.rst modified: docs/_source/api/distill.rst modified: docs/_source/api/mesh.rst modified: docs/_source/api/qa.rst modified: docs/_source/api/retrieval.rst modified: docs/_source/api/storage.rst modified: docs/_source/api/substrate.rst modified: docs/_source/concepts.rst modified: docs/_source/conf.py modified: docs/_source/cookbook.rst modified: docs/_source/index.rst modified: docs/_source/license.rst modified: docs/_source/quickstart.rst modified: docs/bench-maxing.md modified: docs/benchmarks.md modified: docs/cti-architecture.md modified: docs/diagrams/aborist-modules.dot modified: docs/diagrams/aborist-modules.svg modified: docs/diagrams/mesh-data-flow.dot modified: docs/diagrams/mesh-epoch-lifecycle.dot modified: docs/diagrams/mesh-epoch-lifecycle.svg modified: docs/diagrams/mesh-group-decisions.dot modified: docs/diagrams/mesh-group-decisions.svg modified: docs/diagrams/mesh-identity-stack.dot modified: docs/diagrams/mesh-secret-envelope.dot modified: docs/mesh.md modified: docs/qa-modes-bench.md modified: docs/seven-point-program.md modified: docs/tickets/ticket-000001-retrieval-keywords-audit-gap.md modified: docs/tickets/ticket-000002-reference-frame-polarity-contract.md modified: docs/tickets/ticket-000003-anchor-class-warrant.md modified: docs/tickets/ticket-000005-label-ladder-migration.md modified: docs/tickets/ticket-000006-bench-emergent-findings.md modified: docs/tickets/ticket-000007-query-layer-hyphen-fold.md modified: docs/tickets/ticket-000008-broad-quantifier-preflight-guard.md modified: docs/tickets/ticket-000009-quantifier-preflight-dag-binding.md modified: docs/tickets/ticket-000010-metacognition-preflight-guard.md modified: docs/tickets/ticket-000011-soft-preflight-hint-sidecar.md modified: scripts/backfill_concepts.py modified: scripts/bench_emergent.py modified: tests/crawler/test_async_web_fetcher.py modified: tests/crawler/test_bridge.py modified: tests/crawler/test_web_fetch.py modified: tests/test_bench_qa_sweep.py modified: tests/test_burn.py modified: tests/test_burn_doc.py modified: tests/test_claim_lattice.py modified: tests/test_cli_render.py modified: tests/test_compress.py modified: tests/test_concepts.py modified: tests/test_dag.py modified: tests/test_directives.py modified: tests/test_distill.py modified: tests/test_distill_recursive.py modified: tests/test_evict.py modified: tests/test_frame.py modified: tests/test_grok_source.py modified: tests/test_html_source.py modified: tests/test_ingest.py modified: tests/test_inspect.py modified: tests/test_journal.py modified: tests/test_keys.py modified: tests/test_llm_context_base.py modified: tests/test_merkle.py modified: tests/test_mesh.py modified: tests/test_mesh_aead.py modified: tests/test_mesh_chain.py modified: tests/test_mesh_cli.py modified: tests/test_mesh_cli_pull.py modified: tests/test_mesh_wire.py modified: tests/test_mesh_wire_e2e.py modified: tests/test_metacognition.py modified: tests/test_migration_audit_mode.py modified: tests/test_providence_source.py modified: tests/test_qa.py modified: tests/test_qa_quality_live.py modified: tests/test_quantifier_caps.py modified: tests/test_quantifier_classifier.py modified: tests/test_quantifier_phase4.py modified: tests/test_quantifier_reminder.py modified: tests/test_query.py modified: tests/test_reclassify.py modified: tests/test_repair.py modified: tests/test_resume.py modified: tests/test_snapshot.py modified: tests/test_soft_preflight.py modified: tests/test_tfidf.py modified: tests/test_vcs_source.py modified: tests/test_verify.py modified: tests/test_verify_json.py modified: tests/test_versioned_ingest.py modified: tests/test_warrant.py modified: tests/test_wikipedia_old.py modified: tests/test_wikipedia_xml.py modified: tests/test_wikitext.py
213 lines
7.2 KiB
Python
213 lines
7.2 KiB
Python
"""Generate docs/_source/api/makefile.rst from Makefile ## annotations.
|
|
|
|
Convention: every documented target has the form
|
|
target-name: deps ## one-line description
|
|
|
|
Targets are grouped into workflow phases (manual mapping below) rather
|
|
than alphabetical prefix, because phase tells a new reader the order
|
|
they'd actually run things.
|
|
"""
|
|
|
|
from pathlib import Path
|
|
import re
|
|
|
|
TARGET_RE = re.compile(r"^([a-zA-Z0-9_-]+):.*?##\s*(.*)$")
|
|
|
|
# Workflow phases. Order = the order a new operator usually runs them.
|
|
# Targets not listed here go into UNCATEGORIZED so we notice on review.
|
|
PHASES: list[tuple[str, str, list[str]]] = [
|
|
(
|
|
"Setup",
|
|
"One-time installation. Creates the venv and (optionally) the "
|
|
"crawler's heavy extras. Re-running is a no-op when up to date.",
|
|
["bootstrap", "bootstrap-crawler", "all"],
|
|
),
|
|
(
|
|
"Fetch",
|
|
"Download corpus snapshots into ``data/``. Idempotent — ``curl`` "
|
|
"skips files already present.",
|
|
["fetch", "fetch-cur", "fetch-old", "fetch-xml", "fetch-abstract"],
|
|
),
|
|
(
|
|
"Ingest",
|
|
"Parse a source into Merkle-committed shards. ``-attached`` "
|
|
"variants are the canonical sharded path (one SQLite per shard, "
|
|
"no WAL contention). Single-DB variants are for experiments.",
|
|
[
|
|
"ingest",
|
|
"ingest-cur",
|
|
"ingest-cur-attached",
|
|
"ingest-old",
|
|
"ingest-old-attached",
|
|
"ingest-xml",
|
|
"ingest-xml-history",
|
|
"ingest-xml-attached",
|
|
"ingest-abstract",
|
|
"ingest-grok-attached",
|
|
"ingest-grok-media-attached",
|
|
"ingest-self",
|
|
"ingest-self-providence",
|
|
"ingest-git",
|
|
"ingest-hg",
|
|
"crawl-ingest",
|
|
"recrawl-check",
|
|
],
|
|
),
|
|
(
|
|
"Distill",
|
|
"Surface → core distillation. Cores are Merkle-bound back to "
|
|
"their source chunks via inclusion proofs.",
|
|
[
|
|
"distill-shards-parallel",
|
|
"distill-shards-tfidf-parallel",
|
|
"backfill-concepts",
|
|
],
|
|
),
|
|
(
|
|
"Query",
|
|
"Ask the corpus a question. ``query-dry`` skips the LLM call "
|
|
"and returns the assembled context — useful for prompt iteration.",
|
|
["query", "query-dry", "search"],
|
|
),
|
|
(
|
|
"Verify and inspect",
|
|
"Round-trip Merkle proofs, audit chain integrity, sidecar "
|
|
"diagnostics on cached answers.",
|
|
[
|
|
"verify",
|
|
"verify-shards",
|
|
"chain-check",
|
|
"chain-check-shards",
|
|
"analyze-shards",
|
|
"stats",
|
|
"stats-shards",
|
|
"activity",
|
|
"inspect",
|
|
],
|
|
),
|
|
(
|
|
"Operations on cached records",
|
|
"Mark a record falsified (audit-preserving) or burn it from "
|
|
"the database (refuses if it has children unless ``FORCE=1``).",
|
|
["falsify", "burn", "burn-kindergarten"],
|
|
),
|
|
(
|
|
"Tests and benches",
|
|
"Default test suite excludes opt-in crawler tests. ``bench-qa`` "
|
|
"runs the full QA-quality sweep; ``bench-qa-smoke`` is the 5-question "
|
|
"fast loop.",
|
|
[
|
|
"test",
|
|
"test-crawler",
|
|
"test-live",
|
|
"bench",
|
|
"bench-qa",
|
|
"bench-qa-smoke",
|
|
"bench-emergent",
|
|
"bench-emergent-pending",
|
|
],
|
|
),
|
|
(
|
|
"Docs",
|
|
"Render diagrams (graphviz) and build the Sphinx API reference. "
|
|
"RTD rebuilds on push; these targets are for local previews.",
|
|
["docs", "docs-api", "docs-api-clean"],
|
|
),
|
|
(
|
|
"Clean",
|
|
"Reversible by re-running the matching ``bootstrap`` / ``fetch`` "
|
|
"/ ``ingest`` target. ``clean-data`` deletes the largest payload "
|
|
"(downloaded dumps).",
|
|
["clean", "clean-db", "clean-data", "help"],
|
|
),
|
|
]
|
|
|
|
|
|
def parse_makefile(makefile_path: Path) -> dict[str, str]:
|
|
"""Return {target: description} from a Makefile."""
|
|
targets = {}
|
|
for line in makefile_path.read_text(encoding="utf-8").splitlines():
|
|
m = TARGET_RE.match(line)
|
|
if m:
|
|
targets[m.group(1)] = m.group(2).strip()
|
|
return targets
|
|
|
|
|
|
def generate_rst(all_targets: dict[str, str], output_path: Path) -> None:
|
|
"""Write a single RST page grouping every target by workflow phase."""
|
|
lines = [
|
|
"Makefile reference",
|
|
"==================",
|
|
"",
|
|
"Every arborist workflow lives behind a ``make`` target. This page is",
|
|
"auto-generated from the project ``Makefile``'s ``## description``",
|
|
"annotations at Sphinx build time, so it stays in sync with the source.",
|
|
"",
|
|
"Run ``make help`` locally for a flat alphabetized listing.",
|
|
"",
|
|
".. note::",
|
|
"",
|
|
" Targets are grouped below by **workflow phase**, in the order a",
|
|
" new operator typically runs them. The first row of each table is",
|
|
" the most common entry point for that phase.",
|
|
"",
|
|
]
|
|
|
|
used: set[str] = set()
|
|
for phase_title, blurb, target_names in PHASES:
|
|
# Filter to targets that actually exist in the parsed Makefile.
|
|
present = [(t, all_targets[t]) for t in target_names if t in all_targets]
|
|
if not present:
|
|
continue
|
|
used.update(t for t, _ in present)
|
|
|
|
lines.append(phase_title)
|
|
lines.append("-" * len(phase_title))
|
|
lines.append("")
|
|
lines.append(blurb)
|
|
lines.append("")
|
|
lines.append(".. list-table::")
|
|
lines.append(" :widths: 30 70")
|
|
lines.append(" :header-rows: 1")
|
|
lines.append("")
|
|
lines.append(" * - Target")
|
|
lines.append(" - Description")
|
|
for name, desc in present:
|
|
lines.append(f" * - ``make {name}``")
|
|
lines.append(f" - {desc}")
|
|
lines.append("")
|
|
|
|
# Surface anything we forgot to categorize so it shows up in review.
|
|
leftover = [(t, d) for t, d in all_targets.items() if t not in used]
|
|
if leftover:
|
|
lines.append("Uncategorized")
|
|
lines.append("-------------")
|
|
lines.append("")
|
|
lines.append(
|
|
"Targets not yet placed in a workflow phase. If you see one here, "
|
|
"add it to ``docs/_source/_ext/makefile_targets.py`` ``PHASES``."
|
|
)
|
|
lines.append("")
|
|
lines.append(".. list-table::")
|
|
lines.append(" :widths: 30 70")
|
|
lines.append(" :header-rows: 1")
|
|
lines.append("")
|
|
lines.append(" * - Target")
|
|
lines.append(" - Description")
|
|
for name, desc in sorted(leftover):
|
|
lines.append(f" * - ``make {name}``")
|
|
lines.append(f" - {desc}")
|
|
lines.append("")
|
|
|
|
output_path.write_text("\n".join(lines), encoding="utf-8")
|
|
|
|
|
|
def setup(app):
|
|
"""Sphinx hook: regenerate makefile.rst at the start of every build."""
|
|
project_root = Path(app.srcdir).parent.parent
|
|
makefile = project_root / "Makefile"
|
|
output = Path(app.srcdir) / "api" / "makefile.rst"
|
|
if makefile.exists():
|
|
targets = parse_makefile(makefile)
|
|
generate_rst(targets, output)
|
|
return {"version": "1.1", "parallel_read_safe": True}
|