create-gluon / packages/create-gluon/src / addComponentHelpText
Variable: addComponentHelpText
constaddComponentHelpText: "Usage: create-gluon add-component [name] [options]\n\nOptions:\n --kind <kind> atom, molecule, organism, element, or headless\n --root <directory> project root (default: current directory)\n --path <path> relative component directory (default: src/components)\n --tag <name> autonomous Custom Element tag for --kind element\n -y, --yes require stable non-interactive values\n --dry-run print every create/update/overwrite operation without mutation\n --overwrite allow generated source/test collisions\n --confirm-overwrite separately confirm --overwrite in scripted use\n -h, --help show this help\n\nSupported app-local component kinds:\n atom stateless Quark-based primitive; caller owns its document/ShadowRoot sheet\n molecule stateless composition of official Atoms; caller owns its sheet\n organism stateless downward Atom/Molecule composition; caller owns its sheet\n element stateful autonomous Custom Element; defineGluonElement owns its ShadowRoot sheet and cleanup\n headless behavior-only wrapper; caller owns markup, styles, activation, and deactivation\n\nManaged package.json fields and the marked barrel region are updated deterministically.\nGenerated source/test collisions require both --overwrite and --confirm-overwrite.\n"
Example
Display canonical non-interactive flags, mutation safeguards, and the managed-update boundary from an embedded CLI host:
import { PassThrough } from 'node:stream';
import {
AddComponentError,
addComponent,
addComponentHelpText,
componentKindHelpText,
componentKinds,
parseAddComponentArguments,
planComponent,
runAddComponentCli,
type AddComponentAction,
type AddComponentErrorCode,
type AddComponentOperation,
type AddComponentOptions,
type AddComponentResult,
type ComponentKind,
type ParsedAddComponentArguments,
} from 'create-gluon';
const parsed: ParsedAddComponentArguments = parseAddComponentArguments([
'PurchaseAction', '--kind', 'molecule', '--root', '/tmp/shop', '--dry-run', '--yes',
]);
const kind: ComponentKind = parsed.kind ?? componentKinds[0];
const options = {
kind,
name: parsed.name!,
root: parsed.root,
dryRun: true,
} satisfies AddComponentOptions;
const planned: Promise<AddComponentResult> = planComponent(options);
const generated: Promise<AddComponentResult> = addComponent(options);
const operation = { path: 'src/components/index.ts', action: 'update', bytes: 80 } satisfies AddComponentOperation;
const action: AddComponentAction = operation.action;
const output = new PassThrough();
await runAddComponentCli(['--help'], { output, cwd: '/tmp/shop' });
console.log(planned, generated, action, addComponentHelpText, componentKindHelpText);
try { throw new AddComponentError('FILE_COLLISION', 'existing component'); } catch (error) {
if (error instanceof AddComponentError) {
const code: AddComponentErrorCode = error.code;
console.error(code);
}
}