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 {
|
||||
// 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
|
||||
const instructions = getDocsInstructions();
|
||||
const repositoryStructure = `<repository-structure>\n${inputData.repositoryTree}\n</repository-structure>`;
|
||||
|
@ -110,6 +122,14 @@ const docsAgentExecution = async ({
|
|||
} as CoreMessage,
|
||||
];
|
||||
|
||||
// Add cwd message if available (after todo list)
|
||||
if (cwdMessage) {
|
||||
messages.push({
|
||||
role: 'user',
|
||||
content: cwdMessage,
|
||||
} as CoreMessage);
|
||||
}
|
||||
|
||||
// Execute the docs agent
|
||||
const result = await docsAgent.stream(messages, {
|
||||
instructions,
|
||||
|
|
|
@ -48,23 +48,28 @@ const rgSearchExecution = wrapTraced(
|
|||
// Execute all commands concurrently
|
||||
const resultPromises = commands.map(async (command) => {
|
||||
try {
|
||||
// Use executeCommand like bash-tool does
|
||||
const result = await sandbox.process.executeCommand(command);
|
||||
|
||||
// Exit code 1 means no matches found, which is not an error for rg
|
||||
if (result.exitCode === 0 || result.exitCode === 1) {
|
||||
// The sandbox returns the full output in result.result
|
||||
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 {
|
||||
success: true,
|
||||
command: command,
|
||||
stdout: result.result || '',
|
||||
stdout: output,
|
||||
stderr: '',
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
success: false,
|
||||
command: command,
|
||||
stdout: '',
|
||||
stderr: result.result || '',
|
||||
stderr: output,
|
||||
error: `Command failed with exit code ${result.exitCode}`,
|
||||
};
|
||||
} catch (error) {
|
||||
|
|
|
@ -94,7 +94,7 @@ describe('docs-agent-workflow', () => {
|
|||
});
|
||||
|
||||
const input = createTestWorkflowInput({
|
||||
message: TEST_MESSAGES.documentSpecific, // Use simpler test message
|
||||
message: TEST_MESSAGES.documentAll, // Use simpler test message
|
||||
context,
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue