claudeos-core 1.3.0 → 1.4.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.

Potentially problematic release.


This version of claudeos-core might be problematic. Click here for more details.

Files changed (34) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.de.md +75 -27
  3. package/README.es.md +75 -27
  4. package/README.fr.md +75 -27
  5. package/README.hi.md +76 -28
  6. package/README.ja.md +94 -28
  7. package/README.ko.md +94 -28
  8. package/README.md +93 -26
  9. package/README.ru.md +75 -27
  10. package/README.vi.md +75 -27
  11. package/README.zh-CN.md +76 -28
  12. package/bin/cli.js +38 -10
  13. package/bootstrap.sh +13 -2
  14. package/content-validator/index.js +18 -13
  15. package/manifest-generator/index.js +24 -1
  16. package/package.json +1 -1
  17. package/pass-prompts/templates/java-spring/pass1.md +1 -1
  18. package/pass-prompts/templates/java-spring/pass3.md +25 -5
  19. package/pass-prompts/templates/kotlin-spring/pass1.md +1 -1
  20. package/pass-prompts/templates/kotlin-spring/pass3.md +25 -5
  21. package/pass-prompts/templates/node-express/pass1.md +1 -1
  22. package/pass-prompts/templates/node-express/pass3.md +24 -5
  23. package/pass-prompts/templates/node-nextjs/pass1.md +1 -1
  24. package/pass-prompts/templates/node-nextjs/pass3.md +25 -5
  25. package/pass-prompts/templates/python-django/pass1.md +1 -1
  26. package/pass-prompts/templates/python-django/pass3.md +24 -5
  27. package/pass-prompts/templates/python-fastapi/pass1.md +1 -1
  28. package/pass-prompts/templates/python-fastapi/pass3.md +24 -5
  29. package/plan-installer/domain-grouper.js +3 -10
  30. package/plan-installer/prompt-generator.js +0 -5
  31. package/plan-installer/stack-detector.js +2 -2
  32. package/plan-installer/structure-scanner.js +58 -7
  33. package/plan-validator/index.js +4 -2
  34. package/sync-checker/index.js +4 -2
package/README.zh-CN.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ClaudeOS-Core
2
2
 
3
- **一条命令,从源代码自动生成 Claude Code 的完整项目文档。**
3
+ **唯一一个先读取源代码、用确定性分析确认技术栈和模式、然后生成精确匹配项目的 Claude Code 规则的工具。**
4
4
 
