Skip to content

feat(jtk): add users get subcommand#189

Merged
rianjs merged 1 commit intomainfrom
feat/176-users-get
Mar 28, 2026
Merged

feat(jtk): add users get subcommand#189
rianjs merged 1 commit intomainfrom
feat/176-users-get

Conversation

@rianjs
Copy link
Copy Markdown
Contributor

@rianjs rianjs commented Mar 28, 2026

Summary

  • Add jtk users get <account-id> to look up a user by account ID
  • Displays account ID, name, email, and active status
  • Supports JSON output via -o json
  • The api.GetUser() method already existed; this adds the CLI command

Closes #176

Test plan

  • Unit tests for table, JSON, and inactive user output
  • make build && make test passes

Look up a user by their Jira account ID:

  jtk users get 61292e4c4f29230069621c5f

Returns display name, email, account ID, and active status.
The API method already existed; this adds the CLI command.

Closes #176
Copy link
Copy Markdown

@monit-reviewer monit-reviewer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated PR Review

Reviewed commit: d91066d

Approved with 2 non-blocking suggestions below. Address at your discretion.

Summary

Reviewer Findings
security:code-auditor 2
security:code-auditor (2 findings)

💡 Suggestion - tools/jtk/internal/cmd/users/users_test.go:109

TestRunGet_InactiveUser only asserts Contains(stdout, "no"), which is fragile — it would match any occurrence of "no" in the output (e.g., a display name like "Arnold Nolan"). Consider asserting a more specific substring like "Active: no" to avoid false positives. The existing search tests at line 245 have the same weakness, but this PR has the opportunity to set a better pattern.

💡 Suggestion - tools/jtk/internal/cmd/users/users_test.go:17

newTestUserServer ignores the HTTP request entirely (path, query params, method). The test verifies display formatting but does not confirm that runGet passes the correct account ID to the API. A minimal check on the request URL (e.g., asserting r.URL.Query().Get("accountId") == expectedID) would catch regressions in argument propagation.


Completed in 9m 41s | $1.27
Field Value
Reviewers hybrid-synthesis, database:sql-reviewer, security:code-auditor, harness-engineering:knowledge-reviewer, harness-engineering:enforcement-reviewer, harness-engineering:architecture-reviewer, harness-engineering:legibility-reviewer
Reviewed by pr-review-daemon · monit-pr-reviewer
Duration 9m 41s (Reviewers: 3m 03s · Synthesis: 1m 13s)
Cost $1.27
Tokens 971.5k in / 34.6k out
Turns 73

err = runGet(context.Background(), opts, "abc123")
testutil.RequireNoError(t, err)

testutil.Contains(t, stdout.String(), "no")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Low (security:code-auditor): TestRunGet_InactiveUser only asserts Contains(stdout, "no"), which is fragile — it would match any occurrence of "no" in the output (e.g., a display name like "Arnold Nolan"). Consider asserting a more specific substring like "Active: no" to avoid false positives. The existing search tests at line 245 have the same weakness, but this PR has the opportunity to set a better pattern.

"github.com/open-cli-collective/jira-ticket-cli/internal/cmd/root"
)

func newTestUserServer(_ *testing.T, user api.User) *httptest.Server {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Low (security:code-auditor): newTestUserServer ignores the HTTP request entirely (path, query params, method). The test verifies display formatting but does not confirm that runGet passes the correct account ID to the API. A minimal check on the request URL (e.g., asserting r.URL.Query().Get("accountId") == expectedID) would catch regressions in argument propagation.

@rianjs rianjs merged commit 4b544e8 into main Mar 28, 2026
7 checks passed
@rianjs rianjs deleted the feat/176-users-get branch March 28, 2026 18:39
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.

feat(jtk): add users get subcommand

2 participants