claudeos-core 1.7.0 → 2.0.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +138 -0
  2. package/CONTRIBUTING.md +92 -59
  3. package/README.de.md +465 -240
  4. package/README.es.md +446 -223
  5. package/README.fr.md +461 -238
  6. package/README.hi.md +485 -261
  7. package/README.ja.md +440 -235
  8. package/README.ko.md +244 -56
  9. package/README.md +215 -47
  10. package/README.ru.md +462 -238
  11. package/README.vi.md +454 -230
  12. package/README.zh-CN.md +476 -252
  13. package/bin/cli.js +144 -140
  14. package/bin/commands/init.js +550 -46
  15. package/bin/commands/memory.js +426 -0
  16. package/bin/lib/cli-utils.js +206 -143
  17. package/bootstrap.sh +81 -390
  18. package/content-validator/index.js +436 -340
  19. package/lib/expected-guides.js +23 -0
  20. package/lib/expected-outputs.js +91 -0
  21. package/lib/language-config.js +35 -0
  22. package/lib/memory-scaffold.js +1014 -0
  23. package/lib/plan-parser.js +153 -149
  24. package/lib/staged-rules.js +118 -0
  25. package/manifest-generator/index.js +176 -171
  26. package/package.json +1 -1
  27. package/pass-json-validator/index.js +337 -299
  28. package/pass-prompts/templates/common/pass3-footer.md +16 -0
  29. package/pass-prompts/templates/common/pass4.md +317 -0
  30. package/pass-prompts/templates/common/staging-override.md +26 -0
  31. package/pass-prompts/templates/python-flask/pass1.md +119 -0
  32. package/pass-prompts/templates/python-flask/pass2.md +85 -0
  33. package/pass-prompts/templates/python-flask/pass3.md +103 -0
  34. package/plan-installer/domain-grouper.js +2 -1
  35. package/plan-installer/prompt-generator.js +120 -96
  36. package/plan-installer/scanners/scan-frontend.js +219 -10
  37. package/plan-installer/scanners/scan-java.js +226 -223
  38. package/plan-installer/scanners/scan-python.js +21 -0
  39. package/sync-checker/index.js +133 -132
