HCC Docs

CLI

hcc is in the @hccrun/cli package, and runs on Node.

npm install --save-dev @hccrun/cli

Run hcc --help to see this list in your terminal.

hcc deploy

Scans your exports and deploys them: to test, or with --live to live and test. It writes hcc.gen.ts and .hcc/versions. Commit both.

Definitions with hosting: 'hcc' are bundled into .hcc/hosted/test.js (live.js with --live), which you don't commit, and uploaded before anything is registered. With --live the bundle goes to both environments, each with its own secrets. If an upload fails, nothing changes. Live hosted code needs a live plan in good standing. See Hosting.

OptionWhat it does
--liveDeploy to live and to test. Needs a live key (the Deploy preset). Also removes frozen versions no call uses
--no-testWith --live: live only
--checkWrite nothing and change nothing. Exits 1 if anything differs, a frozen version is missing, or hosted code differs. For CI
--api-key <key>Default: HCC_TEST_API_KEY or HCC_API_KEY (with --live: HCC_API_KEY) from the environment, .dev.vars or .env
--api-url <url>The HCC API. Default: HCC_API_URL, else the hosted API
--config <path>Default: hcc.config.ts in this folder

hcc dev

Attaches a dev session, so the test environment's flow events reach your machine. With an hcc.config.ts, it also deploys to test on every save. See Local development.

hcc dev --forward-to http://localhost:8790/hcc -- wrangler dev --port 8790
OptionWhat it does
--forward-to <url>Where your server listens (localhost only)
--webhooks-to <url>Where your webhook handler listens (localhost only). Without it, copies are printed instead
--api-key <key>A test key. Default: HCC_TEST_API_KEY or HCC_API_KEY from the environment, .dev.vars or .env
--api-url <url>The HCC API. Default: HCC_API_URL, else the hosted API
--no-syncDon't deploy on save. hcc.gen.ts still follows your code
--sync-toolsOn save, also sync tools to agents that aren't test branches. Live calls use those tools
--config <path>Default: hcc.config.ts in this folder
-- <command>Run your server too. It stops when hcc dev does

hcc generate

Writes hcc.gen.ts and the current .hcc/versions, with no key and no network. Takes --config <path>.

hcc secrets

Lists, sets and deletes the secrets your hosted code reads: test's, or live's with --live and a live key with secrets:write (an owner's or admin's). Values are write-only: list shows names and when each was set, never values. See Hosting.

echo -n "$VALUE" | hcc secrets set NAME # or leave out the pipe and type it at a hidden prompt
hcc secrets list
hcc secrets delete NAME
hcc secrets set NAME --live

set never takes the value as an argument, so it stays out of your shell history. Takes --api-key <key> (a test key) and --api-url <url>, as hcc deploy does.

hcc prune

Removes the .hcc/versions that no call and no active version needs. Commit the result. It needs a live key, and deploys nothing. See During a deploy.

In CI

hcc deploy --check # fails if the commit is missing what a deploy would write
# ship your server, then:
hcc deploy --live

Use a key with the Deploy preset. See API keys and scopes.