wjx-cli 0.1.13 → 0.1.14

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.
package/README.md CHANGED
@@ -85,8 +85,8 @@ npm install -g wjx-cli
85
85
  ### 从源码安装(开发者)
86
86
 
87
87
  ```bash
88
- git clone https://codeup.aliyun.com/6445da2d020eabef3107e22e/wjxfc/wjxagents.git
89
- cd wjxagents/wjx-ai-kit
88
+ git clone https://github.com/wjxcom/wjx-ai-kit.git
89
+ cd wjx-ai-kit
90
90
  npm install
91
91
  npm run build --workspace=wjx-api-sdk
92
92
  npm run build --workspace=wjx-cli
@@ -1,20 +1,61 @@
1
1
  ---
2
2
  name: wjx-cli-use
3
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 69 subcommands across 15 modules.
4
+ homepage: https://www.wjx.cn
5
+ version: 1.0.0
4
6
  ---
5
7
 
6
8
  # wjx-cli 使用指南
7
9
 
8
10
  wjx-cli 是问卷星 OpenAPI 的命令行工具。所有命令格式:`wjx <模块> <操作> [选项]`。
9
11
 
12
+ ## 触发场景
13
+
14
+ 以下情况应直接使用本 Skill:
15
+
16
+ - 用户提到「问卷」「调查」「收集」「表单」「投票」「考试」「测评」「满意度」「NPS」「问卷星」「wjx」等关键词
17
+ - 用户说「帮我做个调查」「创建问卷」「查看答卷」「分析数据」「导出数据」等
18
+ - 用户需要管理通讯录、部门、子账号、SSO 等企业功能
19
+
20
+ ### 模糊场景
21
+
22
+ | 用户表述 | 处理方式 |
23
+ |---------|---------|
24
+ | 「帮我做个调查/问卷」 | `wjx survey create-by-text --text "..."` |
25
+ | 「做个考试/测验」 | `wjx survey create-by-text --text "..." --type 6` |
26
+ | 「做个投票」 | `wjx survey create-by-text --text "..." --type 3` |
27
+ | 「做个表单/报名表」 | `wjx survey create-by-text --text "..." --type 7` |
28
+ | 「看看问卷结果」 | 先 `wjx survey list` 找 vid,再 `wjx response report --vid <vid>` |
29
+ | 「导出答卷数据」 | `wjx response download --vid <vid>` |
30
+ | 「分析 NPS 得分」 | `wjx analytics nps --scores "[9,10,7,3]"` |
31
+ | 「导入联系人」 | `wjx contacts add --users '[...]'`(需 `WJX_CORP_ID`) |
32
+ | 「查看问卷链接」 | `wjx survey url --vid <vid>` |
33
+
10
34
  ## 安装与配置
11
35
 
36
+ ### 快速安装(推荐)
37
+
38
+ ```bash
39
+ ./setup.sh -y # 自动检测环境 → 安装 wjx-cli → 引导获取 API Key → 配置 → 验证
40
+ ```
41
+
42
+ ### 手动安装
43
+
12
44
  ```bash
13
45
  npm install -g wjx-cli
14
46
  wjx init # 交互式配置:API Key、Base URL、Corp ID → ~/.wjxrc
15
47
  wjx doctor # 检查连接状态
16
48
  ```
17
49
 
50
+ ### 其他选项
51
+
52
+ ```bash
53
+ ./setup.sh # 交互式安装
54
+ ./setup.sh -c # 仅检查环境
55
+ ./setup.sh -v # 验证安装
56
+ ./setup.sh -h # 显示帮助
57
+ ```
58
+
18
59
  ## 全局选项
19
60
 
20
61
  | 选项 | 说明 |
@@ -24,7 +65,7 @@ wjx doctor # 检查连接状态
24
65
  | `--dry-run` | 预览 API 请求,不实际发送 |
25
66
  | `--stdin` | 从 stdin 读取 JSON 参数(可访问 SDK 全部参数) |
26
67
 
27
- ## 命令总览(15 模块,58 命令)
68
+ ## 命令总览(15 模块,69 命令)
28
69
 
29
70
  | 模块 | 命令 | 说明 |
30
71
  |------|------|------|
@@ -46,7 +87,7 @@ wjx doctor # 检查连接状态
46
87
 
47
88
  ## 核心工作流
48
89
 
49
- ### 1. 创建问卷(推荐:DSL 文本格式)
90
+ ### 工作流 1:创建问卷(DSL 文本格式)
50
91
 
51
92
  ```bash
52
93
  # AI Agent 推荐使用 DSL 文本格式
@@ -65,7 +106,7 @@ wjx survey create-by-text --text "问卷标题
65
106
 
66
107
  JSON 创建或复制问卷见 [references/survey-commands.md](references/survey-commands.md)。
67
108
 
68
- ### 2. 查询与分析答卷
109
+ ### 工作流 2:查询与分析答卷
69
110
 
