@aisdlc/core 2.2.1 → 2.2.3

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
@@ -9824,10 +9824,39 @@ function computeReworkRatios(totalTime, totalTokens, totalCost, reworkTime, rewo
9824
9824
  costPercent: totalCost > 0 ? Math.round(reworkCost / totalCost * 1e4) / 100 : 0
9825
9825
  };
9826
9826
  }
9827
- function aggregateReleaseKpis(releaseBranch, baseBranch = "main", options = {}) {
9827
+ function resolveReleaseBaseBranch(release, explicitBase, options = {}) {
9828
9828
  const cwd = options.cwd || process.cwd();
9829
+ if (explicitBase && explicitBase !== release) {
9830
+ return explicitBase;
9831
+ }
9832
+ if (release !== "main" && release !== "master") {
9833
+ return "main";
9834
+ }
9835
+ try {
9836
+ const lastTag = child_process.execFileSync("git", ["describe", "--tags", "--abbrev=0", `${release}^`], {
9837
+ cwd,
9838
+ encoding: "utf-8",
9839
+ stdio: ["pipe", "pipe", "pipe"]
9840
+ }).trim();
9841
+ if (lastTag) return lastTag;
9842
+ } catch {
9843
+ }
9844
+ try {
9845
+ const rootSha = child_process.execFileSync("git", ["rev-list", "--max-parents=0", release], {
9846
+ cwd,
9847
+ encoding: "utf-8",
9848
+ stdio: ["pipe", "pipe", "pipe"]
9849
+ }).trim().split("\n")[0];
9850
+ if (rootSha) return rootSha;
9851
+ } catch {
9852
+ }
9853
+ return release;
9854
+ }
9855
+ function aggregateReleaseKpis(releaseBranch, baseBranch, options = {}) {
9856
+ const cwd = options.cwd || process.cwd();
9857
+ const effectiveBase = resolveReleaseBaseBranch(releaseBranch, baseBranch, { cwd });
9829
9858
  const resolvedRelease = resolveGitRef(cwd, releaseBranch);
9830
- const resolvedBase = resolveGitRef(cwd, baseBranch);
9859
+ const resolvedBase = resolveGitRef(cwd, effectiveBase);
9831
9860
  const records = extractCommitKpisFromRange(resolvedBase, resolvedRelease, options);
9832
9861
  const statsMap = {};
9833
9862
  const bugList = [];
@@ -12400,33 +12429,42 @@ function resolveActiveBranch(rootDir) {
12400
12429
  return "HEAD";
12401
12430
  }
12402
12431
  }
12403
- function resolveDefaultBranchBase(rootDir) {
12432
+ function resolveRootCommit(rootDir, targetRef) {
12404
12433
  try {
12405
- const count = parseInt(
12406
- child_process.execFileSync("git", ["rev-list", "--count", "HEAD"], {
12407
- cwd: rootDir,
12408
- encoding: "utf-8",
12409
- stdio: ["pipe", "pipe", "pipe"]
12410
- }).trim(),
12411
- 10
12412
- );
12413
- if (count <= 20) {
12414
- return child_process.execFileSync("git", ["rev-list", "--max-parents=0", "HEAD"], {
12434
+ return child_process.execFileSync("git", ["rev-list", "--max-parents=0", targetRef], {
12435
+ cwd: rootDir,
12436
+ encoding: "utf-8",
12437
+ stdio: ["pipe", "pipe", "pipe"]
12438
+ }).trim().split("\n")[0] || targetRef;
12439
+ } catch {
12440
+ return targetRef;
12441
+ }
12442
+ }
12443
+ function resolveDefaultBranchBase(rootDir, targetRef = "HEAD") {
12444
+ try {
12445
+ const rawCount = child_process.execFileSync("git", ["rev-list", "--count", "--first-parent", targetRef], {
12446
+ cwd: rootDir,
12447
+ encoding: "utf-8",
12448
+ stdio: ["pipe", "pipe", "pipe"]
12449
+ }).trim();
12450
+ const firstParentCount = parseInt(rawCount, 10);
12451
+ if (firstParentCount > 20) {
12452
+ const candidateRef = `${targetRef}~20`;
12453
+ child_process.execFileSync("git", ["rev-parse", "--verify", "--quiet", candidateRef], {
12415
12454
  cwd: rootDir,
12416
- encoding: "utf-8",
12417
12455
  stdio: ["pipe", "pipe", "pipe"]
12418
- }).trim().split("\n")[0];
12456
+ });
12457
+ return candidateRef;
12419
12458
  }
12420
- return "HEAD~20";
12421
12459
  } catch {
12422
- return "HEAD~1";
12423
12460
  }
12461
+ return resolveRootCommit(rootDir, targetRef);
12424
12462
  }
12425
12463
  function resolveActivePrKpi(rootDir, activeBranch) {
12426
12464
  try {
12427
12465
  const isDefaultBranch = activeBranch === "main" || activeBranch === "master";
12428
12466
  if (isDefaultBranch) {
12429
- const base = resolveDefaultBranchBase(rootDir);
12467
+ const base = resolveDefaultBranchBase(rootDir, "HEAD");
12430
12468
  return aggregatePrKpis(base, "HEAD", { cwd: rootDir });
12431
12469
  }
12432
12470
  const prKpi = aggregatePrKpis("main", "HEAD", { cwd: rootDir });
@@ -12481,7 +12519,7 @@ function resolveCandidateBranches(rootDir, activeBranch, history) {
12481
12519
  function fetchBranchKpi(rootDir, branch) {
12482
12520
  try {
12483
12521
  const isDefault = branch === "main" || branch === "master";
12484
- const base = isDefault ? resolveDefaultBranchBase(rootDir) : "main";
12522
+ const base = isDefault ? resolveDefaultBranchBase(rootDir, branch) : "main";
12485
12523
  const kpi = aggregatePrKpis(base, branch, { cwd: rootDir });
12486
12524
  return kpi && kpi.totalCommits > 0 ? kpi : null;
12487
12525
  } catch {
@@ -12987,6 +13025,8 @@ Execute every implementation task following this strict sequential order:
12987
13025
  - **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.
12988
13026
  - **Infrastructure Dependency Policy**: Verify licenses of dependencies, Docker base images, and third-party CI actions against \`license-policy.yaml\`.
12989
13027
  - **Gate Preservation**: Ensure any pipeline optimization keeps all existing deterministic Quality Gates intact.
13028
+ - **Cross-Workflow Audit**: When fixing any CI/CD or configuration defect detected in a PR, search all \`.github/workflows/*.yml\` for the same pattern (including release, post-merge, and publishing pipelines) before declaring the fix complete.
13029
+ - **Remote Verification**: Creating a PR (\`gh pr create\`) does not equal success; actively verify that remote checks pass (\`gh pr checks\`).
12990
13030
  - 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.`
12991
13031
  }
12992
13032
  ];
@@ -13336,6 +13376,8 @@ This file defines the operational rules and specialized role mappings for Google
13336
13376
  - **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.
13337
13377
  - Infrastructure dependency policy: Verify licenses of dependencies, base images, and third-party actions according to \`license-policy.yaml\`.
13338
13378
  - Gate preservation: Ensure pipeline optimizations preserve all existing deterministic Quality Gates intact.
13379
+ - **Cross-Workflow Audit**: When fixing any CI/CD or configuration defect detected in a PR, search all \`.github/workflows/*.yml\` for the same pattern (including release, post-merge, and publishing pipelines) before declaring the fix complete.
13380
+ - **Remote Verification**: Creating a PR (\`gh pr create\`) does not equal success; actively verify that remote checks pass (\`gh pr checks\`).
13339
13381
 
13340
13382
  ---
13341
13383
 
@@ -16098,9 +16140,11 @@ exports.resolveAgentTargets = resolveAgentTargets;
16098
16140
  exports.resolveBranchHierarchy = resolveBranchHierarchy;
16099
16141
  exports.resolveCiEnvironment = resolveCiEnvironment;
16100
16142
  exports.resolveCytoscapePath = resolveCytoscapePath;
16143
+ exports.resolveDefaultBranchBase = resolveDefaultBranchBase;
16101
16144
  exports.resolveFeatureFilePath = resolveFeatureFilePath;
16102
16145
  exports.resolveGitRef = resolveGitRef;
16103
16146
  exports.resolveLicenseFromFile = resolveLicenseFromFile;
16147
+ exports.resolveReleaseBaseBranch = resolveReleaseBaseBranch;
16104
16148
  exports.resolveSastCwe = resolveSastCwe;
16105
16149
  exports.resolveSastOwasp = resolveSastOwasp;
16106
16150
  exports.resolveSchemaForArtifact = resolveSchemaForArtifact;