pi-local-agents-only 0.1.0 → 0.1.1

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 CHANGED
@@ -4,8 +4,16 @@ Use repo-local `AGENTS.md` only for selected projects by stripping global `AGENT
4
4
 
5
5
  ## Install
6
6
 
7
+ Install it from npm with pi:
8
+
9
+ ```bash
10
+ pi install npm:pi-local-agents-only
11
+ ```
12
+
13
+ Or install it directly from GitHub with pi:
14
+
7
15
  ```bash
8
- pi install git:github.com/fitchmultz/pi-local-agents-only
16
+ pi install https://github.com/fitchmultz/pi-local-agents-only
9
17
  ```
10
18
 
11
19
  ## Use
package/package.json CHANGED
@@ -1,9 +1,21 @@
1
1
  {
2
2
  "name": "pi-local-agents-only",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Pi extension that strips global AGENTS.md and CLAUDE.md from the effective prompt for selected projects.",
5
5
  "type": "module",
6
- "keywords": ["pi-package"],
6
+ "keywords": ["pi-package", "pi", "pi-extension", "extension"],
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/fitchmultz/pi-local-agents-only.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/fitchmultz/pi-local-agents-only/issues"
13
+ },
14
+ "homepage": "https://github.com/fitchmultz/pi-local-agents-only#readme",
15
+ "files": ["extensions", "README.md"],
16
+ "peerDependencies": {
17
+ "@mariozechner/pi-coding-agent": "*"
18
+ },
7
19
  "pi": {
8
20
  "extensions": ["./extensions"]
9
21
  },
@@ -1,50 +0,0 @@
1
- /**
2
- * Purpose: Verify the local-agents-only extension's repo detection, activation precedence, and prompt stripping.
3
- * Responsibilities: Test git-root discovery, env and config precedence, and removal of global prompt blocks.
4
- * Scope: Minimal unit tests for the extension's exported helpers.
5
- * Usage: Run `npm test` from the package root.
6
- * Invariants/Assumptions: Tests use temporary directories and do not touch the user's real pi config.
7
- */
8
-
9
- import test from "node:test";
10
- import assert from "node:assert/strict";
11
- import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
12
- import { tmpdir } from "node:os";
13
- import { join } from "node:path";
14
-
15
- import { findProjectRoot, getMode, stripGlobalBlocks } from "../extensions/local-agents-only.js";
16
-
17
- test("findProjectRoot returns the nearest git root", () => {
18
- const root = mkdtempSync(join(tmpdir(), "pi-local-agents-only-root-"));
19
- const nested = join(root, "a", "b");
20
- mkdirSync(join(root, ".git"), { recursive: true });
21
- mkdirSync(nested, { recursive: true });
22
- assert.equal(findProjectRoot(nested), root);
23
- });
24
-
25
- test("getMode prefers env override, then repo marker, then global config", () => {
26
- const root = mkdtempSync(join(tmpdir(), "pi-local-agents-only-mode-"));
27
- const configPath = join(root, "local-agents-only.json");
28
- const markerPath = join(root, ".pi", "local-agents-only");
29
- mkdirSync(join(root, ".pi"), { recursive: true });
30
- writeFileSync(configPath, JSON.stringify({ projects: [root] }));
31
- writeFileSync(markerPath, "\n");
32
- assert.deepEqual(getMode(root, "1", configPath), { enabled: true, source: "env" });
33
- assert.deepEqual(getMode(root, "0", configPath), { enabled: false, source: "env" });
34
- assert.deepEqual(getMode(root, "", configPath), { enabled: true, source: "marker" });
35
- assert.equal(rmSync(markerPath, { force: true }), undefined);
36
- assert.deepEqual(getMode(root, "", configPath), { enabled: true, source: "global-config" });
37
- assert.deepEqual(getMode(mkdtempSync(join(tmpdir(), "pi-local-agents-only-default-")), "", configPath), {
38
- enabled: false,
39
- source: "default",
40
- });
41
- });
42
-
43
- test("stripGlobalBlocks removes global blocks and keeps local AGENTS or CLAUDE context", () => {
44
- const globalAgents = "## /home/me/.pi/agent/AGENTS.md\n\nA\n\n";
45
- const globalClaude = "## /home/me/.pi/agent/CLAUDE.md\n\nB\n\n";
46
- const localAgents = "## /repo/AGENTS.md\n\nLOCAL AGENTS\n\n";
47
- const localClaude = "## /repo/subdir/CLAUDE.md\n\nLOCAL CLAUDE\n\n";
48
- const prompt = `${globalAgents}${globalClaude}${localAgents}${localClaude}`;
49
- assert.equal(stripGlobalBlocks(prompt, [globalAgents, globalClaude]), `${localAgents}${localClaude}`);
50
- });