feat: @uncaged/workflow-agent-cursor — Cursor Agent adapter #10

Closed
opened 2026-05-06 06:50:42 +00:00 by xiaoju · 0 comments
Owner

背景

从 nerve 迁移 Cursor Agent adapter。

源码:~/repos/nerve/packages/adapter-cursor/src/index.ts + ~/repos/nerve/packages/workflow-utils/src/role-cursor.ts

职责

将 Cursor Agent CLI 包装为 AgentFn:

import { createCursorAgent } from "@uncaged/workflow-agent-cursor";

const agent = createCursorAgent({ workdir: "/path/to/repo", model: "auto" });
// agent: AgentFn = (ctx, systemPrompt) => Promise<string>

内部调用 cursor-agent -p <prompt> --model <model> --force --trust

实现

  • 从 nerve adapter-cursor 迁移,去掉 nerve-core 依赖
  • node:child_processexecFilespawn 调用 cursor-agent CLI
  • 不依赖 nerveCommandEnv,直接用 process.env
  • AgentFn 类型从 @uncaged/workflow 导入

包结构

packages/workflow-agent-cursor/
  package.json    # @uncaged/workflow-agent-cursor
  src/
    index.ts      # createCursorAgent
    types.ts      # CursorAgentConfig

验证

  • bun test 通过
  • bunx biome check . 通过
  • 不依赖 nerve-core
## 背景 从 nerve 迁移 Cursor Agent adapter。 源码:`~/repos/nerve/packages/adapter-cursor/src/index.ts` + `~/repos/nerve/packages/workflow-utils/src/role-cursor.ts` ## 职责 将 Cursor Agent CLI 包装为 AgentFn: ```typescript import { createCursorAgent } from "@uncaged/workflow-agent-cursor"; const agent = createCursorAgent({ workdir: "/path/to/repo", model: "auto" }); // agent: AgentFn = (ctx, systemPrompt) => Promise<string> ``` 内部调用 `cursor-agent -p <prompt> --model <model> --force --trust` ## 实现 - 从 nerve adapter-cursor 迁移,去掉 nerve-core 依赖 - 用 `node:child_process` 的 `execFile` 或 `spawn` 调用 cursor-agent CLI - 不依赖 `nerveCommandEnv`,直接用 process.env - AgentFn 类型从 `@uncaged/workflow` 导入 ## 包结构 ``` packages/workflow-agent-cursor/ package.json # @uncaged/workflow-agent-cursor src/ index.ts # createCursorAgent types.ts # CursorAgentConfig ``` ## 验证 - [ ] bun test 通过 - [ ] bunx biome check . 通过 - [ ] 不依赖 nerve-core
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#10