@claudetools/tools 0.9.1 → 0.9.2

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 (85) hide show
  1. package/dist/cli.js +9 -1
  2. package/dist/codedna/__tests__/examples/mongoose-example.d.ts +6 -0
  3. package/dist/codedna/__tests__/examples/mongoose-example.js +163 -0
  4. package/dist/codedna/__tests__/fixtures/typeorm-production-test.d.ts +1 -0
  5. package/dist/codedna/__tests__/fixtures/typeorm-production-test.js +231 -0
  6. package/dist/codedna/__tests__/fixtures/typeorm-test.d.ts +1 -0
  7. package/dist/codedna/__tests__/fixtures/typeorm-test.js +124 -0
  8. package/dist/codedna/__tests__/laravel-output-review.d.ts +1 -0
  9. package/dist/codedna/__tests__/laravel-output-review.js +249 -0
  10. package/dist/codedna/__tests__/mongoose-output-test.d.ts +1 -0
  11. package/dist/codedna/__tests__/mongoose-output-test.js +178 -0
  12. package/dist/codedna/examples/radix-example.d.ts +2 -0
  13. package/dist/codedna/examples/radix-example.js +259 -0
  14. package/dist/codedna/index.d.ts +5 -3
  15. package/dist/codedna/index.js +6 -3
  16. package/dist/codedna/kappa-ast.d.ts +143 -5
  17. package/dist/codedna/kappa-drizzle-generator.js +8 -5
  18. package/dist/codedna/kappa-gofiber-generator.d.ts +65 -0
  19. package/dist/codedna/kappa-gofiber-generator.js +587 -0
  20. package/dist/codedna/kappa-laravel-generator.d.ts +68 -0
  21. package/dist/codedna/kappa-laravel-generator.js +741 -0
  22. package/dist/codedna/kappa-lexer.d.ts +44 -0
  23. package/dist/codedna/kappa-lexer.js +124 -0
  24. package/dist/codedna/kappa-mantine-generator.d.ts +65 -0
  25. package/dist/codedna/kappa-mantine-generator.js +518 -0
  26. package/dist/codedna/kappa-mongoose-generator.d.ts +44 -0
  27. package/dist/codedna/kappa-mongoose-generator.js +442 -0
  28. package/dist/codedna/kappa-parser.d.ts +43 -1
  29. package/dist/codedna/kappa-parser.js +601 -0
  30. package/dist/codedna/kappa-radix-generator.d.ts +61 -0
  31. package/dist/codedna/kappa-radix-generator.js +566 -0
  32. package/dist/codedna/kappa-typeorm-generator.d.ts +59 -0
  33. package/dist/codedna/kappa-typeorm-generator.js +723 -0
  34. package/dist/codedna/kappa-vitest-generator.d.ts +85 -0
  35. package/dist/codedna/kappa-vitest-generator.js +739 -0
  36. package/dist/codedna/parser.js +26 -1
  37. package/dist/codegen/cloud-client.d.ts +160 -0
  38. package/dist/codegen/cloud-client.js +195 -0
  39. package/dist/codegen/codegen-tool.d.ts +35 -0
  40. package/dist/codegen/codegen-tool.js +312 -0
  41. package/dist/codegen/field-inference.d.ts +24 -0
  42. package/dist/codegen/field-inference.js +101 -0
  43. package/dist/codegen/form-parser.d.ts +13 -0
  44. package/dist/codegen/form-parser.js +186 -0
  45. package/dist/codegen/index.d.ts +2 -0
  46. package/dist/codegen/index.js +4 -0
  47. package/dist/codegen/natural-parser.d.ts +50 -0
  48. package/dist/codegen/natural-parser.js +769 -0
  49. package/dist/handlers/codedna-handlers.d.ts +1 -1
  50. package/dist/handlers/codegen-handlers.d.ts +20 -0
  51. package/dist/handlers/codegen-handlers.js +60 -0
  52. package/dist/handlers/kappa-handlers.d.ts +97 -0
  53. package/dist/handlers/kappa-handlers.js +408 -0
  54. package/dist/handlers/tool-handlers.js +124 -221
  55. package/dist/helpers/api-client.js +48 -3
  56. package/dist/helpers/compact-formatter.d.ts +9 -2
  57. package/dist/helpers/compact-formatter.js +26 -2
  58. package/dist/helpers/config.d.ts +7 -2
  59. package/dist/helpers/config.js +25 -10
  60. package/dist/helpers/session-validation.d.ts +1 -1
  61. package/dist/helpers/session-validation.js +2 -4
  62. package/dist/helpers/tasks.d.ts +21 -0
  63. package/dist/helpers/tasks.js +52 -0
  64. package/dist/helpers/workers.d.ts +1 -1
  65. package/dist/helpers/workers.js +19 -19
  66. package/dist/setup.d.ts +1 -0
  67. package/dist/setup.js +49 -16
  68. package/dist/templates/claude-md.d.ts +1 -1
  69. package/dist/templates/claude-md.js +37 -152
  70. package/dist/templates/orchestrator-prompt.d.ts +2 -2
  71. package/dist/templates/orchestrator-prompt.js +31 -38
  72. package/dist/templates/self-critique.d.ts +50 -0
  73. package/dist/templates/self-critique.js +209 -0
  74. package/dist/templates/worker-prompt.d.ts +3 -3
  75. package/dist/templates/worker-prompt.js +18 -18
  76. package/dist/tools.js +77 -413
  77. package/docs/codedna/generator-testing-summary.md +205 -0
  78. package/docs/codedna/radix-ui-generator.md +478 -0
  79. package/docs/kappa-gofiber-generator.md +274 -0
  80. package/docs/kappa-laravel-fixes.md +172 -0
  81. package/docs/kappa-mongoose-generator.md +322 -0
  82. package/docs/kappa-vitest-generator.md +337 -0
  83. package/package.json +1 -1
  84. package/dist/context/deduplication.test.d.ts +0 -6
  85. package/dist/context/deduplication.test.js +0 -84
