@claudetools/tools 0.8.11 → 0.9.1

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/kappa-handlers.d.ts +116 -0
  58. package/dist/handlers/kappa-handlers.js +465 -0
  59. package/dist/handlers/tool-handlers.js +121 -0
  60. package/dist/setup.js +195 -3
  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,18 @@
1
+ import { BaseGenerator } from './base.js';
2
+ import { EntitySpec } from '../parser.js';
3
+ import { GenerateFrontendOptions } from '../types.js';
4
+ interface AstroOptions extends GenerateFrontendOptions {
5
+ islands?: 'react' | 'svelte' | 'vue' | 'solid';
6
+ ssr?: boolean;
7
+ apiRoutes?: boolean;
8
+ }
9
+ export declare class AstroGenerator extends BaseGenerator {
10
+ protected getGeneratorId(): string;
11
+ protected getRequiredTemplates(options: AstroOptions): string[];
12
+ protected getFileMapping(entity: EntitySpec, options: AstroOptions): Record<string, string>;
13
+ /**
14
+ * Generate Astro pages and components from entity specification
15
+ */
16
+ generate(entity: EntitySpec, options?: AstroOptions): Promise<import('../types.js').GenerationResult>;
17
+ }
18
+ export {};
@@ -0,0 +1,91 @@
1
+ // =============================================================================
2
+ // Astro Generator
3
+ // =============================================================================
4
+ //
5
+ // Generate Astro pages, components, and API endpoints.
6
+ // Supports Islands architecture with React/Svelte/Vue components.
7
+ //
8
+ import { BaseGenerator } from './base.js';
9
+ export class AstroGenerator extends BaseGenerator {
10
+ getGeneratorId() {
11
+ return 'astro';
12
+ }
13
+ getRequiredTemplates(options) {
14
+ const templates = [
15
+ 'page.astro.j2',
16
+ 'types.ts.j2',
17
+ ];
18
+ if (options.apiRoutes) {
19
+ templates.push('api.ts.j2');
20
+ }
21
+ if (this.isEnabled(options, 'forms', true)) {
22
+ if (options.islands === 'react') {
23
+ templates.push('form.tsx.j2');
24
+ }
25
+ else if (options.islands === 'svelte') {
26
+ templates.push('form.svelte.j2');
27
+ }
28
+ else if (options.islands === 'vue') {
29
+ templates.push('form.vue.j2');
30
+ }
31
+ else {
32
+ templates.push('form.astro.j2');
33
+ }
34
+ }
35
+ if (this.isEnabled(options, 'tables', true)) {
36
+ templates.push('table.astro.j2');
37
+ }
38
+ if (this.isEnabled(options, 'tests')) {
39
+ templates.push('test.ts.j2');
40
+ }
41
+ return templates;
42
+ }
43
+ getFileMapping(entity, options) {
44
+ const entityLower = entity.name.toLowerCase();
45
+ const entityPlural = entityLower + 's';
46
+ const mapping = {
47
+ [`src/pages/${entityPlural}/index.astro`]: 'page.astro.j2',
48
+ [`src/types/${entityLower}.ts`]: 'types.ts.j2',
49
+ };
50
+ if (options.apiRoutes) {
51
+ mapping[`src/pages/api/${entityPlural}.ts`] = 'api.ts.j2';
52
+ }
53
+ if (this.isEnabled(options, 'forms', true)) {
54
+ if (options.islands === 'react') {
55
+ mapping[`src/components/${entity.name}Form.tsx`] = 'form.tsx.j2';
56
+ }
57
+ else if (options.islands === 'svelte') {
58
+ mapping[`src/components/${entity.name}Form.svelte`] = 'form.svelte.j2';
59
+ }
60
+ else if (options.islands === 'vue') {
61
+ mapping[`src/components/${entity.name}Form.vue`] = 'form.vue.j2';
62
+ }
63
+ else {
64
+ mapping[`src/components/${entity.name}Form.astro`] = 'form.astro.j2';
65
+ }
66
+ }
67
+ if (this.isEnabled(options, 'tables', true)) {
68
+ mapping[`src/components/${entity.name}Table.astro`] = 'table.astro.j2';
69
+ }
70
+ if (this.isEnabled(options, 'tests')) {
71
+ mapping[`src/pages/${entityPlural}/__tests__/index.test.ts`] = 'test.ts.j2';
72
+ }
73
+ return mapping;
74
+ }
75
+ /**
76
+ * Generate Astro pages and components from entity specification
77
+ */
78
+ async generate(entity, options = {}) {
79
+ // Set defaults - Astro specific
80
+ const opts = {
81
+ forms: true,
82
+ tables: true,
83
+ islands: 'react',
84
+ ssr: true,
85
+ apiRoutes: true,
86
+ ...options,
87
+ };
88
+ // Generate files
89
+ return super.generate(entity, opts);
90
+ }
91
+ }
@@ -0,0 +1,18 @@
1
+ import { BaseGenerator } from './base.js';
2
+ import { EntitySpec } from '../parser.js';
3
+ import { GenerateApiOptions } from '../types.js';
4
+ interface AuthJsOptions extends GenerateApiOptions {
5
+ providers?: ('credentials' | 'google' | 'github' | 'discord' | 'apple')[];
6
+ adapter?: 'prisma' | 'drizzle' | 'none';
7
+ middleware?: boolean;
8
+ }
9
+ export declare class AuthJsGenerator extends BaseGenerator {
10
+ protected getGeneratorId(): string;
11
+ protected getRequiredTemplates(options: AuthJsOptions): string[];
12
+ protected getFileMapping(entity: EntitySpec, options: AuthJsOptions): Record<string, string>;
13
+ /**
14
+ * Generate Auth.js configuration from entity specification
15
+ */
16
+ generate(entity: EntitySpec, options?: AuthJsOptions): Promise<import('../types.js').GenerationResult>;
17
+ }
18
+ export {};
@@ -0,0 +1,68 @@
1
+ // =============================================================================
2
+ // Auth.js (NextAuth) Generator
3
+ // =============================================================================
4
+ //
5
+ // Generate Auth.js v5 configuration for Next.js applications.
6
+ // Supports multiple providers, database adapters, and custom callbacks.
7
+ //
8
+ import { BaseGenerator } from './base.js';
9
+ export class AuthJsGenerator extends BaseGenerator {
10
+ getGeneratorId() {
11
+ return 'authjs';
12
+ }
13
+ getRequiredTemplates(options) {
14
+ const templates = [
15
+ 'auth.ts.j2',
16
+ 'auth.config.ts.j2',
17
+ 'types.ts.j2',
18
+ ];
19
+ if (options.adapter && options.adapter !== 'none') {
20
+ templates.push('adapter.ts.j2');
21
+ }
22
+ if (options.middleware !== false) {
23
+ templates.push('middleware.ts.j2');
24
+ }
25
+ if (options.providers?.includes('credentials')) {
26
+ templates.push('credentials.ts.j2');
27
+ }
28
+ if (this.isEnabled(options, 'tests')) {
29
+ templates.push('test.ts.j2');
30
+ }
31
+ return templates;
32
+ }
33
+ getFileMapping(entity, options) {
34
+ const mapping = {
35
+ ['src/auth.ts']: 'auth.ts.j2',
36
+ ['src/auth.config.ts']: 'auth.config.ts.j2',
37
+ ['src/types/auth.ts']: 'types.ts.j2',
38
+ };
39
+ if (options.adapter && options.adapter !== 'none') {
40
+ mapping['src/lib/auth-adapter.ts'] = 'adapter.ts.j2';
41
+ }
42
+ if (options.middleware !== false) {
43
+ mapping['src/middleware.ts'] = 'middleware.ts.j2';
44
+ }
45
+ if (options.providers?.includes('credentials')) {
46
+ mapping['src/lib/credentials.ts'] = 'credentials.ts.j2';
47
+ }
48
+ if (this.isEnabled(options, 'tests')) {
49
+ mapping['src/__tests__/auth.test.ts'] = 'test.ts.j2';
50
+ }
51
+ return mapping;
52
+ }
53
+ /**
54
+ * Generate Auth.js configuration from entity specification
55
+ */
56
+ async generate(entity, options = {}) {
57
+ // Set defaults - Auth.js specific
58
+ const opts = {
59
+ providers: ['google', 'github'],
60
+ adapter: 'prisma',
61
+ middleware: true,
62
+ database: 'postgresql',
63
+ ...options,
64
+ };
65
+ // Generate files
66
+ return super.generate(entity, opts);
67
+ }
68
+ }
@@ -0,0 +1,18 @@
1
+ import { BaseGenerator } from './base.js';
2
+ import { EntitySpec } from '../parser.js';
3
+ import { GenerateApiOptions } from '../types.js';
4
+ interface BetterAuthOptions extends GenerateApiOptions {
5
+ providers?: ('email' | 'google' | 'github' | 'discord')[];
6
+ sessionStrategy?: 'jwt' | 'database';
7
+ twoFactor?: boolean;
8
+ }
9
+ export declare class BetterAuthGenerator extends BaseGenerator {
10
+ protected getGeneratorId(): string;
11
+ protected getRequiredTemplates(options: BetterAuthOptions): string[];
12
+ protected getFileMapping(entity: EntitySpec, options: BetterAuthOptions): Record<string, string>;
13
+ /**
14
+ * Generate Better-Auth configuration from entity specification
15
+ */
16
+ generate(entity: EntitySpec, options?: BetterAuthOptions): Promise<import('../types.js').GenerationResult>;
17
+ }
18
+ export {};
@@ -0,0 +1,62 @@
1
+ // =============================================================================
2
+ // Better-Auth Generator
3
+ // =============================================================================
4
+ //
5
+ // Generate authentication configuration using Better-Auth library.
6
+ // Supports email/password, OAuth providers, sessions, and database adapters.
7
+ //
8
+ import { BaseGenerator } from './base.js';
9
+ export class BetterAuthGenerator extends BaseGenerator {
10
+ getGeneratorId() {
11
+ return 'better-auth';
12
+ }
13
+ getRequiredTemplates(options) {
14
+ const templates = [
15
+ 'auth.ts.j2',
16
+ 'client.ts.j2',
17
+ 'types.ts.j2',
18
+ ];
19
+ if (options.providers?.includes('email')) {
20
+ templates.push('email-templates.ts.j2');
21
+ }
22
+ if (options.twoFactor) {
23
+ templates.push('two-factor.ts.j2');
24
+ }
25
+ if (this.isEnabled(options, 'tests')) {
26
+ templates.push('test.ts.j2');
27
+ }
28
+ return templates;
29
+ }
30
+ getFileMapping(entity, options) {
31
+ const mapping = {
32
+ ['src/lib/auth.ts']: 'auth.ts.j2',
33
+ ['src/lib/auth-client.ts']: 'client.ts.j2',
34
+ ['src/types/auth.ts']: 'types.ts.j2',
35
+ };
36
+ if (options.providers?.includes('email')) {
37
+ mapping['src/lib/email-templates.ts'] = 'email-templates.ts.j2';
38
+ }
39
+ if (options.twoFactor) {
40
+ mapping['src/lib/two-factor.ts'] = 'two-factor.ts.j2';
41
+ }
42
+ if (this.isEnabled(options, 'tests')) {
43
+ mapping['src/__tests__/auth.test.ts'] = 'test.ts.j2';
44
+ }
45
+ return mapping;
46
+ }
47
+ /**
48
+ * Generate Better-Auth configuration from entity specification
49
+ */
50
+ async generate(entity, options = {}) {
51
+ // Set defaults - Better-Auth specific
52
+ const opts = {
53
+ providers: ['email'],
54
+ sessionStrategy: 'jwt',
55
+ twoFactor: false,
56
+ database: 'postgresql',
57
+ ...options,
58
+ };
59
+ // Generate files
60
+ return super.generate(entity, opts);
61
+ }
62
+ }
@@ -0,0 +1,18 @@
1
+ import { BaseGenerator } from './base.js';
2
+ import { EntitySpec } from '../parser.js';
3
+ import { GenerateApiOptions } from '../types.js';
4
+ interface DrizzleOptions extends GenerateApiOptions {
5
+ dialect?: 'postgresql' | 'mysql' | 'sqlite';
6
+ relations?: boolean;
7
+ migrations?: boolean;
8
+ }
9
+ export declare class DrizzleOrmGenerator extends BaseGenerator {
10
+ protected getGeneratorId(): string;
11
+ protected getRequiredTemplates(options: DrizzleOptions): string[];
12
+ protected getFileMapping(entity: EntitySpec, options: DrizzleOptions): Record<string, string>;
13
+ /**
14
+ * Generate Drizzle ORM schema from entity specification
15
+ */
16
+ generate(entity: EntitySpec, options?: DrizzleOptions): Promise<import('../types.js').GenerationResult>;
17
+ }
18
+ export {};
@@ -0,0 +1,65 @@
1
+ // =============================================================================
2
+ // Drizzle ORM Generator
3
+ // =============================================================================
4
+ //
5
+ // Generate Drizzle ORM schemas, relations, and migrations.
6
+ // Type-safe SQL with excellent TypeScript inference.
7
+ //
8
+ import { BaseGenerator } from './base.js';
9
+ export class DrizzleOrmGenerator extends BaseGenerator {
10
+ getGeneratorId() {
11
+ return 'drizzle-orm';
12
+ }
13
+ getRequiredTemplates(options) {
14
+ const templates = [
15
+ 'schema.ts.j2',
16
+ 'types.ts.j2',
17
+ ];
18
+ if (options.relations !== false) {
19
+ templates.push('relations.ts.j2');
20
+ }
21
+ if (options.migrations) {
22
+ templates.push('migration.sql.j2');
23
+ }
24
+ // Database queries
25
+ templates.push('queries.ts.j2');
26
+ if (this.isEnabled(options, 'tests')) {
27
+ templates.push('test.ts.j2');
28
+ }
29
+ return templates;
30
+ }
31
+ getFileMapping(entity, options) {
32
+ const entityLower = entity.name.toLowerCase();
33
+ const entityPlural = entityLower + 's';
34
+ const mapping = {
35
+ [`src/db/schema/${entityPlural}.ts`]: 'schema.ts.j2',
36
+ [`src/types/${entityLower}.ts`]: 'types.ts.j2',
37
+ [`src/db/queries/${entityPlural}.ts`]: 'queries.ts.j2',
38
+ };
39
+ if (options.relations !== false) {
40
+ mapping[`src/db/relations/${entityPlural}.ts`] = 'relations.ts.j2';
41
+ }
42
+ if (options.migrations) {
43
+ mapping[`drizzle/migrations/0001_create_${entityPlural}.sql`] = 'migration.sql.j2';
44
+ }
45
+ if (this.isEnabled(options, 'tests')) {
46
+ mapping[`src/db/__tests__/${entityPlural}.test.ts`] = 'test.ts.j2';
47
+ }
48
+ return mapping;
49
+ }
50
+ /**
51
+ * Generate Drizzle ORM schema from entity specification
52
+ */
53
+ async generate(entity, options = {}) {
54
+ // Set defaults - Drizzle specific
55
+ const opts = {
56
+ dialect: 'postgresql',
57
+ relations: true,
58
+ migrations: true,
59
+ database: 'postgresql',
60
+ ...options,
61
+ };
62
+ // Generate files
63
+ return super.generate(entity, opts);
64
+ }
65
+ }
@@ -0,0 +1,12 @@
1
+ import { BaseGenerator } from './base.js';
2
+ import { EntitySpec } from '../parser.js';
3
+ import { GenerateApiOptions } from '../types.js';
4
+ export declare class ElysiaApiGenerator extends BaseGenerator {
5
+ protected getGeneratorId(): string;
6
+ protected getRequiredTemplates(options: GenerateApiOptions): string[];
7
+ protected getFileMapping(entity: EntitySpec, options: GenerateApiOptions): Record<string, string>;
8
+ /**
9
+ * Generate Elysia API from entity specification
10
+ */
11
+ generate(entity: EntitySpec, options?: GenerateApiOptions): Promise<import('../types.js').GenerationResult>;
12
+ }
@@ -0,0 +1,64 @@
1
+ // =============================================================================
2
+ // Elysia API Generator
3
+ // =============================================================================
4
+ //
5
+ // Generate TypeScript Elysia REST API with CRUD operations, type-safe routes,
6
+ // built-in validation, and plugins. Optimised for Bun runtime.
7
+ //
8
+ import { BaseGenerator } from './base.js';
9
+ export class ElysiaApiGenerator extends BaseGenerator {
10
+ getGeneratorId() {
11
+ return 'elysia-api';
12
+ }
13
+ getRequiredTemplates(options) {
14
+ const templates = [
15
+ 'model.ts.j2',
16
+ 'controller.ts.j2',
17
+ 'routes.ts.j2',
18
+ 'schema.ts.j2',
19
+ 'index.ts.j2',
20
+ ];
21
+ if (this.isEnabled(options, 'auth')) {
22
+ templates.push('auth-plugin.ts.j2');
23
+ }
24
+ if (this.isEnabled(options, 'tests')) {
25
+ templates.push('test.ts.j2');
26
+ }
27
+ return templates;
28
+ }
29
+ getFileMapping(entity, options) {
30
+ const entityLower = entity.name.toLowerCase();
31
+ const mapping = {
32
+ [`src/models/${entityLower}.model.ts`]: 'model.ts.j2',
33
+ [`src/controllers/${entityLower}.controller.ts`]: 'controller.ts.j2',
34
+ [`src/routes/${entityLower}.routes.ts`]: 'routes.ts.j2',
35
+ [`src/schemas/${entityLower}.schema.ts`]: 'schema.ts.j2',
36
+ ['src/index.ts']: 'index.ts.j2',
37
+ };
38
+ if (this.isEnabled(options, 'auth')) {
39
+ mapping['src/plugins/auth.ts'] = 'auth-plugin.ts.j2';
40
+ }
41
+ if (this.isEnabled(options, 'tests')) {
42
+ mapping[`src/__tests__/${entityLower}.test.ts`] = 'test.ts.j2';
43
+ }
44
+ return mapping;
45
+ }
46
+ /**
47
+ * Generate Elysia API from entity specification
48
+ */
49
+ async generate(entity, options = {}) {
50
+ // Validate options
51
+ await this.validateOptions(options);
52
+ // Set defaults - Elysia specific (Bun-first)
53
+ const opts = {
54
+ auth: false,
55
+ validation: true,
56
+ tests: false,
57
+ database: 'postgresql',
58
+ swagger: true, // Elysia has built-in Swagger support
59
+ ...options,
60
+ };
61
+ // Generate files
62
+ return super.generate(entity, opts);
63
+ }
64
+ }
@@ -0,0 +1,12 @@
1
+ import { BaseGenerator } from './base.js';
2
+ import { EntitySpec } from '../parser.js';
3
+ import { GenerateApiOptions } from '../types.js';
4
+ export declare class HonoApiGenerator extends BaseGenerator {
5
+ protected getGeneratorId(): string;
6
+ protected getRequiredTemplates(options: GenerateApiOptions): string[];
7
+ protected getFileMapping(entity: EntitySpec, options: GenerateApiOptions): Record<string, string>;
8
+ /**
9
+ * Generate Hono API from entity specification
10
+ */
11
+ generate(entity: EntitySpec, options?: GenerateApiOptions): Promise<import('../types.js').GenerationResult>;
12
+ }
@@ -0,0 +1,64 @@
1
+ // =============================================================================
2
+ // Hono API Generator
3
+ // =============================================================================
4
+ //
5
+ // Generate TypeScript Hono REST API with CRUD operations, type-safe routes,
6
+ // Zod validation, and middleware. Optimised for Cloudflare Workers and Bun.
7
+ //
8
+ import { BaseGenerator } from './base.js';
9
+ export class HonoApiGenerator extends BaseGenerator {
10
+ getGeneratorId() {
11
+ return 'hono-api';
12
+ }
13
+ getRequiredTemplates(options) {
14
+ const templates = [
15
+ 'model.ts.j2',
16
+ 'controller.ts.j2',
17
+ 'routes.ts.j2',
18
+ 'validator.ts.j2',
19
+ 'index.ts.j2',
20
+ ];
21
+ if (this.isEnabled(options, 'auth')) {
22
+ templates.push('middleware.ts.j2');
23
+ }
24
+ if (this.isEnabled(options, 'tests')) {
25
+ templates.push('test.ts.j2');
26
+ }
27
+ return templates;
28
+ }
29
+ getFileMapping(entity, options) {
30
+ const entityLower = entity.name.toLowerCase();
31
+ const mapping = {
32
+ [`src/models/${entityLower}.model.ts`]: 'model.ts.j2',
33
+ [`src/controllers/${entityLower}.controller.ts`]: 'controller.ts.j2',
34
+ [`src/routes/${entityLower}.routes.ts`]: 'routes.ts.j2',
35
+ [`src/validators/${entityLower}.validator.ts`]: 'validator.ts.j2',
36
+ ['src/index.ts']: 'index.ts.j2',
37
+ };
38
+ if (this.isEnabled(options, 'auth')) {
39
+ mapping['src/middleware/auth.ts'] = 'middleware.ts.j2';
40
+ }
41
+ if (this.isEnabled(options, 'tests')) {
42
+ mapping[`src/__tests__/${entityLower}.test.ts`] = 'test.ts.j2';
43
+ }
44
+ return mapping;
45
+ }
46
+ /**
47
+ * Generate Hono API from entity specification
48
+ */
49
+ async generate(entity, options = {}) {
50
+ // Validate options
51
+ await this.validateOptions(options);
52
+ // Set defaults - Hono specific
53
+ const opts = {
54
+ auth: false,
55
+ validation: true,
56
+ tests: false,
57
+ database: 'postgresql',
58
+ target: 'cloudflare-workers', // cloudflare-workers | bun | node
59
+ ...options,
60
+ };
61
+ // Generate files
62
+ return super.generate(entity, opts);
63
+ }
64
+ }
@@ -0,0 +1,18 @@
1
+ import { BaseGenerator } from './base.js';
2
+ import { EntitySpec } from '../parser.js';
3
+ import { GenerateApiOptions } from '../types.js';
4
+ interface LuciaOptions extends GenerateApiOptions {
5
+ framework?: 'nextjs' | 'sveltekit' | 'astro' | 'hono';
6
+ adapter?: 'drizzle' | 'prisma' | 'better-sqlite3';
7
+ oauth?: ('github' | 'google' | 'discord')[];
8
+ }
9
+ export declare class LuciaAuthGenerator extends BaseGenerator {
10
+ protected getGeneratorId(): string;
11
+ protected getRequiredTemplates(options: LuciaOptions): string[];
12
+ protected getFileMapping(entity: EntitySpec, options: LuciaOptions): Record<string, string>;
13
+ /**
14
+ * Generate Lucia configuration from entity specification
15
+ */
16
+ generate(entity: EntitySpec, options?: LuciaOptions): Promise<import('../types.js').GenerationResult>;
17
+ }
18
+ export {};
@@ -0,0 +1,69 @@
1
+ // =============================================================================
2
+ // Lucia Auth Generator
3
+ // =============================================================================
4
+ //
5
+ // Generate Lucia v3 authentication setup with sessions, database adapters,
6
+ // and framework integrations. Lightweight and flexible auth library.
7
+ //
8
+ import { BaseGenerator } from './base.js';
9
+ export class LuciaAuthGenerator extends BaseGenerator {
10
+ getGeneratorId() {
11
+ return 'lucia-auth';
12
+ }
13
+ getRequiredTemplates(options) {
14
+ const templates = [
15
+ 'lucia.ts.j2',
16
+ 'session.ts.j2',
17
+ 'types.ts.j2',
18
+ ];
19
+ if (options.adapter) {
20
+ templates.push('adapter.ts.j2');
21
+ }
22
+ if (options.oauth && options.oauth.length > 0) {
23
+ templates.push('oauth.ts.j2');
24
+ }
25
+ // Framework-specific middleware
26
+ if (options.framework) {
27
+ templates.push('middleware.ts.j2');
28
+ }
29
+ if (this.isEnabled(options, 'tests')) {
30
+ templates.push('test.ts.j2');
31
+ }
32
+ return templates;
33
+ }
34
+ getFileMapping(entity, options) {
35
+ const mapping = {
36
+ ['src/lib/lucia.ts']: 'lucia.ts.j2',
37
+ ['src/lib/session.ts']: 'session.ts.j2',
38
+ ['src/types/auth.ts']: 'types.ts.j2',
39
+ };
40
+ if (options.adapter) {
41
+ mapping['src/lib/auth-adapter.ts'] = 'adapter.ts.j2';
42
+ }
43
+ if (options.oauth && options.oauth.length > 0) {
44
+ mapping['src/lib/oauth.ts'] = 'oauth.ts.j2';
45
+ }
46
+ if (options.framework) {
47
+ mapping['src/middleware/auth.ts'] = 'middleware.ts.j2';
48
+ }
49
+ if (this.isEnabled(options, 'tests')) {
50
+ mapping['src/__tests__/auth.test.ts'] = 'test.ts.j2';
51
+ }
52
+ return mapping;
53
+ }
54
+ /**
55
+ * Generate Lucia configuration from entity specification
56
+ */
57
+ async generate(entity, options = {}) {
58
+ // Set defaults - Lucia specific
59
+ const opts = {
60
+ framework: 'nextjs',
61
+ adapter: 'drizzle',
62
+ oauth: [],
63
+ database: 'postgresql',
64
+ ...options,
65
+ };
66
+ // Generate files
67
+ return super.generate(entity, opts);
68
+ }
69
+ }
@@ -0,0 +1,18 @@
1
+ import { BaseGenerator } from './base.js';
2
+ import { EntitySpec } from '../parser.js';
3
+ import { GenerateApiOptions } from '../types.js';
4
+ interface PrismaOptions extends GenerateApiOptions {
5
+ datasource?: 'postgresql' | 'mysql' | 'sqlite' | 'sqlserver' | 'mongodb';
6
+ clientExtensions?: boolean;
7
+ seedFile?: boolean;
8
+ }
9
+ export declare class PrismaGenerator extends BaseGenerator {
10
+ protected getGeneratorId(): string;
11
+ protected getRequiredTemplates(options: PrismaOptions): string[];
12
+ protected getFileMapping(entity: EntitySpec, options: PrismaOptions): Record<string, string>;
13
+ /**
14
+ * Generate Prisma schema from entity specification
15
+ */
16
+ generate(entity: EntitySpec, options?: PrismaOptions): Promise<import('../types.js').GenerationResult>;
17
+ }
18
+ export {};