@ncoderz/awa 0.2.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// src/_generated/package_info.ts
|
|
7
7
|
var PACKAGE_INFO = {
|
|
8
8
|
"name": "@ncoderz/awa",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "1.0.0",
|
|
10
10
|
"author": "Richard Sewell <richard.sewell@ncoderz.com>",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"description": "awa is an Agent Workflow for AIs. It is also a CLI tool to powerfully manage agent workflow files using templates."
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/index.ts","../src/_generated/package_info.ts","../src/commands/diff.ts","../src/core/config.ts","../src/types/index.ts","../src/utils/fs.ts","../src/utils/logger.ts","../src/core/differ.ts","../src/core/delete-list.ts","../src/core/generator.ts","../src/core/resolver.ts","../src/core/template.ts","../src/core/feature-resolver.ts","../src/core/template-resolver.ts","../src/commands/generate.ts"],"sourcesContent":["// @awa-component: CLI-ArgumentParser\n// @awa-impl: CLI-1_AC-1\n// @awa-impl: CLI-1_AC-2\n// @awa-impl: CLI-1_AC-3\n// @awa-impl: CLI-1_AC-4\n// @awa-impl: CLI-1_AC-5\n// @awa-impl: CLI-2_AC-1\n// @awa-impl: CLI-2_AC-2\n// @awa-impl: CLI-2_AC-3\n// @awa-impl: CLI-2_AC-5\n// @awa-impl: CLI-2_AC-6\n// @awa-impl: CLI-3_AC-1\n// @awa-impl: CLI-4_AC-1\n// @awa-impl: CLI-4_AC-2\n// @awa-impl: CLI-5_AC-1\n// @awa-impl: CLI-6_AC-1\n// @awa-impl: CLI-7_AC-1\n// @awa-impl: CLI-8_AC-1\n// @awa-impl: CLI-9_AC-1\n// @awa-impl: CLI-9_AC-2\n// @awa-impl: CLI-9_AC-3\n// @awa-impl: CLI-10_AC-1\n// @awa-impl: CLI-10_AC-2\n// @awa-impl: CLI-11_AC-1\n// @awa-impl: CLI-11_AC-2\n// @awa-impl: CLI-11_AC-3\n// @awa-impl: CFG-5_AC-2\n// @awa-impl: DIFF-7_AC-1\n// @awa-impl: DIFF-7_AC-2\n// @awa-impl: DIFF-7_AC-3\n// @awa-impl: DIFF-7_AC-4\n// @awa-impl: DIFF-7_AC-5\n// @awa-impl: DIFF-7_AC-6\n// @awa-impl: DIFF-7_AC-7\n// @awa-impl: DIFF-7_AC-8\n// @awa-impl: DIFF-7_AC-9\n// @awa-impl: DIFF-7_AC-10\n// @awa-impl: DIFF-7_AC-11\n// @awa-impl: FP-2_AC-1\n// @awa-impl: FP-2_AC-2\n// @awa-impl: FP-2_AC-4\n// @awa-impl: FP-4_AC-1\n// @awa-impl: FP-4_AC-2\n// @awa-impl: FP-4_AC-3\n// @awa-impl: FP-4_AC-5\n// @awa-impl: GEN-10_AC-1\n// @awa-impl: GEN-10_AC-2\n\nimport { Command } from 'commander';\nimport { PACKAGE_INFO } from '../_generated/package_info.js';\nimport { diffCommand } from '../commands/diff.js';\nimport { generateCommand } from '../commands/generate.js';\nimport type { RawCliOptions } from '../types/index.js';\n\nconst version = PACKAGE_INFO.version;\n\n// @awa-impl: CLI-1_AC-2, CLI-9_AC-1, CLI-9_AC-2, CLI-9_AC-3, CLI-10_AC-1, CLI-10_AC-2\nconst program = new Command();\n\nprogram\n .name('awa')\n .description('awa - tool for generating AI coding agent configuration files')\n .version(version, '-v, --version', 'Display version number');\n\n// @awa-impl: CLI-1_AC-1, CLI-1_AC-2, CLI-1_AC-3, CLI-1_AC-4, CLI-1_AC-5\nprogram\n .command('generate')\n .description('Generate AI agent configuration files from templates')\n // @awa-impl: CLI-2_AC-1, CLI-2_AC-5, CLI-2_AC-6\n .argument('[output]', 'Output directory (optional if specified in config)')\n // @awa-impl: CLI-3_AC-1\n .option('-t, --template <source>', 'Template source (local path or Git repository)')\n // @awa-impl: CLI-4_AC-1, CLI-4_AC-2\n .option('-f, --features <flag...>', 'Feature flags (can be specified multiple times)')\n .option('--preset <name...>', 'Preset names to enable (can be specified multiple times)')\n .option(\n '--remove-features <flag...>',\n 'Feature flags to remove (can be specified multiple times)'\n )\n // @awa-impl: CLI-5_AC-1\n .option('--force', 'Force overwrite existing files without prompting', false)\n // @awa-impl: CLI-6_AC-1\n .option('--dry-run', 'Preview changes without modifying files', false)\n .option(\n '--delete',\n 'Enable deletion of files listed in the delete list (default: warn only)',\n false\n )\n // @awa-impl: CLI-7_AC-1\n .option('-c, --config <path>', 'Path to configuration file')\n // @awa-impl: CLI-8_AC-1\n .option('--refresh', 'Force refresh of cached Git templates', false)\n .action(async (output: string | undefined, options) => {\n // @awa-impl: CLI-11_AC-1, CLI-11_AC-2, CLI-11_AC-3\n const cliOptions: RawCliOptions = {\n output,\n template: options.template,\n features: options.features || [],\n preset: options.preset || [],\n removeFeatures: options.removeFeatures || [],\n force: options.force,\n dryRun: options.dryRun,\n delete: options.delete,\n config: options.config,\n refresh: options.refresh,\n };\n\n await generateCommand(cliOptions);\n });\n\n// @awa-impl: DIFF-7_AC-1, DIFF-7_AC-2, DIFF-7_AC-3, DIFF-7_AC-4, DIFF-7_AC-5, DIFF-7_AC-6, DIFF-7_AC-7, DIFF-7_AC-8, DIFF-7_AC-9, DIFF-7_AC-10\nprogram\n .command('diff')\n .description('Compare template output with existing target directory')\n // @awa-impl: DIFF-7_AC-1, DIFF-7_AC-2, DIFF-7_AC-3, DIFF-7_AC-4, DIFF-7_AC-5\n .argument('[target]', 'Target directory to compare against (optional if specified in config)')\n // @awa-impl: DIFF-7_AC-6\n .option('-t, --template <source>', 'Template source (local path or Git repository)')\n // @awa-impl: DIFF-7_AC-7\n .option('-f, --features <flag...>', 'Feature flags (can be specified multiple times)')\n .option('--preset <name...>', 'Preset names to enable (can be specified multiple times)')\n .option(\n '--remove-features <flag...>',\n 'Feature flags to remove (can be specified multiple times)'\n )\n // @awa-impl: DIFF-7_AC-8\n .option('-c, --config <path>', 'Path to configuration file')\n // @awa-impl: DIFF-7_AC-9\n .option('--refresh', 'Force refresh of cached Git templates', false)\n // @awa-impl: DIFF-7_AC-11\n .option('--list-unknown', 'Include target-only files in diff results', false)\n // @awa-impl: DIFF-7_AC-10 - Note: --force and --dry-run are intentionally NOT accepted for diff command\n .action(async (target: string | undefined, options) => {\n const cliOptions: RawCliOptions = {\n output: target, // Use target as output for consistency\n template: options.template,\n features: options.features || [],\n preset: options.preset || [],\n removeFeatures: options.removeFeatures || [],\n config: options.config,\n refresh: options.refresh,\n listUnknown: options.listUnknown,\n };\n\n const exitCode = await diffCommand(cliOptions);\n process.exit(exitCode);\n });\n\n// @awa-impl: GEN-10_AC-1, GEN-10_AC-2\nprogram.parse();\n","// This file is automatically generated. DO NOT EDIT.\n\n/* eslint-disable */\n\nexport const PACKAGE_INFO = {\n \"name\": \"@ncoderz/awa\",\n \"version\": \"0.2.0\",\n \"author\": \"Richard Sewell <richard.sewell@ncoderz.com>\",\n \"license\": \"MIT\",\n \"description\": \"awa is an Agent Workflow for AIs. It is also a CLI tool to powerfully manage agent workflow files using templates.\"\n};\n","// @awa-component: DIFF-DiffCommand\n// @awa-impl: DIFF-5_AC-1\n// @awa-impl: DIFF-5_AC-2\n// @awa-impl: DIFF-5_AC-3\n\nimport { intro, outro } from '@clack/prompts';\nimport { configLoader } from '../core/config.js';\nimport { diffEngine } from '../core/differ.js';\nimport { featureResolver } from '../core/feature-resolver.js';\nimport { templateResolver } from '../core/template-resolver.js';\nimport { DiffError, type RawCliOptions } from '../types/index.js';\nimport { pathExists } from '../utils/fs.js';\nimport { logger } from '../utils/logger.js';\n\nexport async function diffCommand(cliOptions: RawCliOptions): Promise<number> {\n try {\n intro('awa CLI - Template Diff');\n\n // Load configuration file\n const fileConfig = await configLoader.load(cliOptions.config ?? null);\n\n // Merge CLI and file config\n const options = configLoader.merge(cliOptions, fileConfig);\n\n // Validate target directory exists (now from options.output)\n if (!(await pathExists(options.output))) {\n throw new DiffError(`Target directory does not exist: ${options.output}`);\n }\n\n const targetPath = options.output;\n\n // Resolve template source\n const template = await templateResolver.resolve(options.template, options.refresh);\n\n const features = featureResolver.resolve({\n baseFeatures: [...options.features],\n presetNames: [...options.preset],\n removeFeatures: [...options.removeFeatures],\n presetDefinitions: options.presets,\n });\n\n // Perform diff\n const result = await diffEngine.diff({\n templatePath: template.localPath,\n targetPath,\n features,\n listUnknown: options.listUnknown,\n });\n\n // Display diff output\n for (const file of result.files) {\n switch (file.status) {\n case 'modified':\n logger.info(`Modified: ${file.relativePath}`);\n if (file.unifiedDiff) {\n // Parse and display unified diff with colors\n const lines = file.unifiedDiff.split('\\n');\n for (const line of lines) {\n if (\n line.startsWith('diff --git') ||\n line.startsWith('index ') ||\n line.startsWith('--- ') ||\n line.startsWith('+++ ')\n ) {\n logger.diffLine(line, 'context');\n } else if (line.startsWith('+')) {\n logger.diffLine(line, 'add');\n } else if (line.startsWith('-')) {\n logger.diffLine(line, 'remove');\n } else if (line.startsWith('@@')) {\n logger.diffLine(line, 'context');\n } else {\n logger.diffLine(line, 'context');\n }\n }\n }\n break;\n case 'new':\n logger.info(`New file: ${file.relativePath}`);\n break;\n case 'extra':\n logger.warn(`Extra file (not in template): ${file.relativePath}`);\n break;\n case 'binary-differs':\n logger.warn(`binary files differ: ${file.relativePath}`);\n break;\n case 'delete-listed':\n logger.warn(`Delete listed: ${file.relativePath}`);\n break;\n case 'identical':\n // Skip identical files from output\n break;\n }\n }\n\n // Display summary\n logger.diffSummary(result);\n\n outro('Diff complete!');\n\n // @awa-impl: DIFF-5_AC-1, DIFF-5_AC-2\n return result.hasDifferences ? 1 : 0;\n } catch (error) {\n if (error instanceof Error) {\n logger.error(error.message);\n } else {\n logger.error(String(error));\n }\n\n // @awa-impl: DIFF-5_AC-3\n return 2;\n }\n}\n","// @awa-component: CFG-ConfigLoader\n// @awa-impl: CFG-1_AC-1\n// @awa-impl: CFG-1_AC-2\n// @awa-impl: CFG-1_AC-3\n// @awa-impl: CFG-1_AC-4\n// @awa-impl: CFG-2_AC-1\n// @awa-impl: CFG-2_AC-2\n// @awa-impl: CFG-2_AC-3\n// @awa-impl: CFG-3_AC-1\n// @awa-impl: CFG-3_AC-2\n// @awa-impl: CFG-3_AC-3\n// @awa-impl: CFG-3_AC-4\n// @awa-impl: CFG-3_AC-5\n// @awa-impl: CFG-3_AC-6\n// @awa-impl: CFG-4_AC-1\n// @awa-impl: CFG-4_AC-2\n// @awa-impl: CFG-4_AC-3\n// @awa-impl: CFG-4_AC-4\n// @awa-impl: CFG-5_AC-1\n// @awa-impl: CFG-6_AC-1\n// @awa-impl: CFG-6_AC-2\n// @awa-impl: CLI-1_AC-4\n// @awa-impl: CLI-2_AC-2\n// @awa-impl: CLI-2_AC-3\n// @awa-impl: CLI-2_AC-4\n// @awa-impl: CLI-4_AC-3\n// @awa-impl: CLI-7_AC-2\n\nimport { parse } from 'smol-toml';\nimport {\n ConfigError,\n type FileConfig,\n type PresetDefinitions,\n type RawCliOptions,\n type ResolvedOptions,\n} from '../types/index.js';\nimport { pathExists, readTextFile } from '../utils/fs.js';\nimport { logger } from '../utils/logger.js';\n\nconst DEFAULT_CONFIG_PATH = '.awa.toml';\n\nexport class ConfigLoader {\n // @awa-impl: CFG-1_AC-1, CFG-1_AC-2, CFG-1_AC-3, CFG-1_AC-4\n async load(configPath: string | null): Promise<FileConfig | null> {\n const pathToLoad = configPath ?? DEFAULT_CONFIG_PATH;\n\n // Check if file exists\n const exists = await pathExists(pathToLoad);\n\n // If explicit path provided but doesn't exist, error\n if (configPath && !exists) {\n throw new ConfigError(\n `Configuration file not found: ${configPath}`,\n 'FILE_NOT_FOUND',\n configPath\n );\n }\n\n // If default path doesn't exist, return null (no error)\n if (!configPath && !exists) {\n return null;\n }\n\n // Read and parse TOML\n try {\n const content = await readTextFile(pathToLoad);\n const parsed = parse(content) as Record<string, unknown>;\n\n // Validate and extract known options\n const config: FileConfig = {};\n\n if (parsed.output !== undefined) {\n if (typeof parsed.output !== 'string') {\n throw new ConfigError(\n `Invalid type for 'output': expected string, got ${typeof parsed.output}`,\n 'INVALID_TYPE',\n pathToLoad\n );\n }\n config.output = parsed.output;\n }\n\n if (parsed.template !== undefined) {\n if (typeof parsed.template !== 'string') {\n throw new ConfigError(\n `Invalid type for 'template': expected string, got ${typeof parsed.template}`,\n 'INVALID_TYPE',\n pathToLoad\n );\n }\n config.template = parsed.template;\n }\n\n if (parsed.features !== undefined) {\n if (\n !Array.isArray(parsed.features) ||\n !parsed.features.every((f) => typeof f === 'string')\n ) {\n throw new ConfigError(\n `Invalid type for 'features': expected array of strings`,\n 'INVALID_TYPE',\n pathToLoad\n );\n }\n config.features = parsed.features;\n }\n\n if (parsed.preset !== undefined) {\n if (!Array.isArray(parsed.preset) || !parsed.preset.every((p) => typeof p === 'string')) {\n throw new ConfigError(\n `Invalid type for 'preset': expected array of strings`,\n 'INVALID_TYPE',\n pathToLoad\n );\n }\n config.preset = parsed.preset;\n }\n\n if (parsed['remove-features'] !== undefined) {\n if (\n !Array.isArray(parsed['remove-features']) ||\n !parsed['remove-features'].every((f) => typeof f === 'string')\n ) {\n throw new ConfigError(\n `Invalid type for 'remove-features': expected array of strings`,\n 'INVALID_TYPE',\n pathToLoad\n );\n }\n config['remove-features'] = parsed['remove-features'];\n }\n\n if (parsed.force !== undefined) {\n if (typeof parsed.force !== 'boolean') {\n throw new ConfigError(\n `Invalid type for 'force': expected boolean, got ${typeof parsed.force}`,\n 'INVALID_TYPE',\n pathToLoad\n );\n }\n config.force = parsed.force;\n }\n\n if (parsed['dry-run'] !== undefined) {\n if (typeof parsed['dry-run'] !== 'boolean') {\n throw new ConfigError(\n `Invalid type for 'dry-run': expected boolean, got ${typeof parsed['dry-run']}`,\n 'INVALID_TYPE',\n pathToLoad\n );\n }\n config['dry-run'] = parsed['dry-run'];\n }\n\n if (parsed.delete !== undefined) {\n if (typeof parsed.delete !== 'boolean') {\n throw new ConfigError(\n `Invalid type for 'delete': expected boolean, got ${typeof parsed.delete}`,\n 'INVALID_TYPE',\n pathToLoad\n );\n }\n config.delete = parsed.delete;\n }\n\n if (parsed.refresh !== undefined) {\n if (typeof parsed.refresh !== 'boolean') {\n throw new ConfigError(\n `Invalid type for 'refresh': expected boolean, got ${typeof parsed.refresh}`,\n 'INVALID_TYPE',\n pathToLoad\n );\n }\n config.refresh = parsed.refresh;\n }\n\n if (parsed.presets !== undefined) {\n if (\n parsed.presets === null ||\n typeof parsed.presets !== 'object' ||\n Array.isArray(parsed.presets)\n ) {\n throw new ConfigError(\n `Invalid type for 'presets': expected table of string arrays`,\n 'INVALID_PRESET',\n pathToLoad\n );\n }\n\n const defs: PresetDefinitions = {};\n for (const [presetName, value] of Object.entries(\n parsed.presets as Record<string, unknown>\n )) {\n if (!Array.isArray(value) || !value.every((v) => typeof v === 'string')) {\n throw new ConfigError(\n `Invalid preset '${presetName}': expected array of strings`,\n 'INVALID_PRESET',\n pathToLoad\n );\n }\n defs[presetName] = value as string[];\n }\n\n config.presets = defs;\n }\n\n if (parsed['list-unknown'] !== undefined) {\n if (typeof parsed['list-unknown'] !== 'boolean') {\n throw new ConfigError(\n `Invalid type for 'list-unknown': expected boolean, got ${typeof parsed['list-unknown']}`,\n 'INVALID_TYPE',\n pathToLoad\n );\n }\n config['list-unknown'] = parsed['list-unknown'];\n }\n\n // Warn about unknown options\n const knownKeys = new Set([\n 'output',\n 'template',\n 'features',\n 'preset',\n 'remove-features',\n 'presets',\n 'force',\n 'dry-run',\n 'delete',\n 'refresh',\n 'list-unknown',\n ]);\n for (const key of Object.keys(parsed)) {\n if (!knownKeys.has(key)) {\n logger.warn(`Unknown configuration option: '${key}'`);\n }\n }\n\n return config;\n } catch (error) {\n if (error instanceof ConfigError) {\n throw error;\n }\n\n // TOML parsing error\n throw new ConfigError(\n `Failed to parse TOML configuration: ${error instanceof Error ? error.message : String(error)}`,\n 'PARSE_ERROR',\n pathToLoad\n );\n }\n }\n\n // @awa-impl: CFG-4_AC-1, CFG-4_AC-2, CFG-4_AC-3, CFG-4_AC-4\n // @awa-impl: CLI-2_AC-2, CLI-2_AC-3, CLI-2_AC-4\n merge(cli: RawCliOptions, file: FileConfig | null): ResolvedOptions {\n // CLI arguments override file config values\n // Output can come from CLI (positional argument) or config file\n\n // @awa-impl: CLI-2_AC-2, CLI-2_AC-3\n const output = cli.output ?? file?.output;\n\n // @awa-impl: CLI-1_AC-4, CLI-2_AC-4\n if (!output) {\n throw new ConfigError(\n 'Output directory is required. Provide it as a positional argument or in the config file.',\n 'MISSING_OUTPUT',\n null\n );\n }\n\n const template = cli.template ?? file?.template ?? null;\n\n // Features: CLI completely replaces config (no merge)\n const features = cli.features ?? file?.features ?? [];\n\n const preset = cli.preset ?? file?.preset ?? [];\n const removeFeatures = cli.removeFeatures ?? file?.['remove-features'] ?? [];\n const presets = file?.presets ?? {};\n\n const force = cli.force ?? file?.force ?? false;\n const dryRun = cli.dryRun ?? file?.['dry-run'] ?? false;\n const enableDelete = cli.delete ?? file?.delete ?? false;\n const refresh = cli.refresh ?? file?.refresh ?? false;\n const listUnknown = cli.listUnknown ?? file?.['list-unknown'] ?? false;\n\n return {\n output,\n template,\n features,\n preset,\n removeFeatures,\n force,\n dryRun,\n delete: enableDelete,\n refresh,\n presets,\n listUnknown,\n };\n }\n}\n\nexport const configLoader = new ConfigLoader();\n","// @awa-component: Types-CoreDefinitions\n\n// Custom error classes for diff operations\nexport class DiffError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'DiffError';\n }\n}\n\n// RawCliOptions - CLI argument parser output\nexport interface RawCliOptions {\n output?: string; // Optional positional argument (required if not in config)\n template?: string;\n features?: string[];\n preset?: string[];\n removeFeatures?: string[];\n force?: boolean;\n dryRun?: boolean;\n delete?: boolean;\n config?: string;\n refresh?: boolean;\n listUnknown?: boolean;\n}\n\n// PresetDefinitions - Named feature bundles\nexport interface PresetDefinitions {\n [presetName: string]: string[];\n}\n\n// FileConfig - TOML configuration file structure\nexport interface FileConfig {\n output?: string;\n template?: string;\n features?: string[];\n preset?: string[];\n 'remove-features'?: string[];\n force?: boolean;\n 'dry-run'?: boolean;\n delete?: boolean;\n refresh?: boolean;\n presets?: PresetDefinitions;\n 'list-unknown'?: boolean;\n}\n\n// ResolvedOptions - Fully resolved configuration with defaults applied\nexport interface ResolvedOptions {\n readonly output: string;\n readonly template: string | null;\n readonly features: readonly string[];\n readonly preset: readonly string[];\n readonly removeFeatures: readonly string[];\n readonly force: boolean;\n readonly dryRun: boolean;\n readonly delete: boolean;\n readonly refresh: boolean;\n readonly presets: PresetDefinitions;\n readonly listUnknown: boolean;\n}\n\n// TemplateSourceType - Template source type detection\nexport type TemplateSourceType = 'local' | 'git' | 'bundled';\n\n// ResolvedTemplate - Template source resolution result\nexport interface ResolvedTemplate {\n type: TemplateSourceType;\n localPath: string;\n source: string;\n}\n\n// TemplateContext - Context passed to template engine\nexport interface TemplateContext {\n features: string[];\n}\n\n// RenderResult - Template rendering output\nexport interface RenderResult {\n content: string;\n isEmpty: boolean;\n isEmptyFileMarker: boolean;\n}\n\n// FileAction - Tagged union for file operations\nexport type FileAction =\n | { type: 'create'; sourcePath: string; outputPath: string }\n | { type: 'overwrite'; sourcePath: string; outputPath: string }\n | { type: 'skip-user'; sourcePath: string; outputPath: string }\n | { type: 'skip-empty'; sourcePath: string; outputPath: string }\n | { type: 'skip-equal'; sourcePath: string; outputPath: string }\n | { type: 'delete'; outputPath: string };\n\n// GenerationResult - Aggregated generation outcome\nexport interface GenerationResult {\n readonly actions: readonly FileAction[];\n readonly created: number;\n readonly overwritten: number;\n readonly deleted: number;\n readonly skipped: number;\n readonly skippedEmpty: number;\n readonly skippedUser: number;\n readonly skippedEqual: number;\n}\n\n// GenerateOptions - File generation parameters\nexport interface GenerateOptions {\n templatePath: string;\n outputPath: string;\n features: string[];\n force: boolean;\n dryRun: boolean;\n delete: boolean;\n}\n\n// ConflictChoice - User choice for conflict resolution\nexport type ConflictChoice = 'overwrite' | 'skip';\n\n// ConflictItem - Individual file conflict for batch resolution\nexport interface ConflictItem {\n outputPath: string;\n sourcePath: string;\n newContent: string;\n existingContent: string;\n}\n\n// BatchConflictResolution - Result of batch conflict resolution\nexport interface BatchConflictResolution {\n overwrite: string[]; // List of output paths to overwrite\n skip: string[]; // List of output paths to skip\n equal: string[]; // List of output paths skipped because content is identical\n}\n\n// TemplateFile - Template file metadata\nexport interface TemplateFile {\n path: string;\n absolutePath: string;\n isPartial: boolean;\n}\n\n// DiffOptions - Diff operation parameters\nexport interface DiffOptions {\n templatePath: string;\n targetPath: string;\n features: string[];\n listUnknown: boolean;\n}\n\n// FileDiffStatus - File comparison status\nexport type FileDiffStatus =\n | 'identical'\n | 'modified'\n | 'new'\n | 'extra'\n | 'binary-differs'\n | 'delete-listed';\n\n// FileDiff - Comparison result for a single file\nexport interface FileDiff {\n relativePath: string;\n status: FileDiffStatus;\n unifiedDiff?: string; // Present only for 'modified' text files\n}\n\n// DiffResult - Aggregated diff outcome\nexport interface DiffResult {\n files: FileDiff[];\n identical: number;\n modified: number;\n newFiles: number;\n extraFiles: number;\n binaryDiffers: number;\n deleteListed: number;\n hasDifferences: boolean;\n}\n\n// CachedTemplate - Cached Git template metadata\nexport interface CachedTemplate {\n source: string;\n localPath: string;\n fetchedAt: Date;\n ref?: string;\n}\n\n// Custom error types\nexport class ConfigError extends Error {\n constructor(\n message: string,\n public code:\n | 'FILE_NOT_FOUND'\n | 'PARSE_ERROR'\n | 'INVALID_TYPE'\n | 'MISSING_OUTPUT'\n | 'INVALID_PRESET'\n | 'UNKNOWN_PRESET',\n public filePath?: string | null\n ) {\n super(message);\n this.name = 'ConfigError';\n }\n}\n\nexport class TemplateError extends Error {\n constructor(\n message: string,\n public code: 'SOURCE_NOT_FOUND' | 'FETCH_FAILED' | 'RENDER_ERROR',\n public source?: string\n ) {\n super(message);\n this.name = 'TemplateError';\n }\n}\n\nexport class GenerationError extends Error {\n constructor(\n message: string,\n public code: 'PERMISSION_DENIED' | 'DISK_FULL'\n ) {\n super(message);\n this.name = 'GenerationError';\n }\n}\n","// @awa-component: Utils-FileSystem\n\nimport { mkdir, readdir, readFile, rm, stat, writeFile } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nexport async function ensureDir(dirPath: string): Promise<void> {\n await mkdir(dirPath, { recursive: true });\n}\n\nexport async function pathExists(path: string): Promise<boolean> {\n try {\n await stat(path);\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function isDirectory(path: string): Promise<boolean> {\n try {\n const stats = await stat(path);\n return stats.isDirectory();\n } catch {\n return false;\n }\n}\n\nexport async function readTextFile(path: string): Promise<string> {\n return readFile(path, 'utf-8');\n}\n\nexport async function readBinaryFile(path: string): Promise<Buffer> {\n return readFile(path);\n}\n\nexport async function writeTextFile(path: string, content: string): Promise<void> {\n await ensureDir(dirname(path));\n await writeFile(path, content, 'utf-8');\n}\n\nexport async function* walkDirectory(dir: string): AsyncGenerator<string> {\n const entries = await readdir(dir, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = join(dir, entry.name);\n\n if (entry.isDirectory()) {\n // Skip directories starting with underscore\n if (entry.name.startsWith('_')) {\n continue;\n }\n yield* walkDirectory(fullPath);\n } else if (entry.isFile()) {\n // Skip files starting with underscore\n if (entry.name.startsWith('_')) {\n continue;\n }\n yield fullPath;\n }\n }\n}\n\nexport function getCacheDir(): string {\n return join(homedir(), '.cache', 'awa', 'templates');\n}\n\nexport function getTemplateDir(): string {\n // In built dist, we need to go up from dist/index.js to project root\n // In development, we're in src/utils/fs.ts\n const currentFile = fileURLToPath(import.meta.url);\n const currentDir = dirname(currentFile);\n\n // Check if we're in dist/ or src/\n if (currentDir.includes('/dist')) {\n // In dist: go up one level to project root\n return join(dirname(currentDir), 'templates');\n }\n\n // In src: go up two levels to project root\n return join(currentDir, '..', '..', 'templates');\n}\n\nexport async function rmDir(dirPath: string): Promise<void> {\n await rm(dirPath, { recursive: true, force: true });\n}\n\nexport async function deleteFile(filePath: string): Promise<void> {\n await rm(filePath, { force: true });\n}\n","// @awa-component: GEN-Logger\n// @awa-impl: CLI-6_AC-3\n// @awa-impl: GEN-6_AC-4\n// @awa-impl: GEN-7_AC-1\n// @awa-impl: GEN-7_AC-2\n// @awa-impl: GEN-7_AC-3\n// @awa-impl: GEN-7_AC-4\n// @awa-impl: GEN-9_AC-1\n// @awa-impl: GEN-9_AC-2\n// @awa-impl: GEN-9_AC-3\n// @awa-impl: GEN-9_AC-4\n// @awa-impl: GEN-9_AC-5\n// @awa-impl: GEN-9_AC-6\n// @awa-impl: GEN-11_AC-1\n// @awa-impl: GEN-11_AC-2\n// @awa-impl: GEN-11_AC-4\n// @awa-impl: TPL-7_AC-3\n\nimport chalk from 'chalk';\nimport type { DiffResult, FileAction, GenerationResult } from '../types/index.js';\n\nexport class Logger {\n info(message: string): void {\n console.log(chalk.blue('ℹ'), message);\n }\n\n success(message: string): void {\n console.log(chalk.green('✔'), message);\n }\n\n warn(message: string): void {\n console.warn(chalk.yellow('⚠'), message);\n }\n\n error(message: string): void {\n console.error(chalk.red('✖'), message);\n }\n\n fileAction(action: FileAction): void {\n const { type, outputPath } = action;\n\n switch (type) {\n case 'create':\n console.log(chalk.green(' + '), chalk.dim(outputPath));\n break;\n case 'overwrite':\n console.log(chalk.yellow(' ~ '), chalk.dim(outputPath));\n break;\n case 'skip-user':\n console.log(chalk.blue(' - '), chalk.dim(outputPath), chalk.dim('(skipped)'));\n break;\n case 'skip-empty':\n console.log(chalk.dim(' · '), chalk.dim(outputPath), chalk.dim('(empty)'));\n break;\n case 'skip-equal':\n console.log(chalk.dim(' = '), chalk.dim(outputPath), chalk.dim('(unchanged)'));\n break;\n case 'delete':\n console.log(chalk.red(' ✖ '), chalk.dim(outputPath), chalk.red('(deleted)'));\n break;\n }\n }\n\n // @awa-impl: GEN-9_AC-1, GEN-9_AC-2, GEN-9_AC-3, GEN-9_AC-4, GEN-9_AC-5, GEN-9_AC-6\n summary(result: GenerationResult): void {\n console.log('');\n console.log(chalk.bold('Summary:'));\n\n // @awa-impl: GEN-9_AC-6\n // Check if no files were created, overwritten, or deleted\n if (result.created === 0 && result.overwritten === 0 && result.deleted === 0) {\n console.log(chalk.yellow(' ⚠ No files were created, overwritten, or deleted'));\n }\n\n if (result.created > 0) {\n console.log(chalk.green(` Created: ${result.created}`));\n }\n\n if (result.overwritten > 0) {\n console.log(chalk.yellow(` Overwritten: ${result.overwritten}`));\n }\n\n if (result.deleted > 0) {\n console.log(chalk.red(` Deleted: ${result.deleted}`));\n }\n\n if (result.skippedEqual > 0) {\n console.log(chalk.dim(` Skipped (equal): ${result.skippedEqual}`));\n }\n\n if (result.skippedUser > 0) {\n console.log(chalk.blue(` Skipped (user): ${result.skippedUser}`));\n }\n\n if (result.skippedEmpty > 0) {\n console.log(chalk.dim(` Skipped (empty): ${result.skippedEmpty}`));\n }\n\n console.log('');\n }\n\n // @awa-impl: DIFF-4_AC-3\n diffLine(line: string, type: 'add' | 'remove' | 'context'): void {\n switch (type) {\n case 'add':\n console.log(chalk.green(line));\n break;\n case 'remove':\n console.log(chalk.red(line));\n break;\n case 'context':\n console.log(chalk.dim(line));\n break;\n }\n }\n\n // @awa-impl: DIFF-4_AC-4, DIFF-4_AC-5\n diffSummary(result: DiffResult): void {\n console.log('');\n\n const filesCompared =\n result.identical +\n result.modified +\n result.newFiles +\n result.extraFiles +\n result.binaryDiffers +\n result.deleteListed;\n const differences =\n result.modified +\n result.newFiles +\n result.extraFiles +\n result.binaryDiffers +\n result.deleteListed;\n\n // @awa-impl: DIFF-4_AC-5\n console.log(chalk.bold(`${filesCompared} files compared, ${differences} differences`));\n\n if (!result.hasDifferences) {\n // @awa-impl: DIFF-4_AC-4\n console.log(chalk.green('✔ No differences found'));\n }\n\n // @awa-impl: DIFF-4_AC-5\n console.log(chalk.bold('Summary:'));\n console.log(chalk.dim(` Identical: ${result.identical}`));\n\n if (result.modified > 0) {\n console.log(chalk.yellow(` Modified: ${result.modified}`));\n }\n\n if (result.newFiles > 0) {\n console.log(chalk.green(` New: ${result.newFiles}`));\n }\n\n if (result.extraFiles > 0) {\n console.log(chalk.red(` Extra: ${result.extraFiles}`));\n }\n\n if (result.binaryDiffers > 0) {\n console.log(chalk.red(` Binary differs: ${result.binaryDiffers}`));\n }\n\n if (result.deleteListed > 0) {\n console.log(chalk.red(` Delete listed: ${result.deleteListed}`));\n }\n\n console.log('');\n }\n}\n\nexport const logger = new Logger();\n","// @awa-component: DIFF-DiffEngine\n// @awa-impl: DIFF-1_AC-1\n// @awa-impl: DIFF-1_AC-2\n// @awa-impl: DIFF-1_AC-3\n// @awa-impl: DIFF-2_AC-1\n// @awa-impl: DIFF-2_AC-2\n// @awa-impl: DIFF-2_AC-3\n// @awa-impl: DIFF-2_AC-4\n// @awa-impl: DIFF-2_AC-5\n// @awa-impl: DIFF-3_AC-1\n// @awa-impl: DIFF-3_AC-2\n// @awa-impl: DIFF-3_AC-3\n// @awa-impl: DIFF-4_AC-1\n// @awa-impl: DIFF-4_AC-2\n// @awa-impl: DIFF-5_AC-1\n// @awa-impl: DIFF-5_AC-2\n// @awa-impl: DIFF-5_AC-3\n// @awa-impl: DIFF-6_AC-1\n// @awa-impl: DIFF-6_AC-2\n// @awa-impl: DIFF-6_AC-3\n\nimport { tmpdir } from 'node:os';\nimport { join, relative } from 'node:path';\nimport { structuredPatch } from 'diff';\nimport { isBinaryFile as detectBinaryFile } from 'isbinaryfile';\nimport type { DiffOptions, DiffResult, FileDiff, GenerateOptions } from '../types/index.js';\nimport { ensureDir, pathExists, readBinaryFile, rmDir, walkDirectory } from '../utils/fs.js';\nimport { loadDeleteList, resolveDeleteList } from './delete-list.js';\nimport { fileGenerator } from './generator.js';\n\nexport class DiffEngine {\n // @awa-impl: DIFF-1_AC-1, DIFF-1_AC-2, DIFF-1_AC-3\n // @awa-impl: DIFF-2_AC-1, DIFF-2_AC-2, DIFF-2_AC-3, DIFF-2_AC-4, DIFF-2_AC-5\n // @awa-impl: DIFF-3_AC-1, DIFF-3_AC-2, DIFF-3_AC-3\n // @awa-impl: DIFF-4_AC-1, DIFF-4_AC-2\n // @awa-impl: DIFF-5_AC-1, DIFF-5_AC-2, DIFF-5_AC-3\n // @awa-impl: DIFF-6_AC-1, DIFF-6_AC-2, DIFF-6_AC-3\n async diff(options: DiffOptions): Promise<DiffResult> {\n const { templatePath, targetPath, features, listUnknown } = options;\n\n // @awa-impl: DIFF-1_AC-1, DIFF-1_AC-2\n const tempPath = await this.createTempDir();\n\n try {\n // Generate templates to temp directory\n const generateOptions: GenerateOptions = {\n templatePath,\n outputPath: tempPath,\n features,\n force: true,\n dryRun: false,\n delete: false,\n };\n\n await fileGenerator.generate(generateOptions);\n\n // Collect all files from both directories\n const generatedFiles = new Set<string>();\n const targetFiles = new Set<string>();\n\n // Walk generated directory (if exists - may be empty if template generates nothing)\n if (await pathExists(tempPath)) {\n for await (const file of walkDirectory(tempPath)) {\n const relPath = relative(tempPath, file);\n generatedFiles.add(relPath);\n }\n }\n\n // Walk target directory (if exists)\n if (await pathExists(targetPath)) {\n for await (const file of walkDirectory(targetPath)) {\n const relPath = relative(targetPath, file);\n targetFiles.add(relPath);\n }\n }\n\n // Compare files: iterate generated files first; optionally include target-only files when requested\n const files: FileDiff[] = [];\n\n for (const relPath of generatedFiles) {\n const generatedFilePath = join(tempPath, relPath);\n const targetFilePath = join(targetPath, relPath);\n\n if (targetFiles.has(relPath)) {\n // @awa-impl: DIFF-2_AC-1, DIFF-2_AC-2, DIFF-2_AC-3, DIFF-2_AC-4, DIFF-2_AC-5\n const fileDiff = await this.compareFiles(generatedFilePath, targetFilePath, relPath);\n files.push(fileDiff);\n } else {\n // @awa-impl: DIFF-3_AC-1\n files.push({\n relativePath: relPath,\n status: 'new',\n });\n }\n }\n\n if (listUnknown) {\n for (const relPath of targetFiles) {\n if (generatedFiles.has(relPath)) {\n continue;\n }\n\n // @awa-impl: DIFF-3_AC-2, DIFF-3_AC-3, DIFF-3_AC-4\n files.push({\n relativePath: relPath,\n status: 'extra',\n });\n }\n }\n\n // Check delete list for files that exist in target\n const deleteEntries = await loadDeleteList(templatePath);\n const deleteList = resolveDeleteList(deleteEntries, features ?? []);\n for (const relPath of deleteList) {\n if (targetFiles.has(relPath) && !generatedFiles.has(relPath)) {\n // Remove any existing 'extra' entry for this path (to avoid double-reporting)\n const existingIdx = files.findIndex(\n (f) => f.relativePath === relPath && f.status === 'extra'\n );\n if (existingIdx !== -1) {\n files.splice(existingIdx, 1);\n }\n files.push({\n relativePath: relPath,\n status: 'delete-listed',\n });\n }\n }\n\n // Calculate summary\n const identical = files.filter((f) => f.status === 'identical').length;\n const modified = files.filter((f) => f.status === 'modified').length;\n const newFiles = files.filter((f) => f.status === 'new').length;\n const extraFiles = files.filter((f) => f.status === 'extra').length;\n const binaryDiffers = files.filter((f) => f.status === 'binary-differs').length;\n const deleteListed = files.filter((f) => f.status === 'delete-listed').length;\n\n const hasDifferences =\n modified > 0 || newFiles > 0 || extraFiles > 0 || binaryDiffers > 0 || deleteListed > 0;\n\n return {\n files,\n identical,\n modified,\n newFiles,\n extraFiles,\n binaryDiffers,\n deleteListed,\n hasDifferences,\n };\n } finally {\n // @awa-impl: DIFF-6_AC-1, DIFF-6_AC-2, DIFF-6_AC-3\n await this.cleanupTempDir(tempPath);\n }\n }\n\n // @awa-impl: DIFF-1_AC-1, DIFF-1_AC-2\n async createTempDir(): Promise<string> {\n const systemTemp = tmpdir();\n const timestamp = Date.now();\n const random = Math.random().toString(36).substring(2, 8);\n const tempPath = join(systemTemp, `awa-diff-${timestamp}-${random}`);\n\n await ensureDir(tempPath);\n return tempPath;\n }\n\n // @awa-impl: DIFF-6_AC-1, DIFF-6_AC-2, DIFF-6_AC-3\n async cleanupTempDir(tempPath: string): Promise<void> {\n try {\n if (await pathExists(tempPath)) {\n await rmDir(tempPath);\n }\n } catch (_error) {\n // Swallow cleanup errors - temp directory will be cleaned by OS eventually\n // This ensures cleanup errors don't mask the actual diff results\n }\n }\n\n // @awa-impl: DIFF-2_AC-1, DIFF-2_AC-2, DIFF-2_AC-3, DIFF-2_AC-4, DIFF-2_AC-5\n async compareFiles(\n generatedPath: string,\n targetPath: string,\n relativePath: string\n ): Promise<FileDiff> {\n // Read raw bytes for byte-for-byte comparison.\n const generatedBytes = await readBinaryFile(generatedPath);\n const targetBytes = await readBinaryFile(targetPath);\n\n // @awa-impl: DIFF-2_AC-1, DIFF-2_AC-3\n if (generatedBytes.equals(targetBytes)) {\n return {\n relativePath,\n status: 'identical',\n };\n }\n\n // @awa-impl: DIFF-2_AC-5\n // If either side is binary, do not attempt a text diff.\n const isBinaryGenerated = await this.isBinaryFile(generatedPath);\n const isBinaryTarget = await this.isBinaryFile(targetPath);\n\n if (isBinaryGenerated || isBinaryTarget) {\n return {\n relativePath,\n status: 'binary-differs',\n };\n }\n\n // Text files: unified diff (diff library is text-based)\n const generatedContent = generatedBytes.toString('utf-8');\n const targetContent = targetBytes.toString('utf-8');\n\n // @awa-impl: DIFF-2_AC-4\n // Generate unified diff\n const patch = structuredPatch(\n `a/${relativePath}`,\n `b/${relativePath}`,\n targetContent,\n generatedContent,\n 'target',\n 'generated',\n {\n context: 3,\n }\n );\n\n // Format as git-style unified diff string (with file headers)\n const headerLines = [\n `diff --git a/${relativePath} b/${relativePath}`,\n `--- a/${relativePath}`,\n `+++ b/${relativePath}`,\n ];\n\n const hunkLines = patch.hunks.flatMap((hunk) => {\n const lines = [`@@ -${hunk.oldStart},${hunk.oldLines} +${hunk.newStart},${hunk.newLines} @@`];\n lines.push(...hunk.lines);\n return lines;\n });\n\n const unifiedDiff = [...headerLines, ...hunkLines].join('\\n');\n\n return {\n relativePath,\n status: 'modified',\n unifiedDiff,\n };\n }\n\n // @awa-impl: DIFF-2_AC-5\n async isBinaryFile(filePath: string): Promise<boolean> {\n try {\n return await detectBinaryFile(filePath);\n } catch {\n // If detection fails, assume text file\n return false;\n }\n }\n}\n\nexport const diffEngine = new DiffEngine();\n","// @awa-component: GEN-DeleteList\n\nimport { join } from 'node:path';\nimport { pathExists, readTextFile } from '../utils/fs.js';\n\nconst DELETE_LIST_FILENAME = '_delete.txt';\n\n/**\n * A delete list entry. When `features` is set, the path is only deleted\n * when NONE of those features are present in the active feature set\n * (stale tool cleanup). When `features` is absent, the path is always\n * deleted (legacy removal).\n */\nexport interface DeleteEntry {\n path: string;\n /** One or more feature names — keep (don't delete) if any is active. */\n features?: string[];\n}\n\n/**\n * Parse `_delete.txt` content into structured entries.\n *\n * Format:\n * - Blank lines and `#` comments are ignored.\n * - `# @feature <name> [<name2> ...]` starts a feature-gated section: subsequent\n * paths are deleted only when NONE of the listed features are active.\n * - Any other comment line clears the current feature section (returns to\n * always-delete behaviour).\n * - Path lines inherit the current section's feature tag (if any).\n */\nexport function parseDeleteList(content: string): DeleteEntry[] {\n const entries: DeleteEntry[] = [];\n let currentFeatures: string[] | undefined;\n\n for (const raw of content.split('\\n')) {\n const line = raw.trim();\n if (line.length === 0) continue;\n\n if (line.startsWith('#')) {\n const featureMatch = line.match(/^#\\s*@feature\\s+(.+)$/);\n if (featureMatch) {\n const featureSection = featureMatch[1];\n currentFeatures = featureSection ? featureSection.trim().split(/\\s+/) : undefined;\n } else {\n // Any other comment resets the feature section\n currentFeatures = undefined;\n }\n continue;\n }\n\n entries.push({ path: line, features: currentFeatures });\n }\n\n return entries;\n}\n\n/**\n * Resolve which paths from the delete list should actually be deleted,\n * given the currently active feature flags.\n *\n * - Entries without a feature tag are always included (legacy removals).\n * - Entries with feature tags are included only when NONE of those features are active\n * (stale tool output cleanup).\n */\nexport function resolveDeleteList(entries: DeleteEntry[], activeFeatures: string[]): string[] {\n const activeSet = new Set(activeFeatures);\n return entries\n .filter((e) => e.features === undefined || !e.features.some((f) => activeSet.has(f)))\n .map((e) => e.path);\n}\n\n/**\n * Load and parse `_delete.txt` from the template directory.\n * Returns empty array if the file does not exist.\n */\nexport async function loadDeleteList(templatePath: string): Promise<DeleteEntry[]> {\n const deleteListPath = join(templatePath, DELETE_LIST_FILENAME);\n\n if (!(await pathExists(deleteListPath))) {\n return [];\n }\n\n const content = await readTextFile(deleteListPath);\n return parseDeleteList(content);\n}\n","// @awa-component: GEN-FileGenerator\n// @awa-impl: GEN-1_AC-1\n// @awa-impl: GEN-1_AC-2\n// @awa-impl: GEN-1_AC-3\n// @awa-impl: GEN-2_AC-1\n// @awa-impl: GEN-2_AC-2\n// @awa-impl: GEN-2_AC-3\n// @awa-impl: GEN-3_AC-1\n// @awa-impl: GEN-3_AC-2\n// @awa-impl: GEN-3_AC-3\n// @awa-impl: GEN-8_AC-1\n// @awa-impl: GEN-8_AC-2\n// @awa-impl: GEN-8_AC-3\n// @awa-impl: GEN-11_AC-3\n// @awa-impl: TPL-9_AC-1\n// @awa-impl: TPL-9_AC-2\n\nimport { join, relative } from 'node:path';\nimport {\n type ConflictItem,\n type FileAction,\n type GenerateOptions,\n GenerationError,\n type GenerationResult,\n} from '../types/index.js';\nimport { deleteFile, pathExists, readTextFile, walkDirectory, writeTextFile } from '../utils/fs.js';\nimport { logger } from '../utils/logger.js';\nimport { loadDeleteList, resolveDeleteList } from './delete-list.js';\nimport { conflictResolver, deleteResolver } from './resolver.js';\nimport { templateEngine } from './template.js';\n\nexport class FileGenerator {\n // @awa-impl: GEN-1_AC-1, GEN-1_AC-2, GEN-1_AC-3\n // @awa-impl: GEN-2_AC-1, GEN-2_AC-2, GEN-2_AC-3\n // @awa-impl: GEN-3_AC-1, GEN-3_AC-2, GEN-3_AC-3\n async generate(options: GenerateOptions): Promise<GenerationResult> {\n const { templatePath, outputPath, features, force, dryRun } = options;\n const enableDelete = options.delete;\n\n // Configure template engine\n templateEngine.configure(templatePath);\n\n const actions: FileAction[] = [];\n let created = 0;\n let overwritten = 0;\n let deleted = 0;\n let skippedEmpty = 0;\n let skippedUser = 0;\n let skippedEqual = 0;\n\n // Collect files to process\n interface FileToProcess {\n templateFile: string;\n outputFile: string;\n content: string;\n isNew: boolean;\n }\n\n const filesToProcess: FileToProcess[] = [];\n const conflicts: ConflictItem[] = [];\n\n try {\n // First pass: render all templates and categorize files\n for await (const templateFile of this.walkTemplates(templatePath)) {\n // Compute output path\n const outputFile = this.computeOutputPath(templateFile, templatePath, outputPath);\n\n // Render template\n const result = await templateEngine.render(templateFile, { features });\n\n // Handle empty output\n if (result.isEmpty && !result.isEmptyFileMarker) {\n // Skip empty files\n actions.push({\n type: 'skip-empty',\n sourcePath: templateFile,\n outputPath: outputFile,\n });\n skippedEmpty++;\n continue;\n }\n\n // Get final content (empty string if marker)\n const content = result.isEmptyFileMarker ? '' : result.content;\n\n // Check for conflicts\n const fileExists = await pathExists(outputFile);\n\n if (fileExists) {\n // Read existing content for comparison\n const existingContent = await readTextFile(outputFile);\n conflicts.push({\n outputPath: outputFile,\n sourcePath: templateFile,\n newContent: content,\n existingContent,\n });\n }\n\n filesToProcess.push({\n templateFile,\n outputFile,\n content,\n isNew: !fileExists,\n });\n }\n\n // Resolve all conflicts at once if there are any\n let resolution: { overwrite: string[]; skip: string[]; equal: string[] } = {\n overwrite: [],\n skip: [],\n equal: [],\n };\n if (conflicts.length > 0) {\n resolution = await conflictResolver.resolveBatch(conflicts, force, dryRun);\n }\n\n // Second pass: process files based on resolution\n for (const file of filesToProcess) {\n if (file.isNew) {\n // Create new file\n if (!dryRun) {\n await writeTextFile(file.outputFile, file.content);\n }\n actions.push({\n type: 'create',\n sourcePath: file.templateFile,\n outputPath: file.outputFile,\n });\n created++;\n logger.fileAction({\n type: 'create',\n sourcePath: file.templateFile,\n outputPath: file.outputFile,\n });\n } else if (resolution.overwrite.includes(file.outputFile)) {\n // Overwrite existing file\n if (!dryRun) {\n await writeTextFile(file.outputFile, file.content);\n }\n actions.push({\n type: 'overwrite',\n sourcePath: file.templateFile,\n outputPath: file.outputFile,\n });\n overwritten++;\n logger.fileAction({\n type: 'overwrite',\n sourcePath: file.templateFile,\n outputPath: file.outputFile,\n });\n } else if (resolution.equal.includes(file.outputFile)) {\n // Skip file — content is identical\n actions.push({\n type: 'skip-equal',\n sourcePath: file.templateFile,\n outputPath: file.outputFile,\n });\n skippedEqual++;\n logger.fileAction({\n type: 'skip-equal',\n sourcePath: file.templateFile,\n outputPath: file.outputFile,\n });\n } else if (resolution.skip.includes(file.outputFile)) {\n // Skip file — user declined overwrite\n actions.push({\n type: 'skip-user',\n sourcePath: file.templateFile,\n outputPath: file.outputFile,\n });\n skippedUser++;\n logger.fileAction({\n type: 'skip-user',\n sourcePath: file.templateFile,\n outputPath: file.outputFile,\n });\n }\n }\n\n // Process delete list (after file generation)\n const deleteEntries = await loadDeleteList(templatePath);\n if (deleteEntries.length > 0) {\n const deleteList = resolveDeleteList(deleteEntries, features);\n\n // Collect generated output paths to detect conflicts\n const generatedOutputPaths = new Set(filesToProcess.map((f) => f.outputFile));\n\n // Filter: only files that exist and aren't being generated\n const deleteCandidates: string[] = [];\n for (const relPath of deleteList) {\n const absPath = join(outputPath, relPath);\n if (generatedOutputPaths.has(absPath)) {\n logger.warn(\n `Delete list entry '${relPath}' conflicts with generated file — skipping deletion`\n );\n continue;\n }\n if (await pathExists(absPath)) {\n deleteCandidates.push(absPath);\n }\n }\n\n if (deleteCandidates.length > 0) {\n if (!enableDelete) {\n // --delete not passed: warn but do nothing\n for (const absPath of deleteCandidates) {\n logger.warn(\n `Would delete (pass --delete to enable): ${relative(outputPath, absPath)}`\n );\n }\n } else {\n const confirmed = await deleteResolver.resolveDeletes(deleteCandidates, force, dryRun);\n\n for (const absPath of confirmed) {\n if (!dryRun) {\n await deleteFile(absPath);\n }\n actions.push({ type: 'delete', outputPath: absPath });\n deleted++;\n logger.fileAction({ type: 'delete', outputPath: absPath });\n }\n }\n }\n }\n\n return {\n actions,\n created,\n overwritten,\n deleted,\n skipped: skippedEmpty + skippedUser + skippedEqual,\n skippedEmpty,\n skippedUser,\n skippedEqual,\n };\n } catch (error) {\n // @awa-impl: GEN-2_AC-3, GEN-11_AC-3\n if (error instanceof Error && 'code' in error) {\n const code = (error as NodeJS.ErrnoException).code;\n if (code === 'EACCES' || code === 'EPERM') {\n throw new GenerationError(`Permission denied: ${error.message}`, 'PERMISSION_DENIED');\n }\n if (code === 'ENOSPC') {\n throw new GenerationError(`Disk full: ${error.message}`, 'DISK_FULL');\n }\n }\n throw error;\n }\n }\n\n // @awa-impl: GEN-8_AC-1, GEN-8_AC-2, GEN-8_AC-3\n // @awa-impl: TPL-9_AC-1, TPL-9_AC-2\n async *walkTemplates(dir: string): AsyncIterable<string> {\n // Use utility function that already handles underscore exclusion\n yield* walkDirectory(dir);\n }\n\n // @awa-impl: GEN-1_AC-1, GEN-1_AC-2, GEN-1_AC-3\n computeOutputPath(templatePath: string, templateRoot: string, outputRoot: string): string {\n // Get relative path from template root\n const relativePath = relative(templateRoot, templatePath);\n\n // Join with output root to mirror structure\n return join(outputRoot, relativePath);\n }\n}\n\nexport const fileGenerator = new FileGenerator();\n","// @awa-component: GEN-ConflictResolver\n// @awa-impl: CLI-5_AC-2\n// @awa-impl: CLI-5_AC-3\n// @awa-impl: GEN-4_AC-1\n// @awa-impl: GEN-4_AC-2\n// @awa-impl: GEN-4_AC-3\n// @awa-impl: GEN-5_AC-1\n// @awa-impl: GEN-5_AC-2\n// @awa-impl: GEN-5_AC-3\n// @awa-impl: GEN-5_AC-4\n// @awa-impl: GEN-5_AC-5\n// @awa-impl: GEN-5_AC-6\n// @awa-impl: GEN-5_AC-7\n// @awa-impl: GEN-6_AC-3\n// @awa-impl: GEN-10_AC-3\n\nimport { MultiSelectPrompt } from '@clack/core';\nimport { isCancel, multiselect } from '@clack/prompts';\nimport chalk from 'chalk';\nimport type { BatchConflictResolution, ConflictItem } from '../types/index.js';\n\n// Unicode symbols (mirrors @clack/prompts internals)\nconst _unicode = process.platform !== 'win32';\nconst _s = (c: string, fb: string) => (_unicode ? c : fb);\nconst _CHECKED = _s('\\u25FC', '[+]'); // ◼\nconst _UNCHECKED_A = _s('\\u25FB', '[·]'); // ◻ active\nconst _UNCHECKED = _s('\\u25FB', '[ ]'); // ◻ inactive\nconst _BAR = _s('\\u2502', '|'); // │\nconst _BAR_END = _s('\\u2514', '-'); // └\n\ntype SelectOption = { value: string; label?: string; hint?: string };\n\nfunction _renderDeleteItem(opt: SelectOption, state: string): string {\n const label = opt.label ?? opt.value;\n const hint = opt.hint ? ` ${chalk.dim(`(${opt.hint})`)}` : '';\n switch (state) {\n case 'active':\n return `${chalk.cyan(_UNCHECKED_A)} ${label}${hint}`;\n case 'selected':\n return `${chalk.red(_CHECKED)} ${chalk.dim(label)}${hint}`;\n case 'active-selected':\n return `${chalk.red(_CHECKED)} ${label}${hint}`;\n case 'cancelled':\n return chalk.strikethrough(chalk.dim(label));\n case 'submitted':\n return chalk.dim(label);\n default:\n return `${chalk.dim(_UNCHECKED)} ${chalk.dim(label)}`;\n }\n}\n\n/** Like @clack/prompts `multiselect` but with red checkboxes for destructive operations. */\nasync function deleteMultiselect(opts: {\n message: string;\n options: SelectOption[];\n initialValues?: string[];\n required?: boolean;\n}): Promise<string[] | symbol> {\n const { message, options, initialValues, required = false } = opts;\n return new MultiSelectPrompt({\n options,\n initialValues,\n required,\n render() {\n const self = this as unknown as {\n state: string;\n options: SelectOption[];\n cursor: number;\n value: string[];\n };\n const header = `${chalk.gray(_BAR)}\\n${chalk.cyan(_BAR)} ${message}\\n`;\n const getState = (opt: SelectOption, idx: number): string => {\n const active = idx === self.cursor;\n const sel = self.value.includes(opt.value);\n if (active && sel) return 'active-selected';\n if (sel) return 'selected';\n if (active) return 'active';\n return 'inactive';\n };\n switch (self.state) {\n case 'submit':\n return (\n `${header}${chalk.gray(_BAR)} ` +\n (self.options\n .filter((o) => self.value.includes(o.value))\n .map((o) => _renderDeleteItem(o, 'submitted'))\n .join(chalk.dim(', ')) || chalk.dim('none'))\n );\n case 'cancel': {\n const cancelled = self.options\n .filter((o) => self.value.includes(o.value))\n .map((o) => _renderDeleteItem(o, 'cancelled'))\n .join(chalk.dim(', '));\n return `${header}${chalk.gray(_BAR)} ${cancelled.trim() ? `${cancelled}\\n${chalk.gray(_BAR)}` : chalk.dim('none')}`;\n }\n default:\n return (\n `${header}${chalk.cyan(_BAR)} ` +\n self.options\n .map((o, i) => _renderDeleteItem(o, getState(o, i)))\n .join(`\\n${chalk.cyan(_BAR)} `) +\n `\\n${chalk.cyan(_BAR_END)}\\n`\n );\n }\n },\n }).prompt() as Promise<string[] | symbol>;\n}\n\nexport class ConflictResolver {\n // @awa-impl: GEN-4_AC-1, GEN-4_AC-2, GEN-4_AC-3\n // @awa-impl: GEN-5_AC-1, GEN-5_AC-2, GEN-5_AC-3, GEN-5_AC-4, GEN-5_AC-5, GEN-5_AC-6, GEN-5_AC-7\n // @awa-impl: CLI-5_AC-2, CLI-5_AC-3\n // @awa-impl: GEN-6_AC-3\n async resolveBatch(\n conflicts: ConflictItem[],\n force: boolean,\n dryRun: boolean\n ): Promise<BatchConflictResolution> {\n // Separate identical-content files from different files\n const identicalPaths = conflicts\n .filter((c) => c.newContent === c.existingContent)\n .map((c) => c.outputPath);\n const differentFiles = conflicts.filter((c) => c.newContent !== c.existingContent);\n\n // In dry-run mode, never modify files (P7: Dry Run Immutable)\n if (dryRun) {\n return {\n overwrite: [],\n skip: differentFiles.map((c) => c.outputPath),\n equal: identicalPaths,\n };\n }\n\n // In force mode, always overwrite without prompting (P8: Force No Prompt)\n if (force) {\n return {\n overwrite: differentFiles.map((c) => c.outputPath),\n skip: [],\n equal: identicalPaths,\n };\n }\n\n // If all files are identical, skip them all\n if (differentFiles.length === 0) {\n return {\n overwrite: [],\n skip: [],\n equal: identicalPaths,\n };\n }\n\n // @awa-impl: GEN-5_AC-1, GEN-5_AC-2, GEN-5_AC-5, GEN-5_AC-6\n // Prompt user with multi-select (all selected by default)\n const selected = await multiselect({\n message: 'The following files already exist. Select files to overwrite:',\n options: differentFiles.map((c) => ({\n value: c.outputPath,\n label: c.outputPath,\n })),\n initialValues: differentFiles.map((c) => c.outputPath), // All selected by default (AC-5.6)\n required: false,\n });\n\n // @awa-impl: GEN-10_AC-3\n // Handle user cancellation (Ctrl+C)\n if (isCancel(selected)) {\n process.exit(1);\n }\n\n const selectedPaths = selected as string[];\n const allPaths = differentFiles.map((c) => c.outputPath);\n\n return {\n overwrite: selectedPaths,\n skip: allPaths.filter((p) => !selectedPaths.includes(p)),\n equal: identicalPaths,\n };\n }\n}\n\nexport const conflictResolver = new ConflictResolver();\n\nexport class DeleteResolver {\n /**\n * Prompt user to confirm which files to delete.\n * Returns the list of absolute paths confirmed for deletion.\n */\n async resolveDeletes(candidates: string[], force: boolean, dryRun: boolean): Promise<string[]> {\n if (candidates.length === 0) {\n return [];\n }\n\n // In dry-run mode, return all candidates (caller logs but won't delete)\n if (dryRun) {\n return candidates;\n }\n\n // In force mode, delete without prompting\n if (force) {\n return candidates;\n }\n\n // Prompt user with multi-select (all selected by default, red checkboxes)\n const selected = await deleteMultiselect({\n message:\n '⚠ WARNING: The selected files will be PERMANENTLY DELETED from disk.\\n' +\n ' Deselect any files you want to keep. Press Enter to confirm deletion:',\n options: candidates.map((p) => ({\n value: p,\n label: p,\n })),\n initialValues: candidates,\n required: false,\n });\n\n // Handle user cancellation (Ctrl+C)\n if (isCancel(selected)) {\n process.exit(1);\n }\n\n return selected as string[];\n }\n}\n\nexport const deleteResolver = new DeleteResolver();\n","// @awa-component: TPL-TemplateEngine\n// @awa-impl: TPL-4_AC-1\n// @awa-impl: TPL-4_AC-2\n// @awa-impl: TPL-4_AC-3\n// @awa-impl: TPL-4_AC-4\n// @awa-impl: TPL-5_AC-1\n// @awa-impl: TPL-5_AC-2\n// @awa-impl: TPL-5_AC-3\n// @awa-impl: TPL-6_AC-1\n// @awa-impl: TPL-6_AC-2\n// @awa-impl: TPL-7_AC-1\n// @awa-impl: TPL-7_AC-2\n// @awa-impl: TPL-8_AC-1\n// @awa-impl: TPL-8_AC-2\n// @awa-impl: TPL-8_AC-3\n// @awa-impl: TPL-8_AC-4\n// @awa-impl: TPL-11_AC-1\n// @awa-impl: TPL-11_AC-2\n\nimport { Eta } from 'eta';\nimport { type RenderResult, type TemplateContext, TemplateError } from '../types/index.js';\nimport { readTextFile } from '../utils/fs.js';\n\nconst EMPTY_FILE_MARKER = '<!-- AWA:EMPTY_FILE -->';\n\nexport class TemplateEngine {\n private eta: Eta | null = null;\n private templateDir: string | null = null;\n private compiledCache = new Map<string, unknown>();\n\n // @awa-impl: TPL-8_AC-1, TPL-8_AC-2, TPL-8_AC-3, TPL-8_AC-4\n configure(templateDir: string): void {\n this.templateDir = templateDir;\n this.compiledCache.clear();\n\n // @awa-impl: TPL-4_AC-1, TPL-4_AC-2, TPL-4_AC-3, TPL-4_AC-4\n // Configure Eta with partials support\n this.eta = new Eta({\n views: templateDir,\n cache: true, // Enable compilation caching\n autoEscape: false, // Don't escape HTML by default\n defaultExtension: '', // No automatic extension - use exact path as specified (AC-8.2)\n });\n }\n\n // @awa-impl: TPL-5_AC-1, TPL-5_AC-2, TPL-5_AC-3\n // @awa-impl: TPL-6_AC-1, TPL-6_AC-2\n // @awa-impl: TPL-7_AC-1, TPL-7_AC-2\n // @awa-impl: TPL-11_AC-1, TPL-11_AC-2\n async render(templatePath: string, context: TemplateContext): Promise<RenderResult> {\n if (!this.eta || !this.templateDir) {\n throw new TemplateError(\n 'Template engine not configured. Call configure() first.',\n 'RENDER_ERROR'\n );\n }\n\n try {\n // Read template content\n const templateContent = await readTextFile(templatePath);\n\n // Render with features context\n // The context is available as 'it' in templates\n const rendered = await this.eta.renderStringAsync(templateContent, {\n features: context.features,\n });\n\n // Check if output is empty or only whitespace\n const trimmed = rendered.trim();\n const isEmpty = trimmed.length === 0;\n\n // Check for empty file marker\n const isEmptyFileMarker = trimmed === EMPTY_FILE_MARKER;\n\n return {\n content: rendered,\n isEmpty,\n isEmptyFileMarker,\n };\n } catch (error) {\n throw new TemplateError(\n `Failed to render template ${templatePath}: ${error instanceof Error ? error.message : String(error)}`,\n 'RENDER_ERROR',\n templatePath\n );\n }\n }\n}\n\nexport const templateEngine = new TemplateEngine();\n","// @awa-component: FP-FeatureResolver\n\nimport { ConfigError, type PresetDefinitions } from '../types/index.js';\n\nexport interface FeatureResolutionInput {\n baseFeatures: string[];\n presetNames: string[];\n removeFeatures: string[];\n presetDefinitions: PresetDefinitions;\n}\n\nexport class FeatureResolver {\n validatePresets(presetNames: string[], definitions: PresetDefinitions): void {\n for (const name of presetNames) {\n if (!definitions[name]) {\n throw new ConfigError(`Unknown preset: ${name}`, 'UNKNOWN_PRESET');\n }\n }\n }\n\n resolve(input: FeatureResolutionInput): string[] {\n const { baseFeatures, presetNames, removeFeatures, presetDefinitions } = input;\n\n this.validatePresets(presetNames, presetDefinitions);\n\n const finalFeatures: string[] = [];\n const seen = new Set<string>();\n\n const add = (feature: string) => {\n if (seen.has(feature)) return;\n seen.add(feature);\n finalFeatures.push(feature);\n };\n\n for (const feature of baseFeatures) add(feature);\n\n for (const presetName of presetNames) {\n for (const feature of presetDefinitions[presetName] ?? []) add(feature);\n }\n\n if (removeFeatures.length === 0) return finalFeatures;\n\n const removeSet = new Set(removeFeatures);\n return finalFeatures.filter((f) => !removeSet.has(f));\n }\n}\n\nexport const featureResolver = new FeatureResolver();\n","// @awa-component: TPL-TemplateResolver\n// @awa-impl: CLI-3_AC-2\n// @awa-impl: CLI-3_AC-3\n// @awa-impl: CLI-8_AC-2\n// @awa-impl: TPL-1_AC-1\n// @awa-impl: TPL-1_AC-2\n// @awa-impl: TPL-1_AC-3\n// @awa-impl: TPL-1_AC-4\n// @awa-impl: TPL-2_AC-1\n// @awa-impl: TPL-2_AC-2\n// @awa-impl: TPL-2_AC-3\n// @awa-impl: TPL-2_AC-4\n// @awa-impl: TPL-2_AC-5\n// @awa-impl: TPL-2_AC-6\n// @awa-impl: TPL-3_AC-1\n// @awa-impl: TPL-3_AC-2\n// @awa-impl: TPL-3_AC-3\n// @awa-impl: TPL-3_AC-4\n// @awa-impl: TPL-10_AC-1\n// @awa-impl: TPL-10_AC-2\n// @awa-impl: TPL-10_AC-3\n\nimport { createHash } from 'node:crypto';\nimport { rm } from 'node:fs/promises';\nimport { isAbsolute, join, resolve } from 'node:path';\nimport degit from 'degit';\nimport { type ResolvedTemplate, TemplateError, type TemplateSourceType } from '../types/index.js';\nimport { ensureDir, getCacheDir, getTemplateDir, pathExists } from '../utils/fs.js';\nimport { logger } from '../utils/logger.js';\n\nexport class TemplateResolver {\n // @awa-impl: CLI-3_AC-2, TPL-10_AC-1\n async resolve(source: string | null, refresh: boolean): Promise<ResolvedTemplate> {\n // If no source provided, use bundled templates\n if (!source) {\n const bundledPath = join(getTemplateDir(), 'awa');\n return {\n type: 'bundled',\n localPath: bundledPath,\n source: 'bundled',\n };\n }\n\n const type = this.detectType(source);\n\n // @awa-impl: TPL-1_AC-1, TPL-1_AC-2, TPL-1_AC-3, TPL-1_AC-4\n if (type === 'local') {\n // Resolve relative/absolute paths\n const localPath = isAbsolute(source) ? source : resolve(process.cwd(), source);\n\n // Check if path exists\n if (!(await pathExists(localPath))) {\n throw new TemplateError(\n `Template source not found: ${localPath}`,\n 'SOURCE_NOT_FOUND',\n source\n );\n }\n\n // Local templates are not cached\n return {\n type: 'local',\n localPath,\n source,\n };\n }\n\n // @awa-impl: TPL-2_AC-1 through TPL-2_AC-6, TPL-3_AC-1 through TPL-3_AC-4\n if (type === 'git') {\n const cachePath = this.getCachePath(source);\n\n // @awa-impl: CLI-8_AC-2, TPL-3_AC-2\n // Check if cached version exists\n const cacheExists = await pathExists(cachePath);\n\n if (cacheExists && !refresh) {\n // Use cached version\n logger.info(`Using cached template: ${source}`);\n return {\n type: 'git',\n localPath: cachePath,\n source,\n };\n }\n\n // Fetch from Git\n try {\n // Remove existing cache if refresh\n if (cacheExists && refresh) {\n logger.info(`Refreshing template: ${source}`);\n await rm(cachePath, { recursive: true, force: true });\n } else {\n logger.info(`Fetching template: ${source}`);\n }\n\n await ensureDir(cachePath);\n\n // Use degit for shallow fetch\n const emitter = degit(source, { cache: false, force: true });\n await emitter.clone(cachePath);\n\n return {\n type: 'git',\n localPath: cachePath,\n source,\n };\n } catch (error) {\n throw new TemplateError(\n `Failed to fetch Git template: ${error instanceof Error ? error.message : String(error)}`,\n 'FETCH_FAILED',\n source\n );\n }\n }\n\n throw new TemplateError(\n `Unable to resolve template source: ${source}`,\n 'SOURCE_NOT_FOUND',\n source\n );\n }\n\n // @awa-impl: TPL-2_AC-1 through TPL-2_AC-6\n detectType(source: string): TemplateSourceType {\n // Check for local path indicators\n if (source.startsWith('.') || source.startsWith('/') || source.startsWith('~')) {\n return 'local';\n }\n\n // Check for Windows absolute paths\n if (/^[a-zA-Z]:/.test(source)) {\n return 'local';\n }\n\n // All other formats are treated as Git sources:\n // - GitHub shorthand: owner/repo\n // - Prefixed: github:owner/repo, gitlab:owner/repo, bitbucket:owner/repo\n // - HTTPS: https://github.com/owner/repo\n // - SSH: git@github.com:owner/repo\n // - With subdirs: owner/repo/path/to/templates\n // - With refs: owner/repo#branch\n return 'git';\n }\n\n // @awa-impl: TPL-3_AC-1\n getCachePath(source: string): string {\n // Create a stable cache path based on source hash\n const hash = createHash('sha256').update(source).digest('hex').substring(0, 16);\n const cacheDir = getCacheDir();\n return join(cacheDir, hash);\n }\n}\n\nexport const templateResolver = new TemplateResolver();\n","// @awa-component: GEN-GenerateCommand\n\nimport { intro, isCancel, multiselect, outro } from '@clack/prompts';\nimport { configLoader } from '../core/config.js';\nimport { featureResolver } from '../core/feature-resolver.js';\nimport { fileGenerator } from '../core/generator.js';\nimport { templateResolver } from '../core/template-resolver.js';\nimport type { RawCliOptions } from '../types/index.js';\nimport { logger } from '../utils/logger.js';\n\n/** Known AI tool feature flags for interactive selection. */\nconst TOOL_FEATURES = [\n { value: 'copilot', label: 'GitHub Copilot' },\n { value: 'claude', label: 'Claude Code' },\n { value: 'cursor', label: 'Cursor' },\n { value: 'windsurf', label: 'Windsurf' },\n { value: 'kilocode', label: 'Kilocode' },\n { value: 'opencode', label: 'OpenCode' },\n { value: 'gemini', label: 'Gemini CLI' },\n { value: 'roo', label: 'Roo Code' },\n { value: 'qwen', label: 'Qwen Code' },\n { value: 'codex', label: 'Codex CLI' },\n { value: 'agy', label: 'Antigravity (agy)' },\n { value: 'agents-md', label: 'AGENTS.md (cross-tool)' },\n] as const;\n\nconst TOOL_FEATURE_VALUES = new Set<string>(TOOL_FEATURES.map((t) => t.value));\n\nexport async function generateCommand(cliOptions: RawCliOptions): Promise<void> {\n try {\n intro('awa CLI - Template Generator');\n\n // Load configuration file\n const fileConfig = await configLoader.load(cliOptions.config ?? null);\n\n // Merge CLI and file config\n const options = configLoader.merge(cliOptions, fileConfig);\n\n // Resolve template source\n const template = await templateResolver.resolve(options.template, options.refresh);\n\n const features = featureResolver.resolve({\n baseFeatures: [...options.features],\n presetNames: [...options.preset],\n removeFeatures: [...options.removeFeatures],\n presetDefinitions: options.presets,\n });\n\n // @awa-impl: MTT-1_AC-1\n // If no tool feature flag is present, prompt the user to select tools interactively\n const hasToolFlag = features.some((f) => TOOL_FEATURE_VALUES.has(f));\n if (!hasToolFlag) {\n const selected = await multiselect({\n message: 'Select AI tools to generate for (space to toggle, enter to confirm):',\n options: TOOL_FEATURES.map((t) => ({ value: t.value, label: t.label })),\n required: true,\n });\n if (isCancel(selected)) {\n logger.info('Generation cancelled.');\n process.exit(0);\n }\n features.push(...(selected as string[]));\n }\n\n // Display mode indicators\n if (options.dryRun) {\n logger.info('Running in dry-run mode (no files will be modified)');\n }\n if (options.force) {\n logger.info('Force mode enabled (existing files will be overwritten)');\n }\n\n // Generate files\n const result = await fileGenerator.generate({\n templatePath: template.localPath,\n outputPath: options.output,\n features,\n force: options.force,\n dryRun: options.dryRun,\n delete: options.delete,\n });\n\n // Display summary\n logger.summary(result);\n\n outro('Generation complete!');\n } catch (error) {\n // Error handling with proper exit codes\n if (error instanceof Error) {\n logger.error(error.message);\n } else {\n logger.error(String(error));\n }\n process.exit(1);\n }\n}\n"],"mappings":";;;AAgDA,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,QAAQ,UAAU,CAAC;AAAA,IAC3B,gBAAgB,QAAQ,kBAAkB,CAAC;AAAA,IAC3C,QAAQ,QAAQ;AAAA,IAChB,SAAS,QAAQ;AAAA,IACjB,aAAa,QAAQ;AAAA,EACvB;AAEA,QAAM,WAAW,MAAM,YAAY,UAAU;AAC7C,UAAQ,KAAK,QAAQ;AACvB,CAAC;AAGH,QAAQ,MAAM;","names":["join","relative","join","join","join","chalk","join","relative","join","rm","join","join","rm","intro","isCancel","multiselect","outro","intro","multiselect","isCancel","outro"]}
|
|
1
|
+
{"version":3,"sources":["../src/cli/index.ts","../src/_generated/package_info.ts","../src/commands/diff.ts","../src/core/config.ts","../src/types/index.ts","../src/utils/fs.ts","../src/utils/logger.ts","../src/core/differ.ts","../src/core/delete-list.ts","../src/core/generator.ts","../src/core/resolver.ts","../src/core/template.ts","../src/core/feature-resolver.ts","../src/core/template-resolver.ts","../src/commands/generate.ts"],"sourcesContent":["// @awa-component: CLI-ArgumentParser\n// @awa-impl: CLI-1_AC-1\n// @awa-impl: CLI-1_AC-2\n// @awa-impl: CLI-1_AC-3\n// @awa-impl: CLI-1_AC-4\n// @awa-impl: CLI-1_AC-5\n// @awa-impl: CLI-2_AC-1\n// @awa-impl: CLI-2_AC-2\n// @awa-impl: CLI-2_AC-3\n// @awa-impl: CLI-2_AC-5\n// @awa-impl: CLI-2_AC-6\n// @awa-impl: CLI-3_AC-1\n// @awa-impl: CLI-4_AC-1\n// @awa-impl: CLI-4_AC-2\n// @awa-impl: CLI-5_AC-1\n// @awa-impl: CLI-6_AC-1\n// @awa-impl: CLI-7_AC-1\n// @awa-impl: CLI-8_AC-1\n// @awa-impl: CLI-9_AC-1\n// @awa-impl: CLI-9_AC-2\n// @awa-impl: CLI-9_AC-3\n// @awa-impl: CLI-10_AC-1\n// @awa-impl: CLI-10_AC-2\n// @awa-impl: CLI-11_AC-1\n// @awa-impl: CLI-11_AC-2\n// @awa-impl: CLI-11_AC-3\n// @awa-impl: CFG-5_AC-2\n// @awa-impl: DIFF-7_AC-1\n// @awa-impl: DIFF-7_AC-2\n// @awa-impl: DIFF-7_AC-3\n// @awa-impl: DIFF-7_AC-4\n// @awa-impl: DIFF-7_AC-5\n// @awa-impl: DIFF-7_AC-6\n// @awa-impl: DIFF-7_AC-7\n// @awa-impl: DIFF-7_AC-8\n// @awa-impl: DIFF-7_AC-9\n// @awa-impl: DIFF-7_AC-10\n// @awa-impl: DIFF-7_AC-11\n// @awa-impl: FP-2_AC-1\n// @awa-impl: FP-2_AC-2\n// @awa-impl: FP-2_AC-4\n// @awa-impl: FP-4_AC-1\n// @awa-impl: FP-4_AC-2\n// @awa-impl: FP-4_AC-3\n// @awa-impl: FP-4_AC-5\n// @awa-impl: GEN-10_AC-1\n// @awa-impl: GEN-10_AC-2\n\nimport { Command } from 'commander';\nimport { PACKAGE_INFO } from '../_generated/package_info.js';\nimport { diffCommand } from '../commands/diff.js';\nimport { generateCommand } from '../commands/generate.js';\nimport type { RawCliOptions } from '../types/index.js';\n\nconst version = PACKAGE_INFO.version;\n\n// @awa-impl: CLI-1_AC-2, CLI-9_AC-1, CLI-9_AC-2, CLI-9_AC-3, CLI-10_AC-1, CLI-10_AC-2\nconst program = new Command();\n\nprogram\n .name('awa')\n .description('awa - tool for generating AI coding agent configuration files')\n .version(version, '-v, --version', 'Display version number');\n\n// @awa-impl: CLI-1_AC-1, CLI-1_AC-2, CLI-1_AC-3, CLI-1_AC-4, CLI-1_AC-5\nprogram\n .command('generate')\n .description('Generate AI agent configuration files from templates')\n // @awa-impl: CLI-2_AC-1, CLI-2_AC-5, CLI-2_AC-6\n .argument('[output]', 'Output directory (optional if specified in config)')\n // @awa-impl: CLI-3_AC-1\n .option('-t, --template <source>', 'Template source (local path or Git repository)')\n // @awa-impl: CLI-4_AC-1, CLI-4_AC-2\n .option('-f, --features <flag...>', 'Feature flags (can be specified multiple times)')\n .option('--preset <name...>', 'Preset names to enable (can be specified multiple times)')\n .option(\n '--remove-features <flag...>',\n 'Feature flags to remove (can be specified multiple times)'\n )\n // @awa-impl: CLI-5_AC-1\n .option('--force', 'Force overwrite existing files without prompting', false)\n // @awa-impl: CLI-6_AC-1\n .option('--dry-run', 'Preview changes without modifying files', false)\n .option(\n '--delete',\n 'Enable deletion of files listed in the delete list (default: warn only)',\n false\n )\n // @awa-impl: CLI-7_AC-1\n .option('-c, --config <path>', 'Path to configuration file')\n // @awa-impl: CLI-8_AC-1\n .option('--refresh', 'Force refresh of cached Git templates', false)\n .action(async (output: string | undefined, options) => {\n // @awa-impl: CLI-11_AC-1, CLI-11_AC-2, CLI-11_AC-3\n const cliOptions: RawCliOptions = {\n output,\n template: options.template,\n features: options.features || [],\n preset: options.preset || [],\n removeFeatures: options.removeFeatures || [],\n force: options.force,\n dryRun: options.dryRun,\n delete: options.delete,\n config: options.config,\n refresh: options.refresh,\n };\n\n await generateCommand(cliOptions);\n });\n\n// @awa-impl: DIFF-7_AC-1, DIFF-7_AC-2, DIFF-7_AC-3, DIFF-7_AC-4, DIFF-7_AC-5, DIFF-7_AC-6, DIFF-7_AC-7, DIFF-7_AC-8, DIFF-7_AC-9, DIFF-7_AC-10\nprogram\n .command('diff')\n .description('Compare template output with existing target directory')\n // @awa-impl: DIFF-7_AC-1, DIFF-7_AC-2, DIFF-7_AC-3, DIFF-7_AC-4, DIFF-7_AC-5\n .argument('[target]', 'Target directory to compare against (optional if specified in config)')\n // @awa-impl: DIFF-7_AC-6\n .option('-t, --template <source>', 'Template source (local path or Git repository)')\n // @awa-impl: DIFF-7_AC-7\n .option('-f, --features <flag...>', 'Feature flags (can be specified multiple times)')\n .option('--preset <name...>', 'Preset names to enable (can be specified multiple times)')\n .option(\n '--remove-features <flag...>',\n 'Feature flags to remove (can be specified multiple times)'\n )\n // @awa-impl: DIFF-7_AC-8\n .option('-c, --config <path>', 'Path to configuration file')\n // @awa-impl: DIFF-7_AC-9\n .option('--refresh', 'Force refresh of cached Git templates', false)\n // @awa-impl: DIFF-7_AC-11\n .option('--list-unknown', 'Include target-only files in diff results', false)\n // @awa-impl: DIFF-7_AC-10 - Note: --force and --dry-run are intentionally NOT accepted for diff command\n .action(async (target: string | undefined, options) => {\n const cliOptions: RawCliOptions = {\n output: target, // Use target as output for consistency\n template: options.template,\n features: options.features || [],\n preset: options.preset || [],\n removeFeatures: options.removeFeatures || [],\n config: options.config,\n refresh: options.refresh,\n listUnknown: options.listUnknown,\n };\n\n const exitCode = await diffCommand(cliOptions);\n process.exit(exitCode);\n });\n\n// @awa-impl: GEN-10_AC-1, GEN-10_AC-2\nprogram.parse();\n","// This file is automatically generated. DO NOT EDIT.\n\n/* eslint-disable */\n\nexport const PACKAGE_INFO = {\n \"name\": \"@ncoderz/awa\",\n \"version\": \"1.0.0\",\n \"author\": \"Richard Sewell <richard.sewell@ncoderz.com>\",\n \"license\": \"MIT\",\n \"description\": \"awa is an Agent Workflow for AIs. It is also a CLI tool to powerfully manage agent workflow files using templates.\"\n};\n","// @awa-component: DIFF-DiffCommand\n// @awa-impl: DIFF-5_AC-1\n// @awa-impl: DIFF-5_AC-2\n// @awa-impl: DIFF-5_AC-3\n\nimport { intro, outro } from '@clack/prompts';\nimport { configLoader } from '../core/config.js';\nimport { diffEngine } from '../core/differ.js';\nimport { featureResolver } from '../core/feature-resolver.js';\nimport { templateResolver } from '../core/template-resolver.js';\nimport { DiffError, type RawCliOptions } from '../types/index.js';\nimport { pathExists } from '../utils/fs.js';\nimport { logger } from '../utils/logger.js';\n\nexport async function diffCommand(cliOptions: RawCliOptions): Promise<number> {\n try {\n intro('awa CLI - Template Diff');\n\n // Load configuration file\n const fileConfig = await configLoader.load(cliOptions.config ?? null);\n\n // Merge CLI and file config\n const options = configLoader.merge(cliOptions, fileConfig);\n\n // Validate target directory exists (now from options.output)\n if (!(await pathExists(options.output))) {\n throw new DiffError(`Target directory does not exist: ${options.output}`);\n }\n\n const targetPath = options.output;\n\n // Resolve template source\n const template = await templateResolver.resolve(options.template, options.refresh);\n\n const features = featureResolver.resolve({\n baseFeatures: [...options.features],\n presetNames: [...options.preset],\n removeFeatures: [...options.removeFeatures],\n presetDefinitions: options.presets,\n });\n\n // Perform diff\n const result = await diffEngine.diff({\n templatePath: template.localPath,\n targetPath,\n features,\n listUnknown: options.listUnknown,\n });\n\n // Display diff output\n for (const file of result.files) {\n switch (file.status) {\n case 'modified':\n logger.info(`Modified: ${file.relativePath}`);\n if (file.unifiedDiff) {\n // Parse and display unified diff with colors\n const lines = file.unifiedDiff.split('\\n');\n for (const line of lines) {\n if (\n line.startsWith('diff --git') ||\n line.startsWith('index ') ||\n line.startsWith('--- ') ||\n line.startsWith('+++ ')\n ) {\n logger.diffLine(line, 'context');\n } else if (line.startsWith('+')) {\n logger.diffLine(line, 'add');\n } else if (line.startsWith('-')) {\n logger.diffLine(line, 'remove');\n } else if (line.startsWith('@@')) {\n logger.diffLine(line, 'context');\n } else {\n logger.diffLine(line, 'context');\n }\n }\n }\n break;\n case 'new':\n logger.info(`New file: ${file.relativePath}`);\n break;\n case 'extra':\n logger.warn(`Extra file (not in template): ${file.relativePath}`);\n break;\n case 'binary-differs':\n logger.warn(`binary files differ: ${file.relativePath}`);\n break;\n case 'delete-listed':\n logger.warn(`Delete listed: ${file.relativePath}`);\n break;\n case 'identical':\n // Skip identical files from output\n break;\n }\n }\n\n // Display summary\n logger.diffSummary(result);\n\n outro('Diff complete!');\n\n // @awa-impl: DIFF-5_AC-1, DIFF-5_AC-2\n return result.hasDifferences ? 1 : 0;\n } catch (error) {\n if (error instanceof Error) {\n logger.error(error.message);\n } else {\n logger.error(String(error));\n }\n\n // @awa-impl: DIFF-5_AC-3\n return 2;\n }\n}\n","// @awa-component: CFG-ConfigLoader\n// @awa-impl: CFG-1_AC-1\n// @awa-impl: CFG-1_AC-2\n// @awa-impl: CFG-1_AC-3\n// @awa-impl: CFG-1_AC-4\n// @awa-impl: CFG-2_AC-1\n// @awa-impl: CFG-2_AC-2\n// @awa-impl: CFG-2_AC-3\n// @awa-impl: CFG-3_AC-1\n// @awa-impl: CFG-3_AC-2\n// @awa-impl: CFG-3_AC-3\n// @awa-impl: CFG-3_AC-4\n// @awa-impl: CFG-3_AC-5\n// @awa-impl: CFG-3_AC-6\n// @awa-impl: CFG-4_AC-1\n// @awa-impl: CFG-4_AC-2\n// @awa-impl: CFG-4_AC-3\n// @awa-impl: CFG-4_AC-4\n// @awa-impl: CFG-5_AC-1\n// @awa-impl: CFG-6_AC-1\n// @awa-impl: CFG-6_AC-2\n// @awa-impl: CLI-1_AC-4\n// @awa-impl: CLI-2_AC-2\n// @awa-impl: CLI-2_AC-3\n// @awa-impl: CLI-2_AC-4\n// @awa-impl: CLI-4_AC-3\n// @awa-impl: CLI-7_AC-2\n\nimport { parse } from 'smol-toml';\nimport {\n ConfigError,\n type FileConfig,\n type PresetDefinitions,\n type RawCliOptions,\n type ResolvedOptions,\n} from '../types/index.js';\nimport { pathExists, readTextFile } from '../utils/fs.js';\nimport { logger } from '../utils/logger.js';\n\nconst DEFAULT_CONFIG_PATH = '.awa.toml';\n\nexport class ConfigLoader {\n // @awa-impl: CFG-1_AC-1, CFG-1_AC-2, CFG-1_AC-3, CFG-1_AC-4\n async load(configPath: string | null): Promise<FileConfig | null> {\n const pathToLoad = configPath ?? DEFAULT_CONFIG_PATH;\n\n // Check if file exists\n const exists = await pathExists(pathToLoad);\n\n // If explicit path provided but doesn't exist, error\n if (configPath && !exists) {\n throw new ConfigError(\n `Configuration file not found: ${configPath}`,\n 'FILE_NOT_FOUND',\n configPath\n );\n }\n\n // If default path doesn't exist, return null (no error)\n if (!configPath && !exists) {\n return null;\n }\n\n // Read and parse TOML\n try {\n const content = await readTextFile(pathToLoad);\n const parsed = parse(content) as Record<string, unknown>;\n\n // Validate and extract known options\n const config: FileConfig = {};\n\n if (parsed.output !== undefined) {\n if (typeof parsed.output !== 'string') {\n throw new ConfigError(\n `Invalid type for 'output': expected string, got ${typeof parsed.output}`,\n 'INVALID_TYPE',\n pathToLoad\n );\n }\n config.output = parsed.output;\n }\n\n if (parsed.template !== undefined) {\n if (typeof parsed.template !== 'string') {\n throw new ConfigError(\n `Invalid type for 'template': expected string, got ${typeof parsed.template}`,\n 'INVALID_TYPE',\n pathToLoad\n );\n }\n config.template = parsed.template;\n }\n\n if (parsed.features !== undefined) {\n if (\n !Array.isArray(parsed.features) ||\n !parsed.features.every((f) => typeof f === 'string')\n ) {\n throw new ConfigError(\n `Invalid type for 'features': expected array of strings`,\n 'INVALID_TYPE',\n pathToLoad\n );\n }\n config.features = parsed.features;\n }\n\n if (parsed.preset !== undefined) {\n if (!Array.isArray(parsed.preset) || !parsed.preset.every((p) => typeof p === 'string')) {\n throw new ConfigError(\n `Invalid type for 'preset': expected array of strings`,\n 'INVALID_TYPE',\n pathToLoad\n );\n }\n config.preset = parsed.preset;\n }\n\n if (parsed['remove-features'] !== undefined) {\n if (\n !Array.isArray(parsed['remove-features']) ||\n !parsed['remove-features'].every((f) => typeof f === 'string')\n ) {\n throw new ConfigError(\n `Invalid type for 'remove-features': expected array of strings`,\n 'INVALID_TYPE',\n pathToLoad\n );\n }\n config['remove-features'] = parsed['remove-features'];\n }\n\n if (parsed.force !== undefined) {\n if (typeof parsed.force !== 'boolean') {\n throw new ConfigError(\n `Invalid type for 'force': expected boolean, got ${typeof parsed.force}`,\n 'INVALID_TYPE',\n pathToLoad\n );\n }\n config.force = parsed.force;\n }\n\n if (parsed['dry-run'] !== undefined) {\n if (typeof parsed['dry-run'] !== 'boolean') {\n throw new ConfigError(\n `Invalid type for 'dry-run': expected boolean, got ${typeof parsed['dry-run']}`,\n 'INVALID_TYPE',\n pathToLoad\n );\n }\n config['dry-run'] = parsed['dry-run'];\n }\n\n if (parsed.delete !== undefined) {\n if (typeof parsed.delete !== 'boolean') {\n throw new ConfigError(\n `Invalid type for 'delete': expected boolean, got ${typeof parsed.delete}`,\n 'INVALID_TYPE',\n pathToLoad\n );\n }\n config.delete = parsed.delete;\n }\n\n if (parsed.refresh !== undefined) {\n if (typeof parsed.refresh !== 'boolean') {\n throw new ConfigError(\n `Invalid type for 'refresh': expected boolean, got ${typeof parsed.refresh}`,\n 'INVALID_TYPE',\n pathToLoad\n );\n }\n config.refresh = parsed.refresh;\n }\n\n if (parsed.presets !== undefined) {\n if (\n parsed.presets === null ||\n typeof parsed.presets !== 'object' ||\n Array.isArray(parsed.presets)\n ) {\n throw new ConfigError(\n `Invalid type for 'presets': expected table of string arrays`,\n 'INVALID_PRESET',\n pathToLoad\n );\n }\n\n const defs: PresetDefinitions = {};\n for (const [presetName, value] of Object.entries(\n parsed.presets as Record<string, unknown>\n )) {\n if (!Array.isArray(value) || !value.every((v) => typeof v === 'string')) {\n throw new ConfigError(\n `Invalid preset '${presetName}': expected array of strings`,\n 'INVALID_PRESET',\n pathToLoad\n );\n }\n defs[presetName] = value as string[];\n }\n\n config.presets = defs;\n }\n\n if (parsed['list-unknown'] !== undefined) {\n if (typeof parsed['list-unknown'] !== 'boolean') {\n throw new ConfigError(\n `Invalid type for 'list-unknown': expected boolean, got ${typeof parsed['list-unknown']}`,\n 'INVALID_TYPE',\n pathToLoad\n );\n }\n config['list-unknown'] = parsed['list-unknown'];\n }\n\n // Warn about unknown options\n const knownKeys = new Set([\n 'output',\n 'template',\n 'features',\n 'preset',\n 'remove-features',\n 'presets',\n 'force',\n 'dry-run',\n 'delete',\n 'refresh',\n 'list-unknown',\n ]);\n for (const key of Object.keys(parsed)) {\n if (!knownKeys.has(key)) {\n logger.warn(`Unknown configuration option: '${key}'`);\n }\n }\n\n return config;\n } catch (error) {\n if (error instanceof ConfigError) {\n throw error;\n }\n\n // TOML parsing error\n throw new ConfigError(\n `Failed to parse TOML configuration: ${error instanceof Error ? error.message : String(error)}`,\n 'PARSE_ERROR',\n pathToLoad\n );\n }\n }\n\n // @awa-impl: CFG-4_AC-1, CFG-4_AC-2, CFG-4_AC-3, CFG-4_AC-4\n // @awa-impl: CLI-2_AC-2, CLI-2_AC-3, CLI-2_AC-4\n merge(cli: RawCliOptions, file: FileConfig | null): ResolvedOptions {\n // CLI arguments override file config values\n // Output can come from CLI (positional argument) or config file\n\n // @awa-impl: CLI-2_AC-2, CLI-2_AC-3\n const output = cli.output ?? file?.output;\n\n // @awa-impl: CLI-1_AC-4, CLI-2_AC-4\n if (!output) {\n throw new ConfigError(\n 'Output directory is required. Provide it as a positional argument or in the config file.',\n 'MISSING_OUTPUT',\n null\n );\n }\n\n const template = cli.template ?? file?.template ?? null;\n\n // Features: CLI completely replaces config (no merge)\n const features = cli.features ?? file?.features ?? [];\n\n const preset = cli.preset ?? file?.preset ?? [];\n const removeFeatures = cli.removeFeatures ?? file?.['remove-features'] ?? [];\n const presets = file?.presets ?? {};\n\n const force = cli.force ?? file?.force ?? false;\n const dryRun = cli.dryRun ?? file?.['dry-run'] ?? false;\n const enableDelete = cli.delete ?? file?.delete ?? false;\n const refresh = cli.refresh ?? file?.refresh ?? false;\n const listUnknown = cli.listUnknown ?? file?.['list-unknown'] ?? false;\n\n return {\n output,\n template,\n features,\n preset,\n removeFeatures,\n force,\n dryRun,\n delete: enableDelete,\n refresh,\n presets,\n listUnknown,\n };\n }\n}\n\nexport const configLoader = new ConfigLoader();\n","// @awa-component: Types-CoreDefinitions\n\n// Custom error classes for diff operations\nexport class DiffError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'DiffError';\n }\n}\n\n// RawCliOptions - CLI argument parser output\nexport interface RawCliOptions {\n output?: string; // Optional positional argument (required if not in config)\n template?: string;\n features?: string[];\n preset?: string[];\n removeFeatures?: string[];\n force?: boolean;\n dryRun?: boolean;\n delete?: boolean;\n config?: string;\n refresh?: boolean;\n listUnknown?: boolean;\n}\n\n// PresetDefinitions - Named feature bundles\nexport interface PresetDefinitions {\n [presetName: string]: string[];\n}\n\n// FileConfig - TOML configuration file structure\nexport interface FileConfig {\n output?: string;\n template?: string;\n features?: string[];\n preset?: string[];\n 'remove-features'?: string[];\n force?: boolean;\n 'dry-run'?: boolean;\n delete?: boolean;\n refresh?: boolean;\n presets?: PresetDefinitions;\n 'list-unknown'?: boolean;\n}\n\n// ResolvedOptions - Fully resolved configuration with defaults applied\nexport interface ResolvedOptions {\n readonly output: string;\n readonly template: string | null;\n readonly features: readonly string[];\n readonly preset: readonly string[];\n readonly removeFeatures: readonly string[];\n readonly force: boolean;\n readonly dryRun: boolean;\n readonly delete: boolean;\n readonly refresh: boolean;\n readonly presets: PresetDefinitions;\n readonly listUnknown: boolean;\n}\n\n// TemplateSourceType - Template source type detection\nexport type TemplateSourceType = 'local' | 'git' | 'bundled';\n\n// ResolvedTemplate - Template source resolution result\nexport interface ResolvedTemplate {\n type: TemplateSourceType;\n localPath: string;\n source: string;\n}\n\n// TemplateContext - Context passed to template engine\nexport interface TemplateContext {\n features: string[];\n}\n\n// RenderResult - Template rendering output\nexport interface RenderResult {\n content: string;\n isEmpty: boolean;\n isEmptyFileMarker: boolean;\n}\n\n// FileAction - Tagged union for file operations\nexport type FileAction =\n | { type: 'create'; sourcePath: string; outputPath: string }\n | { type: 'overwrite'; sourcePath: string; outputPath: string }\n | { type: 'skip-user'; sourcePath: string; outputPath: string }\n | { type: 'skip-empty'; sourcePath: string; outputPath: string }\n | { type: 'skip-equal'; sourcePath: string; outputPath: string }\n | { type: 'delete'; outputPath: string };\n\n// GenerationResult - Aggregated generation outcome\nexport interface GenerationResult {\n readonly actions: readonly FileAction[];\n readonly created: number;\n readonly overwritten: number;\n readonly deleted: number;\n readonly skipped: number;\n readonly skippedEmpty: number;\n readonly skippedUser: number;\n readonly skippedEqual: number;\n}\n\n// GenerateOptions - File generation parameters\nexport interface GenerateOptions {\n templatePath: string;\n outputPath: string;\n features: string[];\n force: boolean;\n dryRun: boolean;\n delete: boolean;\n}\n\n// ConflictChoice - User choice for conflict resolution\nexport type ConflictChoice = 'overwrite' | 'skip';\n\n// ConflictItem - Individual file conflict for batch resolution\nexport interface ConflictItem {\n outputPath: string;\n sourcePath: string;\n newContent: string;\n existingContent: string;\n}\n\n// BatchConflictResolution - Result of batch conflict resolution\nexport interface BatchConflictResolution {\n overwrite: string[]; // List of output paths to overwrite\n skip: string[]; // List of output paths to skip\n equal: string[]; // List of output paths skipped because content is identical\n}\n\n// TemplateFile - Template file metadata\nexport interface TemplateFile {\n path: string;\n absolutePath: string;\n isPartial: boolean;\n}\n\n// DiffOptions - Diff operation parameters\nexport interface DiffOptions {\n templatePath: string;\n targetPath: string;\n features: string[];\n listUnknown: boolean;\n}\n\n// FileDiffStatus - File comparison status\nexport type FileDiffStatus =\n | 'identical'\n | 'modified'\n | 'new'\n | 'extra'\n | 'binary-differs'\n | 'delete-listed';\n\n// FileDiff - Comparison result for a single file\nexport interface FileDiff {\n relativePath: string;\n status: FileDiffStatus;\n unifiedDiff?: string; // Present only for 'modified' text files\n}\n\n// DiffResult - Aggregated diff outcome\nexport interface DiffResult {\n files: FileDiff[];\n identical: number;\n modified: number;\n newFiles: number;\n extraFiles: number;\n binaryDiffers: number;\n deleteListed: number;\n hasDifferences: boolean;\n}\n\n// CachedTemplate - Cached Git template metadata\nexport interface CachedTemplate {\n source: string;\n localPath: string;\n fetchedAt: Date;\n ref?: string;\n}\n\n// Custom error types\nexport class ConfigError extends Error {\n constructor(\n message: string,\n public code:\n | 'FILE_NOT_FOUND'\n | 'PARSE_ERROR'\n | 'INVALID_TYPE'\n | 'MISSING_OUTPUT'\n | 'INVALID_PRESET'\n | 'UNKNOWN_PRESET',\n public filePath?: string | null\n ) {\n super(message);\n this.name = 'ConfigError';\n }\n}\n\nexport class TemplateError extends Error {\n constructor(\n message: string,\n public code: 'SOURCE_NOT_FOUND' | 'FETCH_FAILED' | 'RENDER_ERROR',\n public source?: string\n ) {\n super(message);\n this.name = 'TemplateError';\n }\n}\n\nexport class GenerationError extends Error {\n constructor(\n message: string,\n public code: 'PERMISSION_DENIED' | 'DISK_FULL'\n ) {\n super(message);\n this.name = 'GenerationError';\n }\n}\n","// @awa-component: Utils-FileSystem\n\nimport { mkdir, readdir, readFile, rm, stat, writeFile } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nexport async function ensureDir(dirPath: string): Promise<void> {\n await mkdir(dirPath, { recursive: true });\n}\n\nexport async function pathExists(path: string): Promise<boolean> {\n try {\n await stat(path);\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function isDirectory(path: string): Promise<boolean> {\n try {\n const stats = await stat(path);\n return stats.isDirectory();\n } catch {\n return false;\n }\n}\n\nexport async function readTextFile(path: string): Promise<string> {\n return readFile(path, 'utf-8');\n}\n\nexport async function readBinaryFile(path: string): Promise<Buffer> {\n return readFile(path);\n}\n\nexport async function writeTextFile(path: string, content: string): Promise<void> {\n await ensureDir(dirname(path));\n await writeFile(path, content, 'utf-8');\n}\n\nexport async function* walkDirectory(dir: string): AsyncGenerator<string> {\n const entries = await readdir(dir, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = join(dir, entry.name);\n\n if (entry.isDirectory()) {\n // Skip directories starting with underscore\n if (entry.name.startsWith('_')) {\n continue;\n }\n yield* walkDirectory(fullPath);\n } else if (entry.isFile()) {\n // Skip files starting with underscore\n if (entry.name.startsWith('_')) {\n continue;\n }\n yield fullPath;\n }\n }\n}\n\nexport function getCacheDir(): string {\n return join(homedir(), '.cache', 'awa', 'templates');\n}\n\nexport function getTemplateDir(): string {\n // In built dist, we need to go up from dist/index.js to project root\n // In development, we're in src/utils/fs.ts\n const currentFile = fileURLToPath(import.meta.url);\n const currentDir = dirname(currentFile);\n\n // Check if we're in dist/ or src/\n if (currentDir.includes('/dist')) {\n // In dist: go up one level to project root\n return join(dirname(currentDir), 'templates');\n }\n\n // In src: go up two levels to project root\n return join(currentDir, '..', '..', 'templates');\n}\n\nexport async function rmDir(dirPath: string): Promise<void> {\n await rm(dirPath, { recursive: true, force: true });\n}\n\nexport async function deleteFile(filePath: string): Promise<void> {\n await rm(filePath, { force: true });\n}\n","// @awa-component: GEN-Logger\n// @awa-impl: CLI-6_AC-3\n// @awa-impl: GEN-6_AC-4\n// @awa-impl: GEN-7_AC-1\n// @awa-impl: GEN-7_AC-2\n// @awa-impl: GEN-7_AC-3\n// @awa-impl: GEN-7_AC-4\n// @awa-impl: GEN-9_AC-1\n// @awa-impl: GEN-9_AC-2\n// @awa-impl: GEN-9_AC-3\n// @awa-impl: GEN-9_AC-4\n// @awa-impl: GEN-9_AC-5\n// @awa-impl: GEN-9_AC-6\n// @awa-impl: GEN-11_AC-1\n// @awa-impl: GEN-11_AC-2\n// @awa-impl: GEN-11_AC-4\n// @awa-impl: TPL-7_AC-3\n\nimport chalk from 'chalk';\nimport type { DiffResult, FileAction, GenerationResult } from '../types/index.js';\n\nexport class Logger {\n info(message: string): void {\n console.log(chalk.blue('ℹ'), message);\n }\n\n success(message: string): void {\n console.log(chalk.green('✔'), message);\n }\n\n warn(message: string): void {\n console.warn(chalk.yellow('⚠'), message);\n }\n\n error(message: string): void {\n console.error(chalk.red('✖'), message);\n }\n\n fileAction(action: FileAction): void {\n const { type, outputPath } = action;\n\n switch (type) {\n case 'create':\n console.log(chalk.green(' + '), chalk.dim(outputPath));\n break;\n case 'overwrite':\n console.log(chalk.yellow(' ~ '), chalk.dim(outputPath));\n break;\n case 'skip-user':\n console.log(chalk.blue(' - '), chalk.dim(outputPath), chalk.dim('(skipped)'));\n break;\n case 'skip-empty':\n console.log(chalk.dim(' · '), chalk.dim(outputPath), chalk.dim('(empty)'));\n break;\n case 'skip-equal':\n console.log(chalk.dim(' = '), chalk.dim(outputPath), chalk.dim('(unchanged)'));\n break;\n case 'delete':\n console.log(chalk.red(' ✖ '), chalk.dim(outputPath), chalk.red('(deleted)'));\n break;\n }\n }\n\n // @awa-impl: GEN-9_AC-1, GEN-9_AC-2, GEN-9_AC-3, GEN-9_AC-4, GEN-9_AC-5, GEN-9_AC-6\n summary(result: GenerationResult): void {\n console.log('');\n console.log(chalk.bold('Summary:'));\n\n // @awa-impl: GEN-9_AC-6\n // Check if no files were created, overwritten, or deleted\n if (result.created === 0 && result.overwritten === 0 && result.deleted === 0) {\n console.log(chalk.yellow(' ⚠ No files were created, overwritten, or deleted'));\n }\n\n if (result.created > 0) {\n console.log(chalk.green(` Created: ${result.created}`));\n }\n\n if (result.overwritten > 0) {\n console.log(chalk.yellow(` Overwritten: ${result.overwritten}`));\n }\n\n if (result.deleted > 0) {\n console.log(chalk.red(` Deleted: ${result.deleted}`));\n }\n\n if (result.skippedEqual > 0) {\n console.log(chalk.dim(` Skipped (equal): ${result.skippedEqual}`));\n }\n\n if (result.skippedUser > 0) {\n console.log(chalk.blue(` Skipped (user): ${result.skippedUser}`));\n }\n\n if (result.skippedEmpty > 0) {\n console.log(chalk.dim(` Skipped (empty): ${result.skippedEmpty}`));\n }\n\n console.log('');\n }\n\n // @awa-impl: DIFF-4_AC-3\n diffLine(line: string, type: 'add' | 'remove' | 'context'): void {\n switch (type) {\n case 'add':\n console.log(chalk.green(line));\n break;\n case 'remove':\n console.log(chalk.red(line));\n break;\n case 'context':\n console.log(chalk.dim(line));\n break;\n }\n }\n\n // @awa-impl: DIFF-4_AC-4, DIFF-4_AC-5\n diffSummary(result: DiffResult): void {\n console.log('');\n\n const filesCompared =\n result.identical +\n result.modified +\n result.newFiles +\n result.extraFiles +\n result.binaryDiffers +\n result.deleteListed;\n const differences =\n result.modified +\n result.newFiles +\n result.extraFiles +\n result.binaryDiffers +\n result.deleteListed;\n\n // @awa-impl: DIFF-4_AC-5\n console.log(chalk.bold(`${filesCompared} files compared, ${differences} differences`));\n\n if (!result.hasDifferences) {\n // @awa-impl: DIFF-4_AC-4\n console.log(chalk.green('✔ No differences found'));\n }\n\n // @awa-impl: DIFF-4_AC-5\n console.log(chalk.bold('Summary:'));\n console.log(chalk.dim(` Identical: ${result.identical}`));\n\n if (result.modified > 0) {\n console.log(chalk.yellow(` Modified: ${result.modified}`));\n }\n\n if (result.newFiles > 0) {\n console.log(chalk.green(` New: ${result.newFiles}`));\n }\n\n if (result.extraFiles > 0) {\n console.log(chalk.red(` Extra: ${result.extraFiles}`));\n }\n\n if (result.binaryDiffers > 0) {\n console.log(chalk.red(` Binary differs: ${result.binaryDiffers}`));\n }\n\n if (result.deleteListed > 0) {\n console.log(chalk.red(` Delete listed: ${result.deleteListed}`));\n }\n\n console.log('');\n }\n}\n\nexport const logger = new Logger();\n","// @awa-component: DIFF-DiffEngine\n// @awa-impl: DIFF-1_AC-1\n// @awa-impl: DIFF-1_AC-2\n// @awa-impl: DIFF-1_AC-3\n// @awa-impl: DIFF-2_AC-1\n// @awa-impl: DIFF-2_AC-2\n// @awa-impl: DIFF-2_AC-3\n// @awa-impl: DIFF-2_AC-4\n// @awa-impl: DIFF-2_AC-5\n// @awa-impl: DIFF-3_AC-1\n// @awa-impl: DIFF-3_AC-2\n// @awa-impl: DIFF-3_AC-3\n// @awa-impl: DIFF-4_AC-1\n// @awa-impl: DIFF-4_AC-2\n// @awa-impl: DIFF-5_AC-1\n// @awa-impl: DIFF-5_AC-2\n// @awa-impl: DIFF-5_AC-3\n// @awa-impl: DIFF-6_AC-1\n// @awa-impl: DIFF-6_AC-2\n// @awa-impl: DIFF-6_AC-3\n\nimport { tmpdir } from 'node:os';\nimport { join, relative } from 'node:path';\nimport { structuredPatch } from 'diff';\nimport { isBinaryFile as detectBinaryFile } from 'isbinaryfile';\nimport type { DiffOptions, DiffResult, FileDiff, GenerateOptions } from '../types/index.js';\nimport { ensureDir, pathExists, readBinaryFile, rmDir, walkDirectory } from '../utils/fs.js';\nimport { loadDeleteList, resolveDeleteList } from './delete-list.js';\nimport { fileGenerator } from './generator.js';\n\nexport class DiffEngine {\n // @awa-impl: DIFF-1_AC-1, DIFF-1_AC-2, DIFF-1_AC-3\n // @awa-impl: DIFF-2_AC-1, DIFF-2_AC-2, DIFF-2_AC-3, DIFF-2_AC-4, DIFF-2_AC-5\n // @awa-impl: DIFF-3_AC-1, DIFF-3_AC-2, DIFF-3_AC-3\n // @awa-impl: DIFF-4_AC-1, DIFF-4_AC-2\n // @awa-impl: DIFF-5_AC-1, DIFF-5_AC-2, DIFF-5_AC-3\n // @awa-impl: DIFF-6_AC-1, DIFF-6_AC-2, DIFF-6_AC-3\n async diff(options: DiffOptions): Promise<DiffResult> {\n const { templatePath, targetPath, features, listUnknown } = options;\n\n // @awa-impl: DIFF-1_AC-1, DIFF-1_AC-2\n const tempPath = await this.createTempDir();\n\n try {\n // Generate templates to temp directory\n const generateOptions: GenerateOptions = {\n templatePath,\n outputPath: tempPath,\n features,\n force: true,\n dryRun: false,\n delete: false,\n };\n\n await fileGenerator.generate(generateOptions);\n\n // Collect all files from both directories\n const generatedFiles = new Set<string>();\n const targetFiles = new Set<string>();\n\n // Walk generated directory (if exists - may be empty if template generates nothing)\n if (await pathExists(tempPath)) {\n for await (const file of walkDirectory(tempPath)) {\n const relPath = relative(tempPath, file);\n generatedFiles.add(relPath);\n }\n }\n\n // Walk target directory (if exists)\n if (await pathExists(targetPath)) {\n for await (const file of walkDirectory(targetPath)) {\n const relPath = relative(targetPath, file);\n targetFiles.add(relPath);\n }\n }\n\n // Compare files: iterate generated files first; optionally include target-only files when requested\n const files: FileDiff[] = [];\n\n for (const relPath of generatedFiles) {\n const generatedFilePath = join(tempPath, relPath);\n const targetFilePath = join(targetPath, relPath);\n\n if (targetFiles.has(relPath)) {\n // @awa-impl: DIFF-2_AC-1, DIFF-2_AC-2, DIFF-2_AC-3, DIFF-2_AC-4, DIFF-2_AC-5\n const fileDiff = await this.compareFiles(generatedFilePath, targetFilePath, relPath);\n files.push(fileDiff);\n } else {\n // @awa-impl: DIFF-3_AC-1\n files.push({\n relativePath: relPath,\n status: 'new',\n });\n }\n }\n\n if (listUnknown) {\n for (const relPath of targetFiles) {\n if (generatedFiles.has(relPath)) {\n continue;\n }\n\n // @awa-impl: DIFF-3_AC-2, DIFF-3_AC-3, DIFF-3_AC-4\n files.push({\n relativePath: relPath,\n status: 'extra',\n });\n }\n }\n\n // Check delete list for files that exist in target\n const deleteEntries = await loadDeleteList(templatePath);\n const deleteList = resolveDeleteList(deleteEntries, features ?? []);\n for (const relPath of deleteList) {\n if (targetFiles.has(relPath) && !generatedFiles.has(relPath)) {\n // Remove any existing 'extra' entry for this path (to avoid double-reporting)\n const existingIdx = files.findIndex(\n (f) => f.relativePath === relPath && f.status === 'extra'\n );\n if (existingIdx !== -1) {\n files.splice(existingIdx, 1);\n }\n files.push({\n relativePath: relPath,\n status: 'delete-listed',\n });\n }\n }\n\n // Calculate summary\n const identical = files.filter((f) => f.status === 'identical').length;\n const modified = files.filter((f) => f.status === 'modified').length;\n const newFiles = files.filter((f) => f.status === 'new').length;\n const extraFiles = files.filter((f) => f.status === 'extra').length;\n const binaryDiffers = files.filter((f) => f.status === 'binary-differs').length;\n const deleteListed = files.filter((f) => f.status === 'delete-listed').length;\n\n const hasDifferences =\n modified > 0 || newFiles > 0 || extraFiles > 0 || binaryDiffers > 0 || deleteListed > 0;\n\n return {\n files,\n identical,\n modified,\n newFiles,\n extraFiles,\n binaryDiffers,\n deleteListed,\n hasDifferences,\n };\n } finally {\n // @awa-impl: DIFF-6_AC-1, DIFF-6_AC-2, DIFF-6_AC-3\n await this.cleanupTempDir(tempPath);\n }\n }\n\n // @awa-impl: DIFF-1_AC-1, DIFF-1_AC-2\n async createTempDir(): Promise<string> {\n const systemTemp = tmpdir();\n const timestamp = Date.now();\n const random = Math.random().toString(36).substring(2, 8);\n const tempPath = join(systemTemp, `awa-diff-${timestamp}-${random}`);\n\n await ensureDir(tempPath);\n return tempPath;\n }\n\n // @awa-impl: DIFF-6_AC-1, DIFF-6_AC-2, DIFF-6_AC-3\n async cleanupTempDir(tempPath: string): Promise<void> {\n try {\n if (await pathExists(tempPath)) {\n await rmDir(tempPath);\n }\n } catch (_error) {\n // Swallow cleanup errors - temp directory will be cleaned by OS eventually\n // This ensures cleanup errors don't mask the actual diff results\n }\n }\n\n // @awa-impl: DIFF-2_AC-1, DIFF-2_AC-2, DIFF-2_AC-3, DIFF-2_AC-4, DIFF-2_AC-5\n async compareFiles(\n generatedPath: string,\n targetPath: string,\n relativePath: string\n ): Promise<FileDiff> {\n // Read raw bytes for byte-for-byte comparison.\n const generatedBytes = await readBinaryFile(generatedPath);\n const targetBytes = await readBinaryFile(targetPath);\n\n // @awa-impl: DIFF-2_AC-1, DIFF-2_AC-3\n if (generatedBytes.equals(targetBytes)) {\n return {\n relativePath,\n status: 'identical',\n };\n }\n\n // @awa-impl: DIFF-2_AC-5\n // If either side is binary, do not attempt a text diff.\n const isBinaryGenerated = await this.isBinaryFile(generatedPath);\n const isBinaryTarget = await this.isBinaryFile(targetPath);\n\n if (isBinaryGenerated || isBinaryTarget) {\n return {\n relativePath,\n status: 'binary-differs',\n };\n }\n\n // Text files: unified diff (diff library is text-based)\n const generatedContent = generatedBytes.toString('utf-8');\n const targetContent = targetBytes.toString('utf-8');\n\n // @awa-impl: DIFF-2_AC-4\n // Generate unified diff\n const patch = structuredPatch(\n `a/${relativePath}`,\n `b/${relativePath}`,\n targetContent,\n generatedContent,\n 'target',\n 'generated',\n {\n context: 3,\n }\n );\n\n // Format as git-style unified diff string (with file headers)\n const headerLines = [\n `diff --git a/${relativePath} b/${relativePath}`,\n `--- a/${relativePath}`,\n `+++ b/${relativePath}`,\n ];\n\n const hunkLines = patch.hunks.flatMap((hunk) => {\n const lines = [`@@ -${hunk.oldStart},${hunk.oldLines} +${hunk.newStart},${hunk.newLines} @@`];\n lines.push(...hunk.lines);\n return lines;\n });\n\n const unifiedDiff = [...headerLines, ...hunkLines].join('\\n');\n\n return {\n relativePath,\n status: 'modified',\n unifiedDiff,\n };\n }\n\n // @awa-impl: DIFF-2_AC-5\n async isBinaryFile(filePath: string): Promise<boolean> {\n try {\n return await detectBinaryFile(filePath);\n } catch {\n // If detection fails, assume text file\n return false;\n }\n }\n}\n\nexport const diffEngine = new DiffEngine();\n","// @awa-component: GEN-DeleteList\n\nimport { join } from 'node:path';\nimport { pathExists, readTextFile } from '../utils/fs.js';\n\nconst DELETE_LIST_FILENAME = '_delete.txt';\n\n/**\n * A delete list entry. When `features` is set, the path is only deleted\n * when NONE of those features are present in the active feature set\n * (stale tool cleanup). When `features` is absent, the path is always\n * deleted (legacy removal).\n */\nexport interface DeleteEntry {\n path: string;\n /** One or more feature names — keep (don't delete) if any is active. */\n features?: string[];\n}\n\n/**\n * Parse `_delete.txt` content into structured entries.\n *\n * Format:\n * - Blank lines and `#` comments are ignored.\n * - `# @feature <name> [<name2> ...]` starts a feature-gated section: subsequent\n * paths are deleted only when NONE of the listed features are active.\n * - Any other comment line clears the current feature section (returns to\n * always-delete behaviour).\n * - Path lines inherit the current section's feature tag (if any).\n */\nexport function parseDeleteList(content: string): DeleteEntry[] {\n const entries: DeleteEntry[] = [];\n let currentFeatures: string[] | undefined;\n\n for (const raw of content.split('\\n')) {\n const line = raw.trim();\n if (line.length === 0) continue;\n\n if (line.startsWith('#')) {\n const featureMatch = line.match(/^#\\s*@feature\\s+(.+)$/);\n if (featureMatch) {\n const featureSection = featureMatch[1];\n currentFeatures = featureSection ? featureSection.trim().split(/\\s+/) : undefined;\n } else {\n // Any other comment resets the feature section\n currentFeatures = undefined;\n }\n continue;\n }\n\n entries.push({ path: line, features: currentFeatures });\n }\n\n return entries;\n}\n\n/**\n * Resolve which paths from the delete list should actually be deleted,\n * given the currently active feature flags.\n *\n * - Entries without a feature tag are always included (legacy removals).\n * - Entries with feature tags are included only when NONE of those features are active\n * (stale tool output cleanup).\n */\nexport function resolveDeleteList(entries: DeleteEntry[], activeFeatures: string[]): string[] {\n const activeSet = new Set(activeFeatures);\n return entries\n .filter((e) => e.features === undefined || !e.features.some((f) => activeSet.has(f)))\n .map((e) => e.path);\n}\n\n/**\n * Load and parse `_delete.txt` from the template directory.\n * Returns empty array if the file does not exist.\n */\nexport async function loadDeleteList(templatePath: string): Promise<DeleteEntry[]> {\n const deleteListPath = join(templatePath, DELETE_LIST_FILENAME);\n\n if (!(await pathExists(deleteListPath))) {\n return [];\n }\n\n const content = await readTextFile(deleteListPath);\n return parseDeleteList(content);\n}\n","// @awa-component: GEN-FileGenerator\n// @awa-impl: GEN-1_AC-1\n// @awa-impl: GEN-1_AC-2\n// @awa-impl: GEN-1_AC-3\n// @awa-impl: GEN-2_AC-1\n// @awa-impl: GEN-2_AC-2\n// @awa-impl: GEN-2_AC-3\n// @awa-impl: GEN-3_AC-1\n// @awa-impl: GEN-3_AC-2\n// @awa-impl: GEN-3_AC-3\n// @awa-impl: GEN-8_AC-1\n// @awa-impl: GEN-8_AC-2\n// @awa-impl: GEN-8_AC-3\n// @awa-impl: GEN-11_AC-3\n// @awa-impl: TPL-9_AC-1\n// @awa-impl: TPL-9_AC-2\n\nimport { join, relative } from 'node:path';\nimport {\n type ConflictItem,\n type FileAction,\n type GenerateOptions,\n GenerationError,\n type GenerationResult,\n} from '../types/index.js';\nimport { deleteFile, pathExists, readTextFile, walkDirectory, writeTextFile } from '../utils/fs.js';\nimport { logger } from '../utils/logger.js';\nimport { loadDeleteList, resolveDeleteList } from './delete-list.js';\nimport { conflictResolver, deleteResolver } from './resolver.js';\nimport { templateEngine } from './template.js';\n\nexport class FileGenerator {\n // @awa-impl: GEN-1_AC-1, GEN-1_AC-2, GEN-1_AC-3\n // @awa-impl: GEN-2_AC-1, GEN-2_AC-2, GEN-2_AC-3\n // @awa-impl: GEN-3_AC-1, GEN-3_AC-2, GEN-3_AC-3\n async generate(options: GenerateOptions): Promise<GenerationResult> {\n const { templatePath, outputPath, features, force, dryRun } = options;\n const enableDelete = options.delete;\n\n // Configure template engine\n templateEngine.configure(templatePath);\n\n const actions: FileAction[] = [];\n let created = 0;\n let overwritten = 0;\n let deleted = 0;\n let skippedEmpty = 0;\n let skippedUser = 0;\n let skippedEqual = 0;\n\n // Collect files to process\n interface FileToProcess {\n templateFile: string;\n outputFile: string;\n content: string;\n isNew: boolean;\n }\n\n const filesToProcess: FileToProcess[] = [];\n const conflicts: ConflictItem[] = [];\n\n try {\n // First pass: render all templates and categorize files\n for await (const templateFile of this.walkTemplates(templatePath)) {\n // Compute output path\n const outputFile = this.computeOutputPath(templateFile, templatePath, outputPath);\n\n // Render template\n const result = await templateEngine.render(templateFile, { features });\n\n // Handle empty output\n if (result.isEmpty && !result.isEmptyFileMarker) {\n // Skip empty files\n actions.push({\n type: 'skip-empty',\n sourcePath: templateFile,\n outputPath: outputFile,\n });\n skippedEmpty++;\n continue;\n }\n\n // Get final content (empty string if marker)\n const content = result.isEmptyFileMarker ? '' : result.content;\n\n // Check for conflicts\n const fileExists = await pathExists(outputFile);\n\n if (fileExists) {\n // Read existing content for comparison\n const existingContent = await readTextFile(outputFile);\n conflicts.push({\n outputPath: outputFile,\n sourcePath: templateFile,\n newContent: content,\n existingContent,\n });\n }\n\n filesToProcess.push({\n templateFile,\n outputFile,\n content,\n isNew: !fileExists,\n });\n }\n\n // Resolve all conflicts at once if there are any\n let resolution: { overwrite: string[]; skip: string[]; equal: string[] } = {\n overwrite: [],\n skip: [],\n equal: [],\n };\n if (conflicts.length > 0) {\n resolution = await conflictResolver.resolveBatch(conflicts, force, dryRun);\n }\n\n // Second pass: process files based on resolution\n for (const file of filesToProcess) {\n if (file.isNew) {\n // Create new file\n if (!dryRun) {\n await writeTextFile(file.outputFile, file.content);\n }\n actions.push({\n type: 'create',\n sourcePath: file.templateFile,\n outputPath: file.outputFile,\n });\n created++;\n logger.fileAction({\n type: 'create',\n sourcePath: file.templateFile,\n outputPath: file.outputFile,\n });\n } else if (resolution.overwrite.includes(file.outputFile)) {\n // Overwrite existing file\n if (!dryRun) {\n await writeTextFile(file.outputFile, file.content);\n }\n actions.push({\n type: 'overwrite',\n sourcePath: file.templateFile,\n outputPath: file.outputFile,\n });\n overwritten++;\n logger.fileAction({\n type: 'overwrite',\n sourcePath: file.templateFile,\n outputPath: file.outputFile,\n });\n } else if (resolution.equal.includes(file.outputFile)) {\n // Skip file — content is identical\n actions.push({\n type: 'skip-equal',\n sourcePath: file.templateFile,\n outputPath: file.outputFile,\n });\n skippedEqual++;\n logger.fileAction({\n type: 'skip-equal',\n sourcePath: file.templateFile,\n outputPath: file.outputFile,\n });\n } else if (resolution.skip.includes(file.outputFile)) {\n // Skip file — user declined overwrite\n actions.push({\n type: 'skip-user',\n sourcePath: file.templateFile,\n outputPath: file.outputFile,\n });\n skippedUser++;\n logger.fileAction({\n type: 'skip-user',\n sourcePath: file.templateFile,\n outputPath: file.outputFile,\n });\n }\n }\n\n // Process delete list (after file generation)\n const deleteEntries = await loadDeleteList(templatePath);\n if (deleteEntries.length > 0) {\n const deleteList = resolveDeleteList(deleteEntries, features);\n\n // Collect generated output paths to detect conflicts\n const generatedOutputPaths = new Set(filesToProcess.map((f) => f.outputFile));\n\n // Filter: only files that exist and aren't being generated\n const deleteCandidates: string[] = [];\n for (const relPath of deleteList) {\n const absPath = join(outputPath, relPath);\n if (generatedOutputPaths.has(absPath)) {\n logger.warn(\n `Delete list entry '${relPath}' conflicts with generated file — skipping deletion`\n );\n continue;\n }\n if (await pathExists(absPath)) {\n deleteCandidates.push(absPath);\n }\n }\n\n if (deleteCandidates.length > 0) {\n if (!enableDelete) {\n // --delete not passed: warn but do nothing\n for (const absPath of deleteCandidates) {\n logger.warn(\n `Would delete (pass --delete to enable): ${relative(outputPath, absPath)}`\n );\n }\n } else {\n const confirmed = await deleteResolver.resolveDeletes(deleteCandidates, force, dryRun);\n\n for (const absPath of confirmed) {\n if (!dryRun) {\n await deleteFile(absPath);\n }\n actions.push({ type: 'delete', outputPath: absPath });\n deleted++;\n logger.fileAction({ type: 'delete', outputPath: absPath });\n }\n }\n }\n }\n\n return {\n actions,\n created,\n overwritten,\n deleted,\n skipped: skippedEmpty + skippedUser + skippedEqual,\n skippedEmpty,\n skippedUser,\n skippedEqual,\n };\n } catch (error) {\n // @awa-impl: GEN-2_AC-3, GEN-11_AC-3\n if (error instanceof Error && 'code' in error) {\n const code = (error as NodeJS.ErrnoException).code;\n if (code === 'EACCES' || code === 'EPERM') {\n throw new GenerationError(`Permission denied: ${error.message}`, 'PERMISSION_DENIED');\n }\n if (code === 'ENOSPC') {\n throw new GenerationError(`Disk full: ${error.message}`, 'DISK_FULL');\n }\n }\n throw error;\n }\n }\n\n // @awa-impl: GEN-8_AC-1, GEN-8_AC-2, GEN-8_AC-3\n // @awa-impl: TPL-9_AC-1, TPL-9_AC-2\n async *walkTemplates(dir: string): AsyncIterable<string> {\n // Use utility function that already handles underscore exclusion\n yield* walkDirectory(dir);\n }\n\n // @awa-impl: GEN-1_AC-1, GEN-1_AC-2, GEN-1_AC-3\n computeOutputPath(templatePath: string, templateRoot: string, outputRoot: string): string {\n // Get relative path from template root\n const relativePath = relative(templateRoot, templatePath);\n\n // Join with output root to mirror structure\n return join(outputRoot, relativePath);\n }\n}\n\nexport const fileGenerator = new FileGenerator();\n","// @awa-component: GEN-ConflictResolver\n// @awa-impl: CLI-5_AC-2\n// @awa-impl: CLI-5_AC-3\n// @awa-impl: GEN-4_AC-1\n// @awa-impl: GEN-4_AC-2\n// @awa-impl: GEN-4_AC-3\n// @awa-impl: GEN-5_AC-1\n// @awa-impl: GEN-5_AC-2\n// @awa-impl: GEN-5_AC-3\n// @awa-impl: GEN-5_AC-4\n// @awa-impl: GEN-5_AC-5\n// @awa-impl: GEN-5_AC-6\n// @awa-impl: GEN-5_AC-7\n// @awa-impl: GEN-6_AC-3\n// @awa-impl: GEN-10_AC-3\n\nimport { MultiSelectPrompt } from '@clack/core';\nimport { isCancel, multiselect } from '@clack/prompts';\nimport chalk from 'chalk';\nimport type { BatchConflictResolution, ConflictItem } from '../types/index.js';\n\n// Unicode symbols (mirrors @clack/prompts internals)\nconst _unicode = process.platform !== 'win32';\nconst _s = (c: string, fb: string) => (_unicode ? c : fb);\nconst _CHECKED = _s('\\u25FC', '[+]'); // ◼\nconst _UNCHECKED_A = _s('\\u25FB', '[·]'); // ◻ active\nconst _UNCHECKED = _s('\\u25FB', '[ ]'); // ◻ inactive\nconst _BAR = _s('\\u2502', '|'); // │\nconst _BAR_END = _s('\\u2514', '-'); // └\n\ntype SelectOption = { value: string; label?: string; hint?: string };\n\nfunction _renderDeleteItem(opt: SelectOption, state: string): string {\n const label = opt.label ?? opt.value;\n const hint = opt.hint ? ` ${chalk.dim(`(${opt.hint})`)}` : '';\n switch (state) {\n case 'active':\n return `${chalk.cyan(_UNCHECKED_A)} ${label}${hint}`;\n case 'selected':\n return `${chalk.red(_CHECKED)} ${chalk.dim(label)}${hint}`;\n case 'active-selected':\n return `${chalk.red(_CHECKED)} ${label}${hint}`;\n case 'cancelled':\n return chalk.strikethrough(chalk.dim(label));\n case 'submitted':\n return chalk.dim(label);\n default:\n return `${chalk.dim(_UNCHECKED)} ${chalk.dim(label)}`;\n }\n}\n\n/** Like @clack/prompts `multiselect` but with red checkboxes for destructive operations. */\nasync function deleteMultiselect(opts: {\n message: string;\n options: SelectOption[];\n initialValues?: string[];\n required?: boolean;\n}): Promise<string[] | symbol> {\n const { message, options, initialValues, required = false } = opts;\n return new MultiSelectPrompt({\n options,\n initialValues,\n required,\n render() {\n const self = this as unknown as {\n state: string;\n options: SelectOption[];\n cursor: number;\n value: string[];\n };\n const header = `${chalk.gray(_BAR)}\\n${chalk.cyan(_BAR)} ${message}\\n`;\n const getState = (opt: SelectOption, idx: number): string => {\n const active = idx === self.cursor;\n const sel = self.value.includes(opt.value);\n if (active && sel) return 'active-selected';\n if (sel) return 'selected';\n if (active) return 'active';\n return 'inactive';\n };\n switch (self.state) {\n case 'submit':\n return (\n `${header}${chalk.gray(_BAR)} ` +\n (self.options\n .filter((o) => self.value.includes(o.value))\n .map((o) => _renderDeleteItem(o, 'submitted'))\n .join(chalk.dim(', ')) || chalk.dim('none'))\n );\n case 'cancel': {\n const cancelled = self.options\n .filter((o) => self.value.includes(o.value))\n .map((o) => _renderDeleteItem(o, 'cancelled'))\n .join(chalk.dim(', '));\n return `${header}${chalk.gray(_BAR)} ${cancelled.trim() ? `${cancelled}\\n${chalk.gray(_BAR)}` : chalk.dim('none')}`;\n }\n default:\n return (\n `${header}${chalk.cyan(_BAR)} ` +\n self.options\n .map((o, i) => _renderDeleteItem(o, getState(o, i)))\n .join(`\\n${chalk.cyan(_BAR)} `) +\n `\\n${chalk.cyan(_BAR_END)}\\n`\n );\n }\n },\n }).prompt() as Promise<string[] | symbol>;\n}\n\nexport class ConflictResolver {\n // @awa-impl: GEN-4_AC-1, GEN-4_AC-2, GEN-4_AC-3\n // @awa-impl: GEN-5_AC-1, GEN-5_AC-2, GEN-5_AC-3, GEN-5_AC-4, GEN-5_AC-5, GEN-5_AC-6, GEN-5_AC-7\n // @awa-impl: CLI-5_AC-2, CLI-5_AC-3\n // @awa-impl: GEN-6_AC-3\n async resolveBatch(\n conflicts: ConflictItem[],\n force: boolean,\n dryRun: boolean\n ): Promise<BatchConflictResolution> {\n // Separate identical-content files from different files\n const identicalPaths = conflicts\n .filter((c) => c.newContent === c.existingContent)\n .map((c) => c.outputPath);\n const differentFiles = conflicts.filter((c) => c.newContent !== c.existingContent);\n\n // In dry-run mode, never modify files (P7: Dry Run Immutable)\n if (dryRun) {\n return {\n overwrite: [],\n skip: differentFiles.map((c) => c.outputPath),\n equal: identicalPaths,\n };\n }\n\n // In force mode, always overwrite without prompting (P8: Force No Prompt)\n if (force) {\n return {\n overwrite: differentFiles.map((c) => c.outputPath),\n skip: [],\n equal: identicalPaths,\n };\n }\n\n // If all files are identical, skip them all\n if (differentFiles.length === 0) {\n return {\n overwrite: [],\n skip: [],\n equal: identicalPaths,\n };\n }\n\n // @awa-impl: GEN-5_AC-1, GEN-5_AC-2, GEN-5_AC-5, GEN-5_AC-6\n // Prompt user with multi-select (all selected by default)\n const selected = await multiselect({\n message: 'The following files already exist. Select files to overwrite:',\n options: differentFiles.map((c) => ({\n value: c.outputPath,\n label: c.outputPath,\n })),\n initialValues: differentFiles.map((c) => c.outputPath), // All selected by default (AC-5.6)\n required: false,\n });\n\n // @awa-impl: GEN-10_AC-3\n // Handle user cancellation (Ctrl+C)\n if (isCancel(selected)) {\n process.exit(1);\n }\n\n const selectedPaths = selected as string[];\n const allPaths = differentFiles.map((c) => c.outputPath);\n\n return {\n overwrite: selectedPaths,\n skip: allPaths.filter((p) => !selectedPaths.includes(p)),\n equal: identicalPaths,\n };\n }\n}\n\nexport const conflictResolver = new ConflictResolver();\n\nexport class DeleteResolver {\n /**\n * Prompt user to confirm which files to delete.\n * Returns the list of absolute paths confirmed for deletion.\n */\n async resolveDeletes(candidates: string[], force: boolean, dryRun: boolean): Promise<string[]> {\n if (candidates.length === 0) {\n return [];\n }\n\n // In dry-run mode, return all candidates (caller logs but won't delete)\n if (dryRun) {\n return candidates;\n }\n\n // In force mode, delete without prompting\n if (force) {\n return candidates;\n }\n\n // Prompt user with multi-select (all selected by default, red checkboxes)\n const selected = await deleteMultiselect({\n message:\n '⚠ WARNING: The selected files will be PERMANENTLY DELETED from disk.\\n' +\n ' Deselect any files you want to keep. Press Enter to confirm deletion:',\n options: candidates.map((p) => ({\n value: p,\n label: p,\n })),\n initialValues: candidates,\n required: false,\n });\n\n // Handle user cancellation (Ctrl+C)\n if (isCancel(selected)) {\n process.exit(1);\n }\n\n return selected as string[];\n }\n}\n\nexport const deleteResolver = new DeleteResolver();\n","// @awa-component: TPL-TemplateEngine\n// @awa-impl: TPL-4_AC-1\n// @awa-impl: TPL-4_AC-2\n// @awa-impl: TPL-4_AC-3\n// @awa-impl: TPL-4_AC-4\n// @awa-impl: TPL-5_AC-1\n// @awa-impl: TPL-5_AC-2\n// @awa-impl: TPL-5_AC-3\n// @awa-impl: TPL-6_AC-1\n// @awa-impl: TPL-6_AC-2\n// @awa-impl: TPL-7_AC-1\n// @awa-impl: TPL-7_AC-2\n// @awa-impl: TPL-8_AC-1\n// @awa-impl: TPL-8_AC-2\n// @awa-impl: TPL-8_AC-3\n// @awa-impl: TPL-8_AC-4\n// @awa-impl: TPL-11_AC-1\n// @awa-impl: TPL-11_AC-2\n\nimport { Eta } from 'eta';\nimport { type RenderResult, type TemplateContext, TemplateError } from '../types/index.js';\nimport { readTextFile } from '../utils/fs.js';\n\nconst EMPTY_FILE_MARKER = '<!-- AWA:EMPTY_FILE -->';\n\nexport class TemplateEngine {\n private eta: Eta | null = null;\n private templateDir: string | null = null;\n private compiledCache = new Map<string, unknown>();\n\n // @awa-impl: TPL-8_AC-1, TPL-8_AC-2, TPL-8_AC-3, TPL-8_AC-4\n configure(templateDir: string): void {\n this.templateDir = templateDir;\n this.compiledCache.clear();\n\n // @awa-impl: TPL-4_AC-1, TPL-4_AC-2, TPL-4_AC-3, TPL-4_AC-4\n // Configure Eta with partials support\n this.eta = new Eta({\n views: templateDir,\n cache: true, // Enable compilation caching\n autoEscape: false, // Don't escape HTML by default\n defaultExtension: '', // No automatic extension - use exact path as specified (AC-8.2)\n });\n }\n\n // @awa-impl: TPL-5_AC-1, TPL-5_AC-2, TPL-5_AC-3\n // @awa-impl: TPL-6_AC-1, TPL-6_AC-2\n // @awa-impl: TPL-7_AC-1, TPL-7_AC-2\n // @awa-impl: TPL-11_AC-1, TPL-11_AC-2\n async render(templatePath: string, context: TemplateContext): Promise<RenderResult> {\n if (!this.eta || !this.templateDir) {\n throw new TemplateError(\n 'Template engine not configured. Call configure() first.',\n 'RENDER_ERROR'\n );\n }\n\n try {\n // Read template content\n const templateContent = await readTextFile(templatePath);\n\n // Render with features context\n // The context is available as 'it' in templates\n const rendered = await this.eta.renderStringAsync(templateContent, {\n features: context.features,\n });\n\n // Check if output is empty or only whitespace\n const trimmed = rendered.trim();\n const isEmpty = trimmed.length === 0;\n\n // Check for empty file marker\n const isEmptyFileMarker = trimmed === EMPTY_FILE_MARKER;\n\n return {\n content: rendered,\n isEmpty,\n isEmptyFileMarker,\n };\n } catch (error) {\n throw new TemplateError(\n `Failed to render template ${templatePath}: ${error instanceof Error ? error.message : String(error)}`,\n 'RENDER_ERROR',\n templatePath\n );\n }\n }\n}\n\nexport const templateEngine = new TemplateEngine();\n","// @awa-component: FP-FeatureResolver\n\nimport { ConfigError, type PresetDefinitions } from '../types/index.js';\n\nexport interface FeatureResolutionInput {\n baseFeatures: string[];\n presetNames: string[];\n removeFeatures: string[];\n presetDefinitions: PresetDefinitions;\n}\n\nexport class FeatureResolver {\n validatePresets(presetNames: string[], definitions: PresetDefinitions): void {\n for (const name of presetNames) {\n if (!definitions[name]) {\n throw new ConfigError(`Unknown preset: ${name}`, 'UNKNOWN_PRESET');\n }\n }\n }\n\n resolve(input: FeatureResolutionInput): string[] {\n const { baseFeatures, presetNames, removeFeatures, presetDefinitions } = input;\n\n this.validatePresets(presetNames, presetDefinitions);\n\n const finalFeatures: string[] = [];\n const seen = new Set<string>();\n\n const add = (feature: string) => {\n if (seen.has(feature)) return;\n seen.add(feature);\n finalFeatures.push(feature);\n };\n\n for (const feature of baseFeatures) add(feature);\n\n for (const presetName of presetNames) {\n for (const feature of presetDefinitions[presetName] ?? []) add(feature);\n }\n\n if (removeFeatures.length === 0) return finalFeatures;\n\n const removeSet = new Set(removeFeatures);\n return finalFeatures.filter((f) => !removeSet.has(f));\n }\n}\n\nexport const featureResolver = new FeatureResolver();\n","// @awa-component: TPL-TemplateResolver\n// @awa-impl: CLI-3_AC-2\n// @awa-impl: CLI-3_AC-3\n// @awa-impl: CLI-8_AC-2\n// @awa-impl: TPL-1_AC-1\n// @awa-impl: TPL-1_AC-2\n// @awa-impl: TPL-1_AC-3\n// @awa-impl: TPL-1_AC-4\n// @awa-impl: TPL-2_AC-1\n// @awa-impl: TPL-2_AC-2\n// @awa-impl: TPL-2_AC-3\n// @awa-impl: TPL-2_AC-4\n// @awa-impl: TPL-2_AC-5\n// @awa-impl: TPL-2_AC-6\n// @awa-impl: TPL-3_AC-1\n// @awa-impl: TPL-3_AC-2\n// @awa-impl: TPL-3_AC-3\n// @awa-impl: TPL-3_AC-4\n// @awa-impl: TPL-10_AC-1\n// @awa-impl: TPL-10_AC-2\n// @awa-impl: TPL-10_AC-3\n\nimport { createHash } from 'node:crypto';\nimport { rm } from 'node:fs/promises';\nimport { isAbsolute, join, resolve } from 'node:path';\nimport degit from 'degit';\nimport { type ResolvedTemplate, TemplateError, type TemplateSourceType } from '../types/index.js';\nimport { ensureDir, getCacheDir, getTemplateDir, pathExists } from '../utils/fs.js';\nimport { logger } from '../utils/logger.js';\n\nexport class TemplateResolver {\n // @awa-impl: CLI-3_AC-2, TPL-10_AC-1\n async resolve(source: string | null, refresh: boolean): Promise<ResolvedTemplate> {\n // If no source provided, use bundled templates\n if (!source) {\n const bundledPath = join(getTemplateDir(), 'awa');\n return {\n type: 'bundled',\n localPath: bundledPath,\n source: 'bundled',\n };\n }\n\n const type = this.detectType(source);\n\n // @awa-impl: TPL-1_AC-1, TPL-1_AC-2, TPL-1_AC-3, TPL-1_AC-4\n if (type === 'local') {\n // Resolve relative/absolute paths\n const localPath = isAbsolute(source) ? source : resolve(process.cwd(), source);\n\n // Check if path exists\n if (!(await pathExists(localPath))) {\n throw new TemplateError(\n `Template source not found: ${localPath}`,\n 'SOURCE_NOT_FOUND',\n source\n );\n }\n\n // Local templates are not cached\n return {\n type: 'local',\n localPath,\n source,\n };\n }\n\n // @awa-impl: TPL-2_AC-1 through TPL-2_AC-6, TPL-3_AC-1 through TPL-3_AC-4\n if (type === 'git') {\n const cachePath = this.getCachePath(source);\n\n // @awa-impl: CLI-8_AC-2, TPL-3_AC-2\n // Check if cached version exists\n const cacheExists = await pathExists(cachePath);\n\n if (cacheExists && !refresh) {\n // Use cached version\n logger.info(`Using cached template: ${source}`);\n return {\n type: 'git',\n localPath: cachePath,\n source,\n };\n }\n\n // Fetch from Git\n try {\n // Remove existing cache if refresh\n if (cacheExists && refresh) {\n logger.info(`Refreshing template: ${source}`);\n await rm(cachePath, { recursive: true, force: true });\n } else {\n logger.info(`Fetching template: ${source}`);\n }\n\n await ensureDir(cachePath);\n\n // Use degit for shallow fetch\n const emitter = degit(source, { cache: false, force: true });\n await emitter.clone(cachePath);\n\n return {\n type: 'git',\n localPath: cachePath,\n source,\n };\n } catch (error) {\n throw new TemplateError(\n `Failed to fetch Git template: ${error instanceof Error ? error.message : String(error)}`,\n 'FETCH_FAILED',\n source\n );\n }\n }\n\n throw new TemplateError(\n `Unable to resolve template source: ${source}`,\n 'SOURCE_NOT_FOUND',\n source\n );\n }\n\n // @awa-impl: TPL-2_AC-1 through TPL-2_AC-6\n detectType(source: string): TemplateSourceType {\n // Check for local path indicators\n if (source.startsWith('.') || source.startsWith('/') || source.startsWith('~')) {\n return 'local';\n }\n\n // Check for Windows absolute paths\n if (/^[a-zA-Z]:/.test(source)) {\n return 'local';\n }\n\n // All other formats are treated as Git sources:\n // - GitHub shorthand: owner/repo\n // - Prefixed: github:owner/repo, gitlab:owner/repo, bitbucket:owner/repo\n // - HTTPS: https://github.com/owner/repo\n // - SSH: git@github.com:owner/repo\n // - With subdirs: owner/repo/path/to/templates\n // - With refs: owner/repo#branch\n return 'git';\n }\n\n // @awa-impl: TPL-3_AC-1\n getCachePath(source: string): string {\n // Create a stable cache path based on source hash\n const hash = createHash('sha256').update(source).digest('hex').substring(0, 16);\n const cacheDir = getCacheDir();\n return join(cacheDir, hash);\n }\n}\n\nexport const templateResolver = new TemplateResolver();\n","// @awa-component: GEN-GenerateCommand\n\nimport { intro, isCancel, multiselect, outro } from '@clack/prompts';\nimport { configLoader } from '../core/config.js';\nimport { featureResolver } from '../core/feature-resolver.js';\nimport { fileGenerator } from '../core/generator.js';\nimport { templateResolver } from '../core/template-resolver.js';\nimport type { RawCliOptions } from '../types/index.js';\nimport { logger } from '../utils/logger.js';\n\n/** Known AI tool feature flags for interactive selection. */\nconst TOOL_FEATURES = [\n { value: 'copilot', label: 'GitHub Copilot' },\n { value: 'claude', label: 'Claude Code' },\n { value: 'cursor', label: 'Cursor' },\n { value: 'windsurf', label: 'Windsurf' },\n { value: 'kilocode', label: 'Kilocode' },\n { value: 'opencode', label: 'OpenCode' },\n { value: 'gemini', label: 'Gemini CLI' },\n { value: 'roo', label: 'Roo Code' },\n { value: 'qwen', label: 'Qwen Code' },\n { value: 'codex', label: 'Codex CLI' },\n { value: 'agy', label: 'Antigravity (agy)' },\n { value: 'agents-md', label: 'AGENTS.md (cross-tool)' },\n] as const;\n\nconst TOOL_FEATURE_VALUES = new Set<string>(TOOL_FEATURES.map((t) => t.value));\n\nexport async function generateCommand(cliOptions: RawCliOptions): Promise<void> {\n try {\n intro('awa CLI - Template Generator');\n\n // Load configuration file\n const fileConfig = await configLoader.load(cliOptions.config ?? null);\n\n // Merge CLI and file config\n const options = configLoader.merge(cliOptions, fileConfig);\n\n // Resolve template source\n const template = await templateResolver.resolve(options.template, options.refresh);\n\n const features = featureResolver.resolve({\n baseFeatures: [...options.features],\n presetNames: [...options.preset],\n removeFeatures: [...options.removeFeatures],\n presetDefinitions: options.presets,\n });\n\n // @awa-impl: MTT-1_AC-1\n // If no tool feature flag is present, prompt the user to select tools interactively\n const hasToolFlag = features.some((f) => TOOL_FEATURE_VALUES.has(f));\n if (!hasToolFlag) {\n const selected = await multiselect({\n message: 'Select AI tools to generate for (space to toggle, enter to confirm):',\n options: TOOL_FEATURES.map((t) => ({ value: t.value, label: t.label })),\n required: true,\n });\n if (isCancel(selected)) {\n logger.info('Generation cancelled.');\n process.exit(0);\n }\n features.push(...(selected as string[]));\n }\n\n // Display mode indicators\n if (options.dryRun) {\n logger.info('Running in dry-run mode (no files will be modified)');\n }\n if (options.force) {\n logger.info('Force mode enabled (existing files will be overwritten)');\n }\n\n // Generate files\n const result = await fileGenerator.generate({\n templatePath: template.localPath,\n outputPath: options.output,\n features,\n force: options.force,\n dryRun: options.dryRun,\n delete: options.delete,\n });\n\n // Display summary\n logger.summary(result);\n\n outro('Generation complete!');\n } catch (error) {\n // Error handling with proper exit codes\n if (error instanceof Error) {\n logger.error(error.message);\n } else {\n logger.error(String(error));\n }\n process.exit(1);\n }\n}\n"],"mappings":";;;AAgDA,SAAS,eAAe;;;AC5CjB,IAAM,eAAe;AAAA,EAC1B,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,WAAW;AAAA,EACX,eAAe;AACjB;;;ACLA,SAAS,OAAO,aAAa;;;ACuB7B,SAAS,aAAa;;;ACzBf,IAAM,YAAN,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AQ,KAAK,QAAQ;AACvB,CAAC;AAGH,QAAQ,MAAM;","names":["join","relative","join","join","join","chalk","join","relative","join","rm","join","join","rm","intro","isCancel","multiselect","outro","intro","multiselect","isCancel","outro"]}
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ncoderz/awa",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "awa is an Agent Workflow for AIs. It is also a CLI tool to powerfully manage agent workflow files using templates.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/ncoderz/awa"
|
|
9
|
+
},
|
|
6
10
|
"author": "Richard Sewell <richard.sewell@ncoderz.com>",
|
|
7
11
|
"type": "module",
|
|
8
12
|
"bin": {
|