@docsworth/cli 0.0.0-stage → 0.2.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.
Files changed (91) hide show
  1. package/LICENSE +55 -0
  2. package/README.md +186 -2
  3. package/dist/cli.d.ts +11 -0
  4. package/dist/cli.js +409 -0
  5. package/dist/core/acl.d.ts +28 -0
  6. package/dist/core/acl.js +102 -0
  7. package/dist/core/audit-log.d.ts +133 -0
  8. package/dist/core/audit-log.js +290 -0
  9. package/dist/core/blocks.d.ts +35 -0
  10. package/dist/core/blocks.js +417 -0
  11. package/dist/core/codeowners.d.ts +62 -0
  12. package/dist/core/codeowners.js +133 -0
  13. package/dist/core/config.d.ts +96 -0
  14. package/dist/core/config.js +131 -0
  15. package/dist/core/coverage.d.ts +25 -0
  16. package/dist/core/coverage.js +41 -0
  17. package/dist/core/duration.d.ts +20 -0
  18. package/dist/core/duration.js +60 -0
  19. package/dist/core/errors.d.ts +11 -0
  20. package/dist/core/errors.js +13 -0
  21. package/dist/core/frontmatter.d.ts +17 -0
  22. package/dist/core/frontmatter.js +40 -0
  23. package/dist/core/gate.d.ts +17 -0
  24. package/dist/core/gate.js +25 -0
  25. package/dist/core/github.d.ts +152 -0
  26. package/dist/core/github.js +234 -0
  27. package/dist/core/host.d.ts +125 -0
  28. package/dist/core/host.js +22 -0
  29. package/dist/core/identity.d.ts +39 -0
  30. package/dist/core/identity.js +127 -0
  31. package/dist/core/init.d.ts +25 -0
  32. package/dist/core/init.js +86 -0
  33. package/dist/core/lint.d.ts +17 -0
  34. package/dist/core/lint.js +115 -0
  35. package/dist/core/mcp/audit-transport.d.ts +16 -0
  36. package/dist/core/mcp/audit-transport.js +238 -0
  37. package/dist/core/mcp/server.d.ts +19 -0
  38. package/dist/core/mcp/server.js +207 -0
  39. package/dist/core/mcp/text.d.ts +14 -0
  40. package/dist/core/mcp/text.js +43 -0
  41. package/dist/core/mirror-view.d.ts +68 -0
  42. package/dist/core/mirror-view.js +367 -0
  43. package/dist/core/new-page.d.ts +52 -0
  44. package/dist/core/new-page.js +49 -0
  45. package/dist/core/policy.d.ts +10 -0
  46. package/dist/core/policy.js +30 -0
  47. package/dist/core/polish.d.ts +42 -0
  48. package/dist/core/polish.js +1000 -0
  49. package/dist/core/references.d.ts +52 -0
  50. package/dist/core/references.js +1242 -0
  51. package/dist/core/repo.d.ts +42 -0
  52. package/dist/core/repo.js +116 -0
  53. package/dist/core/schema.d.ts +46 -0
  54. package/dist/core/schema.js +49 -0
  55. package/dist/core/search.d.ts +24 -0
  56. package/dist/core/search.js +98 -0
  57. package/dist/core/serve/auth.d.ts +23 -0
  58. package/dist/core/serve/auth.js +38 -0
  59. package/dist/core/serve/server.d.ts +22 -0
  60. package/dist/core/serve/server.js +138 -0
  61. package/dist/core/serve/sessions.d.ts +39 -0
  62. package/dist/core/serve/sessions.js +130 -0
  63. package/dist/core/serve/token.d.ts +10 -0
  64. package/dist/core/serve/token.js +96 -0
  65. package/dist/core/service.d.ts +375 -0
  66. package/dist/core/service.js +815 -0
  67. package/dist/core/sla.d.ts +16 -0
  68. package/dist/core/sla.js +20 -0
  69. package/dist/core/stale.d.ts +16 -0
  70. package/dist/core/stale.js +23 -0
  71. package/dist/core/tool-registry.d.ts +31 -0
  72. package/dist/core/tool-registry.js +77 -0
  73. package/dist/core/url.d.ts +4 -0
  74. package/dist/core/url.js +31 -0
  75. package/dist/core/version.d.ts +22 -0
  76. package/dist/core/version.js +32 -0
  77. package/dist/core/writes.d.ts +58 -0
  78. package/dist/core/writes.js +113 -0
  79. package/dist/web/assets/index-BglLMIyN.css +1 -0
  80. package/dist/web/assets/index-DugFPoRu.js +25 -0
  81. package/dist/web/index.html +14 -0
  82. package/docs/format-spec.md +311 -0
  83. package/package.json +75 -4
  84. package/plugin/.claude-plugin/plugin.json +8 -0
  85. package/plugin/.mcp.json +8 -0
  86. package/plugin/bin/docsworth-mcp.mjs +46 -0
  87. package/plugin/skills/draft-runbook/SKILL.md +75 -0
  88. package/plugin/skills/polish-page/SKILL.md +64 -0
  89. package/plugin/skills/update-after-incident/SKILL.md +59 -0
  90. package/plugin/skills/verify-page/SKILL.md +46 -0
  91. package/templates/github/knowledge.yml +51 -0
@@ -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