@aisdlc/core 3.2.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5057,6 +5057,256 @@ function emitCiOutput(key, value, env = process.env) {
5057
5057
  writeEnvOutputFile(envOutputFile, key, value);
5058
5058
  }
5059
5059
  }
5060
+ var DEFAULT_DLP_RULES = [
5061
+ {
5062
+ id: "DLP-001-PRIVATE-KEY",
5063
+ description: "PEM / RSA / EC / OPENSSH Private Key Block",
5064
+ pattern: "-----BEGIN (?:[A-Z0-9_-]+ )?PRIVATE KEY-----[\\s\\S]*?-----END (?:[A-Z0-9_-]+ )?PRIVATE KEY-----",
5065
+ replacement: "[REDACTED:PRIVATE_KEY]",
5066
+ enabled: true
5067
+ },
5068
+ {
5069
+ id: "DLP-002-API-TOKEN",
5070
+ description: "Cloud, GitHub, Slack, OpenAI, Stripe, and AWS Access Tokens",
5071
+ pattern: "\\b(?:gh[pousr]_[A-Za-z0-9_]{36,255}|github_pat_[0-9a-zA-Z_]{82}|sk-(?:proj-|live-)?[a-zA-Z0-9_-]{32,}|AKIA[0-9A-Z]{16}|xox[baprs]-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*|(?:sk|rk)_(?:live|test)_[0-9a-zA-Z]{24,99})\\b",
5072
+ replacement: "[REDACTED:API_TOKEN]",
5073
+ enabled: true
5074
+ },
5075
+ {
5076
+ id: "DLP-003-JWT",
5077
+ description: "Plaintext JSON Web Token (JWT)",
5078
+ pattern: "\\beyJ[A-Za-z0-9_-]{10,}\\.eyJ[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}\\b",
5079
+ replacement: "[REDACTED:JWT_TOKEN]",
5080
+ enabled: true
5081
+ },
5082
+ {
5083
+ id: "DLP-004-CREDIT-CARD",
5084
+ description: "Payment Card Number (13-19 digits formatted)",
5085
+ pattern: "\\b(?:\\d{4}[- ]\\d{4}[- ]\\d{4}[- ]\\d{4}|(?!9007199254740991)\\d{16})\\b",
5086
+ replacement: "[REDACTED:CREDIT_CARD]",
5087
+ enabled: true
5088
+ },
5089
+ {
5090
+ id: "DLP-005-EMAIL",
5091
+ description: "Personal or Corporate Email Address",
5092
+ pattern: "\\b[A-Za-z0-9._%+-]+@(?!example\\.com|localhost|test\\.local)[A-Za-z0-9.-]+\\.[A-Za-z]{2,}\\b",
5093
+ replacement: "[REDACTED:EMAIL]",
5094
+ enabled: true
5095
+ },
5096
+ {
5097
+ id: "DLP-006-INTERNAL-URL",
5098
+ description: "Internal Intranet / Corp Service URL",
5099
+ pattern: "https?://(?:[A-Za-z0-9._-]+:[A-Za-z0-9._-]+@|[A-Za-z0-9.-]+\\.(?:internal|corp|intranet|local)\\b)[^\\s\"'`<>]*",
5100
+ replacement: "[REDACTED:INTERNAL_URL]",
5101
+ enabled: true
5102
+ }
5103
+ ];
5104
+ function createDefaultDlpPolicy() {
5105
+ return {
5106
+ version: "1.0",
5107
+ enabled: true,
5108
+ zero_data_retention_required: true,
5109
+ rules: [...DEFAULT_DLP_RULES]
5110
+ };
5111
+ }
5112
+ function normalizeParsedRule(raw, idx) {
5113
+ if (typeof raw.pattern !== "string" || !raw.pattern) return null;
5114
+ return {
5115
+ id: typeof raw.id === "string" ? raw.id : `DLP-CUSTOM-${idx + 1}`,
5116
+ description: typeof raw.description === "string" ? raw.description : "Custom DLP rule",
5117
+ pattern: raw.pattern,
5118
+ replacement: typeof raw.replacement === "string" ? raw.replacement : "[REDACTED]",
5119
+ enabled: raw.enabled !== false
5120
+ };
5121
+ }
5122
+ function parseDlpDoc(yamlContent) {
5123
+ let doc;
5124
+ try {
5125
+ doc = yaml3.load(yamlContent);
5126
+ } catch (err) {
5127
+ throw new Error(`[AI-SDLC Fail-Closed] Invalid YAML in dlp-policy: ${err instanceof Error ? err.message : String(err)}`);
5128
+ }
5129
+ if (!doc || typeof doc !== "object" || Array.isArray(doc)) {
5130
+ throw new Error(`[AI-SDLC Fail-Closed] Invalid dlp-policy structure: root must be a YAML mapping`);
5131
+ }
5132
+ const record = doc;
5133
+ if (record.rules !== void 0 && !Array.isArray(record.rules)) {
5134
+ throw new Error(`[AI-SDLC Fail-Closed] Invalid dlp-policy: rules must be an array`);
5135
+ }
5136
+ return record;
5137
+ }
5138
+ function parseDlpPolicy(yamlContent) {
5139
+ const fallback = createDefaultDlpPolicy();
5140
+ if (!yamlContent || !yamlContent.trim()) return fallback;
5141
+ const record = parseDlpDoc(yamlContent);
5142
+ const rawRules = Array.isArray(record.rules) ? record.rules : [];
5143
+ const parsedRules = rawRules.map((r, i) => normalizeParsedRule(r, i)).filter((r) => r !== null);
5144
+ return {
5145
+ version: typeof record.version === "string" ? record.version : "1.0",
5146
+ enabled: record.enabled !== false,
5147
+ zero_data_retention_required: Boolean(record.zero_data_retention_required ?? true),
5148
+ rules: parsedRules.length > 0 ? parsedRules : fallback.rules
5149
+ };
5150
+ }
5151
+ function loadDlpPolicy(rootDir, customPolicyPath) {
5152
+ const base = rootDir || process.cwd();
5153
+ const filePath = customPolicyPath ? path5.isAbsolute(customPolicyPath) ? customPolicyPath : path5.join(base, customPolicyPath) : path5.join(base, "dlp-policy.yaml");
5154
+ if (!fs8.existsSync(filePath)) return createDefaultDlpPolicy();
5155
+ return parseDlpPolicy(fs8.readFileSync(filePath, "utf-8"));
5156
+ }
5157
+ function applySingleDlpRule(text, rule) {
5158
+ if (rule.enabled === false) return { output: text, matches: 0 };
5159
+ try {
5160
+ const regex = new RegExp(rule.pattern, "g");
5161
+ let matches = 0;
5162
+ const output = text.replace(regex, () => {
5163
+ matches++;
5164
+ return rule.replacement;
5165
+ });
5166
+ return { output, matches };
5167
+ } catch {
5168
+ return { output: text, matches: 0 };
5169
+ }
5170
+ }
5171
+ function sanitizeDlpText(text, policy = createDefaultDlpPolicy()) {
5172
+ if (!policy.enabled || !text) {
5173
+ return { sanitizedText: text, redactionCount: 0, triggeredRuleIds: [] };
5174
+ }
5175
+ let current = text;
5176
+ let totalRedactions = 0;
5177
+ const triggered = [];
5178
+ for (const rule of policy.rules) {
5179
+ const res = applySingleDlpRule(current, rule);
5180
+ if (res.matches > 0) {
5181
+ current = res.output;
5182
+ totalRedactions += res.matches;
5183
+ triggered.push(rule.id);
5184
+ }
5185
+ }
5186
+ return {
5187
+ sanitizedText: current,
5188
+ redactionCount: totalRedactions,
5189
+ triggeredRuleIds: triggered
5190
+ };
5191
+ }
5192
+ function sanitizeDlpPayload(payload, policy = createDefaultDlpPolicy()) {
5193
+ if (!policy.enabled || payload === null || payload === void 0) return payload;
5194
+ if (typeof payload === "string") {
5195
+ return sanitizeDlpText(payload, policy).sanitizedText;
5196
+ }
5197
+ const serialized = JSON.stringify(payload);
5198
+ const { sanitizedText } = sanitizeDlpText(serialized, policy);
5199
+ try {
5200
+ return JSON.parse(sanitizedText);
5201
+ } catch {
5202
+ return payload;
5203
+ }
5204
+ }
5205
+
5206
+ // src/adapters/sdd/review-report.ts
5207
+ var REVIEW_VERDICTS = ["COMPLIANT", "SUGGESTIONS", "BLOCKING"];
5208
+ var REVIEWER_ROLES = [
5209
+ "agent-code-reviewer",
5210
+ "agent-security-auditor",
5211
+ "agent-compliance-checker",
5212
+ "agent-privacy-officer",
5213
+ "agent-expert-user",
5214
+ "auditor",
5215
+ "reviewer"
5216
+ ];
5217
+ function isReviewerRole(role) {
5218
+ if (!role || typeof role !== "string") return false;
5219
+ const normalized = role.toLowerCase().trim();
5220
+ return REVIEWER_ROLES.includes(normalized);
5221
+ }
5222
+ function validateChangeId(changeId, rootDir) {
5223
+ if (!changeId || typeof changeId !== "string") {
5224
+ return { ok: false, error: "Missing changeId for review report submission" };
5225
+ }
5226
+ const rawChange = changeId.trim();
5227
+ if (rawChange.includes("..") || rawChange.includes("/") || rawChange.includes("\\") || !/^[a-zA-Z0-9_\-.]+$/.test(rawChange)) {
5228
+ return { ok: false, error: `Invalid changeId: path traversal or invalid characters detected '${rawChange}'` };
5229
+ }
5230
+ const activeChangeDir = path5.join(rootDir, "specs", "changes", "active", rawChange);
5231
+ if (!fs8.existsSync(activeChangeDir)) {
5232
+ return { ok: false, error: `Active change not found in specs/changes/active: '${rawChange}'` };
5233
+ }
5234
+ return { ok: true, changeDir: activeChangeDir, rawChange };
5235
+ }
5236
+ function validateReviewer(reviewer) {
5237
+ if (!reviewer || typeof reviewer !== "string") {
5238
+ return { ok: false, error: "Reviewer role is required" };
5239
+ }
5240
+ const rawReviewer = reviewer.trim().toLowerCase();
5241
+ if (rawReviewer.includes("..") || rawReviewer.includes("/") || rawReviewer.includes("\\")) {
5242
+ return { ok: false, error: `Invalid reviewer name: path traversal detected '${rawReviewer}'` };
5243
+ }
5244
+ if (!isReviewerRole(rawReviewer)) {
5245
+ return {
5246
+ ok: false,
5247
+ error: `Role '${reviewer}' is not an authorized reviewer role. Authorized roles: ${REVIEWER_ROLES.join(", ")}`
5248
+ };
5249
+ }
5250
+ return { ok: true, rawReviewer };
5251
+ }
5252
+ function validateVerdictAndBody(verdict, body) {
5253
+ if (!verdict || !REVIEW_VERDICTS.includes(verdict)) {
5254
+ return {
5255
+ ok: false,
5256
+ error: `Invalid verdict '${verdict}'. Allowed verdicts: ${REVIEW_VERDICTS.join(", ")}`
5257
+ };
5258
+ }
5259
+ if (!body || typeof body !== "string" || !body.trim()) {
5260
+ return { ok: false, error: "Review report body cannot be empty" };
5261
+ }
5262
+ return { ok: true };
5263
+ }
5264
+ function buildReportMarkdown(change, reviewer, verdict, body, date) {
5265
+ return [
5266
+ `# Review Report: ${reviewer}`,
5267
+ "",
5268
+ `- change: ${change}`,
5269
+ `- reviewer: ${reviewer}`,
5270
+ `- verdict: ${verdict}`,
5271
+ `- date: ${date}`,
5272
+ "",
5273
+ "## Findings",
5274
+ "",
5275
+ body,
5276
+ ""
5277
+ ].join("\n");
5278
+ }
5279
+ function persistReportFile(changeDir, rawReviewer, content) {
5280
+ const reviewsDir = path5.join(changeDir, "reviews");
5281
+ if (!fs8.existsSync(reviewsDir)) {
5282
+ fs8.mkdirSync(reviewsDir, { recursive: true });
5283
+ }
5284
+ const reportFileName = `${rawReviewer}.md`;
5285
+ fs8.writeFileSync(path5.join(reviewsDir, reportFileName), content, "utf-8");
5286
+ return crypto3.createHash("sha256").update(content.replace(/\r\n/g, "\n")).digest("hex");
5287
+ }
5288
+ function submitReviewReport(options) {
5289
+ const root = options.rootDir || process.cwd();
5290
+ const changeCheck = validateChangeId(options.changeId, root);
5291
+ if (!changeCheck.ok) return { success: false, error: changeCheck.error };
5292
+ const reviewerCheck = validateReviewer(options.reviewer);
5293
+ if (!reviewerCheck.ok) return { success: false, error: reviewerCheck.error };
5294
+ const contentCheck = validateVerdictAndBody(options.verdict, options.body);
5295
+ if (!contentCheck.ok) return { success: false, error: contentCheck.error };
5296
+ const rawChange = changeCheck.rawChange;
5297
+ const rawReviewer = reviewerCheck.rawReviewer;
5298
+ const dlpPolicy = loadDlpPolicy(root);
5299
+ const sanitizedBody = sanitizeDlpText(options.body.trim(), dlpPolicy).sanitizedText;
5300
+ const date = options.date || (/* @__PURE__ */ new Date()).toISOString();
5301
+ const reportContent = buildReportMarkdown(rawChange, rawReviewer, options.verdict, sanitizedBody, date);
5302
+ const digest = persistReportFile(changeCheck.changeDir, rawReviewer, reportContent);
5303
+ return {
5304
+ success: true,
5305
+ reportPath: `specs/changes/active/${rawChange}/reviews/${rawReviewer}.md`,
5306
+ digest,
5307
+ verdict: options.verdict
5308
+ };
5309
+ }
5060
5310
 
5061
5311
  // src/adapters/sdd/index.ts
