Add skip option for agent setup

This commit is contained in:
Andrey Avtomonov 2026-05-24 19:22:15 +02:00
parent ce0015f677
commit 4397211c4a
4 changed files with 79 additions and 4 deletions

View file

@ -418,6 +418,11 @@ describe('setup agents', () => {
label: 'Ask data questions + manage KTX with CLI commands',
hint: 'Adds an admin CLI skill so agents can run ktx status, sl, wiki, and setup commands.',
},
{
value: 'skip',
label: 'Skip agent setup for now',
hint: 'Leaves agent integration incomplete. You can run ktx setup --agents later.',
},
],
});
expect(prompts.multiselect).toHaveBeenCalledWith(
@ -427,6 +432,58 @@ describe('setup agents', () => {
);
});
it('lets interactive setup skip agent integration from the connection mode prompt', async () => {
const io = makeIo();
const prompts = {
select: vi.fn(async () => 'skip'),
multiselect: vi.fn(async () => {
throw new Error('target selection should not run');
}),
cancel: vi.fn(),
};
await expect(
runKtxSetupAgentsStep(
{
projectDir: tempDir,
inputMode: 'auto',
yes: false,
agents: true,
scope: 'project',
mode: 'mcp',
skipAgents: false,
},
io.io,
{ prompts },
),
).resolves.toMatchObject({ status: 'skipped', projectDir: tempDir });
expect(prompts.select).toHaveBeenCalledWith({
message: 'What should agents be allowed to do with this KTX project?',
options: [
{
value: 'mcp',
label: 'Ask data questions with KTX MCP',
hint: 'Installs the MCP connection and analytics workflow skill. Best for normal use.',
},
{
value: 'mcp-cli',
label: 'Ask data questions + manage KTX with CLI commands',
hint: 'Adds an admin CLI skill so agents can run ktx status, sl, wiki, and setup commands.',
},
{
value: 'skip',
label: 'Skip agent setup for now',
hint: 'Leaves agent integration incomplete. You can run ktx setup --agents later.',
},
],
});
expect(prompts.multiselect).not.toHaveBeenCalled();
expect(io.stdout()).toContain('Agent integration skipped.');
await expect(stat(join(tempDir, '.ktx/agents/install-manifest.json'))).rejects.toThrow();
expect(await readKtxSetupState(tempDir)).toEqual({ completed_steps: [] });
});
it('prompts for global scope when every selected target supports it', async () => {
const home = await mkdtemp(join(tmpdir(), 'ktx-setup-agents-home-'));
const previousHome = process.env.HOME;

View file

@ -21,6 +21,7 @@ export type KtxAgentTarget = 'claude-code' | 'claude-desktop' | 'codex' | 'curso
export type KtxAgentScope = 'project' | 'global' | 'local';
/** @internal */
export type KtxAgentInstallMode = 'mcp' | 'mcp-cli';
type KtxAgentModePromptChoice = KtxAgentInstallMode | 'skip' | 'back';
export interface KtxSetupAgentsArgs {
projectDir: string;
@ -1122,9 +1123,18 @@ export async function runKtxSetupAgentsStep(
label: 'Ask data questions + manage KTX with CLI commands',
hint: 'Adds an admin CLI skill so agents can run ktx status, sl, wiki, and setup commands.',
},
{
value: 'skip',
label: 'Skip agent setup for now',
hint: 'Leaves agent integration incomplete. You can run ktx setup --agents later.',
},
],
})) as KtxAgentInstallMode | 'back');
})) as KtxAgentModePromptChoice);
if (mode === 'back') return { status: 'skipped', projectDir: args.projectDir };
if (mode === 'skip') {
io.stdout.write('│ Agent integration skipped.\n');
return { status: 'skipped', projectDir: args.projectDir };
}
const targets =
args.target !== undefined