popeye-cli 1.0.0 → 1.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.
- package/README.md +521 -125
- package/dist/adapters/claude.d.ts +16 -4
- package/dist/adapters/claude.d.ts.map +1 -1
- package/dist/adapters/claude.js +679 -33
- package/dist/adapters/claude.js.map +1 -1
- package/dist/adapters/gemini.d.ts +55 -0
- package/dist/adapters/gemini.d.ts.map +1 -0
- package/dist/adapters/gemini.js +318 -0
- package/dist/adapters/gemini.js.map +1 -0
- package/dist/adapters/openai.d.ts.map +1 -1
- package/dist/adapters/openai.js +41 -7
- package/dist/adapters/openai.js.map +1 -1
- package/dist/auth/claude.d.ts +11 -9
- package/dist/auth/claude.d.ts.map +1 -1
- package/dist/auth/claude.js +107 -71
- package/dist/auth/claude.js.map +1 -1
- package/dist/auth/gemini.d.ts +58 -0
- package/dist/auth/gemini.d.ts.map +1 -0
- package/dist/auth/gemini.js +172 -0
- package/dist/auth/gemini.js.map +1 -0
- package/dist/auth/index.d.ts +11 -7
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +23 -5
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/keychain.d.ts +20 -7
- package/dist/auth/keychain.d.ts.map +1 -1
- package/dist/auth/keychain.js +85 -29
- package/dist/auth/keychain.js.map +1 -1
- package/dist/auth/openai.d.ts +2 -2
- package/dist/auth/openai.d.ts.map +1 -1
- package/dist/auth/openai.js +30 -32
- package/dist/auth/openai.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +4 -7
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/interactive.d.ts +2 -2
- package/dist/cli/interactive.d.ts.map +1 -1
- package/dist/cli/interactive.js +1380 -183
- package/dist/cli/interactive.js.map +1 -1
- package/dist/config/defaults.d.ts +6 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +10 -2
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/index.d.ts +10 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +19 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/schema.d.ts +20 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +7 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/generators/python.d.ts.map +1 -1
- package/dist/generators/python.js +1 -0
- package/dist/generators/python.js.map +1 -1
- package/dist/generators/typescript.d.ts.map +1 -1
- package/dist/generators/typescript.js +1 -0
- package/dist/generators/typescript.js.map +1 -1
- package/dist/state/index.d.ts +108 -0
- package/dist/state/index.d.ts.map +1 -1
- package/dist/state/index.js +551 -4
- package/dist/state/index.js.map +1 -1
- package/dist/state/registry.d.ts +52 -0
- package/dist/state/registry.d.ts.map +1 -0
- package/dist/state/registry.js +215 -0
- package/dist/state/registry.js.map +1 -0
- package/dist/types/cli.d.ts +4 -0
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/cli.js.map +1 -1
- package/dist/types/consensus.d.ts +69 -4
- package/dist/types/consensus.d.ts.map +1 -1
- package/dist/types/consensus.js +24 -3
- package/dist/types/consensus.js.map +1 -1
- package/dist/types/workflow.d.ts +55 -0
- package/dist/types/workflow.d.ts.map +1 -1
- package/dist/types/workflow.js +16 -0
- package/dist/types/workflow.js.map +1 -1
- package/dist/workflow/auto-fix.d.ts +45 -0
- package/dist/workflow/auto-fix.d.ts.map +1 -0
- package/dist/workflow/auto-fix.js +274 -0
- package/dist/workflow/auto-fix.js.map +1 -0
- package/dist/workflow/consensus.d.ts +44 -2
- package/dist/workflow/consensus.d.ts.map +1 -1
- package/dist/workflow/consensus.js +565 -17
- package/dist/workflow/consensus.js.map +1 -1
- package/dist/workflow/execution-mode.d.ts +10 -4
- package/dist/workflow/execution-mode.d.ts.map +1 -1
- package/dist/workflow/execution-mode.js +547 -58
- package/dist/workflow/execution-mode.js.map +1 -1
- package/dist/workflow/index.d.ts +14 -2
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/index.js +69 -6
- package/dist/workflow/index.js.map +1 -1
- package/dist/workflow/milestone-workflow.d.ts +34 -0
- package/dist/workflow/milestone-workflow.d.ts.map +1 -0
- package/dist/workflow/milestone-workflow.js +414 -0
- package/dist/workflow/milestone-workflow.js.map +1 -0
- package/dist/workflow/plan-mode.d.ts +14 -1
- package/dist/workflow/plan-mode.d.ts.map +1 -1
- package/dist/workflow/plan-mode.js +589 -47
- package/dist/workflow/plan-mode.js.map +1 -1
- package/dist/workflow/plan-storage.d.ts +142 -0
- package/dist/workflow/plan-storage.d.ts.map +1 -0
- package/dist/workflow/plan-storage.js +331 -0
- package/dist/workflow/plan-storage.js.map +1 -0
- package/dist/workflow/project-verification.d.ts +37 -0
- package/dist/workflow/project-verification.d.ts.map +1 -0
- package/dist/workflow/project-verification.js +381 -0
- package/dist/workflow/project-verification.js.map +1 -0
- package/dist/workflow/task-workflow.d.ts +37 -0
- package/dist/workflow/task-workflow.d.ts.map +1 -0
- package/dist/workflow/task-workflow.js +383 -0
- package/dist/workflow/task-workflow.js.map +1 -0
- package/dist/workflow/test-runner.d.ts +1 -0
- package/dist/workflow/test-runner.d.ts.map +1 -1
- package/dist/workflow/test-runner.js +9 -5
- package/dist/workflow/test-runner.js.map +1 -1
- package/dist/workflow/ui-designer.d.ts +82 -0
- package/dist/workflow/ui-designer.d.ts.map +1 -0
- package/dist/workflow/ui-designer.js +234 -0
- package/dist/workflow/ui-designer.js.map +1 -0
- package/dist/workflow/ui-setup.d.ts +58 -0
- package/dist/workflow/ui-setup.d.ts.map +1 -0
- package/dist/workflow/ui-setup.js +685 -0
- package/dist/workflow/ui-setup.js.map +1 -0
- package/dist/workflow/ui-verification.d.ts +114 -0
- package/dist/workflow/ui-verification.d.ts.map +1 -0
- package/dist/workflow/ui-verification.js +258 -0
- package/dist/workflow/ui-verification.js.map +1 -0
- package/dist/workflow/workflow-logger.d.ts +110 -0
- package/dist/workflow/workflow-logger.d.ts.map +1 -0
- package/dist/workflow/workflow-logger.js +267 -0
- package/dist/workflow/workflow-logger.js.map +1 -0
- package/package.json +2 -2
- package/src/adapters/claude.ts +815 -34
- package/src/adapters/gemini.ts +373 -0
- package/src/adapters/openai.ts +40 -7
- package/src/auth/claude.ts +120 -78
- package/src/auth/gemini.ts +207 -0
- package/src/auth/index.ts +28 -8
- package/src/auth/keychain.ts +95 -28
- package/src/auth/openai.ts +29 -36
- package/src/cli/index.ts +4 -7
- package/src/cli/interactive.ts +1641 -216
- package/src/config/defaults.ts +10 -2
- package/src/config/index.ts +21 -0
- package/src/config/schema.ts +7 -0
- package/src/generators/python.ts +1 -0
- package/src/generators/typescript.ts +1 -0
- package/src/state/index.ts +713 -4
- package/src/state/registry.ts +278 -0
- package/src/types/cli.ts +4 -0
- package/src/types/consensus.ts +65 -6
- package/src/types/workflow.ts +35 -0
- package/src/workflow/auto-fix.ts +340 -0
- package/src/workflow/consensus.ts +750 -16
- package/src/workflow/execution-mode.ts +673 -74
- package/src/workflow/index.ts +95 -6
- package/src/workflow/milestone-workflow.ts +576 -0
- package/src/workflow/plan-mode.ts +696 -50
- package/src/workflow/plan-storage.ts +482 -0
- package/src/workflow/project-verification.ts +471 -0
- package/src/workflow/task-workflow.ts +525 -0
- package/src/workflow/test-runner.ts +10 -5
- package/src/workflow/ui-designer.ts +337 -0
- package/src/workflow/ui-setup.ts +797 -0
- package/src/workflow/ui-verification.ts +357 -0
- package/src/workflow/workflow-logger.ts +353 -0
- package/tests/config/config.test.ts +1 -1
- package/tests/types/consensus.test.ts +3 -3
- package/tests/workflow/plan-mode.test.ts +213 -0
- package/tests/workflow/test-runner.test.ts +5 -3
package/src/workflow/index.ts
CHANGED
|
@@ -12,6 +12,8 @@ import {
|
|
|
12
12
|
getProgress,
|
|
13
13
|
resetToPhase,
|
|
14
14
|
deleteProject,
|
|
15
|
+
verifyProjectCompletion,
|
|
16
|
+
resetIncompleteProject,
|
|
15
17
|
} from '../state/index.js';
|
|
16
18
|
import {
|
|
17
19
|
runPlanMode,
|
|
@@ -25,6 +27,7 @@ import {
|
|
|
25
27
|
type ExecutionModeResult,
|
|
26
28
|
type TaskExecutionResult,
|
|
27
29
|
} from './execution-mode.js';
|
|
30
|
+
import { getWorkflowLogger } from './workflow-logger.js';
|
|
28
31
|
// Types are re-exported via export * from statements below
|
|
29
32
|
|
|
30
33
|
// Re-export submodules
|
|
@@ -32,6 +35,12 @@ export * from './consensus.js';
|
|
|
32
35
|
export * from './plan-mode.js';
|
|
33
36
|
export * from './execution-mode.js';
|
|
34
37
|
export * from './test-runner.js';
|
|
38
|
+
export * from './workflow-logger.js';
|
|
39
|
+
export * from './ui-setup.js';
|
|
40
|
+
export * from './ui-designer.js';
|
|
41
|
+
export * from './ui-verification.js';
|
|
42
|
+
export * from './project-verification.js';
|
|
43
|
+
export * from './auto-fix.js';
|
|
35
44
|
|
|
36
45
|
/**
|
|
37
46
|
* Workflow options
|
|
@@ -67,7 +76,16 @@ export async function runWorkflow(
|
|
|
67
76
|
): Promise<WorkflowResult> {
|
|
68
77
|
const { projectDir, consensusConfig, maxRetries, onProgress } = options;
|
|
69
78
|
|
|
79
|
+
// Initialize workflow logger
|
|
80
|
+
const logger = getWorkflowLogger(projectDir);
|
|
81
|
+
|
|
70
82
|
try {
|
|
83
|
+
await logger.stageStart('init', 'Starting complete workflow', {
|
|
84
|
+
projectName: spec.name,
|
|
85
|
+
idea: spec.idea.slice(0, 200),
|
|
86
|
+
language: spec.language,
|
|
87
|
+
});
|
|
88
|
+
|
|
71
89
|
// Phase 1: Plan Mode
|
|
72
90
|
onProgress?.('workflow', 'Starting Plan Mode...');
|
|
73
91
|
|
|
@@ -78,6 +96,7 @@ export async function runWorkflow(
|
|
|
78
96
|
});
|
|
79
97
|
|
|
80
98
|
if (!planResult.success) {
|
|
99
|
+
await logger.stageFailed('init', 'Workflow failed in Plan Mode', planResult.error || 'Plan mode failed');
|
|
81
100
|
return {
|
|
82
101
|
success: false,
|
|
83
102
|
state: planResult.state,
|
|
@@ -95,6 +114,15 @@ export async function runWorkflow(
|
|
|
95
114
|
onProgress,
|
|
96
115
|
});
|
|
97
116
|
|
|
117
|
+
if (executionResult.success) {
|
|
118
|
+
await logger.stageComplete('completion', 'Complete workflow finished successfully', {
|
|
119
|
+
completedTasks: executionResult.completedTasks,
|
|
120
|
+
failedTasks: executionResult.failedTasks,
|
|
121
|
+
});
|
|
122
|
+
} else {
|
|
123
|
+
await logger.stageFailed('completion', 'Workflow failed in Execution Mode', executionResult.error || 'Execution failed');
|
|
124
|
+
}
|
|
125
|
+
|
|
98
126
|
return {
|
|
99
127
|
success: executionResult.success,
|
|
100
128
|
state: executionResult.state,
|
|
@@ -105,6 +133,10 @@ export async function runWorkflow(
|
|
|
105
133
|
} catch (error) {
|
|
106
134
|
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
107
135
|
|
|
136
|
+
await logger.stageFailed('init', 'Workflow failed with exception', errorMessage, {
|
|
137
|
+
errorType: error instanceof Error ? error.constructor.name : typeof error,
|
|
138
|
+
});
|
|
139
|
+
|
|
108
140
|
return {
|
|
109
141
|
success: false,
|
|
110
142
|
state: await loadProject(projectDir).catch(() => ({} as ProjectState)),
|
|
@@ -113,18 +145,28 @@ export async function runWorkflow(
|
|
|
113
145
|
}
|
|
114
146
|
}
|
|
115
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Resume workflow options with additional context
|
|
150
|
+
*/
|
|
151
|
+
export interface ResumeWorkflowOptions extends Omit<WorkflowOptions, 'projectDir'> {
|
|
152
|
+
additionalContext?: string;
|
|
153
|
+
}
|
|
154
|
+
|
|
116
155
|
/**
|
|
117
156
|
* Resume an existing workflow from where it left off
|
|
118
157
|
*
|
|
119
158
|
* @param projectDir - Project directory
|
|
120
|
-
* @param options - Workflow options
|
|
159
|
+
* @param options - Workflow options with optional additional context
|
|
121
160
|
* @returns Workflow result
|
|
122
161
|
*/
|
|
123
162
|
export async function resumeWorkflow(
|
|
124
163
|
projectDir: string,
|
|
125
|
-
options:
|
|
164
|
+
options: ResumeWorkflowOptions
|
|
126
165
|
): Promise<WorkflowResult> {
|
|
127
|
-
const { consensusConfig, maxRetries, onProgress } = options;
|
|
166
|
+
const { consensusConfig, maxRetries, onProgress, additionalContext } = options;
|
|
167
|
+
|
|
168
|
+
// Initialize workflow logger
|
|
169
|
+
const logger = getWorkflowLogger(projectDir);
|
|
128
170
|
|
|
129
171
|
try {
|
|
130
172
|
// Check if project exists
|
|
@@ -134,13 +176,24 @@ export async function resumeWorkflow(
|
|
|
134
176
|
|
|
135
177
|
const state = await loadProject(projectDir);
|
|
136
178
|
|
|
179
|
+
await logger.info('init', 'workflow_resume', 'Resuming workflow', {
|
|
180
|
+
projectName: state.name,
|
|
181
|
+
currentPhase: state.phase,
|
|
182
|
+
currentStatus: state.status,
|
|
183
|
+
hasAdditionalContext: !!additionalContext,
|
|
184
|
+
});
|
|
185
|
+
|
|
137
186
|
// Determine which phase to resume
|
|
138
187
|
switch (state.phase) {
|
|
139
188
|
case 'plan': {
|
|
140
189
|
onProgress?.('workflow', 'Resuming Plan Mode...');
|
|
190
|
+
if (additionalContext) {
|
|
191
|
+
onProgress?.('workflow', `Additional guidance: ${additionalContext}`);
|
|
192
|
+
}
|
|
141
193
|
|
|
142
194
|
const planResult = await resumePlanMode(projectDir, {
|
|
143
195
|
consensusConfig,
|
|
196
|
+
additionalContext,
|
|
144
197
|
onProgress,
|
|
145
198
|
});
|
|
146
199
|
|
|
@@ -189,10 +242,46 @@ export async function resumeWorkflow(
|
|
|
189
242
|
}
|
|
190
243
|
|
|
191
244
|
case 'complete': {
|
|
192
|
-
|
|
245
|
+
// Verify actual completion - don't trust status alone
|
|
246
|
+
const verification = await verifyProjectCompletion(projectDir);
|
|
247
|
+
|
|
248
|
+
if (verification.isComplete) {
|
|
249
|
+
onProgress?.('workflow', 'Project is fully complete');
|
|
250
|
+
onProgress?.('workflow', verification.progress.progressSummary);
|
|
251
|
+
return {
|
|
252
|
+
success: true,
|
|
253
|
+
state,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Status says complete but work is incomplete - allow resume
|
|
258
|
+
onProgress?.(
|
|
259
|
+
'workflow',
|
|
260
|
+
`Project status is 'complete' but work is incomplete: ${verification.reason}`
|
|
261
|
+
);
|
|
262
|
+
onProgress?.(
|
|
263
|
+
'workflow',
|
|
264
|
+
`Progress: ${verification.progress.progressSummary}`
|
|
265
|
+
);
|
|
266
|
+
|
|
267
|
+
// Reset project to correct state and continue execution
|
|
268
|
+
onProgress?.('workflow', 'Resetting project status to allow resuming...');
|
|
269
|
+
const resetState = await resetIncompleteProject(projectDir);
|
|
270
|
+
|
|
271
|
+
onProgress?.('workflow', `Resuming Execution Mode (${resetState.phase} phase)...`);
|
|
272
|
+
|
|
273
|
+
const executionResult = await resumeExecutionMode({
|
|
274
|
+
projectDir,
|
|
275
|
+
maxRetries,
|
|
276
|
+
consensusConfig,
|
|
277
|
+
onProgress,
|
|
278
|
+
});
|
|
279
|
+
|
|
193
280
|
return {
|
|
194
|
-
success:
|
|
195
|
-
state,
|
|
281
|
+
success: executionResult.success,
|
|
282
|
+
state: executionResult.state,
|
|
283
|
+
executionResult,
|
|
284
|
+
error: executionResult.error,
|
|
196
285
|
};
|
|
197
286
|
}
|
|
198
287
|
|