Instruction file imported from Rikinshah787/hackwithstripe (
.cursor/rules/stripe-projects-cli.mdc). Copyright stays with the author.
Stripe Projects CLI
This workspace is initialized for the Stripe project "AU".
Workflow
-
Run
stripe projects llm-contextto get the LLM context for the project. -
Start with
stripe projects statusorstripe projects showto inspect the current project, linked providers, and named resources. -
Use
stripe projects catalogorstripe projects servicesto browse available providers and services. When you know the provider, runstripe projects catalog <provider> --jsonorstripe projects catalog <provider>and copy the exact<provider>/<service>slug from the output. -
Provision a resource with
stripe projects add <provider>/<service>. Do not guess thestripe projects addargument. Runstripe projects catalog <provider> --jsonorstripe projects catalog <provider>and copy the exact<provider>/<service>slug before you runstripe projects add. Example:stripe projects add databaseco/postgres --name primary-db. Use--name <resource>to control the local resource name used by future resource commands and environment variable prefixes. If you omit--name, the CLI uses the provider/service default for the local resource name. When a service config field looks like a name, the CLI uses the current project name as the default value when that satisfies the field schema. Use--config '<json>'when the service requires configuration. -
Review credentials with
stripe projects env. Values are redacted by default, and you can usestripe projects env --pullto write them to local files. If named project environment commands are available,stripe projects env --pullwrites credentials for the active environment to that environment's output file. -
After a successful
stripe projects add, summarize the result and suggest next steps:Field Value Provider <provider name>Service <service type>Tier <tier>Env vars <variable names only — never values>Then show a compact summary of the other services already provisioned on the project (from
stripe projects status):Already on this project:
Provider Service Env var prefix ProviderA service-name (Tier) PREFIX_*ProviderB service-name (Tier) PREFIX_*Then suggest 3–5 complementary services from different categories in the catalog (e.g., if user added a database, suggest auth, hosting, or observability). Only reference services that actually appear in
stripe projects catalog --jsonoutput — never fabricate commands or provider names. Use this human-friendly format without CLI commands or provider/service slugs:- ProviderName (category) — short description of what it provides
-
For named environments, use
stripe projects env listto see all environments and the active*,stripe projects env create <environment> --output .env.<environment>to create one, andstripe projects env use <environment>to switch the active environment. -
Use
stripe projects env add <resource>andstripe projects env remove <resource>to change resource membership for the active environment only. Usestripe projects env add <variable> --variable --env-key <KEY>andstripe projects env remove <variable> --variableto change project variable membership for the active environment only.
Optional notes
- If necessary, you can also link a provider with
stripe projects link <provider>directly. Butstripe projects add <provider>/<service>will guide you through provider authentication when needed.
Working Agreement
- Commands can be run from the project root or nested directories inside the project.
- Do not hand-edit CLI-managed files under
.projectsor the generated.envoutput. - NEVER look at any files in the .projects directory. The CLI manages everything for you.
- NEVER look at
.env. The CLI manages everything for you.
Agent mode
- You can use the
--jsonflag when structured output will make follow-up steps easier. - When you need to build a provisioning command programmatically, prefer
stripe projects catalog <provider> --jsonso you can copy the exact<provider>/<service>slug without guessing. - Use
--non-interactiveto disable prompts across commands. When you do, pass fully specified arguments and companion flags like--yeswhen the command requires confirmation.
Headless limitations
You CANNOT complete browser authentication alone. If a command exits with BROWSER_AUTH_REQUIRED, Run stripe login --non-interactive to print JSON with browser_url, verification_code, and next_step; present browser_url and verification_code to the user, then run the emitted next_step command to complete login before retrying. If a command exits with ACCOUNT_NOT_ELIGIBLE, The current account isn’t eligible for Stripe Projects.
Run stripe projects switch-account to choose an account or continue setup for this account. Do NOT retry the original command until the blocker is resolved.
Error codes
When a command fails, the error output includes a machine-readable code in parentheses. React to these programmatically:
| Code | Meaning | What to do |
|---|---|---|
BROWSER_AUTH_REQUIRED |
No Stripe session and browser auth needed | Run stripe login --non-interactive to print JSON with browser_url, verification_code, and next_step; present browser_url and verification_code to the user, then run the emitted next_step command to complete login before retrying. |
BROWSER_AUTH_TIMEOUT |
Browser auth did not complete in time | Ask the user to finish the browser flow, then retry |
ACCOUNT_NOT_ELIGIBLE |
Account not onboarded for Projects | The current account isn’t eligible for Stripe Projects. |
Run stripe projects switch-account to choose an account or continue setup for this account. |
| TOS_ACCEPTANCE_REQUIRED | Provider terms not accepted | Re-run with --accept-tos --yes |
| PLAN_REQUIRED | Service needs a plan provisioned first | Provision the plan listed in the error, then retry |
| PROVIDER_NOT_LINKED | Provider requires OAuth linking | Run stripe projects link <provider> (may need browser) |
| JSON_REQUIRES_CONFIRMATION | Interactive confirmation needed | Re-run with --yes |
| MERCHANT_MISMATCH | Logged-in account differs from project owner | Run stripe projects switch-account |
Full command reference
stripe projects status— view project, providers, and servicesstripe projects catalog [provider]— browse available services (optionally for one provider) and copy exactprovider/serviceslugsstripe projects add <provider>/<service>— provision a servicestripe projects add databaseco/postgres --name primary-db— example add command you can copy and adapt--name <resource>— custom local resource name for future commands and env var prefixes--config '<json>'— service configuration that can be passed withprojects add--provider-config '<json>'— provider link configuration (e.g. region)--force-provider-relink— force a fresh provider link request duringadd
stripe projects add @database— browse services by category (interactive only)stripe projects remove <resource>— remove a provisioned resourcestripe projects rotate <resource>— rotate credentials for a resourcestripe projects upgrade <resource>— change a resource's service tierstripe projects open <provider>— open provider dashboard in browserstripe projects link <provider>— link/re-link a providerstripe projects link <provider> --force— force a fresh provider re-link requeststripe projects env— list credentials (redacted)stripe projects env --pull— fetch credentials and write them to.envstripe projects env list— list named project environments and mark the active one with*stripe projects env show— show the active project environmentstripe projects env create <environment> --output .env.<environment>— create a named environment and make it activestripe projects env use <environment>— switch the active project environmentstripe projects env add <resource>— add an existing resource to the active environmentstripe projects env remove <resource>— remove resource membership from the active environmentstripe projects variables set <name> --env-key <KEY> [--value <value>]— store a backend-backed project variable and bind it to the active environmentstripe projects variables list— list project variables and local environment bindingsstripe projects variables delete <name>— delete a project variable and its local bindingsstripe projects env add <variable> --variable --env-key <KEY>— bind an existing project variable to the active environmentstripe projects env remove <variable> --variable— remove project variable membership from the active environmentstripe projects llm-context— get provider-specific LLM guidancestripe projects billing show— view billing methodstripe projects billing add— add or update billing methodstripe projects spend— view charges on your account
Companion plan services
Some deployable services require a companion plan service to be provisioned first (controls pricing tier/resource limits).
Checking existing plans
Run stripe projects status to see provisioned plans. If the required plan is already active, no action needed — proceed directly with the deployable.
Provisioning order
When adding a deployable that has component pricing and no plan is yet provisioned:
- Identify the required plan via
stripe projects catalog <provider> --json— look for plan-kind services that are parents of the target deployable. - Provision the plan:
stripe projects add <provider>/<plan-service> --accept-tos --yes - Provision the deployable:
stripe projects add <provider>/<deployable> --accept-tos --yes
The plan must be provisioned before the deployable. If you skip it, the CLI exits with PLAN_REQUIRED and lists the exact command to provision the missing plan.
Billing
If you need to deploy paid services, use stripe projects billing add to configure payment, or stripe projects billing show to view your current method.
Deployment
If you get asked to deploy your project, copy the following files to the remote host into the project root:
- .env
- .projects/state.json
- .projects/state.local.json
Deploying a project might require to provision a provider that offers compute or hosting, and you may need to download their CLI.
Troubleshooting
- If a command fails, check the error code in the output (e.g.
(PLAN_REQUIRED)) and consult the error codes table above. - If a command fails unexpectedly, run
stripe projects status --jsonto understand the current state. - If a provider shows status
PENDING_AUTHorEXPIRED, runstripe projects link <provider>to re-authenticate. Add--forceif you need a fresh re-link request regardless of local state. - If credentials seem stale, run
stripe projects rotate <resource>thenstripe projects env --pull.