TS parity: mkdir the claude home when the path is under it, then exclusive-create an empty file (existing content preserved).
(path: str)
| 129 | |
| 130 | |
| 131 | def _ensure_file(path: str) -> None: |
| 132 | """TS parity: mkdir the claude home when the path is under it, then |
| 133 | exclusive-create an empty file (existing content preserved).""" |
| 134 | claude_home = str(Path.home() / ".claude") |
| 135 | if path.startswith(claude_home): |
| 136 | Path(claude_home).mkdir(parents=True, exist_ok=True) |
| 137 | try: |
| 138 | with open(path, "x", encoding="utf-8"): |
| 139 | pass |
| 140 | except FileExistsError: |
| 141 | pass |
| 142 | |
| 143 | |
| 144 | _EDITOR_HINT = ( |