Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/cli/ai/slash-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ export const AI_CHAT_LOGIN_COMMAND = '/login';
export const AI_CHAT_LOGOUT_COMMAND = '/logout';
export const AI_CHAT_MODEL_COMMAND = '/model';
export const AI_CHAT_PROVIDER_COMMAND = '/provider';
export const AI_CHAT_DESELECT_COMMAND = '/deselect';
export const AI_CHAT_EXIT_COMMAND = '/exit';

export const AI_CHAT_SLASH_COMMANDS: SlashCommandDef[] = [
{ name: 'browser', description: 'Open the active site in the browser' },
{ name: 'deselect', description: 'Deselect the active site' },
{ name: 'api-key', description: 'Set or update the Anthropic API key' },
{ name: 'login', description: 'Log in to WordPress.com' },
{ name: 'logout', description: 'Log out of WordPress.com' },
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/ai/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ export class AiChatUI {
this.tui.requestRender();
}

private clearActiveSite(): void {
clearActiveSite(): void {
this._activeSite = null;
this._activeSiteData = null;
this.editor.activeSiteName = null;
Expand Down
10 changes: 10 additions & 0 deletions apps/cli/commands/ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { AI_PROVIDERS, type AiProviderId } from 'cli/ai/providers';
import {
AI_CHAT_API_KEY_COMMAND,
AI_CHAT_BROWSER_COMMAND,
AI_CHAT_DESELECT_COMMAND,
AI_CHAT_EXIT_COMMAND,
AI_CHAT_LOGIN_COMMAND,
AI_CHAT_LOGOUT_COMMAND,
Expand Down Expand Up @@ -193,6 +194,15 @@ export async function runCommand(): Promise< void > {
continue;
}

if ( trimmedPrompt === AI_CHAT_DESELECT_COMMAND ) {
if ( ui.activeSite ) {
ui.clearActiveSite();
} else {
ui.showInfo( 'No site selected.' );
}
continue;
}

if ( trimmedPrompt === AI_CHAT_API_KEY_COMMAND ) {
try {
await prepareProviderSelection( 'anthropic-api-key', { force: true } );
Expand Down
Loading