claudeos-core 2.2.0 → 2.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 +1664 -907
- package/CONTRIBUTING.md +92 -92
- package/README.de.md +28 -0
- package/README.es.md +28 -0
- package/README.fr.md +28 -0
- package/README.hi.md +28 -0
- package/README.ja.md +28 -0
- package/README.ko.md +1014 -986
- package/README.md +1016 -987
- package/README.ru.md +28 -0
- package/README.vi.md +1015 -987
- package/README.zh-CN.md +28 -0
- package/bin/cli.js +152 -148
- package/bin/commands/init.js +1673 -1554
- package/bin/commands/lint.js +62 -0
- package/bin/commands/memory.js +438 -438
- package/bin/lib/cli-utils.js +206 -206
- package/claude-md-validator/index.js +184 -0
- package/claude-md-validator/reporter.js +66 -0
- package/claude-md-validator/structural-checks.js +528 -0
- package/content-validator/index.js +666 -441
- package/lib/expected-guides.js +23 -23
- package/lib/expected-outputs.js +90 -90
- package/lib/language-config.js +35 -35
- package/lib/memory-scaffold.js +1058 -1054
- package/lib/plan-parser.js +165 -165
- package/lib/staged-rules.js +118 -118
- package/manifest-generator/index.js +174 -174
- package/package.json +90 -87
- package/pass-json-validator/index.js +337 -337
- package/pass-prompts/templates/common/claude-md-scaffold.md +52 -10
- package/pass-prompts/templates/common/pass3-footer.md +402 -224
- package/pass-prompts/templates/common/pass3b-core-header.md +43 -0
- package/pass-prompts/templates/common/pass4.md +375 -305
- package/pass-prompts/templates/common/staging-override.md +26 -26
- package/pass-prompts/templates/node-vite/pass1.md +117 -117
- package/pass-prompts/templates/node-vite/pass2.md +78 -78
- package/pass-prompts/templates/python-flask/pass1.md +119 -119
- package/pass-prompts/templates/python-flask/pass2.md +85 -85
- package/plan-installer/domain-grouper.js +76 -76
- package/plan-installer/index.js +137 -137
- package/plan-installer/prompt-generator.js +188 -145
- package/plan-installer/scanners/scan-frontend.js +505 -473
- package/plan-installer/scanners/scan-java.js +226 -226
- package/plan-installer/scanners/scan-node.js +57 -57
- package/plan-installer/scanners/scan-python.js +85 -85
- package/plan-installer/stack-detector.js +482 -482
- package/plan-installer/structure-scanner.js +65 -65
- package/sync-checker/index.js +177 -177
package/README.zh-CN.md
CHANGED
|
@@ -69,6 +69,34 @@ ClaudeOS-Core 生成的文档知道你的项目使用 `ApiResponse.ok()`(而
|
|
|
69
69
|
|
|
70
70
|
---
|
|
71
71
|
|
|
72
|
+
## 生成后质量保证 (v2.3.0)
|
|
73
|
+
|
|
74
|
+
生成只解决了问题的一半。另一半是 **知道输出是正确的** —— 跨越 10 种输出语言、11 种 stack 模板、以及各种规模的项目。v2.3.0 添加了两个在生成之后运行的确定性验证器,它们不依赖 LLM 自检。
|
|
75
|
+
|
|
76
|
+
### `claude-md-validator` —— 结构不变式
|
|
77
|
+
|
|
78
|
+
每个生成的 `CLAUDE.md` 都会对照 25 个结构不变式进行检查,这些不变式只使用语言无关的信号: markdown 语法 (`^## `, `^### `)、不会被翻译的字面文件名 (`decision-log.md`, `failure-patterns.md`)、section 数量、每个 section 的子 section 数量、表格行数。同一个验证器对英语、韩语、日语、越南语、印地语、俄语、西班牙语、中文、法语、德语生成的 `CLAUDE.md` 会产出逐字节相同的判定。
|
|
79
|
+
|
|
80
|
+
跨语言保证由所有 10 种语言的测试 fixture 验证,其中 6 种语言的坏用例 fixture 会产生完全相同的错误签名。当不变式在越南语项目上失败时,修复方法与在德语项目上失败时完全相同。
|
|
81
|
+
|
|
82
|
+
### `content-validator [10/10]` —— 路径声明验证与 MANIFEST 一致性
|
|
83
|
+
|
|
84
|
+
读取所有生成的 `.md` 文件中以反引号括起的路径引用 (`src/...`, `.claude/rules/...`, `claudeos-core/skills/...`) 并对照真实文件系统进行验证。捕捉两类此前没有工具能检测的 LLM 失败:
|
|
85
|
+
|
|
86
|
+
- **`STALE_PATH`** —— 当 Pass 3 或 Pass 4 捏造出看似合理但不存在的路径时。典型例子: 实际文件是 `routePath.ts`,但因 TypeScript 常量名为 `FEATURE_ROUTE_PATH` 而推断出 `featureRoutePath.ts`; 在多入口项目中从 Vite 约定推断出 `src/main.tsx`; 项目根本没有测试,却从 MSW 文档推断出 `src/__mocks__/handlers.ts`。
|
|
87
|
+
- **`MANIFEST_DRIFT`** —— 当 `claudeos-core/skills/00.shared/MANIFEST.md` 注册了某个 skill 但 `CLAUDE.md §6` 没有提到 (或反之)。它识别出 orchestrator + sub-skills 布局 (其中 `CLAUDE.md §6` 是入口点,`MANIFEST.md` 是完整注册表),并将 sub-skills 判定为通过其父 orchestrator 间接覆盖。
|
|
88
|
+
|
|
89
|
+
验证器与 `pass3-footer.md` 和 `pass4.md` 中的 prompt 级别预防配对: 记录了具体幻觉类别 (父目录前缀、Vite/MSW/Vitest/Jest/RTL 库约定) 的 anti-pattern 块,以及在 `pass3a-facts.md` 没有具体文件名时把规则限定到目录级别的明确 positive guidance。
|
|
90
|
+
|
|
91
|
+
### 在任意项目上运行验证
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
npx claudeos-core health # 所有验证器 —— 单一 go/no-go 判定
|
|
95
|
+
npx claudeos-core lint # 仅 CLAUDE.md 结构不变式 (任意语言)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
72
100
|
## 支持的技术栈
|
|
73
101
|
|
|
74
102
|
| 技术栈 | 检测方式 | 分析深度 |
|
package/bin/cli.js
CHANGED
|
@@ -1,149 +1,153 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* ClaudeOS-Core — CLI
|
|
5
|
-
*
|
|
6
|
-
* Node.js replacement for bootstrap.sh with cross-platform support.
|
|
7
|
-
* Usage:
|
|
8
|
-
* npx claudeos-core init --lang ko ← Run 4-Pass pipeline (Korean output)
|
|
9
|
-
* npx claudeos-core init ← Interactive language selection
|
|
10
|
-
* npx claudeos-core health ← Run health checker
|
|
11
|
-
* npx claudeos-core validate ← Run plan validator (--check)
|
|
12
|
-
* npx claudeos-core restore ← Restore from Master Plan
|
|
13
|
-
* npx claudeos-core refresh ← Sync disk → Plan
|
|
14
|
-
* npx claudeos-core memory <sub> ← L4 memory (compact/score/propose-rules)
|
|
15
|
-
* npx claudeos-core --help ← Show help
|
|
16
|
-
*
|
|
17
|
-
* Also works when cloned directly:
|
|
18
|
-
* node claudeos-core-tools/bin/cli.js init
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
const path = require("path");
|
|
22
|
-
const { TOOLS_DIR, PROJECT_ROOT, log, run, readFile } = require("./lib/cli-utils");
|
|
23
|
-
const { cmdInit, InitError } = require("./commands/init");
|
|
24
|
-
const { cmdMemory } = require("./commands/memory");
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
--
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
npx claudeos-core init
|
|
74
|
-
npx claudeos-core
|
|
75
|
-
npx claudeos-core
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
//
|
|
94
|
-
// help
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ClaudeOS-Core — CLI
|
|
5
|
+
*
|
|
6
|
+
* Node.js replacement for bootstrap.sh with cross-platform support.
|
|
7
|
+
* Usage:
|
|
8
|
+
* npx claudeos-core init --lang ko ← Run 4-Pass pipeline (Korean output)
|
|
9
|
+
* npx claudeos-core init ← Interactive language selection
|
|
10
|
+
* npx claudeos-core health ← Run health checker
|
|
11
|
+
* npx claudeos-core validate ← Run plan validator (--check)
|
|
12
|
+
* npx claudeos-core restore ← Restore from Master Plan
|
|
13
|
+
* npx claudeos-core refresh ← Sync disk → Plan
|
|
14
|
+
* npx claudeos-core memory <sub> ← L4 memory (compact/score/propose-rules)
|
|
15
|
+
* npx claudeos-core --help ← Show help
|
|
16
|
+
*
|
|
17
|
+
* Also works when cloned directly:
|
|
18
|
+
* node claudeos-core-tools/bin/cli.js init
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const path = require("path");
|
|
22
|
+
const { TOOLS_DIR, PROJECT_ROOT, log, run, readFile } = require("./lib/cli-utils");
|
|
23
|
+
const { cmdInit, InitError } = require("./commands/init");
|
|
24
|
+
const { cmdMemory } = require("./commands/memory");
|
|
25
|
+
const { cmdLint } = require("./commands/lint");
|
|
26
|
+
|
|
27
|
+
// Set env var so sub-tools (plan-installer, etc.) correctly resolve the project root
|
|
28
|
+
process.env.CLAUDEOS_ROOT = PROJECT_ROOT;
|
|
29
|
+
|
|
30
|
+
// ─── Command handlers (simple — delegate to sub-tools) ───────────
|
|
31
|
+
function cmdHealth() {
|
|
32
|
+
run(`node "${path.join(TOOLS_DIR, "health-checker/index.js")}"`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function cmdValidate() {
|
|
36
|
+
run(`node "${path.join(TOOLS_DIR, "plan-validator/index.js")}" --check`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function cmdRestore() {
|
|
40
|
+
run(`node "${path.join(TOOLS_DIR, "plan-validator/index.js")}" --execute`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function cmdRefresh() {
|
|
44
|
+
run(`node "${path.join(TOOLS_DIR, "plan-validator/index.js")}" --refresh`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// ─── Help ───────────────────────────────────────────────────────
|
|
48
|
+
function showHelp() {
|
|
49
|
+
log(`
|
|
50
|
+
ClaudeOS-Core — Auto-generate Claude Code documentation from your source code.
|
|
51
|
+
|
|
52
|
+
Usage:
|
|
53
|
+
claudeos-core <command>
|
|
54
|
+
|
|
55
|
+
Commands:
|
|
56
|
+
init Run the full 4-Pass pipeline (analyze → merge → generate → memory scaffold)
|
|
57
|
+
lint Validate CLAUDE.md structure (language-invariant post-generation check)
|
|
58
|
+
health Run all verification tools (health checker)
|
|
59
|
+
validate Check Plan ↔ disk consistency
|
|
60
|
+
refresh Sync disk changes → Master Plan
|
|
61
|
+
restore Restore all files from Master Plan
|
|
62
|
+
memory <sub> L4 memory: compact | score | propose-rules
|
|
63
|
+
|
|
64
|
+
Options:
|
|
65
|
+
--lang CODE Output language for generated files (required for init)
|
|
66
|
+
Supported: en, ko, zh-CN, ja, es, vi, hi, ru, fr, de
|
|
67
|
+
If omitted, interactive selection is shown.
|
|
68
|
+
--force Skip resume prompt and start fresh (delete previous results)
|
|
69
|
+
--help Show this help message
|
|
70
|
+
--version Show version
|
|
71
|
+
|
|
72
|
+
Examples:
|
|
73
|
+
npx claudeos-core init --lang ko # Generate in Korean
|
|
74
|
+
npx claudeos-core init --lang ja # Generate in Japanese
|
|
75
|
+
npx claudeos-core init # Interactive language selection
|
|
76
|
+
npx claudeos-core lint # Validate CLAUDE.md structure (any language)
|
|
77
|
+
npx claudeos-core health # Check everything is consistent
|
|
78
|
+
npx claudeos-core restore # Recover from corrupted docs
|
|
79
|
+
`);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// ─── Argument parser ────────────────────────────────────────────
|
|
83
|
+
function parseArgs(argv) {
|
|
84
|
+
const result = { command: null, lang: null };
|
|
85
|
+
for (let i = 0; i < argv.length; i++) {
|
|
86
|
+
if (argv[i] === "--lang" && i + 1 < argv.length) {
|
|
87
|
+
result.lang = argv[++i];
|
|
88
|
+
} else if (argv[i].startsWith("--lang=")) {
|
|
89
|
+
result.lang = argv[i].split("=")[1];
|
|
90
|
+
} else if (argv[i] === "--force" || argv[i] === "-f") {
|
|
91
|
+
result.force = true;
|
|
92
|
+
} else if (argv[i] === "--help" || argv[i] === "-h") {
|
|
93
|
+
// If we already saw a command (e.g. `memory --help`), let that command
|
|
94
|
+
// handle --help itself via process.argv. Only promote --help to
|
|
95
|
+
// top-level when it appears before any command (e.g. `--help` alone or
|
|
96
|
+
// `--help memory`). This lets `memory --help` show memory's subcommand
|
|
97
|
+
// help rather than the top-level usage.
|
|
98
|
+
if (!result.command) result.command = "--help";
|
|
99
|
+
} else if (argv[i] === "--version" || argv[i] === "-v") {
|
|
100
|
+
result.command = "--version";
|
|
101
|
+
} else if (!argv[i].startsWith("-") && !result.command) {
|
|
102
|
+
result.command = argv[i];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ─── Main ───────────────────────────────────────────────────────
|
|
109
|
+
const args = process.argv.slice(2);
|
|
110
|
+
const parsedArgs = parseArgs(args);
|
|
111
|
+
const command = parsedArgs.command;
|
|
112
|
+
|
|
113
|
+
if (!command || command === "--help") {
|
|
114
|
+
showHelp();
|
|
115
|
+
process.exit(0);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (command === "--version") {
|
|
119
|
+
try {
|
|
120
|
+
const pkg = JSON.parse(
|
|
121
|
+
readFile(path.join(TOOLS_DIR, "package.json"))
|
|
122
|
+
);
|
|
123
|
+
log(`claudeos-core v${pkg.version}`);
|
|
124
|
+
} catch (e) {
|
|
125
|
+
log("claudeos-core (version unknown)");
|
|
126
|
+
}
|
|
127
|
+
process.exit(0);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const commands = {
|
|
131
|
+
init: () => cmdInit(parsedArgs),
|
|
132
|
+
lint: () => cmdLint(parsedArgs),
|
|
133
|
+
health: cmdHealth,
|
|
134
|
+
validate: cmdValidate,
|
|
135
|
+
restore: cmdRestore,
|
|
136
|
+
refresh: cmdRefresh,
|
|
137
|
+
memory: () => cmdMemory(parsedArgs),
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
if (!commands[command]) {
|
|
141
|
+
log(`Unknown command: ${command}`);
|
|
142
|
+
log('Run "claudeos-core --help" for usage.');
|
|
143
|
+
process.exit(1);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
Promise.resolve().then(() => commands[command]()).catch((e) => {
|
|
147
|
+
if (e instanceof InitError) {
|
|
148
|
+
log(`\n ❌ ${e.message}\n`);
|
|
149
|
+
} else {
|
|
150
|
+
console.error(e.message || e);
|
|
151
|
+
}
|
|
152
|
+
process.exit(1);
|
|
153
|
+
});
|