Skip to content

CLI Commands — validate, typegen, lint, dev

Terminal window
npm install -g @rep-protocol/cli
# or
npx @rep-protocol/cli [command]

Validate a .rep.yaml manifest against the JSON schema.

Structural check only: the gateway, not rep validate, checks each default against its type and pattern.

Terminal window
rep validate [--manifest <path>]
FlagDefaultDescription
-m, --manifest <path>.rep.yamlPath to manifest file

Example:

Terminal window
$ rep validate --manifest .rep.yaml
✓ Manifest is valid
Version: 0.1.0
Variables: 11 total
- PUBLIC: 6
- SENSITIVE: 3
- SERVER: 2
Settings configured: 6

Generate TypeScript type definitions from a manifest. Creates strongly-typed overloads for rep.get() and rep.getSecure().

Terminal window
rep typegen [--manifest <path>] [--output <path>]
FlagDefaultDescription
-m, --manifest <path>.rep.yamlPath to manifest file
-o, --output <path>src/rep.d.tsOutput path for generated types

Generated output:

declare module "@rep-protocol/sdk" {
export interface REP {
// Overloaded: passing a defaultValue narrows the return type to string.
get(key: "API_URL" | "FEATURE_FLAGS", defaultValue: string): string;
get(key: "API_URL" | "FEATURE_FLAGS", defaultValue?: undefined): string | undefined;
getSecure(key: "ANALYTICS_KEY"): Promise<string>;
// ... other methods
}
export function get(key: "API_URL" | "FEATURE_FLAGS", defaultValue: string): string;
export function get(key: "API_URL" | "FEATURE_FLAGS", defaultValue?: undefined): string | undefined;
export function getSecure(key: "ANALYTICS_KEY"): Promise<string>;
// ...
}

Strict by design — the key unions are closed. Calling rep.get('UNDECLARED_KEY') is a TypeScript error if that variable is not declared in .rep.yaml. This is intentional: it forces every variable the app reads to be explicitly declared in the manifest, keeping the manifest the single source of truth. The fix is always to add the missing variable to .rep.yaml and re-run rep typegen, not to widen the types.

If you don’t want strict type enforcement, skip rep typegen and rely on the base SDK types (key: string).

Scan built JavaScript bundles for accidentally leaked secrets. Uses the same guardrail detection as the gateway (Shannon entropy, known secret formats).

Terminal window
rep lint [--dir <path>] [--pattern <glob>] [--exclude <patterns>] [--strict]
FlagDefaultDescription
-d, --dir <path>./distDirectory to scan
--pattern <glob>**/*.{js,mjs,cjs}File pattern to scan
--exclude <patterns>—Comma-separated glob patterns to exclude (e.g., "*.min.js,vendor/**")
--strictfalseExit with error code if warnings found

The linter filters out false positives from minified/bundled code while still detecting real secrets embedded in your bundles.

File-level skip: Files with .min.js / .min.mjs / .min.cjs extensions are skipped entirely, as these are typically third-party vendor bundles. If your build pipeline produces application code with .min.js filenames, rename the output or run rep lint against the non-minified build.

String-level filtering: For all other files (including Vite, webpack, and Rollup bundles), extracted string values are checked for JavaScript language constructs (function, return, if, =>, ===, &&, .method(), key:value, etc.) and skipped if they look like compiled code. This means real secrets accidentally embedded in a bundle are still detected, while minified code noise is filtered out.

If you still get false positives, use --exclude to skip specific files or directories.

Example:

Terminal window
$ rep lint --dir ./dist
⚠ dist/main.js
high_entropy:42: value has high entropy (5.23 bits/char) — may be a secret
const key = "sk_live_abc123..."
⚠ Found 1 potential secret(s) in 1 file(s)
Terminal window
# Exclude vendor bundles
$ rep lint --dir ./dist --exclude "vendor/**,*.chunk.js"

Use cases:

  • CI/CD pipeline step before deployment
  • Pre-commit hook
  • Regular audits of production bundles

Run a local development server with the REP gateway. Loads env vars from a file and starts the gateway.

Terminal window
rep dev [options]
FlagDefaultDescription
-e, --env <path>.env.localPath to .env file
-p, --port <number>8080Gateway port
--proxy <url>—Upstream proxy URL (e.g., http://localhost:5173)
--static <path>—Serve static files (embedded mode)
--hot-reloadfalseEnable hot reload
--gateway-bin <path>autoPath to gateway binary

Example workflows:

Terminal window
# Proxy mode with Vite
rep dev --env .env.local --proxy http://localhost:5173
# Embedded mode with static files
rep dev --env .env.local --static ./dist --port 8080

The CLI looks for the gateway binary in this order:

  1. Bundled binary (downloaded during npm install)
  2. Custom path via --gateway-bin
  3. rep-gateway in system PATH