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

Plan — BJ-2: BitbucketOAuthAuthProvider#

Summary#

Add a concrete BitbucketOAuthAuthProvider that extends the AtlassianOAuthAuthProvider base (BJ-1) and wire it into a new BitbucketModule under the PLATFORM_AUTH_PROVIDER token via a factory pattern mirroring src/github/github.module.ts:14.

Files#

PathActionDescription
src/atlassian/bitbucket-oauth-auth.provider.tscreateConcrete provider: platform = 'bitbucket', token endpoint https://bitbucket.org/site/oauth2/access_token, getBotUsername() returns BITBUCKET_BOT_USERNAME.
src/atlassian/bitbucket-oauth-auth.provider.spec.tscreateUnit test covering platform id, token endpoint, bot username resolution, and missing-config error.
src/bitbucket/bitbucket.module.tscreateNestJS module with factory-registered PLATFORM_AUTH_PROVIDER gated on BITBUCKET_OAUTH_CLIENT_ID.
src/app.module.tsmodifyImport BitbucketModule alongside GitHubModule.

Steps#

  1. Implement BitbucketOAuthAuthProvider extending AtlassianOAuthAuthProvider, overriding platform, the token endpoint, and getBotUsername() (throw typed error when BITBUCKET_BOT_USERNAME missing).
  2. Create BitbucketModule with factory provider that instantiates BitbucketOAuthAuthProvider only when BITBUCKET_OAUTH_CLIENT_ID is configured; otherwise omit registration so module boots cleanly.
  3. Register BitbucketModule in app.module.ts imports array.
  4. Write unit spec: verify platform === 'bitbucket', verify getBotUsername() returns configured value and throws when unset, verify factory returns provider only when client id is set.
  5. Run npm run lint and npm run test to confirm zero warnings and all specs pass.

Verification#

  • npm run test — new provider spec green, existing suite unchanged.
  • npm run lint — zero warnings (strict mode).
  • npm run build — compiles with no TypeScript errors.

Risks#

  • Depends on #540 (platform union includes 'bitbucket') and #541 (AtlassianOAuthAuthProvider base class). Both are OPEN; implementation cannot merge until they land on rc/atlassian-integration. Agent will BLOCK if deps absent at exec time.
  • BITBUCKET_* env vars are not yet in the Joi config schema (BJ-4); provider will read them with config.get() but a full e2e boot needs BJ-4 to pass validation.

Open Questions#

  • Does BJ-1's base class already implement getToken() (OAuth refresh flow) such that this subclass only overrides platform / endpoint / getBotUsername()? Assumption: yes — plan treats the subclass as thin. If base class is abstract for token logic, step 1 expands to include Bitbucket-specific refresh call.
ContextPrd