@aliendreamer/ai-skills 0.1.0 → 0.3.0

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/dist/main.cjs +51 -17
  2. package/package.json +5 -5
package/dist/main.cjs CHANGED
@@ -25276,6 +25276,17 @@ function resolveAddTargets(catalog, ids, opts = {}) {
25276
25276
  }
25277
25277
  return targets;
25278
25278
  }
25279
+ var AGENTS2 = ["claude", "codex", "copilot", "cursor", "gemini"];
25280
+ function resolveAgents(flags) {
25281
+ if (flags.allAgents) return [...AGENTS2];
25282
+ if (!flags.agent) return [];
25283
+ const names = flags.agent.split(",").map((s3) => s3.trim()).filter(Boolean);
25284
+ const unknown = names.filter((n) => !AGENTS2.includes(n));
25285
+ if (unknown.length > 0) {
25286
+ throw new Error(`Unknown agent(s): ${unknown.join(", ")}`);
25287
+ }
25288
+ return [...new Set(names)];
25289
+ }
25279
25290
  function resolveScope(flags) {
25280
25291
  if (flags.project && flags.global) {
25281
25292
  throw new Error("Use only one of --project or --global");
@@ -25283,8 +25294,8 @@ function resolveScope(flags) {
25283
25294
  return flags.global ? "global" : "project";
25284
25295
  }
25285
25296
  function requireYesFlags(flags) {
25286
- if (flags.yes && !flags.agent) {
25287
- throw new Error("--agent is required with --yes");
25297
+ if (flags.yes && flags.agents.length === 0) {
25298
+ throw new Error("an agent is required with --yes (use --agent or --all-agents)");
25288
25299
  }
25289
25300
  }
25290
25301
  async function addItems(targets, deps) {
@@ -25294,22 +25305,32 @@ async function addItems(targets, deps) {
25294
25305
  const makeTmp = deps.mkdtemp ?? (() => (0, import_promises4.mkdtemp)((0, import_node_path16.join)((0, import_node_os3.tmpdir)(), "ai-skills-add-")));
25295
25306
  const results = [];
25296
25307
  for (const entry of targets) {
25308
+ let tmp;
25297
25309
  try {
25298
- const tmp = await makeTmp();
25310
+ tmp = await makeTmp();
25299
25311
  await fetchItem2(deps.owner, deps.repo, deps.ref, entry.path, tmp);
25300
- const dest = entry.type === "prompt" ? await installPrompt2(tmp, deps.agent, deps.scope, entry.id, entry.description, deps.bases) : await installSkill2(tmp, deps.agent, deps.scope, entry.id, deps.bases);
25301
- results.push({ id: entry.id, status: "installed", dest });
25302
25312
  } catch (err) {
25303
- results.push({ id: entry.id, status: "failed", message: err.message });
25313
+ for (const agent of deps.agents) {
25314
+ results.push({ id: entry.id, agent, status: "failed", message: err.message });
25315
+ }
25316
+ continue;
25317
+ }
25318
+ for (const agent of deps.agents) {
25319
+ try {
25320
+ const dest = entry.type === "prompt" ? await installPrompt2(tmp, agent, deps.scope, entry.id, entry.description, deps.bases) : await installSkill2(tmp, agent, deps.scope, entry.id, deps.bases);
25321
+ results.push({ id: entry.id, agent, status: "installed", dest });
25322
+ } catch (err) {
25323
+ results.push({ id: entry.id, agent, status: "failed", message: err.message });
25324
+ }
25304
25325
  }
25305
25326
  }
25306
25327
  return results;
25307
25328
  }
25308
25329
 
25309
25330
  // src/commands/add.ts
25310
- var AGENTS2 = ["claude", "codex", "copilot", "cursor", "gemini"];
25311
25331
  async function addCommand(ids, opts) {
25312
- requireYesFlags({ agent: opts.agent, yes: opts.yes });
25332
+ const flagAgents = resolveAgents({ agent: opts.agent, allAgents: opts.allAgents });
25333
+ requireYesFlags({ agents: flagAgents, yes: opts.yes });
25313
25334
  if (opts.yes && !opts.all && ids.length === 0) {
25314
25335
  throw new Error("With --yes, specify item id(s) or --all");
25315
25336
  }
@@ -25320,16 +25341,29 @@ async function addCommand(ids, opts) {
25320
25341
  } else if (ids.length > 0) {
25321
25342
  targets = resolveAddTargets(catalog, ids);
25322
25343
  } else {
25344
+ const type = await esm_default11({
25345
+ message: "What to install?",
25346
+ choices: [
25347
+ { name: "Skills", value: "skill" },
25348
+ { name: "Prompts", value: "prompt" },
25349
+ { name: "Everything", value: "all" }
25350
+ ]
25351
+ });
25352
+ const pool = type === "all" ? catalog.entries : catalog.entries.filter((e) => e.type === type);
25323
25353
  const chosen = await esm_default2({
25324
25354
  message: "Select items to add",
25325
- choices: catalog.entries.map((e) => ({ name: `${e.id} (${e.type})`, value: e.id }))
25355
+ choices: pool.map((e) => ({ name: `${e.id} (${e.type})`, value: e.id }))
25326
25356
  });
25327
25357
  targets = resolveAddTargets(catalog, chosen);
25328
25358
  }
25329
- const agent = opts.agent ?? await esm_default11({
25330
- message: "Target agent",
25331
- choices: AGENTS2.map((a) => ({ name: a, value: a }))
25332
- });
25359
+ let agents = flagAgents;
25360
+ if (agents.length === 0) {
25361
+ agents = await esm_default2({
25362
+ message: "Select agents",
25363
+ choices: AGENTS2.map((a) => ({ name: a, value: a }))
25364
+ });
25365
+ if (agents.length === 0) throw new Error("No agents selected");
25366
+ }
25333
25367
  let scope;
25334
25368
  if (opts.project || opts.global) scope = resolveScope(opts);
25335
25369
  else if (opts.yes) scope = "project";
@@ -25342,12 +25376,12 @@ async function addCommand(ids, opts) {
25342
25376
  ]
25343
25377
  });
25344
25378
  const bases = { project: process.cwd(), home: (0, import_node_os4.homedir)() };
25345
- const results = await addItems(targets, { ...repoRef, agent, scope, bases });
25379
+ const results = await addItems(targets, { ...repoRef, agents, scope, bases });
25346
25380
  for (const r of results) {
25347
25381
  if (r.status === "installed") {
25348
- console.log(import_picocolors2.default.green(`\u2713 ${r.id} \u2192 ${r.dest}`));
25382
+ console.log(import_picocolors2.default.green(`\u2713 ${r.id} \u2192 ${r.agent} (${r.dest})`));
25349
25383
  } else {
25350
- console.log(import_picocolors2.default.red(`\u2717 ${r.id}: ${r.message}`));
25384
+ console.log(import_picocolors2.default.red(`\u2717 ${r.id} \u2192 ${r.agent}: ${r.message}`));
25351
25385
  }
25352
25386
  }
25353
25387
  }
@@ -25358,7 +25392,7 @@ program2.name("ai-skills").description("Install AI agent skills and prompts from
25358
25392
  program2.command("list").description("List items in the store").option("--type <type>", "filter by type: skill or prompt").option("--agent <agent>", "filter by supported agent").action((opts, cmd) => listCommand({ ...cmd.optsWithGlobals(), ...opts }));
25359
25393
  program2.command("search").description("Search items by id, description, or tag").argument("<query>", "text to search for").action((query, opts, cmd) => searchCommand(query, cmd.optsWithGlobals()));
25360
25394
  program2.command("info").description("Show details for one item").argument("<id>", "item id").action((id, opts, cmd) => infoCommand(id, cmd.optsWithGlobals()));
25361
- program2.command("add").description("Install skill(s) into an agent (interactive when no ids are given)").argument("[ids...]", "item ids to add").option("--all", "add every item").option("--agent <agent>", "target agent: claude, codex, copilot, cursor, gemini").option("--project", "install into the current project (./)").option("--global", "install into the home directory (~/)").option("-y, --yes", "skip prompts (requires --agent)").action((ids, opts, cmd) => addCommand(ids, { ...cmd.optsWithGlobals(), ...opts }));
25395
+ program2.command("add").description("Install skill(s) into an agent (interactive when no ids are given)").argument("[ids...]", "item ids to add").option("--all", "add every item").option("--agent <agents>", "target agent(s), comma-separated: claude, codex, copilot, cursor, gemini").option("--all-agents", "install into every supported agent").option("--project", "install into the current project (./)").option("--global", "install into the home directory (~/)").option("-y, --yes", "skip prompts (requires --agent)").action((ids, opts, cmd) => addCommand(ids, { ...cmd.optsWithGlobals(), ...opts }));
25362
25396
  program2.parseAsync(process.argv).catch((err) => {
25363
25397
  console.error(import_picocolors3.default.red(err.message));
25364
25398
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aliendreamer/ai-skills",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Install AI agent skills and prompts from the ai.skills store",
5
5
  "type": "module",
6
6
  "bin": {
@@ -15,9 +15,9 @@
15
15
  "devDependencies": {
16
16
  "@ai-skills/catalog": "workspace:*",
17
17
  "@ai-skills/install": "workspace:*",
18
- "@inquirer/prompts": "^7.2.0",
19
- "commander": "^12.1.0",
20
- "picocolors": "^1.1.1",
21
- "tsup": "^8.3.5"
18
+ "@inquirer/prompts": "7.10.1",
19
+ "commander": "12.1.0",
20
+ "picocolors": "1.1.1",
21
+ "tsup": "8.5.1"
22
22
  }
23
23
  }