u-foo 1.2.4 → 1.2.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/package.json +1 -1
- package/scripts/postinstall.js +62 -0
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -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,64 @@ 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
|
+
// 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 = [];
|
|
42
|
+
|
|
43
|
+
// Top-level SKILLS/
|
|
44
|
+
const topSkills = path.join(pkgRoot, "SKILLS");
|
|
45
|
+
if (fs.existsSync(topSkills)) {
|
|
46
|
+
for (const entry of fs.readdirSync(topSkills, { withFileTypes: true })) {
|
|
47
|
+
if (entry.isDirectory()) {
|
|
48
|
+
skillSources.push({ name: entry.name, src: path.join(topSkills, entry.name) });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// modules/*/SKILLS/
|
|
54
|
+
const modulesDir = path.join(pkgRoot, "modules");
|
|
55
|
+
if (fs.existsSync(modulesDir)) {
|
|
56
|
+
for (const mod of fs.readdirSync(modulesDir, { withFileTypes: true })) {
|
|
57
|
+
if (!mod.isDirectory()) continue;
|
|
58
|
+
const modSkills = path.join(modulesDir, mod.name, "SKILLS");
|
|
59
|
+
if (!fs.existsSync(modSkills)) continue;
|
|
60
|
+
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) });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (skillSources.length > 0) {
|
|
69
|
+
fs.mkdirSync(claudeSkillsDir, { recursive: true });
|
|
70
|
+
|
|
71
|
+
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);
|
|
83
|
+
installed += 1;
|
|
84
|
+
}
|
|
85
|
+
if (installed > 0) {
|
|
86
|
+
console.log(`[postinstall] Installed ${installed} ufoo skill(s) to ${claudeSkillsDir}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
} catch (err) {
|
|
90
|
+
// Non-fatal — skills can be installed manually via `ufoo skills install`
|
|
91
|
+
console.log(`[postinstall] Skipped skills install: ${err.message}`);
|
|
92
|
+
}
|