@claudetools/tools 0.9.0 → 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 +228 -3
  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
@@ -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
  }
package/dist/tools.js CHANGED
@@ -533,7 +533,14 @@ High hit rate memories (frequently fetched after being indexed) are good candida
533
533
  },
534
534
  {
535
535
  name: 'task_complete',
536
- description: 'PROACTIVE: When finished with a task, mark it complete with a summary of work done. Use this after completing any task.',
536
+ description: `PROACTIVE: When finished with a task, mark it complete with a summary of work done.
537
+
538
+ IMPORTANT: For code changes, include verification evidence:
539
+ - tests_passed: Did you run tests? What was the result?
540
+ - type_check_passed: Did TypeScript compile without errors?
541
+ - manually_verified: Did you verify the change works as expected?
542
+
543
+ Tasks without verification may need follow-up. Be honest about what was tested.`,
537
544
  inputSchema: {
538
545
  type: 'object',
539
546
  properties: {
@@ -549,6 +556,28 @@ High hit rate memories (frequently fetched after being indexed) are good candida
549
556
  type: 'string',
550
557
  description: 'Your agent identifier (default: claude-code)',
551
558
  },
559
+ verification: {
560
+ type: 'object',
561
+ description: 'Verification evidence for code changes (recommended)',
562
+ properties: {
563
+ tests_passed: {
564
+ type: 'boolean',
565
+ description: 'Were tests run and did they pass?',
566
+ },
567
+ type_check_passed: {
568
+ type: 'boolean',
569
+ description: 'Did TypeScript type checking pass?',
570
+ },
571
+ manually_verified: {
572
+ type: 'boolean',
573
+ description: 'Was the change manually verified to work?',
574
+ },
575
+ evidence: {
576
+ type: 'string',
577
+ description: 'Brief description of verification performed (e.g., "npm test passed", "tested in browser")',
578
+ },
579
+ },
580
+ },
552
581
  },
553
582
  required: ['task_id', 'summary'],
554
583
  },
