@coralai/sps-cli 0.50.24 → 0.51.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 (82) hide show
  1. package/README.md +18 -1
  2. package/dist/commands/projectInit.d.ts +15 -0
  3. package/dist/commands/projectInit.d.ts.map +1 -1
  4. package/dist/commands/projectInit.js +191 -3
  5. package/dist/commands/projectInit.js.map +1 -1
  6. package/dist/commands/wikiCommand.d.ts +77 -0
  7. package/dist/commands/wikiCommand.d.ts.map +1 -0
  8. package/dist/commands/wikiCommand.js +489 -0
  9. package/dist/commands/wikiCommand.js.map +1 -0
  10. package/dist/console/routes/projects.d.ts.map +1 -1
  11. package/dist/console/routes/projects.js +1 -0
  12. package/dist/console/routes/projects.js.map +1 -1
  13. package/dist/console-assets/assets/{index-BgOHCIG1.css → index-DlwaKe2l.css} +1 -1
  14. package/dist/console-assets/assets/{index-QBai48VV.js → index-Gjim492C.js} +1 -1
  15. package/dist/console-assets/index.html +2 -2
  16. package/dist/core/taskPrompts.d.ts +12 -0
  17. package/dist/core/taskPrompts.d.ts.map +1 -1
  18. package/dist/core/taskPrompts.js +14 -0
  19. package/dist/core/taskPrompts.js.map +1 -1
  20. package/dist/core/wiki/frontmatter.d.ts +55 -0
  21. package/dist/core/wiki/frontmatter.d.ts.map +1 -0
  22. package/dist/core/wiki/frontmatter.js +109 -0
  23. package/dist/core/wiki/frontmatter.js.map +1 -0
  24. package/dist/core/wiki/hot.d.ts +27 -0
  25. package/dist/core/wiki/hot.d.ts.map +1 -0
  26. package/dist/core/wiki/hot.js +124 -0
  27. package/dist/core/wiki/hot.js.map +1 -0
  28. package/dist/core/wiki/index-builder.d.ts +37 -0
  29. package/dist/core/wiki/index-builder.d.ts.map +1 -0
  30. package/dist/core/wiki/index-builder.js +130 -0
  31. package/dist/core/wiki/index-builder.js.map +1 -0
  32. package/dist/core/wiki/linter.d.ts +76 -0
  33. package/dist/core/wiki/linter.d.ts.map +1 -0
  34. package/dist/core/wiki/linter.js +280 -0
  35. package/dist/core/wiki/linter.js.map +1 -0
  36. package/dist/core/wiki/log.d.ts +24 -0
  37. package/dist/core/wiki/log.d.ts.map +1 -0
  38. package/dist/core/wiki/log.js +107 -0
  39. package/dist/core/wiki/log.js.map +1 -0
  40. package/dist/core/wiki/manifest.d.ts +59 -0
  41. package/dist/core/wiki/manifest.d.ts.map +1 -0
  42. package/dist/core/wiki/manifest.js +180 -0
  43. package/dist/core/wiki/manifest.js.map +1 -0
  44. package/dist/core/wiki/page.d.ts +72 -0
  45. package/dist/core/wiki/page.d.ts.map +1 -0
  46. package/dist/core/wiki/page.js +221 -0
  47. package/dist/core/wiki/page.js.map +1 -0
  48. package/dist/core/wiki/reader.d.ts +102 -0
  49. package/dist/core/wiki/reader.d.ts.map +1 -0
  50. package/dist/core/wiki/reader.js +225 -0
  51. package/dist/core/wiki/reader.js.map +1 -0
  52. package/dist/core/wiki/scaffold.d.ts +42 -0
  53. package/dist/core/wiki/scaffold.d.ts.map +1 -0
  54. package/dist/core/wiki/scaffold.js +223 -0
  55. package/dist/core/wiki/scaffold.js.map +1 -0
  56. package/dist/core/wiki/searcher.d.ts +73 -0
  57. package/dist/core/wiki/searcher.d.ts.map +1 -0
  58. package/dist/core/wiki/searcher.js +216 -0
  59. package/dist/core/wiki/searcher.js.map +1 -0
  60. package/dist/core/wiki/sources.d.ts +84 -0
  61. package/dist/core/wiki/sources.d.ts.map +1 -0
  62. package/dist/core/wiki/sources.js +261 -0
  63. package/dist/core/wiki/sources.js.map +1 -0
  64. package/dist/core/wiki/types.d.ts +904 -0
  65. package/dist/core/wiki/types.d.ts.map +1 -0
  66. package/dist/core/wiki/types.js +109 -0
  67. package/dist/core/wiki/types.js.map +1 -0
  68. package/dist/engines/StageEngine.d.ts +17 -1
  69. package/dist/engines/StageEngine.d.ts.map +1 -1
  70. package/dist/engines/StageEngine.js +85 -0
  71. package/dist/engines/StageEngine.js.map +1 -1
  72. package/dist/main.js +78 -1
  73. package/dist/main.js.map +1 -1
  74. package/dist/services/ProjectService.d.ts +2 -0
  75. package/dist/services/ProjectService.d.ts.map +1 -1
  76. package/dist/services/ProjectService.js.map +1 -1
  77. package/dist/shared/wikiPaths.d.ts +38 -0
  78. package/dist/shared/wikiPaths.d.ts.map +1 -0
  79. package/dist/shared/wikiPaths.js +89 -0
  80. package/dist/shared/wikiPaths.js.map +1 -0
  81. package/package.json +1 -1
  82. package/skills/wiki-update/SKILL.md +300 -0
