pi-gitbox 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
@@ -113,9 +113,9 @@ Set `bypassPaths: true` to skip this check entirely.
113
113
 
114
114
  ## How It Works
115
115
 
116
- 1. **Session Start** — On `session_start`, the extension verifies that `git` is available and checks if the current directory is a git repository
116
+ 1. **Session Start** — On `session_start`, the extension checks whether the current directory is a git repository with `git` available
117
117
  2. **Gitignored Path Detection** — Uses git-specific commands to discover all gitignored files and directories
118
- 3. **Gitbox Creation** — Creates a private directory at `~/.pi/agent/gitbox/<project-name>` and mirrors gitignored paths into it: files get placeholder content (`{}` for `.json` and ` ` (empty space) for others)
118
+ 3. **Gitbox Creation** — If the directory is a git repository, creates a private directory at `~/.pi/agent/gitbox/<project-name>` and mirrors gitignored paths into it: files get placeholder content (`{}` for `.json` and ` ` (empty space) for others)
119
119
  4. **Path Mapping** — Builds a mapper from original absolute paths to their impersonated counterparts
120
120
  5. **Event Interception** — On every `tool_call` event:
121
121
  - **Bash commands** — Extracts paths from the command using `shell-quote`, checks directory restrictions, then rewrites paths to their impersonated versions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-gitbox",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Pi extension that impersonates gitignored paths to reduce secrets exposure.",
5
5
  "keywords": [
6
6
  "pi",
@@ -32,7 +32,7 @@
32
32
  "@earendil-works/pi-tui": "*"
33
33
  },
34
34
  "devDependencies": {
35
- "@types/node": "^25.9.3",
35
+ "@types/node": "^26.0.0",
36
36
  "@types/shell-quote": "^1.7.5",
37
37
  "prettier-plugin-organize-imports": "^4.3.0"
38
38
  },
package/src/commands.ts CHANGED
@@ -100,8 +100,8 @@ export class CommandManager {
100
100
  const key: string = Object.values(Options).find((o) => o === id)!;
101
101
  await settings.setConfig({ [key]: newValue === "on" });
102
102
 
103
- // Update the status bar with the new status
104
- await this.gitbox.setStatus(ctx);
103
+ // Re-initialize to pick up the new configuration
104
+ await this.gitbox.initialize(ctx);
105
105
  }
106
106
 
107
107
  /**
package/src/gitbox.ts CHANGED
@@ -18,14 +18,14 @@ export class Gitbox {
18
18
  async initialize(ctx: ExtensionContext) {
19
19
  await this.verifySettings(ctx);
20
20
 
21
- if (!Detector.isGitAvailable()) {
22
- await this.setStatus(ctx);
23
- return;
21
+ // Only create the gitbox folder if it makes sense
22
+ const status = await this.getStatus();
23
+ if (status === Status.AVAILABLE || status === Status.ENABLED) {
24
+ await this.impersonator.initialize(ctx);
25
+ await this.getOrCreate(ctx);
24
26
  }
25
27
 
26
- await this.impersonator.initialize(ctx);
27
- await this.getOrCreate(ctx);
28
- await this.setStatus(ctx);
28
+ await Renderer.setStatus(ctx, status);
29
29
  }
30
30
 
31
31
  async shutdown(ctx: ExtensionContext) {
@@ -166,15 +166,4 @@ export class Gitbox {
166
166
 
167
167
  return Status.ENABLED;
168
168
  }
169
-
170
- /**
171
- * Sets the current status in the status bar.
172
- * No-op if the settings prevent it.
173
- *
174
- * @param ctx The extension context
175
- */
176
- async setStatus(ctx: ExtensionContext) {
177
- const status = await this.getStatus();
178
- await Renderer.setStatus(ctx, status);
179
- }
180
169
  }