@wcs-edu-os/cli 0.0.0-stage → 0.1.1

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
@@ -1,3 +1,74 @@
1
- # Temporary Holding Version
1
+ # @wcs-edu-os/cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ WCS EDU OS 开源管理员 CLI,命令入口为 `wcs-edu-os`。它通过网关 API 查询和管理课程、用户、题库及考试资源,适合管理员、自动化脚本和 AI Agent 使用。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ npm install -g @wcs-edu-os/cli
9
+ wcs-edu-os version --output json
10
+ ```
11
+
12
+ 也可以使用 npx:
13
+
14
+ ```bash
15
+ npx --yes @wcs-edu-os/cli doctor --output json
16
+ ```
17
+
18
+ 要求 Node.js 22 或更高版本。
19
+
20
+ ## 配置认证
21
+
22
+ ```bash
23
+ export WCS_EDU_BASE_URL=https://edu.example.com
24
+ export WCS_EDU_APP_KEY=your-app-key
25
+ export WCS_EDU_APP_SECRET=your-app-secret
26
+ wcs-edu-os doctor --output table
27
+ ```
28
+
29
+ 不希望把 secret 放入环境变量时,可以通过标准输入传入:
30
+
31
+ ```bash
32
+ printf '%s' "$WCS_EDU_APP_SECRET" | wcs-edu-os --secret-stdin auth test --output json
33
+ ```
34
+
35
+ ## 常用命令
36
+
37
+ ```bash
38
+ wcs-edu-os guide getting-started
39
+ wcs-edu-os capabilities --output json
40
+ wcs-edu-os category list --output table
41
+ wcs-edu-os lecturer list --output table
42
+ wcs-edu-os course list --output json
43
+ wcs-edu-os course get <courseId> --output json
44
+ wcs-edu-os question list --output json
45
+ wcs-edu-os paper list --output json
46
+ wcs-edu-os exam list --output json
47
+ wcs-edu-os user list --page 1 --size 20 --output json
48
+ ```
49
+
50
+ 非交互环境默认输出 JSON;终端环境可使用 `--output table`。分页列表支持 `--page`、`--size`、`--max-items` 和重复的 `--filter key=value`。
51
+
52
+ ## 安全写操作
53
+
54
+ 创建和编辑命令必须先使用 `--dry-run` 生成确认令牌,再使用确认令牌和幂等键执行。CLI 不会自动重试写请求,也不会在命令行参数中接收密码。
55
+
56
+ ```bash
57
+ wcs-edu-os course create --input course.json --dry-run --output json
58
+ wcs-edu-os course create --input course.json \
59
+ --confirm-token "$WCS_CONFIRM_TOKEN" \
60
+ --idempotency-key "course-create-20261102-001" \
61
+ --output json
62
+ ```
63
+
64
+ ## 输出协议
65
+
66
+ JSON 结果使用固定信封字段:`schemaVersion`、`ok`、`command`、`requestId`、`data`、`page`、`warnings`、`meta` 和 `error`。诊断信息写入 stderr,并自动脱敏。
67
+
68
+ ## 相关链接
69
+
70
+ - [项目源码](https://codeup.aliyun.com/qixin/base/opens/wcs-edu)
71
+
72
+ 完整命令和参数可通过 wcs-edu-os --help 及 wcs-edu-os guide all 查看。
73
+
74
+ 许可证:AGPL-3.0-only,与 wcs-edu 开源项目一致。