@thjodann/wk 1.0.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 (153) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +197 -0
  3. package/dist/cli/commands/article.d.ts +2 -0
  4. package/dist/cli/commands/article.js +47 -0
  5. package/dist/cli/commands/article.js.map +1 -0
  6. package/dist/cli/commands/closeout.d.ts +2 -0
  7. package/dist/cli/commands/closeout.js +37 -0
  8. package/dist/cli/commands/closeout.js.map +1 -0
  9. package/dist/cli/commands/compile.d.ts +2 -0
  10. package/dist/cli/commands/compile.js +50 -0
  11. package/dist/cli/commands/compile.js.map +1 -0
  12. package/dist/cli/commands/concept.d.ts +2 -0
  13. package/dist/cli/commands/concept.js +36 -0
  14. package/dist/cli/commands/concept.js.map +1 -0
  15. package/dist/cli/commands/decision.d.ts +2 -0
  16. package/dist/cli/commands/decision.js +38 -0
  17. package/dist/cli/commands/decision.js.map +1 -0
  18. package/dist/cli/commands/event.d.ts +2 -0
  19. package/dist/cli/commands/event.js +32 -0
  20. package/dist/cli/commands/event.js.map +1 -0
  21. package/dist/cli/commands/init.d.ts +2 -0
  22. package/dist/cli/commands/init.js +52 -0
  23. package/dist/cli/commands/init.js.map +1 -0
  24. package/dist/cli/commands/installAgent.d.ts +2 -0
  25. package/dist/cli/commands/installAgent.js +130 -0
  26. package/dist/cli/commands/installAgent.js.map +1 -0
  27. package/dist/cli/commands/link.d.ts +2 -0
  28. package/dist/cli/commands/link.js +36 -0
  29. package/dist/cli/commands/link.js.map +1 -0
  30. package/dist/cli/commands/note.d.ts +2 -0
  31. package/dist/cli/commands/note.js +34 -0
  32. package/dist/cli/commands/note.js.map +1 -0
  33. package/dist/cli/commands/pages.d.ts +2 -0
  34. package/dist/cli/commands/pages.js +46 -0
  35. package/dist/cli/commands/pages.js.map +1 -0
  36. package/dist/cli/commands/record.d.ts +2 -0
  37. package/dist/cli/commands/record.js +101 -0
  38. package/dist/cli/commands/record.js.map +1 -0
  39. package/dist/cli/commands/render.d.ts +2 -0
  40. package/dist/cli/commands/render.js +33 -0
  41. package/dist/cli/commands/render.js.map +1 -0
  42. package/dist/cli/commands/search.d.ts +2 -0
  43. package/dist/cli/commands/search.js +125 -0
  44. package/dist/cli/commands/search.js.map +1 -0
  45. package/dist/cli/commands/setup.d.ts +2 -0
  46. package/dist/cli/commands/setup.js +53 -0
  47. package/dist/cli/commands/setup.js.map +1 -0
  48. package/dist/cli/commands/site.d.ts +2 -0
  49. package/dist/cli/commands/site.js +47 -0
  50. package/dist/cli/commands/site.js.map +1 -0
  51. package/dist/cli/commands/spin.d.ts +2 -0
  52. package/dist/cli/commands/spin.js +43 -0
  53. package/dist/cli/commands/spin.js.map +1 -0
  54. package/dist/cli/commands/status.d.ts +2 -0
  55. package/dist/cli/commands/status.js +63 -0
  56. package/dist/cli/commands/status.js.map +1 -0
  57. package/dist/cli/commands/symbol.d.ts +2 -0
  58. package/dist/cli/commands/symbol.js +37 -0
  59. package/dist/cli/commands/symbol.js.map +1 -0
  60. package/dist/cli/commands/theme.d.ts +2 -0
  61. package/dist/cli/commands/theme.js +52 -0
  62. package/dist/cli/commands/theme.js.map +1 -0
  63. package/dist/cli/commands/validate.d.ts +2 -0
  64. package/dist/cli/commands/validate.js +44 -0
  65. package/dist/cli/commands/validate.js.map +1 -0
  66. package/dist/cli/helpers.d.ts +30 -0
  67. package/dist/cli/helpers.js +131 -0
  68. package/dist/cli/helpers.js.map +1 -0
  69. package/dist/core/articles.d.ts +5 -0
  70. package/dist/core/articles.js +25 -0
  71. package/dist/core/articles.js.map +1 -0
  72. package/dist/core/automation.d.ts +96 -0
  73. package/dist/core/automation.js +384 -0
  74. package/dist/core/automation.js.map +1 -0
  75. package/dist/core/beads.d.ts +43 -0
  76. package/dist/core/beads.js +358 -0
  77. package/dist/core/beads.js.map +1 -0
  78. package/dist/core/compiler.d.ts +45 -0
  79. package/dist/core/compiler.js +399 -0
  80. package/dist/core/compiler.js.map +1 -0
  81. package/dist/core/config.d.ts +59 -0
  82. package/dist/core/config.js +187 -0
  83. package/dist/core/config.js.map +1 -0
  84. package/dist/core/git.d.ts +21 -0
  85. package/dist/core/git.js +109 -0
  86. package/dist/core/git.js.map +1 -0
  87. package/dist/core/ids.d.ts +2 -0
  88. package/dist/core/ids.js +8 -0
  89. package/dist/core/ids.js.map +1 -0
  90. package/dist/core/pages.d.ts +34 -0
  91. package/dist/core/pages.js +233 -0
  92. package/dist/core/pages.js.map +1 -0
  93. package/dist/core/paths.d.ts +15 -0
  94. package/dist/core/paths.js +67 -0
  95. package/dist/core/paths.js.map +1 -0
  96. package/dist/core/profiles.d.ts +30 -0
  97. package/dist/core/profiles.js +243 -0
  98. package/dist/core/profiles.js.map +1 -0
  99. package/dist/core/renderer.d.ts +8 -0
  100. package/dist/core/renderer.js +106 -0
  101. package/dist/core/renderer.js.map +1 -0
  102. package/dist/core/schemas.d.ts +1039 -0
  103. package/dist/core/schemas.js +108 -0
  104. package/dist/core/schemas.js.map +1 -0
  105. package/dist/core/site.d.ts +20 -0
  106. package/dist/core/site.js +2684 -0
  107. package/dist/core/site.js.map +1 -0
  108. package/dist/core/spin.d.ts +42 -0
  109. package/dist/core/spin.js +265 -0
  110. package/dist/core/spin.js.map +1 -0
  111. package/dist/core/store.d.ts +29 -0
  112. package/dist/core/store.js +146 -0
  113. package/dist/core/store.js.map +1 -0
  114. package/dist/core/theme.d.ts +35 -0
  115. package/dist/core/theme.js +1086 -0
  116. package/dist/core/theme.js.map +1 -0
  117. package/dist/core/validator.d.ts +8 -0
  118. package/dist/core/validator.js +154 -0
  119. package/dist/core/validator.js.map +1 -0
  120. package/dist/index.d.ts +3 -0
  121. package/dist/index.js +61 -0
  122. package/dist/index.js.map +1 -0
  123. package/dist/templates/articlesPage.d.ts +3 -0
  124. package/dist/templates/articlesPage.js +46 -0
  125. package/dist/templates/articlesPage.js.map +1 -0
  126. package/dist/templates/conceptsPage.d.ts +2 -0
  127. package/dist/templates/conceptsPage.js +24 -0
  128. package/dist/templates/conceptsPage.js.map +1 -0
  129. package/dist/templates/decisionsPage.d.ts +2 -0
  130. package/dist/templates/decisionsPage.js +27 -0
  131. package/dist/templates/decisionsPage.js.map +1 -0
  132. package/dist/templates/devlogPage.d.ts +2 -0
  133. package/dist/templates/devlogPage.js +22 -0
  134. package/dist/templates/devlogPage.js.map +1 -0
  135. package/dist/templates/indexPage.d.ts +6 -0
  136. package/dist/templates/indexPage.js +33 -0
  137. package/dist/templates/indexPage.js.map +1 -0
  138. package/dist/templates/linksPage.d.ts +2 -0
  139. package/dist/templates/linksPage.js +26 -0
  140. package/dist/templates/linksPage.js.map +1 -0
  141. package/dist/templates/notesPage.d.ts +2 -0
  142. package/dist/templates/notesPage.js +26 -0
  143. package/dist/templates/notesPage.js.map +1 -0
  144. package/dist/templates/symbolsPage.d.ts +2 -0
  145. package/dist/templates/symbolsPage.js +25 -0
  146. package/dist/templates/symbolsPage.js.map +1 -0
  147. package/docs/concepts.md +249 -0
  148. package/docs/reference.md +356 -0
  149. package/docs/setup.md +331 -0
  150. package/docs/workflows.md +154 -0
  151. package/package.json +61 -0
  152. package/skills/wk/SKILL.md +251 -0
  153. package/skills/wk/agents/openai.yaml +4 -0
