@erclx/canon 5.43.0 → 5.44.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 (133) hide show
  1. package/claude/.claude-plugin/plugin.json +1 -1
  2. package/claude/skills/backlog-triage/references/apply.md +6 -6
  3. package/claude/skills/canon-cli/SKILL.md +4 -4
  4. package/claude/skills/canvas-board/REQUIREMENT.md +1 -1
  5. package/claude/skills/canvas-board/SKILL.md +1 -1
  6. package/claude/skills/context-fold/references/context.md +1 -1
  7. package/claude/skills/create-skill/REQUIREMENT.md +1 -1
  8. package/claude/skills/create-skill/SKILL.md +2 -2
  9. package/claude/skills/create-skill/references/skill-requirement.md +68 -9
  10. package/claude/skills/create-skill/references/skill.md +1 -1
  11. package/claude/skills/design-identity/REQUIREMENT.md +40 -0
  12. package/claude/skills/design-identity/SKILL.md +138 -0
  13. package/claude/skills/{draft-identity → design-identity}/references/card-route.md +2 -2
  14. package/claude/skills/design-taste/REQUIREMENT.md +4 -4
  15. package/claude/skills/design-taste/SKILL.md +2 -2
  16. package/claude/skills/design-taste/references/kinds.md +1 -1
  17. package/claude/skills/design-taste/references/preflight.md +1 -1
  18. package/claude/skills/draft-and-pick/REQUIREMENT.md +8 -69
  19. package/claude/skills/draft-and-pick/SKILL.md +3 -153
  20. package/claude/skills/draft-doc/REQUIREMENT.md +9 -30
  21. package/claude/skills/draft-doc/SKILL.md +4 -76
  22. package/claude/skills/draft-figure/REQUIREMENT.md +8 -42
  23. package/claude/skills/draft-figure/SKILL.md +3 -77
  24. package/claude/skills/draft-identity/REQUIREMENT.md +8 -23
  25. package/claude/skills/draft-identity/SKILL.md +3 -130
  26. package/claude/skills/draft-ready/REQUIREMENT.md +8 -37
  27. package/claude/skills/draft-ready/SKILL.md +3 -128
  28. package/claude/skills/draft-screencast/REQUIREMENT.md +8 -23
  29. package/claude/skills/draft-screencast/SKILL.md +3 -62
  30. package/claude/skills/draft-slides/REQUIREMENT.md +8 -27
  31. package/claude/skills/draft-slides/SKILL.md +3 -72
  32. package/claude/skills/draw-figure/REQUIREMENT.md +59 -0
  33. package/claude/skills/draw-figure/SKILL.md +85 -0
  34. package/claude/skills/{draft-figure → draw-figure}/references/architecture-set.md +2 -2
  35. package/claude/skills/{draft-figure → draw-figure}/references/hand-drawn.md +2 -2
  36. package/claude/skills/{draft-figure → draw-figure}/references/mermaid-path.md +2 -2
  37. package/claude/skills/{draft-figure → draw-figure}/references/mermaid.md +1 -1
  38. package/claude/skills/make-deck/REQUIREMENT.md +44 -0
  39. package/claude/skills/make-deck/SKILL.md +80 -0
  40. package/claude/skills/markdown-craft/REQUIREMENT.md +1 -1
  41. package/claude/skills/markdown-craft/SKILL.md +2 -2
  42. package/claude/skills/pick-by-eye/REQUIREMENT.md +86 -0
  43. package/claude/skills/pick-by-eye/SKILL.md +161 -0
  44. package/claude/skills/plan-feature/SKILL.md +2 -1
  45. package/claude/skills/plan-feature/references/plan.md +24 -10
  46. package/claude/skills/plan-groundwork/SKILL.md +1 -1
  47. package/claude/skills/plan-intake/SKILL.md +1 -1
  48. package/claude/skills/plan-ready/REQUIREMENT.md +54 -0
  49. package/claude/skills/plan-ready/SKILL.md +136 -0
  50. package/claude/skills/{draft-ready → plan-ready}/references/assembly.md +1 -1
  51. package/claude/skills/{draft-ready → plan-ready}/references/ready.md +1 -1
  52. package/claude/skills/record-screencast/REQUIREMENT.md +3 -3
  53. package/claude/skills/record-screencast/SKILL.md +2 -2
  54. package/claude/skills/role-orchestrator/REQUIREMENT.md +1 -1
  55. package/claude/skills/role-orchestrator/references/orchestrator-dispatch.md +5 -2
  56. package/claude/skills/role-orchestrator/references/orchestrator-parked.md +2 -2
  57. package/claude/skills/role-orchestrator/references/orchestrator-refill.md +18 -13
  58. package/claude/skills/role-planner/SKILL.md +2 -1
  59. package/claude/skills/role-worker/SKILL.md +9 -0
  60. package/claude/skills/script-screencast/REQUIREMENT.md +40 -0
  61. package/claude/skills/script-screencast/SKILL.md +70 -0
  62. package/claude/skills/{draft-screencast → script-screencast}/references/beats-template.md +2 -2
  63. package/claude/skills/search-craft/REQUIREMENT.md +4 -4
  64. package/claude/skills/search-craft/SKILL.md +1 -1
  65. package/claude/skills/target-setup/SKILL.md +1 -0
  66. package/claude/skills/task-board/SKILL.md +11 -9
  67. package/claude/skills/task-board/references/board.md +15 -12
  68. package/claude/skills/teach-workspace/SKILL.md +1 -1
  69. package/claude/skills/teach-workspace/references/lesson-craft.md +2 -2
  70. package/claude/skills/ui-checklist/SKILL.md +2 -0
  71. package/claude/skills/write-doc/REQUIREMENT.md +46 -0
  72. package/claude/skills/write-doc/SKILL.md +83 -0
  73. package/claude/skills/{draft-doc → write-doc}/references/context.md +2 -2
  74. package/claude/skills/{draft-doc → write-doc}/references/docs.md +2 -2
  75. package/claude/skills/{draft-doc → write-doc}/references/readme.md +2 -2
  76. package/claude/skills/{draft-doc → write-doc}/references/wiki-kind.md +3 -3
  77. package/docs/agents/markdown-audit.md +4 -2
  78. package/docs/agents/migrate.md +2 -2
  79. package/docs/target/migrations.md +17 -4
  80. package/docs/target/projects.md +1 -1
  81. package/docs/workflow/parallel-features.md +3 -2
  82. package/docs/workflow/skill-map-on-request.md +18 -12
  83. package/docs/workflow/skill-map.md +13 -12
  84. package/docs/workflow/visual-design-workflow.md +2 -2
  85. package/governance/ledger/framework/astro.md +73 -0
  86. package/governance/ledger/framework/fastapi.md +76 -0
  87. package/governance/ledger/framework/nextjs.md +86 -0
  88. package/governance/ledger/framework/react.md +83 -0
  89. package/governance/ledger/framework/shadcn.md +60 -0
  90. package/governance/ledger/framework/tailwind.md +55 -0
  91. package/governance/rules/framework/astro.md +12 -14
  92. package/governance/rules/framework/fastapi.md +20 -24
  93. package/governance/rules/framework/nextjs.md +19 -27
  94. package/governance/rules/framework/react.md +22 -33
  95. package/governance/rules/framework/shadcn.md +11 -15
  96. package/governance/rules/framework/tailwind.md +12 -14
  97. package/governance/rules/writing/markdown.md +1 -1
  98. package/package.json +1 -1
  99. package/src/claude/cases/authoring.ts +15 -3
  100. package/src/claude/cases/misc.ts +12 -0
  101. package/src/claude/cases/workflow.ts +19 -1
  102. package/src/claude/skills-audit.ts +113 -1
  103. package/src/commands/claude.ts +34 -11
  104. package/src/commands/demo.ts +1 -1
  105. package/src/commands/markdown.ts +1 -1
  106. package/src/commands/migrate.ts +4 -0
  107. package/src/commands/pr.ts +30 -6
  108. package/src/commands/tasks.ts +383 -2
  109. package/src/context/audit.ts +1 -1
  110. package/src/demo/beats.ts +1 -1
  111. package/src/gov/audit.ts +3 -2
  112. package/src/markdown/scope.ts +45 -35
  113. package/src/migrate/record-layout.ts +1 -1
  114. package/src/migrate/skill-names.ts +68 -21
  115. package/src/pr/frames.ts +14 -3
  116. package/src/records/validate.ts +31 -0
  117. package/src/tasks/board.ts +854 -0
  118. package/src/tasks/record.ts +20 -1
  119. package/src/tasks/validate.ts +206 -9
  120. package/tooling/astro/configs/card-src/pages/og-card.astro +1 -1
  121. package/tooling/astro/reference.md +2 -2
  122. package/tooling/claude/seeds/.claude/hooks/board-validate.sh +65 -0
  123. package/tooling/claude/seeds/.claude/settings.json +4 -0
  124. /package/claude/skills/{draft-figure → draw-figure}/references/figures.md +0 -0
  125. /package/claude/skills/{draft-slides → make-deck}/references/deck.md +0 -0
  126. /package/claude/skills/{draft-and-pick → pick-by-eye}/references/live-arms.md +0 -0
  127. /package/claude/skills/{draft-doc → write-doc}/references/readme/agent-facing.md +0 -0
  128. /package/claude/skills/{draft-doc → write-doc}/references/readme/application.md +0 -0
  129. /package/claude/skills/{draft-doc → write-doc}/references/readme/cli.md +0 -0
  130. /package/claude/skills/{draft-doc → write-doc}/references/readme/library.md +0 -0
  131. /package/claude/skills/{draft-doc → write-doc}/references/readme/plugin.md +0 -0
  132. /package/claude/skills/{draft-doc → write-doc}/references/requirements.md +0 -0
  133. /package/claude/skills/{draft-doc → write-doc}/references/wiki.md +0 -0
