feat: show work status on draft sessions and resolve project worktrees

Keeps the work status panel aligned to the draft's target directory
Resolves project labels for sibling worktrees using shared session-directory logic
Adds coverage for resolving a worktree back to its registered project
This commit is contained in:
Bohdan Triapitsyn
2026-08-11 17:00:23 +03:00
parent a20b87e984
commit 22b3665077
4 changed files with 80 additions and 42 deletions
@@ -0,0 +1,21 @@
import { describe, expect, test } from 'bun:test';
import { resolveProjectForSessionDirectory } from './projectResolution';
const projects = [
{ id: 'openchamber', path: '/workspace/openchamber', label: 'OpenChamber' },
];
describe('resolveProjectForSessionDirectory', () => {
test('resolves a sibling worktree to its registered project', () => {
const worktrees = new Map([
['/workspace/openchamber', [{
path: '/workspace/openchamber-feature',
projectDirectory: '/workspace/openchamber',
branch: 'feature',
label: 'feature',
}]],
]);
expect(resolveProjectForSessionDirectory(projects, worktrees, '/workspace/openchamber-feature')).toEqual(projects[0]);
});
});