--- name: page description: Organize a discussion's artifacts into a named, ordered tree of wiki pages — import a directory of markdown, give every file a title, build the index, see what a space holds. Entirely offline; pages are local markdown files and need no wiki. Load when the user asks to turn notes/artifacts into wiki pages, organize or re-title a page tree, or rebuild a table of contents. For fetching from or publishing to a Gitea wiki, load /tea:wiki instead. --- # /tea:page — discussion artifacts as a page tree A discussion produces artifacts wherever the discussion happened — a directory of markdown with numbered files and subdirectories. This skill turns that into a **space**: a named, ordered tree of pages with a manifest, living under `tmp/wiki/`. **Nothing here touches the network.** No `tea`, no Gitea, no login. A space that never leaves this machine is a finished thing, not a draft waiting for an upload. Publishing is a separate, optional layer — `/tea:wiki`. Read [`references/pages.md`](references/pages.md) before importing or re-titling. It is the single source of truth for titles, ordering, paths, the manifest, and the index. ## Identity: the title `Simple Chains/Ideas/Chain core`. The `/` is the only hierarchy there is — the wiki this feeds is flat and has no directories. The local path is derived from the title (`Simple-Chains/Ideas/Chain-core.md`); the reverse never happens. A title is chosen **once**, at import or at pull, and then it is a fact in the manifest. Editing a heading does not rename a page. Renaming is `--retitle`, and on a published page it orphans the old one. ## Scripts All offline, all in `/scripts/`. | Script | What it does | |---|---| | `page_import.py --from DIR [--space S] [--prefix T]` | copy a directory of markdown into a space, titling every file | | `page_index.py [--space S] [--prefix T]` | write the table-of-contents page — the navigation the flat wiki cannot provide | | `page_ls.py [--space S] [--prefix T]` | the tree, the titles, and one sync-state tag per page | | `page.py` | the domain module the others import — not a command | ``` tmp/wiki/claude-skills/tea/ a space .pages.json the manifest — titles, order, sync bookkeeping Simple-Chains.md the index page Simple-Chains/Ideas.md title: Simple Chains/Ideas Simple-Chains/Ideas/Chain-core.md title: Simple Chains/Ideas/Chain core ``` ## The usual run ```bash python3 scripts/page_import.py \ --from ~/proj/tmp/simple-chains \ --space claude-skills/tea --prefix "Simple Chains" --dry-run ``` `--dry-run` first, always: it prints every path and the title it would get, and that listing is the only chance to catch a heading that titles a page badly before the name becomes a decision. Drop the flag to write. Then the index, then look at it: ```bash python3 scripts/page_index.py --space claude-skills/tea --prefix "Simple Chains" python3 scripts/page_ls.py --space claude-skills/tea --prefix "Simple Chains" ``` `page_ls.py` tags each page `local` (never published), `synced` (published and unchanged), or `ahead` (edited since it was published). `local` is a complete state. ## Where the cache is `/tmp/wiki` — **not** `tmp/wiki` relative to wherever you are standing. The scripts resolve it by walking up from their own file to the nearest `.git` or `AGENTS.md`, so they all see one cache no matter which directory they are run from. `--out` overrides that and is taken **literally**: an absolute path is used as given, a relative one stays relative to the current directory. ## Re-importing is the normal refresh The discussion continues, the artifacts change, run the same import again. Bodies are replaced, titles are kept, `sub_url` and the rest of the wiki bookkeeping survive — so the next push updates the pages that already exist instead of publishing a second copy of each.