@codebakers/cli 3.7.2 → 3.8.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/dist/lib/engineering-state.d.ts +269 -0
- package/dist/lib/engineering-state.js +605 -0
- package/dist/mcp/engineering-tools.d.ts +396 -0
- package/dist/mcp/engineering-tools.js +808 -0
- package/dist/mcp/server.js +15 -0
- package/package.json +1 -1
- package/src/lib/engineering-state.ts +823 -0
- package/src/mcp/engineering-tools.ts +977 -0
- package/src/mcp/server.ts +16 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ENGINEERING STATE PERSISTENCE
|
|
3
|
+
*
|
|
4
|
+
* Manages the .codebakers/ folder structure for local state persistence.
|
|
5
|
+
* This keeps the project state in sync between local and server.
|
|
6
|
+
*
|
|
7
|
+
* Folder structure:
|
|
8
|
+
* .codebakers/
|
|
9
|
+
* project.json - Main project configuration and scope
|
|
10
|
+
* state.json - Current build state (phase, progress, etc.)
|
|
11
|
+
* graph.json - Dependency graph
|
|
12
|
+
* decisions/ - Agent decision log
|
|
13
|
+
* 001-scoping.json
|
|
14
|
+
* 002-architecture.json
|
|
15
|
+
* artifacts/ - Generated documents
|
|
16
|
+
* prd.md
|
|
17
|
+
* tech-spec.md
|
|
18
|
+
* api-docs.md
|
|
19
|
+
* messages/ - Agent communication log
|
|
20
|
+
* session-xxx.json
|
|
21
|
+
* snapshots/ - Rollback points
|
|
22
|
+
* snap-001/
|
|
23
|
+
*/
|
|
24
|
+
export interface ProjectConfig {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
projectHash: string;
|
|
29
|
+
scope: ProjectScope;
|
|
30
|
+
stack: StackConfig;
|
|
31
|
+
createdAt: string;
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
}
|
|
34
|
+
export interface ProjectScope {
|
|
35
|
+
targetAudience: 'consumers' | 'businesses' | 'internal' | 'developers';
|
|
36
|
+
isFullBusiness: boolean;
|
|
37
|
+
needsMarketing: boolean;
|
|
38
|
+
needsAnalytics: boolean;
|
|
39
|
+
needsTeamFeatures: boolean;
|
|
40
|
+
needsAdminDashboard: boolean;
|
|
41
|
+
platforms: ('web' | 'mobile' | 'api')[];
|
|
42
|
+
hasRealtime: boolean;
|
|
43
|
+
hasPayments: boolean;
|
|
44
|
+
hasAuth: boolean;
|
|
45
|
+
hasFileUploads: boolean;
|
|
46
|
+
compliance: {
|
|
47
|
+
hipaa: boolean;
|
|
48
|
+
pci: boolean;
|
|
49
|
+
gdpr: boolean;
|
|
50
|
+
soc2: boolean;
|
|
51
|
+
coppa: boolean;
|
|
52
|
+
};
|
|
53
|
+
expectedUsers: 'small' | 'medium' | 'large' | 'enterprise';
|
|
54
|
+
launchTimeline: 'asap' | 'weeks' | 'months' | 'flexible';
|
|
55
|
+
}
|
|
56
|
+
export interface StackConfig {
|
|
57
|
+
framework: string;
|
|
58
|
+
database: string;
|
|
59
|
+
orm: string;
|
|
60
|
+
auth: string;
|
|
61
|
+
ui: string;
|
|
62
|
+
payments?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface BuildState {
|
|
65
|
+
sessionId: string | null;
|
|
66
|
+
currentPhase: EngineeringPhase;
|
|
67
|
+
currentAgent: AgentRole;
|
|
68
|
+
isRunning: boolean;
|
|
69
|
+
gates: Record<EngineeringPhase, GateStatus>;
|
|
70
|
+
overallProgress: number;
|
|
71
|
+
lastActivity: string;
|
|
72
|
+
pendingApprovals: string[];
|
|
73
|
+
blockers: string[];
|
|
74
|
+
}
|
|
75
|
+
export type EngineeringPhase = 'scoping' | 'requirements' | 'architecture' | 'design_review' | 'implementation' | 'code_review' | 'testing' | 'security_review' | 'documentation' | 'staging' | 'launch';
|
|
76
|
+
export type AgentRole = 'orchestrator' | 'pm' | 'architect' | 'engineer' | 'qa' | 'security' | 'documentation' | 'devops';
|
|
77
|
+
export interface GateStatus {
|
|
78
|
+
status: 'pending' | 'in_progress' | 'passed' | 'failed' | 'skipped';
|
|
79
|
+
passedAt?: string;
|
|
80
|
+
failedReason?: string;
|
|
81
|
+
approvedBy?: string;
|
|
82
|
+
artifacts?: string[];
|
|
83
|
+
}
|
|
84
|
+
export interface DependencyNode {
|
|
85
|
+
id: string;
|
|
86
|
+
type: 'schema' | 'api' | 'component' | 'service' | 'page' | 'util' | 'config';
|
|
87
|
+
name: string;
|
|
88
|
+
filePath: string;
|
|
89
|
+
createdAt: string;
|
|
90
|
+
modifiedAt: string;
|
|
91
|
+
createdByFeature?: string;
|
|
92
|
+
}
|
|
93
|
+
export interface DependencyEdge {
|
|
94
|
+
id: string;
|
|
95
|
+
sourceId: string;
|
|
96
|
+
targetId: string;
|
|
97
|
+
type: 'import' | 'api-call' | 'db-query' | 'event' | 'config';
|
|
98
|
+
}
|
|
99
|
+
export interface DependencyGraph {
|
|
100
|
+
nodes: DependencyNode[];
|
|
101
|
+
edges: DependencyEdge[];
|
|
102
|
+
}
|
|
103
|
+
export interface AgentDecision {
|
|
104
|
+
id: string;
|
|
105
|
+
timestamp: string;
|
|
106
|
+
agent: AgentRole;
|
|
107
|
+
phase: EngineeringPhase;
|
|
108
|
+
decision: string;
|
|
109
|
+
reasoning: string;
|
|
110
|
+
alternatives: string[];
|
|
111
|
+
confidence: number;
|
|
112
|
+
reversible: boolean;
|
|
113
|
+
impact: 'low' | 'medium' | 'high' | 'critical';
|
|
114
|
+
}
|
|
115
|
+
export interface AgentMessage {
|
|
116
|
+
id: string;
|
|
117
|
+
timestamp: string;
|
|
118
|
+
fromAgent: AgentRole | 'user';
|
|
119
|
+
toAgent: AgentRole | 'user' | 'all';
|
|
120
|
+
messageType: 'request' | 'response' | 'review' | 'approval' | 'rejection' | 'question' | 'update' | 'handoff';
|
|
121
|
+
content: string;
|
|
122
|
+
metadata?: Record<string, unknown>;
|
|
123
|
+
}
|
|
124
|
+
export declare class EngineeringStateManager {
|
|
125
|
+
private cwd;
|
|
126
|
+
private stateDir;
|
|
127
|
+
constructor(cwd?: string);
|
|
128
|
+
/**
|
|
129
|
+
* Initialize the .codebakers folder structure
|
|
130
|
+
*/
|
|
131
|
+
init(): void;
|
|
132
|
+
/**
|
|
133
|
+
* Check if project is initialized
|
|
134
|
+
*/
|
|
135
|
+
isInitialized(): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Get project hash from current directory
|
|
138
|
+
*/
|
|
139
|
+
getProjectHash(): string;
|
|
140
|
+
/**
|
|
141
|
+
* Create a new project configuration
|
|
142
|
+
*/
|
|
143
|
+
createProject(name: string, description: string, scope?: Partial<ProjectScope>): ProjectConfig;
|
|
144
|
+
/**
|
|
145
|
+
* Get project configuration
|
|
146
|
+
*/
|
|
147
|
+
getProject(): ProjectConfig | null;
|
|
148
|
+
/**
|
|
149
|
+
* Save project configuration
|
|
150
|
+
*/
|
|
151
|
+
saveProject(project: ProjectConfig): void;
|
|
152
|
+
/**
|
|
153
|
+
* Update project scope
|
|
154
|
+
*/
|
|
155
|
+
updateScope(scope: Partial<ProjectScope>): ProjectConfig | null;
|
|
156
|
+
/**
|
|
157
|
+
* Initialize build state
|
|
158
|
+
*/
|
|
159
|
+
private initializeState;
|
|
160
|
+
/**
|
|
161
|
+
* Get build state
|
|
162
|
+
*/
|
|
163
|
+
getState(): BuildState | null;
|
|
164
|
+
/**
|
|
165
|
+
* Save build state
|
|
166
|
+
*/
|
|
167
|
+
saveState(state: BuildState): void;
|
|
168
|
+
/**
|
|
169
|
+
* Update current phase
|
|
170
|
+
*/
|
|
171
|
+
setPhase(phase: EngineeringPhase, agent: AgentRole): void;
|
|
172
|
+
/**
|
|
173
|
+
* Pass a gate
|
|
174
|
+
*/
|
|
175
|
+
passGate(phase: EngineeringPhase, artifacts?: string[], approvedBy?: string): void;
|
|
176
|
+
/**
|
|
177
|
+
* Fail a gate
|
|
178
|
+
*/
|
|
179
|
+
failGate(phase: EngineeringPhase, reason: string): void;
|
|
180
|
+
/**
|
|
181
|
+
* Get dependency graph
|
|
182
|
+
*/
|
|
183
|
+
getGraph(): DependencyGraph;
|
|
184
|
+
/**
|
|
185
|
+
* Save dependency graph
|
|
186
|
+
*/
|
|
187
|
+
saveGraph(graph: DependencyGraph): void;
|
|
188
|
+
/**
|
|
189
|
+
* Add a node to the graph
|
|
190
|
+
*/
|
|
191
|
+
addNode(node: Omit<DependencyNode, 'id' | 'createdAt' | 'modifiedAt'>): DependencyNode;
|
|
192
|
+
/**
|
|
193
|
+
* Add an edge to the graph
|
|
194
|
+
*/
|
|
195
|
+
addEdge(edge: Omit<DependencyEdge, 'id'>): DependencyEdge;
|
|
196
|
+
/**
|
|
197
|
+
* Find nodes affected by a change
|
|
198
|
+
*/
|
|
199
|
+
findAffectedNodes(nodeId: string): {
|
|
200
|
+
direct: DependencyNode[];
|
|
201
|
+
transitive: DependencyNode[];
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Record a decision
|
|
205
|
+
*/
|
|
206
|
+
recordDecision(decision: Omit<AgentDecision, 'id' | 'timestamp'>): AgentDecision;
|
|
207
|
+
/**
|
|
208
|
+
* Get all decisions
|
|
209
|
+
*/
|
|
210
|
+
getDecisions(): AgentDecision[];
|
|
211
|
+
/**
|
|
212
|
+
* Save an artifact (PRD, tech spec, etc.)
|
|
213
|
+
*/
|
|
214
|
+
saveArtifact(name: string, content: string): void;
|
|
215
|
+
/**
|
|
216
|
+
* Get an artifact
|
|
217
|
+
*/
|
|
218
|
+
getArtifact(name: string): string | null;
|
|
219
|
+
/**
|
|
220
|
+
* List all artifacts
|
|
221
|
+
*/
|
|
222
|
+
listArtifacts(): string[];
|
|
223
|
+
/**
|
|
224
|
+
* Record a message
|
|
225
|
+
*/
|
|
226
|
+
recordMessage(message: Omit<AgentMessage, 'id' | 'timestamp'>): AgentMessage;
|
|
227
|
+
/**
|
|
228
|
+
* Get messages for current session
|
|
229
|
+
*/
|
|
230
|
+
getMessages(): AgentMessage[];
|
|
231
|
+
/**
|
|
232
|
+
* Detect the tech stack from package.json
|
|
233
|
+
*/
|
|
234
|
+
private detectStack;
|
|
235
|
+
/**
|
|
236
|
+
* Get a summary of current engineering state
|
|
237
|
+
*/
|
|
238
|
+
getSummary(): {
|
|
239
|
+
project: ProjectConfig | null;
|
|
240
|
+
state: BuildState | null;
|
|
241
|
+
graphStats: {
|
|
242
|
+
nodes: number;
|
|
243
|
+
edges: number;
|
|
244
|
+
};
|
|
245
|
+
decisions: number;
|
|
246
|
+
artifacts: string[];
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Get the state manager for current directory
|
|
251
|
+
*/
|
|
252
|
+
export declare function getStateManager(cwd?: string): EngineeringStateManager;
|
|
253
|
+
/**
|
|
254
|
+
* Check if engineering project exists in current directory
|
|
255
|
+
*/
|
|
256
|
+
export declare function hasEngineeringProject(cwd?: string): boolean;
|
|
257
|
+
/**
|
|
258
|
+
* Quick summary of current project state
|
|
259
|
+
*/
|
|
260
|
+
export declare function getProjectSummary(cwd?: string): {
|
|
261
|
+
project: ProjectConfig | null;
|
|
262
|
+
state: BuildState | null;
|
|
263
|
+
graphStats: {
|
|
264
|
+
nodes: number;
|
|
265
|
+
edges: number;
|
|
266
|
+
};
|
|
267
|
+
decisions: number;
|
|
268
|
+
artifacts: string[];
|
|
269
|
+
};
|