chore(release): 更新项目与 CLI 名称为 hose-use,升级到 v0.2.0,增加二进制构建与 GitHub Actions Release 工作流,集成 Agent Skill
🚀 Release / 🚀 Build & Publish Multi-Platform Binaries (push) Has been cancelled
🚀 Release / 🚀 Build & Publish Multi-Platform Binaries (push) Has been cancelled
This commit is contained in:
1 parent
b7a3bf2c03
commit
dbeb422aeb
13 files changed
+653
-37
No files matched your search
@@ -0,0 +1,122 @@
|
||||
import { existsSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import {
|
||||
getDefaultGlobalSkillDir,
|
||||
getAgentSkillCandidates,
|
||||
getSkillContent,
|
||||
installSkillFiles,
|
||||
} from "../../core/embedded-skill.js";
|
||||
import { booleanOption, stringOption } from "../parser.js";
|
||||
import { printJson, printKeyValue } from "../printer.js";
|
||||
import type { CliParsedArgs, CliResult, CliRuntime } from "../types.js";
|
||||
|
||||
export async function handleSkillCommand(
|
||||
parsed: CliParsedArgs,
|
||||
runtime: CliRuntime
|
||||
): Promise<CliResult> {
|
||||
const action = parsed.action || "status";
|
||||
|
||||
switch (action) {
|
||||
case "dump":
|
||||
case "cat":
|
||||
case "show":
|
||||
return {
|
||||
stdout: `${getSkillContent()}\n`,
|
||||
stderr: "",
|
||||
exitCode: 0,
|
||||
};
|
||||
|
||||
case "install":
|
||||
case "init":
|
||||
case "sync": {
|
||||
const isLocal =
|
||||
booleanOption(parsed.options, ["local"]) ||
|
||||
booleanOption(parsed.options, ["workspace"]);
|
||||
const customDir =
|
||||
stringOption(parsed.options, ["dir", "target"]) || parsed.args[0];
|
||||
|
||||
const targetDir = customDir
|
||||
? customDir
|
||||
: isLocal
|
||||
? join(process.cwd(), ".agents", "skills", "hose-use")
|
||||
: getDefaultGlobalSkillDir();
|
||||
|
||||
const result = installSkillFiles(targetDir);
|
||||
|
||||
// 也同时尝试安装到其它检测到的候选目录
|
||||
const candidates = getAgentSkillCandidates();
|
||||
for (const dir of candidates) {
|
||||
if (dir !== targetDir) {
|
||||
try {
|
||||
installSkillFiles(dir);
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (runtime.jsonMode) {
|
||||
return {
|
||||
stdout: printJson({
|
||||
installed: true,
|
||||
targetDir: result.targetDir,
|
||||
fileCount: result.files.length,
|
||||
files: result.files,
|
||||
}),
|
||||
stderr: "",
|
||||
exitCode: 0,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
stdout: `[SUCCESS] hose-use 技能已成功安装至: ${result.targetDir}\n包含文件: ${result.files.join(", ")}\n`,
|
||||
stderr: "",
|
||||
exitCode: 0,
|
||||
};
|
||||
}
|
||||
|
||||
case "status":
|
||||
case "get": {
|
||||
const globalDir = getDefaultGlobalSkillDir();
|
||||
const localDir = join(process.cwd(), ".agents", "skills", "hose-use");
|
||||
const candidates = getAgentSkillCandidates();
|
||||
|
||||
const statusObj = {
|
||||
global: {
|
||||
dir: globalDir,
|
||||
installed: existsSync(join(globalDir, "SKILL.md")),
|
||||
},
|
||||
local: {
|
||||
dir: localDir,
|
||||
installed: existsSync(join(localDir, "SKILL.md")),
|
||||
},
|
||||
candidates: candidates.map((dir) => ({
|
||||
dir,
|
||||
installed: existsSync(join(dir, "SKILL.md")),
|
||||
})),
|
||||
};
|
||||
|
||||
if (runtime.jsonMode) {
|
||||
return { stdout: printJson(statusObj), stderr: "", exitCode: 0 };
|
||||
}
|
||||
|
||||
const output = printKeyValue({
|
||||
"全局 Skill 目录": `${globalDir} [${statusObj.global.installed ? "已安装 ✅" : "未安装 ❌"}]`,
|
||||
"本地 Skill 目录": `${localDir} [${statusObj.local.installed ? "已安装 ✅" : "未安装 ❌"}]`,
|
||||
});
|
||||
|
||||
return {
|
||||
stdout: `====== Agent Skill 状态 ======\n${output}\n\n提示: 运行 hose-use skill install 进行全局安装\n`,
|
||||
stderr: "",
|
||||
exitCode: 0,
|
||||
};
|
||||
}
|
||||
|
||||
default:
|
||||
return {
|
||||
stdout: "",
|
||||
stderr: `未知 skill 子命令: ${action}。支持: install, status, dump\n`,
|
||||
exitCode: 1,
|
||||
};
|
||||
}
|
||||
}
|
||||
+16
-10
@@ -38,32 +38,38 @@ export function printTable(
|
||||
|
||||
export function printHelp(): string {
|
||||
return `
|
||||
合思/易快报企业级 CLI 工具 (hose) v${VERSION}
|
||||
合思/易快报企业级 CLI 工具 (hose-use) v${VERSION}
|
||||
|
||||
用法:
|
||||
hose <命令域> <子命令> [参数] [选项]
|
||||
hose-use <命令域> <子命令> [参数] [选项]
|
||||
|
||||
核心命令域:
|
||||
auth 认证与凭证管理 (login, status, refresh, import, accounts)
|
||||
corps 多企业租户管理 (list, switch, current)
|
||||
config 全局运行模式 (show, mode <stateful|stateless>, set)
|
||||
workflow 工作流管理 (list, get, find, toggle)
|
||||
platform 自建应用管理 (list)
|
||||
skill Agent Skill 管理 (install, status, dump)
|
||||
probe 连通性诊断 (probe [corpId])
|
||||
mcp MCP Server 运行 (serve)
|
||||
version 查看版本信息
|
||||
|
||||
全局选项:
|
||||
--corp=<id> 临时指定操作的企业 ID (覆盖当前激活企业)
|
||||
--corp=<id> 临时指定操作的企业/身份 ID (覆盖默认企业)
|
||||
--json, -j 以 JSON 结构化输出结果 (适合脚本/流水线集成)
|
||||
--stateless 单次强制以无状态模式执行
|
||||
--stateful 单次强制以有状态模式执行
|
||||
--help, -h 查看帮助信息
|
||||
|
||||
常用示例:
|
||||
hose auth login --phone=177... --password=... # 纯 API 账密自动登录
|
||||
hose auth status # 查看当前登录状态与活跃企业
|
||||
hose corps list # 列出名下所有企业
|
||||
hose corps switch uzU7pcWfScck00 # 切换工作企业
|
||||
hose workflow list # 汇总查看全部工作流
|
||||
hose workflow find --task=code-js2 # 搜索包含自定义脚本的工作流
|
||||
hose probe # 诊断当前企业鉴权连通性
|
||||
hose-use auth login --phone=177... --password=... # 纯 API 账密自动登录
|
||||
hose-use auth status # 查看当前登录状态与活跃企业
|
||||
hose-use config mode stateless # 切换为无状态模式 (防止 Agent 误操作)
|
||||
hose-use corps list # 列出名下所有企业
|
||||
hose-use corps switch uzU7pcWfScck00 # 切换工作企业
|
||||
hose-use workflow list # 汇总查看全部工作流
|
||||
hose-use workflow find --task=code-js2 # 搜索包含自定义脚本的工作流
|
||||
hose-use probe # 诊断当前企业鉴权连通性
|
||||
hose-use skill install # 安装 Agent 技能到用户目录
|
||||
`.trim();
|
||||
}
|
||||
+5
-1
@@ -7,6 +7,7 @@ import { handleCorpsCommand } from "./commands/corps.js";
|
||||
import { handleConfigCommand } from "./commands/config.js";
|
||||
import { handleWorkflowCommand } from "./commands/workflow.js";
|
||||
import { handlePlatformCommand } from "./commands/platform.js";
|
||||
import { handleSkillCommand } from "./commands/skill.js";
|
||||
import { handleProbeCommand } from "./commands/probe.js";
|
||||
import { handleMcpCommand } from "./commands/mcp.js";
|
||||
import type { CliResult, CliRunOptions } from "./types.js";
|
||||
@@ -22,7 +23,7 @@ export async function runCli(
|
||||
}
|
||||
|
||||
if (booleanOption(parsed.options, ["version", "v"]) || parsed.area === "version") {
|
||||
return { stdout: `hose v${VERSION}\n`, stderr: "", exitCode: 0 };
|
||||
return { stdout: `hose-use v${VERSION}\n`, stderr: "", exitCode: 0 };
|
||||
}
|
||||
|
||||
const jsonMode = booleanOption(parsed.options, ["json", "j"]);
|
||||
@@ -57,6 +58,9 @@ export async function runCli(
|
||||
case "app":
|
||||
case "apps":
|
||||
return await handlePlatformCommand(parsed, runtime);
|
||||
case "skill":
|
||||
case "skills":
|
||||
return await handleSkillCommand(parsed, runtime);
|
||||
case "probe":
|
||||
case "check":
|
||||
case "diagnose":
|
||||
|
||||
Reference in new issue
Block a user