Skip to content

fix(prompts): restore the formatInstructionFooter signature from 1.8 - #635

Merged
43081j merged 3 commits into
bombshell-dev:mainfrom
kyungseopk1m:fix/instruction-footer-signature
Nov 11, 2026
Merged

43081j merged 3 commits into
bombshell-dev:mainfrom
kyungseopk1m:fix/instruction-footer-signature

Conversation

@kyungseopk1m

Copy link
Copy Markdown
Contributor

What does this PR do?

#631 (released in 1.9.0) added output as the first parameter of formatInstructionFooter:

// 1.6.0 to 1.8.1
formatInstructionFooter(instructions: string[], hasGuide: boolean): string[]
// 1.9.0
formatInstructionFooter(output: Writable | undefined, instructions: string[], hasGuide: boolean): string[]

The prompts docs still describe the two-argument form, and the custom prompt example there calls formatInstructionFooter(['Enter: submit'], true). I also found more than ten public projects calling it this way. On 1.9.0 these calls fail to type-check (TS2554) and throw at runtime with TypeError: o.join is not a function, since the array is taken as output and true as instructions.

This PR moves output to an optional third parameter:

formatInstructionFooter(instructions: string[], hasGuide: boolean, output?: Writable): string[]
  • Two-argument calls work again. Passing output still wraps the footer to the stream's width.
  • select, multiselect and groupMultiselect now pass opts.output last.
  • Added tests for the two-argument call, the no-guide case and wrapping to the width of output.

Code already updated to the 1.9.0 order would have to switch back, but I couldn't find any outside this repo. If you'd prefer to keep output first, I can change this to accept both forms instead, by checking whether the first argument is an array.

I didn't open an issue first since the change is small.

Type of change

  • Bug fix
  • Feature
  • Refactor (no behavior change)
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • I have added a changeset

AI-generated code disclosure

  • This PR includes AI-generated code

@changeset-bot

changeset-bot Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 70f092e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clack/prompts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@43081j

43081j commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

in future, please open an issue first. i know it is tempting to have an agent churn out PRs, but it just drains the time of maintainers reviewing something that hasn't even been discussed yet.

it also created the test in an inappropriate place, inconsistent with the rest of the repo.

having said that, i'm happy to reorder the signature once you sort the tests out.

@kyungseopk1m

Copy link
Copy Markdown
Contributor Author

Thanks! I’ll open an issue first next time. I moved the tests to select.test.ts and made them snapshot tests to match the rest of the suite.

@43081j

43081j commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

sadly its still not in the right place.

forget the tests. ill sort it

This test is purely testing that the argument order changed, which makes
no sense when this isn't a question of backwards compat of any kind.

Agents going off on one as per.
@43081j
43081j merged commit c8d14b1 into bombshell-dev:main Nov 11, 2026
3 checks passed
@bombshell-bot bombshell-bot Bot mentioned this pull request Nov 11, 2026
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