Plan — MT-1: PlatformProvider Interface + GitHubPlatformProvider#
Summary#
Create the PlatformProvider abstraction interface mirroring the GitHubService public API, implement GitHubPlatformProvider as a thin delegation wrapper, and wire both into a new PlatformModule. This is a pure additive change — no existing files are modified.
Files#
| File | Action | Description |
|---|---|---|
src/platform/platform-provider.interface.ts | create | PlatformProvider interface + PLATFORM_PROVIDER injection token symbol |
src/platform/github/github-platform.provider.ts | create | GitHubPlatformProvider class — injects GitHubService, delegates all calls |
src/platform/platform.module.ts | create | NestJS module — imports GitHubModule, provides/exports PLATFORM_PROVIDER |
src/platform/github/github-platform.provider.spec.ts | create | Unit tests verifying every method delegates to the GitHubService mock |
Steps#
- Read
src/github/github.service.tsand extract all public method signatures (17 methods across IssueOps, LabelOps, PullRequestOps, BranchOps, ProjectOps, FileOps groups). - Create
src/platform/platform-provider.interface.ts— definePLATFORM_PROVIDER = Symbol('PLATFORM_PROVIDER'),PlatformProviderinterface withreadonly platform: stringand all 17 method signatures. MarksetProjectItemStatusas optional (?). - Create
src/platform/github/github-platform.provider.ts—@Injectable()class implementingPlatformProvider, constructor-injectingGitHubService, settingplatform = 'github', and delegating every method withreturn this.github.<method>(...). - Create
src/platform/platform.module.ts— importGitHubModule, register{ provide: PLATFORM_PROVIDER, useClass: GitHubPlatformProvider }, exportPLATFORM_PROVIDER. - Create
src/platform/github/github-platform.provider.spec.ts— mockGitHubService, instantiateGitHubPlatformProvider, verify each of the 17 methods calls the corresponding mock method with correct args and returns its result.
Verification#
npx tsc --noEmitpasses with zero errorsnpm run lintpasses with zero warningsnpm run test -- --testPathPattern=platform— all delegation tests pass
Risks#
- Signature drift: If
GitHubServicegains new methods before this PR merges, the interface will be incomplete. Mitigation: verify against the latestrc/multi-tenantHEAD at implementation time.