### ApiClient basic usage example Source: https://github.com/adriansilaghi/danube-cli Shows how to create a client and make a GET request to fetch a static site. The token is read from config or the DANUBE_TOKEN environment variable. ```typescript import { ApiClient } from './lib/api-client.js'; import type { StaticSite } from './types/api.js'; const api = await ApiClient.create(); // token from config or DANUBE_TOKEN const res = await api.get<{ data: StaticSite }>(`/api/v1/static-sites/${siteId}`); console.log(res.data.url); ``` -------------------------------- ### Example CLI commands for upgrade, config, and operations wait Source: https://github.com/adriansilaghi/danube-cli Shows example invocations for checking upgrades, setting auto-update config, and waiting for an operation with a timeout. ```bash danube upgrade --check --json danube config set auto-update true danube operations wait op_01ab... --timeout 30m --json ``` -------------------------------- ### Example usage of output helpers Source: https://github.com/adriansilaghi/danube-cli Example showing how to use formatTable, statusColor, formatBytes, and printDetails together. It formats a table of buckets and prints details. ```typescript import { formatTable, statusColor, formatBytes, printDetails } from './lib/output.js'; const rows = buckets.map(b => [b.name, statusColor(b.status), formatBytes(b.size_bytes ?? 0)]); console.log(formatTable(['NAME', 'STATUS', 'SIZE'], rows)); printDetails([ ['id', bucket.id], ['region', bucket.region], ['endpoint', bucket.endpoint ?? '-'], ]); ``` -------------------------------- ### Full deploy wait example Source: https://github.com/adriansilaghi/danube-cli Complete example showing how to wait for a static site deploy: captures baseline, uploads zip, then waits for build, publish, and serving. Handles each outcome and warns if the site is password-protected or not confirmed. ```typescript import { ApiClient } from './lib/api-client.js'; import { captureDeployBaseline, waitForBuild, waitForPublish, waitUntilServed, } from './lib/static-site-deploy.js'; const api = await ApiClient.create(); const baseline = await captureDeployBaseline(api, siteId); await api.upload(`/api/v1/static-sites/${siteId}/deploy`, zip, 'bundle.zip'); const build = await waitForBuild(api, siteId, baseline, (s) => process.stderr.write(`${s}\n`)); if (build.kind !== 'built') throw new Error(build.message); const published = await waitForPublish(api, siteId, baseline, true); if (published.kind !== 'published') throw new Error(published.message); const serve = await waitUntilServed(published.site.url, build.build.id); if (serve !== 'live') { console.warn(serve === 'password_protected' ? 'Site is password-protected; not confirmed.' : 'Could not confirm the new build is served.'); } ``` -------------------------------- ### Example: openLinkedSite usage Source: https://github.com/adriansilaghi/danube-cli Shows how to use openLinkedSite to deploy a site, handling NotLinkedError and ResourceNotFoundError. The example logs the site name, URL, and team ID, and suggests running `danube pages link` if not linked. ```typescript import { openLinkedSite } from './lib/linked-site.js'; import { NotLinkedError, ResourceNotFoundError } from './lib/errors.js'; try { const { api, site, project } = await openLinkedSite(); console.log(`Deploying ${site.name} (${site.url}) in project ${project.teamId}`); } catch (err) { if (err instanceof NotLinkedError) console.error('Run `danube pages link` first.'); else if (err instanceof ResourceNotFoundError) console.error(err.message); else throw err; } ``` -------------------------------- ### Example: probe() usage Source: https://github.com/adriansilaghi/danube-cli Probes a URL with 5 warm requests and expects status 200. On failure, logs detail and TLS error; on cold start, logs first request time. ```typescript import { probe } from './lib/probe.js'; const report = await probe('https://my-api.example.com/healthz', { warmRequests: 5, expectStatus: 200, }); if (!report.ok) { console.error(report.detail, report.tls.error ?? ''); process.exitCode = 1; } else if (report.cold_start_likely) { console.error('Scale-to-zero cold start suspected:', report.first_request_ms, 'ms'); } ``` -------------------------------- ### InstallKind, detectInstall, explainRefusal, UpgradeOutcome, performUpgrade (upgrade.ts) Source: https://github.com/adriansilaghi/danube-cli Defines types and functions for detecting installation kind and performing upgrades. detectInstall realpaths the module and detects version-manager paths, then checks writability of the node_modules parent. performUpgrade only upgrades npm-global installs via npm install -g @danubedata/cli@ with a 120-second timeout; other install kinds return ok: false with explainRefusal, and npm failures re-print the exact command. ```typescript export type InstallKind = | { kind: 'npm-global'; prefix: string } | { kind: 'version-manager'; manager: string } | { kind: 'not-global' } | { kind: 'unwritable'; prefix: string }; export async function detectInstall(moduleUrl: string = import.meta.url): Promise export function explainRefusal(install: InstallKind): string export interface UpgradeOutcome { ok: boolean; from: string; to: string; message: string; } export async function performUpgrade(from: string, to: string): Promise ``` -------------------------------- ### Quick start commands Source: https://github.com/adriansilaghi/danube-cli/blob/main/README.md Authenticates and lists VPS instances, storage buckets, and deploys a static site. ```bash # Authenticate via browser danube auth # List your VPS instances danube vps ls # List your storage buckets danube storage buckets ls # Deploy a static site danube pages link danube pages deploy ``` -------------------------------- ### pages deploy example commands Source: https://github.com/adriansilaghi/danube-cli Example invocations of `danube pages deploy`. The first deploys from the `dist` directory; the second uses environment variables for site and team IDs and outputs JSON. ```bash danube pages deploy --dir dist ``` ```bash DANUBE_SITE_ID= DANUBE_TEAM_ID=4 danube pages deploy --dir dist --json ``` -------------------------------- ### Power management commands for VPS Source: https://github.com/adriansilaghi/danube-cli/blob/main/README.md Stop, start, or reboot a VPS instance by name or ID. ```bash danube vps stop danube vps start danube vps reboot ``` -------------------------------- ### Install @danubedata/cli globally Source: https://github.com/adriansilaghi/danube-cli/blob/main/README.md Installs the CLI package globally via npm. Requires Node.js 18 or later. ```bash npm install -g @danubedata/cli ``` -------------------------------- ### Storage policy commands examples Source: https://github.com/adriansilaghi/danube-cli Shows usage of `danube storage policy` subcommands: get with `--effective`, set from stdin with `--yes --wait`, and grant with `--folder` and `--level`. The set command reads policy JSON from stdin and requires `--yes`. ```bash danube storage policy get invoices --effective ``` ```bash danube storage policy set invoices --file - --yes --wait < policy.json ``` ```bash danube storage policy grant invoices --key AKIA... --folder reports/2026 --level readwrite --wait ``` -------------------------------- ### Unified wait envelope example Source: https://github.com/adriansilaghi/danube-cli Example showing how to call waitForTerminal, print the outcome with printWaitOutcome, and output the JSON envelope from waitEnvelope. Requires baseline and minGeneration values for the wait options. ```typescript import { waitEnvelope, printWaitOutcome } from './lib/report-wait.js'; import { waitForTerminal } from './lib/wait-for-terminal.js'; const result = await waitForTerminal(api, containerId, { baseline, minGeneration }); printWaitOutcome(result, name); console.log(JSON.stringify(waitEnvelope('apply', container, result), null, 2)); ``` -------------------------------- ### get Source: https://github.com/adriansilaghi/danube-cli/blob/main/README.md Shows the stored bucket policy. Use to verify what is stored after a change. ```APIDOC ## get ### Description Shows the stored bucket policy. Use to verify what is stored after a change. ### Method CLI command ### Command `danube storage policy get` ### Response #### Success Response - Policy document - The stored policy. ``` -------------------------------- ### config get Source: https://github.com/adriansilaghi/danube-cli Prints the current CLI configuration, including the auto-update setting and version. ```APIDOC ## config get ### Description Prints the current CLI configuration, including the auto-update setting and version. ### Response #### Success Response - **auto-update** (boolean) - The auto-update setting. - **package** (string) - The package name. - **version** (string) - The CLI version. ``` -------------------------------- ### upgrade Source: https://github.com/adriansilaghi/danube-cli Updates the CLI to the latest published version. Can check for updates without installing. ```APIDOC ## upgrade ### Description Updates the CLI to the latest published version. Can check for updates without installing. ### Options - **--check** (boolean) - Report what would happen without installing anything. ### Response #### Success Response - **current** (string) - The current version. - **latest** (string) - The latest version. - **upgraded** (boolean) - Whether the upgrade was performed. - **meta.up_to_date** (boolean) - Whether the CLI is up to date. - **can_upgrade** (boolean) - Whether the CLI can be upgraded (only with `--check`). - **reason** (string) - The reason for refusal (only with `--check`). #### Error Response - **error.code** (string) - The error code (`upgrade.failed` or `upgrade.check_failed`). - **error.retryable** (boolean) - Whether the error is retryable. ``` -------------------------------- ### Create a database instance with danube database create Source: https://github.com/adriansilaghi/danube-cli/blob/main/README.md Interactive creation prompts for provider, datacenter, and profile. The flags version specifies name, provider, datacenter, profile, and database name. Plans and prices in the interactive picker are fetched live from the API. ```bash # Interactive danube database create # With flags danube database create --name my-db --provider postgresql --datacenter fsn1 --profile small --database-name app ``` -------------------------------- ### Create a cache instance with danube cache create Source: https://github.com/adriansilaghi/danube-cli/blob/main/README.md Interactive creation prompts for provider, datacenter, and profile. The flags version specifies name, provider, datacenter, and profile directly. Plans and prices in the interactive picker are fetched live from the API. ```bash # Interactive danube cache create # With flags danube cache create --name my-cache --provider redis --datacenter fsn1 --profile small ``` -------------------------------- ### Create a VPS interactively or with flags Source: https://github.com/adriansilaghi/danube-cli/blob/main/README.md Use `danube vps create` to create a new VPS. The interactive mode fetches plans and prices live from the API. With flags, specify name, image, plan, and SSH key ID. ```bash # Interactive danube vps create # With flags danube vps create \ --name my-server \ --image ubuntu-24.04 \ --plan nano_shared \ --ssh-key-id ``` -------------------------------- ### GET /api/v1/registry/repositories* Source: https://github.com/adriansilaghi/danube-cli Repository operations: list repositories, get a specific repository, list its tags, delete a tag, or delete a repository. ```APIDOC ## [GET] /api/v1/registry/repositories* ### Description Repository operations: list repositories, get a specific repository, list its tags, delete a tag, or delete a repository. ### Method GET, DELETE ### Endpoint /api/v1/registry/repositories* ### Parameters #### Path Parameters - **id** (string) - Required - The repository ID (for sub-operations). - **tag** (string) - Optional - The tag to delete (for tag delete). ``` -------------------------------- ### GET /api/v1/database/{id} Source: https://github.com/adriansilaghi/danube-cli Retrieves details of a specific database by its ID. This endpoint is used by the `database get` command. ```APIDOC ## GET /api/v1/database/{id} ### Description Retrieves details of a specific database by its ID. ### Method GET ### Endpoint /api/v1/database/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the database. ``` -------------------------------- ### get(path: string, timeoutMs?: number): Promise Source: https://github.com/adriansilaghi/danube-cli Performs an HTTP GET request to the specified path. Returns the parsed JSON body typed as T, or undefined as T on HTTP 204. ```APIDOC ## get(path: string, timeoutMs?: number): Promise ### Description Performs an HTTP GET request to the specified path. Returns the parsed JSON body typed as T, or undefined as T on HTTP 204. ### Parameters - `path` (string) - Required - Route appended to `baseUrl`, e.g. `/api/v1/vps` - `timeoutMs` (number) - Optional - Per-request abort; defaults to `30_000`; used by `--wait` pollers ### Response Parsed JSON body typed as `T`; `undefined as T` on HTTP 204. ### Throws - `NotAuthenticatedError` - HTTP 401 from the API - `ApiError` - Any `!res.ok` response; `statusCode = res.status`, `message` from envelope `error.message` / `error` string / `message` / fallback `Request failed with status `, plus `errors`, `cause`, `meta`, `retryAfterSeconds` - `Error` - Request aborted by timeout: `Request timed out after ms: `; network failure: `Could not reach (). Check your connection and DANUBE_API_BASE.` ### Request Example ```typescript import { ApiClient } from './lib/api-client.js'; import type { StaticSite } from './types/api.js'; const api = await ApiClient.create(); // token from config or DANUBE_TOKEN const res = await api.get<{ data: StaticSite }>(`/api/v1/static-sites/${siteId}`); console.log(res.data.url); ``` ``` -------------------------------- ### Create a bucket with danube storage buckets create Source: https://github.com/adriansilaghi/danube-cli/blob/main/README.md Creates a new bucket interactively or with flags. Use --name, --region, and --versioning to configure it non-interactively. ```bash # Interactive danube storage buckets create # With flags danube storage buckets create --name my-bucket --region fsn1 --versioning ``` -------------------------------- ### Launcher script bin/danube Source: https://github.com/adriansilaghi/danube-cli Executable launcher for the CLI. Installed as the `danube` binary via package.json's `bin.danube`. The published package ships only `bin` and `dist`; there is no library entry point. ```javascript #!/usr/bin/env node import('../dist/index.js'); ``` -------------------------------- ### Deploy static site with danube pages deploy Source: https://github.com/adriansilaghi/danube-cli/blob/main/README.md Deploys the linked static site. Use --dir to specify a directory, --no-wait to skip waiting for the build. Waits for build, publish, and live URL before printing 'Live at'. ```bash danube pages deploy # Deploy current directory danube pages deploy --dir dist # Deploy a specific directory danube pages deploy --no-wait # Don't wait for build ``` -------------------------------- ### Example: using findUnknownCommand and formatUnknownCommand Source: https://github.com/adriansilaghi/danube-cli Shows how to probe for a command safely: 'danube rapids probe --help' reports 'probe' as missing rather than printing the parent's help and exiting 0. Builds the program, finds the unknown command, formats the output, writes to the appropriate stream, and exits with the reported code. ```typescript import { buildProgram } from './program.js'; import { findUnknownCommand, formatUnknownCommand, wantsJsonOutput } from './lib/command-resolution.js'; const program = buildProgram(); const unknown = findUnknownCommand(program, ['rapids', 'probe', '--help']); if (unknown) { const out = formatUnknownCommand(unknown, wantsJsonOutput(['rapids', 'probe', '--help'])); const write = out.stream === 'stdout' ? console.log : console.error; for (const line of out.lines) write(line); process.exit(out.exitCode); } program.parseAsync(); ``` -------------------------------- ### CI/CD environment variables and deploy Source: https://github.com/adriansilaghi/danube-cli/blob/main/README.md Sets environment variables for token, site ID, and team ID, then deploys a static site. The site ID and team ID are printed by 'danube pages link'. ```bash export DANUBE_TOKEN=your-token export DANUBE_SITE_ID=01a0d8fa-35fa-709d-b9d1-319c28ba28fa # "siteId" in .danube/project.json export DANUBE_TEAM_ID=4 # "teamId" in .danube/project.json danube pages deploy --dir dist ``` -------------------------------- ### GET /api/v1/database/plans Source: https://github.com/adriansilaghi/danube-cli Retrieve database plans. ```APIDOC ## [GET] /api/v1/database/plans ### Description Retrieve database plans. ### Method GET ### Endpoint /api/v1/database/plans ``` -------------------------------- ### GET /api/v1/vps/plans Source: https://github.com/adriansilaghi/danube-cli Retrieve VPS plans. ```APIDOC ## [GET] /api/v1/vps/plans ### Description Retrieve VPS plans. ### Method GET ### Endpoint /api/v1/vps/plans ``` -------------------------------- ### registry context Source: https://github.com/adriansilaghi/danube-cli Retrieves the registry context, including the registry host, namespace, push prefix, and storage/repository usage information. Prints the complete push prefix. ```APIDOC ## [GET] /api/v1/registry/context ### Description Retrieves the registry context, including the registry host, namespace, push prefix, and storage/repository usage information. Prints the complete push prefix. ### Method GET ### Endpoint /api/v1/registry/context ### Response #### Success Response (200) - **registry_host** (string) - The registry host. - **namespace** (string) - The namespace. - **push_prefix** (string) - The complete push prefix. - **repositories** (object) - Repository usage information. - **used** (number) - Number of repositories used. - **limit** (number) - Repository limit. - **can_create** (boolean) - Whether new repositories can be created. - **storage** (object) - Storage usage information. - **used_bytes** (number) - Storage used in bytes. - **limit_bytes** (number) - Storage limit in bytes. - **can_push** (boolean) - Whether pushing is allowed. ``` -------------------------------- ### Create access keys with different scopes Source: https://github.com/adriansilaghi/danube-cli/blob/main/README.md Shows how --scope controls which buckets a key reaches. --scope team reaches every bucket, --scope buckets limits to named buckets with levels, and --scope none gives no access until a policy grants it. ```bash # Every bucket of the project (the default, and what a create with no --scope makes) danube storage keys create --name "deploy-key" --scope team # Only the buckets you name, each with a level: read, readwrite or full danube storage keys create --name "reports" --scope buckets \ --bucket reports:read --bucket exports:readwrite # No access of its own: it reaches only what a bucket policy allows it danube storage keys create --name "invoices-service" --scope none ``` -------------------------------- ### GET /api/v1/registry/usage Source: https://github.com/adriansilaghi/danube-cli Retrieve registry storage usage. ```APIDOC ## [GET] /api/v1/registry/usage ### Description Get registry storage usage. ### Method GET ### Endpoint /api/v1/registry/usage ``` -------------------------------- ### GET /api/v1/registry/context Source: https://github.com/adriansilaghi/danube-cli Retrieve the push context (`RegistryContext`). ```APIDOC ## [GET] /api/v1/registry/context ### Description Get the push context (`RegistryContext`). ### Method GET ### Endpoint /api/v1/registry/context ``` -------------------------------- ### GET /api/v1/vps/images/grouped Source: https://github.com/adriansilaghi/danube-cli Retrieve OS images grouped for VPS. ```APIDOC ## [GET] /api/v1/vps/images/grouped ### Description Retrieve OS images grouped for VPS. ### Method GET ### Endpoint /api/v1/vps/images/grouped ``` -------------------------------- ### Agent workflow deploy path Source: https://github.com/adriansilaghi/danube-cli/blob/main/README.md Sequential steps for deploying and diagnosing a rapid. 'preflight' resolves the digest and architectures; 'can_pull: null' means unknown, not failure. ```bash danube registry verify-push safi4/danube-todo --json # may I push here? danube rapids preflight --image cr.danubedata.ro/safi4/danube-todo:v1.0.0 --json danube rapids apply --name danube-todo --image ... --wait --idempotency-key "$KEY" --json danube rapids probe danube-todo --path /healthz --cold --warm-requests 5 --json danube rapids diagnose danube-todo --json # only if something looks wrong ``` -------------------------------- ### registry repos Source: https://github.com/adriansilaghi/danube-cli Manages repositories, including listing, retrieving, tagging, and deleting repositories and tags. ```APIDOC ## [GET/POST/DELETE] /api/v1/registry/repositories* ### Description Manages repositories, including listing, retrieving, tagging, and deleting repositories and tags. ### Method GET, POST, DELETE ### Endpoint /api/v1/registry/repositories* ### Parameters #### Path Parameters - **path-or-id** (string) - Required - The repository path or ID. - **tag** (string) - Required - The tag name. #### Query Parameters - **force** (boolean) - Optional - Force the operation. - **delete-in-use** (boolean) - Optional - Delete the tag even if in use. ``` -------------------------------- ### GET /api/v1/storage/buckets/{id}/policy Source: https://github.com/adriansilaghi/danube-cli Read the bucket policy. ```APIDOC ## [GET] /api/v1/storage/buckets/{id}/policy ### Description Read the bucket policy. ### Method GET ### Endpoint /api/v1/storage/buckets/{id}/policy ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the bucket. ### Response #### Success Response (200) Returns a `BucketPolicy` object. ``` -------------------------------- ### alerts get Source: https://github.com/adriansilaghi/danube-cli Retrieves a specific metric alert by ID. ```APIDOC ## [GET] /api/v1/metric-alerts/{id} ### Description Retrieves a specific metric alert. ### Method GET ### Endpoint /api/v1/metric-alerts/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The alert ID. ### Response #### Success Response (200) - **metric_alert** (object) - The metric alert object. ``` -------------------------------- ### Basic call to packageDirectory and getDirectorySize Source: https://github.com/adriansilaghi/danube-cli Example showing how to call packageDirectory with extra ignore patterns and getDirectorySize. Imports from './lib/packager.js' and './lib/output.js'. Outputs file count and zip size. ```typescript import { packageDirectory, getDirectorySize } from './lib/packager.js'; import { formatBytes } from './lib/output.js'; const { buffer, fileCount } = await packageDirectory('dist', ['build/**', '*.map']); console.log(`${fileCount} files, ${formatBytes(buffer.length)} zip`); const sourceBytes = await getDirectorySize('dist'); ``` -------------------------------- ### Selecting a project with --project Source: https://github.com/adriansilaghi/danube-cli/blob/main/README.md Scopes a single invocation with --project, or persists the default with 'danube project select'. Precedence is explicit flag, then DANUBE_TEAM_ID, then saved selection, then account default. ```bash danube --project 42 rapids get my-api --json danube project select --project 42 # persists the default, no prompt ``` -------------------------------- ### danube storage buckets get Source: https://github.com/adriansilaghi/danube-cli/blob/main/README.md Shows details of a specific bucket. ```APIDOC ## danube storage buckets get ### Description Shows details of a specific bucket. ### Method CLI command ### Command `danube storage buckets get ` ### Parameters #### Path Parameters - `` (string) - Required - The name or ID of the bucket. ``` -------------------------------- ### alerts available-metrics Source: https://github.com/adriansilaghi/danube-cli Lists available metrics for a given resource type (e.g., vps). ```APIDOC ## [GET] /api/v1/metric-alerts/{resource-type}/available-metrics ### Description Lists available metrics for a given resource type. ### Method GET ### Endpoint /api/v1/metric-alerts/{resource-type}/available-metrics ### Parameters #### Path Parameters - **resource-type** (string) - Required - The resource type (e.g., `vps`). ### Response #### Success Response (200) - **available_metrics** (array) - List of available metric names. ``` -------------------------------- ### GET /api/v1/cache Source: https://github.com/adriansilaghi/danube-cli Lists all cache instances. ```APIDOC ## GET /api/v1/cache ### Description Lists all cache instances. ### Method GET ### Endpoint /api/v1/cache ``` -------------------------------- ### danube rapids preflight --image Source: https://github.com/adriansilaghi/danube-cli/blob/main/README.md Checks namespace, credential, manifest, digest, and architecture before deploying. ```APIDOC ## danube rapids preflight --image ### Description Check namespace, credential, manifest, digest and architecture before deploying. ### Command `danube rapids preflight --image ` ### Parameters #### Options - `--image` (string) - Required - Image reference to check. ### Usage ``` danube rapids preflight --image ``` ``` -------------------------------- ### GET /api/v1/serverless/{id}/schedules Source: https://github.com/adriansilaghi/danube-cli Lists all schedules for a serverless container. ```APIDOC ## [GET] /api/v1/serverless/{id}/schedules ### Description Lists all schedules for a serverless container. ### Method GET ### Endpoint /api/v1/serverless/{id}/schedules ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the serverless container ### Response #### Success Response (200) - List of schedules ``` -------------------------------- ### GET /api/v1/serverless/{id}/runs Source: https://github.com/adriansilaghi/danube-cli Lists all runs for a serverless container. ```APIDOC ## [GET] /api/v1/serverless/{id}/runs ### Description Lists all runs for a serverless container. ### Method GET ### Endpoint /api/v1/serverless/{id}/runs ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the serverless container ### Response #### Success Response (200) - List of runs ``` -------------------------------- ### Entry sequence in src/index.ts Source: https://github.com/adriansilaghi/danube-cli Main entry sequence: builds the program, prepares the update notice, sets up exit handlers, detects unknown commands before parsing, and runs parseAsync with error handling. Order matters: update notice is prepared before anything else, unknown command detection happens before Commander parses, and autoUpdateIfEnabled may install a same-major update after successful parse. ```typescript const program = buildProgram(); const argv = process.argv.slice(2); const updateNotice = await prepareUpdateNotice(argv); process.on('exit', () => updateNotice.print()); process.on('SIGINT', () => { if (!isJsonMode()) console.log(''); process.exit(130); }); process.on('unhandledRejection', (err) => handleError(err)); const unknown = findUnknownCommand(program, argv); if (unknown) { /* formatUnknownCommand → print → process.exit(2) */ } program.parseAsync() .then(() => autoUpdateIfEnabled(updateNotice)) .catch((err) => handleError(err)); ``` -------------------------------- ### uptime get Source: https://github.com/adriansilaghi/danube-cli Retrieves a specific uptime check by ID or name. ```APIDOC ## [GET] /api/v1/uptime-checks/{id} ### Description Retrieves a specific uptime check. ### Method GET ### Endpoint /api/v1/uptime-checks/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The check ID or name. ### Response #### Success Response (200) - **uptime_check** (object) - The uptime check object. ``` -------------------------------- ### POST /api/v1/vps/{id}/reinstall Source: https://github.com/adriansilaghi/danube-cli Reinstalls a VPS instance with a new image and optional cloud-init script. The command requires confirmation via `-f/--force` or `-y/--yes` flags. ```APIDOC ## POST /api/v1/vps/{id}/reinstall ### Description Reinstalls a VPS instance with a new image and optional cloud-init script. The command requires confirmation via `-f/--force` or `-y/--yes` flags. ### Method POST ### Endpoint /api/v1/vps/{id}/reinstall ### Parameters #### Path Parameters - **id** (string) - Required - VPS ID or name #### Request Body - **image** (string) - Required - Image ID - **cloud_init** (string) - Optional - Cloud-init script ### Response #### Success Response (200) - **status** (string) - New VPS status ``` -------------------------------- ### GET /api/v1/registry/verify-push Source: https://github.com/adriansilaghi/danube-cli Pre-push permission check. Requires a `repository` query parameter. ```APIDOC ## [GET] /api/v1/registry/verify-push ### Description Pre-push permission check. ### Method GET ### Endpoint /api/v1/registry/verify-push ### Parameters #### Query Parameters - **repository** (string) - Required - The repository to verify push permission for. ``` -------------------------------- ### GET /api/v1/metric-alerts/{id}/history Source: https://github.com/adriansilaghi/danube-cli Retrieve the evaluation history of a metric alert. ```APIDOC ## [GET] /api/v1/metric-alerts/{id}/history ### Description Get evaluation history for a metric alert. ### Method GET ### Endpoint /api/v1/metric-alerts/{id}/history ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the metric alert. ``` -------------------------------- ### Manage access keys with danube storage keys Source: https://github.com/adriansilaghi/danube-cli/blob/main/README.md Creates, lists, and revokes access keys. Use --name to set a key name and for the key ID. ```bash danube storage keys create --name "deploy-key" danube storage keys ls danube storage keys revoke ``` -------------------------------- ### printAutoUpdateNotice(from, to) Source: https://github.com/adriansilaghi/danube-cli Prints a post-upgrade notice, naming the opt-out command. ```APIDOC ## printAutoUpdateNotice(from, to) ### Description Prints a post-upgrade notice, naming the opt-out command. ### Method Function ### Signature `printAutoUpdateNotice(from: string, to: string): void` ### Parameters - **from** (string) - Required - The version before the upgrade. - **to** (string) - Required - The version after the upgrade. ### Returns - **void** - No return value. ``` -------------------------------- ### GET /api/v1/uptime-checks/{id}/diagnose Source: https://github.com/adriansilaghi/danube-cli Run a diagnosis on a specific uptime check. ```APIDOC ## [GET] /api/v1/uptime-checks/{id}/diagnose ### Description Run a diagnosis on an uptime check. ### Method GET ### Endpoint /api/v1/uptime-checks/{id}/diagnose ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the uptime check. ``` -------------------------------- ### GET /api/v1/cache/plans?provider= Source: https://github.com/adriansilaghi/danube-cli Retrieve cache plans, optionally filtered by provider. ```APIDOC ## [GET] /api/v1/cache/plans?provider= ### Description Retrieve cache plans, optionally filtered by provider. ### Method GET ### Endpoint /api/v1/cache/plans?provider= ### Parameters #### Query Parameters - **provider** (string) - Optional - Provider to filter plans. ``` -------------------------------- ### GET /api/v1/storage/buckets/{id}/metrics/health Source: https://github.com/adriansilaghi/danube-cli Retrieve hygiene health metrics for a bucket. ```APIDOC ## [GET] /api/v1/storage/buckets/{id}/metrics/health ### Description Retrieve hygiene health metrics for a bucket. ### Method GET ### Endpoint /api/v1/storage/buckets/{id}/metrics/health ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the bucket. ### Response #### Success Response (200) Returns a `BucketHealthResponse` object. ``` -------------------------------- ### waitUntilServed Source: https://github.com/adriansilaghi/danube-cli Performs external confirmation by fetching the site's root URL and checking if the new build is being served. Returns a ServeOutcome indicating whether the build is live, password-protected, or not yet confirmed. ```APIDOC ## waitUntilServed ### Description External confirmation: fetches `/` with `User-Agent: DanubeCLI/` and `Cache-Control: no-cache` (10 s per probe). `401` → `password_protected`; otherwise parses the HTML: `servesBuild(html, buildId)` is true when the page carries `?v=` on a css/js reference, or when **no** build stamp is present at all (unstamped pages cannot be told apart). Any transport failure is `waiting` ("not yet", never a verdict). 90 s ceiling → `not_confirmed`. ### Signature ```typescript export async function waitUntilServed(siteUrl: string, buildId: string): Promise ``` ### Parameters - **siteUrl** (string) - Required - The URL of the deployed static site. - **buildId** (string) - Required - The ID of the build to confirm is being served. ### Returns - **Promise** - Resolves to a `ServeOutcome` indicating the serving status. ``` -------------------------------- ### GET /api/v1/serverless/{id}/events Source: https://github.com/adriansilaghi/danube-cli Retrieves platform events for a serverless container. ```APIDOC ## [GET] /api/v1/serverless/{id}/events ### Description Retrieves platform events for a serverless container. ### Method GET ### Endpoint /api/v1/serverless/{id}/events ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the serverless container ### Response #### Success Response (200) - List of platform events ``` -------------------------------- ### Error handling for empty output directory Source: https://github.com/adriansilaghi/danube-cli Example showing error handling when packageDirectory throws because every file was ignored. The error message is 'No files to deploy. Check your output directory and ignore patterns.' The caller's --dir or danube.json.ignore is wrong, so this is a usage-style failure. ```typescript import { packageDirectory } from './lib/packager.js'; let zip: Buffer; try { ({ buffer: zip } = await packageDirectory('.', ['!index.html'])); } catch (err) { // Thrown when every file was ignored: "No files to deploy. Check your // output directory and ignore patterns." — the caller's --dir or // danube.json.ignore is wrong, so this is a usage-style failure. console.error(err instanceof Error ? err.message : err); process.exit(1); } ``` -------------------------------- ### registry usage Source: https://github.com/adriansilaghi/danube-cli Retrieves registry usage information. ```APIDOC ## [GET] /api/v1/registry/usage ### Description Retrieves registry usage information. ### Method GET ### Endpoint /api/v1/registry/usage ``` -------------------------------- ### GET /api/v1/serverless/{id}/revisions Source: https://github.com/adriansilaghi/danube-cli Retrieves Knative revisions for a serverless container. ```APIDOC ## [GET] /api/v1/serverless/{id}/revisions ### Description Retrieves Knative revisions for a serverless container. ### Method GET ### Endpoint /api/v1/serverless/{id}/revisions ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the serverless container ### Response #### Success Response (200) - List of Knative revisions ``` -------------------------------- ### Batch resolve with exact matching Source: https://github.com/adriansilaghi/danube-cli Example call to `resolveResources` with `{ exact: true }` to resolve multiple bucket references. Requires an authenticated `ApiClient` and an import of `resolveResources` and `ResolvableResource`. Resolves `['invoices', 'reports', '01ax...']` against `/api/v1/storage/buckets`; prints each bucket's id. ```typescript import { resolveResources } from './lib/resolve.js'; import type { ResolvableResource } from './lib/resolve.js'; const buckets = await resolveResources( api, '/api/v1/storage/buckets', 'bucket', ['invoices', 'reports', '01ax...'], { exact: true }, ); for (const b of buckets) console.log(b.id); ``` -------------------------------- ### GET /api/v1/serverless/{id}/deployments Source: https://github.com/adriansilaghi/danube-cli Retrieves the deployment history for a serverless container. ```APIDOC ## [GET] /api/v1/serverless/{id}/deployments ### Description Retrieves the deployment history for a serverless container. ### Method GET ### Endpoint /api/v1/serverless/{id}/deployments ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the serverless container ### Response #### Success Response (200) - List of deployments ``` -------------------------------- ### pg ls Source: https://github.com/adriansilaghi/danube-cli Lists parameter groups, optionally filtered by type and provider. ```APIDOC ## [GET] /api/v1/parameter-groups ### Description Lists parameter groups. ### Method GET ### Endpoint /api/v1/parameter-groups ### Parameters #### Query Parameters - **type** (string) - Optional - Filter by type: `cache`, `database`, `queue`. - **provider** (string) - Optional - Filter by provider (e.g., `redis`, `mysql`). ### Response #### Success Response (200) - **parameter_groups** (array) - List of parameter group objects. ``` -------------------------------- ### GET /api/v1/static-sites/{siteId}/domains Source: https://github.com/adriansilaghi/danube-cli Lists all domains associated with a static site. ```APIDOC ## [GET] /api/v1/static-sites/{siteId}/domains ### Description Lists all domains associated with a static site. ### Method GET ### Endpoint /api/v1/static-sites/{siteId}/domains ### Parameters #### Path Parameters - **siteId** (string) - Required - The unique identifier of the static site ### Response #### Success Response (200) - List of domains ``` -------------------------------- ### POST /api/v1/vps Source: https://github.com/adriansilaghi/danube-cli Creates a new VPS instance. The command requires an image ID and a resource profile (or plan alias), and supports various options for CPU, network, and authentication. ```APIDOC ## POST /api/v1/vps ### Description Creates a new VPS instance. The command requires an image ID and a resource profile (or plan alias), and supports various options for CPU, network, and authentication. ### Method POST ### Endpoint /api/v1/vps ### Parameters #### Request Body - **name** (string) - Required - Name of the VPS - **image** (string) - Required - Image ID (e.g., `ubuntu-24.04`) - **resource_profile** (string) - Required - Resource profile slug (canonical) or plan alias - **cpu_allocation_type** (string) - Optional - `shared` or `dedicated` (alias: `cpu-type`) - **cpu_platform** (string) - Required - `amd` or `intel` (alias: `processor`) - **network_stack** (string) - Optional - `dual_stack`, `ipv4_only`, or `ipv6_only` (alias: `network`) - **ssh_key_id** (string) - Optional - SSH key ID - **password** (string) - Optional - Password (min 12 characters) - **datacenter** (string) - Optional - Datacenter location (default `fsn1`) ### Response #### Success Response (201) - **id** (string) - VPS ID - **name** (string) - VPS name - **status** (string) - VPS status ``` -------------------------------- ### formatCores and formatBytesBinary in units.ts Source: https://github.com/adriansilaghi/danube-cli formatCores returns millicores (e.g., '250m') for values under 1 core, otherwise 2-decimal cores with trailing zeros trimmed; non-finite or negative values return '-'. formatBytesBinary formats KiB/MiB/GiB/TiB with one decimal trimmed (e.g., '256 MiB'), matching Kubernetes binary quantities. ```typescript export function formatCores(cores: number): string export function formatBytesBinary(bytes: number): string ``` -------------------------------- ### GET /api/v1/metric-alerts/{resourceType}/available-metrics Source: https://github.com/adriansilaghi/danube-cli List the metrics that can be alerted on for a given resource type. ```APIDOC ## [GET] /api/v1/metric-alerts/{resourceType}/available-metrics ### Description List alertable metrics for a resource type. ### Method GET ### Endpoint /api/v1/metric-alerts/{resourceType}/available-metrics ### Parameters #### Path Parameters - **resourceType** (string) - Required - The resource type. ``` -------------------------------- ### danube pages deploy Source: https://github.com/adriansilaghi/danube-cli/blob/main/README.md Deploys the linked site. Supports options for specifying a directory and waiting behavior. The command waits for the build and publication, then prints 'Live at' when the site is live. ```APIDOC ## danube pages deploy ### Description Deploys the linked site. Supports options for specifying a directory and waiting behavior. The command waits for the build and publication, then prints 'Live at' when the site is live. ### Method CLI Command ### Command `danube pages deploy` ### Parameters #### Options - `--dir ` - Optional - Deploy a specific directory instead of the current directory. - `--no-wait` - Optional - Don't wait for the build to complete. ### Response #### Success Response - Prints `Live at` when the site is live. - Under `--json`, the result carries `revision`, `url`, and `live`. #### Error Response - A failed deploy is a `success: false` envelope with a `static_site.*` error code. ### Request Example ```bash danube pages deploy # Deploy current directory danube pages deploy --dir dist # Deploy a specific directory danube pages deploy --no-wait # Don't wait for build ``` ``` -------------------------------- ### GET /api/v1/uptime-checks/{id}/incidents Source: https://github.com/adriansilaghi/danube-cli Retrieve the outage history for a specific uptime check. ```APIDOC ## [GET] /api/v1/uptime-checks/{id}/incidents ### Description Get outage history for an uptime check. ### Method GET ### Endpoint /api/v1/uptime-checks/{id}/incidents ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the uptime check. ``` -------------------------------- ### danube storage buckets create Source: https://github.com/adriansilaghi/danube-cli/blob/main/README.md Creates a new bucket. Can be run interactively or with flags. ```APIDOC ## danube storage buckets create ### Description Creates a new bucket. Can be run interactively or with flags. ### Method CLI command ### Command `danube storage buckets create` ### Parameters #### Flags - `--name` (string) - Optional - Name of the bucket. - `--region` (string) - Optional - Region for the bucket. - `--versioning` (flag) - Optional - Enable versioning on the bucket. ### Request Example ```bash # Interactive danube storage buckets create # With flags danube storage buckets create --name my-bucket --region fsn1 --versioning ``` ``` -------------------------------- ### GET /api/v1/storage/buckets/{id}/metrics Source: https://github.com/adriansilaghi/danube-cli Retrieve a snapshot of storage metrics for a specific bucket. ```APIDOC ## [GET] /api/v1/storage/buckets/{id}/metrics ### Description Retrieve a snapshot of storage metrics for a specific bucket. ### Method GET ### Endpoint /api/v1/storage/buckets/{id}/metrics ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the bucket. ### Response #### Success Response (200) Returns a `StorageMetrics` object. ``` -------------------------------- ### uptime ls Source: https://github.com/adriansilaghi/danube-cli Lists all uptime checks. ```APIDOC ## [GET] /api/v1/uptime-checks ### Description Lists all uptime checks. ### Method GET ### Endpoint /api/v1/uptime-checks ### Response #### Success Response (200) - **uptime_checks** (array) - List of uptime check objects. ``` -------------------------------- ### danube storage buckets ls Source: https://github.com/adriansilaghi/danube-cli/blob/main/README.md Lists all buckets in the project. ```APIDOC ## danube storage buckets ls ### Description Lists all buckets in the project. ### Method CLI command ### Command `danube storage buckets ls` ```