opencode-add-dir 1.3.0 → 1.3.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.
Files changed (2) hide show
  1. package/README.md +12 -31
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -31,7 +31,6 @@ Automatically adds the plugin to your global `opencode.json`.
31
31
  <summary>Alternative: local file</summary>
32
32
 
33
33
  ```bash
34
- # Clone and build
35
34
  git clone https://github.com/kuzeofficial/add-dir-opencode.git
36
35
  cd add-dir-opencode
37
36
  bun install && bun run deploy
@@ -41,27 +40,15 @@ Bundles to `~/.config/opencode/plugins/add-dir.js`.
41
40
 
42
41
  </details>
43
42
 
44
- ## Usage
45
-
46
- ### Slash Command
43
+ ## Commands
47
44
 
48
45
  ```
49
- /add-dir /path/to/directory # Session only
46
+ /add-dir /path/to/directory # Add for this session
50
47
  /add-dir /path/to/directory --remember # Persist across sessions
51
- /add-dir list # Show added directories
52
- /add-dir remove /path/to/directory # Remove a directory
48
+ /list-dir # Show added directories
49
+ /remove-dir /path/to/directory # Remove a directory
53
50
  ```
54
51
 
55
- ### LLM Tools
56
-
57
- The agent can also call these tools directly:
58
-
59
- | Tool | Description |
60
- |------|-------------|
61
- | `add_dir` | Add a directory (with optional `remember` flag) |
62
- | `list_dirs` | List all added directories |
63
- | `remove_dir` | Remove a directory |
64
-
65
52
  ## How It Works
66
53
 
67
54
  The plugin uses a layered approach to handle permissions across all sessions, including subagents:
@@ -69,13 +56,13 @@ The plugin uses a layered approach to handle permissions across all sessions, in
69
56
  | Layer | When | Scope |
70
57
  |-------|------|-------|
71
58
  | **Config hook** | Startup | Injects `external_directory: "allow"` rules for persisted dirs into all agents |
72
- | **Session permission** | `/add-dir` | Sets `external_directory: true` on the current session via `tools` field |
59
+ | **Session permission** | `/add-dir` | Sets `external_directory: true` on the current session |
73
60
  | **tool.execute.before** | Every file tool | Detects subagent sessions accessing added dirs, grants permission before execution |
74
61
  | **Event auto-approve** | Permission popup | Catches any remaining `external_directory` requests and auto-approves via SDK |
75
62
 
76
- ### AGENTS.md Injection
63
+ ### Context Injection
77
64
 
78
- If an added directory contains `AGENTS.md`, `CLAUDE.md`, or `.agents/AGENTS.md`, the content is automatically injected into the system prompt via `experimental.chat.system.transform`.
65
+ If an added directory contains `AGENTS.md`, `CLAUDE.md`, or `.agents/AGENTS.md`, the content is automatically injected into the system prompt.
79
66
 
80
67
  ## Persistence
81
68
 
@@ -91,7 +78,7 @@ These are loaded at startup and injected into agent permission rules via the con
91
78
 
92
79
  ```bash
93
80
  bun install
94
- bun test # 17 tests
81
+ bun test # 33 tests
95
82
  bun run typecheck # Type check
96
83
  bun run build # Build npm package
97
84
  bun run deploy # Bundle to ~/.config/opencode/plugins/
@@ -102,24 +89,18 @@ bun run deploy # Bundle to ~/.config/opencode/plugins/
102
89
  ```
103
90
  src/
104
91
  ├── index.ts # Entry point (default export)
105
- ├── plugin.ts # Hooks + tools
106
- ├── state.ts # Persistence
92
+ ├── plugin.ts # Hooks + commands
93
+ ├── state.ts # Persistence + path utils
107
94
  ├── validate.ts # Directory validation
108
95
  ├── permissions.ts # Session grants + auto-approve
109
- └── context.ts # AGENTS.md injection
96
+ ├── context.ts # AGENTS.md injection
97
+ └── types.ts # Shared type definitions
110
98
  ```
111
99
 
112
100
  ## Debugging
113
101
 
114
- Run OpenCode with logs:
115
-
116
102
  ```bash
117
103
  opencode --print-logs 2>debug.log
118
- ```
119
-
120
- Filter plugin logs:
121
-
122
- ```bash
123
104
  grep "\[add-dir\]" debug.log
124
105
  ```
125
106
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-add-dir",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Add working directories to your OpenCode session with auto-approved permissions",
5
5
  "author": "Cristian Fonseca <cfonsecacomas@gmail.com>",
6
6
  "type": "module",