diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9fcef7a..798e6e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,6 +92,20 @@ jobs: env: PTYWRIGHT_REQUIRED: "1" run: npm test --workspace @onkernel/cua-cli + - name: Build cua-cli + run: npm run build --workspace @onkernel/cua-cli + - name: Pack tarball + run: npm pack --workspace @onkernel/cua-cli --pack-destination "$RUNNER_TEMP" + - name: CLI bin smoke test + run: | + SMOKE_DIR=$(mktemp -d) + cd "$SMOKE_DIR" + npm init -y > /dev/null + npm install "$RUNNER_TEMP"/onkernel-cua-cli-*.tgz + OUTPUT=$(./node_modules/.bin/cua --help) + echo "$OUTPUT" + echo "$OUTPUT" | grep -q "Usage:" + echo "$OUTPUT" | grep -q "cua \[options\] \[prompt\.\.\.\]" integration: runs-on: ubuntu-latest diff --git a/package-lock.json b/package-lock.json index beae503..d1618ca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6116,6 +6116,7 @@ }, "devDependencies": { "@onkernel/ptywright": "0.1.0", + "tsdown": "^0.22.2", "vitest": "^3.2.4" }, "engines": { diff --git a/package.json b/package.json index a189916..1f5397e 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "packages/cli" ], "scripts": { - "build": "npm run build --workspace @onkernel/cua-ai && npm run build --workspace @onkernel/cua-agent && tsc -b && npm run build:native --workspace @onkernel/ptywright --if-present", + "build": "npm run build --workspace @onkernel/cua-ai && npm run build --workspace @onkernel/cua-agent && tsc -b && npm run build --workspace @onkernel/cua-cli && npm run build:native --workspace @onkernel/ptywright --if-present", "build:cli": "npm run build --workspace @onkernel/cua-cli", "dev": "tsc -b --watch", "typecheck": "npm run build --workspace @onkernel/cua-ai && npm run build --workspace @onkernel/cua-agent && tsc -b", diff --git a/packages/cli/package.json b/packages/cli/package.json index 061eeca..4a43a43 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -5,7 +5,6 @@ "license": "MIT", "type": "module", "main": "./dist/cli.js", - "types": "./dist/cli.d.ts", "repository": { "type": "git", "url": "git+https://github.com/kernel/cua.git", @@ -29,9 +28,10 @@ "node": ">=22.19.0" }, "scripts": { - "build": "tsc -b && chmod +x dist/cli.js", - "clean": "tsc -b --clean", - "test": "vitest --run" + "build": "tsdown && chmod +x dist/cli.js", + "clean": "tsc -b --clean && rm -rf dist dist-tsc", + "test": "vitest --run", + "typecheck": "tsc -b" }, "dependencies": { "@earendil-works/pi-coding-agent": "0.79.1", @@ -42,6 +42,7 @@ }, "devDependencies": { "@onkernel/ptywright": "0.1.0", + "tsdown": "^0.22.2", "vitest": "^3.2.4" } } diff --git a/packages/cli/tsconfig.build.json b/packages/cli/tsconfig.build.json new file mode 100644 index 0000000..d57acd1 --- /dev/null +++ b/packages/cli/tsconfig.build.json @@ -0,0 +1,15 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "./dist-tsc", + "rootDir": "./src", + "emitDeclarationOnly": true, + "sourceMap": false, + "declarationMap": false + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist", "**/*.d.ts"], + "references": [ + { "path": "../ptywright" } + ] +} diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index 95f9f63..d8faaf5 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -1,11 +1,3 @@ { - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "./dist", - "rootDir": "./src" - }, - "include": ["src/**/*"], - "references": [ - { "path": "../ptywright" } - ] + "extends": "./tsconfig.build.json" } diff --git a/packages/cli/tsdown.config.ts b/packages/cli/tsdown.config.ts new file mode 100644 index 0000000..cb7d4f7 --- /dev/null +++ b/packages/cli/tsdown.config.ts @@ -0,0 +1,11 @@ +import { defineConfig } from "tsdown"; + +export default defineConfig({ + entry: ["src/cli.ts"], + format: ["esm"], + platform: "node", + dts: false, + sourcemap: false, + clean: true, + outExtensions: () => ({ js: ".js" }), +});