@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
@@ -0,0 +1,57 @@
1
+ import type { PageBlock } from './kappa-ast.js';
2
+ export type PageFramework = 'tanstack-start' | 'nextjs';
3
+ export interface PageGeneratorOptions {
4
+ /** Target framework (default: 'tanstack-start') */
5
+ framework?: PageFramework;
6
+ /** Add provenance comments (default: true) */
7
+ provenance?: boolean;
8
+ /** Generate TypeScript (default: true) */
9
+ typescript?: boolean;
10
+ /** Use client components by default (Next.js only) */
11
+ clientComponents?: boolean;
12
+ }
13
+ export interface GeneratedPage {
14
+ /** Page file path (relative) */
15
+ path: string;
16
+ /** Page content */
17
+ content: string;
18
+ /** Loader file (if separate) */
19
+ loader?: {
20
+ path: string;
21
+ content: string;
22
+ };
23
+ }
24
+ export interface GeneratedPages {
25
+ /** Generated page files */
26
+ pages: GeneratedPage[];
27
+ /** Shared layout files */
28
+ layouts?: {
29
+ path: string;
30
+ content: string;
31
+ }[];
32
+ }
33
+ export declare class KappaPageGenerator {
34
+ private framework;
35
+ private provenance;
36
+ private typescript;
37
+ private clientComponents;
38
+ constructor(options?: PageGeneratorOptions);
39
+ /**
40
+ * Generate page files from PageBlock AST nodes
41
+ */
42
+ generate(pages: PageBlock[]): GeneratedPages;
43
+ private generateTanStackPage;
44
+ private generateTanStackLoader;
45
+ private generateNextJSPage;
46
+ private generateNextJSLoader;
47
+ private generateLayoutJSX;
48
+ private generateActionHandler;
49
+ private routeToFilePath;
50
+ private extractRouteParams;
51
+ private toCamelCase;
52
+ private toPascalCase;
53
+ }
54
+ /**
55
+ * Generate page files from Kappa PageBlock nodes
56
+ */
57
+ export declare function generatePages(pages: PageBlock[], options?: PageGeneratorOptions): GeneratedPages;
@@ -0,0 +1,338 @@
1
+ // =============================================================================
2
+ // Kappa v2.5 Page Generator
3
+ // =============================================================================
4
+ //
5
+ // Generates page/route components from Kappa PageBlock AST.
6
+ // Supports TanStack Start and Next.js App Router.
7
+ //
8
+ // =============================================================================
9
+ // Generator Class
10
+ // =============================================================================
11
+ export class KappaPageGenerator {
12
+ framework;
13
+ provenance;
14
+ typescript;
15
+ clientComponents;
16
+ constructor(options = {}) {
17
+ this.framework = options.framework ?? 'tanstack-start';
18
+ this.provenance = options.provenance ?? true;
19
+ this.typescript = options.typescript ?? true;
20
+ this.clientComponents = options.clientComponents ?? false;
21
+ }
22
+ /**
23
+ * Generate page files from PageBlock AST nodes
24
+ */
25
+ generate(pages) {
26
+ const generatedPages = [];
27
+ for (const page of pages) {
28
+ if (this.framework === 'tanstack-start') {
29
+ generatedPages.push(this.generateTanStackPage(page));
30
+ }
31
+ else {
32
+ generatedPages.push(this.generateNextJSPage(page));
33
+ }
34
+ }
35
+ return { pages: generatedPages };
36
+ }
37
+ // ===========================================================================
38
+ // TanStack Start Generation
39
+ // ===========================================================================
40
+ generateTanStackPage(page) {
41
+ const lines = [];
42
+ const ext = this.typescript ? 'tsx' : 'jsx';
43
+ // Header
44
+ if (this.provenance) {
45
+ lines.push('// Generated by Kappa v2.5 CodeDNA');
46
+ lines.push(`// Page: ${page.name}`);
47
+ lines.push('');
48
+ }
49
+ // Imports
50
+ lines.push("import { createFileRoute } from '@tanstack/react-router';");
51
+ if (page.loaders.length > 0) {
52
+ lines.push("import { createServerFn } from '@tanstack/start';");
53
+ }
54
+ lines.push('');
55
+ // Generate loaders as server functions
56
+ for (const loader of page.loaders) {
57
+ lines.push(this.generateTanStackLoader(loader));
58
+ lines.push('');
59
+ }
60
+ // Generate route definition
61
+ lines.push(`export const Route = createFileRoute('${page.route}')({`);
62
+ // Add loader if present
63
+ if (page.loaders.length > 0) {
64
+ const loaderCalls = page.loaders.map((l) => `${this.toCamelCase(l.name)}()`).join(', ');
65
+ if (page.loaders.length === 1) {
66
+ lines.push(` loader: () => ${loaderCalls},`);
67
+ }
68
+ else {
69
+ lines.push(` loader: async () => {`);
70
+ lines.push(` const [${page.loaders.map((l) => this.toCamelCase(l.name) + 'Data').join(', ')}] = await Promise.all([${loaderCalls}]);`);
71
+ lines.push(` return { ${page.loaders.map((l) => this.toCamelCase(l.name) + 'Data').join(', ')} };`);
72
+ lines.push(` },`);
73
+ }
74
+ }
75
+ // Add meta
76
+ if (page.title || page.meta) {
77
+ lines.push(` meta: () => [{`);
78
+ if (page.title) {
79
+ lines.push(` title: '${page.title}',`);
80
+ }
81
+ if (page.meta) {
82
+ for (const [key, value] of Object.entries(page.meta)) {
83
+ lines.push(` ${key}: '${value}',`);
84
+ }
85
+ }
86
+ lines.push(` }],`);
87
+ }
88
+ // Add beforeLoad for guards
89
+ if (page.guard) {
90
+ lines.push(` beforeLoad: ({ context }) => {`);
91
+ if (page.guard === 'authenticated') {
92
+ lines.push(` if (!context.auth?.user) {`);
93
+ lines.push(` throw redirect({ to: '/login' });`);
94
+ lines.push(` }`);
95
+ }
96
+ else if (page.guard === 'guest_only') {
97
+ lines.push(` if (context.auth?.user) {`);
98
+ lines.push(` throw redirect({ to: '/dashboard' });`);
99
+ lines.push(` }`);
100
+ }
101
+ lines.push(` },`);
102
+ }
103
+ lines.push(` component: ${page.name}Page,`);
104
+ lines.push('});');
105
+ lines.push('');
106
+ // Generate component
107
+ lines.push(`function ${page.name}Page() {`);
108
+ if (page.loaders.length > 0) {
109
+ lines.push(` const loaderData = Route.useLoaderData();`);
110
+ }
111
+ lines.push(` return (`);
112
+ // Generate layout or simple content
113
+ if (page.layout) {
114
+ lines.push(this.generateLayoutJSX(page.layout, 4));
115
+ }
116
+ else if (page.component) {
117
+ lines.push(` <${page.component} />`);
118
+ }
119
+ else {
120
+ lines.push(` <div>`);
121
+ lines.push(` <h1>${page.title || page.name}</h1>`);
122
+ if (page.loaders.length > 0) {
123
+ lines.push(` {/* Loader data available in loaderData */}`);
124
+ }
125
+ lines.push(` </div>`);
126
+ }
127
+ lines.push(` );`);
128
+ lines.push('}');
129
+ // Generate action handlers
130
+ if (page.actions.length > 0) {
131
+ lines.push('');
132
+ for (const action of page.actions) {
133
+ lines.push(this.generateActionHandler(action));
134
+ }
135
+ }
136
+ const routePath = this.routeToFilePath(page.route, 'tanstack-start');
137
+ return {
138
+ path: `app/routes/${routePath}.${ext}`,
139
+ content: lines.join('\n'),
140
+ };
141
+ }
142
+ generateTanStackLoader(loader) {
143
+ const fnName = this.toCamelCase(loader.name);
144
+ const lines = [];
145
+ lines.push(`const ${fnName} = createServerFn('GET', async () => {`);
146
+ lines.push(` // TODO: Implement loader - ${loader.source}`);
147
+ lines.push(` return { /* ${loader.name} data */ };`);
148
+ lines.push('});');
149
+ return lines.join('\n');
150
+ }
151
+ // ===========================================================================
152
+ // Next.js App Router Generation
153
+ // ===========================================================================
154
+ generateNextJSPage(page) {
155
+ const lines = [];
156
+ const ext = this.typescript ? 'tsx' : 'jsx';
157
+ // Header
158
+ if (this.provenance) {
159
+ lines.push('// Generated by Kappa v2.5 CodeDNA');
160
+ lines.push(`// Page: ${page.name}`);
161
+ lines.push('');
162
+ }
163
+ // Client directive if needed
164
+ if (this.clientComponents || page.actions.length > 0) {
165
+ lines.push("'use client';");
166
+ lines.push('');
167
+ }
168
+ // Imports
169
+ if (page.meta || page.title) {
170
+ lines.push("import type { Metadata } from 'next';");
171
+ }
172
+ if (page.guard) {
173
+ lines.push("import { redirect } from 'next/navigation';");
174
+ }
175
+ lines.push('');
176
+ // Generate metadata export
177
+ if (page.title || page.meta) {
178
+ lines.push('export const metadata: Metadata = {');
179
+ if (page.title) {
180
+ lines.push(` title: '${page.title}',`);
181
+ }
182
+ if (page.meta?.description) {
183
+ lines.push(` description: '${page.meta.description}',`);
184
+ }
185
+ lines.push('};');
186
+ lines.push('');
187
+ }
188
+ // Generate params type for dynamic routes
189
+ const params = this.extractRouteParams(page.route);
190
+ const hasParams = params.length > 0;
191
+ if (hasParams && this.typescript) {
192
+ lines.push(`interface PageProps {`);
193
+ lines.push(` params: { ${params.map((p) => `${p}: string`).join('; ')} };`);
194
+ lines.push(`}`);
195
+ lines.push('');
196
+ }
197
+ // Generate page component
198
+ const propsType = hasParams ? (this.typescript ? ': PageProps' : '') : '';
199
+ const isAsync = page.loaders.length > 0;
200
+ lines.push(`export default ${isAsync ? 'async ' : ''}function ${page.name}Page(${hasParams ? `{ params }${propsType}` : ''}) {`);
201
+ // Add guard logic
202
+ if (page.guard) {
203
+ lines.push(` // Guard: ${page.guard}`);
204
+ if (page.guard === 'authenticated') {
205
+ lines.push(` // TODO: Check authentication`);
206
+ lines.push(` // if (!session) redirect('/login');`);
207
+ }
208
+ else if (page.guard === 'guest_only') {
209
+ lines.push(` // TODO: Check if guest`);
210
+ lines.push(` // if (session) redirect('/dashboard');`);
211
+ }
212
+ lines.push('');
213
+ }
214
+ // Add loader calls
215
+ if (page.loaders.length > 0) {
216
+ for (const loader of page.loaders) {
217
+ const varName = this.toCamelCase(loader.name);
218
+ lines.push(` // Loader: ${loader.name}`);
219
+ lines.push(` const ${varName} = await fetch${this.toPascalCase(loader.name)}();`);
220
+ }
221
+ lines.push('');
222
+ }
223
+ lines.push(` return (`);
224
+ // Generate layout or simple content
225
+ if (page.layout) {
226
+ lines.push(this.generateLayoutJSX(page.layout, 4));
227
+ }
228
+ else if (page.component) {
229
+ lines.push(` <${page.component} />`);
230
+ }
231
+ else {
232
+ lines.push(` <div>`);
233
+ lines.push(` <h1>${page.title || page.name}</h1>`);
234
+ lines.push(` </div>`);
235
+ }
236
+ lines.push(` );`);
237
+ lines.push('}');
238
+ // Generate loader functions
239
+ if (page.loaders.length > 0) {
240
+ lines.push('');
241
+ lines.push('// --- Data Fetching ---');
242
+ for (const loader of page.loaders) {
243
+ lines.push('');
244
+ lines.push(this.generateNextJSLoader(loader));
245
+ }
246
+ }
247
+ // Generate action handlers
248
+ if (page.actions.length > 0) {
249
+ lines.push('');
250
+ lines.push('// --- Actions ---');
251
+ for (const action of page.actions) {
252
+ lines.push('');
253
+ lines.push(this.generateActionHandler(action));
254
+ }
255
+ }
256
+ const routePath = this.routeToFilePath(page.route, 'nextjs');
257
+ return {
258
+ path: `app/${routePath}/page.${ext}`,
259
+ content: lines.join('\n'),
260
+ };
261
+ }
262
+ generateNextJSLoader(loader) {
263
+ const fnName = `fetch${this.toPascalCase(loader.name)}`;
264
+ const lines = [];
265
+ lines.push(`async function ${fnName}() {`);
266
+ lines.push(` // TODO: Implement - ${loader.source}`);
267
+ lines.push(` return { /* ${loader.name} data */ };`);
268
+ lines.push('}');
269
+ return lines.join('\n');
270
+ }
271
+ // ===========================================================================
272
+ // Shared Helpers
273
+ // ===========================================================================
274
+ generateLayoutJSX(layout, indent) {
275
+ const spaces = ' '.repeat(indent);
276
+ const lines = [];
277
+ const props = Object.entries(layout.props || {})
278
+ .map(([k, v]) => `${k}="${v}"`)
279
+ .join(' ');
280
+ const propsStr = props ? ` ${props}` : '';
281
+ if (layout.children && layout.children.length > 0) {
282
+ lines.push(`${spaces}<${layout.component}${propsStr}>`);
283
+ for (const child of layout.children) {
284
+ lines.push(this.generateLayoutJSX(child, indent + 2));
285
+ }
286
+ lines.push(`${spaces}</${layout.component}>`);
287
+ }
288
+ else {
289
+ lines.push(`${spaces}<${layout.component}${propsStr} />`);
290
+ }
291
+ return lines.join('\n');
292
+ }
293
+ generateActionHandler(action) {
294
+ const fnName = this.toCamelCase(action.name);
295
+ const lines = [];
296
+ lines.push(`function ${fnName}() {`);
297
+ lines.push(` // TODO: Implement action - ${action.handler}`);
298
+ lines.push('}');
299
+ return lines.join('\n');
300
+ }
301
+ routeToFilePath(route, framework) {
302
+ // Convert route like "/projects/:id" to file path
303
+ let path = route.replace(/^\//, ''); // Remove leading slash
304
+ if (framework === 'tanstack-start') {
305
+ // TanStack: /projects/:id -> projects.$id
306
+ path = path.replace(/\//g, '.').replace(/:(\w+)/g, '$$$1');
307
+ if (path === '')
308
+ path = '_index';
309
+ }
310
+ else {
311
+ // Next.js: /projects/:id -> projects/[id]
312
+ path = path.replace(/:(\w+)/g, '[$1]');
313
+ if (path === '')
314
+ path = '(home)';
315
+ }
316
+ return path;
317
+ }
318
+ extractRouteParams(route) {
319
+ const matches = route.match(/:(\w+)/g) || [];
320
+ return matches.map((m) => m.slice(1));
321
+ }
322
+ toCamelCase(str) {
323
+ return str.charAt(0).toLowerCase() + str.slice(1);
324
+ }
325
+ toPascalCase(str) {
326
+ return str.charAt(0).toUpperCase() + str.slice(1);
327
+ }
328
+ }
329
+ // =============================================================================
330
+ // Convenience Function
331
+ // =============================================================================
332
+ /**
333
+ * Generate page files from Kappa PageBlock nodes
334
+ */
335
+ export function generatePages(pages, options = {}) {
336
+ const generator = new KappaPageGenerator(options);
337
+ return generator.generate(pages);
338
+ }
@@ -0,0 +1,261 @@
1
+ import { CstParser, IToken, CstNode } from 'chevrotain';
2
+ import { KappaSpec, ProjectBlock, AuthBlock, HashConfig, EntityBlock, EntityField, FieldType, FieldModifier, EntityRelationship, Capability, LifecycleHook, APIBlock, APIOperation, APIReturnType, CRUDShorthand, CRUDAction, EffectType, APIParameter, JourneyBlock, JourneyStep, PageBlock, ComponentBlock, FormBlock, FormField, DesignBlock } from './kappa-ast.js';
3
+ declare class KappaParser extends CstParser {
4
+ constructor();
5
+ kappaSpec: import("chevrotain").ParserMethod<[], CstNode>;
6
+ projectBlock: import("chevrotain").ParserMethod<[], CstNode>;
7
+ projectProperty: import("chevrotain").ParserMethod<[], CstNode>;
8
+ stackValue: import("chevrotain").ParserMethod<[], CstNode>;
9
+ databaseValue: import("chevrotain").ParserMethod<[], CstNode>;
10
+ authTypeValue: import("chevrotain").ParserMethod<[], CstNode>;
11
+ uiValue: import("chevrotain").ParserMethod<[], CstNode>;
12
+ authBlock: import("chevrotain").ParserMethod<[], CstNode>;
13
+ authProperty: import("chevrotain").ParserMethod<[], CstNode>;
14
+ envCall: import("chevrotain").ParserMethod<[], CstNode>;
15
+ refreshValue: import("chevrotain").ParserMethod<[], CstNode>;
16
+ hashConfig: import("chevrotain").ParserMethod<[], CstNode>;
17
+ hashParams: import("chevrotain").ParserMethod<[], CstNode>;
18
+ entityBlock: import("chevrotain").ParserMethod<[], CstNode>;
19
+ fieldName: import("chevrotain").ParserMethod<[], CstNode>;
20
+ entityField: import("chevrotain").ParserMethod<[], CstNode>;
21
+ fieldType: import("chevrotain").ParserMethod<[], CstNode>;
22
+ innerFieldType: import("chevrotain").ParserMethod<[], CstNode>;
23
+ rangeConstraint: import("chevrotain").ParserMethod<[], CstNode>;
24
+ fieldModifier: import("chevrotain").ParserMethod<[], CstNode>;
25
+ defaultValue: import("chevrotain").ParserMethod<[], CstNode>;
26
+ entityRelationship: import("chevrotain").ParserMethod<[], CstNode>;
27
+ entityCapability: import("chevrotain").ParserMethod<[], CstNode>;
28
+ capabilityList: import("chevrotain").ParserMethod<[], CstNode>;
29
+ singleCapability: import("chevrotain").ParserMethod<[], CstNode>;
30
+ capabilityAction: import("chevrotain").ParserMethod<[], CstNode>;
31
+ capabilityCondition: import("chevrotain").ParserMethod<[], CstNode>;
32
+ entityLifecycleHook: import("chevrotain").ParserMethod<[], CstNode>;
33
+ hookAction: import("chevrotain").ParserMethod<[], CstNode>;
34
+ hookActionParam: import("chevrotain").ParserMethod<[], CstNode>;
35
+ arrayLiteral: import("chevrotain").ParserMethod<[], CstNode>;
36
+ apiBlock: import("chevrotain").ParserMethod<[], CstNode>;
37
+ crudShorthand: import("chevrotain").ParserMethod<[], CstNode>;
38
+ crudActionList: import("chevrotain").ParserMethod<[], CstNode>;
39
+ crudAction: import("chevrotain").ParserMethod<[], CstNode>;
40
+ apiEndpoint: import("chevrotain").ParserMethod<[], CstNode>;
41
+ parameterList: import("chevrotain").ParserMethod<[], CstNode>;
42
+ parameter: import("chevrotain").ParserMethod<[], CstNode>;
43
+ parameterType: import("chevrotain").ParserMethod<[], CstNode>;
44
+ effectAnnotation: import("chevrotain").ParserMethod<[], CstNode>;
45
+ effectList: import("chevrotain").ParserMethod<[], CstNode>;
46
+ effect: import("chevrotain").ParserMethod<[], CstNode>;
47
+ returnType: import("chevrotain").ParserMethod<[], CstNode>;
48
+ returnTypeInner: import("chevrotain").ParserMethod<[], CstNode>;
49
+ objectTypeFields: import("chevrotain").ParserMethod<[], CstNode>;
50
+ objectTypeField: import("chevrotain").ParserMethod<[], CstNode>;
51
+ journeyBlock: import("chevrotain").ParserMethod<[], CstNode>;
52
+ journeyProperty: import("chevrotain").ParserMethod<[], CstNode>;
53
+ journeyStep: import("chevrotain").ParserMethod<[], CstNode>;
54
+ journeyStepProperty: import("chevrotain").ParserMethod<[], CstNode>;
55
+ pageBlock: import("chevrotain").ParserMethod<[], CstNode>;
56
+ pageProperty: import("chevrotain").ParserMethod<[], CstNode>;
57
+ metaProperty: import("chevrotain").ParserMethod<[], CstNode>;
58
+ componentBlock: import("chevrotain").ParserMethod<[], CstNode>;
59
+ componentProperty: import("chevrotain").ParserMethod<[], CstNode>;
60
+ propDefinition: import("chevrotain").ParserMethod<[], CstNode>;
61
+ stateDefinition: import("chevrotain").ParserMethod<[], CstNode>;
62
+ handlerDefinition: import("chevrotain").ParserMethod<[], CstNode>;
63
+ formBlock: import("chevrotain").ParserMethod<[], CstNode>;
64
+ formProperty: import("chevrotain").ParserMethod<[], CstNode>;
65
+ formFieldDefinition: import("chevrotain").ParserMethod<[], CstNode>;
66
+ formFieldType: import("chevrotain").ParserMethod<[], CstNode>;
67
+ formFieldProperty: import("chevrotain").ParserMethod<[], CstNode>;
68
+ submitProperty: import("chevrotain").ParserMethod<[], CstNode>;
69
+ validationRule: import("chevrotain").ParserMethod<[], CstNode>;
70
+ designBlock: import("chevrotain").ParserMethod<[], CstNode>;
71
+ designSection: import("chevrotain").ParserMethod<[], CstNode>;
72
+ colorDefinition: import("chevrotain").ParserMethod<[], CstNode>;
73
+ typographyDefinition: import("chevrotain").ParserMethod<[], CstNode>;
74
+ spacingDefinition: import("chevrotain").ParserMethod<[], CstNode>;
75
+ animationDefinition: import("chevrotain").ParserMethod<[], CstNode>;
76
+ }
77
+ declare const parser: KappaParser;
78
+ declare const BaseCstVisitor: new (...args: any[]) => import("chevrotain").ICstVisitor<any, any>;
79
+ declare class KappaAstBuilder extends BaseCstVisitor {
80
+ constructor();
81
+ private getLocation;
82
+ private findFirstToken;
83
+ private findLastToken;
84
+ kappaSpec(ctx: Record<string, unknown>): KappaSpec;
85
+ projectBlock(ctx: Record<string, unknown>): ProjectBlock;
86
+ projectProperty(ctx: Record<string, unknown>): {
87
+ type: string;
88
+ value: string;
89
+ };
90
+ stackValue(ctx: Record<string, IToken[]>): string;
91
+ databaseValue(ctx: Record<string, IToken[]>): string;
92
+ authTypeValue(ctx: Record<string, IToken[]>): string;
93
+ uiValue(ctx: Record<string, IToken[]>): string;
94
+ authBlock(ctx: Record<string, unknown>): AuthBlock;
95
+ authProperty(ctx: Record<string, unknown>): {
96
+ type: string;
97
+ value: unknown;
98
+ };
99
+ envCall(ctx: Record<string, IToken[]>): string;
100
+ refreshValue(ctx: Record<string, IToken[]>): string;
101
+ hashConfig(ctx: Record<string, unknown>): HashConfig;
102
+ hashParams(ctx: Record<string, unknown>): Record<string, unknown>;
103
+ entityBlock(ctx: Record<string, unknown>): EntityBlock;
104
+ entityField(ctx: Record<string, unknown>): EntityField;
105
+ fieldName(ctx: Record<string, unknown>): string;
106
+ fieldType(ctx: Record<string, unknown>): FieldType;
107
+ innerFieldType(ctx: Record<string, unknown>): FieldType;
108
+ rangeConstraint(ctx: Record<string, IToken[]>): {
109
+ min?: number;
110
+ max?: number;
111
+ };
112
+ fieldModifier(ctx: Record<string, IToken[]>): FieldModifier;
113
+ defaultValue(ctx: Record<string, IToken[]>): string;
114
+ entityRelationship(ctx: Record<string, unknown>): EntityRelationship;
115
+ entityCapability(ctx: Record<string, unknown>): Capability;
116
+ capabilityList(ctx: Record<string, unknown>): unknown[];
117
+ singleCapability(ctx: Record<string, unknown>): {
118
+ action: string;
119
+ entity: string;
120
+ condition?: {
121
+ type: 'where' | 'unless';
122
+ value: string;
123
+ };
124
+ };
125
+ capabilityAction(ctx: Record<string, IToken[]>): string;
126
+ capabilityCondition(ctx: Record<string, IToken[]>): {
127
+ type: 'where' | 'unless';
128
+ value: string;
129
+ };
130
+ entityLifecycleHook(ctx: Record<string, unknown>): LifecycleHook;
131
+ hookAction(ctx: Record<string, unknown>): {
132
+ name: string;
133
+ params: Record<string, unknown>;
134
+ };
135
+ hookActionParam(ctx: Record<string, unknown>): {
136
+ name: string;
137
+ value: unknown;
138
+ };
139
+ arrayLiteral(ctx: Record<string, IToken[]>): string[];
140
+ apiBlock(ctx: Record<string, unknown>): APIBlock;
141
+ crudShorthand(ctx: Record<string, unknown>): CRUDShorthand;
142
+ crudActionList(ctx: Record<string, unknown>): CRUDAction[];
143
+ crudAction(ctx: Record<string, IToken[]>): CRUDAction;
144
+ apiEndpoint(ctx: Record<string, unknown>): APIOperation;
145
+ parameterList(ctx: Record<string, unknown>): APIParameter[];
146
+ parameter(ctx: Record<string, unknown>): APIParameter;
147
+ parameterType(ctx: Record<string, IToken[]>): string;
148
+ effectAnnotation(ctx: Record<string, unknown>): EffectType[];
149
+ effectList(ctx: Record<string, unknown>): EffectType[];
150
+ effect(ctx: Record<string, IToken[]>): EffectType;
151
+ returnType(ctx: Record<string, unknown>): APIReturnType;
152
+ returnTypeInner(ctx: Record<string, unknown> | CstNode[]): {
153
+ type: string;
154
+ joined?: {
155
+ field: string;
156
+ entity: string;
157
+ }[];
158
+ };
159
+ objectTypeFields(ctx: Record<string, unknown>): {
160
+ name: string;
161
+ type: string;
162
+ }[];
163
+ objectTypeField(ctx: Record<string, unknown>): {
164
+ name: string;
165
+ type: string;
166
+ };
167
+ journeyBlock(ctx: Record<string, unknown>): JourneyBlock;
168
+ journeyProperty(ctx: Record<string, unknown>): {
169
+ type: string;
170
+ value: unknown;
171
+ };
172
+ journeyStep(ctx: Record<string, unknown>): JourneyStep;
173
+ journeyStepProperty(ctx: Record<string, unknown>): {
174
+ type: string;
175
+ value: string;
176
+ };
177
+ pageBlock(ctx: Record<string, unknown>): PageBlock;
178
+ pageProperty(ctx: Record<string, unknown>): {
179
+ type: string;
180
+ value: unknown;
181
+ };
182
+ metaProperty(ctx: Record<string, IToken[]>): {
183
+ name: string;
184
+ value: string;
185
+ };
186
+ componentBlock(ctx: Record<string, unknown>): ComponentBlock;
187
+ componentProperty(ctx: Record<string, unknown>): {
188
+ type: string;
189
+ value: unknown[];
190
+ };
191
+ propDefinition(ctx: Record<string, unknown>): {
192
+ name: string;
193
+ type: string;
194
+ optional: boolean;
195
+ };
196
+ stateDefinition(ctx: Record<string, unknown>): {
197
+ name: string;
198
+ type: string;
199
+ defaultValue?: string;
200
+ };
201
+ handlerDefinition(ctx: Record<string, unknown>): {
202
+ name: string;
203
+ effects: EffectType[];
204
+ };
205
+ formBlock(ctx: Record<string, unknown>): FormBlock;
206
+ formProperty(ctx: Record<string, unknown>): {
207
+ type: string;
208
+ value: unknown;
209
+ };
210
+ formFieldDefinition(ctx: Record<string, unknown>): FormField;
211
+ formFieldType(ctx: Record<string, IToken[]>): string;
212
+ formFieldProperty(ctx: Record<string, unknown>): {
213
+ type: string;
214
+ value: unknown;
215
+ };
216
+ submitProperty(ctx: Record<string, IToken[]>): {
217
+ type: string;
218
+ value: string;
219
+ };
220
+ validationRule(ctx: Record<string, IToken[]>): {
221
+ name: string;
222
+ value: string;
223
+ };
224
+ designBlock(ctx: Record<string, unknown>): DesignBlock;
225
+ designSection(ctx: Record<string, unknown>): {
226
+ type: string;
227
+ value: unknown;
228
+ };
229
+ colorDefinition(ctx: Record<string, unknown>): {
230
+ name: string;
231
+ value: string;
232
+ };
233
+ typographyDefinition(ctx: Record<string, IToken[]>): {
234
+ name: string;
235
+ value: string;
236
+ };
237
+ spacingDefinition(ctx: Record<string, IToken[]>): {
238
+ name: string;
239
+ value: string;
240
+ };
241
+ animationDefinition(ctx: Record<string, IToken[]>): {
242
+ name: string;
243
+ value: string;
244
+ };
245
+ }
246
+ export interface ParseResult {
247
+ success: boolean;
248
+ ast?: KappaSpec;
249
+ errors: Array<{
250
+ message: string;
251
+ line?: number;
252
+ column?: number;
253
+ }>;
254
+ }
255
+ export declare function parse(source: string): ParseResult;
256
+ /**
257
+ * Convenience function that parses source and returns the AST directly.
258
+ * Returns null if parsing fails.
259
+ */
260
+ export declare function parseToAST(source: string): KappaSpec | null;
261
+ export { parser, KappaParser, KappaAstBuilder };