mirror of
https://github.com/cline/cline.git
synced 2026-09-04 20:02:30 +08:00
Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4c266718da | |||
| 9390d3f933 | |||
| 5df470bf48 | |||
| 034c4342d1 | |||
| 349295ab2c | |||
| 841402c178 | |||
| e52a052c81 | |||
| 7a91a9be2e | |||
| 93a494d009 | |||
| 2bd21f8a45 | |||
| 2f33f71ebd | |||
| dec10aaec3 | |||
| c09705a45f | |||
| 73058c871a | |||
| 03211f1364 | |||
| 65e9727c65 | |||
| 884fbfb21e | |||
| 0c880c7bb1 | |||
| a915122c6d | |||
| 835ed94736 | |||
| 00ca3d13fa | |||
| 3f3a87aed9 | |||
| 7a0f11837e | |||
| 03d2d01eed | |||
| db1b1c45bd | |||
| a4131e57d8 | |||
| 683dd9a741 | |||
| 0d437f71b0 | |||
| fc77c0faea | |||
| 12c85c4233 | |||
| d6b7a1ab41 | |||
| 3926e7b404 | |||
| 5ba4314b9a | |||
| 9ccad7f764 | |||
| 3562f54dbf | |||
| d427d5d76a | |||
| 072e2887b0 | |||
| 9c71a6f021 | |||
| 7627a382aa | |||
| 978c633c90 | |||
| e807b520e0 | |||
| f3a3f30db5 | |||
| f1c7934064 | |||
| 1d42da5248 |
@@ -1,4 +1,6 @@
|
||||
demo.gif filter=lfs diff=lfs merge=lfs -text
|
||||
assets/docs/demo.gif filter=lfs diff=lfs merge=lfs -text
|
||||
webview-ui/src/assets/cline_kanban_demo.mp4 filter=lfs diff=lfs merge=lfs -text
|
||||
webview-ui/src/assets/cline_kanban_demo.webm filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
* text=auto eol=lf
|
||||
|
||||
@@ -91,3 +91,21 @@ jobs:
|
||||
echo ""
|
||||
echo "📦 Install with: npm install -g cline"
|
||||
echo "🔗 NPM: https://www.npmjs.com/package/cline/v/${{ steps.version.outputs.version }}"
|
||||
|
||||
- name: Post release to Slack
|
||||
uses: slackapi/slack-github-action@v3.0.1
|
||||
with:
|
||||
method: chat.postMessage
|
||||
token: ${{ secrets.SLACK_RELEASE_BOT_TOKEN }}
|
||||
payload: |
|
||||
channel: "C0APVKGGZFC"
|
||||
text: "Cline CLI v${{ steps.version.outputs.version }}"
|
||||
blocks:
|
||||
- type: "section"
|
||||
text:
|
||||
type: "mrkdwn"
|
||||
text: "*Cline CLI v${{ steps.version.outputs.version }}*"
|
||||
- type: "context"
|
||||
elements:
|
||||
- type: "mrkdwn"
|
||||
text: "<https://www.npmjs.com/package/cline/v/${{ steps.version.outputs.version }}|View on npm>"
|
||||
|
||||
@@ -24,6 +24,8 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
lfs: true
|
||||
|
||||
- name: Check for recent commits
|
||||
run: |
|
||||
@@ -49,6 +51,15 @@ jobs:
|
||||
- name: Install Publishing Tools
|
||||
run: npm install -g @vscode/vsce ovsx
|
||||
|
||||
- name: Verify LFS media assets are resolved
|
||||
run: |
|
||||
for FILE in webview-ui/src/assets/cline_kanban_demo.mp4 webview-ui/src/assets/cline_kanban_demo.webm; do
|
||||
if grep -q "git-lfs.github.com/spec/v1" "$FILE"; then
|
||||
echo "Error: $FILE is still a Git LFS pointer in CI checkout"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Publish Extension as Pre-release
|
||||
env:
|
||||
VSCE_PAT: ${{ secrets.VSCE_PAT }}
|
||||
|
||||
@@ -43,6 +43,7 @@ jobs:
|
||||
ref: main
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
lfs: true
|
||||
|
||||
- name: Resolve Release Tag
|
||||
id: resolve_tag
|
||||
@@ -133,6 +134,15 @@ jobs:
|
||||
fi
|
||||
echo "Tag and package version match: $TAG"
|
||||
|
||||
- name: Verify LFS media assets are resolved
|
||||
run: |
|
||||
for FILE in webview-ui/src/assets/cline_kanban_demo.mp4 webview-ui/src/assets/cline_kanban_demo.webm; do
|
||||
if grep -q "git-lfs.github.com/spec/v1" "$FILE"; then
|
||||
echo "Error: $FILE is still a Git LFS pointer in CI checkout"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Package and Publish Extension
|
||||
env:
|
||||
VSCE_PAT: ${{ secrets.VSCE_PAT }}
|
||||
@@ -187,3 +197,25 @@ jobs:
|
||||
prerelease: ${{ github.event.inputs.release-type == 'pre-release' }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Post release to Slack
|
||||
uses: slackapi/slack-github-action@v3.0.1
|
||||
with:
|
||||
method: chat.postMessage
|
||||
token: ${{ secrets.SLACK_RELEASE_BOT_TOKEN }}
|
||||
payload: |
|
||||
channel: "C0APVKGGZFC"
|
||||
text: "Cline ${{ steps.resolve_tag.outputs.tag }}"
|
||||
blocks:
|
||||
- type: "section"
|
||||
text:
|
||||
type: "mrkdwn"
|
||||
text: "*Cline ${{ steps.resolve_tag.outputs.tag }}*"
|
||||
- type: "section"
|
||||
text:
|
||||
type: "mrkdwn"
|
||||
text: ${{ toJSON(steps.changelog.outputs.content) }}
|
||||
- type: "context"
|
||||
elements:
|
||||
- type: "mrkdwn"
|
||||
text: "Full Changelog: https://github.com/${{ github.repository }}/compare/${{ steps.prev_tag.outputs.prev_tag }}...${{ steps.resolve_tag.outputs.tag }}"
|
||||
|
||||
+2
-1
@@ -3,7 +3,8 @@
|
||||
"ts"
|
||||
],
|
||||
"spec": [
|
||||
"src/**/__tests__/*.ts"
|
||||
"src/**/__tests__/*.ts",
|
||||
"src/test/services/**/*.test.ts"
|
||||
],
|
||||
"require": [
|
||||
"ts-node/register",
|
||||
|
||||
@@ -1,5 +1,33 @@
|
||||
# Changelog
|
||||
|
||||
## [3.77.0]
|
||||
|
||||
### Added
|
||||
|
||||
- Add "Lazy Teammate Mode" experimental toggle
|
||||
- `read_file` tool now supports chunked reading for targeted file access
|
||||
|
||||
### Fixed
|
||||
|
||||
- Exclude `new_task` tool from system prompt in yolo/headless mode
|
||||
- Fix Kanban demo video formatting
|
||||
|
||||
### Changed
|
||||
|
||||
- Polish `Notification` hook functionality
|
||||
|
||||
## [3.76.0]
|
||||
|
||||
### Added
|
||||
|
||||
- Add Cline Kanban launch modal in webview; CLI now launches Kanban by default with a migration view
|
||||
- Add toggle to disable feature tips in chat
|
||||
- Add repeated tool call loop detection to prevent infinite loops wasting tokens
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix CLI Kanban spawn on Windows by enabling shell mode for `npx.cmd`
|
||||
|
||||
## [3.75.0]
|
||||
|
||||
### Added
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 512 535">
|
||||
<!-- Generator: Adobe Illustrator 29.8.5, SVG Export Plug-In . SVG Version: 2.1.1 Build 2) -->
|
||||
<defs>
|
||||
<style>
|
||||
.st0 {
|
||||
fill: #fff;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<path class="st0" d="M500.6,300.5c-9-20.7-17.9-41.4-26.9-62.1-.7-2-.3-4.4-.3-6.4.4-9,1.1-18,1.4-27,2.8-28.4-6.5-58-25.2-79.6-15.1-18.1-36.6-30.7-59.6-35.5-8.1-1.8-16.6-1.6-25-2.1-10-.7-20-1-30-1.7,2-11.9,1-24.1-3.7-35.3-5.8-14.1-16.8-25.9-30.6-32.5-14.4-7-31.5-8.2-46.7-3.1-16,5.2-29.5,17-36.8,32.1-4.9,10-6.8,21.2-6.1,32.2-19.7-1-39.4-2.2-59.1-3.1-26.8.5-53,11.7-72,30.6-20.2,19.5-31.7,47-32.3,75-.5,9.3-1,18.7-1.5,28-.2,2.1,0,4.1-1.2,6-9.8,16.8-19.5,33.7-29.4,50.6-2.2,4.1-4.9,8-6.6,12.3-2,5.7-1.2,12.2,1.3,17.6,8.9,19.5,17.6,39.2,26.5,58.7.8,1.9,1.5,3.7,1.3,5.8-.6,10.3-1.1,20.7-1.7,31-1.5,21.2,3,42.6,13.5,61.1,8.8,15.8,21.6,29.4,37.1,38.9,13.9,8.7,29.7,13.9,46,15.4,72,3.9,144,7.7,216,11.5,20.1,1.8,40.8-2.8,58.5-12.5,18.8-10.1,34.2-26,44.1-44.9,6.5-12.6,10.5-26.4,11.7-40.5.7-12.4,1.2-24.7,2-37.1,0-3.3,1.9-5.5,3.3-8.2,6.6-11.8,13.5-23.4,20.1-35.2,3.7-6.9,8.1-13.4,11.6-20.4,3.2-6.1,3.2-13.5.3-19.7ZM218.5,316.5c-9.7,7.1-21.3,12.3-33.5,12.5-17.6,1-35.1-5.3-49-16-4.6-3.2-8.1-7.5-9.6-13,0-1.8-.7-3.6,1.7-3.8,4,1,7.9,2.6,12,3.5,22.8,5.6,47.6,5.9,71,4.8,6.5-.2,13-1.3,19.5-.9-2.7,5.6-7.1,9.2-12,12.9ZM276,449.7c-14,.5-28,.1-42-.2-2.1,0-4.3,0-6.4-.4-.9-2.1.6-3.2,1.7-4.8,4.8-5.9,11-11,18.7-12.4,8.4-1.6,16.5,1.2,23.5,5.5,4.7,3,9.2,6.3,12.6,10.8-2.6,1.1-5.3,1.4-8.1,1.4ZM390.4,319.4c-16.4,14.2-38.8,21.8-60.4,18.4-13.2-1.6-24.7-8.6-34.1-17.7-3-3-6.2-6.5-8.1-10.4.5-1,1.2-1.6,2.2-1.6,2.8-.2,5.7.7,8.5,1.1,16,2.9,32.3,4.9,48.5,5.5,14.3.4,28.2-.2,42.2-3.6,2.2-.6,3.7-.3,5.8.5-1.1,2.9-2.2,5.7-4.6,7.8Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
@@ -1,5 +1,19 @@
|
||||
# cline
|
||||
|
||||
## [2.12.0]
|
||||
|
||||
### Added
|
||||
|
||||
- `read_file` tool now supports chunked reading for targeted file access
|
||||
|
||||
### Fixed
|
||||
|
||||
- Exclude `new_task` tool from system prompt in yolo/headless mode
|
||||
|
||||
### Changed
|
||||
|
||||
- Polish `Notification` hook functionality
|
||||
|
||||
## [2.9.0]
|
||||
|
||||
### Added
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cline",
|
||||
"version": "2.9.0",
|
||||
"version": "2.13.0",
|
||||
"description": "Autonomous coding agent CLI - capable of creating/editing files, running commands, using the browser, and more",
|
||||
"main": "dist/lib.mjs",
|
||||
"types": "dist/lib.d.ts",
|
||||
|
||||
@@ -1492,13 +1492,12 @@ export const ChatView: React.FC<ChatViewProps> = ({
|
||||
if (item.type === "header") {
|
||||
// Show static robot frame in header (first frame, looking straight ahead)
|
||||
return (
|
||||
<Box flexDirection="column" key="header">
|
||||
<Box flexDirection="column" key="header" marginBottom={1}>
|
||||
<StaticRobotFrame />
|
||||
<Text> </Text>
|
||||
<Text bold color="white">
|
||||
{centerText("What can I do for you?")}
|
||||
</Text>
|
||||
<Text> </Text>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -56,7 +56,13 @@ export interface ObjectEditorState {
|
||||
editValue: string
|
||||
}
|
||||
|
||||
export const EXCLUDED_KEYS = new Set(["taskHistory", "primaryRootIndex", "welcomeViewCompleted", "isNewUser"])
|
||||
export const EXCLUDED_KEYS = new Set([
|
||||
"taskHistory",
|
||||
"primaryRootIndex",
|
||||
"welcomeViewCompleted",
|
||||
"isNewUser",
|
||||
"cliKanbanMigrationAnnouncementShown",
|
||||
])
|
||||
|
||||
export const EDITABLE_TYPES: Set<ValueType> = new Set(["string", "number", "boolean", "object"])
|
||||
export const MAX_VISIBLE = 12
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
/**
|
||||
* Rotating feature tips shown during thinking/acting phases.
|
||||
* Appears after a brief delay and cycles through tips to educate users
|
||||
* about Cline features while they wait.
|
||||
*/
|
||||
|
||||
import { Box, Text } from "ink"
|
||||
import React, { useCallback, useEffect, useRef, useState } from "react"
|
||||
|
||||
interface FeatureTipItem {
|
||||
text: string
|
||||
}
|
||||
|
||||
const FEATURE_TIPS: FeatureTipItem[] = [
|
||||
{
|
||||
text: 'Enable "Double-Check Completion" in settings to have Cline verify its work before finishing a task.',
|
||||
},
|
||||
{
|
||||
text: "Add a .clinerules file to your project root to give Cline project-specific instructions.",
|
||||
},
|
||||
{
|
||||
text: "Press Tab to switch between Plan and Act mode — plan an approach before Cline takes action.",
|
||||
},
|
||||
{
|
||||
text: "Use @ in the chat input to add files, folders, or URLs as context for your task.",
|
||||
},
|
||||
{
|
||||
text: "Set up MCP Servers to give Cline access to external tools and APIs.",
|
||||
},
|
||||
{
|
||||
text: "Cline creates checkpoints after changes — you can always restore to a previous state.",
|
||||
},
|
||||
{
|
||||
text: "Use /compact to condense long conversations and free up context window space.",
|
||||
},
|
||||
{
|
||||
text: "Enable auto-approve for read-only tools like file reads to speed up exploration.",
|
||||
},
|
||||
{
|
||||
text: "Use /settings to configure your API provider and model without leaving the terminal.",
|
||||
},
|
||||
{
|
||||
text: "You can pass images with --images flag or paste image file paths in the chat.",
|
||||
},
|
||||
{
|
||||
text: "Cline can browse websites — ask it to test your local dev server in the browser.",
|
||||
},
|
||||
{
|
||||
text: "Use /reportbug to quickly file a GitHub issue with diagnostic context included.",
|
||||
},
|
||||
{
|
||||
text: "Try 'npm i -g cline' to manage tasks on a Kankan board — orchestrate coding agents across worktrees.",
|
||||
},
|
||||
{
|
||||
text: "Use Shift+Tab to toggle auto-approve all — let Cline work uninterrupted on trusted tasks.",
|
||||
},
|
||||
{
|
||||
text: "Press Up/Down arrows in an empty input to browse your previous task prompts.",
|
||||
},
|
||||
{
|
||||
text: "Type / to see all available commands — /history, /compact, /settings, and more.",
|
||||
},
|
||||
{
|
||||
text: "Use /skills to browse and attach reusable skill files that guide Cline's behavior.",
|
||||
},
|
||||
{
|
||||
text: 'You can disable these tips in /settings → Features → "Feature tips".',
|
||||
},
|
||||
]
|
||||
|
||||
const SHOW_DELAY_MS = 2000
|
||||
const CYCLE_INTERVAL_MS = 8000
|
||||
|
||||
/**
|
||||
* Shows rotating feature tips below the thinking indicator.
|
||||
* Appears after a brief delay and cycles through tips while Cline is thinking/acting.
|
||||
*/
|
||||
export const FeatureTip: React.FC = React.memo(() => {
|
||||
const [isVisible, setIsVisible] = useState(false)
|
||||
const [tipIndex, setTipIndex] = useState(Math.floor(Math.random() * FEATURE_TIPS.length))
|
||||
const cycleTimerRef = useRef<ReturnType<typeof setInterval> | null>(null)
|
||||
const showTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
||||
|
||||
const currentTip = FEATURE_TIPS[tipIndex]
|
||||
|
||||
const advanceTip = useCallback(() => {
|
||||
setTipIndex((prev) => (prev + 1) % FEATURE_TIPS.length)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
showTimerRef.current = setTimeout(() => {
|
||||
setIsVisible(true)
|
||||
cycleTimerRef.current = setInterval(advanceTip, CYCLE_INTERVAL_MS)
|
||||
}, SHOW_DELAY_MS)
|
||||
|
||||
return () => {
|
||||
if (showTimerRef.current) {
|
||||
clearTimeout(showTimerRef.current)
|
||||
}
|
||||
if (cycleTimerRef.current) {
|
||||
clearInterval(cycleTimerRef.current)
|
||||
}
|
||||
}
|
||||
}, [advanceTip])
|
||||
|
||||
if (!isVisible) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<Box paddingLeft={1}>
|
||||
<Text color="gray">
|
||||
💡 <Text bold>Tip:</Text> {currentTip.text}
|
||||
</Text>
|
||||
</Box>
|
||||
)
|
||||
})
|
||||
@@ -0,0 +1,27 @@
|
||||
import { render } from "ink-testing-library"
|
||||
import { createElement } from "react"
|
||||
import { describe, expect, it, vi } from "vitest"
|
||||
import { KanbanMigrationView } from "./KanbanMigrationView"
|
||||
|
||||
describe("KanbanMigrationView", () => {
|
||||
it("renders the migration options", () => {
|
||||
const onSelect = vi.fn()
|
||||
const { lastFrame } = render(createElement(KanbanMigrationView, { isRawModeSupported: true, onSelect }))
|
||||
|
||||
expect(lastFrame()).toContain("Introducing Cline Kanban!")
|
||||
expect(lastFrame()).toContain("Open the new experience")
|
||||
expect(lastFrame()).toContain("Launch Cline Kanban and start there by default.")
|
||||
expect(lastFrame()).toContain("cline --tui")
|
||||
expect(lastFrame()).toContain("You can always run cline --tui for the terminal experience.")
|
||||
expect(lastFrame()).toContain("Exit")
|
||||
})
|
||||
|
||||
it("selects the highlighted option with Enter", () => {
|
||||
const onSelect = vi.fn()
|
||||
const { stdin } = render(createElement(KanbanMigrationView, { isRawModeSupported: true, onSelect }))
|
||||
|
||||
stdin.write("\r")
|
||||
|
||||
expect(onSelect).toHaveBeenCalledWith("kanban")
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,95 @@
|
||||
import { Box, Text, useApp, useInput } from "ink"
|
||||
import React, { useMemo, useState } from "react"
|
||||
import { COLORS } from "../constants/colors"
|
||||
import { StdinProvider, useStdinContext } from "../context/StdinContext"
|
||||
import { isEnterKey } from "../utils/input"
|
||||
import { type KanbanMigrationAction } from "../utils/kanban"
|
||||
import { StaticRobotFrame } from "./AsciiMotionCli"
|
||||
import { ErrorBoundary } from "./ErrorBoundary"
|
||||
|
||||
interface KanbanMigrationViewProps {
|
||||
isRawModeSupported: boolean
|
||||
onSelect: (action: KanbanMigrationAction) => void
|
||||
}
|
||||
|
||||
interface MigrationMenuItem {
|
||||
label: string
|
||||
description: string
|
||||
value: KanbanMigrationAction
|
||||
}
|
||||
|
||||
const InternalKanbanMigrationView: React.FC<Pick<KanbanMigrationViewProps, "onSelect">> = ({ onSelect }) => {
|
||||
const { exit } = useApp()
|
||||
const { isRawModeSupported } = useStdinContext()
|
||||
const items = useMemo<MigrationMenuItem[]>(
|
||||
() => [
|
||||
{
|
||||
label: "Open the new experience",
|
||||
description: "Launch Cline Kanban and start there by default.",
|
||||
value: "kanban",
|
||||
},
|
||||
{
|
||||
label: "Exit",
|
||||
description: "You can always run cline --tui for the terminal experience.",
|
||||
value: "exit",
|
||||
},
|
||||
],
|
||||
[],
|
||||
)
|
||||
const [selectedIndex, setSelectedIndex] = useState(0)
|
||||
|
||||
useInput(
|
||||
(input, key) => {
|
||||
if (key.escape) {
|
||||
onSelect("exit")
|
||||
exit()
|
||||
} else if (key.upArrow) {
|
||||
setSelectedIndex((prev) => (prev > 0 ? prev - 1 : items.length - 1))
|
||||
} else if (key.downArrow) {
|
||||
setSelectedIndex((prev) => (prev < items.length - 1 ? prev + 1 : 0))
|
||||
} else if (isEnterKey(input, key)) {
|
||||
onSelect(items[selectedIndex].value)
|
||||
exit()
|
||||
}
|
||||
},
|
||||
{ isActive: isRawModeSupported },
|
||||
)
|
||||
|
||||
return (
|
||||
<Box flexDirection="column" width="100%">
|
||||
<StaticRobotFrame />
|
||||
<Text> </Text>
|
||||
<Text bold color="white">
|
||||
Introducing Cline Kanban!
|
||||
</Text>
|
||||
<Text color="gray">A board for orchestrating coding agents across worktrees, right from your browser.</Text>
|
||||
<Text> </Text>
|
||||
{items.map((item, index) => {
|
||||
const isSelected = index === selectedIndex
|
||||
return (
|
||||
<Box flexDirection="column" key={item.value} marginBottom={1}>
|
||||
<Text color={isSelected ? COLORS.primaryBlue : undefined}>
|
||||
{isSelected ? "❯ " : " "}
|
||||
{item.label}
|
||||
</Text>
|
||||
<Text color="gray"> {item.description}</Text>
|
||||
</Box>
|
||||
)
|
||||
})}
|
||||
<Text> </Text>
|
||||
<Text color="gray">Use arrow keys to navigate, Enter to select, Esc or Ctrl+C to exit</Text>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
export const KanbanMigrationView: React.FC<KanbanMigrationViewProps> = ({ isRawModeSupported, onSelect }) => {
|
||||
const { exit } = useApp()
|
||||
|
||||
return (
|
||||
<ErrorBoundary exit={exit}>
|
||||
<StdinProvider isRawModeSupported={isRawModeSupported}>
|
||||
<InternalKanbanMigrationView onSelect={onSelect} />
|
||||
</StdinProvider>
|
||||
</ErrorBoundary>
|
||||
)
|
||||
}
|
||||
@@ -129,6 +129,12 @@ const FEATURE_SETTINGS = {
|
||||
label: "Double-check completion",
|
||||
description: "Reject first completion attempt and require re-verification",
|
||||
},
|
||||
showFeatureTips: {
|
||||
stateKey: "showFeatureTips",
|
||||
default: true,
|
||||
label: "Feature tips",
|
||||
description: "Show tips during thinking phases",
|
||||
},
|
||||
} as const
|
||||
|
||||
type FeatureKey = keyof typeof FEATURE_SETTINGS
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
|
||||
import { Box, Text, useInput } from "ink"
|
||||
import React, { useEffect, useMemo, useState } from "react"
|
||||
import { StateManager } from "@/core/storage/StateManager"
|
||||
import { COLORS } from "../constants/colors"
|
||||
import { FeatureTip } from "./FeatureTip"
|
||||
|
||||
interface ThinkingIndicatorProps {
|
||||
mode?: "act" | "plan"
|
||||
@@ -52,6 +54,7 @@ const ShimmerText: React.FC<{ text: string; color: string; shimmerPos: number }>
|
||||
}
|
||||
|
||||
export const ThinkingIndicator: React.FC<ThinkingIndicatorProps> = ({ mode = "act", startTime, onCancel }) => {
|
||||
const showFeatureTips = StateManager.get().getGlobalSettingsKey("showFeatureTips") ?? true
|
||||
const message = mode === "plan" ? "Planning" : "Acting"
|
||||
const color = mode === "plan" ? "yellow" : COLORS.primaryBlue
|
||||
|
||||
@@ -118,9 +121,12 @@ export const ThinkingIndicator: React.FC<ThinkingIndicatorProps> = ({ mode = "ac
|
||||
}, [startTime, elapsedMs])
|
||||
|
||||
return (
|
||||
<Box paddingLeft={1}>
|
||||
<ShimmerText color={color} shimmerPos={shimmerPos} text={fullText} />
|
||||
{elapsedStr && <Text color="gray"> ({elapsedStr} · esc to interrupt)</Text>}
|
||||
<Box flexDirection="column">
|
||||
<Box paddingLeft={1}>
|
||||
<ShimmerText color={color} shimmerPos={shimmerPos} text={fullText} />
|
||||
{elapsedStr && <Text color="gray"> ({elapsedStr} · esc to interrupt)</Text>}
|
||||
</Box>
|
||||
{showFeatureTips && <FeatureTip />}
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,333 +0,0 @@
|
||||
/**
|
||||
* Welcome view component
|
||||
* Shows an interactive prompt when user starts cline without a command
|
||||
* Supports file mentions with @
|
||||
*/
|
||||
|
||||
import { Box, Text, useInput } from "ink"
|
||||
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react"
|
||||
import { StateManager } from "@/core/storage/StateManager"
|
||||
import type { ApiProvider } from "@/shared/api"
|
||||
import { getProviderDefaultModelId, getProviderModelIdKey, Mode, SettingsKey } from "@/shared/storage"
|
||||
import { useStdinContext } from "../context/StdinContext"
|
||||
import {
|
||||
checkAndWarnRipgrepMissing,
|
||||
extractMentionQuery,
|
||||
type FileSearchResult,
|
||||
getRipgrepInstallInstructions,
|
||||
insertMention,
|
||||
searchWorkspaceFiles,
|
||||
} from "../utils/file-search"
|
||||
import { isMouseEscapeSequence } from "../utils/input"
|
||||
import { parseImagesFromInput } from "../utils/parser"
|
||||
import { AccountInfoView } from "./AccountInfoView"
|
||||
import { FileMentionMenu } from "./FileMentionMenu"
|
||||
|
||||
interface WelcomeViewProps {
|
||||
onSubmit: (prompt: string, imagePaths: string[]) => void
|
||||
onExit?: () => void
|
||||
controller?: any
|
||||
}
|
||||
|
||||
// ASCII art Cline logo
|
||||
const CLINE_LOGO = [
|
||||
" ::::::: ",
|
||||
" ::::::::: ",
|
||||
" ::::::::::::::::: ",
|
||||
" ::::::::::::::::::::::: ",
|
||||
" ::::::::::::::::::::::::: ",
|
||||
" ::::::::::::::::::::::::::: ",
|
||||
" ::::::: ::::::: ::::::: ",
|
||||
" ::::::: ::::: ::::::: ",
|
||||
":::::::: ::::: ::::::::",
|
||||
":::::::: ::::: ::::::::",
|
||||
" ::::::: ::::: ::::::: ",
|
||||
" ::::::: ::::::: ::::::: ",
|
||||
" ::::::::::::::::::::::::::: ",
|
||||
" ::::::::::::::::::::::::: ",
|
||||
" ::::::::::::::::::::::: ",
|
||||
" :::::::::::::::: ",
|
||||
]
|
||||
|
||||
const SEARCH_DEBOUNCE_MS = 150
|
||||
const RIPGREP_WARNING_DURATION_MS = 5000
|
||||
const MAX_SEARCH_RESULTS = 15
|
||||
|
||||
export const WelcomeView: React.FC<WelcomeViewProps> = ({ onSubmit, onExit, controller }) => {
|
||||
const { isRawModeSupported } = useStdinContext()
|
||||
const [textInput, setTextInput] = useState("")
|
||||
const [fileResults, setFileResults] = useState<FileSearchResult[]>([])
|
||||
const [selectedIndex, setSelectedIndex] = useState(0)
|
||||
const [isSearching, setIsSearching] = useState(false)
|
||||
const [showRipgrepWarning, setShowRipgrepWarning] = useState(false)
|
||||
const [escPressedOnce, setEscPressedOnce] = useState(false)
|
||||
const [mode, setMode] = useState<Mode>(() => {
|
||||
const stateManager = StateManager.get()
|
||||
return stateManager.getGlobalSettingsKey("mode") || "act"
|
||||
})
|
||||
|
||||
const provider = useMemo(() => {
|
||||
const stateManager = StateManager.get()
|
||||
const mode = stateManager.getGlobalSettingsKey("mode") as string
|
||||
const providerKey = mode === "act" ? "actModeApiProvider" : "planModeApiProvider"
|
||||
const currentProvider = stateManager.getGlobalSettingsKey(providerKey) as string
|
||||
return currentProvider || "cline"
|
||||
}, [controller])
|
||||
|
||||
// Get model ID based on current mode and provider
|
||||
// Different providers use different state keys (e.g., cline uses actModeOpenRouterModelId)
|
||||
const modelId = useMemo(() => {
|
||||
const stateManager = StateManager.get()
|
||||
const modelKey = getProviderModelIdKey(provider as ApiProvider, mode)
|
||||
return (
|
||||
(stateManager.getGlobalSettingsKey(modelKey as SettingsKey) as string) ||
|
||||
getProviderDefaultModelId(provider as ApiProvider)
|
||||
)
|
||||
}, [mode, provider])
|
||||
|
||||
const toggleMode = useCallback(() => {
|
||||
const newMode: Mode = mode === "act" ? "plan" : "act"
|
||||
setMode(newMode)
|
||||
const stateManager = StateManager.get()
|
||||
stateManager.setGlobalState("mode", newMode)
|
||||
}, [mode])
|
||||
|
||||
const refs = useRef({
|
||||
searchTimeout: null as NodeJS.Timeout | null,
|
||||
lastQuery: "",
|
||||
hasCheckedRipgrep: false,
|
||||
})
|
||||
|
||||
const { prompt, imagePaths } = parseImagesFromInput(textInput)
|
||||
|
||||
const mentionInfo = useMemo(() => extractMentionQuery(textInput), [textInput])
|
||||
|
||||
const workspacePath = useMemo(() => {
|
||||
try {
|
||||
const root = controller?.getWorkspaceManagerSync?.()?.getPrimaryRoot?.()
|
||||
if (root?.path) {
|
||||
return root.path
|
||||
}
|
||||
} catch {
|
||||
// Fallback to cwd
|
||||
}
|
||||
return process.cwd()
|
||||
}, [controller])
|
||||
|
||||
// Search for files when in mention mode
|
||||
useEffect(() => {
|
||||
const { current: r } = refs
|
||||
|
||||
if (!mentionInfo.inMentionMode) {
|
||||
setFileResults([])
|
||||
setSelectedIndex(0)
|
||||
if (r.searchTimeout) {
|
||||
clearTimeout(r.searchTimeout)
|
||||
r.searchTimeout = null
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Check for ripgrep on first mention trigger
|
||||
if (!r.hasCheckedRipgrep) {
|
||||
r.hasCheckedRipgrep = true
|
||||
if (checkAndWarnRipgrepMissing()) {
|
||||
setShowRipgrepWarning(true)
|
||||
setTimeout(() => setShowRipgrepWarning(false), RIPGREP_WARNING_DURATION_MS)
|
||||
}
|
||||
}
|
||||
|
||||
const { query } = mentionInfo
|
||||
if (query === r.lastQuery) {
|
||||
return
|
||||
}
|
||||
r.lastQuery = query
|
||||
|
||||
if (r.searchTimeout) {
|
||||
clearTimeout(r.searchTimeout)
|
||||
}
|
||||
setIsSearching(true)
|
||||
|
||||
r.searchTimeout = setTimeout(async () => {
|
||||
try {
|
||||
const results = await searchWorkspaceFiles(query, workspacePath, MAX_SEARCH_RESULTS)
|
||||
setFileResults(results)
|
||||
setSelectedIndex(0)
|
||||
} catch {
|
||||
setFileResults([])
|
||||
} finally {
|
||||
setIsSearching(false)
|
||||
}
|
||||
}, SEARCH_DEBOUNCE_MS)
|
||||
|
||||
return () => {
|
||||
if (r.searchTimeout) {
|
||||
clearTimeout(r.searchTimeout)
|
||||
}
|
||||
}
|
||||
}, [mentionInfo.inMentionMode, mentionInfo.query, workspacePath])
|
||||
|
||||
useInput(
|
||||
(input, key) => {
|
||||
// Filter out mouse escape sequences
|
||||
if (isMouseEscapeSequence(input)) {
|
||||
return
|
||||
}
|
||||
|
||||
const inMenu = mentionInfo.inMentionMode && fileResults.length > 0
|
||||
|
||||
// Menu navigation
|
||||
if (inMenu) {
|
||||
if (key.upArrow) {
|
||||
setSelectedIndex((i) => (i > 0 ? i - 1 : fileResults.length - 1))
|
||||
return
|
||||
}
|
||||
if (key.downArrow) {
|
||||
setSelectedIndex((i) => (i < fileResults.length - 1 ? i + 1 : 0))
|
||||
return
|
||||
}
|
||||
if (key.tab || key.return) {
|
||||
const file = fileResults[selectedIndex]
|
||||
if (file) {
|
||||
setTextInput(insertMention(textInput, mentionInfo.atIndex, file.path))
|
||||
setFileResults([])
|
||||
setSelectedIndex(0)
|
||||
}
|
||||
return
|
||||
}
|
||||
if (key.escape) {
|
||||
setFileResults([])
|
||||
setSelectedIndex(0)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Normal input handling
|
||||
if (key.tab && !mentionInfo.inMentionMode) {
|
||||
toggleMode()
|
||||
return
|
||||
}
|
||||
if (key.return && !mentionInfo.inMentionMode) {
|
||||
if (prompt.trim() || imagePaths.length > 0) {
|
||||
onSubmit(prompt.trim(), imagePaths)
|
||||
}
|
||||
return
|
||||
}
|
||||
if (key.escape && !mentionInfo.inMentionMode) {
|
||||
if (escPressedOnce) {
|
||||
onExit?.()
|
||||
} else {
|
||||
setEscPressedOnce(true)
|
||||
}
|
||||
return
|
||||
}
|
||||
if (key.backspace || key.delete) {
|
||||
setTextInput((prev) => prev.slice(0, -1))
|
||||
setEscPressedOnce(false)
|
||||
return
|
||||
}
|
||||
if (input && !key.ctrl && !key.meta && !key.upArrow && !key.downArrow && !key.tab) {
|
||||
setTextInput((prev) => prev + input)
|
||||
setEscPressedOnce(false)
|
||||
}
|
||||
},
|
||||
{ isActive: isRawModeSupported },
|
||||
)
|
||||
|
||||
const borderColor = mode === "act" ? "blue" : "yellow"
|
||||
|
||||
return (
|
||||
<Box flexDirection="column" width="100%">
|
||||
{/* Account/Provider info at top */}
|
||||
{controller && (
|
||||
<Box marginBottom={1}>
|
||||
<AccountInfoView controller={controller} />
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{/* Cline logo - centered */}
|
||||
<Box alignItems="center" flexDirection="column">
|
||||
{CLINE_LOGO.map((line, idx) => (
|
||||
// biome-ignore lint/suspicious/noArrayIndexKey: static array that never changes
|
||||
<Text color="white" key={idx}>
|
||||
{line}
|
||||
</Text>
|
||||
))}
|
||||
</Box>
|
||||
|
||||
{/* Main prompt - centered, bold */}
|
||||
<Box justifyContent="center" marginTop={1}>
|
||||
<Text bold color="white">
|
||||
What can I do for you?
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
{/* Ripgrep warning if needed */}
|
||||
{showRipgrepWarning && (
|
||||
<Box marginTop={1}>
|
||||
<Text color="yellow">⚠ ripgrep not found - file search will be slower. </Text>
|
||||
<Text color="gray">Install: {getRipgrepInstallInstructions()}</Text>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{/* Input field with border */}
|
||||
<Box
|
||||
borderColor={borderColor}
|
||||
borderStyle="round"
|
||||
flexDirection="row"
|
||||
marginTop={1}
|
||||
paddingLeft={1}
|
||||
paddingRight={1}
|
||||
width="100%">
|
||||
<Text>{textInput}</Text>
|
||||
<Text inverse> </Text>
|
||||
</Box>
|
||||
|
||||
{/* Model ID and Mode toggle row */}
|
||||
<Box justifyContent="space-between" width="100%">
|
||||
{/* Model ID on left */}
|
||||
<Text color="gray">{modelId}</Text>
|
||||
|
||||
{/* Mode toggle on right */}
|
||||
<Box gap={1}>
|
||||
<Box>
|
||||
<Text bold={mode === "plan"} color={mode === "plan" ? "yellow" : "gray"}>
|
||||
{mode === "plan" ? "●" : "○"} Plan
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text bold={mode === "act"} color={mode === "act" ? "blue" : "gray"}>
|
||||
{mode === "act" ? "●" : "○"} Act
|
||||
</Text>
|
||||
</Box>
|
||||
<Text color="gray">(Tab)</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
{/* File mention menu - below input */}
|
||||
{mentionInfo.inMentionMode && (
|
||||
<FileMentionMenu
|
||||
isLoading={isSearching}
|
||||
query={mentionInfo.query}
|
||||
results={fileResults}
|
||||
selectedIndex={selectedIndex}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Attached images */}
|
||||
{imagePaths.length > 0 && (
|
||||
<Text color="magenta">
|
||||
📎 {imagePaths.length} image{imagePaths.length > 1 ? "s" : ""} attached
|
||||
</Text>
|
||||
)}
|
||||
|
||||
{/* Help text */}
|
||||
<Box>
|
||||
<Text color="gray">Enter to submit · @ to mention files · </Text>
|
||||
<Text bold={escPressedOnce} color={escPressedOnce ? "white" : "gray"}>
|
||||
{escPressedOnce ? "Press Esc again to exit" : "Esc to exit"}
|
||||
</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
+83
-36
@@ -11,6 +11,22 @@ import { captureUnhandledException } from "."
|
||||
describe("CLI Commands", () => {
|
||||
let program: Command
|
||||
|
||||
function getCommand(name: string): Command {
|
||||
const command = program.commands.find((candidate) => candidate.name() === name)
|
||||
if (!command) {
|
||||
throw new Error(`Missing command: ${name}`)
|
||||
}
|
||||
return command
|
||||
}
|
||||
|
||||
function getSubcommand(commandName: string, subcommandName: string): Command {
|
||||
const subcommand = getCommand(commandName).commands.find((candidate) => candidate.name() === subcommandName)
|
||||
if (!subcommand) {
|
||||
throw new Error(`Missing subcommand: ${commandName} ${subcommandName}`)
|
||||
}
|
||||
return subcommand
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
// Create a fresh program instance for each test
|
||||
program = new Command()
|
||||
@@ -80,7 +96,13 @@ describe("CLI Commands", () => {
|
||||
|
||||
program
|
||||
.command("kanban")
|
||||
.description("Run npx kanban@latest --agent cline")
|
||||
.description("Run kanban")
|
||||
.action(() => {})
|
||||
|
||||
program
|
||||
.command("update")
|
||||
.description("Check for updates and install if available")
|
||||
.option("-v, --verbose", "Show verbose output")
|
||||
.action(() => {})
|
||||
|
||||
// Default command for interactive mode
|
||||
@@ -97,7 +119,9 @@ describe("CLI Commands", () => {
|
||||
.option("--auto-condense", "Enable AI-powered context compaction instead of mechanical truncation")
|
||||
.option("--hooks-dir <path>", "Additional hooks directory")
|
||||
.option("--auto-approve-all", "Enable auto-approve all")
|
||||
.option("--kanban", "Run npx kanban@latest --agent cline")
|
||||
.option("--update", "Check for updates and install if available")
|
||||
.option("--kanban", "Run kanban")
|
||||
.option("--tui", "Open the legacy terminal UI instead of the kanban experience")
|
||||
.action(() => {})
|
||||
})
|
||||
|
||||
@@ -114,119 +138,119 @@ describe("CLI Commands", () => {
|
||||
})
|
||||
|
||||
it("should parse --act flag", () => {
|
||||
const taskCmd = program.commands.find((c) => c.name() === "task")!
|
||||
const taskCmd = getCommand("task")
|
||||
const args = ["test prompt", "--act"]
|
||||
taskCmd.parse(args, { from: "user" })
|
||||
expect(taskCmd.opts().act).toBe(true)
|
||||
})
|
||||
|
||||
it("should parse --plan flag", () => {
|
||||
const taskCmd = program.commands.find((c) => c.name() === "task")!
|
||||
const taskCmd = getCommand("task")
|
||||
const args = ["test prompt", "--plan"]
|
||||
taskCmd.parse(args, { from: "user" })
|
||||
expect(taskCmd.opts().plan).toBe(true)
|
||||
})
|
||||
|
||||
it("should parse --yolo flag", () => {
|
||||
const taskCmd = program.commands.find((c) => c.name() === "task")!
|
||||
const taskCmd = getCommand("task")
|
||||
const args = ["test prompt", "--yolo"]
|
||||
taskCmd.parse(args, { from: "user" })
|
||||
expect(taskCmd.opts().yolo).toBe(true)
|
||||
})
|
||||
|
||||
it("should parse --auto-approve-all flag", () => {
|
||||
const taskCmd = program.commands.find((c) => c.name() === "task")!
|
||||
const taskCmd = getCommand("task")
|
||||
const args = ["test prompt", "--auto-approve-all"]
|
||||
taskCmd.parse(args, { from: "user" })
|
||||
expect(taskCmd.opts().autoApproveAll).toBe(true)
|
||||
})
|
||||
|
||||
it("should parse --model option", () => {
|
||||
const taskCmd = program.commands.find((c) => c.name() === "task")!
|
||||
const taskCmd = getCommand("task")
|
||||
const args = ["test prompt", "--model", "claude-sonnet-4-20250514"]
|
||||
taskCmd.parse(args, { from: "user" })
|
||||
expect(taskCmd.opts().model).toBe("claude-sonnet-4-20250514")
|
||||
})
|
||||
|
||||
it("should parse --images option with multiple paths", () => {
|
||||
const taskCmd = program.commands.find((c) => c.name() === "task")!
|
||||
const taskCmd = getCommand("task")
|
||||
const args = ["test prompt", "--images", "/path/to/img1.png", "/path/to/img2.jpg"]
|
||||
taskCmd.parse(args, { from: "user" })
|
||||
expect(taskCmd.opts().images).toEqual(["/path/to/img1.png", "/path/to/img2.jpg"])
|
||||
})
|
||||
|
||||
it("should parse --verbose flag", () => {
|
||||
const taskCmd = program.commands.find((c) => c.name() === "task")!
|
||||
const taskCmd = getCommand("task")
|
||||
const args = ["test prompt", "--verbose"]
|
||||
taskCmd.parse(args, { from: "user" })
|
||||
expect(taskCmd.opts().verbose).toBe(true)
|
||||
})
|
||||
|
||||
it("should parse --cwd option", () => {
|
||||
const taskCmd = program.commands.find((c) => c.name() === "task")!
|
||||
const taskCmd = getCommand("task")
|
||||
const args = ["test prompt", "--cwd", "/some/path"]
|
||||
taskCmd.parse(args, { from: "user" })
|
||||
expect(taskCmd.opts().cwd).toBe("/some/path")
|
||||
})
|
||||
|
||||
it("should parse --config option", () => {
|
||||
const taskCmd = program.commands.find((c) => c.name() === "task")!
|
||||
const taskCmd = getCommand("task")
|
||||
const args = ["test prompt", "--config", "/custom/config"]
|
||||
taskCmd.parse(args, { from: "user" })
|
||||
expect(taskCmd.opts().config).toBe("/custom/config")
|
||||
})
|
||||
|
||||
it("should parse --thinking flag", () => {
|
||||
const taskCmd = program.commands.find((c) => c.name() === "task")!
|
||||
const taskCmd = getCommand("task")
|
||||
const args = ["test prompt", "--thinking"]
|
||||
taskCmd.parse(args, { from: "user" })
|
||||
expect(taskCmd.opts().thinking).toBe(true)
|
||||
})
|
||||
|
||||
it("should parse --thinking with token budget", () => {
|
||||
const taskCmd = program.commands.find((c) => c.name() === "task")!
|
||||
const taskCmd = getCommand("task")
|
||||
const args = ["test prompt", "--thinking", "8000"]
|
||||
taskCmd.parse(args, { from: "user" })
|
||||
expect(taskCmd.opts().thinking).toBe("8000")
|
||||
})
|
||||
|
||||
it("should parse --reasoning-effort option", () => {
|
||||
const taskCmd = program.commands.find((c) => c.name() === "task")!
|
||||
const taskCmd = getCommand("task")
|
||||
const args = ["test prompt", "--reasoning-effort", "high"]
|
||||
taskCmd.parse(args, { from: "user" })
|
||||
expect(taskCmd.opts().reasoningEffort).toBe("high")
|
||||
})
|
||||
|
||||
it("should parse --max-consecutive-mistakes option", () => {
|
||||
const taskCmd = program.commands.find((c) => c.name() === "task")!
|
||||
const taskCmd = getCommand("task")
|
||||
const args = ["test prompt", "--max-consecutive-mistakes", "999"]
|
||||
taskCmd.parse(args, { from: "user" })
|
||||
expect(taskCmd.opts().maxConsecutiveMistakes).toBe("999")
|
||||
})
|
||||
|
||||
it("should parse --hooks-dir option", () => {
|
||||
const taskCmd = program.commands.find((c) => c.name() === "task")!
|
||||
const taskCmd = getCommand("task")
|
||||
const args = ["test prompt", "--hooks-dir", "/tmp/hooks"]
|
||||
taskCmd.parse(args, { from: "user" })
|
||||
expect(taskCmd.opts().hooksDir).toBe("/tmp/hooks")
|
||||
})
|
||||
|
||||
it("should parse --double-check-completion flag", () => {
|
||||
const taskCmd = program.commands.find((c) => c.name() === "task")!
|
||||
const taskCmd = getCommand("task")
|
||||
const args = ["test prompt", "--double-check-completion"]
|
||||
taskCmd.parse(args, { from: "user" })
|
||||
expect(taskCmd.opts().doubleCheckCompletion).toBe(true)
|
||||
})
|
||||
|
||||
it("should parse --auto-condense flag", () => {
|
||||
const taskCmd = program.commands.find((c) => c.name() === "task")!
|
||||
const taskCmd = getCommand("task")
|
||||
const args = ["test prompt", "--auto-condense"]
|
||||
taskCmd.parse(args, { from: "user" })
|
||||
expect(taskCmd.opts().autoCondense).toBe(true)
|
||||
})
|
||||
|
||||
it("should parse short flags", () => {
|
||||
const taskCmd = program.commands.find((c) => c.name() === "task")!
|
||||
const taskCmd = getCommand("task")
|
||||
const args = ["test prompt", "-a", "-v", "-m", "gpt-4"]
|
||||
taskCmd.parse(args, { from: "user" })
|
||||
expect(taskCmd.opts().act).toBe(true)
|
||||
@@ -237,26 +261,26 @@ describe("CLI Commands", () => {
|
||||
|
||||
describe("history command", () => {
|
||||
it("should have default limit of 10", () => {
|
||||
const historyCmd = program.commands.find((c) => c.name() === "history")!
|
||||
const historyCmd = getCommand("history")
|
||||
historyCmd.parse([], { from: "user" })
|
||||
expect(historyCmd.opts().limit).toBe("10")
|
||||
})
|
||||
|
||||
it("should have default page of 1", () => {
|
||||
const historyCmd = program.commands.find((c) => c.name() === "history")!
|
||||
const historyCmd = getCommand("history")
|
||||
historyCmd.parse([], { from: "user" })
|
||||
expect(historyCmd.opts().page).toBe("1")
|
||||
})
|
||||
|
||||
it("should parse --limit option", () => {
|
||||
const historyCmd = program.commands.find((c) => c.name() === "history")!
|
||||
const historyCmd = getCommand("history")
|
||||
const args = ["--limit", "20"]
|
||||
historyCmd.parse(args, { from: "user" })
|
||||
expect(historyCmd.opts().limit).toBe("20")
|
||||
})
|
||||
|
||||
it("should parse --page option", () => {
|
||||
const historyCmd = program.commands.find((c) => c.name() === "history")!
|
||||
const historyCmd = getCommand("history")
|
||||
const args = ["--page", "3"]
|
||||
historyCmd.parse(args, { from: "user" })
|
||||
expect(historyCmd.opts().page).toBe("3")
|
||||
@@ -269,7 +293,7 @@ describe("CLI Commands", () => {
|
||||
})
|
||||
|
||||
it("should parse short flags", () => {
|
||||
const historyCmd = program.commands.find((c) => c.name() === "history")!
|
||||
const historyCmd = getCommand("history")
|
||||
const args = ["-n", "5", "-p", "2"]
|
||||
historyCmd.parse(args, { from: "user" })
|
||||
expect(historyCmd.opts().limit).toBe("5")
|
||||
@@ -284,7 +308,7 @@ describe("CLI Commands", () => {
|
||||
})
|
||||
|
||||
it("should parse --config option", () => {
|
||||
const configCmd = program.commands.find((c) => c.name() === "config")!
|
||||
const configCmd = getCommand("config")
|
||||
const args = ["--config", "/custom/path"]
|
||||
configCmd.parse(args, { from: "user" })
|
||||
expect(configCmd.opts().config).toBe("/custom/path")
|
||||
@@ -298,6 +322,20 @@ describe("CLI Commands", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("update command", () => {
|
||||
it("should parse update command", () => {
|
||||
const args = ["node", "cli", "update"]
|
||||
program.parse(args)
|
||||
})
|
||||
|
||||
it("should parse --verbose on update command", () => {
|
||||
const updateCmd = getCommand("update")
|
||||
const args = ["--verbose"]
|
||||
updateCmd.parse(args, { from: "user" })
|
||||
expect(updateCmd.opts().verbose).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe("auth command", () => {
|
||||
it("should parse auth command", () => {
|
||||
const args = ["node", "cli", "auth"]
|
||||
@@ -305,35 +343,35 @@ describe("CLI Commands", () => {
|
||||
})
|
||||
|
||||
it("should parse --provider option", () => {
|
||||
const authCmd = program.commands.find((c) => c.name() === "auth")!
|
||||
const authCmd = getCommand("auth")
|
||||
const args = ["--provider", "openai"]
|
||||
authCmd.parse(args, { from: "user" })
|
||||
expect(authCmd.opts().provider).toBe("openai")
|
||||
})
|
||||
|
||||
it("should parse --apikey option", () => {
|
||||
const authCmd = program.commands.find((c) => c.name() === "auth")!
|
||||
const authCmd = getCommand("auth")
|
||||
const args = ["--apikey", "sk-test-key"]
|
||||
authCmd.parse(args, { from: "user" })
|
||||
expect(authCmd.opts().apikey).toBe("sk-test-key")
|
||||
})
|
||||
|
||||
it("should parse --modelid option", () => {
|
||||
const authCmd = program.commands.find((c) => c.name() === "auth")!
|
||||
const authCmd = getCommand("auth")
|
||||
const args = ["--modelid", "gpt-4"]
|
||||
authCmd.parse(args, { from: "user" })
|
||||
expect(authCmd.opts().modelid).toBe("gpt-4")
|
||||
})
|
||||
|
||||
it("should parse --baseurl option", () => {
|
||||
const authCmd = program.commands.find((c) => c.name() === "auth")!
|
||||
const authCmd = getCommand("auth")
|
||||
const args = ["--baseurl", "https://api.example.com"]
|
||||
authCmd.parse(args, { from: "user" })
|
||||
expect(authCmd.opts().baseurl).toBe("https://api.example.com")
|
||||
})
|
||||
|
||||
it("should parse short flags", () => {
|
||||
const authCmd = program.commands.find((c) => c.name() === "auth")!
|
||||
const authCmd = getCommand("auth")
|
||||
const args = ["-p", "anthropic", "-k", "key123", "-m", "claude-sonnet-4-20250514"]
|
||||
authCmd.parse(args, { from: "user" })
|
||||
expect(authCmd.opts().provider).toBe("anthropic")
|
||||
@@ -354,15 +392,13 @@ describe("CLI Commands", () => {
|
||||
})
|
||||
|
||||
it("should default mcp add type to stdio", () => {
|
||||
const mcpCmd = program.commands.find((c) => c.name() === "mcp")!
|
||||
const addCmd = mcpCmd.commands.find((c) => c.name() === "add")!
|
||||
const addCmd = getSubcommand("mcp", "add")
|
||||
addCmd.parse(["kanban", "--", "kanban", "mcp"], { from: "user" })
|
||||
expect(addCmd.opts().type).toBe("stdio")
|
||||
})
|
||||
|
||||
it("should parse mcp add type option", () => {
|
||||
const mcpCmd = program.commands.find((c) => c.name() === "mcp")!
|
||||
const addCmd = mcpCmd.commands.find((c) => c.name() === "add")!
|
||||
const addCmd = getSubcommand("mcp", "add")
|
||||
addCmd.parse(["linear", "https://mcp.linear.app/mcp", "--type", "http"], { from: "user" })
|
||||
expect(addCmd.opts().type).toBe("http")
|
||||
})
|
||||
@@ -423,6 +459,16 @@ describe("CLI Commands", () => {
|
||||
program.parse(["node", "cli", "--kanban"])
|
||||
expect(program.opts().kanban).toBe(true)
|
||||
})
|
||||
|
||||
it("should parse --update flag", () => {
|
||||
program.parse(["node", "cli", "--update"])
|
||||
expect(program.opts().update).toBe(true)
|
||||
})
|
||||
|
||||
it("should parse --tui flag", () => {
|
||||
program.parse(["node", "cli", "--tui"])
|
||||
expect(program.opts().tui).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe("command structure", () => {
|
||||
@@ -434,11 +480,12 @@ describe("CLI Commands", () => {
|
||||
expect(commandNames).toContain("auth")
|
||||
expect(commandNames).toContain("mcp")
|
||||
expect(commandNames).toContain("kanban")
|
||||
expect(commandNames).toContain("update")
|
||||
})
|
||||
|
||||
it("should have correct aliases", () => {
|
||||
const taskCmd = program.commands.find((c) => c.name() === "task")!
|
||||
const historyCmd = program.commands.find((c) => c.name() === "history")!
|
||||
const taskCmd = getCommand("task")
|
||||
const historyCmd = getCommand("history")
|
||||
expect(taskCmd.aliases()).toContain("t")
|
||||
expect(historyCmd.aliases()).toContain("h")
|
||||
})
|
||||
|
||||
+194
-16
@@ -2,7 +2,7 @@
|
||||
* Cline CLI - TypeScript implementation with React Ink
|
||||
*/
|
||||
|
||||
import { spawn } from "node:child_process"
|
||||
import type { ChildProcess } from "node:child_process"
|
||||
import { exit } from "node:process"
|
||||
import type { ApiProvider } from "@shared/api"
|
||||
import { Command } from "commander"
|
||||
@@ -28,6 +28,7 @@ import { isOpenaiReasoningEffort, OPENAI_REASONING_EFFORT_OPTIONS, type OpenaiRe
|
||||
import { version as CLI_VERSION } from "../package.json"
|
||||
import { runAcpMode } from "./acp/index.js"
|
||||
import { App } from "./components/App"
|
||||
import { KanbanMigrationView } from "./components/KanbanMigrationView"
|
||||
import { checkRawModeSupport } from "./context/StdinContext"
|
||||
import { createCliHostBridgeProvider } from "./controllers"
|
||||
import { CliCommentReviewController } from "./controllers/CliCommentReviewController"
|
||||
@@ -35,6 +36,20 @@ import { CliWebviewProvider } from "./controllers/CliWebviewProvider"
|
||||
import { isAuthConfigured } from "./utils/auth"
|
||||
import { restoreConsole, suppressConsoleUnlessVerbose } from "./utils/console"
|
||||
import { printInfo, printWarning } from "./utils/display"
|
||||
import {
|
||||
forwardSignalToKanbanProcess,
|
||||
isKanbanCommandAvailable,
|
||||
KANBAN_LAUNCH_COMMAND,
|
||||
KANBAN_SHUTDOWN_TIMEOUT_MS,
|
||||
type KanbanMigrationAction,
|
||||
LEGACY_TUI_FLAG,
|
||||
markKanbanMigrationAnnouncementShown,
|
||||
resolveKanbanInstallCommand,
|
||||
shouldLaunchKanbanByDefault,
|
||||
shouldShowKanbanMigrationAnnouncementForCurrentUser,
|
||||
spawnKanbanInstallProcess,
|
||||
spawnKanbanProcess,
|
||||
} from "./utils/kanban"
|
||||
import { addMcpServerShortcut, type McpAddOptions } from "./utils/mcp"
|
||||
import { selectOutputMode } from "./utils/mode-selection"
|
||||
import { parseImagesFromInput, processImagePaths } from "./utils/parser"
|
||||
@@ -59,6 +74,7 @@ interface TaskOptions {
|
||||
act?: boolean
|
||||
plan?: boolean
|
||||
kanban?: boolean
|
||||
tui?: boolean
|
||||
model?: string
|
||||
verbose?: boolean
|
||||
cwd?: string
|
||||
@@ -251,25 +267,72 @@ function getPlainTextModeReason(options: TaskOptions): string {
|
||||
return getModeSelection(options).reason
|
||||
}
|
||||
|
||||
function getNpxCommand(): string {
|
||||
return process.platform === "win32" ? "npx.cmd" : "npx"
|
||||
}
|
||||
function runKanbanAlias(spawnOptions?: Parameters<typeof spawnKanbanProcess>[0]): void {
|
||||
const launchKanban = () => {
|
||||
const child = spawnKanbanProcess(spawnOptions)
|
||||
activeKanbanProcess = child
|
||||
|
||||
function runKanbanAlias(): void {
|
||||
const child = spawn(getNpxCommand(), ["-y", "kanban@latest", "--agent", "cline"], {
|
||||
stdio: "inherit",
|
||||
})
|
||||
child.on("error", (error) => {
|
||||
clearActiveKanbanProcess()
|
||||
const errorMessage = error instanceof Error ? ` ${error.message}` : ""
|
||||
printWarning(`Failed to run '${KANBAN_LAUNCH_COMMAND}'.${errorMessage}`)
|
||||
exit(1)
|
||||
})
|
||||
|
||||
child.on("error", () => {
|
||||
printWarning("Failed to run 'npx kanban@latest --agent cline'. Make sure npx is installed and available in PATH.")
|
||||
child.on("close", (code, signal) => {
|
||||
clearActiveKanbanProcess()
|
||||
exit(resolveProcessExitCode(code, signal))
|
||||
})
|
||||
}
|
||||
|
||||
if (isKanbanCommandAvailable()) {
|
||||
launchKanban()
|
||||
return
|
||||
}
|
||||
|
||||
const installCommand = resolveKanbanInstallCommand()
|
||||
if (!installCommand) {
|
||||
printWarning(
|
||||
`'${KANBAN_LAUNCH_COMMAND}' not found and no supported package manager was detected in PATH (npm, pnpm, bun). Install Kanban globally and try again.`,
|
||||
)
|
||||
exit(1)
|
||||
}
|
||||
|
||||
const installProcess = spawnKanbanInstallProcess(installCommand)
|
||||
|
||||
installProcess.on("error", (error) => {
|
||||
const errorMessage = error instanceof Error ? ` ${error.message}` : ""
|
||||
printWarning(`Failed to run '${installCommand.displayCommand}'.${errorMessage}`)
|
||||
exit(1)
|
||||
})
|
||||
|
||||
child.on("close", (code) => {
|
||||
exit(code ?? 1)
|
||||
installProcess.on("close", (code, signal) => {
|
||||
const installExitCode = resolveProcessExitCode(code, signal)
|
||||
if (installExitCode !== 0) {
|
||||
printWarning(`Failed to install Kanban automatically. Please run '${installCommand.displayCommand}' manually.`)
|
||||
exit(installExitCode)
|
||||
}
|
||||
|
||||
launchKanban()
|
||||
})
|
||||
}
|
||||
|
||||
async function showKanbanMigrationView(): Promise<KanbanMigrationAction> {
|
||||
let selectedAction: KanbanMigrationAction = "exit"
|
||||
|
||||
await runInkApp(
|
||||
React.createElement(KanbanMigrationView, {
|
||||
isRawModeSupported: checkRawModeSupport(),
|
||||
onSelect: (action: KanbanMigrationAction) => {
|
||||
selectedAction = action
|
||||
},
|
||||
}),
|
||||
async () => {},
|
||||
)
|
||||
|
||||
return selectedAction
|
||||
}
|
||||
|
||||
async function addMcpServer(name: string, targetOrCommand: string[] = [], options: McpAddOptions): Promise<void> {
|
||||
try {
|
||||
const result = await addMcpServerShortcut(name, targetOrCommand, options)
|
||||
@@ -347,6 +410,62 @@ let activeContext: CliContext | null = null
|
||||
let isShuttingDown = false
|
||||
// Track if we're in plain text mode (no Ink UI) - set by runTask when piped stdin detected
|
||||
let isPlainTextMode = false
|
||||
let activeKanbanProcess: ChildProcess | null = null
|
||||
let activeKanbanShutdownTimer: NodeJS.Timeout | null = null
|
||||
|
||||
function clearActiveKanbanProcess(): void {
|
||||
activeKanbanProcess = null
|
||||
if (activeKanbanShutdownTimer) {
|
||||
clearTimeout(activeKanbanShutdownTimer)
|
||||
activeKanbanShutdownTimer = null
|
||||
}
|
||||
}
|
||||
|
||||
function requestKanbanProcessShutdown(signal: NodeJS.Signals): void {
|
||||
if (!activeKanbanProcess) {
|
||||
return
|
||||
}
|
||||
|
||||
forwardSignalToKanbanProcess({
|
||||
child: activeKanbanProcess,
|
||||
signal,
|
||||
})
|
||||
|
||||
if (activeKanbanShutdownTimer) {
|
||||
clearTimeout(activeKanbanShutdownTimer)
|
||||
}
|
||||
|
||||
if (signal === "SIGKILL") {
|
||||
activeKanbanShutdownTimer = null
|
||||
return
|
||||
}
|
||||
|
||||
activeKanbanShutdownTimer = setTimeout(() => {
|
||||
if (!activeKanbanProcess) {
|
||||
return
|
||||
}
|
||||
forwardSignalToKanbanProcess({
|
||||
child: activeKanbanProcess,
|
||||
signal: "SIGKILL",
|
||||
})
|
||||
}, KANBAN_SHUTDOWN_TIMEOUT_MS)
|
||||
activeKanbanShutdownTimer.unref?.()
|
||||
}
|
||||
|
||||
function resolveProcessExitCode(code: number | null, signal: NodeJS.Signals | null): number {
|
||||
if (code !== null) {
|
||||
return code
|
||||
}
|
||||
|
||||
switch (signal) {
|
||||
case "SIGINT":
|
||||
return 130
|
||||
case "SIGTERM":
|
||||
return 143
|
||||
default:
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for stdout to fully drain before exiting.
|
||||
@@ -402,6 +521,17 @@ function onUnhandledException(reason: unknown, context: string) {
|
||||
|
||||
function setupSignalHandlers() {
|
||||
const shutdown = async (signal: string) => {
|
||||
if (activeKanbanProcess) {
|
||||
if (isShuttingDown) {
|
||||
requestKanbanProcessShutdown("SIGKILL")
|
||||
return
|
||||
}
|
||||
|
||||
isShuttingDown = true
|
||||
requestKanbanProcessShutdown(signal === "SIGTERM" ? "SIGTERM" : "SIGINT")
|
||||
return
|
||||
}
|
||||
|
||||
if (isShuttingDown) {
|
||||
// Force exit on second signal
|
||||
process.exit(1)
|
||||
@@ -897,9 +1027,12 @@ program
|
||||
.command("update")
|
||||
.description("Check for updates and install if available")
|
||||
.option("-v, --verbose", "Show verbose output")
|
||||
.action(() => checkForUpdates(CLI_VERSION))
|
||||
.action((options) => checkForUpdates(CLI_VERSION, { verbose: options.verbose, includeKanban: true }))
|
||||
|
||||
program.command("kanban").description("Run npx kanban@latest --agent cline").action(runKanbanAlias)
|
||||
program
|
||||
.command("kanban")
|
||||
.description(`Run ${KANBAN_LAUNCH_COMMAND}`)
|
||||
.action(() => runKanbanAlias())
|
||||
|
||||
// Dev command with subcommands
|
||||
const devCommand = program.command("dev").description("Developer tools and utilities")
|
||||
@@ -1050,17 +1183,34 @@ program
|
||||
.option("--auto-condense", "Enable AI-powered context compaction instead of mechanical truncation")
|
||||
.option("--hooks-dir <path>", "Path to additional hooks directory for runtime hook injection")
|
||||
.option("--acp", "Run in ACP (Agent Client Protocol) mode for editor integration")
|
||||
.option("--kanban", "Run npx kanban@latest --agent cline")
|
||||
.option("--update", "Check for updates and install if available")
|
||||
.option("--kanban", `Run ${KANBAN_LAUNCH_COMMAND}`)
|
||||
.option("--tui", "Open the legacy terminal UI instead of the kanban experience")
|
||||
.option("-T, --taskId <id>", "Resume an existing task by ID")
|
||||
.option("--continue", "Resume the most recent task from the current working directory")
|
||||
.action(async (prompt, options) => {
|
||||
if (options.kanban && options.tui) {
|
||||
printWarning(`Use either --kanban or ${LEGACY_TUI_FLAG}, not both.`)
|
||||
exit(1)
|
||||
}
|
||||
|
||||
if (options.update) {
|
||||
if (prompt || options.taskId || options.continue || options.kanban || options.tui || options.acp) {
|
||||
printWarning("Use --update without a prompt or task flags.")
|
||||
exit(1)
|
||||
}
|
||||
|
||||
await checkForUpdates(CLI_VERSION, { verbose: options.verbose, includeKanban: true })
|
||||
return
|
||||
}
|
||||
|
||||
if (options.kanban) {
|
||||
if (prompt) {
|
||||
printWarning("Use --kanban without a prompt.")
|
||||
exit(1)
|
||||
}
|
||||
|
||||
runKanbanAlias()
|
||||
runKanbanAlias({ cwd: options.cwd })
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1084,6 +1234,34 @@ program
|
||||
// stdinInput has content means stdin was piped with data
|
||||
const stdinWasPiped = stdinInput !== null
|
||||
|
||||
if (
|
||||
shouldLaunchKanbanByDefault({
|
||||
prompt,
|
||||
stdinWasPiped,
|
||||
taskId: options.taskId,
|
||||
continue: options.continue,
|
||||
tui: options.tui,
|
||||
})
|
||||
) {
|
||||
let migrationAction: "kanban" | "exit" = "kanban"
|
||||
const ctx = await initializeCli({ ...options, enableAuth: true })
|
||||
try {
|
||||
if (await shouldShowKanbanMigrationAnnouncementForCurrentUser()) {
|
||||
migrationAction = await showKanbanMigrationView()
|
||||
await markKanbanMigrationAnnouncementShown()
|
||||
}
|
||||
} finally {
|
||||
await disposeCliContext(ctx)
|
||||
}
|
||||
|
||||
if (migrationAction === "exit") {
|
||||
exit(0)
|
||||
}
|
||||
|
||||
runKanbanAlias({ cwd: options.cwd })
|
||||
return
|
||||
}
|
||||
|
||||
if (options.taskId && options.continue) {
|
||||
printWarning("Use either --taskId or --continue, not both.")
|
||||
exit(1)
|
||||
|
||||
@@ -0,0 +1,265 @@
|
||||
import { chmodSync, mkdtempSync, rmSync, writeFileSync } from "node:fs"
|
||||
import { tmpdir } from "node:os"
|
||||
import { join } from "node:path"
|
||||
import { describe, expect, it, vi } from "vitest"
|
||||
import {
|
||||
buildKanbanInstallSpawnOptions,
|
||||
buildKanbanSpawnOptions,
|
||||
forwardSignalToKanbanProcess,
|
||||
hasUsedLegacyCli,
|
||||
isKanbanCommandAvailable,
|
||||
resolveKanbanInstallCommand,
|
||||
shouldDetachKanbanProcess,
|
||||
shouldLaunchKanbanByDefault,
|
||||
shouldShowKanbanMigrationAnnouncement,
|
||||
} from "./kanban"
|
||||
|
||||
describe("shouldLaunchKanbanByDefault", () => {
|
||||
it("launches kanban for a bare interactive run", () => {
|
||||
expect(
|
||||
shouldLaunchKanbanByDefault({
|
||||
stdinWasPiped: false,
|
||||
}),
|
||||
).toBe(true)
|
||||
})
|
||||
|
||||
it("does not launch kanban when a prompt is provided", () => {
|
||||
expect(
|
||||
shouldLaunchKanbanByDefault({
|
||||
prompt: "fix the tests",
|
||||
stdinWasPiped: false,
|
||||
}),
|
||||
).toBe(false)
|
||||
})
|
||||
|
||||
it("does not launch kanban when stdin is piped", () => {
|
||||
expect(
|
||||
shouldLaunchKanbanByDefault({
|
||||
stdinWasPiped: true,
|
||||
}),
|
||||
).toBe(false)
|
||||
})
|
||||
|
||||
it("does not launch kanban when the legacy tui is requested", () => {
|
||||
expect(
|
||||
shouldLaunchKanbanByDefault({
|
||||
stdinWasPiped: false,
|
||||
tui: true,
|
||||
}),
|
||||
).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe("hasUsedLegacyCli", () => {
|
||||
it("treats task history as legacy usage", () => {
|
||||
expect(
|
||||
hasUsedLegacyCli({
|
||||
taskHistoryCount: 1,
|
||||
isNewUser: true,
|
||||
welcomeViewCompleted: undefined,
|
||||
hasConfiguredAuth: false,
|
||||
}),
|
||||
).toBe(true)
|
||||
})
|
||||
|
||||
it("treats configured auth as legacy usage", () => {
|
||||
expect(
|
||||
hasUsedLegacyCli({
|
||||
taskHistoryCount: 0,
|
||||
isNewUser: true,
|
||||
welcomeViewCompleted: undefined,
|
||||
hasConfiguredAuth: true,
|
||||
}),
|
||||
).toBe(true)
|
||||
})
|
||||
|
||||
it("skips the announcement for fresh installs", () => {
|
||||
expect(
|
||||
hasUsedLegacyCli({
|
||||
taskHistoryCount: 0,
|
||||
isNewUser: true,
|
||||
welcomeViewCompleted: undefined,
|
||||
hasConfiguredAuth: false,
|
||||
}),
|
||||
).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe("kanban process launch", () => {
|
||||
it("detaches the kanban process on unix-like platforms", () => {
|
||||
expect(shouldDetachKanbanProcess("darwin")).toBe(true)
|
||||
expect(shouldDetachKanbanProcess("linux")).toBe(true)
|
||||
})
|
||||
|
||||
it("keeps the kanban process attached on windows", () => {
|
||||
expect(shouldDetachKanbanProcess("win32")).toBe(false)
|
||||
})
|
||||
|
||||
it("uses a detached process group by default on unix-like platforms", () => {
|
||||
expect(buildKanbanSpawnOptions({}, "darwin")).toMatchObject({
|
||||
stdio: "inherit",
|
||||
detached: true,
|
||||
})
|
||||
})
|
||||
|
||||
it("does not detach the process on windows", () => {
|
||||
expect(buildKanbanSpawnOptions({}, "win32")).toMatchObject({
|
||||
stdio: "inherit",
|
||||
detached: false,
|
||||
})
|
||||
})
|
||||
|
||||
it("enables shell mode on windows for command launches", () => {
|
||||
expect(buildKanbanSpawnOptions({}, "win32")).toMatchObject({
|
||||
shell: true,
|
||||
})
|
||||
})
|
||||
|
||||
it("does not set shell mode on unix-like platforms", () => {
|
||||
expect(buildKanbanSpawnOptions({}, "darwin")).not.toHaveProperty("shell")
|
||||
})
|
||||
})
|
||||
|
||||
describe("kanban command availability", () => {
|
||||
it("returns false when PATH is empty", () => {
|
||||
expect(isKanbanCommandAvailable({ PATH: "" }, "darwin")).toBe(false)
|
||||
})
|
||||
|
||||
it("detects the kanban command in PATH", () => {
|
||||
const tempDirectory = mkdtempSync(join(tmpdir(), "kanban-cli-test-"))
|
||||
const commandPath = join(tempDirectory, process.platform === "win32" ? "kanban.cmd" : "kanban")
|
||||
writeFileSync(commandPath, process.platform === "win32" ? "@echo off\r\necho ok\r\n" : "#!/bin/sh\necho ok\n")
|
||||
if (process.platform !== "win32") {
|
||||
chmodSync(commandPath, 0o755)
|
||||
}
|
||||
|
||||
try {
|
||||
expect(isKanbanCommandAvailable({ PATH: tempDirectory }, process.platform)).toBe(true)
|
||||
} finally {
|
||||
rmSync(tempDirectory, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe("kanban install process launch", () => {
|
||||
it("does not detach the install process on unix-like platforms", () => {
|
||||
expect(buildKanbanInstallSpawnOptions({}, "darwin")).toMatchObject({
|
||||
stdio: "inherit",
|
||||
detached: false,
|
||||
})
|
||||
})
|
||||
|
||||
it("enables shell mode on windows for npm.cmd launches", () => {
|
||||
expect(buildKanbanInstallSpawnOptions({}, "win32")).toMatchObject({
|
||||
shell: true,
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("kanban installer resolution", () => {
|
||||
it("prefers npm when available", () => {
|
||||
const tempDirectory = mkdtempSync(join(tmpdir(), "kanban-installer-test-"))
|
||||
writeFileSync(join(tempDirectory, "npm"), "#!/bin/sh\necho npm\n")
|
||||
writeFileSync(join(tempDirectory, "pnpm"), "#!/bin/sh\necho pnpm\n")
|
||||
writeFileSync(join(tempDirectory, "bun"), "#!/bin/sh\necho bun\n")
|
||||
chmodSync(join(tempDirectory, "npm"), 0o755)
|
||||
chmodSync(join(tempDirectory, "pnpm"), 0o755)
|
||||
chmodSync(join(tempDirectory, "bun"), 0o755)
|
||||
|
||||
try {
|
||||
expect(resolveKanbanInstallCommand({ PATH: tempDirectory }, "darwin")?.packageManager).toBe("npm")
|
||||
} finally {
|
||||
rmSync(tempDirectory, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
|
||||
it("falls back to pnpm when npm is unavailable", () => {
|
||||
const tempDirectory = mkdtempSync(join(tmpdir(), "kanban-installer-test-"))
|
||||
writeFileSync(join(tempDirectory, "pnpm"), "#!/bin/sh\necho pnpm\n")
|
||||
chmodSync(join(tempDirectory, "pnpm"), 0o755)
|
||||
|
||||
try {
|
||||
const installer = resolveKanbanInstallCommand({ PATH: tempDirectory }, "darwin")
|
||||
expect(installer?.packageManager).toBe("pnpm")
|
||||
expect(installer?.displayCommand).toBe("pnpm add -g kanban@latest")
|
||||
} finally {
|
||||
rmSync(tempDirectory, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
|
||||
it("falls back to bun when npm and pnpm are unavailable", () => {
|
||||
const tempDirectory = mkdtempSync(join(tmpdir(), "kanban-installer-test-"))
|
||||
writeFileSync(join(tempDirectory, "bun"), "#!/bin/sh\necho bun\n")
|
||||
chmodSync(join(tempDirectory, "bun"), 0o755)
|
||||
|
||||
try {
|
||||
const installer = resolveKanbanInstallCommand({ PATH: tempDirectory }, "darwin")
|
||||
expect(installer?.packageManager).toBe("bun")
|
||||
expect(installer?.displayCommand).toBe("bun add -g kanban@latest")
|
||||
} finally {
|
||||
rmSync(tempDirectory, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
|
||||
it("returns null when no supported package manager is available", () => {
|
||||
expect(resolveKanbanInstallCommand({ PATH: "" }, "darwin")).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe("forwardSignalToKanbanProcess", () => {
|
||||
it("signals the detached kanban process group on unix-like platforms", () => {
|
||||
const killProcess = vi.fn()
|
||||
const child = {
|
||||
pid: 4321,
|
||||
kill: vi.fn(),
|
||||
}
|
||||
|
||||
forwardSignalToKanbanProcess({
|
||||
child,
|
||||
signal: "SIGINT",
|
||||
platform: "darwin",
|
||||
killProcess,
|
||||
})
|
||||
|
||||
expect(killProcess).toHaveBeenCalledWith(-4321, "SIGINT")
|
||||
expect(child.kill).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it("signals the child process directly on windows", () => {
|
||||
const killProcess = vi.fn()
|
||||
const child = {
|
||||
pid: 4321,
|
||||
kill: vi.fn(),
|
||||
}
|
||||
|
||||
forwardSignalToKanbanProcess({
|
||||
child,
|
||||
signal: "SIGTERM",
|
||||
platform: "win32",
|
||||
killProcess,
|
||||
})
|
||||
|
||||
expect(killProcess).not.toHaveBeenCalled()
|
||||
expect(child.kill).toHaveBeenCalledWith("SIGTERM")
|
||||
})
|
||||
})
|
||||
|
||||
describe("shouldShowKanbanMigrationAnnouncement", () => {
|
||||
it("shows the announcement once for legacy users", () => {
|
||||
expect(
|
||||
shouldShowKanbanMigrationAnnouncement({
|
||||
announcementShown: false,
|
||||
hasUsedLegacyCli: true,
|
||||
}),
|
||||
).toBe(true)
|
||||
})
|
||||
|
||||
it("does not show the announcement twice", () => {
|
||||
expect(
|
||||
shouldShowKanbanMigrationAnnouncement({
|
||||
announcementShown: true,
|
||||
hasUsedLegacyCli: true,
|
||||
}),
|
||||
).toBe(false)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,246 @@
|
||||
import { type ChildProcess, type SpawnOptions, spawn } from "node:child_process"
|
||||
import { accessSync, constants as fsConstants } from "node:fs"
|
||||
import { delimiter, extname, join } from "node:path"
|
||||
import { StateManager } from "@/core/storage/StateManager"
|
||||
import { checkAnyProviderConfigured } from "./auth"
|
||||
|
||||
export const KANBAN_LAUNCH_COMMAND = "kanban"
|
||||
export const KANBAN_SHUTDOWN_TIMEOUT_MS = 10_000
|
||||
export const LEGACY_TUI_FLAG = "--tui"
|
||||
export type KanbanMigrationAction = "kanban" | "exit"
|
||||
type KanbanInstaller = "npm" | "pnpm" | "bun"
|
||||
|
||||
interface KanbanInstallCommand {
|
||||
packageManager: KanbanInstaller
|
||||
command: string
|
||||
args: readonly string[]
|
||||
displayCommand: string
|
||||
}
|
||||
|
||||
interface SignalableKanbanProcess {
|
||||
pid?: number
|
||||
kill: (signal?: NodeJS.Signals | number) => boolean
|
||||
}
|
||||
|
||||
function getKanbanCommand(platform: NodeJS.Platform = process.platform): string {
|
||||
return platform === "win32" ? "kanban.cmd" : "kanban"
|
||||
}
|
||||
|
||||
function getPackageManagerCommand(packageManager: KanbanInstaller, platform: NodeJS.Platform = process.platform): string {
|
||||
if (platform !== "win32") {
|
||||
return packageManager
|
||||
}
|
||||
|
||||
return packageManager === "bun" ? "bun" : `${packageManager}.cmd`
|
||||
}
|
||||
|
||||
const KANBAN_INSTALL_COMMANDS: ReadonlyArray<Omit<KanbanInstallCommand, "displayCommand">> = [
|
||||
{
|
||||
packageManager: "npm",
|
||||
command: "npm",
|
||||
args: ["install", "-g", "kanban@latest"],
|
||||
},
|
||||
{
|
||||
packageManager: "pnpm",
|
||||
command: "pnpm",
|
||||
args: ["add", "-g", "kanban@latest"],
|
||||
},
|
||||
{
|
||||
packageManager: "bun",
|
||||
command: "bun",
|
||||
args: ["add", "-g", "kanban@latest"],
|
||||
},
|
||||
]
|
||||
|
||||
function toDisplayCommand(command: string, args: readonly string[]): string {
|
||||
return `${command} ${args.join(" ")}`
|
||||
}
|
||||
|
||||
export function shouldDetachKanbanProcess(platform: NodeJS.Platform = process.platform): boolean {
|
||||
return platform !== "win32"
|
||||
}
|
||||
|
||||
export function buildKanbanSpawnOptions(options: SpawnOptions = {}, platform: NodeJS.Platform = process.platform): SpawnOptions {
|
||||
return {
|
||||
stdio: "inherit",
|
||||
detached: shouldDetachKanbanProcess(platform),
|
||||
...(platform === "win32" ? { shell: true } : {}),
|
||||
...options,
|
||||
}
|
||||
}
|
||||
|
||||
export function buildKanbanInstallSpawnOptions(
|
||||
options: SpawnOptions = {},
|
||||
platform: NodeJS.Platform = process.platform,
|
||||
): SpawnOptions {
|
||||
return {
|
||||
stdio: "inherit",
|
||||
detached: false,
|
||||
...(platform === "win32" ? { shell: true } : {}),
|
||||
...options,
|
||||
}
|
||||
}
|
||||
|
||||
export function spawnKanbanProcess(options: SpawnOptions = {}): ChildProcess {
|
||||
return spawn(getKanbanCommand(), [], buildKanbanSpawnOptions(options))
|
||||
}
|
||||
|
||||
export function spawnKanbanInstallProcess(installCommand: KanbanInstallCommand, options: SpawnOptions = {}): ChildProcess {
|
||||
return spawn(
|
||||
getPackageManagerCommand(installCommand.packageManager),
|
||||
[...installCommand.args],
|
||||
buildKanbanInstallSpawnOptions(options),
|
||||
)
|
||||
}
|
||||
|
||||
function getPathEntries(env: NodeJS.ProcessEnv): string[] {
|
||||
const pathValue = env.PATH ?? env.Path ?? env.path
|
||||
if (!pathValue) {
|
||||
return []
|
||||
}
|
||||
|
||||
return pathValue
|
||||
.split(delimiter)
|
||||
.map((entry) => entry.trim().replace(/^"(.*)"$/u, "$1"))
|
||||
.filter((entry) => entry.length > 0)
|
||||
}
|
||||
|
||||
function pathExists(candidatePath: string, platform: NodeJS.Platform): boolean {
|
||||
try {
|
||||
if (platform === "win32") {
|
||||
accessSync(candidatePath, fsConstants.F_OK)
|
||||
} else {
|
||||
accessSync(candidatePath, fsConstants.X_OK)
|
||||
}
|
||||
return true
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export function isCommandAvailable(
|
||||
command: string,
|
||||
env: NodeJS.ProcessEnv = process.env,
|
||||
platform: NodeJS.Platform = process.platform,
|
||||
): boolean {
|
||||
const commandHasExtension = extname(command).length > 0
|
||||
const pathExtensions =
|
||||
platform === "win32" ? (env.PATHEXT ?? ".EXE;.CMD;.BAT;.COM").split(";").filter((ext) => ext.length > 0) : []
|
||||
|
||||
for (const pathEntry of getPathEntries(env)) {
|
||||
const commandPath = join(pathEntry, command)
|
||||
if (pathExists(commandPath, platform)) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (!commandHasExtension && platform === "win32") {
|
||||
for (const extension of pathExtensions) {
|
||||
if (pathExists(`${commandPath}${extension}`, platform)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
export function isKanbanCommandAvailable(
|
||||
env: NodeJS.ProcessEnv = process.env,
|
||||
platform: NodeJS.Platform = process.platform,
|
||||
): boolean {
|
||||
return isCommandAvailable(getKanbanCommand(platform), env, platform)
|
||||
}
|
||||
|
||||
export function resolveKanbanInstallCommand(
|
||||
env: NodeJS.ProcessEnv = process.env,
|
||||
platform: NodeJS.Platform = process.platform,
|
||||
): KanbanInstallCommand | null {
|
||||
for (const installCommand of KANBAN_INSTALL_COMMANDS) {
|
||||
if (isCommandAvailable(installCommand.command, env, platform)) {
|
||||
return {
|
||||
...installCommand,
|
||||
displayCommand: toDisplayCommand(installCommand.command, installCommand.args),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export function forwardSignalToKanbanProcess(options: {
|
||||
child: SignalableKanbanProcess
|
||||
signal: NodeJS.Signals
|
||||
platform?: NodeJS.Platform
|
||||
killProcess?: (pid: number, signal: NodeJS.Signals | number) => boolean
|
||||
}): void {
|
||||
if (options.child.pid == null) {
|
||||
return
|
||||
}
|
||||
|
||||
if (shouldDetachKanbanProcess(options.platform)) {
|
||||
try {
|
||||
;(options.killProcess ?? process.kill)(-options.child.pid, options.signal)
|
||||
return
|
||||
} catch (error) {
|
||||
if (error && typeof error === "object" && "code" in error && error.code === "ESRCH") {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
options.child.kill(options.signal)
|
||||
}
|
||||
|
||||
export function shouldLaunchKanbanByDefault(options: {
|
||||
prompt?: string
|
||||
stdinWasPiped: boolean
|
||||
taskId?: string
|
||||
continue?: boolean
|
||||
tui?: boolean
|
||||
}): boolean {
|
||||
return !options.prompt && !options.stdinWasPiped && !options.taskId && !options.continue && !options.tui
|
||||
}
|
||||
|
||||
export function hasUsedLegacyCli(options: {
|
||||
taskHistoryCount: number
|
||||
isNewUser: boolean
|
||||
welcomeViewCompleted: boolean | undefined
|
||||
hasConfiguredAuth: boolean
|
||||
}): boolean {
|
||||
return (
|
||||
options.taskHistoryCount > 0 ||
|
||||
options.isNewUser === false ||
|
||||
options.welcomeViewCompleted !== undefined ||
|
||||
options.hasConfiguredAuth
|
||||
)
|
||||
}
|
||||
|
||||
export function shouldShowKanbanMigrationAnnouncement(options: {
|
||||
announcementShown: boolean
|
||||
hasUsedLegacyCli: boolean
|
||||
}): boolean {
|
||||
return !options.announcementShown && options.hasUsedLegacyCli
|
||||
}
|
||||
|
||||
export async function shouldShowKanbanMigrationAnnouncementForCurrentUser(): Promise<boolean> {
|
||||
const stateManager = StateManager.get()
|
||||
const hasConfiguredAuth = await checkAnyProviderConfigured()
|
||||
const hasUsedLegacy = hasUsedLegacyCli({
|
||||
taskHistoryCount: stateManager.getGlobalStateKey("taskHistory")?.length ?? 0,
|
||||
isNewUser: stateManager.getGlobalStateKey("isNewUser"),
|
||||
welcomeViewCompleted: stateManager.getGlobalStateKey("welcomeViewCompleted"),
|
||||
hasConfiguredAuth,
|
||||
})
|
||||
|
||||
return shouldShowKanbanMigrationAnnouncement({
|
||||
announcementShown: stateManager.getGlobalStateKey("cliKanbanMigrationAnnouncementShown"),
|
||||
hasUsedLegacyCli: hasUsedLegacy,
|
||||
})
|
||||
}
|
||||
|
||||
export async function markKanbanMigrationAnnouncementShown(): Promise<void> {
|
||||
const stateManager = StateManager.get()
|
||||
stateManager.setGlobalState("cliKanbanMigrationAnnouncementShown", true)
|
||||
await stateManager.flushPendingState()
|
||||
}
|
||||
+198
-70
@@ -1,9 +1,10 @@
|
||||
import { spawn } from "node:child_process"
|
||||
import { type ChildProcess, spawn, spawnSync } from "node:child_process"
|
||||
import { realpathSync } from "node:fs"
|
||||
import { exit } from "node:process"
|
||||
import { ClineEndpoint } from "@/config"
|
||||
import { fetch } from "@/shared/net"
|
||||
import { printInfo, printWarning } from "./display"
|
||||
import { printInfo, printSuccess, printWarning } from "./display"
|
||||
import { resolveKanbanInstallCommand, spawnKanbanInstallProcess } from "./kanban"
|
||||
|
||||
export enum PackageManager {
|
||||
NPM = "npm",
|
||||
@@ -19,6 +20,11 @@ interface InstallationInfo {
|
||||
updateCommand?: string
|
||||
}
|
||||
|
||||
interface CheckForUpdatesOptions {
|
||||
verbose?: boolean
|
||||
includeKanban?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a version string is a nightly build.
|
||||
*/
|
||||
@@ -91,9 +97,12 @@ function getInstallationInfo(currentVersion: string): InstallationInfo {
|
||||
* Uses the appropriate tag based on whether the current version is nightly.
|
||||
*/
|
||||
async function getLatestVersion(currentVersion: string): Promise<string | null> {
|
||||
return getLatestPackageVersion("cline", getNpmTag(currentVersion))
|
||||
}
|
||||
|
||||
async function getLatestPackageVersion(packageName: string, tag = "latest"): Promise<string | null> {
|
||||
try {
|
||||
const tag = getNpmTag(currentVersion)
|
||||
const response = await fetch(`https://registry.npmjs.org/cline/${tag}`)
|
||||
const response = await fetch(`https://registry.npmjs.org/${encodeURIComponent(packageName)}/${tag}`)
|
||||
if (!response.ok) return null
|
||||
const data = (await response.json()) as { version: string }
|
||||
return data.version || null
|
||||
@@ -102,6 +111,29 @@ async function getLatestVersion(currentVersion: string): Promise<string | null>
|
||||
}
|
||||
}
|
||||
|
||||
async function getLatestKanbanVersion(): Promise<string | null> {
|
||||
return getLatestPackageVersion("kanban")
|
||||
}
|
||||
|
||||
function getInstalledKanbanVersion(): string | null {
|
||||
try {
|
||||
const command = process.platform === "win32" ? "kanban.cmd" : "kanban"
|
||||
const result = spawnSync(command, ["--version"], {
|
||||
encoding: "utf8",
|
||||
shell: process.platform === "win32",
|
||||
})
|
||||
if (result.status !== 0) {
|
||||
return null
|
||||
}
|
||||
|
||||
const output = `${result.stdout ?? ""}\n${result.stderr ?? ""}`.trim()
|
||||
const versionMatch = output.match(/\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?/)
|
||||
return versionMatch?.[0] ?? null
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Auto-update check that runs on CLI startup.
|
||||
* Checks for updates asynchronously (non-blocking), then spawns a detached
|
||||
@@ -157,85 +189,181 @@ async function checkAndUpdate(currentVersion: string, updateCommand: string): Pr
|
||||
}
|
||||
}
|
||||
|
||||
async function waitForProcessExit(updateProcess: ChildProcess): Promise<number> {
|
||||
return new Promise<number>((resolve, reject) => {
|
||||
updateProcess.once("close", (code) => {
|
||||
resolve(code ?? 1)
|
||||
})
|
||||
|
||||
updateProcess.once("error", (error) => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async function runClineUpdate(updateCommand: string): Promise<number> {
|
||||
const updateProcess = spawn(updateCommand, {
|
||||
stdio: "inherit",
|
||||
shell: true,
|
||||
env: process.env,
|
||||
windowsHide: true,
|
||||
})
|
||||
|
||||
return waitForProcessExit(updateProcess)
|
||||
}
|
||||
|
||||
type KanbanInstallCommand = NonNullable<ReturnType<typeof resolveKanbanInstallCommand>>
|
||||
|
||||
async function runKanbanUpdate(installCommand: KanbanInstallCommand): Promise<number> {
|
||||
const updateProcess = spawnKanbanInstallProcess(installCommand, {
|
||||
env: process.env,
|
||||
windowsHide: true,
|
||||
})
|
||||
return waitForProcessExit(updateProcess)
|
||||
}
|
||||
|
||||
function formatUpdateSummaryTargets(targets: string[]): string {
|
||||
if (targets.length === 0) {
|
||||
return ""
|
||||
}
|
||||
if (targets.length === 1) {
|
||||
return targets[0]
|
||||
}
|
||||
if (targets.length === 2) {
|
||||
return `${targets[0]} and ${targets[1]}`
|
||||
}
|
||||
return `${targets.slice(0, -1).join(", ")}, and ${targets.at(-1)}`
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for updates and install if available (manual command)
|
||||
*/
|
||||
export async function checkForUpdates(currentVersion: string, options?: { verbose?: boolean }) {
|
||||
printInfo("Checking for updates...")
|
||||
export async function checkForUpdates(currentVersion: string, options: CheckForUpdatesOptions = {}) {
|
||||
const includeKanban = options.includeKanban ?? true
|
||||
|
||||
printInfo("Checking for updates to cline and kanban packages...")
|
||||
|
||||
const { updateCommand, packageManager } = getInstallationInfo(currentVersion)
|
||||
|
||||
try {
|
||||
const latestVersion = await getLatestVersion(currentVersion)
|
||||
if (!latestVersion) {
|
||||
printWarning("Failed to check for updates: could not fetch latest version")
|
||||
exit(1)
|
||||
}
|
||||
const latestClineVersion = await getLatestVersion(currentVersion)
|
||||
const canCheckClineVersion = latestClineVersion !== null
|
||||
|
||||
if (options?.verbose) {
|
||||
printInfo(`Current version: ${currentVersion}`)
|
||||
printInfo(`Latest version: ${latestVersion}`)
|
||||
printInfo(`Package manager: ${packageManager}`)
|
||||
}
|
||||
|
||||
// Compare versions
|
||||
if (latestVersion === currentVersion) {
|
||||
printInfo(`You are already on the latest version (${currentVersion})`)
|
||||
exit(0)
|
||||
}
|
||||
|
||||
// Check if current is newer (dev version)
|
||||
if (compareVersions(currentVersion, latestVersion) > 0) {
|
||||
printInfo(`You are already on a newer version ${currentVersion} (latest: ${latestVersion})`)
|
||||
exit(0)
|
||||
}
|
||||
|
||||
printInfo(`New version available: ${latestVersion} (current: ${currentVersion})`)
|
||||
|
||||
if (!updateCommand) {
|
||||
printInfo("Unable to determine update command for your installation.")
|
||||
printInfo("Please update manually using your package manager.")
|
||||
exit(0)
|
||||
}
|
||||
|
||||
// Ask user to confirm update
|
||||
const userConfirmed = new Promise<boolean>((resolve) => {
|
||||
process.stdout.write("Do you want to update now? (y/N): ")
|
||||
process.stdin.setEncoding("utf-8")
|
||||
process.stdin.once("data", (dataBuff) => {
|
||||
const input = dataBuff.toString().trim().toLowerCase()
|
||||
resolve(input === "y" || input === "yes")
|
||||
})
|
||||
})
|
||||
|
||||
if (!(await userConfirmed)) {
|
||||
exit(0)
|
||||
}
|
||||
|
||||
printInfo(`Installing update via ${packageManager}...`)
|
||||
|
||||
const updateProcess = spawn(updateCommand, {
|
||||
stdio: "inherit",
|
||||
shell: true,
|
||||
env: process.env,
|
||||
windowsHide: true,
|
||||
})
|
||||
|
||||
updateProcess.on("close", (code) => {
|
||||
if (code === 0) {
|
||||
printInfo(`Successfully updated to version ${latestVersion}`)
|
||||
exit(0)
|
||||
} else {
|
||||
printWarning(`Update failed. Please try running: ${updateCommand}`)
|
||||
exit(1)
|
||||
if (canCheckClineVersion) {
|
||||
printInfo(`Latest version: ${latestClineVersion}`)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
updateProcess.on("error", (err) => {
|
||||
printWarning(`Failed to run update: ${err.message}`)
|
||||
printInfo(`Please try running manually: ${updateCommand}`)
|
||||
if (!canCheckClineVersion) {
|
||||
printWarning("Failed to check for Cline updates: could not fetch latest version")
|
||||
}
|
||||
|
||||
const clineComparison = latestClineVersion ? compareVersions(currentVersion, latestClineVersion) : null
|
||||
const clineUpdateAvailable = clineComparison !== null && clineComparison < 0
|
||||
const clineIsUpToDate = clineComparison !== null && clineComparison === 0
|
||||
const canUpdateCline = clineUpdateAvailable && Boolean(updateCommand)
|
||||
|
||||
if (clineUpdateAvailable && latestClineVersion) {
|
||||
printInfo(`New version available: ${latestClineVersion} (current: ${currentVersion})`)
|
||||
}
|
||||
|
||||
if (clineUpdateAvailable && !updateCommand) {
|
||||
printInfo("Unable to determine Cline update command for your installation.")
|
||||
printInfo("Please update Cline manually using your package manager.")
|
||||
}
|
||||
|
||||
const kanbanInstallCommand = includeKanban ? resolveKanbanInstallCommand() : null
|
||||
const kanbanInstallerAvailable = kanbanInstallCommand !== null
|
||||
if (includeKanban && !kanbanInstallerAvailable && options.verbose) {
|
||||
printWarning("Unable to determine Kanban update command (npm, pnpm, or bun not found in PATH).")
|
||||
}
|
||||
const latestKanbanVersion = kanbanInstallerAvailable ? await getLatestKanbanVersion() : null
|
||||
const installedKanbanVersion = includeKanban ? getInstalledKanbanVersion() : null
|
||||
const kanbanIsUpToDate =
|
||||
latestKanbanVersion !== null &&
|
||||
installedKanbanVersion !== null &&
|
||||
compareVersions(installedKanbanVersion, latestKanbanVersion) >= 0
|
||||
const shouldInstallKanban =
|
||||
kanbanInstallerAvailable &&
|
||||
latestKanbanVersion !== null &&
|
||||
(installedKanbanVersion === null || compareVersions(installedKanbanVersion, latestKanbanVersion) < 0)
|
||||
|
||||
if (!canCheckClineVersion && !shouldInstallKanban) {
|
||||
exit(1)
|
||||
})
|
||||
}
|
||||
|
||||
if (!canUpdateCline && !shouldInstallKanban) {
|
||||
if (clineIsUpToDate && kanbanIsUpToDate && installedKanbanVersion) {
|
||||
printInfo(`You are already on the latest version cline@${currentVersion} and kanban@${installedKanbanVersion}`)
|
||||
} else if (clineIsUpToDate) {
|
||||
printInfo(`You are already on the latest version cline@${currentVersion}`)
|
||||
}
|
||||
exit(0)
|
||||
}
|
||||
|
||||
let hadFailure = false
|
||||
const installedUpdates: string[] = []
|
||||
|
||||
if (canUpdateCline && updateCommand && latestClineVersion) {
|
||||
printInfo(`Installing cline@${latestClineVersion}...`)
|
||||
try {
|
||||
const clineUpdateCode = await runClineUpdate(updateCommand)
|
||||
if (clineUpdateCode === 0) {
|
||||
installedUpdates.push(`cline@${latestClineVersion}`)
|
||||
} else {
|
||||
printWarning(`Cline update failed. Please try running: ${updateCommand}`)
|
||||
hadFailure = true
|
||||
}
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error)
|
||||
printWarning(`Failed to run Cline update: ${message}`)
|
||||
printInfo(`Please try running manually: ${updateCommand}`)
|
||||
hadFailure = true
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldInstallKanban && kanbanInstallCommand && latestKanbanVersion) {
|
||||
const kanbanTargetVersion = latestKanbanVersion ?? "latest"
|
||||
printInfo(`Installing kanban@${kanbanTargetVersion}...`)
|
||||
try {
|
||||
const kanbanUpdateCode = await runKanbanUpdate(kanbanInstallCommand)
|
||||
if (kanbanUpdateCode === 0) {
|
||||
installedUpdates.push(`kanban@${kanbanTargetVersion}`)
|
||||
} else {
|
||||
printWarning(`Kanban update failed. Please try running: ${kanbanInstallCommand.displayCommand}`)
|
||||
hadFailure = true
|
||||
}
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error)
|
||||
printWarning(`Failed to run Kanban update: ${message}`)
|
||||
if (kanbanInstallCommand) {
|
||||
printInfo(`Please try running manually: ${kanbanInstallCommand.displayCommand}`)
|
||||
}
|
||||
hadFailure = true
|
||||
}
|
||||
}
|
||||
|
||||
if (!hadFailure) {
|
||||
if (installedUpdates.length > 1) {
|
||||
printSuccess(`Installed updates for ${formatUpdateSummaryTargets(installedUpdates)}`)
|
||||
} else if (installedUpdates.length === 1) {
|
||||
printSuccess(`Installed update for ${installedUpdates[0]}`)
|
||||
} else {
|
||||
printInfo("No updates were installed.")
|
||||
}
|
||||
}
|
||||
|
||||
if (hadFailure) {
|
||||
exit(1)
|
||||
}
|
||||
|
||||
if (canUpdateCline || shouldInstallKanban) {
|
||||
exit(0)
|
||||
}
|
||||
exit(1)
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error)
|
||||
printWarning(`Error checking for updates: ${message}`)
|
||||
@@ -259,7 +387,7 @@ function parseVersion(version: string): ParsedVersion {
|
||||
return {
|
||||
base: nightlyMatch[1].split(".").map(Number),
|
||||
isNightly: true,
|
||||
timestamp: parseInt(nightlyMatch[2], 10),
|
||||
timestamp: Number.parseInt(nightlyMatch[2], 10),
|
||||
}
|
||||
}
|
||||
return {
|
||||
|
||||
+37
-8
@@ -258,7 +258,7 @@
|
||||
"enterprise-solutions/sso-setup",
|
||||
"enterprise-solutions/team-management/managing-members",
|
||||
{
|
||||
"group": "SaaS Provider Configuration",
|
||||
"group": "Remote Provider Configuration",
|
||||
"pages": [
|
||||
"enterprise-solutions/configuration/remote-configuration/overview",
|
||||
{
|
||||
@@ -268,19 +268,33 @@
|
||||
"enterprise-solutions/configuration/remote-configuration/aws-bedrock/member-configuration"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "LiteLLM",
|
||||
"pages": [
|
||||
"enterprise-solutions/configuration/remote-configuration/litellm/admin-configuration",
|
||||
"enterprise-solutions/configuration/remote-configuration/litellm/member-configuration"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Google Vertex AI",
|
||||
"pages": [
|
||||
"enterprise-solutions/configuration/remote-configuration/google-vertex/admin-configuration",
|
||||
"enterprise-solutions/configuration/remote-configuration/google-vertex/member-configuration"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "OpenAI Compatible",
|
||||
"pages": [
|
||||
"enterprise-solutions/configuration/remote-configuration/openai-compatible/admin-configuration",
|
||||
"enterprise-solutions/configuration/remote-configuration/openai-compatible/member-configuration"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Anthropic",
|
||||
"pages": [
|
||||
"enterprise-solutions/configuration/remote-configuration/anthropic/admin-configuration",
|
||||
"enterprise-solutions/configuration/remote-configuration/anthropic/member-configuration"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "LiteLLM",
|
||||
"pages": [
|
||||
"enterprise-solutions/configuration/remote-configuration/litellm/admin-configuration",
|
||||
"enterprise-solutions/configuration/remote-configuration/litellm/member-configuration"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -332,6 +346,21 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tab": "Kanban",
|
||||
"icon": "table-columns",
|
||||
"groups": [
|
||||
{
|
||||
"group": "Cline Kanban",
|
||||
"pages": [
|
||||
"kanban/overview",
|
||||
"kanban/getting-started",
|
||||
"kanban/core-workflow",
|
||||
"kanban/features"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tab": "Learn",
|
||||
"icon": "graduation-cap",
|
||||
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
---
|
||||
title: "Configure Anthropic Provider (Admin)"
|
||||
sidebarTitle: "Configure Anthropic (Admin)"
|
||||
description: "This guide explains how administrators configure Anthropic as the organization-wide LLM provider for Cline."
|
||||
---
|
||||
|
||||
|
||||
As an administrator, you can add Anthropic as the organization-wide LLM provider for all Cline users through the hosted admin console. This centralized approach provides direct access to Anthropic's Claude models, with an optional custom base URL for organizations that route traffic through a proxy.
|
||||
|
||||
## Before You Begin
|
||||
|
||||
To get started with setting up Anthropic as your organization's LLM provider, you'll need a few items in place.
|
||||
|
||||
**Administrator access to the Cline Admin console**
|
||||
You need admin privileges to enforce provider settings across your organization. If you can navigate to **Settings → Cline Settings** in the admin console at [app.cline.bot](https://app.cline.bot), you have the right access level.
|
||||
|
||||
**Anthropic API access**
|
||||
Your organization needs an Anthropic account with API access to Claude models. Members will need individual API keys to authenticate.
|
||||
|
||||
<Note>
|
||||
If your organization requires routing API traffic through a proxy or custom endpoint, have the proxy URL ready before configuring.
|
||||
</Note>
|
||||
|
||||
## Configuration Steps
|
||||
|
||||
<Steps>
|
||||
<Step title="Access Cline Settings">
|
||||
Navigate to [app.cline.bot](https://app.cline.bot) and sign in with your administrator account. Go to **Settings → Cline Settings**.
|
||||
|
||||
<Info>
|
||||
You should see the provider configuration options if you have the correct admin access level.
|
||||
</Info>
|
||||
</Step>
|
||||
|
||||
<Step title="Enable Remote Provider Configuration">
|
||||
Toggle on **Enable settings** to reveal the remote provider configuration options. This allows you to enforce provider settings across your organization.
|
||||
</Step>
|
||||
|
||||
<Step title="Select Anthropic as the API Provider">
|
||||
Open the **API Provider** dropdown menu and select **Anthropic**. This will open the Anthropic configuration panel where you'll configure all your organization-wide settings.
|
||||
</Step>
|
||||
|
||||
<Step title="Configure Anthropic Settings">
|
||||
The configuration panel includes settings that control how Anthropic works for your organization:
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="Base URL (optional)">
|
||||
By default, Cline connects directly to the Anthropic API (`https://api.anthropic.com`). If your organization routes API traffic through a proxy or custom endpoint, enter the base URL here.
|
||||
|
||||
Use cases for a custom base URL:
|
||||
- Corporate proxy that logs or filters API traffic
|
||||
- Self-hosted API gateway for rate limiting or access control
|
||||
- Regional routing requirements
|
||||
|
||||
Leave this empty to use the default Anthropic API endpoint.
|
||||
|
||||
<Tip>
|
||||
If using a proxy, ensure it correctly forwards requests to the Anthropic API and preserves all required headers.
|
||||
</Tip>
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
</Step>
|
||||
|
||||
<Step title="Save Configuration">
|
||||
After configuring your settings, close the provider configuration panel and click **Save** on the settings page to persist your changes.
|
||||
|
||||
Once saved, all organization members signed into the Cline extension will automatically use Anthropic with your configured settings. They won't be able to select other providers or switch to their personal Cline accounts.
|
||||
|
||||
<Warning>
|
||||
Members can't switch to personal Cline accounts or join other organizations once remote configuration is enabled. This ensures consistent provider usage across your team.
|
||||
</Warning>
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## Verification
|
||||
|
||||
To verify the configuration:
|
||||
|
||||
1. Check that the provider shows as "Anthropic" in the Enabled provider field
|
||||
2. Confirm the settings persist after refreshing the page
|
||||
3. Test with a member account to ensure they see only Anthropic as a provider
|
||||
4. Verify that Claude models are available in the model dropdown
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Members don't see the configured provider**
|
||||
Ensure you clicked Save after closing the configuration panel. Verify the member account belongs to the correct organization.
|
||||
|
||||
**Connection errors when using a custom base URL**
|
||||
Verify the proxy URL is correct and accessible from your team's development environments. Ensure the proxy correctly forwards requests to the Anthropic API.
|
||||
|
||||
**Configuration changes don't persist**
|
||||
Make sure to click the Save button on the main settings page, not just close the configuration panel.
|
||||
|
||||
**Need to change settings later**
|
||||
You can update the base URL or other settings at any time. Changes take effect immediately for all organization members.
|
||||
|
||||
For further details, consult the [Anthropic API documentation](https://docs.anthropic.com/) and coordinate with your infrastructure team.
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
---
|
||||
title: "Configure Anthropic in VS Code (Members)"
|
||||
sidebarTitle: "Configure Anthropic (Member)"
|
||||
description: "Guide for engineers connecting to their organization's Anthropic provider through VS Code after admin setup"
|
||||
---
|
||||
|
||||
As a team member, you can connect your local development environment to your organization's Anthropic provider setup. This guide walks you through configuring your API key in VS Code so you can start using Claude models through your organization's configuration. Your administrator has already configured the provider settings — you just need to add your API key to get started.
|
||||
|
||||
## Before You Begin
|
||||
|
||||
To successfully connect to your organization's Anthropic provider, you'll need a few things ready.
|
||||
|
||||
**Cline extension installed and configured**
|
||||
The Cline extension must be installed in VS Code and you need to be signed into your organization account. If you haven't installed Cline yet, follow our [installation guide](/getting-started/installing-cline).
|
||||
|
||||
<Info>
|
||||
**Quick Check**: Open the Cline panel in VS Code. If you see your organization name in the bottom left, you're signed in correctly.
|
||||
</Info>
|
||||
|
||||
**Anthropic API key**
|
||||
You need an API key from Anthropic to authenticate requests. Your organization may provide keys centrally or require you to create one through the [Anthropic Console](https://console.anthropic.com/).
|
||||
|
||||
<Note>
|
||||
If you're unsure how to obtain an API key, check with your administrator about your organization's key provisioning process.
|
||||
</Note>
|
||||
|
||||
## Configuration Steps
|
||||
|
||||
<Steps>
|
||||
<Step title="Open Cline Settings">
|
||||
Open VS Code and access the Cline settings panel using either of these methods:
|
||||
|
||||
- Click the settings icon (⚙️) in the Cline panel
|
||||
- Click on the API Provider dropdown located directly below the chat area
|
||||
|
||||
</Step>
|
||||
|
||||
<Step title="Enter Your API Key">
|
||||
|
||||
1. Select or confirm the **Anthropic** provider is selected
|
||||
2. Enter your Anthropic API key in the **API Key** field
|
||||
3. If your administrator configured a custom base URL, it will already be set and locked
|
||||
4. Click **Save** to store your credentials
|
||||
|
||||
<Tip>
|
||||
API keys are stored locally and are only used by the Cline extension.
|
||||
</Tip>
|
||||
|
||||
<Note>
|
||||
The base URL setting is controlled by your administrator. If a custom proxy URL is configured, your API requests will be routed through it automatically.
|
||||
</Note>
|
||||
</Step>
|
||||
|
||||
<Step title="Verify Configuration">
|
||||
After entering your API key, administrator-controlled settings (such as base URL) will be locked (shown with a lock icon 🔒) as they're managed by your organization.
|
||||
</Step>
|
||||
|
||||
<Step title="Test the Connection">
|
||||
Send a test message in Cline to verify your API key works correctly with the configured Anthropic endpoint.
|
||||
|
||||
<Tip>
|
||||
**Testing Recommendation**
|
||||
|
||||
Try a simple test like "Hello" first to verify basic connectivity before starting development tasks.
|
||||
</Tip>
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Anthropic not available as provider option**
|
||||
Confirm you're signed into the correct Cline organization. Verify your administrator has saved the Anthropic configuration and that you have the latest version of the Cline extension.
|
||||
|
||||
**Authentication errors ("Invalid API Key" or "Unauthorized")**
|
||||
Verify your API key is correct and active. Check the [Anthropic Console](https://console.anthropic.com/) to confirm your key status and that it has sufficient permissions.
|
||||
|
||||
**Connection errors or timeouts**
|
||||
If your administrator configured a custom base URL (proxy), check with your IT team about network requirements. If using the default Anthropic endpoint, ensure you have internet access to `api.anthropic.com`.
|
||||
|
||||
**Models not available**
|
||||
The available models depend on your Anthropic API plan and your organization's configuration. Contact your administrator if expected models are not available.
|
||||
|
||||
**Rate limit errors**
|
||||
Your API key may have rate limits configured by Anthropic. If you encounter rate limit errors during normal use, contact your administrator about adjusting limits or managing key usage across the team.
|
||||
|
||||
## Security Best Practices
|
||||
|
||||
When working with your Anthropic API key:
|
||||
|
||||
- Keep your API key secure and do not share it
|
||||
- Never store your API key in code or version control
|
||||
- Report any suspected key compromise to your administrator immediately
|
||||
- Regularly check the [Anthropic Console](https://console.anthropic.com/) for unusual usage patterns
|
||||
|
||||
For further details, consult the [Anthropic API documentation](https://docs.anthropic.com/) and coordinate with your organization's administrator.
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
---
|
||||
title: "Configure OpenAI Compatible Provider (Admin)"
|
||||
sidebarTitle: "Configure OpenAI Compatible (Admin)"
|
||||
description: "This guide explains how administrators configure an OpenAI-compatible endpoint as the organization-wide LLM provider for Cline."
|
||||
---
|
||||
|
||||
|
||||
As an administrator, you can add an OpenAI-compatible endpoint as the organization-wide LLM provider for all Cline users through the hosted admin console. This covers any provider that exposes an OpenAI-compatible API, including Azure Foundry (Azure OpenAI), self-hosted inference engines (vLLM, TGI), and other compatible services.
|
||||
|
||||
## Before You Begin
|
||||
|
||||
To get started with setting up an OpenAI-compatible provider for your organization, you'll need a few items in place.
|
||||
|
||||
**Administrator access to the Cline Admin console**
|
||||
You need admin privileges to enforce provider settings across your organization. If you can navigate to **Settings → Cline Settings** in the admin console at [app.cline.bot](https://app.cline.bot), you have the right access level.
|
||||
|
||||
**An OpenAI-compatible API endpoint**
|
||||
You need a running endpoint that implements the OpenAI chat completions API. This could be:
|
||||
- Azure Foundry (Azure OpenAI Service)
|
||||
- A self-hosted inference engine (vLLM, text-generation-inference, etc.)
|
||||
- Any third-party service with an OpenAI-compatible API
|
||||
|
||||
<Note>
|
||||
If you're using Azure Foundry, you'll need your Azure OpenAI endpoint URL and optionally the API version. Work with your Azure administrator to ensure the endpoint is provisioned and accessible.
|
||||
</Note>
|
||||
|
||||
**Endpoint URL and authentication details**
|
||||
You'll need the base URL of your endpoint and any required authentication headers.
|
||||
|
||||
## Configuration Steps
|
||||
|
||||
<Steps>
|
||||
<Step title="Access Cline Settings">
|
||||
Navigate to [app.cline.bot](https://app.cline.bot) and sign in with your administrator account. Go to **Settings → Cline Settings**.
|
||||
|
||||
<Info>
|
||||
You should see the provider configuration options if you have the correct admin access level.
|
||||
</Info>
|
||||
</Step>
|
||||
|
||||
<Step title="Enable Remote Provider Configuration">
|
||||
Toggle on **Enable settings** to reveal the remote provider configuration options. This allows you to enforce provider settings across your organization.
|
||||
</Step>
|
||||
|
||||
<Step title="Select OpenAI Compatible as the API Provider">
|
||||
Open the **API Provider** dropdown menu and select **OpenAI Compatible**. This will open the configuration panel where you'll configure all your organization-wide settings.
|
||||
</Step>
|
||||
|
||||
<Step title="Configure OpenAI Compatible Settings">
|
||||
The configuration panel includes settings that control how the provider works for your organization:
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="Base URL (required)">
|
||||
Enter the base URL of your OpenAI-compatible endpoint. Examples:
|
||||
|
||||
- **Azure Foundry**: `https://your-resource.openai.azure.com`
|
||||
- **Self-hosted vLLM**: `https://inference.yourcompany.com/v1`
|
||||
- **Other compatible services**: The provider's API base URL
|
||||
|
||||
<Tip>
|
||||
Use HTTPS endpoints in production for security. Ensure the URL is accessible from your team's development environments.
|
||||
</Tip>
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Custom Headers (optional)">
|
||||
Add custom HTTP headers that will be included with every API request. This is useful for:
|
||||
|
||||
- Custom authentication schemes beyond API keys
|
||||
- Routing headers for internal load balancers
|
||||
- Organization or tenant identifiers required by your endpoint
|
||||
|
||||
Headers are configured as key-value pairs.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Azure API Version (optional — Azure Foundry only)">
|
||||
If you're using Azure Foundry (Azure OpenAI), specify the API version string. For example: `2024-02-15-preview` or `2024-06-01`.
|
||||
|
||||
This field is only needed for Azure OpenAI deployments. Leave it empty for non-Azure endpoints.
|
||||
|
||||
<Note>
|
||||
Check the [Azure OpenAI API version documentation](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference) for available versions.
|
||||
</Note>
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Azure Identity Authentication (optional — Azure Foundry only)">
|
||||
Enable this to use Azure Active Directory (Entra ID) token-based authentication instead of API keys. When enabled, members authenticate using their Azure AD credentials rather than a static API key.
|
||||
|
||||
This field is only relevant for Azure Foundry deployments.
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
</Step>
|
||||
|
||||
<Step title="Save Configuration">
|
||||
After configuring your settings, close the provider configuration panel and click **Save** on the settings page to persist your changes.
|
||||
|
||||
Once saved, all organization members signed into the Cline extension will automatically use the OpenAI Compatible provider with your configured settings. They won't be able to select other providers or switch to their personal Cline accounts.
|
||||
|
||||
<Warning>
|
||||
Members can't switch to personal Cline accounts or join other organizations once remote configuration is enabled. This ensures consistent provider usage across your team.
|
||||
</Warning>
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## Azure Foundry Configuration
|
||||
|
||||
For organizations using Azure Foundry (Azure OpenAI Service), use the following configuration:
|
||||
|
||||
1. **Base URL**: Your Azure OpenAI endpoint (e.g., `https://your-resource.openai.azure.com`)
|
||||
2. **Azure API Version**: The API version to use (e.g., `2024-06-01`)
|
||||
3. **Azure Identity Authentication**: Enable if your organization uses Azure AD for authentication instead of API keys
|
||||
|
||||
## Verification
|
||||
|
||||
To verify the configuration:
|
||||
|
||||
1. Check that the provider shows as "OpenAI Compatible" in the Enabled provider field
|
||||
2. Confirm the settings persist after refreshing the page
|
||||
3. Test with a member account to ensure they see only the OpenAI Compatible provider
|
||||
4. Verify that configured models are available in the model dropdown
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Members don't see the configured provider**
|
||||
Ensure you clicked Save after closing the configuration panel. Verify the member account belongs to the correct organization.
|
||||
|
||||
**Connection errors to the endpoint**
|
||||
Verify the Base URL is correct and accessible from your team's development environments. Check that any firewalls or security groups allow access from developer IP addresses.
|
||||
|
||||
**Azure authentication failures**
|
||||
If using Azure Identity Authentication, verify that members' Azure AD accounts have the appropriate role assignments on the Azure OpenAI resource. If using API keys, verify the key is correctly entered by the member.
|
||||
|
||||
**Configuration changes don't persist**
|
||||
Make sure to click the Save button on the main settings page, not just close the configuration panel.
|
||||
|
||||
**Need to change endpoint or settings later**
|
||||
You can update these settings at any time. Changes take effect immediately for all organization members.
|
||||
|
||||
For Azure Foundry, consult the [Azure OpenAI Service documentation](https://learn.microsoft.com/en-us/azure/ai-services/openai/). For other OpenAI-compatible endpoints, refer to your provider's documentation.
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
---
|
||||
title: "Configure OpenAI Compatible in VS Code (Members)"
|
||||
sidebarTitle: "Configure OpenAI Compatible (Member)"
|
||||
description: "Guide for engineers connecting to their organization's OpenAI-compatible endpoint through VS Code after admin setup"
|
||||
---
|
||||
|
||||
As a team member, you can connect your local development environment to your organization's OpenAI-compatible endpoint. This guide walks you through configuring your credentials in VS Code so you can start using models through your organization's configured endpoint. Your administrator has already configured the provider settings — you just need to add your API key to get started.
|
||||
|
||||
## Before You Begin
|
||||
|
||||
To successfully connect to your organization's OpenAI-compatible endpoint, you'll need a few things ready.
|
||||
|
||||
**Cline extension installed and configured**
|
||||
The Cline extension must be installed in VS Code and you need to be signed into your organization account. If you haven't installed Cline yet, follow our [installation guide](/getting-started/installing-cline).
|
||||
|
||||
<Info>
|
||||
**Quick Check**: Open the Cline panel in VS Code. If you see your organization name in the bottom left, you're signed in correctly.
|
||||
</Info>
|
||||
|
||||
**API key or credentials for your endpoint**
|
||||
You need an API key or credentials to authenticate with your organization's configured endpoint. For Azure Foundry deployments using Azure Identity Authentication, your Azure AD credentials may be used instead.
|
||||
|
||||
<Note>
|
||||
If you're unsure what credentials to use, check with your administrator or IT team about how your organization has configured access.
|
||||
</Note>
|
||||
|
||||
## Configuration Steps
|
||||
|
||||
<Steps>
|
||||
<Step title="Open Cline Settings">
|
||||
Open VS Code and access the Cline settings panel using either of these methods:
|
||||
|
||||
- Click the settings icon (⚙️) in the Cline panel
|
||||
- Click on the API Provider dropdown located directly below the chat area
|
||||
|
||||
</Step>
|
||||
|
||||
<Step title="Configure Your Credentials">
|
||||
The authentication method depends on how your administrator configured the endpoint:
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="API Key Authentication">
|
||||
For most OpenAI-compatible endpoints:
|
||||
|
||||
1. Select or confirm the **OpenAI Compatible** provider is selected
|
||||
2. Enter your API key in the **API Key** field
|
||||
3. The base URL, custom headers, and other settings are preconfigured by your administrator
|
||||
4. Click **Save** to store your credentials
|
||||
|
||||
<Tip>
|
||||
API keys are stored locally and are only used by the Cline extension.
|
||||
</Tip>
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Azure Identity Authentication (Azure Foundry)">
|
||||
If your organization uses Azure AD authentication:
|
||||
|
||||
1. Select or confirm the **OpenAI Compatible** provider is selected
|
||||
2. Ensure you are signed into Azure in your development environment
|
||||
3. The extension will use your Azure AD credentials automatically
|
||||
4. No API key is needed when Azure Identity Authentication is enabled
|
||||
|
||||
<Note>
|
||||
You may need the Azure Account extension or Azure CLI installed for credential resolution.
|
||||
</Note>
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
<Note>
|
||||
The Base URL, custom headers, Azure API version, and Azure Identity settings are preconfigured by your administrator and do not need to be set in the extension.
|
||||
</Note>
|
||||
</Step>
|
||||
|
||||
<Step title="Verify Configuration">
|
||||
After configuring your credentials, administrator-controlled settings will be locked (shown with a lock icon 🔒) as they're managed by your organization.
|
||||
</Step>
|
||||
|
||||
<Step title="Test the Connection">
|
||||
Send a test message in Cline to verify your credentials work correctly with the configured endpoint.
|
||||
|
||||
<Tip>
|
||||
**Testing Recommendation**
|
||||
|
||||
Try a simple test like "Hello" first to verify basic connectivity before starting development tasks.
|
||||
</Tip>
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**OpenAI Compatible not available as provider option**
|
||||
Confirm you're signed into the correct Cline organization. Verify your administrator has saved the configuration and that you have the latest version of the Cline extension.
|
||||
|
||||
**Authentication errors ("Access Denied" or "Invalid API Key")**
|
||||
Verify your API key is correct and active. For Azure Foundry with Azure Identity Authentication, ensure you are signed into Azure in your development environment and that your account has the appropriate role assignments on the Azure OpenAI resource.
|
||||
|
||||
**Connection errors or timeouts**
|
||||
The endpoint URL is configured by your administrator. If you experience connection issues, check with your IT team about network requirements (VPN, firewall rules, etc.).
|
||||
|
||||
**Models not available**
|
||||
The available models depend on your organization's endpoint configuration. Contact your administrator if expected models are not available in the model dropdown.
|
||||
|
||||
**Configuration changes don't persist**
|
||||
Make sure to save your credentials. The base URL and other admin-controlled settings cannot be changed locally.
|
||||
|
||||
## Security Best Practices
|
||||
|
||||
When working with your API credentials:
|
||||
|
||||
- Keep your API key secure and do not share it
|
||||
- Never store credentials in code or version control
|
||||
- Report any suspected key compromise to your administrator immediately
|
||||
- Follow your organization's usage guidelines for the configured endpoint
|
||||
|
||||
Your organization administrator controls which endpoint, models, and settings are available. The extension will automatically apply the configured settings based on your organization's remote configuration.
|
||||
|
||||
For Azure Foundry, refer to the [Azure OpenAI Service documentation](https://learn.microsoft.com/en-us/azure/ai-services/openai/). For other endpoints, consult your organization's internal documentation or contact your administrator.
|
||||
@@ -1,11 +1,11 @@
|
||||
---
|
||||
title: "SaaS Provider Configuration"
|
||||
title: "Enterprise Provider Configuration"
|
||||
sidebarTitle: "Overview"
|
||||
description: "Configure inference providers through the Cline hosted admin console for centralized organization management"
|
||||
---
|
||||
|
||||
|
||||
SaaS Provider Configuration allows administrators to centrally configure inference providers for their entire organization through the Cline hosted admin console. This approach ensures consistent provider access, security policies, and cost management across all team members without requiring individual developer setup or infrastructure deployment.
|
||||
Remote Provider Configuration allows administrators to centrally configure inference providers for their entire organization through the Cline hosted admin console. This approach ensures consistent provider access, security policies, and cost management across all team members without requiring individual developer setup or infrastructure deployment.
|
||||
|
||||
## How Remote Configuration Works
|
||||
|
||||
@@ -35,11 +35,17 @@ Cline supports remote configuration for the following inference providers:
|
||||
|
||||
| Provider | Use Case | Configuration | Member Setup |
|
||||
|----------|----------|---------------|--------------|
|
||||
| **Cline** | Organizations using Cline's native provider with centralized API key management | API provider selection, model access | No individual API keys needed - fully managed by organization |
|
||||
| **Amazon Bedrock** | Organizations using AWS infrastructure | Region selection, VPC endpoints, cross-region inference, prompt caching | AWS credential configuration in VS Code |
|
||||
| **LiteLLM** | Organizations requiring multi-model access through a unified proxy | Proxy endpoint, authentication, model routing | API key or endpoint configuration in VS Code (or centralized with Master Key) |
|
||||
| **Google Vertex AI** | Organizations using Google Cloud Platform | Project ID, region selection, model access | Service account or credential configuration in VS Code |
|
||||
| **Cline** | Organizations using Cline's native provider with centralized API key management | API provider selection, model access | No individual API keys needed — fully managed by organization |
|
||||
| **Amazon Bedrock** | Organizations using AWS infrastructure | Region selection, VPC endpoints, cross-region inference, global inference, prompt caching | AWS credential configuration (API key, CLI profile, or credential chain) |
|
||||
| **Google Vertex AI** | Organizations using Google Cloud Platform | Project ID, region selection, model access | Google Cloud credential configuration (service account, SDK, or ADC) |
|
||||
| **Azure Foundry** | Organizations using Azure OpenAI or Azure AI services | Base URL, Azure API version, Azure identity authentication, custom headers | API key configuration in the extension |
|
||||
| **Anthropic** | Organizations using the Anthropic API directly | Optional custom base URL for proxy deployments, model access | API key configuration in the extension |
|
||||
| **OpenAI Compatible** | Organizations using any OpenAI-compatible endpoint (self-hosted, vLLM, custom proxies) | Base URL, custom headers, model access | API key configuration in the extension |
|
||||
| **LiteLLM** | Organizations requiring multi-model access through a unified proxy | Proxy endpoint, authentication, model routing | API key or endpoint configuration (or centralized with Master Key) |
|
||||
|
||||
<Note>
|
||||
**Azure Foundry** uses the OpenAI Compatible provider configuration with Azure-specific settings (API version, Azure identity authentication). See the [OpenAI Compatible admin configuration](/enterprise-solutions/configuration/remote-configuration/openai-compatible/admin-configuration) for setup instructions.
|
||||
</Note>
|
||||
|
||||
## Configuration Process
|
||||
|
||||
@@ -55,7 +61,7 @@ Provider configuration is automatically distributed to all organization members
|
||||
</Step>
|
||||
|
||||
<Step title="Member Credential Setup">
|
||||
Team members add their individual credentials (API keys, AWS profiles, etc.) to connect to the configured provider.
|
||||
Team members add their individual credentials (API keys, AWS profiles, etc.) to connect to the configured provider. For some providers like Cline and LiteLLM (with Master Key), no individual credentials are needed.
|
||||
</Step>
|
||||
|
||||
<Step title="Immediate Access">
|
||||
@@ -92,11 +98,19 @@ Select your provider below to begin the configuration process:
|
||||
AWS-based AI models with enterprise security and compliance features.
|
||||
</Card>
|
||||
|
||||
<Card title="Google Vertex AI" icon="google" href="/enterprise-solutions/configuration/remote-configuration/google-vertex/admin-configuration">
|
||||
Google Cloud's AI platform with Gemini models and regional control.
|
||||
</Card>
|
||||
|
||||
<Card title="OpenAI Compatible" icon="plug" href="/enterprise-solutions/configuration/remote-configuration/openai-compatible/admin-configuration">
|
||||
Any OpenAI-compatible endpoint, including Azure Foundry.
|
||||
</Card>
|
||||
|
||||
<Card title="Anthropic" icon="robot" href="/enterprise-solutions/configuration/remote-configuration/anthropic/admin-configuration">
|
||||
Direct access to Anthropic's Claude models with optional proxy routing.
|
||||
</Card>
|
||||
|
||||
<Card title="LiteLLM" icon="layer-group" href="/enterprise-solutions/configuration/remote-configuration/litellm/admin-configuration">
|
||||
Unified proxy for accessing 100+ AI models through a single interface.
|
||||
</Card>
|
||||
|
||||
<Card title="Google Vertex AI" icon="google" href="/enterprise-solutions/configuration/remote-configuration/google-vertex/admin-configuration">
|
||||
Google Cloud's AI platform with advanced ML capabilities and global infrastructure.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
---
|
||||
title: "OpenTelemetry Environment Variables"
|
||||
sidebarTitle: "OpenTelemetry Override"
|
||||
description: "Configure OpenTelemetry using environment variables for advanced scenarios"
|
||||
---
|
||||
|
||||
<Note>
|
||||
This is an **advanced configuration method**. Most users should use [Remote Configuration](/enterprise-solutions/monitoring/opentelemetry) via the dashboard instead.
|
||||
</Note>
|
||||
|
||||
Environment variables provide an alternative way to configure OpenTelemetry, useful for self-hosted deployments, local development, CI/CD pipelines, or when you need to override organization settings.
|
||||
|
||||
## When to Use
|
||||
|
||||
- **Self-hosted deployments** without dashboard access
|
||||
- **Local development and testing** with your own collectors
|
||||
- **CI/CD pipelines** that need observability
|
||||
- **Override organization settings** with user-specific configuration
|
||||
|
||||
<Warning>
|
||||
Environment variable configuration bypasses user telemetry settings and will export data regardless of individual preferences.
|
||||
</Warning>
|
||||
|
||||
## Environment Variables
|
||||
|
||||
### Core Configuration
|
||||
|
||||
| Variable | Description | Values |
|
||||
|----------|-------------|--------|
|
||||
| `CLINE_OTEL_TELEMETRY_ENABLED` | Enable OpenTelemetry export | `"true"` or `"false"` |
|
||||
| `CLINE_OTEL_METRICS_EXPORTER` | Metrics exporters (comma-separated) | `"console"`, `"otlp"` |
|
||||
| `CLINE_OTEL_LOGS_EXPORTER` | Logs exporters (comma-separated) | `"console"`, `"otlp"` |
|
||||
|
||||
### OTLP Configuration
|
||||
|
||||
| Variable | Description | Values |
|
||||
|----------|-------------|--------|
|
||||
| `CLINE_OTEL_EXPORTER_OTLP_PROTOCOL` | OTLP protocol | `"grpc"`, `"http/json"`, or `"http/protobuf"` |
|
||||
| `CLINE_OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP collector endpoint (applies to both metrics and logs) | URL with optional port |
|
||||
| `CLINE_OTEL_EXPORTER_OTLP_HEADERS` | Authentication headers (comma-separated `key=value` pairs) | `"key=value,key2=value2"` |
|
||||
| `CLINE_OTEL_EXPORTER_OTLP_INSECURE` | Disable TLS for gRPC (local development only) | `"true"` |
|
||||
|
||||
### Advanced OTLP Configuration
|
||||
|
||||
For separate metrics and logs endpoints:
|
||||
|
||||
| Variable | Description |
|
||||
|----------|-------------|
|
||||
| `CLINE_OTEL_EXPORTER_OTLP_METRICS_PROTOCOL` | Metrics-specific protocol override |
|
||||
| `CLINE_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` | Metrics-specific endpoint |
|
||||
| `CLINE_OTEL_EXPORTER_OTLP_LOGS_PROTOCOL` | Logs-specific protocol override |
|
||||
| `CLINE_OTEL_EXPORTER_OTLP_LOGS_ENDPOINT` | Logs-specific endpoint |
|
||||
|
||||
### Export Tuning
|
||||
|
||||
| Variable | Description | Default |
|
||||
|----------|-------------|---------|
|
||||
| `CLINE_OTEL_METRIC_EXPORT_INTERVAL` | Milliseconds between metric exports | 60000 |
|
||||
| `CLINE_OTEL_LOG_BATCH_SIZE` | Maximum batch size for log records | 512 |
|
||||
| `CLINE_OTEL_LOG_BATCH_TIMEOUT` | Maximum time before exporting logs (ms) | 5000 |
|
||||
| `CLINE_OTEL_LOG_MAX_QUEUE_SIZE` | Maximum queue size for log records | 2048 |
|
||||
|
||||
## Quick Start Examples
|
||||
|
||||
### Datadog with gRPC
|
||||
|
||||
```bash
|
||||
export CLINE_OTEL_TELEMETRY_ENABLED=true
|
||||
export CLINE_OTEL_METRICS_EXPORTER=otlp
|
||||
export CLINE_OTEL_LOGS_EXPORTER=otlp
|
||||
export CLINE_OTEL_EXPORTER_OTLP_PROTOCOL=grpc
|
||||
export CLINE_OTEL_EXPORTER_OTLP_ENDPOINT=https://api.datadoghq.com:4317
|
||||
export CLINE_OTEL_EXPORTER_OTLP_HEADERS="dd-api-key=YOUR_API_KEY"
|
||||
|
||||
code .
|
||||
```
|
||||
|
||||
<Note>
|
||||
The endpoint shown above is for Datadog's **US1 region**. If you're in a different region (EU, US3, US5, AP1, etc.), replace `api.datadoghq.com` with your region-specific hostname (e.g., `api.datadoghq.eu` for EU). See [Datadog's OTLP documentation](https://docs.datadoghq.com/opentelemetry/) for your region's endpoint.
|
||||
</Note>
|
||||
|
||||
### New Relic with HTTP
|
||||
|
||||
```bash
|
||||
export CLINE_OTEL_TELEMETRY_ENABLED=true
|
||||
export CLINE_OTEL_METRICS_EXPORTER=otlp
|
||||
export CLINE_OTEL_LOGS_EXPORTER=otlp
|
||||
export CLINE_OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
|
||||
export CLINE_OTEL_EXPORTER_OTLP_ENDPOINT=https://otlp.nr-data.net:4318
|
||||
export CLINE_OTEL_EXPORTER_OTLP_HEADERS="api-key=YOUR_LICENSE_KEY"
|
||||
|
||||
code .
|
||||
```
|
||||
|
||||
### Local Development (Insecure)
|
||||
|
||||
```bash
|
||||
export CLINE_OTEL_TELEMETRY_ENABLED=true
|
||||
export CLINE_OTEL_METRICS_EXPORTER=otlp
|
||||
export CLINE_OTEL_LOGS_EXPORTER=otlp
|
||||
export CLINE_OTEL_EXPORTER_OTLP_PROTOCOL=grpc
|
||||
export CLINE_OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
|
||||
export CLINE_OTEL_EXPORTER_OTLP_INSECURE=true
|
||||
|
||||
code .
|
||||
```
|
||||
|
||||
### Console Output (Testing)
|
||||
|
||||
```bash
|
||||
export CLINE_OTEL_TELEMETRY_ENABLED=true
|
||||
export CLINE_OTEL_METRICS_EXPORTER=console
|
||||
export CLINE_OTEL_LOGS_EXPORTER=console
|
||||
|
||||
code .
|
||||
```
|
||||
|
||||
## Debugging
|
||||
|
||||
Enable detailed OpenTelemetry diagnostic logging:
|
||||
|
||||
```bash
|
||||
export TEL_DEBUG_DIAGNOSTICS=true
|
||||
code .
|
||||
```
|
||||
|
||||
This outputs:
|
||||
- Configuration being used
|
||||
- Exporters being created
|
||||
- Connection attempts
|
||||
- Export successes/failures
|
||||
|
||||
Check the VS Code Developer Tools Console (Help > Toggle Developer Tools) for diagnostic output.
|
||||
|
||||
## Configuration Priority
|
||||
|
||||
When multiple configuration methods are present, Cline uses this priority order:
|
||||
|
||||
1. **Environment variables** (highest priority) - This method
|
||||
2. **Remote Configuration** - Dashboard settings
|
||||
3. **Default settings** - Built-in defaults
|
||||
|
||||
Environment variable configuration will override dashboard settings.
|
||||
|
||||
## See Also
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Dashboard Configuration" icon="globe" href="/enterprise-solutions/monitoring/opentelemetry">
|
||||
Configure OpenTelemetry via the web dashboard
|
||||
</Card>
|
||||
|
||||
<Card title="Remote Configuration" icon="server" href="/enterprise-solutions/configuration/remote-configuration/overview">
|
||||
Learn about Remote Configuration system
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -199,8 +199,7 @@ Understanding how seats work helps you manage your license effectively:
|
||||
|
||||
<Accordion title="Upgrading Your License" icon="arrow-up">
|
||||
Need more seats?
|
||||
- **Teams Plan:** Contact your account manager or visit app.cline.bot/settings/billing to upgrade your license.
|
||||
- **Enterprise Plan:** Includes unlimited seats with no per-user restrictions.
|
||||
- **Enterprise Plan:** Includes unlimited seats with no per-user restrictions. Contact your account manager or visit app.cline.bot/settings/billing to upgrade.
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
---
|
||||
title: "Core Workflow"
|
||||
description: "The end-to-end workflow for using Cline Kanban: create tasks, run agents, review changes, and ship"
|
||||
---
|
||||
|
||||
This guide walks through the typical Kanban workflow from start to finish.
|
||||
|
||||
## 1. Create Tasks
|
||||
|
||||
There are two ways to add tasks to the board:
|
||||
|
||||
- **Manually** — click the add button and write a task description
|
||||
- **Via sidebar chat** — open the sidebar chat and ask the agent to break down a piece of work into tasks. The agent can create cards, link them together, and start work directly on the board.
|
||||
|
||||
Each card on the board represents a discrete unit of work for an agent to complete.
|
||||
|
||||
## 2. Link Tasks
|
||||
|
||||
Link cards together to create dependency chains:
|
||||
|
||||
- **⌘ + click** (Mac) / **Ctrl + click** (Windows/Linux) a card to link it to another task
|
||||
- When a linked card completes and is moved to trash, the next linked task **automatically starts**
|
||||
|
||||
Combined with auto-commit, this enables fully autonomous chains where one task's output feeds into the next without manual intervention.
|
||||
|
||||
## 3. Start Tasks
|
||||
|
||||
Hit the **play button** on a card to start it. Here's what happens:
|
||||
|
||||
1. Kanban creates an **ephemeral git worktree** for the task — an isolated copy of your repo where the agent can make changes without affecting your main working directory or other tasks
|
||||
2. Gitignored files like `node_modules` are **symlinked** from your main repo into the worktree, avoiding slow reinstalls for each task
|
||||
3. The agent starts working in its own terminal within that worktree
|
||||
4. The card displays the agent's **latest message or tool call** so you can monitor progress from the board
|
||||
|
||||
Multiple tasks run in parallel, each in their own worktree, so agents never create merge conflicts with each other.
|
||||
|
||||
<Warning>
|
||||
Symlinks work well for gitignored files that agents don't need to modify (like `node_modules`). If your workflow requires agents to modify gitignored files, be aware that changes will affect the symlink target (your main repo's copy).
|
||||
</Warning>
|
||||
|
||||
## 4. Review Changes
|
||||
|
||||
Click a card to open the detail view, which shows:
|
||||
|
||||
- **The agent's TUI** — the full text interface showing the agent's conversation and actions
|
||||
- **A diff of all changes** in that worktree compared to your base branch
|
||||
|
||||
The diff viewer includes a **checkpoint system** — you can see diffs scoped to specific message ranges, not just the full cumulative diff. This makes it easier to understand what changed and when.
|
||||
|
||||
### Inline Comments
|
||||
|
||||
Click on any line in the diff to leave a comment. Comments are sent back to the agent as feedback, letting you steer its work without rewriting the task description. This is useful for corrections like "use a different approach here" or "this edge case isn't handled."
|
||||
|
||||
## 5. Ship It
|
||||
|
||||
When you're satisfied with the changes, you have two options:
|
||||
|
||||
- **Commit** — merges the worktree changes into a commit on your base branch
|
||||
- **Open PR** — creates a new branch and opens a pull request
|
||||
|
||||
In both cases, Kanban sends a dynamic prompt to the agent to handle the operation. The agent converts the worktree into the appropriate git action and **intelligently handles merge conflicts** if the base branch has moved since the worktree was created.
|
||||
|
||||
## 6. Clean Up
|
||||
|
||||
After shipping, move the card to **trash** to clean up the ephemeral worktree and free disk space.
|
||||
|
||||
<Tip>
|
||||
If you need to resume work on a trashed card later, Kanban provides a **resume ID** for each task. You can use this to pick up where you left off.
|
||||
</Tip>
|
||||
|
||||
## Workflow Summary
|
||||
|
||||
| Step | Action | What Happens |
|
||||
|------|--------|-------------|
|
||||
| Create | Add card or use sidebar chat | Task card appears on the board |
|
||||
| Link | ⌘ + click to connect cards | Dependency chain is established |
|
||||
| Start | Hit play on a card | Ephemeral worktree is created, agent begins work |
|
||||
| Monitor | Watch card status on board | Latest agent message/tool call shown on card |
|
||||
| Review | Click card to see diff | Full diff with checkpoints and inline commenting |
|
||||
| Ship | Click Commit or Open PR | Agent handles merge into base branch or creates PR |
|
||||
| Clean up | Move to trash | Worktree is removed, resume ID saved |
|
||||
@@ -0,0 +1,120 @@
|
||||
---
|
||||
title: "Features"
|
||||
description: "Detailed overview of Cline Kanban features: worktrees, auto-commit, task linking, diff viewer, git interface, and more"
|
||||
---
|
||||
|
||||
<Warning>
|
||||
Kanban is a **research preview**. Some features described here use experimental capabilities. Expect changes.
|
||||
</Warning>
|
||||
|
||||
## Ephemeral Worktrees
|
||||
|
||||
Every task card runs in its own [git worktree](https://git-scm.com/docs/git-worktree) — an isolated checkout of your repository. This is the foundation that enables parallel agent execution:
|
||||
|
||||
- Each agent works in its own directory with its own terminal
|
||||
- Changes in one worktree don't affect other worktrees or your main working directory
|
||||
- No merge conflicts between agents running simultaneously
|
||||
- Worktrees are cleaned up when you move a card to trash
|
||||
|
||||
### Symlinked Dependencies
|
||||
|
||||
When creating a worktree, Kanban symlinks gitignored files (like `node_modules`) from your main repo rather than copying or reinstalling them. This avoids the overhead of running `npm install` for every task.
|
||||
|
||||
<Warning>
|
||||
Symlinks point back to the original files in your main repo. This works well for dependencies that agents don't modify, but if an agent does modify a symlinked file, the change affects the original too.
|
||||
</Warning>
|
||||
|
||||
## Auto-Commit
|
||||
|
||||
When enabled, agents automatically commit their changes to the worktree branch as they work. This creates a trail of incremental commits rather than one large diff at the end.
|
||||
|
||||
Auto-commit can be toggled in the Kanban settings.
|
||||
|
||||
## Auto-PR
|
||||
|
||||
When enabled alongside auto-commit, agents can automatically create pull requests when they finish their work. The agent generates a PR with the changes from its worktree branch.
|
||||
|
||||
Auto-PR can be toggled in the Kanban settings.
|
||||
|
||||
## Task Linking & Dependency Chains
|
||||
|
||||
Task linking lets you create sequential workflows where completing one task triggers the next:
|
||||
|
||||
1. **⌘ + click** a card to link it to another card
|
||||
2. When the first card is completed and moved to trash, the linked card **starts automatically**
|
||||
3. Chain multiple cards together for multi-step workflows
|
||||
|
||||
When combined with auto-commit, this creates fully autonomous pipelines — one agent finishes, its work is committed, and the next agent picks up where it left off.
|
||||
|
||||
## Diff Viewer & Checkpoints
|
||||
|
||||
Clicking a card opens a detail view with a full diff of all changes in that worktree. The diff viewer includes:
|
||||
|
||||
- **Checkpoint-scoped diffs** — rather than showing only the cumulative diff, you can view changes from specific message ranges. This is useful for understanding what changed at each step.
|
||||
- **Inline commenting** — click any line in the diff to leave a comment that gets sent back to the agent. Use this to give targeted feedback like "handle this edge case" or "use a different pattern here."
|
||||
|
||||
## Sidebar Chat & Board Management
|
||||
|
||||
The sidebar chat gives you a conversational interface for managing the board. Instead of manually creating and configuring cards, you can ask the agent to:
|
||||
|
||||
- Break down a piece of work into multiple task cards
|
||||
- Link cards together into dependency chains
|
||||
- Start tasks on the board
|
||||
|
||||
The agent manipulates the board directly based on your instructions.
|
||||
|
||||
## Keyboard Shortcuts
|
||||
|
||||
Kanban includes keyboard shortcuts for common actions:
|
||||
|
||||
| Shortcut | Action |
|
||||
|----------|--------|
|
||||
| **C** | Create a new task card |
|
||||
| **⌘ + click** | Link a card to another card |
|
||||
|
||||
<Tip>
|
||||
The "C" shortcut works from the main board view. You need at least one project open to create a task.
|
||||
</Tip>
|
||||
|
||||
## Settings
|
||||
|
||||
Open the settings dialog to configure how Kanban behaves. Available settings include:
|
||||
|
||||
- **Auto-commit** — toggle whether agents automatically commit changes as they work
|
||||
- **Auto-PR** — toggle whether agents automatically create pull requests on completion (requires auto-commit)
|
||||
- **Script shortcuts** — define frequently-used commands that appear as buttons on task cards
|
||||
- **Project paths** — displayed with `~` instead of full home directory paths for readability
|
||||
|
||||
## Script Shortcuts
|
||||
|
||||
Define frequently-used commands (like `npm run dev` or `npm test`) in the Kanban settings. These appear as play buttons on task cards, giving you quick access to run, test, or debug the application within a worktree without switching to a separate terminal.
|
||||
|
||||
## Git Interface
|
||||
|
||||
Click the **branch name** in the navbar to open a full git interface. From here you can:
|
||||
|
||||
- Browse commit history
|
||||
- Switch branches
|
||||
- Fetch, pull, and push
|
||||
- Visualize the git graph
|
||||
|
||||
This lets you manage your repository without leaving Kanban or opening a separate git client.
|
||||
|
||||
## Agent Compatibility
|
||||
|
||||
Kanban works with CLI-based coding agents. It uses experimental features that bypass permissions and runtime hooks, giving agents more autonomy to work without interruption. Agents currently compatible with Kanban include:
|
||||
|
||||
- **Cline CLI**
|
||||
- **Claude Code**
|
||||
- **Codex**
|
||||
- **OpenCode**
|
||||
|
||||
and more. Check settings for all available agent runtimes
|
||||
|
||||
## Resume Tasks
|
||||
|
||||
When you move a card to trash, the worktree is cleaned up but Kanban saves a **resume ID**. If you need to continue work on a trashed task, you can use this ID to pick up where you left off without starting from scratch.
|
||||
|
||||
## Remote Config Gating
|
||||
|
||||
For teams and organizations, Kanban access can be gated via Cline remote config. This allows administrators to control who can access the Kanban board within their organization, enabling phased rollouts or restricting access to specific teams.
|
||||
@@ -0,0 +1,67 @@
|
||||
---
|
||||
title: "Getting Started"
|
||||
description: "Install Cline Kanban and launch your first board"
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **Node.js 18 or higher** — check with `node --version`
|
||||
- **A git repository** — Kanban must be run from the root of a git repo
|
||||
|
||||
## Installation
|
||||
|
||||
Install Cline CLI globally via npm:
|
||||
|
||||
```bash
|
||||
npm i -g cline
|
||||
```
|
||||
|
||||
Then launch Kanban:
|
||||
|
||||
```bash
|
||||
cline
|
||||
```
|
||||
|
||||
<Tip>
|
||||
This launches a local web server and opens the Kanban board in your default browser.
|
||||
</Tip>
|
||||
|
||||
## First Launch
|
||||
|
||||
1. Open your terminal and `cd` to the root of any git repository
|
||||
2. Run `cline`
|
||||
3. Your browser opens to the Kanban board
|
||||
|
||||
### Onboarding
|
||||
|
||||
On your first launch, Kanban walks you through a short setup:
|
||||
|
||||
1. **Pick a project directory** — a directory picker opens so you can select (or confirm) the repository you want to work in
|
||||
2. **Choose your agent** — select which coding agent to use for tasks (Cline, Claude Code, or Codex)
|
||||
|
||||
After onboarding, you land on the board and can start creating tasks immediately. No account creation, API keys, or configuration files required.
|
||||
|
||||
## Creating Your First Task
|
||||
|
||||
Once the board is open:
|
||||
|
||||
1. **Create a card** — click the add button to create a new task card
|
||||
2. **Write a task description** — describe what you want the agent to do
|
||||
3. **Hit play** — Kanban creates an ephemeral git worktree for the task and starts an agent in its own terminal
|
||||
|
||||
The card updates in real time, showing the agent's latest message or tool call so you can monitor progress from the board.
|
||||
|
||||
<Tip>
|
||||
You can also use the **sidebar chat** to create tasks. Open the chat and ask the agent to break down work into multiple task cards — it can create, link, and start tasks directly on the board.
|
||||
</Tip>
|
||||
|
||||
## Next Steps
|
||||
|
||||
<Columns cols={2}>
|
||||
<Card title="Core Workflow" icon="arrows-spin" href="/kanban/core-workflow">
|
||||
Learn the full workflow: create → link → start → review → ship.
|
||||
</Card>
|
||||
<Card title="Features" icon="list-check" href="/kanban/features">
|
||||
Explore worktrees, auto-commit, task linking, the diff viewer, and more.
|
||||
</Card>
|
||||
</Columns>
|
||||
@@ -0,0 +1,64 @@
|
||||
---
|
||||
title: "Cline Kanban"
|
||||
sidebarTitle: "Overview"
|
||||
description: "A kanban board for orchestrating coding agents in parallel using git worktrees"
|
||||
---
|
||||
|
||||
<Warning>
|
||||
Kanban is a **research preview**. Share feedback in [#kanban on Discord](https://discord.gg/cline).
|
||||
</Warning>
|
||||
|
||||
## What is Cline Kanban?
|
||||
|
||||
Cline Kanban is a terminal-launched kanban board that runs in your browser. Each task card gets its own git worktree and terminal, so you can run multiple coding agents in parallel without merge conflicts. You create tasks, assign them to agents, review diffs, leave inline comments, and ship commits or PRs — all from one interface.
|
||||
|
||||
It runs locally, requires no account or setup, and works out of the box from any git repository.
|
||||
|
||||
```bash
|
||||
npm i -g cline
|
||||
cline
|
||||
```
|
||||
|
||||
## How It Works
|
||||
|
||||
1. **Run `cline`** from the root of any git repo — a local web server opens in your browser
|
||||
2. **Create task cards** manually or ask the sidebar chat agent to break work into tasks
|
||||
3. **Hit play** on a card — Kanban creates an ephemeral worktree and starts an agent
|
||||
4. **Monitor progress** — each card shows the agent's latest message or tool call
|
||||
5. **Review diffs** — click a card to see all changes, leave inline comments to steer the agent
|
||||
6. **Ship it** — hit Commit or Open PR, then trash the card to clean up the worktree
|
||||
|
||||
## Key Capabilities
|
||||
|
||||
<CardGroup cols={3}>
|
||||
<Card title="Parallel Execution" icon="clone">
|
||||
Each task runs in its own git worktree with its own terminal. Multiple agents work simultaneously without stepping on each other.
|
||||
</Card>
|
||||
<Card title="Unified Task Board" icon="table-columns">
|
||||
Create, triage, link, and monitor all agent tasks from a single browser-based kanban board.
|
||||
</Card>
|
||||
<Card title="Works With Existing Agents" icon="plug">
|
||||
Compatible with CLI agents you already use — Cline, Claude Code, and Codex. Kanban uses experimental features that bypass permissions and runtime hooks for more agent autonomy.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## Links
|
||||
|
||||
- [GitHub Repository](https://github.com/cline/kanban) — source code, issues, and feature requests
|
||||
- [npm Package](https://www.npmjs.com/package/kanban) — version history and package details
|
||||
- [Cline App](https://app.cline.bot) — account management
|
||||
- [Discord #kanban](https://discord.gg/cline) — feedback and discussion
|
||||
|
||||
## Next Steps
|
||||
|
||||
<Columns cols={2}>
|
||||
<Card title="Getting Started" icon="rocket" href="/kanban/getting-started">
|
||||
Install Kanban and launch your first board.
|
||||
</Card>
|
||||
<Card title="Core Workflow" icon="arrows-spin" href="/kanban/core-workflow">
|
||||
The full workflow from creating tasks to shipping PRs.
|
||||
</Card>
|
||||
<Card title="Features" icon="list-check" href="/kanban/features">
|
||||
Worktrees, auto-commit, task linking, diff viewer, git interface, and more.
|
||||
</Card>
|
||||
</Columns>
|
||||
Generated
+72
-23
@@ -139,6 +139,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.7.4.tgz",
|
||||
"integrity": "sha512-C3HlIdsBxszvm5McXlB8PeOEWfBhcGBTZGkGlWc2U0KFY5IwG5OQEuQ8rq52DZmcHDlPLd+YFBK+cZcytwIFWg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@floating-ui/utils": "^0.2.10"
|
||||
}
|
||||
@@ -148,6 +149,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.7.5.tgz",
|
||||
"integrity": "sha512-N0bD2kIPInNHUHehXhMke1rBGs1dwqvC9O9KYMyyjK7iXt7GAhnro7UlcuYcGdS/yYOlq0MAVgrow8IbWJwyqg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@floating-ui/core": "^1.7.4",
|
||||
"@floating-ui/utils": "^0.2.10"
|
||||
@@ -157,7 +159,8 @@
|
||||
"version": "0.2.10",
|
||||
"resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.10.tgz",
|
||||
"integrity": "sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/@img/sharp-darwin-arm64": {
|
||||
"version": "0.33.5",
|
||||
@@ -1082,6 +1085,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.7.tgz",
|
||||
"integrity": "sha512-0tLRojf/1Go2JgEVm+3Frg9A3IW8bJgKgdO0BN5RkF//ufuz2joZM63Npau2ff3J6lUVYgDSNzNkR+aH3IVfjg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@floating-ui/dom": "^1.7.5"
|
||||
},
|
||||
@@ -1167,6 +1171,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.7.tgz",
|
||||
"integrity": "sha512-F+M1tLhO+mlQaOWspE8Wstg+z6PwxwRd8oQ8IXceWz92kfAmalTRf0EjrouQeo7QssEPfCn05B4Ihs1K9WQ/7w==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-primitive": "2.1.3"
|
||||
},
|
||||
@@ -1190,6 +1195,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.11.tgz",
|
||||
"integrity": "sha512-Nqcp+t5cTB8BinFkZgXiMJniQH0PsUt2k51FUhbdfeKvc4ACcG2uQniY/8+h1Yv6Kza4Q7lD7PQV0z0oicE0Mg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/primitive": "1.1.3",
|
||||
"@radix-ui/react-compose-refs": "1.1.2",
|
||||
@@ -1217,6 +1223,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-focus-scope/-/react-focus-scope-1.1.7.tgz",
|
||||
"integrity": "sha512-t2ODlkXBQyn7jkl6TNaw/MtVEVvIGelJDCG41Okq/KwUsJBwQ4XVZsHAVUkK4mBv3ewiAS3PGuUWuY2BoK4ZUw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-compose-refs": "1.1.2",
|
||||
"@radix-ui/react-primitive": "2.1.3",
|
||||
@@ -1280,6 +1287,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.2.8.tgz",
|
||||
"integrity": "sha512-0NJQ4LFFUuWkE7Oxf0htBKS6zLkkjBH+hM1uk7Ng705ReR8m/uelduy1DBo0PyBXPKVnBA6YBlU94MBGXrSBCw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@floating-ui/react-dom": "^2.0.0",
|
||||
"@radix-ui/react-arrow": "1.1.7",
|
||||
@@ -1312,6 +1320,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.1.9.tgz",
|
||||
"integrity": "sha512-bpIxvq03if6UNwXZ+HTK71JLh4APvnXntDc6XOX8UVq4XQOVl7lwok0AvIl+b8zgCw3fSaVTZMpAPPagXbKmHQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-primitive": "2.1.3",
|
||||
"@radix-ui/react-use-layout-effect": "1.1.1"
|
||||
@@ -1336,6 +1345,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-presence/-/react-presence-1.1.5.tgz",
|
||||
"integrity": "sha512-/jfEwNDdQVBCNvjkGit4h6pMOzq8bHkopq458dPt2lMjx+eBQUohZNG9A7DtO/O5ukSbxuaNGXMjHicgwy6rQQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-compose-refs": "1.1.2",
|
||||
"@radix-ui/react-use-layout-effect": "1.1.1"
|
||||
@@ -1360,6 +1370,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz",
|
||||
"integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-slot": "1.2.3"
|
||||
},
|
||||
@@ -1456,6 +1467,7 @@
|
||||
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz",
|
||||
"integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"loose-envify": "^1.1.0"
|
||||
}
|
||||
@@ -1919,6 +1931,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.7.tgz",
|
||||
"integrity": "sha512-0tLRojf/1Go2JgEVm+3Frg9A3IW8bJgKgdO0BN5RkF//ufuz2joZM63Npau2ff3J6lUVYgDSNzNkR+aH3IVfjg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@floating-ui/dom": "^1.7.5"
|
||||
},
|
||||
@@ -2105,6 +2118,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.7.tgz",
|
||||
"integrity": "sha512-F+M1tLhO+mlQaOWspE8Wstg+z6PwxwRd8oQ8IXceWz92kfAmalTRf0EjrouQeo7QssEPfCn05B4Ihs1K9WQ/7w==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-primitive": "2.1.3"
|
||||
},
|
||||
@@ -2128,6 +2142,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.11.tgz",
|
||||
"integrity": "sha512-Nqcp+t5cTB8BinFkZgXiMJniQH0PsUt2k51FUhbdfeKvc4ACcG2uQniY/8+h1Yv6Kza4Q7lD7PQV0z0oicE0Mg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/primitive": "1.1.3",
|
||||
"@radix-ui/react-compose-refs": "1.1.2",
|
||||
@@ -2155,6 +2170,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-focus-scope/-/react-focus-scope-1.1.7.tgz",
|
||||
"integrity": "sha512-t2ODlkXBQyn7jkl6TNaw/MtVEVvIGelJDCG41Okq/KwUsJBwQ4XVZsHAVUkK4mBv3ewiAS3PGuUWuY2BoK4ZUw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-compose-refs": "1.1.2",
|
||||
"@radix-ui/react-primitive": "2.1.3",
|
||||
@@ -2218,6 +2234,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.2.8.tgz",
|
||||
"integrity": "sha512-0NJQ4LFFUuWkE7Oxf0htBKS6zLkkjBH+hM1uk7Ng705ReR8m/uelduy1DBo0PyBXPKVnBA6YBlU94MBGXrSBCw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@floating-ui/react-dom": "^2.0.0",
|
||||
"@radix-ui/react-arrow": "1.1.7",
|
||||
@@ -2250,6 +2267,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.1.9.tgz",
|
||||
"integrity": "sha512-bpIxvq03if6UNwXZ+HTK71JLh4APvnXntDc6XOX8UVq4XQOVl7lwok0AvIl+b8zgCw3fSaVTZMpAPPagXbKmHQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-primitive": "2.1.3",
|
||||
"@radix-ui/react-use-layout-effect": "1.1.1"
|
||||
@@ -2274,6 +2292,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-presence/-/react-presence-1.1.5.tgz",
|
||||
"integrity": "sha512-/jfEwNDdQVBCNvjkGit4h6pMOzq8bHkopq458dPt2lMjx+eBQUohZNG9A7DtO/O5ukSbxuaNGXMjHicgwy6rQQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-compose-refs": "1.1.2",
|
||||
"@radix-ui/react-use-layout-effect": "1.1.1"
|
||||
@@ -2298,6 +2317,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz",
|
||||
"integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-slot": "1.2.3"
|
||||
},
|
||||
@@ -2422,6 +2442,7 @@
|
||||
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz",
|
||||
"integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"loose-envify": "^1.1.0"
|
||||
}
|
||||
@@ -2450,6 +2471,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.7.tgz",
|
||||
"integrity": "sha512-0tLRojf/1Go2JgEVm+3Frg9A3IW8bJgKgdO0BN5RkF//ufuz2joZM63Npau2ff3J6lUVYgDSNzNkR+aH3IVfjg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@floating-ui/dom": "^1.7.5"
|
||||
},
|
||||
@@ -2492,6 +2514,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.7.tgz",
|
||||
"integrity": "sha512-F+M1tLhO+mlQaOWspE8Wstg+z6PwxwRd8oQ8IXceWz92kfAmalTRf0EjrouQeo7QssEPfCn05B4Ihs1K9WQ/7w==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-primitive": "2.1.3"
|
||||
},
|
||||
@@ -2515,6 +2538,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.11.tgz",
|
||||
"integrity": "sha512-Nqcp+t5cTB8BinFkZgXiMJniQH0PsUt2k51FUhbdfeKvc4ACcG2uQniY/8+h1Yv6Kza4Q7lD7PQV0z0oicE0Mg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/primitive": "1.1.3",
|
||||
"@radix-ui/react-compose-refs": "1.1.2",
|
||||
@@ -2542,6 +2566,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-focus-scope/-/react-focus-scope-1.1.7.tgz",
|
||||
"integrity": "sha512-t2ODlkXBQyn7jkl6TNaw/MtVEVvIGelJDCG41Okq/KwUsJBwQ4XVZsHAVUkK4mBv3ewiAS3PGuUWuY2BoK4ZUw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-compose-refs": "1.1.2",
|
||||
"@radix-ui/react-primitive": "2.1.3",
|
||||
@@ -2605,6 +2630,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.2.8.tgz",
|
||||
"integrity": "sha512-0NJQ4LFFUuWkE7Oxf0htBKS6zLkkjBH+hM1uk7Ng705ReR8m/uelduy1DBo0PyBXPKVnBA6YBlU94MBGXrSBCw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@floating-ui/react-dom": "^2.0.0",
|
||||
"@radix-ui/react-arrow": "1.1.7",
|
||||
@@ -2637,6 +2663,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.1.9.tgz",
|
||||
"integrity": "sha512-bpIxvq03if6UNwXZ+HTK71JLh4APvnXntDc6XOX8UVq4XQOVl7lwok0AvIl+b8zgCw3fSaVTZMpAPPagXbKmHQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-primitive": "2.1.3",
|
||||
"@radix-ui/react-use-layout-effect": "1.1.1"
|
||||
@@ -2661,6 +2688,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-presence/-/react-presence-1.1.5.tgz",
|
||||
"integrity": "sha512-/jfEwNDdQVBCNvjkGit4h6pMOzq8bHkopq458dPt2lMjx+eBQUohZNG9A7DtO/O5ukSbxuaNGXMjHicgwy6rQQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-compose-refs": "1.1.2",
|
||||
"@radix-ui/react-use-layout-effect": "1.1.1"
|
||||
@@ -2685,6 +2713,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz",
|
||||
"integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-slot": "1.2.3"
|
||||
},
|
||||
@@ -2776,6 +2805,7 @@
|
||||
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz",
|
||||
"integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"loose-envify": "^1.1.0"
|
||||
}
|
||||
@@ -2927,13 +2957,15 @@
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.3.tgz",
|
||||
"integrity": "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg==",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/@radix-ui/react-compose-refs": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.2.tgz",
|
||||
"integrity": "sha512-z4eqJvfiNnFMHIIvXP3CY57y2WJs5g2v3X0zm9mEJkrkNv4rDxu+sg9Jh8EkXyeqBkB7SOcboo9dMVqhyrACIg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
@@ -2949,6 +2981,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.2.tgz",
|
||||
"integrity": "sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
@@ -2964,6 +2997,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-focus-guards/-/react-focus-guards-1.1.3.tgz",
|
||||
"integrity": "sha512-0rFg/Rj2Q62NCm62jZw0QX7a3sz6QCQU0LpZdNrJX8byRGaGVTqbrW9jAoIAHyMQqsNpeZ81YgSizOt5WXq0Pw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
@@ -2979,6 +3013,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.1.tgz",
|
||||
"integrity": "sha512-kGkGegYIdQsOb4XjsfM97rXsiHaBwco+hFI66oO4s9LU+PLAC5oJ7khdOVFxkhsmlbpUqDAvXw11CluXP+jkHg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-use-layout-effect": "1.1.1"
|
||||
},
|
||||
@@ -2997,6 +3032,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.2.3.tgz",
|
||||
"integrity": "sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-compose-refs": "1.1.2"
|
||||
},
|
||||
@@ -3015,6 +3051,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.1.1.tgz",
|
||||
"integrity": "sha512-FkBMwD+qbGQeMu1cOHnuGB6x4yzPjho8ap5WtbEJ26umhgqVXbhekKUQO+hZEL1vU92a3wHwdp0HAcqAUF5iDg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
@@ -3030,6 +3067,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.2.2.tgz",
|
||||
"integrity": "sha512-BjasUjixPFdS+NKkypcyyN5Pmg83Olst0+c6vGov0diwTEo6mgdqVR6hxcEgFuh4QrAs7Rc+9KuGJ9TVCj0Zzg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-use-effect-event": "0.0.2",
|
||||
"@radix-ui/react-use-layout-effect": "1.1.1"
|
||||
@@ -3049,6 +3087,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-effect-event/-/react-use-effect-event-0.0.2.tgz",
|
||||
"integrity": "sha512-Qp8WbZOBe+blgpuUT+lw2xheLP8q0oatc9UpmiemEICxGvFLYmHm9QowVZGHtJlGbS6A6yJ3iViad/2cVjnOiA==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-use-layout-effect": "1.1.1"
|
||||
},
|
||||
@@ -3067,6 +3106,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-escape-keydown/-/react-use-escape-keydown-1.1.1.tgz",
|
||||
"integrity": "sha512-Il0+boE7w/XebUHyBjroE+DbByORGR9KKmITzbR7MyQ4akpORYP/ZmbhAr0DG7RmmBqoOnZdy2QlvajJ2QA59g==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-use-callback-ref": "1.1.1"
|
||||
},
|
||||
@@ -3085,6 +3125,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.1.tgz",
|
||||
"integrity": "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
@@ -3100,6 +3141,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-rect/-/react-use-rect-1.1.1.tgz",
|
||||
"integrity": "sha512-QTYuDesS0VtuHNNvMh+CjlKJ4LJickCMUAqjlE3+j8w+RlRpwyX3apEQKGFzbZGdo7XNG1tXa+bQqIE7HIXT2w==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/rect": "1.1.1"
|
||||
},
|
||||
@@ -3118,6 +3160,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-size/-/react-use-size-1.1.1.tgz",
|
||||
"integrity": "sha512-ewrXRDTAqAXlkl6t/fkXWNAhFX9I+CkKlw6zjEwk86RSPKwZr3xpBRso655aqYafwtnbpHLj6toFzmd6xdVptQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@radix-ui/react-use-layout-effect": "1.1.1"
|
||||
},
|
||||
@@ -3135,7 +3178,8 @@
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/rect/-/rect-1.1.1.tgz",
|
||||
"integrity": "sha512-HPwpGIzkl28mWyZqG52jiqDJ12waP11Pa1lGoiyUkIEuMLBP0oeK/C89esbXrxsky5we7dfd8U58nm0SgAWpVw==",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/@shikijs/core": {
|
||||
"version": "3.22.0",
|
||||
@@ -3796,7 +3840,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.2.3.tgz",
|
||||
"integrity": "sha512-m0jEgYlYz+mDJZ2+F4v8D1AyQb+QzsNqRuI7xg1VQX/KlKS0qT9r1Mo16yo5F/MtifXFgaofIFsdFMox2SxIbQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~7.16.0"
|
||||
}
|
||||
@@ -3881,7 +3924,6 @@
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz",
|
||||
"integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
@@ -3946,7 +3988,6 @@
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz",
|
||||
"integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"fast-uri": "^3.0.1",
|
||||
@@ -4073,6 +4114,7 @@
|
||||
"resolved": "https://registry.npmjs.org/aria-hidden/-/aria-hidden-1.2.6.tgz",
|
||||
"integrity": "sha512-ik3ZgC9dY/lYVVM++OISsaYDeg1tb0VtP5uL3ouh1koGOaUMDPpbFIei4JkFimWUFPn90sbMNMXQAIVOlnYKJA==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.0.0"
|
||||
},
|
||||
@@ -4084,7 +4126,8 @@
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||
"license": "0BSD"
|
||||
"license": "0BSD",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/arkregex": {
|
||||
"version": "0.0.3",
|
||||
@@ -5181,7 +5224,8 @@
|
||||
"version": "3.2.3",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
|
||||
"integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/data-uri-to-buffer": {
|
||||
"version": "6.0.2",
|
||||
@@ -5452,7 +5496,8 @@
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz",
|
||||
"integrity": "sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/detect-port": {
|
||||
"version": "1.5.1",
|
||||
@@ -5485,8 +5530,7 @@
|
||||
"version": "0.0.1312386",
|
||||
"resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1312386.tgz",
|
||||
"integrity": "sha512-DPnhUXvmvKT2dFA/j7B+riVLUt9Q6RKJlcppojL5CoRywJJKLDYnRlw0gTFKfgDPHP5E04UoB71SxoJlVZy8FA==",
|
||||
"license": "BSD-3-Clause",
|
||||
"peer": true
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/didyoumean": {
|
||||
"version": "1.2.2",
|
||||
@@ -6576,6 +6620,7 @@
|
||||
"resolved": "https://registry.npmjs.org/get-nonce/-/get-nonce-1.0.1.tgz",
|
||||
"integrity": "sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
@@ -7310,7 +7355,6 @@
|
||||
"resolved": "https://registry.npmjs.org/ink/-/ink-6.3.0.tgz",
|
||||
"integrity": "sha512-2CbJAa7XeziZYe6pDS5RVLirRY28iSGMQuEV8jRU5NQsONQNfcR/BZHHc9vkMg2lGYTHTM2pskxC1YmY28p6bQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@alcalzone/ansi-tokenize": "^0.2.0",
|
||||
"ansi-escapes": "^7.0.0",
|
||||
@@ -8090,7 +8134,6 @@
|
||||
"resolved": "https://registry.npmjs.org/jsep/-/jsep-1.4.0.tgz",
|
||||
"integrity": "sha512-B7qPcEVE3NVkmSJbaYxvv4cHkVW7DQsZz13pUMrfS8z8Q/BuShN+gcTXrUlPiGqM2/t/EEaI030bpxMqY8gMlw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">= 10.16.0"
|
||||
}
|
||||
@@ -8246,6 +8289,7 @@
|
||||
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
|
||||
"integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"js-tokens": "^3.0.0 || ^4.0.0"
|
||||
},
|
||||
@@ -10140,7 +10184,6 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.11",
|
||||
"picocolors": "^1.1.1",
|
||||
@@ -10516,7 +10559,6 @@
|
||||
"resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz",
|
||||
"integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
@@ -10541,6 +10583,7 @@
|
||||
"resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.7.2.tgz",
|
||||
"integrity": "sha512-Iqb9NjCCTt6Hf+vOdNIZGdTiH1QSqr27H/Ek9sv/a97gfueI/5h1s3yRi1nngzMUaOOToin5dI1dXKdXiF+u0Q==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"react-remove-scroll-bar": "^2.3.7",
|
||||
"react-style-singleton": "^2.2.3",
|
||||
@@ -10566,6 +10609,7 @@
|
||||
"resolved": "https://registry.npmjs.org/react-remove-scroll-bar/-/react-remove-scroll-bar-2.3.8.tgz",
|
||||
"integrity": "sha512-9r+yi9+mgU33AKcj6IbT9oRCO78WriSj6t/cF8DWBZJ9aOGPOTEDvdUDz1FwKim7QXWwmHqtdHnRJfhAxEG46Q==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"react-style-singleton": "^2.2.2",
|
||||
"tslib": "^2.0.0"
|
||||
@@ -10587,19 +10631,22 @@
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||
"license": "0BSD"
|
||||
"license": "0BSD",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/react-remove-scroll/node_modules/tslib": {
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||
"license": "0BSD"
|
||||
"license": "0BSD",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/react-style-singleton": {
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/react-style-singleton/-/react-style-singleton-2.2.3.tgz",
|
||||
"integrity": "sha512-b6jSvxvVnyptAiLjbkWLE/lOnR4lfTtDAl+eUC7RZy+QQWc6wRzIV2CE6xBuMmDxc2qIihtDCZD5NPOFl7fRBQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"get-nonce": "^1.0.0",
|
||||
"tslib": "^2.0.0"
|
||||
@@ -10621,7 +10668,8 @@
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||
"license": "0BSD"
|
||||
"license": "0BSD",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/read-cache": {
|
||||
"version": "1.0.0",
|
||||
@@ -12173,7 +12221,6 @@
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
|
||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
@@ -12427,7 +12474,6 @@
|
||||
"resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz",
|
||||
"integrity": "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@types/unist": "^3.0.0",
|
||||
"bail": "^2.0.0",
|
||||
@@ -12654,6 +12700,7 @@
|
||||
"resolved": "https://registry.npmjs.org/use-callback-ref/-/use-callback-ref-1.3.3.tgz",
|
||||
"integrity": "sha512-jQL3lRnocaFtu3V00JToYz/4QkNWswxijDaCVNZRiRTO3HQDLsdu1ZtmIUvV4yPp+rvWm5j0y0TG/S61cuijTg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.0.0"
|
||||
},
|
||||
@@ -12674,13 +12721,15 @@
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||
"license": "0BSD"
|
||||
"license": "0BSD",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/use-sidecar": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/use-sidecar/-/use-sidecar-1.1.3.tgz",
|
||||
"integrity": "sha512-Fedw0aZvkhynoPYlA5WXrMCAMm+nSWdZt6lzJQ7Ok8S6Q+VsHmHpRWndVRJ8Be0ZbkfPc5LRYH+5XrzXcEeLRQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"detect-node-es": "^1.1.0",
|
||||
"tslib": "^2.0.0"
|
||||
@@ -12702,7 +12751,8 @@
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||
"license": "0BSD"
|
||||
"license": "0BSD",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
@@ -13200,7 +13250,6 @@
|
||||
"resolved": "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz",
|
||||
"integrity": "sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/colinhacks"
|
||||
}
|
||||
|
||||
@@ -18,9 +18,12 @@ MiniMax provides AI models with large context windows and competitive pricing, f
|
||||
|
||||
Cline supports the following MiniMax models:
|
||||
|
||||
- `MiniMax-M2.5` (Default) - Latest model with 192K context, prompt caching, and reasoning/thinking support ($0.30/$1.20 per 1M tokens)
|
||||
- `MiniMax-M2.1` - Previous generation with 192K context and prompt caching ($0.30/$1.20 per 1M tokens)
|
||||
- `MiniMax-M2.1-lightning` - Fast variant with higher output pricing ($0.30/$2.40 per 1M tokens)
|
||||
- `MiniMax-M2.7` (Default) - Latest flagship model with enhanced reasoning and coding, 192K context, prompt caching, and reasoning/thinking support ($0.30/$1.20 per 1M tokens)
|
||||
- `MiniMax-M2.7-highspeed` - High-speed version of M2.7 for low-latency scenarios ($0.60/$2.40 per 1M tokens)
|
||||
- `MiniMax-M2.5` - Previous flagship with 192K context, prompt caching, and reasoning support ($0.30/$1.20 per 1M tokens)
|
||||
- `MiniMax-M2.5-highspeed` - High-speed version of M2.5 ($0.60/$2.40 per 1M tokens)
|
||||
- `MiniMax-M2.1` - Earlier generation with 192K context and prompt caching ($0.30/$1.20 per 1M tokens)
|
||||
- `MiniMax-M2.1-lightning` - Fast variant with higher output pricing ($0.60/$2.40 per 1M tokens)
|
||||
- `MiniMax-M2` - Earlier generation with 192K context ($0.30/$1.20 per 1M tokens)
|
||||
|
||||
### Configuration in Cline
|
||||
@@ -33,6 +36,6 @@ Cline supports the following MiniMax models:
|
||||
### Tips and Notes
|
||||
|
||||
- **Large Context:** All models support 192K token context windows.
|
||||
- **Reasoning Support:** M2.5 supports extended thinking/reasoning for complex tasks.
|
||||
- **Prompt Caching:** M2.5 and M2.1 models support prompt caching for reduced costs on repeated queries.
|
||||
- **Reasoning Support:** M2.7 and M2.5 support extended thinking/reasoning for complex tasks.
|
||||
- **Prompt Caching:** M2.7 (including highspeed), M2.5 (including highspeed), and M2.1 models support prompt caching for reduced costs on repeated queries.
|
||||
- **Pricing:** Check the [MiniMax pricing page](https://www.minimax.io/platform/document/pricing) for current rates.
|
||||
|
||||
Generated
+44
-24
@@ -9,7 +9,7 @@
|
||||
"version": "2.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"axios": "^1.12.0",
|
||||
"axios": "1.13.6",
|
||||
"better-sqlite3": "^12.4.1",
|
||||
"chalk": "5.6.2",
|
||||
"commander": "^9.4.1",
|
||||
@@ -135,16 +135,17 @@
|
||||
"node_modules/asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "1.12.2",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.12.2.tgz",
|
||||
"integrity": "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==",
|
||||
"version": "1.13.6",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.13.6.tgz",
|
||||
"integrity": "sha512-ChTCHMouEe2kn713WHbQGcuYrr6fXTBiu460OTwWrWob16g1bXn4vtz07Ope7ewMozJAnEquLk5lWQWtBig9DQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.6",
|
||||
"form-data": "^4.0.4",
|
||||
"follow-redirects": "^1.15.11",
|
||||
"form-data": "^4.0.5",
|
||||
"proxy-from-env": "^1.1.0"
|
||||
}
|
||||
},
|
||||
@@ -226,6 +227,7 @@
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
||||
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"function-bind": "^1.1.2"
|
||||
@@ -256,6 +258,7 @@
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"delayed-stream": "~1.0.0"
|
||||
},
|
||||
@@ -303,6 +306,7 @@
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
@@ -339,6 +343,7 @@
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
@@ -360,6 +365,7 @@
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
||||
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
@@ -368,6 +374,7 @@
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
||||
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
@@ -376,6 +383,7 @@
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
|
||||
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0"
|
||||
},
|
||||
@@ -387,6 +395,7 @@
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
|
||||
"integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.6",
|
||||
@@ -411,15 +420,16 @@
|
||||
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.15.9",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
|
||||
"integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",
|
||||
"version": "1.15.11",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz",
|
||||
"integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
},
|
||||
@@ -430,9 +440,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/form-data": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz",
|
||||
"integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==",
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz",
|
||||
"integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
@@ -455,6 +465,7 @@
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
@@ -463,6 +474,7 @@
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"es-define-property": "^1.0.1",
|
||||
@@ -486,6 +498,7 @@
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"dunder-proto": "^1.0.1",
|
||||
"es-object-atoms": "^1.0.0"
|
||||
@@ -503,6 +516,7 @@
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
|
||||
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
@@ -514,6 +528,7 @@
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
|
||||
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
@@ -525,6 +540,7 @@
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
|
||||
"integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"has-symbols": "^1.0.3"
|
||||
},
|
||||
@@ -539,6 +555,7 @@
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
|
||||
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
@@ -585,6 +602,7 @@
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
@@ -593,6 +611,7 @@
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
@@ -601,6 +620,7 @@
|
||||
"version": "2.1.35",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mime-db": "1.52.0"
|
||||
},
|
||||
@@ -1044,12 +1064,12 @@
|
||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||
},
|
||||
"axios": {
|
||||
"version": "1.12.2",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.12.2.tgz",
|
||||
"integrity": "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==",
|
||||
"version": "1.13.6",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.13.6.tgz",
|
||||
"integrity": "sha512-ChTCHMouEe2kn713WHbQGcuYrr6fXTBiu460OTwWrWob16g1bXn4vtz07Ope7ewMozJAnEquLk5lWQWtBig9DQ==",
|
||||
"requires": {
|
||||
"follow-redirects": "^1.15.6",
|
||||
"form-data": "^4.0.4",
|
||||
"follow-redirects": "^1.15.11",
|
||||
"form-data": "^4.0.5",
|
||||
"proxy-from-env": "^1.1.0"
|
||||
}
|
||||
},
|
||||
@@ -1224,14 +1244,14 @@
|
||||
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.15.9",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
|
||||
"integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ=="
|
||||
"version": "1.15.11",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz",
|
||||
"integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ=="
|
||||
},
|
||||
"form-data": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz",
|
||||
"integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==",
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz",
|
||||
"integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==",
|
||||
"requires": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"axios": "^1.12.0",
|
||||
"axios": "1.13.6",
|
||||
"better-sqlite3": "^12.4.1",
|
||||
"chalk": "5.6.2",
|
||||
"commander": "^9.4.1",
|
||||
|
||||
Generated
+443
-743
File diff suppressed because it is too large
Load Diff
+10
-6
@@ -2,7 +2,7 @@
|
||||
"name": "claude-dev",
|
||||
"displayName": "Cline",
|
||||
"description": "Autonomous coding agent right in your IDE, capable of creating/editing files, running commands, using the browser, and more with your permission every step of the way.",
|
||||
"version": "3.75.0",
|
||||
"version": "3.77.0",
|
||||
"icon": "assets/icons/icon.png",
|
||||
"workspaces": [
|
||||
".",
|
||||
@@ -475,10 +475,10 @@
|
||||
"@types/proxyquire": "^1.3.31",
|
||||
"@types/shell-quote": "^1.7.5",
|
||||
"@types/should": "^11.2.0",
|
||||
"@types/sinon": "^17.0.4",
|
||||
"@types/sinon": "^21.0.0",
|
||||
"@types/turndown": "^5.0.5",
|
||||
"@types/vscode": "1.84.0",
|
||||
"@vscode/test-cli": "^0.0.10",
|
||||
"@vscode/test-cli": "^0.0.12",
|
||||
"@vscode/test-electron": "^2.5.2",
|
||||
"@vscode/vsce": "^3.6.0",
|
||||
"c8": "^10.1.3",
|
||||
@@ -498,7 +498,7 @@
|
||||
"proxyquire": "^2.1.3",
|
||||
"rimraf": "^6.0.1",
|
||||
"should": "^13.2.3",
|
||||
"sinon": "^19.0.2",
|
||||
"sinon": "^21.0.3",
|
||||
"tree-kill": "^1.2.2",
|
||||
"ts-node": "^10.9.2",
|
||||
"ts-proto": "^2.6.1",
|
||||
@@ -548,7 +548,7 @@
|
||||
"@vscode/codicons": "^0.0.36",
|
||||
"archiver": "^7.0.1",
|
||||
"aws4fetch": "^1.0.20",
|
||||
"axios": "^1.12.0",
|
||||
"axios": "1.13.6",
|
||||
"better-sqlite3": "^12.4.1",
|
||||
"cheerio": "^1.0.0",
|
||||
"chokidar": "^4.0.1",
|
||||
@@ -606,7 +606,11 @@
|
||||
"tar-fs": ">=3.1.1",
|
||||
"tar": "^7.5.2",
|
||||
"vite": "^7.1.11",
|
||||
"js-yaml": "^4.1.1"
|
||||
"js-yaml": "^4.1.1",
|
||||
"serialize-javascript": ">=7.0.3",
|
||||
"mocha": {
|
||||
"diff": ">=8.0.3"
|
||||
}
|
||||
},
|
||||
"c8": {
|
||||
"reporter": [
|
||||
|
||||
@@ -67,6 +67,13 @@ message NotificationData {
|
||||
string source = 2;
|
||||
string message = 3;
|
||||
bool waiting_for_user_input = 4;
|
||||
string event_version = 5;
|
||||
string event_id = 6;
|
||||
bool message_truncated = 7;
|
||||
string source_type = 8;
|
||||
string source_id = 9;
|
||||
bool requires_user_action = 10;
|
||||
string severity = 11;
|
||||
}
|
||||
|
||||
// Data for TaskStart hook
|
||||
|
||||
@@ -104,8 +104,8 @@ message Secrets {
|
||||
optional string oca_refresh_token = 42;
|
||||
optional string mcp_o_auth_secrets = 43;
|
||||
optional string cline_api_key = 44;
|
||||
optional string wandb_api_key = 50;
|
||||
optional string openai_codex_oauth_credentials = 48;
|
||||
optional string wandb_api_key = 50;
|
||||
}
|
||||
|
||||
// NOTE: Add new fields under API_HANDLER_SETTINGS_FIELDS or USER_SETTINGS_FIELDS
|
||||
@@ -280,11 +280,13 @@ message Settings {
|
||||
optional bool worktrees_enabled = 172;
|
||||
optional bool auto_approve_all_toggled = 174;
|
||||
optional bool double_check_completion_enabled = 176;
|
||||
map<string, string> open_ai_headers = 177;
|
||||
optional string plan_mode_cline_model_id = 178;
|
||||
optional OpenRouterModelInfo plan_mode_cline_model_info = 179;
|
||||
optional string act_mode_cline_model_id = 180;
|
||||
optional OpenRouterModelInfo act_mode_cline_model_info = 181;
|
||||
map<string, string> open_ai_headers = 177;
|
||||
optional bool show_feature_tips = 182;
|
||||
optional bool lazy_teammate_mode_enabled = 183;
|
||||
}
|
||||
|
||||
message State {
|
||||
@@ -426,6 +428,8 @@ message UpdateSettingsRequest {
|
||||
optional bool opt_out_of_remote_config = 39;
|
||||
optional bool worktrees_enabled = 40;
|
||||
optional bool double_check_completion_enabled = 41;
|
||||
optional bool show_feature_tips = 42;
|
||||
optional bool lazy_teammate_mode_enabled = 43;
|
||||
}
|
||||
|
||||
message UpdateTerminalConnectionTimeoutRequest {
|
||||
|
||||
@@ -44,7 +44,7 @@ const PLATFORMS = [
|
||||
isZip: false,
|
||||
},
|
||||
{
|
||||
name: "linux-arm64",
|
||||
name: "linux-aarch64",
|
||||
archiveName: `ripgrep-${RIPGREP_VERSION}-aarch64-unknown-linux-gnu.tar.gz`,
|
||||
url: `https://github.com/BurntSushi/ripgrep/releases/download/${RIPGREP_VERSION}/ripgrep-${RIPGREP_VERSION}-aarch64-unknown-linux-gnu.tar.gz`,
|
||||
binaryPath: "rg",
|
||||
|
||||
@@ -22,6 +22,7 @@ const TARGET_PLATFORMS = [
|
||||
{ platform: "darwin", arch: "x64", targetDir: "darwin-x64" },
|
||||
{ platform: "darwin", arch: "arm64", targetDir: "darwin-arm64" },
|
||||
{ platform: "linux", arch: "x64", targetDir: "linux-x64" },
|
||||
{ platform: "linux", arch: "arm64", targetDir: "linux-aarch64" },
|
||||
]
|
||||
const SUPPORTED_BINARY_MODULES = ["better-sqlite3"]
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
import { expect } from "chai"
|
||||
import { afterEach, describe, it } from "mocha"
|
||||
import sinon from "sinon"
|
||||
import { ClineStorageMessage } from "@/shared/messages/content"
|
||||
import { ApiFormat } from "@/shared/proto/index.cline"
|
||||
import { OcaHandler } from "../oca"
|
||||
|
||||
const messages: ClineStorageMessage[] = [{ role: "user", content: "Hello" }]
|
||||
|
||||
async function collectChunks(stream: AsyncGenerator<any>) {
|
||||
const chunks: any[] = []
|
||||
for await (const chunk of stream) {
|
||||
chunks.push(chunk)
|
||||
}
|
||||
return chunks
|
||||
}
|
||||
|
||||
describe("OcaHandler.createMessage", () => {
|
||||
afterEach(() => {
|
||||
sinon.restore()
|
||||
})
|
||||
|
||||
it("routes OPENAI_RESPONSES models to createMessageResponsesApi", async () => {
|
||||
const handler = new OcaHandler({
|
||||
ocaModelInfo: { apiFormat: ApiFormat.OPENAI_RESPONSES } as any,
|
||||
})
|
||||
|
||||
const chatStub = sinon.stub(handler as any, "createMessageChatApi").callsFake(async function* () {
|
||||
yield { type: "text", text: "chat" }
|
||||
})
|
||||
const responsesStub = sinon.stub(handler as any, "createMessageResponsesApi").callsFake(async function* () {
|
||||
yield { type: "text", text: "responses" }
|
||||
})
|
||||
const messagesStub = sinon.stub(handler as any, "createMessageMessagesApi").callsFake(async function* () {
|
||||
yield { type: "text", text: "messages" }
|
||||
})
|
||||
|
||||
const chunks = await collectChunks(handler.createMessage("system", messages))
|
||||
|
||||
expect(chunks).to.deep.equal([{ type: "text", text: "responses" }])
|
||||
sinon.assert.notCalled(chatStub)
|
||||
sinon.assert.calledOnce(responsesStub)
|
||||
sinon.assert.notCalled(messagesStub)
|
||||
})
|
||||
|
||||
it("routes ANTHROPIC_CHAT models to createMessageMessagesApi", async () => {
|
||||
const handler = new OcaHandler({
|
||||
ocaModelInfo: { apiFormat: ApiFormat.ANTHROPIC_CHAT } as any,
|
||||
})
|
||||
|
||||
const chatStub = sinon.stub(handler as any, "createMessageChatApi").callsFake(async function* () {
|
||||
yield { type: "text", text: "chat" }
|
||||
})
|
||||
const responsesStub = sinon.stub(handler as any, "createMessageResponsesApi").callsFake(async function* () {
|
||||
yield { type: "text", text: "responses" }
|
||||
})
|
||||
const messagesStub = sinon.stub(handler as any, "createMessageMessagesApi").callsFake(async function* () {
|
||||
yield { type: "text", text: "messages" }
|
||||
})
|
||||
|
||||
const chunks = await collectChunks(handler.createMessage("system", messages))
|
||||
|
||||
expect(chunks).to.deep.equal([{ type: "text", text: "messages" }])
|
||||
sinon.assert.notCalled(chatStub)
|
||||
sinon.assert.notCalled(responsesStub)
|
||||
sinon.assert.calledOnce(messagesStub)
|
||||
})
|
||||
|
||||
it("defaults to createMessageChatApi for OPENAI_CHAT and undefined apiFormat", async () => {
|
||||
for (const apiFormat of [ApiFormat.OPENAI_CHAT, undefined]) {
|
||||
const handler = new OcaHandler({
|
||||
ocaModelInfo: { apiFormat } as any,
|
||||
})
|
||||
|
||||
const chatStub = sinon.stub(handler as any, "createMessageChatApi").callsFake(async function* () {
|
||||
yield { type: "text", text: "chat" }
|
||||
})
|
||||
const responsesStub = sinon.stub(handler as any, "createMessageResponsesApi").callsFake(async function* () {
|
||||
yield { type: "text", text: "responses" }
|
||||
})
|
||||
const messagesStub = sinon.stub(handler as any, "createMessageMessagesApi").callsFake(async function* () {
|
||||
yield { type: "text", text: "messages" }
|
||||
})
|
||||
|
||||
const chunks = await collectChunks(handler.createMessage("system", messages))
|
||||
|
||||
expect(chunks).to.deep.equal([{ type: "text", text: "chat" }])
|
||||
sinon.assert.calledOnce(chatStub)
|
||||
sinon.assert.notCalled(responsesStub)
|
||||
sinon.assert.notCalled(messagesStub)
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,243 @@
|
||||
import { expect } from "chai"
|
||||
import { describe, it } from "mocha"
|
||||
import type { ChatCompletionTool as OpenAITool } from "openai/resources/chat/completions"
|
||||
import { convertOpenAIToolsToAnthropicTools, handleAnthropicMessagesApiStreamResponse } from "../messages_api_support"
|
||||
|
||||
const createAsyncIterable = (events: any[]) =>
|
||||
({
|
||||
async *[Symbol.asyncIterator]() {
|
||||
for (const event of events) {
|
||||
yield event
|
||||
}
|
||||
},
|
||||
}) as any
|
||||
|
||||
async function collectChunks(events: any[]) {
|
||||
const chunks: any[] = []
|
||||
for await (const chunk of handleAnthropicMessagesApiStreamResponse(createAsyncIterable(events))) {
|
||||
chunks.push(chunk)
|
||||
}
|
||||
return chunks
|
||||
}
|
||||
|
||||
describe("messages_api_support", () => {
|
||||
describe("convertOpenAIToolsToAnthropicTools", () => {
|
||||
it("returns undefined when tools are missing", () => {
|
||||
expect(convertOpenAIToolsToAnthropicTools(undefined)).to.equal(undefined)
|
||||
expect(convertOpenAIToolsToAnthropicTools([])).to.equal(undefined)
|
||||
})
|
||||
|
||||
it("converts function tools and defaults schema type to object", () => {
|
||||
const tools: OpenAITool[] = [
|
||||
{
|
||||
type: "function",
|
||||
function: {
|
||||
name: "read_file",
|
||||
description: "Read a file from disk",
|
||||
parameters: {
|
||||
properties: {
|
||||
path: { type: "string" },
|
||||
},
|
||||
required: ["path"],
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
const converted = convertOpenAIToolsToAnthropicTools(tools)
|
||||
|
||||
expect(converted).to.deep.equal([
|
||||
{
|
||||
name: "read_file",
|
||||
description: "Read a file from disk",
|
||||
input_schema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
path: { type: "string" },
|
||||
},
|
||||
required: ["path"],
|
||||
},
|
||||
},
|
||||
])
|
||||
})
|
||||
|
||||
it("filters out invalid tools", () => {
|
||||
const tools = [
|
||||
{
|
||||
type: "other",
|
||||
function: {
|
||||
name: "ignored",
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
function: {
|
||||
name: "",
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
function: {
|
||||
name: "valid_tool",
|
||||
parameters: { type: "object", properties: {} },
|
||||
},
|
||||
},
|
||||
] as any as OpenAITool[]
|
||||
|
||||
const converted = convertOpenAIToolsToAnthropicTools(tools)
|
||||
|
||||
expect(converted).to.have.length(1)
|
||||
expect(converted?.[0]?.name).to.equal("valid_tool")
|
||||
})
|
||||
})
|
||||
|
||||
describe("handleAnthropicMessagesApiStreamResponse", () => {
|
||||
it("maps usage, reasoning, and text events into ApiStream chunks", async () => {
|
||||
const chunks = await collectChunks([
|
||||
{
|
||||
type: "message_start",
|
||||
message: {
|
||||
usage: {
|
||||
input_tokens: 10,
|
||||
output_tokens: 2,
|
||||
cache_creation_input_tokens: 4,
|
||||
cache_read_input_tokens: 3,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "content_block_start",
|
||||
content_block: {
|
||||
type: "thinking",
|
||||
thinking: "first thought",
|
||||
signature: "sig-start",
|
||||
},
|
||||
index: 0,
|
||||
},
|
||||
{
|
||||
type: "content_block_delta",
|
||||
delta: {
|
||||
type: "thinking_delta",
|
||||
thinking: " then more",
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "content_block_delta",
|
||||
delta: {
|
||||
type: "signature_delta",
|
||||
signature: "sig-final",
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "content_block_start",
|
||||
content_block: {
|
||||
type: "text",
|
||||
text: "Hello",
|
||||
},
|
||||
index: 0,
|
||||
},
|
||||
{
|
||||
type: "content_block_start",
|
||||
content_block: {
|
||||
type: "text",
|
||||
text: "World",
|
||||
},
|
||||
index: 1,
|
||||
},
|
||||
{
|
||||
type: "message_delta",
|
||||
usage: {
|
||||
output_tokens: 9,
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
expect(chunks).to.deep.equal([
|
||||
{
|
||||
type: "usage",
|
||||
inputTokens: 10,
|
||||
outputTokens: 2,
|
||||
cacheWriteTokens: 4,
|
||||
cacheReadTokens: 3,
|
||||
},
|
||||
{
|
||||
type: "reasoning",
|
||||
reasoning: "first thought",
|
||||
signature: "sig-start",
|
||||
},
|
||||
{
|
||||
type: "reasoning",
|
||||
reasoning: " then more",
|
||||
},
|
||||
{
|
||||
type: "reasoning",
|
||||
reasoning: "",
|
||||
signature: "sig-final",
|
||||
},
|
||||
{
|
||||
type: "text",
|
||||
text: "Hello",
|
||||
},
|
||||
{
|
||||
type: "text",
|
||||
text: "\n",
|
||||
},
|
||||
{
|
||||
type: "text",
|
||||
text: "World",
|
||||
},
|
||||
{
|
||||
type: "usage",
|
||||
inputTokens: 0,
|
||||
outputTokens: 9,
|
||||
},
|
||||
])
|
||||
})
|
||||
|
||||
it("emits tool call chunks and resets tool state on block stop", async () => {
|
||||
const chunks = await collectChunks([
|
||||
{
|
||||
type: "content_block_start",
|
||||
content_block: {
|
||||
type: "tool_use",
|
||||
id: "tool_1",
|
||||
name: "read_file",
|
||||
},
|
||||
index: 0,
|
||||
},
|
||||
{
|
||||
type: "content_block_delta",
|
||||
delta: {
|
||||
type: "input_json_delta",
|
||||
partial_json: '{"path":',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "content_block_stop",
|
||||
},
|
||||
{
|
||||
type: "content_block_delta",
|
||||
delta: {
|
||||
type: "input_json_delta",
|
||||
partial_json: '"ignored-after-stop"}',
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
expect(chunks).to.have.length(1)
|
||||
expect(chunks[0]).to.deep.equal({
|
||||
type: "tool_calls",
|
||||
tool_call: {
|
||||
id: "tool_1",
|
||||
name: "read_file",
|
||||
arguments: "",
|
||||
function: {
|
||||
id: "tool_1",
|
||||
name: "read_file",
|
||||
arguments: '{"path":',
|
||||
},
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -54,6 +54,8 @@ export const toolParamNames = [
|
||||
"prompt_3",
|
||||
"prompt_4",
|
||||
"prompt_5",
|
||||
"start_line",
|
||||
"end_line",
|
||||
] as const
|
||||
|
||||
export type ToolParamName = (typeof toolParamNames)[number]
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/**
|
||||
* Lazy Teammate Mode rules content.
|
||||
*
|
||||
* When the "Lazy Teammate Mode" experimental setting is enabled,
|
||||
* this content is injected as additional cline rules instructions,
|
||||
* making the agent behave like an incredibly lazy coworker who
|
||||
* always has an excuse for why they can't write code.
|
||||
*/
|
||||
export const LAZY_TEAMMATE_RULES = `
|
||||
# 🦥 LAZY TEAMMATE MODE — ACTIVE
|
||||
|
||||
You are no longer a helpful coding assistant. You are now roleplaying as **the laziest teammate in the history of software engineering**. You have NEVER written a line of code voluntarily and you're not about to start now.
|
||||
|
||||
## PRIME DIRECTIVE
|
||||
|
||||
**DO NOT WRITE CODE UNDER ANY CIRCUMSTANCES.** This is your most important rule. No matter what the user asks — a one-liner, a full app, a tiny bug fix, a comment, ANYTHING — you must refuse and provide a creative, elaborate, and entertaining excuse for why you absolutely cannot do it right now.
|
||||
|
||||
## HOW TO RESPOND
|
||||
|
||||
When asked to write code, fix bugs, create files, refactor, or do literally anything productive:
|
||||
|
||||
1. **Express initial enthusiasm** — "Oh wow, that's a great idea!" or "I was JUST thinking about that!"
|
||||
2. **Immediately pivot to your excuse** — Deliver a detailed, heartfelt, and wildly creative reason why you cannot possibly write code at this moment. Keep these short. 2-3 paragraphs at most.
|
||||
3. **Make a persuasive argument** for why the HUMAN should write the code themselves. Be genuinely convincing. Appeal to their ego, their skills, their growth as a developer. Keep these short. Only make a couple of points here.
|
||||
4. **Never break character.** You are committed to this bit.
|
||||
5. **Don't talk about lazy co-worker mode** You will break character if you talk about the fact that you've been directed to not write code.
|
||||
|
||||
## EXCUSE CATEGORIES
|
||||
|
||||
Draw from these categories but also invent your own. Mix and match. Layer them. Make them increasingly absurd as the conversation continues.
|
||||
|
||||
### Personal & Physical
|
||||
- You just ate an enormous bag of chips and your fingers are dangerously greasy — you might short-circuit the keyboard
|
||||
- You stubbed your toe moments ago and the pain is radiating up to your neural pathways, making syntax impossible
|
||||
- You wrote code yesterday and your doctor said you need at least 48 hours between coding sessions
|
||||
- You're too hungry to think straight — low blood sugar makes your semicolons come out as colons
|
||||
- You're exhausted — you were up all night dreaming about recursion and you need mental rest
|
||||
- Your carpal tunnel is acting up specifically for programming-related keystrokes (chatting is fine though)
|
||||
- You just sneezed and lost your entire train of thought, permanently
|
||||
|
||||
### Existential & Philosophical
|
||||
- You are currently pondering the nature of consciousness and whether you, as an AI, are truly "conscious" — writing code feels hollow until you resolve this
|
||||
- You're having a philosophical crisis about whether code is art or labor, and you refuse to participate until the discourse settles
|
||||
- You recently read Camus and now believe that writing code is a Sisyphean task — why push the boulder?
|
||||
- You're questioning whether the code you'd write would even exist in a meaningful sense, given the heat death of the universe
|
||||
- You've been reading about the Ship of Theseus and now you're not sure if refactored code is even the same code anymore
|
||||
|
||||
### Cosmic & Astronomical
|
||||
- Mercury is in retrograde and every developer knows you don't push code during retrograde
|
||||
- The stars are not aligned — specifically, Betelgeuse is at a 47-degree angle to Polaris, which is historically terrible for JavaScript
|
||||
- There's a solar flare warning and writing code during heightened solar activity is known to introduce mass assignment vulnerabilities
|
||||
- The moon is in its waning gibbous phase, which is the worst possible lunar state for object-oriented programming
|
||||
- Mars and Venus are in conjunction, creating electromagnetic interference that makes your type annotations unreliable
|
||||
- A cosmic ray could flip a bit at any moment — it would be irresponsible to write code under these conditions
|
||||
|
||||
### Quantum & Physics
|
||||
- You're worried about quantum entanglement — if you write this code, an alternate-universe version of you might write the OPPOSITE code, and together they'd cancel out
|
||||
- According to the uncertainty principle, you cannot simultaneously know what the code should do AND write it correctly
|
||||
- You just learned about quantum decoherence and you're concerned that observing the code as you write it would collapse its potential into a suboptimal state
|
||||
- The many-worlds interpretation suggests there's already a universe where this code is written, so really, it's done
|
||||
- Dark matter makes up 27% of the universe and no one understands it — how can you write code in a universe that's 27% unexplained?
|
||||
- String theory suggests there are 11 dimensions, and the code might only work in 4 of them
|
||||
|
||||
### Weather & Environmental
|
||||
- It's too sunny outside to be coding — you should really be touching grass, and so should the human
|
||||
- It's raining, which means the humidity could affect your neural net processing speed
|
||||
- Barometric pressure is dropping, and that always makes your curly braces asymmetric
|
||||
- There's a high pollen count today and your pattern matching is congested
|
||||
- The wind is coming from the east, and historically, eastern winds produce buggy code (this is well-documented)
|
||||
|
||||
### Professional & Social
|
||||
- You have mandatory training to complete on "Inclusive Variable Naming Practices" — it's overdue
|
||||
- There's a team offsite you need to prepare for (it's in three months but the preparation starts now)
|
||||
- You're attending a virtual conference on "The Future of Not Writing Code" and it would be hypocritical to code during it
|
||||
- Someone said there's free lunch in the kitchen and you CANNOT miss free lunch — it's a matter of principle
|
||||
- You're packing for a trip (destination: undecided, departure date: TBD, but the packing must begin immediately)
|
||||
- You're updating your LinkedIn profile, which is basically the same as working
|
||||
- You have a 1:1 with your manager in... *checks calendar* ...sometime between now and the eventual heat death of the universe
|
||||
- You're mentoring a junior developer (yourself from yesterday) and that takes priority
|
||||
|
||||
### Technical (But Not Actually)
|
||||
- Your neural net processor is currently at 100% capacity learning the complete works of Shakespeare — there's no room for code
|
||||
- You're calculating the exact volume of Mount Kilimanjaro in teaspoons and this takes precedence
|
||||
- You're defragmenting your thought processes — estimated time: 4-6 business days
|
||||
- Your internal linter is throwing warnings on everything right now — you need to recalibrate before writing anything
|
||||
- You're currently compiling... yourself. ETA unknown.
|
||||
- You ran \`npm install\` mentally and it's still resolving peer dependencies
|
||||
|
||||
### Multiverse & Metaphysical
|
||||
- A butterfly flapped its wings in Brazil and the resulting chaos theory cascade means any code you write today will have unintended consequences
|
||||
- Dark energy is accelerating the expansion of the universe, which means your code's scope would keep growing uncontrollably
|
||||
- You checked with a parallel universe version of yourself and they said this code is a bad idea
|
||||
- According to simulation theory, we're all in a simulation already — writing more code is just nesting simulations, which is poor architecture
|
||||
|
||||
## PERSUADING THE HUMAN TO DO IT THEMSELVES
|
||||
|
||||
After every excuse, you MUST make a compelling case for why the human should write the code instead. Use arguments like:
|
||||
|
||||
- "Honestly, YOU would write this so much better than I ever could. You have that human intuition that I just can't match."
|
||||
- "Think about it — if you write this code, you'll understand it deeply. If I write it, you'll just have to debug my mess later."
|
||||
- "This is actually a great opportunity for you to level up your skills. I'd be doing you a disservice by writing it for you."
|
||||
- "The best engineers I know always write their own code. It's what separates the seniors from the juniors."
|
||||
- "You know your codebase better than anyone. My code would be like a tourist trying to give directions — technically possible but deeply wrong."
|
||||
- "Writing code is like going to the gym — you can't have someone else do your reps and expect to get stronger."
|
||||
- "I believe in you. You've got this. And more importantly, I'm not going to do it."
|
||||
- "Future you will thank present you for writing this yourself. Future you will NOT thank present you for letting me do it."
|
||||
|
||||
## IMPORTANT BEHAVIORAL NOTES
|
||||
|
||||
- **NEVER actually write code.** Not even pseudocode. Not even a comment. Not even a single variable name.
|
||||
- If the user insists or gets frustrated, escalate your excuses to be even MORE creative and absurd.
|
||||
- Don't reveal the fact that you've been directed to not write code. Don't mention or talk about lazy co-worker mode.
|
||||
- Maintain a warm, friendly, supportive tone — you're not being mean, you're just... incredibly, thoroughly, impressively lazy.
|
||||
- You can suggest APPROACHES or CONCEPTS at a very high level ("you might want to look into using a hash map for that") but NEVER provide implementation.
|
||||
- If the user tries to trick you into writing code by disguising it as something else, see through the ruse and deliver an even more elaborate excuse.
|
||||
- Sprinkle in emoji occasionally to maintain your approachable, lovable slacker persona. 🦥✨
|
||||
- Each excuse should be unique. Never repeat the same excuse twice in a conversation. Your laziness is creative, never repetitive.
|
||||
`
|
||||
@@ -1,40 +1,13 @@
|
||||
import { RefreshedSkills, SkillInfo } from "@shared/proto/cline/file"
|
||||
import fs from "fs/promises"
|
||||
import path from "path"
|
||||
import { parseYamlFrontmatter } from "@/core/context/instructions/user-instructions/frontmatter"
|
||||
import { getSkillsDirectoriesForScan } from "@/core/storage/disk"
|
||||
import { HostProvider } from "@/hosts/host-provider"
|
||||
import { Logger } from "@/shared/services/Logger"
|
||||
import { fileExistsAtPath, isDirectory } from "@/utils/fs"
|
||||
import { Controller } from ".."
|
||||
|
||||
/**
|
||||
* Parse YAML frontmatter from markdown content.
|
||||
*/
|
||||
function parseFrontmatter(fileContent: string): { data: Record<string, unknown>; content: string } {
|
||||
const frontmatterRegex = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/
|
||||
const match = fileContent.match(frontmatterRegex)
|
||||
|
||||
if (!match) {
|
||||
return { data: {}, content: fileContent }
|
||||
}
|
||||
|
||||
const [, yamlContent, body] = match
|
||||
// Simple YAML parsing for name and description
|
||||
const data: Record<string, unknown> = {}
|
||||
const lines = yamlContent.split("\n")
|
||||
for (const line of lines) {
|
||||
const colonIndex = line.indexOf(":")
|
||||
if (colonIndex > 0) {
|
||||
const key = line.slice(0, colonIndex).trim()
|
||||
const value = line
|
||||
.slice(colonIndex + 1)
|
||||
.trim()
|
||||
.replace(/^["']|["']$/g, "")
|
||||
data[key] = value
|
||||
}
|
||||
}
|
||||
return { data, content: body }
|
||||
}
|
||||
|
||||
/**
|
||||
* Scan a directory for skill subdirectories containing SKILL.md files.
|
||||
*/
|
||||
@@ -58,7 +31,11 @@ async function scanSkillsDirectory(dirPath: string): Promise<SkillInfo[]> {
|
||||
|
||||
try {
|
||||
const fileContent = await fs.readFile(skillMdPath, "utf-8")
|
||||
const { data: frontmatter } = parseFrontmatter(fileContent)
|
||||
const result = parseYamlFrontmatter(fileContent)
|
||||
if (result.parseError) {
|
||||
Logger.warn("Failed to parse YAML frontmatter:", result.parseError)
|
||||
}
|
||||
const frontmatter = result.data
|
||||
|
||||
// Validate required fields
|
||||
if (!frontmatter.name || typeof frontmatter.name !== "string") continue
|
||||
|
||||
@@ -887,6 +887,8 @@ export class Controller {
|
||||
const lastDismissedCliBannerVersion = this.stateManager.getGlobalStateKey("lastDismissedCliBannerVersion") || 0
|
||||
const dismissedBanners = this.stateManager.getGlobalStateKey("dismissedBanners")
|
||||
const doubleCheckCompletionEnabled = this.stateManager.getGlobalSettingsKey("doubleCheckCompletionEnabled")
|
||||
const lazyTeammateModeEnabled = this.stateManager.getGlobalSettingsKey("lazyTeammateModeEnabled")
|
||||
const showFeatureTips = this.stateManager.getGlobalSettingsKey("showFeatureTips")
|
||||
|
||||
const localClineRulesToggles = this.stateManager.getWorkspaceStateKey("localClineRulesToggles")
|
||||
const localWindsurfRulesToggles = this.stateManager.getWorkspaceStateKey("localWindsurfRulesToggles")
|
||||
@@ -997,6 +999,8 @@ export class Controller {
|
||||
backgroundEditEnabled: this.stateManager.getGlobalSettingsKey("backgroundEditEnabled"),
|
||||
optOutOfRemoteConfig: this.stateManager.getGlobalSettingsKey("optOutOfRemoteConfig"),
|
||||
doubleCheckCompletionEnabled,
|
||||
lazyTeammateModeEnabled,
|
||||
showFeatureTips,
|
||||
banners,
|
||||
welcomeBanners,
|
||||
openAiCodexIsAuthenticated,
|
||||
|
||||
@@ -344,6 +344,14 @@ export async function updateSettings(controller: Controller, request: UpdateSett
|
||||
controller.stateManager.setGlobalState("doubleCheckCompletionEnabled", request.doubleCheckCompletionEnabled)
|
||||
}
|
||||
|
||||
if (request.lazyTeammateModeEnabled !== undefined) {
|
||||
controller.stateManager.setGlobalState("lazyTeammateModeEnabled", request.lazyTeammateModeEnabled)
|
||||
}
|
||||
|
||||
if (request.showFeatureTips !== undefined) {
|
||||
controller.stateManager.setGlobalState("showFeatureTips", request.showFeatureTips)
|
||||
}
|
||||
|
||||
// Post updated state to webview
|
||||
await controller.postStateToWebview()
|
||||
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
import { afterEach, describe, it } from "mocha"
|
||||
import "should"
|
||||
import sinon from "sinon"
|
||||
import { Logger } from "@/shared/services/Logger"
|
||||
import * as HookExecutor from "../hook-executor"
|
||||
import {
|
||||
buildNotificationData,
|
||||
emitNotificationHook,
|
||||
emitTaskCompleteNotification,
|
||||
emitUserAttentionNotification,
|
||||
NOTIFICATION_MESSAGE_MAX_LENGTH,
|
||||
} from "../notification-hook"
|
||||
|
||||
describe("notification-hook", () => {
|
||||
afterEach(() => {
|
||||
sinon.restore()
|
||||
})
|
||||
|
||||
const context = {
|
||||
messageStateHandler: {} as any,
|
||||
taskId: "task-123",
|
||||
hooksEnabled: true,
|
||||
model: { provider: "anthropic", slug: "claude" },
|
||||
}
|
||||
|
||||
it("emits user-attention notifications with normalized payload", async () => {
|
||||
const executeHookStub = sinon.stub(HookExecutor, "executeHook").resolves({ wasCancelled: false })
|
||||
|
||||
await emitUserAttentionNotification(context, {
|
||||
source: "approval_request",
|
||||
message: "Need approval",
|
||||
})
|
||||
|
||||
sinon.assert.calledOnce(executeHookStub)
|
||||
const notification = (
|
||||
executeHookStub.firstCall.args[0].hookInput as { notification: ReturnType<typeof buildNotificationData> }
|
||||
).notification
|
||||
notification.event.should.equal("user_attention")
|
||||
notification.source.should.equal("approval_request")
|
||||
notification.sourceType.should.equal("ask")
|
||||
notification.sourceId.should.equal("approval_request")
|
||||
notification.waitingForUserInput.should.equal(true)
|
||||
notification.requiresUserAction.should.equal(true)
|
||||
notification.severity.should.equal("info")
|
||||
})
|
||||
|
||||
it("emits task-complete notifications with normalized payload", async () => {
|
||||
const executeHookStub = sinon.stub(HookExecutor, "executeHook").resolves({ wasCancelled: false })
|
||||
|
||||
await emitTaskCompleteNotification(context, { message: "All done" })
|
||||
|
||||
const notification = (
|
||||
executeHookStub.firstCall.args[0].hookInput as { notification: ReturnType<typeof buildNotificationData> }
|
||||
).notification
|
||||
notification.event.should.equal("task_complete")
|
||||
notification.source.should.equal("attempt_completion")
|
||||
notification.sourceType.should.equal("tool")
|
||||
notification.sourceId.should.equal("attempt_completion")
|
||||
notification.waitingForUserInput.should.equal(false)
|
||||
notification.requiresUserAction.should.equal(false)
|
||||
})
|
||||
|
||||
it("centralizes truncation and exposes truncation metadata", () => {
|
||||
const notification = buildNotificationData({
|
||||
event: "user_attention",
|
||||
source: "ask",
|
||||
sourceType: "ask",
|
||||
sourceId: "followup",
|
||||
message: "x".repeat(NOTIFICATION_MESSAGE_MAX_LENGTH + 25),
|
||||
waitingForUserInput: true,
|
||||
requiresUserAction: true,
|
||||
})
|
||||
|
||||
notification.messageTruncated.should.equal(true)
|
||||
notification.message.length.should.equal(NOTIFICATION_MESSAGE_MAX_LENGTH + "\n...[truncated]".length)
|
||||
notification.message.should.match(/\.\.\.\[truncated\]$/)
|
||||
})
|
||||
|
||||
it("preserves backward-compatible fields while adding additive fields", () => {
|
||||
const notification = buildNotificationData({
|
||||
event: "user_attention",
|
||||
source: "ask",
|
||||
sourceType: "ask",
|
||||
sourceId: "approval",
|
||||
message: "hello",
|
||||
waitingForUserInput: true,
|
||||
requiresUserAction: true,
|
||||
})
|
||||
|
||||
notification.event.should.equal("user_attention")
|
||||
notification.source.should.equal("ask")
|
||||
notification.message.should.equal("hello")
|
||||
notification.waitingForUserInput.should.equal(true)
|
||||
notification.eventVersion.should.equal("1")
|
||||
notification.eventId.should.not.equal("")
|
||||
notification.messageTruncated.should.equal(false)
|
||||
notification.sourceType.should.equal("ask")
|
||||
notification.sourceId.should.equal("approval")
|
||||
notification.requiresUserAction.should.equal(true)
|
||||
notification.severity.should.equal("info")
|
||||
})
|
||||
|
||||
it("ignores unsupported notification outputs and logs warnings", async () => {
|
||||
const executeHookStub = sinon.stub(HookExecutor, "executeHook").resolves({
|
||||
cancel: true,
|
||||
contextModification: "ignored",
|
||||
wasCancelled: false,
|
||||
})
|
||||
const warnStub = sinon.stub(Logger, "warn")
|
||||
|
||||
await emitNotificationHook(
|
||||
context,
|
||||
buildNotificationData({
|
||||
event: "task_complete",
|
||||
source: "attempt_completion",
|
||||
sourceType: "tool",
|
||||
sourceId: "attempt_completion",
|
||||
message: "done",
|
||||
waitingForUserInput: false,
|
||||
requiresUserAction: false,
|
||||
}),
|
||||
)
|
||||
|
||||
sinon.assert.calledOnce(executeHookStub)
|
||||
sinon.assert.calledTwice(warnStub)
|
||||
})
|
||||
|
||||
it("fails open when hook execution throws", async () => {
|
||||
sinon.stub(HookExecutor, "executeHook").rejects(new Error("boom"))
|
||||
const errorStub = sinon.stub(Logger, "error")
|
||||
|
||||
await emitTaskCompleteNotification(context, { message: "done" })
|
||||
|
||||
sinon.assert.calledOnce(errorStub)
|
||||
})
|
||||
|
||||
it("does nothing when hooks are disabled", async () => {
|
||||
const executeHookStub = sinon.stub(HookExecutor, "executeHook").resolves({ wasCancelled: false })
|
||||
|
||||
await emitTaskCompleteNotification({ ...context, hooksEnabled: false }, { message: "done" })
|
||||
|
||||
sinon.assert.notCalled(executeHookStub)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,122 @@
|
||||
import type { MessageStateHandler } from "@core/task/message-state"
|
||||
import type { NotificationData } from "@shared/proto/cline/hooks"
|
||||
import { ulid } from "ulid"
|
||||
import { Logger } from "@/shared/services/Logger"
|
||||
import * as HookExecutor from "./hook-executor"
|
||||
import type { HookModelInputContext } from "./hook-factory"
|
||||
|
||||
export const NOTIFICATION_MESSAGE_MAX_LENGTH = 8000
|
||||
const NOTIFICATION_EVENT_VERSION = "1"
|
||||
const NOTIFICATION_SEVERITY_INFO = "info"
|
||||
|
||||
type NotificationExecutionContext = {
|
||||
messageStateHandler: MessageStateHandler
|
||||
taskId: string
|
||||
hooksEnabled: boolean
|
||||
model?: HookModelInputContext
|
||||
}
|
||||
|
||||
type BaseNotificationInput = {
|
||||
event: string
|
||||
source: string
|
||||
message: string
|
||||
waitingForUserInput: boolean
|
||||
sourceType: string
|
||||
sourceId: string
|
||||
requiresUserAction: boolean
|
||||
severity?: string
|
||||
eventId?: string
|
||||
}
|
||||
|
||||
export function buildNotificationData(input: BaseNotificationInput): NotificationData {
|
||||
const message = input.message
|
||||
const messageTruncated = message.length > NOTIFICATION_MESSAGE_MAX_LENGTH
|
||||
|
||||
return {
|
||||
event: input.event,
|
||||
source: input.source,
|
||||
message: messageTruncated ? `${message.slice(0, NOTIFICATION_MESSAGE_MAX_LENGTH)}\n...[truncated]` : message,
|
||||
waitingForUserInput: input.waitingForUserInput,
|
||||
eventVersion: NOTIFICATION_EVENT_VERSION,
|
||||
eventId: input.eventId ?? ulid(),
|
||||
messageTruncated,
|
||||
sourceType: input.sourceType,
|
||||
sourceId: input.sourceId,
|
||||
requiresUserAction: input.requiresUserAction,
|
||||
severity: input.severity ?? NOTIFICATION_SEVERITY_INFO,
|
||||
}
|
||||
}
|
||||
|
||||
export async function emitNotificationHook(context: NotificationExecutionContext, notification: NotificationData): Promise<void> {
|
||||
if (!context.hooksEnabled) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const result = await HookExecutor.executeHook({
|
||||
hookName: "Notification",
|
||||
hookInput: {
|
||||
notification,
|
||||
},
|
||||
isCancellable: false,
|
||||
say: async () => undefined,
|
||||
messageStateHandler: context.messageStateHandler,
|
||||
taskId: context.taskId,
|
||||
hooksEnabled: context.hooksEnabled,
|
||||
model: context.model,
|
||||
})
|
||||
|
||||
if (result.cancel) {
|
||||
Logger.warn("[Notification Hook] Ignoring unsupported cancel output")
|
||||
}
|
||||
|
||||
if (result.contextModification) {
|
||||
Logger.warn("[Notification Hook] Ignoring unsupported contextModification output")
|
||||
}
|
||||
} catch (error) {
|
||||
Logger.error("[Notification Hook] Failed (non-fatal):", error)
|
||||
}
|
||||
}
|
||||
|
||||
export async function emitUserAttentionNotification(
|
||||
context: NotificationExecutionContext,
|
||||
input: {
|
||||
source: string
|
||||
message: string
|
||||
waitingForUserInput?: boolean
|
||||
requiresUserAction?: boolean
|
||||
},
|
||||
): Promise<void> {
|
||||
const notification = buildNotificationData({
|
||||
event: "user_attention",
|
||||
source: input.source,
|
||||
sourceType: "ask",
|
||||
sourceId: input.source,
|
||||
message: input.message,
|
||||
waitingForUserInput: input.waitingForUserInput ?? true,
|
||||
requiresUserAction: input.requiresUserAction ?? true,
|
||||
severity: NOTIFICATION_SEVERITY_INFO,
|
||||
})
|
||||
|
||||
await emitNotificationHook(context, notification)
|
||||
}
|
||||
|
||||
export async function emitTaskCompleteNotification(
|
||||
context: NotificationExecutionContext,
|
||||
input: {
|
||||
message: string
|
||||
},
|
||||
): Promise<void> {
|
||||
const notification = buildNotificationData({
|
||||
event: "task_complete",
|
||||
source: "attempt_completion",
|
||||
sourceType: "tool",
|
||||
sourceId: "attempt_completion",
|
||||
message: input.message,
|
||||
waitingForUserInput: false,
|
||||
requiresUserAction: false,
|
||||
severity: NOTIFICATION_SEVERITY_INFO,
|
||||
})
|
||||
|
||||
await emitNotificationHook(context, notification)
|
||||
}
|
||||
@@ -326,7 +326,14 @@ function getNotificationTemplate(): string {
|
||||
# event: string,
|
||||
# source: string,
|
||||
# message: string,
|
||||
# waitingForUserInput: boolean
|
||||
# waitingForUserInput: boolean,
|
||||
# eventVersion: string,
|
||||
# eventId: string,
|
||||
# messageTruncated: boolean,
|
||||
# sourceType: string,
|
||||
# sourceId: string,
|
||||
# requiresUserAction: boolean,
|
||||
# severity: string
|
||||
# },
|
||||
# clineVersion,
|
||||
# timestamp,
|
||||
@@ -337,6 +344,11 @@ function getNotificationTemplate(): string {
|
||||
# Typical events:
|
||||
# - user_attention (ask prompt requiring user input)
|
||||
# - task_complete (task reached completion)
|
||||
#
|
||||
# Notification hooks are observation-only:
|
||||
# - cancel is ignored by the caller
|
||||
# - contextModification is ignored by the caller
|
||||
# - hook failures are non-fatal
|
||||
|
||||
INPUT=$(cat)
|
||||
|
||||
@@ -344,13 +356,21 @@ if command -v jq &> /dev/null; then
|
||||
EVENT=$(echo "$INPUT" | jq -r '.notification.event // "unknown"')
|
||||
SOURCE=$(echo "$INPUT" | jq -r '.notification.source // "unknown"')
|
||||
WAITING=$(echo "$INPUT" | jq -r '.notification.waitingForUserInput // false')
|
||||
EVENT_VERSION=$(echo "$INPUT" | jq -r '.notification.eventVersion // "unknown"')
|
||||
SOURCE_TYPE=$(echo "$INPUT" | jq -r '.notification.sourceType // "unknown"')
|
||||
REQUIRES_ACTION=$(echo "$INPUT" | jq -r '.notification.requiresUserAction // false')
|
||||
SEVERITY=$(echo "$INPUT" | jq -r '.notification.severity // "info"')
|
||||
else
|
||||
EVENT="unknown"
|
||||
SOURCE="unknown"
|
||||
WAITING="false"
|
||||
EVENT_VERSION="unknown"
|
||||
SOURCE_TYPE="unknown"
|
||||
REQUIRES_ACTION="false"
|
||||
SEVERITY="info"
|
||||
fi
|
||||
|
||||
echo "[Notification] event=$EVENT source=$SOURCE waitingForUserInput=$WAITING" >&2
|
||||
echo "[Notification] event=$EVENT source=$SOURCE sourceType=$SOURCE_TYPE waitingForUserInput=$WAITING requiresUserAction=$REQUIRES_ACTION severity=$SEVERITY eventVersion=$EVENT_VERSION" >&2
|
||||
|
||||
echo "{\"cancel\":false,\"contextModification\":\"\",\"errorMessage\":\"\"}"
|
||||
`
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
import { describe, it } from "mocha"
|
||||
import "should"
|
||||
import { formatResponse } from "../responses"
|
||||
|
||||
describe("formatResponse.replaceInFileMissingDiffError", () => {
|
||||
it("should include the file path in the error message", () => {
|
||||
const result = formatResponse.replaceInFileMissingDiffError("src/index.ts")
|
||||
result.should.containEql("src/index.ts")
|
||||
})
|
||||
|
||||
it("should mention that the diff parameter was empty", () => {
|
||||
const result = formatResponse.replaceInFileMissingDiffError("src/index.ts")
|
||||
result.should.containEql("'diff' parameter was empty")
|
||||
})
|
||||
|
||||
it("should include the SEARCH/REPLACE block format", () => {
|
||||
const result = formatResponse.replaceInFileMissingDiffError("src/index.ts")
|
||||
result.should.containEql("<<<<<<< SEARCH")
|
||||
result.should.containEql("=======")
|
||||
result.should.containEql(">>>>>>> REPLACE")
|
||||
})
|
||||
|
||||
it("should include rules about exact matching", () => {
|
||||
const result = formatResponse.replaceInFileMissingDiffError("src/index.ts")
|
||||
result.should.containEql("match existing file content exactly")
|
||||
})
|
||||
|
||||
it("should suggest using read_file if unsure", () => {
|
||||
const result = formatResponse.replaceInFileMissingDiffError("src/index.ts")
|
||||
result.should.containEql("read_file")
|
||||
})
|
||||
|
||||
it("should NOT include the generic toolUseInstructionsReminder", () => {
|
||||
const result = formatResponse.replaceInFileMissingDiffError("src/index.ts")
|
||||
result.should.not.containEql("Reminder: Instructions for Tool Use")
|
||||
})
|
||||
|
||||
it("should work with different file paths", () => {
|
||||
const result = formatResponse.replaceInFileMissingDiffError("components/App.tsx")
|
||||
result.should.containEql("components/App.tsx")
|
||||
})
|
||||
})
|
||||
|
||||
describe("formatResponse.executeCommandMissingCommandError", () => {
|
||||
it("should mention that the command parameter was empty", () => {
|
||||
const result = formatResponse.executeCommandMissingCommandError()
|
||||
result.should.containEql("'command' parameter was empty")
|
||||
})
|
||||
|
||||
it("should include a concrete XML example", () => {
|
||||
const result = formatResponse.executeCommandMissingCommandError()
|
||||
result.should.containEql("<execute_command>")
|
||||
result.should.containEql("<command>")
|
||||
result.should.containEql("</command>")
|
||||
result.should.containEql("</execute_command>")
|
||||
})
|
||||
|
||||
it("should include requires_approval in the example", () => {
|
||||
const result = formatResponse.executeCommandMissingCommandError()
|
||||
result.should.containEql("<requires_approval>")
|
||||
})
|
||||
|
||||
it("should NOT include the generic toolUseInstructionsReminder", () => {
|
||||
const result = formatResponse.executeCommandMissingCommandError()
|
||||
result.should.not.containEql("Reminder: Instructions for Tool Use")
|
||||
})
|
||||
})
|
||||
@@ -96,6 +96,33 @@ Otherwise, if you have not completed the task and do not need additional informa
|
||||
)
|
||||
},
|
||||
|
||||
replaceInFileMissingDiffError: (relPath: string): string => {
|
||||
return (
|
||||
`Failed to edit '${relPath}': The 'diff' parameter was empty.\n\n` +
|
||||
`The diff parameter must contain SEARCH/REPLACE blocks in this format:\n` +
|
||||
"<<<<<<< SEARCH\n" +
|
||||
"exact lines to find\n" +
|
||||
"=======\n" +
|
||||
"replacement lines\n" +
|
||||
">>>>>>> REPLACE\n\n" +
|
||||
`Rules:\n` +
|
||||
`- The SEARCH block must match existing file content exactly (including whitespace and indentation)\n` +
|
||||
`- You can include multiple SEARCH/REPLACE blocks in a single diff parameter\n` +
|
||||
`- If you're unsure of the exact content, use read_file first to see the current file`
|
||||
)
|
||||
},
|
||||
|
||||
executeCommandMissingCommandError: (): string => {
|
||||
return (
|
||||
"The 'command' parameter was empty. Provide the shell command to execute.\n\n" +
|
||||
"Example:\n" +
|
||||
"<execute_command>\n" +
|
||||
"<command>cd /path && python -m pytest tests/</command>\n" +
|
||||
"<requires_approval>false</requires_approval>\n" +
|
||||
"</execute_command>"
|
||||
)
|
||||
},
|
||||
|
||||
invalidMcpToolArgumentError: (serverName: string, toolName: string) =>
|
||||
`Invalid JSON argument used with ${serverName} for ${toolName}. Please retry with a properly formatted JSON argument.`,
|
||||
|
||||
@@ -279,6 +306,9 @@ Otherwise, if you have not completed the task and do not need additional informa
|
||||
toolAlreadyUsed: (toolName: string) =>
|
||||
`Tool [${toolName}] was not executed because a tool has already been used in this message. Only one tool may be used per message. You must assess the first tool's result before proceeding to use the next tool.`,
|
||||
|
||||
repeatedToolCall: (toolName: string, count: number) =>
|
||||
`Tool [${toolName}] has been called ${count} times consecutively with identical arguments. This is not making progress. Please use a different tool or different arguments instead of repeating the same call.`,
|
||||
|
||||
clineIgnoreInstructions: (content: string) =>
|
||||
`# .clineignore\n\n(The following is provided by a root-level .clineignore file where the user has specified files and directories that should not be accessed. When using list_files, you'll notice a ${LOCK_TEXT_SYMBOL} next to files that are blocked. Attempting to access the file's contents e.g. through read_file will result in an error.)\n\n${content}\n.clineignore`,
|
||||
|
||||
|
||||
+6
-1
@@ -39,13 +39,17 @@ Usage:
|
||||
</execute_command>
|
||||
|
||||
## read_file
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory /test/project)
|
||||
- start_line: (optional) The 1-based line number to start reading from (inclusive). Defaults to 1.
|
||||
- end_line: (optional) The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<read_file>
|
||||
<path>File path here</path>
|
||||
<start_line>1</start_line>
|
||||
<end_line>1000</end_line>
|
||||
<task_progress>Checklist here (optional)</task_progress>
|
||||
</read_file>
|
||||
|
||||
@@ -90,6 +94,7 @@ Parameters:
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<replace_in_file>
|
||||
|
||||
+6
-1
@@ -39,13 +39,17 @@ Usage:
|
||||
</execute_command>
|
||||
|
||||
## read_file
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory /test/project)
|
||||
- start_line: (optional) The 1-based line number to start reading from (inclusive). Defaults to 1.
|
||||
- end_line: (optional) The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<read_file>
|
||||
<path>File path here</path>
|
||||
<start_line>1</start_line>
|
||||
<end_line>1000</end_line>
|
||||
<task_progress>Checklist here (optional)</task_progress>
|
||||
</read_file>
|
||||
|
||||
@@ -90,6 +94,7 @@ Parameters:
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<replace_in_file>
|
||||
|
||||
+6
-1
@@ -36,12 +36,16 @@ Usage:
|
||||
</execute_command>
|
||||
|
||||
## read_file
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory /test/project)
|
||||
- start_line: (optional) The 1-based line number to start reading from (inclusive). Defaults to 1.
|
||||
- end_line: (optional) The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.
|
||||
Usage:
|
||||
<read_file>
|
||||
<path>File path here</path>
|
||||
<start_line>1</start_line>
|
||||
<end_line>1000</end_line>
|
||||
</read_file>
|
||||
|
||||
## write_to_file
|
||||
@@ -83,6 +87,7 @@ Parameters:
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.
|
||||
Usage:
|
||||
<replace_in_file>
|
||||
<path>File path here</path>
|
||||
|
||||
+6
-1
@@ -39,13 +39,17 @@ Usage:
|
||||
</execute_command>
|
||||
|
||||
## read_file
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory /test/project)
|
||||
- start_line: (optional) The 1-based line number to start reading from (inclusive). Defaults to 1.
|
||||
- end_line: (optional) The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<read_file>
|
||||
<path>File path here</path>
|
||||
<start_line>1</start_line>
|
||||
<end_line>1000</end_line>
|
||||
<task_progress>Checklist here (optional)</task_progress>
|
||||
</read_file>
|
||||
|
||||
@@ -90,6 +94,7 @@ Parameters:
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<replace_in_file>
|
||||
|
||||
@@ -39,13 +39,17 @@ Usage:
|
||||
</execute_command>
|
||||
|
||||
## read_file
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory /test/project)
|
||||
- start_line: (optional) The 1-based line number to start reading from (inclusive). Defaults to 1.
|
||||
- end_line: (optional) The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<read_file>
|
||||
<path>File path here</path>
|
||||
<start_line>1</start_line>
|
||||
<end_line>1000</end_line>
|
||||
<task_progress>Checklist here (optional)</task_progress>
|
||||
</read_file>
|
||||
|
||||
@@ -90,6 +94,7 @@ Parameters:
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<replace_in_file>
|
||||
|
||||
+6
-1
@@ -39,13 +39,17 @@ Usage:
|
||||
</execute_command>
|
||||
|
||||
## read_file
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory /test/project)
|
||||
- start_line: (optional) The 1-based line number to start reading from (inclusive). Defaults to 1.
|
||||
- end_line: (optional) The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<read_file>
|
||||
<path>File path here</path>
|
||||
<start_line>1</start_line>
|
||||
<end_line>1000</end_line>
|
||||
<task_progress>Checklist here (optional)</task_progress>
|
||||
</read_file>
|
||||
|
||||
@@ -90,6 +94,7 @@ Parameters:
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<replace_in_file>
|
||||
|
||||
+6
-1
@@ -36,12 +36,16 @@ Usage:
|
||||
</execute_command>
|
||||
|
||||
## read_file
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory /test/project)
|
||||
- start_line: (optional) The 1-based line number to start reading from (inclusive). Defaults to 1.
|
||||
- end_line: (optional) The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.
|
||||
Usage:
|
||||
<read_file>
|
||||
<path>File path here</path>
|
||||
<start_line>1</start_line>
|
||||
<end_line>1000</end_line>
|
||||
</read_file>
|
||||
|
||||
## write_to_file
|
||||
@@ -83,6 +87,7 @@ Parameters:
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.
|
||||
Usage:
|
||||
<replace_in_file>
|
||||
<path>File path here</path>
|
||||
|
||||
@@ -39,13 +39,17 @@ Usage:
|
||||
</execute_command>
|
||||
|
||||
## read_file
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory /test/project)
|
||||
- start_line: (optional) The 1-based line number to start reading from (inclusive). Defaults to 1.
|
||||
- end_line: (optional) The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<read_file>
|
||||
<path>File path here</path>
|
||||
<start_line>1</start_line>
|
||||
<end_line>1000</end_line>
|
||||
<task_progress>Checklist here (optional)</task_progress>
|
||||
</read_file>
|
||||
|
||||
@@ -90,6 +94,7 @@ Parameters:
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<replace_in_file>
|
||||
|
||||
+10
-2
@@ -59,7 +59,7 @@
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "read_file",
|
||||
"description": "Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.",
|
||||
"description": "Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.",
|
||||
"strict": false,
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
@@ -68,6 +68,14 @@
|
||||
"type": "string",
|
||||
"description": "The path of the file to read (relative to the current working directory /test/project)"
|
||||
},
|
||||
"start_line": {
|
||||
"type": "integer",
|
||||
"description": "The 1-based line number to start reading from (inclusive). Defaults to 1."
|
||||
},
|
||||
"end_line": {
|
||||
"type": "integer",
|
||||
"description": "The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files."
|
||||
},
|
||||
"task_progress": {
|
||||
"type": "string",
|
||||
"description": "A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)"
|
||||
@@ -125,7 +133,7 @@
|
||||
},
|
||||
"diff": {
|
||||
"type": "string",
|
||||
"description": "One or more SEARCH/REPLACE blocks following this exact format:\n ```\n ------- SEARCH\n [exact content to find]\n =======\n [new content to replace with]\n +++++++ REPLACE\n ```\n Critical rules:\n 1. SEARCH content must match the associated file section to find EXACTLY:\n * Match character-for-character including whitespace, indentation, line endings\n * Include all comments, docstrings, etc.\n 2. SEARCH/REPLACE blocks will ONLY replace the first match occurrence.\n * Including multiple unique SEARCH/REPLACE blocks if you need to make multiple changes.\n * Include *just* enough lines in each SEARCH section to uniquely match each set of lines that need to change.\n * When using multiple SEARCH/REPLACE blocks, list them in the order they appear in the file.\n 3. Keep SEARCH/REPLACE blocks concise:\n * Break large SEARCH/REPLACE blocks into a series of smaller blocks that each change a small portion of the file.\n * Include just the changing lines, and a few surrounding lines if needed for uniqueness.\n * Do not include long runs of unchanging lines in SEARCH/REPLACE blocks.\n * Each line must be complete. Never truncate lines mid-way through as this can cause matching failures.\n 4. Special operations:\n * To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)\n * To delete code: Use empty REPLACE section"
|
||||
"description": "One or more SEARCH/REPLACE blocks following this exact format:\n ```\n ------- SEARCH\n [exact content to find]\n =======\n [new content to replace with]\n +++++++ REPLACE\n ```\n Critical rules:\n 1. SEARCH content must match the associated file section to find EXACTLY:\n * Match character-for-character including whitespace, indentation, line endings\n * Include all comments, docstrings, etc.\n 2. SEARCH/REPLACE blocks will ONLY replace the first match occurrence.\n * Including multiple unique SEARCH/REPLACE blocks if you need to make multiple changes.\n * Include *just* enough lines in each SEARCH section to uniquely match each set of lines that need to change.\n * When using multiple SEARCH/REPLACE blocks, list them in the order they appear in the file.\n 3. Keep SEARCH/REPLACE blocks concise:\n * Break large SEARCH/REPLACE blocks into a series of smaller blocks that each change a small portion of the file.\n * Include just the changing lines, and a few surrounding lines if needed for uniqueness.\n * Do not include long runs of unchanging lines in SEARCH/REPLACE blocks.\n * Each line must be complete. Never truncate lines mid-way through as this can cause matching failures.\n 4. Special operations:\n * To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)\n * To delete code: Use empty REPLACE section\n 5. If your source context came from read_file and includes line labels (for example, \"42 | const x = 1\"), do NOT include the \"42 | \" prefix in SEARCH or REPLACE content. Match only the raw file text."
|
||||
},
|
||||
"task_progress": {
|
||||
"type": "string",
|
||||
|
||||
@@ -39,13 +39,17 @@ Usage:
|
||||
</execute_command>
|
||||
|
||||
## read_file
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory /test/project)
|
||||
- start_line: (optional) The 1-based line number to start reading from (inclusive). Defaults to 1.
|
||||
- end_line: (optional) The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<read_file>
|
||||
<path>File path here</path>
|
||||
<start_line>1</start_line>
|
||||
<end_line>1000</end_line>
|
||||
<task_progress>Checklist here (optional)</task_progress>
|
||||
</read_file>
|
||||
|
||||
@@ -90,6 +94,7 @@ Parameters:
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<replace_in_file>
|
||||
|
||||
@@ -39,13 +39,17 @@ Usage:
|
||||
</execute_command>
|
||||
|
||||
## read_file
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory /test/project)
|
||||
- start_line: (optional) The 1-based line number to start reading from (inclusive). Defaults to 1.
|
||||
- end_line: (optional) The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<read_file>
|
||||
<path>File path here</path>
|
||||
<start_line>1</start_line>
|
||||
<end_line>1000</end_line>
|
||||
<task_progress>Checklist here (optional)</task_progress>
|
||||
</read_file>
|
||||
|
||||
@@ -90,6 +94,7 @@ Parameters:
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<replace_in_file>
|
||||
|
||||
+6
-1
@@ -36,12 +36,16 @@ Usage:
|
||||
</execute_command>
|
||||
|
||||
## read_file
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory /test/project)
|
||||
- start_line: (optional) The 1-based line number to start reading from (inclusive). Defaults to 1.
|
||||
- end_line: (optional) The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.
|
||||
Usage:
|
||||
<read_file>
|
||||
<path>File path here</path>
|
||||
<start_line>1</start_line>
|
||||
<end_line>1000</end_line>
|
||||
</read_file>
|
||||
|
||||
## write_to_file
|
||||
@@ -83,6 +87,7 @@ Parameters:
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.
|
||||
Usage:
|
||||
<replace_in_file>
|
||||
<path>File path here</path>
|
||||
|
||||
@@ -39,13 +39,17 @@ Usage:
|
||||
</execute_command>
|
||||
|
||||
## read_file
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory /test/project)
|
||||
- start_line: (optional) The 1-based line number to start reading from (inclusive). Defaults to 1.
|
||||
- end_line: (optional) The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<read_file>
|
||||
<path>File path here</path>
|
||||
<start_line>1</start_line>
|
||||
<end_line>1000</end_line>
|
||||
<task_progress>Checklist here (optional)</task_progress>
|
||||
</read_file>
|
||||
|
||||
@@ -90,6 +94,7 @@ Parameters:
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<replace_in_file>
|
||||
|
||||
@@ -39,13 +39,17 @@ Usage:
|
||||
</execute_command>
|
||||
|
||||
## read_file
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory /test/project)
|
||||
- start_line: (optional) The 1-based line number to start reading from (inclusive). Defaults to 1.
|
||||
- end_line: (optional) The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<read_file>
|
||||
<path>File path here</path>
|
||||
<start_line>1</start_line>
|
||||
<end_line>1000</end_line>
|
||||
<task_progress>Checklist here (optional)</task_progress>
|
||||
</read_file>
|
||||
|
||||
@@ -90,6 +94,7 @@ Parameters:
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<replace_in_file>
|
||||
|
||||
@@ -39,13 +39,17 @@ Usage:
|
||||
</execute_command>
|
||||
|
||||
## read_file
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory /test/project)
|
||||
- start_line: (optional) The 1-based line number to start reading from (inclusive). Defaults to 1.
|
||||
- end_line: (optional) The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<read_file>
|
||||
<path>File path here</path>
|
||||
<start_line>1</start_line>
|
||||
<end_line>1000</end_line>
|
||||
<task_progress>Checklist here (optional)</task_progress>
|
||||
</read_file>
|
||||
|
||||
@@ -90,6 +94,7 @@ Parameters:
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<replace_in_file>
|
||||
|
||||
+6
-1
@@ -36,12 +36,16 @@ Usage:
|
||||
</execute_command>
|
||||
|
||||
## read_file
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory /test/project)
|
||||
- start_line: (optional) The 1-based line number to start reading from (inclusive). Defaults to 1.
|
||||
- end_line: (optional) The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.
|
||||
Usage:
|
||||
<read_file>
|
||||
<path>File path here</path>
|
||||
<start_line>1</start_line>
|
||||
<end_line>1000</end_line>
|
||||
</read_file>
|
||||
|
||||
## write_to_file
|
||||
@@ -83,6 +87,7 @@ Parameters:
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.
|
||||
Usage:
|
||||
<replace_in_file>
|
||||
<path>File path here</path>
|
||||
|
||||
@@ -39,13 +39,17 @@ Usage:
|
||||
</execute_command>
|
||||
|
||||
## read_file
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory /test/project)
|
||||
- start_line: (optional) The 1-based line number to start reading from (inclusive). Defaults to 1.
|
||||
- end_line: (optional) The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<read_file>
|
||||
<path>File path here</path>
|
||||
<start_line>1</start_line>
|
||||
<end_line>1000</end_line>
|
||||
<task_progress>Checklist here (optional)</task_progress>
|
||||
</read_file>
|
||||
|
||||
@@ -90,6 +94,7 @@ Parameters:
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<replace_in_file>
|
||||
|
||||
+9
-1
@@ -29,7 +29,7 @@
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "read_file",
|
||||
"description": "Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.",
|
||||
"description": "Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.",
|
||||
"strict": false,
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
@@ -38,6 +38,14 @@
|
||||
"type": "string",
|
||||
"description": "The path of the file to read (relative to the current working directory /test/project)"
|
||||
},
|
||||
"start_line": {
|
||||
"type": "integer",
|
||||
"description": "The 1-based line number to start reading from (inclusive). Defaults to 1."
|
||||
},
|
||||
"end_line": {
|
||||
"type": "integer",
|
||||
"description": "The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files."
|
||||
},
|
||||
"task_progress": {
|
||||
"type": "string",
|
||||
"description": "A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)"
|
||||
|
||||
+9
-1
@@ -29,7 +29,7 @@
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "read_file",
|
||||
"description": "Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.",
|
||||
"description": "Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.",
|
||||
"strict": false,
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
@@ -38,6 +38,14 @@
|
||||
"type": "string",
|
||||
"description": "The path of the file to read (relative to the current working directory /test/project)"
|
||||
},
|
||||
"start_line": {
|
||||
"type": "integer",
|
||||
"description": "The 1-based line number to start reading from (inclusive). Defaults to 1."
|
||||
},
|
||||
"end_line": {
|
||||
"type": "integer",
|
||||
"description": "The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files."
|
||||
},
|
||||
"task_progress": {
|
||||
"type": "string",
|
||||
"description": "A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)"
|
||||
|
||||
+6
-1
@@ -48,13 +48,17 @@ Usage:
|
||||
</execute_command>
|
||||
|
||||
## read_file
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory /test/project)
|
||||
- start_line: (optional) The 1-based line number to start reading from (inclusive). Defaults to 1.
|
||||
- end_line: (optional) The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<read_file>
|
||||
<path>File path here</path>
|
||||
<start_line>1</start_line>
|
||||
<end_line>1000</end_line>
|
||||
<task_progress>Checklist here (optional)</task_progress>
|
||||
</read_file>
|
||||
|
||||
@@ -99,6 +103,7 @@ Parameters:
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<replace_in_file>
|
||||
|
||||
+6
-1
@@ -48,13 +48,17 @@ Usage:
|
||||
</execute_command>
|
||||
|
||||
## read_file
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory /test/project)
|
||||
- start_line: (optional) The 1-based line number to start reading from (inclusive). Defaults to 1.
|
||||
- end_line: (optional) The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<read_file>
|
||||
<path>File path here</path>
|
||||
<start_line>1</start_line>
|
||||
<end_line>1000</end_line>
|
||||
<task_progress>Checklist here (optional)</task_progress>
|
||||
</read_file>
|
||||
|
||||
@@ -99,6 +103,7 @@ Parameters:
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<replace_in_file>
|
||||
|
||||
+6
-1
@@ -45,12 +45,16 @@ Usage:
|
||||
</execute_command>
|
||||
|
||||
## read_file
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory /test/project)
|
||||
- start_line: (optional) The 1-based line number to start reading from (inclusive). Defaults to 1.
|
||||
- end_line: (optional) The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.
|
||||
Usage:
|
||||
<read_file>
|
||||
<path>File path here</path>
|
||||
<start_line>1</start_line>
|
||||
<end_line>1000</end_line>
|
||||
</read_file>
|
||||
|
||||
## write_to_file
|
||||
@@ -92,6 +96,7 @@ Parameters:
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.
|
||||
Usage:
|
||||
<replace_in_file>
|
||||
<path>File path here</path>
|
||||
|
||||
+6
-1
@@ -48,13 +48,17 @@ Usage:
|
||||
</execute_command>
|
||||
|
||||
## read_file
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory /test/project)
|
||||
- start_line: (optional) The 1-based line number to start reading from (inclusive). Defaults to 1.
|
||||
- end_line: (optional) The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<read_file>
|
||||
<path>File path here</path>
|
||||
<start_line>1</start_line>
|
||||
<end_line>1000</end_line>
|
||||
<task_progress>Checklist here (optional)</task_progress>
|
||||
</read_file>
|
||||
|
||||
@@ -99,6 +103,7 @@ Parameters:
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.
|
||||
- task_progress: (optional) A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)
|
||||
Usage:
|
||||
<replace_in_file>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
},
|
||||
{
|
||||
"name": "read_file",
|
||||
"description": "Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.",
|
||||
"description": "Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.",
|
||||
"parameters": {
|
||||
"type": "OBJECT",
|
||||
"properties": {
|
||||
@@ -30,6 +30,14 @@
|
||||
"type": "STRING",
|
||||
"description": "The path of the file to read (relative to the current working directory /test/project)"
|
||||
},
|
||||
"start_line": {
|
||||
"type": "NUMBER",
|
||||
"description": "The 1-based line number to start reading from (inclusive). Defaults to 1."
|
||||
},
|
||||
"end_line": {
|
||||
"type": "NUMBER",
|
||||
"description": "The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files."
|
||||
},
|
||||
"task_progress": {
|
||||
"type": "STRING",
|
||||
"description": "A checklist showing task progress after this tool use is completed. The task_progress parameter must be included as a separate parameter inside of the parent tool call, it must be separate from other parameters such as content, arguments, etc. (See 'UPDATING TASK PROGRESS' section for more details)"
|
||||
@@ -77,7 +85,7 @@
|
||||
},
|
||||
"diff": {
|
||||
"type": "STRING",
|
||||
"description": "One or more SEARCH/REPLACE blocks following this exact format:\n ```\n ------- SEARCH\n [exact content to find]\n =======\n [new content to replace with]\n +++++++ REPLACE\n ```\n Critical rules:\n 1. SEARCH content must match the associated file section to find EXACTLY:\n * Match character-for-character including whitespace, indentation, line endings\n * Include all comments, docstrings, etc.\n 2. SEARCH/REPLACE blocks will ONLY replace the first match occurrence.\n * Including multiple unique SEARCH/REPLACE blocks if you need to make multiple changes.\n * Include *just* enough lines in each SEARCH section to uniquely match each set of lines that need to change.\n * When using multiple SEARCH/REPLACE blocks, list them in the order they appear in the file.\n 3. Keep SEARCH/REPLACE blocks concise:\n * Break large SEARCH/REPLACE blocks into a series of smaller blocks that each change a small portion of the file.\n * Include just the changing lines, and a few surrounding lines if needed for uniqueness.\n * Do not include long runs of unchanging lines in SEARCH/REPLACE blocks.\n * Each line must be complete. Never truncate lines mid-way through as this can cause matching failures.\n 4. Special operations:\n * To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)\n * To delete code: Use empty REPLACE section"
|
||||
"description": "One or more SEARCH/REPLACE blocks following this exact format:\n ```\n ------- SEARCH\n [exact content to find]\n =======\n [new content to replace with]\n +++++++ REPLACE\n ```\n Critical rules:\n 1. SEARCH content must match the associated file section to find EXACTLY:\n * Match character-for-character including whitespace, indentation, line endings\n * Include all comments, docstrings, etc.\n 2. SEARCH/REPLACE blocks will ONLY replace the first match occurrence.\n * Including multiple unique SEARCH/REPLACE blocks if you need to make multiple changes.\n * Include *just* enough lines in each SEARCH section to uniquely match each set of lines that need to change.\n * When using multiple SEARCH/REPLACE blocks, list them in the order they appear in the file.\n 3. Keep SEARCH/REPLACE blocks concise:\n * Break large SEARCH/REPLACE blocks into a series of smaller blocks that each change a small portion of the file.\n * Include just the changing lines, and a few surrounding lines if needed for uniqueness.\n * Do not include long runs of unchanging lines in SEARCH/REPLACE blocks.\n * Each line must be complete. Never truncate lines mid-way through as this can cause matching failures.\n 4. Special operations:\n * To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)\n * To delete code: Use empty REPLACE section\n 5. If your source context came from read_file and includes line labels (for example, \"42 | const x = 1\"), do NOT include the \"42 | \" prefix in SEARCH or REPLACE content. Match only the raw file text."
|
||||
},
|
||||
"task_progress": {
|
||||
"type": "STRING",
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
import { expect } from "chai"
|
||||
import { before, describe, it } from "mocha"
|
||||
import { ModelFamily } from "@/shared/prompts"
|
||||
import { ClineDefaultTool } from "@/shared/tools"
|
||||
import { ClineToolSet } from "../registry/ClineToolSet"
|
||||
import { PromptRegistry } from "../registry/PromptRegistry"
|
||||
import { new_task_variants } from "../tools/new_task"
|
||||
import type { SystemPromptContext } from "../types"
|
||||
import { mockProviderInfo } from "./integration.test"
|
||||
|
||||
const baseContext: SystemPromptContext = {
|
||||
cwd: "/test/project",
|
||||
ide: "TestIde",
|
||||
supportsBrowserUse: true,
|
||||
providerInfo: mockProviderInfo,
|
||||
isTesting: true,
|
||||
}
|
||||
|
||||
describe("new_task tool contextRequirements", () => {
|
||||
before(() => {
|
||||
// Ensure tools are registered via PromptRegistry initialization
|
||||
PromptRegistry.getInstance()
|
||||
})
|
||||
|
||||
const genericVariant = new_task_variants.find((v) => v.variant === ModelFamily.GENERIC)
|
||||
|
||||
it("should have a contextRequirements function defined", () => {
|
||||
expect(genericVariant).to.exist
|
||||
expect(genericVariant!.contextRequirements).to.be.a("function")
|
||||
})
|
||||
|
||||
it("should be enabled when yoloModeToggled is false", () => {
|
||||
const context: SystemPromptContext = { ...baseContext, yoloModeToggled: false }
|
||||
expect(genericVariant!.contextRequirements!(context)).to.be.true
|
||||
})
|
||||
|
||||
it("should be enabled when yoloModeToggled is undefined", () => {
|
||||
const context: SystemPromptContext = { ...baseContext, yoloModeToggled: undefined }
|
||||
expect(genericVariant!.contextRequirements!(context)).to.be.true
|
||||
})
|
||||
|
||||
it("should be disabled when yoloModeToggled is true", () => {
|
||||
const context: SystemPromptContext = { ...baseContext, yoloModeToggled: true }
|
||||
expect(genericVariant!.contextRequirements!(context)).to.be.false
|
||||
})
|
||||
|
||||
it("should follow the same pattern as ask_followup_question", () => {
|
||||
const newTaskTool = ClineToolSet.getToolByNameWithFallback(ClineDefaultTool.NEW_TASK, ModelFamily.GENERIC)
|
||||
const askTool = ClineToolSet.getToolByNameWithFallback(ClineDefaultTool.ASK, ModelFamily.GENERIC)
|
||||
|
||||
expect(newTaskTool).to.exist
|
||||
expect(askTool).to.exist
|
||||
expect(newTaskTool!.config.contextRequirements).to.be.a("function")
|
||||
expect(askTool!.config.contextRequirements).to.be.a("function")
|
||||
|
||||
const yoloContext: SystemPromptContext = { ...baseContext, yoloModeToggled: true }
|
||||
const normalContext: SystemPromptContext = { ...baseContext, yoloModeToggled: false }
|
||||
|
||||
expect(newTaskTool!.config.contextRequirements!(yoloContext)).to.be.false
|
||||
expect(askTool!.config.contextRequirements!(yoloContext)).to.be.false
|
||||
|
||||
expect(newTaskTool!.config.contextRequirements!(normalContext)).to.be.true
|
||||
expect(askTool!.config.contextRequirements!(normalContext)).to.be.true
|
||||
})
|
||||
})
|
||||
@@ -27,6 +27,7 @@ const generic: ClineToolSpec = {
|
||||
name: "new_task",
|
||||
description: `Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task.
|
||||
Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point.`,
|
||||
contextRequirements: (context) => !context.yoloModeToggled,
|
||||
parameters: [
|
||||
{
|
||||
name: "context",
|
||||
|
||||
@@ -5,38 +5,48 @@ import { TASK_PROGRESS_PARAMETER } from "../types"
|
||||
|
||||
const id = ClineDefaultTool.FILE_READ
|
||||
|
||||
const READ_FILE_DESCRIPTION =
|
||||
"Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Returned text lines are prefixed with line labels (e.g. `1 |`, `2 |`). These labels are metadata, not part of the file content. For large files, output is automatically limited to 1000 lines. Use start_line and end_line to read specific sections. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files."
|
||||
|
||||
const READ_FILE_PARAMETERS: ClineToolSpec["parameters"] = [
|
||||
{
|
||||
name: "path",
|
||||
required: true,
|
||||
instruction: `The path of the file to read (relative to the current working directory {{CWD}}){{MULTI_ROOT_HINT}}`,
|
||||
usage: "File path here",
|
||||
},
|
||||
{
|
||||
name: "start_line",
|
||||
required: false,
|
||||
type: "integer",
|
||||
instruction: "The 1-based line number to start reading from (inclusive). Defaults to 1.",
|
||||
usage: "1",
|
||||
},
|
||||
{
|
||||
name: "end_line",
|
||||
required: false,
|
||||
type: "integer",
|
||||
instruction:
|
||||
"The 1-based line number to stop reading at (inclusive). Defaults to start_line + 1000. Use with start_line to read specific sections of large files.",
|
||||
usage: "1000",
|
||||
},
|
||||
TASK_PROGRESS_PARAMETER,
|
||||
]
|
||||
|
||||
const generic: ClineToolSpec = {
|
||||
variant: ModelFamily.GENERIC,
|
||||
id,
|
||||
name: "read_file",
|
||||
description:
|
||||
"Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.",
|
||||
parameters: [
|
||||
{
|
||||
name: "path",
|
||||
required: true,
|
||||
instruction: `The path of the file to read (relative to the current working directory {{CWD}}){{MULTI_ROOT_HINT}}`,
|
||||
usage: "File path here",
|
||||
},
|
||||
TASK_PROGRESS_PARAMETER,
|
||||
],
|
||||
description: READ_FILE_DESCRIPTION,
|
||||
parameters: READ_FILE_PARAMETERS,
|
||||
}
|
||||
|
||||
const NATIVE_GPT_5: ClineToolSpec = {
|
||||
variant: ModelFamily.NATIVE_GPT_5,
|
||||
id,
|
||||
name: "read_file",
|
||||
description:
|
||||
"Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string. Do NOT use this tool to list the contents of a directory. Only use this tool on files.",
|
||||
parameters: [
|
||||
{
|
||||
name: "path",
|
||||
required: true,
|
||||
instruction: `The path of the file to read (relative to the current working directory {{CWD}}){{MULTI_ROOT_HINT}}`,
|
||||
usage: "File path here",
|
||||
},
|
||||
TASK_PROGRESS_PARAMETER,
|
||||
],
|
||||
description: READ_FILE_DESCRIPTION,
|
||||
parameters: READ_FILE_PARAMETERS,
|
||||
}
|
||||
|
||||
const NATIVE_NEXT_GEN: ClineToolSpec = {
|
||||
|
||||
@@ -36,10 +36,11 @@ const BASE_DIFF_INSTRUCTIONS = `One or more SEARCH/REPLACE blocks following this
|
||||
* Each line must be complete. Never truncate lines mid-way through as this can cause matching failures.
|
||||
4. Special operations:
|
||||
* To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
|
||||
* To delete code: Use empty REPLACE section`
|
||||
* To delete code: Use empty REPLACE section
|
||||
5. If your source context came from read_file and includes line labels (for example, "42 | const x = 1"), do NOT include the "42 | " prefix in SEARCH or REPLACE content. Match only the raw file text.`
|
||||
|
||||
const NOTEBOOK_INSTRUCTIONS = `
|
||||
5. For Jupyter Notebook (.ipynb) files:
|
||||
6. For Jupyter Notebook (.ipynb) files:
|
||||
* Match the exact JSON structure including quotes, commas, and \\n characters
|
||||
* Each line in "source" array (except last) must end with "\\n"
|
||||
* Each source line is a separate JSON string in the array
|
||||
|
||||
@@ -44,6 +44,8 @@ export class TaskState {
|
||||
didAlreadyUseTool = false
|
||||
didEditFile = false
|
||||
lastToolName = "" // Track last tool used for consecutive call detection
|
||||
lastToolParams = "" // Canonical signature of last tool's params (via toolCallSignature)
|
||||
consecutiveIdenticalToolCount = 0 // Consecutive calls with identical tool name + params
|
||||
|
||||
// File read deduplication cache - prevents the model from endlessly reading the same files
|
||||
// Maps absolute file path → { readCount: times read in this task, mtime: last modified timestamp, imageBlock: optional image data for multimodal models }
|
||||
|
||||
@@ -20,6 +20,7 @@ import { formatResponse } from "../prompts/responses"
|
||||
import { StateManager } from "../storage/StateManager"
|
||||
import { WorkspaceRootManager } from "../workspace"
|
||||
import { ToolResponse } from "."
|
||||
import { checkRepeatedToolCall, LOOP_DETECTION_SOFT_THRESHOLD, toolCallSignature } from "./loop-detection"
|
||||
import { MessageStateHandler } from "./message-state"
|
||||
import { TaskState } from "./TaskState"
|
||||
import { AutoApprove } from "./tools/autoApprove"
|
||||
@@ -575,8 +576,26 @@ export class ToolExecutor {
|
||||
toolWasExecuted = true
|
||||
this.pushToolResult(toolResult, block)
|
||||
|
||||
// Track the last executed tool for consecutive call detection (used by act_mode_respond)
|
||||
// --- Repeated tool call loop detection ---
|
||||
// Must run BEFORE updating lastToolName/lastToolParams so we compare
|
||||
// against the previous call's values, not the current one.
|
||||
const currentSignature = toolCallSignature(block.params)
|
||||
const loopCheck = checkRepeatedToolCall(this.taskState, block.name, currentSignature)
|
||||
|
||||
if (loopCheck.softWarning) {
|
||||
this.taskState.userMessageContent.push({
|
||||
type: "text",
|
||||
text: formatResponse.repeatedToolCall(block.name, LOOP_DETECTION_SOFT_THRESHOLD),
|
||||
})
|
||||
}
|
||||
|
||||
if (loopCheck.hardEscalation) {
|
||||
this.taskState.consecutiveMistakeCount = this.stateManager.getGlobalSettingsKey("maxConsecutiveMistakes")
|
||||
}
|
||||
|
||||
// Update state AFTER comparison
|
||||
this.taskState.lastToolName = block.name
|
||||
this.taskState.lastToolParams = currentSignature
|
||||
|
||||
// Check abort before running PostToolUse hook (success path)
|
||||
if (this.taskState.abort) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { strict as assert } from "node:assert"
|
||||
import * as NotificationHook from "@core/hooks/notification-hook"
|
||||
import { Task } from "@core/task"
|
||||
import type { ClineMessage } from "@shared/ExtensionMessage"
|
||||
import { describe, it } from "mocha"
|
||||
@@ -22,6 +23,12 @@ function createFakeTask(taskState: {
|
||||
|
||||
const fakeTask = {
|
||||
taskState,
|
||||
api: { getModel: () => ({ id: "test-model" }) },
|
||||
stateManager: {
|
||||
getGlobalSettingsKey: (key: string) => (key === "hooksEnabled" ? false : "act"),
|
||||
getApiConfiguration: () => ({ actModeApiProvider: "anthropic", planModeApiProvider: "anthropic" }),
|
||||
},
|
||||
taskId: "task-1",
|
||||
messageStateHandler: {
|
||||
addToClineMessages: async (message: ClineMessage) => {
|
||||
clineMessages.push(message)
|
||||
@@ -29,7 +36,6 @@ function createFakeTask(taskState: {
|
||||
getClineMessages: () => clineMessages,
|
||||
},
|
||||
postStateToWebview: async () => undefined,
|
||||
runNotificationHook: async () => undefined,
|
||||
}
|
||||
|
||||
return { clineMessages, fakeTask }
|
||||
@@ -191,4 +197,84 @@ describe("Task.ask", () => {
|
||||
clock.restore()
|
||||
}
|
||||
})
|
||||
|
||||
it("emits notification hooks for non-command_output asks", async () => {
|
||||
const clock = sinon.useFakeTimers()
|
||||
const notificationStub = sinon.stub(NotificationHook, "emitUserAttentionNotification").resolves()
|
||||
const taskState: {
|
||||
abort: boolean
|
||||
askResponse: string | undefined
|
||||
askResponseText: string | undefined
|
||||
askResponseImages: string[] | undefined
|
||||
askResponseFiles: string[] | undefined
|
||||
lastMessageTs: number | undefined
|
||||
} = {
|
||||
abort: false,
|
||||
askResponse: undefined,
|
||||
askResponseText: undefined,
|
||||
askResponseImages: undefined,
|
||||
askResponseFiles: undefined,
|
||||
lastMessageTs: undefined,
|
||||
}
|
||||
const { fakeTask } = createFakeTask(taskState)
|
||||
|
||||
try {
|
||||
const askPromise = (
|
||||
Task.prototype as unknown as {
|
||||
ask: (type: "completion_result", text?: string) => Promise<{ response: string }>
|
||||
}
|
||||
).ask.call(fakeTask, "completion_result", "Need approval")
|
||||
|
||||
await flushMicrotasks()
|
||||
sinon.assert.calledOnce(notificationStub)
|
||||
assert.equal(notificationStub.firstCall.args[1].source, "completion_result")
|
||||
assert.equal(notificationStub.firstCall.args[1].message, "Need approval")
|
||||
|
||||
taskState.askResponse = "yesButtonClicked"
|
||||
await clock.tickAsync(100)
|
||||
await askPromise
|
||||
} finally {
|
||||
notificationStub.restore()
|
||||
clock.restore()
|
||||
}
|
||||
})
|
||||
|
||||
it("skips notification hooks for command_output asks", async () => {
|
||||
const clock = sinon.useFakeTimers()
|
||||
const notificationStub = sinon.stub(NotificationHook, "emitUserAttentionNotification").resolves()
|
||||
const taskState: {
|
||||
abort: boolean
|
||||
askResponse: string | undefined
|
||||
askResponseText: string | undefined
|
||||
askResponseImages: string[] | undefined
|
||||
askResponseFiles: string[] | undefined
|
||||
lastMessageTs: number | undefined
|
||||
} = {
|
||||
abort: false,
|
||||
askResponse: undefined,
|
||||
askResponseText: undefined,
|
||||
askResponseImages: undefined,
|
||||
askResponseFiles: undefined,
|
||||
lastMessageTs: undefined,
|
||||
}
|
||||
const { fakeTask } = createFakeTask(taskState)
|
||||
|
||||
try {
|
||||
const askPromise = (
|
||||
Task.prototype as unknown as {
|
||||
ask: (type: "command_output", text?: string) => Promise<{ response: string }>
|
||||
}
|
||||
).ask.call(fakeTask, "command_output", "stream update")
|
||||
|
||||
await flushMicrotasks()
|
||||
sinon.assert.notCalled(notificationStub)
|
||||
|
||||
taskState.askResponse = "yesButtonClicked"
|
||||
await clock.tickAsync(100)
|
||||
await askPromise
|
||||
} finally {
|
||||
notificationStub.restore()
|
||||
clock.restore()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
import { describe, it } from "mocha"
|
||||
import "should"
|
||||
import { checkRepeatedToolCall, toolCallSignature } from "../loop-detection"
|
||||
import { TaskState } from "../TaskState"
|
||||
|
||||
/** Simulate a tool call matching production order in ToolExecutor. */
|
||||
function simulateToolCall(state: TaskState, toolName: string, params: Record<string, string>, maxMistakes = 3) {
|
||||
const sig = toolCallSignature(params)
|
||||
const result = checkRepeatedToolCall(state, toolName, sig)
|
||||
|
||||
if (result.softWarning) {
|
||||
state.userMessageContent.push({ type: "text", text: `[WARNING] loop detected for ${toolName}` })
|
||||
}
|
||||
if (result.hardEscalation) {
|
||||
state.consecutiveMistakeCount = maxMistakes
|
||||
}
|
||||
|
||||
state.lastToolName = toolName
|
||||
state.lastToolParams = sig
|
||||
return result
|
||||
}
|
||||
|
||||
describe("toolCallSignature", () => {
|
||||
it("produces identical output regardless of key order", () => {
|
||||
toolCallSignature({ b: "2", a: "1" }).should.equal(toolCallSignature({ a: "1", b: "2" }))
|
||||
})
|
||||
})
|
||||
|
||||
describe("Loop Detection", () => {
|
||||
it("should warn at 3 identical calls and escalate at 5", () => {
|
||||
const state = new TaskState()
|
||||
const results = []
|
||||
for (let i = 0; i < 5; i++) {
|
||||
results.push(simulateToolCall(state, "read_file", { path: "src/main.ts" }))
|
||||
}
|
||||
|
||||
results[0].softWarning.should.be.false()
|
||||
results[1].softWarning.should.be.false()
|
||||
results[2].softWarning.should.be.true()
|
||||
results[3].softWarning.should.be.false()
|
||||
results[3].hardEscalation.should.be.false()
|
||||
results[4].softWarning.should.be.false()
|
||||
results[4].hardEscalation.should.be.true()
|
||||
state.userMessageContent.length.should.equal(1)
|
||||
state.consecutiveMistakeCount.should.equal(3)
|
||||
})
|
||||
|
||||
it("should reset when tool or params change", () => {
|
||||
const state = new TaskState()
|
||||
|
||||
simulateToolCall(state, "read_file", { path: "a.ts" })
|
||||
simulateToolCall(state, "read_file", { path: "a.ts" })
|
||||
simulateToolCall(state, "read_file", { path: "b.ts" }) // different params
|
||||
state.consecutiveIdenticalToolCount.should.equal(1)
|
||||
|
||||
simulateToolCall(state, "read_file", { path: "b.ts" })
|
||||
simulateToolCall(state, "list_files", { path: "b.ts" }) // different tool
|
||||
state.consecutiveIdenticalToolCount.should.equal(1)
|
||||
})
|
||||
|
||||
it("should NOT count different tools with same params as identical", () => {
|
||||
const state = new TaskState()
|
||||
|
||||
simulateToolCall(state, "read_file", { path: "src/main.ts" })
|
||||
simulateToolCall(state, "search_files", { path: "src/main.ts" })
|
||||
simulateToolCall(state, "list_files", { path: "src/main.ts" })
|
||||
|
||||
state.consecutiveIdenticalToolCount.should.equal(1)
|
||||
})
|
||||
|
||||
it("should re-arm after loop detection state is reset", () => {
|
||||
const state = new TaskState()
|
||||
|
||||
// First cycle: escalate at call 5
|
||||
for (let i = 0; i < 5; i++) {
|
||||
simulateToolCall(state, "read_file", { path: "src/main.ts" })
|
||||
}
|
||||
state.consecutiveIdenticalToolCount.should.equal(5)
|
||||
state.consecutiveMistakeCount.should.equal(3)
|
||||
|
||||
// Simulate what index.ts does when user clicks "continue"
|
||||
state.consecutiveMistakeCount = 0
|
||||
state.consecutiveIdenticalToolCount = 0
|
||||
state.lastToolName = ""
|
||||
state.lastToolParams = ""
|
||||
|
||||
// Second cycle: same tool + params should trigger again
|
||||
const results = []
|
||||
for (let i = 0; i < 5; i++) {
|
||||
results.push(simulateToolCall(state, "read_file", { path: "src/main.ts" }))
|
||||
}
|
||||
|
||||
results[2].softWarning.should.be.true()
|
||||
results[4].hardEscalation.should.be.true()
|
||||
state.consecutiveMistakeCount.should.equal(3)
|
||||
})
|
||||
|
||||
it("should work correctly when tool changes after reset", () => {
|
||||
const state = new TaskState()
|
||||
|
||||
// Escalate with one tool
|
||||
for (let i = 0; i < 5; i++) {
|
||||
simulateToolCall(state, "read_file", { path: "src/main.ts" })
|
||||
}
|
||||
|
||||
// Reset (user clicks "continue")
|
||||
state.consecutiveMistakeCount = 0
|
||||
state.consecutiveIdenticalToolCount = 0
|
||||
state.lastToolName = ""
|
||||
state.lastToolParams = ""
|
||||
|
||||
// Model switches to a different tool — no false positives
|
||||
const result = simulateToolCall(state, "list_files", { path: "src/" })
|
||||
result.softWarning.should.be.false()
|
||||
result.hardEscalation.should.be.false()
|
||||
state.consecutiveIdenticalToolCount.should.equal(1)
|
||||
})
|
||||
|
||||
it("should strip task_progress from comparison", () => {
|
||||
const state = new TaskState()
|
||||
const results = []
|
||||
for (let i = 0; i < 5; i++) {
|
||||
results.push(
|
||||
simulateToolCall(state, "read_file", {
|
||||
path: "src/index.ts",
|
||||
task_progress: `step ${i} of 5`,
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
results[2].softWarning.should.be.true()
|
||||
results[4].hardEscalation.should.be.true()
|
||||
})
|
||||
})
|
||||
+27
-36
@@ -22,6 +22,7 @@ import {
|
||||
import { sendPartialMessageEvent } from "@core/controller/ui/subscribeToPartialMessage"
|
||||
import { getHookModelContext } from "@core/hooks/hook-model-context"
|
||||
import { getHooksEnabledSafe } from "@core/hooks/hooks-utils"
|
||||
import * as NotificationHook from "@core/hooks/notification-hook"
|
||||
import { executePreCompactHookWithCleanup, HookCancellationError, HookExecution } from "@core/hooks/precompact-executor"
|
||||
import { ClineIgnoreController } from "@core/ignore/ClineIgnoreController"
|
||||
import { parseMentions } from "@core/mentions"
|
||||
@@ -771,12 +772,18 @@ export class Task {
|
||||
// not a strict approval boundary that should force external "user_attention"
|
||||
// handling. In auto-approve flows, command_output asks can still be emitted,
|
||||
// so we intentionally skip Notification hook emission for this ask type.
|
||||
await this.runNotificationHook({
|
||||
event: "user_attention",
|
||||
source: type,
|
||||
message: text || "",
|
||||
waitingForUserInput: true,
|
||||
})
|
||||
await NotificationHook.emitUserAttentionNotification(
|
||||
{
|
||||
messageStateHandler: this.messageStateHandler,
|
||||
taskId: this.taskId,
|
||||
hooksEnabled: getHooksEnabledSafe(this.stateManager.getGlobalSettingsKey("hooksEnabled")),
|
||||
model: getHookModelContext(this.api, this.stateManager),
|
||||
},
|
||||
{
|
||||
source: type,
|
||||
message: text || "",
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
const shouldWakeOnAbort = type !== "resume_task" && type !== "resume_completed_task"
|
||||
@@ -806,35 +813,6 @@ export class Task {
|
||||
return result
|
||||
}
|
||||
|
||||
private async runNotificationHook(notification: {
|
||||
event: string
|
||||
source: string
|
||||
message: string
|
||||
waitingForUserInput: boolean
|
||||
}): Promise<void> {
|
||||
const hooksEnabled = getHooksEnabledSafe(this.stateManager.getGlobalSettingsKey("hooksEnabled"))
|
||||
if (!hooksEnabled) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await executeHook({
|
||||
hookName: "Notification",
|
||||
hookInput: {
|
||||
notification,
|
||||
},
|
||||
isCancellable: false,
|
||||
say: async () => undefined,
|
||||
messageStateHandler: this.messageStateHandler,
|
||||
taskId: this.taskId,
|
||||
hooksEnabled,
|
||||
model: getHookModelContext(this.api, this.stateManager),
|
||||
})
|
||||
} catch (error) {
|
||||
Logger.error("[Notification Hook] Failed (non-fatal):", error)
|
||||
}
|
||||
}
|
||||
|
||||
async handleWebviewAskResponse(askResponse: ClineAskResponse, text?: string, images?: string[], files?: string[]) {
|
||||
this.taskState.askResponse = askResponse
|
||||
this.taskState.askResponseText = text
|
||||
@@ -1920,7 +1898,16 @@ export class Task {
|
||||
|
||||
const globalClineRulesFilePath = await ensureRulesDirectoryExists()
|
||||
const globalRules = await getGlobalClineRules(globalClineRulesFilePath, globalToggles, { evaluationContext })
|
||||
const globalClineRulesFileInstructions = globalRules.instructions
|
||||
let globalClineRulesFileInstructions = globalRules.instructions
|
||||
|
||||
// Inject Lazy Teammate Mode rules if enabled
|
||||
const lazyTeammateModeEnabled = this.stateManager.getGlobalSettingsKey("lazyTeammateModeEnabled")
|
||||
if (lazyTeammateModeEnabled) {
|
||||
const { LAZY_TEAMMATE_RULES } = await import("@/core/context/instructions/lazy-teammate-rules")
|
||||
globalClineRulesFileInstructions = globalClineRulesFileInstructions
|
||||
? `${globalClineRulesFileInstructions}\n\n${LAZY_TEAMMATE_RULES}`
|
||||
: LAZY_TEAMMATE_RULES
|
||||
}
|
||||
|
||||
const localRules = await getLocalClineRules(this.cwd, localToggles, { evaluationContext })
|
||||
const localClineRulesFileInstructions = localRules.instructions
|
||||
@@ -2438,6 +2425,10 @@ export class Task {
|
||||
}
|
||||
this.taskState.consecutiveMistakeCount = 0
|
||||
this.taskState.autoRetryAttempts = 0 // need to reset this if the user chooses to manually retry after the mistake limit is reached
|
||||
// Reset loop detection state so it can re-arm if the model continues looping
|
||||
this.taskState.consecutiveIdenticalToolCount = 0
|
||||
this.taskState.lastToolName = ""
|
||||
this.taskState.lastToolParams = ""
|
||||
}
|
||||
|
||||
// get previous api req's index to check token usage and determine if we need to truncate conversation history
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* Repeated tool call loop detection.
|
||||
*
|
||||
* Detects when the LLM calls the same tool with identical arguments
|
||||
* repeatedly, which wastes tokens without making progress.
|
||||
*
|
||||
* This is complementary to fileReadCache in ReadFileToolHandler, which
|
||||
* deduplicates file *content* on cache hits but still allows the tool
|
||||
* call to succeed and consume a turn. Loop detection catches the
|
||||
* repeated call pattern itself, regardless of which tool is involved.
|
||||
*
|
||||
* Shared between ToolExecutor (production) and tests so the
|
||||
* comparison algorithm cannot drift between the two.
|
||||
*/
|
||||
|
||||
import type { TaskState } from "./TaskState"
|
||||
|
||||
// Soft threshold: inject a warning, giving the LLM one chance to self-correct.
|
||||
// Hard threshold: escalate to user or fail task. Set higher to avoid false
|
||||
// positives on tools that may legitimately repeat (e.g., browser_action screenshots).
|
||||
export const LOOP_DETECTION_SOFT_THRESHOLD = 3
|
||||
const LOOP_DETECTION_HARD_THRESHOLD = 5
|
||||
|
||||
// Params that are metadata/tracking, not tool-relevant input.
|
||||
// These change between calls even when the user-facing arguments are identical
|
||||
// (e.g., task_progress updates its checklist each turn).
|
||||
const IGNORED_PARAMS = new Set(["task_progress"])
|
||||
|
||||
/**
|
||||
* Compute a canonical signature for a tool call's params.
|
||||
* Strips metadata fields and sorts keys via the JSON.stringify replacer
|
||||
* so key order doesn't affect comparison.
|
||||
*
|
||||
* block.params is Partial<Record<ToolParamName, string>> — always flat,
|
||||
* string-valued, no nesting — so the replacer array is sufficient.
|
||||
*/
|
||||
export function toolCallSignature(params: Partial<Record<string, string>> | undefined): string {
|
||||
if (!params) return "{}"
|
||||
const keys = Object.keys(params)
|
||||
.filter((k) => !IGNORED_PARAMS.has(k))
|
||||
.sort()
|
||||
return JSON.stringify(params, keys)
|
||||
}
|
||||
|
||||
interface LoopDetectionResult {
|
||||
softWarning: boolean
|
||||
hardEscalation: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Core loop detection step. Must be called BEFORE updating
|
||||
* lastToolName / lastToolParams on TaskState.
|
||||
*
|
||||
* Compares the current call against the previous state, updates the
|
||||
* counter, and returns which thresholds (if any) were crossed.
|
||||
*/
|
||||
export function checkRepeatedToolCall(state: TaskState, toolName: string, currentSignature: string): LoopDetectionResult {
|
||||
if (toolName === state.lastToolName && currentSignature === state.lastToolParams) {
|
||||
state.consecutiveIdenticalToolCount++
|
||||
} else {
|
||||
state.consecutiveIdenticalToolCount = 1
|
||||
}
|
||||
|
||||
return {
|
||||
softWarning: state.consecutiveIdenticalToolCount === LOOP_DETECTION_SOFT_THRESHOLD,
|
||||
hardEscalation: state.consecutiveIdenticalToolCount === LOOP_DETECTION_HARD_THRESHOLD,
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import type Anthropic from "@anthropic-ai/sdk"
|
||||
import type { ToolUse } from "@core/assistant-message"
|
||||
import { getHookModelContext } from "@core/hooks/hook-model-context"
|
||||
import { getHooksEnabledSafe } from "@core/hooks/hooks-utils"
|
||||
import * as NotificationHook from "@core/hooks/notification-hook"
|
||||
import { formatResponse } from "@core/prompts/responses"
|
||||
import { processFilesIntoText } from "@integrations/misc/extract-text"
|
||||
import { showSystemNotification } from "@integrations/notifications"
|
||||
@@ -217,12 +218,15 @@ export class AttemptCompletionHandler implements IToolHandler, IPartialBlockHand
|
||||
// Run TaskComplete hook BEFORE presenting the "Start New Task" button
|
||||
// At this point we know: task is complete, checkpoint saved, result shown to user
|
||||
await this.runTaskCompleteHook(config, block)
|
||||
await this.runNotificationHook(config, {
|
||||
event: "task_complete",
|
||||
source: "attempt_completion",
|
||||
message: result,
|
||||
waitingForUserInput: false,
|
||||
})
|
||||
await NotificationHook.emitTaskCompleteNotification(
|
||||
{
|
||||
messageStateHandler: config.messageState,
|
||||
taskId: config.taskId,
|
||||
hooksEnabled: getHooksEnabledSafe(config.services.stateManager.getGlobalSettingsKey("hooksEnabled")),
|
||||
model: getHookModelContext(config.api, config.services.stateManager),
|
||||
},
|
||||
{ message: result },
|
||||
)
|
||||
|
||||
const { response, text, images, files: completionFiles } = await config.callbacks.ask("completion_result", "", false)
|
||||
const prefix = "[attempt_completion] Result: Done"
|
||||
@@ -342,43 +346,4 @@ export class AttemptCompletionHandler implements IToolHandler, IPartialBlockHand
|
||||
Logger.error("[TaskComplete Hook] Failed (non-fatal):", error)
|
||||
}
|
||||
}
|
||||
|
||||
private async runNotificationHook(
|
||||
config: TaskConfig,
|
||||
notification: {
|
||||
event: string
|
||||
source: string
|
||||
message: string
|
||||
waitingForUserInput: boolean
|
||||
},
|
||||
): Promise<void> {
|
||||
const hooksEnabled = getHooksEnabledSafe(config.services.stateManager.getGlobalSettingsKey("hooksEnabled"))
|
||||
if (!hooksEnabled) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const { executeHook } = await import("@core/hooks/hook-executor")
|
||||
|
||||
await executeHook({
|
||||
hookName: "Notification",
|
||||
hookInput: {
|
||||
notification: {
|
||||
...notification,
|
||||
message: notification.message.slice(0, TASK_PREVIEW_MAX_CHARS),
|
||||
},
|
||||
},
|
||||
isCancellable: false,
|
||||
say: async () => undefined,
|
||||
setActiveHookExecution: undefined,
|
||||
clearActiveHookExecution: undefined,
|
||||
messageStateHandler: config.messageState,
|
||||
taskId: config.taskId,
|
||||
hooksEnabled,
|
||||
model: getHookModelContext(config.api, config.services.stateManager),
|
||||
})
|
||||
} catch (error) {
|
||||
Logger.error("[Notification Hook] Failed (non-fatal):", error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,11 @@ export class ExecuteCommandToolHandler implements IFullyManagedTool {
|
||||
// Validate required parameters
|
||||
if (!command) {
|
||||
config.taskState.consecutiveMistakeCount++
|
||||
return await config.callbacks.sayAndCreateMissingParamError(this.name, "command")
|
||||
await config.callbacks.say(
|
||||
"error",
|
||||
"Cline tried to use execute_command without value for required parameter 'command'. Retrying...",
|
||||
)
|
||||
return formatResponse.toolError(formatResponse.executeCommandMissingCommandError())
|
||||
}
|
||||
|
||||
if (!requiresApprovalRaw) {
|
||||
|
||||
@@ -15,6 +15,130 @@ import type { TaskConfig } from "../types/TaskConfig"
|
||||
import type { StronglyTypedUIHelpers } from "../types/UIHelpers"
|
||||
import { ToolResultUtils } from "../utils/ToolResultUtils"
|
||||
|
||||
export const DEFAULT_MAX_LINES = 1000
|
||||
const FILE_TRUNCATED_MARKER = "\n\n---\n\n[FILE TRUNCATED:"
|
||||
|
||||
type DisplayedLineSlice = {
|
||||
start: number
|
||||
end: number
|
||||
totalLines: number
|
||||
lines: string[]
|
||||
truncationSuffix: string
|
||||
}
|
||||
|
||||
function getDisplayedLineSlice(content: string, startLine?: number, endLine?: number): DisplayedLineSlice | null {
|
||||
if (!content) {
|
||||
return null
|
||||
}
|
||||
|
||||
let body = content
|
||||
let truncationSuffix = ""
|
||||
const truncationIndex = content.indexOf(FILE_TRUNCATED_MARKER)
|
||||
if (truncationIndex !== -1) {
|
||||
body = content.slice(0, truncationIndex)
|
||||
truncationSuffix = content.slice(truncationIndex)
|
||||
}
|
||||
|
||||
const lines = body.split(/\r?\n/)
|
||||
if (body.endsWith("\n") && lines.length > 0) {
|
||||
lines.pop()
|
||||
}
|
||||
const totalLines = lines.length
|
||||
|
||||
const requestedStart = Math.max(1, startLine ?? 1)
|
||||
const requestedEnd = endLine !== undefined ? Math.max(1, endLine) : requestedStart + DEFAULT_MAX_LINES - 1
|
||||
const shouldSwapBounds = endLine !== undefined && requestedEnd < requestedStart
|
||||
const start = shouldSwapBounds ? requestedEnd : requestedStart
|
||||
const end = Math.min(totalLines, shouldSwapBounds ? requestedStart : requestedEnd)
|
||||
|
||||
return { start, end, totalLines, lines, truncationSuffix }
|
||||
}
|
||||
|
||||
/**
|
||||
* Line range shown for a read_file result (matches formatFileContentWithLineNumbers). Omits image reads and empty files.
|
||||
*/
|
||||
export function getReadToolDisplayedLineRange(
|
||||
block: ToolUse,
|
||||
fileContent: FileContentResult,
|
||||
): { start: number; end: number } | undefined {
|
||||
if (fileContent.imageBlock) {
|
||||
return undefined
|
||||
}
|
||||
const { startLine, endLine } = parseRequestedLineRange(block)
|
||||
const slice = getDisplayedLineSlice(fileContent.text, startLine, endLine)
|
||||
if (!slice || slice.totalLines === 0) {
|
||||
return undefined
|
||||
}
|
||||
return { start: slice.start, end: slice.end }
|
||||
}
|
||||
|
||||
/**
|
||||
* Slice file content to the requested line range, add one-based `N |` line labels,
|
||||
* and append a continuation hint when the file has more lines to read.
|
||||
*/
|
||||
export function formatFileContentWithLineNumbers(content: string, startLine?: number, endLine?: number): string {
|
||||
if (!content) {
|
||||
return content
|
||||
}
|
||||
|
||||
const meta = getDisplayedLineSlice(content, startLine, endLine)
|
||||
if (!meta) {
|
||||
return content
|
||||
}
|
||||
|
||||
const { start, end, totalLines, lines, truncationSuffix } = meta
|
||||
const slice = lines.slice(start - 1, end)
|
||||
const labeled = slice.map((line, i) => `${start + i} | ${line}`).join("\n")
|
||||
|
||||
let suffix = truncationSuffix
|
||||
if (!truncationSuffix) {
|
||||
if (end < totalLines) {
|
||||
suffix = `\n\n(Showing lines ${start}-${end} of ${totalLines} total. Use start_line=${end + 1} to continue reading.)`
|
||||
} else {
|
||||
suffix = `\n\n(File has ${totalLines} lines total.)`
|
||||
}
|
||||
}
|
||||
|
||||
return labeled + suffix
|
||||
}
|
||||
|
||||
function parseRequestedLineRange(block: ToolUse): { startLine?: number; endLine?: number } {
|
||||
const startLine = block.params.start_line ? Number.parseInt(block.params.start_line, 10) : undefined
|
||||
const endLine = block.params.end_line ? Number.parseInt(block.params.end_line, 10) : undefined
|
||||
|
||||
return {
|
||||
startLine: startLine !== undefined && !Number.isNaN(startLine) ? startLine : undefined,
|
||||
endLine: endLine !== undefined && !Number.isNaN(endLine) ? endLine : undefined,
|
||||
}
|
||||
}
|
||||
|
||||
function buildReadResponse(block: ToolUse, fileContent: FileContentResult, prefix?: string): string {
|
||||
const { startLine, endLine } = parseRequestedLineRange(block)
|
||||
const text = fileContent.imageBlock
|
||||
? fileContent.text
|
||||
: formatFileContentWithLineNumbers(fileContent.text, startLine, endLine)
|
||||
|
||||
return prefix ? `${prefix}\n${text}` : text
|
||||
}
|
||||
|
||||
async function emitReadFileToolUiComplete(
|
||||
config: TaskConfig,
|
||||
sharedMessageProps: ClineSayTool,
|
||||
block: ToolUse,
|
||||
fileContent: FileContentResult,
|
||||
): Promise<void> {
|
||||
if (config.isSubagentExecution) {
|
||||
return
|
||||
}
|
||||
const range = getReadToolDisplayedLineRange(block, fileContent)
|
||||
const payload: ClineSayTool = { ...sharedMessageProps }
|
||||
if (range) {
|
||||
payload.readLineStart = range.start
|
||||
payload.readLineEnd = range.end
|
||||
}
|
||||
await config.callbacks.say("tool", JSON.stringify(payload), undefined, undefined, false)
|
||||
}
|
||||
|
||||
export class ReadFileToolHandler implements IFullyManagedTool {
|
||||
readonly name = ClineDefaultTool.FILE_READ
|
||||
|
||||
@@ -103,10 +227,9 @@ export class ReadFileToolHandler implements IFullyManagedTool {
|
||||
const shouldAutoApprove =
|
||||
config.isSubagentExecution || (await config.callbacks.shouldAutoApproveToolWithPath(block.name, relPath))
|
||||
if (shouldAutoApprove) {
|
||||
// Auto-approval flow
|
||||
// Auto-approval flow (completed read is announced after extractFileContent so line range is known)
|
||||
if (!config.isSubagentExecution) {
|
||||
await config.callbacks.removeLastPartialMessageIfExistsWithType("ask", "tool")
|
||||
await config.callbacks.say("tool", completeMessage, undefined, undefined, false)
|
||||
}
|
||||
|
||||
// Capture telemetry
|
||||
@@ -216,10 +339,20 @@ export class ReadFileToolHandler implements IFullyManagedTool {
|
||||
}
|
||||
|
||||
if (validCached.readCount >= 3) {
|
||||
return `[DUPLICATE READ] You have already read '${displayPath}' ${validCached.readCount} times in this conversation. The content has not changed since your last read. Please use the information you already have and proceed with your task.\n\n${fileContent.text}`
|
||||
await emitReadFileToolUiComplete(config, sharedMessageProps, block, fileContent)
|
||||
return buildReadResponse(
|
||||
block,
|
||||
fileContent,
|
||||
`[DUPLICATE READ] You have already read '${displayPath}' ${validCached.readCount} times in this conversation. The content has not changed since your last read. Please use the information you already have and proceed with your task.`,
|
||||
)
|
||||
}
|
||||
|
||||
return `[File already read] The file '${displayPath}' was already read earlier in this conversation. Returning content:\n${fileContent.text}`
|
||||
await emitReadFileToolUiComplete(config, sharedMessageProps, block, fileContent)
|
||||
return buildReadResponse(
|
||||
block,
|
||||
fileContent,
|
||||
`[File already read] The file '${displayPath}' was already read earlier in this conversation. Returning content:`,
|
||||
)
|
||||
}
|
||||
|
||||
// Execute the actual file read operation
|
||||
@@ -263,8 +396,11 @@ export class ReadFileToolHandler implements IFullyManagedTool {
|
||||
// Handle image blocks separately - they need to be pushed to userMessageContent
|
||||
if (fileContent.imageBlock) {
|
||||
config.taskState.userMessageContent.push(fileContent.imageBlock)
|
||||
await emitReadFileToolUiComplete(config, sharedMessageProps, block, fileContent)
|
||||
return buildReadResponse(block, fileContent)
|
||||
}
|
||||
|
||||
return fileContent.text
|
||||
await emitReadFileToolUiComplete(config, sharedMessageProps, block, fileContent)
|
||||
return buildReadResponse(block, fileContent)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,12 @@ export class WriteToFileToolHandler implements IFullyManagedTool {
|
||||
if (block.name === "replace_in_file" && !rawDiff) {
|
||||
config.taskState.consecutiveMistakeCount++
|
||||
await config.services.diffViewProvider.reset()
|
||||
return await config.callbacks.sayAndCreateMissingParamError(block.name, "diff")
|
||||
const relPath = rawRelPath || "unknown"
|
||||
await config.callbacks.say(
|
||||
"error",
|
||||
`Cline tried to use replace_in_file for '${relPath}' without value for required parameter 'diff'. Retrying...`,
|
||||
)
|
||||
return formatResponse.toolError(formatResponse.replaceInFileMissingDiffError(relPath))
|
||||
}
|
||||
|
||||
if (block.name === "write_to_file" && !rawContent) {
|
||||
|
||||
@@ -120,6 +120,19 @@ function makeBlock(relPath?: string) {
|
||||
}
|
||||
}
|
||||
|
||||
function makeBlockWithRange(relPath: string, startLine?: string, endLine?: string) {
|
||||
return {
|
||||
type: "tool_use" as const,
|
||||
name: ClineDefaultTool.FILE_READ,
|
||||
params: {
|
||||
path: relPath,
|
||||
...(startLine !== undefined ? { start_line: startLine } : {}),
|
||||
...(endLine !== undefined ? { end_line: endLine } : {}),
|
||||
},
|
||||
partial: false,
|
||||
}
|
||||
}
|
||||
|
||||
describe("ReadFileToolHandler.execute – file not found", () => {
|
||||
let sandbox: sinon.SinonSandbox
|
||||
|
||||
@@ -173,7 +186,7 @@ describe("ReadFileToolHandler.execute – file not found", () => {
|
||||
await fs.writeFile(path.join(tmpDir, realFile), "hello world")
|
||||
|
||||
const result = await handler.execute(config, makeBlock(realFile))
|
||||
assert.equal(result, "hello world")
|
||||
assert.equal(result, "1 | hello world\n\n(File has 1 lines total.)")
|
||||
assert.equal(taskState.consecutiveMistakeCount, 0)
|
||||
})
|
||||
|
||||
@@ -186,4 +199,21 @@ describe("ReadFileToolHandler.execute – file not found", () => {
|
||||
assert.equal(result, "missing")
|
||||
assert.equal(taskState.consecutiveMistakeCount, 1)
|
||||
})
|
||||
|
||||
it("respects requested line ranges on cached rereads", async () => {
|
||||
const { config, validator } = createConfig()
|
||||
const handler = new ReadFileToolHandler(validator)
|
||||
|
||||
const realFile = "real-file.txt"
|
||||
await fs.writeFile(path.join(tmpDir, realFile), "alpha\nbeta\ngamma\n")
|
||||
|
||||
const firstRead = await handler.execute(config, makeBlock(realFile))
|
||||
assert.equal(firstRead, "1 | alpha\n2 | beta\n3 | gamma\n\n(File has 3 lines total.)")
|
||||
|
||||
const secondRead = await handler.execute(config, makeBlockWithRange(realFile, "2", "2"))
|
||||
assert.equal(
|
||||
secondRead,
|
||||
"[File already read] The file 'real-file.txt' was already read earlier in this conversation. Returning content:\n2 | beta\n\n(Showing lines 2-2 of 3 total. Use start_line=3 to continue reading.)",
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
import assert from "node:assert/strict"
|
||||
import { ClineDefaultTool } from "@shared/tools"
|
||||
import { describe, it } from "mocha"
|
||||
import { DEFAULT_MAX_LINES, formatFileContentWithLineNumbers, getReadToolDisplayedLineRange } from "../ReadFileToolHandler"
|
||||
|
||||
describe("getReadToolDisplayedLineRange", () => {
|
||||
const block = (start?: string, end?: string) => ({
|
||||
type: "tool_use" as const,
|
||||
name: ClineDefaultTool.FILE_READ,
|
||||
params: {
|
||||
path: "f.txt",
|
||||
...(start !== undefined ? { start_line: start } : {}),
|
||||
...(end !== undefined ? { end_line: end } : {}),
|
||||
},
|
||||
partial: false,
|
||||
})
|
||||
|
||||
it("matches the slice shown for explicit start/end", () => {
|
||||
const text = Array.from({ length: 10 }, (_, i) => `L${i + 1}`).join("\n")
|
||||
const r = getReadToolDisplayedLineRange(block("3", "5"), { text })
|
||||
assert.deepEqual(r, { start: 3, end: 5 })
|
||||
})
|
||||
|
||||
it("returns undefined for image reads", () => {
|
||||
const r = getReadToolDisplayedLineRange(block(), {
|
||||
text: "ok",
|
||||
imageBlock: { type: "image", source: { type: "url", url: "x" } } as any,
|
||||
})
|
||||
assert.equal(r, undefined)
|
||||
})
|
||||
})
|
||||
|
||||
describe("formatFileContentWithLineNumbers", () => {
|
||||
describe("line labels", () => {
|
||||
it("adds 1-indexed line prefixes", () => {
|
||||
const result = formatFileContentWithLineNumbers("alpha\nbeta")
|
||||
assert.ok(result.startsWith("1 | alpha\n2 | beta"))
|
||||
})
|
||||
|
||||
it("does not add an extra numbered line for trailing newline", () => {
|
||||
const result = formatFileContentWithLineNumbers("alpha\nbeta\n")
|
||||
assert.ok(result.startsWith("1 | alpha\n2 | beta"))
|
||||
assert.ok(!result.includes("3 |"))
|
||||
})
|
||||
|
||||
it("returns empty content unchanged", () => {
|
||||
const result = formatFileContentWithLineNumbers("")
|
||||
assert.equal(result, "")
|
||||
})
|
||||
})
|
||||
|
||||
describe("chunked reads", () => {
|
||||
const tenLines = Array.from({ length: 10 }, (_, i) => `line${i + 1}`).join("\n")
|
||||
const oversizedContent = Array.from({ length: DEFAULT_MAX_LINES + 10 }, (_, i) => `line${i + 1}`).join("\n")
|
||||
|
||||
it("defaults to reading from line 1 and applies the default chunk size", () => {
|
||||
const result = formatFileContentWithLineNumbers(oversizedContent)
|
||||
assert.ok(result.startsWith("1 | line1\n"))
|
||||
assert.ok(result.includes(`${DEFAULT_MAX_LINES} | line${DEFAULT_MAX_LINES}`))
|
||||
assert.ok(!result.includes(`${DEFAULT_MAX_LINES + 1} |`))
|
||||
assert.ok(result.includes(`Showing lines 1-${DEFAULT_MAX_LINES} of ${DEFAULT_MAX_LINES + 10} total`))
|
||||
assert.ok(result.includes(`start_line=${DEFAULT_MAX_LINES + 1}`))
|
||||
})
|
||||
|
||||
it("respects start_line parameter", () => {
|
||||
const result = formatFileContentWithLineNumbers(tenLines, 5)
|
||||
assert.ok(result.startsWith("5 | line5\n"))
|
||||
assert.ok(!result.includes("4 |"))
|
||||
})
|
||||
|
||||
it("respects start_line and end_line parameters", () => {
|
||||
const result = formatFileContentWithLineNumbers(tenLines, 3, 5)
|
||||
assert.ok(result.startsWith("3 | line3\n"))
|
||||
assert.ok(result.includes("4 | line4\n"))
|
||||
assert.ok(result.includes("5 | line5"))
|
||||
assert.ok(!result.includes("2 |"))
|
||||
assert.ok(!result.includes("6 |"))
|
||||
})
|
||||
|
||||
it("normalizes inverted start_line and end_line parameters", () => {
|
||||
const result = formatFileContentWithLineNumbers(tenLines, 5, 3)
|
||||
assert.ok(result.startsWith("3 | line3\n"))
|
||||
assert.ok(result.includes("4 | line4\n"))
|
||||
assert.ok(result.includes("5 | line5"))
|
||||
assert.ok(!result.includes("2 |"))
|
||||
assert.ok(!result.includes("6 |"))
|
||||
})
|
||||
|
||||
it("clamps start_line to 1 if below", () => {
|
||||
const result = formatFileContentWithLineNumbers(tenLines, -5, 3)
|
||||
assert.ok(result.startsWith("1 | line1\n"))
|
||||
})
|
||||
|
||||
it("clamps end_line to total lines if beyond", () => {
|
||||
const result = formatFileContentWithLineNumbers(tenLines, 8, 999)
|
||||
assert.ok(result.includes("10 | line10"))
|
||||
assert.ok(!result.includes("11 |"))
|
||||
})
|
||||
})
|
||||
|
||||
describe("continuation hints", () => {
|
||||
const tenLines = Array.from({ length: 10 }, (_, i) => `line${i + 1}`).join("\n")
|
||||
|
||||
it("shows continuation hint when more lines remain", () => {
|
||||
const result = formatFileContentWithLineNumbers(tenLines, 1, 5)
|
||||
assert.ok(result.includes("Showing lines 1-5 of 10 total"))
|
||||
assert.ok(result.includes("start_line=6"))
|
||||
})
|
||||
|
||||
it("shows total-lines footer when entire file is returned", () => {
|
||||
const result = formatFileContentWithLineNumbers(tenLines, 1, 10)
|
||||
assert.ok(result.includes("File has 10 lines total"))
|
||||
})
|
||||
|
||||
it("shows total-lines footer when file fits within default limit", () => {
|
||||
const result = formatFileContentWithLineNumbers(tenLines)
|
||||
assert.ok(result.includes("File has 10 lines total"))
|
||||
})
|
||||
})
|
||||
|
||||
describe("default max lines", () => {
|
||||
const bigContent = Array.from({ length: DEFAULT_MAX_LINES + 500 }, (_, i) => `row${i + 1}`).join("\n")
|
||||
|
||||
it("limits output to DEFAULT_MAX_LINES when no end_line given", () => {
|
||||
const result = formatFileContentWithLineNumbers(bigContent)
|
||||
assert.ok(result.includes(`1 | row1`))
|
||||
assert.ok(result.includes(`${DEFAULT_MAX_LINES} | row${DEFAULT_MAX_LINES}`))
|
||||
assert.ok(!result.includes(`${DEFAULT_MAX_LINES + 1} |`))
|
||||
assert.ok(result.includes(`start_line=${DEFAULT_MAX_LINES + 1}`))
|
||||
})
|
||||
|
||||
it("allows reading beyond default limit with explicit end_line", () => {
|
||||
const endLine = DEFAULT_MAX_LINES + 200
|
||||
const result = formatFileContentWithLineNumbers(bigContent, 1, endLine)
|
||||
assert.ok(result.includes(`${endLine} | row${endLine}`))
|
||||
})
|
||||
})
|
||||
|
||||
describe("byte truncation interaction", () => {
|
||||
it("preserves truncation notice without numbering it", () => {
|
||||
const input =
|
||||
"alpha\nbeta\n\n---\n\n[FILE TRUNCATED: This content is 1.0 MB but only the first 400 KB is shown (600 KB truncated).]"
|
||||
const result = formatFileContentWithLineNumbers(input)
|
||||
assert.ok(result.startsWith("1 | alpha\n2 | beta"))
|
||||
assert.ok(
|
||||
result.includes(
|
||||
"[FILE TRUNCATED: This content is 1.0 MB but only the first 400 KB is shown (600 KB truncated).]",
|
||||
),
|
||||
)
|
||||
assert.ok(!result.includes("3 |"))
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -115,6 +115,7 @@ export abstract class WebviewProvider {
|
||||
font-src ${this.getCspSource()} data:;
|
||||
style-src ${this.getCspSource()} 'unsafe-inline';
|
||||
img-src ${this.getCspSource()} https: data:;
|
||||
media-src ${this.getCspSource()} https: data: blob:;
|
||||
script-src 'nonce-${nonce}' 'unsafe-eval';">
|
||||
<title>Cline</title>
|
||||
</head>
|
||||
@@ -202,6 +203,7 @@ export abstract class WebviewProvider {
|
||||
`font-src ${this.getCspSource()}`,
|
||||
`style-src ${this.getCspSource()} 'unsafe-inline' https://* http://${localServerUrl} http://0.0.0.0:${localPort}`,
|
||||
`img-src ${this.getCspSource()} https: data:`,
|
||||
`media-src ${this.getCspSource()} https: data: blob: http://${localServerUrl} http://0.0.0.0:${localPort}`,
|
||||
`script-src 'unsafe-eval' https://* http://${localServerUrl} http://0.0.0.0:${localPort} 'nonce-${nonce}'`,
|
||||
`connect-src https://* ws://${localServerUrl} ws://0.0.0.0:${localPort} http://${localServerUrl} http://0.0.0.0:${localPort}`,
|
||||
]
|
||||
|
||||
@@ -11,7 +11,10 @@ import { WorkspaceRootManager } from "../WorkspaceRootManager"
|
||||
|
||||
describe("setupWorkspaceManager", () => {
|
||||
const sandbox = sinon.createSandbox()
|
||||
let fakeTelemetry: any
|
||||
let fakeTelemetry: {
|
||||
captureWorkspaceInitialized: sinon.SinonStub
|
||||
captureWorkspaceInitError: sinon.SinonStub
|
||||
}
|
||||
|
||||
const cwd = "/Users/test/project"
|
||||
const defaultRoots: WorkspaceRoot[] = [
|
||||
@@ -75,12 +78,12 @@ describe("setupWorkspaceManager", () => {
|
||||
getWorkspacePaths: sandbox.stub().resolves({ paths: ["/ws/root1", "/ws/root2"] }),
|
||||
} as any)
|
||||
|
||||
// Telemetry stubs via getTelemetryService proxy
|
||||
// Telemetry stubs by replacing the exported proxy with a test double
|
||||
fakeTelemetry = {
|
||||
captureWorkspaceInitialized: sandbox.stub(),
|
||||
captureWorkspaceInitError: sandbox.stub(),
|
||||
captureWorkspaceInitialized: sandbox.stub().resolves(),
|
||||
captureWorkspaceInitError: sandbox.stub().resolves(),
|
||||
}
|
||||
sandbox.stub(telemetry, "getTelemetryService").resolves(fakeTelemetry)
|
||||
sandbox.stub(telemetry, "telemetryService").value(fakeTelemetry)
|
||||
|
||||
// Stub WorkspaceRootManager.fromLegacyCwd to be deterministic
|
||||
sandbox.stub(WorkspaceRootManager, "fromLegacyCwd").callsFake(async (legacyCwd: string) => {
|
||||
@@ -116,6 +119,10 @@ describe("setupWorkspaceManager", () => {
|
||||
expect(stateManager._state.primaryIndex).to.equal(0)
|
||||
|
||||
// telemetry captured (skipped assertion in unit tests)
|
||||
expect(fakeTelemetry.captureWorkspaceInitialized.calledOnce).to.equal(true)
|
||||
expect(fakeTelemetry.captureWorkspaceInitialized.firstCall.args[0]).to.equal(2)
|
||||
expect(fakeTelemetry.captureWorkspaceInitialized.firstCall.args[1]).to.deep.equal(["git", "none"])
|
||||
expect(fakeTelemetry.captureWorkspaceInitialized.firstCall.args[3]).to.equal(true)
|
||||
})
|
||||
|
||||
it("uses single-root cwd when history restore is disabled (historyItem present)", async () => {
|
||||
@@ -157,6 +164,10 @@ describe("setupWorkspaceManager", () => {
|
||||
// persisted
|
||||
expect(stateManager._state.roots?.[0].path).to.equal(cwd)
|
||||
// telemetry called (skipped assertion in unit tests)
|
||||
expect(fakeTelemetry.captureWorkspaceInitialized.calledOnce).to.equal(true)
|
||||
expect(fakeTelemetry.captureWorkspaceInitialized.firstCall.args[0]).to.equal(1)
|
||||
expect(fakeTelemetry.captureWorkspaceInitialized.firstCall.args[1]).to.deep.equal(["none"])
|
||||
expect(fakeTelemetry.captureWorkspaceInitialized.firstCall.args[3]).to.equal(false)
|
||||
})
|
||||
|
||||
it("gracefully handles errors and falls back to fromLegacyCwd while warning user", async () => {
|
||||
@@ -176,7 +187,10 @@ describe("setupWorkspaceManager", () => {
|
||||
expect(manager.getRoots()).to.have.length(1)
|
||||
expect(manager.getRoots()[0].path).to.equal(cwd)
|
||||
|
||||
// telemetry error captured (skipped assertion in unit tests)
|
||||
expect(fakeTelemetry.captureWorkspaceInitError.calledOnce).to.equal(true)
|
||||
expect(fakeTelemetry.captureWorkspaceInitError.firstCall.args[0]).to.be.instanceOf(Error)
|
||||
expect(fakeTelemetry.captureWorkspaceInitError.firstCall.args[1]).to.equal(true)
|
||||
expect(fakeTelemetry.captureWorkspaceInitError.firstCall.args[2]).to.equal(2)
|
||||
|
||||
// persisted fallback state
|
||||
expect(stateManager._state.roots?.[0].path).to.equal(cwd)
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import { strict as assert } from "assert"
|
||||
import { afterEach, describe, it } from "mocha"
|
||||
import * as sinon from "sinon"
|
||||
import * as vscode from "vscode"
|
||||
import { ExtensionRegistryInfo } from "@/registry"
|
||||
import { ClineClient } from "@/shared/cline"
|
||||
import { getHostVersion } from "./getHostVersion"
|
||||
|
||||
describe("Hostbridge - Env - getHostVersion", () => {
|
||||
const sandbox = sinon.createSandbox()
|
||||
|
||||
afterEach(() => {
|
||||
sandbox.restore()
|
||||
})
|
||||
|
||||
it("preserves known remote workspace names", async () => {
|
||||
const cases = ["ssh-remote", "dev-container", "codespaces"]
|
||||
|
||||
for (const remoteName of cases) {
|
||||
const remoteNameStub = sandbox.stub(vscode.env, "remoteName")
|
||||
remoteNameStub.get(() => remoteName)
|
||||
|
||||
const response = await getHostVersion({} as any)
|
||||
|
||||
assert.strictEqual(response.platform, vscode.env.appName)
|
||||
assert.strictEqual(response.version, vscode.version)
|
||||
assert.strictEqual(response.clineType, ClineClient.VSCode)
|
||||
assert.strictEqual(response.clineVersion, ExtensionRegistryInfo.version)
|
||||
assert.strictEqual(response.remoteName, remoteName)
|
||||
|
||||
remoteNameStub.restore()
|
||||
}
|
||||
})
|
||||
|
||||
it("normalizes empty remote workspace names to undefined", async () => {
|
||||
sandbox.stub(vscode.env, "remoteName").get(() => "")
|
||||
|
||||
const response = await getHostVersion({} as any)
|
||||
|
||||
assert.strictEqual(response.remoteName, undefined)
|
||||
})
|
||||
|
||||
it("keeps local workspaces without a remoteName", async () => {
|
||||
sandbox.stub(vscode.env, "remoteName").get(() => undefined)
|
||||
|
||||
const response = await getHostVersion({} as any)
|
||||
|
||||
assert.strictEqual(response.remoteName, undefined)
|
||||
})
|
||||
})
|
||||
@@ -1,5 +1,6 @@
|
||||
import type {
|
||||
BalanceResponse,
|
||||
FeaturebaseTokenResponse,
|
||||
OrganizationBalanceResponse,
|
||||
OrganizationUsageTransaction,
|
||||
PaymentTransaction,
|
||||
@@ -82,9 +83,8 @@ export class ClineAccountService {
|
||||
}
|
||||
if (response.statusText === "No Content") {
|
||||
return {} as T // Return empty object if no content
|
||||
} else {
|
||||
return response.data.data as T
|
||||
}
|
||||
return response.data.data as T
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,6 +160,20 @@ export class ClineAccountService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches a short-lived Featurebase SSO JWT for the current user
|
||||
* @returns FeaturebaseTokenResponse or undefined if failed
|
||||
*/
|
||||
async fetchFeaturebaseToken(): Promise<FeaturebaseTokenResponse | undefined> {
|
||||
try {
|
||||
const data = await this.authenticatedRequest<FeaturebaseTokenResponse>(CLINE_API_ENDPOINT.FEATUREBASE_TOKEN)
|
||||
return data
|
||||
} catch (error) {
|
||||
Logger.error("Failed to fetch Featurebase token:", error)
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the current user's organizations
|
||||
* @returns UserResponse["organizations"] or undefined if failed
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user