import { defineWithTypes } from 'gunshi' import { configArg, dryRunId, type DryRunExtensions, yesArg } from './shared.ts' export const command = defineWithTypes<{ extensions: DryRunExtensions }>()({ name: 'remove', description: 'Remove a plugin or parser from kubb.config.ts and uninstall its package.', examples: ['kubb remove plugin-zod', 'kubb remove acme/plugin-x --yes', 'kubb remove plugin-zod --no-uninstall', 'kubb remove plugin-zod --dry-run'].join( '\n', ), toKebab: true, args: { id: { type: 'positional', description: 'Registry id: owner/slug, or a slug for an official extension', required: true, }, ...configArg, ...yesArg, uninstall: { type: 'boolean', description: 'Uninstall the package. Pass --no-uninstall to only edit the config', negatable: true, default: true, }, }, async run({ values, extensions }) { // Imported here, so `kubb --help` does not load the runner. const { run } = await import('../runners/remove/run.ts') await run({ id: values.id, configPath: values.config, yes: values.yes, uninstall: values.uninstall, dryRun: extensions[dryRunId].enabled }) }, })