Compare commits

..
9 Commits
Author SHA1 Message Date
yunyingk 7c0bdb7518 Merge pull request #44 from yunyingk/feat/update-sources-and-repo-opt
🚀 Release / 🚀 Build & Publish Multi-Platform Binaries (push) Has been cancelled
feat(cli): enhance update sources, normalize repo, upgrade MCP to 2.0, bump to v0.6.2
2026-09-05 22:32:55 +08:00
gitea 2865728885 feat(cli): enhance update sources, normalize repo, upgrade to MCP 2.0, and bump to v0.6.2 2026-09-05 22:32:39 +08:00
yunyingk eaa2b9391f Merge pull request #43 from yunyingk/fix/update-asset-fallback
fix(update): fall back to GitHub releases when Gitea mirror has empty assets
2026-09-05 22:21:03 +08:00
gitea 51502fada5 fix(update): fall back to GitHub releases when Gitea mirror has empty assets 2026-09-05 22:20:45 +08:00
yunyingk cf5d12b0a5 Merge pull request #42 from yunyingk/fix/case-insensitive-version-and-help
🚀 Release / 🚀 Build & Publish Multi-Platform Binaries (push) Has been cancelled
fix(cli): support case-insensitive version & help aliases and bump to v0.6.1
2026-09-05 22:17:48 +08:00
gitea 535404871c chore(release): bump version to v0.6.1 2026-09-05 22:17:32 +08:00
gitea 269b7e8f0f fix(cli): support case-insensitive version and help flags and subcommands 2026-09-05 22:16:56 +08:00
yunyingk c99c5d98ec Merge pull request #41 from yunyingk/fix/version-and-help-aliases
fix(cli): support version and help aliases (v, V, -V, h, -h)
2026-09-05 22:14:22 +08:00
gitea 4fbd737402 fix(cli): support version and help aliases (v, V, -V, h, -h) 2026-09-05 22:13:57 +08:00
19 changed files with 357 additions and 247 deletions

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hose-use",
"version": "0.6.0",
"version": "0.6.2",
"description": "合思/易快报 (ekuaibao) 企业级 SaaS CLI 与底层 SDK:多账号登录、企业租户切换、单据明细检索、工作流管理、内置 HTTP 服务与常驻守护进程。",
"author": {
"name": "yingqing"
+2 -2
View File
@@ -1,4 +1,4 @@
# hose-use (v0.6.0)
# hose-use (v0.6.2)
合思/易快报(ekuaibao)企业级 CLI 命令行工具与底层 SDK。
@@ -138,7 +138,7 @@ src/
- **Runtime**: Bun
- **HTTP Client**: ky
- **Schema**: Zod
- **MCP SDK**: @modelcontextprotocol/sdk
- **MCP Protocol**: @modelcontextprotocol/server & @modelcontextprotocol/core (v2.0+)
## 面向 AI 智能体
+7 -161
View File
@@ -5,214 +5,60 @@
"": {
"name": "ekb-mcp",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.29.0",
"@modelcontextprotocol/core": "^2.0.0",
"@modelcontextprotocol/server": "^2.0.0",
"ky": "^2.0.2",
"yaml": "^2.9.0",
"zod": "^4.4.3",
},
"devDependencies": {
"@modelcontextprotocol/client": "^2.0.0",
"@types/bun": "^1.3.14",
"typescript": "^5.9.3",
},
},
},
"packages": {
"@hono/node-server": ["@hono/node-server@1.19.14", "", { "peerDependencies": { "hono": "^4" } }, "sha512-GwtvgtXxnWsucXvbQXkRgqksiH2Qed37H9xHZocE5sA3N8O8O8/8FA3uclQXxXVzc9XBZuEOMK7+r02FmSpHtw=="],
"@modelcontextprotocol/client": ["@modelcontextprotocol/client@2.0.0", "", { "dependencies": { "@modelcontextprotocol/core": "2.0.0", "cross-spawn": "^7.0.5", "eventsource": "^3.0.2", "eventsource-parser": "^3.0.0", "jose": "^6.1.3", "pkce-challenge": "^5.0.0", "zod": "^4.2.0" } }, "sha512-8f1OghQ2rjzIOfqgUCP+8GiUWqRs89njoWLNqAe8kWmDePv3s1fZXseej+QXemssEuuOvLLmLO/kqM3IQHtISw=="],
"@modelcontextprotocol/sdk": ["@modelcontextprotocol/sdk@1.29.0", "", { "dependencies": { "@hono/node-server": "^1.19.9", "ajv": "^8.17.1", "ajv-formats": "^3.0.1", "content-type": "^1.0.5", "cors": "^2.8.5", "cross-spawn": "^7.0.5", "eventsource": "^3.0.2", "eventsource-parser": "^3.0.0", "express": "^5.2.1", "express-rate-limit": "^8.2.1", "hono": "^4.11.4", "jose": "^6.1.3", "json-schema-typed": "^8.0.2", "pkce-challenge": "^5.0.0", "raw-body": "^3.0.0", "zod": "^3.25 || ^4.0", "zod-to-json-schema": "^3.25.1" }, "peerDependencies": { "@cfworker/json-schema": "^4.1.1" }, "optionalPeers": ["@cfworker/json-schema"] }, "sha512-zo37mZA9hJWpULgkRpowewez1y6ML5GsXJPY8FI0tBBCd77HEvza4jDqRKOXgHNn867PVGCyTdzqpz0izu5ZjQ=="],
"@modelcontextprotocol/core": ["@modelcontextprotocol/core@2.0.0", "", { "dependencies": { "zod": "^4.2.0" } }, "sha512-pJCEwGG7Lfr/+PQp9ZTwKXNeO5wzbfKL7H3MYpCorM4oFBoQrdjnBgEoqG+RjhsvS1FKrDbKux+M1HhlnGWqcA=="],
"@modelcontextprotocol/server": ["@modelcontextprotocol/server@2.0.0", "", { "dependencies": { "@modelcontextprotocol/core": "2.0.0", "zod": "^4.2.0" } }, "sha512-YhHWdHfpFMQfd0prsEnxKeS3Qz3ytIGmsS0sth4KDjnacIT7hxk6hXHkJ9KysxlkvTM+WZAtQbbcUhdoP4Hvtw=="],
"@types/bun": ["@types/bun@1.3.14", "", { "dependencies": { "bun-types": "1.3.14" } }, "sha512-h1hFqFVcvAvD9j9K7ZW7vd82aSA+rTdznZa+5bwvCwqSB1jmmfLcbIWhOLx1/+boy/xmjgCs/OMUL8hRJSmnPw=="],
"@types/node": ["@types/node@25.8.0", "", { "dependencies": { "undici-types": ">=7.24.0 <7.24.7" } }, "sha512-TCFSk8IZh+iLX1xtksoBVtdmgL+1IX0fC9BeU4QqFSuNdN/K+HUlhqOzEmSYYpZUVsLYcPqc9KX+60iDuninSQ=="],
"accepts": ["accepts@2.0.0", "", { "dependencies": { "mime-types": "^3.0.0", "negotiator": "^1.0.0" } }, "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng=="],
"ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
"ajv-formats": ["ajv-formats@3.0.1", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ=="],
"body-parser": ["body-parser@2.2.2", "", { "dependencies": { "bytes": "^3.1.2", "content-type": "^1.0.5", "debug": "^4.4.3", "http-errors": "^2.0.0", "iconv-lite": "^0.7.0", "on-finished": "^2.4.1", "qs": "^6.14.1", "raw-body": "^3.0.1", "type-is": "^2.0.1" } }, "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA=="],
"bun-types": ["bun-types@1.3.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-4N0ig0fEomHt5R0KCFWjovxow98rIoRwKolrYdCcknNwMekCXRnWEUvgu5soYV8QXtVsrUD8B95MBOZGPvr6KQ=="],
"bytes": ["bytes@3.1.2", "", {}, "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="],
"call-bind-apply-helpers": ["call-bind-apply-helpers@1.0.2", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2" } }, "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ=="],
"call-bound": ["call-bound@1.0.4", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "get-intrinsic": "^1.3.0" } }, "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg=="],
"content-disposition": ["content-disposition@1.1.0", "", {}, "sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g=="],
"content-type": ["content-type@1.0.5", "", {}, "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA=="],
"cookie": ["cookie@0.7.2", "", {}, "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w=="],
"cookie-signature": ["cookie-signature@1.2.2", "", {}, "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg=="],
"cors": ["cors@2.8.6", "", { "dependencies": { "object-assign": "^4", "vary": "^1" } }, "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw=="],
"cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="],
"debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],
"depd": ["depd@2.0.0", "", {}, "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="],
"dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="],
"ee-first": ["ee-first@1.1.1", "", {}, "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="],
"encodeurl": ["encodeurl@2.0.0", "", {}, "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg=="],
"es-define-property": ["es-define-property@1.0.1", "", {}, "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g=="],
"es-errors": ["es-errors@1.3.0", "", {}, "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="],
"es-object-atoms": ["es-object-atoms@1.1.1", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA=="],
"escape-html": ["escape-html@1.0.3", "", {}, "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="],
"etag": ["etag@1.8.1", "", {}, "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg=="],
"eventsource": ["eventsource@3.0.7", "", { "dependencies": { "eventsource-parser": "^3.0.1" } }, "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA=="],
"eventsource-parser": ["eventsource-parser@3.0.8", "", {}, "sha512-70QWGkr4snxr0OXLRWsFLeRBIRPuQOvt4s8QYjmUlmlkyTZkRqS7EDVRZtzU3TiyDbXSzaOeF0XUKy8PchzukQ=="],
"express": ["express@5.2.1", "", { "dependencies": { "accepts": "^2.0.0", "body-parser": "^2.2.1", "content-disposition": "^1.0.0", "content-type": "^1.0.5", "cookie": "^0.7.1", "cookie-signature": "^1.2.1", "debug": "^4.4.0", "depd": "^2.0.0", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "etag": "^1.8.1", "finalhandler": "^2.1.0", "fresh": "^2.0.0", "http-errors": "^2.0.0", "merge-descriptors": "^2.0.0", "mime-types": "^3.0.0", "on-finished": "^2.4.1", "once": "^1.4.0", "parseurl": "^1.3.3", "proxy-addr": "^2.0.7", "qs": "^6.14.0", "range-parser": "^1.2.1", "router": "^2.2.0", "send": "^1.1.0", "serve-static": "^2.2.0", "statuses": "^2.0.1", "type-is": "^2.0.1", "vary": "^1.1.2" } }, "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw=="],
"express-rate-limit": ["express-rate-limit@8.5.2", "", { "dependencies": { "ip-address": "^10.2.0" }, "peerDependencies": { "express": ">= 4.11" } }, "sha512-5Kb34ipNX694DH48vN9irak1Qx30nb0PLYHXfJgw4YEjiC3ZEmZJhwOp+VfiCYwFzvFTdB9QkArYS5kXa2cx2A=="],
"fast-deep-equal": ["fast-deep-equal@3.1.3", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="],
"fast-uri": ["fast-uri@3.1.2", "", {}, "sha512-rVjf7ArG3LTk+FS6Yw81V1DLuZl1bRbNrev6Tmd/9RaroeeRRJhAt7jg/6YFxbvAQXUCavSoZhPPj6oOx+5KjQ=="],
"finalhandler": ["finalhandler@2.1.1", "", { "dependencies": { "debug": "^4.4.0", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "on-finished": "^2.4.1", "parseurl": "^1.3.3", "statuses": "^2.0.1" } }, "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA=="],
"forwarded": ["forwarded@0.2.0", "", {}, "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow=="],
"fresh": ["fresh@2.0.0", "", {}, "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A=="],
"function-bind": ["function-bind@1.1.2", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="],
"get-intrinsic": ["get-intrinsic@1.3.0", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" } }, "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ=="],
"get-proto": ["get-proto@1.0.1", "", { "dependencies": { "dunder-proto": "^1.0.1", "es-object-atoms": "^1.0.0" } }, "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g=="],
"gopd": ["gopd@1.2.0", "", {}, "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg=="],
"has-symbols": ["has-symbols@1.1.0", "", {}, "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ=="],
"hasown": ["hasown@2.0.3", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-ej4AhfhfL2Q2zpMmLo7U1Uv9+PyhIZpgQLGT1F9miIGmiCJIoCgSmczFdrc97mWT4kVY72KA+WnnhJ5pghSvSg=="],
"hono": ["hono@4.12.19", "", {}, "sha512-xa3eYXYXx68XTT4hZ7dRzsXBhaq85ToSrlUJNoR0gwz/1Ap/CNwX47wfvV7pc/xWhjKVVkLT7zBJy8chhNguqQ=="],
"http-errors": ["http-errors@2.0.1", "", { "dependencies": { "depd": "~2.0.0", "inherits": "~2.0.4", "setprototypeof": "~1.2.0", "statuses": "~2.0.2", "toidentifier": "~1.0.1" } }, "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ=="],
"iconv-lite": ["iconv-lite@0.7.2", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw=="],
"inherits": ["inherits@2.0.4", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="],
"ip-address": ["ip-address@10.2.0", "", {}, "sha512-/+S6j4E9AHvW9SWMSEY9Xfy66O5PWvVEJ08O0y5JGyEKQpojb0K0GKpz/v5HJ/G0vi3D2sjGK78119oXZeE0qA=="],
"ipaddr.js": ["ipaddr.js@1.9.1", "", {}, "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="],
"is-promise": ["is-promise@4.0.0", "", {}, "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="],
"isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="],
"jose": ["jose@6.2.3", "", {}, "sha512-YYVDInQKFJfR/xa3ojUTl8c2KoTwiL1R5Wg9YCydwH0x0B9grbzlg5HC7mMjCtUJjbQ/YnGEZIhI5tCgfTb4Hw=="],
"json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
"json-schema-typed": ["json-schema-typed@8.0.2", "", {}, "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA=="],
"ky": ["ky@2.0.2", "", {}, "sha512-/GmXpo9F9W+f8n4Ivr2iH+7h7wL7jLbLKWkMlpflcCRb6kGjBfTlASEXaZ9qUgNTn4VgS0P2pwxxzQ4EM6Ulgg=="],
"math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="],
"media-typer": ["media-typer@1.1.0", "", {}, "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw=="],
"merge-descriptors": ["merge-descriptors@2.0.0", "", {}, "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g=="],
"mime-db": ["mime-db@1.54.0", "", {}, "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ=="],
"mime-types": ["mime-types@3.0.2", "", { "dependencies": { "mime-db": "^1.54.0" } }, "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A=="],
"ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
"negotiator": ["negotiator@1.0.0", "", {}, "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg=="],
"object-assign": ["object-assign@4.1.1", "", {}, "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="],
"object-inspect": ["object-inspect@1.13.4", "", {}, "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew=="],
"on-finished": ["on-finished@2.4.1", "", { "dependencies": { "ee-first": "1.1.1" } }, "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg=="],
"once": ["once@1.4.0", "", { "dependencies": { "wrappy": "1" } }, "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="],
"parseurl": ["parseurl@1.3.3", "", {}, "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="],
"path-key": ["path-key@3.1.1", "", {}, "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="],
"path-to-regexp": ["path-to-regexp@8.4.2", "", {}, "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA=="],
"pkce-challenge": ["pkce-challenge@5.0.1", "", {}, "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ=="],
"proxy-addr": ["proxy-addr@2.0.7", "", { "dependencies": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" } }, "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg=="],
"qs": ["qs@6.15.2", "", { "dependencies": { "side-channel": "^1.1.0" } }, "sha512-Rzq0KEyX/w/tEybncDgdkZrJgVUsUMk3xjh3t5bv3S1HTAtg+uOYt72+ZfwiQwKdysThkTBdL/rTi6HDmX9Ddw=="],
"range-parser": ["range-parser@1.2.1", "", {}, "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="],
"raw-body": ["raw-body@3.0.2", "", { "dependencies": { "bytes": "~3.1.2", "http-errors": "~2.0.1", "iconv-lite": "~0.7.0", "unpipe": "~1.0.0" } }, "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA=="],
"require-from-string": ["require-from-string@2.0.2", "", {}, "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw=="],
"router": ["router@2.2.0", "", { "dependencies": { "debug": "^4.4.0", "depd": "^2.0.0", "is-promise": "^4.0.0", "parseurl": "^1.3.3", "path-to-regexp": "^8.0.0" } }, "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ=="],
"safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="],
"send": ["send@1.2.1", "", { "dependencies": { "debug": "^4.4.3", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "etag": "^1.8.1", "fresh": "^2.0.0", "http-errors": "^2.0.1", "mime-types": "^3.0.2", "ms": "^2.1.3", "on-finished": "^2.4.1", "range-parser": "^1.2.1", "statuses": "^2.0.2" } }, "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ=="],
"serve-static": ["serve-static@2.2.1", "", { "dependencies": { "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "parseurl": "^1.3.3", "send": "^1.2.0" } }, "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw=="],
"setprototypeof": ["setprototypeof@1.2.0", "", {}, "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="],
"shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="],
"shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="],
"side-channel": ["side-channel@1.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3", "side-channel-list": "^1.0.0", "side-channel-map": "^1.0.1", "side-channel-weakmap": "^1.0.2" } }, "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw=="],
"side-channel-list": ["side-channel-list@1.0.1", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.4" } }, "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w=="],
"side-channel-map": ["side-channel-map@1.0.1", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3" } }, "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA=="],
"side-channel-weakmap": ["side-channel-weakmap@1.0.2", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3", "side-channel-map": "^1.0.1" } }, "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A=="],
"statuses": ["statuses@2.0.2", "", {}, "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw=="],
"toidentifier": ["toidentifier@1.0.1", "", {}, "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="],
"type-is": ["type-is@2.1.0", "", { "dependencies": { "content-type": "^2.0.0", "media-typer": "^1.1.0", "mime-types": "^3.0.0" } }, "sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA=="],
"typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
"undici-types": ["undici-types@7.24.6", "", {}, "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg=="],
"unpipe": ["unpipe@1.0.0", "", {}, "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ=="],
"vary": ["vary@1.1.2", "", {}, "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg=="],
"which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="],
"wrappy": ["wrappy@1.0.2", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="],
"yaml": ["yaml@2.9.0", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA=="],
"zod": ["zod@4.4.3", "", {}, "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ=="],
"zod-to-json-schema": ["zod-to-json-schema@3.25.2", "", { "peerDependencies": { "zod": "^3.25.28 || ^4" } }, "sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA=="],
"type-is/content-type": ["content-type@2.0.0", "", {}, "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ=="],
}
}
+1 -1
View File
@@ -2,7 +2,7 @@
"openapi": "3.1.0",
"info": {
"title": "hose-use API & MCP Tools Specification",
"version": "0.6.0",
"version": "0.6.2",
"description": "Unified Enterprise SaaS API, CLI, and MCP Specification for Ekuaibao (合思/易快报), EASO, and Piper Workflows."
},
"servers": [
+1 -1
View File
@@ -1,7 +1,7 @@
openapi: 3.1.0
info:
title: hose-use API & MCP Tools Specification
version: 0.6.0
version: 0.6.2
description: >-
Unified Enterprise SaaS API, CLI, and MCP Specification for Ekuaibao (合思/易快报), EASO, and Piper Workflows.
servers:
+5 -4
View File
@@ -1,11 +1,10 @@
{
"name": "hose-use",
"version": "0.6.0",
"version": "0.6.2",
"module": "src/server.ts",
"type": "module",
"bin": {
"hose-use": "src/cli.ts",
"hose": "src/cli.ts"
"hose-use": "src/cli.ts"
},
"scripts": {
"cli": "bun run src/cli.ts",
@@ -24,12 +23,14 @@
"export:workflow-schema": "bun run scripts/export-workflow-schema.ts"
},
"dependencies": {
"@modelcontextprotocol/sdk": "^1.29.0",
"@modelcontextprotocol/core": "^2.0.0",
"@modelcontextprotocol/server": "^2.0.0",
"ky": "^2.0.2",
"yaml": "^2.9.0",
"zod": "^4.4.3"
},
"devDependencies": {
"@modelcontextprotocol/client": "^2.0.0",
"@types/bun": "^1.3.14",
"typescript": "^5.9.3"
}
+1 -1
View File
@@ -6,7 +6,7 @@ metadata:
short-description: 合思/易快报企业级 CLI 工具与底层 SDK (v0.6.0)
---
# hose-use (v0.6.0)
# hose-use (v0.6.2)
在具备 MCP 的 AI 智能体环境中,**优先使用 `hose_cli` 单工具网关**,传入 `command: string` 执行;在终端或自动化脚本中,直接调用全局 `hose` 或 `hose-use` 命令行。
本 Skill 是智能体的路由分发层:保持主文档简明,遇到复杂业务时深入查阅对应的专属参考文档(`references/*.md`)。
+32 -8
View File
@@ -48,6 +48,8 @@ async function handleShow(parsed: CliParsedArgs, runtime: CliRuntime): Promise<C
defaultCorpId: globalConfig.defaultCorpId || null,
defaultAccountId: globalConfig.defaultAccountId || null,
activeCorp: currentCorp ? { id: currentCorp.id, name: currentCorp.name } : null,
updateRepo: globalConfig.updateRepo || null,
updateSource: globalConfig.updateSource || "auto",
configFile: configPath,
};
@@ -59,11 +61,13 @@ async function handleShow(parsed: CliParsedArgs, runtime: CliRuntime): Promise<C
"运行模式 (Mode)": globalConfig.stateful ? "有状态模式 (Stateful - 自动记忆默认企业)" : "无状态模式 (Stateless - 每次需显式传 --corp)",
"默认工作企业": globalConfig.defaultCorpId || "未设置 (使用首个可用企业)",
"当前解析企业": currentCorp ? `${currentCorp.name} (${currentCorp.id})` : "无",
"默认自更新仓库": globalConfig.updateRepo || "官方默认 (yunyingk/hose-use)",
"自更新源偏好": globalConfig.updateSource || "auto (自动择优)",
"配置文件路径": configPath,
});
return {
stdout: `====== 全局运行配置 ======\n${output}\n\n提示:\n 切换模式: hose config mode <stateful|stateless>\n 指定企业: hose corps switch <corpId>\n`,
stdout: `====== 全局运行配置 ======\n${output}\n\n提示:\n 切换模式: hose config mode <stateful|stateless>\n 指定企业: hose corps switch <corpId>\n 更新源设置: hose config set updateSource <auto|github|gitea>\n`,
stderr: "",
exitCode: 0,
};
@@ -95,10 +99,10 @@ async function handleMode(parsed: CliParsedArgs, runtime: CliRuntime): Promise<C
}
async function handleSet(parsed: CliParsedArgs, runtime: CliRuntime): Promise<CliResult> {
const key = parsed.args[0];
const rawKey = parsed.args[0];
const val = parsed.args[1];
if (!key || val === undefined) {
if (!rawKey || val === undefined) {
return {
stdout: "",
stderr: "用法: hose config set <key> <val> (如 hose config set defaultCorpId uzU7pcWfScck00)\n",
@@ -106,17 +110,37 @@ async function handleSet(parsed: CliParsedArgs, runtime: CliRuntime): Promise<Cl
};
}
const keyLower = rawKey.toLowerCase();
const partial: Record<string, unknown> = {};
if (key === "stateful") {
let resolvedKey = rawKey;
if (keyLower === "stateful") {
resolvedKey = "stateful";
partial.stateful = val === "true" || val === "1";
} else if (key === "defaultCorpId") {
} else if (keyLower === "defaultcorpid") {
resolvedKey = "defaultCorpId";
partial.defaultCorpId = val;
} else if (key === "defaultAccountId") {
} else if (keyLower === "defaultaccountid") {
resolvedKey = "defaultAccountId";
partial.defaultAccountId = val;
} else if (keyLower === "updaterepo") {
resolvedKey = "updateRepo";
partial.updateRepo = val;
} else if (keyLower === "updatesource") {
resolvedKey = "updateSource";
const srcLower = val.toLowerCase();
if (srcLower !== "auto" && srcLower !== "github" && srcLower !== "gitea") {
return {
stdout: "",
stderr: `不支持的 updateSource 值: ${val}。可选: auto, github, gitea\n`,
exitCode: 1,
};
}
partial.updateSource = srcLower;
} else {
return {
stdout: "",
stderr: `不支持配置键: ${key}。支持: stateful, defaultCorpId, defaultAccountId\n`,
stderr: `不支持配置键: ${rawKey}。支持: stateful, defaultCorpId, defaultAccountId, updateRepo, updateSource\n`,
exitCode: 1,
};
}
@@ -127,7 +151,7 @@ async function handleSet(parsed: CliParsedArgs, runtime: CliRuntime): Promise<Cl
}
return {
stdout: `[SUCCESS] 配置已更新: ${key} = ${val}\n`,
stdout: `[SUCCESS] 配置已更新: ${resolvedKey} = ${val}\n`,
stderr: "",
exitCode: 0,
};
+32 -1
View File
@@ -1,5 +1,12 @@
import { describe, expect, test } from "bun:test";
import { compareSemVer, isNewerVersion, matchAssetForPlatform, type GitHubAsset } from "./update.js";
import {
compareSemVer,
isNewerVersion,
matchAssetForPlatform,
normalizeRepo,
isValidRepo,
type GitHubAsset,
} from "./update.js";
describe("update version comparator", () => {
test("correctly identifies newer semantic versions", () => {
@@ -20,6 +27,29 @@ describe("update version comparator", () => {
});
});
describe("normalizeRepo and isValidRepo", () => {
test("normalizeRepo trims and cleans various GitHub URL formats", () => {
expect(normalizeRepo("yunyingk/hose-use")).toBe("yunyingk/hose-use");
expect(normalizeRepo("https://github.com/yunyingk/hose-use")).toBe("yunyingk/hose-use");
expect(normalizeRepo("https://github.com/yunyingk/hose-use.git")).toBe("yunyingk/hose-use");
expect(normalizeRepo("http://www.github.com/my-org/my-fork/")).toBe("my-org/my-fork");
expect(normalizeRepo(" custom/project.git ")).toBe("custom/project");
expect(normalizeRepo("github.com/test-org/repo")).toBe("test-org/repo");
});
test("isValidRepo validates owner/repo format and rejects illegal inputs", () => {
expect(isValidRepo("yunyingk/hose-use")).toBe(true);
expect(isValidRepo("my-org/hose-use-fork")).toBe(true);
expect(isValidRepo("user.name/repo_name.v2")).toBe(true);
expect(isValidRepo("")).toBe(false);
expect(isValidRepo("single-word")).toBe(false);
expect(isValidRepo("too/many/parts/here")).toBe(false);
expect(isValidRepo("../path/traversal")).toBe(false);
expect(isValidRepo("invalid character/repo")).toBe(false);
});
});
describe("matchAssetForPlatform", () => {
const assets: GitHubAsset[] = [
{ name: "hose-use-darwin-arm64", downloadUrl: "https://example.com/darwin-arm64", size: 100 },
@@ -49,3 +79,4 @@ describe("matchAssetForPlatform", () => {
expect(matched?.name).toBe("hose-use-windows-x64.zip");
});
});
+158 -42
View File
@@ -3,6 +3,7 @@ import { dirname, join } from "node:path";
import { spawnSync } from "node:child_process";
import { isCompiledBinary, resolveAppRoot } from "../../core/runtime.js";
import { syncGlobalSkillIfPresent } from "../../core/embedded-skill.js";
import { loadGlobalConfig } from "../../core/config/loader.js";
import { VERSION } from "../../version.js";
import { booleanOption, numberOption, stringOption } from "../parser.js";
import { printJson, printKeyValue } from "../printer.js";
@@ -11,15 +12,29 @@ import type { CliParsedArgs, CliResult, CliRunOptions, CliRuntime } from "../typ
const DEFAULT_GITHUB_REPO = "yunyingk/hose-use";
const GITHUB_REPO_ENV = "HOSE_USE_GITHUB_REPO";
export type UpdateSourcePreference = "auto" | "github" | "gitea";
export type UpdateOptions = {
checkOnly?: boolean;
changelogOnly?: boolean;
limit?: number;
force?: boolean;
targetVersion?: string;
repo?: string;
repo: string;
sourcePreference: UpdateSourcePreference;
};
export function normalizeRepo(raw: string): string {
let repo = raw.trim();
repo = repo.replace(/^(https?:\/\/)?(www\.)?github\.com\//i, "");
repo = repo.replace(/\.git$/i, "").replace(/\/+$/, "");
return repo;
}
export function isValidRepo(repo: string): boolean {
return /^[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+$/.test(repo);
}
export async function handleUpdateCommand(
parsed: CliParsedArgs,
runtime: CliRuntime,
@@ -47,11 +62,44 @@ export async function handleUpdateCommand(
? targetVersionRaw.replace(/^v/, "")
: undefined;
const repo =
const isGitHub = booleanOption(parsed.options, ["github", "gh"]);
const isGitea = booleanOption(parsed.options, ["gitea", "yingqing", "mirror"]);
const globalConfig = loadGlobalConfig();
const configuredSource = globalConfig.updateSource || "auto";
let sourcePreference: UpdateSourcePreference = "auto";
if (isGitHub) {
sourcePreference = "github";
} else if (isGitea) {
sourcePreference = "gitea";
} else if (configuredSource === "github" || configuredSource === "gitea") {
sourcePreference = configuredSource;
}
const rawRepo =
stringOption(parsed.options, ["repo"]) ||
process.env[GITHUB_REPO_ENV]?.trim() ||
globalConfig.updateRepo?.trim() ||
DEFAULT_GITHUB_REPO;
const repo = normalizeRepo(rawRepo);
if (!isValidRepo(repo)) {
const errorMsg = `非法 GitHub 仓库标识: '${rawRepo}'。应为 'owner/repo' 格式(如 'yunyingk/hose-use')。`;
if (runtime.jsonMode) {
return {
stdout: printJson({ updated: false, error: true, message: errorMsg }),
stderr: "",
exitCode: 1,
};
}
return {
stdout: "",
stderr: `[ERROR] ${errorMsg}\n`,
exitCode: 1,
};
}
const options: UpdateOptions = {
checkOnly: isCheck,
changelogOnly: isChangelog,
@@ -59,6 +107,7 @@ export async function handleUpdateCommand(
force: booleanOption(parsed.options, ["force", "f"]),
targetVersion,
repo,
sourcePreference,
};
const appRoot = runOptions.appRoot || resolveAppRoot(runOptions.entryFile);
@@ -112,11 +161,13 @@ export async function handleUpdateCommand(
// 1. Changelog / Release History query
if (options.changelogOnly) {
const releases = await fetchGitHubReleases(repo, options.limit ?? 10);
const releases = await fetchGitHubReleases(repo, options.limit ?? 10, options.sourcePreference);
if (runtime.jsonMode) {
return {
stdout: printJson({
currentVersion: VERSION,
repo,
sourcePreference: options.sourcePreference,
totalQueried: releases.length,
releases: releases.map((r) => ({
version: r.version,
@@ -157,7 +208,7 @@ export async function handleUpdateCommand(
// 2. Source development mode (running via bun/node)
if (!isCompiledBinary()) {
if (options.checkOnly) {
const releases = await fetchGitHubReleases(repo, 30);
const releases = await fetchGitHubReleases(repo, 30, options.sourcePreference);
const latestRelease = releases[0];
const latestVersion = latestRelease?.version ?? VERSION;
const currentRelease = releases.find((r) => r.version === VERSION);
@@ -174,6 +225,8 @@ export async function handleUpdateCommand(
latestVersion,
latestVersionPublishedAt: latestRelease?.publishedAt,
behindCount: pendingReleases.length,
repo,
sourcePreference: options.sourcePreference,
pendingReleases: pendingReleases.map((r) => ({
version: r.version,
tagName: r.tagName,
@@ -197,6 +250,8 @@ export async function handleUpdateCommand(
"当前版本": `v${VERSION}`,
"最新版本": `v${latestVersion} ${isUpgrade ? "(可升级 ✨)" : "(已是最新 ✅)"}`,
"待更新版本数": pendingReleases.length,
"发布仓库": repo,
"通道偏好": options.sourcePreference,
"源码路径": appRoot,
});
@@ -241,11 +296,11 @@ export async function handleUpdateCommand(
const platform = detectPlatform();
const arch = detectArch();
const releases = await fetchGitHubReleases(repo, 30);
const releases = await fetchGitHubReleases(repo, 30, options.sourcePreference);
const release = targetVersion
? (releases.find((r) => r.version === targetVersion || r.tagName === targetVersion || r.tagName === `v${targetVersion}`) ??
await fetchGitHubRelease(repo, targetVersion))
: (releases[0] ?? await fetchGitHubRelease(repo));
await fetchGitHubRelease(repo, targetVersion, options.sourcePreference))
: (releases[0] ?? await fetchGitHubRelease(repo, undefined, options.sourcePreference));
if (!release) {
const errorMsg = `无法从 GitHub 仓库 '${repo}' 获取 Release 列表`;
@@ -254,6 +309,8 @@ export async function handleUpdateCommand(
stdout: printJson({
updated: false,
currentVersion: VERSION,
repo,
sourcePreference: options.sourcePreference,
mode: "binary",
message: errorMsg,
}),
@@ -285,6 +342,8 @@ export async function handleUpdateCommand(
latestVersion,
latestVersionPublishedAt: release.publishedAt,
behindCount: pendingReleases.length,
repo,
sourcePreference: options.sourcePreference,
pendingReleases: pendingReleases.map((r) => ({
version: r.version,
tagName: r.tagName,
@@ -308,6 +367,8 @@ export async function handleUpdateCommand(
"最新版本": `v${latestVersion} ${isUpgrade ? "(可升级 ✨)" : "(已是最新 ✅)"}`,
"发布时间": release.publishedAt ? release.publishedAt.slice(0, 10) : "未知",
"平台架构": `${platform}-${arch}`,
"发布仓库": repo,
"通道偏好": options.sourcePreference,
});
return {
@@ -326,6 +387,8 @@ export async function handleUpdateCommand(
currentVersionPublishedAt: currentRelease?.publishedAt,
latestVersion,
latestVersionPublishedAt: release.publishedAt,
repo,
sourcePreference: options.sourcePreference,
mode: "binary",
message: `hose-use 当前已是最新版本 (v${VERSION})`,
}),
@@ -365,7 +428,7 @@ export async function handleUpdateCommand(
try {
const downloadedFile = join(tmpDir, asset.name);
await downloadFile(asset.downloadUrl, downloadedFile, release.tagName, asset.name);
await downloadFile(asset.downloadUrl, downloadedFile, release.tagName, asset.name, repo, options.sourcePreference);
let newBinaryPath = downloadedFile;
if (asset.name.endsWith(".tar.gz") || asset.name.endsWith(".tgz")) {
@@ -456,7 +519,11 @@ export type GitHubRelease = {
assets: GitHubAsset[];
};
export async function fetchGitHubReleases(repo: string, limit = 20): Promise<GitHubRelease[]> {
export async function fetchGitHubReleases(
repo: string,
limit = 20,
sourcePreference: UpdateSourcePreference = "auto"
): Promise<GitHubRelease[]> {
const token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
const headers: Record<string, string> = {
"User-Agent": `hose-use/${VERSION}`,
@@ -464,10 +531,25 @@ export async function fetchGitHubReleases(repo: string, limit = 20): Promise<Git
...(token ? { Authorization: `Bearer ${token}` } : {}),
};
const urls = [
`https://git.ying-qing.cn/api/v1/repos/gitea/hose-use/releases?per_page=${limit}`,
`https://api.github.com/repos/${repo}/releases?per_page=${limit}`,
];
const isDefaultRepo = repo.toLowerCase() === DEFAULT_GITHUB_REPO.toLowerCase();
const allowGitea = isDefaultRepo && sourcePreference !== "github";
const urls: string[] = [];
if (sourcePreference === "github") {
urls.push(`https://api.github.com/repos/${repo}/releases?per_page=${limit}`);
} else if (sourcePreference === "gitea") {
if (allowGitea) {
urls.push(`https://git.ying-qing.cn/api/v1/repos/gitea/hose-use/releases?per_page=${limit}`);
}
urls.push(`https://api.github.com/repos/${repo}/releases?per_page=${limit}`);
} else {
if (allowGitea) {
urls.push(`https://git.ying-qing.cn/api/v1/repos/gitea/hose-use/releases?per_page=${limit}`);
}
urls.push(`https://api.github.com/repos/${repo}/releases?per_page=${limit}`);
}
let fallbackList: GitHubRelease[] = [];
for (const url of urls) {
try {
@@ -506,18 +588,26 @@ export async function fetchGitHubReleases(repo: string, limit = 20): Promise<Git
assets,
});
}
if (list.length > 0) return list;
if (list.length > 0) {
if (list.some((r) => r.assets.length > 0)) {
return list;
}
if (fallbackList.length === 0) {
fallbackList = list;
}
}
} catch {
// try next source
}
}
return [];
return fallbackList;
}
export async function fetchGitHubRelease(
repo: string,
targetVersion?: string
targetVersion?: string,
sourcePreference: UpdateSourcePreference = "auto"
): Promise<GitHubRelease | undefined> {
const tag = targetVersion ? (targetVersion.startsWith("v") ? targetVersion : `v${targetVersion}`) : undefined;
const token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
@@ -527,15 +617,26 @@ export async function fetchGitHubRelease(
...(token ? { Authorization: `Bearer ${token}` } : {}),
};
const urls = tag
? [
`https://git.ying-qing.cn/api/v1/repos/gitea/hose-use/releases/tags/${tag}`,
`https://api.github.com/repos/${repo}/releases/tags/${tag}`,
]
: [
`https://git.ying-qing.cn/api/v1/repos/gitea/hose-use/releases/latest`,
`https://api.github.com/repos/${repo}/releases/latest`,
];
const isDefaultRepo = repo.toLowerCase() === DEFAULT_GITHUB_REPO.toLowerCase();
const allowGitea = isDefaultRepo && sourcePreference !== "github";
const urls: string[] = [];
const giteaTagUrl = tag
? `https://git.ying-qing.cn/api/v1/repos/gitea/hose-use/releases/tags/${tag}`
: `https://git.ying-qing.cn/api/v1/repos/gitea/hose-use/releases/latest`;
const githubTagUrl = tag
? `https://api.github.com/repos/${repo}/releases/tags/${tag}`
: `https://api.github.com/repos/${repo}/releases/latest`;
if (sourcePreference === "github") {
urls.push(githubTagUrl);
} else if (sourcePreference === "gitea") {
if (allowGitea) urls.push(giteaTagUrl);
urls.push(githubTagUrl);
} else {
if (allowGitea) urls.push(giteaTagUrl);
urls.push(githubTagUrl);
}
let fallbackRelease: GitHubRelease | undefined;
@@ -642,32 +743,47 @@ function logProgress(msg: string) {
}
}
async function downloadFile(url: string, destPath: string, tagName?: string, assetName?: string) {
export async function downloadFile(
url: string,
destPath: string,
tagName?: string,
assetName?: string,
repo: string = DEFAULT_GITHUB_REPO,
sourcePreference: UpdateSourcePreference = "auto"
) {
const candidates: string[] = [];
const tag = tagName ? (tagName.startsWith("v") ? tagName : `v${tagName}`) : undefined;
const fileName = assetName || url.split("/").pop() || "";
const isDefaultRepo = repo.toLowerCase() === DEFAULT_GITHUB_REPO.toLowerCase();
const allowGitea = isDefaultRepo && sourcePreference !== "github";
// 1. High-speed Gitea direct mirror first
if (tag && fileName) {
candidates.push(`https://git.ying-qing.cn/gitea/hose-use/releases/download/${tag}/${fileName}`);
}
if (url.startsWith("https://git.ying-qing.cn")) {
candidates.push(url);
// 1. High-speed Gitea direct mirror first (only for default official repo)
if (allowGitea) {
if (tag && fileName) {
candidates.push(`https://git.ying-qing.cn/gitea/hose-use/releases/download/${tag}/${fileName}`);
}
if (url.startsWith("https://git.ying-qing.cn")) {
candidates.push(url);
}
}
// 2. Fast GitHub CDN proxies and direct GitHub fallback
// 2. Fast GitHub CDN proxies and direct GitHub fallback (dynamic repo)
if (tag && fileName) {
const ghDirectUrl = `https://github.com/${DEFAULT_GITHUB_REPO}/releases/download/${tag}/${fileName}`;
candidates.push(`https://ghfast.top/${ghDirectUrl}`);
candidates.push(`https://ghproxy.net/${ghDirectUrl}`);
candidates.push(`https://gh.ddlc.top/${ghDirectUrl}`);
candidates.push(`https://mirror.ghproxy.com/${ghDirectUrl}`);
const ghDirectUrl = `https://github.com/${repo}/releases/download/${tag}/${fileName}`;
if (sourcePreference !== "gitea") {
candidates.push(`https://ghfast.top/${ghDirectUrl}`);
candidates.push(`https://ghproxy.net/${ghDirectUrl}`);
candidates.push(`https://gh.ddlc.top/${ghDirectUrl}`);
candidates.push(`https://mirror.ghproxy.com/${ghDirectUrl}`);
}
candidates.push(ghDirectUrl);
} else if (url.includes("github.com")) {
candidates.push(`https://ghfast.top/${url}`);
candidates.push(`https://ghproxy.net/${url}`);
candidates.push(`https://gh.ddlc.top/${url}`);
candidates.push(`https://mirror.ghproxy.com/${url}`);
if (sourcePreference !== "gitea") {
candidates.push(`https://ghfast.top/${url}`);
candidates.push(`https://ghproxy.net/${url}`);
candidates.push(`https://gh.ddlc.top/${url}`);
candidates.push(`https://mirror.ghproxy.com/${url}`);
}
candidates.push(url);
} else {
candidates.push(url);
+12 -5
View File
@@ -8,6 +8,7 @@ const KNOWN_BOOLEAN_FLAGS = new Set([
"h",
"version",
"v",
"V",
"force",
"f",
"stateless",
@@ -48,8 +49,10 @@ export function parseArgs(rawArgs: string[]): CliParsedArgs {
options[key] = val;
} else {
const key = arg.slice(2);
if (KNOWN_BOOLEAN_FLAGS.has(key)) {
const keyLower = key.toLowerCase();
if (KNOWN_BOOLEAN_FLAGS.has(key) || KNOWN_BOOLEAN_FLAGS.has(keyLower)) {
options[key] = true;
if (key !== keyLower) options[keyLower] = true;
} else {
const next = rawArgs[i + 1];
if (next && !next.startsWith("-")) {
@@ -65,10 +68,14 @@ export function parseArgs(rawArgs: string[]): CliParsedArgs {
if (arg.startsWith("-") && arg.length > 1) {
const flag = arg.slice(1);
if (flag === "h") options.help = true;
else if (flag === "j") options.json = true;
else if (flag === "v") options.version = true;
else if (flag === "o") {
const flagLower = flag.toLowerCase();
if (flagLower === "h" || flag === "?") {
options.help = true;
} else if (flagLower === "j") {
options.json = true;
} else if (flagLower === "v") {
options.version = true;
} else if (flag === "o") {
const next = rawArgs[i + 1];
if (next && !next.startsWith("-")) {
options.outputFile = next;
+2 -1
View File
@@ -129,7 +129,7 @@ export function printHelp(): string {
permission 权限模型快照 (get)
skill Agent Skill 管理 (install, status, dump)
probe 连通性诊断 (probe [corpId])
update 版本自更新与发布记录 (update, update check, update --changelog)
update 版本自更新与发布记录 (update, update check, update --changelog, --github, --gitea, --repo=<owner/repo>)
openapi OpenAPI 3.1.0 规范导出 (openapi, openapi --raw, openapi paths, openapi info)
http 启动轻量 HTTP Server 与交互式文档 (http [--port=8888] [--host=127.0.0.1])
service 常驻守护进程管理 (service start|stop|restart|status|logs|poll)
@@ -194,6 +194,7 @@ export function printHelp(): string {
hose-use probe # 诊断当前企业鉴权连通性
hose-use skill install # 安装 Agent 技能到用户目录
hose-use update # 自动检查并升级到最新版本
hose-use update --github # 强制走官方 GitHub 源升级
hose-use update --changelog # 查看版本发布历史
hose-use openapi paths # 查看所有 API 路径与概要一览
hose-use openapi --raw # 导出原生下游全量 OpenAPI 规范
+63
View File
@@ -0,0 +1,63 @@
import { describe, expect, it } from "bun:test";
import { runCli } from "./runner.js";
import { VERSION } from "../version.js";
describe("CLI runner - version and help aliases", () => {
const versionVariants = [
["version"],
["verSion"],
["versioN"],
["VERSION"],
["Version"],
["v"],
["V"],
["-v"],
["-V"],
["--version"],
["--verSion"],
["--VERSION"],
["--v"],
["--V"],
];
for (const args of versionVariants) {
it(`correctly outputs version for "${args.join(" ")}"`, async () => {
const result = await runCli(args);
expect(result.exitCode).toBe(0);
expect(result.stderr).toBe("");
expect(result.stdout).toBe(`hose-use v${VERSION}\n`);
});
}
const helpVariants = [
[],
["help"],
["HeLp"],
["HELP"],
["h"],
["H"],
["-h"],
["-H"],
["--help"],
["--HeLp"],
["--HELP"],
["?"],
["-?"],
];
for (const args of helpVariants) {
it(`correctly outputs help for "${args.join(" ") || "<empty>"}"`, async () => {
const result = await runCli(args);
expect(result.exitCode).toBe(0);
expect(result.stderr).toBe("");
expect(result.stdout).toContain(`合思/易快报企业级 CLI 工具 (hose-use) v${VERSION}`);
expect(result.stdout).toContain("用法:");
});
}
it("handles unknown commands gracefully", async () => {
const result = await runCli(["unknown-command-xyz"]);
expect(result.exitCode).toBe(1);
expect(result.stderr).toContain("未知命令域: unknown-command-xyz");
});
});
+29 -3
View File
@@ -21,7 +21,7 @@ import { handleMessageCommand } from "./commands/message.js";
import { handleDimensionCommand } from "./commands/dimension.js";
import { handleRoleCommand } from "./commands/role.js";
import { handlePermissionCommand } from "./commands/permission.js";
import type { CliResult, CliRunOptions } from "./types.js";
import type { CliParsedArgs, CliResult, CliRunOptions } from "./types.js";
const STANDING_COMMANDS = new Set(["http", "server", "web", "mcp"]);
@@ -82,17 +82,43 @@ async function runCliOnce(
}
}
function isHelpRequested(parsed: CliParsedArgs): boolean {
const normArea = (parsed.area || "").replace(/^-+/, "").toLowerCase();
if (normArea === "help" || normArea === "h" || normArea === "?") return true;
for (const [key, val] of Object.entries(parsed.options)) {
const normKey = key.replace(/^-+/, "").toLowerCase();
if (normKey === "help" || normKey === "h" || normKey === "?") {
if (val === true || val === "true" || val === "") return true;
}
}
return false;
}
function isVersionRequested(parsed: CliParsedArgs): boolean {
const normArea = (parsed.area || "").replace(/^-+/, "").toLowerCase();
if (normArea === "version" || normArea === "v") return true;
for (const [key, val] of Object.entries(parsed.options)) {
const normKey = key.replace(/^-+/, "").toLowerCase();
if (normKey === "version" || normKey === "v") {
if (val === true || val === "true" || val === "") return true;
}
}
return false;
}
async function dispatchCli(
rawArgs: string[],
options: CliRunOptions = {}
): Promise<CliResult> {
const parsed = parseArgs(rawArgs);
if (booleanOption(parsed.options, ["help", "h"]) || parsed.area === "help") {
if (isHelpRequested(parsed)) {
return { stdout: printHelp() + "\n", stderr: "", exitCode: 0 };
}
if (booleanOption(parsed.options, ["version", "v"]) || parsed.area === "version") {
if (isVersionRequested(parsed)) {
return { stdout: `hose-use v${VERSION}\n`, stderr: "", exitCode: 0 };
}
+1 -5
View File
@@ -86,11 +86,7 @@ export function loadGlobalConfig(): GlobalConfig {
// 容错返回默认
}
return {
stateful: true,
defaultCorpId: undefined,
defaultAccountId: undefined,
};
return GlobalConfigSchema.parse({});
}
export function saveGlobalConfig(config: Partial<GlobalConfig>): GlobalConfig {
+3
View File
@@ -65,6 +65,9 @@ export const GlobalConfigSchema = z.object({
stateful: z.boolean().default(true).describe("是否为有状态模式 (true 记忆默认企业,false 无状态需显式传 --corp)"),
defaultCorpId: z.string().optional().describe("默认工作企业 ID"),
defaultAccountId: z.string().optional().describe("默认主账号"),
updateRepo: z.string().optional().describe("默认自更新的 GitHub 仓库 (owner/repo)"),
updateSource: z.enum(["auto", "github", "gitea"]).optional().default("auto").describe("默认自更新源通道偏好 (auto/github/gitea)"),
});
export type GlobalConfig = z.infer<typeof GlobalConfigSchema>;
+2 -2
View File
@@ -1,6 +1,6 @@
import { describe, expect, test } from "bun:test";
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
import { Client } from "@modelcontextprotocol/client";
import { InMemoryTransport } from "@modelcontextprotocol/server";
import {
createServer,
resolveMcpMode,
+4 -8
View File
@@ -1,9 +1,5 @@
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import {
CallToolRequestSchema,
ListToolsRequestSchema,
} from "@modelcontextprotocol/sdk/types.js";
import { Server } from "@modelcontextprotocol/server";
import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
import { z } from "zod";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
@@ -192,7 +188,7 @@ export function createServer(options: { mode?: HoseMcpMode; enabled?: boolean }
const fineGrainedTools = [...authTools, ...platformTools, ...billTools];
// 注册工具列表
server.setRequestHandler(ListToolsRequestSchema, async () => {
server.setRequestHandler("tools/list", async () => {
if (!enabled) {
return { tools: [] };
}
@@ -234,7 +230,7 @@ export function createServer(options: { mode?: HoseMcpMode; enabled?: boolean }
});
// 处理工具调用
server.setRequestHandler(CallToolRequestSchema, async (request) => {
server.setRequestHandler("tools/call", async (request: any) => {
if (!enabled) {
return cliResult({
stdout: "",
+1 -1
View File
@@ -1 +1 @@
export const VERSION = "0.6.0";
export const VERSION = "0.6.2";