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

Plan: Migrate DirectiveService from GitHubService to PlatformProvider#

Summary#

Replace direct GitHubService injection in DirectiveService with the PlatformProvider interface so directive handling becomes platform-agnostic. The service uses closePR, deleteBranch (via GitHubService), and postRawComment (via raw fetch) — all three call sites migrate to PlatformProvider.

Files#

FileActionDescription
src/directive/directive.service.tsmodifySwap GitHubService → @Inject(PLATFORM_PROVIDER) platform: PlatformProvider; replace this.gitHubService.closePR/deleteBranch and postRawComment raw fetch with this.platform.* calls
src/directive/directive.module.tsmodifyImport PlatformModule instead of GitHubModule
src/directive/directive.service.spec.tsmodifyReplace GitHubService mock with PLATFORM_PROVIDER token mock; add postComment to mock surface
src/platform/platform-provider.interface.tsmodifyAdd closePR, deleteBranch, postComment if missing from interface (gap-fill per AC)

Steps#

  1. Verify PlatformProvider interface coverage — check if closePR(owner, repo, prNumber), deleteBranch(owner, repo, branch), and postComment(repo, issueNumber, body) exist on PlatformProvider. Add any missing methods to the interface and GitHubPlatformProvider implementation.
  2. Update directive.module.ts — replace GitHubModule import with PlatformModule; remove GitHubModule import statement.
  3. Update directive.service.ts — replace constructor param private readonly gitHubService: GitHubService with @Inject(PLATFORM_PROVIDER) private readonly platform: PlatformProvider. Replace all this.gitHubService.closePR/deleteBranch calls with this.platform.closePR/deleteBranch. Replace postRawComment raw fetch implementation with this.platform.postComment(repo, issueNumber, body). Remove GitHubService import and ConfigService usage for token (no longer needed for comment posting).
  4. Update directive.service.spec.ts — replace { provide: GitHubService, useValue: gitHubService } with { provide: PLATFORM_PROVIDER, useValue: platformProvider }. Add postComment to mock alongside closePR/deleteBranch. Update all assertions from gitHubService.* to platformProvider.*. Replace raw global.fetch assertions with platformProvider.postComment assertions.
  5. Verify — run tsc --noEmit, npm run lint, npm run test.

Verification#

  • grep -r "GitHubService\|GitHubModule" src/directive/ returns zero matches
  • All existing directive unit tests pass with PlatformProvider mock
  • tsc --noEmit and npm run lint pass clean

Risks#

  • Dependency on #345: PlatformProvider interface and PlatformModule must exist before implementation. If #345 hasn't merged to rc/multi-tenant, this issue is blocked.
  • postRawComment migration: Current implementation uses raw fetch with ConfigService token — migrating to PlatformProvider.postComment() changes error handling semantics slightly. The provider implementation must handle missing tokens gracefully.
ContextPrd