@inceptionstack/pi-hard-no 1.0.3 → 1.1.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/changes.ts +10 -1
- package/commands.ts +1 -1
- package/context.ts +9 -3
- package/git-roots.ts +1 -1
- package/index.ts +1 -1
- package/judge.ts +1 -1
- package/message-sender.ts +1 -1
- package/package.json +3 -3
- package/reviewer.ts +1 -1
- package/session-kind.ts +1 -1
package/changes.ts
CHANGED
|
@@ -370,7 +370,16 @@ export function hasGitCommitCommand(toolCalls: TrackedToolCall[]): boolean {
|
|
|
370
370
|
return toolCalls.some((tc) => {
|
|
371
371
|
if (tc.name !== "bash") return false;
|
|
372
372
|
const cmd = String(tc.input?.command ?? "");
|
|
373
|
-
|
|
373
|
+
// Direct: git commit
|
|
374
|
+
if (/\bgit(?:\s+-C\s+\S+)?\s+commit\b/.test(cmd)) return true;
|
|
375
|
+
// Subprocess wrapper: perl/python/node/ruby calling git commit
|
|
376
|
+
if (
|
|
377
|
+
/\b(?:python3?|node|perl|ruby)\b/.test(cmd) &&
|
|
378
|
+
/\bgit\b/.test(cmd) &&
|
|
379
|
+
/\bcommit\b/.test(cmd)
|
|
380
|
+
)
|
|
381
|
+
return true;
|
|
382
|
+
return false;
|
|
374
383
|
});
|
|
375
384
|
}
|
|
376
385
|
|
package/commands.ts
CHANGED
package/context.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Falls back gracefully when git is unavailable.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { ExtensionAPI } from "@
|
|
9
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
10
10
|
import { truncateDiff } from "./helpers";
|
|
11
11
|
import { filterIgnored } from "./ignore";
|
|
12
12
|
import { log } from "./logger";
|
|
@@ -627,6 +627,12 @@ export async function getBestReviewContent(
|
|
|
627
627
|
|
|
628
628
|
const allowLastCommitFallback = hasGitCommitCommand(agentToolCalls);
|
|
629
629
|
|
|
630
|
+
// Also allow last-commit fallback when the agent modified files via edit/write
|
|
631
|
+
// tools but the working tree is clean (implying an undetected commit occurred,
|
|
632
|
+
// e.g. via subprocess wrapper that evaded hasGitCommitCommand detection).
|
|
633
|
+
const agentModifiedFiles = agentToolCalls.some((tc) => tc.name === "write" || tc.name === "edit");
|
|
634
|
+
const shouldFallbackToLastCommit = allowLastCommitFallback || agentModifiedFiles;
|
|
635
|
+
|
|
630
636
|
if (gitRoots && gitRoots.size > 0) {
|
|
631
637
|
const result = await getContentFromGitRoots(
|
|
632
638
|
pi,
|
|
@@ -635,7 +641,7 @@ export async function getBestReviewContent(
|
|
|
635
641
|
summarySection,
|
|
636
642
|
onStatus,
|
|
637
643
|
lim,
|
|
638
|
-
|
|
644
|
+
shouldFallbackToLastCommit,
|
|
639
645
|
);
|
|
640
646
|
if (result) return result;
|
|
641
647
|
}
|
|
@@ -643,7 +649,7 @@ export async function getBestReviewContent(
|
|
|
643
649
|
const cwdResult = await getContentFromCwd(pi, ignorePatterns, summarySection, onStatus, lim);
|
|
644
650
|
if (cwdResult) return cwdResult;
|
|
645
651
|
|
|
646
|
-
if (
|
|
652
|
+
if (shouldFallbackToLastCommit) {
|
|
647
653
|
const lastCommitResult = await getContentFromLastCommit(
|
|
648
654
|
pi,
|
|
649
655
|
ignorePatterns,
|
package/git-roots.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { dirname, resolve, isAbsolute } from "node:path";
|
|
8
8
|
import { homedir } from "node:os";
|
|
9
|
-
import type { ExtensionAPI } from "@
|
|
9
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Find the git repo root for a given directory.
|
package/index.ts
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* or: cp index.ts ~/.pi/agent/extensions/pi-hard-no.ts
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import { type ExtensionAPI, isToolCallEventType } from "@
|
|
24
|
+
import { type ExtensionAPI, isToolCallEventType } from "@earendil-works/pi-coding-agent";
|
|
25
25
|
|
|
26
26
|
import {
|
|
27
27
|
type AutoReviewSettings,
|
package/judge.ts
CHANGED
package/message-sender.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inceptionstack/pi-hard-no",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Pi extension — automatic code review after every agent turn",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"check": "npm run typecheck && npm run lint && npm run format:check && npm run test"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@
|
|
43
|
+
"@earendil-works/pi-coding-agent": "*"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@eslint/js": "^9.27.0",
|
|
47
|
-
"@
|
|
47
|
+
"@earendil-works/pi-coding-agent": "^0.74.0",
|
|
48
48
|
"@types/node": "^22.15.17",
|
|
49
49
|
"eslint": "^9.27.0",
|
|
50
50
|
"prettier": "^3.5.3",
|
package/reviewer.ts
CHANGED
package/session-kind.ts
CHANGED
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
* using distinct mock objects stay isolated without an explicit reset.
|
|
53
53
|
*/
|
|
54
54
|
|
|
55
|
-
import type { ExtensionAPI } from "@
|
|
55
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
56
56
|
|
|
57
57
|
import { log } from "./logger";
|
|
58
58
|
|