@danielsimonjr/repo-tools 2.1.0 → 2.2.1

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,114 @@ All notable changes to this project are recorded in this file. The format follow
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.2.1] - 2026-10-08
10
+
11
+ ### Fixed
12
+
13
+ - `repo-tools map` finds the entry roots of a package that has no `src/` tree. A `bin`, `main`,
14
+ `module` or `exports` entry that names a tracked source file (`bin/tool.mjs`, `./lib/index.js`)
15
+ is now a root. Before, only entries that map into `src/` counted. A package with `bin/` and `lib/`
16
+ and no `src/` showed `entryRoots` 0, and its `unused-analysis.md` listed every file as an orphan or
17
+ test-only. A package with a `src/` tree resolves as before, so a thin launcher that fails the scan
18
+ still warns. The warning text no longer says "under src/".
19
+
20
+ ## [2.2.0] - 2026-10-02
21
+
22
+ `repo-tools docs` is the new gate of the doc comments of a repository. It ports `code_docs.py` of
23
+ the code-docs skill. `docs/parity-docs.md` lists the differences from the Python tool. The
24
+ release also adds the audit of the fix ledger and the check for dangling references to the
25
+ design document.
26
+
27
+ ### Added
28
+
29
+ - `repo-tools docs`, the gate of the doc comments. The command is a port of `code_docs.py` of the
30
+ code-docs skill, and it needs no Python. `docs scan` measures the coverage of the exported
31
+ symbols and writes `COVERAGE.md` and `coverage.json`. `docs check` is the gate: it exits 1 on a
32
+ MUST issue (M1 to M5) and on a file that does not parse. `--paths` and `--paths-from=<file>`
33
+ gate the changed files of a pull request only. `docs stub` plans a skeleton comment with the
34
+ marker `TODO:` for each exported symbol that has no comment. The default is a dry run until
35
+ `--apply`. After a change, `stub` parses the file again, and it keeps the line ends of the
36
+ file. The command reads TypeScript, JavaScript and Python with tree-sitter. A
37
+ `.code-docs.json` file at the root excludes paths, and each entry needs a reason. Section 16
38
+ of `docs/design.md` describes the command. `docs/parity-docs.md` compares the command with the
39
+ Python tool on 9 public repositories: 4665 files, 22329 symbols, 690 MUST issues and 11208
40
+ SHOULD issues. The reports are equal, except for the order of the symbols in 40 files and the
41
+ doc names of 29 symbols of one repository. The command gives 3 MUST issues more than the Python
42
+ tool, for stale names in optional `[name]` tags. The record lists the differences. Some are
43
+ defects of the Python tool. The defects are a closing `*/` in the summary, comment delimiters in
44
+ the STE check, and the parameter names in a doc. The others are the parser of Python, the exit
45
+ codes, and the files that `stub` changes.
46
+ - `repo-tools docs stub` never writes through a link. The command skips a file that is a link or
47
+ resolves outside the root, and names the file. The command does not write a TypeScript block
48
+ when another token precedes the declaration on its line, for example the end of a template. The
49
+ end of a Python signature ignores the brackets in strings and a comment after the colon. A root
50
+ with no source file gives exit code 1, as for `scan` and `check`. `--path=.` selects the whole
51
+ repository.
52
+ - `docs check --paths-from` reads the quoted names that `git diff --name-only` writes for a
53
+ non-ASCII file name. The analysers read a JSDoc parameter name with `$`, and the optional forms
54
+ `[name]` and `[name=default]`. They read a reST field with a type, for example
55
+ `:param int x:`. A destructured parameter binds the names on the left of a default value. The
56
+ analysers read each name from the source as written, so a parameter named `abstract` keeps its
57
+ name. The Python tool has each of these defects, and design section 16.6 lists them.
58
+ - The smoke test has a step for the doc gate. A run of `docs check` reads a TypeScript, a TSX and
59
+ a Python file, so one run loads the three grammars of the product. The test passes documented
60
+ source and fails a new undocumented export.
61
+ - `bun run audit:ledger`, the audit of the fix ledger. For each fix (F1 to F44, M1 and R1), the
62
+ script restores the 1.x defect in a scratch copy of the repository. Then it runs the tests.
63
+ It runs the test file of the fix first, and then the whole suite. A test of the fix file must
64
+ fail. Each test has a 30 s limit (`--test-timeout-s`). A run in which only tests hit their
65
+ time limit is an error, because load can cause it.
66
+ The script exits 0 only when this holds for every mutation. Section 12 of
67
+ `docs/design.md` describes the audit. `scripts/fix-ledger-mutations.ts` holds the 77
68
+ mutations. `docs/fix-ledger-audit.md` holds the result: 77 of 77 mutations fail a test of
69
+ their own fix. The tests of the audit make their temporary repositories with a git identity
70
+ that the privacy check accepts.
71
+ - Tests for the fixes that no test of their own locked. F12: the module map of
72
+ `dependency-layers.json`. F26: components sorted by smallest member. F30: the map resolver
73
+ picks a `.tsx` file and a directory index. F34: a workspace package folder that is a link.
74
+ F43: the `src/<sub>/index.ts` fallback of an `exports` subpath. The tests of F17, F41 and F43
75
+ assert more. They assert the `src/index.ts` fallback root, an excluded package that has an
76
+ entry, and the edges of a self-import.
77
+ - `bun run check:design`, the check for dangling references to `docs/design.md`. A comment, a
78
+ test title or a workflow can name a part of the design, for example `design 11.4`. The script
79
+ finds each such reference and looks for a heading with that number. It prints each reference
80
+ that has no heading, and it exits 1. The unit tests run it on this repository. The check
81
+ proves that the number exists. It cannot prove that the heading has the meaning that the
82
+ reference gives.
83
+
84
+ ### Changed
85
+
86
+ - The grammar loader reads a third grammar, TSX. The Node bundle and the npm package now hold four
87
+ `.wasm` files and not three, and the compiled executable holds the TSX grammar too. `docs` uses
88
+ it for `.tsx` and `.jsx` files. `map` still reads these files with the TypeScript grammar.
89
+ - The directory readers of the map engine read through `readdirHook`. The readers are discovery,
90
+ the two `.csproj` walks and the folder list of a workspace pattern. The F2 test replaces
91
+ `readdirHook`. Before, the map never called the reader that the F2 test reversed. The test
92
+ passed with or without the sort in discovery.
93
+ - `docs/fix-ledger-2.0.0.md` describes what each test locks. The rows for F9 to F12, F19 to F21,
94
+ F23, F24, F27 and F29 to F31 described other behavior. The rows for F13, F36, F41 and F44 sat
95
+ in the section "No 2.0.0 meaning", although tests lock them. The test for M1 said that
96
+ `--reachable-only` removes a file. It asserts that `map` rejects the flag.
97
+ - `docs/design.md` now holds the parts that the code names. Section 11 has the subsections 11.1
98
+ to 11.4: the Node bundle, the compiled executables, the workflows and the release. Section 12
99
+ has 12.1, the steps of the smoke test. Section 14.2 describes the API-surface flags.
100
+ - The check found 50 references in comments, test titles and workflows to a part that the
101
+ document never had. Each reference now names an existing section. Four more references named
102
+ section 4 for the chunk and compress modules. Section 4 holds the output rules, so they now
103
+ name section 8.
104
+
105
+ ### Maintenance
106
+
107
+ - The root `bun` Dependabot entry is removed from `.github/dependabot.yml`. It cannot succeed.
108
+ The bun updater of Dependabot reads `bun.lock` lockfileVersion 1, and Bun 1.4 writes 2. The
109
+ `npm` alternative aborts during file fetching on a bun-managed project. Each error recommends
110
+ the other. Measured here: the `bun in /.` updater job failed on 2026-09-24 and again on
111
+ 2026-10-01, while `github_actions in /.` succeeded on both days. `github-actions` updates are
112
+ unchanged. The file now records the two errors, the cost and a checkable revisit condition.
113
+ **Unlike the sibling repositories in this sweep, this one also has Dependabot alerts
114
+ disabled.** Thus nothing reports a vulnerable dependency either. A bump is entirely a human
115
+ action: `bun outdated`, `bun update <pkg>`, then commit the regenerated `bun.lock`.
116
+
9
117
  ## [2.1.0] - 2026-10-01
