@puyinkai/xiaobao-cli 0.1.0 → 0.1.8

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 (44) hide show
  1. package/dist/{api-Ccj5dLMo.mjs → api-CX99_4K7.mjs} +22 -5
  2. package/dist/{api-client-DwySN6x-.mjs → api-client-zDBFgk0y.mjs} +5 -3
  3. package/dist/{audio-VmDQMq59.mjs → audio-ShfvRomP.mjs} +2 -2
  4. package/dist/{auth-ChHvqjCS.mjs → auth-DpK81Vp5.mjs} +3 -3
  5. package/dist/cli.mjs +15 -11
  6. package/dist/{consultant-ABFTL_jx.mjs → consultant-CS9B42d3.mjs} +1 -1
  7. package/dist/current-CfDExInT.mjs +33 -0
  8. package/dist/{customer-DtSnQqy_.mjs → customer-B1cxRbJ9.mjs} +1 -1
  9. package/dist/{focus-BDYuP2vZ.mjs → focus-DfNPPhm5.mjs} +1 -1
  10. package/dist/{format-BZvv8lYc.mjs → format-yjmxrbNm.mjs} +15 -7
  11. package/dist/{list-Bkyi95YO.mjs → list-CD08BRLk.mjs} +6 -6
  12. package/dist/{list-CzB9_Jho.mjs → list-CKlx8YuL.mjs} +6 -6
  13. package/dist/{list-DW6KAAaC.mjs → list-CnlFIFiY.mjs} +6 -6
  14. package/dist/{list-iwd9cH1I.mjs → list-Cu6WzPpA.mjs} +5 -5
  15. package/dist/{list-CVKSGNu4.mjs → list-D56gEqiB.mjs} +6 -6
  16. package/dist/{list--o5Q_PI8.mjs → list-DCcCS6LM.mjs} +6 -6
  17. package/dist/{list-CGACp0y-.mjs → list-DI1OD95x.mjs} +3 -3
  18. package/dist/login-CUUcjWPd.mjs +156 -0
  19. package/dist/{logout-BJm9pjje.mjs → logout-DP7REhCd.mjs} +10 -7
  20. package/dist/{project-Ba05YzJ5.mjs → project-BuQQewOs.mjs} +3 -2
  21. package/dist/{project-store-Bz5kf-EI.mjs → project-store-CKVJa54T.mjs} +4 -3
  22. package/dist/{qa-D-B9FV9W.mjs → qa-CKsKiQIm.mjs} +5 -5
  23. package/dist/{resistance-Cf7zsdB3.mjs → resistance-DsE-Ha6Y.mjs} +1 -1
  24. package/dist/{text-BLH4R3xv.mjs → text-C3jhdPoe.mjs} +5 -5
  25. package/dist/{token-store-CHZ_rJQk.mjs → token-store-CXizLE2_.mjs} +46 -6
  26. package/dist/{use-DV9Ii3Tn.mjs → use-BZES4FZC.mjs} +2 -2
  27. package/dist/{visit-Ct3Vea8I.mjs → visit-CX0Mc1n6.mjs} +1 -1
  28. package/dist/{whoami-DwTHvI4B.mjs → whoami-CZVez-rm.mjs} +2 -2
  29. package/package.json +2 -2
  30. package/skills/wangxiaobao-audio-query/SKILL.md +51 -106
  31. package/skills/wangxiaobao-audio-wiki/SKILL.md +31 -77
  32. package/skills/wangxiaobao-audio-wiki/references/audio-wiki-schema.md +386 -0
  33. package/skills/wangxiaobao-audio-wiki/references/llm-wiki-ingest.md +450 -0
  34. package/skills/wangxiaobao-customer-focus-query/SKILL.md +37 -87
  35. package/skills/wangxiaobao-customer-query/SKILL.md +41 -90
  36. package/skills/wangxiaobao-customer-resistance-query/SKILL.md +32 -86
  37. package/skills/wangxiaobao-quick-qa/SKILL.md +41 -92
  38. package/skills/wangxiaobao-shared/SKILL.md +194 -0
  39. package/skills/wangxiaobao-switch-project/SKILL.md +51 -77
  40. package/skills/wangxiaobao-visit-query/SKILL.md +41 -88
  41. package/dist/login-BwkrByMm.mjs +0 -91
  42. package/dist/{device-flow-BgsZipYA.mjs → device-flow-D6JVcEap.mjs} +1 -1
  43. /package/dist/{headers-D79npewp.mjs → headers-DSnR4sjk.mjs} +0 -0
  44. /package/dist/{util-DgwkUfV9.mjs → util-CaPQBlNa.mjs} +0 -0
