@stackmemoryai/stackmemory 0.5.1 → 0.5.2

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.
@@ -9,6 +9,13 @@ import {
9
9
  DEFAULT_WEIGHTS,
10
10
  DEFAULT_TOOL_SCORES
11
11
  } from "../../core/config/types.js";
12
+ import {
13
+ loadStorageConfig,
14
+ enableChromaDB,
15
+ disableChromaDB,
16
+ getStorageModeDescription
17
+ } from "../../core/config/storage-config.js";
18
+ import inquirer from "inquirer";
12
19
  function createConfigCommand() {
13
20
  const config = new Command("config").description(
14
21
  "Manage StackMemory configuration"
@@ -352,6 +359,80 @@ Profile: ${profile}`));
352
359
  console.log(" \u2022 Profile usage frequency");
353
360
  console.log(" \u2022 Score trends over time");
354
361
  });
362
+ const storageCmd = config.command("storage").description(
363
+ `Manage storage configuration
364
+
365
+ Storage Modes:
366
+ sqlite (default): Local storage only, fast, no external dependencies
367
+ hybrid: SQLite + ChromaDB for semantic search and cloud backup`
368
+ );
369
+ storageCmd.command("show").description("Show current storage configuration").action(async () => {
370
+ const storageConfig = loadStorageConfig();
371
+ console.log(chalk.blue("\nStorage Configuration:"));
372
+ console.log(` Mode: ${chalk.cyan(storageConfig.mode)}`);
373
+ console.log(` Description: ${chalk.gray(getStorageModeDescription())}`);
374
+ if (storageConfig.chromadb.enabled) {
375
+ console.log(chalk.blue("\nChromaDB Settings:"));
376
+ console.log(` Enabled: ${chalk.green("Yes")}`);
377
+ console.log(
378
+ ` API URL: ${chalk.gray(storageConfig.chromadb.apiUrl || "https://api.trychroma.com")}`
379
+ );
380
+ console.log(
381
+ ` Tenant: ${chalk.gray(storageConfig.chromadb.tenant || "default_tenant")}`
382
+ );
383
+ console.log(
384
+ ` Database: ${chalk.gray(storageConfig.chromadb.database || "default_database")}`
385
+ );
386
+ console.log(
387
+ ` API Key: ${chalk.gray(storageConfig.chromadb.apiKey ? "[configured]" : "[not set]")}`
388
+ );
389
+ } else {
390
+ console.log(chalk.blue("\nChromaDB Settings:"));
391
+ console.log(` Enabled: ${chalk.yellow("No")}`);
392
+ console.log(
393
+ chalk.gray(
394
+ " Enable with: stackmemory config storage enable-chromadb"
395
+ )
396
+ );
397
+ }
398
+ });
399
+ storageCmd.command("enable-chromadb").description("Enable ChromaDB for semantic search and cloud backup").option("--api-key <key>", "ChromaDB API key").option("--api-url <url>", "ChromaDB API URL", "https://api.trychroma.com").action(async (options) => {
400
+ let apiKey = options.apiKey;
401
+ if (!apiKey && process.stdin.isTTY) {
402
+ const answers = await inquirer.prompt([
403
+ {
404
+ type: "password",
405
+ name: "apiKey",
406
+ message: "Enter your ChromaDB API key:",
407
+ validate: (input) => {
408
+ if (!input || input.trim().length === 0) {
409
+ return "API key is required for ChromaDB";
410
+ }
411
+ return true;
412
+ }
413
+ }
414
+ ]);
415
+ apiKey = answers.apiKey;
416
+ }
417
+ if (!apiKey) {
418
+ console.log(chalk.red("[ERROR] ChromaDB API key is required."));
419
+ console.log(
420
+ chalk.gray("Provide via --api-key flag or run interactively.")
421
+ );
422
+ process.exit(1);
423
+ }
424
+ enableChromaDB({
425
+ apiKey,
426
+ apiUrl: options.apiUrl
427
+ });
428
+ console.log(chalk.green("[OK] ChromaDB enabled successfully."));
429
+ console.log(chalk.gray(`Storage mode: ${getStorageModeDescription()}`));
430
+ });
431
+ storageCmd.command("disable-chromadb").description("Disable ChromaDB and use SQLite-only storage").action(async () => {
432
+ disableChromaDB();
433
+ console.log(chalk.green("[OK] ChromaDB disabled."));
434
+ console.log(chalk.gray(`Storage mode: ${getStorageModeDescription()}`));
435
+ });
355
436
  return config;
356
437
  }
357
438
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/commands/config.ts"],
4
- "sourcesContent": ["/**\n * Config command for StackMemory CLI\n */\n\nimport { Command } from 'commander';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as yaml from 'js-yaml';\nimport chalk from 'chalk';\nimport { ConfigManager } from '../../core/config/config-manager.js';\nimport {\n DEFAULT_CONFIG,\n PRESET_PROFILES,\n ProfileConfig,\n ScoringWeights,\n DEFAULT_WEIGHTS,\n DEFAULT_TOOL_SCORES,\n} from '../../core/config/types.js';\n\nexport function createConfigCommand(): Command {\n const config = new Command('config').description(\n 'Manage StackMemory configuration'\n );\n\n config\n .command('validate')\n .description('Validate configuration file')\n .option(\n '-f, --file <path>',\n 'Path to config file',\n '.stackmemory/config.yaml'\n )\n .option('--fix', 'Attempt to auto-fix common issues')\n .action(async (options) => {\n console.log(chalk.blue('\uD83D\uDD0D Validating configuration...'));\n\n const configPath = path.resolve(options.file);\n const manager = new ConfigManager(configPath);\n const result = manager.validate();\n\n // Display errors\n if (result.errors.length > 0) {\n console.log(chalk.red('\\n\u2717 Errors:'));\n result.errors.forEach((error) => {\n console.log(chalk.red(` \u2022 ${error}`));\n });\n }\n\n // Display warnings\n if (result.warnings.length > 0) {\n console.log(chalk.yellow('\\n\u26A0 Warnings:'));\n result.warnings.forEach((warning) => {\n console.log(chalk.yellow(` \u2022 ${warning}`));\n });\n }\n\n // Display suggestions\n if (result.suggestions.length > 0) {\n console.log(chalk.cyan('\\n\uD83D\uDCA1 Suggestions:'));\n result.suggestions.forEach((suggestion) => {\n console.log(chalk.cyan(` \u2022 ${suggestion}`));\n });\n }\n\n // Auto-fix if requested\n if (options.fix && result.errors.length > 0) {\n console.log(chalk.blue('\\n\uD83D\uDD27 Attempting auto-fix...'));\n\n const config = manager.getConfig();\n const weights = config.scoring.weights;\n const weightSum =\n weights.base +\n weights.impact +\n weights.persistence +\n weights.reference;\n\n if (Math.abs(weightSum - 1.0) > 0.001) {\n // Normalize weights to sum to 1.0\n const factor = 1.0 / weightSum;\n manager.updateWeights({\n base: weights.base * factor,\n impact: weights.impact * factor,\n persistence: weights.persistence * factor,\n reference: weights.reference * factor,\n });\n manager.save();\n console.log(chalk.green(' \u2713 Normalized weights to sum to 1.0'));\n }\n }\n\n // Final status\n if (result.valid) {\n console.log(chalk.green('\\n\u2705 Configuration is valid'));\n process.exit(0);\n } else {\n console.log(chalk.red('\\n\u274C Configuration has errors'));\n process.exit(1);\n }\n });\n\n config\n .command('init')\n .description('Initialize configuration file with defaults')\n .option('-p, --profile <name>', 'Use a preset profile', 'default')\n .option('-f, --force', 'Overwrite existing config')\n .action(async (options) => {\n const configPath = path.join(\n process.cwd(),\n '.stackmemory',\n 'config.yaml'\n );\n\n if (fs.existsSync(configPath) && !options.force) {\n console.log(\n chalk.yellow(\n '\u26A0 Config file already exists. Use --force to overwrite.'\n )\n );\n process.exit(1);\n }\n\n const dir = path.dirname(configPath);\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n\n const config = { ...DEFAULT_CONFIG };\n if (options.profile && options.profile !== 'default') {\n config.profile = options.profile;\n }\n\n const content = yaml.dump(config, {\n indent: 2,\n lineWidth: 120,\n noRefs: true,\n });\n\n fs.writeFileSync(configPath, content, 'utf-8');\n console.log(chalk.green(`\u2705 Created config file at ${configPath}`));\n\n if (options.profile !== 'default') {\n console.log(chalk.cyan(`\uD83D\uDCCB Using profile: ${options.profile}`));\n }\n });\n\n config\n .command('show')\n .description('Show current configuration')\n .option('-p, --profile <name>', 'Show specific profile')\n .action(async (options) => {\n const manager = new ConfigManager();\n const config = manager.getConfig();\n\n if (options.profile) {\n const profiles = manager.getProfiles();\n const profile = profiles[options.profile];\n\n if (!profile) {\n console.log(chalk.red(`\u274C Profile '${options.profile}' not found`));\n console.log(chalk.cyan('Available profiles:'));\n Object.keys(profiles).forEach((name) => {\n console.log(` \u2022 ${name}`);\n });\n process.exit(1);\n }\n\n console.log(chalk.blue(`\\n\uD83D\uDCCB Profile: ${profile.name}`));\n if (profile.description) {\n console.log(chalk.gray(` ${profile.description}`));\n }\n console.log('\\n' + yaml.dump(profile, { indent: 2 }));\n } else {\n console.log(chalk.blue('\\n\uD83D\uDCCB Current Configuration:'));\n if (config.profile) {\n console.log(chalk.cyan(` Active Profile: ${config.profile}`));\n }\n console.log('\\n' + yaml.dump(config, { indent: 2 }));\n }\n });\n\n config\n .command('set-profile <name>')\n .description('Set active profile')\n .action(async (name) => {\n const manager = new ConfigManager();\n\n if (manager.setProfile(name)) {\n manager.save();\n console.log(chalk.green(`\u2705 Active profile set to: ${name}`));\n } else {\n console.log(chalk.red(`\u274C Profile '${name}' not found`));\n console.log(chalk.cyan('Available profiles:'));\n Object.keys(manager.getProfiles()).forEach((profile) => {\n console.log(` \u2022 ${profile}`);\n });\n process.exit(1);\n }\n });\n\n config\n .command('list-profiles')\n .description('List available profiles')\n .action(async () => {\n const manager = new ConfigManager();\n const profiles = manager.getProfiles();\n const currentProfile = manager.getConfig().profile;\n\n console.log(chalk.blue('\\n\uD83D\uDCCB Available Profiles:'));\n Object.entries(profiles).forEach(([name, profile]) => {\n const marker = name === currentProfile ? chalk.green(' \u2713') : '';\n console.log(` \u2022 ${chalk.cyan(name)}${marker}`);\n if (profile.description) {\n console.log(chalk.gray(` ${profile.description}`));\n }\n });\n });\n\n config\n .command('test-score <tool>')\n .description('Test importance scoring for a tool')\n .option('-f, --files <number>', 'Number of files affected', parseInt)\n .option('-p, --permanent', 'Is change permanent')\n .option('-r, --references <number>', 'Reference count', parseInt)\n .action(async (tool, options) => {\n const manager = new ConfigManager();\n\n const score = manager.calculateScore(tool, {\n filesAffected: options.files,\n isPermanent: options.permanent,\n referenceCount: options.references,\n });\n\n const config = manager.getConfig();\n const baseScore = config.scoring.tool_scores[tool] || 0.5;\n\n console.log(chalk.blue('\\n\uD83D\uDCCA Score Calculation:'));\n console.log(` Tool: ${chalk.cyan(tool)}`);\n console.log(` Base Score: ${chalk.yellow(baseScore.toFixed(3))}`);\n\n if (options.files !== undefined) {\n console.log(` Files Affected: ${options.files}`);\n }\n if (options.permanent) {\n console.log(` Permanent: ${chalk.green('Yes')}`);\n }\n if (options.references !== undefined) {\n console.log(` References: ${options.references}`);\n }\n\n console.log(chalk.blue('\\n Weights:'));\n console.log(` Base: ${config.scoring.weights.base}`);\n console.log(` Impact: ${config.scoring.weights.impact}`);\n console.log(` Persistence: ${config.scoring.weights.persistence}`);\n console.log(` Reference: ${config.scoring.weights.reference}`);\n\n console.log(chalk.green(`\\n Final Score: ${score.toFixed(3)}`));\n\n // Show importance level\n let level = 'Low';\n let color = chalk.gray;\n if (score >= 0.8) {\n level = 'Critical';\n color = chalk.red;\n } else if (score >= 0.6) {\n level = 'High';\n color = chalk.yellow;\n } else if (score >= 0.4) {\n level = 'Medium';\n color = chalk.cyan;\n }\n\n console.log(` Importance: ${color(level)}`);\n });\n\n config\n .command('create-profile <name>')\n .description('Create a custom configuration profile')\n .option('-d, --description <text>', 'Profile description')\n .option('-b, --base-weight <number>', 'Base weight (0-1)', parseFloat)\n .option('-i, --impact-weight <number>', 'Impact weight (0-1)', parseFloat)\n .option(\n '-p, --persistence-weight <number>',\n 'Persistence weight (0-1)',\n parseFloat\n )\n .option(\n '-r, --reference-weight <number>',\n 'Reference weight (0-1)',\n parseFloat\n )\n .option('--copy-from <profile>', 'Copy settings from existing profile')\n .action(async (name, options) => {\n const manager = new ConfigManager();\n const config = manager.getConfig();\n\n // Check if profile already exists\n if (config.profiles && config.profiles[name]) {\n console.log(\n chalk.yellow(\n `\u26A0 Profile '${name}' already exists. Use 'edit-profile' to modify it.`\n )\n );\n process.exit(1);\n }\n\n let newProfile: ProfileConfig;\n\n if (options.copyFrom) {\n // Copy from existing profile\n const sourceProfile = config.profiles?.[options.copyFrom];\n if (!sourceProfile) {\n console.log(\n chalk.red(`\u274C Source profile '${options.copyFrom}' not found`)\n );\n process.exit(1);\n }\n newProfile = {\n ...sourceProfile,\n name,\n description: options.description,\n };\n } else {\n // Create new profile with custom weights\n const weights: ScoringWeights = {\n base: options.baseWeight ?? DEFAULT_WEIGHTS.base,\n impact: options.impactWeight ?? DEFAULT_WEIGHTS.impact,\n persistence: options.persistenceWeight ?? DEFAULT_WEIGHTS.persistence,\n reference: options.referenceWeight ?? DEFAULT_WEIGHTS.reference,\n };\n\n // Validate weights sum to 1.0\n const sum =\n weights.base +\n weights.impact +\n weights.persistence +\n weights.reference;\n if (Math.abs(sum - 1.0) > 0.001) {\n console.log(\n chalk.red(`\u274C Weights must sum to 1.0 (current: ${sum.toFixed(3)})`)\n );\n console.log(chalk.yellow('\\nNormalizing weights to sum to 1.0...'));\n\n const factor = 1.0 / sum;\n weights.base *= factor;\n weights.impact *= factor;\n weights.persistence *= factor;\n weights.reference *= factor;\n }\n\n newProfile = {\n name,\n description:\n options.description ||\n `Custom profile created ${new Date().toLocaleDateString()}`,\n scoring: {\n weights,\n tool_scores: DEFAULT_TOOL_SCORES,\n },\n };\n }\n\n // Add profile to config\n if (!config.profiles) {\n config.profiles = {};\n }\n config.profiles[name] = newProfile;\n\n // Save config\n manager.save();\n\n console.log(chalk.green(`\u2705 Created profile: ${name}`));\n console.log(chalk.blue('\\nProfile Configuration:'));\n console.log(yaml.dump(newProfile, { indent: 2 }));\n console.log(\n chalk.cyan(`\\nActivate with: stackmemory config set-profile ${name}`)\n );\n });\n\n config\n .command('edit-profile <name>')\n .description('Edit an existing profile')\n .option(\n '-s, --set-tool <tool:score>',\n 'Set tool score (e.g., search:0.95)',\n (value, previous) => {\n const result = previous || {};\n const [tool, score] = value.split(':');\n result[tool] = parseFloat(score);\n return result;\n },\n {}\n )\n .option(\n '-w, --set-weight <type:value>',\n 'Set weight (e.g., base:0.4)',\n (value, previous) => {\n const result = previous || {};\n const [type, weight] = value.split(':');\n result[type] = parseFloat(weight);\n return result;\n },\n {}\n )\n .action(async (name, options) => {\n const manager = new ConfigManager();\n const config = manager.getConfig();\n\n if (!config.profiles?.[name]) {\n console.log(chalk.red(`\u274C Profile '${name}' not found`));\n process.exit(1);\n }\n\n const profile = config.profiles[name];\n\n // Update tool scores\n if (Object.keys(options.setTool).length > 0) {\n if (!profile.scoring) {\n profile.scoring = {};\n }\n if (!profile.scoring.tool_scores) {\n profile.scoring.tool_scores = {};\n }\n Object.assign(profile.scoring.tool_scores, options.setTool);\n console.log(chalk.green('\u2713 Updated tool scores'));\n }\n\n // Update weights\n if (Object.keys(options.setWeight).length > 0) {\n if (!profile.scoring) {\n profile.scoring = {};\n }\n if (!profile.scoring.weights) {\n profile.scoring.weights = { ...DEFAULT_WEIGHTS };\n }\n Object.assign(profile.scoring.weights, options.setWeight);\n\n // Validate weights\n const weights = profile.scoring.weights;\n const sum =\n (weights.base || 0) +\n (weights.impact || 0) +\n (weights.persistence || 0) +\n (weights.reference || 0);\n\n if (Math.abs(sum - 1.0) > 0.001) {\n console.log(\n chalk.yellow(`\u26A0 Weights sum to ${sum.toFixed(3)}, normalizing...`)\n );\n const factor = 1.0 / sum;\n if (weights.base) weights.base *= factor;\n if (weights.impact) weights.impact *= factor;\n if (weights.persistence) weights.persistence *= factor;\n if (weights.reference) weights.reference *= factor;\n }\n\n console.log(chalk.green('\u2713 Updated weights'));\n }\n\n // Save changes\n manager.save();\n\n console.log(chalk.green(`\\n\u2705 Profile '${name}' updated`));\n console.log(chalk.blue('\\nUpdated Configuration:'));\n console.log(yaml.dump(profile, { indent: 2 }));\n });\n\n config\n .command('profile-report [profile]')\n .description('Show profile effectiveness report')\n .action(async (profile) => {\n // This would integrate with the ToolScoringMiddleware\n // For now, show a placeholder\n console.log(chalk.blue('\\n\uD83D\uDCCA Profile Effectiveness Report'));\n\n if (profile) {\n console.log(chalk.cyan(`\\nProfile: ${profile}`));\n console.log('Note: Run tools with this profile to generate metrics');\n } else {\n console.log(\n '\\nNote: Tool scoring metrics will be available after running MCP tools'\n );\n }\n\n console.log(chalk.gray('\\nMetrics tracked:'));\n console.log(' \u2022 Average score per tool');\n console.log(' \u2022 High-importance operations');\n console.log(' \u2022 Profile usage frequency');\n console.log(' \u2022 Score trends over time');\n });\n\n return config;\n}\n"],
5
- "mappings": "AAIA,SAAS,eAAe;AACxB,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,YAAY,UAAU;AACtB,OAAO,WAAW;AAClB,SAAS,qBA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from 'commander';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as yaml from 'js-yaml';\nimport chalk from 'chalk';\nimport { ConfigManager } from '../../core/config/config-manager.js';\nimport {\n DEFAULT_CONFIG,\n ProfileConfig,\n ScoringWeights,\n DEFAULT_WEIGHTS,\n DEFAULT_TOOL_SCORES,\n} from '../../core/config/types.js';\nimport {\n loadStorageConfig,\n enableChromaDB,\n disableChromaDB,\n getStorageModeDescription,\n} from '../../core/config/storage-config.js';\nimport inquirer from 'inquirer';\n\nexport function createConfigCommand(): Command {\n const config = new Command('config').description(\n 'Manage StackMemory configuration'\n );\n\n config\n .command('validate')\n .description('Validate configuration file')\n .option(\n '-f, --file <path>',\n 'Path to config file',\n '.stackmemory/config.yaml'\n )\n .option('--fix', 'Attempt to auto-fix common issues')\n .action(async (options) => {\n console.log(chalk.blue('\uD83D\uDD0D Validating configuration...'));\n\n const configPath = path.resolve(options.file);\n const manager = new ConfigManager(configPath);\n const result = manager.validate();\n\n // Display errors\n if (result.errors.length > 0) {\n console.log(chalk.red('\\n\u2717 Errors:'));\n result.errors.forEach((error) => {\n console.log(chalk.red(` \u2022 ${error}`));\n });\n }\n\n // Display warnings\n if (result.warnings.length > 0) {\n console.log(chalk.yellow('\\n\u26A0 Warnings:'));\n result.warnings.forEach((warning) => {\n console.log(chalk.yellow(` \u2022 ${warning}`));\n });\n }\n\n // Display suggestions\n if (result.suggestions.length > 0) {\n console.log(chalk.cyan('\\n\uD83D\uDCA1 Suggestions:'));\n result.suggestions.forEach((suggestion) => {\n console.log(chalk.cyan(` \u2022 ${suggestion}`));\n });\n }\n\n // Auto-fix if requested\n if (options.fix && result.errors.length > 0) {\n console.log(chalk.blue('\\n\uD83D\uDD27 Attempting auto-fix...'));\n\n const config = manager.getConfig();\n const weights = config.scoring.weights;\n const weightSum =\n weights.base +\n weights.impact +\n weights.persistence +\n weights.reference;\n\n if (Math.abs(weightSum - 1.0) > 0.001) {\n // Normalize weights to sum to 1.0\n const factor = 1.0 / weightSum;\n manager.updateWeights({\n base: weights.base * factor,\n impact: weights.impact * factor,\n persistence: weights.persistence * factor,\n reference: weights.reference * factor,\n });\n manager.save();\n console.log(chalk.green(' \u2713 Normalized weights to sum to 1.0'));\n }\n }\n\n // Final status\n if (result.valid) {\n console.log(chalk.green('\\n\u2705 Configuration is valid'));\n process.exit(0);\n } else {\n console.log(chalk.red('\\n\u274C Configuration has errors'));\n process.exit(1);\n }\n });\n\n config\n .command('init')\n .description('Initialize configuration file with defaults')\n .option('-p, --profile <name>', 'Use a preset profile', 'default')\n .option('-f, --force', 'Overwrite existing config')\n .action(async (options) => {\n const configPath = path.join(\n process.cwd(),\n '.stackmemory',\n 'config.yaml'\n );\n\n if (fs.existsSync(configPath) && !options.force) {\n console.log(\n chalk.yellow(\n '\u26A0 Config file already exists. Use --force to overwrite.'\n )\n );\n process.exit(1);\n }\n\n const dir = path.dirname(configPath);\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n\n const config = { ...DEFAULT_CONFIG };\n if (options.profile && options.profile !== 'default') {\n config.profile = options.profile;\n }\n\n const content = yaml.dump(config, {\n indent: 2,\n lineWidth: 120,\n noRefs: true,\n });\n\n fs.writeFileSync(configPath, content, 'utf-8');\n console.log(chalk.green(`\u2705 Created config file at ${configPath}`));\n\n if (options.profile !== 'default') {\n console.log(chalk.cyan(`\uD83D\uDCCB Using profile: ${options.profile}`));\n }\n });\n\n config\n .command('show')\n .description('Show current configuration')\n .option('-p, --profile <name>', 'Show specific profile')\n .action(async (options) => {\n const manager = new ConfigManager();\n const config = manager.getConfig();\n\n if (options.profile) {\n const profiles = manager.getProfiles();\n const profile = profiles[options.profile];\n\n if (!profile) {\n console.log(chalk.red(`\u274C Profile '${options.profile}' not found`));\n console.log(chalk.cyan('Available profiles:'));\n Object.keys(profiles).forEach((name) => {\n console.log(` \u2022 ${name}`);\n });\n process.exit(1);\n }\n\n console.log(chalk.blue(`\\n\uD83D\uDCCB Profile: ${profile.name}`));\n if (profile.description) {\n console.log(chalk.gray(` ${profile.description}`));\n }\n console.log('\\n' + yaml.dump(profile, { indent: 2 }));\n } else {\n console.log(chalk.blue('\\n\uD83D\uDCCB Current Configuration:'));\n if (config.profile) {\n console.log(chalk.cyan(` Active Profile: ${config.profile}`));\n }\n console.log('\\n' + yaml.dump(config, { indent: 2 }));\n }\n });\n\n config\n .command('set-profile <name>')\n .description('Set active profile')\n .action(async (name) => {\n const manager = new ConfigManager();\n\n if (manager.setProfile(name)) {\n manager.save();\n console.log(chalk.green(`\u2705 Active profile set to: ${name}`));\n } else {\n console.log(chalk.red(`\u274C Profile '${name}' not found`));\n console.log(chalk.cyan('Available profiles:'));\n Object.keys(manager.getProfiles()).forEach((profile) => {\n console.log(` \u2022 ${profile}`);\n });\n process.exit(1);\n }\n });\n\n config\n .command('list-profiles')\n .description('List available profiles')\n .action(async () => {\n const manager = new ConfigManager();\n const profiles = manager.getProfiles();\n const currentProfile = manager.getConfig().profile;\n\n console.log(chalk.blue('\\n\uD83D\uDCCB Available Profiles:'));\n Object.entries(profiles).forEach(([name, profile]) => {\n const marker = name === currentProfile ? chalk.green(' \u2713') : '';\n console.log(` \u2022 ${chalk.cyan(name)}${marker}`);\n if (profile.description) {\n console.log(chalk.gray(` ${profile.description}`));\n }\n });\n });\n\n config\n .command('test-score <tool>')\n .description('Test importance scoring for a tool')\n .option('-f, --files <number>', 'Number of files affected', parseInt)\n .option('-p, --permanent', 'Is change permanent')\n .option('-r, --references <number>', 'Reference count', parseInt)\n .action(async (tool, options) => {\n const manager = new ConfigManager();\n\n const score = manager.calculateScore(tool, {\n filesAffected: options.files,\n isPermanent: options.permanent,\n referenceCount: options.references,\n });\n\n const config = manager.getConfig();\n const baseScore = config.scoring.tool_scores[tool] || 0.5;\n\n console.log(chalk.blue('\\n\uD83D\uDCCA Score Calculation:'));\n console.log(` Tool: ${chalk.cyan(tool)}`);\n console.log(` Base Score: ${chalk.yellow(baseScore.toFixed(3))}`);\n\n if (options.files !== undefined) {\n console.log(` Files Affected: ${options.files}`);\n }\n if (options.permanent) {\n console.log(` Permanent: ${chalk.green('Yes')}`);\n }\n if (options.references !== undefined) {\n console.log(` References: ${options.references}`);\n }\n\n console.log(chalk.blue('\\n Weights:'));\n console.log(` Base: ${config.scoring.weights.base}`);\n console.log(` Impact: ${config.scoring.weights.impact}`);\n console.log(` Persistence: ${config.scoring.weights.persistence}`);\n console.log(` Reference: ${config.scoring.weights.reference}`);\n\n console.log(chalk.green(`\\n Final Score: ${score.toFixed(3)}`));\n\n // Show importance level\n let level = 'Low';\n let color = chalk.gray;\n if (score >= 0.8) {\n level = 'Critical';\n color = chalk.red;\n } else if (score >= 0.6) {\n level = 'High';\n color = chalk.yellow;\n } else if (score >= 0.4) {\n level = 'Medium';\n color = chalk.cyan;\n }\n\n console.log(` Importance: ${color(level)}`);\n });\n\n config\n .command('create-profile <name>')\n .description('Create a custom configuration profile')\n .option('-d, --description <text>', 'Profile description')\n .option('-b, --base-weight <number>', 'Base weight (0-1)', parseFloat)\n .option('-i, --impact-weight <number>', 'Impact weight (0-1)', parseFloat)\n .option(\n '-p, --persistence-weight <number>',\n 'Persistence weight (0-1)',\n parseFloat\n )\n .option(\n '-r, --reference-weight <number>',\n 'Reference weight (0-1)',\n parseFloat\n )\n .option('--copy-from <profile>', 'Copy settings from existing profile')\n .action(async (name, options) => {\n const manager = new ConfigManager();\n const config = manager.getConfig();\n\n // Check if profile already exists\n if (config.profiles && config.profiles[name]) {\n console.log(\n chalk.yellow(\n `\u26A0 Profile '${name}' already exists. Use 'edit-profile' to modify it.`\n )\n );\n process.exit(1);\n }\n\n let newProfile: ProfileConfig;\n\n if (options.copyFrom) {\n // Copy from existing profile\n const sourceProfile = config.profiles?.[options.copyFrom];\n if (!sourceProfile) {\n console.log(\n chalk.red(`\u274C Source profile '${options.copyFrom}' not found`)\n );\n process.exit(1);\n }\n newProfile = {\n ...sourceProfile,\n name,\n description: options.description,\n };\n } else {\n // Create new profile with custom weights\n const weights: ScoringWeights = {\n base: options.baseWeight ?? DEFAULT_WEIGHTS.base,\n impact: options.impactWeight ?? DEFAULT_WEIGHTS.impact,\n persistence: options.persistenceWeight ?? DEFAULT_WEIGHTS.persistence,\n reference: options.referenceWeight ?? DEFAULT_WEIGHTS.reference,\n };\n\n // Validate weights sum to 1.0\n const sum =\n weights.base +\n weights.impact +\n weights.persistence +\n weights.reference;\n if (Math.abs(sum - 1.0) > 0.001) {\n console.log(\n chalk.red(`\u274C Weights must sum to 1.0 (current: ${sum.toFixed(3)})`)\n );\n console.log(chalk.yellow('\\nNormalizing weights to sum to 1.0...'));\n\n const factor = 1.0 / sum;\n weights.base *= factor;\n weights.impact *= factor;\n weights.persistence *= factor;\n weights.reference *= factor;\n }\n\n newProfile = {\n name,\n description:\n options.description ||\n `Custom profile created ${new Date().toLocaleDateString()}`,\n scoring: {\n weights,\n tool_scores: DEFAULT_TOOL_SCORES,\n },\n };\n }\n\n // Add profile to config\n if (!config.profiles) {\n config.profiles = {};\n }\n config.profiles[name] = newProfile;\n\n // Save config\n manager.save();\n\n console.log(chalk.green(`\u2705 Created profile: ${name}`));\n console.log(chalk.blue('\\nProfile Configuration:'));\n console.log(yaml.dump(newProfile, { indent: 2 }));\n console.log(\n chalk.cyan(`\\nActivate with: stackmemory config set-profile ${name}`)\n );\n });\n\n config\n .command('edit-profile <name>')\n .description('Edit an existing profile')\n .option(\n '-s, --set-tool <tool:score>',\n 'Set tool score (e.g., search:0.95)',\n (value, previous) => {\n const result = previous || {};\n const [tool, score] = value.split(':');\n result[tool] = parseFloat(score);\n return result;\n },\n {}\n )\n .option(\n '-w, --set-weight <type:value>',\n 'Set weight (e.g., base:0.4)',\n (value, previous) => {\n const result = previous || {};\n const [type, weight] = value.split(':');\n result[type] = parseFloat(weight);\n return result;\n },\n {}\n )\n .action(async (name, options) => {\n const manager = new ConfigManager();\n const config = manager.getConfig();\n\n if (!config.profiles?.[name]) {\n console.log(chalk.red(`\u274C Profile '${name}' not found`));\n process.exit(1);\n }\n\n const profile = config.profiles[name];\n\n // Update tool scores\n if (Object.keys(options.setTool).length > 0) {\n if (!profile.scoring) {\n profile.scoring = {};\n }\n if (!profile.scoring.tool_scores) {\n profile.scoring.tool_scores = {};\n }\n Object.assign(profile.scoring.tool_scores, options.setTool);\n console.log(chalk.green('\u2713 Updated tool scores'));\n }\n\n // Update weights\n if (Object.keys(options.setWeight).length > 0) {\n if (!profile.scoring) {\n profile.scoring = {};\n }\n if (!profile.scoring.weights) {\n profile.scoring.weights = { ...DEFAULT_WEIGHTS };\n }\n Object.assign(profile.scoring.weights, options.setWeight);\n\n // Validate weights\n const weights = profile.scoring.weights;\n const sum =\n (weights.base || 0) +\n (weights.impact || 0) +\n (weights.persistence || 0) +\n (weights.reference || 0);\n\n if (Math.abs(sum - 1.0) > 0.001) {\n console.log(\n chalk.yellow(`\u26A0 Weights sum to ${sum.toFixed(3)}, normalizing...`)\n );\n const factor = 1.0 / sum;\n if (weights.base) weights.base *= factor;\n if (weights.impact) weights.impact *= factor;\n if (weights.persistence) weights.persistence *= factor;\n if (weights.reference) weights.reference *= factor;\n }\n\n console.log(chalk.green('\u2713 Updated weights'));\n }\n\n // Save changes\n manager.save();\n\n console.log(chalk.green(`\\n\u2705 Profile '${name}' updated`));\n console.log(chalk.blue('\\nUpdated Configuration:'));\n console.log(yaml.dump(profile, { indent: 2 }));\n });\n\n config\n .command('profile-report [profile]')\n .description('Show profile effectiveness report')\n .action(async (profile) => {\n // This would integrate with the ToolScoringMiddleware\n // For now, show a placeholder\n console.log(chalk.blue('\\n\uD83D\uDCCA Profile Effectiveness Report'));\n\n if (profile) {\n console.log(chalk.cyan(`\\nProfile: ${profile}`));\n console.log('Note: Run tools with this profile to generate metrics');\n } else {\n console.log(\n '\\nNote: Tool scoring metrics will be available after running MCP tools'\n );\n }\n\n console.log(chalk.gray('\\nMetrics tracked:'));\n console.log(' \u2022 Average score per tool');\n console.log(' \u2022 High-importance operations');\n console.log(' \u2022 Profile usage frequency');\n console.log(' \u2022 Score trends over time');\n });\n\n // Storage configuration subcommand\n const storageCmd = config.command('storage').description(\n `Manage storage configuration\n\nStorage Modes:\n sqlite (default): Local storage only, fast, no external dependencies\n hybrid: SQLite + ChromaDB for semantic search and cloud backup`\n );\n\n storageCmd\n .command('show')\n .description('Show current storage configuration')\n .action(async () => {\n const storageConfig = loadStorageConfig();\n\n console.log(chalk.blue('\\nStorage Configuration:'));\n console.log(` Mode: ${chalk.cyan(storageConfig.mode)}`);\n console.log(` Description: ${chalk.gray(getStorageModeDescription())}`);\n\n if (storageConfig.chromadb.enabled) {\n console.log(chalk.blue('\\nChromaDB Settings:'));\n console.log(` Enabled: ${chalk.green('Yes')}`);\n console.log(\n ` API URL: ${chalk.gray(storageConfig.chromadb.apiUrl || 'https://api.trychroma.com')}`\n );\n console.log(\n ` Tenant: ${chalk.gray(storageConfig.chromadb.tenant || 'default_tenant')}`\n );\n console.log(\n ` Database: ${chalk.gray(storageConfig.chromadb.database || 'default_database')}`\n );\n console.log(\n ` API Key: ${chalk.gray(storageConfig.chromadb.apiKey ? '[configured]' : '[not set]')}`\n );\n } else {\n console.log(chalk.blue('\\nChromaDB Settings:'));\n console.log(` Enabled: ${chalk.yellow('No')}`);\n console.log(\n chalk.gray(\n ' Enable with: stackmemory config storage enable-chromadb'\n )\n );\n }\n });\n\n storageCmd\n .command('enable-chromadb')\n .description('Enable ChromaDB for semantic search and cloud backup')\n .option('--api-key <key>', 'ChromaDB API key')\n .option('--api-url <url>', 'ChromaDB API URL', 'https://api.trychroma.com')\n .action(async (options) => {\n let apiKey = options.apiKey;\n\n if (!apiKey && process.stdin.isTTY) {\n const answers = await inquirer.prompt([\n {\n type: 'password',\n name: 'apiKey',\n message: 'Enter your ChromaDB API key:',\n validate: (input: string) => {\n if (!input || input.trim().length === 0) {\n return 'API key is required for ChromaDB';\n }\n return true;\n },\n },\n ]);\n apiKey = answers.apiKey;\n }\n\n if (!apiKey) {\n console.log(chalk.red('[ERROR] ChromaDB API key is required.'));\n console.log(\n chalk.gray('Provide via --api-key flag or run interactively.')\n );\n process.exit(1);\n }\n\n enableChromaDB({\n apiKey,\n apiUrl: options.apiUrl,\n });\n\n console.log(chalk.green('[OK] ChromaDB enabled successfully.'));\n console.log(chalk.gray(`Storage mode: ${getStorageModeDescription()}`));\n });\n\n storageCmd\n .command('disable-chromadb')\n .description('Disable ChromaDB and use SQLite-only storage')\n .action(async () => {\n disableChromaDB();\n console.log(chalk.green('[OK] ChromaDB disabled.'));\n console.log(chalk.gray(`Storage mode: ${getStorageModeDescription()}`));\n });\n\n return config;\n}\n"],
5
+ "mappings": "AAIA,SAAS,eAAe;AACxB,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,YAAY,UAAU;AACtB,OAAO,WAAW;AAClB,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EAGA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,cAAc;AAEd,SAAS,sBAA+B;AAC7C,QAAM,SAAS,IAAI,QAAQ,QAAQ,EAAE;AAAA,IACnC;AAAA,EACF;AAEA,SACG,QAAQ,UAAU,EAClB,YAAY,6BAA6B,EACzC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACF,EACC,OAAO,SAAS,mCAAmC,EACnD,OAAO,OAAO,YAAY;AACzB,YAAQ,IAAI,MAAM,KAAK,uCAAgC,CAAC;AAExD,UAAM,aAAa,KAAK,QAAQ,QAAQ,IAAI;AAC5C,UAAM,UAAU,IAAI,cAAc,UAAU;AAC5C,UAAM,SAAS,QAAQ,SAAS;AAGhC,QAAI,OAAO,OAAO,SAAS,GAAG;AAC5B,cAAQ,IAAI,MAAM,IAAI,kBAAa,CAAC;AACpC,aAAO,OAAO,QAAQ,CAAC,UAAU;AAC/B,gBAAQ,IAAI,MAAM,IAAI,YAAO,KAAK,EAAE,CAAC;AAAA,MACvC,CAAC;AAAA,IACH;AAGA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,OAAO,YAAY;AAClB,oBAAgB;AAChB,YAAQ,IAAI,MAAM,MAAM,yBAAyB,CAAC;AAClD,YAAQ,IAAI,MAAM,KAAK,iBAAiB,0BAA0B,CAAC,EAAE,CAAC;AAAA,EACxE,CAAC;AAEH,SAAO;AACT;",
6
6
  "names": ["config"]
7
7
  }
@@ -0,0 +1,262 @@
1
+ import { Command } from "commander";
2
+ import {
3
+ existsSync,
4
+ readFileSync,
5
+ writeFileSync,
6
+ mkdirSync,
7
+ readdirSync
8
+ } from "fs";
9
+ import { join, basename } from "path";
10
+ import { homedir } from "os";
11
+ import { createHash } from "crypto";
12
+ function getDecisionStorePath(projectRoot) {
13
+ return join(projectRoot, ".stackmemory", "session-decisions.json");
14
+ }
15
+ function getProjectId(projectRoot) {
16
+ const hash = createHash("sha256").update(projectRoot).digest("hex");
17
+ return hash.slice(0, 12);
18
+ }
19
+ function getHistoryDir() {
20
+ return join(homedir(), ".stackmemory", "decision-history");
21
+ }
22
+ function archiveDecisions(projectRoot, decisions) {
23
+ if (decisions.length === 0) return;
24
+ const historyDir = getHistoryDir();
25
+ const projectId = getProjectId(projectRoot);
26
+ const projectDir = join(historyDir, projectId);
27
+ if (!existsSync(projectDir)) {
28
+ mkdirSync(projectDir, { recursive: true });
29
+ }
30
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
31
+ const archivePath = join(projectDir, `${timestamp}.json`);
32
+ const archive = {
33
+ projectRoot,
34
+ projectName: basename(projectRoot),
35
+ archivedAt: (/* @__PURE__ */ new Date()).toISOString(),
36
+ decisions
37
+ };
38
+ writeFileSync(archivePath, JSON.stringify(archive, null, 2));
39
+ }
40
+ function loadDecisionHistory(projectRoot) {
41
+ const historyDir = getHistoryDir();
42
+ if (!existsSync(historyDir)) return [];
43
+ const allDecisions = [];
44
+ try {
45
+ const projectDirs = projectRoot ? [getProjectId(projectRoot)] : readdirSync(historyDir);
46
+ for (const projectId of projectDirs) {
47
+ const projectDir = join(historyDir, projectId);
48
+ if (!existsSync(projectDir)) continue;
49
+ try {
50
+ const files = readdirSync(projectDir).filter(
51
+ (f) => f.endsWith(".json")
52
+ );
53
+ for (const file of files) {
54
+ try {
55
+ const content = JSON.parse(
56
+ readFileSync(join(projectDir, file), "utf-8")
57
+ );
58
+ for (const d of content.decisions || []) {
59
+ allDecisions.push({
60
+ ...d,
61
+ projectName: content.projectName || "unknown",
62
+ archivedAt: content.archivedAt
63
+ });
64
+ }
65
+ } catch {
66
+ }
67
+ }
68
+ } catch {
69
+ }
70
+ }
71
+ } catch {
72
+ }
73
+ return allDecisions.sort(
74
+ (a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime()
75
+ );
76
+ }
77
+ function loadDecisions(projectRoot) {
78
+ const storePath = getDecisionStorePath(projectRoot);
79
+ if (existsSync(storePath)) {
80
+ try {
81
+ return JSON.parse(readFileSync(storePath, "utf-8"));
82
+ } catch {
83
+ }
84
+ }
85
+ return {
86
+ decisions: [],
87
+ sessionStart: (/* @__PURE__ */ new Date()).toISOString()
88
+ };
89
+ }
90
+ function saveDecisions(projectRoot, store) {
91
+ const storePath = getDecisionStorePath(projectRoot);
92
+ const dir = join(projectRoot, ".stackmemory");
93
+ if (!existsSync(dir)) {
94
+ mkdirSync(dir, { recursive: true });
95
+ }
96
+ writeFileSync(storePath, JSON.stringify(store, null, 2));
97
+ }
98
+ function createDecisionCommand() {
99
+ const cmd = new Command("decision");
100
+ cmd.description("Capture key decisions for session handoff context");
101
+ cmd.command("add <what>").description("Record a decision made during this session").option("-w, --why <rationale>", "Why this decision was made").option(
102
+ "-a, --alternatives <alts>",
103
+ "Comma-separated alternatives considered"
104
+ ).option(
105
+ "-c, --category <category>",
106
+ "Category (architecture, tooling, approach, etc.)"
107
+ ).action((what, options) => {
108
+ const projectRoot = process.cwd();
109
+ const store = loadDecisions(projectRoot);
110
+ const decision = {
111
+ id: `d-${Date.now()}`,
112
+ what,
113
+ why: options.why || "",
114
+ alternatives: options.alternatives?.split(",").map((a) => a.trim()),
115
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
116
+ category: options.category
117
+ };
118
+ store.decisions.push(decision);
119
+ saveDecisions(projectRoot, store);
120
+ console.log("Decision recorded:");
121
+ console.log(` What: ${decision.what}`);
122
+ if (decision.why) {
123
+ console.log(` Why: ${decision.why}`);
124
+ }
125
+ if (decision.alternatives) {
126
+ console.log(` Alternatives: ${decision.alternatives.join(", ")}`);
127
+ }
128
+ console.log(`
129
+ Total decisions this session: ${store.decisions.length}`);
130
+ });
131
+ cmd.command("list").description("List all decisions from this session").option("--json", "Output as JSON").option("--history", "Include historical decisions").option("--all", "Show all projects (with --history)").action((options) => {
132
+ const projectRoot = process.cwd();
133
+ const store = loadDecisions(projectRoot);
134
+ if (options.history) {
135
+ const history = loadDecisionHistory(
136
+ options.all ? void 0 : projectRoot
137
+ );
138
+ if (options.json) {
139
+ console.log(JSON.stringify(history, null, 2));
140
+ return;
141
+ }
142
+ if (history.length === 0) {
143
+ console.log("No decision history found.");
144
+ return;
145
+ }
146
+ console.log(`Decision History (${history.length}):
147
+ `);
148
+ for (const d of history.slice(0, 50)) {
149
+ const category = d.category ? `[${d.category}] ` : "";
150
+ const project = options.all ? `(${d.projectName}) ` : "";
151
+ console.log(`${project}${category}${d.what}`);
152
+ if (d.why) {
153
+ console.log(` Rationale: ${d.why}`);
154
+ }
155
+ const date = new Date(d.timestamp).toLocaleDateString();
156
+ console.log(` Date: ${date}`);
157
+ console.log("");
158
+ }
159
+ return;
160
+ }
161
+ if (options.json) {
162
+ console.log(JSON.stringify(store.decisions, null, 2));
163
+ return;
164
+ }
165
+ if (store.decisions.length === 0) {
166
+ console.log("No decisions recorded this session.");
167
+ console.log("\nRecord decisions with:");
168
+ console.log(' stackmemory decision add "Decision" --why "Rationale"');
169
+ return;
170
+ }
171
+ console.log(`Session Decisions (${store.decisions.length}):
172
+ `);
173
+ for (const d of store.decisions) {
174
+ const category = d.category ? `[${d.category}] ` : "";
175
+ console.log(`${category}${d.what}`);
176
+ if (d.why) {
177
+ console.log(` Rationale: ${d.why}`);
178
+ }
179
+ if (d.alternatives && d.alternatives.length > 0) {
180
+ console.log(` Alternatives: ${d.alternatives.join(", ")}`);
181
+ }
182
+ console.log("");
183
+ }
184
+ });
185
+ cmd.command("clear").description("Clear all decisions (archives to history first)").option("--force", "Skip confirmation").option("--no-archive", "Do not archive decisions").action((options) => {
186
+ const projectRoot = process.cwd();
187
+ const store = loadDecisions(projectRoot);
188
+ if (store.decisions.length === 0) {
189
+ console.log("No decisions to clear.");
190
+ return;
191
+ }
192
+ if (!options.force) {
193
+ console.log(`This will clear ${store.decisions.length} decisions.`);
194
+ console.log("Decisions will be archived to history.");
195
+ console.log("Use --force to confirm.");
196
+ return;
197
+ }
198
+ if (options.archive !== false) {
199
+ archiveDecisions(projectRoot, store.decisions);
200
+ console.log(`Archived ${store.decisions.length} decisions to history.`);
201
+ }
202
+ const newStore = {
203
+ decisions: [],
204
+ sessionStart: (/* @__PURE__ */ new Date()).toISOString()
205
+ };
206
+ saveDecisions(projectRoot, newStore);
207
+ console.log("Decisions cleared. New session started.");
208
+ });
209
+ cmd.command("arch <description>").description("Record an architecture decision").option("-w, --why <rationale>", "Why this architecture choice").action((description, options) => {
210
+ const projectRoot = process.cwd();
211
+ const store = loadDecisions(projectRoot);
212
+ const decision = {
213
+ id: `d-${Date.now()}`,
214
+ what: description,
215
+ why: options.why || "",
216
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
217
+ category: "architecture"
218
+ };
219
+ store.decisions.push(decision);
220
+ saveDecisions(projectRoot, store);
221
+ console.log(`Architecture decision recorded: ${description}`);
222
+ });
223
+ cmd.command("tool <description>").description("Record a tooling decision").option("-w, --why <rationale>", "Why this tool choice").action((description, options) => {
224
+ const projectRoot = process.cwd();
225
+ const store = loadDecisions(projectRoot);
226
+ const decision = {
227
+ id: `d-${Date.now()}`,
228
+ what: description,
229
+ why: options.why || "",
230
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
231
+ category: "tooling"
232
+ };
233
+ store.decisions.push(decision);
234
+ saveDecisions(projectRoot, store);
235
+ console.log(`Tooling decision recorded: ${description}`);
236
+ });
237
+ return cmd;
238
+ }
239
+ function getSessionDecisions(projectRoot) {
240
+ const store = loadDecisions(projectRoot);
241
+ return store.decisions;
242
+ }
243
+ function createMemoryCommand() {
244
+ const cmd = createDecisionCommand();
245
+ return new Command("memory").description("Store memories for session context (alias for decision)").addCommand(
246
+ cmd.commands.find((c) => c.name() === "add").copyInheritedSettings(cmd)
247
+ ).addCommand(
248
+ cmd.commands.find((c) => c.name() === "list").copyInheritedSettings(cmd)
249
+ ).addCommand(
250
+ cmd.commands.find((c) => c.name() === "clear").copyInheritedSettings(cmd)
251
+ ).addCommand(
252
+ cmd.commands.find((c) => c.name() === "arch").copyInheritedSettings(cmd)
253
+ ).addCommand(
254
+ cmd.commands.find((c) => c.name() === "tool").copyInheritedSettings(cmd)
255
+ );
256
+ }
257
+ export {
258
+ createDecisionCommand,
259
+ createMemoryCommand,
260
+ getSessionDecisions
261
+ };
262
+ //# sourceMappingURL=decision.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/cli/commands/decision.ts"],
4
+ "sourcesContent": ["/**\n * Decision capture command - Records key decisions for handoff context\n *\n * Usage:\n * stackmemory decision add \"Use SQLite as default\" --why \"Zero dependencies, faster onboarding\"\n * stackmemory decision list\n * stackmemory decision clear\n */\n\nimport { Command } from 'commander';\nimport {\n existsSync,\n readFileSync,\n writeFileSync,\n mkdirSync,\n readdirSync,\n} from 'fs';\nimport { join, basename } from 'path';\nimport { homedir } from 'os';\nimport { createHash } from 'crypto';\n\ninterface Decision {\n id: string;\n what: string;\n why: string;\n alternatives?: string[];\n timestamp: string;\n category?: string;\n}\n\ninterface DecisionStore {\n decisions: Decision[];\n sessionStart: string;\n}\n\nfunction getDecisionStorePath(projectRoot: string): string {\n return join(projectRoot, '.stackmemory', 'session-decisions.json');\n}\n\nfunction getProjectId(projectRoot: string): string {\n const hash = createHash('sha256').update(projectRoot).digest('hex');\n return hash.slice(0, 12);\n}\n\nfunction getHistoryDir(): string {\n return join(homedir(), '.stackmemory', 'decision-history');\n}\n\nfunction archiveDecisions(projectRoot: string, decisions: Decision[]): void {\n if (decisions.length === 0) return;\n\n const historyDir = getHistoryDir();\n const projectId = getProjectId(projectRoot);\n const projectDir = join(historyDir, projectId);\n\n if (!existsSync(projectDir)) {\n mkdirSync(projectDir, { recursive: true });\n }\n\n // Save with timestamp\n const timestamp = new Date().toISOString().replace(/[:.]/g, '-');\n const archivePath = join(projectDir, `${timestamp}.json`);\n\n const archive = {\n projectRoot,\n projectName: basename(projectRoot),\n archivedAt: new Date().toISOString(),\n decisions,\n };\n\n writeFileSync(archivePath, JSON.stringify(archive, null, 2));\n}\n\ninterface HistoricalDecision extends Decision {\n projectName: string;\n archivedAt: string;\n}\n\nfunction loadDecisionHistory(projectRoot?: string): HistoricalDecision[] {\n const historyDir = getHistoryDir();\n if (!existsSync(historyDir)) return [];\n\n const allDecisions: HistoricalDecision[] = [];\n\n try {\n const projectDirs = projectRoot\n ? [getProjectId(projectRoot)]\n : readdirSync(historyDir);\n\n for (const projectId of projectDirs) {\n const projectDir = join(historyDir, projectId);\n if (!existsSync(projectDir)) continue;\n\n try {\n const files = readdirSync(projectDir).filter((f) =>\n f.endsWith('.json')\n );\n for (const file of files) {\n try {\n const content = JSON.parse(\n readFileSync(join(projectDir, file), 'utf-8')\n );\n for (const d of content.decisions || []) {\n allDecisions.push({\n ...d,\n projectName: content.projectName || 'unknown',\n archivedAt: content.archivedAt,\n });\n }\n } catch {\n // Skip invalid files\n }\n }\n } catch {\n // Skip unreadable directories\n }\n }\n } catch {\n // History dir unreadable\n }\n\n // Sort by timestamp descending\n return allDecisions.sort(\n (a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime()\n );\n}\n\nfunction loadDecisions(projectRoot: string): DecisionStore {\n const storePath = getDecisionStorePath(projectRoot);\n if (existsSync(storePath)) {\n try {\n return JSON.parse(readFileSync(storePath, 'utf-8'));\n } catch {\n // Invalid file, start fresh\n }\n }\n return {\n decisions: [],\n sessionStart: new Date().toISOString(),\n };\n}\n\nfunction saveDecisions(projectRoot: string, store: DecisionStore): void {\n const storePath = getDecisionStorePath(projectRoot);\n const dir = join(projectRoot, '.stackmemory');\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n writeFileSync(storePath, JSON.stringify(store, null, 2));\n}\n\nexport function createDecisionCommand(): Command {\n const cmd = new Command('decision');\n cmd.description('Capture key decisions for session handoff context');\n\n // Add a decision\n cmd\n .command('add <what>')\n .description('Record a decision made during this session')\n .option('-w, --why <rationale>', 'Why this decision was made')\n .option(\n '-a, --alternatives <alts>',\n 'Comma-separated alternatives considered'\n )\n .option(\n '-c, --category <category>',\n 'Category (architecture, tooling, approach, etc.)'\n )\n .action((what, options) => {\n const projectRoot = process.cwd();\n const store = loadDecisions(projectRoot);\n\n const decision: Decision = {\n id: `d-${Date.now()}`,\n what,\n why: options.why || '',\n alternatives: options.alternatives\n ?.split(',')\n .map((a: string) => a.trim()),\n timestamp: new Date().toISOString(),\n category: options.category,\n };\n\n store.decisions.push(decision);\n saveDecisions(projectRoot, store);\n\n console.log('Decision recorded:');\n console.log(` What: ${decision.what}`);\n if (decision.why) {\n console.log(` Why: ${decision.why}`);\n }\n if (decision.alternatives) {\n console.log(` Alternatives: ${decision.alternatives.join(', ')}`);\n }\n console.log(`\\nTotal decisions this session: ${store.decisions.length}`);\n });\n\n // List decisions\n cmd\n .command('list')\n .description('List all decisions from this session')\n .option('--json', 'Output as JSON')\n .option('--history', 'Include historical decisions')\n .option('--all', 'Show all projects (with --history)')\n .action((options) => {\n const projectRoot = process.cwd();\n const store = loadDecisions(projectRoot);\n\n if (options.history) {\n const history = loadDecisionHistory(\n options.all ? undefined : projectRoot\n );\n\n if (options.json) {\n console.log(JSON.stringify(history, null, 2));\n return;\n }\n\n if (history.length === 0) {\n console.log('No decision history found.');\n return;\n }\n\n console.log(`Decision History (${history.length}):\\n`);\n for (const d of history.slice(0, 50)) {\n const category = d.category ? `[${d.category}] ` : '';\n const project = options.all ? `(${d.projectName}) ` : '';\n console.log(`${project}${category}${d.what}`);\n if (d.why) {\n console.log(` Rationale: ${d.why}`);\n }\n const date = new Date(d.timestamp).toLocaleDateString();\n console.log(` Date: ${date}`);\n console.log('');\n }\n return;\n }\n\n if (options.json) {\n console.log(JSON.stringify(store.decisions, null, 2));\n return;\n }\n\n if (store.decisions.length === 0) {\n console.log('No decisions recorded this session.');\n console.log('\\nRecord decisions with:');\n console.log(' stackmemory decision add \"Decision\" --why \"Rationale\"');\n return;\n }\n\n console.log(`Session Decisions (${store.decisions.length}):\\n`);\n for (const d of store.decisions) {\n const category = d.category ? `[${d.category}] ` : '';\n console.log(`${category}${d.what}`);\n if (d.why) {\n console.log(` Rationale: ${d.why}`);\n }\n if (d.alternatives && d.alternatives.length > 0) {\n console.log(` Alternatives: ${d.alternatives.join(', ')}`);\n }\n console.log('');\n }\n });\n\n // Clear decisions (for new session)\n cmd\n .command('clear')\n .description('Clear all decisions (archives to history first)')\n .option('--force', 'Skip confirmation')\n .option('--no-archive', 'Do not archive decisions')\n .action((options) => {\n const projectRoot = process.cwd();\n const store = loadDecisions(projectRoot);\n\n if (store.decisions.length === 0) {\n console.log('No decisions to clear.');\n return;\n }\n\n if (!options.force) {\n console.log(`This will clear ${store.decisions.length} decisions.`);\n console.log('Decisions will be archived to history.');\n console.log('Use --force to confirm.');\n return;\n }\n\n // Archive before clearing (unless --no-archive)\n if (options.archive !== false) {\n archiveDecisions(projectRoot, store.decisions);\n console.log(`Archived ${store.decisions.length} decisions to history.`);\n }\n\n const newStore: DecisionStore = {\n decisions: [],\n sessionStart: new Date().toISOString(),\n };\n saveDecisions(projectRoot, newStore);\n console.log('Decisions cleared. New session started.');\n });\n\n // Quick capture common decision types\n cmd\n .command('arch <description>')\n .description('Record an architecture decision')\n .option('-w, --why <rationale>', 'Why this architecture choice')\n .action((description, options) => {\n const projectRoot = process.cwd();\n const store = loadDecisions(projectRoot);\n\n const decision: Decision = {\n id: `d-${Date.now()}`,\n what: description,\n why: options.why || '',\n timestamp: new Date().toISOString(),\n category: 'architecture',\n };\n\n store.decisions.push(decision);\n saveDecisions(projectRoot, store);\n\n console.log(`Architecture decision recorded: ${description}`);\n });\n\n cmd\n .command('tool <description>')\n .description('Record a tooling decision')\n .option('-w, --why <rationale>', 'Why this tool choice')\n .action((description, options) => {\n const projectRoot = process.cwd();\n const store = loadDecisions(projectRoot);\n\n const decision: Decision = {\n id: `d-${Date.now()}`,\n what: description,\n why: options.why || '',\n timestamp: new Date().toISOString(),\n category: 'tooling',\n };\n\n store.decisions.push(decision);\n saveDecisions(projectRoot, store);\n\n console.log(`Tooling decision recorded: ${description}`);\n });\n\n return cmd;\n}\n\n// Export for use in enhanced handoff\nexport function getSessionDecisions(projectRoot: string): Decision[] {\n const store = loadDecisions(projectRoot);\n return store.decisions;\n}\n\n// Alias: \"memory\" command (same as decision)\nexport function createMemoryCommand(): Command {\n const cmd = createDecisionCommand();\n // Change command name to \"memory\" but keep all subcommands\n return new Command('memory')\n .description('Store memories for session context (alias for decision)')\n .addCommand(\n cmd.commands.find((c) => c.name() === 'add')!.copyInheritedSettings(cmd)\n )\n .addCommand(\n cmd.commands.find((c) => c.name() === 'list')!.copyInheritedSettings(cmd)\n )\n .addCommand(\n cmd.commands.find((c) => c.name() === 'clear')!.copyInheritedSettings(cmd)\n )\n .addCommand(\n cmd.commands.find((c) => c.name() === 'arch')!.copyInheritedSettings(cmd)\n )\n .addCommand(\n cmd.commands.find((c) => c.name() === 'tool')!.copyInheritedSettings(cmd)\n );\n}\n"],
5
+ "mappings": "AASA,SAAS,eAAe;AACxB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,MAAM,gBAAgB;AAC/B,SAAS,eAAe;AACxB,SA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