tina4-nodejs 3.10.41 → 3.10.44

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.
@@ -3,6 +3,7 @@ import { existsSync } from "node:fs";
3
3
 
4
4
  export interface ServeOptions {
5
5
  port?: number;
6
+ noBrowser?: boolean;
6
7
  }
7
8
 
8
9
  export async function serveProject(options: ServeOptions): Promise<void> {
@@ -39,6 +39,20 @@ const GREEN = "\x1b[32m";
39
39
  const YELLOW = "\x1b[33m";
40
40
  const RESET = "\x1b[0m";
41
41
 
42
+ /**
43
+ * Read the Tina4 version from the root package.json.
44
+ */
45
+ function readVersion(): string {
46
+ try {
47
+ const thisDir = dirname(fileURLToPath(import.meta.url));
48
+ const rootPkg = resolve(thisDir, "..", "..", "..", "package.json");
49
+ const pkg = JSON.parse(readFileSync(rootPkg, "utf-8"));
50
+ return pkg.version ?? "0.0.0";
51
+ } catch {
52
+ return "0.0.0";
53
+ }
54
+ }
55
+
42
56
  /**
43
57
  * Check if a tool's context file already exists.
44
58
  */
@@ -114,10 +128,9 @@ export function installSelected(root: string, selection: string): string[] {
114
128
  }
115
129
  }
116
130
 
117
- const context = generateContext();
118
-
119
131
  for (const idx of indices) {
120
132
  const tool = AI_TOOLS[idx];
133
+ const context = generateContext(tool.name);
121
134
  const files = installForTool(rootPath, tool, context);
122
135
  created.push(...files);
123
136
  }
@@ -222,132 +235,499 @@ function installClaudeSkills(root: string): string[] {
222
235
  return created;
223
236
  }
224
237
 
