@pigcloud/skills 1.0.4 → 1.0.5

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/bin/cli.js CHANGED
@@ -14,6 +14,8 @@ const CODEX_HOME = process.env.CODEX_HOME || path.join(os.homedir(), '.codex');
14
14
  const COMMAND_PACK_NAME = 'codex-commands';
15
15
  const COMMAND_PACK_SOURCE = path.join(PACKAGE_ROOT, COMMAND_PACK_NAME);
16
16
  const CODEX_HOME_SKILLS_DIR = path.join(CODEX_HOME, 'skills');
17
+ const CODEX_HOME_SKILLS_NAMESPACE = 'pigcloud';
18
+ const CODEX_HOME_SKILLS_NAMESPACE_DIR = path.join(CODEX_HOME_SKILLS_DIR, CODEX_HOME_SKILLS_NAMESPACE);
17
19
  const CODEX_PLUGINS_DIR = path.join(CODEX_HOME, 'plugins');
18
20
  const CODEX_MARKETPLACE_FILE = path.join(CODEX_PLUGINS_DIR, 'marketplace.json');
19
21
  const INSTALL_ROOT = path.resolve(process.env.INIT_CWD || process.cwd());
@@ -58,8 +60,8 @@ const SKILLS = [
58
60
  ];
59
61
 
60
62
  const TOOL_CONFIGS = {
61
- codex: { dir: '.codex/skills', rootFile: '.codex/AGENTS.md', markers: ['.codex/AGENTS.md', '.codex'] },
62
- opencode: { dir: '.codex/skills', rootFile: '.codex/AGENTS.md', markers: ['.codex/AGENTS.md', '.codex'] },
63
+ codex: { dir: '.codex/skills/pigcloud', rootFile: '.codex/AGENTS.md', markers: ['.codex/AGENTS.md', '.codex'] },
64
+ opencode: { dir: '.codex/skills/pigcloud', rootFile: '.codex/AGENTS.md', markers: ['.codex/AGENTS.md', '.codex'] },
63
65
  claude: { dir: '.claude/skills', rootFile: '.claude/CLAUDE.md', markers: ['.claude/CLAUDE.md', '.claude'] },
64
66
  claude_code: { dir: '.claude/skills', rootFile: '.claude/CLAUDE.md', markers: ['.claude/CLAUDE.md', '.claude'] },
65
67
  trae: { dir: '.trae/skills', rootFile: '.trae/AGENTS.md', markers: ['.trae/AGENTS.md', '.trae'] },
@@ -252,17 +254,29 @@ async function writeRootFile(tool, cwd = process.cwd()) {
252
254
  }
253
255
  }
254
256
 
255
- async function copySkillToCodexHome(skillName) {
256
- const skill = normalizeSkillName(skillName);
257
- if (!getSkillInfo(skill)) {
258
- throw new Error(`Unknown skill: ${skillName}`);
259
- }
260
-
261
- const sourceDir = path.join(SKILLS_DIR, skill);
262
- const destDir = path.join(CODEX_HOME_SKILLS_DIR, skill);
263
- await ensureDir(CODEX_HOME_SKILLS_DIR);
264
- await copyDirectory(sourceDir, destDir);
265
- }
257
+ async function copySkillToCodexHome(skillName) {
258
+ const skill = normalizeSkillName(skillName);
259
+ if (!getSkillInfo(skill)) {
260
+ throw new Error(`Unknown skill: ${skillName}`);
261
+ }
262
+
263
+ const sourceDir = path.join(SKILLS_DIR, skill);
264
+ const destDir = path.join(CODEX_HOME_SKILLS_NAMESPACE_DIR, skill);
265
+ await removePath(path.join(CODEX_HOME_SKILLS_DIR, skill));
266
+ await removePath(destDir);
267
+ await ensureDir(CODEX_HOME_SKILLS_NAMESPACE_DIR);
268
+ await copyDirectory(sourceDir, destDir);
269
+ }
270
+
271
+ async function clearCodexPersonalSkillsNamespace() {
272
+ await removePath(CODEX_HOME_SKILLS_NAMESPACE_DIR);
273
+ }
274
+
275
+ async function clearCodexLegacyFlatSkills(skillNames) {
276
+ for (const skillName of skillNames) {
277
+ await removePath(path.join(CODEX_HOME_SKILLS_DIR, normalizeSkillName(skillName)));
278
+ }
279
+ }
266
280
 
