@oh-my-pi/cli 0.9.1 → 1.3.37

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 (41) hide show
  1. package/README.md +91 -48
  2. package/dist/cli.js +1192 -1045
  3. package/dist/commands/config.d.ts.map +1 -1
  4. package/dist/commands/create.d.ts.map +1 -1
  5. package/dist/commands/doctor.d.ts +0 -2
  6. package/dist/commands/doctor.d.ts.map +1 -1
  7. package/dist/commands/enable.d.ts +2 -2
  8. package/dist/commands/enable.d.ts.map +1 -1
  9. package/dist/commands/env.d.ts.map +1 -1
  10. package/dist/commands/features.d.ts.map +1 -1
  11. package/dist/commands/init.d.ts +1 -1
  12. package/dist/commands/init.d.ts.map +1 -1
  13. package/dist/commands/install.d.ts +0 -2
  14. package/dist/commands/install.d.ts.map +1 -1
  15. package/dist/commands/link.d.ts +0 -2
  16. package/dist/commands/link.d.ts.map +1 -1
  17. package/dist/commands/list.d.ts +0 -2
  18. package/dist/commands/list.d.ts.map +1 -1
  19. package/dist/commands/outdated.d.ts +0 -2
  20. package/dist/commands/outdated.d.ts.map +1 -1
  21. package/dist/commands/uninstall.d.ts +0 -2
  22. package/dist/commands/uninstall.d.ts.map +1 -1
  23. package/dist/commands/update.d.ts +0 -2
  24. package/dist/commands/update.d.ts.map +1 -1
  25. package/dist/commands/why.d.ts +0 -2
  26. package/dist/commands/why.d.ts.map +1 -1
  27. package/dist/loader.d.ts +4 -4
  28. package/dist/loader.d.ts.map +1 -1
  29. package/dist/lock.d.ts +2 -2
  30. package/dist/lock.d.ts.map +1 -1
  31. package/dist/lockfile.d.ts +6 -6
  32. package/dist/lockfile.d.ts.map +1 -1
  33. package/dist/manifest.d.ts +23 -10
  34. package/dist/manifest.d.ts.map +1 -1
  35. package/dist/paths.d.ts +15 -44
  36. package/dist/paths.d.ts.map +1 -1
  37. package/dist/runtime.d.ts +3 -3
  38. package/dist/runtime.d.ts.map +1 -1
  39. package/dist/symlinks.d.ts +12 -7
  40. package/dist/symlinks.d.ts.map +1 -1
  41. package/package.json +1 -1
package/README.md CHANGED
@@ -60,65 +60,74 @@ omp update
60
60
 
61
61
  ## How It Works
62
62
 
63
- omp installs plugins via npm and symlinks their files into your pi configuration directory:
63
+ omp installs plugins globally via npm and sets up your pi configuration:
64
64
 
65
65
  ```
66
66
  ~/.pi/
67
- ├── agent/ # Where plugin files get symlinked
68
- │ ├── agents/ # Agent definitions (.md)
69
- │ ├── commands/ # Slash commands (.md)
70
- │ ├── tools/ # Custom tools (.ts)
71
- │ └── themes/ # Theme files (.json)
72
- └── plugins/ # Plugin storage
73
- ├── package.json # Installed plugins manifest
74
- └── node_modules/ # Actual plugin packages
67
+ ├── agent/ # Pi's agent directory
68
+ │ ├── agents/ # Agent definitions (.md) - symlinked
69
+ │ ├── commands/ # Slash commands (.md) - symlinked
70
+ │ ├── tools/omp/ # Tool loader
71
+ └── index.ts # Generated loader - imports tools from node_modules
72
+ └── themes/ # Theme files (.json) - symlinked
73
+ └── plugins/
74
+ ├── package.json # Installed plugins manifest
75
+ ├── node_modules/ # Plugin packages (tools loaded directly from here)
76
+ └── store/ # Runtime configs (survives npm updates)
75
77
  ```
76
78
 
77
- Plugins declare which files to install via the `omp.install` field in their `package.json`. omp creates symlinks from the plugin's files into the appropriate `~/.pi/agent/` subdirectories.
79
+ **Non-tool files** (agents, commands, themes) are symlinked via `omp.install` entries.
78
80
 
79
- ## Global vs Local Plugins
81
+ **Tools** are loaded directly from node_modules via a generated loader. Plugins specify `omp.tools` pointing to their tool factory. This allows tools to use npm dependencies without workarounds.
80
82
 
