Merge main into feat/pi-extension (prime-agent switcher UX)

This commit is contained in:
Michal
2026-08-08 18:33:31 +01:00
2 changed files with 33 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@@ -528,6 +528,38 @@ describe('config prime-agent', () => {
expect(ext).not.toContain("'success'");
});
it('the installed switcher shows the active project via a widget, not just setStatus', async () => {
const settingsPath = join(tmpDir, 'settings.json');
const cmd = createConfigCommand(
{ configDeps: { configDir: tmpDir }, log },
{ client, credentialsDeps: { configDir: tmpDir }, log },
);
await cmd.parseAsync(['prime-agent', '--project', 'ha', '-o', settingsPath, '--skip-skills', '--token', 'mcpctl_pat_x'], { from: 'user' });
const ext = readFileSync(join(tmpDir, 'extensions', 'mcpctl-switch.ts'), 'utf-8');
// prime-agent stores extension statuses but never renders them, so a
// setStatus-only indicator is invisible there. Widgets are rendered.
expect(ext).toContain('ctx.ui.setWidget(STATUS_KEY');
expect(ext).toContain("placement: 'belowEditor'");
// Still set the status: pi's footer does render it.
expect(ext).toContain('ctx.ui.setStatus(STATUS_KEY');
});
it('the installed switcher filters the project list before showing it', async () => {
const settingsPath = join(tmpDir, 'settings.json');
const cmd = createConfigCommand(
{ configDeps: { configDir: tmpDir }, log },
{ client, credentialsDeps: { configDir: tmpDir }, log },
);
await cmd.parseAsync(['prime-agent', '--project', 'ha', '-o', settingsPath, '--skip-skills', '--token', 'mcpctl_pat_x'], { from: 'user' });
const ext = readFileSync(join(tmpDir, 'extensions', 'mcpctl-switch.ts'), 'utf-8');
// Hundreds of projects in a plain arrow-key list is unusable.
expect(ext).toContain('export function filterProjects');
expect(ext).toContain('ctx.ui.input(');
expect(ext).toContain('FILTER_THRESHOLD');
});
it('the installed switcher extension passes --skip-marker', async () => {
const settingsPath = join(tmpDir, 'settings.json');
const cmd = createConfigCommand(