Skip to content

feat: add directory history, restore, and test commands#59

Merged
yorkable merged 2 commits into
mainfrom
feat-directory-extras
Apr 30, 2026
Merged

feat: add directory history, restore, and test commands#59
yorkable merged 2 commits into
mainfrom
feat-directory-extras

Conversation

@yorkable

Copy link
Copy Markdown
Contributor

Summary

  • Adds three missing directory subcommands matching spec endpoints: history, restore, test
  • Closes 3/15 of the gaps identified by an OpenAPI vs. CLI coverage diff
  • Mirrors the existing directoryGetCmd shape; no client-helper changes

PR 1 of 5 in the 100% coverage initiative.

Test plan

  • go test ./... passes (3 new tests: TestDirectoryHistory, TestDirectoryRestore, TestDirectoryTest)
  • go build clean
  • ./syllable directory --help shows the three new subcommands
  • ./syllable directory history --help renders
  • Live smoke against a dev/sandbox org (deferred — destructive verb on a real member would dirty the org)

🤖 Generated with Claude Code

Closes coverage gaps for three directory_member spec endpoints:
- GET /api/v1/directory_members/{id}/history
- PUT /api/v1/directory_members/{id}/restore
- GET /api/v1/directory_members/{id}/test

Each subcommand mirrors the existing directoryGetCmd shape with stubbed-HTTP tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Self-review of PR #59 caught two real bugs the test stubs didn't surface:

1. directory test missing required timestamp query param. Spec defines
   GET /api/v1/directory_members/{id}/test with timestamp (required, ISO
   8601). Live API would 422 the prior request. Added --timestamp (defaults
   to time.Now().UTC()) and --language-code (optional).

2. directory restore sent nil body. Spec defines PUT /restore with
   requestBody.required=true (DirectoryMemberRestore schema; only field is
   optional comments with default "Restored"). nil body on apiClient.Put
   skips Content-Type, so the API would reject it. Send {} by default;
   added --comments flag for the optional override.

3. directory history now exposes optional --page, --limit,
   --order-by-direction, --response-format flags so users can paginate
   like every other list command.

Tests now assert query params and body presence/Content-Type, closing
the gap that hid these bugs originally.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@yorkable
yorkable merged commit 6e5cb7c into main Apr 30, 2026
2 checks passed
@yorkable
yorkable deleted the feat-directory-extras branch April 30, 2026 23:03
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