viben 0.1.1 → 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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/cli.ts","../src/commands/init.ts","../src/types/index.ts","../src/lib/config.ts","../src/lib/scope.ts","../src/lib/output.ts","../src/commands/config.ts","../src/commands/agent/index.ts","../src/commands/agent/list.ts","../src/commands/agent/create.ts","../src/commands/agent/show.ts"],"sourcesContent":["/**\n * Viben CLI\n *\n * Command-line interface for managing AI agent workspaces.\n *\n * @packageDocumentation\n */\n\nexport { createProgram, run } from './cli';\nexport { CliError } from './types';\nexport type {\n CliResponse,\n ConfigScope,\n VibenConfig,\n Agent,\n GlobalOptions,\n OutputContext,\n} from './types';\n","/**\n * Viben CLI - Commander.js setup\n */\n\nimport { Command } from 'commander';\nimport { createRequire } from 'module';\nimport { registerInitCommand } from './commands/init';\nimport { registerConfigCommand } from './commands/config';\nimport { registerAgentCommand } from './commands/agent';\n\n// Read version from package.json (using createRequire for ESM compatibility)\nconst require = createRequire(import.meta.url);\nconst packageJson = require('../package.json');\n\n/**\n * Create and configure the CLI program\n */\nexport function createProgram(): Command {\n const program = new Command();\n\n program\n .name('viben')\n .description('Viben CLI - Orchestrate AI agent clusters in your local workspace')\n .version(packageJson.version, '-v, --version', 'Display version number');\n\n // Global options\n program\n .option('--json', 'Output in JSON format for machine consumption')\n .option('-g, --global', 'Use global scope')\n .option('-w, --workspace', 'Use workspace scope')\n .option('--verbose', 'Enable verbose output')\n .option('-q, --quiet', 'Suppress non-essential output');\n\n // Register commands\n registerInitCommand(program);\n registerConfigCommand(program);\n registerAgentCommand(program);\n\n return program;\n}\n\n/**\n * Run the CLI\n */\nexport async function run(args?: string[]): Promise<void> {\n const program = createProgram();\n await program.parseAsync(args || process.argv);\n}\n","/**\n * viben init - Initialize a Viben workspace\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport chalk from 'chalk';\nimport type { Command } from 'commander';\nimport type { OutputContext, VibenConfig } from '../types';\nimport { CliError } from '../types';\nimport { DEFAULT_CONFIG, writeConfigFile } from '../lib/config';\nimport { WORKSPACE_DIR, CONFIG_FILE, findWorkspaceRoot } from '../lib/scope';\nimport { output, successResponse, errorResponse } from '../lib/output';\n\ninterface InitOptions {\n from?: string;\n}\n\n/**\n * Initialize workspace in the given directory\n */\nfunction initWorkspace(targetDir: string, template?: string): VibenConfig {\n const vibenDir = path.join(targetDir, WORKSPACE_DIR);\n const configPath = path.join(vibenDir, CONFIG_FILE);\n\n // Check if already initialized\n if (fs.existsSync(configPath)) {\n throw new CliError(\n 'Workspace already initialized. Use \"viben config\" to modify settings.',\n 'WORKSPACE_EXISTS'\n );\n }\n\n // Create .viben directory\n if (!fs.existsSync(vibenDir)) {\n fs.mkdirSync(vibenDir, { recursive: true });\n }\n\n // Determine config to use\n let config: VibenConfig;\n\n if (template) {\n // TODO: Support template loading from registry or local file\n // For now, just use default config\n config = {\n ...DEFAULT_CONFIG,\n version: 1,\n };\n } else {\n config = {\n ...DEFAULT_CONFIG,\n version: 1,\n };\n }\n\n // Write config file\n writeConfigFile(configPath, config);\n\n // Create agents directory\n const agentsDir = path.join(vibenDir, 'agents');\n if (!fs.existsSync(agentsDir)) {\n fs.mkdirSync(agentsDir, { recursive: true });\n }\n\n // Create default agent config\n const mainAgentPath = path.join(agentsDir, 'main.yaml');\n if (!fs.existsSync(mainAgentPath)) {\n const mainAgentConfig = `# Main agent configuration\nid: main\nname: Main Agent\ndescription: Default workspace agent\n\n# Model configuration (optional, uses defaults)\n# model: claude-sonnet-4-20250514\n# provider: anthropic\n`;\n fs.writeFileSync(mainAgentPath, mainAgentConfig, 'utf-8');\n }\n\n return config;\n}\n\n/**\n * Register the init command\n */\nexport function registerInitCommand(program: Command): void {\n program\n .command('init')\n .description('Initialize a Viben workspace in the current directory')\n .option('--from <template>', 'Initialize from a template')\n .action(async (options: InitOptions) => {\n const ctx: OutputContext = {\n json: program.opts().json || false,\n verbose: program.opts().verbose || false,\n quiet: program.opts().quiet || false,\n };\n\n try {\n const targetDir = process.cwd();\n\n // Check if already inside a workspace\n const existingWorkspace = findWorkspaceRoot(targetDir);\n if (existingWorkspace && existingWorkspace !== targetDir) {\n throw new CliError(\n `Already inside workspace at ${existingWorkspace}`,\n 'NESTED_WORKSPACE'\n );\n }\n\n const config = initWorkspace(targetDir, options.from);\n\n output(\n ctx,\n successResponse({\n workspaceDir: path.join(targetDir, WORKSPACE_DIR),\n configPath: path.join(targetDir, WORKSPACE_DIR, CONFIG_FILE),\n config,\n }),\n () => {\n console.log(chalk.green('Workspace initialized successfully!'));\n console.log();\n console.log('Created:');\n console.log(chalk.gray(' .viben/config.yaml') + ' - Workspace configuration');\n console.log(chalk.gray(' .viben/agents/main.yaml') + ' - Default agent');\n console.log();\n console.log('Next steps:');\n console.log(chalk.cyan(' viben config list') + ' - View configuration');\n console.log(chalk.cyan(' viben agent list') + ' - List agents');\n console.log(chalk.cyan(' viben config set <key> <value>') + ' - Modify settings');\n }\n );\n } catch (error) {\n if (error instanceof CliError) {\n output(ctx, error.toResponse(), () => {\n console.error(chalk.red('Error:'), error.message);\n });\n process.exit(1);\n }\n throw error;\n }\n });\n}\n","/**\n * Viben CLI Type Definitions\n */\n\n/**\n * Standard CLI response for JSON output mode\n */\nexport interface CliResponse<T = unknown> {\n success: boolean;\n data?: T;\n error?: {\n code: string;\n message: string;\n details?: unknown;\n };\n}\n\n/**\n * CLI Error with structured error information\n */\nexport class CliError extends Error {\n constructor(\n message: string,\n public code: string,\n public details?: unknown\n ) {\n super(message);\n this.name = 'CliError';\n }\n\n toResponse(): CliResponse {\n return {\n success: false,\n error: {\n code: this.code,\n message: this.message,\n details: this.details,\n },\n };\n }\n}\n\n/**\n * Scope for configuration operations\n */\nexport type ConfigScope = 'global' | 'workspace';\n\n/**\n * Viben configuration file structure\n */\nexport interface VibenConfig {\n version: number;\n settings?: {\n editor?: string;\n pager?: string;\n color?: 'auto' | 'always' | 'never';\n };\n agents?: string[];\n mcp?: {\n enabled?: string[];\n };\n skills?: {\n enabled?: string[];\n };\n}\n\n/**\n * Agent definition\n */\nexport interface Agent {\n id: string;\n name?: string;\n description?: string;\n model?: string;\n provider?: string;\n createdAt: string;\n updatedAt: string;\n}\n\n/**\n * Global CLI options passed through context\n */\nexport interface GlobalOptions {\n json?: boolean;\n global?: boolean;\n workspace?: boolean;\n verbose?: boolean;\n quiet?: boolean;\n name?: string;\n}\n\n/**\n * Output context for commands\n */\nexport interface OutputContext {\n json: boolean;\n verbose: boolean;\n quiet: boolean;\n}\n","/**\n * Configuration file management for Viben CLI\n *\n * Handles reading/writing YAML config files and config value manipulation.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as yaml from 'yaml';\nimport type { VibenConfig, ConfigScope } from '../types';\nimport { CliError } from '../types';\nimport {\n getConfigPathForScope,\n getGlobalConfigDir,\n getWorkspaceDir,\n ensureDir,\n CONFIG_FILE,\n} from './scope';\n\n/**\n * Default configuration\n */\nexport const DEFAULT_CONFIG: VibenConfig = {\n version: 1,\n settings: {\n editor: 'code',\n pager: 'less',\n color: 'auto',\n },\n agents: [],\n mcp: {\n enabled: [],\n },\n skills: {\n enabled: [],\n },\n};\n\n/**\n * Read a YAML config file\n * Returns null if the file doesn't exist\n */\nexport function readConfigFile(filePath: string): VibenConfig | null {\n if (!fs.existsSync(filePath)) {\n return null;\n }\n\n try {\n const content = fs.readFileSync(filePath, 'utf-8');\n return yaml.parse(content) as VibenConfig;\n } catch (error) {\n throw new CliError(\n `Failed to read config file: ${filePath}`,\n 'CONFIG_READ_ERROR',\n error\n );\n }\n}\n\n/**\n * Write a config to a YAML file\n */\nexport function writeConfigFile(filePath: string, config: VibenConfig): void {\n try {\n // Ensure parent directory exists\n const dirPath = path.dirname(filePath);\n ensureDir(dirPath);\n\n const content = yaml.stringify(config, {\n indent: 2,\n lineWidth: 0, // Don't wrap lines\n });\n fs.writeFileSync(filePath, content, 'utf-8');\n } catch (error) {\n throw new CliError(\n `Failed to write config file: ${filePath}`,\n 'CONFIG_WRITE_ERROR',\n error\n );\n }\n}\n\n/**\n * Read config for a specific scope\n */\nexport function readScopedConfig(scope: ConfigScope): VibenConfig | null {\n const configPath = getConfigPathForScope(scope);\n return readConfigFile(configPath);\n}\n\n/**\n * Write config for a specific scope\n */\nexport function writeScopedConfig(scope: ConfigScope, config: VibenConfig): void {\n const configPath = getConfigPathForScope(scope);\n writeConfigFile(configPath, config);\n}\n\n/**\n * Get a value from config using dot notation\n * e.g., getConfigValue(config, 'settings.editor')\n */\nexport function getConfigValue(\n config: VibenConfig,\n key: string\n): unknown {\n const parts = parseKey(key);\n let current: unknown = config;\n\n for (const part of parts) {\n if (current === null || current === undefined) {\n return undefined;\n }\n\n if (typeof current !== 'object') {\n return undefined;\n }\n\n if (part.isArrayIndex) {\n if (!Array.isArray(current)) {\n return undefined;\n }\n current = current[part.index!];\n } else {\n current = (current as Record<string, unknown>)[part.key];\n }\n }\n\n return current;\n}\n\n/**\n * Set a value in config using dot notation\n * Returns a new config object (immutable)\n */\nexport function setConfigValue(\n config: VibenConfig,\n key: string,\n value: unknown\n): VibenConfig {\n const parts = parseKey(key);\n if (parts.length === 0) {\n return config;\n }\n\n // Deep clone the config\n const newConfig = JSON.parse(JSON.stringify(config)) as VibenConfig;\n let current: Record<string, unknown> = newConfig as unknown as Record<string, unknown>;\n\n // Navigate to parent, creating objects as needed\n for (let i = 0; i < parts.length - 1; i++) {\n const part = parts[i];\n const nextPart = parts[i + 1];\n\n if (part.isArrayIndex) {\n // Handle array index\n const arr = current as unknown as unknown[];\n if (!Array.isArray(arr)) {\n throw new CliError(`Cannot index non-array at ${key}`, 'INVALID_KEY');\n }\n if (arr[part.index!] === undefined) {\n // Create object or array based on next part\n arr[part.index!] = nextPart.isArrayIndex ? [] : {};\n }\n current = arr[part.index!] as Record<string, unknown>;\n } else {\n if (current[part.key] === undefined || typeof current[part.key] !== 'object') {\n // Create object or array based on next part\n current[part.key] = nextPart.isArrayIndex ? [] : {};\n }\n current = current[part.key] as Record<string, unknown>;\n }\n }\n\n // Set the final value\n const lastPart = parts[parts.length - 1];\n if (lastPart.isArrayIndex) {\n const arr = current as unknown as unknown[];\n arr[lastPart.index!] = value;\n } else {\n current[lastPart.key] = value;\n }\n\n return newConfig;\n}\n\n/**\n * Delete a value from config using dot notation\n * Returns a new config object (immutable)\n */\nexport function deleteConfigValue(\n config: VibenConfig,\n key: string\n): VibenConfig {\n const parts = parseKey(key);\n if (parts.length === 0) {\n return config;\n }\n\n // Deep clone the config\n const newConfig = JSON.parse(JSON.stringify(config)) as VibenConfig;\n let current: Record<string, unknown> = newConfig as unknown as Record<string, unknown>;\n\n // Navigate to parent\n for (let i = 0; i < parts.length - 1; i++) {\n const part = parts[i];\n\n if (part.isArrayIndex) {\n const arr = current as unknown as unknown[];\n if (!Array.isArray(arr) || arr[part.index!] === undefined) {\n return config; // Key doesn't exist, return unchanged\n }\n current = arr[part.index!] as Record<string, unknown>;\n } else {\n if (current[part.key] === undefined || typeof current[part.key] !== 'object') {\n return config; // Key doesn't exist, return unchanged\n }\n current = current[part.key] as Record<string, unknown>;\n }\n }\n\n // Delete the final key\n const lastPart = parts[parts.length - 1];\n if (lastPart.isArrayIndex) {\n const arr = current as unknown as unknown[];\n if (Array.isArray(arr)) {\n arr.splice(lastPart.index!, 1);\n }\n } else {\n delete current[lastPart.key];\n }\n\n return newConfig;\n}\n\n/**\n * Key part for dot notation parsing\n */\ninterface KeyPart {\n key: string;\n isArrayIndex: boolean;\n index?: number;\n}\n\n/**\n * Parse a dot-notation key into parts\n * Supports array indexing like \"mcp.enabled[0]\"\n */\nfunction parseKey(key: string): KeyPart[] {\n const parts: KeyPart[] = [];\n const regex = /([^.\\[\\]]+)|\\[(\\d+)\\]/g;\n let match: RegExpExecArray | null;\n\n while ((match = regex.exec(key)) !== null) {\n if (match[1] !== undefined) {\n // Regular key\n parts.push({ key: match[1], isArrayIndex: false });\n } else if (match[2] !== undefined) {\n // Array index\n parts.push({ key: '', isArrayIndex: true, index: parseInt(match[2], 10) });\n }\n }\n\n return parts;\n}\n\n/**\n * Flatten a config object into key-value pairs\n */\nexport interface FlatConfigItem {\n key: string;\n value: string;\n}\n\nexport function flattenConfig(config: VibenConfig): FlatConfigItem[] {\n const items: FlatConfigItem[] = [];\n\n function flatten(obj: unknown, prefix: string): void {\n if (obj === null || obj === undefined) {\n return;\n }\n\n if (Array.isArray(obj)) {\n obj.forEach((item, index) => {\n const key = `${prefix}[${index}]`;\n if (typeof item === 'object' && item !== null) {\n flatten(item, key);\n } else {\n items.push({ key, value: formatValue(item) });\n }\n });\n } else if (typeof obj === 'object') {\n for (const [k, v] of Object.entries(obj)) {\n const key = prefix ? `${prefix}.${k}` : k;\n if (typeof v === 'object' && v !== null) {\n flatten(v, key);\n } else {\n items.push({ key, value: formatValue(v) });\n }\n }\n } else {\n items.push({ key: prefix, value: formatValue(obj) });\n }\n }\n\n flatten(config, '');\n return items;\n}\n\n/**\n * Format a value for display\n */\nfunction formatValue(value: unknown): string {\n if (value === null || value === undefined) {\n return '';\n }\n if (typeof value === 'object') {\n return JSON.stringify(value);\n }\n return String(value);\n}\n\n/**\n * Config item with origin information\n */\nexport interface ConfigWithOrigin {\n key: string;\n value: string;\n origin: string;\n}\n\n/**\n * Get all config values with their origin (global or workspace)\n */\nexport function getConfigWithOrigin(): ConfigWithOrigin[] {\n const items: ConfigWithOrigin[] = [];\n const seen = new Set<string>();\n\n // Workspace config (higher priority)\n const workspaceDir = getWorkspaceDir();\n if (workspaceDir) {\n const workspaceConfigPath = path.join(workspaceDir, CONFIG_FILE);\n const workspaceConfig = readConfigFile(workspaceConfigPath);\n if (workspaceConfig) {\n const workspaceItems = flattenConfig(workspaceConfig);\n for (const item of workspaceItems) {\n items.push({ ...item, origin: 'workspace' });\n seen.add(item.key);\n }\n }\n }\n\n // Global config\n const globalDir = getGlobalConfigDir();\n const globalConfigPath = path.join(globalDir, CONFIG_FILE);\n const globalConfig = readConfigFile(globalConfigPath);\n if (globalConfig) {\n const globalItems = flattenConfig(globalConfig);\n for (const item of globalItems) {\n if (!seen.has(item.key)) {\n items.push({ ...item, origin: 'global' });\n }\n }\n }\n\n return items;\n}\n\n/**\n * Get the configured editor, falling back to defaults\n */\nexport function getEditor(): string {\n // Check environment variables first\n if (process.env.VISUAL) {\n return process.env.VISUAL;\n }\n if (process.env.EDITOR) {\n return process.env.EDITOR;\n }\n\n // Check config\n const workspaceDir = getWorkspaceDir();\n if (workspaceDir) {\n const workspaceConfig = readConfigFile(path.join(workspaceDir, CONFIG_FILE));\n if (workspaceConfig?.settings?.editor) {\n return workspaceConfig.settings.editor;\n }\n }\n\n const globalDir = getGlobalConfigDir();\n const globalConfig = readConfigFile(path.join(globalDir, CONFIG_FILE));\n if (globalConfig?.settings?.editor) {\n return globalConfig.settings.editor;\n }\n\n // Default\n return DEFAULT_CONFIG.settings?.editor || 'vi';\n}\n","/**\n * Scope management for Viben CLI\n *\n * Handles workspace detection, scope resolution, and path management.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport type { ConfigScope } from '../types';\nimport { CliError } from '../types';\n\n/**\n * Workspace directory name (.viben)\n */\nexport const WORKSPACE_DIR = '.viben';\n\n/**\n * Config file name\n */\nexport const CONFIG_FILE = 'config.yaml';\n\n/**\n * Get the global config directory path (~/.viben)\n * Supports VIBEN_STATE_DIR environment variable override\n */\nexport function getGlobalConfigDir(): string {\n return process.env.VIBEN_STATE_DIR || path.join(os.homedir(), WORKSPACE_DIR);\n}\n\n/**\n * Alias for getGlobalConfigDir for backward compatibility\n */\nexport const GLOBAL_CONFIG_DIR = getGlobalConfigDir();\n\n/**\n * Get the state directory (same as global config dir)\n */\nexport function getStateDir(): string {\n return getGlobalConfigDir();\n}\n\n/**\n * Find the workspace root directory by traversing up from the given directory\n * Returns null if no workspace is found\n */\nexport function findWorkspaceRoot(startDir: string): string | null {\n let currentDir = path.resolve(startDir);\n const root = path.parse(currentDir).root;\n\n while (currentDir !== root) {\n const vibenDir = path.join(currentDir, WORKSPACE_DIR);\n const configPath = path.join(vibenDir, CONFIG_FILE);\n\n if (fs.existsSync(configPath)) {\n return currentDir;\n }\n\n currentDir = path.dirname(currentDir);\n }\n\n return null;\n}\n\n/**\n * Get the workspace directory (.viben) for the current directory\n * Returns null if not in a workspace\n */\nexport function getWorkspaceDir(): string | null {\n const workspaceRoot = findWorkspaceRoot(process.cwd());\n if (workspaceRoot) {\n return path.join(workspaceRoot, WORKSPACE_DIR);\n }\n return null;\n}\n\n/**\n * Options for resolving scope\n */\nexport interface ResolveScopeOptions {\n global?: boolean;\n workspace?: boolean;\n}\n\n/**\n * Resolve the configuration scope based on options and environment\n *\n * Priority:\n * 1. Command line flags (--global or --workspace)\n * 2. Environment variable VIBEN_SCOPE\n * 3. Auto-detect based on current directory\n */\nexport function resolveScope(options: ResolveScopeOptions = {}): ConfigScope {\n // 1. Explicit flags\n if (options.global) {\n return 'global';\n }\n if (options.workspace) {\n return 'workspace';\n }\n\n // 2. Environment variable\n const envScope = process.env.VIBEN_SCOPE;\n if (envScope === 'global' || envScope === 'workspace') {\n return envScope;\n }\n\n // 3. Auto-detect: check if we're in a workspace\n const workspaceDir = getWorkspaceDir();\n if (workspaceDir) {\n return 'workspace';\n }\n\n // Default to global\n return 'global';\n}\n\n/**\n * Get the config file path for a given scope\n */\nexport function getConfigPathForScope(scope: ConfigScope): string {\n if (scope === 'workspace') {\n const workspaceDir = getWorkspaceDir();\n if (!workspaceDir) {\n throw new CliError(\n 'Not in a workspace. Use --global or run \"viben init\" first.',\n 'NO_WORKSPACE'\n );\n }\n return path.join(workspaceDir, CONFIG_FILE);\n }\n\n // Global scope\n const globalDir = getGlobalConfigDir();\n return path.join(globalDir, CONFIG_FILE);\n}\n\n/**\n * Ensure a directory exists, creating it if necessary\n */\nexport function ensureDir(dirPath: string): void {\n if (!fs.existsSync(dirPath)) {\n fs.mkdirSync(dirPath, { recursive: true });\n }\n}\n","/**\n * Output management for Viben CLI\n *\n * Handles consistent output formatting for both human and JSON modes.\n */\n\nimport chalk from 'chalk';\nimport type { OutputContext, CliResponse } from '../types';\n\n/**\n * Create a success response\n */\nexport function successResponse<T>(data: T): CliResponse<T> {\n return {\n success: true,\n data,\n };\n}\n\n/**\n * Create an error response\n */\nexport function errorResponse(code: string, message: string, details?: unknown): CliResponse {\n return {\n success: false,\n error: {\n code,\n message,\n details,\n },\n };\n}\n\n/**\n * Unified output function\n *\n * In JSON mode: outputs the response as JSON\n * In human mode: calls the humanFn to output human-readable text\n */\nexport function output<T>(\n ctx: OutputContext,\n response: CliResponse<T>,\n humanFn: () => void\n): void {\n if (ctx.json) {\n console.log(JSON.stringify(response, null, 2));\n return;\n }\n\n if (ctx.quiet && response.success) {\n // In quiet mode, only output errors\n return;\n }\n\n humanFn();\n}\n\n/**\n * Key-value item for output\n */\nexport interface KeyValueItem {\n key: string;\n value: string;\n origin?: string;\n}\n\n/**\n * Output key-value pairs with optional origin\n */\nexport function outputKeyValue(ctx: OutputContext, items: KeyValueItem[]): void {\n if (ctx.json) {\n console.log(JSON.stringify(items, null, 2));\n return;\n }\n\n for (const item of items) {\n if (item.origin) {\n console.log(`${chalk.gray(item.origin + ':')} ${chalk.cyan(item.key)}=${item.value}`);\n } else {\n console.log(`${chalk.cyan(item.key)}=${item.value}`);\n }\n }\n}\n\n/**\n * Output a formatted table\n */\nexport function outputTable(\n ctx: OutputContext,\n headers: string[],\n rows: (string | undefined)[][]\n): void {\n if (ctx.json) {\n // Convert to array of objects\n const data = rows.map((row) => {\n const obj: Record<string, string | undefined> = {};\n headers.forEach((header, index) => {\n obj[header.toLowerCase()] = row[index];\n });\n return obj;\n });\n console.log(JSON.stringify(data, null, 2));\n return;\n }\n\n // Calculate column widths\n const widths = headers.map((h, i) => {\n const columnValues = [h, ...rows.map((r) => stripAnsi(r[i] || ''))];\n return Math.max(...columnValues.map((v) => v.length));\n });\n\n // Print header\n const headerLine = headers.map((h, i) => h.padEnd(widths[i])).join(' ');\n console.log(chalk.bold(headerLine));\n\n // Print separator\n const separator = widths.map((w) => '-'.repeat(w)).join(' ');\n console.log(chalk.gray(separator));\n\n // Print rows\n for (const row of rows) {\n const rowLine = row.map((cell, i) => {\n const stripped = stripAnsi(cell || '');\n const padding = widths[i] - stripped.length;\n return (cell || '') + ' '.repeat(Math.max(0, padding));\n }).join(' ');\n console.log(rowLine);\n }\n}\n\n/**\n * Strip ANSI escape codes from a string\n */\nfunction stripAnsi(str: string): string {\n // eslint-disable-next-line no-control-regex\n return str.replace(/\\x1b\\[[0-9;]*m/g, '');\n}\n\n/**\n * Format a date string for display\n */\nexport function formatDate(dateStr: string | undefined): string {\n if (!dateStr) {\n return chalk.gray('(unknown)');\n }\n\n try {\n const date = new Date(dateStr);\n const now = new Date();\n const diff = now.getTime() - date.getTime();\n\n // Less than 24 hours ago\n if (diff < 24 * 60 * 60 * 1000) {\n const hours = Math.floor(diff / (60 * 60 * 1000));\n if (hours === 0) {\n const minutes = Math.floor(diff / (60 * 1000));\n if (minutes === 0) {\n return 'just now';\n }\n return `${minutes}m ago`;\n }\n return `${hours}h ago`;\n }\n\n // Less than 7 days ago\n if (diff < 7 * 24 * 60 * 60 * 1000) {\n const days = Math.floor(diff / (24 * 60 * 60 * 1000));\n return `${days}d ago`;\n }\n\n // Format as date\n return date.toLocaleDateString();\n } catch {\n return dateStr;\n }\n}\n\n/**\n * Log verbose output (only shown in verbose mode)\n */\nexport function verbose(ctx: OutputContext, message: string): void {\n if (ctx.verbose && !ctx.json) {\n console.log(chalk.gray(`[verbose] ${message}`));\n }\n}\n\n/**\n * Log debug output (only shown in verbose mode)\n */\nexport function debug(ctx: OutputContext, message: string): void {\n if (ctx.verbose && !ctx.json) {\n console.log(chalk.gray(`[debug] ${message}`));\n }\n}\n","/**\n * viben config - Git-style configuration management\n */\n\nimport { spawn } from 'child_process';\nimport chalk from 'chalk';\nimport type { Command } from 'commander';\nimport type { OutputContext, ConfigScope, VibenConfig } from '../types';\nimport { CliError } from '../types';\nimport {\n readScopedConfig,\n writeScopedConfig,\n getConfigValue,\n setConfigValue,\n deleteConfigValue,\n flattenConfig,\n getConfigWithOrigin,\n DEFAULT_CONFIG,\n getEditor,\n} from '../lib/config';\nimport { resolveScope, getConfigPathForScope } from '../lib/scope';\nimport { output, successResponse, outputKeyValue, outputTable } from '../lib/output';\n\ninterface ConfigOptions {\n global?: boolean;\n workspace?: boolean;\n showOrigin?: boolean;\n}\n\n/**\n * Parse value string to appropriate type\n */\nfunction parseValue(value: string): unknown {\n // Try to parse as JSON first (handles arrays, objects, booleans, numbers)\n try {\n return JSON.parse(value);\n } catch {\n // Return as string if not valid JSON\n return value;\n }\n}\n\n/**\n * Format value for display\n */\nfunction formatValue(value: unknown): string {\n if (value === null || value === undefined) {\n return '';\n }\n if (typeof value === 'object') {\n return JSON.stringify(value);\n }\n return String(value);\n}\n\n/**\n * Get command - read a config value\n */\nfunction handleGet(\n ctx: OutputContext,\n scope: ConfigScope,\n key: string\n): void {\n const config = readScopedConfig(scope) || DEFAULT_CONFIG;\n const value = getConfigValue(config, key);\n\n if (value === undefined) {\n output(ctx, successResponse({ key, value: null }), () => {\n // No output for undefined values (git config behavior)\n });\n return;\n }\n\n output(ctx, successResponse({ key, value }), () => {\n console.log(formatValue(value));\n });\n}\n\n/**\n * Set command - set a config value\n */\nfunction handleSet(\n ctx: OutputContext,\n scope: ConfigScope,\n key: string,\n value: string\n): void {\n const config = readScopedConfig(scope) || { version: 1 };\n const parsedValue = parseValue(value);\n const newConfig = setConfigValue(config, key, parsedValue);\n\n writeScopedConfig(scope, newConfig);\n\n output(ctx, successResponse({ key, value: parsedValue, scope }), () => {\n console.log(chalk.green('OK') + ` Set ${chalk.cyan(key)} = ${formatValue(parsedValue)}`);\n });\n}\n\n/**\n * Unset command - remove a config value\n */\nfunction handleUnset(\n ctx: OutputContext,\n scope: ConfigScope,\n key: string\n): void {\n const config = readScopedConfig(scope);\n if (!config) {\n throw new CliError(\n `No config file found for scope: ${scope}`,\n 'CONFIG_NOT_FOUND'\n );\n }\n\n const newConfig = deleteConfigValue(config, key);\n writeScopedConfig(scope, newConfig);\n\n output(ctx, successResponse({ key, scope }), () => {\n console.log(chalk.green('OK') + ` Unset ${chalk.cyan(key)}`);\n });\n}\n\n/**\n * List command - list all config values\n */\nfunction handleList(\n ctx: OutputContext,\n scope: ConfigScope,\n showOrigin: boolean\n): void {\n if (showOrigin) {\n // Show config with origin information\n const items = getConfigWithOrigin();\n\n output(ctx, successResponse({ items }), () => {\n outputKeyValue(ctx, items);\n });\n return;\n }\n\n // List config for specific scope\n const config = readScopedConfig(scope) || DEFAULT_CONFIG;\n const items = flattenConfig(config);\n\n output(ctx, successResponse({ items, scope }), () => {\n for (const item of items) {\n console.log(`${chalk.cyan(item.key)}=${item.value}`);\n }\n });\n}\n\n/**\n * Edit command - open config in editor\n */\nasync function handleEdit(\n ctx: OutputContext,\n scope: ConfigScope\n): Promise<void> {\n const configPath = getConfigPathForScope(scope);\n const editor = getEditor();\n\n output(ctx, successResponse({ configPath, editor }), () => {\n console.log(`Opening ${chalk.cyan(configPath)} in ${chalk.yellow(editor)}...`);\n });\n\n // Spawn editor\n const child = spawn(editor, [configPath], {\n stdio: 'inherit',\n shell: true,\n });\n\n return new Promise((resolve, reject) => {\n child.on('error', (error) => {\n reject(new CliError(\n `Failed to open editor: ${error.message}`,\n 'EDITOR_ERROR',\n error\n ));\n });\n child.on('close', () => {\n resolve();\n });\n });\n}\n\n/**\n * Register the config command\n */\nexport function registerConfigCommand(program: Command): void {\n const configCmd = program\n .command('config')\n .description('Manage Viben configuration (git-style)');\n\n // config get <key>\n configCmd\n .command('get <key>')\n .description('Get a config value')\n .option('-g, --global', 'Use global config')\n .option('-w, --workspace', 'Use workspace config')\n .action((key: string, options: ConfigOptions) => {\n const ctx: OutputContext = {\n json: program.opts().json || false,\n verbose: program.opts().verbose || false,\n quiet: program.opts().quiet || false,\n };\n\n try {\n const scope = resolveScope({\n global: options.global || program.opts().global,\n workspace: options.workspace || program.opts().workspace,\n });\n handleGet(ctx, scope, key);\n } catch (error) {\n if (error instanceof CliError) {\n output(ctx, error.toResponse(), () => {\n console.error(chalk.red('Error:'), error.message);\n });\n process.exit(1);\n }\n throw error;\n }\n });\n\n // config set <key> <value>\n configCmd\n .command('set <key> <value>')\n .description('Set a config value')\n .option('-g, --global', 'Use global config')\n .option('-w, --workspace', 'Use workspace config')\n .action((key: string, value: string, options: ConfigOptions) => {\n const ctx: OutputContext = {\n json: program.opts().json || false,\n verbose: program.opts().verbose || false,\n quiet: program.opts().quiet || false,\n };\n\n try {\n const scope = resolveScope({\n global: options.global || program.opts().global,\n workspace: options.workspace || program.opts().workspace,\n });\n handleSet(ctx, scope, key, value);\n } catch (error) {\n if (error instanceof CliError) {\n output(ctx, error.toResponse(), () => {\n console.error(chalk.red('Error:'), error.message);\n });\n process.exit(1);\n }\n throw error;\n }\n });\n\n // config unset <key>\n configCmd\n .command('unset <key>')\n .description('Remove a config value')\n .option('-g, --global', 'Use global config')\n .option('-w, --workspace', 'Use workspace config')\n .action((key: string, options: ConfigOptions) => {\n const ctx: OutputContext = {\n json: program.opts().json || false,\n verbose: program.opts().verbose || false,\n quiet: program.opts().quiet || false,\n };\n\n try {\n const scope = resolveScope({\n global: options.global || program.opts().global,\n workspace: options.workspace || program.opts().workspace,\n });\n handleUnset(ctx, scope, key);\n } catch (error) {\n if (error instanceof CliError) {\n output(ctx, error.toResponse(), () => {\n console.error(chalk.red('Error:'), error.message);\n });\n process.exit(1);\n }\n throw error;\n }\n });\n\n // config list\n configCmd\n .command('list')\n .description('List all config values')\n .option('-g, --global', 'Use global config')\n .option('-w, --workspace', 'Use workspace config')\n .option('--show-origin', 'Show the origin of each config value')\n .action((options: ConfigOptions) => {\n const ctx: OutputContext = {\n json: program.opts().json || false,\n verbose: program.opts().verbose || false,\n quiet: program.opts().quiet || false,\n };\n\n try {\n const scope = resolveScope({\n global: options.global || program.opts().global,\n workspace: options.workspace || program.opts().workspace,\n });\n handleList(ctx, scope, options.showOrigin || false);\n } catch (error) {\n if (error instanceof CliError) {\n output(ctx, error.toResponse(), () => {\n console.error(chalk.red('Error:'), error.message);\n });\n process.exit(1);\n }\n throw error;\n }\n });\n\n // config edit\n configCmd\n .command('edit')\n .description('Open config in editor')\n .option('-g, --global', 'Edit global config')\n .option('-w, --workspace', 'Edit workspace config')\n .action(async (options: ConfigOptions) => {\n const ctx: OutputContext = {\n json: program.opts().json || false,\n verbose: program.opts().verbose || false,\n quiet: program.opts().quiet || false,\n };\n\n try {\n const scope = resolveScope({\n global: options.global || program.opts().global,\n workspace: options.workspace || program.opts().workspace,\n });\n await handleEdit(ctx, scope);\n } catch (error) {\n if (error instanceof CliError) {\n output(ctx, error.toResponse(), () => {\n console.error(chalk.red('Error:'), error.message);\n });\n process.exit(1);\n }\n throw error;\n }\n });\n}\n","/**\n * viben agent - Agent management commands\n */\n\nimport chalk from 'chalk';\nimport type { Command } from 'commander';\nimport type { OutputContext } from '../../types';\nimport { CliError } from '../../types';\nimport { output } from '../../lib/output';\nimport { listAgents } from './list';\nimport { createAgent } from './create';\nimport { showAgent } from './show';\n\ninterface AgentOptions {\n name?: string;\n description?: string;\n model?: string;\n provider?: string;\n global?: boolean;\n workspace?: boolean;\n}\n\n/**\n * Register the agent command\n */\nexport function registerAgentCommand(program: Command): void {\n const agentCmd = program\n .command('agent')\n .description('Manage agents');\n\n // agent list\n agentCmd\n .command('list')\n .description('List all agents')\n .action(() => {\n const ctx: OutputContext = {\n json: program.opts().json || false,\n verbose: program.opts().verbose || false,\n quiet: program.opts().quiet || false,\n };\n\n try {\n listAgents(ctx);\n } catch (error) {\n if (error instanceof CliError) {\n output(ctx, error.toResponse(), () => {\n console.error(chalk.red('Error:'), error.message);\n });\n process.exit(1);\n }\n throw error;\n }\n });\n\n // agent create\n agentCmd\n .command('create')\n .description('Create a new agent')\n .requiredOption('-n, --name <id>', 'Agent ID (required)')\n .option('-d, --description <text>', 'Agent description')\n .option('-m, --model <model>', 'Model to use')\n .option('-p, --provider <provider>', 'Provider name')\n .option('-g, --global', 'Create in global scope')\n .option('-w, --workspace', 'Create in workspace scope')\n .action((options: AgentOptions) => {\n const ctx: OutputContext = {\n json: program.opts().json || false,\n verbose: program.opts().verbose || false,\n quiet: program.opts().quiet || false,\n };\n\n try {\n if (!options.name) {\n throw new CliError('Agent ID is required (-n, --name)', 'MISSING_ID');\n }\n createAgent(ctx, {\n name: options.name,\n description: options.description,\n model: options.model,\n provider: options.provider,\n global: options.global || program.opts().global,\n workspace: options.workspace || program.opts().workspace,\n });\n } catch (error) {\n if (error instanceof CliError) {\n output(ctx, error.toResponse(), () => {\n console.error(chalk.red('Error:'), error.message);\n });\n process.exit(1);\n }\n throw error;\n }\n });\n\n // agent show\n agentCmd\n .command('show')\n .description('Show agent details')\n .requiredOption('-n, --name <id>', 'Agent ID (required)')\n .action((options: AgentOptions) => {\n const ctx: OutputContext = {\n json: program.opts().json || false,\n verbose: program.opts().verbose || false,\n quiet: program.opts().quiet || false,\n };\n\n try {\n if (!options.name) {\n throw new CliError('Agent ID is required (-n, --name)', 'MISSING_ID');\n }\n showAgent(ctx, options.name);\n } catch (error) {\n if (error instanceof CliError) {\n output(ctx, error.toResponse(), () => {\n console.error(chalk.red('Error:'), error.message);\n });\n process.exit(1);\n }\n throw error;\n }\n });\n}\n","/**\n * viben agent list - List all agents\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as yaml from 'yaml';\nimport chalk from 'chalk';\nimport type { OutputContext, Agent } from '../../types';\nimport { CliError } from '../../types';\nimport { output, successResponse, outputTable } from '../../lib/output';\nimport { getWorkspaceDir, getStateDir } from '../../lib/scope';\n\n/**\n * Read agent files from a directory\n */\nfunction readAgentsFromDir(agentsDir: string, source: string): Agent[] {\n if (!fs.existsSync(agentsDir)) {\n return [];\n }\n\n const agents: Agent[] = [];\n const files = fs.readdirSync(agentsDir);\n\n for (const file of files) {\n if (!file.endsWith('.yaml') && !file.endsWith('.yml')) {\n continue;\n }\n\n const filePath = path.join(agentsDir, file);\n try {\n const content = fs.readFileSync(filePath, 'utf-8');\n const parsed = yaml.parse(content) as Record<string, unknown>;\n\n const stat = fs.statSync(filePath);\n const agent: Agent = {\n id: (parsed.id as string) || path.basename(file, path.extname(file)),\n name: (parsed.name as string) || undefined,\n description: (parsed.description as string) || undefined,\n model: (parsed.model as string) || undefined,\n provider: (parsed.provider as string) || undefined,\n createdAt: stat.birthtime.toISOString(),\n updatedAt: stat.mtime.toISOString(),\n };\n\n agents.push(agent);\n } catch (error) {\n // Skip invalid files\n continue;\n }\n }\n\n return agents;\n}\n\n/**\n * List all agents\n */\nexport function listAgents(ctx: OutputContext): void {\n const agents: Array<Agent & { source: string }> = [];\n\n // List workspace agents\n const workspaceDir = getWorkspaceDir();\n if (workspaceDir) {\n const workspaceAgentsDir = path.join(workspaceDir, 'agents');\n const workspaceAgents = readAgentsFromDir(workspaceAgentsDir, 'workspace');\n for (const agent of workspaceAgents) {\n agents.push({ ...agent, source: 'workspace' });\n }\n }\n\n // List global agents\n const globalAgentsDir = path.join(getStateDir(), 'agents');\n const globalAgents = readAgentsFromDir(globalAgentsDir, 'global');\n for (const agent of globalAgents) {\n // Don't add if already exists from workspace\n if (!agents.find((a) => a.id === agent.id)) {\n agents.push({ ...agent, source: 'global' });\n }\n }\n\n output(\n ctx,\n successResponse({ agents, count: agents.length }),\n () => {\n if (agents.length === 0) {\n console.log(chalk.gray('No agents found.'));\n console.log();\n console.log('Create an agent with:');\n console.log(chalk.cyan(' viben agent create -n <agent-id>'));\n return;\n }\n\n outputTable(\n ctx,\n ['ID', 'Name', 'Model', 'Source'],\n agents.map((a) => [\n a.id,\n a.name || chalk.gray('(unnamed)'),\n a.model || chalk.gray('(default)'),\n a.source,\n ])\n );\n }\n );\n}\n","/**\n * viben agent create - Create a new agent\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as yaml from 'yaml';\nimport chalk from 'chalk';\nimport type { OutputContext, Agent, ConfigScope } from '../../types';\nimport { CliError } from '../../types';\nimport { output, successResponse } from '../../lib/output';\nimport { getWorkspaceDir, getStateDir, resolveScope } from '../../lib/scope';\n\ninterface CreateOptions {\n name: string;\n description?: string;\n model?: string;\n provider?: string;\n global?: boolean;\n workspace?: boolean;\n}\n\n/**\n * Get agents directory for scope\n */\nfunction getAgentsDir(scope: ConfigScope): string {\n if (scope === 'workspace') {\n const workspaceDir = getWorkspaceDir();\n if (!workspaceDir) {\n throw new CliError(\n 'Not in a workspace. Use --global or run \"viben init\" first.',\n 'NO_WORKSPACE'\n );\n }\n return path.join(workspaceDir, 'agents');\n }\n return path.join(getStateDir(), 'agents');\n}\n\n/**\n * Validate agent ID\n */\nfunction validateAgentId(id: string): void {\n if (!id || id.trim() === '') {\n throw new CliError('Agent ID cannot be empty', 'INVALID_ID');\n }\n\n if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(id)) {\n throw new CliError(\n 'Agent ID must start with a letter and contain only letters, numbers, underscores, and hyphens',\n 'INVALID_ID'\n );\n }\n\n if (id.length > 64) {\n throw new CliError('Agent ID must be 64 characters or less', 'INVALID_ID');\n }\n}\n\n/**\n * Create a new agent\n */\nexport function createAgent(ctx: OutputContext, options: CreateOptions): void {\n const id = options.name;\n validateAgentId(id);\n\n const scope = resolveScope({\n global: options.global,\n workspace: options.workspace,\n });\n\n const agentsDir = getAgentsDir(scope);\n const agentPath = path.join(agentsDir, `${id}.yaml`);\n\n // Check if already exists\n if (fs.existsSync(agentPath)) {\n throw new CliError(\n `Agent \"${id}\" already exists`,\n 'AGENT_EXISTS'\n );\n }\n\n // Create agents directory if needed\n if (!fs.existsSync(agentsDir)) {\n fs.mkdirSync(agentsDir, { recursive: true });\n }\n\n // Create agent config\n const now = new Date().toISOString();\n const agent: Agent = {\n id,\n name: options.description ? undefined : id,\n description: options.description,\n model: options.model,\n provider: options.provider,\n createdAt: now,\n updatedAt: now,\n };\n\n // Build YAML content\n const agentConfig: Record<string, unknown> = {\n id: agent.id,\n };\n\n if (agent.name) {\n agentConfig.name = agent.name;\n }\n if (agent.description) {\n agentConfig.description = agent.description;\n }\n if (agent.model) {\n agentConfig.model = agent.model;\n }\n if (agent.provider) {\n agentConfig.provider = agent.provider;\n }\n\n const content = yaml.stringify(agentConfig, { indent: 2 });\n fs.writeFileSync(agentPath, content, 'utf-8');\n\n output(\n ctx,\n successResponse({\n agent,\n path: agentPath,\n scope,\n }),\n () => {\n console.log(chalk.green('OK') + ` Created agent \"${chalk.cyan(id)}\"`);\n console.log();\n console.log('Agent file:', chalk.gray(agentPath));\n console.log();\n console.log('Next steps:');\n console.log(chalk.cyan(` viben agent show -n ${id}`) + ' - View agent details');\n }\n );\n}\n","/**\n * viben agent show - Show agent details\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as yaml from 'yaml';\nimport chalk from 'chalk';\nimport type { OutputContext, Agent } from '../../types';\nimport { CliError } from '../../types';\nimport { output, successResponse, formatDate } from '../../lib/output';\nimport { getWorkspaceDir, getStateDir } from '../../lib/scope';\n\n/**\n * Find agent by ID\n */\nfunction findAgent(id: string): { agent: Agent; path: string; source: string } | null {\n // Check workspace first\n const workspaceDir = getWorkspaceDir();\n if (workspaceDir) {\n const workspaceAgentPath = path.join(workspaceDir, 'agents', `${id}.yaml`);\n if (fs.existsSync(workspaceAgentPath)) {\n const content = fs.readFileSync(workspaceAgentPath, 'utf-8');\n const parsed = yaml.parse(content) as Record<string, unknown>;\n const stat = fs.statSync(workspaceAgentPath);\n\n return {\n agent: {\n id: (parsed.id as string) || id,\n name: parsed.name as string | undefined,\n description: parsed.description as string | undefined,\n model: parsed.model as string | undefined,\n provider: parsed.provider as string | undefined,\n createdAt: stat.birthtime.toISOString(),\n updatedAt: stat.mtime.toISOString(),\n },\n path: workspaceAgentPath,\n source: 'workspace',\n };\n }\n }\n\n // Check global\n const globalAgentPath = path.join(getStateDir(), 'agents', `${id}.yaml`);\n if (fs.existsSync(globalAgentPath)) {\n const content = fs.readFileSync(globalAgentPath, 'utf-8');\n const parsed = yaml.parse(content) as Record<string, unknown>;\n const stat = fs.statSync(globalAgentPath);\n\n return {\n agent: {\n id: (parsed.id as string) || id,\n name: parsed.name as string | undefined,\n description: parsed.description as string | undefined,\n model: parsed.model as string | undefined,\n provider: parsed.provider as string | undefined,\n createdAt: stat.birthtime.toISOString(),\n updatedAt: stat.mtime.toISOString(),\n },\n path: globalAgentPath,\n source: 'global',\n };\n }\n\n return null;\n}\n\n/**\n * Show agent details\n */\nexport function showAgent(ctx: OutputContext, id: string): void {\n const result = findAgent(id);\n\n if (!result) {\n throw new CliError(\n `Agent \"${id}\" not found`,\n 'AGENT_NOT_FOUND'\n );\n }\n\n const { agent, path: agentPath, source } = result;\n\n output(\n ctx,\n successResponse({\n agent,\n path: agentPath,\n source,\n }),\n () => {\n console.log(chalk.bold.underline(`Agent: ${agent.id}`));\n console.log();\n\n const printField = (label: string, value: string | undefined, defaultVal?: string) => {\n const displayValue = value || chalk.gray(defaultVal || '(not set)');\n console.log(` ${chalk.cyan(label.padEnd(12))} ${displayValue}`);\n };\n\n printField('Name', agent.name);\n printField('Description', agent.description);\n printField('Model', agent.model, '(default)');\n printField('Provider', agent.provider, '(default)');\n printField('Source', source);\n console.log();\n printField('Created', formatDate(agent.createdAt));\n printField('Updated', formatDate(agent.updatedAt));\n console.log();\n console.log(chalk.gray('Config file:'), agentPath);\n }\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACIA,uBAAwB;AACxB,oBAA8B;;;ACD9B,IAAAA,MAAoB;AACpB,IAAAC,QAAsB;AACtB,IAAAC,gBAAkB;;;ACcX,IAAM,WAAN,cAAuB,MAAM;AAAA,EAClC,YACE,SACO,MACA,SACP;AACA,UAAM,OAAO;AAHN;AACA;AAGP,SAAK,OAAO;AAAA,EACd;AAAA,EAEA,aAA0B;AACxB,WAAO;AAAA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I,MAAgC;AACxD,QAAM,UAAU,cAAc;AAC9B,QAAM,QAAQ,WAAW,QAAQ,QAAQ,IAAI;AAC/C;","names":["fs","path","import_chalk","fs","path","chalk","chalk","import_chalk","formatValue","chalk","items","resolve","import_chalk","fs","path","yaml","import_chalk","chalk","fs","path","yaml","import_chalk","chalk","fs","path","yaml","import_chalk","chalk","chalk","require"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Viben CLI\n *\n * This is a thin wrapper around @viben/core CLI.\n * All actual CLI logic is implemented in @viben/core.\n */\n\n// Re-export CLI from @viben/core\nexport { run, createProgram } from \"@viben/core\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,kBAAmC;","names":[]}
package/dist/index.d.cts CHANGED
@@ -1,94 +1 @@
1
- import { Command } from 'commander';
2
-
3
- /**
4
- * Viben CLI - Commander.js setup
5
- */
6
-
7
- /**
8
- * Create and configure the CLI program
9
- */
10
- declare function createProgram(): Command;
11
- /**
12
- * Run the CLI
13
- */
14
- declare function run(args?: string[]): Promise<void>;
15
-
16
- /**
17
- * Viben CLI Type Definitions
18
- */
19
- /**
20
- * Standard CLI response for JSON output mode
21
- */
22
- interface CliResponse<T = unknown> {
23
- success: boolean;
24
- data?: T;
25
- error?: {
26
- code: string;
27
- message: string;
28
- details?: unknown;
29
- };
30
- }
31
- /**
32
- * CLI Error with structured error information
33
- */
34
- declare class CliError extends Error {
35
- code: string;
36
- details?: unknown | undefined;
37
- constructor(message: string, code: string, details?: unknown | undefined);
38
- toResponse(): CliResponse;
39
- }
40
- /**
41
- * Scope for configuration operations
42
- */
43
- type ConfigScope = 'global' | 'workspace';
44
- /**
45
- * Viben configuration file structure
46
- */
47
- interface VibenConfig {
48
- version: number;
49
- settings?: {
50
- editor?: string;
51
- pager?: string;
52
- color?: 'auto' | 'always' | 'never';
53
- };
54
- agents?: string[];
55
- mcp?: {
56
- enabled?: string[];
57
- };
58
- skills?: {
59
- enabled?: string[];
60
- };
61
- }
62
- /**
63
- * Agent definition
64
- */
65
- interface Agent {
66
- id: string;
67
- name?: string;
68
- description?: string;
69
- model?: string;
70
- provider?: string;
71
- createdAt: string;
72
- updatedAt: string;
73
- }
74
- /**
75
- * Global CLI options passed through context
76
- */
77
- interface GlobalOptions {
78
- json?: boolean;
79
- global?: boolean;
80
- workspace?: boolean;
81
- verbose?: boolean;
82
- quiet?: boolean;
83
- name?: string;
84
- }
85
- /**
86
- * Output context for commands
87
- */
88
- interface OutputContext {
89
- json: boolean;
90
- verbose: boolean;
91
- quiet: boolean;
92
- }
93
-
94
- export { type Agent, CliError, type CliResponse, type ConfigScope, type GlobalOptions, type OutputContext, type VibenConfig, createProgram, run };
1
+ export { createProgram, run } from '@viben/core';
package/dist/index.d.ts CHANGED
@@ -1,94 +1 @@
1
- import { Command } from 'commander';
2
-
3
- /**
4
- * Viben CLI - Commander.js setup
5
- */
6
-
7
- /**
8
- * Create and configure the CLI program
9
- */
10
- declare function createProgram(): Command;
11
- /**
12
- * Run the CLI
13
- */
14
- declare function run(args?: string[]): Promise<void>;
15
-
16
- /**
17
- * Viben CLI Type Definitions
18
- */
19
- /**
20
- * Standard CLI response for JSON output mode
21
- */
22
- interface CliResponse<T = unknown> {
23
- success: boolean;
24
- data?: T;
25
- error?: {
26
- code: string;
27
- message: string;
28
- details?: unknown;
29
- };
30
- }
31
- /**
32
- * CLI Error with structured error information
33
- */
34
- declare class CliError extends Error {
35
- code: string;
36
- details?: unknown | undefined;
37
- constructor(message: string, code: string, details?: unknown | undefined);
38
- toResponse(): CliResponse;
39
- }
40
- /**
41
- * Scope for configuration operations
42
- */
43
- type ConfigScope = 'global' | 'workspace';
44
- /**
45
- * Viben configuration file structure
46
- */
47
- interface VibenConfig {
48
- version: number;
49
- settings?: {
50
- editor?: string;
51
- pager?: string;
52
- color?: 'auto' | 'always' | 'never';
53
- };
54
- agents?: string[];
55
- mcp?: {
56
- enabled?: string[];
57
- };
58
- skills?: {
59
- enabled?: string[];
60
- };
61
- }
62
- /**
63
- * Agent definition
64
- */
65
- interface Agent {
66
- id: string;
67
- name?: string;
68
- description?: string;
69
- model?: string;
70
- provider?: string;
71
- createdAt: string;
72
- updatedAt: string;
73
- }
74
- /**
75
- * Global CLI options passed through context
76
- */
77
- interface GlobalOptions {
78
- json?: boolean;
79
- global?: boolean;
80
- workspace?: boolean;
81
- verbose?: boolean;
82
- quiet?: boolean;
83
- name?: string;
84
- }
85
- /**
86
- * Output context for commands
87
- */
88
- interface OutputContext {
89
- json: boolean;
90
- verbose: boolean;
91
- quiet: boolean;
92
- }
93
-
94
- export { type Agent, CliError, type CliResponse, type ConfigScope, type GlobalOptions, type OutputContext, type VibenConfig, createProgram, run };
1
+ export { createProgram, run } from '@viben/core';