5
5
  ```bash
6
6
  npx claudeos-core init
@@ -12,20 +12,50 @@ ClaudeOS-Core 读取你的代码库,提取所有模式,生成一套完全适
12
12
 
13
13
  ---
14
14
 
15
- ## 问题
15
+ ## 为什么选择 ClaudeOS-Core?
16
16
 
17
- Claude Code 很强大,但它不了解 _你的_ 项目规范。手动编写 `CLAUDE.md`、数十条规则和脚手架技能需要数小时——而且代码一变,这些文档就过时了。
17
+ > 人类描述项目 LLM 生成文档
18
18
 
19
- ## 解决方案
19
+ ClaudeOS-Core:
20
20
 
21
- ClaudeOS-Core 将整个过程自动化:
21
+ > 代码分析源码 → 代码构建定制提示 → LLM 生成文档 → 代码验证输出
22
22
 
23
- 1. **扫描** 你的项目——自动检测技术栈、领域、ORM、数据库、包管理器
24
- 2. **深度分析** 源代码——控制器模式、服务层、命名规范、异常处理、安全、测试等 50+ 个类别
25
- 3. **生成** 完整的文档体系——`CLAUDE.md`、Standards(15–19 个文件)、Rules、Skills、Guides(9 个文件)、Master Plans、DB 文档和 MCP 指南
26
- 4. **验证** 一切——5 个内置验证工具确保一致性
23
+ ### 核心问题:LLM 猜测,代码确定。
27
24
 
28
- 总耗时:**5–18 分钟**,取决于项目规模。零手动配置。
25
+ 当你要求 Claude "分析这个项目"时,它会**猜测**你的技术栈、ORM、领域结构。
26
+
27
+ **ClaudeOS-Core 不猜测。** Claude Node.js:
28
+
29
+ - `build.gradle` / `package.json` / `pyproject.toml` → **confirmed**
30
+ - directory scan → **confirmed**
31
+ - Java 5 patterns, Kotlin CQRS/BFF, Next.js App Router/FSD → **classified**
32
+ - domain groups → **split**
33
+ - stack-specific prompt → **assembled**
34
+
35
+ ### 结果
36
+
37
+ 其他工具生成"一般性好的"文档。
38
+ ClaudeOS-Core 生成的文档知道你的项目使用 `ApiResponse.ok()`(而不是 `ResponseEntity.success()`),MyBatis XML 映射器位于 `src/main/resources/mapper/{domain}/`,包结构为 `com.company.module.{domain}.controller` — 因为它读了你的实际代码。
39
+
40
+ ### Before & After
41
+
42
+ **没有 ClaudeOS-Core**:
43
+ ```
44
+ ❌ JPA repository (MyBatis)
45
+ ❌ ResponseEntity.success() (ApiResponse.ok())
46
+ ❌ order/controller/ (controller/order/)
47
+ → 20 min fix per file
48
+ ```
49
+
50
+ **使用 ClaudeOS-Core 后**:
51
+ ```
52
+ ✅ MyBatis mapper + XML (build.gradle)
53
+ ✅ ApiResponse.ok() (source code)
54
+ ✅ controller/order/ (Pattern A)
55
+ → immediate match
56
+ ```
57
+
58
+ 这种差异会累积。每天10个任务 × 节省20分钟 = **每天3小时以上**。
29
59
 
30
60
  ---
31
61
 
@@ -79,6 +109,7 @@ ClaudeOS-Core 将整个过程自动化:
79
109
  - **FSD(功能切片设计)**:`features/*/`、`widgets/*/`、`entities/*/`
80
110
  - **RSC/Client 分离**:检测 `client.tsx` 模式,追踪服务端/客户端组件分离
81
111
  - **配置文件回退**:从配置文件检测 Next.js/Vite/Nuxt(monorepo 支持)
112
+ - **深层目录回退**:React/CRA/Vite/Vue/RN 项目扫描任意深度的 `**/components/*/`、`**/views/*/`、`**/screens/*/`、`**/containers/*/`、`**/pages/*/`、`**/routes/*/`、`**/modules/*/`、`**/domains/*/`
82
113
 
83
114
  ---
84
115
 
@@ -117,7 +148,7 @@ bash claudeos-core-tools/bootstrap.sh
117
148
 
118
149
  ### 输出语言(支持 10 种语言)
119
150
 
120
- 不带 `--lang` 运行 `init` 时,会显示箭头键交互选择器:
151
+ 不带 `--lang` 运行 `init` 时,会显示交互选择器(支持方向键或数字键):
121
152
 
122
153
  ```
123
154
  ╔══════════════════════════════════════════════════╗
@@ -132,10 +163,10 @@ bash claudeos-core-tools/bootstrap.sh
132
163
  ❯ 3. zh-CN — 简体中文 (Chinese Simplified)
133
164
  ...
134
165
 
135
- ↑↓ Move Select
166
+ ↑↓ Move 1-0 Jump Enter Select ESC Cancel
136
167
  ```
137
168
 
138
- 移动箭头时说明会切换为对应语言。跳过选择器直接指定:
169
+ 选择移动时说明会切换为对应语言。跳过选择器直接指定:
139
170
 
140
171
  ```bash
141
172
  npx claudeos-core init --lang zh-CN # 简体中文
@@ -387,16 +418,21 @@ ClaudeOS-Core 生成的文档,Claude Code 实际读取方式如下:
387
418
  | 文件 | 时机 | 保证 |
388
419
  |---|---|---|
389
420
  | `CLAUDE.md` | 每次对话开始 | 始终 |
390
- | `.claude/rules/*.md` | 编辑文件时(通过 `paths: ["**/*"]`) | 始终 |
391
- | `.claude/rules/00.core/00.standard-reference.md` | 包含在上面 | 始终 |
421
+ | `.claude/rules/00.core/*` | 编辑文件时(`paths: ["**/*"]`) | 始终 |
422
+ | `.claude/rules/10.backend/*` | 编辑文件时(`paths: ["**/*"]`) | 始终 |
423
+ | `.claude/rules/30.security-db/*` | 编辑文件时(`paths: ["**/*"]`) | 始终 |
424
+ | `.claude/rules/40.infra/*` | 仅编辑 config/infra 文件时(范围限定 paths) | 有条件 |
425
+ | `.claude/rules/50.sync/*` | 仅编辑 claudeos-core 文件时(范围限定 paths) | 有条件 |
392
426
 
393
- ### 通过 standard-reference 规则读取的文件
427
+ ### 通过规则引用按需读取的文件
394
428
 
395
- `00.standard-reference.md` 规则指示 Claude Code 在编写代码前 Read 以下文档:
429
+ 每个规则文件底部的 `## Reference` 部分链接到对应的 standard。Claude 仅读取与当前任务相关的 standard:
396
430
 
397
431
  - `claudeos-core/standard/**` — 编码模式、✅/❌ 示例、命名规范
398
432
  - `claudeos-core/database/**` — 数据库 schema(查询、mapper、迁移用)
399
433
 
434
+ `00.standard-reference.md` 作为目录,用于发现没有对应规则的 standard 文件。
435
+
400
436
  ### 不读取的文件(节省上下文)
401
437
 
402
438
  通过 standard-reference 规则的 `DO NOT Read` 部分明确排除:
@@ -450,19 +486,31 @@ npx claudeos-core restore
450
486
 
