diff --git a/README.md b/README.md index e69230f..b3a9146 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,8 @@ To review what an external caller can reach by invoking a handler, use `--entry- Repeat `--entry` to combine entry points or `--project` to select multiple configs. Output files must be new. Use `--strict` when a partial result should set exit code 2. The CLI still produces the report. +For scripts that save JSON, see the [0.x report compatibility rules](docs/reference.html#compatibility) and [CLI exit codes](docs/reference.html#exit-codes). + Check diagnostics before interpreting counts. Call sites measure source occurrences. Runtime dispatch, callbacks, and external consumers can introduce paths the scanner cannot see. Review declarations with no known path before considering removal. ## Use the library diff --git a/docs/reference.html b/docs/reference.html index c2a8dff..6973ded 100644 --- a/docs/reference.html +++ b/docs/reference.html @@ -28,9 +28,11 @@ On this page @@ -104,13 +106,28 @@
--output new-file--strict-h, --help0 · Success--strict, both complete and
+ partial scans succeed. Check the JSON completeness field when the distinction matters.
+ 1 · Command failed--output file may be from an earlier run.
+ 2 · Strict scan produced a partial report--output. Inspect its diagnostics before
+ using the results. A complete scan with --strict exits with 0.
+ node dist/cli.js . --project tsconfig.build.json --exclude '**/generated/**' --test 'qa/**'
@@ -198,14 +215,52 @@
+ Use --format json for scripts. The packaged JSON Schema lists
+ the required properties, types, allowed values and nullable fields for each report. Summary, Markdown,
+ diagnostic messages and limitation text are for display. --changed-since produces a text summary.
+
schemaVersion === 1 for the layout above. Save the full inventory to run new
+ usages or reachability queries later. Use analyzer.version and
+ analyzer.compilerVersion to identify the producer.
+ schemaVersion === 1 and read usage.symbol,
+ usage.references and usage.counts. The CLI puts snapshot-wide diagnostics
+ alongside usage.
+ schemaVersion. Validate it against the schema’s
+ entryReport definition. File roots appear in entries. The optional
+ entrySymbols lists explicitly invoked declarations. Use reached to reconstruct
+ paths and declarations to look up reachability status.
+
+ All three shapes carry snapshotId, completeness and diagnostics. Keep
+ the matching inventory or its producer metadata with a saved query. Treat IDs as opaque and join records only
+ within the same snapshot. A fresh scan with an improved resolver can produce different IDs, counts, paths or
+ diagnostics for the same source.
+
+ Within schema version 1, readers can rely on required fields and their documented meanings. Producers may add
+ optional fields and diagnostic codes. Ignore unfamiliar properties, handle unfamiliar codes, and allow
+ optional fields such as files[].project to be absent. A required field with a nullable type, such
+ as references[].callerId, is present even when its value is null.
+
- The JSON Schema describes all three CLI report shapes. For persisted data - check schemaVersion before reading a full inventory or symbol response. The entry response has the - Reachability shape in the shipped TypeScript declarations. In 0.1.0 it has no schemaVersion. Keep analyzer and - compiler versions from the full snapshot alongside query results. Use snapshot-local IDs for joins. Accept - additional fields and unknown diagnostic codes. Compare counts across upgrades against source examples; - changes in resolution can change a result even when its shape stays compatible. Keep the generating version - for older snapshots. During 0.x the format and API can change. + During 0.x, a change that invalidates existing reports or breaks a reader following these rules belongs in a + new minor release with migration instructions. An incompatible JSON shape also needs a new schema version, + including an explicit version on a replacement for the unversioned entry report. A change to the documented + exit codes is likewise a breaking CLI change. Before moving to another minor release, validate a saved report + with the target schema and replay a representative query. For an unsupported version, retain the original + report and use its generating release until you migrate.
TS-prefixed codes are compiler diagnostics. unresolved-module and dynamic-module identify missing module