@yeseh/cortex-cli 0.6.6 → 0.6.7

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.
Files changed (62) hide show
  1. package/dist/category/commands/create.d.ts.map +1 -1
  2. package/dist/chunk-tgrm2cc9.js +1543 -0
  3. package/dist/chunk-tgrm2cc9.js.map +38 -0
  4. package/dist/commands/init.d.ts +26 -5
  5. package/dist/commands/init.d.ts.map +1 -1
  6. package/dist/context.d.ts +22 -17
  7. package/dist/context.d.ts.map +1 -1
  8. package/dist/context.spec.d.ts +8 -0
  9. package/dist/context.spec.d.ts.map +1 -1
  10. package/dist/memory/commands/add.d.ts.map +1 -1
  11. package/dist/memory/commands/list.d.ts.map +1 -1
  12. package/dist/memory/commands/move.d.ts.map +1 -1
  13. package/dist/memory/commands/remove.d.ts.map +1 -1
  14. package/dist/memory/commands/show.d.ts.map +1 -1
  15. package/dist/memory/commands/update.d.ts.map +1 -1
  16. package/dist/observability.d.ts +33 -0
  17. package/dist/observability.d.ts.map +1 -0
  18. package/dist/observability.spec.d.ts +2 -0
  19. package/dist/observability.spec.d.ts.map +1 -0
  20. package/dist/output.d.ts +21 -1
  21. package/dist/output.d.ts.map +1 -1
  22. package/dist/program.d.ts.map +1 -1
  23. package/dist/program.js +11 -0
  24. package/dist/program.js.map +9 -0
  25. package/dist/run.js +10 -0
  26. package/dist/run.js.map +10 -0
  27. package/dist/store/commands/init.d.ts +23 -7
  28. package/dist/store/commands/init.d.ts.map +1 -1
  29. package/dist/store/commands/prune.d.ts.map +1 -1
  30. package/dist/store/commands/reindexs.d.ts.map +1 -1
  31. package/dist/test-helpers.spec.d.ts +2 -2
  32. package/dist/utils/input.d.ts.map +1 -0
  33. package/dist/{input.spec.d.ts.map → utils/input.spec.d.ts.map} +1 -1
  34. package/dist/{paths.d.ts → utils/paths.d.ts} +10 -0
  35. package/dist/utils/paths.d.ts.map +1 -0
  36. package/dist/utils/paths.spec.d.ts.map +1 -0
  37. package/dist/utils/prompts.d.ts +86 -0
  38. package/dist/utils/prompts.d.ts.map +1 -0
  39. package/dist/utils/prompts.spec.d.ts +2 -0
  40. package/dist/utils/prompts.spec.d.ts.map +1 -0
  41. package/dist/utils/resolve-default-store.d.ts +44 -0
  42. package/dist/utils/resolve-default-store.d.ts.map +1 -0
  43. package/dist/utils/resolve-default-store.spec.d.ts +7 -0
  44. package/dist/utils/resolve-default-store.spec.d.ts.map +1 -0
  45. package/package.json +9 -9
  46. package/src/run.ts +0 -0
  47. package/src/tests/cli.integration.spec.ts +270 -79
  48. package/src/utils/input.ts +9 -4
  49. package/src/utils/resolve-default-store.spec.ts +1 -1
  50. package/src/utils/resolve-default-store.ts +6 -2
  51. package/dist/create-cli-command.d.ts +0 -23
  52. package/dist/create-cli-command.d.ts.map +0 -1
  53. package/dist/create-cli-command.spec.d.ts +0 -10
  54. package/dist/create-cli-command.spec.d.ts.map +0 -1
  55. package/dist/input.d.ts.map +0 -1
  56. package/dist/memory/commands/handlers.spec.d.ts +0 -2
  57. package/dist/memory/commands/handlers.spec.d.ts.map +0 -1
  58. package/dist/paths.d.ts.map +0 -1
  59. package/dist/paths.spec.d.ts.map +0 -1
  60. /package/dist/{input.d.ts → utils/input.d.ts} +0 -0
  61. /package/dist/{input.spec.d.ts → utils/input.spec.d.ts} +0 -0
  62. /package/dist/{paths.spec.d.ts → utils/paths.spec.d.ts} +0 -0