@@ -16,6 +16,7 @@ import {
16
16
  readPullRequest,
17
17
  tasksDir,
18
18
  } from '@/tasks/archive'
19
+ import { checkWaiting, type LinkPromotion, promoteOnLink } from '@/tasks/board'
19
20
 
20
21
  /**
21
22
  * Lines a task carries above its outcomes naming where the work came from. The
@@ -79,6 +80,8 @@ export interface PlanRecorded {
79
80
  readonly action: LineAction
80
81
  /** The target the line named before a correction. Undefined unless it differed. */
81
82
  readonly replaced: string | undefined
83
+ /** Whether the link moved the task's row out of `## Needs a plan`. */
84
+ readonly board: LinkPromotion
82
85
  }
83
86
 
84
87
  export type PlanOutcome = PlanRecorded | RecordRefused
@@ -472,7 +475,13 @@ export async function recordPlan(
472
475
  stem: string,
473
476
  reference: string,
474
477
  add = false,
478
+ waiting?: string,
475
479
  ): Promise<PlanOutcome> {
480
+ if (waiting !== undefined) {
481
+ const bad = checkWaiting(waiting)
482
+ if (bad) return refuse('bad-input', bad.message, bad.detail)
483
+ }
484
+
476
485
  const opened = await openTask(root, { kind: 'stem', stem })
477
486
  if ('ok' in opened) return opened
478
487
 
@@ -500,7 +509,17 @@ export async function recordPlan(
500
509
  const { text, action, replaced } = written
501
510
  if (action !== 'unchanged') await writeFile(path, text)
502
511
 
503
- return { ok: true, stem: opened.stem, path, plan: target, action, replaced }
512
+ const board = await promoteOnLink(root, opened.stem, { waiting })
513
+
514
+ return {
515
+ ok: true,
516
+ stem: opened.stem,
517
+ path,
518
+ plan: target,
519
+ action,
520
+ replaced,
521
+ board,
522
+ }
504
523
  }
505
524
 
506
525
  /**
@@ -12,6 +12,12 @@ import {
12
12
  resolveLivePlan,
13
13
  tasksDir,
14
14
  } from '@/tasks/archive'
15
+ import {
16
+ deriveCells,
17
+ GROUP_COLUMNS,
18
+ renderedLength,
19
+ WAITING_LIMIT,
20
+ } from '@/tasks/board'
15
21
  import { gitTrunkReader, type TrunkReader } from '@/tasks/trunk'
16
22
 
17
23
  const ORDERING_FILE = 'priority.md'
@@ -50,6 +56,9 @@ export const FINDING_KINDS = [
50
56
  'row-misordered',
51
57
  'row-unranked',
52
58
  'touches-unstated',
59
+ 'touches-stale',
60
+ 'columns-mismatched',
61
+ 'cell-long',
53
62
  'blocker-settled',
54
63
  'blocker-unresolved',
55
64
  'blocker-declined',
@@ -145,6 +154,8 @@ export interface BoardRow {
145
154
  readonly plan: string | undefined
146
155
  /** Absent when the group fixes no `Touches` column, empty when it read none. */
147
156
  readonly touches: readonly string[] | undefined
157
+ /** The `Touches` cell as written, which the stale check compares against the derivation. */
158
+ readonly touchesText: string | undefined
148
159
  /** Absent when the group fixes no `Waiting on` column, which is `## Run now`. */
149
160
  readonly waiting: string | undefined
150
161
  /** The ordinal phrase a `Waiting on` cell states about its own position, undefined when the cell carries none. */
@@ -271,8 +282,8 @@ function splitCells(line: string): string[] {
271
282
  return line
272
283
  .trim()
273
284
  .replace(/^\|/, '')
274
- .replace(/\|$/, '')
275
- .split('|')
285
+ .replace(/(?<!\\)\|$/, '')
286
+ .split(/(?<!\\)\|/)
276
287
  .map((cell) => cell.trim())
277
288
  }
278
289
 
@@ -288,6 +299,21 @@ function isGroup(heading: string): heading is BoardGroup {
288
299
  return (BOARD_GROUPS as readonly string[]).includes(heading)
289
300
  }
290
301
 
302
+ /**
303
+ * Whether a header is the set of columns its group owns. Order is left to the
304
+ * reader, which resolves every column by name, so only a missing or a foreign
305
+ * column is a finding.
306
+ */
307
+ function ownsColumns(group: BoardGroup, header: readonly string[]): boolean {
308
+ const owned = GROUP_COLUMNS[group].map((column) => column.toLowerCase())
309
+ const named = header.map((cell) => cell.toLowerCase())
310
+
311
+ return (
312
+ named.length === owned.length &&
313
+ owned.every((column) => named.includes(column))
314
+ )
315
+ }
316
+
291
317
  const ORDINAL_WORDS = [
292
318
  'first',
293
319
  'second',
@@ -460,6 +486,14 @@ export function readBoard(text: string): {
460
486
  }
461
487
 
462
488
  header = cells
489
+ if (!ownsColumns(group, cells)) {
490
+ findings.push({
491
+ kind: 'columns-mismatched',
492
+ group,
493
+ subject: line.trim(),
494
+ message: `is not the ${GROUP_COLUMNS[group].join(', ')} header ${group} owns.`,
495
+ })
496
+ }
463
497
  continue
464
498
  }
465
499
 
@@ -489,6 +523,7 @@ export function readBoard(text: string): {
489
523
  stem: target ? stemOf(target) : undefined,
490
524
  plan,
491
525
  touches: touchesAt >= 0 ? readPaths(cells[touchesAt] ?? '') : undefined,
526
+ touchesText: touchesAt >= 0 ? (cells[touchesAt] ?? '') : undefined,
492
527
  waiting,
493
528
  ordinal: waiting ? readOrdinal(waiting) : undefined,
494
529
  ranked: waiting ? readRank(waiting) : false,
@@ -1125,6 +1160,83 @@ function citedStem(cell: string): string | undefined {
1125
1160
  return target ? stemOf(target) : undefined
1126
1161
  }
1127
1162
 
1163
+ /** The task stems in each folder a bare label can resolve through, live first. */
1164
+ interface LabelFolders {
1165
+ readonly live: readonly string[]
1166
+ readonly archived: readonly string[]
1167
+ readonly declined: readonly string[]
1168
+ }
1169
+
1170
+ type LabelCitation =
1171
+ | { readonly kind: 'stems'; readonly stems: readonly string[] }
1172
+ | { readonly kind: 'ambiguous'; readonly label: string }
1173
+
1174
+ /**
1175
+ * Reads every bare `vNNN.N` phase label a `Waiting on` cell names outside a
1176
+ * link, each resolved to the one task it labels. The live folder answers first,
1177
+ * since a live task and a declined one can share a label and the live one is
1178
+ * what the row waits on. Two matches in the folder that answers leave the row
1179
+ * untested rather than guessing between them, and a label no folder holds is
1180
+ * read as prose rather than as a broken pointer, since a version number in a
1181
+ * sentence is not always a citation.
1182
+ */
1183
+ function bareLabels(cell: string, folders: LabelFolders): LabelCitation {
1184
+ const prose = cell.replace(/\[[^\]]*\]\([^)]*\)/g, ' ')
1185
+ const stems: string[] = []
1186
+
1187
+ for (const match of prose.matchAll(/\bv\d+\.\d+\b/g)) {
1188
+ const prefix = `${match[0]}-`
1189
+ for (const folder of [folders.live, folders.archived, folders.declined]) {
1190
+ const hits = folder.filter((stem) => stem.startsWith(prefix))
1191
+ if (hits.length > 1) return { kind: 'ambiguous', label: match[0] }
1192
+ if (hits.length === 1) {
1193
+ if (!stems.includes(hits[0])) stems.push(hits[0])
1194
+ break
1195
+ }
1196
+ }
1197
+ }
1198
+
1199
+ return { kind: 'stems', stems }
1200
+ }
1201
+
1202
+ /**
1203
+ * Tests every task a cell cites by bare label, and reports the row only when
1204
+ * none of them is still open. A cell naming settled history beside its live
1205
+ * blocker would otherwise read as settled on the history alone.
1206
+ */
1207
+ async function checkCitedTasks(
1208
+ group: BoardGroup,
1209
+ subject: string,
1210
+ stems: readonly string[],
1211
+ root: string,
1212
+ trunk: TrunkReader,
1213
+ ): Promise<CitedResult> {
1214
+ const results = await Promise.all(
1215
+ stems.map((stem) => checkCitedTask(group, subject, stem, root, trunk)),
1216
+ )
1217
+ const open = results.some(
1218
+ (result) => result.findings.length === 0 && result.untested.length === 0,
1219
+ )
1220
+ if (open) return nothing()
1221
+
1222
+ return {
1223
+ findings: results.flatMap((result) => result.findings),
1224
+ untested: results.flatMap((result) => result.untested),
1225
+ }
1226
+ }
1227
+
1228
+ async function readLabelFolders(root: string): Promise<LabelFolders> {
1229
+ const read = async (dir: string): Promise<string[]> =>
1230
+ existsSync(dir) ? listTaskStems(dir) : []
1231
+ const [live, archived, declined] = await Promise.all([
1232
+ read(tasksDir(root)),
1233
+ read(archiveDir(root)),
1234
+ read(declinedDir(root)),
1235
+ ])
1236
+
1237
+ return { live, archived, declined }
1238
+ }
1239
+
1128
1240
  /** What one blocker citation produced, since a row can be neither settled nor open. */
