@erclx/aitk 3.50.0 → 3.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aitk",
3
3
  "description": "Automated governance, versioning, and discovery tools for Claude Code.",
4
- "version": "3.50.0",
4
+ "version": "3.51.0",
5
5
  "author": {
6
6
  "name": "Eric Le",
7
7
  "url": "https://github.com/erclx"
@@ -29,7 +29,7 @@ Full help: `aitk <command> --help`. Behavior notes for the install and sync verb
29
29
  | `aitk tasks archive` | Move a shipped task off the board, clear its ordering row, and regenerate the index |
30
30
  | `aitk tasks pull-request` | Record a pull request number on the task a branch closes, by stem or `--plan` (`--json`) |
31
31
  | `aitk tasks outcome` | Mark outcomes `[x]` on a task by position, repeating `--close` (`--json`) |
32
- | `aitk tasks validate` | Report board rows whose plan, task file, group, file set, or blocker does not hold (`--json`) |
32
+ | `aitk tasks validate` | Report board rows whose shape, order, plan, task file, group, file set, or blocker does not hold (`--json`) |
33
33
  | `aitk intake list` | Report intake folder counts, or one folder's items, keeping what is unread with `--unread` (`--json`) |
34
34
  | `aitk intake answer` | Write selections into one cluster's answer slots, repeating `--set <item>=<answer>` (`--json`) |
35
35
  | `aitk teach list` | Report learning workspaces and the ordinal a new one takes, or what one workspace holds (`--json`) |
@@ -119,20 +119,26 @@ aitk tasks validate
119
119
  aitk tasks validate --json
120
120
  ```
121
121
 
122
- Five checks run. Plan and Collisions reach one half each of the `## Run now` test the board standard states. Mapping and Grouping test the folder contract and hold for every group. Blockers reaches the rows outside `## Run now`:
122
+ Seven checks run. Plan and Collisions reach one half each of the `## Run now` test the board standard states. Mapping and Grouping test the folder contract and hold for every group, and Shape holds for every group too, ahead of the four. Ordering reaches only the `## Needs a plan` rows, and Blockers reaches every row outside `## Run now`:
123
123
 
124
- | Check | What it reports |
125
- | ---------- | ------------------------------------------------------------------------------------ |
126
- | Plan | A `## Run now` row whose Plan column carries no link, or one resolving to no file |
127
- | Mapping | A row or backlog line naming no task file, and a task file neither surface names |
128
- | Grouping | A task carrying a row in more than one readiness group, or on both surfaces |
129
- | Collisions | Two `## Run now` rows whose Touches columns name a path in common |
130
- | Blockers | A parked row whose blocker has stopped holding, or whose cited task resolves nowhere |
124
+ | Check | What it reports |
125
+ | ---------- | -------------------------------------------------------------------------------------------------------------------- |
126
+ | Shape | A row whose cell count disagrees with its table's header, or one stranded behind a table a blank line already closed |
127
+ | Plan | A `## Run now` row whose Plan column carries no link, or one resolving to no file |
128
+ | Mapping | A row or backlog line naming no task file, and a task file neither surface names |
129
+ | Grouping | A task carrying a row in more than one readiness group, or on both surfaces |
130
+ | Ordering | A `## Needs a plan` row whose stated position disagrees with where it actually sits |
131
+ | Collisions | Two `## Run now` rows whose Touches columns name a path in common |
132
+ | Blockers | A parked row whose blocker has stopped holding, or whose cited task resolves nowhere |
133
+
134
+ Shape runs before any other check reads a row, since a row failing it carries no dependable fields for the rest to check. A blank or prose line closes the table above it, so the walk treats the next pipe line as a fresh header candidate rather than as a continuation. That candidate counts as a header only when the line behind it is a separator carrying the same cell count, and one that fails is `row-untabled`, stranded behind a table that already closed. Cell count still has to match the header on every row that clears that test, and a row whose count disagrees is `row-misshapen`, the shape a dropped pipe or a merged column produces.
131
135
 
132
136
  Mapping spans two surfaces, because a task sits on `priority.md` when it would plausibly be planned soon and on `backlog.md` otherwise. A task file either surface names is accounted for, a file neither names is `row-missing`, and a file both name is `row-duplicated` for the reason a task in two groups is: it claims two things about itself and only one can hold. One check across both is what lets a task move between them without the move reading as a dropped file.
133
137
 
134
138
  A backlog line is a bullet carrying a link to a sibling task, since the backlog is a flat unordered list rather than a table. A bullet holding prose is skipped rather than reported, which keeps the file's own intro out of the findings, and the task that bullet meant to name is still reported as reaching neither surface. A project carrying no `backlog.md` reads as an empty backlog rather than a refusal, which leaves the one-to-one mapping this check ran before the second surface existed.
135
139
 
140
+ Ordering reads only a `## Needs a plan` row whose `Waiting on` cell states a position at all. That phrase is prose rather than data, searched for anywhere in the cell rather than at its start, since every live row states its position at the end of a sentence rather than at the front. The vocabulary stops at `first` through `twentieth` plus `last`, since a parser strict enough to catch a gap would otherwise flag a row phrased correctly and differently, and bounding it to those words is what keeps a cell reading `Untestable from here` from matching on `from`. A row that does state a position is checked against where it actually sits, and that one comparison catches a gap, a duplicate, and a sequence starting somewhere other than first alike.
141
+
136
142
  The collision check is the one a person cannot run by eye. Paths come from the backticked spans in the Touches column, a span naming no file is dropped, and a directory collides with any file beneath it. A `## Run now` row whose column parses to nothing is reported rather than skipped, since a row stating no file set makes a claim nothing can check.
137
143
 
138
144
  Where a directory holds the other row's file, the finding names the row that claimed it, reading `both touch src/tasks, which v2.0-second claims as a folder.` The shared strings alone leave an over-broad cell and a genuine overlap identical, which is how a correct report was once read as the verb comparing folders rather than files.
@@ -113,7 +113,9 @@ The plans sweep reads the whole board rather than the tasks the session touched.
113
113
 
114
114
  `.claude/memory/` carries the same arrangement, its own hook regenerating `index.md` from each entry's `title`, `description`, and `category`. A hand-maintained `priority.md` sits beside it carrying execution order and what each task is waiting on, which the alphabetical index cannot express.
115
115
 
116
- `aitk tasks validate` checks what those rows claim against what the tree holds: every plan pointer resolves, every task file is named by a board row or a backlog line and never by both, no task sits in two groups, and no two rows marked ready touch the same file. One check across both surfaces is what lets a task move between the board and the backlog without the move reading as a dropped file. That fourth check is the half a reader cannot run by eye, and it is what keeps two workers from being handed colliding work. A fifth re-takes what a parked row waits on, reporting one whose cited task reached the trunk and one whose cited file nothing running still holds. A cited task settles the row by being archived, or by closing every outcome and naming a pull request the trunk carries, since the checkbox alone is marked while the branch is still in review. Both halves read a citation out of the blocker cell, so a row citing neither is reported as untested rather than counted clean, and so is a cited task the trunk could not answer for. It reports and never writes, because a row is the orchestrator's claim and a validator repairing one would assert the claim it exists to test. Nothing fires it automatically, since the board is gitignored per-machine scratch with no shared moment to hang a hook on, so the orchestrator's sweep calls it at the point the readiness claim is made and follows it with the parked re-test.
116
+ `aitk tasks validate` reads a row against its own table before it reads anything the row claims. A blank or prose line closes the table above it, so a row stranded there is checked against the line behind it rather than parsed as a continuation, and a row that clears that test still has its cell count checked against its header. A `## Needs a plan` row that states its own position, searched for `<ordinal> here` or the bare word `last` anywhere in the cell rather than at its start, is checked against where it actually sits, which is what catches a gap, a duplicate, and a sequence starting somewhere other than first alike.
117
+
118
+ Past that shape, it checks what a surviving row claims against what the tree holds: every plan pointer resolves, every task file is named by a board row or a backlog line and never by both, no task sits in two groups, and no two rows marked ready touch the same file. One check across both surfaces is what lets a task move between the board and the backlog without the move reading as a dropped file. The collision check is the half a reader cannot run by eye, and it is what keeps two workers from being handed colliding work. Blockers re-takes what a parked row waits on, reporting one whose cited task reached the trunk and one whose cited file nothing running still holds. A cited task settles the row by being archived, or by closing every outcome and naming a pull request the trunk carries, since the checkbox alone is marked while the branch is still in review. Both halves read a citation out of the blocker cell, so a row citing neither is reported as untested rather than counted clean, and so is a cited task the trunk could not answer for. It reports and never writes, because a row is the orchestrator's claim and a validator repairing one would assert the claim it exists to test. Nothing fires it automatically, since the board is gitignored per-machine scratch with no shared moment to hang a hook on, so the orchestrator's sweep calls it at the point the readiness claim is made and follows it with the parked re-test.
117
119
 
118
120
  `aitk:claude-tasks` owns the two operations that bracket a task's life. It creates the file, holding the filename convention and the frontmatter contract so a malformed write cannot break the index for every sibling, and it moves a shipped task to `.claude/tasks/archive/`. Creation is where the origin invariant is enforced: every task names a plan, a groundwork folder, an intake folder, or an issue, since a task with no origin is either lost context or work nobody decided to do.
119
121
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@erclx/aitk",
3
3
  "type": "module",
4
- "version": "3.50.0",
4
+ "version": "3.51.0",
5
5
  "description": "Infrastructure and quality tooling for developer workflows",
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -37,6 +37,9 @@ export const FINDING_KINDS = [
37
37
  'task-unresolved',
38
38
  'row-missing',
39
39
  'row-duplicated',
40
+ 'row-misshapen',
41
+ 'row-untabled',
42
+ 'row-misordered',
40
43
  'touches-unstated',
41
44
  'touches-collided',
42
45
  'blocker-settled',
@@ -95,6 +98,8 @@ export interface BoardRow {
95
98
  readonly touches: readonly string[] | undefined
96
99
  /** Absent when the group fixes no `Waiting on` column, which is `## Run now`. */
97
100
  readonly waiting: string | undefined
101
+ /** The ordinal phrase a `Waiting on` cell states about its own position, undefined when the cell carries none. */
102
+ readonly ordinal: OrdinalWord | 'last' | undefined
98
103
  }
99
104
 
100
105
  export interface ValidateReport {
@@ -216,23 +221,107 @@ function isGroup(heading: string): heading is BoardGroup {
216
221
  return (BOARD_GROUPS as readonly string[]).includes(heading)
217
222
  }
218
223
 
224
+ const ORDINAL_WORDS = [
225
+ 'first',
226
+ 'second',
227
+ 'third',
228
+ 'fourth',
229
+ 'fifth',
230
+ 'sixth',
231
+ 'seventh',
232
+ 'eighth',
233
+ 'ninth',
234
+ 'tenth',
235
+ 'eleventh',
236
+ 'twelfth',
237
+ 'thirteenth',
238
+ 'fourteenth',
239
+ 'fifteenth',
240
+ 'sixteenth',
241
+ 'seventeenth',
242
+ 'eighteenth',
243
+ 'nineteenth',
244
+ 'twentieth',
245
+ ] as const
246
+
247
+ type OrdinalWord = (typeof ORDINAL_WORDS)[number]
248
+
249
+ const ORDINAL_HERE = new RegExp(
250
+ `\\b(${ORDINAL_WORDS.join('|')})\\s+here\\b`,
251
+ 'i',
252
+ )
253
+ const LAST_AT_END = /\blast\.?\s*$/i
254
+
255
+ /**
256
+ * Reads the ordinal phrase a `Waiting on` cell states about its own position,
257
+ * searching the whole cell for `<ordinal> here` or the bare word `last` rather
258
+ * than anchoring to where the cell opens. The phrase sits at the end of the
259
+ * sentence on every row that carries one, as in `nothing, cleared 2026-08-31
260
+ * when it merged. Third here`. The two-word phrase is safe to find anywhere,
261
+ * since it needs both a closed vocabulary word and `here` beside it, but a
262
+ * bare `last` is one of the commonest words in English and this corpus writes
263
+ * it constantly, as in `the last of the two instruments this rename needs`.
264
+ * Anchoring it to the end of the cell is what keeps that prose out of the
265
+ * findings, since every row that actually declares itself last puts the word
266
+ * there and nowhere else. A cell carrying neither reads as unordered rather
267
+ * than as an error, which keeps a legitimately-phrased row out of the
268
+ * findings.
269
+ */
270
+ function readOrdinal(cell: string): OrdinalWord | 'last' | undefined {
271
+ const here = ORDINAL_HERE.exec(cell)
272
+ if (here?.[1]) return here[1].toLowerCase() as OrdinalWord
273
+
274
+ return LAST_AT_END.test(cell) ? 'last' : undefined
275
+ }
276
+
277
+ function isRowLine(line: string): boolean {
278
+ return line.trimStart().startsWith('|')
279
+ }
280
+
281
+ /**
282
+ * Whether a header candidate genuinely opens a table, meaning the line right
283
+ * behind it is a separator carrying the same cell count. A row landing where a
284
+ * blank line already closed the table above it looks identical to a fresh
285
+ * header until this read, since both are the first pipe line the walk has
286
+ * seen since the reset.
287
+ */
288
+ function opensTable(
289
+ header: readonly string[],
290
+ next: string | undefined,
291
+ ): boolean {
292
+ if (next === undefined || !isRowLine(next)) return false
293
+ const cells = splitCells(next)
294
+ return isSeparator(cells) && cells.length === header.length
295
+ }
296
+
219
297
  /**
220
298
  * Parses the ordering file into rows keyed by readiness group. Columns are read
221
299
  * from each table's own header rather than by position, so a group whose shape
222
300
  * differs from this repository's is reported for what it lacks instead of
223
301
  * having its second cell read as something it never was.
302
+ *
303
+ * The walk carries one more piece of state than a header: whether the table
304
+ * that header opened is still open. A blank or prose line closes it, so a row
305
+ * stranded behind that close is read as one candidate header among many rather
306
+ * than as a continuation of the table above, and each surviving row's cell
307
+ * count is checked against the header it actually followed.
224
308
  */
225
309
  export function readBoard(text: string): {
226
310
  readonly rows: readonly BoardRow[]
227
311
  readonly groups: readonly BoardGroup[]
312
+ readonly findings: readonly Finding[]
228
313
  } {
229
314
  const rows: BoardRow[] = []
230
315
  const groups: BoardGroup[] = []
316
+ const findings: Finding[] = []
317
+
318
+ const lines = text.split('\n')
231
319
 
232
320
  let group: BoardGroup | undefined
233
321
  let header: string[] | undefined
234
322
 
235
- for (const line of text.split('\n')) {
323
+ for (let i = 0; i < lines.length; i += 1) {
324
+ const line = lines[i] ?? ''
236
325
  const heading = /^##\s+(.+?)\s*$/.exec(line)
237
326
  if (heading) {
238
327
  const title = heading[1]
@@ -242,16 +331,42 @@ export function readBoard(text: string): {
242
331
  continue
243
332
  }
244
333
 
245
- if (!group || !line.trimStart().startsWith('|')) continue
334
+ if (!group) continue
335
+
336
+ if (!isRowLine(line)) {
337
+ header = undefined
338
+ continue
339
+ }
246
340
 
247
341
  const cells = splitCells(line)
248
342
  if (isSeparator(cells)) continue
249
343
 
250
344
  if (!header) {
345
+ if (!opensTable(cells, lines[i + 1])) {
346
+ findings.push({
347
+ kind: 'row-untabled',
348
+ group,
349
+ subject: line.trim(),
350
+ message:
351
+ 'sits outside a table. The table above it already closed at the line before it.',
352
+ })
353
+ continue
354
+ }
355
+
251
356
  header = cells
252
357
  continue
253
358
  }
254
359
 
360
+ if (cells.length !== header.length) {
361
+ findings.push({
362
+ kind: 'row-misshapen',
363
+ group,
364
+ subject: line.trim(),
365
+ message: `carries ${cells.length} cell(s) against the ${header.length}-cell header above it.`,
366
+ })
367
+ continue
368
+ }
369
+
255
370
  const taskAt = columnIndex(header, 'task')
256
371
  const planAt = columnIndex(header, 'plan')
257
372
  const touchesAt = columnIndex(header, 'touches')
@@ -260,6 +375,7 @@ export function readBoard(text: string): {
260
375
  const task = taskAt >= 0 ? (cells[taskAt] ?? '') : ''
261
376
  const target = linkTarget(task)
262
377
  const plan = planAt >= 0 ? linkTarget(cells[planAt] ?? '') : undefined
378
+ const waiting = waitingAt >= 0 ? (cells[waitingAt] ?? '') : undefined
263
379
 
264
380
  rows.push({
265
381
  group,
@@ -267,11 +383,46 @@ export function readBoard(text: string): {
267
383
  stem: target ? stemOf(target) : undefined,
268
384
  plan,
269
385
  touches: touchesAt >= 0 ? readPaths(cells[touchesAt] ?? '') : undefined,
270
- waiting: waitingAt >= 0 ? (cells[waitingAt] ?? '') : undefined,
386
+ waiting,
387
+ ordinal: waiting ? readOrdinal(waiting) : undefined,
271
388
  })
272
389
  }
273
390
 
274
- return { rows, groups }
391
+ return { rows, groups, findings }
392
+ }
393
+
394
+ /**
395
+ * Reports a `## Needs a plan` row whose stated ordinal disagrees with where it
396
+ * actually sits in that group. Reading the sequence for gaps and duplicates on
397
+ * its own would detect less, since row position is contiguous by
398
+ * construction, and a hand-renumbered sequence is exactly a case where the
399
+ * prose and the position have come apart.
400
+ */
401
+ function checkOrdinals(rows: readonly BoardRow[]): Finding[] {
402
+ const findings: Finding[] = []
403
+ const parked = rows.filter((row) => row.group === 'Needs a plan')
404
+
405
+ parked.forEach((row, index) => {
406
+ if (!row.ordinal) return
407
+
408
+ const position = index + 1
409
+ const expected =
410
+ row.ordinal === 'last'
411
+ ? parked.length
412
+ : ORDINAL_WORDS.indexOf(row.ordinal) + 1
413
+
414
+ if (expected === position) return
415
+
416
+ const phrase = row.ordinal === 'last' ? 'last' : `${row.ordinal} here`
417
+ findings.push({
418
+ kind: 'row-misordered',
419
+ group: row.group,
420
+ subject: subjectOf(row),
421
+ message: `declares itself "${phrase}", but sits at position ${position} of ${parked.length} in ${row.group}.`,
422
+ })
423
+ })
424
+
425
+ return findings
275
426
  }
276
427
 
277
428
  /**
@@ -805,7 +956,11 @@ export async function validateBoard(
805
956
  return refuse('no-ordering', `No ordering file at ${ordering}.`)
806
957
  }
807
958
 
808
- const { rows, groups } = readBoard(await readFile(ordering, 'utf8'))
959
+ const {
960
+ rows,
961
+ groups,
962
+ findings: shapeFindings,
963
+ } = readBoard(await readFile(ordering, 'utf8'))
809
964
 
810
965
  if (groups.length === 0) {
811
966
  return refuse(
@@ -826,9 +981,11 @@ export async function validateBoard(
826
981
  const parked = await checkParked(rows, root, trunk)
827
982
 
828
983
  const findings = [
984
+ ...shapeFindings,
829
985
  ...checkMapping(rows, backlog, stems, dir),
830
986
  ...checkPlans(rows, dir, root),
831
987
  ...checkCollisions(rows),
988
+ ...checkOrdinals(rows),
832
989
  ...parked.findings,
833
990
  ]
834
991