@danielsimonjr/repo-tools 2.0.0 → 2.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.
Files changed (4) hide show
  1. package/CHANGELOG.md +94 -4
  2. package/README.md +50 -6
  3. package/dist/cli.js +12478 -11915
  4. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,96 @@ All notable changes to this project are recorded in this file. The format follow
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.1.0] - 2026-10-01
10
+
11
+ `repo-tools check` is the new drift gate for the Markdown documents of a repository. It ports
12
+ `check.py` of the architecture-docs skill. The release also makes a literal `import()` a graph
13
+ edge, removes the 1.x depgraph pipeline, and adds an accept-list to the privacy check.
14
+ `docs/parity-check.md` lists the differences from the Python tool.
15
+
16
+ ### Added
17
+
18
+ - `repo-tools check --docs=<dir>`, the drift gate of the architecture documents. The command is
19
+ a port of `check.py` of the architecture-docs skill. The check reads the `## Verification`
20
+ tables of the Markdown files in the folder. The check builds a fresh graph, and the check
21
+ compares each claim with the graph. Exit 0 means that every claim matched. Exit 1 lists every
22
+ problem on standard error, one per line. A missing or empty docs folder is a problem. A
23
+ document without a Verification section is a problem. So are a section without a row, an
24
+ unknown claim, a count that the graph build declared unreliable, and a value that differs. A
25
+ document opts out when one of its lines is exactly `<!-- repo-map:no-verification -->`. A relative `--docs` path is
26
+ relative to the root, and an absolute path is used as given. The check reads
27
+ `map.duplicateAllowlist` and `map.verificationMarker` from the config file. Section 15 of
28
+ `docs/design.md` lists the differences from the Python tool. The smoke test has a `check` step.
29
+ `docs/parity-check.md` records the comparison with the Python tool on 11 repositories.
30
+ - The privacy check has an accept-list, `scripts/privacy-accepted.txt`, for a reviewed finding in
31
+ the commit history. A commit message cannot change after a merge, so a new commit cannot clear
32
+ a finding in it. An entry holds a full commit sha, one finding kind, one line of the message and
33
+ a reason. The entry accepts that finding only: no prefix, no wildcard, no whole-commit waiver,
34
+ and never a finding in a tracked file. An entry that accepts no finding is a finding
35
+ (`accepted-stale`). The check prints each accepted finding with its reason.
36
+
37
+ ### Changed
38
+
39
+ - A literal relative `import()` is an edge of the core graph. This reverses the known difference
40
+ in 2.0.0. A runtime call is a namespace use (`*`). A type-position `import('./c').Name` records
41
+ that name. `typeof import()` records no names. A template that contains `${`, and a specifier
42
+ that is not relative, are not edges. The parity record gives the merge rules. The verdict
43
+ against the Python tool is `repo_map-wrong`.
44
+ - A namespace import (`import * as ns`, `export * as ns`) counts every export of its target as
45
+ used, as a runtime `import()` does. The Python tool lists those exports as unused. A name that
46
+ a file mentions only in a comment is not an in-module reference. The Python tool counts the
47
+ comment. The parity record gives the measured effect. A test locks the namespace rule.
48
+ - The opt-out marker of `repo-tools check` must stand alone on a line. `check.py` opts a document
49
+ out when the marker is anywhere in its text. A document can quote the marker in a sentence, a
50
+ code span or a table cell. That document then skips its own table, and a stale claim passes in
51
+ silence.
52
+ `repo-tools check` opts out only when a line, trimmed, equals the marker. This changes the
53
+ result for a document that opted out from inside a sentence or a table cell: the check now
54
+ reads its claims. `repo-tools map` writes the marker alone on a line, so generated reports
55
+ still opt out. A blank `map.verificationMarker` matches no line. `docs/parity-check.md` records
56
+ the difference. The verdict is fail-closed.
57
+ - A bodiless `export function f(): T;` is not an export, as in the Python tool
58
+ (`repo_map-kept`). An overload plus an implementation records the name once.
59
+ - The 1.x depgraph pipeline is removed: the runner, the regex parser, the scanner, the inventory
60
+ reporter and the 1.x goldens. `repo-tools depgraph` stays an alias of `repo-tools map`.
61
+ `docs/fix-ledger-2.0.0.md` records which 1.x fixes the `map` tests lock, and which fixes have
62
+ no 2.0.0 meaning.
63
+
64
+ ### Fixed
65
+
66
+ - `src/check/claims.ts` and one test held the byte-order mark as an invisible U+FEFF character.
67
+ Both files now spell it as an escape sequence. A new test fails when a file under `src/`,
68
+ `tests/` or `scripts/` holds a literal U+FEFF.
69
+ - A named `export { name } from` writes one edge for that statement. The statement does not add a
70
+ second empty-imports edge to the same file.
71
+ - `write` refuses a symbolic link inside the output folder that points outside it.
72
+ - A skip-list folder under `src/` (`dist`, `build`, `coverage`, `node_modules`, `.git`) that
73
+ holds a source file produces a warning. The files stay out of the census. A root `build/` or
74
+ `dist/` folder stays silent.
75
+ - `--check-census` names the configured regenerate command. The test-coverage note names the
76
+ configured coverage-policy path.
77
+ - The config file accepts a top-level `$schema` key.
78
+ - The walk skip list is not module state. Each walk builds its own skip set.
79
+ - A type-position `import('./c').C` records the name `C`.
80
+ - In single-package mode, `main` and `exports` targets are roots after `dist/` maps to `src/`,
81
+ including when the file is not `src/index.ts`. A subpath root is the source of the export
82
+ target.
83
+ - Test coverage follows an import by package name, including the side-effect imports of the
84
+ resolved file.
85
+ - A workspace subpath uses the `exports` target, then `<sub>.ts`, then `<sub>/index.ts`.
86
+ - A package-name import is an edge in cycle detection, including the cyclic components in
87
+ `dependency-layers.json`.
88
+ - The comment mask treats `a++ / b / c` as division, and `if (x) /re/` as a regular expression.
89
+ - A bare `import './x'` together with `import('./x')` is one side-effect edge whose names are
90
+ `["*"]`.
91
+ - A dangling symbolic link is listed in `skippedLinks`.
92
+ - A `new URL` in a root config, and a `new URL('./x.js', import.meta.url)` launch, seed roots.
93
+ - A `.test.tsx` or `.spec.tsx` file is in the `tests` area.
94
+ - The repository scan of the privacy check passes again. A test fixture used an e-mail address
95
+ that the check rejects. Two trailers of the merge commit of the engine change hold a co-author
96
+ address and a name. The fixture now uses an allowed address. The accept-list records the two
97
+ trailers.
98
+
9
99
  ## [2.0.0] - 2026-09-26
