@aisdlc/cli 4.0.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 +302 -61
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import { Command } from "commander";
|
|
5
|
-
import
|
|
5
|
+
import pc12 from "picocolors";
|
|
6
6
|
|
|
7
7
|
// src/commands/check.ts
|
|
8
8
|
import pc2 from "picocolors";
|
|
@@ -1529,8 +1529,12 @@ function runCheck(options = {}) {
|
|
|
1529
1529
|
}
|
|
1530
1530
|
|
|
1531
1531
|
// src/commands/gherkin.ts
|
|
1532
|
+
import * as readline from "readline";
|
|
1532
1533
|
import pc3 from "picocolors";
|
|
1533
|
-
import {
|
|
1534
|
+
import {
|
|
1535
|
+
extractGherkinFeatures as extractGherkinFeatures2,
|
|
1536
|
+
scaffoldGherkinSteps
|
|
1537
|
+
} from "@aisdlc/core";
|
|
1534
1538
|
function printGherkinResult(result) {
|
|
1535
1539
|
console.log(` Generated .feature files: ${pc3.bold(String(result.features.length))}`);
|
|
1536
1540
|
console.log(` Total scenarios: ${pc3.bold(String(result.totalScenarios))}`);
|
|
@@ -1569,6 +1573,79 @@ function runGherkinExtract(options = {}) {
|
|
|
1569
1573
|
}
|
|
1570
1574
|
return result.success;
|
|
1571
1575
|
}
|
|
1576
|
+
function defaultConfirmInstall(question) {
|
|
1577
|
+
return new Promise((resolve3) => {
|
|
1578
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
1579
|
+
rl.question(question, (answer) => {
|
|
1580
|
+
rl.close();
|
|
1581
|
+
const normalized = answer.trim().toLowerCase();
|
|
1582
|
+
resolve3(normalized === "y" || normalized === "yes");
|
|
1583
|
+
});
|
|
1584
|
+
});
|
|
1585
|
+
}
|
|
1586
|
+
function printScaffoldText(result) {
|
|
1587
|
+
if (result.status === "ERROR") {
|
|
1588
|
+
console.error(pc3.red(`
|
|
1589
|
+
\u2716 [Gherkin Scaffold] Error (${result.errorCode}): ${result.featureFile}
|
|
1590
|
+
`));
|
|
1591
|
+
return;
|
|
1592
|
+
}
|
|
1593
|
+
if (result.status === "GENERATOR_MISSING") {
|
|
1594
|
+
console.log(
|
|
1595
|
+
pc3.yellow(
|
|
1596
|
+
`
|
|
1597
|
+
\u26A0 Native generator (${result.generatorBin}) missing. Run: ${pc3.bold(result.installCommand || "")} (License: ${result.license})
|
|
1598
|
+
`
|
|
1599
|
+
)
|
|
1600
|
+
);
|
|
1601
|
+
return;
|
|
1602
|
+
}
|
|
1603
|
+
const files = result.outputFiles?.length ? result.outputFiles : [result.outputFile];
|
|
1604
|
+
for (const out of files.filter(Boolean)) {
|
|
1605
|
+
console.log(` ${pc3.green("\u2714")} [${result.status}] \u2794 ${pc3.bold(String(out))}`);
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
async function handleInteractiveMissing(initialResult, featurePath, options, rootDir) {
|
|
1609
|
+
const ask = options.promptFn || defaultConfirmInstall;
|
|
1610
|
+
const confirmed = await ask(
|
|
1611
|
+
`Native BDD generator is not installed (${initialResult.installCommand}, license: ${initialResult.license}). Install now? [y/N]: `
|
|
1612
|
+
);
|
|
1613
|
+
return scaffoldGherkinSteps({
|
|
1614
|
+
rootDir,
|
|
1615
|
+
featurePath,
|
|
1616
|
+
lang: options.lang,
|
|
1617
|
+
outputPath: options.output,
|
|
1618
|
+
installMissing: confirmed,
|
|
1619
|
+
allowFallback: !confirmed,
|
|
1620
|
+
execFn: options.execFn
|
|
1621
|
+
});
|
|
1622
|
+
}
|
|
1623
|
+
function emitScaffoldOutput(result, options, useJson) {
|
|
1624
|
+
if (useJson) {
|
|
1625
|
+
console.log(JSON.stringify(result, null, 2));
|
|
1626
|
+
} else if (!options.silent) {
|
|
1627
|
+
printScaffoldText(result);
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
async function runGherkinScaffold(featurePath, options) {
|
|
1631
|
+
const rootDir = options.root || process.cwd();
|
|
1632
|
+
const useJson = isJsonOutput(options);
|
|
1633
|
+
const isInteractive = Boolean(process.stdin.isTTY && process.stdout.isTTY && !useJson && !options.silent);
|
|
1634
|
+
let result = scaffoldGherkinSteps({
|
|
1635
|
+
rootDir,
|
|
1636
|
+
featurePath,
|
|
1637
|
+
lang: options.lang,
|
|
1638
|
+
outputPath: options.output,
|
|
1639
|
+
installMissing: options.install,
|
|
1640
|
+
allowFallback: options.fallback,
|
|
1641
|
+
execFn: options.execFn
|
|
1642
|
+
});
|
|
1643
|
+
if (result.status === "GENERATOR_MISSING" && (isInteractive || options.promptFn)) {
|
|
1644
|
+
result = await handleInteractiveMissing(result, featurePath, options, rootDir);
|
|
1645
|
+
}
|
|
1646
|
+
emitScaffoldOutput(result, options, useJson);
|
|
1647
|
+
return result.success;
|
|
1648
|
+
}
|
|
1572
1649
|
|
|
1573
1650
|
// src/commands/git.ts
|
|
1574
1651
|
import pc4 from "picocolors";
|
|
@@ -1696,7 +1773,7 @@ function runGitDetectAuthor(options = {}) {
|
|
|
1696
1773
|
}
|
|
1697
1774
|
|
|
1698
1775
|
// src/commands/init.ts
|
|
1699
|
-
import * as
|
|
1776
|
+
import * as readline2 from "readline/promises";
|
|
1700
1777
|
import { initProject } from "@aisdlc/core";
|
|
1701
1778
|
import pc5 from "picocolors";
|
|
1702
1779
|
var CI_MENU = [
|
|
@@ -1725,7 +1802,7 @@ function parseCiChoice(answer) {
|
|
|
1725
1802
|
return trimmed in CI_CHOICE_MAP ? CI_CHOICE_MAP[trimmed] : trimmed;
|
|
1726
1803
|
}
|
|
1727
1804
|
async function promptForCi() {
|
|
1728
|
-
const rl =
|
|
1805
|
+
const rl = readline2.createInterface({ input: process.stdin, output: process.stdout });
|
|
1729
1806
|
console.log(CI_MENU);
|
|
1730
1807
|
try {
|
|
1731
1808
|
const answer = await rl.question(pc5.bold("\nWhich CI/CD provider do you wish to configure? [1-5] (default 1): "));
|
|
@@ -1748,7 +1825,7 @@ var ARCH_MENU = [
|
|
|
1748
1825
|
" 3) " + pc5.gray("None") + " (No architecture templates)"
|
|
1749
1826
|
].join("\n");
|
|
1750
1827
|
async function promptForArchitecture() {
|
|
1751
|
-
const rl =
|
|
1828
|
+
const rl = readline2.createInterface({ input: process.stdin, output: process.stdout });
|
|
1752
1829
|
console.log(ARCH_MENU);
|
|
1753
1830
|
try {
|
|
1754
1831
|
const answer = await rl.question(pc5.bold("\nWhich architecture granularity level do you wish to configure? [1-3] (default 1): "));
|
|
@@ -1781,7 +1858,7 @@ function parseAgentsChoice(answer) {
|
|
|
1781
1858
|
return !trimmed ? "all" : map[trimmed] || trimmed;
|
|
1782
1859
|
}
|
|
1783
1860
|
async function promptForAgents() {
|
|
1784
|
-
const rl =
|
|
1861
|
+
const rl = readline2.createInterface({ input: process.stdin, output: process.stdout });
|
|
1785
1862
|
console.log(AGENTS_MENU);
|
|
1786
1863
|
try {
|
|
1787
1864
|
const answer = await rl.question(pc5.bold("\nWhich agents do you wish to deploy? [1-7 or comma-separated list] (default 1): "));
|
|
@@ -2015,7 +2092,11 @@ async function runMcpServer(options = {}) {
|
|
|
2015
2092
|
import * as path2 from "path";
|
|
2016
2093
|
import { spawn } from "child_process";
|
|
2017
2094
|
import pc8 from "picocolors";
|
|
2018
|
-
import {
|
|
2095
|
+
import {
|
|
2096
|
+
generateComplianceEvidenceBundleSync,
|
|
2097
|
+
generateDashboardReport,
|
|
2098
|
+
generateQualityReport
|
|
2099
|
+
} from "@aisdlc/core";
|
|
2019
2100
|
function openInBrowser(filePath) {
|
|
2020
2101
|
const resolved = path2.resolve(filePath);
|
|
2021
2102
|
const platform = process.platform;
|
|
@@ -2096,6 +2177,50 @@ function runReportQuality(options = {}) {
|
|
|
2096
2177
|
printQualityReportMetrics(result, rootDir);
|
|
2097
2178
|
return result.verdict === "PASS";
|
|
2098
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
|
+
}
|
|
2099
2224
|
|
|
2100
2225
|
// src/commands/review.ts
|
|
2101
2226
|
import pc9 from "picocolors";
|
|
@@ -2164,9 +2289,79 @@ function runInspect(query, options = {}) {
|
|
|
2164
2289
|
return result.found;
|
|
2165
2290
|
}
|
|
2166
2291
|
|
|
2167
|
-
// src/commands/
|
|
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
|
|
2168
2323
|
import * as path3 from "path";
|
|
2169
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";
|
|
2170
2365
|
import {
|
|
2171
2366
|
depositProductHandoffSidecar,
|
|
2172
2367
|
detectActiveChangeForIntegration,
|
|
@@ -2194,8 +2389,8 @@ function buildHandoffPayload(options, changeId) {
|
|
|
2194
2389
|
return { handoff, reqList };
|
|
2195
2390
|
}
|
|
2196
2391
|
function printDepositSuccess(depositedPath, handoffId, reqList) {
|
|
2197
|
-
console.log(` ${
|
|
2198
|
-
console.log(` Handoff ID: ${
|
|
2392
|
+
console.log(` ${pc11.green("\u2714")} Sidecar successfully deposited: ${pc11.bold(depositedPath)}`);
|
|
2393
|
+
console.log(` Handoff ID: ${pc11.cyan(handoffId)}`);
|
|
2199
2394
|
console.log(` Delivered requirements: ${reqList.join(", ")}
|
|
2200
2395
|
`);
|
|
2201
2396
|
}
|
|
@@ -2211,12 +2406,12 @@ function emitDepositJson(success, changeId, framework, depositedPath, handoff, e
|
|
|
2211
2406
|
console.log(JSON.stringify(payload, null, 2));
|
|
2212
2407
|
}
|
|
2213
2408
|
function printDepositHeader(changeId, framework) {
|
|
2214
|
-
console.log(
|
|
2409
|
+
console.log(pc11.bold(pc11.cyan(`
|
|
2215
2410
|
\u{1F4E6} [AI-SDLC SDD] Depositing PDaC Handoff Sidecar for '${changeId}' (${framework})...`)));
|
|
2216
2411
|
}
|
|
2217
2412
|
function printDepositError(err) {
|
|
2218
2413
|
const errMessage = err instanceof Error ? err.message : String(err);
|
|
2219
|
-
console.error(
|
|
2414
|
+
console.error(pc11.red(` \u2716 Error depositing sidecar: ${errMessage}
|
|
2220
2415
|
`));
|
|
2221
2416
|
}
|
|
2222
2417
|
function runSddDeposit(options) {
|
|
@@ -2242,13 +2437,13 @@ function runSddDeposit(options) {
|
|
|
2242
2437
|
}
|
|
2243
2438
|
function printHandoffEntry(isValid, id, relDir, reqCount) {
|
|
2244
2439
|
if (isValid) {
|
|
2245
|
-
console.log(` ${
|
|
2440
|
+
console.log(` ${pc11.green("\u2714")} [${pc11.bold(id)}] in ${relDir} (Requirements: ${reqCount})`);
|
|
2246
2441
|
} else {
|
|
2247
|
-
console.log(` ${
|
|
2442
|
+
console.log(` ${pc11.red("\u2716")} [${pc11.bold(id)}] in ${relDir} - Invalid handoff schema or subgraph.`);
|
|
2248
2443
|
}
|
|
2249
2444
|
}
|
|
2250
2445
|
function processHandoffEntry(handoff, changeDir, rootDir, isSilent) {
|
|
2251
|
-
const relDir =
|
|
2446
|
+
const relDir = path4.relative(rootDir, changeDir).replace(/\\/g, "/");
|
|
2252
2447
|
const reqCount = handoff.subgraph && Array.isArray(handoff.subgraph.requirements) ? handoff.subgraph.requirements.length : 0;
|
|
2253
2448
|
const isValid = Boolean(handoff.id && handoff.id.startsWith("HOF-") && reqCount > 0);
|
|
2254
2449
|
const id = handoff.id || "UNKNOWN";
|
|
@@ -2260,7 +2455,7 @@ function processHandoffEntry(handoff, changeDir, rootDir, isSilent) {
|
|
|
2260
2455
|
function auditHandoffsMap(handoffsMap, rootDir, isSilent) {
|
|
2261
2456
|
if (handoffsMap.size === 0) {
|
|
2262
2457
|
if (!isSilent) {
|
|
2263
|
-
console.log(
|
|
2458
|
+
console.log(pc11.yellow(" [NOTICE] No handoff.yaml sidecar companion files found in specs/."));
|
|
2264
2459
|
}
|
|
2265
2460
|
return { handoffItems: [], validCount: 0, invalidCount: 0 };
|
|
2266
2461
|
}
|
|
@@ -2284,10 +2479,10 @@ function auditDuplicatesShiftLeft(rootDir, checkDuplicates, isSilent) {
|
|
|
2284
2479
|
}
|
|
2285
2480
|
const dupResult = verifyArtifactDuplicates3({ rootDir });
|
|
2286
2481
|
if (dupResult.errorCount > 0 && !isSilent) {
|
|
2287
|
-
console.log(
|
|
2482
|
+
console.log(pc11.red(`
|
|
2288
2483
|
\u2716 [Shift-Left Gate] Detected ${dupResult.errorCount} requirement collision(s)/duplicate(s) in workspace:`));
|
|
2289
2484
|
for (const issue of dupResult.issues.filter((i) => i.severity === "ERROR")) {
|
|
2290
|
-
console.log(` ${
|
|
2485
|
+
console.log(` ${pc11.red("\u2716")} [${issue.type}] ${issue.id} in ${issue.file}: ${issue.message}`);
|
|
2291
2486
|
}
|
|
2292
2487
|
}
|
|
2293
2488
|
return { duplicateErrors: dupResult.errorCount, duplicateIssues: dupResult.issues };
|
|
@@ -2308,12 +2503,12 @@ function emitSddVerifyJson(payload) {
|
|
|
2308
2503
|
}
|
|
2309
2504
|
function printSddVerifyVerdict(isOk) {
|
|
2310
2505
|
console.log(
|
|
2311
|
-
isOk ?
|
|
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")
|
|
2312
2507
|
);
|
|
2313
2508
|
}
|
|
2314
2509
|
function printSddVerifyHeader(totalFound) {
|
|
2315
|
-
console.log(
|
|
2316
|
-
console.log(` Found PDaC sidecars: ${
|
|
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))}`);
|
|
2317
2512
|
}
|
|
2318
2513
|
function runSddVerify(options = {}) {
|
|
2319
2514
|
const rootDir = options.root || process.cwd();
|
|
@@ -2337,7 +2532,7 @@ function runSddVerify(options = {}) {
|
|
|
2337
2532
|
}
|
|
2338
2533
|
function handleUndetectedChange(detection, isSilent, useJson) {
|
|
2339
2534
|
if (!isSilent) {
|
|
2340
|
-
console.log(
|
|
2535
|
+
console.log(pc11.yellow("\n\u2139 [AI-SDLC SDD] No active SDD change detected to integrate:"));
|
|
2341
2536
|
for (const r of detection.reasons) console.log(` - ${r}`);
|
|
2342
2537
|
console.log("");
|
|
2343
2538
|
}
|
|
@@ -2349,7 +2544,7 @@ function handleUndetectedChange(detection, isSilent, useJson) {
|
|
|
2349
2544
|
}
|
|
2350
2545
|
function handlePendingTasks(detection, isSilent, useJson) {
|
|
2351
2546
|
if (!isSilent) {
|
|
2352
|
-
console.log(
|
|
2547
|
+
console.log(pc11.red(`
|
|
2353
2548
|
\u2716 [AI-SDLC SDD] Detected change '${detection.changeId}' has pending tasks (${detection.completedTasksCount}/${detection.totalTasksCount} completed). All tasks must be in COMPLETED status.
|
|
2354
2549
|
`));
|
|
2355
2550
|
}
|
|
@@ -2381,7 +2576,7 @@ function resolveAutoChange(options, rootDir, isSilent, useJson) {
|
|
|
2381
2576
|
return handlePendingTasks(detection, isSilent, useJson);
|
|
2382
2577
|
}
|
|
2383
2578
|
if (!isSilent) {
|
|
2384
|
-
console.log(
|
|
2579
|
+
console.log(pc11.cyan(` \u2714 Automatically detected SDD change: ${pc11.bold(detection.changeId)} (via ${detection.source})`));
|
|
2385
2580
|
}
|
|
2386
2581
|
return detection.changeId;
|
|
2387
2582
|
}
|
|
@@ -2389,7 +2584,7 @@ function resolveIntegrationChangeId(options, rootDir, isSilent, useJson) {
|
|
|
2389
2584
|
const changeId = options.change || (options.auto ? resolveAutoChange(options, rootDir, isSilent, useJson) : null);
|
|
2390
2585
|
if (!changeId) {
|
|
2391
2586
|
if (!options.auto) {
|
|
2392
|
-
if (!isSilent) console.error(
|
|
2587
|
+
if (!isSilent) console.error(pc11.red("\n\u2716 Change identifier (--change <id>) or --auto option must be specified.\n"));
|
|
2393
2588
|
if (useJson) {
|
|
2394
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));
|
|
2395
2590
|
}
|
|
@@ -2399,22 +2594,22 @@ function resolveIntegrationChangeId(options, rootDir, isSilent, useJson) {
|
|
|
2399
2594
|
return changeId;
|
|
2400
2595
|
}
|
|
2401
2596
|
function printIntegrationSuccess(changeId, result) {
|
|
2402
|
-
console.log(` ${
|
|
2403
|
-
console.log(` - Completed tasks: ${
|
|
2404
|
-
console.log(` - Integrated requirements: ${
|
|
2405
|
-
console.log(` - Created canonical artifacts: ${
|
|
2406
|
-
console.log(` - Updated product artifacts: ${
|
|
2407
|
-
console.log(` - Updated arc42 architecture: ${
|
|
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")}`);
|
|
2408
2603
|
if (result.archived) {
|
|
2409
|
-
console.log(` - Archived to: ${
|
|
2604
|
+
console.log(` - Archived to: ${pc11.cyan(result.archivedPath || "specs/changes/completed")}`);
|
|
2410
2605
|
}
|
|
2411
|
-
console.log(
|
|
2606
|
+
console.log(pc11.green("\n\u2714 Canonical specification integration COMPLETED (EXIT 0)\n"));
|
|
2412
2607
|
}
|
|
2413
2608
|
function printIntegrationFailure(changeId, errors) {
|
|
2414
|
-
console.log(
|
|
2609
|
+
console.log(pc11.red(`
|
|
2415
2610
|
\u2716 Failed to integrate change '${changeId}':`));
|
|
2416
|
-
for (const err of errors) console.log(` ${
|
|
2417
|
-
console.log(
|
|
2611
|
+
for (const err of errors) console.log(` ${pc11.red("\u2716")} ${err}`);
|
|
2612
|
+
console.log(pc11.red("\n\u2716 Integration BLOCKED (EXIT 1)\n"));
|
|
2418
2613
|
}
|
|
2419
2614
|
function emitIntegrateJson(changeId, result) {
|
|
2420
2615
|
const payload = {
|
|
@@ -2434,16 +2629,16 @@ function emitIntegrateJson(changeId, result) {
|
|
|
2434
2629
|
console.log(JSON.stringify(payload, null, 2));
|
|
2435
2630
|
}
|
|
2436
2631
|
function printBatchIntegrationResult(result) {
|
|
2437
|
-
console.log(` ${
|
|
2438
|
-
console.log(` ${
|
|
2439
|
-
console.log(` ${
|
|
2440
|
-
console.log(` ${
|
|
2441
|
-
console.log(` ${
|
|
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))}`);
|
|
2442
2637
|
if (result.success) {
|
|
2443
|
-
console.log(
|
|
2638
|
+
console.log(pc11.green("\n\u2714 Batch canonical specification integration COMPLETED (EXIT 0)\n"));
|
|
2444
2639
|
} else {
|
|
2445
|
-
for (const err of result.errors) console.log(` ${
|
|
2446
|
-
console.log(
|
|
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"));
|
|
2447
2642
|
}
|
|
2448
2643
|
}
|
|
2449
2644
|
function emitBatchIntegrateJson(result) {
|
|
@@ -2463,7 +2658,7 @@ function emitBatchIntegrateJson(result) {
|
|
|
2463
2658
|
}
|
|
2464
2659
|
function runBatchSddIntegrate(options, rootDir, isSilent, useJson) {
|
|
2465
2660
|
if (!isSilent) {
|
|
2466
|
-
console.log(
|
|
2661
|
+
console.log(pc11.bold(pc11.cyan("\n\u{1F504} [AI-SDLC SDD] Consolidating all completed SDD changes into canonical specifications...")));
|
|
2467
2662
|
}
|
|
2468
2663
|
const result = integrateAllSddChanges({ rootDir, author: options.author, autoArchive: options.autoArchive });
|
|
2469
2664
|
if (!isSilent) printBatchIntegrationResult(result);
|
|
@@ -2480,7 +2675,7 @@ function runSddIntegrate(options) {
|
|
|
2480
2675
|
const changeId = resolveIntegrationChangeId(options, rootDir, isSilent, useJson);
|
|
2481
2676
|
if (!changeId) return false;
|
|
2482
2677
|
if (!isSilent) {
|
|
2483
|
-
console.log(
|
|
2678
|
+
console.log(pc11.bold(pc11.cyan(`
|
|
2484
2679
|
\u{1F504} [AI-SDLC SDD] Integrating change '${changeId}' into canonical specification...`)));
|
|
2485
2680
|
}
|
|
2486
2681
|
const result = integrateSddChange({ rootDir, changeId, author: options.author, autoArchive: options.autoArchive });
|
|
@@ -2492,24 +2687,24 @@ function runSddIntegrate(options) {
|
|
|
2492
2687
|
return result.success;
|
|
2493
2688
|
}
|
|
2494
2689
|
function printChangeNewSuccess(result) {
|
|
2495
|
-
console.log(` ${
|
|
2496
|
-
console.log(` ${
|
|
2497
|
-
console.log(` ${
|
|
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")}`);
|
|
2498
2693
|
if (result.productArtifactCreated) {
|
|
2499
|
-
console.log(` ${
|
|
2694
|
+
console.log(` ${pc11.green("\u2714")} Product artifact: ${pc11.bold(result.productArtifactCreated)} (status: draft)`);
|
|
2500
2695
|
}
|
|
2501
|
-
console.log(` ${
|
|
2696
|
+
console.log(` ${pc11.green("\u2714")} Cited artifacts: ${result.citedArtifacts.length}`);
|
|
2502
2697
|
for (const cite of result.citedArtifacts) {
|
|
2503
|
-
console.log(` - [${
|
|
2698
|
+
console.log(` - [${pc11.cyan(cite.id)}] ${cite.digest.substring(0, 19)}... (${cite.title || "Untitled"})`);
|
|
2504
2699
|
}
|
|
2505
|
-
console.log(` ${
|
|
2506
|
-
console.log(
|
|
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"));
|
|
2507
2702
|
}
|
|
2508
2703
|
function printChangeNewFailure(name, errors) {
|
|
2509
|
-
console.log(
|
|
2704
|
+
console.log(pc11.red(`
|
|
2510
2705
|
\u2716 Failed to create SDD change '${name}':`));
|
|
2511
|
-
for (const err of errors) console.log(` ${
|
|
2512
|
-
console.log(
|
|
2706
|
+
for (const err of errors) console.log(` ${pc11.red("\u2716")} ${err}`);
|
|
2707
|
+
console.log(pc11.red("\n\u2716 Change creation BLOCKED\n"));
|
|
2513
2708
|
}
|
|
2514
2709
|
function emitChangeNewJson(name, result) {
|
|
2515
2710
|
const payload = {
|
|
@@ -2529,7 +2724,7 @@ function emitChangeNewJson(name, result) {
|
|
|
2529
2724
|
console.log(JSON.stringify(payload, null, 2));
|
|
2530
2725
|
}
|
|
2531
2726
|
function printChangeNewHeader(name, framework) {
|
|
2532
|
-
console.log(
|
|
2727
|
+
console.log(pc11.bold(pc11.cyan(`
|
|
2533
2728
|
\u{1F4E6} [AI-SDLC SDD] Scaffolding new SDD change '${name}' (${framework})...`)));
|
|
2534
2729
|
}
|
|
2535
2730
|
function handleScaffoldOutput(name, result, isSilent, useJson) {
|
|
@@ -2564,7 +2759,18 @@ function runChangeNew(options) {
|
|
|
2564
2759
|
|
|
2565
2760
|
// src/index.ts
|
|
2566
2761
|
var program = new Command();
|
|
2567
|
-
program.name("aisdlc").description("AI-SDLC: Spec-Driven Development, Governance & Quality Gates for AI & Humans").version("4.
|
|
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
|
+
});
|
|
2568
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) => {
|
|
2569
2775
|
const passed = runCheck({
|
|
2570
2776
|
fix: opts.fix,
|
|
@@ -2730,6 +2936,17 @@ reportCommand.command("dashboard").description("Generate interactive web dashboa
|
|
|
2730
2936
|
});
|
|
2731
2937
|
process.exit(passed ? 0 : 1);
|
|
2732
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
|
+
});
|
|
2733
2950
|
var gherkinCommand = program.command("gherkin").description("BDD / Gherkin synchronization and extraction tools");
|
|
2734
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) => {
|
|
2735
2952
|
const passed = runGherkinExtract({
|
|
@@ -2741,6 +2958,18 @@ gherkinCommand.command("extract").description("Extract ```gherkin``` blocks from
|
|
|
2741
2958
|
});
|
|
2742
2959
|
process.exit(passed ? 0 : 1);
|
|
2743
2960
|
});
|
|
2961
|
+
gherkinCommand.command("scaffold <feature-file>").description("Scaffold failing RED BDD step definitions across target languages (ts, py, go, rs, cs)").requiredOption("--lang <langs...>", "Target language(s): ts, py, go, rs, cs (comma-separated or multiple)").option("-o, --output <path>", "Explicit output file path for generated step definitions").option("--install", "Automatically install missing native BDD generator").option("--fallback", "Use deterministic RED fallback template if native generator is missing").option("-r, --root <path>", "Project root directory").option("--json", "Structured JSON format output").option("-F, --format <format>", "Output format: text or json").action(async (featureFile, opts) => {
|
|
2962
|
+
const passed = await runGherkinScaffold(featureFile, {
|
|
2963
|
+
root: opts.root,
|
|
2964
|
+
lang: opts.lang,
|
|
2965
|
+
output: opts.output,
|
|
2966
|
+
install: opts.install,
|
|
2967
|
+
fallback: opts.fallback,
|
|
2968
|
+
json: opts.json,
|
|
2969
|
+
format: opts.format
|
|
2970
|
+
});
|
|
2971
|
+
process.exit(passed ? 0 : 1);
|
|
2972
|
+
});
|
|
2744
2973
|
var gitCommand = program.command("git").description("Tools for the 4-tier hierarchical Git branch model");
|
|
2745
2974
|
gitCommand.command("validate <branch>").description("Validate naming and hierarchy of a Git branch (Tier 1 to 4)").action((branch) => {
|
|
2746
2975
|
const passed = runGitValidate(branch);
|
|
@@ -2914,10 +3143,22 @@ reviewCmd.command("submit").description("Persist a formal review report for an a
|
|
|
2914
3143
|
});
|
|
2915
3144
|
if (!ok) process.exit(1);
|
|
2916
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
|
+
});
|
|
2917
3158
|
program.on("command:*", () => {
|
|
2918
|
-
console.error(
|
|
3159
|
+
console.error(pc12.red(`
|
|
2919
3160
|
[ERROR] Unrecognized command: ${program.args.join(" ")}`));
|
|
2920
|
-
console.log(
|
|
3161
|
+
console.log(pc12.yellow("Run `aisdlc --help` to see available commands.\n"));
|
|
2921
3162
|
process.exit(1);
|
|
2922
3163
|
});
|
|
2923
3164
|
program.parse(process.argv);
|