From 1c247d8c5024b4ef2625b4e9a8eeb0347adfbd96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=AE=B6=E5=90=8D?= Date: Mon, 9 Mar 2026 16:59:54 +0800 Subject: [PATCH 1/3] docs: add advanced usage guide to README - Add custom agent workflows section - Add multi-model support examples - Add multi-agent orchestration examples - Add CI/CD integration examples - Add environment variables documentation - Add keyboard shortcuts reference --- README.md | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/README.md b/README.md index 275ed31cd..c3a74673e 100644 --- a/README.md +++ b/README.md @@ -157,6 +157,74 @@ Learn more about the SDK [here](https://www.npmjs.com/package/@codebuff/sdk). **SDK**: Build Codebuff into your applications. Create custom tools, integrate with CI/CD, or embed coding assistance into your products. +## Advanced Usage + +### Custom Agent Workflows + +Create your own agents with specialized workflows using the `/init` command: + +```bash +codebuff +/init +``` + +This creates a custom agent structure in `.agents/` that you can customize. + +### Using Different Models + +Codebuff supports any model on OpenRouter. Override the default model per task: + +```typescript +const result = await client.run({ + agent: 'editor', + prompt: 'Refactor this function', + model: 'deepseek/deepseek-chat', // Use DeepSeek for this task +}) +``` + +### Multi-Agent Orchestration + +Codebuff's strength is coordinating multiple specialized agents: + +```typescript +const result = await client.run({ + agent: 'commander', // The orchestrator agent + prompt: 'Add authentication to the API - use file-picker to find relevant files, planner to plan changes, editor to make edits, and reviewer to validate', +}) +``` + +### CI/CD Integration + +Integrate Codebuff into your CI pipeline for automated code reviews: + +```bash +# In your CI script +codebuff "Review the changes in this PR for security issues" +``` + +### Environment Variables + +Configure Codebuff behavior via environment variables: + +```bash +# Use a specific OpenRouter API key +export OPENROUTER_API_KEY=sk-or-v1-xxxx + +# Set default model +export CODEBUFF_MODEL=anthropic/claude-3.5-sonnet + +# Enable debug mode +export DEBUG=codebuff* +``` + +### Keyboard Shortcuts (Interactive Mode) + +- `Ctrl+C` - Cancel current operation +- `Ctrl+L` - Clear screen +- `Ctrl+U` - Clear current input +- `Ctrl+P/N` - Navigate command history +- `Tab` - Autocomplete + ## Contributing to Codebuff We ❤️ contributions from the community - whether you're fixing bugs, tweaking our agents, or improving documentation. From 9ec9a2005ff98c6c1db30cdf4f3c09ded6e8c7ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=AE=B6=E5=90=8D?= Date: Mon, 9 Mar 2026 20:32:50 +0800 Subject: [PATCH 2/3] fix: improve environment validation error messages - Add console.error output before throwing validation errors - Include specific error details in the thrown error message - Makes debugging environment configuration issues easier --- common/src/env.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/env.ts b/common/src/env.ts index f9328f91c..0e30987b7 100644 --- a/common/src/env.ts +++ b/common/src/env.ts @@ -2,7 +2,8 @@ import { clientEnvSchema, clientProcessEnv } from './env-schema' const parsedEnv = clientEnvSchema.safeParse(clientProcessEnv) if (!parsedEnv.success) { - throw parsedEnv.error + console.error('Environment validation failed:', parsedEnv.error.errors) + throw new Error(`Invalid environment configuration: ${parsedEnv.error.message}`) } export const env = parsedEnv.data From 50f8c9a7d5ab4beabaf4ecd9cb7078248fb140b5 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Mon, 9 Mar 2026 13:03:47 -0700 Subject: [PATCH 3/3] Remove sections on usage and configuration from README Removed sections on using different models, multi-agent orchestration, CI/CD integration, environment variables, and keyboard shortcuts from the README. --- README.md | 55 ------------------------------------------------------- 1 file changed, 55 deletions(-) diff --git a/README.md b/README.md index c3a74673e..4c5eaf9de 100644 --- a/README.md +++ b/README.md @@ -170,61 +170,6 @@ codebuff This creates a custom agent structure in `.agents/` that you can customize. -### Using Different Models - -Codebuff supports any model on OpenRouter. Override the default model per task: - -```typescript -const result = await client.run({ - agent: 'editor', - prompt: 'Refactor this function', - model: 'deepseek/deepseek-chat', // Use DeepSeek for this task -}) -``` - -### Multi-Agent Orchestration - -Codebuff's strength is coordinating multiple specialized agents: - -```typescript -const result = await client.run({ - agent: 'commander', // The orchestrator agent - prompt: 'Add authentication to the API - use file-picker to find relevant files, planner to plan changes, editor to make edits, and reviewer to validate', -}) -``` - -### CI/CD Integration - -Integrate Codebuff into your CI pipeline for automated code reviews: - -```bash -# In your CI script -codebuff "Review the changes in this PR for security issues" -``` - -### Environment Variables - -Configure Codebuff behavior via environment variables: - -```bash -# Use a specific OpenRouter API key -export OPENROUTER_API_KEY=sk-or-v1-xxxx - -# Set default model -export CODEBUFF_MODEL=anthropic/claude-3.5-sonnet - -# Enable debug mode -export DEBUG=codebuff* -``` - -### Keyboard Shortcuts (Interactive Mode) - -- `Ctrl+C` - Cancel current operation -- `Ctrl+L` - Clear screen -- `Ctrl+U` - Clear current input -- `Ctrl+P/N` - Navigate command history -- `Tab` - Autocomplete - ## Contributing to Codebuff We ❤️ contributions from the community - whether you're fixing bugs, tweaking our agents, or improving documentation.