zmarketplace 0.4.5 → 0.4.6

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/package.json +1 -1
  2. package/src/index.ts +23 -30
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmarketplace",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
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
@@ -58,23 +58,16 @@ async function browseResults(results: PackageResult[], ctx: Ctx): Promise<void>
58
58
  const pageEnd = Math.min(pageStart + PAGE_SIZE, results.length);
59
59
  const page = results.slice(pageStart, pageEnd);
60
60
 
61
- const options = page.map((r, i) => {
62
- const globalIdx = pageStart + i;
63
- return { label: formatResultOption(r, globalIdx).label, description: r.installCommand ?? "" };
64
- });
61
+ const options: string[] = page.map((r, i) => formatResultOption(r, pageStart + i).label);
65
62
 
66
- // Pagination controls
67
63
  if (pageStart > 0) {
68
- const prevStart = Math.max(0, pageStart - PAGE_SIZE) + 1;
69
- const prevEnd = pageStart;
70
- options.push({ label: `← Previous (${prevStart}-${prevEnd})`, description: "" });
64
+ const ps = Math.max(0, pageStart - PAGE_SIZE) + 1;
65
+ options.push(`← Previous (${ps}-${pageStart})`);
71
66
  }
72
67
  if (pageEnd < results.length) {
73
- const nextStart = pageEnd + 1;
74
- const nextEnd = Math.min(pageEnd + PAGE_SIZE, results.length);
75
- options.push({ label: `→ Next (${nextStart}-${nextEnd})`, description: "" });
68
+ options.push(`→ Next (${pageEnd + 1}-${Math.min(pageEnd + PAGE_SIZE, results.length)})`);
76
69
  }
77
- options.push({ label: "↩ Done", description: "" });
70
+ options.push("↩ Done");
78
71
 
79
72
  const title = `zmarketplace: ${results.length} results (page ${Math.floor(pageStart / PAGE_SIZE) + 1}/${Math.ceil(results.length / PAGE_SIZE)})`;
80
73
  const selected = await ctx.ui.select(title, options);
@@ -173,25 +166,26 @@ async function doInstall(pkg: PackageResult, ctx: Ctx): Promise<void> {
173
166
  "",
174
167
  ];
175
168
 
176
- // Build install options
177
- const cmds: Array<{ label: string; description: string }> = [];
169
+ // Build install options as plain strings
170
+ const cmds: string[] = [];
171
+ const cmdMap = new Map<string, string>();
178
172
  const seen = new Set<string>();
173
+ const addCmd = (label: string, command: string) => { cmds.push(label); cmdMap.set(label, command); };
174
+
179
175
  for (const eco of pkg.ecosystems) {
180
176
  if ((eco === "pi" || eco === "omp") && !seen.has("pi")) {
181
177
  seen.add("pi");
182
- auditLines.push("🥧 pi install");
183
- cmds.push({ label: "🥧 pi install", description: `pi install npm:${pkg.name}` });
184
- cmds.push({ label: "⌥ omp install", description: `omp plugin install npm:${pkg.name}` });
185
- auditLines.push("⌥ omp install");
178
+ addCmd("🥧 pi install", `pi install npm:${pkg.name}`);
179
+ addCmd(" omp install", `omp plugin install npm:${pkg.name}`);
186
180
  }
187
- if (eco === "claude" && !seen.has("claude")) { seen.add("claude"); cmds.push({ label: "🤖 claude", description: `claude plugin install npm:${pkg.name}` }); auditLines.push("🤖 claude install"); }
188
- if (eco === "opencode" && !seen.has("opencode")) { seen.add("opencode"); cmds.push({ label: "🔓 opencode", description: `opencode plugin ${pkg.name}` }); auditLines.push("🔓 opencode install"); }
189
- if (eco === "gemini" && !seen.has("gemini")) { seen.add("gemini"); cmds.push({ label: "💎 gemini", description: `gemini extension install ${pkg.repository ?? pkg.name}` }); auditLines.push("💎 gemini install"); }
190
- if (eco === "codex" && !seen.has("codex")) { seen.add("codex"); cmds.push({ label: "🔲 codex", description: `codex plugin add npm:${pkg.name}` }); auditLines.push("🔲 codex install"); }
181
+ if (eco === "claude" && !seen.has("claude")) { seen.add("claude"); addCmd("🤖 claude", `claude plugin install npm:${pkg.name}`); }
182
+ if (eco === "opencode" && !seen.has("opencode")) { seen.add("opencode"); addCmd("🔓 opencode", `opencode plugin ${pkg.name}`); }
183
+ if (eco === "gemini" && !seen.has("gemini")) { seen.add("gemini"); addCmd("💎 gemini", `gemini extension install ${pkg.repository ?? pkg.name}`); }
184
+ if (eco === "codex" && !seen.has("codex")) { seen.add("codex"); addCmd("🔲 codex", `codex plugin add npm:${pkg.name}`); }
191
185
  }
192
- if (!seen.has("npm")) { cmds.push({ label: "📦 npm", description: `npm install ${pkg.name}` }); auditLines.push("📦 npm install"); }
193
- cmds.push({ label: "⚡ bunx", description: `bunx ${pkg.name}` });
194
- cmds.push({ label: "↩ Cancel", description: "" });
186
+ if (!seen.has("npm")) addCmd("📦 npm", `npm install ${pkg.name}`);
187
+ addCmd("⚡ bunx", `bunx ${pkg.name}`);
188
+ cmds.push("↩ Cancel");
195
189
 
196
190
  // High risk confirmation
197
191
  if (report.risk === "critical" || report.risk === "high") {
@@ -199,11 +193,10 @@ async function doInstall(pkg: PackageResult, ctx: Ctx): Promise<void> {
199
193
  if (!proceed) { ctx.ui.notify("Cancelled.", "info"); return; }
200
194
  }
201
195
 
202
- const choice = await ctx.ui.select(`Install ${pkg.name} — Audit: ${report.risk}`, cmds);
203
- if (!choice || choice.includes("Cancel")) return;
204
- const selected = cmds.find(c => c.label === choice);
205
- if (!selected) return;
206
- ctx.ui.notify(`✅ Run:\n ${selected.description}`, "info");
196
+ const choice = await ctx.ui.select(`Install ${pkg.name} — Risk: ${report.risk}`, cmds);
197
+ if (!choice || choice === "Cancel") return;
198
+ const command = cmdMap.get(choice);
199
+ if (command) ctx.ui.notify(`✅ Run:\n ${command}`, "info");
207
200
  }
208
201
 
209
202
  // ── Factory ────────────────────────────────────────────────────────────────