You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: CLI hide accepted invitations from zitadel invitation list and name the invitation before cancelling - #3176
Replaces #3083, which could not leave its stack. The analytics now stack on top of this one.
Summary
Hides accepted invitations from zitadel invitation list by default, as the console does, and reads an invitation before zitadel invitation cancel asks to cancel it (#2853).
invitation list: --status is repeatable and defaults to pending, expired and rejected; the server filters, so paging stays exact. The footer, or the empty message when nothing is left, says accepted invitations are left out and how to list them.
invitation cancel: reads the invitation first, so the question names who it is for and its role, and an accepted or expired invitation fails with E_VALIDATION before anything is asked. Without an id it picks from pending and declined invitations; a declined one is removed with its own wording.
The API reference's CLI sample spells one --status per status, and names every status for an unfiltered list.
Hand-written commands over the invitations contract (#2849), in a new
Project administration help group. The link appears only in create's
output; telemetry records the role and whether it replaced one.
Refs #2858
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The CLI loads commands from an explicit COMMANDS table, so the
invitation commands were unreachable and missing from the reference
and the docs. Adds the topic and its help group row.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implements the CLI half of #2859 (ADR 086 §9): after the API confirms a
create or replace, the command sends invitation_created with role and
invitation_journey_id through a new BaseCommand.trackEvent, replacing
the role/is_replace dimensions. The catalog lists the CLI event as
emitted and the console's three invitation events as planned, and a
catalog test holds every trackEvent call's properties to the catalog.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ADR 086 gains a dated amendment: a cancelled journey ended at
invitation_created and read as one nobody opened. invitation cancel now
reads the invitation before confirming, names it in the question,
refuses one that is no longer pending, and sends invitation_cancelled
with role and invitation_journey_id after the delete. The catalog lists
it emitted for the CLI and planned for the console.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A dry run now answers with the request it would send. --replaces reads
the original first: an accepted one is refused before anything is
asked, and a replacement without --name keeps the original's name, as
the server does. The name prompt asks one question, and list gains a
unit test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A dry run of invitation cancel <id> now reads nothing: the read that
names the invitation in the question moves into prepare. Also lists the
amendment in the ADR index, fixes the telemetry page's grammar, and
adds a changeset for the invitation events.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- create --dry-run answers before connecting or reading the original.
- cancel --dry-run needs the id instead of reading the pending list.
- The printed link and the picker's hints are escaped for the terminal.
- --name counts characters, as the API's maxLength does.
- The API reference's CLI samples spell invitation create and list
with their flags, and fall back to the api call for team invitations.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A non-interactive run, like a dry run, now refuses an omitted id before
reading the pending list, so a down server cannot hide the missing
input. Regenerates the CLI README, which lacked the invitation commands.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-ups and retries are { id, flags } suggestions, refusals take no
suggester, list declares --all's exclusion through relatedFlags, and its
page carries only the token. Regenerates the CLI README.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Lookup names the inviter; decline refuses the inviter (inv.self_reject) and
accept a creator who lost admin (inv.inviter_not_admin). Invitations carry
rejected_at and keep metadata on decline, cancel removes a declined one, and
the list takes a repeatable status filter and expand=inviter. Amends ADR 086.
The redeem handlers stay stubs, and the list answers 501 for several statuses
or expand, until the implementation lands.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No guard in the server limits lookup, accept or reject; the edge does, so
per ADR 078 §7 they declare no 429. Amends ADR 086.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…onded_at
One who and when for accept and decline; status says which. Replaces
accepted_by, accepted_at and rejected_at, and amends ADR 086.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main replaced literalKeys with keysOf and bans let, so the product-event
check uses keysOf and finds an event's const without a mutable binding.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follows the contract in #3072: --status is repeatable and defaults to
every status but accepted, as the console does; invitation get reports
responded_by and responded_at; invitation cancel also removes a declined
invitation, without sending invitation_cancelled for it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- create --replaces reads the original before any question, and a dry
run reads it too, so an accepted one is refused the same way in both.
- The invitation id schema has one home (invitation/id.ts); the name
limit and the list's statuses and types come from the generated
schema; refusals are declared as const satisfies.
- Unit tests for the invitation service, and for create's and cancel's
questions, refusals and the requests they do not send.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A named pending or declined invitation is asked about by who it is for,
its role and what the cancel does to it; an accepted or expired one is
refused with E_VALIDATION before anything is asked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The new release note should be folded into the existing pending changeset to follow repository policy and avoid publishing an outdated pending-only picker description.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Update the existing pending changeset instead of adding a second
.changeset/cli-invitation-list-contract.md:5
Please fold this release note into the existing pending .changeset/cli-invitation-commands.md instead of adding a second changeset. .changeset/README.md:79–81 requires follow-ups to unreleased changes to update their pending entry; keeping both also publishes the older pending-only picker description alongside this update. Retain the existing minor bump and update its summary with the new list and cancellation behavior.
The reason will be displayed to describe this comment to others. Learn more.
Looked at this as a fresh read of the diff against the repo and its AGENTS.md files. The behaviour is right and CI is green. These are the gaps worth closing, mostly around tests and a few places that will drift.
The reason will be displayed to describe this comment to others. Learn more.
The question now embeds metadata.name, which is whatever another administrator typed, and the non-interactive E_CONFIRMATION_REQUIRED refusal carries the same question in its hint and details.question. invitation-list.spec.ts and invitation-get.spec.ts both run servesAHostileInvitation through inEveryRendering, but invitation-cancel.spec.ts only runs it on a plain invitation, so nothing proves this new path stays free of control characters in any rendering. The mock needs a DELETE that honours the hostile invitation too, or a cancel-specific variant of the helper. Worth a spec before merge.
The reason will be displayed to describe this comment to others. Learn more.
A dry run with a named id never reaches this prepare, so cancel inv_x --dry-run on an accepted or expired invitation answers ok with a dry-run result, and the real run then refuses with E_VALIDATION. That is the same hole as the dry-run-predicts-refusals idea; fine to defer, but say so in the description so it is a known limit and not a surprise.
The reason will be displayed to describe this comment to others. Learn more.
target is a string or an Invitation, and the typeof target === "string" check is repeated here and again in prepare. Resolving it once into the same shape ({ id, invitation? }, or reading the named one lazily behind one helper) would drop both branches.
The reason will be displayed to describe this comment to others. Learn more.
The pair ["pending", "rejected"] is written out six times across this file and InvitationService.cancellable(), plus the !== "pending" && !== "rejected" test in readCancellable. One CANCELLABLE_STATUSES const (typed readonly InvitationStatus[], with a includes check in readCancellable) keeps the picker, the refusals, the hints and the guard from drifting apart when the server's rule changes.
The reason will be displayed to describe this comment to others. Learn more.
This refusal is shared by accepted and expired, but its next lists pending and rejected invitations, which does not help someone who just hit an expired one. For expired the actionable step is invitation create --replaces <id> (ADR 086 revokes an expired original and creates again), and for accepted it is grant list. A per-status next, or at least a hint that says an expired invitation keeps its row until it is replaced, would turn a dead end into a path.
The reason will be displayed to describe this comment to others. Learn more.
The picker hint and the questions say "declined", while invitation list prints rejected in its status column and --status only accepts rejected. Someone who picks the declined row here, then looks for it with list, sees a different word. Either use rejected here or add "declined" to the --status rejected description in list.ts.
The reason will be displayed to describe this comment to others. Learn more.
The default now drops accepted invitations, but only the human rendering says so (empty and footer). A script running invitation list --json gets a subset with nothing in the envelope to say a filter was applied, and a script that counted all invitations changes meaning silently. Consider echoing the applied statuses in data (or a warning when it defaulted) so the envelope states what it filtered. The same default also leaves invitation get's hint ("Find one with zitadel invitation list") unable to find an accepted invitation, which get reads.
The reason will be displayed to describe this comment to others. Learn more.
Listing everything now needs four repeated flags, and this constant, the invitationIds test helper and the footer message all spell that out by hand. A --status all (or --include-accepted) would remove all three: the sample could say --status all, the helper could use it, and the footer would point at one flag. If you would rather not add a value, deriving the list from the operation's status enum at least keeps this from drifting when the API gains a status.
The reason will be displayed to describe this comment to others. Learn more.
apps/cli/tests/AGENTS.md says wording is asserted in a unit test and a spec "asserts that the command refused, never the words", and a spec uses the matcher vocabulary in matchers.ts, not result.stderr.toContain. The empty message and footer wording (and the OPEN_STATUSES default) belong in tests/unit/cli/commands/invitation/list.test.ts, which this PR does not touch. The spec can keep the observable claim, that accepted invitations stay out of the list, with toPrint/toSay.
The reason will be displayed to describe this comment to others. Learn more.
Approving. I read the full diff against the repo and its AGENTS.md files, and CI is green.
What I checked and found sound: invitation list defaults to pending, expired and rejected and the server does the filtering, so paging stays exact. The empty message and footer both say accepted invitations are left out and how to list them. invitation cancel reads the invitation before it asks, so the question names who it is for and its role, and an accepted or expired invitation is refused with E_VALIDATION before anything is asked. This matches ADR 086's rule that cancel deletes a pending or rejected invitation and an expired one keeps its row, and the mock's DELETE answers the same way. The picker offers pending and declined invitations, the next suggestions and hints all carry the repeated --status, and SKILL.md, the README, the command reference, the docs sample and the changeset are updated together.
The inline comments from my earlier review stand. None blocks the merge, but these are the ones I would pick up first, in this PR or right after: a hostile-name case in the cancel spec, since the question now embeds metadata.name; moving the empty-message and footer wording out of the spec and into list.test.ts; and one CANCELLABLE_STATUSES const in place of six copies of the pending/rejected pair. The dry-run limit (a named id is not read, so it cannot predict the refusal) is worth a line in the description as a known limit.
Nothing here changes the behaviour the PR sets out to deliver.
The question embeds an invitation's name, which another administrator
typed. The cancel spec now runs a hostile name through every rendering,
asking and forced, and checks the non-interactive refusal spells it out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces #3083, which could not leave its stack. The analytics now stack on top of this one.
Summary
Hides accepted invitations from
zitadel invitation listby default, as the console does, and reads an invitation beforezitadel invitation cancelasks to cancel it (#2853).invitation list:--statusis repeatable and defaults topending,expiredandrejected; the server filters, so paging stays exact. The footer, or the empty message when nothing is left, says accepted invitations are left out and how to list them.invitation cancel: reads the invitation first, so the question names who it is for and its role, and an accepted or expired invitation fails withE_VALIDATIONbefore anything is asked. Without an id it picks from pending and declined invitations; a declined one is removed with its own wording.--statusper status, and names every status for an unfiltered list.@zitadel/clichangeset.🤖 Generated with Claude Code