@saleem11kh/repomem 0.1.1 → 0.3.0

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 (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +212 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +335 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/config/config.d.ts +24 -0
  8. package/dist/config/config.d.ts.map +1 -0
  9. package/dist/config/config.js +100 -0
  10. package/dist/config/config.js.map +1 -0
  11. package/dist/index.d.ts +3 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +75 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/store/file-store.d.ts +83 -0
  16. package/dist/store/file-store.d.ts.map +1 -0
  17. package/dist/store/file-store.js +509 -0
  18. package/dist/store/file-store.js.map +1 -0
  19. package/dist/store/remote.d.ts +30 -0
  20. package/dist/store/remote.d.ts.map +1 -0
  21. package/dist/store/remote.js +118 -0
  22. package/dist/store/remote.js.map +1 -0
  23. package/dist/tools/mem-context.d.ts +3 -0
  24. package/dist/tools/mem-context.d.ts.map +1 -0
  25. package/dist/tools/mem-context.js +93 -0
  26. package/dist/tools/mem-context.js.map +1 -0
  27. package/dist/tools/mem-get.d.ts +3 -0
  28. package/dist/tools/mem-get.d.ts.map +1 -0
  29. package/dist/tools/mem-get.js +57 -0
  30. package/dist/tools/mem-get.js.map +1 -0
  31. package/dist/tools/mem-handoff.d.ts +3 -0
  32. package/dist/tools/mem-handoff.d.ts.map +1 -0
  33. package/dist/tools/mem-handoff.js +72 -0
  34. package/dist/tools/mem-handoff.js.map +1 -0
  35. package/dist/tools/mem-prime.d.ts +3 -0
  36. package/dist/tools/mem-prime.d.ts.map +1 -0
  37. package/dist/tools/mem-prime.js +48 -0
  38. package/dist/tools/mem-prime.js.map +1 -0
  39. package/dist/tools/mem-save.d.ts +5 -0
  40. package/dist/tools/mem-save.d.ts.map +1 -0
  41. package/dist/tools/mem-save.js +103 -0
  42. package/dist/tools/mem-save.js.map +1 -0
  43. package/dist/tools/mem-search.d.ts +3 -0
  44. package/dist/tools/mem-search.d.ts.map +1 -0
  45. package/dist/tools/mem-search.js +50 -0
  46. package/dist/tools/mem-search.js.map +1 -0
  47. package/dist/tools/util.d.ts +18 -0
  48. package/dist/tools/util.d.ts.map +1 -0
  49. package/dist/tools/util.js +42 -0
  50. package/dist/tools/util.js.map +1 -0
  51. package/package.json +25 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Saleem Khan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,212 @@
1
+ <div align="center">
2
+
3
+ # repomem
4
+
5
+ **Git-native memory for AI coding agents.**
6
+
7
+ `.repomem/` lives in your repo. Commits with your code. Clones with your team.
8
+ Works with Claude Code, Cursor, Gemini CLI, Codex — any MCP-compatible agent.
9
+
10
+ [![npm](https://img.shields.io/npm/v/@saleem11kh/repomem?color=7F77DD&label=npm)](https://www.npmjs.com/package/@saleem11kh/repomem)
11
+ [![license](https://img.shields.io/badge/license-MIT-1D9E75)](./LICENSE)
12
+ [![status](https://img.shields.io/badge/status-early%20development-amber)](https://github.com/saleem786khan/repomem)
13
+
14
+ </div>
15
+
16
+ ---
17
+
18
+ ## The problem
19
+
20
+ Every AI coding session starts from zero.
21
+
22
+ You spend the first 10–15 minutes re-explaining your folder structure, your deployment order, what your team decided last week, which patterns to use, which ones to avoid. Your teammate picks up your work and has no idea what Claude was told. You switch from Claude Code to Cursor and lose all context. You start a new session on a different machine and rediscover everything from scratch.
23
+
24
+ CLAUDE.md helps — but it's static. It doesn't capture what was done yesterday, decisions made mid-session, or work-in-progress state. claude-mem and Engram are personal — they don't sync with your team and don't travel with the repo.
25
+
26
+ **The root problem: memory lives in the tool, not in the project.**
27
+
28
+ ---
29
+
30
+ ## The solution
31
+
32
+ repomem puts memory where code already lives — in the git repo.
33
+
34
+ ```
35
+ your-project/
36
+ └── .repomem/
37
+ ├── decisions/ ← architectural choices + why
38
+ ├── sessions/ ← what was done, what's next
39
+ ├── patterns/ ← reusable conventions for this codebase
40
+ └── issues/ ← known gotchas, do-not-repeat mistakes
41
+ ```
42
+
43
+ Plain markdown files. No database. No cloud. No vendor lock-in.
44
+
45
+ `git add .repomem/ && git commit` → your whole team has the memory.
46
+ `git clone` → new teammate inherits full project context on day one.
47
+ Switch agents → same memory, because it's in the repo, not the tool.
48
+
49
+ ---
50
+
51
+ ## How it works
52
+
53
+ repomem runs as an MCP server. Your AI agent gets 4 tools:
54
+
55
+ | Tool | What it does |
56
+ |---|---|
57
+ | `mem_save` | Save a decision, pattern, issue, or session note (with a one-line summary + `[[links]]`) |
58
+ | `mem_search` | Search across all memory files instantly (BM25 + recency ranked) |
59
+ | `mem_context` | Get a lean context packet at session start — summaries, not full bodies |
60
+ | `mem_get` | Expand a single entry (by file or `[[wikilink]]`) only when you need it |
61
+ | `mem_handoff` | Write today's session file, ready to commit |
62
+ | `mem_prime` | Bootstrap memory on an existing repo from its CLAUDE.md / docs |
63
+
64
+ At the start of every session, your agent calls `mem_context()` and immediately knows:
65
+ - What was worked on last session
66
+ - Key architectural decisions and why they were made
67
+ - Patterns and conventions for this specific codebase
68
+ - Known issues to avoid repeating
69
+ - What's next
70
+
71
+ To keep context small, `mem_context` returns **one-line summaries**; the agent expands
72
+ only what it needs with `mem_get`. Entries can cross-link with `[[wikilinks]]`, so related
73
+ decisions, patterns, and issues travel together. Already have a context-rich repo? Run
74
+ `mem_prime` once to seed memory from your existing `CLAUDE.md` and `docs/`.
75
+
76
+ ---
77
+
78
+ ## Quick start
79
+
80
+ ```bash
81
+ # Install
82
+ npm install -g @saleem11kh/repomem
83
+
84
+ # Initialize in your project
85
+ cd your-project
86
+ repomem init
87
+
88
+ # Wire to Claude Code
89
+ repomem setup claude-code
90
+
91
+ # Wire to Cursor
92
+ repomem setup cursor
93
+
94
+ # Wire to Gemini CLI
95
+ repomem setup gemini
96
+ ```
97
+
98
+ That's it. Your agent now has persistent memory that lives in your repo.
99
+
100
+ ---
101
+
102
+ ## Multi-repo support
103
+
104
+ Working across microservices or a multi-repo setup? repomem handles it.
105
+
106
+ ```json
107
+ // repomem.config.json
108
+ {
109
+ "project": "payments-service",
110
+ "workspace": "../repomem-workspace",
111
+ "linked": [
112
+ { "repo": "../auth-service", "relation": "depends-on" },
113
+ { "repo": "../shared-lib", "relation": "consumes" },
114
+ { "repo": "github:acme/billing-svc", "relation": "depends-on" }
115
+ ]
116
+ }
117
+ ```
118
+
119
+ Linked repos can be **local paths** or **remote GitHub repos** (`github:owner/name`,
120
+ optionally `#ref`). For remotes, run `repomem pull` once to fetch their `.repomem/`
121
+ into a local, gitignored cache — no full clone needed. A `GITHUB_TOKEN`/`GH_TOKEN`
122
+ env var is used for private repos and higher rate limits.
123
+
124
+ When your agent calls `mem_search` with `linked=true`, repomem searches:
125
+ 1. Current repo memory
126
+ 2. Linked repo memory — local paths and pulled remotes (contracts, shared patterns)
127
+ 3. Workspace memory (org-wide decisions)
128
+
129
+ Results are ranked (TF-IDF + recency) and labelled by source:
130
+ `[current] [linked:auth-service] [remote:billing-svc] [workspace]`
131
+
132
+ Cross-repository context that actually travels with the code — not locked in a personal tool on one machine.
133
+
134
+ ---
135
+
136
+ ## Compared to alternatives
137
+
138
+ | | repomem | Engram | claude-mem | CLAUDE.md |
139
+ |---|---|---|---|---|
140
+ | Git-committed | ✅ | ❌ | ❌ | ✅ |
141
+ | Team-shared on clone | ✅ | ❌ | ❌ | ✅ |
142
+ | Captures session work | ✅ | ✅ | ✅ | ❌ |
143
+ | Multi-repo support | ✅ | ❌ | ❌ | ❌ |
144
+ | Multi-agent (any MCP) | ✅ | ✅ | ❌ | ✅ |
145
+ | No cloud / no vendor | ✅ | ❌ | ✅ | ✅ |
146
+ | Plain markdown files | ✅ | ❌ | ❌ | ✅ |
147
+
148
+ ---
149
+
150
+ ## Roadmap
151
+
152
+ - [x] npm package claimed
153
+ - [x] `repomem init` — scaffold `.repomem/` in any project
154
+ - [x] 4 core MCP tools (`mem_save`, `mem_search`, `mem_context`, `mem_handoff`)
155
+ - [x] Claude Code wiring (`repomem setup claude-code`)
156
+ - [x] Cursor wiring
157
+ - [x] Gemini CLI / Codex wiring
158
+ - [x] Multi-repo `linked` support (local paths)
159
+ - [x] Workspace scope (cross-org shared memory repo)
160
+ - [x] `repomem sync` — export `.repomem/` to stdout for sharing
161
+ - [x] Remote linked repos (read `.repomem/` from GitHub without cloning, via `repomem pull`)
162
+ - [x] `repomem import` — import a sync bundle for airgapped environments
163
+ - [x] Smarter search ranking (BM25 + recency weighting)
164
+ - [x] Progressive disclosure — `mem_context` summaries + `mem_get` to expand
165
+ - [x] `[[wikilink]]` graph between memories (traversed by search + context)
166
+ - [x] `mem_prime` — bootstrap memory from an existing repo's docs
167
+ - [ ] Optional semantic search layer (off by default, local embedding cache)
168
+
169
+ ---
170
+
171
+ ## Status
172
+
173
+ **v0.2 — working.** `init`, `setup`, `status`, `sync`, `import`, `pull`, and six
174
+ MCP tools (`mem_save`, `mem_search`, `mem_context`, `mem_get`, `mem_handoff`,
175
+ `mem_prime`) are implemented and tested. Context is token-lean by default
176
+ (summaries + `mem_get` to expand), memories cross-link with `[[wikilinks]]`, and
177
+ `mem_prime` bootstraps an existing repo from its docs. Multi-repo search spans
178
+ local `linked` paths, remote GitHub repos (pulled into a local cache), and a
179
+ shared `workspace`, ranked by BM25 with a recency boost.
180
+
181
+ If this solves a problem you have, **star the repo** — it helps validate that this is worth building and tells me which features to prioritise first.
182
+
183
+ Have this exact problem on your team? Open an [issue](https://github.com/saleem786khan/repomem/issues) describing your setup — I'm using real use cases to shape the v0.1 feature set.
184
+
185
+ ---
186
+
187
+ ## Contributing
188
+
189
+ repomem is being built in public. Contributions welcome at any stage.
190
+
191
+ ```bash
192
+ git clone https://github.com/saleem786khan/repomem
193
+ cd repomem
194
+ npm install
195
+ npm run dev
196
+ ```
197
+
198
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for how to get involved.
199
+ Good first issues will be labelled once the scaffold is up.
200
+
201
+ ---
202
+
203
+ ## License
204
+
205
+ MIT — see [LICENSE](./LICENSE)
206
+
207
+ ---
208
+
209
+ <div align="center">
210
+ Built by <a href="https://github.com/saleem786khan">Saleem Khan</a> — Solutions Architect with 11 years of enterprise delivery,
211
+ tired of re-explaining the same project to Claude every single morning.
212
+ </div>
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,335 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ const config_js_1 = require("./config/config.js");
40
+ const file_store_js_1 = require("./store/file-store.js");
41
+ const remote_js_1 = require("./store/remote.js");
42
+ // Each agent reads project-scoped MCP config from a specific file at the repo
43
+ // root. Claude Code uses `.mcp.json` (NOT `.claude/mcp.json`); Codex uses TOML.
44
+ const AGENTS = {
45
+ "claude-code": { file: ".mcp.json", label: "Claude Code", format: "json" },
46
+ cursor: { file: ".cursor/mcp.json", label: "Cursor", format: "json" },
47
+ gemini: { file: ".gemini/settings.json", label: "Gemini CLI", format: "json" },
48
+ "gemini-cli": { file: ".gemini/settings.json", label: "Gemini CLI", format: "json" },
49
+ codex: { file: ".codex/config.toml", label: "Codex", format: "toml" },
50
+ };
51
+ const MCP_COMMAND = "npx";
52
+ const MCP_ARGS = ["@saleem11kh/repomem"];
53
+ const MCP_ENTRY = { command: MCP_COMMAND, args: MCP_ARGS };
54
+ function cwd() {
55
+ return process.cwd();
56
+ }
57
+ /** repomem init — scaffold .repomem/ and repomem.config.json. */
58
+ function cmdInit() {
59
+ const root = cwd();
60
+ const repomem = (0, file_store_js_1.getRepomemRoot)(root);
61
+ for (const type of file_store_js_1.MEMORY_TYPES) {
62
+ const dir = path.join(repomem, type);
63
+ fs.mkdirSync(dir, { recursive: true });
64
+ const keep = path.join(dir, ".gitkeep");
65
+ if (!fs.existsSync(keep))
66
+ fs.writeFileSync(keep, "", "utf8");
67
+ }
68
+ const configPath = path.join(root, config_js_1.CONFIG_FILENAME);
69
+ if (!fs.existsSync(configPath)) {
70
+ const config = {
71
+ project: (0, config_js_1.deriveProjectName)(root),
72
+ linked: [],
73
+ };
74
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n", "utf8");
75
+ console.log(`✔ Created ${config_js_1.CONFIG_FILENAME} (project: ${config.project})`);
76
+ }
77
+ else {
78
+ console.log(`• ${config_js_1.CONFIG_FILENAME} already exists — left untouched`);
79
+ }
80
+ (0, file_store_js_1.generateIndex)(root);
81
+ console.log(`✔ Initialised .repomem/ with ${file_store_js_1.MEMORY_TYPES.join(", ")}`);
82
+ console.log("\nNext: wire it to your agent, e.g.");
83
+ console.log(" repomem setup claude-code");
84
+ console.log("\nThen commit it so your team inherits the memory:");
85
+ console.log(" git add .repomem/ repomem.config.json && git commit");
86
+ }
87
+ /** repomem setup <agent> — write the MCP server config for an agent. */
88
+ function cmdSetup(agentArg) {
89
+ if (!agentArg) {
90
+ console.error(`✖ Usage: repomem setup <${Object.keys(AGENTS).join("|")}>`);
91
+ process.exitCode = 1;
92
+ return;
93
+ }
94
+ const agent = AGENTS[agentArg.toLowerCase()];
95
+ if (!agent) {
96
+ console.error(`✖ Unknown agent "${agentArg}". Supported: ${Object.keys(AGENTS).join(", ")}`);
97
+ process.exitCode = 1;
98
+ return;
99
+ }
100
+ const root = cwd();
101
+ const target = path.join(root, agent.file);
102
+ const dir = path.dirname(target);
103
+ if (dir !== root)
104
+ fs.mkdirSync(dir, { recursive: true });
105
+ const wired = agent.format === "toml"
106
+ ? setupToml(target, agent)
107
+ : setupJson(target, agent);
108
+ if (!wired)
109
+ return;
110
+ console.log(`✔ Wired repomem into ${agent.label} (${agent.file})`);
111
+ if (agent.format === "toml") {
112
+ console.log(" Codex only loads project config for trusted projects —");
113
+ console.log(" run it from this dir and approve the trust prompt.");
114
+ }
115
+ console.log(" Restart the agent to pick up the new MCP server.");
116
+ }
117
+ /** Merge the repomem entry into a JSON `mcpServers` map. Returns false on error. */
118
+ function setupJson(target, agent) {
119
+ let existing = {};
120
+ if (fs.existsSync(target)) {
121
+ try {
122
+ existing = JSON.parse(fs.readFileSync(target, "utf8"));
123
+ }
124
+ catch {
125
+ console.error(`✖ ${agent.file} exists but is not valid JSON — aborting.`);
126
+ process.exitCode = 1;
127
+ return false;
128
+ }
129
+ }
130
+ const servers = existing.mcpServers ?? {};
131
+ servers.repomem = MCP_ENTRY;
132
+ existing.mcpServers = servers;
133
+ fs.writeFileSync(target, JSON.stringify(existing, null, 2) + "\n", "utf8");
134
+ return true;
135
+ }
136
+ /** Append a `[mcp_servers.repomem]` block to a Codex TOML config (idempotent). */
137
+ function setupToml(target, agent) {
138
+ const content = fs.existsSync(target) ? fs.readFileSync(target, "utf8") : "";
139
+ if (/^\s*\[mcp_servers\.repomem\]/m.test(content)) {
140
+ console.log(`• repomem already configured in ${agent.label} (${agent.file})`);
141
+ return false;
142
+ }
143
+ const block = [
144
+ "[mcp_servers.repomem]",
145
+ `command = ${JSON.stringify(MCP_COMMAND)}`,
146
+ `args = [${MCP_ARGS.map((a) => JSON.stringify(a)).join(", ")}]`,
147
+ "",
148
+ ].join("\n");
149
+ const prefix = content.trim() ? content.replace(/\s*$/, "") + "\n\n" : "";
150
+ fs.writeFileSync(target, prefix + block, "utf8");
151
+ return true;
152
+ }
153
+ /** repomem status — print a health summary. */
154
+ function cmdStatus() {
155
+ const root = cwd();
156
+ if (!(0, file_store_js_1.isInitialized)(root)) {
157
+ console.error("✖ .repomem/ not found here. Run `repomem init` first.");
158
+ process.exitCode = 1;
159
+ return;
160
+ }
161
+ const config = (0, config_js_1.loadConfig)(root);
162
+ const c = (0, file_store_js_1.counts)(root);
163
+ console.log(`repomem status — ${config.project}`);
164
+ console.log("");
165
+ for (const type of file_store_js_1.MEMORY_TYPES) {
166
+ console.log(` ${type.padEnd(10)} ${c[type]}`);
167
+ }
168
+ const configuredAgents = Object.entries(AGENTS)
169
+ .filter(([, a]) => fs.existsSync(path.join(root, a.file)))
170
+ .map(([, a]) => a.label);
171
+ const uniqueAgents = [...new Set(configuredAgents)];
172
+ console.log("");
173
+ console.log(` agents ${uniqueAgents.length ? uniqueAgents.join(", ") : "none configured"}`);
174
+ console.log(` linked ${config.linked.length ? config.linked.map((l) => l.repo).join(", ") : "none"}`);
175
+ if (config.workspace)
176
+ console.log(` workspace ${config.workspace}`);
177
+ }
178
+ /** repomem sync — export .repomem/ contents to stdout for piping/sharing. */
179
+ function cmdSync() {
180
+ const root = cwd();
181
+ if (!(0, file_store_js_1.isInitialized)(root)) {
182
+ console.error("✖ .repomem/ not found here. Run `repomem init` first.");
183
+ process.exitCode = 1;
184
+ return;
185
+ }
186
+ const config = (0, config_js_1.loadConfig)(root);
187
+ const out = [`# repomem export — ${config.project}`, ""];
188
+ for (const type of file_store_js_1.MEMORY_TYPES) {
189
+ const files = (0, file_store_js_1.listFiles)(type, root);
190
+ if (files.length === 0)
191
+ continue;
192
+ out.push(`## ${type}`, "");
193
+ for (const filename of files) {
194
+ out.push(`### ${type}/${filename}`, "");
195
+ out.push(((0, file_store_js_1.readFile)(type, filename, root) ?? "").trim(), "");
196
+ }
197
+ }
198
+ process.stdout.write(out.join("\n") + "\n");
199
+ }
200
+ /** Ensure the remote cache is gitignored so it never gets committed. */
201
+ function ensureCacheGitignore(root) {
202
+ const cacheDir = path.join((0, file_store_js_1.getRepomemRoot)(root), ".cache");
203
+ fs.mkdirSync(cacheDir, { recursive: true });
204
+ const gi = path.join(cacheDir, ".gitignore");
205
+ if (!fs.existsSync(gi)) {
206
+ fs.writeFileSync(gi, "# repomem remote cache — fetched copies, do not commit\n*\n", "utf8");
207
+ }
208
+ }
209
+ /** repomem pull — fetch remote linked repos' .repomem/ into the local cache. */
210
+ async function cmdPull() {
211
+ const root = cwd();
212
+ if (!(0, file_store_js_1.isInitialized)(root)) {
213
+ console.error("✖ .repomem/ not found here. Run `repomem init` first.");
214
+ process.exitCode = 1;
215
+ return;
216
+ }
217
+ const config = (0, config_js_1.loadConfig)(root);
218
+ const remotes = config.linked
219
+ .map((l) => (0, remote_js_1.parseRemote)(l.repo))
220
+ .filter((r) => r !== null);
221
+ if (remotes.length === 0) {
222
+ console.log("• No remote linked repos to pull.");
223
+ console.log(' Add one to repomem.config.json, e.g. { "repo": "github:owner/name" }');
224
+ return;
225
+ }
226
+ const token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
227
+ ensureCacheGitignore(root);
228
+ for (const r of remotes) {
229
+ const destRepomem = path.join((0, file_store_js_1.remoteCacheRoot)(root, r), file_store_js_1.REPOMEM_DIR);
230
+ try {
231
+ fs.mkdirSync(destRepomem, { recursive: true });
232
+ const count = await (0, remote_js_1.fetchRemoteRepomem)(r, destRepomem, token);
233
+ console.log(`✔ Pulled ${count} file(s) from ${r.owner}/${r.name}@${r.ref}`);
234
+ }
235
+ catch (err) {
236
+ console.error(`✖ ${r.owner}/${r.name}: ${err instanceof Error ? err.message : String(err)}`);
237
+ process.exitCode = 1;
238
+ }
239
+ }
240
+ console.log("\nRemote memory is now searchable — mem_search with linked=true.");
241
+ }
242
+ /** repomem import [file] — write a `repomem sync` bundle back into .repomem/. */
243
+ function cmdImport(fileArg) {
244
+ const root = cwd();
245
+ if (!(0, file_store_js_1.isInitialized)(root)) {
246
+ console.error("✖ .repomem/ not found here. Run `repomem init` first.");
247
+ process.exitCode = 1;
248
+ return;
249
+ }
250
+ let text;
251
+ if (fileArg) {
252
+ try {
253
+ text = fs.readFileSync(path.resolve(root, fileArg), "utf8");
254
+ }
255
+ catch {
256
+ console.error(`✖ Cannot read ${fileArg}`);
257
+ process.exitCode = 1;
258
+ return;
259
+ }
260
+ }
261
+ else {
262
+ try {
263
+ text = fs.readFileSync(0, "utf8"); // stdin
264
+ }
265
+ catch {
266
+ console.error("✖ Provide a file: `repomem import bundle.md`, or pipe via stdin.");
267
+ process.exitCode = 1;
268
+ return;
269
+ }
270
+ }
271
+ const written = (0, file_store_js_1.importBundle)(text, root);
272
+ if (written.length === 0) {
273
+ console.log("• Nothing to import — no recognised memory sections found.");
274
+ return;
275
+ }
276
+ (0, file_store_js_1.generateIndex)(root);
277
+ console.log(`✔ Imported ${written.length} file(s):`);
278
+ for (const f of written)
279
+ console.log(` ${f}`);
280
+ }
281
+ function cmdHelp() {
282
+ console.log(`repomem — git-native memory for AI coding agents
283
+
284
+ Usage:
285
+ repomem Start the MCP server (stdio) — used by agents
286
+ repomem init Scaffold .repomem/ and repomem.config.json
287
+ repomem setup <agent> Wire repomem into an agent
288
+ (${Object.keys(AGENTS).join(", ")})
289
+ repomem status Show memory counts and configured agents
290
+ repomem sync Export all memory to stdout
291
+ repomem import [file] Import a sync bundle (file or stdin) into .repomem/
292
+ repomem pull Fetch remote linked repos' memory from GitHub
293
+ repomem help Show this help`);
294
+ }
295
+ async function main() {
296
+ const [command, arg] = process.argv.slice(2);
297
+ switch (command) {
298
+ case undefined:
299
+ // No subcommand: behave as the MCP server (how agents invoke `npx repomem`).
300
+ await (await import("./index.js")).startServer();
301
+ return;
302
+ case "init":
303
+ cmdInit();
304
+ return;
305
+ case "setup":
306
+ cmdSetup(arg);
307
+ return;
308
+ case "status":
309
+ cmdStatus();
310
+ return;
311
+ case "sync":
312
+ cmdSync();
313
+ return;
314
+ case "pull":
315
+ await cmdPull();
316
+ return;
317
+ case "import":
318
+ cmdImport(arg);
319
+ return;
320
+ case "help":
321
+ case "--help":
322
+ case "-h":
323
+ cmdHelp();
324
+ return;
325
+ default:
326
+ console.error(`✖ Unknown command "${command}".\n`);
327
+ cmdHelp();
328
+ process.exitCode = 1;
329
+ }
330
+ }
331
+ main().catch((err) => {
332
+ console.error("repomem error:", err);
333
+ process.exit(1);
334
+ });
335
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uCAAyB;AACzB,2CAA6B;AAE7B,kDAK4B;AAC5B,yDAW+B;AAC/B,iDAA+E;AAQ/E,8EAA8E;AAC9E,gFAAgF;AAChF,MAAM,MAAM,GAA8B;IACxC,aAAa,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE;IAC1E,MAAM,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE;IACrE,MAAM,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE;IAC9E,YAAY,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE;IACpF,KAAK,EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE;CACtE,CAAC;AAEF,MAAM,WAAW,GAAG,KAAK,CAAC;AAC1B,MAAM,QAAQ,GAAG,CAAC,qBAAqB,CAAC,CAAC;AACzC,MAAM,SAAS,GAAG,EAAE,OAAO,EAAE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+ export interface LinkedRepo {
2
+ repo: string;
3
+ relation?: string;
4
+ }
5
+ export interface RepomemConfig {
6
+ project: string;
7
+ workspace?: string;
8
+ linked: LinkedRepo[];
9
+ }
10
+ export declare const CONFIG_FILENAME = "repomem.config.json";
11
+ /**
12
+ * Walk up from `start` looking for repomem.config.json or a .repomem/ dir.
13
+ * Returns the directory that contains them, or `start` if none found.
14
+ */
15
+ export declare function findProjectRoot(start?: string): string;
16
+ /**
17
+ * Load repomem.config.json from the project root. Falls back to a default
18
+ * config (project name derived from package.json or directory name) when the
19
+ * file is missing or malformed — never throws.
20
+ */
21
+ export declare function loadConfig(projectRoot?: string): RepomemConfig;
22
+ /** Derive a project name from package.json `name`, else the directory name. */
23
+ export declare function deriveProjectName(projectRoot: string): string;
24
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,UAAU,EAAE,CAAC;CACtB;AAED,eAAO,MAAM,eAAe,wBAAwB,CAAC;AAOrD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,GAAE,MAAsB,GAAG,MAAM,CAcrE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,WAAW,GAAE,MAA0B,GAAG,aAAa,CAajF;AAED,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAY7D"}