Prompt file imported from vuonglq01685/strata-kb (
.github/prompts/kb-publish.prompt.md). Copyright stays with the author.
/kb-publish — diff → confirm → publish (PR on the hub)
The hub federation is the single source of truth: content is searchable only
after the publish PR is merged on the hub. Local .kb/ is just a drafting desk.
NEVER run kb publish until the user has explicitly confirmed, after
seeing the diff, that the current .kb/ state should be published.
Workflow
- Check state. Run
kb status. If any section is stillpending, stop and tell the user to summarize first (kb summarize, or the kb-summarize skill). - Show what will be published. Run
kb doctor— it reports whether local .kb differs from the published snapshot. In abaordevrepo it asks the hub over MCP (kb mcp-setup), never a hub clone. If it cannot reach the hub, stop: the user runskb mcp-setup(in a cloud session: setsSTRATA_KB_HUB_URLandSTRATA_KB_HTTP_TOKENin the environment, since.envis not committed), then publish again. For each doc with changes, runkb diff <doc-id> --against HEAD(use another git rev if the user names one) and present the added/changed sections. In abarepo,kb publishfirst regenerates<repo_id>-planwithkb plan-ingest; runkb plan-ingestto see what will ship and what is skipped (kb doctordoes not diff-plan). Both.kb/<repo_id>-plan/and.kb/index.yamlare generated and gitignored there. - Confirm — the gate. State where it goes. With
intake:in.kb/config.yaml,kb publishpushes akb-publish/*tag, CI uploads to that intake URL and the hub opens the PR: no hub clone and nohub:needed. In abarepo a push tomainthat changesmissions/ortickets/also publishes (kb-publish-request.ymltags the merged commit), so a merged PR needs nokb publish. Otherwise state the hub (from.kb/config.yaml, orSTRATA_KB_HUBif set) and that a publish PR will be opened on it (direct is picked for a hub with no git remote). Also state the repo's kind and the hub menu it lands in, askb publishprints it:kind: <hub kind> → hub menu: <Document|Ticket|Code>(hubandchildrepos → Document,ba→ Ticket,dev→ Code). Read the kind fromkind:in.kb/config.yaml, or the[info] kind: …linekb doctorprints. If the kind is unrecorded, stop: tell the user to runkb init --kind <child|ba|dev|hub>first. Ask for one explicit go/no-go and wait. - Execute (only after confirmation):
kb publish. Relay the result: thekind: … → hub menu: …line, repo-id, source commit, doc count, and the PR URL — remind the user the content goes live when that PR is merged on the hub. - Errors.
- Kind unrecorded (message mentions
kb init --kind) → stop; the user runskb init --kind <child|ba|dev|hub>, then publishes again. - Missing hub config (only without
intake:) → tell the user to fillhub:in.kb/config.yaml; a ba/dev repo whose people cannot clone the hub setsintake:instead. ghmissing in PR mode → install GitHub CLI, orkb publish --directonly if direct pushes are allowed for this hub.- Tag push refused (e.g. HTTP 403 where only the branch may be pushed,
as in a cloud session) in a
barepo → nothing was published; merge the change intomain, which publishes it, or runkb-publish-request.ymlby hand onmain. - Other git/hub errors → show the stderr and suggest
kb doctor.
- Kind unrecorded (message mentions
