Merge pull request 'feat(prime-agent): filterable project picker + visible active-project indicator' (#97) from feat/prime-agent-switcher-ux into main
Some checks failed
Some checks failed
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -528,6 +528,38 @@ describe('config prime-agent', () => {
|
|||||||
expect(ext).not.toContain("'success'");
|
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 () => {
|
it('the installed switcher extension passes --skip-marker', async () => {
|
||||||
const settingsPath = join(tmpDir, 'settings.json');
|
const settingsPath = join(tmpDir, 'settings.json');
|
||||||
const cmd = createConfigCommand(
|
const cmd = createConfigCommand(
|
||||||
|
|||||||
Reference in New Issue
Block a user