@aisdlc/cli 1.5.2 → 2.0.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/README.md CHANGED
@@ -64,9 +64,9 @@ The `aisdlc` CLI provides comprehensive commands across 6 functional categories
64
64
 
65
65
  | Command | Description | Key Options |
66
66
  | --- | --- | --- |
67
- | `aisdlc init [directory]` | Bootstraps a repository with AI-SDLC folders, all 29 canonical JSON schemas (Draft 2020-12), 32 base starter templates (Product, Security, Safety, Manuals, Compliance, SDD, CI), Pull Request templates, policies (`quality-policy.yaml`, `license-policy.yaml`), and AI agent configs. Unconditionally generates universal MCP configurations (`antigravity.mcp.json`, `.vscode/mcp.json`, `.cursor/mcp.json`). Non-destructively injects standard npm scripts into consumer `package.json`. In interactive TTY mode, prompts for CI/CD provider, architecture level, and AI agent targets. | `-d, --dry-run`, `--ci <github\|gitlab\|azure\|bitbucket\|none>`, `--agents <all\|cursor\|claude\|antigravity\|copilot\|mcp\|none>`, `--arch <minimal\|full\|none>`, `--json`, `-F, --format <format>` |
67
+ | `aisdlc init [directory]` | Bootstraps a repository with AI-SDLC folders, all 33 canonical JSON schemas (Draft 2020-12), 37 base starter templates (Product, Security, Privacy, Safety, Manuals, Compliance, SDD, CI), Pull Request templates, policies (`quality-policy.yaml`, `license-policy.yaml`, `privacy-policy.yaml`), and AI agent configs (11 specialized agents). Unconditionally generates universal MCP configurations (`antigravity.mcp.json`, `.vscode/mcp.json`, `.cursor/mcp.json`). Non-destructively injects standard npm scripts into consumer `package.json`. In interactive TTY mode, prompts for CI/CD provider, architecture level, and AI agent targets. | `-d, --dry-run`, `--ci <github\|gitlab\|azure\|bitbucket\|none>`, `--agents <all\|cursor\|claude\|antigravity\|copilot\|mcp\|none>`, `--arch <minimal\|full\|none>`, `--json`, `-F, --format <format>` |
68
68
  | `aisdlc check` | Unified pre-flight gate: runs Quality Gate checks with optional auto-repair (syncs Gherkin to `.feature` and recalculates PDaC SHA-256 digests). | `--fix`, `-r, --root <path>`, `--json`, `-F, --format <format>` |
69
- | `aisdlc mcp` | Starts the native Model Context Protocol (MCP) server over `stdio` exposing 23 deterministic tools and 5 context resources. | `-r, --root <path>` |
69
+ | `aisdlc mcp` | Starts the native Model Context Protocol (MCP) server over `stdio` exposing 24 deterministic tools and 6 context resources. | `-r, --root <path>` |
70
70
 
71
71
  #### Repository Bootstrapping (`aisdlc init`)
72
72
 
@@ -76,10 +76,10 @@ Running `aisdlc init` (or `npx @aisdlc/cli init`) delivers a turnkey governance
76
76
  - **Architecture Granularity**: Minimal / Baseline (default: `ARCH-INTRO-*`, `CMP-*`, `ADR-*`), Full (all 12 arc42 sections), or None.
77
77
  - **AI Agents**: All (Cursor, Claude Code, Antigravity, Copilot, MCP - recommended) or granular environments.
78
78
  2. **Universal MCP Integration**: Regardless of CI provider or agent selection, automatically scaffolds `.cursor/mcp.json`, `antigravity.mcp.json`, and `.vscode/mcp.json` preconfigured for `@aisdlc/mcp`.
