Clean up bin.ts#489
Draft
gewenyu99 wants to merge 1 commit into
Draft
Conversation
🧙 Wizard CIRun the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands: Test all apps:
Test all apps in a directory:
Test an individual app:
Show more apps
Results will be posted here when complete. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
We didn't write the Wizard knowing it'll be a permanent fixture or that it'll grow to support more than 1 integration command.
We've been throwing things into bin.ts, but it's very hard to read now.
Time to tackle some of the debt to took on to ship the wizard quickly, now that it'll be here to stay.
Prior art
Mainly looked at Cobra (written in Go, used by Docker, kubectl, gh)
Adopted: Cobra-on-our-own-types.
{ name, description, options, children?, handler? }buildercallback.Design
A composable Wizard type, we just register commands in a composable way.
Wizard(src/wizard.ts) — variadic.use(...cmds)chain. Walks the command tree eagerly on registration and throws on any path collision (top-level dupes, positional vs plain, alias clashes, dupe children under a parent)..init()hands the resulting tree to yargs.childrengetdemandCommand(1)automatically; nobuildercallbacks anywhere.basic-integration,mcp) are folders withindex.tsholding the spec and siblings holding the mode runners.programCommandsare generated fromPROGRAM_REGISTRYso audit/migrate/integrate/etc. stay registry-driven.src/lib/runners/) — folder of one runner per file (run-wizard,run-wizard-ci), barrel-exported.bin.tsreload). Conflict detection has its own dedicated suite.Shape of command definitions
Parent with subcommand as children:
Test plan
List of tests to do: