shawnxixi-cli 0.1.0

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 (51) hide show
  1. package/.env.example +2 -0
  2. package/.github/workflows/ci.yml +48 -0
  3. package/AUTH-RESEARCH.md +230 -0
  4. package/CLAUDE.md +102 -0
  5. package/NPM-PUBLISH-RESEARCH.md +163 -0
  6. package/README.md +136 -0
  7. package/dist/commands/biz/calendar.d.ts +12 -0
  8. package/dist/commands/biz/calendar.d.ts.map +1 -0
  9. package/dist/commands/biz/calendar.js +35 -0
  10. package/dist/commands/biz/calendar.js.map +1 -0
  11. package/dist/commands/biz/finance.d.ts +12 -0
  12. package/dist/commands/biz/finance.d.ts.map +1 -0
  13. package/dist/commands/biz/finance.js +34 -0
  14. package/dist/commands/biz/finance.js.map +1 -0
  15. package/dist/commands/biz/item.d.ts +12 -0
  16. package/dist/commands/biz/item.d.ts.map +1 -0
  17. package/dist/commands/biz/item.js +32 -0
  18. package/dist/commands/biz/item.js.map +1 -0
  19. package/dist/commands/biz/record.d.ts +28 -0
  20. package/dist/commands/biz/record.d.ts.map +1 -0
  21. package/dist/commands/biz/record.js +34 -0
  22. package/dist/commands/biz/record.js.map +1 -0
  23. package/dist/commands/biz/todo.d.ts +35 -0
  24. package/dist/commands/biz/todo.d.ts.map +1 -0
  25. package/dist/commands/biz/todo.js +73 -0
  26. package/dist/commands/biz/todo.js.map +1 -0
  27. package/dist/commands/sys/health.d.ts +9 -0
  28. package/dist/commands/sys/health.d.ts.map +1 -0
  29. package/dist/commands/sys/health.js +28 -0
  30. package/dist/commands/sys/health.js.map +1 -0
  31. package/dist/index.d.ts +8 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +199 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/services/api.d.ts +37 -0
  36. package/dist/services/api.d.ts.map +1 -0
  37. package/dist/services/api.js +218 -0
  38. package/dist/services/api.js.map +1 -0
  39. package/jest.config.js +11 -0
  40. package/package.json +40 -0
  41. package/src/commands/biz/calendar.ts +31 -0
  42. package/src/commands/biz/finance.ts +30 -0
  43. package/src/commands/biz/item.ts +28 -0
  44. package/src/commands/biz/record.ts +38 -0
  45. package/src/commands/biz/todo.ts +74 -0
  46. package/src/commands/sys/health.ts +23 -0
  47. package/src/index.ts +209 -0
  48. package/src/services/api.ts +226 -0
  49. package/tests/commands/todo.test.ts +39 -0
  50. package/tests/services/api.test.ts +39 -0
  51. package/tsconfig.json +20 -0
