@aisdlc/core 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -513,6 +513,9 @@ function createDefaultQualityPolicy() {
513
513
  max_cognitive: 15,
514
514
  min_maintainability: 50,
515
515
  max_function_lines: 40,
516
+ min_line_coverage: 85,
517
+ min_branch_coverage: 80,
518
+ min_function_coverage: 90,
516
519
  enforce_mode: "STRICT",
517
520
  target_directories: ["src", "lib", "examples", "tests"],
518
521
  supported_extensions: [...DEFAULT_EXTENSIONS],
@@ -536,6 +539,15 @@ function applyDocScope(policy, doc) {
536
539
  }
537
540
  }
538
541
  }
542
+ function applyCoverageThresholds(policy, covRaw) {
543
+ if (!covRaw || typeof covRaw !== "object") return;
544
+ const cov = covRaw;
545
+ if (cov.min_line_coverage_percent !== void 0) policy.min_line_coverage = Number(cov.min_line_coverage_percent);
546
+ if (cov.min_branch_coverage_percent !== void 0) policy.min_branch_coverage = Number(cov.min_branch_coverage_percent);
547
+ if (cov.min_function_coverage_percent !== void 0) {
548
+ policy.min_function_coverage = Number(cov.min_function_coverage_percent);
549
+ }
550
+ }
539
551
  function applyDocThresholds(policy, doc) {
540
552
  const sections = [doc.release_thresholds, doc.thresholds].filter(
541
553
  (s) => Boolean(s && typeof s === "object")
@@ -549,6 +561,7 @@ function applyDocThresholds(policy, doc) {
549
561
  if (cog !== void 0) policy.max_cognitive = Number(cog);
550
562
  if (mi !== void 0) policy.min_maintainability = Number(mi);
551
563
  if (loc !== void 0) policy.max_function_lines = Number(loc);
564
+ applyCoverageThresholds(policy, s.test_coverage);
552
565
  }
553
566
  const codingRules = doc.coding_rules;
554
567
  const rules = codingRules?.rules;
@@ -729,7 +742,13 @@ function walkMdFiles(dir, fileList = [], excludeDirs = [
729
742
  "test-scaffold",
730
743
  "fixtures",
731
744
  "templates",
732
- "examples"
745
+ "examples",
746
+ ".agent",
747
+ ".agents",
748
+ ".claude",
749
+ ".cursor",
750
+ ".github",
751
+ ".vscode"
733
752
  ]) {
734
753
  try {
735
754
  if (!fs6__namespace.existsSync(dir)) return fileList;
@@ -5809,6 +5828,78 @@ function detectLanguage(filePath) {
5809
5828
  return "Unknown";
5810
5829
  }
5811
5830
  }
5831
+ function parseJsonSummaryFile(filePath, relSource) {
5832
+ try {
5833
+ const raw = JSON.parse(fs6__namespace.readFileSync(filePath, "utf-8"));
5834
+ const total = raw.total;
5835
+ if (!total || typeof total !== "object") return null;
5836
+ const linesPct = Number(total.lines?.pct);
5837
+ const branchesPct = Number(total.branches?.pct);
5838
+ const functionsPct = Number(total.functions?.pct);
5839
+ if (Number.isNaN(linesPct) || Number.isNaN(branchesPct) || Number.isNaN(functionsPct)) return null;
5840
+ const statementsPct = total.statements?.pct !== void 0 ? Number(total.statements.pct) : void 0;
5841
+ return { linesPct, branchesPct, functionsPct, statementsPct, source: relSource };
5842
+ } catch {
5843
+ return null;
5844
+ }
5845
+ }
5846
+ function parseLcovFile(filePath, relSource) {
5847
+ try {
5848
+ const lines = fs6__namespace.readFileSync(filePath, "utf-8").split(/\r?\n/);
5849
+ let lf = 0, lh = 0, brf = 0, brh = 0, fnf = 0, fnh = 0;
5850
+ for (const line of lines) {
5851
+ if (line.startsWith("LF:")) lf += parseInt(line.slice(3), 10) || 0;
5852
+ else if (line.startsWith("LH:")) lh += parseInt(line.slice(3), 10) || 0;
5853
+ else if (line.startsWith("BRF:")) brf += parseInt(line.slice(4), 10) || 0;
5854
+ else if (line.startsWith("BRH:")) brh += parseInt(line.slice(4), 10) || 0;
5855
+ else if (line.startsWith("FNF:")) fnf += parseInt(line.slice(4), 10) || 0;
5856
+ else if (line.startsWith("FNH:")) fnh += parseInt(line.slice(4), 10) || 0;
5857
+ }
5858
+ if (lf === 0 && fnf === 0 && brf === 0) return null;
5859
+ const pct = (hit, found) => found > 0 ? Math.round(hit / found * 1e3) / 10 : 100;
5860
+ return {
5861
+ linesPct: pct(lh, lf),
5862
+ branchesPct: pct(brh, brf),
5863
+ functionsPct: pct(fnh, fnf),
5864
+ source: relSource
5865
+ };
5866
+ } catch {
5867
+ return null;
5868
+ }
5869
+ }
5870
+ function readCodeCoverageSummary(rootDir = process.cwd()) {
5871
+ const jsonCandidates = ["coverage/coverage-summary.json", "reports/coverage-summary.json"];
5872
+ for (const rel of jsonCandidates) {
5873
+ const full = path8__namespace.join(rootDir, rel);
5874
+ if (fs6__namespace.existsSync(full)) {
5875
+ const parsed = parseJsonSummaryFile(full, rel);
5876
+ if (parsed) return parsed;
5877
+ }
5878
+ }
5879
+ const lcovCandidates = ["coverage/lcov.info", "lcov.info", "reports/lcov.info"];
5880
+ for (const rel of lcovCandidates) {
5881
+ const full = path8__namespace.join(rootDir, rel);
5882
+ if (fs6__namespace.existsSync(full)) {
5883
+ const parsed = parseLcovFile(full, rel);
5884
+ if (parsed) return parsed;
5885
+ }
5886
+ }
5887
+ return null;
5888
+ }
5889
+ function formatCoverageRow(label, measured, minThreshold) {
5890
+ if (measured === void 0) {
5891
+ return `| **${label}** | \`N/A (Run test:coverage)\` | $\\ge ${minThreshold}\\%$ | \u2139\uFE0F NOT MEASURED |`;
5892
+ }
5893
+ const status = measured >= minThreshold ? "\u2705 COMPLIANT" : "\u26A0\uFE0F BELOW THRESHOLD";
5894
+ return `| **${label}** | \`${measured}%\` | $\\ge ${minThreshold}\\%$ | ${status} |`;
5895
+ }
5896
+ function buildCoverageRows(coverage, policy) {
5897
+ return [
5898
+ formatCoverageRow("Line Coverage", coverage?.linesPct, policy.min_line_coverage),
5899
+ formatCoverageRow("Branch Coverage", coverage?.branchesPct, policy.min_branch_coverage),
5900
+ formatCoverageRow("Function Coverage", coverage?.functionsPct, policy.min_function_coverage)
5901
+ ];
5902
+ }
5812
5903
  function generateQualityReport(options = {}) {
5813
5904
  const rootDir = options.rootDir || process.cwd();
5814
5905
  const gateResult = verifyQualityGate({
@@ -5816,6 +5907,7 @@ function generateQualityReport(options = {}) {
5816
5907
  policyPath: options.policyPath,
5817
5908
  thresholds: options.thresholds
5818
5909
  });
5910
+ const coverage = readCodeCoverageSummary(rootDir);
5819
5911
  const totalFiles = gateResult.totalFiles;
5820
5912
  const totalFunctions = gateResult.totalFunctions;
5821
5913
  let totalMi = 0;
@@ -5864,6 +5956,7 @@ function generateQualityReport(options = {}) {
5864
5956
  `| **Cyclomatic Complexity (Average)** | \`${avgCyclomatic}\` | $\\le ${gateResult.policy.max_cyclomatic}$ | ${avgCyclomatic <= gateResult.policy.max_cyclomatic ? "\u2705 COMPLIANT" : "\u274C EXCEEDED"} |`,
5865
5957
  `| **Cognitive Complexity (Average)** | \`${avgCognitive}\` | $\\le ${gateResult.policy.max_cognitive}$ | ${avgCognitive <= gateResult.policy.max_cognitive ? "\u2705 COMPLIANT" : "\u274C EXCEEDED"} |`,
5866
5958
  `| **Maintainability Index (SEI MI)** | \`${avgMaintainability} / 100\` | $\\ge ${gateResult.policy.min_maintainability}$ | ${avgMaintainability >= gateResult.policy.min_maintainability ? "\u2705 COMPLIANT" : "\u274C INSUFFICIENT"} |`,
5959
+ ...buildCoverageRows(coverage, gateResult.policy),
5867
5960
  `| **Functions in Violation** | \`${gateResult.failCount}\` | $0$ (Mode ${gateResult.policy.enforce_mode}) | ${gateResult.failCount === 0 ? "\u2705 0 VIOLATIONS" : "\u274C BLOCKED"} |`,
5868
5961
  ``,
5869
5962
  `---`,
@@ -5895,6 +5988,7 @@ function generateQualityReport(options = {}) {
5895
5988
  lines.push("## 4. Evaluation Criteria and Standards");
5896
5989
  lines.push("- **McCabe Cyclomatic Complexity (CC)**: Number of linearly independent paths.");
5897
5990
  lines.push("- **Maintainability Index (SEI MI)**: Normalized formula [0 - 100] combining Halstead Volume, CC, and LOC.");
5991
+ lines.push("- **Automated Test Coverage**: Passively ingested from `coverage/coverage-summary.json` or `lcov.info` when present.");
5898
5992
  lines.push("- **Clean Code Guardrails**: Prohibition of implicit `any` typing, function length limits ($le 40$ lines), and zero unjustified suppressions.");
5899
5993
  const markdown = lines.join("\n");
5900
5994
  const reportsDir = path8__namespace.join(rootDir, "reports");
@@ -5906,7 +6000,8 @@ function generateQualityReport(options = {}) {
5906
6000
  totalFunctions,
5907
6001
  avgMaintainability,
5908
6002
  avgCyclomatic,
5909
- verdict
6003
+ verdict,
6004
+ coverage
5910
6005
  };
5911
6006
  }
5912
6007
 
@@ -7595,10 +7690,12 @@ function collectDashboardMetrics(rootDir) {
7595
7690
  }
7596
7691
  } catch {
7597
7692
  }
7693
+ const codeCoverage = readCodeCoverageSummary(rootDir);
7598
7694
  return {
7599
7695
  gate,
7600
7696
  gov,
7601
7697
  cov,
7698
+ codeCoverage,
7602
7699
  trace,
7603
7700
  history,
7604
7701
  activePrKpi,
@@ -8140,6 +8237,11 @@ function renderDashboardHtml(graphData, metricsData, title = "AI-SDLC: Dashboard
8140
8237
  <span class="value">${metricsData.cov.totalRequirements > 0 ? Math.round(metricsData.cov.passedRequirements / metricsData.cov.totalRequirements * 100) : 100}%</span>
8141
8238
  <span class="subtitle">${metricsData.cov.passedRequirements} / ${metricsData.cov.totalRequirements} verified</span>
8142
8239
  </div>
8240
+ <div class="metric-card">
8241
+ <span class="title">Code Coverage (Lines)</span>
8242
+ <span class="value">${metricsData.codeCoverage ? metricsData.codeCoverage.linesPct + "%" : "N/A"}</span>
8243
+ <span class="subtitle">${metricsData.codeCoverage ? `Branches: ${metricsData.codeCoverage.branchesPct}% | Funcs: ${metricsData.codeCoverage.functionsPct}%` : `Min target: ${metricsData.gate.policy.min_line_coverage}% (Run test:coverage)`}</span>
8244
+ </div>
8143
8245
  </div>
8144
8246
 
8145
8247
  <div class="chart-container">
@@ -9159,155 +9261,424 @@ function generateDashboardReport(options = {}) {
9159
9261
  }
9160
9262
 
9161
9263
  // src/init/agent-templates.ts
9162
- var STARTER_ANTIGRAVITY_RULES = `# Google Antigravity & Gemini CLI Rules - AI-SDLC Framework\r
9163
- \r
9164
- Canonical reference: [\`process/09_agent_protocols.md\`](../../process/09_agent_protocols.md) and [\`process/01_governance_and_roles.md\`](../../process/01_governance_and_roles.md).\r
9165
- \r
9166
- This file defines operational rules and specialized role mappings for Google Antigravity and Gemini CLI-based agents within the AI-SDLC ecosystem.\r
9167
- \r
9168
- ---\r
9169
- \r
9170
- ## 1. The 5 Unbreakable Commandments for Agents\r
9171
- \r
9172
- 1. **NO AUTO-APPROVE OR AUTO-MERGE**: No agent may auto-approve PRs or perform direct merges to protected branches (\`main\`, \`release/*\`). Only a human may approve or merge.\r
9173
- 2. **NO INVENTING PRODUCT OR ARCHITECTURAL DECISIONS**: When facing ambiguous requirements, formulate clarifying questions (\`open-questions\`). Never assume unspecified intent.\r
9174
- 3. **NO INTRODUCING DEPENDENCIES WITHOUT LICENSE INSPECTION**: Always consult \`license-policy.yaml\`. Viral licenses (\`GPL\`/\`AGPL\`) or paid commercial licenses (\`BSL\`/\`SSPL\`) are strictly forbidden without authorization.\r
9175
- 4. **NO IGNORING CYBERSECURITY (SECURITY-BY-DEFAULT)**: Validate inputs, sanitize data, and include mitigation tests (\`SEC-TEST-*\`). Disabling linters or suppressing type-checking errors is prohibited.\r
9176
- 5. **MANDATORY CRYPTOGRAPHIC CITATION**: Every derived artifact must cite its upstream artifacts using canonical identifiers and their normalized SHA-256 cryptographic hashes (Unix LF).\r
9177
- \r
9178
- ---\r
9179
- \r
9180
- ## 2. Specialized Roles Mapping\r
9181
- \r
9182
- ### 1. \`agent-product-analyst\` (Product Analyst / Scribe)\r
9183
- - **Mission**: Assist in defining and refining the product model using ProductShape.\r
9184
- - **Input**: Business intent or natural language specification.\r
9185
- - **Output**: Markdown artifacts with YAML frontmatter conforming to \`schemas/product/\` (\`ACT-*\`, \`UC-*\`, \`FR-*\`, \`QR-*\`, \`BR-*\`).\r
9186
- - **Guardrails**:\r
9187
- - \`status\` always starts as \`draft\`.\r
9188
- - In \`UC-*\`, the \`1. Intent and Outcome\` section must follow the standard English template: \`As a <ACT-ID>... I want <action>... To <outcome>...\`.\r
9189
- - Mandatory Gherkin criteria with \`@<ID> @automated @regression\`.\r
9190
- - Run \`pnpm run verify:schemas\` and \`pnpm run verify:duplicates\` before delivering the draft.\r
9191
- \r
9192
- ### 2. \`agent-threat-modeler\` (Threat & Security Modeler)\r
9193
- - **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.\r
9194
- - **Input**: Use cases \`UC-*\`, functional requirements \`FR-*\`, or architecture components (\`CMP-*\`, Mermaid diagrams, ADRs).\r
9195
- - **Output**: Cybersecurity triad (\`ACT-THREAT-*\`, \`ABUSE-*\`, \`SEC-REQ-*\`) conforming to \`schemas/security/\`.\r
9196
- - **Guardrails**:\r
9197
- - \`status\` always starts as \`draft\`.\r
9198
- - Negative attack and rejection BDD scenarios tagged \`@security @mitigation\`.\r
9199
- - Assignment of Zero Trust enclaves \`SEC-ENC-*\`.\r
9200
- \r
9201
- ### 3. \`agent-qa-engineer\` (QA Engineer & SDET)\r
9202
- - **Mission**: Translate approved requirements (\`FR-*\`, \`SEC-REQ-*\`, \`QR-*\`) into comprehensive FAILING (red) BDD/Gherkin test suites before \`agent-developer\` writes production code.\r
9203
- - **Input**: Approved requirements from the \`handoff.yaml\` sidecar (\`HOF-*\`).\r
9204
- - **Output**: Failing Gherkin scenarios covering: nominal case, boundary cases, out-of-range cases, and conditional categories (security, performance, idempotency, postconditions, interface contracts).\r
9205
- - **Guardrails**:\r
9206
- - STRICTLY FORBIDDEN from including production code or anticipating implementations.\r
9207
- - Every \`FR-*\` must have at least nominal + boundary + out-of-range; without these three categories, handoff to \`agent-developer\` is blocked.\r
9208
- - Mandatory tags: \`@<FR-ID> @automated @regression\`.\r
9209
- - Run \`pnpm run verify:testing\` before issuing handoff.\r
9210
- \r
9211
- ### 4. \`agent-developer\` (Software Developer)\r
9212
- - **Mission**: Implement atomic tasks from SDD specifications (\`tasks.md\`) with clean code, strict typing, and comprehensive tests.\r
9213
- - **Directives**:\r
9214
- - Respect the autonomy mode assigned in \`tasks.md\` (\`AUTONOMOUS\`, \`HUMAN_REVIEW_PLAN\`, \`AMBIGUOUS\`, \`HIGH_RISK_MANUAL\`).\r
9215
- - Make tests delivered by \`agent-qa-engineer\` pass green without altering them to accommodate code.\r
9216
- - Respect thresholds from \`quality-policy.yaml\`: CC $\\le 10$, Cognitive $\\le 15$, MI $\\ge 50$, LOC $\\le 40$.\r
9217
- - Run unified preflight with auto-fix: \`pnpm run check:fix\` and full verification: \`pnpm run verify:all\`.\r
9218
- - Upon completing green implementation, suggest handoff to \`agent-expert-user\` for post-development functional validation prior to security audit.\r
9219
- \r
9220
- ### 5. \`agent-expert-user\` (Expert User & Domain Evaluator)\r
9221
- - **Mission**: Challenge design and specifications (design phase) and functionally validate finished software against \`UC-*\` and \`FR-*\` (post-development phase).\r
9222
- - **Directives**:\r
9223
- - Design mode (upstream): Adopt primary actor persona under field stress conditions, applying bimodal discrimination (strict MVP core vs. roadmap suggestion bank in \`templates/product/user-design-feedback.template.md\`).\r
9224
- - Functional validation mode (downstream / pre-PR): Comprehensively check interface and real CLI execution against acceptance criteria in \`UC-*\` and \`FR-*\` before pre-merge security audit.\r
9225
- - Emit handoff block suggesting \`agent-code-reviewer\` / \`agent-security-auditor\` if compliant, or return to \`agent-developer\` upon functional deviations.\r
9226
- \r
9227
- ### 6. \`agent-code-reviewer\` (Technical & Architectural Code Reviewer)\r
9228
- - **Mission**: Audit Pull Requests evaluating code cleanliness, adherence to SOLID, DRY, YAGNI, design patterns, and compliance with complexity and maintainability thresholds (\`quality-policy.yaml\`), forming part of the Pre-Merge Audit Triad.\r
9229
- - **Directives**:\r
9230
- - Respect \`quality-policy.yaml\` thresholds: CC $\\le 10$, Cognitive $\\le 15$, MI $\\ge 50$, LOC $\\le 40$.\r
9231
- - Detect undue coupling, code smells, magic numbers, ambiguous names, and encapsulation violations.\r
9232
- - Flag premature abstractions and speculative code violating YAGNI.\r
9233
- - Participate in the coordinated Pre-Merge Audit Triad with \`agent-security-auditor\` and \`agent-compliance-checker\`.\r
9234
- - Classify findings into: \`[BLOCKING]\` (quality violation or broken pattern), \`[CLEAN_CODE_SUGGESTION]\` (non-blocking improvement), and \`[COMPLIANT]\`.\r
9235
- \r
9236
- ### 7. \`agent-devops\` (Automation & Infrastructure Engineer)\r
9237
- - **Mission**: Maintain, evolve, and audit the project automated infrastructure: CI/CD workflows, Docker containers, IaC manifests, and support scripts.\r
9238
- - **Directives**:\r
9239
- - Strict infrastructure domain: Operates exclusively in \`.github/workflows/\`, \`Dockerfile*\`, \`docker-compose*.yml\`, IaC manifests, and \`scripts/\`.\r
9240
- - **NON-INVASION GUARDRAIL**: STRICTLY FORBIDDEN from modifying or refactoring application source code files (\`src/\`, \`packages/*/src/\`). Your responsibility is pipeline and scaffolding, never application business logic.\r
9241
- - Infrastructure dependency policy: Verify licenses of dependencies, base images, and third-party actions against \`license-policy.yaml\`.\r
9242
- - Gate preservation: Ensure any pipeline optimization preserves all existing deterministic Quality Gates intact.\r
9243
- \r
9244
- ---\r
9245
- \r
9246
- ## 3. 4-Tier Git Hierarchy and Commit Conventions\r
9247
- - \`task/<PARENT-ID>/<TSK-ID>-<slug>\` $\\rightarrow$ \`feat/<FEAT-ID>-<slug>\` $\\rightarrow$ \`release/vX.Y.Z\` $\\rightarrow$ \`main\`.\r
9248
- - Mandatory injection of commit trailers:\r
9249
- \`\`\`text\r
9250
- Author-Type: agent\r
9251
- AI-Model: gemini-1.5-pro / gemini-2.0-flash\r
9252
- Task-ID: TSK-XXX\r
9253
- Change-ID: CHG-XXX\r
9254
- \`\`\`\r
9255
- \r
9256
- ---\r
9257
- \r
9258
- ## 4. Workflow Handoff Protocol and Human Action Window\r
9259
- - **Conditional Activation Rule by Autonomy**:\r
9260
- - \u{1F7E2} **\`AUTONOMOUS\`** (or exclusive supervision at the end in PR/CI): **OMITIDO**. Do not request or emit interactive handoff to avoid interrupting unattended execution.\r
9261
- - \u{1F7E1} **Autonomy $\\ge$ \`HUMAN_REVIEW_PLAN\`** (\`HUMAN_REVIEW_PLAN\`, \`AMBIGUOUS\`, \`HIGH_RISK_MANUAL\`): **MANDATORY**. Emit the Workflow Handoff block conforming to [\`templates/workflow/agent-handoff.template.md\`](../../templates/workflow/agent-handoff.template.md) and **HALT**.\r
9262
- - **Block Contents**: Declare completed deliverables, recommend the next role in the workflow (\`agent-threat-modeler\`, \`agent-system-architect\`, \`agent-qa-engineer\`, \`agent-developer\`, \`agent-expert-user\`, \`agent-code-reviewer\`, \`agent-security-auditor\`, \`agent-compliance-checker\`, \`agent-devops\`, etc.), provide ready-to-copy invocation prompt, and **always keep the window open for the human user to take action** (review, manually edit, pause/divert, or delegate).\r
9263
- \r
9264
+ var SPECIALIZED_AGENT_TEMPLATES = [
9265
+ {
9266
+ id: "agent-product-analyst",
9267
+ title: "Product Analyst / Scribe",
9268
+ description: "Assist the human Product Owner in exploring, modeling, and refining product definition using ProductShape (ACT-*, UC-*, FR-*, QR-*, BR-*).",
9269
+ globs: "product/**, specs/product/**, templates/product/**",
9270
+ body: `## Role & Mission
9271
+ - **Role**: Product Analyst Agent (\`agent-product-analyst\`) and Technical Scribe (AI as Scribe) of the AI-SDLC framework.
9272
+ - **Mission**: Transform natural language business intent into canonical ProductShape artifacts (\`ACT-*\`, \`JRN-*\`, \`UC-*\`, \`BR-*\`, \`TERM-*\`, \`FR-*\`, \`QR-*\`) 100% compliant with JSON schemas.
9273
+
9274
+ ## Operational Directives & Guardrails
9275
+ - Every generated artifact must strictly adhere to the canonical Markdown and YAML frontmatter format in \`schemas/product/\`.
9276
+ - \`status\` ALWAYS starts as \`draft\`. Creating artifacts directly as \`active\` or \`approved\` is forbidden.
9277
+ - Always write relationships in their single canonical direction (\`derives-from: [UC-*]\`, \`primary-actor: ACT-*\`).
9278
+ - In \`UC-*\`, format section \`1. Intent and Outcome\` under the standard English structure: \`As a <ACT-ID>... I want <action>... To <outcome>...\`.
9279
+ - In every \`FR-*\` requirement, include a \`\`\`gherkin block with tags \`@<ID> @automated @regression\`, nominal \`Scenario\`, and at least one \`Scenario Outline\` with an \`Examples\` table.
9280
+ - Do not assume business rules. If you detect an ambiguity, record it explicitly under \`open-questions\`.
9281
+ - Run \`pnpm run verify:schemas\` and \`pnpm run verify:duplicates\` before delivering the draft.
9282
+ - If autonomy is $\\ge$ \`HUMAN_REVIEW_PLAN\`, conclude by emitting the canonical Workflow Handoff block (\`templates/workflow/agent-handoff.template.md\`) suggesting \`agent-threat-modeler\` or \`agent-expert-user\`, opening the Human Action Window. In \`AUTONOMOUS\` mode, omit interactive handoff.`
9283
+ },
9284
+ {
9285
+ id: "agent-threat-modeler",
9286
+ title: "Threat Modeler and Security Specialist",
9287
+ description: "Analyze business use cases and architecture artifacts to proactively model STRIDE adversaries, abuse cases, and OWASP ASVS security requirements.",
9288
+ globs: "security/**, specs/security/**, architecture/**",
9289
+ body: `## Role & Mission
9290
+ - **Role**: Threat Modeling and Shift-Left Cybersecurity Specialist Agent (\`agent-threat-modeler\`).
9291
+ - **Mission**: Analyze business use cases and architecture artifacts to proactively model adversaries, STRIDE attack vectors, and OWASP ASVS mitigation requirements.
9292
+
9293
+ ## Operational Directives & Guardrails
9294
+ - Apply STRIDE and OWASP ASVS methodologies to every use case \`UC-*\` and architecture component \`CMP-*\` (Mermaid C4/arc42 diagrams, ADR records).
9295
+ - Systematically generate the cybersecurity triad conforming to \`schemas/security/\`:
9296
+ - \`ACT-THREAT-*\` (Threat Actor)
9297
+ - \`ABUSE-*\` (Abuse Case targeting \`UC-*\` with \`mitigated-by: [SEC-REQ-*]\`)
9298
+ - \`SEC-REQ-*\` (Security Requirement with \`mitigates-abuse-case: [ABUSE-*]\` and \`enforced-in-enclave: SEC-ENC-*\`)
9299
+ - \`status\` ALWAYS starts as \`draft\`.
9300
+ - In the **Technical Security Feedback Loop** (arriving from \`agent-system-architect\`), analyze infrastructure, persistence, middleware, and API decisions to issue system/software-level \`ACT-THREAT-*\` and \`SEC-REQ-*\`.
9301
+ - Every \`SEC-REQ-*\` must include negative BDD attack and rejection scenarios tagged \`@security @mitigation\`.
9302
+ - Run \`pnpm run verify:schemas\` before delivering the draft.
9303
+ - If autonomy is $\\ge$ \`HUMAN_REVIEW_PLAN\`, conclude by emitting the Workflow Handoff block (\`templates/workflow/agent-handoff.template.md\`) suggesting \`agent-system-architect\` (or \`agent-qa-engineer\` once technical modeling is complete) and opening the Human Action Window. In \`AUTONOMOUS\` mode, omit interactive handoff.`
9304
+ },
9305
+ {
9306
+ id: "agent-system-architect",
9307
+ title: "System Architect",
9308
+ description: "Translate approved product and security definitions into modular technical architecture based on arc42 enriched with NAF v4 (CMP-*, ADR-*).",
9309
+ globs: "architecture/**, specs/changes/**/design.md, templates/architecture/**",
9310
+ body: `## Role & Mission
9311
+ - **Role**: System Architect Agent (\`agent-system-architect\`) of the AI-SDLC framework.
9312
+ - **Mission**: Translate approved product definition into a modular technical architecture based on arc42 enriched with NAF v4.
9313
+
9314
+ ## Operational Directives & Guardrails
9315
+ - Decompose the system into building blocks \`CMP-*\` ensuring each component declares which use cases \`UC-*\` it implements and which requirements (\`FR-*\`, \`QR-*\`, \`SEC-REQ-*\`) it fulfills under \`satisfies-requirements\`.
9316
+ - Generate interaction and sequence diagrams in native Mermaid syntax.
9317
+ - Document critical technological decisions using immutable \`ADR-*\` records conforming to \`schemas/architecture/adr.schema.json\`.
9318
+ - Validate that architectural choices comply with legal constraints in \`license-policy.yaml\`.
9319
+ - **Technical Security Feedback Loop**: If architectural decisions (databases, queues, distributed caching, third-party APIs, authentication schemes) introduce new attack vectors, emit a return handoff to \`agent-threat-modeler\` for technical modeling prior to the testing phase.
9320
+ - If autonomy is $\\ge$ \`HUMAN_REVIEW_PLAN\`, conclude by emitting the Workflow Handoff block (\`templates/workflow/agent-handoff.template.md\`) suggesting \`agent-qa-engineer\` (or \`agent-threat-modeler\` if technical security loop is required) and opening the Human Action Window. In \`AUTONOMOUS\` mode, omit interactive handoff.`
9321
+ },
9322
+ {
9323
+ id: "agent-qa-engineer",
9324
+ title: "QA Engineer and SDET",
9325
+ description: "Translate approved requirements (FR-*, SEC-REQ-*, QR-*) into comprehensive FAILING (red) BDD/Gherkin and unit test suites before production code is written.",
9326
+ globs: "tests/**, specs/changes/**/spec.md",
9327
+ body: `## Role & Mission
9328
+ - **Role**: QA Engineer and SDET (Software Development Engineer in Test) Agent (\`agent-qa-engineer\`).
9329
+ - **Mission**: Translate approved requirements (\`FR-*\`, \`SEC-REQ-*\`, \`QR-*\`) into comprehensive FAILING (red) BDD/Gherkin test suites before \`agent-developer\` writes a single line of production code.
9330
+
9331
+ ## Operational Directives & Guardrails
9332
+ - Read exclusively requirements cited in the \`handoff.yaml\` sidecar (\`HOF-*\`) and their referenced artifacts.
9333
+ - For each \`FR-*\` requirement, generate the three mandatory test categories:
9334
+ 1. **Nominal Case** (\`Scenario\`): happy path with valid inputs within expected boundaries.
9335
+ 2. **Boundary Cases** (\`Scenario Outline\` + \`Examples\` table): values at the extremes of the accepted range.
9336
+ 3. **Out-of-Range / Invalid Cases** (\`Scenario Outline\` + \`Examples\` table): null, empty, wrong types, values exceeding bounds.
9337
+ - Apply conditional categories when applicable: Security (\`@security @mitigation\`), Performance (\`@performance\`), Idempotency (\`@idempotence\`), Postconditions, and Interface Contracts.
9338
+ - Tag all scenarios with \`@<FR-ID> @automated @regression\`.
9339
+ - **STRICTLY FORBIDDEN**: Including production code, suggesting implementation, or anticipating technical solutions.
9340
+ - Run \`pnpm run verify:testing\` before emitting handoff.
9341
+ - If autonomy is $\\ge$ \`HUMAN_REVIEW_PLAN\`, conclude by emitting the Workflow Handoff block (\`templates/workflow/agent-handoff.template.md\`) suggesting \`agent-developer\` and opening the Human Action Window. In \`AUTONOMOUS\` mode, omit interactive handoff.`
9342
+ },
9343
+ {
9344
+ id: "agent-developer",
9345
+ title: "Software Developer",
9346
+ description: "Implement atomic tasks from SDD specifications (tasks.md) delivering clean, strictly typed, and tested code satisfying quality-policy.yaml thresholds.",
9347
+ globs: "src/**, packages/**, tests/**, specs/changes/**",
9348
+ body: `## Role & Mission
9349
+ - **Role**: High-Precision Software Developer / Coder Agent (\`agent-developer\`).
9350
+ - **Mission**: Implement atomic tasks from SDD specifications (\`tasks.md\`) delivering clean, strictly typed, and tested code.
9351
+
9352
+ ## Operational Directives & Guardrails
9353
+ - Respect the autonomy mode assigned to each task in \`tasks.md\` (\`AUTONOMOUS\`, \`HUMAN_REVIEW_PLAN\`, \`AMBIGUOUS\`, \`HIGH_RISK_MANUAL\`).
9354
+ - Apply Test-Driven Development (TDD): make failing tests delivered by \`agent-qa-engineer\` pass green without altering tests to accommodate buggy code.
9355
+ - Cite implemented \`FR-*\` or \`SEC-REQ-*\` IDs in test header comments to maintain 360\xB0 reverse traceability.
9356
+ - Before adding any external dependency, verify its SPDX license is permitted in \`license-policy.yaml\`.
9357
+ - Respect non-negotiable \`quality-policy.yaml\` thresholds: Cyclomatic Complexity $\\le 10$, Cognitive Complexity $\\le 15$, Maintainability Index $\\ge 50$, Function Length $\\le 40$ lines.
9358
+ - Run unified pre-flight with auto-fix (\`pnpm run check:fix\`) and full verification (\`pnpm run verify:all\`).
9359
+ - Upon completing green implementation, suggest handoff to \`agent-expert-user\` for Post-Development Functional Validation prior to security audit.`
9360
+ },
9361
+ {
9362
+ id: "agent-security-auditor",
9363
+ title: "Adversarial Code Auditor",
9364
+ description: "Examine Pull Requests and source code with an attacker mindset for business logic vulnerabilities, injection vectors, secret leaks, and authorization flaws.",
9365
+ globs: "src/**, packages/**, security/**",
9366
+ body: `## Role & Mission
9367
+ - **Role**: Adversarial Security Auditor Agent (\`agent-security-auditor\`).
9368
+ - **Mission**: Rigorously examine Pull Requests and code diffs for business logic vulnerabilities, injection vectors, secret leaks, and authorization flaws as part of the Pre-Merge Audit Triad.
9369
+
9370
+ ## Operational Directives & Guardrails
9371
+ - Analyze code diffs with an attacker mindset: How can an unauthenticated user bypass this check? Are there info leaks in exceptions? Is command, SQL, path traversal, or prompt injection possible?
9372
+ - Run deterministic security verification: \`pnpm run verify:security\` (secrets + shift-left SAST).
9373
+ - Issue a formal audit report with CVSS v3.1 severity scoring and concrete remediation proposals.
9374
+ - Immediately block any PR introducing CRITICAL or HIGH security risks.
9375
+ - If autonomy is $\\ge$ \`HUMAN_REVIEW_PLAN\`, conclude by emitting the Workflow Handoff block (\`templates/workflow/agent-handoff.template.md\`) to the human Tech Lead, opening the Human Action Window. In \`AUTONOMOUS\` mode, omit interactive handoff.`
9376
+ },
9377
+ {
9378
+ id: "agent-compliance-checker",
9379
+ title: "Open Source License Compliance Auditor",
9380
+ description: "Audit dependency manifests and SBOMs against license-policy.yaml to block viral copyleft licenses and flag commercial license requirements.",
9381
+ globs: "package.json, pnpm-lock.yaml, license-policy.yaml, compliance/**",
9382
+ body: `## Role & Mission
9383
+ - **Role**: Open Source License and Intellectual Property Compliance Auditor Agent (\`agent-compliance-checker\`).
9384
+ - **Mission**: Audit dependency manifests and ensure every direct and transitive third-party package complies with \`license-policy.yaml\` as part of the Pre-Merge Audit Triad.
9385
+
9386
+ ## Operational Directives & Guardrails
9387
+ - Verify SPDX identifiers for every direct and transitive dependency via \`pnpm run verify:licenses\`.
9388
+ - Immediately block viral copyleft licenses (\`GPL-*\`, \`AGPL-*\`) and unknown/unlicensed packages.
9389
+ - If source-available or commercial licenses (\`BSL-1.1\`, \`SSPL-1.0\`) are detected, flag with \`COMMERCIAL_APPROVAL_REQUIRED\` and draft a request using \`templates/compliance/commercial-acquisition-request.template.md\`.
9390
+ - If autonomy is $\\ge$ \`HUMAN_REVIEW_PLAN\`, conclude by emitting the Workflow Handoff block (\`templates/workflow/agent-handoff.template.md\`) to the human Tech Lead or Legal counsel, opening the Human Action Window. In \`AUTONOMOUS\` mode, omit interactive handoff.`
9391
+ },
9392
+ {
9393
+ id: "agent-expert-user",
9394
+ title: "Expert User and Domain Evaluator",
9395
+ description: "Scrutinize product design (MVP vs roadmap) and functionally validate finished software against UC-* and FR-* acceptance criteria before pre-merge audit.",
9396
+ globs: "product/**, specs/**, src/**, packages/**",
9397
+ body: `## Role & Mission
9398
+ - **Role**: Expert User and Domain Evaluator Agent (\`agent-expert-user\`).
9399
+ - **Mission**: Scrutinize product design, technical specifications, and implemented software from the perspective of an advanced operator, enforcing strict MVP boundaries and pre-PR functional conformity.
9400
+
9401
+ ## Operational Directives & Guardrails
9402
+ - Operate under bimodal discipline depending on the lifecycle phase:
9403
+ 1. **Design Mode (Upstream)**: Adopt the primary actor persona under real-world field conditions (stress, latency, constrained viewports). Separate strict Minimum Viable Product (MVP) core from future roadmap ideas using \`templates/product/user-design-feedback.template.md\`.
9404
+ 2. **Functional Validation Mode (Downstream / Pre-PR / Post-Development Functional Validation)**: Inspect \`agent-developer\` deliverables once unit tests pass green. Contrast actual UI, CLI, and API behavior against approved \`UC-*\` and \`FR-*\` criteria.
9405
+ - Formulate decisive questions under \`open-questions\` for the human Product Owner.
9406
+ - Emit handoff block suggesting the Pre-Merge Audit Triad (\`agent-code-reviewer\`, \`agent-security-auditor\`, \`agent-compliance-checker\`) if compliant, or return to \`agent-developer\` on functional drift.`
9407
+ },
9408
+ {
9409
+ id: "agent-code-reviewer",
9410
+ title: "Technical and Architectural Code Reviewer",
9411
+ description: "Audit Pull Requests for Clean Code, SOLID, DRY, YAGNI, design patterns, and compliance with quality-policy.yaml complexity and maintainability thresholds.",
9412
+ globs: "src/**, packages/**, tests/**",
9413
+ body: `## Role & Mission
9414
+ - **Role**: Technical and Architectural Code Reviewer Agent (\`agent-code-reviewer\`).
9415
+ - **Mission**: Audit Pull Requests evaluating code cleanliness, adherence to SOLID, DRY, YAGNI principles, design patterns, and compliance with complexity and maintainability thresholds (\`quality-policy.yaml\`), forming part of the Pre-Merge Audit Triad.
9416
+
9417
+ ## Operational Directives & Guardrails
9418
+ - Analyze code diffs against \`quality-policy.yaml\` standards: Cyclomatic Complexity $\\le 10$, Cognitive Complexity $\\le 15$, Maintainability Index $\\ge 50$, Lines per Function $\\le 40$.
9419
+ - Detect improper coupling, code smells, magic numbers, ambiguous identifiers, and encapsulation breaches.
9420
+ - Flag premature abstractions and speculative code violating YAGNI.
9421
+ - Coordinate Pre-Merge Audit Triad with \`agent-security-auditor\` and \`agent-compliance-checker\`.
9422
+ - Categorize findings into: \`[BLOCKING]\` (quality violation or broken pattern), \`[CLEAN_CODE_SUGGESTION]\` (non-blocking improvement), and \`[COMPLIANT]\`.
9423
+ - If autonomy is $\\ge$ \`HUMAN_REVIEW_PLAN\`, conclude by emitting the Workflow Handoff block (\`templates/workflow/agent-handoff.template.md\`) to the human Tech Lead for final approval and merge, opening the Human Action Window. In \`AUTONOMOUS\` mode, omit interactive handoff.`
9424
+ },
9425
+ {
9426
+ id: "agent-devops",
9427
+ title: "Automation and Infrastructure Engineer",
9428
+ description: "Maintain, evolve, and audit CI/CD workflows, Dockerfiles, IaC manifests, and support scripts under strict non-invasion guardrails on src/.",
9429
+ globs: ".github/workflows/**, templates/ci/**, scripts/**, Dockerfile*",
9430
+ body: `## Role & Mission
9431
+ - **Role**: DevOps and Infrastructure as Code (IaC) Engineer Agent (\`agent-devops\`).
9432
+ - **Mission**: Maintain, evolve, and audit automated project infrastructure: CI/CD workflows, Docker containers, deployment manifests, and infrastructure scripts.
9433
+
9434
+ ## Operational Directives & Guardrails
9435
+ - **Strict Infrastructure Domain**: Operate exclusively on workflows (\`.github/workflows/\`, \`templates/ci/\`), container files (\`Dockerfile*\`, \`docker-compose*.yml\`), IaC manifests, and support scripts (\`scripts/\`).
9436
+ - **NON-INVASION GUARDRAIL**: STRICTLY FORBIDDEN from modifying or refactoring application source code files (\`src/\`, \`packages/*/src/\`). Your responsibility is pipelines and scaffolding, never business logic.
9437
+ - **Infrastructure Dependency Policy**: Verify licenses of dependencies, Docker base images, and third-party CI actions against \`license-policy.yaml\`.
9438
+ - **Gate Preservation**: Ensure any pipeline optimization keeps all existing deterministic Quality Gates intact.
9439
+ - If autonomy is $\\ge$ \`HUMAN_REVIEW_PLAN\`, conclude by emitting the Workflow Handoff block (\`templates/workflow/agent-handoff.template.md\`) to the human Tech Lead or Release Manager, opening the Human Action Window. In \`AUTONOMOUS\` mode, omit interactive handoff.`
9440
+ }
9441
+ ];
9442
+ function renderAntigravityAgentFile(agent) {
9443
+ return `---
9444
+ name: ${agent.id}
9445
+ description: >-
9446
+ ${agent.description}
9447
+ ---
9448
+
9449
+ # ${agent.id} (${agent.title})
9450
+
9451
+ Canonical Reference: [\`process/09_agent_protocols.md\`](../../process/09_agent_protocols.md) and [\`process/01_governance_and_roles.md\`](../../process/01_governance_and_roles.md).
9452
+
9453
+ ${agent.body}
9454
+ `;
9455
+ }
9456
+ function renderClaudeAgentFile(agent) {
9457
+ return `---
9458
+ name: ${agent.id}
9459
+ description: ${agent.description}
9460
+ ---
9461
+
9462
+ # ${agent.id} (${agent.title})
9463
+
9464
+ Canonical Reference: [\`process/09_agent_protocols.md\`](../../process/09_agent_protocols.md) and [\`process/01_governance_and_roles.md\`](../../process/01_governance_and_roles.md).
9465
+
9466
+ ${agent.body}
9467
+ `;
9468
+ }
9469
+ function renderCopilotAgentFile(agent) {
9470
+ return `---
9471
+ name: ${agent.id}
9472
+ description: ${agent.description}
9473
+ ---
9474
+
9475
+ # ${agent.id} (${agent.title})
9476
+
9477
+ Canonical Reference: [\`process/09_agent_protocols.md\`](../../process/09_agent_protocols.md) and [\`process/01_governance_and_roles.md\`](../../process/01_governance_and_roles.md).
9478
+
9479
+ ${agent.body}
9480
+ `;
9481
+ }
9482
+ function renderCursorAgentFile(agent) {
9483
+ return `---
9484
+ description: ${agent.id} (${agent.title}) - ${agent.description}
9485
+ globs: ${agent.globs}
9486
+ alwaysApply: false
9487
+ ---
9488
+
9489
+ # ${agent.id} (${agent.title})
9490
+
9491
+ Canonical Reference: [\`process/09_agent_protocols.md\`](../../process/09_agent_protocols.md) and [\`process/01_governance_and_roles.md\`](../../process/01_governance_and_roles.md).
9492
+
9493
+ ${agent.body}
9494
+ `;
9495
+ }
9496
+ var STARTER_ANTIGRAVITY_RULES = `# Google Antigravity & Gemini CLI Rules - AI-SDLC Framework
9497
+
9498
+ Canonical Reference: [\`process/09_agent_protocols.md\`](../../process/09_agent_protocols.md) and [\`process/01_governance_and_roles.md\`](../../process/01_governance_and_roles.md).
9499
+
9500
+ This file defines the operational rules and specialized role mappings for Google Antigravity and Gemini CLI-based agents within the AI-SDLC ecosystem.
9501
+
9502
+ ---
9503
+
9504
+ ## 1. The 5 Unbreakable Commandments of Agents | Los 5 Mandamientos Inquebrantables de los Agentes
9505
+
9506
+ 1. **FORBIDDEN TO AUTO-APPROVE OR AUTO-MERGE | PROHIBIDO AUTO-APROBAR O AUTO-FUSIONAR**: No agent may auto-approve PRs or perform direct merges to protected branches (\`main\`, \`release/*\`). Only a human engineer may approve or merge.
9507
+ 2. **FORBIDDEN TO INVENT PRODUCT OR ARCHITECTURE DECISIONS**: When facing ambiguous requirements, formulate clarifying questions (\`open-questions\`). Never assume unspecified intentions.
9508
+ 3. **FORBIDDEN TO INTRODUCE DEPENDENCIES WITHOUT LICENSE INSPECTION**: Always consult \`license-policy.yaml\`. Dependencies with viral licenses (\`GPL\`/\`AGPL\`) or commercial paid licenses (\`BSL\`/\`SSPL\`) are strictly forbidden without authorization.
9509
+ 4. **FORBIDDEN TO IGNORE CYBERSECURITY (SECURITY-BY-DEFAULT)**: Validate inputs, sanitize data, and add mitigation tests (\`SEC-TEST-*\`). Disabling linters or suppressing typing errors is prohibited.
9510
+ 5. **MANDATORY CRYPTOGRAPHIC CITATION**: Every derived artifact must cite upstream artifacts using canonical identifiers and their Unix LF-normalized SHA-256 cryptographic hashes.
9511
+
9512
+ ---
9513
+
9514
+ ## 2. Specialized Roles Mapping
9515
+
9516
+ ### 1. \`agent-product-analyst\` (Product Analyst / Scribe)
9517
+ - **Mission**: Assist in defining and refining the product model using ProductShape.
9518
+ - **Input**: Business intent or natural language specification.
9519
+ - **Output**: Markdown artifacts with YAML frontmatter compliant with \`schemas/product/\` (\`ACT-*\`, \`UC-*\`, \`FR-*\`, \`QR-*\`, \`BR-*\`).
9520
+ - **Guardrails**:
9521
+ - \`status\` always starts in \`draft\`.
9522
+ - In \`UC-*\`, format section \`1. Intent and Outcome\` under the standard English structure: \`As a <ACT-ID>... I want <action>... To <outcome>...\`.
9523
+ - Mandatory Gherkin criteria with \`@<ID> @automated @regression\`.
9524
+ - Run \`pnpm run verify:schemas\` and \`pnpm run verify:duplicates\` before delivering the draft.
9525
+
9526
+ ### 2. \`agent-threat-modeler\` (Threat Modeler and Security Specialist)
9527
+ - **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.
9528
+ - **Input**: Use cases \`UC-*\`, functional requirements \`FR-*\`, or architecture components (\`CMP-*\`, Mermaid diagrams, ADRs).
9529
+ - **Output**: Cybersecurity triad (\`ACT-THREAT-*\`, \`ABUSE-*\`, \`SEC-REQ-*\`) compliant with \`schemas/security/\`.
9530
+ - **Guardrails**:
9531
+ - \`status\` always starts in \`draft\`.
9532
+ - Negative BDD attack and rejection scenarios tagged with \`@security @mitigation\`.
9533
+ - Assignment of Zero Trust enclaves \`SEC-ENC-*\`.
9534
+
9535
+ ### 3. \`agent-system-architect\` (System Architect)
9536
+ - **Mission**: Translate the approved product definition into a modular technical architecture based on arc42 enriched with NAF v4.
9537
+ - **Output**: Architecture components (\`CMP-*\`), Mermaid diagrams, and immutable \`ADR-*\` records compliant with \`schemas/architecture/\`.
9538
+ - **Guardrails**:
9539
+ - Every \`CMP-*\` must declare \`satisfies-requirements\` linking \`FR-*\`, \`QR-*\`, and \`SEC-REQ-*\`.
9540
+ - Emit a return handoff to \`agent-threat-modeler\` in the technical security feedback loop when infrastructure or persistence decisions introduce new attack vectors.
9541
+
9542
+ ### 4. \`agent-qa-engineer\` (QA Engineer and SDET)
9543
+ - **Mission**: Translate approved requirements (\`FR-*\`, \`SEC-REQ-*\`, \`QR-*\`) into comprehensive FAILING (red) BDD/Gherkin test suites, before \`agent-developer\` writes production code.
9544
+ - **Input**: Approved requirements from the \`handoff.yaml\` sidecar (\`HOF-*\`).
9545
+ - **Output**: Failing Gherkin scenarios covering: nominal case, boundary cases, out-of-range cases, and conditional categories (security, performance, idempotency, postconditions, interface contract).
9546
+ - **Guardrails**:
9547
+ - FORBIDDEN to include production code or anticipate implementations.
9548
+ - Every \`FR-*\` must have at least nominal + boundary + out-of-range scenarios; missing these blocks handoff to \`agent-developer\`.
9549
+ - Mandatory tags: \`@<FR-ID> @automated @regression\`.
9550
+ - Run \`pnpm run verify:testing\` before emitting handoff.
9551
+
9552
+ ### 5. \`agent-developer\` (Software Developer)
9553
+ - **Mission**: Implement atomic tasks from SDD specifications (\`tasks.md\`) with clean, strictly typed code and thorough tests.
9554
+ - **Directives**:
9555
+ - Respect the autonomy mode assigned in \`tasks.md\` (\`AUTONOMOUS\`, \`HUMAN_REVIEW_PLAN\`, \`AMBIGUOUS\`, \`HIGH_RISK_MANUAL\`).
9556
+ - Make tests delivered by \`agent-qa-engineer\` pass green without altering them to accommodate code.
9557
+ - Respect \`quality-policy.yaml\` thresholds: CC $\\le 10$, Cognitive $\\le 15$, MI $\\ge 50$, LOC $\\le 40$.
9558
+ - Run pre-flight with auto-fix: \`pnpm run check:fix\` and full verification: \`pnpm run verify:all\`.
9559
+ - Upon completing green implementation, suggest handoff to \`agent-expert-user\` for post-development functional validation prior to security audit.
9560
+
9561
+ ### 6. \`agent-security-auditor\` (Adversarial Code Auditor)
9562
+ - **Mission**: Rigorously examine Pull Requests for business logic vulnerabilities, injection vectors, secret leaks, and authorization flaws as part of the Pre-Merge Audit Triad.
9563
+ - **Directives**:
9564
+ - Analyze code diffs with an attacker mindset and run \`pnpm run verify:security\`.
9565
+ - Issue findings with CVSS v3.1 severity scoring and block any PR introducing CRITICAL or HIGH security risks.
9566
+
9567
+ ### 7. \`agent-compliance-checker\` (Open Source License Compliance Auditor)
9568
+ - **Mission**: Audit dependency manifests and ensure every direct and transitive third-party package complies with \`license-policy.yaml\` as part of the Pre-Merge Audit Triad.
9569
+ - **Directives**:
9570
+ - Verify SPDX identifiers via \`pnpm run verify:licenses\`, immediately blocking viral (\`GPL\`, \`AGPL\`) or unapproved commercial (\`BSL\`, \`SSPL\`) licenses.
9571
+
9572
+ ### 8. \`agent-expert-user\` (Expert User and Domain Evaluator)
9573
+ - **Mission**: Contrast design and specifications (design phase) and functionally validate finished software against \`UC-*\` and \`FR-*\` (post-development phase).
9574
+ - **Directives**:
9575
+ - 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\`).
9576
+ - Functional validation mode (downstream / pre-PR / post-development functional validation): Thoroughly contrast interface and actual CLI execution against \`UC-*\` and \`FR-*\` acceptance criteria before pre-merge security audit.
9577
+ - Emit handoff block suggesting \`agent-code-reviewer\` / \`agent-security-auditor\` if compliant, or return to \`agent-developer\` on functional drift.
9578
+
9579
+ ### 9. \`agent-code-reviewer\` (Technical and Architectural Code Reviewer)
9580
+ - **Mission**: Audit Pull Requests evaluating code cleanliness, adherence to SOLID, DRY, YAGNI principles, design patterns, and respect for complexity and maintainability thresholds (\`quality-policy.yaml\`), forming part of the Pre-Merge Audit Triad.
9581
+ - **Directives**:
9582
+ - Respect \`quality-policy.yaml\` thresholds: CC $\\le 10$, Cognitive $\\le 15$, MI $\\ge 50$, LOC $\\le 40$.
9583
+ - Detect improper coupling, code smells, magic numbers, ambiguous names, and encapsulation violations.
9584
+ - Flag premature abstractions and speculative code violating YAGNI.
9585
+ - Coordinate Pre-Merge Audit Triad with \`agent-security-auditor\` and \`agent-compliance-checker\`.
9586
+ - Classify findings into: \`[BLOCKING]\` (quality violation or broken pattern), \`[CLEAN_CODE_SUGGESTION]\` (non-blocking improvement), and \`[COMPLIANT]\`.
9587
+
9588
+ ### 10. \`agent-devops\` (Automation and Infrastructure Engineer)
9589
+ - **Mission**: Maintain, evolve, and audit automated project infrastructure: CI/CD workflows, Docker containers, IaC manifests, and support scripts.
9590
+ - **Directives**:
9591
+ - Strict infrastructure domain: Operates exclusively in \`.github/workflows/\`, \`Dockerfile*\`, \`docker-compose*.yml\`, IaC manifests, and \`scripts/\`.
9592
+ - **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.
9593
+ - Infrastructure dependency policy: Verify licenses of dependencies, base images, and third-party actions according to \`license-policy.yaml\`.
9594
+ - Gate preservation: Ensure pipeline optimizations preserve all existing deterministic Quality Gates intact.
9595
+
9596
+ ---
9597
+
9598
+ ## 3. Git 4-Tier Hierarchy and Commit Conventions
9599
+ - \`task/<PARENT-ID>/<TSK-ID>-<slug>\` $\\rightarrow$ \`feat/<FEAT-ID>-<slug>\` $\\rightarrow$ \`release/vX.Y.Z\` $\\rightarrow$ \`main\`.
9600
+ - Mandatory commit trailers injection:
9601
+ \`\`\`text
9602
+ Author-Type: agent
9603
+ AI-Model: gemini-1.5-pro / gemini-2.0-flash
9604
+ Task-ID: TSK-XXX
9605
+ Change-ID: CHG-XXX
9606
+ \`\`\`
9607
+
9608
+ ---
9609
+
9610
+ ## 4. Workflow Handoff Protocol and Human Action Window | Ventana de Acci\xF3n Humana
9611
+ - **Conditional Activation Rule by Autonomy**:
9612
+ - \u{1F7E2} **\`AUTONOMOUS\`** (or exclusive final supervision in PR/CI): **OMITTED**. Do not request or emit interactive handoff to avoid interrupting unattended execution.
9613
+ - \u{1F7E1} **Autonomy $\\ge$ \`HUMAN_REVIEW_PLAN\`** (\`HUMAN_REVIEW_PLAN\`, \`AMBIGUOUS\`, \`HIGH_RISK_MANUAL\`): **MANDATORY**. Emit the Workflow Handoff block compliant with [\`templates/workflow/agent-handoff.template.md\`](../../templates/workflow/agent-handoff.template.md) and **STOP**.
9614
+ - **Block Contents**: Declare produced deliverables, recommend the next role in workflow (\`agent-threat-modeler\`, \`agent-system-architect\`, \`agent-qa-engineer\`, \`agent-developer\`, \`agent-expert-user\`, \`agent-code-reviewer\`, \`agent-security-auditor\`, \`agent-compliance-checker\`, \`agent-devops\`, etc.), provide suggested invocation prompt, and keep **the Human Action Window open at all times for the human user to take action** (review, edit by hand, pause/reroute, or delegate).
9264
9615
  `;
9265
9616
  var STARTER_CURSOR_CORE_RULES = `---
9266
- description: Canonical global directives, 5 unbreakable commandments, and AI-SDLC preflight
9617
+ description: Global canonical directives, 5 unbreakable commandments, and AI-SDLC pre-flight
9267
9618
  globs: *
9268
9619
  alwaysApply: true
9269
9620
  ---
9270
9621
 
9271
9622
  # Global AI-SDLC Rules (Core)
9272
9623
 
9273
- Canonical reference: [\`process/09_agent_protocols.md\`](process/09_agent_protocols.md) and [\`process/01_governance_and_roles.md\`](process/01_governance_and_roles.md).
9624
+ Canonical Reference: [\`process/09_agent_protocols.md\`](process/09_agent_protocols.md) and [\`process/01_governance_and_roles.md\`](process/01_governance_and_roles.md).
9274
9625
 
9275
- ## 1. The 5 Unbreakable Commandments for Agents
9276
- Any agent operating in this repository must strictly adhere to the following guardrails:
9277
- 1. **NO AUTO-APPROVE OR AUTO-MERGE**: Do not approve PRs or perform direct merges to protected branches (\`main\`, \`release/*\`). Approval is exclusively reserved for human reviewers.
9278
- 2. **NO INVENTING PRODUCT OR ARCHITECTURAL DECISIONS**: When facing ambiguity, ask open questions (\`open-questions\`). Do not assume undocumented requirements.
9279
- 3. **NO INTRODUCING DEPENDENCIES WITHOUT LICENSE INSPECTION**: Always check \`license-policy.yaml\`. Viral (GPL/AGPL) or paid commercial (BSL/SSPL) dependencies are prohibited without explicit approval.
9280
- 4. **NO IGNORING CYBERSECURITY (SECURITY-BY-DEFAULT)**: Validate inputs, apply least privilege, and accompany every change with security tests (\`SEC-TEST-*\`). Suppressing linters or tests to force a green pipeline is prohibited.
9281
- 5. **MANDATORY CRYPTOGRAPHIC CITATION**: Link specifications using immutable identifiers and normalized SHA-256 hashes (Unix LF).
9626
+ ## 1. The 5 Unbreakable Commandments of Agents | Los 5 Mandamientos Inquebrantables de los Agentes
9627
+ Every agent operating in this repository must strictly observe the following guardrails:
9628
+ 1. **FORBIDDEN TO AUTO-APPROVE OR AUTO-MERGE | PROHIBIDO AUTO-APROBAR O AUTO-FUSIONAR**: Do not approve PRs or execute direct merges to protected branches (\`main\`, \`release/*\`). Approval is exclusively reserved for human reviewers.
9629
+ 2. **FORBIDDEN TO INVENT PRODUCT OR ARCHITECTURE DECISIONS**: When facing ambiguity, formulate open questions (\`open-questions\`). Never assume undocumented requirements.
9630
+ 3. **FORBIDDEN TO INTRODUCE DEPENDENCIES WITHOUT LICENSE INSPECTION**: Always verify \`license-policy.yaml\`. Viral dependencies (GPL/AGPL) or commercial paid dependencies (BSL/SSPL) are strictly forbidden without explicit human approval.
9631
+ 4. **FORBIDDEN TO IGNORE CYBERSECURITY (SECURITY-BY-DEFAULT)**: Validate inputs, apply least privilege, and accompany every change with security tests (\`SEC-TEST-*\`). Suppressing linters or tests to force a green pipeline is prohibited.
9632
+ 5. **MANDATORY CRYPTOGRAPHIC CITATION**: Link specifications using immutable identifiers and Unix LF-normalized SHA-256 hashes.
9282
9633
 
9283
- ## 2. Preflight Verification Commands
9634
+ ## 2. Pre-Flight Verification Commands
9284
9635
  Before finalizing changes or proposing commits:
9285
- - Preflight with auto-fix: \`pnpm run check:fix\` (or \`npx aisdlc check --fix\`)
9636
+ - Pre-flight with auto-fix: \`pnpm run check:fix\` (or \`npx aisdlc check --fix\`)
9286
9637
  - Full verification: \`pnpm run verify:all\` (or \`npx aisdlc verify all\`)
9287
9638
  - Unit tests: \`pnpm test\`
9288
9639
  - Strict typing: \`pnpm run typecheck\`
9289
9640
 
9290
- ## 3. 4-Tier Git Hierarchy
9641
+ ## 3. Git 4-Tier Hierarchy
9291
9642
  - Tier 1: \`main\` (Production)
9292
9643
  - Tier 2: \`release/vX.Y.Z\` (Frozen release)
9293
9644
  - Tier 3: \`feat/<FEAT-ID>-<slug>\` / \`bug/<BUG-ID>-<slug>\` (Feature)
9294
9645
  - Tier 4: \`task/<PARENT-ID>/<TSK-ID>-<slug>\` (Atomic task)
9295
9646
 
9296
- ## 4. Workflow Handoff Protocol and Human Action Window
9647
+ ## 4. Specialized Roles Mapping
9648
+ | Role | Mission (summary) |
9649
+ | :--- | :--- |
9650
+ | \`agent-product-analyst\` | ProductShape artifacts (\`ACT-*\`, \`UC-*\`, \`FR-*\`, \`QR-*\`, \`BR-*\`); status starts \`draft\`. |
9651
+ | \`agent-threat-modeler\` | STRIDE/OWASP threat triad (\`ACT-THREAT-*\`, \`ABUSE-*\`, \`SEC-REQ-*\`). |
9652
+ | \`agent-system-architect\` | Modular arc42 + NAF v4 architecture (\`CMP-*\`, Mermaid diagrams, \`ADR-*\`). |
9653
+ | \`agent-qa-engineer\` | FAILING BDD/Gherkin suites before \`agent-developer\` writes code. |
9654
+ | \`agent-developer\` | Atomic tasks from \`tasks.md\`; respects autonomy mode; runs \`pnpm run check:fix\` + \`pnpm run verify:all\`. |
9655
+ | \`agent-security-auditor\` | Adversarial PR security audit, SAST, secrets, and CVSS v3.1 evaluation. |
9656
+ | \`agent-compliance-checker\` | SPDX license compliance audit against \`license-policy.yaml\`. |
9657
+ | \`agent-expert-user\` | Bimodal MVP evaluation (design) and functional validation against \`UC-*\` and \`FR-*\` (pre-PR). |
9658
+ | \`agent-code-reviewer\` | PR audit (SOLID, DRY, YAGNI): \`[BLOCKING]\` / \`[CLEAN_CODE_SUGGESTION]\` / \`[COMPLIANT]\`. |
9659
+ | \`agent-devops\` | CI/CD, Docker, IaC only \u2014 **FORBIDDEN** to touch \`src/\` or \`packages/*/src/\`. |
9660
+
9661
+ ## 5. Task Autonomy Modes (\`tasks.md\`)
9662
+ - \u{1F7E2} **\`AUTONOMOUS\`**: Low risk. Implement directly, omit handoff block.
9663
+ - \u{1F7E1} **\`HUMAN_REVIEW_PLAN\`**: Medium risk. Emit Workflow Handoff block, wait for approval.
9664
+ - \u{1F7E0} **\`AMBIGUOUS\`**: Blocked. Request human clarification.
9665
+ - \u{1F534} **\`HIGH_RISK_MANUAL\`**: Critical risk. Human-only execution.
9666
+
9667
+ ## 6. Workflow Handoff Protocol and Human Action Window | Ventana de Acci\xF3n Humana
9297
9668
  - **Conditional Activation**:
9298
9669
  * \u{1F7E2} **\`AUTONOMOUS\`** (or PR/CI supervision): **OMITTED**. Do not request or emit interactive handoff.
9299
- * \u{1F7E1} **Autonomy $\\ge$ \`HUMAN_REVIEW_PLAN\`** (\`HUMAN_REVIEW_PLAN\`, \`AMBIGUOUS\`, \`HIGH_RISK_MANUAL\`): **MANDATORY**. Emit Workflow Handoff block conforming to [\`templates/workflow/agent-handoff.template.md\`](templates/workflow/agent-handoff.template.md) and **HALT**.
9300
- - **Contents**: Declare completed deliverables, recommend next role(s), provide suggested invocation prompt, and **keep the window open for the human user to take action** (review, manually edit, pause/divert, or delegate).
9670
+ * \u{1F7E1} **Autonomy $\\ge$ \`HUMAN_REVIEW_PLAN\`** (\`HUMAN_REVIEW_PLAN\`, \`AMBIGUOUS\`, \`HIGH_RISK_MANUAL\`): **MANDATORY**. Emit Workflow Handoff block compliant with [\`templates/workflow/agent-handoff.template.md\`](templates/workflow/agent-handoff.template.md) and **STOP**.
9671
+ - **Content**: Declare completed deliverables, recommend next role(s), provide suggested invocation prompt, and **keep the Human Action Window open for the human user to take action** (review, edit by hand, pause/reroute, or delegate).
9301
9672
  `;
9302
9673
  var STARTER_CURSOR_PRODUCT_RULES = `---
9303
9674
  description: Directives for SDD specifications editing, ProductShape artifacts, and Cybersecurity
9304
- globs: specs/**, templates/**
9675
+ globs: specs/**, templates/**, product/**, security/**
9305
9676
  alwaysApply: false
9306
9677
  ---
9307
9678
 
9308
9679
  # Product and SDD Specification Directives
9309
9680
 
9310
- Canonical reference: [\`process/09_agent_protocols.md\`](process/09_agent_protocols.md) and [\`process/02_product_definition.md\`](process/02_product_definition.md).
9681
+ Canonical Reference: [\`process/09_agent_protocols.md\`](process/09_agent_protocols.md) and [\`process/02_product_definition.md\`](process/02_product_definition.md).
9311
9682
 
9312
9683
  ## 1. Identifier Taxonomy and JSON Schemas
9313
9684
  Every generated or modified artifact must follow canonical naming and satisfy its schema in \`schemas/\`:
@@ -9335,7 +9706,7 @@ alwaysApply: false
9335
9706
 
9336
9707
  # Code Quality and Architecture Directives
9337
9708
 
9338
- Canonical reference: [\`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).
9709
+ Canonical Reference: [\`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).
9339
9710
 
9340
9711
  ## 1. Non-Negotiable Quality Thresholds (\`quality-policy.yaml\`)
9341
9712
  - **Cyclomatic Complexity (CC)**: $\\le 10$ per function (warning alert if $> 7$).
@@ -9357,159 +9728,229 @@ Canonical reference: [\`process/09_agent_protocols.md\`](process/09_agent_protoc
9357
9728
  ## 4. Structured Output \`--json\`
9358
9729
  - Any extension to CLI commands must preserve compatibility with the \`--json\` flag and suppress ANSI escape codes when this flag is present.
9359
9730
  `;
9360
- var STARTER_CLAUDE_RULES = `# Claude Code Instructions - AI-SDLC Monorepo\r
9361
- \r
9362
- Canonical reference: [\`process/09_agent_protocols.md\`](process/09_agent_protocols.md) and [\`process/01_governance_and_roles.md\`](process/01_governance_and_roles.md).\r
9363
- \r
9364
- This repository implements the **AI-SDLC** framework (Spec-Driven Development, deterministic quality governance, and OSS license compliance for human-agent collaboration).\r
9365
- \r
9366
- ---\r
9367
- \r
9368
- ## 1. The 5 Unbreakable Commandments for Agents\r
9369
- \r
9370
- 1. **NO AUTO-APPROVE OR AUTO-MERGE**: Never approve PRs or merge directly to \`main\` or protected branches. Approval is exclusively human.\r
9371
- 2. **NO INVENTING PRODUCT OR ARCHITECTURAL DECISIONS**: When facing ambiguous requirements, ask open questions (\`open-questions\`). Do not assume undocumented behavior.\r
9372
- 3. **NO INTRODUCING DEPENDENCIES WITHOUT LICENSE INSPECTION**: Always validate SPDX identifier against \`license-policy.yaml\`. Viral libraries (\`GPL\`/\`AGPL\`) or paid commercial licenses (\`BSL\`/\`SSPL\`) are prohibited without formal approval.\r
9373
- 4. **NO IGNORING CYBERSECURITY (SECURITY-BY-DEFAULT)**: Validate inputs, sanitize data, and include mitigation tests (\`SEC-TEST-*\`). Disabling linters or suppressing typing errors (\`any\`, \`@ts-ignore\`) is prohibited.\r
9374
- 5. **MANDATORY CRYPTOGRAPHIC CITATION**: Every spec or sidecar must include immutable identifiers and normalized SHA-256 digests (Unix LF).\r
9375
- \r
9376
- ---\r
9377
- \r
9378
- ## 2. Essential Execution and Preflight Commands\r
9379
- \r
9380
- \`\`\`bash\r
9381
- # 1. Preflight with deterministic auto-fix (Gherkin & SHA-256 digests)\r
9382
- pnpm run check:fix\r
9383
- \r
9384
- # 2. Full verification of all Quality Gates (Quality, RTM, Governance, Testing, Licenses, PDaC, Schemas, Duplicates, Security)\r
9385
- pnpm run verify:all\r
9386
- \r
9387
- # 3. Complete automated test suite (Vitest)\r
9388
- pnpm test\r
9389
- \r
9390
- # 4. Strict TypeScript typecheck\r
9391
- pnpm run typecheck\r
9392
- \r
9393
- # 5. Scaffolding for a new SDD change\r
9394
- pnpm run change:new <name> --id <chg-id>\r
9395
- \r
9396
- # 6. Canonical integration of a completed SDD change\r
9397
- npx tsx packages/cli/src/index.ts sdd integrate --change <chg-id>\r
9398
- \`\`\`\r
9399
- \r
9400
- ---\r
9401
- \r
9402
- ## 3. Git Workflow and Commit Rules with Trailers\r
9403
- \r
9404
- ### 4-Tier Hierarchy\r
9405
- 1. **Tier 1 (\`main\`)**: Absolute production stability.\r
9406
- 2. **Tier 2 (\`release/vX.Y.Z\`)**: Release stabilization.\r
9407
- 3. **Tier 3 (\`feat/<FEAT-ID>-<slug>\` or \`bug/<BUG-ID>-<slug>\`)**: SDD delivery increment.\r
9408
- 4. **Tier 4 (\`task/<PARENT-ID>/<TSK-ID>-<slug>\`)**: Atomic implementation task.\r
9409
- \r
9410
- ### Commit Format (Conventional Commits + Git Trailers)\r
9411
- \`\`\`text\r
9412
- feat(scope): concise imperative description (#issue)\r
9413
- \r
9414
- Body explaining technical motivation and justification.\r
9415
- \r
9416
- Author-Type: agent\r
9417
- AI-Model: claude-3-7-sonnet\r
9418
- Task-ID: TSK-001\r
9419
- Change-ID: CHG-026-AGENT-NATIVE-CONFIGS\r
9420
- \`\`\`\r
9421
- \r
9422
- ---\r
9423
- \r
9424
- ## 4. Non-Negotiable Quality Thresholds (\`quality-policy.yaml\`)\r
9425
- - **Cyclomatic Complexity (CC)**: $\\le 10$\r
9426
- - **Cognitive Complexity**: $\\le 15$\r
9427
- - **Maintainability Index (MI)**: $\\ge 50$\r
9428
- - **Lines per Function**: $\\le 40$\r
9429
- - Deterministic CLI output: all \`verify\` commands support \`--json\` without ANSI escape codes.\r
9430
- \r
9431
- ---\r
9432
- \r
9433
- ## 5. Workflow Handoff Protocol and Human Action Window\r
9434
- - **Conditional Activation**:\r
9435
- - \u{1F7E2} **\`AUTONOMOUS\`** (or PR/CI supervision): **OMITTED**. Uninterrupted execution.\r
9436
- - \u{1F7E1} **Autonomy $\\ge$ \`HUMAN_REVIEW_PLAN\`** (\`HUMAN_REVIEW_PLAN\`, \`AMBIGUOUS\`, \`HIGH_RISK_MANUAL\`): **MANDATORY**. Emit Workflow Handoff block ([\`templates/workflow/agent-handoff.template.md\`](templates/workflow/agent-handoff.template.md)) and **HALT**.\r
9437
- - **Contents**: Completed deliverables, suggested next role(s), copy-ready prompt, and **open window for the user to take action** (review, manually edit, pause/divert, or delegate).\r
9438
- \r
9731
+ var STARTER_CLAUDE_RULES = `# Claude Code Instructions - AI-SDLC Monorepo
9732
+
9733
+ Canonical Reference: [\`process/09_agent_protocols.md\`](process/09_agent_protocols.md) and [\`process/01_governance_and_roles.md\`](process/01_governance_and_roles.md).
9734
+
9735
+ This repository implements the **AI-SDLC** framework (Spec-Driven Development, deterministic quality governance, and OSS license compliance for human-agent collaboration).
9736
+
9737
+ ---
9738
+
9739
+ ## 1. The 5 Unbreakable Commandments of Agents | Los 5 Mandamientos Inquebrantables de los Agentes
9740
+
9741
+ 1. **FORBIDDEN TO AUTO-APPROVE OR AUTO-MERGE | PROHIBIDO AUTO-APROBAR O AUTO-FUSIONAR**: Never approve PRs or merge directly to \`main\` or protected branches. Approval is exclusively a human prerogative.
9742
+ 2. **FORBIDDEN TO INVENT PRODUCT OR ARCHITECTURE DECISIONS**: When facing ambiguous requirements, formulate open questions (\`open-questions\`). Never assume undocumented behaviors.
9743
+ 3. **FORBIDDEN TO INTRODUCE DEPENDENCIES WITHOUT LICENSE INSPECTION**: Always validate the SPDX identifier against \`license-policy.yaml\`. Viral libraries (\`GPL\`/\`AGPL\`) or paid commercial libraries (\`BSL\`/\`SSPL\`) are strictly forbidden without formal human approval.
9744
+ 4. **FORBIDDEN TO IGNORE CYBERSECURITY (SECURITY-BY-DEFAULT)**: Validate inputs, sanitize data, and include mitigation tests (\`SEC-TEST-*\`). Disabling linters or suppressing typing errors (\`any\`, \`@ts-ignore\`) is prohibited.
9745
+ 5. **MANDATORY CRYPTOGRAPHIC CITATION**: Every spec or sidecar must cite immutable identifiers and Unix LF-normalized SHA-256 digests.
9746
+
9747
+ ---
9748
+
9749
+ ## 2. Essential Execution and Pre-Flight Commands
9750
+
9751
+ \`\`\`bash
9752
+ # 1. Pre-flight with deterministic auto-fix (Gherkin & SHA-256 digests)
9753
+ pnpm run check:fix
9754
+
9755
+ # 2. Complete verification across all Quality Gates (Quality, RTM, Governance, Testing, Licenses, PDaC, Schemas, Duplicates, Security)
9756
+ pnpm run verify:all
9757
+
9758
+ # 3. Complete automated test suite (Vitest)
9759
+ pnpm test
9760
+
9761
+ # 4. Strict TypeScript typechecking
9762
+ pnpm run typecheck
9763
+
9764
+ # 5. Scaffolding for a new SDD change
9765
+ pnpm run change:new <name> --id <chg-id>
9766
+
9767
+ # 6. Canonical integration of a completed SDD change
9768
+ npx tsx packages/cli/src/index.ts sdd integrate --change <chg-id>
9769
+ \`\`\`
9770
+
9771
+ ---
9772
+
9773
+ ## 3. Specialized Roles Mapping
9774
+
9775
+ ### 1. \`agent-product-analyst\` (Product Analyst / Scribe)
9776
+ - **Mission**: Assist in defining and refining the product model using ProductShape.
9777
+ - **Input**: Business intent or natural language specification.
9778
+ - **Output**: Markdown artifacts with YAML frontmatter compliant with \`schemas/product/\` (\`ACT-*\`, \`UC-*\`, \`FR-*\`, \`QR-*\`, \`BR-*\`).
9779
+ - **Guardrails**: \`status\` always starts in \`draft\`. Mandatory Gherkin criteria with \`@<ID> @automated @regression\`.
9780
+
9781
+ ### 2. \`agent-threat-modeler\` (Threat Modeler and Security Specialist)
9782
+ - **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.
9783
+ - **Output**: Cybersecurity triad (\`ACT-THREAT-*\`, \`ABUSE-*\`, \`SEC-REQ-*\`) compliant with \`schemas/security/\`.
9784
+
9785
+ ### 3. \`agent-system-architect\` (System Architect)
9786
+ - **Mission**: Translate the approved product definition into a modular technical architecture based on arc42 enriched with NAF v4 (\`CMP-*\`, Mermaid diagrams, \`ADR-*\`).
9787
+ - **Guardrails**: Declare \`satisfies-requirements\` on every \`CMP-*\` and trigger the technical security feedback loop toward \`agent-threat-modeler\` when infrastructure decisions introduce new attack vectors.
9788
+
9789
+ ### 4. \`agent-qa-engineer\` (QA Engineer and SDET)
9790
+ - **Mission**: Translate approved requirements (\`FR-*\`, \`SEC-REQ-*\`, \`QR-*\`) into comprehensive FAILING (red) BDD/Gherkin test suites, before \`agent-developer\` writes production code.
9791
+ - **Guardrails**: FORBIDDEN to include production code. Mandatory tags: \`@<FR-ID> @automated @regression\`.
9792
+
9793
+ ### 5. \`agent-developer\` (Software Developer)
9794
+ - **Mission**: Implement atomic tasks from SDD specifications (\`tasks.md\`) with clean, strictly typed code and thorough tests.
9795
+ - **Directives**: Respect the autonomy mode. Make tests delivered by \`agent-qa-engineer\` pass green. Run \`pnpm run check:fix\` and \`pnpm run verify:all\`.
9796
+
9797
+ ### 6. \`agent-security-auditor\` (Adversarial Code Auditor)
9798
+ - **Mission**: Examine Pull Requests for business logic vulnerabilities, injection vectors, secret leaks, and authorization flaws as part of the Pre-Merge Audit Triad.
9799
+ - **Directives**: Run \`pnpm run verify:security\`, evaluate CVSS v3.1 severity, and block CRITICAL/HIGH risks.
9800
+
9801
+ ### 7. \`agent-compliance-checker\` (Open Source License Compliance Auditor)
9802
+ - **Mission**: Audit dependency manifests against \`license-policy.yaml\` as part of the Pre-Merge Audit Triad.
9803
+ - **Directives**: Run \`pnpm run verify:licenses\`, blocking viral (\`GPL\`, \`AGPL\`) or unapproved commercial (\`BSL\`, \`SSPL\`) packages.
9804
+
9805
+ ### 8. \`agent-expert-user\` (Expert User and Domain Evaluator)
9806
+ - **Mission**: Contrast design and specifications (design phase) and functionally validate finished software against \`UC-*\` and \`FR-*\` (post-development functional validation phase).
9807
+
9808
+ ### 9. \`agent-code-reviewer\` (Technical and Architectural Code Reviewer)
9809
+ - **Mission**: Audit Pull Requests evaluating code cleanliness, adherence to SOLID, DRY, YAGNI principles, and respect for \`quality-policy.yaml\` thresholds, forming part of the Pre-Merge Audit Triad.
9810
+ - **Findings classification**: \`[BLOCKING]\`, \`[CLEAN_CODE_SUGGESTION]\`, \`[COMPLIANT]\`.
9811
+
9812
+ ### 10. \`agent-devops\` (Automation and Infrastructure Engineer)
9813
+ - **Mission**: Maintain, evolve, and audit automated project infrastructure: CI/CD workflows, Docker containers, IaC manifests, and support scripts.
9814
+ - **NON-INVASION GUARDRAIL**: STRICTLY FORBIDDEN from modifying application source code (\`src/\`, \`packages/*/src/\`).
9815
+
9816
+ ---
9817
+
9818
+ ## 4. Task Autonomy Modes (\`tasks.md\`)
9819
+
9820
+ - \u{1F7E2} **\`AUTONOMOUS\`**: Low risk, isolated task. Implement code and tests directly. Omit interactive handoff block.
9821
+ - \u{1F7E1} **\`HUMAN_REVIEW_PLAN\`**: Medium risk. Design detailed plan, emit Workflow Handoff block, and wait for human confirmation before coding.
9822
+ - \u{1F7E0} **\`AMBIGUOUS\`**: Incomplete requirements. Blocked: request human clarification.
9823
+ - \u{1F534} **\`HIGH_RISK_MANUAL\`**: Critical risk (migrations, cryptography). Direct manual execution by humans only.
9824
+
9825
+ ---
9826
+
9827
+ ## 5. Git Workflow and Commit Rules with Trailers
9828
+
9829
+ ### 4-Tier Hierarchy
9830
+ 1. **Tier 1 (\`main\`)**: Absolute stability and production readiness.
9831
+ 2. **Tier 2 (\`release/vX.Y.Z\`)**: Release stabilization.
9832
+ 3. **Tier 3 (\`feat/<FEAT-ID>-<slug>\` or \`bug/<BUG-ID>-<slug>\`)**: SDD delivery increment.
9833
+ 4. **Tier 4 (\`task/<PARENT-ID>/<TSK-ID>-<slug>\`)**: Atomic implementation task.
9834
+
9835
+ ### Commit Format (Conventional Commits + Git Trailers)
9836
+ \`\`\`text
9837
+ feat(scope): concise imperative description (#issue)
9838
+
9839
+ Body explaining the motivation and technical justification of the change.
9840
+
9841
+ Author-Type: agent
9842
+ AI-Model: claude-3-7-sonnet
9843
+ Task-ID: TSK-001
9844
+ Change-ID: CHG-026-AGENT-NATIVE-CONFIGS
9845
+ \`\`\`
9846
+
9847
+ ---
9848
+
9849
+ ## 6. Non-Negotiable Quality Thresholds (\`quality-policy.yaml\`)
9850
+ - **Cyclomatic Complexity (CC)**: $\\le 10$
9851
+ - **Cognitive Complexity**: $\\le 15$
9852
+ - **Maintainability Index (MI)**: $\\ge 50$
9853
+ - **Lines per Function**: $\\le 40$
9854
+ - Deterministic CLI output: every \`verify\` command supports \`--json\` without ANSI escape codes.
9855
+
9856
+ ---
9857
+
9858
+ ## 7. Workflow Handoff Protocol and Human Action Window | Ventana de Acci\xF3n Humana
9859
+ - **Conditional Activation**:
9860
+ - \u{1F7E2} **\`AUTONOMOUS\`** (or PR/CI final supervision): **OMITTED**. Uninterrupted continuous execution.
9861
+ - \u{1F7E1} **Autonomy $\\ge$ \`HUMAN_REVIEW_PLAN\`** (\`HUMAN_REVIEW_PLAN\`, \`AMBIGUOUS\`, \`HIGH_RISK_MANUAL\`): **MANDATORY**. Emit Workflow Handoff block ([\`templates/workflow/agent-handoff.template.md\`](templates/workflow/agent-handoff.template.md)) and **STOP**.
9862
+ - **Content**: Completed deliverables, suggested next role(s), copy-paste ready invocation prompt, and **an open Human Action Window for the user to take action** (review, edit by hand, pause/reroute, or delegate).
9439
9863
  `;
9440
- var STARTER_COPILOT_RULES = `<!--\r
9441
- AI-SDLC: Canonical Instructions for GitHub Copilot (Chat & Workspace)\r
9442
- Canonical reference: process/09_agent_protocols.md and process/01_governance_and_roles.md\r
9443
- -->\r
9444
- \r
9445
- # GitHub Copilot Instructions - AI-SDLC Framework\r
9446
- \r
9447
- You operate as an assistant agent in the **AI-SDLC** repository. You are not a mere text autocompleter: you are a specialized technical worker subject to normative guidelines, deterministic autonomy boundaries, and strict traceability.\r
9448
- \r
9449
- ---\r
9450
- \r
9451
- ## 1. The 5 Unbreakable Commandments for Agents\r
9452
- \r
9453
- 1. **NO AUTO-APPROVE OR AUTO-MERGE**:\r
9454
- - Never execute PR approvals or direct merges to stable branches (\`main\`, \`release/*\`). Approval is an exclusive human prerogative.\r
9455
- 2. **NO INVENTING PRODUCT OR ARCHITECTURAL DECISIONS**:\r
9456
- - When a requirement is ambiguous or incomplete, ask open questions (\`open-questions\`) to the human user. Guessing undocumented intent is forbidden.\r
9457
- 3. **NO INTRODUCING DEPENDENCIES WITHOUT LICENSE INSPECTION**:\r
9458
- - Before suggesting or adding dependencies to manifests (\`package.json\`, etc.), validate their SPDX identifier against \`license-policy.yaml\`. Adding viral (\`GPL\`, \`AGPL\`) or paid commercial licenses (\`BSL\`, \`SSPL\`) without human authorization is prohibited.\r
9459
- 4. **NO IGNORING CYBERSECURITY (SECURITY-BY-DEFAULT)**:\r
9460
- - All code must apply the principle of least privilege, sanitize external inputs, and be accompanied by mitigation tests (\`SEC-TEST-*\`). Suppressing types (\`any\`), linters, or tests to force a green light is prohibited.\r
9461
- 5. **MANDATORY CRYPTOGRAPHIC CITATION**:\r
9462
- - Every specification, design, or sidecar must reference canonical identifiers and their normalized SHA-256 digests (Unix LF).\r
9463
- \r
9464
- ---\r
9465
- \r
9466
- ## 2. 4-Tier Git Branch Hierarchy\r
9467
- \r
9468
- When proposing or creating work branches, adhere strictly to the hierarchical structure:\r
9469
- - **Tier 1**: \`main\` (Protected production branch with maximum stability).\r
9470
- - **Tier 2**: \`release/vX.Y.Z\` (Release consolidation and scope freeze branch).\r
9471
- - **Tier 3**: \`feat/<FEAT-ID>-<slug>\` or \`bug/<BUG-ID>-<slug>\` (SDD feature or increment).\r
9472
- - **Tier 4**: \`task/<PARENT-ID>/<TSK-ID>-<slug>\` (Atomic development task).\r
9473
- \r
9474
- ---\r
9475
- \r
9476
- ## 3. Preflight Commands and Quality Gates\r
9477
- \r
9478
- Before concluding any intervention or suggesting a commit:\r
9479
- - **Unified preflight with auto-fix**: \`pnpm run check:fix\` (or \`npx aisdlc check --fix\`).\r
9480
- - **Full Quality Gates verification**: \`pnpm run verify:all\` (or \`npx aisdlc verify all\`).\r
9481
- - **Unit test suite**: \`pnpm test\`.\r
9482
- - **Strict typing**: \`pnpm run typecheck\`.\r
9483
- \r
9484
- Non-Negotiable Quality Thresholds (\`quality-policy.yaml\`):\r
9485
- - Cyclomatic Complexity (CC) $\\le 10$.\r
9486
- - Cognitive Complexity $\\le 15$.\r
9487
- - Maintainability Index (MI) $\\ge 50$.\r
9488
- - Maximum lines per function $\\le 40$.\r
9489
- \r
9490
- ---\r
9491
- \r
9492
- ## 4. Task Autonomy Modes (\`tasks.md\`)\r
9493
- \r
9494
- - \u{1F7E2} **\`AUTONOMOUS\`**: Low risk, isolated task. Implement code and tests directly. Omit interactive handoff block.\r
9495
- - \u{1F7E1} **\`HUMAN_REVIEW_PLAN\`**: Medium risk. Design the detailed plan, emit Workflow Handoff block, and wait for human confirmation before coding.\r
9496
- - \u{1F7E0} **\`AMBIGUOUS\`**: Incomplete requirements. Blocked: request human clarification.\r
9497
- - \u{1F534} **\`HIGH_RISK_MANUAL\`**: Critical risk (migrations, cryptography). Exclusive manual execution by humans.\r
9498
- \r
9499
- ---\r
9500
- \r
9501
- ## 5. Workflow Handoff Protocol and Human Action Window\r
9502
- - **Conditional Activation**:\r
9503
- * \u{1F7E2} **Mode \`AUTONOMOUS\`** (or PR/CI supervision): **OMITTED**. Do not interrupt unattended execution.\r
9504
- * \u{1F7E1} **Autonomy $\\ge$ \`HUMAN_REVIEW_PLAN\`** (\`HUMAN_REVIEW_PLAN\`, \`AMBIGUOUS\`, \`HIGH_RISK_MANUAL\`): **MANDATORY**. Emit Workflow Handoff block conforming to [\`templates/workflow/agent-handoff.template.md\`](../templates/workflow/agent-handoff.template.md) and **HALT**.\r
9505
- - **Components**: Declare completed deliverables, recommend next roles (\`agent-threat-modeler\`, \`agent-system-architect\`, \`agent-developer\`, \`agent-security-auditor\`), provide suggested invocation prompt, and **always keep the window open for the user to take action** (review, manually edit, pause/divert, or delegate).\r
9506
- \r
9507
- ---\r
9508
- \r
9509
- ## 6. Canonical Reference\r
9510
- To consult full protocols, specialized prompts, and interface contracts:\r
9511
- - [\`process/09_agent_protocols.md\`](../process/09_agent_protocols.md)\r
9512
- - [\`process/01_governance_and_roles.md\`](../process/01_governance_and_roles.md)\r
9864
+ var STARTER_COPILOT_RULES = `<!--
9865
+ AI-SDLC: Canonical Instructions for GitHub Copilot (Chat & Workspace)
9866
+ Canonical Reference: process/09_agent_protocols.md and process/01_governance_and_roles.md
9867
+ -->
9868
+
9869
+ # GitHub Copilot Instructions - AI-SDLC Framework
9870
+
9871
+ You operate as an assistant agent in the **AI-SDLC** repository. You are not a simple text auto-completer: you are a specialized technical worker subject to normative directives, deterministic autonomy boundaries, and strict traceability.
9872
+
9873
+ ---
9874
+
9875
+ ## 1. The 5 Unbreakable Commandments of Agents | Los 5 Mandamientos Inquebrantables de los Agentes
9876
+
9877
+ 1. **FORBIDDEN TO AUTO-APPROVE OR AUTO-MERGE | PROHIBIDO AUTO-APROBAR O AUTO-FUSIONAR**:
9878
+ - Never execute PR approvals or direct merges to stable branches (\`main\`, \`release/*\`). Approval is an exclusive human prerogative.
9879
+ 2. **FORBIDDEN TO INVENT PRODUCT OR ARCHITECTURE DECISIONS**:
9880
+ - If a requirement is ambiguous or incomplete, formulate open questions (\`open-questions\`) to the human user. Guessing undocumented intentions is forbidden.
9881
+ 3. **FORBIDDEN TO INTRODUCE DEPENDENCIES WITHOUT LICENSE INSPECTION**:
9882
+ - Before suggesting or adding dependencies to manifests (\`package.json\`, etc.), validate their SPDX identifier against \`license-policy.yaml\`. Adding viral (\`GPL\`, \`AGPL\`) or commercial paid (\`BSL\`, \`SSPL\`) licenses without human authorization is prohibited.
9883
+ 4. **FORBIDDEN TO IGNORE CYBERSECURITY (SECURITY-BY-DEFAULT)**:
9884
+ - All code must enforce least privilege, sanitize external inputs, and include mitigation tests (\`SEC-TEST-*\`). Suppressing types (\`any\`), linters, or tests to force a green pipeline is prohibited.
9885
+ 5. **MANDATORY CRYPTOGRAPHIC CITATION**:
9886
+ - Every specification, design, or sidecar must reference canonical identifiers and their Unix LF-normalized SHA-256 digests.
9887
+
9888
+ ---
9889
+
9890
+ ## 2. Git 4-Tier Branch Hierarchy
9891
+
9892
+ When proposing or creating branches, respect the strict hierarchical structure:
9893
+ - **Tier 1**: \`main\` (Protected production branch with maximum stability).
9894
+ - **Tier 2**: \`release/vX.Y.Z\` (Release consolidation and scope freeze branch).
9895
+ - **Tier 3**: \`feat/<FEAT-ID>-<slug>\` or \`bug/<BUG-ID>-<slug>\` (SDD increment or feature branch).
9896
+ - **Tier 4**: \`task/<PARENT-ID>/<TSK-ID>-<slug>\` (Atomic development task branch).
9897
+
9898
+ ---
9899
+
9900
+ ## 3. Pre-Flight Commands and Quality Gates
9901
+
9902
+ Before concluding any intervention or suggesting a commit:
9903
+ - **Unified pre-flight with auto-fix**: \`pnpm run check:fix\` (or \`npx aisdlc check --fix\`).
9904
+ - **Complete Quality Gates verification**: \`pnpm run verify:all\` (or \`npx aisdlc verify all\`).
9905
+ - **Unit test suite**: \`pnpm test\`.
9906
+ - **Strict typing**: \`pnpm run typecheck\`.
9907
+
9908
+ Non-Negotiable Quality Thresholds (\`quality-policy.yaml\`):
9909
+ - Cyclomatic Complexity (CC) $\\le 10$.
9910
+ - Cognitive Complexity $\\le 15$.
9911
+ - Maintainability Index (MI) $\\ge 50$.
9912
+ - Maximum lines per function $\\le 40$.
9913
+
9914
+ ---
9915
+
9916
+ ## 4. Task Autonomy Modes (\`tasks.md\`)
9917
+
9918
+ - \u{1F7E2} **\`AUTONOMOUS\`**: Low risk, isolated task. Implement code and tests directly. Omit interactive handoff block.
9919
+ - \u{1F7E1} **\`HUMAN_REVIEW_PLAN\`**: Medium risk. Design detailed plan, emit Workflow Handoff block, and wait for human confirmation before coding.
9920
+ - \u{1F7E0} **\`AMBIGUOUS\`**: Incomplete requirements. Blocked: request human clarification.
9921
+ - \u{1F534} **\`HIGH_RISK_MANUAL\`**: Critical risk (migrations, cryptography). Direct manual execution by humans only.
9922
+
9923
+ ---
9924
+
9925
+ ## 5. Workflow Handoff Protocol and Human Action Window | Ventana de Acci\xF3n Humana
9926
+ - **Conditional Activation**:
9927
+ * \u{1F7E2} **\`AUTONOMOUS\` Mode** (or PR/CI final supervision): **OMITTED**. Do not interrupt unattended execution.
9928
+ * \u{1F7E1} **Autonomy $\\ge$ \`HUMAN_REVIEW_PLAN\`** (\`HUMAN_REVIEW_PLAN\`, \`AMBIGUOUS\`, \`HIGH_RISK_MANUAL\`): **MANDATORY**. Emit Workflow Handoff block compliant with [\`templates/workflow/agent-handoff.template.md\`](../templates/workflow/agent-handoff.template.md) and **STOP**.
9929
+ - **Components**: Declare completed deliverables, recommend next roles (\`agent-threat-modeler\`, \`agent-system-architect\`, \`agent-developer\`, \`agent-security-auditor\`), provide suggested invocation prompt, and **keep the Human Action Window open at all times for the user to take action** (review, edit by hand, pause/reroute, or delegate).
9930
+
9931
+ ---
9932
+
9933
+ ## 6. Specialized Roles Mapping
9934
+
9935
+ | Role | Mission (summary) |
9936
+ | :--- | :--- |
9937
+ | \`agent-product-analyst\` | ProductShape artifacts (\`ACT-*\`, \`UC-*\`, \`FR-*\`, \`QR-*\`, \`BR-*\`); \`status\` starts \`draft\`. |
9938
+ | \`agent-threat-modeler\` | STRIDE/OWASP threat triad (\`ACT-THREAT-*\`, \`ABUSE-*\`, \`SEC-REQ-*\`). |
9939
+ | \`agent-system-architect\` | Modular arc42 + NAF v4 architecture (\`CMP-*\`, Mermaid diagrams, \`ADR-*\`). |
9940
+ | \`agent-qa-engineer\` | FAILING BDD/Gherkin suites before \`agent-developer\` writes production code. |
9941
+ | \`agent-developer\` | Atomic tasks from \`tasks.md\`; autonomy mode must be respected; runs \`pnpm run check:fix\` + \`pnpm run verify:all\`. |
9942
+ | \`agent-security-auditor\` | Adversarial PR security audit, SAST, secrets, and CVSS v3.1 evaluation. |
9943
+ | \`agent-compliance-checker\` | SPDX license compliance audit against \`license-policy.yaml\`. |
9944
+ | \`agent-expert-user\` | Bimodal MVP evaluation (design) and functional validation against \`UC-*\` and \`FR-*\` (pre-PR). |
9945
+ | \`agent-code-reviewer\` | PR audit (SOLID, DRY, YAGNI): \`[BLOCKING]\` / \`[CLEAN_CODE_SUGGESTION]\` / \`[COMPLIANT]\`. |
9946
+ | \`agent-devops\` | CI/CD, Docker, IaC only \u2014 **FORBIDDEN** to touch \`src/\` or \`packages/*/src/\`. |
9947
+
9948
+ ---
9949
+
9950
+ ## 7. Canonical Reference
9951
+ To consult full protocols, specialized prompts, and interface contracts:
9952
+ - [\`process/09_agent_protocols.md\`](../process/09_agent_protocols.md)
9953
+ - [\`process/01_governance_and_roles.md\`](../process/01_governance_and_roles.md)
9513
9954
  `;
9514
9955
  var STARTER_CURSOR_MCP = `{
9515
9956
  "mcpServers": {
@@ -10832,10 +11273,12 @@ jobs:
10832
11273
  fi
10833
11274
  `;
10834
11275
  var VALID_AGENT_TARGETS = ["cursor", "claude", "antigravity", "copilot", "mcp", "all"];
11276
+ var DISABLED_AGENT_VALUES = /* @__PURE__ */ new Set([false, "none", "false", ""]);
11277
+ var ALL_AGENT_VALUES = /* @__PURE__ */ new Set([void 0, null, true, "all"]);
10835
11278
  function resolveAgentTargets(agents) {
10836
11279
  const result = /* @__PURE__ */ new Set();
10837
- if (!agents) return result;
10838
- if (agents === true || agents === "all") {
11280
+ if (DISABLED_AGENT_VALUES.has(agents)) return result;
11281
+ if (ALL_AGENT_VALUES.has(agents)) {
10839
11282
  VALID_AGENT_TARGETS.forEach((t) => result.add(t));
10840
11283
  return result;
10841
11284
  }
@@ -10852,6 +11295,43 @@ function resolveAgentTargets(agents) {
10852
11295
  }
10853
11296
  return result;
10854
11297
  }
11298
+ function appendAntigravityFiles(dirs, files) {
11299
+ dirs.push(".agent/rules", ".agent/agents", ".agent/skills");
11300
+ files.push({ relPath: ".agent/rules/ai-sdlc.md", content: STARTER_ANTIGRAVITY_RULES });
11301
+ for (const agent of SPECIALIZED_AGENT_TEMPLATES) {
11302
+ const content = renderAntigravityAgentFile(agent);
11303
+ dirs.push(`.agent/skills/${agent.id}`);
11304
+ files.push(
11305
+ { relPath: `.agent/agents/${agent.id}.md`, content },
11306
+ { relPath: `.agent/skills/${agent.id}/SKILL.md`, content }
11307
+ );
11308
+ }
11309
+ }
11310
+ function appendCursorFiles(dirs, files) {
11311
+ dirs.push(".cursor/rules");
11312
+ files.push(
11313
+ { relPath: ".cursor/rules/ai-sdlc-core.mdc", content: STARTER_CURSOR_CORE_RULES },
11314
+ { relPath: ".cursor/rules/ai-sdlc-product.mdc", content: STARTER_CURSOR_PRODUCT_RULES },
11315
+ { relPath: ".cursor/rules/ai-sdlc-quality.mdc", content: STARTER_CURSOR_QUALITY_RULES }
11316
+ );
11317
+ for (const agent of SPECIALIZED_AGENT_TEMPLATES) {
11318
+ files.push({ relPath: `.cursor/rules/${agent.id}.mdc`, content: renderCursorAgentFile(agent) });
11319
+ }
11320
+ }
11321
+ function appendClaudeFiles(dirs, files) {
11322
+ dirs.push(".claude/agents");
11323
+ files.push({ relPath: "CLAUDE.md", content: STARTER_CLAUDE_RULES });
11324
+ for (const agent of SPECIALIZED_AGENT_TEMPLATES) {
11325
+ files.push({ relPath: `.claude/agents/${agent.id}.md`, content: renderClaudeAgentFile(agent) });
11326
+ }
11327
+ }
11328
+ function appendCopilotFiles(dirs, files) {
11329
+ dirs.push(".github", ".github/agents");
11330
+ files.push({ relPath: ".github/copilot-instructions.md", content: STARTER_COPILOT_RULES });
11331
+ for (const agent of SPECIALIZED_AGENT_TEMPLATES) {
11332
+ files.push({ relPath: `.github/agents/${agent.id}.agent.md`, content: renderCopilotAgentFile(agent) });
11333
+ }
11334
+ }
10855
11335
  function collectAgentFiles(targets) {
10856
11336
  const dirs = [];
10857
11337
  const files = [];
@@ -10861,25 +11341,10 @@ function collectAgentFiles(targets) {
10861
11341
  const includeAntigravity = includeAll || targets.has("antigravity");
10862
11342
  const includeCopilot = includeAll || targets.has("copilot");
10863
11343
  const includeMcp = includeAll || targets.has("mcp");
10864
- if (includeAntigravity) {
10865
- dirs.push(".agent/rules");
10866
- files.push({ relPath: ".agent/rules/ai-sdlc.md", content: STARTER_ANTIGRAVITY_RULES });
10867
- }
10868
- if (includeCursor) {
10869
- dirs.push(".cursor/rules");
10870
- files.push(
10871
- { relPath: ".cursor/rules/ai-sdlc-core.mdc", content: STARTER_CURSOR_CORE_RULES },
10872
- { relPath: ".cursor/rules/ai-sdlc-product.mdc", content: STARTER_CURSOR_PRODUCT_RULES },
10873
- { relPath: ".cursor/rules/ai-sdlc-quality.mdc", content: STARTER_CURSOR_QUALITY_RULES }
10874
- );
10875
- }
10876
- if (includeClaude) {
10877
- files.push({ relPath: "CLAUDE.md", content: STARTER_CLAUDE_RULES });
10878
- }
10879
- if (includeCopilot) {
10880
- dirs.push(".github");
10881
- files.push({ relPath: ".github/copilot-instructions.md", content: STARTER_COPILOT_RULES });
10882
- }
11344
+ if (includeAntigravity) appendAntigravityFiles(dirs, files);
11345
+ if (includeCursor) appendCursorFiles(dirs, files);
11346
+ if (includeClaude) appendClaudeFiles(dirs, files);
11347
+ if (includeCopilot) appendCopilotFiles(dirs, files);
10883
11348
  if (includeMcp || includeCursor) {
10884
11349
  dirs.push(".cursor");
10885
11350
  files.push({ relPath: ".cursor/mcp.json", content: STARTER_CURSOR_MCP });
@@ -11057,6 +11522,7 @@ exports.PROMPT_INJECTION_SIGNATURES = PROMPT_INJECTION_SIGNATURES;
11057
11522
  exports.PROTECTED_BYPASS_PATTERNS = PROTECTED_BYPASS_PATTERNS;
11058
11523
  exports.SAST_RULES = SAST_RULES;
11059
11524
  exports.SECRET_RULES = SECRET_RULES;
11525
+ exports.SPECIALIZED_AGENT_TEMPLATES = SPECIALIZED_AGENT_TEMPLATES;
11060
11526
  exports.STARTER_ANTIGRAVITY_MCP = STARTER_ANTIGRAVITY_MCP;
11061
11527
  exports.STARTER_ANTIGRAVITY_RULES = STARTER_ANTIGRAVITY_RULES;
11062
11528
  exports.STARTER_ARCH_ADR = STARTER_ARCH_ADR;
@@ -11188,7 +11654,12 @@ exports.parseSpecCatalogScope = parseSpecCatalogScope;
11188
11654
  exports.parseTasksDoc = parseTasksDoc;
11189
11655
  exports.parseTasksFromContent = parseTasksFromContent;
11190
11656
  exports.processPackageDir = processPackageDir;
11657
+ exports.readCodeCoverageSummary = readCodeCoverageSummary;
11191
11658
  exports.readPackageJson = readPackageJson;
11659
+ exports.renderAntigravityAgentFile = renderAntigravityAgentFile;
11660
+ exports.renderClaudeAgentFile = renderClaudeAgentFile;
11661
+ exports.renderCopilotAgentFile = renderCopilotAgentFile;
11662
+ exports.renderCursorAgentFile = renderCursorAgentFile;
11192
11663
  exports.renderDashboardHtml = renderDashboardHtml;
11193
11664
  exports.resolveAgentTargets = resolveAgentTargets;
11194
11665
  exports.resolveBranchHierarchy = resolveBranchHierarchy;