Skip to content

@rpallas/outcrop-cli ​

Scaffolding and CI helpers for services built with @rpallas/outcrop.

sh
npx @rpallas/outcrop-cli create service orders --http-api --dynamodb --auth jwt-auth0
npx @rpallas/outcrop-cli create account my-platform --owner my-org --domain example.com
npx @rpallas/outcrop-cli preview-id --branch feature/ABC-123-thing --pr 42   # abc-123
npx @rpallas/outcrop-cli stack-outputs --outputs-file cdk-outputs.json --prefix PREVIEW_ --github-env
npx @rpallas/outcrop-cli sync-skills

Commands ​

CommandPurpose
create service <name>Generates a complete service repository: infra, handlers, tests, workflows and docs.
create account <name>Generates an account baseline app using @rpallas/outcrop-account.
preview-idDerives the preview id (abc-123 from a ticket in the branch name, else pr-<n>).
stack-outputsReads CloudFormation outputs (from cdk deploy --outputs-file or the API) and exports them.
sync-skillsCopies the bundled agent skills into .agents/skills so coding agents follow the conventions.

Service variants ​

Variants can be combined: --http-api, --queue-consumer, --event-subscriber, --scheduled, --static-site, --dynamodb, --neon. --auth none|jwt-auth0|jwt-cognito|api-key protects the HTTP API. The generated infra/lib/service-stack.ts is plain CDK code intended to be edited; the templates are a starting point, not a framework.

