Skip to content

[Request] eliminate third-party dependencies on @clack/core + @clack/prompts #626

Open

Description

@firxworx

Is your feature request related to a problem? Please describe.

Given so many supply chain attacks and issues with npm in general I would like to throw out there that @clack/core and @clack/prompts could (and perhaps should?) eliminate third party dependencies.

Describe the solution you'd like

Replace fast-string-width, fast-wrap-ansi, and sisteransi with internal lib/helper code owned by this project to reduce the attack surface.

@clack/core would have zero runtime dependencies and @clack/prompts would only need to depend on @clack/core.

Bringing this functionality in-house is lower hanging fruit than ever with frontier LLM's that can help add code, tests, and refactor.

While these packages incorporate some pretty niche knowledge they are also pretty small and focused in scope so they are perfect candidates.

If you really wanted you could even introduce a process to compare implementations when the current package dependencies are updated to see if there's anything relevant to your in-house implementation to consider.

Other leading CLI libraries such as commander.js are 100% runtime dependency free and I think it would be a sweet touch if that could describe this project as well.


Thanks for your work on clack, it has made TUI's so much nicer and has had a really positive impact.

Activity

  1. 43081j commented on Oct 21, 2026

    @43081j
    Collaborator

    there is a balance. these dependencies de-dupe very well in wider dependency trees as they're used by quite a lot of dev tools in the ecosystem. on top of that, AI or not, it increases the burden on us (the maintainers) to maintain code unrelated to what clack exists for.

    i understand wanting to secure the supply chain, and i spend a large part of my time doing that, but i don't think the solution is "never use dependencies". that's a quick way to add noise to your repo, lose focus and, worse, slop.

    i'll wait for an opinion from @dreyfus92 but i don't see a reason to drop them.

    also worth noting, commander is a CLI builder (i.e. it generates usage, --help, and parses args), while clack is a CLI renderer (prompts library). all CLI renderers ultimately have to calculate the visual string width, so barely any of them have zero dependencies because of that.

  2. dreyfus92 commented on Oct 21, 2026

    @dreyfus92
    Member

    hey @firxworx, thanks for taking the time to write this up, supply chain stuff is worth raising. agree with james here though. @clack/prompts pulls in 4 tiny packages, one of them is being maintained by james, and all of them sit at 20M+ weekly downloads, so they're almost certainly in your tree already thru other tools. vendoring them wouldn't remove them, it'd just add a copy we have to maintain, increasing maintainance burden. string width is exactly the kind of niche code where bugs kide (cjk, emoji, ansi stuff).

    your supply chain concern is fair though. fast-wrap-ansi and sisteransi already publish with npm provenance, fast-string-width and fast-string-truncated-width don't. getting provenance on those two seems like the better win here than dropping them.

  3. firxworx commented on Oct 23, 2026

    @firxworx
    Author

    hey @43081j and @dreyfus92 I really appreciate the thoughtful and detailed responses.

    Paul I really appreciate that you looked at each dependency and noted the lack of npm provenance on fast-string-width and fast-string-truncated-width.

    I agree that "never use dependencies" is not a general solution... my own general philosophy considers if a dependency:

    • is small (or the usage of it is small such as calling a function or two from a huge library) and;
    • is not likely to change (for example you are not effectively outsourcing to a maintainer the work of staying on top of something hairy or changing)

    ...then consider bringing it into the codebase.

    At first blush it seemed like that's the case for all but y'all bring up a good point about string width being pretty niche, and I admittedly didn't notice that one of you guys is behind one of them!

    A few thoughts regarding popularity:

    • a good chunk of the popularity of these packages is your own work such as clack itself (congrats!)
    • considering an attacker's perspective, the more popular a dependency is, and the sweeter the targets that depend on it (such as corporate and government codebases vs. lower value consumers), the juicer of a target it may be

    All said I respect your guys decision and really appreciate you taking the time and care you put into responding, I'm happy to call the issue closed if you are :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions