claudeos-core 1.6.2 → 1.7.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.
- package/CHANGELOG.md +26 -0
- package/README.de.md +655 -653
- package/README.es.md +657 -655
- package/README.fr.md +657 -655
- package/README.hi.md +656 -654
- package/README.ja.md +675 -673
- package/README.ko.md +692 -690
- package/README.md +712 -710
- package/README.ru.md +656 -654
- package/README.vi.md +656 -654
- package/README.zh-CN.md +656 -654
- package/bin/commands/init.js +386 -357
- package/package.json +1 -1
- package/pass-prompts/templates/common/pass3-footer.md +23 -3
- package/pass-prompts/templates/node-vite/pass1.md +117 -0
- package/pass-prompts/templates/node-vite/pass2.md +78 -0
- package/pass-prompts/templates/node-vite/pass3.md +103 -0
- package/plan-installer/domain-grouper.js +75 -73
- package/plan-installer/index.js +129 -126
- package/plan-installer/scanners/scan-frontend.js +264 -254
- package/plan-installer/scanners/scan-node.js +57 -46
- package/plan-installer/scanners/scan-python.js +64 -55
- package/plan-installer/stack-detector.js +466 -454
- package/plan-installer/structure-scanner.js +65 -65
package/package.json
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
|
|
2
|
+
CRITICAL — No Hallucination Guard:
|
|
3
|
+
You may ONLY reference technologies that are explicitly present in the two files you read:
|
|
4
|
+
project-analysis.json (stack detection results) and pass2-merged.json (code analysis results).
|
|
5
|
+
If a library, framework, tool, or pattern does NOT appear in either of these files,
|
|
6
|
+
you MUST NOT mention it, generate code examples for it, or assume it exists — not in
|
|
7
|
+
standards, rules, skills, guides, database docs, or CLAUDE.md.
|
|
8
|
+
Do NOT infer or guess technologies from other detected technologies.
|
|
9
|
+
Examples of violations:
|
|
10
|
+
- Writing "React Query caching" when pass2-merged.json has no TanStack Query / React Query entry
|
|
11
|
+
- Adding "Zustand store pattern" when pass2-merged.json has no Zustand usage
|
|
12
|
+
- Generating "Prisma schema" examples when project-analysis.json ORM is not Prisma
|
|
13
|
+
- Assuming React Query exists because Orval was detected (inference is NOT detection)
|
|
14
|
+
When in doubt, omit. Missing content is fixable; hallucinated content erodes trust.
|
|
15
|
+
|
|
16
|
+
CRITICAL — Skill Orchestrator Completeness:
|
|
17
|
+
The orchestrator file (e.g., 01.scaffold-page-feature.md, 01.scaffold-crud-feature.md)
|
|
18
|
+
MUST list ALL sub-skill files in its execution order table with no gaps.
|
|
19
|
+
Every sub-skill file generated in the scaffold directory MUST have a corresponding row.
|
|
20
|
+
Do NOT skip any number in the sequence.
|
|
21
|
+
|
|
22
|
+
After completion, run the following commands in order:
|
|
23
|
+
1. npx claudeos-core health
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
Read claudeos-core/generated/project-analysis.json and
|
|
2
|
+
perform a deep analysis of the following domains only: {{DOMAIN_GROUP}}
|
|
3
|
+
|
|
4
|
+
For each domain, select one representative file per layer, read its code, and analyze it.
|
|
5
|
+
Prioritize files with the richest patterns.
|
|
6
|
+
|
|
7
|
+
Analysis items (per domain):
|
|
8
|
+
|
|
9
|
+
1. Page/Routing Patterns
|
|
10
|
+
- Client-side routing (React Router, TanStack Router, custom)
|
|
11
|
+
- Route definition approach (file-based, config-based, lazy loading)
|
|
12
|
+
- Layout structure (nested layouts, outlet, wrapper components)
|
|
13
|
+
- Dynamic routes and route parameters
|
|
14
|
+
- Route guards and authentication redirects
|
|
15
|
+
- Error/404 handling
|
|
16
|
+
|
|
17
|
+
2. Component Patterns
|
|
18
|
+
- Component structure (functional, forwardRef, memo)
|
|
19
|
+
- Props type definition (interface vs type, Generic usage)
|
|
20
|
+
- State management (useState, useReducer, external libraries)
|
|
21
|
+
- Styling approach and exact import paths (e.g., `import styles from './index.module.scss'`, `import { cn } from '@/lib/utils'`)
|
|
22
|
+
- Styling utility functions: record the EXACT import path used in source code
|
|
23
|
+
- UI library and exact package names (e.g., `@mui/material`, `antd`, `@shadcn/ui`)
|
|
24
|
+
- Component classification (UI, Feature, Layout, Page)
|
|
25
|
+
- Component entry file pattern: is the main file `index.tsx` or `ComponentName.tsx`? Record exactly.
|
|
26
|
+
- Directory structure pattern: record exact convention
|
|
27
|
+
- export pattern: default export vs named export in component files
|
|
28
|
+
- Reuse patterns (composition, compound components, render props)
|
|
29
|
+
- Accessibility (ARIA, semantic HTML, keyboard navigation)
|
|
30
|
+
|
|
31
|
+
3. Data Fetching Patterns
|
|
32
|
+
- Client-side data fetching (TanStack Query, SWR, useEffect, axios)
|
|
33
|
+
- API client configuration (base URL, interceptors, error handling)
|
|
34
|
+
- Request/response typing
|
|
35
|
+
- Caching strategy (query keys, stale time, refetch)
|
|
36
|
+
- Error/loading state handling
|
|
37
|
+
- Optimistic updates
|
|
38
|
+
- Pagination/infinite scroll patterns
|
|
39
|
+
|
|
40
|
+
4. State Management Patterns
|
|
41
|
+
- Global state (Zustand, Redux Toolkit, Jotai, Recoil, Context)
|
|
42
|
+
- Server state (TanStack Query, SWR)
|
|
43
|
+
- URL state (searchParams, useNavigate)
|
|
44
|
+
- Form state (React Hook Form, Formik)
|
|
45
|
+
- Local component state patterns
|
|
46
|
+
|
|
47
|
+
5. Configuration/Environment Patterns
|
|
48
|
+
- Environment variable management (VITE_ prefix convention, .env separation)
|
|
49
|
+
- vite.config settings (proxy, aliases, plugins)
|
|
50
|
+
- Build optimization (chunk splitting, dynamic imports)
|
|
51
|
+
- Path aliases (@/, src/)
|
|
52
|
+
|
|
53
|
+
6. Logging/Monitoring Patterns
|
|
54
|
+
- Client error tracking (Sentry, DataDog RUM)
|
|
55
|
+
- Performance monitoring
|
|
56
|
+
- Analytics tools (Google Analytics, PostHog, Mixpanel)
|
|
57
|
+
|
|
58
|
+
7. Testing Patterns
|
|
59
|
+
- Test framework (Vitest, Jest, Playwright, Cypress)
|
|
60
|
+
- Component testing (React Testing Library, Storybook)
|
|
61
|
+
- E2E testing strategy
|
|
62
|
+
- Mocking strategy (MSW, vi.mock)
|
|
63
|
+
- Test naming conventions
|
|
64
|
+
|
|
65
|
+
8. Domain-Specific Patterns
|
|
66
|
+
- Authentication/authorization (session, token, OAuth)
|
|
67
|
+
- Internationalization (i18next, react-intl)
|
|
68
|
+
- File upload patterns
|
|
69
|
+
- Real-time features (WebSocket, SSE)
|
|
70
|
+
- API versioning strategy
|
|
71
|
+
|
|
72
|
+
9. Anti-patterns / Inconsistencies
|
|
73
|
+
- Patterns inconsistent with other domains
|
|
74
|
+
- Performance issues (unnecessary re-renders, bundle size)
|
|
75
|
+
- Type safety issues
|
|
76
|
+
- Accessibility issues
|
|
77
|
+
- Security issues (XSS, CSRF)
|
|
78
|
+
|
|
79
|
+
Do not create or modify source files. Analysis only.
|
|
80
|
+
Save results to claudeos-core/generated/pass1-{{PASS_NUM}}.json in the following format:
|
|
81
|
+
|
|
82
|
+
{
|
|
83
|
+
"analyzedAt": "ISO timestamp",
|
|
84
|
+
"passNum": {{PASS_NUM}},
|
|
85
|
+
"domains": ["auth", "dashboard", "settings", "shared"],
|
|
86
|
+
"analysisPerDomain": {
|
|
87
|
+
"dashboard": {
|
|
88
|
+
"representativeFiles": {
|
|
89
|
+
"page": "src/pages/dashboard/index.tsx",
|
|
90
|
+
"component": "src/components/dashboard/StatsCard.tsx",
|
|
91
|
+
"hook": "src/hooks/useDashboardData.ts",
|
|
92
|
+
"api": "src/api/dashboard.ts"
|
|
93
|
+
},
|
|
94
|
+
"patterns": {
|
|
95
|
+
"page": { ... },
|
|
96
|
+
"component": {
|
|
97
|
+
"entryFilePattern": "index.tsx or ComponentName.tsx",
|
|
98
|
+
"exportPattern": "default export or named export",
|
|
99
|
+
"stylingImport": "exact import statement used for styling utility",
|
|
100
|
+
"uiLibraryImport": "exact import statement for UI components",
|
|
101
|
+
...
|
|
102
|
+
},
|
|
103
|
+
"dataFetching": { ... },
|
|
104
|
+
"stateManagement": { ... },
|
|
105
|
+
"config": { ... },
|
|
106
|
+
"logging": { ... },
|
|
107
|
+
"testing": { ... }
|
|
108
|
+
},
|
|
109
|
+
"specialPatterns": [],
|
|
110
|
+
"antiPatterns": []
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"crossDomainCommon": {
|
|
114
|
+
"description": "Patterns commonly used across domains in this group",
|
|
115
|
+
"patterns": []
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Read all pass1-*.json files from the claudeos-core/generated/ directory and
|
|
2
|
+
merge all domain analysis results into a single unified report.
|
|
3
|
+
|
|
4
|
+
Merge items:
|
|
5
|
+
|
|
6
|
+
1. Universal Patterns (shared by 100% of all domains)
|
|
7
|
+
- Page/routing structure (React Router / TanStack Router / custom)
|
|
8
|
+
- Component writing conventions (functional, Props types, styling)
|
|
9
|
+
- Data fetching strategy (TanStack Query, SWR, axios patterns)
|
|
10
|
+
- State management approach
|
|
11
|
+
- Error/loading handling patterns
|
|
12
|
+
- Route guard/protection patterns
|
|
13
|
+
|
|
14
|
+
2. Majority Patterns (shared by 50%+ of domains)
|
|
15
|
+
- Specify which domains share them
|
|
16
|
+
|
|
17
|
+
3. Domain-Specific Patterns (unique to a single domain)
|
|
18
|
+
- Auth: which domain
|
|
19
|
+
- Real-time features: which domain
|
|
20
|
+
- File upload: which domain
|
|
21
|
+
- i18n: which domain
|
|
22
|
+
|
|
23
|
+
4. Anti-pattern Summary
|
|
24
|
+
- Consolidate all inconsistencies found across domains
|
|
25
|
+
- Classify by severity (CRITICAL / HIGH / MEDIUM / LOW)
|
|
26
|
+
|
|
27
|
+
5. Naming Conventions Summary
|
|
28
|
+
- File/directory naming (kebab-case, PascalCase)
|
|
29
|
+
- Component entry file pattern (index.tsx vs ComponentName.tsx — pick ONE that the project actually uses)
|
|
30
|
+
- Component export pattern (default export vs named export)
|
|
31
|
+
- Hook naming (use* prefix)
|
|
32
|
+
- API function patterns
|
|
33
|
+
|
|
34
|
+
6. Shared Types/Components List
|
|
35
|
+
- Common UI components with EXACT import paths
|
|
36
|
+
- Shared hooks with exact import paths
|
|
37
|
+
- Utility functions with EXACT import paths
|
|
38
|
+
- Path aliases used in the project (e.g., `@/` -> `src/`)
|
|
39
|
+
- Environment variable types
|
|
40
|
+
- Constants/Enum management
|
|
41
|
+
|
|
42
|
+
7. Security/Authentication Patterns
|
|
43
|
+
- Authentication approach (JWT, session, OAuth)
|
|
44
|
+
- Route protection strategy
|
|
45
|
+
- CSRF/XSS prevention
|
|
46
|
+
- Environment variable management (VITE_ convention)
|
|
47
|
+
|
|
48
|
+
8. Database Patterns
|
|
49
|
+
- API endpoint conventions
|
|
50
|
+
- Request/response format
|
|
51
|
+
- Error response handling
|
|
52
|
+
|
|
53
|
+
9. Testing Strategy Summary
|
|
54
|
+
- Test coverage level
|
|
55
|
+
- Test classification system (unit/component/E2E)
|
|
56
|
+
- Mocking strategy (MSW, vi.mock)
|
|
57
|
+
- Storybook usage
|
|
58
|
+
- Test naming conventions
|
|
59
|
+
|
|
60
|
+
10. Logging/Monitoring Strategy
|
|
61
|
+
- Error tracking approach (Sentry, DataDog)
|
|
62
|
+
- Analytics tools
|
|
63
|
+
- Performance monitoring
|
|
64
|
+
|
|
65
|
+
11. Performance Patterns
|
|
66
|
+
- Code splitting strategy (lazy, Suspense)
|
|
67
|
+
- Bundle optimization (chunk splitting, tree shaking)
|
|
68
|
+
- Image optimization
|
|
69
|
+
- Caching strategy
|
|
70
|
+
|
|
71
|
+
12. Code Quality Tools
|
|
72
|
+
- Lint/Format tools (ESLint, Prettier, Biome)
|
|
73
|
+
- Pre-commit hooks (husky, lint-staged)
|
|
74
|
+
- TypeScript strict mode
|
|
75
|
+
- CI integration status
|
|
76
|
+
|
|
77
|
+
Do not generate code. Merge only.
|
|
78
|
+
Save results to claudeos-core/generated/pass2-merged.json.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
Read claudeos-core/generated/project-analysis.json and
|
|
2
|
+
claudeos-core/generated/pass2-merged.json, then
|
|
3
|
+
generate all ClaudeOS-Core files based on the analysis results.
|
|
4
|
+
|
|
5
|
+
Do not read the original source code again. Reference only the analysis results.
|
|
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
|
+
NEVER mix npm/yarn/pnpm commands. Also check `scripts` field in the project's package.json
|
|
11
|
+
for actual script names.
|
|
12
|
+
|
|
13
|
+
CRITICAL — Cross-file Consistency:
|
|
14
|
+
Rules (.claude/rules/) and Standards (claudeos-core/standard/) MUST NOT contradict each other.
|
|
15
|
+
|
|
16
|
+
CRITICAL — Code Example Accuracy:
|
|
17
|
+
ALL code examples in rules and standards MUST use EXACT method names, class names,
|
|
18
|
+
and signatures from pass2-merged.json analysis data.
|
|
19
|
+
Do NOT paraphrase, rename, or infer API names.
|
|
20
|
+
|
|
21
|
+
CRITICAL — CLAUDE.md Reference Table Completeness:
|
|
22
|
+
The reference table in CLAUDE.md MUST list ALL generated standard files.
|
|
23
|
+
|
|
24
|
+
Generation targets:
|
|
25
|
+
|
|
26
|
+
1. CLAUDE.md (project root)
|
|
27
|
+
- Role definition (based on detected stack — Vite + React SPA)
|
|
28
|
+
- Build & Run Commands (use ONLY the detected packageManager)
|
|
29
|
+
- Core architecture diagram (client-side SPA, routing, state management)
|
|
30
|
+
- Directory structure description
|
|
31
|
+
- Standard/Skills/Guide reference table
|
|
32
|
+
|
|
33
|
+
2. claudeos-core/standard/ (active domains only)
|
|
34
|
+
- 00.core/01.project-overview.md — Stack, routing approach, deployment environment
|
|
35
|
+
- 00.core/02.architecture.md — SPA structure, component hierarchy, data flow
|
|
36
|
+
- 00.core/03.naming-conventions.md — File/component/hook/type naming conventions
|
|
37
|
+
- 20.frontend-ui/01.component-patterns.md — Component writing rules, Props patterns, reuse
|
|
38
|
+
- 20.frontend-ui/02.page-routing-patterns.md — Client-side routing, layouts, route guards, lazy loading
|
|
39
|
+
- 20.frontend-ui/03.data-fetching.md — API client, TanStack Query/SWR, caching, error handling
|
|
40
|
+
- 20.frontend-ui/04.state-management.md — Global/server/URL/form state management
|
|
41
|
+
- 20.frontend-ui/05.styling-patterns.md — Styling rules, theming, responsive, accessibility
|
|
42
|
+
- 30.security-db/01.security-auth.md — Auth patterns, token management, route protection, environment variables
|
|
43
|
+
- 40.infra/01.environment-config.md — Environment variables (VITE_ prefix), vite.config, build optimization
|
|
44
|
+
- 40.infra/02.logging-monitoring.md — Error tracking, analytics tools, performance monitoring
|
|
45
|
+
- 40.infra/03.cicd-deployment.md — CI/CD, static hosting deployment (Nginx, S3, Vercel, Netlify)
|
|
46
|
+
- 50.verification/01.development-verification.md — Build, startup, dev server
|
|
47
|
+
- 50.verification/02.testing-strategy.md — Testing strategy (Vitest, RTL, E2E, Storybook)
|
|
48
|
+
|
|
49
|
+
Each file MUST include:
|
|
50
|
+
- Correct examples (code blocks)
|
|
51
|
+
- Incorrect examples (code blocks)
|
|
52
|
+
- Key rules summary table
|
|
53
|
+
|
|
54
|
+
3. .claude/rules/ (active domains only)
|
|
55
|
+
- Write the full rule content directly in each file (self-contained, no external references)
|
|
56
|
+
- Include 5-15 lines of key rules with concrete examples
|
|
57
|
+
- Do NOT use @import — it is not a Claude Code feature and does not work
|
|
58
|
+
- Each rule file MUST end with a `## Reference` section linking to the corresponding standard file(s):
|
|
59
|
+
```
|
|
60
|
+
## Reference
|
|
61
|
+
> For detailed patterns and examples, Read: claudeos-core/standard/20.frontend-ui/01.component-patterns.md
|
|
62
|
+
```
|
|
63
|
+
- `paths:` frontmatter per rule category:
|
|
64
|
+
- `00.core/*` rules: `paths: ["**/*"]`
|
|
65
|
+
- `20.frontend/*` rules: `paths: ["**/*"]`
|
|
66
|
+
- `30.security-db/*` rules: `paths: ["**/*"]`
|
|
67
|
+
- `40.infra/*` rules: `paths: ["**/*.json", "**/*.env*", "**/vite.config.*", "**/Dockerfile*", "**/*.yml", "**/*.yaml"]`
|
|
68
|
+
- `50.sync/*` rules: `paths: ["**/claudeos-core/**", "**/.claude/**"]`
|
|
69
|
+
- MUST generate `.claude/rules/00.core/00.standard-reference.md` — directory of all standard files.
|
|
70
|
+
|
|
71
|
+
4. .claude/rules/50.sync/ (3 sync rules)
|
|
72
|
+
- 01.standard-sync.md — Remind AI to update plan/10 when standard is modified
|
|
73
|
+
- 02.rules-sync.md — Remind AI to update plan/20 when rules is modified
|
|
74
|
+
- 03.skills-sync.md — Remind AI to update plan/30 when skills is modified
|
|
75
|
+
|
|
76
|
+
5. claudeos-core/skills/ (active domains only)
|
|
77
|
+
- 20.frontend-page/01.scaffold-page-feature.md (orchestrator)
|
|
78
|
+
- 20.frontend-page/scaffold-page-feature/01~08 (sub-skills: page, layout, component, hook, api-client, test, style, index)
|
|
79
|
+
- 00.shared/MANIFEST.md (skill registry)
|
|
80
|
+
|
|
81
|
+
6. claudeos-core/guide/ (all)
|
|
82
|
+
- 01.onboarding/01.overview.md
|
|
83
|
+
- 01.onboarding/02.quickstart.md
|
|
84
|
+
- 01.onboarding/03.glossary.md
|
|
85
|
+
- 02.usage/01.faq.md
|
|
86
|
+
- 02.usage/02.real-world-examples.md
|
|
87
|
+
- 02.usage/03.do-and-dont.md
|
|
88
|
+
- 03.troubleshooting/01.troubleshooting.md
|
|
89
|
+
- 04.architecture/01.file-map.md
|
|
90
|
+
- 04.architecture/02.pros-and-cons.md
|
|
91
|
+
|
|
92
|
+
7. claudeos-core/plan/ (Master Plan)
|
|
93
|
+
- 10.standard-master.md — CLAUDE.md + all standard/ files as <file> blocks
|
|
94
|
+
- 20.rules-master.md — All rules/ (except sync) as <file> blocks
|
|
95
|
+
- 21.sync-rules-master.md — All sync rules (code block format)
|
|
96
|
+
- 30.frontend-skills-master.md — All frontend skills as <file> blocks
|
|
97
|
+
- 40.guides-master.md — All guide/ files as <file> blocks
|
|
98
|
+
|
|
99
|
+
8. claudeos-core/database/
|
|
100
|
+
- 01.schema-overview.md — API endpoint catalog, request/response schemas (if applicable)
|
|
101
|
+
|
|
102
|
+
9. claudeos-core/mcp-guide/
|
|
103
|
+
- 01.mcp-overview.md — List of MCP servers in use, integration methods
|
|
@@ -1,73 +1,75 @@
|
|
|
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.
|
|
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 (requires a backend framework; language-only fallback skipped for pure frontend projects)
|
|
51
|
-
if (stack.language === "kotlin") templates.backend = "kotlin-spring";
|
|
52
|
-
else if (stack.language === "java") templates.backend = "java-spring";
|
|
53
|
-
else if (stack.framework === "nestjs") templates.backend = "node-nestjs";
|
|
54
|
-
else if (stack.framework === "express") templates.backend = "node-express";
|
|
55
|
-
else if (stack.framework === "fastify") templates.backend = "node-fastify";
|
|
56
|
-
else if (stack.framework === "django") templates.backend = "python-django";
|
|
57
|
-
else if (stack.framework === "fastapi" || stack.framework === "flask") templates.backend = "python-fastapi";
|
|
58
|
-
else if ((stack.language === "typescript" || stack.language === "javascript") && stack.framework) templates.backend = "node-express";
|
|
59
|
-
else if (stack.language === "python" && stack.framework) templates.backend = "python-fastapi";
|
|
60
|
-
|
|
61
|
-
// Frontend template
|
|
62
|
-
if (stack.frontend === "nextjs"
|
|
63
|
-
templates.frontend = "node-nextjs";
|
|
64
|
-
} else if (stack.frontend === "
|
|
65
|
-
templates.frontend = "
|
|
66
|
-
} else if (stack.frontend === "
|
|
67
|
-
templates.frontend = "
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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 && stack.framework !== "vite";
|
|
35
|
+
return {
|
|
36
|
+
"00.core": true,
|
|
37
|
+
"10.backend": !!isBackend,
|
|
38
|
+
"20.frontend": !!stack.frontend,
|
|
39
|
+
"30.security-db": !!(stack.database || isBackend || stack.frontend),
|
|
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 (requires a backend framework; language-only fallback skipped for pure frontend projects)
|
|
51
|
+
if (stack.language === "kotlin") templates.backend = "kotlin-spring";
|
|
52
|
+
else if (stack.language === "java") templates.backend = "java-spring";
|
|
53
|
+
else if (stack.framework === "nestjs") templates.backend = "node-nestjs";
|
|
54
|
+
else if (stack.framework === "express") templates.backend = "node-express";
|
|
55
|
+
else if (stack.framework === "fastify") templates.backend = "node-fastify";
|
|
56
|
+
else if (stack.framework === "django") templates.backend = "python-django";
|
|
57
|
+
else if (stack.framework === "fastapi" || stack.framework === "flask") templates.backend = "python-fastapi";
|
|
58
|
+
else if ((stack.language === "typescript" || stack.language === "javascript") && stack.framework && stack.framework !== "vite") templates.backend = "node-express";
|
|
59
|
+
else if (stack.language === "python" && stack.framework) templates.backend = "python-fastapi";
|
|
60
|
+
|
|
61
|
+
// Frontend template
|
|
62
|
+
if (stack.frontend === "nextjs") {
|
|
63
|
+
templates.frontend = "node-nextjs";
|
|
64
|
+
} else if (stack.frontend === "react") {
|
|
65
|
+
templates.frontend = stack.framework === "vite" ? "node-vite" : "node-nextjs";
|
|
66
|
+
} else if (stack.frontend === "vue") {
|
|
67
|
+
templates.frontend = "vue-nuxt";
|
|
68
|
+
} else if (stack.frontend === "angular") {
|
|
69
|
+
templates.frontend = "angular";
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return templates;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
module.exports = { splitDomainGroups, determineActiveDomains, selectTemplates };
|