mirror of
https://github.com/stablyai/orca.git
synced 2026-11-14 01:47:24 +00:00
fix(cursor): write workspace trust where cursor-agent reads it (#38807)
* fix(cursor): write workspace trust where cursor-agent reads it cursor-agent names ~/.cursor/projects/<dir> by replacing every non-alphanumeric character with '-', collapsing repeats, and trimming dashes. Orca only replaced Windows-illegal characters, so paths with '_', '.', spaces or non-ASCII got a marker cursor-agent never reads and the trust menu appeared on every fresh worktree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(cursor): cover space, non-ASCII and Windows paths in the trust slug test --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
Jinwoo-H
parent
3c4990dc03
commit
b07b0432a4
@@ -91,6 +91,16 @@ describe('markCursorWorkspaceTrusted', () => {
|
||||
rmSync(workspace, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
|
||||
it('uses the project directory cursor-agent reads', () => {
|
||||
// Names computed by cursor-agent's own rule (2026.09.28 and 2026.11.05) for these paths.
|
||||
markCursorWorkspaceTrusted('/orca-missing/My Repo_v2/Ünï code--x.1', testState.fakeHomeDir)
|
||||
markCursorWorkspaceTrusted('C:\\Users\\Jane Doe\\orca\\feat', testState.fakeHomeDir)
|
||||
expect(readdirSync(join(testState.fakeHomeDir, '.cursor', 'projects')).sort()).toEqual([
|
||||
'C-Users-Jane-Doe-orca-feat',
|
||||
'orca-missing-My-Repo-v2-n-code-x-1'
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
describe('markKimiWorkspaceTrusted', () => {
|
||||
|
||||
@@ -163,8 +163,9 @@ function canonicalize(p: string): string {
|
||||
}
|
||||
|
||||
function cursorWorkspaceSlug(absPath: string): string {
|
||||
const stripped = absPath.replace(/^[\\/]+/, '')
|
||||
// Windows paths contain characters forbidden in Cursor’s project-directory names.
|
||||
const slug = stripped.replace(/[\\/:*?"<>|]+/g, '-')
|
||||
return slug
|
||||
// Mirrors cursor-agent's project-directory name; any mismatch leaves the trust menu up.
|
||||
return absPath
|
||||
.replace(/[^a-zA-Z0-9]/g, '-')
|
||||
.replace(/-+/g, '-')
|
||||
.replace(/^-+|-+$/g, '')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user