@quolu/lattice 0.85.0 → 0.85.2
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/bin/lattice.mjs +31 -16
- package/docs/schemas/lattice.plan_create_input.v4.schema.json +1 -1
- package/docs/schemas/lattice.plan_create_input.v5.schema.json +1 -1
- package/package.json +1 -1
- package/src/cli-help.mjs +21 -14
- package/src/cli-refusal-guidance.mjs +54 -2
- package/src/hooks-cli.mjs +4 -1
- package/src/plan-backchain.mjs +48 -8
- package/src/plan-scope-review.mjs +3 -2
- package/src/project-cli.mjs +103 -12
- package/src/runtime-cli.mjs +4 -1
- package/src/sensor-cli.mjs +8 -2
- package/src/sensor-diff.mjs +8 -0
- package/src/setup-cli.mjs +6 -2
- package/src/todo-authoring-input.mjs +14 -6
- package/src/todo-cli.mjs +284 -136
- package/src/todo-readiness.mjs +13 -3
package/src/sensor-cli.mjs
CHANGED
|
@@ -11,10 +11,10 @@ function writeJson(stream, value) {
|
|
|
11
11
|
stream.write(`${JSON.stringify(value)}\n`);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const USAGE = 'usage: lattice sensor <init|sync> [path] --json'
|
|
14
|
+
const USAGE = 'usage: lattice sensor <init|sync> [path] [--json]'
|
|
15
15
|
+ ' | lattice sensor diff <rootA> <rootB>'
|
|
16
16
|
+ ' [--subtree-a <rel>] [--subtree-b <rel>] [--map-a <from>=<to>] [--map-b <from>=<to>]'
|
|
17
|
-
+ ' [--limit <n>] --json';
|
|
17
|
+
+ ' [--limit <n>] [--json]';
|
|
18
18
|
|
|
19
19
|
function usage(stderr) {
|
|
20
20
|
writeJson(stderr, { schema: 'lattice.cli_error.v2', code: 'USAGE', message: USAGE });
|
|
@@ -100,6 +100,12 @@ export async function runSensorCli({ argv, stdout, stderr }) {
|
|
|
100
100
|
const request = parse(argv);
|
|
101
101
|
if (!request) return usage(stderr);
|
|
102
102
|
if (request.command === 'diff') return runDiff(request.diff, stdout, stderr);
|
|
103
|
+
if (!existsSync(request.path)) {
|
|
104
|
+
writeJson(stderr, { schema: 'lattice.cli_error.v2', code: 'LATTICE_SENSOR_PATH_MISSING',
|
|
105
|
+
message: `no such project path: ${request.path}`,
|
|
106
|
+
detail: { path: request.path, next_action: `lattice sensor ${request.command}` } });
|
|
107
|
+
return 1;
|
|
108
|
+
}
|
|
103
109
|
try {
|
|
104
110
|
const result = await execute(request.command, request.path);
|
|
105
111
|
if (result.code !== 0 || result.signal || result.overflow) {
|
package/src/sensor-diff.mjs
CHANGED
|
@@ -546,6 +546,14 @@ export function compareSensorIndexes(request) {
|
|
|
546
546
|
const sideB = withReadSnapshot(handleB, () => loadSide(
|
|
547
547
|
handleB, makePathNormalizer(request.b.subtree ?? '', request.b.mappings ?? []), 'b',
|
|
548
548
|
));
|
|
549
|
+
// A subtree that matches no indexed file is a typo, not an empty side: say so instead of "ok".
|
|
550
|
+
for (const [side, loaded, subtree] of [['a', sideA, request.a.subtree], ['b', sideB, request.b.subtree]]) {
|
|
551
|
+
if (subtree && loaded.counts.files === 0 && loaded.excluded.files_outside_subtree > 0) {
|
|
552
|
+
throw new SensorDiffError('LATTICE_SENSOR_DIFF_SUBTREE_EMPTY',
|
|
553
|
+
`--subtree-${side} ${subtree} matches no indexed file`,
|
|
554
|
+
{ side, subtree, next_action: `check the path; omit --subtree-${side} to compare the whole index` });
|
|
555
|
+
}
|
|
556
|
+
}
|
|
549
557
|
const comparability = assessComparability(sideA, sideB);
|
|
550
558
|
|
|
551
559
|
const nodes = diffNodes(sideA, sideB);
|
package/src/setup-cli.mjs
CHANGED
|
@@ -24,7 +24,9 @@ async function hookResult(host, options, statusOnly) {
|
|
|
24
24
|
if (installed.exit !== 0) return { ...installed.result, state: 'failed' };
|
|
25
25
|
}
|
|
26
26
|
const status = await invoke('status');
|
|
27
|
-
|
|
27
|
+
if (status.exit === 0 && status.result.state === 'wired') return { ...status.result, state: 'verified' };
|
|
28
|
+
// Keep setup's verified/failed, and name the hooks status state as the code (as MCP does).
|
|
29
|
+
return { ...status.result, state: 'failed', code: `HOOKS_${String(status.result.state ?? 'failed').toUpperCase()}` };
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
async function configureHost(host, options, statusOnly) {
|
|
@@ -116,6 +118,8 @@ export async function runSetupCli({ argv, stdout, env = process.env, platform =
|
|
|
116
118
|
const state = !hosts.length || features.some((feature) => feature.state === 'failed') ? 'failed'
|
|
117
119
|
: features.every((feature) => feature.state === 'verified') ? 'ready' : 'partial';
|
|
118
120
|
stdout.write(`${JSON.stringify({ schema: 'lattice.setup_result.v1', operation: statusOnly ? 'status' : 'setup',
|
|
119
|
-
platform, state, ...(hosts.length ? {} : { code: 'HOST_NOT_PRESENT'
|
|
121
|
+
platform, state, ...(hosts.length ? {} : { code: 'HOST_NOT_PRESENT',
|
|
122
|
+
message: 'このHOMEにはAIの設定フォルダがありません',
|
|
123
|
+
next_action: 'lattice setup --host <claude|codex|grok|cursor>' }), hosts: results })}\n`);
|
|
120
124
|
return state === 'ready' ? 0 : 1;
|
|
121
125
|
}
|
|
@@ -307,7 +307,13 @@ function looksLikeProse(value) {
|
|
|
307
307
|
|| (/\s/u.test(value) && !/[/\\]/u.test(value));
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
-
|
|
310
|
+
function outsideRepoAction(canonicalRoot, inlineFlag) {
|
|
311
|
+
return 'この引数は証拠としてrepo内のpathとgit blobで記録し、他の席がそれを検証するので、repo内のfileだけ受理する。'
|
|
312
|
+
+ `repo外(/tmp等)にあるならrepo内へ写してから渡す${inlineFlag ? `か、本文を ${inlineFlag} <text> で渡す` : ''}(repo_root: ${canonicalRoot})`;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// allowOutsideRepo: 中身だけを読むcaller(JSON入力・note本文・test result)はrepo外の絶対pathも受ける(a17, a23)。
|
|
316
|
+
// 証拠はrepo内のpathとgit blobで記録し他の席が検証するので、既定のまま拒む。
|
|
311
317
|
export async function resolveAuthoringInputPath(repoRoot, inputRef, {
|
|
312
318
|
inlineFlag = null, allowOutsideRepo = false,
|
|
313
319
|
} = {}) {
|
|
@@ -318,6 +324,8 @@ export async function resolveAuthoringInputPath(repoRoot, inputRef, {
|
|
|
318
324
|
const candidate = path.isAbsolute(inputRef)
|
|
319
325
|
? inputRef
|
|
320
326
|
: path.resolve(canonicalRoot, inputRef);
|
|
327
|
+
// a23: 「repo内」と言うのは、repo外を拒むcallerの時だけ。
|
|
328
|
+
const fileKind = allowOutsideRepo ? 'file path(repo外は絶対path)' : 'repo内のfile path';
|
|
321
329
|
let stats;
|
|
322
330
|
try { stats = await lstat(candidate); } catch {
|
|
323
331
|
fail('INPUT_UNREADABLE', 'input_missing', {
|
|
@@ -325,9 +333,9 @@ export async function resolveAuthoringInputPath(repoRoot, inputRef, {
|
|
|
325
333
|
repo_root: canonicalRoot,
|
|
326
334
|
next_action: looksLikeProse(inputRef)
|
|
327
335
|
? (inlineFlag
|
|
328
|
-
?
|
|
329
|
-
:
|
|
330
|
-
:
|
|
336
|
+
? `この引数は${fileKind}を取る。文章をそのまま渡すなら ${inlineFlag} <text> を使う`
|
|
337
|
+
: `この引数は${fileKind}を取る。渡された値は本文に見える——先にfileへ書いてからそのpathを渡す`)
|
|
338
|
+
: `存在する${fileKind}を渡す(相対pathはrepo_rootから解く: ${canonicalRoot})`,
|
|
331
339
|
});
|
|
332
340
|
}
|
|
333
341
|
if (stats.isSymbolicLink() || !stats.isFile()) {
|
|
@@ -342,7 +350,7 @@ export async function resolveAuthoringInputPath(repoRoot, inputRef, {
|
|
|
342
350
|
fail('INPUT_UNREADABLE', 'input_path_outside_repo', {
|
|
343
351
|
input_ref: inputRef,
|
|
344
352
|
repo_root: canonicalRoot,
|
|
345
|
-
next_action:
|
|
353
|
+
next_action: outsideRepoAction(canonicalRoot, inlineFlag),
|
|
346
354
|
});
|
|
347
355
|
}
|
|
348
356
|
if (stats.size > MAX_AUTHORING_INPUT_BYTES) fail('INPUT_TOO_LARGE', 'input_size_limit_exceeded');
|
|
@@ -351,7 +359,7 @@ export async function resolveAuthoringInputPath(repoRoot, inputRef, {
|
|
|
351
359
|
fail('INPUT_UNREADABLE', 'input_path_outside_repo', {
|
|
352
360
|
input_ref: inputRef,
|
|
353
361
|
repo_root: canonicalRoot,
|
|
354
|
-
next_action:
|
|
362
|
+
next_action: outsideRepoAction(canonicalRoot, inlineFlag),
|
|
355
363
|
});
|
|
356
364
|
}
|
|
357
365
|
return {
|