Expand description
bynk new — scaffold a new project.
The zero-to-one step of the driver arc doctor → new → dev (proposal
v0.58): it writes a complete, runnable single-context HTTP service that
bynk dev serves unmodified. Unlike dev, new shells nothing, compiles
nothing, and reads no network — it is pure, offline file-writing, so it
works before bynkc, Node, or wrangler are installed (D4).
The starter, manifest, and .gitignore are embedded via include_str!
(the first-party precedent, ADR 0086): each template carries a
PLACEHOLDER identifier substituted for the project name at write time.
A standing test (tests/new.rs) renders the starter with a non-default name
and asserts it compiles and is bynk-fmt-clean, so the scaffold can never
rot into something that doesn’t build.
Structs§
- NewOptions
- Parsed
bynk newarguments.
Constants§
- PLACEHOLDER
- The sentinel identifier in the embedded templates, replaced by the project name when the scaffold is written. Chosen as a legal Bynk identifier so each template is itself parseable, and distinctive enough that a plain substring substitution only ever hits the intended occurrences.
Functions§
- cannot_
derive_ message - The failure message when a name can’t be derived from the path.
- clobber_
message - The failure message when the target exists and isn’t empty (D5).
- invalid_
name_ message - The failure message for a name that isn’t a legal Bynk identifier.
- is_
legal_ name - Is
namea legal Bynk identifier — a single, dotlessIdent? Answered by the real lexer rather than a hand-rolled regex, so it tracks the language exactly: a dash, dot, leading digit, or reserved keyword all yield something other than one loneIdenttoken and are rejected. - next_
steps_ message - The success “next steps” message, printed to stdout.
- render
- Render an embedded template for
nameby substitutingPLACEHOLDER. - run
- Scaffold a new project: derive & validate the name, refuse to clobber, write the tree, and print next steps. Returns a non-zero exit (touching nothing) on an underivable/invalid name or a non-empty target.
- starter_
source - The rendered starter source for
name— thecontext <name>HTTP service written tosrc/<name>.bynk.