@tulcn/lxz 0.0.0-stage → 0.3.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 (93) hide show
  1. package/README.md +63 -2
  2. package/dist/application.d.ts +2 -0
  3. package/dist/application.js +17 -0
  4. package/dist/auth/client.d.ts +5 -0
  5. package/dist/auth/client.js +14 -0
  6. package/dist/auth/gateway.d.ts +1 -0
  7. package/dist/auth/gateway.js +10 -0
  8. package/dist/auth/host.d.ts +2 -0
  9. package/dist/auth/host.js +16 -0
  10. package/dist/auth/identity.d.ts +45 -0
  11. package/dist/auth/identity.js +106 -0
  12. package/dist/auth/index.d.ts +9 -0
  13. package/dist/auth/index.js +12 -0
  14. package/dist/auth/inspection.d.ts +14 -0
  15. package/dist/auth/inspection.js +20 -0
  16. package/dist/auth/modules.d.ts +12 -0
  17. package/dist/auth/modules.js +25 -0
  18. package/dist/auth/protocol.d.ts +17 -0
  19. package/dist/auth/protocol.js +1 -0
  20. package/dist/auth/provider.d.ts +36 -0
  21. package/dist/auth/provider.js +166 -0
  22. package/dist/auth/response.d.ts +2 -0
  23. package/dist/auth/response.js +17 -0
  24. package/dist/auth/service.d.ts +5 -0
  25. package/dist/auth/service.js +71 -0
  26. package/dist/auth/store.d.ts +25 -0
  27. package/dist/auth/store.js +170 -0
  28. package/dist/cli/browser.d.ts +1 -0
  29. package/dist/cli/browser.js +11 -0
  30. package/dist/cli/contracts.d.ts +85 -0
  31. package/dist/cli/contracts.js +51 -0
  32. package/dist/cli/deployment.d.ts +5 -0
  33. package/dist/cli/deployment.js +23 -0
  34. package/dist/cli/device-login.d.ts +29 -0
  35. package/dist/cli/device-login.js +87 -0
  36. package/dist/cli/environment.d.ts +9 -0
  37. package/dist/cli/environment.js +19 -0
  38. package/dist/cli/errors.d.ts +30 -0
  39. package/dist/cli/errors.js +22 -0
  40. package/dist/cli/files.d.ts +6 -0
  41. package/dist/cli/files.js +71 -0
  42. package/dist/cli/http.d.ts +6 -0
  43. package/dist/cli/http.js +38 -0
  44. package/dist/cli/identity-commands.d.ts +3 -0
  45. package/dist/cli/identity-commands.js +56 -0
  46. package/dist/cli/index.d.ts +13 -0
  47. package/dist/cli/index.js +13 -0
  48. package/dist/cli/init.d.ts +205 -0
  49. package/dist/cli/init.js +77 -0
  50. package/dist/cli/modules.d.ts +6 -0
  51. package/dist/cli/modules.js +18 -0
  52. package/dist/cli/output.d.ts +2 -0
  53. package/dist/cli/output.js +35 -0
  54. package/dist/cli/prompts.d.ts +34 -0
  55. package/dist/cli/prompts.js +58 -0
  56. package/dist/cli/runtime.d.ts +2 -0
  57. package/dist/cli/runtime.js +137 -0
  58. package/dist/cli/schemas.d.ts +187 -0
  59. package/dist/cli/schemas.js +46 -0
  60. package/dist/doctor.d.ts +2 -0
  61. package/dist/doctor.js +72 -0
  62. package/dist/internal/client.d.ts +6 -0
  63. package/dist/internal/client.js +51 -0
  64. package/dist/internal/host.d.ts +1 -0
  65. package/dist/internal/host.js +50 -0
  66. package/dist/internal/protocol.d.ts +27 -0
  67. package/dist/internal/protocol.js +1 -0
  68. package/dist/main.d.ts +2 -0
  69. package/dist/main.js +12 -0
  70. package/dist/skills/agents.d.ts +7 -0
  71. package/dist/skills/agents.js +11 -0
  72. package/dist/skills/artifacts.d.ts +9 -0
  73. package/dist/skills/artifacts.js +12 -0
  74. package/dist/skills/bundle.d.ts +22 -0
  75. package/dist/skills/bundle.js +77 -0
  76. package/dist/skills/client.d.ts +5 -0
  77. package/dist/skills/client.js +9 -0
  78. package/dist/skills/commands.d.ts +5 -0
  79. package/dist/skills/commands.js +20 -0
  80. package/dist/skills/delivery.d.ts +60 -0
  81. package/dist/skills/delivery.js +89 -0
  82. package/dist/skills/index.d.ts +7 -0
  83. package/dist/skills/index.js +7 -0
  84. package/dist/skills/installer.d.ts +23 -0
  85. package/dist/skills/installer.js +130 -0
  86. package/dist/skills/paths.d.ts +2 -0
  87. package/dist/skills/paths.js +28 -0
  88. package/package.json +36 -3
  89. package/scripts/install.mjs +17 -0
  90. package/skills/SKILL.md +38 -0
  91. package/skills/bundle.json +7 -0
  92. package/skills/commands.md +440 -0
  93. package/skills/features.md +12 -0
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: lxz
3
+ description: 管理指定 CLI 的登录授权并检查运行环境
4
+ ---
5
+
6
+ # lxz
7
+
8
+ 此说明对应 @tulcn/lxz@0.3.0。优先使用已安装且版本匹配的 lxz;未安装时,可用 `pnpm dlx @tulcn/lxz@<版本>`(`<版本>` 取上面的版本号)作为调用前缀。以下命令适用于 pwsh 和 bash,选择 dlx 时替换调用前缀。
9
+
10
+ 功能定位可按需读取同目录 [features.md](features.md);它由当前命令注册自动生成,再沿子命令帮助查询参数。
11
+
12
+ ## 按任务查帮助
13
+
14
+ 先核对版本,再从 `lxz -h` 查找所需功能,沿分组逐层查询。例如授权任务先看 `lxz auth -h`,再看选定子命令的 `-h`,读取其参数、选项与示例。帮助不发起登录、不执行操作;不要凭记忆补写参数。
15
+
16
+ 需要结构化的输入和结果约束时,在选定命令或分组后加 `--schema --json`,只获取该范围的契约;根入口 `lxz --schema --json` 返回全量,仅在需要总览时使用。完整命令参考 [commands.md](commands.md),按需定位相关命令。本说明只保留流程和判断规则,子功能细节以当前帮助为准。
17
+
18
+ Agent 使用 `--non-interactive` 读取默认行数据,失败时读取 stderr。行数据使用 UTF-8,业务数据保留原文;需要程序解析时加 `--json`,先解析再读取字段,JSON 回执中的非 ASCII 字符以 `\uXXXX` 转义,解析后即为原文。
19
+
20
+ ## 和用户沟通
21
+
22
+ 用户关心业务结果,不关心命令怎么运行。回复只用业务说法,不提预览开关(如 dry-run)、命令名、参数、字段名、JSON、退出码或执行步骤;例如说“已经检查过,可以提交”,而不是“预览通过,返回 ok”。只有出错且需要用户处理时,才用业务说法说明原因和用户要做的事。授权链接和用户码例外,要原样写给用户。
23
+
24
+ ## 授权与诊断
25
+
26
+ 先确定用户要使用的业务 CLI,以及管理员分配的 CLI 标识。各 CLI 分别授权,其他 CLI 的登录不授予当前 CLI 权限;业务任务运行对应的独立 CLI,lxz 办理共用授权与诊断。
27
+
28
+ 默认连接正式授权中心;切换测试环境前确认目标地址、该环境的 CLI 登记和人员使用权,授权与令牌不跨环境复用。未知配置联系维护者,不猜测权限。状态查询和普通诊断不应自行触发登录。
29
+
30
+ 仅在用户要求登录时发起授权,先查登录帮助。`lxz auth login --client-id <CLI 标识> --device-login --non-interactive --json` 几秒内返回 `status: pending`,批准在后台等待:把 `authorizationUrl` 和 `userCode` 原样写给用户。链接写成单独一行的 Markdown 链接,例如 `[打开授权页面](authorizationUrl)`,不要写成裸 URL,链接后面也不要紧跟文字或标点(聊天窗口会把它们当成链接的一部分,点开就打不开);用户码另起一行原样写出。`browserOpened` 为 true 时请用户切到已打开的浏览器核对用户码,为 false 时请用户在系统浏览器打开链接(联小助里请右键选择用系统浏览器打开)。然后在同一轮、不等用户回话,运行结果 `next` 中带同一 `--client-id` 的 `auth status --wait-seconds 170` 命令,批准后立即返回并继续用户原来的任务。仍未批准时按 `next` 询问用户;链接有效期间不重复登录,拒绝或到期后停止,不自动重复登录。只有能实时看到输出的终端才用 `--wait` 前台等待;需要在另一设备确认时加 `--no-browser`。
31
+
32
+ 将后端失败原因与恢复提示如实告知用户。不得展示设备码、读取或复制令牌缓存,不在日志、结果或业务文档中记录访问令牌和刷新令牌。
33
+
34
+ 退出前说明本次授权撤销和本机清理的影响,并取得用户同意。撤销失败时说明服务端授权可能仍有效、需要时联系管理员;不自动重试或重新登录。人员身份与 CLI 标识不混用,缺失字段不推断,本机状态不等于实时权限核验。
35
+
36
+ ## 同步说明
37
+
38
+ 首次接入、升级或回滚后,按 `lxz install skill -h` 安装所用版本的说明,再核对版本。postinstall 可自动尝试,但不能依赖它执行;目录选择和冲突处理参数查当前帮助,保留用户修改,不擅自覆盖。
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "lxz",
3
+ "packageName": "@tulcn/lxz",
4
+ "version": "0.3.0",
5
+ "cliVersion": "0.3.0",
6
+ "contractVersion": "1.0.0"
7
+ }
@@ -0,0 +1,440 @@
1
+ ### lxz auth login
2
+
3
+ Sign in using a browser and authorize this CLI
4
+
5
+ Effects: local; Preview: false.
6
+
7
+ - --json (boolean): Return a JSON receipt instead of compact rows; use for programmatic parsing; default false
8
+
9
+ - --non-interactive (boolean): Use command parameters without interactive prompts; default false
10
+
11
+ - --timeout-ms (string): Total deadline in ms (1-3600000), including approval waits; keyboard inactivity does not end authorization; default "660000"
12
+
13
+ - --help (boolean): Show help for this command or group; same as -h
14
+
15
+ - --version (boolean): Show version
16
+
17
+ - --schema (boolean): Show command, input and result schemas
18
+
19
+ - --device-login (boolean): Allow device authorization in non-interactive mode; returns the link at once and waits for approval in the background; default false
20
+
21
+ - --wait (boolean): With --device-login in non-interactive mode, wait for approval in the foreground instead of returning the link at once; default false
22
+
23
+ - --browser (boolean): Open the authorization page in the default browser; use --no-browser to open the URL on another device; default true
24
+
25
+ - --client-id (string): Client ID to manage; defaults to LXZ_AUTH_CLIENT_ID
26
+
27
+ Result schema:
28
+
29
+ ```json
30
+ {
31
+ "type": "object",
32
+ "properties": {
33
+ "account": {
34
+ "type": "string"
35
+ },
36
+ "status": {
37
+ "const": "pending"
38
+ },
39
+ "authorizationUrl": {
40
+ "type": "string"
41
+ },
42
+ "userCode": {
43
+ "type": "string"
44
+ },
45
+ "browserOpened": {
46
+ "type": "boolean",
47
+ "description": "This command opened the authorization page in the system browser"
48
+ },
49
+ "log": {
50
+ "type": "string",
51
+ "description": "Log of the background process that waits for approval"
52
+ },
53
+ "next": {
54
+ "type": "string",
55
+ "description": "What to do next while authorization is pending"
56
+ }
57
+ }
58
+ }
59
+ ```
60
+
61
+ **pwsh / bash**
62
+
63
+ ```sh
64
+ pnpm dlx @tulcn/lxz auth login
65
+ ```
66
+
67
+ **pwsh / bash**
68
+
69
+ ```sh
70
+ pnpm dlx @tulcn/lxz auth login --device-login --json --non-interactive
71
+ ```
72
+
73
+ ### lxz auth status
74
+
75
+ Show this CLI authorization status and current account
76
+
77
+ Effects: none; Preview: false.
78
+
79
+ - --json (boolean): Return a JSON receipt instead of compact rows; use for programmatic parsing; default false
80
+
81
+ - --non-interactive (boolean): Use command parameters without interactive prompts; default false
82
+
83
+ - --timeout-ms (string): Non-interactive deadline in ms (1-3600000); interactive prompts exit after 60 seconds without input; default "175000"
84
+
85
+ - --help (boolean): Show help for this command or group; same as -h
86
+
87
+ - --version (boolean): Show version
88
+
89
+ - --schema (boolean): Show command, input and result schemas
90
+
91
+ - --wait-seconds (string): Wait up to this many seconds (0-170) for a pending browser approval; returns as soon as it is approved; default "0"
92
+
93
+ - --client-id (string): Client ID to manage; defaults to LXZ_AUTH_CLIENT_ID
94
+
95
+ Result schema:
96
+
97
+ ```json
98
+ {
99
+ "type": "object",
100
+ "properties": {
101
+ "authorized": {
102
+ "type": "boolean",
103
+ "description": "Local session exists within its refresh lifetime; server status has not been checked"
104
+ },
105
+ "account": {
106
+ "type": "string",
107
+ "description": "Backend account ID; defaults to token sub, which may differ from the login name"
108
+ },
109
+ "loginName": {
110
+ "type": "string",
111
+ "description": "Backend login name from token name; omitted when unavailable"
112
+ },
113
+ "clientId": {
114
+ "type": "string",
115
+ "description": "CLI client ID, separate from account identity"
116
+ },
117
+ "displayName": {
118
+ "type": "string",
119
+ "description": "Backend display name; omitted when unavailable"
120
+ },
121
+ "accessExpiresAt": {
122
+ "type": "number"
123
+ },
124
+ "refreshExpiresAt": {
125
+ "type": "number"
126
+ },
127
+ "next": {
128
+ "type": "string",
129
+ "description": "What to do when the approval did not arrive in time"
130
+ }
131
+ },
132
+ "required": [
133
+ "authorized"
134
+ ]
135
+ }
136
+ ```
137
+
138
+ **pwsh / bash**
139
+
140
+ ```sh
141
+ pnpm dlx @tulcn/lxz auth status --json --non-interactive
142
+ ```
143
+
144
+ **pwsh / bash**
145
+
146
+ ```sh
147
+ pnpm dlx @tulcn/lxz auth status --wait-seconds 170 --json --non-interactive
148
+ ```
149
+
150
+ ### lxz auth logout
151
+
152
+ Revoke this CLI grant and delete local tokens; other devices and CLIs are unaffected
153
+
154
+ Effects: remote; Preview: false.
155
+
156
+ - --json (boolean): Return a JSON receipt instead of compact rows; use for programmatic parsing; default false
157
+
158
+ - --non-interactive (boolean): Use command parameters without interactive prompts; default false
159
+
160
+ - --timeout-ms (string): Non-interactive deadline in ms (1-3600000); interactive prompts exit after 60 seconds without input; default "120000"
161
+
162
+ - --help (boolean): Show help for this command or group; same as -h
163
+
164
+ - --version (boolean): Show version
165
+
166
+ - --schema (boolean): Show command, input and result schemas
167
+
168
+ - --client-id (string): Client ID to manage; defaults to LXZ_AUTH_CLIENT_ID
169
+
170
+ Result schema:
171
+
172
+ ```json
173
+ {
174
+ "type": "object",
175
+ "properties": {
176
+ "loggedOut": {
177
+ "const": true
178
+ },
179
+ "clientId": {
180
+ "type": "string"
181
+ },
182
+ "impact": {
183
+ "type": "string"
184
+ },
185
+ "revocation": {
186
+ "enum": [
187
+ "revoked",
188
+ "failed",
189
+ "not-needed"
190
+ ]
191
+ },
192
+ "warning": {
193
+ "type": "string"
194
+ },
195
+ "revocationError": {
196
+ "type": "object",
197
+ "required": [
198
+ "code",
199
+ "message",
200
+ "retryable",
201
+ "next"
202
+ ],
203
+ "properties": {
204
+ "code": {
205
+ "enum": [
206
+ "INVALID_INPUT",
207
+ "AUTH_REQUIRED",
208
+ "AUTH_EXPIRED",
209
+ "ACCESS_DENIED",
210
+ "UNAVAILABLE",
211
+ "CONFLICT",
212
+ "IO_ERROR",
213
+ "CANCELLED",
214
+ "TIMEOUT",
215
+ "CONFIGURATION",
216
+ "INCOMPATIBLE",
217
+ "INIT_INCOMPLETE",
218
+ "INTERNAL"
219
+ ]
220
+ },
221
+ "message": {
222
+ "type": "string"
223
+ },
224
+ "retryable": {
225
+ "type": "boolean"
226
+ },
227
+ "next": {
228
+ "type": "string"
229
+ },
230
+ "details": {}
231
+ }
232
+ }
233
+ },
234
+ "required": [
235
+ "loggedOut",
236
+ "clientId",
237
+ "impact"
238
+ ]
239
+ }
240
+ ```
241
+
242
+ **pwsh / bash**
243
+
244
+ ```sh
245
+ pnpm dlx @tulcn/lxz auth logout --json --non-interactive
246
+ ```
247
+
248
+ ### lxz auth whoami
249
+
250
+ Show the local account authorized for this CLI
251
+
252
+ Effects: none; Preview: false.
253
+
254
+ - --json (boolean): Return a JSON receipt instead of compact rows; use for programmatic parsing; default false
255
+
256
+ - --non-interactive (boolean): Use command parameters without interactive prompts; default false
257
+
258
+ - --timeout-ms (string): Non-interactive deadline in ms (1-3600000); interactive prompts exit after 60 seconds without input; default "175000"
259
+
260
+ - --help (boolean): Show help for this command or group; same as -h
261
+
262
+ - --version (boolean): Show version
263
+
264
+ - --schema (boolean): Show command, input and result schemas
265
+
266
+ - --wait-seconds (string): Wait up to this many seconds (0-170) for a pending browser approval; returns as soon as it is approved; default "0"
267
+
268
+ - --client-id (string): Client ID to manage; defaults to LXZ_AUTH_CLIENT_ID
269
+
270
+ Result schema:
271
+
272
+ ```json
273
+ {
274
+ "type": "object",
275
+ "properties": {
276
+ "authorized": {
277
+ "type": "boolean",
278
+ "description": "Local session exists within its refresh lifetime; server status has not been checked"
279
+ },
280
+ "account": {
281
+ "type": "string",
282
+ "description": "Backend account ID; defaults to token sub, which may differ from the login name"
283
+ },
284
+ "loginName": {
285
+ "type": "string",
286
+ "description": "Backend login name from token name; omitted when unavailable"
287
+ },
288
+ "clientId": {
289
+ "type": "string",
290
+ "description": "CLI client ID, separate from account identity"
291
+ },
292
+ "displayName": {
293
+ "type": "string",
294
+ "description": "Backend display name; omitted when unavailable"
295
+ },
296
+ "accessExpiresAt": {
297
+ "type": "number"
298
+ },
299
+ "refreshExpiresAt": {
300
+ "type": "number"
301
+ },
302
+ "next": {
303
+ "type": "string",
304
+ "description": "What to do when the approval did not arrive in time"
305
+ }
306
+ },
307
+ "required": [
308
+ "authorized"
309
+ ]
310
+ }
311
+ ```
312
+
313
+ **pwsh / bash**
314
+
315
+ ```sh
316
+ pnpm dlx @tulcn/lxz auth status --json --non-interactive
317
+ ```
318
+
319
+ **pwsh / bash**
320
+
321
+ ```sh
322
+ pnpm dlx @tulcn/lxz auth status --wait-seconds 170 --json --non-interactive
323
+ ```
324
+
325
+ ### lxz doctor
326
+
327
+ Check runtime, package registry, authorization service and local session without logging in
328
+
329
+ Effects: none; Preview: false.
330
+
331
+ - --json (boolean): Return a JSON receipt instead of compact rows; use for programmatic parsing; default false
332
+
333
+ - --non-interactive (boolean): Use command parameters without interactive prompts; default false
334
+
335
+ - --timeout-ms (string): Non-interactive deadline in ms (1-3600000); interactive prompts exit after 60 seconds without input; default "120000"
336
+
337
+ - --help (boolean): Show help for this command or group; same as -h
338
+
339
+ - --version (boolean): Show version
340
+
341
+ - --schema (boolean): Show command, input and result schemas
342
+
343
+ - --client-id (string): Client ID to check; defaults to LXZ_AUTH_CLIENT_ID
344
+
345
+ Result schema:
346
+
347
+ ```json
348
+ {
349
+ "type": "object",
350
+ "required": [
351
+ "checks",
352
+ "healthy"
353
+ ]
354
+ }
355
+ ```
356
+
357
+ **pwsh / bash**
358
+
359
+ ```sh
360
+ pnpm dlx @tulcn/lxz doctor --json --non-interactive
361
+ ```
362
+
363
+ **pwsh / bash**
364
+
365
+ ```sh
366
+ pnpm dlx @tulcn/lxz doctor --client-id crm-demo1 --json --non-interactive
367
+ ```
368
+
369
+ ### lxz install skill
370
+
371
+ Install the bundled Skill for this version; synchronize registered directories on upgrade or rollback
372
+
373
+ Effects: local; Preview: false.
374
+
375
+ - --json (boolean): Return a JSON receipt instead of compact rows; use for programmatic parsing; default false
376
+
377
+ - --non-interactive (boolean): Use command parameters without interactive prompts; default false
378
+
379
+ - --timeout-ms (string): Non-interactive deadline in ms (1-3600000); interactive prompts exit after 60 seconds without input; default "120000"
380
+
381
+ - --help (boolean): Show help for this command or group; same as -h
382
+
383
+ - --version (boolean): Show version
384
+
385
+ - --schema (boolean): Show command, input and result schemas
386
+
387
+ - --skills-dir (string): Skills root; overrides LXZ_SKILLS_DIR. First install targets ~/.agents/skills and ~/.linkwise/skills (Linkwise)
388
+
389
+ - --skill-conflict (string): Local changes: error keeps them; replace overwrites files managed by this CLI; default "error"; choices ["error","replace"]
390
+
391
+ Result schema:
392
+
393
+ ```json
394
+ {
395
+ "type": "object",
396
+ "required": [
397
+ "installed"
398
+ ],
399
+ "properties": {
400
+ "installed": {
401
+ "type": "array",
402
+ "items": {
403
+ "type": "object",
404
+ "required": [
405
+ "directory",
406
+ "version",
407
+ "action"
408
+ ],
409
+ "properties": {
410
+ "directory": {
411
+ "type": "string"
412
+ },
413
+ "version": {
414
+ "type": "string"
415
+ },
416
+ "action": {
417
+ "enum": [
418
+ "installed",
419
+ "updated",
420
+ "unchanged"
421
+ ]
422
+ }
423
+ }
424
+ }
425
+ }
426
+ }
427
+ }
428
+ ```
429
+
430
+ **pwsh / bash**
431
+
432
+ ```sh
433
+ pnpm dlx @tulcn/lxz install skill
434
+ ```
435
+
436
+ **pwsh / bash**
437
+
438
+ ```sh
439
+ pnpm dlx @tulcn/lxz install skill --skills-dir ./ceshi123/skills --json --non-interactive
440
+ ```
@@ -0,0 +1,12 @@
1
+ # lxz feature map
2
+
3
+ Generated from registered commands. Use this map to locate a task, then read that command help.
4
+
5
+ | Module | Task | Help entry | Effects |
6
+ | --- | --- | --- | --- |
7
+ | authorization | Sign in using a browser and authorize this CLI | `lxz auth login -h` | local |
8
+ | authorization | Show this CLI authorization status and current account | `lxz auth status -h` | none |
9
+ | authorization | Revoke this CLI grant and delete local tokens; other devices and CLIs are unaffected | `lxz auth logout -h` | remote |
10
+ | authorization | Show the local account authorized for this CLI | `lxz auth whoami -h` | none |
11
+ | diagnostics | Check runtime, package registry, authorization service and local session without logging in | `lxz doctor -h` | none |
12
+ | skill | Install the bundled Skill for this version; synchronize registered directories on upgrade or rollback | `lxz install skill -h` | local |