70
111
  ```bash
71
112
  wjx response report --vid 12345 # 统计报告(建议第一步)
@@ -81,7 +122,7 @@ wjx analytics decode --submitdata "1\$1}2\$3|4"
81
122
 
82
123
  完整答卷查询参数(筛选、分页、条件)见 [references/response-commands.md](references/response-commands.md)。
83
124
 
84
- ### 3. 管理通讯录与账号
125
+ ### 工作流 3:管理通讯录与账号
85
126
 
86
127
  ```bash
87
128
  wjx contacts add --users '[{"userid":"u1","name":"Alice","mobile":"13800000001"}]'
@@ -92,6 +133,24 @@ wjx account add --subuser user1 --password pass123 --role 1
92
133
 
93
134
  角色编号:1=系统管理员, 2=问卷管理员, 3=统计查看, 4=完整查看。所有参数见 [references/contacts-commands.md](references/contacts-commands.md)。
94
135
 
136
+ ### 工作流 4:考试/测评问卷
137
+
138
+ ```bash
139
+ # 创建考试问卷(type=6)
140
+ wjx survey create-by-text --text "JavaScript 基础测验
141
+
142
+ 1. typeof null 的结果是?[单选题]
143
+ \"null\"
144
+ \"undefined\"
145
+ \"object\"
146
+ \"boolean\"
147
+
148
+ 2. 请解释闭包的概念 [填空题]" --type 6
149
+
150
+ # 也可使用示例文件
151
+ wjx survey create-by-text --file examples/exam_survey.txt --type 6
152
+ ```
153
+
95
154
  ## 常用枚举值
96
155
 
97
156
  | 参数 | 值 |
@@ -101,6 +160,48 @@ wjx account add --subuser user1 --password pass123 --role 1
101
160
  | 下载格式 (`--suffix`) | 0=CSV, 1=SAV, 2=Word |
102
161
  | 排序方式 (`--sort`) | 0=升序, 1=降序 |
103
162
 
163
+ ## 常见错误与处理
164
+
165
+ | 错误信息 | 原因 | 解决方案 |
166
+ |---------|------|---------|
167
+ | `API Key is required` | 未配置 API Key | 运行 `wjx init` 或设置 `WJX_API_KEY` 环境变量 |
168
+ | `Invalid API Key` | API Key 错误或过期 | 登录问卷星重新获取 API Key |
169
+ | `vid is required` | 未指定问卷 ID | 先 `wjx survey list` 查看问卷列表获取 vid |
170
+ | `Corp ID is required` | 通讯录操作需企业 ID | 运行 `wjx init` 配置 `WJX_CORP_ID` |
171
+ | `Network Error` | 网络连接问题 | 检查网络,或用 `--dry-run` 预览请求 |
172
+
173
+ ## 环境变量
174
+
175
+ | 变量 | 必填 | 说明 |
176
+ |------|:---:|------|
177
+ | `WJX_API_KEY` | 是 | 问卷星 OpenAPI API Key |
178
+ | `WJX_CORP_ID` | 否 | 企业通讯录 ID(通讯录相关操作需要) |
179
+ | `WJX_BASE_URL` | 否 | 自定义 API 基础域名(默认 `https://www.wjx.cn`) |
180
+
181
+ 凭据优先级:`--api-key` 参数 > 环境变量 > `~/.wjxrc` 配置文件。
182
+
183
+ ## 目录结构
184
+
185
+ ```
186
+ wjx-cli-use/
187
+ ├── SKILL.md # 本文档(AI 读取入口)
188
+ ├── README.md # 场景化宣传文档
189
+ ├── package.json # 元数据
190
+ ├── setup.sh # 环境检测与安装脚本
191
+ ├── pack_skill.sh # 打包分发 zip
192
+ ├── examples/ # DSL 示例文件
193
+ │ ├── nps_survey.txt # NPS 调查示例
194
+ │ ├── satisfaction_survey.txt # 满意度调查示例
195
+ │ └── exam_survey.txt # 考试问卷示例
196
+ └── references/ # 详细参考文档(按需读取)
197
+ ├── dsl-syntax.md # DSL 语法,28 种题型标签
198
+ ├── survey-commands.md # survey 模块全部子命令
199
+ ├── response-commands.md # 答卷查询、筛选、下载
200
+ ├── contacts-commands.md # 通讯录、部门、管理员、标签、子账号、SSO
201
+ ├── analytics-commands.md # NPS/CSAT/异常检测/数据解码
202
+ └── question-types.md # 题型编码映射表
203
+ ```
204
+
104
205
  ## 参考文件(按需读取)
105
206
 
106
207
  - [DSL 语法](references/dsl-syntax.md) — create-by-text 的完整 DSL 格式,28 种题型标签
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wjx-cli",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "问卷星 (Wenjuanxing) CLI — AI Agent 原生命令行工具",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -30,8 +30,8 @@
30
30
  "type": "module",
31
31
  "repository": {
32
32
  "type": "git",
33
- "url": "https://codeup.aliyun.com/6445da2d020eabef3107e22e/wjxfc/wjxagents.git",
34
- "directory": "wjx-ai-kit/wjx-cli"
33
+ "url": "https://github.com/wjxcom/wjx-ai-kit.git",
34
+ "directory": "wjx-cli"
35
35
  },
36
36
  "dependencies": {
37
37
  "commander": "^14.0.3",