@starhui/huly-cli 0.1.0 → 0.1.2
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.
- package/README.md +13 -0
- package/dist/index.js +20 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -66,6 +66,7 @@ npx -y @starhui/huly-cli@latest --config .env call get_issue --field project=HUL
|
|
|
66
66
|
## 命令
|
|
67
67
|
|
|
68
68
|
- `context`:输出脱敏后的 MCP/Huly 运行上下文。
|
|
69
|
+
- `--version`:输出 CLI 包名、CLI 版本、内置 `@firfi/huly-mcp` 版本和 Node.js 版本。
|
|
69
70
|
- `version-remote`:输出底层 `@firfi/huly-mcp` 版本信息。
|
|
70
71
|
- `tools`:列出上游 MCP 暴露的工具。
|
|
71
72
|
- `project list|get|statuses|create|update|delete`:项目相关操作。
|
|
@@ -98,6 +99,18 @@ npx -y skills add starhui-dev/huly-cli --skill huly-cli
|
|
|
98
99
|
npx -y skills add starhui-dev/huly-cli --list --full-depth
|
|
99
100
|
```
|
|
100
101
|
|
|
102
|
+
## 自动更新与发布
|
|
103
|
+
|
|
104
|
+
仓库内置 GitHub Actions:
|
|
105
|
+
|
|
106
|
+
- `Publish npm`:推送到 `main`、手动触发或每天定时运行;定时运行会先检查 `@firfi/huly-mcp` 最新版本,发现更新后自动更新依赖、patch bump CLI 版本、运行 `pnpm check`、打 tag、发布 `@starhui/huly-cli` 并创建 GitHub Release。
|
|
107
|
+
|
|
108
|
+
自动发布使用 npm Trusted Publishing。需要在 npm 包设置中添加 GitHub trusted publisher:
|
|
109
|
+
|
|
110
|
+
- 仓库:`starhui-dev/huly-cli`
|
|
111
|
+
- Workflow:`publish-npm.yml`
|
|
112
|
+
- Environment:留空,除非之后在 workflow 中显式配置 GitHub environment
|
|
113
|
+
|
|
101
114
|
## 开发
|
|
102
115
|
|
|
103
116
|
```bash
|
package/dist/index.js
CHANGED
|
@@ -73,7 +73,7 @@ var fail = (message) => {
|
|
|
73
73
|
|
|
74
74
|
// src/mcp-client.ts
|
|
75
75
|
import { spawn } from "node:child_process";
|
|
76
|
-
import { createRequire } from "node:module";
|
|
76
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
77
77
|
|
|
78
78
|
// src/json.ts
|
|
79
79
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
@@ -94,10 +94,24 @@ var parseJson = (value, label) => {
|
|
|
94
94
|
var readJsonObjectFile = (path) => parseJsonObject(readFileSync2(path, "utf8"), path);
|
|
95
95
|
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
96
96
|
|
|
97
|
-
// src/
|
|
97
|
+
// src/package-info.ts
|
|
98
|
+
import { createRequire } from "node:module";
|
|
98
99
|
var require2 = createRequire(import.meta.url);
|
|
100
|
+
var packageJson = require2("../package.json");
|
|
101
|
+
var cliPackageName = packageJson.name;
|
|
102
|
+
var cliVersion = packageJson.version;
|
|
103
|
+
var hulyMcpPackageName = "@firfi/huly-mcp";
|
|
104
|
+
var hulyMcpVersion = packageJson.dependencies?.[hulyMcpPackageName] ?? "unknown";
|
|
105
|
+
var formatVersionInfo = () => [
|
|
106
|
+
`${cliPackageName} ${cliVersion}`,
|
|
107
|
+
`${hulyMcpPackageName} ${hulyMcpVersion}`,
|
|
108
|
+
`node ${process.version}`
|
|
109
|
+
].join("\n");
|
|
110
|
+
|
|
111
|
+
// src/mcp-client.ts
|
|
112
|
+
var require3 = createRequire2(import.meta.url);
|
|
99
113
|
var createHulyMcpClient = async (config) => {
|
|
100
|
-
const serverPath = config.env.HULY_CLI_MCP_SERVER_PATH ??
|
|
114
|
+
const serverPath = config.env.HULY_CLI_MCP_SERVER_PATH ?? require3.resolve("@firfi/huly-mcp");
|
|
101
115
|
const transport = new JsonRpcStdioClient(
|
|
102
116
|
process.execPath,
|
|
103
117
|
[serverPath],
|
|
@@ -112,8 +126,8 @@ var createHulyMcpClient = async (config) => {
|
|
|
112
126
|
protocolVersion: "2025-06-18",
|
|
113
127
|
capabilities: {},
|
|
114
128
|
clientInfo: {
|
|
115
|
-
name:
|
|
116
|
-
version:
|
|
129
|
+
name: cliPackageName,
|
|
130
|
+
version: cliVersion
|
|
117
131
|
}
|
|
118
132
|
});
|
|
119
133
|
await transport.notify("notifications/initialized", {});
|
|
@@ -634,7 +648,7 @@ var parseOptionalNumber = (value, label) => {
|
|
|
634
648
|
|
|
635
649
|
// src/index.ts
|
|
636
650
|
var program = new Command();
|
|
637
|
-
program.name("huly").description("Huly command-line client powered by @firfi/huly-mcp").version(
|
|
651
|
+
program.name("huly").description("Huly command-line client powered by @firfi/huly-mcp").version(formatVersionInfo()).option("--config <path>", "Load Huly env vars from a dotenv-style file").option("--json", "Print JSON output").showHelpAfterError();
|
|
638
652
|
registerCommands(program);
|
|
639
653
|
program.parseAsync(process.argv).catch((error) => {
|
|
640
654
|
const message = error instanceof Error ? error.message : String(error);
|