u-foo 1.2.4 → 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.4",
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",
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable no-console */
2
2
  const path = require("path");
3
3
  const fs = require("fs");
4
+ const os = require("os");
4
5
 
5
6
  // Fix node-pty spawn-helper permissions on macOS (both arm64 and x64)
6
7
  const platforms = ["darwin-arm64", "darwin-x64"];
@@ -28,3 +29,76 @@ for (const platform of platforms) {
28
29
  // Silently ignore - not critical for non-macOS or if node-pty not installed
29
30
  }
30
31
  }
32
+
33
+ // Collect all skill sources from package
34
+ function collectSkillSources(pkgRoot) {
35
+ const sources = [];
36
+
37
+ // Top-level SKILLS/
38
+ const topSkills = path.join(pkgRoot, "SKILLS");
39
+ if (fs.existsSync(topSkills)) {
40
+ for (const entry of fs.readdirSync(topSkills, { withFileTypes: true })) {
41
+ if (entry.isDirectory()) {
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
+ }
46
+ }
47
+ }
48
+ }
49
+
50
+ // modules/*/SKILLS/
51
+ const modulesDir = path.join(pkgRoot, "modules");
52
+ if (fs.existsSync(modulesDir)) {
53
+ for (const mod of fs.readdirSync(modulesDir, { withFileTypes: true })) {
54
+ if (!mod.isDirectory()) continue;
55
+ const modSkills = path.join(modulesDir, mod.name, "SKILLS");
56
+ if (!fs.existsSync(modSkills)) continue;
57
+ for (const entry of fs.readdirSync(modSkills, { withFileTypes: true })) {
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 });
62
+ }
63
+ }
64
+ }
65
+ }
66
+
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 });
93
+
94
+ let installed = 0;
95
+ for (const { name, md } of sources) {
96
+ forceSymlink(md, path.join(commandsDir, `${name}.md`));
97
+ installed += 1;
98
+ }
99
+ console.log(`[postinstall] Installed ${installed} ufoo command(s) to ${commandsDir}`);
100
+ }
101
+ } catch (err) {
102
+ // Non-fatal — skills can be installed manually via `ufoo skills install`
103
+ console.log(`[postinstall] Skipped skills install: ${err.message}`);
104
+ }