Skip to content

Live values for existing resources, and search in popup lists - #10

Merged
someson merged 4 commits into
mainfrom
claude/wizardly-cori-v71gj6
Sep 26, 2026
Merged

someson merged 4 commits into
mainfrom
claude/wizardly-cori-v71gj6

Conversation

@someson

@someson someson commented Sep 26, 2026

Copy link
Copy Markdown
Owner

Summary

The README promises "live values from your Azure subscription — resource groups, locations, existing resources", but the form only listed what az --help marks with Values from: (locations, VM sizes, Kubernetes versions). This PR lists the user's real resources where a param names one, and makes long lists usable with search.

Changes

Existing resources as live values (internal/ui/fetch.go, model.go)

  • --resource-group in every command, and --name of az group show/delete/update/wait/export, list az group list. Never group create, where the name is new.
  • --name of an existing resource: show, delete, update, start, stop, scale, get-credentials, … of VMs, VMSS, AKS, ACR, Key Vault, storage accounts, web and function apps, App Service plans, SQL and PostgreSQL servers, Cosmos DB, Redis, VNets, NSGs, public IPs, load balancers, application gateways, Bastion, Event Hubs and Service Bus namespaces, Log Analytics workspaces. Never on create or on sub-resources (network vnet subnet show, sql db show).
  • References to another resource: --vault-name, --vnet-name, --vm-name, and, only within their family, --account-name (storage …), --server (sql db …), --plan (webapp/functionapp), --cluster-name (aks …). Outside it they mean something else (e.g. a Cosmos DB account) and get no list.
  • Context:
    • resource lists are narrowed by the form's --resource-group;
    • every values command follows the form's --subscription;
    • changing either refetches dependent resource lists immediately.
  • Superseded fetches: a fetch still in flight is superseded through Field.FetchGen, so a late result for the old context can't overwrite the new list.
  • Prefetch: resource lists load in the background when the form opens and are sorted.
  • Cache: fetched values are cached for 3 minutes in the cache dir (0700). The key is the full command; the cache is invalidated when azureProfile.json changes (az login / logout / account set).
  • Errors: "not signed in (run az login)" and "az not found" replace raw stderr.
  • Grid layout: cells show the fetch state (spinner, ▼, !), and the footer names the value count or error for the focused field.
  • Filter: leaving the / filter starts the focused field's fetch, as a cursor move does. Before, a field reached via the filter never loaded its list.

Search in popup lists (internal/ui/enum.go, view.go)

  • / in a popup starts a case-insensitive search, the same key as the form filter.
  • While searching:
    • typed characters (including j, k, q) go into the query and the arrows move;
    • the first Esc ends the search, the second closes the popup.
  • The type a value… row stays pinned. When a search finds nothing, picking it opens the editor with the query already typed, for a name that doesn't exist yet.
  • Long lists show a / filter hint; an empty result shows the query and (no matches).

Docs

  • New README section Live values.
  • The Privacy section now mentions the three-minute values cache. The previous text said only enum values were ever persisted.
  • The help overlay and README key list mention / inside popups.

Testing

  • go vet ./..., gofmt, go test -race ./... pass locally.
  • New tests with a stubbed az cover:
    • the source table, including the must-not-list cases;
    • scoping by group and subscription;
    • cache TTL and profile invalidation;
    • prefetch, refetch on context change and superseded results;
    • grid indicators;
    • popup search: narrowing, pinned row, Esc behaviour, empty result, seeded editor.
  • Driven live through a pty with the built binary and a fake az: in az vm show, picked the group by searching "weu", then the VM by searching "web". Result: az vm show --name web-02 --resource-group prod-weu --output json. The VM list was requested with --resource-group prod-weu, and a reopen made no az calls (served from the caches).
  • Not verified against a real Azure subscription: there is no az login in this environment. The list commands return the standard [{"name": …}] shape the parser already handles.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Dza8X5c3XGHUjejpqGLR8q


Generated by Claude Code

az's help carries no 'Values from:' hint for --resource-group, so the
form never listed groups. Params that always name an existing resource
now get an implicit source: --resource-group everywhere, and --name on
az group show/delete/update/wait/export (never group create, where a
new name is typed).

- Implicit lists are prefetched when the form opens and sorted, so the
  picker is usually ready when the user reaches the field.
- --subscription from the form is passed to every values command, and
  changing it drops choices fetched for the old subscription.
- Fetched values are cached on disk for 3 minutes, keyed by command and
  invalidated when az login/logout/account set rewrite
  azureProfile.json.
- 'Not signed in' and 'az not found' get a one-line explanation.
- Grid cells show the fetch state (spinner, ▼, !) and the footer names
  the count or error for the focused field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dza8X5c3XGHUjejpqGLR8q
Long lists (resource groups, locations) could only be scrolled with
j/k. '/' now starts a case-insensitive search, the same key as the
form filter: typed characters (j, k, q included) narrow the list, the
arrows move, the first Esc ends the search and the second closes the
popup. The free-text row stays pinned, and when a search finds nothing
picking it opens the editor with the query already typed. Long lists
show a '/ filter' hint in the popup; an empty result shows the query
and '(no matches)'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dza8X5c3XGHUjejpqGLR8q
--name now lists the real resources when a command acts on an existing
one (show/delete/update/start/stop/scale/get-credentials/… of VMs, AKS,
ACR, Key Vault, storage accounts, web/function apps, plans, SQL and
PostgreSQL servers, Cosmos DB, Redis, networking resources, namespaces
and workspaces) and never on create. Params that reference another
resource get the same: --vault-name, --vnet-name, --vm-name, and, only
within their family, --account-name (storage), --server (sql db),
--plan (webapp/functionapp) and --cluster-name (aks).

Resource lists are narrowed by the form's --resource-group. Changing a
context param now refetches dependent resource lists immediately, and a
fetch still in flight is superseded (FetchGen) so its late result can
no longer overwrite the list for the new context. Leaving the / filter
starts the focused field's fetch, as moving the cursor does.

README gains a Live values section, and Privacy now mentions the
three-minute values cache.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dza8X5c3XGHUjejpqGLR8q
@someson
someson merged commit 25ff1ee into main Sep 26, 2026
6 checks passed
@someson
someson deleted the claude/wizardly-cori-v71gj6 branch September 26, 2026 16:57
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.

2 participants