Skip to content

Commit 22c676c

Browse files
authored
Merge branch 'CodebuffAI:main' into cost-optimization-clean
2 parents 8ba55cc + f703966 commit 22c676c

File tree

28 files changed

+980
-261
lines changed

28 files changed

+980
-261
lines changed
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

.github/workflows/nightly-evals.yml

Lines changed: 2 additions & 2 deletions
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: 1440
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
@@ -47,7 +47,7 @@ jobs:
4747
echo "CODEBUFF_GITHUB_TOKEN=${{ secrets.CODEBUFF_GITHUB_TOKEN }}" >> $GITHUB_ENV
4848
4949
- name: Run nightly evals
50-
run: cd evals && bun run-eval-set --concurrency 3 --email --title "Nightly Eval Run ($(date '+%Y-%m-%d'))"
50+
run: cd evals && bun run-eval-set --concurrency 10 --email --title "Nightly Eval Run ($(date '+%Y-%m-%d'))"
5151

5252
- name: Workflow completed
5353
run: echo "Nightly evals workflow completed successfully"

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,7 @@ Some ways you can help:
174174
**Contributing**: [CONTRIBUTING.md](./CONTRIBUTING.md) - Start here to contribute!
175175

176176
**Support**: [support@codebuff.com](mailto:support@codebuff.com)
177+
178+
## Star History
179+
180+
[![Star History Chart](https://api.star-history.com/svg?repos=CodebuffAI/codebuff&type=Date)](https://www.star-history.com/#CodebuffAI/codebuff&Date)

0 commit comments

Comments
 (0)