refactor(workflow-utils): reorganize — roles top-level, shared internals in shared/ #228

Merged
xingyue merged 1 commits from refactor/227-workflow-utils-reorg into main 2026-04-28 08:51:06 +00:00
Owner

What

Reorganize packages/workflow-utils/src/ so the package's core purpose (role factories) is immediately obvious.

Changes

Structure: flat mixed → layered

src/
  index.ts              # barrel exports (public API unchanged)
  role-cursor.ts        # createCursorRole
  role-hermes.ts        # createHermesRole
  role-llm.ts           # createLlmRole
  role-react.ts         # createReActRole
  role-types.ts         # all role types + isDryRun

  shared/               # internal shared utilities
    spawn-safe.ts
    cursor-agent.ts
    hermes-agent.ts     # + resolveHermesOptions (absorbed)
    llm-extract.ts
    llm-chat.ts
    schema-defaults.ts
    context.ts
    format-error.ts     # extracted shared helper

Eliminated files:

  • start-step.ts (6 lines) → absorbed into role-types.ts
  • hermes-options.ts (29 lines) → absorbed into shared/hermes-agent.ts
  • role-factories.ts (223 lines) → split into 4 role-*.ts files

Other improvements:

  • Deduplicated cursor merge helpers with generic pick()
  • Extracted formatLlmError into shared/format-error.ts (DRY)

Result

  • 257 additions, 281 deletions (net -24 lines)
  • Public API (index.ts exports) unchanged
  • All tests pass (15 workflow-utils + full monorepo)

Fixes #227

## What Reorganize `packages/workflow-utils/src/` so the package's core purpose (role factories) is immediately obvious. ## Changes **Structure: flat mixed → layered** ``` src/ index.ts # barrel exports (public API unchanged) role-cursor.ts # createCursorRole role-hermes.ts # createHermesRole role-llm.ts # createLlmRole role-react.ts # createReActRole role-types.ts # all role types + isDryRun shared/ # internal shared utilities spawn-safe.ts cursor-agent.ts hermes-agent.ts # + resolveHermesOptions (absorbed) llm-extract.ts llm-chat.ts schema-defaults.ts context.ts format-error.ts # extracted shared helper ``` **Eliminated files:** - `start-step.ts` (6 lines) → absorbed into `role-types.ts` - `hermes-options.ts` (29 lines) → absorbed into `shared/hermes-agent.ts` - `role-factories.ts` (223 lines) → split into 4 `role-*.ts` files **Other improvements:** - Deduplicated cursor merge helpers with generic `pick()` - Extracted `formatLlmError` into `shared/format-error.ts` (DRY) ## Result - 257 additions, 281 deletions (net -24 lines) - Public API (`index.ts` exports) unchanged - All tests pass (15 workflow-utils + full monorepo) Fixes #227
xiaomo added 1 commit 2026-04-28 08:49:07 +00:00
- Split role-factories.ts into role-cursor/hermes/llm/react.ts
- Move shared internals (spawn-safe, cursor-agent, hermes-agent, llm-*, etc.) to shared/
- Absorb start-step.ts (6 lines) into role-types.ts
- Absorb hermes-options.ts into shared/hermes-agent.ts
- Extract formatLlmError into shared/format-error.ts
- Deduplicate cursor merge helpers with generic pick()
- Public API (index.ts exports) unchanged

Fixes #227
xingyue merged commit a0a91d1699 into main 2026-04-28 08:51:06 +00:00
This repo is archived. You cannot comment on pull requests.
No Reviewers
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/nerve#228