Skip to content

feat: add 'atl jira assets' (CMDB count + AQL)#59

Merged
Hinne1 merged 2 commits into
mainfrom
claude/atl-assets-command
Jun 24, 2026
Merged

feat: add 'atl jira assets' (CMDB count + AQL)#59
Hinne1 merged 2 commits into
mainfrom
claude/atl-assets-command

Conversation

@Hinne1

@Hinne1 Hinne1 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

What & Why

Adds an assets command group under atl jira for 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

atl jira assets count             # objects per schema + workspace total
atl jira assets aql <query>       # run AQL; lists matches (--limit), or
atl jira assets aql <query> --count   # exact total (paginates)

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)
  • account email — --email / $ATLASSIAN_EMAIL / current host user
  • workspace id — --workspace / $ATLASSIAN_ASSETS_WORKSPACE / auto-discovered from the site

Note on counting

The object/aql endpoint caps its reported total at 1000, so AQLCount paginates and counts pages instead of trusting that field.

Testing

go build, go vet, gofmt -l, golangci-lint (0 issues), and full go test ./... (no breakage) all clean. Verified live against the prod workspace: count returns the per-schema breakdown + total, aql --count returns exact subtree counts. No unit tests added yet — draft; happy to add table tests for AQLCount pagination + the auth-resolution fallback before marking ready.

https://claude.ai/code/session_01UXES7yuZdhf5JJoDeiUN1a

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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread internal/api/assets.go Outdated
Comment thread internal/cmd/assets/aql.go Outdated
Comment thread internal/cmd/assets/count.go Outdated
Comment thread internal/cmd/assets/assets.go Outdated
- 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
@Hinne1 Hinne1 marked this pull request as ready for review June 24, 2026 08:35
@Hinne1 Hinne1 merged commit 2932db6 into main Jun 24, 2026
9 checks passed
@Hinne1 Hinne1 deleted the claude/atl-assets-command branch June 24, 2026 08:35
@github-actions

Copy link
Copy Markdown

Merging this branch will decrease overall coverage

Impacted Packages Coverage Δ 🤖
github.com/enthus-appdev/atl-cli/internal/api 34.27% (-1.63%) 👎
github.com/enthus-appdev/atl-cli/internal/cmd/assets 0.00% (ø)
github.com/enthus-appdev/atl-cli/internal/cmd/jira 0.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/enthus-appdev/atl-cli/internal/api/assets.go 0.00% (ø) 68 (+68) 0 68 (+68)
github.com/enthus-appdev/atl-cli/internal/cmd/assets/aql.go 0.00% (ø) 29 (+29) 0 29 (+29)
github.com/enthus-appdev/atl-cli/internal/cmd/assets/assets.go 0.00% (ø) 32 (+32) 0 32 (+32)
github.com/enthus-appdev/atl-cli/internal/cmd/assets/count.go 0.00% (ø) 21 (+21) 0 21 (+21)
github.com/enthus-appdev/atl-cli/internal/cmd/jira/jira.go 0.00% (ø) 7 (+1) 0 7 (+1)

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.

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