feat: add 'atl jira assets' (CMDB count + AQL)#59
Conversation
Adds an assets command group under 'atl jira' for the Jira Service
Management Assets (CMDB) API:
- atl jira assets count — object count per schema + workspace total
- atl jira assets aql <query> — run AQL; --count paginates for an exact
total (the endpoint caps reported total at 1000)
Assets is not covered by atl's granular OAuth scopes, so the client uses
Basic auth: ATLASSIAN_API_TOKEN from the environment, with account email
and site defaulting to the current atl host and the workspace id
auto-discovered when not supplied.
Claude-Session: https://claude.ai/code/session_01UXES7yuZdhf5JJoDeiUN1a
There was a problem hiding this comment.
Code Review
This pull request introduces a new Jira Service Management Assets (CMDB) client and CLI commands (assets aql and assets count) to query the Assets workspace. The feedback highlights opportunities to optimize memory allocation by using bytes.NewReader instead of converting []byte to string, to improve context cancellation propagation by using cmd.Context() instead of context.Background(), and to avoid silently ignoring errors from config.Load().
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
- assets.go: stream request body via bytes.NewReader/io.Reader (nil when no body) instead of copying through a string - count/aql: use cmd.Context() so requests honour Ctrl+C cancellation - assets.go client(): return the config.Load() error instead of swallowing it Claude-Session: https://claude.ai/code/session_01UXES7yuZdhf5JJoDeiUN1a
Merging this branch will decrease overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. |
What & Why
Adds an
assetscommand group underatl jirafor the Jira Service Management Assets (CMDB) API. Came out of NX-15795 (the org is near the 50,005-object Assets plan limit), where we needed to read the live workspace object count and slice it by object type — there was no CLI path for that.Commands
Both support
--json.Auth
Assets is not covered by atl's granular OAuth scopes, so this uses Basic auth:
ATLASSIAN_API_TOKEN— required, read only from the environment (never written to config)--email/$ATLASSIAN_EMAIL/ current host user--workspace/$ATLASSIAN_ASSETS_WORKSPACE/ auto-discovered from the siteNote on counting
The
object/aqlendpoint caps its reportedtotalat 1000, soAQLCountpaginates and counts pages instead of trusting that field.Testing
go build,go vet,gofmt -l,golangci-lint(0 issues), and fullgo test ./...(no breakage) all clean. Verified live against the prod workspace:countreturns the per-schema breakdown + total,aql --countreturns exact subtree counts. No unit tests added yet — draft; happy to add table tests forAQLCountpagination + the auth-resolution fallback before marking ready.https://claude.ai/code/session_01UXES7yuZdhf5JJoDeiUN1a