@@ -1,91 +0,0 @@
1
- import { a as resolveConfig, n as pollForToken, r as refreshToken, t as initiateDeviceAuthorization } from "./device-flow-BgsZipYA.mjs";
2
- import { a as writeToken, i as readToken, r as isAccessTokenValid, t as clearToken } from "./token-store-CHZ_rJQk.mjs";
3
- import { n as writeResult, t as writeError } from "./format-BZvv8lYc.mjs";
4
- import { defineCommand } from "citty";
5
- //#region src/commands/auth/login.ts
6
- /**
7
- * `xiaobao-cli auth login` — OAuth 2.0 Device Authorization Grant.
8
- *
9
- * Behaviour:
10
- * 1. Cache hit (valid access_token, no --force) → return immediately.
11
- * 2. Refresh path (cached refresh_token, no --force) → refresh & store.
12
- * 3. Device flow → print verification URL + user_code to stderr (humans see
13
- * it in the terminal), and synchronously poll until success/denial/expiry.
14
- * Polls foreground so the CLI exits with a final structured result on
15
- * stdout (agents waiting on stdout JSON get a definitive answer).
16
- */
17
- var login_default = defineCommand({
18
- meta: {
19
- name: "login",
20
- description: "走 OAuth device flow 登录"
21
- },
22
- args: {
23
- force: {
24
- type: "boolean",
25
- description: "强制清除缓存并重新发起设备授权流程"
26
- },
27
- "api-base": {
28
- type: "string",
29
- description: "覆盖 API base URL"
30
- },
31
- "auth-base": {
32
- type: "string",
33
- description: "覆盖 auth base URL"
34
- },
35
- format: {
36
- type: "string",
37
- default: "json"
38
- }
39
- },
40
- async run({ args }) {
41
- const config = resolveConfig({
42
- apiBase: args["api-base"],
43
- authBase: args["auth-base"]
44
- });
45
- const fmt = args.format;
46
- try {
47
- if (!args.force) {
48
- const cached = await readToken();
49
- if (isAccessTokenValid(cached)) {
50
- writeResult({
51
- source: "cache",
52
- expires_at: cached.expires_at,
53
- scope: cached.scope
54
- }, fmt);
55
- return;
56
- }
57
- if (cached?.refresh_token) try {
58
- const saved = await writeToken(await refreshToken(config, cached.refresh_token));
59
- writeResult({
60
- source: "refresh",
61
- expires_at: saved.expires_at,
62
- scope: saved.scope
63
- }, fmt);
64
- return;
65
- } catch {
66
- await clearToken();
67
- }
68
- } else await clearToken();
69
- const init = await initiateDeviceAuthorization(config);
70
- const verificationUri = init.verification_uri_complete || init.verification_uri;
71
- const expiresMinutes = Math.max(1, Math.round(init.expires_in / 60));
72
- const interval = init.interval ?? 5;
73
- process.stderr.write(`
74
- 请在浏览器中打开以下链接完成登录并授权访问你的旺小宝账号:
75
- \n 🔗 ${verificationUri}\n\n 设备验证码: ${init.user_code}\n 有效期约 ${expiresMinutes} 分钟\n\n等待你在浏览器中确认 ...
76
- `);
77
- const saved = await writeToken(await pollForToken(config, init.device_code, interval, init.expires_in));
78
- writeResult({
79
- source: "device-flow",
80
- expires_at: saved.expires_at,
81
- scope: saved.scope,
82
- message: "登录成功,token 已缓存到 ~/.xiaobao/token.json"
83
- }, fmt);
84
- } catch (err) {
85
- writeError(err, fmt);
86
- process.exit(1);
87
- }
88
- }
89
- });
90
- //#endregion
91
- export { login_default as default };
@@ -1,6 +1,6 @@
1
1
  import { readFileSync } from "node:fs";
2
- import { homedir } from "node:os";
3
2
  import { join } from "node:path";
3
+ import { homedir } from "node:os";
4
4
  //#region src/core/config.ts
5
5
  /**
6
6
  * CLI configuration resolution — flat, host-agnostic version of
File without changes