(err: unknown)
| 184 | } |
| 185 | |
| 186 | export function toLoadError(err: unknown): LoadError { |
| 187 | if (err instanceof ZenCliNotFoundError || isMissingExecutableError(err)) { |
| 188 | return { |
| 189 | title: "ZenNotes CLI not found", |
| 190 | message: |
| 191 | "Install the zn command from ZenNotes Settings -> CLI, then run `zn list` in Terminal to verify it.", |
| 192 | }; |
| 193 | } |
| 194 | |
| 195 | const stderr = |
| 196 | isRecord(err) && typeof err.stderr === "string" ? err.stderr.trim() : ""; |
| 197 | const message = |
| 198 | stderr.replace(/^(?:zn|zen):\s*/i, "") || |
| 199 | (err instanceof Error ? err.message : String(err)); |
| 200 | return { |
| 201 | title: "Could not load notes", |
| 202 | message, |
| 203 | }; |
| 204 | } |
| 205 | |
| 206 | export function cliSetupCopyActionContent(): string { |
| 207 | return "Open ZenNotes -> Settings -> CLI, install the zn command, then run `zn list` in Terminal to verify it."; |
no test coverage detected