@auto-engineer/component-implementer 0.13.3 → 0.15.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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +24 -0
- package/README.md +153 -305
- package/dist/src/agent.js +5 -5
- package/dist/src/agent.js.map +1 -1
- package/dist/src/commands/implement-component.d.ts.map +1 -1
- package/dist/src/commands/implement-component.js +13 -10
- package/dist/src/commands/implement-component.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -8
- package/src/agent.ts +5 -5
- package/src/commands/implement-component.ts +13 -10
- package/src/index.ts +2 -2
package/package.json
CHANGED
|
@@ -19,24 +19,20 @@
|
|
|
19
19
|
"openai": "^5.7.0",
|
|
20
20
|
"vite": "^5.4.1",
|
|
21
21
|
"zod": "^3.25.67",
|
|
22
|
-
"@auto-engineer/ai-gateway": "0.
|
|
23
|
-
"@auto-engineer/message-bus": "0.
|
|
22
|
+
"@auto-engineer/ai-gateway": "0.15.0",
|
|
23
|
+
"@auto-engineer/message-bus": "0.15.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"playwright": "^1.54.1",
|
|
27
|
-
"@auto-engineer/cli": "0.
|
|
27
|
+
"@auto-engineer/cli": "0.15.0"
|
|
28
28
|
},
|
|
29
|
-
"version": "0.
|
|
29
|
+
"version": "0.15.0",
|
|
30
30
|
"scripts": {
|
|
31
31
|
"start": "tsx src/index.ts",
|
|
32
32
|
"build": "tsc && tsx ../../scripts/fix-esm-imports.ts && cp src/*.html dist/src/ 2>/dev/null || true",
|
|
33
33
|
"test": "vitest run --reporter=dot",
|
|
34
34
|
"ai-agent": "tsx -r dotenv/config src/agent-cli.ts",
|
|
35
|
-
"lint": "eslint 'src/**/*.ts' --max-warnings 0 --config ../../eslint.config.ts",
|
|
36
35
|
"type-check": "tsc --noEmit",
|
|
37
|
-
"format": "prettier --write \"**/*.{js,ts,json,md,yml,yaml}\" --ignore-path ../../.prettierignore --log-level warn",
|
|
38
|
-
"lint:fix": "eslint 'src/**/*.ts' --fix --config ../../eslint.config.ts",
|
|
39
|
-
"format:fix": "prettier --write \"**/*.{js,ts,json,md,yml,yaml}\" --ignore-path ../../.prettierignore --log-level warn",
|
|
40
36
|
"link:dev": "pnpm build && pnpm link --global",
|
|
41
37
|
"unlink:dev": "pnpm unlink --global"
|
|
42
38
|
}
|
package/src/agent.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import * as fs from 'node:fs/promises';
|
|
2
|
+
import * as path from 'node:path';
|
|
1
3
|
import { generateTextWithAI } from '@auto-engineer/ai-gateway';
|
|
2
|
-
import * as fs from 'fs/promises';
|
|
3
|
-
import * as path from 'path';
|
|
4
|
-
import * as ts from 'typescript';
|
|
5
4
|
import createDebug from 'debug';
|
|
5
|
+
import * as ts from 'typescript';
|
|
6
6
|
|
|
7
7
|
const debug = createDebug('frontend-impl:agent');
|
|
8
8
|
const debugPlan = createDebug('frontend-impl:agent:plan');
|
|
@@ -102,7 +102,7 @@ const provider = undefined;
|
|
|
102
102
|
function extractJsonArray(text: string): string {
|
|
103
103
|
debugAI('Extracting JSON array from text of length: %d', text.length);
|
|
104
104
|
const codeBlockMatch = text.match(/```(?:json)?\s*([\s\S]*?)\s*```/);
|
|
105
|
-
if (codeBlockMatch
|
|
105
|
+
if (codeBlockMatch?.[1]) {
|
|
106
106
|
debugAI('Found JSON in code block');
|
|
107
107
|
return codeBlockMatch[1].trim();
|
|
108
108
|
}
|
|
@@ -250,7 +250,7 @@ async function getTheme(designSystem: string): Promise<string> {
|
|
|
250
250
|
debugContext('Extracting theme from design system, content length: %d', designSystem.length);
|
|
251
251
|
try {
|
|
252
252
|
const themeMatch = designSystem.match(/## Theme\s*\n([\s\S]*?)(?=\n## |\n# |\n*$)/);
|
|
253
|
-
if (themeMatch
|
|
253
|
+
if (themeMatch?.[1]) {
|
|
254
254
|
const theme = themeMatch[1].trim();
|
|
255
255
|
debugContext('Theme extracted, length: %d', theme.length);
|
|
256
256
|
return theme;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import * as fs from 'node:fs/promises';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { performance } from 'node:perf_hooks';
|
|
1
4
|
import { type Command, defineCommandHandler, type Event } from '@auto-engineer/message-bus';
|
|
2
|
-
import * as fs from 'fs/promises';
|
|
3
|
-
import * as path from 'path';
|
|
4
|
-
import * as ts from 'typescript';
|
|
5
5
|
import createDebug from 'debug';
|
|
6
|
-
import { callAI, loadScheme } from '../agent';
|
|
7
6
|
import { execa } from 'execa';
|
|
8
|
-
import
|
|
7
|
+
import * as ts from 'typescript';
|
|
8
|
+
import { callAI, loadScheme } from '../agent';
|
|
9
9
|
|
|
10
10
|
const debug = createDebug('auto:client-implementer:component');
|
|
11
11
|
const debugTypeCheck = createDebug('auto:client-implementer:component:typecheck');
|
|
@@ -64,6 +64,7 @@ export const commandHandler = defineCommandHandler<
|
|
|
64
64
|
(command: ImplementComponentCommand) => Promise<ComponentImplementedEvent | ComponentImplementationFailedEvent>
|
|
65
65
|
>({
|
|
66
66
|
name: 'ImplementComponent',
|
|
67
|
+
displayName: 'Implement Component',
|
|
67
68
|
alias: 'implement:component',
|
|
68
69
|
description: 'AI implements a single component (atom, molecule, organism, or page)',
|
|
69
70
|
category: 'implement',
|
|
@@ -87,7 +88,10 @@ export const commandHandler = defineCommandHandler<
|
|
|
87
88
|
examples: [
|
|
88
89
|
'$ auto implement:component --project-dir=./client --ia-scheme-dir=./.context --design-system-path=./design-system.md --component-type=molecule --component-name=SurveyCard',
|
|
89
90
|
],
|
|
90
|
-
events: [
|
|
91
|
+
events: [
|
|
92
|
+
{ name: 'ComponentImplemented', displayName: 'Component Implemented' },
|
|
93
|
+
{ name: 'ComponentImplementationFailed', displayName: 'Component Failed' },
|
|
94
|
+
],
|
|
91
95
|
handle: async (
|
|
92
96
|
command: ImplementComponentCommand,
|
|
93
97
|
): Promise<ComponentImplementedEvent | ComponentImplementationFailedEvent> => {
|
|
@@ -132,7 +136,7 @@ async function loadComponentDataForImplementation(
|
|
|
132
136
|
const componentDef = items[componentName] as Record<string, unknown> | undefined;
|
|
133
137
|
if (!componentDef) throw new Error(`Component ${componentType}:${componentName} not found in IA schema`);
|
|
134
138
|
|
|
135
|
-
const outPath = path.join(projectDir, '..', filePath);
|
|
139
|
+
const outPath = path.isAbsolute(filePath) ? filePath : path.join(projectDir, '..', filePath);
|
|
136
140
|
|
|
137
141
|
const t2 = performance.now();
|
|
138
142
|
let existingScaffold = '';
|
|
@@ -1403,8 +1407,7 @@ function validateImports(code: string, registry: ComponentRegistry): { valid: bo
|
|
|
1403
1407
|
const errors: string[] = [];
|
|
1404
1408
|
|
|
1405
1409
|
const componentImportPattern = /import\s+[^'"]*from\s+['"]@\/components\/([^/]+)\/([^'"]+)['"]/g;
|
|
1406
|
-
|
|
1407
|
-
while ((match = componentImportPattern.exec(code)) !== null) {
|
|
1410
|
+
for (const match of code.matchAll(componentImportPattern)) {
|
|
1408
1411
|
const error = validateComponentImport(match[1], match[2], registry);
|
|
1409
1412
|
if (error !== null) {
|
|
1410
1413
|
errors.push(error);
|
|
@@ -1412,7 +1415,7 @@ function validateImports(code: string, registry: ComponentRegistry): { valid: bo
|
|
|
1412
1415
|
}
|
|
1413
1416
|
|
|
1414
1417
|
const allImportPattern = /import\s+[^'"]*from\s+['"](@\/[^'"]+)['"]/g;
|
|
1415
|
-
|
|
1418
|
+
for (const match of code.matchAll(allImportPattern)) {
|
|
1416
1419
|
const error = validateNonComponentImport(match[1]);
|
|
1417
1420
|
if (error !== null) {
|
|
1418
1421
|
errors.push(error);
|
package/src/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { commandHandler as implementComponentHandler } from './commands/implemen
|
|
|
4
4
|
export const COMMANDS = [implementComponentHandler];
|
|
5
5
|
|
|
6
6
|
export type {
|
|
7
|
-
ImplementComponentCommand,
|
|
8
|
-
ComponentImplementedEvent,
|
|
9
7
|
ComponentImplementationFailedEvent,
|
|
8
|
+
ComponentImplementedEvent,
|
|
9
|
+
ImplementComponentCommand,
|
|
10
10
|
} from './commands/implement-component.js';
|