u-foo 1.2.5 → 1.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "u-foo",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "Multi-Agent Workspace Protocol. Just add u. claude → uclaude, codex → ucodex.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://ufoo.dev",
@@ -30,22 +30,19 @@ for (const platform of platforms) {
30
30
  }
31
31
  }
32
32
 
33
- // Install ufoo skills to ~/.claude/skills/ via symlinks
34
- // Skills auto-update when the package is updated since they're symlinks.
35
- try {
36
- const pkgRoot = path.resolve(__dirname, "..");
37
- const home = os.homedir();
38
- const claudeSkillsDir = path.join(home, ".claude", "skills");
39
-
40
- // Collect all skill directories
41
- const skillSources = [];
33
+ // Collect all skill sources from package
34
+ function collectSkillSources(pkgRoot) {
35
+ const sources = [];
42
36
 
43
37
  // Top-level SKILLS/
44
38
  const topSkills = path.join(pkgRoot, "SKILLS");
45
39
  if (fs.existsSync(topSkills)) {
46
40
  for (const entry of fs.readdirSync(topSkills, { withFileTypes: true })) {
47
41
  if (entry.isDirectory()) {
48
- skillSources.push({ name: entry.name, src: path.join(topSkills, entry.name) });
42
+ const skillMd = path.join(topSkills, entry.name, "SKILL.md");
43
+ if (fs.existsSync(skillMd)) {
44
+ sources.push({ name: entry.name, dir: path.join(topSkills, entry.name), md: skillMd });
45
+ }
49
46
  }
50
47
  }
51
48
  }
@@ -58,33 +55,48 @@ try {
58
55
  const modSkills = path.join(modulesDir, mod.name, "SKILLS");
59
56
  if (!fs.existsSync(modSkills)) continue;
60
57
  for (const entry of fs.readdirSync(modSkills, { withFileTypes: true })) {
61
- if (entry.isDirectory()) {
62
- skillSources.push({ name: entry.name, src: path.join(modSkills, entry.name) });
58
+ if (!entry.isDirectory()) continue;
59
+ const skillMd = path.join(modSkills, entry.name, "SKILL.md");
60
+ if (fs.existsSync(skillMd)) {
61
+ sources.push({ name: entry.name, dir: path.join(modSkills, entry.name), md: skillMd });
63
62
  }
64
63
  }
65
64
  }
66
65
  }
67
66
 
68
- if (skillSources.length > 0) {
69
- fs.mkdirSync(claudeSkillsDir, { recursive: true });
67
+ return sources;
68
+ }
69
+
70
+ function forceSymlink(target, linkPath) {
71
+ try {
72
+ const existing = fs.lstatSync(linkPath);
73
+ if (existing.isSymbolicLink() || existing.isFile() || existing.isDirectory()) {
74
+ fs.rmSync(linkPath, { recursive: true, force: true });
75
+ }
76
+ } catch {
77
+ // doesn't exist — fine
78
+ }
79
+ fs.symlinkSync(target, linkPath);
80
+ }
81
+
82
+ // Install ufoo skills as Claude Code slash commands (~/.claude/commands/<name>.md)
83
+ // and as skill directories (~/.claude/skills/<name>/)
84
+ try {
85
+ const pkgRoot = path.resolve(__dirname, "..");
86
+ const home = os.homedir();
87
+ const sources = collectSkillSources(pkgRoot);
88
+
89
+ if (sources.length > 0) {
90
+ // Slash commands: ~/.claude/commands/<name>.md -> SKILL.md
91
+ const commandsDir = path.join(home, ".claude", "commands");
92
+ fs.mkdirSync(commandsDir, { recursive: true });
70
93
 
71
94
  let installed = 0;
72
- for (const { name, src } of skillSources) {
73
- const dest = path.join(claudeSkillsDir, name);
74
- try {
75
- // Remove existing (symlink or dir) before creating fresh symlink
76
- if (fs.existsSync(dest) || fs.lstatSync(dest).isSymbolicLink()) {
77
- fs.rmSync(dest, { recursive: true, force: true });
78
- }
79
- } catch {
80
- // lstatSync throws if path doesn't exist at all — fine
81
- }
82
- fs.symlinkSync(src, dest);
95
+ for (const { name, md } of sources) {
96
+ forceSymlink(md, path.join(commandsDir, `${name}.md`));
83
97
  installed += 1;
84
98
  }
85
- if (installed > 0) {
86
- console.log(`[postinstall] Installed ${installed} ufoo skill(s) to ${claudeSkillsDir}`);
87
- }
99
+ console.log(`[postinstall] Installed ${installed} ufoo command(s) to ${commandsDir}`);
88
100
  }
89
101
  } catch (err) {
90
102
  // Non-fatal — skills can be installed manually via `ufoo skills install`