225
- /**
226
- * Generate the universal Tina4 context document for any AI assistant.
227
- */
228
- export function generateContext(): string {
229
- return `# Tina4 Node.js AI Context
238
+ // ── Shared content fragments ────────────────────────────────
239
+
240
+ const VERSION = readVersion();
241
+
242
+ const FEATURES_COMPACT = "Router, ORM, Database (SQLite/PostgreSQL/MySQL/MSSQL/Firebird), Frond templates (Twig-compatible), JWT auth, Sessions (File/Redis/Valkey/MongoDB/DB), GraphQL + GraphiQL, WebSocket + Redis backplane, WSDL/SOAP, Queue (File/RabbitMQ/Kafka/MongoDB), HTTP client, Messenger (SMTP/IMAP), FakeData/Seeder, Migrations, SCSS compiler, Swagger/OpenAPI, i18n, Events, Container/DI, HtmlElement, Inline testing, Error overlay, Dev dashboard, Rate limiter, Response cache, Logging, MCP server";
243
+
244
+ const PROJECT_STRUCTURE = `src/routes/ \u2014 File-based route handlers (auto-discovered)
245
+ src/models/ \u2014 ORM models
246
+ src/templates/ \u2014 Twig templates
247
+ src/app/ \u2014 Service classes
248
+ src/scss/ \u2014 SCSS (auto-compiled)
249
+ src/public/ \u2014 Static assets
250
+ src/seeds/ \u2014 Database seeders
251
+ migrations/ \u2014 SQL migration files`;
252
+
253
+ const CONVENTIONS = `1. File-based routing \u2014 src/routes/api/users/get.ts handles GET /api/users
254
+ 2. Export default async function for route handlers
255
+ 3. GET routes are public, POST/PUT/PATCH/DELETE require auth by default
256
+ 4. ESM only (import/export, no require)
257
+ 5. Every template extends base.twig
258
+ 6. All schema changes via migrations \u2014 never create tables in route code
259
+ 7. Use built-in features \u2014 never install npm packages for things Tina4 already provides`;
260
+
261
+ const ROUTE_EXAMPLE = `// src/routes/api/users/get.ts
262
+ export default async function(req: Tina4Request, res: Tina4Response) {
263
+ res.json({ users: [] });
264
+ }
265
+
266
+ // src/routes/api/users/post.ts
267
+ export default async function(req: Tina4Request, res: Tina4Response) {
268
+ res.json({ created: req.body.name }, 201);
269
+ }`;
270
+
271
+ const MODEL_EXAMPLE = `// src/models/User.ts
272
+ export default class User {
273
+ static tableName = "users";
274
+ static fields = {
275
+ id: { type: "integer" as const, primaryKey: true, autoIncrement: true },
276
+ name: { type: "string" as const, required: true },
277
+ email: { type: "string" as const },
278
+ };
279
+ }`;
280
+
281
+ // ── Per-tool generators ─────────────────────────────────────
282
+
283
+ function generateCursorContext(): string {
284
+ return `# Tina4 Node.js v${VERSION} — Cursor Rules
285
+
286
+ You are working on a **Tina4 for Node.js/TypeScript** project.
287
+ Documentation: https://tina4.com
288
+
289
+ ## Project Structure
230
290
 
231
- This project uses **Tina4 for Node.js/TypeScript**, a lightweight, batteries-included
232
- web framework with zero third-party dependencies for core features.
291
+ \`\`\`
292
+ ${PROJECT_STRUCTURE}
293
+ \`\`\`
294
+
295
+ ## Built-in Features (Do NOT Install Packages For These)
296
+
297
+ ${FEATURES_COMPACT}
233
298
 
234
- **Documentation:** https://tina4.com
299
+ ## Conventions
235
300
 
236
- ## Quick Start
301
+ ${CONVENTIONS}
302
+
303
+ ## Route Example
304
+
305
+ \`\`\`typescript
306
+ ${ROUTE_EXAMPLE}
307
+ \`\`\`
308
+
309
+ ## Model Example
310
+
311
+ \`\`\`typescript
312
+ ${MODEL_EXAMPLE}
313
+ \`\`\`
314
+
315
+ ## Quick Commands
237
316
 
238
317
  \`\`\`bash
239
- npx tina4nodejs init . # Scaffold project
240
- npx tina4nodejs serve # Start dev server on port 7148
241
- npx tina4nodejs migrate # Run database migrations
242
- npx tina4nodejs test # Run test suite
243
- npx tina4nodejs routes # List all registered routes
318
+ npx tina4nodejs serve # Dev server on port 7148
319
+ npx tina4nodejs migrate # Run migrations
320
+ npx tina4nodejs test # Run tests
321
+ npx tina4nodejs routes # List routes
322
+ \`\`\`
323
+
324
+ ## Key Rules
325
+
326
+ - TypeScript strict mode, ESM only, Node.js 20+
327
+ - Native \`node:http\` — no Express/Fastify
328
+ - Convention-based models with \`static fields\` — no decorators
329
+ - Dynamic route params use brackets: \`[id]\`, \`[...slug]\`
330
+ - Use \`.js\` extensions in import paths
331
+ - All schema changes via migrations
332
+ `;
333
+ }
334
+
335
+ function generateCopilotContext(): string {
336
+ return `# Tina4 Node.js v${VERSION} — Copilot Instructions
337
+
338
+ This is a **Tina4 for Node.js/TypeScript** project (https://tina4.com).
339
+
340
+ ## Structure
341
+
342
+ \`\`\`
343
+ ${PROJECT_STRUCTURE}
344
+ \`\`\`
345
+
346
+ ## Built-in Features
347
+
348
+ ${FEATURES_COMPACT}
349
+
350
+ ## Conventions
351
+
352
+ ${CONVENTIONS}
353
+
354
+ ## Route Pattern
355
+
356
+ \`\`\`typescript
357
+ ${ROUTE_EXAMPLE}
358
+ \`\`\`
359
+
360
+ ## Model Pattern
361
+
362
+ \`\`\`typescript
363
+ ${MODEL_EXAMPLE}
244
364
  \`\`\`
245
365
 
366
+ ## Rules
367
+
368
+ - TypeScript strict, ESM only, Node.js 20+, native \`node:http\`
369
+ - Never install npm packages for built-in features
370
+ - All schema changes via migrations
371
+ `;
372
+ }
373
+
374
+ function generateWindsurfContext(): string {
375
+ return `# Tina4 Node.js v${VERSION} — Windsurf Rules
376
+
377
+ You are working on a **Tina4 for Node.js/TypeScript** project.
378
+ Documentation: https://tina4.com
379
+
246
380
  ## Project Structure
247
381
 
248
382
  \`\`\`
249
- packages/core/src/ — Framework core (server, router, middleware, events)
250
- src/routes/ — Route handlers (auto-discovered, file-based routing)
251
- src/models/ — ORM models (one per file, convention-based)
252
- src/templates/ — Twig templates
253
- src/public/ — Static assets served at /
254
- src/scss/ — SCSS files (auto-compiled to public/css/)
255
- migrations/ — SQL migration files (sequential numbered)
256
- test/ — Test files
257
- \`\`\`
258
-
259
- ## Built-in Features (No External Packages Needed)
260
-
261
- | Feature | Module | Import |
262
- |---------|--------|--------|
263
- | Routing | router | \`import { get, post, put, del } from "@tina4/core"\` |
264
- | ORM | orm | \`import { BaseModel } from "@tina4/orm"\` |
265
- | Database | database | \`import { initDatabase } from "@tina4/orm"\` |
266
- | Templates | twig | \`import { renderTemplate } from "@tina4/twig"\` |
267
- | JWT Auth | auth | \`import { createToken, validateToken, hashPassword, checkPassword } from "@tina4/core"\` |
268
- | REST API Client | api | \`import { Api } from "@tina4/core"\` |
269
- | GraphQL | graphql | \`import { GraphQL } from "@tina4/core"\` |
270
- | WebSocket | websocket | \`import { WebSocketServer } from "@tina4/core"\` |
271
- | SOAP/WSDL | wsdl | \`import { WSDLService } from "@tina4/core"\` |
272
- | Email (SMTP+IMAP) | messenger | \`import { Messenger } from "@tina4/core"\` |
273
- | Background Queue | queue | \`import { Queue } from "@tina4/core"\` |
274
- | SCSS Compilation | scss | Auto-compiled from src/scss/ |
275
- | Migrations | migration | \`npx tina4nodejs migrate\` CLI command |
276
- | Seeder | seeder | \`import { FakeData, seedTable } from "@tina4/orm"\` |
277
- | i18n | i18n | \`import { I18n } from "@tina4/core"\` |
278
- | Swagger/OpenAPI | swagger | Auto-generated at /swagger |
279
- | Sessions | session | \`import { Session } from "@tina4/core"\` |
280
- | Middleware | middleware | \`import { MiddlewareChain } from "@tina4/core"\` |
281
- | Cache | cache | \`import { responseCache, cacheStats, clearCache } from "@tina4/core"\` |
282
- | Events | events | \`import { Events } from "@tina4/core"\` |
283
- | HTML Builder | htmlElement | \`import { HtmlElement, htmlElement, addHtmlHelpers } from "@tina4/core"\` |
284
- | Error Overlay | errorOverlay | \`import { renderErrorOverlay, isDebugMode } from "@tina4/core"\` |
285
- | Inline Testing | testing | \`import { tests, assertEqual, runAllTests } from "@tina4/core"\` |
286
- | DI Container | container | \`import { Container } from "@tina4/core"\` |
287
-
288
- ## Key Conventions
289
-
290
- 1. **Route files export a default async function** — \`export default async function(req, res) {}\`
291
- 2. **File-based routing** — directory structure mirrors URL paths
292
- 3. **Dynamic params use brackets** — \`[id]\` for params, \`[...slug]\` for catch-all
293
- 4. **GET routes are public**, POST/PUT/PATCH/DELETE require auth by default
294
- 5. **ESM everywhere** — use \`.js\` extensions in imports
295
- 6. **No inline styles** — use SCSS in \`src/scss/\`
296
- 7. **All schema changes via migrations** — never create tables in route code
297
- 8. **Use built-in features** — never install packages for things Tina4 already provides
298
-
299
- ## AI Workflow — Available Skills
300
-
301
- When using an AI coding assistant with Tina4, these skills are available:
302
-
303
- | Skill | Description |
304
- |-------|-------------|
305
- | \`/tina4-route\` | Create a new route with proper decorators and auth |
306
- | \`/tina4-orm\` | Create an ORM model with migration |
307
- | \`/tina4-crud\` | Generate complete CRUD (migration, ORM, routes, template, tests) |
308
- | \`/tina4-auth\` | Set up JWT authentication with login/register |
309
- | \`/tina4-api\` | Create an external API integration |
310
- | \`/tina4-queue\` | Set up background job processing |
311
- | \`/tina4-template\` | Create a server-rendered template page |
312
- | \`/tina4-graphql\` | Set up a GraphQL endpoint |
313
- | \`/tina4-websocket\` | Set up WebSocket communication |
314
- | \`/tina4-wsdl\` | Create a SOAP/WSDL service |
315
- | \`/tina4-messenger\` | Set up email send/receive |
316
- | \`/tina4-test\` | Write tests for a feature |
317
- | \`/tina4-migration\` | Create a database migration |
318
- | \`/tina4-seed\` | Generate fake data for development |
319
- | \`/tina4-i18n\` | Set up internationalization |
320
- | \`/tina4-scss\` | Set up SCSS stylesheets |
321
- | \`/tina4-frontend\` | Set up a frontend framework |
322
-
323
- ## Common Patterns
324
-
325
- ### Route
383
+ ${PROJECT_STRUCTURE}
384
+ \`\`\`
385
+
386
+ ## Built-in Features (Do NOT Install Packages For These)
387
+
388
+ ${FEATURES_COMPACT}
389
+
390
+ ## Conventions
391
+
392
+ ${CONVENTIONS}
393
+
394
+ ## Route Example
395
+
396
+ \`\`\`typescript
397
+ ${ROUTE_EXAMPLE}
398
+ \`\`\`
399
+
400
+ ## Model Example
401
+
326
402
  \`\`\`typescript
327
- // src/routes/api/users/post.ts
328
- import type { Tina4Request, Tina4Response } from "@tina4/core";
403
+ ${MODEL_EXAMPLE}
404
+ \`\`\`
405
+
406
+ ## Quick Commands
407
+
408
+ \`\`\`bash
409
+ npx tina4nodejs serve # Dev server on port 7148
410
+ npx tina4nodejs migrate # Run migrations
411
+ npx tina4nodejs test # Run tests
412
+ npx tina4nodejs routes # List routes
413
+ \`\`\`
414
+
415
+ ## Key Rules
329
416
 
330
- export const meta = { summary: "Create a user", tags: ["users"] };
417
+ - TypeScript strict mode, ESM only, Node.js 20+
418
+ - Native \`node:http\` — no Express/Fastify
419
+ - Convention-based models with \`static fields\` — no decorators
420
+ - Dynamic route params use brackets: \`[id]\`, \`[...slug]\`
421
+ - Use \`.js\` extensions in import paths
422
+ - All schema changes via migrations
331
423
 
332
- export default async function (req: Tina4Request, res: Tina4Response) {
333
- const data = req.body;
334
- return res.json({ created: true }, 201);
424
+ ## Database
425
+
426
+ Default: SQLite via \`node:sqlite\`. Adapters for PostgreSQL, MySQL, MSSQL, Firebird.
427
+ Set \`DATABASE_URL\` in \`.env\` (e.g. \`postgres://localhost:5432/mydb\`).
428
+
429
+ ## Auth
430
+
431
+ JWT auth built in. \`import { createToken, validateToken, hashPassword, checkPassword } from "@tina4/core"\`.
432
+ GET routes are public. POST/PUT/PATCH/DELETE require auth by default.
433
+ `;
335
434
  }
