vesper-wizard 2.3.1 → 2.3.3

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 (214) hide show
  1. package/README.md +37 -322
  2. package/package.json +34 -100
  3. package/vesper-mcp-config.json +6 -0
  4. package/{scripts/wizard.js → wizard.js} +1 -1
  5. package/LICENSE +0 -21
  6. package/build/cache/cdn.js +0 -34
  7. package/build/cache/service.js +0 -63
  8. package/build/cleaning/cleaner.js +0 -81
  9. package/build/cleaning/evaluator.js +0 -89
  10. package/build/cleaning/executor.js +0 -62
  11. package/build/cleaning/exporter.js +0 -87
  12. package/build/cleaning/planner.js +0 -127
  13. package/build/cleaning/rules.js +0 -57
  14. package/build/cleaning/types.js +0 -1
  15. package/build/cloud/adapters/local.js +0 -37
  16. package/build/cloud/adapters/s3.js +0 -24
  17. package/build/cloud/adapters/supabase.js +0 -49
  18. package/build/cloud/storage-manager.js +0 -26
  19. package/build/cloud/types.js +0 -1
  20. package/build/compliance/service.js +0 -73
  21. package/build/compliance/store.js +0 -80
  22. package/build/compliance/types.js +0 -1
  23. package/build/config/config-manager.js +0 -221
  24. package/build/config/secure-keys.js +0 -51
  25. package/build/config/user-config.js +0 -48
  26. package/build/data/processing-worker.js +0 -23
  27. package/build/data/streaming.js +0 -38
  28. package/build/data/worker-pool.js +0 -39
  29. package/build/export/exporter.js +0 -82
  30. package/build/export/packager.js +0 -100
  31. package/build/export/types.js +0 -1
  32. package/build/fusion/aligner.js +0 -56
  33. package/build/fusion/deduplicator.js +0 -69
  34. package/build/fusion/engine.js +0 -69
  35. package/build/fusion/harmonizer.js +0 -39
  36. package/build/fusion/orchestrator.js +0 -86
  37. package/build/fusion/types.js +0 -1
  38. package/build/gateway/unified-dataset-gateway.js +0 -410
  39. package/build/index.js +0 -3068
  40. package/build/ingestion/hf-downloader.js +0 -171
  41. package/build/ingestion/ingestor.js +0 -271
  42. package/build/ingestion/kaggle-downloader.js +0 -102
  43. package/build/install/install-service.js +0 -46
  44. package/build/jobs/manager.js +0 -136
  45. package/build/jobs/queue.js +0 -59
  46. package/build/jobs/types.js +0 -1
  47. package/build/lib/supabase.js +0 -3
  48. package/build/metadata/dataworld-source.js +0 -89
  49. package/build/metadata/domain.js +0 -147
  50. package/build/metadata/github-scraper.js +0 -47
  51. package/build/metadata/institutional-scrapers.js +0 -49
  52. package/build/metadata/kaggle-scraper.js +0 -182
  53. package/build/metadata/kaggle-source.js +0 -70
  54. package/build/metadata/license.js +0 -68
  55. package/build/metadata/monitoring-service.js +0 -107
  56. package/build/metadata/monitoring-store.js +0 -78
  57. package/build/metadata/monitoring-types.js +0 -1
  58. package/build/metadata/openml-source.js +0 -87
  59. package/build/metadata/quality.js +0 -48
  60. package/build/metadata/rate-limiter.js +0 -128
  61. package/build/metadata/scraper.js +0 -448
  62. package/build/metadata/store.js +0 -340
  63. package/build/metadata/types.js +0 -1
  64. package/build/metadata/uci-scraper.js +0 -49
  65. package/build/monitoring/observability.js +0 -76
  66. package/build/preparation/target-detector.js +0 -75
  67. package/build/python/__pycache__/config.cpython-312.pyc +0 -0
  68. package/build/python/asset_downloader_engine.py +0 -94
  69. package/build/python/cleaner.py +0 -226
  70. package/build/python/config.py +0 -263
  71. package/build/python/convert_engine.py +0 -92
  72. package/build/python/dataworld_engine.py +0 -208
  73. package/build/python/export_engine.py +0 -288
  74. package/build/python/framework_adapters.py +0 -100
  75. package/build/python/fusion_engine.py +0 -368
  76. package/build/python/github_adapter.py +0 -106
  77. package/build/python/hf_fallback.py +0 -298
  78. package/build/python/image_engine.py +0 -86
  79. package/build/python/kaggle_engine.py +0 -295
  80. package/build/python/media_engine.py +0 -133
  81. package/build/python/nasa_adapter.py +0 -82
  82. package/build/python/normalize_engine.py +0 -83
  83. package/build/python/openml_engine.py +0 -146
  84. package/build/python/quality_engine.py +0 -267
  85. package/build/python/row_count.py +0 -54
  86. package/build/python/splitter_engine.py +0 -283
  87. package/build/python/target_engine.py +0 -154
  88. package/build/python/test_framework_adapters.py +0 -61
  89. package/build/python/test_fusion_engine.py +0 -89
  90. package/build/python/uci_adapter.py +0 -94
  91. package/build/python/vesper/__init__.py +0 -1
  92. package/build/python/vesper/__pycache__/__init__.cpython-312.pyc +0 -0
  93. package/build/python/vesper/core/__init__.py +0 -1
  94. package/build/python/vesper/core/__pycache__/__init__.cpython-312.pyc +0 -0
  95. package/build/python/vesper/core/__pycache__/asset_downloader.cpython-312.pyc +0 -0
  96. package/build/python/vesper/core/__pycache__/download_recipe.cpython-312.pyc +0 -0
  97. package/build/python/vesper/core/asset_downloader.py +0 -679
  98. package/build/python/vesper/core/download_recipe.py +0 -104
  99. package/build/python/worldbank_adapter.py +0 -99
  100. package/build/quality/analyzer.js +0 -93
  101. package/build/quality/image-analyzer.js +0 -114
  102. package/build/quality/media-analyzer.js +0 -115
  103. package/build/quality/quality-orchestrator.js +0 -162
  104. package/build/quality/types.js +0 -1
  105. package/build/scripts/build-index.js +0 -54
  106. package/build/scripts/check-db.js +0 -73
  107. package/build/scripts/check-jobs.js +0 -24
  108. package/build/scripts/check-naruto.js +0 -17
  109. package/build/scripts/cleanup-kaggle.js +0 -41
  110. package/build/scripts/demo-full-pipeline.js +0 -62
  111. package/build/scripts/demo-ui.js +0 -58
  112. package/build/scripts/e2e-demo.js +0 -72
  113. package/build/scripts/massive-scrape.js +0 -103
  114. package/build/scripts/ops-dashboard.js +0 -33
  115. package/build/scripts/repro-bug.js +0 -37
  116. package/build/scripts/repro-export-bug.js +0 -56
  117. package/build/scripts/scrape-metadata.js +0 -100
  118. package/build/scripts/search-cli.js +0 -26
  119. package/build/scripts/test-bias.js +0 -45
  120. package/build/scripts/test-caching.js +0 -51
  121. package/build/scripts/test-cleaning.js +0 -76
  122. package/build/scripts/test-cloud-storage.js +0 -48
  123. package/build/scripts/test-compliance.js +0 -58
  124. package/build/scripts/test-conversion.js +0 -64
  125. package/build/scripts/test-custom-rules.js +0 -58
  126. package/build/scripts/test-db-opt.js +0 -63
  127. package/build/scripts/test-export-custom.js +0 -33
  128. package/build/scripts/test-exporter.js +0 -53
  129. package/build/scripts/test-fusion.js +0 -61
  130. package/build/scripts/test-github.js +0 -27
  131. package/build/scripts/test-group-split.js +0 -52
  132. package/build/scripts/test-hf-download.js +0 -29
  133. package/build/scripts/test-holdout-manager.js +0 -61
  134. package/build/scripts/test-hybrid-search.js +0 -41
  135. package/build/scripts/test-image-analysis.js +0 -50
  136. package/build/scripts/test-ingestion-infra.js +0 -39
  137. package/build/scripts/test-install.js +0 -40
  138. package/build/scripts/test-institutional.js +0 -26
  139. package/build/scripts/test-integrity.js +0 -41
  140. package/build/scripts/test-jit.js +0 -42
  141. package/build/scripts/test-job-queue.js +0 -62
  142. package/build/scripts/test-kaggle-download.js +0 -34
  143. package/build/scripts/test-large-data.js +0 -50
  144. package/build/scripts/test-mcp-v5.js +0 -74
  145. package/build/scripts/test-media-analysis.js +0 -61
  146. package/build/scripts/test-monitoring.js +0 -91
  147. package/build/scripts/test-observability.js +0 -106
  148. package/build/scripts/test-packager.js +0 -55
  149. package/build/scripts/test-pipeline.js +0 -50
  150. package/build/scripts/test-planning.js +0 -64
  151. package/build/scripts/test-privacy.js +0 -38
  152. package/build/scripts/test-production-sync.js +0 -36
  153. package/build/scripts/test-quality.js +0 -43
  154. package/build/scripts/test-robust-ingestion.js +0 -41
  155. package/build/scripts/test-schema.js +0 -45
  156. package/build/scripts/test-split-validation.js +0 -40
  157. package/build/scripts/test-splitter.js +0 -93
  158. package/build/scripts/test-target-detector.js +0 -29
  159. package/build/scripts/test-uci.js +0 -27
  160. package/build/scripts/test-unified-quality.js +0 -86
  161. package/build/scripts/test-write.js +0 -14
  162. package/build/scripts/verify-integration.js +0 -57
  163. package/build/scripts/verify-priority.js +0 -33
  164. package/build/search/embedder.js +0 -34
  165. package/build/search/engine.js +0 -190
  166. package/build/search/jit-orchestrator.js +0 -262
  167. package/build/search/query-intent.js +0 -509
  168. package/build/search/vector-store.js +0 -123
  169. package/build/splitting/splitter.js +0 -82
  170. package/build/splitting/types.js +0 -1
  171. package/build/tools/formatter.js +0 -251
  172. package/build/utils/downloader.js +0 -52
  173. package/build/utils/python-runtime.js +0 -130
  174. package/build/utils/selector.js +0 -69
  175. package/mcp-config-template.json +0 -18
  176. package/scripts/postinstall.cjs +0 -170
  177. package/scripts/preindex_registry.cjs +0 -157
  178. package/scripts/refresh-index.cjs +0 -87
  179. package/scripts/wizard.cjs +0 -601
  180. package/src/python/__pycache__/config.cpython-312.pyc +0 -0
  181. package/src/python/__pycache__/export_engine.cpython-312.pyc +0 -0
  182. package/src/python/__pycache__/framework_adapters.cpython-312.pyc +0 -0
  183. package/src/python/__pycache__/fusion_engine.cpython-312.pyc +0 -0
  184. package/src/python/__pycache__/kaggle_engine.cpython-312.pyc +0 -0
  185. package/src/python/asset_downloader_engine.py +0 -94
  186. package/src/python/cleaner.py +0 -226
  187. package/src/python/config.py +0 -263
  188. package/src/python/convert_engine.py +0 -92
  189. package/src/python/dataworld_engine.py +0 -208
  190. package/src/python/export_engine.py +0 -288
  191. package/src/python/framework_adapters.py +0 -100
  192. package/src/python/fusion_engine.py +0 -368
  193. package/src/python/github_adapter.py +0 -106
  194. package/src/python/hf_fallback.py +0 -298
  195. package/src/python/image_engine.py +0 -86
  196. package/src/python/kaggle_engine.py +0 -295
  197. package/src/python/media_engine.py +0 -133
  198. package/src/python/nasa_adapter.py +0 -82
  199. package/src/python/normalize_engine.py +0 -83
  200. package/src/python/openml_engine.py +0 -146
  201. package/src/python/quality_engine.py +0 -267
  202. package/src/python/requirements.txt +0 -12
  203. package/src/python/row_count.py +0 -54
  204. package/src/python/splitter_engine.py +0 -283
  205. package/src/python/target_engine.py +0 -154
  206. package/src/python/test_framework_adapters.py +0 -61
  207. package/src/python/test_fusion_engine.py +0 -89
  208. package/src/python/uci_adapter.py +0 -94
  209. package/src/python/vesper/__init__.py +0 -1
  210. package/src/python/vesper/core/__init__.py +0 -1
  211. package/src/python/vesper/core/asset_downloader.py +0 -679
  212. package/src/python/vesper/core/download_recipe.py +0 -104
  213. package/src/python/worldbank_adapter.py +0 -99
  214. package/wizard.cjs +0 -3
