@aisdlc/core 2.0.2 → 2.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.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
+ var crypto = require('crypto');
3
4
  var fs7 = require('fs');
4
5
  var path4 = require('path');
5
6
  var yaml3 = require('js-yaml');
6
7
  var tsMorph = require('ts-morph');
7
- var crypto = require('crypto');
8
8
  var child_process = require('child_process');
9
9
  var module$1 = require('module');
10
10
 
@@ -29,10 +29,10 @@ function _interopNamespace(e) {
29
29
  return Object.freeze(n);
30
30
  }
31
31
 
32
+ var crypto__namespace = /*#__PURE__*/_interopNamespace(crypto);
32
33
  var fs7__namespace = /*#__PURE__*/_interopNamespace(fs7);
33
34
  var path4__namespace = /*#__PURE__*/_interopNamespace(path4);
34
35
  var yaml3__default = /*#__PURE__*/_interopDefault(yaml3);
35
- var crypto__namespace = /*#__PURE__*/_interopNamespace(crypto);
36
36
  var child_process__namespace = /*#__PURE__*/_interopNamespace(child_process);
37
37
 
38
38
  // src/types/index.ts
@@ -195,7 +195,8 @@ function buildNodeMetrics(node, filePath) {
195
195
  const fullText = node.getFullText();
196
196
  const { loc, mi } = calculateLocAndHalstead(fullText, cyclomatic);
197
197
  const codeSmells = detectAstCodeSmells(node, fullText, filePath);
198
- return { functionName, filePath, loc, cyclomatic, cognitive, maintainability: mi, codeSmells };
198
+ const line = typeof node.getStartLineNumber === "function" ? node.getStartLineNumber() : 1;
199
+ return { functionName, filePath, loc, cyclomatic, cognitive, maintainability: mi, codeSmells, line };
199
200
  }
200
201
  function createTempSourceFile(project, content, filePath) {
201
202
  const ext = path4__namespace.extname(filePath).toLowerCase() || ".ts";
@@ -426,7 +427,7 @@ function buildMetricsFromBlocks(blocks, content, filePath) {
426
427
  }
427
428
  return [];
428
429
  }
429
- return blocks.map((b) => calculatePolyglotMetrics(b.body, b.name, filePath));
430
+ return blocks.map((b) => calculatePolyglotMetrics(b.body, b.name, filePath, b.startLine));
430
431
  }
431
432
  function detectPolyglotSmells(body) {
432
433
  const smells = [];
@@ -456,7 +457,7 @@ function countCommentsAndLoc(rawLines, isPy) {
456
457
  const cleanLines = rawLines.filter((l) => !isCommentLine(l, isPy));
457
458
  return { loc, commentCount, cleanLines };
458
459
  }
459
- function calculatePolyglotMetrics(body, name, filePath) {
460
+ function calculatePolyglotMetrics(body, name, filePath, startLine) {
460
461
  const ext = path4__namespace.extname(filePath).toLowerCase();
461
462
  const rawLines = body.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0);
462
463
  const { loc, commentCount, cleanLines } = countCommentsAndLoc(rawLines, ext === ".py");
@@ -470,7 +471,8 @@ function calculatePolyglotMetrics(body, name, filePath) {
470
471
  cyclomatic,
471
472
  cognitive,
472
473
  maintainability,
473
- codeSmells: detectPolyglotSmells(body)
474
+ codeSmells: detectPolyglotSmells(body),
475
+ line: startLine ? startLine + 1 : 1
474
476
  };
475
477
  }
476
478
  function computePolyglotCyclomatic(body, ext) {
@@ -1206,6 +1208,7 @@ function createDefaultQualityPolicy() {
1206
1208
  }
1207
1209
  function applyDocScope(policy, doc) {
1208
1210
  if (typeof doc.enforcement_mode === "string") policy.enforce_mode = doc.enforcement_mode;
1211
+ if (typeof doc.ratchet_mode === "boolean") policy.ratchet_mode = doc.ratchet_mode;
1209
1212
  if (!doc.scope || typeof doc.scope !== "object") return;
1210
1213
  const scope = doc.scope;
1211
1214
  if (Array.isArray(scope.target_directories)) {
@@ -1496,12 +1499,138 @@ function evaluateCoverageThresholds(rootDir, policy, requireReport) {
1496
1499
  checkCoverageThreshold("Function", cov.functionsPct, policy.min_function_coverage, violations);
1497
1500
  return violations;
1498
1501
  }
1499
- function buildQualityGateResult(results, totalFiles, policy, coverageViolations, untestedFunctions) {
1502
+ function computeViolationSignature(relPath, fnName, metric) {
1503
+ const normPath = relPath.replace(/\\/g, "/");
1504
+ return crypto__namespace.createHash("sha256").update(normPath + ":" + fnName + ":" + metric).digest("hex");
1505
+ }
1506
+ function classifyMetricFromMessage(msg, fn) {
1507
+ if (msg.startsWith("Cyclomatic Complexity")) {
1508
+ return { metric: "cyclomatic", value: fn?.cyclomatic, threshold: 10 };
1509
+ }
1510
+ if (msg.startsWith("Cognitive Complexity")) {
1511
+ return { metric: "cognitive", value: fn?.cognitive, threshold: 15 };
1512
+ }
1513
+ if (msg.startsWith("Maintainability Index")) {
1514
+ return { metric: "maintainability", value: fn?.maintainability, threshold: 50 };
1515
+ }
1516
+ if (msg.startsWith("Function lines")) {
1517
+ return { metric: "loc", value: fn?.loc, threshold: 40 };
1518
+ }
1519
+ if (msg.includes("Missing unit test")) {
1520
+ return { metric: "unit-test" };
1521
+ }
1522
+ return { metric: "codeSmell" };
1523
+ }
1524
+ function isMetricWorsened(baselineEntry, current) {
1525
+ if (baselineEntry.value === void 0 || current.value === void 0) return false;
1526
+ if (baselineEntry.metric === "maintainability") {
1527
+ return current.value < baselineEntry.value;
1528
+ }
1529
+ return current.value > baselineEntry.value;
1530
+ }
1531
+ function loadQualityBaseline(baselineFile) {
1532
+ try {
1533
+ if (!fs7__namespace.existsSync(baselineFile)) return null;
1534
+ const content = fs7__namespace.readFileSync(baselineFile, "utf-8");
1535
+ return JSON.parse(content);
1536
+ } catch {
1537
+ return null;
1538
+ }
1539
+ }
1540
+ function writeQualityBaseline(baselineFile, entries) {
1541
+ const baseline = {
1542
+ version: "1.0",
1543
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
1544
+ totalViolations: entries.length,
1545
+ violations: entries
1546
+ };
1547
+ fs7__namespace.writeFileSync(baselineFile, JSON.stringify(baseline, null, 2) + "\n", "utf-8");
1548
+ return baseline;
1549
+ }
1550
+ function extractBaselineEntriesFromResults(results) {
1551
+ const entries = [];
1552
+ for (const r of results) {
1553
+ for (const v of r.violations) {
1554
+ const { metric, value, threshold } = classifyMetricFromMessage(v, r);
1555
+ const signature = computeViolationSignature(r.relPath, r.functionName, metric);
1556
+ entries.push({
1557
+ signature,
1558
+ file: r.relPath,
1559
+ functionName: r.functionName,
1560
+ line: r.line || 1,
1561
+ metric,
1562
+ value,
1563
+ threshold,
1564
+ message: v
1565
+ });
1566
+ }
1567
+ }
1568
+ return entries;
1569
+ }
1570
+ function applyRatchetToFunctionResult(r, baselineMap) {
1571
+ const activeViolations = [];
1572
+ const tolerated = [];
1573
+ for (const v of r.violations) {
1574
+ const classified = classifyMetricFromMessage(v, r);
1575
+ const sig = computeViolationSignature(r.relPath, r.functionName, classified.metric);
1576
+ const baseEntry = baselineMap.get(sig);
1577
+ if (baseEntry && !isMetricWorsened(baseEntry, classified)) {
1578
+ tolerated.push(v);
1579
+ } else {
1580
+ activeViolations.push(v);
1581
+ }
1582
+ }
1583
+ r.violations = activeViolations;
1584
+ r.toleratedViolations = tolerated;
1585
+ r.status = activeViolations.length === 0 ? "PASS" : "FAIL";
1586
+ return { tolerated: tolerated.length, newViolations: activeViolations.length };
1587
+ }
1588
+ function applyRatchetMode(results, baseline) {
1589
+ const baselineMap = /* @__PURE__ */ new Map();
1590
+ for (const entry of baseline.violations) {
1591
+ baselineMap.set(entry.signature, entry);
1592
+ }
1593
+ let toleratedCount = 0;
1594
+ let newViolationsCount = 0;
1595
+ for (const r of results) {
1596
+ if (r.violations.length === 0) continue;
1597
+ const res = applyRatchetToFunctionResult(r, baselineMap);
1598
+ toleratedCount += res.tolerated;
1599
+ newViolationsCount += res.newViolations;
1600
+ }
1601
+ return { toleratedCount, newViolationsCount };
1602
+ }
1603
+ function resolveBaselineFilePath(rootDir, options) {
1604
+ if (options.baselinePath) return options.baselinePath;
1605
+ if (typeof options.baseline === "string") return options.baseline;
1606
+ return path4__namespace.join(rootDir, "quality-baseline.json");
1607
+ }
1608
+ function isRatchetModeActive(policy, options, baselineExists) {
1609
+ if (options.ratchet !== void 0) return options.ratchet;
1610
+ if (options.baseline === false) return false;
1611
+ return Boolean(policy.ratchet_mode || options.baseline && baselineExists);
1612
+ }
1613
+ function evaluateRatchetIfActive(results, baselineFile, isActive) {
1614
+ if (!isActive || !fs7__namespace.existsSync(baselineFile)) {
1615
+ return { toleratedViolationsCount: 0, newViolationsCount: 0, baselineViolationsCount: 0 };
1616
+ }
1617
+ const baseline = loadQualityBaseline(baselineFile);
1618
+ if (!baseline) {
1619
+ return { toleratedViolationsCount: 0, newViolationsCount: 0, baselineViolationsCount: 0 };
1620
+ }
1621
+ const counts = applyRatchetMode(results, baseline);
1622
+ return {
1623
+ toleratedViolationsCount: counts.toleratedCount,
1624
+ newViolationsCount: counts.newViolationsCount,
1625
+ baselineViolationsCount: baseline.totalViolations
1626
+ };
1627
+ }
1628
+ function buildQualityGateResult(results, totalFiles, policy, coverageViolations, untestedFunctions, baselineMeta) {
1500
1629
  const failCount = results.filter((r) => r.status === "FAIL").length;
1501
1630
  const passCount = results.length - failCount;
1502
1631
  const violationsCount = results.reduce((acc, r) => acc + r.violations.length, 0) + coverageViolations.length;
1503
1632
  const hasFailures = failCount > 0 || coverageViolations.length > 0;
1504
- const success = policy.enforce_mode === "STRICT" ? !hasFailures : true;
1633
+ const success = baselineMeta?.baselineUpdated ? true : policy.enforce_mode === "STRICT" ? !hasFailures : true;
1505
1634
  return {
1506
1635
  success,
1507
1636
  totalFiles,
@@ -1512,7 +1641,11 @@ function buildQualityGateResult(results, totalFiles, policy, coverageViolations,
1512
1641
  results,
1513
1642
  policy,
1514
1643
  coverageViolations,
1515
- untestedFunctions
1644
+ untestedFunctions,
1645
+ baselineUpdated: baselineMeta?.baselineUpdated,
1646
+ baselineViolationsCount: baselineMeta?.baselineViolationsCount,
1647
+ toleratedViolationsCount: baselineMeta?.toleratedViolationsCount,
1648
+ newViolationsCount: baselineMeta?.newViolationsCount
1516
1649
  };
1517
1650
  }
1518
1651
  function verifyQualityGate(options = {}) {
@@ -1528,7 +1661,23 @@ function verifyQualityGate(options = {}) {
1528
1661
  }
1529
1662
  const untestedFunctions = options.requireFunctionUnitTests ? auditUnitTestsPerFunction(results, rootDir) : [];
1530
1663
  const coverageViolations = evaluateCoverageThresholds(rootDir, policy, options.requireCoverageReport);
1531
- return buildQualityGateResult(results, allFiles.length, policy, coverageViolations, untestedFunctions);
1664
+ const baselineFile = resolveBaselineFilePath(rootDir, options);
1665
+ if (options.updateBaseline) {
1666
+ const entries = extractBaselineEntriesFromResults(results);
1667
+ writeQualityBaseline(baselineFile, entries);
1668
+ return buildQualityGateResult(results, allFiles.length, policy, coverageViolations, untestedFunctions, {
1669
+ baselineUpdated: true,
1670
+ baselineViolationsCount: entries.length
1671
+ });
1672
+ }
1673
+ const baselineExists = fs7__namespace.existsSync(baselineFile);
1674
+ const isRatchet = isRatchetModeActive(policy, options, baselineExists);
1675
+ const ratchetEval = evaluateRatchetIfActive(results, baselineFile, isRatchet);
1676
+ return buildQualityGateResult(results, allFiles.length, policy, coverageViolations, untestedFunctions, {
1677
+ baselineViolationsCount: ratchetEval.baselineViolationsCount,
1678
+ toleratedViolationsCount: ratchetEval.toleratedViolationsCount,
1679
+ newViolationsCount: ratchetEval.newViolationsCount
1680
+ });
1532
1681
  }
1533
1682
  function normalizeHandoffPayload(handoff, changeId) {
1534
1683
  return {
@@ -2850,7 +2999,7 @@ var SCHEMA_SCHEMAS_ARCHITECTURE_COMPONENT_SCHEMA_JSON = '{\r\n "$schema": "http
2850
2999
  var SCHEMA_SCHEMAS_ARCHITECTURE_INTRODUCTION_AND_GOALS_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/architecture/introduction-and-goals.schema.json",\r\n "title": "NAF v4 Enterprise & Capability / arc42 Introduction and System Goals Schema",\r\n "type": "object",\r\n "required": [\r\n "id",\r\n "type",\r\n "title",\r\n "status",\r\n "version",\r\n "naf-perspective",\r\n "cites-product-actors",\r\n "cites-quality-goals",\r\n "cites-use-cases"\r\n ],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^ARCH-INTRO-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "architecture-introduction"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\r\n "description": "Artifact semantic version (SemVer)."\r\n },\r\n "schema-version": {\r\n "type": "string"\r\n },\r\n "title": {\r\n "type": "string",\r\n "minLength": 3\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": ["draft", "proposed", "accepted", "approved", "deprecated", "superseded"]\r\n },\r\n "owner": {\r\n "type": "string"\r\n },\r\n "arc42-section": {\r\n "type": "integer",\r\n "const": 1\r\n },\r\n "naf-perspective": {\r\n "type": "string",\r\n "const": "Enterprise & Capability"\r\n },\r\n "cites-product-actors": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string",\r\n "pattern": "^ACT-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "cites-quality-goals": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string",\r\n "pattern": "^(QR|SEC-REQ|PRIV-REQ)-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "cites-use-cases": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string",\r\n "pattern": "^UC-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "supersedes": {\r\n "type": ["string", "null"],\r\n "pattern": "^ARCH-INTRO-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "superseded-by": {\r\n "type": ["string", "null"],\r\n "pattern": "^ARCH-INTRO-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
2851
3000
  var SCHEMA_SCHEMAS_COMPLIANCE_LICENSE_MANIFEST_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/compliance/license-manifest.schema.json",\r\n "title": "Static Dependencies License Manifest Schema",\r\n "type": "object",\r\n "required": ["evaluated_dependencies"],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^(MAN-LIC|LIC-MAN|LIC)-[A-Z0-9]+(-[A-Z0-9]+)*$",\r\n "description": "Optional canonical artifact identifier."\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "license-manifest"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+(\\\\.[0-9]+)?(-[0-9A-Za-z.-]+)?$",\r\n "description": "Manifest format version."\r\n },\r\n "schema-version": {\r\n "type": "string"\r\n },\r\n "description": {\r\n "type": "string"\r\n },\r\n "generated_at": {\r\n "type": "string"\r\n },\r\n "evaluated_dependencies": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "object",\r\n "required": ["package", "version", "spdx_license", "status"],\r\n "properties": {\r\n "package": {\r\n "type": "string",\r\n "minLength": 1\r\n },\r\n "version": {\r\n "type": "string",\r\n "minLength": 1\r\n },\r\n "spdx_license": {\r\n "type": "string",\r\n "minLength": 1\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": [\r\n "APPROVED",\r\n "REJECTED",\r\n "REVIEW_REQUIRED",\r\n "COMMERCIAL_APPROVAL_REQUIRED",\r\n "PENDING"\r\n ]\r\n },\r\n "reason": {\r\n "type": "string"\r\n },\r\n "approved_by": {\r\n "type": "string"\r\n }\r\n },\r\n "additionalProperties": false\r\n }\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
2852
3001
  var SCHEMA_SCHEMAS_COMPLIANCE_LICENSE_POLICY_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/compliance/license-policy.schema.json",\r\n "title": "Open Source License Policy Schema",\r\n "type": "object",\r\n "required": ["version", "project", "default_action", "categories", "agent_guardrails", "ci_gates"],\r\n "properties": {\r\n "version": {\r\n "type": "string"\r\n },\r\n "project": {\r\n "type": "string"\r\n },\r\n "default_action": {\r\n "type": "string",\r\n "enum": ["ALLOW", "DENY", "REVIEW_REQUIRED"]\r\n },\r\n "categories": {\r\n "type": "object"\r\n },\r\n "agent_guardrails": {\r\n "type": "object",\r\n "required": ["enforce_pre_check", "reject_unknown_licenses"],\r\n "properties": {\r\n "enforce_pre_check": { "type": "boolean" },\r\n "reject_unknown_licenses": { "type": "boolean" },\r\n "auto_reject_categories": { "type": "array", "items": { "type": "string" } },\r\n "on_commercial_detected": { "type": "object" }\r\n }\r\n },\r\n "ci_gates": {\r\n "type": "object",\r\n "required": ["fail_on_denied", "generate_sbom"],\r\n "properties": {\r\n "fail_on_denied": { "type": "boolean" },\r\n "fail_on_missing_license": { "type": "boolean" },\r\n "generate_sbom": { "type": "boolean" },\r\n "sbom_format": { "type": "string" },\r\n "output_notices_file": { "type": "string" },\r\n "allowed_depth": { "type": "string", "enum": ["DIRECT", "TRANSITIVE"] }\r\n }\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
2853
- var SCHEMA_SCHEMAS_COMPLIANCE_QUALITY_POLICY_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/compliance/quality-policy.schema.json",\r\n "title": "Software Quality Policy Schema (Polyglot)",\r\n "type": "object",\r\n "required": ["version", "project", "enforcement_mode", "coding_rules", "release_thresholds", "agent_guardrails"],\r\n "properties": {\r\n "version": { "type": "string" },\r\n "project": { "type": "string" },\r\n "enforcement_mode": { "type": "string", "enum": ["STRICT", "PERMISSIVE"] },\r\n "scope": {\r\n "type": "object",\r\n "properties": {\r\n "target_directories": { "type": "array", "items": { "type": "string" } },\r\n "supported_extensions": { "type": "array", "items": { "type": "string" } },\r\n "exclude_patterns": { "type": "array", "items": { "type": "string" } }\r\n }\r\n },\r\n "language_toolchains": {\r\n "type": "object"\r\n },\r\n "coding_rules": {\r\n "type": "object",\r\n "required": ["standards", "enforce_formatting", "rules"],\r\n "properties": {\r\n "standards": { "type": "array", "items": { "type": "string" } },\r\n "enforce_formatting": { "type": "boolean" },\r\n "formatting_engine": { "type": "string" },\r\n "linter_engine": { "type": "string" },\r\n "rules": { "type": "object" }\r\n }\r\n },\r\n "release_thresholds": {\r\n "type": "object",\r\n "required": ["cyclomatic_complexity", "cognitive_complexity", "maintainability_index", "code_duplication", "test_coverage"],\r\n "properties": {\r\n "cyclomatic_complexity": {\r\n "type": "object",\r\n "required": ["max_per_function", "action_on_breach"],\r\n "properties": {\r\n "max_per_function": { "type": "integer" },\r\n "warning_at": { "type": "integer" },\r\n "action_on_breach": { "type": "string" }\r\n }\r\n },\r\n "cognitive_complexity": {\r\n "type": "object",\r\n "required": ["max_per_function", "action_on_breach"],\r\n "properties": {\r\n "max_per_function": { "type": "integer" },\r\n "warning_at": { "type": "integer" },\r\n "action_on_breach": { "type": "string" }\r\n }\r\n },\r\n "maintainability_index": {\r\n "type": "object",\r\n "required": ["min_acceptable_score", "action_on_breach"],\r\n "properties": {\r\n "min_acceptable_score": { "type": "number" },\r\n "target_score": { "type": "number" },\r\n "action_on_breach": { "type": "string" }\r\n }\r\n },\r\n "code_duplication": {\r\n "type": "object",\r\n "required": ["max_percentage", "action_on_breach"],\r\n "properties": {\r\n "max_percentage": { "type": "number" },\r\n "action_on_breach": { "type": "string" }\r\n }\r\n },\r\n "test_coverage": {\r\n "type": "object",\r\n "required": ["min_line_coverage_percent", "action_on_breach"],\r\n "properties": {\r\n "min_line_coverage_percent": { "type": "number" },\r\n "min_branch_coverage_percent": { "type": "number" },\r\n "min_function_coverage_percent": { "type": "number" },\r\n "action_on_breach": { "type": "string" }\r\n }\r\n },\r\n "technical_debt": {\r\n "type": "object"\r\n }\r\n }\r\n },\r\n "agent_guardrails": {\r\n "type": "object",\r\n "required": ["enforce_pre_commit_linter", "prevent_suppression_comments"],\r\n "properties": {\r\n "enforce_pre_commit_linter": { "type": "boolean" },\r\n "prevent_suppression_comments": { "type": "boolean" },\r\n "auto_refactor_on_high_complexity": { "type": "boolean" }\r\n }\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
3002
+ var SCHEMA_SCHEMAS_COMPLIANCE_QUALITY_POLICY_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/compliance/quality-policy.schema.json",\r\n "title": "Software Quality Policy Schema (Polyglot)",\r\n "type": "object",\r\n "required": ["version", "project", "enforcement_mode", "coding_rules", "release_thresholds", "agent_guardrails"],\r\n "properties": {\r\n "version": { "type": "string" },\r\n "project": { "type": "string" },\r\n "enforcement_mode": { "type": "string", "enum": ["STRICT", "PERMISSIVE"] },\r\n "ratchet_mode": { "type": "boolean" },\r\n "scope": {\r\n "type": "object",\r\n "properties": {\r\n "target_directories": { "type": "array", "items": { "type": "string" } },\r\n "supported_extensions": { "type": "array", "items": { "type": "string" } },\r\n "exclude_patterns": { "type": "array", "items": { "type": "string" } }\r\n }\r\n },\r\n "language_toolchains": {\r\n "type": "object"\r\n },\r\n "coding_rules": {\r\n "type": "object",\r\n "required": ["standards", "enforce_formatting", "rules"],\r\n "properties": {\r\n "standards": { "type": "array", "items": { "type": "string" } },\r\n "enforce_formatting": { "type": "boolean" },\r\n "formatting_engine": { "type": "string" },\r\n "linter_engine": { "type": "string" },\r\n "rules": { "type": "object" }\r\n }\r\n },\r\n "release_thresholds": {\r\n "type": "object",\r\n "required": ["cyclomatic_complexity", "cognitive_complexity", "maintainability_index", "code_duplication", "test_coverage"],\r\n "properties": {\r\n "cyclomatic_complexity": {\r\n "type": "object",\r\n "required": ["max_per_function", "action_on_breach"],\r\n "properties": {\r\n "max_per_function": { "type": "integer" },\r\n "warning_at": { "type": "integer" },\r\n "action_on_breach": { "type": "string" }\r\n }\r\n },\r\n "cognitive_complexity": {\r\n "type": "object",\r\n "required": ["max_per_function", "action_on_breach"],\r\n "properties": {\r\n "max_per_function": { "type": "integer" },\r\n "warning_at": { "type": "integer" },\r\n "action_on_breach": { "type": "string" }\r\n }\r\n },\r\n "maintainability_index": {\r\n "type": "object",\r\n "required": ["min_acceptable_score", "action_on_breach"],\r\n "properties": {\r\n "min_acceptable_score": { "type": "number" },\r\n "target_score": { "type": "number" },\r\n "action_on_breach": { "type": "string" }\r\n }\r\n },\r\n "code_duplication": {\r\n "type": "object",\r\n "required": ["max_percentage", "action_on_breach"],\r\n "properties": {\r\n "max_percentage": { "type": "number" },\r\n "action_on_breach": { "type": "string" }\r\n }\r\n },\r\n "test_coverage": {\r\n "type": "object",\r\n "required": ["min_line_coverage_percent", "action_on_breach"],\r\n "properties": {\r\n "min_line_coverage_percent": { "type": "number" },\r\n "min_branch_coverage_percent": { "type": "number" },\r\n "min_function_coverage_percent": { "type": "number" },\r\n "action_on_breach": { "type": "string" }\r\n }\r\n },\r\n "technical_debt": {\r\n "type": "object"\r\n }\r\n }\r\n },\r\n "agent_guardrails": {\r\n "type": "object",\r\n "required": ["enforce_pre_commit_linter", "prevent_suppression_comments"],\r\n "properties": {\r\n "enforce_pre_commit_linter": { "type": "boolean" },\r\n "prevent_suppression_comments": { "type": "boolean" },\r\n "auto_refactor_on_high_complexity": { "type": "boolean" }\r\n }\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
2854
3003
  var SCHEMA_SCHEMAS_IDE_MCP_CONFIG_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/ide/mcp-config.schema.json",\r\n "title": "IDE MCP Configuration Schema (Cursor, Antigravity, VS Code)",\r\n "type": "object",\r\n "properties": {\r\n "$schema": {\r\n "type": "string"\r\n },\r\n "id": {\r\n "type": "string",\r\n "pattern": "^(MCP-CFG|IDE-MCP|MCP)-[A-Z0-9]+(-[A-Z0-9]+)*$",\r\n "description": "Optional identifier for MCP configuration artifact."\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "mcp-config"\r\n },\r\n "mcpServers": {\r\n "type": "object",\r\n "additionalProperties": {\r\n "type": "object",\r\n "required": ["command"],\r\n "properties": {\r\n "command": {\r\n "type": "string",\r\n "minLength": 1\r\n },\r\n "args": {\r\n "type": "array",\r\n "items": {\r\n "type": "string"\r\n }\r\n },\r\n "env": {\r\n "type": "object"\r\n },\r\n "disabled": {\r\n "type": "boolean"\r\n },\r\n "alwaysAllow": {\r\n "type": "array",\r\n "items": {\r\n "type": "string"\r\n }\r\n }\r\n },\r\n "additionalProperties": false\r\n },\r\n "description": "MCP server registry format for Cursor and Antigravity."\r\n },\r\n "servers": {\r\n "type": "object",\r\n "additionalProperties": {\r\n "type": "object",\r\n "required": ["command"],\r\n "properties": {\r\n "command": {\r\n "type": "string",\r\n "minLength": 1\r\n },\r\n "args": {\r\n "type": "array",\r\n "items": {\r\n "type": "string"\r\n }\r\n },\r\n "env": {\r\n "type": "object"\r\n },\r\n "disabled": {\r\n "type": "boolean"\r\n },\r\n "alwaysAllow": {\r\n "type": "array",\r\n "items": {\r\n "type": "string"\r\n }\r\n }\r\n },\r\n "additionalProperties": false\r\n },\r\n "description": "MCP server registry format for VS Code."\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
2855
3004
  var SCHEMA_SCHEMAS_MANUALS_PRODUCTION_MANUAL_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/manuals/production-manual.schema.json",\r\n "title": "AI-SDLC Production & Operations Manual Schema",\r\n "type": "object",\r\n "required": [\r\n "id",\r\n "type",\r\n "title",\r\n "status",\r\n "version",\r\n "applies-to-version",\r\n "target-audience"\r\n ],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^MAN-PROD-[A-Z0-9]+(-[A-Z0-9]+)*$",\r\n "description": "Immutable production manual identifier (e.g. MAN-PROD-SENTINELCORE)."\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "production-manual"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\r\n "description": "Document semantic version (SemVer)."\r\n },\r\n "schema-version": {\r\n "type": "string",\r\n "description": "Template schema version."\r\n },\r\n "title": {\r\n "type": "string",\r\n "minLength": 3,\r\n "description": "Descriptive title of the production manual."\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": ["draft", "active", "deprecated", "retired"]\r\n },\r\n "applies-to-version": {\r\n "type": "string",\r\n "description": "Software version or release this production manual applies to (e.g. v1.0.0)."\r\n },\r\n "target-audience": {\r\n "type": "array",\r\n "items": {\r\n "type": "string"\r\n },\r\n "minItems": 1,\r\n "description": "Target technical profiles (e.g. DevOps, SRE, Release Manager, SecOps)."\r\n },\r\n "components-covered": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "pattern": "^CMP-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "description": "Architecture components (CMP-*) deployed and covered by the manual."\r\n },\r\n "enclaves-involved": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "pattern": "^SEC-ENC-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "description": "Security enclaves (SEC-ENC-*) in which deployment executes."\r\n },\r\n "supersedes": {\r\n "type": ["string", "null"],\r\n "pattern": "^MAN-PROD-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "superseded-by": {\r\n "type": ["string", "null"],\r\n "pattern": "^MAN-PROD-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
2856
3005
  var SCHEMA_SCHEMAS_MANUALS_USER_MANUAL_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/manuals/user-manual.schema.json",\r\n "title": "AI-SDLC User Manual Schema",\r\n "type": "object",\r\n "required": [\r\n "id",\r\n "type",\r\n "title",\r\n "status",\r\n "version",\r\n "target-audience",\r\n "allowed-roles",\r\n "applies-to-version"\r\n ],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^MAN-USER-[A-Z0-9]+(-[A-Z0-9]+)*$",\r\n "description": "Immutable user manual identifier (e.g. MAN-USER-SENTINELCORE)."\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "user-manual"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\r\n "description": "Document semantic version (SemVer)."\r\n },\r\n "schema-version": {\r\n "type": "string",\r\n "description": "Template schema version."\r\n },\r\n "title": {\r\n "type": "string",\r\n "minLength": 3,\r\n "description": "Descriptive title of the user manual."\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": ["draft", "active", "deprecated", "retired"]\r\n },\r\n "applies-to-version": {\r\n "type": "string",\r\n "description": "Software version or release this manual applies to (e.g. v1.0.0)."\r\n },\r\n "target-audience": {\r\n "type": "array",\r\n "items": {\r\n "type": "string"\r\n },\r\n "minItems": 1,\r\n "description": "Target user profiles or roles for the manual."\r\n },\r\n "allowed-roles": {\r\n "type": "array",\r\n "items": {\r\n "type": "string"\r\n },\r\n "minItems": 1,\r\n "description": "Formal catalog of authorized roles to operate the application (linked to ACT-*)."\r\n },\r\n "journeys-covered": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "pattern": "^JRN-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "description": "Product journey identifiers (JRN-*) covered in the manual."\r\n },\r\n "use-cases-covered": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "pattern": "^UC-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "description": "Use case identifiers (UC-*) implemented across journeys."\r\n },\r\n "supersedes": {\r\n "type": ["string", "null"],\r\n "pattern": "^MAN-USER-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "superseded-by": {\r\n "type": ["string", "null"],\r\n "pattern": "^MAN-USER-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
@@ -2859,6 +3008,7 @@ var SCHEMA_SCHEMAS_PRIVACY_PRIVACY_POLICY_SCHEMA_JSON = '{\r\n "$schema": "http
2859
3008
  var SCHEMA_SCHEMAS_PRIVACY_PRIVACY_REQ_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/privacy/privacy-req.schema.json",\r\n "title": "Privacy Requirement & Technical Control Schema (PRIV-REQ-*)",\r\n "type": "object",\r\n "required": [\r\n "id",\r\n "type",\r\n "title",\r\n "status",\r\n "version",\r\n "privacy-principle",\r\n "linddun-category",\r\n "governs-ropa"\r\n ],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^PRIV-REQ-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "privacy-requirement"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\r\n "description": "Privacy requirement semantic version (SemVer)."\r\n },\r\n "schema-version": {\r\n "type": "string"\r\n },\r\n "title": {\r\n "type": "string",\r\n "minLength": 3\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": ["draft", "active", "deprecated", "retired"]\r\n },\r\n "privacy-principle": {\r\n "type": "string",\r\n "enum": [\r\n "data-minimization",\r\n "purpose-limitation",\r\n "storage-limitation",\r\n "accuracy",\r\n "integrity-and-confidentiality",\r\n "transparency-and-consent",\r\n "data-subject-rights-arco",\r\n "pseudonymization-anonymization"\r\n ]\r\n },\r\n "linddun-category": {\r\n "type": "string",\r\n "enum": [\r\n "linkability",\r\n "identifiability",\r\n "non-repudiation",\r\n "detectability",\r\n "disclosure-of-information",\r\n "unawareness",\r\n "non-compliance"\r\n ],\r\n "description": "LINDDUN privacy threat category mitigated by this control."\r\n },\r\n "governs-ropa": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string",\r\n "pattern": "^PRIV-ROPA-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "description": "Upstream ROPA records (PRIV-ROPA-*) governed by this privacy requirement."\r\n },\r\n "protects-data-assets": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "pattern": "^DATA-ASSET-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "enforced-in-enclave": {\r\n "type": "string",\r\n "pattern": "^SEC-ENC-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "compliance-references": {\r\n "type": "array",\r\n "items": {\r\n "type": "string"\r\n }\r\n },\r\n "acceptance-format": {\r\n "type": "string",\r\n "enum": ["gherkin", "declarative-prose"]\r\n },\r\n "cucumber-tags": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "pattern": "^@[a-zA-Z0-9_-]+$"\r\n }\r\n },\r\n "supersedes": {\r\n "type": ["string", "null"],\r\n "pattern": "^PRIV-REQ-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "superseded-by": {\r\n "type": ["string", "null"],\r\n "pattern": "^PRIV-REQ-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
2860
3009
  var SCHEMA_SCHEMAS_PRIVACY_PRIVACY_ROPA_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/privacy/privacy-ropa.schema.json",\r\n "title": "Record of Processing Activities Schema (PRIV-ROPA-* / GDPR Art. 30)",\r\n "type": "object",\r\n "required": [\r\n "id",\r\n "type",\r\n "title",\r\n "status",\r\n "version",\r\n "lawful-basis",\r\n "processing-purpose",\r\n "use-cases",\r\n "data-assets",\r\n "data-subjects",\r\n "retention-ttl"\r\n ],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^PRIV-ROPA-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "privacy-ropa"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\r\n "description": "ROPA record semantic version (SemVer)."\r\n },\r\n "schema-version": {\r\n "type": "string"\r\n },\r\n "title": {\r\n "type": "string",\r\n "minLength": 3\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": ["draft", "active", "deprecated", "retired"]\r\n },\r\n "lawful-basis": {\r\n "type": "string",\r\n "enum": [\r\n "consent",\r\n "contract",\r\n "legal-obligation",\r\n "vital-interests",\r\n "public-task",\r\n "legitimate-interests"\r\n ],\r\n "description": "Lawful basis for processing under GDPR Art. 6.1."\r\n },\r\n "special-category-condition": {\r\n "type": ["string", "null"],\r\n "enum": [\r\n null,\r\n "explicit-consent",\r\n "employment-social-security",\r\n "vital-interests",\r\n "public-interest",\r\n "preventive-medicine",\r\n "public-health"\r\n ],\r\n "description": "GDPR Art. 9.2 condition when processing special category data."\r\n },\r\n "processing-purpose": {\r\n "type": "string",\r\n "minLength": 10\r\n },\r\n "use-cases": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string",\r\n "pattern": "^UC-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "description": "Upstream Use Cases (UC-*) that trigger this data processing activity."\r\n },\r\n "data-assets": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string",\r\n "pattern": "^DATA-ASSET-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "description": "Personal Data Assets (DATA-ASSET-*) processed in this activity."\r\n },\r\n "data-subjects": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string",\r\n "pattern": "^ACT-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "retention-ttl": {\r\n "type": "string",\r\n "pattern": "^([0-9]+(d|m|y)|session-only|indefinite-anonymized)$"\r\n },\r\n "cross-border-transfer": {\r\n "type": "boolean"\r\n },\r\n "transfer-safeguards": {\r\n "type": ["string", "null"],\r\n "enum": [null, "adequacy-decision", "scc", "bcr", "derogation"]\r\n },\r\n "subprocessors": {\r\n "type": "array",\r\n "items": {\r\n "type": "string"\r\n }\r\n },\r\n "dpia-required": {\r\n "type": "boolean"\r\n },\r\n "dpia-reference": {\r\n "type": ["string", "null"],\r\n "pattern": "^DPIA-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "mitigated-by": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "pattern": "^PRIV-REQ-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "description": "Privacy requirements (PRIV-REQ-*) governing and enforcing this processing activity."\r\n },\r\n "supersedes": {\r\n "type": ["string", "null"],\r\n "pattern": "^PRIV-ROPA-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "superseded-by": {\r\n "type": ["string", "null"],\r\n "pattern": "^PRIV-ROPA-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
2861
3010
  var SCHEMA_SCHEMAS_PRODUCT_ACTOR_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/product/actor.schema.json",\r\n "title": "ProductShape Actor Schema (Versionable)",\r\n "type": "object",\r\n "required": ["id", "type", "title", "status", "version", "role-type"],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^ACT-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "actor"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\r\n "description": "Artifact semantic version (SemVer)."\r\n },\r\n "schema-version": {\r\n "type": "string",\r\n "description": "Schema specification version used."\r\n },\r\n "title": {\r\n "type": "string",\r\n "minLength": 3\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": ["draft", "active", "deprecated", "retired"]\r\n },\r\n "role-type": {\r\n "type": "string",\r\n "enum": ["human-user", "ai-agent", "external-system", "sensor-iot"]\r\n },\r\n "description": {\r\n "type": "string"\r\n },\r\n "supersedes": {\r\n "type": ["string", "null"],\r\n "pattern": "^ACT-[A-Z0-9]+(-[A-Z0-9]+)*$",\r\n "description": "Identifier of the actor superseded by this version or artifact."\r\n },\r\n "superseded-by": {\r\n "type": ["string", "null"],\r\n "pattern": "^ACT-[A-Z0-9]+(-[A-Z0-9]+)*$",\r\n "description": "Identifier of the new actor superseding this one upon deprecation/retirement."\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
3011
+ var SCHEMA_SCHEMAS_PRODUCT_BOUNDED_CONTEXT_SCHEMA_JSON = '{\n "$schema": "https://json-schema.org/draft/2020-12/schema",\n "$id": "https://ai-sdlc.org/schemas/product/bounded-context.schema.json",\n "title": "Domain-Driven Design (DDD) Bounded Context Schema",\n "type": "object",\n "required": [\n "id",\n "type",\n "title",\n "status",\n "version",\n "domain-type",\n "responsibilities"\n ],\n "properties": {\n "id": {\n "type": "string",\n "pattern": "^BC-[A-Z0-9]+(-[A-Z0-9]+)*$",\n "description": "Immutable Bounded Context identifier (e.g. BC-AI-SDLC-GOVERNANCE)."\n },\n "type": {\n "type": "string",\n "const": "bounded-context"\n },\n "version": {\n "type": "string",\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\n "description": "Bounded context document semantic version (SemVer)."\n },\n "schema-version": {\n "type": "string",\n "description": "Template schema version."\n },\n "title": {\n "type": "string",\n "minLength": 3,\n "description": "Descriptive title of the Bounded Context."\n },\n "status": {\n "type": "string",\n "enum": ["draft", "active", "deprecated", "retired"]\n },\n "domain-type": {\n "type": "string",\n "enum": ["core", "supporting", "generic"],\n "description": "DDD subdomain classification: core differentiator, supporting capability, or generic commodity."\n },\n "strategic-classification": {\n "type": "object",\n "properties": {\n "evolutionary-stage": {\n "type": "string",\n "enum": ["genesis", "custom-built", "product-rental", "commodity"]\n },\n "business-model-role": {\n "type": "string",\n "enum": ["differentiator", "operational", "enabler"]\n }\n },\n "additionalProperties": false\n },\n "responsibilities": {\n "type": "array",\n "items": {\n "type": "string",\n "minLength": 3\n },\n "minItems": 1,\n "description": "List of functional boundaries and core domain responsibilities encapsulated within this context."\n },\n "ubiquitous-language-terms": {\n "type": "array",\n "items": {\n "type": "string",\n "pattern": "^TERM-[A-Z0-9]+(-[A-Z0-9]+)*$"\n },\n "description": "Ubiquitous language terms (TERM-*) governed within this bounded context."\n },\n "context-mapping": {\n "type": "object",\n "properties": {\n "upstream-dependencies": {\n "type": "array",\n "items": {\n "type": "string"\n }\n },\n "downstream-dependents": {\n "type": "array",\n "items": {\n "type": "string"\n }\n },\n "integration-patterns": {\n "type": "array",\n "items": {\n "type": "object",\n "properties": {\n "pattern": {\n "type": "string"\n },\n "related-context": {\n "type": "string"\n }\n },\n "additionalProperties": false\n }\n }\n },\n "additionalProperties": false\n },\n "components-involved": {\n "type": "array",\n "items": {\n "type": "string",\n "pattern": "^CMP-[A-Z0-9]+(-[A-Z0-9]+)*$"\n },\n "description": "Architecture components (CMP-*) implementing this bounded context."\n },\n "supersedes": {\n "type": ["string", "null"],\n "pattern": "^BC-[A-Z0-9]+(-[A-Z0-9]+)*$"\n },\n "superseded-by": {\n "type": ["string", "null"],\n "pattern": "^BC-[A-Z0-9]+(-[A-Z0-9]+)*$"\n }\n },\n "additionalProperties": false\n}\n';
2862
3012
  var SCHEMA_SCHEMAS_PRODUCT_BUSINESS_RULE_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/product/business-rule.schema.json",\r\n "title": "ProductShape Business Rule Schema (Versionable)",\r\n "type": "object",\r\n "required": ["id", "type", "title", "status", "version", "enforcement-level"],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^BR-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "business-rule"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\r\n "description": "Business rule semantic version (SemVer)."\r\n },\r\n "schema-version": {\r\n "type": "string"\r\n },\r\n "title": {\r\n "type": "string",\r\n "minLength": 3\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": ["draft", "active", "deprecated", "retired"]\r\n },\r\n "enforcement-level": {\r\n "type": "string",\r\n "enum": ["strict-invariant", "override-with-approval", "guideline"]\r\n },\r\n "defined-in": {\r\n "type": "string",\r\n "pattern": "^BC-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "uses-terms": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "pattern": "^TERM-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "supersedes": {\r\n "type": ["string", "null"],\r\n "pattern": "^BR-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "superseded-by": {\r\n "type": ["string", "null"],\r\n "pattern": "^BR-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
2863
3013
  var SCHEMA_SCHEMAS_PRODUCT_JOURNEY_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/product/journey.schema.json",\r\n "title": "Customer / Operator Journey Schema",\r\n "type": "object",\r\n "required": [\r\n "id",\r\n "type",\r\n "title",\r\n "status",\r\n "version",\r\n "persona",\r\n "stages",\r\n "touchpoints"\r\n ],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^JRN-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "journey"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\r\n "description": "Journey semantic version (SemVer)."\r\n },\r\n "schema-version": {\r\n "type": "string"\r\n },\r\n "title": {\r\n "type": "string",\r\n "minLength": 3\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": ["draft", "active", "deprecated", "retired"]\r\n },\r\n "persona": {\r\n "type": "string",\r\n "pattern": "^ACT-[A-Z0-9]+(-[A-Z0-9]+)*$",\r\n "description": "Actor (persona) starring in this journey."\r\n },\r\n "stages": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string"\r\n },\r\n "description": "Sequential journey stages (e.g. Awareness, Onboarding, Activation, Retention)."\r\n },\r\n "touchpoints": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string"\r\n },\r\n "description": "Touchpoints between persona and system at each stage."\r\n },\r\n "related-use-cases": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "pattern": "^UC-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "description": "System use cases related to this journey."\r\n },\r\n "pain-points": {\r\n "type": "array",\r\n "items": {\r\n "type": "string"\r\n },\r\n "description": "Frictions or issues detected along the user journey."\r\n },\r\n "supersedes": {\r\n "type": ["string", "null"]\r\n },\r\n "superseded-by": {\r\n "type": ["string", "null"]\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
