@snevins/repo-mapper 1.1.0 → 1.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.
- package/README.md +22 -0
- package/dist/output.js +29 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -107,6 +107,28 @@ Clear cache with: `rm -rf .repomap.cache.v2`
|
|
|
107
107
|
4. **Rank** - Run PageRank to score files by importance
|
|
108
108
|
5. **Budget** - Binary search to fit top definitions within token limit
|
|
109
109
|
|
|
110
|
+
## Claude Code Plugin
|
|
111
|
+
|
|
112
|
+
repo-mapper includes a Claude Code plugin with commands and skills.
|
|
113
|
+
|
|
114
|
+
### Installation
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Add to your Claude Code plugins
|
|
118
|
+
claude plugins add /path/to/repo-mapper-ts
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Commands
|
|
122
|
+
|
|
123
|
+
| Command | Description |
|
|
124
|
+
|---------|-------------|
|
|
125
|
+
| `/status` | Check if repo-mapper is installed and up to date |
|
|
126
|
+
| `/update-codemap` | Generate or update CODEMAP.md with smart language detection |
|
|
127
|
+
|
|
128
|
+
### Skills
|
|
129
|
+
|
|
130
|
+
The `using-repo-mapper` skill provides guidance on effective repo-mapper usage patterns.
|
|
131
|
+
|
|
110
132
|
## License
|
|
111
133
|
|
|
112
134
|
MIT
|
package/dist/output.js
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
import { estimateTokens } from "./tokens.js";
|
|
2
|
+
/**
|
|
3
|
+
* Get files that a given file depends on (outgoing edges).
|
|
4
|
+
* Returns file paths sorted by edge weight descending.
|
|
5
|
+
*/
|
|
6
|
+
function getFileDependencies(file, graph) {
|
|
7
|
+
const edges = graph.edges.get(file);
|
|
8
|
+
if (!edges)
|
|
9
|
+
return [];
|
|
10
|
+
return [...edges.entries()]
|
|
11
|
+
.sort((a, b) => b[1] - a[1])
|
|
12
|
+
.map(([target]) => target);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get files that depend on a given file (incoming edges).
|
|
16
|
+
* Returns file paths sorted by edge weight descending.
|
|
17
|
+
*/
|
|
18
|
+
function getFileDependents(file, graph) {
|
|
19
|
+
const dependents = [];
|
|
20
|
+
for (const [from, toMap] of graph.edges) {
|
|
21
|
+
const weight = toMap.get(file);
|
|
22
|
+
if (weight !== undefined) {
|
|
23
|
+
dependents.push([from, weight]);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return dependents.sort((a, b) => b[1] - a[1]).map(([from]) => from);
|
|
27
|
+
}
|
|
2
28
|
/**
|
|
3
29
|
* Max definitions per unique name in output to prevent repetition.
|
|
4
30
|
*/
|
|
@@ -195,7 +221,9 @@ export function formatOutput(defs, graph, fileRanks, focusFiles, maxFilesPerModu
|
|
|
195
221
|
if (!fileDefs || fileDefs.length === 0)
|
|
196
222
|
continue;
|
|
197
223
|
const fileRank = fileRanks.get(file) ?? 0;
|
|
198
|
-
|
|
224
|
+
const deps = getFileDependents(file, graph);
|
|
225
|
+
const depsStr = deps.length > 0 ? ` (used-by: ${deps.slice(0, 3).join(", ")}${deps.length > 3 ? ", ..." : ""})` : "";
|
|
226
|
+
lines.push(`${file}: ${formatRankDisplay(fileRank, allRanks)}${depsStr}`);
|
|
199
227
|
// Sort definitions by line ascending
|
|
200
228
|
const sorted = [...fileDefs].sort((a, b) => a.tag.line - b.tag.line);
|
|
201
229
|
for (const def of sorted) {
|