Skip to content

refactor(api): move bapiRequest into lib/bapi.ts#359

Open
rafa-thayto wants to merge 1 commit into
mainfrom
refactor/api-bapi-to-lib
Open

refactor(api): move bapiRequest into lib/bapi.ts#359
rafa-thayto wants to merge 1 commit into
mainfrom
refactor/api-bapi-to-lib

Conversation

@rafa-thayto

Copy link
Copy Markdown
Contributor

Stacked on #345.

Follow-up to the fapiRequest relocation in #345. That PR moved the FAPI passthrough wrapper into lib/fapi.ts and left bapiRequest in commands/api/bapi.ts, which broke the symmetry between the two API clients. This restores it.

What changed

  • commands/api/bapi.tslib/bapi.ts (now a sibling of lib/fapi.ts)
  • commands/api/bapi.test.tslib/bapi.test.ts
  • Updated all importers (api/index.ts, users/{create,list,lifecycle-runner}.ts, users/interactive/pick-user.ts) and their mock.module paths
  • Fixed the stale commands/api/bapi.ts reference in the BapiError doc comment and .claude/rules/errors.md

Both wrappers now live in the leaf lib/ layer and return the shared ApiResponse type from lib/fetch.ts (introduced in #345), so nothing in lib/ imports upward from commands/.

No behavior change — pure relocation. Empty changeset added since it touches non-exempt packages/** paths with no user-facing impact.

Test plan

  • bun run format
  • bun run lint
  • bun run typecheck
  • bun run test (1691 pass)

https://claude.ai/code/session_01QnfBw9qY7u19BvUWyfQGC6

@changeset-bot

changeset-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3888f1e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@rafa-thayto rafa-thayto requested a review from wyattjoh June 22, 2026 19:30
Base automatically changed from feat/api-fapi-passthrough to main June 22, 2026 19:31
@rafa-thayto rafa-thayto force-pushed the refactor/api-bapi-to-lib branch from ae4e22f to 283259e Compare June 22, 2026 20:42
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8d2d462f-ec35-499f-a310-701ad48167d4

📥 Commits

Reviewing files that changed from the base of the PR and between 0989251 and 3888f1e.

📒 Files selected for processing (13)
  • .changeset/free-breads-pick.md
  • .claude/rules/errors.md
  • packages/cli-core/src/commands/api/index.ts
  • packages/cli-core/src/commands/users/create.test.ts
  • packages/cli-core/src/commands/users/create.ts
  • packages/cli-core/src/commands/users/interactive/pick-user.test.ts
  • packages/cli-core/src/commands/users/interactive/pick-user.ts
  • packages/cli-core/src/commands/users/lifecycle-runner.ts
  • packages/cli-core/src/commands/users/list.test.ts
  • packages/cli-core/src/commands/users/list.ts
  • packages/cli-core/src/lib/bapi.test.ts
  • packages/cli-core/src/lib/bapi.ts
  • packages/cli-core/src/lib/errors.ts
✅ Files skipped from review due to trivial changes (7)
  • packages/cli-core/src/lib/bapi.test.ts
  • .claude/rules/errors.md
  • .changeset/free-breads-pick.md
  • packages/cli-core/src/lib/errors.ts
  • packages/cli-core/src/commands/api/index.ts
  • packages/cli-core/src/lib/bapi.ts
  • packages/cli-core/src/commands/users/interactive/pick-user.ts
🚧 Files skipped from review as they are similar to previous changes (6)
  • packages/cli-core/src/commands/users/list.test.ts
  • packages/cli-core/src/commands/users/interactive/pick-user.test.ts
  • packages/cli-core/src/commands/users/lifecycle-runner.ts
  • packages/cli-core/src/commands/users/list.ts
  • packages/cli-core/src/commands/users/create.test.ts
  • packages/cli-core/src/commands/users/create.ts

📝 Walkthrough

Walkthrough

bapiRequest is consolidated to src/lib/bapi.ts. That file’s internal imports now use local sibling paths. Command files and their tests update import and mock paths to the shared module. Documentation in errors.ts and errors.md is updated to reference the new location, and a changeset file is added.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed It clearly describes the main change: relocating bapiRequest into lib/bapi.ts.
Description check ✅ Passed It matches the changeset and correctly summarizes the relocation and import updates.
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.

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

@rafa-thayto rafa-thayto force-pushed the refactor/api-bapi-to-lib branch from 283259e to 0989251 Compare June 26, 2026 19:59
Mirror the fapiRequest relocation: the BAPI passthrough wrapper now
lives in lib/bapi.ts as a sibling to lib/fapi.ts, so both API clients
sit in the leaf layer instead of one being a command module. Updates
all importers and the relocated bapi test; no behavior change.

Claude-Session: https://claude.ai/code/session_01QnfBw9qY7u19BvUWyfQGC6
@rafa-thayto rafa-thayto force-pushed the refactor/api-bapi-to-lib branch from 0989251 to 3888f1e Compare June 27, 2026 12:13
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