@@ -1,601 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // ─────────────────────────────────────────────────────────────
4
- // vesper-wizard — Zero-friction local setup for Vesper MCP
5
- // Run: npx vesper-wizard@latest
6
- // ─────────────────────────────────────────────────────────────
7
-
8
- const fs = require('fs');
9
- const path = require('path');
10
- const os = require('os');
11
- const crypto = require('crypto');
12
- const { execSync, spawnSync } = require('child_process');
13
- const http = require('http');
14
- const https = require('https');
15
- const readline = require('readline');
16
-
17
- // ── Paths ────────────────────────────────────────────────────
18
- const HOME = os.homedir();
19
- const VESPER_DIR = path.join(HOME, '.vesper');
20
- const CONFIG_TOML = path.join(VESPER_DIR, 'config.toml');
21
- const DATA_DIR = path.join(VESPER_DIR, 'data');
22
- const IS_WIN = process.platform === 'win32';
23
- const APPDATA = process.env.APPDATA || path.join(HOME, 'AppData', 'Roaming');
24
-
25
- // ── Helpers ──────────────────────────────────────────────────
26
- function ensureDir(dir) {
27
- if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
28
- }
29
-
30
- function generateLocalKey() {
31
- const random = crypto.randomBytes(24).toString('hex');
32
- return `vesper_sk_local_${random}`;
33
- }
34
-
35
- function readToml(filePath) {
36
- if (!fs.existsSync(filePath)) return {};
37
- const content = fs.readFileSync(filePath, 'utf8');
38
- const obj = {};
39
- for (const line of content.split('\n')) {
40
- const m = line.match(/^\s*(\w+)\s*=\s*"(.*)"\s*$/);
41
- if (m) obj[m[1]] = m[2];
42
- }
43
- return obj;
44
- }
45
-
46
- function writeToml(filePath, data) {
47
- ensureDir(path.dirname(filePath));
48
- const lines = Object.entries(data).map(([k, v]) => `${k} = "${v}"`);
49
- fs.writeFileSync(filePath, lines.join('\n') + '\n', 'utf8');
50
- }
51
-
52
- function dim(text) { return `\x1b[2m${text}\x1b[0m`; }
53
- function bold(text) { return `\x1b[1m${text}\x1b[0m`; }
54
- function green(text) { return `\x1b[32m${text}\x1b[0m`; }
55
- function cyan(text) { return `\x1b[36m${text}\x1b[0m`; }
56
- function yellow(text) { return `\x1b[33m${text}\x1b[0m`; }
57
- function red(text) { return `\x1b[31m${text}\x1b[0m`; }
58
- function magenta(text) { return `\x1b[35m${text}\x1b[0m`; }
59
-
60
- // ── Vesper API URL resolution ────────────────────────────────
61
- const VESPER_API_URL = process.env.VESPER_API_URL || '';
62
- const DEFAULT_VESPER_API_CANDIDATES = [
63
- 'http://localhost:3000',
64
- 'http://127.0.0.1:3000',
65
- 'https://getvesper.dev',
66
- ];
67
-
68
- // ── Device Auth Helpers ──────────────────────────────────────
69
- function httpJson(method, url, body) {
70
- return new Promise((resolve, reject) => {
71
- const parsed = new URL(url);
72
- const lib = parsed.protocol === 'https:' ? https : http;
73
- const opts = {
74
- method,
75
- hostname: parsed.hostname,
76
- port: parsed.port || (parsed.protocol === 'https:' ? 443 : 80),
77
- path: parsed.pathname + parsed.search,
78
- headers: { 'Content-Type': 'application/json' },
79
- };
80
- const req = lib.request(opts, (res) => {
81
- let data = '';
82
- res.on('data', (chunk) => (data += chunk));
83
- res.on('end', () => {
84
- try { resolve({ status: res.statusCode, body: JSON.parse(data) }); }
85
- catch { resolve({ status: res.statusCode, body: data }); }
86
- });
87
- });
88
- req.on('error', reject);
89
- if (body) req.write(JSON.stringify(body));
90
- req.end();
91
- });
92
- }
93
-
94
- async function probeDeviceAuth(baseUrl) {
95
- try {
96
- const res = await httpJson('POST', `${baseUrl}/api/auth/device/start`);
97
- if (res.status === 201 && !!res.body && !!res.body.code) {
98
- return { baseUrl, status: 'ready', response: res.body };
99
- }
100
-
101
- if (res.status === 503 && res.body && res.body.requiresSetup) {
102
- return {
103
- baseUrl,
104
- status: 'setup-required',
105
- response: res.body,
106
- message: res.body.error || 'Auth storage is not initialized.',
107
- };
108
- }
109
-
110
- return {
111
- baseUrl,
112
- status: 'unreachable',
113
- response: res.body,
114
- message: typeof res.body === 'string' ? res.body : JSON.stringify(res.body),
115
- };
116
- } catch (error) {
117
- return {
118
- baseUrl,
119
- status: 'unreachable',
120
- message: error && error.message ? error.message : 'Request failed',
121
- };
122
- }
123
- }
124
-
125
- async function resolveVesperApiBaseUrl() {
126
- const candidates = VESPER_API_URL
127
- ? [VESPER_API_URL]
128
- : DEFAULT_VESPER_API_CANDIDATES;
129
-
130
- let setupRequiredProbe = null;
131
-
132
- for (const candidate of candidates) {
133
- const probe = await probeDeviceAuth(candidate);
134
- if (probe.status === 'ready') {
135
- return probe;
136
- }
137
-
138
- if (!setupRequiredProbe && probe.status === 'setup-required') {
139
- setupRequiredProbe = probe;
140
- }
141
- }
142
-
143
- return setupRequiredProbe;
144
- }
145
-
146
- function openBrowser(url) {
147
- try {
148
- if (process.platform === 'win32') {
149
- spawnSync('cmd', ['/c', 'start', '', url], { stdio: 'ignore' });
150
- } else if (process.platform === 'darwin') {
151
- spawnSync('open', [url], { stdio: 'ignore' });
152
- } else {
153
- spawnSync('xdg-open', [url], { stdio: 'ignore' });
154
- }
155
- } catch { /* browser open is best-effort */ }
156
- }
157
-
158
- function askYesNo(question) {
159
- return new Promise((resolve) => {
160
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
161
- rl.question(` ${question} ${dim('[Y/n]')} `, (answer) => {
162
- rl.close();
163
- resolve(!answer || answer.toLowerCase().startsWith('y'));
164
- });
165
- });
166
- }
167
-
168
- function askInput(question) {
169
- return new Promise((resolve) => {
170
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
171
- rl.question(` ${question} `, (answer) => {
172
- rl.close();
173
- resolve(String(answer || '').trim());
174
- });
175
- });
176
- }
177
-
178
- async function askChoice(question, choices, defaultValue) {
179
- console.log(` ${question}`);
180
- choices.forEach((choice, index) => {
181
- console.log(` ${dim(String(index + 1) + ')')} ${choice.label}`);
182
- });
183
-
184
- const prompt = defaultValue ? `${dim('[default: ' + defaultValue + ']')}` : '';
185
- const answer = await askInput(`${prompt} ${cyan('→')} Choose an option:`);
186
- if (!answer && defaultValue) {
187
- return defaultValue;
188
- }
189
-
190
- const numeric = Number(answer);
191
- if (Number.isFinite(numeric) && numeric >= 1 && numeric <= choices.length) {
192
- return choices[numeric - 1].value;
193
- }
194
-
195
- const matched = choices.find((choice) => choice.value === answer);
196
- return matched ? matched.value : defaultValue;
197
- }
198
-
199
- function isCloudApiKey(value) {
200
- return !!value && value.startsWith('vesper_sk_') && !value.startsWith('vesper_sk_local_');
201
- }
202
-
203
- async function promptForManualApiKey() {
204
- console.log(`\n ${cyan('■')} ${bold('Manual API Key')}`);
205
- console.log(` ${dim('Paste a Vesper cloud API key. It will be stored locally in config.toml.\n')}`);
206
-
207
- while (true) {
208
- const value = await askInput(`${cyan('→')} Vesper API key:`);
209
- if (isCloudApiKey(value)) {
210
- return value;
211
- }
212
- console.log(` ${yellow('!')} ${yellow('Expected a Vesper key starting with vesper_sk_')}`);
213
- }
214
- }
215
-
216
- async function chooseAuthMode(existingKey, existingAuthMode) {
217
- const hasExistingKey = !!existingKey;
218
- if (hasExistingKey) {
219
- console.log(` ${dim('Current key:')} ${dim(existingKey.slice(0, 24) + '...')}`);
220
- console.log(` ${dim('Current mode:')} ${dim(existingAuthMode || (isCloudApiKey(existingKey) ? 'cloud' : 'local_unified'))}`);
221
- }
222
-
223
- const choices = [];
224
- choices.push({ value: 'browser', label: 'Sign in through the browser' });
225
- choices.push({ value: 'manual', label: 'Provide Vesper API key manually' });
226
-
227
- return await askChoice(`${cyan('→')} How do you want to authenticate Vesper?`, choices, 'browser');
228
- }
229
-
230
- async function deviceAuthFlow() {
231
- console.log(`\n ${cyan('■')} ${bold('Device Authentication')}`);
232
- console.log(` ${dim('Link your CLI to a Vesper account for cloud features\n')}`);
233
-
234
- const resolvedApiBaseUrl = await resolveVesperApiBaseUrl();
235
- if (!resolvedApiBaseUrl) {
236
- console.log(` ${red('✗')} ${red('Could not reach any Vesper auth endpoint.')}`);
237
- console.log(` ${dim('Tried:')} ${dim((VESPER_API_URL ? [VESPER_API_URL] : DEFAULT_VESPER_API_CANDIDATES).join(', '))}`);
238
- console.log(` ${dim('If your landing app is running locally, start it on http://localhost:3000 or set VESPER_API_URL.')}`);
239
- console.log(` ${dim('Falling back to manual key entry.\n')}`);
240
- return null;
241
- }
242
-
243
- if (resolvedApiBaseUrl.status === 'setup-required') {
244
- console.log(` ${yellow('!')} ${yellow('Reached Vesper auth endpoint, but local auth storage is not initialized.')}`);
245
- console.log(` ${dim('Endpoint:')} ${dim(resolvedApiBaseUrl.baseUrl)}`);
246
- console.log(` ${dim('Reason:')} ${dim(resolvedApiBaseUrl.message || 'Apply Supabase migrations first.')}`);
247
- console.log(` ${dim('Run the SQL in supabase/migrations/001_device_auth.sql and 002_rate_limits.sql, then retry.')}`);
248
- console.log(` ${dim('Falling back to manual key entry.\n')}`);
249
- return null;
250
- }
251
-
252
- console.log(` ${dim('Auth endpoint:')} ${dim(resolvedApiBaseUrl.baseUrl)}\n`);
253
-
254
- // Step 1: Call /api/auth/device/start
255
- process.stdout.write(` ${dim('Requesting device code...')}`);
256
- let startRes;
257
- try {
258
- startRes = await httpJson('POST', `${resolvedApiBaseUrl.baseUrl}/api/auth/device/start`);
259
- } catch (err) {
260
- console.log(` ${red('✗')}`);
261
- console.log(` ${red('Could not reach Vesper API at')} ${dim(resolvedApiBaseUrl.baseUrl)}`);
262
- console.log(` ${dim('Falling back to manual key entry.\n')}`);
263
- return null;
264
- }
265
-
266
- if (startRes.status !== 201 || !startRes.body.code) {
267
- console.log(` ${red('✗')}`);
268
- console.log(` ${red('Unexpected response:')} ${dim(JSON.stringify(startRes.body))}`);
269
- return null;
270
- }
271
-
272
- const { code, loginUrl } = startRes.body;
273
- console.log(` ${green('✓')}\n`);
274
-
275
- // Step 2: Display code and open browser
276
- console.log(` ┌───────────────────────────────────────────────┐`);
277
- console.log(` │ │`);
278
- console.log(` │ ${bold('Your device code:')} ${cyan(bold(code))} │`);
279
- console.log(` │ │`);
280
- console.log(` │ ${dim('Open this URL to sign in:')} │`);
281
- console.log(` │ ${cyan(loginUrl.padEnd(41))}│`);
282
- console.log(` │ │`);
283
- console.log(` └───────────────────────────────────────────────┘\n`);
284
-
285
- openBrowser(loginUrl);
286
- console.log(` ${dim('Browser opened automatically.')}`);
287
- console.log(` ${dim('Waiting for you to sign in...')}\n`);
288
-
289
- // Step 3: Poll until confirmed or expired
290
- const POLL_INTERVAL = 3000; // 3 seconds
291
- const MAX_POLLS = 200; // 10 min max (200 × 3s)
292
- let polls = 0;
293
- const spinner = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
294
-
295
- while (polls < MAX_POLLS) {
296
- polls++;
297
- const frame = spinner[polls % spinner.length];
298
- process.stdout.write(`\r ${cyan(frame)} Polling... (${polls})`);
299
-
300
- try {
301
- const pollRes = await httpJson('GET', `${resolvedApiBaseUrl.baseUrl}/api/auth/device/poll?code=${code}`);
302
-
303
- if (pollRes.body.status === 'confirmed' && pollRes.body.apiKey) {
304
- process.stdout.write(`\r ${green('✓')} Device authenticated! \n`);
305
- console.log(` ${dim('Email:')} ${pollRes.body.email || 'linked'}`);
306
- return pollRes.body.apiKey;
307
- }
308
-
309
- if (pollRes.body.status === 'expired') {
310
- process.stdout.write(`\r ${red('✗')} Device code expired. \n`);
311
- console.log(` ${dim('Run the wizard again to get a new code.')}`);
312
- return null;
313
- }
314
- } catch {
315
- // Network hiccup — keep polling
316
- }
317
-
318
- await new Promise((r) => setTimeout(r, POLL_INTERVAL));
319
- }
320
-
321
- process.stdout.write(`\r ${red('✗')} Timed out waiting for authentication.\n`);
322
- return null;
323
- }
324
-
325
- function printBanner() {
326
- console.log(`
327
- ${dim('─────────────────────────────────────────────────')}
328
-
329
- ${bold('██ ██ ███████ ███████ ██████ ███████ ██████')}
330
- ${bold('██ ██ ██ ██ ██ ██ ██ ██ ██')}
331
- ${bold('██ ██ █████ ███████ ██████ █████ ██████')}
332
- ${bold(' ██ ██ ██ ██ ██ ██ ██ ██')}
333
- ${bold(' ████ ███████ ███████ ██ ███████ ██ ██')}
334
-
335
- ${cyan('dataset intelligence layer')}
336
- ${dim('local-first • zero-config • agent-native')}
337
-
338
- ${dim('─────────────────────────────────────────────────')}
339
- `);
340
- }
341
-
342
- // ── MCP Auto-Config ──────────────────────────────────────────
343
- function getAllAgentConfigs() {
344
- const isMac = process.platform === 'darwin';
345
- return [
346
- {
347
- name: 'Claude Code',
348
- path: path.join(HOME, '.claude.json'),
349
- format: 'mcpServers',
350
- },
351
- {
352
- name: 'Claude Desktop',
353
- path: IS_WIN
354
- ? path.join(APPDATA, 'Claude', 'claude_desktop_config.json')
355
- : isMac
356
- ? path.join(HOME, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json')
357
- : path.join(HOME, '.config', 'claude', 'claude_desktop_config.json'),
358
- format: 'mcpServers',
359
- },
360
- {
361
- name: 'Cursor',
362
- path: path.join(HOME, '.cursor', 'mcp.json'),
363
- format: 'mcpServers',
364
- },
365
- {
366
- name: 'VS Code',
367
- path: IS_WIN
368
- ? path.join(APPDATA, 'Code', 'User', 'mcp.json')
369
- : isMac
370
- ? path.join(HOME, 'Library', 'Application Support', 'Code', 'User', 'mcp.json')
371
- : path.join(HOME, '.config', 'Code', 'User', 'mcp.json'),
372
- format: 'servers',
373
- },
374
- {
375
- name: 'Codex',
376
- path: path.join(HOME, '.codex', 'config.toml'),
377
- format: 'toml',
378
- },
379
- {
380
- name: 'Gemini CLI',
381
- path: path.join(HOME, '.gemini', 'settings.json'),
382
- format: 'mcpServers',
383
- },
384
- ];
385
- }
386
-
387
- function installMcpToAgent(agent) {
388
- const npxCmd = IS_WIN ? 'npx.cmd' : 'npx';
389
- const serverEntry = { command: npxCmd, args: ['-y', '@vespermcp/mcp-server@latest'] };
390
-
391
- try {
392
- if (agent.format === 'toml') {
393
- let content = fs.existsSync(agent.path) ? fs.readFileSync(agent.path, 'utf8') : '';
394
- if (content.includes('[mcp_servers.vesper]')) return true;
395
- ensureDir(path.dirname(agent.path));
396
- content += `\n[mcp_servers.vesper]\ncommand = "${serverEntry.command}"\nargs = [${serverEntry.args.map(a => `"${a}"`).join(', ')}]\n`;
397
- fs.writeFileSync(agent.path, content, 'utf8');
398
- return true;
399
- }
400
-
401
- let config = {};
402
- if (fs.existsSync(agent.path)) {
403
- try { config = JSON.parse(fs.readFileSync(agent.path, 'utf8').trim() || '{}'); } catch { config = {}; }
404
- } else {
405
- ensureDir(path.dirname(agent.path));
406
- }
407
-
408
- const key = agent.format === 'servers' ? 'servers' : 'mcpServers';
409
- if (!config[key]) config[key] = {};
410
-
411
- const entry = agent.format === 'servers'
412
- ? { type: 'stdio', ...serverEntry }
413
- : serverEntry;
414
-
415
- config[key].vesper = entry;
416
- fs.writeFileSync(agent.path, JSON.stringify(config, null, 2), 'utf8');
417
- return true;
418
- } catch {
419
- return false;
420
- }
421
- }
422
-
423
- // ── Server Health Check ──────────────────────────────────────
424
- async function checkServerHealth() {
425
- try {
426
- // Quick stdio check — spawn server and see if it responds
427
- const result = spawnSync(IS_WIN ? 'npx.cmd' : 'npx', ['-y', '@vespermcp/mcp-server@latest', '--version'], {
428
- timeout: 10000,
429
- encoding: 'utf8',
430
- stdio: ['pipe', 'pipe', 'pipe'],
431
- });
432
- return result.status === 0 || (result.stderr && result.stderr.includes('Vesper'));
433
- } catch {
434
- return false;
435
- }
436
- }
437
-
438
- // ── Main Wizard ──────────────────────────────────────────────
439
- async function main() {
440
- printBanner();
441
-
442
- console.log(` ${green('→')} Setting up Vesper on ${bold(os.hostname())}\n`);
443
-
444
- // ─── Step 1: Create directories ────────────────────────────
445
- process.stdout.write(` ${dim('[')}${cyan('1/6')}${dim(']')} Creating local directories...`);
446
- ensureDir(VESPER_DIR);
447
- ensureDir(DATA_DIR);
448
- ensureDir(path.join(DATA_DIR, 'raw'));
449
- ensureDir(path.join(DATA_DIR, 'processed'));
450
- ensureDir(path.join(VESPER_DIR, 'datasets'));
451
- console.log(` ${green('✓')}`);
452
-
453
- // ─── Step 2: Authenticate (device flow or local key) ──────
454
- console.log(`\n ${dim('[')}${cyan('2/6')}${dim(']')} Authentication`);
455
-
456
- const existing = readToml(CONFIG_TOML);
457
- let localKey = existing.api_key || '';
458
- let authMode = existing.auth_mode || '';
459
-
460
- const authChoice = await chooseAuthMode(localKey, authMode);
461
-
462
- if (authChoice === 'manual') {
463
- localKey = await promptForManualApiKey();
464
- authMode = 'cloud';
465
- console.log(` ${green('✓')} Cloud API key saved from manual input`);
466
- } else if (authChoice === 'browser') {
467
- const cloudKey = await deviceAuthFlow();
468
- if (cloudKey) {
469
- localKey = cloudKey;
470
- authMode = 'cloud';
471
- } else {
472
- console.log(`\n ${yellow('!')} Browser sign-in did not complete. Falling back to manual key entry.`);
473
- localKey = await promptForManualApiKey();
474
- authMode = 'cloud';
475
- }
476
- }
477
-
478
- const configData = { ...existing, api_key: localKey, auth_mode: authMode };
479
- writeToml(CONFIG_TOML, configData);
480
- console.log(` ${dim('Key:')} ${dim(localKey.slice(0, 24) + '...')} ${dim('→')} ${dim(CONFIG_TOML)}`);
481
-
482
- // ─── Step 3: Local vault initialization ────────────────────
483
- process.stdout.write(`\n ${dim('[')}${cyan('3/6')}${dim(']')} Initializing local credentials vault...`);
484
- const vaultData = readToml(CONFIG_TOML);
485
- if (!vaultData.auth_mode) vaultData.auth_mode = 'local_unified';
486
- writeToml(CONFIG_TOML, vaultData);
487
- console.log(` ${green('✓')}`);
488
- console.log(` ${dim('Mode:')} ${dim(vaultData.auth_mode === 'cloud' ? 'cloud (linked to Vesper account)' : 'single local Vesper key (no external keys required)')}`);
489
-
490
- // ─── Step 4: Install @vespermcp/mcp-server ─────────────────
491
- console.log(`\n ${dim('[')}${cyan('4/6')}${dim(']')} Installing Vesper MCP server...`);
492
- try {
493
- const npmCmd = IS_WIN ? 'npx.cmd' : 'npx';
494
- spawnSync(npmCmd, ['-y', '@vespermcp/mcp-server@latest', '--setup', '--silent'], {
495
- stdio: 'inherit',
496
- timeout: 120000,
497
- });
498
- console.log(` ${green('✓')} @vespermcp/mcp-server installed`);
499
- } catch {
500
- console.log(` ${yellow('⚠')} Could not auto-install — run manually: npx -y @vespermcp/mcp-server@latest --setup`);
501
- }
502
-
503
- // ─── Step 5: Auto-configure all detected IDEs ──────────────
504
- process.stdout.write(`\n ${dim('[')}${cyan('5/6')}${dim(']')} Configuring coding agents...`);
505
- const agents = getAllAgentConfigs();
506
- const configuredAgents = [];
507
- const skippedAgents = [];
508
-
509
- for (const agent of agents) {
510
- const dirExists = fs.existsSync(path.dirname(agent.path));
511
- const fileExists = fs.existsSync(agent.path);
512
- if (fileExists || dirExists) {
513
- const ok = installMcpToAgent(agent);
514
- if (ok) configuredAgents.push(agent.name);
515
- else skippedAgents.push(agent.name);
516
- }
517
- }
518
- console.log(` ${green('✓')}`);
519
-
520
- if (configuredAgents.length > 0) {
521
- console.log(`\n ┌───────────────────────────────────────────────┐`);
522
- console.log(` │ ${bold('MCP Auto-Configured')} │`);
523
- console.log(` ├───────────────────────────────────────────────┤`);
524
- for (const name of configuredAgents) {
525
- console.log(` │ ${green('✓')} ${name.padEnd(42)}│`);
526
- }
527
- console.log(` └───────────────────────────────────────────────┘`);
528
- }
529
-
530
- // ─── Step 6: Verify ────────────────────────────────────────
531
- console.log(`\n ${dim('[')}${cyan('6/6')}${dim(']')} Verifying installation...`);
532
-
533
- const dbExists = fs.existsSync(path.join(DATA_DIR, 'metadata.db'));
534
- const vecExists = fs.existsSync(path.join(DATA_DIR, 'vectors.json')) || fs.existsSync(path.join(DATA_DIR, 'vectors.bin'));
535
- const keyStored = fs.existsSync(CONFIG_TOML);
536
-
537
- console.log(` ${keyStored ? green('✓') : red('✗')} Local API key ${dim(CONFIG_TOML)}`);
538
- console.log(` ${dbExists ? green('✓') : yellow('⚠')} Dataset index ${dim(dbExists ? 'ready' : 'will build on first search')}`);
539
- console.log(` ${vecExists ? green('✓') : yellow('⚠')} Vector store ${dim(vecExists ? 'ready' : 'will build on first search')}`);
540
- console.log(` ${configuredAgents.length > 0 ? green('✓') : yellow('⚠')} MCP agents ${dim(configuredAgents.length + ' configured')}`);
541
-
542
- // ─── Final Summary ─────────────────────────────────────────
543
- const finalConfig = readToml(CONFIG_TOML);
544
- const isCloud = finalConfig.auth_mode === 'cloud';
545
- console.log(`
546
- ${dim('═════════════════════════════════════════════════')}
547
-
548
- ${green(bold('✓ Vesper is ready!'))}
549
-
550
- ${bold(isCloud ? 'Your cloud API key:' : 'Your local API key:')}
551
- ${cyan(finalConfig.api_key || localKey)}
552
-
553
- ${bold('Auth mode:')}
554
- ${dim(isCloud ? '☁ Cloud (linked to Vesper account)' : '🔑 Local-only (key never leaves your machine)')}
555
-
556
- ${bold('Config file:')}
557
- ${dim(CONFIG_TOML)}
558
-
559
- ${bold('What just happened:')}
560
- ${dim('1.')} ${isCloud ? 'Linked to your Vesper cloud account' : 'Generated a local API key (never leaves your machine)'}
561
- ${dim('2.')} Initialized local credentials vault
562
- ${dim('3.')} Auto-configured MCP for ${configuredAgents.length > 0 ? configuredAgents.join(', ') : 'detected agents'}
563
- ${dim('4.')} Vesper server ready on stdio transport
564
-
565
- ${dim('─────────────────────────────────────────────────')}
566
-
567
- ${bold('Quick start — try in your AI assistant:')}
568
-
569
- ${cyan('Search datasets')}
570
- ${dim('>')} vesper_search(query="sentiment analysis")
571
-
572
- ${cyan('Download & prepare')}
573
- ${dim('>')} prepare_dataset(query="image classification cats dogs")
574
-
575
- ${cyan('Quality analysis')}
576
- ${dim('>')} analyze_quality(dataset_id="imdb")
577
-
578
- ${cyan('Export to your project')}
579
- ${dim('>')} export_dataset(dataset_id="imdb", format="parquet")
580
-
581
- ${dim('─────────────────────────────────────────────────')}
582
-
583
- ${bold('Unified API — one interface, every source:')}
584
- HuggingFace · Kaggle · OpenML · data.world
585
-
586
- ${dim('Agents call localhost Vesper APIs with one local key.')}
587
- ${dim('Vesper adapters handle provider routing internally.')}
588
-
589
- ${dim('─────────────────────────────────────────────────')}
590
-
591
- ${yellow('→')} Restart your IDE to activate MCP
592
- ${dim('Docs:')} https://github.com/vesper/mcp-server
593
-
594
- ${dim('═════════════════════════════════════════════════')}
595
- `);
596
- }
597
-
598
- main().catch((err) => {
599
- console.error(`\n${red('Error:')} ${err.message || err}`);
600
- process.exit(1);
601
- });