81
- omp supports both global and project-local plugin configurations:
83
+ ## Project-Level Overrides
82
84
 
83
- | Scope | Config Location | Agent Directory | Use Case |
84
- | ------ | ---------------- | --------------- | ------------------------ |
85
- | Global | `~/.pi/plugins/` | `~/.pi/agent/` | Personal defaults |
86
- | Local | `.pi/` | `.pi/agent/` | Project-specific plugins |
85
+ While plugins are installed globally, you can customize their behavior per-project using `.pi/overrides.json`:
87
86
 
88
87
  ```bash
89
- # Explicit scope
90
- omp install -g @oh-my-pi/subagents # Global
91
- omp install -l @oh-my-pi/subagents # Local
88
+ # Initialize project overrides
89
+ omp init
92
90
 
93
- # Auto-detect: uses local if .pi/plugins.json exists, otherwise global
94
- omp install @oh-my-pi/subagents
91
+ # Disable a plugin for this project only
92
+ omp disable @oh-my-pi/subagents -l
93
+
94
+ # Enable different features in this project
95
+ omp features @oh-my-pi/exa --set search -l
96
+
97
+ # Override config variables for this project
98
+ omp config @oh-my-pi/exa apiKey sk-project-specific -l
95
99
  ```
96
100
 
97
- Initialize a project-local config with `omp init`.
101
+ Project overrides are stored in:
102
+
103
+ - `.pi/overrides.json` - disabled plugins list
104
+ - `.pi/store/` - feature and config overrides (merged with global, project takes precedence)
105
+
106
+ The loader automatically merges project overrides at runtime.
98
107
 
99
108
  ## Commands
100
109
 
101
- | Command | Alias | Description |
102
- | ---------------------- | ----- | ------------------------------------------------------ |
103
- | `omp install [pkg...]` | `i` | Install plugin(s). No args = install from plugins.json |
104
- | `omp uninstall <pkg>` | `rm` | Remove plugin and its symlinks |
105
- | `omp update [pkg]` | `up` | Update to latest within semver range |
106
- | `omp list` | `ls` | Show installed plugins |
107
- | `omp search <query>` | | Search npm for plugins |
108
- | `omp info <pkg>` | | Show plugin details before install |
109
- | `omp outdated` | | List plugins with newer versions |
110
- | `omp doctor` | | Check for broken symlinks, conflicts |
111
- | `omp link <path>` | | Symlink local plugin (dev mode) |
112
- | `omp create <name>` | | Scaffold new plugin from template |
113
- | `omp init` | | Create .pi/plugins.json in current project |
114
- | `omp why <file>` | | Show which plugin installed a file |
115
- | `omp enable <name>` | | Enable a disabled plugin |
116
- | `omp disable <name>` | | Disable plugin without uninstalling |
117
- | `omp features <name>` | | List or configure plugin features |
118
- | `omp config <name>` | | Get or set plugin configuration variables |
119
- | `omp env` | | Print environment variables for shell eval |
120
-
121
- Most commands accept `-g`/`--global` or `-l`/`--local` flags to override scope auto-detection.
110
+ | Command | Alias | Description |
111
+ | ---------------------- | ----- | -------------------------------------------------------- |
112
+ | `omp install [pkg...]` | `i` | Install plugin(s). No args = install from package.json |
113
+ | `omp uninstall <pkg>` | `rm` | Remove plugin and its symlinks |
114
+ | `omp update [pkg]` | `up` | Update to latest within semver range |
115
+ | `omp list` | `ls` | Show installed plugins |
116
+ | `omp search <query>` | | Search npm for plugins |
117
+ | `omp info <pkg>` | | Show plugin details before install |
118
+ | `omp outdated` | | List plugins with newer versions |
119
+ | `omp doctor` | | Check for broken symlinks, conflicts |
120
+ | `omp link <path>` | | Symlink local plugin (dev mode) |
121
+ | `omp create <name>` | | Scaffold new plugin from template |
122
+ | `omp init` | | Create .pi/overrides.json for project-local config |
123
+ | `omp why <file>` | | Show which plugin installed a file |
124
+ | `omp enable <name>` | | Enable a disabled plugin (-l for project override) |
125
+ | `omp disable <name>` | | Disable plugin without uninstalling (-l for project) |
126
+ | `omp features <name>` | | List or configure plugin features (-l for project) |
127
+ | `omp config <name>` | | Get or set plugin configuration (-l for project) |
128
+ | `omp env` | | Print environment variables for shell eval (-l to merge) |
129
+
130
+ Commands that modify plugin state (enable, disable, features, config, env) accept `-l`/`--local` to use project-level overrides instead of global config.
122
131
 
