vorpl-setup 0.1.1 → 1.0.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.
Files changed (2) hide show
  1. package/index.js +34 -68
  2. package/package.json +1 -1
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 downloadFile(url) {
43
- return new Promise((resolve, reject) => {
44
- https.get(url, { timeout: 10000 }, (res) => {
45
- if (res.statusCode === 301 || res.statusCode === 302 || res.statusCode === 308) {
46
- return downloadFile(res.headers.location).then(resolve).catch(reject);
47
- }
48
- if (res.statusCode !== 200) {
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 (API may be starting up). Continuing anyway.');
66
+ warn('Could not validate key. Continuing anyway.');
77
67
  }
78
68
 
79
- // ── Download plugin files ──────────────────────────────
80
- log('Downloading Vorpl plugin ...');
81
-
82
- let manifest;
83
- try {
84
- const manifestData = await downloadFile(`${PLUGIN_BASE_URL}/manifest.json`);
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
- // Create plugin directory
93
- if (!fs.existsSync(PLUGIN_DIR)) {
94
- fs.mkdirSync(PLUGIN_DIR, { recursive: true });
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
- let downloaded = 0;
98
- for (const file of manifest.files) {
99
- try {
100
- const content = await downloadFile(`${PLUGIN_BASE_URL}/${file}`);
101
- const filePath = path.join(PLUGIN_DIR, file);
102
- fs.mkdirSync(path.dirname(filePath), { recursive: true });
103
- fs.writeFileSync(filePath, content, 'utf8');
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
- success(`Downloaded ${downloaded}/${manifest.files.length} files.`);
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,6 +1,6 @@
1
1
  {
2
2
  "name": "vorpl-setup",
3
- "version": "0.1.1",
3
+ "version": "1.0.0",
4
4
  "description": "One-command Vorpl setup for Claude Code",
5
5
  "bin": {
6
6
  "vorpl-setup": "index.js"