@claudetools/tools 0.8.10 → 0.9.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 (76) hide show
  1. package/dist/codedna/generators/astro.d.ts +18 -0
  2. package/dist/codedna/generators/astro.js +91 -0
  3. package/dist/codedna/generators/authjs.d.ts +18 -0
  4. package/dist/codedna/generators/authjs.js +68 -0
  5. package/dist/codedna/generators/better-auth.d.ts +18 -0
  6. package/dist/codedna/generators/better-auth.js +62 -0
  7. package/dist/codedna/generators/drizzle-orm.d.ts +18 -0
  8. package/dist/codedna/generators/drizzle-orm.js +65 -0
  9. package/dist/codedna/generators/elysia-api.d.ts +12 -0
  10. package/dist/codedna/generators/elysia-api.js +64 -0
  11. package/dist/codedna/generators/hono-api.d.ts +12 -0
  12. package/dist/codedna/generators/hono-api.js +64 -0
  13. package/dist/codedna/generators/lucia-auth.d.ts +18 -0
  14. package/dist/codedna/generators/lucia-auth.js +69 -0
  15. package/dist/codedna/generators/prisma.d.ts +18 -0
  16. package/dist/codedna/generators/prisma.js +64 -0
  17. package/dist/codedna/generators/react-router-v7.d.ts +18 -0
  18. package/dist/codedna/generators/react-router-v7.js +77 -0
  19. package/dist/codedna/generators/react19-shadcn.d.ts +21 -0
  20. package/dist/codedna/generators/react19-shadcn.js +367 -0
  21. package/dist/codedna/generators/sveltekit.d.ts +18 -0
  22. package/dist/codedna/generators/sveltekit.js +73 -0
  23. package/dist/codedna/generators/tanstack-start-drizzle.d.ts +92 -0
  24. package/dist/codedna/generators/tanstack-start-drizzle.js +824 -0
  25. package/dist/codedna/generators/trpc-api.d.ts +12 -0
  26. package/dist/codedna/generators/trpc-api.js +64 -0
  27. package/dist/codedna/index.d.ts +31 -0
  28. package/dist/codedna/index.js +39 -0
  29. package/dist/codedna/kappa-api-generator.d.ts +89 -0
  30. package/dist/codedna/kappa-api-generator.js +493 -0
  31. package/dist/codedna/kappa-ast.d.ts +552 -0
  32. package/dist/codedna/kappa-ast.js +141 -0
  33. package/dist/codedna/kappa-cli.d.ts +2 -0
  34. package/dist/codedna/kappa-cli.js +302 -0
  35. package/dist/codedna/kappa-component-generator.d.ts +47 -0
  36. package/dist/codedna/kappa-component-generator.js +295 -0
  37. package/dist/codedna/kappa-design-generator.d.ts +52 -0
  38. package/dist/codedna/kappa-design-generator.js +365 -0
  39. package/dist/codedna/kappa-drizzle-generator.d.ts +45 -0
  40. package/dist/codedna/kappa-drizzle-generator.js +355 -0
  41. package/dist/codedna/kappa-form-generator.d.ts +51 -0
  42. package/dist/codedna/kappa-form-generator.js +319 -0
  43. package/dist/codedna/kappa-lexer.d.ts +268 -0
  44. package/dist/codedna/kappa-lexer.js +757 -0
  45. package/dist/codedna/kappa-page-generator.d.ts +57 -0
  46. package/dist/codedna/kappa-page-generator.js +338 -0
  47. package/dist/codedna/kappa-parser.d.ts +261 -0
  48. package/dist/codedna/kappa-parser.js +2547 -0
  49. package/dist/codedna/kappa-provenance.d.ts +101 -0
  50. package/dist/codedna/kappa-provenance.js +199 -0
  51. package/dist/codedna/kappa-types-generator.d.ts +37 -0
  52. package/dist/codedna/kappa-types-generator.js +159 -0
  53. package/dist/codedna/kappa-validator.d.ts +86 -0
  54. package/dist/codedna/kappa-validator.js +638 -0
  55. package/dist/codedna/kappa-zod-generator.d.ts +32 -0
  56. package/dist/codedna/kappa-zod-generator.js +216 -0
  57. package/dist/handlers/codedna-handlers.d.ts +1 -1
  58. package/dist/handlers/kappa-handlers.d.ts +116 -0
  59. package/dist/handlers/kappa-handlers.js +465 -0
  60. package/dist/handlers/tool-handlers.js +121 -0
  61. package/dist/templates/claude-md.d.ts +1 -1
  62. package/dist/templates/claude-md.js +166 -9
  63. package/dist/tools.js +199 -0
  64. package/docs/research/2026-01-02-codedna-il-specification.md +639 -0
  65. package/docs/research/2026-01-02-codedna-v2-research.md +943 -0
  66. package/docs/research/2026-01-02-computation-foundations.md +564 -0
  67. package/docs/research/2026-01-02-hardware-description.md +814 -0
  68. package/docs/research/2026-01-02-kappa-specification.md +697 -0
  69. package/docs/research/2026-01-02-kappa-tanstack-example.md +527 -0
  70. package/docs/research/2026-01-02-kappa-v2-synthesis.md +406 -0
  71. package/docs/research/2026-01-02-kappa-v2.5-specification.md +1218 -0
  72. package/docs/research/2026-01-02-kappa-v3-specification.md +1864 -0
  73. package/docs/research/2026-01-02-kappa-whitepaper.md +662 -0
  74. package/docs/research/2026-01-02-logic-constraint.md +731 -0
  75. package/docs/research/2026-01-02-quantum-computation.md +635 -0
  76. package/package.json +4 -2
