feat(cli): add debug logging via CHKIT_DEBUG env variable#105
Merged
Conversation
Adds a lightweight stderr debug logger gated by CHKIT_DEBUG=1. Instruments config loading, command dispatch, all plugin lifecycle hooks, ClickHouse executor (queries, timing, errors), journal operations, schema loading, and per-command details (migrate, generate, status, drift, check). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
KeKs0r
added a commit
that referenced
this pull request
Mar 29, 2026
* refactor(plugin-obsessiondb): replace hand-rolled API client with ORPC Replace the manual fetch-based api-client.ts with a typed ORPC client backed by contracts copied from the platform repo. Narrows remote commands to status/cancel/list and adds --job-id/--service-id flags. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(plugin-obsessiondb): add grant_type to device token poll request RFC 8628 requires the grant_type field in the device authorization token request, which better-auth's device plugin enforces. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(plugin-obsessiondb): handle 400 responses in device token polling RFC 8628 device flow returns authorization_pending and slow_down as 400 responses. The !res.ok guard was throwing before the body could be parsed, preventing the existing switch/case from handling these expected states. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Commit currnet Progress * refactor(plugin-obsessiondb): migrate remote executor and services to oRPC Replace REST API calls with oRPC client for all remote operations. The remote executor now routes SQL through workbench.query.execute instead of the removed /api/v1/ endpoints. Extract shared introspection helpers (buildIntrospectedTables, normalize functions) from @chkit/clickhouse so both local and remote executors reuse the same logic. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat(cli): add debug logging via CHKIT_DEBUG env variable (#105) Adds a lightweight stderr debug logger gated by CHKIT_DEBUG=1. Instruments config loading, command dispatch, all plugin lifecycle hooks, ClickHouse executor (queries, timing, errors), journal operations, schema loading, and per-command details (migrate, generate, status, drift, check). Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * refactor(plugin-obsessiondb): replace hand-rolled API client with ORPC Replace the manual fetch-based api-client.ts with a typed ORPC client backed by contracts copied from the platform repo. Narrows remote commands to status/cancel/list and adds --job-id/--service-id flags. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(plugin-obsessiondb): add grant_type to device token poll request RFC 8628 requires the grant_type field in the device authorization token request, which better-auth's device plugin enforces. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(plugin-obsessiondb): handle 400 responses in device token polling RFC 8628 device flow returns authorization_pending and slow_down as 400 responses. The !res.ok guard was throwing before the body could be parsed, preventing the existing switch/case from handling these expected states. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Commit currnet Progress * refactor(plugin-obsessiondb): migrate remote executor and services to oRPC Replace REST API calls with oRPC client for all remote operations. The remote executor now routes SQL through workbench.query.execute instead of the removed /api/v1/ endpoints. Extract shared introspection helpers (buildIntrospectedTables, normalize functions) from @chkit/clickhouse so both local and remote executors reuse the same logic. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 Throw error on remote query failure --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CHKIT_DEBUG=1environment variable that enables detailed stderr logging across the CLIdebug.tsmodule with timestamped, categorized output (cli,config,clickhouse,plugin,hook,journal,schema,migrate,generate,status,drift,check,dispatch,context,command)debug()function returns immediately whenCHKIT_DEBUGis unsetTest plan
bun run buildandbun run typecheckpassCHKIT_DEBUG=1 chkit --versionshows debug line on stderr, stdout unaffectedCHKIT_DEBUG=1 chkit statusshows config resolution, fatal error with stack traceCHKIT_DEBUG, output is unchanged (no debug lines)CHKIT_DEBUG=1 chkit migrate --applyshows query timing, journal writes🤖 Generated with Claude Code