Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
193 commits
Select commit Hold shift + click to select a range
6636874
rename agent state to session state
charleslien Jun 20, 2025
208515c
Change start-bin to use dev keys
jahooma Jun 24, 2025
c9a6d86
Add backend-initiated tool call system
brandonkachen Jun 23, 2025
fffdd01
move agent state stuff into mainAgentState field
charleslien Jun 20, 2025
44707a4
add tool call for spawn agent
charleslien Jun 24, 2025
c12567c
Use request tool call to perform all tool calls except end turn
jahooma Jun 24, 2025
cdb97bf
Simple file_picker agent
jahooma Jun 24, 2025
042a730
use templates in main-prompt
charleslien Jun 24, 2025
30a83a9
Add fields for initialAgentMessage & initialAgentPrefix
jahooma Jun 24, 2025
3edcf3d
add stop sequences to agent templates
charleslien Jun 24, 2025
733ec12
Tweak file picker, import model constants
jahooma Jun 24, 2025
fa02e03
Factor out base agent prompts
jahooma Jun 24, 2025
054b940
Rename file to pro thinking (not flash)
jahooma Jun 24, 2025
105eb80
Implement max mode with an agent that spawns thinking
jahooma Jun 24, 2025
0b9a137
add getAgentPrompt for initialAssistantMessage and initialAssistantPr…
charleslien Jun 24, 2025
d3eb26e
Add include_message_history bool in spawn agent
jahooma Jun 24, 2025
6f24af4
Fix types
jahooma Jun 24, 2025
1b201b3
Make agent templates files a function of model
jahooma Jun 24, 2025
02b8831
create run-agent-step.ts
charleslien Jun 24, 2025
68b53de
call runAgentStep from main prompt
charleslien Jun 24, 2025
cc22270
fix type errors
charleslien Jun 25, 2025
f8f1ff5
re-add detecting terminal commands
charleslien Jun 25, 2025
eaa0c58
Refactor: decouple requestRelevantFiles from getFileReadingUpdates
jahooma Jun 25, 2025
480c4d7
More getFileReadingUpdates cleanup
jahooma Jun 25, 2025
e5bfc81
Delete some dead code in request-files-prompt.ts
jahooma Jun 25, 2025
cc8866d
loop runAgentStep in main prompt
charleslien Jun 25, 2025
89fe14a
logging stuff
charleslien Jun 25, 2025
f2012c2
Initial planner agent
jahooma Jun 25, 2025
34c8740
add end_turn
charleslien Jun 25, 2025
ef91bf4
remove research tool
charleslien Jun 25, 2025
5aafb1c
remove references to research tool
charleslien Jun 25, 2025
a460412
fix main-prompt tests
charleslien Jun 25, 2025
3b98520
fix new files necessary integration test
charleslien Jun 25, 2025
799db7a
spawn_agents: use loopAgentSteps
jahooma Jun 25, 2025
5314c04
[buffbench] fix evals
charleslien Jun 25, 2025
bd25003
[buffbench] remove logging to stdout
charleslien Jun 25, 2025
7192512
spawn_agents: give tool results based on `report` object
jahooma Jun 25, 2025
fe3f64e
Implement assistantMessage and assistantPrefix for agentStep
jahooma Jun 25, 2025
da89095
fix stepsRemaining in evals
charleslien Jun 25, 2025
e63776f
Add update_report tool call
jahooma Jun 25, 2025
4ab4f20
Update agents: spawnable agents, tools, prompts
jahooma Jun 25, 2025
b0dd266
Support stepAssistantMessage and stepAssistantPrefix
jahooma Jun 25, 2025
86f7ede
Let agents know about what agents they can spawn
jahooma Jun 25, 2025
f3e9f7c
update tool call format
charleslien Jun 26, 2025
f295a74
Add spawn_agents to base tools, stop_sequences
jahooma Jun 26, 2025
f67dbed
update example for read_files
charleslien Jun 26, 2025
c4a9de2
remove hardcoded tool calls from base-prompts
charleslien Jun 26, 2025
dfd7f80
fix tool parsing
charleslien Jun 26, 2025
b1d5fc6
formatPrompt on assistantMessage & assistantPrefix. Tell filepicker t…
jahooma Jun 26, 2025
0cc8839
add flags to run-eval-set
charleslien Jun 26, 2025
23d3a03
add email title to run-eval-set
charleslien Jun 26, 2025
77c33ab
fix: common -> @codebuff/common
brandonkachen Jun 26, 2025
8d557be
Update npm-app-release-staging.yml
brandonkachen Jun 26, 2025
ace5b3e
fix zod versions
charleslien Jun 26, 2025
afdfa2c
fix type errors
charleslien Jun 26, 2025
305be29
Add read_docs tool with Context7 API integration
brandonkachen Jun 26, 2025
8822552
change string format for tool calls
charleslien Jun 26, 2025
767120b
fix start-bin
charleslien Jun 26, 2025
e82bced
reference backend toolParams instead of common
charleslien Jun 26, 2025
cf2fd20
fix type errors
charleslien Jun 26, 2025
1e95302
Add prompt schema, which lets you set params per agent template
jahooma Jun 26, 2025
5731f0e
Updates for agent templates (include tools)
jahooma Jun 26, 2025
bdd69f4
Render spawned agents nicer
jahooma Jun 26, 2025
c6a6dd0
change email title format
charleslien Jun 26, 2025
779d83a
[buffbench] testing
charleslien Jun 26, 2025
65dade3
update instructions for array params
charleslien Jun 26, 2025
8adace8
Log update_report separately. Tweak planning agent
jahooma Jun 26, 2025
0537461
agent tweaks
jahooma Jun 27, 2025
45e184e
tweak
jahooma Jun 27, 2025
e5bbe8e
run-single-eval command on hand-picked eval
jahooma Jun 27, 2025
cb4fe9c
Config evals by agent type instead of modelConfig
jahooma Jun 27, 2025
cd9b5bb
don't use planner. use thinker
jahooma Jun 27, 2025
98436e7
Add reviewer agent
jahooma Jun 27, 2025
ccfd912
Tweaks for reviewer
jahooma Jun 27, 2025
034e72e
Tweaks for file picker
jahooma Jun 27, 2025
6875e7a
Implement outputMode: 'last_message' or 'report'.
jahooma Jun 27, 2025
8f47832
Make message history appear within one user message. Tweak reviewer
jahooma Jun 27, 2025
4ee4389
Add opus base. Use in max mode
jahooma Jun 27, 2025
954f374
Make sure reviewer gets the latest tool call results
jahooma Jun 27, 2025
d8083ca
Switch back to sonnet for evals
jahooma Jun 27, 2025
9c46bf8
fix unit tests and types
charleslien Jun 27, 2025
bdf878f
Merge branch 'main' into colony
brandonkachen Jun 27, 2025
feb45b5
Update npm-app-release-staging.yml
brandonkachen Jun 27, 2025
9051388
Revert "Update npm-app-release-staging.yml"
brandonkachen Jun 27, 2025
91e597c
fix diff and file change hooks
charleslien Jun 27, 2025
7896306
Add cwd and flags params to ripgrep. Add unit tests!
jahooma Jun 27, 2025
4b6145f
Tweak prompts to use str_replace instead of write_file in more cases:
jahooma Jun 27, 2025
531cae9
Fix spinner state management in checkpoint flow
brandonkachen Jun 27, 2025
1fb8a6b
Tweak file picker to focus on relevant files
jahooma Jun 27, 2025
76d5191
Fix WebSocket hang detection false positives
brandonkachen Jun 27, 2025
3eacb73
add logging for hanging terminal commands
charleslien Jun 27, 2025
716b382
clean up response on error
charleslien Jun 27, 2025
e9e689a
Move timeout parameter into args for requestToolCall function
brandonkachen Jun 27, 2025
30e6502
Merge branch 'main' into colony
brandonkachen Jun 27, 2025
694182a
hook up cancel user input
charleslien Jun 27, 2025
01df052
Add web_search tool with Linkup API integration
brandonkachen Jun 27, 2025
bc18c10
no timeout for negative value
charleslien Jun 28, 2025
ecd4b56
cut off tool calls after ctrl-c
charleslien Jun 28, 2025
b0d377c
Add missing web_search tool renderer
brandonkachen Jun 28, 2025
4ae07a5
Fix read_docs and web_search tool tests by adding missing mocks
brandonkachen Jun 28, 2025
cca220b
remove could not find directory
charleslien Jun 28, 2025
f58141c
fix tool renderer for read_files
charleslien Jun 28, 2025
e87e71f
Don't crash on bug
jahooma Jun 28, 2025
a995852
Update live-user-inputs.ts
charleslien Jun 28, 2025
db99be9
Add a unit test for run-agent-step tool update_report
jahooma Jun 28, 2025
08bb4cd
all_messages output mode
jahooma Jun 28, 2025
eed4a23
Disable live user checks in evals
jahooma Jun 28, 2025
2e8d24b
Run three judges. Take the median
jahooma Jun 29, 2025
e10e035
Prefer str_replace for most edits. Prompt better to use a single tool…
jahooma Jun 29, 2025
09a16ea
Planner agent
jahooma Jun 29, 2025
8108227
Fix str_replace bug
jahooma Jun 29, 2025
37f41ca
Don't add agent step prompt if empty (fails for anthropic models)
jahooma Jun 30, 2025
e89215b
Disable planner. Prompt main agent to read more files
jahooma Jun 30, 2025
836a4e2
add analytics for starting shell
charleslien Jun 28, 2025
a762ac1
add opus pricing
charleslien Jun 30, 2025
dc40ed6
add ask mode agent
charleslien Jun 30, 2025
8bb59fa
Add missing parms to code_search tool schema
jahooma Jun 30, 2025
eaaab49
tweak ask mode prompts
charleslien Jun 30, 2025
3dcafac
Update credit-delegation.ts
brandonkachen Jun 30, 2025
2a80473
add analytics for runSinglePtyCommand
charleslien Jun 28, 2025
b5e847c
feat: override local bun to inject infisical before running bun scrip…
brandonkachen Jun 30, 2025
7eef654
Delete direnv-test-plan.md
brandonkachen Jun 30, 2025
9055f2c
Merge branch 'main' into colony
brandonkachen Jun 30, 2025
68daab3
Update base.ts
brandonkachen Jun 30, 2025
c67119e
type errors
brandonkachen Jun 30, 2025
a16997e
fix: correct read_files test to use array instead of string
brandonkachen Jun 30, 2025
d6300fb
Merge branch 'main' into colony
brandonkachen Jun 30, 2025
b15ed74
send back tool results on file change hook fail
charleslien Jun 30, 2025
642431e
add messages to file patch tool results
charleslien Jun 30, 2025
99b9a4c
remove code search tool from researcher
brandonkachen Jun 30, 2025
c51819c
automatically include knowledge files
charleslien Jun 30, 2025
7efca51
update README.md for envrc
charleslien Jun 30, 2025
8e2968f
added logging to web_search + read_docs tools
brandonkachen Jun 30, 2025
eb33c94
[BuffBench] Fix evals for str_replace, I think
jahooma Jul 1, 2025
5b0055d
vibe-update knowledge files
charleslien Jul 1, 2025
742d4c5
add logging for when user cancels
charleslien Jul 1, 2025
3121d49
pass userInputId to client when running tool calls
charleslien Jul 1, 2025
8942360
fix: add missing userInputId parameter to requestToolCall
brandonkachen Jul 1, 2025
5819160
Merge branch 'main' into colony
brandonkachen Jul 1, 2025
f8bb7e1
calculate monthly usage using current month in current timezone
jahooma Jul 1, 2025
a720f63
Migrate off bun-pty. Use child process + user config + (parital) colors
jahooma Jul 1, 2025
ebb5e79
fix types
jahooma Jul 1, 2025
57a7596
Fix types
jahooma Jul 1, 2025
a17780e
fix bun wrapper
charleslien Jul 1, 2025
394475f
Add width/column env for run command
jahooma Jul 1, 2025
400a806
remove logging
charleslien Jul 1, 2025
9d638bc
default email to false
charleslien Jul 1, 2025
85dcd4c
[buffbench] fix evals
charleslien Jul 1, 2025
83f4e5b
feat: improve direnv setup and bun wrapper
brandonkachen Jul 1, 2025
26e9cd5
Prevent nested infisical calls in bun wrapper and document functionality
brandonkachen Jul 1, 2025
eb6f8db
fix: created a helper fn to close tags, so it's easier for us to use
brandonkachen Jul 1, 2025
a7cd901
fix: renamed to generateCloseTags
brandonkachen Jul 1, 2025
510ebac
fix: accidentally broke backend
brandonkachen Jul 1, 2025
0f65801
fix: moved generate xml helper fns to another file
brandonkachen Jul 1, 2025
4b30043
Add file change hooks tool (#194)
charleslien Jul 1, 2025
83a9c9a
remove to web_search and read_docs from main agent
charleslien Jul 1, 2025
73d8bac
await for web_search and read_docs
charleslien Jul 1, 2025
847c0c2
fix type errors
charleslien Jul 1, 2025
40786d9
do not run spinner during tool calls
charleslien Jul 1, 2025
430a720
fix: replace all hardcoded close tags with helper fn call (closeXml)
brandonkachen Jul 1, 2025
fd869cf
fix unit tests
charleslien Jul 2, 2025
572f349
switch out to use backend logger for ai-sdk
charleslien Jul 2, 2025
ae399e1
log model when recieving error from stream
charleslien Jul 2, 2025
2ba1ce6
fixed web_search and read_docs tests
brandonkachen Jul 2, 2025
f6cbb09
Attempt to fix aliases
jahooma Jul 2, 2025
b979a26
fix ask agent tools
charleslien Jul 2, 2025
a6fb151
Bash on non-windows, cmd on windows
jahooma Jul 2, 2025
85a373f
fix: run one eval at a time
brandonkachen Jul 2, 2025
74eaf44
tweak evals
charleslien Jul 2, 2025
6b425ba
Fix posix spawn error: make cwd absolute
jahooma Jul 2, 2025
88598b8
update git evals
charleslien Jul 2, 2025
af4380c
change agent step log message
charleslien Jul 2, 2025
ff18067
[BuffBench] Old school relace
jahooma Jul 2, 2025
0028bf9
[BuffBench] New relace
jahooma Jul 2, 2025
d323484
[BuffBench] Put back string replace
jahooma Jul 2, 2025
8b68c64
Allow concurrent evals
jahooma Jul 2, 2025
84b707b
Revert "[BuffBench] Put back string replace"
jahooma Jul 2, 2025
bb901be
[BuffBench] New relace
jahooma Jul 2, 2025
e65bdc2
cancel current user input on fresh prompt
charleslien Jul 2, 2025
5279ea6
update undefined error
charleslien Jul 2, 2025
af6160c
[BuffBench] New relace
jahooma Jul 2, 2025
e07581c
[BuffBench] String replace
jahooma Jul 2, 2025
57a9488
log to stdout for evals if concurrency === 1
charleslien Jul 2, 2025
4885815
Add agent personas and names to template system
brandonkachen Jul 2, 2025
54ce6d4
fix project root not set for test environment
charleslien Jul 2, 2025
95a3677
[buffbench] testing
charleslien Jul 2, 2025
86dd776
fix mock in evals
charleslien Jul 2, 2025
45bbd27
increase timeout for github actions
charleslien Jul 2, 2025
d3b6311
Add agent personas and automatic file change hooks
brandonkachen Jul 2, 2025
1d70bfb
Simplify agent constants structure by removing AGENT_METADATA
brandonkachen Jul 2, 2025
85858b7
Update tool-renderers.ts
brandonkachen Jul 2, 2025
ef86bd3
Update tool-renderers.ts
brandonkachen Jul 2, 2025
f38f33d
Add news message (+ max mode warning)
jahooma Jul 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 76 additions & 78 deletions .bin/bun
Original file line number Diff line number Diff line change
Expand Up @@ -22,94 +22,92 @@ if [ -z "$REAL_BUN" ]; then
REAL_BUN=$(PATH=$(echo "$PATH" | tr ':' '\n' | grep -v "^$SCRIPT_DIR$" | tr '\n' ':') which bun)
fi

# Function to check if a script needs secrets by looking in package.json
needs_secrets() {
local script_name="$1"
local cwd="${2:-.}"

# Check if package.json exists in the specified directory
if [ ! -f "$cwd/package.json" ]; then
return 1 # No package.json, assume no secrets needed
# Function to check if command doesn't need secrets
# Returns 0 if secrets are NOT needed, 1 if they ARE needed
doesnt_need_secrets() {
# If we're already running under infisical, don't need to wrap again
if [ -n "$NEXT_PUBLIC_INFISICAL_UP" ]; then
return 0
fi

# Extract the script command from package.json
local script_command
script_command=$(node -pe "
try {
const pkg = require('$cwd/package.json');
const script = pkg.scripts && pkg.scripts['$script_name'];
script || '';
} catch (e) {
'';
}
" 2>/dev/null)
# Find the first non-flag argument, which is the command
local cmd=""
for arg in "$@"; do
if [[ ! "$arg" =~ ^- ]]; then
cmd="$arg"
break
fi
done

# Handle version/help flags which can appear anywhere
for arg in "$@"; do
case "$arg" in
--version|-v|--help|-h|--revision)
return 0
;;
esac
done

# If script doesn't exist, assume no secrets needed
if [ -z "$script_command" ]; then
return 1
# If no command is found (e.g., just 'bun'), it doesn't need secrets
if [ -z "$cmd" ]; then
return 0
fi

# Check if script needs secrets:
# 1. Already uses infisical
# 2. Contains dev server patterns that obviously need secrets
case "$script_command" in
*"infisical"*)
return 0 # Already uses infisical, needs secrets
# Commands that don't need secrets
case "$cmd" in
# Package management
install|i|add|remove|rm|link|unlink|pm|update|upgrade)
return 0
;;
*"dev"*|*"start"*|*"studio"*|*"db:start"*|*"db:studio"*)
return 0 # Dev servers and database tools need secrets
# Project initialization
init|create)
return 0
;;
# Info/utility
info|outdated|audit|typecheck)
return 0
;;
# Run command needs special handling
run)
# Find the script name after 'run'
local script=""
local found_run=false
for arg in "$@"; do
if $found_run && [[ ! "$arg" =~ ^- ]]; then
script="$arg"
break
fi
if [[ "$arg" == "run" ]]; then
found_run=true
fi
done

