Skip to content

Extract control plane API client wrapper to @vectorless/control-plane#3

Merged
hallelx2 merged 1 commit into
mainfrom
halleluyaholudele/hal-330-extract-control-plane-api-client-wrapper-into-a-shared
Jun 20, 2026
Merged

Extract control plane API client wrapper to @vectorless/control-plane#3
hallelx2 merged 1 commit into
mainfrom
halleluyaholudele/hal-330-extract-control-plane-api-client-wrapper-into-a-shared

Conversation

@hallelx2

@hallelx2 hallelx2 commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Extracts the backend control plane HTTP client code from apps/web/lib/control-plane.ts into a new shared workspace package @vectorless/control-plane under packages/control-plane. Exposes it in apps/web/lib/control-plane.ts via a re-export to ensure no other imports break.

Closes HAL-330

Summary by Sourcery

Extract control-plane HTTP client into a shared workspace package and re-export it from the web app to preserve existing imports.

Enhancements:

  • Introduce new @vectorless/control-plane package containing the control plane HTTP client and typed helper wrappers.
  • Update web app to depend on the new control-plane package and re-export its API from the existing control-plane module.
  • Set up build and TypeScript configs (tsup, tsconfig) for the new control-plane package.

Summary by CodeRabbit

  • Refactor
    • Reorganized internal control-plane client code into a shared package structure for improved modularity and maintainability across the application.

@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vectorless-web Ready Ready Preview, Comment Jun 20, 2026 10:28pm

@sourcery-ai

sourcery-ai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Reviewer's Guide

Extracts the control plane HTTP client from the web app into a new shared @vectorless/control-plane package and re-exports it from the existing web lib entrypoint so existing imports keep working.

File-Level Changes

Change Details Files
Extract control plane HTTP client implementation into a new shared package and re-export from the web app entrypoint.
  • Moved the entire control plane HTTP client implementation (service/user callers, typed wrappers, error type, URL helper) from the web app lib into a new package entrypoint.
  • Replaced the previous implementation in the web app lib module with a re-export of the new shared package so existing call sites can continue importing from the old path.
apps/web/lib/control-plane.ts
packages/control-plane/src/index.ts
Introduce @vectorless/control-plane as a buildable workspace package.
  • Defined a package.json for the new package with dual-module outputs (CJS/ESM), type declarations, and build/dev/typecheck scripts.
  • Added a tsup build configuration targeting ES2022, generating CJS/ESM bundles and d.ts, with sourcemaps and no code splitting.
  • Added a package-local tsconfig that extends the repo base config, sets dist/src dirs, includes DOM and Node types, and includes src in compilation.
packages/control-plane/package.json
packages/control-plane/tsup.config.ts
packages/control-plane/tsconfig.json
Wire the new control plane package into the web app and workspace dependency graph.
  • Added @vectorless/control-plane as a workspace dependency of the web app so it can be consumed via both direct imports and the existing re-export.
  • Updated pnpm-lock.yaml to register the new package and ensure correct dependency resolution.
apps/web/package.json
pnpm-lock.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

The control-plane HTTP client, ControlPlaneError class, controlPlaneServiceCall/controlPlaneUserCall helpers, and typed controlPlane endpoint wrappers are extracted from apps/web/lib/control-plane.ts into a new workspace package packages/control-plane. The web app module is replaced with a single export * from "@vectorless/control-plane" re-export.

Changes

Control-plane package extraction

Layer / File(s) Summary
Package scaffold
packages/control-plane/package.json, packages/control-plane/tsconfig.json, packages/control-plane/tsup.config.ts
New private @vectorless/control-plane package with dist/ entrypoints and exports map, TypeScript config targeting ES2022 with Node types, and tsup build producing CJS+ESM with declarations and sourcemaps.
Client implementation
packages/control-plane/src/index.ts
Environment-based URL/token config, ControlPlaneError class and CallOptions interface, controlPlaneServiceCall (bearer-token auth) and controlPlaneUserCall (cookie-forwarding auth) fetch helpers with error handling and response normalization, typed controlPlane.identity.* and controlPlane.oauth.* wrappers, and controlPlaneUrl() export.
Web app wiring
apps/web/lib/control-plane.ts, apps/web/package.json
Adds @vectorless/control-plane as a workspace:* dependency and replaces the local module body with export * from "@vectorless/control-plane".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 Hippity-hop, I carved out the code,
No more long files down a single road!
A package was born with its own little nest,
export * points back—the barrel knows best.
Now web apps and packages share in the glee,
One source of truth, just as it should be! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective of the changeset: extracting the control plane API client from apps/web/lib/control-plane.ts into a new shared package @vectorless/control-plane.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch halleluyaholudele/hal-330-extract-control-plane-api-client-wrapper-into-a-shared

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.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Consider exporting the CallOptions type so downstream callers of controlPlaneServiceCall / controlPlaneUserCall can reuse the same options shape instead of re-declaring it.
  • Now that this lives in a shared package, you may want to make the base URL and service token configurable (e.g., via a factory or parameters) rather than reading process.env directly, to make the client easier to reuse in non-Node/non-Next runtimes and in tests.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider exporting the `CallOptions` type so downstream callers of `controlPlaneServiceCall` / `controlPlaneUserCall` can reuse the same options shape instead of re-declaring it.
- Now that this lives in a shared package, you may want to make the base URL and service token configurable (e.g., via a factory or parameters) rather than reading `process.env` directly, to make the client easier to reuse in non-Node/non-Next runtimes and in tests.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@hallelx2 hallelx2 merged commit 7f9ec48 into main Jun 20, 2026
7 of 8 checks passed
@hallelx2 hallelx2 deleted the halleluyaholudele/hal-330-extract-control-plane-api-client-wrapper-into-a-shared branch June 20, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant