| name | apps-cli-framework |
|---|---|
| description | Oclif command structure for Contentstack Apps CLI using BaseCommand, AppCLIBaseCommand, @contentstack/cli-command, and @contentstack/cli-utilities. Use when adding flags, init/SDK setup, logging, or organizing command code. |
BaseCommand(src/base-command.ts) — Extends@contentstack/cli-commandCommand. Centralizesinit,parse, shared flags (org,yes), logger,managementSdk/marketplaceAppSdk, region/auth validation, andmessages/$t.AppCLIBaseCommand(src/app-cli-base-command.ts) — For app-manifest workflows: loadsmanifestDatafrom the default app JSON path aftersuper.init().
New app-facing commands should extend the appropriate base and call await super.init() first.
- CLI layer: flag definitions, prompts via
cliux, progress viathis.log/ logger, user errors viathis.error/ framework patterns. - Business logic: prefer
src/util/,src/factories/,src/strategies/over largerun()methods.
- Add static
flagson the command class; inheritbaseFlagsfromBaseCommandwhere org/skip-confirmation apply. - Parse runs in
BaseCommand.init; usethis.flags/this.argsafterinit.
- Use
messagesand$tfromsrc/messagesfor user-visible strings consistent with the rest of the CLI.
BaseCommand.catchhandles some framework errors; prefer consistent, actionable messages for users.