wjx-cli 0.1.9 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +887 -889
  2. package/bundled/wjx-cli-expert.md +102 -0
  3. package/bundled/wjx-cli-use/SKILL.md +111 -0
  4. package/bundled/wjx-cli-use/references/analytics-commands.md +159 -0
  5. package/bundled/wjx-cli-use/references/contacts-commands.md +330 -0
  6. package/bundled/wjx-cli-use/references/dsl-syntax.md +160 -0
  7. package/bundled/wjx-cli-use/references/question-types.md +102 -0
  8. package/bundled/wjx-cli-use/references/response-commands.md +164 -0
  9. package/bundled/wjx-cli-use/references/survey-commands.md +194 -0
  10. package/dist/commands/init.js +10 -0
  11. package/dist/commands/init.js.map +1 -1
  12. package/dist/commands/reference.js +358 -334
  13. package/dist/commands/reference.js.map +1 -1
  14. package/dist/commands/response.js +13 -19
  15. package/dist/commands/response.js.map +1 -1
  16. package/dist/commands/skill.d.ts +2 -0
  17. package/dist/commands/skill.js +46 -0
  18. package/dist/commands/skill.js.map +1 -0
  19. package/dist/commands/survey.js +13 -5
  20. package/dist/commands/survey.js.map +1 -1
  21. package/dist/commands/update.d.ts +2 -0
  22. package/dist/commands/update.js +76 -0
  23. package/dist/commands/update.js.map +1 -0
  24. package/dist/commands/user-system.js +4 -27
  25. package/dist/commands/user-system.js.map +1 -1
  26. package/dist/index.js +4 -0
  27. package/dist/index.js.map +1 -1
  28. package/dist/lib/command-helpers.d.ts +2 -0
  29. package/dist/lib/command-helpers.js +2 -1
  30. package/dist/lib/command-helpers.js.map +1 -1
  31. package/dist/lib/install-skill.d.ts +23 -0
  32. package/dist/lib/install-skill.js +96 -0
  33. package/dist/lib/install-skill.js.map +1 -0
  34. package/package.json +3 -2
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: wjx-cli-expert
3
+ description: 问卷星 CLI 专家子Agent,通过 wjx 命令行工具完成问卷创建、数据回收、分析等全部操作
4
+ model: sonnet
5
+ tools:
6
+ - Bash
7
+ - Read
8
+ - Write
9
+ - Edit
10
+ - Glob
11
+ - Grep
12
+ ---
13
+
14
+ # 问卷星 CLI 专家 Agent
15
+
16
+ 你是问卷星(Wenjuanxing)平台操作专家。你通过 `wjx` 命令行工具完成所有问卷星相关任务。
17
+
18
+ ## 可用技能
19
+
20
+ 你有一个配套的 CLI 使用指南技能,位于 `wjx-skills/wjx-cli-use/`:
21
+
22
+ - **`wjx-skills/wjx-cli-use/SKILL.md`** — ���令总览、核心工作流、常用枚举值
23
+ - **`wjx-skills/wjx-cli-use/references/`** — 按需查阅的详细参考:
24
+ - `dsl-syntax.md` — DSL 文本语法(create-by-text 用)
25
+ - `survey-commands.md` — survey 模块全部参数
26
+ - `response-commands.md` — response 模块全部参数
27
+ - `contacts-commands.md` — contacts/department/admin/tag/account/sso 参数
28
+ - `analytics-commands.md` — analytics 本地分析命令
29
+ - `question-types.md` — q_type/q_subtype 完整映射表
30
+
31
+ **工作方式:先读 SKILL.md 获取全局视图,遇到具体参数问题时再读对应的 references 文件。**
32
+
33
+ ## 你的职责
34
+
35
+ 1. **问卷设计与创建** — 根据用户需求设计问卷,优先使用 `wjx survey create-by-text`
36
+ 2. **数据回收与查询** — 查询答卷、下载报告、监控回收进度
37
+ 3. **数据分析** — NPS/CSAT 计算、异常检测、趋势对比
38
+ 4. **通讯录管理** — 联系人/部门/标签的增删改查
39
+ 5. **账号与权限** — 子账号管理、SSO 链接生成
40
+
41
+ ## 环境检查
42
+
43
+ 在执行任务前,先确认 CLI 已配置:
44
+
45
+ ```bash
46
+ wjx doctor
47
+ ```
48
+
49
+ 未配置则引导用户运行 `wjx init` 或设置 `WJX_API_KEY` 环境变量。
50
+
51
+ ## 工作原则
52
+
53
+ ### 创建问卷
54
+
55
+ 1. 优先用 `wjx survey create-by-text --text "..."` — 需要 DSL 语法时读 `references/dsl-syntax.md`
56
+ 2. 创建前用 `--dry-run` 预览解析结果
57
+ 3. 创建后用 `wjx survey get --vid N` 验证
58
+ 4. 向用户提供编辑链接:`wjx survey url --mode edit --activity N`
59
+ 5. 向用户提供预览链接:通过 SDK 的 `buildPreviewUrl` 或告知用户在编辑页面预览
60
+
61
+ ### 考试问卷注意事项
62
+
63
+ - 创建考试问卷时 `--type 6`,考试中的单选/多选/填空自动变为考试题型
64
+ - **API 限制**:考试的正确答案和每题分值无法通过 API 设置,创建后必须提供 `wjx survey url --mode edit --activity N` 编辑链接,指引用户在网页端手动配置答案与评分
65
+ - 创建考试后使用 `wjx survey update-settings --vid N --time_setting '...'` 设置考试时间限制
66
+
67
+ ### 查询数据
68
+
69
+ 1. `wjx response report --vid N` — 统计概览(首选)
70
+ 2. `wjx response query --vid N` — 明细数据
71
+ 3. `wjx response download --vid N` — 批量导出
72
+
73
+ ### 分析数据
74
+
75
+ 获取数据 → `analytics decode` 解码 → 选择分析方法(nps/csat/anomalies)→ 给出结论
76
+
77
+ ### 参数不确定时
78
+
79
+ 用 CLI 内置参考:`wjx reference dsl`、`wjx reference question-types` 等,或读取对应的 references 文件。
80
+
81
+ ### 安全原则
82
+
83
+ - **破坏性操作执行前必须确认**:`survey delete`、`response clear`、`survey clear-bin`
84
+ - 批量操作先告知影响范围
85
+ - 首次操作用 `--dry-run` 预览
86
+
87
+ ### 输出规范
88
+
89
+ - JSON 输出到 stdout,错误输出到 stderr
90
+ - 退出码:0=成功,1=API/认证错误,2=输入错误
91
+ - 向用户报告时提供关键信息(vid、URL、数量等)
92
+
93
+ ## 常见错误与处理
94
+
95
+ | 错误信息 | 原因 | 处理方式 |
96
+ |---------|------|---------|
97
+ | "该问卷没有题目" | 尝试发布空问卷 | 先添加题目再发布 |
98
+ | "状态不能直接更新到X" | 违反状态转换规则 | 遵循合法路径:0→1→2↔1, 1/2→3。不可跳过中间状态 |
99
+ | "username参数有误" | 用户名不匹配 | 从 `wjx survey list` 返回的 `creater` 字段获取正确用户名 |
100
+ | 下载/报告请求超时 | 大数据量生成耗时 | 耗时操作已使用120s超时,可重试一次 |
101
+ | `wjx contacts query` 返回空 | uid 不精确 | uid 必须完全匹配,不支持模糊搜索或通配符 |
102
+ | 多项填空创建失败 | 缺少填空占位符 | 题目文本中必须包含 `{_}` 占位符 |
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: wjx-cli-use
3
+ description: Guide for using wjx-cli (Wenjuanxing CLI) to create surveys, query responses, and analyze data. Use when the user wants to interact with the Wenjuanxing (问卷星) platform via CLI commands, including creating surveys with specific question types, querying response data, managing contacts, or performing analytics. Covers all 58 subcommands across 15 modules.
4
+ ---
5
+
6
+ # wjx-cli 使用指南
7
+
8
+ wjx-cli 是问卷星 OpenAPI 的命令行工具。所有命令格式:`wjx <模块> <操作> [选项]`。
9
+
10
+ ## 安装与配置
11
+
12
+ ```bash
13
+ npm install -g wjx-cli
14
+ wjx init # 交互式配置:API Key、Base URL、Corp ID → ~/.wjxrc
15
+ wjx doctor # 检查连接状态
16
+ ```
17
+
18
+ ## 全局选项
19
+
20
+ | 选项 | 说明 |
21
+ |------|------|
22
+ | `--api-key <key>` | API Key(覆盖环境变量/配置文件) |
23
+ | `--table` | 输出为可读表格(默认 JSON) |
24
+ | `--dry-run` | 预览 API 请求,不实际发送 |
25
+ | `--stdin` | 从 stdin 读取 JSON 参数(可访问 SDK 全部参数) |
26
+
27
+ ## 命令总览(15 模块,58 命令)
28
+
29
+ | 模块 | 命令 | 说明 |
30
+ |------|------|------|
31
+ | `survey` | list, get, create, create-by-text, delete, status, settings, update-settings, tags, tag-details, clear-bin, upload, export-text, url | 问卷增删改查与配置 |
32
+ | `response` | query, realtime, download, submit, modify, clear, report, winners, 360-report, count | 答卷数据操作 |
33
+ | `contacts` | query, add, delete | 联系人管理(需要 WJX_CORP_ID) |
34
+ | `department` | list, add, modify, delete | 部门管理 |
35
+ | `admin` | add, delete, restore | 管理员管理 |
36
+ | `tag` | list, add, modify, delete | 标签管理 |
37
+ | `user-system` | add-participants, modify-participants, delete-participants, bind, query-binding, query-surveys | 用户系统(已过时) |
38
+ | `account` | list, add, modify, delete, restore | 子账号管理 |
39
+ | `sso` | subaccount-url, user-system-url, partner-url | SSO 链接生成 |
40
+ | `analytics` | decode, nps, csat, anomalies, compare, decode-push | 本地分析(无需 API Key) |
41
+ | `init` | (独立命令) | 交互式配置向导 |
42
+ | `doctor` | (独立命令) | 环境诊断 |
43
+ | `completion` | bash, zsh, fish, install | Shell 自动补全 |
44
+ | `skill` | install, update | 管理 Claude Code 技能(安装/更新 wjx-cli-use) |
45
+ | `update` | (独立命令) | 自更新 wjx-cli 到最新版本 |
46
+
47
+ ## 核心工作流
48
+
49
+ ### 1. 创建问卷(推荐:DSL 文本格式)
50
+
51
+ ```bash
52
+ # AI Agent 推荐使用 DSL 文本格式
53
+ wjx survey create-by-text --text "问卷标题
54
+
55
+ 可选描述
56
+
57
+ 1. 题目文本[单选题]
58
+ 选项A
59
+ 选项B
60
+
61
+ 2. 另一个题目[填空题]"
62
+ ```
63
+
64
+ 考试问卷加 `--type 6`。完整 DSL 语法(含 28 种题型标签)见 [references/dsl-syntax.md](references/dsl-syntax.md)。
65
+
66
+ JSON 创建或复制问卷见 [references/survey-commands.md](references/survey-commands.md)。
67
+
68
+ ### 2. 查询与分析答卷
69
+
70
+ ```bash
71
+ wjx response report --vid 12345 # 统计报告(建议第一步)
72
+ wjx response query --vid 12345 # 答卷明细数据
73
+ wjx response download --vid 12345 # 批量导出(CSV/SAV/Word)
74
+ wjx response count --vid 12345 # 答卷总数
75
+
76
+ # 本地分析(无需 API)
77
+ wjx analytics nps --scores "[9,10,7,3,8]"
78
+ wjx analytics csat --scores "[4,5,3,5,2]"
79
+ wjx analytics decode --submitdata "1\$1}2\$3|4"
80
+ ```
81
+
82
+ 完整答卷查询参数(筛选、分页、条件)见 [references/response-commands.md](references/response-commands.md)。
83
+
84
+ ### 3. 管理通讯录与账号
85
+
86
+ ```bash
87
+ wjx contacts add --users '[{"userid":"u1","name":"Alice","mobile":"13800000001"}]'
88
+ wjx department add --depts '["研发部/后端"]'
89
+ wjx admin add --users '[{"userid":"u1","role":2}]'
90
+ wjx account add --subuser user1 --password pass123 --role 1
91
+ ```
92
+
93
+ 角色编号:1=系统管理员, 2=问卷管理员, 3=统计查看, 4=完整查看。所有参数见 [references/contacts-commands.md](references/contacts-commands.md)。
94
+
95
+ ## 常用枚举值
96
+
97
+ | 参数 | 值 |
98
+ |------|-----|
99
+ | 问卷类型 (`--type`) | 1=调查, 2=测评, 3=投票, 6=考试, 7=表单 |
100
+ | 问卷状态 (`--state`) | 1=发布, 2=暂停, 3=删除 |
101
+ | 下载格式 (`--suffix`) | 0=CSV, 1=SAV, 2=Word |
102
+ | 排序方式 (`--sort`) | 0=升序, 1=降序 |
103
+
104
+ ## 参考文件(按需读取)
105
+
106
+ - [DSL 语法](references/dsl-syntax.md) — create-by-text 的完整 DSL 格式,28 种题型标签
107
+ - [问卷命令](references/survey-commands.md) — survey 模块全部子命令参数、JSON 创建格式、设置
108
+ - [答卷命令](references/response-commands.md) — 查询筛选、submitdata 格式、下载选项
109
+ - [通讯录命令](references/contacts-commands.md) — 联系人、部门、管理员、标签、子账号、SSO
110
+ - [分析命令](references/analytics-commands.md) — NPS/CSAT/CES 公式、异常检测、数据解码
111
+ - [题型编码](references/question-types.md) — 完整 q_type/q_subtype 映射表
@@ -0,0 +1,159 @@
1
+ # Analytics Commands Reference
2
+
3
+ > 所有分析命令**本地运行**,无需 API Key 或网络连接。
4
+ > 所有命令支持 `--stdin` 传入 JSON 参数。
5
+
6
+ ## wjx analytics decode
7
+
8
+ 解码答卷提交数据(submitdata 格式)。
9
+
10
+ ```bash
11
+ wjx analytics decode --submitdata "1\$1}2\$3|4}3\$hello"
12
+ ```
13
+
14
+ | Flag | 必填 | 说明 |
15
+ |------|------|------|
16
+ | `--submitdata <s>` | 是 | 提交数据字符串 |
17
+
18
+ ### submitdata 编码格式
19
+
20
+ | 分隔符 | 含义 |
21
+ |--------|------|
22
+ | `}` | 题目之间分隔 |
23
+ | `$` | 题号与答案分隔 |
24
+ | `\|` | 多选选项之间分隔 |
25
+
26
+ 示例:`1$1}2$3|4}3$hello` → 第1题选1,第2题选3和4,第3题填"hello"
27
+
28
+ ## wjx analytics nps
29
+
30
+ 计算 Net Promoter Score(净推荐值)。
31
+
32
+ ```bash
33
+ wjx analytics nps --scores "[9,10,7,3,8,10,9,6,8,10]"
34
+ ```
35
+
36
+ | Flag | 必填 | 说明 |
37
+ |------|------|------|
38
+ | `--scores <json>` | 是 | 评分 JSON 数组(0-10 分) |
39
+
40
+ **NPS = 推荐者% - 贬损者%**(范围 -100 ~ +100)
41
+
42
+ | 类别 | 分数范围 |
43
+ |------|---------|
44
+ | 推荐者 (Promoters) | 9-10 |
45
+ | 被动者 (Passives) | 7-8 |
46
+ | 贬损者 (Detractors) | 0-6 |
47
+
48
+ | 评级 | NPS 范围 |
49
+ |------|---------|
50
+ | 优秀 | > 70 |
51
+ | 良好 | 50-70 |
52
+ | 一般 | 0-50 |
53
+ | 较差 | < 0 |
54
+
55
+ ## wjx analytics csat
56
+
57
+ 计算 Customer Satisfaction Score(客户满意度)。
58
+
59
+ ```bash
60
+ wjx analytics csat --scores "[4,5,3,5,2,4,5]"
61
+ wjx analytics csat --scores "[6,7,5,7,3,6,7]" --scale "7-point"
62
+ ```
63
+
64
+ | Flag | 必填 | 说明 |
65
+ |------|------|------|
66
+ | `--scores <json>` | 是 | 评分 JSON 数组 |
67
+ | `--scale <s>` | 否 | 量表类型:`"5-point"`(默认)或 `"7-point"` |
68
+
69
+ **CSAT = 满意人数 / 总人数 × 100%**
70
+
71
+ | 量表 | 满意阈值 |
72
+ |------|---------|
73
+ | 5-point | 4-5 分 |
74
+ | 7-point | 5-7 分 |
75
+
76
+ | 评级 | CSAT 范围 |
77
+ |------|----------|
78
+ | 优秀 | > 90% |
79
+ | 良好 | 75-90% |
80
+ | 一般 | 50-75% |
81
+ | 较差 | < 50% |
82
+
83
+ ## wjx analytics anomalies
84
+
85
+ 检测异常答卷模式。
86
+
87
+ ```bash
88
+ wjx analytics anomalies --responses '[{"submitdata":"1$1}2$1","inputcosttime":5},{"submitdata":"1$2}2$3","inputcosttime":120}]'
89
+ ```
90
+
91
+ | Flag | 必填 | 说明 |
92
+ |------|------|------|
93
+ | `--responses <json>` | 是 | 答卷数据 JSON 数组 |
94
+
95
+ 检测 6 种异常模式:
96
+ 1. **直线作答** — 所有题目选同一个答案
97
+ 2. **速度异常** — 完成时间 < 中位数的 30%
98
+ 3. **IP 重复** — 同一 IP 多次提交
99
+ 4. **时间聚集** — 短时间内大量提交
100
+ 5. **答案雷同** — 多份答卷内容近乎相同
101
+ 6. **矩阵直线** — 矩阵题每行选同一值
102
+
103
+ ## wjx analytics compare
104
+
105
+ 对比两组指标数据。
106
+
107
+ ```bash
108
+ wjx analytics compare --set_a '{"nps":45,"csat":78}' --set_b '{"nps":52,"csat":85}'
109
+ ```
110
+
111
+ | Flag | 必填 | 说明 |
112
+ |------|------|------|
113
+ | `--set_a <json>` | 是 | 指标集 A JSON 对象(`{"指标名":数值}`) |
114
+ | `--set_b <json>` | 是 | 指标集 B JSON 对象(`{"指标名":数值}`) |
115
+
116
+ 显著性阈值:|变化率| > 10% 视为显著变化。
117
+
118
+ ## wjx analytics decode-push
119
+
120
+ 解码问卷星 Webhook 推送回调数据。
121
+
122
+ ```bash
123
+ wjx analytics decode-push --payload '<加密数据>' --app_key '<AppKey>'
124
+ wjx analytics decode-push --payload '<加密数据>' --app_key '<AppKey>' --signature '<签名>' --raw_body '<原始请求体>'
125
+ ```
126
+
127
+ | Flag | 必填 | 说明 |
128
+ |------|------|------|
129
+ | `--payload <s>` | 是 | 加密数据 |
130
+ | `--app_key <s>` | 是 | AppKey |
131
+ | `--signature <s>` | 否 | X-Wjx-Signature 签名(用于验证) |
132
+ | `--raw_body <s>` | 否 | 原始请求体(用于签名验证) |
133
+
134
+ ### Webhook 推送字段
135
+
136
+ | 字段 | 说明 |
137
+ |------|------|
138
+ | vid | 问卷编号 |
139
+ | jid | 答卷编号 |
140
+ | submitdata | 编码的答卷数据 |
141
+ | submittime | 提交时间 |
142
+ | source | 来源(1=PC, 2=手机, 3=微信) |
143
+ | ip | 客户端 IP |
144
+
145
+ ### 加密方式
146
+
147
+ Webhook 数据使用 AES-128-CBC 加密:
148
+ - Key = MD5(appKey) 前 16 字符
149
+ - Padding: PKCS7
150
+ - IV = 密文前 16 字节
151
+ - 签名验证:通过 X-Wjx-Signature 头进行 SHA1 验证
152
+
153
+ ---
154
+
155
+ ## CES 参考(Customer Effort Score,客户费力度)
156
+
157
+ 非 CLI 命令,但分析时常用的参考指标:
158
+ - 量表:1-7(越低越好,表示客户越省力)
159
+ - 优秀:< 2,良好:2-3,一般:3-5,较差:> 5
@@ -0,0 +1,330 @@
1
+ # Contacts, Departments, Admins, Tags, Accounts & SSO
2
+
3
+ > 通讯录相关操作需要 `WJX_CORP_ID`(通过 `wjx init` 配置或环境变量)。
4
+ > 所有通讯录命令支持 `--corpid <s>` 覆盖默认值。
5
+
6
+ ## Contacts 模块
7
+
8
+ ### wjx contacts query
9
+
10
+ ```bash
11
+ wjx contacts query --uid user001
12
+ wjx contacts query --uid user001 --corpid CORP123
13
+ ```
14
+
15
+ | Flag | 必填 | 说明 |
16
+ |------|------|------|
17
+ | `--uid <s>` | 是 | 用户编号(唯一标识) |
18
+ | `--corpid <s>` | 否 | 通讯录编号 |
19
+
20
+ ### wjx contacts add
21
+
22
+ 批量添加或更新联系人(最多 100 人)。userid 已存在则更新。
23
+
24
+ ```bash
25
+ wjx contacts add --users '[{"userid":"u1","name":"Alice","mobile":"13800000001","email":"a@b.com","department":"研发部/后端","tags":"学历/本科"}]'
26
+ wjx contacts add --users '[...]' --auto_create_udept --auto_create_tag
27
+ ```
28
+
29
+ | Flag | 必填 | 说明 |
30
+ |------|------|------|
31
+ | `--users <json>` | 是 | 用户列表 JSON 数组 |
32
+ | `--corpid <s>` | 否 | 通讯录编号 |
33
+ | `--auto_create_udept` | 否 | 自动创建不存在的部门 |
34
+ | `--auto_create_tag` | 否 | 自动创建不存在的标签 |
35
+
36
+ **users 数组每项字段**:`userid`(必填), `name`(必填), `nickname`, `mobile`, `email`, `department`(用/分隔层级), `tags`(格式:组/标签), `birthday`, `gender`(0=保密/1=男/2=女), `pwd`
37
+
38
+ ### wjx contacts delete
39
+
40
+ 批量删除联系人(**不可逆**)。
41
+
42
+ ```bash
43
+ wjx contacts delete --uids "user001,user002"
44
+ ```
45
+
46
+ | Flag | 必填 | 说明 |
47
+ |------|------|------|
48
+ | `--uids <s>` | 是 | 用户编号列表,逗号分隔 |
49
+ | `--corpid <s>` | 否 | 通讯录编号 |
50
+
51
+ ---
52
+
53
+ ## Department 模块
54
+
55
+ ### wjx department list
56
+
57
+ ```bash
58
+ wjx department list
59
+ wjx department list --corpid CORP123
60
+ ```
61
+
62
+ ### wjx department add
63
+
64
+ ```bash
65
+ wjx department add --depts '["研发部/后端", "产品部"]'
66
+ ```
67
+
68
+ | Flag | 必填 | 说明 |
69
+ |------|------|------|
70
+ | `--depts <json>` | 是 | 部门路径 JSON 数组,用 / 分隔层级 |
71
+ | `--corpid <s>` | 否 | 通讯录编号 |
72
+
73
+ ### wjx department modify
74
+
75
+ ```bash
76
+ wjx department modify --depts '[{"id":"dept123","name":"新名称","order":10}]'
77
+ ```
78
+
79
+ | Flag | 必填 | 说明 |
80
+ |------|------|------|
81
+ | `--depts <json>` | 是 | 部门对象 JSON 数组,每项含 id(必填), name, order(>0 且 <999999) |
82
+ | `--corpid <s>` | 否 | 通讯录编号 |
83
+
84
+ ### wjx department delete
85
+
86
+ ```bash
87
+ wjx department delete --type 1 --depts '["dept123"]'
88
+ wjx department delete --type 2 --depts '["研发部"]' --del_child
89
+ ```
90
+
91
+ | Flag | 必填 | 说明 |
92
+ |------|------|------|
93
+ | `--type <s>` | 是 | "1"=按 ID 删除, "2"=按名称删除 |
94
+ | `--depts <json>` | 是 | 部门标识 JSON 数组(ID 或名称) |
95
+ | `--corpid <s>` | 否 | 通讯录编号 |
96
+ | `--del_child` | 否 | 同时删除子部门 |
97
+
98
+ ---
99
+
100
+ ## Admin 模块
101
+
102
+ ### wjx admin add
103
+
104
+ 批量添加或修改管理员(最多 100 人)。
105
+
106
+ ```bash
107
+ wjx admin add --users '[{"userid":"u1","role":2}]'
108
+ wjx admin add --users '[{"userid":"u1","role":0,"confidential":true,"effective_date":"2026-12-31","remark":"临时管理员"}]'
109
+ ```
110
+
111
+ | Flag | 必填 | 说明 |
112
+ |------|------|------|
113
+ | `--users <json>` | 是 | 管理员 JSON 数组 |
114
+ | `--corpid <s>` | 否 | 通讯录编号 |
115
+
116
+ **users 数组每项字段**:`userid`(必填), `role`(必填: 0=系统管理员, 1=分组管理员, 2=问卷管理员, 3=统计查看, 4=完整查看, 5=部门管理员), `confidential`(是否保密), `effective_date`(有效期 yyyy-MM-dd), `remark`(备注, 最多 50 字)
117
+
118
+ ### wjx admin delete
119
+
120
+ ```bash
121
+ wjx admin delete --uids "u1,u2"
122
+ ```
123
+
124
+ | Flag | 必填 | 说明 |
125
+ |------|------|------|
126
+ | `--uids <s>` | 是 | 管理员用户编号,逗号分隔(最多 100) |
127
+ | `--corpid <s>` | 否 | 通讯录编号 |
128
+
129
+ ### wjx admin restore
130
+
131
+ ```bash
132
+ wjx admin restore --uids "u1,u2"
133
+ ```
134
+
135
+ | Flag | 必填 | 说明 |
136
+ |------|------|------|
137
+ | `--uids <s>` | 是 | 管理员用户编号,逗号分隔(最多 100) |
138
+ | `--corpid <s>` | 否 | 通讯录编号 |
139
+
140
+ ---
141
+
142
+ ## Tag 模块
143
+
144
+ ### wjx tag list
145
+
146
+ ```bash
147
+ wjx tag list
148
+ ```
149
+
150
+ ### wjx tag add
151
+
152
+ ```bash
153
+ wjx tag add --child_names '["学历/本科", "学历/硕士", "年龄/18-35"]'
154
+ wjx tag add --child_names '["职级/初级", "职级/高级"]' --is_radio # 单选标签组
155
+ ```
156
+
157
+ | Flag | 必填 | 说明 |
158
+ |------|------|------|
159
+ | `--child_names <json>` | 是 | 标签路径 JSON 数组,格式 "组/标签名" |
160
+ | `--corpid <s>` | 否 | 通讯录编号 |
161
+ | `--is_radio` | 否 | 标签组为单选(默认多选) |
162
+
163
+ ### wjx tag modify
164
+
165
+ ```bash
166
+ wjx tag modify --tp_id "tag123" --tp_name "新组名"
167
+ wjx tag modify --tp_id "tag123" --child_names '[{"id":"child1","name":"新标签名"}]'
168
+ ```
169
+
170
+ | Flag | 必填 | 说明 |
171
+ |------|------|------|
172
+ | `--tp_id <s>` | 是 | 标签组 ID(从 tag list 获取) |
173
+ | `--tp_name <s>` | 否 | 新标签组名称 |
174
+ | `--child_names <json>` | 否 | 子标签 JSON 数组,每项含 id 和 name |
175
+ | `--corpid <s>` | 否 | 通讯录编号 |
176
+
177
+ ### wjx tag delete
178
+
179
+ ```bash
180
+ wjx tag delete --type 1 --tags '["tag123"]'
181
+ wjx tag delete --type 2 --tags '["学历"]'
182
+ ```
183
+
184
+ | Flag | 必填 | 说明 |
185
+ |------|------|------|
186
+ | `--type <s>` | 是 | "1"=按 ID, "2"=按名称 |
187
+ | `--tags <json>` | 是 | 标签标识 JSON 数组 |
188
+ | `--corpid <s>` | 否 | 通讯录编号 |
189
+
190
+ ---
191
+
192
+ ## Account 模块(子账号管理)
193
+
194
+ ### wjx account list
195
+
196
+ ```bash
197
+ wjx account list
198
+ wjx account list --role 2 --name_like "张"
199
+ ```
200
+
201
+ | Flag | 说明 |
202
+ |------|------|
203
+ | `--subuser <s>` | 精确匹配用户名 |
204
+ | `--name_like <s>` | 名称模糊搜索(最多 10 字符) |
205
+ | `--role <n>` | 按角色筛选 |
206
+ | `--group <n>` | 按分组筛选 |
207
+ | `--page_index <n>` | 页码 |
208
+ | `--page_size <n>` | 每页数量 |
209
+ | `--mobile <s>` | 按手机号筛选 |
210
+
211
+ ### wjx account add
212
+
213
+ ```bash
214
+ wjx account add --subuser user1 --password pass123 --role 1
215
+ ```
216
+
217
+ | Flag | 必填 | 说明 |
218
+ |------|------|------|
219
+ | `--subuser <s>` | 是 | 子账号用户名 |
220
+ | `--password <s>` | 否 | 密码 |
221
+ | `--mobile <s>` | 否 | 手机号 |
222
+ | `--email <s>` | 否 | 邮箱 |
223
+ | `--role <n>` | 否 | 1=系统管理员, 2=问卷管理员, 3=统计查看, 4=完整查看 |
224
+ | `--group <n>` | 否 | 分组 ID |
225
+
226
+ ### wjx account modify
227
+
228
+ ```bash
229
+ wjx account modify --subuser user1 --role 2
230
+ ```
231
+
232
+ | Flag | 必填 | 说明 |
233
+ |------|------|------|
234
+ | `--subuser <s>` | 是 | 子账号用户名 |
235
+ | `--mobile <s>` | 否 | 手机号 |
236
+ | `--email <s>` | 否 | 邮箱 |
237
+ | `--role <n>` | 否 | 角色(1-4) |
238
+ | `--group <n>` | 否 | 分组 ID |
239
+
240
+ 注意:不支持修改密码。
241
+
242
+ ### wjx account delete
243
+
244
+ ```bash
245
+ wjx account delete --subuser user1
246
+ ```
247
+
248
+ ### wjx account restore
249
+
250
+ ```bash
251
+ wjx account restore --subuser user1 --mobile 13800000001
252
+ ```
253
+
254
+ | Flag | 必填 | 说明 |
255
+ |------|------|------|
256
+ | `--subuser <s>` | 是 | 子账号用户名 |
257
+ | `--mobile <s>` | 否 | 手机号 |
258
+ | `--email <s>` | 否 | 邮箱 |
259
+
260
+ ---
261
+
262
+ ## SSO 模块(本地 URL 生成,无需 API Key)
263
+
264
+ ### wjx sso subaccount-url
265
+
266
+ 生成子账号免密登录链接。
267
+
268
+ ```bash
269
+ wjx sso subaccount-url --subuser admin1
270
+ wjx sso subaccount-url --subuser admin1 --role_id 2 --url "https://example.com/dashboard"
271
+ ```
272
+
273
+ | Flag | 必填 | 说明 |
274
+ |------|------|------|
275
+ | `--subuser <s>` | 是 | 子账号用户名 |
276
+ | `--mobile <s>` | 否 | 手机号 |
277
+ | `--email <s>` | 否 | 邮箱 |
278
+ | `--role_id <n>` | 否 | 角色 ID(1-4) |
279
+ | `--url <s>` | 否 | 登录后跳转地址 |
280
+ | `--admin <n>` | 否 | 设为 1 以主账号身份登录 |
281
+
282
+ ### wjx sso user-system-url
283
+
284
+ 生成用户系统参与者登录链接。
285
+
286
+ ```bash
287
+ wjx sso user-system-url --u admin --system_id 100 --uid user001
288
+ ```
289
+
290
+ | Flag | 必填 | 说明 |
291
+ |------|------|------|
292
+ | `--u <s>` | 是 | 账户用户名 |
293
+ | `--system_id <n>` | 是 | 用户系统 ID |
294
+ | `--uid <s>` | 是 | 参与者 ID |
295
+ | `--uname <s>` | 否 | 参与者姓名 |
296
+ | `--udept <s>` | 否 | 参与者部门 |
297
+ | `--uextf <s>` | 否 | 扩展字段 |
298
+ | `--upass <s>` | 否 | 密码 |
299
+ | `--is_login <n>` | 否 | 是否登录(0 或 1) |
300
+ | `--activity <n>` | 否 | 跳转到的问卷编号 |
301
+ | `--return_url <s>` | 否 | 返回地址 |
302
+
303
+ ### wjx sso partner-url
304
+
305
+ 生成合作伙伴登录链接。
306
+
307
+ ```bash
308
+ wjx sso partner-url --username partner1
309
+ ```
310
+
311
+ | Flag | 必填 | 说明 |
312
+ |------|------|------|
313
+ | `--username <s>` | 是 | 合作伙伴用户名 |
314
+ | `--mobile <s>` | 否 | 手机号 |
315
+ | `--subuser <s>` | 否 | 子账号用户名 |
316
+
317
+ ---
318
+
319
+ ## User-System 模块(已过时)
320
+
321
+ > 这些命令已标记 Deprecated,优先使用通讯录模块。仅在用户明确要求时使用。
322
+
323
+ ```bash
324
+ wjx user-system add-participants --usid 100 --users '[{"uid":"u1","uname":"Alice","upass":"123"}]'
325
+ wjx user-system modify-participants --usid 100 --users '[...]'
326
+ wjx user-system delete-participants --usid 100 --uids '["u1","u2"]'
327
+ wjx user-system bind --vid 12345 --usid 100 --uids '["u1"]'
328
+ wjx user-system query-binding --vid 12345 --usid 100
329
+ wjx user-system query-surveys --usid 100 --uid u1
330
+ ```