[showcase] Add flags unarchive command - #3
Conversation
CodeBoarding reviewStatus: 2 changed components See the full change in CodeBoarding. graph LR
n_CLI_Core_Orchestration["CLI Core #38; Orchestration"]
n_Python_Serverless_Runtime["Python Serverless Runtime"]
n_Python_Package_Distribution["Python Package Distribution"]
n_Local_Development_Execution["Local Development #38; Execution"]
n_Rust_Serverless_Runtime["Rust Serverless Runtime"]
n_Build_Utilities_Resource_Management["Build Utilities #38; Resource Management"]
n_Infrastructure_Proxy_Services["Infrastructure #38; Proxy Services"]
n_Build_Tooling_Binary_Distribution["Build Tooling #38; Binary Distribution"]
n_CLI_Core_Orchestration -- "orchestrates local emulation" --> n_Local_Development_Execution
n_CLI_Core_Orchestration -- "resolves project configuration" --> n_Build_Utilities_Resource_Management
n_Python_Serverless_Runtime -- "defines deployment artifacts via Lambda abstrac…" --> n_Build_Utilities_Resource_Management
n_Python_Package_Distribution -- "provides runtime dependencies and wheels" --> n_Python_Serverless_Runtime
n_Local_Development_Execution -- "utilizes IPC proxy for cross-language request r…" --> n_Infrastructure_Proxy_Services
n_Rust_Serverless_Runtime -- "standardizes build outputs and error reporting" --> n_Build_Utilities_Resource_Management
n_Build_Tooling_Binary_Distribution -- "packages executable binaries" --> n_CLI_Core_Orchestration
n_CLI_Core_Orchestration -- "queries framework metadata for project initiali…" --> n_Infrastructure_Proxy_Services
n_Infrastructure_Proxy_Services -- "dispatches requests to Python ASGI/HTTP handlers" --> n_Python_Serverless_Runtime
classDef added fill:#1f883d,stroke:#0b5d23,color:#ffffff;
classDef modified fill:#bf8700,stroke:#7d4e00,color:#ffffff;
classDef deleted fill:#cf222e,stroke:#82071e,color:#ffffff,stroke-dasharray:5 3;
class n_CLI_Core_Orchestration modified;
linkStyle 1 stroke:#0b5d23,stroke-width:2px;
linkStyle 0,6 stroke:#7d4e00,stroke-width:2px;
linkStyle 7,8 stroke:#82071e,stroke-width:2px,stroke-dasharray:5 3;
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9b9494f690
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| if (!skipConfirmation) { | ||
| if (!client.stdin.isTTY) { |
There was a problem hiding this comment.
Respect non-interactive mode before confirming
When client.nonInteractive is true because the caller explicitly passed global --non-interactive but stdin is still a TTY, this condition is false and the command invokes client.input.confirm(). This breaks the global flag's contract and can leave pseudo-TTY automation waiting for input; treat client.nonInteractive as non-prompting and report the missing --yes flag.
AGENTS.md reference: packages/cli/AGENTS.md:L98-L98
Useful? React with 👍 / 👎.
| output.success(`Feature flag ${chalk.bold(flag.slug)} has been archived`); | ||
| output.log( | ||
| `\nTo restore this flag, visit the dashboard: ${chalk.cyan(getFlagsDashboardUrl(link.org.slug, project.name) + '/archive')}` | ||
| `\nTo unarchive this flag, run ${getCommandName(`flags unarchive ${flag.slug}`)}` |
There was a problem hiding this comment.
Preserve --project in the unarchive suggestion
When flags archive ... --project B is run from a directory linked to project A—or from an unlinked directory—the new next-step command drops --project B. Copying it therefore targets a same-named flag in A or fails as unlinked instead of undoing the archive in B; construct the suggestion with the explicit/resolved project and relevant global targeting flags.
AGENTS.md reference: packages/cli/AGENTS.md:L15-L18
Useful? React with 👍 / 👎.
| } | ||
|
|
||
| const confirmed = await client.input.confirm( | ||
| `Are you sure you want to unarchive ${chalk.bold(flag.slug)}?`, |
There was a problem hiding this comment.
Show the resolved project before confirmation
When no --project is supplied and the cwd has a stale or unexpected link, this prompt names only the flag and gives the user no indication which resolved project will be mutated. Confirming can consequently reactivate the flag in the wrong project; print the resolved project/team before asking for confirmation.
AGENTS.md reference: packages/cli/AGENTS.md:L15-L18
Useful? React with 👍 / 👎.
| } | ||
|
|
||
| output.spinner('Unarchiving flag...'); | ||
| await updateFlag(client, project.id, flagArg, { |
There was a problem hiding this comment.
Disable retries for the unarchive mutation
When the API applies this PATCH but its response is lost, or it returns a retryable 5xx after committing, Client.fetch() retries the request up to 3 times by default. Each flag PATCH creates a new revision/message—the mock handler likewise increments revision on every call—so one unarchive can create duplicate history entries even though the final state is unchanged; issue this remote mutation without automatic retries or add a server-supported idempotency mechanism.
AGENTS.md reference: packages/cli/AGENTS.md:L102-L102
Useful? React with 👍 / 👎.
Showcase context
Exact patch reproduction of vercel/vercel#17332.
This medium-sized CLI feature adds
vercel flags unarchiveacross command registration, execution, telemetry, help snapshots, unit tests, and a package changeset.The synthetic base contains the CodeBoarding workflow with this upstream patch removed; this head reapplies the exact upstream diff.