pi-hashline-edit-pro 4.3.2 → 4.3.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/README.md +7 -4
- package/index.ts +8 -3
- package/package.json +1 -1
- package/prompts/grep-guidelines.md +0 -1
- package/prompts/grep.md +1 -1
- package/prompts/insert-guidelines.md +1 -2
- package/prompts/insert.md +1 -1
- package/prompts/read-guidelines.md +2 -3
- package/prompts/replace-guidelines.md +4 -4
- package/prompts/replace.md +1 -1
- package/src/auto-read-all-state.ts +13 -0
- package/src/auto-read-all.ts +49 -27
- package/src/batch.ts +23 -32
- package/src/config-ui.ts +79 -7
- package/src/config.ts +35 -0
- package/src/edit-common.ts +25 -7
- package/src/file-reader.ts +2 -3
- package/src/grep.ts +176 -20
- package/src/hash-store.ts +21 -7
- package/src/hashline/apply.ts +1 -1
- package/src/hashline/hash.ts +3 -15
- package/src/hashline/hasher.ts +15 -1
- package/src/insert.ts +1 -1
- package/src/paths.ts +5 -1
- package/src/payload-contract.ts +2 -2
- package/src/read.ts +20 -1
- package/src/replace-undo.ts +10 -4
- package/src/replace.ts +2 -3
- package/src/utils.ts +1 -1
package/src/replace-undo.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { genDiff, genPatch, spansFromHashes } from "./replace-diff";
|
|
|
13
13
|
import { getDiffContextLines } from "./config";
|
|
14
14
|
import { cntDiff, errCode, makePrepareArguments, splitLines } from "./utils";
|
|
15
15
|
import { loadP, loadGuide } from "./prompts";
|
|
16
|
+
import { withUndoPrompts, DEFAULT_EDIT_FLAGS, type EditToolFlags } from "./edit-common";
|
|
16
17
|
import { buildMetrics } from "./replace-response";
|
|
17
18
|
import { renderEditResult, fmtCall } from "./replace-render";
|
|
18
19
|
import { Text } from "@earendil-works/pi-tui";
|
|
@@ -102,13 +103,18 @@ function fallbackFileMode(): number {
|
|
|
102
103
|
return 0o666 & ~process.umask();
|
|
103
104
|
}
|
|
104
105
|
|
|
105
|
-
export function regUndo(pi: ExtensionAPI): void {
|
|
106
|
+
export function regUndo(pi: ExtensionAPI, flags: EditToolFlags = DEFAULT_EDIT_FLAGS): void {
|
|
107
|
+
const prompted = withUndoPrompts({
|
|
108
|
+
description: loadP("../prompts/undo-last-change.md"),
|
|
109
|
+
snippet: loadP("../prompts/undo-last-change-snippet.md"),
|
|
110
|
+
guidelines: loadGuide("../prompts/undo-last-change-guidelines.md"),
|
|
111
|
+
}, flags);
|
|
106
112
|
pi.registerTool({
|
|
107
113
|
name: "undo_last_change",
|
|
108
114
|
label: "Undo Last Change",
|
|
109
|
-
description:
|
|
110
|
-
promptSnippet:
|
|
111
|
-
promptGuidelines:
|
|
115
|
+
description: prompted.description,
|
|
116
|
+
promptSnippet: prompted.snippet,
|
|
117
|
+
promptGuidelines: prompted.guidelines,
|
|
112
118
|
prepareArguments: makePrepareArguments(),
|
|
113
119
|
parameters: Type.Object({
|
|
114
120
|
path: Type.String({
|
package/src/replace.ts
CHANGED
|
@@ -3,7 +3,6 @@ import type {
|
|
|
3
3
|
ToolDefinition,
|
|
4
4
|
} from "@earendil-works/pi-coding-agent";
|
|
5
5
|
import { constants } from "node:fs";
|
|
6
|
-
import { relative } from "node:path";
|
|
7
6
|
import {
|
|
8
7
|
genDiff,
|
|
9
8
|
type DiffSpan,
|
|
@@ -31,7 +30,7 @@ import {
|
|
|
31
30
|
import { loadHashStore, type HashStore } from "./hash-store";
|
|
32
31
|
import { adoptAnchors, servedForPath, withAnchorSession } from "./anchor-registry";
|
|
33
32
|
import { resolveTarget } from "./fs-write";
|
|
34
|
-
import { toCwd } from "./paths";
|
|
33
|
+
import { toCwd, toDisplayPath } from "./paths";
|
|
35
34
|
import { queuedEdit, editToolBase, editRenderCallWrapper, editRenderResultWrapper, resolveEditTargetWithRequirement, throwIfStrictInput, getBoundaryDedupMode, withReplacePrompts, DEFAULT_EDIT_FLAGS, type EditToolFlags } from "./edit-common";
|
|
36
35
|
import { commitEdit, dedupRowsFromFixes } from "./commit";
|
|
37
36
|
import { batchMemberFor, executeBatchMember, noteBatchFailure } from "./batch";
|
|
@@ -148,7 +147,7 @@ export async function execPipeline(
|
|
|
148
147
|
const { normalized: originalNormalized, bom, originalEnding, fileHashes: originalHashes, hadUtf8DecodeErrors, absolutePath, identity } = await readNormFile(
|
|
149
148
|
targetPath, cwd, { signal: options?.signal, accessMode: options?.accessMode, maxLines: MAX_HASH_LINES, store: hashStore, noPersist: options?.noPersist, allocation: options?.noPersist ? "shadow" : "real", preloadedNorm: options?.preloadedNorm },
|
|
150
149
|
);
|
|
151
|
-
const displayPath =
|
|
150
|
+
const displayPath = toDisplayPath(cwd, absolutePath, targetPath);
|
|
152
151
|
|
|
153
152
|
const dedupMode = await getBoundaryDedupMode();
|
|
154
153
|
const effectiveSkipBoundaryDedup = options?.skipBoundaryDedup === true || dedupMode === "off";
|
package/src/utils.ts
CHANGED
|
@@ -137,7 +137,7 @@ export function isHashRow(line: string): boolean {
|
|
|
137
137
|
return /^[A-Za-z0-9]{4}│/.test(line);
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
function gutterWidth(max: number, fallback: number): number {
|
|
140
|
+
export function gutterWidth(max: number, fallback: number): number {
|
|
141
141
|
return String(max || fallback).length;
|
|
142
142
|
}
|
|
143
143
|
|