diff --git a/docs.json b/docs.json index c0d40d2..1e5d4a6 100644 --- a/docs.json +++ b/docs.json @@ -126,7 +126,10 @@ "tab": "CLI", "icon": "terminal", "pages": [ - "reference/cli" + "reference/cli", + "reference/cli/auth", + "reference/cli/browsers", + "reference/cli/apps" ] } ] diff --git a/reference/cli.mdx b/reference/cli.mdx index 8f032a0..de36ac6 100644 --- a/reference/cli.mdx +++ b/reference/cli.mdx @@ -6,8 +6,6 @@ The Kernel CLI helps you access and manage your Kernel resources. ## Installation -Install the Kernel CLI using your favorite package manager: - ```bash # Using brew brew install onkernel/tap/kernel @@ -19,94 +17,44 @@ pnpm install -g @onkernel/cli npm install -g @onkernel/cli ``` -## Authentication - -The Kernel CLI supports two authentication methods: - -### OAuth 2.0 (Recommended) - -The preferred method is OAuth 2.0 with PKCE, which provides secure browser-based authentication: +Verify installation: ```bash -kernel login +which kernel +kernel --version ``` -This opens your browser to complete the OAuth flow. Your tokens are securely stored in your system keychain (macOS/Windows) or a local file (Linux). - -### API Key + + + Login, logout, and check auth status. + + + Create, view, and manage Kernel browsers. + + + Deploy apps, invoke actions, and stream logs. + + -You can also authenticate using an API key: +## Quick Start ```bash -export KERNEL_API_KEY= -``` +# 1) Login +kernel login -## Verifying installation -After installation, verify that Kernel CLI was installed correctly: +# 2) Deploy your app +kernel deploy index.ts -```bash -which kernel +# 3) Invoke your app +kernel invoke my-app action-name --payload '{"key":"value"}' ``` ## Global Flags -| Flag | Description | -|------|-------------| -| `--version`, `-v` | Print the CLI version | -| `--no-color` | Disable color output | -| `--log-level ` | Set the log level (trace, debug, info, warn, error, fatal, print) | - -## Authentication Commands - -| Command | Description | -|---------|-------------| -| `kernel login [--force]` | Initiates OAuth 2.0 authentication flow via browser. Use `--force` to re-authenticate when already logged in | -| `kernel logout` | Clears stored authentication tokens and logs out | -| `kernel auth` | Displays current authentication status, user details, and token expiry. Use `--log-level debug` for detailed information including user ID and storage method | - -## Browser Management Commands - -| Command | Description | -|---------|-------------| -| `kernel browsers list` | List running or persistent browsers | -| `kernel browsers create` | Create a new browser session | -| | `--persistence-id ` | Unique identifier for browser session persistence. Optional. | -| | `--stealth` | Launch browser in stealth mode to avoid detection. Optional. | -| | `--headless` | Launch browser without GUI access. Optional. | -| `kernel browsers delete` | Delete a browser. Must specify either `--by-persistent-id` or `--by-id` | -| | `--by-persistent-id ` | Delete browser by persistent ID | -| | `--by-id ` | Delete browser by session ID | -| | `--yes`, `-y` | Skip confirmation prompt | -| `kernel browsers view` | Get the live view URL for a browser. Must specify either `--by-persistent-id` or `--by-id` | -| | `--by-persistent-id ` | View browser by persistent ID | -| | `--by-id ` | View browser by session ID | - -## App Management Commands - -| Command | Optional Flags | Description | -|---------|-------------| -------------| -| `kernel deploy ` | - | Deploys an app to Kernel from the current directory. | -| | `--version ` | Specify a version for the app (default: latest). Optional. | -| | `--force` | Allow overwrite of an existing version with the same name. Optional. | -| | `--env `, `-e` | Adds environment variables to the app. Expects the form `ENV_VAR=VAL` delimited by spaces. May be specified multiple times. Optional. | -| | `--env-file ` | Read environment variables from a file (.env format). May be specified multiple times. Optional. | -| `kernel invoke ` | - | Invokes a specific app action by its name. Generates an Invocation. | -| | `--version `, `-v` | Specify a version of the app to invoke (default: latest). Optional. | -| | `--payload `, `-p` | Includes the specified parameters. Expects a stringified JSON object. Optional. | -| | `--sync`, `-s` | Invoke synchronously (default false). A synchronous invocation opens a long-lived HTTP POST that times out after 60 seconds. Optional. | -| | `ctrl-c` | Terminates the running invocation in your CLI. Also destroys any associated browsers. | -| `kernel app list` | - | List deployed application versions. | -| | `--name ` | Filter by application name. Optional. | -| | `--version ` | Filter by version label. Optional. | -| `kernel app history ` | - | Show deployment history for an application. | -| `kernel logs ` | - | Prints the logs for the specified app. | -| | `--version ` | Specify a version of the app (default: latest). Optional. | -| | `--follow`, `-f` | Follow logs in real-time (stream continuously). Optional. | -| | `--since