Add team support: sync teamId from API, use team-based dashboard URLs#21
Add team support: sync teamId from API, use team-based dashboard URLs#21
Conversation
jschen5
commented
Mar 9, 2026
- Update API mutations to request claudeCodeTeamId from response
- Change upsertSession/upsertSessions to return UpsertResult with teamId
- Store teamId in local DB on successful sync
- Require organization for sync (getSyncConfig returns null if empty)
- Update setup to require --organization when sync is enabled
- Show team dashboard URL in report and setup output
- Update getDashboardUrl to accept teamId instead of userId
- Combine report header/footer into single branded header
|
@claude review this pr |
|
Claude finished @jschen5's task in 2m 5s —— View job PR Review: Add team support
Overall this is a clean, well-structured PR. The logic is consistent across all layers (API → sync → data store → UI), the migration is sound, and the simplified project identifier is a nice cleanup. A few issues worth addressing: Issues1.
function storeTeamId(db: Database, teamId: string | null): void {
if (teamId) {
setConfig(db, 'claude_code_team_id', teamId);
}
}If the API returns 2. Batch sync extracts teamId from first result only — fragile assumption is undocumented
teamId: result?.upsertClaudeCodeSessions?.[0]?.claudeCodeUser?.claudeCodeTeamId ?? nullThis silently assumes all sessions in a batch belong to the same user/team. That's a reasonable assumption today, but since the batch API returns an array of results (each with its own 3. Migration v6 — no test coverage The new migration is the most complex one added so far (it mutates existing data in three different ways), but there's no test for it in 4.
const organization = getConfig(db, 'claude_code_organization') ?? '';
if (!organization) return null;This is a new guard. Before this PR, This seems intentional given the setup now requires Minor Notes5. Stale test fixtures use old-format project identifiers
6.
const cols = db.prepare(`PRAGMA table_info(${table})`).all() as { name: string }[];SQLite SummaryThe PR is logically sound and the team-based dashboard URL approach is well integrated throughout the stack. The migration v6 and |
- Update API mutations to request claudeCodeTeamId from response - Change upsertSession/upsertSessions to return UpsertResult with teamId - Store teamId in local DB on successful sync - Require organization for sync (getSyncConfig returns null if empty) - Update setup to require --organization when sync is enabled - Show team dashboard URL in report and setup output - Update getDashboardUrl to accept teamId instead of userId - Combine report header/footer into single branded header