Generated repositories consume the reusable workflows from this repository (rpallas/outcrop/.github/workflows/*.yml@v1) and expect these repository variables: AWS_REGION, AWS_DEPLOY_ROLE_ARN_DEV (and _PROD, AWS_READONLY_ROLE_ARN_DEV for diffs).

Run outcrop create service --help for the full option list.

Classes ​

CliError ​

Defined in: io.ts:40

Extends ​

  • Error

Constructors ​

Constructor ​
ts
new CliError(message, exitCode?): CliError;

Defined in: io.ts:41

Parameters ​
ParameterTypeDefault value
messagestringundefined
exitCodenumber1
Returns ​

CliError

Overrides ​
ts
Error.constructor

Properties ​

PropertyModifierTypeDefault valueDefined in
exitCodereadonlynumber1io.ts:43

Interfaces ​

PreviewIdSource ​

Defined in: preview-id.ts:48

Properties ​

PropertyTypeDefined in
branch?stringpreview-id.ts:49
prNumber?string | numberpreview-id.ts:50

ServiceStackSpec ​

Defined in: scaffold/service-stack.ts:17

Properties ​

PropertyModifierTypeDefined in
authreadonly"none" | "jwt-auth0" | "jwt-cognito" | "api-key"scaffold/service-stack.ts:20
servicereadonlystringscaffold/service-stack.ts:18
variantsreadonlyReadonlySet< | "http-api" | "queue-consumer" | "event-subscriber" | "scheduled" | "static-site" | "dynamodb" | "neon">scaffold/service-stack.ts:19

Type Aliases ​

AuthMode ​

ts
type AuthMode = typeof AUTH_MODES[number];

Defined in: scaffold/service-stack.ts:15


PreviewIdStrategy ​

ts
type PreviewIdStrategy = "ticket-then-pr" | "pr" | "branch-slug";

Defined in: preview-id.ts:8


ServiceVariant ​

ts
type ServiceVariant = typeof SERVICE_VARIANTS[number];

Defined in: scaffold/service-stack.ts:12


TemplateVars ​

ts
type TemplateVars = Record<string, string | boolean | undefined>;

Defined in: scaffold/template.ts:1

Variables ​

AUTH_MODES ​

ts
const AUTH_MODES: readonly ["none", "jwt-auth0", "jwt-cognito", "api-key"];

Defined in: scaffold/service-stack.ts:14


HELP ​

ts
const HELP: "outcrop - scaffolding and CI helpers for outcrop services\n\nUsage: outcrop <command> [options]\n\nCommands:\n  create service <name>   Scaffold a new service (see: outcrop create service --help)\n  create account <name>   Scaffold an account baseline app\n  preview-id              Derive the preview id for a pull request\n  stack-outputs           Print / export CloudFormation stack outputs\n  oidc-subject <owner/repo>  Print a repository's OIDC subject and ids for account.config.ts\n  sync-skills             Copy the bundled agent skills into ./.agents/skills\n  help                    Show this help\n\nRun any command with --help for details.";

Defined in: index.ts:14


HELP_TEXT ​

ts
const HELP_TEXT: Record<string, string>;

Defined in: index.ts:46


PREVIEW_ID_MAX_LENGTH ​

ts
const PREVIEW_ID_MAX_LENGTH: 20 = 20;

Defined in: preview-id.ts:7


PREVIEW_ID_RE ​

ts
const PREVIEW_ID_RE: RegExp;

Defined in: preview-id.ts:6

Preview id derivation. This is a CDK-free copy of the rules in @rpallas/outcrop (config/preview-id.ts) so that CI, the CLI and the CDK app agree without the CLI depending on aws-cdk-lib. Keep both in sync.


PREVIEW_ID_STRATEGIES ​

ts
const PREVIEW_ID_STRATEGIES: readonly PreviewIdStrategy[];

Defined in: preview-id.ts:9


SERVICE_VARIANTS ​

ts
const SERVICE_VARIANTS: readonly ["http-api", "queue-consumer", "event-subscriber", "scheduled", "static-site", "dynamodb", "neon"];

Defined in: scaffold/service-stack.ts:3

Functions ​

assertValidPreviewId() ​

ts
function assertValidPreviewId(value): string;

Defined in: preview-id.ts:20

Parameters ​

ParameterType
valuestring

Returns ​

string


branchSlug() ​

ts
function branchSlug(branch): string;

Defined in: preview-id.ts:37

Parameters ​

ParameterType
branchstring

Returns ​

string


derivePreviewId() ​

ts
function derivePreviewId(source, strategy?): string;

Defined in: preview-id.ts:53

Parameters ​

ParameterTypeDefault value
sourcePreviewIdSourceundefined
strategyPreviewIdStrategy"ticket-then-pr"

Returns ​

string


isValidPreviewId() ​

ts
function isValidPreviewId(value): boolean;

Defined in: preview-id.ts:17

Parameters ​

ParameterType
valuestring

Returns ​

boolean


main() ​

ts
function main(argv, io?): Promise<number>;

Defined in: index.ts:52

Parameters ​

ParameterTypeDefault value
argvstring[]undefined
ioIoprocessIo

Returns ​

Promise<number>


renderServiceStack() ​

ts
function renderServiceStack(spec): string;

Defined in: scaffold/service-stack.ts:29

Generates infra/lib/service-stack.ts for the selected variants. Kept as code (not a template) so the combinations stay consistent and type-safe.

Parameters ​

ParameterType
specServiceStackSpec

Returns ​

string


renderTemplate() ​

ts
function renderTemplate(content, vars): string;

Defined in: scaffold/template.ts:12

Tiny mustache-like renderer: {{var}}, {{#if flag}}...{{/if}}, {{#unless flag}}...{{/unless}}. Blocks may nest one level deep by running the block regex until no more blocks match. Unknown variables throw so templates never ship placeholders.

Parameters ​

ParameterType
contentstring
varsTemplateVars

Returns ​

string


ticketFromBranch() ​

ts
function ticketFromBranch(branch): string | undefined;

Defined in: preview-id.ts:29

Parameters ​

ParameterType
branchstring

Returns ​

string | undefined


toCamelCase() ​

ts
function toCamelCase(value): string;

Defined in: scaffold/template.ts:41

Parameters ​

ParameterType
valuestring

Returns ​

string


toConstantCase() ​

ts
function toConstantCase(value): string;

Defined in: scaffold/template.ts:46

Parameters ​

ParameterType
valuestring

Returns ​

string


toPascalCase() ​

ts
function toPascalCase(value): string;

Defined in: scaffold/template.ts:34

Parameters ​

ParameterType
valuestring

Returns ​

string

References ​

previewId ​

Renames and re-exports derivePreviewId

Released under the MIT License.