Skip to content

Commit 5f5ede5

Browse files
cleanup: remove legacy backend and npm-app (#389)
🧹 Remove Legacy Backend & npm-app Packages This branch removes ~33,000 lines of legacy code by eliminating the standalone backend/ and npm-app/ packages that are no longer needed. What Was Removed - backend/ - The entire legacy Node.js backend including: - WebSocket server infrastructure - LLM API integrations (OpenRouter, Vertex, Vercel AI SDK) - Admin utilities, API endpoints, and test suites - Database templates and logging utilities - npm-app/ - Legacy npm application package - common/src/websockets/websocket-client.ts - No longer needed WebSocket client What Was Migrated/Preserved - credentials.ts moved from npm-app/ → sdk/src/ - system-info.ts moved from backend/ → common/src/util/ - Agent loading logic consolidated into new sdk/src/agents/load-agents.ts Related Changes - Environment cleanup: Removed backend-only env vars, enforced explicit env validation - SDK improvements: New loadLocalAgents API with better error handling - Documentation updates: Removed references to deleted packages - Web package: Migrated relabel endpoint, updated env handling ( env → webEnv ) - Agent updates: Replaced deprecated base agent with codebuff/base2@latest 🤖 Acknowledgments Big thanks to Codebuff for handling the majority of these changes! From carefully migrating critical utilities, to cleaning up environment variables, to ensuring documentation stayed in sync — this refactor was powered by AI-assisted development. (all of the above was written by codebuff)
1 parent da8b875 commit 5f5ede5

File tree

235 files changed

+3475
-36668
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

235 files changed

+3475
-36668
lines changed

.agents/LESSONS.md

Lines changed: 125 additions & 135 deletions
Large diffs are not rendered by default.

.env.example

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ OPENAI_API_KEY=dummy_openai_key
66
# Database & Server
77
DATABASE_URL=postgresql://manicode_user_local:secretpassword_local@localhost:5432/manicode_db_local
88
PORT=4242
9-
GOOGLE_CLOUD_PROJECT_ID=dummy_project_id
109

1110
# Authentication
1211
CODEBUFF_GITHUB_ID=dummy_github_id
1312
CODEBUFF_GITHUB_SECRET=dummy_github_secret
1413
NEXTAUTH_SECRET=dummy_nextauth_secret_at_least_32_chars_long
15-
API_KEY_ENCRYPTION_SECRET=dummy_encryption_secret_32_chars
1614

1715
# Payment (Stripe)
1816
STRIPE_SECRET_KEY=sk_test_dummy_stripe_secret
@@ -21,7 +19,6 @@ STRIPE_USAGE_PRICE_ID=price_dummy_usage_id
2119
STRIPE_TEAM_FEE_PRICE_ID=price_dummy_team_fee_id
2220

2321
# External Services
24-
RELACE_API_KEY=dummy_relace_key
2522
LINKUP_API_KEY=dummy_linkup_key
2623
LOOPS_API_KEY=dummy_loops_key
2724

@@ -33,9 +30,8 @@ DISCORD_APPLICATION_ID=dummy_discord_app_id
3330
# Frontend/Public Variables
3431
NEXT_PUBLIC_CB_ENVIRONMENT=dev
3532
NEXT_PUBLIC_CODEBUFF_APP_URL=http://localhost:3000
36-
NEXT_PUBLIC_CODEBUFF_BACKEND_URL=localhost:4242
3733
NEXT_PUBLIC_SUPPORT_EMAIL=support@codebuff.com
3834
NEXT_PUBLIC_POSTHOG_API_KEY=phc_dummy_posthog_key
3935
NEXT_PUBLIC_POSTHOG_HOST_URL=https://us.i.posthog.com
4036
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_dummy_publishable
41-
NEXT_PUBLIC_STRIPE_CUSTOMER_PORTAL=https://billing.stripe.com/p/login/test_dummy
37+
NEXT_PUBLIC_STRIPE_CUSTOMER_PORTAL=https://billing.stripe.com/p/login/test_dummy

CONTRIBUTING.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,14 @@ Before you begin, you'll need to install a few tools:
5151
5. **Start development services**:
5252

5353
**Option A: All-in-one (recommended)**
54+
5455
```bash
5556
bun run dev
5657
# Starts the web server, builds the SDK, and launches the CLI automatically
5758
```
5859

5960
**Option B: Separate terminals (for more control)**
61+
6062
```bash
6163
# Terminal 1 - Web server (start first)
6264
bun run start-web
@@ -69,7 +71,7 @@ Before you begin, you'll need to install a few tools:
6971

7072
Now, you should be able to run the CLI and send commands, but it will error out because you don't have any credits.
7173

72-
**Note**: CLI requires both backend and web server running for authentication.
74+
**Note**: CLI requires the web server running for authentication.
7375

7476
6. **Giving yourself credits**:
7577

@@ -123,9 +125,8 @@ In order to run the CLI from other directories, you need to first publish the ag
123125

124126
Codebuff is organized as a monorepo with these main packages:
125127

126-
- **backend/**: WebSocket server, LLM integration, agent orchestration
127-
- **npm-app/**: CLI application that users interact with
128128
- **web/**: Next.js web application and dashboard
129+
- **cli/**: CLI application that users interact with
129130
- **python-app/**: Python version of the CLI (experimental)
130131
- **common/**: Shared code, database schemas, utilities
131132
- **sdk/**: TypeScript SDK for programmatic usage
@@ -202,7 +203,7 @@ cd cli
202203
bun run test:tmux-poc
203204
```
204205

205-
See [cli/src/__tests__/README.md](cli/src/__tests__/README.md) for comprehensive interactive testing documentation.
206+
See [cli/src/**tests**/README.md](cli/src/__tests__/README.md) for comprehensive interactive testing documentation.
206207

207208
### Commit Messages
208209

@@ -225,15 +226,15 @@ Build specialized agents in `.agents/` for different languages, frameworks, or w
225226

226227
### 🔧 **Tool System**
227228

228-
Add new capabilities in `backend/src/tools.ts` - file operations, API integrations, development environment helpers. The sky's the limit!
229+
Add new capabilities in `common/src/tools` and the SDK helpers - file operations, API integrations, development environment helpers. The sky's the limit!
229230

230231
### 📦 **SDK Improvements**
231232

232233
Make the SDK in `sdk/` even more powerful with new methods, better TypeScript support, or killer integration examples.
233234

234235
### 💻 **CLI Magic**
235236

236-
Enhance the user experience in `npm-app/` with smoother commands, better error messages, or interactive features that make developers smile.
237+
Enhance the user experience in `cli/` with smoother commands, better error messages, or interactive features that make developers smile.
237238

238239
### 🌐 **Web Dashboard**
239240

ROADMAP.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
In general, we reevaulate plans day-by-day and thus the roadmap may change at any point.
1+
In general, we reevaluate plans day-by-day and thus the roadmap may change at any point.
22

3-
As of Oct 6th, here's what we're working on:
4-
- Brandon is rebuilding npm-app from the ground up with a snazzy TUI and reusing the SDK instead of a custom connection to the backend
5-
- Charles is moving backend logic to the SDK so more code is run locally.
6-
- James is building more powerful agents, especially "base2", which is the next-gen default codebuff agent. Try it with `codebuff --experimental`!
3+
As of Dec 2024, here's what we're working on:
4+
- The CLI has been rebuilt with a modern TUI using OpenTUI and React 19
5+
- Core functionality has been moved to the SDK for local execution, and our CLI now fully uses it!
6+
- Building more powerful agents, especially "base2", which is the next-gen default codebuff agent

authentication.knowledge.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
## Overview
44

5-
Codebuff implements secure authentication between CLI (npm-app), backend, and web application using fingerprint-based device identification.
5+
Codebuff implements secure authentication between the CLI and web application using fingerprint-based device identification.
66

77
## Core Authentication Flow
88

99
```mermaid
1010
sequenceDiagram
11-
participant CLI as npm-app
11+
participant CLI as CLI
1212
participant Web as web app
1313
participant DB as Database
1414
@@ -30,7 +30,7 @@ sequenceDiagram
3030
### 1. First Time Login / Missing Credentials
3131

3232
- CLI generates fingerprint from hardware info + 8 random bytes
33-
- Uses `calculateFingerprint()` in `npm-app/src/fingerprint.ts`
33+
- Uses `calculateFingerprint()` in the SDK
3434
- Continues to core flow with new fingerprintId
3535

3636
### 2. Logout Flow

backend/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

backend/README.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

backend/knowledge.md

Lines changed: 0 additions & 180 deletions
This file was deleted.

0 commit comments

Comments
 (0)