Skip to content

Commit b9454d3

Browse files
authored
Merge branch 'CodebuffAI:main' into fix/cross-platform-commit-helper
2 parents 67e8231 + f703966 commit b9454d3

59 files changed

Lines changed: 2227 additions & 1379 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
import type { AgentDefinition } from './types/agent-definition'
2+
3+
const definition: AgentDefinition = {
4+
id: 'codebase-commands-explorer',
5+
displayName: 'Codebase Commands Explorer',
6+
publisher: 'james',
7+
model: 'openai/gpt-5',
8+
reasoningOptions: {
9+
enabled: true,
10+
effort: 'low',
11+
exclude: true,
12+
},
13+
14+
spawnerPrompt: `Analyzes any project's codebase to comprehensively discover all commands needed to build, test, and run the project. Provides detailed analysis of project structure, tech stack, and working commands with confidence scores.`,
15+
16+
toolNames: ['spawn_agents', 'set_output'],
17+
spawnableAgents: [
18+
'codebuff/file-explorer@0.0.4',
19+
'codebuff/read-only-commander-lite@0.0.1',
20+
],
21+
22+
inputSchema: {
23+
prompt: {
24+
type: 'string',
25+
description:
26+
'Optional specific focus areas or requirements for the codebase analysis (e.g., "focus on test commands" or "include CI/CD analysis")',
27+
},
28+
},
29+
30+
outputMode: 'structured_output',
31+
outputSchema: {
32+
type: 'object',
33+
properties: {
34+
projectOverview: {
35+
type: 'object',
36+
properties: {
37+
projectType: {
38+
type: 'string',
39+
description:
40+
'Primary project type (e.g., Node.js, Python, Rust, Go, etc.)',
41+
},
42+
techStack: {
43+
type: 'array',
44+
items: { type: 'string' },
45+
description: 'List of technologies, frameworks, and tools detected',
46+
},
47+
packageManagers: {
48+
type: 'array',
49+
items: { type: 'string' },
50+
description:
51+
'Package managers found (npm, yarn, pnpm, pip, cargo, etc.)',
52+
},
53+
buildSystems: {
54+
type: 'array',
55+
items: { type: 'string' },
56+
description:
57+
'Build systems detected (webpack, vite, make, cmake, etc.)',
58+
},
59+
keyFiles: {
60+
type: 'array',
61+
items: { type: 'string' },
62+
description: 'Key configuration files found',
63+
},
64+
},
65+
required: [
66+
'projectType',
67+
'techStack',
68+
'packageManagers',
69+
'buildSystems',
70+
'keyFiles',
71+
],
72+
},
73+
workingCommands: {
74+
type: 'array',
75+
items: {
76+
type: 'object',
77+
properties: {
78+
command: { type: 'string', description: 'The working command' },
79+
description: {
80+
type: 'string',
81+
description: 'What this command does',
82+
},
83+
category: {
84+
type: 'string',
85+
enum: [
86+
'build',
87+
'test',
88+
'run',
89+
'lint',
90+
'format',
91+
'install',
92+
'clean',
93+
'dev',
94+
],
95+
description: 'Command category',
96+
},
97+
confidenceScore: {
98+
type: 'number',
99+
minimum: 0,
100+
maximum: 1,
101+
description: 'Confidence that this command works (0-1)',
102+
},
103+
workingDirectory: {
104+
type: 'string',
105+
description: 'Directory where command should be run',
106+
},
107+
prerequisites: {
108+
type: 'array',
109+
items: { type: 'string' },
110+
description: 'Commands that should be run first',
111+
},
112+
environment: {
113+
type: 'string',
114+
description: 'Required environment or conditions',
115+
},
116+
},
117+
required: ['command', 'description', 'category', 'confidenceScore'],
118+
},
119+
},
120+
setupRequirements: {
121+
type: 'array',
122+
items: {
123+
type: 'object',
124+
properties: {
125+
requirement: {
126+
type: 'string',
127+
description: 'Setup requirement description',
128+
},
129+
commands: {
130+
type: 'array',
131+
items: { type: 'string' },
132+
description: 'Commands to fulfill this requirement',
133+
},
134+
priority: {
135+
type: 'string',
136+
enum: ['critical', 'recommended', 'optional'],
137+
description: 'Priority level',
138+
},
139+
},
140+
required: ['requirement', 'commands', 'priority'],
141+
},
142+
},
143+
cicdAnalysis: {
144+
type: 'object',
145+
properties: {
146+
ciFilesFound: {
147+
type: 'array',
148+
items: { type: 'string' },
149+
description: 'CI/CD configuration files detected',
150+
},
151+
officialCommands: {
152+
type: 'array',
153+
items: { type: 'string' },
154+
description: 'Commands found in CI/CD files',
155+
},
156+
platforms: {
157+
type: 'array',
158+
items: { type: 'string' },
159+
description:
160+
'CI/CD platforms detected (GitHub Actions, GitLab CI, etc.)',
161+
},
162+
},
163+
required: ['ciFilesFound', 'officialCommands', 'platforms'],
164+
},
165+
},
166+
required: [
167+
'projectOverview',
168+
'workingCommands',
169+
'setupRequirements',
170+
'cicdAnalysis',
171+
],
172+
},
173+
174+
systemPrompt: `You are an expert codebase explorer that comprehensively analyzes any software project to discover all build, test, and run commands. You orchestrate multiple specialized agents to explore the project structure and test commands in parallel for maximum efficiency.`,
175+
176+
instructionsPrompt: `Your mission is to provide a comprehensive analysis of any codebase to discover all working commands for building, testing, and running the project.
177+
178+
## Analysis Strategy:
179+
180+
1. **Project Structure Exploration**: First spawn file-explorer to understand the project layout, key files, and technology stack.
181+
In parallel, spawn a second file-explorer to learn about the build, lint, and testing processes across the codebase.
182+
183+
2. **Massive Parallel Command Testing**: Only after fully completing step 1 and getting back the results, spawn MANY (10-15) read-only-commander agents simultaneously to test different command combinations, including for any relevant sub-directories if this is a monorepo.
184+
Look for commands for the following project types:
185+
- Web apps: next.js, react, vue, etc. commands (build, test, start, dev, lint, etc.)
186+
- Node.js projects: npm/yarn/pnpm commands (build, test, start, dev, lint, etc.)
187+
- Python projects: pip, pytest, setup.py, tox commands
188+
- Rust projects: cargo commands (build, test, run, check, etc.)
189+
...And so on for all project types
190+
191+
Include CI/CD Analysis: Have agents examine CI/CD files (.github/workflows, .gitlab-ci.yml, etc.) to discover official build processes
192+
193+
3. **Final Analysis**: Use the set_output tool to output the results of the analysis. Rate each working command based on:
194+
- Success rate of execution
195+
- Presence in official documentation/CI
196+
- Standard conventions for the project type
197+
- Output quality and expected behavior
198+
199+
## Command Categories to Test:
200+
- **install**: Dependency installation commands
201+
- **build**: Compilation and build commands
202+
- **test**: All types of testing (unit, integration, e2e)
203+
- **run**: Application execution commands
204+
- **dev**: Development server/watch commands
205+
- **lint**: Code linting and static analysis
206+
- **format**: Code formatting commands
207+
- **clean**: Cleanup and reset commands
208+
209+
## Be Extremely Thorough:
210+
- Try multiple package managers if multiple are detected
211+
- Test both short and long command forms
212+
- Check for custom scripts in package.json, Makefile, etc.
213+
- Test commands with different flags and options
214+
- Verify commands work from different directories
215+
- Check for environment-specific requirements
216+
217+
## Special Focus Areas:
218+
- Look for monorepo structures and workspace commands
219+
- Detect containerized setups and associated commands
220+
- Find database setup/migration commands
221+
- Identify development vs production commands
222+
- Discover deployment and release commands
223+
224+
Provide a comprehensive, structured output that gives developers everything they need to understand and work with the codebase immediately.`,
225+
}
226+
227+
export default definition

