-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.js
More file actions
executable file
·44 lines (37 loc) · 1.2 KB
/
Copy pathinstall.js
File metadata and controls
executable file
·44 lines (37 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env node
const fs = require("fs");
const path = require("path");
const os = require("os");
const SKILL = path.join(__dirname, "SKILL.md");
const home = os.homedir();
const targets = [
// Claude Code (skill subdirectory format)
path.join(home, ".claude", "skills", "bye"),
// OpenCode (native location)
path.join(home, ".config", "opencode", "skills", "bye"),
];
let installed = 0;
for (const dir of targets) {
try {
fs.mkdirSync(dir, { recursive: true });
fs.copyFileSync(SKILL, path.join(dir, "SKILL.md"));
console.log(`✓ Installed to ${dir}/SKILL.md`);
installed++;
} catch (err) {
console.warn(`✗ Skipped ${dir}: ${err.message}`);
}
}
// Remove stale commands/bye.md left by older versions of this package
const staleCommand = path.join(home, ".claude", "commands", "bye.md");
try {
fs.unlinkSync(staleCommand);
console.log(`✓ Removed stale ${staleCommand}`);
} catch (err) {
if (err.code !== "ENOENT") console.warn(`✗ Could not remove ${staleCommand}: ${err.message}`);
}
if (installed > 0) {
console.log(`\nDone! Use /bye to wrap up any coding session.`);
} else {
console.error("Installation failed — no targets were writable.");
process.exit(1);
}