chore: [PoC] Phase 1 — SQLite event write infrastructure for dev tools usage reporting#28681
chore: [PoC] Phase 1 — SQLite event write infrastructure for dev tools usage reporting#28681NicolasMassart wants to merge 1 commit intomainfrom
Conversation
This commit introduces a new SQLite database setup for tracking tool usage events. It includes the following changes: - Added `db.ts` for database initialization and schema creation. - Implemented `trackEvent` function in `events.ts` to log events with relevant metadata. - Created test files for both database operations and event tracking to ensure functionality and reliability. - Added a CLI script (`tool-usage-collection.ts`) for collecting tool usage data via command-line arguments. Additionally, updated `package.json` and `yarn.lock` to include necessary dependencies for SQLite and TypeScript support. CHANGELOG entry: Added SQLite database handling for tool usage tracking.
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
🔍 Smart E2E Test Selection⏭️ Smart E2E selection skipped - draft PR All E2E tests pre-selected. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Caution MetaMask internal reviewing guidelines:
|
PR Title
chore: [PoC] Phase 1 — SQLite event write infrastructure for dev tools usage reporting
Description
Part of MCWP-448 (Dev Tools Usage Reporting PoC). This is Phase 1 — the core write infrastructure that all subsequent phases depend on.
Adds a local SQLite-backed event writer so developer tool and agent skill usage can be voluntarily recorded on the developer's machine. Nothing is sent anywhere — data stays in
~/.tool-usage-collection/events.dbuntil the developer explicitly exports it viayarn tooling:report(Phase 3).What's included:
scripts/tooling/tsconfig.json— isolated TypeScript config for tooling scripts (no React Native / JSX settings)scripts/tooling/db.ts— opens/creates the SQLite DB, applies WAL mode for safe concurrent writes, and runsCREATE TABLE IF NOT EXISTSschema migrationscripts/tooling/events.ts—trackEvent()shared write function used by both the CLI wrapper and the future MCP server; detects the current git repo automatically; always writes errors to stderr, never throwsscripts/tooling/tool-usage-collection.ts— thin CLI wrapper aroundtrackEvent()for use in yarnpre/posthooks and Claude Code bash hooks; validates all args strictly (--successmust be"true"|"false",--durationmust be a non-negative integer); supports--verbosefor agent callers (TOON-style confirmation + hint line) and--helppackage.json— addsbetter-sqlite3,@types/better-sqlite3, andtsxas devDependencies (withdependenciesMeta.built: trueto allow native compilation underenableScripts: false);.cursor/agents/axi-tooling-reviewer.md— project-level subagent that reviews scripts against the 10 AXI (Agent eXperience Interface) principlesDesign decisions:
finallyblock to prevent descriptor leaks on insert failure@modelcontextprotocol/sdkintentionally deferred to Phase 2 (where it will be used bytooling-mcp-server.ts)tsx— no compilation stepTest coverage: 40 unit tests across 3 suites (
db.test.ts,events.test.ts,tool-usage-collection.test.ts)Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/MCWP-512
Refs: https://consensyssoftware.atlassian.net/browse/MCWP-448
Manual testing steps
Screenshots/Recordings
Before
N/A
After
TODO
Pre-merge author checklist
Pre-merge reviewer checklist