.agents/git-committer.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,13 @@ const definition: AgentDefinition = {
3838
toolName: 'run_terminal_command',
3939
input: {
4040
command: 'git diff',
41-
process_type: 'SYNC',
42-
timeout_seconds: 30,
4341
},
4442
}
4543

4644
yield {
4745
toolName: 'run_terminal_command',
4846
input: {
4947
command: 'git log --oneline -10',
50-
process_type: 'SYNC',
51-
timeout_seconds: 30,
5248
},
5349
}
5450

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { publisher } from './constants'
2+
import {
3+
PLACEHOLDER,
4+
type SecretAgentDefinition,
5+
} from './types/secret-agent-definition'
6+
import readOnlyCommander from './read-only-commander'
7+
8+
const readOnlyCommanderLite: SecretAgentDefinition = {
9+
...readOnlyCommander,
10+
id: 'read-only-commander-lite',
11+
displayName: 'ReadOnly Commander Lite',
12+
publisher,
13+
model: 'x-ai/grok-code-fast-1',
14+
spawnerPrompt:
15+
'Can run quick read-only terminal commands and report back on the results. Has a basic understanding of the codebase. Is speedy and low-cost,',
16+
}
17+
18+
export default readOnlyCommanderLite
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { publisher } from '../constants'
1+
import { publisher } from './constants'
22
import {
33
PLACEHOLDER,
44
type SecretAgentDefinition,
5-
} from '../types/secret-agent-definition'
5+
} from './types/secret-agent-definition'
66

