From 6ee48fbee2331bc04423e0420130beb70ffa766c Mon Sep 17 00:00:00 2001 From: bradygaster Date: Sun, 15 Mar 2026 06:54:32 -0700 Subject: [PATCH 1/8] fix(ci): Remove prepare scripts to fix build race condition The prepare scripts in root and SDK package.json were causing a race condition in CI where the SDK build could be incomplete when the CLI tried to build. This resulted in TypeScript errors about missing roles exports. The prepare script runs during npm ci, which conflicts with npm workspaces' parallel installation. The explicit build step in the CI workflow (npm run build) is sufficient and builds in the correct order (SDK first, then CLI). This fix ensures: - SDK builds completely before CLI starts building - No circular dependency issues during npm ci - CI build order matches local build order Closes #XXX Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- package.json | 3 +-- packages/squad-sdk/package.json | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 6d21561ba..19c3da1f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bradygaster/squad", - "version": "0.8.25.2", + "version": "0.8.25-build.3", "private": true, "description": "Squad — Programmable multi-agent runtime for GitHub Copilot, built on @github/copilot-sdk", "type": "module", @@ -8,7 +8,6 @@ "packages/*" ], "scripts": { - "prepare": "npm run build", "prebuild": "node scripts/bump-build.mjs && node scripts/sync-skill-templates.mjs", "build": "npm run build -w packages/squad-sdk && npm run build -w packages/squad-cli", "sync-templates": "node scripts/sync-skill-templates.mjs", diff --git a/packages/squad-sdk/package.json b/packages/squad-sdk/package.json index c4ac69aac..cc1fddefa 100644 --- a/packages/squad-sdk/package.json +++ b/packages/squad-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@bradygaster/squad-sdk", - "version": "0.8.25.2", + "version": "0.8.25-build.3", "description": "Squad SDK — Programmable multi-agent runtime for GitHub Copilot", "type": "module", "main": "./dist/index.js", @@ -161,7 +161,6 @@ "README.md" ], "scripts": { - "prepare": "npm run build", "prepublishOnly": "npm run build", "build": "tsc -p tsconfig.json" }, From 36598410312fc4ca81170d7ee3043ced0a47091a Mon Sep 17 00:00:00 2001 From: bradygaster Date: Sun, 15 Mar 2026 07:00:31 -0700 Subject: [PATCH 2/8] fix(ci): Clean dist before install and use wildcard SDK dependency Root cause: npm workspaces on Windows copies dist/ folders during npm ci. If dist/ exists from a previous build but is incomplete, the workspace copy is stale and missing new modules like roles/. Changes: 1. Remove prepare scripts from root and SDK package.json to prevent premature builds during npm ci 2. Add 'Clean dist folders' step in CI workflow before npm ci to ensure fresh workspace copies 3. Use wildcard (*) for CLI's SDK dependency to ensure workspace resolution regardless of version bumps This ensures: - SDK builds from scratch with all modules - CLI sees the complete SDK dist including roles/ - No race conditions between install and build Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/squad-ci.yml | 3 +++ package-lock.json | 10 +++++----- package.json | 2 +- packages/squad-cli/package.json | 4 ++-- packages/squad-sdk/package.json | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/squad-ci.yml b/.github/workflows/squad-ci.yml index 67a7299d0..41224cdbb 100644 --- a/.github/workflows/squad-ci.yml +++ b/.github/workflows/squad-ci.yml @@ -20,6 +20,9 @@ jobs: with: node-version: 22 + - name: Clean dist folders + run: rm -rf packages/*/dist + - name: Install dependencies run: npm ci diff --git a/package-lock.json b/package-lock.json index ce8bcb274..beb077566 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@bradygaster/squad", - "version": "0.8.25", + "version": "0.8.25-build.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@bradygaster/squad", - "version": "0.8.25", + "version": "0.8.25-build.4", "license": "MIT", "workspaces": [ "packages/*" @@ -5271,11 +5271,11 @@ }, "packages/squad-cli": { "name": "@bradygaster/squad-cli", - "version": "0.8.25", + "version": "0.8.25-build.4", "hasInstallScript": true, "license": "MIT", "dependencies": { - "@bradygaster/squad-sdk": "0.8.25", + "@bradygaster/squad-sdk": "*", "ink": "^6.8.0", "react": "^19.2.4", "vscode-jsonrpc": "^8.2.1" @@ -5367,7 +5367,7 @@ }, "packages/squad-sdk": { "name": "@bradygaster/squad-sdk", - "version": "0.8.25", + "version": "0.8.25-build.4", "license": "MIT", "dependencies": { "@github/copilot-sdk": "^0.1.32", diff --git a/package.json b/package.json index 19c3da1f5..559553b07 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bradygaster/squad", - "version": "0.8.25-build.3", + "version": "0.8.25-build.4", "private": true, "description": "Squad — Programmable multi-agent runtime for GitHub Copilot, built on @github/copilot-sdk", "type": "module", diff --git a/packages/squad-cli/package.json b/packages/squad-cli/package.json index b67af45fd..f51cb05fe 100644 --- a/packages/squad-cli/package.json +++ b/packages/squad-cli/package.json @@ -1,6 +1,6 @@ { "name": "@bradygaster/squad-cli", - "version": "0.8.25.2", + "version": "0.8.25-build.4", "description": "Squad CLI — Command-line interface for the Squad multi-agent runtime", "type": "module", "bin": { @@ -157,7 +157,7 @@ "node": ">=20" }, "dependencies": { - "@bradygaster/squad-sdk": "0.8.25", + "@bradygaster/squad-sdk": "*", "ink": "^6.8.0", "react": "^19.2.4", "vscode-jsonrpc": "^8.2.1" diff --git a/packages/squad-sdk/package.json b/packages/squad-sdk/package.json index cc1fddefa..f36c63776 100644 --- a/packages/squad-sdk/package.json +++ b/packages/squad-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@bradygaster/squad-sdk", - "version": "0.8.25-build.3", + "version": "0.8.25-build.4", "description": "Squad SDK — Programmable multi-agent runtime for GitHub Copilot", "type": "module", "main": "./dist/index.js", From 582416d6aba3ea912e6a90e99bcb4059ed8efc5d Mon Sep 17 00:00:00 2001 From: bradygaster Date: Sun, 15 Mar 2026 07:01:55 -0700 Subject: [PATCH 3/8] debug: Add diagnostic output for SDK dist and workspace link --- .github/workflows/squad-ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/squad-ci.yml b/.github/workflows/squad-ci.yml index 41224cdbb..039a58516 100644 --- a/.github/workflows/squad-ci.yml +++ b/.github/workflows/squad-ci.yml @@ -36,5 +36,14 @@ jobs: - name: Build run: npm run build + - name: Debug - List SDK dist contents + run: ls -la packages/squad-sdk/dist/ + + - name: Debug - Check roles exists + run: test -d packages/squad-sdk/dist/roles && echo "roles dir exists" || echo "roles dir MISSING" + + - name: Debug - List CLI node_modules SDK + run: ls -la packages/squad-cli/node_modules/@bradygaster/squad-sdk/dist/ || echo "SDK not found in CLI node_modules" + - name: Run tests run: npm test From 701f6bcd091ad8588557fbcf26bcebe54d9e415d Mon Sep 17 00:00:00 2001 From: bradygaster Date: Sun, 15 Mar 2026 07:03:09 -0700 Subject: [PATCH 4/8] debug: Continue on build error to see diagnostics --- .github/workflows/squad-ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/squad-ci.yml b/.github/workflows/squad-ci.yml index 039a58516..f6c697789 100644 --- a/.github/workflows/squad-ci.yml +++ b/.github/workflows/squad-ci.yml @@ -34,10 +34,12 @@ jobs: run: npx playwright install chromium --with-deps - name: Build + id: build + continue-on-error: true run: npm run build - name: Debug - List SDK dist contents - run: ls -la packages/squad-sdk/dist/ + run: ls -la packages/squad-sdk/dist/ || echo "SDK dist not found" - name: Debug - Check roles exists run: test -d packages/squad-sdk/dist/roles && echo "roles dir exists" || echo "roles dir MISSING" @@ -45,5 +47,9 @@ jobs: - name: Debug - List CLI node_modules SDK run: ls -la packages/squad-cli/node_modules/@bradygaster/squad-sdk/dist/ || echo "SDK not found in CLI node_modules" + - name: Fail if build failed + if: steps.build.outcome == 'failure' + run: exit 1 + - name: Run tests run: npm test From 6499a09a9a3e46c1810a4eb56da52b50b39f4872 Mon Sep 17 00:00:00 2001 From: bradygaster Date: Sun, 15 Mar 2026 07:05:03 -0700 Subject: [PATCH 5/8] fix(ci): Build SDK before installing CLI dependencies The issue was that npm ci creates workspace links before building, so the CLI's node_modules SDK link pointed to an empty dist folder. New build sequence: 1. Clean dist folders 2. Install SDK dependencies only 3. Build SDK (creates dist with roles/) 4. Install CLI dependencies (creates workspace link to built SDK) 5. Build CLI (now sees complete SDK including roles/) This ensures the CLI always sees a fully-built SDK dist. --- .github/workflows/squad-ci.yml | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/.github/workflows/squad-ci.yml b/.github/workflows/squad-ci.yml index f6c697789..fb44c6a5a 100644 --- a/.github/workflows/squad-ci.yml +++ b/.github/workflows/squad-ci.yml @@ -23,8 +23,14 @@ jobs: - name: Clean dist folders run: rm -rf packages/*/dist - - name: Install dependencies - run: npm ci + - name: Install root and SDK dependencies + run: npm ci --workspace=packages/squad-sdk + + - name: Build SDK + run: npm run build --workspace=packages/squad-sdk + + - name: Install CLI dependencies + run: npm ci --workspace=packages/squad-cli - name: Install docs dependencies run: npm ci @@ -33,23 +39,8 @@ jobs: - name: Install Playwright browsers run: npx playwright install chromium --with-deps - - name: Build - id: build - continue-on-error: true - run: npm run build - - - name: Debug - List SDK dist contents - run: ls -la packages/squad-sdk/dist/ || echo "SDK dist not found" - - - name: Debug - Check roles exists - run: test -d packages/squad-sdk/dist/roles && echo "roles dir exists" || echo "roles dir MISSING" - - - name: Debug - List CLI node_modules SDK - run: ls -la packages/squad-cli/node_modules/@bradygaster/squad-sdk/dist/ || echo "SDK not found in CLI node_modules" - - - name: Fail if build failed - if: steps.build.outcome == 'failure' - run: exit 1 + - name: Build CLI + run: npm run build --workspace=packages/squad-cli - name: Run tests run: npm test From 4d73fb7fb64a69ac7c84c50fa82a95e3884f64d4 Mon Sep 17 00:00:00 2001 From: bradygaster Date: Sun, 15 Mar 2026 07:06:34 -0700 Subject: [PATCH 6/8] debug: Check CLI node_modules after install --- .github/workflows/squad-ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/squad-ci.yml b/.github/workflows/squad-ci.yml index fb44c6a5a..52a71f4ba 100644 --- a/.github/workflows/squad-ci.yml +++ b/.github/workflows/squad-ci.yml @@ -32,6 +32,15 @@ jobs: - name: Install CLI dependencies run: npm ci --workspace=packages/squad-cli + - name: Debug - Check CLI node_modules SDK after install + run: | + echo "=== CLI node_modules SDK dist contents ===" + ls -la packages/squad-cli/node_modules/@bradygaster/squad-sdk/dist/ + echo "=== Check for roles dir ===" + test -d packages/squad-cli/node_modules/@bradygaster/squad-sdk/dist/roles && echo "✓ roles exists" || echo "✗ roles MISSING" + echo "=== Link target (if symlink) ===" + readlink packages/squad-cli/node_modules/@bradygaster/squad-sdk || echo "Not a symlink" + - name: Install docs dependencies run: npm ci working-directory: docs From 3e0164d94ca2755e71260f7ecd7550187ed823b6 Mon Sep 17 00:00:00 2001 From: bradygaster Date: Sun, 15 Mar 2026 07:11:19 -0700 Subject: [PATCH 7/8] fix: Force workspace link refresh after SDK build After building SDK, remove CLI's node_modules SDK copy and reinstall to ensure the workspace link/copy includes the freshly built dist with all modules including roles/. --- .github/workflows/squad-ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/squad-ci.yml b/.github/workflows/squad-ci.yml index 52a71f4ba..5f9c9c19a 100644 --- a/.github/workflows/squad-ci.yml +++ b/.github/workflows/squad-ci.yml @@ -29,8 +29,10 @@ jobs: - name: Build SDK run: npm run build --workspace=packages/squad-sdk - - name: Install CLI dependencies - run: npm ci --workspace=packages/squad-cli + - name: Force workspace link refresh + run: | + rm -rf packages/squad-cli/node_modules/@bradygaster/squad-sdk + npm ci --workspace=packages/squad-cli - name: Debug - Check CLI node_modules SDK after install run: | From 837acc549c8e3136590c848f40d7c50d531933c0 Mon Sep 17 00:00:00 2001 From: bradygaster Date: Sun, 15 Mar 2026 07:13:13 -0700 Subject: [PATCH 8/8] fix(ci): remove stale nested SDK from lockfile The package-lock.json had a nested entry at packages/squad-cli/node_modules/@bradygaster/squad-sdk that resolved to the npm registry (v0.8.25) instead of using the workspace symlink. This stale copy predated the roles module addition, causing all CI builds to fail with 'Module has no exported member listRoles' since the roles feature was merged. Removing the nested entry lets npm ci properly resolve the SDK through the root workspace link (node_modules/@bradygaster/squad-sdk -> packages/squad-sdk), which includes the roles module. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/squad-ci.yml | 28 ++------------ package-lock.json | 70 ---------------------------------- 2 files changed, 4 insertions(+), 94 deletions(-) diff --git a/.github/workflows/squad-ci.yml b/.github/workflows/squad-ci.yml index 5f9c9c19a..67a7299d0 100644 --- a/.github/workflows/squad-ci.yml +++ b/.github/workflows/squad-ci.yml @@ -20,28 +20,8 @@ jobs: with: node-version: 22 - - name: Clean dist folders - run: rm -rf packages/*/dist - - - name: Install root and SDK dependencies - run: npm ci --workspace=packages/squad-sdk - - - name: Build SDK - run: npm run build --workspace=packages/squad-sdk - - - name: Force workspace link refresh - run: | - rm -rf packages/squad-cli/node_modules/@bradygaster/squad-sdk - npm ci --workspace=packages/squad-cli - - - name: Debug - Check CLI node_modules SDK after install - run: | - echo "=== CLI node_modules SDK dist contents ===" - ls -la packages/squad-cli/node_modules/@bradygaster/squad-sdk/dist/ - echo "=== Check for roles dir ===" - test -d packages/squad-cli/node_modules/@bradygaster/squad-sdk/dist/roles && echo "✓ roles exists" || echo "✗ roles MISSING" - echo "=== Link target (if symlink) ===" - readlink packages/squad-cli/node_modules/@bradygaster/squad-sdk || echo "Not a symlink" + - name: Install dependencies + run: npm ci - name: Install docs dependencies run: npm ci @@ -50,8 +30,8 @@ jobs: - name: Install Playwright browsers run: npx playwright install chromium --with-deps - - name: Build CLI - run: npm run build --workspace=packages/squad-cli + - name: Build + run: npm run build - name: Run tests run: npm test diff --git a/package-lock.json b/package-lock.json index beb077566..54acba38c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5295,76 +5295,6 @@ "node": ">=20" } }, - "packages/squad-cli/node_modules/@bradygaster/squad-sdk": { - "version": "0.8.25", - "resolved": "https://registry.npmjs.org/@bradygaster/squad-sdk/-/squad-sdk-0.8.25.tgz", - "integrity": "sha512-9gQ1vatbG+uQCTxx3mVDPRNop6LWVRpE42i+nenzB+LhHOMaANYiANN/kDG8MmPFHIdXCsmnZKdeGblr6DPwvA==", - "license": "MIT", - "dependencies": { - "@github/copilot-sdk": "^0.1.32", - "vscode-jsonrpc": "^8.2.1" - }, - "engines": { - "node": ">=20" - }, - "optionalDependencies": { - "@opentelemetry/api": "^1.9.0", - "@opentelemetry/exporter-metrics-otlp-grpc": "^0.57.2", - "@opentelemetry/exporter-trace-otlp-grpc": "^0.57.2", - "@opentelemetry/resources": "^1.30.0", - "@opentelemetry/sdk-metrics": "^1.30.0", - "@opentelemetry/sdk-node": "^0.57.2", - "@opentelemetry/sdk-trace-base": "^1.30.0", - "@opentelemetry/sdk-trace-node": "^1.30.0", - "@opentelemetry/semantic-conventions": "^1.28.0", - "ws": "^8.18.0" - } - }, - "packages/squad-cli/node_modules/@opentelemetry/sdk-metrics": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-1.30.1.tgz", - "integrity": "sha512-q9zcZ0Okl8jRgmy7eNW3Ku1XSgg3sDLa5evHZpCwjspw7E8Is4K/haRPDJrBcX3YSn/Y7gUvFnByNYEKQNbNog==", - "license": "Apache-2.0", - "optional": true, - "dependencies": { - "@opentelemetry/core": "1.30.1", - "@opentelemetry/resources": "1.30.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.3.0 <1.10.0" - } - }, - "packages/squad-cli/node_modules/@opentelemetry/sdk-trace-base": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.30.1.tgz", - "integrity": "sha512-jVPgBbH1gCy2Lb7X0AVQ8XAfgg0pJ4nvl8/IiQA6nxOsPvS+0zMJaFSs2ltXe0J6C8dqjcnpyqINDJmU30+uOg==", - "license": "Apache-2.0", - "optional": true, - "dependencies": { - "@opentelemetry/core": "1.30.1", - "@opentelemetry/resources": "1.30.1", - "@opentelemetry/semantic-conventions": "1.28.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.10.0" - } - }, - "packages/squad-cli/node_modules/@opentelemetry/semantic-conventions": { - "version": "1.28.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.28.0.tgz", - "integrity": "sha512-lp4qAiMTD4sNWW4DbKLBkfiMZ4jbAboJIGOQr5DvciMRI494OapieI9qiODpOt0XBr1LjIDy1xAGAnVs5supTA==", - "license": "Apache-2.0", - "optional": true, - "engines": { - "node": ">=14" - } - }, "packages/squad-sdk": { "name": "@bradygaster/squad-sdk", "version": "0.8.25-build.4",