feat(cli): show the active mcpctl project in prime-agent's footer
`/mcpctl` could switch projects but there was no way to see which one was active without running a command. prime-agent exposes the same status-bar channel the model name uses (`ctx.ui.setStatus`), so the switcher now publishes `mcpctl:<project>` there. Wired to `session_start`, which fires on startup *and* on every reload — including the reload the switch itself triggers — so the footer tracks settings.json without extra bookkeeping. Cleared when no project is mounted. Also fixes `notify(..., 'success')`: the API only accepts info|warning|error. Not a live bug (prime-agent falls through to the same showStatus path as 'info') but it fails a typecheck of the extension against the real ExtensionAPI, which is how it was found. The extension ships as a JSON-escaped string and is never compiled by our build, so it was typechecked out-of-tree against @earendil-works/pi-coding-agent's published types. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017BMXdb2qZbPSh8Q7XpTyjB
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -510,6 +510,24 @@ describe('config prime-agent', () => {
|
|||||||
expect(exceptionSafeRead(join(tmpDir, '.mcpctl-project'))).toBeNull();
|
expect(exceptionSafeRead(join(tmpDir, '.mcpctl-project'))).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('the installed switcher extension publishes the active project to the footer', 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');
|
||||||
|
// Footer status, refreshed on startup and on every reload (which is what
|
||||||
|
// the switch itself triggers) — the mcpctl equivalent of the model name.
|
||||||
|
expect(ext).toContain("pi.on('session_start'");
|
||||||
|
expect(ext).toContain('ctx.ui.setStatus(STATUS_KEY');
|
||||||
|
expect(ext).toContain('`mcpctl:${active}`');
|
||||||
|
// notify() only accepts info|warning|error — 'success' is not a valid type.
|
||||||
|
expect(ext).not.toContain("'success'");
|
||||||
|
});
|
||||||
|
|
||||||
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