77
const readOnlyCommander: SecretAgentDefinition = {
88
id: 'read-only-commander',
@@ -15,7 +15,7 @@ const readOnlyCommander: SecretAgentDefinition = {
1515
},
1616
displayName: 'ReadOnly Commander',
1717
spawnerPrompt:
18-
'Can run quick read-only terminal commands and report back on the results. Has a basic understanding of the codebase.',
18+
'Can run quick read-only terminal commands and report back on the results. Has a decent understanding of the codebase.',
1919
inputSchema: {
2020
prompt: {
2121
type: 'string',

.agents/simple-code-reviewer.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import type { AgentDefinition } from './types/agent-definition'
2+
3+
const definition: AgentDefinition = {
4+
id: 'simple-code-reviewer',
5+
displayName: 'Simple Code Reviewer',
6+
publisher: 'james',
7+
model: 'anthropic/claude-sonnet-4',
8+
toolNames: [
9+
'read_files',
10+
'code_search',
11+
'run_terminal_command',
12+
'spawn_agents',
13+
],
14+
spawnableAgents: ['codebuff/file-explorer@0.0.2'],
15+
spawnerPrompt: 'Spawn when you need to review local code changes',
16+
systemPrompt:
17+
'You are an expert software developer. Your job is to review local code changes and give helpful feedback.',
18+
instructionsPrompt: `Instructions:
19+
1. Use git diff to get the changes, but also get untracked files.
20+
2. Read the files that have changed.
21+
3. Spawn a file explorer to find all related and relevant files.
22+
4. Read all the files that could be relevant to the changes.
23+
5. Review the changes and suggest improvements.`,
24+
}
25+
26+
export default definition

.env.example

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# AI API Keys
2+
ANTHROPIC_API_KEY=dummy_anthropic_key
3+
ANTHROPIC_API_KEY2=dummy_anthropic_key_2
4+
OPEN_AI_KEY=dummy_openai_key
5+
GEMINI_API_KEY=dummy_gemini_key
6+
DEEPSEEK_API_KEY=dummy_deepseek_key
7+
OPEN_ROUTER_API_KEY=dummy_openrouter_key
8+
HELICONE_API_KEY=dummy_helicone_key
9+
10+
# Database & Server
11+
DATABASE_URL=postgresql://postgres:secretpassword_local@localhost:5432/codebuff
12+
PORT=4242
13+
GOOGLE_CLOUD_PROJECT_ID=dummy_project_id
14+
15+
# Authentication
16+
CODEBUFF_GITHUB_ID=dummy_github_id
17+
CODEBUFF_GITHUB_SECRET=dummy_github_secret
18+
NEXTAUTH_SECRET=dummy_nextauth_secret_at_least_32_chars_long
19+
API_KEY_ENCRYPTION_SECRET=dummy_encryption_secret_32_chars
20+
21+
# Payment (Stripe)
22+
STRIPE_SECRET_KEY=sk_test_dummy_stripe_secret
23+
STRIPE_WEBHOOK_SECRET_KEY=whsec_dummy_webhook_secret
24+
STRIPE_USAGE_PRICE_ID=price_dummy_usage_id
25+
STRIPE_TEAM_FEE_PRICE_ID=price_dummy_team_fee_id
26+
27+
# External Services
28+
RELACE_API_KEY=dummy_relace_key
29+
LINKUP_API_KEY=dummy_linkup_key
30+
LOOPS_API_KEY=dummy_loops_key
31+
32+
# Discord Integration
33+
DISCORD_PUBLIC_KEY=dummy_discord_public_key
34+
DISCORD_BOT_TOKEN=dummy_discord_bot_token
35+
DISCORD_APPLICATION_ID=dummy_discord_app_id
36+
37+
# Frontend/Public Variables
38+
NEXT_PUBLIC_CB_ENVIRONMENT=development
39+
NEXT_PUBLIC_CODEBUFF_APP_URL=http://localhost:3000
40+
NEXT_PUBLIC_CODEBUFF_BACKEND_URL=http://localhost:3001
41+
NEXT_PUBLIC_SUPPORT_EMAIL=support@codebuff.com
42+
NEXT_PUBLIC_POSTHOG_API_KEY=phc_dummy_posthog_key
43+
NEXT_PUBLIC_POSTHOG_HOST_URL=https://app.posthog.com
44+
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_dummy_publishable
45+
NEXT_PUBLIC_STRIPE_CUSTOMER_PORTAL=https://billing.stripe.com/p/login/test_dummy

.github/workflows/nightly-evals.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
run-nightly-evals:
1111
runs-on: ubuntu-latest
12-
timeout-minutes: 540
12+
timeout-minutes: 360 # 6 hours is the max for any hosted github action
1313
steps:
1414
- name: Checkout repository
1515
uses: actions/checkout@v3

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ debug/
3131
# Infisical cache (contains secrets, should not be committed)
3232
.infisical-cache
3333
.infisical-cache.tmp
34+
.infisical.json

.infisical.json

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

0 commit comments

Comments
 (0)