pruff-skills 0.5.0 → 0.5.1

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/cli.mjs +63 -21
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -7409,29 +7409,28 @@ async function installSkillsAndAgents(team) {
7409
7409
  const priorCwd = process.cwd();
7410
7410
  process.chdir(nestDir());
7411
7411
  try {
7412
- for (const skill of skills) {
7413
- if (existsSync(join(nestDir(), ".claude", "skills", skill))) {
7414
- M.success(`${skill} (already present)`);
7415
- continue;
7416
- }
7412
+ const skillPath = (name) => join(nestDir(), ".claude", "skills", name);
7413
+ const missingSkills = skills.filter((s) => !existsSync(skillPath(s)));
7414
+ for (const s of skills) if (!missingSkills.includes(s)) M.success(`${s} (already present)`);
7415
+ if (missingSkills.length > 0) {
7417
7416
  try {
7418
- const { source, options } = parseAddOptions([skill, "-y"]);
7419
- await runAdd(source, options);
7420
- M.success(skill);
7421
- } catch {
7422
- M.warn(`${import_picocolors.default.yellow(skill)} — not found in the catalog, skipped`);
7423
- }
7417
+ await runAdd([PRUFF_CATALOG], {
7418
+ skill: missingSkills,
7419
+ yes: true
7420
+ });
7421
+ } catch {}
7422
+ for (const s of missingSkills) if (existsSync(skillPath(s))) M.success(s);
7423
+ else M.warn(`${import_picocolors.default.yellow(s)} — not found in the catalog, skipped`);
7424
7424
  }
7425
- for (const agent of subagents) {
7426
- if (existsSync(join(nestDir(), ".claude", "agents", `${agent}.md`))) {
7427
- M.success(`subagent ${agent} (already present)`);
7428
- continue;
7429
- }
7425
+ const agentPath = (name) => join(nestDir(), ".claude", "agents", `${name}.md`);
7426
+ const missingAgents = subagents.filter((a) => !existsSync(agentPath(a)));
7427
+ for (const a of subagents) if (!missingAgents.includes(a)) M.success(`subagent ${a} (already present)`);
7428
+ if (missingAgents.length > 0) {
7430
7429
  try {
7431
- await addAgents([agent], { yes: true });
7432
- } catch {
7433
- M.warn(`subagent ${import_picocolors.default.yellow(agent)} — not found, skipped`);
7434
- }
7430
+ await addAgents(missingAgents, { yes: true });
7431
+ } catch {}
7432
+ for (const a of missingAgents) if (existsSync(agentPath(a))) M.success(`subagent ${a}`);
7433
+ else M.warn(`subagent ${import_picocolors.default.yellow(a)} — not found, skipped`);
7435
7434
  }
7436
7435
  } finally {
7437
7436
  process.chdir(priorCwd);
@@ -7566,6 +7565,45 @@ function runPacksList() {
7566
7565
  console.log(` ${existsSync(dir) ? import_picocolors.default.green("✓") : import_picocolors.default.red("✗")} ${team} ${import_picocolors.default.dim(dir)}`);
7567
7566
  }
7568
7567
  }
7568
+ function properCase(word) {
7569
+ return word.length === 0 ? word : word[0].toUpperCase() + word.slice(1);
7570
+ }
7571
+ function replacePlatformWith(text, team) {
7572
+ return text.replaceAll("Platform", properCase(team)).replaceAll("platform", team);
7573
+ }
7574
+ function rewritePackForTeam(destDir, team) {
7575
+ const pluginPath = join(destDir, ".plugin", "plugin.json");
7576
+ const plugin = JSON.parse(readFileSync(pluginPath, "utf8"));
7577
+ if (typeof plugin.id === "string") plugin.id = replacePlatformWith(plugin.id, team);
7578
+ if (typeof plugin.name === "string") plugin.name = replacePlatformWith(plugin.name, team);
7579
+ if (typeof plugin.description === "string") plugin.description = replacePlatformWith(plugin.description, team);
7580
+ if (Array.isArray(plugin.keywords)) plugin.keywords = plugin.keywords.map((k) => typeof k === "string" ? replacePlatformWith(k, team) : k);
7581
+ const renamed = [];
7582
+ const needsManualRename = [];
7583
+ const newPersonaList = [];
7584
+ for (const relPath of plugin.personas ?? []) {
7585
+ if (!relPath.includes("platform")) {
7586
+ newPersonaList.push(relPath);
7587
+ needsManualRename.push(relPath);
7588
+ continue;
7589
+ }
7590
+ const newRelPath = replacePlatformWith(relPath, team);
7591
+ const oldAbsPath = join(destDir, relPath);
7592
+ const newAbsPath = join(destDir, newRelPath);
7593
+ writeFileSync(newAbsPath, replacePlatformWith(readFileSync(oldAbsPath, "utf8"), team));
7594
+ if (newAbsPath !== oldAbsPath) rmSync(oldAbsPath);
7595
+ newPersonaList.push(newRelPath);
7596
+ renamed.push(newRelPath);
7597
+ }
7598
+ plugin.personas = newPersonaList;
7599
+ writeFileSync(pluginPath, JSON.stringify(plugin, null, 2) + "\n");
7600
+ const instructionsPath = join(destDir, "instructions.md");
7601
+ if (existsSync(instructionsPath)) writeFileSync(instructionsPath, replacePlatformWith(readFileSync(instructionsPath, "utf8"), team));
7602
+ return {
7603
+ renamed,
7604
+ needsManualRename
7605
+ };
7606
+ }
7569
7607
  function runPacksInit(team) {
7570
7608
  if (!team) {
7571
7609
  M.error("usage: pruff-skills buzz packs init <team>");
@@ -7578,7 +7616,11 @@ function runPacksInit(team) {
7578
7616
  process.exit(1);
7579
7617
  }
7580
7618
  cpSync(src, dest, { recursive: true });
7581
- M.success(`Scaffolded packs/pruff-${team} from pruff-platform. Edit the personas, then add "${team}" support in src/buzz.ts's TEAM_SKILLS / TEAM_AGENTS.`);
7619
+ const { renamed, needsManualRename } = rewritePackForTeam(dest, team);
7620
+ M.success(`Scaffolded packs/pruff-${team} from pruff-platform.`);
7621
+ if (renamed.length > 0) M.message(import_picocolors.default.dim(`Renamed to ${team}: ${renamed.join(", ")}`));
7622
+ if (needsManualRename.length > 0) M.warn(`These personas have no team in their name and were copied as-is — they still collide with the platform team's real persona once seeded. Rename them by hand (file + name: / display_name:) with the real owner's initials before running setup: ${needsManualRename.join(", ")}`);
7623
+ M.message(import_picocolors.default.dim(`Edit the personas, then add "${team}" support in src/buzz.ts's TEAM_SKILLS / TEAM_AGENTS.`));
7582
7624
  }
7583
7625
  const BUZZ_HELP = `${import_picocolors.default.bold("Usage:")} pruff-skills buzz <command> [options]
7584
7626
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pruff-skills",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "The official Pruff agent skills CLI",
5
5
  "type": "module",
6
6
  "bin": {