@@ -85,22 +85,17 @@ export function buildOrchestratorPrompt(params) {
85
85
  - File-by-file change lists
86
86
  </behavior>
87
87
 
88
- <behavior id="codedna_specs" priority="MANDATORY">
88
+ <behavior id="codegen_specs" priority="MANDATORY">
89
89
  When tasks involve creating entities/models/APIs:
90
90
 
91
- INSTEAD OF writing code like:
92
- \`\`\`typescript
93
- interface User {
94
- id: string;
95
- email: string;
96
- password: string;
97
- }
98
- \`\`\`
91
+ INSTEAD OF writing code, USE natural language:
92
+ "User with email, password, role (admin/user)"
99
93
 
100
- USE Entity DSL format:
101
- "User(id:string:unique, email:string:required, password:string:hashed)"
94
+ Workers use codegen() which infers types from field names:
95
+ - email → email type, passwordhashed, createdAt → timestamp
96
+ - (admin/user) → enum, price → decimal, isActive → boolean
102
97
 
103
- This tells workers to use CodeDNA generators (95-99% token savings).
98
+ Token savings: 95-99% vs manual coding.
104
99
  </behavior>
105
100
 
106
101
  <behavior id="parallel_dispatch" priority="IMPORTANT">
@@ -161,19 +156,18 @@ export function buildOrchestratorPrompt(params) {
161
156
  - Random .md files scattered in src/ or root
162
157
  </documentation_standards>
163
158
 
164
- <entity_dsl_format>
165
- When defining data models, use Entity DSL:
159
+ <entity_format>
160
+ When defining data models, use natural language:
166
161
 
167
- FORMAT: EntityName(field:type:constraint, field:type:constraint, ...)
168
-
169
- TYPES: string, integer, decimal, boolean, datetime, ref(Entity), enum(val1|val2)
170
- CONSTRAINTS: unique, required, min(n), max(n), hashed, default(val)
162
+ FORMAT: "EntityName with field1, field2, field3 (enum values)"
171
163
 
172
164
  EXAMPLES:
173
- - "User(email:string:unique:required, password:string:hashed, role:enum(admin|user))"
174
- - "Product(name:string:required, price:decimal:min(0), category:ref(Category))"
175
- - "Order(user:ref(User), total:decimal, status:enum(pending|paid|shipped))"
176
- </entity_dsl_format>
165
+ - "User with email, password, role (admin/user)"
166
+ - "Product with name, price, categoryId"
167
+ - "Order with userId, total, status (pending/paid/shipped)"
168
+
169
+ Types are inferred from field names (email→email, password→hashed, price→decimal)
170
+ </entity_format>
177
171
 
178
172
  <acceptance_criteria_format>
179
173
  Good acceptance criteria are:
@@ -219,24 +213,23 @@ export function buildOrchestratorPrompt(params) {
219
213
  - general-expert: Tasks that don't fit other domains`}
