Compare commits
4 Commits
8b006263de
...
bc83d36a68
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc83d36a68 | ||
|
|
e6db9cac83 | ||
|
|
64503e8924 | ||
|
|
ba05b2865c |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -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(
|
||||
|
||||
@@ -450,8 +450,13 @@ export default function (pi: ExtensionAPI) {
|
||||
|
||||
/** Above this many projects, arrowing through the list stops being usable. */
|
||||
const FILTER_THRESHOLD = 20;
|
||||
/** Never render more than this in one selector, even after filtering. */
|
||||
const MAX_SHOWN = 50;
|
||||
/**
|
||||
* Hard cap on rendered rows. pi's ExtensionSelectorComponent.updateList()
|
||||
* renders *every* option with no windowing, so an uncapped list scrolls the
|
||||
* whole screen away. prime-agent's selector windows to ~20 itself; this
|
||||
* matches that height so both hosts feel the same.
|
||||
*/
|
||||
const MAX_SHOWN = 20;
|
||||
|
||||
/**
|
||||
* Choose a project, asking for a filter first when the list is long.
|
||||
|
||||
Reference in New Issue
Block a user