435
+
436
+ function generateAiderContext(): string {
437
+ return `# Tina4 Node.js v${VERSION} — Conventions
438
+
439
+ This is a **Tina4 for Node.js/TypeScript** project (https://tina4.com).
440
+
441
+ ## Project Structure
442
+
443
+ \`\`\`
444
+ ${PROJECT_STRUCTURE}
445
+ \`\`\`
446
+
447
+ ## Built-in Features (Do NOT Install Packages For These)
448
+
449
+ ${FEATURES_COMPACT}
450
+
451
+ ## Conventions
452
+
453
+ ${CONVENTIONS}
454
+
455
+ ## Route Example
456
+
457
+ \`\`\`typescript
458
+ ${ROUTE_EXAMPLE}
336
459
  \`\`\`
337
460
 
338
- ### Model
461
+ ## Model Example
462
+
339
463
  \`\`\`typescript
340
- // src/models/User.ts
341
- export default class User {
342
- static tableName = "users";
343
- static fields = {
344
- id: { type: "integer" as const, primaryKey: true, autoIncrement: true },
345
- name: { type: "string" as const, required: true },
346
- email: { type: "string" as const, required: true },
347
- };
464
+ ${MODEL_EXAMPLE}
465
+ \`\`\`
466
+
467
+ ## Quick Commands
468
+
469
+ \`\`\`bash
470
+ npx tina4nodejs serve # Dev server on port 7148
471
+ npx tina4nodejs migrate # Run migrations
472
+ npx tina4nodejs test # Run tests
473
+ npx tina4nodejs routes # List routes
474
+ \`\`\`
475
+
476
+ ## Key Rules
477
+
478
+ - TypeScript strict mode, ESM only, Node.js 20+
479
+ - Native \`node:http\` — no Express/Fastify
480
+ - Convention-based models with \`static fields\` — no decorators
481
+ - Dynamic route params use brackets: \`[id]\`, \`[...slug]\`
482
+ - Use \`.js\` extensions in import paths
483
+ - All schema changes via migrations
484
+
485
+ ## Database
486
+
487
+ Default: SQLite via \`node:sqlite\`. Adapters for PostgreSQL, MySQL, MSSQL, Firebird.
488
+ Set \`DATABASE_URL\` in \`.env\`.
489
+ `;
490
+ }
491
+
492
+ function generateClineContext(): string {
493
+ return `# Tina4 Node.js v${VERSION} — Cline Rules
494
+
495
+ You are working on a **Tina4 for Node.js/TypeScript** project.
496
+ Documentation: https://tina4.com
497
+
498
+ ## Project Structure
499
+
500
+ \`\`\`
501
+ ${PROJECT_STRUCTURE}
502
+ \`\`\`
503
+
504
+ ## Built-in Features (Do NOT Install Packages For These)
505
+
506
+ ${FEATURES_COMPACT}
507
+
508
+ ## Conventions
509
+
510
+ ${CONVENTIONS}
511
+
512
+ ## Route Example
513
+
514
+ \`\`\`typescript
515
+ ${ROUTE_EXAMPLE}
516
+ \`\`\`
517
+
518
+ ## Model Example
519
+
520
+ \`\`\`typescript
521
+ ${MODEL_EXAMPLE}
522
+ \`\`\`
523
+
524
+ ## Quick Commands
525
+
526
+ \`\`\`bash
527
+ npx tina4nodejs serve # Dev server on port 7148
528
+ npx tina4nodejs migrate # Run migrations
529
+ npx tina4nodejs test # Run tests
530
+ npx tina4nodejs routes # List routes
531
+ \`\`\`
532
+
533
+ ## Key Rules
534
+
535
+ - TypeScript strict mode, ESM only, Node.js 20+
536
+ - Native \`node:http\` — no Express/Fastify
537
+ - Never install npm packages for built-in features
538
+ - All schema changes via migrations
539
+ `;
540
+ }
541
+
542
+ function generateCodexContext(): string {
543
+ return `# Tina4 Node.js v${VERSION} — Agent Instructions
544
+
545
+ You are working on a **Tina4 for Node.js/TypeScript** project.
546
+ Documentation: https://tina4.com
547
+
548
+ ## Project Structure
549
+
550
+ \`\`\`
551
+ ${PROJECT_STRUCTURE}
552
+ \`\`\`
553
+
554
+ ## Built-in Features (Do NOT Install Packages For These)
555
+
556
+ ${FEATURES_COMPACT}
557
+
558
+ ## Conventions
559
+
560
+ ${CONVENTIONS}
561
+
562
+ ## Route Example
563
+
564
+ \`\`\`typescript
565
+ ${ROUTE_EXAMPLE}
566
+ \`\`\`
567
+
568
+ ## Model Example
569
+
570
+ \`\`\`typescript
571
+ ${MODEL_EXAMPLE}
572
+ \`\`\`
573
+
574
+ ## Quick Commands
575
+
576
+ \`\`\`bash
577
+ npx tina4nodejs init . # Scaffold project
578
+ npx tina4nodejs serve # Dev server on port 7148
579
+ npx tina4nodejs migrate # Run migrations
580
+ npx tina4nodejs test # Run tests
581
+ npx tina4nodejs routes # List routes
582
+ \`\`\`
583
+
584
+ ## Key Rules
585
+
586
+ - TypeScript strict mode, ESM only, Node.js 20+
587
+ - Native \`node:http\` — no Express/Fastify
588
+ - Convention-based models with \`static fields\` — no decorators
589
+ - Dynamic route params use brackets: \`[id]\`, \`[...slug]\`
590
+ - Use \`.js\` extensions in import paths
591
+ - All schema changes via migrations
592
+
593
+ ## Database
594
+
595
+ Default: SQLite via \`node:sqlite\`. Adapters for PostgreSQL, MySQL, MSSQL, Firebird.
596
+ Set \`DATABASE_URL\` in \`.env\` (e.g. \`sqlite:///path/to/db.sqlite\`, \`postgres://localhost:5432/mydb\`).
597
+
598
+ ## Auth
599
+
600
+ JWT auth built in. \`import { createToken, validateToken, hashPassword, checkPassword } from "@tina4/core"\`.
601
+ GET routes are public. POST/PUT/PATCH/DELETE require auth by default.
602
+
603
+ ## Testing
604
+
605
+ \`\`\`bash
606
+ npx tina4nodejs test # Run all tests
607
+ \`\`\`
608
+
609
+ Add test files in \`test/\` directory. Use built-in inline testing:
610
+ \`\`\`typescript
611
+ import { tests, assertEqual, runAllTests } from "@tina4/core";
612
+ \`\`\`
613
+
614
+ ## Important
615
+
616
+ - Never add Express, Fastify, or any HTTP framework
617
+ - Never use CommonJS — everything is ESM
618
+ - Never use decorators — use convention-based models
619
+ - Run tests before committing
620
+ `;
348
621
  }
