repomemory 0.1.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/LICENSE +21 -0
- package/README.md +227 -0
- package/dist/commands/analyze.d.ts +7 -0
- package/dist/commands/analyze.d.ts.map +1 -0
- package/dist/commands/analyze.js +360 -0
- package/dist/commands/analyze.js.map +1 -0
- package/dist/commands/init.d.ts +5 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +86 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/serve.d.ts +4 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +13 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/commands/setup.d.ts +4 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +134 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/sync.d.ts +5 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +77 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +109 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/ai-provider.d.ts +18 -0
- package/dist/lib/ai-provider.d.ts.map +1 -0
- package/dist/lib/ai-provider.js +164 -0
- package/dist/lib/ai-provider.js.map +1 -0
- package/dist/lib/config.d.ts +29 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +103 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/context-store.d.ts +31 -0
- package/dist/lib/context-store.d.ts.map +1 -0
- package/dist/lib/context-store.js +150 -0
- package/dist/lib/context-store.js.map +1 -0
- package/dist/lib/git.d.ts +29 -0
- package/dist/lib/git.d.ts.map +1 -0
- package/dist/lib/git.js +139 -0
- package/dist/lib/git.js.map +1 -0
- package/dist/lib/repo-scanner.d.ts +26 -0
- package/dist/lib/repo-scanner.d.ts.map +1 -0
- package/dist/lib/repo-scanner.js +213 -0
- package/dist/lib/repo-scanner.js.map +1 -0
- package/dist/lib/search.d.ts +21 -0
- package/dist/lib/search.d.ts.map +1 -0
- package/dist/lib/search.js +147 -0
- package/dist/lib/search.js.map +1 -0
- package/dist/mcp/server.d.ts +3 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +324 -0
- package/dist/mcp/server.js.map +1 -0
- package/package.json +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
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,227 @@
|
|
|
1
|
+
# repomemory
|
|
2
|
+
|
|
3
|
+
**Your repo remembers what every AI session learned.**
|
|
4
|
+
|
|
5
|
+
Persistent, structured memory for AI coding agents. Stop wasting the first 10 minutes of every session re-discovering your architecture.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npx repomemory init && npx repomemory analyze
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
That's it. Your repo now has a `.context/` directory with AI-generated knowledge that persists across sessions.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## The Problem
|
|
16
|
+
|
|
17
|
+
Every time you open a project with Claude Code, Cursor, Copilot, or any AI coding agent:
|
|
18
|
+
|
|
19
|
+
- It re-discovers your architecture from scratch
|
|
20
|
+
- It re-reads the same files to understand patterns
|
|
21
|
+
- It proposes changes that were already debated and rejected
|
|
22
|
+
- It re-introduces bugs that were already fixed
|
|
23
|
+
|
|
24
|
+
Your CLAUDE.md / .cursorrules helps, but it's a static file you manually maintain. It gets stale. It loads everything whether relevant or not.
|
|
25
|
+
|
|
26
|
+
## The Solution
|
|
27
|
+
|
|
28
|
+
`repomemory` creates a structured knowledge base that AI agents can search, read, and **write to** during sessions:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
.context/
|
|
32
|
+
āāā index.md ā Quick orientation (loaded every session)
|
|
33
|
+
āāā facts/
|
|
34
|
+
ā āāā architecture.md ā Services, how they connect, deploy targets
|
|
35
|
+
ā āāā database.md ā Schema overview, key tables, relationships
|
|
36
|
+
ā āāā deployment.md ā How to deploy, env vars, CI/CD
|
|
37
|
+
āāā decisions/
|
|
38
|
+
ā āāā why-drizzle.md ā "We chose Drizzle because X, not Prisma because Y"
|
|
39
|
+
ā āāā auth-strategy.md ā "JWT over sessions because Z"
|
|
40
|
+
āāā regressions/
|
|
41
|
+
ā āāā sql-join-bug.md ā "This broke before. Here's what happened."
|
|
42
|
+
ā āāā token-refresh.md ā "53-day cycle, don't touch without reading this"
|
|
43
|
+
āāā sessions/ ā AI session summaries (auto-populated)
|
|
44
|
+
āāā changelog/ ā Monthly git history syncs
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Facts** tell agents how things work. **Decisions** prevent re-debating. **Regressions** prevent re-breaking.
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
### 1. Install and Initialize
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npx repomemory init
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 2. Set Your API Key
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Pick one:
|
|
61
|
+
export ANTHROPIC_API_KEY=sk-ant-... # Claude (recommended)
|
|
62
|
+
export OPENAI_API_KEY=sk-... # GPT-4o
|
|
63
|
+
export GEMINI_API_KEY=... # Gemini
|
|
64
|
+
export GROK_API_KEY=... # Grok
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 3. Analyze Your Repo
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npx repomemory analyze
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This scans your entire codebase ā file structure, key configs, database schemas, git history ā and uses AI to generate structured knowledge files. Takes 2-5 minutes depending on repo size.
|
|
74
|
+
|
|
75
|
+
### 4. Connect to Your AI Tool
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Claude Code
|
|
79
|
+
npx repomemory setup claude
|
|
80
|
+
|
|
81
|
+
# Cursor
|
|
82
|
+
npx repomemory setup cursor
|
|
83
|
+
|
|
84
|
+
# GitHub Copilot
|
|
85
|
+
npx repomemory setup copilot
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 5. Commit to Git
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
git add .context/
|
|
92
|
+
git commit -m "Add repomemory knowledge base"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Your entire team now shares the knowledge.
|
|
96
|
+
|
|
97
|
+
## MCP Server
|
|
98
|
+
|
|
99
|
+
The real power is the MCP server, which gives AI agents tools to **search and write** context:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
npx repomemory serve
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Tools Exposed
|
|
106
|
+
|
|
107
|
+
| Tool | What It Does |
|
|
108
|
+
|------|-------------|
|
|
109
|
+
| `context_search` | Search the knowledge base by natural language query |
|
|
110
|
+
| `context_write` | Write new knowledge (facts, decisions, regressions, session notes) |
|
|
111
|
+
| `context_list` | Browse all entries by category |
|
|
112
|
+
| `context_read` | Read a specific context file |
|
|
113
|
+
|
|
114
|
+
When configured via `repomemory setup claude`, the MCP server auto-starts with Claude Code. Your agent can:
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
Agent: "Let me search for context about the authentication flow..."
|
|
118
|
+
ā context_search("authentication flow")
|
|
119
|
+
ā Returns: facts/auth.md, decisions/jwt-over-sessions.md
|
|
120
|
+
|
|
121
|
+
Agent: "I discovered a race condition in token refresh. Let me record this."
|
|
122
|
+
ā context_write(category="regressions", filename="token-refresh-race", content="...")
|
|
123
|
+
ā Persisted. Next session will find it.
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Configuration
|
|
127
|
+
|
|
128
|
+
Create `.repomemory.json` in your repo root:
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"provider": "anthropic",
|
|
133
|
+
"model": "claude-sonnet-4-5-20250929",
|
|
134
|
+
"contextDir": ".context",
|
|
135
|
+
"maxFilesForAnalysis": 80,
|
|
136
|
+
"maxGitCommits": 100,
|
|
137
|
+
"autoIndex": true,
|
|
138
|
+
"ignorePatterns": [],
|
|
139
|
+
"keyFilePatterns": []
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Supported Providers
|
|
144
|
+
|
|
145
|
+
| Provider | Models | Env Variable |
|
|
146
|
+
|----------|--------|-------------|
|
|
147
|
+
| `anthropic` | claude-sonnet-4-5-20250929, claude-opus-4-6 | `ANTHROPIC_API_KEY` |
|
|
148
|
+
| `openai` | gpt-4o, o3-mini | `OPENAI_API_KEY` |
|
|
149
|
+
| `gemini` | gemini-2.0-flash, gemini-2.5-pro | `GEMINI_API_KEY` |
|
|
150
|
+
| `grok` | grok-3, grok-3-mini | `GROK_API_KEY` |
|
|
151
|
+
|
|
152
|
+
## Commands
|
|
153
|
+
|
|
154
|
+
| Command | Description |
|
|
155
|
+
|---------|-------------|
|
|
156
|
+
| `repomemory init` | Scaffold `.context/` directory |
|
|
157
|
+
| `repomemory analyze` | AI-powered repo analysis (generates all context files) |
|
|
158
|
+
| `repomemory sync` | Sync recent git history to `changelog/` |
|
|
159
|
+
| `repomemory serve` | Start MCP server for AI agent integration |
|
|
160
|
+
| `repomemory setup <tool>` | Configure Claude Code, Cursor, or Copilot |
|
|
161
|
+
| `repomemory status` | Show current context state |
|
|
162
|
+
|
|
163
|
+
### Options
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Use a specific provider
|
|
167
|
+
repomemory analyze --provider openai --model gpt-4o
|
|
168
|
+
|
|
169
|
+
# Analyze a different directory
|
|
170
|
+
repomemory analyze --dir /path/to/repo
|
|
171
|
+
|
|
172
|
+
# Verbose output
|
|
173
|
+
repomemory analyze --verbose
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## How It Works
|
|
177
|
+
|
|
178
|
+
### Initial Analysis (`analyze`)
|
|
179
|
+
|
|
180
|
+
1. **Scans** your repo structure ā files, directories, languages, frameworks
|
|
181
|
+
2. **Reads** key files ā package.json, configs, schemas, READMEs, existing CLAUDE.md
|
|
182
|
+
3. **Mines** git history ā commits, contributors, change patterns, activity
|
|
183
|
+
4. **Sends** everything to your chosen AI model with a structured analysis prompt
|
|
184
|
+
5. **Writes** organized knowledge to `.context/` ā facts, decisions, regressions
|
|
185
|
+
6. **Indexes** all files for full-text search via the MCP server
|
|
186
|
+
|
|
187
|
+
### During Sessions (MCP Server)
|
|
188
|
+
|
|
189
|
+
- Agent searches for relevant context at task start
|
|
190
|
+
- Agent writes discoveries, decisions, and gotchas during work
|
|
191
|
+
- Knowledge accumulates session over session
|
|
192
|
+
- Next agent session has access to everything previous sessions learned
|
|
193
|
+
|
|
194
|
+
### Git Sync (`sync`)
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
repomemory sync
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Reads recent git commits and writes them to `changelog/YYYY-MM.md`. Run periodically or as a post-merge hook.
|
|
201
|
+
|
|
202
|
+
## Why Not Just Use CLAUDE.md?
|
|
203
|
+
|
|
204
|
+
| | CLAUDE.md | repomemory |
|
|
205
|
+
|--|-----------|-------------|
|
|
206
|
+
| **Maintenance** | Manual | AI-generated + agent-maintained |
|
|
207
|
+
| **Search** | Load everything | FTS5 search, return only relevant |
|
|
208
|
+
| **Cross-tool** | Claude Code only | Claude, Cursor, Copilot, any MCP client |
|
|
209
|
+
| **Team knowledge** | One person writes | Every AI session contributes |
|
|
210
|
+
| **Decisions** | Mixed in with instructions | Structured, searchable, prevents re-debating |
|
|
211
|
+
| **Regressions** | Not tracked | Explicit files preventing repeat bugs |
|
|
212
|
+
|
|
213
|
+
`repomemory` doesn't replace CLAUDE.md ā it complements it. Your CLAUDE.md stays for instructions and rules. `.context/` holds the knowledge that grows over time.
|
|
214
|
+
|
|
215
|
+
## Inspired By
|
|
216
|
+
|
|
217
|
+
- **[OpenClaw](https://github.com/openclaw/openclaw)** ā The memory architecture (tiers, temporal decay, hybrid search) inspired this project. OpenClaw remembers *you*. repomemory remembers *your codebase*.
|
|
218
|
+
- **[Aider](https://aider.chat/)** ā Repo maps and convention files showed the value of structured context.
|
|
219
|
+
- **Context Engineering** ā The emerging discipline of curating what AI models see for better outcomes.
|
|
220
|
+
|
|
221
|
+
## License
|
|
222
|
+
|
|
223
|
+
MIT
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
**Built for developers who are tired of AI agents forgetting everything between sessions.**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../src/commands/analyze.ts"],"names":[],"mappings":"AAyOA,wBAAsB,cAAc,CAAC,OAAO,EAAE;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,iBAiJA"}
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
import { loadConfig } from "../lib/config.js";
|
|
4
|
+
import { ContextStore } from "../lib/context-store.js";
|
|
5
|
+
import { SearchIndex } from "../lib/search.js";
|
|
6
|
+
import { scanRepo } from "../lib/repo-scanner.js";
|
|
7
|
+
import { getGitInfo, getRecentDiffs } from "../lib/git.js";
|
|
8
|
+
import { createProvider } from "../lib/ai-provider.js";
|
|
9
|
+
/**
|
|
10
|
+
* Robustly extracts a JSON object from an AI response that may contain
|
|
11
|
+
* markdown code fences, preamble text, or other wrapping.
|
|
12
|
+
*/
|
|
13
|
+
function extractJSON(raw) {
|
|
14
|
+
let text = raw.trim();
|
|
15
|
+
// Strategy 1: Strip outermost code fences (greedy to match last ```)
|
|
16
|
+
const fenceMatch = text.match(/^```(?:json)?\s*\n([\s\S]*)\n\s*```\s*$/);
|
|
17
|
+
if (fenceMatch) {
|
|
18
|
+
text = fenceMatch[1].trim();
|
|
19
|
+
}
|
|
20
|
+
// Strategy 2: If still wrapped in non-JSON text, find first { to last }
|
|
21
|
+
if (!text.startsWith("{")) {
|
|
22
|
+
const firstBrace = text.indexOf("{");
|
|
23
|
+
const lastBrace = text.lastIndexOf("}");
|
|
24
|
+
if (firstBrace !== -1 && lastBrace > firstBrace) {
|
|
25
|
+
text = text.slice(firstBrace, lastBrace + 1);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// Try parsing (with multiple repair strategies)
|
|
29
|
+
const attempts = [
|
|
30
|
+
() => text,
|
|
31
|
+
() => fixJsonNewlines(text),
|
|
32
|
+
() => repairTruncatedJSON(text),
|
|
33
|
+
() => repairTruncatedJSON(fixJsonNewlines(text)),
|
|
34
|
+
];
|
|
35
|
+
let lastError = null;
|
|
36
|
+
for (const attempt of attempts) {
|
|
37
|
+
try {
|
|
38
|
+
return JSON.parse(attempt());
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
lastError = e;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
throw lastError;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Fixes actual newlines inside JSON string values by replacing them with \n.
|
|
48
|
+
* Walks the string character by character, tracking whether we're inside a string.
|
|
49
|
+
*/
|
|
50
|
+
function fixJsonNewlines(json) {
|
|
51
|
+
const chars = [];
|
|
52
|
+
let inString = false;
|
|
53
|
+
let escaped = false;
|
|
54
|
+
for (let i = 0; i < json.length; i++) {
|
|
55
|
+
const ch = json[i];
|
|
56
|
+
if (escaped) {
|
|
57
|
+
chars.push(ch);
|
|
58
|
+
escaped = false;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (ch === "\\") {
|
|
62
|
+
chars.push(ch);
|
|
63
|
+
escaped = true;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (ch === '"') {
|
|
67
|
+
inString = !inString;
|
|
68
|
+
chars.push(ch);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (inString && ch === "\n") {
|
|
72
|
+
chars.push("\\n");
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (inString && ch === "\r") {
|
|
76
|
+
continue; // Skip carriage returns
|
|
77
|
+
}
|
|
78
|
+
if (inString && ch === "\t") {
|
|
79
|
+
chars.push("\\t");
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
chars.push(ch);
|
|
83
|
+
}
|
|
84
|
+
return chars.join("");
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Repairs a truncated JSON string by closing any open strings, arrays, and objects.
|
|
88
|
+
* Handles the common case where the AI response was cut off mid-output.
|
|
89
|
+
*/
|
|
90
|
+
function repairTruncatedJSON(json) {
|
|
91
|
+
let text = json.trim();
|
|
92
|
+
// If it ends cleanly, nothing to repair
|
|
93
|
+
if (text.endsWith("}")) {
|
|
94
|
+
try {
|
|
95
|
+
JSON.parse(text);
|
|
96
|
+
return text;
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
// Fall through to repair
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// Find what's open ā track nesting
|
|
103
|
+
let inString = false;
|
|
104
|
+
let escaped = false;
|
|
105
|
+
const stack = []; // Track open brackets
|
|
106
|
+
for (let i = 0; i < text.length; i++) {
|
|
107
|
+
const ch = text[i];
|
|
108
|
+
if (escaped) {
|
|
109
|
+
escaped = false;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (ch === "\\") {
|
|
113
|
+
escaped = true;
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if (ch === '"') {
|
|
117
|
+
inString = !inString;
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (inString)
|
|
121
|
+
continue;
|
|
122
|
+
if (ch === "{")
|
|
123
|
+
stack.push("}");
|
|
124
|
+
else if (ch === "[")
|
|
125
|
+
stack.push("]");
|
|
126
|
+
else if (ch === "}" || ch === "]")
|
|
127
|
+
stack.pop();
|
|
128
|
+
}
|
|
129
|
+
// Close open string if needed
|
|
130
|
+
if (inString) {
|
|
131
|
+
text += '"';
|
|
132
|
+
}
|
|
133
|
+
// Remove trailing comma
|
|
134
|
+
text = text.replace(/,\s*$/, "");
|
|
135
|
+
// Close all open brackets in reverse order
|
|
136
|
+
while (stack.length > 0) {
|
|
137
|
+
const closer = stack.pop();
|
|
138
|
+
// Remove any trailing incomplete entry before closing
|
|
139
|
+
if (closer === "]") {
|
|
140
|
+
// Remove trailing incomplete object in array
|
|
141
|
+
text = text.replace(/,\s*\{[^}]*$/, "");
|
|
142
|
+
text = text.replace(/,\s*"[^"]*$/, "");
|
|
143
|
+
}
|
|
144
|
+
text += closer;
|
|
145
|
+
}
|
|
146
|
+
return text;
|
|
147
|
+
}
|
|
148
|
+
const ANALYSIS_SYSTEM_PROMPT = `You are repomemory, an expert at analyzing codebases and creating structured knowledge bases for AI coding agents.
|
|
149
|
+
|
|
150
|
+
Your job is to analyze a repository and produce a comprehensive, well-organized knowledge base that helps AI agents (Claude Code, Cursor, Copilot, etc.) work effectively in this codebase from the very first message.
|
|
151
|
+
|
|
152
|
+
You must output valid JSON with this exact structure:
|
|
153
|
+
{
|
|
154
|
+
"index": "markdown string for index.md - the 30-60 line quick orientation",
|
|
155
|
+
"facts": [
|
|
156
|
+
{"filename": "descriptive-name.md", "content": "markdown content"}
|
|
157
|
+
],
|
|
158
|
+
"decisions": [
|
|
159
|
+
{"filename": "descriptive-name.md", "content": "markdown content"}
|
|
160
|
+
],
|
|
161
|
+
"regressions": [
|
|
162
|
+
{"filename": "descriptive-name.md", "content": "markdown content"}
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
Guidelines for each section:
|
|
167
|
+
|
|
168
|
+
INDEX.md (30-60 lines):
|
|
169
|
+
- What this project is (1-2 sentences)
|
|
170
|
+
- Tech stack and key frameworks
|
|
171
|
+
- Service architecture (if multiple services/packages)
|
|
172
|
+
- Key file locations (config, schema, entry points)
|
|
173
|
+
- Active development areas
|
|
174
|
+
- Critical warnings for agents (things that WILL bite you)
|
|
175
|
+
- How to run/test/deploy
|
|
176
|
+
|
|
177
|
+
FACTS (one file per architectural concern, 20-80 lines each):
|
|
178
|
+
- architecture.md ā Services, how they connect, deployment targets
|
|
179
|
+
- database.md ā Schema overview, key tables, relationships
|
|
180
|
+
- deployment.md ā How to deploy each service, env vars needed
|
|
181
|
+
- api-patterns.md ā How APIs are structured, auth, common patterns
|
|
182
|
+
- testing.md ā How to run tests, what frameworks, coverage
|
|
183
|
+
- Create additional files for any major subsystem (auth, billing, etc.)
|
|
184
|
+
|
|
185
|
+
DECISIONS (one file per significant decision):
|
|
186
|
+
- Format: What was decided, Why, Alternatives considered, Date (if inferrable)
|
|
187
|
+
- Only document decisions you can confidently infer from the code
|
|
188
|
+
- Examples: tech stack choices, architecture patterns, naming conventions
|
|
189
|
+
|
|
190
|
+
REGRESSIONS (one file per known issue pattern):
|
|
191
|
+
- Format: What happened, Root cause, How it was fixed, How to prevent it
|
|
192
|
+
- Look for: TODO/FIXME/HACK comments, recent bugfix commits, workaround patterns
|
|
193
|
+
- Only include if you have reasonable confidence
|
|
194
|
+
|
|
195
|
+
Rules:
|
|
196
|
+
- Be specific ā include file paths, function names, exact commands
|
|
197
|
+
- Be concise ā no filler, every line should inform a decision
|
|
198
|
+
- Use code blocks for commands, configs, and code references
|
|
199
|
+
- Link between files where relevant (e.g., "See decisions/tech-stack.md")
|
|
200
|
+
- If the repo has an existing CLAUDE.md or similar, extract and restructure its knowledge
|
|
201
|
+
- Focus on what an AI agent needs to be PRODUCTIVE, not just informed
|
|
202
|
+
|
|
203
|
+
CRITICAL: Output ONLY the JSON object. No markdown wrapping, no \`\`\`json fences, no text before or after. Start with { and end with }. All markdown formatting goes INSIDE the JSON string values (escaped). Do NOT use actual newlines in string values ā use \\n instead.`;
|
|
204
|
+
export async function analyzeCommand(options) {
|
|
205
|
+
const repoRoot = options.dir || process.cwd();
|
|
206
|
+
const config = loadConfig(repoRoot);
|
|
207
|
+
if (options.provider)
|
|
208
|
+
config.provider = options.provider;
|
|
209
|
+
if (options.model)
|
|
210
|
+
config.model = options.model;
|
|
211
|
+
const store = new ContextStore(repoRoot, config);
|
|
212
|
+
if (!store.exists()) {
|
|
213
|
+
console.log(chalk.yellow("ā No .context/ directory found. Running init first..."));
|
|
214
|
+
store.scaffold();
|
|
215
|
+
}
|
|
216
|
+
console.log(chalk.bold("\nš Scanning repository...\n"));
|
|
217
|
+
// Scan repo
|
|
218
|
+
const scan = scanRepo(repoRoot, config);
|
|
219
|
+
console.log(` ${chalk.cyan("Files:")} ${scan.stats.totalFiles}`);
|
|
220
|
+
console.log(` ${chalk.cyan("Directories:")} ${scan.stats.totalDirs}`);
|
|
221
|
+
console.log(` ${chalk.cyan("Languages:")} ${Object.entries(scan.stats.languages)
|
|
222
|
+
.sort((a, b) => b[1] - a[1])
|
|
223
|
+
.map(([lang, count]) => `${lang} (${count})`)
|
|
224
|
+
.join(", ")}`);
|
|
225
|
+
if (scan.stats.frameworks.length > 0) {
|
|
226
|
+
console.log(` ${chalk.cyan("Frameworks:")} ${scan.stats.frameworks.join(", ")}`);
|
|
227
|
+
}
|
|
228
|
+
console.log(` ${chalk.cyan("Key files found:")} ${scan.keyFiles.length}`);
|
|
229
|
+
// Get git info
|
|
230
|
+
console.log(chalk.bold("\nš Reading git history...\n"));
|
|
231
|
+
const git = getGitInfo(repoRoot, config.maxGitCommits);
|
|
232
|
+
if (git.isGitRepo) {
|
|
233
|
+
console.log(` ${chalk.cyan("Commits:")} ${git.totalCommits}`);
|
|
234
|
+
console.log(` ${chalk.cyan("Contributors:")} ${git.contributors.length}`);
|
|
235
|
+
console.log(` ${chalk.cyan("Activity:")} ${git.commitFrequency}`);
|
|
236
|
+
console.log(` ${chalk.cyan("Branch:")} ${git.currentBranch}`);
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
console.log(chalk.dim(" Not a git repository"));
|
|
240
|
+
}
|
|
241
|
+
// Get recent diffs for deeper analysis
|
|
242
|
+
const recentDiffs = git.isGitRepo ? getRecentDiffs(repoRoot, 20) : "";
|
|
243
|
+
// Build the analysis prompt
|
|
244
|
+
const userPrompt = buildAnalysisPrompt(scan, git, recentDiffs);
|
|
245
|
+
if (options.verbose) {
|
|
246
|
+
console.log(chalk.dim(`\n Prompt size: ~${Math.round(userPrompt.length / 4)} tokens`));
|
|
247
|
+
}
|
|
248
|
+
// Call AI
|
|
249
|
+
console.log(chalk.bold(`\nš¤ Analyzing with ${config.provider} (${config.model})...\n`));
|
|
250
|
+
const provider = await createProvider(config);
|
|
251
|
+
const startTime = Date.now();
|
|
252
|
+
const response = await provider.generate([
|
|
253
|
+
{ role: "system", content: ANALYSIS_SYSTEM_PROMPT },
|
|
254
|
+
{ role: "user", content: userPrompt },
|
|
255
|
+
], { maxTokens: 64000, temperature: 0.2 });
|
|
256
|
+
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
|
257
|
+
console.log(chalk.dim(` Completed in ${elapsed}s`));
|
|
258
|
+
if (response.tokensUsed) {
|
|
259
|
+
console.log(chalk.dim(` Tokens used: ${response.tokensUsed.toLocaleString()}`));
|
|
260
|
+
}
|
|
261
|
+
// Parse response
|
|
262
|
+
let analysis;
|
|
263
|
+
try {
|
|
264
|
+
analysis = extractJSON(response.content);
|
|
265
|
+
}
|
|
266
|
+
catch (e) {
|
|
267
|
+
// Save raw response for debugging
|
|
268
|
+
const debugPath = join(repoRoot, ".context", ".last-response.txt");
|
|
269
|
+
try {
|
|
270
|
+
const { writeFileSync: wf } = await import("fs");
|
|
271
|
+
wf(debugPath, response.content);
|
|
272
|
+
console.error(chalk.dim(` Raw response saved to ${debugPath}`));
|
|
273
|
+
}
|
|
274
|
+
catch { }
|
|
275
|
+
console.error(chalk.red(`\nā Failed to parse AI response as JSON: ${e.message}`));
|
|
276
|
+
if (options.verbose) {
|
|
277
|
+
console.error(chalk.dim(response.content.slice(0, 500)));
|
|
278
|
+
}
|
|
279
|
+
console.log(chalk.yellow("\nTip: Try running again, or try a different model with --model"));
|
|
280
|
+
process.exit(1);
|
|
281
|
+
}
|
|
282
|
+
// Write everything
|
|
283
|
+
console.log(chalk.bold("\nš Writing context files...\n"));
|
|
284
|
+
// Index
|
|
285
|
+
store.writeIndex(analysis.index);
|
|
286
|
+
console.log(` ${chalk.green("ā")} index.md`);
|
|
287
|
+
// Facts
|
|
288
|
+
for (const fact of analysis.facts || []) {
|
|
289
|
+
const path = store.writeEntry("facts", fact.filename, fact.content);
|
|
290
|
+
console.log(` ${chalk.green("ā")} ${path}`);
|
|
291
|
+
}
|
|
292
|
+
// Decisions
|
|
293
|
+
for (const decision of analysis.decisions || []) {
|
|
294
|
+
const path = store.writeEntry("decisions", decision.filename, decision.content);
|
|
295
|
+
console.log(` ${chalk.green("ā")} ${path}`);
|
|
296
|
+
}
|
|
297
|
+
// Regressions
|
|
298
|
+
for (const regression of analysis.regressions || []) {
|
|
299
|
+
const path = store.writeEntry("regressions", regression.filename, regression.content);
|
|
300
|
+
console.log(` ${chalk.green("ā")} ${path}`);
|
|
301
|
+
}
|
|
302
|
+
// Build search index
|
|
303
|
+
console.log(chalk.bold("\nš Building search index...\n"));
|
|
304
|
+
const searchIndex = new SearchIndex(store.path, store);
|
|
305
|
+
searchIndex.rebuild();
|
|
306
|
+
searchIndex.close();
|
|
307
|
+
const stats = store.getStats();
|
|
308
|
+
console.log(` ${chalk.green("ā")} Indexed ${stats.totalFiles} files across ${Object.keys(stats.categories).length} categories`);
|
|
309
|
+
// Summary
|
|
310
|
+
console.log(chalk.bold("\n⨠Analysis complete!\n"));
|
|
311
|
+
console.log(` ${chalk.cyan("Facts:")} ${(analysis.facts || []).length} files`);
|
|
312
|
+
console.log(` ${chalk.cyan("Decisions:")} ${(analysis.decisions || []).length} files`);
|
|
313
|
+
console.log(` ${chalk.cyan("Regressions:")} ${(analysis.regressions || []).length} files`);
|
|
314
|
+
console.log();
|
|
315
|
+
console.log(chalk.bold("Next:"));
|
|
316
|
+
console.log(` ${chalk.dim("ā¢")} Review .context/ files and edit as needed`);
|
|
317
|
+
console.log(` ${chalk.dim("ā¢")} Run ${chalk.cyan("repomemory serve")} to start the MCP server`);
|
|
318
|
+
console.log(` ${chalk.dim("ā¢")} Commit .context/ to git to share with your team`);
|
|
319
|
+
}
|
|
320
|
+
function buildAnalysisPrompt(scan, git, recentDiffs) {
|
|
321
|
+
const parts = [];
|
|
322
|
+
// Project structure
|
|
323
|
+
parts.push("## Repository Structure\n```");
|
|
324
|
+
parts.push(scan.tree.slice(0, 5000)); // Cap tree size
|
|
325
|
+
parts.push("```");
|
|
326
|
+
// Stats
|
|
327
|
+
parts.push("\n## Repository Stats");
|
|
328
|
+
parts.push(`- Files: ${scan.stats.totalFiles}`);
|
|
329
|
+
parts.push(`- Languages: ${JSON.stringify(scan.stats.languages)}`);
|
|
330
|
+
parts.push(`- Frameworks: ${scan.stats.frameworks.join(", ") || "none detected"}`);
|
|
331
|
+
parts.push(`- Package managers: ${scan.stats.packageManagers.join(", ") || "none detected"}`);
|
|
332
|
+
parts.push(`- Monorepo: ${scan.stats.hasMonorepo}`);
|
|
333
|
+
// Key files
|
|
334
|
+
parts.push("\n## Key Files\n");
|
|
335
|
+
for (const file of scan.keyFiles) {
|
|
336
|
+
parts.push(`### ${file.path}\n\`\`\`\n${file.content.slice(0, 8000)}\n\`\`\`\n`);
|
|
337
|
+
}
|
|
338
|
+
// Git info
|
|
339
|
+
if (git.isGitRepo) {
|
|
340
|
+
parts.push("\n## Git Information");
|
|
341
|
+
parts.push(`- Total commits: ${git.totalCommits}`);
|
|
342
|
+
parts.push(`- Activity: ${git.commitFrequency}`);
|
|
343
|
+
parts.push(`- Default branch: ${git.defaultBranch}`);
|
|
344
|
+
parts.push(`- Contributors: ${git.contributors.map((c) => `${c.name} (${c.commits})`).join(", ")}`);
|
|
345
|
+
if (git.recentCommits.length > 0) {
|
|
346
|
+
parts.push("\n### Recent Commits");
|
|
347
|
+
for (const commit of git.recentCommits.slice(0, 50)) {
|
|
348
|
+
parts.push(`- ${commit.shortHash} ${commit.message} (${commit.author}, ${commit.date.split("T")[0]}, +${commit.insertions}/-${commit.deletions})`);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
if (recentDiffs) {
|
|
352
|
+
parts.push("\n### Recent Change Summaries");
|
|
353
|
+
parts.push("```");
|
|
354
|
+
parts.push(recentDiffs.slice(0, 5000));
|
|
355
|
+
parts.push("```");
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return parts.join("\n");
|
|
359
|
+
}
|
|
360
|
+
//# sourceMappingURL=analyze.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze.js","sourceRoot":"","sources":["../../src/commands/analyze.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;GAGG;AACH,SAAS,WAAW,CAAC,GAAW;IAM9B,IAAI,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAEtB,qEAAqE;IACrE,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;IACzE,IAAI,UAAU,EAAE,CAAC;QACf,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9B,CAAC;IAED,wEAAwE;IACxE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACrC,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACxC,IAAI,UAAU,KAAK,CAAC,CAAC,IAAI,SAAS,GAAG,UAAU,EAAE,CAAC;YAChD,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,SAA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