From 06f67093177d4c43850861b651ea1e11ffda19cb Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Mon, 18 May 2026 21:20:05 +0900 Subject: [PATCH] build: wire ast-grep MCP into release gates Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- .github/workflows/ci.yml | 6 +++--- .github/workflows/publish-platform.yml | 3 ++- .github/workflows/publish.yml | 14 +++++--------- .github/workflows/refresh-model-capabilities.yml | 2 +- package.json | 7 ++++--- script/build-binaries.ts | 2 ++ 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f3f414d1a..68b8792f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,7 +55,7 @@ jobs: - name: Install dependencies run: bun install --frozen-lockfile env: - BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/napi" + BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/cli @ast-grep/napi" - name: Run tests run: bun test @@ -83,7 +83,7 @@ jobs: - name: Install dependencies run: bun install --frozen-lockfile env: - BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/napi" + BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/cli @ast-grep/napi" - name: Type check run: bun run typecheck @@ -118,7 +118,7 @@ jobs: - name: Install dependencies run: bun install --frozen-lockfile env: - BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/napi" + BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/cli @ast-grep/napi" - name: Build run: bun run build diff --git a/.github/workflows/publish-platform.yml b/.github/workflows/publish-platform.yml index 7fcf6d913..5f061ab6b 100644 --- a/.github/workflows/publish-platform.yml +++ b/.github/workflows/publish-platform.yml @@ -54,7 +54,7 @@ jobs: - name: Install dependencies run: bun install --frozen-lockfile env: - BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/napi" + BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/cli @ast-grep/napi" - name: Validate release inputs id: validate @@ -187,6 +187,7 @@ jobs: retry_wait_seconds: 10 shell: bash command: | + bun run build:ast-grep-mcp PLATFORM="${{ matrix.platform }}" PACKAGE_DIR="packages/oh-my-opencode-${PLATFORM}" case "$PLATFORM" in diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a369822ba..210205b95 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -43,7 +43,7 @@ jobs: - name: Install dependencies run: bun install --frozen-lockfile env: - BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/napi" + BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/cli @ast-grep/napi" - name: Run tests run: bun test @@ -60,7 +60,7 @@ jobs: - name: Install dependencies run: bun install --frozen-lockfile env: - BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/napi" + BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/cli @ast-grep/napi" - name: Type check run: bun run typecheck @@ -162,7 +162,7 @@ jobs: - name: Install dependencies run: bun install --frozen-lockfile env: - BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/napi" + BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/cli @ast-grep/napi" - name: Calculate version id: version @@ -232,11 +232,7 @@ jobs: - name: Build main package if: steps.check.outputs.skip != 'true' - run: | - bun build src/index.ts --outdir dist --target bun --format esm --external @ast-grep/napi - bun build src/cli/index.ts --outdir dist/cli --target bun --format esm --external @ast-grep/napi - bunx tsc --emitDeclarationOnly - bun run build:schema + run: bun run build - name: Strip token auth from .npmrc to force OIDC if: steps.check.outputs.skip != 'true' @@ -330,7 +326,7 @@ jobs: - name: Install dependencies run: bun install --frozen-lockfile env: - BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/napi" + BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/cli @ast-grep/napi" - name: Generate changelog run: | diff --git a/.github/workflows/refresh-model-capabilities.yml b/.github/workflows/refresh-model-capabilities.yml index d21a2d661..0bec53521 100644 --- a/.github/workflows/refresh-model-capabilities.yml +++ b/.github/workflows/refresh-model-capabilities.yml @@ -23,7 +23,7 @@ jobs: - name: Install dependencies run: bun install --frozen-lockfile env: - BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/napi" + BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/cli @ast-grep/napi" - name: Refresh bundled model capabilities snapshot run: bun run build:model-capabilities diff --git a/package.json b/package.json index 449ff7f05..b09b51457 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "./schema.json": "./dist/oh-my-opencode.schema.json" }, "scripts": { - "build": "bun build src/index.ts --outdir dist --target bun --format esm --external @ast-grep/napi --external zod && bun run build:node-require-shim && tsc --emitDeclarationOnly && bun build src/cli/index.ts --outdir dist/cli --target bun --format esm --external @ast-grep/napi && bun run build:schema", + "build": "bun run build:ast-grep-mcp && bun build src/index.ts --outdir dist --target bun --format esm --external @ast-grep/napi --external zod && bun run build:node-require-shim && tsc --emitDeclarationOnly && bun build src/cli/index.ts --outdir dist/cli --target bun --format esm --external @ast-grep/napi && bun run build:schema", "build:lsp-tools-mcp": "npm --prefix packages/lsp-tools-mcp ci && npm --prefix packages/lsp-tools-mcp run build", "build:node-require-shim": "bun run script/patch-node-require-shim.ts", "build:all": "bun run build && bun run build:binaries", @@ -38,9 +38,10 @@ "clean": "rm -rf dist", "prepare": "bun run build", "postinstall": "node postinstall.mjs", - "prepublishOnly": "bun run clean && bun run build:lsp-tools-mcp && bun run build:ast-grep-mcp && bun run build", + "prepublishOnly": "bun run clean && bun run build:lsp-tools-mcp && bun run build", "test:model-capabilities": "bun test src/shared/model-capability-aliases.test.ts src/shared/model-capability-guardrails.test.ts src/shared/model-capabilities.test.ts src/cli/doctor/checks/model-resolution.test.ts --bail", - "typecheck": "tsgo --noEmit", + "typecheck": "tsgo --noEmit && bun run typecheck:packages", + "typecheck:packages": "tsgo --noEmit -p packages/rules-core/tsconfig.json && tsgo --noEmit -p packages/ast-grep-mcp/tsconfig.json", "typecheck:script": "tsgo --noEmit -p script/tsconfig.json", "test": "bun test", "build:ast-grep-mcp": "bun run --cwd packages/ast-grep-mcp build" diff --git a/script/build-binaries.ts b/script/build-binaries.ts index 0e1c69f00..7e3c20e15 100644 --- a/script/build-binaries.ts +++ b/script/build-binaries.ts @@ -67,6 +67,8 @@ async function main() { console.log(` Entry point: ${ENTRY_POINT}`); console.log(` Platforms: ${PLATFORMS.length}`); + await $`bun run build:ast-grep-mcp`; + // Verify entry point exists if (!existsSync(ENTRY_POINT)) { console.error(`\n❌ Entry point not found: ${ENTRY_POINT}`);