@bonesofspring/ai-rules 0.2.66 → 0.2.67
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/CHANGELOG.md +22 -0
- package/README.md +2 -0
- package/bin/cli.js +9 -1
- package/bin/lib/engine-scripts.js +0 -4
- package/bin/lib/seed-ai-local-team.js +26 -0
- package/docs/OPENCODE-COMPATIBILITY.md +1 -0
- package/docs/OPENCODE.md +14 -1
- package/docs/TEAM-DB.md +2 -1
- package/docs/TOKEN-ECONOMY.md +32 -1
- package/docs/openapi/team-db.v1.json +5 -5
- package/package.json +10 -2
- package/presets/_shared/ai-local/scripts/dump-output.mjs +63 -12
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +3 -3
- package/presets/_shared/ai-local/scripts/team-db-tracker.mjs +2 -0
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +9 -2
- package/presets/_shared/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/android-kotlin/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/go/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/go/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/ios-swift/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/java/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/java/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/mcp-ts/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/mol/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/mol/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/next/agents/ci-investigator.md +5 -2
- package/presets/claude/next/agents/debugger.md +5 -2
- package/presets/claude/next/agents/feature-developer.md +5 -2
- package/presets/claude/next/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/next/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/next/rules/architecture/feature-delivery-workflow.md +4 -0
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/nuxt/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/php-hexagonal/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/php-laravel/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/svelte/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/svelte/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/android-kotlin/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/go/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/go/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/ios-swift/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/java/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/java/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/mcp-ts/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/mol/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/mol/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/next/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/next/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/next/rules/feature-delivery-workflow.mdc +4 -0
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/nuxt/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/php-hexagonal/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/php-laravel/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/svelte/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/android-kotlin/adapter-map.json +1 -1
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/android-kotlin/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/go/adapter-map.json +1 -1
- package/presets/mavis/go/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/go/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/ios-swift/adapter-map.json +1 -1
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/ios-swift/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/java/adapter-map.json +1 -1
- package/presets/mavis/java/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/java/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/mcp-ts/adapter-map.json +1 -1
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/mcp-ts/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/mol/adapter-map.json +1 -1
- package/presets/mavis/mol/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/mol/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/next/adapter-map.json +1 -1
- package/presets/mavis/next/agents/ci-investigator.md +5 -2
- package/presets/mavis/next/agents/debugger.md +5 -2
- package/presets/mavis/next/agents/feature-developer.md +5 -2
- package/presets/mavis/next/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/next/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/next/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/nuxt/adapter-map.json +1 -1
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/nuxt/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/php-hexagonal/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/php-laravel/adapter-map.json +1 -1
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/php-laravel/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/svelte/adapter-map.json +1 -1
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/svelte/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/android-kotlin/adapter-map.json +1 -1
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/android-kotlin/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/go/adapter-map.json +1 -1
- package/presets/opencode/go/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/go/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/ios-swift/adapter-map.json +1 -1
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/ios-swift/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/java/adapter-map.json +1 -1
- package/presets/opencode/java/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/java/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/mcp-ts/adapter-map.json +1 -1
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/mcp-ts/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/mol/adapter-map.json +1 -1
- package/presets/opencode/mol/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/mol/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/next/adapter-map.json +1 -1
- package/presets/opencode/next/agents/ci-investigator.md +5 -2
- package/presets/opencode/next/agents/debugger.md +5 -2
- package/presets/opencode/next/agents/feature-developer.md +5 -2
- package/presets/opencode/next/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/next/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/next/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/nuxt/adapter-map.json +1 -1
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/nuxt/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/php-hexagonal/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/php-laravel/adapter-map.json +1 -1
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/php-laravel/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/plugins/output-guard/README.md +43 -0
- package/presets/opencode/plugins/output-guard/index.ts +300 -0
- package/presets/opencode/plugins/output-guard/package.json +9 -0
- package/presets/opencode/plugins/output-guard/rewrite.ts +149 -0
- package/presets/opencode/plugins/task-status/task-view.ts +58 -20
- package/presets/opencode/plugins/task-status/tui.tsx +5 -3
- package/presets/opencode/svelte/adapter-map.json +1 -1
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/svelte/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/android-kotlin/adapter-map.json +1 -1
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/android-kotlin/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/go/adapter-map.json +1 -1
- package/presets/zcode/go/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/go/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/ios-swift/adapter-map.json +1 -1
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/ios-swift/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/java/adapter-map.json +1 -1
- package/presets/zcode/java/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/java/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/mcp-ts/adapter-map.json +1 -1
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/mcp-ts/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/mol/adapter-map.json +1 -1
- package/presets/zcode/mol/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/mol/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/next/adapter-map.json +1 -1
- package/presets/zcode/next/agents/ci-investigator.md +5 -2
- package/presets/zcode/next/agents/debugger.md +5 -2
- package/presets/zcode/next/agents/feature-developer.md +5 -2
- package/presets/zcode/next/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/next/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/next/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/nuxt/adapter-map.json +1 -1
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/nuxt/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/php-hexagonal/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/php-laravel/adapter-map.json +1 -1
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/php-laravel/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/svelte/adapter-map.json +1 -1
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/svelte/hooks/list-ai-local.mjs +17 -0
- package/scripts/report-context-cost.mjs +432 -0
|
@@ -1301,11 +1301,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
|
|
|
1301
1301
|
}
|
|
1302
1302
|
} catch {}
|
|
1303
1303
|
}
|
|
1304
|
+
// Five entries is enough to resume; a longer list is a status dump, not a
|
|
1305
|
+
// pointer. The line budget below still bounds a single entry with many paths.
|
|
1306
|
+
const MAX_FOCUS_ENTRIES = 5;
|
|
1307
|
+
const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
|
|
1304
1308
|
const pathLines = [];
|
|
1305
1309
|
if (incomplete.length === 0) pathLines.push(' - (none)');
|
|
1306
1310
|
else {
|
|
1307
|
-
for (let index = 0; index <
|
|
1308
|
-
const item =
|
|
1311
|
+
for (let index = 0; index < shownIncomplete.length; index += 1) {
|
|
1312
|
+
const item = shownIncomplete[index];
|
|
1309
1313
|
if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
|
|
1310
1314
|
else {
|
|
1311
1315
|
for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
|
|
@@ -1313,6 +1317,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
|
|
|
1313
1317
|
}
|
|
1314
1318
|
}
|
|
1315
1319
|
}
|
|
1320
|
+
if (incomplete.length > shownIncomplete.length) {
|
|
1321
|
+
pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
|
|
1322
|
+
}
|
|
1316
1323
|
}
|
|
1317
1324
|
let readyLine = '- decomposition ready set: (none)';
|
|
1318
1325
|
try {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import fs from 'node:fs';
|
|
16
16
|
import path from 'node:path';
|
|
17
|
+
import crypto from 'node:crypto';
|
|
17
18
|
import { fileURLToPath } from 'node:url';
|
|
18
19
|
|
|
19
20
|
export const OUTPUT_CAP = 4096;
|
|
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
|
|
|
29
30
|
}
|
|
30
31
|
};
|
|
31
32
|
|
|
33
|
+
/** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
|
|
34
|
+
const shortHash = (file) => {
|
|
35
|
+
try {
|
|
36
|
+
return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
|
|
37
|
+
} catch {
|
|
38
|
+
return '????????';
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
32
42
|
const insideRoot = (root, abs) => {
|
|
33
43
|
const relative = path.relative(root, abs);
|
|
34
44
|
return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
|
|
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
|
|
|
168
178
|
}
|
|
169
179
|
if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
|
|
170
180
|
const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
|
|
181
|
+
const readSet = new Set(read);
|
|
182
|
+
if (readSet.size > 0) {
|
|
183
|
+
lines.push('hashes:');
|
|
184
|
+
for (const file of [...readSet].sort()) {
|
|
185
|
+
lines.push(`${file} ${shortHash(path.join(root, file))}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
171
188
|
return {
|
|
172
189
|
text: lines.join('\n'),
|
|
173
190
|
chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),
|
|
@@ -1300,11 +1300,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
|
|
|
1300
1300
|
}
|
|
1301
1301
|
} catch {}
|
|
1302
1302
|
}
|
|
1303
|
+
// Five entries is enough to resume; a longer list is a status dump, not a
|
|
1304
|
+
// pointer. The line budget below still bounds a single entry with many paths.
|
|
1305
|
+
const MAX_FOCUS_ENTRIES = 5;
|
|
1306
|
+
const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
|
|
1303
1307
|
const pathLines = [];
|
|
1304
1308
|
if (incomplete.length === 0) pathLines.push(' - (none)');
|
|
1305
1309
|
else {
|
|
1306
|
-
for (let index = 0; index <
|
|
1307
|
-
const item =
|
|
1310
|
+
for (let index = 0; index < shownIncomplete.length; index += 1) {
|
|
1311
|
+
const item = shownIncomplete[index];
|
|
1308
1312
|
if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
|
|
1309
1313
|
else {
|
|
1310
1314
|
for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
|
|
@@ -1312,6 +1316,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
|
|
|
1312
1316
|
}
|
|
1313
1317
|
}
|
|
1314
1318
|
}
|
|
1319
|
+
if (incomplete.length > shownIncomplete.length) {
|
|
1320
|
+
pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
|
|
1321
|
+
}
|
|
1315
1322
|
}
|
|
1316
1323
|
let readyLine = '- decomposition ready set: (none)';
|
|
1317
1324
|
try {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import fs from 'node:fs';
|
|
16
16
|
import path from 'node:path';
|
|
17
|
+
import crypto from 'node:crypto';
|
|
17
18
|
import { fileURLToPath } from 'node:url';
|
|
18
19
|
|
|
19
20
|
export const OUTPUT_CAP = 4096;
|
|
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
|
|
|
29
30
|
}
|
|
30
31
|
};
|
|
31
32
|
|
|
33
|
+
/** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
|
|
34
|
+
const shortHash = (file) => {
|
|
35
|
+
try {
|
|
36
|
+
return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
|
|
37
|
+
} catch {
|
|
38
|
+
return '????????';
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
32
42
|
const insideRoot = (root, abs) => {
|
|
33
43
|
const relative = path.relative(root, abs);
|
|
34
44
|
return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
|
|
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
|
|
|
168
178
|
}
|
|
169
179
|
if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
|
|
170
180
|
const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
|
|
181
|
+
const readSet = new Set(read);
|
|
182
|
+
if (readSet.size > 0) {
|
|
183
|
+
lines.push('hashes:');
|
|
184
|
+
for (const file of [...readSet].sort()) {
|
|
185
|
+
lines.push(`${file} ${shortHash(path.join(root, file))}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
171
188
|
return {
|
|
172
189
|
text: lines.join('\n'),
|
|
173
190
|
chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),
|
|
@@ -1288,11 +1288,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
|
|
|
1288
1288
|
}
|
|
1289
1289
|
} catch {}
|
|
1290
1290
|
}
|
|
1291
|
+
// Five entries is enough to resume; a longer list is a status dump, not a
|
|
1292
|
+
// pointer. The line budget below still bounds a single entry with many paths.
|
|
1293
|
+
const MAX_FOCUS_ENTRIES = 5;
|
|
1294
|
+
const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
|
|
1291
1295
|
const pathLines = [];
|
|
1292
1296
|
if (incomplete.length === 0) pathLines.push(' - (none)');
|
|
1293
1297
|
else {
|
|
1294
|
-
for (let index = 0; index <
|
|
1295
|
-
const item =
|
|
1298
|
+
for (let index = 0; index < shownIncomplete.length; index += 1) {
|
|
1299
|
+
const item = shownIncomplete[index];
|
|
1296
1300
|
if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
|
|
1297
1301
|
else {
|
|
1298
1302
|
for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
|
|
@@ -1300,6 +1304,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
|
|
|
1300
1304
|
}
|
|
1301
1305
|
}
|
|
1302
1306
|
}
|
|
1307
|
+
if (incomplete.length > shownIncomplete.length) {
|
|
1308
|
+
pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
|
|
1309
|
+
}
|
|
1303
1310
|
}
|
|
1304
1311
|
let readyLine = '- decomposition ready set: (none)';
|
|
1305
1312
|
try {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import fs from 'node:fs';
|
|
16
16
|
import path from 'node:path';
|
|
17
|
+
import crypto from 'node:crypto';
|
|
17
18
|
import { fileURLToPath } from 'node:url';
|
|
18
19
|
|
|
19
20
|
export const OUTPUT_CAP = 4096;
|
|
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
|
|
|
29
30
|
}
|
|
30
31
|
};
|
|
31
32
|
|
|
33
|
+
/** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
|
|
34
|
+
const shortHash = (file) => {
|
|
35
|
+
try {
|
|
36
|
+
return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
|
|
37
|
+
} catch {
|
|
38
|
+
return '????????';
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
32
42
|
const insideRoot = (root, abs) => {
|
|
33
43
|
const relative = path.relative(root, abs);
|
|
34
44
|
return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
|
|
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
|
|
|
168
178
|
}
|
|
169
179
|
if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
|
|
170
180
|
const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
|
|
181
|
+
const readSet = new Set(read);
|
|
182
|
+
if (readSet.size > 0) {
|
|
183
|
+
lines.push('hashes:');
|
|
184
|
+
for (const file of [...readSet].sort()) {
|
|
185
|
+
lines.push(`${file} ${shortHash(path.join(root, file))}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
171
188
|
return {
|
|
172
189
|
text: lines.join('\n'),
|
|
173
190
|
chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),
|
|
@@ -1301,11 +1301,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
|
|
|
1301
1301
|
}
|
|
1302
1302
|
} catch {}
|
|
1303
1303
|
}
|
|
1304
|
+
// Five entries is enough to resume; a longer list is a status dump, not a
|
|
1305
|
+
// pointer. The line budget below still bounds a single entry with many paths.
|
|
1306
|
+
const MAX_FOCUS_ENTRIES = 5;
|
|
1307
|
+
const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
|
|
1304
1308
|
const pathLines = [];
|
|
1305
1309
|
if (incomplete.length === 0) pathLines.push(' - (none)');
|
|
1306
1310
|
else {
|
|
1307
|
-
for (let index = 0; index <
|
|
1308
|
-
const item =
|
|
1311
|
+
for (let index = 0; index < shownIncomplete.length; index += 1) {
|
|
1312
|
+
const item = shownIncomplete[index];
|
|
1309
1313
|
if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
|
|
1310
1314
|
else {
|
|
1311
1315
|
for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
|
|
@@ -1313,6 +1317,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
|
|
|
1313
1317
|
}
|
|
1314
1318
|
}
|
|
1315
1319
|
}
|
|
1320
|
+
if (incomplete.length > shownIncomplete.length) {
|
|
1321
|
+
pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
|
|
1322
|
+
}
|
|
1316
1323
|
}
|
|
1317
1324
|
let readyLine = '- decomposition ready set: (none)';
|
|
1318
1325
|
try {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import fs from 'node:fs';
|
|
16
16
|
import path from 'node:path';
|
|
17
|
+
import crypto from 'node:crypto';
|
|
17
18
|
import { fileURLToPath } from 'node:url';
|
|
18
19
|
|
|
19
20
|
export const OUTPUT_CAP = 4096;
|
|
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
|
|
|
29
30
|
}
|
|
30
31
|
};
|
|
31
32
|
|
|
33
|
+
/** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
|
|
34
|
+
const shortHash = (file) => {
|
|
35
|
+
try {
|
|
36
|
+
return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
|
|
37
|
+
} catch {
|
|
38
|
+
return '????????';
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
32
42
|
const insideRoot = (root, abs) => {
|
|
33
43
|
const relative = path.relative(root, abs);
|
|
34
44
|
return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
|
|
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
|
|
|
168
178
|
}
|
|
169
179
|
if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
|
|
170
180
|
const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
|
|
181
|
+
const readSet = new Set(read);
|
|
182
|
+
if (readSet.size > 0) {
|
|
183
|
+
lines.push('hashes:');
|
|
184
|
+
for (const file of [...readSet].sort()) {
|
|
185
|
+
lines.push(`${file} ${shortHash(path.join(root, file))}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
171
188
|
return {
|
|
172
189
|
text: lines.join('\n'),
|
|
173
190
|
chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),
|
|
@@ -14,10 +14,13 @@ This subagent does **not** inherit the parent session context or `CLAUDE.md`. Re
|
|
|
14
14
|
- `.claude/rules/tooling-and-review/ai-local-overlay.md`
|
|
15
15
|
- `.claude/rules/architecture/architecture-boundaries.md` — layer boundaries and allowed imports
|
|
16
16
|
- `.claude/rules/architecture/feature-delivery-workflow.md` — layer order, mockup gate, ux-design gate
|
|
17
|
-
- `.claude/rules/architecture/reference-features.md` — analog files first
|
|
18
|
-
- `.claude/rules/tooling-and-review/anti-sycophancy-discipline.md` — procedural anti-sycophancy rules
|
|
19
17
|
- `.claude/rules/tooling-and-review/anti-hallucination-contract.md` — do not invent signatures, imports, schemas, or evidence
|
|
20
18
|
- `.claude/rules/tooling-and-review/post-change-lint.md` — lint/type-check after code edits
|
|
19
|
+
|
|
20
|
+
Read when the task reaches the matching zone:
|
|
21
|
+
|
|
22
|
+
- `.claude/rules/architecture/reference-features.md` — analog files first
|
|
23
|
+
- `.claude/rules/tooling-and-review/anti-sycophancy-discipline.md` — procedural anti-sycophancy rules
|
|
21
24
|
- `.claude/rules/tooling-and-review/mcp-usage.md` — when verifying third-party APIs (Context7)
|
|
22
25
|
- `.claude/rules/architecture/public-imports.md` — @/types, @/api barrels
|
|
23
26
|
- `.claude/rules/ui-and-accessibility/react-ui.md` — UI component style (no FC, no spread, decomposition)
|
|
@@ -14,10 +14,13 @@ This subagent does **not** inherit the parent session context or `CLAUDE.md`. Re
|
|
|
14
14
|
- `.claude/rules/tooling-and-review/ai-local-overlay.md`
|
|
15
15
|
- `.claude/rules/architecture/architecture-boundaries.md` — layer boundaries and allowed imports
|
|
16
16
|
- `.claude/rules/architecture/feature-delivery-workflow.md` — layer order, mockup gate, ux-design gate
|
|
17
|
-
- `.claude/rules/architecture/reference-features.md` — analog files first
|
|
18
|
-
- `.claude/rules/tooling-and-review/anti-sycophancy-discipline.md` — procedural anti-sycophancy rules
|
|
19
17
|
- `.claude/rules/tooling-and-review/anti-hallucination-contract.md` — do not invent signatures, imports, schemas, or evidence
|
|
20
18
|
- `.claude/rules/tooling-and-review/post-change-lint.md` — lint/type-check after code edits
|
|
19
|
+
|
|
20
|
+
Read when the task reaches the matching zone:
|
|
21
|
+
|
|
22
|
+
- `.claude/rules/architecture/reference-features.md` — analog files first
|
|
23
|
+
- `.claude/rules/tooling-and-review/anti-sycophancy-discipline.md` — procedural anti-sycophancy rules
|
|
21
24
|
- `.claude/rules/tooling-and-review/mcp-usage.md` — when verifying third-party APIs (Context7)
|
|
22
25
|
- `.claude/rules/architecture/public-imports.md` — @/types, @/api barrels
|
|
23
26
|
- `.claude/rules/ui-and-accessibility/react-ui.md` — UI component style (no FC, no spread, decomposition)
|
|
@@ -14,10 +14,13 @@ This subagent does **not** inherit the parent session context or `CLAUDE.md`. Re
|
|
|
14
14
|
- `.claude/rules/tooling-and-review/ai-local-overlay.md`
|
|
15
15
|
- `.claude/rules/architecture/architecture-boundaries.md` — layer boundaries and allowed imports
|
|
16
16
|
- `.claude/rules/architecture/feature-delivery-workflow.md` — layer order, mockup gate, ux-design gate
|
|
17
|
-
- `.claude/rules/architecture/reference-features.md` — analog files first
|
|
18
|
-
- `.claude/rules/tooling-and-review/anti-sycophancy-discipline.md` — procedural anti-sycophancy rules
|
|
19
17
|
- `.claude/rules/tooling-and-review/anti-hallucination-contract.md` — do not invent signatures, imports, schemas, or evidence
|
|
20
18
|
- `.claude/rules/tooling-and-review/post-change-lint.md` — lint/type-check after code edits
|
|
19
|
+
|
|
20
|
+
Read when the task reaches the matching zone:
|
|
21
|
+
|
|
22
|
+
- `.claude/rules/architecture/reference-features.md` — analog files first
|
|
23
|
+
- `.claude/rules/tooling-and-review/anti-sycophancy-discipline.md` — procedural anti-sycophancy rules
|
|
21
24
|
- `.claude/rules/tooling-and-review/mcp-usage.md` — when verifying third-party APIs (Context7)
|
|
22
25
|
- `.claude/rules/architecture/public-imports.md` — @/types, @/api barrels
|
|
23
26
|
- `.claude/rules/ui-and-accessibility/react-ui.md` — UI component style (no FC, no spread, decomposition)
|
|
@@ -1301,11 +1301,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
|
|
|
1301
1301
|
}
|
|
1302
1302
|
} catch {}
|
|
1303
1303
|
}
|
|
1304
|
+
// Five entries is enough to resume; a longer list is a status dump, not a
|
|
1305
|
+
// pointer. The line budget below still bounds a single entry with many paths.
|
|
1306
|
+
const MAX_FOCUS_ENTRIES = 5;
|
|
1307
|
+
const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
|
|
1304
1308
|
const pathLines = [];
|
|
1305
1309
|
if (incomplete.length === 0) pathLines.push(' - (none)');
|
|
1306
1310
|
else {
|
|
1307
|
-
for (let index = 0; index <
|
|
1308
|
-
const item =
|
|
1311
|
+
for (let index = 0; index < shownIncomplete.length; index += 1) {
|
|
1312
|
+
const item = shownIncomplete[index];
|
|
1309
1313
|
if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
|
|
1310
1314
|
else {
|
|
1311
1315
|
for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
|
|
@@ -1313,6 +1317,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
|
|
|
1313
1317
|
}
|
|
1314
1318
|
}
|
|
1315
1319
|
}
|
|
1320
|
+
if (incomplete.length > shownIncomplete.length) {
|
|
1321
|
+
pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
|
|
1322
|
+
}
|
|
1316
1323
|
}
|
|
1317
1324
|
let readyLine = '- decomposition ready set: (none)';
|
|
1318
1325
|
try {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import fs from 'node:fs';
|
|
16
16
|
import path from 'node:path';
|
|
17
|
+
import crypto from 'node:crypto';
|
|
17
18
|
import { fileURLToPath } from 'node:url';
|
|
18
19
|
|
|
19
20
|
export const OUTPUT_CAP = 4096;
|
|
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
|
|
|
29
30
|
}
|
|
30
31
|
};
|
|
31
32
|
|
|
33
|
+
/** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
|
|
34
|
+
const shortHash = (file) => {
|
|
35
|
+
try {
|
|
36
|
+
return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
|
|
37
|
+
} catch {
|
|
38
|
+
return '????????';
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
32
42
|
const insideRoot = (root, abs) => {
|
|
33
43
|
const relative = path.relative(root, abs);
|
|
34
44
|
return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
|
|
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
|
|
|
168
178
|
}
|
|
169
179
|
if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
|
|
170
180
|
const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
|
|
181
|
+
const readSet = new Set(read);
|
|
182
|
+
if (readSet.size > 0) {
|
|
183
|
+
lines.push('hashes:');
|
|
184
|
+
for (const file of [...readSet].sort()) {
|
|
185
|
+
lines.push(`${file} ${shortHash(path.join(root, file))}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
171
188
|
return {
|
|
172
189
|
text: lines.join('\n'),
|
|
173
190
|
chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),
|
|
@@ -107,6 +107,10 @@ Typical feature with backend data and shared state. Layer details — `architect
|
|
|
107
107
|
8. **Tests** — unit for mappers (`testing/tests-unit.md`); e2e from `*.cases.md` (`testing/tests-e2e-structure.md`, `testing/playwright-agents.md`).
|
|
108
108
|
9. **Completion** — **`tooling-and-review/post-change-lint.md`**: `lint:js` + `lint:css` + `type-check`; package manager — `tooling-and-review/package-manager.md`. When the current WP spans **more than one** layer or module, `implementation.md` includes a **Code Map** (3–8 annotated paths) and **Suggested Review Order** (`concern | path:line | ≤15 word note`). Omit both for a single-file or single-layer WP.
|
|
109
109
|
|
|
110
|
+
## Context hygiene
|
|
111
|
+
|
|
112
|
+
A command whose output can exceed ~4 KB — a test run, a build/lint log, `git log`, a diff — is piped through `.ai.local/scripts/dump-output.mjs --task <slug>` instead of being read whole. Work from its ≤40-line head and the stored file (`grep -n` or `team-db.mjs search`), and record the repo-relative `outputs/…` path in `implementation.md` or `validation-report.md` when it informed a decision. Do not read the whole output into context.
|
|
113
|
+
|
|
110
114
|
## Data flow (orientation)
|
|
111
115
|
|
|
112
116
|
```mermaid
|
|
@@ -1301,11 +1301,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
|
|
|
1301
1301
|
}
|
|
1302
1302
|
} catch {}
|
|
1303
1303
|
}
|
|
1304
|
+
// Five entries is enough to resume; a longer list is a status dump, not a
|
|
1305
|
+
// pointer. The line budget below still bounds a single entry with many paths.
|
|
1306
|
+
const MAX_FOCUS_ENTRIES = 5;
|
|
1307
|
+
const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
|
|
1304
1308
|
const pathLines = [];
|
|
1305
1309
|
if (incomplete.length === 0) pathLines.push(' - (none)');
|
|
1306
1310
|
else {
|
|
1307
|
-
for (let index = 0; index <
|
|
1308
|
-
const item =
|
|
1311
|
+
for (let index = 0; index < shownIncomplete.length; index += 1) {
|
|
1312
|
+
const item = shownIncomplete[index];
|
|
1309
1313
|
if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
|
|
1310
1314
|
else {
|
|
1311
1315
|
for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
|
|
@@ -1313,6 +1317,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
|
|
|
1313
1317
|
}
|
|
1314
1318
|
}
|
|
1315
1319
|
}
|
|
1320
|
+
if (incomplete.length > shownIncomplete.length) {
|
|
1321
|
+
pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
|
|
1322
|
+
}
|
|
1316
1323
|
}
|
|
1317
1324
|
let readyLine = '- decomposition ready set: (none)';
|
|
1318
1325
|
try {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import fs from 'node:fs';
|
|
16
16
|
import path from 'node:path';
|
|
17
|
+
import crypto from 'node:crypto';
|
|
17
18
|
import { fileURLToPath } from 'node:url';
|
|
18
19
|
|
|
19
20
|
export const OUTPUT_CAP = 4096;
|
|
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
|
|
|
29
30
|
}
|
|
30
31
|
};
|
|
31
32
|
|
|
33
|
+
/** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
|
|
34
|
+
const shortHash = (file) => {
|
|
35
|
+
try {
|
|
36
|
+
return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
|
|
37
|
+
} catch {
|
|
38
|
+
return '????????';
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
32
42
|
const insideRoot = (root, abs) => {
|
|
33
43
|
const relative = path.relative(root, abs);
|
|
34
44
|
return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
|
|
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
|
|
|
168
178
|
}
|
|
169
179
|
if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
|
|
170
180
|
const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
|
|
181
|
+
const readSet = new Set(read);
|
|
182
|
+
if (readSet.size > 0) {
|
|
183
|
+
lines.push('hashes:');
|
|
184
|
+
for (const file of [...readSet].sort()) {
|
|
185
|
+
lines.push(`${file} ${shortHash(path.join(root, file))}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
171
188
|
return {
|
|
172
189
|
text: lines.join('\n'),
|
|
173
190
|
chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),
|
|
@@ -1301,11 +1301,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
|
|
|
1301
1301
|
}
|
|
1302
1302
|
} catch {}
|
|
1303
1303
|
}
|
|
1304
|
+
// Five entries is enough to resume; a longer list is a status dump, not a
|
|
1305
|
+
// pointer. The line budget below still bounds a single entry with many paths.
|
|
1306
|
+
const MAX_FOCUS_ENTRIES = 5;
|
|
1307
|
+
const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
|
|
1304
1308
|
const pathLines = [];
|
|
1305
1309
|
if (incomplete.length === 0) pathLines.push(' - (none)');
|
|
1306
1310
|
else {
|
|
1307
|
-
for (let index = 0; index <
|
|
1308
|
-
const item =
|
|
1311
|
+
for (let index = 0; index < shownIncomplete.length; index += 1) {
|
|
1312
|
+
const item = shownIncomplete[index];
|
|
1309
1313
|
if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
|
|
1310
1314
|
else {
|
|
1311
1315
|
for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
|
|
@@ -1313,6 +1317,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
|
|
|
1313
1317
|
}
|
|
1314
1318
|
}
|
|
1315
1319
|
}
|
|
1320
|
+
if (incomplete.length > shownIncomplete.length) {
|
|
1321
|
+
pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
|
|
1322
|
+
}
|
|
1316
1323
|
}
|
|
1317
1324
|
let readyLine = '- decomposition ready set: (none)';
|
|
1318
1325
|
try {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import fs from 'node:fs';
|
|
16
16
|
import path from 'node:path';
|
|
17
|
+
import crypto from 'node:crypto';
|
|
17
18
|
import { fileURLToPath } from 'node:url';
|
|
18
19
|
|
|
19
20
|
export const OUTPUT_CAP = 4096;
|
|
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
|
|
|
29
30
|
}
|
|
30
31
|
};
|
|
31
32
|
|
|
33
|
+
/** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
|
|
34
|
+
const shortHash = (file) => {
|
|
35
|
+
try {
|
|
36
|
+
return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
|
|
37
|
+
} catch {
|
|
38
|
+
return '????????';
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
32
42
|
const insideRoot = (root, abs) => {
|
|
33
43
|
const relative = path.relative(root, abs);
|
|
34
44
|
return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
|
|
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
|
|
|
168
178
|
}
|
|
169
179
|
if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
|
|
170
180
|
const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
|
|
181
|
+
const readSet = new Set(read);
|
|
182
|
+
if (readSet.size > 0) {
|
|
183
|
+
lines.push('hashes:');
|
|
184
|
+
for (const file of [...readSet].sort()) {
|
|
185
|
+
lines.push(`${file} ${shortHash(path.join(root, file))}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
171
188
|
return {
|
|
172
189
|
text: lines.join('\n'),
|
|
173
190
|
chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),
|
|
@@ -1301,11 +1301,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
|
|
|
1301
1301
|
}
|
|
1302
1302
|
} catch {}
|
|
1303
1303
|
}
|
|
1304
|
+
// Five entries is enough to resume; a longer list is a status dump, not a
|
|
1305
|
+
// pointer. The line budget below still bounds a single entry with many paths.
|
|
1306
|
+
const MAX_FOCUS_ENTRIES = 5;
|
|
1307
|
+
const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
|
|
1304
1308
|
const pathLines = [];
|
|
1305
1309
|
if (incomplete.length === 0) pathLines.push(' - (none)');
|
|
1306
1310
|
else {
|
|
1307
|
-
for (let index = 0; index <
|
|
1308
|
-
const item =
|
|
1311
|
+
for (let index = 0; index < shownIncomplete.length; index += 1) {
|
|
1312
|
+
const item = shownIncomplete[index];
|
|
1309
1313
|
if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
|
|
1310
1314
|
else {
|
|
1311
1315
|
for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
|
|
@@ -1313,6 +1317,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
|
|
|
1313
1317
|
}
|
|
1314
1318
|
}
|
|
1315
1319
|
}
|
|
1320
|
+
if (incomplete.length > shownIncomplete.length) {
|
|
1321
|
+
pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
|
|
1322
|
+
}
|
|
1316
1323
|
}
|
|
1317
1324
|
let readyLine = '- decomposition ready set: (none)';
|
|
1318
1325
|
try {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import fs from 'node:fs';
|
|
16
16
|
import path from 'node:path';
|
|
17
|
+
import crypto from 'node:crypto';
|
|
17
18
|
import { fileURLToPath } from 'node:url';
|
|
18
19
|
|
|
19
20
|
export const OUTPUT_CAP = 4096;
|
|
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
|
|
|
29
30
|
}
|
|
30
31
|
};
|
|
31
32
|
|
|
33
|
+
/** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
|
|
34
|
+
const shortHash = (file) => {
|
|
35
|
+
try {
|
|
36
|
+
return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
|
|
37
|
+
} catch {
|
|
38
|
+
return '????????';
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
32
42
|
const insideRoot = (root, abs) => {
|
|
33
43
|
const relative = path.relative(root, abs);
|
|
34
44
|
return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
|
|
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
|
|
|
168
178
|
}
|
|
169
179
|
if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
|
|
170
180
|
const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
|
|
181
|
+
const readSet = new Set(read);
|
|
182
|
+
if (readSet.size > 0) {
|
|
183
|
+
lines.push('hashes:');
|
|
184
|
+
for (const file of [...readSet].sort()) {
|
|
185
|
+
lines.push(`${file} ${shortHash(path.join(root, file))}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
171
188
|
return {
|
|
172
189
|
text: lines.join('\n'),
|
|
173
190
|
chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),
|
|
@@ -1301,11 +1301,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
|
|
|
1301
1301
|
}
|
|
1302
1302
|
} catch {}
|
|
1303
1303
|
}
|
|
1304
|
+
// Five entries is enough to resume; a longer list is a status dump, not a
|
|
1305
|
+
// pointer. The line budget below still bounds a single entry with many paths.
|
|
1306
|
+
const MAX_FOCUS_ENTRIES = 5;
|
|
1307
|
+
const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
|
|
1304
1308
|
const pathLines = [];
|
|
1305
1309
|
if (incomplete.length === 0) pathLines.push(' - (none)');
|
|
1306
1310
|
else {
|
|
1307
|
-
for (let index = 0; index <
|
|
1308
|
-
const item =
|
|
1311
|
+
for (let index = 0; index < shownIncomplete.length; index += 1) {
|
|
1312
|
+
const item = shownIncomplete[index];
|
|
1309
1313
|
if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
|
|
1310
1314
|
else {
|
|
1311
1315
|
for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
|
|
@@ -1313,6 +1317,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
|
|
|
1313
1317
|
}
|
|
1314
1318
|
}
|
|
1315
1319
|
}
|
|
1320
|
+
if (incomplete.length > shownIncomplete.length) {
|
|
1321
|
+
pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
|
|
1322
|
+
}
|
|
1316
1323
|
}
|
|
1317
1324
|
let readyLine = '- decomposition ready set: (none)';
|
|
1318
1325
|
try {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import fs from 'node:fs';
|
|
16
16
|
import path from 'node:path';
|
|
17
|
+
import crypto from 'node:crypto';
|
|
17
18
|
import { fileURLToPath } from 'node:url';
|
|
18
19
|
|
|
19
20
|
export const OUTPUT_CAP = 4096;
|
|
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
|
|
|
29
30
|
}
|
|
30
31
|
};
|
|
31
32
|
|
|
33
|
+
/** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
|
|
34
|
+
const shortHash = (file) => {
|
|
35
|
+
try {
|
|
36
|
+
return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
|
|
37
|
+
} catch {
|
|
38
|
+
return '????????';
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
32
42
|
const insideRoot = (root, abs) => {
|
|
33
43
|
const relative = path.relative(root, abs);
|
|
34
44
|
return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
|
|
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
|
|
|
168
178
|
}
|
|
169
179
|
if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
|
|
170
180
|
const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
|
|
181
|
+
const readSet = new Set(read);
|
|
182
|
+
if (readSet.size > 0) {
|
|
183
|
+
lines.push('hashes:');
|
|
184
|
+
for (const file of [...readSet].sort()) {
|
|
185
|
+
lines.push(`${file} ${shortHash(path.join(root, file))}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
171
188
|
return {
|
|
172
189
|
text: lines.join('\n'),
|
|
173
190
|
chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),
|