Skip to content

Export built-in commands for composition#303

Open
boramuyar wants to merge 2 commits into
vercel-labs:mainfrom
boramuyar:feat/export-builtin-commands
Open

Export built-in commands for composition#303
boramuyar wants to merge 2 commits into
vercel-labs:mainfrom
boramuyar:feat/export-builtin-commands

Conversation

@boramuyar

Copy link
Copy Markdown

Summary

  • export createBuiltinCommands from the public package entry point
  • preserve the existing lazy-loading behavior and support selecting a subset by command name
  • document and test wrapping a built-in as a custom command
  • add a minor changeset

Motivation

Custom commands can override built-ins, but there is currently no supported way to delegate back to the original built-in implementation. Consumers that need to instrument a command or substitute part of its CommandContext must either construct a nested Bash instance or copy the command implementation.

This exposes the registry's existing lazy command factory under a public composition-oriented name, allowing consumers to decorate built-ins while retaining their implementation and execution context.

const [builtinCat] = createBuiltinCommands(["cat"]);
const cat = defineCommand("cat", (args, ctx) => builtinCat.execute(args, ctx));
const bash = new Bash({ customCommands: [cat] });

Validation

  • focused registry and public API tests: 7 passed
  • pnpm --filter just-bash typecheck
  • pnpm --filter just-bash knip
  • TypeScript declaration emit
  • CJS and browser bundle builds, with runtime verification of the CJS export

@boramuyar
boramuyar requested a review from cramforce as a code owner July 16, 2026 13:04
@vercel

vercel Bot commented Jul 16, 2026

Copy link
Copy Markdown

@boramuyar is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant