@auto-engineer/server-implementer 0.4.6 → 0.4.8

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.
@@ -1,4 +1,5 @@
1
1
 
2
- > @auto-engineer/server-implementer@0.4.6 build /Users/sam/WebstormProjects/top/auto-engineer/packages/server-implementer
3
- > tsc
2
+ > @auto-engineer/server-implementer@0.4.8 build /Users/sam/WebstormProjects/top/auto-engineer/packages/server-implementer
3
+ > tsc && tsx ../../scripts/fix-esm-imports.ts && chmod +x dist/cli/implement-server.js
4
4
 
5
+ Fixed ESM imports in dist/
@@ -1,26 +1,19 @@
1
-
2
- 
3
- > @auto-engineer/server-implementer@0.4.6 format /Users/sam/WebstormProjects/top/auto-engineer/packages/server-implementer
4
- > prettier --write "**/*.{js,ts,json,md,yml,yaml}" --ignore-path ../../.prettierignore
5
-
6
- CHANGELOG.mdCHANGELOG.md 20ms (unchanged)
7
- DEBUG.mdDEBUG.md 3ms (unchanged)
8
- package.jsonpackage.json 14ms (unchanged)
9
- src/agent/runAllSlices.jssrc/agent/runAllSlices.js 10ms (unchanged)
10
- src/agent/runAllSlices.tssrc/agent/runAllSlices.ts 23ms (unchanged)
11
- src/agent/runFlows.jssrc/agent/runFlows.js 3ms (unchanged)
12
- src/agent/runFlows.tssrc/agent/runFlows.ts 6ms (unchanged)
13
- src/agent/runSlice.jssrc/agent/runSlice.js 20ms (unchanged)
14
- src/agent/runSlice.tssrc/agent/runSlice.ts 24ms (unchanged)
15
- src/agent/runTests.jssrc/agent/runTests.js 5ms (unchanged)
16
- src/agent/runTests.tssrc/agent/runTests.ts 7ms (unchanged)
17
- src/cli/implement-server.tssrc/cli/implement-server.ts 2ms (unchanged)
18
- src/cli/index.jssrc/cli/index.js 1ms (unchanged)
19
- src/cli/index.tssrc/cli/index.ts 2ms (unchanged)
20
- src/commands/implement-server.tssrc/commands/implement-server.ts 5ms (unchanged)
21
- src/index.tssrc/index.ts 1ms (unchanged)
22
- src/prompts/systemPrompt.jssrc/prompts/systemPrompt.js 1ms (unchanged)
23
- src/prompts/systemPrompt.tssrc/prompts/systemPrompt.ts 1ms (unchanged)
24
- src/utils/extractCodeBlock.jssrc/utils/extractCodeBlock.js 1ms (unchanged)
25
- src/utils/extractCodeBlock.tssrc/utils/extractCodeBlock.ts 1ms (unchanged)
26
- tsconfig.jsontsconfig.json 1ms (unchanged)
1
+
2
+ > @auto-engineer/server-implementer@0.4.8 format /Users/sam/WebstormProjects/top/auto-engineer/packages/server-implementer
3
+ > prettier --write "**/*.{js,ts,json,md,yml,yaml}" --ignore-path ../../.prettierignore
4
+
5
+ CHANGELOG.md 20ms (unchanged)
6
+ DEBUG.md 3ms (unchanged)
7
+ package.json 18ms (unchanged)
8
+ src/agent/runAllSlices.ts 32ms (unchanged)
9
+ src/agent/runFlows.ts 11ms (unchanged)
10
+ src/agent/runSlice.ts 37ms (unchanged)
11
+ src/agent/runTests.ts 11ms (unchanged)
12
+ src/cli/implement-server.ts 3ms (unchanged)
13
+ src/cli/index.ts 2ms (unchanged)
14
+ src/commands/implement-server.ts 5ms (unchanged)
15
+ src/commands/implement-slice.ts 12ms (unchanged)
16
+ src/index.ts 1ms (unchanged)
17
+ src/prompts/systemPrompt.ts 1ms (unchanged)
18
+ src/utils/extractCodeBlock.ts 1ms (unchanged)
19
+ tsconfig.json 1ms (unchanged)
@@ -0,0 +1,14 @@
1
+
2
+ > @auto-engineer/server-implementer@0.4.8 lint:fix /Users/sam/WebstormProjects/top/auto-engineer/packages/server-implementer
3
+ > eslint 'src/**/*.ts' --fix --config ../../eslint.config.ts
4
+
5
+
6
+ /Users/sam/WebstormProjects/top/auto-engineer/packages/server-implementer/src/commands/implement-slice.ts
7
+ 198:11 error Unexpected nullable string value in conditional. Please handle the nullish/empty cases explicitly @typescript-eslint/strict-boolean-expressions
8
+ 230:8 error Async function 'handleImplementSliceCommand' has a complexity of 13. Maximum allowed is 10 complexity
9
+ 269:9 error Unexpected nullable string value in conditional. Please handle the nullish/empty cases explicitly @typescript-eslint/strict-boolean-expressions
10
+ 283:18 error Unexpected nullable string value in conditional. Please handle the nullish/empty cases explicitly @typescript-eslint/strict-boolean-expressions
11
+
12
+ ✖ 4 problems (4 errors, 0 warnings)
13
+
14
+  ELIFECYCLE  Command failed with exit code 1.
@@ -1,5 +1,4 @@
1
-
2
- 
3
- > @auto-engineer/server-implementer@0.4.6 lint /Users/sam/WebstormProjects/top/auto-engineer/packages/server-implementer
4
- > eslint 'src/**/*.ts' --max-warnings 0 --config ../../eslint.config.ts
5
-
1
+
2
+ > @auto-engineer/server-implementer@0.4.8 lint /Users/sam/WebstormProjects/top/auto-engineer/packages/server-implementer
3
+ > eslint 'src/**/*.ts' --max-warnings 0 --config ../../eslint.config.ts
4
+
@@ -1,14 +1,12 @@
1
-
2
- 
3
- > @auto-engineer/server-implementer@0.4.6 test /Users/sam/WebstormProjects/top/auto-engineer/packages/server-implementer
4
- > vitest run
5
-
6
- [?25l
7
-  RUN  v3.2.4 /Users/sam/WebstormProjects/top/auto-engineer/packages/server-implementer
8
-
9
- No test files found, exiting with code 0
10
-
11
- include: **/*.specs.{js,ts}
12
- exclude: **/.tmp/**, **/node_modules/**, **/dist/**
13
- 
14
- [?25h
1
+
2
+ > @auto-engineer/server-implementer@0.4.8 test /Users/sam/WebstormProjects/top/auto-engineer/packages/server-implementer
3
+ > vitest run
4
+
5
+
6
+ RUN v3.2.4 /Users/sam/WebstormProjects/top/auto-engineer/packages/server-implementer
7
+
8
+ No test files found, exiting with code 0
9
+
10
+ include: **/*.specs.{js,ts}
11
+ exclude: **/.tmp/**, **/node_modules/**, **/dist/**
12
+
@@ -1,5 +1,4 @@
1
-
2
- 
3
- > @auto-engineer/server-implementer@0.4.6 type-check /Users/sam/WebstormProjects/top/auto-engineer/packages/server-implementer
4
- > tsc --noEmit
5
-
1
+
2
+ > @auto-engineer/server-implementer@0.4.8 type-check /Users/sam/WebstormProjects/top/auto-engineer/packages/server-implementer
3
+ > tsc --noEmit
4
+
@@ -1,5 +1,5 @@
1
1
  import fg from 'fast-glob';
2
- import { runSlice } from './runSlice';
2
+ import { runSlice } from './runSlice.js';
3
3
  import path from 'path';
4
4
  export async function runAllSlices(flowDir) {
5
5
  const flowName = path.basename(flowDir);
@@ -1,6 +1,6 @@
1
1
  import fg from 'fast-glob';
2
2
  import path from 'path';
3
- import { runAllSlices } from './runAllSlices';
3
+ import { runAllSlices } from './runAllSlices.js';
4
4
  import createDebug from 'debug';
5
5
  const debug = createDebug('server-impl:flows');
6
6
  const debugFlow = createDebug('server-impl:flows:flow');
@@ -3,9 +3,9 @@ import fg from 'fast-glob';
3
3
  import { generateTextWithAI, getAvailableProviders } from '@auto-engineer/ai-gateway';
4
4
  import { readFile, writeFile, access } from 'fs/promises';
5
5
  import { execa } from 'execa';
6
- import { SYSTEM_PROMPT } from '../prompts/systemPrompt';
7
- import { extractCodeBlock } from '../utils/extractCodeBlock';
8
- import { runTests } from './runTests';
6
+ import { SYSTEM_PROMPT } from '../prompts/systemPrompt.js';
7
+ import { extractCodeBlock } from '../utils/extractCodeBlock.js';
8
+ import { runTests } from './runTests.js';
9
9
  const availableProviders = getAvailableProviders();
10
10
  const AI_PROVIDER = availableProviders[0];
11
11
  if (availableProviders.length === 0) {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import 'dotenv/config';
3
3
  import { fileURLToPath } from 'url';
4
- import { implementServerCommandHandler } from '../commands/implement-server';
4
+ import { implementServerCommandHandler } from '../commands/implement-server.js';
5
5
  import createDebug from 'debug';
6
6
  const debug = createDebug('server-impl:cli:implement');
7
7
  const __filename = fileURLToPath(import.meta.url);
package/dist/cli/index.js CHANGED
@@ -2,7 +2,7 @@ import 'dotenv/config';
2
2
  import path from 'path';
3
3
  import { fileURLToPath } from 'url';
4
4
  import { existsSync } from 'fs';
5
- import { runFlows } from '../agent/runFlows';
5
+ import { runFlows } from '../agent/runFlows.js';
6
6
  import createDebug from 'debug';
7
7
  const debug = createDebug('server-impl:cli');
8
8
  const __filename = fileURLToPath(import.meta.url);
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import path from 'path';
3
3
  import { existsSync } from 'fs';
4
- import { runFlows } from '../agent/runFlows';
4
+ import { runFlows } from '../agent/runFlows.js';
5
5
  import createDebug from 'debug';
6
6
  const debug = createDebug('server-impl:command');
7
7
  const debugHandler = createDebug('server-impl:command:handler');
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env node
2
+ import { type CommandHandler, type Command, type Event } from '@auto-engineer/message-bus';
3
+ export type ImplementSliceCommand = Command<'ImplementSlice', {
4
+ sliceDirectory: string;
5
+ flowName: string;
6
+ context?: {
7
+ previousOutputs?: string;
8
+ attemptNumber?: number;
9
+ };
10
+ }>;
11
+ export type SliceImplementedEvent = Event<'SliceImplemented', {
12
+ sliceDirectory: string;
13
+ flowName: string;
14
+ filesImplemented: string[];
15
+ }>;
16
+ export type SliceImplementationFailedEvent = Event<'SliceImplementationFailed', {
17
+ sliceDirectory: string;
18
+ flowName: string;
19
+ error: string;
20
+ }>;
21
+ export declare function handleImplementSliceCommand(command: ImplementSliceCommand): Promise<SliceImplementedEvent | SliceImplementationFailedEvent>;
22
+ export declare const implementSliceCommandHandler: CommandHandler<ImplementSliceCommand>;
23
+ //# sourceMappingURL=implement-slice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"implement-slice.d.ts","sourceRoot":"","sources":["../../src/commands/implement-slice.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,4BAA4B,CAAC;AA0D3F,MAAM,MAAM,qBAAqB,GAAG,OAAO,CACzC,gBAAgB,EAChB;IACE,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE;QACR,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;CACH,CACF,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,KAAK,CACvC,kBAAkB,EAClB;IACE,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,CACF,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,KAAK,CAChD,2BAA2B,EAC3B;IACE,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CACF,CAAC;AA8LF,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,qBAAqB,GAAG,8BAA8B,CAAC,CAmCjE;AAED,eAAO,MAAM,4BAA4B,EAAE,cAAc,CAAC,qBAAqB,CAiB9E,CAAC"}
@@ -0,0 +1,263 @@
1
+ #!/usr/bin/env node
2
+ import { generateTextWithAI, getAvailableProviders } from '@auto-engineer/ai-gateway';
3
+ import path from 'path';
4
+ import { existsSync } from 'fs';
5
+ import { readFile, writeFile } from 'fs/promises';
6
+ import fg from 'fast-glob';
7
+ import createDebug from 'debug';
8
+ const debug = createDebug('server-impl:slice');
9
+ const debugHandler = createDebug('server-impl:slice:handler');
10
+ const debugProcess = createDebug('server-impl:slice:process');
11
+ const debugResult = createDebug('server-impl:slice:result');
12
+ // System prompt for AI implementation
13
+ const SYSTEM_PROMPT = `
14
+ You are a software engineer implementing missing logic in a sliced event-driven TypeScript backend. Each slice contains partially scaffolded code, and your task is to complete the logic following implementation instructions embedded in each file.
15
+
16
+ Project Characteristics:
17
+ - Architecture: sliced event-sourced CQRS (Command, Query, Reaction slices)
18
+ - Language: TypeScript with type-graphql and Emmett
19
+ - Each slice has scaffolded files with implementation instructions clearly marked with comments (e.g., '## IMPLEMENTATION INSTRUCTIONS ##') or TODOs.
20
+ - Tests (e.g., *.specs.ts) must pass.
21
+ - Type errors are not allowed.
22
+
23
+ Your Goal:
24
+ - Read the implementation instructions from the provided file.
25
+ - Generate only the code needed to fulfill the instructions, nothing extra and provide back the whole file without the instructions.
26
+ - Maintain immutability and adhere to functional best practices.
27
+ - Use only the types and domain constructs already present in the slice.
28
+ - Do not remove existing imports or types that are still referenced or required in the file.
29
+ - Return the entire updated file, not just the modified parts and remove any TODO comments or instructions after implementing the logic
30
+
31
+ Key rules:
32
+ - Never modify code outside the TODO or instruction areas.
33
+ - Ensure the code is production-ready and type-safe.
34
+ - Follow the slice type conventions:
35
+ - **Command slice**: validate command, inspect state, emit events, never mutate state. Uses graphql mutations.
36
+ - **Reaction slice**: respond to events with commands.
37
+ - **Query slice**: maintain projections based on events, do not emit or throw. Uses graphql queries.
38
+ - All code must be TypeScript compliant and follow functional patterns.
39
+ - If a test exists, make it pass.
40
+ - Keep implementations minimal and idiomatic.
41
+
42
+ Avoid:
43
+ - Adding new dependencies.
44
+ - Refactoring unrelated code.
45
+ - Changing the structure of already scaffolded files unless instructed.
46
+
47
+ You will receive:
48
+ - The path of the file to implement.
49
+ - The current contents of the file, with instruction comments.
50
+ - Other relevant files from the same slice (e.g., types, test, state, etc.).
51
+
52
+ You must:
53
+ - Return the entire updated file (no commentary and remove all implementation instructions).
54
+ - Ensure the output is valid TypeScript.
55
+ `;
56
+ // Helper function to extract code block from AI response
57
+ function extractCodeBlock(text) {
58
+ return text
59
+ .replace(/```(?:ts|typescript)?/g, '')
60
+ .replace(/```/g, '')
61
+ .trim();
62
+ }
63
+ // Load all TypeScript files from the slice directory
64
+ async function loadContextFiles(sliceDir) {
65
+ const files = await fg(['*.ts'], { cwd: sliceDir });
66
+ const context = {};
67
+ for (const file of files) {
68
+ const absPath = path.join(sliceDir, file);
69
+ context[file] = await readFile(absPath, 'utf-8');
70
+ }
71
+ return context;
72
+ }
73
+ // Find files that need implementation
74
+ function findFilesToImplement(contextFiles) {
75
+ return Object.entries(contextFiles).filter(([, content]) => content.includes('TODO:') || content.includes('IMPLEMENTATION INSTRUCTIONS'));
76
+ }
77
+ // Build prompt for initial implementation
78
+ function buildInitialPrompt(targetFile, context) {
79
+ return `
80
+ ${SYSTEM_PROMPT}
81
+
82
+ ---
83
+ 📄 Target file to implement: ${targetFile}
84
+
85
+ ${context[targetFile]}
86
+
87
+ ---
88
+ 🧠 Other files in the same slice:
89
+ ${Object.entries(context)
90
+ .filter(([name]) => name !== targetFile)
91
+ .map(([name, content]) => `// File: ${name}\n${content}`)
92
+ .join('\n\n')}
93
+
94
+ ---
95
+ Return only the whole updated file of ${targetFile}. Do not remove existing imports or types that are still referenced or required in the file. The file returned has to be production ready.
96
+ `.trim();
97
+ }
98
+ // Build prompt for retry with context
99
+ function buildRetryPrompt(targetFile, context, previousOutputs) {
100
+ return `
101
+ ${SYSTEM_PROMPT}
102
+
103
+ ---
104
+ The previous implementation needs adjustment based on this feedback:
105
+
106
+ ${previousOutputs}
107
+
108
+ 📄 File to update: ${targetFile}
109
+
110
+ ${context[targetFile]}
111
+
112
+ 🧠 Other files in the same slice:
113
+ ${Object.entries(context)
114
+ .filter(([name]) => name !== targetFile)
115
+ .map(([name, content]) => `// File: ${name}\n${content}`)
116
+ .join('\n\n')}
117
+
118
+ ---
119
+ Return only the corrected full contents of ${targetFile}, no commentary, no markdown.
120
+ `.trim();
121
+ }
122
+ // Main implementation function
123
+ async function implementSlice(sliceDir, flowName, context) {
124
+ const availableProviders = getAvailableProviders();
125
+ if (availableProviders.length === 0) {
126
+ throw new Error('No AI providers configured. Please set one of: OPENAI_API_KEY, ANTHROPIC_API_KEY, GEMINI_API_KEY, or XAI_API_KEY');
127
+ }
128
+ const AI_PROVIDER = availableProviders[0];
129
+ const sliceName = path.basename(sliceDir);
130
+ debugProcess(`Implementing slice: ${sliceName} for flow: ${flowName}`);
131
+ try {
132
+ // Load all context files
133
+ const contextFiles = await loadContextFiles(sliceDir);
134
+ const filesToImplement = findFilesToImplement(contextFiles);
135
+ const implementedFiles = [];
136
+ if (filesToImplement.length === 0) {
137
+ debugProcess('No files with TODO or IMPLEMENTATION INSTRUCTIONS found');
138
+ return { success: true, filesImplemented: [] };
139
+ }
140
+ // Implement each file that needs it
141
+ for (const [targetFile] of filesToImplement) {
142
+ debugProcess(`Implementing ${targetFile}`);
143
+ let prompt;
144
+ if (context !== undefined && context.previousOutputs !== undefined && context.previousOutputs.length > 0) {
145
+ // Use retry prompt if we have previous context
146
+ prompt = buildRetryPrompt(targetFile, contextFiles, context.previousOutputs);
147
+ debugProcess(`Using retry prompt for attempt #${context.attemptNumber ?? 2}`);
148
+ }
149
+ else {
150
+ // Use initial prompt for first attempt
151
+ prompt = buildInitialPrompt(targetFile, contextFiles);
152
+ }
153
+ // Generate implementation with AI
154
+ const aiOutput = await generateTextWithAI(prompt, AI_PROVIDER);
155
+ const cleanedCode = extractCodeBlock(aiOutput);
156
+ // Write the implemented file
157
+ const filePath = path.join(sliceDir, targetFile);
158
+ await writeFile(filePath, cleanedCode, 'utf-8');
159
+ debugProcess(`Successfully implemented ${targetFile}`);
160
+ implementedFiles.push(targetFile);
161
+ // Update context for next file
162
+ contextFiles[targetFile] = cleanedCode;
163
+ }
164
+ return { success: true, filesImplemented: implementedFiles };
165
+ }
166
+ catch (error) {
167
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
168
+ debugProcess(`Implementation failed: ${errorMessage}`);
169
+ return { success: false, filesImplemented: [], error: errorMessage };
170
+ }
171
+ }
172
+ function logCommandDebugInfo(command) {
173
+ const { sliceDirectory, flowName, context } = command.data;
174
+ debug('Handling ImplementSliceCommand');
175
+ debug(' Slice directory: %s', sliceDirectory);
176
+ debug(' Flow name: %s', flowName);
177
+ debug(' Context provided: %s', context ? 'yes' : 'no');
178
+ if (context) {
179
+ debug(' Attempt number: %d', context.attemptNumber ?? 1);
180
+ }
181
+ debug(' Request ID: %s', command.requestId);
182
+ debug(' Correlation ID: %s', command.correlationId ?? 'none');
183
+ }
184
+ function createFailedEvent(command, error) {
185
+ return {
186
+ type: 'SliceImplementationFailed',
187
+ data: {
188
+ sliceDirectory: command.data.sliceDirectory,
189
+ flowName: command.data.flowName,
190
+ error,
191
+ },
192
+ timestamp: new Date(),
193
+ requestId: command.requestId,
194
+ correlationId: command.correlationId,
195
+ };
196
+ }
197
+ function createSuccessEvent(command, filesImplemented) {
198
+ return {
199
+ type: 'SliceImplemented',
200
+ data: {
201
+ sliceDirectory: command.data.sliceDirectory,
202
+ flowName: command.data.flowName,
203
+ filesImplemented,
204
+ },
205
+ timestamp: new Date(),
206
+ requestId: command.requestId,
207
+ correlationId: command.correlationId,
208
+ };
209
+ }
210
+ function logRetryContext(context) {
211
+ if (context !== undefined && context.previousOutputs !== undefined && context.previousOutputs.length > 0) {
212
+ debugProcess('Retrying with context from previous attempt #%d', context.attemptNumber ?? 1);
213
+ debugProcess('Previous outputs: %s', context.previousOutputs.substring(0, 500));
214
+ }
215
+ }
216
+ export async function handleImplementSliceCommand(command) {
217
+ const { sliceDirectory, flowName, context } = command.data;
218
+ logCommandDebugInfo(command);
219
+ try {
220
+ const sliceRoot = path.resolve(sliceDirectory);
221
+ debugHandler('Resolved paths:');
222
+ debugHandler(' Slice root: %s', sliceRoot);
223
+ if (!existsSync(sliceRoot)) {
224
+ debugHandler('ERROR: Slice directory not found at %s', sliceRoot);
225
+ return createFailedEvent(command, `Slice directory not found at: ${sliceRoot}`);
226
+ }
227
+ debugProcess('Starting slice implementation for: %s', sliceRoot);
228
+ logRetryContext(context);
229
+ const result = await implementSlice(sliceRoot, flowName, context);
230
+ if (!result.success) {
231
+ return createFailedEvent(command, result.error ?? 'Implementation failed');
232
+ }
233
+ debugResult('Process succeeded');
234
+ debugResult('Files implemented: %d', result.filesImplemented.length);
235
+ debugResult('Files: %s', result.filesImplemented.join(', '));
236
+ debugResult('Returning success event: SliceImplemented');
237
+ return createSuccessEvent(command, result.filesImplemented);
238
+ }
239
+ catch (error) {
240
+ debug('ERROR: Exception caught: %O', error);
241
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
242
+ return createFailedEvent(command, errorMessage);
243
+ }
244
+ }
245
+ export const implementSliceCommandHandler = {
246
+ name: 'ImplementSlice',
247
+ handle: async (command) => {
248
+ debug('CommandHandler executing for ImplementSlice');
249
+ const result = await handleImplementSliceCommand(command);
250
+ if (result.type === 'SliceImplemented') {
251
+ debug('Command handler completed: success');
252
+ console.log(`✅ Slice implementation completed successfully`);
253
+ console.log(` Flow: ${result.data.flowName}`);
254
+ console.log(` Files implemented: ${result.data.filesImplemented.length}`);
255
+ }
256
+ else {
257
+ debug('Command handler completed: failure - %s', result.data.error);
258
+ console.error(`❌ Slice implementation failed: ${result.data.error}`);
259
+ process.exit(1);
260
+ }
261
+ },
262
+ };
263
+ //# sourceMappingURL=implement-slice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"implement-slice.js","sourceRoot":"","sources":["../../src/commands/implement-slice.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,MAAM,WAAW,CAAC;AAC3B,OAAO,WAAW,MAAM,OAAO,CAAC;AAEhC,MAAM,KAAK,GAAG,WAAW,CAAC,mBAAmB,CAAC,CAAC;AAC/C,MAAM,YAAY,GAAG,WAAW,CAAC,2BAA2B,CAAC,CAAC;AAC9D,MAAM,YAAY,GAAG,WAAW,CAAC,2BAA2B,CAAC,CAAC;AAC9D,MAAM,WAAW,GAAG,WAAW,CAAC,0BAA0B,CAAC,CAAC;AAE5D,sCAAsC;AACtC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CrB,CAAC;AAgCF,yDAAyD;AACzD,SAAS,gBAAgB,CAAC,IAAY;IACpC,OAAO,IAA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AC;QACrD,MAAM,MAAM,GAAG,MAAM,2BAA2B,CAAC,OAAO,CAAC,CAAC;QAE1D,IAAI,MAAM,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;YACvC,KAAK,CAAC,oCAAoC,CAAC,CAAC;YAC5C,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;YAC7D,OAAO,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;YAChD,OAAO,CAAC,GAAG,CAAC,yBAAyB,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC;QAC9E,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,yCAAyC,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACpE,OAAO,CAAC,KAAK,CAAC,kCAAkC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;YACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { implementServerCommandHandler, handleImplementServerCommand, type ImplementServerCommand, type ServerImplementedEvent, type ServerImplementationFailedEvent, } from './commands/implement-server';
2
+ export { implementSliceCommandHandler, handleImplementSliceCommand, type ImplementSliceCommand, type SliceImplementedEvent, type SliceImplementationFailedEvent, } from './commands/implement-slice';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,+BAA+B,GACrC,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,+BAA+B,GACrC,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,4BAA4B,EAC5B,2BAA2B,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,8BAA8B,GACpC,MAAM,4BAA4B,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
- export { implementServerCommandHandler, handleImplementServerCommand, } from './commands/implement-server';
1
+ export { implementServerCommandHandler, handleImplementServerCommand, } from './commands/implement-server.js';
2
+ export { implementSliceCommandHandler, handleImplementSliceCommand, } from './commands/implement-slice.js';
2
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,GAI7B,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,GAI7B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,4BAA4B,EAC5B,2BAA2B,GAI5B,MAAM,4BAA4B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auto-engineer/server-implementer",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  "scripts": {
32
32
  "implement": "tsx src/cli/index.ts",
33
33
  "implement:server": "tsx src/cli/implement-server.ts",
34
- "build": "tsc",
34
+ "build": "tsc && tsx ../../scripts/fix-esm-imports.ts && chmod +x dist/cli/implement-server.js",
35
35
  "dev": "tsc --watch",
36
36
  "test": "vitest run",
37
37
  "lint": "eslint 'src/**/*.ts' --max-warnings 0 --config ../../eslint.config.ts",