@only1btayy/g2w 1.0.0 → 1.0.1
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/lib/install.js +5 -25
- package/package.json +1 -1
package/lib/install.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const os = require('os');
|
|
4
|
-
const readline = require('readline');
|
|
5
|
-
|
|
6
4
|
const SKILLS_SRC = path.join(__dirname, '../skills');
|
|
7
5
|
|
|
8
6
|
const G2W_HOOKS = {
|
|
@@ -30,11 +28,6 @@ const G2W_HOOKS = {
|
|
|
30
28
|
]
|
|
31
29
|
};
|
|
32
30
|
|
|
33
|
-
function prompt(question) {
|
|
34
|
-
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
35
|
-
return new Promise(resolve => rl.question(question, answer => { rl.close(); resolve(answer.trim()); }));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
31
|
function copySkills(targetBase) {
|
|
39
32
|
const dest = path.join(targetBase, '.claude', 'skills', 'g2w');
|
|
40
33
|
fs.mkdirSync(dest, { recursive: true });
|
|
@@ -110,25 +103,12 @@ function removeHooks(targetBase) {
|
|
|
110
103
|
fs.writeFileSync(settingsPath, JSON.stringify(existing, null, 2));
|
|
111
104
|
}
|
|
112
105
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
G2W — Install
|
|
116
|
-
|
|
117
|
-
Where should G2W be installed?
|
|
118
|
-
|
|
119
|
-
1. Global ~/.claude/ available in all projects
|
|
120
|
-
2. Local ./.claude/ this project only
|
|
121
|
-
|
|
122
|
-
`);
|
|
123
|
-
const answer = await prompt('Enter 1 or 2: ');
|
|
124
|
-
if (answer === '1') return { base: os.homedir(), label: '~/.claude/' };
|
|
125
|
-
if (answer === '2') return { base: process.cwd(), label: `./.claude/` };
|
|
126
|
-
console.log('Invalid choice. Please enter 1 or 2.');
|
|
127
|
-
return getTarget();
|
|
106
|
+
function getTarget() {
|
|
107
|
+
return { base: os.homedir(), label: '~/.claude/' };
|
|
128
108
|
}
|
|
129
109
|
|
|
130
110
|
async function run() {
|
|
131
|
-
const { base, label } =
|
|
111
|
+
const { base, label } = getTarget();
|
|
132
112
|
const { dest, count } = copySkills(base);
|
|
133
113
|
const settingsPath = mergeHooks(base);
|
|
134
114
|
|
|
@@ -146,13 +126,13 @@ Open any project with Claude Code and type:
|
|
|
146
126
|
}
|
|
147
127
|
|
|
148
128
|
async function update() {
|
|
149
|
-
const { base, label } =
|
|
129
|
+
const { base, label } = getTarget();
|
|
150
130
|
copySkills(base);
|
|
151
131
|
console.log(`\n✅ G2W skills updated at ${label}\n`);
|
|
152
132
|
}
|
|
153
133
|
|
|
154
134
|
async function uninstall() {
|
|
155
|
-
const { base, label } =
|
|
135
|
+
const { base, label } = getTarget();
|
|
156
136
|
const removed = removeSkills(base);
|
|
157
137
|
removeHooks(base);
|
|
158
138
|
|