repomemory 1.1.0 → 1.2.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.
- package/README.md +40 -14
- package/dist/commands/dashboard.d.ts.map +1 -1
- package/dist/commands/dashboard.js +35 -20
- package/dist/commands/dashboard.js.map +1 -1
- package/dist/commands/global.d.ts +11 -0
- package/dist/commands/global.d.ts.map +1 -0
- package/dist/commands/global.js +106 -0
- package/dist/commands/global.js.map +1 -0
- package/dist/commands/go.d.ts.map +1 -1
- package/dist/commands/go.js +24 -39
- package/dist/commands/go.js.map +1 -1
- package/dist/commands/hook.d.ts.map +1 -1
- package/dist/commands/hook.js +19 -4
- package/dist/commands/hook.js.map +1 -1
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +38 -34
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/serve.d.ts.map +1 -1
- package/dist/commands/serve.js +5 -2
- package/dist/commands/serve.js.map +1 -1
- package/dist/commands/wizard.d.ts.map +1 -1
- package/dist/commands/wizard.js +9 -3
- package/dist/commands/wizard.js.map +1 -1
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/config.d.ts +4 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +11 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/context-store.d.ts +5 -0
- package/dist/lib/context-store.d.ts.map +1 -1
- package/dist/lib/context-store.js +28 -2
- package/dist/lib/context-store.js.map +1 -1
- package/dist/lib/embeddings.js +27 -6
- package/dist/lib/embeddings.js.map +1 -1
- package/dist/lib/search.d.ts +0 -1
- package/dist/lib/search.d.ts.map +1 -1
- package/dist/lib/search.js +67 -19
- package/dist/lib/search.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +301 -95
- package/dist/mcp/server.js.map +1 -1
- package/package.json +1 -1
- package/server.json +3 -3
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
**Your codebase never forgets.**
|
|
6
6
|
|
|
7
7
|
AI agents lose context every session. repomemory fixes that.
|
|
8
|
-
One command analyzes your repo and creates a persistent knowledge base that any AI tool can search, read, and write to — with hybrid keyword + semantic search, auto-session capture,
|
|
8
|
+
One command analyzes your repo and creates a persistent knowledge base that any AI tool can search, read, and write to — with hybrid keyword + semantic search, auto-session capture, intelligent category routing, and **global developer context** that follows you across all repos.
|
|
9
9
|
|
|
10
10
|
[](https://www.npmjs.com/package/repomemory)
|
|
11
11
|
[](https://github.com/DanielGuru/repomemory/blob/main/LICENSE)
|
|
@@ -58,17 +58,18 @@ repomemory creates a structured, searchable knowledge base that AI agents can **
|
|
|
58
58
|
|
|
59
59
|
## Quick Start
|
|
60
60
|
|
|
61
|
-
### One-Command Setup
|
|
61
|
+
### One-Command Setup
|
|
62
62
|
|
|
63
63
|
```bash
|
|
64
64
|
npx repomemory go
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
This single command:
|
|
68
|
-
1.
|
|
69
|
-
2.
|
|
70
|
-
3.
|
|
71
|
-
4.
|
|
68
|
+
1. Sets up your global developer profile (`~/.repomemory/global/`) — your preferences follow you everywhere
|
|
69
|
+
2. Creates `.context/` if it doesn't exist
|
|
70
|
+
3. Configures Claude Code MCP server if installed
|
|
71
|
+
4. Runs AI analysis if context is empty
|
|
72
|
+
5. Prints CLAUDE.md instructions to copy-paste
|
|
72
73
|
|
|
73
74
|
### Interactive Setup
|
|
74
75
|
|
|
@@ -115,12 +116,12 @@ npx repomemory serve
|
|
|
115
116
|
|
|
116
117
|
| Tool | What It Does |
|
|
117
118
|
|------|-------------|
|
|
118
|
-
| `context_search` | Hybrid keyword + semantic search
|
|
119
|
-
| `context_auto_orient` | One-call
|
|
120
|
-
| `context_write` | Write entries with
|
|
121
|
-
| `context_read` | Read
|
|
122
|
-
| `context_list` | Browse
|
|
123
|
-
| `context_delete` | Remove stale
|
|
119
|
+
| `context_search` | Hybrid keyword + semantic search across repo + global. Intelligent category routing. Optional `scope` filter. |
|
|
120
|
+
| `context_auto_orient` | One-call orientation: index, global + repo preferences, recent sessions, recent changes |
|
|
121
|
+
| `context_write` | Write entries with scope routing (preferences→global). Auto-purge detection. Supersedes. |
|
|
122
|
+
| `context_read` | Read full content. Repo-first, falls back to global. |
|
|
123
|
+
| `context_list` | Browse entries from both stores with `[repo]`/`[global]` provenance tags. |
|
|
124
|
+
| `context_delete` | Remove stale knowledge. Tries repo first, falls back to global. |
|
|
124
125
|
|
|
125
126
|
When configured via `repomemory setup claude`, the MCP server auto-starts with Claude Code:
|
|
126
127
|
|
|
@@ -138,8 +139,23 @@ Agent: "I discovered a race condition in token refresh. Let me record this."
|
|
|
138
139
|
-> Persisted. Detects if it supersedes an existing entry.
|
|
139
140
|
```
|
|
140
141
|
|
|
142
|
+
### What's New in v1.2
|
|
143
|
+
|
|
144
|
+
**Global Developer Context** — Your coding preferences now follow you across all repos. A global context store at `~/.repomemory/global/` is auto-created on first run. The `preferences/` category defaults to global scope — write once, available everywhere. Repo-level preferences override global when needed.
|
|
145
|
+
|
|
146
|
+
**Scope Routing** — All MCP tools gain an optional `scope` parameter (`"repo"` or `"global"`). Defaults are automatic: preferences go global, everything else stays repo-local. Search merges results from both stores with repo-first dedup.
|
|
147
|
+
|
|
148
|
+
**CLI: `repomemory global`** — New subcommand to manage global context directly: `list`, `read`, `write`, `delete`, `export`, `import`. Export/import enables backup and machine migration.
|
|
149
|
+
|
|
150
|
+
**Unicode Filename Handling** — Accented characters are now transliterated (café → cafe) instead of stripped to hyphens. NFKD normalization preserves readable filenames.
|
|
151
|
+
|
|
152
|
+
**Search Improvements** — Category column is now indexed in LIKE fallback search, so searching for "regressions" within the regressions category actually works. Score normalization no longer compresses ranges artificially.
|
|
153
|
+
|
|
141
154
|
### What's New in v1.1
|
|
142
155
|
|
|
156
|
+
<details>
|
|
157
|
+
<summary>v1.1 changelog</summary>
|
|
158
|
+
|
|
143
159
|
**Hybrid Search** — Keyword search (FTS5) + optional vector/semantic search via OpenAI or Gemini embeddings. Falls back to keyword-only when no embedding API key is available. Configure with `embeddingProvider` in `.repomemory.json`.
|
|
144
160
|
|
|
145
161
|
**Intelligent Category Routing** — Search queries are auto-routed to the most relevant category. "Why did we use X" routes to `decisions/`. "Bug in login" routes to `regressions/`. "Coding style" routes to `preferences/`. If no results found, retries across all categories.
|
|
@@ -156,6 +172,8 @@ Agent: "I discovered a race condition in token refresh. Let me record this."
|
|
|
156
172
|
|
|
157
173
|
**Dashboard Improvements** — Edit entries inline, server-side FTS5 search, real-time polling, JSON export, proper markdown rendering.
|
|
158
174
|
|
|
175
|
+
</details>
|
|
176
|
+
|
|
159
177
|
### Web Dashboard
|
|
160
178
|
|
|
161
179
|
Browse, search, and edit your context files in a beautiful local web UI:
|
|
@@ -237,7 +255,7 @@ Shows coverage bars, freshness indicators, stale file warnings, and suggestions.
|
|
|
237
255
|
|
|
238
256
|
| Command | Description |
|
|
239
257
|
|---------|-------------|
|
|
240
|
-
| `repomemory go` | One-command setup — init + analyze + configure
|
|
258
|
+
| `repomemory go` | One-command setup — global profile + init + analyze + configure |
|
|
241
259
|
| `repomemory wizard` | Interactive guided setup (recommended for first use) |
|
|
242
260
|
| `repomemory init` | Scaffold `.context/` directory |
|
|
243
261
|
| `repomemory analyze` | AI-powered repo analysis |
|
|
@@ -249,6 +267,8 @@ Shows coverage bars, freshness indicators, stale file warnings, and suggestions.
|
|
|
249
267
|
| `repomemory status` | Show context coverage and freshness |
|
|
250
268
|
| `repomemory dashboard` | Open web dashboard |
|
|
251
269
|
| `repomemory hook install` | Auto-sync changelog on git commits |
|
|
270
|
+
| `repomemory global list` | List global developer context entries |
|
|
271
|
+
| `repomemory global export` | Export global context as JSON (for backup/migration) |
|
|
252
272
|
|
|
253
273
|
## Configuration
|
|
254
274
|
|
|
@@ -264,7 +284,9 @@ Create `.repomemory.json` in your repo root:
|
|
|
264
284
|
"ignorePatterns": [],
|
|
265
285
|
"keyFilePatterns": [],
|
|
266
286
|
"embeddingProvider": "openai",
|
|
267
|
-
"hybridAlpha": 0.5
|
|
287
|
+
"hybridAlpha": 0.5,
|
|
288
|
+
"enableGlobalContext": true,
|
|
289
|
+
"globalContextDir": "~/.repomemory/global"
|
|
268
290
|
}
|
|
269
291
|
```
|
|
270
292
|
|
|
@@ -276,6 +298,10 @@ Custom `ignorePatterns` and `keyFilePatterns` are **additive** — they extend t
|
|
|
276
298
|
- `embeddingApiKey`: Explicit API key for embeddings (falls back to env vars)
|
|
277
299
|
- `hybridAlpha`: Weight between keyword (1.0) and semantic (0.0) search. Default: 0.5
|
|
278
300
|
|
|
301
|
+
**Global context config**:
|
|
302
|
+
- `enableGlobalContext`: `true` (default) — set to `false` to disable global context and behave like v1.1
|
|
303
|
+
- `globalContextDir`: `"~/.repomemory/global"` (default) — path to global developer context
|
|
304
|
+
|
|
279
305
|
## How It Works
|
|
280
306
|
|
|
281
307
|
### Initial Analysis
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../src/commands/dashboard.ts"],"names":[],"mappings":"AAOA,wBAAsB,gBAAgB,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../src/commands/dashboard.ts"],"names":[],"mappings":"AAOA,wBAAsB,gBAAgB,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,iBA+J9E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import { createServer } from "http";
|
|
3
|
-
import {
|
|
3
|
+
import { execFile } from "child_process";
|
|
4
4
|
import { loadConfig } from "../lib/config.js";
|
|
5
5
|
import { ContextStore } from "../lib/context-store.js";
|
|
6
6
|
import { SearchIndex } from "../lib/search.js";
|
|
@@ -24,10 +24,11 @@ export async function dashboardCommand(options) {
|
|
|
24
24
|
}
|
|
25
25
|
const server = createServer((req, res) => {
|
|
26
26
|
const url = new URL(req.url || "/", `http://localhost:${port}`);
|
|
27
|
-
|
|
27
|
+
const allowedOrigin = `http://localhost:${port}`;
|
|
28
|
+
// CORS preflight — restrict to same origin
|
|
28
29
|
if (req.method === "OPTIONS") {
|
|
29
30
|
res.writeHead(204, {
|
|
30
|
-
"Access-Control-Allow-Origin":
|
|
31
|
+
"Access-Control-Allow-Origin": allowedOrigin,
|
|
31
32
|
"Access-Control-Allow-Methods": "GET, PUT, OPTIONS",
|
|
32
33
|
"Access-Control-Allow-Headers": "Content-Type",
|
|
33
34
|
});
|
|
@@ -45,7 +46,7 @@ export async function dashboardCommand(options) {
|
|
|
45
46
|
body += chunk;
|
|
46
47
|
if (body.length > MAX_BODY_SIZE) {
|
|
47
48
|
bodyTooLarge = true;
|
|
48
|
-
res.writeHead(413, { "Content-Type": "application/json", "Access-Control-Allow-Origin":
|
|
49
|
+
res.writeHead(413, { "Content-Type": "application/json", "Access-Control-Allow-Origin": allowedOrigin });
|
|
49
50
|
res.end(JSON.stringify({ error: "Request body too large (max 5MB)" }));
|
|
50
51
|
req.destroy();
|
|
51
52
|
}
|
|
@@ -56,7 +57,7 @@ export async function dashboardCommand(options) {
|
|
|
56
57
|
try {
|
|
57
58
|
const { category, filename, content } = JSON.parse(body);
|
|
58
59
|
if (!category || !filename || content === undefined || content === null) {
|
|
59
|
-
res.writeHead(400, { "Content-Type": "application/json", "Access-Control-Allow-Origin":
|
|
60
|
+
res.writeHead(400, { "Content-Type": "application/json", "Access-Control-Allow-Origin": allowedOrigin });
|
|
60
61
|
res.end(JSON.stringify({ error: "Missing required fields: category, filename, and content" }));
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
@@ -68,11 +69,11 @@ export async function dashboardCommand(options) {
|
|
|
68
69
|
if (entry)
|
|
69
70
|
await searchIndex.indexEntry(entry);
|
|
70
71
|
}
|
|
71
|
-
res.writeHead(200, { "Content-Type": "application/json", "Access-Control-Allow-Origin":
|
|
72
|
+
res.writeHead(200, { "Content-Type": "application/json", "Access-Control-Allow-Origin": allowedOrigin });
|
|
72
73
|
res.end(JSON.stringify({ success: true }));
|
|
73
74
|
}
|
|
74
75
|
catch (e) {
|
|
75
|
-
res.writeHead(400, { "Content-Type": "application/json", "Access-Control-Allow-Origin":
|
|
76
|
+
res.writeHead(400, { "Content-Type": "application/json", "Access-Control-Allow-Origin": allowedOrigin });
|
|
76
77
|
res.end(JSON.stringify({ error: e.message }));
|
|
77
78
|
}
|
|
78
79
|
});
|
|
@@ -80,7 +81,7 @@ export async function dashboardCommand(options) {
|
|
|
80
81
|
}
|
|
81
82
|
const category = url.searchParams.get("category") || undefined;
|
|
82
83
|
const entries = store.listEntries(category);
|
|
83
|
-
res.writeHead(200, { "Content-Type": "application/json", "Access-Control-Allow-Origin":
|
|
84
|
+
res.writeHead(200, { "Content-Type": "application/json", "Access-Control-Allow-Origin": allowedOrigin });
|
|
84
85
|
res.end(JSON.stringify(entries.map((e) => ({
|
|
85
86
|
category: e.category,
|
|
86
87
|
filename: e.filename,
|
|
@@ -96,7 +97,7 @@ export async function dashboardCommand(options) {
|
|
|
96
97
|
const query = url.searchParams.get("q") || "";
|
|
97
98
|
const category = url.searchParams.get("category") || undefined;
|
|
98
99
|
if (!query || query.length < 2) {
|
|
99
|
-
res.writeHead(200, { "Content-Type": "application/json", "Access-Control-Allow-Origin":
|
|
100
|
+
res.writeHead(200, { "Content-Type": "application/json", "Access-Control-Allow-Origin": allowedOrigin });
|
|
100
101
|
res.end(JSON.stringify([]));
|
|
101
102
|
return;
|
|
102
103
|
}
|
|
@@ -107,11 +108,11 @@ export async function dashboardCommand(options) {
|
|
|
107
108
|
await searchIndex.rebuild();
|
|
108
109
|
}
|
|
109
110
|
const results = await searchIndex.search(query, category, 20);
|
|
110
|
-
res.writeHead(200, { "Content-Type": "application/json", "Access-Control-Allow-Origin":
|
|
111
|
+
res.writeHead(200, { "Content-Type": "application/json", "Access-Control-Allow-Origin": allowedOrigin });
|
|
111
112
|
res.end(JSON.stringify(results));
|
|
112
113
|
}
|
|
113
114
|
catch {
|
|
114
|
-
res.writeHead(200, { "Content-Type": "application/json", "Access-Control-Allow-Origin":
|
|
115
|
+
res.writeHead(200, { "Content-Type": "application/json", "Access-Control-Allow-Origin": allowedOrigin });
|
|
115
116
|
res.end(JSON.stringify([]));
|
|
116
117
|
}
|
|
117
118
|
})();
|
|
@@ -119,13 +120,13 @@ export async function dashboardCommand(options) {
|
|
|
119
120
|
}
|
|
120
121
|
if (url.pathname === "/api/stats") {
|
|
121
122
|
const stats = store.getStats();
|
|
122
|
-
res.writeHead(200, { "Content-Type": "application/json", "Access-Control-Allow-Origin":
|
|
123
|
+
res.writeHead(200, { "Content-Type": "application/json", "Access-Control-Allow-Origin": allowedOrigin });
|
|
123
124
|
res.end(JSON.stringify(stats));
|
|
124
125
|
return;
|
|
125
126
|
}
|
|
126
127
|
if (url.pathname === "/api/index") {
|
|
127
128
|
const content = store.readIndex();
|
|
128
|
-
res.writeHead(200, { "Content-Type": "application/json", "Access-Control-Allow-Origin":
|
|
129
|
+
res.writeHead(200, { "Content-Type": "application/json", "Access-Control-Allow-Origin": allowedOrigin });
|
|
129
130
|
res.end(JSON.stringify({ content }));
|
|
130
131
|
return;
|
|
131
132
|
}
|
|
@@ -133,15 +134,20 @@ export async function dashboardCommand(options) {
|
|
|
133
134
|
res.writeHead(200, { "Content-Type": "text/html" });
|
|
134
135
|
res.end(buildDashboardHTML(config.provider, config.model));
|
|
135
136
|
});
|
|
136
|
-
server.listen(port, () => {
|
|
137
|
+
server.listen(port, "127.0.0.1", () => {
|
|
137
138
|
const url = `http://localhost:${port}`;
|
|
138
139
|
console.log(chalk.bold(`\n\ud83c\udf10 repomemory dashboard\n`));
|
|
139
140
|
console.log(` ${chalk.cyan("URL:")} ${chalk.underline(url)}`);
|
|
140
141
|
console.log(` ${chalk.cyan("Root:")} ${repoRoot}`);
|
|
141
142
|
console.log(chalk.dim(`\n Press Ctrl+C to stop.\n`));
|
|
142
|
-
// Try to open browser
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
// Try to open browser (use execFile to avoid shell injection)
|
|
144
|
+
if (process.platform === "win32") {
|
|
145
|
+
execFile("cmd", ["/c", "start", url], () => { });
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
const cmd = process.platform === "darwin" ? "open" : "xdg-open";
|
|
149
|
+
execFile(cmd, [url], () => { });
|
|
150
|
+
}
|
|
145
151
|
});
|
|
146
152
|
// Graceful shutdown
|
|
147
153
|
process.on("SIGTERM", () => { server.close(); process.exit(0); });
|
|
@@ -702,9 +708,9 @@ document.getElementById('searchInput').addEventListener('input', () => {
|
|
|
702
708
|
try {
|
|
703
709
|
const results = await fetch('/api/search?q=' + encodeURIComponent(q) + (currentCategory ? '&category=' + currentCategory : '')).then(r => r.json());
|
|
704
710
|
if (results.length > 0) {
|
|
705
|
-
const
|
|
711
|
+
const matchedKeys = new Set(results.map(r => r.category + '/' + r.filename));
|
|
706
712
|
const filtered = allEntries.filter(e =>
|
|
707
|
-
|
|
713
|
+
matchedKeys.has(e.category + '/' + e.filename) &&
|
|
708
714
|
(!currentCategory || e.category === currentCategory)
|
|
709
715
|
);
|
|
710
716
|
renderEntries(filtered.length > 0 ? filtered : getFilteredEntries());
|
|
@@ -732,10 +738,19 @@ function escapeHtml(s) {
|
|
|
732
738
|
return s.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
|
733
739
|
}
|
|
734
740
|
|
|
741
|
+
function sanitizeHtml(html) {
|
|
742
|
+
// Strip script tags and event handlers to prevent XSS
|
|
743
|
+
html = html.replace(/<script[^>]*>[\\s\\S]*?<\\/script>/gi, '');
|
|
744
|
+
html = html.replace(/\\s+on\\w+\\s*=\\s*["'][^"']*["']/gi, '');
|
|
745
|
+
html = html.replace(/\\s+on\\w+\\s*=\\s*[^\\s>]+/gi, '');
|
|
746
|
+
html = html.replace(/href\\s*=\\s*["']javascript:[^"']*["']/gi, 'href="#"');
|
|
747
|
+
return html;
|
|
748
|
+
}
|
|
749
|
+
|
|
735
750
|
function renderMarkdown(md) {
|
|
736
751
|
// Use marked.js if available (loaded from CDN), else fallback to regex
|
|
737
752
|
if (typeof marked !== 'undefined') {
|
|
738
|
-
try { return marked.parse(md); } catch {}
|
|
753
|
+
try { return sanitizeHtml(marked.parse(md)); } catch {}
|
|
739
754
|
}
|
|
740
755
|
return regexRenderMarkdown(md);
|
|
741
756
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../src/commands/dashboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAA6C,MAAM,MAAM,CAAC;AAC/E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../src/commands/dashboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAA6C,MAAM,MAAM,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAAwC;IAC7E,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAC9C,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,CAA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are function globalReadCommand(entry: string): Promise<void>;
|
|
5
|
+
export declare function globalWriteCommand(entry: string, options: {
|
|
6
|
+
content?: string;
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
export declare function globalDeleteCommand(entry: string): Promise<void>;
|
|
9
|
+
export declare function globalExportCommand(): Promise<void>;
|
|
10
|
+
export declare function globalImportCommand(): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=global.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../src/commands/global.ts"],"names":[],"mappings":"AAcA,wBAAsB,iBAAiB,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,iBAsBrE;AAED,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,MAAM,iBAoBpD;AAED,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,iBAkBpF;AAED,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,MAAM,iBAmBtD;AAED,wBAAsB,mBAAmB,kBAWxC;AAED,wBAAsB,mBAAmB,kBAiBxC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { ContextStore } from "../lib/context-store.js";
|
|
3
|
+
import { DEFAULT_CONFIG, resolveGlobalDir } from "../lib/config.js";
|
|
4
|
+
function getGlobalStore() {
|
|
5
|
+
const globalDir = resolveGlobalDir(DEFAULT_CONFIG);
|
|
6
|
+
const store = ContextStore.forAbsolutePath(globalDir);
|
|
7
|
+
if (!store.exists()) {
|
|
8
|
+
store.scaffold();
|
|
9
|
+
console.log(chalk.dim(` Created global context at ${globalDir}`));
|
|
10
|
+
}
|
|
11
|
+
return store;
|
|
12
|
+
}
|
|
13
|
+
export async function globalListCommand(options) {
|
|
14
|
+
const store = getGlobalStore();
|
|
15
|
+
const entries = store.listEntries(options.category);
|
|
16
|
+
if (entries.length === 0) {
|
|
17
|
+
console.log(chalk.dim(" No global context entries."));
|
|
18
|
+
console.log(chalk.dim(" AI agents will populate this as they learn your preferences."));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const grouped = {};
|
|
22
|
+
for (const e of entries) {
|
|
23
|
+
if (!grouped[e.category])
|
|
24
|
+
grouped[e.category] = [];
|
|
25
|
+
grouped[e.category].push(e);
|
|
26
|
+
}
|
|
27
|
+
for (const [cat, catEntries] of Object.entries(grouped)) {
|
|
28
|
+
console.log(chalk.bold(`${cat}/`) + chalk.dim(` (${catEntries.length})`));
|
|
29
|
+
for (const e of catEntries) {
|
|
30
|
+
console.log(` ${e.filename} ${chalk.dim("—")} ${e.title}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export async function globalReadCommand(entry) {
|
|
35
|
+
const store = getGlobalStore();
|
|
36
|
+
const parts = entry.split("/");
|
|
37
|
+
if (parts.length !== 2) {
|
|
38
|
+
console.error(chalk.red(" Usage: repomemory global read <category/filename>"));
|
|
39
|
+
console.error(chalk.dim(" Example: repomemory global read preferences/coding-style"));
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
const [category, filename] = parts;
|
|
43
|
+
const fname = filename.endsWith(".md") ? filename : filename + ".md";
|
|
44
|
+
const content = store.readEntry(category, fname);
|
|
45
|
+
if (!content) {
|
|
46
|
+
console.error(chalk.red(` Not found: ${category}/${fname}`));
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
console.log(content);
|
|
50
|
+
}
|
|
51
|
+
export async function globalWriteCommand(entry, options) {
|
|
52
|
+
const store = getGlobalStore();
|
|
53
|
+
const parts = entry.split("/");
|
|
54
|
+
if (parts.length !== 2) {
|
|
55
|
+
console.error(chalk.red(" Usage: repomemory global write <category/filename> --content \"...\""));
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
const [category, filename] = parts;
|
|
59
|
+
if (!options.content) {
|
|
60
|
+
console.error(chalk.red(" --content is required"));
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
const relativePath = store.writeEntry(category, filename, options.content);
|
|
64
|
+
console.log(chalk.green(` \u2713 Written to ${relativePath}`));
|
|
65
|
+
}
|
|
66
|
+
export async function globalDeleteCommand(entry) {
|
|
67
|
+
const store = getGlobalStore();
|
|
68
|
+
const parts = entry.split("/");
|
|
69
|
+
if (parts.length !== 2) {
|
|
70
|
+
console.error(chalk.red(" Usage: repomemory global delete <category/filename>"));
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
const [category, filename] = parts;
|
|
74
|
+
const fname = filename.endsWith(".md") ? filename : filename + ".md";
|
|
75
|
+
const deleted = store.deleteEntry(category, fname);
|
|
76
|
+
if (!deleted) {
|
|
77
|
+
console.error(chalk.red(` Not found: ${category}/${fname}`));
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
console.log(chalk.green(` \u2713 Deleted ${category}/${fname}`));
|
|
81
|
+
}
|
|
82
|
+
export async function globalExportCommand() {
|
|
83
|
+
const store = getGlobalStore();
|
|
84
|
+
const entries = store.listEntries();
|
|
85
|
+
const exported = entries.map((e) => ({
|
|
86
|
+
category: e.category,
|
|
87
|
+
filename: e.filename,
|
|
88
|
+
content: e.content,
|
|
89
|
+
}));
|
|
90
|
+
console.log(JSON.stringify(exported, null, 2));
|
|
91
|
+
}
|
|
92
|
+
export async function globalImportCommand() {
|
|
93
|
+
const store = getGlobalStore();
|
|
94
|
+
let input = "";
|
|
95
|
+
for await (const chunk of process.stdin) {
|
|
96
|
+
input += chunk;
|
|
97
|
+
}
|
|
98
|
+
const entries = JSON.parse(input);
|
|
99
|
+
let count = 0;
|
|
100
|
+
for (const entry of entries) {
|
|
101
|
+
store.writeEntry(entry.category, entry.filename, entry.content);
|
|
102
|
+
count++;
|
|
103
|
+
}
|
|
104
|
+
console.log(chalk.green(` \u2713 Imported ${count} entries`));
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=global.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global.js","sourceRoot":"","sources":["../../src/commands/global.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpE,SAAS,cAAc;IACrB,MAAM,SAAS,GAAG,gBAAgB,CAAC,cAAc,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,YAAY,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IACtD,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;QACpB,KAAK,CAAC,QAAQ,EAAE,CAAC;QACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,+BAA+B,SAAS,EAAE,CAAC,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAA8B;IACpE,MAAM,KAAK,GAAG,cAAc,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEpD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC,CAAC;QACvD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,gEAAgE,CAAC,CAAC,CAAC;QACzF,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAmC,EAAE,CAAC;IACnD,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC;Y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,CAAC,CAAC,OAAO;KACnB,CAAC,CAAC,CAAC;IAEJ,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACvC,MAAM,KAAK,GAAG,cAAc,EAAE,CAAC;IAE/B,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QACxC,KAAK,IAAI,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAmE,CAAC;IACpG,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAChE,KAAK,EAAE,CAAC;IACV,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,qBAAqB,KAAK,UAAU,CAAC,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"go.d.ts","sourceRoot":"","sources":["../../src/commands/go.ts"],"names":[],"mappings":"AAWA,wBAAsB,SAAS,CAAC,OAAO,EAAE;IACvC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,
|
|
1
|
+
{"version":3,"file":"go.d.ts","sourceRoot":"","sources":["../../src/commands/go.ts"],"names":[],"mappings":"AAWA,wBAAsB,SAAS,CAAC,OAAO,EAAE;IACvC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,iBA6IA"}
|
package/dist/commands/go.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { existsSync, readFileSync
|
|
1
|
+
import { existsSync, readFileSync } from "fs";
|
|
2
2
|
import { join } from "path";
|
|
3
3
|
import chalk from "chalk";
|
|
4
|
-
import { loadConfig,
|
|
4
|
+
import { loadConfig, resolveGlobalDir } from "../lib/config.js";
|
|
5
5
|
import { ContextStore } from "../lib/context-store.js";
|
|
6
6
|
import { validateApiKey } from "../lib/ai-provider.js";
|
|
7
|
-
import { CLAUDE_MD_BLOCK } from "./init.js";
|
|
7
|
+
import { CLAUDE_MD_BLOCK, STARTER_INDEX, writeDefaultConfigFile } from "./init.js";
|
|
8
8
|
import { analyzeCommand } from "./analyze.js";
|
|
9
9
|
import { setupCommand } from "./setup.js";
|
|
10
10
|
export async function goCommand(options) {
|
|
@@ -20,49 +20,34 @@ export async function goCommand(options) {
|
|
|
20
20
|
}
|
|
21
21
|
const store = new ContextStore(repoRoot, config);
|
|
22
22
|
const steps = [];
|
|
23
|
-
let totalSteps =
|
|
23
|
+
let totalSteps = 5;
|
|
24
24
|
let currentStep = 0;
|
|
25
25
|
console.log(chalk.bold("\nrepomemory go \u2014 one-command setup\n"));
|
|
26
|
+
// Step 0: Ensure global context exists
|
|
27
|
+
currentStep++;
|
|
28
|
+
if (config.enableGlobalContext) {
|
|
29
|
+
const globalDir = resolveGlobalDir(config);
|
|
30
|
+
const globalStore = ContextStore.forAbsolutePath(globalDir);
|
|
31
|
+
if (!globalStore.exists()) {
|
|
32
|
+
console.log(chalk.cyan(`${currentStep}/${totalSteps}`) + " Setting up global developer profile...");
|
|
33
|
+
globalStore.scaffold();
|
|
34
|
+
steps.push(`Created ${globalDir} for developer preferences`);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const globalPrefs = globalStore.listEntries("preferences");
|
|
38
|
+
console.log(chalk.dim(`${currentStep}/${totalSteps} Global profile loaded (${globalPrefs.length} preference${globalPrefs.length !== 1 ? "s" : ""}).`));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
console.log(chalk.dim(`${currentStep}/${totalSteps} Global context disabled.`));
|
|
43
|
+
}
|
|
26
44
|
// Step 1: Create .context/ if missing
|
|
27
45
|
currentStep++;
|
|
28
46
|
if (!store.exists()) {
|
|
29
47
|
console.log(chalk.cyan(`${currentStep}/${totalSteps}`) + " Initializing .context/ directory...");
|
|
30
48
|
store.scaffold();
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
> Auto-generated by [repomemory](https://github.com/DanielGuru/repomemory). Run \`repomemory analyze\` to populate.
|
|
35
|
-
|
|
36
|
-
## Quick Orient
|
|
37
|
-
*Run \`repomemory analyze\` to generate project-specific orientation.*
|
|
38
|
-
|
|
39
|
-
## Context Files
|
|
40
|
-
- \`facts/\` \u2014 Architecture, patterns, integrations
|
|
41
|
-
- \`decisions/\` \u2014 Why things are this way (prevents re-debating)
|
|
42
|
-
- \`regressions/\` \u2014 Known gotchas, things that broke before
|
|
43
|
-
- \`sessions/\` \u2014 Compressed session summaries
|
|
44
|
-
- \`changelog/\` \u2014 Recent changes by month
|
|
45
|
-
- \`preferences/\` \u2014 Coding style, preferred patterns, tool configs
|
|
46
|
-
|
|
47
|
-
## For AI Agents
|
|
48
|
-
Search this directory for task-relevant context before starting work.
|
|
49
|
-
Write new learnings using the \`context_write\` MCP tool during your session.
|
|
50
|
-
`);
|
|
51
|
-
// Write config file
|
|
52
|
-
const configPath = join(repoRoot, ".repomemory.json");
|
|
53
|
-
if (!existsSync(configPath)) {
|
|
54
|
-
const configToWrite = {
|
|
55
|
-
provider: config.provider,
|
|
56
|
-
model: config.model,
|
|
57
|
-
contextDir: DEFAULT_CONFIG.contextDir,
|
|
58
|
-
maxFilesForAnalysis: DEFAULT_CONFIG.maxFilesForAnalysis,
|
|
59
|
-
maxGitCommits: DEFAULT_CONFIG.maxGitCommits,
|
|
60
|
-
autoIndex: DEFAULT_CONFIG.autoIndex,
|
|
61
|
-
ignorePatterns: [],
|
|
62
|
-
keyFilePatterns: [],
|
|
63
|
-
};
|
|
64
|
-
writeFileSync(configPath, JSON.stringify(configToWrite, null, 2) + "\n");
|
|
65
|
-
}
|
|
49
|
+
store.writeIndex(STARTER_INDEX);
|
|
50
|
+
writeDefaultConfigFile(repoRoot, config.provider, config.model);
|
|
66
51
|
steps.push("Initialized .context/ directory");
|
|
67
52
|
}
|
|
68
53
|
else {
|
package/dist/commands/go.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"go.js","sourceRoot":"","sources":["../../src/commands/go.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"go.js","sourceRoot":"","sources":["../../src/commands/go.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAI/B;IACC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAC9C,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ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C,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,iGAAiG,CAAC,CAAC,CAAC;IAC5H,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,2FAA2F,CAAC,CAAC,CAAC;IACpH,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../src/commands/hook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../src/commands/hook.ts"],"names":[],"mappings":"AAgBA,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,iBAc1B"}
|
package/dist/commands/hook.js
CHANGED
|
@@ -2,10 +2,14 @@ import chalk from "chalk";
|
|
|
2
2
|
import { existsSync, mkdirSync, writeFileSync, chmodSync, readFileSync, unlinkSync } from "fs";
|
|
3
3
|
import { join } from "path";
|
|
4
4
|
import { execFileSync } from "child_process";
|
|
5
|
+
const HOOK_MARKER_START = "# >>> repomemory start >>>";
|
|
6
|
+
const HOOK_MARKER_END = "# <<< repomemory end <<<";
|
|
5
7
|
const HOOK_CONTENT = `#!/bin/sh
|
|
8
|
+
${HOOK_MARKER_START}
|
|
6
9
|
# repomemory: auto-sync git history after commits
|
|
7
10
|
# Installed by: repomemory hook install
|
|
8
11
|
npx -y repomemory sync --dir "$(git rev-parse --show-toplevel)" 2>/dev/null &
|
|
12
|
+
${HOOK_MARKER_END}
|
|
9
13
|
`;
|
|
10
14
|
export async function hookCommand(action, options) {
|
|
11
15
|
const repoRoot = options.dir || process.cwd();
|
|
@@ -74,10 +78,21 @@ function uninstallHook(repoRoot) {
|
|
|
74
78
|
console.log(chalk.dim(" post-commit hook does not contain repomemory. Nothing to uninstall."));
|
|
75
79
|
return;
|
|
76
80
|
}
|
|
77
|
-
//
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
const
|
|
81
|
+
// Prefer marker-based removal (new installs), fall back to line-matching (legacy)
|
|
82
|
+
let remaining;
|
|
83
|
+
const startIdx = existing.indexOf(HOOK_MARKER_START);
|
|
84
|
+
const endIdx = existing.indexOf(HOOK_MARKER_END);
|
|
85
|
+
if (startIdx !== -1 && endIdx !== -1) {
|
|
86
|
+
const before = existing.slice(0, startIdx).trimEnd();
|
|
87
|
+
const after = existing.slice(endIdx + HOOK_MARKER_END.length).trimStart();
|
|
88
|
+
remaining = (before + (after ? "\n" + after : "")).trim();
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
// Legacy: remove individual repomemory lines
|
|
92
|
+
const lines = existing.split("\n");
|
|
93
|
+
const filtered = lines.filter((line) => !line.includes("repomemory") || line.startsWith("#!"));
|
|
94
|
+
remaining = filtered.join("\n").trim();
|
|
95
|
+
}
|
|
81
96
|
if (remaining === "#!/bin/sh" || remaining === "") {
|
|
82
97
|
// Hook is now empty — remove it
|
|
83
98
|
unlinkSync(hookPath);
|