@@ -0,0 +1,38 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/program.ts", "../src/memory/index.ts", "../src/memory/commands/add.ts", "../src/errors.ts", "../src/utils/input.ts", "../src/memory/parsing.ts", "../src/context.ts", "../src/observability.ts", "../src/output.ts", "../src/utils/resolve-default-store.ts", "../src/memory/commands/show.ts", "../src/memory/commands/update.ts", "../src/memory/commands/remove.ts", "../src/memory/commands/move.ts", "../src/memory/commands/list.ts", "../src/store/index.ts", "../src/store/commands/list.ts", "../src/store/commands/add.ts", "../src/utils/paths.ts", "../src/store/commands/remove.ts", "../src/store/commands/init.ts", "../src/store/utils/resolve-store-name.ts", "../src/utils/git.ts", "../src/utils/prompts.ts", "../src/store/commands/prune.ts", "../src/store/commands/reindexs.ts", "../src/commands/init.ts", "../src/category/index.ts", "../src/category/commands/create.ts"],
4
+ "sourcesContent": [
5
+ "/**\n * Commander.js program setup for Cortex CLI.\n *\n * This module sets up the main Commander program and wires together\n * all command groups. It serves as the entry point for the CLI.\n *\n * @module cli/program\n */\n\nimport { Command } from '@commander-js/extra-typings';\n\nimport { memoryCommand } from './memory/index.ts';\nimport { storeCommand } from './store/index.ts';\nimport { initCommand } from './commands/init.ts';\nimport { categoryCommand } from './category/index.ts';\nimport { createCliLogger } from './observability.ts';\nimport packageInfo from '../package.json'\n\n/**\n * The main Commander program instance for Cortex CLI.\n *\n * Configured with:\n * - Name: cortex\n * - Description: Memory system for AI agents\n * - Version: 0.1.0\n *\n * @example\n * ```ts\n * import { program } from './program.ts';\n * await program.parseAsync(process.argv);\n * ```\n */\nconst program = new Command()\n .name('cortex')\n .description('Memory system for AI agents')\n .version(packageInfo.version);\n\nprogram.addCommand(memoryCommand);\nprogram.addCommand(categoryCommand);\nprogram.addCommand(storeCommand);\nprogram.addCommand(initCommand);\n\nexport { program };\n\n/**\n * Runs the CLI program by parsing command-line arguments.\n *\n * This function handles errors gracefully and sets the appropriate\n * exit code on failure.\n *\n * @returns A promise that resolves when the program completes\n *\n * @example\n * ```ts\n * import { runProgram } from './program.ts';\n * await runProgram();\n * ```\n */\nexport const runProgram = async (): Promise<void> => {\n try {\n await program.parseAsync(process.argv);\n }\n catch (error) {\n // Commander.js handles most errors by writing to stderr and exiting.\n // This catch handles any unexpected errors that slip through.\n const logger = createCliLogger();\n if (error instanceof Error) {\n logger.error(error.message);\n }\n else {\n logger.error('An unexpected error occurred');\n }\n process.exitCode = 1;\n }\n};\n",
6
+ "/**\n * Memory command group for the CLI.\n *\n * This module defines the `memory` command group, which provides operations\n * for managing memories in the Cortex memory system. The `--store` option\n * is defined at the group level and inherited by all subcommands.\n *\n * @example\n * ```bash\n * # Use default store\n * cortex memory add project/notes --content \"Hello\"\n *\n * # Use specific store\n * cortex memory --store my-store add project/notes --content \"Hello\"\n * cortex memory -s my-store list\n * ```\n */\n\nimport { Command } from '@commander-js/extra-typings';\n\nimport { addCommand } from './commands/add.ts';\nimport { showCommand } from './commands/show.ts';\nimport { updateCommand } from './commands/update.ts';\nimport { removeCommand } from './commands/remove.ts';\nimport { moveCommand } from './commands/move.ts';\nimport { listCommand } from './commands/list.ts';\n\n/**\n * The `memory` command group.\n *\n * Provides memory management operations. The `--store` option allows\n * targeting a specific named store instead of the default store.\n * This option is inherited by all subcommands.\n */\nexport const memoryCommand = new Command('memory')\n .description('Memory operations')\n .option('-s, --store <name>', 'Use a specific named store');\n\nmemoryCommand.addCommand(addCommand);\nmemoryCommand.addCommand(showCommand);\nmemoryCommand.addCommand(updateCommand);\nmemoryCommand.addCommand(removeCommand);\nmemoryCommand.addCommand(moveCommand);\nmemoryCommand.addCommand(listCommand);\n",
7
+ "/**\n * Memory add command implementation using Commander.js.\n *\n * Creates a new memory at the specified path with content from inline text,\n * a file, or stdin.\n *\n * @example\n * ```bash\n * # Add memory with inline content\n * cortex memory add project/tech-stack --content \"Using TypeScript and Node.js\"\n *\n * # Add memory from a file\n * cortex memory add project/notes --file ./notes.md\n *\n * # Add memory from stdin\n * echo \"My notes\" | cortex memory add project/notes\n *\n * # Add memory with tags and expiration\n * cortex memory add project/temp --content \"Temporary note\" \\\n * --tags \"temp,cleanup\" --expires-at \"2025-12-31T00:00:00Z\"\n * ```\n */\n\nimport { Command } from '@commander-js/extra-typings';\nimport { throwCliError } from '../../errors.ts';\nimport { type CortexContext } from '@yeseh/cortex-core';\nimport { resolveInput as resolveCliContent } from '../../utils/input.ts';\nimport { parseExpiresAt, parseTags } from '../parsing.ts';\nimport { createCliCommandContext } from '../../context.ts';\nimport { serializeOutput, type OutputFormat } from '../../output.ts';\nimport { resolveDefaultStore } from '../../utils/resolve-default-store.ts';\n\n/** Options parsed by Commander for the add command */\nexport interface AddCommandOptions {\n content?: string;\n file?: string;\n tags?: string[];\n expiresAt?: string;\n citations?: string[];\n format?: string;\n}\n/**\n * Handler for the memory add command.\n * Exported for direct testing without Commander parsing.\n *\n * @param path - Memory path (e.g., \"project/tech-stack\")\n * @param options - Command options from Commander\n * @param storeName - Optional store name from parent command\n * @param deps - Injectable dependencies for testing\n */\nexport async function handleAdd(\n ctx: CortexContext,\n storeName: string | undefined,\n path: string,\n options: AddCommandOptions\n): Promise<void> {\n const content = await resolveCliContent({\n content: options.content,\n filePath: options.file,\n stream: ctx.stdin,\n // `memory add` accepts stdin by default (when piped).\n stdinRequested: options.content === undefined && options.file === undefined,\n });\n\n if (!content.ok()) {\n throwCliError(content.error);\n }\n\n if (!content.value.content) {\n throwCliError({\n code: 'MISSING_CONTENT',\n message: 'Memory content is required via --content, --file, or stdin.',\n });\n }\n\n const { content: memoryContent, source } = content.value;\n const tags = parseTags(options.tags);\n const expiresAt = parseExpiresAt(options.expiresAt);\n const citations = options.citations ?? [];\n\n const storeResult = ctx.cortex.getStore(resolveDefaultStore(ctx, storeName));\n if (!storeResult.ok()) {\n throwCliError(storeResult.error);\n }\n\n const store = storeResult.value;\n const timestamp = ctx.now() ?? new Date();\n const memoryClient = store.getMemory(path);\n const memoryResult = await memoryClient.create({\n content: memoryContent!,\n metadata: {\n tags,\n source,\n createdAt: timestamp,\n updatedAt: timestamp,\n expiresAt,\n citations,\n },\n });\n\n if (!memoryResult.ok()) {\n throwCliError(memoryResult.error);\n }\n\n const memory = memoryResult.value;\n const out = ctx.stdout ?? process.stdout;\n\n const rawFormat = options.format;\n if (!rawFormat) {\n out.write(`Added memory ${memory.path} (${source}).\\n`);\n } else {\n const format = rawFormat as OutputFormat;\n const serialized = serializeOutput(\n {\n kind: 'memory',\n value: {\n path: memory.path.toString(),\n metadata: memory.metadata,\n content: memory.content,\n },\n },\n format\n );\n if (!serialized.ok()) {\n throwCliError({ code: 'SERIALIZE_FAILED', message: serialized.error.message });\n }\n out.write(serialized.value + '\\n');\n }\n}\n\n/**\n * The `memory add` subcommand.\n *\n * Creates a new memory at the specified path. Content can be provided via:\n * - `--content` flag for inline text\n * - `--file` flag to read from a file\n * - stdin when piped\n *\n * The `--store` option is inherited from the parent `memory` command.\n */\nexport const addCommand = new Command('add')\n .description('Create a new memory')\n .argument('<path>', 'Memory path (e.g., project/tech-stack)')\n .option('-c, --content <text>', 'Memory content as inline text')\n .option('-f, --file <filepath>', 'Read content from a file')\n .option('-t, --tags <value...>', 'Tags (can be repeated or comma-separated)')\n .option('-e, --expires-at <date>', 'Expiration date (ISO 8601)')\n .option('--citation <value...>', 'Citation references (file paths or URLs)')\n .option('-o, --format <format>', 'Output format (yaml, json, toon)')\n .action(async (path, options, command) => {\n const parentOpts = command.parent?.opts() as { store?: string } | undefined;\n const context = await createCliCommandContext();\n if (!context.ok()) {\n throwCliError(context.error);\n }\n\n await handleAdd(context.value, parentOpts?.store, path, options);\n });\n",
8
+ "/**\n * Error mapping utilities for CLI commands.\n *\n * This module provides utilities to map core Result errors to Commander.js\n * exceptions. Commander.js uses specific exception types to control error\n * output and exit codes:\n *\n * - `InvalidArgumentError` - For user input validation errors (shows usage help)\n * - `CommanderError` - For other errors (shows error message only)\n *\n * @example\n * ```ts\n * const result = await runAddCommand(options);\n * if (!result.ok()) {\n * mapCoreError(result.error);\n * }\n * ```\n */\n\nimport { InvalidArgumentError, CommanderError } from '@commander-js/extra-typings';\n\n/**\n * Represents a core error with a code and message.\n *\n * This interface matches the error shape used throughout the CLI commands,\n * allowing consistent error handling across all command implementations.\n */\nexport interface CoreError {\n code: string;\n message: string;\n cause?: unknown;\n}\n\n/**\n * Error codes that indicate invalid user input or arguments.\n *\n * These errors result in `InvalidArgumentError` which causes Commander.js\n * to display usage help alongside the error message.\n *\n * Includes:\n * - Path validation errors (`INVALID_PATH`)\n * - Argument parsing errors (`INVALID_ARGUMENTS`)\n * - Store configuration errors (`INVALID_STORE_NAME`, `INVALID_STORE_PATH`)\n * - Content input errors (`MISSING_CONTENT`, `MULTIPLE_CONTENT_SOURCES`, `CONTENT_INPUT_FAILED`)\n * - Command syntax errors (`INVALID_COMMAND`)\n */\nconst ARGUMENT_ERROR_CODES = new Set([\n // Path validation\n 'INVALID_PATH',\n 'INVALID_FILE_PATH',\n 'INVALID_SOURCE_PATH',\n 'INVALID_DESTINATION_PATH',\n\n // Argument parsing\n 'INVALID_ARGUMENTS',\n\n // Store configuration\n 'INVALID_STORE_NAME',\n 'INVALID_STORE_PATH',\n\n // Content input\n 'MISSING_CONTENT',\n 'MULTIPLE_CONTENT_SOURCES',\n 'CONTENT_INPUT_FAILED',\n\n // Command syntax\n 'INVALID_COMMAND',\n\n // Git detection (user needs to provide --name)\n 'GIT_REPO_REQUIRED',\n]);\n\n/**\n * Maps a core error to a Commander.js exception and throws it.\n *\n * This function examines the error code to determine the appropriate\n * Commander.js exception type:\n *\n * - **Argument errors** (`InvalidArgumentError`): For errors caused by invalid\n * user input. Commander.js displays usage help for these errors.\n *\n * - **Other errors** (`CommanderError`): For system errors, missing resources,\n * or internal failures. Commander.js displays only the error message.\n *\n * @param error - The core error to map\n * @throws {InvalidArgumentError} When the error code indicates invalid input\n * @throws {CommanderError} For all other error codes\n *\n * @example\n * ```ts\n * // In a command action handler\n * const result = await runShowCommand(options);\n * if (!result.ok()) {\n * mapCoreError(result.error);\n * // Never reaches here - mapCoreError always throws\n * }\n * ```\n */\nexport function throwCliError(error: CoreError): never {\n if (ARGUMENT_ERROR_CODES.has(error.code)) {\n throw new InvalidArgumentError(error.message);\n }\n\n throw new CommanderError(1, error.code, error.message);\n}\n",
9
+ "/**\n * CLI helpers for resolving memory content input.\n */\n\nimport { readFile } from 'node:fs/promises';\nimport { err, ok, type Result } from '@yeseh/cortex-core';\n\nexport type MemoryContentSource = 'flag' | 'file' | 'stdin' | 'none';\n\nexport type InputSource = {\n content?: string;\n filePath?: string;\n /**\n * stdin stream to read from.\n *\n * NOTE: Passing a stream does not necessarily mean stdin is intended as an input\n * source. Use `stdinRequested: true` when a command semantics include reading from\n * stdin by default (e.g. `memory add`), typically when piping.\n */\n stream?: NodeJS.ReadableStream;\n /**\n * Explicitly indicates stdin should be considered as an input source.\n *\n * This is `false` by default so that inheriting a non-TTY stdin in test harnesses\n * or subprocess environments does not accidentally count as providing `--stdin`.\n */\n stdinRequested?: boolean;\n};\n\nexport interface InputContent {\n content: string | null;\n source: MemoryContentSource;\n}\n\nexport type InputErrorCode =\n | 'MULTIPLE_CONTENT_SOURCES'\n | 'FILE_READ_FAILED'\n | 'MISSING_CONTENT'\n | 'INVALID_FILE_PATH';\n\nexport interface InputError {\n code: InputErrorCode;\n message: string;\n path?: string;\n cause?: unknown;\n}\n\ntype InputResult = Result<InputContent, InputError>;\ntype OptionalContentResult = Result<InputContent | null, InputError>;\n\nexport const readContentFromFile = async (\n filePath: string | undefined,\n): Promise<OptionalContentResult> => {\n if (filePath === undefined) {\n return ok(null);\n }\n const trimmed = filePath.trim();\n if (!trimmed) {\n return err({\n code: 'INVALID_FILE_PATH',\n message: 'File path must be a non-empty string.',\n });\n }\n try {\n const content = await readFile(trimmed, 'utf8');\n return ok({ content, source: 'file' });\n }\n catch (error) {\n return err({\n code: 'FILE_READ_FAILED',\n message: `Failed to read content file: ${trimmed}.`,\n path: trimmed,\n cause: error,\n });\n }\n};\n\nexport const readContentFromStream = async (\n stream: NodeJS.ReadableStream,\n): Promise<OptionalContentResult> => {\n const isTty = 'isTTY' in stream ? Boolean(stream.isTTY) : false;\n if (isTty) {\n return ok(null);\n }\n\n if ('setEncoding' in stream && typeof stream.setEncoding === 'function') {\n stream.setEncoding('utf8');\n }\n\n let data = '';\n for await (const chunk of stream) {\n data += String(chunk);\n }\n\n return ok({ content: data, source: 'stdin' });\n};\n\n/*\n * Main function to resolve content input from various sources.\n */\nexport const resolveInput = async (source: InputSource): Promise<InputResult> => {\n const contentProvided = source.content !== undefined;\n const fileProvided = source.filePath !== undefined && source.filePath.trim() !== '';\n\n // stdin must be explicitly requested by the caller. Merely having a stream\n // attached (e.g. inherited stdin in a subprocess) should not count as providing\n // an input source.\n const streamRequested =\n source.stdinRequested === true &&\n source.stream !== null &&\n source.stream !== undefined &&\n !('isTTY' in source.stream && Boolean((source.stream as { isTTY?: boolean }).isTTY));\n\n const requestedSources = [\n contentProvided,\n fileProvided,\n streamRequested,\n ].filter(Boolean);\n\n if (requestedSources.length > 1) {\n return err({\n code: 'MULTIPLE_CONTENT_SOURCES',\n message: 'Provide either --content, --file, or --stdin, not multiple sources.',\n });\n }\n\n if (contentProvided) {\n return ok({ content: source.content ?? '', source: 'flag' });\n }\n\n const fileResult = await readContentFromFile(source.filePath);\n if (!fileResult.ok()) {\n return fileResult;\n }\n if (fileResult.value) {\n return ok(fileResult.value);\n }\n\n if (streamRequested) {\n const stdinResult = await readContentFromStream(source.stream!);\n if (!stdinResult.ok()) {\n return stdinResult;\n }\n if (stdinResult.value) {\n return ok(stdinResult.value);\n }\n }\n\n return ok({ content: null, source: 'none' });\n};\n",
10
+ "import { throwCliError } from '../errors';\n\nexport const parseTags = (raw?: string[]): string[] =>\n raw\n ? raw\n .flatMap((tag) => tag.split(','))\n .map((tag) => tag.trim())\n .filter(Boolean)\n : [];\n\nexport const parseExpiresAt = (raw?: string): Date | undefined => {\n if (!raw) {\n return undefined;\n }\n\n const parsed = new Date(raw);\n if (Number.isNaN(parsed.getTime())) {\n throwCliError({ code: 'INVALID_ARGUMENTS', message: 'Invalid expiration date format' });\n }\n\n return parsed;\n};\n",
11
+ "import {\n Cortex,\n err,\n getDefaultSettings,\n ok,\n type ConfigValidationError,\n type CortexContext,\n type Result,\n} from '@yeseh/cortex-core';\nimport { homedir } from 'os';\nimport { isAbsolute, resolve } from 'path';\nimport { FilesystemStorageAdapter, FilesystemConfigAdapter } from '@yeseh/cortex-storage-fs';\nimport { stdin, stdout } from 'process';\nimport { createCliLogger } from './observability.ts';\n\n// TODO: Much of this module should move to the FS adapter, since it's all about loading config from the filesystem. The CLI command handlers should just call into the core module to load config and create a context, rather than having all the logic here.\n\nconst makeAbsolute = (pathStr: string): string => {\n if (pathStr.startsWith('~')) {\n return resolve(homedir(), pathStr.slice(1).replace(/^[/\\\\]/, ''));\n }\n return isAbsolute(pathStr) ? pathStr : resolve(pathStr);\n};\n\nexport const validateStorePath = (\n storePath: string,\n storeName: string\n): Result<void, ConfigValidationError> => {\n if (!isAbsolute(storePath)) {\n return err({\n code: 'INVALID_STORE_PATH',\n message:\n `Store '${storeName}' path must be absolute. Got: ${storePath}. ` +\n \"Use an absolute path like '/home/user/.cortex/memory'.\",\n store: storeName,\n });\n }\n return ok(undefined);\n};\n\nexport interface ConfigLoadOptions {\n cwd?: string;\n globalConfigPath?: string;\n localConfigPath?: string;\n}\n\nexport interface CliContextOptions {\n configDir?: string;\n configCwd?: string;\n}\n\nexport interface CliConfigContext {\n configAdapter: FilesystemConfigAdapter;\n stores: Record<string, any>;\n settings: ReturnType<typeof getDefaultSettings>;\n effectiveCwd: string;\n}\n\nexport const createCliConfigAdapter = (configPath: string): FilesystemConfigAdapter => {\n return new FilesystemConfigAdapter(configPath);\n};\n\nexport const createCliAdapterFactory = (configAdapter: FilesystemConfigAdapter) => {\n return (storeName: string) => {\n const stores = configAdapter.stores!;\n const storeEntry = stores[storeName];\n if (!storeEntry) {\n const available = Object.keys(stores).join(', ') || 'none';\n throw new Error(\n `Store '${storeName}' is not registered. Available stores: ${available}. ` +\n 'Use --store to specify a registered store, or run `cortex store init` to create one.'\n );\n }\n\n const storePath = storeEntry.properties?.path as string | undefined;\n if (!storePath) {\n throw new Error(\n `Store '${storeName}' has no path configured. ` +\n 'Check your cortex config or re-run `cortex store init`.'\n );\n }\n\n return new FilesystemStorageAdapter(configAdapter, {\n rootDirectory: storePath,\n });\n };\n};\n\nexport const createCliConfigContext = async (\n options: CliContextOptions = {}\n): Promise<Result<CliConfigContext, any>> => {\n const envConfigPath = process.env.CORTEX_CONFIG;\n const envConfigDir = process.env.CORTEX_CONFIG_DIR;\n const envConfigCwd = process.env.CORTEX_CONFIG_CWD;\n\n const explicitConfigPath =\n typeof envConfigPath === 'string' && envConfigPath.length > 0\n ? makeAbsolute(envConfigPath)\n : undefined;\n\n const dir = options.configDir ?? envConfigDir ?? resolve(homedir(), '.config', 'cortex');\n\n const absoluteDir = makeAbsolute(dir);\n const configPath = explicitConfigPath ?? resolve(absoluteDir, 'config.yaml');\n\n const effectiveCwd =\n options.configCwd ??\n (typeof envConfigCwd === 'string' && envConfigCwd.length > 0\n ? envConfigCwd\n : process.cwd());\n\n const configAdapter = createCliConfigAdapter(configPath);\n const initResult = await configAdapter.initializeConfig();\n if (!initResult.ok()) {\n return initResult;\n }\n\n return ok({\n configAdapter,\n settings: configAdapter.settings!,\n stores: configAdapter.stores!,\n effectiveCwd,\n });\n};\n\n/* Creates a CortexContext from the CLI environment, including loading configuration and setting up dependencies.\n * This function is used to create a context object that can be injected into command handlers for consistent access to the Cortex client and other utilities.\n */\nexport const createCliCommandContext = async (\n configDir?: string\n): Promise<Result<CortexContext, any>> => {\n try {\n const configContextResult = await createCliConfigContext({\n configDir,\n });\n if (!configContextResult.ok()) {\n return configContextResult;\n }\n\n const { configAdapter, settings, stores } = configContextResult.value;\n const adapterFactory = createCliAdapterFactory(configAdapter);\n\n const now = () => new Date();\n const cortex = Cortex.init({\n settings,\n stores,\n adapterFactory,\n });\n\n const logger = createCliLogger();\n\n const context: CortexContext = {\n config: configAdapter,\n settings: settings ?? getDefaultSettings(),\n stores: stores ?? {},\n cortex,\n now,\n stdin,\n stdout,\n logger,\n };\n\n return ok(context);\n } catch (error) {\n return err({\n code: 'CONTEXT_CREATION_FAILED',\n message: `Unexpected error creating CLI command context: ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n};\n",
12
+ "/**\n * CLI observability — plain ConsoleLogger writing human-readable lines to stderr.\n *\n * No OTel SDK dependency — keeps the CLI binary small.\n * Debug output is gated by the `DEBUG=cortex` environment variable.\n *\n * @module cli/observability\n */\nimport type { Logger } from '@yeseh/cortex-core';\n\n/**\n * Creates a plain console logger for CLI usage.\n *\n * Writes human-readable log lines to stderr (not stdout) to avoid\n * polluting piped command output. Debug output is gated by the\n * `DEBUG=cortex` environment variable.\n *\n * @returns Logger instance writing to stderr\n *\n * @example\n * ```typescript\n * const logger = createCliLogger();\n * logger.info('Starting command', { store: 'global' });\n * // → INFO: Starting command store=global\n * ```\n *\n * @example\n * ```bash\n * # Enable debug output\n * DEBUG=cortex cortex memory list\n * ```\n */\nexport const createCliLogger = (): Logger => {\n const debugEnabled =\n typeof process.env.DEBUG === 'string' && process.env.DEBUG.includes('cortex');\n\n const stringifyMetaValue = (value: unknown): string => {\n if (typeof value === 'string') {\n return value.includes(' ') ? JSON.stringify(value) : value;\n }\n if (typeof value === 'number' || typeof value === 'boolean' || value === null) {\n return String(value);\n }\n return JSON.stringify(value);\n };\n\n const formatMeta = (meta?: Record<string, unknown>): string => {\n if (!meta || Object.keys(meta).length === 0) return '';\n return Object.entries(meta)\n .map(([key, value]) => `${key}=${stringifyMetaValue(value)}`)\n .join(' ');\n };\n\n const write = (level: string, msg: string, meta?: Record<string, unknown>): void => {\n const line = `${level.toUpperCase()}: ${msg}`;\n const metaText = formatMeta(meta);\n process.stderr.write(metaText.length > 0 ? `${line} ${metaText}\\n` : `${line}\\n`);\n };\n\n return {\n debug(msg: string, meta?: Record<string, unknown>): void {\n if (debugEnabled) write('debug', msg, meta);\n },\n info(msg: string, meta?: Record<string, unknown>): void {\n write('info', msg, meta);\n },\n warn(msg: string, meta?: Record<string, unknown>): void {\n write('warn', msg, meta);\n },\n error(msg: string, err?: Error | unknown, meta?: Record<string, unknown>): void {\n const errMeta =\n err instanceof Error\n ? debugEnabled\n ? { error: err.message, stack: err.stack }\n : { error: err.message }\n : err !== null && err !== undefined\n ? { error: String(err) }\n : {};\n write('error', msg, { ...meta, ...errMeta });\n },\n };\n};\n",
13
+ "/**\n * Output format types and serialization helpers.\n *\n * This module provides type definitions for CLI output payloads and a thin\n * wrapper around the core serialize function. Validation is expected to happen\n * at object construction time, not during serialization.\n */\n\nimport { err, ok, type Result } from '@yeseh/cortex-core';\nimport { serialize, type OutputFormat } from '@yeseh/cortex-core';\n\n// Re-export OutputFormat from core\nexport type { OutputFormat };\n\nexport interface OutputMemoryMetadata {\n createdAt: Date;\n updatedAt?: Date;\n tags: string[];\n source?: string;\n tokenEstimate?: number;\n expiresAt?: Date;\n}\n\nexport interface OutputPath {\n path: string;\n}\n\nexport interface OutputMemory {\n path: string;\n metadata: OutputMemoryMetadata;\n content: string;\n}\nexport interface OutputMovedMemory {\n from: string;\n to: string;\n}\n\nexport interface OutputCategoryMemory {\n path: string;\n tokenEstimate?: number;\n summary?: string;\n}\n\nexport interface OutputSubcategory {\n path: string;\n memoryCount: number;\n}\n\nexport interface OutputCategory {\n path: string;\n memories: OutputCategoryMemory[];\n subcategories: OutputSubcategory[];\n}\n\nexport interface OutputCreatedCategory {\n path: string;\n created: boolean;\n}\n\nexport interface OutputStore {\n name: string;\n path: string;\n}\n\nexport interface OutputStoreRegistry {\n stores: OutputStore[];\n}\n\nexport interface OutputStoreInit {\n path: string;\n name: string;\n}\n\nexport interface OutputInit {\n path: string;\n categories: string[];\n}\n\nexport type OutputPayload =\n | { kind: 'memory'; value: OutputMemory }\n | { kind: 'moved-memory'; value: OutputMovedMemory }\n | { kind: 'path'; value: OutputPath }\n | { kind: 'category'; value: OutputCategory }\n | { kind: 'created-category'; value: OutputCreatedCategory}\n | { kind: 'store'; value: OutputStore }\n | { kind: 'store-registry'; value: OutputStoreRegistry }\n | { kind: 'store-init'; value: OutputStoreInit }\n | { kind: 'init'; value: OutputInit };\n\nexport interface OutputSerializeError {\n code: 'INVALID_FORMAT' | 'SERIALIZE_FAILED';\n message: string;\n}\n\n/**\n * Serialize an output payload to the specified format.\n *\n * This is a thin wrapper around the core serialize function that extracts\n * the value from the discriminated union and handles errors.\n *\n * @param payload - The output payload to serialize\n * @param format - The output format ('yaml', 'json', or 'toon')\n * @returns Result with serialized string or error\n */\nexport const serializeOutput = (\n payload: OutputPayload,\n format: OutputFormat,\n): Result<string, OutputSerializeError> => {\n const result = serialize(payload, format);\n\n if (result.ok()) {\n return ok(result.value);\n }\n\n return err({\n code: result.error.code === 'INVALID_FORMAT' ? 'INVALID_FORMAT' : 'SERIALIZE_FAILED',\n message: result.error.message,\n });\n};\n",
14
+ "/**\n * Utility for resolving which store to target when no `--store` flag is given.\n *\n * Resolution order (first match wins):\n * 1. Explicit store name provided by the caller (from `--store` flag)\n * 2. Local store – a registered store whose path starts with `<cwd>/.cortex`\n * 3. `settings.defaultStore` from the Cortex config file\n * 4. Hard-coded fallback: `\"global\"`\n *\n * @module cli/utils/resolve-default-store\n *\n * @example\n * ```typescript\n * // In a command handler:\n * const storeName = resolveDefaultStore(ctx, parentOpts?.store);\n * const storeResult = ctx.cortex.getStore(storeName);\n * ```\n */\n\nimport { join } from 'node:path';\nimport type { CortexContext } from '@yeseh/cortex-core';\n\n/**\n * Resolves the effective store name for a command invocation.\n *\n * When a user runs a command without `--store` in a project directory where\n * they have run `cortex store init`, the local store registered for that\n * directory is automatically selected so they don't have to type `--store`\n * on every command.\n *\n * @param ctx - The current Cortex context (provides `stores`, `settings`, `cwd`)\n * @param explicit - Store name from the `--store` CLI flag (may be undefined)\n * @returns The resolved store name to use\n *\n * @example\n * ```typescript\n * // No --store flag, inside /home/user/my-project with a .cortex store:\n * resolveDefaultStore(ctx, undefined);\n * // → \"my-project\" (the store registered at /home/user/my-project/.cortex)\n *\n * // Explicit flag always wins:\n * resolveDefaultStore(ctx, \"global\");\n * // → \"global\"\n * ```\n */\nexport function resolveDefaultStore(ctx: CortexContext, explicit: string | undefined): string {\n // 1. Explicit --store flag wins\n if (explicit) return explicit;\n\n const cwd = ctx.cwd ?? process.cwd();\n const stores = ctx.stores ?? {};\n\n // 2. Local store – registered store whose path is the `.cortex` dir in cwd\n // Both `.cortex` and `.cortex/memory` are accepted to handle both\n // naming conventions in use across the project.\n const localPaths = [\n join(cwd, '.cortex'), join(cwd, '.cortex', 'memory'),\n ];\n for (const [\n name, store,\n ] of Object.entries(stores)) {\n const storePath = store.properties?.path as string | undefined;\n if (storePath && localPaths.includes(storePath)) {\n return name;\n }\n }\n\n // 3. settings.defaultStore from config\n const defaultStore = ctx.settings?.defaultStore;\n if (defaultStore) return defaultStore;\n\n // 4. Hard-coded fallback\n return 'global';\n}\n",
15
+ "/**\n * Memory show command for displaying a memory's content and metadata.\n *\n * This command reads a memory from the store and displays it in the\n * specified format. Expired memories are excluded by default unless\n * the `--include-expired` flag is provided.\n *\n * @example\n * ```bash\n * # Show a memory in YAML format (default)\n * cortex memory show project/notes\n *\n * # Show a memory in JSON format\n * cortex memory show project/notes --format json\n *\n * # Include expired memories\n * cortex memory show project/notes --include-expired\n *\n * # Use a specific store\n * cortex memory --store my-store show project/notes\n * ```\n */\n\nimport { Command } from '@commander-js/extra-typings';\nimport { throwCliError } from '../../errors.ts';\n\nimport { defaultTokenizer, MemoryPath, type CortexContext } from '@yeseh/cortex-core';\nimport { type StoreClient } from '@yeseh/cortex-core/store';\nimport { serializeOutput, type OutputMemory, type OutputFormat } from '../../output.ts';\nimport { createCliCommandContext } from '../../context.ts';\nimport { resolveDefaultStore } from '../../utils/resolve-default-store.ts';\n\n/**\n * Options for the show command.\n */\nexport interface ShowCommandOptions {\n /** Include expired memories in the output */\n includeExpired?: boolean;\n /** Output format (yaml, json, toon) */\n format?: string;\n}\n\n/**\n * Dependencies for the show command handler.\n * Allows injection for testing.\n */\nexport interface ShowHandlerDeps {\n /** Output stream for writing results (defaults to process.stdout) */\n stdout?: NodeJS.WritableStream;\n /** Pre-resolved store client for testing */\n store?: StoreClient;\n}\n\n/**\n * Handles the show command execution.\n *\n * This function:\n * 1. Resolves the store context\n * 2. Validates the memory path\n * 3. Reads the memory file from storage\n * 4. Parses the memory content and frontmatter\n * 5. Checks expiration status (unless --include-expired)\n * 6. Serializes and outputs the result\n *\n * @param path - The memory path to show (e.g., \"project/notes\")\n * @param options - Command options (includeExpired, format)\n * @param storeName - Optional store name from parent command\n * @param deps - Optional dependencies for testing\n * @throws {InvalidArgumentError} When the path is invalid\n * @throws {CommanderError} When the memory is not found or read fails\n */\nexport async function handleShow(\n ctx: CortexContext,\n storeName: string | undefined,\n path: string,\n options: ShowCommandOptions,\n deps: ShowHandlerDeps = {}\n): Promise<void> {\n const pathResult = MemoryPath.fromString(path);\n if (!pathResult.ok()) {\n throwCliError(pathResult.error);\n }\n\n const storeResult = ctx.cortex.getStore(resolveDefaultStore(ctx, storeName));\n if (!storeResult.ok()) {\n throwCliError(storeResult.error);\n }\n\n const store = deps.store ?? storeResult.value;\n\n const rootResult = store.root();\n if (!rootResult.ok()) {\n throwCliError(rootResult.error);\n }\n\n const categoryResult = pathResult.value.category.isRoot\n ? rootResult\n : rootResult.value.getCategory(pathResult.value.category.toString());\n if (!categoryResult.ok()) {\n throwCliError(categoryResult.error);\n }\n\n const memoryClient = categoryResult.value.getMemory(pathResult.value.slug.toString());\n const readResult = await memoryClient.get({\n includeExpired: options.includeExpired ?? false,\n now: ctx.now(),\n });\n if (!readResult.ok()) {\n throwCliError(readResult.error);\n }\n\n const memory = readResult.value;\n const tokenEstimateResult = defaultTokenizer.estimateTokens(memory.content);\n const tokenEstimate = tokenEstimateResult.ok() ? tokenEstimateResult.value : undefined;\n\n const outputMemory: OutputMemory = {\n path: memory.path.toString(),\n metadata: {\n createdAt: memory.metadata.createdAt,\n updatedAt: memory.metadata.updatedAt,\n tags: memory.metadata.tags,\n source: memory.metadata.source,\n tokenEstimate,\n expiresAt: memory.metadata.expiresAt,\n },\n content: memory.content,\n };\n\n const format = (options.format as OutputFormat) ?? 'yaml';\n const serialized = serializeOutput({ kind: 'memory', value: outputMemory }, format);\n if (!serialized.ok()) {\n throwCliError({ code: 'SERIALIZE_FAILED', message: serialized.error.message });\n }\n\n const out = deps.stdout ?? ctx.stdout;\n out.write(serialized.value + '\\n');\n}\n\n/**\n * The `show` subcommand for displaying a memory.\n *\n * Reads a memory from the store and displays its content and metadata\n * in the specified format. By default, expired memories are excluded.\n *\n * @example\n * ```bash\n * cortex memory show project/notes\n * cortex memory show project/notes --format json\n * cortex memory show project/notes --include-expired\n * ```\n */\nexport const showCommand = new Command('show')\n .description('Display a memory')\n .argument('<path>', 'Memory path to show')\n .option('-x, --include-expired', 'Include expired memories')\n .option('-o, --format <format>', 'Output format (yaml, json, toon)', 'yaml')\n .action(async (path, options, command) => {\n const parentOpts = command.parent?.opts() as { store?: string } | undefined;\n const context = await createCliCommandContext();\n if (!context.ok()) {\n throwCliError(context.error);\n }\n\n await handleShow(context.value, parentOpts?.store, path, options);\n });\n",
16
+ "/**\n * Memory update command implementation using Commander.js.\n *\n * Updates an existing memory at the specified path with new content, tags,\n * or expiration date.\n *\n * @example\n * ```bash\n * # Update memory content inline\n * cortex memory update project/tech-stack --content \"Updated stack: TypeScript\"\n *\n * # Update memory content from a file\n * cortex memory update project/notes --file ./updated-notes.md\n *\n * # Update tags\n * cortex memory update project/tech-stack --tags \"typescript,nodejs,updated\"\n *\n * # Update expiration date\n * cortex memory update project/temp --expires-at \"2026-12-31T00:00:00Z\"\n *\n * # Clear expiration date\n * cortex memory update project/temp --no-expires-at\n *\n * # Update from a specific store\n * cortex memory --store work update project/notes --content \"New content\"\n * ```\n */\n\nimport { Command } from '@commander-js/extra-typings';\nimport { throwCliError } from '../../errors.ts';\nimport { MemoryPath, type CortexContext, type UpdateMemoryInput } from '@yeseh/cortex-core';\nimport { resolveInput as resolveCliContent } from '../../utils/input.ts';\nimport { parseExpiresAt, parseTags } from '../parsing.ts';\nimport { createCliCommandContext } from '../../context.ts';\nimport { serializeOutput, type OutputFormat } from '../../output.ts';\nimport { resolveDefaultStore } from '../../utils/resolve-default-store.ts';\n\n/** Options parsed by Commander for the update command */\nexport interface UpdateCommandOptions {\n content?: string;\n file?: string;\n tags?: string[];\n /**\n * Expiration date from Commander.js option parsing.\n * - `string` — ISO 8601 date provided via `--expires-at <date>`\n * - `false` — expiration cleared via `--no-expires-at` negation flag\n * - `undefined` (omitted) — keep the existing value unchanged\n */\n expiresAt?: string | false;\n citation?: string[];\n format?: string;\n}\n\nconst parseUpdateExpiresAt = (raw?: string | false): Date | null | undefined => {\n if (raw === false) {\n return null;\n }\n\n if (!raw) {\n return undefined;\n }\n\n return parseExpiresAt(raw);\n};\n\nconst resolveUpdateContent = async (\n ctx: CortexContext,\n options: UpdateCommandOptions\n): Promise<string | null> => {\n if (options.content === undefined && options.file === undefined) {\n return null;\n }\n\n const content = await resolveCliContent({\n content: options.content,\n filePath: options.file,\n stream: ctx.stdin,\n // `memory update` does not read stdin.\n stdinRequested: false,\n });\n\n if (!content.ok()) {\n throwCliError(content.error);\n }\n\n if (!content.value.content) {\n throwCliError({\n code: 'MISSING_CONTENT',\n message: 'Memory content is required via --content or --file.',\n });\n }\n\n return content.value.content;\n};\n\nconst buildUpdates = (\n content: string | null,\n tags: string[] | undefined,\n expiresAt: Date | null | undefined,\n citations: string[] | undefined\n): UpdateMemoryInput => {\n const updates: UpdateMemoryInput = {};\n if (content !== null) {\n updates.content = content;\n }\n if (tags !== undefined) {\n updates.tags = tags;\n }\n if (expiresAt !== undefined) {\n updates.expiresAt = expiresAt;\n }\n if (citations !== undefined) {\n updates.citations = citations;\n }\n\n if (Object.keys(updates).length === 0) {\n throwCliError({\n code: 'INVALID_ARGUMENTS',\n message:\n 'No updates provided. Use --content, --file, --tags, --citation, or expiry flags.',\n });\n }\n\n return updates;\n};\n\n/**\n * Handler for the memory update command.\n * Exported for direct testing without Commander parsing.\n *\n * @param ctx - CLI context containing Cortex client and streams\n * @param storeName - Optional store name from parent command\n * @param path - Memory path to update (e.g., \"project/tech-stack\")\n * @param options - Command options from Commander\n */\nexport async function handleUpdate(\n ctx: CortexContext,\n storeName: string | undefined,\n path: string,\n options: UpdateCommandOptions\n): Promise<void> {\n const pathResult = MemoryPath.fromString(path);\n if (!pathResult.ok()) {\n throwCliError(pathResult.error);\n }\n\n const content = await resolveUpdateContent(ctx, options);\n const tags = options.tags === undefined ? undefined : parseTags(options.tags);\n const expiresAt = parseUpdateExpiresAt(options.expiresAt);\n const updates = buildUpdates(content, tags, expiresAt, options.citation);\n\n const storeResult = ctx.cortex.getStore(resolveDefaultStore(ctx, storeName));\n if (!storeResult.ok()) {\n throwCliError(storeResult.error);\n }\n\n const store = storeResult.value;\n const rootResult = store.root();\n if (!rootResult.ok()) {\n throwCliError(rootResult.error);\n }\n\n const categoryResult = pathResult.value.category.isRoot\n ? rootResult\n : rootResult.value.getCategory(pathResult.value.category.toString());\n if (!categoryResult.ok()) {\n throwCliError(categoryResult.error);\n }\n\n const memoryClient = categoryResult.value.getMemory(pathResult.value.slug.toString());\n const updateResult = await memoryClient.update(updates);\n if (!updateResult.ok()) {\n throwCliError(updateResult.error);\n }\n\n const memory = updateResult.value;\n const stdout = ctx.stdout ?? process.stdout;\n\n const rawFormat = options.format;\n if (!rawFormat) {\n stdout.write(`Updated memory ${memory.path.toString()}.\\n`);\n } else {\n const format = rawFormat as OutputFormat;\n const serialized = serializeOutput(\n {\n kind: 'memory',\n value: {\n path: memory.path.toString(),\n metadata: memory.metadata,\n content: memory.content,\n },\n },\n format\n );\n if (!serialized.ok()) {\n throwCliError({ code: 'SERIALIZE_FAILED', message: serialized.error.message });\n }\n stdout.write(serialized.value + '\\n');\n }\n}\n\n/**\n * The `memory update` subcommand.\n *\n * Updates an existing memory at the specified path. Can update:\n * - Content via `--content` flag for inline text or `--file` to read from a file\n * - Tags via `--tags` flag (replaces existing tags)\n * - Expiration via `--expires-at` or `--no-expires-at`\n *\n * The `--store` option is inherited from the parent `memory` command.\n */\nexport const updateCommand = new Command('update')\n .description('Update an existing memory')\n .argument('<path>', 'Memory path to update')\n .option('-c, --content <text>', 'New memory content as inline text')\n .option('-f, --file <filepath>', 'Read new content from a file')\n .option('-t, --tags <value...>', 'Tags (can be repeated or comma-separated, replaces existing)')\n .option('-e, --expires-at <date>', 'New expiration date (ISO 8601)')\n .option('--no-expires-at', 'Remove expiration date')\n .option('--citation <value...>', 'Citation references (replaces existing)')\n .option('-o, --format <format>', 'Output format (yaml, json, toon)')\n .action(async (path, options, command) => {\n const parentOpts = command.parent?.opts() as { store?: string } | undefined;\n const context = await createCliCommandContext();\n if (!context.ok()) {\n throwCliError(context.error);\n }\n\n await handleUpdate(context.value, parentOpts?.store, path, options);\n });\n",
17
+ "/**\n * Memory remove command implementation using Commander.js.\n *\n * Deletes an existing memory at the specified path.\n *\n * @example\n * ```bash\n * # Remove a memory\n * cortex memory remove project/tech-stack\n *\n * # Remove memory from a specific store\n * cortex memory --store work remove project/notes\n * ```\n */\n\nimport { Command } from '@commander-js/extra-typings';\nimport { throwCliError } from '../../errors.ts';\nimport { MemoryPath, type CortexContext } from '@yeseh/cortex-core';\nimport { createCliCommandContext } from '../../context.ts';\nimport { serializeOutput, type OutputFormat } from '../../output.ts';\nimport { resolveDefaultStore } from '../../utils/resolve-default-store.ts';\n\n/** Options for the remove command. */\nexport interface RemoveCommandOptions {\n /** Output format (yaml, json, toon) */\n format?: string;\n}\n\n/**\n * Handler for the memory remove command.\n * Exported for direct testing without Commander parsing.\n *\n * @param ctx - CLI context containing Cortex client and streams\n * @param storeName - Optional store name from parent command\n * @param path - Memory path to remove (e.g., \"project/tech-stack\")\n */\nexport async function handleRemove(\n ctx: CortexContext,\n storeName: string | undefined,\n path: string,\n options: RemoveCommandOptions = {}\n): Promise<void> {\n const pathResult = MemoryPath.fromString(path);\n if (!pathResult.ok()) {\n throwCliError(pathResult.error);\n }\n\n const storeResult = ctx.cortex.getStore(resolveDefaultStore(ctx, storeName));\n if (!storeResult.ok()) {\n throwCliError(storeResult.error);\n }\n\n const store = storeResult.value;\n const rootResult = store.root();\n if (!rootResult.ok()) {\n throwCliError(rootResult.error);\n }\n\n const categoryResult = pathResult.value.category.isRoot\n ? rootResult\n : rootResult.value.getCategory(pathResult.value.category.toString());\n if (!categoryResult.ok()) {\n throwCliError(categoryResult.error);\n }\n\n const memoryClient = categoryResult.value.getMemory(pathResult.value.slug.toString());\n const removeResult = await memoryClient.delete();\n if (!removeResult.ok()) {\n throwCliError(removeResult.error);\n }\n\n const out = ctx.stdout ?? process.stdout;\n const rawFormat = options.format;\n if (!rawFormat) {\n out.write(`Removed memory ${pathResult.value.toString()}.\\n`);\n } else {\n const format = rawFormat as OutputFormat;\n const serialized = serializeOutput(\n { kind: 'path', value: { path: pathResult.value.toString() } },\n format\n );\n if (!serialized.ok()) {\n throwCliError({ code: 'SERIALIZE_FAILED', message: serialized.error.message });\n }\n out.write(serialized.value + '\\n');\n }\n}\n\n/**\n * The `memory remove` subcommand.\n *\n * Deletes an existing memory at the specified path.\n *\n * The `--store` option is inherited from the parent `memory` command.\n */\nexport const removeCommand = new Command('remove')\n .description('Delete a memory')\n .argument('<path>', 'Memory path to remove')\n .option('-o, --format <format>', 'Output format (yaml, json, toon)')\n .action(async (path, options, command) => {\n const parentOpts = command.parent?.opts() as { store?: string } | undefined;\n const context = await createCliCommandContext();\n if (!context.ok()) {\n throwCliError(context.error);\n }\n\n await handleRemove(context.value, parentOpts?.store, path, options);\n });\n",
18
+ "/**\n * Memory move command implementation using Commander.js.\n *\n * Moves a memory from one path to another within the same store.\n *\n * @example\n * ```bash\n * # Move a memory to a new location\n * cortex memory move project/old-name project/new-name\n *\n * # Move with explicit store\n * cortex memory --store my-store move project/old project/new\n * ```\\n */\n\nimport { Command } from '@commander-js/extra-typings';\nimport { throwCliError } from '../../errors.ts';\nimport { MemoryPath, type CortexContext } from '@yeseh/cortex-core';\nimport { createCliCommandContext } from '../../context.ts';\nimport { serializeOutput, type OutputFormat } from '../../output.ts';\nimport { resolveDefaultStore } from '../../utils/resolve-default-store.ts';\n\n/** Options for the move command. */\nexport interface MoveCommandOptions {\n /** Output format (yaml, json, toon) */\n format?: string;\n}\n\n/**\n * Handler for the memory move command.\n * Exported for direct testing without Commander parsing.\n *\n * @param ctx - CLI context containing Cortex client and streams\n * @param storeName - Optional store name from parent command\n * @param from - Source memory path\n * @param to - Destination memory path\n */\nexport async function handleMove(\n ctx: CortexContext,\n storeName: string | undefined,\n from: string,\n to: string,\n options: MoveCommandOptions = {}\n): Promise<void> {\n const fromResult = MemoryPath.fromString(from);\n if (!fromResult.ok()) {\n throwCliError(fromResult.error);\n }\n\n const toResult = MemoryPath.fromString(to);\n if (!toResult.ok()) {\n throwCliError(toResult.error);\n }\n\n const storeResult = ctx.cortex.getStore(resolveDefaultStore(ctx, storeName));\n if (!storeResult.ok()) {\n throwCliError(storeResult.error);\n }\n\n const store = storeResult.value;\n const rootResult = store.root();\n if (!rootResult.ok()) {\n throwCliError(rootResult.error);\n }\n\n const sourceCategoryResult = fromResult.value.category.isRoot\n ? rootResult\n : rootResult.value.getCategory(fromResult.value.category.toString());\n if (!sourceCategoryResult.ok()) {\n throwCliError(sourceCategoryResult.error);\n }\n\n const sourceMemory = sourceCategoryResult.value.getMemory(fromResult.value.slug.toString());\n const moveResult = await sourceMemory.move(toResult.value);\n if (!moveResult.ok()) {\n throwCliError(moveResult.error);\n }\n\n const out = ctx.stdout ?? process.stdout;\n const rawFormat = options.format;\n if (!rawFormat) {\n out.write(`Moved memory ${fromResult.value.toString()} to ${toResult.value.toString()}.\\n`);\n } else {\n const format = rawFormat as OutputFormat;\n const serialized = serializeOutput(\n {\n kind: 'moved-memory',\n value: { from: fromResult.value.toString(), to: toResult.value.toString() },\n },\n format\n );\n if (!serialized.ok()) {\n throwCliError({ code: 'SERIALIZE_FAILED', message: serialized.error.message });\n }\n out.write(serialized.value + '\\n');\n }\n}\n\n/**\n * The `memory move` subcommand.\n *\n * Moves a memory from one path to another within the store.\n * Both paths must be valid memory slug paths.\n *\n * The `--store` option is inherited from the parent `memory` command.\n */\nexport const moveCommand = new Command('move')\n .description('Move a memory to a new path')\n .argument('<from>', 'Source memory path')\n .argument('<to>', 'Destination memory path')\n .option('-o, --format <format>', 'Output format (yaml, json, toon)')\n .action(async (from, to, options, command) => {\n const parentOpts = command.parent?.opts() as { store?: string } | undefined;\n const context = await createCliCommandContext();\n if (!context.ok()) {\n throwCliError(context.error);\n }\n\n await handleMove(context.value, parentOpts?.store, from, to, options);\n });\n",
19
+ "/**\n * Memory list command for browsing memories with optional filtering.\n *\n * Lists all memories in a category, or all memories across all categories\n * if no category is specified. Expired memories are excluded by default\n * unless the `--include-expired` flag is provided.\n *\n * When no category is specified, the command dynamically discovers all\n * root categories from the store's index rather than using a hardcoded list.\n *\n * @example\n * ```bash\n * # List all memories\n * cortex memory list\n *\n * # List memories in a specific category\n * cortex memory list project/cortex\n *\n * # Include expired memories\n * cortex memory list --include-expired\n *\n * # Output in JSON format\n * cortex memory list --format json\n *\n * # Use a specific store (either placement works)\n * cortex memory list -s my-store\n * cortex memory -s my-store list\n * ```\n */\n\nimport { Command } from '@commander-js/extra-typings';\nimport { throwCliError } from '../../errors.ts';\n\nimport { CategoryPath, type CategoryClient } from '@yeseh/cortex-core/category';\nimport { serialize, type CortexContext } from '@yeseh/cortex-core';\nimport type { SubcategoryEntry } from '@yeseh/cortex-core/category';\nimport { type OutputFormat } from '../../output.ts';\nimport { createCliCommandContext } from '../../context.ts';\nimport { resolveDefaultStore } from '../../utils/resolve-default-store.ts';\n\n/**\n * Options for the list command.\n */\nexport interface ListCommandOptions {\n /** Include expired memories in the output */\n includeExpired?: boolean;\n /** Output format (yaml, json, toon) */\n format?: string;\n /** Store name (can be specified on subcommand or parent) */\n store?: string;\n}\n\n/**\n * Dependencies for the list command handler.\n * Allows injection for testing.\n */\nexport interface ListHandlerDeps {\n /** Output stream for writing results (defaults to process.stdout) */\n stdout?: NodeJS.WritableStream;\n /** Current time for expiration checks */\n now?: Date;\n}\n\n/**\n * Entry representing a memory in the list output.\n */\nexport interface ListMemoryEntry {\n path: string;\n tokenEstimate: number;\n summary?: string;\n expiresAt?: Date;\n isExpired: boolean;\n}\n\n/**\n * Entry representing a subcategory in the list output.\n */\nexport interface ListSubcategoryEntry {\n path: string;\n memoryCount: number;\n description?: string;\n}\n\n/**\n * Result of the list command containing memories and subcategories.\n */\nexport interface ListResult {\n memories: ListMemoryEntry[];\n subcategories: ListSubcategoryEntry[];\n}\n\n/**\n * Handles the list command execution.\n *\n * This function:\n * 1. Resolves the store context\n * 2. Loads category index (or all categories if none specified)\n * 3. Collects memories and subcategories, filtering expired if needed\n * 4. Formats and outputs the result\n *\n * @param category - Optional category path to list (lists all if omitted)\n * @param options - Command options (includeExpired, format)\n * @param storeName - Optional store name from parent command\n * @param deps - Optional dependencies for testing\n * @throws {InvalidArgumentError} When arguments are invalid\n * @throws {CommanderError} When read or parse fails\n */\nexport async function handleList(\n ctx: CortexContext,\n storeName: string | undefined,\n category: string | undefined,\n options: ListCommandOptions,\n deps: ListHandlerDeps = {}\n): Promise<void> {\n const categoryResult = CategoryPath.fromString(category ?? '');\n if (!categoryResult.ok()) {\n throwCliError(categoryResult.error);\n }\n\n const storeResult = ctx.cortex.getStore(resolveDefaultStore(ctx, storeName));\n if (!storeResult.ok()) {\n throwCliError(storeResult.error);\n }\n\n const rootResult = storeResult.value.root();\n if (!rootResult.ok()) {\n throwCliError(rootResult.error);\n }\n\n const root = rootResult.value;\n let categoryClient: CategoryClient;\n\n if (categoryResult.value.isRoot) {\n categoryClient = root;\n } else {\n const categoryClientResult = root.getCategory(categoryResult.value.toString());\n if (!categoryClientResult.ok()) {\n throwCliError(categoryClientResult.error);\n }\n\n categoryClient = categoryClientResult.value;\n }\n const now = deps.now ?? ctx.now();\n const includeExpired = options.includeExpired ?? false;\n const visited = new Set<string>();\n\n const collectMemories = async (client: CategoryClient): Promise<ListMemoryEntry[]> => {\n const categoryKey = client.rawPath;\n if (visited.has(categoryKey)) {\n return [];\n }\n visited.add(categoryKey);\n\n const memoriesResult = await client.listMemories({ includeExpired });\n if (!memoriesResult.ok()) {\n throwCliError(memoriesResult.error);\n }\n\n const memories: ListMemoryEntry[] = [];\n for (const entry of memoriesResult.value) {\n const memoryClient = client.getMemory(entry.path.slug.toString());\n const memoryResult = await memoryClient.get({ includeExpired: true, now });\n if (!memoryResult.ok()) {\n if (memoryResult.error.code === 'MEMORY_NOT_FOUND') {\n continue;\n }\n if (!includeExpired && memoryResult.error.code === 'MEMORY_EXPIRED') {\n continue;\n }\n throwCliError(memoryResult.error);\n }\n\n const memory = memoryResult.value;\n const isExpired = memory.isExpired(now);\n if (!includeExpired && isExpired) {\n continue;\n }\n\n memories.push({\n path: entry.path.toString(),\n tokenEstimate: entry.tokenEstimate,\n summary: undefined,\n expiresAt: memory.metadata.expiresAt,\n isExpired,\n });\n }\n\n const subcategoriesResult = await client.listSubcategories();\n if (!subcategoriesResult.ok()) {\n throwCliError(subcategoriesResult.error);\n }\n\n for (const subcategory of subcategoriesResult.value) {\n const subcategoryClientResult = root.getCategory(subcategory.path.toString());\n if (!subcategoryClientResult.ok()) {\n throwCliError(subcategoryClientResult.error);\n }\n const subMemories = await collectMemories(subcategoryClientResult.value);\n memories.push(...subMemories);\n }\n\n return memories;\n };\n\n const subcategoriesResult = await categoryClient.listSubcategories();\n if (!subcategoriesResult.ok()) {\n throwCliError(subcategoriesResult.error);\n }\n\n const memories = await collectMemories(categoryClient);\n const result: ListResult = {\n memories,\n subcategories: subcategoriesResult.value.map((subcategory: SubcategoryEntry) => ({\n path: subcategory.path.toString(),\n memoryCount: subcategory.memoryCount,\n description: subcategory.description,\n })),\n };\n\n // 3. Format and output\n const validFormats = ['yaml', 'json', 'toon'] as const;\n const format: OutputFormat = validFormats.includes(options.format as OutputFormat)\n ? (options.format as OutputFormat)\n : 'yaml';\n const output = serialize(result, format);\n if (!output.ok()) {\n throwCliError({ code: 'SERIALIZE_FAILED', message: output.error.message });\n }\n\n const out = deps.stdout ?? ctx.stdout;\n out.write(output.value + '\\n');\n}\n\n/**\n * The `list` subcommand for browsing memories.\n *\n * Lists memories in a category, or all memories across all root categories\n * if no category is specified. By default, expired memories are excluded.\n *\n * The `--store` option can be specified either on this command or on the\n * parent `memory` command for flexibility.\n *\n * @example\n * ```bash\n * cortex memory list\n * cortex memory list project/cortex\n * cortex memory list --include-expired\n * cortex memory list --format json\n * cortex memory list -s my-store\n * cortex memory -s my-store list\n * ```\n */\nexport const listCommand = new Command('list')\n .description('List memories in a category')\n .argument('[category]', 'Category path to list (lists all if omitted)')\n .option('-s, --store <name>', 'Use a specific named store')\n .option('-x, --include-expired', 'Include expired memories')\n .option('-o, --format <format>', 'Output format (yaml, json, toon)', 'yaml')\n .action(async (category, options, command) => {\n const parentOpts = command.parent?.opts() as { store?: string } | undefined;\n // Allow store to be specified on either the subcommand or parent command\n const storeName = options.store ?? parentOpts?.store;\n const context = await createCliCommandContext();\n if (!context.ok()) {\n throwCliError(context.error);\n }\n\n await handleList(context.value, storeName, category, options);\n });\n",
20
+ "/**\n * Store command group for the Cortex CLI.\n *\n * Provides store management operations including listing, adding, removing,\n * and initializing memory stores. Also includes maintenance commands for\n * pruning expired memories and reindexing stores.\n *\n * The `--store` option is defined at the group level and inherited by all\n * subcommands, allowing users to specify which store to operate on.\n *\n * @example\n * ```bash\n * cortex store list # List all registered stores\n * cortex store add <name> <path> # Register a store\n * cortex store remove <name> # Unregister a store\n * cortex store init [path] # Initialize a new store\n * cortex store prune # Remove expired memories\n * cortex store reindex # Rebuild store indexes\n * ```\n */\nimport { Command } from '@commander-js/extra-typings';\n\nimport { listCommand } from './commands/list.ts';\nimport { addCommand } from './commands/add.ts';\nimport { removeCommand } from './commands/remove.ts';\nimport { initCommand } from './commands/init.ts';\nimport { pruneCommand } from './commands/prune.ts';\nimport { reindexCommand } from './commands/reindexs.ts';\n\n// Re-export resolveStoreName from its own utility module so callers that\n// previously imported it from this file continue to work.\nexport { resolveStoreName } from './utils/resolve-store-name.ts';\n\n/**\n * Store command group.\n *\n * The `--store` option is inherited by all subcommands, allowing operations\n * to target a specific named store rather than using automatic store resolution.\n */\nexport const storeCommand = new Command('store')\n .description('Store management')\n .option('-s, --store <name>', 'Use a specific named store');\n\nstoreCommand.addCommand(listCommand);\nstoreCommand.addCommand(addCommand);\nstoreCommand.addCommand(removeCommand);\nstoreCommand.addCommand(initCommand);\nstoreCommand.addCommand(pruneCommand);\nstoreCommand.addCommand(reindexCommand);\n",
21
+ "/**\n * Store list command for displaying all registered stores.\n *\n * This command reads the store registry and displays all registered\n * stores sorted alphabetically by name.\n *\n * @example\n * ```bash\n * # List all stores in YAML format (default)\n * cortex store list\n *\n * # List all stores in JSON format\n * cortex store list --format json\n * ```\n */\n\nimport { Command } from '@commander-js/extra-typings';\nimport { type CortexContext } from '@yeseh/cortex-core';\nimport { throwCliError } from '../../errors.ts';\nimport { createCliCommandContext } from '../../context.ts';\nimport { serializeOutput, type OutputStoreRegistry, type OutputFormat } from '../../output.ts';\n\n/**\n * Options for the list command.\n */\nexport interface ListCommandOptions {\n /** Output format (yaml, json, toon) */\n format?: string;\n}\n\n/**\n * Dependencies for the list command handler.\n * Allows injection for testing.\n */\nexport interface ListHandlerDeps {\n /** Output stream for writing results (defaults to process.stdout) */\n stdout?: NodeJS.WritableStream;\n}\n\n/**\n * Handles the list command execution.\n *\n * This function:\n * 1. Gets stores from the context\n * 2. Formats the stores as a sorted list\n * 3. Serializes and outputs the result\n *\n * @param ctx - The Cortex context containing stores configuration\n * @param options - Command options (format)\n * @param deps - Optional dependencies for testing\n * @throws {CommanderError} When serialization fails\n */\nexport async function handleList(\n ctx: CortexContext,\n options: ListCommandOptions,\n deps: ListHandlerDeps = {},\n): Promise<void> {\n // 1. Get stores from context\n const stores = Object.entries(ctx.stores)\n .map(([\n name, def,\n ]) => ({\n name,\n path: (def.properties as { path: string }).path,\n }))\n .sort((a, b) => a.name.localeCompare(b.name));\n\n const output: OutputStoreRegistry = { stores };\n\n // 2. Serialize and output\n const format: OutputFormat = (options.format as OutputFormat) ?? 'yaml';\n const serialized = serializeOutput({ kind: 'store-registry', value: output }, format);\n if (!serialized.ok()) {\n throwCliError({ code: 'SERIALIZE_FAILED', message: serialized.error.message });\n }\n\n const out = deps.stdout ?? process.stdout;\n out.write(serialized.value + '\\n');\n}\n\n/**\n * The `list` subcommand for displaying all registered stores.\n *\n * Reads the store registry and displays all stores sorted alphabetically\n * by name in the specified format.\n *\n * @example\n * ```bash\n * cortex store list\n * cortex store list --format json\n * ```\n */\nexport const listCommand = new Command('list')\n .description('List all registered stores')\n .option('-o, --format <format>', 'Output format (yaml, json, toon)', 'yaml')\n .action(async (options) => {\n const context = await createCliCommandContext();\n if (!context.ok()) {\n throwCliError(context.error);\n }\n await handleList(context.value, options);\n });\n",
22
+ "/**\n * Store add command for registering a new store.\n *\n * This command registers a new store in the global registry with a given\n * name and filesystem path. Paths are resolved relative to the current\n * working directory, with support for tilde expansion.\n *\n * @example\n * ```bash\n * # Register a store with an absolute path\n * cortex store add work /path/to/work/memories\n *\n * # Register a store with a relative path\n * cortex store add project ./cortex\n *\n * # Register a store with tilde expansion\n * cortex store add personal ~/memories\n * ```\n */\n\nimport { mkdir } from 'node:fs/promises';\nimport { dirname } from 'node:path';\nimport { Command } from '@commander-js/extra-typings';\nimport { throwCliError } from '../../errors.ts';\nimport { getDefaultConfigPath } from '../../utils/paths.ts';\nimport { serializeOutput, type OutputStore, type OutputFormat } from '../../output.ts';\nimport { resolveUserPath } from '../../utils/paths.ts';\nimport { Slug, parseConfig, type CortexContext, type ConfigStore } from '@yeseh/cortex-core';\nimport { createCliCommandContext } from '../../context.ts';\n\n/**\n * Options for the add command.\n */\nexport interface AddCommandOptions {\n /** Output format (yaml, json, toon) */\n format?: string;\n}\n\n/**\n * Dependencies for the add command handler.\n * Allows injection for testing.\n */\nexport interface AddHandlerDeps {\n /** Output stream for writing results (defaults to process.stdout) */\n stdout?: NodeJS.WritableStream;\n}\n\n/**\n * Validates store name input.\n *\n * @param name - The raw store name input\n * @returns The validated, trimmed store name\n * @throws {InvalidArgumentError} When the store name is empty or invalid\n */\nfunction validateStoreName(name: string): string {\n const slugResult = Slug.from(name);\n if (!slugResult.ok()) {\n throwCliError({\n code: 'INVALID_STORE_NAME',\n message: 'Store name must be a lowercase slug (letters, numbers, hyphens).',\n });\n }\n\n return slugResult.value.toString();\n}\n\n/**\n * Validates and resolves store path input.\n *\n * @param storePath - The raw store path input\n * @param cwd - The current working directory for relative path resolution\n * @returns The resolved absolute path\n * @throws {InvalidArgumentError} When the store path is empty\n */\nfunction validateAndResolvePath(storePath: string, cwd: string): string {\n const trimmed = storePath.trim();\n if (!trimmed) {\n throwCliError({ code: 'INVALID_STORE_PATH', message: 'Store path is required.' });\n }\n return resolveUserPath(trimmed, cwd);\n}\n\n/**\n * Writes the serialized output to the output stream.\n *\n * @param output - The store output payload\n * @param format - The output format\n * @param stdout - The output stream\n */\nfunction writeOutput(\n output: OutputStore,\n format: OutputFormat,\n stdout: NodeJS.WritableStream,\n): void {\n const serialized = serializeOutput({ kind: 'store', value: output }, format);\n if (!serialized.ok()) {\n throwCliError({ code: 'SERIALIZE_FAILED', message: serialized.error.message });\n }\n stdout.write(serialized.value + '\\n');\n}\n\n/**\n * Handles the add command execution.\n *\n * This function:\n * 1. Validates the store name format\n * 2. Validates and resolves the store path\n * 3. Checks if store already exists in context\n * 4. Reads current config file\n * 5. Adds the store to the config and saves\n * 6. Outputs the result\n *\n * @param ctx - The CortexContext with loaded configuration\n * @param name - The store name to register\n * @param storePath - The filesystem path to the store\n * @param options - Command options (format)\n * @param deps - Optional dependencies for testing\n * @throws {InvalidArgumentError} When the store name or path is invalid\n * @throws {CommanderError} When the store already exists or config operations fail\n */\nexport async function handleAdd(\n ctx: CortexContext,\n name: string,\n storePath: string,\n options: AddCommandOptions = {},\n deps: AddHandlerDeps = {},\n): Promise<void> {\n const cwd = ctx.cwd ?? process.cwd();\n const stdout = deps.stdout ?? ctx.stdout ?? process.stdout;\n const configPath = getDefaultConfigPath();\n\n // 1. Validate inputs\n const trimmedName = validateStoreName(name);\n const resolvedPath = validateAndResolvePath(storePath, cwd);\n\n // 2. Check if store already exists in context\n if (ctx.stores[trimmedName]) {\n throwCliError({\n code: 'STORE_ALREADY_EXISTS',\n message: `Store '${trimmedName}' is already registered.`,\n });\n }\n\n // 3. Read current config file (or start with empty config if it doesn't exist)\n const configFile = Bun.file(configPath);\n let parsedConfig: { settings?: unknown; stores: Record<string, unknown> };\n\n if (await configFile.exists()) {\n let configContents: string;\n try {\n configContents = await configFile.text();\n }\n catch {\n throwCliError({\n code: 'CONFIG_READ_FAILED',\n message: `Failed to read config at ${configPath}`,\n });\n }\n\n const parsed = parseConfig(configContents!);\n if (!parsed.ok()) {\n throwCliError(parsed.error);\n }\n parsedConfig = parsed.value;\n }\n else {\n // Config doesn't exist yet — start with empty config\n parsedConfig = { settings: undefined, stores: {} };\n // Ensure config directory exists\n await mkdir(dirname(configPath), { recursive: true });\n }\n\n // 4. Add new store to config\n const newStore: ConfigStore = {\n kind: 'filesystem',\n categoryMode: 'free',\n categories: {},\n properties: { path: resolvedPath },\n };\n\n const updatedConfig = {\n ...parsedConfig,\n stores: {\n ...parsedConfig.stores,\n [trimmedName]: newStore,\n },\n };\n\n // 5. Write updated config\n const serialized = Bun.YAML.stringify(updatedConfig, null, 2);\n try {\n await Bun.write(configPath, serialized);\n }\n catch {\n throwCliError({\n code: 'CONFIG_WRITE_FAILED',\n message: `Failed to write config at ${configPath}`,\n });\n }\n\n // 6. Output result\n const output: OutputStore = { name: trimmedName, path: resolvedPath };\n const format: OutputFormat = (options.format as OutputFormat) ?? 'yaml';\n writeOutput(output, format, stdout);\n}\n\n/**\n * The `add` subcommand for registering a new store.\n *\n * Registers a store with the given name and filesystem path. The path is\n * resolved relative to the current working directory, with support for\n * tilde expansion.\n *\n * @example\n * ```bash\n * cortex store add work /path/to/work/memories\n * cortex store add project ./cortex --format json\n * ```\n */\nexport const addCommand = new Command('add')\n .description('Register a new store')\n .argument('<name>', 'Store name (lowercase slug)')\n .argument('<path>', 'Filesystem path to the store')\n .option('-o, --format <format>', 'Output format (yaml, json, toon)', 'yaml')\n .action(async (name, path, options) => {\n const context = await createCliCommandContext();\n if (!context.ok()) {\n throwCliError(context.error);\n }\n await handleAdd(context.value, name, path, options);\n });\n",
23
+ "/**\n * Path resolution utilities for CLI commands.\n *\n * Provides cross-platform path handling including:\n * - Home directory (~) expansion\n * - Absolute path detection (Unix, Windows drive, UNC)\n * - Relative path resolution\n */\n\nimport { homedir } from 'node:os';\nimport { resolve } from 'node:path';\n\n/**\n * Checks if a path is absolute.\n * Handles Unix paths, Windows drive paths (C:\\), and UNC paths (\\\\server).\n */\nexport function isAbsolutePath(inputPath: string): boolean {\n // Unix absolute path\n if (inputPath.startsWith('/')) return true;\n // Windows drive path (e.g., C:\\, D:/)\n if (/^[a-zA-Z]:[/\\\\]/.test(inputPath)) return true;\n // UNC path (e.g., \\\\server\\share, //server/share)\n if (inputPath.startsWith('\\\\\\\\') || inputPath.startsWith('//')) return true;\n return false;\n}\n\n/**\n * Resolves a user-provided path to an absolute path.\n *\n * Handles:\n * - Home directory expansion (~)\n * - Absolute paths (returned as-is, normalized)\n * - Relative paths (resolved against cwd)\n *\n * @param inputPath - The path to resolve\n * @param cwd - Current working directory for relative path resolution\n * @returns Normalized absolute path\n */\nexport function resolveUserPath(inputPath: string, cwd: string): string {\n // Expand home directory\n if (inputPath.startsWith('~')) {\n const home = homedir();\n return resolve(home, inputPath.slice(1).replace(/^[/\\\\]/, ''));\n }\n // Already absolute\n if (isAbsolutePath(inputPath)) {\n return resolve(inputPath);\n }\n // Relative to cwd\n return resolve(cwd, inputPath);\n}\n\n/**\n * Default path to the global store.\n */\nexport const getDefaultGlobalStorePath = (): string =>\n resolve(homedir(), '.config', 'cortex', 'memory');\n\n/**\n * Default path to the store configuration file.\n * Respects CORTEX_CONFIG (config file path) and CORTEX_CONFIG_DIR (config directory)\n * environment variables when set.\n */\nexport const getDefaultConfigPath = (): string => {\n const envConfigPath = process.env.CORTEX_CONFIG;\n if (envConfigPath) {\n return resolve(envConfigPath);\n }\n\n const envConfigDir = process.env.CORTEX_CONFIG_DIR;\n if (envConfigDir) {\n return resolve(envConfigDir, 'config.yaml');\n }\n return resolve(homedir(), '.config', 'cortex', 'config.yaml');\n};\n",
24
+ "/**\n * Store remove command for unregistering a store.\n *\n * This command removes a store from the global registry. Note that this\n * only unregisters the store - it does not delete the actual data.\n *\n * @example\n * ```bash\n * # Remove a store from the registry\n * cortex store remove work\n * ```\n */\n\nimport { Command } from '@commander-js/extra-typings';\nimport { throwCliError } from '../../errors.ts';\nimport { getDefaultConfigPath } from '../../utils/paths.ts';\nimport { serializeOutput, type OutputStore, type OutputFormat } from '../../output.ts';\nimport { Slug, parseConfig, type CortexContext } from '@yeseh/cortex-core';\nimport { createCliCommandContext } from '../../context.ts';\n\n/**\n * Options for the remove command.\n */\nexport interface RemoveCommandOptions {\n /** Output format (yaml, json, toon) */\n format?: string;\n}\n\n/**\n * Dependencies for the remove command handler.\n * Allows injection for testing.\n */\nexport interface RemoveHandlerDeps {\n /** Output stream for writing results (defaults to process.stdout) */\n stdout?: NodeJS.WritableStream;\n}\n\n/**\n * Validates store name input.\n *\n * @param name - The raw store name input\n * @returns The validated, trimmed store name\n * @throws {InvalidArgumentError} When the store name is empty or invalid\n */\nfunction validateStoreName(name: string): string {\n const slugResult = Slug.from(name);\n if (!slugResult.ok()) {\n throwCliError({\n code: 'INVALID_STORE_NAME',\n message: 'Store name must be a lowercase slug (letters, numbers, hyphens).',\n });\n }\n\n return slugResult.value.toString();\n}\n\n/**\n * Writes the serialized output to the output stream.\n *\n * @param output - The store output payload\n * @param format - The output format\n * @param stdout - The output stream\n */\nfunction writeOutput(\n output: OutputStore,\n format: OutputFormat,\n stdout: NodeJS.WritableStream,\n): void {\n const serialized = serializeOutput({ kind: 'store', value: output }, format);\n if (!serialized.ok()) {\n throwCliError({ code: 'SERIALIZE_FAILED', message: serialized.error.message });\n }\n stdout.write(serialized.value + '\\n');\n}\n\n/**\n * Handles the remove command execution.\n *\n * This function:\n * 1. Validates the store name format\n * 2. Checks that the store exists in context\n * 3. Reads current config file\n * 4. Removes the store from the config and saves\n * 5. Outputs the result\n *\n * @param ctx - The Cortex context\n * @param name - The store name to unregister\n * @param options - Command options (format)\n * @param deps - Optional dependencies for testing\n * @throws {InvalidArgumentError} When the store name is invalid\n * @throws {CommanderError} When the store doesn't exist or config operations fail\n */\nexport async function handleRemove(\n ctx: CortexContext,\n name: string,\n options: RemoveCommandOptions = {},\n deps: RemoveHandlerDeps = {},\n): Promise<void> {\n const stdout = deps.stdout ?? ctx.stdout ?? process.stdout;\n const configPath = getDefaultConfigPath();\n\n // 1. Validate store name\n const trimmedName = validateStoreName(name);\n\n // 2. Check if store exists in context\n const existingStore = ctx.stores[trimmedName];\n if (!existingStore) {\n throwCliError({\n code: 'STORE_NOT_FOUND',\n message: `Store '${trimmedName}' is not registered.`,\n });\n }\n\n // Get the path from the existing store before removing\n const storePath = (existingStore.properties as { path: string }).path;\n\n // 3. Read current config file\n const configFile = Bun.file(configPath);\n if (!(await configFile.exists())) {\n throwCliError({\n code: 'CONFIG_NOT_FOUND',\n message: `Config file not found at ${configPath}. Cannot remove store.`,\n });\n }\n let configContents: string;\n try {\n configContents = await configFile.text();\n }\n catch {\n throwCliError({\n code: 'CONFIG_READ_FAILED',\n message: `Failed to read config at ${configPath}`,\n });\n }\n\n const configResult = parseConfig(configContents);\n if (!configResult.ok()) {\n throwCliError(configResult.error);\n }\n\n // 4. Remove store from config\n const { [trimmedName]: _removed, ...remainingStores } = configResult.value.stores ?? {};\n\n const updatedConfig = {\n ...configResult.value,\n stores: remainingStores,\n };\n\n // 5. Write updated config\n const serialized = Bun.YAML.stringify(updatedConfig, null, 2);\n try {\n await Bun.write(configPath, serialized);\n }\n catch {\n throwCliError({\n code: 'CONFIG_WRITE_FAILED',\n message: `Failed to write config at ${configPath}`,\n });\n }\n\n // 6. Output result\n const output: OutputStore = { name: trimmedName, path: storePath };\n const format: OutputFormat = (options.format as OutputFormat) ?? 'yaml';\n writeOutput(output, format, stdout);\n}\n\n/**\n * The `remove` subcommand for unregistering a store.\n *\n * Removes a store from the registry. This only unregisters the store\n * from the global registry - it does not delete the actual data.\n *\n * @example\n * ```bash\n * cortex store remove work\n * cortex store remove project --format json\n * ```\n */\nexport const removeCommand = new Command('remove')\n .description('Unregister a store from the registry')\n .argument('<name>', 'Store name to remove')\n .option('-o, --format <format>', 'Output format (yaml, json, toon)', 'yaml')\n .action(async (name, options) => {\n const context = await createCliCommandContext();\n if (!context.ok()) {\n throwCliError(context.error);\n }\n await handleRemove(context.value, name, options);\n });\n",
25
+ "/**\n * Store init command for initializing a new memory store.\n *\n * This command creates a new memory store at the specified path (or current\n * directory) and registers it in the global registry. The store name is\n * either explicitly provided via --name or auto-detected from the git\n * repository name.\n *\n * @example\n * ```bash\n * # Initialize store with auto-detected name from git repo\n * cortex store init\n *\n * # Initialize store with explicit name\n * cortex store init --name my-project\n *\n * # Initialize store at a specific path\n * cortex store init ./my-store --name my-project\n *\n * # Initialize store with tilde expansion\n * cortex store init ~/memories --name personal\n * ```\n */\n\nimport { Command } from '@commander-js/extra-typings';\nimport { resolve } from 'node:path';\nimport { stdin, stdout as processStdout } from 'node:process';\nimport { resolveStoreName } from '../utils/resolve-store-name.ts';\nimport { throwCliError } from '../../errors.ts';\nimport { type StoreData, initializeStore } from '@yeseh/cortex-core/store';\nimport { type CategoryMode, type CortexContext } from '@yeseh/cortex-core';\nimport { serializeOutput, type OutputStoreInit, type OutputFormat } from '../../output.ts';\nimport { resolveUserPath } from '../../utils/paths.ts';\nimport { createCliConfigContext } from '../../context.ts';\nimport { isTTY, defaultPromptDeps, type PromptDeps } from '../../utils/prompts.ts';\nimport type { FilesystemConfigAdapter } from '@yeseh/cortex-storage-fs';\nimport { FilesystemStorageAdapter } from '@yeseh/cortex-storage-fs';\n\n/**\n * Options for the init command.\n */\nexport interface InitCommandOptions {\n /** Explicit store name (otherwise auto-detected from git) */\n name?: string;\n /** Category mode for the store */\n categoryMode?: CategoryMode;\n /** Output format (yaml, json, toon) */\n format?: string;\n /** Optional description for the store */\n description?: string;\n}\n\n/**\n * Writes the serialized output to the output stream.\n *\n * @param output - The store init output payload\n * @param format - The output format\n * @param stdout - The output stream\n */\nfunction writeOutput(\n output: OutputStoreInit,\n format: OutputFormat,\n stdout: NodeJS.WritableStream,\n): void {\n const serialized = serializeOutput({ kind: 'store-init', value: output }, format);\n if (!serialized.ok()) {\n throwCliError({ code: 'SERIALIZE_FAILED', message: serialized.error.message });\n }\n stdout.write(serialized.value + '\\n');\n}\n\n/**\n * Prompts the user to confirm or change the resolved store name and path.\n *\n * Prompts are selectively skipped:\n * - Name prompt skipped when `explicit.name` is provided\n * - Path prompt skipped when `explicit.path` is provided\n * - All prompts skipped when stdin is not a TTY\n *\n * @param ctx - Cortex context used for TTY detection via `ctx.stdin`\n * @param resolved - Default store name and path to present as suggestions\n * @param explicit - Which values were provided explicitly by the user\n * @param promptDeps - Injectable prompt functions for testability\n * @returns Finalized store name and path\n */\nasync function promptStoreInitOptions(\n ctx: CortexContext,\n resolved: { storeName: string; storePath: string },\n explicit: { name?: string; path?: string },\n promptDeps: PromptDeps,\n): Promise<{ storeName: string; storePath: string }> {\n if (!isTTY(ctx.stdin)) return resolved;\n\n const storeName = explicit.name\n ? resolved.storeName\n : await promptDeps.input({ message: 'Store name:', default: resolved.storeName });\n\n let storePath: string;\n if (explicit.path) {\n storePath = resolved.storePath;\n }\n else {\n const promptedPath = await promptDeps.input({\n message: 'Store path:',\n default: resolved.storePath,\n });\n const trimmedPath = promptedPath.trim();\n storePath = resolveUserPath(trimmedPath, process.cwd());\n }\n\n return { storeName, storePath };\n}\n\n/**\n * Tries to resolve the store name. Returns an empty string when resolution\n * fails and stdin is a TTY (allowing the interactive prompt to take over).\n * Re-throws when stdin is not a TTY.\n *\n * @param cwd - Current working directory for git detection\n * @param explicitName - Optional explicit name from `--name` flag\n * @param tty - Whether stdin is a TTY\n */\nasync function resolveStoreNameOrEmpty(\n cwd: string,\n explicitName: string | undefined,\n tty: boolean,\n): Promise<string> {\n try {\n return await resolveStoreName(cwd, explicitName);\n }\n catch (e) {\n // When running in a TTY, only swallow errors (and fall back to prompting)\n // if no explicit name was provided. If the user passed an explicit --name,\n // re-throw so they see the actual invalid-name error.\n if (tty && !explicitName) return '';\n throw e;\n }\n}\n\n/**\n * Handles the store init command execution.\n *\n * This function:\n * 1. Resolves the store name (explicit or git detection; falls back to empty for TTY prompt)\n * 2. Resolves target path (default to .cortex in cwd)\n * 3. When stdin is a TTY, prompts for unresolved name and/or path\n * 4. Uses `store.initialize` to create directory, index, and register\n * 5. Outputs the result\n *\n * Interactive mode activates automatically when `ctx.stdin.isTTY === true`.\n * In non-TTY environments (CI, pipes) the command behaves exactly as before —\n * no behavioral regression.\n *\n * @param ctx - The Cortex context (stdin TTY state used for interactive detection)\n * @param targetPath - Optional path for the store (defaults to .cortex in cwd)\n * @param options - Command options (name, format, categoryMode, description)\n * @param promptDeps - Injectable prompt functions; defaults to real `@inquirer/prompts` functions\n * @throws {InvalidArgumentError} When the store name is invalid\n * @throws {CommanderError} When the store already exists or init fails\n *\n * @example\n * ```typescript\n * // Explicit name + path (no prompts even in TTY):\n * await handleInit(ctx, './my-store', { name: 'my-project' });\n *\n * // Interactive (TTY detected, no --name given):\n * await handleInit(ctx, undefined, {}, defaultPromptDeps);\n * ```\n */\nexport async function handleInit(\n ctx: CortexContext,\n targetPath: string | undefined,\n options: InitCommandOptions = {},\n promptDeps: PromptDeps = defaultPromptDeps,\n): Promise<void> {\n const cwd = ctx.cwd ?? process.cwd();\n const stdout = ctx.stdout ?? process.stdout;\n\n const storeName = await resolveStoreNameOrEmpty(cwd, options.name, isTTY(ctx.stdin));\n\n const storePath = targetPath\n ? resolveUserPath(targetPath.trim(), cwd)\n : resolve(cwd, '.cortex');\n\n const resolved = await promptStoreInitOptions(\n ctx,\n { storeName, storePath },\n { name: options.name, path: targetPath },\n promptDeps,\n );\n\n const finalStoreName = resolved.storeName;\n const finalStorePath = resolved.storePath;\n\n if (!finalStoreName) {\n throwCliError({\n code: 'INVALID_STORE_NAME',\n message: 'Store name is required. Use --name to specify one.',\n });\n }\n\n const storeData: StoreData = {\n kind: 'filesystem',\n categoryMode: (options.categoryMode as CategoryMode) ?? 'free',\n categories: [],\n properties: {\n path: finalStorePath,\n },\n description: options.description,\n };\n\n const adapter = new FilesystemStorageAdapter(ctx.config as FilesystemConfigAdapter, {\n rootDirectory: finalStorePath,\n });\n const createResult = await initializeStore(adapter, finalStoreName, storeData);\n if (!createResult.ok()) {\n throwCliError(createResult.error);\n }\n\n const output: OutputStoreInit = { path: finalStorePath, name: finalStoreName };\n const format: OutputFormat = (options.format as OutputFormat) ?? 'yaml';\n writeOutput(output, format, stdout);\n}\n\n/**\n * The `init` subcommand for initializing a new memory store.\n *\n * Creates a new store at the specified path (or .cortex in current directory)\n * and registers it in the global registry. The store name is auto-detected\n * from the git repository name or can be explicitly provided.\n *\n * @example\n * ```bash\n * cortex store init # Auto-detect name from git\n * cortex store init --name my-project # Explicit name\n * cortex store init ./store --name custom # Custom path and name\n * ```\n */\nexport const initCommand = new Command('init')\n .description('Initialize a new memory store')\n .argument('[path]', 'Path for the store (defaults to .cortex in current directory)')\n .option('-n, --name <name>', 'Explicit store name (otherwise auto-detected from git)')\n .option('-d, --description <description>', 'Optional description for the store')\n .option('-c, --category-mode <mode>', 'Category mode (free, strict, flat)', 'free')\n .option('-o, --format <format>', 'Output format (yaml, json, toon)', 'yaml')\n .action(async (path, options) => {\n const configCtx = await createCliConfigContext();\n if (!configCtx.ok()) {\n throwCliError(configCtx.error);\n }\n\n const { configAdapter, effectiveCwd } = configCtx.value;\n\n // Build a minimal context for handleInit. The init command cannot go\n // through the full CortexContext/adapterFactory because the store is\n // not yet registered — the adapter factory would throw STORE_NOT_FOUND.\n // handleInit only needs cwd, stdin, stdout, and config (to construct\n // its own adapter directly via initializeStore).\n const ctx = {\n config: configAdapter,\n cwd: effectiveCwd,\n stdin,\n stdout: processStdout,\n } as unknown as CortexContext;\n\n await handleInit(ctx, path, {\n name: options.name,\n description: options.description,\n categoryMode: options.categoryMode as CategoryMode,\n format: options.format,\n });\n });\n",
26
+ "/**\n * Utility for resolving the store name using a priority-based strategy.\n *\n * Extracted into its own module to avoid a circular dependency:\n * store/commands/init.ts → store/index.ts → store/commands/init.ts\n *\n * @module cli/store/utils/resolve-store-name\n */\n\nimport { Slug } from '@yeseh/cortex-core';\nimport { basename } from 'node:path';\nimport { detectGitRepoName } from '../../utils/git.ts';\nimport { throwCliError } from '../../errors.ts';\n\n/**\n * Resolves the store name using a priority-based strategy.\n *\n * Name resolution follows this precedence:\n * 1. **Explicit name** - If `--name` option is provided, use it directly\n * 2. **Git detection** - Auto-detect from git repository directory name\n * 3. **Folder name** - Use the current folder name if git detection fails\n * 4. **Error** - Fail with guidance to use `--name` flag\n *\n * Git repository names are normalized to valid store name format:\n * - Converted to lowercase\n * - Non-alphanumeric characters replaced with hyphens\n * - Leading/trailing hyphens removed\n *\n * @param cwd - Current working directory\n * @param explicitName - Optional explicit name provided via `--name` option\n * @returns The validated store name\n * @throws {InvalidArgumentError} When the name is invalid\n * @throws {CommanderError} When git detection fails and no name provided\n */\nexport async function resolveStoreName(cwd: string, explicitName?: string): Promise<string> {\n // 1. Use explicit name if provided\n if (explicitName) {\n const slugResult = Slug.from(explicitName);\n if (!slugResult.ok()) {\n throwCliError({\n code: 'INVALID_STORE_NAME',\n message: 'Store name must be a lowercase slug (letters, numbers, hyphens).',\n });\n }\n\n return slugResult.value.toString();\n }\n\n // 2. Try git detection\n const gitName = await detectGitRepoName(cwd);\n if (gitName) {\n // Convert to valid store name (lowercase slug)\n const normalized = gitName\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-|-$/g, '');\n const slugResult = Slug.from(normalized);\n if (!slugResult.ok()) {\n throwCliError({\n code: 'INVALID_STORE_NAME',\n message: 'Could not derive valid store name from git repo.',\n });\n }\n return slugResult.value.toString();\n }\n\n // 3. Use the leaf folder name if git detection fails\n const folderName = basename(cwd);\n const slugResult = Slug.from(folderName);\n if (slugResult.ok()) {\n return slugResult.value.toString();\n }\n\n // 4. Error: require --name\n throwCliError({\n code: 'GIT_REPO_REQUIRED',\n message: 'Not in a git repository. Use --name to specify the store name.',\n });\n}\n",
27
+ "import { spawn } from 'node:child_process';\nimport { basename } from 'node:path';\n\n/**\n * Executes a git command and returns the trimmed stdout.\n */\nexport const runGitCommand = (\n args: string[],\n cwd: string,\n): Promise<{ ok: true; value: string } | { ok: false }> => {\n return new Promise((resolvePromise) => {\n const proc = spawn('git', args, { cwd });\n let stdout = '';\n\n proc.stdout.on('data', (data: Buffer) => {\n stdout += data.toString();\n });\n proc.on('close', (code: number | null) => {\n if (code === 0) {\n resolvePromise({ ok: true, value: stdout.trim() });\n }\n else {\n resolvePromise({ ok: false });\n }\n });\n proc.on('error', () => {\n resolvePromise({ ok: false });\n });\n });\n};\n\n/**\n * Detects the git repository name from the current working directory.\n *\n * Uses `git rev-parse --show-toplevel` to find the repository root,\n * then extracts the directory name as the repository name.\n *\n * @param cwd - The current working directory to check for git repository\n * @returns The repository directory name, or `null` if not in a git repository\n */\nexport const detectGitRepoName = async (cwd: string): Promise<string | null> => {\n const result = await runGitCommand([\n 'rev-parse', '--show-toplevel',\n ], cwd);\n if (!result.ok) {\n return null;\n }\n return basename(result.value);\n};\n\n\n",
28
+ "/**\n * Shared prompt utilities for interactive CLI commands.\n *\n * Provides TTY detection and injectable prompt dependencies (`PromptDeps`) so\n * command handlers remain fully testable without spawning real terminals.\n *\n * Interactive mode activates automatically when stdin is a TTY (same heuristic\n * as git and npm). In non-TTY environments (CI, pipes, scripts) the prompts are\n * simply skipped.\n *\n * @module cli/prompts\n */\n\nimport { input, confirm } from '@inquirer/prompts';\n\n/**\n * Async function that prompts the user for a text value.\n *\n * @param opts - Prompt options\n * @param opts.message - The prompt message displayed to the user\n * @param opts.default - The default value shown in the prompt\n * @returns A promise resolving to the user's input or the default\n */\nexport type InputFn = (opts: { message: string; default?: string }) => Promise<string>;\n\n/**\n * Async function that prompts the user for a boolean confirmation.\n *\n * @param opts - Prompt options\n * @param opts.message - The prompt message displayed to the user\n * @param opts.default - The default answer (true = yes, false = no)\n * @returns A promise resolving to the user's answer\n */\nexport type ConfirmFn = (opts: { message: string; default?: boolean }) => Promise<boolean>;\n\n/**\n * Injectable dependencies for interactive prompts.\n *\n * Pass real functions (from `@inquirer/prompts`) in production and stub\n * implementations in tests to avoid blocking on terminal input.\n *\n * @example\n * ```typescript\n * // Production\n * const deps = defaultPromptDeps;\n *\n * // Test stub\n * const deps: PromptDeps = {\n * input: async ({ default: d }) => d ?? 'test-value',\n * confirm: async () => true,\n * };\n * ```\n */\nexport interface PromptDeps {\n input: InputFn;\n confirm: ConfirmFn;\n}\n\n/**\n * Default prompt dependencies backed by `@inquirer/prompts`.\n * Use this in production; inject stubs in tests.\n */\nexport const defaultPromptDeps: PromptDeps = { input, confirm };\n\n/**\n * Checks whether the given readable stream is an interactive terminal (TTY).\n *\n * Returns `true` only when `stream.isTTY === true`. Returns `false` for:\n * - `undefined` stream\n * - streams without an `isTTY` property (e.g. `PassThrough`)\n * - streams where `isTTY` is `false`\n *\n * This mirrors the same heuristic used by git and npm for auto-detecting\n * interactive mode.\n *\n * @param stream - The readable stream to check (usually `ctx.stdin`)\n * @returns `true` if the stream is a TTY, `false` otherwise\n *\n * @example\n * ```typescript\n * if (isTTY(ctx.stdin)) {\n * // Show interactive prompts\n * }\n * ```\n */\nexport function isTTY(stream: NodeJS.ReadableStream | undefined): boolean {\n return (stream as NodeJS.ReadStream | undefined)?.isTTY === true;\n}\n",
29
+ "/**\n * Store prune command for removing expired memories.\n *\n * This command removes expired memories from the current store or a specified\n * store. It supports a dry-run mode to preview what would be deleted.\n *\n * @module cli/commands/store/prune\n *\n * @example\n * ```bash\n * # Prune expired memories from the current store\n * cortex store prune\n *\n * # Preview what would be pruned (dry-run)\n * cortex store prune --dry-run\n *\n * # Prune from a specific store\n * cortex --store work store prune\n * ```\n */\n\nimport { Command } from '@commander-js/extra-typings';\nimport { throwCliError } from '../../errors.ts';\nimport { type CortexContext } from '@yeseh/cortex-core';\nimport { createCliCommandContext } from '../../context.ts';\nimport { resolveDefaultStore } from '../../utils/resolve-default-store.ts';\n\n/**\n * Options for the prune command.\n */\nexport interface PruneCommandOptions {\n /** Show what would be pruned without actually deleting */\n dryRun?: boolean;\n}\n\n/**\n * Dependencies for the prune command handler.\n * Allows injection for testing.\n */\nexport interface PruneHandlerDeps {\n /** Output stream for writing results (defaults to process.stdout) */\n stdout?: NodeJS.WritableStream;\n /** Current time for expiry checks (defaults to ctx.now()) */\n now?: Date;\n}\n\n/**\n * Handles the prune command execution.\n *\n * Thin CLI handler that delegates all business logic to the core\n * prune operation via CategoryClient. This handler is responsible\n * only for:\n * 1. Resolving the store via CortexContext\n * 2. Calling the category prune operation\n * 3. Formatting output for the CLI (dry-run preview vs. deletion summary)\n *\n * After pruning, the core operation automatically triggers a reindex to\n * clean up category indexes for removed memories.\n *\n * @module cli/commands/store/prune\n *\n * @param ctx - CortexContext providing access to Cortex client\n * @param storeName - Optional store name from the parent `--store` flag;\n * when `undefined`, resolves the default store\n * @param options - Command options controlling pruning behavior\n * @param options.dryRun - When `true`, lists expired memories without deleting\n * @param deps - Optional injected dependencies for testing\n * @throws {InvalidArgumentError} When the store cannot be resolved\n * (e.g., store name does not exist)\n * @throws {CommanderError} When the core prune operation fails\n * (e.g., I/O errors, serialization failures)\n *\n * @example\n * ```typescript\n * // Direct invocation in tests\n * const out = new PassThrough();\n * await handlePrune(ctx, 'my-store', { dryRun: true }, {\n * stdout: out,\n * now: new Date('2025-01-01'),\n * });\n * ```\n */\nexport async function handlePrune(\n ctx: CortexContext,\n storeName: string | undefined,\n options: PruneCommandOptions,\n deps: PruneHandlerDeps = {}\n): Promise<void> {\n const now = deps.now ?? ctx.now();\n const stdout = deps.stdout ?? ctx.stdout ?? process.stdout;\n\n // Get store through Cortex client\n const storeResult = ctx.cortex.getStore(resolveDefaultStore(ctx, storeName));\n if (!storeResult.ok()) {\n throwCliError(storeResult.error);\n }\n\n const store = storeResult.value;\n const rootResult = store.root();\n if (!rootResult.ok()) {\n throwCliError(rootResult.error);\n }\n\n // Use the category's prune method\n const result = await rootResult.value.prune({\n dryRun: options.dryRun,\n now,\n });\n\n if (!result.ok()) {\n throwCliError(result.error);\n }\n\n const pruned = result.value.pruned;\n\n // Format output\n if (pruned.length === 0) {\n stdout.write('No expired memories found.\\n');\n return;\n }\n\n const paths = pruned.map((entry) => entry.path).join('\\n ');\n if (options.dryRun) {\n stdout.write(`Would prune ${pruned.length} expired memories:\\n ${paths}\\n`);\n } else {\n stdout.write(`Pruned ${pruned.length} expired memories:\\n ${paths}\\n`);\n }\n}\n\n/**\n * The `prune` subcommand for removing expired memories.\n *\n * Removes all expired memories from the store. Use --dry-run to preview\n * what would be deleted without actually removing anything.\n *\n * @example\n * ```bash\n * cortex store prune\n * cortex store prune --dry-run\n * ```\n */\nexport const pruneCommand = new Command('prune')\n .description('Remove expired memories from the store')\n .option('--dry-run', 'Show what would be pruned without deleting')\n .action(async (options, command) => {\n const parentOpts = command.parent?.opts() as { store?: string } | undefined;\n const context = await createCliCommandContext();\n if (!context.ok()) {\n throwCliError(context.error);\n }\n await handlePrune(context.value, parentOpts?.store, options);\n });\n",
30
+ "/**\n * Store reindex command for rebuilding category indexes.\n *\n * This command rebuilds the category indexes for a store, which can help\n * repair corrupted indexes or synchronize them after manual file changes.\n *\n * @example\n * ```bash\n * # Reindex the default store\n * cortex store reindex\n *\n * # Reindex a specific named store\n * cortex store --store work reindex\n * ```\n */\n\nimport { Command } from '@commander-js/extra-typings';\nimport { throwCliError } from '../../errors.ts';\nimport { type CortexContext } from '@yeseh/cortex-core';\nimport { createCliCommandContext } from '../../context.ts';\nimport { resolveDefaultStore } from '../../utils/resolve-default-store.ts';\n\n/**\n * Dependencies for the reindex command handler.\n * Allows injection for testing.\n */\nexport interface ReindexHandlerDeps {\n /** Output stream for writing results (defaults to process.stdout) */\n stdout?: NodeJS.WritableStream;\n}\n\n/**\n * Handles the reindex command execution.\n *\n * This function:\n * 1. Resolves the store context (from --store option or default resolution)\n * 2. Gets the root category for the store\n * 3. Rebuilds the category indexes\n * 4. Outputs the result\n *\n * @param ctx - The Cortex context\n * @param storeName - Optional store name from parent --store option\n * @param deps - Optional dependencies for testing\n * @throws {CommanderError} When store resolution or reindexing fails\n */\nexport async function handleReindex(\n ctx: CortexContext,\n storeName: string | undefined,\n deps: ReindexHandlerDeps = {}\n): Promise<void> {\n const stdout = deps.stdout ?? ctx.stdout ?? process.stdout;\n\n // Get store through Cortex client\n const effectiveStoreName = resolveDefaultStore(ctx, storeName);\n const storeResult = ctx.cortex.getStore(effectiveStoreName);\n if (!storeResult.ok()) {\n throwCliError(storeResult.error);\n }\n\n const store = storeResult.value;\n const rootResult = store.root();\n if (!rootResult.ok()) {\n throwCliError(rootResult.error);\n }\n\n // Use the category's reindex method\n const reindexResult = await rootResult.value.reindex();\n if (!reindexResult.ok()) {\n throwCliError({ code: 'REINDEX_FAILED', message: reindexResult.error.message });\n }\n\n // Output result\n stdout.write(`Reindexed category indexes for store '${effectiveStoreName}'.\\n`);\n}\n\n/**\n * The `reindex` subcommand for rebuilding category indexes.\n *\n * Rebuilds the category indexes for a store, which can help repair corrupted\n * indexes or synchronize them after manual file changes.\n *\n * @example\n * ```bash\n * cortex store reindex\n * cortex store --store work reindex\n * ```\n */\nexport const reindexCommand = new Command('reindex')\n .description('Rebuild category indexes for the store')\n .action(async (_options, command) => {\n const parentOpts = command.parent?.opts() as { store?: string } | undefined;\n const context = await createCliCommandContext();\n if (!context.ok()) {\n throwCliError(context.error);\n }\n await handleReindex(context.value, parentOpts?.store);\n });\n",
31
+ "/**\n * Init command for initializing the global cortex configuration store.\n *\n * Creates the global config store at ~/.config/cortex/ with:\n * - config.yaml: Global configuration with default settings\n * - stores.yaml: Store registry with a 'global' store pointing to the memory directory\n * - memory/: Default store with 'global' and 'projects' categories\n *\n * @example\n * ```bash\n * # Initialize global cortex configuration\n * cortex init\n *\n * # Reinitialize even if already initialized\n * cortex init --force\n * ```\n */\n\nimport { homedir } from 'node:os';\nimport { resolve } from 'node:path';\nimport { Command } from '@commander-js/extra-typings';\nimport { throwCliError } from '../errors.ts';\nimport {\n serializeOutput,\n type OutputFormat,\n type OutputInit,\n type OutputPayload,\n} from '../output.ts';\nimport { defaultGlobalStoreCategories } from '@yeseh/cortex-core/category';\nimport {\n configCategoriesToStoreCategories,\n getDefaultSettings,\n type CortexConfig,\n type CortexContext,\n type StoreData,\n} from '@yeseh/cortex-core';\nimport { createCliCommandContext } from '../context.ts';\nimport { isTTY, defaultPromptDeps, type PromptDeps } from '../utils/prompts.ts';\n\n/**\n * Options for the init command.\n */\nexport interface InitCommandOptions {\n /** Reinitialize even if already initialized */\n force?: boolean;\n /** Output format (yaml, json, toon) */\n format?: string;\n}\n\n/**\n * The `init` command for initializing the global cortex configuration.\n *\n * Creates the global config store at ~/.config/cortex/ with default settings\n * and store registry.\n *\n * @example\n * ```bash\n * cortex init # Initialize global config\n * cortex init --force # Reinitialize even if exists\n * ```\n */\nexport const initCommand = new Command('init')\n .description('Initialize global cortex configuration')\n .option('-F, --force', 'Reinitialize even if already initialized')\n .option('-o, --format <format>', 'Output format (yaml, json, toon)', 'yaml')\n .action(async (options) => {\n const context = await createCliCommandContext();\n if (!context.ok()) {\n throwCliError({\n code: 'CONTEXT_CREATION_FAILED',\n message: `Failed to create command context: ${context.error.message}`,\n });\n }\n await handleInit(context.value, options);\n });\n\n/**\n * Prompts the user to confirm or change the resolved global store path and name.\n *\n * Returns `resolved` unchanged when stdin is not a TTY.\n *\n * @param ctx - Cortex context used for TTY detection via `ctx.stdin`\n * @param resolved - Default store name and path to present as suggestions\n * @param promptDeps - Injectable prompt functions for testability\n * @returns Finalized store name and path (either from prompts or from `resolved`)\n */\n\n/**\n * Resolve a user-supplied path:\n * - expands a leading '~' to the user's home directory\n * - resolves relative paths to an absolute path\n */\nfunction resolveUserPath(userPath: string): string {\n if (!userPath) return userPath;\n\n let expanded = userPath;\n if (userPath.startsWith('~')) {\n expanded = resolve(homedir(), userPath.slice(1));\n }\n\n return resolve(expanded);\n}\n\nfunction normalizeStoreName(input: string, fallback: string): string {\n const trimmed = input.trim();\n if (!trimmed) return fallback;\n\n const slug = trimmed\n .toLowerCase()\n .replace(/[^a-z0-9_-]+/gi, '-')\n .replace(/^-+|-+$/g, '');\n\n return slug || fallback;\n}\n\nfunction normalizeStorePath(input: string, fallback: string): string {\n const trimmed = input.trim();\n const base = trimmed || fallback;\n return resolveUserPath(base);\n}\n\nasync function promptInitOptions(\n ctx: CortexContext,\n resolved: { storeName: string; storePath: string },\n promptDeps: PromptDeps,\n): Promise<{ storeName: string; storePath: string }> {\n if (!isTTY(ctx.stdin)) {\n return {\n storeName: normalizeStoreName(resolved.storeName, resolved.storeName),\n storePath: normalizeStorePath(resolved.storePath, resolved.storePath),\n };\n }\n\n const storePathInput = await promptDeps.input({\n message: 'Global store path:',\n default: resolved.storePath,\n });\n const storeNameInput = await promptDeps.input({\n message: 'Global store name:',\n default: resolved.storeName,\n });\n\n const storeName = normalizeStoreName(storeNameInput, resolved.storeName);\n const storePath = normalizeStorePath(storePathInput, resolved.storePath);\n return { storePath, storeName };\n}\n\n// TODO: We should move this logic into the core package as a helper function, and just call it from the CLI command handler.\n// Use the ConfigAdapter to initialize the config store and write the default config, instead of manually writing files here. This way we can reuse the same initialization logic in other contexts (e.g. programmatic setup, tests).\n\n/**\n * Handles the init command execution.\n *\n * This function:\n * 1. When stdin is a TTY, prompts for global store path and name confirmation\n * 2. Initializes the global cortex config store\n * 3. Creates default categories\n * 4. Outputs the result\n *\n * Interactive mode activates automatically when `ctx.stdin.isTTY === true`.\n * In non-TTY environments (CI, pipes) the defaults are used without prompting.\n *\n * @param ctx - The Cortex context (stdin TTY state used for interactive detection)\n * @param options - Command options (force, format)\n * @param promptDeps - Injectable prompt functions; defaults to real `@inquirer/prompts` functions\n * @throws {InvalidArgumentError} When arguments are invalid\n * @throws {CommanderError} When initialization fails\n *\n * @example\n * ```typescript\n * // Non-interactive (CI / scripts):\n * await handleInit(ctx, { format: 'yaml' });\n *\n * // Force interactive with test stubs:\n * const stubs: PromptDeps = {\n * input: async ({ default: d }) => d ?? 'test',\n * confirm: async () => true,\n * };\n * (ctx.stdin as any).isTTY = true;\n * await handleInit(ctx, {}, stubs);\n * ```\n */\nexport async function handleInit(\n ctx: CortexContext,\n options: InitCommandOptions = {},\n promptDeps: PromptDeps = defaultPromptDeps,\n): Promise<void> {\n const cortexConfigDir = resolve(homedir(), '.config', 'cortex');\n const globalStorePath = resolve(cortexConfigDir, 'memory');\n\n const resolved = await promptInitOptions(\n ctx,\n { storeName: 'global', storePath: globalStorePath },\n promptDeps,\n );\n const finalStorePath = resolved.storePath;\n const finalStoreName = resolved.storeName;\n\n await initializeConfigAdapter(ctx);\n await ensureNotInitialized(ctx, finalStoreName, finalStorePath, options.force);\n await createGlobalStore(ctx, finalStoreName, finalStorePath);\n\n // Build output\n const output: OutputPayload = {\n kind: 'init',\n value: formatInit(finalStorePath, Object.keys(defaultGlobalStoreCategories)),\n };\n\n // Output result\n const format: OutputFormat = (options.format as OutputFormat) ?? 'yaml';\n const outputSerialized = serializeOrThrow(output, format);\n\n const out = ctx.stdout ?? process.stdout;\n out.write(outputSerialized.value + '\\n');\n}\n\nconst ensureNotInitialized = async (\n ctx: CortexContext,\n storeName: string,\n globalStorePath: string,\n force = false,\n): Promise<void> => {\n if (force) {\n return;\n }\n\n const existingStoreResult = await ctx.config.getStore(storeName);\n if (!existingStoreResult.ok()) {\n throwCliError(existingStoreResult.error);\n }\n\n if (!existingStoreResult.value) {\n return;\n }\n\n throwCliError({\n code: 'ALREADY_INITIALIZED',\n message: `Global config store already exists at ${globalStorePath}. Use --force to reinitialize.`,\n });\n};\n\nconst initializeConfigAdapter = async (ctx: CortexContext): Promise<void> => {\n const config: CortexConfig = {\n settings: getDefaultSettings(),\n stores: {},\n };\n\n const initConfigResult = await ctx.config.initializeConfig(config);\n if (!initConfigResult.ok()) {\n throwCliError(initConfigResult.error);\n }\n};\n\nconst serializeOrThrow = <T extends OutputPayload>(value: T, format: OutputFormat) => {\n const serialized = serializeOutput(value, format);\n if (!serialized.ok()) {\n throwCliError(serialized.error);\n }\n return serialized;\n};\n\nconst createGlobalStore = async (\n ctx: CortexContext,\n storeName: string,\n globalStorePath: string,\n): Promise<void> => {\n const existingStoreResult = await ctx.config.getStore(storeName);\n if (!existingStoreResult.ok()) {\n throwCliError(existingStoreResult.error);\n }\n\n if (existingStoreResult.value) {\n return;\n }\n\n const templateCategories = configCategoriesToStoreCategories(\n defaultGlobalStoreCategories,\n ).unwrap(); // defaultGlobalStoreCategories is valid, unwrap is safe here\n\n const globalStoreData: StoreData = {\n kind: 'filesystem',\n categoryMode: 'free',\n description:\n 'Global memory store for Cortex. Use for cross-project memories and configurations.',\n categories: templateCategories,\n properties: {\n path: globalStorePath,\n },\n };\n\n const saveStoreResult = await ctx.config.saveStore(storeName, globalStoreData);\n if (!saveStoreResult.ok()) {\n throwCliError(saveStoreResult.error);\n }\n};\n\nconst formatInit = (path: string, categories: readonly string[]): OutputInit => ({\n path,\n categories: [...categories],\n});\n\n",
32
+ "/**\n * Category command group for the CLI.\n *\n * This module defines the `category` command group, which provides operations\n * for managing categories in the Cortex memory system. The `--store` option\n * is defined at the group level and inherited by all subcommands.\n */\n\nimport { Command } from '@commander-js/extra-typings';\n\nimport { createCommand } from './commands/create';\n\n/**\n * The `category` command group.\n *\n * Provides category management operations. The `--store` option allows\n * targeting a specific named store instead of the default store.\n * This option is inherited by all subcommands.\n */\nexport const categoryCommand = new Command('category')\n .description('Category operations')\n .option('-s, --store <name>', 'Use a specific named store');\n\ncategoryCommand.addCommand(createCommand);\n",
33
+ "/**\n * Category create command.\n *\n * Creates a category at the specified path, including any missing ancestors.\n *\n * @example\n * ```bash\n * # Create a category in default store\n * cortex category create standards/typescript\n *\n * # Create a category in a specific store\n * cortex category --store my-store create standards/typescript\n *\n * # Serialize output as JSON\n * cortex category create standards --format json\n * ```\n */\n\nimport { Command } from '@commander-js/extra-typings';\nimport { type CortexContext, type Result } from '@yeseh/cortex-core';\n\nimport { createCliCommandContext } from '../../context.ts';\nimport { throwCliError } from '../../errors.ts';\nimport { serializeOutput, type OutputFormat } from '../../output.ts';\nimport { resolveDefaultStore } from '../../utils/resolve-default-store.ts';\n\n/** Options parsed by Commander for the create command */\nexport interface CreateCommandOptions {\n description?: string;\n format?: string;\n}\n\n/**\n * Writes command output to stdout.\n *\n * @param payload - Category creation result payload\n * @param options - Command options\n * @param stdout - Output stream\n */\nfunction writeCreateOutput(\n payload: { path: string; created: boolean },\n options: CreateCommandOptions,\n stdout: NodeJS.WritableStream\n): void {\n const rawFormat = options.format;\n\n if (!rawFormat) {\n const verb = payload.created ? 'Created' : 'Category already exists:';\n stdout.write(`${verb} ${payload.path}\\n`);\n return;\n }\n\n const serialized = serializeOutput(\n { kind: 'created-category', value: payload },\n rawFormat as OutputFormat\n );\n if (!serialized.ok()) {\n throwCliError({ code: 'SERIALIZE_FAILED', message: serialized.error.message });\n }\n stdout.write(serialized.value + '\\n');\n}\n\n/**\n * Unwrap a Result and throw a mapped CLI error on failure.\n *\n * @param result - Result value\n * @returns Unwrapped value\n */\nfunction unwrapOrThrow<T, E extends { code: string; message: string }>(result: Result<T, E>): T {\n if (!result.ok()) {\n throwCliError(result.error);\n }\n\n return result.value;\n}\n\n/**\n * Handler for the category create command.\n * Exported for direct testing without Commander parsing.\n *\n * @param ctx - CLI execution context\n * @param storeName - Optional store name from parent command\n * @param path - Category path (e.g., \"standards/typescript\")\n * @param options - Command options from Commander\n */\nexport async function handleCreate(\n ctx: CortexContext,\n storeName: string | undefined,\n path: string,\n options: CreateCommandOptions = {}\n): Promise<void> {\n const store = unwrapOrThrow(ctx.cortex.getStore(resolveDefaultStore(ctx, storeName)));\n const root = unwrapOrThrow(store.root());\n const category = unwrapOrThrow(root.getCategory(path));\n const result = unwrapOrThrow(await category.create());\n\n const out = ctx.stdout ?? process.stdout;\n writeCreateOutput(result, options, out);\n}\n\n/**\n * The `category create` subcommand.\n *\n * Creates a category and any missing ancestors.\n */\nexport const createCommand = new Command('create')\n .description('Create a category (and any missing ancestors)')\n .argument('<path>', 'Category path (e.g., standards/typescript)')\n .option('-d, --description <text>', 'Optional description for the category')\n .option('-o, --format <format>', 'Output format (yaml, json, toon)')\n .action(async (path, options, command) => {\n const parentOpts = command.parent?.opts() as { store?: string } | undefined;\n const context = await createCliCommandContext();\n if (!context.ok()) {\n throwCliError(context.error);\n }\n\n await handleCreate(context.value, parentOpts?.store, path, options);\n });\n"
34
+ ],
35
+ "mappings": ";;AASA,oBAAS;;;ACST,oBAAS;;;ACKT;;;ACJA;AA2BA,IAAM,uBAAuB,IAAI,IAAI;AAAA,EAEjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,EAGA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,EAGA;AACJ,CAAC;AA4BM,SAAS,aAAa,CAAC,OAAyB;AAAA,EACnD,IAAI,qBAAqB,IAAI,MAAM,IAAI,GAAG;AAAA,IACtC,MAAM,IAAI,qBAAqB,MAAM,OAAO;AAAA,EAChD;AAAA,EAEA,MAAM,IAAI,eAAe,GAAG,MAAM,MAAM,MAAM,OAAO;AAAA;;;ACnGzD;AACA;AA6CO,IAAM,sBAAsB,OAC/B,aACiC;AAAA,EACjC,IAAI,aAAa,WAAW;AAAA,IACxB,OAAO,GAAG,IAAI;AAAA,EAClB;AAAA,EACA,MAAM,UAAU,SAAS,KAAK;AAAA,EAC9B,IAAI,CAAC,SAAS;AAAA,IACV,OAAO,IAAI;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,IACb,CAAC;AAAA,EACL;AAAA,EACA,IAAI;AAAA,IACA,MAAM,UAAU,MAAM,SAAS,SAAS,MAAM;AAAA,IAC9C,OAAO,GAAG,EAAE,SAAS,QAAQ,OAAO,CAAC;AAAA,IAEzC,OAAO,OAAO;AAAA,IACV,OAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A3BSxC,IAAM,UAAU,IAAI,UAAQ,EACvB,KAAK,QAAQ,EACb,YAAY,6BAA6B,EACzC,QAAQ,gBAAY,OAAO;AAEhC,QAAQ,WAAW,aAAa;AAChC,QAAQ,WAAW,eAAe;AAClC,QAAQ,WAAW,YAAY;AAC/B,QAAQ,WAAW,YAAW;AAkBvB,IAAM,aAAa,YAA2B;AAAA,EACjD,IAAI;AAAA,IACA,MAAM,QAAQ,WAAW,QAAQ,IAAI;AAAA,IAEzC,OAAO,OAAO;AAAA,IAGV,MAAM,SAAS,gBAAgB;AAAA,IAC/B,IAAI,iBAAiB,OAAO;AAAA,MACxB,OAAO,MAAM,MAAM,OAAO;AAAA,IAC9B,EACK;AAAA,MACD,OAAO,MAAM,8BAA8B;AAAA;AAAA,IAE/C,QAAQ,WAAW;AAAA;AAAA;",
36
+ "debugId": "0802DEEFC967AC3164756E2164756E21",
37
+ "names": []
38
+ }
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Creates the global config store at ~/.config/cortex/ with:
5
5
  * - config.yaml: Global configuration with default settings