@@ -0,0 +1,251 @@
1
+ ---
2
+ name: wk
3
+ description: Use when working in a code repository that uses or should use Wikiwiki/wk for article-first project wikis, agent-maintained living docs, structured repo memory, generated Markdown, static wiki sites, UX/DX human wiki drafts, or agent closeout knowledge updates. Trigger when the user asks to keep docs current, capture or update articles/decisions/events/notes/symbols/links, dogfood Wikiwiki, inspect changes with wk spin, render wiki/, generate wiki-site/, set up agentic IDE instructions, or update wk.
4
+ ---
5
+
6
+ # WK
7
+
8
+ ## Overview
9
+
10
+ Use `wk` as the repo-local memory loop for agents. It keeps durable project knowledge in `.wikiwiki/records/*.jsonl`, treats `article` records as the public wiki pages, renders deterministic Markdown into `wiki/`, and generates the human-facing static site in `wiki-site/`.
11
+
12
+ Prefer JSON output, preserve user work, and treat structured records as the source of truth. Records are the ledger; articles are the wiki. Lean on deterministic CLI commands for status, validation, rendering, site generation, and search; use model judgment for deciding what knowledge matters, updating public article prose, attaching source records, and polishing drafts. The generated site should feel like the user's project wiki; keep Wikiwiki itself quiet unless credit or setup context is needed.
13
+
14
+ ## Start Of Work
15
+
16
+ 1. Find the repo root before running `wk`.
17
+ 2. If `wk` is unavailable, try the repo-local fallback in this order:
18
+ - `node dist/index.js <command>` when working inside the Wikiwiki repo.
19
+ - `npm run dev -- <command>` when the repo has Wikiwiki source installed.
20
+ - `npx @thjodann/wk <command>` when the package is available.
21
+ 3. If the repo is not initialized and the user wants Wikiwiki adopted, run `wk setup --profile mixed --audience all` unless the user clearly wants `user`, `developer`, or a narrower site audience.
22
+ 4. If `.beads/` exists, run `bd prime` before wiki work when `bd` is available.
23
+ 5. Run `wk status --json`.
24
+ 6. Run `wk spin --profile mixed --json` unless the repo config or user request specifies another profile.
25
+ 7. Read relevant existing articles first, then supporting records before adding new ones.
26
+
27
+ ## During Work
28
+
29
+ - Use `authority: "user"` only for explicit user intent.
30
+ - Use `authority: "agent"` for agent-authored or inferred records.
31
+ - Use lower confidence for guesses, partial summaries, stale information, or uncertain file relationships.
32
+ - Prefer CLI commands over hand-editing JSONL records.
33
+ - Prefer existing project scripts such as `npm run wiki:site` when they exist.
34
+ - Avoid unnecessary LLM calls for deterministic work that `wk` or repo scripts can do directly.
35
+ - If `.beads/` exists, use Beads for task state, blockers, dependencies, ownership, and follow-ups.
36
+ - Use Wikiwiki for public articles, durable knowledge, decisions, generated Markdown, static wiki sites, and human-facing wiki drafts.
37
+ - Do not import Beads issues as Wikiwiki records unless they contain lasting knowledge worth recording separately.
38
+ - When public knowledge changes, add or update `article` records. Use `source_record_ids` to connect articles to concepts, decisions, notes, events, symbols, or links that support the article.
39
+ - Use concepts, decisions, notes, events, symbols, and links as evidence and maintainer context, not as the default public destination.
40
+ - Prefer titled notes for durable reminders. Untitled notes are acceptable for quick context and render as dated notes.
41
+ - Use audience tags consistently: `audience:user`, `audience:developer`, or `audience:all`.
42
+ - For user-facing first-pass material, prefer tags such as `getting-started`, `instructions`, `faq`, `troubleshooting`, `privacy`, and `features`.
43
+ - For developer-facing material, prefer tags such as `architecture`, `data-model`, `generated-files`, `maintenance`, `tests`, and `symbol`.
44
+ - Do not manually edit generated files in `wiki/`, `wiki-site/`, or `wiki/human/` unless the user asks for a one-off repair.
45
+ - Keep record prose factual and compact; human-facing narrative belongs in compile drafts or generated site pages.
46
+
47
+ ## Useful Commands
48
+
49
+ Inspect:
50
+
51
+ ```sh
52
+ bd prime # only when .beads/ exists and bd is available
53
+ wk setup --profile mixed --audience all
54
+ wk status --json
55
+ wk spin --profile mixed --json
56
+ wk search <query> --json
57
+ ```
58
+
59
+ Add knowledge:
60
+
61
+ ```sh
62
+ wk article add --json '{...}'
63
+ wk concept add --json '{...}'
64
+ wk decision add --json '{...}'
65
+ wk event add --json '{...}'
66
+ wk note add --json '{...}'
67
+ wk symbol add --json '{...}'
68
+ wk link add --json '{...}'
69
+ ```
70
+
71
+ Revise knowledge append-only:
72
+
73
+ ```sh
74
+ wk record list <type> --json
75
+ wk record get <type> <id> --json
76
+ wk record update <type> <id> --json '{...}'
77
+ wk record delete <type> <id> --reason "..."
78
+ ```
79
+
80
+ Generate:
81
+
82
+ ```sh
83
+ wk validate
84
+ wk render
85
+ wk site --audience all
86
+ wk site --audience user
87
+ wk site --audience all --source-base-url https://github.com/OWNER/REPO/blob/main/
88
+ ```
89
+
90
+ Agent setup:
91
+
92
+ ```sh
93
+ wk install-agent codex
94
+ wk install-agent codex --yes
95
+ # Only after inspecting an existing non-empty destination:
96
+ wk install-agent codex --yes --force
97
+ ```
98
+
99
+ Human wiki drafts:
100
+
101
+ ```sh
102
+ wk compile draft --role all --json
103
+ wk compile apply <draft-id> --json
104
+ ```
105
+
106
+ Objective closeout:
107
+
108
+ ```sh
109
+ wk closeout --profile mixed --audience all --json
110
+ ```
111
+
112
+ ## Practical Article Loop
113
+
114
+ For normal wiki maintenance during development:
115
+
116
+ 1. Inspect: `wk status --json`, then `wk spin --profile mixed --json`.
117
+ 2. Read relevant article records first, then supporting records and source files.
118
+ 3. Update article records when public wiki knowledge changes.
119
+ 4. Add concepts, decisions, notes, events, symbols, or links when they provide durable evidence or maintainer context.
120
+ 5. Run `wk validate`, `wk render`, and `wk site --audience all`.
121
+ 6. Run `wk closeout --profile mixed --audience all --json` for meaningful objectives and review the draft packet before applying any suggested records.
122
+
123
+ ## First Install Style And Substance
124
+
125
+ When adopting Wikiwiki in a repo for the first time, do more than make a valid
126
+ wiki. Make the first generated site feel native to the host project:
127
+
128
+ 1. Run `wk setup --profile mixed --audience all`.
129
+ 2. Inspect README/docs/package metadata for product identity and durable facts.
130
+ 3. Inspect actual visual sources before writing a theme: app/global CSS, design
131
+ tokens, theme files, landing page styles, app shell/layout styles, and any
132
+ existing brand palette files.
133
+ 4. Run `wk theme preview --json`. If the preview looks right, run
134
+ `wk theme init`; otherwise pass explicit `--project-name`, `--description`,
135
+ or `--mood`, then preview again.
136
+ 5. Seed high-signal records for product promise, privacy/data boundary,
137
+ architecture, distribution/support, important symbols, and a devlog event.
138
+ 6. Run `wk validate`, `wk render`, and `wk site --audience all`.
139
+ 7. Verify the generated site locally: Auto/Light/Dark controls, default theme,
140
+ search, local links/source-file links, and contrast for body text, muted
141
+ text, accents, badges, and tags.
142
+
143
+ Do not edit generated CSS in `wiki-site/`. The source of truth is
144
+ `.wikiwiki/site-theme.json` plus structured records.
145
+
146
+ ## Update wk
147
+
148
+ When a user asks "Update wk", treat it as a request to update both the CLI and
149
+ the installed agent instructions when possible.
150
+
151
+ 1. Inspect before changing anything:
152
+
153
+ ```sh
154
+ command -v wk || true
155
+ wk --version || true
156
+ git status --short
157
+ ```
158
+
159
+ 2. If npm is available, update the repo-local CLI from the current GitHub source
160
+ package until the npm package is published:
161
+
162
+ ```sh
163
+ test "$(npm prefix)" = "$PWD" || npm init -y
164
+ npm install --prefix "$PWD" --save-dev --package-lock=false git+https://github.com/Thjodann/Wikiwiki.git
165
+ ./node_modules/.bin/wk --version
166
+ ./node_modules/.bin/wk install-agent codex --yes
167
+ ```
168
+
169
+ Use `@thjodann/wk@latest` instead of the GitHub URL after the package is
170
+ published to npm. If the project uses another JavaScript package manager, use
171
+ the closest equivalent and keep the install rooted in the target repo.
172
+
173
+ 3. If npm and equivalent package managers are not available, do not pretend the
174
+ CLI was updated. Refresh only the agent skill from GitHub raw files, preserving
175
+ unknown local files:
176
+
177
+ ```sh
178
+ WK_SKILL_HOME="${CODEX_HOME:-$HOME/.codex}/skills/wk"
179
+ tmpdir="$(mktemp -d)"
180
+ mkdir -p "$tmpdir/agents" "$WK_SKILL_HOME/agents"
181
+ curl -fsSL https://raw.githubusercontent.com/Thjodann/Wikiwiki/main/skills/wk/SKILL.md \
182
+ -o "$tmpdir/SKILL.md"
183
+ curl -fsSL https://raw.githubusercontent.com/Thjodann/Wikiwiki/main/skills/wk/agents/openai.yaml \
184
+ -o "$tmpdir/agents/openai.yaml"
185
+ cp "$tmpdir/SKILL.md" "$WK_SKILL_HOME/SKILL.md"
186
+ cp "$tmpdir/agents/openai.yaml" "$WK_SKILL_HOME/agents/openai.yaml"
187
+ rm -rf "$tmpdir"
188
+ ```
189
+
190
+ Then tell the user plainly: the wk agent instructions were refreshed, but the
191
+ `wk` CLI still needs npm, another JavaScript package manager, or a release
192
+ artifact to update.
193
+
194
+ 4. Verify the result that is actually available:
195
+
196
+ ```sh
197
+ wk --version || true
198
+ wk status --json || true
199
+ ```
200
+
201
+ Never delete lockfiles, overwrite unknown agent files, or force a skill install
202
+ unless the user explicitly approves that risk.
203
+
204
+ ## Closeout
205
+
206
+ After meaningful repo changes:
207
+
208
+ 1. Run `wk closeout --profile mixed --audience all --json` unless the repo config or user request specifies another profile/audience.
209
+ 2. Review `.wikiwiki/drafts/closeout/<closeout-id>/summary.md` and `.wikiwiki/drafts/closeout/<closeout-id>/record-drafts/`. In Beads repos, the summary reports detected Beads state; detailed Beads context appears only when the repo explicitly enables it and `bd` reads cleanly.
210
+ 3. Apply only the record drafts that are true, useful, and properly sourced.
211
+ 4. If articles or records changed, run `wk validate`, `wk render`, and `wk site --audience all`; also run `wk site --audience user` when checking the standard user experience.
212
+ 5. Summarize any knowledge updates and closeout draft path in the final response.
213
+
214
+ Closeout drafts are deterministic prompts, not automatic truth. Do not treat a
215
+ draft JSON file as a record until a user or agent deliberately applies it with
216
+ the appropriate `wk <type> add --json ...` command.
217
+
218
+ ## Install Guidance For Users
219
+
220
+ When a user asks how to set up Wikiwiki for an agentic IDE:
221
+
222
+ - Explain that Wikiwiki works without AI through the CLI and repo scripts.
223
+ - Recommend installing the `wk` CLI first.
224
+ - Recommend `wk setup --profile mixed --audience all` before adding agent-specific instructions.
225
+ - If the repo uses Beads, recommend keeping `bd init` / `bd setup codex` as Beads' own setup and then installing Wikiwiki's skill. Do not overwrite or duplicate Beads' agent instructions.
226
+ - Explain that `wk setup` creates `.wikiwiki/config.json`, adds safe package scripts when `package.json` exists, and refuses conflicting scripts unless `--force` is explicit.
227
+ - Recommend `wk spin --profile mixed --json` for first-pass dogfood, then article records for public pages and audience tags on every durable user/developer record.
228
+ - Recommend `wk closeout --profile mixed --audience all --json` after meaningful work; clarify that it creates reviewable drafts and does not append records automatically.
229
+ - Recommend installing this skill into the agent's skill/custom-instructions system with `wk install-agent codex` when supported.
230
+ - Explain that `wk install-agent codex --yes` refuses unknown destination files; use `--force` only after the user or agent has inspected the destination.
231
+ - For Codex-compatible skills, copy this `SKILL.md` into `${CODEX_HOME:-$HOME/.codex}/skills/wk/SKILL.md`.
232
+ - For other agentic IDEs, copy the body of this file into the IDE's persistent agent instructions and keep the start/closeout loops intact.
233
+
234
+ Keep setup advice local-first, script-first, and provider-agnostic.
235
+
236
+ ## Beads Coordination
237
+
238
+ When `.beads/` exists, treat Beads as the repo's task and work-memory layer:
239
+
240
+ - Run `bd prime` before wiki work when `bd` is available.
241
+ - Use Beads for task state, blockers, dependencies, ownership, and follow-ups.
242
+ - Use Wikiwiki for public articles, durable knowledge, decisions, generated Markdown, static site generation, and human wiki drafts.
243
+ - Let `wk closeout` report Beads detection, and include detailed Beads-linked context only when `.wikiwiki/config.json` explicitly sets `integrations.beads.enabled` to `true` and the read does not dirty `.beads/`.
244
+ - Do not mutate Beads through Wikiwiki. Use `bd` directly for Beads task changes.
245
+
246
+ The same skill is safe in non-Beads repos. If `.beads/` is absent, skip Beads
247
+ steps and use the normal Wikiwiki flow.
248
+
249
+ ## Site Theme Guidance
250
+
251
+ When asked to make the human wiki match a project, edit `.wikiwiki/site-theme.json` rather than generated CSS. Prefer `wk theme preview --json` and `wk theme init` first because they inspect CSS/design sources when present. If you hand-edit, use the host project's real visual language literally: default color mode, paired light/dark palettes, accent spectrum, neutral surfaces, sidebar/hero/card gradients, brand gradient, badge/tag colors, focus ring, gloss, shadows, border radius, code background, and font family. Then run `wk validate`, `wk render`, and `wk site`.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "WK"
3
+ short_description: "Agentic living docs with wk"
4
+ default_prompt: "Use $wk to keep this repo's Wikiwiki records, Markdown, and site current."