@auto-engineer/server-implementer 1.139.0 โ 1.140.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/.turbo/turbo-test.log +3 -3
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +17 -0
- package/DEBUG.md +4 -4
- package/README.md +4 -4
- package/dist/src/agent/detectShadowsInSlice.specs.js +6 -6
- package/dist/src/agent/detectShadowsInSlice.specs.js.map +1 -1
- package/dist/src/agent/runAllSlices.d.ts +1 -1
- package/dist/src/agent/runAllSlices.d.ts.map +1 -1
- package/dist/src/agent/runAllSlices.js +7 -7
- package/dist/src/agent/runAllSlices.js.map +1 -1
- package/dist/src/agent/runFlows.d.ts +1 -1
- package/dist/src/agent/runFlows.d.ts.map +1 -1
- package/dist/src/agent/runFlows.js +20 -20
- package/dist/src/agent/runFlows.js.map +1 -1
- package/dist/src/agent/runSlice.d.ts +4 -4
- package/dist/src/agent/runSlice.d.ts.map +1 -1
- package/dist/src/agent/runSlice.js +64 -64
- package/dist/src/agent/runSlice.js.map +1 -1
- package/dist/src/agent/runTests.d.ts +1 -1
- package/dist/src/agent/runTests.d.ts.map +1 -1
- package/dist/src/agent/runTests.js +12 -12
- package/dist/src/agent/runTests.js.map +1 -1
- package/dist/src/commands/implement-server.d.ts +1 -1
- package/dist/src/commands/implement-server.d.ts.map +1 -1
- package/dist/src/commands/implement-server.js +17 -17
- package/dist/src/commands/implement-server.js.map +1 -1
- package/dist/src/commands/implement-slice.d.ts +10 -10
- package/dist/src/commands/implement-slice.d.ts.map +1 -1
- package/dist/src/commands/implement-slice.js +47 -47
- package/dist/src/commands/implement-slice.js.map +1 -1
- package/dist/src/index.d.ts +5 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/prompts/systemPrompt.d.ts +1 -1
- package/dist/src/prompts/systemPrompt.d.ts.map +1 -1
- package/dist/src/prompts/systemPrompt.js +1 -1
- package/dist/src/utils/buildContextSections.js +3 -3
- package/dist/src/utils/buildContextSections.js.map +1 -1
- package/dist/src/utils/buildContextSections.specs.js +6 -6
- package/dist/src/utils/buildContextSections.specs.js.map +1 -1
- package/dist/src/utils/loadContextFiles.d.ts +1 -1
- package/dist/src/utils/loadContextFiles.d.ts.map +1 -1
- package/dist/src/utils/loadContextFiles.js +4 -4
- package/dist/src/utils/loadContextFiles.js.map +1 -1
- package/dist/src/utils/loadContextFiles.specs.js +12 -12
- package/dist/src/utils/loadContextFiles.specs.js.map +1 -1
- package/dist/src/utils/loadSharedContext.d.ts +1 -1
- package/dist/src/utils/loadSharedContext.d.ts.map +1 -1
- package/dist/src/utils/loadSharedContext.js +2 -2
- package/dist/src/utils/loadSharedContext.js.map +1 -1
- package/dist/src/utils/loadSharedContext.specs.js +7 -7
- package/dist/src/utils/loadSharedContext.specs.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/agent/detectShadowsInSlice.specs.ts +6 -6
- package/src/agent/runAllSlices.ts +7 -7
- package/src/agent/runFlows.ts +21 -21
- package/src/agent/runSlice.ts +65 -65
- package/src/agent/runTests.ts +12 -12
- package/src/commands/implement-server.ts +18 -18
- package/src/commands/implement-slice.ts +73 -71
- package/src/index.ts +8 -8
- package/src/prompts/systemPrompt.ts +1 -1
- package/src/utils/buildContextSections.specs.ts +6 -6
- package/src/utils/buildContextSections.ts +3 -3
- package/src/utils/loadContextFiles.specs.ts +12 -12
- package/src/utils/loadContextFiles.ts +4 -4
- package/src/utils/loadSharedContext.specs.ts +7 -7
- package/src/utils/loadSharedContext.ts +2 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @auto-engineer/server-implementer@1.
|
|
2
|
+
> @auto-engineer/server-implementer@1.140.0 build /home/runner/work/auto-engineer/auto-engineer/packages/server-implementer
|
|
3
3
|
> tsc && tsx ../../scripts/fix-esm-imports.ts
|
|
4
4
|
|
|
5
5
|
Fixed ESM imports in dist/
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @auto-engineer/server-implementer@1.
|
|
2
|
+
> @auto-engineer/server-implementer@1.139.0 test /home/runner/work/auto-engineer/auto-engineer/packages/server-implementer
|
|
3
3
|
> vitest run --reporter=dot
|
|
4
4
|
|
|
5
5
|
|
|
@@ -9,6 +9,6 @@
|
|
|
9
9
|
|
|
10
10
|
[2m Test Files [22m [1m[32m7 passed[39m[22m[90m (7)[39m
|
|
11
11
|
[2m Tests [22m [1m[32m46 passed[39m[22m[90m (46)[39m
|
|
12
|
-
[2m Start at [22m
|
|
13
|
-
[2m Duration [22m
|
|
12
|
+
[2m Start at [22m 06:30:41
|
|
13
|
+
[2m Duration [22m 14.83s[2m (transform 1.45s, setup 0ms, collect 26.49s, tests 1.44s, environment 2ms, prepare 5.29s)[22m
|
|
14
14
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> @auto-engineer/server-implementer@1.
|
|
2
|
+
> @auto-engineer/server-implementer@1.139.0 type-check /home/runner/work/auto-engineer/auto-engineer/packages/server-implementer
|
|
3
3
|
> tsc --noEmit
|
|
4
4
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @auto-engineer/server-implementer
|
|
2
2
|
|
|
3
|
+
## 1.140.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`2b1315d`](https://github.com/BeOnAuto/auto-engineer/commit/2b1315d27aa7fbb5137f098c174b7b1daebbb821) Thanks [@github-actions[bot]](https://github.com/github-actions%5Bbot%5D)! - - **react-gen**: domain-aware theming, flexible layouts, chain-of-thought color selection
|
|
8
|
+
- **global**: version packages
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- [`26e5682`](https://github.com/BeOnAuto/auto-engineer/commit/26e56821d984838ba3720baca89c74fc012357c5) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - Renamed core entity hierarchy: JourneyโNarrative, NarrativeโScene, SliceโMoment for clearer domain language
|
|
13
|
+
- Updated DSL functions and schemas to match new naming (narrative(), scene(), moment())
|
|
14
|
+
- Server-generated directory structure now uses narrative-prefixed paths under domain/narratives
|
|
15
|
+
- Narratives are now required on Model and auto-populated by assembleSpecs
|
|
16
|
+
- Updated dependencies [[`2b1315d`](https://github.com/BeOnAuto/auto-engineer/commit/2b1315d27aa7fbb5137f098c174b7b1daebbb821), [`26e5682`](https://github.com/BeOnAuto/auto-engineer/commit/26e56821d984838ba3720baca89c74fc012357c5)]:
|
|
17
|
+
- @auto-engineer/message-bus@1.140.0
|
|
18
|
+
- @auto-engineer/model-factory@1.140.0
|
|
19
|
+
|
|
3
20
|
## 1.139.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/DEBUG.md
CHANGED
|
@@ -40,7 +40,7 @@ Output example:
|
|
|
40
40
|
server-impl:cli CLI started with args: [ './server' ]
|
|
41
41
|
server-impl:cli Server root argument: ./server
|
|
42
42
|
server-impl:cli Resolved server root: /Users/project/server
|
|
43
|
-
server-impl:cli Flows directory: /Users/project/server/src/domain/
|
|
43
|
+
server-impl:cli Flows directory: /Users/project/server/src/domain/narratives
|
|
44
44
|
server-impl:cli Flows directory exists, starting flow runner
|
|
45
45
|
server-impl:cli Flow runner completed
|
|
46
46
|
```
|
|
@@ -54,7 +54,7 @@ DEBUG=server-impl:flows pnpm implement:server
|
|
|
54
54
|
Output example:
|
|
55
55
|
|
|
56
56
|
```
|
|
57
|
-
server-impl:flows Running flows from base directory: /Users/project/server/src/domain/
|
|
57
|
+
server-impl:flows Running flows from base directory: /Users/project/server/src/domain/narratives
|
|
58
58
|
server-impl:flows Found 3 flow directories
|
|
59
59
|
server-impl:flows Flow directories: [ 'shopping-assistant', 'order-management', 'user-profile' ]
|
|
60
60
|
server-impl:flows All 3 flows processed successfully
|
|
@@ -70,10 +70,10 @@ Output example:
|
|
|
70
70
|
|
|
71
71
|
```
|
|
72
72
|
server-impl:flows:flow Processing flow: shopping-assistant
|
|
73
|
-
server-impl:flows:flow Path: /Users/project/server/src/domain/
|
|
73
|
+
server-impl:flows:flow Path: /Users/project/server/src/domain/narratives/shopping-assistant
|
|
74
74
|
server-impl:flows:flow Flow shopping-assistant completed successfully
|
|
75
75
|
server-impl:flows:flow Processing flow: order-management
|
|
76
|
-
server-impl:flows:flow Path: /Users/project/server/src/domain/
|
|
76
|
+
server-impl:flows:flow Path: /Users/project/server/src/domain/narratives/order-management
|
|
77
77
|
server-impl:flows:flow Flow order-management completed successfully
|
|
78
78
|
```
|
|
79
79
|
|
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ console.log(result);
|
|
|
47
47
|
// โ { type: 'ServerImplemented', data: { serverDirectory: './server' } }
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
The command processes all flows in `src/domain/
|
|
50
|
+
The command processes all flows in `src/domain/narratives/` and implements TODO-marked files.
|
|
51
51
|
|
|
52
52
|
---
|
|
53
53
|
|
|
@@ -57,7 +57,7 @@ The command processes all flows in `src/domain/flows/` and implements TODO-marke
|
|
|
57
57
|
|
|
58
58
|
```bash
|
|
59
59
|
auto implement:server --server-directory=./server
|
|
60
|
-
auto implement:slice --slice-path=./server/src/domain/
|
|
60
|
+
auto implement:slice --slice-path=./server/src/domain/narratives/order/place-order
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
### Run Programmatically
|
|
@@ -68,7 +68,7 @@ import { handleImplementSliceCommand } from '@auto-engineer/server-implementer';
|
|
|
68
68
|
const result = await handleImplementSliceCommand({
|
|
69
69
|
type: 'ImplementSlice',
|
|
70
70
|
data: {
|
|
71
|
-
slicePath: './server/src/domain/
|
|
71
|
+
slicePath: './server/src/domain/narratives/order/place-order',
|
|
72
72
|
aiOptions: { maxTokens: 4000 },
|
|
73
73
|
},
|
|
74
74
|
requestId: 'req-123',
|
|
@@ -81,7 +81,7 @@ const result = await handleImplementSliceCommand({
|
|
|
81
81
|
const retryResult = await handleImplementSliceCommand({
|
|
82
82
|
type: 'ImplementSlice',
|
|
83
83
|
data: {
|
|
84
|
-
slicePath: './server/src/domain/
|
|
84
|
+
slicePath: './server/src/domain/narratives/order/place-order',
|
|
85
85
|
context: {
|
|
86
86
|
previousOutputs: 'TypeError: Property "status" is missing...',
|
|
87
87
|
attemptNumber: 2,
|
|
@@ -2,8 +2,8 @@ import { mkdtemp, rm, writeFile } from 'node:fs/promises';
|
|
|
2
2
|
import { tmpdir } from 'node:os';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
5
|
-
import {
|
|
6
|
-
describe('
|
|
5
|
+
import { detectShadowsInMoment } from './runSlice.js';
|
|
6
|
+
describe('detectShadowsInMoment', () => {
|
|
7
7
|
let tempDir;
|
|
8
8
|
beforeEach(async () => {
|
|
9
9
|
tempDir = await mkdtemp(path.join(tmpdir(), 'shadow-test-'));
|
|
@@ -13,12 +13,12 @@ describe('detectShadowsInSlice', () => {
|
|
|
13
13
|
});
|
|
14
14
|
it('returns empty results for clean files', async () => {
|
|
15
15
|
await writeFile(path.join(tempDir, 'projection.ts'), `import type { MyState } from './state.js';\nconst x = 1;\n`);
|
|
16
|
-
const result = await
|
|
16
|
+
const result = await detectShadowsInMoment(tempDir);
|
|
17
17
|
expect(result).toEqual({ errors: '', failedFiles: [] });
|
|
18
18
|
});
|
|
19
19
|
it('detects shadow in a file and returns error with file path', async () => {
|
|
20
20
|
await writeFile(path.join(tempDir, 'projection.ts'), `import type { MyState } from './state.js';\ntype MyState = { name: string };\n`);
|
|
21
|
-
const result = await
|
|
21
|
+
const result = await detectShadowsInMoment(tempDir);
|
|
22
22
|
expect(result).toEqual({
|
|
23
23
|
errors: 'CONTRACT VIOLATION in projection.ts: Types [MyState] are imported but redefined locally. Remove local definitions and use the imports.',
|
|
24
24
|
failedFiles: [path.join(tempDir, 'projection.ts')],
|
|
@@ -26,13 +26,13 @@ describe('detectShadowsInSlice', () => {
|
|
|
26
26
|
});
|
|
27
27
|
it('ignores spec files', async () => {
|
|
28
28
|
await writeFile(path.join(tempDir, 'projection.specs.ts'), `import type { MyState } from './state.js';\ntype MyState = { name: string };\n`);
|
|
29
|
-
const result = await
|
|
29
|
+
const result = await detectShadowsInMoment(tempDir);
|
|
30
30
|
expect(result).toEqual({ errors: '', failedFiles: [] });
|
|
31
31
|
});
|
|
32
32
|
it('reports multiple files with shadows', async () => {
|
|
33
33
|
await writeFile(path.join(tempDir, 'a.ts'), `import type { Alpha } from './types.js';\ntype Alpha = { x: number };\n`);
|
|
34
34
|
await writeFile(path.join(tempDir, 'b.ts'), `import type { Beta } from './types.js';\ninterface Beta { y: string }\n`);
|
|
35
|
-
const result = await
|
|
35
|
+
const result = await detectShadowsInMoment(tempDir);
|
|
36
36
|
expect(result.failedFiles).toEqual([path.join(tempDir, 'a.ts'), path.join(tempDir, 'b.ts')]);
|
|
37
37
|
expect(result.errors).toContain('CONTRACT VIOLATION in a.ts');
|
|
38
38
|
expect(result.errors).toContain('CONTRACT VIOLATION in b.ts');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detectShadowsInSlice.specs.js","sourceRoot":"","sources":["../../../src/agent/detectShadowsInSlice.specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"detectShadowsInSlice.specs.js","sourceRoot":"","sources":["../../../src/agent/detectShadowsInSlice.specs.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function runAllMoments(sceneDir: string): Promise<void>;
|
|
2
2
|
//# sourceMappingURL=runAllSlices.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runAllSlices.d.ts","sourceRoot":"","sources":["../../../src/agent/runAllSlices.ts"],"names":[],"mappings":"AAIA,wBAAsB,
|
|
1
|
+
{"version":3,"file":"runAllSlices.d.ts","sourceRoot":"","sources":["../../../src/agent/runAllSlices.ts"],"names":[],"mappings":"AAIA,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOnE"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import fg from 'fast-glob';
|
|
3
|
-
import {
|
|
4
|
-
export async function
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
for (const
|
|
8
|
-
await
|
|
3
|
+
import { runMoment } from './runSlice.js';
|
|
4
|
+
export async function runAllMoments(sceneDir) {
|
|
5
|
+
const sceneName = path.basename(sceneDir);
|
|
6
|
+
const momentDirs = await fg(`${sceneDir}/**/*/`, { onlyDirectories: true });
|
|
7
|
+
for (const momentDir of momentDirs) {
|
|
8
|
+
await runMoment(momentDir, sceneName);
|
|
9
9
|
}
|
|
10
|
-
console.log('โ
All
|
|
10
|
+
console.log('โ
All moments processed');
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=runAllSlices.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runAllSlices.js","sourceRoot":"","sources":["../../../src/agent/runAllSlices.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,WAAW,CAAC;AAC3B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"runAllSlices.js","sourceRoot":"","sources":["../../../src/agent/runAllSlices.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,WAAW,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,QAAgB;IAClD,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC1C,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC,GAAG,QAAQ,QAAQ,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5E,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function runScenes(baseDir: string): Promise<void>;
|
|
2
2
|
//# sourceMappingURL=runFlows.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runFlows.d.ts","sourceRoot":"","sources":["../../../src/agent/runFlows.ts"],"names":[],"mappings":"AAQA,wBAAsB,
|
|
1
|
+
{"version":3,"file":"runFlows.d.ts","sourceRoot":"","sources":["../../../src/agent/runFlows.ts"],"names":[],"mappings":"AAQA,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoC9D"}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import createDebug from 'debug';
|
|
3
3
|
import fg from 'fast-glob';
|
|
4
|
-
import {
|
|
5
|
-
const debug = createDebug('auto:server-implementer:
|
|
6
|
-
const
|
|
7
|
-
export async function
|
|
8
|
-
debug('Running
|
|
9
|
-
const
|
|
4
|
+
import { runAllMoments } from './runAllSlices.js';
|
|
5
|
+
const debug = createDebug('auto:server-implementer:scenes');
|
|
6
|
+
const debugScene = createDebug('auto:server-implementer:scenes:scene');
|
|
7
|
+
export async function runScenes(baseDir) {
|
|
8
|
+
debug('Running scenes from base directory: %s', baseDir);
|
|
9
|
+
const sceneDirs = await fg('*', {
|
|
10
10
|
cwd: baseDir,
|
|
11
11
|
onlyDirectories: true,
|
|
12
12
|
absolute: true,
|
|
13
13
|
});
|
|
14
|
-
debug('Found %d
|
|
15
|
-
if (
|
|
16
|
-
debug('
|
|
14
|
+
debug('Found %d scene directories', sceneDirs.length);
|
|
15
|
+
if (sceneDirs.length > 0) {
|
|
16
|
+
debug('Scene directories: %o', sceneDirs.map((d) => path.basename(d)));
|
|
17
17
|
}
|
|
18
|
-
console.log(`๐ Found ${
|
|
19
|
-
for (const
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
console.log(`๐ Processing
|
|
18
|
+
console.log(`๐ Found ${sceneDirs.length} scenes`);
|
|
19
|
+
for (const sceneDir of sceneDirs) {
|
|
20
|
+
const sceneName = path.basename(sceneDir);
|
|
21
|
+
debugScene('Processing scene: %s', sceneName);
|
|
22
|
+
debugScene(' Path: %s', sceneDir);
|
|
23
|
+
console.log(`๐ Processing scene: ${sceneName}`);
|
|
24
24
|
try {
|
|
25
|
-
await
|
|
26
|
-
|
|
25
|
+
await runAllMoments(sceneDir);
|
|
26
|
+
debugScene('Scene %s completed successfully', sceneName);
|
|
27
27
|
}
|
|
28
28
|
catch (error) {
|
|
29
|
-
|
|
29
|
+
debugScene('ERROR: Scene %s failed: %O', sceneName, error);
|
|
30
30
|
throw error;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
debug('All %d
|
|
34
|
-
console.log('โ
All
|
|
33
|
+
debug('All %d scenes processed successfully', sceneDirs.length);
|
|
34
|
+
console.log('โ
All scenes processed');
|
|
35
35
|
}
|
|
36
36
|
//# sourceMappingURL=runFlows.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runFlows.js","sourceRoot":"","sources":["../../../src/agent/runFlows.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,WAAW,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,MAAM,WAAW,CAAC;AAC3B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"runFlows.js","sourceRoot":"","sources":["../../../src/agent/runFlows.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,WAAW,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,MAAM,WAAW,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,KAAK,GAAG,WAAW,CAAC,gCAAgC,CAAC,CAAC;AAC5D,MAAM,UAAU,GAAG,WAAW,CAAC,sCAAsC,CAAC,CAAC;AAEvE,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAe;IAC7C,KAAK,CAAC,wCAAwC,EAAE,OAAO,CAAC,CAAC;IAEzD,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,GAAG,EAAE;QAC9B,GAAG,EAAE,OAAO;QACZ,eAAe,EAAE,IAAI;QACrB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,KAAK,CAAC,4BAA4B,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACtD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,KAAK,CACH,uBAAuB,EACvB,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CACvC,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,YAAY,SAAS,CAAC,MAAM,SAAS,CAAC,CAAC;IACnD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC1C,UAAU,CAAC,sBAAsB,EAAE,SAAS,CAAC,CAAC;QAC9C,UAAU,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAEnC,OAAO,CAAC,GAAG,CAAC,wBAAwB,SAAS,EAAE,CAAC,CAAC;QAEjD,IAAI,CAAC;YACH,MAAM,aAAa,CAAC,QAAQ,CAAC,CAAC;YAC9B,UAAU,CAAC,iCAAiC,EAAE,SAAS,CAAC,CAAC;QAC3D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,UAAU,CAAC,4BAA4B,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;YAC3D,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED,KAAK,CAAC,sCAAsC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAChE,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -16,13 +16,13 @@ export type VitestTestResult = {
|
|
|
16
16
|
status: string;
|
|
17
17
|
assertionResults: VitestAssertionResult[];
|
|
18
18
|
};
|
|
19
|
-
export declare function
|
|
20
|
-
export declare function runTestsAndTypecheck(
|
|
21
|
-
export declare function
|
|
19
|
+
export declare function runMoment(momentDir: string, scene: string): Promise<void>;
|
|
20
|
+
export declare function runTestsAndTypecheck(momentDir: string): Promise<TestAndTypecheckResult>;
|
|
21
|
+
export declare function detectShadowsInMoment(momentDir: string): Promise<{
|
|
22
22
|
errors: string;
|
|
23
23
|
failedFiles: string[];
|
|
24
24
|
}>;
|
|
25
|
-
export declare function
|
|
25
|
+
export declare function detectAssertionsInMoment(momentDir: string): Promise<{
|
|
26
26
|
errors: string;
|
|
27
27
|
failedFiles: string[];
|
|
28
28
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runSlice.d.ts","sourceRoot":"","sources":["../../../src/agent/runSlice.ts"],"names":[],"mappings":"AAeA,KAAK,sBAAsB,GAAG;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,qBAAqB,EAAE,CAAC;CAC3C,CAAC;AAEF,wBAAsB,
|
|
1
|
+
{"version":3,"file":"runSlice.d.ts","sourceRoot":"","sources":["../../../src/agent/runSlice.ts"],"names":[],"mappings":"AAeA,KAAK,sBAAsB,GAAG;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,qBAAqB,EAAE,CAAC;CAC3C,CAAC;AAEF,wBAAsB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkB/E;AAiHD,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,CA0B7F;AAED,wBAAsB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAajH;AAED,wBAAsB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAapH"}
|
|
@@ -12,28 +12,28 @@ import { extractCodeBlock } from '../utils/extractCodeBlock.js';
|
|
|
12
12
|
import { findFilesToImplement } from '../utils/findFilesToImplement.js';
|
|
13
13
|
import { loadContextFiles } from '../utils/loadContextFiles.js';
|
|
14
14
|
import { runTests } from './runTests.js';
|
|
15
|
-
export async function
|
|
16
|
-
const
|
|
17
|
-
console.log(`โ๏ธ Implementing slice: ${
|
|
18
|
-
const contextFiles = await loadContextFiles(
|
|
15
|
+
export async function runMoment(momentDir, scene) {
|
|
16
|
+
const momentName = path.basename(momentDir);
|
|
17
|
+
console.log(`โ๏ธ Implementing slice: ${momentName} for scene: ${scene}`);
|
|
18
|
+
const contextFiles = await loadContextFiles(momentDir);
|
|
19
19
|
const filesToImplement = findFilesToImplement(contextFiles, needsImplementation);
|
|
20
20
|
for (const [targetFile] of filesToImplement) {
|
|
21
|
-
await implementFileFromAI(
|
|
21
|
+
await implementFileFromAI(momentDir, targetFile, contextFiles);
|
|
22
22
|
}
|
|
23
|
-
const result = await runTestsAndTypecheck(
|
|
24
|
-
reportTestAndTypecheckResults(
|
|
23
|
+
const result = await runTestsAndTypecheck(momentDir);
|
|
24
|
+
reportTestAndTypecheckResults(momentDir, scene, result);
|
|
25
25
|
if (result.success) {
|
|
26
26
|
console.log(`โ
All tests and checks passed on first attempt.`);
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
await retryFailedFiles(
|
|
29
|
+
await retryFailedFiles(momentDir, scene, result);
|
|
30
30
|
if (result.failedTestFiles.length > 0) {
|
|
31
|
-
await retryFailedTests(
|
|
31
|
+
await retryFailedTests(momentDir, scene, result);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
async function retryFailedFiles(
|
|
34
|
+
async function retryFailedFiles(momentDir, scene, initialResult, depth = 0) {
|
|
35
35
|
const MAX_RECURSION_DEPTH = 2;
|
|
36
|
-
let contextFiles = await loadContextFiles(
|
|
36
|
+
let contextFiles = await loadContextFiles(momentDir);
|
|
37
37
|
let result = initialResult;
|
|
38
38
|
for (let attempt = 1; attempt <= 5; attempt++) {
|
|
39
39
|
if (result.failedTypecheckFiles.length === 0) {
|
|
@@ -41,18 +41,18 @@ async function retryFailedFiles(sliceDir, flow, initialResult, depth = 0) {
|
|
|
41
41
|
break;
|
|
42
42
|
}
|
|
43
43
|
console.log(`๐ Typecheck retry attempt ${attempt} for ${result.failedTypecheckFiles.length} files...`);
|
|
44
|
-
contextFiles = await loadContextFiles(
|
|
44
|
+
contextFiles = await loadContextFiles(momentDir);
|
|
45
45
|
for (const filePath of result.failedTypecheckFiles) {
|
|
46
46
|
const fileName = path.basename(filePath);
|
|
47
47
|
const retryPrompt = buildRetryPrompt(fileName, contextFiles, result.testErrors, result.typecheckErrors);
|
|
48
|
-
console.log(`๐ง Retrying typecheck error in ${fileName} in
|
|
48
|
+
console.log(`๐ง Retrying typecheck error in ${fileName} in scene ${scene}...`);
|
|
49
49
|
const { text: aiOutput } = await generateText({ model: createModelFromEnv(), prompt: retryPrompt });
|
|
50
50
|
const cleanedCode = extractCodeBlock(aiOutput);
|
|
51
|
-
await writeFile(path.join(
|
|
51
|
+
await writeFile(path.join(momentDir, fileName), cleanedCode, 'utf-8');
|
|
52
52
|
console.log(`โป๏ธ Updated ${fileName} to fix typecheck errors`);
|
|
53
53
|
}
|
|
54
|
-
result = await runTestsAndTypecheck(
|
|
55
|
-
reportTestAndTypecheckResults(
|
|
54
|
+
result = await runTestsAndTypecheck(momentDir);
|
|
55
|
+
reportTestAndTypecheckResults(momentDir, scene, result);
|
|
56
56
|
}
|
|
57
57
|
if (result.failedTypecheckFiles.length > 0) {
|
|
58
58
|
if (depth >= MAX_RECURSION_DEPTH) {
|
|
@@ -65,10 +65,10 @@ async function retryFailedFiles(sliceDir, flow, initialResult, depth = 0) {
|
|
|
65
65
|
testErrors: '', // Clear test errors since we're only fixing typecheck
|
|
66
66
|
failedTestFiles: [], // Clear failed test files
|
|
67
67
|
};
|
|
68
|
-
result = await retryFailedFiles(
|
|
68
|
+
result = await retryFailedFiles(momentDir, scene, typecheckOnlyResult, depth + 1);
|
|
69
69
|
// After fixing typecheck, re-run everything to get fresh results
|
|
70
|
-
const freshResult = await runTestsAndTypecheck(
|
|
71
|
-
reportTestAndTypecheckResults(
|
|
70
|
+
const freshResult = await runTestsAndTypecheck(momentDir);
|
|
71
|
+
reportTestAndTypecheckResults(momentDir, scene, freshResult);
|
|
72
72
|
result = freshResult;
|
|
73
73
|
if (result.failedTestFiles.length === 0) {
|
|
74
74
|
console.log(`โ
All test issues resolved after fixing type errors.`);
|
|
@@ -117,8 +117,8 @@ ${typeErrors || 'None'}
|
|
|
117
117
|
Return only the corrected full contents of ${targetFile}, no commentary, no markdown.
|
|
118
118
|
`.trim();
|
|
119
119
|
}
|
|
120
|
-
async function implementFileFromAI(
|
|
121
|
-
const filePath = path.join(
|
|
120
|
+
async function implementFileFromAI(momentDir, targetFile, contextFiles) {
|
|
121
|
+
const filePath = path.join(momentDir, targetFile);
|
|
122
122
|
const prompt = buildInitialPrompt(targetFile, contextFiles);
|
|
123
123
|
console.log(`๐ฎ Analysing and Implementing ${targetFile}`);
|
|
124
124
|
const { text: aiOutput } = await generateText({ model: createModelFromEnv(), prompt });
|
|
@@ -126,12 +126,12 @@ async function implementFileFromAI(sliceDir, targetFile, contextFiles) {
|
|
|
126
126
|
await writeFile(filePath, cleanedCode, 'utf-8');
|
|
127
127
|
console.log(`โป Implemented ${targetFile}`);
|
|
128
128
|
}
|
|
129
|
-
export async function runTestsAndTypecheck(
|
|
130
|
-
const rootDir = await findProjectRoot(
|
|
131
|
-
const testResult = await runTests(
|
|
132
|
-
const typecheckResult = await runTypecheck(
|
|
133
|
-
const shadowResult = await
|
|
134
|
-
const assertionResult = await
|
|
129
|
+
export async function runTestsAndTypecheck(momentDir) {
|
|
130
|
+
const rootDir = await findProjectRoot(momentDir);
|
|
131
|
+
const testResult = await runTests(momentDir, rootDir);
|
|
132
|
+
const typecheckResult = await runTypecheck(momentDir, rootDir);
|
|
133
|
+
const shadowResult = await detectShadowsInMoment(momentDir);
|
|
134
|
+
const assertionResult = await detectAssertionsInMoment(momentDir);
|
|
135
135
|
const failedTypecheckFiles = [
|
|
136
136
|
...typecheckResult.failedTypecheckFiles,
|
|
137
137
|
...shadowResult.failedFiles,
|
|
@@ -152,36 +152,36 @@ export async function runTestsAndTypecheck(sliceDir) {
|
|
|
152
152
|
typecheckErrors,
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
|
-
export async function
|
|
156
|
-
const files = await fg(['*.ts'], { cwd:
|
|
155
|
+
export async function detectShadowsInMoment(momentDir) {
|
|
156
|
+
const files = await fg(['*.ts'], { cwd: momentDir, ignore: ['*.spec.ts', '*.specs.ts', '*.test.ts'] });
|
|
157
157
|
const errors = [];
|
|
158
158
|
const failedFiles = [];
|
|
159
159
|
for (const file of files) {
|
|
160
|
-
const content = await readFile(path.join(
|
|
160
|
+
const content = await readFile(path.join(momentDir, file), 'utf-8');
|
|
161
161
|
const warning = buildShadowWarning(content, file);
|
|
162
162
|
if (warning.length > 0) {
|
|
163
163
|
errors.push(warning);
|
|
164
|
-
failedFiles.push(path.join(
|
|
164
|
+
failedFiles.push(path.join(momentDir, file));
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
return { errors: errors.join('\n'), failedFiles };
|
|
168
168
|
}
|
|
169
|
-
export async function
|
|
170
|
-
const files = await fg(['*.ts'], { cwd:
|
|
169
|
+
export async function detectAssertionsInMoment(momentDir) {
|
|
170
|
+
const files = await fg(['*.ts'], { cwd: momentDir, ignore: ['*.spec.ts', '*.specs.ts', '*.test.ts'] });
|
|
171
171
|
const errors = [];
|
|
172
172
|
const failedFiles = [];
|
|
173
173
|
for (const file of files) {
|
|
174
|
-
const content = await readFile(path.join(
|
|
174
|
+
const content = await readFile(path.join(momentDir, file), 'utf-8');
|
|
175
175
|
const warning = buildTypeAssertionWarning(content, file);
|
|
176
176
|
if (warning.length > 0) {
|
|
177
177
|
errors.push(warning);
|
|
178
|
-
failedFiles.push(path.join(
|
|
178
|
+
failedFiles.push(path.join(momentDir, file));
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
return { errors: errors.join('\n'), failedFiles };
|
|
182
182
|
}
|
|
183
|
-
async function retryFailedTests(
|
|
184
|
-
let contextFiles = await loadContextFiles(
|
|
183
|
+
async function retryFailedTests(momentDir, scene, result) {
|
|
184
|
+
let contextFiles = await loadContextFiles(momentDir);
|
|
185
185
|
for (let attempt = 1; attempt <= 5; attempt++) {
|
|
186
186
|
if (result.failedTestFiles.length === 0) {
|
|
187
187
|
console.log(`โ
Test failures resolved after attempt ${attempt - 1}`);
|
|
@@ -221,32 +221,32 @@ No commentary or markdown outside the code block.
|
|
|
221
221
|
break;
|
|
222
222
|
}
|
|
223
223
|
const [, fileName, code] = match;
|
|
224
|
-
const absPath = path.join(
|
|
224
|
+
const absPath = path.join(momentDir, fileName.trim());
|
|
225
225
|
console.log('๐ง Applying AI fix to:', absPath);
|
|
226
226
|
await writeFile(absPath, code.trim(), 'utf-8');
|
|
227
227
|
console.log(`โป๏ธ Updated ${fileName.trim()} to fix tests`);
|
|
228
|
-
contextFiles = await loadContextFiles(
|
|
229
|
-
result = await runTestsAndTypecheck(
|
|
230
|
-
reportTestAndTypecheckResults(
|
|
228
|
+
contextFiles = await loadContextFiles(momentDir);
|
|
229
|
+
result = await runTestsAndTypecheck(momentDir);
|
|
230
|
+
reportTestAndTypecheckResults(momentDir, scene, result);
|
|
231
231
|
// If test fix introduced a new type error, handle it before continuing
|
|
232
232
|
if (result.failedTypecheckFiles.length > 0) {
|
|
233
233
|
console.log(`โ ๏ธ Fixing tests caused typecheck errors. Retrying typecheck fixes...`);
|
|
234
|
-
result = await retryFailedFiles(
|
|
234
|
+
result = await retryFailedFiles(momentDir, scene, result);
|
|
235
235
|
if (result.failedTestFiles.length === 0) {
|
|
236
236
|
console.log(`โ
All test issues resolved after fixing type errors.`);
|
|
237
237
|
break;
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
contextFiles = await loadContextFiles(
|
|
240
|
+
contextFiles = await loadContextFiles(momentDir);
|
|
241
241
|
}
|
|
242
242
|
if (result.failedTestFiles.length > 0) {
|
|
243
243
|
console.error(`โ Some test failures remain after retry attempts.`);
|
|
244
244
|
for (const file of result.failedTestFiles) {
|
|
245
|
-
console.log(` - ${path.relative(
|
|
245
|
+
console.log(` - ${path.relative(momentDir, file)}`);
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
|
-
async function runTypecheck(
|
|
249
|
+
async function runTypecheck(momentDir, rootDir) {
|
|
250
250
|
try {
|
|
251
251
|
const result = await execa('npx', ['tsc', '--noEmit'], {
|
|
252
252
|
cwd: rootDir,
|
|
@@ -255,7 +255,7 @@ async function runTypecheck(sliceDir, rootDir) {
|
|
|
255
255
|
});
|
|
256
256
|
const output = (result.stdout ?? '') + (result.stderr ?? '');
|
|
257
257
|
if (result.exitCode !== 0 || output.includes('error')) {
|
|
258
|
-
return await processTypecheckOutput(output,
|
|
258
|
+
return await processTypecheckOutput(output, momentDir, rootDir);
|
|
259
259
|
}
|
|
260
260
|
return { success: true, typecheckErrors: '', failedTypecheckFiles: [] };
|
|
261
261
|
}
|
|
@@ -263,7 +263,7 @@ async function runTypecheck(sliceDir, rootDir) {
|
|
|
263
263
|
const execaErr = err;
|
|
264
264
|
const output = (execaErr.stdout ?? '') + (execaErr.stderr ?? '');
|
|
265
265
|
console.error('TypeScript execution error:', output);
|
|
266
|
-
const files = await fg(['*.ts'], { cwd:
|
|
266
|
+
const files = await fg(['*.ts'], { cwd: momentDir, absolute: true });
|
|
267
267
|
return { success: false, typecheckErrors: output, failedTypecheckFiles: files };
|
|
268
268
|
}
|
|
269
269
|
}
|
|
@@ -274,46 +274,46 @@ function getTypecheckPatterns() {
|
|
|
274
274
|
/^([^:]+\.ts):\d+:\d+\s+-\s+error/gm,
|
|
275
275
|
];
|
|
276
276
|
}
|
|
277
|
-
function extractFailedFiles(output, patterns, rootDir,
|
|
277
|
+
function extractFailedFiles(output, patterns, rootDir, momentDir) {
|
|
278
278
|
const failedFiles = new Set();
|
|
279
279
|
for (const pattern of patterns) {
|
|
280
280
|
for (const match of output.matchAll(pattern)) {
|
|
281
281
|
const filePath = match[1] ? path.resolve(rootDir, match[1]) : '';
|
|
282
282
|
const notNodeModules = !filePath.includes('node_modules');
|
|
283
|
-
const
|
|
284
|
-
if (notNodeModules &&
|
|
283
|
+
const inMoment = momentDir === undefined || filePath.startsWith(momentDir);
|
|
284
|
+
if (notNodeModules && inMoment) {
|
|
285
285
|
failedFiles.add(filePath);
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
return Array.from(failedFiles);
|
|
290
290
|
}
|
|
291
|
-
async function processTypecheckOutput(output,
|
|
292
|
-
const relativePath = path.relative(rootDir,
|
|
291
|
+
async function processTypecheckOutput(output, momentDir, rootDir) {
|
|
292
|
+
const relativePath = path.relative(rootDir, momentDir);
|
|
293
293
|
const filtered = output
|
|
294
294
|
.split('\n')
|
|
295
295
|
.filter((line) => {
|
|
296
296
|
const hasError = line.includes('error TS') || line.includes('): error');
|
|
297
297
|
const notNodeModules = !line.includes('node_modules');
|
|
298
|
-
const
|
|
299
|
-
return hasError && notNodeModules &&
|
|
298
|
+
const hasMomentPath = line.includes(relativePath) || line.includes(momentDir);
|
|
299
|
+
return hasError && notNodeModules && hasMomentPath;
|
|
300
300
|
})
|
|
301
301
|
.join('\n');
|
|
302
302
|
if (filtered.trim() === '') {
|
|
303
303
|
return { success: true, typecheckErrors: '', failedTypecheckFiles: [] };
|
|
304
304
|
}
|
|
305
|
-
const failedFiles = await processTypecheckFailure(filtered, rootDir,
|
|
305
|
+
const failedFiles = await processTypecheckFailure(filtered, rootDir, momentDir);
|
|
306
306
|
return {
|
|
307
307
|
success: false,
|
|
308
308
|
typecheckErrors: filtered,
|
|
309
309
|
failedTypecheckFiles: failedFiles,
|
|
310
310
|
};
|
|
311
311
|
}
|
|
312
|
-
async function processTypecheckFailure(output, rootDir,
|
|
312
|
+
async function processTypecheckFailure(output, rootDir, momentDir) {
|
|
313
313
|
const patterns = getTypecheckPatterns();
|
|
314
|
-
let failed = extractFailedFiles(output, patterns, rootDir,
|
|
314
|
+
let failed = extractFailedFiles(output, patterns, rootDir, momentDir);
|
|
315
315
|
if (failed.length === 0 && output.includes('error')) {
|
|
316
|
-
failed = await fg(['*.ts'], { cwd:
|
|
316
|
+
failed = await fg(['*.ts'], { cwd: momentDir, absolute: true });
|
|
317
317
|
}
|
|
318
318
|
return failed;
|
|
319
319
|
}
|
|
@@ -330,22 +330,22 @@ async function findProjectRoot(startDir) {
|
|
|
330
330
|
}
|
|
331
331
|
throw new Error('โ Could not find project root');
|
|
332
332
|
}
|
|
333
|
-
function reportTestAndTypecheckResults(
|
|
334
|
-
const
|
|
333
|
+
function reportTestAndTypecheckResults(momentDir, scene, result) {
|
|
334
|
+
const momentName = path.basename(momentDir);
|
|
335
335
|
if (result.success) {
|
|
336
|
-
console.log(`โ
All Tests and checks passed for: ${
|
|
336
|
+
console.log(`โ
All Tests and checks passed for: ${momentName} in scene ${scene}`);
|
|
337
337
|
return;
|
|
338
338
|
}
|
|
339
|
-
console.error(`โ ${
|
|
339
|
+
console.error(`โ ${momentName} in scene ${scene} failed tests or type-checks.`);
|
|
340
340
|
if (result.failedTestFiles.length) {
|
|
341
|
-
const files = result.failedTestFiles.map((f) => path.relative(
|
|
341
|
+
const files = result.failedTestFiles.map((f) => path.relative(momentDir, f));
|
|
342
342
|
console.log(`๐งช Failed test files: ${files.join(', ')}`);
|
|
343
343
|
if (result.testErrors) {
|
|
344
344
|
console.log(`๐ Test errors:\n${result.testErrors}`);
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
347
|
if (result.failedTypecheckFiles.length) {
|
|
348
|
-
const files = result.failedTypecheckFiles.map((f) => path.relative(
|
|
348
|
+
const files = result.failedTypecheckFiles.map((f) => path.relative(momentDir, f));
|
|
349
349
|
console.log(`๐ Failed typecheck files: ${files.join(', ')}`);
|
|
350
350
|
if (result.typecheckErrors) {
|
|
351
351
|
console.log(`๐ Typecheck errors:\n${result.typecheckErrors}`);
|