claudeos-core 2.2.0 → 2.3.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 (49) hide show
  1. package/CHANGELOG.md +1649 -907
  2. package/CONTRIBUTING.md +92 -92
  3. package/README.de.md +32 -0
  4. package/README.es.md +32 -0
  5. package/README.fr.md +32 -0
  6. package/README.hi.md +32 -0
  7. package/README.ja.md +32 -0
  8. package/README.ko.md +1018 -986
  9. package/README.md +1020 -987
  10. package/README.ru.md +32 -0
  11. package/README.vi.md +1019 -987
  12. package/README.zh-CN.md +32 -0
  13. package/bin/cli.js +152 -148
  14. package/bin/commands/init.js +1673 -1554
  15. package/bin/commands/lint.js +62 -0
  16. package/bin/commands/memory.js +438 -438
  17. package/bin/lib/cli-utils.js +206 -206
  18. package/claude-md-validator/index.js +184 -0
  19. package/claude-md-validator/reporter.js +66 -0
  20. package/claude-md-validator/structural-checks.js +528 -0
  21. package/content-validator/index.js +666 -441
  22. package/lib/expected-guides.js +23 -23
  23. package/lib/expected-outputs.js +90 -90
  24. package/lib/language-config.js +35 -35
  25. package/lib/memory-scaffold.js +1058 -1054
  26. package/lib/plan-parser.js +165 -165
  27. package/lib/staged-rules.js +118 -118
  28. package/manifest-generator/index.js +174 -174
  29. package/package.json +90 -87
  30. package/pass-json-validator/index.js +337 -337
  31. package/pass-prompts/templates/common/claude-md-scaffold.md +52 -10
  32. package/pass-prompts/templates/common/pass3-footer.md +402 -224
  33. package/pass-prompts/templates/common/pass3b-core-header.md +43 -0
  34. package/pass-prompts/templates/common/pass4.md +375 -305
  35. package/pass-prompts/templates/common/staging-override.md +26 -26
  36. package/pass-prompts/templates/node-vite/pass1.md +117 -117
  37. package/pass-prompts/templates/node-vite/pass2.md +78 -78
  38. package/pass-prompts/templates/python-flask/pass1.md +119 -119
  39. package/pass-prompts/templates/python-flask/pass2.md +85 -85
  40. package/plan-installer/domain-grouper.js +76 -76
  41. package/plan-installer/index.js +137 -137
  42. package/plan-installer/prompt-generator.js +188 -145
  43. package/plan-installer/scanners/scan-frontend.js +505 -473
  44. package/plan-installer/scanners/scan-java.js +226 -226
  45. package/plan-installer/scanners/scan-node.js +57 -57
  46. package/plan-installer/scanners/scan-python.js +85 -85
  47. package/plan-installer/stack-detector.js +482 -482
  48. package/plan-installer/structure-scanner.js +65 -65
  49. package/sync-checker/index.js +177 -177
