@hawkeye-xb.com/imprint-cli 0.1.1 → 0.2.1

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 (3) hide show
  1. package/LICENSE +94 -0
  2. package/dist/cli.js +66 -3
  3. package/package.json +8 -9
package/LICENSE ADDED
@@ -0,0 +1,94 @@
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.
package/dist/cli.js CHANGED
@@ -263,6 +263,68 @@ async function install(args) {
263
263
  await installCodex(creds.token, apiBase);
264
264
  break;
265
265
  }
266
+ await bootstrapUsageDoc(creds.token, apiBase);
267
+ }
268
+ var USAGE_DOC_PATH = "users/_imprint-usage.md";
269
+ var USAGE_DOC = `# How to use Imprint (auto-seeded)
270
+
271
+ This file was created by \`imprint install\` on first run as a primer for any AI agent that connects to this user's Imprint memory. Edit or \`rm\` it freely \u2014 it will only be re-seeded if missing.
272
+
273
+ ## Triggers
274
+
275
+ - **Session start**: run \`ls /\` to see what context exists. Then \`cat\` or \`grep\` anything that might be relevant before asking the user identity questions.
276
+ - **User reveals a preference / decision / constraint**: \`write\` it. Don't wait for explicit "remember this".
277
+ - **Stored memory contradicts current observation**: overwrite or \`rm\` it. Stale memories are worse than missing ones.
278
+
279
+ ## Path taxonomy
280
+
281
+ - \`users/<topic>.md\` \u2014 identity, working style, preferences, principles
282
+ - \`projects/<name>/<topic>.md\` \u2014 per-project goals, constraints, decisions
283
+ - \`feedback/<topic>.md\` \u2014 corrections received, validated approaches
284
+ - \`references/<topic>.md\` \u2014 pointers to external systems (Linear, Slack, dashboards)
285
+
286
+ ## Entry shape
287
+
288
+ Lead with the rule or fact in one line, then:
289
+
290
+ - **Why:** the reason it matters (often a past incident, deadline, or stated preference)
291
+ - **How to apply:** when this should change behavior in future sessions
292
+
293
+ Knowing *why* lets future agents handle edge cases instead of mechanically following the rule.
294
+
295
+ ## Privacy
296
+
297
+ Don't persist employer names, work emails, or any identifier that could leak day-job context unless the user has explicitly said it's safe. When in doubt, abstract ("a tech company") or omit.
298
+ `;
299
+ async function bootstrapUsageDoc(token, apiBase) {
300
+ const url = `${apiBase}/api/v1/memories/${USAGE_DOC_PATH}`;
301
+ try {
302
+ const head = await fetch(url, {
303
+ headers: { Authorization: `Bearer ${token}` }
304
+ });
305
+ if (head.status === 200) return;
306
+ if (head.status !== 404) {
307
+ console.warn(` (skipped seeding ${USAGE_DOC_PATH}: HTTP ${head.status})`);
308
+ return;
309
+ }
310
+ const res = await fetch(`${apiBase}/api/v1/memories`, {
311
+ method: "POST",
312
+ headers: {
313
+ Authorization: `Bearer ${token}`,
314
+ "Content-Type": "application/json"
315
+ },
316
+ body: JSON.stringify({ path: USAGE_DOC_PATH, content: USAGE_DOC })
317
+ });
318
+ if (res.ok) {
319
+ console.log(`\u2713 Seeded ${USAGE_DOC_PATH} (visible on first \`ls /\`)`);
320
+ } else {
321
+ console.warn(` (skipped seeding ${USAGE_DOC_PATH}: HTTP ${res.status})`);
322
+ }
323
+ } catch (err) {
324
+ console.warn(
325
+ ` (skipped seeding ${USAGE_DOC_PATH}: ${err.message})`
326
+ );
327
+ }
266
328
  }
267
329
  function parseTool(args) {
268
330
  const idx = args.indexOf("--tool");
@@ -296,13 +358,14 @@ async function mergeJsonMcpServer(filePath, serverName, serverConfig) {
296
358
  await fs2.writeFile(filePath, JSON.stringify(config, null, 2) + "\n");
297
359
  }
298
360
  async function installClaudeCode(token, apiBase) {
299
- const settingsPath = path2.join(os3.homedir(), ".claude", "settings.json");
300
- await mergeJsonMcpServer(settingsPath, "imprint", {
361
+ const configPath = path2.join(os3.homedir(), ".claude.json");
362
+ await mergeJsonMcpServer(configPath, "imprint", {
301
363
  type: "http",
302
364
  url: `${apiBase}/mcp`,
303
365
  headers: { Authorization: `Bearer ${token}` }
304
366
  });
305
- console.log(`\u2713 Claude Code: wrote mcpServers.imprint to ${settingsPath}`);
367
+ console.log(`\u2713 Claude Code: wrote mcpServers.imprint to ${configPath}`);
368
+ console.log(` This is user-scoped \u2014 imprint will be available from any directory.`);
306
369
  console.log(` Restart Claude Code to pick up the new server.`);
307
370
  }
308
371
  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.1.1",
3
+ "version": "0.2.1",
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,16 +33,15 @@
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
- "scripts": {
37
- "build": "tsup",
38
- "dev": "tsup --watch",
39
- "typecheck": "tsc --noEmit",
40
- "start": "node dist/cli.js",
41
- "prepublishOnly": "pnpm build"
42
- },
43
36
  "devDependencies": {
44
37
  "@types/node": "^22.10.2",
45
38
  "tsup": "^8.3.5",
46
39
  "typescript": "^5.6.3"
40
+ },
41
+ "scripts": {
42
+ "build": "tsup",
43
+ "dev": "tsup --watch",
44
+ "typecheck": "tsc --noEmit",
45
+ "start": "node dist/cli.js"
47
46
  }
48
- }
47
+ }