Skip to content

feat(syncs,usage,imports): add syncs, usage, and imports preflight#19

Merged
dgilperez merged 1 commit into
mainfrom
feat/cli-syncs-usage-cmds
May 23, 2026
Merged

feat(syncs,usage,imports): add syncs, usage, and imports preflight#19
dgilperez merged 1 commit into
mainfrom
feat/cli-syncs-usage-cmds

Conversation

@dgilperez
Copy link
Copy Markdown
Collaborator

Adds the rest of the read-only API surface flagged in #11 (P2):

Endpoint Command(s)
GET /api/v1/syncs syncs list (paged)
GET /api/v1/syncs/latest syncs latest
GET /api/v1/syncs/:id syncs show <id>
GET /api/v1/usage usage show
POST /api/v1/imports/preflight imports preflight

Notes

  • `syncs` vs `sync` — the existing `sync` command POSTs to `/api/v1/sync` to trigger a sync. The new `syncs` subtree is read-only inspection of sync history. Both kept, no breaking change.
  • `usage show` returns API key scope + rate-limit info (`tier`, `limit`, `current_count`, `remaining`, `reset_in_seconds`, `reset_at`) or an OAuth notice depending on the auth method.
  • `imports preflight` is read-only — no `--apply` gate. Mirrors `imports create` flags including `--rows-to-skip` (full `Import::Preflight::PARAM_KEYS` set). Requires `--type` and exactly one of `--file`/`--raw-file-content`.

Tests

  • Command shape + registration for syncs / usage / imports preflight.
  • Preflight payload builder: type missing, content source missing, both sources provided, raw content propagation including `rows_to_skip`.

`go test ./...` green across the suite.

Refs #11.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 23, 2026

Warning

Review limit reached

@dgilperez, we couldn't start this review because you've used your available PR reviews for now.

Your plan currently allows 1 review/hour. Refill in 52 minutes and 32 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 126cba53-4952-4cae-b327-9491698542f1

📥 Commits

Reviewing files that changed from the base of the PR and between 7e20ce2 and 4478b25.

📒 Files selected for processing (10)
  • README.md
  • cmd/sure-cli/root/imports_cmd.go
  • cmd/sure-cli/root/imports_preflight_cmd.go
  • cmd/sure-cli/root/imports_preflight_cmd_test.go
  • cmd/sure-cli/root/root.go
  • cmd/sure-cli/root/syncs_cmd.go
  • cmd/sure-cli/root/syncs_cmd_test.go
  • cmd/sure-cli/root/usage_cmd.go
  • cmd/sure-cli/root/usage_cmd_test.go
  • docs/ROADMAP.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cli-syncs-usage-cmds

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@superagent-security superagent-security Bot added contributor:verified Contributor passed trust analysis. pr:verified PR passed security analysis. labels May 23, 2026
…mmands

Closes the rest of the read-only API surface flagged as P2 in #11.

- `syncs list` (paged), `syncs latest`, `syncs show <id>` over the
  upstream `/api/v1/syncs` collection (separate from the existing
  `sync` command, which POSTs to `/api/v1/sync` to trigger).
- `usage show` over the `/api/v1/usage` singleton; returns API key
  scope + rate-limit info (or OAuth notice).
- `imports preflight` validates an import config + content before
  creating an Import record. Mirrors `imports create` flags (full
  `Import::Preflight::PARAM_KEYS` set including `rows_to_skip`) but is
  read-only — no `--apply` gate. Requires `--type` and one of
  `--file`/`--raw-file-content`.

Tests cover command shape and registration; preflight payload builder
has dedicated unit tests for the required-field invariants
(type missing, content source missing, both sources provided).

Refs #11.
@dgilperez dgilperez force-pushed the feat/cli-syncs-usage-cmds branch from b5c09e4 to 4478b25 Compare May 23, 2026 19:36
@dgilperez dgilperez merged commit a9210fe into main May 23, 2026
5 checks passed
@dgilperez dgilperez deleted the feat/cli-syncs-usage-cmds branch May 23, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor:verified Contributor passed trust analysis. pr:verified PR passed security analysis.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant