weaver-work-cli 0.1.73 → 0.1.76

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 (363) hide show
  1. package/README.md +37 -1
  2. package/dist/chunks/{archive-THZV4ND4.js → archive-ENBSUMHV.js} +14 -9
  3. package/dist/chunks/{archive-oa-PQ23OLEV.js → archive-oa-7BFPQ6M5.js} +10 -7
  4. package/dist/chunks/{asset-RGPROZYH.js → asset-V5SUD3PW.js} +10 -7
  5. package/dist/chunks/{asset-idle-Z2PDX7NA.js → asset-idle-3CEL7WFX.js} +7 -4
  6. package/dist/chunks/{attachment-content-R3RPVOYE.js → attachment-content-24RL44SE.js} +3 -3
  7. package/dist/chunks/{blog-7U3QZPIF.js → blog-FLI4SS3P.js} +10 -7
  8. package/dist/chunks/{caizhilian-3AB42GCV.js → caizhilian-7WCTKCCP.js} +10 -7
  9. package/dist/chunks/{calendar-KINM64E4.js → calendar-G726HUUH.js} +10 -7
  10. package/dist/chunks/chunk-257JXJGD.js +30 -0
  11. package/dist/chunks/chunk-2BZ7TY4M.js +49 -0
  12. package/dist/chunks/{chunk-4BXR6CNB.js → chunk-2KW7AI6P.js} +2 -2
  13. package/dist/chunks/{chunk-WM33BSIL.js → chunk-2QCCXPNU.js} +1 -1
  14. package/dist/chunks/chunk-2UV4IZIT.js +473 -0
  15. package/dist/chunks/{chunk-R3MK2RBN.js → chunk-5E2FDXBU.js} +1 -1
  16. package/dist/chunks/{chunk-DRUND2PJ.js → chunk-5QUTQHXF.js} +225 -152
  17. package/dist/chunks/chunk-7DE3VMZD.js +35 -0
  18. package/dist/chunks/{chunk-PAFOLIYQ.js → chunk-AZC53XSQ.js} +1 -1
  19. package/dist/chunks/{chunk-6HT73VOI.js → chunk-BWFCTE43.js} +2 -2
  20. package/dist/chunks/{chunk-4YXAK6OA.js → chunk-FEZK536Z.js} +12 -7
  21. package/dist/chunks/{chunk-IU6UB2TD.js → chunk-FPWCCRKT.js} +48 -6
  22. package/dist/chunks/{chunk-LLCMOZ5L.js → chunk-H6N6U2D6.js} +11 -11
  23. package/dist/chunks/{chunk-54ST55IJ.js → chunk-JJONWB5N.js} +11 -1
  24. package/dist/chunks/{chunk-GWJLAF6B.js → chunk-JWF2R6EQ.js} +0 -462
  25. package/dist/chunks/chunk-KINXYJXM.js +205 -0
  26. package/dist/chunks/{chunk-F4HM25K4.js → chunk-KJA7CRES.js} +1 -1
  27. package/dist/chunks/chunk-L5SCNJKX.js +1166 -0
  28. package/dist/chunks/{chunk-TV46Q4NY.js → chunk-MS7MKBGJ.js} +74 -68
  29. package/dist/chunks/{chunk-XZBYRYWX.js → chunk-NZQRW4KL.js} +2 -2
  30. package/dist/chunks/chunk-OJ4JPD25.js +428 -0
  31. package/dist/chunks/chunk-OVTCWLNQ.js +1346 -0
  32. package/dist/chunks/{chunk-NUP4RYZK.js → chunk-PMRNIGKZ.js} +2 -2
  33. package/dist/chunks/{chunk-2CHGUYMG.js → chunk-Q7RXCK2Y.js} +4 -4
  34. package/dist/chunks/{chunk-AMAPQVBT.js → chunk-QVKRNL7L.js} +286 -305
  35. package/dist/chunks/{chunk-7QFVXP2X.js → chunk-R4PN3OFK.js} +8 -7
  36. package/dist/chunks/{chunk-L7TYG5SN.js → chunk-RVEKGVZU.js} +2 -2
  37. package/dist/chunks/{chunk-2XED2FKY.js → chunk-SQFKBWTR.js} +38 -36
  38. package/dist/chunks/chunk-SU6IJD6D.js +49 -0
  39. package/dist/chunks/{chunk-IBSJJGXL.js → chunk-T7HVQ2WP.js} +2 -2
  40. package/dist/chunks/{chunk-ZWLWXHJC.js → chunk-TBCKK6LH.js} +2 -2
  41. package/dist/chunks/{chunk-JMJBPP4B.js → chunk-UDBQJLQF.js} +2 -2
  42. package/dist/chunks/chunk-UUJK76HV.js +209 -0
  43. package/dist/chunks/{chunk-4I26YMBY.js → chunk-WHI6YAUE.js} +7 -3
  44. package/dist/chunks/{chunk-BWYVS62Z.js → chunk-WJQJ7YEX.js} +4 -4
  45. package/dist/chunks/{chunk-GAMGDNTF.js → chunk-XNN5PZTI.js} +1 -1
  46. package/dist/chunks/chunk-Y3C6MDL7.js +28 -0
  47. package/dist/chunks/chunk-ZM7RN2IM.js +38 -0
  48. package/dist/chunks/cli-DFLV57LO.js +226 -0
  49. package/dist/chunks/commands-J52MJ6NF.js +70 -0
  50. package/dist/chunks/{conflict-VPAR7E6F.js → conflict-72Q6DM4I.js} +2 -2
  51. package/dist/chunks/{contract-DDXAO2DZ.js → contract-IRNRQ5FY.js} +12446 -5964
  52. package/dist/chunks/{cowork-34QCHMDD.js → cowork-GZDODGKF.js} +11 -8
  53. package/dist/chunks/{create-flow-52PU2OBI.js → create-flow-UGTDI7SP.js} +6 -6
  54. package/dist/chunks/{data-CLQ62QGD.js → data-HTQZRPPI.js} +6 -3
  55. package/dist/chunks/{ebuilder-form-W5R7Q22S.js → ebuilder-form-GHNIZ7ET.js} +9 -6
  56. package/dist/chunks/{ehr-LCNAVMK5.js → ehr-PHIBBUIG.js} +23 -16
  57. package/dist/chunks/{entry-mode-6Z3ZV3DE.js → entry-mode-5WOXFE67.js} +3 -3
  58. package/dist/chunks/{env-RDKWAARB.js → env-H4ALHESA.js} +2 -2
  59. package/dist/chunks/{esb-ANKPUU65.js → esb-ATRKVHCD.js} +10 -7
  60. package/dist/chunks/{factory-434B7RAT.js → factory-COX6AVK7.js} +1 -1
  61. package/dist/chunks/{fna-AKBSG5HI.js → fna-IKYI3SST.js} +13 -8
  62. package/dist/chunks/{group-chat-PROTW22R.js → group-chat-ZIWQQO4G.js} +3 -3
  63. package/dist/chunks/{host-5R2SNFWD.js → host-6UOXYOOY.js} +6 -3
  64. package/dist/chunks/{host-7FJW4E7R.js → host-EJSJSLVK.js} +6 -3
  65. package/dist/chunks/{host-WO4L5G5I.js → host-EYNLB6S4.js} +6 -3
  66. package/dist/chunks/{host-PDJAKCT7.js → host-OT4KNR3G.js} +6 -3
  67. package/dist/chunks/{host-CGXUFQO4.js → host-UY4LQPN4.js} +6 -3
  68. package/dist/chunks/{host-XIYG4F4B.js → host-XXGDQM7D.js} +6 -3
  69. package/dist/chunks/{hrm-WGODDTEH.js → hrm-5JQ7QZ6A.js} +8 -5
  70. package/dist/chunks/{im-YKTKAJU3.js → im-2YJW3EI5.js} +7 -4
  71. package/dist/chunks/{invoice-PVYCCCVM.js → invoice-37HR6L3W.js} +956 -566
  72. package/dist/chunks/{jiuchuanhui-RKOQW7BY.js → jiuchuanhui-KBWUZ7WT.js} +17 -10
  73. package/dist/chunks/{lazy-dispatch-DW45AFQ5.js → lazy-dispatch-MZ3EZYDL.js} +22 -8
  74. package/dist/chunks/{mail-BNB5S4NW.js → mail-YBKUM6HM.js} +11 -8
  75. package/dist/chunks/{meeting-O2KDJH66.js → meeting-XE6CTXYA.js} +22 -18
  76. package/dist/chunks/{minute-doc-JUCG56GY.js → minute-doc-4BA2R5EA.js} +4 -4
  77. package/dist/chunks/{okr-LWFGWOE7.js → okr-HW7IULIR.js} +10 -7
  78. package/dist/chunks/{operations-532PN5OB.js → operations-4P2UYVLH.js} +7 -4
  79. package/dist/chunks/{performance-7W5COCFU.js → performance-PM2G6L3E.js} +6 -3
  80. package/dist/chunks/{plan-ZVY3IYTL.js → plan-3YYGZ7ZM.js} +10 -7
  81. package/dist/chunks/{project-SA62B7MH.js → project-XREEXFU2.js} +10 -7
  82. package/dist/chunks/{reception-NGIONPQ3.js → reception-7G3J2MA6.js} +8 -4
  83. package/dist/chunks/{recruit-stage-WOSN6MGP.js → recruit-stage-TSQWOGQD.js} +199 -74
  84. package/dist/chunks/register-SQOPIR2G.js +16 -0
  85. package/dist/chunks/{registry-N7P3W2RD.js → registry-3VTB3KLV.js} +7 -4
  86. package/dist/chunks/registry-7UDUWYB5.js +30 -0
  87. package/dist/chunks/{registry-R72GWXOG.js → registry-F4YFZLOD.js} +7 -3
  88. package/dist/chunks/{room-recommend-KCGIVUFR.js → room-recommend-FO3HLPNB.js} +4 -4
  89. package/dist/chunks/root-YZG2TS5W.js +16 -0
  90. package/dist/chunks/{schedule-6UP27HQ4.js → schedule-DHNNOHVS.js} +4 -4
  91. package/dist/chunks/{smart-extract-DDOQSPRB.js → smart-extract-T5Z4AULN.js} +15 -7
  92. package/dist/chunks/update-AV5VOXGY.js +13 -0
  93. package/dist/chunks/{workflow-V5ALD6QZ.js → workflow-MAGCHWYZ.js} +15 -10
  94. package/dist/cli.js +40 -0
  95. package/dist/cmd/action.js +3 -1
  96. package/dist/cmd/doctor/index.js +1 -1
  97. package/dist/cmd/e10/index.js +1 -1
  98. package/dist/cmd/identity/index.js +5 -8
  99. package/dist/cmd/index.js +2 -0
  100. package/dist/cmd/setup/index.js +1 -1
  101. package/dist/cmd/update/index.js +38 -0
  102. package/dist/core/manifest-view.js +1 -1
  103. package/dist/core/output.js +8 -1
  104. package/dist/core/runtime-agent.js +13 -0
  105. package/dist/core/update-notice.js +23 -0
  106. package/dist/index.js +105 -198
  107. package/dist/internal/e10/auth/agent-host-key.js +16 -0
  108. package/dist/internal/e10/auth/agent-hosts.js +45 -9
  109. package/dist/internal/e10/auth/commands.js +66 -36
  110. package/dist/internal/e10/auth/session.js +30 -15
  111. package/dist/internal/e10/auth/xiaoe.js +4 -20
  112. package/dist/internal/e10/auth-recovery.js +44 -4
  113. package/dist/internal/e10/context.js +5 -2
  114. package/dist/internal/update/bootstrap.js +96 -0
  115. package/dist/internal/update/npm.js +78 -0
  116. package/dist/internal/update/service.js +252 -0
  117. package/dist/internal/update/store.js +135 -0
  118. package/dist/shortcuts/archive/index.js +2 -2
  119. package/dist/shortcuts/archive/manifest.js +1 -0
  120. package/dist/shortcuts/archive/operations/search.js +3 -1
  121. package/dist/shortcuts/archive-oa/index.js +1 -1
  122. package/dist/shortcuts/asset/index.js +1 -1
  123. package/dist/shortcuts/asset-idle/index.js +1 -1
  124. package/dist/shortcuts/blog/index.js +1 -1
  125. package/dist/shortcuts/caizhilian/index.js +1 -1
  126. package/dist/shortcuts/calendar/index.js +1 -1
  127. package/dist/shortcuts/contract/data/bi-config.js +156 -0
  128. package/dist/shortcuts/contract/data/collection-ledger-html.js +189 -0
  129. package/dist/shortcuts/contract/data/collection-node-catalog.js +226 -0
  130. package/dist/shortcuts/contract/data/metric-catalog.js +154 -20
  131. package/dist/shortcuts/contract/data/report-renderers.js +414 -0
  132. package/dist/shortcuts/contract/data/report-spec.js +132 -0
  133. package/dist/shortcuts/contract/error-actions.js +114 -0
  134. package/dist/shortcuts/contract/host.js +12 -3
  135. package/dist/shortcuts/contract/index.js +17 -1
  136. package/dist/shortcuts/contract/manifest.js +398 -3
  137. package/dist/shortcuts/contract/ooxml/docx-table.js +48 -0
  138. package/dist/shortcuts/contract/operations/bi-preview.js +131 -0
  139. package/dist/shortcuts/contract/operations/bizreview-report.js +496 -0
  140. package/dist/shortcuts/contract/operations/collection-node.js +229 -0
  141. package/dist/shortcuts/contract/operations/docx-slots.js +735 -16
  142. package/dist/shortcuts/contract/operations/draft-build.js +940 -0
  143. package/dist/shortcuts/contract/operations/draft-submit.js +229 -0
  144. package/dist/shortcuts/contract/operations/first-screen.js +3 -2
  145. package/dist/shortcuts/contract/operations/generated-submit.js +175 -0
  146. package/dist/shortcuts/contract/operations/ledger-report.js +233 -0
  147. package/dist/shortcuts/contract/operations/ledger-stat.js +1400 -0
  148. package/dist/shortcuts/contract/operations/ledger.js +4 -1
  149. package/dist/shortcuts/contract/operations/metrics.js +9 -3
  150. package/dist/shortcuts/contract/operations/ops-draft.js +527 -0
  151. package/dist/shortcuts/contract/operations/page.js +9 -0
  152. package/dist/shortcuts/contract/operations/quote-submit.js +55 -229
  153. package/dist/shortcuts/contract/operations/registry.js +20 -0
  154. package/dist/shortcuts/contract/operations/sign-launch.js +256 -0
  155. package/dist/shortcuts/contract/operations/viewlink.js +334 -0
  156. package/dist/shortcuts/cowork/index.js +2 -2
  157. package/dist/shortcuts/ebuilder-form/index.js +1 -1
  158. package/dist/shortcuts/ehr/index.js +2 -2
  159. package/dist/shortcuts/ehr/manifest.js +1 -1
  160. package/dist/shortcuts/ehr/operations/recruit-position.js +7 -2
  161. package/dist/shortcuts/ehr/operations/recruit-write.js +7 -6
  162. package/dist/shortcuts/ehr/operations/recruit.js +318 -248
  163. package/dist/shortcuts/ehr/operations/shared.js +22 -2
  164. package/dist/shortcuts/esb/index.js +1 -1
  165. package/dist/shortcuts/fna/index.js +1 -1
  166. package/dist/shortcuts/fna/manifest.js +1 -0
  167. package/dist/shortcuts/fna/operations/expense-chart.js +3 -1
  168. package/dist/shortcuts/hrm/index.js +1 -1
  169. package/dist/shortcuts/invoice/business-response.js +13 -0
  170. package/dist/shortcuts/invoice/calendar.js +24 -0
  171. package/dist/shortcuts/invoice/host.js +26 -15
  172. package/dist/shortcuts/invoice/index.js +3 -3
  173. package/dist/shortcuts/invoice/invoice-record.js +7 -2
  174. package/dist/shortcuts/invoice/manifest.js +179 -155
  175. package/dist/shortcuts/invoice/operations/get.js +9 -3
  176. package/dist/shortcuts/invoice/operations/issuing-red-requests.js +138 -0
  177. package/dist/shortcuts/invoice/operations/registry.js +4 -5
  178. package/dist/shortcuts/invoice/operations/reim-auto.js +40 -2
  179. package/dist/shortcuts/invoice/operations/reim-customer-projects.js +79 -0
  180. package/dist/shortcuts/invoice/operations/reim-customer.js +79 -30
  181. package/dist/shortcuts/invoice/operations/reim-relation.js +0 -146
  182. package/dist/shortcuts/invoice/operations/reim.js +2 -126
  183. package/dist/shortcuts/invoice/operations/shared.js +15 -17
  184. package/dist/shortcuts/invoice/preapproval-enrichment.js +180 -0
  185. package/dist/shortcuts/invoice/projection.js +14 -0
  186. package/dist/shortcuts/invoice/read-enrichment.js +123 -0
  187. package/dist/shortcuts/jiuchuanhui/index.js +2 -2
  188. package/dist/shortcuts/jiuchuanhui/manifest.js +3 -0
  189. package/dist/shortcuts/mail/index.js +2 -2
  190. package/dist/shortcuts/meeting/index.js +1 -1
  191. package/dist/shortcuts/meeting/manifest.js +1 -0
  192. package/dist/shortcuts/meeting/operations/eb/catalog.js +5 -3
  193. package/dist/shortcuts/meeting/operations/eb/conflict.js +3 -1
  194. package/dist/shortcuts/meeting/operations/eb/create-flow.js +10 -9
  195. package/dist/shortcuts/meeting/operations/eb/factory.js +2 -0
  196. package/dist/shortcuts/meeting/operations/eb/member-expand.js +3 -2
  197. package/dist/shortcuts/meeting/operations/invitation-publish.js +3 -3
  198. package/dist/shortcuts/meeting/operations/invitation.js +4 -4
  199. package/dist/shortcuts/meeting/operations/link.js +3 -1
  200. package/dist/shortcuts/okr/index.js +1 -1
  201. package/dist/shortcuts/performance/index.js +1 -1
  202. package/dist/shortcuts/plan/index.js +1 -1
  203. package/dist/shortcuts/project/index.js +1 -1
  204. package/dist/shortcuts/reception/manifest.js +2 -2
  205. package/dist/shortcuts/recruit-stage/context.js +10 -2
  206. package/dist/shortcuts/recruit-stage/index.js +16 -3
  207. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +1 -1
  208. package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +1 -1
  209. package/dist/shortcuts/recruit-stage/operations/jd-create.js +17 -8
  210. package/dist/shortcuts/recruit-stage/operations/list.js +1 -1
  211. package/dist/shortcuts/recruit-stage/operations/resume-import.js +178 -35
  212. package/dist/shortcuts/recruit-stage/operations/search.js +2 -2
  213. package/dist/shortcuts/recruit-stage/operations/shortlist.js +4 -2
  214. package/dist/shortcuts/recruit-stage/shared.js +27 -53
  215. package/dist/shortcuts/smart-extract/manifest.js +1 -0
  216. package/dist/shortcuts/smart-extract/operations/fill.js +7 -2
  217. package/dist/shortcuts/smart-extract/operations/validate.js +4 -1
  218. package/dist/shortcuts/workflow/index.js +2 -2
  219. package/dist/shortcuts/workflow/manifest.js +1 -0
  220. package/dist/shortcuts/workflow/operations/aiDeepRead/render.js +4 -1
  221. package/dist/shortcuts/workflow/operations/deepRead.js +23 -2
  222. package/dist/shortcuts/workflow/operations/form.js +8 -2
  223. package/docs/agent-invoice.md +28 -2
  224. package/docs/contract.md +6 -1
  225. package/docs/e10-auth.md +25 -7
  226. package/docs/invoice.md +60 -9
  227. package/docs/operation-manual.md +15 -0
  228. package/package.json +2 -2
  229. package/skill-template/business-info.json +28 -0
  230. package/skill-template/domains/jinchengda.md +13 -1
  231. package/skill-template/domains/yepiaotong.md +36 -7
  232. package/skills/weaver-e10-archive-oa/references/source-manifest.json +3 -3
  233. package/skills/weaver-e10-caizhilian/references/auth-and-install.md +2 -1
  234. package/skills/weaver-e10-caizhilian/references/source-manifest.json +3 -3
  235. package/skills/weaver-e10-esb/references/source-manifest.json +3 -3
  236. package/skills/weaver-e10-jinchengda/SKILL.md +90 -32
  237. package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +45 -0
  238. package/skills/weaver-e10-jinchengda/references/contract-bizreview-report-template.html +68 -0
  239. package/skills/weaver-e10-jinchengda/references/contract-bizreview.md +216 -0
  240. package/skills/weaver-e10-jinchengda/references/contract-clause-negotiate.md +215 -0
  241. package/skills/weaver-e10-jinchengda/references/contract-collection-node.md +113 -0
  242. package/skills/weaver-e10-jinchengda/references/contract-command-index.md +19 -3
  243. package/skills/weaver-e10-jinchengda/references/contract-decisions.md +114 -0
  244. package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +53 -44
  245. package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +1 -1
  246. package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +1 -1
  247. package/skills/weaver-e10-jinchengda/references/contract-firstscreen-guide.md +200 -0
  248. package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +18 -1
  249. package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +138 -3
  250. package/skills/weaver-e10-jinchengda/references/contract-ledger-report.md +158 -0
  251. package/skills/weaver-e10-jinchengda/references/contract-ledger-rules.md +3 -1
  252. package/skills/weaver-e10-jinchengda/references/contract-material-gap.md +139 -0
  253. package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +2 -2
  254. package/skills/weaver-e10-jinchengda/references/contract-open-web-pages.md +10 -3
  255. package/skills/weaver-e10-jinchengda/references/contract-ops-draft.md +106 -0
  256. package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +1 -1
  257. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +176 -56
  258. package/skills/weaver-e10-jinchengda/references/contract-sign-launch.md +123 -0
  259. package/skills/weaver-e10-jinchengda/references/contract-smart-draft.md +410 -0
  260. package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +1 -1
  261. package/skills/weaver-e10-jinchengda/references/contract-viewlink.md +110 -0
  262. package/skills/weaver-e10-jinchengda/references/orchestration.md +38 -24
  263. package/skills/weaver-e10-meeting/SKILL.md +13 -0
  264. package/skills/weaver-e10-okr/SKILL.md +11 -0
  265. package/skills/weaver-e10-okr/references/source-manifest.json +7 -6
  266. package/skills/weaver-e10-performance/SKILL.md +131 -39
  267. package/skills/weaver-e10-performance/agents/openai.yaml +48 -17
  268. package/skills/weaver-e10-performance/references/default-assembly.md +3 -0
  269. package/skills/weaver-e10-performance/references/extraction-guide.md +17 -3
  270. package/skills/weaver-e10-performance/references/flow-assess.md +38 -5
  271. package/skills/weaver-e10-performance/references/scheme-setting-page.md +20 -3
  272. package/skills/weaver-e10-performance/scripts/assemble_scheme.py +461 -0
  273. package/skills/weaver-e10-performance/scripts/parse_appraisal_doc.py +41 -0
  274. package/skills/weaver-e10-plan/SKILL.md +10 -0
  275. package/skills/weaver-e10-plan/references/source-manifest.json +13 -13
  276. package/skills/weaver-e10-qiyecheng/SKILL.md +2 -2
  277. package/skills/weaver-e10-qiyecheng/references/source-manifest.json +9 -9
  278. package/skills/weaver-e10-recruit-stage/SKILL.md +230 -202
  279. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +74 -46
  280. package/skills/weaver-e10-recruit-stage/lib/interview-conflict.mjs +3 -0
  281. package/skills/weaver-e10-recruit-stage/lib/interview-summary.mjs +201 -36
  282. package/skills/weaver-e10-recruit-stage/lib/recruit-shortlist.mjs +336 -27
  283. package/skills/weaver-e10-recruit-stage/lib/recruit-write-helper.mjs +3 -0
  284. package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +15 -1
  285. package/skills/weaver-e10-recruit-stage/lib/report-attachment.mjs +38 -0
  286. package/skills/weaver-e10-recruit-stage/lib/xiaoe-session.mjs +5 -1
  287. package/skills/weaver-e10-recruit-stage/references/env-fixed-values.md +4 -0
  288. package/skills/weaver-e10-recruit-stage/references/env-ziyong.md +4 -0
  289. package/skills/weaver-e10-recruit-stage/references/position-templates.md +12 -8
  290. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +20 -18
  291. package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +11 -7
  292. package/skills/weaver-e10-recruit-stage/references/recruit-check-install.md +5 -1
  293. package/skills/weaver-e10-recruit-stage/references/recruit-detail-process.md +4 -0
  294. package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +8 -4
  295. package/skills/weaver-e10-recruit-stage/references/recruit-failure-fallback.md +6 -1
  296. package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +7 -3
  297. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +32 -25
  298. package/skills/weaver-e10-recruit-stage/references/recruit-jd-template.md +4 -0
  299. package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +4 -0
  300. package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +5 -1
  301. package/skills/weaver-e10-recruit-stage/references/recruit-maint.md +4 -0
  302. package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +16 -10
  303. package/skills/weaver-e10-recruit-stage/references/recruit-my-positions.md +6 -2
  304. package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +148 -40
  305. package/skills/weaver-e10-recruit-stage/references/recruit-platform-compat.md +5 -1
  306. package/skills/weaver-e10-recruit-stage/references/recruit-report-templates.md +32 -8
  307. package/skills/weaver-e10-recruit-stage/references/recruit-resolve-creator.md +4 -0
  308. package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +8 -4
  309. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +6 -2
  310. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +41 -41
  311. package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +7 -3
  312. package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +7 -3
  313. package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +8 -4
  314. package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +5 -1
  315. package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +5 -1
  316. package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +5 -1
  317. package/skills/weaver-e10-recruit-stage/templates/candidate-evidence.html +41 -28
  318. package/skills/weaver-e10-recruit-stage/templates/interview-summary.html +23 -26
  319. package/skills/weaver-e10-recruit-stage/templates/match-report.html +44 -36
  320. package/skills/weaver-e10-shared/SKILL.md +40 -5
  321. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +11 -1
  322. package/skills/weaver-e10-shared/references/json-output-contract.md +144 -8
  323. package/skills/weaver-e10-shared/references/weaver-e10-installation.md +11 -0
  324. package/skills/weaver-e10-shijingran/references/source-manifest.json +3 -3
  325. package/skills/weaver-e10-wenshuding/references/source-manifest.json +3 -3
  326. package/skills/weaver-e10-workflow/references/source-manifest.json +3 -3
  327. package/skills/weaver-e10-yepiaotong/SKILL.md +133 -61
  328. package/skills/weaver-e10-yepiaotong/references/invoice-add.md +3 -1
  329. package/skills/weaver-e10-yepiaotong/references/invoice-detail.md +18 -2
  330. package/skills/weaver-e10-yepiaotong/references/invoice-disabled-capabilities.md +3 -3
  331. package/skills/weaver-e10-yepiaotong/references/invoice-download.md +1 -1
  332. package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +13 -1
  333. package/skills/weaver-e10-yepiaotong/references/invoice-file-upload.md +3 -1
  334. package/skills/weaver-e10-yepiaotong/references/invoice-import.md +6 -4
  335. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +42 -45
  336. package/skills/weaver-e10-yepiaotong/references/invoice-ocr-preview.md +1 -1
  337. package/skills/weaver-e10-yepiaotong/references/invoice-output-view.md +18 -2
  338. package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +14 -1
  339. package/skills/weaver-e10-yepiaotong/references/invoice-red-workflow.md +96 -0
  340. package/skills/weaver-e10-yepiaotong/references/invoice-reim-relation.md +56 -369
  341. package/skills/weaver-e10-yepiaotong/references/invoice-upload-and-validate.md +16 -6
  342. package/skills/weaver-e10-yepiaotong/references/name-fuzzy-search.md +38 -0
  343. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +163 -646
  344. package/skills/weaver-e10-yepiaotong/references/reim-customer-search.md +90 -44
  345. package/skills/weaver-e10-yepiaotong/references/reim-eligibility-rules.md +85 -0
  346. package/skills/weaver-e10-yepiaotong/references/reim-fill-validation.md +61 -0
  347. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +91 -280
  348. package/skills/weaver-e10-yepiaotong/references/reim-preapproval-rules.md +98 -0
  349. package/skills/weaver-e10-yepiaotong/references/reim-travel-invoice-matching.md +48 -0
  350. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +234 -695
  351. package/skills/weaver-e10-yepiaotong/references/source-manifest.json +395 -204
  352. package/skills/weaver-e10-yepiaotong/references/travel-application-fill.md +84 -0
  353. package/skills/weaver-e10-yepiaotong/references/workflow-direct-fill.md +165 -0
  354. package/skills/weaver-e10-yepiaotong.zip +0 -0
  355. package/dist/chunks/chunk-ICP53R52.js +0 -2849
  356. package/dist/chunks/registry-RIQ67ZT7.js +0 -27
  357. package/scripts/pysite/__pycache__/sitecustomize.cpython-312.pyc +0 -0
  358. package/scripts/pysite/__pycache__/sitecustomize.cpython-313.pyc +0 -0
  359. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +0 -93
  360. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +0 -774
  361. package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +0 -111
  362. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +0 -360
  363. package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +0 -167