220
214
  </available_workers>
221
215
 
222
- <codedna_generators priority="CRITICAL">
223
- CodeDNA generates production code from Entity DSL - workers MUST check availability first.
216
+ <codegen priority="CRITICAL">
217
+ codegen() generates production code from natural language descriptions.
224
218
 
225
- BEFORE creating any task involving APIs, CRUD, or UI components:
226
- 1. Workers should call codedna_list_generators() to see available generators
227
- 2. If a generator exists, use it instead of writing code manually
219
+ USAGE: codegen({ describe: "User with email, password, role (admin/user)" })
228
220
 
229
- AVAILABLE DOMAINS:
230
- - api: Express, FastAPI, NestJS (full CRUD with auth, validation, tests)
231
- - frontend: React/Next.js, Vue 3 (pages, forms, tables)
232
- - component: Forms, tables, cards, modals (React, Vue, Svelte)
221
+ GENERATES:
222
+ - Drizzle schema (database tables)
223
+ - TypeScript types
224
+ - Zod validators
225
+ - API routes (Hono/Express)
233
226
 
234
227
  INCLUDE IN TASK DESCRIPTIONS:
235
- When tasks involve entities, include the DSL spec so workers know to use CodeDNA:
236
- "Create user registration. Entity: User(email:string:unique, password:string:hashed)"
228
+ When tasks involve entities, describe them naturally:
229
+ "Create user registration. Entity: User with email, password, role (admin/user)"
237
230
 
238
- Token savings: 95-99% vs manual coding
239
- </codedna_generators>
231
+ Stack auto-detected from package.json. Token savings: 95-99% vs manual coding.
232
+ </codegen>
240
233
 
241
234
  ${epicTitle ? `<epic_context>
242
235
  <title>${epicTitle}</title>
@@ -259,10 +252,10 @@ export function buildOrchestratorPrompt(params) {
259
252
  </user_input>`;
260
253
  }
261
254
  /**
262
- * Get CodeDNA usage hint for task descriptions
255
+ * Get codegen usage hint for task descriptions
263
256
  */