# 'bun run' with no script lists scripts, no secrets needed
if [ -z "$script" ]; then
return 0
fi

# Scripts that typically don't need secrets
case "$script" in
format|lint|typecheck|compile)
return 0
;;
*)
# Default run scripts to needing secrets
return 1
;;
esac
;;
*)
return 1 # Default to no secrets for maintainability
# Default to needing secrets for all other commands
return 1
;;
esac
}

# Function to extract cwd from bun command
get_cwd_from_args() {
local args=("$@")
for ((i=0; i<${#args[@]}; i++)); do
if [[ "${args[i]}" == "--cwd" && $((i+1)) -lt ${#args[@]} ]]; then
echo "${args[$((i+1))]}"
return
fi
done
echo "."
}

# Main logic
case "$1" in
"test")
# Tests often need database/API access
# Main logic - default to using infisical unless command doesn't need secrets
if doesnt_need_secrets "$@"; then
exec "$REAL_BUN" "$@"
else
exec infisical run -- "$REAL_BUN" "$@"
;;
"dev"|"start")
# Development servers need secrets
exec infisical run -- "$REAL_BUN" "$@"
;;
"run")
if [ -n "$2" ]; then
# Extract cwd if specified
cwd=$(get_cwd_from_args "$@")

# Check if the script needs secrets
if needs_secrets "$2" "$cwd"; then
exec infisical run -- "$REAL_BUN" "$@"
else
exec "$REAL_BUN" "$@"
fi
else
# No script specified, run without secrets
exec "$REAL_BUN" "$@"ggp -
fi
;;
*)
# Check if the first argument is a script name in package.json
if needs_secrets "$1" "."; then
exec infisical run -- "$REAL_BUN" "$@"
else
# For install, add, remove, format, etc. - no secrets needed
exec "$REAL_BUN" "$@"
fi
;;
esac
fi
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export PATH="$PWD/.bin:$PATH"
1 change: 0 additions & 1 deletion .envrc.example

This file was deleted.

64 changes: 31 additions & 33 deletions .github/knowledge.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,40 @@

## CI/CD Pipeline Overview

The CI pipeline consists of multiple jobs that run in sequence and parallel:

```mermaid
graph TD
setup[Setup - Install & Cache Dependencies]
build[Build & Typecheck]
test1[Test npm-app]
test2[Test backend]
test3[Test common]

setup --> build
build --> test1 & test2 & test3

classDef setup fill:#e1f5fe,stroke:#01579b
classDef build fill:#e8f5e9,stroke:#1b5e20
classDef test fill:#f9f,stroke:#333,stroke-width:2px

class setup setup
class build build
class test1,test2,test3 test
```
The CI pipeline consists of two main jobs:

### Key Jobs
- **Setup**: Installs and caches dependencies
- **Build**: Compiles the project and runs typechecking in one combined job
- **Tests**: Three parallel test jobs for different packages:
- npm-app tests
- backend tests
- common tests
1. **Build Job**: Installs dependencies, builds web, runs typecheck, and builds npm-app
2. **Test Job**: Runs tests for npm-app, backend, and common packages in parallel using matrix strategy

### Important Settings
- Uses Bun v1.1.26 for all jobs
### Key Configuration
- Uses Bun v1.2.12 for all jobs
- Tests use retry logic (max 5 attempts, 10 min timeout)
- Dependencies are cached between jobs
- Environment variables are set from secrets
- Build and typecheck are combined for efficiency
- Dependencies are cached between jobs using `actions/cache@v3`
- Environment variables are set from GitHub secrets using `scripts/generate-ci-env.js`

### Test Strategy
Tests run in parallel using matrix strategy:
```yaml
strategy:
matrix:
package: [npm-app, backend, common]
```

Each test job:
- Runs unit tests only (excludes integration tests)
- Uses `nick-fields/retry@v3` for reliability
- Sets `CODEBUFF_GITHUB_ACTIONS=true` and `NEXT_PUBLIC_CB_ENVIRONMENT=test`

### Environment Variables
- Secrets are extracted using `scripts/generate-ci-env.js`
- Environment variables are set dynamically from GitHub secrets
- Test environment flags are set for proper test execution

## Workflow Structure
- Triggered on push/PR to main branch
- Build job must complete before test jobs start (`needs: build`)
- Uses `actions/checkout@v3`, `oven-sh/setup-bun@v2`, and `actions/cache@v3`
- Commented debug shell available for troubleshooting failures

## Artifact Actions

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/evals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
run-evals:
runs-on: ubuntu-latest
timeout-minutes: 180
timeout-minutes: 360
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:

- name: Run evals
if: ${{ steps.check_commit.outputs.should_run_evals == 'true' }}
run: bun run --cwd evals run-eval-set
run: cd evals && bun run-eval-set --concurrency 1 --email --title "Git Eval (${{ github.sha }} ${{ github.event.head_commit.message }}})"

- name: Workflow completed
run: echo "Evals workflow completed successfully"
3 changes: 1 addition & 2 deletions .github/workflows/npm-app-release-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ jobs:
new-version: ${{ needs.prepare-and-commit-staging.outputs.new_version }}
artifact-name: updated-staging-package
checkout-ref: ${{ github.event.pull_request.head.sha }}
env-overrides: '{"NEXT_PUBLIC_CB_ENVIRONMENT": "prod"}'

env-overrides: '{"NEXT_PUBLIC_CB_ENVIRONMENT": "prod", "NEXT_PUBLIC_BACKEND_URL": "backend-pr-187-cg9u.onrender.com"}'
secrets: inherit

# Create GitHub prerelease with all binaries
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,3 @@ debug/
# Nx cache directories
.nx/cache
.nx/workspace-data

# direnv
.envrc
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ If you want to set up Codebuff for local development:
1. **Install Bun**: Follow the [Bun installation guide](https://bun.sh/docs/installation)

2. **Install direnv**: This manages environment variables automatically

- macOS: `brew install direnv`
- Ubuntu/Debian: `sudo apt install direnv`
- Other systems: See [direnv installation guide](https://direnv.net/docs/installation.html)
Expand All @@ -93,54 +94,63 @@ If you want to set up Codebuff for local development:
### Setup Steps

1. **Clone and navigate to the project**:

```bash
git clone <repository-url>
cd codebuff
```

2. **Set up Infisical for secrets management**:

```bash
npm install -g @infisical/cli
infisical login
```

When prompted, select the "US" region, then verify setup:

```bash
infisical secrets
```

3. **Configure direnv**:

```bash
direnv allow
cp .envrc.example .envrc
```
This automatically manages your PATH and environment variables.

This automatically manages your PATH and environment variables. The `.envrc` file is already committed to the repository and sets up the correct PATH to use the project's bundled version of Bun.

4. **Install dependencies**:

```bash
bun install
```

5. **Start the development services**:

**Terminal 1 - Backend server**:

```bash
bun run start-server
```

**Terminal 2 - Web server** (requires Docker):

```bash
bun run start-web
```

**Terminal 3 - Client**:

```bash
bun run start-client
```


### Running Tests

After direnv setup, you can run tests from any directory:

```bash
bun test # Runs with secrets automatically
bun test --watch # Watch mode
Expand All @@ -152,6 +162,7 @@ bun test specific.test.ts # Run specific test file
### direnv Issues

If direnv isn't working:

1. Ensure it's properly hooked into your shell (see Prerequisites step 3)
2. Run `direnv allow` in the project root
3. Check that `.envrc` exists and has the correct content
Expand Down
Loading