622
+
623
+ function generateClaudeCodeContext(): string {
624
+ // Try to read the existing CLAUDE.md from the repo root
625
+ try {
626
+ const thisDir = dirname(fileURLToPath(import.meta.url));
627
+ const repoRoot = resolve(thisDir, "..", "..", "..");
628
+ const claudeMdPath = join(repoRoot, "CLAUDE.md");
629
+ if (existsSync(claudeMdPath)) {
630
+ return readFileSync(claudeMdPath, "utf-8");
631
+ }
632
+ } catch {
633
+ // fall through to generated version
634
+ }
635
+
636
+ // Fallback: generate a CLAUDE.md
637
+ return `# CLAUDE.md — Tina4 Node.js v${VERSION}
638
+
639
+ > AI Developer Guide for Tina4 Node.js/TypeScript projects.
640
+
641
+ ## What This Project Is
642
+
643
+ Tina4 for Node.js/TypeScript v${VERSION} — a convention-over-configuration structural paradigm.
644
+ Zero ceremony, batteries included, file system as source of truth.
645
+
646
+ Documentation: https://tina4.com
647
+
648
+ ## Project Structure
649
+
650
+ \`\`\`
651
+ ${PROJECT_STRUCTURE}
652
+ \`\`\`
653
+
654
+ ## Built-in Features (Do NOT Install Packages For These)
655
+
656
+ ${FEATURES_COMPACT}
657
+
658
+ ## Conventions
659
+
660
+ ${CONVENTIONS}
661
+
662
+ ## Route Example
663
+
664
+ \`\`\`typescript
665
+ ${ROUTE_EXAMPLE}
349
666
  \`\`\`
667
+
668
+ ## Model Example
669
+
670
+ \`\`\`typescript
671
+ ${MODEL_EXAMPLE}
672
+ \`\`\`
673
+
674
+ ## Quick Commands
675
+
676
+ \`\`\`bash
677
+ npx tina4nodejs init . # Scaffold project
678
+ npx tina4nodejs serve # Dev server on port 7148
679
+ npx tina4nodejs migrate # Run migrations
680
+ npx tina4nodejs test # Run tests
681
+ npx tina4nodejs routes # List routes
682
+ \`\`\`
683
+
684
+ ## Key Rules
685
+
686
+ - TypeScript strict mode, ESM only, Node.js 20+
687
+ - Native \`node:http\` — no Express/Fastify
688
+ - Convention-based models with \`static fields\` — no decorators
689
+ - Dynamic route params use brackets: \`[id]\`, \`[...slug]\`
690
+ - Use \`.js\` extensions in import paths
691
+ - All schema changes via migrations
692
+
693
+ ## Database
694
+
695
+ Default: SQLite via \`node:sqlite\`. Adapters for PostgreSQL, MySQL, MSSQL, Firebird.
696
+ Set \`DATABASE_URL\` in \`.env\`.
697
+
698
+ ## Auth
699
+
700
+ JWT auth built in. GET routes are public. POST/PUT/PATCH/DELETE require auth by default.
701
+
702
+ ## Testing
703
+
704
+ Run \`npx tina4nodejs test\`. All tests must pass before committing.
705
+
706
+ ## Don'ts
707
+
708
+ - Don't add Express, Fastify, or any HTTP framework
709
+ - Don't use decorators — convention-based models
710
+ - Don't use CommonJS — ESM only
711
+ - Don't install packages for built-in features
350
712
  `;
351
713
  }
352
714
 
715
+ // ── Main generator ──────────────────────────────────────────
716
+
717
+ /**
718
+ * Generate the Tina4 context document for a specific AI tool.
719
+ */
720
+ export function generateContext(toolName: string = "claude-code"): string {
721
+ switch (toolName) {
722
+ case "claude-code": return generateClaudeCodeContext();
723
+ case "cursor": return generateCursorContext();
724
+ case "copilot": return generateCopilotContext();
725
+ case "windsurf": return generateWindsurfContext();
726
+ case "aider": return generateAiderContext();
727
+ case "cline": return generateClineContext();
728
+ case "codex": return generateCodexContext();
729
+ default: return generateClaudeCodeContext();
730
+ }
731
+ }
732
+
353
733
  export { AiTool as AiToolType };