@d3ara1n/pi-hashline-edit 0.3.3 → 0.3.4
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/package.json +1 -1
- package/src/pi/config.ts +1 -7
- package/src/pi/grep-tool.ts +2 -2
package/package.json
CHANGED
package/src/pi/config.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module pi-hashline-edit/pi
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import { getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
9
10
|
import * as fs from "node:fs";
|
|
10
|
-
import * as os from "node:os";
|
|
11
11
|
import * as path from "node:path";
|
|
12
12
|
|
|
13
13
|
export interface HashlineEditConfig {
|
|
@@ -21,12 +21,6 @@ export interface HashlineEditConfig {
|
|
|
21
21
|
|
|
22
22
|
const DEFAULT_CONFIG: HashlineEditConfig = { enabled: true, hashLen: 4, shiftRadius: 15 };
|
|
23
23
|
|
|
24
|
-
function getAgentDir(): string {
|
|
25
|
-
const envDir = process.env.PI_AGENT_DIR;
|
|
26
|
-
if (envDir) return envDir;
|
|
27
|
-
return path.join(os.homedir(), ".pi", "agent");
|
|
28
|
-
}
|
|
29
|
-
|
|
30
24
|
/** Parse JSON directly without stripping comments (standard JSON forbids comments; on error fall back to default). */
|
|
31
25
|
function readSettings(filePath: string): Record<string, unknown> {
|
|
32
26
|
try {
|
package/src/pi/grep-tool.ts
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import {
|
|
20
|
+
getAgentDir,
|
|
20
21
|
createGrepTool,
|
|
21
22
|
truncateHead,
|
|
22
23
|
truncateLine,
|
|
@@ -28,7 +29,6 @@ import { spawn } from "node:child_process";
|
|
|
28
29
|
import { createInterface } from "node:readline";
|
|
29
30
|
import { access, constants, readFile, stat } from "node:fs/promises";
|
|
30
31
|
import { basename, delimiter, join, relative } from "node:path";
|
|
31
|
-
import { homedir } from "node:os";
|
|
32
32
|
import { hashFileLines } from "../core/hash.ts";
|
|
33
33
|
import { splitLines } from "../core/lines.ts";
|
|
34
34
|
import { getState } from "./state.ts";
|
|
@@ -41,7 +41,7 @@ const GREP_MAX_LINE_LENGTH = 500;
|
|
|
41
41
|
|
|
42
42
|
/** Locate ripgrep: pi's bundled bin first, then PATH. Returns null if not found. */
|
|
43
43
|
async function findRg(): Promise<string | null> {
|
|
44
|
-
const agentDir =
|
|
44
|
+
const agentDir = getAgentDir();
|
|
45
45
|
const piRg = join(agentDir, "bin", "rg");
|
|
46
46
|
try {
|
|
47
47
|
await access(piRg, constants.X_OK);
|