123
132
  ## Feature Selection
124
133
 
@@ -157,6 +166,9 @@ omp features @oh-my-pi/exa --disable search
157
166
 
158
167
  # Set exact feature list
159
168
  omp features @oh-my-pi/exa --set search,websets
169
+
170
+ # Override features for current project only
171
+ omp features @oh-my-pi/exa --set search -l
160
172
  ```
161
173
 
162
174
  ## Plugin Configuration
@@ -175,6 +187,9 @@ omp config @oh-my-pi/exa apiKey sk-xxx
175
187
 
176
188
  # Reset to default
177
189
  omp config @oh-my-pi/exa apiKey --delete
190
+
191
+ # Override for current project only
192
+ omp config @oh-my-pi/exa apiKey sk-project -l
178
193
  ```
179
194
 
180
195
  Variables with `env` mappings can be exported as environment variables:
@@ -186,6 +201,9 @@ eval "$(omp env)"
186
201
  # Fish shell
187
202
  omp env --fish | source
188
203
 
204
+ # Merge project overrides
205
+ eval "$(omp env -l)"
206
+
189
207
  # Persist in your shell config
190
208
  omp env >> ~/.bashrc
191
209
  ```
@@ -205,10 +223,31 @@ Plugins are npm packages with an `omp` field in `package.json`:
205
223
  { "src": "commands/research.md", "dest": "agent/commands/research.md" }
206
224
  ]
207
225
  },
208
- "files": ["agents", "commands", "tools", "themes"]
226
+ "files": ["agents", "commands"]
209
227
  }
210
228
  ```
211
229
 
230
+ ### Tools
231
+
232
+ For plugins with custom tools, use the `tools` field instead of `install`:
233
+
234
+ ```json
235
+ {
236
+ "name": "@oh-my-pi/my-tools",
237
+ "version": "1.0.0",
238
+ "keywords": ["omp-plugin"],
239
+ "omp": {
240
+ "tools": "tools"
241
+ },
242
+ "files": ["tools"],
243
+ "dependencies": {
244
+ "some-npm-package": "^1.0.0"
245
+ }
246
+ }
247
+ ```
248
+
249
+ The `tools` field points to a directory containing an `index.ts` that exports a tool factory. Tools are loaded directly from node_modules, so npm dependencies work normally.
250
+
212
251
  ### Features and Variables
213
252
 
214
253
  Plugins can define optional features and configurable variables:
@@ -219,7 +258,8 @@ Plugins can define optional features and configurable variables:
219
258
  "version": "1.0.0",
220
259
  "keywords": ["omp-plugin"],
221
260
  "omp": {
222
- "install": [{ "src": "tools/core.ts", "dest": "agent/tools/exa/core.ts" }],
261
+ "tools": "tools",
262
+ "runtime": "tools/runtime.json",
223
263
  "variables": {
224
264
  "apiKey": {
225
265
  "type": "string",
@@ -231,13 +271,11 @@ Plugins can define optional features and configurable variables:
231
271
  "features": {
232
272
  "search": {
233
273
  "description": "Web search capabilities",
234
- "default": true,
235
- "install": [{ "src": "tools/search.ts", "dest": "agent/tools/exa/search.ts" }]
274
+ "default": true
236
275
  },
237
276
  "websets": {
238
277
  "description": "Curated content collections",
239
278
  "default": false,
240
- "install": [{ "src": "tools/websets.ts", "dest": "agent/tools/exa/websets.ts" }],
241
279
  "variables": {
242
280
  "defaultCollection": {
243
281
  "type": "string",
@@ -250,6 +288,8 @@ Plugins can define optional features and configurable variables:
250
288
  }
251
289
  ```
252
290
 
291
+ The `runtime` field points to a JSON file that the plugin imports to check feature state. omp stores user's feature selections in `~/.pi/plugins/store/` and injects them at load time, so they persist across npm updates.
292
+
253
293
  ### Plugin Structure
254
294
 
255
295
  ```
@@ -311,6 +351,9 @@ omp disable @oh-my-pi/subagents
311
351
 
312
352
  # Re-enable it later
313
353
  omp enable @oh-my-pi/subagents
354
+
355
+ # Disable just for this project
356
+ omp disable @oh-my-pi/subagents -l
314
357
  ```
315
358
 
316
359
  ## Credits