/**
 * Framework scaffolding catalog.
 *
 * Maps supported frameworks to their official create CLI commands
 * and the augmentation steps needed to integrate with Agentuity.
 *
 * AI examples and landing pages are provided as template overlay
 * directories under templates/<slug>/ that get copied on top of
 * the scaffolded project. This approach is more maintainable than
 * inline code snippets and produces complete, working files.
 */
import { cpSync } from 'node:fs';
import { join } from 'node:path';
import { currentDir } from "../../node-compat/runtime-info.js";
// Resolve the templates directory relative to this file.
//
// Layouts to handle:
//
//   - Running from source (bun packages/cli/src/main.ts):
//       thisDir = packages/cli/src/cmd/project/
//       templates at thisDir/templates/
//
//   - Running from compiled dist (e.g. installed npm package):
//       thisDir = packages/cli/dist/cmd/project/
//       templates copied by scripts/copy-assets.ts to
//       packages/cli/dist/cmd/project/templates/
//
// The same `thisDir/templates` path resolves correctly under both
// layouts because the dist tree mirrors the source tree (rootDir is
// `./src` so dist/cmd/... = src/cmd/...).
const templatesDir = join(currentDir(import.meta), 'templates');
/**
 * Apply a template overlay directory on top of a scaffolded project.
 */
export function applyOverlay(dest, overlayDir) {
    const overlayPath = join(templatesDir, overlayDir);
    cpSync(overlayPath, dest, { recursive: true, dereference: true, force: true });
}
// ─── Framework Catalog ───────────────────────────────────────────────────────
export const frameworkCatalog = [
    {
        slug: 'nextjs',
        name: 'Next.js',
        description: 'Full-stack React framework with App Router',
        createCommand: (dir) => [
            'bunx',
            'create-next-app@latest',
            dir,
            '--ts',
            '--app',
            '--tailwind',
            '--eslint',
            '--src-dir',
            '--import-alias',
            '@/*',
            '--use-bun',
        ],
        dependencies: ['ai', '@ai-sdk/openai', 'swr'],
        scripts: {
            deploy: 'agentuity deploy',
        },
        overlayDir: 'nextjs',
    },
    {
        slug: 'nuxt',
        name: 'Nuxt',
        description: 'Full-stack Vue framework with server routes',
        createCommand: (dir) => ['bunx', 'nuxi@latest', 'init', dir, '--packageManager', 'bun'],
        dependencies: ['ai', '@ai-sdk/openai'],
        scripts: {
            deploy: 'agentuity deploy',
        },
        overlayDir: 'nuxt',
    },
    {
        slug: 'remix',
        name: 'React Router',
        description: 'Full-stack React framework with nested routing',
        createCommand: (dir) => [
            'bunx',
            'create-react-router@latest',
            dir,
            '--yes',
            '--install',
            '--package-manager',
            'bun',
        ],
        dependencies: ['ai', '@ai-sdk/openai'],
        scripts: {
            deploy: 'agentuity deploy',
        },
        overlayDir: 'remix',
    },
    {
        slug: 'sveltekit',
        name: 'SvelteKit',
        description: 'Full-stack Svelte framework',
        createCommand: (dir) => [
            'bunx',
            'sv@latest',
            'create',
            dir,
            '--template',
            'minimal',
            '--types',
            'ts',
        ],
        dependencies: ['ai', '@ai-sdk/openai'],
        scripts: {
            deploy: 'agentuity deploy',
        },
        overlayDir: 'sveltekit',
    },
    {
        slug: 'astro',
        name: 'Astro',
        description: 'Content-focused framework with island architecture',
        createCommand: (dir) => [
            'bunx',
            'create-astro@latest',
            dir,
            '--template',
            'basics',
            '--install',
            '--yes',
            '--typescript',
            'strict',
        ],
        dependencies: ['ai', '@ai-sdk/openai'],
        scripts: {
            deploy: 'agentuity deploy',
        },
        overlayDir: 'astro',
    },
    {
        slug: 'hono',
        name: 'Hono',
        description: 'Lightweight, fast web framework for the edge',
        createCommand: (dir) => [
            'bunx',
            'create-hono@latest',
            dir,
            '--template',
            'bun',
            '--install',
            '--pm',
            'bun',
        ],
        dependencies: ['ai', '@ai-sdk/openai'],
        scripts: {
            deploy: 'agentuity deploy',
        },
        overlayDir: 'hono',
    },
    {
        slug: 'vite-react',
        name: 'Vite + React',
        description: 'React SPA with Vite bundler',
        createCommand: (dir) => ['bunx', 'create-vite@latest', dir, '--template', 'react-ts'],
        dependencies: ['ai', '@ai-sdk/openai', '@tanstack/react-query'],
        devDependencies: ['tailwindcss', '@tailwindcss/vite'],
        scripts: {
            deploy: 'agentuity deploy',
        },
        overlayDir: 'vite-react',
    },
];
/**
 * Find a framework scaffold by slug.
 */
export function getFrameworkBySlug(slug) {
    return frameworkCatalog.find((f) => f.slug === slug);
}
//# sourceMappingURL=frameworks.js.map