@inceptionstack/pi-hard-no 1.0.2 → 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/architect.ts +10 -5
- 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/prompt.ts +17 -5
- package/reviewer.ts +1 -1
- package/session-kind.ts +1 -1
package/architect.ts
CHANGED
|
@@ -44,11 +44,16 @@ You have tools available (read, bash, grep, find, ls) to explore the full codeba
|
|
|
44
44
|
- Do public APIs have adequate comments/types?
|
|
45
45
|
- Are new files/modules properly documented?
|
|
46
46
|
|
|
47
|
-
## Response format
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
## Response format — terse, technical, low-bandwidth
|
|
48
|
+
|
|
49
|
+
LGTM or bullets. Nothing else. Agent reads this, not a human — minimum words, maximum signal.
|
|
50
|
+
|
|
51
|
+
- If everything is fine: one line — "LGTM — architecture looks solid."
|
|
52
|
+
- Otherwise: bullet per issue, each: **<severity>:** <area/file> — <problem>; <fix>.
|
|
53
|
+
- Max 3 lines per issue, 1 line preferred.
|
|
54
|
+
- No preamble, no recap of what you checked, no praise.
|
|
55
|
+
- Skip anything already fixed in mini-reviews.
|
|
56
|
+
- Technical shorthand OK (race, coupling, leak, god-object, dead code).`;
|
|
52
57
|
|
|
53
58
|
/**
|
|
54
59
|
* Load architect review rules from .hardno/architect.md.
|
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/prompt.ts
CHANGED
|
@@ -70,21 +70,33 @@ export const DEFAULT_AUTO_REVIEW_RULES = `## What to review (in priority order)
|
|
|
70
70
|
|
|
71
71
|
// ── Part 3: Suffix (always included, not user-editable) ──
|
|
72
72
|
|
|
73
|
-
export const PROMPT_SUFFIX = `##
|
|
73
|
+
export const PROMPT_SUFFIX = `## Output style — terse, technical, low-bandwidth
|
|
74
|
+
|
|
75
|
+
Write as if on a slow link: minimum words, maximum signal. The agent reads this,
|
|
76
|
+
not a human skimming prose.
|
|
77
|
+
|
|
78
|
+
- Max 3 lines per issue. One line if location + problem + fix fits in one.
|
|
79
|
+
- Each issue = location · problem · fix. Nothing else.
|
|
80
|
+
- No preamble, no recap, no "I noticed", no "consider", no hedging.
|
|
81
|
+
- Technical shorthand OK (e.g. "OBO", "race", "null deref", "unbounded loop").
|
|
82
|
+
- Don't restate code — point to it by file:line.
|
|
83
|
+
- Don't explain why the rule exists. Just the hit.
|
|
84
|
+
|
|
85
|
+
## Response format
|
|
74
86
|
|
|
75
87
|
Your response MUST follow this exact structure:
|
|
76
88
|
|
|
77
|
-
1. (If issues found) List of bullet points, each: - **<Severity>:** <file/location> — <
|
|
89
|
+
1. (If issues found) List of bullet points, each: - **<Severity>:** <file/location> — <problem>; <fix>
|
|
78
90
|
Severity is one of: High, Medium, Low.
|
|
79
91
|
2. (If no issues) Write a single line: No issues found.
|
|
80
92
|
3. On the final line of your response, output exactly ONE of these verdict tags:
|
|
81
93
|
- <verdict>LGTM</verdict> — if no real bugs were found
|
|
82
94
|
- <verdict>ISSUES_FOUND</verdict> — if you flagged any issue above
|
|
83
95
|
|
|
84
|
-
## Example — issues found
|
|
96
|
+
## Example — issues found (terse)
|
|
85
97
|
|
|
86
|
-
- **High:** test-bugs.ts:12 —
|
|
87
|
-
- **High:** test-bugs.ts:6 —
|
|
98
|
+
- **High:** test-bugs.ts:12 — OBO in \`for (i<=len)\`; use \`<\`.
|
|
99
|
+
- **High:** test-bugs.ts:6 — hardcoded key \`sk-prod-…\`; move to env.
|
|
88
100
|
|
|
89
101
|
<verdict>ISSUES_FOUND</verdict>
|
|
90
102
|
|
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
|
|