Skip to content

feat(cycle): teams reconcile cycle (#7) - #25

Merged
lex00 merged 1 commit into
mainfrom
feat/teams-cycle
Jun 19, 2026
Merged

lex00 merged 1 commit into
mainfrom
feat/teams-cycle

Conversation

@lex00

@lex00 lex00 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Closes #7.

Adds the teams cycle — team tree, membership/roles, and team→repo permissions. Fourth of the npm-gate set (#5#9).

What it does

Dispatches across the three team resource types the diff already emits (team, team-member, team-repo):

  • list teams (paginated) + scope-gated sub-fetch of members/repos
  • POST/PATCH/DELETE /orgs/{org}/teams/{slug} — create/update/delete; create resolves parentTeamSlugparent_team_id
  • PUT/DELETE …/memberships/{user} — member add/role/remove
  • PUT/DELETE …/repos/{owner}/{repo} — team repo permission set/remove

Team-repo permission live-mapping prefers role_name, falling back to the highest permissions boolean.

New-team handling

diffTeams embeds members/repos inside the team create entry (it doesn't emit separate child entries for a brand-new team), so applyTeam attaches the embedded members and repos after the POST. Existing teams reconcile members/repos as their own entries.

Rename-without-loss

Adds TeamConfig.previously. Its effect is at the guardrail layer: resolveRenames collapses delete(previously)+create(slug) into one update so a rename doesn't trip removalDeltaCap. With the safe default (no ownership predicate) a rename is emitted purely as a create — the old team is left in place, nothing deleted. previously is never written to GitHub. Atomic apply-time rename is noted as a runner-level follow-up (the runner applies the raw, not rename-resolved, change set).

Verification

  • npx tsc --noEmit clean
  • npm test green (308 tests; +22 in teams.test.ts)
  • Action bundle rebuilt for the CI freshness check

🤖 Generated with Claude Code

Reconciles teams, team membership/roles, and team→repo permissions
(team / team-member / team-repo resource types). Create resolves
parentTeamSlug→parent_team_id and attaches members/repos embedded in the
new-team diff entry. Adds TeamConfig.previously so resolveRenames
collapses a rename, sparing removalDeltaCap (apply-time atomic rename is
a documented runner follow-up).

Registered, exported, action bundle rebuilt.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lex00
lex00 merged commit d9d4830 into main Jun 19, 2026
2 checks passed
@lex00 lex00 mentioned this pull request Jun 19, 2026
1 task
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.

cycle: teams

1 participant