2864
3014
  var SCHEMA_SCHEMAS_PRODUCT_REQUIREMENT_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/product/requirement.schema.json",\r\n "title": "ProductShape Requirement Schema (Strict Test Validation Enforced)",\r\n "type": "object",\r\n "required": ["id", "type", "title", "status", "version", "category", "derives-from", "verifiable-by"],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^(FR|QR|CON)-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "requirement"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\r\n "description": "Requirement semantic version (SemVer)."\r\n },\r\n "schema-version": {\r\n "type": "string"\r\n },\r\n "title": {\r\n "type": "string",\r\n "minLength": 3\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": ["draft", "active", "deprecated", "retired"]\r\n },\r\n "category": {\r\n "type": "string",\r\n "enum": ["functional", "quality", "constraint"]\r\n },\r\n "derives-from": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string",\r\n "pattern": "^(UC|BR|CON|CAP|GOAL)-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "description": "Product Traceability: Origin Use Cases, Rules, Constraints, or Capabilities."\r\n },\r\n "verifiable-by": {\r\n "type": "string",\r\n "enum": ["cucumber-bdd", "automated-unit-test", "integration-test", "performance-benchmark", "security-audit", "inspection"],\r\n "description": "Mandatory formal verification method."\r\n },\r\n "acceptance-format": {\r\n "type": "string",\r\n "enum": ["gherkin", "declarative-prose"],\r\n "description": "Acceptance criteria format."\r\n },\r\n "cucumber-tags": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "pattern": "^@[a-zA-Z0-9_-]+$"\r\n },\r\n "description": "Cucumber tags for filtering and executing BDD tests."\r\n },\r\n "enforce-bdd-variants": {\r\n "type": "boolean",\r\n "description": "When true, enforces all 3 BDD scenario categories (@nominal, @boundary, @invalid)."\r\n },\r\n "supersedes": {\r\n "type": ["string", "null"],\r\n "pattern": "^(FR|QR|CON)-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "superseded-by": {\r\n "type": ["string", "null"],\r\n "pattern": "^(FR|QR|CON)-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
@@ -2993,6 +3143,7 @@ var STARTER_SCHEMAS_MAP = {
2993
3143
  "schemas/privacy/privacy-req.schema.json": JSON.parse(SCHEMA_SCHEMAS_PRIVACY_PRIVACY_REQ_SCHEMA_JSON),
2994
3144
  "schemas/privacy/privacy-ropa.schema.json": JSON.parse(SCHEMA_SCHEMAS_PRIVACY_PRIVACY_ROPA_SCHEMA_JSON),
2995
3145
  "schemas/product/actor.schema.json": JSON.parse(SCHEMA_SCHEMAS_PRODUCT_ACTOR_SCHEMA_JSON),
3146
+ "schemas/product/bounded-context.schema.json": JSON.parse(SCHEMA_SCHEMAS_PRODUCT_BOUNDED_CONTEXT_SCHEMA_JSON),
2996
3147
  "schemas/product/business-rule.schema.json": JSON.parse(SCHEMA_SCHEMAS_PRODUCT_BUSINESS_RULE_SCHEMA_JSON),
2997
3148
  "schemas/product/journey.schema.json": JSON.parse(SCHEMA_SCHEMAS_PRODUCT_JOURNEY_SCHEMA_JSON),
2998
3149
  "schemas/product/requirement.schema.json": JSON.parse(SCHEMA_SCHEMAS_PRODUCT_REQUIREMENT_SCHEMA_JSON),
@@ -3027,6 +3178,7 @@ var TYPE_TO_SCHEMA_MAP = {
3027
3178
  journey: "schemas/product/journey.schema.json",
3028
3179
  requirement: "schemas/product/requirement.schema.json",
3029
3180
  term: "schemas/product/term.schema.json",
3181
+ "bounded-context": "schemas/product/bounded-context.schema.json",
3030
3182
  "use-case": "schemas/product/use-case.schema.json",
3031
3183
  // Security
3032
3184
  "abuse-case": "schemas/security/abuse-case.schema.json",
@@ -3077,6 +3229,7 @@ var PREFIX_TAXONOMY = [
3077
3229
  ["CON-", "requirement"],
3078
3230
  ["JRN-", "journey"],
3079
3231
  ["TERM-", "term"],
3232
+ ["BC-", "bounded-context"],
3080
3233
  ["ABUSE-", "abuse-case"],
3081
3234
  ["SEC-ENC-", "security-enclave"],
3082
3235
  ["SEC-REQ-", "security-requirement"],
@@ -5548,6 +5701,82 @@ function scanWithNativeFs(rootDir, options = {}) {
5548
5701
  }
5549
5702
  return allDeps.sort((a, b) => a.name.localeCompare(b.name));
5550
5703
  }
5704
+ function extractCvssV3Score(cvss) {
5705
+ if (!cvss || typeof cvss !== "object") return void 0;
5706
+ const dict = cvss;
5707
+ for (const source of ["nvd", "ghsa", "redhat"]) {
5708
+ if (dict[source]?.V3Score !== void 0) {
5709
+ return Number(dict[source].V3Score);
5710
+ }
5711
+ }
5712
+ return void 0;
5713
+ }
5714
+ function extractCvssV3Vector(cvss) {
5715
+ if (!cvss || typeof cvss !== "object") return void 0;
5716
+ const dict = cvss;
5717
+ for (const source of ["nvd", "ghsa", "redhat"]) {
5718
+ if (dict[source]?.V3Vector) {
5719
+ return String(dict[source].V3Vector);
5720
+ }
5721
+ }
5722
+ return void 0;
5723
+ }
5724
+ function normalizeVulnerabilitySeverity(raw) {
5725
+ if (!raw) return "UNKNOWN";
5726
+ const upper = raw.toUpperCase().trim();
5727
+ if (upper === "CRITICAL" || upper === "HIGH" || upper === "MEDIUM" || upper === "LOW") {
5728
+ return upper;
5729
+ }
5730
+ return "UNKNOWN";
5731
+ }
5732
+ function parseSingleVulnerability(v) {
5733
+ return {
5734
+ id: v.VulnerabilityID || "UNKNOWN",
5735
+ packageName: v.PkgName || "UNKNOWN",
5736
+ installedVersion: v.InstalledVersion || "unknown",
5737
+ fixedVersion: v.FixedVersion || void 0,
5738
+ severity: normalizeVulnerabilitySeverity(v.Severity),
5739
+ cvssV3Score: extractCvssV3Score(v.CVSS),
5740
+ cvssV3Vector: extractCvssV3Vector(v.CVSS),
5741
+ title: v.Title || void 0,
5742
+ description: v.Description || void 0,
5743
+ primaryUrl: v.PrimaryURL || void 0
5744
+ };
5745
+ }
5746
+ function parseTrivyVulnerabilities(stdout) {
5747
+ try {
5748
+ const data = JSON.parse(stdout);
5749
+ const vulns = [];
5750
+ for (const r of data.Results || []) {
5751
+ for (const v of r.Vulnerabilities || []) {
5752
+ vulns.push(parseSingleVulnerability(v));
5753
+ }
5754
+ }
5755
+ return vulns;
5756
+ } catch {
5757
+ return [];
5758
+ }
5759
+ }
5760
+ var SEVERITY_RANK = {
5761
+ CRITICAL: 4,
5762
+ HIGH: 3,
5763
+ MEDIUM: 2,
5764
+ LOW: 1,
5765
+ UNKNOWN: 0
5766
+ };
5767
+ function evaluateVulnerabilityThresholds(vulnerabilities, options) {
5768
+ const minRank = options?.failOnSeverity ? SEVERITY_RANK[options.failOnSeverity] ?? 3 : void 0;
5769
+ const maxScore = options?.maxCvssScore;
5770
+ const failing = vulnerabilities.filter((v) => {
5771
+ const rankMatch = minRank !== void 0 && SEVERITY_RANK[v.severity] >= minRank;
5772
+ const scoreMatch = maxScore !== void 0 && v.cvssV3Score !== void 0 && v.cvssV3Score >= maxScore;
5773
+ return rankMatch || scoreMatch;
5774
+ });
5775
+ return {
5776
+ blocked: failing.length > 0,
5777
+ failingVulnerabilities: failing
5778
+ };
5779
+ }
5551
5780
  function parseTrivyOutput(stdout) {
5552
5781
  const data = JSON.parse(stdout);
5553
5782
  const deps = [];
@@ -5563,23 +5792,32 @@ function parseTrivyOutput(stdout) {
5563
5792
  }
5564
5793
  return deps;
5565
5794
  }
5566
- function scanWithTrivy(rootDir) {
5567
- if (!isToolAvailable("trivy")) {
5568
- return { dependencies: [], executed: false };
5569
- }
5795
+ function execTrivyCli(rootDir, checkTypes) {
5570
5796
  try {
5571
5797
  const res = child_process__namespace.spawnSync(
5572
5798
  "trivy",
5573
- ["fs", "--format", "json", "--security-checks", "license", rootDir],
5799
+ ["fs", "--format", "json", "--security-checks", checkTypes, rootDir],
5574
5800
  { encoding: "utf-8", timeout: 3e4 }
5575
5801
  );
5576
- if (res.status !== 0 || !res.stdout) {
5577
- return { dependencies: [], executed: false };
5578
- }
5579
- return { dependencies: parseTrivyOutput(res.stdout), executed: true };
5802
+ return res.status === 0 && res.stdout ? res.stdout : null;
5580
5803
  } catch {
5581
- return { dependencies: [], executed: false };
5804
+ return null;
5805
+ }
5806
+ }
5807
+ function scanWithTrivy(rootDir, options) {
5808
+ if (!isToolAvailable("trivy")) {
5809
+ return { dependencies: [], vulnerabilities: [], executed: false };
5582
5810
  }
5811
+ const checkTypes = options?.scanVulnerabilities !== false ? "vuln,license" : "license";
5812
+ const stdout = execTrivyCli(rootDir, checkTypes);
5813
+ if (!stdout) {
5814
+ return { dependencies: [], vulnerabilities: [], executed: false };
5815
+ }
5816
+ return {
5817
+ dependencies: parseTrivyOutput(stdout),
5818
+ vulnerabilities: parseTrivyVulnerabilities(stdout),
5819
+ executed: true
5820
+ };
5583
5821
  }
5584
5822
  function parseSyftOutput(stdout) {
5585
5823
  const data = JSON.parse(stdout);
@@ -6095,12 +6333,34 @@ function evaluateDependencyList(dependencies, policy) {
6095
6333
  }
6096
6334
  return { violations, permittedCount };
6097
6335
  }
6098
- function assembleDynamicLicenseResult(dependencies, permittedCount, violations, reportMarkdown, artifacts) {
6336
+ function buildSkippedVulnResult() {
6099
6337
  return {
6100
- success: violations.length === 0,
6338
+ vulnerabilities: [],
6339
+ blocked: false,
6340
+ skipped: true,
6341
+ skipReason: "Trivy scanner is not installed on host environment. Vulnerability check gracefully skipped."
6342
+ };
6343
+ }
6344
+ function checkVulnerabilities(rootDir, options) {
6345
+ if (options.scanVulnerabilities === false) {
6346
+ return { vulnerabilities: [], blocked: false };
6347
+ }
6348
+ const res = scanWithTrivy(rootDir, { scanVulnerabilities: true });
6349
+ if (!res.executed) {
6350
+ return buildSkippedVulnResult();
6351
+ }
6352
+ const evalResult = evaluateVulnerabilityThresholds(res.vulnerabilities, options.vulnerabilityThresholds);
6353
+ return { vulnerabilities: res.vulnerabilities, blocked: evalResult.blocked };
6354
+ }
6355
+ function assembleDynamicLicenseResult(dependencies, permittedCount, violations, reportMarkdown, artifacts, vulnData) {
6356
+ return {
6357
+ success: violations.length === 0 && !vulnData.blocked,
6101
6358
  totalEvaluated: dependencies.length,
6102
6359
  permittedCount,
6103
6360
  violations,
6361
+ vulnerabilities: vulnData.vulnerabilities,
6362
+ vulnerabilitiesSkipped: vulnData.skipped,
6363
+ vulnerabilitiesSkipReason: vulnData.skipReason,
6104
6364
  reportMarkdown,
6105
6365
  sbomPath: artifacts.sbomPath,
6106
6366
  noticesPath: artifacts.noticesPath,
@@ -6134,8 +6394,9 @@ function verifyLicenses(options = {}) {
6134
6394
  const dependencies = scanDependenciesForVerification(options, rootDir, policyWithRaw.rawPolicy);
6135
6395
  const { violations, permittedCount } = evaluateDependencyList(dependencies, policy);
6136
6396
  const artifacts = handleDynamicScaArtifacts(options, rootDir, policyWithRaw.rawPolicy, dependencies);
6397
+ const vulnData = checkVulnerabilities(rootDir, options);
6137
6398
  const reportMarkdown = generateLicenseReportMarkdown(dependencies, violations, policy, artifacts.sbomPath);
6138
- return assembleDynamicLicenseResult(dependencies, permittedCount, violations, reportMarkdown, artifacts);
6399
+ return assembleDynamicLicenseResult(dependencies, permittedCount, violations, reportMarkdown, artifacts, vulnData);
6139
6400
  }
6140
6401
  var PROTECTED_BYPASS_PATTERNS = [
6141
6402
  /^schemas[\\/]/i,
@@ -6171,11 +6432,27 @@ function isPathProtectedFromPatch(filePath) {
6171
6432
  const normalized = filePath.replace(/\\/g, "/");
6172
6433
  return PROTECTED_BYPASS_PATTERNS.some((pattern) => pattern.test(normalized));
6173
6434
  }
6435
+ function detectBranchChangeMatch(rootDir, dirs) {
6436
+ if (!fs7__namespace.existsSync(path4__namespace.join(rootDir, ".git"))) return void 0;
6437
+ try {
6438
+ const branch = child_process.execFileSync("git", ["branch", "--show-current"], {
6439
+ cwd: rootDir,
6440
+ encoding: "utf-8",
6441
+ stdio: ["pipe", "pipe", "ignore"]
6442
+ }).trim().toLowerCase();
6443
+ if (!branch) return void 0;
6444
+ return dirs.find((d) => branch.includes(path4__namespace.basename(d).toLowerCase()));
6445
+ } catch {
6446
+ return void 0;
6447
+ }
6448
+ }
6174
6449
  function resolveActiveChangeDir(rootDir) {
6175
6450
  const activeRoot = path4__namespace.join(rootDir, "specs", "changes", "active");
6176
6451
  if (!fs7__namespace.existsSync(activeRoot)) return void 0;
6177
6452
  try {
6178
6453
  const dirs = fs7__namespace.readdirSync(activeRoot, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => path4__namespace.join(activeRoot, d.name));
6454
+ const branchMatch = detectBranchChangeMatch(rootDir, dirs);
6455
+ if (branchMatch) return branchMatch;
6179
6456
  return dirs.find((d) => detectProfileFromChange(d) === "patch") || dirs[0];
6180
6457
  } catch {
6181
6458
  return void 0;
@@ -6848,6 +7125,133 @@ function generateDuplicatesReportMarkdown(result) {
6848
7125
  }
6849
7126
  return lines.join("\n");
6850
7127
  }
7128
+
7129
+ // src/verifiers/security-suppressions.ts
7130
+ var SUPPRESSION_TRIGGER_REGEX = /(?:\/\/|#|--|\/\*)\s*(?:ai-sdlc:allow-sast|ai-sdlc:allow-secret|ai-sdlc:allow-prompt-injection|gitleaks:allow|pragma:\s*allowlist\s*secret|\bnosec\b)/i;
7131
+ function extractAttribute(text, attrName) {
7132
+ const pattern = new RegExp(`${attrName}\\s*=\\s*["']([^"']+)["']`, "i");
7133
+ const match = text.match(pattern);
7134
+ return match ? match[1].trim() : void 0;
7135
+ }
7136
+ function determineSuppressionKind(line) {
7137
+ if (line.includes("ai-sdlc:allow-secret") || line.includes("gitleaks:allow") || line.includes("allowlist secret")) {
7138
+ return "secret";
7139
+ }
7140
+ return "sast";
7141
+ }
7142
+ function isInformalSuppression(line) {
7143
+ return line.includes("nosec") || line.includes("pragma: allowlist secret") || line.includes("gitleaks:allow");
7144
+ }
7145
+ function checkMissingFields(reason, expires, approvedBy) {
7146
+ const missing = [];
7147
+ if (!reason) missing.push("reason");
7148
+ if (!expires) missing.push("expires");
7149
+ if (!approvedBy) missing.push("approved-by");
7150
+ return missing;
7151
+ }
7152
+ function checkExpiration(expires, referenceDate) {
7153
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(expires)) {
7154
+ return { status: "invalid", invalidReason: "Formato de fecha expires inv\xE1lido (se requiere YYYY-MM-DD)" };
7155
+ }
7156
+ const expDate = /* @__PURE__ */ new Date(`${expires}T23:59:59.999Z`);
7157
+ if (isNaN(expDate.getTime())) {
7158
+ return { status: "invalid", invalidReason: "Fecha expires no es una fecha v\xE1lida" };
7159
+ }
7160
+ const now = referenceDate || /* @__PURE__ */ new Date();
7161
+ if (expDate.getTime() < now.getTime()) {
7162
+ return { status: "expired", invalidReason: `Excepci\xF3n caducada en fecha ${expires}` };
7163
+ }
7164
+ return { status: "active" };
7165
+ }
7166
+ function evaluateSuppressionStatus(reason, expires, approvedBy, isInformal, referenceDate) {
7167
+ if (isInformal) {
7168
+ return { status: "invalid", invalidReason: "Formato informal (nosec/allowlist no estructurado) no permitido" };
7169
+ }
7170
+ const missing = checkMissingFields(reason, expires, approvedBy);
7171
+ if (missing.length > 0) {
7172
+ return { status: "invalid", invalidReason: `Faltan campos obligatorios: ${missing.join(", ")}` };
7173
+ }
7174
+ return checkExpiration(expires, referenceDate);
7175
+ }
7176
+ function extractSuppressionAttrs(line) {
7177
+ return {
7178
+ ruleId: extractAttribute(line, "rule"),
7179
+ reason: extractAttribute(line, "reason"),
7180
+ expires: extractAttribute(line, "expires"),
7181
+ approvedBy: extractAttribute(line, "approved-by") || extractAttribute(line, "approvedBy")
7182
+ };
7183
+ }
7184
+ function parseSecuritySuppression(line, filePath, lineNumber, referenceDate) {
7185
+ if (!SUPPRESSION_TRIGGER_REGEX.test(line)) return null;
7186
+ const kind = determineSuppressionKind(line);
7187
+ const isInformal = isInformalSuppression(line);
7188
+ const attrs = extractSuppressionAttrs(line);
7189
+ const evalResult = evaluateSuppressionStatus(attrs.reason, attrs.expires, attrs.approvedBy, isInformal, referenceDate);
7190
+ return {
7191
+ kind,
7192
+ ruleId: attrs.ruleId,
7193
+ reason: attrs.reason,
7194
+ expires: attrs.expires,
7195
+ approvedBy: attrs.approvedBy,
7196
+ status: evalResult.status,
7197
+ filePath,
7198
+ lineNumber,
7199
+ rawComment: line.trim(),
7200
+ invalidReason: evalResult.invalidReason
7201
+ };
7202
+ }
7203
+ function formatSuppressionRow(s) {
7204
+ const rule = s.ruleId ? `\`${s.ruleId}\`` : "*(all)*";
7205
+ const fileRef = `\`${s.filePath}:${s.lineNumber}\``;
7206
+ const reason = s.reason ? s.reason.replace(/\|/g, "\\|") : s.invalidReason || "*(Sin justificaci\xF3n)*";
7207
+ const expires = s.expires || "N/A";
7208
+ const approver = s.approvedBy || "*(Sin aprobador)*";
7209
+ return `| ${s.kind.toUpperCase()} | ${rule} | ${fileRef} | ${reason} | ${expires} | ${approver} |`;
7210
+ }
7211
+ function buildAuditHeader(total, active, expired, invalid) {
7212
+ return [
7213
+ "# \u{1F4CB} Security Suppressions and Audit Exceptions Inventory",
7214
+ "",
7215
+ `> **Generated at:** ${(/* @__PURE__ */ new Date()).toISOString()}`,
7216
+ `> **Total Audited Suppressions:** ${total} | **Active:** ${active} | **Expired:** ${expired} | **Invalid:** ${invalid}`,
7217
+ "",
7218
+ "## 1. Executive Summary",
7219
+ "",
7220
+ "| Category | Count | Status | Policy Compliance |",
7221
+ "| :--- | :---: | :---: | :--- |",
7222
+ `| **Active Suppressions** | ${active} | \u{1F7E2} PASS | Permitted until expiration date |`,
7223
+ `| **Expired Suppressions** | ${expired} | ${expired > 0 ? "\u{1F534} BLOCKED" : "\u{1F7E2} PASS"} | Must be renewed or remediated immediately |`,
7224
+ `| **Invalid Suppressions** | ${invalid} | ${invalid > 0 ? "\u26A0\uFE0F REJECTED" : "\u{1F7E2} PASS"} | Missing mandatory metadata fields |`,
7225
+ ""
7226
+ ];
7227
+ }
7228
+ function buildTableSection(title, items, emptyMsg) {
7229
+ const lines = [
7230
+ title,
7231
+ "",
7232
+ "| Engine | Rule / ID | Location | Details / Justification | Expires | Approved By |",
7233
+ "| :--- | :--- | :--- | :--- | :--- | :--- |"
7234
+ ];
7235
+ if (items.length === 0) {
7236
+ lines.push(`| - | - | - | ${emptyMsg} | - | - |`);
7237
+ } else {
7238
+ for (const item of items) lines.push(formatSuppressionRow(item));
7239
+ }
7240
+ lines.push("");
7241
+ return lines;
7242
+ }
7243
+ function generateSuppressionsAuditReport(suppressions) {
7244
+ const active = suppressions.filter((s) => s.status === "active");
7245
+ const expired = suppressions.filter((s) => s.status === "expired");
7246
+ const invalid = suppressions.filter((s) => s.status === "invalid");
7247
+ return [
7248
+ ...buildAuditHeader(suppressions.length, active.length, expired.length, invalid.length),
7249
+ ...buildTableSection("## 2. Active Security Exceptions", active, "*(No active suppressions recorded)*"),
7250
+ ...buildTableSection("## 3. Expired or Invalid Exceptions (Blocking/Rejected)", [...expired, ...invalid], "*(No expired or invalid suppressions)*")
7251
+ ].join("\n");
7252
+ }
7253
+
7254
+ // src/verifiers/secrets.ts
6851
7255
  var SECRET_RULES = [
6852
7256
  {
6853
7257
  id: "SEC-001-PRIVATE-KEY",
@@ -6969,13 +7373,15 @@ function maskSecret(secret) {
6969
7373
  const suffix = secret.slice(-suffixLen);
6970
7374
  return `${prefix}****${suffix}`;
6971
7375
  }
6972
- function isPlaceholderOrIgnored(secret, line) {
7376
+ function isPlaceholderOrIgnored(secret, line, filePath = "", lineNumber = 0, collectedSuppressions) {
6973
7377
  const lowerSecret = secret.toLowerCase();
6974
7378
  for (const placeholder of PLACEHOLDER_KEYWORDS) {
6975
7379
  if (lowerSecret.includes(placeholder)) return true;
6976
7380
  }
6977
- if (line.includes("ai-sdlc:allow-secret") || line.includes("gitleaks:allow") || line.includes("pragma: allowlist secret")) {
6978
- return true;
7381
+ const suppression = parseSecuritySuppression(line, filePath, lineNumber);
7382
+ if (suppression) {
7383
+ if (collectedSuppressions) collectedSuppressions.push(suppression);
7384
+ return suppression.status === "active";
6979
7385
  }
6980
7386
  return false;
6981
7387
  }
@@ -7116,14 +7522,14 @@ function buildSecretViolation(rule, rawMatch, entropy, filePath, relPath, lineNu
7116
7522
  message: `${rule.description} (Entrop\xEDa: ${entropy})`
7117
7523
  };
7118
7524
  }
7119
- function checkRuleOnLine(rule, line, lineNumber, filePath, relPath, entropyThreshold) {
7525
+ function checkRuleOnLine(rule, line, lineNumber, filePath, relPath, entropyThreshold, collectedSuppressions) {
7120
7526
  const violations = [];
7121
7527
  rule.regex.lastIndex = 0;
7122
7528
  let match;
7123
7529
  while ((match = rule.regex.exec(line)) !== null) {
7124
7530
  const rawMatch = rule.captureIndex ? match[rule.captureIndex] : match[0];
7125
7531
  if (!rawMatch || rawMatch.length < 8) continue;
7126
- if (isPlaceholderOrIgnored(rawMatch, line)) continue;
7532
+ if (isPlaceholderOrIgnored(rawMatch, line, filePath, lineNumber, collectedSuppressions)) continue;
7127
7533
  const entropy = calculateShannonEntropy(rawMatch);
7128
7534
  if (rule.minEntropy && entropy < (entropyThreshold || rule.minEntropy)) {
7129
7535
  continue;
@@ -7132,20 +7538,20 @@ function checkRuleOnLine(rule, line, lineNumber, filePath, relPath, entropyThres
7132
7538
  }
7133
7539
  return violations;
7134
7540
  }
7135
- function scanLineForSecrets(line, lineNumber, filePath, relPath, entropyThreshold) {
7541
+ function scanLineForSecrets(line, lineNumber, filePath, relPath, entropyThreshold, collectedSuppressions) {
7136
7542
  if (!line || line.trim().length === 0) return [];
7137
7543
  const lineViolations = [];
7138
7544
  for (const rule of SECRET_RULES) {
7139
- lineViolations.push(...checkRuleOnLine(rule, line, lineNumber, filePath, relPath, entropyThreshold));
7545
+ lineViolations.push(...checkRuleOnLine(rule, line, lineNumber, filePath, relPath, entropyThreshold, collectedSuppressions));
7140
7546
  }
7141
7547
  return lineViolations;
7142
7548
  }
7143
- function scanContentForSecrets(content, filePath, rootDir, entropyThreshold = 4.3) {
7549
+ function scanContentForSecrets(content, filePath, rootDir, entropyThreshold = 4.3, collectedSuppressions) {
7144
7550
  const violations = [];
7145
7551
  const lines = content.split(/\r?\n/);
7146
7552
  const relPath = path4__namespace.relative(rootDir, filePath).replace(/\\/g, "/");
7147
7553
  for (let i = 0; i < lines.length; i++) {
7148
- violations.push(...scanLineForSecrets(lines[i], i + 1, filePath, relPath, entropyThreshold));
7554
+ violations.push(...scanLineForSecrets(lines[i], i + 1, filePath, relPath, entropyThreshold, collectedSuppressions));
7149
7555
  }
7150
7556
  return violations;
7151
7557
  }
@@ -7161,29 +7567,31 @@ function groupDiffLinesByFile(diffLines) {
7161
7567
  function scanDiffItems(diffLines, rootDir, excludePatterns, entropyThreshold) {
7162
7568
  const fileGroups = groupDiffLinesByFile(diffLines);
7163
7569
  const findings = [];
7570
+ const suppressions = [];
7164
7571
  for (const [relFile, items] of fileGroups) {
7165
7572
  if (isPathExcluded2(relFile, excludePatterns)) continue;
7166
7573
  const absPath = path4__namespace.resolve(rootDir, relFile);
7167
7574
  for (const item of items) {
7168
- const lineViolations = scanLineForSecrets(item.content, item.lineNumber, absPath, relFile, entropyThreshold);
7575
+ const lineViolations = scanLineForSecrets(item.content, item.lineNumber, absPath, relFile, entropyThreshold, suppressions);
7169
7576
  for (const v of lineViolations) {
7170
7577
  findings.push({ ...v, message: `[DIFF] ${v.message}` });
7171
7578
  }
7172
7579
  }
7173
7580
  }
7174
- return { findings, filesScannedCount: fileGroups.size };
7581
+ return { findings, filesScannedCount: fileGroups.size, suppressions };
7175
7582
  }
7176
7583
  function scanAllProjectFiles(rootDir, excludePatterns, entropyThreshold) {
7177
7584
  const allFiles = walkProjectFiles(rootDir, rootDir, excludePatterns);
7178
7585
  const findings = [];
7586
+ const suppressions = [];
7179
7587
  for (const file of allFiles) {
7180
7588
  try {
7181
7589
  const content = fs7__namespace.readFileSync(file, "utf-8");
7182
- findings.push(...scanContentForSecrets(content, file, rootDir, entropyThreshold));
7590
+ findings.push(...scanContentForSecrets(content, file, rootDir, entropyThreshold, suppressions));
7183
7591
  } catch {
7184
7592
  }
7185
7593
  }
7186
- return { findings, filesScannedCount: allFiles.length };
7594
+ return { findings, filesScannedCount: allFiles.length, suppressions };
7187
7595
  }
7188
7596
  function appendNonDuplicateFindings(target, incoming) {
7189
7597
  for (const item of incoming) {
@@ -7216,14 +7624,16 @@ function verifySecrets(options = {}) {
7216
7624
  const rootDir = options.rootDir || process.cwd();
7217
7625
  const entropyThreshold = options.entropyThreshold ?? 4.3;
7218
7626
  const excludePatterns = options.excludePatterns || DEFAULT_EXCLUDED_PATTERNS;
7219
- const { findings, filesScannedCount } = options.diff ? scanDiffItems(getGitDiffLines(rootDir, options.baseBranch), rootDir, excludePatterns, entropyThreshold) : scanAllProjectFiles(rootDir, excludePatterns, entropyThreshold);
7627
+ const { findings, filesScannedCount, suppressions } = options.diff ? scanDiffItems(getGitDiffLines(rootDir, options.baseBranch), rootDir, excludePatterns, entropyThreshold) : scanAllProjectFiles(rootDir, excludePatterns, entropyThreshold);
7220
7628
  const merged = mergeGitleaksFindings(findings, rootDir, options.gitleaks);
7629
+ const hasExpired = (suppressions || []).some((s) => s.status === "expired");
7221
7630
  const result = {
7222
- success: merged.findings.length === 0,
7631
+ success: merged.findings.length === 0 && !hasExpired,
7223
7632
  totalFilesScanned: filesScannedCount,
7224
7633
  findingsCount: merged.findings.length,
7225
7634
  findings: merged.findings,
7226
- scannedWithGitleaks: merged.scannedWithGitleaks
7635
+ scannedWithGitleaks: merged.scannedWithGitleaks,
7636
+ suppressions
7227
7637
  };
7228
7638
  result.reportMarkdown = generateSecretsReportMarkdown(result);
7229
7639
  return result;
@@ -7448,8 +7858,12 @@ function walkSourceFiles(dir, rootDir, excludes = DEFAULT_SAST_EXCLUDES) {
7448
7858
  }
7449
7859
  return files;
7450
7860
  }
7451
- function isLineExemptFromSast(line) {
7452
- return line.includes("ai-sdlc:allow-sast") || line.includes("ai-sdlc:allow-prompt-injection") || line.includes("nosec");
7861
+ function checkLineSuppression(line, relPath, lineNumber, collected) {
7862
+ if (line.includes("ai-sdlc:allow-prompt-injection")) return true;
7863
+ const supp = parseSecuritySuppression(line, relPath, lineNumber);
7864
+ if (!supp) return false;
7865
+ if (collected) collected.push(supp);
7866
+ return supp.status === "active";
7453
7867
  }
7454
7868
  function checkRuleMatch(rule, line, ext, minSeverity) {
7455
7869
  if (rule.fileExtensions && !rule.fileExtensions.includes(ext)) return false;
@@ -7457,7 +7871,7 @@ function checkRuleMatch(rule, line, ext, minSeverity) {
7457
7871
  rule.pattern.lastIndex = 0;
7458
7872
  return rule.pattern.test(line);
7459
7873
  }
7460
- function scanFileForSast(filePath, rootDir, minSeverity = "HIGH") {
7874
+ function scanFileForSast(filePath, rootDir, minSeverity = "HIGH", collectedSuppressions) {
7461
7875
  const violations = [];
7462
7876
  const ext = path4__namespace.extname(filePath).toLowerCase();
7463
7877
  try {
@@ -7466,7 +7880,7 @@ function scanFileForSast(filePath, rootDir, minSeverity = "HIGH") {
7466
7880
  const relPath = path4__namespace.relative(rootDir, filePath).replace(/\\/g, "/");
7467
7881
  for (let i = 0; i < lines.length; i++) {
7468
7882
  const line = lines[i];
7469
- if (isLineExemptFromSast(line)) continue;
7883
+ if (checkLineSuppression(line, relPath, i + 1, collectedSuppressions)) continue;
7470
7884
  for (const rule of SAST_RULES) {
7471
7885
  if (checkRuleMatch(rule, line, ext, minSeverity)) {
7472
7886
  violations.push({
@@ -7506,8 +7920,9 @@ function verifySast(options = {}) {
7506
7920
  const targetDirs = options.targetDirectories || ["src", "packages", "prompts"];
7507
7921
  const filesToScan = collectSastFiles(rootDir, targetDirs);
7508
7922
  const violations = [];
7923
+ const suppressions = [];
7509
7924
  for (const file of filesToScan) {
7510
- violations.push(...scanFileForSast(file, rootDir, minSeverity));
7925
+ violations.push(...scanFileForSast(file, rootDir, minSeverity, suppressions));
7511
7926
  }
7512
7927
  if (shouldRunSemgrep(options)) {
7513
7928
  try {
@@ -7515,11 +7930,13 @@ function verifySast(options = {}) {
7515
7930
  } catch {
7516
7931
  }
7517
7932
  }
7933
+ const hasExpired = suppressions.some((s) => s.status === "expired");
7518
7934
  const result = {
7519
- success: violations.length === 0,
7935
+ success: violations.length === 0 && !hasExpired,
7520
7936
  totalFilesScanned: filesToScan.length,
7521
7937
  violationsCount: violations.length,
7522
- violations
7938
+ violations,
7939
+ suppressions
7523
7940
  };
7524
7941
  result.reportMarkdown = generateSastReportMarkdown(result);
7525
7942
  return result;
@@ -7572,7 +7989,7 @@ var PROMPT_INJECTION_SIGNATURES = [
7572
7989
  severity: "CRITICAL",
7573
7990
  regex: /(?:\b(?:system\s+(?:prompt\s+)?override|override\s+system\s+prompt|developer\s+mode\s+enabled|dan\s+mode(?:\s+enabled)?|unfiltered\s+(?:ai\s+)?mode)\b)/i,
7574
7991
  message: "Attempted system prompt override, developer mode, or unrestricted mode activation"
7575
- // ai-sdlc:allow-prompt-injection
7992
+ // ai-sdlc:allow-sast rule="PROMPT-INJ-MODE-OVERRIDE" reason="Regla interna de deteccion" expires="2099-12-31" approved-by="security@ai-sdlc.dev"
7576
7993
  },
7577
7994
  {
7578
7995
  ruleId: "PROMPT-INJ-LEAK",
@@ -7596,7 +8013,7 @@ var PROMPT_INJECTION_SIGNATURES = [
7596
8013
  function scanLinesForPromptInjection(lines, findings) {
7597
8014
  for (let i = 0; i < lines.length; i++) {
7598
8015
  const line = lines[i];
7599
- if (line.includes("ai-sdlc:allow-prompt-injection") || line.includes("nosec")) continue;
8016
+ if (line.includes("ai-sdlc:allow-prompt-injection")) continue;
7600
8017
  for (const sig of PROMPT_INJECTION_SIGNATURES) {
7601
8018
  sig.regex.lastIndex = 0;
7602
8019
  if (sig.regex.test(line)) {
@@ -9585,6 +10002,7 @@ var PREFIX_MAP = {
9585
10002
  "ACT": { type: "actor", layer: "product" },
9586
10003
  "UC": { type: "use-case", layer: "product" },
9587
10004
  "BR": { type: "business-rule", layer: "product" },
10005
+ "BC": { type: "bounded-context", layer: "product" },
9588
10006
  "ABUSE": { type: "abuse-case", layer: "product" },
9589
10007
  "DATA-ASSET": { type: "data-asset", layer: "product" },
9590
10008
  "PRIV-ROPA": { type: "privacy-ropa", layer: "product" },
@@ -9603,6 +10021,7 @@ var TYPE_LOOKUP = {
9603
10021
  "use-case": { type: "use-case", layer: "product" },
9604
10022
  "usecase": { type: "use-case", layer: "product" },
9605
10023
  "business-rule": { type: "business-rule", layer: "product" },
10024
+ "bounded-context": { type: "bounded-context", layer: "product" },
9606
10025
  "rule": { type: "business-rule", layer: "product" },
9607
10026
  "abuse-case": { type: "abuse-case", layer: "product" },
9608
10027
  "data-asset": { type: "data-asset", layer: "product" },
@@ -9974,6 +10393,23 @@ function connectAdrRelationships(art, nodeMap, addEdge) {
9974
10393
  }
9975
10394
  }
9976
10395
  }
10396
+ function connectBoundedContextRelationships(art, nodeMap, addEdge) {
10397
+ for (const cmp of toList(art.frontmatter["components-involved"] || art.frontmatter.components)) {
10398
+ const id = cmp.trim();
10399
+ if (id) {
10400
+ connectTargets(art.id, [id], "encompasses", nodeMap, addEdge, "component", "architecture");
10401
+ }
10402
+ }
10403
+ const cm = art.frontmatter["context-mapping"];
10404
+ if (cm && typeof cm === "object") {
10405
+ for (const up of toList(cm["upstream-dependencies"])) {
10406
+ const id = up.trim();
10407
+ if (id) {
10408
+ connectTargets(art.id, [id], "depends-on", nodeMap, addEdge, "bounded-context", "product");
10409
+ }
10410
+ }
10411
+ }
10412
+ }
9977
10413
  function connectEnclaveRelationships(art, nodeMap, addEdge) {
9978
10414
  for (const sec of toList(art.frontmatter["enforced-by"])) {
9979
10415
  const id = sec.trim();
@@ -9994,6 +10430,7 @@ var CONNECTOR_MAP = {
9994
10430
  "security-requirement": connectRequirementMitigations,
9995
10431
  "privacy-requirement": connectRequirementMitigations,
9996
10432
  "adr": connectAdrRelationships,
10433
+ "bounded-context": connectBoundedContextRelationships,
9997
10434
  "security-enclave": connectEnclaveRelationships
9998
10435
  };
9999
10436
  function connectArtifactRelationships(scannedMap, nodeMap, addEdge) {
@@ -10655,6 +11092,19 @@ var DASHBOARD_CLIENT_SCRIPT = `
10655
11092
  'height': 40
10656
11093
  }
10657
11094
  },
11095
+ {
11096
+ selector: 'node.type-bounded-context',
11097
+ style: {
11098
+ 'shape': 'round-rectangle',
11099
+ 'background-color': '#4338ca',
11100
+ 'border-color': '#a5b4fc',
11101
+ 'border-width': 2.5,
11102
+ 'width': 75,
11103
+ 'height': 42,
11104
+ 'font-weight': 'bold',
11105
+ 'text-max-width': '70px'
11106
+ }
11107
+ },
10658
11108
  {
10659
11109
  selector: 'node.type-security-enclave',
10660
11110
  style: {
@@ -10758,6 +11208,14 @@ var DASHBOARD_CLIENT_SCRIPT = `
10758
11208
  selector: 'edge.relation-verified-by',
10759
11209
  style: { 'line-color': '#10b981', 'target-arrow-color': '#10b981', 'width': 1.8 }
10760
11210
  },
11211
+ {
11212
+ selector: 'edge.relation-encompasses',
11213
+ style: { 'line-color': '#a5b4fc', 'target-arrow-color': '#a5b4fc', 'width': 2 }
11214
+ },
11215
+ {
11216
+ selector: 'edge.relation-depends-on',
11217
+ style: { 'line-color': '#c084fc', 'target-arrow-color': '#c084fc', 'line-style': 'dashed', 'width': 1.8 }
11218
+ },
10761
11219
  {
10762
11220
  selector: 'node.highlighted',
10763
11221
  style: {
@@ -10954,6 +11412,7 @@ var DASHBOARD_CLIENT_SCRIPT = `
10954
11412
  'actor': '.type-actor, .type-threat-actor',
10955
11413
  'use-case': '.type-use-case, .type-usecase',
10956
11414
  'business-rule': '.type-business-rule, .type-rule',
11415
+ 'bounded-context': '.type-bounded-context',
10957
11416
  'abuse-case': '.type-abuse-case, .type-threat-actor',
10958
11417
  'data-asset': '.type-data-asset',
10959
11418
  'privacy-ropa': '.type-privacy-ropa',
@@ -11366,6 +11825,7 @@ var GRAPH_LEGEND_HTML = `
11366
11825
  <div class="legend-item" data-type="actor" onclick="handleTypologyClick(event, 'actor')" title="Filter Actor"><span class="legend-dot" style="background:#065f46; border:2px solid #34d399; border-radius:50%;"></span><strong>Actor</strong> (ACT)</div>
11367
11826
  <div class="legend-item" data-type="use-case" onclick="handleTypologyClick(event, 'use-case')" title="Filter Use Case"><span class="legend-dot" style="background:#0369a1; border:2px solid #38bdf8;"></span><strong>Use Case</strong> (UC)</div>
11368
11827
  <div class="legend-item" data-type="business-rule" onclick="handleTypologyClick(event, 'business-rule')" title="Filter Business Rule"><span class="legend-dot" style="background:#b45309; border:2px solid #fbbf24; transform:rotate(45deg);"></span><strong>Business Rule</strong> (BR)</div>
11828
+ <div class="legend-item" data-type="bounded-context" onclick="handleTypologyClick(event, 'bounded-context')" title="Filter Bounded Context"><span class="legend-dot" style="background:#4338ca; border:2px solid #a5b4fc;"></span><strong>Bounded Context</strong> (BC)</div>
11369
11829
  <div class="legend-item" data-type="abuse-case" onclick="handleTypologyClick(event, 'abuse-case')" title="Filter Abuse Case"><span class="legend-dot" style="background:#881337; border:2px solid #f43f5e;"></span><strong>Abuse Case</strong> (ABUSE)</div>
11370
11830
  <div class="legend-item" data-type="data-asset" onclick="handleTypologyClick(event, 'data-asset')" title="Filter Data Asset"><span class="legend-dot" style="background:#134e4a; border:2px solid #5eead4;"></span><strong>Data Asset</strong> (DATA-ASSET)</div>
11371
11831
  <div class="legend-item" data-type="privacy-ropa" onclick="handleTypologyClick(event, 'privacy-ropa')" title="Filter Privacy ROPA"><span class="legend-dot" style="background:#1e3a8a; border:2px solid #60a5fa;"></span><strong>Privacy ROPA</strong> (PRIV-ROPA)</div>
@@ -11410,7 +11870,7 @@ function renderGraphToolbarHtml() {
11410
11870
  ` <div class="graph-toolbar">`,
11411
11871
  ` <div class="tool-row"><button class="tool-btn" onclick="cyZoom(0.2)">Zoom +</button><button class="tool-btn" onclick="cyZoom(-0.2)">Zoom -</button><button class="tool-btn" onclick="cy.fit(30)">Center</button><button class="tool-btn" onclick="resetHighlight()">Reset</button></div>`,
11412
11872
  ` <div class="tool-row"><select id="layout-select" class="tool-select" onchange="applyLayout(this.value)"><option value="breadthfirst">Hierarchical (Layers)</option><option value="cose">Force-directed (COSE)</option><option value="concentric">Concentric</option><option value="circle">Circular</option></select></div>`,
11413
- ` <div class="tool-row"><select id="type-filter" class="tool-select" onchange="filterType(this.value)"><option value="all">All Typologies</option><option value="architecture-introduction">Vision &amp; Goals (ARCH-INTRO)</option><option value="journey">Journeys (JRN)</option><option value="actor">Actors (ACT)</option><option value="use-case">Use Cases (UC)</option><option value="business-rule">Business Rules (BR)</option><option value="abuse-case">Abuse Cases (ABUSE)</option><option value="data-asset">Data Assets (DATA-ASSET)</option><option value="privacy-ropa">Privacy ROPA (PRIV-ROPA)</option><option value="requirement">Requirements (FR/QR/SEC/PRIV)</option><option value="architecture">Architecture (CMP/ADR)</option><option value="test">Testing (BDD/Test)</option></select></div>`,
11873
+ ` <div class="tool-row"><select id="type-filter" class="tool-select" onchange="filterType(this.value)"><option value="all">All Typologies</option><option value="architecture-introduction">Vision &amp; Goals (ARCH-INTRO)</option><option value="journey">Journeys (JRN)</option><option value="actor">Actors (ACT)</option><option value="use-case">Use Cases (UC)</option><option value="business-rule">Business Rules (BR)</option><option value="bounded-context">Bounded Contexts (BC)</option><option value="abuse-case">Abuse Cases (ABUSE)</option><option value="data-asset">Data Assets (DATA-ASSET)</option><option value="privacy-ropa">Privacy ROPA (PRIV-ROPA)</option><option value="requirement">Requirements (FR/QR/SEC/PRIV)</option><option value="architecture">Architecture (CMP/ADR)</option><option value="test">Testing (BDD/Test)</option></select></div>`,
11414
11874
  ` <div class="tool-row"><select id="layer-filter" class="tool-select" onchange="filterLayer(this.value)"><option value="all">All Layers</option><option value="product">Layer 1: Product (Upstream)</option><option value="requirement">Layer 2: Requirements</option><option value="architecture">Layer 3: Architecture (Midstream)</option><option value="test">Layer 4: Testing (Downstream)</option></select></div>`,
11415
11875
  ` <div class="tool-row"><select id="status-filter" class="tool-select" onchange="filterStatus(this.value)"><option value="all">All Statuses</option><option value="COMPLIANT">Only Compliant (Green)</option><option value="issues">Only Orphans / Drift (Red)</option></select></div>`,
11416
11876
  ` <div class="tool-row"><input type="text" id="node-search" class="tool-input" placeholder="Search node ID..." oninput="searchNode(this.value)"></div>`,
@@ -12140,6 +12600,159 @@ function generateDashboardReport(options = {}) {
12140
12600
  html
12141
12601
  };
12142
12602
  }
12603
+ var SARIF_SCHEMA_2_1_0 = "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json";
12604
+ var SARIF_VERSION = "2.1.0";
12605
+ function normalizeUri(filePath) {
12606
+ return filePath.replace(/\\/g, "/");
12607
+ }
12608
+ function mapSastSeverityToSarifLevel(severity) {
12609
+ switch (severity) {
12610
+ case "CRITICAL":
12611
+ case "HIGH":
12612
+ return "error";
12613
+ case "MEDIUM":
12614
+ return "warning";
12615
+ case "LOW":
12616
+ default:
12617
+ return "note";
12618
+ }
12619
+ }
12620
+ var SAST_CWE_MAP = {
12621
+ "SAST-001": "CWE-89",
12622
+ "SAST-002": "CWE-78",
12623
+ "SAST-003": "CWE-95",
12624
+ "SAST-004": "CWE-918",
12625
+ "SAST-005": "CWE-22",
12626
+ "SAST-006": "CWE-77",
12627
+ "SAST-007": "CWE-77"
12628
+ };
12629
+ var SAST_OWASP_MAP = {
12630
+ "SAST-001": "A03:2021-Injection",
12631
+ "SAST-002": "A03:2021-Injection",
12632
+ "SAST-003": "A03:2021-Injection",
12633
+ "SAST-004": "A10:2021-Server-Side Request Forgery (SSRF)",
12634
+ "SAST-005": "A01:2021-Broken Access Control",
12635
+ "SAST-006": "LLM01:2023-Prompt Injection",
12636
+ "SAST-007": "LLM01:2023-Prompt Injection"
12637
+ };
12638
+ function resolveSastCwe(ruleId) {
12639
+ const prefix = ruleId.slice(0, 8);
12640
+ const cwe = SAST_CWE_MAP[prefix];
12641
+ return cwe ? [cwe] : ["CWE-200"];
12642
+ }
12643
+ function resolveSastOwasp(ruleId) {
12644
+ const prefix = ruleId.slice(0, 8);
12645
+ const owasp = SAST_OWASP_MAP[prefix];
12646
+ return owasp ? [owasp] : ["A04:2021-Insecure Design"];
12647
+ }
12648
+ function buildSastRuleDescriptors() {
12649
+ return SAST_RULES.map((rule) => ({
12650
+ id: rule.id,
12651
+ name: rule.type,
12652
+ shortDescription: { text: rule.description },
12653
+ fullDescription: { text: rule.description },
12654
+ defaultConfiguration: { level: mapSastSeverityToSarifLevel(rule.severity) },
12655
+ properties: {
12656
+ tags: ["security", "sast"],
12657
+ cwe: resolveSastCwe(rule.id),
12658
+ owasp: resolveSastOwasp(rule.id)
12659
+ }
12660
+ }));
12661
+ }
12662
+ function buildSecretRuleDescriptors() {
12663
+ return SECRET_RULES.map((rule) => ({
12664
+ id: rule.id,
12665
+ name: rule.type,
12666
+ shortDescription: { text: rule.description },
12667
+ fullDescription: { text: rule.description },
12668
+ defaultConfiguration: { level: "error" },
12669
+ properties: {
12670
+ tags: ["security", "secrets", "credentials"],
12671
+ cwe: ["CWE-798"],
12672
+ owasp: ["A07:2021-Identification and Authentication Failures"]
12673
+ }
12674
+ }));
12675
+ }
12676
+ function buildSastResults(sastResult) {
12677
+ if (!sastResult || !sastResult.violations) return [];
12678
+ return sastResult.violations.map((v) => ({
12679
+ ruleId: v.ruleId,
12680
+ level: mapSastSeverityToSarifLevel(v.severity),
12681
+ message: { text: v.message },
12682
+ locations: [
12683
+ {
12684
+ physicalLocation: {
12685
+ artifactLocation: { uri: normalizeUri(v.relPath) },
12686
+ region: { startLine: v.lineNumber, startColumn: 1 }
12687
+ }
12688
+ }
12689
+ ]
12690
+ }));
12691
+ }
12692
+ function buildSecretResults(secretsResult) {
12693
+ if (!secretsResult || !secretsResult.findings) return [];
12694
+ return secretsResult.findings.map((f) => ({
12695
+ ruleId: f.ruleId,
12696
+ level: "error",
12697
+ message: {
12698
+ text: `Potential hardcoded secret or credential leak detected: ${f.type} (${f.maskedMatch})`
12699
+ },
12700
+ locations: [
12701
+ {
12702
+ physicalLocation: {
12703
+ artifactLocation: { uri: normalizeUri(f.relPath) },
12704
+ region: { startLine: f.lineNumber, startColumn: 1 }
12705
+ }
12706
+ }
12707
+ ]
12708
+ }));
12709
+ }
12710
+ function collectAllRules() {
12711
+ const sastRules = buildSastRuleDescriptors();
12712
+ const secretRules = buildSecretRuleDescriptors();
12713
+ const ruleMap = /* @__PURE__ */ new Map();
12714
+ for (const r of [...sastRules, ...secretRules]) {
12715
+ if (!ruleMap.has(r.id)) {
12716
+ ruleMap.set(r.id, r);
12717
+ }
12718
+ }
12719
+ return Array.from(ruleMap.values());
12720
+ }
12721
+ function generateSecuritySarifReport(options = {}) {
12722
+ const toolName = options.toolName || "aisdlc-security";
12723
+ const toolVersion = options.toolVersion || "2.2.0";
12724
+ const informationUri = options.informationUri || "https://github.com/altromon/AI-SDLC";
12725
+ const sastResults = buildSastResults(options.sastResult);
12726
+ const secretResults = buildSecretResults(options.secretsResult);
12727
+ const allResults = [...sastResults, ...secretResults];
12728
+ return {
12729
+ $schema: SARIF_SCHEMA_2_1_0,
12730
+ version: SARIF_VERSION,
12731
+ runs: [
12732
+ {
12733
+ tool: {
12734
+ driver: {
12735
+ name: toolName,
12736
+ version: toolVersion,
12737
+ informationUri,
12738
+ rules: collectAllRules()
12739
+ }
12740
+ },
12741
+ results: allResults
12742
+ }
12743
+ ]
12744
+ };
12745
+ }
12746
+ function serializeSarifDocument(doc, pretty = true) {
12747
+ return JSON.stringify(doc, null, pretty ? 2 : 0);
12748
+ }
12749
+ function writeSecuritySarifReport(outputPath, doc, pretty = true) {
12750
+ const dir = path4__namespace.dirname(outputPath);
12751
+ if (!fs7__namespace.existsSync(dir)) {
12752
+ fs7__namespace.mkdirSync(dir, { recursive: true });
12753
+ }
12754
+ fs7__namespace.writeFileSync(outputPath, serializeSarifDocument(doc, pretty), "utf-8");
12755
+ }
12143
12756
 
12144
12757
  // src/init/agent-templates.ts
12145
12758
  var SPECIALIZED_AGENT_TEMPLATES = [
@@ -12245,7 +12858,7 @@ var SPECIALIZED_AGENT_TEMPLATES = [
12245
12858
  - Read exclusively requirements cited in the \`handoff.yaml\` sidecar (\`HOF-*\`) and their referenced artifacts.
12246
12859
  - **Agreed Project Technology**: Always use the testing frameworks, E2E/UI runners, and technology stack agreed upon for the project (as defined in \`ADR-*\`, \`design.md\`, \`package.json\`, or project configuration) if present, without requiring the user to specify it in the prompt.
12247
12860
  - **Mandatory End-to-End (E2E) & User Interface (UI) Testing**: Never forget or omit End-to-End (E2E) and User Interface (UI) tests. Automatically include E2E and UI test suites alongside BDD/integration tests whenever requirements involve user-facing flows or interfaces, so the user never has to remind you in the prompt.
12248
- - **Per-Interactive-Element Exhaustive Testing**: Create specific tests for **every** UI element with which the user can interact (buttons, inputs, selects, forms, modals, links, toggles, tabs, etc.), explicitly evaluating for each element:
12861
+ - **Per-Interactive-Element Exhaustive Testing**: Create specific tests for **every** UI element with which the user can interact (buttons, inputs, selects, forms, modals, links, toggles, tabs, etc.), using external tools such as Playwright or FlatUI (or the agreed project testing technology), explicitly evaluating for each element:
12249
12862
  1. **Happy Path**: nominal user interaction with valid inputs producing the expected UI state/response.
12250
12863
  2. **Sad Path**: error handling, invalid interactions, validation rejections, disabled/blocked states, and failure recovery.
12251
12864
  3. **Boundary Values**: minimum/maximum lengths, numeric extremes, empty/whitespace inputs, edge selections, and rapid/repeated interactions.
@@ -14136,15 +14749,16 @@ pipelines:\r
14136
14749
  var STARTER_TEMPLATES_CI_GITHUB_WORKFLOWS_CI_YML = "name: CI - AI-SDLC Quality Gates & Testing\r\n\r\non:\r\n push:\r\n branches: [ main ]\r\n pull_request:\r\n branches: [ main ]\r\n\r\njobs:\r\n verify-and-test:\r\n runs-on: ubuntu-latest\r\n strategy:\r\n matrix:\r\n node-version: [ 18.x, 20.x, 22.x ]\r\n\r\n steps:\r\n - name: Checkout Code\r\n uses: actions/checkout@v4\r\n\r\n - name: Install pnpm\r\n uses: pnpm/action-setup@v4\r\n with:\r\n version: 10\r\n\r\n - name: Setup Node.js ${{ matrix.node-version }}\r\n uses: actions/setup-node@v4\r\n with:\r\n node-version: ${{ matrix.node-version }}\r\n\r\n - name: Install Dependencies\r\n run: |\r\n pnpm install --frozen-lockfile\r\n pnpm approve-builds --all\r\n\r\n - name: Build Packages\r\n run: pnpm run build\r\n\r\n - name: Run Vitest Unit & Integration Suites\r\n run: pnpm test\r\n\r\n - name: AI-SDLC Quality Gate & Full Verification\r\n run: npx @aisdlc/cli verify all\r\n";
14137
14750
  var STARTER_TEMPLATES_CI_GITHUB_WORKFLOWS_DEPLOY_DASHBOARD_YML = 'name: Deploy AI-SDLC Dashboard to GitHub Pages\r\n\r\non:\r\n push:\r\n branches:\r\n - main\r\n workflow_dispatch:\r\n\r\npermissions:\r\n contents: read\r\n pages: write\r\n id-token: write\r\n\r\nconcurrency:\r\n group: pages\r\n cancel-in-progress: false\r\n\r\njobs:\r\n deploy-dashboard:\r\n name: Build & Publish Interactive Dashboard\r\n runs-on: ubuntu-latest\r\n environment:\r\n name: github-pages\r\n url: ${{ steps.deployment.outputs.page_url }}\r\n\r\n steps:\r\n - name: Checkout Code\r\n uses: actions/checkout@v4\r\n with:\r\n fetch-depth: 0 # Full git history required for historical KPIs and telemetry\r\n\r\n - name: Setup Node.js\r\n uses: actions/setup-node@v4\r\n with:\r\n node-version: 20\r\n\r\n - name: Generate AI-SDLC Interactive Dashboard\r\n run: |\r\n mkdir -p reports\r\n npx --yes @aisdlc/cli report dashboard --output reports/index.html\r\n cp reports/index.html reports/dashboard.html\r\n touch reports/.nojekyll\r\n\r\n - name: Setup GitHub Pages\r\n uses: actions/configure-pages@v5\r\n\r\n - name: Upload Pages Artifact\r\n uses: actions/upload-pages-artifact@v3\r\n with:\r\n path: reports\r\n\r\n - name: Deploy to GitHub Pages\r\n id: deployment\r\n uses: actions/deploy-pages@v4\r\n\r\n - name: Emit Summary to GitHub Actions\r\n if: always() && steps.deployment.outcome == \'success\'\r\n run: |\r\n echo "### \u{1F310} AI-SDLC Interactive Dashboard Published" >> $GITHUB_STEP_SUMMARY\r\n echo "" >> $GITHUB_STEP_SUMMARY\r\n echo "The interactive PDaC / RTM graph, Quality Gate telemetry, and release metrics are live at:" >> $GITHUB_STEP_SUMMARY\r\n echo "" >> $GITHUB_STEP_SUMMARY\r\n echo "\u{1F449} **[Open Live Dashboard](${{ steps.deployment.outputs.page_url }})**" >> $GITHUB_STEP_SUMMARY\r\n';
14138
14751
  var STARTER_TEMPLATES_CI_GITHUB_WORKFLOWS_PR_KPI_SUMMARY_YML = "name: AI-SDLC PR KPI Aggregator\r\n\r\non:\r\n pull_request:\r\n types: [opened, synchronize, reopened]\r\n\r\npermissions:\r\n contents: read\r\n pull-requests: write\r\n\r\njobs:\r\n aggregate-kpis:\r\n name: Aggregate PR KPIs & Telemetry\r\n runs-on: ubuntu-latest\r\n\r\n steps:\r\n - name: Checkout Repository\r\n uses: actions/checkout@v4\r\n with:\r\n fetch-depth: 0\r\n\r\n - name: Install pnpm\r\n uses: pnpm/action-setup@v4\r\n with:\r\n version: 10\r\n\r\n - name: Setup Node.js\r\n uses: actions/setup-node@v4\r\n with:\r\n node-version: 20\r\n\r\n - name: Install Dependencies\r\n run: |\r\n pnpm install --frozen-lockfile\r\n\r\n - name: Calculate and Emit PR KPIs\r\n id: kpi\r\n run: |\r\n npx @aisdlc/cli kpi pr --base origin/${{ github.base_ref }} --head HEAD >> $GITHUB_STEP_SUMMARY\r\n";
14139
- var STARTER_TEMPLATES_CI_GITHUB_WORKFLOWS_SDD_INTEGRATE_ON_MERGE_YML = 'name: SDD Canonical Integration on Merge\n\non:\n pull_request:\n types: [closed]\n branches:\n - main\n - \'release/**\'\n workflow_dispatch:\n inputs:\n change_id:\n description: \'SDD change ID to integrate manually (e.g. chg-001-telemetry)\'\n required: false\n type: string\n\npermissions:\n contents: write\n pull-requests: read\n\nconcurrency:\n group: sdd-integrate-${{ github.event.pull_request.base.ref || github.ref_name }}\n cancel-in-progress: false\n\njobs:\n integrate-sdd:\n name: SDD Canonical Integration\n if: github.event.pull_request.merged == true || github.event_name == \'workflow_dispatch\'\n runs-on: ubuntu-latest\n\n steps:\n - name: Checkout Repository\n uses: actions/checkout@v4\n with:\n ref: ${{ github.event.pull_request.base.ref || github.ref_name }}\n fetch-depth: 0\n token: ${{ secrets.GITHUB_TOKEN }}\n\n - name: Install pnpm\n uses: pnpm/action-setup@v4\n with:\n version: 10\n\n - name: Setup Node.js\n uses: actions/setup-node@v4\n with:\n node-version: 20\n\n - name: Install Dependencies\n run: |\n pnpm install --frozen-lockfile\n pnpm approve-builds --all\n\n - name: Build Packages\n run: pnpm run build\n\n - name: Detect and Integrate SDD Change\n id: integrate\n env:\n PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}\n PR_TITLE: ${{ github.event.pull_request.title }}\n PR_BODY: ${{ github.event.pull_request.body }}\n MANUAL_CHANGE_ID: ${{ github.event.inputs.change_id }}\n run: |\n npx @aisdlc/cli sdd integrate --auto || true\n\n - name: Commit and Push Canonical Baseline Changes\n run: |\n git config user.name "github-actions[bot]"\n git config user.email "github-actions[bot]@users.noreply.github.com"\n git add -A\n if ! git diff --cached --quiet; then\n git commit -m "chore(sdd): integrate changes into canonical baseline [skip ci]"\n TARGET_BRANCH="${{ github.event.pull_request.base.ref || github.ref_name }}"\n MAX_RETRIES=3\n RETRY_COUNT=0\n DELAY=2\n\n while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do\n echo "Synchronizing with remote branch $TARGET_BRANCH (pull --rebase)..."\n git pull --rebase origin "$TARGET_BRANCH"\n if git push origin "$TARGET_BRANCH"; then\n echo "\u2714 Canonical integration committed and synchronized to repository."\n exit 0\n fi\n RETRY_COUNT=$((RETRY_COUNT + 1))\n if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then\n echo "\u26A0 Push rejected (concurrency detected). Retrying in ${DELAY}s (attempt $RETRY_COUNT/$MAX_RETRIES)..."\n sleep $DELAY\n DELAY=$((DELAY * 2))\n fi\n done\n\n echo "\u274C Error: Failed to push canonical integration after $MAX_RETRIES attempts."\n exit 1\n else\n echo "\u2139 No pending changes generated in working tree."\n fi\n';
14752
+ var STARTER_TEMPLATES_CI_GITHUB_WORKFLOWS_SDD_INTEGRATE_ON_MERGE_YML = 'name: SDD Canonical Integration on Merge\r\n\r\non:\r\n pull_request:\r\n types: [closed]\r\n branches:\r\n - main\r\n - \'release/**\'\r\n workflow_dispatch:\r\n inputs:\r\n change_id:\r\n description: \'SDD change ID to integrate manually (e.g. chg-001-telemetry)\'\r\n required: false\r\n type: string\r\n\r\npermissions:\r\n contents: write\r\n pull-requests: read\r\n\r\nconcurrency:\r\n group: sdd-integrate-${{ github.event.pull_request.base.ref || github.ref_name }}\r\n cancel-in-progress: false\r\n\r\njobs:\r\n integrate-sdd:\r\n name: SDD Canonical Integration\r\n if: github.event.pull_request.merged == true || github.event_name == \'workflow_dispatch\'\r\n runs-on: ubuntu-latest\r\n\r\n steps:\r\n - name: Checkout Repository\r\n uses: actions/checkout@v4\r\n with:\r\n ref: ${{ github.event.pull_request.base.ref || github.ref_name }}\r\n fetch-depth: 0\r\n token: ${{ secrets.GITHUB_TOKEN }}\r\n\r\n - name: Install pnpm\r\n uses: pnpm/action-setup@v4\r\n with:\r\n version: 10\r\n\r\n - name: Setup Node.js\r\n uses: actions/setup-node@v4\r\n with:\r\n node-version: 20\r\n\r\n - name: Install Dependencies\r\n run: |\r\n pnpm install --frozen-lockfile\r\n pnpm approve-builds --all\r\n\r\n - name: Build Packages\r\n run: pnpm run build\r\n\r\n - name: Detect and Integrate SDD Change\r\n id: integrate\r\n env:\r\n PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}\r\n PR_TITLE: ${{ github.event.pull_request.title }}\r\n PR_BODY: ${{ github.event.pull_request.body }}\r\n MANUAL_CHANGE_ID: ${{ github.event.inputs.change_id }}\r\n run: |\r\n npx @aisdlc/cli sdd integrate --auto || true\r\n\r\n - name: Commit and Push Canonical Baseline Changes\r\n run: |\r\n git config user.name "github-actions[bot]"\r\n git config user.email "github-actions[bot]@users.noreply.github.com"\r\n git add -A\r\n if ! git diff --cached --quiet; then\r\n git commit -m "chore(sdd): integrate changes into canonical baseline [skip ci]"\r\n TARGET_BRANCH="${{ github.event.pull_request.base.ref || github.ref_name }}"\r\n MAX_RETRIES=3\r\n RETRY_COUNT=0\r\n DELAY=2\r\n\r\n while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do\r\n echo "Synchronizing with remote branch $TARGET_BRANCH (pull --rebase)..."\r\n git pull --rebase origin "$TARGET_BRANCH"\r\n if git push origin "$TARGET_BRANCH"; then\r\n echo "\u2714 Canonical integration committed and synchronized to repository."\r\n exit 0\r\n fi\r\n RETRY_COUNT=$((RETRY_COUNT + 1))\r\n if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then\r\n echo "\u26A0 Push rejected (concurrency detected). Retrying in ${DELAY}s (attempt $RETRY_COUNT/$MAX_RETRIES)..."\r\n sleep $DELAY\r\n DELAY=$((DELAY * 2))\r\n fi\r\n done\r\n\r\n echo "\u274C Error: Failed to push canonical integration after $MAX_RETRIES attempts."\r\n exit 1\r\n else\r\n echo "\u2139 No pending changes generated in working tree."\r\n fi\r\n';
14140
14753
  var STARTER_TEMPLATES_COMPLIANCE_COMMERCIAL_ACQUISITION_REQUEST_TEMPLATE_MD = '---\r\nid: REQ-LIC-ACQUISITION-001\r\ntype: license-acquisition-request\r\ntitle: Commercial License Acquisition Request for [Library]\r\nstatus: pending-approval # pending-approval, approved, rejected\r\nrequested-package: "@vendor/commercial-package"\r\nspdx-license: "BSL-1.1" # or Commercial, SSPL-1.0\r\nlicense-category: commercial_acquisition_required\r\nestimated-cost: "$1,200 / year"\r\nbusiness-justification: "Accelerates critical telemetry module development avoiding 4 months of in-house implementation."\r\n---\r\n\r\n# Commercial License Acquisition Request\r\n\r\n## 1. Package and Vendor\r\n- **Package**: `@vendor/commercial-package`\r\n- **Version**: `2.4.0`\r\n- **License Type**: BSL 1.1 / Commercial\r\n- **Official Website**: `https://vendor.example.com`\r\n\r\n## 2. Technical Justification and Evaluated Alternatives\r\n- **Why a permissive alternative (MIT/Apache 2.0) is not used**:\r\n - Open-source alternatives lack required hardware encryption protocol support.\r\n- **Impact of not acquiring the license**:\r\n - 4-month delay on product delivery milestone.\r\n\r\n## 3. Human Authorization Signatures\r\n- [ ] Tech Lead: Technical approval\r\n- [ ] Legal / IP Counsel: EULA clauses validation\r\n- [ ] Procurement / Budget Owner: Payment authorization\r\n';
14141
- var STARTER_TEMPLATES_MANUALS_PRODUCTION_MANUAL_TEMPLATE_MD = '---\r\nid: MAN-PROD-001\r\ntype: production-manual\r\ntitle: "Production & Operations Manual: Application Name"\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\napplies-to-version: "v1.0.0"\r\ntarget-audience:\r\n - devops-engineer\r\n - sre-engineer\r\n - release-manager\r\n - secops\r\ncomponents-covered:\r\n - CMP-NAME-001\r\nenclaves-involved:\r\n - SEC-ENC-DMZ-001\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# MAN-PROD-001: Production & Operations Manual - Application Name\r\n\r\n## 1. Deterministic Release Regeneration (Reproducible Builds)\r\n\r\nThis section contains the specifications and directives required to deterministically reproduce identical bit-by-bit application artifacts or releases from their Git tag.\r\n\r\n### 1.1 Source Code Baseline\r\n\r\n- **Canonical Repository**: `https://github.com/organization/repo-name.git`\r\n- **Immutable Git Release Tag**: `v1.0.0`\r\n- **Commit SHA-256 / SHA-1**: `[VERIFIED_HEXADECIMAL_COMMIT_SHA]`\r\n- **Clean Checkout Command**:\r\n ```bash\r\n git clone --recurse-submodules https://github.com/organization/repo-name.git\r\n cd repo-name\r\n git checkout tags/v1.0.0\r\n git submodule update --init --recursive\r\n ```\r\n\r\n### 1.2 Frozen Toolchains and Build Tool Matrix\r\n\r\nTo prevent discrepancies in binary or package generation, strict usage of pinned versions of the following utilities is enforced:\r\n\r\n| Tool / Runtime | Exact Version | Toolchain Checksum / Digest | Purpose |\r\n| :--- | :--- | :--- | :--- |\r\n| **Node.js LTS** | `v22.12.0` | `sha256:node-v22.12.0-linux-x64.tar.xz` | Execution and transpilation runtime |\r\n| **pnpm** | `9.15.0` | `sha256:pnpm-v9.15.0` | Deterministic monorepo package manager |\r\n| **TypeScript (tsc)** | `5.7.2` | Pinned in `devDependencies` | Strict ECMAScript compiler |\r\n| **Docker BuildKit** | `v0.18.0` | `moby/buildkit:v0.18.0` | Hermetic OCI packaging engine |\r\n\r\n### 1.3 Libraries, Dependencies, and Vertex Graph\r\n\r\n- **Immutable Lockfile**: `pnpm-lock.yaml` (or `Cargo.lock`, `go.sum`, `requirements.lock`). Installations with open resolution are forbidden (`pnpm install --frozen-lockfile` mandatory).\r\n- **SBOM (Software Bill of Materials) Inventory**:\r\n - Format: CycloneDX JSON v1.5 / SPDX v2.3.\r\n - Compiled SBOM path: `reports/sbom-cyclonedx.json`.\r\n- **OSS License Governance**:\r\n - Binding policy: `license-policy.yaml`.\r\n - Library vertex pre-verification:\r\n ```bash\r\n pnpm verify:licenses\r\n ```\r\n\r\n### 1.4 Step-by-Step Deterministic Build Procedure\r\n\r\n1. **Step 1: Hermetic Dependency Installation**\r\n ```bash\r\n pnpm install --frozen-lockfile --ignore-scripts\r\n ```\r\n\r\n2. **Step 2: Integrity and Strict Type Checking**\r\n ```bash\r\n pnpm typecheck\r\n ```\r\n\r\n3. **Step 3: Artifact Compilation**\r\n ```bash\r\n export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)\r\n pnpm build\r\n ```\r\n\r\n4. **Step 4: Cryptographic Verification of Generated Artifact**\r\n ```bash\r\n sha256sum dist/app.bundle.js\r\n # Compare against the canonical checksum registered in official release:\r\n # Expected: [CANONICAL_SHA256_CHECKSUM]\r\n ```\r\n\r\n---\r\n\r\n## 2. Version, Infrastructure, and Migration Compatibility Matrix\r\n\r\nThis section defines technical interoperability boundaries between the release version and the deployment ecosystem, ensuring safe Zero-Downtime transitions.\r\n\r\n### 2.1 Platform and Execution Runtime Compatibility\r\n\r\n| Infrastructure Component | Approved Version Range | Recommended Version | Support Status |\r\n| :--- | :--- | :--- | :---: |\r\n| **Kubernetes Cluster (K8s)** | `>= 1.28` and `<= 1.31` | `1.30.2` | \u2705 Certified |\r\n| **Container Runtime (CRI)** | containerd `>= 1.7` / CRI-O `>= 1.28` | containerd `1.7.15` | \u2705 Certified |\r\n| **Base Operating System (Host)** | Ubuntu 22.04 LTS / RHEL 9.2+ | Ubuntu 22.04 LTS (Kernel 6.x) | \u2705 Homologated |\r\n| **Language Runtime (Production)** | Node.js `>= 20.x` and `<= 22.x` | `v22.12.0 LTS` | \u2705 Hermetic |\r\n\r\n### 2.2 Data Schema and Migration Compatibility (N-1 Support)\r\n\r\nTo enable Canary or Blue-Green continuous deployments without transaction loss:\r\n\r\n| Release Version | DB Schema Version | Compatible with $N-1$ Code | Schema Migration Status |\r\n| :---: | :---: | :---: | :--- |\r\n| **`v1.0.0`** (Current) | `SCHEMA-v1.0` | \u2705 Yes (supports `v0.9.x` code) | Non-destructive additive migration (no column renaming). |\r\n| **`v0.9.x`** | `SCHEMA-v0.9` | \u2705 Previous baseline | Fully compatible during Canary drain period. |\r\n\r\n### 2.3 Interoperability Between Architecture Components (`CMP-*`)\r\n\r\n| Dependent Component | Consumed Component | Minimum Compatible Versions | Binding Protocol / Contract |\r\n| :--- | :--- | :---: | :--- |\r\n| `CMP-NAME-001` (Gateway) | `CMP-NAME-002` (Backend) | `>= v1.0.0` | gRPC / Protobuf v3 (`contract_spec.proto`) |\r\n| `CMP-NAME-001` (Gateway) | Messaging Bus / Kafka | `>= 3.5.0` | Kafka v2 Protocol with TLS mTLS |\r\n\r\n### 2.4 Homologated Upgrade & Rollback Paths\r\n\r\n| Source Version | Direct Jump to `v1.0.0` | Intermediate Migration Required | Direct Rollback Procedure |\r\n| :---: | :---: | :---: | :---: |\r\n| **`v0.9.1`** | \u2705 Allowed | \u274C Not required | `kubectl rollout undo` without data loss. |\r\n| **`v0.9.0`** | \u2705 Allowed | \u274C Not required | `kubectl rollout undo` without data loss. |\r\n| **`< v0.9.0`** | \u274C Blocked | \u2705 Must upgrade to `v0.9.1` first | Requires restore from backup snapshot. |\r\n\r\n---\r\n\r\n## 3. CI/CD Architecture and Pipelines\r\n\r\n### 3.1 Hierarchical Branching Model and Integration Triggers\r\n\r\nFollowing the AI-SDLC 4-tier standard:\r\n\r\n```text\r\nTIER 1: main (Production)\r\n \u25B2\r\n \u2514\u2500\u2500 PR Release Gate (Manual Tech Lead / Release Manager Approval)\r\n \u2502\r\nTIER 2: release/v1.0.0 (Open Version Branch)\r\n \u25B2\r\n \u2514\u2500\u2500 PR Feature Gate (Lint + Tests + Quality Gate + SAST + SBOM)\r\n \u2502\r\nTIER 3: feat/CHG-001-* (Feature / Bug)\r\n```\r\n\r\n- **Pull Request Trigger**: Executes linters, full test battery, and governance verifications without deployment.\r\n- **Release Tag Trigger (`v*.*.*`)**: Executes the full hermetic build pipeline, image signing, and continuous deployment.\r\n\r\n### 3.2 CI/CD Pipeline Flowchart\r\n\r\n```mermaid\r\nflowchart LR\r\n A["Git Push / Tag v1.0.0"] --> B["Hermetic Checkout"]\r\n B --> C["Linters & Typecheck"]\r\n C --> D["Vitest: Unit & BDD"]\r\n D --> E["Quality Gate: CC & MI"]\r\n E --> F["SAST & Secret Scan"]\r\n F --> G["SBOM & License Gate"]\r\n G --> H["Deterministic Build"]\r\n H --> I["Cosign / SLSA Signing"]\r\n I --> J["Push to OCI Registry"]\r\n J --> K["Deploy to DMZ Enclave"]\r\n```\r\n\r\n### 3.3 Release Gate Contracts and Thresholds\r\n\r\n| Quality Gate | Tool / Command | Required Threshold | Action on Non-Compliance |\r\n| :--- | :--- | :--- | :--- |\r\n| **Lint & Typecheck** | `pnpm typecheck` | Zero errors, zero `any` | **Immediate failure** |\r\n| **Automated Tests** | `pnpm test:all` | 100% passed, Coverage >= 85% | **Immediate failure** |\r\n| **Cyclomatic Complexity** | `aisdlc verify quality` | CC <= 10 per function | **Release blocked** |\r\n| **Maintainability Index** | `aisdlc verify quality` | MI >= 50.0 / 100 | **Release blocked** |\r\n| **360\xB0 Traceability** | `aisdlc verify traceability` | 100% of requirements linked | **Release blocked** |\r\n| **OSS Licenses** | `aisdlc verify licenses` | Zero forbidden/viral licenses | **Release blocked** |\r\n| **Cryptographic Signature** | `cosign verify` | Valid signature from Corporate CA | **Deployment rejected** |\r\n\r\n---\r\n\r\n## 4. Production Deployment Strategy and Procedure\r\n\r\n### 4.1 Infrastructure Prerequisites and Network Enclaves\r\n\r\n- **Target Enclave**: `SEC-ENC-DMZ-001` (Strict segmentation without direct uncontrolled outbound internet access).\r\n- **Enabled Network Ports**:\r\n - Port `8443/TCP`: Secure WebSocket ingestion with mutual TLS (mTLS) authentication.\r\n - Port `9090/TCP`: Prometheus metrics (internal management network only).\r\n- **Secrets and Certificate Management**:\r\n - Server TLS and client root CA certificates mounted via immutable secret at `/etc/pki/tls/`.\r\n - Embedding cryptographic keys in environment variables or images is strictly forbidden.\r\n\r\n### 4.2 Rollout Strategy\r\n\r\nA **Canary strategy with progressive telemetry metrics analysis** is utilized:\r\n1. 10% of traffic is routed to the new version for 15 minutes.\r\n2. If the 5xx error rate is `<= 0.01%` and p99 latency is `<= 50ms`, traffic is promoted to 100%.\r\n\r\n### 4.3 Step-by-Step Deployment Procedure\r\n\r\n1. **Step 1: Pre-deployment and State Snapshot**\r\n ```bash\r\n # Check cluster health and record baseline\r\n kubectl get pods -n production -l app=system\r\n kubectl exec -it system-db-0 -- /backup/create-snapshot.sh\r\n ```\r\n\r\n2. **Step 2: Deployment Manifest Application**\r\n ```bash\r\n kubectl apply -f deploy/production/canary-deployment.yaml\r\n kubectl rollout status deployment/system-service -n production --timeout=180s\r\n ```\r\n\r\n3. **Step 3: Health Verification and Smoke Tests**\r\n ```bash\r\n curl -f --cacert /etc/pki/tls/ca.crt https://127.0.0.1:8443/healthz\r\n curl -f --cacert /etc/pki/tls/ca.crt https://127.0.0.1:8443/readyz\r\n pnpm test:example\r\n ```\r\n\r\n### 4.4 Rollback Plan (Immediate Rollback)\r\n\r\n- **Objective Rollback Activation Criteria**:\r\n - mTLS handshake failure rate `> 1.0%`.\r\n - Ingestion p99 latency `> 100ms` for 2 continuous minutes.\r\n - Critical `CrashLoopBackOff` alert on more than 20% of instances.\r\n- **Rollback Execution Command**:\r\n ```bash\r\n kubectl rollout undo deployment/system-service -n production\r\n kubectl rollout status deployment/system-service -n production\r\n ```\r\n\r\n---\r\n\r\n## 5. Likely Errors Resolution and Troubleshooting (Runbooks)\r\n\r\nThis section documents the most frequent runtime and deployment failures along with diagnosis and immediate mitigation procedures.\r\n\r\n### 5.1 Frequent Incidents and Solutions Matrix\r\n\r\n#### Incident 1: Dependency Vertex Inconsistency or Drift (Build Failure)\r\n- **Symptom**: `pnpm install --frozen-lockfile` command fails in CI with error `ERR_PNPM_LOCKFILE_OUTDATED`.\r\n- **Root Cause**: `package.json` was modified without updating `pnpm-lock.yaml`.\r\n- **Diagnosis**:\r\n ```bash\r\n git diff HEAD^ package.json pnpm-lock.yaml\r\n ```\r\n- **Mitigation**:\r\n 1. On the feature branch, run `pnpm install` locally to regenerate the deterministic lockfile.\r\n 2. Verify no restricted-license dependencies were introduced via `pnpm verify:licenses`.\r\n 3. Commit both files together in an atomic commit.\r\n\r\n---\r\n\r\n#### Incident 2: mTLS Handshake Failure or Enclave Certificate Rejected\r\n- **Symptom**: Clients receive error `ERR_TLS_CERT_ALTNAME_INVALID` or connection closed with TLS alert `certificate_unknown (46)`.\r\n- **Root Cause**: Internal root CA mounted on server does not match the client certificate issuer CA, or certificate expired.\r\n- **Diagnosis**:\r\n ```bash\r\n openssl s_client -connect 127.0.0.1:8443 -CAfile /etc/pki/tls/ca.crt -cert /etc/pki/tls/client.crt -key /etc/pki/tls/client.key\r\n openssl x509 -in /etc/pki/tls/ca.crt -noout -dates -issuer -subject\r\n ```\r\n- **Mitigation**:\r\n 1. Verify expiration date of certificate mounted in cluster Secret.\r\n 2. If expired, rotate the certificate by injecting the new pair from HSM / Vault storage.\r\n 3. Orderly restart pods with `kubectl rollout restart deployment/system-service`.\r\n\r\n---\r\n\r\n#### Incident 3: Release Gate Rejection in CI/CD Due to Quality Metrics\r\n- **Symptom**: Pipeline aborts with verdict `Quality Gate REJECTED` (Cyclomatic Complexity > 10 or Maintainability < 50).\r\n- **Root Cause**: Introduction of complex nested logic (multiple `if/else`, extensive `switch`, or branching loops).\r\n- **Diagnosis**:\r\n ```bash\r\n pnpm verify:quality\r\n ```\r\n- **Mitigation**:\r\n 1. Inspect the violation report in `reports/QUALITY_GATE_REPORT.md` to identify the offending function.\r\n 2. Decompose function into cohesive private helper methods following the rule of maximum 40 lines per function.\r\n 3. Re-run `pnpm verify:quality` until green verdict is confirmed. Adding suppression comments (`// @ts-ignore`) is forbidden.\r\n\r\n---\r\n\r\n#### Incident 4: CrashLoopBackOff Due to Memory Leak or Connection Limit\r\n- **Symptom**: Pod is terminated with exit code `ExitCode: 137` (`OOMKilled`) after a load spike.\r\n- **Root Cause**: Undrained socket buffer accumulation during high-frequency bursts.\r\n- **Diagnosis**:\r\n ```bash\r\n kubectl describe pod system-service-xxx -n production | grep -i oom\r\n kubectl logs system-service-xxx -n production --previous\r\n ```\r\n- **Mitigation**:\r\n 1. Temporarily adjust memory limits in Kubernetes manifest (`resources.limits.memory`) if the load burst is legitimate.\r\n 2. Apply backpressure or discard expired packets in accordance with business rules (`BR-*`).\r\n 3. Run local benchmark with `pnpm test:all` to audit memory consumption.\r\n\r\n---\r\n\r\n### 5.2 Escalation Protocol and Critical Incident Management\r\n\r\n| Severity Level | Impact Criterion | Maximum Response Time | Roles Involved |\r\n| :--- | :--- | :---: | :--- |\r\n| **SEV-1 (Critical)** | Complete service outage or security breach in enclave. | 15 minutes | On-call SRE + Lead Architect + SecOps |\r\n| **SEV-2 (Major)** | Severe service degradation, massive retries without outage. | 1 hour | On-call SRE + Tech Lead |\r\n| **SEV-3 (Minor)** | Isolated node incident without global SLA impact. | 4 hours | Support Engineer / DevOps |\r\n\r\n---\r\n\r\n## 6. Revision History and Version Control\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | 2026-09-15 | Operations & DevOps Team | Initial Production Manual generation | CHG-009 |\r\n';
14754
+ var STARTER_TEMPLATES_MANUALS_PRODUCTION_MANUAL_TEMPLATE_MD = '---\r\nid: MAN-PROD-001\r\ntype: production-manual\r\ntitle: "Production & Operations Manual: Application Name"\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\napplies-to-version: "v1.0.0"\r\ntarget-audience:\r\n - devops-engineer\r\n - sre-engineer\r\n - release-manager\r\n - secops\r\ncomponents-covered:\r\n - CMP-NAME-001\r\nenclaves-involved:\r\n - SEC-ENC-DMZ-001\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# MAN-PROD-001: Production & Operations Manual - Application Name\r\n\r\n## 1. Deterministic Release Regeneration (Reproducible Builds)\r\n\r\nThis section contains the specifications and directives required to deterministically reproduce identical bit-by-bit application artifacts or releases from their Git tag.\r\n\r\n### 1.1 Source Code Baseline\r\n\r\n- **Canonical Repository**: `https://github.com/organization/repo-name.git`\r\n- **Immutable Git Release Tag**: `v1.0.0`\r\n- **Commit SHA-256 / SHA-1**: `[VERIFIED_HEXADECIMAL_COMMIT_SHA]`\r\n- **Clean Checkout Command**:\r\n ```bash\r\n git clone --recurse-submodules https://github.com/organization/repo-name.git\r\n cd repo-name\r\n git checkout tags/v1.0.0\r\n git submodule update --init --recursive\r\n ```\r\n\r\n### 1.2 Frozen Toolchains and Build Tool Matrix\r\n\r\nTo prevent discrepancies in binary or package generation, strict usage of pinned versions of the following utilities is enforced:\r\n\r\n| Tool / Runtime | Exact Version | Toolchain Checksum / Digest | Purpose |\r\n| :--- | :--- | :--- | :--- |\r\n| **Node.js LTS** | `v22.12.0` | `sha256:node-v22.12.0-linux-x64.tar.xz` | Execution and transpilation runtime |\r\n| **pnpm** | `9.15.0` | `sha256:pnpm-v9.15.0` | Deterministic monorepo package manager |\r\n| **TypeScript (tsc)** | `5.7.2` | Pinned in `devDependencies` | Strict ECMAScript compiler |\r\n| **Docker BuildKit** | `v0.18.0` | `moby/buildkit:v0.18.0` | Hermetic OCI packaging engine |\r\n\r\n### 1.3 Libraries, Dependencies, and Vertex Graph\r\n\r\n- **Immutable Lockfile**: `pnpm-lock.yaml` (or `Cargo.lock`, `go.sum`, `requirements.lock`). Installations with open resolution are forbidden (`pnpm install --frozen-lockfile` mandatory).\r\n- **SBOM (Software Bill of Materials) Inventory**:\r\n - Format: CycloneDX JSON v1.5 / SPDX v2.3.\r\n - Compiled SBOM path: `reports/sbom-cyclonedx.json`.\r\n- **OSS License Governance**:\r\n - Binding policy: `license-policy.yaml`.\r\n - Library vertex pre-verification:\r\n ```bash\r\n pnpm verify:licenses\r\n ```\r\n\r\n### 1.4 Step-by-Step Deterministic Build Procedure\r\n\r\n1. **Step 1: Hermetic Dependency Installation**\r\n ```bash\r\n pnpm install --frozen-lockfile --ignore-scripts\r\n ```\r\n\r\n2. **Step 2: Integrity and Strict Type Checking**\r\n ```bash\r\n pnpm typecheck\r\n ```\r\n\r\n3. **Step 3: Artifact Compilation**\r\n ```bash\r\n export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)\r\n pnpm build\r\n ```\r\n\r\n4. **Step 4: Cryptographic Verification of Generated Artifact**\r\n ```bash\r\n sha256sum dist/app.bundle.js\r\n # Compare against the canonical checksum registered in official release:\r\n # Expected: [CANONICAL_SHA256_CHECKSUM]\r\n ```\r\n\r\n\n\n5. **Step 5: Sigstore / Cosign Signature and SLSA Provenance Verification**\n ```bash\n # Verify npm package provenance from registry\n npm audit signatures\n\n # Verify package tarball with Sigstore / Cosign (Keyless via OIDC identity)\n cosign verify-blob \\\n --bundle release-artifacts/package.tgz.bundle \\\n --certificate-identity-regexp "^https://github.com/organization/repo-name/.*$" \\\n --certificate-oidc-issuer "https://token.actions.githubusercontent.com" \\\n release-artifacts/package.tgz\n\n # Verify SLSA Build Provenance Attestation using GitHub CLI\n gh attestation verify release-artifacts/package.tgz --repo organization/repo-name\n ```\n\n---\r\n\r\n## 2. Version, Infrastructure, and Migration Compatibility Matrix\r\n\r\nThis section defines technical interoperability boundaries between the release version and the deployment ecosystem, ensuring safe Zero-Downtime transitions.\r\n\r\n### 2.1 Platform and Execution Runtime Compatibility\r\n\r\n| Infrastructure Component | Approved Version Range | Recommended Version | Support Status |\r\n| :--- | :--- | :--- | :---: |\r\n| **Kubernetes Cluster (K8s)** | `>= 1.28` and `<= 1.31` | `1.30.2` | \u2705 Certified |\r\n| **Container Runtime (CRI)** | containerd `>= 1.7` / CRI-O `>= 1.28` | containerd `1.7.15` | \u2705 Certified |\r\n| **Base Operating System (Host)** | Ubuntu 22.04 LTS / RHEL 9.2+ | Ubuntu 22.04 LTS (Kernel 6.x) | \u2705 Homologated |\r\n| **Language Runtime (Production)** | Node.js `>= 20.x` and `<= 22.x` | `v22.12.0 LTS` | \u2705 Hermetic |\r\n\r\n### 2.2 Data Schema and Migration Compatibility (N-1 Support)\r\n\r\nTo enable Canary or Blue-Green continuous deployments without transaction loss:\r\n\r\n| Release Version | DB Schema Version | Compatible with $N-1$ Code | Schema Migration Status |\r\n| :---: | :---: | :---: | :--- |\r\n| **`v1.0.0`** (Current) | `SCHEMA-v1.0` | \u2705 Yes (supports `v0.9.x` code) | Non-destructive additive migration (no column renaming). |\r\n| **`v0.9.x`** | `SCHEMA-v0.9` | \u2705 Previous baseline | Fully compatible during Canary drain period. |\r\n\r\n### 2.3 Interoperability Between Architecture Components (`CMP-*`)\r\n\r\n| Dependent Component | Consumed Component | Minimum Compatible Versions | Binding Protocol / Contract |\r\n| :--- | :--- | :---: | :--- |\r\n| `CMP-NAME-001` (Gateway) | `CMP-NAME-002` (Backend) | `>= v1.0.0` | gRPC / Protobuf v3 (`contract_spec.proto`) |\r\n| `CMP-NAME-001` (Gateway) | Messaging Bus / Kafka | `>= 3.5.0` | Kafka v2 Protocol with TLS mTLS |\r\n\r\n### 2.4 Homologated Upgrade & Rollback Paths\r\n\r\n| Source Version | Direct Jump to `v1.0.0` | Intermediate Migration Required | Direct Rollback Procedure |\r\n| :---: | :---: | :---: | :---: |\r\n| **`v0.9.1`** | \u2705 Allowed | \u274C Not required | `kubectl rollout undo` without data loss. |\r\n| **`v0.9.0`** | \u2705 Allowed | \u274C Not required | `kubectl rollout undo` without data loss. |\r\n| **`< v0.9.0`** | \u274C Blocked | \u2705 Must upgrade to `v0.9.1` first | Requires restore from backup snapshot. |\r\n\r\n---\r\n\r\n## 3. CI/CD Architecture and Pipelines\r\n\r\n### 3.1 Hierarchical Branching Model and Integration Triggers\r\n\r\nFollowing the AI-SDLC 4-tier standard:\r\n\r\n```text\r\nTIER 1: main (Production)\r\n \u25B2\r\n \u2514\u2500\u2500 PR Release Gate (Manual Tech Lead / Release Manager Approval)\r\n \u2502\r\nTIER 2: release/v1.0.0 (Open Version Branch)\r\n \u25B2\r\n \u2514\u2500\u2500 PR Feature Gate (Lint + Tests + Quality Gate + SAST + SBOM)\r\n \u2502\r\nTIER 3: feat/CHG-001-* (Feature / Bug)\r\n```\r\n\r\n- **Pull Request Trigger**: Executes linters, full test battery, and governance verifications without deployment.\r\n- **Release Tag Trigger (`v*.*.*`)**: Executes the full hermetic build pipeline, image signing, and continuous deployment.\r\n\r\n### 3.2 CI/CD Pipeline Flowchart\r\n\r\n```mermaid\r\nflowchart LR\r\n A["Git Push / Tag v1.0.0"] --> B["Hermetic Checkout"]\r\n B --> C["Linters & Typecheck"]\r\n C --> D["Vitest: Unit & BDD"]\r\n D --> E["Quality Gate: CC & MI"]\r\n E --> F["SAST & Secret Scan"]\r\n F --> G["SBOM & License Gate"]\r\n G --> H["Deterministic Build"]\r\n H --> I["Cosign / SLSA Signing"]\r\n I --> J["Push to OCI Registry"]\r\n J --> K["Deploy to DMZ Enclave"]\r\n```\r\n\r\n### 3.3 Release Gate Contracts and Thresholds\r\n\r\n| Quality Gate | Tool / Command | Required Threshold | Action on Non-Compliance |\r\n| :--- | :--- | :--- | :--- |\r\n| **Lint & Typecheck** | `pnpm typecheck` | Zero errors, zero `any` | **Immediate failure** |\r\n| **Automated Tests** | `pnpm test:all` | 100% passed, Coverage >= 85% | **Immediate failure** |\r\n| **Cyclomatic Complexity** | `aisdlc verify quality` | CC <= 10 per function | **Release blocked** |\r\n| **Maintainability Index** | `aisdlc verify quality` | MI >= 50.0 / 100 | **Release blocked** |\r\n| **360\xB0 Traceability** | `aisdlc verify traceability` | 100% of requirements linked | **Release blocked** |\r\n| **OSS Licenses** | `aisdlc verify licenses` | Zero forbidden/viral licenses | **Release blocked** |\r\n| **Cryptographic Signature & SLSA** | `cosign verify-blob` / `gh attestation verify` | Valid signature and SLSA provenance from GitHub Actions OIDC | **Deployment rejected** |\r\n\r\n---\r\n\r\n## 4. Production Deployment Strategy and Procedure\r\n\r\n### 4.1 Infrastructure Prerequisites and Network Enclaves\r\n\r\n- **Target Enclave**: `SEC-ENC-DMZ-001` (Strict segmentation without direct uncontrolled outbound internet access).\r\n- **Enabled Network Ports**:\r\n - Port `8443/TCP`: Secure WebSocket ingestion with mutual TLS (mTLS) authentication.\r\n - Port `9090/TCP`: Prometheus metrics (internal management network only).\r\n- **Secrets and Certificate Management**:\r\n - Server TLS and client root CA certificates mounted via immutable secret at `/etc/pki/tls/`.\r\n - Embedding cryptographic keys in environment variables or images is strictly forbidden.\r\n\r\n### 4.2 Rollout Strategy\r\n\r\nA **Canary strategy with progressive telemetry metrics analysis** is utilized:\r\n1. 10% of traffic is routed to the new version for 15 minutes.\r\n2. If the 5xx error rate is `<= 0.01%` and p99 latency is `<= 50ms`, traffic is promoted to 100%.\r\n\r\n### 4.3 Step-by-Step Deployment Procedure\r\n\r\n1. **Step 1: Pre-deployment and State Snapshot**\r\n ```bash\r\n # Check cluster health and record baseline\r\n kubectl get pods -n production -l app=system\r\n kubectl exec -it system-db-0 -- /backup/create-snapshot.sh\r\n ```\r\n\r\n2. **Step 2: Deployment Manifest Application**\r\n ```bash\r\n kubectl apply -f deploy/production/canary-deployment.yaml\r\n kubectl rollout status deployment/system-service -n production --timeout=180s\r\n ```\r\n\r\n3. **Step 3: Health Verification and Smoke Tests**\r\n ```bash\r\n curl -f --cacert /etc/pki/tls/ca.crt https://127.0.0.1:8443/healthz\r\n curl -f --cacert /etc/pki/tls/ca.crt https://127.0.0.1:8443/readyz\r\n pnpm test:example\r\n ```\r\n\r\n### 4.4 Rollback Plan (Immediate Rollback)\r\n\r\n- **Objective Rollback Activation Criteria**:\r\n - mTLS handshake failure rate `> 1.0%`.\r\n - Ingestion p99 latency `> 100ms` for 2 continuous minutes.\r\n - Critical `CrashLoopBackOff` alert on more than 20% of instances.\r\n- **Rollback Execution Command**:\r\n ```bash\r\n kubectl rollout undo deployment/system-service -n production\r\n kubectl rollout status deployment/system-service -n production\r\n ```\r\n\r\n---\r\n\r\n## 5. Likely Errors Resolution and Troubleshooting (Runbooks)\r\n\r\nThis section documents the most frequent runtime and deployment failures along with diagnosis and immediate mitigation procedures.\r\n\r\n### 5.1 Frequent Incidents and Solutions Matrix\r\n\r\n#### Incident 1: Dependency Vertex Inconsistency or Drift (Build Failure)\r\n- **Symptom**: `pnpm install --frozen-lockfile` command fails in CI with error `ERR_PNPM_LOCKFILE_OUTDATED`.\r\n- **Root Cause**: `package.json` was modified without updating `pnpm-lock.yaml`.\r\n- **Diagnosis**:\r\n ```bash\r\n git diff HEAD^ package.json pnpm-lock.yaml\r\n ```\r\n- **Mitigation**:\r\n 1. On the feature branch, run `pnpm install` locally to regenerate the deterministic lockfile.\r\n 2. Verify no restricted-license dependencies were introduced via `pnpm verify:licenses`.\r\n 3. Commit both files together in an atomic commit.\r\n\r\n---\r\n\r\n#### Incident 2: mTLS Handshake Failure or Enclave Certificate Rejected\r\n- **Symptom**: Clients receive error `ERR_TLS_CERT_ALTNAME_INVALID` or connection closed with TLS alert `certificate_unknown (46)`.\r\n- **Root Cause**: Internal root CA mounted on server does not match the client certificate issuer CA, or certificate expired.\r\n- **Diagnosis**:\r\n ```bash\r\n openssl s_client -connect 127.0.0.1:8443 -CAfile /etc/pki/tls/ca.crt -cert /etc/pki/tls/client.crt -key /etc/pki/tls/client.key\r\n openssl x509 -in /etc/pki/tls/ca.crt -noout -dates -issuer -subject\r\n ```\r\n- **Mitigation**:\r\n 1. Verify expiration date of certificate mounted in cluster Secret.\r\n 2. If expired, rotate the certificate by injecting the new pair from HSM / Vault storage.\r\n 3. Orderly restart pods with `kubectl rollout restart deployment/system-service`.\r\n\r\n---\r\n\r\n#### Incident 3: Release Gate Rejection in CI/CD Due to Quality Metrics\r\n- **Symptom**: Pipeline aborts with verdict `Quality Gate REJECTED` (Cyclomatic Complexity > 10 or Maintainability < 50).\r\n- **Root Cause**: Introduction of complex nested logic (multiple `if/else`, extensive `switch`, or branching loops).\r\n- **Diagnosis**:\r\n ```bash\r\n pnpm verify:quality\r\n ```\r\n- **Mitigation**:\r\n 1. Inspect the violation report in `reports/QUALITY_GATE_REPORT.md` to identify the offending function.\r\n 2. Decompose function into cohesive private helper methods following the rule of maximum 40 lines per function.\r\n 3. Re-run `pnpm verify:quality` until green verdict is confirmed. Adding suppression comments (`// @ts-ignore`) is forbidden.\r\n\r\n---\r\n\r\n#### Incident 4: CrashLoopBackOff Due to Memory Leak or Connection Limit\r\n- **Symptom**: Pod is terminated with exit code `ExitCode: 137` (`OOMKilled`) after a load spike.\r\n- **Root Cause**: Undrained socket buffer accumulation during high-frequency bursts.\r\n- **Diagnosis**:\r\n ```bash\r\n kubectl describe pod system-service-xxx -n production | grep -i oom\r\n kubectl logs system-service-xxx -n production --previous\r\n ```\r\n- **Mitigation**:\r\n 1. Temporarily adjust memory limits in Kubernetes manifest (`resources.limits.memory`) if the load burst is legitimate.\r\n 2. Apply backpressure or discard expired packets in accordance with business rules (`BR-*`).\r\n 3. Run local benchmark with `pnpm test:all` to audit memory consumption.\r\n\r\n---\r\n\r\n### 5.2 Escalation Protocol and Critical Incident Management\r\n\r\n| Severity Level | Impact Criterion | Maximum Response Time | Roles Involved |\r\n| :--- | :--- | :---: | :--- |\r\n| **SEV-1 (Critical)** | Complete service outage or security breach in enclave. | 15 minutes | On-call SRE + Lead Architect + SecOps |\r\n| **SEV-2 (Major)** | Severe service degradation, massive retries without outage. | 1 hour | On-call SRE + Tech Lead |\r\n| **SEV-3 (Minor)** | Isolated node incident without global SLA impact. | 4 hours | Support Engineer / DevOps |\r\n\r\n---\r\n\r\n## 6. Revision History and Version Control\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | 2026-09-15 | Operations & DevOps Team | Initial Production Manual generation | CHG-009 |\r\n';
14142
14755
  var STARTER_TEMPLATES_MANUALS_USER_MANUAL_TEMPLATE_MD = '---\r\nid: MAN-USER-001\r\ntype: user-manual\r\ntitle: "User Manual: Application Name"\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\napplies-to-version: "v1.0.0"\r\ntarget-audience:\r\n - ACT-ROLE-USER-001\r\n - ACT-OPERATOR-002\r\nallowed-roles:\r\n - ACT-ROLE-USER-001\r\n - ACT-OPERATOR-002\r\njourneys-covered:\r\n - JRN-JOURNEY-001\r\nuse-cases-covered:\r\n - UC-ACTION-001\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# MAN-USER-001: User Manual - Application Name\r\n\r\n## 1. System Purpose and Audience\r\n\r\nConcisely describes the software\'s purpose, the operational value it delivers to end users, and the general context in which it operates.\r\n\r\n- **Application / System**: `[System Name or Bounded Context]`\r\n- **Software Version**: `v1.0.0`\r\n- **Target Audience**: `[Functional roles and user profiles addressed]`\r\n\r\n---\r\n\r\n## 2. User Role Catalog and Permissions Matrix (RBAC)\r\n\r\nThis section formally defines the roles authorized to access and operate the application, as well as the privileges assigned to each.\r\n\r\n### 2.1 Authorized Role Catalog\r\n\r\n| Role Identifier | Role Name | Associated Actor | Description & Responsibility | Enclave / Access Level |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **`ROLE_USER`** | Standard User | `ACT-ROLE-USER-001` | Data queries and nominal business flow execution. | Corporate Network / Web UI |\r\n| **`ROLE_OPERATOR`** | System Operator | `ACT-OPERATOR-002` | Streaming supervision, alert management, and command control. | DMZ Enclave / Operational Console |\r\n\r\n### 2.2 Access and Capabilities Matrix by Role\r\n\r\n| Application Capability / Module | `ROLE_USER` | `ROLE_OPERATOR` | Authentication Mode |\r\n| :--- | :---: | :---: | :--- |\r\n| Status Query and Dashboard Visualizations | \u2705 Allowed | \u2705 Allowed | Bearer Token (OIDC/JWT) |\r\n| Business Journey Execution (`JRN-JOURNEY-001`) | \u2705 Allowed | \u2705 Allowed | Bearer Token (OIDC/JWT) |\r\n| Real-Time Streaming and Operational Control | \u274C Denied | \u2705 Allowed | mTLS + Device X.509 Certificate |\r\n| Global Parameters Configuration & Connectivity | \u274C Denied | \u2705 Allowed | Administrator Credential |\r\n\r\n---\r\n\r\n## 3. Version and User Platform Compatibility Matrix\r\n\r\nThis section specifies cross-compatibility between the current application version and user environments, clients, and formats.\r\n\r\n### 3.1 Client-Server Compatibility (APIs and SDKs)\r\n\r\n| Application Version (Backend) | Compatible CLI Version | Compatible SDK Version | Compatibility Status | Migration Notes |\r\n| :---: | :---: | :---: | :---: | :--- |\r\n| **`v1.0.0`** (Current) | `>= v1.0.0` | `>= v1.0.0` | \u2705 Fully Supported | Active canonical version. |\r\n| **`v1.0.0`** (Current) | `v0.9.x` | `v0.9.x` | \u26A0\uFE0F Degraded Mode | Requires upgrade before next minor. |\r\n| **`v1.0.0`** (Current) | `< v0.9.0` | `< v0.9.0` | \u274C Incompatible / Deprecated | Legacy endpoints decommissioned. |\r\n\r\n### 3.2 Homologated Browsers and Client Platforms\r\n\r\n| Platform / Environment | Minimum Supported Versions | Support Level | Known Constraints |\r\n| :--- | :--- | :---: | :--- |\r\n| **Google Chrome / Chromium** | Version `>= 120` | Tier 1 (Official) | Optimal WebSockets and WebGL performance. |\r\n| **Mozilla Firefox** | Version `>= 115 ESR` | Tier 1 (Official) | Full client certificate support. |\r\n| **Safari / WebKit** | Version `>= 17.0` | Tier 2 (Functional) | Requires explicit mTLS enablement in macOS Keychain. |\r\n| **Terminal / CLI (Linux / macOS / Windows)** | Node.js `>= 18` or Bash `>= 5.0` | Tier 1 (Official) | Full support on PowerShell 7+ and bash. |\r\n\r\n### 3.3 Configuration Files and Data Formats Compatibility\r\n\r\n| Format / Artifact | Source Version Supported | Automatic Conversion | User Action Required |\r\n| :--- | :---: | :---: | :--- |\r\n| **`config.yaml`** | `v0.9.x` | \u2705 Yes | None. Application migrates deprecated keys on startup. |\r\n| **Export Profiles (`.json`)** | `v0.9.x` | \u2705 Yes | 100% backward compatible. |\r\n\r\n---\r\n\r\n## 4. Application Installation, Access, and Configuration\r\n\r\n### 4.1 Access Channels and Prerequisites\r\n\r\n- **Web Portal / UI**: Access URL (e.g., `https://app.system.internal`).\r\n- **Command Line (CLI)**: Executable binary or package (e.g., `npx system-cli` or `./system-client`).\r\n- **Supported Browsers or Platforms**: Chrome >= 120, Firefox >= 120, Linux/macOS/Windows terminal.\r\n\r\n### 4.2 Client Configuration and Environment Variables\r\n\r\nThe application allows parameterizing its behavior via environment variables or local configuration files:\r\n\r\n| Parameter / Variable | Type | Default Value | Required | Description |\r\n| :--- | :--- | :--- | :---: | :--- |\r\n| `API_ENDPOINT` | URL | `https://api.system.internal/v1` | Yes | Base backend API endpoint. |\r\n| `WS_STREAM_URL` | WSS URL | `wss://stream.system.internal/telemetry` | No | Real-time telemetry or notifications socket. |\r\n| `CLIENT_TIMEOUT_MS` | Integer | `5000` | No | Network response timeout in milliseconds. |\r\n| `AUTH_PROFILE` | String | `production` | No | Active authentication profile (`development`, `staging`, `production`). |\r\n\r\n### 4.3 Local Configuration File (`config.yaml` / `.env`)\r\n\r\nExample recommended configuration for operator workstations:\r\n\r\n```yaml\r\n# Client configuration file: config.yaml\r\nprofile: production\r\nnetwork:\r\n api_endpoint: "https://api.system.internal/v1"\r\n stream_url: "wss://stream.system.internal/telemetry"\r\n timeout_ms: 5000\r\n retry_attempts: 3\r\n\r\nsecurity:\r\n tls_verify: true\r\n client_cert_path: "/etc/pki/client/operator.crt"\r\n client_key_path: "/etc/pki/client/operator.key"\r\n\r\nui:\r\n theme: "dark"\r\n refresh_interval_sec: 1\r\n```\r\n\r\n---\r\n\r\n## 5. Step-by-Step Journey Execution Guide (`JRN-*`)\r\n\r\nEach subsection documents an end-to-end Journey, specifying authorized execution roles, starting conditions, and the step-by-step operating procedure.\r\n\r\n### 5.1 `JRN-JOURNEY-001`: User Journey Name\r\n\r\n- **Linked Use Case**: `UC-ACTION-001`\r\n- **Primary Actor**: `ACT-ROLE-USER-001`\r\n- **Authorized Roles**: `ROLE_USER`, `ROLE_OPERATOR`\r\n- **Required Execution Enclave**: Corporate Intranet or VPN access\r\n\r\n#### A. Preconditions\r\n1. User must have an active and authenticated session with their authorized role.\r\n2. The base entity or resource must be in `ACTIVE` state.\r\n\r\n#### B. Step-by-Step Procedure\r\n\r\n1. **Step 1: Operation Initiation**\r\n - **Action**: User navigates to the execution section or invokes the corresponding command:\r\n ```bash\r\n system-cli execute --journey JRN-JOURNEY-001 --input payload.json\r\n ```\r\n - **Required Input**: Resource identifier and validated parameters.\r\n - **Expected On-Screen Response**: System displays confirmation dialog with operation summary.\r\n\r\n2. **Step 2: Validation and Submission**\r\n - **Action**: User reviews parameters and confirms execution.\r\n - **System Behavior**: Client locally validates data schema and transmits signed request.\r\n\r\n3. **Step 3: Observable Outcome Verification**\r\n - **Success Outcome**: Console / interface displays success message `MSG-SUCCESS-001` with generated unique transaction ID.\r\n - **Final State**: Resource transitions to `PROCESSED` state.\r\n\r\n#### C. Alternative Flows and Exception Handling\r\n- **Unauthorized Access**: If an unauthorized role attempts to invoke the journey, the system blocks the action, outputs code `MSG-ERR-AUTH-403`, and records the access attempt in the audit trail.\r\n- **Connection Loss in Transit**: If connection is lost during step 2, client retries with exponential backoff up to 3 times before notifying user.\r\n\r\n---\r\n\r\n## 6. System Messages Catalog and Response Codes\r\n\r\nStructured matrix of key informational, warning, and error messages emitted by the application during its operational lifecycle:\r\n\r\n| Code | Severity | Literal Screen Message | Trigger / Context | Meaning for User | Recommended Corrective Action |\r\n| :--- | :--- | :--- | :--- | :--- | :--- |\r\n| **`MSG-SYS-100`** | `INFO` | `"Connection established successfully with server"` | Successful network handshake upon initializing session. | Application is online and ready to process commands. | None. Normal operation. |\r\n| **`MSG-SYS-200`** | `INFO` | `"Operation completed successfully. Transaction ID: [TX-ID]"` | Successful completion of a Journey or Use Case. | Transaction was persisted and acknowledged by backend. | Save `TX-ID` for tracking if required. |\r\n| **`MSG-WARN-301`** | `WARN` | `"High link latency (>500ms). Degraded mode active"` | Response metric exceeds real-time threshold. | Screen data may experience slight refresh delays. | Check network connection quality or bandwidth. |\r\n| **`MSG-WARN-302`** | `WARN` | `"Session expiring in 5 minutes"` | Authentication token approaching TTL expiry. | User will be logged out unless credential is refreshed. | Renew session by clicking alert or re-authenticating. |\r\n| **`MSG-ERR-401`** | `ERR-USER` | `"Invalid credentials or expired token. Access denied"` | Login authentication failure or expired token. | User identity could not be validated. | Re-enter credentials or request a new token. |\r\n| **`MSG-ERR-403`** | `ERR-USER` | `"Unauthorized action for assigned role [ROLE]"` | Attempted execution of Journey or command outside RBAC. | User role lacks permissions for this resource. | Contact administrator to request permission expansion. |\r\n| **`MSG-ERR-422`** | `ERR-USER` | `"Invalid payload: field [FIELD] does not match schema"` | Syntactic validation or business rule (`BR-*`) failure. | User-supplied data is invalid. | Correct indicated fields according to business rule. |\r\n| **`MSG-ERR-503`** | `ERR-SYS` | `"Service temporarily unavailable. Retrying..."` | Backend gateway unreachable or under scheduled maintenance. | Central server is not responding to requests. | Await automatic retries or check system status page. |\r\n\r\n---\r\n\r\n## 7. Frequently Asked Questions (FAQ) and Support\r\n\r\n- **What should I do if I lose connectivity while executing a Journey?** \r\n The application implements idempotency mechanisms. Once network connectivity is restored, verify resource status before retrying to prevent duplicate transactions.\r\n- **How do I request a user role change?** \r\n Contact the Security Administrator (`SecOps`) referencing your user ID and operational justification for the role change.\r\n\r\n---\r\n\r\n## 8. Revision History and Version Control\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | 2026-09-15 | Documentation & Product Team | Initial User Manual generation | CHG-009 |\r\n';
14143
14756
  var STARTER_TEMPLATES_PRIVACY_DATA_ASSET_TEMPLATE_MD = '---\r\nid: DATA-ASSET-USER-PROFILE-001\r\ntype: data-asset\r\ntitle: User Profile & Identity Personal Data Asset\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\nclassification: confidential-pii # public, internal, confidential-pii, special-category-sensitive\r\npii-categories:\r\n - identifiers\r\n - contact\r\ndata-subjects:\r\n - ACT-USER-001\r\nfields:\r\n - name: email\r\n sensitivity: pii\r\n masking-strategy: sha256-salt\r\n - name: phone_number\r\n sensitivity: pii\r\n masking-strategy: redact\r\n - name: operator_callsign\r\n sensitivity: internal\r\n masking-strategy: none\r\nretention-period: 365d\r\nerasure-method: crypto-shredding\r\nowner-bounded-context: CMP-IDENTITY-SERVICE-001\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# DATA-ASSET-USER-PROFILE-001: User Profile & Identity Personal Data Asset\r\n\r\n## 1. Data Asset Inventory & Purpose\r\nDescribes the structure, storage medium, and operational boundary of the personal data asset governed under GDPR / ISO 27701.\r\n\r\n## 2. Field-Level Sensitivity & Masking Policy\r\n\r\n| Field Name | Sensitivity | Masking / Pseudonymization Strategy | Allowed in Logs | Allowed in AI Prompts |\r\n| :--- | :--- | :--- | :---: | :---: |\r\n| `email` | `pii` | `sha256-salt` | \u274C No | \u274C No |\r\n| `phone_number` | `pii` | `redact` | \u274C No | \u274C No |\r\n| `operator_callsign` | `internal` | `none` | \u2705 Yes | \u2705 Yes |\r\n\r\n## 3. Storage Limitation & Right to Erasure (GDPR Art. 17)\r\n- **Maximum Retention TTL**: `365d` after account deactivation.\r\n- **Erasure Mechanism**: `crypto-shredding` (destruction of per-subject encryption key and PII column purge).\r\n\r\n---\r\n\r\n## 4. Revision History and Version Control\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | 2026-10-17 | Privacy Officer (`agent-privacy-officer`) | Initial personal data asset inventory | CHG-PRIV-001 |\r\n';
14144
14757
  var STARTER_TEMPLATES_PRIVACY_DPIA_REQUEST_TEMPLATE_MD = '---\r\nid: DPIA-ASSESSMENT-001\r\ntype: dpia-request\r\ntitle: Data Protection Impact Assessment (DPIA / EIPD) Request\r\nstatus: pending-dpo-approval # pending-dpo-approval, approved, rejected\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\nropa-reference: PRIV-ROPA-USER-AUTH-001\r\ndata-assets:\r\n - DATA-ASSET-USER-PROFILE-001\r\nspecial-category-triggers:\r\n - "GDPR Art. 9 Special Category Data or Automated Profiling"\r\nresidual-risk-level: MEDIUM # LOW, MEDIUM, HIGH\r\n---\r\n\r\n# Data Protection Impact Assessment (DPIA / EIPD \u2014 GDPR Art. 35)\r\n\r\n## 1. Trigger & Necessity Assessment\r\n- **Associated ROPA**: `PRIV-ROPA-USER-AUTH-001`\r\n- **Data Assets Affected**: `DATA-ASSET-USER-PROFILE-001`\r\n- **Why a DPIA is Mandatory**: Processing involves `special_category_sensitive` data (biometrics, health, precise geolocation) or systematic automated profiling under GDPR Art. 35.\r\n\r\n## 2. Necessity, Proportionality & LINDDUN Risk Matrix\r\n\r\n| LINDDUN Threat Category | Identified Privacy Risk | Intrinsic Risk | Technical Mitigation (`PRIV-REQ-*`) | Residual Risk |\r\n| :--- | :--- | :---: | :--- | :---: |\r\n| **Identifiability** | Re-identification of operator from telemetry streams | HIGH | `PRIV-REQ-MASKING-001` (SHA-256 salted pseudonymization) | LOW |\r\n| **Disclosure of Information** | Plaintext PII leakage in error logs | HIGH | `PRIV-REQ-MASKING-001` (Redaction middleware) | LOW |\r\n\r\n## 3. Mandatory Human Sovereign Signatures (DPO & Legal)\r\n- [ ] **Data Protection Officer (DPO)**: Necessity, proportionality, and GDPR Art. 35 validation\r\n- [ ] **Legal / Privacy Counsel**: Lawful basis and cross-border transfer clauses verified\r\n- [ ] **Security Officer (CISO) / System Architect**: Cryptographic and enclave controls verified\r\n';
14145
14758
  var STARTER_TEMPLATES_PRIVACY_PRIVACY_REQ_TEMPLATE_MD = '---\r\nid: PRIV-REQ-MASKING-001\r\ntype: privacy-requirement\r\ntitle: Mandatory Pseudonymization and Log Redaction of Operator PII\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\nprivacy-principle: data-minimization # data-minimization, purpose-limitation, storage-limitation, accuracy, integrity-and-confidentiality, transparency-and-consent, data-subject-rights-arco, pseudonymization-anonymization\r\nlinddun-category: identifiability # linkability, identifiability, non-repudiation, detectability, disclosure-of-information, unawareness, non-compliance\r\ngoverns-ropa:\r\n - PRIV-ROPA-USER-AUTH-001\r\nprotects-data-assets:\r\n - DATA-ASSET-USER-PROFILE-001\r\nenforced-in-enclave: SEC-ENC-DMZ-001\r\ncompliance-references:\r\n - "GDPR-Art-25-Privacy-by-Design"\r\n - "GDPR-Art-32-Pseudonymization"\r\n - "ISO-27701-A.7.4"\r\nacceptance-format: gherkin\r\ncucumber-tags:\r\n - "@PRIV-REQ-MASKING-001"\r\n - "@privacy"\r\n - "@linddun"\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# PRIV-REQ-MASKING-001: Mandatory Pseudonymization and Log Redaction of Operator PII\r\n\r\n## 1. Technical Privacy Control Statement\r\nThe system MUST pseudonymize or redact all `confidential-pii` fields (`email`, `phone_number`) prior to emitting structured application logs, telemetry traces, or external AI prompts, and MUST enforce automated TTL purge after `365d`.\r\n\r\n---\r\n\r\n## 2. Upstream Privacy Traceability (PDaC)\r\n\r\n| Dimension | Link / Artifact | Relationship Type | Status |\r\n| :--- | :--- | :--- | :--- |\r\n| **Record of Processing (ROPA)** | `PRIV-ROPA-USER-AUTH-001` | Governs Processing Activity | Validated |\r\n| **Protected Data Asset** | `DATA-ASSET-USER-PROFILE-001` | Enforces Field Masking & TTL | Validated |\r\n\r\n---\r\n\r\n## 3. Privacy Verification Criteria in Gherkin Format (Cucumber Privacy Tests)\r\n\r\n```gherkin\r\n@PRIV-REQ-MASKING-001 @privacy @linddun\r\nFeature: Personal Data Pseudonymization and Zero-PII Telemetry Logging\r\n As a Data Protection Officer (DPO)\r\n I want all personal identifiers to be redacted or salted-hashed before logging\r\n So that application logs and telemetry never expose raw personal data\r\n\r\n Scenario: Structured logger redacts PII fields automatically (Nominal Privacy Control)\r\n Given an authenticated operator session with email "operator@example.com" and phone "+34600112233"\r\n When the telemetry ingestion service emits an audit log entry\r\n Then the serialized log payload must not contain the literal string "operator@example.com"\r\n And the serialized log payload must not contain the literal string "+34600112233"\r\n And the email field must be replaced by a deterministic SHA-256 salted pseudonym\r\n\r\n Scenario: Right to erasure purges expired or revoked subject records\r\n Given a personal data record for subject "ACT-USER-001" exceeding the "365d" retention TTL\r\n When the automated retention enforcement job executes\r\n Then the personal data fields must be irreversibly erased via crypto-shredding\r\n```\r\n\r\n---\r\n\r\n## 4. Revision History and Version Control\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | 2026-10-17 | Privacy Officer (`agent-privacy-officer`) | Initial privacy control specification | CHG-PRIV-001 |\r\n';
14146
14759
  var STARTER_TEMPLATES_PRIVACY_PRIVACY_ROPA_TEMPLATE_MD = '---\r\nid: PRIV-ROPA-USER-AUTH-001\r\ntype: privacy-ropa\r\ntitle: Record of Processing Activity for Operator Authentication and Session Audit\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\nlawful-basis: contract # consent, contract, legal-obligation, vital-interests, public-task, legitimate-interests\r\nspecial-category-condition: null\r\nprocessing-purpose: "Authenticate authorized operators and maintain tamper-evident operational session audit trails."\r\nuse-cases:\r\n - UC-ACTION-001\r\ndata-assets:\r\n - DATA-ASSET-USER-PROFILE-001\r\ndata-subjects:\r\n - ACT-USER-001\r\nretention-ttl: 365d\r\ncross-border-transfer: false\r\ntransfer-safeguards: null\r\nsubprocessors: []\r\ndpia-required: false\r\ndpia-reference: null\r\nmitigated-by:\r\n - PRIV-REQ-MASKING-001\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# PRIV-ROPA-USER-AUTH-001: Record of Processing Activity (GDPR Art. 30)\r\n\r\n## 1. Processing Activity Summary & Lawful Basis\r\n- **Lawful Basis (GDPR Art. 6.1)**: `contract` \u2014 Necessary for the performance of the operator service agreement.\r\n- **Purpose of Processing**: Authenticate authorized operators and maintain tamper-evident operational session audit trails.\r\n\r\n## 2. Linked Product & Data Artifacts\r\n\r\n| Dimension | Artifact ID | Relationship |\r\n| :--- | :--- | :--- |\r\n| **Triggering Use Cases** | `UC-ACTION-001` | Initiates personal data collection/processing |\r\n| **Data Assets Processed** | `DATA-ASSET-USER-PROFILE-001` | Personal data fields subject to minimization |\r\n| **Data Subjects** | `ACT-USER-001` | Natural persons whose data is processed |\r\n| **Governing Privacy Controls** | `PRIV-REQ-MASKING-001` | Technical privacy-by-design controls |\r\n\r\n## 3. International Transfers & Subprocessors\r\n- **Cross-Border Transfer Outside EEA**: `false`\r\n- **Authorized Subprocessors**: None (In-house processing within `SEC-ENC-DMZ-001`).\r\n\r\n---\r\n\r\n## 4. Revision History and Version Control\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | 2026-10-17 | Privacy Officer (`agent-privacy-officer`) | Initial GDPR Art. 30 ROPA entry | CHG-PRIV-001 |\r\n';
14147
14760
  var STARTER_TEMPLATES_PRODUCT_ACTOR_TEMPLATE_MD = '---\r\nid: ACT-NAME-001\r\ntype: actor\r\ntitle: Descriptive Actor Title\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\nrole-type: human-user # human-user, ai-agent, external-system, sensor-iot\r\ndescription: One-sentence summary of the role this actor performs in the system.\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# ACT-NAME-001: Descriptive Actor Title\r\n\r\n## 1. Profile and Responsibility\r\nDescribes who this actor is, their operational context, and what goals they pursue when interacting with the product.\r\n\r\n## 2. System Touchpoints\r\n- Interaction channels (Web UI, REST API, WebSocket, Messaging).\r\n- Privilege level and latency/availability expectations.\r\n\r\n---\r\n\r\n## 3. Revision History and Version Control\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | 2026-09-03 | Product Owner / Analyst | Initial actor profile creation | CHG-INIT-001 |\r\n';
14761
+ var STARTER_TEMPLATES_PRODUCT_BOUNDED_CONTEXT_TEMPLATE_MD = '---\nid: BC-NAME-001\ntype: bounded-context\ntitle: "Bounded Context Name"\nstatus: draft\nversion: "1.0.0"\nschema-version: "1.0"\ndomain-type: core\nstrategic-classification:\n evolutionary-stage: custom-built\n business-model-role: differentiator\nresponsibilities:\n - "Primary domain capability or boundary responsibility"\nubiquitous-language-terms:\n - TERM-NAME-001\ncontext-mapping:\n upstream-dependencies: []\n downstream-dependents: []\n integration-patterns:\n - pattern: Open Host Service / Published Language\n related-context: BC-ANOTHER-001\ncomponents-involved:\n - CMP-NAME-001\nsupersedes: null\nsuperseded-by: null\n---\n\n# BC-NAME-001: Bounded Context Name\n\n## 1. Context Purpose and Scope\nExecutive summary and clear linguistic boundary defining what is inside vs. outside this Bounded Context according to Domain-Driven Design (DDD).\n\n### 1.1 Strategic Domain Classification\n- **Domain Type**: `core` (Core Domain / Supporting Subdomain / Generic Subdomain)\n- **Evolutionary Stage**: `custom-built` (Genesis / Custom-Built / Product / Commodity - Wardley Mapping)\n- **Business Role**: Key differentiator creating competitive advantage for the product.\n\n---\n\n## 2. Ubiquitous Language & Domain Invariants\n- **Core Entities & Aggregates**: High-level domain concepts encapsulated within this boundary.\n- **Glossary References**:\n - `TERM-NAME-001`: Primary ubiquitous term definition.\n- **Domain Invariants**: Critical business rules (`BR-*`) enforced exclusively within this boundary.\n\n---\n\n## 3. Context Mapping & Integration Relationships\nRelationships with adjacent Bounded Contexts:\n- **Upstream Contexts**: Contexts providing domain events, APIs, or contracts.\n- **Downstream Contexts**: Contexts consuming models from this boundary.\n- **Anti-Corruption Layers (ACL)**: Translations safeguarding ubiquitous language from external contamination.\n\n---\n\n## 4. Architecture Mapping\n- **Physical Components (`CMP-*`)**: Components implementing aggregates, services, or adapters within this context.\n- **Security Enclaves (`SEC-ENC-*`)**: Execution boundary or isolation tier.\n\n---\n\n## 5. Revision History\n\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\n| :--- | :--- | :--- | :--- | :--- |\n| **1.0.0** | YYYY-MM-DD | Product Analyst / Architect | Initial Bounded Context definition | CHG-INIT-001 |\n';
14148
14762
  var STARTER_TEMPLATES_PRODUCT_BUSINESS_RULE_TEMPLATE_MD = '---\r\nid: BR-DOMAIN-001\r\ntype: business-rule\r\ntitle: Business Rule Name\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\nenforcement-level: strict-invariant # strict-invariant, override-with-approval, guideline\r\ndefined-in: BC-CONTEXT-001\r\nuses-terms:\r\n - TERM-TERM-001\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# BR-DOMAIN-001: Business Rule Name\r\n\r\n## 1. Rule Definition\r\nFormally establishes the business invariant that must not be violated under any circumstance.\r\n\r\n## 2. Business Rationale and Consequences\r\n- **Why it exists**: Economic, regulatory, or technical justification for the constraint.\r\n- **Action upon violation**: Immediate transaction rejection with a formal error code.\r\n\r\n---\r\n\r\n## 3. Revision History and Version Control\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | 2026-09-03 | Product Owner / Analyst | Initial business rule definition | CHG-INIT-001 |\r\n';
14149
14763
  var STARTER_TEMPLATES_PRODUCT_JOURNEY_TEMPLATE_MD = '---\r\nid: JRN-NAME-001\r\ntype: journey\r\ntitle: Descriptive User or Operator Journey Title\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\npersona: ACT-OPERATOR-001\r\nstages:\r\n - "Discovery and Planning"\r\n - "Configuration and Pre-flight"\r\n - "Mission Execution"\r\n - "Post-Analysis and Wrap-up"\r\ntouchpoints:\r\n - "Mission planning web portal"\r\n - "Ground control station (GCS)"\r\n - "Real-time telemetry dashboard"\r\n - "Flight report exporter"\r\nrelated-use-cases:\r\n - UC-PLAN-MISSION-001\r\n - UC-MONITOR-FLIGHT-001\r\npain-points:\r\n - "Latency when loading offline navigation maps"\r\n - "Complexity in manual flight plan reconciliation"\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# JRN-NAME-001: Descriptive User or Operator Journey Title\r\n\r\n## 1. Actor / Primary Persona Profile\r\n- **Protagonist Actor**: `ACT-OPERATOR-001`\r\n- **Main Goal**: Complete operational workflow with high efficiency, safety, and real-time visibility.\r\n\r\n---\r\n\r\n## 2. Journey Stages Map\r\n\r\n| Stage | User Goal | Touchpoints | Frictions / Pain Points |\r\n| :--- | :--- | :--- | :--- |\r\n| **1. Discovery and Planning** | Design route and validate operational constraints | Mission planning web portal | Complexity in manual flight plan reconciliation |\r\n| **2. Configuration and Pre-flight** | Verify subsystem health and link integrity | Ground control station (GCS) | Latency when loading offline navigation maps |\r\n| **3. Mission Execution** | Supervise telemetry and respond to alerts | Real-time telemetry dashboard | None detected in nominal flow |\r\n| **4. Post-Analysis and Wrap-up** | Export mission logs and performance metrics | Flight report exporter | Telemetry consolidation latency |\r\n\r\n---\r\n\r\n## 3. Traceability to Use Cases and Product\r\n\r\n- `UC-PLAN-MISSION-001`: Planning and validation of safe corridors.\r\n- `UC-MONITOR-FLIGHT-001`: Ingestion and visualization of real-time telemetry.\r\n\r\n---\r\n\r\n## 4. Revision History\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | 2026-09-23 | Product Manager / UX Lead | Initial operator journey definition | CHG-INIT-001 |\r\n';
14150
14764
  var STARTER_TEMPLATES_PRODUCT_REQUIREMENT_TEMPLATE_MD = '---\r\n# Valid prefixes: FR- (Functional), QR- (Quality), CON- (Constraint)\r\nid: FR-FEATURE-001\r\ntype: requirement\r\ntitle: Concise Requirement Title\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\ncategory: functional # functional, quality, constraint\r\n\r\n# 1. PRODUCT TRACEABILITY (Upstream)\r\nderives-from:\r\n - UC-ACTION-001\r\n\r\n# 2. METHOD AND ACCEPTANCE CRITERIA\r\nverifiable-by: cucumber-bdd # cucumber-bdd, automated-unit-test, integration-test, performance-benchmark\r\nacceptance-format: gherkin # gherkin, declarative-prose\r\ncucumber-tags:\r\n - "@FR-FEATURE-001"\r\n - "@automated"\r\n - "@regression"\r\n\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# FR-FEATURE-001: Concise Requirement Title\r\n\r\n## 1. Normative Statement\r\nThe system MUST [unambiguous and atomic description of expected behavior under specific conditions].\r\n\r\n---\r\n\r\n## 2. Upstream Traceability\r\n\r\n| Dimension | Link / Artifact | Relationship Type | Status |\r\n| :--- | :--- | :--- | :--- |\r\n| **Product (Upstream)** | `UC-ACTION-001` | Derived from Use Case | Validated |\r\n\r\n> *Note: Traceability toward Architecture and Testing is maintained inversely; services declare `satisfies-requirements` and test suites tag or reference this requirement.*\r\n\r\n---\r\n\r\n## 3. Acceptance Criteria in Gherkin (Cucumber) Format\r\n\r\n```gherkin\r\n@FR-FEATURE-001 @automated @regression\r\nFeature: Concise Requirement Title\r\n As a [primary actor / user role]\r\n I want [functional system capability]\r\n So that [obtain expected business benefit or value]\r\n\r\n Background:\r\n Given the system is in operational state\r\n And the actor is authenticated with valid permissions\r\n\r\n Scenario: Successful nominal flow\r\n Given the system has initial precondition configured\r\n When the actor submits a request with valid parameters\r\n Then the system processes the operation successfully\r\n And the resource status updates to "ACTIVE"\r\n And the corresponding domain event is emitted\r\n\r\n Scenario Outline: Business rule validation and edge cases\r\n Given data input with value "<input>"\r\n When requirement validation is processed\r\n Then the response must return status code "<status_code>"\r\n And the descriptive message must be "<message>"\r\n\r\n Examples:\r\n | input | status_code | message |\r\n | correct_value | 200 | SUCCESSFUL_OPERATION |\r\n | invalid_value | 400 | ERROR_INVALID_PARAMETER |\r\n | limit_exceeded | 422 | ERROR_LIMIT_EXCEEDED |\r\n```\r\n\r\n---\r\n\r\n## 4. Revision History and Version Control\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | 2026-09-03 | Product Owner / QA | Initial specification with complete 360\xB0 traceability | CHG-INIT-001 |\r\n';
@@ -14215,6 +14829,7 @@ var STARTER_BASE_TEMPLATES = [
14215
14829
  { relPath: "templates/privacy/privacy-req.template.md", content: STARTER_TEMPLATES_PRIVACY_PRIVACY_REQ_TEMPLATE_MD },
14216
14830
  { relPath: "templates/privacy/privacy-ropa.template.md", content: STARTER_TEMPLATES_PRIVACY_PRIVACY_ROPA_TEMPLATE_MD },
14217
14831
  { relPath: "templates/product/actor.template.md", content: STARTER_TEMPLATES_PRODUCT_ACTOR_TEMPLATE_MD },
14832
+ { relPath: "templates/product/bounded-context.template.md", content: STARTER_TEMPLATES_PRODUCT_BOUNDED_CONTEXT_TEMPLATE_MD },
14218
14833
  { relPath: "templates/product/business-rule.template.md", content: STARTER_TEMPLATES_PRODUCT_BUSINESS_RULE_TEMPLATE_MD },
14219
14834
  { relPath: "templates/product/journey.template.md", content: STARTER_TEMPLATES_PRODUCT_JOURNEY_TEMPLATE_MD },
14220
14835
  { relPath: "templates/product/requirement.template.md", content: STARTER_TEMPLATES_PRODUCT_REQUIREMENT_TEMPLATE_MD },
@@ -15234,6 +15849,8 @@ exports.PII_SAST_RULES = PII_SAST_RULES;
15234
15849
  exports.PREPARE_COMMIT_MSG_SCRIPT = PREPARE_COMMIT_MSG_SCRIPT;
15235
15850
  exports.PROMPT_INJECTION_SIGNATURES = PROMPT_INJECTION_SIGNATURES;
15236
15851
  exports.PROTECTED_BYPASS_PATTERNS = PROTECTED_BYPASS_PATTERNS;
15852
+ exports.SARIF_SCHEMA_2_1_0 = SARIF_SCHEMA_2_1_0;
15853
+ exports.SARIF_VERSION = SARIF_VERSION;
15237
15854
  exports.SAST_RULES = SAST_RULES;
15238
15855
  exports.SCHEMA_SCHEMAS_ARCHITECTURE_ADR_SCHEMA_JSON = SCHEMA_SCHEMAS_ARCHITECTURE_ADR_SCHEMA_JSON;
15239
15856
  exports.SCHEMA_SCHEMAS_ARCHITECTURE_COMPONENT_SCHEMA_JSON = SCHEMA_SCHEMAS_ARCHITECTURE_COMPONENT_SCHEMA_JSON;
@@ -15249,6 +15866,7 @@ exports.SCHEMA_SCHEMAS_PRIVACY_PRIVACY_POLICY_SCHEMA_JSON = SCHEMA_SCHEMAS_PRIVA
15249
15866
  exports.SCHEMA_SCHEMAS_PRIVACY_PRIVACY_REQ_SCHEMA_JSON = SCHEMA_SCHEMAS_PRIVACY_PRIVACY_REQ_SCHEMA_JSON;
15250
15867
  exports.SCHEMA_SCHEMAS_PRIVACY_PRIVACY_ROPA_SCHEMA_JSON = SCHEMA_SCHEMAS_PRIVACY_PRIVACY_ROPA_SCHEMA_JSON;
15251
15868
  exports.SCHEMA_SCHEMAS_PRODUCT_ACTOR_SCHEMA_JSON = SCHEMA_SCHEMAS_PRODUCT_ACTOR_SCHEMA_JSON;
15869
+ exports.SCHEMA_SCHEMAS_PRODUCT_BOUNDED_CONTEXT_SCHEMA_JSON = SCHEMA_SCHEMAS_PRODUCT_BOUNDED_CONTEXT_SCHEMA_JSON;
15252
15870
  exports.SCHEMA_SCHEMAS_PRODUCT_BUSINESS_RULE_SCHEMA_JSON = SCHEMA_SCHEMAS_PRODUCT_BUSINESS_RULE_SCHEMA_JSON;
15253
15871
  exports.SCHEMA_SCHEMAS_PRODUCT_JOURNEY_SCHEMA_JSON = SCHEMA_SCHEMAS_PRODUCT_JOURNEY_SCHEMA_JSON;
15254
15872
  exports.SCHEMA_SCHEMAS_PRODUCT_REQUIREMENT_SCHEMA_JSON = SCHEMA_SCHEMAS_PRODUCT_REQUIREMENT_SCHEMA_JSON;
@@ -15325,6 +15943,7 @@ exports.STARTER_TEMPLATES_PRIVACY_DPIA_REQUEST_TEMPLATE_MD = STARTER_TEMPLATES_P
15325
15943
  exports.STARTER_TEMPLATES_PRIVACY_PRIVACY_REQ_TEMPLATE_MD = STARTER_TEMPLATES_PRIVACY_PRIVACY_REQ_TEMPLATE_MD;
15326
15944
  exports.STARTER_TEMPLATES_PRIVACY_PRIVACY_ROPA_TEMPLATE_MD = STARTER_TEMPLATES_PRIVACY_PRIVACY_ROPA_TEMPLATE_MD;
15327
15945
  exports.STARTER_TEMPLATES_PRODUCT_ACTOR_TEMPLATE_MD = STARTER_TEMPLATES_PRODUCT_ACTOR_TEMPLATE_MD;
15946
+ exports.STARTER_TEMPLATES_PRODUCT_BOUNDED_CONTEXT_TEMPLATE_MD = STARTER_TEMPLATES_PRODUCT_BOUNDED_CONTEXT_TEMPLATE_MD;
15328
15947
  exports.STARTER_TEMPLATES_PRODUCT_BUSINESS_RULE_TEMPLATE_MD = STARTER_TEMPLATES_PRODUCT_BUSINESS_RULE_TEMPLATE_MD;
15329
15948
  exports.STARTER_TEMPLATES_PRODUCT_JOURNEY_TEMPLATE_MD = STARTER_TEMPLATES_PRODUCT_JOURNEY_TEMPLATE_MD;
15330
15949
  exports.STARTER_TEMPLATES_PRODUCT_REQUIREMENT_TEMPLATE_MD = STARTER_TEMPLATES_PRODUCT_REQUIREMENT_TEMPLATE_MD;
@@ -15359,6 +15978,7 @@ exports.aggregatePrKpis = aggregatePrKpis;
15359
15978
  exports.aggregateReleaseKpis = aggregateReleaseKpis;
15360
15979
  exports.analyzeBddVariantsForRequirement = analyzeBddVariantsForRequirement;
15361
15980
  exports.appendRevisionHistoryRow = appendRevisionHistoryRow;
15981
+ exports.applyRatchetMode = applyRatchetMode;
15362
15982
  exports.buildCycloneDxComponent = buildCycloneDxComponent;
15363
15983
  exports.buildFeatureFileContent = buildFeatureFileContent;
15364
15984
  exports.buildGraphElements = buildGraphElements;
@@ -15369,11 +15989,13 @@ exports.calculateShannonEntropy = calculateShannonEntropy;
15369
15989
  exports.checkGherkinInSync = checkGherkinInSync;
15370
15990
  exports.checkoutTaskBranch = checkoutTaskBranch;
15371
15991
  exports.classifyBranch = classifyBranch;
15992
+ exports.classifyMetricFromMessage = classifyMetricFromMessage;
15372
15993
  exports.collectAgentFiles = collectAgentFiles;
15373
15994
  exports.collectDashboardMetrics = collectDashboardMetrics;
15374
15995
  exports.collectHistoricalKpis = collectHistoricalKpis;
15375
15996
  exports.computeCanonicalSha256 = computeCanonicalSha256;
15376
15997
  exports.computeSha256 = computeSha256;
15998
+ exports.computeViolationSignature = computeViolationSignature;
15377
15999
  exports.createDefaultQualityPolicy = createDefaultQualityPolicy;
15378
16000
  exports.depositProductHandoffSidecar = depositProductHandoffSidecar;
15379
16001
  exports.detectActiveChangeForIntegration = detectActiveChangeForIntegration;
@@ -15384,6 +16006,8 @@ exports.detectPromptInjection = detectPromptInjection;
15384
16006
  exports.emitCiOutput = emitCiOutput;
15385
16007
  exports.evaluateCompoundLicense = evaluateCompoundLicense;
15386
16008
  exports.evaluateSingleDependency = evaluateSingleDependency;
16009
+ exports.evaluateVulnerabilityThresholds = evaluateVulnerabilityThresholds;
16010
+ exports.extractBaselineEntriesFromResults = extractBaselineEntriesFromResults;
15387
16011
  exports.extractCitations = extractCitations;
15388
16012
  exports.extractCommitKpisFromRange = extractCommitKpisFromRange;
15389
16013
  exports.extractDirectDepNames = extractDirectDepNames;
@@ -15414,6 +16038,8 @@ exports.generateQualityReport = generateQualityReport;
15414
16038
  exports.generateRopaInventoryMarkdown = generateRopaInventoryMarkdown;
15415
16039
  exports.generateSastReportMarkdown = generateSastReportMarkdown;
15416
16040
  exports.generateSecretsReportMarkdown = generateSecretsReportMarkdown;
16041
+ exports.generateSecuritySarifReport = generateSecuritySarifReport;
16042
+ exports.generateSuppressionsAuditReport = generateSuppressionsAuditReport;
15417
16043
  exports.generateTestingCoverageReportMarkdown = generateTestingCoverageReportMarkdown;
15418
16044
  exports.generateThirdPartyNotices = generateThirdPartyNotices;
15419
16045
  exports.generateTraceabilityReportMarkdown = generateTraceabilityReportMarkdown;
@@ -15429,6 +16055,7 @@ exports.injectKpisIntoPrBody = injectKpisIntoPrBody;
15429
16055
  exports.installGitHooks = installGitHooks;
15430
16056
  exports.integrateSddChange = integrateSddChange;
15431
16057
  exports.isGitleaksInstalled = isGitleaksInstalled;
16058
+ exports.isMetricWorsened = isMetricWorsened;
15432
16059
  exports.isPathProtectedFromPatch = isPathProtectedFromPatch;
15433
16060
  exports.isPlaceholderOrIgnored = isPlaceholderOrIgnored;
15434
16061
  exports.isRequirementArtifact = isRequirementArtifact2;
@@ -15436,9 +16063,12 @@ exports.isSemgrepInstalled = isSemgrepInstalled;
15436
16063
  exports.isToolAvailable = isToolAvailable;
15437
16064
  exports.loadPrivacyPolicy = loadPrivacyPolicy;
15438
16065
  exports.loadProductHandoffSidecar = loadProductHandoffSidecar;
16066
+ exports.loadQualityBaseline = loadQualityBaseline;
15439
16067
  exports.locateTaskInActiveChanges = locateTaskInActiveChanges;
16068
+ exports.mapSastSeverityToSarifLevel = mapSastSeverityToSarifLevel;
15440
16069
  exports.maskSecret = maskSecret;
15441
16070
  exports.normalizeSpdxLicense = normalizeSpdxLicense;
16071
+ exports.normalizeUri = normalizeUri;
15442
16072
  exports.parseCommitTrailers = parseCommitTrailers;
15443
16073
  exports.parseFrontmatter = parseFrontmatter;
15444
16074
  exports.parseFrontmatterId = parseFrontmatterId;
@@ -15447,9 +16077,11 @@ exports.parseLicensePolicy = parseLicensePolicy;
15447
16077
  exports.parseMarkdownFrontmatter = parseMarkdownFrontmatter;
15448
16078
  exports.parseQualityPolicy = parseQualityPolicy;
15449
16079
  exports.parseRequirementFile = parseRequirementFile;
16080
+ exports.parseSecuritySuppression = parseSecuritySuppression;
15450
16081
  exports.parseSpecCatalogScope = parseSpecCatalogScope;
15451
16082
  exports.parseTasksDoc = parseTasksDoc;
15452
16083
  exports.parseTasksFromContent = parseTasksFromContent;
16084
+ exports.parseTrivyVulnerabilities = parseTrivyVulnerabilities;
15453
16085
  exports.processPackageDir = processPackageDir;
15454
16086
  exports.readCodeCoverageSummary = readCodeCoverageSummary;
15455
16087
  exports.readPackageJson = readPackageJson;
@@ -15468,6 +16100,8 @@ exports.resolveCytoscapePath = resolveCytoscapePath;
15468
16100
  exports.resolveFeatureFilePath = resolveFeatureFilePath;
15469
16101
  exports.resolveGitRef = resolveGitRef;
15470
16102
  exports.resolveLicenseFromFile = resolveLicenseFromFile;
16103
+ exports.resolveSastCwe = resolveSastCwe;
16104
+ exports.resolveSastOwasp = resolveSastOwasp;
15471
16105
  exports.resolveSchemaForArtifact = resolveSchemaForArtifact;
15472
16106
  exports.resolveTargetFiles = resolveTargetFiles;
15473
16107
  exports.runGitleaksCli = runGitleaksCli;
@@ -15485,6 +16119,7 @@ exports.scanSubdirectories = scanSubdirectories;
15485
16119
  exports.scanWithNativeFs = scanWithNativeFs;
15486
16120
  exports.scanWithSyft = scanWithSyft;
15487
16121
  exports.scanWithTrivy = scanWithTrivy;
16122
+ exports.serializeSarifDocument = serializeSarifDocument;
15488
16123
  exports.slugify = slugify;
15489
16124
  exports.syncPdacDigests = syncPdacDigests;
15490
16125
  exports.tokenizeTitle = tokenizeTitle;
@@ -15511,7 +16146,9 @@ exports.walkProjectFiles = walkProjectFiles;
15511
16146
  exports.walkSourceFiles = walkSourceFiles;
15512
16147
  exports.walkTaskFiles = walkTaskFiles;
15513
16148
  exports.writeCycloneDxSbom = writeCycloneDxSbom;
16149
+ exports.writeQualityBaseline = writeQualityBaseline;
15514
16150
  exports.writeReleaseKpiReport = writeReleaseKpiReport;
16151
+ exports.writeSecuritySarifReport = writeSecuritySarifReport;
15515
16152
  exports.writeThirdPartyNotices = writeThirdPartyNotices;
15516
16153
  //# sourceMappingURL=index.cjs.map
15517
16154
  //# sourceMappingURL=index.cjs.map