@hawkeye-xb.com/imprint-cli 0.2.0 → 0.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.
Files changed (2) hide show
  1. package/dist/cli.js +49 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -255,6 +255,7 @@ async function install(args) {
255
255
  switch (tool) {
256
256
  case "claude-code":
257
257
  await installClaudeCode(creds.token, apiBase);
258
+ await migrateLegacyClaudeSettings();
258
259
  break;
259
260
  case "cursor":
260
261
  await installCursor(creds.token, apiBase);
@@ -264,6 +265,50 @@ async function install(args) {
264
265
  break;
265
266
  }
266
267
  await bootstrapUsageDoc(creds.token, apiBase);
268
+ await printIdentity(creds.token, apiBase);
269
+ }
270
+ async function printIdentity(token, apiBase) {
271
+ try {
272
+ const res = await fetch(`${apiBase}/api/v1/whoami`, {
273
+ headers: { Authorization: `Bearer ${token}` }
274
+ });
275
+ if (!res.ok) return;
276
+ const body = await res.json();
277
+ const label = body.email || body.userId || "(unknown account)";
278
+ console.log(`
279
+ \u2713 Authorized as: ${label}`);
280
+ if (!body.email) {
281
+ console.log(
282
+ ` (no email on file \u2014 if this is the wrong account, re-run 'imprint install' and use "Switch Account" on the confirmation page.)`
283
+ );
284
+ }
285
+ } catch {
286
+ }
287
+ }
288
+ async function migrateLegacyClaudeSettings() {
289
+ const legacyPath = path2.join(os3.homedir(), ".claude", "settings.json");
290
+ let raw;
291
+ try {
292
+ raw = await fs2.readFile(legacyPath, "utf8");
293
+ } catch (err) {
294
+ if (err.code === "ENOENT") return;
295
+ return;
296
+ }
297
+ if (raw.trim().length === 0) return;
298
+ let parsed;
299
+ try {
300
+ parsed = JSON.parse(raw);
301
+ } catch {
302
+ return;
303
+ }
304
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return;
305
+ const obj = parsed;
306
+ if (!obj.mcpServers || typeof obj.mcpServers !== "object") return;
307
+ if (!("imprint" in obj.mcpServers)) return;
308
+ delete obj.mcpServers.imprint;
309
+ if (Object.keys(obj.mcpServers).length === 0) delete obj.mcpServers;
310
+ await fs2.writeFile(legacyPath, JSON.stringify(obj, null, 2) + "\n");
311
+ console.log(`\u2713 Cleaned legacy mcpServers.imprint from ${legacyPath}`);
267
312
  }
268
313
  var USAGE_DOC_PATH = "users/_imprint-usage.md";
269
314
  var USAGE_DOC = `# How to use Imprint (auto-seeded)
@@ -358,13 +403,14 @@ async function mergeJsonMcpServer(filePath, serverName, serverConfig) {
358
403
  await fs2.writeFile(filePath, JSON.stringify(config, null, 2) + "\n");
359
404
  }
360
405
  async function installClaudeCode(token, apiBase) {
361
- const settingsPath = path2.join(os3.homedir(), ".claude", "settings.json");
362
- await mergeJsonMcpServer(settingsPath, "imprint", {
406
+ const configPath = path2.join(os3.homedir(), ".claude.json");
407
+ await mergeJsonMcpServer(configPath, "imprint", {
363
408
  type: "http",
364
409
  url: `${apiBase}/mcp`,
365
410
  headers: { Authorization: `Bearer ${token}` }
366
411
  });
367
- console.log(`\u2713 Claude Code: wrote mcpServers.imprint to ${settingsPath}`);
412
+ console.log(`\u2713 Claude Code: wrote mcpServers.imprint to ${configPath}`);
413
+ console.log(` This is user-scoped \u2014 imprint will be available from any directory.`);
368
414
  console.log(` Restart Claude Code to pick up the new server.`);
369
415
  }
370
416
  async function installCursor(token, apiBase) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hawkeye-xb.com/imprint-cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "description": "Imprint CLI — long-term memory for AI coding tools (Claude Code, Cursor, Codex). Installs the imprint MCP server into your tool's settings file via a browser OAuth flow.",
6
6
  "license": "Elastic-2.0",