xray-code 0.1.0 → 0.1.1
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/cli.js +50 -12
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -22,7 +22,7 @@ const client_js_1 = require("./client.js");
|
|
|
22
22
|
const program = new commander_1.Command()
|
|
23
23
|
.name("xray")
|
|
24
24
|
.description("X-ray your codebase — instant cross-references and impact analysis")
|
|
25
|
-
.version("0.1.
|
|
25
|
+
.version("0.1.1");
|
|
26
26
|
// ─── Auth commands ──────────────────────────────────────────────
|
|
27
27
|
program
|
|
28
28
|
.command("login")
|
|
@@ -67,12 +67,28 @@ program
|
|
|
67
67
|
if (!existsSync(dir))
|
|
68
68
|
mkdirSync(dir, { recursive: true });
|
|
69
69
|
writeFileSync(join(dir, "config.json"), JSON.stringify({ server: entry.server, apiKey: entry.apiKey }, null, 2), { mode: 0o600 });
|
|
70
|
-
console.log(`
|
|
71
|
-
console.log(`
|
|
70
|
+
console.log(` Invite code accepted!\n`);
|
|
71
|
+
console.log(` Now let's connect your GitHub account...\n`);
|
|
72
|
+
try {
|
|
73
|
+
await (0, auth_js_1.login)();
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
console.log(`\n GitHub login skipped.\n`);
|
|
77
|
+
}
|
|
72
78
|
const client = new client_js_1.XRayClient(entry.server, entry.apiKey);
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
try {
|
|
80
|
+
const health = await client.health();
|
|
81
|
+
console.log(`\n ══════════════════════════════════════════════════`);
|
|
82
|
+
console.log(` XRay is ready!`);
|
|
83
|
+
console.log(` ══════════════════════════════════════════════════\n`);
|
|
84
|
+
console.log(` Symbols: ${health.symbols.toLocaleString()}`);
|
|
85
|
+
console.log(` Refs: ${health.uses.toLocaleString()}`);
|
|
86
|
+
console.log(` Files: ${health.files.toLocaleString()}\n`);
|
|
87
|
+
console.log(` Try: npx xray-code search <symbol-name>\n`);
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
console.log(` Config saved. Try 'npx xray-code health' in a minute.\n`);
|
|
91
|
+
}
|
|
76
92
|
return;
|
|
77
93
|
}
|
|
78
94
|
}
|
|
@@ -84,13 +100,35 @@ program
|
|
|
84
100
|
if (!existsSync(dir))
|
|
85
101
|
mkdirSync(dir, { recursive: true });
|
|
86
102
|
writeFileSync(join(dir, "config.json"), JSON.stringify({ server: data.server, apiKey: data.api_key }, null, 2), { mode: 0o600 });
|
|
87
|
-
console.log(`
|
|
88
|
-
|
|
89
|
-
console.log(`
|
|
103
|
+
console.log(` Invite code accepted!\n`);
|
|
104
|
+
// Step 2: GitHub login
|
|
105
|
+
console.log(` Now let's connect your GitHub account...\n`);
|
|
106
|
+
try {
|
|
107
|
+
await (0, auth_js_1.login)();
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
console.log(`\n GitHub login skipped — you can run 'npx xray-code login' later.\n`);
|
|
111
|
+
}
|
|
112
|
+
// Step 3: Show connection status
|
|
90
113
|
const client = new client_js_1.XRayClient(data.server, data.api_key);
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
114
|
+
try {
|
|
115
|
+
const health = await client.health();
|
|
116
|
+
console.log(`\n ══════════════════════════════════════════════════`);
|
|
117
|
+
console.log(` XRay is ready!`);
|
|
118
|
+
console.log(` ══════════════════════════════════════════════════\n`);
|
|
119
|
+
console.log(` Codebase: ${data.space}`);
|
|
120
|
+
console.log(` Symbols: ${health.symbols.toLocaleString()}`);
|
|
121
|
+
console.log(` Refs: ${health.uses.toLocaleString()}`);
|
|
122
|
+
console.log(` Files: ${health.files.toLocaleString()}\n`);
|
|
123
|
+
console.log(` Try these commands:`);
|
|
124
|
+
console.log(` npx xray-code search <symbol-name>`);
|
|
125
|
+
console.log(` npx xray-code who-uses <symbol-name>`);
|
|
126
|
+
console.log(` npx xray-code impact <symbol-name>`);
|
|
127
|
+
console.log(` npx xray-code health\n`);
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
console.log(` Config saved. Server may still be indexing — try 'npx xray-code health' in a minute.\n`);
|
|
131
|
+
}
|
|
94
132
|
}
|
|
95
133
|
catch (e) {
|
|
96
134
|
console.error(` Activation failed: ${e}\n`);
|