@hawkeye-xb.com/imprint-cli 0.2.1 → 0.2.3
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 +52 -1
- package/package.json +9 -8
- package/LICENSE +0 -94
package/dist/cli.js
CHANGED
|
@@ -160,7 +160,8 @@ var TOKEN_PREFIX = "imp_";
|
|
|
160
160
|
async function login() {
|
|
161
161
|
const port = await findFreePort();
|
|
162
162
|
const state = crypto.randomBytes(16).toString("hex");
|
|
163
|
-
const
|
|
163
|
+
const user = process.env.USER || os2.userInfo().username || "user";
|
|
164
|
+
const name = `${user}@${friendlyHostname()}`;
|
|
164
165
|
const tokenPromise = waitForCallback(port, state);
|
|
165
166
|
const url = new URL("/cli-login", DASHBOARD_URL);
|
|
166
167
|
url.searchParams.set("port", String(port));
|
|
@@ -177,6 +178,11 @@ async function login() {
|
|
|
177
178
|
console.log(`\u2713 Logged in. Token saved.`);
|
|
178
179
|
return token;
|
|
179
180
|
}
|
|
181
|
+
function friendlyHostname() {
|
|
182
|
+
const raw = os2.hostname();
|
|
183
|
+
if (!raw || raw === "bogon" || raw.startsWith("bogon.")) return "local";
|
|
184
|
+
return raw.replace(/\.local$/, "");
|
|
185
|
+
}
|
|
180
186
|
function waitForCallback(port, expectedState) {
|
|
181
187
|
return new Promise((resolve, reject) => {
|
|
182
188
|
const timeout = setTimeout(
|
|
@@ -255,6 +261,7 @@ async function install(args) {
|
|
|
255
261
|
switch (tool) {
|
|
256
262
|
case "claude-code":
|
|
257
263
|
await installClaudeCode(creds.token, apiBase);
|
|
264
|
+
await migrateLegacyClaudeSettings();
|
|
258
265
|
break;
|
|
259
266
|
case "cursor":
|
|
260
267
|
await installCursor(creds.token, apiBase);
|
|
@@ -264,6 +271,50 @@ async function install(args) {
|
|
|
264
271
|
break;
|
|
265
272
|
}
|
|
266
273
|
await bootstrapUsageDoc(creds.token, apiBase);
|
|
274
|
+
await printIdentity(creds.token, apiBase);
|
|
275
|
+
}
|
|
276
|
+
async function printIdentity(token, apiBase) {
|
|
277
|
+
try {
|
|
278
|
+
const res = await fetch(`${apiBase}/api/v1/whoami`, {
|
|
279
|
+
headers: { Authorization: `Bearer ${token}` }
|
|
280
|
+
});
|
|
281
|
+
if (!res.ok) return;
|
|
282
|
+
const body = await res.json();
|
|
283
|
+
const label = body.email || body.userId || "(unknown account)";
|
|
284
|
+
console.log(`
|
|
285
|
+
\u2713 Authorized as: ${label}`);
|
|
286
|
+
if (!body.email) {
|
|
287
|
+
console.log(
|
|
288
|
+
` (no email on file \u2014 if this is the wrong account, re-run 'imprint install' and use "Switch Account" on the confirmation page.)`
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
} catch {
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
async function migrateLegacyClaudeSettings() {
|
|
295
|
+
const legacyPath = path2.join(os3.homedir(), ".claude", "settings.json");
|
|
296
|
+
let raw;
|
|
297
|
+
try {
|
|
298
|
+
raw = await fs2.readFile(legacyPath, "utf8");
|
|
299
|
+
} catch (err) {
|
|
300
|
+
if (err.code === "ENOENT") return;
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
if (raw.trim().length === 0) return;
|
|
304
|
+
let parsed;
|
|
305
|
+
try {
|
|
306
|
+
parsed = JSON.parse(raw);
|
|
307
|
+
} catch {
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return;
|
|
311
|
+
const obj = parsed;
|
|
312
|
+
if (!obj.mcpServers || typeof obj.mcpServers !== "object") return;
|
|
313
|
+
if (!("imprint" in obj.mcpServers)) return;
|
|
314
|
+
delete obj.mcpServers.imprint;
|
|
315
|
+
if (Object.keys(obj.mcpServers).length === 0) delete obj.mcpServers;
|
|
316
|
+
await fs2.writeFile(legacyPath, JSON.stringify(obj, null, 2) + "\n");
|
|
317
|
+
console.log(`\u2713 Cleaned legacy mcpServers.imprint from ${legacyPath}`);
|
|
267
318
|
}
|
|
268
319
|
var USAGE_DOC_PATH = "users/_imprint-usage.md";
|
|
269
320
|
var USAGE_DOC = `# How to use Imprint (auto-seeded)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hawkeye-xb.com/imprint-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
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",
|
|
@@ -33,15 +33,16 @@
|
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
|
-
"devDependencies": {
|
|
37
|
-
"@types/node": "^22.10.2",
|
|
38
|
-
"tsup": "^8.3.5",
|
|
39
|
-
"typescript": "^5.6.3"
|
|
40
|
-
},
|
|
41
36
|
"scripts": {
|
|
42
37
|
"build": "tsup",
|
|
43
38
|
"dev": "tsup --watch",
|
|
44
39
|
"typecheck": "tsc --noEmit",
|
|
45
|
-
"start": "node dist/cli.js"
|
|
40
|
+
"start": "node dist/cli.js",
|
|
41
|
+
"prepublishOnly": "pnpm build"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/node": "^22.10.2",
|
|
45
|
+
"tsup": "^8.3.5",
|
|
46
|
+
"typescript": "^5.6.3"
|
|
46
47
|
}
|
|
47
|
-
}
|
|
48
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
Elastic License 2.0 (ELv2)
|
|
2
|
-
|
|
3
|
-
URL: https://www.elastic.co/licensing/elastic-license
|
|
4
|
-
|
|
5
|
-
## Acceptance
|
|
6
|
-
|
|
7
|
-
By using the software, you agree to all of the terms and conditions below.
|
|
8
|
-
|
|
9
|
-
## Copyright License
|
|
10
|
-
|
|
11
|
-
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
12
|
-
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
13
|
-
available, and prepare derivative works of the software, in each case subject
|
|
14
|
-
to the limitations and conditions below.
|
|
15
|
-
|
|
16
|
-
## Limitations
|
|
17
|
-
|
|
18
|
-
You may not provide the software to third parties as a hosted or managed
|
|
19
|
-
service, where the service provides users with access to any substantial set
|
|
20
|
-
of the features or functionality of the software.
|
|
21
|
-
|
|
22
|
-
You may not move, change, disable, or circumvent the license key functionality
|
|
23
|
-
in the software, and you may not remove or obscure any functionality in the
|
|
24
|
-
software that is protected by the license key.
|
|
25
|
-
|
|
26
|
-
You may not alter, remove, or obscure any licensing, copyright, or other
|
|
27
|
-
notices of the licensor in the software. Any use of the licensor's trademarks
|
|
28
|
-
is subject to applicable law.
|
|
29
|
-
|
|
30
|
-
## Patents
|
|
31
|
-
|
|
32
|
-
The licensor grants you a license, under any patent claims the licensor can
|
|
33
|
-
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
34
|
-
sale, import and have imported the software, in each case subject to the
|
|
35
|
-
limitations and conditions in this license. This license does not cover any
|
|
36
|
-
patent claims that you cause to be infringed by modifications or additions to
|
|
37
|
-
the software. If you or your company make any written claim that the software
|
|
38
|
-
infringes or contributes to infringement of any patent, your patent license
|
|
39
|
-
for the software granted under these terms ends immediately. If your company
|
|
40
|
-
makes such a claim, your patent license ends immediately for work on behalf
|
|
41
|
-
of your company.
|
|
42
|
-
|
|
43
|
-
## Notices
|
|
44
|
-
|
|
45
|
-
You must ensure that anyone who gets a copy of any part of the software from
|
|
46
|
-
you also gets a copy of these terms.
|
|
47
|
-
|
|
48
|
-
If you modify the software, you must include in any modified copies of the
|
|
49
|
-
software prominent notices stating that you have modified the software.
|
|
50
|
-
|
|
51
|
-
## No Other Rights
|
|
52
|
-
|
|
53
|
-
These terms do not imply any licenses other than those expressly granted in
|
|
54
|
-
these terms.
|
|
55
|
-
|
|
56
|
-
## Termination
|
|
57
|
-
|
|
58
|
-
If you use the software in violation of these terms, such use is not licensed,
|
|
59
|
-
and your licenses will automatically terminate. If the licensor provides you
|
|
60
|
-
with a notice of your violation, and you cease all violation of this license
|
|
61
|
-
no later than 30 days after you receive that notice, your licenses will be
|
|
62
|
-
reinstated retroactively. However, if you violate these terms after such
|
|
63
|
-
reinstatement, any additional violation of these terms will cause your
|
|
64
|
-
licenses to terminate automatically and permanently.
|
|
65
|
-
|
|
66
|
-
## No Liability
|
|
67
|
-
|
|
68
|
-
*As far as the law allows, the software comes as is, without any warranty or
|
|
69
|
-
condition, and the licensor will not be liable to you for any damages arising
|
|
70
|
-
out of these terms or the use or nature of the software, under any kind of
|
|
71
|
-
legal claim.*
|
|
72
|
-
|
|
73
|
-
## Definitions
|
|
74
|
-
|
|
75
|
-
The **licensor** is the entity offering these terms, and the **software** is
|
|
76
|
-
the software the licensor makes available under these terms, including any
|
|
77
|
-
portion of it.
|
|
78
|
-
|
|
79
|
-
**you** refers to the individual or entity agreeing to these terms.
|
|
80
|
-
|
|
81
|
-
**your company** is any legal entity, sole proprietorship, or other kind of
|
|
82
|
-
organization that you work for, plus all organizations that have control
|
|
83
|
-
over, are under the control of, or are under common control with that
|
|
84
|
-
organization. **control** means ownership of substantially all the assets of
|
|
85
|
-
an entity, or the power to direct its management and policies by vote,
|
|
86
|
-
contract, or otherwise. Control can be direct or indirect.
|
|
87
|
-
|
|
88
|
-
**your licenses** are all the licenses granted to you for the software under
|
|
89
|
-
these terms.
|
|
90
|
-
|
|
91
|
-
**use** means anything you do with the software requiring one of your
|
|
92
|
-
licenses.
|
|
93
|
-
|
|
94
|
-
**trademark** means trademarks, service marks, and similar rights.
|