pi-local-agents-only 0.1.19 → 0.1.21
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 +11 -0
- package/README.md +1 -1
- package/extensions/local-agents-only.js +16 -18
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.1.21 - 2026-06-22
|
|
6
|
+
|
|
7
|
+
- updated the local pi development baseline to `@earendil-works/pi-coding-agent` `0.79.10` and refreshed the npm lockfile
|
|
8
|
+
- refreshed the README compatibility note for pi `0.79.10` and removed the obsolete fleet-tested marker
|
|
9
|
+
- validated with `npm run check` and an isolated Pi package-load smoke under pi `0.79.10`
|
|
10
|
+
|
|
11
|
+
## 0.1.20 - 2026-06-15
|
|
12
|
+
|
|
13
|
+
- updated the local pi development baseline to `@earendil-works/pi-coding-agent` `0.79.4` and refreshed the npm lockfile
|
|
14
|
+
- validated project-trust no-UI/global-block stripping behavior and package load under pi `0.79.4`
|
|
15
|
+
|
|
5
16
|
## 0.1.19 - 2026-06-04
|
|
6
17
|
|
|
7
18
|
- updated the local pi development baseline to `@earendil-works/pi-coding-agent` `0.78.1` and regenerated the npm lockfile
|
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Or install it directly from GitHub with pi:
|
|
|
16
16
|
pi install https://github.com/fitchmultz/pi-local-agents-only
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
Compatibility note: this package is currently tested against pi `0.
|
|
19
|
+
Compatibility note: this package is currently tested against pi `0.79.10` as the suggested floor, and pi-bundled runtime packages are declared as optional wildcard peers. That keeps installs forward-open for future pi releases: npm peer ranges should not block users from trying a newer pi, though runtime behavior is only verified against the tested baseline until a follow-up package release confirms it.
|
|
20
20
|
|
|
21
21
|
## Use
|
|
22
22
|
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
import { execFileSync } from "node:child_process";
|
|
12
12
|
import { closeSync, existsSync, fsyncSync, mkdirSync, openSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
13
|
-
import { homedir } from "node:os";
|
|
14
13
|
import { dirname, join, resolve } from "node:path";
|
|
14
|
+
import { CONFIG_DIR_NAME, getAgentDir as getPiAgentDir } from "@earendil-works/pi-coding-agent";
|
|
15
15
|
|
|
16
16
|
/** @typedef {import("@earendil-works/pi-coding-agent").ExtensionAPI} ExtensionAPI */
|
|
17
17
|
/** @typedef {import("@earendil-works/pi-coding-agent").ExtensionContext} ExtensionContext */
|
|
@@ -33,7 +33,7 @@ class ConfigError extends Error {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
const COMMAND = "local-agents-only";
|
|
36
|
-
const MARKER = join(
|
|
36
|
+
const MARKER = join(CONFIG_DIR_NAME, COMMAND);
|
|
37
37
|
const GLOBAL_CONTEXT_FILES = ["AGENTS.md", "CLAUDE.md"];
|
|
38
38
|
const ENV_TRUE = ["1", "true", "yes", "on"];
|
|
39
39
|
const ENV_FALSE = ["0", "false", "no", "off"];
|
|
@@ -44,16 +44,7 @@ const CONTEXT_XML_BLOCK = /<project_instructions path="([^"]+(?:AGENTS|CLAUDE)\.
|
|
|
44
44
|
const emptyConfig = () => ({ projects: [], repositories: [] });
|
|
45
45
|
|
|
46
46
|
/** @returns {string} */
|
|
47
|
-
const getAgentDir = () =>
|
|
48
|
-
const env = process.env.PI_CODING_AGENT_DIR;
|
|
49
|
-
if (env === "~") {
|
|
50
|
-
return homedir();
|
|
51
|
-
}
|
|
52
|
-
if (env?.startsWith("~/")) {
|
|
53
|
-
return join(homedir(), env.slice(2));
|
|
54
|
-
}
|
|
55
|
-
return env || join(homedir(), ".pi", "agent");
|
|
56
|
-
};
|
|
47
|
+
const getAgentDir = () => getPiAgentDir();
|
|
57
48
|
|
|
58
49
|
/** @param {string} path */
|
|
59
50
|
const normalizePath = (path) => resolve(path).replace(/\\/g, "/");
|
|
@@ -360,7 +351,7 @@ const getProjectState = (start = process.cwd()) => {
|
|
|
360
351
|
gitTopLevel ||
|
|
361
352
|
walkUp(normalizedStart, (dir) => existsSync(getMarkerPath(dir))) ||
|
|
362
353
|
walkUp(normalizedStart, (dir) => {
|
|
363
|
-
const piDir = join(dir,
|
|
354
|
+
const piDir = join(dir, CONFIG_DIR_NAME);
|
|
364
355
|
return existsSync(piDir) && !isGlobalPiDirectory(piDir);
|
|
365
356
|
}) ||
|
|
366
357
|
normalizedStart;
|
|
@@ -428,12 +419,18 @@ const applyLocalOnlyPrompt = (prompt, agentDir = getAgentDir(), systemPromptOpti
|
|
|
428
419
|
return notice ? `${stripped}\n\n${notice}` : stripped;
|
|
429
420
|
};
|
|
430
421
|
|
|
422
|
+
/** @param {ExtensionContext} ctx */
|
|
423
|
+
const isProjectTrusted = (ctx) => typeof ctx.isProjectTrusted === "function" ? ctx.isProjectTrusted() : true;
|
|
424
|
+
|
|
425
|
+
/** @param {ExtensionContext} ctx */
|
|
426
|
+
const getTrustedMode = (ctx) => getMode(ctx.cwd, undefined, undefined, { projectTrusted: isProjectTrusted(ctx) });
|
|
427
|
+
|
|
431
428
|
/** @param {ExtensionContext} ctx */
|
|
432
429
|
const setStatus = (ctx) => {
|
|
433
430
|
if (!ctx.hasUI) {
|
|
434
431
|
return;
|
|
435
432
|
}
|
|
436
|
-
const mode =
|
|
433
|
+
const mode = getTrustedMode(ctx);
|
|
437
434
|
ctx.ui.setStatus(COMMAND, mode.enabled ? `AGENTS: local-only (${mode.source})` : undefined);
|
|
438
435
|
};
|
|
439
436
|
|
|
@@ -497,15 +494,16 @@ export function findProjectRoot(start = process.cwd()) {
|
|
|
497
494
|
* @param {string | ProjectState} [start]
|
|
498
495
|
* @param {string | undefined} [envValue]
|
|
499
496
|
* @param {string} [configPath]
|
|
497
|
+
* @param {{ projectTrusted?: boolean }} [options]
|
|
500
498
|
* @returns {Mode}
|
|
501
499
|
*/
|
|
502
|
-
export function getMode(start = process.cwd(), envValue = process.env.PI_LOCAL_AGENTS_ONLY, configPath = CONFIG()) {
|
|
500
|
+
export function getMode(start = process.cwd(), envValue = process.env.PI_LOCAL_AGENTS_ONLY, configPath = CONFIG(), options = {}) {
|
|
503
501
|
const state = typeof start === "string" ? getProjectState(start) : start;
|
|
504
502
|
const envToggle = getEnvToggle(envValue);
|
|
505
503
|
if (envToggle !== undefined) {
|
|
506
504
|
return { enabled: envToggle, source: "env" };
|
|
507
505
|
}
|
|
508
|
-
if (hasMarker(state)) {
|
|
506
|
+
if (options.projectTrusted !== false && hasMarker(state)) {
|
|
509
507
|
return { enabled: true, source: "marker" };
|
|
510
508
|
}
|
|
511
509
|
const { projects, repositories } = readConfig(configPath);
|
|
@@ -576,7 +574,7 @@ export default function localAgentsOnly(pi) {
|
|
|
576
574
|
return;
|
|
577
575
|
}
|
|
578
576
|
case "status": {
|
|
579
|
-
const mode = getMode(state);
|
|
577
|
+
const mode = getMode(state, undefined, undefined, { projectTrusted: isProjectTrusted(ctx) });
|
|
580
578
|
ctx.ui.notify(
|
|
581
579
|
`local-agents-only: ${mode.enabled ? `enabled via ${mode.source}` : "disabled"} (${state.projectRoot})`,
|
|
582
580
|
"info",
|
|
@@ -600,7 +598,7 @@ export default function localAgentsOnly(pi) {
|
|
|
600
598
|
});
|
|
601
599
|
|
|
602
600
|
pi.on("before_agent_start", (event, ctx) => {
|
|
603
|
-
return
|
|
601
|
+
return getTrustedMode(ctx).enabled
|
|
604
602
|
? { systemPrompt: applyLocalOnlyPrompt(event.systemPrompt, getAgentDir(), event.systemPromptOptions) }
|
|
605
603
|
: undefined;
|
|
606
604
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-local-agents-only",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "Pi extension that strips global AGENTS.md and CLAUDE.md from the effective prompt for selected projects.",
|
|
5
5
|
"author": "Mitch Fultz (https://github.com/fitchmultz)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"prepublishOnly": "npm run check"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
40
|
+
"@earendil-works/pi-coding-agent": "^0.79.10",
|
|
41
41
|
"@types/node": "^25.9.1",
|
|
42
42
|
"typescript": "^6.0.3"
|
|
43
43
|
},
|