@haaaiawd/loom 1.2.1 → 1.3.1
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 +37 -0
- package/README.md +24 -22
- package/cli/bin/loom.js +83 -76
- package/cli/help/atlas.md +48 -0
- package/cli/help/capability.md +48 -3
- package/cli/help/concepts.md +2 -0
- package/cli/help/doctor.md +8 -1
- package/cli/help/expertise.md +7 -6
- package/cli/help/workflow.md +7 -2
- package/cli/src/activate.js +126 -6
- package/cli/src/atlas.js +282 -0
- package/cli/src/capability-graph.js +300 -6
- package/cli/src/diagnostics.js +108 -15
- package/cli/src/guide.js +82 -22
- package/package.json +1 -1
- package/roles/architect.md +23 -17
- package/roles/forge.md +1 -3
- package/roles/impact-reviewer.md +37 -0
- package/templates/ATLAS_TEMPLATE.html +104 -0
- package/templates/CAPABILITY_BRIEF_TEMPLATE.md +1 -0
- package/templates/CAPABILITY_GRAPH_EXAMPLE.json +188 -0
- package/templates/CAPABILITY_GRAPH_TEMPLATE.json +69 -2
- package/cli/help/preview.md +0 -60
- package/cli/src/preview-prompt.md +0 -337
- package/cli/src/preview.js +0 -73
package/cli/src/preview.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// preview — 输出提示词,让 AI 读 .loom/ 文件并生成 HTML,并检查投影新鲜度。
|
|
2
|
-
// CLI 不生成 HTML。AI 自己读文件、重组信息、生成 HTML。
|
|
3
|
-
|
|
4
|
-
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
5
|
-
import { join, relative } from 'node:path';
|
|
6
|
-
import { readCurrentPointer } from './shared/paths.js';
|
|
7
|
-
|
|
8
|
-
const PROMPT_PATH = new URL('./preview-prompt.md', import.meta.url);
|
|
9
|
-
const SOURCE_FILE_NAMES = new Set([
|
|
10
|
-
'01_VISION.md',
|
|
11
|
-
'02_ARCHITECTURE.md',
|
|
12
|
-
'04_INTENT_MAP.json',
|
|
13
|
-
'05_VERIFICATION.md',
|
|
14
|
-
'06_CHANGELOG.json',
|
|
15
|
-
'06_CHANGELOG.md',
|
|
16
|
-
]);
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 输出 preview 提示词。
|
|
20
|
-
* @returns {string}
|
|
21
|
-
*/
|
|
22
|
-
export function generatePreviewPrompt() {
|
|
23
|
-
return readFileSync(PROMPT_PATH, 'utf-8');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function shouldIncludeSource(filePath) {
|
|
27
|
-
const normalized = filePath.replace(/\\/g, '/');
|
|
28
|
-
const fileName = normalized.split('/').pop();
|
|
29
|
-
if (SOURCE_FILE_NAMES.has(fileName)) return true;
|
|
30
|
-
return normalized.includes('/00_PHILOSOPHY/')
|
|
31
|
-
|| normalized.includes('/03_DECISIONS/')
|
|
32
|
-
|| normalized.includes('/verifications/');
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function collectSourceFiles(dir, files = []) {
|
|
36
|
-
if (!existsSync(dir)) return files;
|
|
37
|
-
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
38
|
-
const fullPath = join(dir, entry.name);
|
|
39
|
-
if (entry.isDirectory()) {
|
|
40
|
-
collectSourceFiles(fullPath, files);
|
|
41
|
-
} else if (shouldIncludeSource(fullPath)) {
|
|
42
|
-
files.push(fullPath);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return files;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export function getPreviewStatus(projectDir) {
|
|
49
|
-
const previewPath = join(projectDir, 'loom-preview.html');
|
|
50
|
-
const loomRoot = join(projectDir, '.loom');
|
|
51
|
-
const current = readCurrentPointer(loomRoot);
|
|
52
|
-
const versionDir = current ? join(loomRoot, current) : null;
|
|
53
|
-
const sourceFiles = versionDir ? collectSourceFiles(versionDir) : [];
|
|
54
|
-
const latestSource = sourceFiles
|
|
55
|
-
.map((filePath) => ({ filePath, mtimeMs: statSync(filePath).mtimeMs }))
|
|
56
|
-
.sort((a, b) => b.mtimeMs - a.mtimeMs)[0] || null;
|
|
57
|
-
|
|
58
|
-
const exists = existsSync(previewPath);
|
|
59
|
-
const previewMtimeMs = exists ? statSync(previewPath).mtimeMs : null;
|
|
60
|
-
const sourceLatestMtimeMs = latestSource?.mtimeMs ?? null;
|
|
61
|
-
const fresh = exists && sourceLatestMtimeMs !== null && previewMtimeMs >= sourceLatestMtimeMs;
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
exists,
|
|
65
|
-
fresh,
|
|
66
|
-
version: current,
|
|
67
|
-
preview_path: previewPath,
|
|
68
|
-
preview_mtime: previewMtimeMs ? new Date(previewMtimeMs).toISOString() : null,
|
|
69
|
-
source_latest_mtime: sourceLatestMtimeMs ? new Date(sourceLatestMtimeMs).toISOString() : null,
|
|
70
|
-
latest_source_file: latestSource ? relative(projectDir, latestSource.filePath).replace(/\\/g, '/') : null,
|
|
71
|
-
next_command: fresh ? 'loom preview' : 'loom preview --regen',
|
|
72
|
-
};
|
|
73
|
-
}
|