You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+23-23Lines changed: 23 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,15 +72,15 @@ Bun replaces the entire Node.js toolchain. There are no separate tools for trans
72
72
73
73
This is a Bun workspace monorepo with four packages:
74
74
75
-
-**`@bunny.net/api`** (`packages/api/`) — Standalone, type-safe API client SDK for bunny.net. Zero CLI dependencies. Publishable to npm.
75
+
-**`@bunny.net/openapi-client`** (`packages/openapi-client/`) — Standalone, type-safe OpenAPI client for bunny.net, generated from OpenAPI specs. Zero CLI dependencies. Publishable to npm.
76
76
-**`@bunny.net/app-config`** (`packages/app-config/`) — Shared app configuration schemas (Zod), inferred types, JSON Schema generation, and API conversion functions. Used by the CLI and potentially other tools.
77
77
-**`@bunny.net/database-shell`** (`packages/database-shell/`) — Standalone interactive SQL shell for libSQL databases. Framework-agnostic REPL, dot-commands, formatting, masking, and history. Also usable as a standalone CLI (binary: `bsql`).
78
-
-**`@bunny.net/cli`** (`packages/cli/`) — The CLI. Depends on `@bunny.net/api`, `@bunny.net/app-config`, and `@bunny.net/database-shell`.
78
+
-**`@bunny.net/cli`** (`packages/cli/`) — The CLI. Depends on `@bunny.net/openapi-client`, `@bunny.net/app-config`, and `@bunny.net/database-shell`.
│ │ ├── format.test.ts # Tests for format utilities
150
150
│ │ ├── logger.ts # Chalk-based structured logger
@@ -266,7 +266,7 @@ bunny-cli/
266
266
267
267
### Conventions
268
268
269
-
-**Monorepo with Bun workspaces.**`packages/api/` is the standalone API client SDK; `packages/app-config/` provides shared Zod schemas, types, and API conversion functions for `bunny.jsonc`; `packages/database-shell/` is the standalone SQL shell engine; `packages/cli/` is the CLI.
269
+
-**Monorepo with Bun workspaces.**`packages/openapi-client/` is the standalone API client SDK; `packages/app-config/` provides shared Zod schemas, types, and API conversion functions for `bunny.jsonc`; `packages/database-shell/` is the standalone SQL shell engine; `packages/cli/` is the CLI.
270
270
-**API clients use `ClientOptions`** — an options object with `apiKey`, `baseUrl`, `verbose`, `userAgent`, and `onDebug`. The CLI provides a `clientOptions(config, verbose)` helper to build this from `ResolvedConfig`.
271
271
-**One command per file.** Each file in `commands/` exports a single command or namespace.
272
272
-**Commands are grouped by domain** in subdirectories (`config/`, `db/`, `scripts/`).
@@ -275,8 +275,8 @@ bunny-cli/
275
275
-**Top-level commands** (`login`, `logout`, `whoami`) are registered directly in `cli.ts` without a namespace.
276
276
-**Shared internal code lives in `packages/cli/src/core/`** — command factories, errors, logger, format utilities, UI helpers, and shared types. Keep this flat (no nested subdirectories).
277
277
-**Config logic lives in `packages/cli/src/config/`** — schema, file resolution, and profile management.
278
-
-**Error classes are split.**`UserError` and `ApiError` live in `@bunny.net/api` (the SDK needs them). `ConfigError` lives in the CLI and extends `UserError`. The CLI's `errors.ts` re-exports `UserError` and `ApiError` from `@bunny.net/api`.
279
-
-**Import API clients from `@bunny.net/api`**, not relative paths. Import generated types from `@bunny.net/api/generated/<spec>.d.ts`.
278
+
-**Error classes are split.**`UserError` and `ApiError` live in `@bunny.net/openapi-client` (the SDK needs them). `ConfigError` lives in the CLI and extends `UserError`. The CLI's `errors.ts` re-exports `UserError` and `ApiError` from `@bunny.net/openapi-client`.
279
+
-**Import API clients from `@bunny.net/openapi-client`**, not relative paths. Import generated types from `@bunny.net/openapi-client/generated/<spec>.d.ts`.
280
280
281
281
---
282
282
@@ -508,7 +508,7 @@ Creates an `ora` spinner. Automatically silenced in non-TTY environments (`isSil
508
508
509
509
### API error normalization
510
510
511
-
The Bunny APIs use two different error response formats. The shared `authMiddleware()` in `packages/api/src/middleware.ts` normalizes both into `ApiError` via an `onResponse` handler, so command code never deals with raw HTTP errors.
511
+
The Bunny APIs use two different error response formats. The shared `authMiddleware()` in `packages/openapi-client/src/middleware.ts` normalizes both into `ApiError` via an `onResponse` handler, so command code never deals with raw HTTP errors.
All clients accept a `ClientOptions` object and inject `AccessKey` and `User-Agent` headers via shared `authMiddleware()` in `packages/api/src/middleware.ts`.
806
+
All clients accept a `ClientOptions` object and inject `AccessKey` and `User-Agent` headers via shared `authMiddleware()` in `packages/openapi-client/src/middleware.ts`.
807
807
808
808
### ClientOptions
809
809
@@ -823,7 +823,7 @@ The CLI provides a `clientOptions()` helper (`packages/cli/src/core/client-optio
823
823
824
824
### Undocumented endpoints (`CustomPaths`)
825
825
826
-
Some Bunny API endpoints are not included in the public OpenAPI specs. These are typed manually via a `CustomPaths` type in `packages/api/src/core-client.ts`, which is intersected with the generated `paths`:
826
+
Some Bunny API endpoints are not included in the public OpenAPI specs. These are typed manually via a `CustomPaths` type in `packages/openapi-client/src/core-client.ts`, which is intersected with the generated `paths`:
@@ -847,29 +847,29 @@ Only fall back to `string`, `any`, or `number` when no generated type exists (e.
847
847
848
848
### OpenAPI specs
849
849
850
-
Specs are committed as JSON files in `packages/api/specs/`. Generated types go to `packages/api/src/generated/` (gitignored). The `redocly.yaml` config and `openapi-typescript` devDependency live in the `@bunny.net/api` package.
850
+
Specs are committed as JSON files in `packages/openapi-client/specs/`. Generated types go to `packages/openapi-client/src/generated/` (gitignored). The `redocly.yaml` config and `openapi-typescript` devDependency live in the `@bunny.net/openapi-client` package.
-`packages/cli/` (`@bunny.net/cli`) — the CLI, depends on all three
@@ -43,7 +43,7 @@ This is a Bun workspace monorepo with four packages:
43
43
- Handle `--output json` first in every handler, then pass `output` to format functions.
44
44
- Use `logger` from `packages/cli/src/core/logger.ts` for all user-facing output.
45
45
- Throw `UserError` for expected errors.
46
-
- Import API clients from `@bunny.net/api`, not relative paths. Import generated types from `@bunny.net/api/generated/<spec>.d.ts`.
46
+
- Import API clients from `@bunny.net/openapi-client`, not relative paths. Import generated types from `@bunny.net/openapi-client/generated/<spec>.d.ts`.
47
47
- Use `clientOptions(config, verbose)` from `packages/cli/src/core/client-options.ts` when creating API clients in command handlers.
48
48
- Database commands use v2 API endpoints (`/v2/databases/...`).
49
49
- Apps (Magic Containers) commands use `bunny.jsonc` as the single source of truth. App ID is stored in the config (no separate manifest file). Use `resolveAppId()` and `resolveContainerId()` from `packages/cli/src/commands/apps/config.ts`. Types and conversion functions come from `@bunny.net/app-config`.
0 commit comments