79
- 3. **Canonical Starter Templates**: Deploys 32 templates into `templates/` (product, security, safety, manuals, compliance, SDD, and CI/CD reference templates).
80
- 4. **JSON Schemas (Draft 2020-12)**: Scaffolds all 29 schemas under `schemas/` and provides automatic in-memory fallback during verification if disk files are deleted.
79
+ 3. **Canonical Starter Templates**: Deploys 37 templates into `templates/` (product, security, privacy, safety, manuals, compliance, SDD, and CI/CD reference templates).
80
+ 4. **JSON Schemas (Draft 2020-12)**: Scaffolds all 33 schemas under `schemas/` and provides automatic in-memory fallback during verification if disk files are deleted.
81
81
  5. **Pull Request Templates**: Deposits `.github/PULL_REQUEST_TEMPLATE.md` with non-negotiable Plan Execution Matrix (`[X]` vs `[O]`), Weak Points hotspots, and automated KPI tables.
82
- 6. **Automatic Script Injection**: Non-destructively registers standard shortcuts in consumer `package.json` (`check`, `check:fix`, `verify:quality`, `verify:all`, `change:new`).
82
+ 6. **Automatic Script Injection**: Non-destructively registers standard shortcuts in consumer `package.json` (`check`, `check:fix`, `verify:quality`, `verify:privacy`, `verify:all`, `change:new`).
83
83
 
84
84
  ### 2. Spec-Driven Development (SDD) & Change Management
85
85
 
@@ -95,7 +95,7 @@ Running `aisdlc init` (or `npx @aisdlc/cli init`) delivers a turnkey governance
95
95
 
96
96
  | Command | Description | Key Options |
97
97
  | --- | --- | --- |
98
- | `aisdlc verify [all]` | Executes the consolidated CI/CD suite evaluating all 11 quality and governance gates simultaneously. | `-r, --root <path>`, `-p, --policy <path>`, `-C <max-cc>`, `-K <max-cog>`, `-M <min-mi>`, `-L <max-lines>`, `-m <mode>`, `--json` |
98
+ | `aisdlc verify [all]` | Executes the consolidated CI/CD suite evaluating all 12 quality and governance gates simultaneously. | `-r, --root <path>`, `-p, --policy <path>`, `-C <max-cc>`, `-K <max-cog>`, `-M <min-mi>`, `-L <max-lines>`, `-m <mode>`, `--json` |
99
99
  | `aisdlc verify quality` | AST-based release gate evaluating Cyclomatic Complexity ($\le 10$), Cognitive ($\le 15$), Maintainability ($\ge 50$), and function length ($\le 40$). | `-p, --policy <path>`, `-C, --max-cyclomatic <n>`, `-K, --max-cognitive <n>`, `-M, --min-maintainability <n>`, `-m <STRICT\|PERMISSIVE>`, `--json` |
100
100
  | `aisdlc verify traceability` | Audits the 360° Requirements Traceability Matrix (Product HOF $\leftrightarrow$ Architecture CMP $\leftrightarrow$ Tests `.feature`). | `-r, --root <path>`, `--json` |
101
101
  | `aisdlc verify governance` | Audits task governance, human review plans, and autonomy modes (`AUTONOMOUS`, `HUMAN_REVIEW_PLAN`, etc.). | `-r, --root <path>`, `--json` |
@@ -107,6 +107,7 @@ Running `aisdlc init` (or `npx @aisdlc/cli init`) delivers a turnkey governance
107
107
  | `aisdlc verify duplicates` | Detects redundant requirements, ID collisions, title lexical redundancy ($\ge 85\%$), and BDD overlaps before coding. | `-s, --similarity <number>` *(default: 0.85)*, `-r, --root <path>`, `--json` |
108
108
  | `aisdlc verify friction [change]` | Evaluates progressive friction and Anti-Bypass rules (verifies change scope matches risk profile: `patch`, `standard`, `critical`). | `-r, --root <path>`, `--json` |
109
109
  | `aisdlc verify security` | Unified shift-left security gate: deterministic secret scanning (Gitleaks) and SAST (OWASP Top 10 vulnerabilities). | `-d, --diff`, `-b, --base <branch>`, `-g, --gitleaks`, `-s, --semgrep`, `-e, --entropy <n>`, `-m, --min-severity <level>`, `--json` |