@@ -104,26 +104,167 @@ analyze_impact("validateToken") # See what changing a function affects
104
104
 
105
105
  ## CodeDNA: Generate Code, Save 99% Tokens
106
106
 
107
- **When creating APIs/CRUD operations:** Call \`codedna_generate_api\` instead of writing code manually.
107
+ **BEFORE writing ANY code, check if CodeDNA can generate it.** Call \`codedna_list_generators()\` to see available generators.
108
108
 
109
- \`\`\`
109
+ ### Available Generators (20+)
110
+
111
+ | Category | Frameworks | Tool |
112
+ |----------|------------|------|
113
+ | **API** | Express, FastAPI, NestJS, Hono, Elysia, tRPC | \`codedna_generate_api\` |
114
+ | **Frontend** | React, Vue, SvelteKit, Astro, React Router v7, TanStack Start | \`codedna_generate_frontend\` |
115
+ | **ORM** | Prisma, Drizzle | \`codedna_generate_api\` with database option |
116
+ | **Auth** | Better Auth, Auth.js, Lucia | \`codedna_generate_api\` with auth option |
117
+ | **Components** | Forms, Tables, Cards, Modals (React/Vue/Svelte) | \`codedna_generate_component\` |
118
+
119
+ ### Usage Examples
120
+
121
+ \`\`\`typescript
122
+ // API with auth and validation
110
123
  codedna_generate_api({
111
- spec: "User(email:string:unique, password:string:hashed, age:integer:min(18))",
112
- framework: "express",
124
+ spec: "User(email:string:unique, password:string:hashed)",
125
+ framework: "express", // or: fastapi, nestjs, hono, elysia, trpc
113
126
  options: { auth: true, validation: true, tests: true }
114
127
  })
128
+
129
+ // Frontend with forms and data fetching
130
+ codedna_generate_frontend({
131
+ spec: "User(email:string, name:string, role:enum(admin,user))",
132
+ framework: "react", // or: vue, nextjs, sveltekit, astro
133
+ options: { forms: true, tables: true, ui: "shadcn" }
134
+ })
135
+
136
+ // Single component
137
+ codedna_generate_component({
138
+ spec: "Product(name:string, price:decimal, inStock:boolean)",
139
+ type: "form", // or: table, card, modal
140
+ framework: "react",
141
+ options: { validation: true, ui: "shadcn" }
142
+ })
143
+ \`\`\`
144
+
145
+ ### Entity DSL Quick Reference
146
+
147
+ \`\`\`
148
+ EntityName(field:type:modifier, field2:type:modifier)
149
+
150
+ Types: string, integer, decimal, boolean, datetime, text, json
151
+ Modifiers: unique, required, optional, hashed, email, min(n), max(n), default(v)
152
+ Relations: userId:User (reference), posts:Post[] (array)
153
+ Enums: role:enum(admin,user,guest)
154
+ \`\`\`
155
+
156
+ **Token savings:** 30,000 tokens → 200 tokens (99% reduction per generation)
157
+
158
+ ## Kappa v2.5: Declarative Full-Stack Generation
159
+
160
+ **For even higher-level generation**, use Kappa DSL - a declarative specification language that generates complete applications from compact specs.
161
+
162
+ ### When to Use Kappa vs CodeDNA
163
+
164
+ | Use Case | Tool |
165
+ |----------|------|
166
+ | Single entity/component | CodeDNA (\`codedna_generate_*\`) |
167
+ | Full application with multiple entities | Kappa (\`kappa_generate_all\`) |
168
+ | Pages, forms, routing together | Kappa |
169
+ | Design system + components | Kappa |
170
+
171
+ ### Kappa Tools
172
+
173
+ | Tool | Purpose |
174
+ |------|---------|
175
+ | \`kappa_parse\` | Parse and validate Kappa spec |
176
+ | \`kappa_generate_schema\` | Generate Drizzle schema + Zod + types |
177
+ | \`kappa_generate_api\` | Generate API routes (Hono/Express/tRPC) |
178
+ | \`kappa_generate_pages\` | Generate pages (TanStack Start/Next.js) |
179
+ | \`kappa_generate_forms\` | Generate forms (React Hook Form + Zod + shadcn) |
180
+ | \`kappa_generate_components\` | Generate React components (compound, forwardRef) |
181
+ | \`kappa_generate_design\` | Generate CSS variables + Tailwind config |
182
+ | \`kappa_generate_all\` | Generate complete full-stack application |
183
+
184
+ ### Kappa DSL Example
185
+
186
+ \`\`\`
187
+ // Complete app specification in ~50 lines
188
+ project TaskManager {
189
+ database postgres
190
+ framework tanstack-start
191
+ }
192
+
193
+ entity Task {
194
+ title string required max(100)
195
+ description text
196
+ status enum(todo, in_progress, done) default(todo)
197
+ dueDate datetime
198
+ assignee User
199
+ }
200
+
201
+ entity User {
202
+ email string unique email
203
+ name string required
204
+ tasks Task[]
205
+ }
206
+
207
+ api /tasks {
208
+ GET / -> list Task[]
209
+ POST / -> create Task
210
+ GET /:id -> get Task
211
+ PUT /:id -> update Task
212
+ DELETE /:id -> delete Task
213
+ }
214
+
215
+ page /tasks {
216
+ layout dashboard
217
+ load tasks from /api/tasks
218
+ components [TaskList, TaskForm]
219
+ }
220
+
221
+ form TaskForm for Task {
222
+ fields [title, description, status, dueDate]
223
+ submit POST /api/tasks
224
+ }
225
+
226
+ design {
227
+ colors {
228
+ primary #3B82F6
229
+ secondary #6B7280
230
+ }
231
+ typography {
232
+ fontFamily "Inter"
233
+ scale { sm: "0.875rem", base: "1rem", lg: "1.125rem" }
234
+ }
235
+ }
236
+ \`\`\`
237
+
238
+ ### Usage
239
+
240
+ \`\`\`typescript
241
+ // Generate everything from spec
242
+ kappa_generate_all({
243
+ spec: \`project MyApp { ... }\`,
244
+ options: {
245
+ framework: "tanstack-start",
246
+ ui: "shadcn",
247
+ dbDialect: "postgres"
248
+ }
249
+ })
250
+
251
+ // Or generate incrementally
252
+ kappa_parse({ spec: "..." }) // Validate first
253
+ kappa_generate_schema({ spec: "...", outputs: ["drizzle", "zod", "types"] })
254
+ kappa_generate_api({ spec: "...", framework: "hono" })
255
+ kappa_generate_pages({ spec: "...", framework: "tanstack-start" })
115
256
  \`\`\`
116
257
 
117
- **Generates 6 production files** (models, controllers, routes, validators, auth, tests) in ~5 seconds.
118
- **Saves:** 30,000 tokens → 200 tokens (99% reduction)
258
+ **Token savings:** ~50 lines of Kappa thousands of lines of production code (95%+ reduction)
119
259
 
120
260
  ## Best Practices
121
261
 
122
262
  1. **Trust auto-injection** - Context is injected automatically, don't call memory_search
123
263
  2. **Store decisions** - Use \`memory_store_fact\` for architectural choices
124
264
  3. **Use task tracking** - Break complex work into tasks
125
- 4. **Use CodeDNA for APIs** - Generate instead of write (99% token savings)
126
- 5. **Minimize tool calls** - Every MCP call costs context tokens
265
+ 4. **Use Kappa for full apps** - For multi-entity apps with pages/forms, use \`kappa_generate_all\`
266
+ 5. **Use CodeDNA for single components** - For individual entities or components, use \`codedna_generate_*\`
267
+ 6. **Minimize tool calls** - Every MCP call costs context tokens
127
268
  ${SECTION_END}
128
269
  `;
