Skip to content

feat(form,team,kudos): forms lifecycle + team-aware kudos#20

Merged
xergioalex merged 3 commits into
mainfrom
feat/forms-lifecycle-teams
May 26, 2026
Merged

feat(form,team,kudos): forms lifecycle + team-aware kudos#20
xergioalex merged 3 commits into
mainfrom
feat/forms-lifecycle-teams

Conversation

@xergioalex
Copy link
Copy Markdown
Member

Summary

Implements the api-services cross-repo handoff for the forms-response lifecycle and team-aware kudos. Three additive workstreams on dailybot:

  • Forms lifecycle. Extends dailybot form with get, responses, response get, update, transition, delete so a coding agent can drive any form — including workflow-enabled ones — end-to-end after dailybot login.
  • Teams. New dailybot team list / dailybot team get [--with-members] consuming GET /v1/teams/. Visibility is scoped server-side by role (admins see all org teams, members see only their own). The CLI never client-filters.
  • Team-aware kudos. dailybot kudos give accepts --to, --team, or both. Payload migrated from receivers to user_uuid_receivers + team_uuid_receivers per the new api-services contract.

Surface added

Command Endpoint
dailybot form get <uuid> GET /v1/forms/<uuid>/
dailybot form responses <uuid> [--state] [--latest] GET /v1/forms/<uuid>/responses/
dailybot form response get <uuid> <resp> GET /v1/forms/<uuid>/responses/<resp>/
dailybot form update <uuid> <resp> --content '{...}' PATCH …/responses/<resp>/
dailybot form transition <uuid> <resp> <state> [--note] POST …/responses/<resp>/transition/
dailybot form delete <uuid> <resp> DELETE …/responses/<resp>/
dailybot team list GET /v1/teams/
dailybot team get <uuid_or_name> [--with-members] GET /v1/teams/<uuid>/ + …/members/
dailybot kudos give --team <name_or_uuid> POST /v1/kudos/ (new payload)

Error-code mapping

APIError now carries the code from {detail, code} 4xx bodies. exit_for_api_error maps every server code from the handoff to a friendly message + structured exit code:

  • form_response_change_state_forbidden, final_state_locked, form_response_delete_forbidden, user_can_not_see_form_responses → 403 → exit 4
  • form_response_not_found, form_does_not_exists → 404 → exit 5 (new EXIT_NOT_FOUND)
  • payload_too_large, no_valid_team, no_valid_users, no_users_found → 400 → exit 2

--json output surfaces error, status, code, and detail so chat-agent consumers can pattern-match on the structured shape.

Tests

  • 24 new tests across tests/api_client_test.py and tests/public_api_commands_test.py covering: form get / responses (state filter + latest) / response get (404) / update / transition (forbidden + final_state_locked) / delete (forbidden); team list / team get / team get --with-members; kudos give --team / kudos give --to + --team / kudos give --team unseen-team / kudos give without --to or --team.
  • Existing kudos test migrated to the user_uuid_receivers / team_uuid_receivers payload shape.
  • ruff check, ruff format --check, mypy dailybot_cli — all clean.
  • 182/182 new + touched tests pass. The 11 pre-existing failures in commands_test.py exist on bare main (unrelated CLI Agent vs CLI agent-name resolution).

Live validation