10
118
 
11
119
  `repo-tools check` is the new drift gate for the Markdown documents of a repository. It ports
package/README.md CHANGED
@@ -7,12 +7,13 @@
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
9
  | `check` | Checks the `## Verification` tables of Markdown documents against a fresh graph, and fails on drift. |
10
+ | `docs` | Measures the doc comments of TypeScript, JavaScript and Python files, plans the missing ones, and gates the result. |
10
11
  | `chunk` | Splits a large file into chunks, merges the chunks back, and shows which chunks changed. |
11
12
  | `compress` | Writes a compact copy of a file for a model context, and restores it. |
12
13
  | `query` | Answers structural questions from the graph of `map`, and writes two derived reports. |
13
14
  | `ste` | Checks Markdown or docstring prose against Simplified Technical English. |
14
15
 
15
- Status: version 2.1.0.
16
+ Status: version 2.2.1.
16
17
 
17
18
  - `map`, `check` and `query` read their settings from `repo-tools.config.json` in the root. The
18
19
  section of `map` is `map` (its old name, `depgraph`, is also read). `--config=<file>` makes any
@@ -40,7 +41,7 @@ repo-tools --version
40
41
 
41
42
  The executable holds the tool and the Bun runtime. It needs no Bun, Node or `node_modules`.