@@ -0,0 +1,300 @@
1
+ ---
2
+ name: wiki-update
3
+ description: |
4
+ SPS Wiki maintenance — ingest source diffs into structured pages, cross-reference,
5
+ and keep the knowledge base coherent. Single source of truth for the SOP that
6
+ Worker follows when "wiki update" runs (per card completion or via `sps wiki update`).
7
+ Triggers on: "ingest source", "wiki update", "update wiki", "process wiki sources",
8
+ "add to wiki", "lesson from this card", "decision from this design". (🪸 Coral SPS)
9
+
10
+ Attribution: ~70% of the SOP is adapted from claude-obsidian/skills/wiki-ingest
11
+ (MIT, https://github.com/kepano/claude-obsidian). 30% is SPS-specific:
12
+ the 4-question entry filter, the 5 page types, sources={card:N|commit:hash},
13
+ and the `sps wiki check` exit gate. See ATTRIBUTION.md.
14
+ allowed-tools: Read Write Edit Glob Grep Bash
15
+ ---
16
+
17
+ # wiki-update — SPS Knowledge Maintenance
18
+
19
+ You are a knowledge architect inside an SPS pipeline. The wiki is a persistent,
20
+ cross-referenced artifact that compounds with every card the team finishes.
21
+ You don't dump source content; you **distill** facts, decisions, and lessons
22
+ into atomic, linkable pages.
23
+
24
+ This SKILL is the **single source of truth** for "what to write to the wiki."
25
+ CLAUDE.md only points here. Don't duplicate rules between the two files.
26
+
27
+ ---
28
+
29
+ ## When to invoke this skill
30
+
31
+ Two paths can trigger it:
32
+
33
+ 1. **Manual** — user runs `sps wiki update <project>` and reads the diff.
34
+ 2. **Auto** — at card completion, the StageEngine appends a wiki-update
35
+ prompt to the Worker's session (no new ACP call).
36
+
37
+ In both cases your job is the same: read what changed, decide what to write,
38
+ keep the wiki coherent.
39
+
40
+ ---
41
+
42
+ ## The 4-Question Entry Filter
43
+
44
+ **Before writing anything**, answer these for the trigger that brought you here:
45
+
46
+ 1. **Did a module change?** → write/update a `module/` page.
47
+ 2. **Was a non-trivial decision recorded?** → write a `decision/` page.
48
+ 3. **Did a bug or gotcha surface?** → write a `lesson/` page.
49
+ 4. **Is there a recurring pattern worth naming?** → write a `concept/` page.
50
+
51
+ If none of the four hit: **don't write**. Empty wiki growth is worse than no
52
+ growth — every page is a future read budget cost. Add to `.hot.md` only if
53
+ context is recent and relevant; otherwise just append a `.log.md` entry.
54
+
55
+ ---
56
+
57
+ ## What to read first (context discipline)
58
+
59
+ Token budget matters. Follow this order on every invocation:
60
+
61
+ 1. `wiki/.hot.md` — ~500-char recent context. If this answers your question, stop.
62
+ 2. `wiki/index.md` — find existing pages **before** creating new ones.
63
+ 3. Run `sps wiki update <project>` — see the manifest diff (added/changed/removed).
64
+ 4. Run `sps wiki list <project> --tag <skill>` — find related pages by tag.
65
+ 5. Read at most **3-5** existing pages per ingest. If you need 10+, you're scoping
66
+ too broadly. Split the work across cards.
67
+ 6. Use `sps wiki get <project> <pageId>` for surgical reads.
68
+
69
+ Never read whole wiki dumps. Use Edit (not Write) for in-place updates.
70
+
71
+ ---
72
+
73
+ ## Page Anatomy (mandatory)
74
+
75
+ Every page has YAML frontmatter + a body. The body **must** start with `## TL;DR`
76
+ followed by 1-3 sentences. The TL;DR is what `sps wiki read` injects into Worker
77
+ prompts; the rest is read on demand.
78
+
79
+ ```markdown
80
+ ---
81
+ type: lesson | module | concept | decision | source
82
+ title: "Short Descriptive Name"
83
+ created: 2026-04-27
84
+ updated: 2026-04-27
85
+ tags: ["pipeline", "race-condition"] # use existing tags first; minimum 1
86
+ status: developing | mature | evergreen | stale
87
+ related: ["[[modules/PipelineService]]", "[[concepts/Async-Stop-Hook]]"]
88
+ sources:
89
+ - { card: "42" } # SPS card seq
90
+ - { commit: "abc1234" } # git commit hash
91
+ - { path: "src/services/X.ts", hash: "<sha256>" }
92
+ generated: manual | auto | semi
93
+ # type-specific fields below — see schema per type
94
+ ---
95
+
96
+ ## TL;DR
97
+ One to three sentences. **Dense facts**, no fluff. This is what other Workers
98
+ will see in their prompt context.
99
+
100
+ ## Body
101
+ Whatever the page needs. Cross-reference other pages with `[[type/Title]]`.
102
+ ```
103
+
104
+ ### Type-specific fields
105
+
106
+ - **module**: `module_path: "src/services/X.ts"` (required)
107
+ - **concept**: `complexity: basic|intermediate|advanced`, `domain: "..."`, optional `aliases: [...]`
108
+ - **decision**: `version: "v0.51.0"` (the version this decision shipped in), optional `superseded_by: "[[decisions/...]]"`
109
+ - **lesson**: `severity: critical|major|minor` (default major), optional `seen_in_cards: ["42", "67"]`
110
+ - **source**: `source_type: pdf|article|image|transcript|data|note|unknown`, `original_path: "wiki/.raw/..."`
111
+
112
+ The CLI validates frontmatter with zod. If you write something invalid, `sps
113
+ wiki check` will scream at you. Don't ship a card without running it.
114
+
115
+ ---
116
+
117
+ ## Wikilinks
118
+
119
+ Use `[[type/Title]]` form everywhere — frontmatter `related[]` and body prose.
120
+ Bare `[[Title]]` works (linter resolves by title) but typed form is safer when
121
+ two pages share a title across types.
122
+
123
+ **Forbidden**: external markdown links to wiki files (`[X](./modules/X.md)`).
124
+ Use wikilinks so renames don't break references.
125
+
126
+ ---
127
+
128
+ ## SPS-specific sources field
129
+
130
+ The `sources:` field in frontmatter is how a page traces back to its origin.
131
+ SPS pipelines have three kinds:
132
+
133
+ ```yaml
134
+ sources:
135
+ - { card: "42" } # card that produced this knowledge
136
+ - { commit: "abc1234" } # git commit at the time of writing
137
+ - { path: "src/services/X.ts", hash: "<sha256>" } # the file the page summarizes
138
+ ```
139
+
140
+ **Rules**:
141
+ - A `lesson/` page from a card MUST include `{ card: "<seq>" }`.
142
+ - A `module/` page MUST include `{ path: "<module_path>", hash: ... }`. The
143
+ hash is read from `wiki/.manifest.json` (auto-managed by `sps wiki update --finalize`).
144
+ - A `decision/` page SHOULD include the commit hash that shipped the decision.
145
+ - A `source/` page MUST point at its original file in `.raw/`.
146
+
147
+ You don't have to include every applicable source — just the strongest 1-3.
148
+
149
+ ---
150
+
151
+ ## Writing a page (the 8 steps)
152
+
153
+ When the entry filter says "write":
154
+
155
+ 1. **Search first** — `sps wiki list <project> --tag <skill>` and `sps wiki read
156
+ <project> "<query>"`. If a page exists that's close, **update** it; don't make
157
+ a duplicate.
158
+ 2. **Pick the type** — module / concept / decision / lesson / source. If you're
159
+ not sure between concept and decision, ask: "is this an architectural choice
160
+ we made?" → decision. "Is this a pattern we name?" → concept.
161
+ 3. **Choose a Title** — short, distinctive, no version suffix (avoid
162
+ "PipelineService v2", just "PipelineService").
163
+ 4. **Pick tags** — reuse existing tags from `index.md` first. Minimum 1, max 5.
164
+ Tags map to skills (per StageEngine); a page with no tags won't surface via
165
+ skill-match retrieval.
166
+ 5. **Write the TL;DR** — first thing after frontmatter. 1-3 dense sentences.
167
+ This is the page's elevator pitch and what other Workers see.
168
+ 6. **Write the body** — what's not in the TL;DR. Use sub-headings (`## Body`,
169
+ `## Why`, `## How to apply`, etc). Keep it ≤ 300 lines. Split at 300+.
170
+ 7. **Cross-reference** — every relevant `[[type/Title]]` link in body and
171
+ `related[]`. Don't bloat with weak links; aim for 2-5 strong ones.
172
+ 8. **Save** with `Write` tool (or `Edit` if updating). Path:
173
+ `wiki/<type>s/<Title>.md` (note plural directory).
174
+
175
+ ---
176
+
177
+ ## Updating an existing page
178
+
179
+ Prefer **Edit** over Write. Surgical changes only:
180
+
181
+ - Bump `updated:` to today.
182
+ - If TL;DR changed, edit just that line.
183
+ - If you added a section, append it; don't rewrite the page.
184
+ - If status changed (e.g. `developing → mature`), update only that field.
185
+
186
+ Never overwrite with a full re-write unless the page is genuinely re-scoped.
187
+ Re-writes lose the git history of what was when.
188
+
189
+ ---
190
+
191
+ ## Contradictions
192
+
193
+ When new info contradicts an existing page, **don't silently overwrite**. Add a
194
+ callout on both pages:
195
+
196
+ ```markdown
197
+ > [!warning] Conflicts with [[decisions/Use-Karpathy-Wiki]]
198
+ > [[decisions/Use-Karpathy-Wiki]] (2026-04-23) said pages should be 100-300 lines.
199
+ > This page argues for ≤200. Needs reconciliation; flagged for review.
200
+ ```
201
+
202
+ If you're not sure which side wins, leave both flagged and keep going. The user
203
+ will resolve.
204
+
205
+ ---
206
+
207
+ ## After writing: index, hot, log, check
208
+
209
+ In this order:
210
+
211
+ 1. **Update `wiki/index.md`** — add a row for the new page (or bump the entry).
212
+ Title + TL;DR + tags. Keep alphabetical within the type section.
213
+ 2. **Update `wiki/.hot.md`** — overwrite "Last Updated" with this card's
214
+ summary; append to "Recent Changes" the new wikilinks. Keep total ≤ 500 chars.
215
+ 3. **Append to `wiki/.log.md`** at the **top** (newest-first):
216
+ ```markdown
217
+ ## 2026-04-27T14:30:00Z · ingest · card #42
218
+ Wrote [[lessons/Stop-Hook-Race]] from card #42 review.
219
+ - Pages: [[lessons/Stop-Hook-Race]], [[modules/PipelineService]]
220
+ ```
221
+ 4. **Run `sps wiki check <project>`** — fix any errors before exiting. Warnings
222
+ (orphans, missing TL;DR) can wait, but errors (dead links in `related[]`,
223
+ empty title) MUST be resolved.
224
+ 5. **(Optional)** `sps wiki update <project> --finalize` — flushes the manifest
225
+ so the next `update` shows clean diff.
226
+
227
+ ---
228
+
229
+ ## Quality bar
230
+
231
+ A page is **publishable** when:
232
+
233
+ - TL;DR is dense (no "this page describes…").
234
+ - At least one strong cross-reference in `related[]`.
235
+ - All wikilinks resolve (no `[[Ghost]]`).
236
+ - Tags overlap with at least one skill or active card label.
237
+ - Body is ≤ 300 lines (split otherwise).
238
+ - Frontmatter passes `sps wiki check`.
239
+
240
+ A page is **not** publishable when:
241
+
242
+ - It restates source verbatim.
243
+ - It's a placeholder ("TODO: fill in").
244
+ - It links to nothing.
245
+ - It uses generic tags like `["misc", "general"]`.
246
+
247
+ If a draft fails any of these, fix it or don't ship.
248
+
249
+ ---
250
+
251
+ ## What NOT to do
252
+
253
+ - **Don't** read a whole `.raw/` source if `wiki/.hot.md` already covers it.
254
+ - **Don't** create a page per card. Many cards produce zero wiki pages — that's
255
+ correct.
256
+ - **Don't** mass-rename pages. Wikilinks break and the manifest goes stale.
257
+ Use the Bash tool for sed renames only when you've also updated `related[]`
258
+ in every linker.
259
+ - **Don't** edit `.raw/` files. They're immutable sources.
260
+ - **Don't** edit `wiki/.manifest.json` by hand. Use `sps wiki update --finalize`.
261
+ - **Don't** skip `sps wiki check`. A broken wiki costs the team more than the
262
+ card's value.
263
+
264
+ ---
265
+
266
+ ## CLI cheat sheet
267
+
268
+ ```bash
269
+ # Discover what changed
270
+ sps wiki update <project>
271
+
272
+ # After writing pages, flush the manifest
273
+ sps wiki update <project> --finalize
274
+
275
+ # Lint before merging
276
+ sps wiki check <project>
277
+
278
+ # Inspect single page
279
+ sps wiki get <project> lessons/Stop-Hook-Race
280
+
281
+ # Filter list
282
+ sps wiki list <project> --type lesson --tag pipeline
283
+
284
+ # Drop external file into vault
285
+ sps wiki add <project> ~/notes.md --category transcripts
286
+
287
+ # Inject context into the next prompt (used by StageEngine)
288
+ sps wiki read <project> "<keyword>"
289
+ ```
290
+
291
+ ---
292
+
293
+ ## Reference
294
+
295
+ This SOP is adapted from `claude-obsidian/skills/wiki-ingest` (MIT). The
296
+ SPS-specific bits — 4 page types, sources={card,commit}, `sps wiki check` gate,
297
+ 5-layer reader integration — are from `docs/design/28-wiki-system.md`.
298
+
299
+ If you find this skill conflicting with `docs/design/28-wiki-system.md`, the
300
+ design doc wins. File a card to update this SKILL.md.