@aisdlc/cli 4.1.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/index.ts
4
4
  import { Command } from "commander";
5
- import pc11 from "picocolors";
5
+ import pc12 from "picocolors";
6
6
 
7
7
  // src/commands/check.ts
8
8
  import pc2 from "picocolors";
@@ -1574,12 +1574,12 @@ function runGherkinExtract(options = {}) {
1574
1574
  return result.success;
1575
1575
  }
1576
1576
  function defaultConfirmInstall(question) {
1577
- return new Promise((resolve2) => {
1577
+ return new Promise((resolve3) => {
1578
1578
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
1579
1579
  rl.question(question, (answer) => {
1580
1580
  rl.close();
1581
1581
  const normalized = answer.trim().toLowerCase();
1582
- resolve2(normalized === "y" || normalized === "yes");
1582
+ resolve3(normalized === "y" || normalized === "yes");
1583
1583
  });
1584
1584
  });
1585
1585
  }
@@ -2092,7 +2092,11 @@ async function runMcpServer(options = {}) {
2092
2092
  import * as path2 from "path";
2093
2093
  import { spawn } from "child_process";
2094
2094
  import pc8 from "picocolors";
2095
- import { generateDashboardReport, generateQualityReport } from "@aisdlc/core";
2095
+ import {
2096
+ generateComplianceEvidenceBundleSync,
2097
+ generateDashboardReport,
2098
+ generateQualityReport
2099
+ } from "@aisdlc/core";
2096
2100
  function openInBrowser(filePath) {
2097
2101
  const resolved = path2.resolve(filePath);
2098
2102
  const platform = process.platform;
@@ -2173,6 +2177,50 @@ function runReportQuality(options = {}) {
2173
2177
  printQualityReportMetrics(result, rootDir);
2174
2178
  return result.verdict === "PASS";
2175
2179
  }
2180
+ var ALLOWED_COMPLIANCE_OPTIONS = /* @__PURE__ */ new Set([
2181
+ "root",
2182
+ "output",
2183
+ "keyless",
2184
+ "strict",
2185
+ "offline",
2186
+ "dryRun"
2187
+ ]);
2188
+ function validateComplianceOptions(options) {
2189
+ for (const key of Object.keys(options)) {
2190
+ if (!ALLOWED_COMPLIANCE_OPTIONS.has(key)) {
2191
+ console.error(pc8.red(`
2192
+ \u2716 [ERROR] Unknown option provided: --${key}
2193
+ `));
2194
+ return false;
2195
+ }
2196
+ }
2197
+ return true;
2198
+ }
2199
+ function runReportCompliance(options = {}) {
2200
+ if (!validateComplianceOptions(options)) {
2201
+ return false;
2202
+ }
2203
+ const rootDir = options.root || process.cwd();
2204
+ console.log(pc8.bold(pc8.cyan("\n\u{1F4DC} [AI-SDLC] Generating Regulatory Compliance Evidence Bundle...")));
2205
+ try {
2206
+ const res = generateComplianceEvidenceBundleSync({
2207
+ rootDir,
2208
+ outputPath: options.output,
2209
+ keyless: options.keyless,
2210
+ strict: options.strict,
2211
+ offline: options.offline,
2212
+ dryRun: options.dryRun
2213
+ });
2214
+ console.log(pc8.green(`\u2714 Compliance evidence bundle generated successfully. Digest: ${res.bundleDigest}
2215
+ `));
2216
+ return res.success;
2217
+ } catch (err) {
2218
+ console.error(pc8.red(`
2219
+ \u2716 [ERROR] ${err instanceof Error ? err.message : String(err)}
2220
+ `));
2221
+ return false;
2222
+ }
2223
+ }
2176
2224
 
2177
2225
  // src/commands/review.ts
2178
2226
  import pc9 from "picocolors";
@@ -2241,9 +2289,79 @@ function runInspect(query, options = {}) {
2241
2289
  return result.found;
2242
2290
  }
2243
2291
 
2244
- // src/commands/sdd.ts
2292
+ // src/commands/doctor.ts
2293
+ import { DoctorService, DoctorReporter } from "@aisdlc/core";
2294
+ function printReport(report, reporter, asJson) {
2295
+ if (asJson) {
2296
+ console.log(reporter.formatJson(report));
2297
+ return;
2298
+ }
2299
+ const formatted = reporter.formatTerminal(report);
2300
+ if (report.exitCode === 2) {
2301
+ console.error(formatted);
2302
+ } else {
2303
+ console.log(formatted);
2304
+ }
2305
+ }
2306
+ async function runDoctor(opts = {}) {
2307
+ const doctorOpts = {
2308
+ rootDir: opts.rootDir || process.cwd(),
2309
+ json: opts.json,
2310
+ fix: opts.fix,
2311
+ strict: opts.strict,
2312
+ offline: opts.offline || process.env.AI_SDLC_OFFLINE === "1",
2313
+ timeout: opts.timeout
2314
+ };
2315
+ const service = new DoctorService();
2316
+ const reporter = new DoctorReporter();
2317
+ const report = await service.diagnose(doctorOpts);
2318
+ printReport(report, reporter, Boolean(opts.json));
2319
+ return report.exitCode;
2320
+ }
2321
+
2322
+ // src/commands/migrate.ts
2245
2323
  import * as path3 from "path";
2246
2324
  import pc10 from "picocolors";
2325
+ import {
2326
+ MigrationService,
2327
+ MigrationReporter
2328
+ } from "@aisdlc/core";
2329
+ function printConsoleSummary(result, reporter) {
2330
+ console.log(reporter.formatTerminal(result));
2331
+ if (result.exitCode === 0) {
2332
+ console.log(pc10.green("\nMigration completed successfully."));
2333
+ } else if (result.exitCode === 1) {
2334
+ console.log(pc10.yellow("\nMigration finished with local overrides preserved. Use --force to overwrite."));
2335
+ } else {
2336
+ console.error(pc10.red("\nMigration encountered errors or conflicts."));
2337
+ }
2338
+ }
2339
+ async function runMigrate(options) {
2340
+ const root = path3.resolve(options.root || process.cwd());
2341
+ const service = new MigrationService();
2342
+ const reporter = new MigrationReporter();
2343
+ const migrationOptions = {
2344
+ root,
2345
+ dryRun: Boolean(options.dryRun),
2346
+ backup: options.backup ?? true,
2347
+ force: Boolean(options.force),
2348
+ allowPolicyDowngrade: Boolean(options.allowPolicyDowngrade),
2349
+ json: Boolean(options.json),
2350
+ verbose: Boolean(options.verbose),
2351
+ branch: options.branch
2352
+ };
2353
+ const result = await service.migrate(migrationOptions);
2354
+ if (options.json) {
2355
+ console.log(reporter.formatJson(result));
2356
+ } else {
2357
+ printConsoleSummary(result, reporter);
2358
+ }
2359
+ return result.exitCode;
2360
+ }
2361
+
2362
+ // src/commands/sdd.ts
2363
+ import * as path4 from "path";
2364
+ import pc11 from "picocolors";
2247
2365
  import {
2248
2366
  depositProductHandoffSidecar,
2249
2367
  detectActiveChangeForIntegration,
@@ -2271,8 +2389,8 @@ function buildHandoffPayload(options, changeId) {
2271
2389
  return { handoff, reqList };
2272
2390
  }
2273
2391
  function printDepositSuccess(depositedPath, handoffId, reqList) {
2274
- console.log(` ${pc10.green("\u2714")} Sidecar successfully deposited: ${pc10.bold(depositedPath)}`);
2275
- console.log(` Handoff ID: ${pc10.cyan(handoffId)}`);
2392
+ console.log(` ${pc11.green("\u2714")} Sidecar successfully deposited: ${pc11.bold(depositedPath)}`);
2393
+ console.log(` Handoff ID: ${pc11.cyan(handoffId)}`);
2276
2394
  console.log(` Delivered requirements: ${reqList.join(", ")}
2277
2395
  `);
2278
2396
  }
@@ -2288,12 +2406,12 @@ function emitDepositJson(success, changeId, framework, depositedPath, handoff, e
2288
2406
  console.log(JSON.stringify(payload, null, 2));
2289
2407
  }
2290
2408
  function printDepositHeader(changeId, framework) {
2291
- console.log(pc10.bold(pc10.cyan(`
2409
+ console.log(pc11.bold(pc11.cyan(`
2292
2410
  \u{1F4E6} [AI-SDLC SDD] Depositing PDaC Handoff Sidecar for '${changeId}' (${framework})...`)));
2293
2411
  }
2294
2412
  function printDepositError(err) {
2295
2413
  const errMessage = err instanceof Error ? err.message : String(err);
2296
- console.error(pc10.red(` \u2716 Error depositing sidecar: ${errMessage}
2414
+ console.error(pc11.red(` \u2716 Error depositing sidecar: ${errMessage}
2297
2415
  `));
2298
2416
  }
2299
2417
  function runSddDeposit(options) {
@@ -2319,13 +2437,13 @@ function runSddDeposit(options) {
2319
2437
  }
2320
2438
  function printHandoffEntry(isValid, id, relDir, reqCount) {
2321
2439
  if (isValid) {
2322
- console.log(` ${pc10.green("\u2714")} [${pc10.bold(id)}] in ${relDir} (Requirements: ${reqCount})`);
2440
+ console.log(` ${pc11.green("\u2714")} [${pc11.bold(id)}] in ${relDir} (Requirements: ${reqCount})`);
2323
2441
  } else {
2324
- console.log(` ${pc10.red("\u2716")} [${pc10.bold(id)}] in ${relDir} - Invalid handoff schema or subgraph.`);
2442
+ console.log(` ${pc11.red("\u2716")} [${pc11.bold(id)}] in ${relDir} - Invalid handoff schema or subgraph.`);
2325
2443
  }
2326
2444
  }
2327
2445
  function processHandoffEntry(handoff, changeDir, rootDir, isSilent) {
2328
- const relDir = path3.relative(rootDir, changeDir).replace(/\\/g, "/");
2446
+ const relDir = path4.relative(rootDir, changeDir).replace(/\\/g, "/");
2329
2447
  const reqCount = handoff.subgraph && Array.isArray(handoff.subgraph.requirements) ? handoff.subgraph.requirements.length : 0;
2330
2448
  const isValid = Boolean(handoff.id && handoff.id.startsWith("HOF-") && reqCount > 0);
2331
2449
  const id = handoff.id || "UNKNOWN";
@@ -2337,7 +2455,7 @@ function processHandoffEntry(handoff, changeDir, rootDir, isSilent) {
2337
2455
  function auditHandoffsMap(handoffsMap, rootDir, isSilent) {
2338
2456
  if (handoffsMap.size === 0) {
2339
2457
  if (!isSilent) {
2340
- console.log(pc10.yellow(" [NOTICE] No handoff.yaml sidecar companion files found in specs/."));
2458
+ console.log(pc11.yellow(" [NOTICE] No handoff.yaml sidecar companion files found in specs/."));
2341
2459
  }
2342
2460
  return { handoffItems: [], validCount: 0, invalidCount: 0 };
2343
2461
  }
@@ -2361,10 +2479,10 @@ function auditDuplicatesShiftLeft(rootDir, checkDuplicates, isSilent) {
2361
2479
  }
2362
2480
  const dupResult = verifyArtifactDuplicates3({ rootDir });
2363
2481
  if (dupResult.errorCount > 0 && !isSilent) {
2364
- console.log(pc10.red(`
2482
+ console.log(pc11.red(`
2365
2483
  \u2716 [Shift-Left Gate] Detected ${dupResult.errorCount} requirement collision(s)/duplicate(s) in workspace:`));
2366
2484
  for (const issue of dupResult.issues.filter((i) => i.severity === "ERROR")) {
2367
- console.log(` ${pc10.red("\u2716")} [${issue.type}] ${issue.id} in ${issue.file}: ${issue.message}`);
2485
+ console.log(` ${pc11.red("\u2716")} [${issue.type}] ${issue.id} in ${issue.file}: ${issue.message}`);
2368
2486
  }
2369
2487
  }
2370
2488
  return { duplicateErrors: dupResult.errorCount, duplicateIssues: dupResult.issues };
@@ -2385,12 +2503,12 @@ function emitSddVerifyJson(payload) {
2385
2503
  }
2386
2504
  function printSddVerifyVerdict(isOk) {
2387
2505
  console.log(
2388
- isOk ? pc10.green("\n\u2714 SDD Integration COMPLIANT: All sidecars and requirements are valid.\n") : pc10.red("\n\u2716 SDD Integration BLOCKED: Non-compliant sidecars or duplicate requirements detected.\n")
2506
+ isOk ? pc11.green("\n\u2714 SDD Integration COMPLIANT: All sidecars and requirements are valid.\n") : pc11.red("\n\u2716 SDD Integration BLOCKED: Non-compliant sidecars or duplicate requirements detected.\n")
2389
2507
  );
2390
2508
  }
2391
2509
  function printSddVerifyHeader(totalFound) {
2392
- console.log(pc10.bold(pc10.cyan("\n\u{1F50D} [AI-SDLC SDD] Verifying SDD Workspaces and Handoff Sidecars (HOF-*)...")));
2393
- console.log(` Found PDaC sidecars: ${pc10.bold(String(totalFound))}`);
2510
+ console.log(pc11.bold(pc11.cyan("\n\u{1F50D} [AI-SDLC SDD] Verifying SDD Workspaces and Handoff Sidecars (HOF-*)...")));
2511
+ console.log(` Found PDaC sidecars: ${pc11.bold(String(totalFound))}`);
2394
2512
  }
2395
2513
  function runSddVerify(options = {}) {
2396
2514
  const rootDir = options.root || process.cwd();
@@ -2414,7 +2532,7 @@ function runSddVerify(options = {}) {
2414
2532
  }
2415
2533
  function handleUndetectedChange(detection, isSilent, useJson) {
2416
2534
  if (!isSilent) {
2417
- console.log(pc10.yellow("\n\u2139 [AI-SDLC SDD] No active SDD change detected to integrate:"));
2535
+ console.log(pc11.yellow("\n\u2139 [AI-SDLC SDD] No active SDD change detected to integrate:"));
2418
2536
  for (const r of detection.reasons) console.log(` - ${r}`);
2419
2537
  console.log("");
2420
2538
  }
@@ -2426,7 +2544,7 @@ function handleUndetectedChange(detection, isSilent, useJson) {
2426
2544
  }
2427
2545
  function handlePendingTasks(detection, isSilent, useJson) {
2428
2546
  if (!isSilent) {
2429
- console.log(pc10.red(`
2547
+ console.log(pc11.red(`
2430
2548
  \u2716 [AI-SDLC SDD] Detected change '${detection.changeId}' has pending tasks (${detection.completedTasksCount}/${detection.totalTasksCount} completed). All tasks must be in COMPLETED status.
2431
2549
  `));
2432
2550
  }
@@ -2458,7 +2576,7 @@ function resolveAutoChange(options, rootDir, isSilent, useJson) {
2458
2576
  return handlePendingTasks(detection, isSilent, useJson);
2459
2577
  }
2460
2578
  if (!isSilent) {
2461
- console.log(pc10.cyan(` \u2714 Automatically detected SDD change: ${pc10.bold(detection.changeId)} (via ${detection.source})`));
2579
+ console.log(pc11.cyan(` \u2714 Automatically detected SDD change: ${pc11.bold(detection.changeId)} (via ${detection.source})`));
2462
2580
  }
2463
2581
  return detection.changeId;
2464
2582
  }
@@ -2466,7 +2584,7 @@ function resolveIntegrationChangeId(options, rootDir, isSilent, useJson) {
2466
2584
  const changeId = options.change || (options.auto ? resolveAutoChange(options, rootDir, isSilent, useJson) : null);
2467
2585
  if (!changeId) {
2468
2586
  if (!options.auto) {
2469
- if (!isSilent) console.error(pc10.red("\n\u2716 Change identifier (--change <id>) or --auto option must be specified.\n"));
2587
+ if (!isSilent) console.error(pc11.red("\n\u2716 Change identifier (--change <id>) or --auto option must be specified.\n"));
2470
2588
  if (useJson) {
2471
2589
  console.log(JSON.stringify({ command: "sdd:integrate", success: false, exitCode: 1, error: "Change identifier (--change <id>) or --auto option must be specified." }, null, 2));
2472
2590
  }
@@ -2476,22 +2594,22 @@ function resolveIntegrationChangeId(options, rootDir, isSilent, useJson) {
2476
2594
  return changeId;
2477
2595
  }
2478
2596
  function printIntegrationSuccess(changeId, result) {
2479
- console.log(` ${pc10.green("\u2714")} Change '${changeId}' successfully processed:`);
2480
- console.log(` - Completed tasks: ${pc10.bold(String(result.completedTasks.length))}`);
2481
- console.log(` - Integrated requirements: ${pc10.green(result.integratedRequirements.join(", ") || "None")}`);
2482
- console.log(` - Created canonical artifacts: ${pc10.green(result.createdCanonicalArtifacts?.join(", ") || "None")}`);
2483
- console.log(` - Updated product artifacts: ${pc10.green(result.updatedProductArtifacts.join(", ") || "None")}`);
2484
- console.log(` - Updated arc42 architecture: ${pc10.green(result.updatedArchitectureArtifacts.join(", ") || "None")}`);
2597
+ console.log(` ${pc11.green("\u2714")} Change '${changeId}' successfully processed:`);
2598
+ console.log(` - Completed tasks: ${pc11.bold(String(result.completedTasks.length))}`);
2599
+ console.log(` - Integrated requirements: ${pc11.green(result.integratedRequirements.join(", ") || "None")}`);
2600
+ console.log(` - Created canonical artifacts: ${pc11.green(result.createdCanonicalArtifacts?.join(", ") || "None")}`);
2601
+ console.log(` - Updated product artifacts: ${pc11.green(result.updatedProductArtifacts.join(", ") || "None")}`);
2602
+ console.log(` - Updated arc42 architecture: ${pc11.green(result.updatedArchitectureArtifacts.join(", ") || "None")}`);
2485
2603
  if (result.archived) {
2486
- console.log(` - Archived to: ${pc10.cyan(result.archivedPath || "specs/changes/completed")}`);
2604
+ console.log(` - Archived to: ${pc11.cyan(result.archivedPath || "specs/changes/completed")}`);
2487
2605
  }
2488
- console.log(pc10.green("\n\u2714 Canonical specification integration COMPLETED (EXIT 0)\n"));
2606
+ console.log(pc11.green("\n\u2714 Canonical specification integration COMPLETED (EXIT 0)\n"));
2489
2607
  }
2490
2608
  function printIntegrationFailure(changeId, errors) {
2491
- console.log(pc10.red(`
2609
+ console.log(pc11.red(`
2492
2610
  \u2716 Failed to integrate change '${changeId}':`));
2493
- for (const err of errors) console.log(` ${pc10.red("\u2716")} ${err}`);
2494
- console.log(pc10.red("\n\u2716 Integration BLOCKED (EXIT 1)\n"));
2611
+ for (const err of errors) console.log(` ${pc11.red("\u2716")} ${err}`);
2612
+ console.log(pc11.red("\n\u2716 Integration BLOCKED (EXIT 1)\n"));
2495
2613
  }
2496
2614
  function emitIntegrateJson(changeId, result) {
2497
2615
  const payload = {
@@ -2511,16 +2629,16 @@ function emitIntegrateJson(changeId, result) {
2511
2629
  console.log(JSON.stringify(payload, null, 2));
2512
2630
  }
2513
2631
  function printBatchIntegrationResult(result) {
2514
- console.log(` ${pc10.green("\u2714")} Processed changes: ${pc10.bold(String(result.processedChanges.length))} (${result.processedChanges.join(", ") || "None"})`);
2515
- console.log(` ${pc10.yellow("\u2139")} Skipped changes: ${pc10.bold(String(result.skippedChanges.length))}`);
2516
- console.log(` ${pc10.green("\u2714")} Updated product artifacts: ${pc10.green(result.updatedProductArtifacts.join(", ") || "None")}`);
2517
- console.log(` ${pc10.green("\u2714")} Updated arc42 architecture: ${pc10.green(result.updatedArchitectureArtifacts.join(", ") || "None")}`);
2518
- console.log(` ${pc10.green("\u2714")} Synced PDaC SHA-256 digests: ${pc10.cyan(String(result.syncedDigestsCount))}`);
2632
+ console.log(` ${pc11.green("\u2714")} Processed changes: ${pc11.bold(String(result.processedChanges.length))} (${result.processedChanges.join(", ") || "None"})`);
2633
+ console.log(` ${pc11.yellow("\u2139")} Skipped changes: ${pc11.bold(String(result.skippedChanges.length))}`);
2634
+ console.log(` ${pc11.green("\u2714")} Updated product artifacts: ${pc11.green(result.updatedProductArtifacts.join(", ") || "None")}`);
2635
+ console.log(` ${pc11.green("\u2714")} Updated arc42 architecture: ${pc11.green(result.updatedArchitectureArtifacts.join(", ") || "None")}`);
2636
+ console.log(` ${pc11.green("\u2714")} Synced PDaC SHA-256 digests: ${pc11.cyan(String(result.syncedDigestsCount))}`);
2519
2637
  if (result.success) {
2520
- console.log(pc10.green("\n\u2714 Batch canonical specification integration COMPLETED (EXIT 0)\n"));
2638
+ console.log(pc11.green("\n\u2714 Batch canonical specification integration COMPLETED (EXIT 0)\n"));
2521
2639
  } else {
2522
- for (const err of result.errors) console.log(` ${pc10.red("\u2716")} ${err}`);
2523
- console.log(pc10.red("\n\u2716 Batch integration finished with errors (EXIT 1)\n"));
2640
+ for (const err of result.errors) console.log(` ${pc11.red("\u2716")} ${err}`);
2641
+ console.log(pc11.red("\n\u2716 Batch integration finished with errors (EXIT 1)\n"));
2524
2642
  }
2525
2643
  }
2526
2644
  function emitBatchIntegrateJson(result) {
@@ -2540,7 +2658,7 @@ function emitBatchIntegrateJson(result) {
2540
2658
  }
2541
2659
  function runBatchSddIntegrate(options, rootDir, isSilent, useJson) {
2542
2660
  if (!isSilent) {
2543
- console.log(pc10.bold(pc10.cyan("\n\u{1F504} [AI-SDLC SDD] Consolidating all completed SDD changes into canonical specifications...")));
2661
+ console.log(pc11.bold(pc11.cyan("\n\u{1F504} [AI-SDLC SDD] Consolidating all completed SDD changes into canonical specifications...")));
2544
2662
  }
2545
2663
  const result = integrateAllSddChanges({ rootDir, author: options.author, autoArchive: options.autoArchive });
2546
2664
  if (!isSilent) printBatchIntegrationResult(result);
@@ -2557,7 +2675,7 @@ function runSddIntegrate(options) {
2557
2675
  const changeId = resolveIntegrationChangeId(options, rootDir, isSilent, useJson);
2558
2676
  if (!changeId) return false;
2559
2677
  if (!isSilent) {
2560
- console.log(pc10.bold(pc10.cyan(`
2678
+ console.log(pc11.bold(pc11.cyan(`
2561
2679
  \u{1F504} [AI-SDLC SDD] Integrating change '${changeId}' into canonical specification...`)));
2562
2680
  }
2563
2681
  const result = integrateSddChange({ rootDir, changeId, author: options.author, autoArchive: options.autoArchive });
@@ -2569,24 +2687,24 @@ function runSddIntegrate(options) {
2569
2687
  return result.success;
2570
2688
  }
2571
2689
  function printChangeNewSuccess(result) {
2572
- console.log(` ${pc10.green("\u2714")} Change directory: ${pc10.bold(result.changeDir)}`);
2573
- console.log(` ${pc10.green("\u2714")} SDD Change ID: ${pc10.cyan(result.canonicalId)} (${result.changeId})`);
2574
- console.log(` ${pc10.green("\u2714")} Risk profile: ${pc10.magenta(result.profile || "standard")}`);
2690
+ console.log(` ${pc11.green("\u2714")} Change directory: ${pc11.bold(result.changeDir)}`);
2691
+ console.log(` ${pc11.green("\u2714")} SDD Change ID: ${pc11.cyan(result.canonicalId)} (${result.changeId})`);
2692
+ console.log(` ${pc11.green("\u2714")} Risk profile: ${pc11.magenta(result.profile || "standard")}`);
2575
2693
  if (result.productArtifactCreated) {
2576
- console.log(` ${pc10.green("\u2714")} Product artifact: ${pc10.bold(result.productArtifactCreated)} (status: draft)`);
2694
+ console.log(` ${pc11.green("\u2714")} Product artifact: ${pc11.bold(result.productArtifactCreated)} (status: draft)`);
2577
2695
  }
2578
- console.log(` ${pc10.green("\u2714")} Cited artifacts: ${result.citedArtifacts.length}`);
2696
+ console.log(` ${pc11.green("\u2714")} Cited artifacts: ${result.citedArtifacts.length}`);
2579
2697
  for (const cite of result.citedArtifacts) {
2580
- console.log(` - [${pc10.cyan(cite.id)}] ${cite.digest.substring(0, 19)}... (${cite.title || "Untitled"})`);
2698
+ console.log(` - [${pc11.cyan(cite.id)}] ${cite.digest.substring(0, 19)}... (${cite.title || "Untitled"})`);
2581
2699
  }
2582
- console.log(` ${pc10.green("\u2714")} Generated files: ${result.createdFiles.length}`);
2583
- console.log(pc10.green("\n\u2714 SDD change successfully initialized and validated.\n"));
2700
+ console.log(` ${pc11.green("\u2714")} Generated files: ${result.createdFiles.length}`);
2701
+ console.log(pc11.green("\n\u2714 SDD change successfully initialized and validated.\n"));
2584
2702
  }
2585
2703
  function printChangeNewFailure(name, errors) {
2586
- console.log(pc10.red(`
2704
+ console.log(pc11.red(`
2587
2705
  \u2716 Failed to create SDD change '${name}':`));
2588
- for (const err of errors) console.log(` ${pc10.red("\u2716")} ${err}`);
2589
- console.log(pc10.red("\n\u2716 Change creation BLOCKED\n"));
2706
+ for (const err of errors) console.log(` ${pc11.red("\u2716")} ${err}`);
2707
+ console.log(pc11.red("\n\u2716 Change creation BLOCKED\n"));
2590
2708
  }
2591
2709
  function emitChangeNewJson(name, result) {
2592
2710
  const payload = {
@@ -2606,7 +2724,7 @@ function emitChangeNewJson(name, result) {
2606
2724
  console.log(JSON.stringify(payload, null, 2));
2607
2725
  }
2608
2726
  function printChangeNewHeader(name, framework) {
2609
- console.log(pc10.bold(pc10.cyan(`
2727
+ console.log(pc11.bold(pc11.cyan(`
2610
2728
  \u{1F4E6} [AI-SDLC SDD] Scaffolding new SDD change '${name}' (${framework})...`)));
2611
2729
  }
2612
2730
  function handleScaffoldOutput(name, result, isSilent, useJson) {
@@ -2641,7 +2759,18 @@ function runChangeNew(options) {
2641
2759
 
2642
2760
  // src/index.ts
2643
2761
  var program = new Command();
2644
- program.name("aisdlc").description("AI-SDLC: Spec-Driven Development, Governance & Quality Gates for AI & Humans").version("4.1.0");
2762
+ program.name("aisdlc").description("AI-SDLC: Spec-Driven Development, Governance & Quality Gates for AI & Humans").version("4.2.0");
2763
+ program.command("doctor").description("Comprehensive environment, toolchain, git-hooks, and security health diagnostics").option("-r, --root <path>", "Project root directory").option("--fix", "Automatically repair broken or missing git hooks with backup").option("--json", "Emit diagnostics report in structured JSON format").option("--strict", "Fail with non-zero exit code on warnings as well as critical failures").option("--offline", "Skip remote external network probes (e.g. for air-gapped environments)").option("--timeout <ms>", "Maximum timeout in milliseconds for subprocess execution", parseInt).action(async (opts) => {
2764
+ const exitCode = await runDoctor({
2765
+ rootDir: opts.root,
2766
+ fix: opts.fix,
2767
+ json: opts.json,
2768
+ strict: opts.strict,
2769
+ offline: opts.offline,
2770
+ timeout: opts.timeout
2771
+ });
2772
+ process.exit(exitCode);
2773
+ });
2645
2774
  program.command("check").description("Unified pre-flight command: validates Quality Gates with optional non-destructive auto-fix").option("--fix", "Automatically synchronize Gherkin scenarios (.feature) and cryptographic digests of PDaC citations").option("-r, --root <path>", "Project root directory").option("--vuln", "Scan for known vulnerabilities (CVE/GHSA) in dependencies").option("--json", "Emit verification results in structured JSON format").option("-F, --format <format>", "Output format: text or json").action((opts) => {
2646
2775
  const passed = runCheck({
2647
2776
  fix: opts.fix,
@@ -2807,6 +2936,17 @@ reportCommand.command("dashboard").description("Generate interactive web dashboa
2807
2936
  });
2808
2937
  process.exit(passed ? 0 : 1);
2809
2938
  });
2939
+ reportCommand.command("compliance").description("Generate Regulatory Compliance Evidence Bundle (EU AI Act, ISO 42001, NIST SSDF)").option("-r, --root <path>", "Project root directory").option("-o, --output <path>", "Output JSON file path (default: reports/audit-evidence-bundle.json)").option("--offline", "Offline execution: prohibit external network calls").option("--strict", "Strict mode: fail closed if any of 12 Quality Gates is missing or stale").option("--keyless", "Enable keyless OIDC attestation claims").option("--dry-run", "Dry run without writing to disk").action((opts) => {
2940
+ const passed = runReportCompliance({
2941
+ root: opts.root,
2942
+ output: opts.output,
2943
+ offline: opts.offline,
2944
+ strict: opts.strict,
2945
+ keyless: opts.keyless,
2946
+ dryRun: opts.dryRun
2947
+ });
2948
+ process.exit(passed ? 0 : 1);
2949
+ });
2810
2950
  var gherkinCommand = program.command("gherkin").description("BDD / Gherkin synchronization and extraction tools");
2811
2951
  gherkinCommand.command("extract").description("Extract ```gherkin``` blocks from Markdown specifications into .feature files").option("-r, --root <path>", "Project root directory").option("-p, --path <path>", "Target Markdown file or directory").option("-a, --all", "Process all specifications and requirements").option("--json", "Structured JSON format output").option("-F, --format <format>", "Output format: text or json").action((opts) => {
2812
2952
  const passed = runGherkinExtract({
@@ -3003,10 +3143,22 @@ reviewCmd.command("submit").description("Persist a formal review report for an a
3003
3143
  });
3004
3144
  if (!ok) process.exit(1);
3005
3145
  });
3146
+ program.command("migrate").description("Synchronize schemas, templates, and policies with upstream canonical versions").option("-r, --root <path>", "Repository root directory").option("--dry-run", "Preview changes without mutating filesystem").option("--no-backup", "Disable pre-migration backup").option("-f, --force", "Overwrite local customizations with canonical versions").option("--allow-policy-downgrade", "Permit relaxing stricter quality or security thresholds").option("--json", "Output migration report as JSON").option("-v, --verbose", "Enable verbose logging").action(async (opts) => {
3147
+ const exitCode = await runMigrate({
3148
+ root: opts.root,
3149
+ dryRun: opts.dryRun,
3150
+ backup: opts.backup,
3151
+ force: opts.force,
3152
+ allowPolicyDowngrade: opts.allowPolicyDowngrade,
3153
+ json: opts.json,
3154
+ verbose: opts.verbose
3155
+ });
3156
+ process.exit(exitCode);
3157
+ });
3006
3158
  program.on("command:*", () => {
3007
- console.error(pc11.red(`
3159
+ console.error(pc12.red(`
3008
3160
  [ERROR] Unrecognized command: ${program.args.join(" ")}`));
3009
- console.log(pc11.yellow("Run `aisdlc --help` to see available commands.\n"));
3161
+ console.log(pc12.yellow("Run `aisdlc --help` to see available commands.\n"));
3010
3162
  process.exit(1);
3011
3163
  });
3012
3164
  program.parse(process.argv);