Verified against the local api-services dev server (http://djangovscode:8000) via clitest-local:

  • dailybot login → multi-org selection works (XergioAleXDailyBot selected).
  • dailybot team list → returns General, Tech, Product (admin view).
  • dailybot user list → returns the 4 org members.
  • dailybot form list → returns all 6 org forms.
  • dailybot form get, form submit, form response get, form update, form transition exercised end-to-end on the "Code Release Form" (65de0ec6-…). Response 04dbefcf-… walked null → pre_release → qa → code_review with notes; workflow surface (current_state, allowed_transitions, state_history) rendered correctly after every mutation.

Docs

  • README.md — new sections for form get / responses / response get / update / transition / delete, the team commands, team-aware kudos, the workflow-state vocabulary, and the structured-code JSON mode.
  • AGENTS.md (≡ CLAUDE.md) — project overview now covers forms-lifecycle, workflow states, team browsing, team-aware kudos. Endpoint list extended. Project Structure tree shows all per-command files.
  • docs/API_REFERENCE.md — every new subcommand documented with its endpoint, options, and the full server-code error table.
  • docs/PRODUCT_SPEC.md — feature matrix split out per new command.
  • docs/CLI_COMMAND_BEST_PRACTICES.md — note on short-alias per-command scoping.
  • docs/DISPLAY_OUTPUT_BEST_PRACTICES.md — 7 new specialized renderers documented.
  • docs/TESTING_GUIDE.md — coverage expectations: happy + error path per code + JSON-mode shape; "no legacy receivers key" rule.
  • docs/TROUBLESHOOTING.md — new Forms & Workflow + Teams & Kudos sections covering every server code, plus a Form-response Markdown: supported subset entry (only single-level # headings render; real \n newlines required; rest of the inline + block features documented).

Risks

  • The /v1/kudos/ payload no longer includes the legacy receivers field. Coordinated with api-services per the cross-repo handoff — backend is fully ready.
  • No new env variables, no new Python dependencies, no Homebrew formula changes.
  • No changes to auth resolution or repo-profile behavior.
  • Backward compatible across all stored files (agents.json, config.json, credentials.json, .dailybot/profile.json) — no schema changes.

Release notes

  • Release order: this CLI PR must land after the api-services PRs (#7078, #8589, #3067) are deployed — those endpoints are required at runtime.
  • auto-release.yml will cut the next bump automatically on merge per default_bump_level = 2 in pyproject.toml.
  • Post-release: ping the agent-skill repo so forms/SKILL.md can re-test end-to-end against the new CLI version.

Test plan

  • dailybot form get <uuid> renders questions + workflow states.
  • dailybot form responses <uuid> --latest --json returns at most one response.
  • dailybot form transition maps form_response_change_state_forbidden (exit 4) and final_state_locked (exit 4).
  • dailybot team list returns admin's all-teams set; member view scoped server-side.
  • dailybot kudos give --team "Tech" posts with team_uuid_receivers.
  • dailybot kudos give --to "X" --team "Y" posts both arrays.
  • dailybot form delete honors author / owner / admin invariant.

🤖 Generated with Claude Code

xergioalex and others added 3 commits May 26, 2026 17:59
## Summary
Adds the full forms-response lifecycle to `dailybot form` (get, responses,
response get, update, transition, delete) and introduces `dailybot team
list / get` plus `dailybot kudos give --team` so agents can drive any
form — including workflow-enabled ones — and credit entire teams in a
single kudos call.

## Change Log
- api_client.py
  - New methods: list_form_responses, get_form_response, update_form_response,
    transition_form_response, delete_form_response, list_teams, get_team,
    list_team_members.
  - give_kudos payload switched from `receivers` to
    `user_uuid_receivers` + `team_uuid_receivers` per the api-services
    contract.
  - APIError now carries the structured `code` from {detail, code} 4xx
    bodies.
- commands/form.py
  - New subcommands: get, responses, response get, update, transition,
    delete. Each one prints the workflow-state surface (current_state,
    allowed_transitions, can_change_state, state_history) after every
    mutating call.
- commands/team.py (new)
  - team list / team get [--with-members]. Resolves by UUID or
    case-insensitive name. The CLI never client-filters — server scoping
    (admin sees all, member sees own) is rendered verbatim.
- commands/kudos.py
  - `kudos give` accepts `--to`, `--team`, or both. Self-kudos still
    rejected client-side. Either receiver list resolves to the new
    payload shape.
- commands/public_api_helpers.py
  - ERROR_CODE_MESSAGES table mapping server-side codes
    (form_response_change_state_forbidden, final_state_locked,
    form_response_delete_forbidden, user_can_not_see_form_responses,
    form_response_not_found, form_does_not_exists, payload_too_large,
    no_valid_team, no_valid_users, no_users_found).
  - exit_for_api_error now handles 404 (EXIT_NOT_FOUND=5) and 400, and
    JSON mode surfaces `code` + `detail` alongside `status`.
  - resolve_team_by_name_or_uuid helper mirroring the user resolver,
    surfacing the team-scoping reality on miss.
- display.py
  - Helpers for form detail, response state surface, responses table,
    response detail, teams table, team detail.
- Tests: 24 new tests across api_client_test.py + public_api_commands_test.py
  covering forms lifecycle, teams, team-kudos, and code-based 4xx mapping.
  Existing kudos test migrated to the new payload shape.
- README + docs/API_REFERENCE: new commands, options, error-code table,
  HTTP endpoint table.

## Risks
- Behavioral change for /v1/kudos/: the CLI no longer sends the legacy
  `receivers` field. Coordinated with api-services per handoff.
- Auth resolution + repo profile behavior unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
## Summary
Expands the documentation set so AI agents and human installers can
discover and use the new commands without reading the source.

## Change Log
- AGENTS.md (also reachable as CLAUDE.md via the existing symlink)
  - Project overview now mentions forms-lifecycle, workflow states,
    team browsing, and team-aware kudos for both humans and agents.
  - Endpoint list extended (`/v1/forms/*`, `/v1/teams/*`, `/v1/kudos/`).
  - Project Structure documents the per-command files (checkin, form,
    team, kudos, user, public_api_helpers, user_scoped_actions).
  - tests/ tree shows the modules covering the new surface.
- docs/PRODUCT_SPEC.md
  - Human-facing feature matrix split out: form get / responses /
    response get / update / transition / delete; team list / get;
    kudos --to | --team | both.
- docs/CLI_COMMAND_BEST_PRACTICES.md
  - Clarifies that short aliases are scoped per command, not globally
    (-m and -c are reused legitimately across groups).
- docs/DISPLAY_OUTPUT_BEST_PRACTICES.md
  - Specialized-renderer table extended with print_form_detail,
    print_form_response_state, print_form_responses_table,
    print_form_response_detail, print_form_response_deleted,
    print_teams_table, print_team_detail.
- docs/TESTING_GUIDE.md
  - Test-tree section reflects the actual files under tests/.
  - Adds coverage expectations for forms-lifecycle (happy path,
    error-path per server code, JSON-mode shape) and team-kudos
    (the legacy `receivers` key MUST NOT appear).
- docs/TROUBLESHOOTING.md
  - New "Forms & Workflow" section: 403 forbidden, final_state_locked,
    404 not_found, delete forbidden, --latest empty, Markdown
    newlines-in-content guidance.
  - New "Teams & Kudos" section: role-scoping reality, "team not
    visible" error, self-team kudos, no_valid_users / no_valid_team.

## Risks
None — docs-only.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The form-response webapp renders a constrained Markdown subset — only
single-level `#` headings, with multi-level (`##`, `###`) falling
through as plain text. Document the supported features so agents
authoring `--content` for `form submit` / `form update` don't ship
broken-looking renderings.

Includes a quick CLI-side smoke-check using `form response get --json |
jq` to confirm newlines and heading levels round-tripped correctly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@xergioalex xergioalex merged commit cc594b6 into main May 26, 2026
4 checks passed
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