openkitt 0.3.4 → 0.3.6

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 (2) hide show
  1. package/dist/cli.js +97 -21
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2789,22 +2789,30 @@ async function decryptCopilotStored(stored) {
2789
2789
  }
2790
2790
  }
2791
2791
  async function refreshCopilotToken(githubToken) {
2792
+ let res;
2792
2793
  try {
2793
- const res = await fetch(COPILOT_TOKEN_URL, {
2794
+ res = await fetch(COPILOT_TOKEN_URL, {
2794
2795
  headers: {
2795
- Authorization: `Token ${githubToken}`,
2796
- "User-Agent": "GitHubCopilotChat/0.26.7"
2796
+ Authorization: `token ${githubToken}`,
2797
+ "User-Agent": "GithubCopilot/1.250.0",
2798
+ "Editor-Version": "vscode/1.95.0",
2799
+ "Editor-Plugin-Version": "copilot/1.250.0",
2800
+ "X-GitHub-Api-Version": "2025-04-01",
2801
+ Accept: "application/json"
2797
2802
  }
2798
2803
  });
2799
- if (!res.ok)
2800
- return null;
2801
- const data = await res.json();
2802
- if (typeof data.token !== "string" || typeof data.expires_at !== "number")
2803
- return null;
2804
- return { token: data.token, expiresAt: data.expires_at * 1000 };
2805
- } catch {
2806
- return null;
2804
+ } catch (err) {
2805
+ throw new Error(`Copilot token exchange failed: network error — ${err instanceof Error ? err.message : String(err)}`);
2806
+ }
2807
+ if (!res.ok) {
2808
+ const body = await res.text().catch(() => "");
2809
+ throw new Error(`Copilot token exchange failed (HTTP ${res.status}): ${body.slice(0, 300)}`);
2807
2810
  }
2811
+ const data = await res.json();
2812
+ if (typeof data.token !== "string" || typeof data.expires_at !== "number") {
2813
+ throw new Error("Copilot token exchange failed: unexpected response shape");
2814
+ }
2815
+ return { token: data.token, expiresAt: data.expires_at * 1000 };
2808
2816
  }
2809
2817
  async function getCopilotToken() {
2810
2818
  const config = readConfig();
@@ -2819,9 +2827,12 @@ async function getCopilotToken() {
2819
2827
  if (Date.now() < stored.copilotTokenExpiresAt - 60000) {
2820
2828
  return decrypted.copilotToken;
2821
2829
  }
2822
- const refreshed = await refreshCopilotToken(decrypted.githubToken);
2823
- if (!refreshed)
2830
+ let refreshed;
2831
+ try {
2832
+ refreshed = await refreshCopilotToken(decrypted.githubToken);
2833
+ } catch {
2824
2834
  return null;
2835
+ }
2825
2836
  const encCopilot = await encrypt(refreshed.token);
2826
2837
  writeConfig({
2827
2838
  llm: {
@@ -2836,11 +2847,7 @@ async function getCopilotToken() {
2836
2847
  return refreshed.token;
2837
2848
  }
2838
2849
  async function exchangeCopilotToken(githubToken) {
2839
- const result = await refreshCopilotToken(githubToken);
2840
- if (!result) {
2841
- throw new Error("Failed to exchange GitHub token for Copilot bearer token. Check your Copilot subscription is active.");
2842
- }
2843
- return result;
2850
+ return refreshCopilotToken(githubToken);
2844
2851
  }
2845
2852
  async function getLlmConfig() {
2846
2853
  const config = readConfig();
@@ -265101,7 +265108,7 @@ var COPILOT_MODEL_OPTIONS = [
265101
265108
  { value: "o4-mini", label: "o4-mini (o4-mini via Copilot)" },
265102
265109
  { value: "gemini-2.5-pro", label: "gemini-2.5-pro (Gemini 2.5 Pro via Copilot)" }
265103
265110
  ];
265104
- var GITHUB_DEVICE_CLIENT_ID = "01ab8ac9400c4e429b23";
265111
+ var GITHUB_DEVICE_CLIENT_ID = "Iv1.b507a08c87ecfe98";
265105
265112
  function cancelled() {
265106
265113
  console.log(import_picocolors8.default.yellow("Cancelled."));
265107
265114
  return true;
@@ -265419,6 +265426,70 @@ async function runFullLogin(context) {
265419
265426
  console.log(import_picocolors8.default.yellow("• LLM: not configured"));
265420
265427
  }
265421
265428
  }
265429
+ async function runLoginStatus() {
265430
+ const [railway, llmConfigured, llmConfig] = await Promise.all([
265431
+ checkRailwayAuth(),
265432
+ isLlmConfigured(),
265433
+ getLlmConfig()
265434
+ ]);
265435
+ const W3 = 54;
265436
+ const dim = (s) => import_picocolors8.default.dim(s);
265437
+ const divider = (label) => {
265438
+ const pad = W3 - 2 - label.length;
265439
+ console.log(` ${dim("┌─")} ${import_picocolors8.default.bold(import_picocolors8.default.white(label))} ${dim("─".repeat(Math.max(0, pad)) + "┐")}`);
265440
+ };
265441
+ const sectionEnd = () => console.log(` ${dim("└" + "─".repeat(W3))}`);
265442
+ const row = (icon, label, value, color = import_picocolors8.default.white) => console.log(` ${dim("│")} ${icon} ${dim(label.padEnd(12))} ${color(value)}`);
265443
+ const hint = (text) => console.log(` ${dim("│")} ${dim(text)}`);
265444
+ console.log("");
265445
+ divider("Railway");
265446
+ if (railway.authenticated) {
265447
+ const user = railway.username ?? "authenticated";
265448
+ row("✓", "status", user, import_picocolors8.default.green);
265449
+ } else if (railway.error === "Railway CLI not installed") {
265450
+ row("✗", "status", "CLI not installed", import_picocolors8.default.yellow);
265451
+ hint("Install: https://docs.railway.com/cli");
265452
+ } else {
265453
+ row("✗", "status", "not authenticated", import_picocolors8.default.yellow);
265454
+ hint("Run /login railway to authenticate");
265455
+ }
265456
+ sectionEnd();
265457
+ console.log("");
265458
+ divider("LLM");
265459
+ if (llmConfigured && llmConfig) {
265460
+ const label = providerLabel(llmConfig);
265461
+ row("✓", "provider", label, import_picocolors8.default.green);
265462
+ row(" ", "model", llmConfig.model, import_picocolors8.default.cyan);
265463
+ if (llmConfig.authType === "github-copilot") {
265464
+ row(" ", "auth", "GitHub Copilot subscription", import_picocolors8.default.dim);
265465
+ } else {
265466
+ row(" ", "auth", "API key", import_picocolors8.default.dim);
265467
+ }
265468
+ if (llmConfig.validatedAt) {
265469
+ const d3 = new Date(llmConfig.validatedAt);
265470
+ const ago = formatTimeAgo(d3);
265471
+ row(" ", "configured", ago, import_picocolors8.default.dim);
265472
+ }
265473
+ } else {
265474
+ row("✗", "status", "not configured", import_picocolors8.default.yellow);
265475
+ hint("Run /login llm to configure");
265476
+ }
265477
+ sectionEnd();
265478
+ console.log("");
265479
+ }
265480
+ function formatTimeAgo(date) {
265481
+ const diffMs = Date.now() - date.getTime();
265482
+ const diffMins = Math.floor(diffMs / 60000);
265483
+ if (diffMins < 1)
265484
+ return "just now";
265485
+ if (diffMins < 60)
265486
+ return `${diffMins}m ago`;
265487
+ const diffHours = Math.floor(diffMins / 60);
265488
+ if (diffHours < 24)
265489
+ return `${diffHours}h ago`;
265490
+ const diffDays = Math.floor(diffHours / 24);
265491
+ return `${diffDays}d ago`;
265492
+ }
265422
265493
  async function runLogout(context) {
265423
265494
  if (!context.yes) {
265424
265495
  const shouldLogout = await ye({
@@ -265464,8 +265535,12 @@ async function loginCommand(context, args, commandKey = "login") {
265464
265535
  await runModelSwitch();
265465
265536
  return;
265466
265537
  }
265538
+ if (subcommand === "status") {
265539
+ await runLoginStatus();
265540
+ return;
265541
+ }
265467
265542
  console.log(import_picocolors8.default.red(`Unknown /login subcommand: ${subcommand}`));
265468
- console.log(import_picocolors8.default.dim("Available: /login, /login railway, /login llm, /login model"));
265543
+ console.log(import_picocolors8.default.dim("Available: /login, /login status, /login railway, /login llm, /login model"));
265469
265544
  }
265470
265545
 
265471
265546
  // src/commands/versions.ts
@@ -265882,6 +265957,7 @@ function renderHelp() {
265882
265957
  cmd("/login railway", "", "Authenticate with Railway");
265883
265958
  cmd("/login llm", "", "Configure LLM provider and API key");
265884
265959
  cmd("/login model", "", "Switch active model without re-entering key");
265960
+ cmd("/login status", "", "Show current auth status for Railway and LLM");
265885
265961
  cmd("/logout", "", "Remove all stored credentials");
265886
265962
  sectionEnd();
265887
265963
  divider("Workspace");
@@ -265947,7 +266023,7 @@ async function helpCommand(_context, _args) {
265947
266023
  // package.json
265948
266024
  var package_default = {
265949
266025
  name: "openkitt",
265950
- version: "0.3.4",
266026
+ version: "0.3.6",
265951
266027
  description: "AI-powered monorepo scaffolding CLI",
265952
266028
  keywords: [
265953
266029
  "cli",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openkitt",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "AI-powered monorepo scaffolding CLI",
5
5
  "keywords": [
6
6
  "cli",