new secret
holocron new secret <name> [value] [--from-stdin] [--from-env <var>] [--scope <scope>] [--dry-run]holocron new secret <name> --target file [--generate] [--env <layer or name>] [--yes] [--dry-run]Sets a single secret at the specified scope using the secrets capability (e.g. GitHub Actions secrets). The secret value is read from the positional argument, --from-stdin, --from-env, or the env var matching <name> — in that priority order.
Arguments and options
Section titled “Arguments and options”| Argument / Option | Default | Description |
|---|---|---|
<name> |
(required) | Secret name (e.g. NPM_TOKEN) |
[value] |
— | Secret value as a positional argument |
--from-stdin |
false |
Read secret value from stdin |
--from-env <var> |
— | Read from a named env var (falls back to env var matching <name>) |
--scope |
repo |
Scope: repo, env=<name>, or org=<name> |
--target |
github |
github (the secrets capability) or file (the private import file, below) |
--generate |
false |
Make the value instead of taking one (only a name in the table below) |
--env |
— | With --target file: the vault Environment to import into (a layer word such as prod, or a name) |
--yes |
false |
With --target file: write without asking (required without a terminal) |
--dry-run |
false |
Print what would be set without writing |
Scope formats
Section titled “Scope formats”| Scope | Example | Description |
|---|---|---|
repo |
--scope repo |
Repository-level secret (default) |
env=<name> |
--scope env=production |
Environment-level secret |
org=<name> |
--scope org=my-org |
Organization-level secret |
Examples
Section titled “Examples”# From positional valueholocron new secret NPM_TOKEN tok_xxx
# From env var (reads $NPM_TOKEN)holocron new secret NPM_TOKEN
# From a different env varholocron new secret DEPLOY_HOOK --from-env VERCEL_HOOK_URL
# From stdin (useful for piping)echo "tok_xxx" | holocron new secret NPM_TOKEN --from-stdin
# Environment-scopedholocron new secret DATABASE_URL --scope env=production
# Org-scopedholocron new secret SHARED_TOKEN --scope org=my-org
# Dry-runholocron new secret NPM_TOKEN tok_xxx --dry-runMaking a secret and handing it to a vault
Section titled “Making a secret and handing it to a vault”--generate makes the value from the system’s random source. It works only for a name the CLI is allowed to make up, so a token a vendor issues can never be invented by mistake:
| Name | Value | Read by |
|---|---|---|
CRON_SECRET |
32 random bytes as hex | the bearer Vercel’s cron sends to Sentinel’s /api/scheduled |
--generate cannot be combined with a value, --from-stdin or --from-env. With the default --target github the made value is set through the secrets capability and never shown, so it cannot be copied anywhere else.
--target file is for a vault the CLI cannot write to, such as a 1Password Environment. The value goes only to the private import file, .holocron/.private/.credentials (mode 0600, never overwritten, refused unless git ignores it, refused on Windows), and the command waits while you import it (in 1Password: Developer, View Environments, the Environment, Import .env file). The file is deleted afterwards. The value is never printed, logged or returned.
With --env, the command reads the Environment before it writes the file and again after the import, comparing a per-run salted hash held in memory. A name that is missing, blank or unchanged is a failure (still holds the old value), so a forgotten import shows up here and not as a 401 later. If the Environment cannot be read the check is skipped and says why. It then names the two steps to run: holocron sync <app> --env <environment> for a workspace app such as sentinel (it fills in the project id and the deploy filter; plain sync secrets does not know the Vercel project), or holocron sync secrets --env <environment> for the repository’s own destinations, and a redeploy, because a deployment only gets variables when it is deployed. Neither is run for you. It asks first unless --yes or --dry-run is given.
To rotate CRON_SECRET:
holocron new secret CRON_SECRET --generate --target file --env prodholocron sync sentinel --env prod# then redeploy SentinelAuthentication
Section titled “Authentication”Uses the HOLOCRON_SECRETS_TOKEN / github.secrets keyring entry when the secrets capability is GitHub, for org= scope (repo and environment scopes use HOLOCRON_ADMIN_TOKEN / github.admin first), each falling back to the other. Required scopes: secrets: read/write (an organization-level secrets: read/write for org= scope), environments: read/write (for env-scoped secrets).