prompt: inject full ignore-aware file list at boot (gitignore-respected, capped 5000)
walk() at boot -> Session.workspaceFiles -> systemPrompt Environment section + subagent system prompts. read_many_files still on-demand, but the agent now sees the tree without a tool call.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { expect, test } from 'bun:test';
|
||||
import { systemPrompt } from '../src/prompt';
|
||||
|
||||
test('workspaceFiles are injected gitignore-style when provided', () => {
|
||||
const prompt = systemPrompt({ cwd: '/repo', workspaceFiles: ['src/app.ts', 'README.md'] });
|
||||
expect(prompt).toContain('Workspace files (2, gitignore-respected');
|
||||
expect(prompt).toContain('src/app.ts');
|
||||
expect(prompt).toContain('README.md');
|
||||
});
|
||||
|
||||
test('workspaceFiles omitted when empty', () => {
|
||||
const prompt = systemPrompt({ cwd: '/repo', workspaceFiles: [] });
|
||||
expect(prompt).not.toContain('Workspace files');
|
||||
});
|
||||
|
||||
test('workspaceFiles undefined leaves prompt unchanged', () => {
|
||||
const prompt = systemPrompt({ cwd: '/repo' });
|
||||
expect(prompt).not.toContain('Workspace files');
|
||||
});
|
||||
Reference in New Issue
Block a user