@quolu/lattice 0.105.0 → 0.107.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/README.ja.md +10 -13
- package/README.md +2 -2
- package/docs/bridge-setup.md +2 -2
- package/package.json +1 -1
- package/src/chart-cli.mjs +23 -11
- package/src/cli-help.mjs +9 -15
- package/src/cli-refusal-guidance.mjs +7 -15
- package/src/project-cli.mjs +1 -1
- package/src/sensor-cli.mjs +23 -0
- package/src/todo-audit-pending.mjs +11 -13
- package/src/todo-authoring-input.mjs +1 -1
- package/src/todo-cli.mjs +95 -477
- package/src/todo-contracts.mjs +32 -4
- package/src/todo-gantt-html-style.mjs +1 -1
- package/src/todo-gantt-html.mjs +6 -6
- package/src/todo-gantt-scope.mjs +3 -3
- package/src/todo-note-store.mjs +3 -3
- package/src/todo-readiness.mjs +0 -1
- package/src/todo-status.mjs +5 -6
- package/src/todo-store.mjs +178 -146
package/README.ja.md
CHANGED
|
@@ -95,7 +95,7 @@ append-only realizationとして記録します。有効化済みplanのgraph ta
|
|
|
95
95
|
|
|
96
96
|
```bash
|
|
97
97
|
lattice todo structure realize --plan <key> --task <id> --input realization.json
|
|
98
|
-
lattice todo done --plan <key> --task <id> --
|
|
98
|
+
lattice todo done --plan <key> --task <id> --message "<やったこと>"
|
|
99
99
|
lattice todo structure finalize --plan <key> --json
|
|
100
100
|
```
|
|
101
101
|
|
|
@@ -318,12 +318,12 @@ remainingのA工程は同じwitnessへ含めます。競合の同時起動は助
|
|
|
318
318
|
起動するものではなく、実際のdispatchはhostが行います。ready全件が着手されたかは
|
|
319
319
|
`active_set`と`next_ready`で観測できます。
|
|
320
320
|
ToDo完了は軽量確認までで、所属ToDoが全てdoneになったPhaseは`gate_ready`となり、`todo phase review`後に
|
|
321
|
-
|
|
321
|
+
`todo phase accept`(任意の`--message`付き)で重監査の判断を記録します。監査回数やPhase数を自動追加する
|
|
322
322
|
機能ではありません。
|
|
323
323
|
|
|
324
324
|
**監査の既定は「有り」です。** phaseを持たないplanも終端に重監査が要ります(予約Phase
|
|
325
325
|
`terminal-audit`を暗黙に1つ持ちます)。全taskがdoneになった状態は「完走」ではなく`gate_ready`=
|
|
326
|
-
|
|
326
|
+
**監査前**であり、工程図のlive scopeはそのplanのToDoを畳みません——完走扱いで図から消えることが
|
|
327
327
|
「閉じた」の可視表現なので、監査の記録なしにそこへ行かせません。作成時に拒否はせず、
|
|
328
328
|
`todo migrate`/`plan create`の結果と最後のdoneのadvisoryで`terminal_audit_required`を通知します。
|
|
329
329
|
**終端監査はToDoのdispatch可否へ影響しません**(Phaseは重監査の順序だけを制御し、開始順はToDo DAGが決めます)。
|
|
@@ -332,23 +332,21 @@ required evidenceを束縛した`todo phase accept`で重監査の判断を記
|
|
|
332
332
|
```bash
|
|
333
333
|
lattice todo phase status --plan <key> # phase無しplanでも暗黙Phaseを返す(implicit: true)
|
|
334
334
|
lattice todo phase review --plan <key> --phase terminal-audit --reason <text>
|
|
335
|
-
lattice todo phase accept --plan <key> --phase terminal-audit --
|
|
335
|
+
lattice todo phase accept --plan <key> --phase terminal-audit [--message <text>]
|
|
336
336
|
```
|
|
337
337
|
|
|
338
|
-
|
|
339
|
-
必須evidence slotはLatticeが組み立てます。必須slotが複数あるPhaseや、記述子を自分で渡したい時は
|
|
340
|
-
`--input <file>`(`lattice.phase_accept_input.v1`、`input_digest`は空でよい)を使います。
|
|
338
|
+
acceptとrejectは証拠を求めません。任意の`--message`の文は、その判断のeventにだけ残ります。
|
|
341
339
|
|
|
342
340
|
**過去の工程は監査できません。** 監査対象のコードが既に変化しているためです。そこで
|
|
343
341
|
「監査なしで閉じた」という状態を別に持ちます——`accepted`(監査を通った)へは絶対に化けず、
|
|
344
|
-
|
|
342
|
+
記録は永久に区別できます。工程図では畳まれるので監査前の札は外れます。
|
|
345
343
|
|
|
346
344
|
```bash
|
|
347
345
|
lattice todo phase close-unaudited --plan <key> --phase terminal-audit --reason <text>
|
|
348
346
|
lattice todo phase baseline --reason <text> --except <監査したいplan_key> # 一括
|
|
349
347
|
```
|
|
350
348
|
|
|
351
|
-
|
|
349
|
+
一括の入口は、現在監査前で一度も監査に触れていないPhaseだけを対象にします。**自動では
|
|
352
350
|
実行しません**——どれを監査し、どれを歴史として畳むかは人が決め、Latticeは宣言を受け取って
|
|
353
351
|
記録するだけです。`--except`は「最近の作業でコードも生きているので本当に監査したい」planを
|
|
354
352
|
残すための口です。規約は
|
|
@@ -376,7 +374,7 @@ dashboardはmanifestのfile identityが変わらない間のstable store readを
|
|
|
376
374
|
巨大工程図のrender中にhealth応答が遅れても、生存中dashboardを新daemonで置き換えず
|
|
377
375
|
`DASHBOARD_DAEMON_UNRESPONSIVE`としてtyped拒否します。
|
|
378
376
|
最近のsession activityが1週間を過ぎても、Lattice storeの`active_set`が非空なproject、
|
|
379
|
-
|
|
377
|
+
または監査前Phaseがあるprojectは一覧へ残ります。
|
|
380
378
|
長時間の外部処理中にCLI呼出しが途切れても進行中projectを休眠扱いしません。
|
|
381
379
|
LANや外部reverse proxyから閲覧するoptional bridgeは既定で無効です。明示したIPにだけbindする初回設定、
|
|
382
380
|
再設定、停止方法は[bridge setup](docs/bridge-setup.md)を参照してください。reverse proxy hostへsshで
|
|
@@ -407,7 +405,7 @@ daemonの生死はdescriptor 1枚では持ちません。daemonは自分のpid
|
|
|
407
405
|
配信を続けているdaemonを引き取ります。signalを送るのはその場で再認証を通った相手だけで、応答しない
|
|
408
406
|
pidへは送りません(pid再利用で無関係のprocessを止めうるためです)。規約は
|
|
409
407
|
[ADR 0157](https://github.com/kitepon/Lattice/blob/main/docs/adr/0157-dashboard-daemons-are-discoverable-by-record.md)が正です。
|
|
410
|
-
状態を書き込む`start / block / unblock / done /
|
|
408
|
+
状態を書き込む`start / block / unblock / done / reopen / note / independence mode /
|
|
411
409
|
revise / revise-phase / revise-set / phase review|accept|reject|reopen|close-unaudited|baseline /
|
|
412
410
|
dashboard adopt`では、監査actorとして次の3環境変数を渡せます。未設定なら、hostは端末ごとのlabel
|
|
413
411
|
(`terminal-`と16進12桁)、sessionは`session`、agentはUSERになります。hostのlabelは端末の乱数の識別子
|
|
@@ -421,8 +419,7 @@ export LATTICE_TODO_ACTOR_SESSION=<session-id>
|
|
|
421
419
|
export LATTICE_TODO_ACTOR_AGENT=<agent-id>
|
|
422
420
|
```
|
|
423
421
|
|
|
424
|
-
`todo done`は`--evidence
|
|
425
|
-
blobを書きます。flagの順は問いません。空の設計メモは拒否します。無策なら`NO_PLAN`と書いてください。
|
|
422
|
+
`todo done`は`--message`の文を閉じた記録として残します(`--evidence <file>`は次のminorまでの別名で、fileの文を読むだけです)。flagの順は問いません。空の設計メモは拒否します。無策なら`NO_PLAN`と書いてください。
|
|
426
423
|
|
|
427
424
|
authoring入口と閉じる口の契約は
|
|
428
425
|
[ADR 0181](https://github.com/kitepon/Lattice/blob/main/docs/adr/0181-authoring-entry-accepts-drafts.md)を参照してください。
|
package/README.md
CHANGED
|
@@ -110,7 +110,7 @@ recompiles the final HEAD and requires a fresh, consistent finalization before t
|
|
|
110
110
|
|
|
111
111
|
```bash
|
|
112
112
|
lattice todo structure realize --plan <key> --task <id> --input realization.json
|
|
113
|
-
lattice todo done --plan <key> --task <id> --
|
|
113
|
+
lattice todo done --plan <key> --task <id> --message "<what was done>"
|
|
114
114
|
lattice todo structure finalize --plan <key> --json
|
|
115
115
|
```
|
|
116
116
|
|
|
@@ -281,7 +281,7 @@ re-derived is not recorded.
|
|
|
281
281
|
**Heavy audit is on by default.** A plan without explicit phases still carries an implicit
|
|
282
282
|
terminal audit: every task being done means `gate_ready` — *awaiting audit* — not finished. The
|
|
283
283
|
live dependency diagram refuses to fold such a plan away, because folding is how the product
|
|
284
|
-
says "closed", and nothing gets there without
|
|
284
|
+
says "closed", and nothing gets there without a recorded `phase accept` (or `close-unaudited`). Creation is never
|
|
285
285
|
rejected over it; the requirement is reported instead. And the audit gate never touches dispatch:
|
|
286
286
|
phases order reviews, the ToDo DAG orders work
|
|
287
287
|
([ADR 0147](https://github.com/kitepon/Lattice/blob/main/docs/adr/0147-audit-is-on-by-default.md)).
|
package/docs/bridge-setup.md
CHANGED
|
@@ -205,8 +205,8 @@ hubへ繋いでいる端末では、`runtime.last_heartbeat`が最後にhubへ
|
|
|
205
205
|
| `null` | hub未設定、またはまだ1回も送っていない | — |
|
|
206
206
|
|
|
207
207
|
名乗る集合はdaemonが実際に配信している集合そのもの(ADR 0165)。配信集合は
|
|
208
|
-
`last_seen_at`が1週間以内、またはactive run
|
|
209
|
-
人がCLIを叩かなくても、その条件を満たす限り公開面に残る。1週間を超え、run
|
|
208
|
+
`last_seen_at`が1週間以内、またはactive run、または監査前Phaseがあるprojectである。
|
|
209
|
+
人がCLIを叩かなくても、その条件を満たす限り公開面に残る。1週間を超え、runも監査前も
|
|
210
210
|
無いprojectは配信から外れる。heartbeatの90秒TTLは、配信そのものが止まった時
|
|
211
211
|
(daemon停止)にofflineへ落とすためのもので、鮮度窓ではない。
|
|
212
212
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quolu/lattice",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.107.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/chart-cli.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import { Writable } from 'node:stream';
|
|
|
9
9
|
import { promisify } from 'node:util';
|
|
10
10
|
|
|
11
11
|
import { parseFlagMap } from './todo-authoring-input.mjs';
|
|
12
|
+
import { isTodoIdentifier } from './todo-contracts.mjs';
|
|
12
13
|
import { TODO_CHARTS_ROOT_ENV } from './todo-external.mjs';
|
|
13
14
|
import {
|
|
14
15
|
readTodoChartMeta, readTodoStoreDisplaySource, TodoStoreError, writeTodoChartMeta,
|
|
@@ -176,14 +177,23 @@ function projectIdOf(env, dir) {
|
|
|
176
177
|
}
|
|
177
178
|
|
|
178
179
|
/**
|
|
179
|
-
* K4 `chart set [--name <text>] [--created-by <id>]`, at least one; `created` = K5 made the chart in this run.
|
|
180
|
+
* K4 `chart set [--name <text>] [--created-by <id>] [--no-code-lane <lanes>]`, at least one; `created` = K5 made the chart in this run.
|
|
180
181
|
* Without --name the patch has no `name` key, so the name stays as is (null stays null): the a102 sidecar migration.
|
|
181
182
|
*/
|
|
182
183
|
async function chartSet({ cwd, env, flags, created }) {
|
|
183
|
-
if (!('name' in flags) && !('created-by' in flags)) {
|
|
184
|
+
if (!('name' in flags) && !('created-by' in flags) && !('no-code-lane' in flags)) {
|
|
184
185
|
throw refusal('CHART_NAME_INVALID', 'chart_set_flag_missing', { field: '--name',
|
|
185
|
-
rule: '--name, --created-by or
|
|
186
|
-
next_action: 'lattice chart set --name <text> [--created-by <id>]
|
|
186
|
+
rule: '--name, --created-by, --no-code-lane or any of them',
|
|
187
|
+
next_action: 'lattice chart set --name <text> [--created-by <id>] [--no-code-lane <lane>[,<lane>...]]' });
|
|
188
|
+
}
|
|
189
|
+
// g3: the host marks the lanes whose tasks touch no code, once per chart; '' clears the list. Lattice names no lane itself.
|
|
190
|
+
const lanes = 'no-code-lane' in flags
|
|
191
|
+
? (typeof flags['no-code-lane'] === 'string' ? flags['no-code-lane'].split(',').map((lane) => lane.trim()).filter(Boolean) : null)
|
|
192
|
+
: undefined;
|
|
193
|
+
if (lanes === null || (lanes ?? []).some((lane) => !isTodoIdentifier(lane))) {
|
|
194
|
+
throw refusal('CHART_NAME_INVALID', 'chart_no_code_lane_invalid', { field: '--no-code-lane',
|
|
195
|
+
rule: 'comma-separated lane ids (letters, digits, . _ -); empty clears the list',
|
|
196
|
+
next_action: 'lattice chart set --no-code-lane <lane>[,<lane>...]' });
|
|
187
197
|
}
|
|
188
198
|
const name = 'name' in flags ? (typeof flags.name === 'string' ? flags.name.trim() : null) : undefined;
|
|
189
199
|
if (name !== undefined && !validChartName(name)) {
|
|
@@ -201,9 +211,10 @@ async function chartSet({ cwd, env, flags, created }) {
|
|
|
201
211
|
const dir = await repoRoot(cwd);
|
|
202
212
|
const createdBy = explicit ?? (created ? env[SEAT_ID_ENV] || null : undefined);
|
|
203
213
|
const { meta, unchanged } = await writeTodoChartMeta({ repoRoot: dir,
|
|
204
|
-
patch: { ...(name === undefined ? {} : { name }), ...(createdBy === undefined ? {} : { created_by: createdBy })
|
|
214
|
+
patch: { ...(name === undefined ? {} : { name }), ...(createdBy === undefined ? {} : { created_by: createdBy }),
|
|
215
|
+
...(lanes === undefined ? {} : { no_code_lanes: [...new Set(lanes)].sort() }) } });
|
|
205
216
|
return { schema: 'lattice.chart_set_result.v1', project_id: projectIdOf(env, dir), name: meta.name,
|
|
206
|
-
created_by: meta.created_by, created_at: meta.created_at, unchanged };
|
|
217
|
+
created_by: meta.created_by, created_at: meta.created_at, no_code_lanes: meta.no_code_lanes, unchanged };
|
|
207
218
|
}
|
|
208
219
|
|
|
209
220
|
const URL_PATTERN = /^(?:https:\/\/|ssh:\/\/|file:\/\/|git@)[^\s\p{Cc}]+$/u;
|
|
@@ -244,7 +255,8 @@ async function runSensor(command, dir) {
|
|
|
244
255
|
/**
|
|
245
256
|
* K7 sync. Named protection: never reset, clean, force or repoint; tracked edits make it `dirty` and a HEAD that is
|
|
246
257
|
* not the accepted baseline makes it `diverged` (nothing moves). Self-exit: a failed step is reported and the next
|
|
247
|
-
* sync tries again.
|
|
258
|
+
* sync tries again. HEAD moves only from the baseline. Only the first fetch is depth-1; later fetches keep the previous tip
|
|
259
|
+
* an ancestor of the new one (gate 4's merged-sha check and the structure adapter's `rev-list baseline..HEAD` need that).
|
|
248
260
|
*/
|
|
249
261
|
async function chartRepoSync({ cwd, env }) {
|
|
250
262
|
const dir = await repoRoot(cwd);
|
|
@@ -276,9 +288,9 @@ async function chartRepoSync({ cwd, env }) {
|
|
|
276
288
|
}
|
|
277
289
|
// Charts moved before 0.101.0 kept the baseline in refs/remotes/origin/<branch>.
|
|
278
290
|
const accepted = meta.repo.accepted_tip ?? await optional(['rev-parse', '--verify', '--quiet', `refs/remotes/origin/${branch}`]);
|
|
279
|
-
await git('fetch', ['fetch', '--quiet', '--depth=1', '--no-tags', url, branch]);
|
|
280
|
-
const tip = await git('fetch', ['rev-parse', 'FETCH_HEAD']);
|
|
281
291
|
const head = await optional(['rev-parse', '--verify', '--quiet', 'HEAD']);
|
|
292
|
+
await git('fetch', ['fetch', '--quiet', ...(head === null ? ['--depth=1'] : []), '--no-tags', url, branch]);
|
|
293
|
+
const tip = await git('fetch', ['rev-parse', 'FETCH_HEAD']);
|
|
282
294
|
if (head !== null && head !== tip && head !== accepted) return result('diverged', { tip, accepted_tip: accepted });
|
|
283
295
|
if (head !== tip) await git('checkout', ['checkout', '--quiet', '-B', branch, tip]);
|
|
284
296
|
if (meta.repo.accepted_tip !== tip) {
|
|
@@ -325,8 +337,8 @@ export async function runChartCli({ argv, cwd, env, stdout, stderr, created = fa
|
|
|
325
337
|
result = await chartSources(env, ids);
|
|
326
338
|
} else if (group === 'chart' && command === 'set') {
|
|
327
339
|
const { flags, rest } = parseFlagMap(words.slice(2));
|
|
328
|
-
if (rest.length > 0 || Object.keys(flags).some((key) => !['name', 'created-by'].includes(key))) {
|
|
329
|
-
return usage(stderr, 'chart set [--name <text>] [--created-by <id>] [--json]');
|
|
340
|
+
if (rest.length > 0 || Object.keys(flags).some((key) => !['name', 'created-by', 'no-code-lane'].includes(key))) {
|
|
341
|
+
return usage(stderr, 'chart set [--name <text>] [--created-by <id>] [--no-code-lane <lane>[,<lane>...]] [--json]');
|
|
330
342
|
}
|
|
331
343
|
result = await chartSet({ cwd, env, flags, created });
|
|
332
344
|
} else if (group === 'chart' && command === 'repo' && sub === 'bind') {
|
package/src/cli-help.mjs
CHANGED
|
@@ -138,14 +138,11 @@ Write commands:
|
|
|
138
138
|
add --plan <key> --task <id> --title <text> [--phase <id>] [--lane <lane>] [--done-condition <text>]
|
|
139
139
|
[--design-memo <text>] [--after <id>[,<id>...]] [--before <id>[,<id>...]] [--reason <text>]
|
|
140
140
|
# 1件を足す(a39)。planの全体を書かずに軽量改訂で新plan_versionを作り、他のtaskはcarry
|
|
141
|
-
done --plan <key> --task <id> [--
|
|
142
|
-
# task
|
|
141
|
+
done --plan <key> --task <id> [--message <text>] [--test-result <markdown-file>]
|
|
142
|
+
# taskを閉じる。--messageの文が閉じた記録になる(省略すると既定の文)。--evidence <file>は次のminorまでの別名で、fileの文を--messageとして読む。
|
|
143
143
|
# 既にdoneなら何も足さずunchanged:trueで成功する(a12)
|
|
144
144
|
# 監査と構造finalizationは残作業であり、doneの門ではない
|
|
145
145
|
reopen --plan <key> --task <id> --reason <text> [--override-reason <text>]
|
|
146
|
-
evidence promote --plan <key> --task <id> --evidence <file>
|
|
147
|
-
evidence anchor [--json] # 既存の証拠をgcから守る印(refs/lattice/evidence/<oid>)を付ける。commit済みにはならない
|
|
148
|
-
# done状態と完了時刻を維持し、最新doneへ追記eventで証拠を再束縛する
|
|
149
146
|
start --plan <key> --task <id> --rebind --reason <text> # 改訂でcarryされたin-progressへ現版のstart束縛を積み直す(ADR 0191)
|
|
150
147
|
predecessor add --plan <key> --task <id> --after <plan>/<task> --reason <text>
|
|
151
148
|
predecessor remove --plan <key> --task <id> --after <plan>/<task> --reason <text>
|
|
@@ -201,8 +198,8 @@ Write commands:
|
|
|
201
198
|
# 実際に受理する最新契約のJSON Schemaを返す(storeを読まない)。
|
|
202
199
|
# 入力が契約に合わないときは、違反フィールドのpathがerror detailへ載る
|
|
203
200
|
phase review --plan <key> --phase <id> --reason <text>
|
|
204
|
-
phase accept --plan <key> --phase <id> --
|
|
205
|
-
phase reject --plan <key> --phase <id> --reason <text> --
|
|
201
|
+
phase accept --plan <key> --phase <id> [--message <text>]
|
|
202
|
+
phase reject --plan <key> --phase <id> --reason <text> [--message <text>]
|
|
206
203
|
phase <accept|reject> --plan <key> --phase <id> --input <file>
|
|
207
204
|
phase reopen --plan <key> --phase <id> --reason <text> [--override-reason <text>]
|
|
208
205
|
phase close-unaudited --plan <key> --phase <id> --reason <text>
|
|
@@ -340,8 +337,8 @@ const SUBCOMMAND_USAGE = Object.freeze({
|
|
|
340
337
|
charts: 'charts list [--json] | source [--project <id>]... [--json] # LATTICE_CHARTS_ROOT配下の全工程表を1プロセスで読む',
|
|
341
338
|
'charts list': 'charts list [--json] # lattice.charts_list_result.v1 {charts_root, charts:[{project_id, name, created_by, created_at, source}], findings}',
|
|
342
339
|
'charts source': 'charts source [--project <id>]... [--json] # lattice.charts_source_result.v1 {charts:{<id>: <source>|null}}(--project無し=全工程表)',
|
|
343
|
-
chart: 'chart set [--name <text>] [--created-by <id>] [--json] | repo bind --url <url> --branch <branch> [--json] | repo sync [--json]',
|
|
344
|
-
'chart set': 'chart set [--name <text>] [--created-by <id>] [--json] # lattice.chart_set_result.v1
|
|
340
|
+
chart: 'chart set [--name <text>] [--created-by <id>] [--no-code-lane <lane>[,<lane>...]] [--json] | repo bind --url <url> --branch <branch> [--json] | repo sync [--json]',
|
|
341
|
+
'chart set': 'chart set [--name <text>] [--created-by <id>] [--no-code-lane <lane>[,<lane>...]] [--json] # lattice.chart_set_result.v1(1つ以上。--no-code-lane はコードを触らない工程のlaneで、enforcedの着手の関門1-3を外す(空文字で消す)。名前は1-40字・制御文字なし。--nameが無ければ名前はそのまま。--created-byは作成者が空の時だけ)',
|
|
345
342
|
'chart repo': 'chart repo bind --url <url> --branch <branch> [--json] | sync [--json] # lattice.chart_repo_result.v1',
|
|
346
343
|
'chart repo bind': 'chart repo bind --url <url> --branch <branch> [--json] # コード工程表のrepoを記録する',
|
|
347
344
|
'chart repo sync': 'chart repo sync [--json] # depth-1 fetch、accepted_tipからだけ前進(reset/forceしない)、その後sensor。status current|synced|dirty|diverged|failed',
|
|
@@ -368,8 +365,8 @@ const SUBCOMMAND_USAGE = Object.freeze({
|
|
|
368
365
|
+ ' | baseline --reason <text> [--except <plan_key>]...',
|
|
369
366
|
'todo phase status': 'todo phase status --plan <key> [--json]',
|
|
370
367
|
'todo phase review': 'todo phase review --plan <key> --phase <id> --reason <text>',
|
|
371
|
-
'todo phase accept': 'todo phase accept --plan <key> --phase <id> --
|
|
372
|
-
'todo phase reject': 'todo phase reject --plan <key> --phase <id> --reason <text> --
|
|
368
|
+
'todo phase accept': 'todo phase accept --plan <key> --phase <id> [--message <text>]',
|
|
369
|
+
'todo phase reject': 'todo phase reject --plan <key> --phase <id> --reason <text> [--message <text>]',
|
|
373
370
|
'todo phase reopen': 'todo phase reopen --plan <key> --phase <id> --reason <text> [--override-reason <text>]',
|
|
374
371
|
'todo phase close-unaudited': 'todo phase close-unaudited --plan <key> --phase <id> --reason <text>',
|
|
375
372
|
'todo phase baseline': 'todo phase baseline --reason <text> [--except <plan_key>]...',
|
|
@@ -381,11 +378,8 @@ const SUBCOMMAND_USAGE = Object.freeze({
|
|
|
381
378
|
'todo retire': 'todo retire --plan <key> --task <id> --reason <text>',
|
|
382
379
|
'todo add': 'todo add --plan <key> --task <id> --title <text> [--phase <id>] [--lane <lane>] [--done-condition <text>]'
|
|
383
380
|
+ ' [--design-memo <text>] [--after <id>[,<id>...]] [--before <id>[,<id>...]] [--reason <text>]',
|
|
384
|
-
'todo done': 'todo done --plan <key> --task <id> [--
|
|
381
|
+
'todo done': 'todo done --plan <key> --task <id> [--message <text>] [--test-result <markdown-file>]',
|
|
385
382
|
'todo reopen': 'todo reopen --plan <key> --task <id> --reason <text> [--override-reason <text>]',
|
|
386
|
-
'todo evidence': 'todo evidence promote --plan <key> --task <id> --evidence <file> | anchor [--json]',
|
|
387
|
-
'todo evidence anchor': 'todo evidence anchor [--json] # lattice.todo_evidence_anchor_result.v1 {anchored, already, missing}; no Store yet: lattice.todo_evidence_anchor_uninitialized.v1',
|
|
388
|
-
'todo evidence promote': 'todo evidence promote --plan <key> --task <id> --evidence <file>',
|
|
389
383
|
'todo predecessor': [
|
|
390
384
|
'todo predecessor add --plan <key> --task <id> --after <plan>/<task> --reason <text>',
|
|
391
385
|
'todo predecessor remove --plan <key> --task <id> --after <plan>/<task> --reason <text>',
|
|
@@ -24,11 +24,7 @@ const run = (ctx, ...tail) => ['lattice', ctx.family ?? 'todo', ctx.command, ...
|
|
|
24
24
|
const schemaCommand = (ctx) => run(ctx, '--schema', '--json');
|
|
25
25
|
const showTask = (detail, ctx) => `lattice todo show --plan ${planOf(detail, ctx)} --task ${taskOf(detail, ctx)} --json`;
|
|
26
26
|
const startTask = (detail, ctx) => `lattice todo start --plan ${planOf(detail, ctx)} --task ${taskOf(detail, ctx)}`;
|
|
27
|
-
|
|
28
|
-
export const ENFORCED_DONE_MESSAGE = '"<PR URL or merged commit sha>"';
|
|
29
|
-
// A done hint that the done gate accepts: on an enforced plan (ctx.enforcedPlans) it names the change, else `rest`.
|
|
30
|
-
const doneCommand = (planKey, taskId, ctx, rest = '') => `lattice todo done --plan ${planKey} --task ${taskId}${
|
|
31
|
-
strings(ctx.enforcedPlans).includes(planKey) ? ` --message ${ENFORCED_DONE_MESSAGE}` : rest}`;
|
|
27
|
+
const doneCommand = (planKey, taskId, rest = '') => `lattice todo done --plan ${planKey} --task ${taskId}${rest}`;
|
|
32
28
|
// a12: name the blocking task (seat contract), falling back to the refused task's own detail.
|
|
33
29
|
const blocker = (detail) => (Array.isArray(detail.blocking_tasks) ? detail.blocking_tasks.find(record) : undefined);
|
|
34
30
|
// a18: the step that moves the blocker on depends on its status (a pending one is started first).
|
|
@@ -40,7 +36,7 @@ const unfinishedFirst = (detail, ctx) => {
|
|
|
40
36
|
return ({
|
|
41
37
|
pending: `Start ${name} first with \`lattice todo start ${on}\`, then record done on it`,
|
|
42
38
|
blocked: `Unblock ${name} with \`lattice todo unblock ${on}\`, then record done on it`,
|
|
43
|
-
})[first.status] ?? `Record done on ${name} first with \`${doneCommand(first.plan_key, first.task_id,
|
|
39
|
+
})[first.status] ?? `Record done on ${name} first with \`${doneCommand(first.plan_key, first.task_id, ' --message <text>')}\` (see \`lattice todo show ${on} --json\`)`;
|
|
44
40
|
};
|
|
45
41
|
// 接続: an open 他条件に接続 is not a 前工程; name how it settles and how to remove it (Store: blocking_connections).
|
|
46
42
|
const openConnections = (detail) => (Array.isArray(detail.blocking_connections) ? detail.blocking_connections.filter(record) : []);
|
|
@@ -64,7 +60,7 @@ const inProgressHolder = (detail, ctx, on) => {
|
|
|
64
60
|
return `It is in-progress under '${holder}', the name a start gets without LATTICE_SEAT_ID: most likely this seat's own`
|
|
65
61
|
+ ` start from before it set LATTICE_SEAT_ID. One-time fix (seat contract): with LATTICE_SEAT_ID unset, undo that start`
|
|
66
62
|
+ ` with \`lattice todo retract ${on} --reason <text>\` and start it again here, or finish it there first with`
|
|
67
|
-
+ ` \`${doneCommand(planOf(detail, ctx), taskOf(detail, ctx),
|
|
63
|
+
+ ` \`${doneCommand(planOf(detail, ctx), taskOf(detail, ctx), ' --message <text>')}\`.`;
|
|
68
64
|
}
|
|
69
65
|
return `It is already in-progress under ${holder === null ? 'another seat' : `seat '${holder}'`}; see \`${showTask(detail, ctx)}\`.`
|
|
70
66
|
+ ` To move it to this seat run \`lattice todo start ${on} --rebind --reason <text>\`.`;
|
|
@@ -238,7 +234,7 @@ const REGISTRY = {
|
|
|
238
234
|
// a32: only a done task can be reopened; say the state and the step that fits it.
|
|
239
235
|
repair: (detail, ctx) => {
|
|
240
236
|
const on = `--plan ${planOf(detail, ctx)} --task ${taskOf(detail, ctx)}`;
|
|
241
|
-
const done = doneCommand(planOf(detail, ctx), taskOf(detail, ctx)
|
|
237
|
+
const done = doneCommand(planOf(detail, ctx), taskOf(detail, ctx));
|
|
242
238
|
return `Only a done task can be reopened; ${planOf(detail, ctx)}/${taskOf(detail, ctx)} is ${detail.status ?? 'not done'}. ` + ({
|
|
243
239
|
// retract-anyone: any seat may return an in-progress task to unstarted.
|
|
244
240
|
'in-progress': `It is still open: finish it with \`${done}\`, or return it to unstarted with \`lattice todo retract ${on} --reason <text>\`.`,
|
|
@@ -257,7 +253,7 @@ const REGISTRY = {
|
|
|
257
253
|
const status = detail.phase_status;
|
|
258
254
|
const head = `Phase ${plan}/${phase} is ${status ?? 'not gate_ready'}; review and close-unaudited need gate_ready. `;
|
|
259
255
|
if (isAuditPendingPhaseStatus(status) && status !== 'gate_ready') {
|
|
260
|
-
const [first, second] = auditPendingNextCommands(plan, phase, status
|
|
256
|
+
const [first, second] = auditPendingNextCommands(plan, phase, status);
|
|
261
257
|
return head + (status === 'reviewing'
|
|
262
258
|
? `It is already in review: decide it with \`${first}\`, or \`${second}\`.`
|
|
263
259
|
: `Its review was rejected: run \`${first}\`, then review it again.`);
|
|
@@ -274,7 +270,7 @@ const REGISTRY = {
|
|
|
274
270
|
// retract-anyone: retract targets the event that last made the task in-progress (start, reopen or carrying revision).
|
|
275
271
|
repair: (detail, ctx) => `retract targets the event that last put ${planOf(detail, ctx)}/${taskOf(detail, ctx)} in progress`
|
|
276
272
|
+ ` and found none in this plan version; see \`${showTask(detail, ctx)}\`, or finish it with`
|
|
277
|
-
+ ` \`${doneCommand(planOf(detail, ctx), taskOf(detail, ctx)
|
|
273
|
+
+ ` \`${doneCommand(planOf(detail, ctx), taskOf(detail, ctx))}\`.`,
|
|
278
274
|
},
|
|
279
275
|
reopen_has_started_successor: {
|
|
280
276
|
repair: (detail, ctx) => `A successor of ${taskOf(detail, ctx)} has already started: to reopen it anyway run \`lattice todo reopen --plan ${planOf(detail, ctx)} --task ${taskOf(detail, ctx)} --reason <text> --override-reason <text>\`.`,
|
|
@@ -396,11 +392,7 @@ const REGISTRY = {
|
|
|
396
392
|
note_input_too_large: inputFile('The input is too large.'),
|
|
397
393
|
evidence_input_invalid_utf8: {
|
|
398
394
|
pointer: '--evidence',
|
|
399
|
-
repair: () => 'Save the
|
|
400
|
-
},
|
|
401
|
-
authored_evidence_descriptor_invalid: {
|
|
402
|
-
pointer: '--evidence',
|
|
403
|
-
repair: () => 'Pass a non-empty text file to --evidence (or use --message <text>) whose content can be stored as evidence.',
|
|
395
|
+
repair: () => 'Save the file as UTF-8 and pass it to --evidence again, or pass the text with --message <text>.',
|
|
404
396
|
},
|
|
405
397
|
test_result_must_be_non_empty_markdown: {
|
|
406
398
|
pointer: '--test-result',
|
package/src/project-cli.mjs
CHANGED
|
@@ -319,7 +319,7 @@ async function resolveProjectState({ cwd, cliVersion, diagnoseStructureArtifacts
|
|
|
319
319
|
// 監査/構造finalization待ちが在る限り「残作業なし」と答えない。優先順位は
|
|
320
320
|
// active_run > next_ready > structure finalization > audit_pending > なし。
|
|
321
321
|
// ready frontierが在る間はADR 0063の並列開始コマンドが勝つ
|
|
322
|
-
// ——ここを監査で上書きするとdispatch
|
|
322
|
+
// ——ここを監査で上書きするとdispatchが再直列化する。監査前はtodo statusの
|
|
323
323
|
// audit_pending欄に常在するので、順位を下げても消えない。
|
|
324
324
|
// gate_ready(全taskが終わり監査も未着手)は軽い出口close-unauditedを1行で示す(a22)。
|
|
325
325
|
// 監査を始めた後(reviewing/rejected)は読み取り専用の`todo phase status`が両分岐を示す。
|
package/src/sensor-cli.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
1
2
|
import { existsSync } from 'node:fs';
|
|
3
|
+
import { appendFile, mkdir, readFile } from 'node:fs/promises';
|
|
2
4
|
import path from 'node:path';
|
|
5
|
+
import { promisify } from 'node:util';
|
|
3
6
|
import sensorPackage from '../sensor/package.json' with { type: 'json' };
|
|
4
7
|
import { compareSensorIndexes, parseSensorDiffArgs, SensorDiffError } from './sensor-diff.mjs';
|
|
5
8
|
import { spawnSensorCli } from './sensor-runtime.mjs';
|
|
@@ -57,6 +60,25 @@ function runDiff(request, stdout, stderr) {
|
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
62
|
|
|
63
|
+
/**
|
|
64
|
+
* g2: the index (`.lattice/sensor/`, ~143 MB) must not be committed by `git add -A` in a product clone; not a git work tree = nothing to do.
|
|
65
|
+
* Only the index: `.lattice/todo` may be tracked or added in the same repo (ignoring all of `.lattice/` broke `git add .lattice/todo`).
|
|
66
|
+
*/
|
|
67
|
+
async function excludeSensorIndex(projectPath) {
|
|
68
|
+
try {
|
|
69
|
+
const { stdout } = await promisify(execFile)('git', ['rev-parse', '--git-path', 'info/exclude'], { cwd: projectPath });
|
|
70
|
+
const exclude = path.resolve(projectPath, stdout.trim());
|
|
71
|
+
const text = await readFile(exclude, 'utf8').catch(() => '');
|
|
72
|
+
if (text.split(/\r?\n/u).includes('.lattice/sensor/')) return;
|
|
73
|
+
await mkdir(path.dirname(exclude), { recursive: true });
|
|
74
|
+
await appendFile(exclude, `${text === '' || text.endsWith('\n') ? '' : '\n'}.lattice/sensor/\n`);
|
|
75
|
+
} catch (error) {
|
|
76
|
+
// Not a git work tree (git exits 128) or no git on PATH: there is nothing `git add -A` could commit from here.
|
|
77
|
+
if (error?.code === 128 || error?.code === 'ENOENT') return;
|
|
78
|
+
process.emitWarning(`.lattice/sensor/ not added to .git/info/exclude: ${error?.message ?? error}`, { code: 'LATTICE_SENSOR_EXCLUDE_FAILED' });
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
60
82
|
function execute(command, projectPath) {
|
|
61
83
|
return new Promise((resolve, reject) => {
|
|
62
84
|
let captured = 0;
|
|
@@ -107,6 +129,7 @@ export async function runSensorCli({ argv, stdout, stderr }) {
|
|
|
107
129
|
return 1;
|
|
108
130
|
}
|
|
109
131
|
try {
|
|
132
|
+
await excludeSensorIndex(request.path);
|
|
110
133
|
const result = await execute(request.command, request.path);
|
|
111
134
|
if (result.code !== 0 || result.signal || result.overflow) {
|
|
112
135
|
const notInitialized = request.command === 'sync' && /not initialized/u.test(result.stderr);
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 監査前Phaseの定義(ADR 0147/0148)。
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* 「監査前」は同じ3状態の集合として、gantt scopeのfold判定・dashboardの表示判定へ
|
|
5
5
|
* 別々に書かれていた。status面にも同じ判定が要るので、定義をここへ一本化する——
|
|
6
6
|
* 集合が三重になれば、片方だけ更新された時に「図には出るがstatusには出ない」形の
|
|
7
7
|
* ずれが生まれる。ADR 0147が塞ごうとした事故と外形が同じになる。
|
|
8
8
|
*
|
|
9
|
-
* このmodule
|
|
9
|
+
* このmoduleが持つのは監査前の**定義**だけである。各消費者の方針
|
|
10
10
|
* (ganttのfold対象をどのplan世代へ限るか等)はここへ持ち込まない。
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* 監査の判断がまだ着いていないPhase状態。
|
|
15
15
|
*
|
|
16
|
-
* - `gate_ready`: 所属ToDoが全てdone
|
|
16
|
+
* - `gate_ready`: 所属ToDoが全てdoneで、監査前。
|
|
17
17
|
* - `reviewing`: 監査中(reviewは出たが、acceptもrejectも出ていない)。
|
|
18
18
|
* - `rejected`: 監査が通らず、要フォロー。
|
|
19
19
|
*
|
|
@@ -23,27 +23,26 @@
|
|
|
23
23
|
*/
|
|
24
24
|
export const AUDIT_PENDING_PHASE_STATUSES = new Set(['gate_ready', 'reviewing', 'rejected']);
|
|
25
25
|
|
|
26
|
-
/** そのPhase
|
|
26
|
+
/** そのPhase状態が監査前か。null/undefined/未知の値はfalse。 */
|
|
27
27
|
export function isAuditPendingPhaseStatus(status) {
|
|
28
28
|
return AUDIT_PENDING_PHASE_STATUSES.has(status ?? null);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* その監査前状態から実際に打てるコマンド。
|
|
33
33
|
*
|
|
34
34
|
* `src/todo-store.mjs`の遷移guardと一致させる——gate_readyからいきなりacceptはできず
|
|
35
35
|
* (`phase_gate_not_ready`)、reviewing以外からのrejectもできない(`phase_reject_binding_invalid`)。
|
|
36
36
|
* 実行すれば必ず弾かれる遷移を「次の一歩」として案内しない。
|
|
37
37
|
*
|
|
38
|
-
*
|
|
38
|
+
* 監査前でない状態を渡すのは呼び出し側の誤りなので、空配列へ丸めずに投げる。
|
|
39
39
|
* 呼ぶ前に`isAuditPendingPhaseStatus`で絞ること。
|
|
40
40
|
*
|
|
41
|
-
* `slotCount`は必須evidence slotの数。1つなら`--evidence`で足り、複数なら`--input`が要る。
|
|
42
41
|
* `auditRequired`(`phaseAuditRequired`)ならclose-unauditedを案内しない(ADR 0200 gate 5が断る)。
|
|
43
42
|
*
|
|
44
43
|
* @returns {string[]} 実行可能なコマンド行(1つ以上)
|
|
45
44
|
*/
|
|
46
|
-
export function auditPendingNextCommands(planKey, phaseId, status,
|
|
45
|
+
export function auditPendingNextCommands(planKey, phaseId, status, { auditRequired = false } = {}) {
|
|
47
46
|
const target = `--plan ${planKey} --phase ${phaseId}`;
|
|
48
47
|
if (status === 'gate_ready') {
|
|
49
48
|
return [
|
|
@@ -54,9 +53,8 @@ export function auditPendingNextCommands(planKey, phaseId, status, slotCount = 1
|
|
|
54
53
|
}
|
|
55
54
|
if (status === 'reviewing') {
|
|
56
55
|
return [
|
|
57
|
-
|
|
58
|
-
`lattice todo phase
|
|
59
|
-
`lattice todo phase reject ${target} --reason <text> --evidence <file>`,
|
|
56
|
+
`lattice todo phase accept ${target} [--message <text>]`,
|
|
57
|
+
`lattice todo phase reject ${target} --reason <text> [--message <text>]`,
|
|
60
58
|
];
|
|
61
59
|
}
|
|
62
60
|
if (status === 'rejected') {
|
|
@@ -73,7 +71,7 @@ export function phaseAuditRequired(member, gatePolicy) {
|
|
|
73
71
|
}
|
|
74
72
|
|
|
75
73
|
/**
|
|
76
|
-
* store read model(`lattice.todo_store_read.v1`)
|
|
74
|
+
* store read model(`lattice.todo_store_read.v1`)の中の監査前Phaseを列挙する。
|
|
77
75
|
*
|
|
78
76
|
* `member.phases`はstoreが常に埋める導出ビューで、phase無しplanの暗黙terminal-audit Phaseも
|
|
79
77
|
* 同じ形で入っている(ADR 0147)。planの世代で分岐しないのはそのためである。
|
|
@@ -312,7 +312,7 @@ function looksLikeProse(value) {
|
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
function outsideRepoAction(canonicalRoot, inlineFlag) {
|
|
315
|
-
return '
|
|
315
|
+
return 'この引数はrepo内のfileだけ受理する。'
|
|
316
316
|
+ `repo外(/tmp等)にあるならrepo内へ写してから渡す${inlineFlag ? `か、本文を ${inlineFlag} <text> で渡す` : ''}(repo_root: ${canonicalRoot})`;
|
|
317
317
|
}
|
|
318
318
|
|