@aisdlc/core 4.6.0 → 4.7.1

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
@@ -14273,11 +14273,18 @@ function verifyPrivacy(options = {}) {
14273
14273
  writePrivacyOutputsIfNeeded(result, options, policy, rootDir);
14274
14274
  return result;
14275
14275
  }
14276
+ var VALID_REASONING_EFFORTS = /* @__PURE__ */ new Set(["low", "medium", "high", "max"]);
14277
+ function normalizeReasoningEffort(raw) {
14278
+ if (!raw) return void 0;
14279
+ const normalized = raw.trim().toLowerCase();
14280
+ return VALID_REASONING_EFFORTS.has(normalized) ? normalized : void 0;
14281
+ }
14276
14282
  var TRAILER_REGEXES = {
14277
14283
  taskId: /^\s*Task-ID:\s*(.+)$/im,
14278
14284
  parentRef: /^\s*Parent-Ref:\s*(.+)$/im,
14279
14285
  authorType: /^\s*Author-Type:\s*(human|agent)/im,
14280
14286
  aiModel: /^\s*AI-Model:\s*(.+)$/im,
14287
+ reasoningEffort: /^[ \t]*AI-Reasoning-Effort:[ \t]*([^\r\n]+)$/im,
14281
14288
  promptTokens: /^\s*Prompt-Tokens:\s*([0-9]+)/im,
14282
14289
  completionTokens: /^\s*Completion-Tokens:\s*([0-9]+)/im,
14283
14290
  activeTimeSeconds: /^\s*Active-Time-Seconds:\s*([0-9]+)/im
@@ -14308,11 +14315,14 @@ function parseCommitTrailers(rawMessage) {
14308
14315
  const authorType = resolveAuthorType(authorTypeMatch, aiModelMatch);
14309
14316
  const rawModel = aiModelMatch ? aiModelMatch[1].trim() : void 0;
14310
14317
  const aiModel = rawModel && rawModel !== "n/a" ? rawModel : void 0;
14318
+ const effortMatch = text.match(TRAILER_REGEXES.reasoningEffort);
14319
+ const reasoningEffort = normalizeReasoningEffort(effortMatch ? effortMatch[1] : void 0);
14311
14320
  return {
14312
14321
  taskId: resolveTrailerOrScope(text.match(TRAILER_REGEXES.taskId), text, /\b(TSK-[0-9A-Za-z_-]+)\b/i),
14313
14322
  parentRef: resolveTrailerOrScope(text.match(TRAILER_REGEXES.parentRef), text, /\b((?:CHG|FEAT|BUG|FIX|PATCH)-[0-9A-Za-z_-]+)\b/i),
14314
14323
  authorType,
14315
14324
  aiModel,
14325
+ reasoningEffort,
14316
14326
  promptTokens: parseTrailerInt(text.match(TRAILER_REGEXES.promptTokens)),
14317
14327
  completionTokens: parseTrailerInt(text.match(TRAILER_REGEXES.completionTokens)),
14318
14328
  activeTimeSeconds: parseTrailerInt(text.match(TRAILER_REGEXES.activeTimeSeconds))
@@ -14324,6 +14334,8 @@ function formatCommitTrailers(trailers) {
14324
14334
  if (trailers.parentRef) lines.push(`Parent-Ref: ${trailers.parentRef}`);
14325
14335
  lines.push(`Author-Type: ${trailers.authorType || "human"}`);
14326
14336
  lines.push(`AI-Model: ${trailers.aiModel || "n/a"}`);
14337
+ const normalizedEffort = normalizeReasoningEffort(trailers.reasoningEffort);
14338
+ if (normalizedEffort) lines.push(`AI-Reasoning-Effort: ${normalizedEffort}`);
14327
14339
  lines.push(`Prompt-Tokens: ${trailers.promptTokens ?? 0}`);
14328
14340
  lines.push(`Completion-Tokens: ${trailers.completionTokens ?? 0}`);
14329
14341
  lines.push(`Active-Time-Seconds: ${trailers.activeTimeSeconds ?? 0}`);
@@ -14546,6 +14558,12 @@ function accumulateAuthorSummaries(records, humanSummary, byModel) {
14546
14558
  const modelName = record.trailers.aiModel || "agent-generic";
14547
14559
  if (!byModel[modelName]) byModel[modelName] = createEmptySummary();
14548
14560
  accumulateRecord(byModel[modelName], record);
14561
+ const effortKey = record.trailers.reasoningEffort || "unspecified";
14562
+ if (!byModel[modelName].byEffort) byModel[modelName].byEffort = {};
14563
+ if (!byModel[modelName].byEffort[effortKey]) {
14564
+ byModel[modelName].byEffort[effortKey] = createEmptySummary();
14565
+ }
14566
+ accumulateRecord(byModel[modelName].byEffort[effortKey], record);
14549
14567
  } else {
14550
14568
  accumulateRecord(humanSummary, record);
14551
14569
  }
@@ -15476,8 +15494,8 @@ function detectFromGitConfig(cwd) {
15476
15494
  }
15477
15495
  return null;
15478
15496
  }
15479
- function detectFromTelemetry(cwd, env) {
15480
- const telemetry = readSessionTelemetry(cwd);
15497
+ function detectFromTelemetry(cwd, env, preloaded) {
15498
+ const telemetry = preloaded !== void 0 ? preloaded : readSessionTelemetry(cwd);
15481
15499
  if (telemetry) {
15482
15500
  const model = telemetry.model || env.AI_MODEL || "agent-developer";
15483
15501
  return {
@@ -15532,10 +15550,14 @@ function detectFromSignature(env, cwd) {
15532
15550
  }
15533
15551
  return null;
15534
15552
  }
15553
+ function resolveAgentReasoningEffort(cwd, env, telemetry) {
15554
+ return normalizeReasoningEffort(env.AI_REASONING_EFFORT) ?? normalizeReasoningEffort(telemetry?.reasoningEffort) ?? normalizeReasoningEffort(getGitConfigValue("ai-sdlc.reasoning-effort", cwd));
15555
+ }
15535
15556
  function detectAuthorIdentity(options = {}) {
15536
15557
  const env = options.env || process.env;
15537
15558
  const cwd = options.cwd || process.cwd();
15538
- return detectFromEnvOverride(env) || detectFromGitConfig(cwd) || detectFromTelemetry(cwd, env) || detectFromAgentEnv(env) || detectFromSignature(env, cwd) || {
15559
+ const telemetry = readSessionTelemetry(cwd);
15560
+ const identity = detectFromEnvOverride(env) || detectFromGitConfig(cwd) || detectFromTelemetry(cwd, env, telemetry) || detectFromAgentEnv(env) || detectFromSignature(env, cwd) || {
15539
15561
  authorType: "human",
15540
15562
  model: "n/a",
15541
15563
  source: "default-human",
@@ -15544,6 +15566,11 @@ function detectAuthorIdentity(options = {}) {
15544
15566
  completionTokens: 0,
15545
15567
  activeTimeSeconds: 0
15546
15568
  };
15569
+ if (identity.authorType !== "agent") {
15570
+ return identity;
15571
+ }
15572
+ const reasoningEffort = resolveAgentReasoningEffort(cwd, env, telemetry);
15573
+ return reasoningEffort ? { ...identity, reasoningEffort } : identity;
15547
15574
  }
15548
15575
  var PRE_COMMIT_SCRIPT = `#!/usr/bin/env bash
15549
15576
  # ==============================================================================
@@ -15631,24 +15658,33 @@ AI_MODEL_NAME="n/a"
15631
15658
  PROMPT_TOKENS=0
15632
15659
  COMPLETION_TOKENS=0
15633
15660
  ACTIVE_TIME_SEC=0
15661
+ REASONING_EFFORT=""
15634
15662
 
15635
15663
  # Execute universal IDE-agnostic author detection engine
15636
- DETECTED=$(node packages/cli/bin/aisdlc.js git detect-author 2>/dev/null || npx aisdlc git detect-author 2>/dev/null || node -e "try { const { detectAuthorIdentity } = require('@aisdlc/core'); const id = detectAuthorIdentity(); console.log([id.authorType, id.model, id.promptTokens, id.completionTokens, id.activeTimeSeconds].join('|')); } catch {}" 2>/dev/null || echo "")
15664
+ DETECTED=$(node packages/cli/bin/aisdlc.js git detect-author 2>/dev/null || npx aisdlc git detect-author 2>/dev/null || node -e "try { const { detectAuthorIdentity } = require('@aisdlc/core'); const id = detectAuthorIdentity(); console.log([id.authorType, id.model, id.promptTokens, id.completionTokens, id.activeTimeSeconds, id.reasoningEffort || ''].join('|')); } catch {}" 2>/dev/null || echo "")
15637
15665
 
15638
15666
  if [ -n "$DETECTED" ]; then
15639
- IFS='|' read -r DET_AUTHOR DET_MODEL DET_PROMPT DET_COMPL DET_TIME <<< "$DETECTED"
15667
+ IFS='|' read -r DET_AUTHOR DET_MODEL DET_PROMPT DET_COMPL DET_TIME DET_EFFORT <<< "$DETECTED"
15640
15668
  AUTHOR_TYPE="\${DET_AUTHOR:-$AUTHOR_TYPE}"
15641
15669
  AI_MODEL_NAME="\${DET_MODEL:-$AI_MODEL_NAME}"
15642
15670
  PROMPT_TOKENS="\${DET_PROMPT:-$PROMPT_TOKENS}"
15643
15671
  COMPLETION_TOKENS="\${DET_COMPL:-$COMPLETION_TOKENS}"
15644
15672
  ACTIVE_TIME_SEC="\${DET_TIME:-$ACTIVE_TIME_SEC}"
15673
+ REASONING_EFFORT="\${DET_EFFORT:-$AI_REASONING_EFFORT}"
15645
15674
  else
15646
15675
  if [ -n "$AI_MODEL" ] || [ -n "$AI_AGENT_NAME" ] || [ -n "$ANTIGRAVITY_AGENT" ] || [ -n "$ANTIGRAVITY_AGENT_ID" ] || [ -n "$ANTIGRAVITY_CONVERSATION_ID" ] || [ -n "$CLAUDE_CODE" ] || [ -n "$CURSOR_AGENT" ] || [ -n "$WINDSURF_AGENT" ] || [ -n "$AIDER_MODEL" ] || [ -f "$TELEMETRY_FILE" ]; then
15647
15676
  AUTHOR_TYPE="agent"
15648
15677
  AI_MODEL_NAME="\${AI_MODEL:-\${AI_AGENT_NAME:-\${AIDER_MODEL:-agent-developer}}}"
15678
+ REASONING_EFFORT="\${AI_REASONING_EFFORT:-}"
15649
15679
  fi
15650
15680
  fi
15651
15681
 
15682
+ REASONING_EFFORT=$(printf '%s' "$REASONING_EFFORT" | tr -d '\\r[:space:]' | tr '[:upper:]' '[:lower:]')
15683
+ case "$REASONING_EFFORT" in
15684
+ low|medium|high|max) ;;
15685
+ *) REASONING_EFFORT="" ;;
15686
+ esac
15687
+
15652
15688
  # Estimate tokens and active time if not provided for agent
15653
15689
  if [ "$PROMPT_TOKENS" = "0" ] && [ "$AUTHOR_TYPE" = "agent" ]; then
15654
15690
  CHG_LINES=$(git diff --cached --shortstat 2>/dev/null | grep -oE '[0-9]+ (insertion|deletion)' | awk '{s+=$1} END {print s+0}')
@@ -15682,6 +15718,10 @@ if [ "$AUTHOR_TYPE" = "agent" ] && ! grep -qE "^AI-Model:" "$COMMIT_MSG_FILE" 2>
15682
15718
  TRAILERS_TO_ADD="\${TRAILERS_TO_ADD}AI-Model: $AI_MODEL_NAME
15683
15719
  "
15684
15720
  fi
15721
+ if [ "$AUTHOR_TYPE" = "agent" ] && [ -n "$REASONING_EFFORT" ] && ! grep -qiE "^AI-Reasoning-Effort:" "$COMMIT_MSG_FILE" 2>/dev/null; then
15722
+ TRAILERS_TO_ADD="\${TRAILERS_TO_ADD}AI-Reasoning-Effort: $REASONING_EFFORT
15723
+ "
15724
+ fi
15685
15725
  if ! grep -qE "^Prompt-Tokens:" "$COMMIT_MSG_FILE" 2>/dev/null; then
15686
15726
  TRAILERS_TO_ADD="\${TRAILERS_TO_ADD}Prompt-Tokens: $PROMPT_TOKENS
15687
15727
  "
@@ -17779,9 +17819,13 @@ var DASHBOARD_CLIENT_SCRIPT = `
17779
17819
  var tableBranchLabel = document.getElementById('table-branch-label');
17780
17820
  if (tableBranchLabel) tableBranchLabel.textContent = isTotal ? 'Totalizador (Todas las ramas)' : branchKey;
17781
17821
 
17822
+ var escHtml = function(s) {
17823
+ return String(s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
17824
+ };
17825
+
17782
17826
  var badgeElem = document.getElementById('telemetry-badge-container');
17783
17827
  if (badgeElem) {
17784
- badgeElem.innerHTML = '<span class="badge" style="background: rgba(56, 189, 248, 0.2); color: #38bdf8; border: 1px solid #38bdf8; font-size: 0.75rem; padding: 0.25rem 0.6rem; border-radius: 4px;">' + badgeText + '</span>';
17828
+ badgeElem.innerHTML = '<span class="badge" style="background: rgba(56, 189, 248, 0.2); color: #38bdf8; border: 1px solid #38bdf8; font-size: 0.75rem; padding: 0.25rem 0.6rem; border-radius: 4px;">' + escHtml(badgeText) + '</span>';
17785
17829
  }
17786
17830
 
17787
17831
  var elCommits = document.getElementById('card-commits');
@@ -17809,6 +17853,7 @@ var DASHBOARD_CLIENT_SCRIPT = `
17809
17853
  html += '<tr>' +
17810
17854
  '<td><strong>Human (Developer)</strong></td>' +
17811
17855
  '<td><span class="badge" style="background:#334155;">HUMAN</span></td>' +
17856
+ '<td>\u2014</td>' +
17812
17857
  '<td>' + data.humanSummary.commits + '</td>' +
17813
17858
  '<td>+' + data.humanSummary.linesAdded + ' / -' + data.humanSummary.linesDeleted + '</td>' +
17814
17859
  '<td>' + Math.round(data.humanSummary.activeTimeSeconds / 60) + 'm</td>' +
@@ -17816,24 +17861,42 @@ var DASHBOARD_CLIENT_SCRIPT = `
17816
17861
  '</tr>';
17817
17862
  }
17818
17863
  if (data.byModel) {
17864
+ var effortOrder = { low: 0, medium: 1, high: 2, max: 3, unspecified: 4 };
17865
+ var renderRow = function(safeModel, effortKey, s) {
17866
+ var safeEffort = escHtml(effortKey);
17867
+ return '<tr>' +
17868
+ '<td><strong><code>' + safeModel + '</code></strong></td>' +
17869
+ '<td><span class="badge badge-green">AGENT</span></td>' +
17870
+ '<td><span class="badge" style="background:#334155;">' + safeEffort + '</span></td>' +
17871
+ '<td>' + s.commits + '</td>' +
17872
+ '<td>+' + s.linesAdded + ' / -' + s.linesDeleted + '</td>' +
17873
+ '<td>' + Math.round(s.activeTimeSeconds / 60) + 'm</td>' +
17874
+ '<td>' + (s.promptTokens + s.completionTokens).toLocaleString('en-US') + '</td>' +
17875
+ '<td>$' + Number(s.estimatedCostUsd).toFixed(2) + '</td>' +
17876
+ '</tr>';
17877
+ };
17819
17878
  var models = Object.keys(data.byModel);
17820
17879
  for (var i = 0; i < models.length; i++) {
17821
17880
  var m = models[i];
17822
17881
  var summary = data.byModel[m];
17823
- var safeModel = String(m).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
17824
- html += '<tr>' +
17825
- '<td><strong><code>' + safeModel + '</code></strong></td>' +
17826
- '<td><span class="badge badge-green">AGENT</span></td>' +
17827
- '<td>' + summary.commits + '</td>' +
17828
- '<td>+' + summary.linesAdded + ' / -' + summary.linesDeleted + '</td>' +
17829
- '<td>' + Math.round(summary.activeTimeSeconds / 60) + 'm</td>' +
17830
- '<td>' + (summary.promptTokens + summary.completionTokens).toLocaleString('en-US') + '</td>' +
17831
- '<td>$' + Number(summary.estimatedCostUsd).toFixed(2) + '</td>' +
17832
- '</tr>';
17882
+ var safeModel = escHtml(m);
17883
+ var effortKeys = summary.byEffort ? Object.keys(summary.byEffort) : [];
17884
+ if (effortKeys.length === 0) {
17885
+ html += renderRow(safeModel, 'unspecified', summary);
17886
+ } else {
17887
+ effortKeys.sort(function(a, b) {
17888
+ var oa = effortOrder.hasOwnProperty(a) ? effortOrder[a] : 99;
17889
+ var ob = effortOrder.hasOwnProperty(b) ? effortOrder[b] : 99;
17890
+ return oa !== ob ? oa - ob : a.localeCompare(b);
17891
+ });
17892
+ for (var j = 0; j < effortKeys.length; j++) {
17893
+ html += renderRow(safeModel, effortKeys[j], summary.byEffort[effortKeys[j]]);
17894
+ }
17895
+ }
17833
17896
  }
17834
17897
  }
17835
17898
  html += '<tr style="font-weight: bold; background: rgba(255,255,255,0.05);">' +
17836
- '<td>' + (isTotal ? 'TOTAL REPOSITORIO' : 'TOTAL RAMA') + '</td><td>\u2014</td>' +
17899
+ '<td>' + (isTotal ? 'TOTAL REPOSITORIO' : 'TOTAL RAMA') + '</td><td>\u2014</td><td>\u2014</td>' +
17837
17900
  '<td>' + data.totalCommits + '</td>' +
17838
17901
  '<td>+' + data.linesAdded + ' / -' + data.linesDeleted + '</td>' +
17839
17902
  '<td>' + Math.round(data.totalActiveTimeSeconds / 60) + 'm</td>' +
@@ -18277,11 +18340,20 @@ function renderTelemetryCardsHtml(kpi, displayLabel = "Totalizador") {
18277
18340
  `</div>`
18278
18341
  ].join("\n");
18279
18342
  }
18280
- function renderModelRow(model, summary) {
18343
+ var EFFORT_ORDER = { low: 0, medium: 1, high: 2, max: 3, unspecified: 4 };
18344
+ function sortEffortEntries(entries) {
18345
+ return [...entries].sort(([a], [b]) => {
18346
+ const oa = EFFORT_ORDER[a] ?? 99;
18347
+ const ob = EFFORT_ORDER[b] ?? 99;
18348
+ return oa !== ob ? oa - ob : a.localeCompare(b);
18349
+ });
18350
+ }
18351
+ function renderModelEffortRow(model, effort, summary) {
18281
18352
  return [
18282
18353
  `<tr>`,
18283
- ` <td><strong><code>${model}</code></strong></td>`,
18354
+ ` <td><strong><code>${escapeHtml(model)}</code></strong></td>`,
18284
18355
  ` <td><span class="badge badge-green">AGENT</span></td>`,
18356
+ ` <td><span class="badge" style="background:#334155;">${escapeHtml(effort)}</span></td>`,
18285
18357
  ` <td>${summary.commits}</td>`,
18286
18358
  ` <td>+${summary.linesAdded} / -${summary.linesDeleted}</td>`,
18287
18359
  ` <td>${Math.round(summary.activeTimeSeconds / 60)}m</td>`,
@@ -18290,12 +18362,20 @@ function renderModelRow(model, summary) {
18290
18362
  `</tr>`
18291
18363
  ].join("");
18292
18364
  }
18365
+ function renderModelRows(model, summary) {
18366
+ const effortEntries = summary.byEffort ? Object.entries(summary.byEffort) : [];
18367
+ if (effortEntries.length === 0) {
18368
+ return renderModelEffortRow(model, "unspecified", summary);
18369
+ }
18370
+ return sortEffortEntries(effortEntries).map(([effort, effortSummary]) => renderModelEffortRow(model, effort, effortSummary)).join("\n");
18371
+ }
18293
18372
  function renderHumanTelemetryRow(human) {
18294
18373
  if (human.commits <= 0) return "";
18295
18374
  return [
18296
18375
  `<tr>`,
18297
18376
  ` <td><strong>Human (Developer)</strong></td>`,
18298
18377
  ` <td><span class="badge" style="background:#334155;">HUMAN</span></td>`,
18378
+ ` <td>\u2014</td>`,
18299
18379
  ` <td>${human.commits}</td>`,
18300
18380
  ` <td>+${human.linesAdded} / -${human.linesDeleted}</td>`,
18301
18381
  ` <td>${Math.round(human.activeTimeSeconds / 60)}m</td>`,
@@ -18310,20 +18390,20 @@ function renderTotalBranchRow(kpi, isTotal = false) {
18310
18390
  const label = isTotal ? "TOTAL REPOSITORIO" : "TOTAL RAMA";
18311
18391
  return [
18312
18392
  `<tr style="font-weight: bold; background: rgba(255,255,255,0.05);">`,
18313
- ` <td>${label}</td><td>\u2014</td><td>${kpi.totalCommits}</td><td>+${kpi.linesAdded} / -${kpi.linesDeleted}</td>`,
18393
+ ` <td>${label}</td><td>\u2014</td><td>\u2014</td><td>${kpi.totalCommits}</td><td>+${kpi.linesAdded} / -${kpi.linesDeleted}</td>`,
18314
18394
  ` <td>${mins}m</td><td>${tokens}</td><td>$${cost} USD</td>`,
18315
18395
  `</tr>`
18316
18396
  ].join("");
18317
18397
  }
18318
- function renderTelemetryTable(kpi, displayLabel) {
18398
+ function renderModelTelemetryTable(kpi, displayLabel) {
18319
18399
  const humanRow = renderHumanTelemetryRow(kpi.humanSummary);
18320
- const modelRows = Object.entries(kpi.byModel).map(([m, s]) => renderModelRow(m, s)).join("\n");
18400
+ const modelRows = Object.entries(kpi.byModel).map(([m, s]) => renderModelRows(m, s)).join("\n");
18321
18401
  const totalRow = renderTotalBranchRow(kpi, displayLabel === "Totalizador");
18322
18402
  const titleLabel = "Totalizador (Todas las ramas)" ;
18323
18403
  return [
18324
18404
  `<div class="chart-container">`,
18325
18405
  ` <h3>Telemetry Breakdown by Author and Model (<span id="table-branch-label">${escapeHtml(titleLabel)}</span>)</h3>`,
18326
- ` <table class="data-table"><thead><tr><th>Entity / Model</th><th>Type</th><th>Commits</th><th>Lines (+/-)</th><th>Active Time</th><th>Consumed Tokens</th><th>Estimated Cost ($ USD)</th></tr></thead><tbody id="telemetry-table-tbody">`,
18406
+ ` <table class="data-table"><thead><tr><th>Entity / Model</th><th>Type</th><th>Reasoning Effort</th><th>Commits</th><th>Lines (+/-)</th><th>Active Time</th><th>Consumed Tokens</th><th>Estimated Cost ($ USD)</th></tr></thead><tbody id="telemetry-table-tbody">`,
18327
18407
  humanRow,
18328
18408
  modelRows,
18329
18409
  totalRow,
@@ -18334,7 +18414,7 @@ function renderTelemetryTable(kpi, displayLabel) {
18334
18414
  function renderActiveTelemetrySection(kpi, displayLabel, branches, activeBranch) {
18335
18415
  const filterBarHtml = renderTelemetryFilterBarHtml(branches, activeBranch);
18336
18416
  const cardsHtml = renderTelemetryCardsHtml(kpi, displayLabel);
18337
- const tableHtml = renderTelemetryTable(kpi, displayLabel);
18417
+ const tableHtml = renderModelTelemetryTable(kpi, displayLabel);
18338
18418
  return `${filterBarHtml}
18339
18419
  ${cardsHtml}
18340
18420
  ${tableHtml}`;
@@ -19392,6 +19472,14 @@ var LIFECYCLE_SKILL_TEMPLATES = [
19392
19472
  references: "[`process/06_spec_driven_development.md`](../../process/06_spec_driven_development.md), [`process/08_citation_contract_and_drift.md`](../../process/08_citation_contract_and_drift.md), [`process/10_quality_management_and_release_gates.md`](../../process/10_quality_management_and_release_gates.md), [`process/11_git_branching_and_lifecycle.md`](../../process/11_git_branching_and_lifecycle.md), and [`process/09_agent_protocols.md`](../../process/09_agent_protocols.md).",
19393
19473
  globs: "specs/changes/**, src/**, packages/**, tests/**",
19394
19474
  body: '## Purpose & Trigger\nUse this skill for **every evolutionary increment (new feature, enhancement, refactoring, or bugfix)** on a project that already has an AI-SDLC baseline. It enforces strict 360\xB0 traceability from upstream ProductShape (`UC-*`, `FR-*`) through SDD (`CHG-*`, `HOF-*`, `TSK-*`), TDD implementation, the 12 Quality Gates, and baseline promotion under the **streamlined 2-checkpoint architecture**.\n\n## End-to-End Execution Playbook\n\n### Step 0: Branch-Before-Change, Pre-Change Draft PR & Scope Triage (`patch | standard | critical`)\n1. **Branch-Before-Change & Pre-Change Draft PR/MR**: Verify the active branch (`git branch --show-current`). If currently on a protected branch (`main`, `master`, `release/*`), create and switch to a dedicated working branch (`feat/<CHG-ID>-<slug>` or `fix/<CHG-ID>-<slug>`) **before** modifying or creating any files. Whenever a remote repository is configured (`git remote`), check if an open PR/MR already exists for the branch (`gh pr view` / `gh pr list --head <branch>` on GitHub; `glab mr view` / `glab mr list --source-branch <branch>` on GitLab); if none exists, create an empty bootstrap commit (`git commit --allow-empty -m "chore(<CHG-ID>): open draft PR"`), push (`git push -u origin <branch>`), and open a **Draft PR/MR** (`gh pr create --draft` on GitHub; `glab mr create --draft` or `git push -o merge_request.create -o merge_request.draft` on GitLab) before making any changes (if no remote exists, work locally).\n2. Before editing any files or running `sdd_change_new`, inspect if the user explicitly specified the friction profile (`patch`, `standard`, or `critical`). If not, analyze the requested scope and ask the user via interactive question (`ask_question`) with the recommended option first (`(Recommended)`):\n - **`patch`**: low-risk isolated bugfixes ($\\le 2$ source files, zero Anti-Bypass paths), typos, or linter fixes on `patch/*` or `fix/*` branches (`npx aisdlc change new "<Title>" --id <chg-id> --profile patch` generates `spec.md` with `profile: patch` and `verification` block only, omitting `design.md`, `tasks.md`, and `handoff.yaml`; fast-track directly to Step 3 -> Step 4 -> Step 5 -> Step 6).\n - **`standard`**: functional increments, new/updated `UC-*` or `FR-*`, or contract changes (`proposal.md`, `spec.md`, `design.md`, `tasks.md`, and `handoff.yaml`).\n - **`critical`**: changes touching security enclaves (`SEC-ENC-*`), sensitive PII (`SPECIAL_CATEGORY` / `DPIA-*`), schemas, or migrations (full `standard` artifacts + `ADR-*` + mandatory STRIDE modeling and dual human approval).\n2. **Anti-Bypass Rule**: Never recommend or allow `patch` when the change touches protected paths (`schemas/`, `specs/security/`, `specs/privacy/`, `packages/security/`, `SEC-ENC-*`, `09_decisions/`, `migrations/`, or `*-policy.yaml`).\n\n### Step 1: Upstream Product, Security & Privacy Delta (`agent-product-analyst`, `agent-threat-modeler` & `agent-privacy-officer`)\n1. Inspect active changes via MCP tool `get_active_handoff` and verify whether the target Use Case (`UC-*`) or Requirement (`FR-*`) already exists in `specs/product/`.\n2. If the increment introduces new behavior or modifies business rules:\n - Use [`agent-product-analyst`](../agent-product-analyst/SKILL.md) to create or update the `UC-*`, `BR-*`, and `FR-*` (with `@nominal`, `@boundary`, `@invalid` Gherkin scenarios).\n - Run MCP tool `verify_duplicates` (`npx aisdlc verify duplicates`) to block lexical or functional collisions early.\n - Use [`agent-threat-modeler`](../agent-threat-modeler/SKILL.md) to model any new `ABUSE-*` and `SEC-REQ-*` mitigations.\n - Hand off to [`agent-privacy-officer`](../agent-privacy-officer/SKILL.md) to model any personal data assets (`DATA-ASSET-*`), GDPR Art. 30 processing activities (`PRIV-ROPA-*`), and privacy requirements (`PRIV-REQ-*`).\n3. Run `sdd_check_fix` (`npx aisdlc check --fix`) to sync Gherkin `.feature` files and validate schemas.\n\n### Step 2: SDD Change Scaffolding & Architectural Design (`agent-system-architect`)\n1. Scaffold the bounded change package and its cryptographic `handoff.yaml` sidecar (`HOF-*`) targeting **a single Use Case (`1 UC-* = 1 CHG-*`)** using MCP tool `sdd_change_new` (or CLI `npx aisdlc change new "<Title>" --from <UC-ID> --profile <patch|standard|critical>`).\n2. Use [`agent-system-architect`](../agent-system-architect/SKILL.md) to complete `specs/changes/active/<chg-id>/design.md` and `specs/architecture/CMP-*.md`:\n - Structure `CMP-*` and `design.md` around **Modular & Hexagonal Architecture (Ports & Adapters)** (Domain/Application Core + Inbound/Outbound Ports) and define **Contract-First** shared interfaces/DTOs/schemas when spanning Frontend and Backend.\n - Map 100% of `handoff.yaml` requirements and components to atomic tasks (`TSK-*`) in `tasks.md` with explicit `autonomy-mode` (`AUTONOMOUS`, `HUMAN_REVIEW_PLAN`, `HIGH_RISK_MANUAL`, `AMBIGUOUS`).\n3. Run `verify_governance` and `verify_friction` to validate task governance, 100% design/handoff scope coverage, and anti-monolith limits (`maxUseCasesPerChange = 1`).\n4. Commit the SDD scaffolding and specification/design artifacts on the working branch and push (`git push`) to the open Draft PR.\n\n### Checkpoint 1: Specification & Design Checkpoint (`agent-auditor` $\\parallel$ `agent-adversary`)\n1. Concurrently invoke `agent-auditor` (evaluating YAGNI, interface bloat, and task completeness) and `agent-adversary` (probing contradictions, race conditions, and architecture SPOFs) in clean, isolated context windows over the combined upstream deliverables.\n2. Consolidate findings and remediate any blocking defects (max 2 correction rounds), committing and pushing updates (`git push`) to the open Draft PR.\n3. **Human Approval Gate 1**: Present the specification and architectural design (reviewable directly in the Draft PR) for Human Tech Lead / PO sign-off before proceeding to code.\n\n### Step 3: Streamlined Git Branch Navigation & Multi-Agent Parallelism\n1. Confirm you are on the working branch via `npx aisdlc git checkout <TSK-ID>` (`pnpm run git:checkout <TSK-ID>`).\n - **Default Streamlined Mode**: Ensures the agent is on `feat/<CHG-ID>-<slug>` (already created in Step 0).\n - Granular task traceability is maintained via commit trailers (`Task-ID: TSK-*`, `Parent-Ref: CHG-*`) and commit scopes (`feat(TSK-001): ...`), enabling per-task rework KPIs without branch explosion.\n2. **Parallel Agent Execution Rules (`--parallel`)**:\n - When concurrent multi-agent implementation is configured (e.g. Backend adapter $\\parallel$ Frontend UI), `aisdlc git checkout <TSK-ID> --parallel` creates isolated worktrees (`task/<PARENT-ID>/<TSK-ID>-<slug>`).\n\n### Step 4: Red Phase \u2014 Failing Test Suites (`agent-qa-engineer`)\n1. Delegate to or adopt [`agent-qa-engineer`](../agent-qa-engineer/SKILL.md).\n2. Run `npx aisdlc gherkin extract` (`sdd_check_fix`) to deterministically extract `.feature` files from Markdown specifications, and run `npx aisdlc gherkin scaffold <feature-file> --lang <lang> --fallback` to scaffold RED step definitions in `tests/steps/` (never hand-author `.feature` or step skeletons).\n3. Author FAILING (red) assertions inside the scaffolded step definitions, plus integration/contract tests and mandatory E2E/UI tests (evaluating Happy Path, Sad Path, and Boundary Values for every interactive UI element, plus `UC-*` alternative/exception flows) in `tests/`.\n4. Commit failing test suites with trailer `Task-ID: TSK-YYY` and push (`git push`) to the Draft PR (CI workflows skip heavy checks while the PR is in `draft` state).\n5. Run `npx aisdlc verify gherkin` and `verify_testing` (`npx aisdlc verify testing`) to confirm deterministic Gherkin/step sync and requirement test coverage before writing production code.\n\n### Step 5: Green & Refactor Phase \u2014 Surgical Implementation (`agent-developer` / `agent-devops`)\n1. Delegate application tasks (`src/`, `tests/`) to [`agent-developer`](../agent-developer/SKILL.md). For tasks (`TSK-*`) targeting CI/CD workflows (`.github/workflows/`), `Dockerfile*`, IaC manifests, or support scripts (`scripts/`), delegate to [`agent-devops`](../agent-devops/SKILL.md) under its strict non-invasion guardrail on `src/`.\n2. Execute the **Mandatory 4-Step Implementation Order**:\n - (1) Modular & Hexagonal Architecture (Ports & Adapters) boundaries, (2) Inter-module interfaces/ports first, (3) Concrete component implementation (zero fake-wiring; all 4 UI states `Loading`, `Empty`, `Error`, `Nominal`), (4) Exhaustive per-function unit tests in `tests/unit/` (Happy Path, Sad Path, Boundary, Null/Empty).\n3. Commit implementations with trailer `Task-ID: TSK-YYY` and push (`git push`) incrementally to the Draft PR.\n4. Verify any new dependency against `license-policy.yaml` via `verify_licenses` and PII handling against `privacy-policy.yaml` via `verify_privacy`.\n5. Run `sdd_check_fix` (`npx aisdlc check --fix`) and `verify_quality` (`npx aisdlc verify quality`) until Cyclomatic Complexity $\\le 10$, Cognitive $\\le 15$, Maintainability $\\ge 50$, and Function Length $\\le 40$ lines pass with zero violations.\n6. Run `verify` (`npx aisdlc verify all`) confirming all **12 Quality Gates** pass green.\n\n### Checkpoint 2: Implementation & Pre-PR Checkpoint (`agent-auditor` $\\parallel$ `agent-adversary`)\n1. **Functional Validation (`agent-expert-user`)**: Validate live runtime behavior against `UC-*` and `FR-*` criteria (including `0` browser `console.error`/`pageerror` on UI changes).\n2. Concurrently invoke `agent-auditor` (verifying Clean Code, SOLID, DRY, AST thresholds, and eliminating unnecessary abstractions) and `agent-adversary` (performing conceptual test mutation to verify QA tests catch defects, and attacking boundary inputs with concrete PoC breaks).\n3. Consolidate findings and remediate in `agent-developer` (max 2 correction rounds), committing and pushing (`git push`) fixes to the Draft PR.\n4. Run `npx aisdlc verify all` to confirm final green status, then run `report_quality` (`npx aisdlc report quality`) and `report_dashboard` (`npx aisdlc report dashboard`) to compute local reports and the interactive dashboard for review (**do NOT stage or commit global `reports/*` files on `feat/CHG-*` branches** to prevent merge conflicts across parallel PRs).\n\n### Step 6: Human PR Sign-Off, Baseline Integration & Release Closure\n1. **Ready for Review & Feature Merge (`feat/CHG-*` \u2794 `main` or `release/vX.Y.Z`)**:\n - Update the Draft PR body with the Plan Execution Matrix (`[X]` vs `[O]`), KPI summary (`kpi_pr` including per-task rework metrics), and local verification/report summary (`reports/QUALITY_REPORT.md`, `reports/TRACEABILITY_MATRIX.md`, `reports/dashboard.html` inspected locally, without committing global `reports/*` to the feature PR), then run `gh pr ready` (GitHub) or `glab mr update --ready` (GitLab) to mark the PR/MR **Ready for Review** (triggering full CI verification) and present it to the human Tech Lead for review and approval (never auto-approve or auto-merge).\n2. **Canonical Baseline Promotion**: Once tasks in `tasks.md` are marked `COMPLETED` and approved, promote the change into the canonical baseline via MCP tool `sdd_integrate` (`npx aisdlc sdd integrate --auto`), which synchronizes the normative text and BDD Gherkin scenarios into `FR-*` / `UC-*` / `SEC-REQ-*` / `PRIV-REQ-*`, bumps minor SemVer when updating active specs, resyncs PDaC SHA-256 digests, promotes `FR-*` to `active`, links `CMP-*`, and archives the change under `specs/changes/completed/` (or `npx aisdlc sdd integrate --all` to consolidate all completed changes).\n3. **Semantic Versioning Promotion**:\n - **Profile-Driven SemVer Mapping**: Bump the version of the software under development according to the increment\'s friction profile:\n - `patch` -> bump **Patch** digit (`x.y.Z`)\n - `standard` -> bump **Minor** digit (`x.Y.0`)\n - `critical` -> bump **Major** digit (`X.0.0`)\n - **Highest-Precedence Consolidation (Multiple Pending Increments)**: When multiple pending increments exist in the active branch or release batch being integrated, apply **ONLY a single version bump corresponding to the highest rank** (`critical` / Major > `standard` / Minor > `patch` / Patch), ignoring unrelated historical directories.\n - Tag the merge with the computed SemVer bump (`patch`, `minor`, `major`) and refresh the interactive dashboard (`report_dashboard`).\n\n## Non-Negotiable Guardrails\n- **Clean Context Window Isolation per Specialist Agent (Cross-IDE)**: Never execute two distinct specialist roles (e.g., `agent-qa-engineer` and `agent-developer`, or `agent-developer` and `agent-adversary`) in the same conversation context window. In subagent-capable IDEs (Antigravity `invoke_subagent`, Claude Code `Task` / `.claude/agents/`, GitHub Copilot `@agent-*`), always spawn each specialist in a fresh isolated subagent context that reads state strictly from disk (`specs/`, `handoff.yaml`, `get_active_handoff`). In chat-based IDEs (Cursor, Windsurf, Aider), persist all artifacts to disk, emit the Workflow Handoff block, and instruct the user to open a **New Chat** (or `/clear`) before running the next specialist.\n- **2-Checkpoint Quality & Adversarial Protocol**: Enforce transversal quality and red-team checks exclusively at **Checkpoint 1 (Specification & Design)** and **Checkpoint 2 (Implementation & Pre-PR)**. Enforce the **Anti-Ping-Pong Guardrail**: maximum 2 correction rounds per checkpoint; if unresolved blocking defects persist, escalate to the Human Tech Lead.\n- **Single-Use-Case Scope (`1 UC-* = 1 CHG-*`)**: Each SDD change (`CHG-*`) must deliver at most 1 Use Case (`UC-*`). Bundling multiple `UC-*` into one `handoff.yaml` is blocked by `verify_governance` (`Greenfield monolith detected`). Scale throughput via parallel `CHG-*` branches/worktrees, not monolithic changes.\n- **100% Design & Handoff Coverage in `tasks.md`**: Every `CMP-*`, `FR-*`, `SEC-REQ-*`, and `PRIV-REQ-*` declared in `design.md` and `handoff.yaml` must be explicitly assigned to at least one `TSK-*` in `tasks.md`.'
19475
+ },
19476
+ {
19477
+ id: "aisdlc-inspector",
19478
+ title: "360\xB0 Traceability Inspector & Graph Navigator",
19479
+ description: "Interactive technical inspector and graph navigator across AI-SDLC requirements (FR-*, QR-*, SEC-REQ-*, PRIV-REQ-*), architecture components (CMP-*, ADR-*), SDD tasks (TSK-*, CHG-*), test suites, and source code files. Provides concise technical summaries, upstream/downstream traceability mappings, and selectable navigation loops.",
19480
+ 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).",
19481
+ globs: "specs/**, architecture/**, src/**, packages/**, tests/**",
19482
+ 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.'
19395
19483
  }
19396
19484
  ];
19397
19485
  function renderAntigravitySkillFile(skill) {
@@ -19562,10 +19650,11 @@ This file defines the operational rules and specialized role mappings for Google
19562
19650
 
19563
19651
  ## 3. Git 4-Tier Hierarchy and Commit Conventions
19564
19652
  - \`task/<PARENT-ID>/<TSK-ID>-<slug>\` $\\rightarrow$ \`feat/<FEAT-ID>-<slug>\` $\\rightarrow$ \`release/vX.Y.Z\` $\\rightarrow$ \`main\`.
19565
- - 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\`):
19653
+ - 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):
19566
19654
  \`\`\`text
19567
19655
  Author-Type: agent
19568
19656
  AI-Model: <active-model>
19657
+ AI-Reasoning-Effort: <low|medium|high|max>
19569
19658
  Task-ID: TSK-XXX
19570
19659
  Change-ID: CHG-XXX
19571
19660
  \`\`\`
@@ -19817,6 +19906,7 @@ Body explaining the motivation and technical justification of the change.
19817
19906
 
19818
19907
  Author-Type: agent
19819
19908
  AI-Model: claude-3-7-sonnet
19909
+ AI-Reasoning-Effort: high
19820
19910
  Task-ID: TSK-001
19821
19911
  Change-ID: CHG-026-AGENT-NATIVE-CONFIGS
19822
19912
  \`\`\`
@@ -25413,6 +25503,7 @@ exports.maskSecret = maskSecret;
25413
25503
  exports.mergeSbomGaps = mergeSbomGaps;
25414
25504
  exports.normalizeIdentifierToSnakeCase = normalizeIdentifierToSnakeCase;
25415
25505
  exports.normalizePath = normalizePath;
25506
+ exports.normalizeReasoningEffort = normalizeReasoningEffort;
25416
25507
  exports.normalizeScaffoldLanguages = normalizeScaffoldLanguages;
25417
25508
  exports.normalizeSpdxLicense = normalizeSpdxLicense;
25418
25509
  exports.normalizeUri = normalizeUri;