AI Agents SDE Task Viewer
      • Context
      • Plan
      • Prd
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-354
  5. plan
  6. plan.md
plan.md(2.4 KB)· Apr 8, 2026· 1 min read
  • Summary
  • Files
  • Steps
  • Verification
  • Risks

Plan: Make WorktreeService config-driven (base branch, branch prefix)#

Summary#

Replace hardcoded origin/master and default 'feat' branch prefix in WorktreeService with values sourced from TenantConfigService. This makes branch management config-driven, unblocking tenant-aware branch operations.

Files#

FileActionDescription
src/worktree/worktree.service.tsmodifyInject TenantConfigService, replace origin/master with origin/${defaultBaseBranch}, use tenantConfig.branchPrefix as default
src/worktree/worktree.module.tsmodifyImport TenantModule
src/worktree/worktree.service.spec.tsmodifyAdd TenantConfigService mock, add test case with defaultBaseBranch: 'main'

Steps#

  1. Inject TenantConfigService into WorktreeService — Add TenantConfigService to constructor. Call getConfig() to read defaultBaseBranch and branchPrefix at the point of use (not constructor-time, since config may vary per invocation in future multi-tenant scenarios).
  2. Replace hardcoded origin/master — Line 130: change 'origin/master' to `origin/${tenantConfig.defaultBaseBranch}` in the git worktree add -b call inside getOrCreateWorktree().
  3. Make default branchPrefix config-driven — Change the branchPrefix = 'feat' default parameter in getOrCreateWorktree() (line 27) and cleanupWorktree() (line 149) to use tenantConfig.branchPrefix when no explicit prefix is passed. Use a sentinel default (undefined) and resolve inside the method body.
  4. Import TenantModule in WorktreeModule — Add TenantModule to imports array in worktree.module.ts.
  5. Update unit tests — Add TenantConfigService mock (returning { defaultBaseBranch: 'master', branchPrefix: 'feat' } by default). Add test case where defaultBaseBranch: 'main' verifies origin/main is used. Verify explicit branchPrefix caller override still takes precedence.

Verification#

  • tsc --noEmit passes with no type errors
  • npm run lint passes with zero warnings
  • npm run test passes — all existing tests still pass with default config values, new test with defaultBaseBranch: 'main' passes

Risks#

  • Dependency on #348: TenantConfigService and TenantModule must exist before implementation. If #348 is not yet merged into rc/multi-tenant, this task is blocked.
ContextPrd