claude-autopm 1.31.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+
2
+ # Test Server
3
+
4
+ ```json
5
+ {
6
+ "name": "test-server",
7
+ "command": "npx",
8
+ "args": ["test-package"]
9
+ }
10
+ ```
package/bin/autopm-poc.js CHANGED
@@ -16,30 +16,38 @@ const fs = require('fs');
16
16
  const path = require('path');
17
17
  const ClaudeProvider = require('../lib/ai-providers/ClaudeProvider');
18
18
  const PRDService = require('../lib/services/PRDService');
19
+ const EpicService = require('../lib/services/EpicService');
20
+ const ConfigManager = require('../lib/config/ConfigManager');
21
+ const ServiceFactory = require('../lib/utils/ServiceFactory');
19
22
 
20
23
  /**
21
24
  * Print usage information
22
25
  */
23
26
  function printUsage() {
24
27
  console.log(`
25
- AutoPM POC - Claude API Integration Demo
26
- =========================================
28
+ AutoPM POC - Claude API Integration Demo (Streaming Support)
29
+ =============================================================
27
30
 
28
31
  Usage:
29
- autopm-poc parse <prd-file> Parse PRD with streaming output
30
- autopm-poc parse <prd-file> --json Parse PRD and extract epics as JSON
31
- autopm-poc summarize <prd-file> Get one-paragraph summary
32
+ autopm-poc parse <prd-file> Parse PRD with streaming AI analysis
33
+ autopm-poc extract-epics <prd-file> Extract epics from PRD (streaming)
34
+ autopm-poc summarize <prd-file> Get PRD summary (streaming)
35
+ autopm-poc decompose <epic-file> Decompose epic into tasks (streaming)
36
+ autopm-poc analyze <prd-file> Epic-level PRD analysis (streaming)
32
37
  autopm-poc test Test API connection
33
38
  autopm-poc help Show this help message
34
39
 
35
40
  Environment Variables:
36
41
  ANTHROPIC_API_KEY Required - Your Anthropic API key
42
+ AUTOPM_MASTER_PASSWORD Optional - For encrypted config
37
43
 
38
44
  Examples:
39
45
  export ANTHROPIC_API_KEY="sk-ant-..."
40
46
  autopm-poc parse examples/sample-prd.md
47
+ autopm-poc extract-epics examples/sample-prd.md
41
48
  autopm-poc summarize examples/sample-prd.md
42
- autopm-poc parse examples/sample-prd.md --json
49
+ autopm-poc decompose .claude/epics/user-auth.md
50
+ autopm-poc analyze examples/sample-prd.md
43
51
  `);
44
52
  }
45
53
 
@@ -89,39 +97,97 @@ async function parsePRDStream(service, content) {
89
97
  }
90
98
 
91
99
  /**
92
- * Parse PRD and extract epics as JSON
100
+ * Extract epics from PRD with streaming output
93
101
  */