@@ -0,0 +1,1166 @@
1
+ import { createRequire as __esbuildCreateRequire } from 'node:module';
2
+ const require = __esbuildCreateRequire(import.meta.url);
3
+ import {
4
+ charsOf,
5
+ defaultResultThresholdChars,
6
+ listRefs,
7
+ pickValue,
8
+ pruneRefs,
9
+ readRef,
10
+ readTextWindow,
11
+ readWindow,
12
+ refMaxBytes,
13
+ refMaxCount,
14
+ resultThresholdChars
15
+ } from "./chunk-JJONWB5N.js";
16
+ import {
17
+ refsDir
18
+ } from "./chunk-AJ62BGAW.js";
19
+ import {
20
+ updateCommand
21
+ } from "./chunk-SU6IJD6D.js";
22
+ import {
23
+ registerE10AuthCommands
24
+ } from "./chunk-OVTCWLNQ.js";
25
+ import {
26
+ requireE10Session
27
+ } from "./chunk-FPWCCRKT.js";
28
+ import {
29
+ E10AuthSession,
30
+ findAuthFile,
31
+ resolveActiveProfileForHost
32
+ } from "./chunk-QVKRNL7L.js";
33
+ import {
34
+ packageFileUrl,
35
+ packagePath
36
+ } from "./chunk-2BZ7TY4M.js";
37
+ import {
38
+ CliError
39
+ } from "./chunk-UG5G54VL.js";
40
+
41
+ // src/cmd/auth/index.ts
42
+ var authCommand = {
43
+ name: "auth",
44
+ description: "E10 auth and profile management",
45
+ category: "platform",
46
+ register({ program, action }) {
47
+ registerE10AuthCommands(program, action);
48
+ }
49
+ };
50
+
51
+ // src/cmd/commands/index.ts
52
+ var commandsCommand = {
53
+ name: "commands",
54
+ description: "Registered command discovery",
55
+ category: "system",
56
+ register({ program, action }) {
57
+ const commands = program.command("commands").alias("module").description("Inspect registered commands");
58
+ commands.command("list").description("List registered commands").action(action((ctx) => {
59
+ ctx.output.write({ commands: ctx.commands, modules: ctx.modules });
60
+ }));
61
+ }
62
+ };
63
+
64
+ // src/cmd/config/index.ts
65
+ function parseValue(value) {
66
+ if (value === "true") return true;
67
+ if (value === "false") return false;
68
+ if (value === "null") return null;
69
+ if (/^-?\d+(\.\d+)?$/.test(value)) return Number(value);
70
+ try {
71
+ return JSON.parse(value);
72
+ } catch {
73
+ return value;
74
+ }
75
+ }
76
+ var configCommand = {
77
+ name: "config",
78
+ description: "Generic local configuration commands",
79
+ category: "system",
80
+ register({ program, action }) {
81
+ const config = program.command("config").description("Manage weaver-work-cli config");
82
+ config.command("path").description("Print the active config file path").action(action((ctx) => {
83
+ ctx.output.write({ path: ctx.config.path() }, { text: ctx.config.path() });
84
+ }));
85
+ config.command("list").description("Print all config values").action(action((ctx) => {
86
+ ctx.output.write(ctx.config.all());
87
+ }));
88
+ config.command("get").description("Print one config value").argument("<key>", "config key").action(action((ctx, key) => {
89
+ if (typeof key !== "string") throw new CliError("key must be a string", 2 /* UsageError */);
90
+ ctx.output.write({ key, value: ctx.config.get(key) });
91
+ }));
92
+ config.command("set").description("Set one config value").argument("<key>", "config key").argument("<value>", "config value").action(action((ctx, key, value) => {
93
+ if (typeof key !== "string" || typeof value !== "string") {
94
+ throw new CliError("key and value must be strings", 2 /* UsageError */);
95
+ }
96
+ const parsed = parseValue(value);
97
+ ctx.config.set(key, parsed);
98
+ ctx.output.write({ key, value: parsed, path: ctx.config.path() }, { text: "Saved " + key });
99
+ }));
100
+ config.command("delete").description("Delete one config value").argument("<key>", "config key").action(action((ctx, key) => {
101
+ if (typeof key !== "string") throw new CliError("key must be a string", 2 /* UsageError */);
102
+ const deleted = ctx.config.delete(key);
103
+ ctx.output.write({ key, deleted, path: ctx.config.path() }, { text: deleted ? "Deleted " + key : "No value for " + key });
104
+ }));
105
+ }
106
+ };
107
+
108
+ // src/cmd/docs/index.ts
109
+ import { cpSync, existsSync, readdirSync, readFileSync } from "node:fs";
110
+ import { resolve } from "node:path";
111
+ var DOCS_DIR = packagePath("docs");
112
+ var PKG_JSON_URL = packageFileUrl("package.json");
113
+ function packageVersion() {
114
+ try {
115
+ return JSON.parse(readFileSync(PKG_JSON_URL, "utf-8")).version;
116
+ } catch {
117
+ return "unknown";
118
+ }
119
+ }
120
+ function countFiles(dir) {
121
+ let count = 0;
122
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
123
+ const entryPath = resolve(dir, entry.name);
124
+ count += entry.isDirectory() ? countFiles(entryPath) : 1;
125
+ }
126
+ return count;
127
+ }
128
+ function ensureDocs() {
129
+ if (!existsSync(DOCS_DIR)) {
130
+ throw new CliError("docs directory does not exist: " + DOCS_DIR);
131
+ }
132
+ }
133
+ var docsCommand = {
134
+ name: "docs",
135
+ description: "Packaged docs and template copy commands",
136
+ category: "system",
137
+ register({ program, action }) {
138
+ const docs = program.command("docs").description("Read or copy packaged docs");
139
+ docs.command("root").description("Print packaged docs root path").action(action((ctx) => {
140
+ ensureDocs();
141
+ const root = DOCS_DIR.replace(/[\\/]+$/, "");
142
+ ctx.output.write({ root, version: packageVersion() }, { text: root + "\nversion: " + packageVersion() });
143
+ }));
144
+ docs.command("copy").description("Copy packaged docs to <target>/weaver-work-cli-docs").argument("[target]", "target directory", process.cwd()).action(action((ctx, target) => {
145
+ ensureDocs();
146
+ const dest = resolve(String(target || process.cwd()), "weaver-work-cli-docs");
147
+ const sourceRoot = DOCS_DIR.replace(/[\\/]+$/, "");
148
+ if (dest === sourceRoot || dest.startsWith(sourceRoot + "/") || dest.startsWith(sourceRoot + "\\")) {
149
+ throw new CliError("target directory is inside docs source: " + dest);
150
+ }
151
+ cpSync(DOCS_DIR, dest, { recursive: true });
152
+ const files = countFiles(dest);
153
+ ctx.output.write({ files, dest, version: packageVersion() }, { text: "Copied " + files + " files to " + dest });
154
+ }));
155
+ }
156
+ };
157
+
158
+ // src/cmd/doctor/index.ts
159
+ import { existsSync as existsSync2 } from "node:fs";
160
+ function versionMajor(version) {
161
+ return Number(version.replace(/^v/, "").split(".")[0] || 0);
162
+ }
163
+ var doctorCommand = {
164
+ name: "doctor",
165
+ description: "Environment diagnostics",
166
+ category: "system",
167
+ register({ program, action }) {
168
+ program.command("doctor").description("Check local CLI environment").option("--e10", "also check E10 auth file discovery").action(action((ctx, options) => {
169
+ const opts = options && typeof options === "object" ? options : {};
170
+ const checks = [
171
+ {
172
+ name: "node",
173
+ ok: versionMajor(process.version) >= 18,
174
+ detail: process.version
175
+ },
176
+ {
177
+ name: "package",
178
+ ok: Boolean(ctx.packageInfo.version),
179
+ detail: ctx.packageInfo.name + "@" + ctx.packageInfo.version
180
+ },
181
+ {
182
+ name: "configPath",
183
+ ok: true,
184
+ detail: ctx.config.path()
185
+ }
186
+ ];
187
+ if (opts.e10) {
188
+ const authFile = findAuthFile(ctx.cwd, ctx.getGlobalOptions(), ctx.env);
189
+ checks.push({
190
+ name: "e10AuthFile",
191
+ ok: Boolean(authFile && existsSync2(authFile)),
192
+ detail: authFile || "not found"
193
+ });
194
+ }
195
+ const ok = checks.every((check) => check.ok);
196
+ ctx.output.write({ ok, checks });
197
+ }));
198
+ }
199
+ };
200
+
201
+ // src/cmd/e10/index.ts
202
+ var e10Command = {
203
+ name: "e10",
204
+ description: "E10 platform adapter: auth, profiles, and shared API client",
205
+ category: "platform",
206
+ register({ program, ctx, action }) {
207
+ const e10 = program.command("e10").description("E10 platform commands");
208
+ registerE10AuthCommands(e10, action);
209
+ ctx.hooks.register({
210
+ beforeRun(runCtx) {
211
+ const authFile = findAuthFile(runCtx.cwd, ctx.getGlobalOptions(), runCtx.env);
212
+ const session = authFile ? E10AuthSession.fromFile(authFile) : null;
213
+ if (!session) return;
214
+ runCtx.env.WEAVER_BASE_URL ||= session.getBaseUrl();
215
+ runCtx.env.WEAVER_ETEAMSID ||= session.eteamsId;
216
+ runCtx.env.WEAVER_COOKIE ||= session.cookieHeader();
217
+ runCtx.env.WEAVER_USER_AGENT ||= session.uaHeader();
218
+ runCtx.env.WEAVER_AGENT_TYPE ||= session.agentType;
219
+ }
220
+ });
221
+ }
222
+ };
223
+
224
+ // src/cmd/identity/index.ts
225
+ function safeIdentity(session, profile) {
226
+ const pick = (value) => typeof value === "string" ? value : "";
227
+ return {
228
+ employeeId: pick(session.userId),
229
+ tenantKey: pick(session.tenantKey),
230
+ tenantName: pick(session.tenantName),
231
+ department: pick(session.department),
232
+ subcompany: pick(session.subcompany),
233
+ position: pick(session.position),
234
+ version: pick(session.version),
235
+ baseUrl: session.getBaseUrl(),
236
+ profile,
237
+ agentType: pick(session.agentType)
238
+ };
239
+ }
240
+ var identityCommand = {
241
+ name: "identity",
242
+ description: "Print the signed-in identity in a connector-safe JSON form",
243
+ category: "platform",
244
+ register({ program, action }) {
245
+ const identity = program.command("identity").description("Connector contract: report who the current credential belongs to");
246
+ identity.command("whoami").description("Print the signed-in E10 identity as JSON without any credential material").action(action(async (ctx) => {
247
+ const opts = ctx.getGlobalOptions();
248
+ const session = await requireE10Session(ctx, { skipProfileEnrichment: true });
249
+ const profile = opts.profile || resolveActiveProfileForHost(ctx.env, opts);
250
+ ctx.output.raw(JSON.stringify(safeIdentity(session, profile)));
251
+ }));
252
+ }
253
+ };
254
+
255
+ // src/cmd/refs/index.ts
256
+ function parseDuration(value) {
257
+ const raw = value.trim().toLowerCase();
258
+ const matched = /^(\d+)\s*([dhms])?$/.exec(raw);
259
+ if (!matched) {
260
+ throw new CliError(`\u65E0\u6CD5\u89E3\u6790\u65F6\u957F\uFF1A${value}\uFF08\u793A\u4F8B\uFF1A7d\u300124h\u300130m\uFF09`, 2 /* UsageError */);
261
+ }
262
+ const amount = Number(matched[1]);
263
+ const unit = matched[2] ?? "ms";
264
+ const factor = unit === "d" ? 864e5 : unit === "h" ? 36e5 : unit === "m" ? 6e4 : 1;
265
+ return amount * factor;
266
+ }
267
+ function asOptions(value) {
268
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
269
+ }
270
+ var refsCommand = {
271
+ name: "refs",
272
+ description: "Inspect and prune persisted large results",
273
+ category: "system",
274
+ register({ program, action }) {
275
+ const refs = program.command("refs").description("Manage persisted large results");
276
+ refs.command("path").description("Print the directory holding persisted results").action(action((ctx) => {
277
+ const path = refsDir(ctx);
278
+ ctx.output.write({ path }, { text: path });
279
+ }));
280
+ refs.command("list").description("List persisted results, newest first").action(action((ctx) => {
281
+ const now = Date.now();
282
+ const items = listRefs(ctx).filter((row) => Date.parse(row.expiresAt) > now).map((row) => ({
283
+ refId: row.refId,
284
+ operation: row.operation ?? null,
285
+ bytes: row.bytes,
286
+ createdAt: row.createdAt,
287
+ expiresAt: row.expiresAt
288
+ }));
289
+ ctx.output.write({ count: items.length, items });
290
+ }));
291
+ refs.command("show").description("Print one persisted result in full").argument("<refId>", "reference id").action(action((ctx, refId) => {
292
+ const id = String(refId ?? "").trim();
293
+ if (!id) throw new CliError("refId \u4E0D\u80FD\u4E3A\u7A7A", 2 /* UsageError */);
294
+ const record = readRef(ctx, id);
295
+ const configuredLimit = resultThresholdChars(ctx);
296
+ const displayLimit = configuredLimit > 0 ? configuredLimit : defaultResultThresholdChars();
297
+ if (charsOf(record.envelope) > displayLimit) {
298
+ throw new CliError(
299
+ `\u7ED3\u679C\u592A\u5927\uFF0C\u4E0D\u80FD\u5B89\u5168\u5730\u4E00\u6B21\u663E\u793A\u3002\u8BF7\u7528 refs get ${id} <json-path> \u8BFB\u53D6\u9700\u8981\u7684\u5B57\u6BB5\u3002`,
300
+ 2 /* UsageError */
301
+ );
302
+ }
303
+ ctx.output.write(record.envelope, { json: true, persist: false });
304
+ }));
305
+ refs.command("get").description("Print one value from a persisted result by JSON path (large arrays/text are paged)").argument("<refId>", "reference id").argument("<path>", "JSON path, e.g. data.items[0].fid").option("--offset <n>", "array start index, default 0").option("--limit <n>", "how many array items to print").option("--char-offset <n>", "text start position in Unicode characters, default 0").option("--char-limit <n>", "how many Unicode characters to print").action(action((ctx, refId, path, options) => {
306
+ const id = String(refId ?? "").trim();
307
+ const jsonPath = String(path ?? "").trim();
308
+ if (!id || !jsonPath) throw new CliError("refId \u548C JSON \u8DEF\u5F84\u4E0D\u80FD\u4E3A\u7A7A", 2 /* UsageError */);
309
+ const opts = asOptions(options);
310
+ const hasArrayWindow = opts.offset !== void 0 || opts.limit !== void 0;
311
+ const hasTextWindow = opts.charOffset !== void 0 || opts.charLimit !== void 0;
312
+ if (hasArrayWindow && hasTextWindow) {
313
+ throw new CliError("\u6570\u7EC4\u5206\u9875\u53C2\u6570\u4E0E\u6587\u672C\u5206\u6BB5\u53C2\u6570\u4E0D\u80FD\u540C\u65F6\u4F7F\u7528", 2 /* UsageError */);
314
+ }
315
+ const offset = opts.offset === void 0 ? 0 : Number(opts.offset);
316
+ const requestedLimit = opts.limit === void 0 ? void 0 : Number(opts.limit);
317
+ const charOffset = opts.charOffset === void 0 ? 0 : Number(opts.charOffset);
318
+ const requestedCharLimit = opts.charLimit === void 0 ? void 0 : Number(opts.charLimit);
319
+ if (!Number.isInteger(offset) || offset < 0) {
320
+ throw new CliError("--offset \u5FC5\u987B\u662F\u975E\u8D1F\u6574\u6570", 2 /* UsageError */);
321
+ }
322
+ if (requestedLimit !== void 0 && (!Number.isInteger(requestedLimit) || requestedLimit < 1)) {
323
+ throw new CliError("--limit \u5FC5\u987B\u662F\u6B63\u6574\u6570", 2 /* UsageError */);
324
+ }
325
+ if (!Number.isInteger(charOffset) || charOffset < 0) {
326
+ throw new CliError("--char-offset \u5FC5\u987B\u662F\u975E\u8D1F\u6574\u6570", 2 /* UsageError */);
327
+ }
328
+ if (requestedCharLimit !== void 0 && (!Number.isInteger(requestedCharLimit) || requestedCharLimit < 1)) {
329
+ throw new CliError("--char-limit \u5FC5\u987B\u662F\u6B63\u6574\u6570", 2 /* UsageError */);
330
+ }
331
+ const record = readRef(ctx, id);
332
+ const picked = pickValue(record.envelope, jsonPath);
333
+ const configuredLimit = resultThresholdChars(ctx);
334
+ const displayLimit = configuredLimit > 0 ? configuredLimit : defaultResultThresholdChars();
335
+ if (typeof picked === "string") {
336
+ if (hasArrayWindow) {
337
+ throw new CliError("\u5B57\u7B26\u4E32\u8BF7\u4F7F\u7528 --char-offset / --char-limit \u5206\u6BB5\u8BFB\u53D6", 2 /* UsageError */);
338
+ }
339
+ const chars2 = charsOf(picked);
340
+ if (!hasTextWindow && chars2 <= displayLimit) {
341
+ ctx.output.write(picked, { json: true, persist: false });
342
+ return;
343
+ }
344
+ const totalChars = Array.from(picked).length;
345
+ const perChar = totalChars > 0 ? Math.max(1, Math.ceil(chars2 / totalChars)) : 1;
346
+ const autoLimit2 = Math.max(1, Math.floor((displayLimit - 2048) / perChar));
347
+ const pageOf2 = (size3) => {
348
+ const window = readTextWindow(picked, charOffset, size3);
349
+ const nextHint = window.hasMore ? `\u8FD8\u6709 ${window.totalChars - window.charOffset - window.returnedChars} \u5B57\u7B26\uFF1Arefs get ${id} ${jsonPath} --char-offset ${window.nextCharOffset} --char-limit ${size3}` : void 0;
350
+ return {
351
+ operation: "refs.get",
352
+ path: jsonPath,
353
+ unit: "chars",
354
+ totalChars: window.totalChars,
355
+ charOffset: window.charOffset,
356
+ returnedChars: window.returnedChars,
357
+ hasMore: window.hasMore,
358
+ ...window.nextCharOffset === void 0 ? {} : { nextCharOffset: window.nextCharOffset },
359
+ data: window.text,
360
+ ...nextHint === void 0 ? {} : { largeOutputNotice: nextHint }
361
+ };
362
+ };
363
+ let size2 = requestedCharLimit ?? autoLimit2;
364
+ let page2 = pageOf2(size2);
365
+ for (let round = 0; round < 8; round += 1) {
366
+ const pageChars = charsOf(page2);
367
+ if (pageChars <= displayLimit || size2 <= 1) break;
368
+ size2 = Math.max(1, Math.floor(size2 * displayLimit / pageChars) - 1);
369
+ page2 = pageOf2(size2);
370
+ }
371
+ ctx.output.write(page2, { json: true, persist: false });
372
+ return;
373
+ }
374
+ if (hasTextWindow) {
375
+ throw new CliError("--char-offset / --char-limit \u53EA\u80FD\u7528\u4E8E\u5B57\u7B26\u4E32\u5B57\u6BB5", 2 /* UsageError */);
376
+ }
377
+ if (!Array.isArray(picked)) {
378
+ if (hasArrayWindow) {
379
+ throw new CliError("--offset / --limit \u53EA\u80FD\u7528\u4E8E\u6570\u7EC4\u5B57\u6BB5", 2 /* UsageError */);
380
+ }
381
+ const chars2 = charsOf(picked);
382
+ if (chars2 > displayLimit) {
383
+ throw new CliError(
384
+ `${jsonPath} \u662F\u5355\u4E2A\u975E\u6587\u672C\u503C\uFF0C\u7EA6 ${chars2} \u5B57\u7B26\uFF0C\u8D85\u8FC7\u5355\u6B21\u8F93\u51FA\u9884\u7B97 ${displayLimit} \u5B57\u7B26\u3002\u8BF7\u6539\u7528\u66F4\u7EC6\u7684 JSON \u8DEF\u5F84\u53D6\u503C\uFF0C\u6216\u8D70\u4E1A\u52A1\u547D\u4EE4\u7684\u5BFC\u51FA\u80FD\u529B\u3002`,
385
+ 2 /* UsageError */
386
+ );
387
+ }
388
+ ctx.output.write(picked, { json: true, persist: false });
389
+ return;
390
+ }
391
+ const total = picked.length;
392
+ const chars = charsOf(picked);
393
+ const perItem = total > 0 ? Math.max(1, Math.ceil(chars / total)) : 1;
394
+ const autoLimit = Math.max(1, Math.floor((displayLimit - 2048) / perItem));
395
+ const pageOf = (size2) => {
396
+ const window = readWindow(picked, offset, size2);
397
+ const nextHint = window.hasMore ? `\u8FD8\u6709 ${window.total - window.offset - window.returned} \u6761\uFF1Arefs get ${id} ${jsonPath} --offset ${window.nextOffset} --limit ${size2}` : void 0;
398
+ return {
399
+ operation: "refs.get",
400
+ path: jsonPath,
401
+ total: window.total,
402
+ offset: window.offset,
403
+ returned: window.returned,
404
+ hasMore: window.hasMore,
405
+ ...window.nextOffset === void 0 ? {} : { nextOffset: window.nextOffset },
406
+ data: window.items,
407
+ ...nextHint === void 0 ? {} : { largeOutputNotice: nextHint }
408
+ };
409
+ };
410
+ let size = requestedLimit ?? (chars > displayLimit ? autoLimit : Math.max(total - offset, 1));
411
+ let page = pageOf(size);
412
+ for (let round = 0; round < 4; round += 1) {
413
+ const pageChars = charsOf(page);
414
+ if (pageChars <= displayLimit || size <= 1) break;
415
+ size = Math.max(1, Math.floor(size * displayLimit / pageChars) - 1);
416
+ page = pageOf(size);
417
+ }
418
+ ctx.output.write(page, { json: true, persist: false });
419
+ }));
420
+ refs.command("prune").description("Prune persisted results").option("--older-than <duration>", "remove results created before this age, e.g. 7d").option("--all", "remove every persisted result").action(action((ctx, options) => {
421
+ const opts = asOptions(options);
422
+ if (opts.all === true) {
423
+ const result2 = pruneRefs(ctx, { maxCount: 0, maxBytes: 0 });
424
+ ctx.output.write({
425
+ removed: result2.removed,
426
+ kept: result2.kept,
427
+ bytes: result2.bytes,
428
+ cleanupIncomplete: result2.cleanupIncomplete
429
+ });
430
+ return;
431
+ }
432
+ const olderThanMs = opts.olderThan ? parseDuration(String(opts.olderThan)) : void 0;
433
+ const result = pruneRefs(ctx, {
434
+ maxCount: refMaxCount(ctx),
435
+ maxBytes: refMaxBytes(ctx),
436
+ ...olderThanMs === void 0 ? {} : { olderThanMs }
437
+ });
438
+ ctx.output.write({
439
+ removed: result.removed,
440
+ kept: result.kept,
441
+ bytes: result.bytes,
442
+ cleanupIncomplete: result.cleanupIncomplete
443
+ });
444
+ }));
445
+ }
446
+ };
447
+
448
+ // src/cmd/run/index.ts
449
+ import { resolve as resolve2 } from "node:path";
450
+
451
+ // src/services/command-runner.ts
452
+ import { spawn } from "node:child_process";
453
+ var CommandRunner = class {
454
+ constructor(ctx) {
455
+ this.ctx = ctx;
456
+ }
457
+ ctx;
458
+ async run(command, args = [], options = {}) {
459
+ const runContext = {
460
+ cwd: options.cwd || this.ctx.cwd,
461
+ command,
462
+ args,
463
+ env: options.env || this.ctx.env,
464
+ shell: options.shell
465
+ };
466
+ await this.ctx.hooks.beforeRun(runContext);
467
+ const result = await new Promise((resolve6) => {
468
+ const child = spawn(command, args, {
469
+ cwd: runContext.cwd,
470
+ env: runContext.env,
471
+ shell: runContext.shell,
472
+ stdio: options.stdio === "inherit" ? "inherit" : "pipe"
473
+ });
474
+ const stdout = [];
475
+ const stderr = [];
476
+ if (child.stdout) child.stdout.on("data", (chunk) => stdout.push(chunk));
477
+ if (child.stderr) child.stderr.on("data", (chunk) => stderr.push(chunk));
478
+ child.on("close", (code, signal) => {
479
+ resolve6({
480
+ command,
481
+ args,
482
+ cwd: runContext.cwd,
483
+ code,
484
+ signal,
485
+ stdout: Buffer.concat(stdout).toString("utf-8"),
486
+ stderr: Buffer.concat(stderr).toString("utf-8")
487
+ });
488
+ });
489
+ });
490
+ await this.ctx.hooks.afterRun(runContext, result);
491
+ return result;
492
+ }
493
+ };
494
+
495
+ // src/cmd/run/index.ts
496
+ var runCommand = {
497
+ name: "run",
498
+ description: "Generic external command runner with hooks",
499
+ category: "system",
500
+ register({ program, action }) {
501
+ program.command("run").description("Run an external command through the shared command runner").argument("<command>", "command to run").argument("[args...]", "command arguments").option("--cwd <dir>", "working directory").option("--shell", "run through the platform shell").option("--inherit", "inherit stdio instead of capturing output").allowUnknownOption(true).action(action(async (ctx, command, args, options) => {
502
+ if (typeof command !== "string") {
503
+ throw new CliError("command must be a string", 2 /* UsageError */);
504
+ }
505
+ const opts = options && typeof options === "object" ? options : {};
506
+ const result = await new CommandRunner(ctx).run(command, Array.isArray(args) ? args.map(String) : [], {
507
+ cwd: opts.cwd ? resolve2(opts.cwd) : void 0,
508
+ shell: opts.shell,
509
+ stdio: opts.inherit ? "inherit" : "pipe"
510
+ });
511
+ if (!opts.inherit && result.stdout) process.stdout.write(result.stdout);
512
+ if (!opts.inherit && result.stderr) process.stderr.write(result.stderr);
513
+ if (result.code && result.code !== 0) {
514
+ throw new CliError("command exited with code " + result.code, result.code);
515
+ }
516
+ }));
517
+ }
518
+ };
519
+
520
+ // src/cmd/setup/index.ts
521
+ import { existsSync as existsSync4 } from "node:fs";
522
+
523
+ // src/internal/skills/install.ts
524
+ import { cpSync as cpSync2, existsSync as existsSync3, mkdirSync, readFileSync as readFileSync2, readdirSync as readdirSync2, statSync, writeFileSync } from "node:fs";
525
+ import { homedir } from "node:os";
526
+ import { basename, posix, relative, resolve as resolve3, sep, win32 } from "node:path";
527
+ var SKILL_PREFIX = "weaver-e10-";
528
+ var LEGACY_SKILL_PREFIX = "weaver-work-cli-";
529
+ var SHARED_SKILL_NAME = "weaver-e10-shared";
530
+ function envValue(env, name) {
531
+ const direct = env[name];
532
+ if (typeof direct === "string" && direct.trim()) return direct.trim();
533
+ const expected = name.toUpperCase();
534
+ for (const [key, value] of Object.entries(env)) {
535
+ if (key.toUpperCase() === expected && typeof value === "string" && value.trim()) return value.trim();
536
+ }
537
+ return "";
538
+ }
539
+ function hasEnvFamily(env, prefix, ignoredNames = []) {
540
+ const expected = `${prefix.toUpperCase()}_`;
541
+ const ignored = new Set(ignoredNames.map((name) => name.toUpperCase()));
542
+ return Object.entries(env).some(([key, value]) => key.toUpperCase().startsWith(expected) && !ignored.has(key.toUpperCase()) && typeof value === "string" && Boolean(value.trim()));
543
+ }
544
+ function normalizedAgentType(value) {
545
+ const normalized = value.trim().toLowerCase();
546
+ if (normalized === "codex-cli") return "codex";
547
+ if (normalized === "work-buddy") return "workbuddy";
548
+ return normalized || "unknown";
549
+ }
550
+ function isKnownSkillsHost(host) {
551
+ return host === "codex" || host === "workbuddy";
552
+ }
553
+ function resolveSkillsTargetPath(value, options = {}) {
554
+ const trimmed = value.trim();
555
+ if (!trimmed) throw new Error("skills target path must not be empty");
556
+ const platform = options.platform ?? process.platform;
557
+ const pathApi = platform === "win32" ? win32 : posix;
558
+ const userHome = options.homeDir ?? homedir();
559
+ if (trimmed === "~") return pathApi.resolve(userHome);
560
+ if (/^~[\\/]/u.test(trimmed)) {
561
+ const segments = trimmed.slice(2).split(/[\\/]+/u).filter(Boolean);
562
+ return pathApi.resolve(userHome, ...segments);
563
+ }
564
+ return pathApi.resolve(trimmed);
565
+ }
566
+ function hostSkillsRoot(host, env, options) {
567
+ const platform = options.platform ?? process.platform;
568
+ const pathApi = platform === "win32" ? win32 : posix;
569
+ const userHome = options.homeDir ?? homedir();
570
+ const envName = host === "codex" ? "CODEX_HOME" : "WORKBUDDY_HOME";
571
+ const configuredHome = envValue(env, envName);
572
+ const hostHome = configuredHome ? resolveSkillsTargetPath(configuredHome, options) : pathApi.resolve(userHome, host === "codex" ? ".codex" : ".workbuddy");
573
+ return pathApi.resolve(hostHome, "skills");
574
+ }
575
+ function detectSkillsHost(env = process.env) {
576
+ const explicitAgent = envValue(env, "WEAVER_AGENT_TYPE");
577
+ if (explicitAgent) return normalizedAgentType(explicitAgent);
578
+ const hasCodexRuntime = hasEnvFamily(env, "CODEX", ["CODEX_HOME"]);
579
+ const hasWorkBuddyRuntime = hasEnvFamily(env, "WORKBUDDY", ["WORKBUDDY_HOME"]);
580
+ if (hasCodexRuntime !== hasWorkBuddyRuntime) return hasCodexRuntime ? "codex" : "workbuddy";
581
+ const hasCodexHome = Boolean(envValue(env, "CODEX_HOME"));
582
+ const hasWorkBuddyHome = Boolean(envValue(env, "WORKBUDDY_HOME"));
583
+ if (hasCodexHome !== hasWorkBuddyHome) return hasCodexHome ? "codex" : "workbuddy";
584
+ return "unknown";
585
+ }
586
+ function resolveSkillsRoot(env = process.env, options = {}) {
587
+ const configuredRoot = envValue(env, "WEAVER_SKILLS_ROOT");
588
+ if (configuredRoot) {
589
+ const explicitAgent = envValue(env, "WEAVER_AGENT_TYPE");
590
+ const detectedHost = explicitAgent ? normalizedAgentType(explicitAgent) : detectSkillsHost(env);
591
+ return {
592
+ root: resolveSkillsTargetPath(configuredRoot, options),
593
+ host: detectedHost === "unknown" ? "explicit" : detectedHost,
594
+ source: "explicit-env",
595
+ environmentVariable: "WEAVER_SKILLS_ROOT"
596
+ };
597
+ }
598
+ const host = detectSkillsHost(env);
599
+ if (isKnownSkillsHost(host)) {
600
+ const environmentVariable = envValue(env, host === "codex" ? "CODEX_HOME" : "WORKBUDDY_HOME") ? host === "codex" ? "CODEX_HOME" : "WORKBUDDY_HOME" : void 0;
601
+ return {
602
+ root: hostSkillsRoot(host, env, options),
603
+ host,
604
+ source: environmentVariable ? "explicit-env" : "host-detected",
605
+ ...environmentVariable ? { environmentVariable } : {}
606
+ };
607
+ }
608
+ const codexRoot = hostSkillsRoot("codex", env, options);
609
+ const workBuddyRoot = hostSkillsRoot("workbuddy", env, options);
610
+ const pathExists = options.pathExists ?? existsSync3;
611
+ if (host === "unknown") {
612
+ const existing = [
613
+ { root: codexRoot, host: "codex" },
614
+ { root: workBuddyRoot, host: "workbuddy" }
615
+ ].filter((candidate) => pathExists(candidate.root));
616
+ if (existing.length === 1) {
617
+ return { ...existing[0], source: "filesystem-detected" };
618
+ }
619
+ return {
620
+ root: codexRoot,
621
+ host,
622
+ source: "fallback",
623
+ requiresExplicitTarget: true,
624
+ reason: existing.length > 1 ? "ambiguous-host" : "unknown-host",
625
+ candidates: [codexRoot, workBuddyRoot]
626
+ };
627
+ }
628
+ return {
629
+ root: codexRoot,
630
+ host,
631
+ source: "fallback",
632
+ requiresExplicitTarget: true,
633
+ reason: "unsupported-host",
634
+ candidates: [codexRoot, workBuddyRoot]
635
+ };
636
+ }
637
+ function unresolvedSkillsRootMessage(resolution, targetOption = "--target-dir") {
638
+ const reason = resolution.reason === "ambiguous-host" ? "\u68C0\u6D4B\u5230\u591A\u4E2A\u53EF\u80FD\u7684\u5BBF\u4E3B\u76EE\u5F55" : resolution.reason === "unsupported-host" ? `\u68C0\u6D4B\u5230\u5F53\u524D\u667A\u80FD\u4F53 ${resolution.host}\uFF0C\u4F46\u4E0D\u77E5\u9053\u5B83\u7684 skills \u76EE\u5F55` : "\u672A\u68C0\u6D4B\u5230\u5F53\u524D\u667A\u80FD\u4F53\u53CA\u5176 skills \u76EE\u5F55";
639
+ return [
640
+ `${reason}\uFF0C\u4E3A\u907F\u514D\u88C5\u9519\u4F4D\u7F6E\uFF0C\u672C\u6B21\u672A\u6267\u884C\u5B89\u88C5\u3002`,
641
+ `\u8BF7\u4F7F\u7528 ${targetOption} <\u5F53\u524D\u667A\u80FD\u4F53\u7684 skills \u6839\u76EE\u5F55>\uFF0C\u6216\u8BBE\u7F6E WEAVER_SKILLS_ROOT \u540E\u91CD\u8BD5\u3002`,
642
+ ...resolution.candidates?.length ? [`\u5DF2\u77E5\u5019\u9009\u76EE\u5F55\uFF1A${resolution.candidates.join("\uFF0C")}`] : []
643
+ ].join("\n");
644
+ }
645
+ function normalizePackagedSkillName(value) {
646
+ const trimmed = value.trim();
647
+ if (!trimmed || trimmed === "all") return trimmed;
648
+ if (trimmed.includes("/") || trimmed.includes("\\") || trimmed === "." || trimmed === "..") {
649
+ throw new Error(`invalid skill name: ${value}`);
650
+ }
651
+ if (!/^[A-Za-z0-9._-]+$/u.test(trimmed)) {
652
+ throw new Error(`invalid skill name: ${value}`);
653
+ }
654
+ if (trimmed.startsWith(LEGACY_SKILL_PREFIX)) {
655
+ return `${SKILL_PREFIX}${trimmed.slice(LEGACY_SKILL_PREFIX.length)}`;
656
+ }
657
+ return trimmed.startsWith(SKILL_PREFIX) ? trimmed : `${SKILL_PREFIX}${trimmed}`;
658
+ }
659
+ function resolvePackagedSkillNames(sourceRoot, requested = "all") {
660
+ const available = readdirSync2(sourceRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && existsSync3(resolve3(sourceRoot, entry.name, "SKILL.md"))).map((entry) => entry.name).sort();
661
+ const normalized = normalizePackagedSkillName(requested);
662
+ if (!normalized || normalized === "all") return available;
663
+ if (!available.includes(normalized)) {
664
+ const shortName = normalized.slice(SKILL_PREFIX.length);
665
+ const suggestions = available.filter((name) => editDistance(shortName, name.replace(/^weaver-e10-/u, "")) <= 2);
666
+ throw new Error([
667
+ `unknown packaged skill: ${requested}`,
668
+ ...suggestions.length ? [`Did you mean: ${suggestions.join(", ")}?`] : [],
669
+ 'Run "weaver-work-cli skills list" to see available skills.'
670
+ ].join("\n"));
671
+ }
672
+ const names = [];
673
+ if (normalized !== SHARED_SKILL_NAME && available.includes(SHARED_SKILL_NAME)) {
674
+ names.push(SHARED_SKILL_NAME);
675
+ }
676
+ names.push(normalized);
677
+ return names;
678
+ }
679
+ function editDistance(left, right) {
680
+ let row = Array.from({ length: right.length + 1 }, (_, index) => index);
681
+ for (let i = 0; i < left.length; i += 1) {
682
+ const next = [i + 1];
683
+ for (let j = 0; j < right.length; j += 1) {
684
+ next.push(Math.min(next[j] + 1, row[j + 1] + 1, row[j] + (left[i] === right[j] ? 0 : 1)));
685
+ }
686
+ row = next;
687
+ }
688
+ return row[right.length];
689
+ }
690
+ function installPackagedSkills(sourceRoot, targetRoot, requested = "all") {
691
+ const resolvedSourceRoot = resolve3(sourceRoot);
692
+ const resolvedTargetRoot = resolve3(targetRoot);
693
+ const skillNames = resolvePackagedSkillNames(resolvedSourceRoot, requested);
694
+ const productContent = productMetadataContent(resolvedSourceRoot);
695
+ mkdirSync(resolvedTargetRoot, { recursive: true, mode: 448 });
696
+ const installed = skillNames.map((name) => {
697
+ const source = resolveInside(resolvedSourceRoot, name);
698
+ const target = resolve3(resolvedTargetRoot, basename(name));
699
+ statSync(resolve3(source, "SKILL.md"));
700
+ cpSync2(source, target, {
701
+ recursive: true,
702
+ force: true,
703
+ filter: (entry) => shouldCopy(entry, source, Boolean(productContent))
704
+ });
705
+ writeProductMetadata(target, productContent);
706
+ const current = {
707
+ name,
708
+ source,
709
+ target,
710
+ files: countFiles2(target)
711
+ };
712
+ return current;
713
+ });
714
+ return {
715
+ sourceRoot: resolvedSourceRoot,
716
+ targetRoot: resolvedTargetRoot,
717
+ skillNames,
718
+ installed
719
+ };
720
+ }
721
+ function productMetadataContent(sourceRoot) {
722
+ const productPath = productMetadataPath(sourceRoot);
723
+ if (!existsSync3(productPath)) return null;
724
+ const product = JSON.parse(readFileSync2(productPath, "utf8"));
725
+ const packageInfo = readPackageInfo(resolve3(sourceRoot, "..", "package.json"));
726
+ const metadata = {
727
+ schemaVersion: typeof product.schemaVersion === "number" ? product.schemaVersion : 1,
728
+ product: stringOrEmpty(product.product),
729
+ productVersion: stringOrEmpty(packageInfo?.version) || stringOrEmpty(product.productVersion),
730
+ packageName: stringOrEmpty(packageInfo?.name) || stringOrEmpty(product.packageName),
731
+ command: stringOrEmpty(product.command),
732
+ nodeEngine: stringOrEmpty(packageInfo?.engines?.node) || stringOrEmpty(product.nodeEngine)
733
+ };
734
+ if (metadata.product !== "weaver-work-cli" || metadata.packageName !== "weaver-work-cli" || metadata.command !== "weaver-work-cli" || !metadata.productVersion || !metadata.nodeEngine) {
735
+ throw new Error("skill-template/product.json or package.json is invalid for weaver-work-cli skills");
736
+ }
737
+ return `${JSON.stringify(metadata, null, 2)}
738
+ `;
739
+ }
740
+ function productMetadataPath(sourceRoot) {
741
+ const templatePath = resolve3(sourceRoot, "..", "skill-template", "product.json");
742
+ if (existsSync3(templatePath)) return templatePath;
743
+ return resolve3(sourceRoot, "product.json");
744
+ }
745
+ function readPackageInfo(packagePath2) {
746
+ if (!existsSync3(packagePath2)) return null;
747
+ return JSON.parse(readFileSync2(packagePath2, "utf8"));
748
+ }
749
+ function stringOrEmpty(value) {
750
+ return typeof value === "string" ? value : "";
751
+ }
752
+ function writeProductMetadata(target, productContent) {
753
+ if (!productContent) return;
754
+ writeFileSync(resolve3(target, "product.json"), productContent, "utf8");
755
+ }
756
+ function shouldCopy(entry, sourceRoot, skipSkillProduct) {
757
+ const relativePath = relative(sourceRoot, entry);
758
+ const name = basename(entry);
759
+ if (!relativePath) return true;
760
+ if (skipSkillProduct && relativePath === "product.json") return false;
761
+ if (name === ".DS_Store" || name.startsWith(".")) return false;
762
+ const parts = relativePath.split(sep);
763
+ return !parts.includes("node_modules");
764
+ }
765
+ function countFiles2(root) {
766
+ let count = 0;
767
+ for (const entry of readdirSync2(root, { withFileTypes: true })) {
768
+ const child = resolve3(root, entry.name);
769
+ if (entry.isDirectory()) count += countFiles2(child);
770
+ if (entry.isFile()) count += 1;
771
+ }
772
+ return count;
773
+ }
774
+ function resolveInside(base, subpath = "") {
775
+ if (subpath.startsWith("/") || subpath.split(/[\\/]/u).includes("..")) {
776
+ throw new Error(`invalid skill path: ${subpath}`);
777
+ }
778
+ const target = resolve3(base, subpath || ".");
779
+ const rel = relative(base, target);
780
+ if (rel === ".." || rel.startsWith(`..${sep}`)) {
781
+ throw new Error(`invalid skill path: ${subpath}`);
782
+ }
783
+ return target;
784
+ }
785
+
786
+ // src/cmd/setup/index.ts
787
+ var SKILLS_DIR = packagePath("skills");
788
+ function versionMajor2(version) {
789
+ return Number(version.replace(/^v/, "").split(".")[0] || 0);
790
+ }
791
+ var setupCommand = {
792
+ name: "setup",
793
+ description: "One-step setup checks for business shortcuts",
794
+ category: "system",
795
+ register({ program, action }) {
796
+ const setup = program.command("setup").description("One-step setup checks for business shortcuts");
797
+ setup.command("invoice").description("Check invoice CLI readiness and optionally install Agent skills").option("--install-skill", "install packaged invoice skill into the current Agent skills directory").option("--skill-target-dir <path>", "override target Agent skills directory").action(action((ctx, options) => {
798
+ const opts = options && typeof options === "object" ? options : {};
799
+ const authFile = findAuthFile(ctx.cwd, ctx.getGlobalOptions(), ctx.env);
800
+ const packagedSkills = resolvePackagedSkillNames(SKILLS_DIR, "yepiaotong");
801
+ const checks = [
802
+ {
803
+ name: "node",
804
+ ok: versionMajor2(process.version) >= 18,
805
+ detail: process.version
806
+ },
807
+ {
808
+ name: "package",
809
+ ok: true,
810
+ detail: ctx.packageInfo.name + "@" + ctx.packageInfo.version
811
+ },
812
+ {
813
+ name: "invoiceSkillPackaged",
814
+ ok: packagedSkills.includes("weaver-e10-yepiaotong"),
815
+ detail: packagedSkills.join(", ")
816
+ },
817
+ {
818
+ name: "e10Auth",
819
+ ok: Boolean(authFile && existsSync4(authFile)),
820
+ detail: authFile || "not found"
821
+ }
822
+ ];
823
+ const specifiedSkillRoot = typeof opts.skillTargetDir === "string" && opts.skillTargetDir.trim() ? resolveSkillsTargetPath(opts.skillTargetDir) : "";
824
+ const skillResolution = opts.installSkill ? specifiedSkillRoot ? { root: specifiedSkillRoot, host: "explicit", source: "target-dir" } : resolveSkillsRoot(ctx.env) : null;
825
+ if (skillResolution?.requiresExplicitTarget) {
826
+ throw new CliError(
827
+ unresolvedSkillsRootMessage(skillResolution, "--skill-target-dir"),
828
+ 2 /* UsageError */
829
+ );
830
+ }
831
+ const skillInstall = skillResolution ? {
832
+ ...installPackagedSkills(SKILLS_DIR, skillResolution.root, "yepiaotong"),
833
+ skillsHost: skillResolution.host,
834
+ skillsRootSource: skillResolution.source,
835
+ warnings: skillResolution.source === "filesystem-detected" ? ["\u76EE\u6807\u76EE\u5F55\u4EC5\u6839\u636E\u672C\u673A\u5DF2\u6709\u76EE\u5F55\u63A8\u65AD\uFF1B\u5982\u4E0E\u5F53\u524D\u667A\u80FD\u4F53\u4E0D\u7B26\uFF0C\u8BF7\u663E\u5F0F\u6307\u5B9A\u3002"] : []
836
+ } : null;
837
+ const nextActions = [];
838
+ if (!checks.find((check) => check.name === "e10Auth")?.ok) {
839
+ nextActions.push("Authenticate using the method required by the current runtime, then rerun setup.");
840
+ }
841
+ if (!skillInstall) {
842
+ nextActions.push("Optional Agent setup: weaver-work-cli skills install yepiaotong");
843
+ }
844
+ nextActions.push("Verify invoice operations: weaver-work-cli invoice schema");
845
+ const ok = checks.every((check) => check.ok);
846
+ ctx.output.write({
847
+ ok,
848
+ module: "invoice",
849
+ checks,
850
+ skillInstall,
851
+ nextActions
852
+ }, {
853
+ text: [
854
+ ok ? "Invoice setup checks passed." : "Invoice setup needs attention.",
855
+ ...checks.map((check) => `- ${check.name}: ${check.ok ? "ok" : "missing"} (${check.detail})`),
856
+ ...skillInstall ? skillInstall.installed.map((entry) => `- installed skill: ${entry.name} -> ${entry.target}`) : [],
857
+ ...skillInstall ? skillInstall.warnings.map((warning) => `- warning: ${warning}`) : [],
858
+ "Next:",
859
+ ...nextActions.map((actionText) => `- ${actionText}`)
860
+ ].join("\n")
861
+ });
862
+ }));
863
+ }
864
+ };
865
+
866
+ // src/cmd/skills/index.ts
867
+ import { existsSync as existsSync6 } from "node:fs";
868
+ import { spawnSync } from "node:child_process";
869
+
870
+ // src/internal/skills/detector.ts
871
+ import { existsSync as existsSync5, readFileSync as readFileSync3 } from "node:fs";
872
+ import { join, resolve as resolve4 } from "node:path";
873
+ var PACKAGED_DETECTOR_VERSION = "1.0.13";
874
+ var PACKAGED_DETECTOR_NAME = `weaver-skill-detector-${PACKAGED_DETECTOR_VERSION}`;
875
+ function packagedDetectorDir() {
876
+ return packagePath("tools", PACKAGED_DETECTOR_NAME);
877
+ }
878
+ function detectorScriptPath(detectorDir) {
879
+ return join(detectorDir, "scripts", "validate_skill.py");
880
+ }
881
+ function legacySiblingDetectorDir() {
882
+ return resolve4(packagedDetectorDir(), "..", "..", "..", PACKAGED_DETECTOR_NAME);
883
+ }
884
+ function detectorVersion(detectorDir) {
885
+ let version = PACKAGED_DETECTOR_VERSION;
886
+ const metaPath = join(detectorDir, "_meta.json");
887
+ if (existsSync5(metaPath)) {
888
+ try {
889
+ const meta = JSON.parse(readFileSync3(metaPath, "utf8"));
890
+ if (typeof meta.version === "string" && meta.version) version = meta.version;
891
+ } catch {
892
+ version = PACKAGED_DETECTOR_VERSION;
893
+ }
894
+ }
895
+ return version;
896
+ }
897
+ function resolveDetectorInfo(detectorDir) {
898
+ const candidates = detectorDir ? [resolve4(detectorDir)] : [packagedDetectorDir(), legacySiblingDetectorDir()].map((candidate) => resolve4(candidate));
899
+ for (const candidate of candidates) {
900
+ const scriptPath = detectorScriptPath(candidate);
901
+ if (existsSync5(scriptPath)) {
902
+ return { detectorDir: candidate, scriptPath, version: detectorVersion(candidate) };
903
+ }
904
+ }
905
+ throw new CliError(`weaver skill detector is not available; checked: ${candidates.map(detectorScriptPath).join(", ")}`, 2 /* UsageError */);
906
+ }
907
+
908
+ // src/internal/skills/reader.ts
909
+ import { readFileSync as readFileSync4, readdirSync as readdirSync3, statSync as statSync2 } from "node:fs";
910
+ import { relative as relative2, resolve as resolve5, sep as sep2 } from "node:path";
911
+ var SKILL_PREFIX2 = "weaver-e10-";
912
+ var LEGACY_SKILL_PREFIX2 = "weaver-work-cli-";
913
+ var SkillReader = class {
914
+ constructor(root) {
915
+ this.root = root;
916
+ }
917
+ root;
918
+ list() {
919
+ return readdirSync3(this.root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => this.skillInfo(entry.name)).filter((entry) => Boolean(entry)).sort((a, b) => a.name.localeCompare(b.name));
920
+ }
921
+ listPath(target) {
922
+ const { name, subpath } = splitTarget(target);
923
+ const skill = this.resolveSkill(name);
924
+ const skillRoot = skill.root;
925
+ const dir = this.resolveInside(skillRoot, subpath);
926
+ const info = statSync2(dir);
927
+ if (!info.isDirectory()) {
928
+ throw new Error(`path is a file, not a directory: ${target}`);
929
+ }
930
+ const listed = cleanOutputPath(skill.name, subpath);
931
+ const entries = readdirSync3(dir, { withFileTypes: true }).map((entry) => ({
932
+ path: cleanOutputPath(listed, entry.name),
933
+ isDir: entry.isDirectory()
934
+ })).sort((a, b) => a.path.localeCompare(b.path));
935
+ return { path: listed, entries };
936
+ }
937
+ read(target, pathArg = "") {
938
+ const split = splitTarget(target);
939
+ const skill = this.resolveSkill(split.name);
940
+ const subpath = pathArg || split.subpath || "SKILL.md";
941
+ const file = this.resolveInside(skill.root, subpath);
942
+ const info = statSync2(file);
943
+ if (info.isDirectory()) {
944
+ throw new Error(`path is a directory, not a file: ${cleanOutputPath(skill.name, subpath)}`);
945
+ }
946
+ return {
947
+ skill: skill.name,
948
+ path: cleanOutputPath(subpath),
949
+ content: readFileSync4(file, "utf-8")
950
+ };
951
+ }
952
+ skillInfo(name) {
953
+ try {
954
+ const skillRoot = this.ensureSkill(name);
955
+ const content = readFileSync4(resolve5(skillRoot, "SKILL.md"), "utf-8");
956
+ const frontmatter = parseFrontmatter(content);
957
+ return {
958
+ name,
959
+ title: frontmatter.name,
960
+ description: frontmatter.description,
961
+ version: frontmatter.version
962
+ };
963
+ } catch {
964
+ return null;
965
+ }
966
+ }
967
+ ensureSkill(name) {
968
+ return this.resolveSkill(name).root;
969
+ }
970
+ resolveSkill(name) {
971
+ if (!name || name.includes("/") || name.includes("\\") || name === "." || name === "..") {
972
+ throw new Error(`unknown skill: ${name}`);
973
+ }
974
+ const skillRoot = this.resolveInside(this.root, name);
975
+ if (!existsDirectoryWithSkill(skillRoot)) {
976
+ const normalized = normalizeLegacySkillName(name);
977
+ if (normalized !== name) {
978
+ const normalizedRoot = this.resolveInside(this.root, normalized);
979
+ if (existsDirectoryWithSkill(normalizedRoot)) return { name: normalized, root: normalizedRoot };
980
+ }
981
+ }
982
+ const info = statSync2(skillRoot);
983
+ if (!info.isDirectory()) throw new Error(`unknown skill: ${name}`);
984
+ statSync2(resolve5(skillRoot, "SKILL.md"));
985
+ return { name, root: skillRoot };
986
+ }
987
+ resolveInside(base, subpath = "") {
988
+ const cleaned = subpath.replace(/\\/g, "/");
989
+ if (cleaned.startsWith("/") || cleaned.split("/").includes("..")) {
990
+ throw new Error(`invalid skill path: ${subpath}`);
991
+ }
992
+ const target = resolve5(base, cleaned || ".");
993
+ const rel = relative2(base, target);
994
+ if (rel === ".." || rel.startsWith(`..${sep2}`) || resolve5(base) === target && cleaned === "..") {
995
+ throw new Error(`invalid skill path: ${subpath}`);
996
+ }
997
+ return target;
998
+ }
999
+ };
1000
+ function normalizeLegacySkillName(name) {
1001
+ return name.startsWith(LEGACY_SKILL_PREFIX2) ? `${SKILL_PREFIX2}${name.slice(LEGACY_SKILL_PREFIX2.length)}` : name;
1002
+ }
1003
+ function existsDirectoryWithSkill(skillRoot) {
1004
+ try {
1005
+ const info = statSync2(skillRoot);
1006
+ if (!info.isDirectory()) return false;
1007
+ statSync2(resolve5(skillRoot, "SKILL.md"));
1008
+ return true;
1009
+ } catch {
1010
+ return false;
1011
+ }
1012
+ }
1013
+ function splitTarget(target) {
1014
+ const index = target.indexOf("/");
1015
+ if (index === -1) return { name: target, subpath: "" };
1016
+ return {
1017
+ name: target.slice(0, index),
1018
+ subpath: target.slice(index + 1)
1019
+ };
1020
+ }
1021
+ function cleanOutputPath(...parts) {
1022
+ return parts.filter(Boolean).join("/").replace(/\/+/g, "/").replace(/^\.\//, "");
1023
+ }
1024
+ function parseFrontmatter(content) {
1025
+ const lines = content.split(/\r?\n/u);
1026
+ if (lines[0] !== "---") return {};
1027
+ const result = {};
1028
+ for (let index = 1; index < lines.length; index += 1) {
1029
+ const line = lines[index];
1030
+ if (line === "---") return result;
1031
+ const match = line.match(/^([A-Za-z][A-Za-z0-9_-]*):\s*(.*)$/u);
1032
+ if (!match) continue;
1033
+ result[match[1]] = match[2].replace(/^['"]|['"]$/g, "");
1034
+ }
1035
+ return {};
1036
+ }
1037
+
1038
+ // src/cmd/skills/index.ts
1039
+ var SKILLS_DIR2 = packagePath("skills");
1040
+ function reader() {
1041
+ if (!existsSync6(SKILLS_DIR2)) {
1042
+ throw new CliError("skills directory does not exist: " + SKILLS_DIR2);
1043
+ }
1044
+ return new SkillReader(SKILLS_DIR2);
1045
+ }
1046
+ function commandOptions(value) {
1047
+ if (!value || typeof value !== "object" || !("opts" in value)) return {};
1048
+ const opts = value.opts();
1049
+ return opts && typeof opts === "object" ? opts : {};
1050
+ }
1051
+ function describeRoot(resolution) {
1052
+ if (resolution.source === "target-dir") return "\u7531 --target-dir \u6307\u5B9A";
1053
+ if (resolution.source === "explicit-env") {
1054
+ return `\u7531 ${resolution.environmentVariable || "\u5BBF\u4E3B\u73AF\u5883\u53D8\u91CF"} \u6307\u5B9A\uFF08${resolution.host}\uFF09`;
1055
+ }
1056
+ if (resolution.source === "host-detected") return `\u81EA\u52A8\u63A2\u6D4B\u5BBF\u4E3B ${resolution.host}`;
1057
+ if (resolution.source === "filesystem-detected") return `\u7531\u672C\u673A\u552F\u4E00\u5DF2\u5B58\u5728\u7684\u5BBF\u4E3B\u76EE\u5F55\u63A8\u65AD\uFF08${resolution.host}\uFF09`;
1058
+ return "\u65E0\u6CD5\u53EF\u9760\u5224\u65AD\u5BBF\u4E3B";
1059
+ }
1060
+ function pythonInvocation(opts) {
1061
+ if (opts.python) return { command: opts.python, args: [] };
1062
+ if (process.platform === "win32") return { command: "py", args: ["-3"] };
1063
+ return { command: "python3", args: [] };
1064
+ }
1065
+ function detectorArgs(target, opts, globalJson) {
1066
+ const args = [target];
1067
+ if (opts.json || globalJson) args.push("--json");
1068
+ if (opts.noHtml || opts.html === false) args.push("--no-html");
1069
+ if (opts.out) args.push("--out", opts.out);
1070
+ if (typeof opts.html === "string") args.push("--html", opts.html);
1071
+ if (opts.platform) args.push("--platform", opts.platform);
1072
+ if (opts.marketCatalog) args.push("--market-catalog", opts.marketCatalog);
1073
+ if (opts.marketLive) args.push("--market-live");
1074
+ return args;
1075
+ }
1076
+ var skillsCommand = {
1077
+ name: "skills",
1078
+ description: "Read packaged agent skill content",
1079
+ category: "skills",
1080
+ register({ program, action }) {
1081
+ const skills = program.command("skills").description("Read packaged agent skill content");
1082
+ skills.command("list").description("List skills, or list one layer under a skill path").argument("[target]", "skill name or name/path").option("--json", "accepted for symmetry; output is always JSON").action(action((ctx, target) => {
1083
+ const skillReader = reader();
1084
+ if (typeof target !== "string" || !target) {
1085
+ const listed2 = skillReader.list();
1086
+ ctx.output.write({ ok: true, skills: listed2, count: listed2.length }, { json: true });
1087
+ return;
1088
+ }
1089
+ const listed = skillReader.listPath(target);
1090
+ ctx.output.write({ ok: true, ...listed, count: listed.entries.length }, { json: true });
1091
+ }));
1092
+ skills.command("read").description("Print a skill SKILL.md or a file under the skill").argument("<target>", "skill name or name/path").argument("[path]", "path under the skill").option("--json", "output as a JSON envelope instead of raw markdown").action(action((ctx, target, pathArg, command) => {
1093
+ if (typeof target !== "string") throw new CliError("target must be a string");
1094
+ const opts = commandOptions(command || pathArg);
1095
+ const result = reader().read(target, typeof pathArg === "string" ? pathArg : "");
1096
+ if (opts.json || ctx.getGlobalOptions().json) {
1097
+ ctx.output.write(result, { json: true });
1098
+ return;
1099
+ }
1100
+ ctx.output.raw(result.content);
1101
+ }));
1102
+ skills.command("install").description("Install packaged skills into the current Agent skills directory").argument("[target]", "skill name (weaver-e10-* or legacy weaver-work-cli-*), short name such as skill-maker, or all", "all").option("--target-dir <path>", "override target skills directory").action(action((ctx, target, options) => {
1103
+ const opts = options && typeof options === "object" ? options : {};
1104
+ const specified = typeof opts.targetDir === "string" && opts.targetDir.trim() ? resolveSkillsTargetPath(opts.targetDir) : "";
1105
+ const resolution = specified ? { root: specified, host: "explicit", source: "target-dir" } : resolveSkillsRoot(ctx.env);
1106
+ if (resolution.requiresExplicitTarget) {
1107
+ throw new CliError(unresolvedSkillsRootMessage(resolution), 2 /* UsageError */);
1108
+ }
1109
+ const targetRoot = resolution.root;
1110
+ const result = installPackagedSkills(SKILLS_DIR2, targetRoot, typeof target === "string" ? target : "all");
1111
+ const warnings = resolution.source === "filesystem-detected" ? ["\u63D0\u793A\uFF1A\u8BE5\u76EE\u5F55\u4EC5\u6839\u636E\u672C\u673A\u5DF2\u6709\u76EE\u5F55\u63A8\u65AD\uFF1B\u5982\u4E0E\u5F53\u524D\u667A\u80FD\u4F53\u4E0D\u7B26\uFF0C\u8BF7\u7528 --target-dir \u6216 WEAVER_SKILLS_ROOT \u6307\u5B9A\u3002"] : [];
1112
+ ctx.output.write({
1113
+ ...result,
1114
+ targetRoot,
1115
+ skillsHost: resolution.host,
1116
+ skillsRootSource: resolution.source,
1117
+ warnings
1118
+ }, {
1119
+ text: [
1120
+ `Skills root: ${targetRoot}\uFF08${describeRoot(resolution)}\uFF09`,
1121
+ "Installed packaged skills:",
1122
+ ...result.installed.map((entry) => `- ${entry.name} -> ${entry.target}`),
1123
+ ...warnings
1124
+ ].join("\n")
1125
+ });
1126
+ }));
1127
+ skills.command("validate").description("Validate a generated skill using the packaged Weaver skill detector").argument("<target>", "skill directory, SKILL.md, or skill zip").option("--detector-dir <path>", "override detector directory; defaults to the packaged detector").option("--python <path>", "Python executable; defaults to python3, or py -3 on Windows").option("--json", "ask the detector to print JSON").option("--no-html", "disable detector HTML report output").option("--out <path>", "write detector markdown report").option("--html <path>", "write detector HTML report").option("--platform <platform>", "detector platform: weaver or qwenwork").option("--market-catalog <path>", "detector market catalog JSON").option("--market-live", "enable detector live market checks").action(action((ctx, target, options) => {
1128
+ if (typeof target !== "string") throw new CliError("target must be a string");
1129
+ const opts = options && typeof options === "object" ? options : {};
1130
+ const detector = resolveDetectorInfo(opts.detectorDir);
1131
+ const python = pythonInvocation(opts);
1132
+ const child = spawnSync(python.command, [
1133
+ ...python.args,
1134
+ detector.scriptPath,
1135
+ ...detectorArgs(target, opts, Boolean(ctx.getGlobalOptions().json))
1136
+ ], { stdio: "inherit" });
1137
+ if (child.error) throw new CliError(`failed to run Python detector: ${child.error.message}`);
1138
+ if (typeof child.status === "number") {
1139
+ process.exitCode = child.status;
1140
+ return;
1141
+ }
1142
+ if (child.signal) throw new CliError(`detector terminated by signal: ${child.signal}`);
1143
+ throw new CliError("detector exited without a status code");
1144
+ }));
1145
+ }
1146
+ };
1147
+
1148
+ // src/cmd/index.ts
1149
+ var builtinCommands = [
1150
+ configCommand,
1151
+ docsCommand,
1152
+ doctorCommand,
1153
+ commandsCommand,
1154
+ runCommand,
1155
+ refsCommand,
1156
+ authCommand,
1157
+ e10Command,
1158
+ identityCommand,
1159
+ setupCommand,
1160
+ skillsCommand,
1161
+ updateCommand
1162
+ ];
1163
+
1164
+ export {
1165
+ builtinCommands
1166
+ };