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.

Files changed (44) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/README.de.md +50 -10
  3. package/README.es.md +51 -10
  4. package/README.fr.md +51 -10
  5. package/README.hi.md +51 -10
  6. package/README.ja.md +52 -10
  7. package/README.ko.md +51 -10
  8. package/README.md +62 -15
  9. package/README.ru.md +51 -10
  10. package/README.vi.md +51 -10
  11. package/README.zh-CN.md +51 -10
  12. package/bin/cli.js +171 -36
  13. package/bootstrap.sh +71 -23
  14. package/content-validator/index.js +16 -13
  15. package/health-checker/index.js +4 -3
  16. package/lib/safe-fs.js +110 -0
  17. package/manifest-generator/index.js +13 -7
  18. package/package.json +4 -2
  19. package/pass-json-validator/index.js +3 -5
  20. package/pass-prompts/templates/java-spring/pass1.md +4 -1
  21. package/pass-prompts/templates/java-spring/pass2.md +3 -3
  22. package/pass-prompts/templates/java-spring/pass3.md +42 -5
  23. package/pass-prompts/templates/kotlin-spring/pass1.md +4 -1
  24. package/pass-prompts/templates/kotlin-spring/pass2.md +5 -5
  25. package/pass-prompts/templates/kotlin-spring/pass3.md +42 -5
  26. package/pass-prompts/templates/node-express/pass1.md +4 -1
  27. package/pass-prompts/templates/node-express/pass2.md +4 -1
  28. package/pass-prompts/templates/node-express/pass3.md +44 -6
  29. package/pass-prompts/templates/node-nextjs/pass1.md +14 -4
  30. package/pass-prompts/templates/node-nextjs/pass2.md +6 -4
  31. package/pass-prompts/templates/node-nextjs/pass3.md +45 -6
  32. package/pass-prompts/templates/python-django/pass1.md +4 -2
  33. package/pass-prompts/templates/python-django/pass2.md +4 -4
  34. package/pass-prompts/templates/python-django/pass3.md +42 -5
  35. package/pass-prompts/templates/python-fastapi/pass1.md +4 -1
  36. package/pass-prompts/templates/python-fastapi/pass2.md +4 -4
  37. package/pass-prompts/templates/python-fastapi/pass3.md +42 -5
  38. package/plan-installer/domain-grouper.js +74 -0
  39. package/plan-installer/index.js +35 -1305
  40. package/plan-installer/prompt-generator.js +94 -0
  41. package/plan-installer/stack-detector.js +326 -0
  42. package/plan-installer/structure-scanner.js +783 -0
  43. package/plan-validator/index.js +84 -20
  44. package/sync-checker/index.js +7 -3
@@ -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, dev/build/start)
37
+ - Build & Run Commands (use ONLY the detected packageManager — never hardcode npm/yarn/pnpm)
12
38
  - Core architecture diagram
13
39
  - Directory structure description
14
40
  - Standard/Skills/Guide reference table
@@ -36,19 +62,32 @@ Generation targets:
36
62
  - Key rules summary table
37
63
 
38
64
  3. .claude/rules/ (active domains only)
39
- - Every rule file MUST include `paths: ["**/*"]` in YAML frontmatter — this ensures Claude Code always loads the rule regardless of which file is being edited
40
65
  - Write the full rule content directly in each file (self-contained, no external references)
41
66
  - Include 5-15 lines of key rules with concrete examples
42
67
  - Do NOT use @import — it is not a Claude Code feature and does not work