@@ -1,171 +1,176 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * ClaudeOS-Core — Manifest Generator
5
- *
6
- * Role: Generate metadata JSON + initialize stale-report
7
- * Output (claudeos-core/generated/):
8
- * - rule-manifest.json : rules/standard/skills/guide file list + frontmatter
9
- * - sync-map.json : plan/ <file> block → file path mapping
10
- * - plan-manifest.json : plan/ file list + <file> block count
11
- * - stale-report.json : initialized (each verification tool appends results)
12
- *
13
- * Usage: npx claudeos-core <cmd> or node claudeos-core-tools/manifest-generator/index.js
14
- */
15
-
16
- const fs = require("fs");
17
- const path = require("path");
18
- const matter = require("gray-matter");
19
- const { glob } = require("glob");
20
- const { parseFileBlocks, parseCodeBlocks, CODE_BLOCK_PLANS } = require("../lib/plan-parser");
21
- const { updateStaleReport } = require("../lib/stale-report");
22
-
23
- const ROOT = process.env.CLAUDEOS_ROOT || path.resolve(__dirname, "../..");
24
- const GEN = path.join(ROOT, "claudeos-core/generated");
25
-
26
- const DIRS = {
27
- rules: path.join(ROOT, ".claude/rules"),
28
- standard: path.join(ROOT, "claudeos-core/standard"),
29
- skills: path.join(ROOT, "claudeos-core/skills"),
30
- plan: path.join(ROOT, "claudeos-core/plan"),
31
- guide: path.join(ROOT, "claudeos-core/guide"),
32
- database: path.join(ROOT, "claudeos-core/database"),
33
- mcpGuide: path.join(ROOT, "claudeos-core/mcp-guide"),
34
- };
35
-
36
- function rel(p) {
37
- return path.relative(ROOT, p).replace(/\\/g, "/");
38
- }
39
-
40
- function stat(f) {
41
- try {
42
- const s = fs.statSync(f);
43
- const c = fs.readFileSync(f, "utf-8");
44
- return {
45
- lines: c.endsWith("\n") ? c.split("\n").length - 1 : c.split("\n").length,
46
- bytes: s.size,
47
- modified: s.mtime.toISOString().split("T")[0],
48
- };
49
- } catch (_e) {
50
- return { lines: 0, bytes: 0, modified: "unknown" };
51
- }
52
- }
53
-
54
- function frontmatter(f) {
55
- try {
56
- return matter(fs.readFileSync(f, "utf-8")).data || {};
57
- } catch (_e) {
58
- return {};
59
- }
60
- }
61
-
62
-
63
- // Wrappers: read file → parse → attach planFile metadata
64
- function extractFileBlocksFromFile(f) {
65
- if (!fs.existsSync(f)) return [];
66
- const content = fs.readFileSync(f, "utf-8");
67
- return parseFileBlocks(content).map(b => ({ sourcePath: b.path, planFile: rel(f) }));
68
- }
69
-
70
- function extractCodeBlockPathsFromFile(f) {
71
- if (!fs.existsSync(f)) return [];
72
- const content = fs.readFileSync(f, "utf-8");
73
- return parseCodeBlocks(content).map(b => ({ sourcePath: b.path, planFile: rel(f) }));
74
- }
75
-
76
- async function main() {
77
- console.log("\n╔═══════════════════════════════════════╗");
78
- console.log("║ ClaudeOS-Core — Manifest Generator ║");
79
- console.log("╚═══════════════════════════════════════╝\n");
80
-
81
- if (!fs.existsSync(GEN)) fs.mkdirSync(GEN, { recursive: true });
82
-
83
- // ─── rule-manifest.json ────────────────────────────────
84
- const mf = {
85
- generatedAt: new Date().toISOString(),
86
- rules: [], standards: [], skills: [], guides: [], database: [], mcpGuide: [],
87
- };
88
-
89
- const scanTargets = [
90
- ["rules", DIRS.rules],
91
- ["standards", DIRS.standard],
92
- ["skills", DIRS.skills],
93
- ["guides", DIRS.guide],
94
- ["database", DIRS.database],
95
- ["mcpGuide", DIRS.mcpGuide],
96
- ];
97
-
98
- for (const [key, dir] of scanTargets) {
99
- if (!fs.existsSync(dir)) continue;
100
- for (const f of await glob("**/*.md", { cwd: dir, absolute: true })) {
101
- const r = rel(f);
102
- const s = stat(f);
103
- const fm = frontmatter(f);
104
- mf[key].push({
105
- path: r,
106
- paths: fm.paths || undefined,
107
- name: fm.name || undefined,
108
- ...s,
109
- });
110
- }
111
- }
112
-
113
- mf.summary = {
114
- totalRules: mf.rules.length,
115
- totalStandards: mf.standards.length,
116
- totalSkills: mf.skills.length,
117
- totalGuides: mf.guides.length,
118
- totalDatabase: mf.database.length,
119
- totalMcpGuide: mf.mcpGuide.length,
120
- total: mf.rules.length + mf.standards.length + mf.skills.length +
121
- mf.guides.length + mf.database.length + mf.mcpGuide.length,
122
- };
123
- fs.writeFileSync(path.join(GEN, "rule-manifest.json"), JSON.stringify(mf, null, 2));
124
- console.log(` ✅ rule-manifest.json ${mf.summary.total} files indexed`);
125
-
126
- // import-graph.json removed — @import was never a Claude Code feature
127
-
128
- // ─── sync-map.json ─────────────────────────────────────
129
- // CODE_BLOCK_PLANS imported from lib/plan-parser.js
130
- const sm = { generatedAt: new Date().toISOString(), mappings: [] };
131
- if (fs.existsSync(DIRS.plan)) {
132
- for (const p of await glob("*.md", { cwd: DIRS.plan, absolute: true })) {
133
- const bn = path.basename(p);
134
- if (CODE_BLOCK_PLANS.includes(bn)) {
135
- sm.mappings.push(...extractCodeBlockPathsFromFile(p));
136
- } else {
137
- sm.mappings.push(...extractFileBlocksFromFile(p));
138
- }
139
- }
140
- }
141
- sm.summary = { totalMappings: sm.mappings.length };
142
- fs.writeFileSync(path.join(GEN, "sync-map.json"), JSON.stringify(sm, null, 2));
143
- console.log(` ✅ sync-map.json — ${sm.summary.totalMappings} mappings`);
144
-
145
- // ─── plan-manifest.json ────────────────────────────────
146
- const pm = { generatedAt: new Date().toISOString(), plans: [] };
147
- if (fs.existsSync(DIRS.plan)) {
148
- for (const p of await glob("*.md", { cwd: DIRS.plan, absolute: true })) {
149
- const r = rel(p);
150
- const s = stat(p);
151
- const bn = path.basename(p);
152
- const blocks = CODE_BLOCK_PLANS.includes(bn)
153
- ? extractCodeBlockPathsFromFile(p)
154
- : extractFileBlocksFromFile(p);
155
- pm.plans.push({ path: r, ...s, fileBlocks: blocks.length, status: "ok" });
156
- }
157
- }
158
- fs.writeFileSync(path.join(GEN, "plan-manifest.json"), JSON.stringify(pm, null, 2));
159
- console.log(` ✅ plan-manifest.json — ${pm.plans.length} plans`);
160
-
161
- // ─── Initialize stale-report.json (preserve existing sub-tool results) ──
162
- updateStaleReport(GEN, "generatedAt", new Date().toISOString(), { totalIssues: 0, status: "initial" });
163
- console.log(" ✅ stale-report.json initialized");
164
- console.log("\n 📁 Output: claudeos-core/generated/ (4 files)\n");
165
- }
166
-
167
- if (require.main === module) {
168
- main().catch(e => { console.error(`\n Manifest Generator failed: ${e.message || e}`); process.exit(1); });
169
- }
170
-
171
- module.exports = { main };
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * ClaudeOS-Core — Manifest Generator
5
+ *
6
+ * Role: Generate metadata JSON + initialize stale-report
7
+ * Output (claudeos-core/generated/):
8
+ * - rule-manifest.json : rules/standard/skills/guide file list + frontmatter
9
+ * - sync-map.json : plan/ <file> block → file path mapping
10
+ * - plan-manifest.json : plan/ file list + <file> block count
11
+ * - stale-report.json : initialized (each verification tool appends results)
12
+ *
13
+ * Usage: npx claudeos-core <cmd> or node claudeos-core-tools/manifest-generator/index.js
14
+ */
15
+
16
+ const fs = require("fs");
17
+ const path = require("path");
18
+ const matter = require("gray-matter");
19
+ const { glob } = require("glob");
20
+ const { parseFileBlocks, parseCodeBlocks, CODE_BLOCK_PLANS } = require("../lib/plan-parser");
21
+ const { updateStaleReport } = require("../lib/stale-report");
22
+
23
+ const ROOT = process.env.CLAUDEOS_ROOT || path.resolve(__dirname, "../..");
24
+ const GEN = path.join(ROOT, "claudeos-core/generated");
25
+
26
+ const DIRS = {
27
+ rules: path.join(ROOT, ".claude/rules"),
28
+ standard: path.join(ROOT, "claudeos-core/standard"),
29
+ skills: path.join(ROOT, "claudeos-core/skills"),
30
+ plan: path.join(ROOT, "claudeos-core/plan"),
31
+ guide: path.join(ROOT, "claudeos-core/guide"),
32
+ database: path.join(ROOT, "claudeos-core/database"),
33
+ mcpGuide: path.join(ROOT, "claudeos-core/mcp-guide"),
34
+ memory: path.join(ROOT, "claudeos-core/memory"),
35
+ };
36
+
37
+ function rel(p) {
38
+ return path.relative(ROOT, p).replace(/\\/g, "/");
39
+ }
40
+
41
+ function stat(f) {
42
+ try {
43
+ const s = fs.statSync(f);
44
+ const c = fs.readFileSync(f, "utf-8");
45
+ return {
46
+ lines: c.endsWith("\n") ? c.split("\n").length - 1 : c.split("\n").length,
47
+ bytes: s.size,
48
+ modified: s.mtime.toISOString().split("T")[0],
49
+ };
50
+ } catch (_e) {
51
+ return { lines: 0, bytes: 0, modified: "unknown" };
52
+ }
53
+ }
54
+
55
+ function frontmatter(f) {
56
+ try {
57
+ return matter(fs.readFileSync(f, "utf-8")).data || {};
58
+ } catch (_e) {
59
+ return {};
60
+ }
61
+ }
62
+
63
+
64
+ // Wrappers: read file → parse → attach planFile metadata
65
+ function extractFileBlocksFromFile(f) {
66
+ if (!fs.existsSync(f)) return [];
67
+ const content = fs.readFileSync(f, "utf-8");
68
+ return parseFileBlocks(content).map(b => ({ sourcePath: b.path, planFile: rel(f) }));
69
+ }
70
+
71
+ function extractCodeBlockPathsFromFile(f) {
72
+ if (!fs.existsSync(f)) return [];
73
+ const content = fs.readFileSync(f, "utf-8");
74
+ return parseCodeBlocks(content).map(b => ({ sourcePath: b.path, planFile: rel(f) }));
75
+ }
76
+
77
+ async function main() {
78
+ console.log("\n╔═══════════════════════════════════════╗");
79
+ console.log("║ ClaudeOS-Core — Manifest Generator ║");
80
+ console.log("╚═══════════════════════════════════════╝\n");
81
+
82
+ if (!fs.existsSync(GEN)) fs.mkdirSync(GEN, { recursive: true });
83
+
84
+ // ─── rule-manifest.json ────────────────────────────────
85
+ const mf = {
86
+ generatedAt: new Date().toISOString(),
87
+ rules: [], standards: [], skills: [], guides: [], database: [], mcpGuide: [],
88
+ memory: [],
89
+ };
90
+
91
+ const scanTargets = [
92
+ ["rules", DIRS.rules],
93
+ ["standards", DIRS.standard],
94
+ ["skills", DIRS.skills],
95
+ ["guides", DIRS.guide],
96
+ ["database", DIRS.database],
97
+ ["mcpGuide", DIRS.mcpGuide],
98
+ ["memory", DIRS.memory],
99
+ ];
100
+
101
+ for (const [key, dir] of scanTargets) {
102
+ if (!fs.existsSync(dir)) continue;
103
+ for (const f of await glob("**/*.md", { cwd: dir, absolute: true })) {
104
+ const r = rel(f);
105
+ const s = stat(f);
106
+ const fm = frontmatter(f);
107
+ mf[key].push({
108
+ path: r,
109
+ paths: fm.paths || undefined,
110
+ name: fm.name || undefined,
111
+ ...s,
112
+ });
113
+ }
114
+ }
115
+
116
+ mf.summary = {
117
+ totalRules: mf.rules.length,
118
+ totalStandards: mf.standards.length,
119
+ totalSkills: mf.skills.length,
120
+ totalGuides: mf.guides.length,
121
+ totalDatabase: mf.database.length,
122
+ totalMcpGuide: mf.mcpGuide.length,
123
+ totalMemory: mf.memory.length,
124
+ total: mf.rules.length + mf.standards.length + mf.skills.length +
125
+ mf.guides.length + mf.database.length + mf.mcpGuide.length +
126
+ mf.memory.length,
127
+ };
128
+ fs.writeFileSync(path.join(GEN, "rule-manifest.json"), JSON.stringify(mf, null, 2));
129
+ console.log(` ✅ rule-manifest.json ${mf.summary.total} files indexed`);
130
+
131
+ // import-graph.json removed — @import was never a Claude Code feature
132
+
133
+ // ─── sync-map.json ─────────────────────────────────────
134
+ // CODE_BLOCK_PLANS imported from lib/plan-parser.js
135
+ const sm = { generatedAt: new Date().toISOString(), mappings: [] };
136
+ if (fs.existsSync(DIRS.plan)) {
137
+ for (const p of await glob("*.md", { cwd: DIRS.plan, absolute: true })) {
138
+ const bn = path.basename(p);
139
+ if (CODE_BLOCK_PLANS.includes(bn)) {
140
+ sm.mappings.push(...extractCodeBlockPathsFromFile(p));
141
+ } else {
142
+ sm.mappings.push(...extractFileBlocksFromFile(p));
143
+ }
144
+ }
145
+ }
146
+ sm.summary = { totalMappings: sm.mappings.length };
147
+ fs.writeFileSync(path.join(GEN, "sync-map.json"), JSON.stringify(sm, null, 2));
148
+ console.log(` ✅ sync-map.json ${sm.summary.totalMappings} mappings`);
149
+
150
+ // ─── plan-manifest.json ────────────────────────────────
151
+ const pm = { generatedAt: new Date().toISOString(), plans: [] };
152
+ if (fs.existsSync(DIRS.plan)) {
153
+ for (const p of await glob("*.md", { cwd: DIRS.plan, absolute: true })) {
154
+ const r = rel(p);
155
+ const s = stat(p);
156
+ const bn = path.basename(p);
157
+ const blocks = CODE_BLOCK_PLANS.includes(bn)
158
+ ? extractCodeBlockPathsFromFile(p)
159
+ : extractFileBlocksFromFile(p);
160
+ pm.plans.push({ path: r, ...s, fileBlocks: blocks.length, status: "ok" });
161
+ }
162
+ }
163
+ fs.writeFileSync(path.join(GEN, "plan-manifest.json"), JSON.stringify(pm, null, 2));
164
+ console.log(` plan-manifest.json ${pm.plans.length} plans`);
165
+
166
+ // ─── Initialize stale-report.json (preserve existing sub-tool results) ──
167
+ updateStaleReport(GEN, "generatedAt", new Date().toISOString(), { totalIssues: 0, status: "initial" });
168
+ console.log(" stale-report.json initialized");
169
+ console.log("\n 📁 Output: claudeos-core/generated/ (4 files)\n");
170
+ }
171
+
172
+ if (require.main === module) {
173
+ main().catch(e => { console.error(`\n ❌ Manifest Generator failed: ${e.message || e}`); process.exit(1); });
174
+ }
175
+
176
+ module.exports = { main };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudeos-core",
3
- "version": "1.7.0",
3
+ "version": "2.0.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": {