Repository navigation
feat(cli): add data and warehouse commands on the Metrics API - #122
Conversation
There was a problem hiding this comment.
Hi! I looked through the code and left a few comments from the technical side but, unfortunately, I don't have access to the board you linked to this PR so I can't judge the functionality itself since I lack the context about the feature.
Would be nice to get a reference with the info, purpose, and the reasons behind the feature. Thanks!
P.S. I think we should avoid linking internal resources in public repos 🙃
d33d3f3 to
2f17780
Compare
bespoyasov
left a comment
There was a problem hiding this comment.
Thanks for the update! Several points from the previous round are addressed. I left comments on what's still open, plus a few new findings.
General notes:
- The PR is quite large (39 files, ~2.5k lines) and mixes the core
apiRequestrewrite, a global telemetry change, a global table-format change, a new test runner, and 5 command groups. I'd split the cross-cutting changes into separate PRs. - CLAUDE.md and the
cliskill still don't list the newdatacommand/feature; please, update them. - Per the description, successful create and
sql previewhaven't been verified against a live API yet.
bespoyasov
left a comment
There was a problem hiding this comment.
Two more findings from an automated (Xirp) review pass.
aa93c4b to
db42cd4
Compare
Adds data fact-tables, dimension-tables, entities and sql commands, plus warehouse list and get, calling the regional Metrics API directly. Commands build one operation each; a shared runner handles dry-run, auth, output and errors. Tests mock the API through shared Metrics MSW handlers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
db42cd4 to
1cf5dd6
Compare
A state the CLI doesn't know is shown as the service sends it instead of failing, and --wait keeps polling on unset or unknown states until --timeout, stopping only on COMPLETED, FAILED or CANCELLED. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bespoyasov
left a comment
There was a problem hiding this comment.
Nice!
As a follow-up, let's mention the data onboarding on one of the final screens in the quickstart wizard and its report file?
(Roughly in the same manner as we mention migration from other feature flag providers)
Why
The CLI talks to Confidence mostly through the MCP server, which wraps the REST APIs. For a CLI that's an extra hop, and it means each new command needs an MCP tool built first. We're moving the CLI to call the Confidence REST APIs directly. This PR is the first step: data commands built on the Metrics API.
Builds on #144 (the core
apiRequestchanges) and #145 (no telemetry on--dry-run), both merged.What
New commands, all calling the regional Metrics API with the user's token (or
--profile):confidence data fact-tables list | get | createconfidence data dimension-tables list | get | createconfidence data entities list | getconfidence data sql preview [--wait] | status | schemaconfidence warehouse list | get(infeatures/warehouse/)features/data/is split intoapi.ts(the client only),resources.ts(paging and gets),operations.ts(one operation per command, plus write-once creates) andrequest.ts(dry-run, auth, output and errors).--allup to 1000 pages. A repeated page token fails rather than looping. Table output shows one row per item.--name, and check that the response names the same resource.--dry-run: usesdryRunGuard. It prints{ request, local }and sends nothing.The CLI never prints warehouse secrets (Databricks
clientSecret, RedshiftsecretAccessKey), never fetches SQL sample rows, and rejectsskipSqlPreview: trueon both fact and dimension tables.fact-tables suggest-columnsis left out: its RPC isn't exposed on the edge, and the metrics team considers it legacy.Nested values in data table output stay on one line. This is scoped to the data commands; the shared
printis unchanged.Supersedes #123–#129.
Testing
pnpm qapasses.runCli, with the Metrics API mocked by shared handlers intesting(metricsReturns,metricsFails,metricsRequests). I broke each safety guard on purpose to confirm a test catches it.sql statusandsql schemacommand.sql previewwere run live on a managed-warehouse account, which rejects SQL authoring; the CLI showed that rejection correctly. A successful create and preview still need an account with its own warehouse.🤖 Generated with Claude Code