refactor: restructured monorepo TypeScript config and build tasks for unified setup

- Migrated all package tsconfig files to extend tsconfig.workspace.json for unified TypeScript configuration across monorepo.
- Consolidated build and check scripts across 10+ packages to use biome for linting/formatting with separate type checking via tsgo.
- Renamed build scripts from build:native and build:binary to build for simplified command naming across packages/natives and packages/coding-agent.
- Refactored CI workflow to invoke bun tasks instead of inline shell scripts, reducing workflow complexity by 40+ lines.
- Removed sync-exports.ts and repro-stuck.ts scripts; deleted path aliases from tsconfig.base.json in favor of workspace-based configuration.
- Updated turbo.json with new task definitions (check:types, lint, fmt, fix) and removed build:native/embed:native tasks.
This commit is contained in:
can1357
2026-04-08 16:09:37 +02:00
parent 61dff04ab1
commit 52719d1a7c
55 changed files with 777 additions and 746 deletions
+37 -75
View File
@@ -23,6 +23,8 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3"
@@ -31,8 +33,20 @@ jobs:
with:
path: ~/.bun/install/cache
key: bun-${{ runner.os }}-${{ hashFiles('**/bun.lock') }}
- name: Cache Turbo artifacts
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
- run: bun install --frozen-lockfile
- run: bun run check:ts
- name: Type check changed packages
if: github.event_name == 'pull_request'
run: bun run ci:check:affected
- name: Type check full workspace
if: github.event_name != 'pull_request'
run: bun run ci:check:full
native:
strategy:
@@ -78,9 +92,7 @@ jobs:
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Rust checks
if: matrix.rust_checks
run: |
cargo fmt --all -- --check
cargo clippy --workspace -- -D warnings
run: bun run check:rs
- name: Build native addon(s)
env:
CROSS_TARGET: ${{ matrix.target }}
@@ -89,19 +101,7 @@ jobs:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
shell: bash
run: |
VARIANTS="${{ matrix.variants }}"
if [ -z "$VARIANTS" ]; then
bun --cwd=packages/natives run build:native
else
for variant in $VARIANTS; do
case "$variant" in
baseline) export RUSTFLAGS="-C target-cpu=x86-64-v2" ;;
modern) export RUSTFLAGS="-C target-cpu=x86-64-v3" ;;
esac
export TARGET_VARIANT="$variant"
bun --cwd=packages/natives run build:native
done
fi
bun run ci:build:native
- name: Upload native addon(s)
uses: actions/upload-artifact@v4
with:
@@ -115,6 +115,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- uses: oven-sh/setup-bun@v2
with:
@@ -133,6 +134,13 @@ jobs:
with:
path: ~/.bun/install/cache
key: bun-${{ runner.os }}-${{ hashFiles('**/bun.lock') }}
- name: Cache Turbo artifacts
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
- name: Install system deps
run: |
sudo apt-get update
@@ -140,13 +148,15 @@ jobs:
sudo ln -s $(which fdfind) /usr/local/bin/fd
sudo ln -sf /usr/bin/convert /usr/local/bin/magick
- run: bun install --frozen-lockfile
- run: bun --cwd=packages/natives run build:native
- run: bun run test
- run: bun run build:native
- name: Test changed packages
if: github.event_name == 'pull_request'
run: bun run ci:test:affected
- name: Test full workspace
if: github.event_name != 'pull_request'
run: bun run ci:test:full
- name: CLI smoke test
run: |
bun packages/coding-agent/src/cli.ts --version
bun packages/coding-agent/src/cli.ts --help
bun packages/coding-agent/src/cli.ts stats --help
run: bun run ci:test:smoke
install_methods:
runs-on: ubuntu-22.04
@@ -179,7 +189,7 @@ jobs:
sudo ln -sf /usr/bin/convert /usr/local/bin/magick
- run: bun install --frozen-lockfile
- name: Install method smoke tests
run: bash scripts/install-tests/run-ci.sh
run: bun run ci:test:install-methods
release:
if: startsWith(github.ref, 'refs/tags/v')
@@ -212,41 +222,10 @@ jobs:
path: packages/natives/native
merge-multiple: true
- name: Verify native addons
run: |
echo "Native addons downloaded:"
ls -la packages/natives/native/
echo ""
echo "Expected addons: linux-x64-modern, linux-x64-baseline, linux-arm64, darwin-x64-modern, darwin-x64-baseline, darwin-arm64, win32-x64-modern, win32-x64-baseline"
for plat in linux-x64-modern linux-x64-baseline linux-arm64 darwin-x64-modern darwin-x64-baseline darwin-arm64 win32-x64-modern win32-x64-baseline; do
if [ -f "packages/natives/native/pi_natives.${plat}.node" ]; then
echo "✓ pi_natives.${plat}.node"
else
echo "✗ pi_natives.${plat}.node MISSING"
exit 1
fi
done
run: bun run ci:release:verify-natives
- name: Build binaries
run: |
bun --cwd=packages/stats scripts/generate-client-bundle.ts
mkdir -p packages/coding-agent/binaries
ENTRYPOINT="./packages/coding-agent/src/cli.ts"
DEFINES="--define PI_COMPILED=true --root ."
build_binary() {
PLATFORM="$1"
ARCH="$2"
TARGET="$3"
OUTFILE="$4"
TARGET_PLATFORM="$PLATFORM" TARGET_ARCH="$ARCH" bun --cwd=packages/natives run embed:native
bun build --compile $DEFINES --external mupdf --target="$TARGET" "$ENTRYPOINT" --outfile "$OUTFILE"
}
build_binary darwin arm64 bun-darwin-arm64 packages/coding-agent/binaries/omp-darwin-arm64
build_binary darwin x64 bun-darwin-x64 packages/coding-agent/binaries/omp-darwin-x64
build_binary linux x64 bun-linux-x64-modern packages/coding-agent/binaries/omp-linux-x64
build_binary linux arm64 bun-linux-arm64 packages/coding-agent/binaries/omp-linux-arm64
build_binary win32 x64 bun-windows-x64-modern packages/coding-agent/binaries/omp-windows-x64.exe
bun --cwd=packages/natives run embed:native --reset
bun --cwd=packages/stats scripts/generate-client-bundle.ts --reset
run: bun run ci:release:build-binaries
- name: Stage native addons for release
run: cp packages/natives/native/*.node packages/coding-agent/binaries/
- name: Create GitHub Release
@@ -258,21 +237,4 @@ jobs:
if: ${{ !inputs.skip_npm }}
env:
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
for pkg in packages/utils packages/ai packages/natives packages/tui packages/stats packages/agent packages/coding-agent; do
pkg_name=$(basename "$pkg")
# Skip private packages
if jq -e '.private == true' "$pkg/package.json" > /dev/null 2>&1; then
echo "Skipping $pkg_name (private)"
continue
fi
echo "Publishing $pkg_name..."
output=$(cd "$pkg" && bun publish --access public 2>&1) && echo "$output" && continue
echo "$output"
if echo "$output" | grep -q "previously published\|cannot publish over\|You cannot publish over"; then
echo "Already published, skipping"
else
echo "Failed to publish $pkg_name"
exit 1
fi
done
run: bun run ci:release:publish