@auto-engineer/frontend-implementer 0.1.4 → 0.2.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 +2 -2
- package/.turbo/turbo-test.log +12 -14
- package/.turbo/turbo-type-check.log +4 -5
- package/CHANGELOG.md +12 -0
- package/dist/commands/implement-client.d.ts +13 -43
- package/dist/commands/implement-client.d.ts.map +1 -1
- package/dist/commands/implement-client.js +33 -24
- package/dist/commands/implement-client.js.map +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -264
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/commands/implement-client.ts +37 -33
- package/src/index.ts +8 -321
- package/tsconfig.tsbuildinfo +1 -1
- package/.turbo/turbo-format.log +0 -15
- package/.turbo/turbo-lint.log +0 -5
- package/dist/cli-manifest.d.ts +0 -3
- package/dist/cli-manifest.d.ts.map +0 -1
- package/dist/cli-manifest.js +0 -35
- package/dist/cli-manifest.js.map +0 -1
- package/src/cli-manifest.ts +0 -37
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @auto-engineer/frontend-implementer@0.
|
|
3
|
-
> tsc && tsx ../../scripts/fix-esm-imports.ts
|
|
2
|
+
> @auto-engineer/frontend-implementer@0.2.0 build /home/runner/work/auto-engineer/auto-engineer/packages/frontend-implementer
|
|
3
|
+
> tsc && tsx ../../scripts/fix-esm-imports.ts && cp src/*.html dist/src/ 2>/dev/null || true
|
|
4
4
|
|
|
5
5
|
Fixed ESM imports in dist/
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
[
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
[
|
|
12
|
-
|
|
13
|
-
[31m[39m
|
|
14
|
-
[?25h
|
|
1
|
+
|
|
2
|
+
> @auto-engineer/frontend-implementer@0.2.0 test /home/runner/work/auto-engineer/auto-engineer/packages/frontend-implementer
|
|
3
|
+
> vitest run
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
[1m[46m RUN [49m[22m [36mv3.2.4 [39m[90m/home/runner/work/auto-engineer/auto-engineer/packages/frontend-implementer[39m
|
|
7
|
+
|
|
8
|
+
No test files found, exiting with code 0
|
|
9
|
+
|
|
10
|
+
[2minclude: [22m[33m**/*.specs.{js,ts}[39m
|
|
11
|
+
[2mexclude: [22m[33m**/.tmp/**[2m, [22m**/node_modules/**[2m, [22m**/dist/**[39m
|
|
12
|
+
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
|
|
2
|
+
> @auto-engineer/frontend-implementer@0.2.0 type-check /home/runner/work/auto-engineer/auto-engineer/packages/frontend-implementer
|
|
3
|
+
> tsc --noEmit
|
|
4
|
+
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @auto-engineer/frontend-implementer
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- add command details in dashboard
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @auto-engineer/ai-gateway@0.7.0
|
|
13
|
+
- @auto-engineer/message-bus@0.6.0
|
|
14
|
+
|
|
3
15
|
## 0.1.4
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1,44 +1,4 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export declare const implementClientManifest: {
|
|
3
|
-
handler: () => Promise<{
|
|
4
|
-
default: CommandHandler<Readonly<{
|
|
5
|
-
type: "ImplementClient";
|
|
6
|
-
data: Readonly<{
|
|
7
|
-
projectDir: string;
|
|
8
|
-
iaSchemeDir: string;
|
|
9
|
-
designSystemPath: string;
|
|
10
|
-
}>;
|
|
11
|
-
timestamp?: Date;
|
|
12
|
-
requestId?: string;
|
|
13
|
-
correlationId?: string;
|
|
14
|
-
}>, Readonly<{
|
|
15
|
-
type: "ClientImplemented";
|
|
16
|
-
data: {
|
|
17
|
-
projectDir: string;
|
|
18
|
-
};
|
|
19
|
-
timestamp?: Date;
|
|
20
|
-
requestId?: string;
|
|
21
|
-
correlationId?: string;
|
|
22
|
-
}> | Readonly<{
|
|
23
|
-
type: "ClientImplementationFailed";
|
|
24
|
-
data: {
|
|
25
|
-
error: string;
|
|
26
|
-
projectDir: string;
|
|
27
|
-
};
|
|
28
|
-
timestamp?: Date;
|
|
29
|
-
requestId?: string;
|
|
30
|
-
correlationId?: string;
|
|
31
|
-
}>>;
|
|
32
|
-
}>;
|
|
33
|
-
description: string;
|
|
34
|
-
usage: string;
|
|
35
|
-
examples: string[];
|
|
36
|
-
args: {
|
|
37
|
-
name: string;
|
|
38
|
-
description: string;
|
|
39
|
-
required: boolean;
|
|
40
|
-
}[];
|
|
41
|
-
};
|
|
1
|
+
import { type Command, type Event } from '@auto-engineer/message-bus';
|
|
42
2
|
export type ImplementClientCommand = Command<'ImplementClient', {
|
|
43
3
|
projectDir: string;
|
|
44
4
|
iaSchemeDir: string;
|
|
@@ -51,6 +11,16 @@ export type ClientImplementationFailedEvent = Event<'ClientImplementationFailed'
|
|
|
51
11
|
error: string;
|
|
52
12
|
projectDir: string;
|
|
53
13
|
}>;
|
|
54
|
-
export declare const
|
|
55
|
-
|
|
14
|
+
export declare const commandHandler: import("@auto-engineer/message-bus").UnifiedCommandHandler<Readonly<{
|
|
15
|
+
type: "ImplementClient";
|
|
16
|
+
data: Readonly<{
|
|
17
|
+
projectDir: string;
|
|
18
|
+
iaSchemeDir: string;
|
|
19
|
+
designSystemPath: string;
|
|
20
|
+
}>;
|
|
21
|
+
timestamp?: Date;
|
|
22
|
+
requestId?: string;
|
|
23
|
+
correlationId?: string;
|
|
24
|
+
}>>;
|
|
25
|
+
export default commandHandler;
|
|
56
26
|
//# sourceMappingURL=implement-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implement-client.d.ts","sourceRoot":"","sources":["../../src/commands/implement-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"implement-client.d.ts","sourceRoot":"","sources":["../../src/commands/implement-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAwB,MAAM,4BAA4B,CAAC;AAM5F,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAC1C,iBAAiB,EACjB;IACE,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CACF,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,KAAK,CACxC,mBAAmB,EACnB;IACE,UAAU,EAAE,MAAM,CAAC;CACpB,CACF,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,KAAK,CACjD,4BAA4B,EAC5B;IACE,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB,CACF,CAAC;AAEF,eAAO,MAAM,cAAc;;;oBArBX,MAAM;qBACL,MAAM;0BACD,MAAM;;;;;GAoD1B,CAAC;AAwCH,eAAe,cAAc,CAAC"}
|
|
@@ -1,18 +1,40 @@
|
|
|
1
|
+
import { defineCommandHandler } from '@auto-engineer/message-bus';
|
|
1
2
|
import { runAIAgent } from '../agent.js';
|
|
2
3
|
import createDebug from 'debug';
|
|
3
4
|
const debug = createDebug('frontend-implementer:implement-client');
|
|
4
|
-
export const
|
|
5
|
-
|
|
5
|
+
export const commandHandler = defineCommandHandler({
|
|
6
|
+
name: 'ImplementClient',
|
|
7
|
+
alias: 'implement:client',
|
|
6
8
|
description: 'AI implements client',
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
category: 'implement',
|
|
10
|
+
fields: {
|
|
11
|
+
projectDir: {
|
|
12
|
+
description: 'Client directory path',
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
iaSchemeDir: {
|
|
16
|
+
description: 'Context directory path',
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
designSystemPath: {
|
|
20
|
+
description: 'Design system file',
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
examples: [
|
|
25
|
+
'$ auto implement:client --project-dir=./client --ia-scheme-dir=./.context --design-system-path=./design-system.md',
|
|
14
26
|
],
|
|
15
|
-
|
|
27
|
+
handle: async (command) => {
|
|
28
|
+
const result = await handleImplementClientCommandInternal(command);
|
|
29
|
+
if (result.type === 'ClientImplemented') {
|
|
30
|
+
debug('Client implemented successfully');
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
debug('Failed: %s', result.data.error);
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
},
|
|
37
|
+
});
|
|
16
38
|
async function handleImplementClientCommandInternal(command) {
|
|
17
39
|
const { projectDir, iaSchemeDir, designSystemPath } = command.data;
|
|
18
40
|
try {
|
|
@@ -44,19 +66,6 @@ async function handleImplementClientCommandInternal(command) {
|
|
|
44
66
|
};
|
|
45
67
|
}
|
|
46
68
|
}
|
|
47
|
-
export const implementClientCommandHandler = {
|
|
48
|
-
name: 'ImplementClient',
|
|
49
|
-
handle: async (command) => {
|
|
50
|
-
const result = await handleImplementClientCommandInternal(command);
|
|
51
|
-
if (result.type === 'ClientImplemented') {
|
|
52
|
-
debug('Client implemented successfully');
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
debug('Failed: %s', result.data.error);
|
|
56
|
-
}
|
|
57
|
-
return result;
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
69
|
// Default export is the command handler
|
|
61
|
-
export default
|
|
70
|
+
export default commandHandler;
|
|
62
71
|
//# sourceMappingURL=implement-client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implement-client.js","sourceRoot":"","sources":["../../src/commands/implement-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"implement-client.js","sourceRoot":"","sources":["../../src/commands/implement-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,WAAW,MAAM,OAAO,CAAC;AAEhC,MAAM,KAAK,GAAG,WAAW,CAAC,uCAAuC,CAAC,CAAC;AA0BnE,MAAM,CAAC,MAAM,cAAc,GAAG,oBAAoB,CAAyB;IACzE,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE,kBAAkB;IACzB,WAAW,EAAE,sBAAsB;IACnC,QAAQ,EAAE,WAAW;IACrB,MAAM,EAAE;QACN,UAAU,EAAE;YACV,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,IAAI;SACf;QACD,WAAW,EAAE;YACX,WAAW,EAAE,wBAAwB;YACrC,QAAQ,EAAE,IAAI;SACf;QACD,gBAAgB,EAAE;YAChB,WAAW,EAAE,oBAAoB;YACjC,QAAQ,EAAE,IAAI;SACf;KACF;IACD,QAAQ,EAAE;QACR,mHAAmH;KACpH;IACD,MAAM,EAAE,KAAK,EACX,OAA+B,EACoC,EAAE;QACrE,MAAM,MAAM,GAAG,MAAM,oCAAoC,CAAC,OAAO,CAAC,CAAC;QACnE,IAAI,MAAM,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;YACxC,KAAK,CAAC,iCAAiC,CAAC,CAAC;QAC3C,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC,CAAC;AAEH,KAAK,UAAU,oCAAoC,CACjD,OAA+B;IAE/B,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAEnE,IAAI,CAAC;QACH,uCAAuC;QACvC,MAAM,UAAU,CAAC,UAAU,EAAE,WAAW,EAAE,gBAAgB,CAAC,CAAC;QAE5D,KAAK,CAAC,qCAAqC,CAAC,CAAC;QAE7C,OAAO;YACL,IAAI,EAAE,mBAAmB;YACzB,IAAI,EAAE;gBACJ,UAAU;aACX;YACD,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,aAAa,EAAE,OAAO,CAAC,aAAa;SACrC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5E,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;QAE/C,OAAO;YACL,IAAI,EAAE,4BAA4B;YAClC,IAAI,EAAE;gBACJ,KAAK,EAAE,YAAY;gBACnB,UAAU;aACX;YACD,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,aAAa,EAAE,OAAO,CAAC,aAAa;SACrC,CAAC;IACJ,CAAC;AACH,CAAC;AAED,wCAAwC;AACxC,eAAe,cAAc,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export declare const COMMANDS: import("@auto-engineer/message-bus").UnifiedCommandHandler<Readonly<{
|
|
2
|
+
type: "ImplementClient";
|
|
3
|
+
data: Readonly<{
|
|
4
|
+
projectDir: string;
|
|
5
|
+
iaSchemeDir: string;
|
|
6
|
+
designSystemPath: string;
|
|
7
|
+
}>;
|
|
8
|
+
timestamp?: Date;
|
|
9
|
+
requestId?: string;
|
|
10
|
+
correlationId?: string;
|
|
11
|
+
}>>[];
|
|
12
|
+
export { type ImplementClientCommand, type ClientImplementedEvent, type ClientImplementationFailedEvent, } from './commands/implement-client.js';
|
|
3
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;;;;;;;;KAA2B,CAAC;AACjD,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,+BAA+B,GACrC,MAAM,gCAAgC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,265 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import * as fs from 'fs/promises';
|
|
5
|
-
import * as path from 'path';
|
|
6
|
-
import createDebug from 'debug';
|
|
7
|
-
const debug = createDebug('frontend-impl:mcp');
|
|
8
|
-
const debugTools = createDebug('frontend-impl:mcp:tools');
|
|
9
|
-
const debugServer = createDebug('frontend-impl:mcp:server');
|
|
10
|
-
const debugLifecycle = createDebug('frontend-impl:mcp:lifecycle');
|
|
11
|
-
// Helper to recursively list files
|
|
12
|
-
async function listFiles(dir, base = dir) {
|
|
13
|
-
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
14
|
-
const files = await Promise.all(entries.map(async (entry) => {
|
|
15
|
-
const res = path.resolve(dir, entry.name);
|
|
16
|
-
if (entry.isDirectory()) {
|
|
17
|
-
return listFiles(res, base);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
return [path.relative(base, res)];
|
|
21
|
-
}
|
|
22
|
-
}));
|
|
23
|
-
return files.flat();
|
|
24
|
-
}
|
|
25
|
-
// Helper to read auto-ia-scheme.json
|
|
26
|
-
async function readAutoIAScheme(directory) {
|
|
27
|
-
const filePath = path.join(directory, 'auto-ia-scheme.json');
|
|
28
|
-
const content = await fs.readFile(filePath, 'utf-8');
|
|
29
|
-
return JSON.parse(content);
|
|
30
|
-
}
|
|
31
|
-
function buildEntities(scheme) {
|
|
32
|
-
const entities = [];
|
|
33
|
-
if (scheme.atoms)
|
|
34
|
-
entities.push({ type: 'atoms', items: Object.keys(scheme.atoms.items ?? {}) });
|
|
35
|
-
if (scheme.molecules)
|
|
36
|
-
entities.push({ type: 'molecules', items: Object.keys(scheme.molecules.items ?? {}) });
|
|
37
|
-
if (scheme.organisms)
|
|
38
|
-
entities.push({ type: 'organisms', items: Object.keys(scheme.organisms.items ?? {}) });
|
|
39
|
-
if (scheme.pages)
|
|
40
|
-
entities.push({ type: 'pages', items: Object.keys(scheme.pages.items ?? {}) });
|
|
41
|
-
return entities;
|
|
42
|
-
}
|
|
43
|
-
debugServer('Initializing MCP server with name: frontend-implementer, version: 0.1.0');
|
|
44
|
-
const server = new McpServer({
|
|
45
|
-
name: 'frontend-implementer',
|
|
46
|
-
version: '0.1.0',
|
|
47
|
-
});
|
|
48
|
-
debugServer('MCP server instance created');
|
|
49
|
-
// Tool: List all files in the project
|
|
50
|
-
debugTools('Registering tool: listFiles');
|
|
51
|
-
server.registerTool('listFiles', {
|
|
52
|
-
title: 'List Project Files',
|
|
53
|
-
description: 'List all files in the given project directory.',
|
|
54
|
-
inputSchema: {
|
|
55
|
-
directory: z.string().min(1, 'Directory is required'),
|
|
56
|
-
},
|
|
57
|
-
}, async ({ directory }) => {
|
|
58
|
-
debugTools('listFiles called with directory: %s', directory);
|
|
59
|
-
try {
|
|
60
|
-
const files = await listFiles(directory);
|
|
61
|
-
debugTools('Found %d files in directory', files.length);
|
|
62
|
-
return {
|
|
63
|
-
content: [
|
|
64
|
-
{
|
|
65
|
-
type: 'text',
|
|
66
|
-
text: JSON.stringify(files, null, 2),
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
debugTools('Error listing files: %O', error);
|
|
73
|
-
return {
|
|
74
|
-
isError: true,
|
|
75
|
-
content: [
|
|
76
|
-
{
|
|
77
|
-
type: 'text',
|
|
78
|
-
text: `Error listing files: ${error instanceof Error ? error.message : String(error)}`,
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
// Tool: Read a file
|
|
85
|
-
debugTools('Registering tool: readFile');
|
|
86
|
-
server.registerTool('readFile', {
|
|
87
|
-
title: 'Read File',
|
|
88
|
-
description: 'Read the contents of a file in the project.',
|
|
89
|
-
inputSchema: {
|
|
90
|
-
directory: z.string().min(1, 'Directory is required'),
|
|
91
|
-
relativePath: z.string().min(1, 'Relative file path is required'),
|
|
92
|
-
},
|
|
93
|
-
}, async ({ directory, relativePath }) => {
|
|
94
|
-
debugTools('readFile called - directory: %s, relativePath: %s', directory, relativePath);
|
|
95
|
-
try {
|
|
96
|
-
const filePath = path.join(directory, relativePath);
|
|
97
|
-
debugTools('Reading file from: %s', filePath);
|
|
98
|
-
const content = await fs.readFile(filePath, 'utf-8');
|
|
99
|
-
debugTools('File read successfully, size: %d bytes', content.length);
|
|
100
|
-
return {
|
|
101
|
-
content: [
|
|
102
|
-
{
|
|
103
|
-
type: 'text',
|
|
104
|
-
text: content,
|
|
105
|
-
},
|
|
106
|
-
],
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
debugTools('Error reading file: %O', error);
|
|
111
|
-
return {
|
|
112
|
-
isError: true,
|
|
113
|
-
content: [
|
|
114
|
-
{
|
|
115
|
-
type: 'text',
|
|
116
|
-
text: `Error reading file: ${error instanceof Error ? error.message : String(error)}`,
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
// Tool: Create or update a file
|
|
123
|
-
debugTools('Registering tool: createOrUpdateFile');
|
|
124
|
-
server.registerTool('createOrUpdateFile', {
|
|
125
|
-
title: 'Create or Update File',
|
|
126
|
-
description: 'Create or overwrite a file in the given React project directory.',
|
|
127
|
-
inputSchema: {
|
|
128
|
-
directory: z.string().min(1, 'Directory is required'),
|
|
129
|
-
relativePath: z.string().min(1, 'Relative file path is required'),
|
|
130
|
-
content: z.string().min(1, 'File content is required'),
|
|
131
|
-
},
|
|
132
|
-
}, async ({ directory, relativePath, content }) => {
|
|
133
|
-
debugTools('createOrUpdateFile called - directory: %s, relativePath: %s, content size: %d', directory, relativePath, content.length);
|
|
134
|
-
try {
|
|
135
|
-
const filePath = path.join(directory, relativePath);
|
|
136
|
-
debugTools('Writing file to: %s', filePath);
|
|
137
|
-
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
138
|
-
await fs.writeFile(filePath, content, 'utf-8');
|
|
139
|
-
debugTools('File written successfully');
|
|
140
|
-
return {
|
|
141
|
-
content: [
|
|
142
|
-
{
|
|
143
|
-
type: 'text',
|
|
144
|
-
text: `File created/updated: ${filePath}`,
|
|
145
|
-
},
|
|
146
|
-
],
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
catch (error) {
|
|
150
|
-
debugTools('Error creating/updating file: %O', error);
|
|
151
|
-
return {
|
|
152
|
-
isError: true,
|
|
153
|
-
content: [
|
|
154
|
-
{
|
|
155
|
-
type: 'text',
|
|
156
|
-
text: `Error creating/updating file: ${error instanceof Error ? error.message : String(error)}`,
|
|
157
|
-
},
|
|
158
|
-
],
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
// Tool: Read auto-ia-scheme.json
|
|
163
|
-
debugTools('Registering tool: readAutoIAScheme');
|
|
164
|
-
server.registerTool('readAutoIAScheme', {
|
|
165
|
-
title: 'Read auto-ia-scheme.json',
|
|
166
|
-
description: 'Read and return the parsed auto-ia-scheme.json from the project root.',
|
|
167
|
-
inputSchema: {
|
|
168
|
-
directory: z.string().min(1, 'Directory is required'),
|
|
169
|
-
},
|
|
170
|
-
}, async ({ directory }) => {
|
|
171
|
-
debugTools('readAutoIAScheme called with directory: %s', directory);
|
|
172
|
-
try {
|
|
173
|
-
const scheme = await readAutoIAScheme(directory);
|
|
174
|
-
debugTools('IA scheme loaded successfully');
|
|
175
|
-
return {
|
|
176
|
-
content: [
|
|
177
|
-
{
|
|
178
|
-
type: 'text',
|
|
179
|
-
text: JSON.stringify(scheme, null, 2),
|
|
180
|
-
},
|
|
181
|
-
],
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
catch (error) {
|
|
185
|
-
debugTools('Error reading auto-ia-scheme.json: %O', error);
|
|
186
|
-
return {
|
|
187
|
-
isError: true,
|
|
188
|
-
content: [
|
|
189
|
-
{
|
|
190
|
-
type: 'text',
|
|
191
|
-
text: `Error reading auto-ia-scheme.json: ${error instanceof Error ? error.message : String(error)}`,
|
|
192
|
-
},
|
|
193
|
-
],
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
// Tool: List entities from auto-ia-scheme.json
|
|
198
|
-
debugTools('Registering tool: listAutoIASchemeEntities');
|
|
199
|
-
server.registerTool('listAutoIASchemeEntities', {
|
|
200
|
-
title: 'List Entities from auto-ia-scheme.json',
|
|
201
|
-
description: 'List all atoms, molecules, organisms, and pages defined in auto-ia-scheme.json.',
|
|
202
|
-
inputSchema: {
|
|
203
|
-
directory: z.string().min(1, 'Directory is required'),
|
|
204
|
-
},
|
|
205
|
-
}, async ({ directory }) => {
|
|
206
|
-
try {
|
|
207
|
-
const scheme = await readAutoIAScheme(directory);
|
|
208
|
-
const entities = buildEntities(scheme);
|
|
209
|
-
return {
|
|
210
|
-
content: [
|
|
211
|
-
{
|
|
212
|
-
type: 'text',
|
|
213
|
-
text: JSON.stringify(entities, null, 2),
|
|
214
|
-
},
|
|
215
|
-
],
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
catch (error) {
|
|
219
|
-
return {
|
|
220
|
-
isError: true,
|
|
221
|
-
content: [
|
|
222
|
-
{
|
|
223
|
-
type: 'text',
|
|
224
|
-
text: `Error listing entities: ${error instanceof Error ? error.message : String(error)}`,
|
|
225
|
-
},
|
|
226
|
-
],
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
const transport = new StdioServerTransport();
|
|
231
|
-
async function cleanup() {
|
|
232
|
-
debug('Cleanup initiated');
|
|
233
|
-
console.log('Cleaning up...');
|
|
234
|
-
await transport.close();
|
|
235
|
-
debug('Transport closed, exiting process');
|
|
236
|
-
process.exit(0);
|
|
237
|
-
}
|
|
238
|
-
process.on('SIGTERM', () => {
|
|
239
|
-
void cleanup();
|
|
240
|
-
});
|
|
241
|
-
process.on('SIGINT', () => {
|
|
242
|
-
void cleanup();
|
|
243
|
-
});
|
|
244
|
-
async function startServer() {
|
|
245
|
-
debugLifecycle('Starting MCP server');
|
|
246
|
-
debugServer('Connecting server to transport');
|
|
247
|
-
await server.connect(transport);
|
|
248
|
-
console.error('Frontend Implementation MCP Server running on stdio');
|
|
249
|
-
debugLifecycle('MCP server connected and running');
|
|
250
|
-
debugServer('Server ready to handle requests');
|
|
251
|
-
}
|
|
252
|
-
// Only start the server if this file is run directly
|
|
253
|
-
if (process.argv[1] && import.meta.url === `file://${process.argv[1]}`) {
|
|
254
|
-
debugLifecycle('Running as main module, starting server');
|
|
255
|
-
startServer().catch((error) => {
|
|
256
|
-
debugLifecycle('Fatal error starting server: %O', error);
|
|
257
|
-
console.error(error);
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
else {
|
|
261
|
-
debugLifecycle('Module imported, not starting MCP server');
|
|
262
|
-
}
|
|
263
|
-
export * from './commands/implement-client.js';
|
|
264
|
-
export { CLI_MANIFEST } from './cli-manifest.js';
|
|
1
|
+
// Command exports
|
|
2
|
+
import { commandHandler as implementClientHandler } from './commands/implement-client.js';
|
|
3
|
+
export const COMMANDS = [implementClientHandler];
|
|
265
4
|
//# 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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAClB,OAAO,EAAE,cAAc,IAAI,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC1F,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,sBAAsB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@auto-engineer/frontend-implementer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@auto-engineer/ai-gateway": "^0.
|
|
18
|
-
"@auto-engineer/message-bus": "^0.
|
|
17
|
+
"@auto-engineer/ai-gateway": "^0.7.0",
|
|
18
|
+
"@auto-engineer/message-bus": "^0.6.0",
|
|
19
19
|
"@modelcontextprotocol/sdk": "^1.3.0",
|
|
20
20
|
"debug": "^4.4.1",
|
|
21
21
|
"jsdom": "^26.1.0",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"zod": "^3.25.67"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@auto-engineer/cli": "^0.
|
|
27
|
+
"@auto-engineer/cli": "^0.8.0",
|
|
28
28
|
"playwright": "^1.54.1"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"start": "tsx src/index.ts",
|
|
32
|
-
"build": "tsc && tsx ../../scripts/fix-esm-imports.ts",
|
|
32
|
+
"build": "tsc && tsx ../../scripts/fix-esm-imports.ts && cp src/*.html dist/src/ 2>/dev/null || true",
|
|
33
33
|
"dev": "tsc --watch",
|
|
34
34
|
"test": "vitest run",
|
|
35
35
|
"ai-agent": "tsx -r dotenv/config src/agent-cli.ts",
|
|
@@ -1,22 +1,9 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Command, type Event, defineCommandHandler } from '@auto-engineer/message-bus';
|
|
2
2
|
import { runAIAgent } from '../agent';
|
|
3
3
|
import createDebug from 'debug';
|
|
4
4
|
|
|
5
5
|
const debug = createDebug('frontend-implementer:implement-client');
|
|
6
6
|
|
|
7
|
-
export const implementClientManifest = {
|
|
8
|
-
handler: () => Promise.resolve({ default: implementClientCommandHandler }),
|
|
9
|
-
description: 'AI implements client',
|
|
10
|
-
usage: 'implement:client <client> <context> <principles> <design>',
|
|
11
|
-
examples: ['$ auto implement:client ./client ./.context ./design-principles.md ./design-system.md'],
|
|
12
|
-
args: [
|
|
13
|
-
{ name: 'client', description: 'Client directory path', required: true },
|
|
14
|
-
{ name: 'context', description: 'Context directory path', required: true },
|
|
15
|
-
{ name: 'principles', description: 'Design principles file', required: true },
|
|
16
|
-
{ name: 'design', description: 'Design system file', required: true },
|
|
17
|
-
],
|
|
18
|
-
};
|
|
19
|
-
|
|
20
7
|
export type ImplementClientCommand = Command<
|
|
21
8
|
'ImplementClient',
|
|
22
9
|
{
|
|
@@ -41,6 +28,41 @@ export type ClientImplementationFailedEvent = Event<
|
|
|
41
28
|
}
|
|
42
29
|
>;
|
|
43
30
|
|
|
31
|
+
export const commandHandler = defineCommandHandler<ImplementClientCommand>({
|
|
32
|
+
name: 'ImplementClient',
|
|
33
|
+
alias: 'implement:client',
|
|
34
|
+
description: 'AI implements client',
|
|
35
|
+
category: 'implement',
|
|
36
|
+
fields: {
|
|
37
|
+
projectDir: {
|
|
38
|
+
description: 'Client directory path',
|
|
39
|
+
required: true,
|
|
40
|
+
},
|
|
41
|
+
iaSchemeDir: {
|
|
42
|
+
description: 'Context directory path',
|
|
43
|
+
required: true,
|
|
44
|
+
},
|
|
45
|
+
designSystemPath: {
|
|
46
|
+
description: 'Design system file',
|
|
47
|
+
required: true,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
examples: [
|
|
51
|
+
'$ auto implement:client --project-dir=./client --ia-scheme-dir=./.context --design-system-path=./design-system.md',
|
|
52
|
+
],
|
|
53
|
+
handle: async (
|
|
54
|
+
command: ImplementClientCommand,
|
|
55
|
+
): Promise<ClientImplementedEvent | ClientImplementationFailedEvent> => {
|
|
56
|
+
const result = await handleImplementClientCommandInternal(command);
|
|
57
|
+
if (result.type === 'ClientImplemented') {
|
|
58
|
+
debug('Client implemented successfully');
|
|
59
|
+
} else {
|
|
60
|
+
debug('Failed: %s', result.data.error);
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
|
|
44
66
|
async function handleImplementClientCommandInternal(
|
|
45
67
|
command: ImplementClientCommand,
|
|
46
68
|
): Promise<ClientImplementedEvent | ClientImplementationFailedEvent> {
|
|
@@ -78,23 +100,5 @@ async function handleImplementClientCommandInternal(
|
|
|
78
100
|
}
|
|
79
101
|
}
|
|
80
102
|
|
|
81
|
-
export const implementClientCommandHandler: CommandHandler<
|
|
82
|
-
ImplementClientCommand,
|
|
83
|
-
ClientImplementedEvent | ClientImplementationFailedEvent
|
|
84
|
-
> = {
|
|
85
|
-
name: 'ImplementClient',
|
|
86
|
-
handle: async (
|
|
87
|
-
command: ImplementClientCommand,
|
|
88
|
-
): Promise<ClientImplementedEvent | ClientImplementationFailedEvent> => {
|
|
89
|
-
const result = await handleImplementClientCommandInternal(command);
|
|
90
|
-
if (result.type === 'ClientImplemented') {
|
|
91
|
-
debug('Client implemented successfully');
|
|
92
|
-
} else {
|
|
93
|
-
debug('Failed: %s', result.data.error);
|
|
94
|
-
}
|
|
95
|
-
return result;
|
|
96
|
-
},
|
|
97
|
-
};
|
|
98
|
-
|
|
99
103
|
// Default export is the command handler
|
|
100
|
-
export default
|
|
104
|
+
export default commandHandler;
|