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: 283259e

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
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 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

Run ID: dbdcb305-e0ea-489a-9881-b701ca3dd442

📥 Commits

Reviewing files that changed from the base of the PR and between 8f54a92 and 283259e.

📒 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

📝 Walkthrough

Walkthrough

bapiRequest is consolidated to a single canonical location at src/lib/bapi.ts. The file itself has its internal imports corrected from ../../lib/... to local ./... sibling paths. All consumer command files (commands/api/index.ts, users/create.ts, users/list.ts, users/lifecycle-runner.ts, users/interactive/pick-user.ts) update their import paths to reference ../../lib/bapi.ts (or ../../../lib/bapi.ts). Corresponding test files update their mock.module targets to match. Doc comments in errors.ts and errors.md are updated to reference the new path, and a changeset entry 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 The title clearly and concisely describes the main change: moving bapiRequest to lib/bapi.ts, which is the primary structural change in this refactor.
Description check ✅ Passed The description is directly related to the changeset, explaining the relocation of bapiRequest, updated imports, and documentation fixes with clear context.
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.


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.

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