43
- - 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:
68
+ - Each rule file MUST end with a `## Reference` section linking to the corresponding standard file(s):
69
+ ```
70
+ ## Reference
71
+ > For detailed patterns and examples, Read: claudeos-core/standard/20.frontend-ui/01.component-patterns.md
72
+ ```
73
+ - `paths:` frontmatter per rule category:
74
+ - `00.core/*` rules: `paths: ["**/*"]` — always loaded (architecture, naming are universally needed)
75
+ - `10.backend/*` rules: `paths: ["**/*"]` — always loaded (backend rules needed for any source editing)
76
+ - `20.frontend/*` rules: `paths: ["**/*"]` — always loaded (frontend rules needed for any source editing)
77
+ - `30.security-db/*` rules: `paths: ["**/*"]` — always loaded (cross-cutting concerns)
78
+ - `40.infra/*` rules: `paths: ["**/*.json", "**/*.env*", "**/next.config.*", "**/Dockerfile*", "**/*.yml", "**/*.yaml"]` — loaded only for config/infra files
79
+ - `50.sync/*` rules: `paths: ["**/claudeos-core/**", "**/.claude/**"]` — loaded only when editing claudeos-core files
80
+ - 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:
44
81
  ```
45
82
  ---
46
83
  paths:
47
84
  - "**/*"
48
85
  ---
49
- # Required Standard Documents
50
- Before writing or modifying code, you MUST Read the relevant standard files below using the Read tool.
51
- ## Core (always read)
86
+ # Standard Documents Directory
87
+ Below is the complete list of standard files. Read ONLY the ones relevant to your current task do NOT read all files.
88
+ Each rule file in .claude/rules/ links to its corresponding standard in the ## Reference section. Follow those links first.
89
+ This directory is for discovering standards that have no corresponding rule file.
90
+ ## Core
52
91
  - claudeos-core/standard/00.core/01.project-overview.md
53
92
  - claudeos-core/standard/00.core/02.architecture.md
54
93
  - claudeos-core/standard/00.core/03.naming-conventions.md
@@ -11,6 +11,7 @@ Analysis items (per domain):
11
11
  - URL configuration (urlpatterns, Router registration, namespace)
12
12
  - Parameter handling (request.data, serializer, query_params, kwargs)
13
13
  - Response format (Response, JsonResponse, TemplateResponse)
14
+ - If a custom response wrapper/mixin exists, record its EXACT class name, EXACT method signatures, and EXACT import path. Do NOT guess — read the actual source.
14
15
  - Error handling (exception_handler, DRF exceptions, custom exceptions)
15
16
  - Authentication (permission_classes, authentication_classes)
16
17
  - API documentation (drf-spectacular, drf-yasg, @extend_schema)
@@ -38,8 +39,9 @@ Analysis items (per domain):
38
39
  - Architecture (Fat Model vs Service Layer vs Domain Service)
39
40
  - Transactions (transaction.atomic, select_for_update, savepoint)
40
41
  - Celery tasks (shared_task, retry, priority)
41
- - Utility/helper functions
42
+ - Utility/helper functions with EXACT import paths (e.g., `from apps.common.utils import format_date`)
42
43
  - Event handling (django-signals, custom event bus)
44
+ - Import paths: record EXACT import conventions used in the project (relative vs absolute, app prefix)
43
45
 
44
46
  5. Configuration/Environment Patterns
45
47
  - Settings separation (base/local/staging/production)
@@ -87,7 +89,7 @@ Analysis items (per domain):
87
89
  - Security issues (SQL Injection, missing authorization, CSRF)
88
90
  - Performance issues (unnecessary queries, memory)
89
91
 
90
- Do not create files. Analysis only.
92
+ Do not create or modify source files. Analysis only.
91
93
  Save results to claudeos-core/generated/pass1-{{PASS_NUM}}.json in the following format:
92
94
 
93
95
  {
@@ -34,10 +34,10 @@ Merge items:
34
34
  - Test file structure
35
35
 
36
36
  6. Common Models/Utilities List
37
- - Abstract model fields
38
- - Shared Manager/QuerySet
39
- - Utility functions
40
- - Constants/Enum management
37
+ - Abstract model fields with EXACT import paths (e.g., `from apps.common.models import BaseModel`)
38
+ - Shared Manager/QuerySet with EXACT module locations
39
+ - Utility functions with EXACT import paths
40
+ - Constants/Enum management with EXACT locations
41
41
 
42
42
  7. Security/Authentication Patterns
43
43
  - Authentication method (JWT, Session, Token, 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 — Package Manager Consistency:
8
+ Check `stack.packageManager` in project-analysis.json (e.g., "poetry", "pipenv", "pip").
9
+ ALL generated files MUST use ONLY that detected package manager's commands.
10
+ For example, if packageManager is "poetry": use `poetry run`, `poetry add`, etc.
11
+ NEVER mix pip/poetry/pipenv commands. Also check actual script names in pyproject.toml or Makefile.
12
+
13
+ CRITICAL — Cross-file Consistency:
14
+ Rules (.claude/rules/) and Standards (claudeos-core/standard/) MUST NOT contradict each other.
15
+ If a standard defines a specific pattern (e.g., import path, file naming, API usage),
16
+ the corresponding rule MUST use the same pattern. Before generating each rule file,
17
+ verify it is consistent with the related standard file.
18
+
19
+ CRITICAL — Code Example Accuracy:
20
+ ALL code examples in rules and standards MUST use EXACT method names, class names,
21
+ and signatures from pass2-merged.json analysis data.
22
+ Do NOT paraphrase, rename, or infer API names.
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)
@@ -38,19 +63,31 @@ Generation targets:
38
63
  - Key rules summary table
39
64
 
40
65
  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
66
  - Write the full rule content directly in each file (self-contained, no external references)
43
67
  - Include 5-15 lines of key rules with concrete examples
44
68
  - Do NOT use @import — it is not a Claude Code feature and does not work
45
- - 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:
69
+ - Each rule file MUST end with a `## Reference` section linking to the corresponding standard file(s):
70
+ ```
71
+ ## Reference
72
+ > For detailed patterns and examples, Read: claudeos-core/standard/10.backend-api/01.view-patterns.md
73
+ ```
74
+ - `paths:` frontmatter per rule category:
75
+ - `00.core/*` rules: `paths: ["**/*"]` — always loaded (architecture, naming are universally needed)
76
+ - `10.backend/*` rules: `paths: ["**/*"]` — always loaded (backend rules needed for any source editing)
77
+ - `30.security-db/*` rules: `paths: ["**/*"]` — always loaded (cross-cutting concerns)
78
+ - `40.infra/*` rules: `paths: ["**/*"]` — always loaded (Django settings are .py files, so infra paths cannot be scoped separately)
79
+ - `50.sync/*` rules: `paths: ["**/claudeos-core/**", "**/.claude/**"]` — loaded only when editing claudeos-core files
80
+ - 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
81
  ```
47
82
  ---
48
83
  paths:
49
84
  - "**/*"
50
85
  ---
51
- # Required Standard Documents
52
- Before writing or modifying code, you MUST Read the relevant standard files below using the Read tool.
53
- ## Core (always read)
86
+ # Standard Documents Directory
87
+ Below is the complete list of standard files. Read ONLY the ones relevant to your current task do NOT read all files.
88
+ Each rule file in .claude/rules/ links to its corresponding standard in the ## Reference section. Follow those links first.
89
+ This directory is for discovering standards that have no corresponding rule file.
90
+ ## Core
54
91
  - claudeos-core/standard/00.core/01.project-overview.md
55
92
  - claudeos-core/standard/00.core/02.architecture.md
56
93
  - claudeos-core/standard/00.core/03.naming-conventions.md
@@ -11,6 +11,7 @@ Analysis items (per domain):
11
11
  - Path decorators (@router.get, @router.post, @router.put, @router.delete)
12
12
  - Parameter handling (Path, Query, Body, Header, Cookie, Depends)
13
13
  - Response model (response_model, status_code, response_class)
14
+ - If a custom response wrapper/schema exists, record its EXACT class name, EXACT method signatures, and EXACT import path. Do NOT guess — read the actual source.
14
15
  - Error handling (HTTPException, exception_handler, custom exceptions)
15
16
  - Authentication (Depends-based JWT/OAuth2, Security schemes)
16
17
  - API documentation (auto OpenAPI, tags, summary, description, deprecated)
@@ -40,6 +41,8 @@ Analysis items (per domain):
40
41
  - Dependency hierarchy (nested Depends)
41
42
  - Custom dependency functions/classes
42
43
  - Lifecycle events (lifespan, startup/shutdown)
44
+ - Import paths: record EXACT import conventions (e.g., `from app.core.deps import get_db`, not invented paths)
45
+ - Utility function locations: record EXACT module paths for shared utilities
43
46
  - Dependency overrides (for testing)
44
47
 
45
48
  5. Configuration/Environment Patterns
@@ -90,7 +93,7 @@ Analysis items (per domain):
90
93
  - Security issues (injection, missing authorization)
91
94
  - Performance issues (blocking I/O, N+1)
92
95
 
93
- Do not create files. Analysis only.
96
+ Do not create or modify source files. Analysis only.
94
97
  Save results to claudeos-core/generated/pass1-{{PASS_NUM}}.json in the following format:
95
98
 
96
99
  {
@@ -33,10 +33,10 @@ Merge items:
33
33
  - File structure conventions
34
34
 
35
35
  6. Common Models/Utilities List
36
- - Base model fields
37
- - Shared dependency functions
38
- - Utility functions
39
- - Constants/Enum management
36
+ - Base model fields with EXACT import paths (e.g., `from app.core.base import BaseModel`)
37
+ - Shared dependency functions with EXACT module paths
38
+ - Utility functions with EXACT import paths
39
+ - Constants/Enum management with EXACT locations
40
40
 
41
41
  7. Security/Authentication Patterns
42
42
  - Authentication method (JWT Bearer, OAuth2PasswordBearer)
@@ -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 — Package Manager Consistency:
8
+ Check `stack.packageManager` in project-analysis.json (e.g., "poetry", "pipenv", "pip").
9
+ ALL generated files MUST use ONLY that detected package manager's commands.
10
+ For example, if packageManager is "poetry": use `poetry run`, `poetry add`, etc.
11
+ NEVER mix pip/poetry/pipenv commands. Also check actual script names in pyproject.toml or Makefile.
12
+
13
+ CRITICAL — Cross-file Consistency:
14
+ Rules (.claude/rules/) and Standards (claudeos-core/standard/) MUST NOT contradict each other.
15
+ If a standard defines a specific pattern (e.g., import path, file naming, API usage),
16
+ the corresponding rule MUST use the same pattern. Before generating each rule file,
17
+ verify it is consistent with the related standard file.
18
+
19
+ CRITICAL — Code Example Accuracy:
20
+ ALL code examples in rules and standards MUST use EXACT method names, class names,
21
+ and signatures from pass2-merged.json analysis data.
22
+ Do NOT paraphrase, rename, or infer API names.
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)
@@ -38,19 +63,31 @@ Generation targets:
38
63
  - Key rules summary table
39
64
 
40
65
  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
66
  - Write the full rule content directly in each file (self-contained, no external references)
43
67
  - Include 5-15 lines of key rules with concrete examples
44
68
  - Do NOT use @import — it is not a Claude Code feature and does not work
45
- - 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:
69
+ - Each rule file MUST end with a `## Reference` section linking to the corresponding standard file(s):
70
+ ```
71
+ ## Reference
72
+ > For detailed patterns and examples, Read: claudeos-core/standard/10.backend-api/01.router-endpoint-patterns.md
73
+ ```
74
+ - `paths:` frontmatter per rule category:
75
+ - `00.core/*` rules: `paths: ["**/*"]` — always loaded (architecture, naming are universally needed)
76
+ - `10.backend/*` rules: `paths: ["**/*"]` — always loaded (backend rules needed for any source editing)
77
+ - `30.security-db/*` rules: `paths: ["**/*"]` — always loaded (cross-cutting concerns)
78
+ - `40.infra/*` rules: `paths: ["**/*.toml", "**/*.env*", "**/config/**", "**/Dockerfile*", "**/*.yml", "**/*.yaml"]` — loaded only for config/infra files
79
+ - `50.sync/*` rules: `paths: ["**/claudeos-core/**", "**/.claude/**"]` — loaded only when editing claudeos-core files
80
+ - 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
81
  ```
47
82
  ---
48
83
  paths:
49
84
  - "**/*"
50
85
  ---
51
- # Required Standard Documents
52
- Before writing or modifying code, you MUST Read the relevant standard files below using the Read tool.
53
- ## Core (always read)
86
+ # Standard Documents Directory
87
+ Below is the complete list of standard files. Read ONLY the ones relevant to your current task do NOT read all files.
88
+ Each rule file in .claude/rules/ links to its corresponding standard in the ## Reference section. Follow those links first.
89
+ This directory is for discovering standards that have no corresponding rule file.
90
+ ## Core
54
91
  - claudeos-core/standard/00.core/01.project-overview.md
55
92
  - claudeos-core/standard/00.core/02.architecture.md
56
93
  - claudeos-core/standard/00.core/03.naming-conventions.md
@@ -0,0 +1,74 @@
1
+ /**
2
+ * ClaudeOS-Core — Domain Grouper
3
+ *
4
+ * Splits domains into analysis groups, determines active domains,
5
+ * and selects appropriate templates based on detected stack.
6
+ */
7
+
8
+ function splitDomainGroups(domains, type, template) {
9
+ const MAX_FILES_PER_GROUP = 40;
10
+ const MAX_DOMAINS_PER_GROUP = 4;
11
+ const groups = [];
12
+ let current = [];
13
+ let fileCount = 0;
14
+
15
+ for (const d of domains) {
16
+ // Flush current group before adding if it would exceed limits
17
+ if (current.length > 0 && (fileCount + d.totalFiles >= MAX_FILES_PER_GROUP || current.length >= MAX_DOMAINS_PER_GROUP)) {
18
+ groups.push({ type, template, domains: [...current], estimatedFiles: fileCount });
19
+ current = [];
20
+ fileCount = 0;
21
+ }
22
+ current.push(d.name);
23
+ fileCount += d.totalFiles;
24
+ }
25
+ if (current.length > 0) {
26
+ groups.push({ type, template, domains: [...current], estimatedFiles: fileCount });
27
+ }
28
+
29
+ return groups;
30
+ }
31
+
32
+ // ─── Determine active domains ───────────────────────────────────
33
+ function determineActiveDomains(stack) {
34
+ const isBackend = !!stack.framework;
35
+ return {
36
+ "00.core": true,
37
+ "10.backend": !!isBackend,
38
+ "20.frontend": !!stack.frontend,
39
+ "30.security-db": !!(stack.database || stack.framework),
40
+ "40.infra": true,
41
+ "50.verification": true,
42
+ "90.optional": true,
43
+ };
44
+ }
45
+
46
+ // ─── Template selection (multi-stack) ──────────────────────────────
47
+ function selectTemplates(stack) {
48
+ const templates = { backend: null, frontend: null };
49
+
50
+ // Backend template
51
+ if (stack.language === "kotlin") templates.backend = "kotlin-spring";
52
+ else if (stack.language === "java") templates.backend = "java-spring";
53
+ else if (stack.framework === "express" || stack.framework === "nestjs") templates.backend = "node-express";
54
+ else if (stack.framework === "django") templates.backend = "python-django";
55
+ else if (stack.framework === "fastapi" || stack.framework === "flask") templates.backend = "python-fastapi";
56
+ else if (stack.language === "typescript" || stack.language === "javascript") templates.backend = "node-express";
57
+ else if (stack.language === "python") templates.backend = "python-fastapi";
58
+
59
+ // Frontend template
60
+ if (stack.frontend === "nextjs" || stack.frontend === "react" || stack.frontend === "vue") {
61
+ templates.frontend = "node-nextjs";
62
+ }
63
+
64
+ // Pure frontend project with no backend
65
+ if (!templates.backend && templates.frontend) {
66
+ templates.backend = null;
67
+ }
68
+
69
+ return templates;
70
+ }
71
+
72
+ // ─── Dynamic prompt generation (multi-stack) ──────────────────────
73
+
74
+ module.exports = { splitDomainGroups, determineActiveDomains, selectTemplates };