All checks were successful
CI / Build & test (Node 22) (push) Successful in 10m17s
CI / Build & test (Node 24) (push) Successful in 10m13s
CI / No em/en dashes (push) Successful in 4s
Deploy site (production) / build-and-deploy (push) Successful in 24s
Release / Publish to Gitea npm registry (push) Successful in 10m17s
VSCode Release / Package VSIX (push) Successful in 9m39s
Desktop Release / Build Linux (AppImage + deb) (push) Successful in 15m41s
CI / Pack & boot smoke (Node 22) (push) Successful in 10m3s
« Démarrer le projet » : un repo définit une fois ses commandes de démarrage (serveur de dev, API, base de données), un clic ouvre un terminal PTY par commande dans le dock IDE. Serveur (additif, PROTOCOL_VERSION inchangé) : - LaunchCommand[] persistées sur repos.launch_commands (migration 13) ; champ additif SessionSummary.launchRunId. - POST /repos/:id/launch : résolution du worktree côté serveur, cwd de commande borné (anti-traversal), commandIds outrepasse enabled. - GET /repos/:id/launch/detect : détection package.json / Procfile / docker-compose. - Shell de login interactif ($SHELL -l -i, charge le PATH nvm/asdf) + auto-type de la commande ; le shell survit à la commande (échec visible). Web : LaunchProjectModal + actions (ProjectTreeNode, SessionsPanel, CommandPalette), stores sessions/worktrees, i18n EN/FR. Alignement du reste du projet : - Extension VS Code 0.4.0 : commande Start Project (repo/worktree), Stop Launch, badge « launch » dans l'arbre, méthode REST startLaunch. - Site vitrine : 16e feature card (Rocket) + section showcase « Start the project » (mockup fidèle au modal), i18n EN/FR. - Documentation : README (EN + FR), help-content (EN + FR), CHANGELOGs server + vscode. Vérifié : 430 tests, typecheck, build (web + site + vscode), acceptance-p13 ALL GREEN, VSIX packagé, garde anti-tirets, vérif visuelle du site (thèmes clair et sombre).
105 lines
3.8 KiB
TypeScript
105 lines
3.8 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import type { RepoSummary, SessionSummary, WorktreeSummary } from '@arboretum/shared';
|
|
import { Store } from '../src/state/store.js';
|
|
|
|
function repo(id: string): RepoSummary {
|
|
return {
|
|
id,
|
|
path: `/code/${id}`,
|
|
label: id,
|
|
defaultBranch: 'main',
|
|
postCreateHooks: [],
|
|
launchCommands: [],
|
|
preTrust: false,
|
|
createdAt: '2026-01-01T00:00:00Z',
|
|
valid: true,
|
|
hidden: false,
|
|
};
|
|
}
|
|
|
|
function worktree(repoId: string, path: string, branch: string): WorktreeSummary {
|
|
return {
|
|
repoId,
|
|
path,
|
|
branch,
|
|
head: 'abcdef0',
|
|
detached: false,
|
|
locked: false,
|
|
prunable: false,
|
|
isMain: branch === 'main',
|
|
git: { ahead: 0, behind: 0, dirtyCount: 0, upstream: null },
|
|
sessions: [],
|
|
};
|
|
}
|
|
|
|
function session(id: string, cwd: string, over: Partial<SessionSummary> = {}): SessionSummary {
|
|
return {
|
|
id,
|
|
cwd,
|
|
command: 'claude',
|
|
title: null,
|
|
status: 'running',
|
|
live: true,
|
|
createdAt: '2026-01-01T00:00:00Z',
|
|
endedAt: null,
|
|
exitCode: null,
|
|
clients: 0,
|
|
source: 'managed',
|
|
claudeSessionId: null,
|
|
pid: 123,
|
|
resumable: false,
|
|
attachable: true,
|
|
registryStatus: null,
|
|
...over,
|
|
};
|
|
}
|
|
|
|
describe('Store', () => {
|
|
it('corrèle les sessions au worktree par cwd et filtre les externes', () => {
|
|
const store = new Store();
|
|
store.applyWorktree({ type: 'repo_update', repo: repo('app') });
|
|
store.applyWorktree({ type: 'worktree_update', repoId: 'app', worktree: worktree('app', '/code/app', 'main') });
|
|
|
|
store.applySession({ type: 'session_update', session: session('s1', '/code/app') });
|
|
store.applySession({ type: 'session_update', session: session('s2', '/code/app', { source: 'discovered' }) });
|
|
|
|
// externes masquées par défaut
|
|
expect(store.sessionsForWorktree('/code/app').map((s) => s.id)).toEqual(['s1']);
|
|
store.setShowExternalSessions(true);
|
|
expect(store.sessionsForWorktree('/code/app').map((s) => s.id).sort()).toEqual(['s1', 's2']);
|
|
});
|
|
|
|
it('liste les repos visibles, triés', () => {
|
|
const store = new Store();
|
|
store.applyWorktree({ type: 'repo_update', repo: { ...repo('b'), label: 'beta' } });
|
|
store.applyWorktree({ type: 'repo_update', repo: { ...repo('a'), label: 'alpha' } });
|
|
store.applyWorktree({ type: 'repo_update', repo: { ...repo('h'), label: 'hidden', hidden: true } });
|
|
expect(store.listRepos().map((r) => r.label)).toEqual(['alpha', 'beta']);
|
|
});
|
|
|
|
it('session_exit marque la session morte', () => {
|
|
const store = new Store();
|
|
store.applySession({ type: 'session_update', session: session('s1', '/x') });
|
|
store.applySession({ type: 'session_exit', sessionId: 's1', exitCode: 0, signal: null });
|
|
expect(store.getSession('s1')?.live).toBe(false);
|
|
expect(store.getSession('s1')?.status).toBe('exited');
|
|
});
|
|
|
|
it('waitingSessions ne retient que les sessions live en attente', () => {
|
|
const store = new Store();
|
|
store.applySession({ type: 'session_update', session: session('s1', '/x', { activity: 'waiting' }) });
|
|
store.applySession({ type: 'session_update', session: session('s2', '/y', { activity: 'busy' }) });
|
|
store.applySession({ type: 'session_update', session: session('s3', '/z', { activity: 'waiting', live: false, status: 'exited' }) });
|
|
expect(store.waitingSessions().map((s) => s.id)).toEqual(['s1']);
|
|
});
|
|
|
|
it('worktree_removed retire le worktree', () => {
|
|
const store = new Store();
|
|
store.applyWorktree({ type: 'repo_update', repo: repo('app') });
|
|
store.applyWorktree({ type: 'worktree_update', repoId: 'app', worktree: worktree('app', '/code/app-wt', 'feat') });
|
|
expect(store.listWorktrees('app')).toHaveLength(1);
|
|
store.applyWorktree({ type: 'worktree_removed', repoId: 'app', path: '/code/app-wt' });
|
|
expect(store.listWorktrees('app')).toHaveLength(0);
|
|
});
|
|
});
|