@@ -1145,446 +1174,81 @@ Explicit lock_duration_minutes parameter overrides the effort-based default.`,
1145
1174
  },
1146
1175
  },
1147
1176
  // =========================================================================
1148
- // CODEDNA CODE GENERATION TOOLS
1177
+ // CODEGEN TOOL (Cloud-Only)
1149
1178
  // =========================================================================
1150
1179
  {
1151
- name: 'codedna_generate_api',
1152
- description: 'Generate a complete REST API with CRUD operations from an Entity DSL specification. Saves 95-99% tokens vs writing code manually. Example: codedna_generate_api("User(email:string:unique, password:string:hashed)", "express", { auth: true })',
1153
- inputSchema: {
1154
- type: 'object',
1155
- properties: {
1156
- spec: {
1157
- type: 'string',
1158
- description: 'Entity DSL specification (e.g., "User(email:string:unique:required, password:string:hashed, age:integer:min(18))")',
1159
- },
1160
- framework: {
1161
- type: 'string',
1162
- enum: ['express', 'fastapi', 'nestjs'],
1163
- description: 'API framework to use',
1164
- },
1165
- options: {
1166
- type: 'object',
1167
- properties: {
1168
- auth: {
1169
- type: 'boolean',
1170
- description: 'Include JWT authentication middleware',
1171
- },
1172
- validation: {
1173
- type: 'boolean',
1174
- description: 'Add input validation',
1175
- },
1176
- tests: {
1177
- type: 'boolean',
1178
- description: 'Generate test files',
1179
- },
1180
- database: {
1181
- type: 'string',
1182
- enum: ['postgresql', 'mysql', 'mongodb'],
1183
- description: 'Target database',
1184
- },
1185
- },
1186
- },
1187
- package_json: {
1188
- type: 'object',
1189
- description: 'Optional: package.json content for pattern detection. If provided, generator will detect patterns (zod, yup, etc.) and use matching template variants.',
1190
- },
1191
- },
1192
- required: ['spec', 'framework'],
1193
- },
1194
- },
1195
- {
1196
- name: 'codedna_generate_frontend',
1197
- description: 'Generate frontend application with forms and tables from Entity DSL. Saves 95-99% tokens vs writing components manually.',
1180
+ name: 'codegen',
1181
+ description: `Generate code from natural language descriptions. Describe entities and the system generates schema, types, validators, and API routes.
1182
+
1183
+ EXAMPLES:
1184
+ - "User with email, password, role (admin/user)"
1185
+ - "Post with title, content, published, belongs to User as author"
1186
+ - "Product with name, price, stock, category (electronics/clothing/food)"
1187
+
1188
+ HOW IT WORKS:
1189
+ 1. Describe entities in natural language
1190
+ 2. Field types are inferred automatically:
1191
+ - email email type with unique constraint
1192
+ - password string with hashing
1193
+ - createdAt → timestamp with auto
1194
+ - id → uuid primary key (auto-added)
1195
+ - role (admin/user) → enum
1196
+ 3. Stack is auto-detected from package.json
1197
+
1198
+ OUTPUTS (configurable):
1199
+ - Drizzle schema
1200
+ - TypeScript types
1201
+ - Zod validators
1202
+ - API routes (Hono/Express)
1203
+ - React components
1204
+ - Forms and pages
1205
+ - Tests`,
1198
1206
  inputSchema: {
1199
1207
  type: 'object',
1200
1208
  properties: {
1201
- spec: {
1209
+ describe: {
1202
1210
  type: 'string',
1203
- description: 'Entity DSL specification',
1211
+ description: 'Natural language description. Example: "User with email, password, role (admin/user)"',
1204
1212
  },
1205
- framework: {
1206
- type: 'string',
1207
- enum: ['nextjs', 'react', 'vue'],
1208
- description: 'Frontend framework to use',
1209
- },
1210
- options: {
1213
+ stack: {
1211
1214
  type: 'object',
1215
+ description: 'Override auto-detected stack',
1212
1216
  properties: {
1213
- ui: {
1214
- type: 'string',
1215
- enum: ['shadcn', 'mui', 'chakra'],
1216
- description: 'UI component library',
1217
- },
1218
- forms: {
1219
- type: 'boolean',
1220
- description: 'Generate forms',
1221
- },
1222
- tables: {
1223
- type: 'boolean',
1224
- description: 'Generate data tables',
1225
- },
1226
- routing: {
1227
- type: 'boolean',
1228
- description: 'Setup routing',
1229
- },
1217
+ orm: { type: 'string', enum: ['drizzle', 'prisma', 'typeorm', 'mongoose'] },
1218
+ api: { type: 'string', enum: ['hono', 'express', 'trpc', 'gofiber', 'laravel'] },
1219
+ db: { type: 'string', enum: ['sqlite', 'postgres', 'mysql', 'mongodb'] },
1220
+ framework: { type: 'string', enum: ['tanstack-start', 'nextjs'] },
1221
+ ui: { type: 'string', enum: ['radix', 'shadcn', 'mantine'] },
1230
1222
  },
1231
1223
  },
1232
- package_json: {
1233
- type: 'object',
1234
- description: 'Optional: package.json content for pattern detection. Detects React Hook Form, Zod, TanStack Query, etc. and uses matching template variants.',
1235
- },
1236
- },
1237
- required: ['spec', 'framework'],
1238
- },
1239
- },
1240
- {
1241
- name: 'codedna_generate_component',
1242
- description: 'Generate single UI component (form, table, card, modal) from Entity DSL.',
1243
- inputSchema: {
1244
- type: 'object',
1245
- properties: {
1246
- spec: {
1247
- type: 'string',
1248
- description: 'Entity DSL specification or component spec',
1249
- },
1250
- type: {
1251
- type: 'string',
1252
- enum: ['form', 'table', 'card', 'modal'],
1253
- description: 'Component type to generate',
1254
- },
1255
- framework: {
1256
- type: 'string',
1257
- enum: ['react', 'vue', 'svelte'],
1258
- description: 'Frontend framework',
1259
- },
1260
- options: {
1261
- type: 'object',
1262
- properties: {
1263
- ui: {
1264
- type: 'string',
1265
- enum: ['shadcn', 'mui', 'chakra'],
1266
- description: 'UI library',
1267
- },
1268
- validation: {
1269
- type: 'boolean',
1270
- description: 'Include validation',
1271
- },
1224
+ generate: {
1225
+ type: 'array',
1226
+ items: {
1227
+ type: 'string',
1228
+ enum: ['schema', 'types', 'validators', 'api', 'components', 'forms', 'pages', 'tests', 'all'],
1272
1229
  },
1273
- },
1274
- package_json: {
1275
- type: 'object',
1276
- description: 'Optional: package.json content for pattern detection. Detects form libraries, validation tools, etc. and uses matching template variants.',
1277
- },
1278
- },
1279
- required: ['spec', 'type', 'framework'],
1280
- },
1281
- },
1282
- {
1283
- name: 'codedna_list_generators',
1284
- description: 'CALL THIS BEFORE writing any API, CRUD, or UI component code. Lists available code generators that save 95-99% tokens vs manual coding. Returns generators grouped by domain (api/frontend/component) with their capabilities. If a generator exists for your task, use codedna_generate_* instead of writing code manually.',
1285
- inputSchema: {
1286
- type: 'object',
1287
- properties: {
1288
- domain: {
1289
- type: 'string',
1290
- enum: ['api', 'frontend', 'component'],
1291
- description: 'Filter by domain: "api" for backend APIs, "frontend" for full frontend apps, "component" for individual UI components',
1230
+ description: 'What to generate (default: schema, types, validators)',
1292
1231
  },
1293
1232
  },
1233
+ required: ['describe'],
1294
1234
  },
1295
1235
  },
1296
1236
  {
1297
- name: 'codedna_validate_spec',
1298
- description: 'Validate Entity DSL syntax without generating code. Returns parsed structure or errors.',
1299
- inputSchema: {
1300
- type: 'object',
1301
- properties: {
1302
- spec: {
1303
- type: 'string',
1304
- description: 'Entity DSL specification to validate',
1305
- },
1306
- },
1307
- required: ['spec'],
1308
- },
1309
- },
1310
- // =========================================================================
1311
- // CodeDNA Pattern Library Tools
1312
- // =========================================================================
1313
- {
1314
- name: 'codedna_list_patterns',
1315
- description: 'List coding patterns from the library. Returns best practices (compound components, TanStack Query, Zod) and anti-patterns to avoid (prop drilling, useEffect fetch). Use to understand what patterns are available for a project.',
1237
+ name: 'codegen_list',
1238
+ description: 'List available generators. Shows all published generators with quality scores and usage counts.',
1316
1239
  inputSchema: {
1317
1240
  type: 'object',
1318
1241
  properties: {
1319
1242
  category: {
1320
1243
  type: 'string',
1321
- enum: ['components', 'hooks', 'forms', 'state', 'validation', 'styling', 'anti-patterns'],
1244
+ enum: ['schema', 'types', 'api', 'components', 'forms', 'pages', 'tests', 'auth', 'infra'],
1322
1245
  description: 'Filter by category',
1323
1246
  },
1324
- recommended_only: {
1325
- type: 'boolean',
1326
- description: 'Only return recommended best-practice patterns',
1327
- },
1328
- include_anti_patterns: {
1329
- type: 'boolean',
1330
- description: 'Include anti-patterns in results (default: true)',
1331
- },
1332
- },
1333
- },
1334
- },
1335
- {
1336
- name: 'codedna_get_pattern',
1337
- description: 'Get detailed documentation for a specific pattern including code examples, when to use/avoid, and migration guides. Use after codedna_list_patterns to get full details.',
1338
- inputSchema: {
1339
- type: 'object',
1340
- properties: {
1341
- pattern_id: {
1342
- type: 'string',
1343
- description: 'Pattern ID (e.g., "compound-components", "tanstack-query", "prop-drilling")',
1344
- },
1345
- },
1346
- required: ['pattern_id'],
1347
- },
1348
- },
1349
- {
1350
- name: 'codedna_detect_patterns',
1351
- description: 'Detect which patterns are used in an existing codebase. Analyzes package.json dependencies and code samples to identify patterns and anti-patterns. Use before making changes to understand project conventions.',
1352
- inputSchema: {
1353
- type: 'object',
1354
- properties: {
1355
- package_json: {
1356
- type: 'object',
1357
- description: 'The project package.json object (with dependencies/devDependencies)',
1358
- },
1359
- code_samples: {
1360
- type: 'array',
1361
- items: { type: 'string' },
1362
- description: 'Code snippets to analyze for pattern signals',
1363
- },
1364
- },
1365
- },
1366
- },
1367
- {
1368
- name: 'codedna_init_project',
1369
- description: 'Initialize a project with recommended patterns. For NEW projects, applies best-practice defaults. For EXISTING projects, use with auto_detect to match existing conventions.',
1370
- inputSchema: {
1371
- type: 'object',
1372
- properties: {
1373
- project_id: {
1374
- type: 'string',
1375
- description: 'Project ID from claudetools',
1376
- },
1377
- patterns: {
1378
- type: 'array',
1379
- items: { type: 'string' },
1380
- description: 'Specific pattern IDs to apply (optional - uses recommended if not specified)',
1381
- },
1382
- project_type: {
1383
- type: 'string',
1384
- enum: ['new', 'existing'],
1385
- description: '"new" for greenfield (uses recommended), "existing" for updating (detects patterns)',
1386
- },
1387
- },
1388
- required: ['project_id'],
1389
- },
1390
- },
1391
- // =========================================================================
1392
- // Kappa v2.5 DSL Tools
1393
- // =========================================================================
1394
- // Kappa is a declarative specification language for full-stack applications.
1395
- // It generates production-ready code from compact specifications, saving 95-99% tokens.
1396
- {
1397
- name: 'kappa_parse',
1398
- description: 'Parse and validate a Kappa v2.5 specification. Returns the AST and validation results. Use this to check syntax before generating code.',
1399
- inputSchema: {
1400
- type: 'object',
1401
- properties: {
1402
- spec: {
1403
- type: 'string',
1404
- description: 'Kappa specification to parse (e.g., "project MyApp { stack: tanstack-start } entity User { id: uuid, primary }")',
1405
- },
1406
- },
1407
- required: ['spec'],
1408
- },
1409
- },
1410
- {
1411
- name: 'kappa_generate_schema',
1412
- description: 'Generate database schema (Drizzle), Zod validators, and TypeScript types from Kappa entity definitions. Saves 95%+ tokens vs writing manually.',
1413
- inputSchema: {
1414
- type: 'object',
1415
- properties: {
1416
- spec: {
1417
- type: 'string',
1418
- description: 'Kappa specification with entity blocks',
1419
- },
1420
- outputs: {
1421
- type: 'array',
1422
- items: { type: 'string', enum: ['drizzle', 'zod', 'types'] },
1423
- description: 'What to generate (default: all three)',
1424
- },
1425
- options: {
1426
- type: 'object',
1427
- properties: {
1428
- provenance: { type: 'boolean', description: 'Add generation comments (default: true)' },
1429
- dbDialect: { type: 'string', enum: ['sqlite', 'postgres', 'mysql'], description: 'Database dialect (default: sqlite)' },
1430
- },
1431
- },
1432
- },
1433
- required: ['spec'],
1434
- },
1435
- },
1436
- {
1437
- name: 'kappa_generate_api',
1438
- description: 'Generate API routes from Kappa API blocks. Supports Hono, Express, and Fastify frameworks.',
1439
- inputSchema: {
1440
- type: 'object',
1441
- properties: {
1442
- spec: {
1443
- type: 'string',
1444
- description: 'Kappa specification with API blocks',
1445
- },
1446
- framework: {
1447
- type: 'string',
1448
- enum: ['hono', 'express', 'trpc'],
1449
- description: 'API framework (default: hono)',
1450
- },
1451
- options: {
1452
- type: 'object',
1453
- properties: {
1454
- provenance: { type: 'boolean' },
1455
- typescript: { type: 'boolean' },
1456
- },
1457
- },
1458
- },
1459
- required: ['spec'],
1460
- },
1461
- },
1462
- {
1463
- name: 'kappa_generate_pages',
1464
- description: 'Generate page/route components from Kappa page blocks. Supports TanStack Start and Next.js App Router with loaders, guards, and layouts.',
1465
- inputSchema: {
1466
- type: 'object',
1467
- properties: {
1468
- spec: {
1469
- type: 'string',
1470
- description: 'Kappa specification with page blocks',
1471
- },
1472
1247
  framework: {
1473
1248
  type: 'string',
1474
- enum: ['tanstack-start', 'nextjs'],
1475
- description: 'Page framework (default: tanstack-start)',
1476
- },
1477
- options: {
1478
- type: 'object',
1479
- properties: {
1480
- provenance: { type: 'boolean' },
1481
- typescript: { type: 'boolean' },
1482
- },
1483
- },
1484
- },
1485
- required: ['spec'],
1486
- },
1487
- },
1488
- {
1489
- name: 'kappa_generate_forms',
1490
- description: 'Generate React forms with React Hook Form and Zod validation from Kappa form blocks. Supports shadcn/ui components.',
1491
- inputSchema: {
1492
- type: 'object',
1493
- properties: {
1494
- spec: {
1495
- type: 'string',
1496
- description: 'Kappa specification with form blocks',
1497
- },
1498
- ui: {
1499
- type: 'string',
1500
- enum: ['shadcn', 'plain'],
1501
- description: 'UI component library (default: shadcn)',
1502
- },
1503
- options: {
1504
- type: 'object',
1505
- properties: {
1506
- provenance: { type: 'boolean' },
1507
- typescript: { type: 'boolean' },
1508
- zod: { type: 'boolean', description: 'Generate Zod validation (default: true)' },
1509
- },
1510
- },
1511
- },
1512
- required: ['spec'],
1513
- },
1514
- },
1515
- {
1516
- name: 'kappa_generate_components',
1517
- description: 'Generate React components from Kappa component blocks. Supports simple components, compound components with Context, and variants.',
1518
- inputSchema: {
1519
- type: 'object',
1520
- properties: {
1521
- spec: {
1522
- type: 'string',
1523
- description: 'Kappa specification with component blocks',
1524
- },
1525
- options: {
1526
- type: 'object',
1527
- properties: {
1528
- provenance: { type: 'boolean' },
1529
- typescript: { type: 'boolean' },
1530
- forwardRef: { type: 'boolean', description: 'Use forwardRef (default: false)' },
1531
- basePath: { type: 'string', description: 'Component output path (default: components)' },
1532
- },
1533
- },
1534
- },
1535
- required: ['spec'],
1536
- },
1537
- },
1538
- {
1539
- name: 'kappa_generate_design',
1540
- description: 'Generate CSS variables and Tailwind config from Kappa design blocks. Supports colors, typography, spacing, borders, shadows, and motion tokens.',
1541
- inputSchema: {
1542
- type: 'object',
1543
- properties: {
1544
- spec: {
1545
- type: 'string',
1546
- description: 'Kappa specification with design block',
1547
- },
1548
- format: {
1549
- type: 'string',
1550
- enum: ['css', 'tailwind', 'both'],
1551
- description: 'Output format (default: both)',
1552
- },
1553
- options: {
1554
- type: 'object',
1555
- properties: {
1556
- provenance: { type: 'boolean' },
1557
- prefix: { type: 'string', description: 'CSS variable prefix' },
1558
- hsl: { type: 'boolean', description: 'Use HSL colors (default: false)' },
1559
- },
1560
- },
1561
- },
1562
- required: ['spec'],
1563
- },
1564
- },
1565
- {
1566
- name: 'kappa_generate_all',
1567
- description: 'Generate complete full-stack application from Kappa specification. Includes schema, API, pages, forms, components, and design tokens. Maximum token savings.',
1568
- inputSchema: {
1569
- type: 'object',
1570
- properties: {
1571
- spec: {
1572
- type: 'string',
1573
- description: 'Complete Kappa specification',
1574
- },
1575
- options: {
1576
- type: 'object',
1577
- properties: {
1578
- framework: { type: 'string', enum: ['tanstack-start', 'nextjs'], description: 'Page framework (default: tanstack-start)' },
1579
- apiFramework: { type: 'string', enum: ['hono', 'express', 'trpc'], description: 'API framework (default: hono)' },
1580
- ui: { type: 'string', enum: ['shadcn', 'plain'], description: 'UI library (default: shadcn)' },
1581
- dbDialect: { type: 'string', enum: ['sqlite', 'postgres', 'mysql'], description: 'Database (default: sqlite)' },
1582
- provenance: { type: 'boolean' },
1583
- typescript: { type: 'boolean' },
1584
- },
1249
+ description: 'Filter by framework (e.g., drizzle, hono, react)',
1585
1250
  },
1586
1251
  },
1587
- required: ['spec'],
1588
1252
  },
1589
1253
  },
1590
1254
  ],