110
+ | `aisdlc verify privacy` | Gate 12: Audits Data Protection & Privacy-by-Design (`DATA-ASSET-*`, `PRIV-ROPA-*`, `PRIV-REQ-*`, `DPIA-*`) and PII-SAST rules (`PRIV-001`–`PRIV-008`) against `privacy-policy.yaml`. Exits with code 5 on violations. | `-r, --root <path>`, `-p, --policy <path>`, `--no-reports`, `--json` |
110
111
  | `aisdlc verify secrets` | Scans for exposed credentials, API keys, tokens, and high-entropy secrets (Shannon entropy $\ge 4.3$). Fails with exit code 4. | `-d, --diff`, `-b, --base <branch>`, `-g, --gitleaks`, `-e, --entropy <n>`, `--json` |
111
112
  | `aisdlc verify sast` | Static Application Security Testing for SQL injection, command injection, eval, SSRF, path traversal, and prompt injection. | `-s, --semgrep`, `-m, --min-severity <CRITICAL\|HIGH\|MEDIUM>`, `--json` |
112
113
 
@@ -178,7 +179,7 @@ aisdlc git checkout TSK-001
178
179
  # 4. Run pre-flight check with auto-fix (syncs Gherkin and digests)
179
180
  aisdlc check --fix
180
181
 
181
- # 5. Run the consolidated CI/CD verification suite (all 11 gates)
182
+ # 5. Run the consolidated CI/CD verification suite (all 12 gates)
182
183
  aisdlc verify all
183
184
 