6
- * - stores.yaml: Store registry with a 'default' store pointing to the memory directory
6
+ * - stores.yaml: Store registry with a 'global' store pointing to the memory directory
7
7
  * - memory/: Default store with 'global' and 'projects' categories
8
8
  *
9
9
  * @example
@@ -17,6 +17,7 @@
17
17
  */
18
18
  import { Command } from '@commander-js/extra-typings';
19
19
  import { type CortexContext } from '@yeseh/cortex-core';
20
+ import { type PromptDeps } from '../utils/prompts.ts';
20
21
  /**
21
22
  * Options for the init command.
22
23
  */
@@ -46,13 +47,33 @@ export declare const initCommand: Command<[], {
46
47
  * Handles the init command execution.
47
48
  *
48
49
  * This function:
49
- * 1. Initializes the global cortex config store
50
- * 2. Creates default categories
51
- * 3. Outputs the result
50
+ * 1. When stdin is a TTY, prompts for global store path and name confirmation
51
+ * 2. Initializes the global cortex config store
52
+ * 3. Creates default categories
53
+ * 4. Outputs the result
52
54
  *
55
+ * Interactive mode activates automatically when `ctx.stdin.isTTY === true`.
56
+ * In non-TTY environments (CI, pipes) the defaults are used without prompting.
57
+ *
58
+ * @param ctx - The Cortex context (stdin TTY state used for interactive detection)
53
59
  * @param options - Command options (force, format)
60
+ * @param promptDeps - Injectable prompt functions; defaults to real `@inquirer/prompts` functions
54
61
  * @throws {InvalidArgumentError} When arguments are invalid
55
62
  * @throws {CommanderError} When initialization fails
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * // Non-interactive (CI / scripts):
67
+ * await handleInit(ctx, { format: 'yaml' });
68
+ *
69
+ * // Force interactive with test stubs:
70
+ * const stubs: PromptDeps = {
71
+ * input: async ({ default: d }) => d ?? 'test',
72
+ * confirm: async () => true,
73
+ * };
74
+ * (ctx.stdin as any).isTTY = true;
75
+ * await handleInit(ctx, {}, stubs);
76
+ * ```
56
77
  */
57
- export declare function handleInit(ctx: CortexContext, options?: InitCommandOptions): Promise<void>;
78
+ export declare function handleInit(ctx: CortexContext, options?: InitCommandOptions, promptDeps?: PromptDeps): Promise<void>;
58
79
  //# sourceMappingURL=init.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAStD,OAAO,EAIH,KAAK,aAAa,EAErB,MAAM,oBAAoB,CAAC;AAG5B;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,+CAA+C;IAC/C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW;;;MAalB,CAAC;AAEP;;;;;;;;;;;GAWG;AAIH,wBAAsB,UAAU,CAC5B,GAAG,EAAE,aAAa,EAClB,OAAO,GAAE,kBAAuB,GACjC,OAAO,CAAC,IAAI,CAAC,CAoBf"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAStD,OAAO,EAIH,KAAK,aAAa,EAErB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAA4B,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,+CAA+C;IAC/C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW;;;MAalB,CAAC;AA4EP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,UAAU,CAC5B,GAAG,EAAE,aAAa,EAClB,OAAO,GAAE,kBAAuB,EAChC,UAAU,GAAE,UAA8B,GAC3C,OAAO,CAAC,IAAI,CAAC,CA4Bf"}
package/dist/context.d.ts CHANGED
@@ -1,18 +1,23 @@
1
- /**
2
- * Store resolution utilities for CLI commands.
3
- *
4
- * This module provides functions to resolve the store context (root directory)
5
- * based on command-line options, current working directory, and the global
6
- * store configuration.
7
- */
8
- /**
9
- * Default path to the global store.
10
- */
11
- export declare const getDefaultGlobalStorePath: () => string;
12
- /**
13
- * Default path to the store configuration file.
14
- * Respects CORTEX_CONFIG (config file path) and CORTEX_CONFIG_DIR (config directory)
15
- * environment variables when set.
16
- */
17
- export declare const getDefaultConfigPath: () => string;
1
+ import { getDefaultSettings, type ConfigValidationError, type CortexContext, type Result } from '@yeseh/cortex-core';
2
+ import { FilesystemStorageAdapter, FilesystemConfigAdapter } from '@yeseh/cortex-storage-fs';
3
+ export declare const validateStorePath: (storePath: string, storeName: string) => Result<void, ConfigValidationError>;
4
+ export interface ConfigLoadOptions {
5
+ cwd?: string;
6
+ globalConfigPath?: string;
7
+ localConfigPath?: string;
8
+ }
9
+ export interface CliContextOptions {
10
+ configDir?: string;
11
+ configCwd?: string;
12
+ }
13
+ export interface CliConfigContext {
14
+ configAdapter: FilesystemConfigAdapter;
15
+ stores: Record<string, any>;
16
+ settings: ReturnType<typeof getDefaultSettings>;
17
+ effectiveCwd: string;
18
+ }
19
+ export declare const createCliConfigAdapter: (configPath: string) => FilesystemConfigAdapter;
20
+ export declare const createCliAdapterFactory: (configAdapter: FilesystemConfigAdapter) => (storeName: string) => FilesystemStorageAdapter;
21
+ export declare const createCliConfigContext: (options?: CliContextOptions) => Promise<Result<CliConfigContext, any>>;
22
+ export declare const createCliCommandContext: (configDir?: string) => Promise<Result<CortexContext, any>>;
18
23
  //# sourceMappingURL=context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAO,MACQ,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,QAAO,MAWvC,CAAC"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,kBAAkB,EAElB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,MAAM,EACd,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAa7F,eAAO,MAAM,iBAAiB,GAC1B,WAAW,MAAM,EACjB,WAAW,MAAM,KAClB,MAAM,CAAC,IAAI,EAAE,qBAAqB,CAWpC,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC7B,aAAa,EAAE,uBAAuB,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,QAAQ,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;IAChD,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,sBAAsB,GAAI,YAAY,MAAM,KAAG,uBAE3D,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,eAAe,uBAAuB,MAClE,WAAW,MAAM,6BAuB5B,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAC/B,UAAS,iBAAsB,KAChC,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAiCvC,CAAC;AAKF,eAAO,MAAM,uBAAuB,GAChC,YAAY,MAAM,KACnB,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,GAAG,CAAC,CAuCpC,CAAC"}
@@ -1,2 +1,10 @@
1
+ /**
2
+ * Unit tests for create-cli-command.ts — validateStorePath.
3
+ *
4
+ * Verifies that absolute paths pass validation and relative paths
5
+ * produce a typed INVALID_STORE_PATH error result.
6
+ *
7
+ * @module cli/create-cli-command.spec
8
+ */
1
9
  export {};
2
10
  //# sourceMappingURL=context.spec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.spec.d.ts","sourceRoot":"","sources":["../src/context.spec.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"context.spec.d.ts","sourceRoot":"","sources":["../src/context.spec.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
@@ -1 +1 @@
1
- {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/memory/commands/add.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,O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G;AACH,MAAM,WAAW,UAAU;IACvB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,aAAa,EAAE,oBAAoB,EAAE,CAAC;CACzC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,UAAU,CAC5B,GAAG,EAAE,aAAa,EAClB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,OAAO,EAAE,kBAAkB,EAC3B,IAAI,GAAE,eAAoB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAsHf;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,WAAW;;;;MAgBlB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"move.d.ts","sourceRoot":"","sources":["../../../src/memory/commands/move.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;WAYW;AAEX,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEtD,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIpE,oCAAoC;AACpC,MAAM,WAAW,kBAAkB;IAC/B,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAC5B,GAAG,EAAE,aAAa,EAClB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,kBAAuB,GACjC,OAAO,CAAC,IAAI,CAAC,CAkDf;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW;;MAalB,CAAC"}
1
+ {"version":3,"file":"move.d.ts","sourceRoot":"","sources":["../../../src/memory/commands/move.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;WAYW;AAEX,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEtD,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKpE,oCAAoC;AACpC,MAAM,WAAW,kBAAkB;IAC/B,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAC5B,GAAG,EAAE,aAAa,EAClB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,kBAAuB,GACjC,OAAO,CAAC,IAAI,CAAC,CAqDf;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW;;MAalB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/memory/commands/remove.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEtD,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIpE,sCAAsC;AACtC,MAAM,WAAW,oBAAoB;IACjC,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAC9B,GAAG,EAAE,aAAa,EAClB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,oBAAyB,GACnC,OAAO,CAAC,IAAI,CAAC,CA0Cf;AAED;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;;MAYpB,CAAC"}
1
+ {"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/memory/commands/remove.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEtD,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKpE,sCAAsC;AACtC,MAAM,WAAW,oBAAoB;IACjC,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAC9B,GAAG,EAAE,aAAa,EAClB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,oBAAyB,GACnC,OAAO,CAAC,IAAI,CAAC,CA6Cf;AAED;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;;MAYpB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"show.d.ts","sourceRoot":"","sources":["../../../src/memory/commands/show.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAGtD,OAAO,EAAgC,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAI5D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,6CAA6C;IAC7C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC5B,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC/B,4CAA4C;IAC5C,KAAK,CAAC,EAAE,WAAW,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,UAAU,CAC5B,GAAG,EAAE,aAAa,EAClB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,kBAAkB,EAC3B,IAAI,GAAE,eAAoB,GAC3B,OAAO,CAAC,IAAI,CAAC,CA2Df;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW;;;MAalB,CAAC"}
1
+ {"version":3,"file":"show.d.ts","sourceRoot":"","sources":["../../../src/memory/commands/show.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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