claude-autopm 1.30.0 → 1.31.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,110 @@
1
+ /**
2
+ * Base AI Provider Interface
3
+ *
4
+ * Abstract class that all AI providers must implement
5
+ */
6
+
7
+ class BaseProvider {
8
+ constructor(config = {}) {
9
+ if (this.constructor === BaseProvider) {
10
+ throw new Error('BaseProvider is abstract and cannot be instantiated directly');
11
+ }
12
+
13
+ this.config = config;
14
+ this.apiKey = config.apiKey || process.env[this.getApiKeyEnvVar()];
15
+ this.model = config.model || this.getDefaultModel();
16
+ this.maxTokens = config.maxTokens || 4096;
17
+ this.temperature = config.temperature || 0.7;
18
+ }
19
+
20
+ /**
21
+ * Get environment variable name for API key
22
+ * @abstract
23
+ */
24
+ getApiKeyEnvVar() {
25
+ throw new Error('getApiKeyEnvVar() must be implemented by provider');
26
+ }
27
+
28
+ /**
29
+ * Get default model name
30
+ * @abstract
31
+ */
32
+ getDefaultModel() {
33
+ throw new Error('getDefaultModel() must be implemented by provider');
34
+ }
35
+
36
+ /**
37
+ * Complete a prompt (main interface)
38
+ * @abstract
39
+ * @param {string} prompt - The prompt to complete
40
+ * @param {Object} options - Additional options
41
+ * @returns {Promise<string>} - Completion result
42
+ */
43
+ async complete(prompt, options = {}) {
44
+ throw new Error('complete() must be implemented by provider');
45
+ }
46
+
47
+ /**
48
+ * Stream completion (optional, for interactive mode)
49
+ * @abstract
50
+ * @param {string} prompt - The prompt to complete
51
+ * @param {Function} onChunk - Callback for each chunk
52
+ * @param {Object} options - Additional options
53
+ * @returns {Promise<string>} - Full completion result
54
+ */
55
+ async streamComplete(prompt, onChunk, options = {}) {
56
+ // Default: fall back to non-streaming
57
+ const result = await this.complete(prompt, options);
58
+ if (onChunk) onChunk(result);
59
+ return result;
60
+ }
61
+
62
+ /**
63
+ * Chat completion (multi-turn conversation)
64
+ * @param {Array<{role: string, content: string}>} messages
65
+ * @param {Object} options
66
+ * @returns {Promise<string>}
67
+ */
68
+ async chat(messages, options = {}) {
69
+ // Default: convert to single prompt
70
+ const prompt = messages.map(m => `${m.role}: ${m.content}`).join('\n\n');
71
+ return await this.complete(prompt, options);
72
+ }
73
+
74
+ /**
75
+ * Validate API key
76
+ * @returns {Promise<boolean>}
77
+ */
78
+ async validate() {
79
+ try {
80
+ await this.complete('Hello', { maxTokens: 10 });
81
+ return true;
82
+ } catch (error) {
83
+ return false;
84
+ }
85
+ }
86
+
87
+ /**
88
+ * Get provider name
89
+ * @returns {string}
90
+ */
91
+ getName() {
92
+ return this.constructor.name.replace('Provider', '');
93
+ }
94
+
95
+ /**
96
+ * Get provider info
97
+ * @returns {Object}
98
+ */
99
+ getInfo() {
100
+ return {
101
+ name: this.getName(),
102
+ model: this.model,
103
+ maxTokens: this.maxTokens,
104
+ temperature: this.temperature,
105
+ apiKeyConfigured: !!this.apiKey
106
+ };
107
+ }
108
+ }
109
+
110
+ module.exports = BaseProvider;
@@ -0,0 +1,178 @@
1
+ /**
2
+ * PRDService - Product Requirements Document parsing with AI
3
+ *
4
+ * Analyzes PRD documents and extracts structured information
5
+ * including epics, features, dependencies, and estimates.
6
+ *
7
+ * Documentation Queries:
8
+ * - mcp://context7/agile/prd-analysis - PRD analysis best practices
9
+ * - mcp://context7/agile/epic-breakdown - Epic decomposition patterns
10
+ * - mcp://context7/project-management/estimation - Estimation techniques
11
+ */
12
+
13
+ /**
14
+ * PRDService class for analyzing Product Requirements Documents
15
+ */
16
+ class PRDService {
17
+ /**
18
+ * Create a new PRDService instance
19
+ * @param {Object} aiProvider - AI provider instance (e.g., ClaudeProvider)
20
+ */
21
+ constructor(aiProvider) {
22
+ if (!aiProvider) {
23
+ throw new Error('AI provider is required for PRDService');
24
+ }
25
+ this.ai = aiProvider;
26
+ }
27
+
28
+ /**
29
+ * Build a comprehensive prompt for PRD analysis
30
+ * @param {string} prdContent - The PRD content to analyze
31
+ * @returns {string} Structured prompt for AI
32
+ * @private
33
+ */
34
+ _buildPrompt(prdContent) {
35
+ return `You are an expert product manager and technical analyst. Analyze the following Product Requirements Document (PRD) and extract structured information.
36
+
37
+ PRD Content:
38
+ ${prdContent}
39
+
40
+ Please analyze and provide:
41
+
42
+ 1. **Project Overview**
43
+ - Project name
44
+ - Brief description
45
+ - Goals and objectives
46
+
47
+ 2. **Epics/Features** (Main features or user stories)
48
+ - Name of each epic
49
+ - Description
50
+ - Rough estimate (if mentioned)
51
+ - Priority (High/Medium/Low)
52
+
53
+ 3. **Technical Requirements**
54
+ - Technologies mentioned
55
+ - Infrastructure needs
56
+ - Integration points
57
+
58
+ 4. **Dependencies**
59
+ - Dependencies between features
60
+ - External dependencies
61
+ - Blockers or constraints
62
+
63
+ 5. **Timeline/Phases** (if mentioned)
64
+ - Phases or milestones
65
+ - Estimated durations
66
+
67
+ Please structure your response clearly with headers and bullet points. Focus on actionable insights that would help with project planning and task breakdown.`;
68
+ }
69
+
70
+ /**
71
+ * Build a simpler prompt for streaming analysis
72
+ * @param {string} prdContent - The PRD content to analyze
73
+ * @returns {string} Prompt for streaming
74
+ * @private
75
+ */
76
+ _buildStreamPrompt(prdContent) {
77
+ return `Analyze this PRD and extract the key epics, features, and technical requirements:
78
+
79
+ ${prdContent}
80
+
81
+ Provide a clear, structured breakdown of:
82
+ 1. Main features/epics
83
+ 2. Technical requirements
84
+ 3. Dependencies
85
+ 4. Estimated timeline (if mentioned)`;
86
+ }
87
+
88
+ /**
89
+ * Parse PRD synchronously (wait for complete analysis)
90
+ * @param {string} prdContent - The PRD content to analyze
91
+ * @param {Object} options - Optional configuration
92
+ * @returns {Promise<string>} Structured analysis of the PRD
93
+ */
94
+ async parse(prdContent, options = {}) {
95
+ if (!prdContent) {
96
+ return 'No PRD content provided. Please provide a PRD document to analyze.';
97
+ }
98
+
99
+ const prompt = this._buildPrompt(prdContent);
100
+
101
+ try {
102
+ return await this.ai.complete(prompt, options);
103
+ } catch (error) {
104
+ throw new Error(`PRD parsing error: ${error.message}`);
105
+ }
106
+ }
107
+
108
+ /**
109
+ * Parse PRD with streaming (async generator for real-time feedback)
110
+ * @param {string} prdContent - The PRD content to analyze
111
+ * @param {Object} options - Optional configuration
112
+ * @yields {string} Analysis chunks as they arrive
113
+ */
114
+ async *parseStream(prdContent, options = {}) {
115
+ if (!prdContent) {
116
+ yield 'No PRD content provided. Please provide a PRD document to analyze.';
117
+ return;
118
+ }
119
+
120
+ const prompt = this._buildStreamPrompt(prdContent);
121
+
122
+ try {
123
+ for await (const chunk of this.ai.stream(prompt, options)) {
124
+ yield chunk;
125
+ }
126
+ } catch (error) {
127
+ throw new Error(`PRD streaming error: ${error.message}`);
128
+ }
129
+ }
130
+
131
+ /**
132
+ * Extract epics from PRD (simplified extraction)
133
+ * @param {string} prdContent - The PRD content
134
+ * @returns {Promise<Array>} Array of epic objects
135
+ */
136
+ async extractEpics(prdContent) {
137
+ const prompt = `Extract all epics/features from this PRD and return them as a JSON array:
138
+
139
+ ${prdContent}
140
+
141
+ Format: [{"name": "Epic Name", "description": "Brief description", "estimate": "time estimate if available"}]
142
+
143
+ Return ONLY the JSON array, no other text.`;
144
+
145
+ try {
146
+ const response = await this.ai.complete(prompt, { maxTokens: 2048 });
147
+
148
+ // Try to parse as JSON
149
+ try {
150
+ return JSON.parse(response);
151
+ } catch (parseError) {
152
+ // If parsing fails, return raw response wrapped in array
153
+ return [{ raw: response }];
154
+ }
155
+ } catch (error) {
156
+ throw new Error(`Epic extraction error: ${error.message}`);
157
+ }
158
+ }
159
+
160
+ /**
161
+ * Summarize PRD in one paragraph
162
+ * @param {string} prdContent - The PRD content
163
+ * @returns {Promise<string>} One-paragraph summary
164
+ */
165
+ async summarize(prdContent) {
166
+ const prompt = `Summarize this PRD in one concise paragraph (2-3 sentences):
167
+
168
+ ${prdContent}`;
169
+
170
+ try {
171
+ return await this.ai.complete(prompt, { maxTokens: 256 });
172
+ } catch (error) {
173
+ throw new Error(`PRD summarization error: ${error.message}`);
174
+ }
175
+ }
176
+ }
177
+
178
+ module.exports = PRDService;
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "claude-autopm",
3
- "version": "1.30.0",
3
+ "version": "1.31.0",
4
4
  "description": "Autonomous Project Management Framework for Claude Code - Advanced AI-powered development automation",
