claudeos-core 1.2.4 → 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.
Potentially problematic release.
This version of claudeos-core might be problematic. Click here for more details.
- package/CHANGELOG.md +76 -0
- package/README.de.md +50 -10
- package/README.es.md +51 -10
- package/README.fr.md +51 -10
- package/README.hi.md +51 -10
- package/README.ja.md +52 -10
- package/README.ko.md +51 -10
- package/README.md +62 -15
- package/README.ru.md +51 -10
- package/README.vi.md +51 -10
- package/README.zh-CN.md +51 -10
- package/bin/cli.js +171 -36
- package/bootstrap.sh +71 -23
- package/content-validator/index.js +16 -13
- package/health-checker/index.js +4 -3
- package/lib/safe-fs.js +110 -0
- package/manifest-generator/index.js +13 -7
- package/package.json +4 -2
- package/pass-json-validator/index.js +3 -5
- package/pass-prompts/templates/java-spring/pass1.md +4 -1
- package/pass-prompts/templates/java-spring/pass2.md +3 -3
- package/pass-prompts/templates/java-spring/pass3.md +42 -5
- package/pass-prompts/templates/kotlin-spring/pass1.md +4 -1
- package/pass-prompts/templates/kotlin-spring/pass2.md +5 -5
- package/pass-prompts/templates/kotlin-spring/pass3.md +42 -5
- package/pass-prompts/templates/node-express/pass1.md +4 -1
- package/pass-prompts/templates/node-express/pass2.md +4 -1
- package/pass-prompts/templates/node-express/pass3.md +44 -6
- package/pass-prompts/templates/node-nextjs/pass1.md +14 -4
- package/pass-prompts/templates/node-nextjs/pass2.md +6 -4
- package/pass-prompts/templates/node-nextjs/pass3.md +45 -6
- package/pass-prompts/templates/python-django/pass1.md +4 -2
- package/pass-prompts/templates/python-django/pass2.md +4 -4
- package/pass-prompts/templates/python-django/pass3.md +42 -5
- package/pass-prompts/templates/python-fastapi/pass1.md +4 -1
- package/pass-prompts/templates/python-fastapi/pass2.md +4 -4
- package/pass-prompts/templates/python-fastapi/pass3.md +42 -5
- package/plan-installer/domain-grouper.js +74 -0
- package/plan-installer/index.js +35 -1305
- package/plan-installer/prompt-generator.js +94 -0
- package/plan-installer/stack-detector.js +326 -0
- package/plan-installer/structure-scanner.js +783 -0
- package/plan-validator/index.js +84 -20
- package/sync-checker/index.js +7 -3
package/lib/safe-fs.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ClaudeOS-Core — Safe filesystem utilities
|
|
3
|
+
*
|
|
4
|
+
* Wraps fs operations with consistent error handling.
|
|
5
|
+
* All read functions return a fallback value on failure instead of throwing.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require("fs");
|
|
9
|
+
const path = require("path");
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Safely read a file as UTF-8 string.
|
|
13
|
+
* @param {string} filePath
|
|
14
|
+
* @param {string} [fallback=""] - returned on error
|
|
15
|
+
* @returns {string}
|
|
16
|
+
*/
|
|
17
|
+
function readFileSafe(filePath, fallback = "") {
|
|
18
|
+
try {
|
|
19
|
+
return fs.readFileSync(filePath, "utf-8");
|
|
20
|
+
} catch (e) {
|
|
21
|
+
if (e.code !== "ENOENT") {
|
|
22
|
+
console.warn(` ⚠️ Cannot read ${path.basename(filePath)}: ${e.code || e.message}`);
|
|
23
|
+
}
|
|
24
|
+
return fallback;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Safely parse a JSON file.
|
|
30
|
+
* @param {string} filePath
|
|
31
|
+
* @param {*} [fallback=null] - returned on error
|
|
32
|
+
* @returns {*}
|
|
33
|
+
*/
|
|
34
|
+
function readJsonSafe(filePath, fallback = null) {
|
|
35
|
+
const raw = readFileSafe(filePath, null);
|
|
36
|
+
if (raw === null) return fallback;
|
|
37
|
+
try {
|
|
38
|
+
return JSON.parse(raw);
|
|
39
|
+
} catch (e) {
|
|
40
|
+
console.warn(` ⚠️ JSON parse error in ${path.basename(filePath)}: ${e.message}`);
|
|
41
|
+
return fallback;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Check if a file exists (swallows permission errors).
|
|
47
|
+
* @param {string} filePath
|
|
48
|
+
* @returns {boolean}
|
|
49
|
+
*/
|
|
50
|
+
function existsSafe(filePath) {
|
|
51
|
+
try {
|
|
52
|
+
return fs.existsSync(filePath);
|
|
53
|
+
} catch {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Ensure a directory exists (recursive).
|
|
60
|
+
* @param {string} dir
|
|
61
|
+
*/
|
|
62
|
+
function ensureDir(dir) {
|
|
63
|
+
if (!fs.existsSync(dir)) {
|
|
64
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Write a file with error reporting.
|
|
70
|
+
* @param {string} filePath
|
|
71
|
+
* @param {string} content
|
|
72
|
+
* @returns {boolean} success
|
|
73
|
+
*/
|
|
74
|
+
function writeFileSafe(filePath, content) {
|
|
75
|
+
try {
|
|
76
|
+
fs.writeFileSync(filePath, content);
|
|
77
|
+
return true;
|
|
78
|
+
} catch (e) {
|
|
79
|
+
console.error(` ❌ Cannot write ${path.basename(filePath)}: ${e.code || e.message}`);
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Get file stat safely.
|
|
86
|
+
* @param {string} filePath
|
|
87
|
+
* @returns {{ lines: number, bytes: number, modified: string } | null}
|
|
88
|
+
*/
|
|
89
|
+
function statSafe(filePath) {
|
|
90
|
+
try {
|
|
91
|
+
const c = fs.readFileSync(filePath, "utf-8");
|
|
92
|
+
const s = fs.statSync(filePath);
|
|
93
|
+
return {
|
|
94
|
+
lines: c.split("\n").length,
|
|
95
|
+
bytes: s.size,
|
|
96
|
+
modified: s.mtime.toISOString().split("T")[0],
|
|
97
|
+
};
|
|
98
|
+
} catch {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
module.exports = {
|
|
104
|
+
readFileSafe,
|
|
105
|
+
readJsonSafe,
|
|
106
|
+
existsSafe,
|
|
107
|
+
ensureDir,
|
|
108
|
+
writeFileSafe,
|
|
109
|
+
statSafe,
|
|
110
|
+
};
|
|
@@ -67,9 +67,9 @@ function extractFileBlocks(f) {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
async function main() {
|
|
70
|
-
console.log("\n
|
|
70
|
+
console.log("\n╔═══════════════════════════════════════╗");
|
|
71
71
|
console.log("║ ClaudeOS-Core — Manifest Generator ║");
|
|
72
|
-
console.log("
|
|
72
|
+
console.log("╚═══════════════════════════════════════╝\n");
|
|
73
73
|
|
|
74
74
|
if (!fs.existsSync(GEN)) fs.mkdirSync(GEN, { recursive: true });
|
|
75
75
|
|
|
@@ -142,11 +142,17 @@ async function main() {
|
|
|
142
142
|
fs.writeFileSync(path.join(GEN, "plan-manifest.json"), JSON.stringify(pm, null, 2));
|
|
143
143
|
console.log(` ✅ plan-manifest.json — ${pm.plans.length} plans`);
|
|
144
144
|
|
|
145
|
-
// ─── Initialize stale-report.json
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
145
|
+
// ─── Initialize stale-report.json (preserve existing sub-tool results) ──
|
|
146
|
+
const srPath = path.join(GEN, "stale-report.json");
|
|
147
|
+
let sr = {};
|
|
148
|
+
if (fs.existsSync(srPath)) {
|
|
149
|
+
try { sr = JSON.parse(fs.readFileSync(srPath, "utf-8")); } catch { sr = {}; }
|
|
150
|
+
}
|
|
151
|
+
sr.generatedAt = new Date().toISOString();
|
|
152
|
+
if (!sr.summary) sr.summary = {};
|
|
153
|
+
sr.summary.totalIssues = 0;
|
|
154
|
+
sr.summary.status = "initial";
|
|
155
|
+
fs.writeFileSync(srPath, JSON.stringify(sr, null, 2));
|
|
150
156
|
console.log(" ✅ stale-report.json — initialized");
|
|
151
157
|
console.log("\n 📁 Output: claudeos-core/generated/ (4 files)\n");
|
|
152
158
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claudeos-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
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": {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"bin/",
|
|
11
|
+
"lib/",
|
|
11
12
|
"content-validator/",
|
|
12
13
|
"health-checker/",
|
|
13
14
|
"manifest-generator/",
|
|
@@ -37,7 +38,8 @@
|
|
|
37
38
|
"validate": "node bin/cli.js validate",
|
|
38
39
|
"refresh": "node bin/cli.js refresh",
|
|
39
40
|
"restore": "node bin/cli.js restore",
|
|
40
|
-
"test": "node
|
|
41
|
+
"test": "node --test tests/*.test.js",
|
|
42
|
+
"test:health": "node health-checker/index.js"
|
|
41
43
|
},
|
|
42
44
|
"keywords": [
|
|
43
45
|
"claude-code",
|
|
@@ -24,9 +24,9 @@ const GEN_DIR = path.join(ROOT, "claudeos-core/generated");
|
|
|
24
24
|
function rel(p) { return path.relative(ROOT, p).replace(/\\/g, "/"); }
|
|
25
25
|
|
|
26
26
|
async function main() {
|
|
27
|
-
console.log("\n
|
|
27
|
+
console.log("\n╔═══════════════════════════════════════╗");
|
|
28
28
|
console.log("║ ClaudeOS-Core — Pass JSON Validator ║");
|
|
29
|
-
console.log("
|
|
29
|
+
console.log("╚═══════════════════════════════════════╝\n");
|
|
30
30
|
|
|
31
31
|
if (!fs.existsSync(GEN_DIR)) {
|
|
32
32
|
console.log(" ❌ claudeos-core/generated/ directory not found\n");
|
|
@@ -111,9 +111,7 @@ async function main() {
|
|
|
111
111
|
|
|
112
112
|
// ─── 3. pass1-*.json ──────────────────────────────────
|
|
113
113
|
console.log(" [3/4] pass1-*.json...");
|
|
114
|
-
const
|
|
115
|
-
// Exclude pass1-prompt.md
|
|
116
|
-
const pass1JsonFiles = pass1Files.filter(f => f.endsWith(".json"));
|
|
114
|
+
const pass1JsonFiles = await glob("pass1-*.json", { cwd: GEN_DIR, absolute: true });
|
|
117
115
|
if (pass1JsonFiles.length === 0) {
|
|
118
116
|
warnings.push({ file: "pass1-*.json", type: "NO_FILES", msg: "No pass1 JSON found (not yet executed?)" });
|
|
119
117
|
}
|
|
@@ -12,6 +12,7 @@ Analysis items (per domain):
|
|
|
12
12
|
- URL patterns (RESTful conventions, naming conventions, versioning)
|
|
13
13
|
- Parameter binding (@RequestBody, @PathVariable, @RequestParam, @ModelAttribute, @RequestHeader)
|
|
14
14
|
- Response format (ResponseEntity, custom response wrappers, direct return)
|
|
15
|
+
- If a custom response wrapper class exists, record its EXACT class name, EXACT method signatures (e.g., `success()`, `error()`), and EXACT import path. Do NOT guess or invent method names — read the actual source.
|
|
15
16
|
- Error handling (try-catch patterns, @ExceptionHandler, @ControllerAdvice)
|
|
16
17
|
- Authentication/authorization (@AuthenticationPrincipal, @PreAuthorize, SecurityContext)
|
|
17
18
|
- API documentation (Swagger/SpringDoc annotations)
|
|
@@ -47,6 +48,8 @@ Analysis items (per domain):
|
|
|
47
48
|
- Field type conventions (Boolean handling, date types, Enum management)
|
|
48
49
|
- Validation annotations (@NotNull, @NotBlank, @Size, @Pattern, custom)
|
|
49
50
|
- Conversion approach (MapStruct, ModelMapper, manual conversion)
|
|
51
|
+
- Import paths: record EXACT package paths for shared/utility classes
|
|
52
|
+
- Utility class locations: record EXACT package where shared utilities live
|
|
50
53
|
|
|
51
54
|
5. Interceptor/Filter/AOP Patterns
|
|
52
55
|
- HandlerInterceptor usage
|
|
@@ -93,7 +96,7 @@ Analysis items (per domain):
|
|
|
93
96
|
- Performance issues (N+1, unnecessary queries, memory waste)
|
|
94
97
|
- Security issues (SQL Injection potential, missing authorization)
|
|
95
98
|
|
|
96
|
-
Do not create files. Analysis only.
|
|
99
|
+
Do not create or modify source files. Analysis only.
|
|
97
100
|
Save results to claudeos-core/generated/pass1-{{PASS_NUM}}.json in the following format:
|
|
98
101
|
|
|
99
102
|
{
|
|
@@ -35,9 +35,9 @@ Merge items:
|
|
|
35
35
|
- DB table/column naming
|
|
36
36
|
|
|
37
37
|
6. Common Classes/Utilities List
|
|
38
|
-
- Base class fields (must not be redeclared)
|
|
39
|
-
- Shared utility classes
|
|
40
|
-
- Constants/Enum management approach
|
|
38
|
+
- Base class fields (must not be redeclared) with EXACT fully-qualified class names
|
|
39
|
+
- Shared utility classes with EXACT package paths (e.g., `com.company.common.util.DateUtils`)
|
|
40
|
+
- Constants/Enum management approach with EXACT locations
|
|
41
41
|
|
|
42
42
|
7. Security/Authentication Patterns
|
|
43
43
|
- Authentication method (JWT, Session, OAuth2)
|
|
@@ -4,6 +4,31 @@ generate all ClaudeOS-Core files based on the analysis results.
|
|
|
4
4
|
|
|
5
5
|
Do not read the original source code again. Reference only the analysis results.
|
|
6
6
|
|
|
7
|
+
CRITICAL — Build Tool Consistency:
|
|
8
|
+
Check `stack.buildTool` and `stack.packageManager` in project-analysis.json.
|
|
9
|
+
ALL generated files MUST use the detected build tool's commands (e.g., Gradle or Maven).
|
|
10
|
+
NEVER mix Gradle/Maven commands. Also verify actual task names from build files.
|
|
11
|
+
|
|
12
|
+
CRITICAL — Cross-file Consistency:
|
|
13
|
+
Rules (.claude/rules/) and Standards (claudeos-core/standard/) MUST NOT contradict each other.
|
|
14
|
+
If a standard defines a specific pattern (e.g., import path, file naming, API usage),
|
|
15
|
+
the corresponding rule MUST use the same pattern. Before generating each rule file,
|
|
16
|
+
verify it is consistent with the related standard file.
|
|
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
|
+
|
|
26
|
+
CRITICAL — CLAUDE.md Reference Table Completeness:
|
|
27
|
+
The reference table in CLAUDE.md MUST list ALL generated standard files, not just core.
|
|
28
|
+
Include all backend-api, security-db, infra, and verification standards.
|
|
29
|
+
Alternatively, add a note directing readers to .claude/rules/00.core/00.standard-reference.md
|
|
30
|
+
for the complete list.
|
|
31
|
+
|
|
7
32
|
Generation targets:
|
|
8
33
|
|
|
9
34
|
1. CLAUDE.md (project root)
|
|
@@ -39,19 +64,31 @@ Generation targets:
|
|
|
39
64
|
- Key rules summary table
|
|
40
65
|
|
|
41
66
|
3. .claude/rules/ (active domains only)
|
|
42
|
-
- Every rule file MUST include `paths: ["**/*"]` in YAML frontmatter — this ensures Claude Code always loads the rule regardless of which file is being edited
|
|
43
67
|
- Write the full rule content directly in each file (self-contained, no external references)
|
|
44
68
|
- Include 5-15 lines of key rules with concrete examples
|
|
45
69
|
- Do NOT use @import — it is not a Claude Code feature and does not work
|
|
46
|
-
-
|
|
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:
|
|
47
82
|
```
|
|
48
83
|
---
|
|
49
84
|
paths:
|
|
50
85
|
- "**/*"
|
|
51
86
|
---
|
|
52
|
-
#
|
|
53
|
-
|
|
54
|
-
##
|
|
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
|
|
55
92
|
- claudeos-core/standard/00.core/01.project-overview.md
|
|
56
93
|
- claudeos-core/standard/00.core/02.architecture.md
|
|
57
94
|
- claudeos-core/standard/00.core/03.naming-conventions.md
|
|
@@ -14,6 +14,7 @@ Analysis items (per domain):
|
|
|
14
14
|
- URL patterns (RESTful conventions, naming, versioning)
|
|
15
15
|
- Parameter binding (@RequestBody, @PathVariable, @RequestParam, @ModelAttribute)
|
|
16
16
|
- Response format (ResponseEntity, custom response wrappers, sealed class responses)
|
|
17
|
+
- If a custom response wrapper class exists, record its EXACT class name, EXACT method signatures (e.g., `success()`, `error()`), and EXACT import path. Do NOT guess or invent method names — read the actual source.
|
|
17
18
|
- Error handling (try-catch, @ExceptionHandler, @ControllerAdvice, Result/Either pattern)
|
|
18
19
|
- Authentication/authorization (@AuthenticationPrincipal, @PreAuthorize, SecurityContext)
|
|
19
20
|
- API documentation (Swagger/SpringDoc annotations)
|
|
@@ -61,6 +62,8 @@ Analysis items (per domain):
|
|
|
61
62
|
- Validation annotations (@field:NotNull, @field:NotBlank, @field:Size, custom)
|
|
62
63
|
- Conversion approach (mapstruct-kotlin, manual extension functions, toEntity/toDto)
|
|
63
64
|
- Serialization (Jackson Kotlin module, kotlinx.serialization)
|
|
65
|
+
- Import paths: record EXACT package paths for shared classes (e.g., `com.company.shared.util.DateUtils`, not an invented path)
|
|
66
|
+
- Utility class locations: record EXACT module and package where shared utilities live
|
|
64
67
|
|
|
65
68
|
6. Aggregate/Aggregate Root Patterns
|
|
66
69
|
- Aggregate boundary definition (which entities belong together)
|
|
@@ -126,7 +129,7 @@ Analysis items (per domain):
|
|
|
126
129
|
- Aggregate boundary violations (cross-aggregate direct references, oversized aggregates)
|
|
127
130
|
- VO misuse (mutable VOs, VOs with identity, DTO used where VO should be)
|
|
128
131
|
|
|
129
|
-
Do not create files. Analysis only.
|
|
132
|
+
Do not create or modify source files. Analysis only.
|
|
130
133
|
Save results to claudeos-core/generated/pass1-{{PASS_NUM}}.json in the following format:
|
|
131
134
|
|
|
132
135
|
{
|
|
@@ -43,11 +43,11 @@ Merge items:
|
|
|
43
43
|
- Module naming conventions (what suffix: -server, -lib, -adapter)
|
|
44
44
|
|
|
45
45
|
6. Common Classes/Utilities List
|
|
46
|
-
- Shared library (shared-lib) key classes and utilities
|
|
47
|
-
- Integration library (integration-lib) contracts and adapters
|
|
48
|
-
- Base classes (must not be redeclared)
|
|
49
|
-
- Shared constants/Enum management
|
|
50
|
-
- Common extension functions
|
|
46
|
+
- Shared library (shared-lib) key classes and utilities with EXACT package paths (e.g., `com.company.shared.util.DateUtils`)
|
|
47
|
+
- Integration library (integration-lib) contracts and adapters with EXACT package paths
|
|
48
|
+
- Base classes (must not be redeclared) with EXACT fully-qualified class names
|
|
49
|
+
- Shared constants/Enum management with EXACT locations
|
|
50
|
+
- Common extension functions with EXACT file locations
|
|
51
51
|
|
|
52
52
|
7. BFF Patterns Summary
|
|
53
53
|
- Feign Client declaration conventions
|
|
@@ -4,6 +4,31 @@ generate all ClaudeOS-Core files based on the analysis results.
|
|
|
4
4
|
|
|
5
5
|
Do not read the original source code again. Reference only the analysis results.
|
|
6
6
|
|
|
7
|
+
CRITICAL — Build Tool Consistency:
|
|
8
|
+
Check `stack.buildTool` and `stack.packageManager` in project-analysis.json.
|
|
9
|
+
ALL generated files MUST use the detected build tool's commands (e.g., Gradle tasks).
|
|
10
|
+
NEVER mix Gradle/Maven commands. Also verify actual task names from build.gradle(.kts).
|
|
11
|
+
|
|
12
|
+
CRITICAL — Cross-file Consistency:
|
|
13
|
+
Rules (.claude/rules/) and Standards (claudeos-core/standard/) MUST NOT contradict each other.
|
|
14
|
+
If a standard defines a specific pattern (e.g., import path, file naming, API usage),
|
|
15
|
+
the corresponding rule MUST use the same pattern. Before generating each rule file,
|
|
16
|
+
verify it is consistent with the related standard file.
|
|
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
|
+
|
|
26
|
+
CRITICAL — CLAUDE.md Reference Table Completeness:
|
|
27
|
+
The reference table in CLAUDE.md MUST list ALL generated standard files, not just core.
|
|
28
|
+
Include all backend-api, security-db, infra, and verification standards.
|
|
29
|
+
Alternatively, add a note directing readers to .claude/rules/00.core/00.standard-reference.md
|
|
30
|
+
for the complete list.
|
|
31
|
+
|
|
7
32
|
Generation targets:
|
|
8
33
|
|
|
9
34
|
1. CLAUDE.md (project root)
|
|
@@ -42,20 +67,32 @@ Generation targets:
|
|
|
42
67
|
- Key rules summary table
|
|
43
68
|
|
|
44
69
|
3. .claude/rules/ (active domains only)
|
|
45
|
-
- Every rule file MUST include `paths: ["**/*"]` in YAML frontmatter — this ensures Claude Code always loads the rule regardless of which file is being edited
|
|
46
70
|
- Write the full rule content directly in each file (self-contained, no external references)
|
|
47
71
|
- Include 5-15 lines of key rules with concrete examples
|
|
48
72
|
- Do NOT use @import — it is not a Claude Code feature and does not work
|
|
49
73
|
- CQRS-specific rules: include command/query separation rules directly in the rule file content
|
|
50
|
-
-
|
|
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:
|
|
51
86
|
```
|
|
52
87
|
---
|
|
53
88
|
paths:
|
|
54
89
|
- "**/*"
|
|
55
90
|
---
|
|
56
|
-
#
|
|
57
|
-
|
|
58
|
-
##
|
|
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
|
|
59
96
|
- claudeos-core/standard/00.core/01.project-overview.md
|
|
60
97
|
- claudeos-core/standard/00.core/02.architecture.md
|
|
61
98
|
- claudeos-core/standard/00.core/03.naming-conventions.md
|
|
@@ -12,6 +12,7 @@ Analysis items (per domain):
|
|
|
12
12
|
- URL patterns (RESTful conventions, naming, versioning)
|
|
13
13
|
- Parameter handling (req.body, req.params, req.query, @Body(), @Param(), @Query())
|
|
14
14
|
- Response format (res.json, interceptor, class-transformer, custom wrapper)
|
|
15
|
+
- If a custom response wrapper/helper exists, record its EXACT function/class name, EXACT method signatures, and EXACT import path. Do NOT guess — read the actual source.
|
|
15
16
|
- Error handling (try-catch, HttpException, ExceptionFilter, error middleware)
|
|
16
17
|
- Authentication (Passport, JWT Guard, custom middleware)
|
|
17
18
|
- API documentation (Swagger @ApiTags, @ApiOperation, JSDoc)
|
|
@@ -40,6 +41,8 @@ Analysis items (per domain):
|
|
|
40
41
|
- TypeScript usage level (interface vs type vs class, Generic usage)
|
|
41
42
|
- Serialization/deserialization (class-transformer, custom serializer)
|
|
42
43
|
- Enum/constants management
|
|
44
|
+
- File entry pattern: is the main file `index.ts` or named by module (e.g., `users.controller.ts`)? Record the exact convention.
|
|
45
|
+
- Import paths: record EXACT path aliases and import patterns used (e.g., `@/modules/`, `@app/`, relative paths)
|
|
43
46
|
|
|
44
47
|
5. Configuration/Environment Patterns
|
|
45
48
|
- Environment variable management (@nestjs/config, dotenv, envalid)
|
|
@@ -81,7 +84,7 @@ Analysis items (per domain):
|
|
|
81
84
|
- Performance issues (memory leaks, blocking I/O)
|
|
82
85
|
- Security issues (injection, missing authorization)
|
|
83
86
|
|
|
84
|
-
Do not create files. Analysis only.
|
|
87
|
+
Do not create or modify source files. Analysis only.
|
|
85
88
|
Save results to claudeos-core/generated/pass1-{{PASS_NUM}}.json in the following format:
|
|
86
89
|
|
|
87
90
|
{
|
|
@@ -29,12 +29,15 @@ Merge items:
|
|
|
29
29
|
|
|
30
30
|
5. Naming Conventions Summary
|
|
31
31
|
- File/directory naming (kebab-case, camelCase, PascalCase)
|
|
32
|
+
- File entry pattern (index.ts vs module-named files — pick ONE that the project actually uses)
|
|
32
33
|
- DTO/type naming conventions
|
|
33
34
|
- Route URL patterns
|
|
34
35
|
- Module/package structure conventions
|
|
35
36
|
|
|
36
37
|
6. Common Types/Interfaces List
|
|
37
|
-
- Shared type definition files
|
|
38
|
+
- Shared type definition files with EXACT import paths
|
|
39
|
+
- Utility functions with EXACT import paths
|
|
40
|
+
- Path aliases used in the project (e.g., `@/` → `src/`)
|
|
38
41
|
- Utility types
|
|
39
42
|
- Environment variable types
|
|
40
43
|
- Constants/Enum management
|
|
@@ -4,11 +4,37 @@ generate all ClaudeOS-Core files based on the analysis results.
|
|
|
4
4
|
|
|
5
5
|
Do not read the original source code again. Reference only the analysis results.
|
|
6
6
|
|
|
7
|
+
CRITICAL — Package Manager Consistency:
|
|
8
|
+
Check `stack.packageManager` in project-analysis.json (e.g., "pnpm", "yarn", "npm").
|
|
9
|
+
ALL generated files MUST use ONLY that detected package manager's commands.
|
|
10
|
+
For example, if packageManager is "pnpm": use `pnpm run build`, `pnpm run dev`, `pnpm install`, etc.
|
|
11
|
+
NEVER mix npm/yarn/pnpm commands. Also check `scripts` field in the project's package.json
|
|
12
|
+
for actual script names (e.g., "eslint" not "lint", "typecheck" not "tsc --noEmit").
|
|
13
|
+
|
|
14
|
+
CRITICAL — Cross-file Consistency:
|
|
15
|
+
Rules (.claude/rules/) and Standards (claudeos-core/standard/) MUST NOT contradict each other.
|
|
16
|
+
If a standard defines a specific pattern (e.g., import path, file naming, API usage),
|
|
17
|
+
the corresponding rule MUST use the same pattern. Before generating each rule file,
|
|
18
|
+
verify it is consistent with the related standard file.
|
|
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
|
+
|
|
27
|
+
CRITICAL — CLAUDE.md Reference Table Completeness:
|
|
28
|
+
The reference table in CLAUDE.md MUST list ALL generated standard files, not just core.
|
|
29
|
+
Include all frontend-ui, backend-api, security-db, infra, and verification standards.
|
|
30
|
+
Alternatively, add a note directing readers to .claude/rules/00.core/00.standard-reference.md
|
|
31
|
+
for the complete list.
|
|
32
|
+
|
|
7
33
|
Generation targets:
|
|
8
34
|
|
|
9
35
|
1. CLAUDE.md (project root)
|
|
10
36
|
- Role definition (based on detected stack)
|
|
11
|
-
- Build & Run Commands (npm/yarn/pnpm)
|
|
37
|
+
- Build & Run Commands (use ONLY the detected packageManager — never hardcode npm/yarn/pnpm)
|
|
12
38
|
- Core architecture diagram
|
|
13
39
|
- DB table/collection naming
|
|
14
40
|
- Standard/Skills/Guide reference table
|
|
@@ -38,19 +64,31 @@ Generation targets:
|
|
|
38
64
|
- Key rules summary table
|
|
39
65
|
|
|
40
66
|
3. .claude/rules/ (active domains only)
|
|
41
|
-
- Every rule file MUST include `paths: ["**/*"]` in YAML frontmatter — this ensures Claude Code always loads the rule regardless of which file is being edited
|
|
42
67
|
- Write the full rule content directly in each file (self-contained, no external references)
|
|
43
68
|
- Include 5-15 lines of key rules with concrete examples
|
|
44
69
|
- Do NOT use @import — it is not a Claude Code feature and does not work
|
|
45
|
-
-
|
|
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:
|
|
46
82
|
```
|
|
47
83
|
---
|
|
48
84
|
paths:
|
|
49
85
|
- "**/*"
|
|
50
86
|
---
|
|
51
|
-
#
|
|
52
|
-
|
|
53
|
-
##
|
|
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
|
|
54
92
|
- claudeos-core/standard/00.core/01.project-overview.md
|
|
55
93
|
- claudeos-core/standard/00.core/02.architecture.md
|
|
56
94
|
- claudeos-core/standard/00.core/03.naming-conventions.md
|
|
@@ -19,9 +19,13 @@ Analysis items (per domain):
|
|
|
19
19
|
- Component structure (functional, forwardRef, memo)
|
|
20
20
|
- Props type definition (interface vs type, Generic usage)
|
|
21
21
|
- State management (useState, useReducer, external libraries)
|
|
22
|
-
- Styling (
|
|
23
|
-
-
|
|
22
|
+
- Styling approach and exact import paths (e.g., `import styles from './index.module.scss'`, `import { cn } from '@/lib/utils'`)
|
|
23
|
+
- Styling utility functions: record the EXACT import path used in source code (e.g., `from '@lfos-poc-ui/utils'` NOT `from '@app/shared/lib/classNames'`)
|
|
24
|
+
- UI library and exact package names (e.g., `@lfos-poc-ui/ui`, `@shadcn/ui`, `@mui/material`)
|
|
24
25
|
- Component classification (UI, Feature, Layout, Page)
|
|
26
|
+
- Component entry file pattern: is the main file `index.tsx` or `ComponentName.tsx`? Record exactly which pattern the project uses.
|
|
27
|
+
- Directory structure pattern: record exact convention (e.g., `ComponentName/index.tsx` vs `ComponentName/ComponentName.tsx`)
|
|
28
|
+
- export pattern: default export vs named export in component files
|
|
25
29
|
- Reuse patterns (composition, compound components, render props)
|
|
26
30
|
- Accessibility (ARIA, semantic HTML, keyboard navigation)
|
|
27
31
|
|
|
@@ -79,7 +83,7 @@ Analysis items (per domain):
|
|
|
79
83
|
- Accessibility issues
|
|
80
84
|
- Security issues (XSS, CSRF)
|
|
81
85
|
|
|
82
|
-
Do not create files. Analysis only.
|
|
86
|
+
Do not create or modify source files. Analysis only.
|
|
83
87
|
Save results to claudeos-core/generated/pass1-{{PASS_NUM}}.json in the following format:
|
|
84
88
|
|
|
85
89
|
{
|
|
@@ -97,7 +101,13 @@ Save results to claudeos-core/generated/pass1-{{PASS_NUM}}.json in the following
|
|
|
97
101
|
},
|
|
98
102
|
"patterns": {
|
|
99
103
|
"page": { ... },
|
|
100
|
-
"component": {
|
|
104
|
+
"component": {
|
|
105
|
+
"entryFilePattern": "index.tsx or ComponentName.tsx",
|
|
106
|
+
"exportPattern": "default export or named export",
|
|
107
|
+
"stylingImport": "exact import statement used for styling utility",
|
|
108
|
+
"uiLibraryImport": "exact import statement for UI components",
|
|
109
|
+
...
|
|
110
|
+
},
|
|
101
111
|
"dataFetching": { ... },
|
|
102
112
|
"stateManagement": { ... },
|
|
103
113
|
"config": { ... },
|
|
@@ -27,14 +27,16 @@ Merge items:
|
|
|
27
27
|
|
|
28
28
|
5. Naming Conventions Summary
|
|
29
29
|
- File/directory naming (kebab-case, PascalCase)
|
|
30
|
-
- Component
|
|
30
|
+
- Component entry file pattern (index.tsx vs ComponentName.tsx — pick ONE that the project actually uses)
|
|
31
|
+
- Component export pattern (default export vs named export)
|
|
31
32
|
- Hook naming (use* prefix)
|
|
32
33
|
- API route patterns
|
|
33
34
|
|
|
34
35
|
6. Shared Types/Components List
|
|
35
|
-
- Common UI components
|
|
36
|
-
- Shared hooks
|
|
37
|
-
- Utility functions
|
|
36
|
+
- Common UI components with EXACT import paths (e.g., `from '@lfos-poc-ui/ui'`, NOT invented paths)
|
|
37
|
+
- Shared hooks with exact import paths
|
|
38
|
+
- Utility functions with EXACT import paths (e.g., `from '@lfos-poc-ui/utils'` for classNamesWithRoot)
|
|
39
|
+
- Path aliases used in the project (e.g., `@app/` → `src/`, `@/` → `src/`)
|
|
38
40
|
- Environment variable types
|
|
39
41
|
- Constants/Enum management
|
|
40
42
|
|