mirror of
https://github.com/cline/cline.git
synced 2026-08-31 01:40:46 +08:00
fix(shared): discover global rules at ~/Cline/Rules (#13614)
The VS Code Rules tab resolves the Documents folder via 'xdg-user-dir DOCUMENTS', which prints bare $HOME when no user-dirs config exists (WSL/headless installs), so it reads and writes global rules at ~/Cline/Rules. The SDK's rule search paths only covered ~/Documents/Cline/Rules, so those rules never reached the system prompt. Add the missing path to the search list. Fixes #13542 Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { dirname, join } from "node:path";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import {
|
||||
AGENT_CONFIG_DIRECTORY_NAME,
|
||||
@@ -204,6 +204,12 @@ describe("storage path resolution", () => {
|
||||
expect.arrayContaining([
|
||||
resolveGlobalAgentsRulesPath(),
|
||||
join("/tmp/home", ".cline", RULES_CONFIG_DIRECTORY_NAME),
|
||||
// xdg-user-dir's unconfigured Documents fallback (cline/cline#13542)
|
||||
join(
|
||||
dirname(dirname(resolveGlobalAgentsRulesPath())),
|
||||
"Cline",
|
||||
"Rules",
|
||||
),
|
||||
]),
|
||||
);
|
||||
expect(resolveRulesConfigSearchPaths()).not.toContain(
|
||||
|
||||
@@ -514,6 +514,11 @@ export function resolveRulesConfigSearchPaths(
|
||||
...wsPaths,
|
||||
resolveGlobalAgentsRulesPath(),
|
||||
join(resolveClineDir(), RULES_CONFIG_DIRECTORY_NAME),
|
||||
// The VS Code Rules tab resolves Documents via `xdg-user-dir DOCUMENTS`,
|
||||
// which prints bare $HOME when unconfigured (WSL/headless), putting
|
||||
// global rules at ~/Cline/Rules instead of ~/Documents/Cline/Rules
|
||||
// (cline/cline#13542).
|
||||
join(HOME_DIR, "Cline", "Rules"),
|
||||
resolveDocumentsExtensionPath("Rules"),
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user