@danielsimonjr/repo-tools 1.1.0 → 2.0.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/CHANGELOG.md CHANGED
@@ -6,6 +6,238 @@ All notable changes to this project are recorded in this file. The format follow
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.0.0] - 2026-09-26
10
+
11
+ The unified engine. `repo-tools map` replaces the Python `repo_map.py` and depgraph 1.x with one
12
+ engine for TypeScript/JavaScript, Python, C# and Rust. On 11 public repositories, its four core
13
+ files are identical to the Python tool, apart from the deliberate differences that the parity
14
+ record lists. `repo-tools depgraph` stays as a deprecated alias through 2.x. The 1.x scan-scope
15
+ flags have no effect: `map` exits 1 on them, and the alias gives a warning.
16
+
17
+ ### Known differences
18
+
19
+ - `map` makes no graph edge for a dynamic `import()`, as the Python tool does. depgraph 1.x
20
+ made one. So a cycle that closes only through `import()` is not a cycle in 2.0.0. On
21
+ memoryjs, one type-only cyclic component has 3 files, not 7. Test coverage still counts a
22
+ literal `import()` in a test file as a load.
23
+
24
+ ### Added
25
+
26
+ - `repo-tools map` (design decision D8): the command of the 2.0.0 engine. It writes each report
27
+ of the engine into the output folder, for TypeScript/JavaScript, Python, C# and Rust.
28
+ `repo-tools depgraph` is now its deprecated alias through 2.x, and prints one deprecation line.
29
+ The 1.x scan-scope flags (`--src`, `--tests`, `--exclude`, `--also-exclude`, `--all`/`-a`,
30
+ `--reachable-only`, `--include-tests`/`-t`) have no effect in 2.0.0. `map` exits 1 on them,
31
+ and the alias gives a warning and continues. The config section `map` is the new name of
32
+ `depgraph`, and a file with both sections exits 1.
33
+ - `map` (design decision D9): the duplicate allowlist and baseline and the coverage policy
34
+ default to `docs/architecture/`, never to the output folder. A root-relative `--out=../x`
35
+ writes outside the root.
36
+ - `map` gates: `--strict-orphans`, `--strict-census`, `--check-census`, `--check-duplicates`,
37
+ `--no-regen` and `--write-duplicate-baseline`, and the `preflight` and `report` hooks of the
38
+ extensions. `--strict-census` compares the census with a walk of the root. It finds a source
39
+ file on disk that git does not track. The duplicate gate works for TypeScript only, and says
40
+ so for another language. The `report` hook receives the core `dependency-graph.json`.
41
+ - `map --api-surface` (design decision D5): TypeScript keeps the 1.x report, and the
42
+ mini-repo report is byte-identical to the 1.x golden. Python and Rust list the surface names
43
+ of the entry file. C# exits 1 with the reason.
44
+ - Goldens for `map` (`tests/golden/map`, written by `scripts/update-map-goldens.ts`). The smoke
45
+ test (design 13.3) runs `map`.
46
+ - README and `docs/design.md` describe the 2.0.0 engine. The README gives `map`, the
47
+ `depgraph` alias, the report list of `map` and new query examples from the mono-repo fixture.
48
+ `docs/design.md` has a new section 14, "The 2.0.0 engine". Both documents in `docs/` start
49
+ with the `repo-map:no-verification` marker and give the reason: neither one makes a claim
50
+ about the graph of this repository.
51
+ - `docs/parity-2.0.0.md`: the parity record of the 2.0.0 engine on public repositories. On side
52
+ 1, the four core files are identical to the Python tool on 11 repositories, apart from the
53
+ two deliberate workspace differences on Mathts. A control shows that these two differences
54
+ cause all of the Mathts differences. Side 2 compares each extra with depgraph 1.x on
55
+ memoryjs, Mathts and universal-physics-tensor, and gives a verdict for each difference.
56
+ - `repo-tools query` reads the core graph of `map` (design decision D8), and refuses a 1.x graph.
57
+ `dependents`, `symbol-users` and `cycles` have the meaning of the Python tool. They read each
58
+ area of the graph, and a path that is not a file of the graph exits 1. `symbol-users` lists
59
+ files. `cycles` lists the simple cycles, and `cycles --components` lists the runtime and
60
+ type-only components. `is-public` reads `package-export-surfaces.json` only when it runs. The
61
+ browser-safety commands serve TypeScript/JavaScript only, and exit 1 with the reason for
62
+ another language. They now follow the workspace imports too, so they find a `node:` file
63
+ that another package reaches through an import of its package name.
64
+
65
+ - 2.0.0 engine, step 1: `src/map/discovery.ts` ports `repo_map/discovery.py` from the
66
+ architecture-docs skill. It holds the language detection, the file census and the area and
67
+ disposition rules. It refuses a repository in an unsupported language. The census comes from
68
+ `git ls-files`, or from a pruned walk. The 30 tests of its four test files are ported. Four
69
+ repositories give the same result in the port and in the Python tool: memoryjs, Mathts,
70
+ universal-physics-tensor and repo-tools. For all 3,717 files, the language, path, area,
71
+ disposition and line count agree. The file order is code-unit order on every operating system.
72
+ - 2.0.0 engine, step 2: the TypeScript reader (`src/map/parsing.ts`) and the lazy grammar loader
73
+ (`src/map/grammars.ts`), on tree-sitter-typescript 0.23.2. The 18 tests of `test_parsing.py` are
74
+ ported; a synthetic barrel file replaces the source test's absolute path. On 3,719 files of four
75
+ repositories, the port gives the same imports, exports, kinds and default export as the Python
76
+ reader, file by file.
77
+ - 2.0.0 engine, step 3: the C# and Rust readers (`parseCs`, `parseRs`), regex readers ported
78
+ with their exact behavior. Python's line-start anchor and `.` get exact translations. The 22
79
+ reader tests of `test_parsing_csharp.py` and `test_rust.py` are ported.
80
+ - 2.0.0 engine, step 4: the Python reader (`parsePy`) on tree-sitter-python 0.25.0, in place of
81
+ CPython's `ast`. The import order is the order of `ast.walk` (ast depth, then source position).
82
+ A module that does not parse raises `SyntaxError`. The 9 tests of `test_parsing_python.py` are
83
+ ported; 8 new tests pin the import order and the export forms against CPython's output. The
84
+ Python, C# and Rust readers match the Python tool file by file on 726 files. The files come
85
+ from 7 public repositories: PITS-MRAS, auto-memory, fermat-mcp and memvid (Python), IronClaw
86
+ (Rust), ui-mcp and Windows-mcp (C#).
87
+ - 2.0.0 engine, step 5: the resolvers (`src/map/resolvers.ts`) for TypeScript, Python, C# and
88
+ Rust, with Python's `posixpath` rules in `src/py.ts`. The Python standard-library list is the
89
+ `sys.stdlib_module_names` of CPython 3.13.15, as generated data. The 35 resolver tests of four
90
+ test files are ported.
91
+ - Tests: `tests/unit/node-compat.test.ts` also fails when `src/` uses the `Bun` global or a
92
+ `bun:` module, because `npx` runs the Node bundle. It found `Bun.spawnSync` in the map
93
+ discovery; the git file list now comes from `node:child_process`.
94
+ - 2.0.0 engine, step 6: the graph (`src/map/graph.ts`) and its schema (`src/map/schema.ts`).
95
+ It holds the classify-before-resolve buckets, barrel expansion, entry-point roots for four
96
+ languages, thin launchers, reachability and simple-cycle enumeration. The 29 tests of
97
+ `test_schema.py` and `test_graph.py` are ported. On 11 repositories and 4,456 files, the port
98
+ and the Python tool give the same dispositions, ordered edges, buckets, roots and warnings.
99
+ The empty-repo warning names the root, not its absolute path (output rule R4).
100
+ `pyproject.toml` is read with `smol-toml` 1.9.0, bundled and pinned.
101
+ - 2.0.0 engine: the end-to-end graph tests of C#, Python and Rust are ported (18 tests, from
102
+ `test_graph_csharp.py`, `test_python_repo_end_to_end.py` and `test_rust.py`).
103
+ - 2.0.0 engine, step 7: the four core artifacts (`src/map/artifacts.ts`). They are
104
+ `dependency-graph.json`, `file-inventory.json`, `duplicate-symbols.json` and
105
+ `unused-analysis.json`, with 27 ported tests. On 11 repositories, all 44 files are
106
+ byte-identical to the Python tool after the approved changes. The port writes LF line ends and
107
+ schema version 2.0.0, with no `generated` field. Warnings name no absolute root path. Paths
108
+ sort by code unit, and the Python tool sorts them in the Windows case-insensitive order.
109
+ - 2.0.0 engine: the artifact tests of C# and Rust are ported (16 tests, from
110
+ `test_csharp_repo_end_to_end.py`, `test_unused_csharp.py` and `test_rust_unused_caveat.py`).
111
+ The source tests that read a local repository are not ported. The side-1 parity run covers
112
+ that repository.
113
+ - 2.0.0 engine: the read-only queries (`src/map/query.ts`, from `repo_map/query.py`):
114
+ `loadGraph`, `dependents`, `symbolUsers` and `cycles`, with 23 ported tests. The query module
115
+ reads only the graph JSON. A test scans its imports and fails if a reader, resolver, grammar or
116
+ graph module is reachable. A 1.x graph is refused, because its major version is not 2.
117
+ - 2.0.0 engine: the simple-cycle enumeration moves to `src/map/cycles.ts`. The graph and the
118
+ queries share it. The Python tool keeps two copies of this algorithm. On 10 repositories, the
119
+ artifacts are byte-identical before and after the move.
120
+ - 2.0.0 engine (design decision D2): `dependency-graph.json` statistics also count the cyclic
121
+ components. The new keys are `runtimeCyclicComponents`, `typeOnlyCyclicComponents`,
122
+ `runtimeFilesInCycles` and `typeOnlyFilesInCycles`, after `circularDepsTruncated`. A cap never
123
+ truncates these counts. The Tarjan search moves from `src/depgraph/cycles.ts` to
124
+ `src/map/cycles.ts`, so depgraph and the core graph count components in the same way.
125
+ - 2.0.0 engine (design decision D2): for a TypeScript repo, the statistics also give the
126
+ per-kind export counts of depgraph. The keys are `totalClasses`, `totalInterfaces`,
127
+ `totalFunctions`, `totalTypeGuards`, `totalEnums`, `totalConstants` and `totalReExports`. The
128
+ core reader gives the kinds, so the counts come from one parser. On memoryjs, each file has
129
+ the same names of each kind as in depgraph 1.x. The totals differ for two reasons. The core
130
+ counts every area, and depgraph counts the `src` files only. Also, depgraph counts an
131
+ overloaded or merged name one time for each declaration.
132
+ - 2.0.0 engine (design decisions D3 and D5): `src/map/adapter.ts` changes the `src` files of the
133
+ graph into depgraph's parsed-file records. Then depgraph's analyzers run on the one graph for
134
+ each language. Each edge carries its resolved target. The new helper `targetOf` uses that
135
+ target, and a 1.x parse still resolves the specifier. The graph now also keeps each file's
136
+ export kinds, re-exports and re-export edges. The graph JSON does not write them. The records
137
+ have no workspace edges and no package name. The graph does not keep these facts.
138
+ - 2.0.0 engine (design decision D3): `src/map/layers.ts` writes `dependency-layers.json`, which
139
+ is depgraph's subsystem view built on the graph. The file holds `metadata`, `entryPoints`,
140
+ `modules`, `cyclicComponents` and `layers`. `modules`, `entryPoints` and `layers` hold the
141
+ `src` files, as in depgraph 1.x. `cyclicComponents` holds every area, so its counts agree with
142
+ the core statistics. The adapter now also gives each edge its written specifier, and the
143
+ names of each package or built-in import. On memoryjs, the modules, files, entry points and
144
+ layers are identical to depgraph 1.x, and each field difference has a recorded cause.
145
+ `generateJSON` gets three helpers (`modulesJsonOf`, `layersOf`, `entryPointsOf`), and its
146
+ output does not change.
147
+ - 2.0.0 engine (design decisions D3 and D5): `src/map/reports.ts` writes `DEPENDENCY_GRAPH.md`,
148
+ `dependency-graph.yaml` and `dependency-summary.compact.json` for each language. The
149
+ Markdown and the compact summary show the subsystem view with the core statistics. The YAML
150
+ is a copy of the core `dependency-graph.json` in YAML. The Markdown banner names
151
+ `repo-tools map`, and its table uses language-neutral labels. A language with no kind counts
152
+ gets no kind rows. In depgraph, `generateMarkdown` gets an optional `summaryRows` parameter.
153
+ Its cycle section counts the files of the listed components. The per-kind export counts of
154
+ `Statistics` are optional. After these changes, depgraph 1.x writes all 12 reports on
155
+ memoryjs byte-identical to a run before them.
156
+ - 2.0.0 engine (design decision D4): `file-inventory.json` also gives depgraph's `byPackage`
157
+ and `skippedLinks`, the links that discovery does not follow. A walk does not follow a folder
158
+ link. In a git work tree, discovery does not follow a tracked link (mode 120000) to a folder
159
+ or to a missing file. The new `gitTrackedLinks` reads the modes with `git ls-files --stage`. The
160
+ git branch has a test that makes a folder link when the host permits it. The other core
161
+ files of 10 repositories stay byte-identical.
162
+ - 2.0.0 engine (design decision D4): for a TypeScript repo, `duplicate-symbols.json` also
163
+ holds depgraph's classified lists: `runtime`, `types`, `classificationNote` and the four
164
+ summary counts. The allowlist is `<root>/docs/architecture/duplicate-allowlist.json`,
165
+ never a file in the output folder (D9). A declaration file (`.d.ts`) is no definer in the
166
+ classified lists, because it has no body. Another language gets an explicit
167
+ `classificationNote` and no classified lists. The adapter now gives each file its workspace
168
+ package, as depgraph 1.x does. On memoryjs, MathTS and universal-physics-tensor, each
169
+ classified entry is identical to depgraph 1.x. The one exception is a 1.x definer that is a
170
+ declaration file.
171
+ - 2.0.0 engine (design decisions D4 and D5): `src/map/markdown.ts` writes `FILE_INVENTORY.md`,
172
+ `duplicate-symbols.md` and `unused-analysis.md` for each language. Each report reads the
173
+ JSON files in the output folder. A TypeScript duplicate report keeps the depgraph renderer.
174
+ Another language gets the name-only list and the explicit note. The inventory and unused
175
+ reports have new text, because the 1.x text described a census of TypeScript files only. The
176
+ unused report also lists the dormant files of the core reachability.
177
+ - 2.0.0 engine (design decision D5): `src/map/coverage.ts` writes `TEST_COVERAGE.md` and
178
+ `test-coverage.json` for each language, with depgraph's analyzer. The name of a file decides
179
+ if it is a test. For TypeScript and JavaScript, the name is `*.test.*` or `*.spec.*`, as in
180
+ 1.x. For Python, the name is `test_*.py` or `*_test.py`. For C# and Rust, each file in the
181
+ tests area is a test. A test also covers a file that it loads with a literal `import()`, or
182
+ through a relative `dist/` path. The core graph has no edge for these loads. The coverage
183
+ policy is `<root>/docs/architecture/coverage-policy.json` (D9). The reader records the bare
184
+ side-effect imports and the literal `import()` specifiers of TypeScript. The graph JSON does
185
+ not write them. On memoryjs, MathTS and universal-physics-tensor, the tested files are the
186
+ same as in depgraph 1.x.
187
+ - 2.0.0 engine (design decision D5): `src/map/surfaces.ts` writes
188
+ `package-export-surfaces.json` for TypeScript with depgraph's public-surface rules. Fix: a
189
+ bare `export *` edge now keeps a `star` flag, and the adapter shows it as `*`, as 1.x does.
190
+ Before the fix, barrel expansion replaced the `*` with names. Then a name deep in an
191
+ `export *` chain was not public, which a test found. The layers module entries show star
192
+ edges as 1.x does. On memoryjs the surfaces are identical to 1.x. On MathTS and
193
+ universal-physics-tensor, each difference has a recorded cause.
194
+ - 2.0.0 engine (design decision D5): `package-export-surfaces.json` for Python and Rust, with a
195
+ `note` that gives the rule. A Python package lists its `__all__`, else the public names that
196
+ its `__init__.py` defines. A Rust library crate root (`lib.rs`) lists its `pub` items and the
197
+ names of its plain `pub use` statements. The new `pubUseNames` reads an alias only as the
198
+ whole word `as`, so a name such as `HashMap` keeps its letters. For C#, no file is written,
199
+ because C# has no rule for a public surface of a package.
200
+ - Dependencies (bundled, not installed by users): `web-tree-sitter` 0.27.0,
201
+ `tree-sitter-typescript` 0.23.2 and `tree-sitter-python` 0.25.0, pinned. The engine parses with
202
+ them in a later step. `src/ste/py.ts` moves to `src/py.ts`, because the engine also uses it.
203
+
204
+ ### Fixed
205
+
206
+ - `map`: the Rust `use` reader kept the error of the Python tool. The Python tool removes the white
207
+ space of a `use` path, then cuts the path at the letters `as`. So `HashMap` gave `H`, `wasm`
208
+ gave `w` and `task` gave `t`, and a cut path could resolve to the wrong module. The reader now
209
+ removes only an alias that is the whole word `as` and a name. On IronClaw, 139 names are
210
+ complete again. The internal edges of 14 files go to the correct modules, and the simple
211
+ runtime cycle count goes from 1667 to 1009. The fix is a deliberate difference from the
212
+ Python tool.
213
+ - Tests: the build test that runs `map` from the Node bundle writes `{"type": "module"}` next to
214
+ the bundle, as in the installed package. Without it, Node reads the nearest `package.json`
215
+ above the temporary folder. A stray one with no `type` makes Node write a warning to standard
216
+ error, and the test failed on such a machine.
217
+ - The code-docs gate passes (399 of 399 exported symbols have a doc comment). Seven exported
218
+ types had no doc comment. The doc comment of `resolvePath` was apart from its function,
219
+ because `targetOf` was in the space between them. `src/map/graph.ts` and `src/ste/index.ts`
220
+ wrote the type `import("node:fs").Dirent` in the code, which the tree-sitter TypeScript
221
+ grammar cannot parse. They now import the type `Dirent`.
222
+ - `map`: a workspace monorepo now has entry roots. The Python tool reads the root `package.json`
223
+ only, so each workspace source file showed as an orphan. The engine now also reads the
224
+ `package.json` of each workspace package, then the extra entries of depgraph, then a
225
+ `src/index.*` file. The workspace roots are a deliberate difference from the Python tool. On
226
+ MathTS, the roots go from 0 to 1167, and each disposition equals depgraph 1.x.
227
+ - Build (design decision D7): `scripts/build.ts` now writes the three tree-sitter `.wasm` assets
228
+ next to `dist/cli.js`, under the names that the bundle refers to. Before this fix, the build
229
+ kept the JavaScript output only, so the Node bundle had no grammar files. `package.json`
230
+ `files` adds `dist/*.wasm`, and `npm pack --dry-run` lists the three files. The smoke test
231
+ passes 8 of 8 steps on the Windows executable, and on `dist/cli.js` with Bun, Node 20, Node
232
+ 22 and Node 24. A bundle with no `.wasm` file fails the smoke test. The engine has three
233
+ `.wasm` files, not four, because it reads `.tsx` with the TypeScript grammar.
234
+ - `map`: an import of a workspace package by name is now an edge to its entry file. In a single
235
+ package, an import of its own name is an edge too (1.x fix F43). The Python tool keeps each
236
+ such import as an external package, so a monorepo had no edges between its packages. The
237
+ import stays external when the census does not hold the entry file. The adapter lists these
238
+ edges as workspace edges, as depgraph 1.x does. On MathTS, 485 exports that other packages
239
+ use are no longer counted as unused.
240
+
9
241
  ## [1.1.0] - 2026-09-25