94
- async function parsePRDJson(service, content) {
95
- console.log('šŸ” Extracting epics from PRD...\n');
102
+ async function extractEpicsStream(service, content) {
103
+ console.log('šŸ” Extracting epics from PRD with Claude AI...\n');
104
+ console.log('šŸ“ Streaming response:\n');
105
+ console.log('─'.repeat(60));
106
+
107
+ let fullResponse = '';
108
+ try {
109
+ for await (const chunk of service.extractEpicsStream(content)) {
110
+ process.stdout.write(chunk);
111
+ fullResponse += chunk;
112
+ }
113
+
114
+ console.log('\n' + '─'.repeat(60));
115
+ console.log('\nāœ… Epic extraction complete!');
116
+ console.log(`šŸ“Š Total response length: ${fullResponse.length} characters\n`);
117
+ } catch (error) {
118
+ console.error('\nāŒ Error during epic extraction:', error.message);
119
+ process.exit(1);
120
+ }
121
+ }
96
122
 
123
+ /**
124
+ * Summarize PRD with streaming output
125
+ */
126
+ async function summarizePRDStream(service, content) {
127
+ console.log('šŸ” Summarizing PRD with Claude AI...\n');
128
+ console.log('šŸ“ Streaming response:\n');
129
+ console.log('─'.repeat(60));
130
+
131
+ let fullResponse = '';
97
132
  try {
98
- const epics = await service.extractEpics(content);
133
+ for await (const chunk of service.summarizeStream(content)) {
134
+ process.stdout.write(chunk);
135
+ fullResponse += chunk;
136
+ }
99
137
 
100
- console.log('āœ… Extraction complete!\n');
101
- console.log('šŸ“‹ Extracted Epics:\n');
102
- console.log(JSON.stringify(epics, null, 2));
103
- console.log(`\nšŸ“Š Found ${Array.isArray(epics) ? epics.length : 0} epic(s)\n`);
138
+ console.log('\n' + '─'.repeat(60));
139
+ console.log('\nāœ… Summary complete!');
140
+ console.log(`šŸ“Š Total response length: ${fullResponse.length} characters\n`);
104
141
  } catch (error) {
105
- console.error('āŒ Error during JSON extraction:', error.message);
142
+ console.error('\nāŒ Error during summarization:', error.message);
106
143
  process.exit(1);
107
144
  }
108
145
  }
109
146
 
110
147
  /**
111
- * Summarize PRD
148
+ * Decompose epic into tasks with streaming output
112
149
  */
113
- async function summarizePRD(service, content) {
114
- console.log('šŸ” Summarizing PRD...\n');
150
+ async function decomposeEpicStream(epicService, content) {
151
+ console.log('šŸ” Decomposing epic into tasks with Claude AI...\n');
152
+ console.log('šŸ“ Streaming response:\n');
153
+ console.log('─'.repeat(60));
115
154
 
155
+ let fullResponse = '';
116
156
  try {
117
- const summary = await service.summarize(content);
157
+ for await (const chunk of epicService.decomposeStream(content)) {
158
+ process.stdout.write(chunk);
159
+ fullResponse += chunk;
160
+ }
118
161
 
119
- console.log('āœ… Summary complete!\n');
120
- console.log('šŸ“ Summary:\n');
121
- console.log(summary);
122
- console.log();
162
+ console.log('\n' + '─'.repeat(60));
163
+ console.log('\nāœ… Task decomposition complete!');
164
+ console.log(`šŸ“Š Total response length: ${fullResponse.length} characters\n`);
123
165
  } catch (error) {
124
- console.error('āŒ Error during summarization:', error.message);
166
+ console.error('\nāŒ Error during decomposition:', error.message);
167
+ process.exit(1);
168
+ }
169
+ }
170
+
171
+ /**
172
+ * Analyze PRD for epic breakdown with streaming output
173
+ */
174
+ async function analyzePRDStream(epicService, content) {
175
+ console.log('šŸ” Analyzing PRD for epic breakdown with Claude AI...\n');
176
+ console.log('šŸ“ Streaming response:\n');
177
+ console.log('─'.repeat(60));
178
+
179
+ let fullResponse = '';
180
+ try {
181
+ for await (const chunk of epicService.analyzeStream(content)) {
182
+ process.stdout.write(chunk);
183
+ fullResponse += chunk;
184
+ }
185
+
186
+ console.log('\n' + '─'.repeat(60));
187
+ console.log('\nāœ… PRD analysis complete!');
188
+ console.log(`šŸ“Š Total response length: ${fullResponse.length} characters\n`);
189
+ } catch (error) {
190
+ console.error('\nāŒ Error during PRD analysis:', error.message);
125
191
  process.exit(1);
126
192
  }
127
193
  }
@@ -139,18 +205,55 @@ async function main() {
139
205
  process.exit(0);
140
206
  }
141
207
 
142
- // Check for API key
143
- const apiKey = process.env.ANTHROPIC_API_KEY;
144
- if (!apiKey) {
145
- console.error('āŒ Error: ANTHROPIC_API_KEY environment variable required\n');
146
- console.error('Set it with:');
147
- console.error(' export ANTHROPIC_API_KEY="sk-ant-..."\n');
148
- process.exit(1);
208
+ // Try ConfigManager first, fallback to environment variable
209
+ let prdService;
210
+ let epicService;
211
+ let provider;
212
+ let configManager;
213
+
214
+ const configPath = path.join(process.cwd(), '.autopm', 'config.json');
215
+ if (fs.existsSync(configPath)) {
216
+ try {
217
+ configManager = new ConfigManager(configPath);
218
+
219
+ // Check for master password
220
+ const password = process.env.AUTOPM_MASTER_PASSWORD;
221
+ if (password) {
222
+ configManager.setMasterPassword(password);
223
+
224
+ // Use ServiceFactory to create services and provider
225
+ const factory = new ServiceFactory(configManager);
226
+ provider = factory.createProvider();
227
+ prdService = factory.createPRDService({ provider });
228
+ epicService = factory.createEpicService({ provider });
229
+ console.log('āœ… Using configuration from .autopm/config.json\n');
230
+ } else {
231
+ console.log('āš ļø Config file found but AUTOPM_MASTER_PASSWORD not set');
232
+ console.log(' Falling back to ANTHROPIC_API_KEY environment variable\n');
233
+ }
234
+ } catch (error) {
235
+ console.log(`āš ļø Error loading config: ${error.message}`);
236
+ console.log(' Falling back to ANTHROPIC_API_KEY environment variable\n');
237
+ }
149
238
  }
150
239
 
151
- // Initialize provider and service
152
- const provider = new ClaudeProvider(apiKey);
153
- const service = new PRDService(provider);
240
+ // Fallback to environment variable
241
+ if (!prdService) {
242
+ const apiKey = process.env.ANTHROPIC_API_KEY;
243
+ if (!apiKey) {
244
+ console.error('āŒ Error: No API key found\n');
245
+ console.error('Either:');
246
+ console.error(' 1. Run: autopm config:init (recommended)');
247
+ console.error(' Then: export AUTOPM_MASTER_PASSWORD="your-password"');
248
+ console.error(' 2. Set: export ANTHROPIC_API_KEY="sk-ant-..."\n');
249
+ process.exit(1);
250
+ }
251
+
252
+ provider = new ClaudeProvider(apiKey);
253
+ prdService = new PRDService({ provider });
254
+ epicService = new EpicService({ prdService, provider });
255
+ console.log('āœ… Using ANTHROPIC_API_KEY from environment\n');
256
+ }
154
257
 
155
258
  // Handle test command
156
259
  if (command === 'test') {
@@ -158,8 +261,8 @@ async function main() {
158
261
  process.exit(success ? 0 : 1);
159
262
  }
160
263
 
161
- // Handle parse and summarize commands
162
- if (command === 'parse' || command === 'summarize') {
264
+ // Handle PRD commands (parse, extract-epics, summarize, analyze)
265
+ if (['parse', 'extract-epics', 'summarize', 'analyze'].includes(command)) {
163
266
  const file = args[1];
164
267
 
165
268
  if (!file) {
@@ -187,20 +290,49 @@ async function main() {
187
290
 
188
291
  // Execute command
189
292
  if (command === 'parse') {
190
- const jsonFlag = args[2] === '--json';
191
-
192
- if (jsonFlag) {
193
- await parsePRDJson(service, content);
194
- } else {
195
- await parsePRDStream(service, content);
196
- }
293
+ await parsePRDStream(prdService, content);
294
+ } else if (command === 'extract-epics') {
295
+ await extractEpicsStream(prdService, content);
197
296
  } else if (command === 'summarize') {
198
- await summarizePRD(service, content);
297
+ await summarizePRDStream(prdService, content);
298
+ } else if (command === 'analyze') {
299
+ await analyzePRDStream(epicService, content);
199
300
  }
200
301
 
201
302
  process.exit(0);
202
303
  }
203
304
 
305
+ // Handle decompose command (for epic files)
306
+ if (command === 'decompose') {
307
+ const file = args[1];
308
+
309
+ if (!file) {
310
+ console.error(`āŒ Error: Epic file required for 'decompose' command\n`);
311
+ console.error(`Usage: autopm-poc decompose <epic-file>\n`);
312
+ process.exit(1);
313
+ }
314
+
315
+ // Check if file exists
316
+ if (!fs.existsSync(file)) {
317
+ console.error(`āŒ Error: File not found: ${file}\n`);
318
+ process.exit(1);
319
+ }
320
+
321
+ // Read file content
322
+ const content = fs.readFileSync(file, 'utf8');
323
+
324
+ if (!content.trim()) {
325
+ console.error('āŒ Error: Epic file is empty\n');
326
+ process.exit(1);
327
+ }
328
+
329
+ console.log(`šŸ“„ Reading Epic from: ${file}`);
330
+ console.log(`šŸ“ File size: ${content.length} characters\n`);
331
+
332
+ await decomposeEpicStream(epicService, content);
333
+ process.exit(0);
334
+ }
335
+
204
336
  // Unknown command
205
337
  console.error(`āŒ Error: Unknown command: ${command}\n`);
206
338
  printUsage();
package/bin/autopm.js CHANGED
@@ -182,6 +182,12 @@ function main() {
182
182
  .command(require('./commands/mcp'))
183
183
  // Epic management command
184
184
  .command(require('./commands/epic'))
185
+ // PRD management command (STANDALONE)
186
+ .command(require('../lib/cli/commands/prd'))
187
+ // Task management command (STANDALONE)
188
+ .command(require('../lib/cli/commands/task'))
189
+ // Agent management command (STANDALONE)
190
+ .command(require('../lib/cli/commands/agent'))
185
191
  // Validation command
186
192
  .command('validate', 'Validate ClaudeAutoPM configuration and setup',
187
193
  (yargs) => {