(config: Config | null)
| 117 | } |
| 118 | |
| 119 | export const ideCommand = (config: Config | null): SlashCommand | null => { |
| 120 | if (!config) { |
| 121 | return null; |
| 122 | } |
| 123 | const ideClient = config.getIdeClient(); |
| 124 | const currentIDE = ideClient.getCurrentIde(); |
| 125 | if (!currentIDE || !ideClient.getDetectedIdeDisplayName()) { |
| 126 | return { |
| 127 | name: 'ide', |
| 128 | description: 'manage IDE integration', |
| 129 | kind: CommandKind.BUILT_IN, |
| 130 | action: (): SlashCommandActionReturn => |
| 131 | ({ |
| 132 | type: 'message', |
| 133 | messageType: 'error', |
| 134 | content: `IDE integration is not supported in your current environment. To use this feature, run ANUS in one of these supported IDEs: ${Object.values( |
| 135 | DetectedIde, |
| 136 | ) |
| 137 | .map((ide) => getIdeInfo(ide).displayName) |
| 138 | .join(', ')}`, |
| 139 | }) as const, |
| 140 | }; |
| 141 | } |
| 142 | |
| 143 | const ideSlashCommand: SlashCommand = { |
| 144 | name: 'ide', |
| 145 | description: 'manage IDE integration', |
| 146 | kind: CommandKind.BUILT_IN, |
| 147 | subCommands: [], |
| 148 | }; |
| 149 | |
| 150 | const statusCommand: SlashCommand = { |
| 151 | name: 'status', |
| 152 | description: 'check status of IDE integration', |
| 153 | kind: CommandKind.BUILT_IN, |
| 154 | action: async (): Promise<SlashCommandActionReturn> => { |
| 155 | const { messageType, content } = |
| 156 | await getIdeStatusMessageWithFiles(ideClient); |
| 157 | return { |
| 158 | type: 'message', |
| 159 | messageType, |
| 160 | content, |
| 161 | } as const; |
| 162 | }, |
| 163 | }; |
| 164 | |
| 165 | const installCommand: SlashCommand = { |
| 166 | name: 'install', |
| 167 | description: `install required IDE companion for ${ideClient.getDetectedIdeDisplayName()}`, |
| 168 | kind: CommandKind.BUILT_IN, |
| 169 | action: async (context) => { |
| 170 | const installer = getIdeInstaller(currentIDE); |
| 171 | if (!installer) { |
| 172 | context.ui.addItem( |
| 173 | { |
| 174 | type: 'error', |
| 175 | text: `No installer is available for ${ideClient.getDetectedIdeDisplayName()}. Please install the '${ANUS_CLI_COMPANION_EXTENSION_NAME}' extension manually from the marketplace.`, |
| 176 | }, |
no test coverage detected