1129
1241
  interface CitedResult {
1130
1242
  readonly findings: readonly Finding[]
@@ -1288,17 +1400,29 @@ async function checkParked(
1288
1400
  const findings: Finding[] = []
1289
1401
  const untested: Untested[] = []
1290
1402
  const running = rows.filter((row) => row.group === 'Run now')
1403
+ const folders = await readLabelFolders(root)
1291
1404
 
1292
1405
  for (const row of rows) {
1293
1406
  if (row.group === 'Run now') continue
1294
1407
 
1295
1408
  const subject = row.stem ?? row.label
1296
1409
  const cell = row.waiting ?? ''
1297
- const cited = citedStem(cell)
1410
+ const linked = citedStem(cell)
1411
+ const bare = linked ? undefined : bareLabels(cell, folders)
1412
+ const cited = linked ? [linked] : bare?.kind === 'stems' ? bare.stems : []
1298
1413
  const contested = readPaths(cell)
1299
1414
 
1300
- if (cited) {
1301
- const result = await checkCitedTask(
1415
+ if (bare?.kind === 'ambiguous') {
1416
+ untested.push({
1417
+ group: row.group,
1418
+ subject,
1419
+ message: `waits on ${bare.label}, which labels more than one task, so the blocker is not read.`,
1420
+ })
1421
+ continue
1422
+ }
1423
+
1424
+ if (cited.length > 0) {
1425
+ const result = await checkCitedTasks(
1302
1426
  row.group,
1303
1427
  subject,
1304
1428
  cited,
@@ -1324,7 +1448,7 @@ async function checkParked(
1324
1448
  })
1325
1449
  }
1326
1450
 
1327
- if (!cited && contested.length === 0) {
1451
+ if (cited.length === 0 && contested.length === 0) {
1328
1452
  untested.push({
1329
1453
  group: row.group,
1330
1454
  subject,
@@ -1337,6 +1461,79 @@ async function checkParked(
1337
1461
  return { findings, untested }
1338
1462
  }
1339
1463
 
1464
+ /**
1465
+ * Reports a `Waiting on` cell rendering past the cap. A verb refuses to write
1466
+ * one, so a cell this long is a hand edit, which is why it moves the exit code.
1467
+ */
1468
+ function checkCellWidth(rows: readonly BoardRow[]): Finding[] {
1469
+ return rows.flatMap((row) => {
1470
+ const width = row.waiting ? renderedLength(row.waiting) : 0
1471
+ if (width <= WAITING_LIMIT) return []
1472
+
1473
+ return [
1474
+ {
1475
+ kind: 'cell-long' as const,
1476
+ group: row.group,
1477
+ subject: subjectOf(row),
1478
+ message: `carries a Waiting on cell rendering ${width} characters, past the ${WAITING_LIMIT} a board cell holds.`,
1479
+ },
1480
+ ]
1481
+ })
1482
+ }
1483
+
1484
+ /**
1485
+ * Reports a `Touches` cell that differs from what the task's plans derive. A
1486
+ * verb writes the derivation on every call, so a difference is a hand edit or a
1487
+ * plan that changed since the last write. An empty derivation is left alone,
1488
+ * since a row with no live plan or no declared file is `plan-absent`,
1489
+ * `plan-unresolved`, or `touches-unstated` to report, not stale.
1490
+ */
1491
+ async function checkStaleTouches(
1492
+ rows: readonly BoardRow[],
1493
+ root: string,
1494
+ ): Promise<Finding[]> {
1495
+ const found = await Promise.all(
1496
+ rows.map(async (row): Promise<Finding | undefined> => {
1497
+ if (row.touchesText === undefined || !row.stem) return undefined
1498
+
1499
+ const { touches } = await deriveCells(root, {
1500
+ stem: row.stem,
1501
+ label: row.label,
1502
+ })
1503
+ if (touches === '' || touches === row.touchesText) return undefined
1504
+
1505
+ return {
1506
+ kind: 'touches-stale',
1507
+ group: row.group,
1508
+ subject: row.stem,
1509
+ message: `states ${row.touchesText || 'no file'}, and its plan derives ${touches}. A board verb rewrites the cell.`,
1510
+ }
1511
+ }),
1512
+ )
1513
+
1514
+ return found.filter((finding): finding is Finding => finding !== undefined)
1515
+ }
1516
+
1517
+ /**
1518
+ * The claims a group name makes about a row, being a stated plan and file set
1519
+ * under `## Run now`, a live plan under `## Up next`, and none under
1520
+ * `## Needs a plan`. The board verbs read these same findings off the board
1521
+ * they are about to write, so a placement and a validation cannot disagree on
1522
+ * what a group allows.
1523
+ */
1524
+ export async function groupRuleFindings(
1525
+ rows: readonly BoardRow[],
1526
+ root: string,
1527
+ ): Promise<Finding[]> {
1528
+ const dir = tasksDir(root)
1529
+
1530
+ return [
1531
+ ...checkPlans(rows, dir, root),
1532
+ ...(await checkGroupClaims(rows, dir, root)),
1533
+ ...checkTouches(rows),
1534
+ ]
1535
+ }
1536
+
1340
1537
  function refuse(reason: ValidateRefusal, message: string): ValidateRefused {
1341
1538
  return { ok: false, reason, message }
1342
1539
  }
@@ -1397,10 +1594,10 @@ export async function validateBoard(
1397
1594
  const findings = [
1398
1595
  ...shapeFindings,
1399
1596
  ...checkMapping(rows, backlog, dir),
1400
- ...checkPlans(rows, dir, root),
1597
+ ...(await groupRuleFindings(rows, root)),
1401
1598
  ...(await checkPlanAgreement(rows, dir, root)),
1402
- ...(await checkGroupClaims(rows, dir, root)),
1403
- ...checkTouches(rows),
1599
+ ...(await checkStaleTouches(rows, root)),
1600
+ ...checkCellWidth(rows),
1404
1601
  ...checkOrdering(rows),
1405
1602
  ...parked.findings,
1406
1603
  ]
@@ -7,7 +7,7 @@
7
7
  * an edit to one string here and a re-capture, not another pass through the
8
8
  * pick loop with an operator in it.
9
9
  *
10
- * `canon:draft-identity` writes the picked composition into the `.card`
10
+ * `canon:design-identity` writes the picked composition into the `.card`
11
11
  * element below and leaves everything around it alone. What ships is a working
12
12
  * placeholder, so the route serves before any pick has been taken.
13
13
  *
@@ -91,9 +91,9 @@ In `canon/context/development/ci.md`, the Typecheck row asserts `` `astro check`
91
91
 
92
92
  ## Social card route
93
93
 
94
- The social card is a route the project keeps rather than a page a render writes and deletes. Re-rendering it after a rename is an edit to one string and a re-capture, not another pass through the `draft-identity` pick loop.
94
+ The social card is a route the project keeps rather than a page a render writes and deletes. Re-rendering it after a rename is an edit to one string and a re-capture, not another pass through the `design-identity` pick loop.
95
95
 
96
- `canon:draft-identity` writes the picked composition into the route and captures it through the server below.
96
+ `canon:design-identity` writes the picked composition into the route and captures it through the server below.
97
97
 
98
98
  ### What ships
99
99
 
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Reports what `canon tasks validate` finds after an edit to the task board's
4
+ # ordering file, so a hand edit that broke a table or drifted a derived cell is
5
+ # named in the turn that made it.
6
+ #
7
+ # It reports and never blocks. The board verbs do not yet cover every move a
8
+ # controller makes by hand, so a block here would stop work the verbs cannot
9
+ # yet do. A `Bash` write fires no `PostToolUse` hook for a file, so a heredoc
10
+ # write stays unchecked until the next validate run.
11
+
12
+ # Claude Code sends a payload and closes stdin. A bare read with nothing feeding
13
+ # it blocks forever and holds the session open, so the read is bounded. `read`
14
+ # rather than `timeout cat`, which macOS does not ship.
15
+ IFS= read -r -d '' -t 2 input
16
+ [ -n "$input" ] || {
17
+ printf '%s reads a Claude Code hook payload on stdin and cannot be run by hand.\n' "${0##*/}" >&2
18
+ exit 1
19
+ }
20
+
21
+ tool=$(printf '%s' "$input" | jq -r '.tool_name // empty')
22
+ case "$tool" in
23
+ Write | Edit | MultiEdit) ;;
24
+ *) exit 0 ;;
25
+ esac
26
+
27
+ file_path=$(printf '%s' "$input" | jq -r '.tool_input.file_path // empty')
28
+
29
+ # Both record roots, since a project the move has reached keeps its records
30
+ # under `.canon/`. The root comes from the path rather than the session, since
31
+ # the board resolves at the main worktree root and a linked worktree's session
32
+ # edits it from outside its own project directory.
33
+ case "$file_path" in
34
+ */.canon/tasks/priority.md) base=.canon ;;
35
+ */.claude/tasks/priority.md) base=.claude ;;
36
+ *) exit 0 ;;
37
+ esac
38
+ root="${file_path%/"$base"/tasks/priority.md}"
39
+ [ -n "$root" ] || exit 0
40
+
41
+ report() {
42
+ jq -nc --arg msg "$1" \
43
+ '{hookSpecificOutput:{hookEventName:"PostToolUse",additionalContext:$msg}}'
44
+ exit 0
45
+ }
46
+
47
+ if ! command -v canon >/dev/null 2>&1; then
48
+ report "canon is not on PATH, so the board edit was not validated. Run canon tasks validate by hand."
49
+ fi
50
+
51
+ # Exit 2 carries findings, so the status is read off the record rather than
52
+ # the exit code.
53
+ record=$(canon tasks validate --json --root "$root" 2>/dev/null)
54
+ ok=$(printf '%s' "$record" | jq -r '.ok // empty' 2>/dev/null)
55
+
56
+ if [ "$ok" = false ]; then
57
+ report "canon tasks validate refused the board after this edit: $(printf '%s' "$record" | jq -r '.message // .reason')"
58
+ fi
59
+ [ "$ok" = true ] || report "canon tasks validate wrote no record after this edit, so the board was not validated."
60
+
61
+ findings=$(printf '%s' "$record" | jq -r '.findings[] | "- \(.kind): \(.subject) \(.message)"' | head -10)
62
+ [ -n "$findings" ] || exit 0
63
+
64
+ report "The board edit left findings. Rewrite the rows through canon tasks place, promote, move, or block, which derive every cell but Waiting on.
65
+ $findings"
@@ -54,6 +54,10 @@
54
54
  "type": "command",
55
55
  "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/records-index.sh"
56
56
  },
57
+ {
58
+ "type": "command",
59
+ "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/board-validate.sh"
60
+ },
57
61
  {
58
62
  "type": "command",
59
63
  "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/path-form.sh"