bai-cli

Tests and verifies Backend.AI REST API endpoints using the v2 ./bai CLI command reference.

672|181|Updated Oct 6, 2016
One-click install
npx skills add https://github.com/lablup/backend.ai --skill bai-cli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bai-cli
Source: https://github.com/lablup/backend.ai/tree/main/.claude/skills/bai-cli
Command: npx skills add https://github.com/lablup/backend.ai --skill bai-cli

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers working on Backend.AI need a reliable way to test and verify REST API endpoints and manage cluster resources, but the v2 ./bai CLI has a large entity-command surface that is easy to misuse or confuse with the legacy v1 CLI. This Skill provides the authoritative entity-command reference, login/config setup, and testing workflow so commands are correct on the first attempt.

Core Features & Use Cases

  • Entity-Command Reference: Complete mapping of every entity (domain, user, session, deployment, vfolder, rbac, etc.) to its user/admin/my commands, preventing fabricated or guessed CLI invocations.
  • Login & Configuration Guidance: Covers session-based webserver auth and direct API (HMAC) auth, including non-interactive login for CI environments.
  • Testing Workflow: Step-by-step verification procedure after server code changes, including permission-boundary checks (403 tests), smoke test scripts, and raw GraphQL fallback via ./bai gql.
  • Use Case: After modifying the session API, run ./bai admin session search --limit 1 to confirm connectivity, then log in as a regular user to verify admin-only commands correctly return 403.

Quick Start

Ask the AI to verify a Backend.AI API endpoint by running the appropriate ./bai entity command from the reference, such as searching admin domains with a limit of one.

Frequently Asked Questions about bai-cli

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test Backend.AI API endpoints with the bai CLI?

Configure the endpoint with ./bai config set endpoint and log in via ./bai login, then run entity commands like ./bai admin domain search --limit 1 to verify connectivity. Check the entity-command reference first to confirm the command exists before running it.

What is the difference between the bai v2 CLI and the backend.ai v1 CLI?

The ./bai v2 CLI is a REST API client using singular entity names like project and commands like ./bai my session search. The legacy v1 backend.ai CLI uses different terminology such as group and should not be used for testing.

How do I log in to the bai CLI non-interactively in CI?

Set the BACKEND_USER and BACKEND_PASSWORD environment variables before running ./bai login, for example [email protected] BACKEND_PASSWORD=... ./bai login. The session cookie is stored in ~/.backend.ai/session/cookie.dat.

What should I do when a bai CLI command is not implemented?

Confirm the command is absent from the entity-command reference, then report that the operation is not provided via the CLI. As a temporary workaround, use ./bai gql to run a raw GraphQL query if the operation exists in the GraphQL schema.

How do I test admin-only permission boundaries with the bai CLI?

Run the admin command with superadmin credentials to confirm it succeeds, then log in as a regular user from fixtures/manager/example-users.json and run the same command, which should fail with a 403 error.

Can the bai CLI send raw GraphQL queries?

Yes, ./bai gql sends raw GraphQL queries directly, supporting --v2 for the Strawberry v2 schema, --var for query variables, -f to read from a file, and stdin input. It is useful when no REST CLI command exists for an operation.