@oh-my-pi/cli 0.9.0 → 0.9.2

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
@@ -60,21 +60,25 @@ 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 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.
80
+
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.
78
82
 
79
83
  ## Global vs Local Plugins
80
84
 
@@ -205,10 +209,31 @@ Plugins are npm packages with an `omp` field in `package.json`:
205
209
  { "src": "commands/research.md", "dest": "agent/commands/research.md" }
206
210
  ]
207
211
  },
208
- "files": ["agents", "commands", "tools", "themes"]
212
+ "files": ["agents", "commands"]
209
213
  }
210
214
  ```
211
215
 
216
+ ### Tools
217
+
218
+ For plugins with custom tools, use the `tools` field instead of `install`:
219
+
220
+ ```json
221
+ {
222
+ "name": "@oh-my-pi/my-tools",
223
+ "version": "1.0.0",
224
+ "keywords": ["omp-plugin"],
225
+ "omp": {
226
+ "tools": "tools"
227
+ },
228
+ "files": ["tools"],
229
+ "dependencies": {
230
+ "some-npm-package": "^1.0.0"
231
+ }
232
+ }
233
+ ```
234
+
235
+ 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.
236
+
212
237
  ### Features and Variables
213
238
 
214
239
  Plugins can define optional features and configurable variables:
@@ -219,7 +244,8 @@ Plugins can define optional features and configurable variables:
219
244
  "version": "1.0.0",
220
245
  "keywords": ["omp-plugin"],
221
246
  "omp": {
222
- "install": [{ "src": "tools/core.ts", "dest": "agent/tools/exa/core.ts" }],
247
+ "tools": "tools",
248
+ "runtime": "tools/runtime.json",
223
249
  "variables": {
224
250
  "apiKey": {
225
251
  "type": "string",
@@ -231,13 +257,11 @@ Plugins can define optional features and configurable variables:
231
257
  "features": {
232
258
  "search": {
233
259
  "description": "Web search capabilities",
234
- "default": true,
235
- "install": [{ "src": "tools/search.ts", "dest": "agent/tools/exa/search.ts" }]
260
+ "default": true
236
261
  },
237
262
  "websets": {
238
263
  "description": "Curated content collections",
239
264
  "default": false,
240
- "install": [{ "src": "tools/websets.ts", "dest": "agent/tools/exa/websets.ts" }],
241
265
  "variables": {
242
266
  "defaultCollection": {
243
267
  "type": "string",
@@ -250,6 +274,8 @@ Plugins can define optional features and configurable variables:
250
274
  }
251
275
  ```
252
276
 
277
+ 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.
278
+
253
279
  ### Plugin Structure
254
280
 
255
281
  ```
package/dist/cli.js CHANGED
@@ -6462,6 +6462,7 @@ async function createPlugin(name, options = {}) {
6462
6462
  keywords: ["omp-plugin"],
6463
6463
  author: options.author || "",
6464
6464
  license: "MIT",
6465
+ type: "module",
6465
6466
  omp: {
6466
6467
  install: []
6467
6468
  },
@@ -6486,7 +6487,7 @@ Add agent markdown files to \`agents/\` directory.
6486
6487
 
6487
6488
  ### Tools
6488
6489
 
6489
- Add tool implementations to \`tools/\` directory.
6490
+ Add tool implementations to \`tools/\` directory. Set \`"tools": "tools"\` in package.json omp field to enable.
6490
6491
 
6491
6492
  ### Themes
6492
6493
 
@@ -6498,19 +6499,22 @@ Add command markdown files to \`commands/\` directory.
6498
6499
 
6499
6500
  ## Configuration
6500
6501
 
6501
- Edit \`package.json\` to configure which files are installed:
6502
+ Edit \`package.json\` to configure your plugin:
6502
6503
 
6503
6504
  \`\`\`json
6504
6505
  {
6505
6506
  "omp": {
6506
6507
  "install": [
6507
- { "src": "agents/my-agent.md", "dest": "agent/agents/my-agent.md" },
6508
- { "src": "tools/my-tool/", "dest": "agent/tools/my-tool/" }
6509
- ]
6508
+ { "src": "agents/my-agent.md", "dest": "agent/agents/my-agent.md" }
6509
+ ],
6510
+ "tools": "tools"
6510
6511
  }
6511
6512
  }
6512
6513
  \`\`\`
6513
6514
 
6515
+ - \`install\`: Symlinks files (agents, commands, themes) into ~/.pi/agent/
6516
+ - \`tools\`: Points to tool factory directory (loaded from node_modules)
6517
+
6514
6518
  ## Publishing
6515
6519
 
6516
6520
  1. Update version in package.json
@@ -6536,6 +6540,28 @@ Describe what this agent does.
6536
6540
  Provide instructions for the agent here.
6537
6541
  `;
6538
6542
  await writeFile2(join3(pluginDir, "agents", "example.md"), exampleAgent);
6543
+ const exampleTool = `import type { CustomToolFactory } from "@mariozechner/pi-coding-agent";
6544
+ import { Type } from "@sinclair/typebox";
6545
+
6546
+ const factory: CustomToolFactory = (pi) => {
6547
+ return {
6548
+ name: "example_tool",
6549
+ label: "Example Tool",
6550
+ description: "An example tool for ${pluginName}",
6551
+ parameters: Type.Object({
6552
+ message: Type.String({ description: "A message to echo" }),
6553
+ }),
6554
+ async execute({ message }) {
6555
+ return {
6556
+ content: [{ type: "text", text: \`Echo: \${message}\` }],
6557
+ };
6558
+ },
6559
+ };
6560
+ };
6561
+
6562
+ export default factory;
6563
+ `;
6564
+ await writeFile2(join3(pluginDir, "tools", "index.ts"), exampleTool);
6539
6565
  const gitignore = `node_modules/
6540
6566
  .DS_Store
6541
6567
  *.log
@@ -6552,6 +6578,7 @@ Provide instructions for the agent here.
6552
6578
  console.log(source_default.dim(" \u251C\u2500\u2500 agents/"));
6553
6579
  console.log(source_default.dim(" \u2502 \u2514\u2500\u2500 example.md"));
6554
6580
  console.log(source_default.dim(" \u251C\u2500\u2500 tools/"));
6581
+ console.log(source_default.dim(" \u2502 \u2514\u2500\u2500 index.ts"));
6555
6582
  console.log(source_default.dim(" \u251C\u2500\u2500 themes/"));
6556
6583
  console.log(source_default.dim(" \u2514\u2500\u2500 commands/"));
6557
6584
  console.log();
@@ -11567,7 +11594,7 @@ var {
11567
11594
  } = import__.default;
11568
11595
 
11569
11596
  // src/cli.ts
11570
- program.name("omp").description("Oh My Pi - Plugin manager for pi configuration").version("0.9.0");
11597
+ program.name("omp").description("Oh My Pi - Plugin manager for pi configuration").version("0.9.2");
11571
11598
  program.command("install [packages...]").alias("i").description("Install plugin(s). No args = install from plugins.json").addHelpText("after", `
11572
11599
  Examples:
11573
11600
  $ omp install @oh-my-pi/subagents # Install from npm (all features)
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAmHD;;GAEG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkK3F"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAmHD;;GAEG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiM3F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/cli",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "Plugin manager for pi - install and manage pi config plugins from git repos",
5
5
  "type": "module",
6
6
  "main": "./dist/cli.js",