129
270
  /**
@@ -136,8 +277,9 @@ ${SECTION_START}
136
277
 
137
278
  **Project ID:** \`${projectId}\`
138
279
 
139
- Context is **auto-injected** via hooks. Only use \`memory_store_fact\` to store new facts:
280
+ Context is **auto-injected** via hooks - no need to call memory_search.
140
281
 
282
+ ## Store Facts (DO use this)
141
283
  \`\`\`
142
284
  memory_store_fact(
143
285
  entity1: "ComponentName",
@@ -147,6 +289,21 @@ memory_store_fact(
147
289
  project_id: "${projectId}"
148
290
  )
149
291
  \`\`\`
292
+
293
+ ## Task Management
294
+ \`\`\`
295
+ task_plan({ goal: "...", epic_title: "...", tasks: [...] })
296
+ task_start({ task_id: "task_xxx" })
297
+ task_complete({ task_id: "task_xxx", summary: "What was done" })
298
+ \`\`\`
299
+
300
+ ## CodeDNA (saves 95-99% tokens)
301
+ \`\`\`
302
+ codedna_list_generators() // See all available generators
303
+ codedna_generate_api("User(email:string:unique, password:string)", "express")
304
+ codedna_generate_frontend("User(email:string, name:string)", "react")
305
+ codedna_generate_component("Product(name:string, price:decimal)", "form", "react")
306
+ \`\`\`
150
307
  ${SECTION_END}
151
308
  `;
152
309
  }
package/dist/tools.js CHANGED
@@ -1388,6 +1388,205 @@ Explicit lock_duration_minutes parameter overrides the effort-based default.`,
1388
1388
  required: ['project_id'],
1389
1389
  },
1390
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
+ framework: {
1473
+ 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
+ },
1585
+ },
1586
+ },
1587
+ required: ['spec'],
1588
+ },
1589
+ },
1391
1590
  ],
1392
1591
  }));
1393
1592
  }