42
43
  Download the file for your platform and `SHA256SUMS` from the
43
- [GitHub release](https://github.com/danielsimonjr/repo-tools/releases/tag/v2.1.0):
44
+ [GitHub release](https://github.com/danielsimonjr/repo-tools/releases/tag/v2.2.1):
44
45
 
45
46
  | Platform | File |
46
47
  |---|---|
@@ -210,6 +211,57 @@ metric that the graph build declared unreliable. `docs/design.md` (section 15) g
210
211
  differences from the Python tool. `docs/parity-check.md` records the comparison with that tool on
211
212
  11 repositories.
212
213
 
214
+ ## Gate the documentation comments
215
+
216
+ `repo-tools docs` reads the TypeScript, JavaScript and Python files that git tracks. It finds each
217
+ function, class, interface, type alias and method, and the doc comment of each one. It needs no
218
+ Python on the computer.
219
+
220
+ ```sh
221
+ repo-tools docs scan . # writes docs/code-docs/COVERAGE.md and coverage.json
222
+ repo-tools docs check . # the gate: exit 1 on a MUST issue
223
+ repo-tools docs stub . --path=src/api # a dry run: lists the stubs and writes nothing
224
+ repo-tools docs stub . --path=src/api --apply
225
+ ```
226
+
227
+ The rules are:
228
+
229
+ | Rule | Tier | The rule |
230
+ |---|---|---|
231
+ | M1 | MUST | An exported symbol has a doc comment. A test file is exempt. |
232
+ | M2 | MUST | The doc comment has a summary line. |
233
+ | M3 | MUST | The doc comment names no parameter that the signature lacks. |
234
+ | M4 | MUST | The doc comment holds no `TODO:` marker. |
235
+ | M5 | MUST | A file uses one doc dialect: `google`, `numpy` or `rest` for Python, `tsdoc` or `jsdoc` for TypeScript. |
236
+ | S2 | SHOULD | The summary ends with a full stop. |
237
+ | S5 | SHOULD | The doc comment does not repeat a type that the signature holds. |
238
+ | S6 | SHOULD | The prose follows Simplified Technical English (the rules of `repo-tools ste`). |
239
+
240
+ Only a MUST issue changes the exit code of `check`. A file that does not parse is also a failure,
241
+ because an unknown file is not a clean file. A repository with no source file fails too.
242
+
243
+ `stub` is a dry run until you pass `--apply`. Each stub holds the marker `TODO:`, so `check` fails
244
+ until you replace the stub with real prose. The command parses a file again after the change.
245
+ A file that would no longer parse stays unchanged. The command skips a file that is a link or
246
+ resolves outside the root, and it names the skipped file.
247
+
248
+ To gate a pull request and not the whole backlog, give `check` the changed files:
249
+
250
+ ```sh
251
+ git diff --name-only origin/main... > changed.txt
252
+ repo-tools docs check . --paths-from=changed.txt
253
+ ```
254
+
255
+ A `.code-docs.json` file at the root excludes paths. Each entry needs a reason, and the output
256
+ names each exclusion:
257
+
258
+ ```json
259
+ { "exclude": [ { "path": "assembly/", "reason": "AssemblyScript" } ] }
260
+ ```
261
+
262
+ `docs/design.md` (section 16) gives the rules, the exit codes and the differences from the Python
263
+ tool. `docs/parity-docs.md` records the comparison with that tool on 9 repositories.
264
+
213
265
  ## Query the graph
214
266
 
215
267
  `repo-tools query` answers questions from `dependency-graph.json` (and
@@ -269,6 +321,8 @@ the config key `query.out`, else from `map.out`, else from `docs/architecture`.
269
321
  | `bun run smoke -- <command...>` | Runs the smoke test against one way to run the tool. |
270
322
  | `bun run privacy` | Runs the privacy check on the tracked files and the commit messages. |
271
323
  | `bun run hooks` | Installs the `commit-msg` hook that runs the privacy check on each message. |
324
+ | `bun run audit:ledger` | Reverts each fix of `docs/fix-ledger-2.0.0.md` in a scratch copy and checks that a test of that fix fails. |
325
+ | `bun run check:design` | Finds each reference to a section of `docs/design.md` that has no heading with that number. |
272
326
 
273
327
  ## Design
274
328