codeep 3.2.1 → 3.2.2

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.
@@ -17,7 +17,7 @@ import { getCurrentVersion, checkForUpdates, getUpdateInstructions } from '../ut
17
17
  import { getProviderList, isNoApiKeyProvider, resolveReasoningTier } from '../config/providers.js';
18
18
  import { getSessionStats, getCostBreakdown, getRecordCount } from '../utils/tokenTracker.js';
19
19
  import { getGitStatus, isGitRepository } from '../utils/git.js';
20
- import { reportStats, syncSession, generateProjectId } from '../utils/codeepCloud.js';
20
+ import { reportStats, syncSession, generateProjectId, ensureDeviceRegistered } from '../utils/codeepCloud.js';
21
21
  import { expandFileAndFolderMentions, expandGitMentions } from '../utils/mentions.js';
22
22
  import { expandWebMentions } from '../utils/webFetch.js';
23
23
  import { handleCommand as dispatchCommand } from './commands.js';
@@ -627,6 +627,10 @@ Commands (in chat):
627
627
  return;
628
628
  }
629
629
  await loadAllApiKeys();
630
+ // Re-announce this device to the dashboard. Cheap, fire-and-forget, and it
631
+ // repairs a machine whose one registration at link time happened to fail —
632
+ // which until now left it syncing, unlisted, and impossible to revoke.
633
+ ensureDeviceRegistered();
630
634
  let apiKey = await loadApiKey();
631
635
  if (!apiKey && !isNoApiKeyProvider(config.get('provider'))) {
632
636
  const newKey = await showLoginFlow();
@@ -42,9 +42,7 @@ export interface StatsPayload {
42
42
  cacheReadTokens?: number;
43
43
  estimatedCost?: number;
44
44
  }
45
- /**
46
- * Generate a stable project ID from the project root path.
47
- */
45
+ export declare function ensureDeviceRegistered(): void;
48
46
  export declare function generateProjectId(projectRoot: string): string;
49
47
  /**
50
48
  * Fire-and-forget stats report. Only sends if github_id is configured.
@@ -51,10 +51,18 @@ export async function runAccountFlow() {
51
51
  console.error('\n Could not reach codeep.dev. Check your internet connection.\n');
52
52
  return;
53
53
  }
54
+ // Say that the browser can be somewhere else, because it can and nothing
55
+ // said so. On a server there is no browser to open, and "paste the URL
56
+ // manually" reads as "into this machine's browser" — which is how people
57
+ // end up signing in to GitHub on a box they did not want their account on.
58
+ // The code grants nothing by itself: it is claimed by whoever opens it while
59
+ // already signed in, and it expires in five minutes.
54
60
  const url = `${API_BASE}/auth/cli?code=${code}`;
55
- console.log('\n Opening browser...');
61
+ console.log('\n Open this link to approve — on this machine, or any device');
62
+ console.log(' where you are already signed in to codeep.dev:\n');
56
63
  console.log(` ${url}\n`);
57
- console.log(' If the browser did not open, paste the URL above manually.\n');
64
+ console.log(' The link expires in 5 minutes. This machine then gets its own');
65
+ console.log(' token, revocable from Settings -> Connected devices.\n');
58
66
  openBrowser(url);
59
67
  // Poll for authorization
60
68
  process.stdout.write(' Waiting for GitHub login');
@@ -100,6 +108,41 @@ export async function runAccountFlow() {
100
108
  /**
101
109
  * Generate a stable project ID from the project root path.
102
110
  */
111
+ /**
112
+ * Tell the server this device exists, on every start.
113
+ *
114
+ * Registration used to happen once, at link time, inside a `catch {}` that
115
+ * ignored failures — so a network blip during `codeep account` left a machine
116
+ * with a working token and no `user_devices` row. It synced fine, did not
117
+ * appear under Connected devices, and could not be revoked, because Revoke
118
+ * deletes a row that was never written. That is the worst of the three
119
+ * outcomes: working, invisible, and permanent.
120
+ *
121
+ * Repeating it makes a missed registration self-heal on the next run, and
122
+ * turns `last_seen` into something true — it previously only moved at link
123
+ * time, so the dashboard's "last seen" was really "linked".
124
+ *
125
+ * Once per process, fire-and-forget: it is a heartbeat, not a gate, and must
126
+ * never delay or fail a start. The next start retries it anyway.
127
+ */
128
+ let deviceRegistered = false;
129
+ export function ensureDeviceRegistered() {
130
+ if (deviceRegistered)
131
+ return;
132
+ const syncToken = getSyncToken();
133
+ if (!syncToken)
134
+ return; // not linked; nothing to register
135
+ deviceRegistered = true;
136
+ void fetch(`${API_BASE}/api/auth/cli/device`, {
137
+ method: 'POST',
138
+ headers: { 'Content-Type': 'application/json', 'x-sync-token': syncToken },
139
+ body: JSON.stringify({ deviceId: getDeviceId(), hostname: hostname() }),
140
+ }).catch(() => {
141
+ // Allow the next call in this process to try again — a start that fails
142
+ // here should not mark the device as registered for good.
143
+ deviceRegistered = false;
144
+ });
145
+ }
103
146
  export function generateProjectId(projectRoot) {
104
147
  // Normalize: remove trailing slash, resolve to real path format
105
148
  const normalized = projectRoot.replace(/\/+$/, '').toLowerCase();
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "3.2.1";
1
+ export declare const VERSION = "3.2.2";
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // AUTO-GENERATED by scripts/gen-version.js — do not edit by hand.
2
2
  // Baked from package.json at build time so the bun-compiled binary reports
3
3
  // the right version (it has no package.json on disk to read at runtime).
4
- export const VERSION = '3.2.1';
4
+ export const VERSION = '3.2.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "3.2.1",
3
+ "version": "3.2.2",
4
4
  "description": "AI-powered coding assistant built for the terminal. Multiple LLM providers, project-aware context, and a seamless development workflow.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",