vorpl-setup 0.1.1 → 0.2.0
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/index.js +34 -68
- package/package.json +1 -15
package/index.js
CHANGED
|
@@ -16,8 +16,6 @@ const https = require('https');
|
|
|
16
16
|
const API_KEY = process.argv[2];
|
|
17
17
|
const DATA_DIR = path.join(os.homedir(), '.vorpl');
|
|
18
18
|
const CONFIG_PATH = path.join(DATA_DIR, 'config.json');
|
|
19
|
-
const PLUGIN_DIR = path.join(os.homedir(), '.claude', 'plugins', 'vorpl');
|
|
20
|
-
const PLUGIN_BASE_URL = 'https://vorpl.ai/plugin';
|
|
21
19
|
|
|
22
20
|
function log(msg) { console.log(` ${msg}`); }
|
|
23
21
|
function success(msg) { console.log(` \x1b[32m${msg}\x1b[0m`); }
|
|
@@ -39,21 +37,13 @@ function validateKey(key) {
|
|
|
39
37
|
});
|
|
40
38
|
}
|
|
41
39
|
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
reject(new Error(`HTTP ${res.statusCode} for ${url}`));
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
let data = '';
|
|
53
|
-
res.on('data', chunk => (data += chunk));
|
|
54
|
-
res.on('end', () => resolve(data));
|
|
55
|
-
}).on('error', reject);
|
|
56
|
-
});
|
|
40
|
+
function runCmd(cmd) {
|
|
41
|
+
try {
|
|
42
|
+
execSync(cmd, { stdio: 'pipe', timeout: 60000 });
|
|
43
|
+
return true;
|
|
44
|
+
} catch (e) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
57
47
|
}
|
|
58
48
|
|
|
59
49
|
async function main() {
|
|
@@ -73,40 +63,41 @@ async function main() {
|
|
|
73
63
|
if (valid) {
|
|
74
64
|
success('API key valid.');
|
|
75
65
|
} else {
|
|
76
|
-
warn('Could not validate key
|
|
66
|
+
warn('Could not validate key. Continuing anyway.');
|
|
77
67
|
}
|
|
78
68
|
|
|
79
|
-
// ──
|
|
80
|
-
log('
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
manifest = JSON.parse(manifestData);
|
|
86
|
-
success(`Plugin v${manifest.version} found.`);
|
|
87
|
-
} catch (e) {
|
|
88
|
-
fail(`Could not download plugin manifest: ${e.message}`);
|
|
69
|
+
// ── Check Claude Code ──────────────────────────────────
|
|
70
|
+
log('Checking Claude Code ...');
|
|
71
|
+
const hasClaude = runCmd('claude --version');
|
|
72
|
+
if (!hasClaude) {
|
|
73
|
+
fail('Claude Code CLI not found.');
|
|
74
|
+
log('Install it first: https://claude.ai/download');
|
|
89
75
|
process.exit(1);
|
|
90
76
|
}
|
|
77
|
+
success('Claude Code found.');
|
|
91
78
|
|
|
92
|
-
//
|
|
93
|
-
|
|
94
|
-
|
|
79
|
+
// ── Add marketplace ────────────────────────────────────
|
|
80
|
+
log('Adding Vorpl marketplace ...');
|
|
81
|
+
const added = runCmd('claude plugin marketplace add https://vorpl.ai');
|
|
82
|
+
if (added) {
|
|
83
|
+
success('Marketplace added.');
|
|
84
|
+
} else {
|
|
85
|
+
warn('Marketplace may already exist.');
|
|
95
86
|
}
|
|
96
87
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
downloaded++;
|
|
105
|
-
} catch (e) {
|
|
106
|
-
warn(`Could not download ${file}: ${e.message}`);
|
|
107
|
-
}
|
|
88
|
+
// ── Install plugin ─────────────────────────────────────
|
|
89
|
+
log('Installing Vorpl plugin ...');
|
|
90
|
+
const installed = runCmd('claude plugin install vorpl@vorpl');
|
|
91
|
+
if (installed) {
|
|
92
|
+
success('Plugin installed.');
|
|
93
|
+
} else {
|
|
94
|
+
warn('Plugin may already be installed.');
|
|
108
95
|
}
|
|
109
|
-
|
|
96
|
+
|
|
97
|
+
// ── Enable plugin ──────────────────────────────────────
|
|
98
|
+
log('Enabling plugin ...');
|
|
99
|
+
runCmd('claude plugin enable vorpl@vorpl');
|
|
100
|
+
success('Plugin enabled.');
|
|
110
101
|
|
|
111
102
|
// ── Create data directory ──────────────────────────────
|
|
112
103
|
log('Setting up data directory ...');
|
|
@@ -154,31 +145,6 @@ async function main() {
|
|
|
154
145
|
fs.writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2), 'utf8');
|
|
155
146
|
success('Configuration saved.');
|
|
156
147
|
|
|
157
|
-
// ── Register plugin in Claude Code settings ────────────
|
|
158
|
-
log('Registering plugin ...');
|
|
159
|
-
const settingsPath = path.join(os.homedir(), '.claude', 'settings.json');
|
|
160
|
-
|
|
161
|
-
try {
|
|
162
|
-
let settings = {};
|
|
163
|
-
if (fs.existsSync(settingsPath)) {
|
|
164
|
-
settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (!Array.isArray(settings.enabledPlugins)) settings.enabledPlugins = [];
|
|
168
|
-
|
|
169
|
-
const alreadyRegistered = settings.enabledPlugins.some(p => p.id === 'vorpl@local');
|
|
170
|
-
if (!alreadyRegistered) {
|
|
171
|
-
settings.enabledPlugins.push({
|
|
172
|
-
id: 'vorpl@local',
|
|
173
|
-
source: { type: 'local', path: PLUGIN_DIR },
|
|
174
|
-
});
|
|
175
|
-
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n', 'utf8');
|
|
176
|
-
}
|
|
177
|
-
success('Plugin registered.');
|
|
178
|
-
} catch (e) {
|
|
179
|
-
warn('Could not register plugin automatically. You may need to restart Claude Code.');
|
|
180
|
-
}
|
|
181
|
-
|
|
182
148
|
// ── Done ───────────────────────────────────────────────
|
|
183
149
|
console.log(`
|
|
184
150
|
─────────────────────────────────────
|
package/package.json
CHANGED
|
@@ -1,15 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "vorpl-setup",
|
|
3
|
-
"version": "0.1.1",
|
|
4
|
-
"description": "One-command Vorpl setup for Claude Code",
|
|
5
|
-
"bin": {
|
|
6
|
-
"vorpl-setup": "index.js"
|
|
7
|
-
},
|
|
8
|
-
"keywords": [
|
|
9
|
-
"vorpl",
|
|
10
|
-
"claude-code",
|
|
11
|
-
"ai",
|
|
12
|
-
"coding"
|
|
13
|
-
],
|
|
14
|
-
"license": "MIT"
|
|
15
|
-
}
|
|
1
|
+
{"name":"vorpl-setup","version":"0.2.0","description":"One-command Vorpl setup for Claude Code","bin":{"vorpl-setup":"index.js"},"keywords":["vorpl","claude-code","ai","coding"],"license":"MIT"}
|