Skip to content

feat: add team CRUD commands (get, create, update, delete)#7

Merged
debidong merged 5 commits into
mainfrom
feat/team-crud
May 14, 2026
Merged

feat: add team CRUD commands (get, create, update, delete)#7
debidong merged 5 commits into
mainfrom
feat/team-crud

Conversation

@debidong
Copy link
Copy Markdown
Collaborator

Summary

  • Add full team management CLI commands: team get, team create, team update, team delete
  • Enhance existing team list with --limit, --orderby, --asc, --person-id flags
  • All commands support both table and --json output formats
  • New shared helpers: WriteResultJSON (structured JSON for write ops), confirmAction (interactive delete confirmation), requireExactlyOneFlag (mutual exclusivity validation)

New Commands

Command Description
team get --id/--name/--ref-id View full team detail with member names
team create --name [opts] Create a new team
team update --id [opts] Update team (WARNING: --person-ids replaces members)
team delete --id/--name/--ref-id Delete team with confirmation prompt

SDK Dependency

Requires flashduty-sdk feat/team-crud which adds:

  • GetTeamInfo, UpsertTeam, DeleteTeam methods
  • TeamItem, TeamGetInput, TeamUpsertInput, TeamDeleteInput types
  • Enhanced ListTeamsInput with Limit/OrderBy/Asc/PersonID
  • OrderBy validation and limit capping

Code Review Findings Addressed

  • Restructured GetTeamInfo for real parallelism (both API calls in errgroup)
  • Added limit capping (max 100) and OrderBy validation in SDK
  • Fixed UpsertTeam to not send empty team_name on updates
  • confirmAction uses cmd.InOrStdin() for testability
  • Delete confirmation moved inside runCommand for consistent error handling

Test plan

  • go test -race ./... passes in both SDK and CLI repos
  • Go code review completed -- all HIGH and MEDIUM issues resolved
  • Manual test: flashduty team list
  • Manual test: flashduty team list --json
  • Manual test: flashduty team get --id <id>
  • Manual test: flashduty team get --id <id> --json
  • Manual test: flashduty team create --name "Test Team"
  • Manual test: flashduty team update --id <id> --description "new"
  • Manual test: flashduty team delete --id <id> (confirm + abort)
  • Manual test: flashduty team delete --id <id> --force
  • Verify --help text is clear on all subcommands

debidong added 5 commits May 14, 2026 11:56
Add full team management CLI commands with both table and JSON output:

- team get: view team detail by --id, --name, or --ref-id
  Parallel /team/info + /team/infos for full metadata with member names
- team create: create team with --name, --description, --person-ids, --emails
- team update: update team by --id with any combination of fields
  Clear warning that --person-ids replaces the entire member list
- team delete: delete team with interactive confirmation prompt
  Supports --force to skip confirmation
- team list: enhanced with --limit, --orderby, --asc, --person-id flags

New shared helpers:
- WriteResultJSON: structured JSON for write operations
- confirmAction: interactive delete confirmation using cmd.InOrStdin()
- requireExactlyOneFlag: mutual exclusivity validator for identifier flags

Depends on flashduty-sdk feat/team-crud branch.
The API requires team_name on every upsert call. When updating a team
without --name, fetch the current team name first so it's preserved.
Previously, confirmAction returned true when stdin was not a TTY,
allowing destructive deletes to proceed silently in CI/cron/pipes.
Now it returns false, requiring explicit --force for non-interactive use.
Remove the ../flashduty-sdk replace directive that breaks CI builds.
Point go.mod at the published feat/team-crud commit (dbac133) instead.
- flashduty-admin: document team get/create/update/delete commands,
  all flags, team lifecycle workflow, and member replacement warning
- flashduty-shared: add team get to reference lookups, add safety
  rules for team delete and member list replacement
@debidong debidong merged commit f06b81f into main May 14, 2026
12 checks passed
@debidong debidong deleted the feat/team-crud branch May 14, 2026 08:01
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.

1 participant