Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions packages/cli/src/__tests__/commands/setup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,13 @@ describe('setup command', () => {

await program.parseAsync(['node', 'test', 'setup']);

expect(mockUi.warning).toHaveBeenCalledWith(expect.stringContaining('sudo apt-get install tmux'));
expect(mockUi.text).toHaveBeenCalledWith('Next steps');
expect(mockUi.warning).toHaveBeenCalledWith(
'Next step: install tmux (sudo apt-get update && sudo apt-get install tmux), then run ai-devkit setup again to start managed agents.',
);
expect(mockInspectTmux.mock.invocationCallOrder[0]).toBeLessThan(mockSetupService.run.mock.invocationCallOrder[0]);
expect(mockUi.table.mock.invocationCallOrder[0]).toBeLessThan(mockUi.text.mock.invocationCallOrder[0]);
expect(mockUi.table.mock.invocationCallOrder[0]).toBeLessThan(mockUi.warning.mock.invocationCallOrder[0]);
expect(mockSetupService.run).toHaveBeenCalledOnce();
expect(process.exitCode).toBe(0);
});
Expand All @@ -117,7 +123,12 @@ describe('setup command', () => {

await program.parseAsync(['node', 'test', 'setup']);

expect(mockUi.warning).toHaveBeenCalledWith(expect.stringContaining('permission denied'));
expect(mockUi.text).toHaveBeenCalledWith('Next steps');
expect(mockUi.warning).toHaveBeenCalledWith(
'tmux check could not run (permission denied) — verify tmux works before starting agents.',
);
expect(mockInspectTmux.mock.invocationCallOrder[0]).toBeLessThan(mockSetupService.run.mock.invocationCallOrder[0]);
expect(mockUi.table.mock.invocationCallOrder[0]).toBeLessThan(mockUi.warning.mock.invocationCallOrder[0]);
expect(mockSetupService.run).toHaveBeenCalledOnce();
expect(process.exitCode).toBe(0);
});
Expand Down
21 changes: 12 additions & 9 deletions packages/cli/src/commands/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@ export async function setupCommand(options: SetupCommandOptions = {}): Promise<v

const tmuxDeps = createTmuxInspectionDeps();
const tmux = await inspectTmux(tmuxDeps);
ui.text('Host Prerequisites');
if (tmux.state === 'available') {
ui.success(tmux.version ? `tmux ${tmux.version} available` : `${tmux.rawVersion} available`);
} else if (tmux.state === 'missing') {
const instructions = await resolveTmuxInstallInstructions(tmuxDeps);
ui.warning(`tmux is required for interactive managed agents. ${instructions.message} Setup will continue.`);
} else {
ui.warning(`Could not run tmux -V (${tmux.rawVersion}). Setup will continue.`);
}

const report = await createSetupService().run({ agents });
const counts = countStatuses(report.results.map(result => result.status));
Expand All @@ -63,6 +54,18 @@ export async function setupCommand(options: SetupCommandOptions = {}): Promise<v
]),
});

if (tmux.state === 'available') {
ui.text('Host Prerequisites');
ui.success(tmux.version ? `tmux ${tmux.version} available` : `${tmux.rawVersion} available`);
} else if (tmux.state === 'missing') {
const instructions = await resolveTmuxInstallInstructions(tmuxDeps);
ui.text('Next steps');
ui.warning(`Next step: install tmux (${instructions.command}), then run ai-devkit setup again to start managed agents.`);
} else {
ui.text('Next steps');
ui.warning(`tmux check could not run (${tmux.rawVersion}) — verify tmux works before starting agents.`);
}

process.exitCode = counts.failed > 0 ? 1 : 0;
}

Expand Down
Loading