xray-code 0.1.2 → 0.1.4
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/auth.js +22 -1
- package/dist/cli.js +27 -0
- package/package.json +1 -1
package/dist/auth.js
CHANGED
|
@@ -137,7 +137,28 @@ async function login() {
|
|
|
137
137
|
// Step 4: Fetch user info
|
|
138
138
|
const username = await fetchGitHubUser(token.access_token);
|
|
139
139
|
console.log(` Logged in as @${username}\n`);
|
|
140
|
-
// Step 5:
|
|
140
|
+
// Step 5: Install the GitHub App (grants repo access)
|
|
141
|
+
console.log(` Now install the XRay app on your GitHub account to grant repo access.\n`);
|
|
142
|
+
const installUrl = "https://github.com/apps/proven-dev-xray/installations/new";
|
|
143
|
+
console.log(` Opening: ${installUrl}\n`);
|
|
144
|
+
try {
|
|
145
|
+
const { exec } = await import("node:child_process");
|
|
146
|
+
exec(`open "${installUrl}"`);
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
console.log(` Please open this URL manually: ${installUrl}\n`);
|
|
150
|
+
}
|
|
151
|
+
// Wait for user to complete installation
|
|
152
|
+
const readline = await import("node:readline");
|
|
153
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
154
|
+
await new Promise((resolve) => {
|
|
155
|
+
rl.question(" Press Enter after you've installed the app on GitHub... ", () => {
|
|
156
|
+
rl.close();
|
|
157
|
+
resolve();
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
console.log("");
|
|
161
|
+
// Step 6: Save credentials
|
|
141
162
|
const creds = {
|
|
142
163
|
access_token: token.access_token,
|
|
143
164
|
token_type: token.token_type || "bearer",
|
package/dist/cli.js
CHANGED
|
@@ -140,6 +140,33 @@ program
|
|
|
140
140
|
process.exit(1);
|
|
141
141
|
}
|
|
142
142
|
});
|
|
143
|
+
// ─── Install (standalone) ───────────────────────────────────────
|
|
144
|
+
program
|
|
145
|
+
.command("install")
|
|
146
|
+
.description("Install XRay hooks and CLAUDE.md in the current project directory")
|
|
147
|
+
.action(async () => {
|
|
148
|
+
const { existsSync, readFileSync } = await import("node:fs");
|
|
149
|
+
const { join } = await import("node:path");
|
|
150
|
+
const { homedir } = await import("node:os");
|
|
151
|
+
// Load config
|
|
152
|
+
const configPath = join(homedir(), ".xray", "config.json");
|
|
153
|
+
if (!existsSync(configPath)) {
|
|
154
|
+
console.error(" Not activated yet. Run 'npx xray-code activate <invite-code>' first.\n");
|
|
155
|
+
process.exit(1);
|
|
156
|
+
}
|
|
157
|
+
const config = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
158
|
+
const client = new client_js_1.XRayClient(config.server, config.apiKey);
|
|
159
|
+
try {
|
|
160
|
+
const health = await client.health();
|
|
161
|
+
console.log(`\n Installing XRay into ${process.cwd()}...\n`);
|
|
162
|
+
(0, install_js_1.installClaude)(process.cwd(), config.server, config.apiKey, config.space || "default", health.symbols, health.uses);
|
|
163
|
+
console.log(`\n Done! Start a new Claude Code session to get ambient code intelligence.\n`);
|
|
164
|
+
}
|
|
165
|
+
catch (e) {
|
|
166
|
+
console.error(` Install failed: ${e}\n`);
|
|
167
|
+
process.exit(1);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
143
170
|
// ─── Onboarding ─────────────────────────────────────────────────
|
|
144
171
|
program
|
|
145
172
|
.command("init [filter]")
|