feat: export guidelines - the guideline pages as a generated GUIDELINES.md, pushed into the captured repositories behind the Guideline Push Gate (#179)
CI / verify (push) Successful in 5m40s
CI / pwsh (push) Successful in 1m59s
Release / release (push) Successful in 35s

Files changed:
- AGENTS.md
- CHANGES.md
- README.md
- VERSION
- docs/why-gates-are-code.md
- instructions/gates.md
- instructions/kb-profiles.md
- kb/CONTRACT.md
- kb/CONVENTIONS.md
- kb/CONVENTIONS.md.template
- raw/CONTRACT.md
- tools/CONTRACT.md
- tools/README.md
- tools/chemenu/cli.py
- tools/chemenu/cli_contract.py
- tools/chemenu/commands/export_cmd.py
- tools/chemenu/commands/page_ops.py
- tools/chemenu/commands/raw_cmd.py
- tools/chemenu/commands/search.py
- tools/chemenu/guideline_export.py
- tools/chemenu/kb_scan.py
- tools/chemenu/repo_capture.py
- tools/chemenu/search/filters.py
- tools/chemenu/tests/test_cli.py
- tools/chemenu/tests/test_export_guidelines.py

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SnAJ7Z3CpVD3PRbN73QtU2
This commit is contained in:
torbenandClaude Opus 5.5 committed 2026-10-06 06:48:07 +02:00
1 parent ccede04b97
commit 283cdae8be
25 files changed
+1753 -68

No files matched your search

+47 -1
View File
@@ -59,7 +59,7 @@ concern - readable here, never shipped as something to parse.
---
## 8.0.0-beta.43 - 2026-10-05 - wiki-ingest: updating the captured repositories is a step-1 branch over raw status
## 8.0.0-beta.44 - 2026-10-06 - export guidelines: the guideline pages as a generated GUIDELINES.md, pushed into the captured repositories behind the Guideline Push Gate
**Author:** Torben Nehmer
@@ -110,6 +110,7 @@ concern - readable here, never shipped as something to parse.
- Comparison and source pages accept the sources: that cite add writes; sources may cite sources
- raw capture / raw status / --replaces-bundle: documentation from git repositories as a bundle, with drift reporting
- wiki-ingest: updating the captured repositories is a step-1 branch over raw status
- export guidelines: the guideline pages as a generated GUIDELINES.md, pushed into the captured repositories behind the Guideline Push Gate
**Low impact**
- version bump no longer points at version release in its output
@@ -156,6 +157,51 @@ concern - readable here, never shipped as something to parse.
- raw accept: an occupied folder name held by a captured bundle points at --replaces-bundle
<!-- /wikitool:bumps -->
### export guidelines: the guideline pages as a generated GUIDELINES.md, pushed into the captured repositories behind the Guideline Push Gate
The other direction of `raw capture`. Project repositories each carried their own copy of the
same agent rules, drifting apart; the instance now holds them once and delivers them as a
generated, committed file, so each repository works on its own - in CI, without MCP.
- **`export guidelines <predicates>`** selects pages with `search`'s own predicates and no text
(`--field`, `--kind`, `--subtype`, `--collection`, `--tag`), and prints one `GUIDELINES.md`.
Line 1 is `<!-- wikitool:export kind=guidelines instance=<origin URL without userinfo, or
local> commit=<newest commit touching a selected page> - generated, do not edit by hand -->`;
then each page by title as `# <title>` and its text without frontmatter, the generated links and
footnotes regions and citation markers, with wikilinks turned into their text - code left
byte for byte. No timestamp and not `HEAD`: the same pages give the same bytes, so an instance
commit that touches no guideline changes no target repository. It refuses with no predicate, no
match, an unknown field, any unreadable frontmatter under `kb/`, or uncommitted changes in `kb/`
or `types/`.
- **`--push`** writes that file into every captured repository - the `(repo, ref)` of each
`_capture.json`, `--bundle` narrowing it - that opted in by carrying a `GUIDELINES.md` whose
first line is the export header; a header line alone is the opt-in. A hand-written file, one
from another `instance=`, a tag rule, and an unreachable repository are skipped with the reason.
Each written target gets one commit on the fetched tip changing only `GUIDELINES.md`, built with
plumbing in the bare capture cache (no working tree), authored as the instance checkout's
`user.name`/`user.email`, and pushed without force; a branch that moved since the fetch is
rejected, read from `push --porcelain`'s status flag rather than git's translated messages.
- **The Guideline Push Gate** - a fifth named gate. `--push` without a matching `--confirm`
pushes nothing and exits 42 with each target's status, the diff of every file it would write,
and the re-run line; the token digests URL, branch, old tip and new blob of every target to
write. Nothing to write means no gate. The Publish-Remote Gate does not apply - the targets are
declared by the committed manifests already.
- **No way back in:** `raw accept` refuses a file whose first line starts with
`<!-- wikitool:export`, given on its own, inside a folder, or as `--replaces`/`--replaces-bundle`
material - `raw capture` already left such files out. `EXPORT_MARKER` now lives once, in the new
core module `guideline_export.py`.
Which pages are guidelines is an instance decision: `kb/CONVENTIONS.md` (and its template) has a
new section § Guidelines for other repositories; this instance's filter is `--tag guideline`.
`kb/CONTRACT.md` says what leaving the wiki does to a page; `raw/CONTRACT.md`, `AGENTS.md`
§ Gates, `instructions/gates.md`, `docs/why-gates-are-code.md`, `README.md` and
`tools/README.md` follow. Internals: `kb_scan.LINK_RE` (moved from `commands/page_ops`, which
re-exports it), `filters.raw_predicates` shared with `search`, `repo_capture.run_git_result` and
`captured_manifests` shared with `raw status`.
A new command and a new refusal for files no tool produced before - drop-in in both directions,
no page or manifest changes (Gitea #179).
### wiki-ingest: updating the captured repositories is a step-1 branch over raw status
`raw status`, `raw capture --update` and `raw accept --replaces-bundle` existed, but nothing told