superwiki 0.1.5 → 0.1.6
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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +30 -3
- package/package.json +1 -1
- package/skills/sw-implement/SKILL.md +8 -4
- package/skills/sw-init/assets/agents-block.md +6 -0
- package/skills/sw-init/assets/sw.mjs +90 -2
- package/skills/sw-init/scripts/init.mjs +16 -1
- package/skills/sw-lint/SKILL.md +1 -0
- package/skills/sw-plan/SKILL.md +6 -2
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ Measured on a real project with 165 tasks, converted from a single markdown inde
|
|
|
29
29
|
|
|
30
30
|
| | Before | After |
|
|
31
31
|
| --- | --- | --- |
|
|
32
|
-
| Read at the start of every session | 197 KB index |
|
|
32
|
+
| Read at the start of every session | 197 KB index | 7.7 KB index (the 97 open tasks, a line each) + 2.7 KB of rules |
|
|
33
33
|
| Read to start one task | the index, then the task's section | one file, 2 KB at the median |
|
|
34
34
|
| Marking a task done | a status cell, plus a ✅ at every reference to it (median 12 places) | one frontmatter line |
|
|
35
35
|
|
|
@@ -39,7 +39,7 @@ Measured on a real project with 165 tasks, converted from a single markdown inde
|
|
|
39
39
|
|
|
40
40
|
```text
|
|
41
41
|
docs/
|
|
42
|
-
index.md catalog of the wiki, one line per page
|
|
42
|
+
index.md the open tasks, then the catalog of the wiki, one line per page
|
|
43
43
|
log.md append-only history
|
|
44
44
|
raw/ your sources, never modified
|
|
45
45
|
wiki/ pages the agent writes
|
|
@@ -50,6 +50,31 @@ docs/
|
|
|
50
50
|
|
|
51
51
|
`AGENTS.md` gets a short block of rules so the agent maintains the vault in every session, with or without a command.
|
|
52
52
|
|
|
53
|
+
You can follow the work without the viewer: `index.md` opens with the task list, written from the task files. Each open task is a line that links to its file; finished ones are listed by id.
|
|
54
|
+
|
|
55
|
+
```markdown
|
|
56
|
+
## Tasks
|
|
57
|
+
|
|
58
|
+
ready 9 · in progress 1 · blocked 18 · done 20
|
|
59
|
+
|
|
60
|
+
**In progress**
|
|
61
|
+
|
|
62
|
+
- [[B-20]] Portfolio sync · M5
|
|
63
|
+
|
|
64
|
+
**Ready**
|
|
65
|
+
|
|
66
|
+
- [[F-01]] Frontend skeleton and guards · M0
|
|
67
|
+
- [[B-18]] Valuation · M4
|
|
68
|
+
|
|
69
|
+
**Blocked**
|
|
70
|
+
|
|
71
|
+
- [[B-21]] Journal and thesis gates · M5 · waits on B-20
|
|
72
|
+
|
|
73
|
+
**Done (20)** [[B-01]] [[B-02]] [[B-03]] ...
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
A task's status still lives only in its own file. The list is a view: the agent rewrites it with `sw.mjs board` whenever a task changes, and `lint` says when it has fallen behind.
|
|
77
|
+
|
|
53
78
|
## Install
|
|
54
79
|
|
|
55
80
|
Requires Node 18 or newer.
|
|
@@ -263,7 +288,8 @@ node docs/.sw/sw.mjs check P-15 # can it start or finish, what is op
|
|
|
263
288
|
node docs/.sw/sw.mjs explain P-15 # dependencies, what it unblocks, plan, area guide
|
|
264
289
|
node docs/.sw/sw.mjs search sync timeout # where something is mentioned
|
|
265
290
|
node docs/.sw/sw.mjs next-id P # next free id in an area
|
|
266
|
-
node docs/.sw/sw.mjs
|
|
291
|
+
node docs/.sw/sw.mjs board # rewrite the task list in index.md from the task files
|
|
292
|
+
node docs/.sw/sw.mjs lint # broken links, bad frontmatter, dependency errors, a stale task list
|
|
267
293
|
node docs/.sw/sw.mjs stats # tokens, context and steps of the agent session here
|
|
268
294
|
node docs/.sw/sw.mjs doctor # what that session carried before it read anything
|
|
269
295
|
node docs/.sw/sw.mjs serve --open # the viewer, reading files live
|
|
@@ -281,6 +307,7 @@ Edit sources in `src/`:
|
|
|
281
307
|
| File | What it is |
|
|
282
308
|
| --- | --- |
|
|
283
309
|
| `src/core.js` | the vault model, derived task state, lint and search; shared by the CLI and the viewer |
|
|
310
|
+
| `src/board.js` | the task list in `index.md` |
|
|
284
311
|
| `src/sessions.js` | finds the record an agent keeps of a session |
|
|
285
312
|
| `src/stats.js` | reduces a session record to cost per agent |
|
|
286
313
|
| `src/doctor.js` | reduces a session record to what the session started with |
|
package/package.json
CHANGED
|
@@ -25,7 +25,10 @@ Run commands from the project root. `<skill-dir>` is the directory this SKILL.md
|
|
|
25
25
|
| `plan: none` | fine for a small task: one area, three "Done when" items or fewer, nothing open in its notes, a few files. For anything larger, recommend sw-plan first and let the user choose |
|
|
26
26
|
| `review: required (...)` | remember it for step 7 |
|
|
27
27
|
|
|
28
|
-
3. **Mark it started** before any work:
|
|
28
|
+
3. **Mark it started** before any work:
|
|
29
|
+
- in the frontmatter of `docs/tasks/<ID>.md`, `status: in-progress` and `started:` today;
|
|
30
|
+
- in `docs/log.md`, a new entry `## [date] task | <ID> started`, in the layout its last entries use;
|
|
31
|
+
- `node docs/.sw/sw.mjs board`, so the task list in `index.md` shows it.
|
|
29
32
|
4. **Checks that need the environment.** If the task has a plan, look for `needs:` in it: `grep -n 'needs:' docs/plans/<ID>-plan.md`. Each hit is a check that starts services or changes data. Ask the user which of them may run; without a yes, none.
|
|
30
33
|
5. **Dispatch the implementer** (how: "Dispatching" below). Its prompt is the task id, the project root if it is not your working directory, and which `needs:` checks it may run. Do not paste the plan into the prompt; it reads the files.
|
|
31
34
|
6. **Judge the report.** Its `Requirements:` list must name every "Done when" item and every scope, state or constraint item of the task; compare it with the task file.
|
|
@@ -36,7 +39,7 @@ Run commands from the project root. `<skill-dir>` is the directory this SKILL.md
|
|
|
36
39
|
- `Verdict: pass`: go on. Pass `important` and `minor` findings to the user in your report; they do not block.
|
|
37
40
|
- `Verdict: changes needed`: dispatch the implementer again with the blocking findings, word for word, then the reviewer again with the files changed since. After two rounds that still end in `changes needed`, stop and put the findings to the user.
|
|
38
41
|
- Do not review the change yourself in place of the reviewer, and do not argue a blocking finding away. If you think a finding is wrong, say so to the user and let them decide.
|
|
39
|
-
8. **Record the outcome
|
|
42
|
+
8. **Record the outcome**, then run `node docs/.sw/sw.mjs board`.
|
|
40
43
|
|
|
41
44
|
| Outcome | Task file | Log entry |
|
|
42
45
|
| --- | --- | --- |
|
|
@@ -50,7 +53,7 @@ Run commands from the project root. `<skill-dir>` is the directory this SKILL.md
|
|
|
50
53
|
10. **File what else was learned.** These are separate offers: act on each only when the user says yes to that one.
|
|
51
54
|
- A report held a decision or constraint the wiki should keep: offer a wiki page (`type: decision` or `concept`), added to `index.md`.
|
|
52
55
|
- The task fixed a problem whose cause is now known, or the review caught a defect worth remembering: offer a `type: lesson` page (Symptom, Cause, Fix, How to notice it earlier); sw-triage finds these later.
|
|
53
|
-
- A report named follow-up work: offer to create the tasks.
|
|
56
|
+
- A report named follow-up work, or the review left `important` findings open: offer to create the tasks. A finding that lives only in the log is forgotten.
|
|
54
57
|
11. **Report** to the user, in this order. Commit only if the user asks.
|
|
55
58
|
- the outcome;
|
|
56
59
|
- each requirement with its evidence, and anything that differs from the task;
|
|
@@ -77,6 +80,7 @@ The same table serves both roles: `sw-implementer` with `implementer.md`, `sw-re
|
|
|
77
80
|
- Accepting a `differs` item on the user's behalf. A sensible alternative is still not what the task asked for.
|
|
78
81
|
- Skipping the review on a task that requires it, or doing it yourself in the same context that judged the implementation.
|
|
79
82
|
- Starting work before the task file says `in-progress`. If the session dies, nobody knows the task was touched.
|
|
80
|
-
- Letting a subagent edit the task file or the
|
|
83
|
+
- Letting a subagent edit the task file, the log or the task list. One writer for status: you.
|
|
84
|
+
- Editing the task list in `index.md` by hand. It is written from the task files; change the task file and run `board`.
|
|
81
85
|
- Reading the plan or the code "to follow along". The subagents already paid for that.
|
|
82
86
|
- Running the next task in the same session out of momentum.
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
`docs/` is a wiki you write and keep current, and an Obsidian vault the user reads.
|
|
5
5
|
|
|
6
|
+
{{#tasks}}
|
|
7
|
+
- `docs/index.md`: the open tasks, then the catalog, one line per wiki page. Read it first, then open only the pages you need.
|
|
8
|
+
{{/tasks}}
|
|
9
|
+
{{^tasks}}
|
|
6
10
|
- `docs/index.md`: catalog, one line per wiki page. Read it first, then open only the pages you need.
|
|
11
|
+
{{/tasks}}
|
|
7
12
|
- `docs/log.md`: append-only. Add `## [YYYY-MM-DD] <kind> | <title>` at the end; read it with `tail`, never whole.
|
|
8
13
|
- `docs/raw/`: sources. Read, never modify.
|
|
9
14
|
- `docs/wiki/`: flat, one page per topic, frontmatter `type:` and one-line `summary:`.
|
|
@@ -27,6 +32,7 @@ Wiki:
|
|
|
27
32
|
Tasks:
|
|
28
33
|
|
|
29
34
|
- A task's status lives only in its frontmatter. Before you start: `status: in-progress` and `started:`. When its "Done when" list is met: `status: done` and `finished:`. Each change of status gets a `task` entry in `log.md`.
|
|
35
|
+
- The task list in `index.md` is written from the task files. After you add a task or change a task's status, title, milestone or dependencies, run `node docs/.sw/sw.mjs board`. Never edit that list by hand.
|
|
30
36
|
- Do not start a task while any of its `deps` is not done.
|
|
31
37
|
- If `explain <ID>` names an area guide (`docs/wiki/guide-<area>.md`), read it before you change code for the task: where things are, patterns, how to verify. Afterwards add the facts it was missing, one line each.
|
|
32
38
|
- Work that belongs to no task (a quick fix, a small request) needs no task file. Append one `change` entry to `log.md` instead: what changed and why, in a line.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Generated by scripts/build.mjs from src/core.js, src/sessions.js, src/stats.js, src/doctor.js, src/cli.js. Do not edit.
|
|
2
|
+
// Generated by scripts/build.mjs from src/core.js, src/board.js, src/sessions.js, src/stats.js, src/doctor.js, src/cli.js. Do not edit.
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, statSync, writeFileSync } from 'node:fs';
|
|
4
4
|
import { homedir } from 'node:os';
|
|
5
5
|
import { basename, dirname, join, resolve as resolvePath, sep } from 'node:path';
|
|
@@ -322,6 +322,75 @@ export function guideFor(vault, area) {
|
|
|
322
322
|
return vault.pages.find(p => p.folder === 'wiki' && p.data.type === 'guide' && key(p.data.area ?? '') === key(area)) || null;
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
+
// The task board: the open tasks as a section of index.md, so a person can follow the work in the
|
|
326
|
+
// vault itself, without the viewer. It is a view, written from the task files by `sw.mjs board`
|
|
327
|
+
// and never edited by hand; a task's status still lives only in its own frontmatter.
|
|
328
|
+
// Open tasks get a line each. Finished ones are listed by id only, so the section stays small as
|
|
329
|
+
// a project grows: index.md is the one file every session reads.
|
|
330
|
+
|
|
331
|
+
const BOARD_START = '<!-- sw:board:start (written by `sw.mjs board`; do not edit) -->';
|
|
332
|
+
const BOARD_END = '<!-- sw:board:end -->';
|
|
333
|
+
const BOARD_BLOCK = /<!-- sw:board:start[^\n]*-->\n[\s\S]*?<!-- sw:board:end -->/;
|
|
334
|
+
const REFRESH = 'run `node docs/.sw/sw.mjs board`';
|
|
335
|
+
|
|
336
|
+
// Sections in reading order: what is being worked on, what can start, what waits.
|
|
337
|
+
const OPEN_STATES = [['progress', 'In progress'], ['ready', 'Ready'], ['blocked', 'Blocked']];
|
|
338
|
+
|
|
339
|
+
function openLine(vault, task) {
|
|
340
|
+
// A dependency that does not exist is lint's finding, not something a task waits on.
|
|
341
|
+
const waiting = task.openDeps.filter(id => taskOf(vault, id));
|
|
342
|
+
return [
|
|
343
|
+
`- [[${task.id}]] ${task.title}`,
|
|
344
|
+
...(task.milestone ? [task.milestone] : []),
|
|
345
|
+
...(task.state === 'blocked' && waiting.length ? [`waits on ${waiting.join(', ')}`] : []),
|
|
346
|
+
].join(' · ');
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// The board for this vault, markers included.
|
|
350
|
+
export function taskBoard(vault) {
|
|
351
|
+
const { total } = summary(vault);
|
|
352
|
+
const counts = [
|
|
353
|
+
`ready ${total.ready}`, `in progress ${total.progress}`, `blocked ${total.blocked}`, `done ${total.done}`,
|
|
354
|
+
...(total.cancelled ? [`cancelled ${total.cancelled}`] : []),
|
|
355
|
+
];
|
|
356
|
+
const sections = OPEN_STATES
|
|
357
|
+
.map(([state, heading]) => [heading, tasksIn(vault, state)])
|
|
358
|
+
.filter(([, tasks]) => tasks.length)
|
|
359
|
+
.map(([heading, tasks]) => `**${heading}**\n\n${tasks.map(task => openLine(vault, task)).join('\n')}`);
|
|
360
|
+
// Finished tasks are looked up, not worked through: by id, not in running order.
|
|
361
|
+
const done = tasksIn(vault, 'done').map(task => task.id).sort((a, b) => a.localeCompare(b, 'en', { numeric: true })).map(id => `[[${id}]]`);
|
|
362
|
+
const paragraphs = [
|
|
363
|
+
'## Tasks',
|
|
364
|
+
total.total ? counts.join(' · ') : 'No tasks yet.',
|
|
365
|
+
...sections,
|
|
366
|
+
...(done.length ? [`**Done (${done.length})** ${done.join(' ')}`] : []),
|
|
367
|
+
];
|
|
368
|
+
return `${BOARD_START}\n${paragraphs.join('\n\n')}\n${BOARD_END}`;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
export const boardIn = indexText => (String(indexText).match(BOARD_BLOCK) || [null])[0];
|
|
372
|
+
|
|
373
|
+
// index.md with this board in it: in place of the one it has, otherwise right under the title.
|
|
374
|
+
export function indexWithBoard(indexText, board) {
|
|
375
|
+
const text = String(indexText);
|
|
376
|
+
if (BOARD_BLOCK.test(text)) return text.replace(BOARD_BLOCK, () => board);
|
|
377
|
+
const title = text.match(/^# .*\n?/);
|
|
378
|
+
if (!title) return `${board}\n\n${text}`;
|
|
379
|
+
const rest = text.slice(title[0].length).replace(/^\n+/, '');
|
|
380
|
+
return `${title[0].trimEnd()}\n\n${board}\n${rest ? `\n${rest}` : ''}`;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// A lint finding when index.md does not show the tasks as they are now, else null.
|
|
384
|
+
export function boardFinding(vault) {
|
|
385
|
+
if (!vault.index) return null; // a missing index is reported on its own
|
|
386
|
+
const current = boardIn(vault.index.body);
|
|
387
|
+
if (!current && !vault.tasks.size) return null; // a vault without tasks needs no board
|
|
388
|
+
if (current === taskBoard(vault)) return null;
|
|
389
|
+
return current
|
|
390
|
+
? { level: 'warn', code: 'stale-board', path: 'index.md', message: `the task list is out of date; ${REFRESH}` }
|
|
391
|
+
: { level: 'warn', code: 'missing-board', path: 'index.md', message: `the tasks are not listed; ${REFRESH}` };
|
|
392
|
+
}
|
|
393
|
+
|
|
325
394
|
// Finds the record an agent tool keeps of the session working in a project.
|
|
326
395
|
// Claude Code, Codex and Copilot CLI each write every session to disk in their own layout; this
|
|
327
396
|
// lists a project's sessions as { tool, id, modified, current, source } and picks one. What a
|
|
@@ -913,6 +982,7 @@ const HELP = `sw <command> [--docs <dir>] [--json]
|
|
|
913
982
|
explain <ID> a task's dependencies, what it blocks and unblocks, its plan and linked pages
|
|
914
983
|
search <words> pages and log entries that mention the words, best match first
|
|
915
984
|
next-id <AREA> next free task id for an area (numbers are never reused)
|
|
985
|
+
board rewrite the task list in docs/index.md from the task files
|
|
916
986
|
lint structural checks; exit code 1 on errors
|
|
917
987
|
stats what the agent session here has cost so far: steps, context and tokens per agent
|
|
918
988
|
doctor what that session carried before it read anything: rule files, skill and tool lists
|
|
@@ -1128,8 +1198,25 @@ function nextIdCommand({ vault, args }) {
|
|
|
1128
1198
|
return { data: { id }, text: id };
|
|
1129
1199
|
}
|
|
1130
1200
|
|
|
1201
|
+
// The task list in index.md is a view of the task files; this writes it again from them.
|
|
1202
|
+
function boardCommand({ docs, vault }) {
|
|
1203
|
+
if (!existsSync(join(docs, 'tasks'))) return { error: 'this vault has no task module (docs/tasks); sw-init --tasks adds it', code: 1 };
|
|
1204
|
+
const path = join(docs, 'index.md');
|
|
1205
|
+
if (!existsSync(path)) return { error: 'docs/index.md is missing; run sw-init', code: 1 };
|
|
1206
|
+
const before = readFileSync(path, 'utf8');
|
|
1207
|
+
const after = indexWithBoard(before, taskBoard(vault));
|
|
1208
|
+
const changed = after !== before;
|
|
1209
|
+
if (changed) writeFileSync(path, after);
|
|
1210
|
+
const { total } = summary(vault);
|
|
1211
|
+
return {
|
|
1212
|
+
data: { changed, ready: total.ready, inProgress: total.progress, blocked: total.blocked, done: total.done },
|
|
1213
|
+
text: `board: docs/index.md ${changed ? 'updated' : 'unchanged'} ready ${total.ready} in-progress ${total.progress} blocked ${total.blocked} done ${total.done}`,
|
|
1214
|
+
};
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1131
1217
|
function lintCommand({ vault }) {
|
|
1132
|
-
const
|
|
1218
|
+
const board = boardFinding(vault);
|
|
1219
|
+
const findings = [...lint(vault), ...(board ? [board] : [])];
|
|
1133
1220
|
const errors = findings.filter(f => f.level === 'error').length;
|
|
1134
1221
|
return {
|
|
1135
1222
|
data: findings,
|
|
@@ -1272,6 +1359,7 @@ const COMMANDS = {
|
|
|
1272
1359
|
explain: { run: explain, needsVault: true },
|
|
1273
1360
|
search: { run: searchCommand, needsVault: true },
|
|
1274
1361
|
'next-id': { run: nextIdCommand, needsVault: true },
|
|
1362
|
+
board: { run: boardCommand, needsVault: true },
|
|
1275
1363
|
lint: { run: lintCommand, needsVault: true },
|
|
1276
1364
|
stats: { run: statsCommand, needsVault: false },
|
|
1277
1365
|
doctor: { run: doctorCommand, needsVault: false },
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// Scaffolds docs/ as a Superwiki vault. Safe to re-run: user content is kept, tool files are
|
|
3
3
|
// replaced with this version, and the report says which was which.
|
|
4
|
+
import { spawnSync } from 'node:child_process';
|
|
4
5
|
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
|
|
5
6
|
import { basename, dirname, join, resolve } from 'node:path';
|
|
6
7
|
import { fileURLToPath } from 'node:url';
|
|
@@ -11,6 +12,7 @@ const MANAGED_BLOCK = /<!-- sw:start[\s\S]*?<!-- sw:end -->/;
|
|
|
11
12
|
// What a vault consists of at the top of docs/. Anything else there belongs to someone else.
|
|
12
13
|
const VAULT_ENTRIES = ['index.md', 'log.md', 'raw', 'wiki', 'tasks', 'plans', 'viewer.html'];
|
|
13
14
|
const ROLES = ['plan', 'implement', 'review'];
|
|
15
|
+
const NEW_INDEX = '# Index\n\n## Wiki\n\nCatalog of the wiki: one line per page, `- [[file-name]]: summary`, grouped by type.\n';
|
|
14
16
|
|
|
15
17
|
const HELP = `init.mjs [--root <dir>] [--tasks | --no-tasks] [--areas "M=Mobile,B=Backend"]
|
|
16
18
|
|
|
@@ -116,7 +118,7 @@ function writeVault(docs, tasks, report) {
|
|
|
116
118
|
}
|
|
117
119
|
|
|
118
120
|
const today = new Date().toISOString().slice(0, 10);
|
|
119
|
-
report.keep(join(docs, 'index.md'),
|
|
121
|
+
report.keep(join(docs, 'index.md'), NEW_INDEX);
|
|
120
122
|
report.keep(join(docs, 'log.md'), `# Log\n\nAppend-only. Entry format: \`## [YYYY-MM-DD] kind | title\`.\n\n## [${today}] init | Superwiki vault created\n`);
|
|
121
123
|
|
|
122
124
|
// The viewer snapshot and the local server's address are per-machine and regenerated on demand.
|
|
@@ -128,6 +130,18 @@ function writeVault(docs, tasks, report) {
|
|
|
128
130
|
}
|
|
129
131
|
}
|
|
130
132
|
|
|
133
|
+
// The task list in index.md is the one part of that file the tool owns. The vault's own CLI
|
|
134
|
+
// writes it, so an upgraded vault gets the list in the format of the version just installed.
|
|
135
|
+
function writeTaskBoard(docs, report) {
|
|
136
|
+
const index = join(docs, 'index.md');
|
|
137
|
+
const cli = join(docs, '.sw', 'sw.mjs');
|
|
138
|
+
if (!existsSync(cli)) return; // already reported as missing
|
|
139
|
+
const before = readFileSync(index, 'utf8');
|
|
140
|
+
const run = spawnSync(process.execPath, [cli, 'board', '--docs', docs], { encoding: 'utf8' });
|
|
141
|
+
if (run.status !== 0) return report.line('note', `the task list in docs/index.md was not written: ${run.stderr.trim()}`);
|
|
142
|
+
report.line(readFileSync(index, 'utf8') === before ? 'unchanged' : 'updated', 'docs/index.md (task list)');
|
|
143
|
+
}
|
|
144
|
+
|
|
131
145
|
function writeAgentRules(root, tasks, report) {
|
|
132
146
|
const block = schemaBlock(tasks);
|
|
133
147
|
const agentsPath = join(root, 'AGENTS.md');
|
|
@@ -174,6 +188,7 @@ function main(argv) {
|
|
|
174
188
|
const hadTaskFiles = !previous && existsSync(join(docs, 'tasks'));
|
|
175
189
|
const report = createReport(root);
|
|
176
190
|
writeVault(docs, tasks, report);
|
|
191
|
+
if (tasks) writeTaskBoard(docs, report);
|
|
177
192
|
const config = buildConfig(previous, { root, tasks, areas: options.areas });
|
|
178
193
|
report.write(configPath, JSON.stringify(config, null, 2) + '\n');
|
|
179
194
|
writeAgentRules(root, tasks, report);
|
package/skills/sw-lint/SKILL.md
CHANGED
|
@@ -17,6 +17,7 @@ Two passes. The first is a script and costs almost nothing. The second reads pag
|
|
|
17
17
|
|
|
18
18
|
| Finding | Fix |
|
|
19
19
|
|---|---|
|
|
20
|
+
| `stale-board`, `missing-board` | `node docs/.sw/sw.mjs board`: it rewrites the task list in `index.md` from the task files. Never edit that list by hand |
|
|
20
21
|
| `not-in-index` | add `- [[page]]: summary` to `index.md`, using the page's `summary:` |
|
|
21
22
|
| `missing-field` `summary` | copy it from the page's line in `index.md`; if there is none, read the page and write it |
|
|
22
23
|
| `missing-field` `type` | read that page, write the field |
|
package/skills/sw-plan/SKILL.md
CHANGED
|
@@ -14,7 +14,10 @@ Needs the task module (`docs/tasks/`). If it is missing, say so and offer sw-ini
|
|
|
14
14
|
1. **Pick the task.**
|
|
15
15
|
- Id given: `node docs/.sw/sw.mjs check <ID>`, then read `docs/tasks/<ID>.md`. Status `done` or `cancelled`: stop and ask what the user wants. A plan already exists: this run revises it; say so. Open deps do not prevent planning.
|
|
16
16
|
- No id, existing work: `node docs/.sw/sw.mjs ready`, and let the user choose.
|
|
17
|
-
- New work: agree on title, area and dependencies with the user, get the id from `node docs/.sw/sw.mjs next-id <AREA
|
|
17
|
+
- New work: agree on title, area and dependencies with the user, and get the id from `node docs/.sw/sw.mjs next-id <AREA>`. Then:
|
|
18
|
+
- write `docs/tasks/<ID>.md` from `docs/.sw/templates/task.md` with `status: todo`, a "Goal" and a "Done when" list;
|
|
19
|
+
- append `## [date] task | <ID> created` to `docs/log.md`;
|
|
20
|
+
- run `node docs/.sw/sw.mjs board`, so the task list in `index.md` shows it.
|
|
18
21
|
2. **Does it need a plan?** Judge from the task file alone. A task is small when all of these hold: one area, three "Done when" items or fewer, nothing left open in its notes, and the change it describes is confined to a few files. A small task needs no plan: say so and offer `sw-implement <ID>` directly. Go on with planning only if the user wants a plan anyway, or the task is not small.
|
|
19
22
|
3. **Clarify.** Ask the user only what the task file leaves open about scope or intent, one question at a time, each with your recommendation. Add the answers to the task's "Notes" now. Do not read code to find questions; the planner surfaces the technical ones. Skip this when nothing is open.
|
|
20
23
|
4. **Dispatch the planner.** Its prompt is: the task id, today's date, the project root if it is not your working directory, and any feedback from an earlier round. It writes the plan file as a draft and returns a short message.
|
|
@@ -36,7 +39,7 @@ Needs the task module (`docs/tasks/`). If it is missing, say so and offer sw-ini
|
|
|
36
39
|
- in the area guide, if `node docs/.sw/sw.mjs explain <ID>` names one, the planner's `Guide:` lines, one line per fact;
|
|
37
40
|
- in `docs/log.md`, a new entry `## [date] plan | <ID>`, in the layout the log's last entries use.
|
|
38
41
|
|
|
39
|
-
Then run `node docs/.sw/sw.mjs lint`.
|
|
42
|
+
Then run `node docs/.sw/sw.mjs lint`. If it reports `stale-board`, a task's title, milestone or dependencies changed along the way: run `node docs/.sw/sw.mjs board`.
|
|
40
43
|
7. **Stop.** Do not start implementing. Tell the user the plan is approved and that sw-implement `<ID>` runs it.
|
|
41
44
|
|
|
42
45
|
## Common mistakes
|
|
@@ -46,3 +49,4 @@ Needs the task module (`docs/tasks/`). If it is missing, say so and offer sw-ini
|
|
|
46
49
|
- Editing the plan yourself. If something in it is wrong, send it back to the planner.
|
|
47
50
|
- Setting the task to `in-progress`. Planning does not change status.
|
|
48
51
|
- Planning several tasks in one plan file. One task, one plan; shared design goes to a `type: decision` wiki page that the plans link.
|
|
52
|
+
- Adding the new task to the list in `index.md` by hand. `board` writes that list from the task files.
|