@remotepilot/cli 0.1.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 (48) hide show
  1. package/dist/cli.d.ts +3 -0
  2. package/dist/cli.d.ts.map +1 -0
  3. package/dist/cli.js +70 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/commands/list.d.ts +5 -0
  6. package/dist/commands/list.d.ts.map +1 -0
  7. package/dist/commands/list.js +75 -0
  8. package/dist/commands/list.js.map +1 -0
  9. package/dist/commands/pair.d.ts +6 -0
  10. package/dist/commands/pair.d.ts.map +1 -0
  11. package/dist/commands/pair.js +114 -0
  12. package/dist/commands/pair.js.map +1 -0
  13. package/dist/commands/restart.d.ts +5 -0
  14. package/dist/commands/restart.d.ts.map +1 -0
  15. package/dist/commands/restart.js +67 -0
  16. package/dist/commands/restart.js.map +1 -0
  17. package/dist/commands/setup.d.ts +8 -0
  18. package/dist/commands/setup.d.ts.map +1 -0
  19. package/dist/commands/setup.js +387 -0
  20. package/dist/commands/setup.js.map +1 -0
  21. package/dist/commands/start.d.ts +6 -0
  22. package/dist/commands/start.d.ts.map +1 -0
  23. package/dist/commands/start.js +164 -0
  24. package/dist/commands/start.js.map +1 -0
  25. package/dist/commands/status.d.ts +5 -0
  26. package/dist/commands/status.d.ts.map +1 -0
  27. package/dist/commands/status.js +130 -0
  28. package/dist/commands/status.js.map +1 -0
  29. package/dist/commands/stop.d.ts +5 -0
  30. package/dist/commands/stop.d.ts.map +1 -0
  31. package/dist/commands/stop.js +67 -0
  32. package/dist/commands/stop.js.map +1 -0
  33. package/dist/commands/update.d.ts +2 -0
  34. package/dist/commands/update.d.ts.map +1 -0
  35. package/dist/commands/update.js +8 -0
  36. package/dist/commands/update.js.map +1 -0
  37. package/dist/daemon-manager.ps1 +114 -0
  38. package/dist/daemon.d.ts +14 -0
  39. package/dist/daemon.d.ts.map +1 -0
  40. package/dist/daemon.js +216 -0
  41. package/dist/daemon.js.map +1 -0
  42. package/dist/daemon.log +0 -0
  43. package/dist/daemon.pid +0 -0
  44. package/dist/utils/update-check.d.ts +3 -0
  45. package/dist/utils/update-check.d.ts.map +1 -0
  46. package/dist/utils/update-check.js +112 -0
  47. package/dist/utils/update-check.js.map +1 -0
  48. package/package.json +65 -0
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const commander_1 = require("commander");
5
+ const setup_js_1 = require("./commands/setup.js");
6
+ const start_js_1 = require("./commands/start.js");
7
+ const stop_js_1 = require("./commands/stop.js");
8
+ const restart_js_1 = require("./commands/restart.js");
9
+ const status_js_1 = require("./commands/status.js");
10
+ const pair_js_1 = require("./commands/pair.js");
11
+ const list_js_1 = require("./commands/list.js");
12
+ const update_js_1 = require("./commands/update.js");
13
+ const update_check_js_1 = require("./utils/update-check.js");
14
+ const program = new commander_1.Command();
15
+ // Auto-update check (non-blocking, runs in background)
16
+ (0, update_check_js_1.checkForUpdate)().catch(() => { });
17
+ program
18
+ .name("remotepilot")
19
+ .description("RemotePilot - Connect your phone to any computer via QR code")
20
+ .version("0.1.0");
21
+ // Setup command
22
+ program
23
+ .command("setup")
24
+ .alias("install")
25
+ .description("Set up RemotePilot host on this computer")
26
+ .option("--name <name>", "Host name")
27
+ .option("--port <port>", "Port number", "8080")
28
+ .option("--force", "Force setup even if already configured")
29
+ .action(setup_js_1.setupCommand);
30
+ // Start command
31
+ program
32
+ .command("start")
33
+ .description("Start the RemotePilot host daemon")
34
+ .option("--foreground", "Run in foreground (for development)")
35
+ .option("--service", "Install and start as system service")
36
+ .action(start_js_1.startCommand);
37
+ // Stop command
38
+ program
39
+ .command("stop")
40
+ .description("Stop the RemotePilot host daemon")
41
+ .action(stop_js_1.stopCommand);
42
+ // Restart command
43
+ program
44
+ .command("restart")
45
+ .description("Restart the RemotePilot host daemon")
46
+ .action(restart_js_1.restartCommand);
47
+ // Status command
48
+ program
49
+ .command("status")
50
+ .description("Show RemotePilot host status")
51
+ .action(status_js_1.statusCommand);
52
+ // Pair command
53
+ program
54
+ .command("pair")
55
+ .description("Generate pairing QR code for your phone")
56
+ .option("--timeout <seconds>", "QR code timeout in seconds", "300")
57
+ .action(pair_js_1.pairCommand);
58
+ // List command
59
+ program
60
+ .command("list")
61
+ .description("List paired devices")
62
+ .action(list_js_1.listCommand);
63
+ // Update command
64
+ program
65
+ .command("update")
66
+ .description("Update RemotePilot to the latest version")
67
+ .action(update_js_1.updateCommand);
68
+ // Parse arguments
69
+ program.parse(process.argv);
70
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,kDAAmD;AACnD,kDAAmD;AACnD,gDAAiD;AACjD,sDAAuD;AACvD,oDAAqD;AACrD,gDAAiD;AACjD,gDAAiD;AACjD,oDAAqD;AACrD,6DAAyD;AAEzD,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,uDAAuD;AACvD,IAAA,gCAAc,GAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AAEjC,OAAO;KACJ,IAAI,CAAC,aAAa,CAAC;KACnB,WAAW,CAAC,8DAA8D,CAAC;KAC3E,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,gBAAgB;AAChB,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,KAAK,CAAC,SAAS,CAAC;KAChB,WAAW,CAAC,0CAA0C,CAAC;KACvD,MAAM,CAAC,eAAe,EAAE,WAAW,CAAC;KACpC,MA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AAC"}
@@ -0,0 +1,5 @@
1
+ interface ListOptions {
2
+ }
3
+ export declare function listCommand(_options: ListOptions): Promise<void>;
4
+ export {};
5
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAGA,UAAU,WAAW;CAAG;AAUxB,wBAAsB,WAAW,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAsCtE"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.listCommand = listCommand;
37
+ const fs = __importStar(require("node:fs"));
38
+ const path = __importStar(require("node:path"));
39
+ async function listCommand(_options) {
40
+ console.log("RemotePilot Paired Devices");
41
+ console.log("=========================\n");
42
+ const devicesPath = getPairedDevicesPath();
43
+ if (!fs.existsSync(devicesPath)) {
44
+ console.log("No paired devices found.");
45
+ console.log("\nTo pair a device:");
46
+ console.log("1. Start the host: remotepilot start");
47
+ console.log("2. Generate QR code: remotepilot pair");
48
+ console.log("3. Scan QR code with Android app");
49
+ return;
50
+ }
51
+ const devices = JSON.parse(fs.readFileSync(devicesPath, "utf-8"));
52
+ if (devices.length === 0) {
53
+ console.log("No paired devices found.");
54
+ return;
55
+ }
56
+ console.log(`Found ${devices.length} paired device(s):\n`);
57
+ devices.forEach((device, index) => {
58
+ console.log(`${index + 1}. ${device.deviceName}`);
59
+ console.log(` ID: ${device.deviceId}`);
60
+ console.log(` Paired: ${new Date(device.pairedAt).toLocaleString()}`);
61
+ if (device.lastConnected) {
62
+ console.log(` Last Connected: ${new Date(device.lastConnected).toLocaleString()}`);
63
+ }
64
+ console.log();
65
+ });
66
+ // Show options
67
+ console.log("Options:");
68
+ console.log(" remotepilot unpair <device-id> - Remove a paired device");
69
+ console.log(" remotepilot list --remove <id> - Remove a paired device");
70
+ }
71
+ function getPairedDevicesPath() {
72
+ const homeDir = process.env.HOME || process.env.USERPROFILE || "~";
73
+ return path.join(homeDir, ".remotepilot", "devices.json");
74
+ }
75
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,kCAsCC;AAnDD,4CAA8B;AAC9B,gDAAkC;AAY3B,KAAK,UAAU,WAAW,CAAC,QAAqB;IACrD,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAE3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,GAAG,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,eAAe;IACf,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACxB,OAAO,CAAC,GAAG,CAAC,4DAA4D,CAAC,CAAC;IAC1E,OAAO,CAAC,GAAG,CAAC,4DAA4D,CAAC,CAAC;AAC5E,CAAC;AAED,SAAS,oBAAoB;IAC3B,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC;IACnE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,6 @@
1
+ interface PairOptions {
2
+ timeout?: string;
3
+ }
4
+ export declare function pairCommand(options: PairOptions): Promise<void>;
5
+ export {};
6
+ //# sourceMappingURL=pair.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pair.d.ts","sourceRoot":"","sources":["../../src/commands/pair.ts"],"names":[],"mappings":"AAKA,UAAU,WAAW;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAsBD,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAkFrE"}
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.pairCommand = pairCommand;
40
+ const fs = __importStar(require("node:fs"));
41
+ const path = __importStar(require("node:path"));
42
+ const qrcode_1 = __importDefault(require("qrcode"));
43
+ const crypto_1 = require("@remotepilot/crypto");
44
+ async function pairCommand(options) {
45
+ console.log("RemotePilot Pairing");
46
+ console.log("===================\n");
47
+ // Load config
48
+ const configPath = getConfigPath();
49
+ if (!fs.existsSync(configPath)) {
50
+ console.error("Host not configured. Run 'remotepilot setup' first.");
51
+ process.exit(1);
52
+ }
53
+ const config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
54
+ // Generate pairing token
55
+ const timeoutSeconds = parseInt(options.timeout || "300", 10);
56
+ const timeoutMs = timeoutSeconds * 1000;
57
+ const { token, hash: tokenHash, expiresAt } = (0, crypto_1.createPairingToken)(config.hostId, config.publicKey, timeoutMs);
58
+ console.log(`Host: ${config.hostName} (${config.hostId})`);
59
+ console.log(`Timeout: ${timeoutSeconds} seconds`);
60
+ // Create pairing data
61
+ const pairingData = {
62
+ version: 1,
63
+ hostId: config.hostId,
64
+ hostPublicKey: config.publicKey,
65
+ token,
66
+ expiresAt,
67
+ timestamp: Date.now(),
68
+ signature: tokenHash
69
+ };
70
+ // Generate QR code
71
+ console.log("\nGenerating QR code...\n");
72
+ const qrData = JSON.stringify(pairingData);
73
+ const qrCode = await qrcode_1.default.toString(qrData, { type: "terminal", small: true });
74
+ console.log(qrCode);
75
+ // Also show the pairing URL
76
+ const pairingUrl = `remotepilot://pair?data=${encodeURIComponent(qrData)}`;
77
+ console.log("\nOr use this pairing URL:");
78
+ console.log(pairingUrl);
79
+ // Wait for pairing or timeout
80
+ console.log(`\nWaiting for Android device to scan QR code...`);
81
+ console.log(`Timeout in ${timeoutSeconds} seconds`);
82
+ // Save pairing token for validation
83
+ const pairingTokenPath = getPairingTokenPath();
84
+ fs.writeFileSync(pairingTokenPath, JSON.stringify({
85
+ tokenHash,
86
+ expiresAt,
87
+ used: false
88
+ }));
89
+ // In a real implementation, this would listen for the pairing request
90
+ // For now, we'll just wait
91
+ let timeout;
92
+ const pairingPromise = new Promise((resolve) => {
93
+ timeout = setTimeout(() => {
94
+ console.log("\n✗ Pairing timeout");
95
+ resolve();
96
+ }, timeoutMs);
97
+ });
98
+ // Clean up on exit
99
+ process.on("SIGINT", () => {
100
+ clearTimeout(timeout);
101
+ console.log("\n\nPairing cancelled");
102
+ process.exit(0);
103
+ });
104
+ await pairingPromise;
105
+ }
106
+ function getConfigPath() {
107
+ const homeDir = process.env.HOME || process.env.USERPROFILE || "~";
108
+ return path.join(homeDir, ".remotepilot", "host.json");
109
+ }
110
+ function getPairingTokenPath() {
111
+ const homeDir = process.env.HOME || process.env.USERPROFILE || "~";
112
+ return path.join(homeDir, ".remotepilot", "pairing-token.json");
113
+ }
114
+ //# sourceMappingURL=pair.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pair.js","sourceRoot":"","sources":["../../src/commands/pair.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,kCAkFC;AA/GD,4CAA8B;AAC9B,gDAAkC;A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O,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;QACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,MAAM,cAAc,CAAC;AACvB,CAAC;AAED,SAAS,aAAa;IACpB,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC;IACnE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,mBAAmB;IAC1B,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC;IACnE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,oBAAoB,CAAC,CAAC;AAClE,CAAC"}
@@ -0,0 +1,5 @@
1
+ interface RestartOptions {
2
+ }
3
+ export declare function restartCommand(_options: RestartOptions): Promise<void>;
4
+ export {};
5
+ //# sourceMappingURL=restart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restart.d.ts","sourceRoot":"","sources":["../../src/commands/restart.ts"],"names":[],"mappings":"AAMA,UAAU,cAAc;CAAG;AAE3B,wBAAsB,cAAc,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA4D5E"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.restartCommand = restartCommand;
4
+ const windows_service_1 = require("@remotepilot/windows-service");
5
+ const node_child_process_1 = require("node:child_process");
6
+ const node_util_1 = require("node:util");
7
+ const execAsync = (0, node_util_1.promisify)(node_child_process_1.exec);
8
+ async function restartCommand(_options) {
9
+ console.log("Restarting RemotePilot Host...\n");
10
+ if (process.platform === "win32") {
11
+ // Try Windows service (sc.exe) first
12
+ const serviceManager = new windows_service_1.WindowsServiceManager();
13
+ const exists = await serviceManager.exists();
14
+ if (exists) {
15
+ const status = await serviceManager.status();
16
+ if (status.state !== "running") {
17
+ console.log("Service is not running. Starting...");
18
+ const started = await serviceManager.start();
19
+ if (started) {
20
+ console.log("Service started.");
21
+ }
22
+ else {
23
+ console.error("Failed to start service.");
24
+ process.exit(1);
25
+ }
26
+ return;
27
+ }
28
+ console.log("Stopping service...");
29
+ const stopped = await serviceManager.stop();
30
+ if (!stopped) {
31
+ console.error("Failed to stop service.");
32
+ process.exit(1);
33
+ }
34
+ await new Promise(resolve => setTimeout(resolve, 2000));
35
+ console.log("Starting service...");
36
+ const started = await serviceManager.start();
37
+ if (started) {
38
+ await new Promise(resolve => setTimeout(resolve, 2000));
39
+ const newStatus = await serviceManager.status();
40
+ if (newStatus.state === "running") {
41
+ console.log("Service restarted successfully.");
42
+ if (newStatus.pid) {
43
+ console.log(` PID: ${newStatus.pid}`);
44
+ }
45
+ }
46
+ else {
47
+ console.log(`Service state: ${newStatus.state}`);
48
+ }
49
+ }
50
+ else {
51
+ console.error("Failed to start service after restart.");
52
+ process.exit(1);
53
+ }
54
+ return;
55
+ }
56
+ // Registry Run key mode - cannot restart automatically, inform user
57
+ console.log("Service is configured via Registry Run key (non-elevated mode).");
58
+ console.log("To restart the daemon:");
59
+ console.log(" 1. Stop the current process (Ctrl+C in the terminal)");
60
+ console.log(" 2. Run: remotepilot start");
61
+ console.log(" Or reboot Windows for automatic restart.");
62
+ }
63
+ else {
64
+ console.log("Use: sudo systemctl restart remotepilot");
65
+ }
66
+ }
67
+ //# sourceMappingURL=restart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restart.js","sourceRoot":"","sources":["../../src/commands/restart.ts"],"names":[],"mappings":";;AAQA,wCA4DC;AApED,kEAAqE;AACrE,2DAA0C;AAC1C,yCAAsC;AAEtC,MAAM,SAAS,GAAG,IAAA,qBAAS,EAAC,yBAAI,CAAC,CAAC;AAI3B,KAAK,UAA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;YAC7C,IAAI,OAAO,EAAE,CAAC;gBACZ,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;gBACxD,MAAM,SAAS,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,CAAC;gBAChD,IAAI,SAAS,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;oBAClC,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;oBAC/C,IAAI,SAAS,CAAC,GAAG,EAAE,CAAC;wBAClB,OAAO,CAAC,GAAG,CAAC,UAAU,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC;oBACzC,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,OAAO,CAAC,GAAG,CAAC,kBAAkB,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC;gBACnD,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;gBACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YACD,OAAO;QACT,CAAC;QAED,oEAAoE;QACpE,OAAO,CAAC,GAAG,CAAC,iEAAiE,CAAC,CAAC;QAC/E,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;QACtE,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;QAC3C,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;IAC5D,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;IACzD,CAAC;AACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ interface SetupOptions {
2
+ name?: string;
3
+ port?: string;
4
+ force?: boolean;
5
+ }
6
+ export declare function setupCommand(options: SetupOptions): Promise<void>;
7
+ export {};
8
+ //# sourceMappingURL=setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/commands/setup.ts"],"names":[],"mappings":"AAOA,UAAU,YAAY;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAYD,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA+FvE"}