267
281
  function buildMarketplaceEntry(pluginName) {
268
282
  return {
@@ -324,13 +338,18 @@ async function installSharedWorkspaceAssets(cwd = getInstallRoot()) {
324
338
  }
325
339
  }
326
340
 
327
- async function installSkills(skills, tool, cwd = getInstallRoot()) {
328
- await installSharedWorkspaceAssets(cwd);
329
- for (const skill of skills) {
330
- await copySkill(skill, tool, cwd);
331
- }
332
- await writeRootFile(tool, cwd);
333
- if (tool === 'codex') {
341
+ async function installSkills(skills, tool, cwd = getInstallRoot(), options = {}) {
342
+ const { resetCodexNamespace = false } = options;
343
+ await installSharedWorkspaceAssets(cwd);
344
+ if (tool === 'codex' && resetCodexNamespace) {
345
+ await clearCodexPersonalSkillsNamespace();
346
+ await clearCodexLegacyFlatSkills(skills);
347
+ }
348
+ for (const skill of skills) {
349
+ await copySkill(skill, tool, cwd);
350
+ }
351
+ await writeRootFile(tool, cwd);
352
+ if (tool === 'codex') {
334
353
  for (const skill of skills) {
335
354
  await copySkillToCodexHome(skill);
336
355
  }
@@ -338,16 +357,16 @@ async function installSkills(skills, tool, cwd = getInstallRoot()) {
338
357
  }
339
358
  }
340
359
 
341
- async function installSkillsForTools(skills, tools, cwd = getInstallRoot()) {
342
- const uniqueTools = [...new Set(tools.filter(Boolean))];
343
- if (uniqueTools.length === 0) {
344
- throw new Error('Unable to resolve any install targets.');
345
- }
346
-
347
- for (const tool of uniqueTools) {
348
- await installSkills(skills, tool, cwd);
349
- }
350
- }
360
+ async function installSkillsForTools(skills, tools, cwd = getInstallRoot(), options = {}) {
361
+ const uniqueTools = [...new Set(tools.filter(Boolean))];
362
+ if (uniqueTools.length === 0) {
363
+ throw new Error('Unable to resolve any install targets.');
364
+ }
365
+
366
+ for (const tool of uniqueTools) {
367
+ await installSkills(skills, tool, cwd, options);
368
+ }
369
+ }
351
370
 
352
371
  function parseArgs(argv) {
353
372
  const positionals = [];
@@ -464,10 +483,10 @@ async function run() {
464
483
  if (command === 'init') {
465
484
  const skills = getSelectedSkills(options.skills, options.all || !options.skills);
466
485
  try {
467
- await ensureRuntimeForInstall();
468
- const tools = resolveRequestedTools(options.tool);
469
- await installSkillsForTools(skills, tools);
470
- console.log(chalk.green(`Installed ${skills.length} skills for ${tools.join(', ')}`));
486
+ await ensureRuntimeForInstall();
487
+ const tools = resolveRequestedTools(options.tool);
488
+ await installSkillsForTools(skills, tools, getInstallRoot(), { resetCodexNamespace: true });
489
+ console.log(chalk.green(`Installed ${skills.length} skills for ${tools.join(', ')}`));
471
490
  } catch (error) {
472
491
  console.error(chalk.red(error.message));
473
492
  process.exitCode = 1;
@@ -478,10 +497,10 @@ async function run() {
478
497
  if (command === 'auto') {
479
498
  const skills = getSelectedSkills(options.skills, options.all || !options.skills);
480
499
  try {
481
- await ensureRuntimeForInstall();
482
- const tools = resolveRequestedTools('auto');
483
- await installSkillsForTools(skills, tools);
484
- console.log(chalk.green(`Auto-installed ${skills.length} skills for ${tools.join(', ')}`));
500
+ await ensureRuntimeForInstall();
501
+ const tools = resolveRequestedTools('auto');
502
+ await installSkillsForTools(skills, tools, getInstallRoot(), { resetCodexNamespace: true });
503
+ console.log(chalk.green(`Auto-installed ${skills.length} skills for ${tools.join(', ')}`));
485
504
  } catch (error) {
486
505
  console.error(chalk.red(error.message));
487
506
  process.exitCode = 1;
@@ -492,9 +511,9 @@ async function run() {
492
511
  if (command === 'codex') {
493
512
  const skills = getSelectedSkills(options.skills, options.all || !options.skills);
494
513
  try {
495
- await ensureRuntimeForInstall();
496
- await installSkills(skills, 'codex');
497
- console.log(chalk.green(`Synced ${skills.length} skills into Codex`));
514
+ await ensureRuntimeForInstall();
515
+ await installSkills(skills, 'codex', getInstallRoot(), { resetCodexNamespace: true });
516
+ console.log(chalk.green(`Synced ${skills.length} skills into Codex`));
498
517
  console.log(chalk.green(`Installed Codex command pack: ${COMMAND_PACK_NAME}`));
499
518
  } catch (error) {
500
519
  console.error(chalk.red(error.message));
@@ -569,11 +588,11 @@ async function run() {
569
588
  await installSharedWorkspaceAssets();
570
589
  for (const tool of tools) {
571
590
  await copySkill(skillName, tool);
572
- await writeRootFile(tool);
573
- if (tool === 'codex') {
574
- await copySkillToCodexHome(skillName);
575
- await installCodexCommandPack();
576
- }
591
+ await writeRootFile(tool);
592
+ if (tool === 'codex') {
593
+ await copySkillToCodexHome(skillName);
594
+ await installCodexCommandPack();
595
+ }
577
596
  }
578
597
  console.log(chalk.green(`Installed: ${normalizeSkillName(skillName)} -> ${tools.join(', ')}`));
579
598
  } catch (error) {
@@ -598,12 +617,19 @@ async function run() {
598
617
  for (const tool of tools) {
599
618
  const targetSkillDir = getTargetSkillDir(tool);
600
619
  if (!targetSkillDir) continue;
601
- const skillDir = path.join(targetSkillDir, normalizedSkill);
602
- if (await pathExists(skillDir)) {
603
- await removePath(skillDir);
604
- removedAny = true;
605
- }
606
- }
620
+ const skillDir = path.join(targetSkillDir, normalizedSkill);
621
+ if (await pathExists(skillDir)) {
622
+ await removePath(skillDir);
623
+ removedAny = true;
624
+ }
625
+ if (tool === 'codex') {
626
+ const legacySkillDir = path.join(CODEX_HOME_SKILLS_DIR, normalizedSkill);
627
+ if (await pathExists(legacySkillDir)) {
628
+ await removePath(legacySkillDir);
629
+ removedAny = true;
630
+ }
631
+ }
632
+ }
607
633
  console.log(removedAny
608
634
  ? chalk.green(`Removed: ${normalizedSkill}`)
609
635
  : chalk.yellow(`Skill not found: ${normalizedSkill}`));
@@ -639,10 +665,10 @@ async function run() {
639
665
 
640
666
  if (command === 'update') {
641
667
  try {
642
- await ensureRuntimeForInstall();
643
- const tools = resolveRequestedTools(options.tool);
644
- await installSkillsForTools(SKILLS.map(skill => skill.name), tools);
645
- console.log(chalk.green(`Updated ${SKILLS.length} skills for ${tools.join(', ')}`));
668
+ await ensureRuntimeForInstall();
669
+ const tools = resolveRequestedTools(options.tool);
670
+ await installSkillsForTools(SKILLS.map(skill => skill.name), tools, getInstallRoot(), { resetCodexNamespace: true });
671
+ console.log(chalk.green(`Updated ${SKILLS.length} skills for ${tools.join(', ')}`));
646
672
  } catch (error) {
647
673
  console.error(chalk.red(error.message));
648
674
  process.exitCode = 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pigcloud/skills",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "AI skills pack with client-aware installation, shared skills and rules, Codex command entries, and Pig Cloud-specific overlays for requirements, implementation, and knowledge curation.",
5
5
  "author": "Pig Skills Maintainers",
6
6
  "license": "MIT",
@@ -6,12 +6,12 @@ $ErrorActionPreference = 'Stop'
6
6
  $repoRoot = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot '..')).Path
7
7
  $python = Join-Path $repoRoot '.tools\python.cmd'
8
8
  if (-not $SkillsRoot) {
9
- if (Test-Path -LiteralPath (Join-Path $repoRoot 'skills')) {
10
- $SkillsRoot = Join-Path $repoRoot 'skills'
11
- } else {
12
- $SkillsRoot = Join-Path $repoRoot '.agents\skills'
13
- }
14
- }
9
+ if (Test-Path -LiteralPath (Join-Path $repoRoot 'skills')) {
10
+ $SkillsRoot = Join-Path $repoRoot 'skills'
11
+ } else {
12
+ $SkillsRoot = Join-Path $repoRoot '.codex\skills\pigcloud'
13
+ }
14
+ }
15
15
  $codexHome = $env:CODEX_HOME
16
16
  if (-not $codexHome) {
17
17
  $codexHome = Join-Path $HOME '.codex'
@@ -7,11 +7,11 @@ codex_home="${CODEX_HOME:-$HOME/.codex}"
7
7
  validator="$codex_home/skills/.system/skill-creator/scripts/quick_validate.py"
8
8
  if [ -n "${1:-}" ]; then
9
9
  skills_root="$1"
10
- elif [ -d "$repo_root/skills" ]; then
11
- skills_root="$repo_root/skills"
12
- else
13
- skills_root="$repo_root/.agents/skills"
14
- fi
10
+ elif [ -d "$repo_root/skills" ]; then
11
+ skills_root="$repo_root/skills"
12
+ else
13
+ skills_root="$repo_root/.codex/skills/pigcloud"
14
+ fi
15
15
 
16
16
  if [ ! -f "$validator" ]; then
17
17
  echo "Validator not found: $validator" >&2