10
242
 
11
243
  The STE release. `repo-tools ste` checks Markdown, and docstring prose with `--prose`, against the
package/README.md CHANGED
@@ -1,20 +1,25 @@
1
1
  # repo-tools
2
2
 
3
- `repo-tools` is one command-line tool with five subcommands for repositories:
3
+ `repo-tools` is one command-line tool with these subcommands for repositories:
4
4
 
5
5
  | Subcommand | Job |
6
6
  |---|---|
7
- | `depgraph` | Writes the dependency graph and the architecture reports of a TypeScript tree. |
7
+ | `map` | Writes the dependency graph and the architecture reports of a TypeScript/JavaScript, Python, C# or Rust repository. |
8
+ | `depgraph` | The deprecated alias of `map` (through 2.x). |
8
9
  | `chunk` | Splits a large file into chunks, merges the chunks back, and shows which chunks changed. |
9
10
  | `compress` | Writes a compact copy of a file for a model context, and restores it. |
10
- | `query` | Answers structural questions from the depgraph reports, and writes two derived reports. |
11
+ | `query` | Answers structural questions from the graph of `map`, and writes two derived reports. |
11
12
  | `ste` | Checks Markdown or docstring prose against Simplified Technical English. |
12
13
 
13
- Status: version 1.1.0.
14
+ Status: version 2.0.0.
14
15
 