451
487
  ## 有何不同?
452
488
 
453
- | | ClaudeOS-Core | SuperClaude | 手动 CLAUDE.md | 通用 Skills |
454
- |---|---|---|---|---|
455
- | **读取你的代码** | 深度分析(55–95 类别) | 行为注入 | 手动编写 | 预置模板 |
456
- | **项目定制输出** | ✅ 每个文件反映你的模式 | ❌ 通用命令 | 部分 | ❌ 一刀切 |
457
- | **多栈支持** | 自动检测 + 分别分析 | 栈无关 | 手动 | 不一定 |
458
- | **Kotlin + CQRS/BFF** | 多模块, Command/Query 分离 | | | |
459
- | **多语言** | ✅ 10 种语言,交互式选择 | ❌ | ❌ | ❌ |
460
- | **自验证** | 5 个验证工具 | | | |
461
- | **备份 / 恢复** | Master Plan 系统 | | | |
462
- | **配置时间** | ~5–18分钟(自动) | ~5分钟(手动配置) | 数小时–数天 | ~5分钟 |
489
+ | | ClaudeOS-Core | Everything Claude Code (50K+ ⭐) | Harness | specs-generator | Claude `/init` |
490
+ |---|---|---|---|---|---|
491
+ | **Approach** | Code analyzes first, then LLM generates | Pre-built config presets | LLM designs agent teams | LLM generates spec docs | LLM writes CLAUDE.md |
492
+ | **Reads your source code** | ✅ Deterministic static analysis | ❌ | | (LLM reads) | ❌ (LLM reads) |
493
+ | **Stack detection** | Code confirms (ORM, DB, build tool, pkg manager) | N/A (stack-agnostic) | LLM guesses | LLM guesses | LLM guesses |
494
+ | **Domain detection** | Code confirms (Java 5 patterns, Kotlin CQRS, Next.js FSD) | N/A | LLM guesses | N/A | N/A |
495
+ | **Same project → Same result** | ✅ Deterministic analysis | ✅ (static files) | (LLM varies) | ❌ (LLM varies) | ❌ (LLM varies) |
496
+ | **Large project handling** | Domain group splitting (4 domains / 40 files per group) | N/A | No splitting | No splitting | Context window limit |
497
+ | **Output** | CLAUDE.md + Rules + Standards + Skills + Guides + Plans (40-50+ files) | Agents + Skills + Commands + Hooks | Agents + Skills | 6 spec documents | CLAUDE.md (1 file) |
498
+ | **Output location** | `.claude/rules/` (auto-loaded by Claude Code) | `.claude/` various | `.claude/agents/` + `.claude/skills/` | `.claude/steering/` + `specs/` | `CLAUDE.md` |
499
+ | **Post-generation verification** | ✅ 5 automated validators | ❌ | ❌ | ❌ | ❌ |
500
+ | **Multi-language output** | ✅ 10 languages | ❌ | ❌ | ❌ | ❌ |
501
+ | **Multi-stack** | ✅ Backend + Frontend simultaneous | ❌ Stack-agnostic | ❌ | ❌ | Partial |
502
+ | **Agent orchestration** | ❌ | ✅ 28 agents | ✅ 6 patterns | ❌ | ❌ |
463
503
 
464
- ---
504
+ ### Key difference
465
505
 
506
+ **Other tools give Claude "generally good instructions." ClaudeOS-Core gives Claude "instructions extracted from your actual code."**
507
+
508
+ ### Complementary, not competing
509
+
510
+ ClaudeOS-Core: **project-specific rules**. Other tools: **agent orchestration**.
511
+ Use both together.
512
+
513
+ ---
466
514
  ## FAQ
467
515
 
468
516
  **Q:会修改我的源代码吗?**
package/bin/cli.js CHANGED
@@ -120,7 +120,7 @@ function selectLangInteractive() {
120
120
  }
121
121
  output.push("");
122
122
  const DIM = "\x1b[2m";
123
- output.push(` \x1b[1m↑↓\x1b[0m${DIM} Move ${RESET} \x1b[1mEnter\x1b[0m${DIM} Select ${RESET} \x1b[1mESC\x1b[0m${DIM} Cancel${RESET}`);
123
+ output.push(` \x1b[1m↑↓\x1b[0m${DIM} Move ${RESET} \x1b[1m1-0\x1b[0m${DIM} Jump ${RESET} \x1b[1mEnter\x1b[0m${DIM} Select ${RESET} \x1b[1mESC\x1b[0m${DIM} Cancel${RESET}`);
124
124
  return output;
125
125
  }
126
126
 