5
5
  "main": "bin/autopm.js",
6
6
  "bin": {
7
- "autopm": "./bin/autopm.js"
7
+ "autopm": "./bin/autopm.js",
8
+ "autopm-poc": "./bin/autopm-poc.js"
8
9
  },
9
10
  "scripts": {
10
11
  "postinstall": "echo '🎉 ClaudeAutoPM installed! Run: autopm --help'",
@@ -52,6 +53,7 @@
52
53
  "test:unit:coverage": "c8 node --test $(find test/unit -name '*.test.js' ! -name '*-jest.test.js')",
53
54
  "test:e2e": "jest test/e2e",
54
55
  "test:e2e:legacy": "node --test test/e2e/*.test.js",
56
+ "test:poc": "jest --config jest.config.poc.js",
55
57
  "setup:hooks": "bash scripts/setup-hooks.sh",
56
58
  "lint": "markdownlint *.md .claude/**/*.md install/*.md",
57
59
  "lint:fix": "markdownlint --fix *.md .claude/**/*.md install/*.md",
@@ -114,6 +116,7 @@
114
116
  "README.md"
115
117
  ],
116
118
  "dependencies": {
119
+ "@anthropic-ai/sdk": "^0.32.1",
117
120
  "@octokit/rest": "^22.0.0",
118
121
  "azure-devops-node-api": "^15.1.1",
119
122
  "chalk": "^5.3.0",