@@ -1,119 +1,119 @@
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. Route/Blueprint Patterns
10
- - Blueprint structure (Blueprint registration, url_prefix, naming)
11
- - Route decorators (@app.route, @bp.route with methods)
12
- - URL patterns and naming conventions
13
- - View function structure (function-based vs class-based MethodView)
14
- - Request handling (request.args, request.form, request.json, request.files)
15
- - Response patterns (jsonify, make_response, Response, redirect, abort)
16
- - If a custom response wrapper exists, record its EXACT function/class name, EXACT import path
17
- - **Response wrapping layer (CRITICAL)**: Which layer formats the response?
18
- Does the route handler call it directly, or does a service layer return formatted data?
19
- - Error handling (errorhandler, abort, custom exception classes)
20
- - Authentication (flask-login, flask-jwt-extended, custom decorators)
21
- - API documentation (flask-restx, flask-smorest, flasgger)
22
- - Pagination patterns
23
-
24
- 2. Data Model Patterns
25
- - ORM (SQLAlchemy, Flask-SQLAlchemy, Peewee)
26
- - Model structure (db.Model, relationships, mixins)
27
- - Serialization (marshmallow, flask-marshmallow, manual to_dict)
28
- - Form validation (WTForms, Flask-WTF, manual)
29
- - Request/Response schema separation
30
- - Enum/constant management
31
-
32
- 3. Data Access Patterns
33
- - Session management (db.session, scoped_session)
34
- - Repository/DAO pattern vs direct model queries
35
- - Migration (Flask-Migrate / Alembic)
36
- - Query optimization (eager loading, lazy loading)
37
- - Connection management (pool, teardown_appcontext)
38
- - Transaction management
39
-
40
- 4. Application Structure Patterns
41
- - Application factory (create_app)
42
- - Configuration (app.config, from_object, from_envvar)
43
- - Extension initialization (db.init_app, login_manager.init_app)
44
- - Context (application context, request context, g, current_app)
45
- - Before/after request hooks (before_request, after_request, teardown_request)
46
- - Import paths: record EXACT import conventions
47
- - Utility function locations: record EXACT module paths
48
-
49
- 5. Configuration/Environment Patterns
50
- - Environment variable management (python-dotenv, os.environ)
51
- - Config classes (DevelopmentConfig, ProductionConfig)
52
- - Per-environment branching
53
- - Secret management (SECRET_KEY, database URL)
54
-
55
- 6. Logging Patterns
56
- - Logger usage (app.logger, structlog, loguru, logging)
57
- - Log level policy
58
- - Request/response logging
59
- - Error logging
60
-
61
- 7. Testing Patterns
62
- - Test framework (pytest, unittest)
63
- - Test client (app.test_client, pytest fixtures)
64
- - Application factory testing (create_app with test config)
65
- - Fixture management (conftest, client fixture)
66
- - DB test strategy (test DB, SQLite in-memory, transaction rollback)
67
- - Mocking (unittest.mock, pytest-mock, responses)
68
-
69
- 8. Domain-Specific Patterns
70
- - Template rendering (Jinja2, render_template) vs JSON API
71
- - File upload (request.files, werkzeug FileStorage)
72
- - Background tasks (Celery, RQ, APScheduler)
73
- - WebSocket (Flask-SocketIO)
74
- - External API integration (requests, httpx)
75
- - Caching (Flask-Caching, Redis)
76
- - Session management (server-side, Flask-Session)
77
- - CSRF protection (Flask-WTF CSRFProtect)
78
-
79
- 9. Anti-patterns / Inconsistencies
80
- - Circular imports
81
- - Missing application factory
82
- - Global state misuse
83
- - Missing error handlers
84
- - Security issues (injection, missing CSRF, debug mode in production)
85
- - Performance issues (blocking I/O, N+1 queries)
86
-
87
- Do not create or modify source files. Analysis only.
88
- Save results to claudeos-core/generated/pass1-{{PASS_NUM}}.json in the following format:
89
-
90
- {
91
- "analyzedAt": "ISO timestamp",
92
- "passNum": {{PASS_NUM}},
93
- "domains": ["auth", "users", "orders", "products"],
94
- "analysisPerDomain": {
95
- "users": {
96
- "representativeFiles": {
97
- "routes": "app/users/routes.py",
98
- "models": "app/users/models.py",
99
- "forms": "app/users/forms.py",
100
- "services": "app/users/services.py"
101
- },
102
- "patterns": {
103
- "routes": { ... },
104
- "models": { ... },
105
- "dataAccess": { ... },
106
- "appStructure": { ... },
107
- "config": { ... },
108
- "logging": { ... },
109
- "testing": { ... }
110
- },
111
- "specialPatterns": [],
112
- "antiPatterns": []
113
- }
114
- },
115
- "crossDomainCommon": {
116
- "description": "Patterns commonly used across domains in this group",
117
- "patterns": []
118
- }
119
- }
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. Route/Blueprint Patterns
10
+ - Blueprint structure (Blueprint registration, url_prefix, naming)
11
+ - Route decorators (@app.route, @bp.route with methods)
12
+ - URL patterns and naming conventions
13
+ - View function structure (function-based vs class-based MethodView)
14
+ - Request handling (request.args, request.form, request.json, request.files)
15
+ - Response patterns (jsonify, make_response, Response, redirect, abort)
16
+ - If a custom response wrapper exists, record its EXACT function/class name, EXACT import path
17
+ - **Response wrapping layer (CRITICAL)**: Which layer formats the response?
18
+ Does the route handler call it directly, or does a service layer return formatted data?
19
+ - Error handling (errorhandler, abort, custom exception classes)
20
+ - Authentication (flask-login, flask-jwt-extended, custom decorators)
21
+ - API documentation (flask-restx, flask-smorest, flasgger)
22
+ - Pagination patterns
23
+
24
+ 2. Data Model Patterns
25
+ - ORM (SQLAlchemy, Flask-SQLAlchemy, Peewee)
26
+ - Model structure (db.Model, relationships, mixins)
27
+ - Serialization (marshmallow, flask-marshmallow, manual to_dict)
28
+ - Form validation (WTForms, Flask-WTF, manual)
29
+ - Request/Response schema separation
30
+ - Enum/constant management
31
+
32
+ 3. Data Access Patterns
33
+ - Session management (db.session, scoped_session)
34
+ - Repository/DAO pattern vs direct model queries
35
+ - Migration (Flask-Migrate / Alembic)
36
+ - Query optimization (eager loading, lazy loading)
37
+ - Connection management (pool, teardown_appcontext)
38
+ - Transaction management
39
+
40
+ 4. Application Structure Patterns
41
+ - Application factory (create_app)
42
+ - Configuration (app.config, from_object, from_envvar)
43
+ - Extension initialization (db.init_app, login_manager.init_app)
44
+ - Context (application context, request context, g, current_app)
45
+ - Before/after request hooks (before_request, after_request, teardown_request)
46
+ - Import paths: record EXACT import conventions
47
+ - Utility function locations: record EXACT module paths
48
+
49
+ 5. Configuration/Environment Patterns
50
+ - Environment variable management (python-dotenv, os.environ)
51
+ - Config classes (DevelopmentConfig, ProductionConfig)
52
+ - Per-environment branching
53
+ - Secret management (SECRET_KEY, database URL)
54
+
55
+ 6. Logging Patterns
56
+ - Logger usage (app.logger, structlog, loguru, logging)
57
+ - Log level policy
58
+ - Request/response logging
59
+ - Error logging
60
+
61
+ 7. Testing Patterns
62
+ - Test framework (pytest, unittest)
63
+ - Test client (app.test_client, pytest fixtures)
64
+ - Application factory testing (create_app with test config)
65
+ - Fixture management (conftest, client fixture)
66
+ - DB test strategy (test DB, SQLite in-memory, transaction rollback)
67
+ - Mocking (unittest.mock, pytest-mock, responses)
68
+
69
+ 8. Domain-Specific Patterns
70
+ - Template rendering (Jinja2, render_template) vs JSON API
71
+ - File upload (request.files, werkzeug FileStorage)
72
+ - Background tasks (Celery, RQ, APScheduler)
73
+ - WebSocket (Flask-SocketIO)
74
+ - External API integration (requests, httpx)
75
+ - Caching (Flask-Caching, Redis)
76
+ - Session management (server-side, Flask-Session)
77
+ - CSRF protection (Flask-WTF CSRFProtect)
78
+
79
+ 9. Anti-patterns / Inconsistencies
80
+ - Circular imports
81
+ - Missing application factory
82
+ - Global state misuse
83
+ - Missing error handlers
84
+ - Security issues (injection, missing CSRF, debug mode in production)
85
+ - Performance issues (blocking I/O, N+1 queries)
86
+
87
+ Do not create or modify source files. Analysis only.
88
+ Save results to claudeos-core/generated/pass1-{{PASS_NUM}}.json in the following format:
89
+
90
+ {
91
+ "analyzedAt": "ISO timestamp",
92
+ "passNum": {{PASS_NUM}},
93
+ "domains": ["auth", "users", "orders", "products"],
94
+ "analysisPerDomain": {
95
+ "users": {
96
+ "representativeFiles": {
97
+ "routes": "app/users/routes.py",
98
+ "models": "app/users/models.py",
99
+ "forms": "app/users/forms.py",
100
+ "services": "app/users/services.py"
101
+ },
102
+ "patterns": {
103
+ "routes": { ... },
104
+ "models": { ... },
105
+ "dataAccess": { ... },
106
+ "appStructure": { ... },
107
+ "config": { ... },
108
+ "logging": { ... },
109
+ "testing": { ... }
110
+ },
111
+ "specialPatterns": [],
112
+ "antiPatterns": []
113
+ }
114
+ },
115
+ "crossDomainCommon": {
116
+ "description": "Patterns commonly used across domains in this group",
117
+ "patterns": []
118
+ }
119
+ }
@@ -1,85 +1,85 @@
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
- - Route/Blueprint style (decorators, response format, status codes)
8
- - **Response flow**: Which layer wraps the response? (route handler vs service layer)
9
- Record the definitive answer. If an orchestration layer exists, describe it.
10
- - Model/serialization conventions (SQLAlchemy, marshmallow)
11
- - Data access patterns (session management, queries)
12
- - Application factory structure (create_app, extensions)
13
- - Error handling patterns
14
- - Before/after request hooks
15
-
16
- 2. Majority Patterns (shared by 50%+ of domains)
17
- - Specify which domains share them
18
-
19
- 3. Domain-Specific Patterns (unique to a single domain)
20
- - File upload: which domain
21
- - WebSocket: which domain
22
- - Background tasks: which domain
23
- - External API: which domain
24
- - Caching: which domain
25
- - Template rendering: which domain
26
-
27
- 4. Anti-pattern Summary
28
- - Consolidate all inconsistencies found across domains
29
- - Classify by severity (CRITICAL / HIGH / MEDIUM / LOW)
30
-
31
- 5. Naming Conventions Summary
32
- - Module/package naming (snake_case)
33
- - Blueprint naming conventions
34
- - Model/schema naming conventions
35
- - Route URL patterns
36
- - File structure conventions
37
-
38
- 6. Common Models/Utilities List
39
- - Base model mixins with EXACT import paths
40
- - Shared utility functions with EXACT module paths
41
- - Constants/Enum management with EXACT locations
42
- - Extension instances (db, login_manager, etc.)
43
-
44
- 7. Security/Authentication Patterns
45
- - Authentication method (flask-login, flask-jwt-extended, custom)
46
- - Authorization decorators (login_required, custom)
47
- - CSRF protection
48
- - CORS configuration
49
- - Environment variable management
50
-
51
- 8. Database Patterns
52
- - Table naming (__tablename__)
53
- - Migration strategy (Flask-Migrate)
54
- - Seed data management
55
- - Audit fields (created_at, updated_at)
56
- - Relationship patterns
57
- - Index/constraints
58
-
59
- 9. Testing Strategy Summary
60
- - Test coverage level
61
- - Test classification system (unit/integration/E2E)
62
- - Test client setup (app.test_client)
63
- - Fixture/Factory strategy
64
- - Mocking strategy
65
- - DB test strategy
66
-
67
- 10. Logging/Monitoring Strategy
68
- - Logger standard (app.logger vs custom)
69
- - Log level policy
70
- - Request/response logging
71
-
72
- 11. Performance Patterns
73
- - Caching strategy (Flask-Caching)
74
- - Connection pool configuration
75
- - Query optimization
76
- - Static file serving
77
-
78
- 12. Code Quality Tools
79
- - Lint/Format tools (ruff, black, isort, mypy, flake8)
80
- - Pre-commit hooks
81
- - Type Checking (mypy, pyright)
82
- - CI integration status
83
-
84
- Do not generate code. Merge only.
85
- Save results to claudeos-core/generated/pass2-merged.json.
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
+ - Route/Blueprint style (decorators, response format, status codes)
8
+ - **Response flow**: Which layer wraps the response? (route handler vs service layer)
9
+ Record the definitive answer. If an orchestration layer exists, describe it.
10
+ - Model/serialization conventions (SQLAlchemy, marshmallow)
11
+ - Data access patterns (session management, queries)
12
+ - Application factory structure (create_app, extensions)
13
+ - Error handling patterns
14
+ - Before/after request hooks
15
+
16
+ 2. Majority Patterns (shared by 50%+ of domains)
17
+ - Specify which domains share them
18
+
19
+ 3. Domain-Specific Patterns (unique to a single domain)
20
+ - File upload: which domain
21
+ - WebSocket: which domain
22
+ - Background tasks: which domain
23
+ - External API: which domain
24
+ - Caching: which domain
25
+ - Template rendering: which domain
26
+
27
+ 4. Anti-pattern Summary
28
+ - Consolidate all inconsistencies found across domains
29
+ - Classify by severity (CRITICAL / HIGH / MEDIUM / LOW)
30
+
31
+ 5. Naming Conventions Summary
32
+ - Module/package naming (snake_case)
33
+ - Blueprint naming conventions
34
+ - Model/schema naming conventions
35
+ - Route URL patterns
36
+ - File structure conventions
37
+
38
+ 6. Common Models/Utilities List
39
+ - Base model mixins with EXACT import paths
40
+ - Shared utility functions with EXACT module paths
41
+ - Constants/Enum management with EXACT locations
42
+ - Extension instances (db, login_manager, etc.)
43
+
44
+ 7. Security/Authentication Patterns
45
+ - Authentication method (flask-login, flask-jwt-extended, custom)
46
+ - Authorization decorators (login_required, custom)
47
+ - CSRF protection
48
+ - CORS configuration
49
+ - Environment variable management
50
+
51
+ 8. Database Patterns
52
+ - Table naming (__tablename__)
53
+ - Migration strategy (Flask-Migrate)
54
+ - Seed data management
55
+ - Audit fields (created_at, updated_at)
56
+ - Relationship patterns
57
+ - Index/constraints
58
+
59
+ 9. Testing Strategy Summary
60
+ - Test coverage level
61
+ - Test classification system (unit/integration/E2E)
62
+ - Test client setup (app.test_client)
63
+ - Fixture/Factory strategy
64
+ - Mocking strategy
65
+ - DB test strategy
66
+
67
+ 10. Logging/Monitoring Strategy
68
+ - Logger standard (app.logger vs custom)
69
+ - Log level policy
70
+ - Request/response logging
71
+
72
+ 11. Performance Patterns
73
+ - Caching strategy (Flask-Caching)
74
+ - Connection pool configuration
75
+ - Query optimization
76
+ - Static file serving
77
+
78
+ 12. Code Quality Tools
79
+ - Lint/Format tools (ruff, black, isort, mypy, flake8)
80
+ - Pre-commit hooks
81
+ - Type Checking (mypy, pyright)
82
+ - CI integration status
83
+
84
+ Do not generate code. Merge only.
85
+ Save results to claudeos-core/generated/pass2-merged.json.
@@ -1,76 +1,76 @@
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") templates.backend = "python-fastapi";
58
- else if (stack.framework === "flask") templates.backend = "python-flask";
59
- else if ((stack.language === "typescript" || stack.language === "javascript") && stack.framework && stack.framework !== "vite") templates.backend = "node-express";
60
- else if (stack.language === "python" && stack.framework) templates.backend = "python-fastapi";
61
-
62
- // Frontend template
63
- if (stack.frontend === "nextjs") {
64
- templates.frontend = "node-nextjs";
65
- } else if (stack.frontend === "react") {
66
- templates.frontend = stack.framework === "vite" ? "node-vite" : "node-nextjs";
67
- } else if (stack.frontend === "vue") {
68
- templates.frontend = "vue-nuxt";
69
- } else if (stack.frontend === "angular") {
70
- templates.frontend = "angular";
71
- }
72
-
73
- return templates;
74
- }
75
-
76
- module.exports = { splitDomainGroups, determineActiveDomains, selectTemplates };
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") templates.backend = "python-fastapi";
58
+ else if (stack.framework === "flask") templates.backend = "python-flask";
59
+ else if ((stack.language === "typescript" || stack.language === "javascript") && stack.framework && stack.framework !== "vite") templates.backend = "node-express";
60
+ else if (stack.language === "python" && stack.framework) templates.backend = "python-fastapi";
61
+
62
+ // Frontend template
63
+ if (stack.frontend === "nextjs") {
64
+ templates.frontend = "node-nextjs";
65
+ } else if (stack.frontend === "react") {
66
+ templates.frontend = stack.framework === "vite" ? "node-vite" : "node-nextjs";
67
+ } else if (stack.frontend === "vue") {
68
+ templates.frontend = "vue-nuxt";
69
+ } else if (stack.frontend === "angular") {
70
+ templates.frontend = "angular";
71
+ }
72
+
73
+ return templates;
74
+ }
75
+
76
+ module.exports = { splitDomainGroups, determineActiveDomains, selectTemplates };