15
- - All five subcommands work.
16
- - `depgraph` and `query` read their settings from `repo-tools.config.json` in the root.
17
- `--config=<file>` makes either subcommand read another file.
16
+ - `map` and `query` read their settings from `repo-tools.config.json` in the root. The section
17
+ of `map` is `map` (its old name, `depgraph`, is also read). `--config=<file>` makes either
18
+ subcommand read another file.
19
+ - `repo-tools depgraph` prints one deprecation line and runs `map`. It accepts the 1.x
20
+ scan-scope flags (`--src`, `--tests`, `--exclude`, `--also-exclude`, `--all`,
21
+ `--reachable-only`, `--include-tests`) with a warning, because they have no effect in 2.0.0.
22
+ `map` exits 1 on them.
18
23
  - `compress -d` restores JSON files only.
19
24
 
20
25
  ## Install
@@ -34,7 +39,7 @@ repo-tools --version
34
39
 
35
40
  The executable holds the tool and the Bun runtime. It needs no Bun, Node or `node_modules`.
36
41
  Download the file for your platform and `SHA256SUMS` from the
37
- [GitHub release](https://github.com/danielsimonjr/repo-tools/releases/tag/v1.1.0):
42
+ [GitHub release](https://github.com/danielsimonjr/repo-tools/releases/tag/v2.0.0):
38
43
 
39
44
  | Platform | File |
40
45
  |---|---|
@@ -112,7 +117,7 @@ Prerequisites: Bun 1.4.2 or later, and a clone of this repository.
112
117
 
113
118
  ```sh
114
119
  bin/repo-tools-windows-x64.exe --version
115
- bin/repo-tools-windows-x64.exe depgraph --root=path/to/repo
120
+ bin/repo-tools-windows-x64.exe map --root=path/to/repo
116
121
  ```
117
122
 
118
123
  4. Test the executable, not only the source. The executable is the artifact that ships:
@@ -121,28 +126,38 @@ Prerequisites: Bun 1.4.2 or later, and a clone of this repository.
121
126
  bun run smoke -- bin/repo-tools-windows-x64.exe
122
127
  ```
123
128
 
124
- `bun run build` writes a second channel, the Node bundle `dist/cli.js` (`node dist/cli.js --help`).
129
+ `bun run build` writes a second channel, the Node bundle `dist/cli.js` (`node dist/cli.js --help`),
130
+ with the tree-sitter grammar files (`dist/*.wasm`) next to it.
125
131
 
126
132
  ## Reports
127
133
 
128
- `repo-tools depgraph` writes its reports into `docs/architecture/` under the root. Every file is
129
- generated: do not edit it by hand. Run `repo-tools depgraph` again to update it. Each Markdown
130
- report starts with a "GENERATED FILE -- do not edit by hand" banner.
134
+ `repo-tools map` writes its reports into `docs/architecture/` under the root (`--out=<dir>`
135
+ names another folder; `--out=../reports` writes outside the root). Every file is generated: do
136
+ not edit it by hand. Run `repo-tools map` again to update it. Each Markdown report starts with
137
+ a "GENERATED FILE -- do not edit by hand" banner.
138
+
139
+ The census is the set of source files that git tracks (outside a git work tree, a pruned walk).
140
+ The language with the most files decides how `map` reads the repository. Input files never come
141
+ from the output folder. The duplicate allowlist, the duplicate baseline and the coverage policy
142
+ are in `docs/architecture/`, or at the path that the config gives.
131
143
 
132
144
  | File | What it answers |
133
145
  |---|---|
146
+ | `dependency-graph.json` | The core graph: each file by area, with its imports, exports and edges; the reachability; the cycle counts; and the statistics. |
147
+ | `file-inventory.json` | Where is each source file, and what is it? Package, area and disposition (reachable, build entry, test-only, orphan, test, tool, config, example, bench), and the links that the census did not follow. |
148
+ | `duplicate-symbols.json` | Which names do two or more files define? For TypeScript, also the classified lists. |
149
+ | `unused-analysis.json` | Which exports and files does nothing import? |
150
+ | `dependency-layers.json` | The subsystem view: the `src` files by module, the entry points, the layers and the cyclic components. |
134
151
  | `DEPENDENCY_GRAPH.md` | How do the files and modules depend on each other? Per-file imports and exports, the dependency matrix, cyclic components (runtime and type-only), a Mermaid diagram, and statistics. |
135
- | `dependency-graph.json` | The same graph as data, for tools: modules, files, imports, exports, entry points, cyclic components and statistics. |
136
- | `dependency-graph.yaml` | The same data as YAML. |
152
+ | `dependency-graph.yaml` | `dependency-graph.json` as YAML. |
137
153
  | `dependency-summary.compact.json` | A small summary of the graph, with short keys, to give to a model. |
138
- | `unused-analysis.md` | Which files and exports does nothing import? Dormant files, split into orphans (reachable from nothing) and test-only files. |
139
- | `FILE_INVENTORY.md` | Where is every `.ts` file, and what is it? Area and disposition (reachable, build entry, test-only, orphan, test, tool, config, example, bench), and the result of the census self-check. |
140
- | `file-inventory.json` | The same inventory as data. |
141
- | `TEST_COVERAGE.md` | Which source files does a test import (directly, through a barrel, or through a side-effect import), and which files does no test reach? |
154
+ | `FILE_INVENTORY.md`, `duplicate-symbols.md`, `unused-analysis.md` | The three JSON reports above, for a person to read. |
155
+ | `TEST_COVERAGE.md` | Which source files does a test load (directly, through a barrel, through a side-effect import, or by `import()`), and which files does no test reach? |
142
156
  | `test-coverage.json` | The same coverage data, with the test-to-source map. |
143
- | `duplicate-symbols.md` | Which names do two or more files define? Each name is classified. |
144
- | `duplicate-symbols.json` | The same duplicate data as data. |
145
- | `package-export-surfaces.json` | Which names does each package export publicly? |
157
+ | `package-export-surfaces.json` | Which names does each package export publicly? Not written for C#. |
158
+
159
+ `docs/parity-2.0.0.md` records how these reports compare with the Python tool and with
160
+ depgraph 1.x.
146
161
 
147
162
  `repo-tools query --emit` writes two more files into the same folder. They are also generated.
148
163
 
@@ -153,28 +168,34 @@ report starts with a "GENERATED FILE -- do not edit by hand" banner.
153
168
 
154
169
  ## Query the graph
155
170
 
156
- `repo-tools query` answers questions from `dependency-graph.json` and
157
- `package-export-surfaces.json`. It parses no source file, so run `repo-tools depgraph` first.
158
- The examples use a copy of `tests/fixtures/depgraph/mono-repo`:
171
+ `repo-tools query` answers questions from `dependency-graph.json` (and
172
+ `package-export-surfaces.json` for `is-public`). It parses no source file, so run
173
+ `repo-tools map` first. It reads each area of the graph, and a path that is not a file of the
174
+ graph exits 1. The examples use a copy of `tests/fixtures/depgraph/mono-repo`:
159
175
 
160
176
  ```sh
161
- repo-tools depgraph
177
+ repo-tools map
162
178
  repo-tools query dependents packages/core/src/math.ts
163
179
  # packages/core/src/index.ts
164
180
  # packages/core/src/worker.ts
181
+ # packages/core/tests/math.test.ts
165
182
  repo-tools query symbol-users add
166
- # packages/cli/src/main.ts [@scope/core]
167
- # packages/core/src/index.ts [internal]
183
+ # packages/cli/src/main.ts
184
+ # packages/core/src/index.ts
185
+ # packages/core/tests/math.test.ts
168
186
  repo-tools query is-public packages/core add
169
187
  # PUBLIC: add is exported from packages/core
170
188
  repo-tools query is-public packages/core double
171
189
  # INTERNAL: double is not in the public export surface of packages/core
172
190
  repo-tools query cycles
191
+ # 0 simple cycles
192
+ repo-tools query cycles --components
173
193
  # runtime: 0 cyclic components
174
194
  # type-only: 0 cyclic components
175
195
  ```
176
196
 
177
- A package is the folder above a `src/index.ts` entry (`.` for the root entry). Each package is
197
+ The browser-safety commands serve TypeScript/JavaScript only. A package is the folder above a
198
+ `src/index.ts` file (`.` for the root file). Each package is
178
199
  browser-safe, unless `--node-runtime=<pkg,...>` or the config key `query.nodeRuntimes` lists it.
179
200
  The `.` entry of a browser-safe package must not reach a file that imports a `node:` builtin:
180
201
 
@@ -184,12 +205,12 @@ repo-tools query node-safety
184
205
  repo-tools query --check-browser-safety
185
206
  # browser-safety check passed: the . entries of 1 browser-safe package reach no node: code.
186
207
  repo-tools query --emit
187
- # Written: docs/architecture/dependency-reverse.json (3 files)
208
+ # Written: docs/architecture/dependency-reverse.json (4 files)
188
209
  # Written: docs/architecture/node-safety.json (0 node files, 0 leaks)
189
210
  ```
190
211
 
191
212
  `--check-browser-safety` exits 1 on a leak. The query reads its reports from `--out`, else from
192
- the config key `query.out`, else from `depgraph.out`, else from `docs/architecture`. Run
213
+ the config key `query.out`, else from `map.out`, else from `docs/architecture`. Run
193
214
  `repo-tools query --help` for every option.
194
215
 
195
216
  ## Develop
@@ -208,7 +229,7 @@ the config key `query.out`, else from `depgraph.out`, else from `docs/architectu
208
229
  ## Design
209
230
 
210
231
  `docs/design.md` describes the modules, the output rules, the config, the extension contract,
211
- the privacy check and the verification.
232
+ the privacy check and the verification. Its section "The 2.0.0 engine" describes `map`.
212
233
 
213
234
  ## License
214
235