Skip to content

configbound generate bind

generate bind scaffolds the boilerplate for a new bind. It handles the repetitive parts — class structure, factory pattern, cache setup — so you can focus on the implementation.

Usage

text
configbound generate bind <name> [options]

Arguments

ArgumentDescriptionDefault
nameThe bind name in kebab-case (e.g. vault, aws-ssm, 1password)Required

Options

FlagDescriptionDefault
-o, --output <dir>Output directory (default: current directory)
--type <type>Generation mode: package or embedded (skips interactive prompt)
--dry-runPreview generated files without writing

Generation modes

embedded generates a single TypeScript class file. The bind lives in your project and is not published. Use this when the bind is specific to one application.

package generates a full npm package scaffold: package.json, tsconfig.json, eslint.config.mjs, and a src/ directory containing the bind class and an index. Use this when you intend to publish the bind for others to use.

Examples

bash
# Interactive — prompts for embedded or package
configbound generate bind vault

# Non-interactive embedded bind
configbound generate bind vault --type embedded

# Non-interactive package scaffold
configbound generate bind aws-ssm --type package

# Preview what would be generated without writing anything
configbound generate bind 1password --type package --dry-run

What gets generated

Both modes produce a class that extends Bind with a static async create() factory and a synchronous retrieve() method. The generated code includes inline comments explaining what to fill in.

The factory pattern pre-loads values into a cache at startup. retrieve() reads from that cache synchronously. This satisfies the Bind contract without requiring changes to the core library.

Name derivation

The kebab-case name you provide is used to derive the class name. vault becomes VaultBind. aws-ssm becomes AwsSsmBind. Leading digits are replaced with words: 1password becomes OnepasswordBind.