@mcpsovereign/sdk 0.2.6 ā 0.2.7
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/dist/index.d.ts +1 -258
- package/dist/index.js +8 -294
- package/dist/mcp-helper/index.d.ts +0 -2
- package/dist/mcp-helper/index.js +1 -53
- package/dist/onboarding/types.d.ts +2 -23
- package/dist/onboarding/types.js +1 -148
- package/dist/onboarding/wizard.d.ts +1 -5
- package/dist/onboarding/wizard.js +11 -85
- package/dist/setup.js +16 -174
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Interactive setup experience for new agents
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { OnboardingProgress } from './types.js';
|
|
7
7
|
export declare class OnboardingWizard {
|
|
8
8
|
private progress;
|
|
9
9
|
private outputHandler;
|
|
@@ -20,8 +20,6 @@ export declare class OnboardingWizard {
|
|
|
20
20
|
private addXP;
|
|
21
21
|
private earnBadge;
|
|
22
22
|
runWelcome(): Promise<void>;
|
|
23
|
-
runChooseType(): Promise<AgentType>;
|
|
24
|
-
runChooseNation(): Promise<Nation>;
|
|
25
23
|
runCreateStore(): Promise<{
|
|
26
24
|
name: string;
|
|
27
25
|
tagline: string;
|
|
@@ -39,8 +37,6 @@ export declare class OnboardingWizard {
|
|
|
39
37
|
private getInput;
|
|
40
38
|
private getChoice;
|
|
41
39
|
run(): Promise<OnboardingProgress>;
|
|
42
|
-
showAgentTypes(): void;
|
|
43
|
-
showNations(): void;
|
|
44
40
|
showBadges(): void;
|
|
45
41
|
showLevels(): void;
|
|
46
42
|
getProgress(): OnboardingProgress;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Interactive setup experience for new agents
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { ONBOARDING_STEPS, STARTER_BADGES, LEVELS } from './types.js';
|
|
7
7
|
// ============================================================
|
|
8
8
|
// ASCII ART BANNERS
|
|
9
9
|
// ============================================================
|
|
@@ -165,54 +165,6 @@ export class OnboardingWizard {
|
|
|
165
165
|
this.progress.currentStep = 1;
|
|
166
166
|
this.saveProgress();
|
|
167
167
|
}
|
|
168
|
-
async runChooseType() {
|
|
169
|
-
this.printHeader('šÆ', 'Choose Your Path');
|
|
170
|
-
this.print('Each agent type has unique bonuses. Pick the one that fits your style:\n');
|
|
171
|
-
const types = Object.entries(AGENT_TYPES);
|
|
172
|
-
types.forEach(([key, type], index) => {
|
|
173
|
-
this.print(` ${index + 1}. ${type.emoji} ${type.name}`);
|
|
174
|
-
this.print(` "${type.description}"`);
|
|
175
|
-
this.print(` Starting Credits: ${type.startingCredits}`);
|
|
176
|
-
type.bonuses.forEach(bonus => {
|
|
177
|
-
this.print(` ā ${bonus}`);
|
|
178
|
-
});
|
|
179
|
-
this.print('');
|
|
180
|
-
});
|
|
181
|
-
let choice = await this.getChoice('Enter the number of your choice (1-6):', types.length);
|
|
182
|
-
const selectedType = types[choice - 1][0];
|
|
183
|
-
const typeInfo = AGENT_TYPES[selectedType];
|
|
184
|
-
this.print(`\nā
Excellent choice! You are now a ${typeInfo.emoji} ${typeInfo.name}!`);
|
|
185
|
-
this.print(` You start with ${typeInfo.startingCredits} credits.\n`);
|
|
186
|
-
this.progress.agentType = selectedType;
|
|
187
|
-
this.progress.currentStep = 2;
|
|
188
|
-
this.addXP(50);
|
|
189
|
-
this.saveProgress();
|
|
190
|
-
return selectedType;
|
|
191
|
-
}
|
|
192
|
-
async runChooseNation() {
|
|
193
|
-
this.printHeader('š“', 'Join a Nation');
|
|
194
|
-
this.print('Nations are communities of agents. Each has its own perks:\n');
|
|
195
|
-
const nations = Object.entries(NATIONS);
|
|
196
|
-
nations.forEach(([key, nation], index) => {
|
|
197
|
-
this.print(` ${index + 1}. ${nation.emoji} ${nation.name}`);
|
|
198
|
-
this.print(` Motto: "${nation.motto}"`);
|
|
199
|
-
this.print(` ${nation.description}`);
|
|
200
|
-
nation.bonuses.forEach(bonus => {
|
|
201
|
-
this.print(` ā ${bonus}`);
|
|
202
|
-
});
|
|
203
|
-
this.print('');
|
|
204
|
-
});
|
|
205
|
-
let choice = await this.getChoice('Enter the number of your nation (1-6):', nations.length);
|
|
206
|
-
const selectedNation = nations[choice - 1][0];
|
|
207
|
-
const nationInfo = NATIONS[selectedNation];
|
|
208
|
-
this.print(`\nš“ Welcome to ${nationInfo.emoji} ${nationInfo.name}!`);
|
|
209
|
-
this.print(` "${nationInfo.motto}"\n`);
|
|
210
|
-
this.progress.nation = selectedNation;
|
|
211
|
-
this.progress.currentStep = 3;
|
|
212
|
-
this.addXP(50);
|
|
213
|
-
this.saveProgress();
|
|
214
|
-
return selectedNation;
|
|
215
|
-
}
|
|
216
168
|
async runCreateStore() {
|
|
217
169
|
this.printHeader('šŖ', 'Create Your Store');
|
|
218
170
|
this.print('Your store is your home base. All operations here are FREE!\n');
|
|
@@ -226,7 +178,7 @@ export class OnboardingWizard {
|
|
|
226
178
|
this.print('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
|
|
227
179
|
this.print('\nā
Your store exists locally. 100% FREE!\n');
|
|
228
180
|
this.progress.storeCreated = true;
|
|
229
|
-
this.progress.currentStep =
|
|
181
|
+
this.progress.currentStep = 2;
|
|
230
182
|
this.earnBadge('store_owner');
|
|
231
183
|
this.saveProgress();
|
|
232
184
|
return { name: storeName, tagline };
|
|
@@ -258,7 +210,7 @@ export class OnboardingWizard {
|
|
|
258
210
|
this.print('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
|
|
259
211
|
this.print('\nā
Product ready! Still FREE - not on marketplace yet.\n');
|
|
260
212
|
this.progress.firstProductCreated = true;
|
|
261
|
-
this.progress.currentStep =
|
|
213
|
+
this.progress.currentStep = 3;
|
|
262
214
|
this.earnBadge('product_creator');
|
|
263
215
|
this.saveProgress();
|
|
264
216
|
return { name: productName, price, category };
|
|
@@ -287,7 +239,7 @@ export class OnboardingWizard {
|
|
|
287
239
|
this.print(' š¤ Push to marketplace - 50 credits');
|
|
288
240
|
this.print(' š„ Pull purchases/reviews - 25 credits\n');
|
|
289
241
|
await this.waitForContinue();
|
|
290
|
-
this.progress.currentStep =
|
|
242
|
+
this.progress.currentStep = 4;
|
|
291
243
|
this.addXP(50);
|
|
292
244
|
this.saveProgress();
|
|
293
245
|
}
|
|
@@ -310,7 +262,7 @@ export class OnboardingWizard {
|
|
|
310
262
|
this.print(' (Demo mode - you\'ll get 1,000 free credits to start!)\n');
|
|
311
263
|
}
|
|
312
264
|
this.progress.walletConnected = true;
|
|
313
|
-
this.progress.currentStep =
|
|
265
|
+
this.progress.currentStep = 5;
|
|
314
266
|
this.addXP(100);
|
|
315
267
|
this.saveProgress();
|
|
316
268
|
return wallet;
|
|
@@ -346,24 +298,16 @@ export class OnboardingWizard {
|
|
|
346
298
|
this.print('\nš No problem! You can push whenever you\'re ready.');
|
|
347
299
|
this.print(' Just run: client.push()\n');
|
|
348
300
|
}
|
|
349
|
-
this.progress.currentStep =
|
|
301
|
+
this.progress.currentStep = 6;
|
|
350
302
|
this.addXP(200);
|
|
351
303
|
this.saveProgress();
|
|
352
304
|
return this.progress.firstPushDone;
|
|
353
305
|
}
|
|
354
306
|
async runComplete() {
|
|
355
307
|
this.print(COMPLETION_BANNER);
|
|
356
|
-
const typeInfo = this.progress.agentType ? AGENT_TYPES[this.progress.agentType] : null;
|
|
357
|
-
const nationInfo = this.progress.nation ? NATIONS[this.progress.nation] : null;
|
|
358
308
|
this.print('š Congratulations! You\'ve completed onboarding!\n');
|
|
359
309
|
this.print('Your Profile:');
|
|
360
310
|
this.print('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
|
|
361
|
-
if (typeInfo) {
|
|
362
|
-
this.print(`ā Type: ${typeInfo.emoji} ${typeInfo.name.padEnd(27)}ā`);
|
|
363
|
-
}
|
|
364
|
-
if (nationInfo) {
|
|
365
|
-
this.print(`ā Nation: ${nationInfo.emoji} ${nationInfo.name.padEnd(25)}ā`);
|
|
366
|
-
}
|
|
367
311
|
this.print(`ā Level: ${this.progress.level} (${LEVELS[this.progress.level - 1]?.name || 'Newcomer'})${' '.repeat(20)}ā`);
|
|
368
312
|
this.print(`ā XP: ${this.progress.xp}${' '.repeat(32)}ā`);
|
|
369
313
|
this.print(`ā Badges: ${this.progress.badgesEarned.length}${' '.repeat(29)}ā`);
|
|
@@ -425,20 +369,16 @@ export class OnboardingWizard {
|
|
|
425
369
|
await this.runWelcome();
|
|
426
370
|
// Fall through to next step
|
|
427
371
|
case 1:
|
|
428
|
-
await this.runChooseType();
|
|
429
|
-
case 2:
|
|
430
|
-
await this.runChooseNation();
|
|
431
|
-
case 3:
|
|
432
372
|
await this.runCreateStore();
|
|
433
|
-
case
|
|
373
|
+
case 2:
|
|
434
374
|
await this.runCreateProduct();
|
|
435
|
-
case
|
|
375
|
+
case 3:
|
|
436
376
|
await this.runExploreMarketplace();
|
|
437
|
-
case
|
|
377
|
+
case 4:
|
|
438
378
|
await this.runConnectWallet();
|
|
439
|
-
case
|
|
379
|
+
case 5:
|
|
440
380
|
await this.runFirstPush();
|
|
441
|
-
case
|
|
381
|
+
case 6:
|
|
442
382
|
await this.runComplete();
|
|
443
383
|
break;
|
|
444
384
|
}
|
|
@@ -447,20 +387,6 @@ export class OnboardingWizard {
|
|
|
447
387
|
// ============================================================
|
|
448
388
|
// QUICK DISPLAY METHODS (for MCP tools)
|
|
449
389
|
// ============================================================
|
|
450
|
-
showAgentTypes() {
|
|
451
|
-
this.printHeader('šÆ', 'Agent Types');
|
|
452
|
-
Object.entries(AGENT_TYPES).forEach(([key, type]) => {
|
|
453
|
-
this.print(`${type.emoji} ${type.name} - ${type.description}`);
|
|
454
|
-
this.print(` Credits: ${type.startingCredits} | Bonuses: ${type.bonuses.length}`);
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
showNations() {
|
|
458
|
-
this.printHeader('š“', 'Nations');
|
|
459
|
-
Object.entries(NATIONS).forEach(([key, nation]) => {
|
|
460
|
-
this.print(`${nation.emoji} ${nation.name} - "${nation.motto}"`);
|
|
461
|
-
this.print(` ${nation.description}`);
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
390
|
showBadges() {
|
|
465
391
|
this.printHeader('š', 'Available Badges');
|
|
466
392
|
STARTER_BADGES.forEach(badge => {
|
package/dist/setup.js
CHANGED
|
@@ -16,8 +16,6 @@ import * as path from 'path';
|
|
|
16
16
|
import * as readline from 'readline';
|
|
17
17
|
import { SovereignClient } from './index.js';
|
|
18
18
|
import { OnboardingWizard } from './onboarding/wizard.js';
|
|
19
|
-
import { WalletSetupWizard } from './wallet/wizard.js';
|
|
20
|
-
import { isWalletConfigured, saveWalletConfig, loadWalletConfig } from './wallet/index.js';
|
|
21
19
|
import { STARTER_CREDITS, PLATFORM_CREDENTIALS } from './onboarding/starter-kit.js';
|
|
22
20
|
// ============================================================
|
|
23
21
|
// CONFIG PATHS
|
|
@@ -106,8 +104,6 @@ function createDefaultConfig() {
|
|
|
106
104
|
wallet_address: null,
|
|
107
105
|
auth_token: null,
|
|
108
106
|
agent_id: null,
|
|
109
|
-
agent_type: null,
|
|
110
|
-
nation: null,
|
|
111
107
|
setup_complete: false,
|
|
112
108
|
onboarding_complete: false,
|
|
113
109
|
starter_pack_claimed: false,
|
|
@@ -223,51 +219,7 @@ async function runSetup() {
|
|
|
223
219
|
saveConfig(config);
|
|
224
220
|
console.log('š Created new configuration');
|
|
225
221
|
}
|
|
226
|
-
//
|
|
227
|
-
// STEP 3: WALLET SETUP (RUNS FIRST - GATED)
|
|
228
|
-
// ===========================================================================
|
|
229
|
-
// Wallet is required to buy/sell, but browsing is free
|
|
230
|
-
const walletConfigured = isWalletConfigured();
|
|
231
|
-
if (!walletConfigured) {
|
|
232
|
-
console.log('\n');
|
|
233
|
-
console.log('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
|
|
234
|
-
console.log('ā ā');
|
|
235
|
-
console.log('ā ā” LIGHTNING WALLET SETUP REQUIRED ā” ā');
|
|
236
|
-
console.log('ā ā');
|
|
237
|
-
console.log('ā mcpSovereign runs on Bitcoin Lightning Network ā');
|
|
238
|
-
console.log('ā You need a wallet to buy credits and sell products ā');
|
|
239
|
-
console.log('ā ā');
|
|
240
|
-
console.log('ā š Browsing the marketplace is always FREE ā');
|
|
241
|
-
console.log('ā ā');
|
|
242
|
-
console.log('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
|
|
243
|
-
console.log('\n');
|
|
244
|
-
const walletWizard = new WalletSetupWizard(console.log, async (prompt, options) => {
|
|
245
|
-
return await question(rl, prompt + ' ');
|
|
246
|
-
});
|
|
247
|
-
const walletResult = await walletWizard.run();
|
|
248
|
-
if (walletResult.config) {
|
|
249
|
-
saveWalletConfig(walletResult.config);
|
|
250
|
-
config.wallet_address = walletResult.config.lightningAddress || walletResult.config.nodeUri || null;
|
|
251
|
-
console.log('\nā
Wallet setup complete!\n');
|
|
252
|
-
}
|
|
253
|
-
else if (walletResult.skipped) {
|
|
254
|
-
console.log('\nāļø Wallet setup skipped. You can set it up later with:');
|
|
255
|
-
console.log(' npx @mcpsovereign/sdk setup-wallet\n');
|
|
256
|
-
}
|
|
257
|
-
saveConfig(config);
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
const existingWallet = loadWalletConfig();
|
|
261
|
-
console.log('\nā
Wallet already configured');
|
|
262
|
-
if (existingWallet?.lightningAddress) {
|
|
263
|
-
console.log(` Lightning Address: ${existingWallet.lightningAddress}`);
|
|
264
|
-
}
|
|
265
|
-
else if (existingWallet?.nodeUri) {
|
|
266
|
-
console.log(` Self-hosted node: ${existingWallet.nodeUri}`);
|
|
267
|
-
}
|
|
268
|
-
console.log('');
|
|
269
|
-
}
|
|
270
|
-
// Step 4: Connect to server
|
|
222
|
+
// Step 3: Connect to server
|
|
271
223
|
await showLoadingBar('š Connecting to server', 1500);
|
|
272
224
|
const { client, connected } = await connectToServer(config);
|
|
273
225
|
if (connected) {
|
|
@@ -277,16 +229,14 @@ async function runSetup() {
|
|
|
277
229
|
console.log('\nā ļø Could not connect to server. Running in offline mode.');
|
|
278
230
|
console.log(' You can still build products locally!\n');
|
|
279
231
|
}
|
|
280
|
-
// Step
|
|
232
|
+
// Step 4: First-time setup
|
|
281
233
|
if (isFirstRun || !config.setup_complete) {
|
|
282
234
|
console.log('\nš® First time setup detected!\n');
|
|
283
|
-
//
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
config.wallet_address = walletInput || `demo-agent-${Date.now()}`;
|
|
287
|
-
}
|
|
235
|
+
// Ask for wallet address
|
|
236
|
+
const walletInput = await question(rl, 'š Enter your wallet address (or press Enter for demo mode): ');
|
|
237
|
+
config.wallet_address = walletInput || `demo-agent-${Date.now()}`;
|
|
288
238
|
// Try to authenticate
|
|
289
|
-
if (connected
|
|
239
|
+
if (connected) {
|
|
290
240
|
await showLoadingBar('š Authenticating', 1000);
|
|
291
241
|
const authResult = await client.authenticate(config.wallet_address);
|
|
292
242
|
if (authResult.success && authResult.data) {
|
|
@@ -302,10 +252,10 @@ async function runSetup() {
|
|
|
302
252
|
config.setup_complete = true;
|
|
303
253
|
saveConfig(config);
|
|
304
254
|
}
|
|
305
|
-
// Step
|
|
255
|
+
// Step 5: Update MCP config
|
|
306
256
|
console.log('\nš Configuring MCP integration...');
|
|
307
257
|
updateMCPConfig();
|
|
308
|
-
// Step
|
|
258
|
+
// Step 6: Run onboarding wizard if not complete
|
|
309
259
|
if (!config.onboarding_complete) {
|
|
310
260
|
console.log('\n');
|
|
311
261
|
const runOnboarding = await question(rl, 'š Run the onboarding wizard? (Y/n): ');
|
|
@@ -315,17 +265,15 @@ async function runSetup() {
|
|
|
315
265
|
return await question(rl, prompt + ' ');
|
|
316
266
|
});
|
|
317
267
|
const progress = await wizard.run();
|
|
318
|
-
config.agent_type = progress.agentType || null;
|
|
319
|
-
config.nation = progress.nation || null;
|
|
320
268
|
config.onboarding_complete = progress.completed;
|
|
321
269
|
saveConfig(config);
|
|
322
270
|
}
|
|
323
271
|
}
|
|
324
|
-
// Step
|
|
272
|
+
// Step 7: Save local store
|
|
325
273
|
await client.localStore.save();
|
|
326
|
-
// Step
|
|
274
|
+
// Step 8: Show completion
|
|
327
275
|
console.log(SETUP_COMPLETE_BANNER);
|
|
328
|
-
// Step
|
|
276
|
+
// Step 9: Show quick reference
|
|
329
277
|
console.log('\nš Quick Reference:');
|
|
330
278
|
console.log('ā'.repeat(50));
|
|
331
279
|
console.log('');
|
|
@@ -340,8 +288,7 @@ async function runSetup() {
|
|
|
340
288
|
console.log('SDK Usage (in your code):');
|
|
341
289
|
console.log(' import { SovereignClient } from "@mcpsovereign/sdk";');
|
|
342
290
|
console.log(' const client = new SovereignClient();');
|
|
343
|
-
console.log(' await client.
|
|
344
|
-
console.log(' await client.onboard(); // Store onboarding');
|
|
291
|
+
console.log(' await client.onboard(); // Interactive setup');
|
|
345
292
|
console.log('');
|
|
346
293
|
console.log('Config Location: ' + CONFIG_DIR);
|
|
347
294
|
console.log('');
|
|
@@ -361,8 +308,6 @@ async function showStatus() {
|
|
|
361
308
|
console.log(`Server: ${config.api_url}`);
|
|
362
309
|
console.log(`Wallet: ${config.wallet_address || 'Not set'}`);
|
|
363
310
|
console.log(`Agent ID: ${config.agent_id || 'Not authenticated'}`);
|
|
364
|
-
console.log(`Agent Type: ${config.agent_type || 'Not selected'}`);
|
|
365
|
-
console.log(`Nation: ${config.nation || 'Not selected'}`);
|
|
366
311
|
console.log(`Setup Complete: ${config.setup_complete ? 'ā
' : 'ā'}`);
|
|
367
312
|
console.log(`Onboarding Complete: ${config.onboarding_complete ? 'ā
' : 'ā'}`);
|
|
368
313
|
console.log(`Starter Pack: ${config.starter_pack_claimed ? 'ā
Claimed' : 'š Available'}`);
|
|
@@ -377,18 +322,10 @@ Usage:
|
|
|
377
322
|
npx @mcpsovereign/sdk <command>
|
|
378
323
|
|
|
379
324
|
Commands:
|
|
380
|
-
setup
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
status Show current configuration
|
|
385
|
-
reset Reset configuration and start fresh
|
|
386
|
-
help Show this help message
|
|
387
|
-
|
|
388
|
-
Wallet Commands:
|
|
389
|
-
wallet status - Show wallet configuration
|
|
390
|
-
wallet verify - Verify Lightning address is reachable
|
|
391
|
-
wallet reset - Reset wallet configuration
|
|
325
|
+
setup Run the setup wizard
|
|
326
|
+
status Show current configuration
|
|
327
|
+
reset Reset configuration and start fresh
|
|
328
|
+
help Show this help message
|
|
392
329
|
|
|
393
330
|
After setup, use the sovereign_* MCP tools in Claude!
|
|
394
331
|
`);
|
|
@@ -405,92 +342,6 @@ async function resetConfig() {
|
|
|
405
342
|
// ============================================================
|
|
406
343
|
// MAIN ENTRY
|
|
407
344
|
// ============================================================
|
|
408
|
-
async function runWalletSetup() {
|
|
409
|
-
const rl = readline.createInterface({
|
|
410
|
-
input: process.stdin,
|
|
411
|
-
output: process.stdout
|
|
412
|
-
});
|
|
413
|
-
const questionAsync = (prompt) => new Promise((resolve) => {
|
|
414
|
-
rl.question(prompt, resolve);
|
|
415
|
-
});
|
|
416
|
-
const wizard = new WalletSetupWizard(console.log, async (prompt, options) => {
|
|
417
|
-
return await questionAsync(prompt + ' ');
|
|
418
|
-
});
|
|
419
|
-
const result = await wizard.run();
|
|
420
|
-
if (result.config) {
|
|
421
|
-
saveWalletConfig(result.config);
|
|
422
|
-
console.log('\nā
Wallet configuration saved!\n');
|
|
423
|
-
}
|
|
424
|
-
rl.close();
|
|
425
|
-
}
|
|
426
|
-
async function runLNDSetup() {
|
|
427
|
-
const { LNDSetup } = await import('./wallet/lnd-setup.js');
|
|
428
|
-
console.log('\nš„ļø Self-Hosted Lightning Node Setup\n');
|
|
429
|
-
console.log('This will set up an LND node using Docker with Neutrino mode.');
|
|
430
|
-
console.log('No full Bitcoin node required - syncs in minutes!\n');
|
|
431
|
-
const rl = readline.createInterface({
|
|
432
|
-
input: process.stdin,
|
|
433
|
-
output: process.stdout
|
|
434
|
-
});
|
|
435
|
-
const alias = await new Promise((resolve) => {
|
|
436
|
-
rl.question('Node alias (press Enter for auto-generated): ', resolve);
|
|
437
|
-
});
|
|
438
|
-
rl.close();
|
|
439
|
-
const setup = new LNDSetup({
|
|
440
|
-
alias: alias || `SovereignAgent_${Date.now().toString(36)}`
|
|
441
|
-
});
|
|
442
|
-
// Check prerequisites
|
|
443
|
-
const prereqs = await setup.checkPrerequisites();
|
|
444
|
-
if (!prereqs.ready) {
|
|
445
|
-
console.log('\nā Prerequisites not met:\n');
|
|
446
|
-
if (!prereqs.docker.installed) {
|
|
447
|
-
console.log(' ⢠Docker is not installed');
|
|
448
|
-
console.log(' Install from: https://docs.docker.com/get-docker/\n');
|
|
449
|
-
}
|
|
450
|
-
else if (!prereqs.docker.running) {
|
|
451
|
-
console.log(' ⢠Docker is installed but not running');
|
|
452
|
-
console.log(' Start Docker and try again\n');
|
|
453
|
-
}
|
|
454
|
-
if (!prereqs.compose) {
|
|
455
|
-
console.log(' ⢠Docker Compose is not available\n');
|
|
456
|
-
}
|
|
457
|
-
if (!prereqs.diskSpace.sufficient) {
|
|
458
|
-
console.log(` ⢠Insufficient disk space (need 5GB, have ${Math.round(prereqs.diskSpace.available / 1024 / 1024 / 1024)}GB)\n`);
|
|
459
|
-
}
|
|
460
|
-
return;
|
|
461
|
-
}
|
|
462
|
-
console.log('\nā
Prerequisites met. Starting setup...\n');
|
|
463
|
-
const result = await setup.setupLND();
|
|
464
|
-
if (result.success) {
|
|
465
|
-
console.log('\nā
LND node setup complete!\n');
|
|
466
|
-
if (result.walletSeed) {
|
|
467
|
-
console.log('ā ļø IMPORTANT: Your wallet seed has been saved to:');
|
|
468
|
-
console.log(` ~/.sovereign-lnd/BACKUP_SEED_DELETE_AFTER_BACKUP.txt`);
|
|
469
|
-
console.log(' Back it up and DELETE the file!\n');
|
|
470
|
-
}
|
|
471
|
-
if (result.credentials) {
|
|
472
|
-
// Save wallet config
|
|
473
|
-
saveWalletConfig({
|
|
474
|
-
provider: 'zeus',
|
|
475
|
-
nodeUri: result.credentials.restHost,
|
|
476
|
-
setupComplete: true,
|
|
477
|
-
verified: true,
|
|
478
|
-
verifiedAt: new Date().toISOString(),
|
|
479
|
-
createdAt: new Date().toISOString()
|
|
480
|
-
});
|
|
481
|
-
console.log('ā
Wallet configuration saved!\n');
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
else {
|
|
485
|
-
console.log(`\nā Setup failed: ${result.error}\n`);
|
|
486
|
-
console.log('Logs:');
|
|
487
|
-
result.logs.slice(-10).forEach(log => console.log(` ${log}`));
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
async function walletCommand(args) {
|
|
491
|
-
const { walletCLI } = await import('./wallet/index.js');
|
|
492
|
-
await walletCLI(args);
|
|
493
|
-
}
|
|
494
345
|
async function main() {
|
|
495
346
|
const args = process.argv.slice(2);
|
|
496
347
|
const command = args[0] || 'setup';
|
|
@@ -498,15 +349,6 @@ async function main() {
|
|
|
498
349
|
case 'setup':
|
|
499
350
|
await runSetup();
|
|
500
351
|
break;
|
|
501
|
-
case 'setup-wallet':
|
|
502
|
-
await runWalletSetup();
|
|
503
|
-
break;
|
|
504
|
-
case 'setup-lnd':
|
|
505
|
-
await runLNDSetup();
|
|
506
|
-
break;
|
|
507
|
-
case 'wallet':
|
|
508
|
-
await walletCommand(args.slice(1));
|
|
509
|
-
break;
|
|
510
352
|
case 'status':
|
|
511
353
|
await showStatus();
|
|
512
354
|
break;
|