chore: rename example folders; fix references (#60)

* rename folders

* fix examples reorg references

* move over files

* having agent fixing and validating all examples are still working

* fix sidecar paths

---------

Co-authored-by: abeatrix <beatrix@cline.bot>
This commit is contained in:
Renee Huang
2026-05-07 20:38:04 -07:00
committed by GitHub
parent 2b2ff9667d
commit e215d3d91c
438 changed files with 372 additions and 975 deletions
+2
View File
@@ -52,6 +52,8 @@ packages/rpc/src/proto/generated
# Tauri generated code
apps/*/src-tauri/gen
apps/*/src-tauri/bin
apps/examples/*/src-tauri/gen
apps/examples/*/src-tauri/bin
# Tauri UI test snapshots
apps/*/src/tests/.tui-test
apps/*/src/tests/tui-traces
+4 -4
View File
@@ -6,10 +6,10 @@
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/apps/vscode",
"--extensionDevelopmentPath=${workspaceFolder}/apps/examples/vscode",
"--disable-extensions"
],
"outFiles": ["${workspaceFolder}/apps/vscode/dist/**/*.js"],
"outFiles": ["${workspaceFolder}/apps/examples/vscode/dist/**/*.js"],
"preLaunchTask": "build-vscode-extension"
},
{
@@ -17,10 +17,10 @@
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/apps/vscode",
"--extensionDevelopmentPath=${workspaceFolder}/apps/examples/vscode",
"--disable-extensions"
],
"outFiles": ["${workspaceFolder}/apps/vscode/dist/**/*.js"],
"outFiles": ["${workspaceFolder}/apps/examples/vscode/dist/**/*.js"],
"env": {
"VITE_DEV_SERVER_URL": "http://localhost:5173"
},
+3 -3
View File
@@ -21,7 +21,7 @@
"dependsOn": ["build-sdk"],
"problemMatcher": ["$tsc"],
"options": {
"cwd": "${workspaceFolder}/apps/vscode"
"cwd": "${workspaceFolder}/apps/examples/vscode"
}
},
{
@@ -44,7 +44,7 @@
}
},
"options": {
"cwd": "${workspaceFolder}/apps/vscode"
"cwd": "${workspaceFolder}/apps/examples/vscode"
}
},
{
@@ -66,7 +66,7 @@
}
},
"options": {
"cwd": "${workspaceFolder}/apps/vscode"
"cwd": "${workspaceFolder}/apps/examples/vscode"
}
},
{
+5 -4
View File
@@ -1,6 +1,6 @@
# Contributing to the Cline SDK
This document covers onboarding, development workflow, and publishing. For package boundaries and change routing during development, see [AGENTS.md](./AGENTS.md). For architecture and runtime flows, see [ARCHITECTURE.md](./ARCHITECTURE.md). For API details, see [DOC.md](./DOC.md).
This document covers onboarding, development workflow, and publishing. For package boundaries and change routing during development, see [AGENTS.md](./AGENTS.md). For architecture and runtime flows, see [ARCHITECTURE.md](./ARCHITECTURE.md).
This repo is a WIP framework for building and orchestrating AI agents. Full refactors are acceptable when they improve the architecture and all call sites are updated.
@@ -22,9 +22,10 @@ This repo is a WIP framework for building and orchestrating AI agents. Full refa
### Apps
- `apps/cli`: CLI host and local hub management
- `apps/code`: Tauri + Next.js desktop app
- `apps/vscode`: VS Code extension
- `apps/examples`: sample consumers and integration examples
- `apps/examples/desktop-app`: Tauri + Next.js desktop app example
- `apps/examples/vscode`: VS Code extension example
- `apps/examples/menubar`: hub notification menubar example
- `examples`: plugin, hook, and cron automation examples (customizations upon Cline SDK)
## Development Workflow
+7 -4
View File
@@ -73,13 +73,16 @@ async function handleMessage(threadId: string, message: string) {
}
```
Explore full working examples in [`apps/examples/`](apps/examples):
Explore full working examples in [`examples/`](examples) and app examples in [`apps/examples/`](apps/examples):
| Example | Description |
|---------|-------------|
| [Plugin](apps/examples/cline-plugin) | Custom tools with workspace-aware context, lifecycle hooks, and branch-level safety policies |
| [Subagent Orchestration](apps/examples/subagent-plugin) | Spawn and manage background agents with presets, skills, and cross-agent handoffs |
| [Slack Bot](apps/examples/slack-bot) | Production Slack bot with per-thread agent memory, OAuth, and slash commands |
| [Plugins](examples/plugins) | Custom tools with workspace-aware context, lifecycle hooks, and branch-level safety policies |
| [Subagent Orchestration](examples/plugins/subagent-plugin) | Spawn and manage background agents with presets, skills, and cross-agent handoffs |
| [Hooks](examples/hooks) | File-based and runtime hooks for logging, review gates, context injection, and lifecycle automation |
| [Cron Automations](examples/cron) | Recurring and event-driven automation specs for scheduled quality checks and PR workflows |
| [Desktop App](apps/examples/desktop-app) | Tauri desktop shell with a Bun sidecar backend and Next.js UI |
| [VS Code Extension App](apps/examples/vscode) | VS Code extension example that runs Cline sessions over the RPC runtime |
## Custom Tools
+1 -1
View File
@@ -266,7 +266,7 @@ describe("runDoctorCommand", () => {
return {
status: 0,
stdout:
"60123 /Users/example/dev/sdk/apps/code/src-tauri/bin/code-sidecar\n",
"60123 /Users/example/dev/sdk/apps/examples/desktop-app/src-tauri/bin/code-sidecar\n",
};
}
return { status: 1, stdout: "" };
+4
View File
@@ -159,6 +159,10 @@ function listStaleCliPids(): number[] {
function listStaleSidecarPids(): number[] {
const patterns = [
"/apps/examples/desktop-app/sidecar/index.ts",
"/apps/examples/desktop-app/dist/sidecar/index.js",
// Keep the pre-example-reorg paths so `doctor --fix` can still clean up
// stale sidecars that were launched from older checkouts.
"/apps/code/sidecar/index.ts",
"/apps/code/dist/sidecar/index.js",
"/src-tauri/bin/code-sidecar",
-21
View File
@@ -1,21 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"paths": {
"@/*": ["./*"],
"@cline/agents": ["../../packages/agents/src/index.ts"],
"@cline/core": ["../../packages/core/src/index.ts"],
"@cline/core/hub": ["../../packages/core/src/hub/index.ts"],
"@cline/llms": ["../../packages/llms/src/index.ts"],
"@cline/shared": ["../../packages/shared/src/index.ts"],
"@cline/shared/storage": ["../../packages/shared/src/storage/index.ts"],
"@cline/shared/db": ["../../packages/shared/src/db/index.ts"],
"@cline/shared/*": [
"../../packages/shared/src/*",
"../../packages/shared/src/*/index.ts"
]
}
},
"include": ["sidecar/**/*.ts", "scripts/**/*.ts", "global.d.ts", "bun.mts"],
"exclude": ["node_modules", "webview"]
}
@@ -1,10 +1,10 @@
# @cline/code
# Desktop App Example
Tauri desktop shell + Bun sidecar backend + Next.js UI for running and inspecting Cline chat sessions.
## Dev Commands
From `apps/code/`:
From `apps/examples/desktop-app/`:
- `bun run dev:web` - Next.js UI only (`http://localhost:3125`)
- `bun run dev:sidecar` - sidecar backend only
@@ -40,14 +40,13 @@ Desktop transport envelope:
## Key Files
- [`src-tauri/src/main.rs`](./apps/code/src-tauri/src/main.rs) - Tauri shell lifecycle, backend launch, and native-only commands
- [`sidecar/index.ts`](./apps/code/sidecar/index.ts) - persistent Bun sidecar backend
- [`sidecar/chat-session.ts`](./apps/code/sidecar/chat-session.ts) - in-process chat session runtime
- [`scripts/routine-schedules.ts`](./apps/code/scripts/routine-schedules.ts) - Routine action bridge for Settings > Routine
- [`lib/desktop-client.ts`](./apps/code/lib/desktop-client.ts) - typed desktop websocket client
- [`hooks/use-chat-session.ts`](./apps/code/hooks/use-chat-session.ts) - UI chat session state + backend subscriptions
- [`lib/chat-schema.ts`](./apps/code/lib/chat-schema.ts) - chat message schema used by the UI
- [`components/views/settings/routine-view.tsx`](./apps/code/components/views/settings/routine-view.tsx) - Routine schedules UI
- [`src-tauri/src/main.rs`](./src-tauri/src/main.rs) - Tauri shell lifecycle, backend launch, and native-only commands
- [`sidecar/index.ts`](./sidecar/index.ts) - persistent Bun sidecar backend
- [`sidecar/chat-session.ts`](./sidecar/chat-session.ts) - in-process chat session runtime
- [`webview/lib/desktop-client.ts`](./webview/lib/desktop-client.ts) - typed desktop websocket client
- [`webview/hooks/use-chat-session.ts`](./webview/hooks/use-chat-session.ts) - UI chat session state + backend subscriptions
- [`webview/lib/chat-schema.ts`](./webview/lib/chat-schema.ts) - chat message schema used by the UI
- [`webview/components/views/settings/routine-view.tsx`](./webview/components/views/settings/routine-view.tsx) - Routine schedules UI
## Data + Storage
@@ -55,7 +54,7 @@ Desktop transport envelope:
- Canonical replay/export artifact: `<sessionId>.messages.json`.
- `<sessionId>.messages.json` is expected to contain ordered messages plus assistant `modelInfo` and `metrics` (including cache token fields when provided by the model runtime).
- `<sessionId>.hooks.jsonl` is observability/debug telemetry and should not be required for normal history replay/export flows.
- Full v1 schema for the persisted messages file, including failure/retry semantics and golden fixtures, is documented in [`packages/core/docs/messages-contract-v1.md`](../../packages/core/docs/messages-contract-v1.md).
- Full v1 schema for the persisted messages file, including failure/retry semantics and golden fixtures, is documented in [`packages/core/docs/messages-contract-v1.md`](../../../packages/core/docs/messages-contract-v1.md).
## Troubleshooting
@@ -2,8 +2,7 @@ import { $ } from "bun";
const main = async () => {
await $`next build`.cwd("webview");
await $`mkdir -p dist/sidecar`;
await $`bun build ./sidecar/index.ts --outfile ./dist/sidecar/index.js --target bun`;
await $`bun run build:sidecar:bin`;
};
main().catch((error: unknown) => {
@@ -8,7 +8,7 @@
"dev": "tauri dev",
"build": "bun run bun.mts",
"build:sidecar": "mkdir -p dist/sidecar && bun build ./sidecar/index.ts --outfile ./dist/sidecar/index.js --target bun",
"build:sidecar:bin": "mkdir -p src-tauri/bin && bun build ./sidecar/index.ts --compile --outfile ./src-tauri/bin/code-sidecar",
"build:sidecar:bin": "bun run scripts/build-sidecar-bin.ts",
"build:binary": "tauri build",
"start": "next start webview",
"typecheck": "tsc -p tsconfig.dev.json --noEmit",
@@ -0,0 +1,32 @@
import { $ } from "bun";
const resolveTargetTriple = async (): Promise<string> => {
const fromEnv = process.env.TAURI_ENV_TARGET_TRIPLE ?? process.env.TARGET;
if (fromEnv?.trim()) {
return fromEnv.trim();
}
const rustcVersion = await $`rustc -vV`.text();
const hostLine = rustcVersion
.split("\n")
.find((line) => line.startsWith("host: "));
const host = hostLine?.slice("host: ".length).trim();
if (!host) {
throw new Error("failed to resolve Rust host target triple");
}
return host;
};
const main = async () => {
const targetTriple = await resolveTargetTriple();
const extension = targetTriple.includes("windows") ? ".exe" : "";
const outfile = `./src-tauri/bin/code-sidecar-${targetTriple}${extension}`;
await $`mkdir -p src-tauri/bin`;
await $`bun build ./sidecar/index.ts --compile --outfile ${outfile}`;
};
main().catch((error: unknown) => {
console.error(error);
process.exitCode = 1;
});

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 77 KiB

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Before

Width:  |  Height:  |  Size: 197 KiB

After

Width:  |  Height:  |  Size: 197 KiB

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

@@ -156,28 +156,44 @@ fn request_desktop_backend_shutdown(endpoint: &str) {
}
fn resolve_desktop_backend_script_path(context: &AppContext) -> Option<PathBuf> {
let launch_cwd = PathBuf::from(&context.launch_cwd);
let candidates = [
PathBuf::from(&context.workspace_root)
.join("apps")
.join("code")
.join("examples")
.join("desktop-app")
.join("sidecar")
.join("index.ts"),
PathBuf::from(&context.launch_cwd)
.join("sidecar")
.join("index.ts"),
PathBuf::from(&context.launch_cwd)
launch_cwd.join("sidecar").join("index.ts"),
launch_cwd
.parent()
.map(|parent| parent.join("sidecar").join("index.ts"))
.unwrap_or_else(|| PathBuf::from("")),
launch_cwd
.join("apps")
.join("code")
.join("examples")
.join("desktop-app")
.join("sidecar")
.join("index.ts"),
];
candidates.into_iter().find(|path| path.exists())
}
fn desktop_backend_binary_name() -> String {
let target_triple = option_env!("TAURI_ENV_TARGET_TRIPLE").unwrap_or("").trim();
if target_triple.is_empty() {
return "code-sidecar".to_string();
}
let extension = if cfg!(windows) { ".exe" } else { "" };
format!("code-sidecar-{target_triple}{extension}")
}
fn resolve_desktop_backend_binary_path(context: &AppContext) -> Option<PathBuf> {
if cfg!(debug_assertions) {
return None;
}
let binary_name = desktop_backend_binary_name();
let explicit = std::env::var("CLINE_CODE_SIDECAR_BIN")
.ok()
.map(|value| value.trim().to_string())
@@ -189,18 +205,19 @@ fn resolve_desktop_backend_binary_path(context: &AppContext) -> Option<PathBuf>
Some(
PathBuf::from(&context.workspace_root)
.join("apps")
.join("code")
.join("examples")
.join("desktop-app")
.join("src-tauri")
.join("bin")
.join("code-sidecar"),
.join(&binary_name),
),
current_exe
.as_ref()
.and_then(|path| path.parent().map(|parent| parent.join("code-sidecar"))),
.and_then(|path| path.parent().map(|parent| parent.join(&binary_name))),
current_exe.as_ref().and_then(|path| {
path.parent()
.and_then(|parent| parent.parent())
.map(|parent| parent.join("Resources").join("code-sidecar"))
.map(|parent| parent.join("Resources").join(&binary_name))
}),
];
candidates.into_iter().flatten().find(|path| path.exists())
@@ -4,7 +4,7 @@
"version": "0.1.0",
"identifier": "bot.cline.app",
"build": {
"beforeDevCommand": "bun run dev:web",
"beforeDevCommand": "bun run build:sidecar:bin && bun run dev:web",
"devUrl": "http://localhost:3125",
"beforeBuildCommand": "bun run build",
"frontendDist": "../webview/out"
@@ -26,6 +26,7 @@
"bundle": {
"active": true,
"targets": "all",
"externalBin": ["bin/code-sidecar"],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
@@ -1,10 +1,11 @@
{
"extends": "../tsconfig.json",
"extends": "./tsconfig.json",
"compilerOptions": {
"paths": {
"@/*": ["./*"],
"@cline/agents": ["../../../packages/agents/src/index.ts"],
"@cline/core": ["../../../packages/core/src/index.ts"],
"@cline/core/hub": ["../../../packages/core/src/hub/index.ts"],
"@cline/llms": ["../../../packages/llms/src/index.ts"],
"@cline/shared": ["../../../packages/shared/src/index.ts"],
"@cline/shared/storage": [
@@ -17,12 +18,6 @@
]
}
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
".next/dev/types/**/*.ts"
],
"exclude": ["node_modules"]
"include": ["sidecar/**/*.ts", "scripts/**/*.ts", "global.d.ts", "bun.mts"],
"exclude": ["node_modules", "webview"]
}
@@ -20,16 +20,18 @@
],
"paths": {
"@/*": ["./*"],
"@cline/agents": ["../../packages/agents/src/index.ts"],
"@cline/core": ["../../packages/core/src/index.ts"],
"@cline/core/hub": ["../../packages/core/src/hub/index.ts"],
"@cline/llms": ["../../packages/llms/src/index.ts"],
"@cline/shared": ["../../packages/shared/src/index.ts"],
"@cline/shared/storage": ["../../packages/shared/src/storage/index.ts"],
"@cline/shared/db": ["../../packages/shared/src/db/index.ts"],
"@cline/agents": ["../../../packages/agents/src/index.ts"],
"@cline/core": ["../../../packages/core/src/index.ts"],
"@cline/core/hub": ["../../../packages/core/src/hub/index.ts"],
"@cline/llms": ["../../../packages/llms/src/index.ts"],
"@cline/shared": ["../../../packages/shared/src/index.ts"],
"@cline/shared/storage": [
"../../../packages/shared/src/storage/index.ts"
],
"@cline/shared/db": ["../../../packages/shared/src/db/index.ts"],
"@cline/shared/*": [
"../../packages/shared/src/*",
"../../packages/shared/src/*/index.ts"
"../../../packages/shared/src/*",
"../../../packages/shared/src/*/index.ts"
]
}
},

Some files were not shown because too many files have changed in this diff Show More