@auto-engineer/component-implementer 0.13.3 → 0.14.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/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.13.3",
23
- "@auto-engineer/message-bus": "0.13.3"
22
+ "@auto-engineer/ai-gateway": "0.14.0",
23
+ "@auto-engineer/message-bus": "0.14.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "playwright": "^1.54.1",
27
- "@auto-engineer/cli": "0.13.3"
27
+ "@auto-engineer/cli": "0.14.0"
28
28
  },
29
- "version": "0.13.3",
29
+ "version": "0.14.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 && codeBlockMatch[1]) {
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 && themeMatch[1]) {
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 { performance } from 'perf_hooks';
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');
@@ -132,7 +132,7 @@ async function loadComponentDataForImplementation(
132
132
  const componentDef = items[componentName] as Record<string, unknown> | undefined;
133
133
  if (!componentDef) throw new Error(`Component ${componentType}:${componentName} not found in IA schema`);
134
134
 
135
- const outPath = path.join(projectDir, '..', filePath);
135
+ const outPath = path.isAbsolute(filePath) ? filePath : path.join(projectDir, '..', filePath);
136
136
 
137
137
  const t2 = performance.now();
138
138
  let existingScaffold = '';
@@ -1403,8 +1403,7 @@ function validateImports(code: string, registry: ComponentRegistry): { valid: bo
1403
1403
  const errors: string[] = [];
1404
1404
 
1405
1405
  const componentImportPattern = /import\s+[^'"]*from\s+['"]@\/components\/([^/]+)\/([^'"]+)['"]/g;
1406
- let match;
1407
- while ((match = componentImportPattern.exec(code)) !== null) {
1406
+ for (const match of code.matchAll(componentImportPattern)) {
1408
1407
  const error = validateComponentImport(match[1], match[2], registry);
1409
1408
  if (error !== null) {
1410
1409
  errors.push(error);
@@ -1412,7 +1411,7 @@ function validateImports(code: string, registry: ComponentRegistry): { valid: bo
1412
1411
  }
1413
1412
 
1414
1413
  const allImportPattern = /import\s+[^'"]*from\s+['"](@\/[^'"]+)['"]/g;
1415
- while ((match = allImportPattern.exec(code)) !== null) {
1414
+ for (const match of code.matchAll(allImportPattern)) {
1416
1415
  const error = validateNonComponentImport(match[1]);
1417
1416
  if (error !== null) {
1418
1417
  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';