diff --git a/AGENTS.md b/AGENTS.md index d7e3cc8aa..f8990778f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -115,3 +115,39 @@ EOF ``` This is a Claude Code quirk, not a clawdbot bug. + +--- + +## PR & Code Review Checklist + +Before creating PRs or presenting code for review (especially to senior engineers): + +### 1. Verify Code Quality +- [ ] Run `pnpm lint` - no errors +- [ ] Run `pnpm build` - TypeScript compiles +- [ ] Run related tests - all pass + +### 2. Review Diff Purity +- [ ] Diff is minimal and focused on the feature +- [ ] No unrelated changes bundled in +- [ ] Patch files: **append** changes, don't replace entire files + +### 3. Self-Critique Questions +- Is the auth resolution chain correct? +- Are type changes safe and backwards compatible? +- Would this pass review by John Carmack? (clarity > cleverness) + +### 4. Fork Workflow (when applicable) +```bash +# Push to fork +git remote add fork https://github.com/USERNAME/clawdbot +git push fork branch-name + +# Create PR from fork +gh pr create --head USERNAME:branch-name --base main +``` + +### 5. Git Diff Interpretation +- `-` lines = content being **removed** +- `+` lines = content being **added** +- Verify you understand what the diff actually shows diff --git a/patches/@mariozechner__pi-ai@0.42.1.patch b/patches/@mariozechner__pi-ai@0.42.1.patch index e4a1be4c1..f268e0d4d 100644 --- a/patches/@mariozechner__pi-ai@0.42.1.patch +++ b/patches/@mariozechner__pi-ai@0.42.1.patch @@ -55,3 +55,16 @@ index 20fb0a22aaa28f7ff7c2f44a8b628fa1d9d7d936..0bf46bfb4a6fac5a0304652e42566b2c const reasoningItem = JSON.parse(block.thinkingSignature); output.push(reasoningItem); } + +diff --git a/dist/stream.js b/dist/stream.js +index 0000000..2222222 100644 +--- a/dist/stream.js ++++ b/dist/stream.js +@@ -43,6 +43,7 @@ export function getEnvApiKey(provider) { + xai: "XAI_API_KEY", + openrouter: "OPENROUTER_API_KEY", + zai: "ZAI_API_KEY", ++ minimax: "MINIMAX_API_KEY", + mistral: "MISTRAL_API_KEY", + }; + const envVar = envMap[provider]; diff --git a/src/commands/configure.ts b/src/commands/configure.ts index e7229c9ac..0c4780e80 100644 --- a/src/commands/configure.ts +++ b/src/commands/configure.ts @@ -70,6 +70,7 @@ import { healthCommand } from "./health.js"; import { formatHealthCheckFailure } from "./health-format.js"; import { applyAuthProfileConfig, + applyMinimaxApiConfig, applyMinimaxConfig, applyMinimaxHostedConfig, applyOpencodeZenConfig, @@ -369,6 +370,7 @@ async function promptAuthConfig( | "gemini-api-key" | "apiKey" | "minimax-cloud" + | "minimax-api" | "minimax" | "opencode-zen" | "skip"; @@ -788,6 +790,21 @@ async function promptAuthConfig( next = applyMinimaxHostedConfig(next); } else if (authChoice === "minimax") { next = applyMinimaxConfig(next); + } else if (authChoice === "minimax-api") { + const key = guardCancel( + await text({ + message: "Enter MiniMax API key", + validate: (value) => (value?.trim() ? undefined : "Required"), + }), + runtime, + ); + await setMinimaxApiKey(String(key).trim()); + next = applyAuthProfileConfig(next, { + profileId: "minimax:default", + provider: "minimax", + mode: "api_key", + }); + next = applyMinimaxApiConfig(next); } else if (authChoice === "opencode-zen") { note( [ diff --git a/src/commands/onboard-auth.ts b/src/commands/onboard-auth.ts index 303512c5a..43f16ac2a 100644 --- a/src/commands/onboard-auth.ts +++ b/src/commands/onboard-auth.ts @@ -336,7 +336,7 @@ export function applyMinimaxApiProviderConfig( const providers = { ...cfg.models?.providers }; providers.minimax = { baseUrl: MINIMAX_API_BASE_URL, - apiKey: "", // Resolved via MINIMAX_API_KEY env var or auth profile + // apiKey omitted: resolved via MINIMAX_API_KEY env var or auth profile by default. api: "anthropic-messages", models: [buildMinimaxApiModelDefinition(modelId)], }; diff --git a/src/config/types.ts b/src/config/types.ts index c7c940f4a..dbac18a92 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -1201,7 +1201,7 @@ export type ModelDefinitionConfig = { export type ModelProviderConfig = { baseUrl: string; - apiKey: string; + apiKey?: string; api?: ModelApi; headers?: Record; authHeader?: boolean; diff --git a/src/config/zod-schema.ts b/src/config/zod-schema.ts index 3f07f7d96..99ae0f95a 100644 --- a/src/config/zod-schema.ts +++ b/src/config/zod-schema.ts @@ -40,7 +40,7 @@ const ModelDefinitionSchema = z.object({ const ModelProviderSchema = z.object({ baseUrl: z.string().min(1), - apiKey: z.string().min(1), + apiKey: z.string().min(1).optional(), api: ModelApiSchema.optional(), headers: z.record(z.string(), z.string()).optional(), authHeader: z.boolean().optional(),