dify/cli/src/commands/auth/devices/revoke/index.ts
Stephen Zhou a84c2d36a3
style: format with vp fmt (#38803)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-07-12 15:57:46 +00:00

45 lines
1.4 KiB
TypeScript

import type { CommandEffect } from '@/framework/command'
import { DifyCommand } from '@/commands/_shared/dify-command'
import { httpRetryFlag } from '@/commands/_shared/global-flags'
import { runDevicesRevoke } from '@/commands/auth/devices/_shared/devices'
import { Args, Flags } from '@/framework/flags'
export default class DevicesRevoke extends DifyCommand {
static override description = 'Revoke one or all session devices'
static override effect: CommandEffect = 'destructive'
static override examples = [
'<%= config.bin %> auth devices revoke "difyctl on laptop"',
'<%= config.bin %> auth devices revoke --all',
]
static override args = {
target: Args.string({ description: 'device label / id to revoke', required: false }),
}
static override flags = {
all: Flags.boolean({
description: 'revoke every session except the current one',
default: false,
}),
'http-retry': httpRetryFlag,
yes: Flags.boolean({ char: 'y', description: 'skip confirmation prompt', default: false }),
}
async run(argv: string[]): Promise<void> {
const { args, flags } = this.parse(DevicesRevoke, argv)
const ctx = await this.authedCtx({ retryFlag: flags['http-retry'] })
await runDevicesRevoke({
io: ctx.io,
reg: ctx.reg,
active: ctx.active,
store: ctx.store,
http: ctx.http,
target: args.target,
all: flags.all,
yes: flags.yes,
})
}
}