popeye-cli 1.0.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/.env.example +25 -0
- package/.prettierrc +8 -0
- package/README.md +320 -0
- package/dist/adapters/claude.d.ts +82 -0
- package/dist/adapters/claude.d.ts.map +1 -0
- package/dist/adapters/claude.js +230 -0
- package/dist/adapters/claude.js.map +1 -0
- package/dist/adapters/openai.d.ts +48 -0
- package/dist/adapters/openai.d.ts.map +1 -0
- package/dist/adapters/openai.js +257 -0
- package/dist/adapters/openai.js.map +1 -0
- package/dist/auth/claude.d.ts +44 -0
- package/dist/auth/claude.d.ts.map +1 -0
- package/dist/auth/claude.js +139 -0
- package/dist/auth/claude.js.map +1 -0
- package/dist/auth/index.d.ts +61 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +141 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/keychain.d.ts +66 -0
- package/dist/auth/keychain.d.ts.map +1 -0
- package/dist/auth/keychain.js +125 -0
- package/dist/auth/keychain.js.map +1 -0
- package/dist/auth/openai-entry.d.ts +9 -0
- package/dist/auth/openai-entry.d.ts.map +1 -0
- package/dist/auth/openai-entry.js +410 -0
- package/dist/auth/openai-entry.js.map +1 -0
- package/dist/auth/openai.d.ts +71 -0
- package/dist/auth/openai.d.ts.map +1 -0
- package/dist/auth/openai.js +212 -0
- package/dist/auth/openai.js.map +1 -0
- package/dist/auth/server.d.ts +32 -0
- package/dist/auth/server.d.ts.map +1 -0
- package/dist/auth/server.js +213 -0
- package/dist/auth/server.js.map +1 -0
- package/dist/cli/commands/auth.d.ts +10 -0
- package/dist/cli/commands/auth.d.ts.map +1 -0
- package/dist/cli/commands/auth.js +162 -0
- package/dist/cli/commands/auth.js.map +1 -0
- package/dist/cli/commands/config.d.ts +10 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +215 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/create.d.ts +10 -0
- package/dist/cli/commands/create.d.ts.map +1 -0
- package/dist/cli/commands/create.js +240 -0
- package/dist/cli/commands/create.js.map +1 -0
- package/dist/cli/commands/index.d.ts +10 -0
- package/dist/cli/commands/index.d.ts.map +1 -0
- package/dist/cli/commands/index.js +10 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/resume.d.ts +18 -0
- package/dist/cli/commands/resume.d.ts.map +1 -0
- package/dist/cli/commands/resume.js +241 -0
- package/dist/cli/commands/resume.js.map +1 -0
- package/dist/cli/commands/status.d.ts +18 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +154 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/index.d.ts +17 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +71 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/interactive.d.ts +9 -0
- package/dist/cli/interactive.d.ts.map +1 -0
- package/dist/cli/interactive.js +330 -0
- package/dist/cli/interactive.js.map +1 -0
- package/dist/cli/output.d.ts +182 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +355 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/config/defaults.d.ts +57 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +103 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +138 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +244 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/schema.d.ts +220 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +141 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/generators/index.d.ts +101 -0
- package/dist/generators/index.d.ts.map +1 -0
- package/dist/generators/index.js +200 -0
- package/dist/generators/index.js.map +1 -0
- package/dist/generators/python.d.ts +48 -0
- package/dist/generators/python.d.ts.map +1 -0
- package/dist/generators/python.js +262 -0
- package/dist/generators/python.js.map +1 -0
- package/dist/generators/templates/index.d.ts +6 -0
- package/dist/generators/templates/index.d.ts.map +1 -0
- package/dist/generators/templates/index.js +6 -0
- package/dist/generators/templates/index.js.map +1 -0
- package/dist/generators/templates/python.d.ts +53 -0
- package/dist/generators/templates/python.d.ts.map +1 -0
- package/dist/generators/templates/python.js +454 -0
- package/dist/generators/templates/python.js.map +1 -0
- package/dist/generators/templates/typescript.d.ts +53 -0
- package/dist/generators/templates/typescript.d.ts.map +1 -0
- package/dist/generators/templates/typescript.js +394 -0
- package/dist/generators/templates/typescript.js.map +1 -0
- package/dist/generators/typescript.d.ts +64 -0
- package/dist/generators/typescript.d.ts.map +1 -0
- package/dist/generators/typescript.js +271 -0
- package/dist/generators/typescript.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/state/index.d.ts +168 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +338 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/persistence.d.ts +91 -0
- package/dist/state/persistence.d.ts.map +1 -0
- package/dist/state/persistence.js +201 -0
- package/dist/state/persistence.js.map +1 -0
- package/dist/types/cli.d.ts +132 -0
- package/dist/types/cli.d.ts.map +1 -0
- package/dist/types/cli.js +17 -0
- package/dist/types/cli.js.map +1 -0
- package/dist/types/consensus.d.ts +111 -0
- package/dist/types/consensus.d.ts.map +1 -0
- package/dist/types/consensus.js +29 -0
- package/dist/types/consensus.js.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +13 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/project.d.ts +73 -0
- package/dist/types/project.d.ts.map +1 -0
- package/dist/types/project.js +55 -0
- package/dist/types/project.js.map +1 -0
- package/dist/types/workflow.d.ts +236 -0
- package/dist/types/workflow.d.ts.map +1 -0
- package/dist/types/workflow.js +74 -0
- package/dist/types/workflow.js.map +1 -0
- package/dist/workflow/consensus.d.ts +89 -0
- package/dist/workflow/consensus.d.ts.map +1 -0
- package/dist/workflow/consensus.js +220 -0
- package/dist/workflow/consensus.js.map +1 -0
- package/dist/workflow/execution-mode.d.ts +82 -0
- package/dist/workflow/execution-mode.d.ts.map +1 -0
- package/dist/workflow/execution-mode.js +346 -0
- package/dist/workflow/execution-mode.js.map +1 -0
- package/dist/workflow/index.d.ts +110 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/index.js +283 -0
- package/dist/workflow/index.js.map +1 -0
- package/dist/workflow/plan-mode.d.ts +83 -0
- package/dist/workflow/plan-mode.d.ts.map +1 -0
- package/dist/workflow/plan-mode.js +241 -0
- package/dist/workflow/plan-mode.js.map +1 -0
- package/dist/workflow/test-runner.d.ts +87 -0
- package/dist/workflow/test-runner.d.ts.map +1 -0
- package/dist/workflow/test-runner.js +273 -0
- package/dist/workflow/test-runner.js.map +1 -0
- package/eslint.config.js +25 -0
- package/package.json +66 -0
- package/src/adapters/claude.ts +298 -0
- package/src/adapters/openai.ts +300 -0
- package/src/auth/claude.ts +166 -0
- package/src/auth/index.ts +171 -0
- package/src/auth/keychain.ts +138 -0
- package/src/auth/openai-entry.ts +410 -0
- package/src/auth/openai.ts +260 -0
- package/src/auth/server.ts +252 -0
- package/src/cli/commands/auth.ts +194 -0
- package/src/cli/commands/config.ts +241 -0
- package/src/cli/commands/create.ts +308 -0
- package/src/cli/commands/index.ts +10 -0
- package/src/cli/commands/resume.ts +304 -0
- package/src/cli/commands/status.ts +189 -0
- package/src/cli/index.ts +90 -0
- package/src/cli/interactive.ts +418 -0
- package/src/cli/output.ts +410 -0
- package/src/config/defaults.ts +114 -0
- package/src/config/index.ts +315 -0
- package/src/config/schema.ts +164 -0
- package/src/generators/index.ts +251 -0
- package/src/generators/python.ts +318 -0
- package/src/generators/templates/index.ts +6 -0
- package/src/generators/templates/python.ts +465 -0
- package/src/generators/templates/typescript.ts +417 -0
- package/src/generators/typescript.ts +340 -0
- package/src/index.ts +13 -0
- package/src/state/index.ts +454 -0
- package/src/state/persistence.ts +230 -0
- package/src/types/cli.ts +146 -0
- package/src/types/consensus.ts +116 -0
- package/src/types/index.ts +64 -0
- package/src/types/project.ts +85 -0
- package/src/types/workflow.ts +149 -0
- package/src/workflow/consensus.ts +299 -0
- package/src/workflow/execution-mode.ts +517 -0
- package/src/workflow/index.ts +396 -0
- package/src/workflow/plan-mode.ts +356 -0
- package/src/workflow/test-runner.ts +345 -0
- package/tests/adapters/openai.test.ts +145 -0
- package/tests/config/config.test.ts +208 -0
- package/tests/generators/generators.test.ts +185 -0
- package/tests/types/consensus.test.ts +152 -0
- package/tests/types/project.test.ts +134 -0
- package/tests/workflow/consensus.test.ts +221 -0
- package/tests/workflow/test-runner.test.ts +214 -0
- package/tsconfig.json +25 -0
- package/vitest.config.ts +22 -0
package/src/types/cli.ts
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI-related type definitions
|
|
3
|
+
* Defines command options, interactive mode state, and output formats
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { OutputLanguage, OpenAIModel } from './project.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Global CLI options available on all commands
|
|
10
|
+
*/
|
|
11
|
+
export interface GlobalOptions {
|
|
12
|
+
verbose: boolean;
|
|
13
|
+
quiet: boolean;
|
|
14
|
+
noColor: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Options for the `create` command
|
|
19
|
+
*/
|
|
20
|
+
export interface CreateOptions extends GlobalOptions {
|
|
21
|
+
language: OutputLanguage;
|
|
22
|
+
openaiModel: OpenAIModel;
|
|
23
|
+
output?: string;
|
|
24
|
+
name?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Options for the `resume` command
|
|
29
|
+
*/
|
|
30
|
+
export interface ResumeOptions extends GlobalOptions {
|
|
31
|
+
projectPath: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Options for the `status` command
|
|
36
|
+
*/
|
|
37
|
+
export interface StatusOptions extends GlobalOptions {
|
|
38
|
+
projectPath?: string;
|
|
39
|
+
json: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Options for the `auth` command
|
|
44
|
+
*/
|
|
45
|
+
export interface AuthOptions extends GlobalOptions {
|
|
46
|
+
service?: 'claude' | 'openai' | 'all';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Options for the `config` command
|
|
51
|
+
*/
|
|
52
|
+
export interface ConfigOptions extends GlobalOptions {
|
|
53
|
+
global: boolean;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Authentication status for display
|
|
58
|
+
*/
|
|
59
|
+
export interface AuthStatus {
|
|
60
|
+
claude: {
|
|
61
|
+
authenticated: boolean;
|
|
62
|
+
user?: string;
|
|
63
|
+
expires?: string;
|
|
64
|
+
};
|
|
65
|
+
openai: {
|
|
66
|
+
authenticated: boolean;
|
|
67
|
+
keyLastFour?: string;
|
|
68
|
+
modelAccess?: string[];
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Interactive mode session state
|
|
74
|
+
*/
|
|
75
|
+
export interface InteractiveSession {
|
|
76
|
+
connected: boolean;
|
|
77
|
+
language: OutputLanguage;
|
|
78
|
+
openaiModel: OpenAIModel;
|
|
79
|
+
currentProject?: string;
|
|
80
|
+
history: string[];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Slash command definition for interactive mode
|
|
85
|
+
*/
|
|
86
|
+
export interface SlashCommand {
|
|
87
|
+
name: string;
|
|
88
|
+
aliases: string[];
|
|
89
|
+
description: string;
|
|
90
|
+
usage: string;
|
|
91
|
+
handler: (args: string[], session: InteractiveSession) => Promise<void>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Progress display information
|
|
96
|
+
*/
|
|
97
|
+
export interface ProgressInfo {
|
|
98
|
+
phase: string;
|
|
99
|
+
milestone?: number;
|
|
100
|
+
totalMilestones?: number;
|
|
101
|
+
task?: number;
|
|
102
|
+
totalTasks?: number;
|
|
103
|
+
consensusIteration?: number;
|
|
104
|
+
consensusScore?: number;
|
|
105
|
+
status: 'pending' | 'running' | 'success' | 'error';
|
|
106
|
+
message: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Console output styles/colors
|
|
111
|
+
*/
|
|
112
|
+
export interface OutputStyles {
|
|
113
|
+
primary: string;
|
|
114
|
+
secondary: string;
|
|
115
|
+
success: string;
|
|
116
|
+
warning: string;
|
|
117
|
+
error: string;
|
|
118
|
+
info: string;
|
|
119
|
+
dim: string;
|
|
120
|
+
bold: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Banner configuration
|
|
125
|
+
*/
|
|
126
|
+
export interface BannerConfig {
|
|
127
|
+
version: string;
|
|
128
|
+
language: OutputLanguage;
|
|
129
|
+
openaiModel: OpenAIModel;
|
|
130
|
+
sessionId?: string;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* CLI exit codes
|
|
135
|
+
*/
|
|
136
|
+
export const EXIT_CODES = {
|
|
137
|
+
SUCCESS: 0,
|
|
138
|
+
ERROR: 1,
|
|
139
|
+
AUTH_REQUIRED: 2,
|
|
140
|
+
INVALID_INPUT: 3,
|
|
141
|
+
CONSENSUS_FAILED: 4,
|
|
142
|
+
TEST_FAILED: 5,
|
|
143
|
+
INTERRUPTED: 130,
|
|
144
|
+
} as const;
|
|
145
|
+
|
|
146
|
+
export type ExitCode = (typeof EXIT_CODES)[keyof typeof EXIT_CODES];
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consensus-related type definitions
|
|
3
|
+
* Defines consensus results, iterations, and configuration
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import type { OpenAIModel } from './project.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Result of a consensus review from OpenAI
|
|
11
|
+
*/
|
|
12
|
+
export interface ConsensusResult {
|
|
13
|
+
score: number;
|
|
14
|
+
analysis: string;
|
|
15
|
+
strengths: string[];
|
|
16
|
+
concerns: string[];
|
|
17
|
+
recommendations: string[];
|
|
18
|
+
approved: boolean;
|
|
19
|
+
rawResponse: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Single consensus iteration record
|
|
24
|
+
*/
|
|
25
|
+
export interface ConsensusIteration {
|
|
26
|
+
iteration: number;
|
|
27
|
+
plan: string;
|
|
28
|
+
result: ConsensusResult;
|
|
29
|
+
timestamp: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Configuration for consensus process
|
|
34
|
+
*/
|
|
35
|
+
export interface ConsensusConfig {
|
|
36
|
+
threshold: number;
|
|
37
|
+
maxIterations: number;
|
|
38
|
+
openaiKey: string;
|
|
39
|
+
openaiModel: OpenAIModel;
|
|
40
|
+
escalationAction: 'pause' | 'continue' | 'abort';
|
|
41
|
+
temperature: number;
|
|
42
|
+
maxTokens: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Default consensus configuration
|
|
47
|
+
*/
|
|
48
|
+
export const DEFAULT_CONSENSUS_CONFIG: Omit<ConsensusConfig, 'openaiKey'> = {
|
|
49
|
+
threshold: 95,
|
|
50
|
+
maxIterations: 5,
|
|
51
|
+
openaiModel: 'gpt-4o',
|
|
52
|
+
escalationAction: 'pause',
|
|
53
|
+
temperature: 0.3,
|
|
54
|
+
maxTokens: 4096,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Zod schema for consensus config validation
|
|
59
|
+
*/
|
|
60
|
+
export const ConsensusConfigSchema = z.object({
|
|
61
|
+
threshold: z.number().min(0).max(100).default(95),
|
|
62
|
+
maxIterations: z.number().min(1).max(10).default(5),
|
|
63
|
+
openaiKey: z.string().min(1),
|
|
64
|
+
openaiModel: z.enum(['gpt-4o', 'gpt-4o-mini', 'gpt-4-turbo', 'o1-preview', 'o1-mini']),
|
|
65
|
+
escalationAction: z.enum(['pause', 'continue', 'abort']).default('pause'),
|
|
66
|
+
temperature: z.number().min(0).max(2).default(0.3),
|
|
67
|
+
maxTokens: z.number().min(100).max(32000).default(4096),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Plan document structure for consensus review
|
|
72
|
+
*/
|
|
73
|
+
export interface PlanDocument {
|
|
74
|
+
milestone: number;
|
|
75
|
+
title: string;
|
|
76
|
+
background: string;
|
|
77
|
+
goals: string[];
|
|
78
|
+
useCases: string[];
|
|
79
|
+
risks: string[];
|
|
80
|
+
tasks: {
|
|
81
|
+
id: string;
|
|
82
|
+
description: string;
|
|
83
|
+
acceptanceCriteria: string[];
|
|
84
|
+
dependencies: string[];
|
|
85
|
+
}[];
|
|
86
|
+
testPlan: {
|
|
87
|
+
id: string;
|
|
88
|
+
type: 'unit' | 'integration' | 'e2e';
|
|
89
|
+
description: string;
|
|
90
|
+
setup: string;
|
|
91
|
+
steps: string[];
|
|
92
|
+
expectedResult: string;
|
|
93
|
+
}[];
|
|
94
|
+
summary: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Consensus request payload
|
|
99
|
+
*/
|
|
100
|
+
export interface ConsensusRequest {
|
|
101
|
+
plan: string;
|
|
102
|
+
context: string;
|
|
103
|
+
previousFeedback?: string;
|
|
104
|
+
iteration: number;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Escalation details when consensus cannot be reached
|
|
109
|
+
*/
|
|
110
|
+
export interface EscalationDetails {
|
|
111
|
+
reason: string;
|
|
112
|
+
iterations: ConsensusIteration[];
|
|
113
|
+
lastScore: number;
|
|
114
|
+
unresolvable_concerns: string[];
|
|
115
|
+
suggestedActions: string[];
|
|
116
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central type exports for Popeye CLI
|
|
3
|
+
* Re-exports all types from subdirectories for easy importing
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Project types
|
|
7
|
+
export {
|
|
8
|
+
OutputLanguageSchema,
|
|
9
|
+
OpenAIModelSchema,
|
|
10
|
+
ProjectSpecSchema,
|
|
11
|
+
OPENAI_MODELS,
|
|
12
|
+
type OutputLanguage,
|
|
13
|
+
type OpenAIModel,
|
|
14
|
+
type ProjectSpec,
|
|
15
|
+
type GeneratedProject,
|
|
16
|
+
type GenerationOptions,
|
|
17
|
+
} from './project.js';
|
|
18
|
+
|
|
19
|
+
// Workflow types
|
|
20
|
+
export {
|
|
21
|
+
WorkflowPhaseSchema,
|
|
22
|
+
TaskStatusSchema,
|
|
23
|
+
ProjectStateSchema,
|
|
24
|
+
ProjectStatusSchema,
|
|
25
|
+
TaskSchema,
|
|
26
|
+
MilestoneSchema,
|
|
27
|
+
type WorkflowPhase,
|
|
28
|
+
type ProjectStatus,
|
|
29
|
+
type TaskStatus,
|
|
30
|
+
type Task,
|
|
31
|
+
type Milestone,
|
|
32
|
+
type ProjectState,
|
|
33
|
+
type WorkflowEvent,
|
|
34
|
+
} from './workflow.js';
|
|
35
|
+
|
|
36
|
+
// Consensus types
|
|
37
|
+
export {
|
|
38
|
+
ConsensusConfigSchema,
|
|
39
|
+
DEFAULT_CONSENSUS_CONFIG,
|
|
40
|
+
type ConsensusResult,
|
|
41
|
+
type ConsensusIteration,
|
|
42
|
+
type ConsensusConfig,
|
|
43
|
+
type PlanDocument,
|
|
44
|
+
type ConsensusRequest,
|
|
45
|
+
type EscalationDetails,
|
|
46
|
+
} from './consensus.js';
|
|
47
|
+
|
|
48
|
+
// CLI types
|
|
49
|
+
export {
|
|
50
|
+
EXIT_CODES,
|
|
51
|
+
type GlobalOptions,
|
|
52
|
+
type CreateOptions,
|
|
53
|
+
type ResumeOptions,
|
|
54
|
+
type StatusOptions,
|
|
55
|
+
type AuthOptions,
|
|
56
|
+
type ConfigOptions,
|
|
57
|
+
type AuthStatus,
|
|
58
|
+
type InteractiveSession,
|
|
59
|
+
type SlashCommand,
|
|
60
|
+
type ProgressInfo,
|
|
61
|
+
type OutputStyles,
|
|
62
|
+
type BannerConfig,
|
|
63
|
+
type ExitCode,
|
|
64
|
+
} from './cli.js';
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project-related type definitions
|
|
3
|
+
* Defines output languages, models, and project specifications
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Supported output languages for generated projects
|
|
10
|
+
*/
|
|
11
|
+
export const OutputLanguageSchema = z.enum(['python', 'typescript']);
|
|
12
|
+
export type OutputLanguage = z.infer<typeof OutputLanguageSchema>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Supported OpenAI models for consensus reviews
|
|
16
|
+
*/
|
|
17
|
+
export const OpenAIModelSchema = z.enum([
|
|
18
|
+
'gpt-4o',
|
|
19
|
+
'gpt-4o-mini',
|
|
20
|
+
'gpt-4-turbo',
|
|
21
|
+
'o1-preview',
|
|
22
|
+
'o1-mini',
|
|
23
|
+
]);
|
|
24
|
+
export type OpenAIModel = z.infer<typeof OpenAIModelSchema>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Project specification provided by user
|
|
28
|
+
*/
|
|
29
|
+
export const ProjectSpecSchema = z.object({
|
|
30
|
+
idea: z.string().min(10, 'Idea must be at least 10 characters'),
|
|
31
|
+
name: z.string().optional(),
|
|
32
|
+
language: OutputLanguageSchema,
|
|
33
|
+
openaiModel: OpenAIModelSchema,
|
|
34
|
+
outputDir: z.string().optional(),
|
|
35
|
+
});
|
|
36
|
+
export type ProjectSpec = z.infer<typeof ProjectSpecSchema>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Generated project information
|
|
40
|
+
*/
|
|
41
|
+
export interface GeneratedProject {
|
|
42
|
+
name: string;
|
|
43
|
+
path: string;
|
|
44
|
+
language: OutputLanguage;
|
|
45
|
+
files: string[];
|
|
46
|
+
testsPath: string;
|
|
47
|
+
dockerComposePath: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Project generation options
|
|
52
|
+
*/
|
|
53
|
+
export interface GenerationOptions {
|
|
54
|
+
includeDocker: boolean;
|
|
55
|
+
includeTests: boolean;
|
|
56
|
+
includeDocs: boolean;
|
|
57
|
+
packageManager: 'pip' | 'poetry' | 'npm' | 'pnpm';
|
|
58
|
+
testFramework: 'pytest' | 'jest' | 'vitest';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Available OpenAI models with descriptions
|
|
63
|
+
*/
|
|
64
|
+
export const OPENAI_MODELS: Record<OpenAIModel, { description: string; recommended: string }> = {
|
|
65
|
+
'gpt-4o': {
|
|
66
|
+
description: 'Most capable, best reasoning',
|
|
67
|
+
recommended: 'Complex projects',
|
|
68
|
+
},
|
|
69
|
+
'gpt-4o-mini': {
|
|
70
|
+
description: 'Fast, cost-effective',
|
|
71
|
+
recommended: 'Simple projects',
|
|
72
|
+
},
|
|
73
|
+
'gpt-4-turbo': {
|
|
74
|
+
description: 'High capability, faster',
|
|
75
|
+
recommended: 'Medium complexity',
|
|
76
|
+
},
|
|
77
|
+
'o1-preview': {
|
|
78
|
+
description: 'Advanced reasoning',
|
|
79
|
+
recommended: 'Architectural decisions',
|
|
80
|
+
},
|
|
81
|
+
'o1-mini': {
|
|
82
|
+
description: 'Efficient reasoning',
|
|
83
|
+
recommended: 'Code review',
|
|
84
|
+
},
|
|
85
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow-related type definitions
|
|
3
|
+
* Defines workflow modes, tasks, milestones, and state transitions
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import type { OutputLanguage, OpenAIModel } from './project.js';
|
|
8
|
+
import type { ConsensusIteration } from './consensus.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Workflow phases
|
|
12
|
+
*/
|
|
13
|
+
export const WorkflowPhaseSchema = z.enum(['plan', 'execution', 'complete']);
|
|
14
|
+
export type WorkflowPhase = z.infer<typeof WorkflowPhaseSchema>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Project status
|
|
18
|
+
*/
|
|
19
|
+
export const ProjectStatusSchema = z.enum(['pending', 'in-progress', 'complete', 'failed']);
|
|
20
|
+
export type ProjectStatus = z.infer<typeof ProjectStatusSchema>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Status of a task or milestone
|
|
24
|
+
*/
|
|
25
|
+
export const TaskStatusSchema = z.enum(['pending', 'in-progress', 'complete', 'failed']);
|
|
26
|
+
export type TaskStatus = z.infer<typeof TaskStatusSchema>;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Individual task within a milestone
|
|
30
|
+
*/
|
|
31
|
+
export interface Task {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
description: string;
|
|
35
|
+
status: TaskStatus;
|
|
36
|
+
testsPassed?: boolean;
|
|
37
|
+
testPlan?: string;
|
|
38
|
+
error?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Zod schema for Task
|
|
43
|
+
*/
|
|
44
|
+
export const TaskSchema = z.object({
|
|
45
|
+
id: z.string(),
|
|
46
|
+
name: z.string(),
|
|
47
|
+
description: z.string(),
|
|
48
|
+
status: TaskStatusSchema,
|
|
49
|
+
testsPassed: z.boolean().optional(),
|
|
50
|
+
testPlan: z.string().optional(),
|
|
51
|
+
error: z.string().optional(),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Milestone containing multiple tasks
|
|
56
|
+
*/
|
|
57
|
+
export interface Milestone {
|
|
58
|
+
id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
description: string;
|
|
61
|
+
status: TaskStatus;
|
|
62
|
+
tasks: Task[];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Zod schema for Milestone
|
|
67
|
+
*/
|
|
68
|
+
export const MilestoneSchema = z.object({
|
|
69
|
+
id: z.string(),
|
|
70
|
+
name: z.string(),
|
|
71
|
+
description: z.string(),
|
|
72
|
+
status: TaskStatusSchema,
|
|
73
|
+
tasks: z.array(TaskSchema),
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Complete project state for persistence
|
|
78
|
+
*/
|
|
79
|
+
export interface ProjectState {
|
|
80
|
+
id: string;
|
|
81
|
+
name: string;
|
|
82
|
+
idea: string;
|
|
83
|
+
language: OutputLanguage;
|
|
84
|
+
openaiModel: OpenAIModel;
|
|
85
|
+
phase: WorkflowPhase;
|
|
86
|
+
status: ProjectStatus;
|
|
87
|
+
specification?: string;
|
|
88
|
+
plan?: string;
|
|
89
|
+
milestones: Milestone[];
|
|
90
|
+
currentMilestone: string | null;
|
|
91
|
+
currentTask: string | null;
|
|
92
|
+
consensusHistory: ConsensusIteration[];
|
|
93
|
+
error?: string;
|
|
94
|
+
createdAt: string;
|
|
95
|
+
updatedAt: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Zod schema for project state validation
|
|
100
|
+
*/
|
|
101
|
+
export const ProjectStateSchema = z.object({
|
|
102
|
+
id: z.string(),
|
|
103
|
+
name: z.string(),
|
|
104
|
+
idea: z.string(),
|
|
105
|
+
language: z.enum(['python', 'typescript']),
|
|
106
|
+
openaiModel: z.enum(['gpt-4o', 'gpt-4o-mini', 'gpt-4-turbo', 'o1-preview', 'o1-mini']),
|
|
107
|
+
phase: WorkflowPhaseSchema,
|
|
108
|
+
status: ProjectStatusSchema,
|
|
109
|
+
specification: z.string().optional(),
|
|
110
|
+
plan: z.string().optional(),
|
|
111
|
+
milestones: z.array(MilestoneSchema),
|
|
112
|
+
currentMilestone: z.string().nullable(),
|
|
113
|
+
currentTask: z.string().nullable(),
|
|
114
|
+
consensusHistory: z.array(
|
|
115
|
+
z.object({
|
|
116
|
+
iteration: z.number(),
|
|
117
|
+
plan: z.string(),
|
|
118
|
+
result: z.object({
|
|
119
|
+
score: z.number(),
|
|
120
|
+
analysis: z.string(),
|
|
121
|
+
strengths: z.array(z.string()),
|
|
122
|
+
concerns: z.array(z.string()),
|
|
123
|
+
recommendations: z.array(z.string()),
|
|
124
|
+
approved: z.boolean(),
|
|
125
|
+
rawResponse: z.string(),
|
|
126
|
+
}),
|
|
127
|
+
timestamp: z.string(),
|
|
128
|
+
})
|
|
129
|
+
),
|
|
130
|
+
error: z.string().optional(),
|
|
131
|
+
createdAt: z.string(),
|
|
132
|
+
updatedAt: z.string(),
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Workflow event types for state machine
|
|
137
|
+
*/
|
|
138
|
+
export type WorkflowEvent =
|
|
139
|
+
| { type: 'START_PLANNING' }
|
|
140
|
+
| { type: 'CONSENSUS_APPROVED'; score: number }
|
|
141
|
+
| { type: 'CONSENSUS_REJECTED'; score: number; feedback: string }
|
|
142
|
+
| { type: 'START_EXECUTION' }
|
|
143
|
+
| { type: 'TASK_COMPLETED'; taskId: string }
|
|
144
|
+
| { type: 'TASK_FAILED'; taskId: string; error: string }
|
|
145
|
+
| { type: 'TEST_PASSED' }
|
|
146
|
+
| { type: 'TEST_FAILED'; error: string }
|
|
147
|
+
| { type: 'MILESTONE_COMPLETED'; milestoneId: string }
|
|
148
|
+
| { type: 'PROJECT_COMPLETED' }
|
|
149
|
+
| { type: 'ESCALATE_TO_USER'; reason: string };
|