@@ -10,35 +10,19 @@ npm install @codebuff/sdk
1010
1111## Prerequisites
1212
13- 1 . Install the Codebuff CLI globally:
14-
15- ``` bash
16- npm install -g codebuff
17- ```
18-
19- 2 . Login to ` codebuff ` to store the API key in your local config:
20- ``` bash
21- codebuff login
22- ```
13+ 1 . Create a [ Codebuff account] ( https://codebuff.com )
14+ 2 . Get your [ Codebuff API key] ( https://www.codebuff.com/profile?tab=api-keys )
2315
2416## Usage
2517
2618### Basic Example
2719
2820``` typescript
29- import * as fs from ' fs'
30- import * as os from ' os'
3121import { CodebuffClient } from ' @codebuff/sdk'
3222
33- // Available after running `codebuff login`
34- const apiKey = JSON .parse (
35- fs
36- .readFileSync (os .homedir () + ' /.config/manicode/credentials.json' )
37- .toString (),
38- ).default .authToken
39-
4023const client = new CodebuffClient ({
41- apiKey ,
24+ // Note: You need to pass in your own API key here.
25+ apiKey: process .env .CODEBUFF_API_KEY ,
4226 cwd: process .cwd (),
4327 onError : (e ) => console .error (' Codebuff error:' , e .message ),
4428})
@@ -66,8 +50,6 @@ client.closeConnection()
6650### Advanced Example with Custom Agents, Tools, and Images
6751
6852``` typescript
69- import * as fs from ' fs'
70- import * as os from ' os'
7153import { z } from ' zod'
7254import {
7355 CodebuffClient ,
@@ -76,15 +58,9 @@ import {
7658 getCustomToolDefinition ,
7759} from ' @codebuff/sdk'
7860
79- // Available after running `codebuff login`
80- const apiKey = JSON .parse (
81- fs
82- .readFileSync (os .homedir () + ' /.config/manicode/credentials.json' )
83- .toString (),
84- ).default .authToken
85-
8661const client = new CodebuffClient ({
87- apiKey ,
62+ // Note: You need to pass in your own API key here.
63+ apiKey: process .env .CODEBUFF_API_KEY ,
8864 cwd: process .cwd (),
8965 onError : (e ) => console .error (' Codebuff error:' , e .message ),
9066})
0 commit comments