mirror of
https://github.com/cline/cline.git
synced 2026-08-29 03:52:41 +08:00
Move bun from the sdk/ to root (#11104)
* Move bun to root * Fix scripts and pre-commit * Update scripts * Update workflows * Fix cd * fix pre-commit * fix cli publish
This commit is contained in:
@@ -33,7 +33,7 @@ permissions:
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: sdk
|
||||
working-directory: .
|
||||
|
||||
jobs:
|
||||
publish-main:
|
||||
@@ -102,7 +102,7 @@ jobs:
|
||||
fi
|
||||
|
||||
VERSION="${TAG#cli-v}"
|
||||
PACKAGE_VERSION=$(node -p "require('./apps/cli/package.json').version")
|
||||
PACKAGE_VERSION=$(node -p "require('./sdk/apps/cli/package.json').version")
|
||||
|
||||
if [ "$PACKAGE_VERSION" != "$VERSION" ]; then
|
||||
echo "sdk/apps/cli/package.json version ${PACKAGE_VERSION} does not match ${TAG}"
|
||||
@@ -172,7 +172,7 @@ jobs:
|
||||
)
|
||||
|
||||
for package_name in "${EXPECTED[@]}"; do
|
||||
dir="apps/cli/dist/${package_name#@cline/}"
|
||||
dir="sdk/apps/cli/dist/${package_name#@cline/}"
|
||||
if [ ! -f "$dir/package.json" ]; then
|
||||
echo "Missing package manifest: $dir/package.json"
|
||||
exit 1
|
||||
@@ -207,8 +207,8 @@ jobs:
|
||||
- name: Get Changelog Entry
|
||||
id: changelog
|
||||
run: |
|
||||
# Grab content between the first "## " header and the next one in apps/cli/CHANGELOG.md
|
||||
CONTENT=$(awk '/^## [0-9]/{if(found) exit; found=1; next} found{print}' apps/cli/CHANGELOG.md)
|
||||
# Grab content between the first "## " header and the next one in sdk/apps/cli/CHANGELOG.md
|
||||
CONTENT=$(awk '/^## [0-9]/{if(found) exit; found=1; next} found{print}' sdk/apps/cli/CHANGELOG.md)
|
||||
echo "content<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "$CONTENT" >> $GITHUB_OUTPUT
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
@@ -349,7 +349,7 @@ jobs:
|
||||
if: steps.check_commits.outputs.skip != 'true'
|
||||
id: version
|
||||
run: |
|
||||
BASE_VERSION=$(node -p "require('./apps/cli/package.json').version")
|
||||
BASE_VERSION=$(node -p "require('./sdk/apps/cli/package.json').version")
|
||||
TIMESTAMP=$(date +%s)
|
||||
VERSION="${BASE_VERSION}-nightly.${TIMESTAMP}"
|
||||
|
||||
@@ -365,12 +365,12 @@ jobs:
|
||||
run: |
|
||||
node -e '
|
||||
const fs = require("node:fs");
|
||||
const path = "apps/cli/package.json";
|
||||
const path = "sdk/apps/cli/package.json";
|
||||
const pkg = JSON.parse(fs.readFileSync(path, "utf8"));
|
||||
pkg.version = process.env.VERSION;
|
||||
fs.writeFileSync(path, `${JSON.stringify(pkg, null, "\t")}\n`);
|
||||
'
|
||||
cat apps/cli/package.json | grep '"version"'
|
||||
cat sdk/apps/cli/package.json | grep '"version"'
|
||||
|
||||
- name: Build platform binaries
|
||||
if: steps.check_commits.outputs.skip != 'true'
|
||||
@@ -401,7 +401,7 @@ jobs:
|
||||
)
|
||||
|
||||
for package_name in "${EXPECTED[@]}"; do
|
||||
dir="apps/cli/dist/${package_name#@cline/}"
|
||||
dir="sdk/apps/cli/dist/${package_name#@cline/}"
|
||||
if [ ! -f "$dir/package.json" ]; then
|
||||
echo "Missing package manifest: $dir/package.json"
|
||||
exit 1
|
||||
|
||||
@@ -26,7 +26,7 @@ on:
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: sdk
|
||||
working-directory: .
|
||||
|
||||
jobs:
|
||||
test:
|
||||
@@ -148,7 +148,7 @@ jobs:
|
||||
env:
|
||||
CHANNEL: ${{ steps.channel.outputs.channel }}
|
||||
run: |
|
||||
BASE_VERSION=$(node -p "require('./packages/llms/package.json').version")
|
||||
BASE_VERSION=$(node -p "require('./sdk/packages/llms/package.json').version")
|
||||
|
||||
if [ "$CHANNEL" = "nightly" ]; then
|
||||
TIMESTAMP=$(date +%s)
|
||||
@@ -166,11 +166,11 @@ jobs:
|
||||
if: steps.check_commits.outputs.skip != 'true'
|
||||
env:
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
run: bun scripts/version.ts "$VERSION"
|
||||
run: bun sdk/scripts/version.ts "$VERSION"
|
||||
|
||||
- name: Verify publishability
|
||||
if: steps.check_commits.outputs.skip != 'true'
|
||||
run: bun scripts/check-publish.ts
|
||||
run: bun sdk/scripts/check-publish.ts
|
||||
|
||||
- name: Prepare package tarball directory
|
||||
if: steps.check_commits.outputs.skip != 'true'
|
||||
@@ -187,7 +187,7 @@ jobs:
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
run: |
|
||||
echo "Publishing @cline/shared@${VERSION} with tag '${CHANNEL}'..."
|
||||
cd packages/shared
|
||||
cd sdk/packages/shared
|
||||
TARBALL=$(bun pm pack --destination "$RUNNER_TEMP/sdk-npm-packs" --quiet)
|
||||
npm publish "$RUNNER_TEMP/sdk-npm-packs/$(basename "$TARBALL")" --tag "$CHANNEL" --access public
|
||||
|
||||
@@ -199,7 +199,7 @@ jobs:
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
run: |
|
||||
echo "Publishing @cline/llms@${VERSION} with tag '${CHANNEL}'..."
|
||||
cd packages/llms
|
||||
cd sdk/packages/llms
|
||||
TARBALL=$(bun pm pack --destination "$RUNNER_TEMP/sdk-npm-packs" --quiet)
|
||||
npm publish "$RUNNER_TEMP/sdk-npm-packs/$(basename "$TARBALL")" --tag "$CHANNEL" --access public
|
||||
|
||||
@@ -211,7 +211,7 @@ jobs:
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
run: |
|
||||
echo "Publishing @cline/agents@${VERSION} with tag '${CHANNEL}'..."
|
||||
cd packages/agents
|
||||
cd sdk/packages/agents
|
||||
TARBALL=$(bun pm pack --destination "$RUNNER_TEMP/sdk-npm-packs" --quiet)
|
||||
npm publish "$RUNNER_TEMP/sdk-npm-packs/$(basename "$TARBALL")" --tag "$CHANNEL" --access public
|
||||
|
||||
@@ -223,7 +223,7 @@ jobs:
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
run: |
|
||||
echo "Publishing @cline/core@${VERSION} with tag '${CHANNEL}'..."
|
||||
cd packages/core
|
||||
cd sdk/packages/core
|
||||
TARBALL=$(bun pm pack --destination "$RUNNER_TEMP/sdk-npm-packs" --quiet)
|
||||
npm publish "$RUNNER_TEMP/sdk-npm-packs/$(basename "$TARBALL")" --tag "$CHANNEL" --access public
|
||||
|
||||
@@ -235,7 +235,7 @@ jobs:
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
run: |
|
||||
echo "Publishing @cline/sdk@${VERSION} with tag '${CHANNEL}'..."
|
||||
cd packages/sdk
|
||||
cd sdk/packages/sdk
|
||||
TARBALL=$(bun pm pack --destination "$RUNNER_TEMP/sdk-npm-packs" --quiet)
|
||||
npm publish "$RUNNER_TEMP/sdk-npm-packs/$(basename "$TARBALL")" --tag "$CHANNEL" --access public
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ permissions:
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: sdk
|
||||
working-directory: .
|
||||
|
||||
jobs:
|
||||
quality-checks:
|
||||
@@ -96,12 +96,12 @@ jobs:
|
||||
|
||||
- name: Run SDK Tests (Windows)
|
||||
if: ${{ !cancelled() && steps.build_sdk_step.outcome == 'success' && steps.build_cli_step.outcome == 'success' && matrix.os == 'windows-latest' }}
|
||||
run: bun -F './packages/**' test
|
||||
run: bun -F './sdk/packages/**' test
|
||||
|
||||
- name: Smoke test SQLite under Node
|
||||
if: ${{ !cancelled() && steps.build_sdk_step.outcome == 'success' && matrix.os != 'windows-latest' }}
|
||||
timeout-minutes: 10
|
||||
run: bun scripts/ci-node-smoke.ts
|
||||
run: bun sdk/scripts/ci-node-smoke.ts
|
||||
|
||||
- name: Run TUI e2e tests
|
||||
if: ${{ !cancelled() && steps.build_sdk_step.outcome == 'success' && steps.build_cli_step.outcome == 'success' && matrix.os == 'ubuntu-latest' && matrix.node-version == '24.x' }}
|
||||
@@ -109,4 +109,4 @@ jobs:
|
||||
|
||||
- name: Verify packages are publishable
|
||||
if: ${{ !cancelled() && steps.build_sdk_step.outcome == 'success' && steps.build_cli_step.outcome == 'success' && matrix.os == 'ubuntu-latest' && matrix.node-version == '24.x' }}
|
||||
run: bun scripts/check-publish.ts
|
||||
run: bun sdk/scripts/check-publish.ts
|
||||
|
||||
@@ -1 +1,10 @@
|
||||
if ! command -v gitleaks >/dev/null 2>&1; then
|
||||
echo "gitleaks is required for the pre-commit secret scan."
|
||||
echo "Install it with: brew install gitleaks"
|
||||
echo "Other install options: https://github.com/gitleaks/gitleaks#installing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gitleaks git --pre-commit --redact --staged --verbose || exit 1
|
||||
|
||||
lint-staged
|
||||
Vendored
+22
-21
@@ -5,8 +5,8 @@
|
||||
"tasks": [
|
||||
{
|
||||
"label": "compile-standalone",
|
||||
"type": "npm",
|
||||
"script": "compile-standalone",
|
||||
"type": "shell",
|
||||
"command": "npm run compile-standalone",
|
||||
"group": "build",
|
||||
"problemMatcher": [],
|
||||
"presentation": {
|
||||
@@ -18,8 +18,8 @@
|
||||
},
|
||||
{
|
||||
"label": "npm: protos",
|
||||
"type": "npm",
|
||||
"script": "protos",
|
||||
"type": "shell",
|
||||
"command": "npm run protos",
|
||||
"problemMatcher": [],
|
||||
"isBackground": false,
|
||||
"presentation": {
|
||||
@@ -64,8 +64,8 @@
|
||||
"group": "build"
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "build:webview",
|
||||
"type": "shell",
|
||||
"command": "npm run build:webview",
|
||||
"group": "build",
|
||||
"problemMatcher": [],
|
||||
"isBackground": true,
|
||||
@@ -85,8 +85,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "build:webview:test",
|
||||
"type": "shell",
|
||||
"command": "npm run build:webview:test",
|
||||
"group": "build",
|
||||
"problemMatcher": [],
|
||||
"isBackground": true,
|
||||
@@ -107,8 +107,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "dev:webview",
|
||||
"type": "shell",
|
||||
"command": "npm run dev:webview",
|
||||
"group": "build",
|
||||
"problemMatcher": [
|
||||
{
|
||||
@@ -144,8 +144,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "watch:esbuild",
|
||||
"type": "shell",
|
||||
"command": "npm run watch:esbuild",
|
||||
"group": "build",
|
||||
"problemMatcher": {
|
||||
"pattern": [
|
||||
@@ -183,8 +183,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "watch:esbuild:test",
|
||||
"type": "shell",
|
||||
"command": "npm run watch:esbuild:test",
|
||||
"group": "build",
|
||||
"problemMatcher": {
|
||||
"pattern": [
|
||||
@@ -223,8 +223,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "watch:tsc",
|
||||
"type": "shell",
|
||||
"command": "npm run watch:tsc",
|
||||
"group": "build",
|
||||
"problemMatcher": "$tsc-watch",
|
||||
"isBackground": true,
|
||||
@@ -241,8 +241,9 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "watch-tests",
|
||||
"type": "shell",
|
||||
"command": "npm run watch-tests",
|
||||
"label": "npm: watch-tests",
|
||||
"problemMatcher": "$tsc-watch",
|
||||
"isBackground": true,
|
||||
"dependsOn": [
|
||||
@@ -280,8 +281,8 @@
|
||||
"command": "rm -rf ${workspaceFolder}/apps/vscode/dist/tmp/user && mkdir -p ${workspaceFolder}/apps/vscode/dist/tmp/user"
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "storybook",
|
||||
"type": "shell",
|
||||
"command": "npm run storybook",
|
||||
"group": "build",
|
||||
"problemMatcher": [],
|
||||
"isBackground": false,
|
||||
@@ -308,7 +309,7 @@
|
||||
"$tsc"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/sdk"
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@@ -155,8 +155,7 @@ async function resolveRipgrepPath(): Promise<string> {
|
||||
|
||||
async function findSystemRipgrep(): Promise<string> {
|
||||
const fallback = process.platform === "win32" ? "rg.exe" : "rg"
|
||||
const candidates =
|
||||
process.platform === "win32" ? [] : ["/usr/bin/rg", "/opt/homebrew/bin/rg", "/usr/local/bin/rg"]
|
||||
const candidates = process.platform === "win32" ? [] : ["/usr/bin/rg", "/opt/homebrew/bin/rg", "/usr/local/bin/rg"]
|
||||
|
||||
for (const candidate of candidates) {
|
||||
try {
|
||||
|
||||
@@ -145,9 +145,8 @@ export function mockFetchForTesting<T>(theFetch: typeof globalThis.fetch, callba
|
||||
return result.finally(() => {
|
||||
mockFetch = originalMockFetch
|
||||
}) as typeof result
|
||||
} else {
|
||||
return result
|
||||
}
|
||||
return result
|
||||
} finally {
|
||||
if (willResetSync) {
|
||||
mockFetch = originalMockFetch
|
||||
@@ -171,12 +170,17 @@ export function mockFetchForTesting<T>(theFetch: typeof globalThis.fetch, callba
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
export function getAxiosSettings(): { adapter?: any; fetch?: typeof globalThis.fetch; maxBodyLength?: number; maxContentLength?: number } {
|
||||
export function getAxiosSettings(): {
|
||||
adapter?: any
|
||||
fetch?: typeof globalThis.fetch
|
||||
maxBodyLength?: number
|
||||
maxContentLength?: number
|
||||
} {
|
||||
return {
|
||||
adapter: "fetch" as any,
|
||||
fetch, // Use our configured fetch
|
||||
maxBodyLength: Infinity,
|
||||
maxContentLength: Infinity,
|
||||
maxBodyLength: Number.POSITIVE_INFINITY,
|
||||
maxContentLength: Number.POSITIVE_INFINITY,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+39
-39
@@ -17,9 +17,9 @@
|
||||
"typescript": "^5.9.3",
|
||||
},
|
||||
},
|
||||
"apps/cli": {
|
||||
"sdk/apps/cli": {
|
||||
"name": "@cline/cli",
|
||||
"version": "3.0.14",
|
||||
"version": "3.0.15",
|
||||
"bin": {
|
||||
"cline": "src/index.ts",
|
||||
},
|
||||
@@ -56,7 +56,7 @@
|
||||
"@types/react": "19.2.14",
|
||||
},
|
||||
},
|
||||
"apps/cline-hub": {
|
||||
"sdk/apps/cline-hub": {
|
||||
"name": "@cline/cline-hub",
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
@@ -65,7 +65,7 @@
|
||||
"@cline/shared": "workspace:*",
|
||||
},
|
||||
},
|
||||
"apps/cline-hub/src/webview": {
|
||||
"sdk/apps/cline-hub/src/webview": {
|
||||
"name": "@cline/cline-hub-webview",
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
@@ -122,7 +122,7 @@
|
||||
"vite": "^8.0.0",
|
||||
},
|
||||
},
|
||||
"apps/examples/cli-agent": {
|
||||
"sdk/apps/examples/cli-agent": {
|
||||
"name": "@cline/example-cli-agent",
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
@@ -133,7 +133,7 @@
|
||||
"typescript": "^5.9.3",
|
||||
},
|
||||
},
|
||||
"apps/examples/cline-core-cli-agent": {
|
||||
"sdk/apps/examples/cline-core-cli-agent": {
|
||||
"name": "@cline/example-cline-core-cli-agent",
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
@@ -143,7 +143,7 @@
|
||||
"typescript": "^5.9.3",
|
||||
},
|
||||
},
|
||||
"apps/examples/code-review-bot": {
|
||||
"sdk/apps/examples/code-review-bot": {
|
||||
"name": "@cline/example-code-review-bot",
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
@@ -154,7 +154,7 @@
|
||||
"typescript": "^5.9.3",
|
||||
},
|
||||
},
|
||||
"apps/examples/desktop-app": {
|
||||
"sdk/apps/examples/desktop-app": {
|
||||
"name": "@cline/code",
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
@@ -229,7 +229,7 @@
|
||||
"typescript": "5.7.3",
|
||||
},
|
||||
},
|
||||
"apps/examples/menubar": {
|
||||
"sdk/apps/examples/menubar": {
|
||||
"name": "@cline/menubar",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
@@ -243,7 +243,7 @@
|
||||
"typescript": "^5.9.3",
|
||||
},
|
||||
},
|
||||
"apps/examples/multi-agent": {
|
||||
"sdk/apps/examples/multi-agent": {
|
||||
"name": "@cline/example-multi-agent",
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
@@ -253,7 +253,7 @@
|
||||
"typescript": "^5.9.3",
|
||||
},
|
||||
},
|
||||
"apps/examples/quickstart": {
|
||||
"sdk/apps/examples/quickstart": {
|
||||
"name": "@cline/example-quickstart",
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
@@ -263,7 +263,7 @@
|
||||
"typescript": "^5.9.3",
|
||||
},
|
||||
},
|
||||
"apps/examples/vscode": {
|
||||
"sdk/apps/examples/vscode": {
|
||||
"name": "@cline/vscode",
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
@@ -279,7 +279,7 @@
|
||||
"typescript": "^5.9.3",
|
||||
},
|
||||
},
|
||||
"apps/examples/vscode/src/webview": {
|
||||
"sdk/apps/examples/vscode/src/webview": {
|
||||
"name": "webview",
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
@@ -336,7 +336,7 @@
|
||||
"vite": "^8.0.0",
|
||||
},
|
||||
},
|
||||
"examples": {
|
||||
"sdk/examples": {
|
||||
"name": "examples",
|
||||
"dependencies": {
|
||||
"@cline/core": "workspace:*",
|
||||
@@ -348,7 +348,7 @@
|
||||
"typescript": "^5",
|
||||
},
|
||||
},
|
||||
"examples/plugins/agents-squad": {
|
||||
"sdk/examples/plugins/agents-squad": {
|
||||
"name": "cline-agent-squad-plugin",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
@@ -362,7 +362,7 @@
|
||||
"@cline/core",
|
||||
],
|
||||
},
|
||||
"packages/agents": {
|
||||
"sdk/packages/agents": {
|
||||
"name": "@cline/agents",
|
||||
"version": "0.0.42",
|
||||
"dependencies": {
|
||||
@@ -371,7 +371,7 @@
|
||||
"nanoid": "^5.1.7",
|
||||
},
|
||||
},
|
||||
"packages/core": {
|
||||
"sdk/packages/core": {
|
||||
"name": "@cline/core",
|
||||
"version": "0.0.42",
|
||||
"dependencies": {
|
||||
@@ -402,7 +402,7 @@
|
||||
"@types/ws": "^8.18.1",
|
||||
},
|
||||
},
|
||||
"packages/llms": {
|
||||
"sdk/packages/llms": {
|
||||
"name": "@cline/llms",
|
||||
"version": "0.0.42",
|
||||
"dependencies": {
|
||||
@@ -436,14 +436,14 @@
|
||||
"@aws-sdk/client-bedrock-runtime",
|
||||
],
|
||||
},
|
||||
"packages/sdk": {
|
||||
"sdk/packages/sdk": {
|
||||
"name": "@cline/sdk",
|
||||
"version": "0.0.42",
|
||||
"dependencies": {
|
||||
"@cline/core": "workspace:*",
|
||||
},
|
||||
},
|
||||
"packages/shared": {
|
||||
"sdk/packages/shared": {
|
||||
"name": "@cline/shared",
|
||||
"version": "0.0.42",
|
||||
"dependencies": {
|
||||
@@ -653,37 +653,37 @@
|
||||
|
||||
"@clack/prompts": ["@clack/prompts@1.5.0", "", { "dependencies": { "@clack/core": "1.4.0", "fast-string-width": "^3.0.2", "fast-wrap-ansi": "^0.2.0", "sisteransi": "^1.0.5" } }, "sha512-wKh+wTjmrUoUdkZg8KpJO5X+p9PWV+KE9mePseq9UYWkukgTKsGS47RRL2HstwVcvDQH+PenrPJWII8+MfiiyA=="],
|
||||
|
||||
"@cline/agents": ["@cline/agents@workspace:packages/agents"],
|
||||
"@cline/agents": ["@cline/agents@workspace:sdk/packages/agents"],
|
||||
|
||||
"@cline/cli": ["@cline/cli@workspace:apps/cli"],
|
||||
"@cline/cli": ["@cline/cli@workspace:sdk/apps/cli"],
|
||||
|
||||
"@cline/cline-hub": ["@cline/cline-hub@workspace:apps/cline-hub"],
|
||||
"@cline/cline-hub": ["@cline/cline-hub@workspace:sdk/apps/cline-hub"],
|
||||
|
||||
"@cline/cline-hub-webview": ["@cline/cline-hub-webview@workspace:apps/cline-hub/src/webview"],
|
||||
"@cline/cline-hub-webview": ["@cline/cline-hub-webview@workspace:sdk/apps/cline-hub/src/webview"],
|
||||
|
||||
"@cline/code": ["@cline/code@workspace:apps/examples/desktop-app"],
|
||||
"@cline/code": ["@cline/code@workspace:sdk/apps/examples/desktop-app"],
|
||||
|
||||
"@cline/core": ["@cline/core@workspace:packages/core"],
|
||||
"@cline/core": ["@cline/core@workspace:sdk/packages/core"],
|
||||
|
||||
"@cline/example-cli-agent": ["@cline/example-cli-agent@workspace:apps/examples/cli-agent"],
|
||||
"@cline/example-cli-agent": ["@cline/example-cli-agent@workspace:sdk/apps/examples/cli-agent"],
|
||||
|
||||
"@cline/example-cline-core-cli-agent": ["@cline/example-cline-core-cli-agent@workspace:apps/examples/cline-core-cli-agent"],
|
||||
"@cline/example-cline-core-cli-agent": ["@cline/example-cline-core-cli-agent@workspace:sdk/apps/examples/cline-core-cli-agent"],
|
||||
|
||||
"@cline/example-code-review-bot": ["@cline/example-code-review-bot@workspace:apps/examples/code-review-bot"],
|
||||
"@cline/example-code-review-bot": ["@cline/example-code-review-bot@workspace:sdk/apps/examples/code-review-bot"],
|
||||
|
||||
"@cline/example-multi-agent": ["@cline/example-multi-agent@workspace:apps/examples/multi-agent"],
|
||||
"@cline/example-multi-agent": ["@cline/example-multi-agent@workspace:sdk/apps/examples/multi-agent"],
|
||||
|
||||
"@cline/example-quickstart": ["@cline/example-quickstart@workspace:apps/examples/quickstart"],
|
||||
"@cline/example-quickstart": ["@cline/example-quickstart@workspace:sdk/apps/examples/quickstart"],
|
||||
|
||||
"@cline/llms": ["@cline/llms@workspace:packages/llms"],
|
||||
"@cline/llms": ["@cline/llms@workspace:sdk/packages/llms"],
|
||||
|
||||
"@cline/menubar": ["@cline/menubar@workspace:apps/examples/menubar"],
|
||||
"@cline/menubar": ["@cline/menubar@workspace:sdk/apps/examples/menubar"],
|
||||
|
||||
"@cline/sdk": ["@cline/sdk@workspace:packages/sdk"],
|
||||
"@cline/sdk": ["@cline/sdk@workspace:sdk/packages/sdk"],
|
||||
|
||||
"@cline/shared": ["@cline/shared@workspace:packages/shared"],
|
||||
"@cline/shared": ["@cline/shared@workspace:sdk/packages/shared"],
|
||||
|
||||
"@cline/vscode": ["@cline/vscode@workspace:apps/examples/vscode"],
|
||||
"@cline/vscode": ["@cline/vscode@workspace:sdk/apps/examples/vscode"],
|
||||
|
||||
"@colors/colors": ["@colors/colors@1.6.0", "", {}, "sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA=="],
|
||||
|
||||
@@ -1795,7 +1795,7 @@
|
||||
|
||||
"client-only": ["client-only@0.0.1", "", {}, "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA=="],
|
||||
|
||||
"cline-agent-squad-plugin": ["cline-agent-squad-plugin@workspace:examples/plugins/agents-squad"],
|
||||
"cline-agent-squad-plugin": ["cline-agent-squad-plugin@workspace:sdk/examples/plugins/agents-squad"],
|
||||
|
||||
"cliui": ["cliui@8.0.1", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" } }, "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ=="],
|
||||
|
||||
@@ -2075,7 +2075,7 @@
|
||||
|
||||
"eventsource-parser": ["eventsource-parser@3.1.0", "", {}, "sha512-kJezFj9YFAMLeORyi7aCLxLbD5/qWMQnoMVlVPyHIll7lgRJCc3JVln9Vgl9nwQi0YkMnhdGTMNn7CkRRAptMg=="],
|
||||
|
||||
"examples": ["examples@workspace:examples"],
|
||||
"examples": ["examples@workspace:sdk/examples"],
|
||||
|
||||
"execa": ["execa@9.6.1", "", { "dependencies": { "@sindresorhus/merge-streams": "^4.0.0", "cross-spawn": "^7.0.6", "figures": "^6.1.0", "get-stream": "^9.0.0", "human-signals": "^8.0.1", "is-plain-obj": "^4.1.0", "is-stream": "^4.0.1", "npm-run-path": "^6.0.0", "pretty-ms": "^9.2.0", "signal-exit": "^4.1.0", "strip-final-newline": "^4.0.0", "yoctocolors": "^2.1.1" } }, "sha512-9Be3ZoN4LmYR90tUoVu2te2BsbzHfhJyfEiAVfz7N5/zv+jduIfLrV2xdQXOHbaD6KgpGdO9PRPM1Y4Q9QkPkA=="],
|
||||
|
||||
@@ -3199,7 +3199,7 @@
|
||||
|
||||
"web-tree-sitter": ["web-tree-sitter@0.25.10", "", { "peerDependencies": { "@types/emscripten": "^1.40.0" }, "optionalPeers": ["@types/emscripten"] }, "sha512-Y09sF44/13XvgVKgO2cNDw5rGk6s26MgoZPXLESvMXeefBf7i6/73eFurre0IsTW6E14Y0ArIzhUMmjoc7xyzA=="],
|
||||
|
||||
"webview": ["webview@workspace:apps/examples/vscode/src/webview"],
|
||||
"webview": ["webview@workspace:sdk/apps/examples/vscode/src/webview"],
|
||||
|
||||
"which": ["which@4.0.0", "", { "dependencies": { "isexe": "^3.1.1" }, "bin": { "node-which": "bin/which.js" } }, "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg=="],
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"name": "@cline/packages",
|
||||
"private": true,
|
||||
"workspaces": [
|
||||
"sdk/packages/*",
|
||||
"sdk/apps/*",
|
||||
"sdk/apps/cline-hub/src/webview",
|
||||
"sdk/apps/examples/*",
|
||||
"sdk/apps/examples/vscode/src/webview",
|
||||
"sdk/examples",
|
||||
"sdk/examples/plugins/*"
|
||||
],
|
||||
"scripts": {
|
||||
"prepare": "husky",
|
||||
"build": "bun run clean && bun install && bun run build:sdk && bun -F @cline/cli build",
|
||||
"build:sdk": "bun --production -F './sdk/packages/*' build",
|
||||
"build:apps": "bun -F './sdk/apps/**' --production build",
|
||||
"build:models": "bun -F @cline/llms generate:models && bun format --write",
|
||||
"dev": "bun --conditions=development run build:sdk && bun run cli && bun run cli hub stop",
|
||||
"cli": "bun --conditions=development --cwd sdk/apps/cli dev",
|
||||
"code": "bun --conditions=development -F @cline/code dev",
|
||||
"clean": "bun run sdk/scripts/clean.ts",
|
||||
"types": "bun --parallel -F '*' typecheck",
|
||||
"test": "bun --parallel -F './sdk/packages/**' -F './sdk/apps/cli' test",
|
||||
"test:unit": "bash -lc 'set -euo pipefail; bun -F @cline/agents test & p1=$!; bun -F @cline/llms test & p2=$!; bun -F @cline/core test:unit & p3=$!; bun -F @cline/cli test:unit & p4=$!; wait $p1; wait $p2; wait $p3; wait $p4'",
|
||||
"test:e2e": "bun -F @cline/core test:e2e && bun -F @cline/cli test:e2e",
|
||||
"test:e2e:interactive": "bun -F @cline/cli test:e2e:interactive",
|
||||
"verify:routines": "zsh -lc 'cd sdk/packages/core && bunx vitest run src/cron/schedule-service.test.ts --config vitest.config.ts'",
|
||||
"verify:workos-device-auth": "bun sdk/scripts/verify-workos-device-auth.ts",
|
||||
"biome": "bunx --bun @biomejs/biome",
|
||||
"format": "bun biome format sdk/",
|
||||
"lint": "bun biome lint sdk/",
|
||||
"fix": "bun biome check --write --unsafe --diagnostic-level=error sdk/",
|
||||
"check": "bun biome check --diagnostic-level=error sdk/ && bun run build:sdk && bun run -F @cline/cli build && bun --parallel -F './sdk/packages/**' -F @cline/cli typecheck && bun sdk/scripts/check-publish.ts",
|
||||
"version": "bun run types && bun sdk/scripts/version.ts",
|
||||
"release": "bun sdk/scripts/release.ts"
|
||||
},
|
||||
"lint-staged": {
|
||||
"sdk/**": [
|
||||
"sh -c 'bun run types'",
|
||||
"bun biome check --no-errors-on-unmatched --files-ignore-unknown=true"
|
||||
]
|
||||
},
|
||||
"module": "index.ts",
|
||||
"type": "module",
|
||||
"engines": {
|
||||
"bun": "1.3.13",
|
||||
"node": ">=22"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "2.4.5",
|
||||
"@types/bun": "^1.3.13",
|
||||
"@types/node": "^25.3.5",
|
||||
"husky": "^9.1.7",
|
||||
"lint-staged": "^16.3.2",
|
||||
"vitest": "^4.0.18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"nanoid": "^5.1.7",
|
||||
"typescript": "^5.9.3"
|
||||
},
|
||||
"packageManager": "bun@1.3.13"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
if ! command -v gitleaks >/dev/null 2>&1; then
|
||||
echo "gitleaks is required for the pre-commit secret scan."
|
||||
echo "Install it with: brew install gitleaks"
|
||||
echo "Other install options: https://github.com/gitleaks/gitleaks#installing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gitleaks git --pre-commit --redact --staged --verbose || exit 1
|
||||
lint-staged
|
||||
@@ -1115,8 +1115,11 @@ class DiscordConnector extends ConnectorBase<
|
||||
resolveStop?.();
|
||||
};
|
||||
|
||||
|
||||
type ErrorTrackerEntry = { count: number; firstSeen: number; lastSeen: number };
|
||||
type ErrorTrackerEntry = {
|
||||
count: number;
|
||||
firstSeen: number;
|
||||
lastSeen: number;
|
||||
};
|
||||
const errorTracker = new Map<string, ErrorTrackerEntry>();
|
||||
const MAX_REPEATED_ERRORS = 3;
|
||||
const ERROR_WINDOW_MS = 60_000; // 1 minute
|
||||
@@ -1250,25 +1253,33 @@ class DiscordConnector extends ConnectorBase<
|
||||
} catch (error) {
|
||||
const message =
|
||||
error instanceof Error ? error.message : String(error);
|
||||
|
||||
|
||||
// Track repeated errors per-thread with fixed time window
|
||||
const now = Date.now();
|
||||
const errorKey = `${thread.id}:${message.slice(0, 200)}`; // Per-thread error tracking
|
||||
const tracked = errorTracker.get(errorKey);
|
||||
|
||||
|
||||
if (!tracked) {
|
||||
// First occurrence, start tracking
|
||||
errorTracker.set(errorKey, { count: 1, firstSeen: now, lastSeen: now });
|
||||
errorTracker.set(errorKey, {
|
||||
count: 1,
|
||||
firstSeen: now,
|
||||
lastSeen: now,
|
||||
});
|
||||
await thread.post(`Discord bridge error: ${message}`);
|
||||
} else if (now - tracked.firstSeen > ERROR_WINDOW_MS) {
|
||||
// Outside fixed window, reset counter
|
||||
errorTracker.set(errorKey, { count: 1, firstSeen: now, lastSeen: now });
|
||||
errorTracker.set(errorKey, {
|
||||
count: 1,
|
||||
firstSeen: now,
|
||||
lastSeen: now,
|
||||
});
|
||||
await thread.post(`Discord bridge error: ${message}`);
|
||||
} else {
|
||||
// Within fixed window, increment counter
|
||||
tracked.count++;
|
||||
tracked.lastSeen = now;
|
||||
|
||||
|
||||
if (tracked.count >= MAX_REPEATED_ERRORS) {
|
||||
// Too many repeated errors in this thread, kill the connector
|
||||
loggerAdapter.core.error?.(
|
||||
|
||||
@@ -4,8 +4,8 @@ import { join } from "node:path";
|
||||
import type { Thread } from "chat";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import {
|
||||
clearBindingSessionIds,
|
||||
type ConnectorThreadState,
|
||||
clearBindingSessionIds,
|
||||
isParticipantMuted,
|
||||
isThreadMuted,
|
||||
readBindingForThread,
|
||||
|
||||
@@ -98,9 +98,10 @@ function isControlBinding(
|
||||
);
|
||||
}
|
||||
|
||||
function clearSerializedThreadSessionId(
|
||||
serializedThread: string | undefined,
|
||||
): { serializedThread: string | undefined; updated: boolean } {
|
||||
function clearSerializedThreadSessionId(serializedThread: string | undefined): {
|
||||
serializedThread: string | undefined;
|
||||
updated: boolean;
|
||||
} {
|
||||
if (!serializedThread?.trim()) {
|
||||
return { serializedThread, updated: false };
|
||||
}
|
||||
|
||||
@@ -176,11 +176,11 @@ export function getModeInputPlaceholder(
|
||||
}
|
||||
|
||||
function srgbToLinear(c: number): number {
|
||||
return c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
||||
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
||||
}
|
||||
|
||||
function linearToSrgb(c: number): number {
|
||||
const v = c <= 0.0031308 ? c * 12.92 : 1.055 * Math.pow(c, 1 / 2.4) - 0.055;
|
||||
const v = c <= 0.0031308 ? c * 12.92 : 1.055 * c ** (1 / 2.4) - 0.055;
|
||||
return Math.max(0, Math.min(1, v));
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ export function normalizeCommandName(
|
||||
command: string,
|
||||
botUserName?: string,
|
||||
): string {
|
||||
const botMention = command.match(/^(\/[^@\s]+)@[a-z0-9_.\-]+$/i);
|
||||
const botMention = command.match(/^(\/[^@\s]+)@[a-z0-9_.-]+$/i);
|
||||
if (!botMention) {
|
||||
return command;
|
||||
}
|
||||
@@ -160,7 +160,7 @@ export function isCommandAddressedToBot(
|
||||
if (!expectedBotName) {
|
||||
return false;
|
||||
}
|
||||
const match = command.match(/^\/[^@\s]+@([a-z0-9_.\-]+)$/i);
|
||||
const match = command.match(/^\/[^@\s]+@([a-z0-9_.-]+)$/i);
|
||||
return match?.[1]?.toLowerCase() === expectedBotName;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
{
|
||||
"name": "@cline/packages",
|
||||
"private": true,
|
||||
"workspaces": [
|
||||
"packages/*",
|
||||
"apps/*",
|
||||
"apps/cline-hub/src/webview",
|
||||
"apps/examples/*",
|
||||
"apps/examples/vscode/src/webview",
|
||||
"examples",
|
||||
"examples/plugins/*"
|
||||
],
|
||||
"scripts": {
|
||||
"prepare": "husky",
|
||||
"build": "bun run clean && bun install && bun run build:sdk && bun -F @cline/cli build",
|
||||
"build:sdk": "bun --production -F './packages/*' build",
|
||||
"build:apps": "bun -F './apps/**' --production build",
|
||||
"build:models": "bun -F @cline/llms generate:models && bun format --write",
|
||||
"dev": "bun --conditions=development run build:sdk && bun run cli && bun run cli hub stop",
|
||||
"cli": "bun --conditions=development --cwd apps/cli dev",
|
||||
"code": "bun --conditions=development -F @cline/code dev",
|
||||
"clean": "bun run scripts/clean.ts",
|
||||
"types": "bun --parallel -F '*' typecheck",
|
||||
"test": "bun --parallel -F './packages/**' -F './apps/cli' test",
|
||||
"test:unit": "bash -lc 'set -euo pipefail; bun -F @cline/agents test & p1=$!; bun -F @cline/llms test & p2=$!; bun -F @cline/core test:unit & p3=$!; bun -F @cline/cli test:unit & p4=$!; wait $p1; wait $p2; wait $p3; wait $p4'",
|
||||
"test:e2e": "bun -F @cline/core test:e2e && bun -F @cline/cli test:e2e",
|
||||
"test:e2e:interactive": "bun -F @cline/cli test:e2e:interactive",
|
||||
"verify:routines": "zsh -lc 'cd packages/core && bunx vitest run src/cron/schedule-service.test.ts --config vitest.config.ts'",
|
||||
"verify:workos-device-auth": "bun scripts/verify-workos-device-auth.ts",
|
||||
"biome": "bunx --bun @biomejs/biome",
|
||||
"format": "bun biome format",
|
||||
"lint": "bun biome lint",
|
||||
"fix": "bun biome check --write --unsafe --diagnostic-level=error",
|
||||
"check": "bun biome check --diagnostic-level=error && bun run build:sdk && bun run -F @cline/cli build && bun --parallel -F './packages/**' -F @cline/cli typecheck && bun scripts/check-publish.ts",
|
||||
"version": "bun run types && bun scripts/version.ts",
|
||||
"release": "bun scripts/release.ts"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*": [
|
||||
"sh -c 'bun run types'",
|
||||
"bun biome check --no-errors-on-unmatched --files-ignore-unknown=true"
|
||||
]
|
||||
},
|
||||
"module": "index.ts",
|
||||
"type": "module",
|
||||
"engines": {
|
||||
"bun": "1.3.13",
|
||||
"node": ">=22"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "2.4.5",
|
||||
"@types/bun": "^1.3.13",
|
||||
"@types/node": "^25.3.5",
|
||||
"husky": "^9.1.7",
|
||||
"lint-staged": "^16.3.2",
|
||||
"vitest": "^4.0.18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"nanoid": "^5.1.7",
|
||||
"typescript": "^5.9.3"
|
||||
},
|
||||
"packageManager": "bun@1.3.13"
|
||||
}
|
||||
@@ -20,7 +20,7 @@ type RootPackageJson = {
|
||||
|
||||
const TARGETS = ["dist", "node_modules"] as const;
|
||||
|
||||
const root = path.join(import.meta.dir, "..");
|
||||
const root = path.join(import.meta.dir, "..", "..");
|
||||
|
||||
async function readWorkspaceGlobs(): Promise<string[]> {
|
||||
const raw = await readFile(path.join(root, "package.json"), "utf8");
|
||||
|
||||
+11
-6
@@ -76,9 +76,10 @@ if (explicitVersion && !/^\d+\.\d+\.\d+(-[\w.]+)?$/.test(explicitVersion)) {
|
||||
|
||||
const SDK_PUBLISH_ORDER = ["shared", "llms", "agents", "core", "sdk"] as const;
|
||||
const MAIN_BRANCH = "main";
|
||||
const root = join(import.meta.dir, "..");
|
||||
const packagesDir = join(root, "packages");
|
||||
const cliDir = join(root, "apps/cli");
|
||||
const root = join(import.meta.dir, "..", "..");
|
||||
const sdkRoot = join(import.meta.dir, "..");
|
||||
const packagesDir = join(sdkRoot, "packages");
|
||||
const cliDir = join(sdkRoot, "apps/cli");
|
||||
|
||||
// ── Helpers ───────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -135,7 +136,11 @@ async function stageSdkReadmeForPublish(
|
||||
return undefined;
|
||||
}
|
||||
|
||||
await copyFile(join(root, "README.md"), destination, constants.COPYFILE_EXCL);
|
||||
await copyFile(
|
||||
join(sdkRoot, "README.md"),
|
||||
destination,
|
||||
constants.COPYFILE_EXCL,
|
||||
);
|
||||
return destination;
|
||||
}
|
||||
|
||||
@@ -407,11 +412,11 @@ async function releaseSDK(version: string): Promise<number> {
|
||||
// Step 2: Update versions
|
||||
// version.ts handles: version bump -> lockfile regeneration -> generate:models -> format -> build
|
||||
header("Step 2/5: Updating package versions and lockfile");
|
||||
await run(["bun", "scripts/version.ts", version]);
|
||||
await run(["bun", "scripts/version.ts", version], { cwd: sdkRoot });
|
||||
|
||||
// Step 3: Verify publishability
|
||||
header("Step 3/5: Verifying packed tarballs");
|
||||
await run(["bun", "scripts/check-publish.ts"]);
|
||||
await run(["bun", "scripts/check-publish.ts"], { cwd: sdkRoot });
|
||||
|
||||
// Step 4: Publish in dependency order
|
||||
header("Step 4/5: Publishing packages");
|
||||
|
||||
@@ -25,8 +25,9 @@ function incrementPatchVersion(input: string): string {
|
||||
return `${major}.${minor}.${Number(patch) + 1}`;
|
||||
}
|
||||
|
||||
const root = join(import.meta.dir, "..");
|
||||
const packagesDir = join(root, "packages");
|
||||
const root = join(import.meta.dir, "..", "..");
|
||||
const sdkRoot = join(import.meta.dir, "..");
|
||||
const packagesDir = join(sdkRoot, "packages");
|
||||
const dirs = await readdir(packagesDir, { withFileTypes: true });
|
||||
const workspaces = dirs.filter((d) => d.isDirectory()).map((d) => d.name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user