184
185
  # 6. Generate the interactive web dashboard and open it in the browser
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ import {
14
14
  verifyArtifactsSchemas as verifyArtifactsSchemas2,
15
15
  verifyLicenses as verifyLicenses2,
16
16
  verifyPdacGraph as verifyPdacGraph2,
17
+ verifyPrivacy as verifyPrivacy2,
17
18
  verifyProgressiveFriction as verifyProgressiveFriction2,
18
19
  verifyQualityGate as verifyQualityGate2,
19
20
  verifySast as verifySast2,
@@ -31,6 +32,7 @@ import {
31
32
  verifyArtifactsSchemas,
32
33
  verifyLicenses,
33
34
  verifyPdacGraph,
35
+ verifyPrivacy,
34
36
  verifyProgressiveFriction,
35
37
  verifyQualityGate,
36
38
  verifySast,
@@ -877,6 +879,70 @@ function runVerifyGherkin(options = {}) {
877
879
  }
878
880
  return result.inSync;
879
881
  }
882
+ function emitPrivacyJson(result) {
883
+ const payload = {
884
+ gate: "privacy",
885
+ success: result.success,
886
+ exitCode: result.success ? 0 : 5,
887
+ summary: {
888
+ totalFilesScanned: result.totalFilesScanned,
889
+ dataAssetsCount: result.dataAssetsCount,
890
+ ropaCount: result.ropaRecordsCount,
891
+ ropaRecordsCount: result.ropaRecordsCount,
892
+ privacyRequirementsCount: result.privacyRequirementsCount,
893
+ violationsCount: result.violationsCount
894
+ },
895
+ violations: result.violations,
896
+ artifacts: {
897
+ ropaInventoryPath: result.ropaOutputPath,
898
+ reportPath: result.reportOutputPath
899
+ }
900
+ };
901
+ console.log(JSON.stringify(payload, null, 2));
902
+ }
903
+ function printPrivacyConsole(result) {
904
+ console.log(` Scanned source files: ${pc.bold(String(result.totalFilesScanned))}`);
905
+ console.log(` Data assets (DATA-ASSET):${pc.bold(String(result.dataAssetsCount))}`);
906
+ console.log(` ROPA records (Art. 30): ${pc.bold(String(result.ropaRecordsCount))}`);
907
+ console.log(` Privacy reqs (PRIV-REQ): ${pc.bold(String(result.privacyRequirementsCount))}`);
908
+ console.log(` Privacy violations: ${result.violationsCount > 0 ? pc.red(String(result.violationsCount)) : pc.green("0")}`);
909
+ if (result.ropaOutputPath) console.log(` ROPA Inventory generated:${pc.cyan(result.ropaOutputPath)}`);
910
+ if (result.reportOutputPath) console.log(` Privacy Report generated:${pc.cyan(result.reportOutputPath)}`);
911
+ if (result.violations.length > 0) {
912
+ console.log(pc.red("\n Detected privacy violations:"));
913
+ for (const v of result.violations) {
914
+ const loc = v.lineNumber ? `${v.relPath}:${v.lineNumber}` : v.relPath;
915
+ console.log(` ${pc.red("\u2716")} [${v.severity}] [${v.ruleId}] ${pc.bold(loc)}: ${v.message}`);
916
+ }
917
+ }
918
+ console.log(result.success ? pc.green("\n\u2714 Data Protection & Privacy COMPLIANT\n") : pc.red("\n\u2716 Data Protection & Privacy BLOCKED (Exit Code 5)\n"));
919
+ }
920
+ function buildPrivacyVerifyInput(options, rootDir) {
921
+ return {
922
+ rootDir,
923
+ policyPath: options.policy,
924
+ generateRopa: options.ropaReport !== void 0 ? Boolean(options.ropaReport) : void 0,
925
+ ropaOutputPath: typeof options.ropaReport === "string" ? options.ropaReport : void 0,
926
+ reportOutputPath: typeof options.report === "string" ? options.report : options.report ? "reports/PRIVACY_SCAN_REPORT.md" : void 0
927
+ };
928
+ }
929
+ function runVerifyPrivacy(options = {}) {
930
+ const rootDir = options.root || process.cwd();
931
+ const useJson = isJsonOutput(options);
932
+ const isSilent = Boolean(options.silent || useJson);
933
+ if (!isSilent) {
934
+ console.log(pc.bold(pc.cyan("\n\u{1F512} [AI-SDLC] Verifying Data Protection & Privacy-by-Design (GDPR / LOPDGDD / PII-SAST)...")));
935
+ }
936
+ const result = verifyPrivacy(buildPrivacyVerifyInput(options, rootDir));
937
+ if (useJson) {
938
+ emitPrivacyJson(result);
939
+ return result.success;
940
+ }
941
+ if (!options.silent) {
942
+ printPrivacyConsole(result);
943
+ }
944
+ return result.success;
945
+ }
880
946
  function collectAllGates(options, root, isSilent) {
881
947
  return {
882
948
  quality: { success: runVerifyQuality({ ...options, root, silent: isSilent, json: false }) },
@@ -889,15 +955,21 @@ function collectAllGates(options, root, isSilent) {
889
955
  schemas: { success: runVerifySchemas({ root, silent: isSilent, json: false }) },
890
956
  duplicates: { success: runVerifyDuplicates({ root, silent: isSilent, json: false }) },
891
957
  friction: { success: runVerifyFriction({ root, silent: isSilent, json: false }) },
892
- security: { success: runVerifySecurity({ root, silent: isSilent, json: false }) }
958
+ security: { success: runVerifySecurity({ root, silent: isSilent, json: false }) },
959
+ privacy: { success: runVerifyPrivacy({ root, silent: isSilent, json: false }) }
893
960
  };
894
961
  }
962
+ function resolveVerifyAllExitCode(allPassed, gatesSummary) {
963
+ if (allPassed) return 0;
964
+ if (!gatesSummary.security?.success) return 4;
965
+ if (!gatesSummary.privacy?.success) return 5;
966
+ return 1;
967
+ }
895
968
  function emitVerifyAllJson(gatesSummary, allPassed) {
896
969
  const totalGates = Object.keys(gatesSummary).length;
897
970
  const passedCount = Object.values(gatesSummary).filter((g) => g.success).length;
898
971
  const failedCount = totalGates - passedCount;
899
- const okSecurity = gatesSummary.security.success;
900
- const exitCode = allPassed ? 0 : !okSecurity ? 4 : 1;
972
+ const exitCode = resolveVerifyAllExitCode(allPassed, gatesSummary);
901
973
  const violations = Object.entries(gatesSummary).filter(([, g]) => !g.success).map(([name]) => ({ gate: name, message: `Gate ${name} failed verification criteria` }));
902
974
  const payload = {
903
975
  gate: "all",
@@ -920,7 +992,8 @@ var VERIFY_ALL_GATES_LIST = [
920
992
  { key: "schemas", title: " 8. Artifact JSON Schemas (+ Handoff YAML): " },
921
993
  { key: "duplicates", title: " 9. Duplicate Requirements (Shift-Left Gate): " },
922
994
  { key: "friction", title: " 10. Progressive Friction & Anti-Bypass: " },
923
- { key: "security", title: " 11. Shift-Left Security (Secrets & SAST): " }
995
+ { key: "security", title: " 11. Shift-Left Security (Secrets & SAST): " },
996
+ { key: "privacy", title: " 12. Data Protection & Privacy (GDPR/PII-SAST): " }
924
997
  ];
925
998
  function printVerifyAllSummaryTable(gatesSummary, allPassed) {
926
999
  console.log(pc.bold(pc.magenta("================================================================")));
@@ -1175,6 +1248,24 @@ function auditFrictionGate(rootDir) {
1175
1248
  remediation: "Reclassify change profile to 'standard' or 'critical', or revert protected path changes."
1176
1249
  };
1177
1250
  }
1251
+ function auditPrivacyGate(rootDir) {
1252
+ const res = verifyPrivacy2({ rootDir });
1253
+ if (res.success) {
1254
+ return {
1255
+ name: "Data Protection & Privacy-by-Design (GDPR/PII-SAST)",
1256
+ status: "PASSED",
1257
+ message: `${res.totalFilesScanned} clean files (${res.dataAssetsCount} data assets, ${res.ropaRecordsCount} ROPA records, 0 violations)`
1258
+ };
1259
+ }
1260
+ const first = res.violations[0];
1261
+ const detail = first ? ` (e.g. ${first.ruleId} in ${first.relPath})` : "";
1262
+ return {
1263
+ name: "Data Protection & Privacy-by-Design (GDPR/PII-SAST)",
1264
+ status: "FAILED",
1265
+ message: `${res.violationsCount} privacy violation(s) detected${detail}`,
1266
+ remediation: "Run 'aisdlc verify privacy' and mask PII or register ROPA / retention policies."
1267
+ };
1268
+ }
1178
1269
  function renderGateBadge(status) {
1179
1270
  if (status === "PASSED") return pc2.green("\u2714 PASSED ");
1180
1271
  if (status === "FIXED") return pc2.cyan("\u{1F527} AUTO-FIX ");
@@ -1233,7 +1324,8 @@ function collectPreflightGates(rootDir, fix, gherkinCount, digestsCount) {
1233
1324
  auditSchemasGate(rootDir),
1234
1325
  auditDuplicatesGate(rootDir),
1235
1326
  auditFrictionGate(rootDir),
1236
- auditSecurityGate(rootDir)
1327
+ auditSecurityGate(rootDir),
1328
+ auditPrivacyGate(rootDir)
1237
1329
  ];
1238
1330
  }
1239
1331
  function emitCheckJson(result) {
@@ -2189,7 +2281,7 @@ function runChangeNew(options) {
2189
2281
 
2190
2282
  // src/index.ts
2191
2283
  var program = new Command();
2192
- program.name("aisdlc").description("AI-SDLC: Spec-Driven Development, Governance & Quality Gates for AI & Humans").version("1.5.2");
2284
+ program.name("aisdlc").description("AI-SDLC: Spec-Driven Development, Governance & Quality Gates for AI & Humans").version("2.0.0");
2193
2285
  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("--json", "Emit verification results in structured JSON format").option("-F, --format <format>", "Output format: text or json").action((opts) => {
2194
2286
  const passed = runCheck({
2195
2287
  fix: opts.fix,
@@ -2200,7 +2292,7 @@ program.command("check").description("Unified pre-flight command: validates Qual
2200
2292
  process.exit(passed ? 0 : 1);
2201
2293
  });
2202
2294
  var verifyCommand = program.command("verify").description("Run deterministic verifiers for quality, traceability, governance, and licenses");
2203
- verifyCommand.command("all", { isDefault: true }).description("Run the full quality and governance suite (Quality Gate + RTM + Tasks + Tests + Licenses + PDaC + Schemas + Duplicates + Security)").option("-r, --root <path>", "Project root directory").option("-p, --policy <path>", "Path to quality-policy.yaml").option("-C, --max-cyclomatic <number>", "Maximum Cyclomatic Complexity threshold").option("-K, --max-cognitive <number>", "Maximum Cognitive Complexity threshold").option("-M, --min-maintainability <number>", "Minimum Maintainability threshold (0-100)").option("-L, --max-lines <number>", "Maximum lines per function threshold").option("-m, --mode <mode>", "Enforcement mode: STRICT or PERMISSIVE").option("--json", "Emit verification results in structured JSON format").option("-F, --format <format>", "Output format: text or json").action((opts) => {
2295
+ verifyCommand.command("all", { isDefault: true }).description("Run the full quality and governance suite (Quality Gate + RTM + Tasks + Tests + Licenses + PDaC + Schemas + Duplicates + Security + Privacy)").option("-r, --root <path>", "Project root directory").option("-p, --policy <path>", "Path to quality-policy.yaml").option("-C, --max-cyclomatic <number>", "Maximum Cyclomatic Complexity threshold").option("-K, --max-cognitive <number>", "Maximum Cognitive Complexity threshold").option("-M, --min-maintainability <number>", "Minimum Maintainability threshold (0-100)").option("-L, --max-lines <number>", "Maximum lines per function threshold").option("-m, --mode <mode>", "Enforcement mode: STRICT or PERMISSIVE").option("--json", "Emit verification results in structured JSON format").option("-F, --format <format>", "Output format: text or json").action((opts) => {
2204
2296
  const passed = runVerifyAll({
2205
2297
  root: opts.root,
2206
2298
  policy: opts.policy,
@@ -2307,6 +2399,18 @@ verifyCommand.command("sast").description("Shift-left static application securit
2307
2399
  });
2308
2400
  process.exit(passed ? 0 : 1);
2309
2401
  });
2402
+ verifyCommand.command("privacy").description("Verify Data Protection & Privacy-by-Design against privacy-policy.yaml (GDPR ROPA, PII-SAST, retention/erasure)").option("-r, --root <path>", "Project root directory").option("-p, --policy <path>", "Path to privacy-policy.yaml").option("--ropa-report [path]", "Generate GDPR Art. 30 ROPA_INVENTORY.md report").option("--report [path]", "Generate PRIVACY_SCAN_REPORT.md report").option("-m, --min-severity <level>", "Minimum severity for failure: CRITICAL, HIGH, MEDIUM, LOW", "HIGH").option("--json", "Emit verification results in structured JSON format").option("-F, --format <format>", "Output format: text or json").action((opts) => {
2403
+ const passed = runVerifyPrivacy({
2404
+ root: opts.root,
2405
+ policy: opts.policy,
2406
+ ropaReport: opts.ropaReport,
2407
+ report: opts.report,
2408
+ minSeverity: opts.minSeverity,
2409
+ json: opts.json,
2410
+ format: opts.format
2411
+ });
2412
+ process.exit(passed ? 0 : 5);
2413
+ });
2310
2414
  verifyCommand.command("friction [change]").description("Verify progressive friction and Anti-Bypass guardrails for quick patches").option("-r, --root <path>", "Project root directory").option("--json", "Emit verification results in structured JSON format").option("-F, --format <format>", "Output format: text or json").action((change, opts) => {
2311
2415
  const passed = runVerifyFriction({ root: opts.root, change, json: opts.json, format: opts.format });
2312
2416
  process.exit(passed ? 0 : 1);