feat: add backend CLI commands (authenticate, underwrite, tap-credit)#10
Merged
feat: add backend CLI commands (authenticate, underwrite, tap-credit)#10
Conversation
…credit Implements three new factoring subcommands that interact with the Bulla backend API: - `factoring authenticate` — derives wallet from private key, signs SIWE challenge, returns JWT - `factoring underwrite` — submits claim IDs for underwriting via backend API - `factoring tap-credit` — batch tap-credit requests from a JSON file New files: - Domain types for backend request/response shapes - BackendClientService port with Context.Tag-based DI - HTTP implementation using native fetch - CLI command definitions following existing patterns - 12 mock-based unit tests covering JWT extraction, service calls, and request construction DEV-2462 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ning Replace mock-only unit tests with CLI-level tests that invoke the actual commands via runCli(). Tests now validate argument parsing, JWT extraction errors, and file handling through the full command pipeline. Added real SIWE signing integration test that signs and recovers a message using viem, verifying the authenticate flow works end-to-end. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bengobeil
requested changes
Mar 18, 2026
Contributor
bengobeil
left a comment
There was a problem hiding this comment.
I still want the backend mocked. but at least this is closer to the desired scope.
Use a real HTTP server in tests to exercise the full CLI pipeline: authenticate signs SIWE with real signature verification, underwrite and tap-credit send requests through the mock and verify JSON output. Backend URLs are now configurable via BULLA_AUTH_URL / BULLA_UW_URL env vars (defaulting to production). Added async runCliAsync helper to avoid spawnSync blocking the event loop while mock server responds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bengobeil
approved these changes
Mar 18, 2026
The CLI-level tests spawn `node dist/index.js` and need the build output to exist. Moving from *.test.ts to *.e2e.test.ts ensures they run during `yarn test:e2e` (after build) rather than `yarn test`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bengobeil
approved these changes
Mar 18, 2026
Contributor
|
🎉 This PR is included in version 0.0.9 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds three new factoring subcommands (authenticate, underwrite, tap-credit) that call the Bulla backend API. Follows existing CLI architecture with Command.make(), Effect.gen(), and Layer-based DI. Includes 12 mock-based unit tests. All 190 tests pass. Closes DEV-2462