chore: auto-fetch Cursor cloud agent transcripts on URL paste#181
Conversation
Add a workspace Cursor rule and a pnpm script that call @cursor/sdk (Agent.listRuns + getRun + conversation) when a cursor.com/agents URL or bc- agent id appears in chat. Co-authored-by: Tony <tonyketcham@users.noreply.github.com>
Co-authored-by: Tony <tonyketcham@users.noreply.github.com>
There was a problem hiding this comment.
Found one issue that should be fixed before merge.
packages/proof/scripts/fetch-cloud-agent-conversation.mjs currently crashes when the new command is invoked without a positional argument (pnpm run cursor:fetch-cloud-agent from the repo root reproduces this). Instead of printing usage/help, it throws Node's The "path" argument must be of type string ... Received type number (0) because the stdin fallback is using fs/promises.readFile(0, ...). Please fix that path and add a focused regression test for the no-arg / - cases so the new workflow stays reliable.
Sent by Cursor Automation: Flatbread PR Review
| ); | ||
| let raw = input; | ||
| if (input === '' || input === '-') { | ||
| const { readFile } = await import('node:fs/promises'); |
There was a problem hiding this comment.
This stdin fallback is currently broken: fs/promises.readFile() does not accept a numeric fd here, so pnpm run cursor:fetch-cloud-agent (or ... -- -) dies with The "path" argument must be of type string ... Received type number (0) before we ever reach the usage/error handling below. Since this PR introduces the command specifically for agent-facing workflows, can we switch this to a real stdin reader (process.stdin or fs.readFileSync(0, 'utf8')) and cover the no-arg / - cases with a regression test?
Use async stdin consumption instead of fs/promises.readFile(0), which is invalid for numeric fds in this Node API. Treat standalone '-' as a positional stdin sentinel so pnpm -- - works. Add AVA regression tests for piped stdin with no args and with '-'. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Tony <tonyketcham@users.noreply.github.com>
Validate --run and --api-key values; parse URLs without hiding failures while still falling back to bc-/run- regex when URL() rejects the href. Sort cloud runs by createdAt with stable id tie-break; log full errors from main(). Publish scripts/ in @flatbread/proof so the packaged npm script resolves. Align the workspace Cursor rule with stdout JSON (agentId and slim run). AVA covers missing flag values; Proof DAG review used composer-2 on all ranks. Co-authored-by: Tony <tonyketcham@users.noreply.github.com>


Add a workspace Cursor rule and a pnpm script that call @cursor/sdk (Agent.listRuns + getRun + conversation) when a cursor.com/agents URL or bc- agent id appears in chat.