Repository navigation
Conversation
|
Thanks for the fix and the thorough write-up — the root-cause analysis of The problem:
None of the This traces to
The issue reporter said it themselves: "--agent cursor is completely ignored" — their real complaint is that a Cursor install populates Suggested alternative (Fix B): intercept Cursor before the Claude default path, matching Windsurf/Cline — e.g. // main.rs
let install_claude = !opencode && agent != Some(AgentTarget::Cursor);or add an Separate gap: The |
|
Appreciate it @pszymkowiak — thanks for the thorough review. |
|
I think there is already another PR to fix this: #3000 |
Summary
The single choke point is
atomic_write(path, content)insrc/hooks/init.rs: it computesparent = target.parent()and immediately callsNamedTempFile::new_in(parent), which returnsos error 2whenparentdoes not exist. Every other write site in this file already callsfs::create_dir_all(...)before writing (e.g.Why this matters
Running
rtk init -g --agent cursor(global install targeting Cursor) crashes withFailed to write RTK.md: .../.claude/RTK.md: Failed to create temp file in .../.claude: No such file or directory (os error 2)whenever the user does not already have a~/.claudedirectory. It is reproduced on rtk 0.43.0 on macOS 15.7.3, macOS 26.5.1, and Arch Linux by three separate reporters. The reporter confirms that manually creating a.claudedirectory makes the command succeed, so the failure is purely the missing parent directory. Because the global default path also installs Claude Code awareness files (Cursor hooks are additive on top of Claude Code) and fails fast on that first write, the Cursor portion never runs.Testing
atomic_write(or global default init via a tempCLAUDE_CONFIG_DIRwhose.claudesubdir does not yet exist) creates the missing parent directory and writes the file successfully, mirroring the existingtest_default_mode_creates_rtk_mdpattern.write_if_changedno-op-when-unchanged path).Fixes #3009
AI was used for assistance.