package/.env.example ADDED
@@ -0,0 +1,2 @@
1
+ SHAWNXIXI_API_URL=http://localhost:8080
2
+ SHAWNXIXI_API_TOKEN=
@@ -0,0 +1,48 @@
1
+ name: CI/CD
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ build-test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ node-version: [20.x]
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - name: Use Node.js ${{ matrix.node-version }}
18
+ uses: actions/setup-node@v4
19
+ with:
20
+ node-version: ${{ matrix.node-version }}
21
+ cache: npm
22
+ - name: Install dependencies
23
+ run: npm ci
24
+ - name: Build
25
+ run: npm run build
26
+ - name: Test
27
+ run: npm test
28
+
29
+ publish:
30
+ needs: build-test
31
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
32
+ runs-on: ubuntu-latest
33
+ steps:
34
+ - uses: actions/checkout@v4
35
+ - name: Use Node.js
36
+ uses: actions/setup-node@v4
37
+ with:
38
+ node-version: '20.x'
39
+ registry-url: 'https://registry.npmjs.org'
40
+ - name: Install dependencies
41
+ run: npm ci
42
+ - name: Build
43
+ run: npm run build
44
+ - name: Publish to npm
45
+ run: npm publish --access public
46
+ env:
47
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
48
+
@@ -0,0 +1,230 @@
1
+ # CLI 鉴权方案调研
2
+
3
+ ## 1. CLI 工具常用鉴权方案
4
+
5
+ ### 1.1 API Key 方案
6
+ **原理**: 使用静态字符串作为密钥
7
+ ```
8
+ Authorization: Bearer <api_key>
9
+ ```
10
+
11
+ **优点**:
12
+ - 实现简单
13
+ - 易于理解和使用
14
+ - 适合机器对机器通信
15
+
16
+ **缺点**:
17
+ - 密钥泄露后无法撤销(需重新生成)
18
+ - 无期限控制(除非服务端实现)
19
+
20
+ **适用场景**:
21
+ - 服务级 API 访问
22
+ - CI/CD 环境
23
+
24
+ ### 1.2 OAuth2 方案
25
+ **原理**: 标准 OAuth2 流程,支持刷新令牌
26
+
27
+ **优点**:
28
+ - 支持令牌过期和刷新
29
+ - 用户可撤销授权
30
+ - 支持细粒度权限控制
31
+
32
+ **缺点**:
33
+ - 实现复杂
34
+ - 需要 Web 回调或终端授权
35
+
36
+ **适用场景**:
37
+ - 需要用户授权的 API
38
+ - 用户数据访问
39
+
40
+ ### 1.3 Token(JWT)方案
41
+ **原理**: 使用自包含的 JSON Web Token
42
+
43
+ **优点**:
44
+ - 自带过期时间
45
+ - 可包含用户信息
46
+ - 验证简单
47
+
48
+ **缺点**:
49
+ - 令牌一旦颁发无法撤销(直到过期)
50
+ - 令牌较长
51
+
52
+ **适用场景**:
53
+ - 有状态 API 访问
54
+ - 需要追踪用户身份的 API
55
+
56
+ ## 2. CLI 安全存储 Token
57
+
58
+ ### 2.1 Keychain 存储(推荐 macOS/Linux)
59
+ ```typescript
60
+ // 使用 keytar 库
61
+ import keytar from 'keytar';
62
+
63
+ const SERVICE = 'shawnxixi-cli';
64
+ const ACCOUNT = 'api-token';
65
+
66
+ // 存储
67
+ await keytar.setPassword(SERVICE, ACCOUNT, token);
68
+
69
+ // 读取
70
+ const token = await keytar.getPassword(SERVICE, ACCOUNT);
71
+
72
+ // 删除
73
+ await keytar.deletePassword(SERVICE, ACCOUNT);
74
+ ```
75
+
76
+ **优点**:
77
+ - 系统级安全存储
78
+ - 不易被普通用户发现
79
+ - 跨平台支持
80
+
81
+ **缺点**:
82
+ - 需要 native 依赖
83
+ - 某些系统可能不支持
84
+
85
+ ### 2.2 Config File 存储
86
+ ```bash
87
+ # ~/.config/shawnxixi-cli/config.json
88
+ {
89
+ "token": "encrypted_or_plain_token",
90
+ "endpoint": "https://api.shawnxixi.com"
91
+ }
92
+ ```
93
+
94
+ **优点**:
95
+ - 简单实现
96
+ - 用户可控
97
+
98
+ **缺点**:
99
+ - 容易被发现和泄露
100
+ - 需要自行加密或依赖文件系统权限
101
+
102
+ ### 2.3 环境变量
103
+ ```bash
104
+ export SHAWNXIXI_TOKEN="your_token_here"
105
+ ```
106
+
107
+ **优点**:
108
+ - 简单
109
+ - 便于 CI/CD 集成
110
+
111
+ **缺点**:
112
+ - 容易被 history 或日志泄露
113
+ - 不够安全
114
+
115
+ ### 2.4 加密存储
116
+ ```typescript
117
+ import { createCipheriv, randomBytes } from 'crypto';
118
+
119
+ const encrypt = (text: string, key: Buffer): string => {
120
+ const iv = randomBytes(16);
121
+ const cipher = createCipheriv('aes-256-cbc', key, iv);
122
+ return iv.toString('hex') + ':' + cipher.update(text, 'utf8', 'hex') + ':' + cipher.final('hex');
123
+ };
124
+ ```
125
+
126
+ ## 3. 推荐方案及理由
127
+
128
+ ### 推荐: API Key + Keychain 存储
129
+
130
+ **理由**:
131
+
132
+ 1. **CLI 工具特性**: 大多数 CLI 工具(如 kubectl, terraform, aws cli)都采用 API Key 方案
133
+ 2. **实现简单**: 比 OAuth2 简单很多,适合自动化调用
134
+ 3. **keychain 安全**: macOS Keychain / Linux libsecret 提供系统级保护
135
+ 4. **SpringBoot 兼容**: 与现有 JWT 方案可共存,CLI 使用 API Key 即可
136
+
137
+ **实现架构**:
138
+ ```
139
+ shawnxixi-cli
140
+
141
+ ├── 首次使用: shawnxixi login # 输入 API Key,存 Keychain
142
+
143
+ ├── 后续使用: 自动从 Keychain 读取
144
+
145
+ └── API 调用: Authorization: Bearer <token>
146
+
147
+
148
+ shawnxixi-server
149
+
150
+ ├── 验证 JWT token
151
+
152
+ └── 返回业务数据
153
+ ```
154
+
155
+ ## 4. 与 SpringBoot 后端的鉴权对接
156
+
157
+ ### 4.1 后端实现
158
+ ```java
159
+ // Spring Security 配置
160
+ @Configuration
161
+ public class SecurityConfig {
162
+ @Bean
163
+ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
164
+ http
165
+ .csrf(AbstractHttpConfigurer::disable)
166
+ .authorizeHttpRequests(auth -> auth
167
+ .requestMatchers("/api/**").authenticated()
168
+ // 或支持 API Key 白名单
169
+ .requestMatchers("/api/cli/**").permitAll() // CLI 专用入口
170
+ )
171
+ .addFilterBefore(new ApiKeyAuthFilter(),
172
+ UsernamePasswordAuthenticationFilter.class);
173
+ return http.build();
174
+ }
175
+ }
176
+
177
+ // API Key 验证过滤器
178
+ public class ApiKeyAuthFilter extends OncePerRequestFilter {
179
+ @Override
180
+ protected void doFilterInternal(HttpServletRequest request,
181
+ HttpServletResponse response,
182
+ FilterChain chain) {
183
+ String apiKey = request.getHeader("X-API-Key");
184
+ // 或 Authorization: Bearer <api_key>
185
+
186
+ if (apiKey != null && validateApiKey(apiKey)) {
187
+ // 设置认证信息
188
+ SecurityContextHolder.getContext()
189
+ .setAuthentication(new ApiKeyAuthentication(apiKey));
190
+ }
191
+ chain.doFilter(request, response);
192
+ }
193
+ }
194
+ ```
195
+
196
+ ### 4.2 CLI 实现
197
+ ```typescript
198
+ // src/services/auth.ts
199
+ import keytar from 'keytar';
200
+
201
+ const SERVICE = 'shawnxixi-cli';
202
+ const ACCOUNT = 'api-token';
203
+
204
+ export async function getStoredToken(): Promise<string | null> {
205
+ return keytar.getPassword(SERVICE, ACCOUNT);
206
+ }
207
+
208
+ export async function saveToken(token: string): Promise<void> {
209
+ await keytar.setPassword(SERVICE, ACCOUNT, token);
210
+ }
211
+
212
+ export async function login(apiKey: string): Promise<void> {
213
+ // 验证 API Key 有效性
214
+ await saveToken(apiKey);
215
+ }
216
+ ```
217
+
218
+ ### 4.3 安全建议
219
+ 1. **API Key 生成**: 使用 UUID v4 或 crypto random
220
+ 2. **传输安全**: 必须使用 HTTPS
221
+ 3. **存储加密**: Keychain 本身已加密,可选额外加密
222
+ 4. **令牌轮换**: 支持用户撤销和重新生成
223
+ 5. **日志保护**: 不要在日志中打印 token
224
+
225
+ ## 结论
226
+
227
+ 对于 shawnxixi-cli 作为 OpenClaw 执行肢:
228
+ - **鉴权方案**: API Key(简单、适合机器调用)
229
+ - **存储方案**: Keychain(系统级安全)
230
+ - **后端对接**: API Key Header + Spring Security Filter
package/CLAUDE.md ADDED
@@ -0,0 +1,102 @@
1
+ # shawnxixi-cli
2
+
3
+ ## 项目说明
4
+
5
+ 肖嘻 CLI 工具,OpenClaw 的执行肢。通过 HTTP 调用 shawnxixi-server REST API。
6
+
7
+ ## 技术栈
8
+
9
+ - **Runtime**: Node.js 20+
10
+ - **语言**: TypeScript 5.3
11
+ - **HTTP Client**: axios
12
+ - **测试**: Jest + ts-jest
13
+ - **构建**: tsc
14
+
15
+ ## CLI 命令格式
16
+
17
+ ```
18
+ shawnxixi <命名空间> <操作> [参数]
19
+ ```
20
+
21
+ ### biz 命名空间(日常业务)
22
+
23
+ | 操作 | 命令格式 | 说明 |
24
+ |------|---------|------|
25
+ | todo create | `shawnxixi biz todo create "{title}" --due {date} --priority {priority}` | 创建待办 |
26
+ | todo list | `shawnxixi biz todo list --status {status}` | 列出待办 |
27
+ | todo update | `shawnxixi biz todo update {id} --status {status}` | 更新待办 |
28
+ | todo delete | `shawnxixi biz todo delete {id}` | 删除待办 |
29
+ | record create | `shawnxixi biz record create "{title}" --type {type} --content "{content}" --tags {tags}` | 创建记录 |
30
+ | record list | `shawnxixi biz record list --type {type}` | 列出记录 |
31
+ | finance create | `shawnxixi biz finance create --amount {amount} --type {type} --category {category}` | 记账 |
32
+ | finance list | `shawnxixi biz finance list --type {type}` | 列出账单 |
33
+ | item create | `shawnxixi biz item create "{name}" --category {category}` | 添加物品 |
34
+ | item list | `shawnxixi biz item list --category {category}` | 列出物品 |
35
+ | calendar create | `shawnxixi biz calendar create "{title}" --start {startTime} --end {endTime}` | 创建日程 |
36
+ | calendar list | `shawnxixi biz calendar list --start {startTime} --end {endTime}` | 列出日程 |
37
+ | reminder create | `shawnxixi biz reminder create "{title}" --trigger "{triggerTime}" --type {type}` | 创建提醒 |
38
+ | reminder list | `shawnxixi biz reminder list --status {status}` | 列出提醒 |
39
+ | audit list | `shawnxixi biz audit list --entityType {entityType} --operation {operation}` | 查看审计日志 |
40
+ | task create | `shawnxixi biz task create "{title}" --priority {priority}` | 创建任务 |
41
+ | task list | `shawnxixi biz task list --status {status}` | 列出任务 |
42
+
43
+ ### sys 命名空间(系统操作)
44
+
45
+ | 操作 | 命令格式 | 说明 |
46
+ |------|---------|------|
47
+ | health query | `shawnxixi sys health query --dataType {dataType} --startDate {startDate} --endDate {endDate}` | 查询健康数据 |
48
+ | health sync | `shawnxixi sys health sync` | 同步健康数据 |
49
+
50
+ ## API 端点(Server v1)
51
+
52
+ 所有 API 基础路径:`http://localhost:8080/api/v1`
53
+
54
+ | 端点 | 方法 | 说明 |
55
+ |------|------|------|
56
+ | `/api/v1/todos` | GET/POST | 待办列表/创建 |
57
+ | `/api/v1/todos/{id}` | GET/PUT/PATCH/DELETE | 待办详情/更新/删除 |
58
+ | `/api/v1/records` | GET/POST | 记录列表/创建 |
59
+ | `/api/v1/records/{id}` | GET/PUT/PATCH/DELETE | 记录详情/更新/删除 |
60
+ | `/api/v1/finances` | GET/POST | 账单列表/创建 |
61
+ | `/api/v1/items` | GET/POST | 物品列表/创建 |
62
+ | `/api/v1/calendar-events` | GET/POST | 日程列表/创建 |
63
+ | `/api/v1/reminders` | GET/POST | 提醒列表/创建 |
64
+ | `/api/v1/audit-logs` | GET | 审计日志(只读) |
65
+ | `/api/v1/tasks` | GET/POST | 任务列表/创建 |
66
+ | `/api/v1/health-data` | GET/POST | 健康数据 |
67
+ | `/api/v1/health-data/sync` | POST | 同步健康数据 |
68
+
69
+ ## 环境变量
70
+
71
+ | 变量 | 说明 | 默认值 |
72
+ |------|------|-------|
73
+ | `SHAWNXIXI_API_URL` | API 基础地址 | `http://localhost:8080` |
74
+ | `SHAWNXIXI_API_TOKEN` | 认证 Token | 无(匿名) |
75
+
76
+ **安全注意**:Token 只写入本地 `.env` 或环境变量,禁止写入代码或 git。
77
+
78
+ ## npm 发包
79
+
80
+ - 包名:`shawnxixi-cli`(npmjs.com)
81
+ - 发布命令:`npm publish --access public`
82
+ - CI 自动发包:main 分支合并时通过 GitHub Actions 触发,需配置 `NPM_TOKEN` secret
83
+
84
+ ## 启动开发
85
+
86
+ ```bash
87
+ npm install
88
+ npm run build
89
+ npm test
90
+ ```
91
+
92
+ ## 目录结构
93
+
94
+ ```
95
+ src/
96
+ ├── index.ts # CLI 入口
97
+ ├── commands/ # 命令实现
98
+ │ ├── biz/ # 业务命令
99
+ │ └── sys/ # 系统命令
100
+ └── services/
101
+ └── api.ts # HTTP API 调用层
102
+ ```
@@ -0,0 +1,163 @@
1
+ # NPM 发布调研
2
+
3
+ ## 1. 如何发布到 npm(详细步骤)
4
+
5
+ ### 步骤 1: 创建 npm 账号
6
+ ```bash
7
+ npm adduser
8
+ # 或前往 https://www.npmjs.com/signup 注册
9
+ ```
10
+
11
+ ### 步骤 2: 验证包配置
12
+ ```bash
13
+ # 确认 package.json 配置正确
14
+ npm view . # 查看包信息预览
15
+
16
+ # 登录状态确认
17
+ npm whoami # 显示当前登录用户名
18
+ ```
19
+
20
+ ### 步骤 3: 发布包
21
+ ```bash
22
+ # 发布前先 build
23
+ npm run build
24
+
25
+ # 发布(标签默认为 latest)
26
+ npm publish
27
+
28
+ # 发布到指定标签
29
+ npm publish --tag beta
30
+ npm publish --tag next
31
+ ```
32
+
33
+ ### 步骤 4: 验证发布
34
+ ```bash
35
+ npm view shawnxixi-cli # 查看已发布的包信息
36
+ npm install shawnxixi-cli # 验证安装
37
+ ```
38
+
39
+ ## 2. npm Scope 设置
40
+
41
+ ### 使用 @shawnxixi scope
42
+ ```bash
43
+ # 创建 scope
44
+ npm init --scope=@shawnxixi
45
+
46
+ # 或在 package.json 中设置
47
+ {
48
+ "name": "@shawnxixi/cli"
49
+ }
50
+ ```
51
+
52
+ ### 注意事项
53
+ - 需要先在 npm 创建 organization 或使用付费组织的 scope
54
+ - 免费账号可以使用 public scope 的 @username/packageName
55
+ - `@shawnxixi` 需要创建 shawnxixi organization
56
+
57
+ ## 3. Version 管理策略
58
+
59
+ ### 语义化版本 (SemVer)
60
+ ```
61
+ major.minor.patch
62
+ 1.0.0
63
+ │ │ │
64
+ │ │ └── patch: 修复 bug,兼容更新
65
+ │ └── minor: 新功能,兼容更新
66
+ └── major: 破坏性变更,不兼容更新
67
+ ```
68
+
69
+ ### 预发布版本
70
+ ```
71
+ 1.0.0-alpha.1 # alpha 测试版
72
+ 1.0.0-beta.1 # beta 测试版
73
+ 1.0.0-rc.1 # release candidate
74
+ ```
75
+
76
+ ### 发布策略
77
+ - 开发阶段: `0.1.0` 起,patch 频繁更新
78
+ - MVP 后: `1.0.0` 作为首个正式版本
79
+ - 使用 `npm version` 管理版本:
80
+ ```bash
81
+ npm version patch # 0.1.0 -> 0.1.1
82
+ npm version minor # 0.1.0 -> 0.2.0
83
+ npm version major # 0.1.0 -> 1.0.0
84
+ ```
85
+
86
+ ## 4. 发布可见性(private 包)
87
+
88
+ ### Public 包(默认)
89
+ ```json
90
+ {
91
+ "name": "@shawnxixi/cli",
92
+ "publishConfig": {
93
+ "access": "public"
94
+ }
95
+ }
96
+ ```
97
+
98
+ ### Private 包
99
+ ```json
100
+ {
101
+ "name": "@shawnxixi/internal-cli",
102
+ "private": true
103
+ // private 包不能发布到公共 registry
104
+ }
105
+ ```
106
+
107
+ ### Restricted 可见性
108
+ - 需要付费组织
109
+ - 只能组织内成员安装
110
+
111
+ ## 5. CI/CD 自动发布配置
112
+
113
+ ### GitHub Actions 示例
114
+ ```yaml
115
+ # .github/workflows/npm-publish.yml
116
+ name: npm-publish
117
+
118
+ on:
119
+ push:
120
+ tags:
121
+ - 'v*'
122
+
123
+ jobs:
124
+ publish:
125
+ runs-on: ubuntu-latest
126
+ steps:
127
+ - uses: actions/checkout@v4
128
+
129
+ - name: Setup Node.js
130
+ uses: actions/setup-node@v4
131
+ with:
132
+ node-version: '20'
133
+ registry-url: 'https://registry.npmjs.org'
134
+
135
+ - name: Install dependencies
136
+ run: npm ci
137
+
138
+ - name: Build
139
+ run: npm run build
140
+
141
+ - name: Publish
142
+ run: npm publish
143
+ env:
144
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
145
+ ```
146
+
147
+ ### NPM Token 配置
148
+ 1. npm 官网 -> Access Tokens
149
+ 2. 创建 Automation Token(推荐用于 CI)
150
+ 3. GitHub -> Settings -> Secrets -> NPM_TOKEN
151
+
152
+ ### 发布流程
153
+ ```
154
+ 代码合并 -> 打 tag (v1.0.0) -> push tag -> GitHub Actions 触发 -> 自动发布
155
+ ```
156
+
157
+ ## 推荐方案
158
+
159
+ 对于 shawnxixi-cli:
160
+ - **Scope**: `@shawnxixi` (需要创建 organization) 或 `shawnxixi-cli` (直接发布)
161
+ - **Version**: 从 `0.1.0` 开始,使用 SemVer
162
+ - **可见性**: public
163
+ - **CI/CD**: GitHub Actions + npm automation token
package/README.md ADDED
@@ -0,0 +1,136 @@
1
+ # shawnxixi-cli
2
+
3
+ > 肖嘻 CLI 工具 — OpenClaw 的执行肢
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ # 从源码编译
9
+ git clone https://github.com/LyuShawn/shawnxixi-cli.git
10
+ cd shawnxixi-cli
11
+ npm install
12
+ npm run build
13
+
14
+ # 链接到全局
15
+ npm link
16
+ ```
17
+
18
+ ## 配置
19
+
20
+ ```bash
21
+ # 设置后端地址(可选,默认 http://localhost:8080)
22
+ export SHAWNXIXI_API_URL=http://localhost:8080
23
+
24
+ # 设置 API Token(可选)
25
+ export SHAWNXIXI_API_TOKEN=your-token
26
+ ```
27
+
28
+ ## 命令
29
+
30
+ ### 待办 (biz todo)
31
+
32
+ ```bash
33
+ # 创建待办
34
+ shawnxixi biz todo create "开会" --due 2026-04-12 --priority high
35
+
36
+ # 列出所有待办
37
+ shawnxixi biz todo list
38
+
39
+ # 标记完成
40
+ shawnxixi biz todo done 1
41
+
42
+ # 删除待办
43
+ shawnxixi biz todo delete 1
44
+ ```
45
+
46
+ ### 记录 (biz record)
47
+
48
+ ```bash
49
+ # 创建记录
50
+ shawnxixi biz record create "灵感" --content "想到一个新的app idea" --type idea
51
+
52
+ # 列出所有记录
53
+ shawnxixi biz record list
54
+
55
+ # 宠物记录
56
+ shawnxixi biz record create "西西体重" --content "3.2kg" --type pet --tags "体重,西西"
57
+ ```
58
+
59
+ ### 财务 (biz finance)
60
+
61
+ ```bash
62
+ # 记账(支出)
63
+ shawnxixi biz finance create 50 --category food --desc "午饭"
64
+
65
+ # 记账(收入)
66
+ shawnxixi biz finance create 15000 --type income --category salary
67
+
68
+ # 列出财务流水
69
+ shawnxixi biz finance list
70
+
71
+ # 按分类查看
72
+ shawnxixi biz finance list --category food
73
+ ```
74
+
75
+ ### 物品 (biz item)
76
+
77
+ ```bash
78
+ # 添加物品
79
+ shawnxixi biz item create "阿莫西林" --location "药箱" --expire 2026-12-01 --category "药品"
80
+
81
+ # 列出物品
82
+ shawnxixi biz item list
83
+ ```
84
+
85
+ ### 日历 (biz calendar)
86
+
87
+ ```bash
88
+ # 创建日程
89
+ shawnxixi biz calendar create "面试" --start "2026-04-15 14:00" --end "2026-04-15 15:30" --desc "技术面试"
90
+
91
+ # 列出日程
92
+ shawnxixi biz calendar list
93
+ ```
94
+
95
+ ### 健康 (sys health)
96
+
97
+ ```bash
98
+ # 同步健康数据
99
+ shawnxixi sys health sync
100
+
101
+ # 查询健康数据
102
+ shawnxixi sys health query steps --from 2026-04-01 --to 2026-04-11
103
+ shawnxixi sys health query heartRate
104
+ ```
105
+
106
+ ## 开发
107
+
108
+ ```bash
109
+ # 编译
110
+ npm run build
111
+
112
+ # 测试
113
+ npm test
114
+
115
+ # 发布到 npm(需权限)
116
+ npm publish --access public
117
+ ```
118
+
119
+ ## 架构
120
+
121
+ ```
122
+ src/
123
+ ├── commands/ # 命令实现
124
+ │ ├── biz/ # 业务命令
125
+ │ └── sys/ # 系统命令
126
+ ├── services/
127
+ │ └── api.ts # HTTP 调用层
128
+ └── index.ts # 入口
129
+ ```
130
+
131
+ ## 相关项目
132
+
133
+ - [shawnxixi-design](https://github.com/LyuShawn/shawnxixi-design) - 设计/需求文档
134
+ - [shawnxixi-server](https://github.com/LyuShawn/shawnxixi-server) - 后端服务
135
+ - [shawnxixi-skills](https://github.com/LyuShawn/shawnxixi-skills) - Skill 知识库
136
+ - [shawnxixi-app](https://github.com/LyuShawn/shawnxixi-app) - iOS 应用
@@ -0,0 +1,12 @@
1
+ export declare const calendarCommands: {
2
+ create: (title: string, options?: {
3
+ start?: string;
4
+ end?: string;
5
+ desc?: string;
6
+ }) => Promise<void>;
7
+ list: (options?: {
8
+ from?: string;
9
+ to?: string;
10
+ }) => Promise<void>;
11
+ };
12
+ //# sourceMappingURL=calendar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../src/commands/biz/calendar.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;oBACL,MAAM,YAAW;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;qBAgBhE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE;CAWrD,CAAC"}