@@ -131,13 +131,38 @@ function selectLangInteractive() {
131
131
  log("╚══════════════════════════════════════════════════╝");
132
132
  log("");
133
133
 
134
- // Initial render
134
+ // Try raw mode BEFORE rendering arrow UI — if unsupported, fall back to number input
135
+ try {
136
+ process.stdin.setRawMode(true);
137
+ } catch (e) {
138
+ // setRawMode not supported (e.g., some Windows terminal emulators)
139
+ // Show description + language list and fall back to number input (no arrow UI rendered)
140
+ log(" Generated files (CLAUDE.md, Standards, Rules,");
141
+ log(" Skills, Guides) will be written in this language.");
142
+ log("");
143
+ const readline = require("readline");
144
+ LANG_CODES.forEach((code, i) => {
145
+ log(` ${String(i + 1).padStart(2)}. ${code.padEnd(6)} — ${SUPPORTED_LANGS[code]}`);
146
+ });
147
+ log("");
148
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
149
+ rl.question(` Enter number (1-${total}) or language code: `, (answer) => {
150
+ rl.close();
151
+ const trimmed = answer.trim();
152
+ const num = parseInt(trimmed);
153
+ if (num >= 1 && num <= total) { resolve(LANG_CODES[num - 1]); return; }
154
+ if (isValidLang(trimmed)) { resolve(trimmed); return; }
155
+ log(`\n ❌ Invalid selection: "${trimmed}"`);
156
+ process.exit(1);
157
+ });
158
+ return;
159
+ }
160
+
161
+ // Raw mode succeeded — render interactive arrow UI
135
162
  const lines = render();
136
163
  const listHeight = lines.length;
137
164
  process.stdout.write(lines.join("\n") + "\n");
138
165
 
139
- // Raw mode for keypress detection
140
- process.stdin.setRawMode(true);
141
166
  process.stdin.resume();
142
167
 
143
168
  process.stdin.on("data", (key) => {
@@ -150,19 +175,21 @@ function selectLangInteractive() {
150
175
  process.exit(0);
151
176
  }
152
177
 
153
- // ESC (single byte only — arrow keys send \x1b[ which is 3 bytes)
178
+ // ESC (single byte only — arrow keys send \x1b[ or \x1bO which are 3 bytes)
179
+ // Note: on very slow connections, arrow key bytes could arrive split across events,
180
+ // but this is an inherent raw-mode limitation and extremely rare in practice.
154
181
  if (k === "\x1b" && key.length === 1) {
155
182
  process.stdin.setRawMode(false);
156
183
  log("\n Cancelled.\n");
157
184
  process.exit(0);
158
185
  }
159
186
 
160
- // Up arrow
161
- if (k === "\x1b[A") {
187
+ // Up arrow (normal mode \x1b[A and application mode \x1bOA)
188
+ if (k === "\x1b[A" || k === "\x1bOA") {
162
189
  selected = (selected - 1 + total) % total;
163
190
  }
164
- // Down arrow
165
- else if (k === "\x1b[B") {
191
+ // Down arrow (normal mode \x1b[B and application mode \x1bOB)
192
+ else if (k === "\x1b[B" || k === "\x1bOB") {
166
193
  selected = (selected + 1) % total;
167
194
  }
168
195
  // Number keys 1-9 (direct jump)
@@ -587,7 +614,8 @@ function countFiles() {
587
614
  const visited = new Set();
588
615
  const scan = (dir) => {
589
616
  if (!fs.existsSync(dir)) return;
590
- const realDir = fs.realpathSync(dir);
617
+ let realDir;
618
+ try { realDir = fs.realpathSync(dir); } catch { realDir = dir; }
591
619
  if (visited.has(realDir)) return;
592
620
  visited.add(realDir);
593
621
  for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
package/bootstrap.sh CHANGED
@@ -5,6 +5,9 @@
5
5
  # One-click full system auto-build
6
6
  # Automatically splits Pass 1 into N runs based on project size
7
7
  #
8
+ # Prerequisites: bash, node (v18+), claude CLI, perl
9
+ # For cross-platform use without perl, use: node bin/cli.js init
10
+ #
8
11
  # Usage: bash claudeos-core-tools/bootstrap.sh --lang ko
9
12
  # bash claudeos-core-tools/bootstrap.sh (interactive)
10
13
 
@@ -330,11 +333,19 @@ echo "║ ║"
330
333
  printf "║ Files created: %-29s║\n" "${TOTAL_FILES}"
331
334
  printf "║ Domains analyzed: %-29s║\n" "${TOTAL_GROUPS_DONE} groups"
332
335
  printf "║ Analysis passes: %-29s║\n" "${PASS1_FILES} pass1 files"
336
+ # Find label for selected lang
337
+ LANG_LABEL="$CLAUDEOS_LANG"
338
+ for i in "${!SUPPORTED_LANGS[@]}"; do
339
+ if [ "${SUPPORTED_LANGS[$i]}" = "$CLAUDEOS_LANG" ]; then
340
+ LANG_LABEL="${LANG_LABELS[$i]}"; break
341
+ fi
342
+ done
343
+ printf "║ Output language: %-29s║\n" "${LANG_LABEL}"
333
344
  echo "║ ║"
334
345
  echo "║ Verify anytime: ║"
335
- echo "║ node claudeos-core-tools/health-checker/index.js ║"
346
+ echo "║ npx claudeos-core health ║"
336
347
  echo "║ ║"
337
348
  echo "║ Start using: ║"
338
- echo "║ \"Create a CRUD for orders\" ║"
349
+ echo "║ \"Create a CRUD for orders\" ║"
339
350
  echo "╚════════════════════════════════════════════════════╝"
340
351
  echo ""
@@ -105,15 +105,13 @@ async function main() {
105
105
  errors.push({ file: r, type: "EMPTY", msg: "Empty file" });
106
106
  continue;
107
107
  }
108
- // All rules (except sync reminders) must have paths: ["**/*"] frontmatter
109
- if (!r.includes("50.sync")) {
110
- const hasFrontmatter = c.startsWith("---");
111
- const hasPathsKey = c.includes("paths:");
112
- if (!hasFrontmatter) {
113
- warnings.push({ file: r, type: "NO_FRONTMATTER", msg: "Missing YAML frontmatter (---)" });
114
- } else if (!hasPathsKey) {
115
- warnings.push({ file: r, type: "NO_PATHS", msg: "Frontmatter exists but missing paths: key — use paths: [\"**/*\"] to ensure rule is always loaded" });
116
- }
108
+ // All rules must have paths: frontmatter (value varies by category — e.g. ["**/*"] for core/backend, scoped patterns for infra/sync)
109
+ const hasFrontmatter = c.startsWith("---");
110
+ const hasPathsKey = c.includes("paths:");
111
+ if (!hasFrontmatter) {
112
+ warnings.push({ file: r, type: "NO_FRONTMATTER", msg: "Missing YAML frontmatter (---)" });
113
+ } else if (!hasPathsKey) {
114
+ warnings.push({ file: r, type: "NO_PATHS", msg: "Frontmatter exists but missing paths: key" });
117
115
  }
118
116
  }
119
117
  console.log(` ${ruleFiles.length} files checked`);
@@ -172,12 +170,19 @@ async function main() {
172
170
  if (!hasMarkdownTable) {
173
171
  warnings.push({ file: r, type: "NO_TABLE", msg: "Rules summary table appears to be missing" });
174
172
  }
175
- // Kotlin code block check: core and backend standard files should contain ```kotlin blocks
173
+ // Kotlin code block check: backend standard files should contain ```kotlin blocks
174
+ // (core files excluded for multi-stack projects where core may cover frontend too)
176
175
  if (detectedLanguage === "kotlin") {
177
- const kotlinRelevantPaths = ["backend-api", "00.core/02.", "00.core/03.", "30.security-db"];
178
- if (kotlinRelevantPaths.some(p => r.includes(p))) {
176
+ const kotlinRequiredPaths = ["backend-api", "30.security-db"];
177
+ const kotlinOptionalPaths = ["00.core/02.", "00.core/03."];
178
+ const isRequired = kotlinRequiredPaths.some(p => r.includes(p));
179
+ const isOptional = kotlinOptionalPaths.some(p => r.includes(p));
180
+ if (isRequired || isOptional) {
179
181
  if (!c.includes("```kotlin") && !c.includes("```kt")) {
180
- warnings.push({ file: r, type: "NO_KOTLIN_BLOCK", msg: "No ```kotlin code block found (expected for Kotlin project)" });
182
+ if (isRequired) {
183
+ warnings.push({ file: r, type: "NO_KOTLIN_BLOCK", msg: "No ```kotlin code block found (expected for Kotlin project)" });
184
+ }
185
+ // optional paths: skip warning (core files may legitimately lack kotlin blocks in multi-stack)
181
186
  }
182
187
  }
183
188
  }
@@ -54,6 +54,7 @@ function frontmatter(f) {
54
54
  }
55
55
 
56
56
 
57
+ // Plans using <file path="..."> block format
57
58
  function extractFileBlocks(f) {
58
59
  if (!fs.existsSync(f)) return [];
59
60
  const content = fs.readFileSync(f, "utf-8");
@@ -66,6 +67,22 @@ function extractFileBlocks(f) {
66
67
  return result;
67
68
  }
68
69
 
70
+ // Plans using ## N. `path` ```markdown code block format (e.g., 21.sync-rules-master.md)
71
+ function extractCodeBlockPaths(f) {
72
+ if (!fs.existsSync(f)) return [];
73
+ const content = fs.readFileSync(f, "utf-8");
74
+ const result = [];
75
+ const headingRe = /^##\s+\d+\.\s+`?([^`\n]+)`?/gm;
76
+ let headingMatch;
77
+ while ((headingMatch = headingRe.exec(content)) !== null) {
78
+ const filePath = headingMatch[1].trim();
79
+ if (filePath && filePath.includes("/")) {
80
+ result.push({ sourcePath: filePath, planFile: rel(f) });
81
+ }
82
+ }
83
+ return result;
84
+ }
85
+
69
86
  async function main() {
70
87
  console.log("\n╔═══════════════════════════════════════╗");
71
88
  console.log("║ ClaudeOS-Core — Manifest Generator ║");
@@ -119,10 +136,16 @@ async function main() {
119
136
  // import-graph.json removed — @import was never a Claude Code feature
120
137
 
121
138
  // ─── sync-map.json ─────────────────────────────────────
139
+ const CODE_BLOCK_PLANS = ["21.sync-rules-master.md"];
122
140
  const sm = { generatedAt: new Date().toISOString(), mappings: [] };
123
141
  if (fs.existsSync(DIRS.plan)) {
124
142
  for (const p of await glob("*.md", { cwd: DIRS.plan, absolute: true })) {
125
- sm.mappings.push(...extractFileBlocks(p));
143
+ const bn = path.basename(p);
144
+ if (CODE_BLOCK_PLANS.includes(bn)) {
145
+ sm.mappings.push(...extractCodeBlockPaths(p));
146
+ } else {
147
+ sm.mappings.push(...extractFileBlocks(p));
148
+ }
126
149
  }
127
150
  }
128
151
  sm.summary = { totalMappings: sm.mappings.length };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudeos-core",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Auto-generate Claude Code documentation from your actual source code — Standards, Rules, Skills, and Guides tailored to your project",
5
5
  "main": "bin/cli.js",
6
6
  "bin": {
@@ -96,7 +96,7 @@ Analysis items (per domain):
96
96
  - Performance issues (N+1, unnecessary queries, memory waste)
97
97
  - Security issues (SQL Injection potential, missing authorization)
98
98
 
99
- Do not create files. Analysis only.
99
+ Do not create or modify source files. Analysis only.
100
100
  Save results to claudeos-core/generated/pass1-{{PASS_NUM}}.json in the following format:
101
101
 
102
102
  {
@@ -15,6 +15,14 @@ If a standard defines a specific pattern (e.g., import path, file naming, API us
15
15
  the corresponding rule MUST use the same pattern. Before generating each rule file,
16
16
  verify it is consistent with the related standard file.
17
17
 
18
+ CRITICAL — Code Example Accuracy:
19
+ ALL code examples in rules and standards MUST use EXACT method names, class names,
20
+ and signatures from pass2-merged.json analysis data.
21
+ Do NOT paraphrase, rename, or infer API names. If pass2-merged.json records
22
+ `MzcpResponseUtils.success()`, use `success()` — NOT `ok()`, NOT `respond()`.
23
+ If a method signature is not captured in the analysis data,
24
+ write "See corresponding standard for exact API" instead of guessing.
25
+
18
26
  CRITICAL — CLAUDE.md Reference Table Completeness:
19
27
  The reference table in CLAUDE.md MUST list ALL generated standard files, not just core.
20
28
  Include all backend-api, security-db, infra, and verification standards.
@@ -56,19 +64,31 @@ Generation targets:
56
64
  - Key rules summary table
57
65
 
58
66
  3. .claude/rules/ (active domains only)
59
- - Every rule file MUST include `paths: ["**/*"]` in YAML frontmatter — this ensures Claude Code always loads the rule regardless of which file is being edited
60
67
  - Write the full rule content directly in each file (self-contained, no external references)
61
68
  - Include 5-15 lines of key rules with concrete examples
62
69
  - Do NOT use @import — it is not a Claude Code feature and does not work
63
- - MUST generate `.claude/rules/00.core/00.standard-reference.md` a mandatory rule file that instructs Claude Code to Read the standard documents before coding. Structure it as:
70
+ - Each rule file MUST end with a `## Reference` section linking to the corresponding standard file(s):
71
+ ```
72
+ ## Reference
73
+ > For detailed patterns and examples, Read: claudeos-core/standard/10.backend-api/01.controller-patterns.md
74
+ ```
75
+ - `paths:` frontmatter per rule category:
76
+ - `00.core/*` rules: `paths: ["**/*"]` — always loaded (architecture, naming are universally needed)
77
+ - `10.backend/*` rules: `paths: ["**/*"]` — always loaded (backend rules needed for any source editing)
78
+ - `30.security-db/*` rules: `paths: ["**/*"]` — always loaded (cross-cutting concerns)
79
+ - `40.infra/*` rules: `paths: ["**/*.yml", "**/*.yaml", "**/*.properties", "**/config/**", "**/*.gradle*", "**/Dockerfile*", "**/.env*"]` — loaded only for config/infra files
80
+ - `50.sync/*` rules: `paths: ["**/claudeos-core/**", "**/.claude/**"]` — loaded only when editing claudeos-core files
81
+ - MUST generate `.claude/rules/00.core/00.standard-reference.md` — a directory of all standard files. This is NOT a "read all" instruction. Claude should Read ONLY the standards relevant to the current task. Structure it as:
64
82
  ```
65
83
  ---
66
84
  paths:
67
85
  - "**/*"
68
86
  ---
69
- # Required Standard Documents
70
- Before writing or modifying code, you MUST Read the relevant standard files below using the Read tool.
71
- ## Core (always read)
87
+ # Standard Documents Directory
88
+ Below is the complete list of standard files. Read ONLY the ones relevant to your current task do NOT read all files.
89
+ Each rule file in .claude/rules/ links to its corresponding standard in the ## Reference section. Follow those links first.
90
+ This directory is for discovering standards that have no corresponding rule file.
91
+ ## Core
72
92
  - claudeos-core/standard/00.core/01.project-overview.md
73
93
  - claudeos-core/standard/00.core/02.architecture.md
74
94
  - claudeos-core/standard/00.core/03.naming-conventions.md
@@ -129,7 +129,7 @@ Analysis items (per domain):
129
129
  - Aggregate boundary violations (cross-aggregate direct references, oversized aggregates)
130
130
  - VO misuse (mutable VOs, VOs with identity, DTO used where VO should be)
131
131
 
132
- Do not create files. Analysis only.
132
+ Do not create or modify source files. Analysis only.
133
133
  Save results to claudeos-core/generated/pass1-{{PASS_NUM}}.json in the following format:
134
134
 
135
135
  {
@@ -15,6 +15,14 @@ If a standard defines a specific pattern (e.g., import path, file naming, API us
15
15
  the corresponding rule MUST use the same pattern. Before generating each rule file,
16
16
  verify it is consistent with the related standard file.
17
17
 
18
+ CRITICAL — Code Example Accuracy:
19
+ ALL code examples in rules and standards MUST use EXACT method names, class names,
20
+ and signatures from pass2-merged.json analysis data.
21
+ Do NOT paraphrase, rename, or infer API names. If pass2-merged.json records
22
+ `MzcpResponseUtils.success()`, use `success()` — NOT `ok()`, NOT `respond()`.
23
+ If a method signature is not captured in the analysis data,
24
+ write "See corresponding standard for exact API" instead of guessing.
25
+
18
26
  CRITICAL — CLAUDE.md Reference Table Completeness:
19
27
  The reference table in CLAUDE.md MUST list ALL generated standard files, not just core.
20
28
  Include all backend-api, security-db, infra, and verification standards.
@@ -59,20 +67,32 @@ Generation targets:
59
67
  - Key rules summary table
60
68
 
61
69
  3. .claude/rules/ (active domains only)
62
- - Every rule file MUST include `paths: ["**/*"]` in YAML frontmatter — this ensures Claude Code always loads the rule regardless of which file is being edited
63
70
  - Write the full rule content directly in each file (self-contained, no external references)
64
71
  - Include 5-15 lines of key rules with concrete examples
65
72
  - Do NOT use @import — it is not a Claude Code feature and does not work
66
73
  - CQRS-specific rules: include command/query separation rules directly in the rule file content
67
- - MUST generate `.claude/rules/00.core/00.standard-reference.md` a mandatory rule file that instructs Claude Code to Read the standard documents before coding. Structure it as:
74
+ - Each rule file MUST end with a `## Reference` section linking to the corresponding standard file(s):
75
+ ```
76
+ ## Reference
77
+ > For detailed patterns and examples, Read: claudeos-core/standard/10.backend-api/01.controller-patterns.md
78
+ ```
79
+ - `paths:` frontmatter per rule category:
80
+ - `00.core/*` rules: `paths: ["**/*"]` — always loaded (architecture, naming are universally needed)
81
+ - `10.backend/*` rules: `paths: ["**/*"]` — always loaded (backend rules needed for any source editing)
82
+ - `30.security-db/*` rules: `paths: ["**/*"]` — always loaded (cross-cutting concerns)
83
+ - `40.infra/*` rules: `paths: ["**/*.yml", "**/*.yaml", "**/*.properties", "**/config/**", "**/*.gradle*", "**/Dockerfile*", "**/.env*"]` — loaded only for config/infra files
84
+ - `50.sync/*` rules: `paths: ["**/claudeos-core/**", "**/.claude/**"]` — loaded only when editing claudeos-core files
85
+ - MUST generate `.claude/rules/00.core/00.standard-reference.md` — a directory of all standard files. This is NOT a "read all" instruction. Claude should Read ONLY the standards relevant to the current task. Structure it as:
68
86
  ```
69
87
  ---
70
88
  paths:
71
89
  - "**/*"
72
90
  ---
73
- # Required Standard Documents
74
- Before writing or modifying code, you MUST Read the relevant standard files below using the Read tool.
75
- ## Core (always read)
91
+ # Standard Documents Directory
92
+ Below is the complete list of standard files. Read ONLY the ones relevant to your current task do NOT read all files.
93
+ Each rule file in .claude/rules/ links to its corresponding standard in the ## Reference section. Follow those links first.
94
+ This directory is for discovering standards that have no corresponding rule file.
95
+ ## Core
76
96
  - claudeos-core/standard/00.core/01.project-overview.md
77
97
  - claudeos-core/standard/00.core/02.architecture.md
78
98
  - claudeos-core/standard/00.core/03.naming-conventions.md
@@ -84,7 +84,7 @@ Analysis items (per domain):
84
84
  - Performance issues (memory leaks, blocking I/O)
85
85
  - Security issues (injection, missing authorization)
86
86
 
87
- Do not create files. Analysis only.
87
+ Do not create or modify source files. Analysis only.
88
88
  Save results to claudeos-core/generated/pass1-{{PASS_NUM}}.json in the following format:
89
89
 
90
90
  {
@@ -17,6 +17,13 @@ If a standard defines a specific pattern (e.g., import path, file naming, API us
17
17
  the corresponding rule MUST use the same pattern. Before generating each rule file,
18
18
  verify it is consistent with the related standard file.
19
19
 
20
+ CRITICAL — Code Example Accuracy:
21
+ ALL code examples in rules and standards MUST use EXACT method names, class names,
22
+ and signatures from pass2-merged.json analysis data.
23
+ Do NOT paraphrase, rename, or infer API names.
24
+ If a method signature is not captured in the analysis data,
25
+ write "See corresponding standard for exact API" instead of guessing.
26
+
20
27
  CRITICAL — CLAUDE.md Reference Table Completeness:
21
28
  The reference table in CLAUDE.md MUST list ALL generated standard files, not just core.
22
29
  Include all frontend-ui, backend-api, security-db, infra, and verification standards.
@@ -57,19 +64,31 @@ Generation targets:
57
64
  - Key rules summary table
58
65
 
59
66
  3. .claude/rules/ (active domains only)
60
- - Every rule file MUST include `paths: ["**/*"]` in YAML frontmatter — this ensures Claude Code always loads the rule regardless of which file is being edited
61
67
  - Write the full rule content directly in each file (self-contained, no external references)
62
68
  - Include 5-15 lines of key rules with concrete examples
63
69
  - Do NOT use @import — it is not a Claude Code feature and does not work
64
- - MUST generate `.claude/rules/00.core/00.standard-reference.md` a mandatory rule file that instructs Claude Code to Read the standard documents before coding. Structure it as:
70
+ - Each rule file MUST end with a `## Reference` section linking to the corresponding standard file(s):
71
+ ```
72
+ ## Reference
73
+ > For detailed patterns and examples, Read: claudeos-core/standard/10.backend-api/01.router-controller-patterns.md
74
+ ```
75
+ - `paths:` frontmatter per rule category:
76
+ - `00.core/*` rules: `paths: ["**/*"]` — always loaded (architecture, naming are universally needed)
77
+ - `10.backend/*` rules: `paths: ["**/*"]` — always loaded (backend rules needed for any source editing)
78
+ - `30.security-db/*` rules: `paths: ["**/*"]` — always loaded (cross-cutting concerns)
79
+ - `40.infra/*` rules: `paths: ["**/*.json", "**/*.env*", "**/config/**", "**/Dockerfile*", "**/*.yml", "**/*.yaml"]` — loaded only for config/infra files
80
+ - `50.sync/*` rules: `paths: ["**/claudeos-core/**", "**/.claude/**"]` — loaded only when editing claudeos-core files
81
+ - MUST generate `.claude/rules/00.core/00.standard-reference.md` — a directory of all standard files. This is NOT a "read all" instruction. Claude should Read ONLY the standards relevant to the current task. Structure it as:
65
82
  ```
66
83
  ---
67
84
  paths:
68
85
  - "**/*"
69
86
  ---
70
- # Required Standard Documents
71
- Before writing or modifying code, you MUST Read the relevant standard files below using the Read tool.
72
- ## Core (always read)
87
+ # Standard Documents Directory
88
+ Below is the complete list of standard files. Read ONLY the ones relevant to your current task do NOT read all files.
89
+ Each rule file in .claude/rules/ links to its corresponding standard in the ## Reference section. Follow those links first.
90
+ This directory is for discovering standards that have no corresponding rule file.
91
+ ## Core
73
92
  - claudeos-core/standard/00.core/01.project-overview.md
74
93
  - claudeos-core/standard/00.core/02.architecture.md
75
94
  - claudeos-core/standard/00.core/03.naming-conventions.md
@@ -83,7 +83,7 @@ Analysis items (per domain):
83
83
  - Accessibility issues
84
84
  - Security issues (XSS, CSRF)
85
85
 
86
- Do not create files. Analysis only.
86
+ Do not create or modify source files. Analysis only.
87
87
  Save results to claudeos-core/generated/pass1-{{PASS_NUM}}.json in the following format:
88
88
 
89
89
  {