From a9dcca8cac9f7e74a5b8a7df82ad5ba8a1bb3954 Mon Sep 17 00:00:00 2001 From: yiling Date: Sat, 6 Jun 2026 09:42:49 +0800 Subject: [PATCH 1/4] ci: test local release and CLI execution in CI --- .github/workflows/ci.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9d4d7cda..ebe88843 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,3 +42,9 @@ jobs: - name: Test run: bun run test + + - name: Test Local Release + run: | + bun run release:local --skip-check --out /tmp/shumai-local-release --force + npx --prefix /tmp/shumai-local-release/node shumai-agent + npx --prefix /tmp/shumai-local-release/node shumai-transcode From 852564cc5611caf081c001d5217068bbbfa5e307 Mon Sep 17 00:00:00 2001 From: yiling Date: Sat, 6 Jun 2026 09:55:18 +0800 Subject: [PATCH 2/4] fix(workflow): add @temporalio/workflow alias to bun-temporal-plugin --- .../src/bun-temporal-plugin.test.ts | 50 +++++++++++++++++++ .../workflow-core/src/bun-temporal-plugin.ts | 5 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 packages/workflow-core/src/bun-temporal-plugin.test.ts diff --git a/packages/workflow-core/src/bun-temporal-plugin.test.ts b/packages/workflow-core/src/bun-temporal-plugin.test.ts new file mode 100644 index 00000000..ffc6ac84 --- /dev/null +++ b/packages/workflow-core/src/bun-temporal-plugin.test.ts @@ -0,0 +1,50 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest' +import { temporalWorkflow } from './bun-temporal-plugin' +import * as worker from '@temporalio/worker' + +vi.mock('@temporalio/worker', () => ({ + bundleWorkflowCode: vi.fn().mockResolvedValue({ code: 'mock-code', sourceMap: '' }) +})) + +describe('temporalWorkflow plugin', () => { + beforeEach(() => { + vi.clearAllMocks() + }) + + it('should register onLoad and configure webpackConfigHook with @temporalio/workflow alias', async () => { + const plugin = temporalWorkflow() + + let onLoadCallback: Function | null = null + + const mockBuild = { + onResolve: vi.fn(), + onLoad: vi.fn((opts, callback) => { + onLoadCallback = callback + }) + } + + // Run setup + // @ts-ignore + plugin.setup(mockBuild) + + expect(onLoadCallback).toBeDefined() + + // Trigger onLoad callback + await onLoadCallback!({ path: 'dummy-path' }) + + // Verify bundleWorkflowCode was called + expect(worker.bundleWorkflowCode).toHaveBeenCalled() + + // Inspect the webpackConfigHook that was passed to bundleWorkflowCode + const callArgs = vi.mocked(worker.bundleWorkflowCode).mock.calls[0][0] + expect(callArgs.webpackConfigHook).toBeDefined() + + // Invoke the hook with a dummy config + const config = { resolve: { alias: {} } } + const updatedConfig = callArgs.webpackConfigHook(config) + + // Check that aliases are set + expect(updatedConfig.resolve.alias['@shumai/workflow-core']).toBeDefined() + expect(updatedConfig.resolve.alias['@temporalio/workflow']).toBeDefined() + }) +}) diff --git a/packages/workflow-core/src/bun-temporal-plugin.ts b/packages/workflow-core/src/bun-temporal-plugin.ts index 2cec9cc2..92d1537f 100644 --- a/packages/workflow-core/src/bun-temporal-plugin.ts +++ b/packages/workflow-core/src/bun-temporal-plugin.ts @@ -1,6 +1,6 @@ import { bundleWorkflowCode } from '@temporalio/worker' import type { BunPlugin } from 'bun' -import { resolve } from 'node:path' +import { resolve, dirname } from 'node:path' export interface TemporalWorkflowPluginOptions { /** Query param identifier. Default: 'workflow' */ @@ -47,6 +47,9 @@ export function temporalWorkflow(options: TemporalWorkflowPluginOptions = {}): B ...config.resolve.alias, '@shumai/workflow-core': require.resolve('@shumai/workflow-core/src/workflow-utils.ts'), + '@temporalio/workflow': dirname( + require.resolve('@temporalio/workflow/package.json'), + ), } console.log('Webpack config aliases:', config.resolve.alias) if (originalHook) { From f82cac6f6ca81e045e9650056f59864e119eeffc Mon Sep 17 00:00:00 2001 From: yiling Date: Sat, 6 Jun 2026 10:15:04 +0800 Subject: [PATCH 3/4] fix(workflow): fix test file lint and typecheck errors --- packages/workflow-core/src/bun-temporal-plugin.test.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/workflow-core/src/bun-temporal-plugin.test.ts b/packages/workflow-core/src/bun-temporal-plugin.test.ts index ffc6ac84..8083d7a8 100644 --- a/packages/workflow-core/src/bun-temporal-plugin.test.ts +++ b/packages/workflow-core/src/bun-temporal-plugin.test.ts @@ -14,7 +14,7 @@ describe('temporalWorkflow plugin', () => { it('should register onLoad and configure webpackConfigHook with @temporalio/workflow alias', async () => { const plugin = temporalWorkflow() - let onLoadCallback: Function | null = null + let onLoadCallback: ((...args: unknown[]) => unknown) | null = null const mockBuild = { onResolve: vi.fn(), @@ -35,8 +35,10 @@ describe('temporalWorkflow plugin', () => { // Verify bundleWorkflowCode was called expect(worker.bundleWorkflowCode).toHaveBeenCalled() - // Inspect the webpackConfigHook that was passed to bundleWorkflowCode - const callArgs = vi.mocked(worker.bundleWorkflowCode).mock.calls[0][0] + // Webpack's configuration type is complex and varies across versions. + // We cast it to any here to allow indexing the config aliases dynamically. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const callArgs = vi.mocked(worker.bundleWorkflowCode).mock.calls[0][0] as any expect(callArgs.webpackConfigHook).toBeDefined() // Invoke the hook with a dummy config From 31abe72dd2e89e09ab4ce1ba33dcf0363ed0e38a Mon Sep 17 00:00:00 2001 From: yiling Date: Sat, 6 Jun 2026 10:23:42 +0800 Subject: [PATCH 4/4] ci: run CLI tests from prefix directory to fix prisma import --- .github/workflows/ci.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ebe88843..229553f7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -46,5 +46,6 @@ jobs: - name: Test Local Release run: | bun run release:local --skip-check --out /tmp/shumai-local-release --force - npx --prefix /tmp/shumai-local-release/node shumai-agent - npx --prefix /tmp/shumai-local-release/node shumai-transcode + cd /tmp/shumai-local-release/node + npx shumai-agent + npx shumai-transcode