10
100
 
11
101
  The unified engine. `repo-tools map` replaces the Python `repo_map.py` and depgraph 1.x with one
@@ -16,10 +106,10 @@ flags have no effect: `map` exits 1 on them, and the alias gives a warning.
16
106
 
17
107
  ### Known differences
18
108
 
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.
109
+ - The 2.0.0 release made no graph edge for a dynamic `import()`. That choice is reversed in
110
+ Unreleased: a literal relative `import()` is now an edge. On memoryjs, the release counted
111
+ one type-only cyclic component as 3 files, not 7. Test coverage counted a literal `import()`
112
+ in a test file as a load, and it still does.
23
113
 
24
114
  ### Added
25
115
 
package/README.md CHANGED
@@ -6,16 +6,17 @@
6
6
  |---|---|
7
7
  | `map` | Writes the dependency graph and the architecture reports of a TypeScript/JavaScript, Python, C# or Rust repository. |
8
8
  | `depgraph` | The deprecated alias of `map` (through 2.x). |
9
+ | `check` | Checks the `## Verification` tables of Markdown documents against a fresh graph, and fails on drift. |
9
10
  | `chunk` | Splits a large file into chunks, merges the chunks back, and shows which chunks changed. |
10
11
  | `compress` | Writes a compact copy of a file for a model context, and restores it. |
11
12
  | `query` | Answers structural questions from the graph of `map`, and writes two derived reports. |
12
13
  | `ste` | Checks Markdown or docstring prose against Simplified Technical English. |
13
14
 
