@docsworth/cli 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +55 -0
- package/README.md +238 -2
- package/dist/cli.d.ts +11 -0
- package/dist/cli.js +458 -0
- package/dist/core/acl.d.ts +37 -0
- package/dist/core/acl.js +136 -0
- package/dist/core/adopt.d.ts +68 -0
- package/dist/core/adopt.js +665 -0
- package/dist/core/audit-log.d.ts +133 -0
- package/dist/core/audit-log.js +290 -0
- package/dist/core/blocks.d.ts +35 -0
- package/dist/core/blocks.js +417 -0
- package/dist/core/codeowners.d.ts +62 -0
- package/dist/core/codeowners.js +133 -0
- package/dist/core/config.d.ts +101 -0
- package/dist/core/config.js +175 -0
- package/dist/core/coverage.d.ts +25 -0
- package/dist/core/coverage.js +41 -0
- package/dist/core/duration.d.ts +20 -0
- package/dist/core/duration.js +60 -0
- package/dist/core/edits.d.ts +13 -0
- package/dist/core/edits.js +20 -0
- package/dist/core/errors.d.ts +11 -0
- package/dist/core/errors.js +13 -0
- package/dist/core/frontmatter.d.ts +29 -0
- package/dist/core/frontmatter.js +49 -0
- package/dist/core/gate.d.ts +17 -0
- package/dist/core/gate.js +25 -0
- package/dist/core/gfm.d.ts +13 -0
- package/dist/core/gfm.js +244 -0
- package/dist/core/github.d.ts +152 -0
- package/dist/core/github.js +234 -0
- package/dist/core/host.d.ts +125 -0
- package/dist/core/host.js +22 -0
- package/dist/core/identity.d.ts +39 -0
- package/dist/core/identity.js +127 -0
- package/dist/core/init.d.ts +25 -0
- package/dist/core/init.js +86 -0
- package/dist/core/links.d.ts +82 -0
- package/dist/core/links.js +345 -0
- package/dist/core/lint.d.ts +16 -0
- package/dist/core/lint.js +149 -0
- package/dist/core/mcp/audit-transport.d.ts +16 -0
- package/dist/core/mcp/audit-transport.js +238 -0
- package/dist/core/mcp/server.d.ts +19 -0
- package/dist/core/mcp/server.js +216 -0
- package/dist/core/mcp/text.d.ts +14 -0
- package/dist/core/mcp/text.js +43 -0
- package/dist/core/mirror-view.d.ts +68 -0
- package/dist/core/mirror-view.js +367 -0
- package/dist/core/new-page.d.ts +52 -0
- package/dist/core/new-page.js +49 -0
- package/dist/core/policy.d.ts +10 -0
- package/dist/core/policy.js +30 -0
- package/dist/core/polish.d.ts +42 -0
- package/dist/core/polish.js +1000 -0
- package/dist/core/printable.d.ts +4 -0
- package/dist/core/printable.js +16 -0
- package/dist/core/references.d.ts +87 -0
- package/dist/core/references.js +1744 -0
- package/dist/core/repo.d.ts +46 -0
- package/dist/core/repo.js +118 -0
- package/dist/core/schema.d.ts +50 -0
- package/dist/core/schema.js +51 -0
- package/dist/core/search.d.ts +32 -0
- package/dist/core/search.js +132 -0
- package/dist/core/serve/auth.d.ts +23 -0
- package/dist/core/serve/auth.js +38 -0
- package/dist/core/serve/server.d.ts +21 -0
- package/dist/core/serve/server.js +138 -0
- package/dist/core/serve/sessions.d.ts +40 -0
- package/dist/core/serve/sessions.js +203 -0
- package/dist/core/serve/token.d.ts +10 -0
- package/dist/core/serve/token.js +96 -0
- package/dist/core/service.d.ts +473 -0
- package/dist/core/service.js +973 -0
- package/dist/core/sla.d.ts +16 -0
- package/dist/core/sla.js +20 -0
- package/dist/core/stale.d.ts +16 -0
- package/dist/core/stale.js +24 -0
- package/dist/core/tool-registry.d.ts +31 -0
- package/dist/core/tool-registry.js +80 -0
- package/dist/core/url.d.ts +4 -0
- package/dist/core/url.js +31 -0
- package/dist/core/verify-pages.d.ts +19 -0
- package/dist/core/verify-pages.js +110 -0
- package/dist/core/version.d.ts +22 -0
- package/dist/core/version.js +32 -0
- package/dist/core/writes.d.ts +58 -0
- package/dist/core/writes.js +113 -0
- package/dist/web/assets/index-8J-FUbb0.js +29 -0
- package/dist/web/assets/index-BGpAZzeM.css +1 -0
- package/dist/web/index.html +14 -0
- package/docs/format-spec.md +349 -0
- package/package.json +75 -4
- package/plugin/.claude-plugin/plugin.json +8 -0
- package/plugin/.mcp.json +8 -0
- package/plugin/bin/docsworth-mcp.mjs +46 -0
- package/plugin/skills/draft-runbook/SKILL.md +75 -0
- package/plugin/skills/polish-page/SKILL.md +64 -0
- package/plugin/skills/update-after-incident/SKILL.md +59 -0
- package/plugin/skills/verify-page/SKILL.md +46 -0
- package/templates/github/knowledge.yml +51 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: polish-page
|
|
3
|
+
description: Tidy a Docsworth page without changing what it says, by restructuring and rewording it and opening a polish PR for the owning team. Use when someone says "clean up this runbook", "this page is hard to follow", "polish the docs for X", or asks to reformat a page to the runbook sections.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Polish a page
|
|
7
|
+
|
|
8
|
+
A polish makes a page easier to read and act on. It never changes a fact. The server
|
|
9
|
+
backs that up with a structural guard: `propose_edit` with `polish: true` refuses a
|
|
10
|
+
change to the page's code blocks, inline code, links, numbers or negation words. The
|
|
11
|
+
guard can't see meaning, or a command written as plain prose, so the owners still
|
|
12
|
+
review the diff.
|
|
13
|
+
|
|
14
|
+
## 1. Read the page
|
|
15
|
+
|
|
16
|
+
Call `read` with the page id. Work from `content` exactly as returned: it's the page
|
|
17
|
+
body, without the frontmatter, which a polish never touches. If the user named a topic
|
|
18
|
+
rather than a page, `search` first and confirm which page they mean.
|
|
19
|
+
|
|
20
|
+
## 2. Rewrite the body
|
|
21
|
+
|
|
22
|
+
You may:
|
|
23
|
+
|
|
24
|
+
- move sections that hold no code
|
|
25
|
+
- split long paragraphs
|
|
26
|
+
- turn a run of steps into a numbered list
|
|
27
|
+
- fix or add headings. A runbook reads best with `## When to use`, `## Steps`,
|
|
28
|
+
`## Checks` and `## Rollback`.
|
|
29
|
+
- tighten wording
|
|
30
|
+
|
|
31
|
+
Keep these exactly as they are:
|
|
32
|
+
|
|
33
|
+
- every command and code block (fenced or inline), in the same order and under the same
|
|
34
|
+
headings, and each fence's language tag (the word after ```): don't add or drop one
|
|
35
|
+
- every inline code span, link target and URL, and each link's text with its target
|
|
36
|
+
- any struck-through text, and nothing newly struck through
|
|
37
|
+
- each task-list item's box and text, as written
|
|
38
|
+
- every number with the word after it (`5 minutes`, `3 retries`)
|
|
39
|
+
- how often each negation or modal word appears: not, never, no, must, should,
|
|
40
|
+
cannot, can't, don't, doesn't, won't, shouldn't, mustn't, isn't, aren't, only,
|
|
41
|
+
without, unless, except, nor, none, neither, always
|
|
42
|
+
|
|
43
|
+
Don't add or drop facts, and keep steps in their order. If something looks wrong or
|
|
44
|
+
out of date, leave it and say so in the reason. Fixing it is an ordinary edit, which the owners review as one.
|
|
45
|
+
|
|
46
|
+
## 3. Propose it
|
|
47
|
+
|
|
48
|
+
Call `propose_edit` with `id`, `polish: true`, the rewritten text as `body`, and a
|
|
49
|
+
`reason` describing what you restructured. The server keeps the frontmatter as it is.
|
|
50
|
+
|
|
51
|
+
If it refuses, the message names each change the guard saw. Put those back exactly
|
|
52
|
+
and try again. Don't switch to an ordinary edit to get past the guard.
|
|
53
|
+
|
|
54
|
+
If the page shows `[restricted page]`, it links to pages you can't see, and the server
|
|
55
|
+
won't take a polish of it from this session (or any whole-body rewrite). Tell the user
|
|
56
|
+
rather than working around it.
|
|
57
|
+
|
|
58
|
+
If it refuses because this session read pages with a narrower audience, don't work
|
|
59
|
+
around it. Tell the user which page to polish in a fresh session.
|
|
60
|
+
|
|
61
|
+
## 4. Report
|
|
62
|
+
|
|
63
|
+
Give the PR URL and the owning team. Mention anything you noticed that looked wrong,
|
|
64
|
+
since a polish deliberately left it alone.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: update-after-incident
|
|
3
|
+
description: After an incident or postmortem, find the runbooks and service pages it touched and propose corrections to each as pull requests for the owning teams. Use when someone says "update the docs after this incident", "the runbook was wrong during the outage", or shares a postmortem and asks what knowledge needs fixing.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Update knowledge after an incident
|
|
7
|
+
|
|
8
|
+
Incidents are when runbooks prove wrong. The goal is a small, reviewable PR on each
|
|
9
|
+
affected page, each with its evidence from the incident. A rewrite is never the goal.
|
|
10
|
+
|
|
11
|
+
## 1. Extract what actually happened
|
|
12
|
+
|
|
13
|
+
From the postmortem or notes the user gave you, list:
|
|
14
|
+
|
|
15
|
+
- the symptoms and alerts
|
|
16
|
+
- the services involved
|
|
17
|
+
- every command or step responders actually ran
|
|
18
|
+
- what didn't work, and what they did instead
|
|
19
|
+
- any new check or rollback they discovered
|
|
20
|
+
|
|
21
|
+
## 2. Find the affected pages
|
|
22
|
+
|
|
23
|
+
Use the Docsworth `search` tool with the symptoms, then with each service name, passing
|
|
24
|
+
`include_stale: true`. `read` every candidate. A page is affected when the incident
|
|
25
|
+
showed that one of these is wrong or missing:
|
|
26
|
+
|
|
27
|
+
- a step
|
|
28
|
+
- a command
|
|
29
|
+
- a threshold
|
|
30
|
+
- a check
|
|
31
|
+
- a rollback
|
|
32
|
+
|
|
33
|
+
The search results also list excluded pages: overdue, deprecated or draft. Tell the
|
|
34
|
+
user which of those the incident touched and which team owns each. An overdue runbook
|
|
35
|
+
that failed during an incident is the most important thing to surface.
|
|
36
|
+
|
|
37
|
+
## 3. Propose edits, one PR per page
|
|
38
|
+
|
|
39
|
+
For each affected page, call `propose_edit` with:
|
|
40
|
+
|
|
41
|
+
- **`edits`:** exact `old` → `new` replacements. Copy `old` verbatim from the `read`
|
|
42
|
+
result, and include enough surrounding text that it matches exactly once. Prefer
|
|
43
|
+
several small edits to replacing the whole `content`.
|
|
44
|
+
- **`reason`:** the incident id or date, what happened, and which edit fixes what.
|
|
45
|
+
Reviewers read this first.
|
|
46
|
+
- **`draft`:** `true` when you're unsure whether a change is right.
|
|
47
|
+
|
|
48
|
+
Never try to change `id`, `owner_team`, `acl` or `last_verified`; the tool refuses.
|
|
49
|
+
Verification belongs to the owners, through the `verify` tool.
|
|
50
|
+
|
|
51
|
+
If `propose_edit` refuses because this session read pages with a narrower audience,
|
|
52
|
+
don't work around it. Tell the user which page needs the edit and let them open it
|
|
53
|
+
separately.
|
|
54
|
+
|
|
55
|
+
## 4. Report
|
|
56
|
+
|
|
57
|
+
List each PR URL with its page and owning team. Then list the gaps the incident
|
|
58
|
+
revealed where no page exists yet. Each gap is a candidate for the `draft-runbook`
|
|
59
|
+
skill.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verify-page
|
|
3
|
+
description: Walk a page's owner through checking that a knowledge page is still true, fix what is not via a proposed edit, then open the verify PR that resets its review clock. Use when someone says "verify this runbook", "this page is overdue", "re-verify our team's docs", or after the weekly owner digest lists pages due for review.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Verify a page
|
|
7
|
+
|
|
8
|
+
Verification is the owning team saying "this is still true", and it's what lets agents
|
|
9
|
+
cite the page. Only a member of the page's `owner_team` can verify it. The `verify` tool
|
|
10
|
+
enforces that, so check membership before doing a long walkthrough.
|
|
11
|
+
|
|
12
|
+
## 1. Pick the page
|
|
13
|
+
|
|
14
|
+
If the user named a page, `read` it. If they named a team, call `stale` with
|
|
15
|
+
`owner_team` and offer the overdue pages oldest first, then the pages that are due soon.
|
|
16
|
+
Show the page's `owner_team`, `last_verified`, `due` and `flags` before starting.
|
|
17
|
+
|
|
18
|
+
## 2. Walk through it with the owner
|
|
19
|
+
|
|
20
|
+
Go section by section: *When to use*, *Steps*, *Checks*, *Rollback*. For each one, ask
|
|
21
|
+
the owner a concrete question rather than "is this right?". For example:
|
|
22
|
+
|
|
23
|
+
- "Is `shipyard deploy` still the command?"
|
|
24
|
+
- "Is the canary still 5% → 25% → 100%?"
|
|
25
|
+
- "Does this alert still exist under this name?"
|
|
26
|
+
|
|
27
|
+
Where a step names something you can check without changing anything, offer to check it
|
|
28
|
+
and run it only after the owner agrees. Examples are a CLI's `--help`, a file in the
|
|
29
|
+
repo, or a dashboard URL. Never run a mutating command as part of verification.
|
|
30
|
+
|
|
31
|
+
Record every answer. Anything wrong or out of date becomes an edit in step 3.
|
|
32
|
+
|
|
33
|
+
## 3. Fix first, then verify
|
|
34
|
+
|
|
35
|
+
- **If anything needs changing:** call `propose_edit` with the exact edits and a
|
|
36
|
+
`reason` that says it came from verification. Verify only once those changes are
|
|
37
|
+
agreed. Verifying a page you know is wrong defeats the gate.
|
|
38
|
+
- **If everything is still true:** call `verify` with the page id. It opens a PR that
|
|
39
|
+
sets `last_verified` to today. If it's refused because the user isn't on the owning
|
|
40
|
+
team, say which team can verify it and stop.
|
|
41
|
+
|
|
42
|
+
## 4. Report
|
|
43
|
+
|
|
44
|
+
Give the PR URL or URLs, the new review due date, and anything the owner was unsure
|
|
45
|
+
about. Log the unsure items as `TODO(owner):` lines in a proposed edit rather than
|
|
46
|
+
dropping them.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Docsworth CI for a knowledge repo. Copy to .github/workflows/knowledge.yml
|
|
2
|
+
# (`docsworth init --ci` does this).
|
|
3
|
+
# - Pull requests: lint frontmatter, ownership and links; dry-run the skills compiler.
|
|
4
|
+
# - Merges to the default branch: recompile skills and commit any changes.
|
|
5
|
+
# If the default branch is protected against bot pushes, replace the commit step
|
|
6
|
+
# with a PR (e.g. peter-evans/create-pull-request) or publish skills as an artifact.
|
|
7
|
+
name: knowledge
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
pull_request:
|
|
11
|
+
paths: ["knowledge/**", "CODEOWNERS", ".github/CODEOWNERS", "docs/CODEOWNERS", ".knowledge/config.yaml"]
|
|
12
|
+
push:
|
|
13
|
+
branches: [main]
|
|
14
|
+
paths: ["knowledge/**"]
|
|
15
|
+
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
lint:
|
|
21
|
+
if: github.event_name == 'pull_request'
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
25
|
+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
26
|
+
with:
|
|
27
|
+
node-version: 22
|
|
28
|
+
- run: npx -y "__DOCSWORTH_PACKAGE__" lint .
|
|
29
|
+
- run: npx -y "__DOCSWORTH_PACKAGE__" compile . --dry-run
|
|
30
|
+
|
|
31
|
+
compile:
|
|
32
|
+
if: github.event_name == 'push'
|
|
33
|
+
runs-on: ubuntu-latest
|
|
34
|
+
permissions:
|
|
35
|
+
contents: write
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
38
|
+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
39
|
+
with:
|
|
40
|
+
node-version: 22
|
|
41
|
+
- run: npx -y "__DOCSWORTH_PACKAGE__" compile .
|
|
42
|
+
- run: npx -y "__DOCSWORTH_PACKAGE__" compile . --check
|
|
43
|
+
- name: Commit regenerated skills
|
|
44
|
+
run: |
|
|
45
|
+
if [ -n "$(git status --porcelain -- skills)" ]; then
|
|
46
|
+
git config user.name "docsworth[bot]"
|
|
47
|
+
git config user.email "docsworth-bot@users.noreply.github.com"
|
|
48
|
+
git add skills
|
|
49
|
+
git commit -m "skills: recompile from knowledge [skip ci]"
|
|
50
|
+
git push
|
|
51
|
+
fi
|