* feat: add banner to install Cline for CLI and experimental subagents feature * Update snapshots * Fix copy * Style fixes * A few small changes to cli detection, prompting, cleanup * Prompting tweaks and npm command update * Prompting, bug fix * Prompt changes around command syntax * Command parsing and flag substitution for easier subagent invocation * Added terminal output slider setting for subagents * Improved CLI subagent settings injection * Added max_consecutive_mistakes setting and cli flag * Terminal line limit added to enchanced terminal, prompting and settings tweaks * feat: Add OpenTelemetry settings schema and state infrastructure (1/5) (#6826) * feat: Add OpenTelemetry settings schema and state infrastructure (1/5) - Add 16 OpenTelemetry configuration fields to Settings interface - Add 17 OpenTelemetry fields to RemoteConfig schema - Add state persistence helpers for OpenTelemetry settings - Foundation for dynamic OpenTelemetry configuration Part 1 of 5 in the telemetry settings refactor series. * chore: add changeset for OpenTelemetry schema * fix: Address PR review feedback for OpenTelemetry settings - Remove | undefined from 8 OpenTelemetry fields with default values - Add default values in state-helpers.ts for all non-optional fields - Add OpenTelemetry field mappings to remote-config/utils.ts - Add comprehensive test coverage for OpenTelemetry fields in schema.test.ts - Update changeset terminology from 'Otel' to 'OpenTelemetry' Addresses feedback from: - sjf: Remote config transformation and test coverage - celestial-vault: Type cleanup and default values - Copilot: Terminology improvement * Prompting changes * Fixed system prompt empty sections issue, fixed rebase mistake * Added telemetry for CLI subagent use in IDEs * Platform aware banner, fixed settings layout issues * Post rebase fixes & changes to accomodate new terminal UI * Cline Icon SVG in ChatRow - WIP * Fixed outputLine limit issue * Fixed rebase merge conflict remnant * Rebase fix * Cleanup and changes to instructions for new CLI users * Added CLI documentation link * Small prompt adjustments * One more bullet point * Updated remaining npm install command * Updated subagent command format for CLI release spec * Added check to prevent subagents from getting subagent prompt * Added subagent slash command * Apply suggestion from @ellipsis-dev[bot] Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * Remove workdir * Update src/core/prompts/system-prompt/variants/xs/overrides.ts Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * removed logging * Updated expected version output * Removed checkCliInstallation check in getStateToPostToWebview * removed more logging * fix: force subagents to use terminal stuff --------- Co-authored-by: Kevin Bond <kevin@cline.bot> Co-authored-by: Daniel Steigman <35793213+NightTrek@users.noreply.github.com> Co-authored-by: Andrei Eternal <206184+Garoth@users.noreply.github.com> Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> Co-authored-by: canvrno <46584286+canvrno@users.noreply.github.com> Co-authored-by: Arafatkatze <arafat.da.khan@gmail.com>
174 lines
5.0 KiB
TypeScript
174 lines
5.0 KiB
TypeScript
import { UpdateSettingsRequest } from "@shared/proto/cline/state"
|
|
import * as assert from "assert"
|
|
import * as sinon from "sinon"
|
|
import { Controller } from ".."
|
|
import { updateSettings } from "./updateSettings"
|
|
|
|
// Mock telemetryService
|
|
const telemetryServiceMock = {
|
|
captureSubagentToggle: sinon.stub(),
|
|
}
|
|
|
|
describe("updateSettings platform validation", () => {
|
|
let mockController: Controller
|
|
let originalPlatform: NodeJS.Platform
|
|
|
|
beforeEach(() => {
|
|
// Store original platform
|
|
originalPlatform = process.platform
|
|
|
|
// Create mock controller
|
|
mockController = {
|
|
stateManager: {
|
|
getGlobalSettingsKey: sinon.stub(),
|
|
setGlobalState: sinon.stub(),
|
|
setApiConfiguration: sinon.stub(),
|
|
},
|
|
postStateToWebview: sinon.stub().resolves({}),
|
|
task: undefined,
|
|
updateTelemetrySetting: sinon.stub(),
|
|
} as unknown as Controller
|
|
|
|
// Clear telemetry service mock
|
|
telemetryServiceMock.captureSubagentToggle.reset()
|
|
})
|
|
|
|
afterEach(() => {
|
|
// Restore original platform
|
|
Object.defineProperty(process, "platform", {
|
|
value: originalPlatform,
|
|
writable: true,
|
|
configurable: true,
|
|
})
|
|
sinon.restore()
|
|
})
|
|
|
|
it("should allow enabling subagents on macOS (darwin)", async () => {
|
|
// Set platform to macOS
|
|
Object.defineProperty(process, "platform", { value: "darwin" })
|
|
|
|
;(mockController.stateManager.getGlobalSettingsKey as sinon.SinonStub).returns(false)
|
|
|
|
const request = UpdateSettingsRequest.create({
|
|
subagentsEnabled: true,
|
|
})
|
|
|
|
// Should not throw
|
|
await updateSettings(mockController, request)
|
|
|
|
assert.ok(
|
|
(mockController.stateManager.setGlobalState as sinon.SinonStub).calledWith("subagentsEnabled", true),
|
|
"Should enable subagents on macOS",
|
|
)
|
|
})
|
|
|
|
it("should throw error when trying to enable subagents on Windows", async () => {
|
|
// Set platform to Windows
|
|
Object.defineProperty(process, "platform", { value: "win32" })
|
|
|
|
;(mockController.stateManager.getGlobalSettingsKey as sinon.SinonStub).returns(false)
|
|
|
|
const request = UpdateSettingsRequest.create({
|
|
subagentsEnabled: true,
|
|
})
|
|
|
|
try {
|
|
await updateSettings(mockController, request)
|
|
assert.fail("Should have thrown an error")
|
|
} catch (error) {
|
|
assert.strictEqual(
|
|
(error as Error).message,
|
|
"CLI subagents are only supported on macOS platforms",
|
|
"Should throw platform restriction error",
|
|
)
|
|
}
|
|
|
|
assert.ok(
|
|
!(mockController.stateManager.setGlobalState as sinon.SinonStub).called,
|
|
"Should not call setGlobalState when platform validation fails",
|
|
)
|
|
})
|
|
|
|
it("should throw error when trying to enable subagents on Linux", async () => {
|
|
// Set platform to Linux
|
|
Object.defineProperty(process, "platform", { value: "linux" })
|
|
|
|
;(mockController.stateManager.getGlobalSettingsKey as sinon.SinonStub).returns(false)
|
|
|
|
const request = UpdateSettingsRequest.create({
|
|
subagentsEnabled: true,
|
|
})
|
|
|
|
try {
|
|
await updateSettings(mockController, request)
|
|
assert.fail("Should have thrown an error")
|
|
} catch (error) {
|
|
assert.strictEqual(
|
|
(error as Error).message,
|
|
"CLI subagents are only supported on macOS platforms",
|
|
"Should throw platform restriction error",
|
|
)
|
|
}
|
|
|
|
assert.ok(
|
|
!(mockController.stateManager.setGlobalState as sinon.SinonStub).called,
|
|
"Should not call setGlobalState when platform validation fails",
|
|
)
|
|
})
|
|
|
|
it("should allow disabling subagents on any platform", async () => {
|
|
// Test on Windows
|
|
Object.defineProperty(process, "platform", { value: "win32" })
|
|
|
|
;(mockController.stateManager.getGlobalSettingsKey as sinon.SinonStub).returns(true)
|
|
|
|
const request = UpdateSettingsRequest.create({
|
|
subagentsEnabled: false,
|
|
})
|
|
|
|
// Should not throw
|
|
await updateSettings(mockController, request)
|
|
|
|
assert.ok(
|
|
(mockController.stateManager.setGlobalState as sinon.SinonStub).calledWith("subagentsEnabled", false),
|
|
"Should allow disabling subagents on any platform",
|
|
)
|
|
})
|
|
|
|
it("should allow keeping subagents disabled on non-macOS platforms", async () => {
|
|
// Test on Windows with subagents already disabled
|
|
Object.defineProperty(process, "platform", { value: "win32" })
|
|
|
|
;(mockController.stateManager.getGlobalSettingsKey as sinon.SinonStub).returns(false)
|
|
|
|
const request = UpdateSettingsRequest.create({
|
|
subagentsEnabled: false,
|
|
})
|
|
|
|
// Should not throw
|
|
await updateSettings(mockController, request)
|
|
|
|
assert.ok(
|
|
(mockController.stateManager.setGlobalState as sinon.SinonStub).calledWith("subagentsEnabled", false),
|
|
"Should allow keeping subagents disabled on non-macOS platforms",
|
|
)
|
|
})
|
|
|
|
it("should not perform platform validation when subagentsEnabled is undefined", async () => {
|
|
// Test on Windows but don't try to change subagents setting
|
|
Object.defineProperty(process, "platform", { value: "win32" })
|
|
|
|
const request = UpdateSettingsRequest.create({
|
|
strictPlanModeEnabled: true, // Some other setting
|
|
})
|
|
|
|
// Should not throw error since subagentsEnabled is not being changed
|
|
await updateSettings(mockController, request)
|
|
|
|
assert.ok(
|
|
(mockController.postStateToWebview as sinon.SinonStub).called,
|
|
"Should complete successfully when subagentsEnabled is not being changed",
|
|
)
|
|
})
|
|
})
|