@quolu/lattice 0.95.0 → 0.96.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quolu/lattice",
3
- "version": "0.95.0",
3
+ "version": "0.96.0",
4
4
  "description": "Schedulability compiler for multi-agent development: observe real code boundaries, refactor the conflicting seam, recompile the plan for parallel execution",
5
5
  "author": {
6
6
  "name": "Quo / クオ at kitepon.dev",
package/src/cli-help.mjs CHANGED
@@ -89,6 +89,7 @@ Read commands:
89
89
  note list --plan <key> [--task <id>] --json # note全履歴の診断面(通常read/startでは不要)
90
90
  notice list [--lane <lane>] [--include-acked] [--json] # 着手できるようになった工程の知らせ(既定は未ackだけ。lane省略で全lane)
91
91
  nudge [--json] # 前の工程が終わっているのに未着手の工程を担当ごとに返し、発火(着手)と、動けない時の止め(todo block)を促す(読むだけ)
92
+ blockers [--json] # 止めのある工程を全部返す(題・担当・理由の全文・止めた時刻と者・外すコマンド。読むだけ。外すのは誰でも todo unblock)
92
93
  bindings [--plan <key>] [--json] # compile_binding付きTaskをTODO identityつきで投影する
93
94
  display read [--json] # host表示用の工程表読取(lattice.todo_display_read_result.v1)。不整合でも断らずstateで返す
94
95
  display source [--json] # 安い変更検知(lattice.todo_store_display_source.v1)。変わった時だけreadする
@@ -308,6 +309,7 @@ const SUBCOMMAND_USAGE = Object.freeze({
308
309
  'todo notice list': 'todo notice list [--lane <lane>] [--include-acked] [--json] # lattice.todo_notice_list_result.v1',
309
310
  'todo notice ack': 'todo notice ack --lane <lane> --notice <id>[,<id>...] [--json] # lattice.todo_notice_ack_result.v1 {acked, already, closed}',
310
311
  'todo nudge': 'todo nudge [--json] # lattice.todo_nudge_result.v1 {lanes: [{lane, tasks: [{fire_actions, stop_action, prompt}]}]}',
312
+ 'todo blockers': 'todo blockers [--json] # lattice.todo_blockers_result.v1 {blockers: [{plan_key, task_id, title, lane, reason, blocked_at, blocked_by, unblock_action}]}',
311
313
  'todo wait': 'todo wait --plan <key> --task <id> [--reason <text>] | --cancel [--json] # lattice.todo_wait_result.v1 {state: waiting|startable_now|not_pending|cancelled}',
312
314
  'todo bindings': 'todo bindings [--plan <key>] [--json]',
313
315
  'todo display': 'todo display read [--json] | source [--json] # host表示用の読取。不整合でも断らずstateで返す',
@@ -0,0 +1,29 @@
1
+ // Blockers (blockers-list, docs/architecture/dfd-blockers.md): every blocked task in the chart with its full reason,
2
+ // who stopped it and when, and the command to lift it. Read-only; `todo unblock` stays open to any seat.
3
+
4
+ /** Blocked tasks of every member, sorted by plan_key then task_id. */
5
+ export function projectTodoBlockers(store) {
6
+ const blockers = [];
7
+ for (const member of store.members) {
8
+ const planKey = member.plan.plan_key;
9
+ const lastBlock = new Map();
10
+ for (const event of member.journal.events) if (event.kind === 'block') lastBlock.set(event.task_id, event);
11
+ for (const state of member.tasks) {
12
+ if (state.status !== 'blocked') continue;
13
+ const task = member.plan.tasks.find(({ task_id: id }) => id === state.task_id);
14
+ const event = lastBlock.get(state.task_id);
15
+ blockers.push({
16
+ plan_key: planKey,
17
+ task_id: state.task_id,
18
+ title: task?.title ?? null,
19
+ lane: task?.lane ?? null,
20
+ reason: state.blocked_reason,
21
+ blocked_at: event?.recorded_at ?? null,
22
+ blocked_by: event?.actor ?? null,
23
+ unblock_action: `lattice todo unblock --plan ${planKey} --task ${state.task_id}`,
24
+ });
25
+ }
26
+ }
27
+ const key = ({ plan_key: plan, task_id: task }) => `${plan}\u0000${task}`;
28
+ return blockers.sort((left, right) => (key(left) < key(right) ? -1 : 1));
29
+ }
package/src/todo-cli.mjs CHANGED
@@ -170,6 +170,7 @@ import {
170
170
  import { compileSeamProposalArtifact, declaredConcernSymbols } from './seam-proposal.mjs';
171
171
  import { collectSensorEvidence } from './sensor-adapter.mjs';
172
172
  import { newTodoNotices, projectTodoNotices, waitInEffect } from './todo-notices.mjs';
173
+ import { projectTodoBlockers } from './todo-blockers.mjs';
173
174
  import { projectTodoNudges } from './todo-nudges.mjs';
174
175
  import {
175
176
  ackTodoNotices, cancelTodoNoticeWait, readAllTodoNoticeAcks, readAllTodoNoticeWaits, readTodoNoticeAcks, writeTodoNoticeWait,
@@ -308,7 +309,7 @@ const TODO_COMMAND_NAMES = Object.freeze([
308
309
  'status', 'show', 'note', 'bindings', 'display', 'independence', 'structure', 'seam-profile', 'seam-proposal',
309
310
  'verify', 'repair-eol', 'snapshot', 'gantt', 'dashboard', 'phase', 'migrate', 'start', 'block',
310
311
  'unblock', 'retire', 'done', 'reopen', 'evidence', 'split', 'revise', 'revise-phase', 'revise-set',
311
- 'retract', 'dependency', 'add', 'notice', 'wait', 'nudge',
312
+ 'retract', 'dependency', 'add', 'notice', 'wait', 'nudge', 'blockers',
312
313
  ]);
313
314
 
314
315
  function typedArgumentFailure(stderr, code, message, detail, context = {}) {
@@ -371,6 +372,7 @@ const TODO_FLAG_SPECS = Object.freeze({
371
372
  'notice list': Object.freeze({ known: ['lane', 'include-acked', 'json'], required: [], booleans: ['include-acked', 'json'] }),
372
373
  'notice ack': Object.freeze({ known: ['lane', 'notice', 'json'], required: ['lane', 'notice'], booleans: ['json'] }),
373
374
  nudge: Object.freeze({ known: ['json'], required: [], booleans: ['json'] }),
375
+ blockers: Object.freeze({ known: ['json'], required: [], booleans: ['json'] }),
374
376
  wait: Object.freeze({ known: ['plan', 'task', 'reason', 'cancel', 'json'], required: ['plan', 'task'], booleans: ['cancel', 'json'] }),
375
377
  'note list': Object.freeze({ known: ['plan', 'task', 'json'], required: ['plan'], booleans: ['json'] }),
376
378
  'phase status': Object.freeze({ known: ['plan', 'json'], required: ['plan'], booleans: ['json'] }),
@@ -4677,15 +4679,31 @@ async function declaredWitnessRows(repoRoot, store) {
4677
4679
  * no Store yet answers an empty list, since the BellTeam run walks every chart directory.
4678
4680
  */
4679
4681
  async function nudgeList({ repoRoot }) {
4680
- let store;
4681
- try { store = await readTodoStore({ repoRoot }); }
4682
+ const store = await readTodoStoreOrNull(repoRoot);
4683
+ const result = {
4684
+ schema: 'lattice.todo_nudge_result.v1', project_id: store?.project_id ?? null,
4685
+ lanes: store === null ? [] : projectTodoNudges(store, { declared: await declaredWitnessRows(repoRoot, store) }),
4686
+ result_digest: '',
4687
+ };
4688
+ result.result_digest = todoSelfDigest(result, 'result_digest');
4689
+ return result;
4690
+ }
4691
+
4692
+ /** The Store, or null where none exists yet (the BellTeam reads walk every chart directory). */
4693
+ async function readTodoStoreOrNull(repoRoot) {
4694
+ try { return await readTodoStore({ repoRoot }); }
4682
4695
  catch (error) {
4683
4696
  if (error?.code !== 'STORE_UNINITIALIZED') throw error;
4684
- store = null;
4697
+ return null;
4685
4698
  }
4699
+ }
4700
+
4701
+ /** `todo blockers` (blockers-list, dfd-blockers.md): every blocked task with its full reason and unblock command. */
4702
+ async function blockerList({ repoRoot }) {
4703
+ const store = await readTodoStoreOrNull(repoRoot);
4686
4704
  const result = {
4687
- schema: 'lattice.todo_nudge_result.v1', project_id: store?.project_id ?? null,
4688
- lanes: store === null ? [] : projectTodoNudges(store, { declared: await declaredWitnessRows(repoRoot, store) }),
4705
+ schema: 'lattice.todo_blockers_result.v1', project_id: store?.project_id ?? null,
4706
+ blockers: store === null ? [] : projectTodoBlockers(store),
4689
4707
  result_digest: '',
4690
4708
  };
4691
4709
  result.result_digest = todoSelfDigest(result, 'result_digest');
@@ -5255,6 +5273,8 @@ export async function runTodoCli({ argv, cwd, stdout, stderr, env = process.env,
5255
5273
  }
5256
5274
  } else if (argv[0] === 'nudge' && matchFlagCommand(argv, ['nudge'], TODO_FLAG_SPECS.nudge) !== null) {
5257
5275
  action = (repoRoot) => nudgeList({ repoRoot });
5276
+ } else if (argv[0] === 'blockers' && matchFlagCommand(argv, ['blockers'], TODO_FLAG_SPECS.blockers) !== null) {
5277
+ action = (repoRoot) => blockerList({ repoRoot });
5258
5278
  } else if (argv[0] === 'wait' && matchFlagCommand(argv, ['wait'], TODO_FLAG_SPECS.wait) !== null) {
5259
5279
  const flags = matchFlagCommand(argv, ['wait'], TODO_FLAG_SPECS.wait);
5260
5280
  const reasonOk = flags.reason === undefined