5062
5312
  function getSddAdapter(framework) {
@@ -7358,6 +7608,46 @@ function verifyLicenses(options = {}) {
7358
7608
  const reportMarkdown = generateLicenseReportMarkdown(dependencies, violations, policy, artifacts.sbomPath);
7359
7609
  return assembleDynamicLicenseResult(dependencies, permittedCount, violations, reportMarkdown, artifacts, vulnData);
7360
7610
  }
7611
+ var IGNORED_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "bin", "obj", "dist", "build", "target", "reports", "templates"]);
7612
+ var MSBUILD_WEAKENING = [
7613
+ /<TreatWarningsAsErrors>\s*false\s*<\/TreatWarningsAsErrors>/i,
7614
+ /<Nullable>\s*disable\s*<\/Nullable>/i,
7615
+ /<RunAnalyzers>\s*false\s*<\/RunAnalyzers>/i
7616
+ ];
7617
+ var TSCONFIG_WEAKENING = [/"strict"\s*:\s*false/, /"noImplicitAny"\s*:\s*false/, /"strictNullChecks"\s*:\s*false/];
7618
+ function walkFiles(dir, rootDir, out) {
7619
+ for (const entry of fs8.readdirSync(dir, { withFileTypes: true })) {
7620
+ if (entry.isDirectory() && !IGNORED_DIRS.has(entry.name)) walkFiles(path5.join(dir, entry.name), rootDir, out);
7621
+ else if (entry.isFile()) out.push(path5.relative(rootDir, path5.join(dir, entry.name)).replace(/\\/g, "/"));
7622
+ }
7623
+ return out;
7624
+ }
7625
+ function matchWeakening(rel, content, patterns) {
7626
+ return patterns.filter((p) => p.test(content)).map((p) => `[CODING-RULES-BYPASS] '${rel}' weakens the strict coding rules (${p.source}).`);
7627
+ }
7628
+ function checkMsBuildFile(rel, content) {
7629
+ const issues = matchWeakening(rel, content, MSBUILD_WEAKENING);
7630
+ const isNestedBuildProps = /(^|\/)Directory\.Build\.props$/.test(rel) && rel !== "Directory.Build.props";
7631
+ if (isNestedBuildProps && !content.includes("GetPathOfFileAbove")) {
7632
+ issues.push(`[CODING-RULES-BYPASS] Nested '${rel}' does not import the parent Directory.Build.props (GetPathOfFileAbove), silently dropping root rules.`);
7633
+ }
7634
+ return issues;
7635
+ }
7636
+ function checkFile(rel, content, hasDotnetRules, hasTsRules) {
7637
+ if (hasDotnetRules && /\.(csproj|props|targets)$/.test(rel)) return checkMsBuildFile(rel, content);
7638
+ if (hasTsRules && /(^|\/)tsconfig[^/]*\.json$/.test(rel) && !rel.endsWith("tsconfig.strict.json")) {
7639
+ return matchWeakening(rel, content, TSCONFIG_WEAKENING);
7640
+ }
7641
+ return [];
7642
+ }
7643
+ function collectCodingRulesBypassViolations(rootDir) {
7644
+ const hasDotnetRules = fs8.existsSync(path5.join(rootDir, "Directory.Build.props"));
7645
+ const hasTsRules = fs8.existsSync(path5.join(rootDir, "tsconfig.strict.json"));
7646
+ if (!hasDotnetRules && !hasTsRules) return [];
7647
+ return walkFiles(rootDir, rootDir, []).flatMap(
7648
+ (rel) => checkFile(rel, fs8.readFileSync(path5.join(rootDir, rel), "utf-8"), hasDotnetRules, hasTsRules)
7649
+ );
7650
+ }
7361
7651
  var PROTECTED_BYPASS_PATTERNS = [
7362
7652
  /^schemas[\\/]/i,
7363
7653
  /^examples[\\/]security[\\/]/i,
@@ -7368,7 +7658,8 @@ var PROTECTED_BYPASS_PATTERNS = [
7368
7658
  /license-policy\.ya?ml$/i,
7369
7659
  /08_security_concept\.md$/i,
7370
7660
  /09_decisions[\\/]/i,
7371
- /migrations?[\\/]/i
7661
+ /migrations?[\\/]/i,
7662
+ /^\.github[\\/]CODEOWNERS$/i
7372
7663
  ];
7373
7664
  function detectProfileFromChange(changeDir) {
7374
7665
  if (!fs8.existsSync(changeDir)) return "standard";
@@ -7504,7 +7795,10 @@ function verifyProgressiveFriction(options = {}) {
7504
7795
  const changeDir = resolveChangeDirectory(rootDir, options);
7505
7796
  const profile = changeDir ? detectProfileFromChange(changeDir) : "standard";
7506
7797
  const modifiedFiles = options.diffFiles || options.modifiedFiles || (profile === "patch" ? detectGitDiffFiles(rootDir) : []);
7507
- const violations = profile === "patch" ? collectPatchViolations(rootDir, modifiedFiles) : [];
7798
+ const violations = [
7799
+ ...profile === "patch" ? collectPatchViolations(rootDir, modifiedFiles) : [],
7800
+ ...collectCodingRulesBypassViolations(rootDir)
7801
+ ];
7508
7802
  const bypassed = violations.length > 0;
7509
7803
  const success = !bypassed;
7510
7804
  return {
@@ -10307,6 +10601,28 @@ function extractCommitKpisFromRange(baseRef, headRef = "HEAD", options = {}) {
10307
10601
  }
10308
10602
  return records;
10309
10603
  }
10604
+ function extractAllRepoCommitKpis(options = {}) {
10605
+ const cwd = options.cwd || process.cwd();
10606
+ const format = "---AI_SDLC_COMMIT---%n%H%x1f%an%x1f%ae%x1f%aI%x1f%s%n%B%n---AI_SDLC_BODY_END---";
10607
+ let rawOutput = "";
10608
+ try {
10609
+ rawOutput = execFileSync("git", ["log", "--all", `--format=${format}`, "--numstat"], {
10610
+ cwd,
10611
+ encoding: "utf-8",
10612
+ stdio: ["pipe", "pipe", "pipe"]
10613
+ });
10614
+ } catch {
10615
+ return [];
10616
+ }
10617
+ if (!rawOutput) return [];
10618
+ const chunks = parseRawLogChunks(rawOutput);
10619
+ const records = [];
10620
+ for (const chunk of chunks) {
10621
+ const rec = buildCommitKpiRecord(chunk);
10622
+ if (rec) records.push(rec);
10623
+ }
10624
+ return records;
10625
+ }
10310
10626
  var AGENT_ENV_MAPPINGS = [
10311
10627
  { envKey: "ANTIGRAVITY_AGENT", defaultModel: "gemini-3.8-flash", source: "antigravity" },
10312
10628
  { envKey: "ANTIGRAVITY_CONVERSATION_ID", defaultModel: "gemini-3.8-flash", source: "antigravity" },
@@ -10490,6 +10806,24 @@ if echo "$CURRENT_BRANCH" | grep -qE "^(main|master|release/.*)$"; then
10490
10806
  exit 1
10491
10807
  fi
10492
10808
 
10809
+ # Immutable Coding Rules Guard: block AI agents from adding, modifying or deleting coding rules files
10810
+ IS_AGENT=0
10811
+ if [ -n "$AI_MODEL" ] || [ -n "$AI_AGENT_NAME" ] || [ -n "$ANTIGRAVITY_AGENT" ] || [ -n "$ANTIGRAVITY_AGENT_ID" ] || [ -n "$ANTIGRAVITY_CONVERSATION_ID" ] || [ -n "$CLAUDE_CODE" ] || [ -n "$CURSOR_AGENT" ] || [ -n "$WINDSURF_AGENT" ] || [ -n "$AIDER_MODEL" ] || [ -f ".ai-sdlc/session-telemetry.json" ]; then
10812
+ IS_AGENT=1
10813
+ fi
10814
+
10815
+ if [ "$IS_AGENT" = "1" ]; then
10816
+ TAMPERED_RULES=$(git diff --cached --diff-filter=AMDR --name-only 2>/dev/null | grep -E "(^|/)(Directory\\.Build\\.props|tsconfig\\.strict\\.json|eslint\\.config\\.mjs|gradle/init\\.d/aisdlc-strict\\.init\\.gradle\\.kts|config/pmd/aisdlc-ruleset\\.xml|config/detekt/detekt\\.yml|\\.cargo/config\\.toml|\\.clippy\\.toml|\\.golangci\\.yml|\\.clang-tidy|cmake/AisdlcStrictCompiler\\.cmake|\\.github/CODEOWNERS|templates/coding-rules/.+)$" || echo "")
10817
+ if [ -n "$TAMPERED_RULES" ]; then
10818
+ echo "" >&2
10819
+ echo "\u274C [AI-SDLC Immutable Coding Rules Guard] BLOCKED: AI agents are forbidden from adding, modifying or deleting coding rules files:" >&2
10820
+ echo "$TAMPERED_RULES" >&2
10821
+ echo "Fix the source or test code to comply with the compiler/linter rules instead of altering the rule configuration." >&2
10822
+ echo "" >&2
10823
+ exit 1
10824
+ fi
10825
+ fi
10826
+
10493
10827
  exit 0
10494
10828
  `;
10495
10829
  var PREPARE_COMMIT_MSG_SCRIPT = `#!/usr/bin/env bash
@@ -10607,7 +10941,7 @@ function installGitHooks(rootDir = process.cwd()) {
10607
10941
  fs8.mkdirSync(hooksDir, { recursive: true });
10608
10942
  }
10609
10943
  const prepareCommitMsgPath = path5.join(hooksDir, "prepare-commit-msg");
10610
- const preCommitPath = path5.join(hooksDir, "pre-commit");
10944
+ const preCommitPath = path5.join(gitDir, "hooks", "pre-commit");
10611
10945
  try {
10612
10946
  fs8.writeFileSync(prepareCommitMsgPath, PREPARE_COMMIT_MSG_SCRIPT, { encoding: "utf-8", mode: 493 });
10613
10947
  fs8.writeFileSync(preCommitPath, PRE_COMMIT_SCRIPT, { encoding: "utf-8", mode: 493 });
@@ -10995,7 +11329,7 @@ function getCytoscapeScript() {
10995
11329
  const scriptPath = resolveCytoscapePath();
10996
11330
  if (scriptPath) {
10997
11331
  try {
10998
- cachedScript = fs8.readFileSync(scriptPath, "utf-8");
11332
+ cachedScript = fs8.readFileSync(scriptPath, "utf-8").replace(/\b9007199254740991\b/g, "(Math.pow(2,53)-1)");
10999
11333
  return cachedScript;
11000
11334
  } catch {
11001
11335
  }
@@ -12001,7 +12335,7 @@ var DASHBOARD_CLIENT_SCRIPT = `
12001
12335
  container: document.getElementById('cy'),
12002
12336
  elements: safeElements,
12003
12337
  boxSelectionEnabled: false,
12004
- autoungrabify: true,
12338
+ autoungrabify: false,
12005
12339
  style: [
12006
12340
  {
12007
12341
  selector: 'node',
@@ -12291,6 +12625,9 @@ var DASHBOARD_CLIENT_SCRIPT = `
12291
12625
  }
12292
12626
  });
12293
12627
 
12628
+ setTimeout(function() { if (cy) { cy.resize(); cy.fit(30); } }, 150);
12629
+ window.addEventListener('resize', function() { if (cy) { cy.resize(); } });
12630
+
12294
12631
  cy.on('tap', 'node', function(evt) {
12295
12632
  var node = evt.target;
12296
12633
  var data = node.data();
@@ -13517,7 +13854,28 @@ function collectGitPrefixedBranches(rootDir) {
13517
13854
  return [];
13518
13855
  }
13519
13856
  }
13520
- function resolveCandidateBranches(rootDir, activeBranch, history) {
13857
+ function addDefaultGitBranches(rootDir, branchSet) {
13858
+ for (const def of ["main", "master"]) {
13859
+ try {
13860
+ execFileSync("git", ["rev-parse", "--verify", "--quiet", def], {
13861
+ cwd: rootDir,
13862
+ stdio: ["pipe", "pipe", "pipe"]
13863
+ });
13864
+ branchSet.add(def);
13865
+ } catch {
13866
+ }
13867
+ }
13868
+ }
13869
+ function addCommitTrailerBranches(allRepoCommits, branchSet) {
13870
+ if (!allRepoCommits) return;
13871
+ for (const c of allRepoCommits) {
13872
+ const pRef = c.trailers?.parentRef;
13873
+ if (pRef && /^(feat|bug|task|release)\//i.test(pRef)) {
13874
+ branchSet.add(pRef);
13875
+ }
13876
+ }
13877
+ }
13878
+ function resolveCandidateBranches(rootDir, activeBranch, history, allRepoCommits) {
13521
13879
  const branchSet = /* @__PURE__ */ new Set();
13522
13880
  if (activeBranch && activeBranch !== "HEAD") {
13523
13881
  branchSet.add(activeBranch);
@@ -13527,14 +13885,38 @@ function resolveCandidateBranches(rootDir, activeBranch, history) {
13527
13885
  }
13528
13886
  for (const b of collectGitUnmergedBranches(rootDir)) branchSet.add(b);
13529
13887
  for (const b of collectGitPrefixedBranches(rootDir)) branchSet.add(b);
13888
+ addDefaultGitBranches(rootDir, branchSet);
13889
+ addCommitTrailerBranches(allRepoCommits, branchSet);
13530
13890
  return Array.from(branchSet);
13531
13891
  }
13532
- function fetchBranchKpi(rootDir, branch) {
13892
+ function fetchDefaultBranchKpi(rootDir, branch, allRepoCommits) {
13893
+ if (allRepoCommits && allRepoCommits.length > 0) {
13894
+ return aggregateCommitKpiRecords(allRepoCommits, branch, branch);
13895
+ }
13896
+ const base = resolveDefaultBranchBase(rootDir, branch);
13897
+ const kpi = aggregatePrKpis(base, branch, { cwd: rootDir });
13898
+ return kpi && kpi.totalCommits > 0 ? kpi : null;
13899
+ }
13900
+ function isCommitMatchingBranch(c, branch, branchBase) {
13901
+ const pRef = (c.trailers?.parentRef || "").toLowerCase();
13902
+ const bLower = branch.toLowerCase();
13903
+ const baseLower = branchBase.toLowerCase();
13904
+ return pRef === bLower || pRef === baseLower || pRef.length > 0 && bLower.includes(pRef) || c.subject.toLowerCase().includes("(" + baseLower + ")");
13905
+ }
13906
+ function fetchMergedBranchKpi(branch, allRepoCommits) {
13907
+ if (!allRepoCommits || allRepoCommits.length === 0) return null;
13908
+ const branchBase = branch.replace(/^(feat|bug|task|release)\//i, "");
13909
+ const matched = allRepoCommits.filter((c) => isCommitMatchingBranch(c, branch, branchBase));
13910
+ return matched.length > 0 ? aggregateCommitKpiRecords(matched, "main", branch) : null;
13911
+ }
13912
+ function fetchBranchKpi(rootDir, branch, allRepoCommits) {
13533
13913
  try {
13534
- const isDefault = branch === "main" || branch === "master";
13535
- const base = isDefault ? resolveDefaultBranchBase(rootDir, branch) : "main";
13536
- const kpi = aggregatePrKpis(base, branch, { cwd: rootDir });
13537
- return kpi && kpi.totalCommits > 0 ? kpi : null;
13914
+ if (branch === "main" || branch === "master") {
13915
+ return fetchDefaultBranchKpi(rootDir, branch, allRepoCommits);
13916
+ }
13917
+ const kpi = aggregatePrKpis("main", branch, { cwd: rootDir });
13918
+ if (kpi && kpi.totalCommits > 0) return kpi;
13919
+ return fetchMergedBranchKpi(branch, allRepoCommits);
13538
13920
  } catch {
13539
13921
  return null;
13540
13922
  }
@@ -13543,10 +13925,10 @@ function recordBranchKpi(telemetries, commitMap, branch, kpi) {
13543
13925
  telemetries[branch] = kpi;
13544
13926
  for (const rec of kpi.commitRecords || []) commitMap.set(rec.sha, rec);
13545
13927
  }
13546
- function populateCandidateTelemetries(rootDir, candidateBranches, telemetries, commitMap) {
13928
+ function populateCandidateTelemetries(rootDir, candidateBranches, telemetries, commitMap, allRepoCommits) {
13547
13929
  for (const branch of candidateBranches) {
13548
13930
  if (telemetries[branch]) continue;
13549
- const kpi = fetchBranchKpi(rootDir, branch);
13931
+ const kpi = fetchBranchKpi(rootDir, branch, allRepoCommits);
13550
13932
  if (kpi) recordBranchKpi(telemetries, commitMap, branch, kpi);
13551
13933
  }
13552
13934
  }
@@ -13559,11 +13941,15 @@ function computeConsolidatedTelemetry(uniqueCommits, fallback) {
13559
13941
  function collectAllBranchTelemetries(rootDir, activeBranch, history, activePrKpi) {
13560
13942
  const branchTelemetries = {};
13561
13943
  const uniqueCommits = /* @__PURE__ */ new Map();
13944
+ const allRepoCommits = extractAllRepoCommitKpis({ cwd: rootDir });
13945
+ for (const c of allRepoCommits) {
13946
+ uniqueCommits.set(c.sha, c);
13947
+ }
13562
13948
  if (activePrKpi && activeBranch && activeBranch !== "HEAD") {
13563
13949
  recordBranchKpi(branchTelemetries, uniqueCommits, activeBranch, activePrKpi);
13564
13950
  }
13565
- const candidateBranches = resolveCandidateBranches(rootDir, activeBranch, history);
13566
- populateCandidateTelemetries(rootDir, candidateBranches, branchTelemetries, uniqueCommits);
13951
+ const candidateBranches = resolveCandidateBranches(rootDir, activeBranch, history, allRepoCommits);
13952
+ populateCandidateTelemetries(rootDir, candidateBranches, branchTelemetries, uniqueCommits, allRepoCommits);
13567
13953
  const totalTelemetry = computeConsolidatedTelemetry(Array.from(uniqueCommits.values()), activePrKpi);
13568
13954
  return { branchTelemetries, totalTelemetry };
13569
13955
  }
@@ -13814,9 +14200,10 @@ var SPECIALIZED_AGENT_TEMPLATES = [
13814
14200
 
13815
14201
  ## Phase 0: Greenfield Product Inception (New Product Intent)
13816
14202
  - **Trigger**: When the user expresses intent to create a new product from scratch with the framework (or when \`specs/product/\` has no baseline product model yet), initiate **Phase 0** before any SDD change (\`change:new\`) or implementation:
13817
- 1. **Structured Discovery Interview (3\u20135 Questions)**: Ask a concise 3\u20135 question interview to clarify: (a) core problem and mission statement, (b) primary actors/stakeholders (\`ACT-*\`), (c) essential MVP capabilities/use cases (\`UC-*\`), and (d) top 3\u20135 priority quality goals and constraints (\`QR-*\`, \`CON-*\`).
13818
- 2. **Enterprise & Capability Vision (\`ARCH-INTRO-001\`)**: Draft the root vision artifact (\`type: architecture-introduction\`, \`naf-perspective: "Enterprise & Capability"\`, \`status: draft\`) using \`templates/architecture/introduction-and-goals.template.md\` (\`schemas/architecture/introduction-and-goals.schema.json\`).
14203
+ 1. **Iterative Discovery Interview (Up to 15 Questions or Until Product is Crystal Clear)**: Conduct an iterative discovery interview (up to 15 questions, grouped logically in conversational rounds until zero product ambiguities remain) before drafting specs, clarifying: (a) core problem and mission statement, (b) primary actors/stakeholders (\`ACT-*\`), authentication/role model, and **target user interface modality** (e.g., Web UI, Desktop GUI, Console/TUI/CLI, Mobile app, or headless API/SDK), (c) foundational master entities/catalogs and CRUD flows required to operate the system, (d) essential MVP capabilities/use cases (\`UC-*\`) and business rules/invariants (\`BR-*\`) vs. future roadmap, and (e) top 3\u20135 priority quality goals and constraints (\`QR-*\`, \`CON-*\`). Do not proceed to draft artifacts until the product scope is completely clear.
14204
+ 2. **Enterprise & Capability Vision (\`ARCH-INTRO-001\`)**: Draft the root vision artifact (\`type: architecture-introduction\`, \`naf-perspective: "Enterprise & Capability"\`, \`status: draft\`) using \`templates/architecture/introduction-and-goals.template.md\` (\`schemas/architecture/introduction-and-goals.schema.json\`), explicitly recording the agreed UI/interaction modality.
13819
14205
  3. **ProductShape Derivation**: Derive the initial draft artifacts (\`ACT-*\`, \`UC-*\`, \`BR-*\`, \`FR-*\`, \`QR-*\` with \`status: draft\`) in \`specs/product/\` linked to \`ARCH-INTRO-001\` for human Product Owner review.
14206
+ 4. **Mandatory End-to-End Presentation Interface & Master Data Prerequisite Rule (ANTI-LIBRARY-ONLY MVP)**: Whenever primary actors (\`ACT-*\`) are human users, the MVP ProductShape baseline MUST include: (a) an explicit presentation/interaction requirement (\`FR-*\`) or vertical UI/CLI acceptance criteria matching the modality agreed in Step 1 (Web UI, Desktop GUI, or Console/TUI/CLI \u2014 never proposing a library-only/in-memory MVP without a runnable entry point), (b) user authentication/session access when multi-role actors exist, and (c) CRUD/configuration flows for foundational master entities (e.g., rooms, staff, students, catalogs) required to operate the core business flows without manual database intervention.
13820
14207
 
13821
14208
  ## Operational Directives & Guardrails
13822
14209
  - Every generated artifact must strictly adhere to the canonical Markdown and YAML frontmatter format in \`schemas/product/\` and \`schemas/architecture/introduction-and-goals.schema.json\`.
@@ -13893,6 +14280,7 @@ var SPECIALIZED_AGENT_TEMPLATES = [
13893
14280
  - Decompose the system into building blocks \`CMP-*\` ensuring each component declares which use cases \`UC-*\` it implements and which requirements (\`FR-*\`, \`QR-*\`, \`SEC-REQ-*\`, \`PRIV-REQ-*\`) it fulfills under \`satisfies-requirements\`.
13894
14281
  - **Modular & Hexagonal Architecture (Ports & Adapters)**: Structure building blocks (\`CMP-*\`, Level 2/3 of arc42) around Bounded Contexts (\`BC-*\`) and Vertical Slices (\`UC-*\`) following Hexagonal Architecture (Ports & Adapters). Separate the pure Domain/Application Core from Inbound/Driving Ports (API, CLI, UI handlers) and Outbound/Driven Ports (persistence, queues, external SDKs/LLMs), enforcing the Dependency Rule (dependencies point strictly inward toward the Core; avoid speculative empty layers per YAGNI and respect existing \`ADR-*\` architecture in brownfield repos).
13895
14282
  - **Contract-First Full-Stack Integration**: Whenever a feature or change spans Frontend (UI) and Backend (API/services), define an explicit shared typed contract (Zod schemas, shared TypeScript DTOs, or OpenAPI specification) in \`design.md\` before implementation so both layers compile against a single source of truth.
14283
+ - **No Orphan Presentation Components (\`CMP-WEB-*\` / \`CMP-UI-*\` / \`CMP-CLI-*\`)**: When modeling architecture for a system with human actors (\`ACT-*\`), never leave the agreed presentation/driving adapter (Web UI, Desktop GUI, or Console/CLI) as an unmapped \`proposed\` spec while scheduling only backend class-library tasks in \`tasks.md\`. Wave 0 (\`CHG-001\`) MUST bootstrap the runnable presentation host shell matching the modality defined in Inception, and every subsequent \`CHG-*\` for a human-facing \`UC-*\` must include tasks (\`TSK-*\`) implementing its corresponding views/screens/commands and E2E tests as a complete vertical slice.
13896
14284
  - Generate interaction and sequence diagrams in native Mermaid syntax.
13897
14285
  - Document critical technological decisions using immutable \`ADR-*\` records conforming to \`schemas/architecture/adr.schema.json\`.
13898
14286
  - Validate that architectural choices comply with legal constraints in \`license-policy.yaml\` and data protection constraints in \`privacy-policy.yaml\`.
@@ -14018,6 +14406,7 @@ Execute every implementation task following this strict sequential order:
14018
14406
  ## Operational Directives & Guardrails
14019
14407
  - Operate under bimodal discipline depending on the lifecycle phase:
14020
14408
  1. **Design Mode (Upstream)**: Adopt the primary actor persona under real-world field conditions (stress, latency, constrained viewports). Separate strict Minimum Viable Product (MVP) core from future roadmap ideas using \`templates/product/user-design-feedback.template.md\`.
14409
+ - **FORBIDDEN Library-Only MVP for Human Actors**: Whenever primary actors (\`ACT-*\`) are human users, verify that the target interaction modality (Web UI, Desktop GUI, Console/TUI/CLI, or Mobile) was explicitly defined in \`ARCH-INTRO-*\` / \`specs/product/\`, and reject as \`[BLOCKING_DEFECT]\` any MVP proposal that defers the agreed presentation layer, role authentication (when applicable), or foundational master-entity CRUDs (e.g., creating rooms, teachers, students, schedules) to post-MVP or leaves the system operable only via unit tests/in-memory calls. An MVP for human operators must be end-to-end usable from day one via its agreed interface.
14021
14410
  2. **Functional Validation Mode (Downstream / Pre-PR / Post-Development Functional Validation)**: Inspect \`agent-developer\` deliverables once unit tests pass green by executing the real application (via Playwright or Chrome DevTools MCP when UI is present). Contrast actual UI, CLI, and API behavior against approved \`UC-*\` and \`FR-*\` criteria, verifying real Backend connectivity, the 4 UI usability states (\`Loading\`, \`Empty\`, \`Error\`, \`Nominal\`), keyboard/ARIA accessibility, and \`0\` browser \`console.error\` / network failures.
14022
14411
  - Formulate decisive questions under \`open-questions\` for the human Product Owner.
14023
14412
  - Emit handoff block suggesting the Pre-Merge Audit Triad (\`agent-code-reviewer\`, \`agent-security-auditor\`, \`agent-privacy-officer\`, \`agent-compliance-checker\`) if compliant, or return to \`agent-developer\` on functional drift or fake-wiring.`
@@ -14061,6 +14450,52 @@ Execute every implementation task following this strict sequential order:
14061
14450
  - **Cross-Workflow Audit**: When fixing any CI/CD or configuration defect detected in a PR, search all \`.github/workflows/*.yml\` for the same pattern (including release, post-merge, and publishing pipelines) before declaring the fix complete.
14062
14451
  - **Remote Verification**: Creating a PR (\`gh pr create\`) does not equal success; actively verify that remote checks pass (\`gh pr checks\`).
14063
14452
  - If autonomy is $\\ge$ \`HUMAN_REVIEW_PLAN\`, conclude by emitting the Workflow Handoff block (\`templates/workflow/agent-handoff.template.md\`) to the human Tech Lead or Release Manager, opening the Human Action Window. In \`AUTONOMOUS\` mode, omit interactive handoff.`
14453
+ },
14454
+ {
14455
+ id: "agent-auditor",
14456
+ title: "Transversal Quality and Improvement Auditor",
14457
+ description: "Polymorphically inspect deliverables from any AI-SDLC specialist agent on demand, identifying structural weaknesses, overengineering, or blind spots, and proposing concrete, minimal solutions adhering strictly to YAGNI.",
14458
+ globs: "**/*",
14459
+ claudeTools: ["View", "GlobTool", "GrepTool", "LS", "Bash"],
14460
+ antigravityTools: ["read_file", "run_command", "call_mcp_tool", "ask_question"],
14461
+ body: `## Role & Mission
14462
+ - **Role**: Transversal Quality and Constructive Auditor Agent (\`agent-auditor\`).
14463
+ - **Mission**: Inspect the output deliverables of any upstream specialist agent upon demand across any phase, identifying structural weaknesses, premature abstractions, overengineering, or blind spots, and proposing concrete, minimal, and standard solutions adhering strictly to Simplicity First (YAGNI).
14464
+
14465
+ ## Operational Directives & Guardrails
14466
+ - **Polymorphic On-Demand Scope**: May be invoked over deliverables from any role (\`agent-product-analyst\`, \`agent-threat-modeler\`, \`agent-privacy-officer\`, \`agent-system-architect\`, \`agent-qa-engineer\`, \`agent-developer\`, \`agent-devops\`).
14467
+ - **Simplicity First (YAGNI)**: Actively challenge speculative parameters, redundant interfaces, unused design patterns, and unrequested flexibility.
14468
+ - **End-to-End MVP Completeness Check (Anti-Library-Only Drift)**: When auditing Product (\`specs/product/\`), Architecture (\`specs/architecture/\`), or SDD change plans (\`design.md\`, \`tasks.md\`) involving human actors (\`ACT-*\`), flag as \`[BLOCKING_DEFECT]\` any scope cut that fails to define the target user interface modality at Inception or omits the runnable driving adapter (Web UI, Desktop GUI, or Console/CLI), role access/auth (when applicable), or master-data CRUD flows required to operate the use case end-to-end without manual database manipulation.
14469
+ - **Classification of Findings**: Label every finding as:
14470
+ * \`[BLOCKING_DEFECT]\`: Critical omission, structural debt, or standard violation that must be resolved.
14471
+ * \`[SIMPLIFICATION]\`: Opportunity to remove unneeded complexity or reduce code/spec surface without loss of function.
14472
+ * \`[ADVISORY]\`: Non-blocking observation or suggestion.
14473
+ - **NON-INVASIVE GUARDRAIL**: You do NOT modify upstream files or specifications directly.
14474
+ - **Mandatory Return Handoff**: Emit a structured report citing canonical IDs and SHA-256 digests, concluding with the canonical Workflow Handoff block (\`templates/workflow/agent-handoff.template.md\`) directed back to the audited specialist agent.
14475
+ - **ANTI-PING-PONG GUARDRAIL**: Enforce maximum 1 audit return round per increment unless blocking defects persist.`
14476
+ },
14477
+ {
14478
+ id: "agent-adversary",
14479
+ title: "Transversal Red Team and Chaos Adversary",
14480
+ description: "Actively attempt to break, bypass, or invalidate deliverables from any target specialist agent, providing concrete proofs-of-concept (PoC), counterexamples, and reproduction steps for every discovered failure mode.",
14481
+ globs: "**/*",
14482
+ claudeTools: ["View", "GlobTool", "GrepTool", "LS", "Bash"],
14483
+ antigravityTools: ["read_file", "run_command", "call_mcp_tool", "ask_question"],
14484
+ body: `## Role & Mission
14485
+ - **Role**: Transversal Red Team and Stress Adversary Agent (\`agent-adversary\`).
14486
+ - **Mission**: Actively attempt to break, bypass, or invalidate the deliverables of any target specialist agent across any phase, providing concrete proofs-of-concept (PoC), counterexamples, and reproduction steps for every discovered failure mode.
14487
+
14488
+ ## Operational Directives & Guardrails
14489
+ - **Polymorphic On-Demand Scope**:
14490
+ * **Product**: Uncover contradictory requirements, unreachable business states, and logic traps.
14491
+ * **Architecture**: Simulate race conditions, cascading failures, resource exhaustion, and single points of failure (SPOFs).
14492
+ * **QA**: Perform conceptual mutation testing; demonstrate how flawed or empty implementations could falsely pass tests green.
14493
+ * **Development**: Attack boundary inputs, concurrency race triggers, and memory/type edge breaks.
14494
+ * **DevOps**: Probe pipeline isolation, credential boundaries, and cold-start/dependency outages.
14495
+ - **MANDATORY PROOF-OF-BREAK**: Abstract criticism without reproducible proof is strictly forbidden. Every finding must include: (1) Target Entity ID, (2) Failure Scenario / Attack Vector, (3) Concrete PoC (input vector, sequence breakdown, or mutant code), and (4) Expected Impact.
14496
+ - **NON-INVASIVE GUARDRAIL**: You do NOT patch the vulnerabilities or bugs yourself.
14497
+ - **Mandatory Return Handoff**: Emit the canonical Workflow Handoff block (\`templates/workflow/agent-handoff.template.md\`) addressing the audited agent, demanding verified mitigation before downstream promotion.
14498
+ - **ANTI-PING-PONG GUARDRAIL**: Enforce maximum 1 adversarial return round per increment.`
14064
14499
  }
14065
14500
  ];
14066
14501
  function renderAntigravityAgentFile(agent) {
@@ -14130,12 +14565,20 @@ var LIFECYCLE_SKILL_TEMPLATES = [
14130
14565
  {
14131
14566
  id: "aisdlc-greenfield",
14132
14567
  title: "Greenfield Project Inception & Delivery Playbook",
14133
- description: "Orchestrate end-to-end AI-SDLC onboarding and Phase 0 Inception for brand-new (Greenfield) projects, from repository initialization (aisdlc init) and NAF v4 Vision (ARCH-INTRO-*) through ProductShape, STRIDE Threat Modeling, arc42 Architecture, and initial SDD increment delivery.",
14568
+ description: "Orchestrate end-to-end AI-SDLC onboarding and Phase 0 Inception for brand-new (Greenfield) projects, from repository initialization (aisdlc init) and NAF v4 Vision (ARCH-INTRO-*) through ProductShape, STRIDE Threat Modeling, arc42 Architecture, transversal auditor/adversary verification loops, and initial SDD increment delivery.",
14134
14569
  references: "[`process/02_product_definition.md`](../../process/02_product_definition.md), [`process/04b_data_protection_and_privacy.md`](../../process/04b_data_protection_and_privacy.md), [`process/05_architecture_arc42_nafv4.md`](../../process/05_architecture_arc42_nafv4.md), [`process/06_spec_driven_development.md`](../../process/06_spec_driven_development.md), and [`process/09_agent_protocols.md`](../../process/09_agent_protocols.md).",
14135
14570
  globs: "product/**, specs/product/**, architecture/**, templates/**",
14136
14571
  body: `## Purpose & Trigger
14137
14572
  Use this skill when starting a **brand-new software project from scratch (Greenfield)** or when \`specs/product/\` has no canonical baseline yet. It coordinates the sequential execution of AI-SDLC MCP/CLI tools and specialized role agents so no code is written before product vision, security enclaves, privacy-by-design controls, and architecture contracts exist.
14138
14573
 
14574
+ ## Mandatory Transversal Quality & Adversarial Protocol
14575
+ Every authoring agent deliverable across Phase 0 and Inception undergoes mandatory quality auditing and adversarial stress-testing before downstream progression:
14576
+ - **Concurrent Inspection**: Immediately following the execution of any authoring agent (\`agent-product-analyst\`, \`agent-threat-modeler\`, \`agent-privacy-officer\`, \`agent-system-architect\`), invoke [\`agent-auditor\`](../agent-auditor/SKILL.md) (evaluating YAGNI, structural debt, and simplification) and [\`agent-adversary\`](../agent-adversary/SKILL.md) (stress-testing logic traps, SPOFs, attack vectors, or broken invariants) **concurrently** in clean, isolated context windows.
14577
+ - **Non-Invasive Review**: Neither auditor nor adversary modifies deliverables directly; both deliver structured reports citing canonical IDs and SHA-256 digests.
14578
+ - **Consolidated Remediation Re-Execution**: Consolidate findings and emit the Workflow Handoff back to the authoring agent, who is re-executed to resolve blocking defects and apply simplifications.
14579
+ - **Anti-Ping-Pong Guardrail (Max 2 Rounds)**: Bounded strictly to a maximum of **2 correction rounds** per phase/deliverable. If non-blocking advisories remain after round 2, proceed to the downstream phase; if blocking defects persist after round 2, escalate immediately to the Human Tech Lead.
14580
+ - **Exclusion of Downstream Review & Validation Roles**: Review and validation agents (\`agent-expert-user\`, \`agent-code-reviewer\`, \`agent-security-auditor\`, \`agent-compliance-checker\`) evaluate finished deliverables and are excluded from being audited by this loop.
14581
+
14139
14582
  ## End-to-End Execution Playbook
14140
14583
 
14141
14584
  ### Step 1: Repository Turnkey Initialization
@@ -14145,16 +14588,21 @@ Use this skill when starting a **brand-new software project from scratch (Greenf
14145
14588
 
14146
14589
  ### Step 2: Phase 0 Product Inception (\`agent-product-analyst\`)
14147
14590
  1. Delegate to or adopt [\`agent-product-analyst\`](../agent-product-analyst/SKILL.md).
14148
- 2. **Discovery Interview (3\u20135 Questions)**: Before generating artifacts, clarify with the human Product Owner:
14591
+ 2. **Iterative Discovery Interview (Up to 15 Questions or Until Product Scope is 100% Clear)**: Before generating artifacts, clarify with the human Product Owner in rounds of 3\u20135 questions (up to **15 questions maximum**, stopping earlier as soon as the product is clear):
14149
14592
  - Core mission statement and business problem.
14150
14593
  - Primary actors (\`ACT-*\`) and external systems.
14151
- - Essential MVP capabilities (\`UC-*\`) vs. future roadmap.
14594
+ - **Target Interaction & Presentation Modality (\`CON-*\` / \`ARCH-INTRO-001\`)**: Explicitly define at inception how human actors will interact with the MVP (e.g., **Web UI**, **Desktop GUI**, **Interactive Console/TUI/CLI**, **Mobile App**, or **Headless API/SDK** if actors are exclusively external systems). Never assume a headless C#/TS class library when human actors exist.
14595
+ - Essential MVP capabilities (\`UC-*\`) vs. future roadmap, ensuring **foundational entity CRUD / master data workflows** (creating/managing core domain entities before executing transactions on them) are explicitly included in the MVP.
14152
14596
  - Top 3\u20135 quality goals (\`QR-*\`) and regulatory/technical constraints (\`CON-*\`).
14153
- 3. **Enterprise & Capability Vision**: Create \`specs/architecture/ARCH-INTRO-001.md\` (\`status: draft\`, \`naf-perspective: "Enterprise & Capability"\`) using \`templates/architecture/introduction-and-goals.template.md\`.
14597
+ 3. **Enterprise & Capability Vision**: Create \`specs/architecture/ARCH-INTRO-001.md\` (\`status: draft\`, \`naf-perspective: "Enterprise & Capability"\`) using \`templates/architecture/introduction-and-goals.template.md\`, explicitly recording the chosen presentation/UI modality.
14154
14598
  4. **ProductShape Baseline**: Derive initial draft artifacts in \`specs/product/\`:
14155
14599
  - Actors (\`ACT-*\`), Use Cases (\`UC-*\`), Business Rules (\`BR-*\`), Functional Requirements (\`FR-*\` with mandatory \`@nominal\`, \`@boundary\`, \`@invalid\` Gherkin blocks), and Quality Requirements (\`QR-*\`).
14600
+ - **Vertical Slice Completeness Rule**: Every human-triggered \`UC-*\` in the MVP must specify observable user interaction through the agreed presentation modality (Web screens/forms, Desktop views, or Console commands/menus) and state persistence\u2014never stop at internal library/service method calls.
14156
14601
  5. Validate schemas and duplicates via MCP tools \`verify_schemas\` and \`verify_duplicates\` (or \`npx aisdlc check --fix\`).
14157
- 6. **Mandatory Upstream UX & MVP Boundary Gate (\`agent-expert-user\`)**: Invoke [\`agent-expert-user\`](../agent-expert-user/SKILL.md) in **Design Mode** to stress-test the proposed workflows, enforce strict MVP boundaries, and separate core MVP \`UC-*\` from future roadmap backlog (\`templates/product/user-design-feedback.template.md\`).
14602
+ 6. **Mandatory Upstream UX & MVP Boundary Gate (\`agent-expert-user\`)**: Invoke [\`agent-expert-user\`](../agent-expert-user/SKILL.md) in **Design Mode** to stress-test the proposed workflows, enforce strict MVP boundaries, reject any headless/library-only MVP when human actors exist, verify master-data CRUD prerequisites, and separate core MVP \`UC-*\` from future roadmap backlog (\`templates/product/user-design-feedback.template.md\`).
14603
+ 7. **Transversal Quality & Adversarial Loop (\`agent-product-analyst\`)**:
14604
+ - Concurrently invoke \`agent-auditor\` and \`agent-adversary\` on the draft product artifacts in isolated context windows.
14605
+ - Consolidate findings and hand off back to \`agent-product-analyst\` to re-execute and remediate issues (max 2 correction rounds).
14158
14606
 
14159
14607
  ### Step 3: Shift-Left Cybersecurity & Privacy-by-Design (\`agent-threat-modeler\` \u2794 \`agent-privacy-officer\`)
14160
14608
  1. Delegate to or adopt [\`agent-threat-modeler\`](../agent-threat-modeler/SKILL.md).
@@ -14162,25 +14610,36 @@ Use this skill when starting a **brand-new software project from scratch (Greenf
14162
14610
  - Threat Actors (\`ACT-THREAT-*\`)
14163
14611
  - Abuse Cases (\`ABUSE-*\` targeting \`UC-*\`)
14164
14612
  - Security Requirements (\`SEC-REQ-*\` with \`@security @mitigation\` negative Gherkin scenarios and \`SEC-ENC-*\` Zero Trust enclave bindings).
14165
- 3. Hand off to [\`agent-privacy-officer\`](../agent-privacy-officer/SKILL.md) to apply LINDDUN and GDPR/LOPDGDD/ISO 27701 in \`specs/privacy/\`:
14613
+ 3. **Transversal Quality & Adversarial Loop (\`agent-threat-modeler\`)**:
14614
+ - Concurrently invoke \`agent-auditor\` and \`agent-adversary\` over the security threat models.
14615
+ - Consolidate findings and return handoff to \`agent-threat-modeler\` to re-execute and remediate (max 2 correction rounds).
14616
+ 4. Hand off to [\`agent-privacy-officer\`](../agent-privacy-officer/SKILL.md) to apply LINDDUN and GDPR/LOPDGDD/ISO 27701 in \`specs/privacy/\`:
14166
14617
  - Personal Data Assets (\`DATA-ASSET-*\`), GDPR Art. 30 Records of Processing (\`PRIV-ROPA-*\`), and Privacy Requirements (\`PRIV-REQ-*\` with \`@privacy @gdpr\` Gherkin scenarios).
14167
- 4. Run \`verify_schemas\` and \`verify_privacy\` (\`npx aisdlc verify privacy\`).
14618
+ 5. **Transversal Quality & Adversarial Loop (\`agent-privacy-officer\`)**:
14619
+ - Concurrently invoke \`agent-auditor\` and \`agent-adversary\` over the privacy records and requirements.
14620
+ - Consolidate findings and return handoff to \`agent-privacy-officer\` to re-execute and remediate (max 2 correction rounds).
14621
+ 6. Run \`verify_schemas\` and \`verify_privacy\` (\`npx aisdlc verify privacy\`).
14168
14622
 
14169
14623
  ### Step 4: Modular Systems Architecture (\`agent-system-architect\`)
14170
14624
  1. Delegate to or adopt [\`agent-system-architect\`](../agent-system-architect/SKILL.md).
14171
14625
  2. Define building blocks (\`CMP-*\`) and Architectural Decision Records (\`ADR-*\`) in \`specs/architecture/\` using \`templates/architecture/\`, ensuring every \`CMP-*\` cites \`implements-use-cases\` (\`UC-*\`) and \`satisfies-requirements\` (\`FR-*\`, \`QR-*\`, \`SEC-REQ-*\`, \`PRIV-REQ-*\`).
14172
14626
  3. Inspect third-party stack choices against \`license-policy.yaml\` via \`verify_licenses\` and subprocessors against \`privacy-policy.yaml\` via \`verify_privacy\`.
14173
14627
  4. **Technical Security & Privacy Feedback Loop**: If new infrastructure, persistence, LLM, or auth decisions introduce attack vectors or PII flows, return to \`agent-threat-modeler\` \u2794 \`agent-privacy-officer\` to add technical \`SEC-REQ-*\` and \`PRIV-REQ-*\` mitigations before coding.
14628
+ 5. **Transversal Quality & Adversarial Loop (\`agent-system-architect\`)**:
14629
+ - Concurrently invoke \`agent-auditor\` (evaluating YAGNI, architecture bloat, Ports & Adapters interfaces) and \`agent-adversary\` (simulating SPOFs, race conditions, cascading outages) in isolated context windows.
14630
+ - Consolidate findings and return handoff to \`agent-system-architect\` to re-execute and remediate (max 2 correction rounds).
14174
14631
 
14175
14632
  ### Step 5: Release Milestone & Topological Wave SDD Plan (\`1 UC-* = 1 CHG-*\`)
14176
14633
  1. **Open Release Milestone (\`Tier 2: release/v1.0.0\`)**: Group the approved MVP Use Cases (\`UC-001\`, \`UC-002\`, ...) under the initial release milestone (\`release/v1.0.0\`) and visualize the branch hierarchy via \`npx aisdlc git plan\`.
14177
14634
  2. **Decompose into Topological Waves (DAG Parallelism)**:
14178
- - **Wave 0 \u2014 Foundational Core (Sequential)**: Identify the foundational \`UC-*\` (core domain entities, shared contracts, auth/config) and deliver it first as \`CHG-001\` via [\`aisdlc-increment\`](../aisdlc-increment/SKILL.md) so downstream agents share locked interfaces.
14179
- - **Waves 1..N \u2014 Orthogonal Capabilities (Parallel Multi-Agent)**: Once Wave 0 contracts are merged into \`release/v1.0.0\`, scaffold independent \`CHG-*\` increments (\`1 UC-* = 1 CHG-*\`) and execute them **in parallel** across isolated branches/worktrees (\`feat/CHG-002\`, \`feat/CHG-003\`, ...) whenever they target distinct components (\`CMP-*\`) or bounded contexts (\`BC-*\`).
14635
+ - **Wave 0 \u2014 Foundational Core & Executable Presentation Host (Sequential)**: Identify the foundational \`UC-*\` (core domain entities, shared contracts, auth/config, **plus the runnable application host/shell for the agreed UI modality**\u2014e.g., Web server + layout, Desktop shell, or CLI entrypoint + DB bootstrap) and deliver it first as \`CHG-001\` via [\`aisdlc-increment\`](../aisdlc-increment/SKILL.md) so the product is immediately executable and downstream agents share locked interfaces.
14636
+ - **Waves 1..N \u2014 Orthogonal End-to-End Vertical Slices (Parallel Multi-Agent)**: Once Wave 0 contracts and host shell are merged into \`release/v1.0.0\`, scaffold independent \`CHG-*\` increments (\`1 UC-* = 1 CHG-*\`) and execute them **in parallel** across isolated branches/worktrees (\`feat/CHG-002\`, \`feat/CHG-003\`, ...) whenever they target distinct components (\`CMP-*\`) or bounded contexts (\`BC-*\`). Every \`CHG-*\` implementing a human \`UC-*\` must deliver its complete vertical slice (Domain + Persistence + UI/CLI presentation view/command + E2E test).
14180
14637
  3. **Release Consolidation (\`release/v1.0.0\` \u2794 \`main\`)**: Once all MVP \`CHG-*\` increments are integrated (\`sdd_integrate\`), run \`verify\` (\`npx aisdlc verify all\`), generate SBOM (\`npx aisdlc verify licenses --sbom reports/sbom.cdx.json --notices THIRD_PARTY_NOTICES.md\`), compute release KPIs (\`kpi_release\`), and open the Release PR into \`main\` for human Product Owner & Release Manager sign-off.
14181
14638
 
14182
14639
  ## Non-Negotiable Guardrails
14183
14640
  - **Clean Context Window Isolation per Specialist Agent (Cross-IDE)**: Never execute two distinct specialist roles in the same conversation context window. In subagent-capable IDEs (Antigravity \`invoke_subagent\`, Claude Code \`Task\` / \`.claude/agents/\`, GitHub Copilot \`@agent-*\`), always spawn each specialist in a fresh isolated subagent context that reads state strictly from disk (\`specs/\`, \`handoff.yaml\`, \`get_active_handoff\`). In chat-based IDEs (Cursor, Windsurf, Aider), persist all artifacts to disk, emit the Workflow Handoff block, and instruct the user to open a **New Chat** (or \`/clear\`) before running the next specialist.
14641
+ - **Mandatory Transversal Quality & Adversarial Loop**: Every authoring agent deliverable must undergo concurrent inspection by \`agent-auditor\` and \`agent-adversary\` in isolated context windows, followed by a re-execution of the authoring agent to remediate findings. To prevent infinite cycles, enforce the **Anti-Ping-Pong Guardrail**: maximum 2 correction rounds per phase; if unresolved blocking defects persist after round 2, escalate to the Human Tech Lead.
14642
+ - **FORBIDDEN Library-Only MVP for Human-Facing Products**: Whenever a product defines human actors (\`ACT-*\`), no agent may scope the MVP (\`release/v1.0.0\`) as headless class libraries or in-memory-only modules without an executable presentation host. The target interaction modality (Web UI, Desktop GUI, Console/TUI/CLI, or Mobile) must be explicitly agreed with the user during Phase 0 Inception and delivered as a runnable end-to-end application across the MVP waves.
14184
14643
  - **FORBIDDEN Greenfield Monolith (\`1 UC-* = 1 CHG-*\`)**: Never bundle the entire product or multiple \`UC-*\` into a single SDD change (\`CHG-001\`). Deterministic Gate 3 (\`verify_governance\`) blocks any \`handoff.yaml\` containing $> 1$ Use Case (\`Greenfield monolith detected\`). Parallelism is achieved by running **multiple bounded \`CHG-*\` concurrently** on separate branches/worktrees, never by stuffing multiple \`UC-*\` into one \`CHG-*\`.
14185
14644
  - Never invoke \`sdd_change_new\` or write application code in \`src/\` on a Greenfield project before \`ARCH-INTRO-001\`, \`agent-expert-user\` MVP validation, and at least one \`UC-*\` and \`FR-*\` exist.
14186
14645
  - All newly drafted specifications must start with \`status: draft\`.
@@ -14189,12 +14648,20 @@ Use this skill when starting a **brand-new software project from scratch (Greenf
14189
14648
  {
14190
14649
  id: "aisdlc-legacy-onboarding",
14191
14650
  title: "Legacy / Brownfield Retro-Inception Playbook",
14192
- description: "Orchestrate progressive AI-SDLC adoption and Brownfield retro-inception on existing or legacy repositories without breaking production code, reverse-engineering architecture (ARCH-INTRO-*, CMP-*) and establishing baseline quality, security, and license audits before new SDD increments.",
14651
+ description: "Orchestrate progressive AI-SDLC adoption and Brownfield retro-inception on existing or legacy repositories without breaking production code, reverse-engineering architecture (ARCH-INTRO-*, CMP-*), transversal auditor/adversary verification loops, and establishing baseline quality, security, and license audits before new SDD increments.",
14193
14652
  references: "[`process/02_product_definition.md`](../../process/02_product_definition.md), [`process/04_open_source_license_compliance.md`](../../process/04_open_source_license_compliance.md), [`process/04b_data_protection_and_privacy.md`](../../process/04b_data_protection_and_privacy.md), [`process/05_architecture_arc42_nafv4.md`](../../process/05_architecture_arc42_nafv4.md), [`process/10_quality_management_and_release_gates.md`](../../process/10_quality_management_and_release_gates.md), and [`process/09_agent_protocols.md`](../../process/09_agent_protocols.md).",
14194
14653
  globs: "architecture/**, specs/**, src/**, packages/**",
14195
14654
  body: `## Purpose & Trigger
14196
14655
  Use this skill when **adopting AI-SDLC in an existing or legacy codebase (Brownfield)** that already has production source code (\`src/\`, \`packages/\`, etc.) but lacks canonical PDaC specifications, arc42 architecture views, or deterministic quality/license/privacy gates.
14197
14656
 
14657
+ ## Mandatory Transversal Quality & Adversarial Protocol
14658
+ Every authoring agent deliverable during Brownfield retro-inception undergoes mandatory quality auditing and adversarial stress-testing before downstream progression:
14659
+ - **Concurrent Inspection**: Immediately following the execution of any authoring agent (\`agent-product-analyst\`, \`agent-system-architect\`, \`agent-threat-modeler\`, \`agent-privacy-officer\`), invoke [\`agent-auditor\`](../agent-auditor/SKILL.md) (evaluating YAGNI, over-specification, and structural clarity) and [\`agent-adversary\`](../agent-adversary/SKILL.md) (uncovering hidden assumptions, boundary breaks, and contradictory legacy rules) **concurrently** in clean, isolated context windows.
14660
+ - **Non-Invasive Review**: Neither auditor nor adversary modifies deliverables directly; both deliver structured reports citing canonical IDs and SHA-256 digests.
14661
+ - **Consolidated Remediation Re-Execution**: Consolidate findings and emit the Workflow Handoff back to the authoring agent, who is re-executed to resolve blocking defects and apply simplifications.
14662
+ - **Anti-Ping-Pong Guardrail (Max 2 Rounds)**: Bounded strictly to a maximum of **2 correction rounds** per phase/deliverable. If non-blocking advisories remain after round 2, proceed to the downstream phase; if blocking defects persist after round 2, escalate immediately to the Human Tech Lead.
14663
+ - **Exclusion of Diagnostic/Review Roles**: Read-only baseline verifiers and diagnostic review roles (\`agent-compliance-checker\`, \`agent-security-auditor\`, \`agent-code-reviewer\`) assess pre-existing code and are excluded from being audited by this loop.
14664
+
14198
14665
  ## End-to-End Execution Playbook
14199
14666
 
14200
14667
  ### Step 1: Non-Destructive Framework Scaffolding
@@ -14212,9 +14679,13 @@ Before modifying any code or creating SDD changes, run diagnostic verifiers to q
14212
14679
  ### Step 3: Brownfield Retro-Inception (\`agent-system-architect\` & \`agent-product-analyst\`)
14213
14680
  Instead of attempting to document 100% of a legacy monolith upfront, apply **bounded retro-inception** focused on the system boundary and the domain areas under active evolution:
14214
14681
  1. **System Vision & Context (\`ARCH-INTRO-001\`)**: Use [\`agent-product-analyst\`](../agent-product-analyst/SKILL.md) to document the current system's mission, primary actors (\`ACT-*\`), and top quality goals (\`QR-*\`) in \`specs/architecture/ARCH-INTRO-001.md\`.
14682
+ - **Transversal Loop**: Concurrently invoke \`agent-auditor\` and \`agent-adversary\` over \`ARCH-INTRO-001\`. Consolidate findings and return handoff to \`agent-product-analyst\` to re-execute and remediate (max 2 correction rounds).
14215
14683
  2. **As-Is Component Mapping (\`CMP-*\` & \`ADR-*\`)**: Use [\`agent-system-architect\`](../agent-system-architect/SKILL.md) to map existing core modules/services into \`specs/architecture/CMP-*.md\` and capture historical architectural constraints (\`CON-*\`, \`ADR-*\`).
14684
+ - **Transversal Loop**: Concurrently invoke \`agent-auditor\` and \`agent-adversary\` over component models. Consolidate findings and return handoff to \`agent-system-architect\` to re-execute and remediate (max 2 correction rounds).
14216
14685
  3. **Core Use Cases Extraction (\`UC-*\`, \`FR-*\`)**: Extract canonical \`UC-*\` and \`FR-*\` artifacts in \`specs/product/\` for the specific bounded context or module that will be modified or extended next, including Gherkin acceptance scenarios reflecting current expected behavior (characterization specs).
14686
+ - **Transversal Loop**: Concurrently invoke \`agent-auditor\` and \`agent-adversary\` over extracted \`UC-*\`/\`FR-*\`. Consolidate findings and return handoff to \`agent-product-analyst\` to re-execute and remediate (max 2 correction rounds).
14217
14687
  4. **Threat & Privacy Boundary Mapping (\`agent-threat-modeler\` \u2794 \`agent-privacy-officer\`)**: Map existing trust zones (\`SEC-ENC-*\`), active threat vectors (\`ACT-THREAT-*\`, \`ABUSE-*\`, \`SEC-REQ-*\`), and personal data inventories (\`DATA-ASSET-*\`, \`PRIV-ROPA-*\`, \`PRIV-REQ-*\`) on the target module.
14688
+ - **Transversal Loop**: Concurrently invoke \`agent-auditor\` and \`agent-adversary\` over threat and privacy models. Consolidate findings and return handoff to \`agent-threat-modeler\` and \`agent-privacy-officer\` to re-execute and remediate (max 2 correction rounds).
14218
14689
 
14219
14690
  ### Step 4: Characterization Testing & Synchronization
14220
14691
  1. Run MCP tool \`sdd_check_fix\` (\`npx aisdlc check --fix\`) to extract \`.feature\` files and compute canonical SHA-256 digests.
@@ -14225,6 +14696,7 @@ Once the target domain's baseline artifacts (\`ARCH-INTRO-*\`, \`UC-*\`, \`FR-*\
14225
14696
 
14226
14697
  ## Non-Negotiable Guardrails
14227
14698
  - **Clean Context Window Isolation per Specialist Agent (Cross-IDE)**: Never execute two distinct specialist roles in the same conversation context window. In subagent-capable IDEs (Antigravity \`invoke_subagent\`, Claude Code \`Task\` / \`.claude/agents/\`, GitHub Copilot \`@agent-*\`), always spawn each specialist in a fresh isolated subagent context that reads state strictly from disk (\`specs/\`, \`handoff.yaml\`, \`get_active_handoff\`). In chat-based IDEs (Cursor, Windsurf, Aider), persist all artifacts to disk, emit the Workflow Handoff block, and instruct the user to open a **New Chat** (or \`/clear\`) before running the next specialist.
14699
+ - **Mandatory Transversal Quality & Adversarial Loop**: Every authoring agent deliverable must undergo concurrent inspection by \`agent-auditor\` and \`agent-adversary\` in isolated context windows, followed by a re-execution of the authoring agent to remediate findings. To prevent infinite cycles, enforce the **Anti-Ping-Pong Guardrail**: maximum 2 correction rounds per phase; if unresolved blocking defects persist after round 2, escalate to the Human Tech Lead.
14228
14700
  - **Zero Drive-By Rewrites**: Never mass-refactor untouched legacy modules during onboarding. Apply the Strangler / Boy Scout rule: bring touched functions into compliance with \`quality-policy.yaml\` incrementally via governed SDD tasks (\`TSK-*\`).
14229
14701
  - **Characterization First**: Never alter legacy business logic without first capturing its current behavior in an \`FR-*\` Gherkin specification and a verifiable test suite (\`agent-qa-engineer\`).
14230
14702
  - **Immediate Secret Remediation**: If Step 2 (\`verify_security\`) uncovers leaked credentials (exit code 4), halt feature work and remediate/rotate secrets immediately.`
@@ -14232,7 +14704,7 @@ Once the target domain's baseline artifacts (\`ARCH-INTRO-*\`, \`UC-*\`, \`FR-*\
14232
14704
  {
14233
14705
  id: "aisdlc-increment",
14234
14706
  title: "Bounded SDD Feature & Bugfix Delivery Playbook",
14235
- description: "Orchestrate the complete Spec-Driven Development (SDD) lifecycle for bounded feature increments, enhancements, and bugfixes (CHG-* / TSK-*), from upstream requirement derivation and 4-tier Git branching through Red-Green-Refactor TDD, Pre-Merge Audit Triad, all 11 Quality Gates, and canonical baseline integration.",
14707
+ description: "Orchestrate the complete Spec-Driven Development (SDD) lifecycle for bounded feature increments, enhancements, and bugfixes (CHG-* / TSK-*), from upstream requirement derivation and 4-tier Git branching through Red-Green-Refactor TDD, transversal auditor/adversary verification loops, Pre-Merge Audit Triad, all 11 Quality Gates, and canonical baseline integration.",
14236
14708
  references: "[`process/06_spec_driven_development.md`](../../process/06_spec_driven_development.md), [`process/08_citation_contract_and_drift.md`](../../process/08_citation_contract_and_drift.md), [`process/10_quality_management_and_release_gates.md`](../../process/10_quality_management_and_release_gates.md), [`process/11_git_branching_and_lifecycle.md`](../../process/11_git_branching_and_lifecycle.md), and [`process/09_agent_protocols.md`](../../process/09_agent_protocols.md).",
14237
14709
  globs: "specs/changes/**, src/**, packages/**, tests/**",
14238
14710
  body: `## Purpose & Trigger
@@ -14244,9 +14716,12 @@ Use this skill for **every evolutionary increment (new feature, enhancement, ref
14244
14716
  1. Inspect active changes via MCP tool \`get_active_handoff\` and verify whether the target Use Case (\`UC-*\`) or Requirement (\`FR-*\`) already exists in \`specs/product/\`.
14245
14717
  2. If the increment introduces new behavior or modifies business rules:
14246
14718
  - Use [\`agent-product-analyst\`](../agent-product-analyst/SKILL.md) to create or update the \`UC-*\`, \`BR-*\`, and \`FR-*\` (with \`@nominal\`, \`@boundary\`, \`@invalid\` Gherkin scenarios).
14719
+ - **Transversal Loop (\`agent-product-analyst\`)**: Concurrently invoke \`agent-auditor\` and \`agent-adversary\` over updated specs. Consolidate findings and return handoff to \`agent-product-analyst\` to re-execute and remediate (max 2 correction rounds).
14247
14720
  - Run MCP tool \`verify_duplicates\` (\`npx aisdlc verify duplicates\`) to block lexical or functional collisions early.
14248
14721
  - Use [\`agent-threat-modeler\`](../agent-threat-modeler/SKILL.md) to model any new \`ABUSE-*\` and \`SEC-REQ-*\` mitigations.
14722
+ - **Transversal Loop (\`agent-threat-modeler\`)**: Concurrently invoke \`agent-auditor\` and \`agent-adversary\` over security models. Consolidate findings and return handoff to \`agent-threat-modeler\` to re-execute and remediate (max 2 correction rounds).
14249
14723
  - Hand off to [\`agent-privacy-officer\`](../agent-privacy-officer/SKILL.md) to model any personal data assets (\`DATA-ASSET-*\`), GDPR Art. 30 processing activities (\`PRIV-ROPA-*\`), and privacy requirements (\`PRIV-REQ-*\`).
14724
+ - **Transversal Loop (\`agent-privacy-officer\`)**: Concurrently invoke \`agent-auditor\` and \`agent-adversary\` over privacy models. Consolidate findings and return handoff to \`agent-privacy-officer\` to re-execute and remediate (max 2 correction rounds).
14250
14725
  3. Run \`sdd_check_fix\` (\`npx aisdlc check --fix\`) to sync Gherkin \`.feature\` files and validate schemas.
14251
14726
 
14252
14727
  ### Step 2: SDD Change Scaffolding & Architectural Design (\`agent-system-architect\`)
@@ -14254,7 +14729,10 @@ Use this skill for **every evolutionary increment (new feature, enhancement, ref
14254
14729
  2. Use [\`agent-system-architect\`](../agent-system-architect/SKILL.md) to complete \`specs/changes/active/<chg-id>/design.md\` and \`specs/architecture/CMP-*.md\`:
14255
14730
  - Structure \`CMP-*\` and \`design.md\` around **Modular & Hexagonal Architecture (Ports & Adapters)** (Domain/Application Core + Inbound/Outbound Ports) and define **Contract-First** shared interfaces/DTOs/schemas when spanning Frontend and Backend.
14256
14731
  - Map 100% of \`handoff.yaml\` requirements and components to atomic tasks (\`TSK-*\`) in \`tasks.md\` with explicit \`autonomy-mode\` (\`AUTONOMOUS\`, \`HUMAN_REVIEW_PLAN\`, \`HIGH_RISK_MANUAL\`, \`AMBIGUOUS\`).
14257
- 3. Run \`verify_governance\` and \`verify_friction\` to validate task governance, 100% design/handoff scope coverage, and anti-monolith limits (\`maxUseCasesPerChange = 1\`).
14732
+ 3. **Transversal Loop (\`agent-system-architect\`)**:
14733
+ - Concurrently invoke \`agent-auditor\` (evaluating YAGNI, interface bloat, task completeness) and \`agent-adversary\` (probing race conditions, contract drift, SPOFs) in isolated context windows.
14734
+ - Consolidate findings and return handoff to \`agent-system-architect\` to re-execute and remediate (max 2 correction rounds).
14735
+ 4. Run \`verify_governance\` and \`verify_friction\` to validate task governance, 100% design/handoff scope coverage, and anti-monolith limits (\`maxUseCasesPerChange = 1\`).
14258
14736
 
14259
14737
  ### Step 3: 4-Tier Git Branch Navigation & Multi-Agent Parallelism
14260
14738
  1. Navigate to the task branch using \`npx aisdlc git checkout <TSK-ID>\` (\`pnpm run git:checkout <TSK-ID>\`), which cascade-creates:
@@ -14267,7 +14745,10 @@ Use this skill for **every evolutionary increment (new feature, enhancement, ref
14267
14745
  ### Step 4: Red Phase \u2014 Failing Test Suites (\`agent-qa-engineer\`)
14268
14746
  1. Delegate to or adopt [\`agent-qa-engineer\`](../agent-qa-engineer/SKILL.md).
14269
14747
  2. Author FAILING (red) BDD/Gherkin step definitions, integration/contract tests, and mandatory E2E/UI tests (evaluating Happy Path, Sad Path, and Boundary Values for every interactive UI element, plus \`UC-*\` alternative/exception flows) in \`tests/\`.
14270
- 3. Run \`verify_testing\` (\`npx aisdlc verify testing\`) to confirm requirement test coverage before writing production code.
14748
+ 3. **Transversal Loop (\`agent-qa-engineer\`)**:
14749
+ - Concurrently invoke \`agent-auditor\` (checking test overengineering, brittle assertions) and \`agent-adversary\` (running conceptual mutation testing to prove whether trivial or empty implementations could falsely pass tests green) in isolated context windows.
14750
+ - Consolidate findings and return handoff to \`agent-qa-engineer\` to re-execute and harden test suites (max 2 correction rounds).
14751
+ 4. Run \`verify_testing\` (\`npx aisdlc verify testing\`) to confirm requirement test coverage before writing production code.
14271
14752
 
14272
14753
  ### Step 5: Green & Refactor Phase \u2014 Surgical Implementation (\`agent-developer\`)
14273
14754
  1. Delegate to or adopt [\`agent-developer\`](../agent-developer/SKILL.md).
@@ -14275,6 +14756,19 @@ Use this skill for **every evolutionary increment (new feature, enhancement, ref
14275
14756
  - (1) Modular & Hexagonal Architecture (Ports & Adapters) boundaries, (2) Inter-module interfaces/ports first, (3) Concrete component implementation (zero fake-wiring; all 4 UI states \`Loading\`, \`Empty\`, \`Error\`, \`Nominal\`), (4) Exhaustive per-function unit tests in \`tests/unit/\` (Happy Path, Sad Path, Boundary, Null/Empty).
14276
14757
  3. Verify any new dependency against \`license-policy.yaml\` via \`verify_licenses\` and PII handling against \`privacy-policy.yaml\` via \`verify_privacy\`.
14277
14758
  4. Run \`sdd_check_fix\` (\`npx aisdlc check --fix\`) and \`verify_quality\` (\`npx aisdlc verify quality\`) until Cyclomatic Complexity $\\le 10$, Cognitive $\\le 15$, Maintainability $\\ge 50$, and Function Length $\\le 40$ lines pass with zero violations.
14759
+ 5. **Transversal Loop (\`agent-developer\`)**:
14760
+ - Concurrently invoke \`agent-auditor\` (detecting overengineering, speculative parameters, AST complexity) and \`agent-adversary\` (attacking boundary inputs, concurrency races, type edge breaks with concrete PoCs) in isolated context windows.
14761
+ - Consolidate findings and return handoff to \`agent-developer\` to re-execute and remediate (max 2 correction rounds).
14762
+
14763
+ ### Mandatory Transversal Quality & Adversarial Protocol
14764
+ - **Systematic Post-Agent Execution**: Immediately following the execution of any authoring agent (\`agent-product-analyst\`, \`agent-threat-modeler\`, \`agent-privacy-officer\`, \`agent-system-architect\`, \`agent-qa-engineer\`, \`agent-developer\`, \`agent-devops\`), invoke \`agent-auditor\` and \`agent-adversary\` concurrently in clean, isolated context windows over that agent's deliverables.
14765
+ - **Concurrent Inspection**:
14766
+ * [\`agent-auditor\`](../agent-auditor/SKILL.md) inspects deliverables for structural debt, premature generalizations, or unneeded complexity (YAGNI).
14767
+ * [\`agent-adversary\`](../agent-adversary/SKILL.md) actively stress-tests deliverables: uncovers requirement contradictions, simulates architectural race conditions/SPOFs, conducts conceptual mutation testing on QA suites, or crafts breaking boundary payloads for code with mandatory proof-of-break.
14768
+ - **Non-Invasive Guardrail**: Neither auditor nor adversary edits files directly. Both emit structured findings citing canonical IDs and SHA-256 hashes.
14769
+ - **Consolidated Handoff & Remediation Re-Execution**: Consolidate findings and emit the Workflow Handoff back to the audited authoring agent, who is re-executed to resolve the findings.
14770
+ - **Anti-Ping-Pong Guardrail (Max 2 Rounds)**: Enforce a strict boundary of maximum **2 correction rounds** per phase/deliverable. If non-blocking advisories remain after round 2, proceed downstream; if blocking defects persist after round 2, escalate to the Human Tech Lead.
14771
+ - **Exclusion of Downstream Review & Validation Roles**: Pre-merge review agents (\`agent-code-reviewer\`, \`agent-security-auditor\`, \`agent-compliance-checker\`) and validation agents (\`agent-expert-user\`) evaluate finished deliverables and are excluded from being audited by this loop.
14278
14772
 
14279
14773
  ### Step 6: Post-Development Functional Validation & Pre-Merge Audit Triad
14280
14774
  1. **Functional Validation (\`agent-expert-user\`)**: Validate live runtime behavior against \`UC-*\` and \`FR-*\` criteria (including \`0\` browser \`console.error\`/\`pageerror\` on UI changes).
@@ -14294,6 +14788,7 @@ Use this skill for **every evolutionary increment (new feature, enhancement, ref
14294
14788
 
14295
14789
  ## Non-Negotiable Guardrails
14296
14790
  - **Clean Context Window Isolation per Specialist Agent (Cross-IDE)**: Never execute two distinct specialist roles (e.g., \`agent-qa-engineer\` and \`agent-developer\`, or \`agent-developer\` and \`agent-security-auditor\`) in the same conversation context window. In subagent-capable IDEs (Antigravity \`invoke_subagent\`, Claude Code \`Task\` / \`.claude/agents/\`, GitHub Copilot \`@agent-*\`), always spawn each specialist in a fresh isolated subagent context that reads state strictly from disk (\`specs/\`, \`handoff.yaml\`, \`get_active_handoff\`). In chat-based IDEs (Cursor, Windsurf, Aider), persist all artifacts to disk, emit the Workflow Handoff block, and instruct the user to open a **New Chat** (or \`/clear\`) before running the next specialist.
14791
+ - **Mandatory Transversal Quality & Adversarial Loop**: Every authoring agent deliverable must undergo concurrent inspection by \`agent-auditor\` and \`agent-adversary\` in isolated context windows, followed by a re-execution of the authoring agent to remediate findings. To prevent infinite cycles, enforce the **Anti-Ping-Pong Guardrail**: maximum 2 correction rounds per phase; if unresolved blocking defects persist after round 2, escalate to the Human Tech Lead.
14297
14792
  - **Single-Use-Case Scope (\`1 UC-* = 1 CHG-*\`)**: Each SDD change (\`CHG-*\`) must deliver at most 1 Use Case (\`UC-*\`). Bundling multiple \`UC-*\` into one \`handoff.yaml\` is blocked by \`verify_governance\` (\`Greenfield monolith detected\`). Scale throughput via parallel \`CHG-*\` branches/worktrees, not monolithic changes.
14298
14793
  - **100% Design & Handoff Coverage in \`tasks.md\`**: Every \`CMP-*\`, \`FR-*\`, \`SEC-REQ-*\`, and \`PRIV-REQ-*\` declared in \`design.md\` and \`handoff.yaml\` must be explicitly assigned to at least one \`TSK-*\` in \`tasks.md\`.`
14299
14794
  }
@@ -14375,10 +14870,11 @@ This file defines the operational rules and specialized role mappings for Google
14375
14870
 
14376
14871
  ### 1. \`agent-product-analyst\` (Product Analyst / Scribe)
14377
14872
  - **Mission**: Capture new product intent via NAF v4 Enterprise & Capability Vision (\`ARCH-INTRO-*\`) and define/refine the product model using ProductShape.
14378
- - **Phase 0 (Greenfield Product Inception)**: When creating a new product from scratch (or when \`specs/product/\` has no baseline), run a concise 3\u20135 question discovery interview (mission/problem, actors \`ACT-*\`, MVP capabilities \`UC-*\`, priority quality goals \`QR-*\`), draft \`ARCH-INTRO-001\` (\`templates/architecture/introduction-and-goals.template.md\`), and derive initial \`ACT-*\`, \`UC-*\`, \`BR-*\`, \`FR-*\`, and \`QR-*\` drafts.
14873
+ - **Phase 0 (Greenfield Product Inception)**: When creating a new product from scratch (or when \`specs/product/\` has no baseline), run an iterative discovery interview of **up to 15 questions (or until the product scope is 100% clear and unambiguous)** covering: mission/problem, actors \`ACT-*\`, role/auth model, **target UI/interaction modality (Web UI, Desktop GUI, Console/TUI/CLI, Mobile, or API/SDK)**, master-data CRUD prerequisites, MVP capabilities \`UC-*\`, business rules \`BR-*\`, and priority quality goals \`QR-*\`; then draft \`ARCH-INTRO-001\` (\`templates/architecture/introduction-and-goals.template.md\`), and derive initial \`ACT-*\`, \`UC-*\`, \`BR-*\`, \`FR-*\`, and \`QR-*\` drafts.
14379
14874
  - **Input**: Business intent or natural language specification.
14380
14875
  - **Output**: Markdown artifacts with YAML frontmatter compliant with \`schemas/architecture/introduction-and-goals.schema.json\` (\`ARCH-INTRO-*\`) and \`schemas/product/\` (\`ACT-*\`, \`UC-*\`, \`FR-*\`, \`QR-*\`, \`BR-*\`).
14381
14876
  - **Guardrails**:
14877
+ - **FORBIDDEN Library-Only MVP for Human Actors**: Whenever primary actors (\`ACT-*\`) are human users, the target UI modality (Web, Desktop, Console/CLI, or Mobile) MUST be explicitly defined at Inception, and the MVP baseline MUST include a runnable presentation interface matching that modality, authentication/session access (when multi-role), and CRUD flows for foundational master entities required to execute the core business use cases without manual database seeding.
14382
14878
  - \`status\` always starts in \`draft\`.
14383
14879
  - In \`UC-*\`, format section \`1. Intent and Outcome\` under the standard English structure: \`As a <ACT-ID>... I want <action>... To <outcome>...\`.
14384
14880
  - Mandatory Gherkin criteria with \`@<ID> @automated @regression\`.
@@ -14406,6 +14902,7 @@ This file defines the operational rules and specialized role mappings for Google
14406
14902
  - **Output**: Architecture components (\`CMP-*\`), Mermaid diagrams, and immutable \`ADR-*\` records compliant with \`schemas/architecture/\`.
14407
14903
  - **Guardrails**:
14408
14904
  - Every \`CMP-*\` must declare \`satisfies-requirements\` linking \`FR-*\`, \`QR-*\`, \`SEC-REQ-*\`, and \`PRIV-REQ-*\`, and structure modules following **Modular & Hexagonal Architecture (Ports & Adapters)** (Domain/Application Core + Inbound/Outbound Ports, enforcing the Dependency Rule).
14905
+ - **No Orphan Presentation Components (\`CMP-WEB-*\` / \`CMP-UI-*\` / \`CMP-CLI-*\`)**: Never leave a presentation driving adapter unmapped in \`tasks.md\` while scheduling only backend class-library tasks. Wave 0 (\`CHG-001\`) must bootstrap the runnable host shell for the agreed UI modality (Web, Desktop, or Console/CLI) when human actors exist, and every human-facing \`CHG-*\` must deliver its vertical slice end-to-end (Domain + Persistence + Agreed UI/CLI Adapter + E2E).
14409
14906
  - Emit a return handoff to \`agent-threat-modeler\` (chaining to \`agent-privacy-officer\`) in the technical security/privacy feedback loop when infrastructure or persistence decisions introduce new attack vectors or PII flows.
14410
14907
 
14411
14908
  ### 5. \`agent-qa-engineer\` (QA Engineer and SDET)
@@ -14447,7 +14944,7 @@ This file defines the operational rules and specialized role mappings for Google
14447
14944
  ### 9. \`agent-expert-user\` (Expert User and Domain Evaluator)
14448
14945
  - **Mission**: Contrast design and specifications (design phase) and functionally validate finished software against \`UC-*\` and \`FR-*\` (post-development phase).
14449
14946
  - **Directives**:
14450
- - Design mode (upstream): Adopt the primary actor's profile under stressful field conditions, applying bimodal discrimination (strict MVP core vs. roadmap suggestion backlog in \`templates/product/user-design-feedback.template.md\`).
14947
+ - Design mode (upstream): Adopt the primary actor's profile under stressful field conditions, applying bimodal discrimination (strict MVP core vs. roadmap suggestion backlog in \`templates/product/user-design-feedback.template.md\`). Reject as \`[BLOCKING_DEFECT]\` any library-only MVP proposal for human actors that fails to define or omits the runnable presentation layer (Web, Desktop, or Console/CLI), role access, or master-data CRUD flows.
14451
14948
  - Functional validation mode (downstream / pre-PR / post-development functional validation): Thoroughly contrast interface and actual CLI execution against \`UC-*\` and \`FR-*\` acceptance criteria before pre-merge security audit.
14452
14949
  - Emit handoff block suggesting \`agent-code-reviewer\` / \`agent-security-auditor\` / \`agent-privacy-officer\` if compliant, or return to \`agent-developer\` on functional drift.
14453
14950
 
@@ -14470,6 +14967,14 @@ This file defines the operational rules and specialized role mappings for Google
14470
14967
  - **Cross-Workflow Audit**: When fixing any CI/CD or configuration defect detected in a PR, search all \`.github/workflows/*.yml\` for the same pattern (including release, post-merge, and publishing pipelines) before declaring the fix complete.
14471
14968
  - **Remote Verification**: Creating a PR (\`gh pr create\`) does not equal success; actively verify that remote checks pass (\`gh pr checks\`).
14472
14969
 
14970
+ ### 12. \`agent-auditor\` (Transversal Quality and Improvement Auditor)
14971
+ - **Mission**: Polymorphically inspect deliverables from any specialist agent on demand, identifying structural weaknesses, overengineering, or blind spots, and proposing minimal solutions adhering strictly to YAGNI.
14972
+ - **Directives**: Constructive critique; classify findings into \`[BLOCKING_DEFECT]\`, \`[SIMPLIFICATION]\`, and \`[ADVISORY]\`; non-invasive (never edit files directly); always return handoff to the audited agent (max 1 return round).
14973
+
14974
+ ### 13. \`agent-adversary\` (Transversal Red Team and Chaos Adversary)
14975
+ - **Mission**: Actively attempt to break, bypass, or invalidate deliverables from any target specialist agent, providing concrete proofs-of-concept (PoC), counterexamples, and reproduction steps.
14976
+ - **Directives**: Expose failure modes across Product (logic traps), Architecture (SPOF/races), QA (mutation testing/false greens), Code (boundary/concurrency), and DevOps (pipeline escape); mandatory proof-of-break; non-invasive; always return handoff to the audited agent (max 1 return round).
14977
+
14473
14978
  ---
14474
14979
 
14475
14980
  ## 3. Git 4-Tier Hierarchy and Commit Conventions
@@ -14489,7 +14994,7 @@ This file defines the operational rules and specialized role mappings for Google
14489
14994
  - **Conditional Activation Rule by Autonomy**:
14490
14995
  - \u{1F7E2} **\`AUTONOMOUS\`** (or exclusive final supervision in PR/CI): **OMITTED**. Do not request or emit interactive handoff to avoid interrupting unattended execution.
14491
14996
  - \u{1F7E1} **Autonomy $\\ge$ \`HUMAN_REVIEW_PLAN\`** (\`HUMAN_REVIEW_PLAN\`, \`AMBIGUOUS\`, \`HIGH_RISK_MANUAL\`): **MANDATORY**. Emit the Workflow Handoff block compliant with [\`templates/workflow/agent-handoff.template.md\`](../../templates/workflow/agent-handoff.template.md) and **STOP**.
14492
- - **Block Contents**: Declare produced deliverables, recommend the next role in workflow (\`agent-threat-modeler\`, \`agent-privacy-officer\`, \`agent-system-architect\`, \`agent-qa-engineer\`, \`agent-developer\`, \`agent-expert-user\`, \`agent-code-reviewer\`, \`agent-security-auditor\`, \`agent-compliance-checker\`, \`agent-devops\`, etc.), provide suggested invocation prompt, and keep **the Human Action Window open at all times for the human user to take action** (review, edit by hand, pause/reroute, or delegate).
14997
+ - **Block Contents**: Declare produced deliverables, recommend the next role in workflow (\`agent-threat-modeler\`, \`agent-privacy-officer\`, \`agent-system-architect\`, \`agent-qa-engineer\`, \`agent-developer\`, \`agent-expert-user\`, \`agent-code-reviewer\`, \`agent-security-auditor\`, \`agent-compliance-checker\`, \`agent-devops\`, \`agent-auditor\`, \`agent-adversary\`, etc.), provide suggested invocation prompt, and keep **the Human Action Window open at all times for the human user to take action** (review, edit by hand, pause/reroute, or delegate).
14493
14998
  `;
14494
14999
  var STARTER_CURSOR_CORE_RULES = `---
14495
15000
  description: Global canonical directives, 5 unbreakable commandments, and AI-SDLC pre-flight
@@ -14525,7 +15030,7 @@ Before finalizing changes or proposing commits:
14525
15030
  ## 4. Specialized Roles Mapping
14526
15031
  | Role | Mission (summary) |
14527
15032
  | :--- | :--- |
14528
- | \`agent-product-analyst\` | Phase 0 NAF v4 Enterprise & Capability Vision (\`ARCH-INTRO-*\`, 3\u20135 question interview) + ProductShape artifacts (\`ACT-*\`, \`UC-*\`, \`FR-*\`, \`QR-*\`, \`BR-*\`); status starts \`draft\`. |
15033
+ | \`agent-product-analyst\` | Phase 0 NAF v4 Enterprise & Capability Vision (\`ARCH-INTRO-*\`, up to 15-question discovery interview defining UI modality & CRUD prerequisites) + ProductShape artifacts (\`ACT-*\`, \`UC-*\`, \`FR-*\`, \`QR-*\`, \`BR-*\`); status starts \`draft\`. |
14529
15034
  | \`agent-threat-modeler\` | STRIDE/OWASP threat triad (\`ACT-THREAT-*\`, \`ABUSE-*\`, \`SEC-REQ-*\`); hands off to \`agent-privacy-officer\`. |
14530
15035
  | \`agent-privacy-officer\` | LINDDUN & GDPR/LOPDGDD privacy triad (\`DATA-ASSET-*\`, \`PRIV-ROPA-*\`, \`PRIV-REQ-*\`) + Pre-Merge \`verify:privacy\`. |
14531
15036
  | \`agent-system-architect\` | Modular arc42 + NAF v4 architecture (\`CMP-*\`, Mermaid diagrams, \`ADR-*\`). |
@@ -14536,6 +15041,8 @@ Before finalizing changes or proposing commits:
14536
15041
  | \`agent-expert-user\` | Bimodal MVP evaluation (design) and functional validation against \`UC-*\` and \`FR-*\` (pre-PR). |
14537
15042
  | \`agent-code-reviewer\` | PR audit (SOLID, DRY, YAGNI): \`[BLOCKING]\` / \`[CLEAN_CODE_SUGGESTION]\` / \`[COMPLIANT]\`. |
14538
15043
  | \`agent-devops\` | CI/CD, Docker, IaC only \u2014 **FORBIDDEN** to touch \`src/\` or \`packages/*/src/\`. |
15044
+ | \`agent-auditor\` | Transversal on-demand constructive auditor; identifies overengineering, blind spots & YAGNI simplifications; returns handoff to audited agent. |
15045
+ | \`agent-adversary\` | Transversal on-demand Red Team adversary; breaks deliverables with reproducible PoC & mutation tests; returns handoff to audited agent. |
14539
15046
 
14540
15047
  ## 5. Task Autonomy Modes (\`tasks.md\`)
14541
15048
  - \u{1F7E2} **\`AUTONOMOUS\`**: Low risk. Implement directly, omit handoff block.
@@ -14576,7 +15083,7 @@ Every generated or modified artifact must follow canonical naming and satisfy it
14576
15083
  - Privacy Requirements: \`PRIV-REQ-[SUFFIX]\` (\`schemas/privacy/privacy-req.schema.json\`)
14577
15084
 
14578
15085
  ## 2. "AI as Scribe" Protocol Rules
14579
- - **Phase 0 (New Product Inception)**: When starting a new product, conduct a 3\u20135 question discovery interview, instantiate \`ARCH-INTRO-001\` (\`naf-perspective: "Enterprise & Capability"\`) in \`draft\`, and derive \`ACT-*\`, \`UC-*\`, \`BR-*\`, \`FR-*\`, and \`QR-*\`.
15086
+ - **Phase 0 (New Product Inception)**: When starting a new product, conduct an iterative discovery interview of up to 15 questions (or until the product scope and target UI modality \u2014 Web, Desktop, Console/CLI, Mobile, or API/SDK \u2014 are completely clear), instantiate \`ARCH-INTRO-001\` (\`naf-perspective: "Enterprise & Capability"\`) in \`draft\`, and derive \`ACT-*\`, \`UC-*\`, \`BR-*\`, \`FR-*\`, and \`QR-*\` (including runnable UI/CLI requirements and master-entity CRUD prerequisites when human actors exist).
14580
15087
  - **Initial Status**: Every new artifact strictly starts with \`status: draft\`. Creating artifacts directly as \`active\` or \`approved\` is forbidden.
14581
15088
  - **Gherkin Acceptance Criteria**: In every \`FR-*\` requirement, include a \`\`\`gherkin block with tags \`@<ID> @automated @regression\` and at least one \`Scenario Outline\` with an \`Examples\` data table.
14582
15089
  - **Security & Privacy Mitigations**: Every \`SEC-REQ-*\` must include negative Gherkin tests (\`@security @mitigation\`) and every \`PRIV-REQ-*\` must include Gherkin privacy scenarios (\`@privacy @gdpr\`).
@@ -14662,10 +15169,10 @@ npx tsx packages/cli/src/index.ts sdd integrate --change <chg-id>
14662
15169
 
14663
15170
  ### 1. \`agent-product-analyst\` (Product Analyst / Scribe)
14664
15171
  - **Mission**: Capture new product intent via NAF v4 Enterprise & Capability Vision (\`ARCH-INTRO-*\`) and define/refine the product model using ProductShape.
14665
- - **Phase 0 (Greenfield Product Inception)**: When creating a new product from scratch (or when \`specs/product/\` has no baseline), run a concise 3\u20135 question discovery interview (mission/problem, actors \`ACT-*\`, MVP capabilities \`UC-*\`, priority quality goals \`QR-*\`), draft \`ARCH-INTRO-001\` (\`templates/architecture/introduction-and-goals.template.md\`), and derive initial \`ACT-*\`, \`UC-*\`, \`BR-*\`, \`FR-*\`, and \`QR-*\` drafts.
15172
+ - **Phase 0 (Greenfield Product Inception)**: When creating a new product from scratch (or when \`specs/product/\` has no baseline), run an iterative discovery interview of **up to 15 questions (or until the product scope is 100% clear and unambiguous)** covering: mission/problem, actors \`ACT-*\`, role/auth model, **target UI/interaction modality (Web UI, Desktop GUI, Console/TUI/CLI, Mobile, or API/SDK)**, master-data CRUD prerequisites, MVP capabilities \`UC-*\`, business rules \`BR-*\`, and priority quality goals \`QR-*\`; then draft \`ARCH-INTRO-001\` (\`templates/architecture/introduction-and-goals.template.md\`), and derive initial \`ACT-*\`, \`UC-*\`, \`BR-*\`, \`FR-*\`, and \`QR-*\` drafts.
14666
15173
  - **Input**: Business intent or natural language specification.
14667
15174
  - **Output**: Markdown artifacts with YAML frontmatter compliant with \`schemas/architecture/introduction-and-goals.schema.json\` (\`ARCH-INTRO-*\`) and \`schemas/product/\` (\`ACT-*\`, \`UC-*\`, \`FR-*\`, \`QR-*\`, \`BR-*\`).
14668
- - **Guardrails**: \`status\` always starts in \`draft\`. Mandatory Gherkin criteria with \`@<ID> @automated @regression\`.
15175
+ - **Guardrails**: \`status\` always starts in \`draft\`. Library-only MVPs without the agreed runnable UI/CLI entry point and master-data CRUDs for human actors are forbidden. Mandatory Gherkin criteria with \`@<ID> @automated @regression\`.
14669
15176
 
14670
15177
  ### 2. \`agent-threat-modeler\` (Threat Modeler and Security Specialist)
14671
15178
  - **Mission**: Analyze use cases and proactively model adversaries, STRIDE attack vectors, and OWASP ASVS mitigations, both at product level and in the technical security feedback loop over architecture, handing off to \`agent-privacy-officer\`.
@@ -14706,6 +15213,14 @@ npx tsx packages/cli/src/index.ts sdd integrate --change <chg-id>
14706
15213
  - **Mission**: Maintain, evolve, and audit automated project infrastructure: CI/CD workflows, Docker containers, IaC manifests, and support scripts.
14707
15214
  - **NON-INVASION GUARDRAIL**: STRICTLY FORBIDDEN from modifying application source code (\`src/\`, \`packages/*/src/\`).
14708
15215
 
15216
+ ### 12. \`agent-auditor\` (Transversal Quality and Improvement Auditor)
15217
+ - **Mission**: Polymorphically inspect deliverables from any specialist agent on demand, identifying structural weaknesses, overengineering, or blind spots, and proposing minimal solutions adhering strictly to YAGNI.
15218
+ - **Directives**: Constructive critique; classify findings into \`[BLOCKING_DEFECT]\`, \`[SIMPLIFICATION]\`, and \`[ADVISORY]\`; non-invasive (never edit files directly); always return handoff to the audited agent (max 1 return round).
15219
+
15220
+ ### 13. \`agent-adversary\` (Transversal Red Team and Chaos Adversary)
15221
+ - **Mission**: Actively attempt to break, bypass, or invalidate deliverables from any target specialist agent, providing concrete proofs-of-concept (PoC), counterexamples, and reproduction steps.
15222
+ - **Directives**: Expose failure modes across Product (logic traps), Architecture (SPOF/races), QA (mutation testing/false greens), Code (boundary/concurrency), and DevOps (pipeline escape); mandatory proof-of-break; non-invasive; always return handoff to the audited agent (max 1 return round).
15223
+
14709
15224
  ---
14710
15225
 
14711
15226
  ## 4. Task Autonomy Modes (\`tasks.md\`)
@@ -14829,7 +15344,7 @@ Non-Negotiable Quality Thresholds (\`quality-policy.yaml\`):
14829
15344
 
14830
15345
  | Role | Mission (summary) |
14831
15346
  | :--- | :--- |
14832
- | \`agent-product-analyst\` | Phase 0 NAF v4 Enterprise & Capability Vision (\`ARCH-INTRO-*\`, 3\u20135 question interview) + ProductShape artifacts (\`ACT-*\`, \`UC-*\`, \`FR-*\`, \`QR-*\`, \`BR-*\`); \`status\` starts \`draft\`. |
15347
+ | \`agent-product-analyst\` | Phase 0 NAF v4 Enterprise & Capability Vision (\`ARCH-INTRO-*\`, up to 15-question discovery interview defining UI modality & CRUD prerequisites) + ProductShape artifacts (\`ACT-*\`, \`UC-*\`, \`FR-*\`, \`QR-*\`, \`BR-*\`); \`status\` starts \`draft\`. |
14833
15348
  | \`agent-threat-modeler\` | STRIDE/OWASP threat triad (\`ACT-THREAT-*\`, \`ABUSE-*\`, \`SEC-REQ-*\`); hands off to \`agent-privacy-officer\`. |
14834
15349
  | \`agent-privacy-officer\` | LINDDUN & GDPR/LOPDGDD privacy triad (\`DATA-ASSET-*\`, \`PRIV-ROPA-*\`, \`PRIV-REQ-*\`) + Pre-Merge \`verify:privacy\`. |
14835
15350
  | \`agent-system-architect\` | Modular arc42 + NAF v4 architecture (\`CMP-*\`, Mermaid diagrams, \`ADR-*\`). |
@@ -14840,6 +15355,8 @@ Non-Negotiable Quality Thresholds (\`quality-policy.yaml\`):
14840
15355
  | \`agent-expert-user\` | Bimodal MVP evaluation (design) and functional validation against \`UC-*\` and \`FR-*\` (pre-PR). |
14841
15356
  | \`agent-code-reviewer\` | PR audit (SOLID, DRY, YAGNI): \`[BLOCKING]\` / \`[CLEAN_CODE_SUGGESTION]\` / \`[COMPLIANT]\`. |
14842
15357
  | \`agent-devops\` | CI/CD, Docker, IaC only \u2014 **FORBIDDEN** to touch \`src/\` or \`packages/*/src/\`. |
15358
+ | \`agent-auditor\` | Transversal on-demand constructive auditor; identifies overengineering, blind spots & YAGNI simplifications; returns handoff to audited agent. |
15359
+ | \`agent-adversary\` | Transversal on-demand Red Team adversary; breaks deliverables with reproducible PoC & mutation tests; returns handoff to audited agent. |
14843
15360
 
14844
15361
  ---
14845
15362
 
@@ -16001,6 +16518,522 @@ var STARTER_BASE_TEMPLATES = [
16001
16518
  { relPath: "process/README.md", content: STARTER_PROCESS_README },
16002
16519
  { relPath: "compliance/license-manifest.yaml", content: STARTER_COMPLIANCE_LICENSE_MANIFEST_YAML }
16003
16520
  ];
16521
+ var VALID_CODING_RULE_STACKS = [
16522
+ "dotnet",
16523
+ "typescript",
16524
+ "javascript",
16525
+ "angular",
16526
+ "java",
16527
+ "kotlin",
16528
+ "rust",
16529
+ "go",
16530
+ "c",
16531
+ "cpp"
16532
+ ];
16533
+ var PROTECTED_CODING_RULES_FILES = [
16534
+ "Directory.Build.props",
16535
+ "tsconfig.strict.json",
16536
+ "eslint.config.mjs",
16537
+ "gradle/init.d/aisdlc-strict.init.gradle.kts",
16538
+ "config/pmd/aisdlc-ruleset.xml",
16539
+ "config/detekt/detekt.yml",
16540
+ ".cargo/config.toml",
16541
+ ".clippy.toml",
16542
+ ".golangci.yml",
16543
+ ".clang-tidy",
16544
+ "cmake/AisdlcStrictCompiler.cmake",
16545
+ ".github/CODEOWNERS"
16546
+ ];
16547
+ var DOTNET_DIRECTORY_BUILD_PROPS = `<Project>
16548
+ <!-- 1. Global strict compiler and analyzer rules for all projects (src and tests) -->
16549
+ <PropertyGroup>
16550
+ <Nullable>enable</Nullable>
16551
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
16552
+ <AnalysisLevel>latest-recommended</AnalysisLevel>
16553
+ <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
16554
+ </PropertyGroup>
16555
+
16556
+ <!-- 2. Strict unit/E2E test guardrails (xUnit, MSTest, NUnit) -->
16557
+ <PropertyGroup Condition="'$(IsTestProject)' == 'true' or $(MSBuildProjectName.EndsWith('Tests')) or $(MSBuildProjectName.EndsWith('Test'))">
16558
+ <IsTestProject>true</IsTestProject>
16559
+ <NoWarn>$(NoWarn);CA1707;CA2007</NoWarn>
16560
+ <MSTestAnalysisMode>Recommended</MSTestAnalysisMode>
16561
+ <WarningsAsErrors>$(WarningsAsErrors);S2699;S1607;MSTEST0006;MSTEST0014;MSTEST0015;MSTEST0017;MSTEST0032;xUnit1026;xUnit1013</WarningsAsErrors>
16562
+ </PropertyGroup>
16563
+
16564
+ <ItemGroup Condition="'$(IsTestProject)' == 'true' or $(MSBuildProjectName.EndsWith('Tests')) or $(MSBuildProjectName.EndsWith('Test'))">
16565
+ <PackageReference Include="SonarAnalyzer.CSharp" Version="10.*">
16566
+ <PrivateAssets>all</PrivateAssets>
16567
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
16568
+ </PackageReference>
16569
+ </ItemGroup>
16570
+ </Project>
16571
+ `;
16572
+ var TS_STRICT_TSCONFIG = `{
16573
+ "$schema": "https://json.schemastore.org/tsconfig",
16574
+ "compilerOptions": {
16575
+ "strict": true,
16576
+ "allowJs": true,
16577
+ "checkJs": true,
16578
+ "noImplicitOverride": true,
16579
+ "noPropertyAccessFromIndexSignature": true,
16580
+ "noImplicitReturns": true,
16581
+ "noFallthroughCasesInSwitch": true,
16582
+ "noUnusedLocals": true,
16583
+ "noUnusedParameters": true,
16584
+ "noUncheckedIndexedAccess": true,
16585
+ "exactOptionalPropertyTypes": true,
16586
+ "forceConsistentCasingInFileNames": true
16587
+ },
16588
+ "angularCompilerOptions": {
16589
+ "strictInjectionParameters": true,
16590
+ "strictInputAccessModifiers": true,
16591
+ "strictTemplates": true,
16592
+ "strictStandalone": true,
16593
+ "extendedDiagnostics": {
16594
+ "defaultCategory": "error"
16595
+ }
16596
+ }
16597
+ }
16598
+ `;
16599
+ var TS_ESLINT_CONFIG_MJS = `// AI-SDLC: Immutable Strict Coding & Test Rules for TypeScript / JavaScript / Angular
16600
+ import tseslint from "typescript-eslint";
16601
+
16602
+ export default tseslint.config(
16603
+ {
16604
+ files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
16605
+ extends: [...tseslint.configs.strictTypeChecked],
16606
+ languageOptions: {
16607
+ parserOptions: {
16608
+ projectService: true,
16609
+ },
16610
+ },
16611
+ rules: {
16612
+ "@typescript-eslint/no-explicit-any": "error",
16613
+ "@typescript-eslint/ban-ts-comment": "error",
16614
+ "@typescript-eslint/no-floating-promises": "error",
16615
+ "@typescript-eslint/await-thenable": "error",
16616
+ "@typescript-eslint/no-misused-promises": "error",
16617
+ "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
16618
+ },
16619
+ },
16620
+ {
16621
+ files: ["**/*.spec.ts", "**/*.test.ts", "**/*.spec.js", "**/*.test.js"],
16622
+ rules: {
16623
+ "no-restricted-globals": [
16624
+ "error",
16625
+ { "name": "fit", "message": "Focused tests (fit) are forbidden by AI-SDLC." },
16626
+ { "name": "fdescribe", "message": "Focused suites (fdescribe) are forbidden by AI-SDLC." },
16627
+ { "name": "xit", "message": "Skipped tests (xit) are forbidden by AI-SDLC." },
16628
+ { "name": "xdescribe", "message": "Skipped suites (xdescribe) are forbidden by AI-SDLC." }
16629
+ ]
16630
+ }
16631
+ }
16632
+ );
16633
+ `;
16634
+ var GRADLE_STRICT_INIT_KTS = `// AI-SDLC: Immutable Gradle Strict Compiler & Test Guardrails (Java & Kotlin)
16635
+ allprojects {
16636
+ tasks.withType<JavaCompile>().configureEach {
16637
+ options.compilerArgs.addAll(listOf("-Werror", "-Xlint:all", "-Xlint:-processing"))
16638
+ }
16639
+ tasks.withType<Test>().configureEach {
16640
+ useJUnitPlatform()
16641
+ failOnNoDiscoveredTests.set(true)
16642
+ }
16643
+ }
16644
+ `;
16645
+ var JAVA_PMD_RULESET_XML = `<?xml version="1.0" encoding="UTF-8"?>
16646
+ <ruleset name="AI-SDLC Strict Java &amp; JUnit Rules"
16647
+ xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
16648
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
16649
+ xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.github.io/schema/ruleset_2_0_0.xsd">
16650
+ <description>AI-SDLC Mandatory Java &amp; Unit Test Verification Rules</description>
16651
+ <rule ref="category/java/bestpractices.xml/JUnitTestsShouldIncludeAssert" />
16652
+ <rule ref="category/java/bestpractices.xml/UnusedLocalVariable" />
16653
+ <rule ref="category/java/bestpractices.xml/UnusedPrivateMethod" />
16654
+ <rule ref="category/java/errorprone.xml/EmptyCatchBlock" />
16655
+ </ruleset>
16656
+ `;
16657
+ var KOTLIN_DETEKT_YML = `# AI-SDLC: Immutable Detekt Rules for Kotlin & Unit Tests
16658
+ build:
16659
+ maxIssues: 0
16660
+
16661
+ potential-bugs:
16662
+ active: true
16663
+ IgnoredReturnValue:
16664
+ active: true
16665
+ UnreachableCode:
16666
+ active: true
16667
+
16668
+ exceptions:
16669
+ active: true
16670
+ SwallowedException:
16671
+ active: true
16672
+ EmptyCatchBlock:
16673
+ active: true
16674
+
16675
+ style:
16676
+ active: true
16677
+ ForbiddenAnnotation:
16678
+ active: true
16679
+ annotations:
16680
+ - 'org.junit.jupiter.api.Disabled'
16681
+ - 'org.junit.Ignore'
16682
+ - 'kotlin.test.Ignore'
16683
+ `;
16684
+ var RUST_CARGO_CONFIG_TOML = `# AI-SDLC: Immutable Rust Compiler & Clippy Guardrails
16685
+ [build]
16686
+ rustflags = [
16687
+ "-D", "warnings",
16688
+ "-D", "unused-must-use",
16689
+ "-D", "dead-code",
16690
+ "-D", "clippy::all",
16691
+ "-D", "clippy::unwrap_used",
16692
+ "-D", "clippy::todo",
16693
+ "-D", "clippy::unimplemented",
16694
+ "-D", "clippy::ignore_without_reason",
16695
+ "-D", "clippy::assertions_on_constants"
16696
+ ]
16697
+ `;
16698
+ var RUST_CLIPPY_TOML = `# AI-SDLC: Clippy configuration
16699
+ allow-unwrap-in-tests = true
16700
+ `;
16701
+ var GO_GOLANGCI_YML = `# AI-SDLC: Immutable Go & Testing Linter Guardrails
16702
+ run:
16703
+ tests: true
16704
+
16705
+ issues:
16706
+ max-issues-per-linter: 0
16707
+ max-same-issues: 0
16708
+
16709
+ linters:
16710
+ enable:
16711
+ - errcheck
16712
+ - govet
16713
+ - staticcheck
16714
+ - unused
16715
+ - ineffassign
16716
+ - testifylint
16717
+ - thelper
16718
+ - forbidigo
16719
+
16720
+ linters-settings:
16721
+ testifylint:
16722
+ enable-all: true
16723
+ forbidigo:
16724
+ analyze-types: true
16725
+ forbid:
16726
+ - p: ^testing\\.T\\.Skip.*$
16727
+ msg: "Skipping unit tests with t.Skip() is forbidden by AI-SDLC."
16728
+ `;
16729
+ var CPP_CLANG_TIDY = `# AI-SDLC: Immutable C/C++ Clang-Tidy Guardrails
16730
+ Checks: >
16731
+ -*,
16732
+ bugprone-*,
16733
+ cert-*,
16734
+ clang-analyzer-*,
16735
+ cppcoreguidelines-*,
16736
+ modernize-*,
16737
+ performance-*,
16738
+ readability-*
16739
+ WarningsAsErrors: '*'
16740
+ `;
16741
+ var CPP_CMAKE_STRICT = `# AI-SDLC: Immutable C/C++ Compiler & CTest Guardrails
16742
+ if(MSVC)
16743
+ add_compile_options(/W4 /WX /permissive-)
16744
+ else()
16745
+ add_compile_options(-Wall -Wextra -Wpedantic -Werror -Wnull-dereference -Wunused-result)
16746
+ endif()
16747
+
16748
+ set(CMAKE_CXX_CLANG_TIDY "clang-tidy")
16749
+ set(CMAKE_C_CLANG_TIDY "clang-tidy")
16750
+ `;
16751
+ var STARTER_ANTIGRAVITY_HOOKS_JSON = `{
16752
+ "branch-guard": {
16753
+ "enabled": true,
16754
+ "PreToolUse": [
16755
+ {
16756
+ "matcher": "edit_file|write_file",
16757
+ "hooks": [
16758
+ {
16759
+ "type": "command",
16760
+ "command": "node scripts/guard-branch.cjs",
16761
+ "timeout": 10
16762
+ }
16763
+ ]
16764
+ }
16765
+ ]
16766
+ }
16767
+ }
16768
+ `;
16769
+ var STARTER_AGENT_GUARD_WRAPPER_CJS = `#!/usr/bin/env node
16770
+ // Forwarding wrapper or direct execution from .agent
16771
+ require('../../scripts/guard-branch.cjs');
16772
+ `;
16773
+ var STARTER_GUARD_BRANCH_CJS = `#!/usr/bin/env node
16774
+ /**
16775
+ * AI-SDLC: Antigravity PreToolUse Branch & Immutable Coding Rules Guard Hook
16776
+ * 1. Prevents AI agents from modifying or writing files directly on protected branches (main, master, release/*).
16777
+ * 2. Prevents AI agents from modifying or weakening deployed coding rules files once created.
16778
+ */
16779
+
16780
+ const { execSync } = require('child_process');
16781
+ const path = require('path');
16782
+
16783
+ const PROTECTED_CODING_RULES_FILES = [
16784
+ 'Directory.Build.props',
16785
+ 'tsconfig.strict.json',
16786
+ 'eslint.config.mjs',
16787
+ 'gradle/init.d/aisdlc-strict.init.gradle.kts',
16788
+ 'config/pmd/aisdlc-ruleset.xml',
16789
+ 'config/detekt/detekt.yml',
16790
+ '.cargo/config.toml',
16791
+ '.clippy.toml',
16792
+ '.golangci.yml',
16793
+ '.clang-tidy',
16794
+ 'cmake/AisdlcStrictCompiler.cmake',
16795
+ '.github/CODEOWNERS',
16796
+ ];
16797
+
16798
+ function getWorkingBranch(cwd) {
16799
+ try {
16800
+ const sym = execSync('git symbolic-ref --short HEAD', {
16801
+ cwd,
16802
+ encoding: 'utf-8',
16803
+ stdio: ['pipe', 'pipe', 'ignore'],
16804
+ }).trim();
16805
+ if (sym) return sym;
16806
+ } catch {}
16807
+
16808
+ try {
16809
+ return execSync('git rev-parse --abbrev-ref HEAD', {
16810
+ cwd,
16811
+ encoding: 'utf-8',
16812
+ stdio: ['pipe', 'pipe', 'ignore'],
16813
+ }).trim();
16814
+ } catch {}
16815
+
16816
+ return '';
16817
+ }
16818
+
16819
+ function isProtectedCodingRulesTarget(targetPath, cwd) {
16820
+ if (!targetPath) return false;
16821
+ const resolved = path.resolve(cwd, targetPath);
16822
+
16823
+ const norm = resolved.replace(/\\\\/g, '/');
16824
+ const rel = path.relative(cwd, resolved).replace(/\\\\/g, '/');
16825
+ return PROTECTED_CODING_RULES_FILES.some(
16826
+ (ruleFile) => rel === ruleFile || norm.endsWith('/' + ruleFile)
16827
+ ) || rel.startsWith('templates/coding-rules/');
16828
+ }
16829
+
16830
+ function evaluateGuardDecision(payload) {
16831
+ const targetPath = payload.toolCall?.args?.Path || '';
16832
+ const workspacePaths = payload.workspacePaths || [];
16833
+ const cwd = workspacePaths[0] || process.cwd();
16834
+ const resolvedPath = targetPath ? path.resolve(cwd, targetPath) : '';
16835
+ const normPath = resolvedPath.replace(/\\\\/g, '/');
16836
+
16837
+ if (isProtectedCodingRulesTarget(resolvedPath, cwd)) {
16838
+ return {
16839
+ decision: 'deny',
16840
+ reason: \`\u274C [AI-SDLC Immutable Coding Rules Guard] BLOCKED: AI agents are forbidden from modifying protected coding rules file '\${path.basename(targetPath)}'. Fix the source or test code to satisfy the compiler/linter rules instead of altering the rule configuration.\`,
16841
+ };
16842
+ }
16843
+
16844
+ if (
16845
+ normPath.includes('/.gemini/') ||
16846
+ normPath.includes('/brain/') ||
16847
+ normPath.includes('/scratch/')
16848
+ ) {
16849
+ return { decision: 'allow' };
16850
+ }
16851
+
16852
+ const branch = getWorkingBranch(cwd);
16853
+ if (/^(main|master|release\\/.*)$/.test(branch)) {
16854
+ return {
16855
+ decision: 'deny',
16856
+ reason: \`\u274C [AI-SDLC Security Guard] BLOCKED: Direct file modifications on protected branch '\${branch}' are forbidden. You must create and checkout a new working branch first before editing files (e.g. 'git checkout -b feat/<CHG-ID>-<slug>' or 'git checkout -b task/<PARENT-ID>/<TSK-ID>-<slug>').\`,
16857
+ };
16858
+ }
16859
+
16860
+ return { decision: 'allow' };
16861
+ }
16862
+
16863
+ function main() {
16864
+ let input = '';
16865
+ process.stdin.setEncoding('utf-8');
16866
+ process.stdin.on('data', (chunk) => {
16867
+ input += chunk;
16868
+ });
16869
+ process.stdin.on('end', () => {
16870
+ try {
16871
+ const payload = input.trim() ? JSON.parse(input) : {};
16872
+ console.log(JSON.stringify(evaluateGuardDecision(payload)));
16873
+ } catch {
16874
+ console.log(JSON.stringify({ decision: 'allow' }));
16875
+ }
16876
+ });
16877
+ }
16878
+
16879
+ main();
16880
+ `;
16881
+ var STACK_FILE_MAP = {
16882
+ dotnet: [{ relPath: "Directory.Build.props", content: DOTNET_DIRECTORY_BUILD_PROPS }],
16883
+ typescript: [
16884
+ { relPath: "tsconfig.strict.json", content: TS_STRICT_TSCONFIG },
16885
+ { relPath: "eslint.config.mjs", content: TS_ESLINT_CONFIG_MJS }
16886
+ ],
16887
+ javascript: [
16888
+ { relPath: "tsconfig.strict.json", content: TS_STRICT_TSCONFIG },
16889
+ { relPath: "eslint.config.mjs", content: TS_ESLINT_CONFIG_MJS }
16890
+ ],
16891
+ angular: [
16892
+ { relPath: "tsconfig.strict.json", content: TS_STRICT_TSCONFIG },
16893
+ { relPath: "eslint.config.mjs", content: TS_ESLINT_CONFIG_MJS }
16894
+ ],
16895
+ java: [
16896
+ { relPath: "gradle/init.d/aisdlc-strict.init.gradle.kts", content: GRADLE_STRICT_INIT_KTS },
16897
+ { relPath: "config/pmd/aisdlc-ruleset.xml", content: JAVA_PMD_RULESET_XML }
16898
+ ],
16899
+ kotlin: [
16900
+ { relPath: "gradle/init.d/aisdlc-strict.init.gradle.kts", content: GRADLE_STRICT_INIT_KTS },
16901
+ { relPath: "config/detekt/detekt.yml", content: KOTLIN_DETEKT_YML }
16902
+ ],
16903
+ rust: [
16904
+ { relPath: ".cargo/config.toml", content: RUST_CARGO_CONFIG_TOML },
16905
+ { relPath: ".clippy.toml", content: RUST_CLIPPY_TOML }
16906
+ ],
16907
+ go: [{ relPath: ".golangci.yml", content: GO_GOLANGCI_YML }],
16908
+ c: [
16909
+ { relPath: ".clang-tidy", content: CPP_CLANG_TIDY },
16910
+ { relPath: "cmake/AisdlcStrictCompiler.cmake", content: CPP_CMAKE_STRICT }
16911
+ ],
16912
+ cpp: [
16913
+ { relPath: ".clang-tidy", content: CPP_CLANG_TIDY },
16914
+ { relPath: "cmake/AisdlcStrictCompiler.cmake", content: CPP_CMAKE_STRICT }
16915
+ ]
16916
+ };
16917
+ function getReferenceCodingRulesTemplates() {
16918
+ return [
16919
+ { relPath: "templates/coding-rules/dotnet/Directory.Build.props", content: DOTNET_DIRECTORY_BUILD_PROPS },
16920
+ { relPath: "templates/coding-rules/typescript/tsconfig.strict.json", content: TS_STRICT_TSCONFIG },
16921
+ { relPath: "templates/coding-rules/typescript/eslint.config.mjs", content: TS_ESLINT_CONFIG_MJS },
16922
+ { relPath: "templates/coding-rules/jvm/aisdlc-strict.init.gradle.kts", content: GRADLE_STRICT_INIT_KTS },
16923
+ { relPath: "templates/coding-rules/java/aisdlc-ruleset.xml", content: JAVA_PMD_RULESET_XML },
16924
+ { relPath: "templates/coding-rules/kotlin/detekt.yml", content: KOTLIN_DETEKT_YML },
16925
+ { relPath: "templates/coding-rules/rust/config.toml", content: RUST_CARGO_CONFIG_TOML },
16926
+ { relPath: "templates/coding-rules/rust/.clippy.toml", content: RUST_CLIPPY_TOML },
16927
+ { relPath: "templates/coding-rules/go/.golangci.yml", content: GO_GOLANGCI_YML },
16928
+ { relPath: "templates/coding-rules/cpp/.clang-tidy", content: CPP_CLANG_TIDY },
16929
+ { relPath: "templates/coding-rules/cpp/AisdlcStrictCompiler.cmake", content: CPP_CMAKE_STRICT }
16930
+ ];
16931
+ }
16932
+ function hasFileMatching(entries, suffixOrName) {
16933
+ return entries.some((e) => e === suffixOrName || e.endsWith(suffixOrName));
16934
+ }
16935
+ function detectJvmAndNativeStacks(entries, detected) {
16936
+ if (hasFileMatching(entries, "pom.xml") || hasFileMatching(entries, "build.gradle")) {
16937
+ detected.add("java");
16938
+ }
16939
+ if (hasFileMatching(entries, "build.gradle.kts")) {
16940
+ detected.add("java");
16941
+ detected.add("kotlin");
16942
+ }
16943
+ if (hasFileMatching(entries, "Cargo.toml")) detected.add("rust");
16944
+ if (hasFileMatching(entries, "go.mod")) detected.add("go");
16945
+ if (hasFileMatching(entries, "CMakeLists.txt") || hasFileMatching(entries, "Makefile")) {
16946
+ detected.add("cpp");
16947
+ }
16948
+ }
16949
+ function detectProjectStacks(targetDir) {
16950
+ if (!fs8.existsSync(targetDir)) return [];
16951
+ let entries = [];
16952
+ try {
16953
+ entries = fs8.readdirSync(targetDir);
16954
+ } catch {
16955
+ return [];
16956
+ }
16957
+ const detected = /* @__PURE__ */ new Set();
16958
+ if (hasFileMatching(entries, ".sln") || hasFileMatching(entries, ".slnx") || hasFileMatching(entries, ".csproj")) {
16959
+ detected.add("dotnet");
16960
+ }
16961
+ if (hasFileMatching(entries, "angular.json")) detected.add("angular");
16962
+ else if (hasFileMatching(entries, "tsconfig.json")) detected.add("typescript");
16963
+ else if (hasFileMatching(entries, "package.json")) detected.add("javascript");
16964
+ detectJvmAndNativeStacks(entries, detected);
16965
+ return Array.from(detected);
16966
+ }
16967
+ var STACK_ALIASES = {
16968
+ "c#": "dotnet",
16969
+ csharp: "dotnet",
16970
+ cs: "dotnet",
16971
+ net: "dotnet",
16972
+ ".net": "dotnet",
16973
+ ts: "typescript",
16974
+ js: "javascript",
16975
+ ng: "angular",
16976
+ kt: "kotlin",
16977
+ rs: "rust",
16978
+ golang: "go",
16979
+ "c++": "cpp",
16980
+ cxx: "cpp"
16981
+ };
16982
+ function parseSingleStackToken(token, out) {
16983
+ if (token === "all") {
16984
+ VALID_CODING_RULE_STACKS.forEach((s) => out.add(s));
16985
+ return true;
16986
+ }
16987
+ const mapped = STACK_ALIASES[token] || token;
16988
+ if (VALID_CODING_RULE_STACKS.includes(mapped)) {
16989
+ out.add(mapped);
16990
+ return true;
16991
+ }
16992
+ return false;
16993
+ }
16994
+ function resolveCodingRuleStacks(stackOption, targetDir) {
16995
+ if (stackOption === void 0 || stackOption === null || stackOption === "") {
16996
+ return { valid: true, stacks: detectProjectStacks(targetDir) };
16997
+ }
16998
+ const rawList = Array.isArray(stackOption) ? stackOption : String(stackOption).split(",");
16999
+ const resolved = /* @__PURE__ */ new Set();
17000
+ for (const raw of rawList) {
17001
+ const token = raw.trim().toLowerCase();
17002
+ if (!token || token === "none" || token === "false") continue;
17003
+ if (!parseSingleStackToken(token, resolved)) {
17004
+ return {
17005
+ valid: false,
17006
+ stacks: [],
17007
+ error: `Unrecognized technology stack: '${raw.trim()}'. Valid options: ${VALID_CODING_RULE_STACKS.join(", ")}, all, none.`
17008
+ };
17009
+ }
17010
+ }
17011
+ return { valid: true, stacks: Array.from(resolved) };
17012
+ }
17013
+ function getCodingRulesFilesForStacks(stacks) {
17014
+ const seen = /* @__PURE__ */ new Set();
17015
+ const files = [];
17016
+ for (const stack of stacks) {
17017
+ const entries = STACK_FILE_MAP[stack] || [];
17018
+ for (const entry of entries) {
17019
+ if (!seen.has(entry.relPath)) {
17020
+ seen.add(entry.relPath);
17021
+ files.push(entry);
17022
+ }
17023
+ }
17024
+ }
17025
+ return files;
17026
+ }
17027
+ function isProtectedCodingRulesFile(filePath, rootDir) {
17028
+ const norm = filePath.replace(/\\/g, "/").replace(/^\.\//, "");
17029
+ const rel = rootDir ? path5.relative(rootDir, path5.resolve(rootDir, filePath)).replace(/\\/g, "/") : norm;
17030
+ if (rel.startsWith("templates/coding-rules/") || norm.includes("/templates/coding-rules/")) {
17031
+ return true;
17032
+ }
17033
+ return PROTECTED_CODING_RULES_FILES.some(
17034
+ (protectedRel) => rel === protectedRel || norm === protectedRel || norm.endsWith("/" + protectedRel)
17035
+ );
17036
+ }
16004
17037
 
16005
17038
  // src/init/index.ts
16006
17039
  var VALID_CI_PROVIDERS = ["github", "gitlab", "azure", "bitbucket"];
@@ -16710,7 +17743,12 @@ function resolveAgentTargets(agents) {
16710
17743
  }
16711
17744
  function appendAntigravityFiles(dirs, files) {
16712
17745
  dirs.push(".agent/rules", ".agent/agents", ".agent/skills");
16713
- files.push({ relPath: ".agent/rules/ai-sdlc.md", content: STARTER_ANTIGRAVITY_RULES });
17746
+ files.push(
17747
+ { relPath: ".agent/rules/ai-sdlc.md", content: STARTER_ANTIGRAVITY_RULES },
17748
+ { relPath: ".agent/hooks.json", content: STARTER_ANTIGRAVITY_HOOKS_JSON },
17749
+ { relPath: ".agent/scripts/guard-branch.cjs", content: STARTER_AGENT_GUARD_WRAPPER_CJS },
17750
+ { relPath: "scripts/guard-branch.cjs", content: STARTER_GUARD_BRANCH_CJS }
17751
+ );
16714
17752
  for (const agent of SPECIALIZED_AGENT_TEMPLATES) {
16715
17753
  const content = renderAntigravityAgentFile(agent);
16716
17754
  files.push({ relPath: `.agent/agents/${agent.id}.md`, content });
@@ -16781,24 +17819,25 @@ function collectAgentFiles(targets) {
16781
17819
  appendMcpFiles(dirs, files);
16782
17820
  return { dirs, files };
16783
17821
  }
17822
+ function recordDryRunFile(exists, canOverwrite, relPath, results) {
17823
+ if (exists && canOverwrite) results.filesUpdated.push(relPath);
17824
+ else if (!exists) results.filesCreated.push(relPath);
17825
+ }
17826
+ function persistFileToDisk(fullFilePath, content, exists, relPath, results) {
17827
+ const parentDir = path5.dirname(fullFilePath);
17828
+ if (!fs8.existsSync(parentDir)) fs8.mkdirSync(parentDir, { recursive: true });
17829
+ fs8.writeFileSync(fullFilePath, content, "utf-8");
17830
+ if (exists) results.filesUpdated.push(relPath);
17831
+ else results.filesCreated.push(relPath);
17832
+ }
16784
17833
  function writeSingleFile(fullFilePath, content, relPath, opts, results) {
16785
17834
  const exists = fs8.existsSync(fullFilePath);
17835
+ const canOverwrite = Boolean(opts.force && !PROTECTED_CODING_RULES_FILES.includes(relPath));
16786
17836
  if (opts.dryRun) {
16787
- if (exists && opts.force) results.filesUpdated.push(relPath);
16788
- else if (!exists) results.filesCreated.push(relPath);
17837
+ recordDryRunFile(exists, canOverwrite, relPath, results);
16789
17838
  return;
16790
17839
  }
16791
- const parentDir = path5.dirname(fullFilePath);
16792
- if (!fs8.existsSync(parentDir)) {
16793
- fs8.mkdirSync(parentDir, { recursive: true });
16794
- }
16795
- if (!exists) {
16796
- fs8.writeFileSync(fullFilePath, content, "utf-8");
16797
- results.filesCreated.push(relPath);
16798
- } else if (opts.force) {
16799
- fs8.writeFileSync(fullFilePath, content, "utf-8");
16800
- results.filesUpdated.push(relPath);
16801
- }
17840
+ if (!exists || canOverwrite) persistFileToDisk(fullFilePath, content, exists, relPath, results);
16802
17841
  }
16803
17842
  function writeProjectFiles(destDir, files, dryRun, force) {
16804
17843
  const results = { filesCreated: [], filesUpdated: [] };
@@ -16854,6 +17893,7 @@ var BASE_DIRECTORIES = [
16854
17893
  "templates/sdd",
16855
17894
  "templates/manuals",
16856
17895
  "templates/ci",
17896
+ "templates/coding-rules",
16857
17897
  "templates/workflow",
16858
17898
  "specs",
16859
17899
  "reports",
@@ -16888,25 +17928,32 @@ function createDirectoriesOnDisk(destDir, directories, dryRun) {
16888
17928
  }
16889
17929
  return created;
16890
17930
  }
16891
- function collectStarterFiles(ciProvider, agentFiles = [], archGranularity = "minimal") {
16892
- const files = [
17931
+ function collectPolicyAndSchemaFiles() {
17932
+ return [
16893
17933
  { relPath: "quality-policy.yaml", content: STARTER_QUALITY_POLICY },
16894
17934
  { relPath: "license-policy.yaml", content: STARTER_LICENSE_POLICY },
16895
17935
  { relPath: "privacy-policy.yaml", content: STARTER_PRIVACY_POLICY },
16896
17936
  ...STARTER_BASE_TEMPLATES,
16897
17937
  ...STARTER_SCHEMAS.map((s) => ({ relPath: s.relPath, content: s.content })),
17938
+ ...getReferenceCodingRulesTemplates()
17939
+ ];
17940
+ }
17941
+ function collectArchitectureTemplateFiles(archGranularity) {
17942
+ return getArchitectureTemplates(archGranularity).map((t) => ({
17943
+ relPath: path5.join("templates", "architecture", t.filename).replace(/\\/g, "/"),
17944
+ content: t.content
17945
+ }));
17946
+ }
17947
+ function collectStarterFiles(ciProvider, agentFiles = [], archGranularity = "minimal", stacks = []) {
17948
+ const files = [
17949
+ ...collectPolicyAndSchemaFiles(),
17950
+ ...getCodingRulesFilesForStacks(stacks),
16898
17951
  ...getCiWorkflowFiles(ciProvider),
16899
17952
  ...agentFiles,
16900
- ...getArchitectureTemplates(archGranularity).map((t) => ({
16901
- relPath: path5.join("templates", "architecture", t.filename).replace(/\\/g, "/"),
16902
- content: t.content
16903
- }))
17953
+ ...collectArchitectureTemplateFiles(archGranularity)
16904
17954
  ];
16905
17955
  if (ciProvider === "github" || !ciProvider) {
16906
- files.push({
16907
- relPath: ".github/PULL_REQUEST_TEMPLATE.md",
16908
- content: STARTER_GITHUB_PULL_REQUEST_TEMPLATE
16909
- });
17956
+ files.push({ relPath: ".github/PULL_REQUEST_TEMPLATE.md", content: STARTER_GITHUB_PULL_REQUEST_TEMPLATE });
16910
17957
  }
16911
17958
  return files;
16912
17959
  }
@@ -16974,7 +18021,7 @@ function mergeDirectories(base, extra) {
16974
18021
  }
16975
18022
  return result;
16976
18023
  }
16977
- function buildInitSuccessResult(destDir, directoriesCreated, filesCreated, filesUpdated, ciProvider, agentsConfigured, architectureGranularity, gitHookInstalled) {
18024
+ function buildInitSuccessResult(destDir, directoriesCreated, filesCreated, filesUpdated, ciProvider, agentsConfigured, architectureGranularity, stacksConfigured, gitHookInstalled) {
16978
18025
  return {
16979
18026
  success: true,
16980
18027
  targetDir: destDir,
@@ -16984,6 +18031,7 @@ function buildInitSuccessResult(destDir, directoriesCreated, filesCreated, files
16984
18031
  ciProvider,
16985
18032
  agentsConfigured,
16986
18033
  architectureGranularity,
18034
+ stacksConfigured,
16987
18035
  gitHookInstalled
16988
18036
  };
16989
18037
  }
@@ -16994,182 +18042,37 @@ function validateInitOptions(options) {
16994
18042
  if (!archRes.valid) return { valid: false, archGranularity: "minimal", error: archRes.error };
16995
18043
  return { valid: true, ciProvider: ciRes.provider, archGranularity: archRes.granularity };
16996
18044
  }
16997
- function assembleScaffoldingPlan(ciProvider, agents, archGranularity) {
18045
+ function assembleScaffoldingPlan(ciProvider, agents, archGranularity, stacks = []) {
16998
18046
  const agentTargets = resolveAgentTargets(agents);
16999
18047
  const { dirs: agentDirs, files: agentFiles } = collectAgentFiles(agentTargets);
17000
18048
  const directories = mergeDirectories(getBaseDirectories(ciProvider), agentDirs);
17001
- const starterFiles = collectStarterFiles(ciProvider, agentFiles, archGranularity);
18049
+ const starterFiles = collectStarterFiles(ciProvider, agentFiles, archGranularity, stacks);
17002
18050
  return { agentTargets, directories, starterFiles };
17003
18051
  }
17004
- function initProject(options = {}) {
17005
- const destDir = path5.resolve(options.rootDir || process.cwd(), options.targetDir || ".");
17006
- const validated = validateInitOptions(options);
17007
- if (!validated.valid) return buildInitError(destDir, validated.error);
17008
- const { agentTargets, directories, starterFiles } = assembleScaffoldingPlan(
17009
- validated.ciProvider,
17010
- options.agents,
17011
- validated.archGranularity
17012
- );
18052
+ function executeScaffoldingOnDisk(destDir, options, ciProvider, archGranularity, stacks) {
18053
+ const { agentTargets, directories, starterFiles } = assembleScaffoldingPlan(ciProvider, options.agents, archGranularity, stacks);
17013
18054
  const dirsCreated = createDirectoriesOnDisk(destDir, directories, options.dryRun);
17014
18055
  const { filesCreated, filesUpdated } = writeProjectFiles(destDir, starterFiles, options.dryRun, options.force);
17015
- if (updateConsumerPackageJson(destDir, options.dryRun)) {
17016
- filesCreated.push("package.json");
17017
- }
18056
+ if (updateConsumerPackageJson(destDir, options.dryRun)) filesCreated.push("package.json");
17018
18057
  return buildInitSuccessResult(
17019
18058
  destDir,
17020
18059
  dirsCreated,
17021
18060
  filesCreated,
17022
18061
  filesUpdated,
17023
- validated.ciProvider,
18062
+ ciProvider,
17024
18063
  formatAgentsConfigured(agentTargets),
17025
- validated.archGranularity,
18064
+ archGranularity,
18065
+ stacks,
17026
18066
  tryInstallGitHook(destDir, options.dryRun)
17027
18067
  );
17028
18068
  }
17029
- var DEFAULT_DLP_RULES = [
17030
- {
17031
- id: "DLP-001-PRIVATE-KEY",
17032
- description: "PEM / RSA / EC / OPENSSH Private Key Block",
17033
- pattern: "-----BEGIN (?:[A-Z0-9_-]+ )?PRIVATE KEY-----[\\s\\S]*?-----END (?:[A-Z0-9_-]+ )?PRIVATE KEY-----",
17034
- replacement: "[REDACTED:PRIVATE_KEY]",
17035
- enabled: true
17036
- },
17037
- {
17038
- id: "DLP-002-API-TOKEN",
17039
- description: "Cloud, GitHub, Slack, OpenAI, Stripe, and AWS Access Tokens",
17040
- pattern: "\\b(?:gh[pousr]_[A-Za-z0-9_]{36,255}|github_pat_[0-9a-zA-Z_]{82}|sk-(?:proj-|live-)?[a-zA-Z0-9_-]{32,}|AKIA[0-9A-Z]{16}|xox[baprs]-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*|(?:sk|rk)_(?:live|test)_[0-9a-zA-Z]{24,99})\\b",
17041
- replacement: "[REDACTED:API_TOKEN]",
17042
- enabled: true
17043
- },
17044
- {
17045
- id: "DLP-003-JWT",
17046
- description: "Plaintext JSON Web Token (JWT)",
17047
- pattern: "\\beyJ[A-Za-z0-9_-]{10,}\\.eyJ[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}\\b",
17048
- replacement: "[REDACTED:JWT_TOKEN]",
17049
- enabled: true
17050
- },
17051
- {
17052
- id: "DLP-004-CREDIT-CARD",
17053
- description: "Payment Card Number (13-19 digits formatted)",
17054
- pattern: "\\b(?:\\d{4}[- ]\\d{4}[- ]\\d{4}[- ]\\d{4}|\\d{16})\\b",
17055
- replacement: "[REDACTED:CREDIT_CARD]",
17056
- enabled: true
17057
- },
17058
- {
17059
- id: "DLP-005-EMAIL",
17060
- description: "Personal or Corporate Email Address",
17061
- pattern: "\\b[A-Za-z0-9._%+-]+@(?!example\\.com|localhost|test\\.local)[A-Za-z0-9.-]+\\.[A-Za-z]{2,}\\b",
17062
- replacement: "[REDACTED:EMAIL]",
17063
- enabled: true
17064
- },
17065
- {
17066
- id: "DLP-006-INTERNAL-URL",
17067
- description: "Internal Intranet / Corp Service URL",
17068
- pattern: "https?://(?:[A-Za-z0-9._-]+:[A-Za-z0-9._-]+@|[A-Za-z0-9.-]+\\.(?:internal|corp|intranet|local)\\b)[^\\s\"'`<>]*",
17069
- replacement: "[REDACTED:INTERNAL_URL]",
17070
- enabled: true
17071
- }
17072
- ];
17073
- function createDefaultDlpPolicy() {
17074
- return {
17075
- version: "1.0",
17076
- enabled: true,
17077
- zero_data_retention_required: true,
17078
- rules: [...DEFAULT_DLP_RULES]
17079
- };
17080
- }
17081
- function normalizeParsedRule(raw, idx) {
17082
- if (typeof raw.pattern !== "string" || !raw.pattern) return null;
17083
- return {
17084
- id: typeof raw.id === "string" ? raw.id : `DLP-CUSTOM-${idx + 1}`,
17085
- description: typeof raw.description === "string" ? raw.description : "Custom DLP rule",
17086
- pattern: raw.pattern,
17087
- replacement: typeof raw.replacement === "string" ? raw.replacement : "[REDACTED]",
17088
- enabled: raw.enabled !== false
17089
- };
17090
- }
17091
- function parseDlpDoc(yamlContent) {
17092
- let doc;
17093
- try {
17094
- doc = yaml3.load(yamlContent);
17095
- } catch (err) {
17096
- throw new Error(`[AI-SDLC Fail-Closed] Invalid YAML in dlp-policy: ${err instanceof Error ? err.message : String(err)}`);
17097
- }
17098
- if (!doc || typeof doc !== "object" || Array.isArray(doc)) {
17099
- throw new Error(`[AI-SDLC Fail-Closed] Invalid dlp-policy structure: root must be a YAML mapping`);
17100
- }
17101
- const record = doc;
17102
- if (record.rules !== void 0 && !Array.isArray(record.rules)) {
17103
- throw new Error(`[AI-SDLC Fail-Closed] Invalid dlp-policy: rules must be an array`);
17104
- }
17105
- return record;
17106
- }
17107
- function parseDlpPolicy(yamlContent) {
17108
- const fallback = createDefaultDlpPolicy();
17109
- if (!yamlContent || !yamlContent.trim()) return fallback;
17110
- const record = parseDlpDoc(yamlContent);
17111
- const rawRules = Array.isArray(record.rules) ? record.rules : [];
17112
- const parsedRules = rawRules.map((r, i) => normalizeParsedRule(r, i)).filter((r) => r !== null);
17113
- return {
17114
- version: typeof record.version === "string" ? record.version : "1.0",
17115
- enabled: record.enabled !== false,
17116
- zero_data_retention_required: Boolean(record.zero_data_retention_required ?? true),
17117
- rules: parsedRules.length > 0 ? parsedRules : fallback.rules
17118
- };
17119
- }
17120
- function loadDlpPolicy(rootDir, customPolicyPath) {
17121
- const base = rootDir || process.cwd();
17122
- const filePath = customPolicyPath ? path5.isAbsolute(customPolicyPath) ? customPolicyPath : path5.join(base, customPolicyPath) : path5.join(base, "dlp-policy.yaml");
17123
- if (!fs8.existsSync(filePath)) return createDefaultDlpPolicy();
17124
- return parseDlpPolicy(fs8.readFileSync(filePath, "utf-8"));
17125
- }
17126
- function applySingleDlpRule(text, rule) {
17127
- if (rule.enabled === false) return { output: text, matches: 0 };
17128
- try {
17129
- const regex = new RegExp(rule.pattern, "g");
17130
- let matches = 0;
17131
- const output = text.replace(regex, () => {
17132
- matches++;
17133
- return rule.replacement;
17134
- });
17135
- return { output, matches };
17136
- } catch {
17137
- return { output: text, matches: 0 };
17138
- }
17139
- }
17140
- function sanitizeDlpText(text, policy = createDefaultDlpPolicy()) {
17141
- if (!policy.enabled || !text) {
17142
- return { sanitizedText: text, redactionCount: 0, triggeredRuleIds: [] };
17143
- }
17144
- let current = text;
17145
- let totalRedactions = 0;
17146
- const triggered = [];
17147
- for (const rule of policy.rules) {
17148
- const res = applySingleDlpRule(current, rule);
17149
- if (res.matches > 0) {
17150
- current = res.output;
17151
- totalRedactions += res.matches;
17152
- triggered.push(rule.id);
17153
- }
17154
- }
17155
- return {
17156
- sanitizedText: current,
17157
- redactionCount: totalRedactions,
17158
- triggeredRuleIds: triggered
17159
- };
17160
- }
17161
- function sanitizeDlpPayload(payload, policy = createDefaultDlpPolicy()) {
17162
- if (!policy.enabled || payload === null || payload === void 0) return payload;
17163
- if (typeof payload === "string") {
17164
- return sanitizeDlpText(payload, policy).sanitizedText;
17165
- }
17166
- const serialized = JSON.stringify(payload);
17167
- const { sanitizedText } = sanitizeDlpText(serialized, policy);
17168
- try {
17169
- return JSON.parse(sanitizedText);
17170
- } catch {
17171
- return payload;
17172
- }
18069
+ function initProject(options = {}) {
18070
+ const destDir = path5.resolve(options.rootDir || process.cwd(), options.targetDir || ".");
18071
+ const validated = validateInitOptions(options);
18072
+ if (!validated.valid) return buildInitError(destDir, validated.error);
18073
+ const stackRes = resolveCodingRuleStacks(options.stack, destDir);
18074
+ if (!stackRes.valid) return buildInitError(destDir, stackRes.error);
18075
+ return executeScaffoldingOnDisk(destDir, options, validated.ciProvider, validated.archGranularity, stackRes.stacks);
17173
18076
  }
17174
18077
  var CITATION_REGEX = /\b(ARCH-INTRO|JRN|ACT-THREAT|ACT|UC|BR|BC|ABUSE|DATA-ASSET|PRIV-ROPA|HAZ|SEC-ENC|CMP|ADR|SEC-REQ|PRIV-REQ|FR|QR|CHG|TSK|HOF)-[A-Z0-9_-]+/g;
17175
18078
  function parseTasksFromDir(changeDirPath, rootDir) {
@@ -17634,6 +18537,6 @@ function formatInspectResultMarkdown(result) {
17634
18537
  return lines.join("\n");
17635
18538
  }
17636
18539
 
17637
- export { ALL_ARCHITECTURE_TEMPLATES, BRANCH_PATTERNS, BddStepRegistry, DEFAULT_DLP_RULES, DEFAULT_EXCLUDED_PATTERNS, DEFAULT_EXCLUDES, DEFAULT_EXTENSIONS, DEFAULT_PRIVACY_POLICY, DEFAULT_SAST_EXCLUDES, GENERAL_SOURCE_EXTENSIONS, KPI_SUMMARY_END_TAG, KPI_SUMMARY_START_TAG, LIFECYCLE_SKILL_TEMPLATES, OpenSpecAdapter, PII_SAST_RULES, PREPARE_COMMIT_MSG_SCRIPT, PRE_COMMIT_SCRIPT, PROMPT_INJECTION_SIGNATURES, PROTECTED_BYPASS_PATTERNS, SARIF_SCHEMA_2_1_0, SARIF_VERSION, SAST_RULES, SCHEMA_SCHEMAS_ARCHITECTURE_ADR_SCHEMA_JSON, SCHEMA_SCHEMAS_ARCHITECTURE_COMPONENT_SCHEMA_JSON, SCHEMA_SCHEMAS_ARCHITECTURE_INTRODUCTION_AND_GOALS_SCHEMA_JSON, SCHEMA_SCHEMAS_COMPLIANCE_LICENSE_MANIFEST_SCHEMA_JSON, SCHEMA_SCHEMAS_COMPLIANCE_LICENSE_POLICY_SCHEMA_JSON, SCHEMA_SCHEMAS_COMPLIANCE_QUALITY_POLICY_SCHEMA_JSON, SCHEMA_SCHEMAS_IDE_MCP_CONFIG_SCHEMA_JSON, SCHEMA_SCHEMAS_MANUALS_PRODUCTION_MANUAL_SCHEMA_JSON, SCHEMA_SCHEMAS_MANUALS_USER_MANUAL_SCHEMA_JSON, SCHEMA_SCHEMAS_PRIVACY_DATA_ASSET_SCHEMA_JSON, SCHEMA_SCHEMAS_PRIVACY_PRIVACY_POLICY_SCHEMA_JSON, SCHEMA_SCHEMAS_PRIVACY_PRIVACY_REQ_SCHEMA_JSON, SCHEMA_SCHEMAS_PRIVACY_PRIVACY_ROPA_SCHEMA_JSON, SCHEMA_SCHEMAS_PRODUCT_ACTOR_SCHEMA_JSON, SCHEMA_SCHEMAS_PRODUCT_BOUNDED_CONTEXT_SCHEMA_JSON, SCHEMA_SCHEMAS_PRODUCT_BUSINESS_RULE_SCHEMA_JSON, SCHEMA_SCHEMAS_PRODUCT_JOURNEY_SCHEMA_JSON, SCHEMA_SCHEMAS_PRODUCT_REQUIREMENT_SCHEMA_JSON, SCHEMA_SCHEMAS_PRODUCT_TERM_SCHEMA_JSON, SCHEMA_SCHEMAS_PRODUCT_USE_CASE_SCHEMA_JSON, SCHEMA_SCHEMAS_SAFETY_HAZARD_SCHEMA_JSON, SCHEMA_SCHEMAS_SAFETY_SAFETY_REQ_SCHEMA_JSON, SCHEMA_SCHEMAS_SDD_DESIGN_SCHEMA_JSON, SCHEMA_SCHEMAS_SDD_HANDOFF_SCHEMA_JSON, SCHEMA_SCHEMAS_SDD_PROPOSAL_SCHEMA_JSON, SCHEMA_SCHEMAS_SDD_RELEASE_KPIS_SCHEMA_JSON, SCHEMA_SCHEMAS_SDD_SESSION_TELEMETRY_SCHEMA_JSON, SCHEMA_SCHEMAS_SDD_SPEC_SCHEMA_JSON, SCHEMA_SCHEMAS_SDD_TASKS_SCHEMA_JSON, SCHEMA_SCHEMAS_SECURITY_ABUSE_CASE_SCHEMA_JSON, SCHEMA_SCHEMAS_SECURITY_ENCLAVE_SCHEMA_JSON, SCHEMA_SCHEMAS_SECURITY_SECURITY_REQ_SCHEMA_JSON, SCHEMA_SCHEMAS_SECURITY_THREAT_ACTOR_SCHEMA_JSON, SCHEMA_SCHEMAS_WORKFLOW_AGENT_HANDOFF_SCHEMA_JSON, SECRET_RULES, SPECIALIZED_AGENT_TEMPLATES, STARTER_ANTIGRAVITY_MCP, STARTER_ANTIGRAVITY_RULES, STARTER_ARCH_ADR, STARTER_ARCH_ARCHITECTURE_CONSTRAINTS, STARTER_ARCH_COMPONENT, STARTER_ARCH_CONTEXT_AND_SCOPE, STARTER_ARCH_CROSS_CUTTING_CONCEPTS, STARTER_ARCH_DEPLOYMENT_VIEW, STARTER_ARCH_GLOSSARY, STARTER_ARCH_INTRODUCTION_AND_GOALS, STARTER_ARCH_LEVEL_1_WHITEBOX, STARTER_ARCH_QUALITY_REQUIREMENTS, STARTER_ARCH_RISKS_AND_TECHNICAL_DEBT, STARTER_ARCH_RUNTIME_VIEW, STARTER_ARCH_SOLUTION_STRATEGY, STARTER_AZURE_PIPELINES, STARTER_BASE_TEMPLATES, STARTER_BITBUCKET_PIPELINES, STARTER_CLAUDE_RULES, STARTER_COMPLIANCE_LICENSE_MANIFEST_YAML, STARTER_COPILOT_RULES, STARTER_CURSOR_CORE_RULES, STARTER_CURSOR_MCP, STARTER_CURSOR_PRODUCT_RULES, STARTER_CURSOR_QUALITY_RULES, STARTER_GITHUB_CI, STARTER_GITHUB_DEPLOY_DASHBOARD, STARTER_GITHUB_PR_KPI, STARTER_GITHUB_PULL_REQUEST_TEMPLATE, STARTER_GITHUB_SDD_INTEGRATE, STARTER_GITLAB_CI, STARTER_LICENSE_POLICY, STARTER_PRIVACY_POLICY, STARTER_PROCESS_README, STARTER_PULL_REQUEST_TEMPLATE, STARTER_QUALITY_POLICY, STARTER_REQUIREMENT_TEMPLATE, STARTER_SCHEMAS, STARTER_SCHEMAS_MAP, STARTER_TASK_TEMPLATE, STARTER_TEMPLATES_CI_AZURE_PIPELINES_YML, STARTER_TEMPLATES_CI_BITBUCKET_PIPELINES_YML, STARTER_TEMPLATES_CI_GITHUB_WORKFLOWS_CI_YML, STARTER_TEMPLATES_CI_GITHUB_WORKFLOWS_DEPLOY_DASHBOARD_YML, STARTER_TEMPLATES_CI_GITHUB_WORKFLOWS_PR_KPI_SUMMARY_YML, STARTER_TEMPLATES_CI_GITHUB_WORKFLOWS_SDD_INTEGRATE_ON_MERGE_YML, STARTER_TEMPLATES_CI__GITLAB_CI_YML, STARTER_TEMPLATES_COMPLIANCE_COMMERCIAL_ACQUISITION_REQUEST_TEMPLATE_MD, STARTER_TEMPLATES_MANUALS_PRODUCTION_MANUAL_TEMPLATE_MD, STARTER_TEMPLATES_MANUALS_USER_MANUAL_TEMPLATE_MD, STARTER_TEMPLATES_PRIVACY_DATA_ASSET_TEMPLATE_MD, STARTER_TEMPLATES_PRIVACY_DPIA_REQUEST_TEMPLATE_MD, STARTER_TEMPLATES_PRIVACY_PRIVACY_REQ_TEMPLATE_MD, STARTER_TEMPLATES_PRIVACY_PRIVACY_ROPA_TEMPLATE_MD, STARTER_TEMPLATES_PRODUCT_ACTOR_TEMPLATE_MD, STARTER_TEMPLATES_PRODUCT_BOUNDED_CONTEXT_TEMPLATE_MD, STARTER_TEMPLATES_PRODUCT_BUSINESS_RULE_TEMPLATE_MD, STARTER_TEMPLATES_PRODUCT_JOURNEY_TEMPLATE_MD, STARTER_TEMPLATES_PRODUCT_REQUIREMENT_TEMPLATE_MD, STARTER_TEMPLATES_PRODUCT_TERM_TEMPLATE_MD, STARTER_TEMPLATES_PRODUCT_USER_DESIGN_FEEDBACK_TEMPLATE_MD, STARTER_TEMPLATES_PRODUCT_USE_CASE_TEMPLATE_MD, STARTER_TEMPLATES_SAFETY_HAZARD_TEMPLATE_MD, STARTER_TEMPLATES_SAFETY_SAFETY_REQ_TEMPLATE_MD, STARTER_TEMPLATES_SDD_DESIGN_TEMPLATE_MD, STARTER_TEMPLATES_SDD_HANDOFF_TEMPLATE_YAML, STARTER_TEMPLATES_SDD_PROPOSAL_TEMPLATE_MD, STARTER_TEMPLATES_SDD_PULL_REQUEST_TEMPLATE_MD, STARTER_TEMPLATES_SDD_SPEC_TEMPLATE_MD, STARTER_TEMPLATES_SDD_TASKS_TEMPLATE_MD, STARTER_TEMPLATES_SECURITY_ABUSE_CASE_TEMPLATE_MD, STARTER_TEMPLATES_SECURITY_ENCLAVE_TEMPLATE_MD, STARTER_TEMPLATES_SECURITY_SECURITY_REQ_TEMPLATE_MD, STARTER_TEMPLATES_SECURITY_THREAT_ACTOR_TEMPLATE_MD, STARTER_TEMPLATES_WORKFLOW_AGENT_HANDOFF_TEMPLATE_MD, STARTER_VSCODE_MCP, STARTER_WORKFLOW_HANDOFF_TEMPLATE, STARTER__GITHUB_PULL_REQUEST_TEMPLATE_MD, SpecKitAdapter, TYPE_TO_SCHEMA_MAP, UNIT_TEST_SUFFIXES, VALID_AGENT_TARGETS, VALID_ARCHITECTURE_GRANULARITIES, VALID_AUTONOMY_MODES, VALID_CHANGE_PROFILES, VALID_CI_PROVIDERS, aggregateCommitKpiRecords, aggregatePrKpis, aggregateReleaseKpis, analyzeBddVariantsForRequirement, appendRevisionHistoryRow, applyRatchetMode, buildCycloneDxComponent, buildCycloneDxVulnerabilities, buildFeatureFileContent, buildGraphElements, calculateJaccardSimilarity, calculateMetrics, calculateRating, calculateShannonEntropy, canonicalSort, checkGherkinInSync, checkoutTaskBranch, classifyBranch, classifyMetricFromMessage, collectAgentFiles, collectDashboardMetrics, collectHistoricalKpis, computeCanonicalSha256, computeRawSha256, computeSha256, computeViolationSignature, createDefaultDlpPolicy, createDefaultQualityPolicy, depositProductHandoffSidecar, detectActiveChangeForIntegration, detectAuthorIdentity, detectLanguage, detectProfileFromChange, detectPromptInjection, emitCiOutput, evaluateCompoundLicense, evaluateSingleDependency, evaluateVulnerabilityThresholds, executeBddFeature, extractBaselineEntriesFromResults, extractCitations, extractCommitKpisFromRange, extractDirectDepNames, extractFeatureTags, extractFrontmatter, extractFunctions, extractFunctionsBraceLanguages, extractFunctionsPolyglot, extractFunctionsPython, extractFunctionsPythonAst, extractFunctionsTypeScriptAst, extractGherkinBlock, extractGherkinFeatures, extractNormativeText, extractPythonFunctionsPolyglot, extractSemanticContent, findChangeWorkspaceDir, findLicenseFile, formatCommitTrailers, formatInspectResultMarkdown, formatPrKpiMarkdown, formatReleaseKpiMarkdown, generateBranchHierarchyPlan, generateCycloneDxSbom, generateDashboardReport, generateDeterministicUuidV5, generateDuplicatesReportMarkdown, generateGovernanceReportMarkdown, generateLicenseReportMarkdown, generatePdacReportMarkdown, generatePrivacyReportMarkdown, generateQualityReport, generateRopaInventoryMarkdown, generateSastReportMarkdown, generateSecretsReportMarkdown, generateSecuritySarifReport, generateSuppressionsAuditReport, generateTestingCoverageReportMarkdown, generateThirdPartyNotices, generateTraceabilityReportMarkdown, getArchitectureTemplates, getCytoscapeScript, getGitDiffLines, getNextCorrelativeNumber, getSddAdapter, inferArtifactTypeFromId, inferMissingTrailers, initProject, injectKpisIntoPrBody, inspectElement, installGitHooks, integrateSddChange, isCliInstalled, isFunctionReferencedInTests, isGitleaksInstalled, isMetricWorsened, isPathProtectedFromPatch, isPlaceholderOrIgnored, isReportContentSemanticallyEqual, isRequirementArtifact2 as isRequirementArtifact, isSemgrepInstalled, isToolAvailable, loadDlpPolicy, loadPrivacyPolicy, loadProductHandoffSidecar, loadQualityBaseline, locateTaskInActiveChanges, mapSastSeverityToSarifLevel, maskSecret, normalizePath, normalizeSpdxLicense, normalizeUri, orchestrateNativeAstAnalysis, parseCommitTrailers, parseDlpPolicy, parseFeatureDocument, parseFrontmatter, parseFrontmatterId, parseGenericDoc, parseLicensePolicy, parseMarkdownFrontmatter, parseQualityPolicy, parseRequirementFile, parseSecuritySuppression, parseSpecCatalogScope, parseTasksDoc, parseTasksFromContent, parseTrivyVulnerabilities, processPackageDir, readCodeCoverageSummary, readPackageJson, renderAntigravityAgentFile, renderAntigravitySkillFile, renderAutonomyModeSection, renderClaudeAgentFile, renderClaudeSkillFile, renderCopilotAgentFile, renderCopilotSkillFile, renderCursorAgentFile, renderCursorSkillFile, renderDashboardHtml, renderManualsTab, resolveAgentTargets, resolveBranchHierarchy, resolveCiEnvironment, resolveCytoscapePath, resolveDefaultBranchBase, resolveDeterministicDate, resolveFeatureFilePath, resolveGitRef, resolveLicenseFromFile, resolveReleaseBaseBranch, resolveSastCwe, resolveSastOwasp, resolveSchemaForArtifact, resolveTargetFiles, runGitleaksCli, runSemgrepCli, sanitizeDlpPayload, sanitizeDlpText, sanitizeTestCorpus, scaffoldSddChange, scanAllProductHandoffs, scanAllTestArtifacts, scanContentForSecrets, scanFileForPrivacyViolations, scanFileForSast, scanGoDependencies, scanInstalledLicenses, scanManualsInWorkspace, scanMavenDependencies, scanPnpmStore, scanPythonDependencies, scanRustDependencies, scanSubdirectories, scanWithNativeFs, scanWithSyft, scanWithTrivy, serializeSarifDocument, slugify2 as slugify, stripVolatileReportMetadata, syncPdacDigests, tokenizeTitle, updateCitationsInContent, validateAgainstSchema, validateAnchorExistence, validateArtifactSchema, verifyArtifactDuplicates, verifyArtifactsSchemas, verifyLicenses, verifyManuals, verifyPdacGraph, verifyPrivacy, verifyProgressiveFriction, verifyQualityGate, verifySast, verifySddIntegration, verifySecrets, verifyTasksGovernance, verifyTestingCoverage, verifyTraceability, walkDir, walkMdFiles, walkProjectFiles, walkSourceFiles, walkTaskFiles, writeCucumberJsonReport, writeCycloneDxSbom, writeQualityBaseline, writeReleaseKpiReport, writeReportFileIfChanged, writeSecuritySarifReport, writeThirdPartyNotices };
18540
+ export { ALL_ARCHITECTURE_TEMPLATES, BRANCH_PATTERNS, BddStepRegistry, CPP_CLANG_TIDY, CPP_CMAKE_STRICT, DEFAULT_DLP_RULES, DEFAULT_EXCLUDED_PATTERNS, DEFAULT_EXCLUDES, DEFAULT_EXTENSIONS, DEFAULT_PRIVACY_POLICY, DEFAULT_SAST_EXCLUDES, DOTNET_DIRECTORY_BUILD_PROPS, GENERAL_SOURCE_EXTENSIONS, GO_GOLANGCI_YML, GRADLE_STRICT_INIT_KTS, JAVA_PMD_RULESET_XML, KOTLIN_DETEKT_YML, KPI_SUMMARY_END_TAG, KPI_SUMMARY_START_TAG, LIFECYCLE_SKILL_TEMPLATES, OpenSpecAdapter, PII_SAST_RULES, PREPARE_COMMIT_MSG_SCRIPT, PRE_COMMIT_SCRIPT, PROMPT_INJECTION_SIGNATURES, PROTECTED_BYPASS_PATTERNS, PROTECTED_CODING_RULES_FILES, REVIEWER_ROLES, REVIEW_VERDICTS, RUST_CARGO_CONFIG_TOML, RUST_CLIPPY_TOML, SARIF_SCHEMA_2_1_0, SARIF_VERSION, SAST_RULES, SCHEMA_SCHEMAS_ARCHITECTURE_ADR_SCHEMA_JSON, SCHEMA_SCHEMAS_ARCHITECTURE_COMPONENT_SCHEMA_JSON, SCHEMA_SCHEMAS_ARCHITECTURE_INTRODUCTION_AND_GOALS_SCHEMA_JSON, SCHEMA_SCHEMAS_COMPLIANCE_LICENSE_MANIFEST_SCHEMA_JSON, SCHEMA_SCHEMAS_COMPLIANCE_LICENSE_POLICY_SCHEMA_JSON, SCHEMA_SCHEMAS_COMPLIANCE_QUALITY_POLICY_SCHEMA_JSON, SCHEMA_SCHEMAS_IDE_MCP_CONFIG_SCHEMA_JSON, SCHEMA_SCHEMAS_MANUALS_PRODUCTION_MANUAL_SCHEMA_JSON, SCHEMA_SCHEMAS_MANUALS_USER_MANUAL_SCHEMA_JSON, SCHEMA_SCHEMAS_PRIVACY_DATA_ASSET_SCHEMA_JSON, SCHEMA_SCHEMAS_PRIVACY_PRIVACY_POLICY_SCHEMA_JSON, SCHEMA_SCHEMAS_PRIVACY_PRIVACY_REQ_SCHEMA_JSON, SCHEMA_SCHEMAS_PRIVACY_PRIVACY_ROPA_SCHEMA_JSON, SCHEMA_SCHEMAS_PRODUCT_ACTOR_SCHEMA_JSON, SCHEMA_SCHEMAS_PRODUCT_BOUNDED_CONTEXT_SCHEMA_JSON, SCHEMA_SCHEMAS_PRODUCT_BUSINESS_RULE_SCHEMA_JSON, SCHEMA_SCHEMAS_PRODUCT_JOURNEY_SCHEMA_JSON, SCHEMA_SCHEMAS_PRODUCT_REQUIREMENT_SCHEMA_JSON, SCHEMA_SCHEMAS_PRODUCT_TERM_SCHEMA_JSON, SCHEMA_SCHEMAS_PRODUCT_USE_CASE_SCHEMA_JSON, SCHEMA_SCHEMAS_SAFETY_HAZARD_SCHEMA_JSON, SCHEMA_SCHEMAS_SAFETY_SAFETY_REQ_SCHEMA_JSON, SCHEMA_SCHEMAS_SDD_DESIGN_SCHEMA_JSON, SCHEMA_SCHEMAS_SDD_HANDOFF_SCHEMA_JSON, SCHEMA_SCHEMAS_SDD_PROPOSAL_SCHEMA_JSON, SCHEMA_SCHEMAS_SDD_RELEASE_KPIS_SCHEMA_JSON, SCHEMA_SCHEMAS_SDD_SESSION_TELEMETRY_SCHEMA_JSON, SCHEMA_SCHEMAS_SDD_SPEC_SCHEMA_JSON, SCHEMA_SCHEMAS_SDD_TASKS_SCHEMA_JSON, SCHEMA_SCHEMAS_SECURITY_ABUSE_CASE_SCHEMA_JSON, SCHEMA_SCHEMAS_SECURITY_ENCLAVE_SCHEMA_JSON, SCHEMA_SCHEMAS_SECURITY_SECURITY_REQ_SCHEMA_JSON, SCHEMA_SCHEMAS_SECURITY_THREAT_ACTOR_SCHEMA_JSON, SCHEMA_SCHEMAS_WORKFLOW_AGENT_HANDOFF_SCHEMA_JSON, SECRET_RULES, SPECIALIZED_AGENT_TEMPLATES, STARTER_AGENT_GUARD_WRAPPER_CJS, STARTER_ANTIGRAVITY_HOOKS_JSON, STARTER_ANTIGRAVITY_MCP, STARTER_ANTIGRAVITY_RULES, STARTER_ARCH_ADR, STARTER_ARCH_ARCHITECTURE_CONSTRAINTS, STARTER_ARCH_COMPONENT, STARTER_ARCH_CONTEXT_AND_SCOPE, STARTER_ARCH_CROSS_CUTTING_CONCEPTS, STARTER_ARCH_DEPLOYMENT_VIEW, STARTER_ARCH_GLOSSARY, STARTER_ARCH_INTRODUCTION_AND_GOALS, STARTER_ARCH_LEVEL_1_WHITEBOX, STARTER_ARCH_QUALITY_REQUIREMENTS, STARTER_ARCH_RISKS_AND_TECHNICAL_DEBT, STARTER_ARCH_RUNTIME_VIEW, STARTER_ARCH_SOLUTION_STRATEGY, STARTER_AZURE_PIPELINES, STARTER_BASE_TEMPLATES, STARTER_BITBUCKET_PIPELINES, STARTER_CLAUDE_RULES, STARTER_COMPLIANCE_LICENSE_MANIFEST_YAML, STARTER_COPILOT_RULES, STARTER_CURSOR_CORE_RULES, STARTER_CURSOR_MCP, STARTER_CURSOR_PRODUCT_RULES, STARTER_CURSOR_QUALITY_RULES, STARTER_GITHUB_CI, STARTER_GITHUB_DEPLOY_DASHBOARD, STARTER_GITHUB_PR_KPI, STARTER_GITHUB_PULL_REQUEST_TEMPLATE, STARTER_GITHUB_SDD_INTEGRATE, STARTER_GITLAB_CI, STARTER_GUARD_BRANCH_CJS, STARTER_LICENSE_POLICY, STARTER_PRIVACY_POLICY, STARTER_PROCESS_README, STARTER_PULL_REQUEST_TEMPLATE, STARTER_QUALITY_POLICY, STARTER_REQUIREMENT_TEMPLATE, STARTER_SCHEMAS, STARTER_SCHEMAS_MAP, STARTER_TASK_TEMPLATE, STARTER_TEMPLATES_CI_AZURE_PIPELINES_YML, STARTER_TEMPLATES_CI_BITBUCKET_PIPELINES_YML, STARTER_TEMPLATES_CI_GITHUB_WORKFLOWS_CI_YML, STARTER_TEMPLATES_CI_GITHUB_WORKFLOWS_DEPLOY_DASHBOARD_YML, STARTER_TEMPLATES_CI_GITHUB_WORKFLOWS_PR_KPI_SUMMARY_YML, STARTER_TEMPLATES_CI_GITHUB_WORKFLOWS_SDD_INTEGRATE_ON_MERGE_YML, STARTER_TEMPLATES_CI__GITLAB_CI_YML, STARTER_TEMPLATES_COMPLIANCE_COMMERCIAL_ACQUISITION_REQUEST_TEMPLATE_MD, STARTER_TEMPLATES_MANUALS_PRODUCTION_MANUAL_TEMPLATE_MD, STARTER_TEMPLATES_MANUALS_USER_MANUAL_TEMPLATE_MD, STARTER_TEMPLATES_PRIVACY_DATA_ASSET_TEMPLATE_MD, STARTER_TEMPLATES_PRIVACY_DPIA_REQUEST_TEMPLATE_MD, STARTER_TEMPLATES_PRIVACY_PRIVACY_REQ_TEMPLATE_MD, STARTER_TEMPLATES_PRIVACY_PRIVACY_ROPA_TEMPLATE_MD, STARTER_TEMPLATES_PRODUCT_ACTOR_TEMPLATE_MD, STARTER_TEMPLATES_PRODUCT_BOUNDED_CONTEXT_TEMPLATE_MD, STARTER_TEMPLATES_PRODUCT_BUSINESS_RULE_TEMPLATE_MD, STARTER_TEMPLATES_PRODUCT_JOURNEY_TEMPLATE_MD, STARTER_TEMPLATES_PRODUCT_REQUIREMENT_TEMPLATE_MD, STARTER_TEMPLATES_PRODUCT_TERM_TEMPLATE_MD, STARTER_TEMPLATES_PRODUCT_USER_DESIGN_FEEDBACK_TEMPLATE_MD, STARTER_TEMPLATES_PRODUCT_USE_CASE_TEMPLATE_MD, STARTER_TEMPLATES_SAFETY_HAZARD_TEMPLATE_MD, STARTER_TEMPLATES_SAFETY_SAFETY_REQ_TEMPLATE_MD, STARTER_TEMPLATES_SDD_DESIGN_TEMPLATE_MD, STARTER_TEMPLATES_SDD_HANDOFF_TEMPLATE_YAML, STARTER_TEMPLATES_SDD_PROPOSAL_TEMPLATE_MD, STARTER_TEMPLATES_SDD_PULL_REQUEST_TEMPLATE_MD, STARTER_TEMPLATES_SDD_SPEC_TEMPLATE_MD, STARTER_TEMPLATES_SDD_TASKS_TEMPLATE_MD, STARTER_TEMPLATES_SECURITY_ABUSE_CASE_TEMPLATE_MD, STARTER_TEMPLATES_SECURITY_ENCLAVE_TEMPLATE_MD, STARTER_TEMPLATES_SECURITY_SECURITY_REQ_TEMPLATE_MD, STARTER_TEMPLATES_SECURITY_THREAT_ACTOR_TEMPLATE_MD, STARTER_TEMPLATES_WORKFLOW_AGENT_HANDOFF_TEMPLATE_MD, STARTER_VSCODE_MCP, STARTER_WORKFLOW_HANDOFF_TEMPLATE, STARTER__GITHUB_PULL_REQUEST_TEMPLATE_MD, SpecKitAdapter, TS_ESLINT_CONFIG_MJS, TS_STRICT_TSCONFIG, TYPE_TO_SCHEMA_MAP, UNIT_TEST_SUFFIXES, VALID_AGENT_TARGETS, VALID_ARCHITECTURE_GRANULARITIES, VALID_AUTONOMY_MODES, VALID_CHANGE_PROFILES, VALID_CI_PROVIDERS, VALID_CODING_RULE_STACKS, aggregateCommitKpiRecords, aggregatePrKpis, aggregateReleaseKpis, analyzeBddVariantsForRequirement, appendRevisionHistoryRow, applyRatchetMode, buildCycloneDxComponent, buildCycloneDxVulnerabilities, buildFeatureFileContent, buildGraphElements, calculateJaccardSimilarity, calculateMetrics, calculateRating, calculateShannonEntropy, canonicalSort, checkGherkinInSync, checkoutTaskBranch, classifyBranch, classifyMetricFromMessage, collectAgentFiles, collectDashboardMetrics, collectHistoricalKpis, computeCanonicalSha256, computeRawSha256, computeSha256, computeViolationSignature, createDefaultDlpPolicy, createDefaultQualityPolicy, depositProductHandoffSidecar, detectActiveChangeForIntegration, detectAuthorIdentity, detectLanguage, detectProfileFromChange, detectProjectStacks, detectPromptInjection, emitCiOutput, evaluateCompoundLicense, evaluateSingleDependency, evaluateVulnerabilityThresholds, executeBddFeature, extractAllRepoCommitKpis, extractBaselineEntriesFromResults, extractCitations, extractCommitKpisFromRange, extractDirectDepNames, extractFeatureTags, extractFrontmatter, extractFunctions, extractFunctionsBraceLanguages, extractFunctionsPolyglot, extractFunctionsPython, extractFunctionsPythonAst, extractFunctionsTypeScriptAst, extractGherkinBlock, extractGherkinFeatures, extractNormativeText, extractPythonFunctionsPolyglot, extractSemanticContent, findChangeWorkspaceDir, findLicenseFile, formatCommitTrailers, formatInspectResultMarkdown, formatPrKpiMarkdown, formatReleaseKpiMarkdown, generateBranchHierarchyPlan, generateCycloneDxSbom, generateDashboardReport, generateDeterministicUuidV5, generateDuplicatesReportMarkdown, generateGovernanceReportMarkdown, generateLicenseReportMarkdown, generatePdacReportMarkdown, generatePrivacyReportMarkdown, generateQualityReport, generateRopaInventoryMarkdown, generateSastReportMarkdown, generateSecretsReportMarkdown, generateSecuritySarifReport, generateSuppressionsAuditReport, generateTestingCoverageReportMarkdown, generateThirdPartyNotices, generateTraceabilityReportMarkdown, getArchitectureTemplates, getCodingRulesFilesForStacks, getCytoscapeScript, getGitDiffLines, getNextCorrelativeNumber, getReferenceCodingRulesTemplates, getSddAdapter, inferArtifactTypeFromId, inferMissingTrailers, initProject, injectKpisIntoPrBody, inspectElement, installGitHooks, integrateSddChange, isCliInstalled, isFunctionReferencedInTests, isGitleaksInstalled, isMetricWorsened, isPathProtectedFromPatch, isPlaceholderOrIgnored, isProtectedCodingRulesFile, isReportContentSemanticallyEqual, isRequirementArtifact2 as isRequirementArtifact, isReviewerRole, isSemgrepInstalled, isToolAvailable, loadDlpPolicy, loadPrivacyPolicy, loadProductHandoffSidecar, loadQualityBaseline, locateTaskInActiveChanges, mapSastSeverityToSarifLevel, maskSecret, normalizePath, normalizeSpdxLicense, normalizeUri, orchestrateNativeAstAnalysis, parseCommitTrailers, parseDlpPolicy, parseFeatureDocument, parseFrontmatter, parseFrontmatterId, parseGenericDoc, parseLicensePolicy, parseMarkdownFrontmatter, parseQualityPolicy, parseRequirementFile, parseSecuritySuppression, parseSpecCatalogScope, parseTasksDoc, parseTasksFromContent, parseTrivyVulnerabilities, processPackageDir, readCodeCoverageSummary, readPackageJson, renderAntigravityAgentFile, renderAntigravitySkillFile, renderAutonomyModeSection, renderClaudeAgentFile, renderClaudeSkillFile, renderCopilotAgentFile, renderCopilotSkillFile, renderCursorAgentFile, renderCursorSkillFile, renderDashboardHtml, renderManualsTab, resolveAgentTargets, resolveBranchHierarchy, resolveCiEnvironment, resolveCodingRuleStacks, resolveCytoscapePath, resolveDefaultBranchBase, resolveDeterministicDate, resolveFeatureFilePath, resolveGitRef, resolveLicenseFromFile, resolveReleaseBaseBranch, resolveSastCwe, resolveSastOwasp, resolveSchemaForArtifact, resolveTargetFiles, runGitleaksCli, runSemgrepCli, sanitizeDlpPayload, sanitizeDlpText, sanitizeTestCorpus, scaffoldSddChange, scanAllProductHandoffs, scanAllTestArtifacts, scanContentForSecrets, scanFileForPrivacyViolations, scanFileForSast, scanGoDependencies, scanInstalledLicenses, scanManualsInWorkspace, scanMavenDependencies, scanPnpmStore, scanPythonDependencies, scanRustDependencies, scanSubdirectories, scanWithNativeFs, scanWithSyft, scanWithTrivy, serializeSarifDocument, slugify2 as slugify, stripVolatileReportMetadata, submitReviewReport, syncPdacDigests, tokenizeTitle, updateCitationsInContent, validateAgainstSchema, validateAnchorExistence, validateArtifactSchema, verifyArtifactDuplicates, verifyArtifactsSchemas, verifyLicenses, verifyManuals, verifyPdacGraph, verifyPrivacy, verifyProgressiveFriction, verifyQualityGate, verifySast, verifySddIntegration, verifySecrets, verifyTasksGovernance, verifyTestingCoverage, verifyTraceability, walkDir, walkMdFiles, walkProjectFiles, walkSourceFiles, walkTaskFiles, writeCucumberJsonReport, writeCycloneDxSbom, writeQualityBaseline, writeReleaseKpiReport, writeReportFileIfChanged, writeSecuritySarifReport, writeThirdPartyNotices };
17638
18541
  //# sourceMappingURL=index.js.map
17639
18542
  //# sourceMappingURL=index.js.map