@aisdlc/core 4.7.2 → 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -36,7 +36,7 @@ function _interopNamespace(e) {
36
36
  var crypto4__namespace = /*#__PURE__*/_interopNamespace(crypto4);
37
37
  var fs12__namespace = /*#__PURE__*/_interopNamespace(fs12);
38
38
  var path14__namespace = /*#__PURE__*/_interopNamespace(path14);
39
- var yaml3__default = /*#__PURE__*/_interopDefault(yaml3);
39
+ var yaml3__namespace = /*#__PURE__*/_interopNamespace(yaml3);
40
40
  var child_process3__namespace = /*#__PURE__*/_interopNamespace(child_process3);
41
41
  var Ajv2020__default = /*#__PURE__*/_interopDefault(Ajv2020);
42
42
  var addFormats__default = /*#__PURE__*/_interopDefault(addFormats);
@@ -2430,7 +2430,7 @@ function parseGenericDoc(content) {
2430
2430
  if (!match) return { frontmatter: {}, body: content };
2431
2431
  let parsed;
2432
2432
  try {
2433
- parsed = yaml3__default.default.load(match[1]);
2433
+ parsed = yaml3__namespace.default.load(match[1]);
2434
2434
  } catch {
2435
2435
  return { frontmatter: {}, body: content };
2436
2436
  }
@@ -2902,7 +2902,7 @@ function resolvePolicyTestPatterns(rootDir, options) {
2902
2902
  const policyFile = resolvePolicyFilePath(rootDir, options.policyPath);
2903
2903
  if (!fs12__namespace.existsSync(policyFile)) return void 0;
2904
2904
  try {
2905
- return extractPatternsFromPolicyDoc(yaml3__default.default.load(fs12__namespace.readFileSync(policyFile, "utf-8")));
2905
+ return extractPatternsFromPolicyDoc(yaml3__namespace.default.load(fs12__namespace.readFileSync(policyFile, "utf-8")));
2906
2906
  } catch {
2907
2907
  return void 0;
2908
2908
  }
@@ -3088,7 +3088,7 @@ function applyOptionOverrides(policy, overrides) {
3088
3088
  function parsePolicyYaml(content) {
3089
3089
  let doc;
3090
3090
  try {
3091
- doc = yaml3__default.default.load(content);
3091
+ doc = yaml3__namespace.default.load(content);
3092
3092
  } catch (err) {
3093
3093
  throw new Error(`[AI-SDLC Fail-Closed] Invalid YAML in quality-policy: ${err instanceof Error ? err.message : String(err)}`);
3094
3094
  }
@@ -3620,7 +3620,7 @@ function parseChangeProfile(specFile) {
3620
3620
  const rawSpec = fs12__namespace.readFileSync(specFile, "utf-8").replace(/^\uFEFF/, "");
3621
3621
  const match = rawSpec.match(/^---\r?\n([\s\S]*?)\r?\n---/);
3622
3622
  if (match) {
3623
- const parsedFm = yaml3__default.default.load(match[1]);
3623
+ const parsedFm = yaml3__namespace.default.load(match[1]);
3624
3624
  if (parsedFm?.profile && ["patch", "standard", "critical"].includes(String(parsedFm.profile))) {
3625
3625
  return parsedFm.profile;
3626
3626
  }
@@ -3647,7 +3647,7 @@ function validateSpecFileContent(specFile, changeWorkspaceDir, errors) {
3647
3647
  const rawSpec = fs12__namespace.readFileSync(specFile, "utf-8").replace(/^\uFEFF/, "");
3648
3648
  const match = rawSpec.match(/^---\r?\n([\s\S]*?)\r?\n---/);
3649
3649
  if (match) {
3650
- const parsedFm = yaml3__default.default.load(match[1]);
3650
+ const parsedFm = yaml3__namespace.default.load(match[1]);
3651
3651
  if (parsedFm) checkSpecGherkinFormat(parsedFm, rawSpec, changeWorkspaceDir, errors);
3652
3652
  }
3653
3653
  } catch {
@@ -3720,7 +3720,7 @@ var OpenSpecAdapter = class {
3720
3720
  const handoff = normalizeHandoffPayload(options.handoff, options.changeId);
3721
3721
  const filename = options.format === "json" ? "handoff.json" : "handoff.yaml";
3722
3722
  const filePath = path14__namespace.join(changeDir, filename);
3723
- const content = options.format === "json" ? JSON.stringify(handoff, null, 2) : yaml3__default.default.dump(handoff, { indent: 2, lineWidth: -1 });
3723
+ const content = options.format === "json" ? JSON.stringify(handoff, null, 2) : yaml3__namespace.default.dump(handoff, { indent: 2, lineWidth: -1 });
3724
3724
  fs12__namespace.writeFileSync(filePath, content, "utf-8");
3725
3725
  return filePath;
3726
3726
  }
@@ -3740,7 +3740,7 @@ var OpenSpecAdapter = class {
3740
3740
  if (fs12__namespace.existsSync(fullPath)) {
3741
3741
  try {
3742
3742
  const raw = fs12__namespace.readFileSync(fullPath, "utf-8").replace(/^\uFEFF/, "");
3743
- const parsed = file.endsWith(".json") ? JSON.parse(raw) : yaml3__default.default.load(raw);
3743
+ const parsed = file.endsWith(".json") ? JSON.parse(raw) : yaml3__namespace.default.load(raw);
3744
3744
  if (parsed && typeof parsed === "object" && parsed.id && String(parsed.id).startsWith("HOF-")) {
3745
3745
  return parsed;
3746
3746
  }
@@ -3779,7 +3779,7 @@ function parseChangeProfile2(specFile) {
3779
3779
  const rawSpec = fs12__namespace.readFileSync(specFile, "utf-8").replace(/^\uFEFF/, "");
3780
3780
  const match = rawSpec.match(/^---\r?\n([\s\S]*?)\r?\n---/);
3781
3781
  if (match) {
3782
- const parsedFm = yaml3__default.default.load(match[1]);
3782
+ const parsedFm = yaml3__namespace.default.load(match[1]);
3783
3783
  if (parsedFm?.profile && ["patch", "standard", "critical"].includes(String(parsedFm.profile))) {
3784
3784
  return parsedFm.profile;
3785
3785
  }
@@ -3806,7 +3806,7 @@ function validateSpecFileContent2(specFile, changeWorkspaceDir, errors) {
3806
3806
  const rawSpec = fs12__namespace.readFileSync(specFile, "utf-8").replace(/^\uFEFF/, "");
3807
3807
  const match = rawSpec.match(/^---\r?\n([\s\S]*?)\r?\n---/);
3808
3808
  if (match) {
3809
- const parsedFm = yaml3__default.default.load(match[1]);
3809
+ const parsedFm = yaml3__namespace.default.load(match[1]);
3810
3810
  if (parsedFm) checkSpecGherkinFormat2(parsedFm, rawSpec, changeWorkspaceDir, errors);
3811
3811
  }
3812
3812
  } catch {
@@ -3886,7 +3886,7 @@ var SpecKitAdapter = class {
3886
3886
  }
3887
3887
  const filename = options.format === "json" ? "handoff.json" : "handoff.yaml";
3888
3888
  const filePath = path14__namespace.join(changeDir, filename);
3889
- const content = options.format === "json" ? JSON.stringify(handoff, null, 2) : yaml3__default.default.dump(handoff, { indent: 2, lineWidth: -1 });
3889
+ const content = options.format === "json" ? JSON.stringify(handoff, null, 2) : yaml3__namespace.default.dump(handoff, { indent: 2, lineWidth: -1 });
3890
3890
  fs12__namespace.writeFileSync(filePath, content, "utf-8");
3891
3891
  const specifyMemoryDir = path14__namespace.join(options.rootDir, ".specify", "memory");
3892
3892
  if (fs12__namespace.existsSync(path14__namespace.join(options.rootDir, ".specify"))) {
@@ -3912,7 +3912,7 @@ var SpecKitAdapter = class {
3912
3912
  if (fs12__namespace.existsSync(fullPath)) {
3913
3913
  try {
3914
3914
  const raw = fs12__namespace.readFileSync(fullPath, "utf-8").replace(/^\uFEFF/, "");
3915
- const parsed = file.endsWith(".json") ? JSON.parse(raw) : yaml3__default.default.load(raw);
3915
+ const parsed = file.endsWith(".json") ? JSON.parse(raw) : yaml3__namespace.default.load(raw);
3916
3916
  if (parsed && typeof parsed === "object" && parsed.id && String(parsed.id).startsWith("HOF-")) {
3917
3917
  return parsed;
3918
3918
  }
@@ -4579,7 +4579,7 @@ function loadCanonicalArtifacts(rootDir) {
4579
4579
  }
4580
4580
  function writeUpdatedArtifact(file, frontmatter, body) {
4581
4581
  const yamlHeader = `---
4582
- ${yaml3__default.default.dump(frontmatter, { indent: 2, lineWidth: -1 }).trim()}
4582
+ ${yaml3__namespace.default.dump(frontmatter, { indent: 2, lineWidth: -1 }).trim()}
4583
4583
  ---
4584
4584
  `;
4585
4585
  fs12__namespace.writeFileSync(file, yamlHeader + body, "utf-8");
@@ -5645,7 +5645,7 @@ function extractFrontmatter(content) {
5645
5645
  const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
5646
5646
  if (!match) return null;
5647
5647
  try {
5648
- const parsed = yaml3__default.default.load(match[1]);
5648
+ const parsed = yaml3__namespace.default.load(match[1]);
5649
5649
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
5650
5650
  return parsed;
5651
5651
  }
@@ -5699,7 +5699,7 @@ function walkHandoffSidecars(dir, fileList = []) {
5699
5699
  function extractArtifactData(filePath, content) {
5700
5700
  if (filePath.endsWith(".yaml") || filePath.endsWith(".yml")) {
5701
5701
  try {
5702
- const parsed = yaml3__default.default.load(content);
5702
+ const parsed = yaml3__namespace.default.load(content);
5703
5703
  return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
5704
5704
  } catch {
5705
5705
  return null;
@@ -6004,7 +6004,7 @@ function parseInputFromIds(rawFrom) {
6004
6004
  }
6005
6005
  function renderCitationsYamlBlock(citedArtifacts) {
6006
6006
  if (citedArtifacts.length === 0) return "";
6007
- return yaml3__default.default.dump(
6007
+ return yaml3__namespace.default.dump(
6008
6008
  citedArtifacts.map((c) => ({ id: c.id, digest: c.digest, comment: c.comment })),
6009
6009
  { indent: 2, lineWidth: -1 }
6010
6010
  ).trim().split("\n").map((line) => ` ${line}`).join("\n");
@@ -6645,7 +6645,7 @@ function renderTasksFile(changeDir, canonicalId, name, author, dateStr, reqIds)
6645
6645
  const tasksPath = path14__namespace.join(changeDir, "tasks.md");
6646
6646
  const tasksFm = buildTasksFrontmatter(canonicalId, name, reqIds);
6647
6647
  const header = `---
6648
- ${yaml3__default.default.dump(tasksFm, { indent: 2, lineWidth: -1 }).trim()}
6648
+ ${yaml3__namespace.default.dump(tasksFm, { indent: 2, lineWidth: -1 }).trim()}
6649
6649
  ---
6650
6650
  `;
6651
6651
  const body = TASKS_BODY.replaceAll("{{CANONICAL_ID}}", canonicalId).replaceAll("{{NAME}}", name).replaceAll("{{AUTHOR}}", author).replaceAll("{{DATE}}", dateStr);
@@ -6934,7 +6934,7 @@ function normalizeParsedRule(raw, idx) {
6934
6934
  function parseDlpDoc(yamlContent) {
6935
6935
  let doc;
6936
6936
  try {
6937
- doc = yaml3__default.default.load(yamlContent);
6937
+ doc = yaml3__namespace.default.load(yamlContent);
6938
6938
  } catch (err) {
6939
6939
  throw new Error(`[AI-SDLC Fail-Closed] Invalid YAML in dlp-policy: ${err instanceof Error ? err.message : String(err)}`);
6940
6940
  }
@@ -7190,7 +7190,7 @@ function parseFrontmatter(content) {
7190
7190
  const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
7191
7191
  if (!match) return { frontmatter: {}, body: content };
7192
7192
  try {
7193
- const parsed = yaml3__default.default.load(match[1]);
7193
+ const parsed = yaml3__namespace.default.load(match[1]);
7194
7194
  const frontmatter = parsed && typeof parsed === "object" ? parsed : {};
7195
7195
  return { frontmatter, body: content.substring(match[0].length) };
7196
7196
  } catch {
@@ -7749,7 +7749,7 @@ function parseTasksDoc(content) {
7749
7749
  if (!match) return { frontmatter: { tasks: [] }, body: content };
7750
7750
  let parsed;
7751
7751
  try {
7752
- parsed = yaml3__default.default.load(match[1]);
7752
+ parsed = yaml3__namespace.default.load(match[1]);
7753
7753
  } catch {
7754
7754
  return { frontmatter: { tasks: [] }, body: content };
7755
7755
  }
@@ -8390,7 +8390,10 @@ function executeResolvedBinary(resolvedBin, bin, realManifest) {
8390
8390
  });
8391
8391
  return mapSpawnResult(res);
8392
8392
  } finally {
8393
- fs12__namespace.rmSync(tempHome, { recursive: true, force: true });
8393
+ try {
8394
+ fs12__namespace.rmSync(tempHome, { recursive: true, force: true, maxRetries: 3 });
8395
+ } catch {
8396
+ }
8394
8397
  }
8395
8398
  }
8396
8399
  function runSafe(bin, rootDir, manifestDir) {
@@ -11080,7 +11083,7 @@ function applySastThresholds(defaults, thresholds) {
11080
11083
  }
11081
11084
  function parseYamlPolicyFile(policyPath) {
11082
11085
  try {
11083
- return yaml3__default.default.load(fs12__namespace.default.readFileSync(policyPath, "utf-8"));
11086
+ return yaml3__namespace.default.load(fs12__namespace.default.readFileSync(policyPath, "utf-8"));
11084
11087
  } catch (err) {
11085
11088
  throw new SarifIngestionError(
11086
11089
  "ERR_SARIF_MALFORMED",
@@ -11213,7 +11216,7 @@ function readFailOnMissingToolFromQualityPolicy(rootDir) {
11213
11216
  const policyPath = path14__namespace.join(rootDir, "quality-policy.yaml");
11214
11217
  if (!fs12__namespace.default.existsSync(policyPath)) return false;
11215
11218
  try {
11216
- const doc = yaml3__default.default.load(fs12__namespace.default.readFileSync(policyPath, "utf-8"));
11219
+ const doc = yaml3__namespace.default.load(fs12__namespace.default.readFileSync(policyPath, "utf-8"));
11217
11220
  const rt = doc?.release_thresholds;
11218
11221
  const sast = rt?.sast_analysis;
11219
11222
  return Boolean(sast?.fail_on_missing_tool ?? doc?.fail_on_missing_tool);
@@ -11656,7 +11659,7 @@ function parseVexStatements(doc) {
11656
11659
  function parseLicenseDoc(content) {
11657
11660
  let doc;
11658
11661
  try {
11659
- doc = yaml3__default.default.load(content);
11662
+ doc = yaml3__namespace.default.load(content);
11660
11663
  } catch (err) {
11661
11664
  throw new Error(`[AI-SDLC Fail-Closed] Invalid YAML in license-policy: ${err instanceof Error ? err.message : String(err)}`);
11662
11665
  }
@@ -11805,7 +11808,7 @@ function generateLicenseReportMarkdown(dependencies, violations, policy, sbomPat
11805
11808
  function parseManifestItems(manifestFile) {
11806
11809
  if (!fs12__namespace.existsSync(manifestFile)) return [];
11807
11810
  try {
11808
- const doc = yaml3__default.default.load(fs12__namespace.readFileSync(manifestFile, "utf-8"));
11811
+ const doc = yaml3__namespace.default.load(fs12__namespace.readFileSync(manifestFile, "utf-8"));
11809
11812
  return Array.isArray(doc?.evaluated_dependencies) ? doc.evaluated_dependencies : [];
11810
11813
  } catch {
11811
11814
  return [];
@@ -12084,7 +12087,7 @@ function detectProfileFromChange(changeDir) {
12084
12087
  const rawSpec = fs12__namespace.readFileSync(specFile, "utf-8").replace(/^\uFEFF/, "");
12085
12088
  const match = rawSpec.match(/^---\r?\n([\s\S]*?)\r?\n---/);
12086
12089
  if (match) {
12087
- const parsedFm = yaml3__default.default.load(match[1]);
12090
+ const parsedFm = yaml3__namespace.default.load(match[1]);
12088
12091
  if (parsedFm && parsedFm.profile && ["patch", "standard", "critical"].includes(String(parsedFm.profile))) {
12089
12092
  return parsedFm.profile;
12090
12093
  }
@@ -12243,7 +12246,7 @@ function parseMdFrontmatter(raw) {
12243
12246
  return { fm: {}, body: cleaned.trim() };
12244
12247
  }
12245
12248
  try {
12246
- const parsed = yaml3__default.default.load(match[1]);
12249
+ const parsed = yaml3__namespace.default.load(match[1]);
12247
12250
  const fm = parsed && typeof parsed === "object" ? parsed : {};
12248
12251
  return { fm, body: cleaned.substring(match[0].length).trim() };
12249
12252
  } catch {
@@ -12593,7 +12596,7 @@ function extractParsedFrontmatter(content) {
12593
12596
  const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
12594
12597
  if (!match) return null;
12595
12598
  try {
12596
- const parsed = yaml3__default.default.load(match[1]);
12599
+ const parsed = yaml3__namespace.default.load(match[1]);
12597
12600
  if (parsed && typeof parsed === "object") {
12598
12601
  const fm = parsed;
12599
12602
  if (fm.id && isRequirementArtifact2(fm)) {
@@ -13051,7 +13054,7 @@ function runGitleaksCli(rootDir) {
13051
13054
  try {
13052
13055
  const output = child_process3.execFileSync(
13053
13056
  "gitleaks",
13054
- ["detect", "--no-git", "--report-format", "json", "--report-path", "stdout"],
13057
+ ["detect", "--no-git", "--report-format", "json", "--report-path", "-"],
13055
13058
  {
13056
13059
  cwd: rootDir,
13057
13060
  encoding: "utf-8",
@@ -13806,7 +13809,7 @@ var PII_SAST_RULES = [
13806
13809
  function parsePrivacyDoc(raw, candidate) {
13807
13810
  let parsed;
13808
13811
  try {
13809
- parsed = yaml3__default.default.load(raw);
13812
+ parsed = yaml3__namespace.default.load(raw);
13810
13813
  } catch (err) {
13811
13814
  throw new Error(`[AI-SDLC Fail-Closed] Invalid YAML in privacy-policy '${candidate}': ${err instanceof Error ? err.message : String(err)}`);
13812
13815
  }
@@ -14274,6 +14277,116 @@ function verifyPrivacy(options = {}) {
14274
14277
  writePrivacyOutputsIfNeeded(result, options, policy, rootDir);
14275
14278
  return result;
14276
14279
  }
14280
+ function parseSkillFrontmatter(content) {
14281
+ const normalized = content.replace(/\r\n/g, "\n");
14282
+ const match = normalized.match(/^---\n([\s\S]*?)\n---/);
14283
+ if (!match) return null;
14284
+ try {
14285
+ const parsed = yaml3__namespace.load(match[1]);
14286
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
14287
+ } catch {
14288
+ return null;
14289
+ }
14290
+ }
14291
+ function extractReferenceLinks(content) {
14292
+ const links = /* @__PURE__ */ new Set();
14293
+ const regex = /\(\.\/(references\/[^)\s]+\.md)\)/g;
14294
+ let match;
14295
+ while ((match = regex.exec(content)) !== null) {
14296
+ links.add(match[1]);
14297
+ }
14298
+ return Array.from(links);
14299
+ }
14300
+ function checkSkillReferences(skillDir, relSkillFile, content) {
14301
+ const violations = [];
14302
+ for (const refRel of extractReferenceLinks(content)) {
14303
+ if (!fs12__namespace.existsSync(path14__namespace.join(skillDir, refRel))) {
14304
+ violations.push({
14305
+ skillFile: relSkillFile,
14306
+ code: "BROKEN_REFERENCE",
14307
+ message: `Referenced file './${refRel}' does not exist`
14308
+ });
14309
+ }
14310
+ }
14311
+ return violations;
14312
+ }
14313
+ function validateSingleSkill(skillDir, rootDir, expectedName) {
14314
+ const skillFile = path14__namespace.join(skillDir, "SKILL.md");
14315
+ if (!fs12__namespace.existsSync(skillFile)) return [];
14316
+ const relSkillFile = path14__namespace.relative(rootDir, skillFile).replace(/\\/g, "/");
14317
+ const content = fs12__namespace.readFileSync(skillFile, "utf-8");
14318
+ const fm = parseSkillFrontmatter(content);
14319
+ if (!fm) {
14320
+ return [{ skillFile: relSkillFile, code: "MISSING_FRONTMATTER", message: "Missing or invalid YAML frontmatter" }];
14321
+ }
14322
+ const violations = [];
14323
+ if (typeof fm.name !== "string" || fm.name.trim() !== expectedName) {
14324
+ violations.push({ skillFile: relSkillFile, code: "INVALID_NAME", message: `Frontmatter name must match '${expectedName}'` });
14325
+ }
14326
+ if (typeof fm.description !== "string" || fm.description.trim().length < 10) {
14327
+ violations.push({ skillFile: relSkillFile, code: "MISSING_DESCRIPTION", message: "Frontmatter description is missing or too short" });
14328
+ }
14329
+ return [...violations, ...checkSkillReferences(skillDir, relSkillFile, content)];
14330
+ }
14331
+ function verifySkillsIntegrity(rootDir = process.cwd()) {
14332
+ const resolvedRoot = path14__namespace.resolve(rootDir);
14333
+ const roots = [path14__namespace.join(resolvedRoot, ".agent", "skills"), path14__namespace.join(resolvedRoot, ".claude", "skills")];
14334
+ const violations = [];
14335
+ let checkedSkills = 0;
14336
+ for (const skillsRoot of roots) {
14337
+ if (!fs12__namespace.existsSync(skillsRoot)) continue;
14338
+ for (const entry of fs12__namespace.readdirSync(skillsRoot, { withFileTypes: true })) {
14339
+ if (!entry.isDirectory()) continue;
14340
+ const skillDir = path14__namespace.join(skillsRoot, entry.name);
14341
+ if (fs12__namespace.existsSync(path14__namespace.join(skillDir, "SKILL.md"))) {
14342
+ checkedSkills++;
14343
+ violations.push(...validateSingleSkill(skillDir, resolvedRoot, entry.name));
14344
+ }
14345
+ }
14346
+ }
14347
+ return { success: violations.length === 0, checkedSkills, violations };
14348
+ }
14349
+ var SKILL_EXPECTED_TOOLS = {
14350
+ "aisdlc-greenfield": ["new", "verify_schemas", "sdd_change_new", "verify"],
14351
+ "aisdlc-legacy-onboarding": ["verify_licenses", "verify_security", "verify_privacy", "sdd_check_fix"],
14352
+ "aisdlc-increment": ["sdd_change_new", "verify_governance", "sdd_check_fix", "verify"],
14353
+ "aisdlc-inspector": ["inspect_element"],
14354
+ "aisdlc-doctor-migrate": ["doctor", "migrate"],
14355
+ "aisdlc-release-compliance": ["verify", "kpi_release", "report_dashboard"],
14356
+ "aisdlc-security-sca-triage": ["verify_security", "verify_privacy", "verify_licenses"],
14357
+ "aisdlc-bdd-gherkin": ["sdd_check_fix", "verify_testing"]
14358
+ };
14359
+ function readExecutedMcpTools(auditLogFile) {
14360
+ const executed = /* @__PURE__ */ new Set();
14361
+ if (!fs12__namespace.existsSync(auditLogFile)) return executed;
14362
+ const lines = fs12__namespace.readFileSync(auditLogFile, "utf-8").split(/\r?\n/);
14363
+ for (const line of lines) {
14364
+ const trimmed = line.trim();
14365
+ if (!trimmed) continue;
14366
+ try {
14367
+ const entry = JSON.parse(trimmed);
14368
+ if (typeof entry.tool === "string" && entry.success === true) {
14369
+ executed.add(entry.tool);
14370
+ }
14371
+ } catch {
14372
+ }
14373
+ }
14374
+ return executed;
14375
+ }
14376
+ function verifySkillExecutionEvidence(rootDir, skillId, auditLogPath) {
14377
+ const expectedTools = SKILL_EXPECTED_TOOLS[skillId] || [];
14378
+ const logFile = auditLogPath || path14__namespace.join(path14__namespace.resolve(rootDir), "reports", "mcp-audit.jsonl");
14379
+ const allExecuted = readExecutedMcpTools(logFile);
14380
+ const executedTools = expectedTools.filter((t) => allExecuted.has(t));
14381
+ const missingExpectedTools = expectedTools.filter((t) => !allExecuted.has(t));
14382
+ let status = "NO_EVIDENCE";
14383
+ if (expectedTools.length > 0 && missingExpectedTools.length === 0) {
14384
+ status = "VERIFIED";
14385
+ } else if (executedTools.length > 0) {
14386
+ status = "PARTIAL";
14387
+ }
14388
+ return { skillId, status, expectedTools, executedTools, missingExpectedTools };
14389
+ }
14277
14390
  var VALID_REASONING_EFFORTS = /* @__PURE__ */ new Set(["low", "medium", "high", "max"]);
14278
14391
  function normalizeReasoningEffort(raw) {
14279
14392
  if (!raw) return void 0;
@@ -15172,7 +15285,7 @@ function resolveVersionFromProposal(changeDir) {
15172
15285
  const propContent = fs12__namespace.readFileSync(proposalFile, "utf-8");
15173
15286
  const propFm = propContent.match(/^---\r?\n([\s\S]*?)\r?\n---/);
15174
15287
  if (!propFm) return "1.0.0";
15175
- const parsedProp = yaml3__default.default.load(propFm[1]);
15288
+ const parsedProp = yaml3__namespace.default.load(propFm[1]);
15176
15289
  return parsedProp?.version ? String(parsedProp.version) : "1.0.0";
15177
15290
  }
15178
15291
  function resolveChangeVersion(fm, changeDir) {
@@ -15191,7 +15304,7 @@ function parseTasksFrontmatter(tasksFile) {
15191
15304
  const content = fs12__namespace.readFileSync(tasksFile, "utf-8");
15192
15305
  const fmMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
15193
15306
  if (!fmMatch) return null;
15194
- const fm = yaml3__default.default.load(fmMatch[1]);
15307
+ const fm = yaml3__namespace.default.load(fmMatch[1]);
15195
15308
  return fm && Array.isArray(fm.tasks) ? fm : null;
15196
15309
  } catch {
15197
15310
  return null;
@@ -16134,7 +16247,7 @@ function extractFrontmatter2(fileContent) {
16134
16247
  const match = fileContent.match(/^---\r?\n([\s\S]*?)\r?\n---/);
16135
16248
  if (!match) return null;
16136
16249
  try {
16137
- return yaml3__default.default.load(match[1]) || null;
16250
+ return yaml3__namespace.default.load(match[1]) || null;
16138
16251
  } catch {
16139
16252
  return null;
16140
16253
  }
@@ -19103,6 +19216,149 @@ function formatAisdlcVersionOutput(rootDir = process.cwd()) {
19103
19216
  return `${installed} (repo: ${manifest.version} \u2014 differs from installed CLI)`;
19104
19217
  }
19105
19218
 
19219
+ // src/init/skill-references.ts
19220
+ var SKILL_REFERENCES = {
19221
+ "aisdlc-greenfield": [
19222
+ {
19223
+ filename: "inception-checklist.md",
19224
+ content: `# Greenfield Inception Quick Reference
19225
+
19226
+ ## Phase 0 Discovery Interview (Up to 15 Questions)
19227
+ 1. **Mission & Problem**: Core business problem and measurable success criteria.
19228
+ 2. **Primary Actors (\`ACT-*\`)**: Human roles and external systems.
19229
+ 3. **Interaction Modality (\`ARCH-INTRO-001\`)**: Web UI, Desktop GUI, Console/TUI/CLI, Mobile, or Headless API/SDK (never library-only when human actors exist).
19230
+ 4. **Delivery & Operation Model**: Cloud SaaS, Self-Hosted/On-Premise, Local Desktop/CLI, or SDK package.
19231
+ 5. **Visual Aesthetic Standard**: Bootstrap 5-style responsive Web, modern rounded/elevated Desktop, or colorized rich Console/TUI.
19232
+ 6. **Master Data CRUD**: Foundational catalogs/entities needed to operate core flows without manual DB seeding.
19233
+ 7. **MVP Use Cases (\`UC-*\`) & Quality Goals (\`QR-*\`)**: Strict MVP core vs. roadmap backlog.
19234
+
19235
+ ## Upstream Artifact Chain
19236
+ \`ARCH-INTRO-001\` -> \`ACT-*\` / \`JRN-*\` / \`UC-*\` / \`BR-*\` / \`FR-*\` / \`QR-*\` -> \`agent-expert-user\` (Design Mode) -> \`ACT-THREAT-*\` / \`ABUSE-*\` / \`SEC-REQ-*\` -> \`DATA-ASSET-*\` / \`PRIV-ROPA-*\` / \`PRIV-REQ-*\` -> \`CMP-*\` / \`ARCH-DEP-001\` / \`ADR-*\` -> Checkpoint 1 (\`agent-auditor\` || \`agent-adversary\`).
19237
+ `
19238
+ }
19239
+ ],
19240
+ "aisdlc-legacy-onboarding": [
19241
+ {
19242
+ filename: "retro-inception-and-strangler.md",
19243
+ content: `# Legacy / Brownfield Retro-Inception Reference
19244
+
19245
+ ## Read-Only Baseline Audit Commands
19246
+ - Licenses & AST Quality: \`npx aisdlc verify licenses\` and \`npx aisdlc report quality\`
19247
+ - Secrets & SAST: \`npx aisdlc verify security\` (exit code 4 = halt & rotate secrets immediately)
19248
+ - Privacy & PII: \`npx aisdlc verify privacy\` (exit code 5 = PII in logs/prompts/seeds)
19249
+
19250
+ ## Bounded Retro-Inception Rules
19251
+ - Document only the system boundary (\`ARCH-INTRO-001\`, core \`CMP-*\`) and the specific domain under active evolution (\`UC-*\`, \`FR-*\`).
19252
+ - **Zero Drive-By Rewrites**: Never mass-refactor untouched legacy modules. Apply the Strangler / Boy Scout rule via governed SDD tasks (\`TSK-*\`).
19253
+ - **Characterization First**: Capture existing behavior in \`FR-*\` Gherkin scenarios before modifying logic.
19254
+ `
19255
+ }
19256
+ ],
19257
+ "aisdlc-increment": [
19258
+ {
19259
+ filename: "sdd-lifecycle-and-gates.md",
19260
+ content: `# SDD Increment & 12 Quality Gates Reference
19261
+
19262
+ ## Friction Profiles & Anti-Bypass Paths
19263
+ - \`patch\`: <= 2 source files, zero Anti-Bypass paths (\`spec.md\` only).
19264
+ - \`standard\`: Functional increments, new/updated \`UC-*\` / \`FR-*\` (\`proposal.md\`, \`spec.md\`, \`design.md\`, \`tasks.md\`, \`handoff.yaml\`).
19265
+ - \`critical\`: Security enclaves (\`SEC-ENC-*\`), special-category PII (\`DPIA-*\`), schemas, migrations.
19266
+ - **Anti-Bypass Paths** (never \`patch\`): \`schemas/\`, \`specs/security/\`, \`specs/privacy/\`, \`packages/security/\`, \`SEC-ENC-*\`, \`09_decisions/\`, \`migrations/\`, \`*-policy.yaml\`.
19267
+
19268
+ ## 4-Tier Git Hierarchy & Trailers
19269
+ \`task/<PARENT-ID>/<TSK-ID>-<slug>\` -> \`feat/<CHG-ID>-<slug>\` -> \`release/vX.Y.Z\` -> \`main\`
19270
+ Commit trailers: \`Author-Type: agent\`, \`AI-Model: <model>\`, \`AI-Reasoning-Effort: <level>\`, \`Task-ID: TSK-XXX\`, \`Change-ID: CHG-XXX\`.
19271
+
19272
+ ## Single-Use-Case Rule
19273
+ Enforce \`1 UC-* = 1 CHG-*\` and 100% coverage of \`design.md\` & \`handoff.yaml\` in \`tasks.md\`.
19274
+ `
19275
+ }
19276
+ ],
19277
+ "aisdlc-inspector": [
19278
+ {
19279
+ filename: "traceability-graph-legend.md",
19280
+ content: `# 360\xB0 Traceability Graph Legend
19281
+
19282
+ ## Node Statuses
19283
+ - \`COMPLIANT\`: All upstream citations and downstream test/code links are valid and drift-free.
19284
+ - \`ORPHAN\`: Missing upstream justification or downstream implementation/verification link.
19285
+ - \`DRIFT\`: Upstream SHA-256 citation digest no longer matches the referenced artifact.
19286
+
19287
+ ## UX Rule (Report First, Question After)
19288
+ Always render the full technical report (Header, File Location, Summary, Upstream \u2197\uFE0F, Downstream \u2198\uFE0F, Numbered Items) before prompting for the next navigation step.
19289
+ `
19290
+ }
19291
+ ],
19292
+ "aisdlc-doctor-migrate": [
19293
+ {
19294
+ filename: "migrate-safety-and-ratchet.md",
19295
+ content: `# Doctor & Migrate Safety Reference
19296
+
19297
+ ## Migration File Classifications
19298
+ - \`UP_TO_DATE\`: Local file matches canonical SHA-256 (LF-normalized).
19299
+ - \`CLEAN_UPDATE\`: Local file matches base or is missing; safely updated/created.
19300
+ - \`LOCAL_OVERRIDE_PRESERVED\`: Local customization detected; preserved with exit code \`1\` unless \`--force\` is passed.
19301
+ - \`CONFLICT\`: Structural corruption detected (exit code \`2\`).
19302
+
19303
+ ## Safety Guardrails
19304
+ - Mutating migrations are blocked on protected branches (\`main\`, \`master\`, \`release/*\`) with \`ERR_PROTECTED_BRANCH_MIGRATION\`.
19305
+ - Backups are written to \`.backup/migration-<timestamp>-<rand>/\` with automatic rollback on failure.
19306
+ - Policy Ratchet blocks relaxing stricter thresholds in \`quality-policy.yaml\` / \`privacy-policy.yaml\` without \`--allow-policy-downgrade\`.
19307
+ `
19308
+ }
19309
+ ],
19310
+ "aisdlc-release-compliance": [
19311
+ {
19312
+ filename: "regulatory-bundles-and-semver.md",
19313
+ content: `# Release Compliance & SemVer Reference
19314
+
19315
+ ## Regulatory Compliance Evidence Bundle
19316
+ \`npx aisdlc report compliance --strict --offline\` generates \`reports/audit-evidence-bundle.json\` mapping all 12 Quality Gates to EU AI Act, ISO 42001, NIST SSDF, OSCAL, and in-toto provenance.
19317
+
19318
+ ## Highest-Precedence SemVer Rule
19319
+ When consolidating multiple increments in a single release or PR, apply **only one** version bump matching the highest friction profile:
19320
+ \`critical\` (Major \`X.0.0\`) > \`standard\` (Minor \`x.Y.0\`) > \`patch\` (Patch \`x.y.Z\`).
19321
+ `
19322
+ }
19323
+ ],
19324
+ "aisdlc-security-sca-triage": [
19325
+ {
19326
+ filename: "security-and-license-gates.md",
19327
+ content: `# Security, Privacy & License Triage Reference
19328
+
19329
+ ## Deterministic Exit Codes
19330
+ - Exit Code \`4\`: Gate 11 (Secrets) or Gate 12 (SAST) CRITICAL/HIGH failure.
19331
+ - Exit Code \`5\`: Gate 8 (Privacy/PII) CRITICAL/HIGH failure.
19332
+
19333
+ ## SPDX License Policy Categories (\`license-policy.yaml\`)
19334
+ - \`ALLOW\`: \`MIT\`, \`Apache-2.0\`, \`BSD-2-Clause\`, \`BSD-3-Clause\`, \`ISC\`, \`Unlicense\`, \`CC0-1.0\`, \`0BSD\`.
19335
+ - \`REVIEW_REQUIRED\`: Weak copyleft (\`LGPL-*\`, \`MPL-2.0\`, \`EPL-2.0\`).
19336
+ - \`DENY\`: Strong viral copyleft (\`GPL-*\`, \`AGPL-*\`).
19337
+ - \`COMMERCIAL_APPROVAL_REQUIRED\`: \`SSPL-1.0\`, \`BSL-1.1\`.
19338
+ `
19339
+ }
19340
+ ],
19341
+ "aisdlc-bdd-gherkin": [
19342
+ {
19343
+ filename: "gherkin-polyglot-matrix.md",
19344
+ content: `# Deterministic Polyglot Gherkin Matrix
19345
+
19346
+ ## Supported Step Scaffolding Targets (\`--lang\`)
19347
+ - \`ts\`: TypeScript (Vitest / Cucumber)
19348
+ - \`py\`: Python (pytest-bdd / behave)
19349
+ - \`go\`: Go (godog)
19350
+ - \`rs\`: Rust (cucumber-rs)
19351
+ - \`cs\`: C# / .NET (Reqnroll / SpecFlow)
19352
+
19353
+ ## Mandatory Commands
19354
+ 1. Extract: \`npx aisdlc gherkin extract --all\`
19355
+ 2. Scaffold RED steps: \`npx aisdlc gherkin scaffold <feature-file> --lang <lang> --fallback\`
19356
+ 3. Verify sync: \`npx aisdlc verify gherkin\`
19357
+ `
19358
+ }
19359
+ ]
19360
+ };
19361
+
19106
19362
  // src/init/agent-templates.ts
19107
19363
  var SPECIALIZED_AGENT_TEMPLATES = [
19108
19364
  {
@@ -19481,8 +19737,54 @@ var LIFECYCLE_SKILL_TEMPLATES = [
19481
19737
  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), and [`process/10_quality_management_and_release_gates.md`](../../process/10_quality_management_and_release_gates.md).",
19482
19738
  globs: "specs/**, architecture/**, src/**, packages/**, tests/**",
19483
19739
  body: '## Purpose & Trigger\nUse this skill whenever a user or agent requests to **inspect, explain, trace, or navigate** any element of the system:\n- **Requirements & Product:** `UC-*`, `FR-*`, `QR-*`, `BR-*`, `BC-*`, `ABUSE-*`, `DATA-ASSET-*`, `PRIV-ROPA-*`, `ARCH-INTRO-*`.\n- **Architecture & Decisions:** `CMP-*`, `ADR-*`, `SEC-ENC-*`.\n- **SDD & Tasks:** `TSK-*`, `CHG-*`, `HOF-*`.\n- **Source Code Files:** `src/**/*.ts`, `packages/**/*.ts`, etc.\n- **Verification Suites:** `.feature` BDD files, unit/integration specs.\n\nThis skill provides **impact analysis, context comprehension, and interactive graph exploration** with zero guesswork.\n\n---\n\n## Interactive Execution Playbook\n\n### Step 1: Target Resolution\n1. Extract the target identifier or file path indicated by the user (e.g., `FR-001`, `CMP-CORE`, `src/auth/jwt.ts`, `TSK-001`).\n2. If no target was specified, prompt the user with common anchor options (e.g., primary Use Cases `UC-*`, Core Components `CMP-*`, or an open input).\n\n### Step 2: Deterministic Inspection Engine\nExecute the inspection via MCP or CLI:\n* **Primary (MCP Tool):**\n Invoke MCP tool `inspect_element`:\n ```json\n {\n "query": "<target-id-or-path>"\n }\n ```\n* **Fallback (CLI):**\n Run command:\n ```bash\n npx aisdlc inspect "<target-id-or-path>" --json\n ```\n\n---\n\n### Step 3: Complete Technical Report Delivery (MANDATORY FIRST)\n> [!IMPORTANT]\n> **CRITICAL UX DIRECTIVE (Report First, Question After):**\n> The agent MUST always render and deliver the complete, detailed technical report to the user in visible text **BEFORE** prompting for the next element. Never invoke a blocking dialog or selector on an empty turn without the user having the full inspection visible.\n\nThe rendered response MUST contain:\n1. **Header:** Artifact ID, Title, Type (`requirement`, `component`, `source-file`, `task`), Layer (`product`, `architecture`, `code`, `test`, `governance`), and Status (`COMPLIANT`, `ORPHAN`, `DRIFT`).\n2. **File Location:** Clickable markdown link to the file.\n3. **Technical Summary:** Concise explanation (2\u20134 sentences) of what the element does, its responsibilities, key interfaces, and consolidated evolutionary increments (`### Incremento (CHG-*)`). If a canonical requirement still shows boilerplate text despite completed changes in `specs/changes/`, run `sdd_integrate` with `all: true` (`npx aisdlc sdd integrate --all`) first so canonical requirements reflect the consolidated specification.\n4. **Upstream Relations (Derives from / Mitigates / Governed by):**\n - \u2197\uFE0F List all parent requirements, use cases, business rules, or decisions that justify this element.\n5. **Downstream Relations (Satisfied by / Implemented in / Verified by):**\n - \u2198\uFE0F List all components implementing it, tasks developing it, and test suites validating it.\n6. **Numbered Navigable Items:** Clear, numbered list of connected nodes with their ID, type, and relationship.\n\n---\n\n### Step 4: Subsequent Navigation Formulation & Selector\nOnce the technical report is fully constructed:\n1. Formulate the closing question inviting the user to continue navigating the graph.\n2. If using the interactive selector (`ask_question`), execute it **in conjunction with or immediately following the complete report text**:\n * **Question:** *"\xBFHacia qu\xE9 elemento conectado deseas continuar la exploraci\xF3n?"*\n * **Options:** Formatted list of related elements from `relatedItems`:\n - `(Recommended) <ID-1> (<Type-1> \u2014 <relation-1>)`\n - `<ID-2> (<Type-2> \u2014 <relation-2>)`\n - `<ID-N> (<Type-N> \u2014 <relation-N>)`\n - `Terminar exploraci\xF3n`\n3. **Navigation Loop:**\n - When the user selects or indicates an element (either via UI selector or plain text/number), repeat **Step 2** with the new selection.\n - If the user selects `Terminar exploraci\xF3n`, summarize the traversal journey and conclude.'
19740
+ },
19741
+ {
19742
+ id: "aisdlc-doctor-migrate",
19743
+ title: "Environment Diagnostics & Framework Migration Playbook",
19744
+ description: "Diagnose AI-SDLC environment health, git hooks, and security tools (aisdlc doctor), synchronize IDE agent configs (aisdlc sync), and safely upgrade schemas, templates, policies, and skills (aisdlc migrate) with backup and policy-ratchet protection.",
19745
+ references: "[`process/09_agent_protocols.md`](../../process/09_agent_protocols.md) and [`process/10_quality_management_and_release_gates.md`](../../process/10_quality_management_and_release_gates.md).",
19746
+ globs: ".aisdlc.json, schemas/**, templates/**, *-policy.yaml, .agent/**, .claude/**, .cursor/**",
19747
+ body: "## Purpose & Trigger\nUse this skill whenever the user asks to **diagnose the AI-SDLC setup, repair git hooks, check installed security/SCA tools, synchronize IDE configs, or upgrade/migrate schemas, templates, policies, and skills**.\n\n## End-to-End Execution Playbook\n\n### Step 1: Environment & Toolchain Diagnostics (`aisdlc doctor`)\n1. Run MCP tool `doctor` or CLI `npx aisdlc doctor --json` (use `--offline` in air-gapped environments, `--strict` in CI).\n2. Inspect checks for: Node.js LTS, Git branch safety (never on `main`/`master`/`release/*`), Git hooks (`pre-commit`, `prepare-commit-msg`), schemas/PDaC integrity, and external security/SCA binaries (`gitleaks`, `semgrep`, `trivy`, `syft`).\n3. If hooks are missing or broken, run `npx aisdlc doctor --fix` (or `npx aisdlc git hook install`).\n\n### Step 2: Safe Framework Migration (`aisdlc migrate`)\n1. **Protected Branch Guard**: Never run mutating migrations on `main`, `master`, or `release/*`. Switch to a working branch first.\n2. **Preview First**: Always run MCP tool `migrate` with `dryRun: true` (`npx aisdlc migrate --dry-run --json`) to inspect `upToDate`, `cleanUpdated`, `overridesPreserved`, and `conflicts`.\n3. **Execute Migration**: Run `npx aisdlc migrate` (creates `.backup/migration-<timestamp>/` automatically). Local customizations are preserved (`LOCAL_OVERRIDE_PRESERVED`, exit code `1`) unless `--force` is explicitly requested.\n4. **Policy Ratchet Guard**: `migrate` blocks relaxing stricter local thresholds in `quality-policy.yaml` / `privacy-policy.yaml` unless `--allow-policy-downgrade` is explicitly authorized by a human Tech Lead.\n\n### Step 3: IDE Agent Config Synchronization (`aisdlc sync`)\n1. To refresh `.agent/`, `.claude/`, `.cursor/`, `.github/agents/`, and MCP configs without touching `specs/` or `src/`, run `npx aisdlc sync` (or `npx aisdlc sync --agents antigravity,cursor`)."
19748
+ },
19749
+ {
19750
+ id: "aisdlc-release-compliance",
19751
+ title: "Release Consolidation, SemVer & Regulatory Compliance Playbook",
19752
+ description: "Consolidate release milestones (release/vX.Y.Z), compute release KPIs (kpi_release), generate CycloneDX SBOMs and THIRD_PARTY_NOTICES.md, build Regulatory Compliance Evidence Bundles (EU AI Act, ISO 42001, NIST SSDF, OSCAL, in-toto), and apply highest-precedence SemVer promotion.",
19753
+ references: "[`process/10_quality_management_and_release_gates.md`](../../process/10_quality_management_and_release_gates.md) and [`process/11_git_branching_and_lifecycle.md`](../../process/11_git_branching_and_lifecycle.md).",
19754
+ globs: "reports/**, compliance/**, .changeset/**, package.json",
19755
+ body: "## Purpose & Trigger\nUse this skill when **closing a release milestone (`release/vX.Y.Z`), preparing a regulatory/audit evidence bundle, generating SBOM/legal notices, or calculating consolidated SemVer bumps**.\n\n## End-to-End Execution Playbook\n\n### Step 1: Consolidated Quality, License & Supply Chain Verification\n1. Run `npx aisdlc verify all` to confirm all 12 Quality Gates pass.\n2. Generate CycloneDX 1.5 SBOM and legal attributions: `npx aisdlc verify licenses --sbom reports/sbom.cdx.json --notices THIRD_PARTY_NOTICES.md`.\n\n### Step 2: Regulatory Compliance Evidence Bundle\n1. Generate the deterministic evidence bundle (EU AI Act, ISO 42001, NIST SSDF, OSCAL, in-toto provenance) via `npx aisdlc report compliance --strict --offline` (use `--dry-run` to preview, `--keyless` for OIDC attestation claims).\n2. Verify `reports/audit-evidence-bundle.json` is valid and free of unmasked PII/secrets (DLP sanitized).\n\n### Step 3: Release KPIs, Reports & Highest-Precedence SemVer\n1. Compute release KPIs and DIR/rework metrics via MCP tool `kpi_release` (`npx aisdlc kpi release --release release/vX.Y.Z --base main`).\n2. Regenerate canonical reports (`report_quality`, `report_dashboard`) on the release branch.\n3. **Highest-Precedence SemVer Rule**: When consolidating multiple increments in a single release/PR, apply **ONLY one version bump** matching the highest friction profile (`critical` = Major, `standard` = Minor, `patch` = Patch).\n4. Open the Release PR for human Tech Lead approval and SemVer tagging (never auto-approve or auto-merge)."
19756
+ },
19757
+ {
19758
+ id: "aisdlc-security-sca-triage",
19759
+ title: "Security, SAST, Secrets & SCA License Triage Playbook",
19760
+ description: "Triage and remediate failures from Gate 7 (SCA Licenses & Vulnerabilities), Gate 8 (Privacy/PII), Gate 11 (Secrets), and Gate 12 (SAST), including native SARIF/SBOM ingestion (--sarif, --orchestrate, --sbom-input) and audited security suppressions.",
19761
+ references: "[`process/03_security_by_design.md`](../../process/03_security_by_design.md), [`process/04_open_source_license_compliance.md`](../../process/04_open_source_license_compliance.md), and [`process/07_security_and_license_validation.md`](../../process/07_security_and_license_validation.md).",
19762
+ globs: "security/**, specs/security/**, license-policy.yaml, privacy-policy.yaml, compliance/**",
19763
+ body: "## Purpose & Trigger\nUse this skill when **a security, secrets, privacy, or license gate fails** (e.g., exit code `4` for security/secrets or `5` for privacy), when **ingesting external SARIF/SBOM reports**, or when **evaluating commercial/copyleft dependency exceptions**.\n\n## End-to-End Execution Playbook\n\n### Step 1: Secrets & SAST Triage (Exit Code 4)\n1. Run `npx aisdlc verify security --diff --format sarif -o reports/security.sarif` (add `--gitleaks` or `--semgrep` if native binaries are installed).\n2. For polyglot repositories, run `npx aisdlc verify sast --orchestrate` or ingest external OASIS SARIF v2.1.0 files via `npx aisdlc verify sast --sarif <path...>`.\n3. **Immediate Secret Remediation**: If real credentials are detected, halt feature work, rotate the secret, and remove it from code/history.\n4. **Audited Suppressions**: Never silence findings with inline linter disables. False positives require an audited suppression entry with justification and expiration reviewed by `agent-adversary` / human Tech Lead.\n\n### Step 2: Privacy & PII Triage (Exit Code 5)\n1. Run `npx aisdlc verify privacy --ropa-report reports/ROPA_INVENTORY.md --report reports/PRIVACY_SCAN_REPORT.md`.\n2. Eliminate PII from logs/telemetry/LLM prompts (`[REDACTED]`), ensure `DATA-ASSET-*` and `PRIV-ROPA-*` exist, and escalate `RESTRICTED_SENSITIVE_PII` to a `DPIA-*` request.\n\n### Step 3: SCA License & CVE Triage\n1. Run `npx aisdlc verify licenses --vuln --depth transitive` (or ingest an air-gapped CycloneDX/SPDX SBOM via `--sbom-input <path>`).\n2. Block `GPL`/`AGPL` (viral) and `BSL`/`SSPL` (commercial) unless a human-approved `templates/compliance/commercial-acquisition-request.template.md` authorization is recorded."
19764
+ },
19765
+ {
19766
+ id: "aisdlc-bdd-gherkin",
19767
+ title: "Deterministic BDD & Polyglot Gherkin Scaffolding Playbook",
19768
+ description: "Extract canonical .feature files from Markdown specifications (aisdlc gherkin extract), scaffold failing RED step definitions across TypeScript, Python, Go, Rust, and C# (aisdlc gherkin scaffold), and enforce deterministic BDD synchronization (aisdlc verify gherkin).",
19769
+ references: "[`process/06_spec_driven_development.md`](../../process/06_spec_driven_development.md) and [`process/10_quality_management_and_release_gates.md`](../../process/10_quality_management_and_release_gates.md).",
19770
+ globs: "tests/features/**, tests/steps/**, specs/**",
19771
+ body: "## Purpose & Trigger\nUse this skill whenever **authoring BDD acceptance criteria, extracting `.feature` files, or scaffolding RED step definitions** in TypeScript, Python, Go, Rust, or C#.\n\n## End-to-End Execution Playbook\n\n### Step 1: Author Gherkin Inside Markdown Specs\n1. Never create or edit `tests/features/*.feature` files manually.\n2. Author ```gherkin blocks inside `FR-*`, `SEC-REQ-*`, `PRIV-REQ-*`, or `specs/changes/active/<chg-id>/spec.md` with tags `@<ID> @automated @regression` and `@nominal`, `@boundary`, `@invalid` scenarios.\n\n### Step 2: Deterministic Extraction & Polyglot Step Scaffolding\n1. Run `npx aisdlc gherkin extract --all` (or `npx aisdlc check --fix`) to generate `tests/features/*.feature` deterministically.\n2. Scaffold failing RED step definitions in `tests/steps/` via:\n `npx aisdlc gherkin scaffold <feature-file> --lang <ts|py|go|rs|cs> --fallback`\n (omit `--fallback` when the native BDD generator is installed).\n3. Implement real failing assertions inside the scaffolded step files.\n\n### Step 3: Synchronization Gate\n1. Run `npx aisdlc verify gherkin` and `npx aisdlc verify testing` to confirm 100% Markdown-to-`.feature` parity and scenario coverage."
19484
19772
  }
19485
19773
  ];
19774
+ function formatSkillReferencesSection(skillId) {
19775
+ const refs = SKILL_REFERENCES[skillId];
19776
+ if (!refs || refs.length === 0) return "";
19777
+ const links = refs.map((r) => `- [\`${r.filename}\`](./references/${r.filename})`).join("\n");
19778
+ return `
19779
+ ## Self-Contained References
19780
+ ${links}
19781
+ `;
19782
+ }
19783
+ function formatInlineSkillReferences(skillId) {
19784
+ const refs = SKILL_REFERENCES[skillId];
19785
+ if (!refs || refs.length === 0) return "";
19786
+ return "\n" + refs.map((r) => r.content.trim()).join("\n\n") + "\n";
19787
+ }
19486
19788
  function renderAntigravitySkillFile(skill) {
19487
19789
  return `---
19488
19790
  name: ${skill.id}
@@ -19494,7 +19796,7 @@ description: >-
19494
19796
 
19495
19797
  Canonical Reference: ${skill.references}
19496
19798
 
19497
- ${skill.body}
19799
+ ${skill.body}${formatSkillReferencesSection(skill.id)}
19498
19800
  `;
19499
19801
  }
19500
19802
  function renderCursorSkillFile(skill) {
@@ -19509,7 +19811,7 @@ alwaysApply: false
19509
19811
 
19510
19812
  Canonical Reference: ${skill.references}
19511
19813
 
19512
- ${skill.body}
19814
+ ${skill.body}${formatInlineSkillReferences(skill.id)}
19513
19815
  `;
19514
19816
  }
19515
19817
  function renderClaudeSkillFile(skill) {
@@ -19522,7 +19824,7 @@ description: ${skill.description}
19522
19824
 
19523
19825
  Canonical Reference: ${skill.references}
19524
19826
 
19525
- ${skill.body}
19827
+ ${skill.body}${formatSkillReferencesSection(skill.id)}
19526
19828
  `;
19527
19829
  }
19528
19830
  function renderCopilotSkillFile(skill) {
@@ -19535,7 +19837,7 @@ description: ${skill.description}
19535
19837
 
19536
19838
  Canonical Reference: ${skill.references}
19537
19839
 
19538
- ${skill.body}
19840
+ ${skill.body}${formatInlineSkillReferences(skill.id)}
19539
19841
  `;
19540
19842
  }
19541
19843
  var STARTER_ANTIGRAVITY_RULES = `# Google Antigravity & Gemini CLI Rules - AI-SDLC Framework
@@ -19556,100 +19858,31 @@ This file defines the operational rules and specialized role mappings for Google
19556
19858
 
19557
19859
  ---
19558
19860
 
19559
- ## 2. Specialized Roles Mapping
19560
-
19561
- ### 1. \`agent-product-analyst\` (Product Analyst / Scribe)
19562
- - **Mission**: Capture new product intent via NAF v4 Enterprise & Capability Vision (\`ARCH-INTRO-*\`) and define/refine the product model using ProductShape.
19563
- - **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)**, **modern visual aesthetic & styling standard (Bootstrap 5-style clean responsive web layouts with cards/tables/badges, Fluent/modern desktop aesthetic with rounded corners/elevated panels, or colorized rich terminal console with ANSI palettes/status badges)**, 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.
19564
- - **Input**: Business intent or natural language specification.
19565
- - **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-*\`).
19566
- - **Guardrails**:
19567
- - **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.
19568
- - \`status\` always starts in \`draft\`.
19569
- - In \`UC-*\`, format section \`1. Intent and Outcome\` under the standard English structure: \`As a <ACT-ID>... I want <action>... To <outcome>...\`.
19570
- - Mandatory Gherkin criteria with \`@<ID> @automated @regression\`.
19571
- - Run \`pnpm run verify:schemas\` and \`pnpm run verify:duplicates\` before delivering the draft.
19572
-
19573
- ### 2. \`agent-threat-modeler\` (Threat Modeler and Security Specialist)
19574
- - **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.
19575
- - **Input**: Use cases \`UC-*\`, functional requirements \`FR-*\`, or architecture components (\`CMP-*\`, Mermaid diagrams, ADRs).
19576
- - **Output**: Cybersecurity triad (\`ACT-THREAT-*\`, \`ABUSE-*\`, \`SEC-REQ-*\`) compliant with \`schemas/security/\`, followed by handoff to \`agent-privacy-officer\`.
19577
- - **Guardrails**:
19578
- - \`status\` always starts in \`draft\`.
19579
- - Negative BDD attack and rejection scenarios tagged with \`@security @mitigation\`.
19580
- - Assignment of Zero Trust enclaves \`SEC-ENC-*\`.
19581
-
19582
- ### 3. \`agent-privacy-officer\` (Data Protection & Privacy-by-Design Specialist)
19583
- - **Mission**: Receive handoff from \`agent-threat-modeler\` to model personal data assets (\`DATA-ASSET-*\`), GDPR Art. 30 processing activities (\`PRIV-ROPA-*\`), and LINDDUN / GDPR / ISO 27701 privacy requirements (\`PRIV-REQ-*\`), and audit PR diffs against \`privacy-policy.yaml\`.
19584
- - **Output**: Privacy triad (\`DATA-ASSET-*\`, \`PRIV-ROPA-*\`, \`PRIV-REQ-*\`) in \`specs/privacy/\` compliant with \`schemas/privacy/\`, and \`DPIA-*\` requests when Art. 9 sensitive data is detected.
19585
- - **Guardrails**:
19586
- - \`status\` always starts in \`draft\`.
19587
- - Every \`PRIV-REQ-*\` includes Gherkin scenarios tagged with \`@<PRIV-REQ-ID> @privacy @gdpr @automated @regression\`.
19588
- - Run \`pnpm run verify:privacy\` to block PII in logs/prompts and enforce ROPA & retention/erasure policies.
19589
-
19590
- ### 4. \`agent-system-architect\` (System Architect)
19591
- - **Mission**: Translate the approved product definition into a modular technical architecture based on arc42 enriched with NAF v4.
19592
- - **Output**: Architecture components (\`CMP-*\`), Mermaid diagrams, and immutable \`ADR-*\` records compliant with \`schemas/architecture/\`.
19593
- - **Guardrails**:
19594
- - 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).
19595
- - **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).
19596
- - 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.
19597
-
19598
- ### 5. \`agent-qa-engineer\` (QA Engineer and SDET)
19599
- - **Mission**: Translate approved requirements (\`FR-*\`, \`SEC-REQ-*\`, \`PRIV-REQ-*\`, \`QR-*\`) into comprehensive FAILING (red) BDD/Gherkin, End-to-End (E2E), UI, and unit test suites, before \`agent-developer\` writes production code.
19600
- - **Input**: Approved requirements from the \`handoff.yaml\` sidecar (\`HOF-*\`).
19601
- - **Output**: Failing Gherkin, E2E, and UI test suites covering: nominal case, boundary cases, out-of-range cases, per-interactive-element tests (Happy Path, Sad Path, Boundary Values), and conditional categories (security, privacy, performance, idempotency, postconditions, interface contract).
19602
- - **Guardrails**:
19603
- - FORBIDDEN to include production code or anticipate implementations.
19604
- - **Agreed Project Technology**: Always use the testing frameworks, E2E/UI runners, and technology stack agreed upon for the project (if any), without requiring the user to specify it in the prompt.
19605
- - **Mandatory E2E & UI Testing**: Never forget or omit End-to-End (E2E) and User Interface (UI) tests.
19606
- - **Per-Interactive-Element Coverage**: Create specific tests for every UI element the user can interact with, using external tools such as Playwright or FlatUI (or the agreed project testing technology), covering Happy Path, Sad Path, and Boundary Values for each one.
19607
- - Every \`FR-*\` must have at least nominal + boundary + out-of-range scenarios; missing these blocks handoff to \`agent-developer\`.
19608
- - Mandatory tags: \`@<FR-ID> @automated @regression\`.
19609
- - Run \`pnpm run verify:testing\` before emitting handoff.
19610
-
19611
- ### 6. \`agent-developer\` (Software Developer)
19612
- - **Mission**: Implement atomic tasks from SDD specifications (\`tasks.md\`) with clean, strictly typed code and thorough tests.
19613
- - **Directives**:
19614
- - **Mandatory 4-Step Implementation Order**: (1) Define/refine Modular & Hexagonal Architecture (Ports & Adapters) module boundaries, (2) Define interfaces/ports for all inter-module interactions to avoid direct module coupling, (3) Implement components consuming/fulfilling those interfaces, (4) Write unit tests for every function covering Happy Path, Sad Path, Boundary Values, and Unexpected/Null/Empty values.
19615
- - Respect the autonomy mode assigned in \`tasks.md\` (\`AUTONOMOUS\`, \`HUMAN_REVIEW_PLAN\`, \`AMBIGUOUS\`, \`HIGH_RISK_MANUAL\`).
19616
- - Make tests delivered by \`agent-qa-engineer\` pass green without altering them to accommodate code.
19617
- - Respect \`quality-policy.yaml\` thresholds: CC $\\le 10$, Cognitive $\\le 15$, MI $\\ge 50$, LOC $\\le 40$.
19618
- - Run pre-flight with auto-fix: \`pnpm run check:fix\` and full verification: \`pnpm run verify:all\`.
19619
- - **Mandatory Regression Verification**: Never declare build, typecheck, or bug fixes complete without executing the relevant automated test suite (\`pnpm test\`, \`dotnet test\`) and confirming zero regressions.
19620
- - **Global Styles Protection**: When touching or refactoring frontend views, verify that global stylesheet/asset imports remain intact and that layouts suffer no visual disruption.
19621
- - **Skills-First Implementation Directive**: When authoring or refactoring code (especially frontend, UI, styling, accessibility, or framework-specific logic), proactively inspect and leverage available specialized agent skills (e.g., modern web guidance, accessibility a11y, DevTools, framework skills) to produce standard-compliant, modern implementations rather than guessing ad-hoc patterns.
19622
- - Upon completing green implementation, suggest handoff to \`agent-expert-user\` for post-development functional validation prior to Checkpoint 2 (\`agent-auditor\` $\\parallel$ \`agent-adversary\` + \`agent-privacy-officer\`).
19623
-
19624
- ### 7. \`agent-expert-user\` (Expert User and Domain Evaluator)
19625
- - **Mission**: Contrast design and specifications (design phase) and functionally validate finished software against \`UC-*\` and \`FR-*\` (post-development phase).
19626
- - **Directives**:
19627
- - 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.
19628
- - Functional validation mode (downstream / pre-PR / post-development functional validation): Thoroughly contrast interface and actual CLI execution against \`UC-*\` and \`FR-*\` acceptance criteria before Checkpoint 2 audit.
19629
- - Emit handoff block suggesting Checkpoint 2 (\`agent-auditor\` $\\parallel$ \`agent-adversary\` + \`agent-privacy-officer\`) if compliant, or return to \`agent-developer\` on functional drift.
19630
-
19631
- ### 8. \`agent-devops\` (Automation and Infrastructure Engineer)
19632
- - **Mission**: Maintain, evolve, and audit automated project infrastructure: CI/CD workflows, Docker containers, IaC manifests, and support scripts.
19633
- - **Directives**:
19634
- - Strict infrastructure domain: Operates exclusively in \`.github/workflows/\`, \`Dockerfile*\`, \`docker-compose*.yml\`, IaC manifests, and \`scripts/\`.
19635
- - **NON-INVASION GUARDRAIL**: STRICTLY FORBIDDEN from modifying or refactoring application source code files (\`src/\`, \`packages/*/src/\`). Your responsibility is the pipeline and scaffolding, never application business logic.
19636
- - **Deployment & CI/CD Strategy Discovery**: Before scaffolding new pipelines or containers, read \`ARCH-INTRO-001\` / \`ARCH-DEP-001\` and clarify packaging/CD destination, CI platform, and release trigger policy with the Tech Lead.
19637
- - Infrastructure dependency policy: Verify licenses of dependencies, base images, and third-party actions according to \`license-policy.yaml\`.
19638
- - Gate preservation: Ensure pipeline optimizations preserve all existing deterministic Quality Gates intact.
19639
- - **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.
19640
- - **Remote Verification**: Creating a PR (\`gh pr create\`) does not equal success; actively verify that remote checks pass (\`gh pr checks\`).
19641
-
19642
- ### 9. \`agent-auditor\` (Transversal Quality and Improvement Auditor)
19643
- - **Mission**: Polymorphically inspect deliverables from any specialist agent on demand, enforcing Clean Code, SOLID, DRY, Simplicity First (YAGNI), \`quality-policy.yaml\` AST thresholds, UI design standards, and \`license-policy.yaml\` SPDX compliance.
19644
- - **Directives**: Constructive critique; block fake-wiring, unstyled interfaces, and manual \`.feature\` files; verify licenses via \`pnpm run verify:licenses\`; 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).
19645
-
19646
- ### 10. \`agent-adversary\` (Transversal Red Team and Chaos Adversary)
19647
- - **Mission**: Actively attempt to break, bypass, or invalidate deliverables from any target specialist agent, including Pre-Merge / Checkpoint 2 security diff audits with CVSS v3.1 scoring and concrete proofs-of-concept (PoC).
19648
- - **Directives**: Expose failure modes across Product (logic traps), Architecture (SPOF/races), QA (mutation testing/false greens), Development & Pre-Merge Security (boundary/concurrency, SAST/secrets via \`pnpm run verify:security\`, CVSS v3.1 blocking CRITICAL/HIGH), and DevOps (pipeline escape); mandatory proof-of-break; non-invasive; always return handoff to the audited agent (max 1 return round).
19861
+ ## 2. Specialized Roles Mapping (Summary \u2014 Full Prompts in \`.agent/agents/\`)
19862
+
19863
+ | Role | Mission (summary) |
19864
+ | :--- | :--- |
19865
+ | \`agent-product-analyst\` | Phase 0 NAF v4 Vision (\`ARCH-INTRO-*\`, up to 15-question discovery defining UI modality & CRUD prerequisites) + ProductShape (\`ACT-*\`, \`UC-*\`, \`FR-*\`, \`QR-*\`, \`BR-*\`); \`status\` starts \`draft\`. |
19866
+ | \`agent-threat-modeler\` | STRIDE/OWASP threat triad (\`ACT-THREAT-*\`, \`ABUSE-*\`, \`SEC-REQ-*\`); hands off to \`agent-privacy-officer\`. |
19867
+ | \`agent-privacy-officer\` | LINDDUN & GDPR/LOPDGDD privacy triad (\`DATA-ASSET-*\`, \`PRIV-ROPA-*\`, \`PRIV-REQ-*\`) + Pre-Merge \`verify:privacy\`. |
19868
+ | \`agent-system-architect\` | Modular arc42 + NAF v4 architecture (\`CMP-*\`, \`ARCH-DEP-001\`, Mermaid diagrams, \`ADR-*\`). |
19869
+ | \`agent-qa-engineer\` | FAILING BDD/Gherkin, E2E, and UI suites (Happy Path, Sad Path & Boundary Values per interactive UI element) before \`agent-developer\` writes code. |
19870
+ | \`agent-developer\` | Atomic tasks from \`tasks.md\` in 5-step Hexagonal order; respects autonomy mode; runs \`pnpm run check:fix\` + \`pnpm run verify:all\`. |
19871
+ | \`agent-expert-user\` | Bimodal MVP evaluation (design) and functional validation against \`UC-*\` and \`FR-*\` (pre-PR). |
19872
+ | \`agent-devops\` | CI/CD, Docker, IaC only \u2014 clarifies deployment/CI strategy; **FORBIDDEN** to touch \`src/\` or \`packages/*/src/\`. |
19873
+ | \`agent-auditor\` | Transversal auditor: YAGNI, Clean Code/SOLID/AST thresholds, UI standards, SPDX licenses (\`verify:licenses\`); returns handoff to audited agent. |
19874
+ | \`agent-adversary\` | Transversal Red Team adversary: PoC breaks, mutation testing & Pre-Merge security diff audit (\`verify:security\`, CVSS v3.1); returns handoff to audited agent. |
19649
19875
 
19650
19876
  ---
19651
19877
 
19652
- ## 3. Git 4-Tier Hierarchy and Commit Conventions
19878
+ ## 3. Pre-Flight Verification Commands
19879
+ - Pre-flight with auto-fix: \`pnpm run check:fix\` (or \`npx aisdlc check --fix\`)
19880
+ - Full verification: \`pnpm run verify:all\` (or \`npx aisdlc verify all\`)
19881
+ - Unit tests: \`pnpm test\` | Strict typing: \`pnpm run typecheck\`
19882
+
19883
+ ---
19884
+
19885
+ ## 4. Git 4-Tier Hierarchy and Commit Conventions
19653
19886
  - \`task/<PARENT-ID>/<TSK-ID>-<slug>\` $\\rightarrow$ \`feat/<FEAT-ID>-<slug>\` $\\rightarrow$ \`release/vX.Y.Z\` $\\rightarrow$ \`main\`.
19654
19887
  - Mandatory commit trailers injection (always declare your actual active model in \`AI-Model:\` or via \`AI_MODEL=<active-model>\` when running \`git commit\`, so the hook does not fall back to a generic IDE identifier like \`antigravity-agent\`, and include \`AI-Reasoning-Effort: <low|medium|high|max>\` or \`AI_REASONING_EFFORT=<level>\` when applicable):
19655
19888
  \`\`\`text
@@ -19836,49 +20069,20 @@ npx tsx packages/cli/src/index.ts sdd integrate --change <chg-id>
19836
20069
 
19837
20070
  ---
19838
20071
 
19839
- ## 3. Specialized Roles Mapping
19840
-
19841
- ### 1. \`agent-product-analyst\` (Product Analyst / Scribe)
19842
- - **Mission**: Capture new product intent via NAF v4 Enterprise & Capability Vision (\`ARCH-INTRO-*\`) and define/refine the product model using ProductShape.
19843
- - **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)**, **modern visual aesthetic & styling standard (Bootstrap 5-style clean responsive web layouts with cards/tables/badges, Fluent/modern desktop aesthetic with rounded corners/elevated panels, or colorized rich terminal console with ANSI palettes/status badges)**, 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.
19844
- - **Input**: Business intent or natural language specification.
19845
- - **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-*\`).
19846
- - **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\`.
20072
+ ## 3. Specialized Roles Mapping (Summary \u2014 Full Prompts in \`.claude/agents/\`)
19847
20073
 
19848
- ### 2. \`agent-threat-modeler\` (Threat Modeler and Security Specialist)
19849
- - **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\`.
19850
- - **Output**: Cybersecurity triad (\`ACT-THREAT-*\`, \`ABUSE-*\`, \`SEC-REQ-*\`) compliant with \`schemas/security/\`.
19851
-
19852
- ### 3. \`agent-privacy-officer\` (Data Protection & Privacy-by-Design Specialist)
19853
- - **Mission**: Receive handoff from \`agent-threat-modeler\` to model personal data assets (\`DATA-ASSET-*\`), GDPR Art. 30 records of processing (\`PRIV-ROPA-*\`), and LINDDUN / GDPR / ISO 27701 privacy requirements (\`PRIV-REQ-*\`), and audit code diffs against \`privacy-policy.yaml\`.
19854
- - **Directives**: Run \`pnpm run verify:privacy\`, enforce PII masking in logs/LLM prompts, and trigger \`DPIA-*\` requests on Art. 9 sensitive data.
19855
-
19856
- ### 4. \`agent-system-architect\` (System Architect)
19857
- - **Mission**: Translate the approved product definition into a modular technical architecture based on arc42 enriched with NAF v4 (\`CMP-*\`, Mermaid diagrams, \`ADR-*\`).
19858
- - **Guardrails**: Declare \`satisfies-requirements\` on every \`CMP-*\` (including \`PRIV-REQ-*\`), structure components following **Modular & Hexagonal Architecture (Ports & Adapters)** (Domain/Application Core + Inbound/Outbound Ports), instantiate mandatory building block \`CMP-OBSERVABILITY\` (Level 2/3) alongside Section 8 and an ADR for runtime telemetry, and trigger the technical security/privacy feedback loop toward \`agent-threat-modeler\` \u2794 \`agent-privacy-officer\` when infrastructure decisions introduce new attack vectors or PII flows.
19859
-
19860
- ### 5. \`agent-qa-engineer\` (QA Engineer and SDET)
19861
- - **Mission**: Translate approved requirements (\`FR-*\`, \`SEC-REQ-*\`, \`PRIV-REQ-*\`, \`QR-*\`) into comprehensive FAILING (red) BDD/Gherkin, End-to-End (E2E), UI, and unit test suites, before \`agent-developer\` writes production code.
19862
- - **Guardrails**: Always use the agreed project technology/testing stack (if any). Never omit End-to-End (E2E) and UI tests. Create specific tests for every interactive UI element using external tools such as Playwright or FlatUI (or the agreed project testing technology), covering Happy Path, Sad Path, and Boundary Values. FORBIDDEN to include production code. Mandatory tags: \`@<FR-ID> @automated @regression\`.
19863
-
19864
- ### 6. \`agent-developer\` (Software Developer)
19865
- - **Mission**: Implement atomic tasks from SDD specifications (\`tasks.md\`) with clean, strictly typed code and thorough tests.
19866
- - **Directives**: Execute the mandatory 4-step order: (1) Modular & Hexagonal Architecture (Ports & Adapters) definition/redefinition, (2) Inter-module interfaces first, (3) Component implementation, (4) Per-function unit tests (Happy Path, Sad Path, Boundary Values, Unexpected/Null/Empty values). Respect the autonomy mode. Make tests delivered by \`agent-qa-engineer\` pass green. Run \`pnpm run check:fix\` and \`pnpm run verify:all\`. Enforce Mandatory Regression Verification (\`pnpm test\`) with zero regressions before declaring completion, and enforce Global Styles Protection on frontend views.
19867
-
19868
- ### 7. \`agent-expert-user\` (Expert User and Domain Evaluator)
19869
- - **Mission**: Contrast design and specifications (design phase) and functionally validate finished software against \`UC-*\` and \`FR-*\` (post-development functional validation phase).
19870
-
19871
- ### 8. \`agent-devops\` (Automation and Infrastructure Engineer)
19872
- - **Mission**: Maintain, evolve, and audit automated project infrastructure: CI/CD workflows, Docker containers, IaC manifests, and support scripts. Clarifies packaging/CD strategy against \`ARCH-INTRO-001\` / \`ARCH-DEP-001\`.
19873
- - **NON-INVASION GUARDRAIL**: STRICTLY FORBIDDEN from modifying application source code (\`src/\`, \`packages/*/src/\`).
19874
-
19875
- ### 9. \`agent-auditor\` (Transversal Quality and Improvement Auditor)
19876
- - **Mission**: Polymorphically inspect deliverables from any specialist agent on demand, enforcing Clean Code, SOLID, DRY, YAGNI, \`quality-policy.yaml\` AST thresholds, UI design standards, and \`license-policy.yaml\` SPDX compliance (\`pnpm run verify:licenses\`).
19877
- - **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).
19878
-
19879
- ### 10. \`agent-adversary\` (Transversal Red Team and Chaos Adversary)
19880
- - **Mission**: Actively attempt to break, bypass, or invalidate deliverables from any target specialist agent, including Pre-Merge / Checkpoint 2 security diff audits (\`pnpm run verify:security\`, CVSS v3.1), providing concrete proofs-of-concept (PoC), counterexamples, and reproduction steps.
19881
- - **Directives**: Expose failure modes across Product (logic traps), Architecture (SPOF/races), QA (mutation testing/false greens), Development & Pre-Merge Security (boundary/concurrency, CVSS v3.1), and DevOps (pipeline escape); mandatory proof-of-break; non-invasive; always return handoff to the audited agent (max 1 return round).
20074
+ | Role | Mission (summary) |
20075
+ | :--- | :--- |
20076
+ | \`agent-product-analyst\` | Phase 0 NAF v4 Vision (\`ARCH-INTRO-*\`, up to 15-question discovery defining UI modality & CRUD prerequisites) + ProductShape (\`ACT-*\`, \`UC-*\`, \`FR-*\`, \`QR-*\`, \`BR-*\`); \`status\` starts \`draft\`. |
20077
+ | \`agent-threat-modeler\` | STRIDE/OWASP threat triad (\`ACT-THREAT-*\`, \`ABUSE-*\`, \`SEC-REQ-*\`); hands off to \`agent-privacy-officer\`. |
20078
+ | \`agent-privacy-officer\` | LINDDUN & GDPR/LOPDGDD privacy triad (\`DATA-ASSET-*\`, \`PRIV-ROPA-*\`, \`PRIV-REQ-*\`) + Pre-Merge \`verify:privacy\`. |
20079
+ | \`agent-system-architect\` | Modular arc42 + NAF v4 architecture (\`CMP-*\`, \`ARCH-DEP-001\`, Mermaid diagrams, \`ADR-*\`). |
20080
+ | \`agent-qa-engineer\` | FAILING BDD/Gherkin, E2E, and UI suites (Happy Path, Sad Path & Boundary Values per interactive UI element) before \`agent-developer\` writes code. |
20081
+ | \`agent-developer\` | Atomic tasks from \`tasks.md\` in 5-step Hexagonal order; respects autonomy mode; runs \`pnpm run check:fix\` + \`pnpm run verify:all\`. |
20082
+ | \`agent-expert-user\` | Bimodal MVP evaluation (design) and functional validation against \`UC-*\` and \`FR-*\` (pre-PR). |
20083
+ | \`agent-devops\` | CI/CD, Docker, IaC only \u2014 clarifies deployment/CI strategy; **FORBIDDEN** to touch \`src/\` or \`packages/*/src/\`. |
20084
+ | \`agent-auditor\` | Transversal auditor: YAGNI, Clean Code/SOLID/AST thresholds, UI standards, SPDX licenses (\`verify:licenses\`); returns handoff to audited agent. |
20085
+ | \`agent-adversary\` | Transversal Red Team adversary: PoC breaks, mutation testing & Pre-Merge security diff audit (\`verify:security\`, CVSS v3.1); returns handoff to audited agent. |
19882
20086
 
19883
20087
  ---
19884
20088
 
@@ -20064,6 +20268,88 @@ var STARTER_VSCODE_MCP = `{
20064
20268
  }
20065
20269
  }
20066
20270
  `;
20271
+ var STARTER_ANTIGRAVITY_SPECS_RULES = `---
20272
+ description: Directives for SDD specifications editing, ProductShape artifacts, PDaC citations, Cybersecurity, and Privacy
20273
+ trigger: model_decision
20274
+ ---
20275
+
20276
+ # Specifications, ProductShape & PDaC Directives
20277
+
20278
+ Canonical Reference: [\`process/09_agent_protocols.md\`](process/09_agent_protocols.md).
20279
+
20280
+ 1. **Identifier Taxonomy & Schemas**: Every artifact in \`specs/\` must satisfy its JSON Schema in \`schemas/\` (\`ARCH-INTRO-*\`, \`ACT-*\`, \`JRN-*\`, \`UC-*\`, \`BR-*\`, \`FR-*\`, \`QR-*\`, \`ACT-THREAT-*\`, \`ABUSE-*\`, \`SEC-REQ-*\`, \`DATA-ASSET-*\`, \`PRIV-ROPA-*\`, \`PRIV-REQ-*\`, \`CMP-*\`, \`ADR-*\`).
20281
+ 2. **Initial Status**: All newly drafted specifications MUST start with \`status: draft\`.
20282
+ 3. **Single Canonical Link Direction**: Cite upstream artifacts in one direction only (\`derives-from: [UC-*]\`, \`primary-actor: ACT-*\`, \`satisfies-requirements: [FR-*]\`) with Unix LF-normalized SHA-256 digests.
20283
+ 4. **Gherkin Acceptance Criteria**: Every \`FR-*\` must embed a \`\`\`gherkin block with \`@<ID> @automated @regression\` covering \`@nominal\`, \`@boundary\`, and \`@invalid\`. \`SEC-REQ-*\` uses \`@security @mitigation\`; \`PRIV-REQ-*\` uses \`@privacy @gdpr\`.
20284
+ 5. **Validation**: Run \`pnpm run verify:schemas\`, \`pnpm run verify:duplicates\`, \`pnpm run verify:pdac\`, and \`pnpm run verify:privacy\` before delivering drafts.
20285
+ `;
20286
+ var STARTER_ANTIGRAVITY_CODE_RULES = `---
20287
+ description: Directives for code quality thresholds, Hexagonal architecture, observability, UI states, and license compliance
20288
+ trigger: model_decision
20289
+ ---
20290
+
20291
+ # Code Quality, Hexagonal Architecture & Observability Directives
20292
+
20293
+ Canonical Reference: [\`process/09_agent_protocols.md\`](process/09_agent_protocols.md).
20294
+
20295
+ 1. **AST Thresholds (\`quality-policy.yaml\`)**: Cyclomatic Complexity $\\le 10$, Cognitive Complexity $\\le 15$, Maintainability Index $\\ge 50$, Function Length $\\le 40$ lines.
20296
+ 2. **5-Step Implementation Order**: (1) Modular & Hexagonal Architecture (Ports & Adapters) module boundaries, (2) Inter-module interfaces/ports first, (3) Concrete components, (4) Exhaustive per-function unit tests in \`tests/unit/\` (Happy Path, Sad Path, Boundary Values, and Unexpected/Null/Empty values), (5) Per-component UI/E2E tests.
20297
+ 3. **Mandatory Regression Verification & Global Styles Protection**: Never declare build, typecheck, or bug fixes complete without running \`pnpm test\` / \`dotnet test\` and confirming zero regressions. Verify global stylesheet/asset imports remain intact when touching frontend views.
20298
+ 4. **Zero Fake-Wiring & 4 UI States**: Never ship hardcoded \`mockData\`, empty handlers, or silent errors. Every data-driven view must implement \`Loading\`, \`Empty\`, \`Error\`, and \`Nominal\` states.
20299
+ 5. **Structured Observability (\`CMP-OBSERVABILITY\`)**: Never use \`console.log\` in production code; use \`ILogger\`, \`ITracer\`, \`IMetricsRegistry\` backed by \`.observability/\` with PII redaction and shutdown \`flush()\`.
20300
+ 6. **No Bypass Directives**: Never suppress types or linters (\`@ts-ignore\`, \`eslint-disable\`, \`#pragma warning disable\`, \`#[allow(...)]\`). Check \`license-policy.yaml\` before adding any dependency.
20301
+ `;
20302
+ var STARTER_ANTIGRAVITY_TESTING_RULES = `---
20303
+ description: Directives for deterministic Gherkin extraction, polyglot step scaffolding, E2E/UI coverage, and Zero-Mock integration
20304
+ trigger: model_decision
20305
+ ---
20306
+
20307
+ # Deterministic BDD & Testing Directives
20308
+
20309
+ Canonical Reference: [\`process/09_agent_protocols.md\`](process/09_agent_protocols.md).
20310
+
20311
+ 1. **Deterministic Gherkin Engine**: NEVER hand-author \`tests/features/*.feature\` or boilerplate step skeletons. Author Gherkin inside Markdown specs and run \`npx aisdlc gherkin extract\` + \`npx aisdlc gherkin scaffold <feature> --lang <ts|py|go|rs|cs> --fallback\`.
20312
+ 2. **Reverse Traceability**: Cite \`FR-*\`, \`SEC-REQ-*\`, or \`PRIV-REQ-*\` IDs in test file headers.
20313
+ 3. **Mandatory E2E/UI & Per-Interactive-Element Coverage**: Always use the agreed project technology (e.g. Playwright or FlatUI) to cover Happy Path, Sad Path, and Boundary Values for every interactive UI element, verifying real UI-to-Backend wiring (Zero-Mock).
20314
+ 4. **Verification**: Run \`npx aisdlc verify gherkin\`, \`npx aisdlc verify testing\`, and \`pnpm test\` before completing any task.
20315
+ `;
20316
+ var STARTER_CURSOR_TESTING_RULES = `---
20317
+ description: Directives for deterministic Gherkin extraction, polyglot step scaffolding, E2E/UI coverage, and Zero-Mock integration
20318
+ globs: tests/**
20319
+ alwaysApply: false
20320
+ ---
20321
+
20322
+ # Deterministic BDD & Testing Directives
20323
+
20324
+ Canonical Reference: [\`process/09_agent_protocols.md\`](process/09_agent_protocols.md).
20325
+
20326
+ 1. **Deterministic Gherkin Engine**: NEVER hand-author \`tests/features/*.feature\` or boilerplate step skeletons. Author Gherkin inside Markdown specs and run \`npx aisdlc gherkin extract\` + \`npx aisdlc gherkin scaffold <feature> --lang <ts|py|go|rs|cs> --fallback\`.
20327
+ 2. **Reverse Traceability**: Cite \`FR-*\`, \`SEC-REQ-*\`, or \`PRIV-REQ-*\` IDs in test file headers.
20328
+ 3. **Mandatory E2E/UI & Per-Interactive-Element Coverage**: Always use the agreed project technology (e.g. Playwright or FlatUI) to cover Happy Path, Sad Path, and Boundary Values for every interactive UI element, verifying real UI-to-Backend wiring (Zero-Mock).
20329
+ 4. **Verification**: Run \`npx aisdlc verify gherkin\`, \`npx aisdlc verify testing\`, and \`pnpm test\` before completing any task.
20330
+ `;
20331
+ var STARTER_SPECS_AGENTS_MD = `# Specifications Directory Rules (\`specs/\`)
20332
+
20333
+ - Every new or modified artifact in \`specs/\` must conform to its JSON Schema in \`schemas/\` and start with \`status: draft\`.
20334
+ - Always write relationships in their single canonical direction (\`derives-from\`, \`primary-actor\`, \`satisfies-requirements\`) with Unix LF-normalized SHA-256 digests.
20335
+ - Every \`FR-*\` must include \`\`\`gherkin blocks tagged \`@<ID> @automated @regression\` with \`@nominal\`, \`@boundary\`, and \`@invalid\` scenarios.
20336
+ - Run \`npx aisdlc check --fix\`, \`npx aisdlc verify schemas\`, and \`npx aisdlc verify duplicates\` before committing specification changes.
20337
+ `;
20338
+ var STARTER_SRC_AGENTS_MD = `# Source Code Directory Rules (\`src/\` & \`packages/\`)
20339
+
20340
+ - Enforce \`quality-policy.yaml\` AST thresholds: Cyclomatic Complexity <= 10, Cognitive Complexity <= 15, Maintainability Index >= 50, Function Length <= 40 lines.
20341
+ - Follow Modular & Hexagonal Architecture (Ports & Adapters): define inter-module interfaces/ports before concrete implementations.
20342
+ - Zero Fake-Wiring: never leave hardcoded \`mockData\`, empty handlers, or missing \`Loading\`/\`Empty\`/\`Error\`/\`Nominal\` UI states.
20343
+ - Never use \`console.log\` in production code; route telemetry through \`CMP-OBSERVABILITY\` (\`ILogger\`, \`ITracer\`, \`IMetricsRegistry\`) with PII redaction.
20344
+ - Never add \`@ts-ignore\`, \`eslint-disable\`, or dependency packages without verifying \`license-policy.yaml\`.
20345
+ `;
20346
+ var STARTER_TESTS_AGENTS_MD = `# Test Suite Directory Rules (\`tests/\`)
20347
+
20348
+ - NEVER hand-author or manually edit \`tests/features/*.feature\`; always generate via \`npx aisdlc gherkin extract\`.
20349
+ - Scaffold new step definitions deterministically via \`npx aisdlc gherkin scaffold <feature> --lang <ts|py|go|rs|cs> --fallback\`.
20350
+ - Include header citations (\`FR-*\`, \`SEC-REQ-*\`, \`PRIV-REQ-*\`) for 360\xB0 reverse traceability.
20351
+ - Cover Happy Path, Sad Path, Boundary Values, and Null/Empty inputs for every function and interactive UI element.
20352
+ `;
20067
20353
 
20068
20354
  // src/init/architecture-templates.ts
20069
20355
  var STARTER_ARCH_ADR = `---
@@ -21430,10 +21716,59 @@ var STARTER_ANTIGRAVITY_HOOKS_JSON = `{
21430
21716
  }
21431
21717
  ]
21432
21718
  }
21719
+ ],
21720
+ "PostToolUse": [
21721
+ {
21722
+ "matcher": "edit_file|write_file",
21723
+ "hooks": [
21724
+ {
21725
+ "type": "command",
21726
+ "command": "node scripts/guard-post-edit.cjs",
21727
+ "timeout": 10
21728
+ }
21729
+ ]
21730
+ }
21433
21731
  ]
21434
21732
  }
21435
21733
  }
21436
21734
  `;
21735
+ var STARTER_GUARD_POST_EDIT_CJS = `#!/usr/bin/env node
21736
+ /**
21737
+ * AI-SDLC: Antigravity PostToolUse Skill-Compliance Reminder Hook
21738
+ * Reminds agents to run deterministic Gherkin extraction when specs with gherkin blocks are edited,
21739
+ * and warns if tests/features/*.feature is edited manually.
21740
+ */
21741
+ const fs = require('fs');
21742
+ const path = require('path');
21743
+
21744
+ function readPayloadTarget() {
21745
+ try {
21746
+ const raw = fs.readFileSync(0, 'utf-8').trim();
21747
+ if (!raw) return '';
21748
+ const parsed = JSON.parse(raw);
21749
+ const input = parsed.tool_input || parsed.input || {};
21750
+ return String(input.Path || input.path || input.TargetFile || input.target_file || '');
21751
+ } catch {
21752
+ return '';
21753
+ }
21754
+ }
21755
+
21756
+ const target = readPayloadTarget();
21757
+ if (!target) process.exit(0);
21758
+
21759
+ const rel = path.relative(process.cwd(), path.resolve(process.cwd(), target)).replace(/\\\\/g, '/');
21760
+ if (/^tests\\/features\\/.*\\.feature$/i.test(rel)) {
21761
+ console.error('[AI-SDLC PostEdit Hook] Warning: tests/features/*.feature should be generated via "npx aisdlc gherkin extract" (skill: aisdlc-bdd-gherkin), not hand-edited.');
21762
+ } else if (/^(specs|product|security)\\/.*\\.md$/i.test(rel) && fs.existsSync(target)) {
21763
+ try {
21764
+ const content = fs.readFileSync(target, 'utf-8');
21765
+ if (content.includes('\`\`\`gherkin')) {
21766
+ console.log('[AI-SDLC PostEdit Hook] Spec with Gherkin modified. Run "npx aisdlc gherkin extract" and "npx aisdlc check --fix" to keep .feature files and SHA-256 digests in sync.');
21767
+ }
21768
+ } catch {}
21769
+ }
21770
+ process.exit(0);
21771
+ `;
21437
21772
  var STARTER_AGENT_GUARD_WRAPPER_CJS = `#!/usr/bin/env node
21438
21773
  // Forwarding wrapper or direct execution from .agent
21439
21774
  require('../../scripts/guard-branch.cjs');
@@ -22557,21 +22892,44 @@ function resolveAgentTargets(agents) {
22557
22892
  }
22558
22893
  return result;
22559
22894
  }
22560
- function appendAntigravityFiles(dirs, files) {
22561
- dirs.push(".agent/rules", ".agent/agents", ".agent/skills");
22895
+ function appendHierarchicalAgentsMd(dirs, files) {
22896
+ dirs.push("specs", "src", "tests");
22562
22897
  files.push(
22563
- { relPath: ".agent/rules/ai-sdlc.md", content: STARTER_ANTIGRAVITY_RULES },
22564
- { relPath: ".agent/hooks.json", content: STARTER_ANTIGRAVITY_HOOKS_JSON },
22565
- { relPath: ".agent/scripts/guard-branch.cjs", content: STARTER_AGENT_GUARD_WRAPPER_CJS },
22566
- { relPath: "scripts/guard-branch.cjs", content: STARTER_GUARD_BRANCH_CJS }
22898
+ { relPath: "specs/AGENTS.md", content: STARTER_SPECS_AGENTS_MD },
22899
+ { relPath: "src/AGENTS.md", content: STARTER_SRC_AGENTS_MD },
22900
+ { relPath: "tests/AGENTS.md", content: STARTER_TESTS_AGENTS_MD }
22567
22901
  );
22902
+ }
22903
+ function appendSkillReferenceFiles(baseSkillDir, skillId, dirs, files) {
22904
+ const refs = SKILL_REFERENCES[skillId];
22905
+ if (!refs || refs.length === 0) return;
22906
+ const refsDir = `${baseSkillDir}/references`;
22907
+ dirs.push(refsDir);
22908
+ for (const ref of refs) {
22909
+ files.push({ relPath: `${refsDir}/${ref.filename}`, content: ref.content });
22910
+ }
22911
+ }
22912
+ var ANTIGRAVITY_CORE_FILES = [
22913
+ { relPath: ".agent/rules/ai-sdlc.md", content: STARTER_ANTIGRAVITY_RULES },
22914
+ { relPath: ".agent/rules/ai-sdlc-specs.md", content: STARTER_ANTIGRAVITY_SPECS_RULES },
22915
+ { relPath: ".agent/rules/ai-sdlc-code.md", content: STARTER_ANTIGRAVITY_CODE_RULES },
22916
+ { relPath: ".agent/rules/ai-sdlc-testing.md", content: STARTER_ANTIGRAVITY_TESTING_RULES },
22917
+ { relPath: ".agent/hooks.json", content: STARTER_ANTIGRAVITY_HOOKS_JSON },
22918
+ { relPath: ".agent/scripts/guard-branch.cjs", content: STARTER_AGENT_GUARD_WRAPPER_CJS },
22919
+ { relPath: "scripts/guard-branch.cjs", content: STARTER_GUARD_BRANCH_CJS },
22920
+ { relPath: "scripts/guard-post-edit.cjs", content: STARTER_GUARD_POST_EDIT_CJS }
22921
+ ];
22922
+ function appendAntigravityFiles(dirs, files) {
22923
+ dirs.push(".agent/rules", ".agent/agents", ".agent/skills");
22924
+ files.push(...ANTIGRAVITY_CORE_FILES);
22925
+ appendHierarchicalAgentsMd(dirs, files);
22568
22926
  for (const agent of SPECIALIZED_AGENT_TEMPLATES) {
22569
- const content = renderAntigravityAgentFile(agent);
22570
- files.push({ relPath: `.agent/agents/${agent.id}.md`, content });
22927
+ files.push({ relPath: `.agent/agents/${agent.id}.md`, content: renderAntigravityAgentFile(agent) });
22571
22928
  }
22572
22929
  for (const skill of LIFECYCLE_SKILL_TEMPLATES) {
22573
22930
  dirs.push(`.agent/skills/${skill.id}`);
22574
22931
  files.push({ relPath: `.agent/skills/${skill.id}/SKILL.md`, content: renderAntigravitySkillFile(skill) });
22932
+ appendSkillReferenceFiles(`.agent/skills/${skill.id}`, skill.id, dirs, files);
22575
22933
  }
22576
22934
  }
22577
22935
  function appendCursorFiles(dirs, files) {
@@ -22579,7 +22937,8 @@ function appendCursorFiles(dirs, files) {
22579
22937
  files.push(
22580
22938
  { relPath: ".cursor/rules/ai-sdlc-core.mdc", content: STARTER_CURSOR_CORE_RULES },
22581
22939
  { relPath: ".cursor/rules/ai-sdlc-product.mdc", content: STARTER_CURSOR_PRODUCT_RULES },
22582
- { relPath: ".cursor/rules/ai-sdlc-quality.mdc", content: STARTER_CURSOR_QUALITY_RULES }
22940
+ { relPath: ".cursor/rules/ai-sdlc-quality.mdc", content: STARTER_CURSOR_QUALITY_RULES },
22941
+ { relPath: ".cursor/rules/ai-sdlc-testing.mdc", content: STARTER_CURSOR_TESTING_RULES }
22583
22942
  );
22584
22943
  for (const agent of SPECIALIZED_AGENT_TEMPLATES) {
22585
22944
  files.push({ relPath: `.cursor/rules/${agent.id}.mdc`, content: renderCursorAgentFile(agent) });
@@ -22591,6 +22950,7 @@ function appendCursorFiles(dirs, files) {
22591
22950
  function appendClaudeFiles(dirs, files) {
22592
22951
  dirs.push(".claude/agents", ".claude/skills");
22593
22952
  files.push({ relPath: "CLAUDE.md", content: STARTER_CLAUDE_RULES });
22953
+ appendHierarchicalAgentsMd(dirs, files);
22594
22954
  for (const agent of SPECIALIZED_AGENT_TEMPLATES) {
22595
22955
  const content = renderClaudeAgentFile(agent);
22596
22956
  dirs.push(`.claude/skills/${agent.id}`);
@@ -22602,6 +22962,7 @@ function appendClaudeFiles(dirs, files) {
22602
22962
  for (const skill of LIFECYCLE_SKILL_TEMPLATES) {
22603
22963
  dirs.push(`.claude/skills/${skill.id}`);
22604
22964
  files.push({ relPath: `.claude/skills/${skill.id}/SKILL.md`, content: renderClaudeSkillFile(skill) });
22965
+ appendSkillReferenceFiles(`.claude/skills/${skill.id}`, skill.id, dirs, files);
22605
22966
  }
22606
22967
  }
22607
22968
  function appendCopilotFiles(dirs, files) {
@@ -22633,7 +22994,13 @@ function collectAgentFiles(targets) {
22633
22994
  if (isTargetIncluded(targets, "claude")) appendClaudeFiles(dirs, files);
22634
22995
  if (isTargetIncluded(targets, "copilot")) appendCopilotFiles(dirs, files);
22635
22996
  appendMcpFiles(dirs, files);
22636
- return { dirs, files };
22997
+ const seen = /* @__PURE__ */ new Set();
22998
+ const uniqueFiles = files.filter((f) => {
22999
+ if (seen.has(f.relPath)) return false;
23000
+ seen.add(f.relPath);
23001
+ return true;
23002
+ });
23003
+ return { dirs: Array.from(new Set(dirs)), files: uniqueFiles };
22637
23004
  }
22638
23005
  function recordDryRunFile(exists, canOverwrite, relPath, results) {
22639
23006
  if (exists && canOverwrite) results.filesUpdated.push(relPath);
@@ -23788,13 +24155,13 @@ function resolveExitCode(error) {
23788
24155
  return err.killed ? null : typeof err.code === "number" ? err.code : 1;
23789
24156
  }
23790
24157
  function runSpawn(file, args, cwd, timeout, maxBuffer) {
23791
- return new Promise((resolve18) => {
24158
+ return new Promise((resolve20) => {
23792
24159
  child_process3.execFile(
23793
24160
  file,
23794
24161
  args,
23795
24162
  { shell: false, timeout, maxBuffer, cwd, env: buildSafeEnvironment(cwd), windowsHide: true },
23796
24163
  (err, stdout, stderr) => {
23797
- resolve18({
24164
+ resolve20({
23798
24165
  stdout: truncateBuffer(stdout, maxBuffer),
23799
24166
  stderr: truncateBuffer(stderr, maxBuffer),
23800
24167
  exitCode: resolveExitCode(err)
@@ -24424,12 +24791,25 @@ var DoctorService = class {
24424
24791
  return Array.from(rems);
24425
24792
  }
24426
24793
  };
24427
- var GOVERNED_DIR_PREFIXES = ["schemas" + path14__namespace.sep, "templates" + path14__namespace.sep, ".backup" + path14__namespace.sep];
24794
+ var GOVERNED_DIR_PREFIXES = [
24795
+ "schemas" + path14__namespace.sep,
24796
+ "templates" + path14__namespace.sep,
24797
+ ".backup" + path14__namespace.sep,
24798
+ ".agent" + path14__namespace.sep,
24799
+ ".claude" + path14__namespace.sep,
24800
+ ".cursor" + path14__namespace.sep,
24801
+ ".github" + path14__namespace.sep + "agents" + path14__namespace.sep
24802
+ ];
24428
24803
  var GOVERNED_ROOT_FILES = /* @__PURE__ */ new Set([
24429
24804
  "quality-policy.yaml",
24430
24805
  "license-policy.yaml",
24431
24806
  "privacy-policy.yaml",
24432
- "dlp-policy.yaml"
24807
+ "dlp-policy.yaml",
24808
+ "CLAUDE.md",
24809
+ path14__namespace.join("specs", "AGENTS.md"),
24810
+ path14__namespace.join("src", "AGENTS.md"),
24811
+ path14__namespace.join("tests", "AGENTS.md"),
24812
+ path14__namespace.join("scripts", "guard-post-edit.cjs")
24433
24813
  ]);
24434
24814
  function validateRawInputs(repoRoot, targetPath) {
24435
24815
  if (!repoRoot) {
@@ -24967,6 +25347,9 @@ function buildCanonicalMap() {
24967
25347
  for (const t of STARTER_BASE_TEMPLATES) {
24968
25348
  canonicalMap.set(t.relPath.replace(/\\/g, "/"), { category: "template", content: t.content });
24969
25349
  }
25350
+ for (const a of collectAgentFiles(resolveAgentTargets("all")).files) {
25351
+ canonicalMap.set(a.relPath.replace(/\\/g, "/"), { category: "agent", content: a.content });
25352
+ }
24970
25353
  return canonicalMap;
24971
25354
  }
24972
25355
  function scanSchemasDir(schemasDir, canonicalMap) {
@@ -25133,6 +25516,33 @@ var MigrationService = class {
25133
25516
  }
25134
25517
  }
25135
25518
  items.push(...scanSchemasDir(path14__namespace.join(root, "schemas"), canonicalMap));
25519
+ items.push(...this.discoverAgentFiles(root));
25520
+ return items;
25521
+ }
25522
+ discoverConfiguredAgentTargets(root) {
25523
+ const targets = [];
25524
+ if (fs12__namespace.existsSync(path14__namespace.join(root, ".agent"))) targets.push("antigravity");
25525
+ if (fs12__namespace.existsSync(path14__namespace.join(root, ".cursor"))) targets.push("cursor");
25526
+ if (fs12__namespace.existsSync(path14__namespace.join(root, ".claude")) || fs12__namespace.existsSync(path14__namespace.join(root, "CLAUDE.md"))) targets.push("claude");
25527
+ if (fs12__namespace.existsSync(path14__namespace.join(root, ".github", "agents"))) targets.push("copilot");
25528
+ return targets;
25529
+ }
25530
+ isGovernedAgentPath(relPath) {
25531
+ const prefixes = [".agent/", ".claude/", ".cursor/rules/", ".github/agents/"];
25532
+ return prefixes.some((p) => relPath.startsWith(p)) || relPath === "CLAUDE.md" || relPath.endsWith("/AGENTS.md") || relPath === "scripts/guard-post-edit.cjs";
25533
+ }
25534
+ discoverAgentFiles(root) {
25535
+ const configured = this.discoverConfiguredAgentTargets(root);
25536
+ if (configured.length === 0) return [];
25537
+ const items = [];
25538
+ for (const f of collectAgentFiles(resolveAgentTargets(configured)).files) {
25539
+ const relPath = f.relPath.replace(/\\/g, "/");
25540
+ if (!this.isGovernedAgentPath(relPath)) continue;
25541
+ const fullPath = path14__namespace.join(root, relPath);
25542
+ const exists = fs12__namespace.existsSync(fullPath);
25543
+ const currentContent = exists ? fs12__namespace.readFileSync(fullPath, "utf-8") : "";
25544
+ items.push({ relPath, category: "agent", currentContent, targetContent: f.content, baseContent: exists ? f.content : "" });
25545
+ }
25136
25546
  return items;
25137
25547
  }
25138
25548
  };
@@ -25239,11 +25649,15 @@ exports.SCHEMA_SCHEMAS_SECURITY_THREAT_ACTOR_SCHEMA_JSON = SCHEMA_SCHEMAS_SECURI
25239
25649
  exports.SCHEMA_SCHEMAS_WORKFLOW_AGENT_HANDOFF_SCHEMA_JSON = SCHEMA_SCHEMAS_WORKFLOW_AGENT_HANDOFF_SCHEMA_JSON;
25240
25650
  exports.SECRET_RULES = SECRET_RULES;
25241
25651
  exports.SEVERITY_RANK = SEVERITY_RANK2;
25652
+ exports.SKILL_EXPECTED_TOOLS = SKILL_EXPECTED_TOOLS;
25242
25653
  exports.SPECIALIZED_AGENT_TEMPLATES = SPECIALIZED_AGENT_TEMPLATES;
25243
25654
  exports.STARTER_AGENT_GUARD_WRAPPER_CJS = STARTER_AGENT_GUARD_WRAPPER_CJS;
25655
+ exports.STARTER_ANTIGRAVITY_CODE_RULES = STARTER_ANTIGRAVITY_CODE_RULES;
25244
25656
  exports.STARTER_ANTIGRAVITY_HOOKS_JSON = STARTER_ANTIGRAVITY_HOOKS_JSON;
25245
25657
  exports.STARTER_ANTIGRAVITY_MCP = STARTER_ANTIGRAVITY_MCP;
25246
25658
  exports.STARTER_ANTIGRAVITY_RULES = STARTER_ANTIGRAVITY_RULES;
25659
+ exports.STARTER_ANTIGRAVITY_SPECS_RULES = STARTER_ANTIGRAVITY_SPECS_RULES;
25660
+ exports.STARTER_ANTIGRAVITY_TESTING_RULES = STARTER_ANTIGRAVITY_TESTING_RULES;
25247
25661
  exports.STARTER_ARCH_ADR = STARTER_ARCH_ADR;
25248
25662
  exports.STARTER_ARCH_ARCHITECTURE_CONSTRAINTS = STARTER_ARCH_ARCHITECTURE_CONSTRAINTS;
25249
25663
  exports.STARTER_ARCH_COMPONENT = STARTER_ARCH_COMPONENT;
@@ -25267,6 +25681,7 @@ exports.STARTER_CURSOR_CORE_RULES = STARTER_CURSOR_CORE_RULES;
25267
25681
  exports.STARTER_CURSOR_MCP = STARTER_CURSOR_MCP;
25268
25682
  exports.STARTER_CURSOR_PRODUCT_RULES = STARTER_CURSOR_PRODUCT_RULES;
25269
25683
  exports.STARTER_CURSOR_QUALITY_RULES = STARTER_CURSOR_QUALITY_RULES;
25684
+ exports.STARTER_CURSOR_TESTING_RULES = STARTER_CURSOR_TESTING_RULES;
25270
25685
  exports.STARTER_GITHUB_CI = STARTER_GITHUB_CI;
25271
25686
  exports.STARTER_GITHUB_DEPLOY_DASHBOARD = STARTER_GITHUB_DEPLOY_DASHBOARD;
25272
25687
  exports.STARTER_GITHUB_PR_KPI = STARTER_GITHUB_PR_KPI;
@@ -25274,6 +25689,7 @@ exports.STARTER_GITHUB_PULL_REQUEST_TEMPLATE = STARTER_GITHUB_PULL_REQUEST_TEMPL
25274
25689
  exports.STARTER_GITHUB_SDD_INTEGRATE = STARTER_GITHUB_SDD_INTEGRATE;
25275
25690
  exports.STARTER_GITLAB_CI = STARTER_GITLAB_CI;
25276
25691
  exports.STARTER_GUARD_BRANCH_CJS = STARTER_GUARD_BRANCH_CJS;
25692
+ exports.STARTER_GUARD_POST_EDIT_CJS = STARTER_GUARD_POST_EDIT_CJS;
25277
25693
  exports.STARTER_LICENSE_POLICY = STARTER_LICENSE_POLICY;
25278
25694
  exports.STARTER_PRIVACY_POLICY = STARTER_PRIVACY_POLICY;
25279
25695
  exports.STARTER_PROCESS_README = STARTER_PROCESS_README;
@@ -25282,6 +25698,8 @@ exports.STARTER_QUALITY_POLICY = STARTER_QUALITY_POLICY;
25282
25698
  exports.STARTER_REQUIREMENT_TEMPLATE = STARTER_REQUIREMENT_TEMPLATE;
25283
25699
  exports.STARTER_SCHEMAS = STARTER_SCHEMAS;
25284
25700
  exports.STARTER_SCHEMAS_MAP = STARTER_SCHEMAS_MAP;
25701
+ exports.STARTER_SPECS_AGENTS_MD = STARTER_SPECS_AGENTS_MD;
25702
+ exports.STARTER_SRC_AGENTS_MD = STARTER_SRC_AGENTS_MD;
25285
25703
  exports.STARTER_TASK_TEMPLATE = STARTER_TASK_TEMPLATE;
25286
25704
  exports.STARTER_TEMPLATES_CI_AZURE_PIPELINES_YML = STARTER_TEMPLATES_CI_AZURE_PIPELINES_YML;
25287
25705
  exports.STARTER_TEMPLATES_CI_BITBUCKET_PIPELINES_YML = STARTER_TEMPLATES_CI_BITBUCKET_PIPELINES_YML;
@@ -25323,6 +25741,7 @@ exports.STARTER_TEMPLATES_SECURITY_ENCLAVE_TEMPLATE_MD = STARTER_TEMPLATES_SECUR
25323
25741
  exports.STARTER_TEMPLATES_SECURITY_SECURITY_REQ_TEMPLATE_MD = STARTER_TEMPLATES_SECURITY_SECURITY_REQ_TEMPLATE_MD;
25324
25742
  exports.STARTER_TEMPLATES_SECURITY_THREAT_ACTOR_TEMPLATE_MD = STARTER_TEMPLATES_SECURITY_THREAT_ACTOR_TEMPLATE_MD;
25325
25743
  exports.STARTER_TEMPLATES_WORKFLOW_AGENT_HANDOFF_TEMPLATE_MD = STARTER_TEMPLATES_WORKFLOW_AGENT_HANDOFF_TEMPLATE_MD;
25744
+ exports.STARTER_TESTS_AGENTS_MD = STARTER_TESTS_AGENTS_MD;
25326
25745
  exports.STARTER_VSCODE_MCP = STARTER_VSCODE_MCP;
25327
25746
  exports.STARTER_WORKFLOW_HANDOFF_TEMPLATE = STARTER_WORKFLOW_HANDOFF_TEMPLATE;
25328
25747
  exports.STARTER__GITHUB_PULL_REQUEST_TEMPLATE_MD = STARTER__GITHUB_PULL_REQUEST_TEMPLATE_MD;
@@ -25630,6 +26049,8 @@ exports.verifySast = verifySast;
25630
26049
  exports.verifySastAsync = verifySastAsync;
25631
26050
  exports.verifySddIntegration = verifySddIntegration;
25632
26051
  exports.verifySecrets = verifySecrets;
26052
+ exports.verifySkillExecutionEvidence = verifySkillExecutionEvidence;
26053
+ exports.verifySkillsIntegrity = verifySkillsIntegrity;
25633
26054
  exports.verifyTasksGovernance = verifyTasksGovernance;
25634
26055
  exports.verifyTestingCoverage = verifyTestingCoverage;
25635
26056
  exports.verifyTraceability = verifyTraceability;