refactor: migrate from Turborepo to Nx for task management (#3207)

This commit is contained in:
Alem Tuzlak
2026-02-13 16:53:35 +01:00
committed by GitHub
parent 7b838547a9
commit 7cd968d6a6
40 changed files with 819 additions and 261 deletions
+4 -8
View File
@@ -16,9 +16,9 @@ on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to run the workflow on'
description: "Branch to run the workflow on"
required: true
default: 'main'
default: "main"
type: string
jobs:
@@ -178,12 +178,8 @@ jobs:
working-directory: CopilotKit
env:
NODE_OPTIONS: --max-old-space-size=8192
TURBO_CONCURRENCY: 2
run: |
unset TURBO_API
unset TURBO_TOKEN
unset TURBO_TEAM
pnpm build:packages
NX_PARALLEL: 2
run: pnpm build
- name: Install ag-ui dependencies
working-directory: ag-ui
+3 -3
View File
@@ -14,9 +14,9 @@ on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to run the workflow on'
description: "Branch to run the workflow on"
required: true
default: 'main'
default: "main"
type: string
jobs:
@@ -70,7 +70,7 @@ jobs:
- name: Build CopilotKit
id: build-cpk
run: pnpm build:packages
run: pnpm build
- name: Install e2e dependencies
working-directory: examples/e2e
+1 -1
View File
@@ -24,6 +24,6 @@ jobs:
run: pnpm install
- name: Build
run: pnpm run build:packages
run: pnpm run build
- run: npx pkg-pr-new publish "./packages/v1/*" "./packages/v2/*"
+1 -2
View File
@@ -21,7 +21,6 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Setup Node
uses: actions/setup-node@v4
with:
@@ -34,7 +33,7 @@ jobs:
run: pnpm i
- name: Build
run: pnpm run build:packages
run: pnpm run build
- name: Publish snapshot
run: ./scripts/release/publish-snapshot-release.sh
+1 -1
View File
@@ -61,7 +61,7 @@ jobs:
- name: Build
id: build
run: pnpm run build:packages
run: pnpm run build
- name: NPM Publish
id: publish
+1 -1
View File
@@ -46,7 +46,7 @@ jobs:
run: pnpm install --frozen-lockfile
- name: Run Prettier check
run: npx turbo run check-prettier
run: pnpm run check-prettier
eslint:
runs-on: ubuntu-latest
+4 -1
View File
@@ -55,7 +55,10 @@ jobs:
run: pnpm install --frozen-lockfile
- name: Generate GraphQL codegen files
run: pnpm turbo run graphql-codegen --filter=@copilotkit/runtime-client-gql
run: npx nx run @copilotkit/runtime-client-gql:graphql-codegen
- name: Build
run: pnpm run build
- name: Run tests
run: npm run test:classic
+4 -1
View File
@@ -49,5 +49,8 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm run build
- name: Run tests
run: pnpm test:next
run: pnpm run test:next
+6 -3
View File
@@ -11,7 +11,7 @@ node_modules
.pnpm-store
.idea/
cdk_outputs.json
.turbo
.nx
test-run-comment.md
*.egg-info/
@@ -34,7 +34,10 @@ docs/next-env.d.ts
# External repos (cloned for development)
ext-apps/
dist
.turbo
.nx
.angular
build
debug-storybook.log
debug-storybook.log
storybook-static
coverage
.turbo
+12
View File
@@ -0,0 +1,12 @@
{
"mcpServers": {
"nx-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"nx",
"mcp"
]
}
}
}
+14
View File
@@ -0,0 +1,14 @@
<!-- nx configuration start-->
<!-- Leave the start & end comments to automatically receive updates. -->
# General Guidelines for working with Nx
- When running tasks (for example build, lint, test, e2e, etc.), always prefer running the task through `nx` (i.e. `nx run`, `nx run-many`, `nx affected`) instead of using the underlying tooling directly
- You have access to the Nx MCP server and its tools, use them to help the user
- When answering questions about the repository, use the `nx_workspace` tool first to gain an understanding of the workspace architecture where applicable.
- When working in individual projects, use the `nx_project_details` mcp tool to analyze and understand the specific project structure and dependencies
- For questions around nx configuration, best practices or if you're unsure, use the `nx_docs` tool to get relevant, up-to-date docs. Always use this instead of assuming things about nx configuration
- If the user needs help with an Nx configuration or project graph error, use the `nx_workspace` tool to get any errors
- For Nx plugin best practices, check `node_modules/@nx/<plugin>/PLUGIN.md`. Not all plugins have this file - proceed without it if unavailable.
<!-- nx configuration end-->
+14
View File
@@ -0,0 +1,14 @@
<!-- nx configuration start-->
<!-- Leave the start & end comments to automatically receive updates. -->
# General Guidelines for working with Nx
- When running tasks (for example build, lint, test, e2e, etc.), always prefer running the task through `nx` (i.e. `nx run`, `nx run-many`, `nx affected`) instead of using the underlying tooling directly
- You have access to the Nx MCP server and its tools, use them to help the user
- When answering questions about the repository, use the `nx_workspace` tool first to gain an understanding of the workspace architecture where applicable.
- When working in individual projects, use the `nx_project_details` mcp tool to analyze and understand the specific project structure and dependencies
- For questions around nx configuration, best practices or if you're unsure, use the `nx_docs` tool to get relevant, up-to-date docs. Always use this instead of assuming things about nx configuration
- If the user needs help with an Nx configuration or project graph error, use the `nx_workspace` tool to get any errors
- For Nx plugin best practices, check `node_modules/@nx/<plugin>/PLUGIN.md`. Not all plugins have this file - proceed without it if unavailable.
<!-- nx configuration end-->
+3 -4
View File
@@ -57,7 +57,6 @@ git clone https://github.com/<your-GitHub-username>/CopilotKit
- Node.js 20.x or later
- pnpm v9.x installed globally (npm i -g pnpm@^9)
- Turborepo v2.x installed globally (npm i -g turbo@2)
### 2)Install Dependencies
@@ -74,7 +73,7 @@ To make sure everything works, lets build all packages once:
```jsx
cd CopilotKit
turbo run build
pnpm build
```
## Step 4: Create a branch
@@ -98,10 +97,10 @@ Now that everything is set up and works as expected, you can get started develop
```jsx
# To start all packages in development mode
turbo run dev
pnpm dev
# Start a specific package in development mode
turbo run dev --filter="@copilotkit/package-name"
nx run @copilotkit/package-name:dev
```
## Step 6: Add the changes that are ready to be committed
+2 -2
View File
@@ -1,5 +1,5 @@
{
"buildCommand": "cd ../../../../ && pnpm turbo run storybook:build --filter=storybook",
"buildCommand": "cd ../../../../ && npx nx run @copilotkit-storybook/react:storybook:build",
"installCommand": "cd ../../../../ && pnpm install",
"outputDirectory": "storybook-static"
}
}
+113
View File
@@ -0,0 +1,113 @@
{
"$schema": "https://nx.dev/reference/nx-json",
"namedInputs": {
"default": [
"{projectRoot}/**/*",
"!{projectRoot}/node_modules/**/*"
],
"production": [
"default",
"!{projectRoot}/**/*.test.*",
"!{projectRoot}/**/*.spec.*",
"!{projectRoot}/**/__tests__/**"
],
"test": [
"{projectRoot}/src/**/*.ts",
"{projectRoot}/src/**/*.tsx",
"{projectRoot}/**/__tests__/**",
"{projectRoot}/**/*.test.*",
"{projectRoot}/**/*.spec.*"
]
},
"targetDefaults": {
"build": {
"dependsOn": [
"^build"
],
"inputs": [
"production",
"{projectRoot}/.env*"
],
"outputs": [
"{projectRoot}/dist/**"
],
"cache": true
},
"dev": {
"dependsOn": [
"^build"
],
"cache": false
},
"test": {
"inputs": [
"test"
],
"outputs": [
"{projectRoot}/coverage/**"
],
"cache": true
},
"test:watch": {
"cache": false
},
"test:coverage": {
"inputs": [
"test"
],
"outputs": [
"{projectRoot}/coverage/**"
],
"cache": true
},
"lint": {
"dependsOn": [
"^lint"
],
"cache": true
},
"check-types": {
"dependsOn": [
"^build",
"^check-types"
],
"cache": true
},
"generate-graphql-schema": {
"dependsOn": [
"^build"
],
"cache": true
},
"graphql-codegen": {
"dependsOn": [
"^build"
],
"cache": true
},
"link:global": {
"cache": false
},
"unlink:global": {
"cache": false
},
"build:css": {
"cache": true,
"outputs": [
"{projectRoot}/dist/styles.css",
"{projectRoot}/src/styles/generated.css"
]
},
"storybook:build": {
"dependsOn": [
"^build"
],
"outputs": [
"{projectRoot}/storybook-static/**"
],
"cache": true
}
},
"parallel": 14,
"defaultBase": "main"
}
+30 -38
View File
@@ -2,53 +2,44 @@
"name": "CopilotKit",
"private": true,
"scripts": {
"build": "turbo run build --filter=!@copilotkit-examples/* --filter=!@copilotkit-storybook/*",
"build:classic": "turbo run build --filter=@copilotkit/*",
"build:next": "turbo run build --filter=@copilotkitnext/*",
"build:storybook": "turbo run build --filter=storybook-react --filter=storybook-angular",
"build:packages": "turbo run build --filter=@copilotkit/* --filter=@copilotkitnext/* --filter=!@copilotkit-examples/* --filter=!@copilotkit-storybook/*",
"build:examples": "turbo run build --filter=@copilotkit-examples/*",
"check-types": "turbo run check-types",
"check-types:classic": "turbo run check-types --filter=@copilotkit/*",
"check-types:next": "turbo run check-types --filter=@copilotkitnext/*",
"clean": "turbo clean",
"clean:classic": "turbo run clean --filter=@copilotkit/*",
"clean:next": "turbo run clean --filter=@copilotkitnext/*",
"lint": "turbo lint --filter=!@copilotkit-examples/* --filter=!@copilotkit-storybook/* --filter=!demo --filter=!next-openai --filter=!next-pages-router --filter=!node-express --filter=!node-http --filter=!@copilotkitnext/next-pages-router --filter=!@copilotkitnext/node-express",
"lint:classic": "turbo run lint --filter=@copilotkit/*",
"lint:next": "turbo run lint --filter=@copilotkitnext/*",
"build": "nx run-many -t build --projects=packages/**",
"build:examples": "nx run-many -t build --projects=examples/**",
"build:storybook": "nx run-many -t build --projects=examples/v2/*/storybook",
"check-types": "nx run-many -t check-types",
"clean": "git clean -fdX --exclude=\"!.env\"",
"lint": "nx run-many -t lint --projects=packages/**",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"format:classic": "prettier --write \"packages/v1/**/*.{ts,tsx,md}\" \"examples/v1/**/*.{ts,tsx,md}\"",
"format:next": "prettier --write \"packages/v2/**/*.{ts,tsx,md}\" \"examples/v2/**/*.{ts,tsx,md}\"",
"check-prettier": "prettier --check \"**/*.{ts,tsx,md}\"",
"check-prettier:classic": "prettier --check \"packages/v1/**/*.{ts,tsx,md}\" \"examples/v1/**/*.{ts,tsx,md}\"",
"check-prettier:next": "prettier --check \"packages/v2/**/*.{ts,tsx,md}\" \"examples/v2/**/*.{ts,tsx,md}\"",
"test": "turbo test",
"test:classic": "turbo run test --filter=@copilotkit/* --filter=!@copilotkit/voice",
"test:next": "turbo run test --filter=@copilotkitnext/*",
"test:watch:classic": "turbo run test:watch --filter=@copilotkit/* --filter=!@copilotkit/voice",
"test:watch:next": "turbo run test:watch --filter=@copilotkitnext/*",
"test:coverage:classic": "turbo run test:coverage --filter=@copilotkit/* --filter=!@copilotkit/voice",
"test:coverage:next": "turbo run test:coverage --filter=@copilotkitnext/*",
"dev": "turbo run dev --concurrency 30",
"dev:classic": "turbo run dev --filter=@copilotkit/*",
"dev:next": "turbo run dev --concurrency 14 --filter=@copilotkitnext/* --filter=@copilotkit/voice",
"predev:next": "turbo run build --filter='@copilotkitnext/core' --filter='@copilotkitnext/shared' --filter='@copilotkitnext/web-inspector' --filter='@copilotkitnext/react' --filter='@copilotkitnext/angular' --filter='@copilotkitnext/agent' --filter='@copilotkitnext/sqlite-runner' --filter='@copilotkit/voice'",
"storybook:all": "echo 'Run storybooks in separate terminals: pnpm storybook:react | pnpm storybook:angular'",
"test": "nx run-many -t test",
"test:classic": "nx run-many -t test --projects=packages/v1/**,@copilotkit/voice",
"test:next": "nx run-many -t test --projects=packages/v2/**",
"test:watch": "pnpm run test && nx watch --all -- pnpm run test",
"test:watch:classic": "nx run-many -t test --projects=packages/v1/**,@copilotkit/voice && nx watch --projects=packages/v1/**,@copilotkit/voice -- nx run-many -t test --projects=packages/v1/**,@copilotkit/voice",
"test:watch:next": "nx run-many -t test --projects=packages/v2/** && nx watch --projects=packages/v2/** -- nx run-many -t test --projects=packages/v2/**",
"test:coverage": "nx run-many -t test:coverage",
"test:coverage:classic": "nx run-many -t test:coverage --projects=packages/v1/*,@copilotkit/voice",
"test:coverage:next": "nx run-many -t test:coverage --projects=packages/v2/*",
"dev": "pnpm run build && nx watch --projects=packages/** -- pnpm run build",
"dev:classic": "nx run-many -t build --projects=packages/v1/** && nx watch --projects=packages/v1/** -- nx run-many -t build --projects=packages/v1/**",
"dev:next": "nx run-many -t build --projects=packages/v2/** && nx watch --projects=packages/v2/** -- nx run-many -t build --projects=packages/v2/**",
"dev:examples": "pnpm run build:examples && nx watch --projects=examples/** -- pnpm run build:examples",
"dev:examples:classic": "nx run-many -t build --projects=examples/v1/** && nx watch --projects=examples/v1/** -- nx run-many -t build --projects=examples/v1/**",
"dev:examples:next": "nx run-many -t build --projects=examples/v2/** && nx watch --projects=examples/v2/** -- nx run-many -t build --projects=examples/v2/**",
"storybook:angular": "pnpm -C examples/v2/angular/storybook dev",
"storybook:react": "pnpm -C examples/v2/react/storybook dev",
"storybook": "pnpm storybook:react",
"docs:next": "pnpm -C examples/v2/docs dev",
"docs:classic": "ts-node scripts/docs/gen.ts",
"demo:next:angular": "turbo run dev --filter='@copilotkitnext/angular-demo-server' --filter='@copilotkitnext/angular-demo'",
"demo:next:angular": "nx run-many -t dev --projects=examples/v2/angular/demo,examples/v2/angular/demo-server",
"demo:next:react": "pnpm -C examples/v2/react/demo dev",
"dev:next:packages": "turbo run dev --filter='@copilotkitnext/core' --filter='@copilotkitnext/shared' --filter='@copilotkitnext/web-inspector' --filter='@copilotkitnext/runtime' --filter='@copilotkitnext/sqlite-runner' --filter='@copilotkitnext/react' --filter='@copilotkitnext/angular' --filter='@copilotkitnext/agent'",
"prepare": "husky"
"changeset": "changeset",
"prepare": "husky",
"graph": "nx graph"
},
"v2Leftovers": {
"bump:prerelease": "pnpm -r --filter='@copilotkitnext/agent' --filter='@copilotkitnext/angular' --filter='@copilotkitnext/core' --filter='@copilotkitnext/react' --filter='@copilotkitnext/runtime' --filter='@copilotkitnext/sqlite-runner' --filter='@copilotkitnext/shared' --filter='@copilotkitnext/web-inspector' exec pnpm version prerelease --preid=alpha",
"bump:release": "pnpm -r --filter='@copilotkitnext/agent' --filter='@copilotkitnext/angular' --filter='@copilotkitnext/core' --filter='@copilotkitnext/react' --filter='@copilotkitnext/runtime' --filter='@copilotkitnext/sqlite-runner' --filter='@copilotkitnext/shared' --filter='@copilotkitnext/web-inspector' exec pnpm version patch",
"publish:prerelease": "pnpm -r clean && pnpm install && turbo build && pnpm publish -r --no-git-checks --filter='@copilotkitnext/agent' --filter='@copilotkitnext/angular' --filter='@copilotkitnext/core' --filter='@copilotkitnext/react' --filter='@copilotkitnext/runtime' --filter='@copilotkitnext/sqlite-runner' --filter='@copilotkitnext/shared' --filter='@copilotkitnext/web-inspector' --tag alpha",
"publish:prerelease": "pnpm -r clean && pnpm install && nx run-many -t build && pnpm publish -r --no-git-checks --filter='@copilotkitnext/agent' --filter='@copilotkitnext/angular' --filter='@copilotkitnext/core' --filter='@copilotkitnext/react' --filter='@copilotkitnext/runtime' --filter='@copilotkitnext/sqlite-runner' --filter='@copilotkitnext/shared' --filter='@copilotkitnext/web-inspector' --tag alpha",
"publish:release:dry": "pnpm -r --filter '@copilotkitnext/*' publish --access public --dry-run",
"publish:release": "pnpm -r --filter '@copilotkitnext/*' publish --access public",
"server:node": "pnpm -C src/apps/node dev"
@@ -56,12 +47,13 @@
"v1Leftovers": {
"freshbuild": "pnpm -w clean && pnpm i && pnpm -w build",
"precommit": "pnpm run docs",
"prepublish": "turbo run build"
"prepublish": "nx run-many -t build"
},
"devDependencies": {
"@changesets/cli": "^2.29.8",
"@commitlint/cli": "^20.3.0",
"@commitlint/config-conventional": "^20.3.0",
"@vitest/coverage-v8": "^3.2.4",
"@rollup/plugin-commonjs": "^29.0.0",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^16.0.3",
@@ -79,13 +71,13 @@
"husky": "^9.1.4",
"install": "^0.13.0",
"npm": "^10.7.0",
"nx": "^22.5.0",
"prettier": "^3.6.0",
"prettier-plugin-tailwindcss": "^0.1.11",
"rollup": "^4.55.3",
"rollup-plugin-postcss": "^4.0.2",
"storybook": "^10.1.10",
"ts-node": "^10.9.2",
"turbo": "^2.5.4",
"typescript": "^5.2.3"
},
"packageManager": "pnpm@10.13.1",
@@ -126,4 +118,4 @@
"@changesets/assemble-release-plan@6.0.9": "patches/@changesets__assemble-release-plan@6.0.9.patch"
}
}
}
}
+1
View File
@@ -10,6 +10,7 @@ module.exports = {
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/src/$1",
"\\.(css|less|scss|sass)$": "identity-obj-proxy",
"^@segment/analytics-node$": "<rootDir>/src/__mocks__/analytics-node.js",
},
transformIgnorePatterns: [
"node_modules/(?!(react-markdown|streamdown|@copilotkitnext)/)",
-1
View File
@@ -37,7 +37,6 @@
"dev": "tsup --watch",
"test": "jest",
"check-types": "tsc --noEmit",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .next",
"link:global": "pnpm link --global",
"unlink:global": "pnpm unlink --global"
},
@@ -0,0 +1,9 @@
module.exports = {
Analytics: jest.fn().mockImplementation(() => ({
track: jest.fn(),
identify: jest.fn(),
page: jest.fn(),
group: jest.fn(),
alias: jest.fn(),
})),
};
-1
View File
@@ -32,7 +32,6 @@
"dev": "tsup --watch --no-splitting",
"test": "jest",
"check-types": "tsc --noEmit",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .next",
"link:global": "pnpm link --global",
"unlink:global": "pnpm unlink --global"
},
-1
View File
@@ -33,7 +33,6 @@
"dev": "tsup --watch --no-splitting",
"test": "jest",
"check-types": "tsc --noEmit",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .next",
"link:global": "pnpm link --global",
"unlink:global": "pnpm unlink --global"
},
@@ -30,7 +30,6 @@
"test": "vitest run",
"test:watch": "vitest",
"check-types": "tsc --noEmit",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf ./src/graphql/@generated && rm -rf dist && rm -rf .next",
"graphql-codegen": "graphql-codegen -c codegen.ts",
"graphql-codegen:watch": "graphql-codegen -c codegen.ts --watch",
"link:global": "pnpm link --global",
-1
View File
@@ -37,7 +37,6 @@
"dev": "tsup --watch --onSuccess \"pnpm run generate-graphql-schema\"",
"test": "jest --passWithNoTests",
"check-types": "tsc --noEmit",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .next && rm -rf __snapshots__",
"generate-graphql-schema": "rm -rf __snapshots__ && ts-node ./scripts/generate-gql-schema.ts",
"link:global": "pnpm link --global",
"unlink:global": "pnpm unlink --global"
-1
View File
@@ -37,7 +37,6 @@
"dev": "tsup --watch --no-splitting",
"test": "jest --passWithNoTests",
"check-types": "tsc --noEmit",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .next",
"link:global": "pnpm link --global",
"unlink:global": "pnpm unlink --global"
},
-1
View File
@@ -29,7 +29,6 @@
"dev": "tsup --watch --no-splitting",
"test": "jest --passWithNoTests",
"check-types": "tsc --noEmit",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .next",
"link:global": "pnpm link --global",
"unlink:global": "pnpm unlink --global"
},
-1
View File
@@ -19,7 +19,6 @@
"dev": "tsup --watch",
"lint": "eslint .",
"check-types": "tsc --noEmit",
"clean": "rm -rf dist",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage"
-1
View File
@@ -23,7 +23,6 @@
"build:css": "npx @tailwindcss/cli -i ./src/styles/globals.css -o ./dist/styles.css",
"dev": "concurrently \"ng-packagr -p ng-package.json --watch\" \"npm run dev:css\"",
"dev:css": "npx @tailwindcss/cli -i ./src/styles/globals.css -o ./dist/styles.css --watch",
"clean": "rimraf dist",
"lint": "eslint .",
"check-types": "tsc --noEmit",
"test": "vitest run",
-1
View File
@@ -21,7 +21,6 @@
"dev": "tsup --watch",
"lint": "eslint .",
"check-types": "tsc --noEmit",
"clean": "rm -rf dist",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage"
+1 -2
View File
@@ -28,8 +28,7 @@
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
"test:ui": "vitest --ui",
"clean": "rm -rf dist"
"test:ui": "vitest --ui"
},
"devDependencies": {
"@copilotkitnext/eslint-config": "workspace:*",
-1
View File
@@ -24,7 +24,6 @@
"dev": "tsup --watch",
"lint": "eslint .",
"check-types": "tsc --noEmit",
"clean": "rm -rf dist",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage"
+1 -2
View File
@@ -20,8 +20,7 @@
"build": "tsup && rollup -c rollup.config.mjs",
"dev": "tsup --watch",
"lint": "eslint .",
"check-types": "tsc --noEmit",
"clean": "rm -rf dist"
"check-types": "tsc --noEmit"
},
"devDependencies": {
"@copilotkitnext/eslint-config": "workspace:*",
-1
View File
@@ -19,7 +19,6 @@
"dev": "tsup --watch",
"lint": "eslint .",
"check-types": "tsc --noEmit",
"clean": "rm -rf dist",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage"
@@ -178,6 +178,8 @@ describe("SqliteAgentRunner", () => {
});
afterEach(() => {
runner.close();
if (fs.existsSync(dbPath)) fs.unlinkSync(dbPath);
if (fs.existsSync(tempDir)) fs.rmdirSync(tempDir);
});
@@ -268,7 +270,9 @@ describe("SqliteAgentRunner", () => {
.prepare(
"SELECT events FROM agent_runs WHERE thread_id = ? ORDER BY created_at",
)
.all(threadId) as { events: string }[];
.all(threadId) as {
events: string;
}[];
db.close();
expect(rows).toHaveLength(2);
@@ -370,17 +374,21 @@ describe("SqliteAgentRunner", () => {
);
const newRunner = new SqliteAgentRunner({ dbPath });
const replayed = await firstValueFrom(
newRunner.connect({ threadId }).pipe(toArray()),
);
try {
const replayed = await firstValueFrom(
newRunner.connect({ threadId }).pipe(toArray()),
);
expect(replayed[0].type).toBe(EventType.RUN_STARTED);
expect(replayed.slice(1).map((event) => event.type)).toEqual([
EventType.TEXT_MESSAGE_START,
EventType.TEXT_MESSAGE_CONTENT,
EventType.TEXT_MESSAGE_END,
EventType.RUN_FINISHED,
]);
expect(replayed[0].type).toBe(EventType.RUN_STARTED);
expect(replayed.slice(1).map((event) => event.type)).toEqual([
EventType.TEXT_MESSAGE_START,
EventType.TEXT_MESSAGE_CONTENT,
EventType.TEXT_MESSAGE_END,
EventType.RUN_FINISHED,
]);
} finally {
newRunner.close();
}
});
it("returns false when stopping a thread that is not running", async () => {
-1
View File
@@ -22,7 +22,6 @@
"dev": "tsup --watch",
"lint": "eslint . --max-warnings 0",
"check-types": "tsc --noEmit",
"clean": "rm -rf dist",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage"
-1
View File
@@ -24,7 +24,6 @@
"dev:css": "npx @tailwindcss/cli -i ./src/styles/tailwind.css -o ./src/styles/generated.css --watch --minify",
"lint": "eslint .",
"check-types": "pnpm run build:css && tsc --noEmit",
"clean": "rm -rf dist src/styles/generated.css",
"test": "pnpm run build:css && vitest run"
},
"dependencies": {
+564 -18
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -98,7 +98,7 @@ if [[ "$backend" == "fastapi" ]]; then
fi
echo "Linking packages globally..."
turbo link:global
npx nx run-many -t link:global
echo "Setting up the JS environment..."
cd "$root_dir/../examples/$example_dir/ui"
@@ -136,7 +136,7 @@ fi
echo "Running the app..."
parallel --ungroup ::: \
"cd $root_dir && exec > >(sed 's/^/$copilotkit_prompt /') 2>&1 && turbo run dev" \
"cd $root_dir && exec > >(sed 's/^/$copilotkit_prompt /') 2>&1 && npx nx run-many -t dev" \
"cd $root_dir/../examples/$example_dir/$agent_dir && exec > >(sed 's/^/$agent_prompt /') 2>&1 && $agent_command" \
"cd $root_dir/../examples/$example_dir/ui && exec > >(sed 's/^/$frontend_prompt /') 2>&1 && pnpm dev"
+9
View File
@@ -0,0 +1,9 @@
---
description: NX task runner guidance.
globs: "**/nx.{json,js}"
---
- Tasks are inferred from package.json scripts. Target defaults (dependsOn, cache, inputs, outputs) are configured in `nx.json`.
- Use `nx run <project>:<target>` for single-project tasks.
- Use `nx run-many -t <target>` for workspace-wide tasks.
- Avoid adding new targetDefaults without discussion.
@@ -1,9 +0,0 @@
---
description: Turborepo pipeline guidance.
globs: "**/turbo*.{json,js}"
---
- Tasks are defined in `turbo.json` with common names: `build`, `lint`, `dev`, `check-types`, `test`.
- Each task should specify `dependsOn` and `outputs` where caching matters.
- Avoid creating new pipelines at the repo root without discussion.
- Use `turbo run <task>` for workspace-wide scripts.
-138
View File
@@ -1,138 +0,0 @@
{
"$schema": "https://turborepo.com/schema.json",
"ui": "stream",
"concurrency": "14",
"tasks": {
"build": {
"cache": false,
"persistent": false,
"interactive": false,
"dependsOn": ["^build"],
"inputs": ["$TURBO_DEFAULT$", ".env*"],
"outputs": ["dist/**"],
"outputLogs": "full"
},
"@copilotkit/runtime#generate-graphql-schema": {
"cache": false,
"persistent": false,
"dependsOn": ["^build"]
},
"@copilotkit/runtime-client-gql#graphql-codegen": {
"cache": false,
"persistent": false,
"dependsOn": ["^build", "@copilotkit/runtime#generate-graphql-schema"]
},
"dev": {
"cache": false,
"persistent": true,
"dependsOn": ["^build"]
},
"test": {
"cache": false,
"dependsOn": ["^build"],
"inputs": [
"src/**/*.ts",
"src/**/*.tsx",
"**/__tests__/**",
"**/*.test.*",
"**/*.spec.*"
],
"outputs": ["coverage/**"],
"env": ["LOG_LEVEL", "NODE_ENV"]
},
"test:watch": {
"cache": false,
"persistent": true,
"env": ["LOG_LEVEL", "NODE_ENV"]
},
"test:coverage": {
"dependsOn": ["^build"],
"inputs": [
"src/**/*.ts",
"src/**/*.tsx",
"**/__tests__/**",
"**/*.test.*",
"**/*.spec.*"
],
"outputs": ["coverage/**"],
"env": ["LOG_LEVEL", "NODE_ENV"]
},
"lint": {
"dependsOn": ["^lint"],
"env": ["LOG_LEVEL", "NODE_ENV"]
},
"check-types": {
"cache": false,
"dependsOn": ["^build", "^check-types"]
},
"clean": {
"cache": false,
"persistent": false,
"dependsOn": ["^clean"]
},
"//#check-prettier": {},
"//#format": {
"cache": false
},
"//#freshbuild": {
"cache": false
},
"link:global": {
"cache": false,
"persistent": false
},
"unlink:global": {
"cache": false,
"persistent": false
},
"build:css": {
"cache": true,
"outputs": ["dist/styles.css", "src/styles/generated.css"],
"outputLogs": "errors-only"
},
"@copilotkitnext/web-inspector#build:css": {
"cache": true,
"outputs": ["src/styles/generated.css"],
"outputLogs": "errors-only"
},
"@copilotkitnext/web-inspector#build": {
"dependsOn": ["^build", "@copilotkitnext/web-inspector#build:css"],
"outputs": ["dist/**"],
"outputLogs": "errors-only"
},
"demo#dev": {
"cache": false,
"persistent": true
},
"@copilotkitnext/angular-demo#dev": {
"cache": false,
"persistent": true
},
"@copilotkitnext/angular-demo-server#dev": {
"cache": false,
"persistent": true
},
"storybook:dev": {
"cache": false
},
"storybook": {
"cache": false,
"dependsOn": ["^build"]
},
"storybook-angular#dev": {
"cache": false,
"persistent": true
},
"storybook#dev": {
"cache": false,
"persistent": true
},
"storybook:build": {
"dependsOn": ["^build"],
"outputs": [
"apps/react/storybook/storybook-static/**",
"apps/angular/storybook/storybook-static/**"
]
}
}
}