react-agentic 0.0.1 → 0.0.3

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.
package/dist/cli/index.js CHANGED
@@ -202,11 +202,28 @@ function validateConfig(config) {
202
202
  );
203
203
  }
204
204
  }
205
+ function deriveRuntimeDir(outputDir) {
206
+ if (outputDir.includes("commands")) {
207
+ return outputDir.replace(/commands/g, "runtime");
208
+ }
209
+ return path.join(path.dirname(outputDir), "runtime");
210
+ }
205
211
  async function resolveConfig(cliOptions, cwd = process.cwd()) {
206
212
  const fileConfig = await loadConfigFile(cwd);
213
+ const outputDir = cliOptions.out ?? fileConfig.outputDir ?? DEFAULT_CONFIG.outputDir;
214
+ let runtimeDir;
215
+ if (cliOptions.runtimeOut) {
216
+ runtimeDir = cliOptions.runtimeOut;
217
+ } else if (fileConfig.runtimeDir) {
218
+ runtimeDir = fileConfig.runtimeDir;
219
+ } else if (cliOptions.out) {
220
+ runtimeDir = deriveRuntimeDir(outputDir);
221
+ } else {
222
+ runtimeDir = DEFAULT_CONFIG.runtimeDir;
223
+ }
207
224
  const config = {
208
- outputDir: cliOptions.out ?? fileConfig.outputDir ?? DEFAULT_CONFIG.outputDir,
209
- runtimeDir: cliOptions.runtimeOut ?? fileConfig.runtimeDir ?? DEFAULT_CONFIG.runtimeDir,
225
+ outputDir,
226
+ runtimeDir,
210
227
  minify: cliOptions.minify ?? fileConfig.minify ?? DEFAULT_CONFIG.minify,
211
228
  codeSplit: cliOptions.codeSplit ?? fileConfig.codeSplit ?? DEFAULT_CONFIG.codeSplit
212
229
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cli/index.ts","../../src/cli/commands/build.ts","../../src/cli/output.ts","../../src/cli/watcher.ts","../../src/constants.ts","../../src/cli/config.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from 'commander';\nimport { readFile } from 'fs/promises';\nimport { fileURLToPath } from 'url';\nimport path from 'path';\nimport { buildCommand } from './commands/build.js';\n\nasync function main() {\n // Read version from package.json (stays in sync)\n const __dirname = path.dirname(fileURLToPath(import.meta.url));\n const pkgPath = path.resolve(__dirname, '../../package.json');\n const pkg = JSON.parse(await readFile(pkgPath, 'utf-8'));\n\n const program = new Command();\n\n program\n .name('react-agentic')\n .description('Compile-time safety for Claude Code commands')\n .version(pkg.version);\n\n program.addCommand(buildCommand);\n\n program.parse();\n}\n\nmain().catch((err) => {\n console.error(err.message);\n process.exit(1);\n});\n","/**\n * Build Command - Transpile TSX command files to Markdown\n */\nimport { Command } from 'commander';\nimport { globby } from 'globby';\nimport { writeFile, mkdir } from 'fs/promises';\nimport path from 'path';\nimport type { Project } from 'ts-morph';\nimport { createProject } from '../../parser/utils/project.js';\nimport {\n logSuccess,\n logError,\n logInfo,\n logSummary,\n logWarning,\n logBuildTree,\n logTranspileError,\n BuildResult,\n} from '../output.js';\nimport { TranspileError } from '../errors.js';\nimport { createWatcher } from '../watcher.js';\nimport { resolveConfig, type CLIConfigOverrides } from '../config.js';\nimport { DEFAULT_WATCH_PATTERN, EXIT_CODES } from '../../constants.js';\n\n// Build imports\nimport { buildRuntimeFile, hasRuntimeImports } from '../runtime-build.js';\nimport { bundleSingleEntryRuntime, bundleCodeSplit } from '../../emitter/index.js';\nimport type { RuntimeFileInfo } from '../../emitter/index.js';\n\ninterface BuildOptions {\n out: string;\n runtimeOut: string;\n codeSplit: boolean;\n minify: boolean;\n dryRun?: boolean;\n watch?: boolean;\n}\n\n/**\n * Result of processing a single file\n */\ninterface ProcessFileResult {\n result: BuildResult;\n runtimeFileInfo: RuntimeFileInfo | null;\n runtimePath: string;\n}\n\n/**\n * Process a single TSX file and return build results\n */\nasync function processFile(\n inputFile: string,\n project: Project,\n options: BuildOptions\n): Promise<ProcessFileResult> {\n // Parse file\n const sourceFile = project.addSourceFileAtPath(inputFile);\n\n // Build runtime file\n const buildResult = await buildRuntimeFile(sourceFile, project, {\n commandsOut: options.out,\n runtimeOut: options.runtimeOut,\n dryRun: options.dryRun,\n });\n\n // Log warnings\n for (const warning of buildResult.warnings) {\n logWarning(warning);\n }\n\n return {\n result: {\n inputFile,\n outputPath: buildResult.markdownPath,\n content: buildResult.markdown,\n size: Buffer.byteLength(buildResult.markdown, 'utf8'),\n },\n runtimeFileInfo: buildResult.runtimeFileInfo,\n runtimePath: buildResult.runtimePath,\n };\n}\n\n/**\n * Process all TSX files and collect results\n */\nasync function processFiles(\n tsxFiles: string[],\n project: Project,\n options: BuildOptions\n): Promise<{ results: BuildResult[]; runtimeFiles: RuntimeFileInfo[]; runtimePath: string; errorCount: number }> {\n const results: BuildResult[] = [];\n const runtimeFiles: RuntimeFileInfo[] = [];\n let runtimePath = '';\n let errorCount = 0;\n\n for (const inputFile of tsxFiles) {\n try {\n const processed = await processFile(inputFile, project, options);\n results.push(processed.result);\n\n if (processed.runtimeFileInfo) {\n runtimeFiles.push(processed.runtimeFileInfo);\n runtimePath = processed.runtimePath;\n }\n } catch (error) {\n errorCount++;\n if (error instanceof TranspileError) {\n logTranspileError(error);\n } else {\n const message = error instanceof Error ? error.message : String(error);\n logError(inputFile, message);\n }\n }\n }\n\n return { results, runtimeFiles, runtimePath, errorCount };\n}\n\n/**\n * Bundle runtime files and add results to the results array\n */\nasync function bundleRuntimes(\n runtimeFiles: RuntimeFileInfo[],\n runtimePath: string,\n options: BuildOptions,\n results: BuildResult[]\n): Promise<void> {\n if (runtimeFiles.length === 0) {\n return;\n }\n\n const runtimeOutDir = options.runtimeOut;\n\n if (options.codeSplit) {\n // Code-split mode: generate dispatcher + per-namespace modules\n const bundleResult = await bundleCodeSplit({\n runtimeFiles,\n outputDir: runtimeOutDir,\n minify: options.minify,\n });\n\n // Add dispatcher\n results.push({\n inputFile: `${runtimeFiles.length} file(s) (dispatcher)`,\n outputPath: path.join(runtimeOutDir, 'runtime.js'),\n content: bundleResult.dispatcherContent,\n size: Buffer.byteLength(bundleResult.dispatcherContent, 'utf8'),\n });\n\n // Add each namespace module\n for (const [namespace, content] of bundleResult.moduleContents) {\n results.push({\n inputFile: `${namespace} module`,\n outputPath: path.join(runtimeOutDir, `${namespace}.js`),\n content,\n size: Buffer.byteLength(content, 'utf8'),\n });\n }\n\n // Log any bundle warnings\n for (const warning of bundleResult.warnings) {\n logWarning(warning);\n }\n } else {\n // Single-entry mode (default): one bundled runtime.js\n const bundleResult = await bundleSingleEntryRuntime({\n runtimeFiles,\n outputPath: runtimePath,\n minify: options.minify,\n });\n\n results.push({\n inputFile: `${runtimeFiles.length} file(s)`,\n outputPath: runtimePath,\n content: bundleResult.content,\n size: Buffer.byteLength(bundleResult.content, 'utf8'),\n });\n\n // Log any bundle warnings\n for (const warning of bundleResult.warnings) {\n logWarning(warning);\n }\n }\n}\n\n/**\n * Write build results to disk\n */\nasync function writeResults(results: BuildResult[]): Promise<void> {\n for (const result of results) {\n if (result.skipWrite) continue;\n\n const outputDir = path.dirname(result.outputPath);\n await mkdir(outputDir, { recursive: true });\n await writeFile(result.outputPath, result.content, 'utf-8');\n logSuccess(result.inputFile, result.outputPath);\n }\n}\n\n/**\n * Run a build cycle for the given files\n * Returns counts for summary reporting\n */\nasync function runBuild(\n tsxFiles: string[],\n options: BuildOptions,\n project: Project,\n clearScreen: boolean\n): Promise<{ successCount: number; errorCount: number }> {\n if (clearScreen) {\n console.clear();\n }\n\n // Process all files\n const { results, runtimeFiles, runtimePath, errorCount } = await processFiles(\n tsxFiles,\n project,\n options\n );\n\n // Bundle runtimes\n await bundleRuntimes(runtimeFiles, runtimePath, options, results);\n\n // Write files (unless dry-run)\n if (!options.dryRun) {\n await writeResults(results);\n }\n\n // Show build tree\n if (results.length > 0) {\n console.log('');\n logBuildTree(results, options.dryRun ?? false);\n }\n\n // Summary\n logSummary(results.length, errorCount);\n\n return { successCount: results.length, errorCount };\n}\n\nexport const buildCommand = new Command('build')\n .description('Transpile TSX command files to Markdown')\n .argument('[patterns...]', 'Glob patterns for TSX files (e.g., src/**/*.tsx)')\n .option('-o, --out <dir>', 'Output directory (default: .claude/commands)')\n .option('-d, --dry-run', 'Preview output without writing files')\n .option('-w, --watch', 'Watch for changes and rebuild automatically')\n .option('--runtime-out <dir>', 'Runtime output directory (default: .claude/runtime)')\n .option('--code-split', 'Split runtime into per-namespace modules')\n .option('--minify', 'Minify runtime bundles')\n .action(async (patterns: string[], cliOptions: CLIConfigOverrides & { dryRun?: boolean; watch?: boolean }) => {\n // Resolve config: defaults → config file → CLI flags\n const config = await resolveConfig(cliOptions);\n\n const options: BuildOptions = {\n out: config.outputDir,\n runtimeOut: config.runtimeDir,\n codeSplit: config.codeSplit,\n minify: config.minify,\n dryRun: cliOptions.dryRun,\n watch: cliOptions.watch,\n };\n\n // Disallow --dry-run with --watch (validate early before expensive operations)\n if (options.watch && options.dryRun) {\n console.error('Cannot use --dry-run with --watch');\n process.exit(EXIT_CODES.VALIDATION_ERROR);\n }\n\n // Default to src/app/**/*.tsx in watch mode if no patterns provided\n if (patterns.length === 0) {\n if (options.watch) {\n patterns = [DEFAULT_WATCH_PATTERN];\n } else {\n console.error(`No patterns provided. Specify glob patterns or use --watch for default ${DEFAULT_WATCH_PATTERN}`);\n process.exit(EXIT_CODES.VALIDATION_ERROR);\n }\n }\n\n // Expand glob patterns\n const files = await globby(patterns, {\n onlyFiles: true,\n gitignore: true,\n });\n\n // Filter to .tsx files only\n const tsxFiles = files.filter((f) => f.endsWith('.tsx'));\n\n if (tsxFiles.length === 0) {\n logWarning('No .tsx files found matching patterns');\n process.exit(EXIT_CODES.SUCCESS);\n }\n\n // Create ts-morph project once\n const project = createProject();\n\n if (options.watch) {\n // Watch mode\n logInfo(`Watching ${tsxFiles.length} file(s) for changes...\\n`);\n\n // Initial build\n await runBuild(tsxFiles, options, project, false);\n\n // Setup watcher\n const watcher = createWatcher(tsxFiles, async (changedFiles) => {\n logInfo(`\\nFile changed: ${changedFiles.join(', ')}`);\n\n // Clear stale source files and re-add for fresh parse\n for (const file of changedFiles) {\n const existing = project.getSourceFile(file);\n if (existing) {\n project.removeSourceFile(existing);\n }\n }\n\n await runBuild(tsxFiles, options, project, true);\n });\n\n // Graceful shutdown\n const shutdown = async () => {\n console.log('\\nStopping watch...');\n await watcher.close();\n process.exit(EXIT_CODES.SUCCESS);\n };\n\n process.on('SIGINT', shutdown);\n process.on('SIGTERM', shutdown);\n\n // Keep process running (watcher keeps event loop alive)\n return;\n }\n\n // Non-watch mode: single build\n logInfo(`Found ${tsxFiles.length} file(s) to process\\n`);\n const { errorCount } = await runBuild(tsxFiles, options, project, false);\n\n // Exit with error code if any failures\n if (errorCount > 0) {\n process.exit(EXIT_CODES.BUILD_ERROR);\n }\n });\n","/**\n * CLI Output Utilities - Colored terminal output with NO_COLOR support\n */\nimport pc from 'picocolors';\nimport { TranspileError, formatTranspileError } from './errors.js';\n\n/**\n * Log successful file processing\n */\nexport function logSuccess(inputFile: string, outputFile: string): void {\n console.log(`${pc.green('✓')} ${pc.dim(inputFile)} → ${pc.cyan(outputFile)}`);\n}\n\n/**\n * Log file processing error\n */\nexport function logError(inputFile: string, message: string): void {\n console.error(`${pc.red('✗')} ${pc.dim(inputFile)}: ${message}`);\n}\n\n/**\n * Log informational message\n */\nexport function logInfo(message: string): void {\n console.log(pc.dim(message));\n}\n\n/**\n * Log build summary\n */\nexport function logSummary(successCount: number, errorCount: number): void {\n console.log('');\n if (errorCount === 0) {\n console.log(pc.green(`Built ${successCount} file(s) successfully`));\n } else {\n console.log(\n pc.yellow(`Built ${successCount} file(s) with ${pc.red(String(errorCount))} error(s)`)\n );\n }\n}\n\n/**\n * Log warning message\n */\nexport function logWarning(message: string): void {\n console.log(pc.yellow(message));\n}\n\n/**\n * Log a TranspileError with source location context\n *\n * Outputs TypeScript-style error format with file:line:col,\n * code snippet, and caret indicator.\n */\nexport function logTranspileError(error: TranspileError): void {\n console.error(formatTranspileError(error));\n}\n\n/**\n * Build result for tree output\n */\nexport interface BuildResult {\n inputFile: string;\n outputPath: string;\n content: string;\n size: number;\n /** Static files to copy (skills only) */\n statics?: Array<{ src: string; dest: string }>;\n /** Skip writing this file (already written by merge logic, e.g., settings.json) */\n skipWrite?: boolean;\n}\n\n/**\n * Format bytes to human-readable string\n */\nfunction formatBytes(bytes: number): string {\n if (bytes < 1024) {\n return `${bytes} B`;\n }\n if (bytes < 1024 * 1024) {\n return `${(bytes / 1024).toFixed(1)} KB`;\n }\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\n/**\n * Log build tree output (Next.js-style)\n */\nexport function logBuildTree(results: BuildResult[], dryRun: boolean): void {\n const header = dryRun ? 'Would create:' : 'Output:';\n console.log(pc.bold(header));\n\n for (const result of results) {\n const sizeStr = formatBytes(result.size).padStart(8);\n console.log(` ${pc.cyan(result.outputPath)} ${pc.dim(sizeStr)}`);\n }\n\n console.log('');\n}\n","/**\n * File Watcher - Watch for file changes with debouncing\n */\nimport chokidar from 'chokidar';\nimport type { FSWatcher } from 'chokidar';\nimport {\n DEFAULT_DEBOUNCE_MS,\n WRITE_STABILITY_THRESHOLD_MS,\n WRITE_STABILITY_POLL_MS,\n} from '../constants.js';\n\nexport interface Watcher {\n close(): Promise<void>;\n}\n\nexport interface WatcherOptions {\n debounceMs?: number;\n onReady?: () => void;\n}\n\n/**\n * Create a file watcher with debounced rebuild callback\n *\n * @param files - Array of file paths to watch (use globby to expand first)\n * @param onRebuild - Callback when files change (receives changed file paths)\n * @param options - Configuration options\n */\nexport function createWatcher(\n files: string[],\n onRebuild: (changedFiles: string[]) => Promise<void>,\n options: WatcherOptions = {}\n): Watcher {\n const debounceMs = options.debounceMs ?? DEFAULT_DEBOUNCE_MS;\n\n let timeout: NodeJS.Timeout | null = null;\n let pending: Set<string> = new Set();\n let isRebuilding = false;\n\n const watcher: FSWatcher = chokidar.watch(files, {\n ignoreInitial: true, // Don't fire on startup - do full build first\n awaitWriteFinish: {\n stabilityThreshold: WRITE_STABILITY_THRESHOLD_MS,\n pollInterval: WRITE_STABILITY_POLL_MS,\n },\n });\n\n const triggerRebuild = async () => {\n if (isRebuilding) {\n // If already rebuilding, reschedule\n timeout = setTimeout(triggerRebuild, debounceMs);\n return;\n }\n\n const changedFiles = Array.from(pending);\n pending.clear();\n\n if (changedFiles.length === 0) return;\n\n isRebuilding = true;\n try {\n await onRebuild(changedFiles);\n } finally {\n isRebuilding = false;\n }\n };\n\n watcher.on('all', (event, filePath) => {\n if (event === 'add' || event === 'change' || event === 'unlink') {\n pending.add(filePath);\n\n if (timeout) clearTimeout(timeout);\n timeout = setTimeout(triggerRebuild, debounceMs);\n }\n });\n\n if (options.onReady) {\n watcher.on('ready', options.onReady);\n }\n\n watcher.on('error', (error: unknown) => {\n const message = error instanceof Error ? error.message : String(error);\n console.error('Watcher error:', message);\n });\n\n return {\n async close() {\n if (timeout) clearTimeout(timeout);\n await watcher.close();\n },\n };\n}\n","/**\n * Shared constants for react-agentic\n *\n * Centralized location for magic numbers and configuration values\n * used across multiple modules.\n */\n\n// ============================================================================\n// Root Element Tags\n// ============================================================================\n\n/**\n * Supported root element tags for document files\n */\nexport const SUPPORTED_ROOT_TAGS = ['Command', 'RuntimeCommand', 'Agent'] as const;\n\nexport type SupportedRootTag = (typeof SUPPORTED_ROOT_TAGS)[number];\n\n// ============================================================================\n// File Watcher Constants\n// ============================================================================\n\n/**\n * Default debounce time in milliseconds for file watcher\n */\nexport const DEFAULT_DEBOUNCE_MS = 200;\n\n/**\n * Time to wait for file writes to stabilize before triggering rebuild\n */\nexport const WRITE_STABILITY_THRESHOLD_MS = 100;\n\n/**\n * Poll interval for write stability detection\n */\nexport const WRITE_STABILITY_POLL_MS = 50;\n\n// ============================================================================\n// Exit Codes\n// ============================================================================\n\n/**\n * Standard exit codes for CLI operations\n */\nexport const EXIT_CODES = {\n /** Successful execution */\n SUCCESS: 0,\n /** User/validation error (bad arguments, conflicts) */\n VALIDATION_ERROR: 1,\n /** Build/compilation error */\n BUILD_ERROR: 1,\n} as const;\n\nexport type ExitCode = (typeof EXIT_CODES)[keyof typeof EXIT_CODES];\n\n// ============================================================================\n// Build Configuration\n// ============================================================================\n\n/**\n * Default output directory for generated markdown files\n */\nexport const DEFAULT_OUTPUT_DIR = '.claude/commands';\n\n/**\n * Default output directory for runtime bundles\n */\nexport const DEFAULT_RUNTIME_DIR = '.claude/runtime';\n\n/**\n * Default glob pattern for watch mode when no patterns provided\n */\nexport const DEFAULT_WATCH_PATTERN = 'src/app/**/*.tsx';\n","/**\n * Configuration loading and merging for react-agentic\n *\n * Priority (highest to lowest):\n * 1. CLI flags\n * 2. react-agentic.config.json\n * 3. Built-in defaults\n */\nimport { readFile } from 'fs/promises';\nimport { existsSync } from 'fs';\nimport path from 'path';\nimport { DEFAULT_OUTPUT_DIR, DEFAULT_RUNTIME_DIR } from '../constants.js';\n\n/**\n * Configuration options for react-agentic builds\n */\nexport interface ReactAgenticConfig {\n /** Output directory for markdown files (default: .claude/commands) */\n outputDir: string;\n /** Output directory for runtime bundles (default: .claude/runtime) */\n runtimeDir: string;\n /** Minify runtime bundles (default: false) */\n minify: boolean;\n /** Split runtime into per-namespace modules (default: false) */\n codeSplit: boolean;\n}\n\n/**\n * Built-in default configuration\n */\nexport const DEFAULT_CONFIG: ReactAgenticConfig = {\n outputDir: DEFAULT_OUTPUT_DIR,\n runtimeDir: DEFAULT_RUNTIME_DIR,\n minify: false,\n codeSplit: false,\n};\n\nconst CONFIG_FILENAME = 'react-agentic.config.json';\n\n/**\n * Load configuration from react-agentic.config.json if it exists\n * Returns partial config (only fields present in file)\n */\nexport async function loadConfigFile(cwd: string = process.cwd()): Promise<Partial<ReactAgenticConfig>> {\n const configPath = path.join(cwd, CONFIG_FILENAME);\n\n if (!existsSync(configPath)) {\n return {};\n }\n\n try {\n const content = await readFile(configPath, 'utf-8');\n const parsed = JSON.parse(content);\n\n // Validate and extract known fields only\n const config: Partial<ReactAgenticConfig> = {};\n\n if (typeof parsed.outputDir === 'string') {\n config.outputDir = parsed.outputDir;\n }\n if (typeof parsed.runtimeDir === 'string') {\n config.runtimeDir = parsed.runtimeDir;\n }\n if (typeof parsed.minify === 'boolean') {\n config.minify = parsed.minify;\n }\n if (typeof parsed.codeSplit === 'boolean') {\n config.codeSplit = parsed.codeSplit;\n }\n\n return config;\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to load ${CONFIG_FILENAME}: ${message}`);\n }\n}\n\n/**\n * CLI options that can override config\n */\nexport interface CLIConfigOverrides {\n out?: string;\n runtimeOut?: string;\n minify?: boolean;\n codeSplit?: boolean;\n}\n\n/**\n * Configuration validation errors\n */\nexport class ConfigValidationError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'ConfigValidationError';\n }\n}\n\n/**\n * Validate configuration for common issues\n *\n * Checks:\n * - Output directories are not the same (would cause conflicts)\n * - Paths don't contain problematic characters\n */\nfunction validateConfig(config: ReactAgenticConfig): void {\n // Normalize paths for comparison\n const normalizedOutput = path.normalize(config.outputDir);\n const normalizedRuntime = path.normalize(config.runtimeDir);\n\n // Check for output directory conflicts\n if (normalizedOutput === normalizedRuntime) {\n throw new ConfigValidationError(\n `outputDir and runtimeDir cannot be the same: ${config.outputDir}`\n );\n }\n\n // Check if one is a parent of the other (would cause nested writes)\n if (normalizedRuntime.startsWith(normalizedOutput + path.sep)) {\n throw new ConfigValidationError(\n `runtimeDir (${config.runtimeDir}) cannot be inside outputDir (${config.outputDir})`\n );\n }\n if (normalizedOutput.startsWith(normalizedRuntime + path.sep)) {\n throw new ConfigValidationError(\n `outputDir (${config.outputDir}) cannot be inside runtimeDir (${config.runtimeDir})`\n );\n }\n}\n\n/**\n * Resolve final configuration by merging:\n * defaults → config file → CLI flags\n *\n * @throws {ConfigValidationError} if configuration is invalid\n */\nexport async function resolveConfig(\n cliOptions: CLIConfigOverrides,\n cwd: string = process.cwd()\n): Promise<ReactAgenticConfig> {\n // Load config file (if exists)\n const fileConfig = await loadConfigFile(cwd);\n\n // Merge: defaults → file → CLI\n const config: ReactAgenticConfig = {\n outputDir: cliOptions.out ?? fileConfig.outputDir ?? DEFAULT_CONFIG.outputDir,\n runtimeDir: cliOptions.runtimeOut ?? fileConfig.runtimeDir ?? DEFAULT_CONFIG.runtimeDir,\n minify: cliOptions.minify ?? fileConfig.minify ?? DEFAULT_CONFIG.minify,\n codeSplit: cliOptions.codeSplit ?? fileConfig.codeSplit ?? DEFAULT_CONFIG.codeSplit,\n };\n\n // Validate the merged config\n validateConfig(config);\n\n return config;\n}\n"],"mappings":";;;;;;;;;;;;;AACA,SAAS,WAAAA,gBAAe;AACxB,SAAS,YAAAC,iBAAgB;AACzB,SAAS,qBAAqB;AAC9B,OAAOC,WAAU;;;ACIjB;AALA,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,WAAW,aAAa;AACjC,OAAOC,WAAU;;;ACHjB,OAAO,QAAQ;AAMR,SAAS,WAAW,WAAmB,YAA0B;AACtE,UAAQ,IAAI,GAAG,GAAG,MAAM,QAAG,CAAC,IAAI,GAAG,IAAI,SAAS,CAAC,WAAM,GAAG,KAAK,UAAU,CAAC,EAAE;AAC9E;AAKO,SAAS,SAAS,WAAmB,SAAuB;AACjE,UAAQ,MAAM,GAAG,GAAG,IAAI,QAAG,CAAC,IAAI,GAAG,IAAI,SAAS,CAAC,KAAK,OAAO,EAAE;AACjE;AAKO,SAAS,QAAQ,SAAuB;AAC7C,UAAQ,IAAI,GAAG,IAAI,OAAO,CAAC;AAC7B;AAKO,SAAS,WAAW,cAAsB,YAA0B;AACzE,UAAQ,IAAI,EAAE;AACd,MAAI,eAAe,GAAG;AACpB,YAAQ,IAAI,GAAG,MAAM,SAAS,YAAY,uBAAuB,CAAC;AAAA,EACpE,OAAO;AACL,YAAQ;AAAA,MACN,GAAG,OAAO,SAAS,YAAY,iBAAiB,GAAG,IAAI,OAAO,UAAU,CAAC,CAAC,WAAW;AAAA,IACvF;AAAA,EACF;AACF;AAKO,SAAS,WAAW,SAAuB;AAChD,UAAQ,IAAI,GAAG,OAAO,OAAO,CAAC;AAChC;AAQO,SAAS,kBAAkB,OAA6B;AAC7D,UAAQ,M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U,SAAS,SAAS,KAAK;AAGvE,MAAI,aAAa,GAAG;AAClB,YAAQ,KAAK,WAAW,WAAW;AAAA,EACrC;AACF,CAAC;;;AD5UH,eAAe,OAAO;AAEpB,QAAM,YAAYC,MAAK,QAAQ,cAAc,YAAY,GAAG,CAAC;AAC7D,QAAM,UAAUA,MAAK,QAAQ,WAAW,oBAAoB;AAC5D,QAAM,MAAM,KAAK,MAAM,MAAMC,UAAS,SAAS,OAAO,CAAC;AAEvD,QAAM,UAAU,IAAIC,SAAQ;AAE5B,UACG,KAAK,eAAe,EACpB,YAAY,8CAA8C,EAC1D,QAAQ,IAAI,OAAO;AAEtB,UAAQ,WAAW,YAAY;AAE/B,UAAQ,MAAM;AAChB;AAEA,KAAK,EAAE,MAAM,CAAC,QAAQ;AACpB,UAAQ,MAAM,IAAI,OAAO;AACzB,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["Command","readFile","path","path","path","path","readFile","Command"]}
1
+ {"version":3,"sources":["../../src/cli/index.ts","../../src/cli/commands/build.ts","../../src/cli/output.ts","../../src/cli/watcher.ts","../../src/constants.ts","../../src/cli/config.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from 'commander';\nimport { readFile } from 'fs/promises';\nimport { fileURLToPath } from 'url';\nimport path from 'path';\nimport { buildCommand } from './commands/build.js';\n\nasync function main() {\n // Read version from package.json (stays in sync)\n const __dirname = path.dirname(fileURLToPath(import.meta.url));\n const pkgPath = path.resolve(__dirname, '../../package.json');\n const pkg = JSON.parse(await readFile(pkgPath, 'utf-8'));\n\n const program = new Command();\n\n program\n .name('react-agentic')\n .description('Compile-time safety for Claude Code commands')\n .version(pkg.version);\n\n program.addCommand(buildCommand);\n\n program.parse();\n}\n\nmain().catch((err) => {\n console.error(err.message);\n process.exit(1);\n});\n","/**\n * Build Command - Transpile TSX command files to Markdown\n */\nimport { Command } from 'commander';\nimport { globby } from 'globby';\nimport { writeFile, mkdir } from 'fs/promises';\nimport path from 'path';\nimport type { Project } from 'ts-morph';\nimport { createProject } from '../../parser/utils/project.js';\nimport {\n logSuccess,\n logError,\n logInfo,\n logSummary,\n logWarning,\n logBuildTree,\n logTranspileError,\n BuildResult,\n} from '../output.js';\nimport { TranspileError } from '../errors.js';\nimport { createWatcher } from '../watcher.js';\nimport { resolveConfig, type CLIConfigOverrides } from '../config.js';\nimport { DEFAULT_WATCH_PATTERN, EXIT_CODES } from '../../constants.js';\n\n// Build imports\nimport { buildRuntimeFile, hasRuntimeImports } from '../runtime-build.js';\nimport { bundleSingleEntryRuntime, bundleCodeSplit } from '../../emitter/index.js';\nimport type { RuntimeFileInfo } from '../../emitter/index.js';\n\ninterface BuildOptions {\n out: string;\n runtimeOut: string;\n codeSplit: boolean;\n minify: boolean;\n dryRun?: boolean;\n watch?: boolean;\n}\n\n/**\n * Result of processing a single file\n */\ninterface ProcessFileResult {\n result: BuildResult;\n runtimeFileInfo: RuntimeFileInfo | null;\n runtimePath: string;\n}\n\n/**\n * Process a single TSX file and return build results\n */\nasync function processFile(\n inputFile: string,\n project: Project,\n options: BuildOptions\n): Promise<ProcessFileResult> {\n // Parse file\n const sourceFile = project.addSourceFileAtPath(inputFile);\n\n // Build runtime file\n const buildResult = await buildRuntimeFile(sourceFile, project, {\n commandsOut: options.out,\n runtimeOut: options.runtimeOut,\n dryRun: options.dryRun,\n });\n\n // Log warnings\n for (const warning of buildResult.warnings) {\n logWarning(warning);\n }\n\n return {\n result: {\n inputFile,\n outputPath: buildResult.markdownPath,\n content: buildResult.markdown,\n size: Buffer.byteLength(buildResult.markdown, 'utf8'),\n },\n runtimeFileInfo: buildResult.runtimeFileInfo,\n runtimePath: buildResult.runtimePath,\n };\n}\n\n/**\n * Process all TSX files and collect results\n */\nasync function processFiles(\n tsxFiles: string[],\n project: Project,\n options: BuildOptions\n): Promise<{ results: BuildResult[]; runtimeFiles: RuntimeFileInfo[]; runtimePath: string; errorCount: number }> {\n const results: BuildResult[] = [];\n const runtimeFiles: RuntimeFileInfo[] = [];\n let runtimePath = '';\n let errorCount = 0;\n\n for (const inputFile of tsxFiles) {\n try {\n const processed = await processFile(inputFile, project, options);\n results.push(processed.result);\n\n if (processed.runtimeFileInfo) {\n runtimeFiles.push(processed.runtimeFileInfo);\n runtimePath = processed.runtimePath;\n }\n } catch (error) {\n errorCount++;\n if (error instanceof TranspileError) {\n logTranspileError(error);\n } else {\n const message = error instanceof Error ? error.message : String(error);\n logError(inputFile, message);\n }\n }\n }\n\n return { results, runtimeFiles, runtimePath, errorCount };\n}\n\n/**\n * Bundle runtime files and add results to the results array\n */\nasync function bundleRuntimes(\n runtimeFiles: RuntimeFileInfo[],\n runtimePath: string,\n options: BuildOptions,\n results: BuildResult[]\n): Promise<void> {\n if (runtimeFiles.length === 0) {\n return;\n }\n\n const runtimeOutDir = options.runtimeOut;\n\n if (options.codeSplit) {\n // Code-split mode: generate dispatcher + per-namespace modules\n const bundleResult = await bundleCodeSplit({\n runtimeFiles,\n outputDir: runtimeOutDir,\n minify: options.minify,\n });\n\n // Add dispatcher\n results.push({\n inputFile: `${runtimeFiles.length} file(s) (dispatcher)`,\n outputPath: path.join(runtimeOutDir, 'runtime.js'),\n content: bundleResult.dispatcherContent,\n size: Buffer.byteLength(bundleResult.dispatcherContent, 'utf8'),\n });\n\n // Add each namespace module\n for (const [namespace, content] of bundleResult.moduleContents) {\n results.push({\n inputFile: `${namespace} module`,\n outputPath: path.join(runtimeOutDir, `${namespace}.js`),\n content,\n size: Buffer.byteLength(content, 'utf8'),\n });\n }\n\n // Log any bundle warnings\n for (const warning of bundleResult.warnings) {\n logWarning(warning);\n }\n } else {\n // Single-entry mode (default): one bundled runtime.js\n const bundleResult = await bundleSingleEntryRuntime({\n runtimeFiles,\n outputPath: runtimePath,\n minify: options.minify,\n });\n\n results.push({\n inputFile: `${runtimeFiles.length} file(s)`,\n outputPath: runtimePath,\n content: bundleResult.content,\n size: Buffer.byteLength(bundleResult.content, 'utf8'),\n });\n\n // Log any bundle warnings\n for (const warning of bundleResult.warnings) {\n logWarning(warning);\n }\n }\n}\n\n/**\n * Write build results to disk\n */\nasync function writeResults(results: BuildResult[]): Promise<void> {\n for (const result of results) {\n if (result.skipWrite) continue;\n\n const outputDir = path.dirname(result.outputPath);\n await mkdir(outputDir, { recursive: true });\n await writeFile(result.outputPath, result.content, 'utf-8');\n logSuccess(result.inputFile, result.outputPath);\n }\n}\n\n/**\n * Run a build cycle for the given files\n * Returns counts for summary reporting\n */\nasync function runBuild(\n tsxFiles: string[],\n options: BuildOptions,\n project: Project,\n clearScreen: boolean\n): Promise<{ successCount: number; errorCount: number }> {\n if (clearScreen) {\n console.clear();\n }\n\n // Process all files\n const { results, runtimeFiles, runtimePath, errorCount } = await processFiles(\n tsxFiles,\n project,\n options\n );\n\n // Bundle runtimes\n await bundleRuntimes(runtimeFiles, runtimePath, options, results);\n\n // Write files (unless dry-run)\n if (!options.dryRun) {\n await writeResults(results);\n }\n\n // Show build tree\n if (results.length > 0) {\n console.log('');\n logBuildTree(results, options.dryRun ?? false);\n }\n\n // Summary\n logSummary(results.length, errorCount);\n\n return { successCount: results.length, errorCount };\n}\n\nexport const buildCommand = new Command('build')\n .description('Transpile TSX command files to Markdown')\n .argument('[patterns...]', 'Glob patterns for TSX files (e.g., src/**/*.tsx)')\n .option('-o, --out <dir>', 'Output directory (default: .claude/commands)')\n .option('-d, --dry-run', 'Preview output without writing files')\n .option('-w, --watch', 'Watch for changes and rebuild automatically')\n .option('--runtime-out <dir>', 'Runtime output directory (default: .claude/runtime)')\n .option('--code-split', 'Split runtime into per-namespace modules')\n .option('--minify', 'Minify runtime bundles')\n .action(async (patterns: string[], cliOptions: CLIConfigOverrides & { dryRun?: boolean; watch?: boolean }) => {\n // Resolve config: defaults → config file → CLI flags\n const config = await resolveConfig(cliOptions);\n\n const options: BuildOptions = {\n out: config.outputDir,\n runtimeOut: config.runtimeDir,\n codeSplit: config.codeSplit,\n minify: config.minify,\n dryRun: cliOptions.dryRun,\n watch: cliOptions.watch,\n };\n\n // Disallow --dry-run with --watch (validate early before expensive operations)\n if (options.watch && options.dryRun) {\n console.error('Cannot use --dry-run with --watch');\n process.exit(EXIT_CODES.VALIDATION_ERROR);\n }\n\n // Default to src/app/**/*.tsx in watch mode if no patterns provided\n if (patterns.length === 0) {\n if (options.watch) {\n patterns = [DEFAULT_WATCH_PATTERN];\n } else {\n console.error(`No patterns provided. Specify glob patterns or use --watch for default ${DEFAULT_WATCH_PATTERN}`);\n process.exit(EXIT_CODES.VALIDATION_ERROR);\n }\n }\n\n // Expand glob patterns\n const files = await globby(patterns, {\n onlyFiles: true,\n gitignore: true,\n });\n\n // Filter to .tsx files only\n const tsxFiles = files.filter((f) => f.endsWith('.tsx'));\n\n if (tsxFiles.length === 0) {\n logWarning('No .tsx files found matching patterns');\n process.exit(EXIT_CODES.SUCCESS);\n }\n\n // Create ts-morph project once\n const project = createProject();\n\n if (options.watch) {\n // Watch mode\n logInfo(`Watching ${tsxFiles.length} file(s) for changes...\\n`);\n\n // Initial build\n await runBuild(tsxFiles, options, project, false);\n\n // Setup watcher\n const watcher = createWatcher(tsxFiles, async (changedFiles) => {\n logInfo(`\\nFile changed: ${changedFiles.join(', ')}`);\n\n // Clear stale source files and re-add for fresh parse\n for (const file of changedFiles) {\n const existing = project.getSourceFile(file);\n if (existing) {\n project.removeSourceFile(existing);\n }\n }\n\n await runBuild(tsxFiles, options, project, true);\n });\n\n // Graceful shutdown\n const shutdown = async () => {\n console.log('\\nStopping watch...');\n await watcher.close();\n process.exit(EXIT_CODES.SUCCESS);\n };\n\n process.on('SIGINT', shutdown);\n process.on('SIGTERM', shutdown);\n\n // Keep process running (watcher keeps event loop alive)\n return;\n }\n\n // Non-watch mode: single build\n logInfo(`Found ${tsxFiles.length} file(s) to process\\n`);\n const { errorCount } = await runBuild(tsxFiles, options, project, false);\n\n // Exit with error code if any failures\n if (errorCount > 0) {\n process.exit(EXIT_CODES.BUILD_ERROR);\n }\n });\n","/**\n * CLI Output Utilities - Colored terminal output with NO_COLOR support\n */\nimport pc from 'picocolors';\nimport { TranspileError, formatTranspileError } from './errors.js';\n\n/**\n * Log successful file processing\n */\nexport function logSuccess(inputFile: string, outputFile: string): void {\n console.log(`${pc.green('✓')} ${pc.dim(inputFile)} → ${pc.cyan(outputFile)}`);\n}\n\n/**\n * Log file processing error\n */\nexport function logError(inputFile: string, message: string): void {\n console.error(`${pc.red('✗')} ${pc.dim(inputFile)}: ${message}`);\n}\n\n/**\n * Log informational message\n */\nexport function logInfo(message: string): void {\n console.log(pc.dim(message));\n}\n\n/**\n * Log build summary\n */\nexport function logSummary(successCount: number, errorCount: number): void {\n console.log('');\n if (errorCount === 0) {\n console.log(pc.green(`Built ${successCount} file(s) successfully`));\n } else {\n console.log(\n pc.yellow(`Built ${successCount} file(s) with ${pc.red(String(errorCount))} error(s)`)\n );\n }\n}\n\n/**\n * Log warning message\n */\nexport function logWarning(message: string): void {\n console.log(pc.yellow(message));\n}\n\n/**\n * Log a TranspileError with source location context\n *\n * Outputs TypeScript-style error format with file:line:col,\n * code snippet, and caret indicator.\n */\nexport function logTranspileError(error: TranspileError): void {\n console.error(formatTranspileError(error));\n}\n\n/**\n * Build result for tree output\n */\nexport interface BuildResult {\n inputFile: string;\n outputPath: string;\n content: string;\n size: number;\n /** Static files to copy (skills only) */\n statics?: Array<{ src: string; dest: string }>;\n /** Skip writing this file (already written by merge logic, e.g., settings.json) */\n skipWrite?: boolean;\n}\n\n/**\n * Format bytes to human-readable string\n */\nfunction formatBytes(bytes: number): string {\n if (bytes < 1024) {\n return `${bytes} B`;\n }\n if (bytes < 1024 * 1024) {\n return `${(bytes / 1024).toFixed(1)} KB`;\n }\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\n/**\n * Log build tree output (Next.js-style)\n */\nexport function logBuildTree(results: BuildResult[], dryRun: boolean): void {\n const header = dryRun ? 'Would create:' : 'Output:';\n console.log(pc.bold(header));\n\n for (const result of results) {\n const sizeStr = formatBytes(result.size).padStart(8);\n console.log(` ${pc.cyan(result.outputPath)} ${pc.dim(sizeStr)}`);\n }\n\n console.log('');\n}\n","/**\n * File Watcher - Watch for file changes with debouncing\n */\nimport chokidar from 'chokidar';\nimport type { FSWatcher } from 'chokidar';\nimport {\n DEFAULT_DEBOUNCE_MS,\n WRITE_STABILITY_THRESHOLD_MS,\n WRITE_STABILITY_POLL_MS,\n} from '../constants.js';\n\nexport interface Watcher {\n close(): Promise<void>;\n}\n\nexport interface WatcherOptions {\n debounceMs?: number;\n onReady?: () => void;\n}\n\n/**\n * Create a file watcher with debounced rebuild callback\n *\n * @param files - Array of file paths to watch (use globby to expand first)\n * @param onRebuild - Callback when files change (receives changed file paths)\n * @param options - Configuration options\n */\nexport function createWatcher(\n files: string[],\n onRebuild: (changedFiles: string[]) => Promise<void>,\n options: WatcherOptions = {}\n): Watcher {\n const debounceMs = options.debounceMs ?? DEFAULT_DEBOUNCE_MS;\n\n let timeout: NodeJS.Timeout | null = null;\n let pending: Set<string> = new Set();\n let isRebuilding = false;\n\n const watcher: FSWatcher = chokidar.watch(files, {\n ignoreInitial: true, // Don't fire on startup - do full build first\n awaitWriteFinish: {\n stabilityThreshold: WRITE_STABILITY_THRESHOLD_MS,\n pollInterval: WRITE_STABILITY_POLL_MS,\n },\n });\n\n const triggerRebuild = async () => {\n if (isRebuilding) {\n // If already rebuilding, reschedule\n timeout = setTimeout(triggerRebuild, debounceMs);\n return;\n }\n\n const changedFiles = Array.from(pending);\n pending.clear();\n\n if (changedFiles.length === 0) return;\n\n isRebuilding = true;\n try {\n await onRebuild(changedFiles);\n } finally {\n isRebuilding = false;\n }\n };\n\n watcher.on('all', (event, filePath) => {\n if (event === 'add' || event === 'change' || event === 'unlink') {\n pending.add(filePath);\n\n if (timeout) clearTimeout(timeout);\n timeout = setTimeout(triggerRebuild, debounceMs);\n }\n });\n\n if (options.onReady) {\n watcher.on('ready', options.onReady);\n }\n\n watcher.on('error', (error: unknown) => {\n const message = error instanceof Error ? error.message : String(error);\n console.error('Watcher error:', message);\n });\n\n return {\n async close() {\n if (timeout) clearTimeout(timeout);\n await watcher.close();\n },\n };\n}\n","/**\n * Shared constants for react-agentic\n *\n * Centralized location for magic numbers and configuration values\n * used across multiple modules.\n */\n\n// ============================================================================\n// Root Element Tags\n// ============================================================================\n\n/**\n * Supported root element tags for document files\n */\nexport const SUPPORTED_ROOT_TAGS = ['Command', 'RuntimeCommand', 'Agent'] as const;\n\nexport type SupportedRootTag = (typeof SUPPORTED_ROOT_TAGS)[number];\n\n// ============================================================================\n// File Watcher Constants\n// ============================================================================\n\n/**\n * Default debounce time in milliseconds for file watcher\n */\nexport const DEFAULT_DEBOUNCE_MS = 200;\n\n/**\n * Time to wait for file writes to stabilize before triggering rebuild\n */\nexport const WRITE_STABILITY_THRESHOLD_MS = 100;\n\n/**\n * Poll interval for write stability detection\n */\nexport const WRITE_STABILITY_POLL_MS = 50;\n\n// ============================================================================\n// Exit Codes\n// ============================================================================\n\n/**\n * Standard exit codes for CLI operations\n */\nexport const EXIT_CODES = {\n /** Successful execution */\n SUCCESS: 0,\n /** User/validation error (bad arguments, conflicts) */\n VALIDATION_ERROR: 1,\n /** Build/compilation error */\n BUILD_ERROR: 1,\n} as const;\n\nexport type ExitCode = (typeof EXIT_CODES)[keyof typeof EXIT_CODES];\n\n// ============================================================================\n// Build Configuration\n// ============================================================================\n\n/**\n * Default output directory for generated markdown files\n */\nexport const DEFAULT_OUTPUT_DIR = '.claude/commands';\n\n/**\n * Default output directory for runtime bundles\n */\nexport const DEFAULT_RUNTIME_DIR = '.claude/runtime';\n\n/**\n * Default glob pattern for watch mode when no patterns provided\n */\nexport const DEFAULT_WATCH_PATTERN = 'src/app/**/*.tsx';\n","/**\n * Configuration loading and merging for react-agentic\n *\n * Priority (highest to lowest):\n * 1. CLI flags\n * 2. react-agentic.config.json\n * 3. Built-in defaults\n */\nimport { readFile } from 'fs/promises';\nimport { existsSync } from 'fs';\nimport path from 'path';\nimport { DEFAULT_OUTPUT_DIR, DEFAULT_RUNTIME_DIR } from '../constants.js';\n\n/**\n * Configuration options for react-agentic builds\n */\nexport interface ReactAgenticConfig {\n /** Output directory for markdown files (default: .claude/commands) */\n outputDir: string;\n /** Output directory for runtime bundles (default: .claude/runtime) */\n runtimeDir: string;\n /** Minify runtime bundles (default: false) */\n minify: boolean;\n /** Split runtime into per-namespace modules (default: false) */\n codeSplit: boolean;\n}\n\n/**\n * Built-in default configuration\n */\nexport const DEFAULT_CONFIG: ReactAgenticConfig = {\n outputDir: DEFAULT_OUTPUT_DIR,\n runtimeDir: DEFAULT_RUNTIME_DIR,\n minify: false,\n codeSplit: false,\n};\n\nconst CONFIG_FILENAME = 'react-agentic.config.json';\n\n/**\n * Load configuration from react-agentic.config.json if it exists\n * Returns partial config (only fields present in file)\n */\nexport async function loadConfigFile(cwd: string = process.cwd()): Promise<Partial<ReactAgenticConfig>> {\n const configPath = path.join(cwd, CONFIG_FILENAME);\n\n if (!existsSync(configPath)) {\n return {};\n }\n\n try {\n const content = await readFile(configPath, 'utf-8');\n const parsed = JSON.parse(content);\n\n // Validate and extract known fields only\n const config: Partial<ReactAgenticConfig> = {};\n\n if (typeof parsed.outputDir === 'string') {\n config.outputDir = parsed.outputDir;\n }\n if (typeof parsed.runtimeDir === 'string') {\n config.runtimeDir = parsed.runtimeDir;\n }\n if (typeof parsed.minify === 'boolean') {\n config.minify = parsed.minify;\n }\n if (typeof parsed.codeSplit === 'boolean') {\n config.codeSplit = parsed.codeSplit;\n }\n\n return config;\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to load ${CONFIG_FILENAME}: ${message}`);\n }\n}\n\n/**\n * CLI options that can override config\n */\nexport interface CLIConfigOverrides {\n out?: string;\n runtimeOut?: string;\n minify?: boolean;\n codeSplit?: boolean;\n}\n\n/**\n * Configuration validation errors\n */\nexport class ConfigValidationError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'ConfigValidationError';\n }\n}\n\n/**\n * Validate configuration for common issues\n *\n * Checks:\n * - Output directories are not the same (would cause conflicts)\n * - Paths don't contain problematic characters\n */\nfunction validateConfig(config: ReactAgenticConfig): void {\n // Normalize paths for comparison\n const normalizedOutput = path.normalize(config.outputDir);\n const normalizedRuntime = path.normalize(config.runtimeDir);\n\n // Check for output directory conflicts\n if (normalizedOutput === normalizedRuntime) {\n throw new ConfigValidationError(\n `outputDir and runtimeDir cannot be the same: ${config.outputDir}`\n );\n }\n\n // Check if one is a parent of the other (would cause nested writes)\n if (normalizedRuntime.startsWith(normalizedOutput + path.sep)) {\n throw new ConfigValidationError(\n `runtimeDir (${config.runtimeDir}) cannot be inside outputDir (${config.outputDir})`\n );\n }\n if (normalizedOutput.startsWith(normalizedRuntime + path.sep)) {\n throw new ConfigValidationError(\n `outputDir (${config.outputDir}) cannot be inside runtimeDir (${config.runtimeDir})`\n );\n }\n}\n\n/**\n * Derive runtime directory from output directory\n * Replaces 'commands' with 'runtime' in the path\n */\nfunction deriveRuntimeDir(outputDir: string): string {\n // If outputDir contains 'commands', replace with 'runtime'\n if (outputDir.includes('commands')) {\n return outputDir.replace(/commands/g, 'runtime');\n }\n // Otherwise, use sibling 'runtime' directory\n return path.join(path.dirname(outputDir), 'runtime');\n}\n\n/**\n * Resolve final configuration by merging:\n * defaults → config file → CLI flags\n *\n * When --out is specified but --runtime-out is not, the runtime directory\n * is derived from the output directory (replacing 'commands' with 'runtime').\n *\n * @throws {ConfigValidationError} if configuration is invalid\n */\nexport async function resolveConfig(\n cliOptions: CLIConfigOverrides,\n cwd: string = process.cwd()\n): Promise<ReactAgenticConfig> {\n // Load config file (if exists)\n const fileConfig = await loadConfigFile(cwd);\n\n // Resolve output directory first\n const outputDir = cliOptions.out ?? fileConfig.outputDir ?? DEFAULT_CONFIG.outputDir;\n\n // Resolve runtime directory:\n // 1. Explicit CLI flag takes precedence\n // 2. Config file setting\n // 3. If --out was specified, derive from it\n // 4. Fall back to default\n let runtimeDir: string;\n if (cliOptions.runtimeOut) {\n runtimeDir = cliOptions.runtimeOut;\n } else if (fileConfig.runtimeDir) {\n runtimeDir = fileConfig.runtimeDir;\n } else if (cliOptions.out) {\n // Derive from custom output directory\n runtimeDir = deriveRuntimeDir(outputDir);\n } else {\n runtimeDir = DEFAULT_CONFIG.runtimeDir;\n }\n\n const config: ReactAgenticConfig = {\n outputDir,\n runtimeDir,\n minify: cliOptions.minify ?? fileConfig.minify ?? DEFAULT_CONFIG.minify,\n codeSplit: cliOptions.codeSplit ?? fileConfig.codeSplit ?? DEFAULT_CONFIG.codeSplit,\n };\n\n // Validate the merged config\n validateConfig(config);\n\n return config;\n}\n"],"mappings":";;;;;;;;;;;;;AACA,SAAS,WAAAA,gBAAe;AACxB,SAAS,YAAAC,iBAAgB;AACzB,SAAS,qBAAqB;AAC9B,OAAOC,WAAU;;;ACIjB;AALA,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,WAAW,aAAa;AACjC,OAAOC,WAAU;;;ACHjB,OAAO,QAAQ;AAMR,SAAS,WAAW,WAAmB,YAA0B;AACtE,UAAQ,IAAI,GAAG,GAAG,MAAM,QAAG,CAAC,IAAI,GAAG,IAAI,SAAS,CAAC,WAAM,GAAG,KAAK,UAAU,CAAC,EAAE;AAC9E;AAKO,SAAS,SAAS,WAAmB,SAAuB;AACjE,UAAQ,MAAM,GAAG,GAAG,IAAI,QAAG,CAAC,IAAI,GAAG,IAAI,SAAS,CAAC,KAAK,OAAO,EAAE;AACjE;AAKO,SAAS,QAAQ,SAAuB;AAC7C,UAAQ,IAAI,GAAG,IAAI,OAAO,CAAC;AAC7B;AAKO,SAAS,WAAW,cAAsB,YAA0B;AACzE,UAAQ,IAAI,EAAE;AACd,MAAI,eAAe,GAAG;AACpB,YAAQ,IAAI,GAAG,MAAM,SAAS,YAAY,uBAAuB,CAAC;AAAA,EACpE,OAAO;AACL,YAAQ;AAAA,MACN,GAAG,OAAO,SAAS,YAAY,iBAAiB,GAAG,IAAI,OAAO,UAAU,CAAC,CAAC,WAAW;AAAA,IACvF;AAAA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AAGpD,iBAAW,QAAQ,cAAc;AAC/B,cAAM,WAAW,QAAQ,cAAc,IAAI;AAC3C,YAAI,UAAU;AACZ,kBAAQ,iBAAiB,QAAQ;AAAA,QACnC;AAAA,MACF;AAEA,YAAM,SAAS,UAAU,SAAS,SAAS,IAAI;AAAA,IACjD,CAAC;AAGD,UAAM,WAAW,YAAY;AAC3B,cAAQ,IAAI,qBAAqB;AACjC,YAAM,QAAQ,MAAM;AACpB,cAAQ,KAAK,WAAW,OAAO;AAAA,IACjC;AAEA,YAAQ,GAAG,UAAU,QAAQ;AAC7B,YAAQ,GAAG,WAAW,QAAQ;AAG9B;AAAA,EACF;AAGA,UAAQ,SAAS,SAAS,MAAM;AAAA,CAAuB;AACvD,QAAM,EAAE,WAAW,IAAI,MAAM,SAAS,UAAU,SAAS,SAAS,KAAK;AAGvE,MAAI,aAAa,GAAG;AAClB,YAAQ,KAAK,WAAW,WAAW;AAAA,EACrC;AACF,CAAC;;;AD5UH,eAAe,OAAO;AAEpB,QAAM,YAAYC,MAAK,QAAQ,cAAc,YAAY,GAAG,CAAC;AAC7D,QAAM,UAAUA,MAAK,QAAQ,WAAW,oBAAoB;AAC5D,QAAM,MAAM,KAAK,MAAM,MAAMC,UAAS,SAAS,OAAO,CAAC;AAEvD,QAAM,UAAU,IAAIC,SAAQ;AAE5B,UACG,KAAK,eAAe,EACpB,YAAY,8CAA8C,EAC1D,QAAQ,IAAI,OAAO;AAEtB,UAAQ,WAAW,YAAY;AAE/B,UAAQ,MAAM;AAChB;AAEA,KAAK,EAAE,MAAM,CAAC,QAAQ;AACpB,UAAQ,MAAM,IAAI,OAAO;AACzB,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["Command","readFile","path","path","path","path","readFile","Command"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-agentic",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Compile-time safety for Claude Code commands - malformed commands fail at build time, not runtime",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -77,4 +77,4 @@
77
77
  "typescript": "^5.9.3",
78
78
  "vitest": "^4.0.17"
79
79
  }
80
- }
80
+ }