paqad-ai 1.75.1 → 1.75.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # paqad-ai
2
2
 
3
+ ## 1.75.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 36bcf08: fix(#450): `loadChangeEvidence` now reconciles the session change-artifact
8
+ (`.paqad/session/changed-files.json`) against git before trusting it. A stale
9
+ artifact left over from an already-delivered change (its files committed and
10
+ clean in the working tree) is no longer attributed to a later, unrelated
11
+ session — which previously forced the full feature-development stage gate and a
12
+ `paqad-ai checks run` onto out-of-scope turns (e.g. a docs-only session). An
13
+ artifact entry is now kept only when git still considers it part of the current
14
+ change: dirty in the working tree, or committed on this branch since the
15
+ merge-base with the base branch. When every entry is stale, evidence falls
16
+ through to `git status`; when git cannot be read or has no base branch,
17
+ behavior is unchanged (the artifact is trusted). The fix is at the shared
18
+ `loadChangeEvidence` chokepoint, so every consumer (completion backstop, checks,
19
+ RAG, duplication, rule-scripts) is corrected at once.
20
+
3
21
  ## 1.75.1
4
22
 
5
23
  ### Patch Changes
package/dist/cli/index.js CHANGED
@@ -26051,6 +26051,7 @@ ${lines.join("\n")}
26051
26051
  // src/pipeline/change-evidence.ts
26052
26052
  init_esm_shims();
26053
26053
  init_paths();
26054
+ init_git_state();
26054
26055
  import { existsSync as existsSync45 } from "fs";
26055
26056
  import { readFile as readFile39 } from "fs/promises";
26056
26057
  import { join as join99 } from "path";
@@ -26058,7 +26059,10 @@ import { execa as execa3 } from "execa";
26058
26059
  async function loadChangeEvidence(projectRoot) {
26059
26060
  const tracked = await readTrackedFiles(projectRoot);
26060
26061
  if (tracked.length > 0) {
26061
- return { files: tracked, source: "session-artifact" };
26062
+ const reconciled = await reconcileTrackedWithGit(projectRoot, tracked);
26063
+ if (reconciled.length > 0) {
26064
+ return { files: reconciled, source: "session-artifact" };
26065
+ }
26062
26066
  }
26063
26067
  const gitFiles = await readGitStatusFiles(projectRoot);
26064
26068
  if (gitFiles.length > 0) {
@@ -26066,6 +26070,40 @@ async function loadChangeEvidence(projectRoot) {
26066
26070
  }
26067
26071
  return { files: [], source: "none" };
26068
26072
  }
26073
+ async function reconcileTrackedWithGit(projectRoot, tracked) {
26074
+ const changed = await gitChangedSet(projectRoot);
26075
+ if (changed === null) {
26076
+ return tracked;
26077
+ }
26078
+ return tracked.filter((filePath) => changed.has(filePath));
26079
+ }
26080
+ async function gitChangedSet(projectRoot) {
26081
+ const gitState = readGitState(projectRoot);
26082
+ if (!gitState.head_commit || !gitState.base_commit) {
26083
+ return null;
26084
+ }
26085
+ const [statusFiles, committedFiles] = await Promise.all([
26086
+ readGitStatusFiles(projectRoot),
26087
+ readCommittedSinceBase(projectRoot, gitState.base_commit)
26088
+ ]);
26089
+ return /* @__PURE__ */ new Set([...statusFiles, ...committedFiles]);
26090
+ }
26091
+ async function readCommittedSinceBase(projectRoot, baseCommit) {
26092
+ try {
26093
+ const result = await execa3("git", ["diff", "--name-only", `${baseCommit}..HEAD`], {
26094
+ cwd: projectRoot,
26095
+ reject: false
26096
+ });
26097
+ if (result.exitCode !== 0) {
26098
+ return [];
26099
+ }
26100
+ return normalizePaths(
26101
+ result.stdout.split("\n").map((line) => line.trim()).filter(Boolean)
26102
+ );
26103
+ } catch {
26104
+ return [];
26105
+ }
26106
+ }
26069
26107
  async function readTrackedFiles(projectRoot) {
26070
26108
  const target = join99(projectRoot, PATHS.CHANGED_FILES);
26071
26109
  if (!existsSync45(target)) {
@@ -35055,7 +35093,7 @@ init_cancelled_error();
35055
35093
  init_events();
35056
35094
 
35057
35095
  // src/index.ts
35058
- var VERSION = "1.75.1";
35096
+ var VERSION = "1.75.2";
35059
35097
 
35060
35098
  // src/cli/commands/audit.ts
35061
35099
  init_esm_shims();