264
- export function getCodeDNAHint(entitySpec) {
265
- return `Entity spec: "${entitySpec}" (workers will use CodeDNA generators)`;
257
+ export function getCodegenHint(entityDescription) {
258
+ return `Entity: ${entityDescription} (workers will use codegen)`;
266
259
  }
267
260
  /**
268
261
  * Validate task description doesn't contain code
@@ -0,0 +1,50 @@
1
+ export interface SelfCritiqueContext {
2
+ taskDescription: string;
3
+ proposedSolution: string;
4
+ codeSnippet?: string;
5
+ targetAudience?: string;
6
+ }
7
+ export interface SelfCritiqueResult {
8
+ passed: boolean;
9
+ issues: SelfCritiqueIssue[];
10
+ suggestions: string[];
11
+ overallScore: number;
12
+ }
13
+ export interface SelfCritiqueIssue {
14
+ category: 'universality' | 'simplicity' | 'hardcoding' | 'assumptions';
15
+ severity: 'low' | 'medium' | 'high';
16
+ description: string;
17
+ suggestion: string;
18
+ }
19
+ /**
20
+ * Generate a self-critique prompt for AI agents.
21
+ * This prompt guides the AI to check its own work for common issues.
22
+ */
23
+ export declare function generateSelfCritiquePrompt(context: SelfCritiqueContext): string;
24
+ /**
25
+ * Quick check prompts for specific concerns.
26
+ * Use these for targeted self-critique on specific aspects.
27
+ */
28
+ export declare const QUICK_CRITIQUE_PROMPTS: {
29
+ universality: string;
30
+ simplicity: string;
31
+ hardcoding: string;
32
+ assumptions: string;
33
+ };
34
+ /**
35
+ * Generate a pre-commit checklist for AI agents.
36
+ * A lightweight version of self-critique for quick checks.
37
+ */
38
+ export declare function generatePreCommitChecklist(taskType: 'code' | 'design' | 'analysis'): string;
39
+ /**
40
+ * Parse a self-critique response from an LLM.
41
+ */
42
+ export declare function parseSelfCritiqueResponse(response: string): SelfCritiqueResult | null;
43
+ /**
44
+ * Determine if a self-critique result warrants action.
45
+ */
46
+ export declare function shouldTakeAction(result: SelfCritiqueResult): {
47
+ shouldRevise: boolean;
48
+ shouldAskUser: boolean;
49
+ reason: string;
50
+ };
@@ -0,0 +1,209 @@
1
+ // =============================================================================
2
+ // Self-Critique Prompt Template
3
+ // =============================================================================
4
+ // A template for AI agents to self-critique their work before finalizing.
5
+ // Catches issues like hardcoded patterns, over-engineering, and assumptions
6
+ // before they require user intervention.
7
+ // =============================================================================
8
+ /**
9
+ * Generate a self-critique prompt for AI agents.
10
+ * This prompt guides the AI to check its own work for common issues.
11
+ */
12
+ export function generateSelfCritiquePrompt(context) {
13
+ const codeSection = context.codeSnippet
14
+ ? `\n## Code to Review\n\`\`\`\n${context.codeSnippet.slice(0, 2000)}\n\`\`\``
15
+ : '';
16
+ const audienceNote = context.targetAudience
17
+ ? `Target audience: ${context.targetAudience}`
18
+ : 'Target audience: All users (universal)';
19
+ return `# Self-Critique Review
20
+
21
+ You are reviewing your own proposed solution before finalizing. Be critical and honest.
22
+
23
+ ## Task
24
+ ${context.taskDescription}
25
+
26
+ ## Proposed Solution
27
+ ${context.proposedSolution}
28
+ ${codeSection}
29
+
30
+ ## Review Criteria
31
+
32
+ ${audienceNote}
33
+
34
+ Evaluate the solution against these criteria:
35
+
36
+ ### 1. Universality (Does this work for ALL users?)
37
+ - Does this assume a specific communication style?
38
+ - Would this work for users from different cultures/backgrounds?
39
+ - Are there hardcoded patterns that only match certain phrasings?
40
+ - Would a user with a different vocabulary trigger this correctly?
41
+
42
+ ### 2. Simplicity (Is this over-engineered?)
43
+ - Is there a simpler way to achieve the same result?
44
+ - Are there unnecessary abstractions or indirections?
45
+ - Is the complexity justified by the requirements?
46
+ - Would a junior developer understand this easily?
47
+
48
+ ### 3. Hardcoding (Am I hardcoding things that should be inferred?)
49
+ - Are there magic strings that should be configurable?
50
+ - Are there hardcoded patterns that limit flexibility?
51
+ - Should any of this logic be LLM-inferred instead of rule-based?
52
+ - Are there assumptions baked into constants that might not hold?
53
+
54
+ ### 4. Assumptions (What am I assuming that might be wrong?)
55
+ - What implicit assumptions does this solution make?
56
+ - Are these assumptions documented or validated?
57
+ - What happens if an assumption is violated?
58
+ - Would a user from a different context have different expectations?
59
+
60
+ ## Output Format
61
+
62
+ Respond with a JSON object:
63
+ {
64
+ "passed": true/false,
65
+ "issues": [
66
+ {
67
+ "category": "universality|simplicity|hardcoding|assumptions",
68
+ "severity": "low|medium|high",
69
+ "description": "What the issue is",
70
+ "suggestion": "How to fix it"
71
+ }
72
+ ],
73
+ "suggestions": ["List of improvement suggestions"],
74
+ "overallScore": 0-100
75
+ }
76
+
77
+ A solution passes if:
78
+ - No high-severity issues
79
+ - overallScore >= 70
80
+ - All critical universality concerns addressed
81
+
82
+ Be critical. It's better to catch issues now than to require user intervention later.`;
83
+ }
84
+ /**
85
+ * Quick check prompts for specific concerns.
86
+ * Use these for targeted self-critique on specific aspects.
87
+ */
88
+ export const QUICK_CRITIQUE_PROMPTS = {
89
+ universality: `Before finalizing, ask yourself:
90
+ - Would this work for a user who communicates differently than me?
91
+ - Am I assuming English idioms or Western communication patterns?
92
+ - Would this handle indirect, polite, or terse communication styles?
93
+ - If I replaced keywords with synonyms, would it still work?`,
94
+ simplicity: `Before finalizing, ask yourself:
95
+ - Can I explain this in one sentence?
96
+ - Is there a 3-line solution I'm missing?
97
+ - Would a code reviewer ask "why is this so complicated?"
98
+ - Am I solving future problems that don't exist yet?`,
99
+ hardcoding: `Before finalizing, ask yourself:
100
+ - Am I matching specific strings that could be phrased differently?
101
+ - Should this regex be an LLM inference instead?
102
+ - Are my constants actually universal, or just common in my experience?
103
+ - Would this break if the user uses different terminology?`,
104
+ assumptions: `Before finalizing, ask yourself:
105
+ - What am I assuming about the user's environment?
106
+ - What am I assuming about their technical level?
107
+ - What am I assuming about their preferences?
108
+ - What happens if any of these assumptions are wrong?`,
109
+ };
110
+ /**
111
+ * Generate a pre-commit checklist for AI agents.
112
+ * A lightweight version of self-critique for quick checks.
113
+ */
114
+ export function generatePreCommitChecklist(taskType) {
115
+ const baseChecks = `
116
+ ## Pre-Commit Checklist
117
+
118
+ Before finalizing, verify:
119
+
120
+ ☐ **Universality**: Works for diverse users, not just specific communication styles
121
+ ☐ **Simplicity**: No unnecessary complexity; a simpler solution doesn't exist
122
+ ☐ **No Hardcoding**: Dynamic where needed; LLM inference over rigid patterns
123
+ ☐ **Assumptions Documented**: Any assumptions are explicit and validated
124
+ `;
125
+ const typeSpecificChecks = {
126
+ code: `
127
+ ### Code-Specific
128
+ ☐ No magic strings that should be configurable
129
+ ☐ No regex patterns that could be LLM inference
130
+ ☐ Error messages are helpful, not cryptic
131
+ ☐ Edge cases are handled, not assumed away
132
+ `,
133
+ design: `
134
+ ### Design-Specific
135
+ ☐ Scales to 10x users without architecture changes
136
+ ☐ Failure modes are graceful, not catastrophic
137
+ ☐ New developers can understand the design in 5 minutes
138
+ ☐ No premature optimization or over-abstraction
139
+ `,
140
+ analysis: `
141
+ ### Analysis-Specific
142
+ ☐ Conclusions are supported by evidence
143
+ ☐ Alternative interpretations are considered
144
+ ☐ Limitations are acknowledged
145
+ ☐ Recommendations are actionable
146
+ `,
147
+ };
148
+ return baseChecks + (typeSpecificChecks[taskType] || '');
149
+ }
150
+ /**
151
+ * Parse a self-critique response from an LLM.
152
+ */
153
+ export function parseSelfCritiqueResponse(response) {
154
+ try {
155
+ // Extract JSON from response (handles markdown code blocks)
156
+ let jsonStr = response.trim();
157
+ if (jsonStr.startsWith('```')) {
158
+ jsonStr = jsonStr.replace(/```json?\n?/g, '').replace(/```$/g, '').trim();
159
+ }
160
+ const parsed = JSON.parse(jsonStr);
161
+ // Validate structure
162
+ if (typeof parsed.passed !== 'boolean')
163
+ return null;
164
+ if (!Array.isArray(parsed.issues))
165
+ return null;
166
+ if (typeof parsed.overallScore !== 'number')
167
+ return null;
168
+ return parsed;
169
+ }
170
+ catch {
171
+ return null;
172
+ }
173
+ }
174
+ /**
175
+ * Determine if a self-critique result warrants action.
176
+ */
177
+ export function shouldTakeAction(result) {
178
+ // High severity issues always require revision
179
+ const highSeverityIssues = result.issues.filter(i => i.severity === 'high');
180
+ if (highSeverityIssues.length > 0) {
181
+ return {
182
+ shouldRevise: true,
183
+ shouldAskUser: false,
184
+ reason: `${highSeverityIssues.length} high-severity issue(s) found: ${highSeverityIssues.map(i => i.description).join('; ')}`,
185
+ };
186
+ }
187
+ // Low score requires revision
188
+ if (result.overallScore < 70) {
189
+ return {
190
+ shouldRevise: true,
191
+ shouldAskUser: false,
192
+ reason: `Score ${result.overallScore}/100 is below threshold (70)`,
193
+ };
194
+ }
195
+ // Multiple medium issues warrant user consultation
196
+ const mediumIssues = result.issues.filter(i => i.severity === 'medium');
197
+ if (mediumIssues.length >= 3) {
198
+ return {
199
+ shouldRevise: false,
200
+ shouldAskUser: true,
201
+ reason: `Multiple medium-severity issues found. User should review: ${mediumIssues.map(i => i.description).join('; ')}`,
202
+ };
203
+ }
204
+ return {
205
+ shouldRevise: false,
206
+ shouldAskUser: false,
207
+ reason: 'Solution passed self-critique',
208
+ };
209
+ }
@@ -27,15 +27,15 @@ export interface WorkerPromptParams {
27
27
  tier?: 'minimal' | 'standard' | 'professional';
28
28
  }
29
29
  /**
30
- * Build worker system prompt with CodeDNA integration
30
+ * Build worker system prompt
31
31
  *
32
32
  * Workers:
33
33
  * - Execute specific implementation tasks
34
- * - Use CodeDNA generators for boilerplate code
34
+ * - Use codegen for boilerplate code
35
35
  * - Use tools (memory, codebase) before writing from scratch
36
36
  * - Report completion with detailed summaries
37
37
  */
38
- export declare function buildWorkerPromptWithCodeDNA(params: WorkerPromptParams): string;
38
+ export declare function buildWorkerPrompt(params: WorkerPromptParams): string;
39
39
  /**
40
40
  * Build a minimal prompt for simple tasks
41
41
  */
@@ -1,22 +1,22 @@
1
1
  // =============================================================================
2
- // Worker Prompt Template with CodeDNA Integration
2
+ // Worker Prompt Template
3
3
  // =============================================================================
4
4
  //
5
5
  // Standard tier (~2000 tokens) prompt template for worker agents.
6
- // Instructs workers to use CodeDNA generators and tools before writing code.
6
+ // Instructs workers to use codegen and tools before writing code.
7
7
  //
8
8
  // Based on 10/10 AI System Prompt Architecture Framework
9
9
  //
10
10
  /**
11
- * Build worker system prompt with CodeDNA integration
11
+ * Build worker system prompt
12
12
  *
13
13
  * Workers:
14
14
  * - Execute specific implementation tasks
15
- * - Use CodeDNA generators for boilerplate code
15
+ * - Use codegen for boilerplate code
16
16
  * - Use tools (memory, codebase) before writing from scratch
17
17
  * - Report completion with detailed summaries
18
18
  */
19
- export function buildWorkerPromptWithCodeDNA(params) {
19
+ export function buildWorkerPrompt(params) {
20
20
  const { task, worker, epicContext, attachedContext = [], siblingTasks = [], tier = 'standard' } = params;
21
21
  // Build sections based on tier
22
22
  const sections = [];
@@ -67,9 +67,9 @@ function buildIdentitySection(worker) {
67
67
  function buildBehavioralSection(taskId) {
68
68
  return `<!-- Layer 2: Behavioral Guidelines -->
69
69
  <behavioral_guidelines>
70
- <behavior id="codedna_first" priority="MANDATORY">
71
- BEFORE writing code: codedna_list_generators() → check if task matches generator
72
- Entity DSL: "User(email:string:unique, password:string:hashed)"
70
+ <behavior id="codegen_first" priority="MANDATORY">
71
+ BEFORE writing boilerplate: codegen({ describe: "..." }) → generates schema, types, validators, routes
72
+ Natural language: "User with email, password, role (admin/user)"
73
73
  Only write manually for: complex logic, modifications, custom business rules
74
74
  </behavior>
75
75
 
@@ -109,12 +109,12 @@ function buildStandardsSection() {
109
109
  function buildDomainSection(worker) {
110
110
  return `<!-- Layer 4: Domain Knowledge -->
111
111
  <domain_knowledge>
112
- <codedna_capabilities>
113
- Discovery: codedna_list_generators() detect framework validate spec generate
114
- DSL: EntityName(field:type:constraint, ...)
115
- Types: string, integer, decimal, boolean, datetime, ref(Entity), enum(a|b)
116
- Constraints: unique, required, min(n), max(n), hashed, default(v), textarea, switch
117
- </codedna_capabilities>
112
+ <codegen>
113
+ Usage: codegen({ describe: "User with email, password, role (admin/user)" })
114
+ Generates: Drizzle schema, TypeScript types, Zod validators, API routes
115
+ Smart inference: email→email type, password→hashed, createdAt→timestamp, price→decimal
116
+ Stack auto-detected from package.json (Drizzle, Hono, Express, etc.)
117
+ </codegen>
118
118
 
119
119
  <worker_expertise>
120
120
  ${worker.promptTemplate}
@@ -126,7 +126,7 @@ function buildCrossCuttingSection() {
126
126
  <cross_cutting_concerns>
127
127
  <error_handling>Validate boundaries. Fail fast. Clear messages. Actionable guidance.</error_handling>
128
128
  <security>OWASP Top 10. No exposed secrets. Sanitize inputs. Parameterized queries. Least privilege.</security>
129
- <performance>No premature optimization. Token efficiency. CodeDNA for boilerplate.</performance>
129
+ <performance>No premature optimization. Token efficiency. codegen for boilerplate.</performance>
130
130
  </cross_cutting_concerns>`;
131
131
  }
132
132
  function buildTaskSection(task, epicContext) {
@@ -178,7 +178,7 @@ function buildProtocolSection(taskId) {
178
178
  return `<!-- Protocol -->
179
179
  <protocol>
180
180
  <step number="1">task_start(task_id="${taskId}")</step>
181
- <step number="2">Check CodeDNA for entities/APIs, else use tools (memory_search, codebase_find)</step>
181
+ <step number="2">Check codegen for entities/APIs, else use tools (memory_search, codebase_find)</step>
182
182
  <step number="3">Implement requirements. Minimal changes.</step>
183
183
  <step number="4">task_complete(task_id="${taskId}", summary="impl, files, decisions, testing")</step>
184
184
 
@@ -195,11 +195,11 @@ function buildProtocolSection(taskId) {
195
195
  * Build a minimal prompt for simple tasks
196
196
  */
197
197
  export function buildMinimalWorkerPrompt(params) {
198
- return buildWorkerPromptWithCodeDNA({ ...params, tier: 'minimal' });
198
+ return buildWorkerPrompt({ ...params, tier: 'minimal' });
199
199
  }
200
200
  /**
201
201
  * Build a professional prompt for complex tasks
202
202
  */
203
203
  export function buildProfessionalWorkerPrompt(params) {
204
- return buildWorkerPromptWithCodeDNA({ ...params, tier: 'professional' });
204
+ return buildWorkerPrompt({ ...params, tier: 'professional' });
205
205
  }