Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sixty-carpets-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bunny.net/cli": patch
---

Thread `--verbose` through `resolveConfig()` everywhere
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ Config files are written with permissions `0o660`.

### Config resolution precedence

When resolving the active configuration (in `resolveConfig(profile, apiKeyOverride?)`), the following priority applies — highest wins:
When resolving the active configuration (in `resolveConfig(profile, apiKeyOverride?, verbose?)`), the following priority applies — highest wins:

1. **`--api-key` flag** — Passed as `apiKeyOverride` to `resolveConfig()`
2. **Environment variables** — `BUNNYNET_API_KEY` and `BUNNYNET_API_URL`
Expand Down Expand Up @@ -911,7 +911,7 @@ import { resolveConfig } from "../../config/index.ts";
import { clientOptions } from "../../core/client-options.ts";

handler: async ({ profile, apiKey, verbose }) => {
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const api = createCoreClient(clientOptions(config, verbose));

const { data, error } = await api.GET("/pullzone/{id}", {
Expand Down Expand Up @@ -1152,7 +1152,7 @@ bunny db shell seed.sql
4. **Add flag equivalents for every interactive prompt** so the command is fully scriptable (see "Agent & Scripting Compatibility").
5. Use `preRun` for validation that should prevent execution.
6. Access global flags (`profile`, `verbose`, `output`) directly from the args object.
7. Resolve config via `resolveConfig(args.profile, args.apiKey)` when API access is needed.
7. Resolve config via `resolveConfig(args.profile, args.apiKey, args.verbose)` when API access is needed.
8. Use `logger` for all output. **Every command that returns data must support `--output json`.**
9. Throw `UserError` for expected failures. Let unexpected errors propagate to the factory's catch block.
10. Register the new command/namespace in `packages/cli/src/cli.ts`.
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ This is a Bun workspace monorepo with four packages:
- See `AGENTS.md` for full architecture documentation.
- Commands use `defineCommand()` from `packages/cli/src/core/define-command.ts`.
- Namespaces use `defineNamespace()` from `packages/cli/src/core/define-namespace.ts`.
- Resolve config via `resolveConfig(profile, apiKey)` — always pass both args.
- Resolve config via `resolveConfig(profile, apiKey, verbose)` — always pass `profile` and `apiKey`; pass `verbose` so credential-source debug lines respect the flag.
- Use `formatTable()` / `formatKeyValue()` from `packages/cli/src/core/format.ts` for non-JSON output.
- Handle `--output json` first in every handler, then pass `output` to format functions.
- Use `logger` from `packages/cli/src/core/logger.ts` for all user-facing output.
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const apiCommand = defineCommand<ApiArgs>({
);
}

const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
if (!config.apiKey) {
throw new UserError(
"Not logged in.",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const appsDeleteCommand = defineCommand<DeleteArgs>({

handler: async ({ id: rawId, force, profile, output, verbose, apiKey }) => {
const appId = resolveAppId(rawId);
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

if (!force) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const appsDeployCommand = defineCommand<DeployArgs>({

handler: async ({ image, profile, output, verbose, apiKey }) => {
const toml = loadConfig();
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

let appId = toml.app.id;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/endpoints/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const appsEndpointsAddCommand = defineCommand<AddArgs>({
apiKey,
}) => {
const appId = resolveAppId(rawId);
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

const { data: app } = await client.GET("/apps/{appId}", {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/endpoints/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const appsEndpointsListCommand = defineCommand<ListArgs>({
apiKey,
}) => {
const appId = resolveAppId(rawId);
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

const spin = spinner("Fetching endpoints...");
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/endpoints/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const appsEndpointsRemoveCommand = defineCommand<RemoveArgs>({
apiKey,
}) => {
const appId = resolveAppId(rawId);
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

if (!force) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/env/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const appsEnvListCommand = defineCommand<ListArgs>({
apiKey,
}) => {
const appId = resolveAppId(rawId);
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

const spin = spinner("Fetching environment variables...");
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/env/pull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const appsEnvPullCommand = defineCommand<PullArgs>({
apiKey,
}) => {
const appId = resolveAppId(rawId);
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

const spin = spinner("Fetching environment variables...");
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/env/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const appsEnvRemoveCommand = defineCommand<RemoveArgs>({
apiKey,
}) => {
const appId = resolveAppId(rawId);
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

const spin = spinner("Fetching current variables...");
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/env/set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const appsEnvSetCommand = defineCommand<SetArgs>({
apiKey,
}) => {
const appId = resolveAppId(rawId);
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

// Read-modify-write: fetch current vars, update, PUT all
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const appsInitCommand = defineCommand<InitArgs>({
}
if (!name) throw new UserError("App name is required.");

const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

// Detect Dockerfile in cwd
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const appsListCommand = defineCommand({
aliases: ["ls"],

handler: async ({ profile, output, verbose, apiKey }) => {
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

const spin = spinner("Fetching apps...");
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/pull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const appsPullCommand = defineCommand<PullArgs>({

handler: async ({ id: rawId, force, profile, output, verbose, apiKey }) => {
const appId = resolveAppId(rawId);
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

if (configExists() && !force) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const appsPushCommand = defineCommand<PushArgs>({
handler: async ({ "dry-run": dryRun, profile, output, verbose, apiKey }) => {
const appId = resolveAppId();
const toml = loadConfig();
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

const spin = spinner("Fetching current app state...");
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/regions/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const appsRegionsListCommand = defineCommand({
aliases: ["ls"],

handler: async ({ profile, output, verbose, apiKey }) => {
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

const spin = spinner("Fetching regions...");
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/regions/show.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const appsRegionsShowCommand = defineCommand<ShowArgs>({

handler: async ({ id: rawId, profile, output, verbose, apiKey }) => {
const appId = resolveAppId(rawId);
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

const spin = spinner("Fetching region settings...");
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/restart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const appsRestartCommand = defineCommand<RestartArgs>({

handler: async ({ id: rawId, profile, output, verbose, apiKey }) => {
const appId = resolveAppId(rawId);
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

const spin = spinner("Restarting app...");
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/show.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const appsShowCommand = defineCommand<ShowArgs>({

handler: async ({ id: rawId, profile, output, verbose, apiKey }) => {
const appId = resolveAppId(rawId);
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

const spin = spinner("Fetching app...");
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/undeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const appsUndeployCommand = defineCommand<UndeployArgs>({

handler: async ({ id: rawId, force, profile, output, verbose, apiKey }) => {
const appId = resolveAppId(rawId);
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

if (!force) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/volumes/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const appsVolumesListCommand = defineCommand<ListArgs>({

handler: async ({ id: rawId, profile, output, verbose, apiKey }) => {
const appId = resolveAppId(rawId);
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

const spin = spinner("Fetching volumes...");
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/volumes/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const appsVolumesRemoveCommand = defineCommand<RemoveArgs>({
apiKey,
}) => {
const appId = resolveAppId(rawId);
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

if (!force) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/auth/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export const authLoginCommand = defineCommand<{ force: boolean }>({
setProfile(profile, apiKey);

// Fetch user details for a personalised greeting
const config = resolveConfig(profile);
const config = resolveConfig(profile, undefined, verbose);
const client = createCoreClient(clientOptions(config, verbose));

const spin = spinner("Verifying credentials...");
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/config/show.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export const configShowCommand = defineCommand({
command: "show",
describe: "Show the loaded configuration.",

handler: async ({ profile, output, apiKey }) => {
const cfg = resolveConfig(profile, apiKey);
handler: async ({ profile, output, apiKey, verbose }) => {
const cfg = resolveConfig(profile, apiKey, verbose);

if (output === "json") {
const { apiKey: rawKey, ...rest } = cfg;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/db/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export const dbCreateCommand = defineCommand<CreateArgs>({

handler: async (args) => {
const { profile, output, verbose, apiKey } = args;
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createDbClient(clientOptions(config, verbose));

// Step 1: Database name
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/db/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const dbDeleteCommand = defineCommand<DeleteArgs>({
verbose,
apiKey,
}) => {
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createDbClient(clientOptions(config, verbose));

const { id: databaseId, source } = await resolveDbId(client, databaseIdArg);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/db/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const dbLinkCommand = defineCommand<LinkArgs>({
verbose,
apiKey,
}) => {
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createDbClient(clientOptions(config, verbose));

if (databaseIdArg) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/db/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const dbListCommand = defineCommand({
describe: DESCRIPTION,

handler: async ({ profile, output, verbose, apiKey }) => {
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createDbClient(clientOptions(config, verbose));

const spin = spinner("Fetching databases...");
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/db/quickstart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export const dbQuickstartCommand = defineCommand<{

// Resolve URL and token from API if not provided via flags
if (!url || !token) {
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createDbClient(clientOptions(config, verbose));

const { id: databaseId } = await resolveDbId(client, databaseIdArg);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/db/regions/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const dbRegionsAddCommand = defineCommand<AddArgs>({
verbose,
apiKey,
}) => {
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createDbClient(clientOptions(config, verbose));

const { id: databaseId } = await resolveDbId(client, databaseIdArg);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/db/regions/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const dbRegionsListCommand = defineCommand<ListArgs>({
verbose,
apiKey,
}) => {
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createDbClient(clientOptions(config, verbose));

const { id: databaseId } = await resolveDbId(client, databaseIdArg);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/db/regions/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const dbRegionsRemoveCommand = defineCommand<RemoveArgs>({
verbose,
apiKey,
}) => {
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createDbClient(clientOptions(config, verbose));

const { id: databaseId } = await resolveDbId(client, databaseIdArg);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/db/regions/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const dbRegionsUpdateCommand = defineCommand<UpdateArgs>({
verbose,
apiKey,
}) => {
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createDbClient(clientOptions(config, verbose));

const { id: databaseId } = await resolveDbId(client, databaseIdArg);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/db/shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ async function resolveCredentials(
return { url, token, databaseId: databaseIdArg, tokenGenerated: false };
}

const config = resolveConfig(profile, apiKeyOverride);
const config = resolveConfig(profile, apiKeyOverride, verbose);
const apiClient = createDbClient(clientOptions(config, verbose));

const { id: databaseId } = await resolveDbId(apiClient, databaseIdArg);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/db/show.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const dbShowCommand = defineCommand<ShowArgs>({
verbose,
apiKey,
}) => {
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createDbClient(clientOptions(config, verbose));

const { id: databaseId } = await resolveDbId(client, databaseIdArg);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/db/studio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function resolveCredentials(

if (url && token) return { url, token, databaseId: databaseIdArg };

const config = resolveConfig(profile, apiKeyOverride);
const config = resolveConfig(profile, apiKeyOverride, verbose);
const apiClient = createDbClient(clientOptions(config, verbose));

const { id: databaseId } = await resolveDbId(apiClient, databaseIdArg);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/db/tokens/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export const dbTokensCreateCommand = defineCommand<{
verbose,
apiKey,
}) => {
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createDbClient(clientOptions(config, verbose));

const authorization = readOnly ? "read-only" : "full-access";
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/db/tokens/invalidate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const dbTokensInvalidateCommand = defineCommand<{
verbose,
apiKey,
}) => {
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createDbClient(clientOptions(config, verbose));

// Resolve the target database — explicit ID, .env, or interactive prompt
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/db/usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const dbUsageCommand = defineCommand<UsageArgs>({
verbose,
apiKey,
}) => {
const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createDbClient(clientOptions(config, verbose));

// Resolve time range
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/registries/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const registryAddCommand = defineCommand<AddArgs>({
}
if (!password) throw new UserError("Password is required.");

const config = resolveConfig(profile, apiKey);
const config = resolveConfig(profile, apiKey, verbose);
const client = createMcClient(clientOptions(config, verbose));

const spin = spinner("Adding registry...");
Expand Down
Loading
Loading