@auto-engineer/server-checks 0.1.1
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/CHANGELOG.md +39 -0
- package/LICENSE +10 -0
- package/README.md +91 -0
- package/dist/cli-manifest.d.ts +3 -0
- package/dist/cli-manifest.d.ts.map +1 -0
- package/dist/cli-manifest.js +12 -0
- package/dist/cli-manifest.js.map +1 -0
- package/dist/commands/check-lint.d.ts +36 -0
- package/dist/commands/check-lint.d.ts.map +1 -0
- package/dist/commands/check-lint.js +231 -0
- package/dist/commands/check-lint.js.map +1 -0
- package/dist/commands/check-tests.d.ts +35 -0
- package/dist/commands/check-tests.d.ts.map +1 -0
- package/dist/commands/check-tests.js +178 -0
- package/dist/commands/check-tests.js.map +1 -0
- package/dist/commands/check-types.d.ts +32 -0
- package/dist/commands/check-types.d.ts.map +1 -0
- package/dist/commands/check-types.js +174 -0
- package/dist/commands/check-types.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/package.json +40 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @auto-engineer/server-checks
|
|
2
|
+
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- renamed packages
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @auto-engineer/message-bus@0.5.2
|
|
10
|
+
|
|
11
|
+
## 0.2.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- version bump for testihng
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @auto-engineer/message-bus@0.5.1
|
|
18
|
+
|
|
19
|
+
## 0.2.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- Major overhaul of the plugin system
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
- @auto-engineer/message-bus@0.5.0
|
|
29
|
+
|
|
30
|
+
## 0.1.0
|
|
31
|
+
|
|
32
|
+
### Minor Changes
|
|
33
|
+
|
|
34
|
+
- • All cli commands now use commands and emit events on the bus
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Updated dependencies
|
|
39
|
+
- @auto-engineer/message-bus@0.4.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Elastic License 2.0
|
|
2
|
+
|
|
3
|
+
Copyright 2024 Sam Hatoum
|
|
4
|
+
|
|
5
|
+
This software and associated documentation files (the "Software") are licensed under the Elastic License 2.0 (the "License"). You may not use this file except in compliance with the License.
|
|
6
|
+
|
|
7
|
+
You may obtain a copy of the License at:
|
|
8
|
+
https://www.elastic.co/licensing/elastic-license
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# @auto-engineer/server-checks
|
|
2
|
+
|
|
3
|
+
Server validation commands for Auto Engineer projects. Plugin for the Auto Engineer CLI that provides commands for checking types, tests, and linting that can be orchestrated through event-driven workflows.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
This is a plugin for the Auto Engineer CLI. Install both the CLI and this plugin:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @auto-engineer/cli
|
|
11
|
+
npm install @auto-engineer/server-checks
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Configuration
|
|
15
|
+
|
|
16
|
+
Add this plugin to your `auto.config.ts`:
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
export default {
|
|
20
|
+
plugins: [
|
|
21
|
+
'@auto-engineer/server-checks',
|
|
22
|
+
// ... other plugins
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Commands
|
|
28
|
+
|
|
29
|
+
This plugin provides the following commands:
|
|
30
|
+
|
|
31
|
+
- `check:types` - Check TypeScript types in the server code
|
|
32
|
+
- `check:lint` - Run linter checks on the server code
|
|
33
|
+
- `check:tests` - Run tests on the server code
|
|
34
|
+
|
|
35
|
+
### CheckTypes
|
|
36
|
+
|
|
37
|
+
Runs TypeScript type checking on a target directory or project.
|
|
38
|
+
|
|
39
|
+
Command: `CheckTypes`
|
|
40
|
+
Events:
|
|
41
|
+
|
|
42
|
+
- `TypeCheckPassed` - Emitted when all types are valid
|
|
43
|
+
- `TypeCheckFailed` - Emitted when type errors are found
|
|
44
|
+
|
|
45
|
+
### CheckTests
|
|
46
|
+
|
|
47
|
+
Runs test suite using Vitest on a target directory or project.
|
|
48
|
+
|
|
49
|
+
Command: `CheckTests`
|
|
50
|
+
Events:
|
|
51
|
+
|
|
52
|
+
- `TestsCheckPassed` - Emitted when all tests pass
|
|
53
|
+
- `TestsCheckFailed` - Emitted when tests fail
|
|
54
|
+
|
|
55
|
+
### CheckLint
|
|
56
|
+
|
|
57
|
+
Runs ESLint checks on TypeScript files in a target directory or project.
|
|
58
|
+
|
|
59
|
+
Command: `CheckLint`
|
|
60
|
+
Events:
|
|
61
|
+
|
|
62
|
+
- `LintCheckPassed` - Emitted when no lint issues found
|
|
63
|
+
- `LintCheckFailed` - Emitted when lint issues are detected
|
|
64
|
+
|
|
65
|
+
## Usage
|
|
66
|
+
|
|
67
|
+
Each command can be imported and used in event-driven workflows:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { handleCheckTypesCommand, handleCheckTestsCommand, handleCheckLintCommand } from '@auto-engineer/server-checks';
|
|
71
|
+
|
|
72
|
+
// Run type checking
|
|
73
|
+
const typeResult = await handleCheckTypesCommand({
|
|
74
|
+
type: 'CheckTypes',
|
|
75
|
+
data: {
|
|
76
|
+
targetDirectory: './src/domain/flows/order',
|
|
77
|
+
scope: 'slice', // or 'project'
|
|
78
|
+
},
|
|
79
|
+
timestamp: new Date(),
|
|
80
|
+
requestId: 'req-123',
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// Handle result events
|
|
84
|
+
if (typeResult.type === 'TypeCheckFailed') {
|
|
85
|
+
// Retry implementation with error context
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Integration with Event-Driven Workflows
|
|
90
|
+
|
|
91
|
+
These commands are designed to work with the `@auto-engineer/message-bus` for event-driven orchestration. Failed checks can trigger re-implementation with error context for self-healing workflows.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-manifest.d.ts","sourceRoot":"","sources":["../src/cli-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAKrE,eAAO,MAAM,YAAY,EAAE,WAO1B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { checkTypesManifest } from './commands/check-types.js';
|
|
2
|
+
import { checkLintManifest } from './commands/check-lint.js';
|
|
3
|
+
import { checkTestsManifest } from './commands/check-tests.js';
|
|
4
|
+
export const CLI_MANIFEST = {
|
|
5
|
+
category: '@auto-engineer/server-checks',
|
|
6
|
+
commands: {
|
|
7
|
+
'check:types': checkTypesManifest,
|
|
8
|
+
'check:lint': checkLintManifest,
|
|
9
|
+
'check:tests': checkTestsManifest,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=cli-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-manifest.js","sourceRoot":"","sources":["../src/cli-manifest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,CAAC,MAAM,YAAY,GAAgB;IACvC,QAAQ,EAAE,8BAA8B;IACxC,QAAQ,EAAE;QACR,aAAa,EAAE,kBAAkB;QACjC,YAAY,EAAE,iBAAiB;QAC/B,aAAa,EAAE,kBAAkB;KAClC;CACF,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type CommandHandler, type Command, type Event } from '@auto-engineer/message-bus';
|
|
2
|
+
export declare const checkLintManifest: {
|
|
3
|
+
handler: () => Promise<typeof import("./check-lint")>;
|
|
4
|
+
description: string;
|
|
5
|
+
usage: string;
|
|
6
|
+
examples: string[];
|
|
7
|
+
args: {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
required: boolean;
|
|
11
|
+
}[];
|
|
12
|
+
options: {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
export type CheckLintCommand = Command<'CheckLint', {
|
|
18
|
+
targetDirectory: string;
|
|
19
|
+
scope?: 'slice' | 'project';
|
|
20
|
+
fix?: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
export type LintCheckPassedEvent = Event<'LintCheckPassed', {
|
|
23
|
+
targetDirectory: string;
|
|
24
|
+
filesChecked: number;
|
|
25
|
+
filesFixed?: number;
|
|
26
|
+
}>;
|
|
27
|
+
export type LintCheckFailedEvent = Event<'LintCheckFailed', {
|
|
28
|
+
targetDirectory: string;
|
|
29
|
+
errors: string;
|
|
30
|
+
filesWithIssues: string[];
|
|
31
|
+
errorCount: number;
|
|
32
|
+
warningCount: number;
|
|
33
|
+
}>;
|
|
34
|
+
export declare const checkLintCommandHandler: CommandHandler<CheckLintCommand>;
|
|
35
|
+
export default checkLintCommandHandler;
|
|
36
|
+
//# sourceMappingURL=check-lint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-lint.d.ts","sourceRoot":"","sources":["../../src/commands/check-lint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAY3F,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;CAU7B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,OAAO,CACpC,WAAW,EACX;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CACF,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,KAAK,CACtC,iBAAiB,EACjB;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CACF,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,KAAK,CACtC,iBAAiB,EACjB;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB,CACF,CAAC;AAiFF,eAAO,MAAM,uBAAuB,EAAE,cAAc,CAAC,gBAAgB,CAwKpE,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { execa } from 'execa';
|
|
3
|
+
import fg from 'fast-glob';
|
|
4
|
+
import { access } from 'fs/promises';
|
|
5
|
+
import createDebug from 'debug';
|
|
6
|
+
const debug = createDebug('server-checks:lint');
|
|
7
|
+
const debugHandler = createDebug('server-checks:lint:handler');
|
|
8
|
+
const debugProcess = createDebug('server-checks:lint:process');
|
|
9
|
+
const debugResult = createDebug('server-checks:lint:result');
|
|
10
|
+
export const checkLintManifest = {
|
|
11
|
+
handler: () => import('./check-lint.js'),
|
|
12
|
+
description: 'ESLint with optional auto-fix',
|
|
13
|
+
usage: 'check:lint <directory> [--fix]',
|
|
14
|
+
examples: ['$ auto check:lint ./server', '$ auto check:lint ./server --fix'],
|
|
15
|
+
args: [{ name: 'directory', description: 'Directory to lint', required: true }],
|
|
16
|
+
options: [
|
|
17
|
+
{ name: '--fix', description: 'Automatically fix linting issues' },
|
|
18
|
+
{ name: '--scope <scope>', description: 'Lint scope: slice (default) or project' },
|
|
19
|
+
],
|
|
20
|
+
};
|
|
21
|
+
async function findProjectRoot(startDir) {
|
|
22
|
+
let dir = startDir;
|
|
23
|
+
while (dir !== path.dirname(dir)) {
|
|
24
|
+
try {
|
|
25
|
+
await access(path.join(dir, 'package.json'));
|
|
26
|
+
return dir;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
dir = path.dirname(dir);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
throw new Error('Could not find project root (no package.json found)');
|
|
33
|
+
}
|
|
34
|
+
function parseFilesWithIssues(output) {
|
|
35
|
+
const filesWithIssues = [];
|
|
36
|
+
const filePattern = /^([^\s].+\.ts)$/gm;
|
|
37
|
+
for (const match of output.matchAll(filePattern)) {
|
|
38
|
+
const filePath = match[1];
|
|
39
|
+
if (!filePath.includes('node_modules')) {
|
|
40
|
+
filesWithIssues.push(filePath);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return [...new Set(filesWithIssues)]; // Remove duplicates
|
|
44
|
+
}
|
|
45
|
+
function parseErrorCounts(output) {
|
|
46
|
+
const summaryMatch = output.match(/✖\s+(\d+)\s+problem[s]?\s+\((\d+)\s+error[s]?,?\s*(\d+)?\s*warning[s]?\)/);
|
|
47
|
+
if (summaryMatch) {
|
|
48
|
+
return {
|
|
49
|
+
errorCount: parseInt(summaryMatch[2], 10),
|
|
50
|
+
warningCount: summaryMatch[3] ? parseInt(summaryMatch[3], 10) : 0,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
// Fallback: count individual errors and warnings
|
|
54
|
+
const errorMatches = output.match(/\berror\b/gi);
|
|
55
|
+
const warningMatches = output.match(/\bwarning\b/gi);
|
|
56
|
+
return {
|
|
57
|
+
errorCount: errorMatches ? errorMatches.length : 0,
|
|
58
|
+
warningCount: warningMatches ? warningMatches.length : 0,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function extractFormattedErrors(output) {
|
|
62
|
+
const errorLines = [];
|
|
63
|
+
const lines = output.split('\n');
|
|
64
|
+
let inFileSection = false;
|
|
65
|
+
for (const line of lines) {
|
|
66
|
+
if (line.match(/^[^\s].+\.ts$/)) {
|
|
67
|
+
inFileSection = true;
|
|
68
|
+
errorLines.push(line);
|
|
69
|
+
}
|
|
70
|
+
else if (inFileSection && line.match(/^\s+\d+:\d+/)) {
|
|
71
|
+
errorLines.push(line);
|
|
72
|
+
}
|
|
73
|
+
else if (line.trim() === '') {
|
|
74
|
+
inFileSection = false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return errorLines.join('\n');
|
|
78
|
+
}
|
|
79
|
+
function parseEslintOutput(output) {
|
|
80
|
+
const filesWithIssues = parseFilesWithIssues(output);
|
|
81
|
+
const { errorCount, warningCount } = parseErrorCounts(output);
|
|
82
|
+
const formattedErrors = extractFormattedErrors(output);
|
|
83
|
+
return {
|
|
84
|
+
filesWithIssues,
|
|
85
|
+
errorCount,
|
|
86
|
+
warningCount,
|
|
87
|
+
formattedErrors,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export const checkLintCommandHandler = {
|
|
91
|
+
name: 'CheckLint',
|
|
92
|
+
// eslint-disable-next-line complexity
|
|
93
|
+
handle: async (command) => {
|
|
94
|
+
debug('CommandHandler executing for CheckLint');
|
|
95
|
+
const { targetDirectory, scope = 'slice', fix = false } = command.data;
|
|
96
|
+
debug('Handling CheckLintCommand');
|
|
97
|
+
debug(' Target directory: %s', targetDirectory);
|
|
98
|
+
debug(' Scope: %s', scope);
|
|
99
|
+
debug(' Auto-fix: %s', fix);
|
|
100
|
+
debug(' Request ID: %s', command.requestId);
|
|
101
|
+
debug(' Correlation ID: %s', command.correlationId ?? 'none');
|
|
102
|
+
try {
|
|
103
|
+
const targetDir = path.resolve(targetDirectory);
|
|
104
|
+
const projectRoot = await findProjectRoot(targetDir);
|
|
105
|
+
debugHandler('Resolved paths:');
|
|
106
|
+
debugHandler(' Target directory: %s', targetDir);
|
|
107
|
+
debugHandler(' Project root: %s', projectRoot);
|
|
108
|
+
// Find TypeScript files to lint
|
|
109
|
+
const pattern = scope === 'slice' ? path.join(targetDir, '**/*.ts') : 'src/**/*.ts';
|
|
110
|
+
const files = await fg([pattern], {
|
|
111
|
+
cwd: projectRoot,
|
|
112
|
+
absolute: false,
|
|
113
|
+
});
|
|
114
|
+
if (files.length === 0) {
|
|
115
|
+
debugResult('No TypeScript files found to lint');
|
|
116
|
+
return {
|
|
117
|
+
type: 'LintCheckPassed',
|
|
118
|
+
data: {
|
|
119
|
+
targetDirectory,
|
|
120
|
+
filesChecked: 0,
|
|
121
|
+
},
|
|
122
|
+
timestamp: new Date(),
|
|
123
|
+
requestId: command.requestId,
|
|
124
|
+
correlationId: command.correlationId,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
debugProcess('Running ESLint...');
|
|
128
|
+
debugProcess('Files to check: %d', files.length);
|
|
129
|
+
// Build ESLint command
|
|
130
|
+
const args = ['eslint'];
|
|
131
|
+
if (scope === 'slice') {
|
|
132
|
+
// Lint only files in target directory
|
|
133
|
+
const relativePath = path.relative(projectRoot, targetDir);
|
|
134
|
+
args.push(`${relativePath}/**/*.ts`);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
args.push('src/**/*.ts');
|
|
138
|
+
}
|
|
139
|
+
args.push('--max-warnings', '0');
|
|
140
|
+
// Look for ESLint config
|
|
141
|
+
const configPath = path.join(projectRoot, 'eslint.config.ts');
|
|
142
|
+
if (await access(configPath)
|
|
143
|
+
.then(() => true)
|
|
144
|
+
.catch(() => false)) {
|
|
145
|
+
args.push('--config', configPath);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
// Try parent directory config
|
|
149
|
+
const parentConfig = path.join(projectRoot, '..', '..', 'eslint.config.ts');
|
|
150
|
+
if (await access(parentConfig)
|
|
151
|
+
.then(() => true)
|
|
152
|
+
.catch(() => false)) {
|
|
153
|
+
args.push('--config', parentConfig);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (fix) {
|
|
157
|
+
args.push('--fix');
|
|
158
|
+
}
|
|
159
|
+
const result = await execa('npx', args, {
|
|
160
|
+
cwd: projectRoot,
|
|
161
|
+
stdio: 'pipe',
|
|
162
|
+
reject: false,
|
|
163
|
+
});
|
|
164
|
+
const output = (result.stdout ?? '') + (result.stderr ?? '');
|
|
165
|
+
if (result.exitCode !== 0 && output.includes('error')) {
|
|
166
|
+
const { filesWithIssues, errorCount, warningCount, formattedErrors } = parseEslintOutput(output);
|
|
167
|
+
debugResult('Lint check failed');
|
|
168
|
+
debugResult('Files with issues: %d', filesWithIssues.length);
|
|
169
|
+
debugResult('Errors: %d, Warnings: %d', errorCount, warningCount);
|
|
170
|
+
return {
|
|
171
|
+
type: 'LintCheckFailed',
|
|
172
|
+
data: {
|
|
173
|
+
targetDirectory,
|
|
174
|
+
errors: formattedErrors || output.substring(0, 1000),
|
|
175
|
+
filesWithIssues: filesWithIssues.map((f) => {
|
|
176
|
+
// Make paths relative to target directory
|
|
177
|
+
if (path.isAbsolute(f)) {
|
|
178
|
+
return path.relative(targetDir, f);
|
|
179
|
+
}
|
|
180
|
+
return f;
|
|
181
|
+
}),
|
|
182
|
+
errorCount,
|
|
183
|
+
warningCount,
|
|
184
|
+
},
|
|
185
|
+
timestamp: new Date(),
|
|
186
|
+
requestId: command.requestId,
|
|
187
|
+
correlationId: command.correlationId,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
debugResult('Lint check passed');
|
|
191
|
+
debugResult('Files checked: %d', files.length);
|
|
192
|
+
const successData = {
|
|
193
|
+
targetDirectory,
|
|
194
|
+
filesChecked: files.length,
|
|
195
|
+
};
|
|
196
|
+
if (fix) {
|
|
197
|
+
// Count fixed files by checking the output for "fixed" messages
|
|
198
|
+
const fixedMatch = output.match(/(\d+)\s+error[s]?\s+.*potentially fixable/);
|
|
199
|
+
if (fixedMatch) {
|
|
200
|
+
successData.filesFixed = parseInt(fixedMatch[1], 10);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
type: 'LintCheckPassed',
|
|
205
|
+
data: successData,
|
|
206
|
+
timestamp: new Date(),
|
|
207
|
+
requestId: command.requestId,
|
|
208
|
+
correlationId: command.correlationId,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
debug('ERROR: Exception caught: %O', error);
|
|
213
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
214
|
+
return {
|
|
215
|
+
type: 'LintCheckFailed',
|
|
216
|
+
data: {
|
|
217
|
+
targetDirectory,
|
|
218
|
+
errors: errorMessage,
|
|
219
|
+
filesWithIssues: [],
|
|
220
|
+
errorCount: 0,
|
|
221
|
+
warningCount: 0,
|
|
222
|
+
},
|
|
223
|
+
timestamp: new Date(),
|
|
224
|
+
requestId: command.requestId,
|
|
225
|
+
correlationId: command.correlationId,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
export default checkLintCommandHandler;
|
|
231
|
+
//# sourceMappingURL=check-lint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-lint.js","sourceRoot":"","sources":["../../src/commands/check-lint.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAA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a,EAAE,OAAO,CAAC,aAAa;aACrC,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type CommandHandler, type Command, type Event } from '@auto-engineer/message-bus';
|
|
2
|
+
export declare const checkTestsManifest: {
|
|
3
|
+
handler: () => Promise<typeof import("./check-tests")>;
|
|
4
|
+
description: string;
|
|
5
|
+
usage: string;
|
|
6
|
+
examples: string[];
|
|
7
|
+
args: {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
required: boolean;
|
|
11
|
+
}[];
|
|
12
|
+
options: {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
export type CheckTestsCommand = Command<'CheckTests', {
|
|
18
|
+
targetDirectory: string;
|
|
19
|
+
scope?: 'slice' | 'project';
|
|
20
|
+
}>;
|
|
21
|
+
export type TestsCheckPassedEvent = Event<'TestsCheckPassed', {
|
|
22
|
+
targetDirectory: string;
|
|
23
|
+
testsRun: number;
|
|
24
|
+
testsPassed: number;
|
|
25
|
+
}>;
|
|
26
|
+
export type TestsCheckFailedEvent = Event<'TestsCheckFailed', {
|
|
27
|
+
targetDirectory: string;
|
|
28
|
+
errors: string;
|
|
29
|
+
failedTests: string[];
|
|
30
|
+
testsRun: number;
|
|
31
|
+
testsFailed: number;
|
|
32
|
+
}>;
|
|
33
|
+
export declare const checkTestsCommandHandler: CommandHandler<CheckTestsCommand>;
|
|
34
|
+
export default checkTestsCommandHandler;
|
|
35
|
+
//# sourceMappingURL=check-tests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-tests.d.ts","sourceRoot":"","sources":["../../src/commands/check-tests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAY3F,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;CAO9B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,OAAO,CACrC,YAAY,EACZ;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7B,CACF,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,KAAK,CACvC,kBAAkB,EAClB;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,CACF,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,KAAK,CACvC,kBAAkB,EAClB;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,CACF,CAAC;AAmDF,eAAO,MAAM,wBAAwB,EAAE,cAAc,CAAC,iBAAiB,CAwItE,CAAC;AAGF,eAAe,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { execa } from 'execa';
|
|
3
|
+
import fg from 'fast-glob';
|
|
4
|
+
import { access } from 'fs/promises';
|
|
5
|
+
import createDebug from 'debug';
|
|
6
|
+
const debug = createDebug('bacserverkend-checks:tests');
|
|
7
|
+
const debugHandler = createDebug('server-checks:tests:handler');
|
|
8
|
+
const debugProcess = createDebug('server-checks:tests:process');
|
|
9
|
+
const debugResult = createDebug('server-checks:tests:result');
|
|
10
|
+
export const checkTestsManifest = {
|
|
11
|
+
handler: () => import('./check-tests.js'),
|
|
12
|
+
description: 'Run Vitest test suites',
|
|
13
|
+
usage: 'check:tests <directory>',
|
|
14
|
+
examples: ['$ auto check:tests ./server', '$ auto check:tests ./server --scope project'],
|
|
15
|
+
args: [{ name: 'directory', description: 'Directory containing tests', required: true }],
|
|
16
|
+
options: [{ name: '--scope <scope>', description: 'Test scope: slice (default) or project' }],
|
|
17
|
+
};
|
|
18
|
+
async function findProjectRoot(startDir) {
|
|
19
|
+
let dir = startDir;
|
|
20
|
+
while (dir !== path.dirname(dir)) {
|
|
21
|
+
try {
|
|
22
|
+
await access(path.join(dir, 'package.json'));
|
|
23
|
+
return dir;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
dir = path.dirname(dir);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
throw new Error('Could not find project root (no package.json found)');
|
|
30
|
+
}
|
|
31
|
+
function parseVitestOutput(output) {
|
|
32
|
+
const failedTests = [];
|
|
33
|
+
let testsRun = 0;
|
|
34
|
+
let testsPassed = 0;
|
|
35
|
+
let testsFailed = 0;
|
|
36
|
+
// Parse test results from output
|
|
37
|
+
const failPattern = /FAIL\s+(.+\.specs?\.ts)/g;
|
|
38
|
+
for (const match of output.matchAll(failPattern)) {
|
|
39
|
+
failedTests.push(match[1]);
|
|
40
|
+
}
|
|
41
|
+
// Try to extract test counts from summary
|
|
42
|
+
const summaryMatch = output.match(/Tests\s+(\d+)\s+passed(?:\s+\|\s+(\d+)\s+failed)?/);
|
|
43
|
+
if (summaryMatch) {
|
|
44
|
+
testsPassed = parseInt(summaryMatch[1], 10);
|
|
45
|
+
testsFailed = summaryMatch[2] ? parseInt(summaryMatch[2], 10) : 0;
|
|
46
|
+
testsRun = testsPassed + testsFailed;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
// Fallback: count PASS and FAIL lines
|
|
50
|
+
const passMatches = output.match(/PASS/g);
|
|
51
|
+
const failMatches = output.match(/FAIL/g);
|
|
52
|
+
testsPassed = passMatches ? passMatches.length : 0;
|
|
53
|
+
testsFailed = failMatches ? failMatches.length : 0;
|
|
54
|
+
testsRun = testsPassed + testsFailed;
|
|
55
|
+
}
|
|
56
|
+
return { failedTests, testsRun, testsPassed, testsFailed };
|
|
57
|
+
}
|
|
58
|
+
export const checkTestsCommandHandler = {
|
|
59
|
+
name: 'CheckTests',
|
|
60
|
+
// eslint-disable-next-line complexity
|
|
61
|
+
handle: async (command) => {
|
|
62
|
+
debug('CommandHandler executing for CheckTests');
|
|
63
|
+
const { targetDirectory, scope = 'slice' } = command.data;
|
|
64
|
+
debug('Handling CheckTestsCommand');
|
|
65
|
+
debug(' Target directory: %s', targetDirectory);
|
|
66
|
+
debug(' Scope: %s', scope);
|
|
67
|
+
debug(' Request ID: %s', command.requestId);
|
|
68
|
+
debug(' Correlation ID: %s', command.correlationId ?? 'none');
|
|
69
|
+
try {
|
|
70
|
+
const targetDir = path.resolve(targetDirectory);
|
|
71
|
+
const projectRoot = await findProjectRoot(targetDir);
|
|
72
|
+
debugHandler('Resolved paths:');
|
|
73
|
+
debugHandler(' Target directory: %s', targetDir);
|
|
74
|
+
debugHandler(' Project root: %s', projectRoot);
|
|
75
|
+
// Find test files
|
|
76
|
+
const testPattern = scope === 'slice' ? path.join(targetDir, '**/*.specs.ts') : '**/*.specs.ts';
|
|
77
|
+
const testFiles = await fg([testPattern], {
|
|
78
|
+
cwd: projectRoot,
|
|
79
|
+
absolute: true,
|
|
80
|
+
});
|
|
81
|
+
if (testFiles.length === 0) {
|
|
82
|
+
debugResult('No test files found');
|
|
83
|
+
return {
|
|
84
|
+
type: 'TestsCheckPassed',
|
|
85
|
+
data: {
|
|
86
|
+
targetDirectory,
|
|
87
|
+
testsRun: 0,
|
|
88
|
+
testsPassed: 0,
|
|
89
|
+
},
|
|
90
|
+
timestamp: new Date(),
|
|
91
|
+
requestId: command.requestId,
|
|
92
|
+
correlationId: command.correlationId,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
debugProcess('Running tests with Vitest...');
|
|
96
|
+
debugProcess('Test files: %d', testFiles.length);
|
|
97
|
+
// Run tests with Vitest
|
|
98
|
+
const args = ['vitest', 'run', '--reporter=verbose'];
|
|
99
|
+
if (scope === 'slice') {
|
|
100
|
+
// Run only tests in the target directory
|
|
101
|
+
args.push(targetDir);
|
|
102
|
+
}
|
|
103
|
+
const result = await execa('npx', args, {
|
|
104
|
+
cwd: projectRoot,
|
|
105
|
+
stdio: 'pipe',
|
|
106
|
+
reject: false,
|
|
107
|
+
env: {
|
|
108
|
+
...process.env,
|
|
109
|
+
CI: 'true', // Ensures non-interactive mode
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
const output = (result.stdout ?? '') + (result.stderr ?? '');
|
|
113
|
+
const { failedTests, testsRun, testsPassed, testsFailed } = parseVitestOutput(output);
|
|
114
|
+
if (result.exitCode !== 0 || failedTests.length > 0) {
|
|
115
|
+
debugResult('Tests failed');
|
|
116
|
+
debugResult('Failed tests: %d', testsFailed);
|
|
117
|
+
debugResult('Failed files: %s', failedTests.join(', '));
|
|
118
|
+
// Extract only error messages, not full output
|
|
119
|
+
const errorLines = output
|
|
120
|
+
.split('\n')
|
|
121
|
+
.filter((line) => (line.includes('✓') === false && line.includes('✗')) ||
|
|
122
|
+
line.includes('Error:') ||
|
|
123
|
+
line.includes('AssertionError') ||
|
|
124
|
+
line.includes('expected') ||
|
|
125
|
+
line.includes('received') ||
|
|
126
|
+
line.includes('FAIL'))
|
|
127
|
+
.join('\n');
|
|
128
|
+
return {
|
|
129
|
+
type: 'TestsCheckFailed',
|
|
130
|
+
data: {
|
|
131
|
+
targetDirectory,
|
|
132
|
+
errors: errorLines || output.substring(0, 1000),
|
|
133
|
+
failedTests: failedTests.map((f) => path.relative(targetDir, f)),
|
|
134
|
+
testsRun,
|
|
135
|
+
testsFailed,
|
|
136
|
+
},
|
|
137
|
+
timestamp: new Date(),
|
|
138
|
+
requestId: command.requestId,
|
|
139
|
+
correlationId: command.correlationId,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
debugResult('All tests passed');
|
|
143
|
+
debugResult('Tests run: %d', testsRun);
|
|
144
|
+
debugResult('Tests passed: %d', testsPassed);
|
|
145
|
+
return {
|
|
146
|
+
type: 'TestsCheckPassed',
|
|
147
|
+
data: {
|
|
148
|
+
targetDirectory,
|
|
149
|
+
testsRun,
|
|
150
|
+
testsPassed,
|
|
151
|
+
},
|
|
152
|
+
timestamp: new Date(),
|
|
153
|
+
requestId: command.requestId,
|
|
154
|
+
correlationId: command.correlationId,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
debug('ERROR: Exception caught: %O', error);
|
|
159
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
160
|
+
return {
|
|
161
|
+
type: 'TestsCheckFailed',
|
|
162
|
+
data: {
|
|
163
|
+
targetDirectory,
|
|
164
|
+
errors: errorMessage,
|
|
165
|
+
failedTests: [],
|
|
166
|
+
testsRun: 0,
|
|
167
|
+
testsFailed: 0,
|
|
168
|
+
},
|
|
169
|
+
timestamp: new Date(),
|
|
170
|
+
requestId: command.requestId,
|
|
171
|
+
correlationId: command.correlationId,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
// Default export for CLI usage - just export the handler
|
|
177
|
+
export default checkTestsCommandHandler;
|
|
178
|
+
//# sourceMappingURL=check-tests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-tests.js","sourceRoot":"","sources":["../../src/commands/check-tests.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,MAAM,WAAW,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,WAAW,MAAM,OAAO,CAAC;AAEhC,MAAM,KAAK,GAAG,WAAW,CAAC,4BAA4B,CAAC,CAAC;AACxD,MAAM,YAAY,GAAG,WAAW,CAAC,6BAA6B,CAAC,CAAC;AAChE,MAAM,YAAY,GAAG,WAAW,CAAC,6BAA6B,CAAC,CAAC;AAChE,MAAM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AAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;YAEvF,OAAO;gBACL,IAAI,EAAE,kBAAkB;gBACxB,IAAI,EAAE;oBACJ,eAAe;oBACf,MAAM,EAAE,YAAY;oBACpB,WAAW,EAAE,EAAE;oBACf,QAAQ,EAAE,CAAC;oBACX,WAAW,EAAE,CAAC;iBACf;gBACD,SAAS,EAAE,IAAI,IAAI,EAAE;gBACrB,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,aAAa,EAAE,OAAO,CAAC,aAAa;aACrC,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC;AAEF,yDAAyD;AACzD,eAAe,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type CommandHandler, type Command, type Event } from '@auto-engineer/message-bus';
|
|
2
|
+
export declare const checkTypesManifest: {
|
|
3
|
+
handler: () => Promise<typeof import("./check-types")>;
|
|
4
|
+
description: string;
|
|
5
|
+
usage: string;
|
|
6
|
+
examples: string[];
|
|
7
|
+
args: {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
required: boolean;
|
|
11
|
+
}[];
|
|
12
|
+
options: {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
export type CheckTypesCommand = Command<'CheckTypes', {
|
|
18
|
+
targetDirectory: string;
|
|
19
|
+
scope?: 'slice' | 'project';
|
|
20
|
+
}>;
|
|
21
|
+
export type TypeCheckPassedEvent = Event<'TypeCheckPassed', {
|
|
22
|
+
targetDirectory: string;
|
|
23
|
+
checkedFiles: number;
|
|
24
|
+
}>;
|
|
25
|
+
export type TypeCheckFailedEvent = Event<'TypeCheckFailed', {
|
|
26
|
+
targetDirectory: string;
|
|
27
|
+
errors: string;
|
|
28
|
+
failedFiles: string[];
|
|
29
|
+
}>;
|
|
30
|
+
export declare const checkTypesCommandHandler: CommandHandler<CheckTypesCommand>;
|
|
31
|
+
export default checkTypesCommandHandler;
|
|
32
|
+
//# sourceMappingURL=check-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-types.d.ts","sourceRoot":"","sources":["../../src/commands/check-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAY3F,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;CAO9B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,OAAO,CACrC,YAAY,EACZ;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7B,CACF,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,KAAK,CACtC,iBAAiB,EACjB;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;CACtB,CACF,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,KAAK,CACtC,iBAAiB,EACjB;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CACF,CAAC;AAyCF,eAAO,MAAM,wBAAwB,EAAE,cAAc,CAAC,iBAAiB,CAwItE,CAAC;AAGF,eAAe,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { execa } from 'execa';
|
|
3
|
+
import fg from 'fast-glob';
|
|
4
|
+
import { access } from 'fs/promises';
|
|
5
|
+
import createDebug from 'debug';
|
|
6
|
+
const debug = createDebug('server-checks:types');
|
|
7
|
+
const debugHandler = createDebug('server-checks:types:handler');
|
|
8
|
+
const debugProcess = createDebug('server-checks:types:process');
|
|
9
|
+
const debugResult = createDebug('server-checks:types:result');
|
|
10
|
+
export const checkTypesManifest = {
|
|
11
|
+
handler: () => import('./check-types.js'),
|
|
12
|
+
description: 'TypeScript type checking',
|
|
13
|
+
usage: 'check:types <directory>',
|
|
14
|
+
examples: ['$ auto check:types ./server', '$ auto check:types ./server --scope project'],
|
|
15
|
+
args: [{ name: 'directory', description: 'Directory to check', required: true }],
|
|
16
|
+
options: [{ name: '--scope <scope>', description: 'Check scope: slice (default) or project' }],
|
|
17
|
+
};
|
|
18
|
+
async function findProjectRoot(startDir) {
|
|
19
|
+
let dir = startDir;
|
|
20
|
+
while (dir !== path.dirname(dir)) {
|
|
21
|
+
try {
|
|
22
|
+
await access(path.join(dir, 'package.json'));
|
|
23
|
+
await access(path.join(dir, 'tsconfig.json'));
|
|
24
|
+
return dir;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
dir = path.dirname(dir);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
throw new Error('Could not find project root (no package.json or tsconfig.json found)');
|
|
31
|
+
}
|
|
32
|
+
function extractFailedFiles(output, rootDir, targetDir) {
|
|
33
|
+
const failedFiles = new Set();
|
|
34
|
+
const patterns = [
|
|
35
|
+
/^([^:]+\.ts)\(\d+,\d+\): error/gm,
|
|
36
|
+
/error TS\d+: .+ '([^']+\.ts)'/gm,
|
|
37
|
+
/^([^:]+\.ts):\d+:\d+ - error/gm,
|
|
38
|
+
];
|
|
39
|
+
for (const pattern of patterns) {
|
|
40
|
+
for (const match of output.matchAll(pattern)) {
|
|
41
|
+
const filePath = match[1] ? path.resolve(rootDir, match[1]) : '';
|
|
42
|
+
const notNodeModules = !filePath.includes('node_modules');
|
|
43
|
+
const inTarget = targetDir === undefined || filePath.startsWith(targetDir);
|
|
44
|
+
if (notNodeModules && inTarget) {
|
|
45
|
+
failedFiles.add(filePath);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return Array.from(failedFiles);
|
|
50
|
+
}
|
|
51
|
+
export const checkTypesCommandHandler = {
|
|
52
|
+
name: 'CheckTypes',
|
|
53
|
+
// eslint-disable-next-line complexity
|
|
54
|
+
handle: async (command) => {
|
|
55
|
+
debug('CommandHandler executing for CheckTypes');
|
|
56
|
+
const { targetDirectory, scope = 'slice' } = command.data;
|
|
57
|
+
debug('Handling CheckTypesCommand');
|
|
58
|
+
debug(' Target directory: %s', targetDirectory);
|
|
59
|
+
debug(' Scope: %s', scope);
|
|
60
|
+
debug(' Request ID: %s', command.requestId);
|
|
61
|
+
debug(' Correlation ID: %s', command.correlationId ?? 'none');
|
|
62
|
+
try {
|
|
63
|
+
const targetDir = path.resolve(targetDirectory);
|
|
64
|
+
const projectRoot = await findProjectRoot(targetDir);
|
|
65
|
+
debugHandler('Resolved paths:');
|
|
66
|
+
debugHandler(' Target directory: %s', targetDir);
|
|
67
|
+
debugHandler(' Project root: %s', projectRoot);
|
|
68
|
+
debugProcess('Running TypeScript compiler check...');
|
|
69
|
+
const result = await execa('npx', ['tsc', '--noEmit'], {
|
|
70
|
+
cwd: projectRoot,
|
|
71
|
+
stdio: 'pipe',
|
|
72
|
+
reject: false,
|
|
73
|
+
});
|
|
74
|
+
const output = (result.stdout ?? '') + (result.stderr ?? '');
|
|
75
|
+
if (result.exitCode !== 0 || output.includes('error')) {
|
|
76
|
+
// Filter errors to only those in the target directory if scope is 'slice'
|
|
77
|
+
const failedFiles = extractFailedFiles(output, projectRoot, scope === 'slice' ? targetDir : undefined);
|
|
78
|
+
if (scope === 'slice') {
|
|
79
|
+
// Filter output to only show errors from target directory
|
|
80
|
+
const relativePath = path.relative(projectRoot, targetDir);
|
|
81
|
+
const filteredOutput = output
|
|
82
|
+
.split('\n')
|
|
83
|
+
.filter((line) => {
|
|
84
|
+
const hasError = line.includes('error TS') || line.includes('): error');
|
|
85
|
+
const notNodeModules = !line.includes('node_modules');
|
|
86
|
+
const hasTargetPath = line.includes(relativePath) || line.includes(targetDir);
|
|
87
|
+
return hasError && notNodeModules && hasTargetPath;
|
|
88
|
+
})
|
|
89
|
+
.join('\n');
|
|
90
|
+
if (filteredOutput.trim() === '') {
|
|
91
|
+
// No errors in the target directory specifically
|
|
92
|
+
const files = await fg(['**/*.ts'], { cwd: targetDir });
|
|
93
|
+
debugResult('Type check passed (no errors in target directory)');
|
|
94
|
+
debugResult('Checked files: %d', files.length);
|
|
95
|
+
return {
|
|
96
|
+
type: 'TypeCheckPassed',
|
|
97
|
+
data: {
|
|
98
|
+
targetDirectory,
|
|
99
|
+
checkedFiles: files.length,
|
|
100
|
+
},
|
|
101
|
+
timestamp: new Date(),
|
|
102
|
+
requestId: command.requestId,
|
|
103
|
+
correlationId: command.correlationId,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
debugResult('Type check failed');
|
|
107
|
+
debugResult('Failed files: %d', failedFiles.length);
|
|
108
|
+
debugResult('Errors: %s', filteredOutput.substring(0, 500));
|
|
109
|
+
return {
|
|
110
|
+
type: 'TypeCheckFailed',
|
|
111
|
+
data: {
|
|
112
|
+
targetDirectory,
|
|
113
|
+
errors: filteredOutput,
|
|
114
|
+
failedFiles: failedFiles.map((f) => path.relative(targetDir, f)),
|
|
115
|
+
},
|
|
116
|
+
timestamp: new Date(),
|
|
117
|
+
requestId: command.requestId,
|
|
118
|
+
correlationId: command.correlationId,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
// Project scope - return all errors
|
|
123
|
+
debugResult('Type check failed (project scope)');
|
|
124
|
+
debugResult('Failed files: %d', failedFiles.length);
|
|
125
|
+
return {
|
|
126
|
+
type: 'TypeCheckFailed',
|
|
127
|
+
data: {
|
|
128
|
+
targetDirectory,
|
|
129
|
+
errors: output,
|
|
130
|
+
failedFiles: failedFiles.map((f) => path.relative(projectRoot, f)),
|
|
131
|
+
},
|
|
132
|
+
timestamp: new Date(),
|
|
133
|
+
requestId: command.requestId,
|
|
134
|
+
correlationId: command.correlationId,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Success case
|
|
139
|
+
const files = await fg(['**/*.ts'], {
|
|
140
|
+
cwd: scope === 'slice' ? targetDir : projectRoot,
|
|
141
|
+
});
|
|
142
|
+
debugResult('Type check passed');
|
|
143
|
+
debugResult('Checked files: %d', files.length);
|
|
144
|
+
return {
|
|
145
|
+
type: 'TypeCheckPassed',
|
|
146
|
+
data: {
|
|
147
|
+
targetDirectory,
|
|
148
|
+
checkedFiles: files.length,
|
|
149
|
+
},
|
|
150
|
+
timestamp: new Date(),
|
|
151
|
+
requestId: command.requestId,
|
|
152
|
+
correlationId: command.correlationId,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
debug('ERROR: Exception caught: %O', error);
|
|
157
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
158
|
+
return {
|
|
159
|
+
type: 'TypeCheckFailed',
|
|
160
|
+
data: {
|
|
161
|
+
targetDirectory,
|
|
162
|
+
errors: errorMessage,
|
|
163
|
+
failedFiles: [],
|
|
164
|
+
},
|
|
165
|
+
timestamp: new Date(),
|
|
166
|
+
requestId: command.requestId,
|
|
167
|
+
correlationId: command.correlationId,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
// Default export for CLI usage - just export the handler
|
|
173
|
+
export default checkTypesCommandHandler;
|
|
174
|
+
//# sourceMappingURL=check-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-types.js","sourceRoot":"","sources":["../../src/commands/check-types.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,MAAM,WAAW,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,WAAW,MAAM,OAAO,CAAC;AAEhC,MAAM,KAAK,GAAG,WAAW,CAAC,qBAAqB,CAAC,CAAC;AACjD,MAAM,YAAY,GAAG,WAAW,CA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AAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;YAC5C,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;YAEvF,OAAO;gBACL,IAAI,EAAE,iBAAiB;gBACvB,IAAI,EAAE;oBACJ,eAAe;oBACf,MAAM,EAAE,YAAY;oBACpB,WAAW,EAAE,EAAE;iBAChB;gBACD,SAAS,EAAE,IAAI,IAAI,EAAE;gBACrB,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,aAAa,EAAE,OAAO,CAAC,aAAa;aACrC,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC;AAEF,yDAAyD;AACzD,eAAe,wBAAwB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { CLI_MANIFEST } from './cli-manifest';
|
|
2
|
+
export { checkTypesCommandHandler, type CheckTypesCommand, type TypeCheckPassedEvent, type TypeCheckFailedEvent, } from './commands/check-types';
|
|
3
|
+
export { checkTestsCommandHandler, type CheckTestsCommand, type TestsCheckPassedEvent, type TestsCheckFailedEvent, } from './commands/check-tests';
|
|
4
|
+
export { checkLintCommandHandler, type CheckLintCommand, type LintCheckPassedEvent, type LintCheckFailedEvent, } from './commands/check-lint';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EACL,wBAAwB,EACxB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,wBAAwB,EACxB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC3B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,uBAAuB,EACvB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { CLI_MANIFEST } from './cli-manifest.js';
|
|
2
|
+
export { checkTypesCommandHandler, } from './commands/check-types.js';
|
|
3
|
+
export { checkTestsCommandHandler, } from './commands/check-tests.js';
|
|
4
|
+
export { checkLintCommandHandler, } from './commands/check-lint.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EACL,wBAAwB,GAIzB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,wBAAwB,GAIzB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,uBAAuB,GAIxB,MAAM,uBAAuB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@auto-engineer/server-checks",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md",
|
|
16
|
+
"CHANGELOG.md"
|
|
17
|
+
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@auto-engineer/message-bus": "^0.5.2",
|
|
20
|
+
"debug": "^4.4.1",
|
|
21
|
+
"execa": "^9.5.2",
|
|
22
|
+
"fast-glob": "^3.3.2"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@auto-engineer/cli": "^0.7.2"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc && tsx ../../scripts/fix-esm-imports.ts",
|
|
32
|
+
"dev": "tsc --watch",
|
|
33
|
+
"test": "vitest run",
|
|
34
|
+
"lint": "eslint 'src/**/*.ts' --max-warnings 0 --config ../../eslint.config.ts",
|
|
35
|
+
"type-check": "tsc --noEmit",
|
|
36
|
+
"format": "prettier --write \"**/*.{js,ts,json,md,yml,yaml}\" --ignore-path ../../.prettierignore",
|
|
37
|
+
"lint:fix": "eslint 'src/**/*.ts' --fix --config ../../eslint.config.ts",
|
|
38
|
+
"format:fix": "prettier --write \"**/*.{js,ts,json,md,yml,yaml}\" --ignore-path ../../.prettierignore"
|
|
39
|
+
}
|
|
40
|
+
}
|