14
- Status: version 2.0.0.
15
+ Status: version 2.1.0.
15
16
 
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.
17
+ - `map`, `check` and `query` read their settings from `repo-tools.config.json` in the root. The
18
+ section of `map` is `map` (its old name, `depgraph`, is also read). `--config=<file>` makes any
19
+ of the three read another file.
19
20
  - `repo-tools depgraph` prints one deprecation line and runs `map`. It accepts the 1.x
20
21
  scan-scope flags (`--src`, `--tests`, `--exclude`, `--also-exclude`, `--all`,
21
22
  `--reachable-only`, `--include-tests`) with a warning, because they have no effect in 2.0.0.
@@ -39,7 +40,7 @@ repo-tools --version
39
40
 
40
41
  The executable holds the tool and the Bun runtime. It needs no Bun, Node or `node_modules`.
41
42
  Download the file for your platform and `SHA256SUMS` from the
42
- [GitHub release](https://github.com/danielsimonjr/repo-tools/releases/tag/v2.0.0):
43
+ [GitHub release](https://github.com/danielsimonjr/repo-tools/releases/tag/v2.1.0):
43
44
 
44
45
  | Platform | File |
45
46
  |---|---|
@@ -139,7 +140,13 @@ a "GENERATED FILE -- do not edit by hand" banner.
139
140
  The census is the set of source files that git tracks (outside a git work tree, a pruned walk).
140
141
  The language with the most files decides how `map` reads the repository. Input files never come
141
142
  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.
143
+ are in `docs/architecture/`, or at the path that the config gives. A repository that already has
144
+ its own allowlist must set `map.duplicateAllowlist` (the old key `depgraph.duplicateAllowlist`
145
+ is also read) to that file. Mathts has 283 allowlisted names. With the default path, the
146
+ duplicate gate fails on those names.
147
+
148
+ A literal relative `import()` is a graph edge. The Python `repo_map.py` records none. The parity
149
+ record in `docs/parity-2.0.0.md` gives the rules and the verdict.
143
150
 
144
151
  | File | What it answers |
145
152
  |---|---|
@@ -166,6 +173,43 @@ depgraph 1.x.
166
173
  | `dependency-reverse.json` | Which files import each file? The reverse edges of the graph. |
167
174
  | `node-safety.json` | Which packages are browser-safe, which files import a `node:` builtin, and which of those files does the `.` entry of each browser-safe package reach? |
168
175
 
176
+ ## Check the documents against the graph
177
+
178
+ `repo-tools check --docs=<dir>` reads every `*.md` file of the folder. The check reads the
179
+ `## Verification` table of each document. Each row `| claim | value | source |` names a metric of
180
+ the graph (`totalFiles`, `orphanedFiles`, `runtimeCircularDeps` and so on). The value is the
181
+ number that the document states. The check builds the graph again, so a stale report cannot hide
182
+ drift. A relative `--docs` path is relative to the root.
183
+
184
+ ```md
185
+ ## Verification
186
+
187
+ | Claim | Value | Source |
188
+ |---|---|---|
189
+ | totalFiles | 243 | file-inventory.json |
190
+ ```
191
+
192
+ ```sh
193
+ repo-tools check --docs=docs/architecture
194
+ # check passed: every claim matches the graph (1 claim in 1 document).
195
+ ```
196
+
197
+ When a value drifts, the exit code is 1, and standard error lists every problem, one per line:
198
+
199
+ ```text
200
+ OVERVIEW.md: totalFiles claims 243 but actual is 244
201
+ ```
202
+
203
+ A document passes without a check when one of its lines is exactly
204
+ `<!-- repo-map:no-verification -->`. The marker must stand alone on its line: a marker inside a
205
+ sentence, a code span or a table cell does not count.
206
+ `repo-tools map` writes that line at the top of each generated report. Every other gap is a
207
+ failure. A missing docs folder, a folder with no `*.md` file, a document without a Verification
208
+ section, and a section without a row are failures. An unknown claim name is a failure too. So is a
209
+ metric that the graph build declared unreliable. `docs/design.md` (section 15) gives the rules and the
210
+ differences from the Python tool. `docs/parity-check.md` records the comparison with that tool on
211
+ 11 repositories.
212
+
169
213
  ## Query the graph
170
214
 
171
215
  `repo-tools query` answers questions from `dependency-graph.json` (and