pipecraft 0.37.4 → 0.39.2
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/README.md +50 -0
- package/dist/cli/index.js +152 -53
- package/dist/cli/index.js.map +1 -1
- package/dist/templates/actions/calculate-version.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/calculate-version.yml.tpl.js +24 -2
- package/dist/templates/actions/calculate-version.yml.tpl.js.map +1 -1
- package/dist/templates/actions/create-pr.yml.tpl.js +1 -1
- package/dist/templates/actions/create-release.yml.tpl.js +1 -1
- package/dist/templates/actions/manage-branch.yml.tpl.js +1 -1
- package/dist/templates/actions/promote-branch.yml.tpl.js +1 -1
- package/dist/templates/workflows/pipeline.yml.tpl.d.ts.map +1 -1
- package/dist/templates/workflows/pipeline.yml.tpl.js +55 -25
- package/dist/templates/workflows/pipeline.yml.tpl.js.map +1 -1
- package/dist/templates/workflows/shared/operations-changes.js +1 -1
- package/dist/templates/workflows/shared/operations-domain-jobs.js +4 -4
- package/dist/templates/workflows/shared/operations-tag-promote.js +3 -3
- package/dist/templates/workflows/shared/operations-version.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-version.js +7 -1
- package/dist/templates/workflows/shared/operations-version.js.map +1 -1
- package/dist/utils/doctor.d.ts +61 -0
- package/dist/utils/doctor.d.ts.map +1 -0
- package/dist/utils/doctor.js +647 -0
- package/dist/utils/doctor.js.map +1 -0
- package/dist/utils/github-setup.d.ts +38 -0
- package/dist/utils/github-setup.d.ts.map +1 -1
- package/dist/utils/github-setup.js +66 -11
- package/dist/utils/github-setup.js.map +1 -1
- package/dist/utils/skill-installer.d.ts +54 -0
- package/dist/utils/skill-installer.d.ts.map +1 -0
- package/dist/utils/skill-installer.js +251 -0
- package/dist/utils/skill-installer.js.map +1 -0
- package/package.json +15 -9
|
@@ -0,0 +1,647 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipecraft Doctor - Diagnostic Health Check
|
|
3
|
+
*
|
|
4
|
+
* Performs comprehensive health checks on a Pipecraft setup:
|
|
5
|
+
* - Configuration validation
|
|
6
|
+
* - GitHub workflow permissions
|
|
7
|
+
* - Branch existence on remote
|
|
8
|
+
* - Generated file verification
|
|
9
|
+
* - Workflow semantic validation
|
|
10
|
+
* - Domain path validation
|
|
11
|
+
*
|
|
12
|
+
* @module utils/doctor
|
|
13
|
+
*/
|
|
14
|
+
import { execSync } from 'node:child_process';
|
|
15
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
16
|
+
import { join } from 'node:path';
|
|
17
|
+
import { glob } from 'glob';
|
|
18
|
+
import { loadConfig, validateConfig } from './config.js';
|
|
19
|
+
import { formatOrgActionsLockMessage, getGitHubToken, getOrgWorkflowPermissions, getRepositoryInfo, getRequiredPermissionChanges, getWorkflowPermissions } from './github-setup.js';
|
|
20
|
+
import { validateWorkflowSemantics } from './workflow-semantics.js';
|
|
21
|
+
// ============================================================================
|
|
22
|
+
// ANSI Color Utilities
|
|
23
|
+
// ============================================================================
|
|
24
|
+
const COLORS = {
|
|
25
|
+
reset: '\x1b[0m',
|
|
26
|
+
bold: '\x1b[1m',
|
|
27
|
+
dim: '\x1b[2m',
|
|
28
|
+
// Pipecraft brand - magenta/pink
|
|
29
|
+
magenta: '\x1b[35m',
|
|
30
|
+
brightMagenta: '\x1b[95m',
|
|
31
|
+
// Status colors
|
|
32
|
+
green: '\x1b[32m',
|
|
33
|
+
red: '\x1b[31m',
|
|
34
|
+
yellow: '\x1b[33m',
|
|
35
|
+
cyan: '\x1b[36m',
|
|
36
|
+
white: '\x1b[37m',
|
|
37
|
+
gray: '\x1b[90m'
|
|
38
|
+
};
|
|
39
|
+
function color(text, ...codes) {
|
|
40
|
+
return `${codes.join('')}${text}${COLORS.reset}`;
|
|
41
|
+
}
|
|
42
|
+
// ============================================================================
|
|
43
|
+
// Output Formatting
|
|
44
|
+
// ============================================================================
|
|
45
|
+
function formatStatus(status) {
|
|
46
|
+
switch (status) {
|
|
47
|
+
case 'success':
|
|
48
|
+
return color(' ✓ ', COLORS.green);
|
|
49
|
+
case 'error':
|
|
50
|
+
return color(' ✗ ', COLORS.red);
|
|
51
|
+
case 'warning':
|
|
52
|
+
return color(' ! ', COLORS.yellow);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function formatCheckLine(result) {
|
|
56
|
+
const status = formatStatus(result.status);
|
|
57
|
+
switch (result.status) {
|
|
58
|
+
case 'success':
|
|
59
|
+
return `${status} ${color(result.message, COLORS.green)}`;
|
|
60
|
+
case 'error':
|
|
61
|
+
return `${status} ${color(result.message, COLORS.red)}`;
|
|
62
|
+
case 'warning':
|
|
63
|
+
return `${status} ${color(result.message, COLORS.yellow)}`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function formatCategoryHeader(name) {
|
|
67
|
+
return color(name, COLORS.brightMagenta, COLORS.bold);
|
|
68
|
+
}
|
|
69
|
+
function formatFixCommand(command) {
|
|
70
|
+
return color(command, COLORS.cyan);
|
|
71
|
+
}
|
|
72
|
+
export function formatDoctorOutput(result) {
|
|
73
|
+
const lines = [];
|
|
74
|
+
// Header
|
|
75
|
+
lines.push('');
|
|
76
|
+
lines.push(color('Pipecraft Doctor', COLORS.brightMagenta, COLORS.bold));
|
|
77
|
+
lines.push('');
|
|
78
|
+
// Categories
|
|
79
|
+
for (const category of result.categories) {
|
|
80
|
+
lines.push(formatCategoryHeader(category.name));
|
|
81
|
+
for (const check of category.results) {
|
|
82
|
+
lines.push(formatCheckLine(check));
|
|
83
|
+
}
|
|
84
|
+
lines.push('');
|
|
85
|
+
}
|
|
86
|
+
// Summary line
|
|
87
|
+
lines.push(color('─'.repeat(50), COLORS.gray));
|
|
88
|
+
if (result.errorCount === 0 && result.warningCount === 0) {
|
|
89
|
+
lines.push(color('All checks passed!', COLORS.green, COLORS.bold));
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const parts = [];
|
|
93
|
+
if (result.errorCount > 0) {
|
|
94
|
+
parts.push(color(`${result.errorCount} error${result.errorCount > 1 ? 's' : ''}`, COLORS.red));
|
|
95
|
+
}
|
|
96
|
+
if (result.warningCount > 0) {
|
|
97
|
+
parts.push(color(`${result.warningCount} warning${result.warningCount > 1 ? 's' : ''}`, COLORS.yellow));
|
|
98
|
+
}
|
|
99
|
+
lines.push(parts.join(', '));
|
|
100
|
+
}
|
|
101
|
+
// Fix suggestions
|
|
102
|
+
const fixes = result.categories
|
|
103
|
+
.flatMap(cat => cat.results)
|
|
104
|
+
.filter(r => r.status !== 'success' && r.fix);
|
|
105
|
+
if (fixes.length > 0) {
|
|
106
|
+
lines.push('');
|
|
107
|
+
lines.push(color('To fix:', COLORS.white, COLORS.bold));
|
|
108
|
+
lines.push('');
|
|
109
|
+
let fixNumber = 1;
|
|
110
|
+
for (const fix of fixes) {
|
|
111
|
+
if (fix.fix) {
|
|
112
|
+
lines.push(` ${color(`${fixNumber}.`, COLORS.white)} ${fix.fix.description}`);
|
|
113
|
+
if (fix.fix.command) {
|
|
114
|
+
lines.push(` ${formatFixCommand(fix.fix.command)}`);
|
|
115
|
+
}
|
|
116
|
+
lines.push('');
|
|
117
|
+
fixNumber++;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return lines.join('\n');
|
|
122
|
+
}
|
|
123
|
+
// ============================================================================
|
|
124
|
+
// Individual Checks
|
|
125
|
+
// ============================================================================
|
|
126
|
+
/**
|
|
127
|
+
* Check 1: Configuration validation
|
|
128
|
+
*/
|
|
129
|
+
export function checkConfiguration() {
|
|
130
|
+
const results = [];
|
|
131
|
+
// Check if config file exists and is valid
|
|
132
|
+
try {
|
|
133
|
+
const config = loadConfig();
|
|
134
|
+
results.push({
|
|
135
|
+
status: 'success',
|
|
136
|
+
message: 'Config file found'
|
|
137
|
+
});
|
|
138
|
+
// Validate schema
|
|
139
|
+
try {
|
|
140
|
+
validateConfig(config);
|
|
141
|
+
results.push({
|
|
142
|
+
status: 'success',
|
|
143
|
+
message: 'Config schema valid'
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
148
|
+
results.push({
|
|
149
|
+
status: 'error',
|
|
150
|
+
message: `Config validation failed: ${message}`,
|
|
151
|
+
fix: {
|
|
152
|
+
description: 'Fix the configuration errors in .pipecraftrc',
|
|
153
|
+
command: 'pipecraft validate'
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
results.push({
|
|
160
|
+
status: 'error',
|
|
161
|
+
message: 'No config file found',
|
|
162
|
+
fix: {
|
|
163
|
+
description: 'Initialize Pipecraft configuration',
|
|
164
|
+
command: 'pipecraft init'
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
return { name: 'Configuration', results };
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Check 2: GitHub workflow permissions
|
|
172
|
+
*/
|
|
173
|
+
export async function checkGitHubPermissions() {
|
|
174
|
+
const results = [];
|
|
175
|
+
try {
|
|
176
|
+
// Get repository info
|
|
177
|
+
const repoInfo = getRepositoryInfo();
|
|
178
|
+
results.push({
|
|
179
|
+
status: 'success',
|
|
180
|
+
message: `Repository: ${repoInfo.owner}/${repoInfo.repo}`
|
|
181
|
+
});
|
|
182
|
+
// Get GitHub token
|
|
183
|
+
let token;
|
|
184
|
+
try {
|
|
185
|
+
token = getGitHubToken();
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
results.push({
|
|
189
|
+
status: 'error',
|
|
190
|
+
message: 'GitHub token not found',
|
|
191
|
+
fix: {
|
|
192
|
+
description: 'Authenticate with GitHub CLI',
|
|
193
|
+
command: 'gh auth login'
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
return { name: 'GitHub Setup', results };
|
|
197
|
+
}
|
|
198
|
+
// Check workflow permissions
|
|
199
|
+
try {
|
|
200
|
+
const permissions = await getWorkflowPermissions(repoInfo.owner, repoInfo.repo, token);
|
|
201
|
+
const changes = getRequiredPermissionChanges(permissions);
|
|
202
|
+
if (changes === null) {
|
|
203
|
+
results.push({
|
|
204
|
+
status: 'success',
|
|
205
|
+
message: 'Workflow permissions configured correctly'
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
if (permissions.default_workflow_permissions !== 'write') {
|
|
210
|
+
results.push({
|
|
211
|
+
status: 'error',
|
|
212
|
+
message: 'Workflow permissions are read-only (should be read-write)',
|
|
213
|
+
fix: {
|
|
214
|
+
description: 'Configure GitHub workflow permissions',
|
|
215
|
+
command: 'pipecraft setup-github'
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
if (!permissions.can_approve_pull_request_reviews) {
|
|
220
|
+
// Proactively detect an organization-level lock. If the org itself
|
|
221
|
+
// disallows Actions creating/approving PRs, `pipecraft setup-github`
|
|
222
|
+
// cannot fix it (the write would 409) — only an org admin can. Surface
|
|
223
|
+
// that directly instead of recommending a command that will fail.
|
|
224
|
+
let orgLocked = false;
|
|
225
|
+
try {
|
|
226
|
+
const orgPermissions = await getOrgWorkflowPermissions(repoInfo.owner, token);
|
|
227
|
+
if (orgPermissions && orgPermissions.can_approve_pull_request_reviews === false) {
|
|
228
|
+
orgLocked = true;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
catch {
|
|
232
|
+
// Indeterminate (no org-admin scope, not an org, network) — fall back.
|
|
233
|
+
}
|
|
234
|
+
if (orgLocked) {
|
|
235
|
+
results.push({
|
|
236
|
+
status: 'error',
|
|
237
|
+
message: 'Cannot create/approve PRs — blocked by organization policy (org admin action required)',
|
|
238
|
+
fix: {
|
|
239
|
+
description: formatOrgActionsLockMessage(repoInfo.owner),
|
|
240
|
+
command: `https://github.com/organizations/${repoInfo.owner}/settings/actions`
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
results.push({
|
|
246
|
+
status: 'error',
|
|
247
|
+
message: 'Cannot create/approve PRs (should be enabled)',
|
|
248
|
+
fix: {
|
|
249
|
+
description: 'Enable PR creation permission',
|
|
250
|
+
command: 'pipecraft setup-github'
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
catch (error) {
|
|
258
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
259
|
+
results.push({
|
|
260
|
+
status: 'warning',
|
|
261
|
+
message: `Could not check permissions: ${message}`
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
catch (error) {
|
|
266
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
267
|
+
results.push({
|
|
268
|
+
status: 'error',
|
|
269
|
+
message: `Git remote not configured: ${message}`,
|
|
270
|
+
fix: {
|
|
271
|
+
description: 'Set up git remote origin',
|
|
272
|
+
command: 'git remote add origin <your-repo-url>'
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
return { name: 'GitHub Setup', results };
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Check 3: Branches exist on remote
|
|
280
|
+
*/
|
|
281
|
+
export function checkBranches() {
|
|
282
|
+
const results = [];
|
|
283
|
+
try {
|
|
284
|
+
const config = loadConfig();
|
|
285
|
+
if (!config.branchFlow || config.branchFlow.length === 0) {
|
|
286
|
+
results.push({
|
|
287
|
+
status: 'warning',
|
|
288
|
+
message: 'No branches configured in branchFlow'
|
|
289
|
+
});
|
|
290
|
+
return { name: 'Branches', results };
|
|
291
|
+
}
|
|
292
|
+
// Get remote branches
|
|
293
|
+
let remoteBranches;
|
|
294
|
+
try {
|
|
295
|
+
const output = execSync('git ls-remote --heads origin', {
|
|
296
|
+
encoding: 'utf8',
|
|
297
|
+
stdio: ['pipe', 'pipe', 'ignore']
|
|
298
|
+
});
|
|
299
|
+
remoteBranches = output
|
|
300
|
+
.split('\n')
|
|
301
|
+
.filter(line => line.trim())
|
|
302
|
+
.map(line => {
|
|
303
|
+
const match = line.match(/refs\/heads\/(.+)$/);
|
|
304
|
+
return match ? match[1] : '';
|
|
305
|
+
})
|
|
306
|
+
.filter(Boolean);
|
|
307
|
+
}
|
|
308
|
+
catch {
|
|
309
|
+
results.push({
|
|
310
|
+
status: 'warning',
|
|
311
|
+
message: 'Could not check remote branches (offline or no remote)',
|
|
312
|
+
fix: {
|
|
313
|
+
description: 'Ensure git remote is configured and accessible',
|
|
314
|
+
command: 'git remote -v'
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
return { name: 'Branches', results };
|
|
318
|
+
}
|
|
319
|
+
// Check each branch in branchFlow
|
|
320
|
+
for (const branch of config.branchFlow) {
|
|
321
|
+
if (remoteBranches.includes(branch)) {
|
|
322
|
+
results.push({
|
|
323
|
+
status: 'success',
|
|
324
|
+
message: `${branch} exists on origin`
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
results.push({
|
|
329
|
+
status: 'warning',
|
|
330
|
+
message: `${branch} not found on origin`,
|
|
331
|
+
fix: {
|
|
332
|
+
description: `Push branch "${branch}" to remote`,
|
|
333
|
+
command: `git push -u origin ${branch}`
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
catch {
|
|
340
|
+
results.push({
|
|
341
|
+
status: 'warning',
|
|
342
|
+
message: 'Could not load config to check branches'
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
return { name: 'Branches', results };
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Check 4: Required actions exist
|
|
349
|
+
*/
|
|
350
|
+
export function checkGeneratedFiles() {
|
|
351
|
+
const results = [];
|
|
352
|
+
try {
|
|
353
|
+
const config = loadConfig();
|
|
354
|
+
const actionMode = config.actionSourceMode || 'local';
|
|
355
|
+
// Check pipeline.yml exists
|
|
356
|
+
const pipelinePath = join(process.cwd(), '.github/workflows/pipeline.yml');
|
|
357
|
+
if (existsSync(pipelinePath)) {
|
|
358
|
+
results.push({
|
|
359
|
+
status: 'success',
|
|
360
|
+
message: '.github/workflows/pipeline.yml'
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
results.push({
|
|
365
|
+
status: 'error',
|
|
366
|
+
message: '.github/workflows/pipeline.yml not found',
|
|
367
|
+
fix: {
|
|
368
|
+
description: 'Generate workflow files',
|
|
369
|
+
command: 'pipecraft generate'
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
// Check actions only in local mode
|
|
374
|
+
if (actionMode === 'local') {
|
|
375
|
+
const actionsDir = join(process.cwd(), '.github/actions');
|
|
376
|
+
const expectedActions = [
|
|
377
|
+
'calculate-version',
|
|
378
|
+
'create-pr',
|
|
379
|
+
'create-release',
|
|
380
|
+
'create-tag',
|
|
381
|
+
'detect-changes',
|
|
382
|
+
'manage-branch',
|
|
383
|
+
'promote-branch'
|
|
384
|
+
];
|
|
385
|
+
for (const action of expectedActions) {
|
|
386
|
+
const actionPath = join(actionsDir, action);
|
|
387
|
+
if (existsSync(actionPath)) {
|
|
388
|
+
results.push({
|
|
389
|
+
status: 'success',
|
|
390
|
+
message: `.github/actions/${action}`
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
results.push({
|
|
395
|
+
status: 'error',
|
|
396
|
+
message: `.github/actions/${action} not found`,
|
|
397
|
+
fix: {
|
|
398
|
+
description: 'Generate missing action',
|
|
399
|
+
command: 'pipecraft generate'
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
else if (actionMode === 'remote') {
|
|
406
|
+
// In remote mode, verify the workflow references remote actions correctly
|
|
407
|
+
const pipelinePath = join(process.cwd(), '.github/workflows/pipeline.yml');
|
|
408
|
+
if (existsSync(pipelinePath)) {
|
|
409
|
+
const pipelineContent = readFileSync(pipelinePath, 'utf8');
|
|
410
|
+
const actionVersion = config.actionVersion || 'main';
|
|
411
|
+
const expectedRemotePattern = `the-craftlab/pipecraft/actions/`;
|
|
412
|
+
if (pipelineContent.includes(expectedRemotePattern)) {
|
|
413
|
+
results.push({
|
|
414
|
+
status: 'success',
|
|
415
|
+
message: `Using remote actions (the-craftlab/pipecraft/actions/*@${actionVersion})`
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
results.push({
|
|
420
|
+
status: 'warning',
|
|
421
|
+
message: `Workflow may not reference remote actions correctly`,
|
|
422
|
+
fix: {
|
|
423
|
+
description: 'Regenerate workflows with remote action mode',
|
|
424
|
+
command: 'pipecraft generate --force'
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
else if (actionMode === 'source') {
|
|
431
|
+
// In source mode (dogfooding), verify actions exist at ./actions/
|
|
432
|
+
const actionsDir = join(process.cwd(), 'actions');
|
|
433
|
+
const expectedActions = [
|
|
434
|
+
'calculate-version',
|
|
435
|
+
'create-pr',
|
|
436
|
+
'create-release',
|
|
437
|
+
'create-tag',
|
|
438
|
+
'detect-changes',
|
|
439
|
+
'manage-branch',
|
|
440
|
+
'promote-branch'
|
|
441
|
+
];
|
|
442
|
+
for (const action of expectedActions) {
|
|
443
|
+
const actionPath = join(actionsDir, action);
|
|
444
|
+
if (existsSync(actionPath)) {
|
|
445
|
+
results.push({
|
|
446
|
+
status: 'success',
|
|
447
|
+
message: `actions/${action}`
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
else {
|
|
451
|
+
results.push({
|
|
452
|
+
status: 'error',
|
|
453
|
+
message: `actions/${action} not found`,
|
|
454
|
+
fix: {
|
|
455
|
+
description: 'Ensure source actions exist',
|
|
456
|
+
command: undefined
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
catch {
|
|
464
|
+
// Config not found - just check pipeline.yml
|
|
465
|
+
const pipelinePath = join(process.cwd(), '.github/workflows/pipeline.yml');
|
|
466
|
+
if (existsSync(pipelinePath)) {
|
|
467
|
+
results.push({
|
|
468
|
+
status: 'success',
|
|
469
|
+
message: '.github/workflows/pipeline.yml'
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
results.push({
|
|
474
|
+
status: 'error',
|
|
475
|
+
message: '.github/workflows/pipeline.yml not found',
|
|
476
|
+
fix: {
|
|
477
|
+
description: 'Generate workflow files',
|
|
478
|
+
command: 'pipecraft generate'
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
return { name: 'Generated Files', results };
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Check 5: Workflow semantic validation
|
|
487
|
+
*/
|
|
488
|
+
export function checkWorkflowSemantics() {
|
|
489
|
+
const results = [];
|
|
490
|
+
const pipelinePath = join(process.cwd(), '.github/workflows/pipeline.yml');
|
|
491
|
+
if (!existsSync(pipelinePath)) {
|
|
492
|
+
results.push({
|
|
493
|
+
status: 'warning',
|
|
494
|
+
message: 'Cannot validate workflow (pipeline.yml not found)'
|
|
495
|
+
});
|
|
496
|
+
return { name: 'Workflow Validation', results };
|
|
497
|
+
}
|
|
498
|
+
try {
|
|
499
|
+
const yamlContent = readFileSync(pipelinePath, 'utf8');
|
|
500
|
+
const validation = validateWorkflowSemantics(yamlContent);
|
|
501
|
+
if (validation.valid && validation.warnings.length === 0) {
|
|
502
|
+
results.push({
|
|
503
|
+
status: 'success',
|
|
504
|
+
message: 'No circular dependencies'
|
|
505
|
+
});
|
|
506
|
+
results.push({
|
|
507
|
+
status: 'success',
|
|
508
|
+
message: 'All job references valid'
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
// Report errors
|
|
513
|
+
for (const error of validation.errors) {
|
|
514
|
+
results.push({
|
|
515
|
+
status: 'error',
|
|
516
|
+
message: error.message,
|
|
517
|
+
fix: {
|
|
518
|
+
description: 'Regenerate workflows to fix semantic errors',
|
|
519
|
+
command: 'pipecraft generate --force'
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
// Report warnings
|
|
524
|
+
for (const warning of validation.warnings) {
|
|
525
|
+
results.push({
|
|
526
|
+
status: 'warning',
|
|
527
|
+
message: warning.message
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
if (validation.errors.length === 0) {
|
|
531
|
+
results.push({
|
|
532
|
+
status: 'success',
|
|
533
|
+
message: 'No circular dependencies'
|
|
534
|
+
});
|
|
535
|
+
results.push({
|
|
536
|
+
status: 'success',
|
|
537
|
+
message: 'All job references valid'
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
catch (error) {
|
|
543
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
544
|
+
results.push({
|
|
545
|
+
status: 'error',
|
|
546
|
+
message: `Failed to parse workflow: ${message}`
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
return { name: 'Workflow Validation', results };
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Check 6: Domain paths match files
|
|
553
|
+
*/
|
|
554
|
+
export async function checkDomainPaths() {
|
|
555
|
+
const results = [];
|
|
556
|
+
try {
|
|
557
|
+
const config = loadConfig();
|
|
558
|
+
if (!config.domains || Object.keys(config.domains).length === 0) {
|
|
559
|
+
results.push({
|
|
560
|
+
status: 'warning',
|
|
561
|
+
message: 'No domains configured'
|
|
562
|
+
});
|
|
563
|
+
return { name: 'Domain Paths', results };
|
|
564
|
+
}
|
|
565
|
+
for (const [domainName, domainConfig] of Object.entries(config.domains)) {
|
|
566
|
+
if (!domainConfig.paths || domainConfig.paths.length === 0) {
|
|
567
|
+
results.push({
|
|
568
|
+
status: 'warning',
|
|
569
|
+
message: `"${domainName}" has no paths configured`
|
|
570
|
+
});
|
|
571
|
+
continue;
|
|
572
|
+
}
|
|
573
|
+
// Check each path pattern
|
|
574
|
+
let totalMatches = 0;
|
|
575
|
+
for (const pattern of domainConfig.paths) {
|
|
576
|
+
try {
|
|
577
|
+
const matches = await glob(pattern, {
|
|
578
|
+
cwd: process.cwd(),
|
|
579
|
+
nodir: false,
|
|
580
|
+
ignore: ['node_modules/**', '.git/**']
|
|
581
|
+
});
|
|
582
|
+
totalMatches += matches.length;
|
|
583
|
+
}
|
|
584
|
+
catch {
|
|
585
|
+
// Glob error - continue with other patterns
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
if (totalMatches > 0) {
|
|
589
|
+
results.push({
|
|
590
|
+
status: 'success',
|
|
591
|
+
message: `"${domainName}" paths match ${totalMatches} file${totalMatches > 1 ? 's' : ''}`
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
else {
|
|
595
|
+
const pathsStr = domainConfig.paths.join(', ');
|
|
596
|
+
results.push({
|
|
597
|
+
status: 'warning',
|
|
598
|
+
message: `"${domainName}" matches 0 files (${pathsStr})`,
|
|
599
|
+
fix: {
|
|
600
|
+
description: `Check path patterns for "${domainName}" in .pipecraftrc`,
|
|
601
|
+
command: undefined
|
|
602
|
+
}
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
catch {
|
|
608
|
+
results.push({
|
|
609
|
+
status: 'warning',
|
|
610
|
+
message: 'Could not load config to check domain paths'
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
return { name: 'Domain Paths', results };
|
|
614
|
+
}
|
|
615
|
+
// ============================================================================
|
|
616
|
+
// Main Doctor Function
|
|
617
|
+
// ============================================================================
|
|
618
|
+
/**
|
|
619
|
+
* Run all diagnostic checks and return the results.
|
|
620
|
+
*/
|
|
621
|
+
export async function runDoctor() {
|
|
622
|
+
const categories = [];
|
|
623
|
+
// Run all checks
|
|
624
|
+
categories.push(checkConfiguration());
|
|
625
|
+
categories.push(await checkGitHubPermissions());
|
|
626
|
+
categories.push(checkBranches());
|
|
627
|
+
categories.push(checkGeneratedFiles());
|
|
628
|
+
categories.push(checkWorkflowSemantics());
|
|
629
|
+
categories.push(await checkDomainPaths());
|
|
630
|
+
// Count errors and warnings
|
|
631
|
+
let errorCount = 0;
|
|
632
|
+
let warningCount = 0;
|
|
633
|
+
for (const category of categories) {
|
|
634
|
+
for (const result of category.results) {
|
|
635
|
+
if (result.status === 'error')
|
|
636
|
+
errorCount++;
|
|
637
|
+
if (result.status === 'warning')
|
|
638
|
+
warningCount++;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
return {
|
|
642
|
+
categories,
|
|
643
|
+
errorCount,
|
|
644
|
+
warningCount
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/utils/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAG3B,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EACL,2BAA2B,EAC3B,cAAc,EACd,yBAAyB,EACzB,iBAAiB,EACjB,4BAA4B,EAC5B,sBAAsB,EACvB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAEnE,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E,MAAM,MAAM,GAAG;IACb,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