* fix(terminal): make command sessions own action lifecycle * fix(ui): reconcile project action terminal state * feat(ui): show running project actions in terminal tabs * feat(ui): run project actions from linked worktrees * fix(ui): guard project action reconciliation * fix(ui): scope project action preview fallback * fix(ui): default project actions to worktrees * fix(ui): reveal project action terminals * fix(ui): retain terminal output after snapshot replay * fix(ui): restore running action terminals on revisit
40 lines
1.5 KiB
TypeScript
40 lines
1.5 KiB
TypeScript
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]);
|
|
});
|
|
|
|
test('prefers registered worktree ownership over a containing project', () => {
|
|
const configuredProjects = [
|
|
{ id: 'home', path: '/Users/elfy', label: 'Home' },
|
|
{ id: 'infoscan', path: '/Users/elfy/GitRepos/infoscan', label: 'InfoScan' },
|
|
];
|
|
const worktreePath = '/Users/elfy/.local/share/opencode/worktree/refactor-self-hosted-runners';
|
|
const worktrees = new Map([
|
|
['/Users/elfy/GitRepos/infoscan', [{
|
|
path: worktreePath,
|
|
projectDirectory: '/Users/elfy/GitRepos/infoscan',
|
|
branch: 'refactor/self-hosted-runners',
|
|
label: 'refactor/self-hosted-runners',
|
|
}]],
|
|
]);
|
|
|
|
expect(resolveProjectForSessionDirectory(configuredProjects, worktrees, worktreePath)).toEqual(configuredProjects[1]);
|
|
});
|
|
});
|