workflow: polish — /context groups trackers, /workflow in README, memoize git root

- contextPanel splits 'instructions' from 'trackers' (TODO.md/ROADMAP.md), so
  /context no longer presents project trackers as standing orders, and its
  empty-state mentions both instruction files and trackers
- README: docs table gets Project workflow, command list gets the new commands
- session: gitRoot memoized (one sync fs walk per session, not per prompt
  build); workflowPolicy computed once per systemFor
- test: context panel grouping covered

10 workflow tests, 830+ suite green
This commit is contained in:
asepharyana
2026-09-09 19:12:29 +07:00
parent a3739eb628
commit 4aeb0d2455
4 changed files with 43 additions and 12 deletions
+16 -2
View File
@@ -169,10 +169,24 @@ test('/workflow parses to the workflow action', () => {
test('/workflow panel renders the status rows', () =>
inGitRepo(async () => {
await Bun.write(join(process.cwd(), 'TODO.md'), '# Todo\n- [ ] thing\n');
const session = new Session({ model: new MockLanguageModelV4({ doStream: async () => stream([]) }), askApproval: async () => "deny" });
const session = new Session({ model: new MockLanguageModelV4({ doStream: async () => stream([]) }), askApproval: async () => 'deny' });
const { workflowPanel } = await import('../src/ui/panel-bodies');
const panel = workflowPanel(session);
expect(panel.title).toBe('workflow');
expect(panel.body).toContain('TODO.md: yes');
expect(panel.body).toContain('workflow: on');
}));
}));
test('context panel groups instructions and trackers separately', () => {
const pm = require('../src/ui/panel-bodies') as typeof import('../src/ui/panel-bodies');
const panel = pm.contextPanel(['/repo/AGENTS.md', '/repo/TODO.md', '/repo/docs/a.md']);
expect(panel.title).toBe('project instructions & trackers');
expect(panel.body).toContain('instructions:');
expect(panel.body).toContain('- `/repo/AGENTS.md`');
expect(panel.body).toContain('trackers:');
expect(panel.body).toContain('- `/repo/TODO.md`');
const empty = pm.contextPanel([]);
expect(empty.body).toContain('No `AGENTS.md`');
expect(empty.body).toContain('no project tracker is loaded');
});