From b1e9c7eed35f9a14328113a8bf62d3e1cc230568 Mon Sep 17 00:00:00 2001 From: yunyingk Date: Fri, 30 Oct 2026 14:11:17 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=BB=9F=E4=B8=80=E5=AF=B9=E5=A4=96?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=A7=84=E8=8C=83=E7=9B=AE=E5=BD=95=E4=B8=BA?= =?UTF-8?q?=20hose-open-api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将 specs/openapi 迁移为 specs/hose-open-api,与内部接口规范目录命名对齐。 同步 README、规范打包、版本更新与版本一致性检查,以及发布验证夹具。 验证:929 项测试通过,类型检查和版本检查通过;打包 JSON 字节内容不变。 --- README.md | 4 ++-- scripts/bump-version.ts | 8 ++++---- scripts/bundle-openapi.ts | 2 +- scripts/check-version-sync.ts | 2 +- scripts/release-validation.test.ts | 6 +++--- .../components/schemas/index.yaml | 0 specs/{openapi => hose-open-api}/openapi.yaml | 0 specs/{openapi => hose-open-api}/paths/auth.yaml | 0 specs/{openapi => hose-open-api}/paths/bill.yaml | 0 specs/{openapi => hose-open-api}/paths/corps.yaml | 0 specs/{openapi => hose-open-api}/paths/platform.yaml | 0 specs/{openapi => hose-open-api}/paths/probe.yaml | 0 specs/{openapi => hose-open-api}/paths/workflow.yaml | 0 13 files changed, 11 insertions(+), 11 deletions(-) rename specs/{openapi => hose-open-api}/components/schemas/index.yaml (100%) rename specs/{openapi => hose-open-api}/openapi.yaml (100%) rename specs/{openapi => hose-open-api}/paths/auth.yaml (100%) rename specs/{openapi => hose-open-api}/paths/bill.yaml (100%) rename specs/{openapi => hose-open-api}/paths/corps.yaml (100%) rename specs/{openapi => hose-open-api}/paths/platform.yaml (100%) rename specs/{openapi => hose-open-api}/paths/probe.yaml (100%) rename specs/{openapi => hose-open-api}/paths/workflow.yaml (100%) diff --git a/README.md b/README.md index 35bf2d2..d71a169 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ hose-use mcp # 启动 MCP Server (默认暴露 | `.agents/` | 本仓库的开发规则与技能发现配置,见 [.agents/README.md](./.agents/README.md);与产品分发用的 `skills/` 职责不同。 | | `.github/` | CI 与 Release 工作流,负责校验、构建和发布。 | | `.zcode-plugin/` | 受版本管理的 [IDE 插件清单](./.zcode-plugin/plugin.json),声明 Skill 路径、MCP 配置与用户开关。 | -| `specs/` | specifications(规范)的缩写,存放 API 与工作流规范:`openapi/` 是包装层 YAML 源文件,`openapi.json` 是其打包结果,`openapi.raw.json` 是独立的下游接口规范,`workflow-schema.json` 是从 Zod 导出的工作流结构。[hose-close-api/](./specs/hose-close-api/README.md) 保存从代码整理的合思内部接口清单与 Schema;本地临时抓包不纳入 Git。生成入口见下文。 | +| `specs/` | specifications(规范)的缩写,存放 API 与工作流规范:`hose-open-api/` 是 hose-use 包装层对外 API 的 YAML 源文件,`openapi.json` 是其打包结果,`openapi.raw.json` 是独立的下游接口规范,`workflow-schema.json` 是从 Zod 导出的工作流结构。[hose-close-api/](./specs/hose-close-api/README.md) 保存从代码整理的合思内部接口清单与 Schema;本地临时抓包不纳入 Git。生成入口见下文。 | | `dist/`(本地) | 全部是已忽略的构建输出:`mcp/server.js` 是 [.mcp.json](./.mcp.json) 引用的插件 bundle,`bin/` 保存独立二进制与发布归档。可重新构建,不随 Git 分发;删除后再次加载源码插件前须先构建。详见 [构建与分发说明](./src/packaging/README.packaging.md)。 | | `docs/` | 跨模块参考与审阅记录;Platform 模块说明和各域 README 提供当前 CLI 与服务导航,架构总纲见 [AGENTS.md](./AGENTS.md);`reviews/` 保留历史审阅及验证证据。 | | `enterprises/` | 仅跟踪配置示例与 [目录说明](./enterprises/README.md)。实际企业配置默认放在 `~/.config/hose-use/enterprises/`,仓库内其他企业 JSON 被忽略。 | @@ -147,7 +147,7 @@ hose-use mcp # 启动 MCP Server (默认暴露 规范生成关系与命令: -- `specs/openapi/**/*.yaml` → `specs/openapi.json`:`bun run openapi:bundle`。 +- `specs/hose-open-api/**/*.yaml` → `specs/openapi.json`:`bun run openapi:bundle`。 - `scripts/generate-raw-openapi.ts` → `specs/openapi.raw.json`:`bun run openapi:generate-raw`;与包装层规范描述不同接口,不是备份副本。 - `src/domains/platform/types.ts` → `specs/workflow-schema.json`:`bun run export:workflow-schema`。 diff --git a/scripts/bump-version.ts b/scripts/bump-version.ts index 04d0939..d99c344 100644 --- a/scripts/bump-version.ts +++ b/scripts/bump-version.ts @@ -37,7 +37,7 @@ export function bumpVersion(ROOT: string, input: string, rebuild = () => { if (git(["tag", "--list", `v${nextVersion}`])) throw new Error(`Tag v${nextVersion} already exists`); // Read all versioned sources before writing any of them. for (const file of ["README.md", "skills/hose-use/SKILL.md"]) readFileSync(join(ROOT, file), "utf8"); - for (const file of ["specs/openapi/openapi.yaml", ".zcode-plugin/plugin.json"]) { + for (const file of ["specs/hose-open-api/openapi.yaml", ".zcode-plugin/plugin.json"]) { if (existsSync(join(ROOT, file))) { const content = readFileSync(join(ROOT, file), "utf8"); if (file.endsWith(".json")) JSON.parse(content); @@ -68,13 +68,13 @@ export function bumpVersion(ROOT: string, input: string, rebuild = () => { writeFileSync(skillPath, skillContent); console.log("✓ Updated skills/hose-use/SKILL.md"); - // 4. specs/openapi/openapi.yaml - const openapiPath = join(ROOT, "specs", "openapi", "openapi.yaml"); + // 4. specs/hose-open-api/openapi.yaml + const openapiPath = join(ROOT, "specs", "hose-open-api", "openapi.yaml"); if (existsSync(openapiPath)) { let openapiContent = readFileSync(openapiPath, "utf-8"); openapiContent = openapiContent.replace(/version: \d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?/g, `version: ${nextVersion}`); writeFileSync(openapiPath, openapiContent); - console.log("✓ Updated specs/openapi/openapi.yaml"); + console.log("✓ Updated specs/hose-open-api/openapi.yaml"); } // 4.5 .zcode-plugin/plugin.json diff --git a/scripts/bundle-openapi.ts b/scripts/bundle-openapi.ts index a99257b..ea98ffc 100644 --- a/scripts/bundle-openapi.ts +++ b/scripts/bundle-openapi.ts @@ -6,7 +6,7 @@ import YAML from "yaml"; type Json = null | boolean | number | string | Json[] | { [key: string]: Json }; -const inputFile = resolve("specs/openapi/openapi.yaml"); +const inputFile = resolve("specs/hose-open-api/openapi.yaml"); const outputFile = resolve("specs/openapi.json"); const bundled = bundle(inputFile, new Set()); diff --git a/scripts/check-version-sync.ts b/scripts/check-version-sync.ts index 1376e9f..751a717 100644 --- a/scripts/check-version-sync.ts +++ b/scripts/check-version-sync.ts @@ -7,7 +7,7 @@ const packageVersion = (JSON.parse(readFileSync(join(root, "package.json"), "utf const expected: Array<[string, string | undefined]> = [ ["package.json", packageVersion], [".zcode-plugin/plugin.json", readJsonVersion(".zcode-plugin/plugin.json")], - ["specs/openapi/openapi.yaml", readFileSync(join(root, "specs/openapi/openapi.yaml"), "utf8").match(/^\s+version:\s+([^\s]+)\s*$/m)?.[1]], + ["specs/hose-open-api/openapi.yaml", readFileSync(join(root, "specs/hose-open-api/openapi.yaml"), "utf8").match(/^\s+version:\s+([^\s]+)\s*$/m)?.[1]], ["specs/openapi.json", readJsonVersion("specs/openapi.json", ["info", "version"])], ]; diff --git a/scripts/release-validation.test.ts b/scripts/release-validation.test.ts index 409c56e..eb4f447 100644 --- a/scripts/release-validation.test.ts +++ b/scripts/release-validation.test.ts @@ -22,11 +22,11 @@ function repository() { git("config", "core.hooksPath", "/dev/null"); git("config", "commit.gpgsign", "false"); git("config", "tag.gpgsign", "false"); - for (const dir of ["skills/hose-use", "specs/openapi", ".zcode-plugin"]) mkdirSync(join(root, dir), { recursive: true }); + for (const dir of ["skills/hose-use", "specs/hose-open-api", ".zcode-plugin"]) mkdirSync(join(root, dir), { recursive: true }); writeFileSync(join(root, "package.json"), '{"version":"1.0.0"}\n'); writeFileSync(join(root, "README.md"), "# hose-use (v1.0.0)\n"); writeFileSync(join(root, "skills/hose-use/SKILL.md"), "version: 1.0.0\n# hose-use (v1.0.0)\n"); - writeFileSync(join(root, "specs/openapi/openapi.yaml"), "info:\n version: 1.0.0\n"); + writeFileSync(join(root, "specs/hose-open-api/openapi.yaml"), "info:\n version: 1.0.0\n"); writeFileSync(join(root, ".zcode-plugin/plugin.json"), '{"version":"1.0.0"}\n'); git("add", "."); git("commit", "-m", "fixture"); @@ -97,7 +97,7 @@ describe("release preparation and publication guards", () => { expect(rebuilt).toBe(true); expect(f.version()).toBe("1.0.1"); expect(readFileSync(join(f.root, "skills/hose-use/SKILL.md"), "utf8")).toContain("version: 1.0.1"); - expect(parse(readFileSync(join(f.root, "specs/openapi/openapi.yaml"), "utf8")).info.version).toBe("1.0.1"); + expect(parse(readFileSync(join(f.root, "specs/hose-open-api/openapi.yaml"), "utf8")).info.version).toBe("1.0.1"); }, 60_000); test("an existing release tag cannot be reused during bump", () => { diff --git a/specs/openapi/components/schemas/index.yaml b/specs/hose-open-api/components/schemas/index.yaml similarity index 100% rename from specs/openapi/components/schemas/index.yaml rename to specs/hose-open-api/components/schemas/index.yaml diff --git a/specs/openapi/openapi.yaml b/specs/hose-open-api/openapi.yaml similarity index 100% rename from specs/openapi/openapi.yaml rename to specs/hose-open-api/openapi.yaml diff --git a/specs/openapi/paths/auth.yaml b/specs/hose-open-api/paths/auth.yaml similarity index 100% rename from specs/openapi/paths/auth.yaml rename to specs/hose-open-api/paths/auth.yaml diff --git a/specs/openapi/paths/bill.yaml b/specs/hose-open-api/paths/bill.yaml similarity index 100% rename from specs/openapi/paths/bill.yaml rename to specs/hose-open-api/paths/bill.yaml diff --git a/specs/openapi/paths/corps.yaml b/specs/hose-open-api/paths/corps.yaml similarity index 100% rename from specs/openapi/paths/corps.yaml rename to specs/hose-open-api/paths/corps.yaml diff --git a/specs/openapi/paths/platform.yaml b/specs/hose-open-api/paths/platform.yaml similarity index 100% rename from specs/openapi/paths/platform.yaml rename to specs/hose-open-api/paths/platform.yaml diff --git a/specs/openapi/paths/probe.yaml b/specs/hose-open-api/paths/probe.yaml similarity index 100% rename from specs/openapi/paths/probe.yaml rename to specs/hose-open-api/paths/probe.yaml diff --git a/specs/openapi/paths/workflow.yaml b/specs/hose-open-api/paths/workflow.yaml similarity index 100% rename from specs/openapi/paths/workflow.yaml rename to specs/hose-open-api/paths/workflow.yaml