@databuddy/scan 0.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.
- package/LICENSE +21 -0
- package/README.md +49 -0
- package/dist/cli.js +1918 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Databuddy Analytics, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Databuddy scan
|
|
2
|
+
|
|
3
|
+
Find places to add product analytics events in a Git repository, with live terminal progress.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npx @databuddy/scan --run
|
|
7
|
+
# or
|
|
8
|
+
bunx @databuddy/scan --run
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Requires Git, Node.js 22+, and a Vercel AI Gateway key in `AI_GATEWAY_API_KEY` or your repository's `.env`. To run directly on Bun without Node, use `bunx --bun @databuddy/scan --run` (Bun 1.2+).
|
|
12
|
+
|
|
13
|
+
Run without `--run` to preview the number of eligible files without sending code. **`--run` sends included source code to Jev through your Vercel AI Gateway account**, requesting zero data retention. Provider charges may apply. The scanner reads tracked files from your working tree, including uncommitted edits; it excludes tests, examples, symlinks, unsupported files, and detected embedded secrets. Detection is not a guarantee that source contains no secrets.
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npx @databuddy/scan --report # Saved summary
|
|
17
|
+
npx @databuddy/scan --report --verbose # Every flagged source location
|
|
18
|
+
npx @databuddy/scan --diagnostics # Failures, retries and output quality
|
|
19
|
+
npx @databuddy/scan --fresh # Scan again without reusing responses
|
|
20
|
+
npx @databuddy/scan --run --no-actions # Review whole files instead of grouped actions
|
|
21
|
+
npx @databuddy/scan --help # All options
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Press Ctrl+C to save completed work. Repeat `--run` to resume using successful cached responses. Findings are potential gaps to review in source, not verified insertion points or automatically added events. Source context can miss shared tracking wrappers and callees.
|
|
25
|
+
|
|
26
|
+
Grouped action review is the default. It groups JavaScript/TypeScript action handlers with callback and persistence evidence, so a button and its mutation are evaluated together. Routine UI state changes and name-only helpers do not become independent candidates. Unresolved or oversized context is recorded with the finding; unsupported files fall back to whole-source review, and files that parse with no action are not reviewed at all (`--no-actions` reviews everything). On a 190-item labelled intersection, grouping raised covered precision from 51.6% to 93.9% (p=0.027) at 2.4x the speed. This is a bounded syntax analysis, not a complete call graph.
|
|
27
|
+
|
|
28
|
+
Results, response caches and request logs are stored under `$XDG_CACHE_HOME/databuddy/scan/<repository-hash>` or `~/.cache/databuddy/scan/<repository-hash>`. Use `--output=/path/to/results` to choose another location, or `--root=/path/to/repository` to scan elsewhere. Reports work offline; `--cache-only` replays matching responses without network access or writes.
|
|
29
|
+
|
|
30
|
+
Request logs contain timing, retries and provider error codes, without credentials, source bodies or raw provider error bodies. The private local inventory includes file paths, hashes and tracking-call snippets. `--json` writes the result to stdout without progress output; `--plain` disables terminal control codes.
|
|
31
|
+
|
|
32
|
+
For local development from the monorepo root:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
bun ./scan.ts --run
|
|
36
|
+
bun run --cwd packages/scan build
|
|
37
|
+
bun run --cwd packages/scan check-types
|
|
38
|
+
bun run --cwd packages/scan test
|
|
39
|
+
bun run --cwd packages/scan eval:quality # Offline extraction report
|
|
40
|
+
bun run --cwd packages/scan eval:quality --run # Bounded live comparison
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
TypeScript source compiles to `dist/cli.js`. Commander handles arguments, Zod validates inputs and model responses, p-limit schedules requests, and Chalk/log-update render terminal progress. The npm package contains the compiled executable; users do not need to build it.
|
|
44
|
+
|
|
45
|
+
Quality tests use synthetic source to reproduce the reviewed misses, duplicate flags, noise, and ambiguous callbacks. They verify extraction and evidence, not model accuracy. The optional live comparison uses 20 previously reviewed Databuddy targets, keeps review labels out of prompts, and reports unmatched or ambiguous targets separately. This selected set is a regression check, not a whole-repository accuracy estimate. It sends source through the same Gateway account as a normal scan.
|
|
46
|
+
|
|
47
|
+
Grouping is the default, on a 190-item labelled intersection where it raised covered precision from 51.6% to 93.9% (McNemar p=0.027) at 2.4x the speed of whole-file review. Known gaps: only `onClick`, `onSubmit` and `onCopy` seed a candidate, so selector-driven workflows using `onValueChange`, `onCheckedChange` or `onSelect` are missed; docs-copy and upgrade controls still classify as operational.
|
|
48
|
+
|
|
49
|
+
Licensed under MIT; see [LICENSE](LICENSE).
|