Skip to content

fix: format the account-selection config hint consistently - #242

Merged
petebacondarwin merged 1 commit into
cloudflare:mainfrom
khoinguyenpham04:noah/cloudflare-issues-review-de6a1b
Oct 11, 2026
Merged

petebacondarwin merged 1 commit into
cloudflare:mainfrom
khoinguyenpham04:noah/cloudflare-issues-review-de6a1b

Conversation

@khoinguyenpham04

@khoinguyenpham04 khoinguyenpham04 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #42.

Summary

  • Render the tip printed after the account picker as a clack info line, wrapped to the terminal width, so it stays inside the prompt's guide
  • Indent the config snippet to the message column without guide glyphs, so copying it from the terminal yields valid TypeScript
  • When a cloudflare.config.ts already exists, name it by relative path and show only the accountId line to add
  • Emphasize only the file and property names in the tip and the account ID in the snippet, so terminals without truecolor fall back to bold cleanly
  • Omit the tip with --quiet, like cf's other tips

Before

◇  Select an account
│  Acme Corp
To have cf automatically use this account for future commands in this project, you can update your `cloudflare.config.ts`:

import { defineConfig } from "cf/config";

export default defineConfig({
  accountId: "023e105f4ecef8ad9ca31a8372d0c353",
});

│
◇  Loading [0s]

After

◇  Select an account
│  Acme Corp
│
●  To make this the project's default account, create cloudflare.config.ts:

   import { defineConfig } from "cf/config";

   export default defineConfig({
     accountId: "023e105f4ecef8ad9ca31a8372d0c353",
   });

│
◇  Loading [0s]

With an existing cloudflare.config.ts:

●  To make this the project's default account, add accountId to cloudflare.config.ts:

   accountId: "023e105f4ecef8ad9ca31a8372d0c353",

Testing

  • pnpm check
  • pnpm test src/__tests__/lib/account-hint.test.ts src/__tests__/commands/account-selection.test.ts
    • account-selection.test.ts runs cf pages list with two accounts through the real picker and snapshots the picker, tip, snippet, and command output together, with and without --quiet
    • account-hint.test.ts covers the existing-config variant and wrapping on narrow terminals, including which words stay emphasized
  • Ran cf pages list against a local API mock with several accounts: dark and light backgrounds, 256-color, 53, 60 and 100 columns, and --quiet

The tip printed after the account picker now joins clack's guide, wraps
to the terminal width, and prints its snippet indented but without
guide glyphs, so copying it from the terminal yields valid TypeScript.
When a cloudflare.config.ts already exists, the tip names that file and
shows only the accountId line to add. --quiet omits the tip.

Fixes cloudflare#42
@khoinguyenpham04
khoinguyenpham04 requested a review from a team as a code owner October 9, 2026 13:17
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Hi @khoinguyenpham04. Thanks for contributing to cf!

During the open beta, we’re being very intentional about the changes we accept so that we can prioritise stability for GA. We’re limiting pull requests to contributions coordinated with the team in advance, so this PR has been automatically closed.

We’d still love to hear about your use case, so please make sure it’s captured in a cf issue. If the proposed change fits our priorities, we’d be happy to take another look at this PR.

@github-actions github-actions Bot closed this Oct 9, 2026
@petebacondarwin

Copy link
Copy Markdown
Collaborator

Re-opening to consider this PR.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Hi @khoinguyenpham04. Thanks for contributing to cf!

During the open beta, we’re being very intentional about the changes we accept so that we can prioritise stability for GA. We’re limiting pull requests to contributions coordinated with the team in advance, so this PR has been automatically closed.

We’d still love to hear about your use case, so please make sure it’s captured in a cf issue. If the proposed change fits our priorities, we’d be happy to take another look at this PR.

@github-actions github-actions Bot closed this Oct 9, 2026
@pkg-pr-new

pkg-pr-new Bot commented Oct 9, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/cf@242

commit: ea10557

Comment thread packages/cli/src/__tests__/commands/account-selection.test.ts
@petebacondarwin
petebacondarwin added this pull request to the merge queue Oct 11, 2026
Merged via the queue into cloudflare:main with commit 51b8cef Oct 11, 2026
9 of 10 checks passed
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.

Format the account-selection configuration hint consistently

2 participants