zmarketplace 0.4.2 → 0.4.3
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/package.json +1 -1
- package/src/index.ts +40 -39
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zmarketplace",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Cross-agent marketplace search: find, audit, and install plugins/skills/themes/prompts across pi, omp, claude code, opencode, gemini cli, and codex",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/src/index.ts
CHANGED
|
@@ -209,47 +209,48 @@ async function doInstall(pkg: PackageResult, ctx: Ctx): Promise<void> {
|
|
|
209
209
|
// ── Factory ────────────────────────────────────────────────────────────────
|
|
210
210
|
|
|
211
211
|
export default function zmarketplace(pi: {
|
|
212
|
-
registerCommand(name: string, def: { description: string; handler: (args: string, ctx: Ctx) => Promise<void> }): void;
|
|
212
|
+
registerCommand?(name: string, def: { description: string; handler: (args: string, ctx: Ctx) => Promise<void> }): void;
|
|
213
213
|
setLabel?(label: string): void;
|
|
214
214
|
}) {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
215
|
+
try {
|
|
216
|
+
pi.setLabel?.("Z Marketplace");
|
|
217
|
+
pi.registerCommand?.("zmarketplace", {
|
|
218
|
+
description: "Search, audit, and install packages across agent ecosystems",
|
|
219
|
+
handler: async (rawArgs: string, ctx: Ctx) => {
|
|
220
|
+
const args = parseArgs(rawArgs.trim().split(/\s+/).filter(Boolean));
|
|
221
|
+
switch (args.subcommand) {
|
|
222
|
+
case "help": {
|
|
223
|
+
ctx.ui.notify(formatHelp(), "info");
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
case "audit":
|
|
227
|
+
case "a": {
|
|
228
|
+
const ref = args.positional[0];
|
|
229
|
+
if (!ref) { ctx.ui.notify("Usage: /zmarketplace audit <name>", "info"); break; }
|
|
230
|
+
await doAudit(resolveRef(ref)?.name ?? ref, ctx);
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
case "search":
|
|
234
|
+
case "s":
|
|
235
|
+
case "": {
|
|
236
|
+
let query = args.positional.join(" ").trim();
|
|
237
|
+
let limit = 50;
|
|
238
|
+
if (!query && ctx.hasUI) {
|
|
239
|
+
const limitChoice = await ctx.ui.select("Results limit (50 per page)", ["25", "50", "150", "All (paged)"]);
|
|
240
|
+
limit = limitChoice?.startsWith("All") ? 999999 : parseInt(limitChoice ?? "50", 10);
|
|
241
|
+
query = (await ctx.ui.input("Search packages", "Type search query...")) ?? "";
|
|
242
|
+
if (!query) return;
|
|
243
|
+
}
|
|
244
|
+
await doSearch(query, ctx, limit);
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
default: {
|
|
248
|
+
await doSearch(rawArgs.trim(), ctx);
|
|
244
249
|
}
|
|
245
|
-
await doSearch(query, ctx, limit);
|
|
246
|
-
break;
|
|
247
|
-
}
|
|
248
|
-
default: {
|
|
249
|
-
// Treat unknown as search query
|
|
250
|
-
await doSearch(rawArgs.trim(), ctx);
|
|
251
250
|
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}
|
|
251
|
+
},
|
|
252
|
+
});
|
|
253
|
+
} catch {
|
|
254
|
+
// pi runtime may differ from omp — don't crash the agent
|
|
255
|
+
}
|
|
255
256
|
}
|