kern0-cli 0.1.1 → 0.1.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.
@@ -0,0 +1,69 @@
1
+ import { loadConfig, saveConfig } from "../config";
2
+
3
+ export async function setupCommand(): Promise<void> {
4
+ console.log("\nšŸ”§ KernZero CLI Setup\n");
5
+
6
+ const config = loadConfig();
7
+
8
+ console.log("Current configuration:");
9
+ console.log(` API URL: ${config.api_url}\n`);
10
+
11
+ console.log("Available endpoints:");
12
+ console.log(" 1. Staging: https://staging.kernzero.com");
13
+ console.log(" 2. Production: https://kernzero.com");
14
+ console.log(" 3. Local: http://localhost:3000");
15
+ console.log(" 4. Custom (enter URL)\n");
16
+
17
+ const readline = await import("readline");
18
+ const rl = readline.createInterface({
19
+ input: process.stdin,
20
+ output: process.stdout,
21
+ });
22
+
23
+ const question = (prompt: string): Promise<string> => {
24
+ return new Promise((resolve) => {
25
+ rl.question(prompt, resolve);
26
+ });
27
+ };
28
+
29
+ try {
30
+ const choice = await question("Select option (1-4): ");
31
+
32
+ let apiUrl = config.api_url;
33
+
34
+ switch (choice.trim()) {
35
+ case "1":
36
+ apiUrl = "https://staging.kernzero.com";
37
+ console.log("\nāœ… Set to Staging");
38
+ break;
39
+ case "2":
40
+ apiUrl = "https://kernzero.com";
41
+ console.log("\nāœ… Set to Production");
42
+ break;
43
+ case "3":
44
+ apiUrl = "http://localhost:3000";
45
+ console.log("\nāœ… Set to Local");
46
+ break;
47
+ case "4":
48
+ const custom = await question("Enter API URL: ");
49
+ apiUrl = custom.trim();
50
+ console.log(`\nāœ… Set to ${apiUrl}`);
51
+ break;
52
+ default:
53
+ console.log("\nāŒ Invalid option");
54
+ rl.close();
55
+ return;
56
+ }
57
+
58
+ config.api_url = apiUrl;
59
+ saveConfig(config);
60
+
61
+ console.log("\nāœ… Configuration saved to ~/.kern0/config.json");
62
+ console.log("\nNext steps:");
63
+ console.log(" 1. Run: kern0 login");
64
+ console.log(" 2. Authenticate with your passkey");
65
+ console.log(" 3. Check: kern0 whoami\n");
66
+ } finally {
67
+ rl.close();
68
+ }
69
+ }
package/lib/cli/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { login, logout } from "./commands/auth";
4
+ import { setupCommand } from "./commands/setup";
4
5
  import {
5
6
  listOrgs,
6
7
  selectOrg,
@@ -40,6 +41,10 @@ async function main() {
40
41
  await logout();
41
42
  break;
42
43
 
44
+ case "setup":
45
+ await setupCommand();
46
+ break;
47
+
43
48
  // Organization commands
44
49
  case "org":
45
50
  switch (subcommand) {
@@ -174,6 +179,9 @@ Kern0 CLI - Recovery Readiness Assessment Tool
174
179
  USAGE:
175
180
  kern0 <command> [options]
176
181
 
182
+ FIRST TIME SETUP:
183
+ setup Configure API endpoint (required before login)
184
+
177
185
  AUTHENTICATION:
178
186
  login Authenticate with OAuth device flow
179
187
  logout Clear credentials and log out
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kern0-cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "KernZero CLI - Recovery control plane management from the terminal",
5
5
  "private": false,
6
6
  "license": "MIT",
@@ -34,9 +34,7 @@
34
34
  "node": ">=18.0.0"
35
35
  },
36
36
  "type": "module",
37
- "scripts": {
38
- "dev": "next dev"
39
- },
37
+ "scripts": {},
40
38
  "dependencies": {
41
39
  "open": "^10.0.0",
42
40
  "@modelcontextprotocol/sdk": "^1.30.1"