Skip to content

refactor: split agent bindings per review on #7 - #9

Merged
devzeebo merged 1 commit into
mainfrom
refactor/split-agent-bindings
Aug 30, 2026
Merged

refactor: split agent bindings per review on #7#9
devzeebo merged 1 commit into
mainfrom
refactor/split-agent-bindings

Conversation

@matt-wright-dev

Copy link
Copy Markdown
Collaborator

Follow-up to the review on #7 (merged with changes requested).

What the review asked for

  • run.spec.ts:40 — temp homes on the context, cleaned up through withAspect instead of a module-level tempRoots array + afterEach. Done as withAspect(a_temp_home, remove_temp_home): the before-aspect creates the temp home, each given decides whether to put a credentials file in it. (withAspect's first argument is typed as required, so a no-op undefined before-aspect would not type-check; creating the home there is the idiomatic version anyway.)
  • run.ts:51resolveClaudeCredentials moved to claude/_resolveCredentials.ts with its own _resolveCredentials.spec.ts.
  • run.ts:80buildClaudeDockerArgs moved to claude/_buildDockerArgs.ts with its own spec, and the same for the Cursor agent: cursor/_buildDockerArgs.ts + spec.

One forced extra split: credentialsEnv was private to run.ts and is now needed by both _buildDockerArgs.ts and run.ts, so it lives in claude/_credentialsEnv.ts (covered through both callers' specs, as before).

Layout after

src/agents/claude/            src/agents/cursor/
  _buildDockerArgs.ts (+spec)   _buildDockerArgs.ts (+spec)
  _credentialsEnv.ts            run.ts (+spec)   runCursorInDocker only
  _resolveCredentials.ts (+spec)
  run.ts (+spec)   runClaudeInDocker + its error helpers only
  index.ts         same exports as before, new sources

Checks

  • pnpm run lint && pnpm run test && pnpm run build: clean; 52 tests, now across 16 files.
  • Public exports unchanged (buildClaudeDockerArgs, resolveClaudeCredentials, runClaudeInDocker, buildDockerArgs, runCursorInDocker, types); the e2e/ suite and an external consumer importing only from the package barrel need no changes.

Two questions, not changed here

  • _-prefixed modules are re-exported by index.ts (resolveClaudeCredentials, buildClaudeDockerArgs, buildDockerArgs). If underscore is meant as "sibling-private" (the way gwt-runner uses it), the two build*DockerArgs exports are the odd ones out: neither is in the README exports table. Dropping them would be an API change, so it is left for a later minor if you agree.
  • Cursor's auth-file resolution (default path + access check + error message) is still inline in cursor/run.ts, while the Claude equivalent now lives in _resolveCredentials.ts. A cursor/_resolveAuthFile.ts + spec would make both run.ts files pure orchestration and give the Cursor error message its first unit test. Left out because the review comment on the Cursor side was about buildDockerArgs.

One function per module, underscore prefix for internal modules, one
spec per module. index.ts still decides the public surface, so nothing
exported changes name and there is no behaviour change.

claude/
- _resolveCredentials.ts (+ spec): resolveClaudeCredentials and the
  ClaudeCredentials type. The spec keeps its temp home on the context
  and cleans it up through withAspect(a_temp_home, remove_temp_home)
  instead of a module-level tempRoots array and afterEach.
- _buildDockerArgs.ts (+ spec): buildClaudeDockerArgs.
- _credentialsEnv.ts: credentialsEnv, now shared by _buildDockerArgs
  and run (was private to run.ts).
- run.ts / run.spec.ts: runClaudeInDocker and its error helpers only.

cursor/
- _buildDockerArgs.ts (+ spec): buildDockerArgs.
- run.ts / run.spec.ts: runCursorInDocker only.

Spec bodies were moved, not rewritten. Verified with the unit suite
(52 tests, 16 files), the repo e2e, and a consumer project running the
packed tarball against both agents.

Refs: #7 (comment)
      #7 (comment)
      #7 (comment)
@devzeebo
devzeebo merged commit ce0a690 into main Aug 30, 2026
2 checks passed
@devzeebo
devzeebo deleted the refactor/split-agent-bindings branch August 30, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants