autotel-cli 0.13.1 → 0.15.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 CHANGED
@@ -178,6 +178,72 @@ npx autotel add backend datadog --help
178
178
  - `--dry-run` - Skip installation and print what would be done
179
179
  - `--force` - Overwrite non-CLI-owned config (creates backup first)
180
180
 
181
+ ### `autotel map`
182
+
183
+ Reads your source, finds every entry point, and scores what context you would have when each one breaks. Static analysis only — nothing runs, nothing is sent anywhere.
184
+
185
+ ```bash
186
+ # Score the project and write autotel.map.json
187
+ npx autotel map
188
+
189
+ # Every entry point as a check matrix
190
+ npx autotel map --all
191
+
192
+ # Explain one entry point and how to fix it
193
+ npx autotel map app/api/checkout/route.ts
194
+ npx autotel map /api/checkout
195
+
196
+ # Machine-readable, for agents and CI
197
+ npx autotel map --json
198
+
199
+ # Fail CI below a threshold
200
+ npx autotel map --min-score 70
201
+
202
+ # Fail CI when a check that used to pass now fails
203
+ npx autotel map --baseline git:origin/main
204
+ ```
205
+
206
+ **Detected frameworks:** `next`, `nitro` (Nuxt), `tanstack-start`, `sveltekit`, `hono`, `express`, `fastify`, `elysia`, `cloudflare`. Override with `--framework <name>`.
207
+
208
+ **Checks:**
209
+
210
+ | Check | Weight | Question |
211
+ | --------------------- | ------ | --------------------------------------------------------------------- |
212
+ | `trace` | 40 | Does this entry point produce a span? |
213
+ | `context` | 25 | Does the span carry business context, or only method and status? |
214
+ | `audit` | 25 | Does this money or auth path leave an audit trail? (sensitive routes) |
215
+ | `structured-errors` | 15 | Do thrown errors explain why they failed and how to fix them? |
216
+ | `error-handling` | 10 | Does every catch block record the failure? |
217
+ | `page-error-handling` | 20 | Does a data-loading page handle its request failing? |
218
+
219
+ Suggestions never cost points. They cover untraced GenAI calls, validation
220
+ without telemetry, missing redaction, repeated inline errors that can use an
221
+ existing error catalog, and uncovered writes in a project that already records
222
+ security events.
223
+
224
+ Health checks, probes, and telemetry endpoints are exempt. Anything else can be waived in code:
225
+
226
+ ```ts
227
+ // autotel-map-disable error-handling -- returns a safe fallback on purpose
228
+ // autotel-map-disable-next-line audit, context -- internal-only route
229
+ handler(); // autotel-map-disable-line structured-errors -- delegated upstream
230
+ ```
231
+
232
+ Omit the check id to waive every finding in the selected scope. A waived check
233
+ costs no score and is never counted as coverage;
234
+ `summary.suppressedChecks` reports how many there are.
235
+
236
+ **`autotel.map.json`** is written next to `package.json` and is meant to be committed: `--baseline` compares against it per check, so a refactor that instruments one route and breaks another still fails. A run that detects a regression does not overwrite the file it compared against.
237
+
238
+ **Options:**
239
+
240
+ - `--all` - Show every entry point as a check matrix
241
+ - `--framework <name>` - Override framework detection
242
+ - `--min-score <n>` - Exit 1 when the global score is below this threshold
243
+ - `--baseline [source]` - Compare against a committed map (path, or `git:<ref>`); exit 1 on regression
244
+ - `--no-write` - Skip writing `autotel.map.json`
245
+ - `--json` / `--output-file <path>` - Machine-readable output
246
+
181
247
  ### `autotel codemod trace <path>`
182
248
 
183
249
  Wrap functions in `trace()` with a span name derived from the function/variable/method name. Use this to adopt autotel on existing code without changing function bodies.