@open-product-primer/cli 0.1.0 → 0.1.1

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.
@@ -93,22 +93,13 @@ function initCommand() {
93
93
  }
94
94
  else {
95
95
  const existingAgents = (0, detect_1.readAgentsFromConfig)(projectRoot);
96
- if (existingAgents !== null) {
96
+ if (existingAgents !== null && existingAgents.length > 0) {
97
97
  selectedAgents = existingAgents;
98
- if (selectedAgents.length > 0) {
99
- console.log('\n' + chalk_1.default.dim(`Re-installing for configured agents: ${selectedAgents.join(', ')}`));
100
- }
98
+ console.log('\n' + chalk_1.default.dim(`Re-installing for configured agents: ${selectedAgents.join(', ')}`));
101
99
  }
102
100
  else {
103
101
  console.log('');
104
- const { checkbox } = await Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
105
- selectedAgents = await checkbox({
106
- message: 'Which AI tools should /oprim:* skills be installed for?',
107
- choices: [
108
- { name: 'Claude Code', value: 'claude' },
109
- { name: 'Cursor', value: 'cursor' },
110
- ],
111
- });
102
+ selectedAgents = await (0, install_agent_1.promptAgentSelection)(projectRoot);
112
103
  }
113
104
  }
114
105
  (0, detect_1.writeAgentsToConfig)(selectedAgents, projectRoot);
@@ -46,7 +46,7 @@ const detect_1 = require("../lib/detect");
46
46
  function updateCommand() {
47
47
  return new commander_1.Command('update')
48
48
  .description('Refresh /oprim:* assistant commands and skills from package templates')
49
- .action(() => {
49
+ .action(async () => {
50
50
  const projectRoot = process.cwd();
51
51
  const configAgents = (0, detect_1.readAgentsFromConfig)(projectRoot);
52
52
  if (configAgents !== null && configAgents.length > 0) {
@@ -55,27 +55,50 @@ function updateCommand() {
55
55
  }
56
56
  console.log(`\nAgent skills updated: ${configAgents.join(', ')}`);
57
57
  }
58
- else if (configAgents !== null && configAgents.length === 0) {
59
- console.log(chalk_1.default.yellow('No agents configured') + ' — run ' + chalk_1.default.cyan('oprim init') + ' to select agents');
60
- }
61
58
  else {
62
59
  // Legacy: fall back to directory detection
63
- let updated = 0;
60
+ const legacyAgents = [];
64
61
  if (fs.existsSync(path.join(projectRoot, '.claude'))) {
65
62
  (0, install_agent_1.installAgentSkills)('claude', projectRoot);
66
- updated++;
63
+ legacyAgents.push('claude');
67
64
  }
68
65
  if (fs.existsSync(path.join(projectRoot, '.cursor'))) {
69
66
  (0, install_agent_1.installAgentSkills)('cursor', projectRoot);
70
- updated++;
67
+ legacyAgents.push('cursor');
71
68
  }
72
- if (updated === 0) {
73
- console.log(chalk_1.default.yellow('No assistant environments detected (.claude/, .cursor/).'));
74
- console.log('Run this command from a repository where AI tools are configured.');
69
+ if (legacyAgents.length > 0) {
70
+ console.log(`\nAgent skills updated for ${legacyAgents.length} environment(s).`);
75
71
  }
76
72
  else {
77
- console.log(`\nAgent skills updated for ${updated} environment(s).`);
73
+ console.log(chalk_1.default.yellow('No agents configured or detected.'));
78
74
  }
79
75
  }
76
+ // ── Post-update: offer to add more agents ────────────────────────────────
77
+ const currentAgents = configAgents ?? [];
78
+ console.log('');
79
+ const { confirm } = await Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
80
+ const addMore = await confirm({
81
+ message: 'Would you like to install skills for additional agents?',
82
+ default: false,
83
+ });
84
+ if (!addMore) {
85
+ console.log('\nRun ' + chalk_1.default.cyan('oprim doctor') + ' to verify your setup.');
86
+ return;
87
+ }
88
+ console.log('');
89
+ const selected = await (0, install_agent_1.promptAgentSelection)(projectRoot);
90
+ if (selected.length === 0) {
91
+ console.log('\n' + chalk_1.default.yellow('No agents selected.'));
92
+ console.log('\nRun ' + chalk_1.default.cyan('oprim doctor') + ' to verify your setup.');
93
+ return;
94
+ }
95
+ console.log('\n' + chalk_1.default.bold('Installing agent skills...'));
96
+ for (const agent of selected) {
97
+ (0, install_agent_1.installAgentSkills)(agent, projectRoot);
98
+ }
99
+ const merged = Array.from(new Set([...currentAgents, ...selected]));
100
+ (0, detect_1.writeAgentsToConfig)(merged, projectRoot);
101
+ console.log('\n' + chalk_1.default.green('✓') + ` Agent skills installed: ${selected.join(', ')}`);
102
+ console.log('\nRun ' + chalk_1.default.cyan('oprim doctor') + ' to verify your setup.');
80
103
  });
81
104
  }
@@ -7,4 +7,5 @@ export declare function detectGraphify(projectRoot: string): {
7
7
  graphDir: string | null;
8
8
  };
9
9
  export declare function readAgentsFromConfig(projectRoot: string): string[] | null;
10
+ export declare function detectAvailableAgents(projectRoot: string): string[];
10
11
  export declare function writeAgentsToConfig(agents: string[], projectRoot: string): void;
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.detectOpenSpec = detectOpenSpec;
37
37
  exports.detectGraphify = detectGraphify;
38
38
  exports.readAgentsFromConfig = readAgentsFromConfig;
39
+ exports.detectAvailableAgents = detectAvailableAgents;
39
40
  exports.writeAgentsToConfig = writeAgentsToConfig;
40
41
  const fs = __importStar(require("fs"));
41
42
  const path = __importStar(require("path"));
@@ -61,6 +62,14 @@ function readAgentsFromConfig(projectRoot) {
61
62
  return null;
62
63
  return agents;
63
64
  }
65
+ function detectAvailableAgents(projectRoot) {
66
+ const detected = [];
67
+ if (fs.existsSync(path.join(projectRoot, '.claude')))
68
+ detected.push('claude');
69
+ if (fs.existsSync(path.join(projectRoot, '.cursor')))
70
+ detected.push('cursor');
71
+ return detected;
72
+ }
64
73
  function writeAgentsToConfig(agents, projectRoot) {
65
74
  const configPath = path.join(projectRoot, 'primer', 'config.yaml');
66
75
  if (!fs.existsSync(configPath))
@@ -1,5 +1,6 @@
1
1
  export type Agent = 'claude' | 'cursor';
2
2
  export declare const SUPPORTED_AGENTS: readonly Agent[];
3
+ export declare function promptAgentSelection(projectRoot: string): Promise<string[]>;
3
4
  export declare function installAgentSkills(agent: Agent, projectRoot: string): void;
4
5
  export declare const CLAUDE_SKILLS: Record<string, string>;
5
6
  export declare const CLAUDE_COMMANDS: Record<string, string>;
@@ -37,12 +37,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.CURSOR_COMMANDS = exports.CURSOR_SKILLS = exports.CLAUDE_COMMANDS = exports.CLAUDE_SKILLS = exports.SUPPORTED_AGENTS = void 0;
40
+ exports.promptAgentSelection = promptAgentSelection;
40
41
  exports.installAgentSkills = installAgentSkills;
41
42
  const path = __importStar(require("path"));
42
43
  const fs = __importStar(require("fs"));
43
44
  const chalk_1 = __importDefault(require("chalk"));
44
45
  const scaffold_1 = require("./scaffold");
46
+ const detect_1 = require("./detect");
45
47
  exports.SUPPORTED_AGENTS = ['claude', 'cursor'];
48
+ async function promptAgentSelection(projectRoot) {
49
+ const detected = (0, detect_1.detectAvailableAgents)(projectRoot);
50
+ if (detected.length > 0) {
51
+ console.log(chalk_1.default.dim(`Auto-detected AI tool environments: ${detected.join(', ')}`));
52
+ }
53
+ console.log('');
54
+ const { checkbox } = await Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
55
+ return checkbox({
56
+ message: 'Which AI tools should /oprim:* skills be installed for?',
57
+ choices: [
58
+ { name: 'Claude Code', value: 'claude', checked: detected.includes('claude') },
59
+ { name: 'Cursor', value: 'cursor', checked: detected.includes('cursor') },
60
+ ],
61
+ });
62
+ }
46
63
  function installAgentSkills(agent, projectRoot) {
47
64
  if (agent === 'claude') {
48
65
  const claudeDir = path.join(projectRoot, '.claude');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-product-primer/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Open Product Primer CLI — product decisions, sequencing, and KPI tracking for repositories",
5
5
  "keywords": [
6
6
  "product",