mirror of https://github.com/buster-so/buster.git
grep search getting me?
This commit is contained in:
parent
a6ea5bef71
commit
2f8622e5bb
|
@ -83,6 +83,18 @@ const docsAgentExecution = async ({
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Get current working directory from sandbox
|
||||||
|
let cwdMessage = '';
|
||||||
|
if (sandbox) {
|
||||||
|
try {
|
||||||
|
const pwdResult = await sandbox.process.executeCommand('pwd');
|
||||||
|
const currentDir = pwdResult.result.trim();
|
||||||
|
cwdMessage = `cwd: ${currentDir}`;
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('[DocsAgent] Failed to get current working directory:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get the docs agent instructions with the current date
|
// Get the docs agent instructions with the current date
|
||||||
const instructions = getDocsInstructions();
|
const instructions = getDocsInstructions();
|
||||||
const repositoryStructure = `<repository-structure>\n${inputData.repositoryTree}\n</repository-structure>`;
|
const repositoryStructure = `<repository-structure>\n${inputData.repositoryTree}\n</repository-structure>`;
|
||||||
|
@ -110,6 +122,14 @@ const docsAgentExecution = async ({
|
||||||
} as CoreMessage,
|
} as CoreMessage,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Add cwd message if available (after todo list)
|
||||||
|
if (cwdMessage) {
|
||||||
|
messages.push({
|
||||||
|
role: 'user',
|
||||||
|
content: cwdMessage,
|
||||||
|
} as CoreMessage);
|
||||||
|
}
|
||||||
|
|
||||||
// Execute the docs agent
|
// Execute the docs agent
|
||||||
const result = await docsAgent.stream(messages, {
|
const result = await docsAgent.stream(messages, {
|
||||||
instructions,
|
instructions,
|
||||||
|
|
|
@ -48,23 +48,28 @@ const rgSearchExecution = wrapTraced(
|
||||||
// Execute all commands concurrently
|
// Execute all commands concurrently
|
||||||
const resultPromises = commands.map(async (command) => {
|
const resultPromises = commands.map(async (command) => {
|
||||||
try {
|
try {
|
||||||
|
// Use executeCommand like bash-tool does
|
||||||
const result = await sandbox.process.executeCommand(command);
|
const result = await sandbox.process.executeCommand(command);
|
||||||
|
|
||||||
// Exit code 1 means no matches found, which is not an error for rg
|
// The sandbox returns the full output in result.result
|
||||||
if (result.exitCode === 0 || result.exitCode === 1) {
|
const output = (result.result || '').trim();
|
||||||
|
|
||||||
|
// For ripgrep, exit code 1 means no matches found, which is not an error
|
||||||
|
const isRgNoMatchesFound = result.exitCode === 1 && command.includes('rg ');
|
||||||
|
|
||||||
|
if (result.exitCode === 0 || isRgNoMatchesFound) {
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
command: command,
|
command: command,
|
||||||
stdout: result.result || '',
|
stdout: output,
|
||||||
stderr: '',
|
stderr: '',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
command: command,
|
command: command,
|
||||||
stdout: '',
|
stdout: '',
|
||||||
stderr: result.result || '',
|
stderr: output,
|
||||||
error: `Command failed with exit code ${result.exitCode}`,
|
error: `Command failed with exit code ${result.exitCode}`,
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -94,7 +94,7 @@ describe('docs-agent-workflow', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const input = createTestWorkflowInput({
|
const input = createTestWorkflowInput({
|
||||||
message: TEST_MESSAGES.documentSpecific, // Use simpler test message
|
message: TEST_MESSAGES.documentAll, // Use simpler test message
|
||||||
context,
|
context,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue