diff --git a/src/commands/user/auth-groups.ts b/src/commands/user/auth-groups.ts new file mode 100644 index 0000000..a95f371 --- /dev/null +++ b/src/commands/user/auth-groups.ts @@ -0,0 +1,16 @@ +/** + * commands/user/auth-groups.ts — 占位, Task 16 实现 + */ +import { Command } from 'commander' +import { log } from '../../core/log.ts' +import { installAiHelpHook } from '../../core/help.ts' + +export function buildUserAuthGroupsCommand(): Command { + const cmd = new Command('auth-groups').description('TODO: implement in Task 16') + cmd.action(async () => { + log.warn('TODO: implement in Task 16') + process.exit(1) + }) + installAiHelpHook(cmd, { purpose: 'TODO' }) + return cmd +} \ No newline at end of file diff --git a/src/commands/user/auth-list.ts b/src/commands/user/auth-list.ts new file mode 100644 index 0000000..eee5e10 --- /dev/null +++ b/src/commands/user/auth-list.ts @@ -0,0 +1,16 @@ +/** + * commands/user/auth-list.ts — 占位, Task 17 实现 + */ +import { Command } from 'commander' +import { log } from '../../core/log.ts' +import { installAiHelpHook } from '../../core/help.ts' + +export function buildUserAuthListCommand(): Command { + const cmd = new Command('auth-list').description('TODO: implement in Task 17') + cmd.action(async () => { + log.warn('TODO: implement in Task 17') + process.exit(1) + }) + installAiHelpHook(cmd, { purpose: 'TODO' }) + return cmd +} \ No newline at end of file diff --git a/src/commands/user/baseinfo.ts b/src/commands/user/baseinfo.ts new file mode 100644 index 0000000..f94e487 --- /dev/null +++ b/src/commands/user/baseinfo.ts @@ -0,0 +1,16 @@ +/** + * commands/user/baseinfo.ts — 占位, Task 15 实现 + */ +import { Command } from 'commander' +import { log } from '../../core/log.ts' +import { installAiHelpHook } from '../../core/help.ts' + +export function buildUserBaseinfoCommand(): Command { + const cmd = new Command('baseinfo').description('TODO: implement in Task 15') + cmd.action(async () => { + log.warn('TODO: implement in Task 15') + process.exit(1) + }) + installAiHelpHook(cmd, { purpose: 'TODO' }) + return cmd +} \ No newline at end of file diff --git a/src/commands/user/batch-delete.ts b/src/commands/user/batch-delete.ts new file mode 100644 index 0000000..7c93b53 --- /dev/null +++ b/src/commands/user/batch-delete.ts @@ -0,0 +1,16 @@ +/** + * commands/user/batch-delete.ts — 占位, Task 7 实现 + */ +import { Command } from 'commander' +import { log } from '../../core/log.ts' +import { installAiHelpHook } from '../../core/help.ts' + +export function buildUserBatchDeleteCommand(): Command { + const cmd = new Command('batch-delete').description('TODO: implement in Task 7') + cmd.action(async () => { + log.warn('TODO: implement in Task 7') + process.exit(1) + }) + installAiHelpHook(cmd, { purpose: 'TODO' }) + return cmd +} \ No newline at end of file diff --git a/src/commands/user/batch-set-position.ts b/src/commands/user/batch-set-position.ts new file mode 100644 index 0000000..e6a2207 --- /dev/null +++ b/src/commands/user/batch-set-position.ts @@ -0,0 +1,16 @@ +/** + * commands/user/batch-set-position.ts — 占位, Task 10 实现 + */ +import { Command } from 'commander' +import { log } from '../../core/log.ts' +import { installAiHelpHook } from '../../core/help.ts' + +export function buildUserBatchSetPositionCommand(): Command { + const cmd = new Command('batch-set-position').description('TODO: implement in Task 10') + cmd.action(async () => { + log.warn('TODO: implement in Task 10') + process.exit(1) + }) + installAiHelpHook(cmd, { purpose: 'TODO' }) + return cmd +} \ No newline at end of file diff --git a/src/commands/user/batch-state.ts b/src/commands/user/batch-state.ts new file mode 100644 index 0000000..d1ef886 --- /dev/null +++ b/src/commands/user/batch-state.ts @@ -0,0 +1,16 @@ +/** + * commands/user/batch-state.ts — 占位, Task 6 实现 + */ +import { Command } from 'commander' +import { log } from '../../core/log.ts' +import { installAiHelpHook } from '../../core/help.ts' + +export function buildUserBatchStateCommand(): Command { + const cmd = new Command('batch-state').description('TODO: implement in Task 6') + cmd.action(async () => { + log.warn('TODO: implement in Task 6') + process.exit(1) + }) + installAiHelpHook(cmd, { purpose: 'TODO' }) + return cmd +} \ No newline at end of file diff --git a/src/commands/user/changepwd.ts b/src/commands/user/changepwd.ts new file mode 100644 index 0000000..6cb269b --- /dev/null +++ b/src/commands/user/changepwd.ts @@ -0,0 +1,16 @@ +/** + * commands/user/changepwd.ts — 占位, Task 14 实现 + */ +import { Command } from 'commander' +import { log } from '../../core/log.ts' +import { installAiHelpHook } from '../../core/help.ts' + +export function buildUserChangepwdCommand(): Command { + const cmd = new Command('changepwd').description('TODO: implement in Task 14') + cmd.action(async () => { + log.warn('TODO: implement in Task 14') + process.exit(1) + }) + installAiHelpHook(cmd, { purpose: 'TODO' }) + return cmd +} \ No newline at end of file diff --git a/src/commands/user/delete.ts b/src/commands/user/delete.ts index 2e37088..0a86149 100644 --- a/src/commands/user/delete.ts +++ b/src/commands/user/delete.ts @@ -21,7 +21,7 @@ export function buildUserDeleteCommand(): Command { .action(async (opts: DeleteOpts) => { if (!opts.yes) { log.warn(`即将删除用户 id=${opts.id}, 加 --yes 跳过确认`) - process.exit(2) + process.exit(1) } const c = await JnpfClient.fromToken() const r = await c.del(`/permission/Users/${opts.id}`) diff --git a/src/commands/user/get-position.ts b/src/commands/user/get-position.ts new file mode 100644 index 0000000..d29cac5 --- /dev/null +++ b/src/commands/user/get-position.ts @@ -0,0 +1,16 @@ +/** + * commands/user/get-position.ts — 占位, Task 8 实现 + */ +import { Command } from 'commander' +import { log } from '../../core/log.ts' +import { installAiHelpHook } from '../../core/help.ts' + +export function buildUserGetPositionCommand(): Command { + const cmd = new Command('get-position').description('TODO: implement in Task 8') + cmd.action(async () => { + log.warn('TODO: implement in Task 8') + process.exit(1) + }) + installAiHelpHook(cmd, { purpose: 'TODO' }) + return cmd +} \ No newline at end of file diff --git a/src/commands/user/index.ts b/src/commands/user/index.ts index c1fa075..2b18ccc 100644 --- a/src/commands/user/index.ts +++ b/src/commands/user/index.ts @@ -5,23 +5,59 @@ * * 决策 7: 用户是 P1 权限三角 2 号 (必须绑组织) * - * 子命令: - * list 列表 - * create 新建 - * delete 删除 - * resetpwd 重置密码 + * 子命令 (v18): + * 基础: list / create / update / delete / resetpwd / unlock + * 批量: batch-state / batch-delete / batch-set-position + * 岗位: get-position / set-position + * 高级: workHandover / socials-unbind / online-kick + * self: changepwd / baseinfo + * auth: auth-groups / auth-list */ import { Command } from 'commander' import { buildUserListCommand } from './list.ts' import { buildUserCreateCommand } from './create.ts' +import { buildUserUpdateCommand } from './update.ts' import { buildUserDeleteCommand } from './delete.ts' import { buildUserResetPwdCommand } from './resetpwd.ts' +import { buildUserUnlockCommand } from './unlock.ts' +import { buildUserBatchStateCommand } from './batch-state.ts' +import { buildUserBatchDeleteCommand } from './batch-delete.ts' +import { buildUserGetPositionCommand } from './get-position.ts' +import { buildUserSetPositionCommand } from './set-position.ts' +import { buildUserBatchSetPositionCommand } from './batch-set-position.ts' +import { buildUserWorkHandoverCommand } from './workHandover.ts' +import { buildUserSocialsUnbindCommand } from './socials-unbind.ts' +import { buildUserOnlineKickCommand } from './online-kick.ts' +import { buildUserChangepwdCommand } from './changepwd.ts' +import { buildUserBaseinfoCommand } from './baseinfo.ts' +import { buildUserAuthGroupsCommand } from './auth-groups.ts' +import { buildUserAuthListCommand } from './auth-list.ts' export function buildUserCommand(): Command { const cmd = new Command('user').description('用户 (P1 权限三角 2 号, 登录主体)') + // 基础 cmd.addCommand(buildUserListCommand()) cmd.addCommand(buildUserCreateCommand()) + cmd.addCommand(buildUserUpdateCommand()) cmd.addCommand(buildUserDeleteCommand()) cmd.addCommand(buildUserResetPwdCommand()) + cmd.addCommand(buildUserUnlockCommand()) + // 批量 + cmd.addCommand(buildUserBatchStateCommand()) + cmd.addCommand(buildUserBatchDeleteCommand()) + cmd.addCommand(buildUserBatchSetPositionCommand()) + // 岗位 + cmd.addCommand(buildUserGetPositionCommand()) + cmd.addCommand(buildUserSetPositionCommand()) + // 高级 + cmd.addCommand(buildUserWorkHandoverCommand()) + cmd.addCommand(buildUserSocialsUnbindCommand()) + cmd.addCommand(buildUserOnlineKickCommand()) + // self + cmd.addCommand(buildUserChangepwdCommand()) + cmd.addCommand(buildUserBaseinfoCommand()) + // auth + cmd.addCommand(buildUserAuthGroupsCommand()) + cmd.addCommand(buildUserAuthListCommand()) return cmd -} +} \ No newline at end of file diff --git a/src/commands/user/online-kick.ts b/src/commands/user/online-kick.ts new file mode 100644 index 0000000..758c2c2 --- /dev/null +++ b/src/commands/user/online-kick.ts @@ -0,0 +1,16 @@ +/** + * commands/user/online-kick.ts — 占位, Task 13 实现 + */ +import { Command } from 'commander' +import { log } from '../../core/log.ts' +import { installAiHelpHook } from '../../core/help.ts' + +export function buildUserOnlineKickCommand(): Command { + const cmd = new Command('online-kick').description('TODO: implement in Task 13') + cmd.action(async () => { + log.warn('TODO: implement in Task 13') + process.exit(1) + }) + installAiHelpHook(cmd, { purpose: 'TODO' }) + return cmd +} \ No newline at end of file diff --git a/src/commands/user/set-position.ts b/src/commands/user/set-position.ts new file mode 100644 index 0000000..a19e936 --- /dev/null +++ b/src/commands/user/set-position.ts @@ -0,0 +1,16 @@ +/** + * commands/user/set-position.ts — 占位, Task 9 实现 + */ +import { Command } from 'commander' +import { log } from '../../core/log.ts' +import { installAiHelpHook } from '../../core/help.ts' + +export function buildUserSetPositionCommand(): Command { + const cmd = new Command('set-position').description('TODO: implement in Task 9') + cmd.action(async () => { + log.warn('TODO: implement in Task 9') + process.exit(1) + }) + installAiHelpHook(cmd, { purpose: 'TODO' }) + return cmd +} \ No newline at end of file diff --git a/src/commands/user/socials-unbind.ts b/src/commands/user/socials-unbind.ts new file mode 100644 index 0000000..1a57d6c --- /dev/null +++ b/src/commands/user/socials-unbind.ts @@ -0,0 +1,16 @@ +/** + * commands/user/socials-unbind.ts — 占位, Task 12 实现 + */ +import { Command } from 'commander' +import { log } from '../../core/log.ts' +import { installAiHelpHook } from '../../core/help.ts' + +export function buildUserSocialsUnbindCommand(): Command { + const cmd = new Command('socials-unbind').description('TODO: implement in Task 12') + cmd.action(async () => { + log.warn('TODO: implement in Task 12') + process.exit(1) + }) + installAiHelpHook(cmd, { purpose: 'TODO' }) + return cmd +} \ No newline at end of file diff --git a/src/commands/user/unlock.ts b/src/commands/user/unlock.ts new file mode 100644 index 0000000..b0c95bf --- /dev/null +++ b/src/commands/user/unlock.ts @@ -0,0 +1,16 @@ +/** + * commands/user/unlock.ts — 占位, Task 5 实现 + */ +import { Command } from 'commander' +import { log } from '../../core/log.ts' +import { installAiHelpHook } from '../../core/help.ts' + +export function buildUserUnlockCommand(): Command { + const cmd = new Command('unlock').description('TODO: implement in Task 5') + cmd.action(async () => { + log.warn('TODO: implement in Task 5') + process.exit(1) + }) + installAiHelpHook(cmd, { purpose: 'TODO' }) + return cmd +} \ No newline at end of file diff --git a/src/commands/user/update.ts b/src/commands/user/update.ts new file mode 100644 index 0000000..1c01de8 --- /dev/null +++ b/src/commands/user/update.ts @@ -0,0 +1,16 @@ +/** + * commands/user/update.ts — 占位, Task 4 实现 + */ +import { Command } from 'commander' +import { log } from '../../core/log.ts' +import { installAiHelpHook } from '../../core/help.ts' + +export function buildUserUpdateCommand(): Command { + const cmd = new Command('update').description('TODO: implement in Task 4') + cmd.action(async () => { + log.warn('TODO: implement in Task 4') + process.exit(1) + }) + installAiHelpHook(cmd, { purpose: 'TODO' }) + return cmd +} \ No newline at end of file diff --git a/src/commands/user/workHandover.ts b/src/commands/user/workHandover.ts new file mode 100644 index 0000000..35e5f12 --- /dev/null +++ b/src/commands/user/workHandover.ts @@ -0,0 +1,16 @@ +/** + * commands/user/workHandover.ts — 占位, Task 11 实现 + */ +import { Command } from 'commander' +import { log } from '../../core/log.ts' +import { installAiHelpHook } from '../../core/help.ts' + +export function buildUserWorkHandoverCommand(): Command { + const cmd = new Command('workHandover').description('TODO: implement in Task 11') + cmd.action(async () => { + log.warn('TODO: implement in Task 11') + process.exit(1) + }) + installAiHelpHook(cmd, { purpose: 'TODO' }) + return cmd +} \ No newline at end of file