Files
cline/apps/vscode/tsconfig.unit-test.json
T
Dominic Cooney 072e237d01 fix(vscode): persist skill disable to SKILL.md frontmatter so the model honors it (ENG-1995) (#11294)
* fix(vscode): persist skill disable to SKILL.md frontmatter so the model honors it (ENG-1995)

The VS Code skill toggle only updated extension state (globalSkillsToggles /
localSkillsToggles), but the SDK builds the model's skill list and the `skills`
tool from each SKILL.md's frontmatter `disabled` flag. As a result, disabling a
skill in the sidebar left it fully available to the model, including in new
tasks.

toggleSkill now also writes the `disabled` flag to the skill's SKILL.md
frontmatter (no-op for remote skills, which have no backing file), via new
helpers updateSkillMarkdownDisabledState / setSkillDisabledInFrontmatter in
skills.ts. Adds unit tests for both helpers.

* fix(vscode): don't rewrite skills with malformed frontmatter (ENG-1995)

parseYamlFrontmatter fails open on invalid YAML, returning the full original
document as the body. updateSkillMarkdownDisabledState would then prepend a
second `---` block on a disable, corrupting the file. Bail out and leave the
file untouched when frontmatter fails to parse. Adds tests for the malformed
disable/enable cases.

Addresses Greptile review feedback on #11294.

* test(vscode): assert malformed-skill fixture is actually invalid YAML (ENG-1995)

Add a guard test that parseYamlFrontmatter reports hadFrontmatter and a
parseError for the shared malformed fixture, so the two "leave file untouched"
tests can't silently pass via a different code path if the fixture ever became
valid YAML.

Addresses Greptile review feedback on #11294.

* fix(vscode): resolve @cline/shared/storage subpath in mocha unit-test compile

The CommonJS mocha unit-test runner uses classic "node" moduleResolution,
which does not read the `exports` subpath maps in @cline/* package
manifests, so `@cline/shared/storage` (imported by
src/sdk/telemetry-settings-sync.ts) failed with TS2307 when test files
transitively reach the SDK adapter. Mirror the explicit paths mapping
already added to tsconfig.test.json for the integration-test compile.

* fix(vscode): restore E2E mock auth in SDK auth service so e2e tests can sign in

The SDK migration replaced classic AuthService (which swapped in
AuthServiceMock under E2E_TEST) with sdk/auth-service.ts, losing the
mock path. "Login to Cline" then invoked the real SDK OAuth flow and
opened a native browser dialog the Playwright tests cannot interact
with, so helper.signin() never authenticated and chat.test.ts +
diff.test.ts failed on every platform (the failures also reproduce on
the base branch).

- auth-service.ts: under E2E_TEST=true (and CLINE_ENVIRONMENT=local),
  exchange the well-known test code with the local mock API server and
  persist credentials to providers.json — no browser. Replaces classic
  AuthServiceMock (see origin/main src/services/auth/AuthServiceMock.ts).
- chat.test.ts/diff.test.ts: wait for the mock turn to complete before
  clicking New Task; SDK history is persisted at turn end, so navigating
  mid-turn races the write and Recent never shows.
- diff.test.ts: the footer Start New Task button only appears for
  attempt_completion turns under SDK TurnState; use the header New Task
  button like chat.test.ts.
2026-06-24 14:11:32 +09:00

76 lines
1.9 KiB
JSON

{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
// Classic "node" moduleResolution (required for the CommonJS mocha unit-test
// runner) does not read the `exports` subpath maps in @cline/* package
// manifests, so bare subpath imports like `@cline/shared/storage` fail to
// resolve (TS2307) even though the built declarations exist. The base
// tsconfig uses `Bundler` resolution and is unaffected. We re-declare the
// inherited `paths` (TS replaces, not merges, `paths`) and add explicit
// mappings to the built dist so the unit-test compile can resolve these
// subpaths. Mirrors the same fix in tsconfig.test.json.
"baseUrl": ".",
"paths": {
"@/*": [
"./src/*"
],
"@api/*": [
"./src/core/api/*"
],
"@core/*": [
"./src/core/*"
],
"@generated/*": [
"./src/generated/*"
],
"@hosts/*": [
"./src/hosts/*"
],
"@integrations/*": [
"./src/integrations/*"
],
"@packages/*": [
"./src/packages/*"
],
"@services/*": [
"./src/services/*"
],
"@shared/*": [
"./src/shared/*"
],
"@utils/*": [
"./src/utils/*"
],
"@cline/shared/*": [
"./node_modules/@cline/shared/dist/*"
]
},
"typeRoots": [
"./node_modules/@types",
"./src/types"
]
},
"ts-node": {
"require": [
"tsconfig-paths/register"
],
// Load the files matched by "include" (notably the ambient vscode LM
// API augmentation in src/types/*.d.ts) into the ts-node program.
// Without this, ts-node defaults to files:false and compiles modules
// on demand from their imports, so the loose .d.ts augmentation is
// never loaded and src/shared/storage/state-keys.ts fails to compile
// with "Module 'vscode' has no exported member 'LanguageModelChatSelector'".
"files": true
},
"include": [
"src/**/*.ts",
"src/types/**/*.d.ts",
"test/**/*.ts"
],
"exclude": [
"node_modules"
]
}