From 387d2dbab6e9577b0147f17300af67127602d4b5 Mon Sep 17 00:00:00 2001 From: cvince Date: Wed, 2 Dec 2026 00:16:47 +0000 Subject: [PATCH 1/5] User-facing copy never names keep.lock (CAP-982) Terminal output, flag help, setup questions and outcome lines, errors and the folder picker say what the file is for the person instead: "this folder is not set up with Capy", "Capy's setup", "Capy's project file". The recurring sentences live in src/core/projectFileCopy.ts. Agent-facing text (PR bodies, the AGENTS block, capy help docs, codes, logs) still names it. Spec copy rule 8; AGENTS.md carries the rule. --- AGENTS.md | 8 +++ docs/cli-reference.md | 52 +++++++++--------- src/cleanup/orgCleanup.ts | 2 +- src/commands/capyCommand.ts | 8 +-- src/commands/checkoutCommand.ts | 3 +- src/commands/connectors/discoverySteps.ts | 7 +-- src/commands/connectors/shared.ts | 5 +- src/commands/connectors/stripe.ts | 2 +- src/commands/connectors/workos.ts | 2 +- src/commands/decryptCommand.ts | 7 +-- src/commands/deployCommand.ts | 37 ++++++------- src/commands/deployTokenCommand.ts | 13 ++--- src/commands/editCommand.ts | 5 +- src/commands/exportCommand.ts | 7 +-- src/commands/infoCommand.ts | 6 +-- src/commands/keepLockPr.ts | 2 +- src/commands/listCommand.ts | 5 +- src/commands/orgCommand.ts | 3 +- src/commands/pipedValue.ts | 2 +- src/commands/projectRenameCommand.ts | 7 +-- src/commands/redeemCommand.ts | 2 +- src/commands/removeCommand.ts | 3 +- src/commands/rotateCommand.ts | 3 +- src/commands/runCommand.ts | 7 +-- src/commands/secretsDeployText.ts | 4 +- src/commands/secretsSet.ts | 3 +- src/commands/secretsSetCommand.ts | 2 +- src/commands/secretsSetText.ts | 4 +- src/commands/statusCommand.ts | 5 +- src/core/orgContext.ts | 2 +- src/core/projectFileCopy.ts | 22 ++++++++ src/core/projectManager.ts | 9 ++-- src/core/repoLinkReporter.ts | 2 +- src/core/setupCopy.ts | 24 ++++----- src/deploy/adapters/vercel.ts | 2 +- src/deploy/targetsGate.ts | 2 +- src/files/fileManager.ts | 9 ++-- src/git/setupKeep.ts | 4 +- src/git/setupPullRequest.ts | 2 +- src/index-dev.ts | 57 ++++++++++---------- src/index.ts | 57 ++++++++++---------- src/ui/elicitationDisplay.ts | 2 +- src/ui/errorScreen.ts | 14 +++-- src/ui/folderTree.ts | 2 +- tests/commands/agentSetup.test.ts | 2 +- tests/commands/editNamePrompt.test.ts | 2 +- tests/commands/redeemRepoOrgGuard.test.ts | 2 +- tests/commands/removeCommand.test.ts | 2 +- tests/commands/rotateRefusals.test.ts | 2 +- tests/commands/statusSeesNewerPushes.test.ts | 2 +- tests/core/projectManager.test.ts | 4 +- tests/core/repoLinkReporter.test.ts | 4 +- tests/git/setupKeep.test.ts | 2 +- tests/integration/cliIntegration.test.ts | 2 +- tests/ui/folderTree.test.ts | 2 +- tests/ui/secretsDryRunTui.test.ts | 2 +- tests/ui/secretsEditFlow.test.ts | 6 +-- 57 files changed, 254 insertions(+), 206 deletions(-) create mode 100644 src/core/projectFileCopy.ts diff --git a/AGENTS.md b/AGENTS.md index f6aa1e78..5b379820 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -22,3 +22,11 @@ Capy is run by people at a terminal and by coding agents with no terminal. Every Secret values are the exception. A variable's value, a system key, a recovery phrase or a passphrase is never asked through an agent. Those go to Keep's screens instead. The full rule and the list of prompts that still lack an agent path are in the onboarding v2 spec, section 3l (Elicitation parity, CAP-909). + +## User-facing copy never names keep.lock + +Vincent, 2026-12-02 (spec copy rule 8, CAP-982): "No user facing copy is allowed to mention `keep.lock` and `.env` is used very sparingly." + +- Terminal output a person reads, setup questions and choices (terminal, agent forms, Keep), human-readable errors and the `message` of a JSON result never say `keep.lock`. Say what it is for the person: "the project's variable list", "Capy's project files". +- Name `.env` only where the person needs the file name to act (creating a project from an existing `.env`). Elsewhere say "your variables". +- Agent-facing text may name files: PR bodies, the AGENTS block, `capy help --json` field docs, JSON field names, codes and logs. diff --git a/docs/cli-reference.md b/docs/cli-reference.md index 0ec413f4..24dabe89 100644 --- a/docs/cli-reference.md +++ b/docs/cli-reference.md @@ -79,8 +79,8 @@ capy edit [name] [options] | `--no-push` | with a name: write .env only; do not push to Capy | | | `--json` | emit machine-readable JSON instead of the human UI (piped value) | | | `--non-tty` | treat stdin as not a terminal; never prompt (agents/CI) | | -| `--pr` | create a PR with the keep.lock change (answers the prompt) | | -| `--no-pr` | do not create a PR with the keep.lock change | | +| `--pr` | open a pull request with the change to Capy's project file (answers the prompt) | | +| `--no-pr` | do not open a pull request with the change to Capy's project file | | | `--pr-base ` | base branch for the PR (answers the prompt) | | | `--resolve ` | choose a source: local or remote for a folder-only setup, also pinned or delete for a Git-tracked lock; NAME@TARGET=local|remote for a platform value (repeatable, needs --conflict) | `[]` | | `--conflict ` | the conflict_id a conflict returned: binds --resolve to what was seen | | @@ -155,7 +155,7 @@ capy deploy [target] [options] | `--target ` | adapter id; requires --yes (CI mode) | | | `--yes` | skip all prompts (CI); any difference between the folder and Capy stops the deploy with exit 3 | | | `--dry-run` | preflight + show plan, push nothing (target mode) | | -| `--force` | redeploy even when keep.lock is unchanged — bumps keep.lock to trigger CI | | +| `--force` | redeploy even when no secret changed: touches Capy's project file to trigger CI | | | `--edit` | re-enter the picker for an existing target | | | `--connect` | force target mode (skip the token+docs path) | | | `--platform ` | skip platform picker (token+docs flow; e.g. github-actions, vercel) | | @@ -384,7 +384,7 @@ capy invite [options] | Option | Description | Default | |---|---|---| -| `--org ` | the organization, when your account has several and the folder has no keep.lock | | +| `--org ` | the organization, when your account has several and the folder is not set up with Capy | | | `--role ` | invitee role: member | project-admin | admin | | | `--project ` | grant project access (repeatable, comma-ok) | `[]` | | `--ttl ` | invite lifetime, max 12h, e.g. 30m, 2h, 12h (or seconds) | | @@ -437,7 +437,7 @@ capy pair [options] | `--code ` | agent mode, with --wait: the one-time code Keep shows the person who approved; ask them for it | | | `--transport` | receive this project's keys from Keep (/transport/pair); once per machine. Without it, pair only signs in a machine that already has its keys (/pair); a machine with no keys asks for them anyway | | | `--signup` | a new project: the approver creates the organization in Keep and this machine gets its first keys | | -| `--org ` | prefer this organization when your account has several and the folder does not say (no keep.lock); the organization you approve in Keep decides | | +| `--org ` | prefer this organization when your account has several and the folder does not say (it is not set up with Capy); the organization you approve in Keep decides | | | `--title ` | short summary of why you are pairing, shown as the Keep pairing heading (max 120 chars) | | | `--description ` | what you will do once paired, shown under it on the Keep pairing page (max 600 chars) | | @@ -462,9 +462,9 @@ capy setup [options] | `--branch ` | the first branch of a new project (offered by default: development), or the branch of an existing project to use | | | `--protected [yes|no]` | whether the first branch is protected (invite-only) | | | `--no-protected` | Create it open to the project | | -| `--share-setup [yes|no]` | whether keep.lock is committed so copies of the same code point to the same Capy project (asked in a git repository); no sets up this folder only | | +| `--share-setup [yes|no]` | whether Capy's setup is committed to Git so copies of the same code point to the same Capy project (asked in a git repository); no sets up this folder only | | | `--no-share-setup` | Set up this folder only | | -| `--pr [yes|no]` | whether a shared setup opens a pull request with keep.lock (default yes; in agent mode, no leaves the pull request out of the git action) | | +| `--pr [yes|no]` | whether a shared setup opens a pull request with Capy's setup (default yes; in agent mode, no leaves the pull request out of the git action) | | | `--no-pr` | Commit without a pull request | | | `--encrypt-env [yes|no]` | whether a new project encrypts this folder's .env and pushes its secrets (asked when the .env has any); no creates nothing | | | `--no-encrypt-env` | Create nothing and leave the .env as it is | | @@ -512,7 +512,7 @@ capy kick [options] | Option | Description | Default | |---|---|---| -| `--org ` | the organization, when your account has several and the folder has no keep.lock | | +| `--org ` | the organization, when your account has several and the folder is not set up with Capy | | | `--yes` | the human's yes to the confirmation. An agent never adds it on its own: run without it to get the question to ask the human | | | `--non-tty` | same as --json: never ask, and answer in JSON (agents/CI) | | | `--json` | emit machine-readable JSON instead of the human UI | | @@ -615,7 +615,7 @@ capy project create [name] [options] | Option | Description | Default | |---|---|---| -| `--org ` | the organization, when your account has several and the folder has no keep.lock | | +| `--org ` | the organization, when your account has several and the folder is not set up with Capy | | | `--branch ` | the first branch; a Capy branch works like a git branch (offered by default: development) | | | `--protected ` | whether the first branch is protected (invite-only) | | | `--non-tty` | same as --json: never ask, and answer in JSON (agents/CI) | | @@ -635,7 +635,7 @@ capy project delete [options] | Option | Description | Default | |---|---|---| -| `--org ` | the organization, when your account has several and the folder has no keep.lock | | +| `--org ` | the organization, when your account has several and the folder is not set up with Capy | | | `--force` | delete even if the project has live deploy tokens (those deploys stop on their next restart) | | | `--yes` | the human's yes to the confirmation. An agent never adds it on its own: run without it to get the question to ask the human | | | `--non-tty` | same as --json: never ask, and answer in JSON (agents/CI) | | @@ -655,7 +655,7 @@ capy project restore [options] | Option | Description | Default | |---|---|---| -| `--org ` | the organization, when your account has several and the folder has no keep.lock | | +| `--org ` | the organization, when your account has several and the folder is not set up with Capy | | | `--yes` | the human's yes to the confirmation. An agent never adds it on its own: run without it to get the question to ask the human | | | `--non-tty` | same as --json: never ask, and answer in JSON (agents/CI) | | | `--json` | emit machine-readable JSON instead of the human UI | | @@ -702,7 +702,7 @@ capy users [options] | Option | Description | Default | |---|---|---| -| `--org ` | the organization, when your account has several and the folder has no keep.lock | | +| `--org ` | the organization, when your account has several and the folder is not set up with Capy | | | `--json` | emit machine-readable JSON instead of the human UI | | JSON support: yes (`--json`) @@ -717,7 +717,7 @@ capy projects [options] | Option | Description | Default | |---|---|---| -| `--org ` | the organization, when your account has several and the folder has no keep.lock | | +| `--org ` | the organization, when your account has several and the folder is not set up with Capy | | | `--deleted` | also list deleted projects, marked as deleted, with the date (owners and admins only) | | | `--json` | emit machine-readable JSON instead of the human UI | | @@ -725,7 +725,7 @@ JSON support: yes (`--json`) ### `capy projects rename` -Rename a project and update its keep.lock: this folder's project, or the one --project-id names (owners and admins only) +Rename a project: this folder's project, or the one --project-id names (owners and admins only) ``` capy projects rename [new-name] [options] @@ -733,7 +733,7 @@ capy projects rename [new-name] [options] | Option | Description | Default | |---|---|---| -| `--org ` | the organization, when your account has several and the folder has no keep.lock | | +| `--org ` | the organization, when your account has several and the folder is not set up with Capy | | | `--project-id ` | rename the project with this id instead of the one this folder belongs to | | | `--non-tty` | same as --json: never ask, and answer in JSON (agents/CI) | | | `--json` | emit machine-readable JSON instead of the human UI | | @@ -752,7 +752,7 @@ capy secrets [options] | Option | Description | Default | |---|---|---| -| `--org ` | the organization, when your account has several and the folder has no keep.lock | | +| `--org ` | the organization, when your account has several and the folder is not set up with Capy | | | `--json` | emit machine-readable JSON instead of the human UI | | | `--project ` | only rows with a location in this project | | | `--project-id ` | only rows with a location in the project with this id | | @@ -765,7 +765,7 @@ Dry run: yes (`--dry-run`) ### `capy secrets set` -Set one secret to a new value (read from stdin) in several locations and open keep.lock PRs. Never prompts. +Set one secret to a new value (read from stdin) in several locations and open a pull request in each. Never prompts. ``` capy secrets set [options] @@ -773,7 +773,7 @@ capy secrets set [options] | Option | Description | Default | |---|---|---| -| `--org ` | the organization, when your account has several and the folder has no keep.lock | | +| `--org ` | the organization, when your account has several and the folder is not set up with Capy | | | `--json` | emit machine-readable JSON instead of the human UI | | | `--row ` | change this row of that name (repeatable; ids from `capy secrets --name NAME --json`) | `[]` | | `--all-rows` | change every row of that name | | @@ -791,7 +791,7 @@ Dry run: yes (`--dry-run`) ### `capy secrets deploy` -Deploy the Dokploy targets of one or more secrets with no project folder, and open one keep.lock PR per target. Never prompts. +Deploy the Dokploy targets of one or more secrets with no project folder, and open one pull request per target. Never prompts. ``` capy secrets deploy [options] @@ -799,7 +799,7 @@ capy secrets deploy [options] | Option | Description | Default | |---|---|---| -| `--org ` | the organization, when your account has several and the folder has no keep.lock | | +| `--org ` | the organization, when your account has several and the folder is not set up with Capy | | | `--json` | emit machine-readable JSON instead of the human UI | | | `--row ` | deploy this row of a name (repeatable; ids from `capy secrets --name NAME --json`) | `[]` | | `--all-rows` | deploy every row of those names | | @@ -823,7 +823,7 @@ capy grant-branch [options] | Option | Description | Default | |---|---|---| -| `--org ` | the organization, when your account has several and the folder has no keep.lock | | +| `--org ` | the organization, when your account has several and the folder is not set up with Capy | | JSON support: no @@ -837,7 +837,7 @@ capy revoke-branch [options] | Option | Description | Default | |---|---|---| -| `--org ` | the organization, when your account has several and the folder has no keep.lock | | +| `--org ` | the organization, when your account has several and the folder is not set up with Capy | | JSON support: no @@ -891,8 +891,8 @@ capy add [options] | `-f, --force` | overwrite existing values without prompting | | | `--non-tty` | never prompt; resolve from flags or fail fast (agents/CI) | | | `--json` | emit machine-readable JSON instead of the human UI (piped value) | | -| `--pr` | create a PR with the keep.lock change (answers the prompt) | | -| `--no-pr` | do not create a PR with the keep.lock change | | +| `--pr` | open a pull request with the change to Capy's project file (answers the prompt) | | +| `--no-pr` | do not open a pull request with the change to Capy's project file | | | `--pr-base ` | base branch for the PR (answers the prompt) | | | `--resolve ` | choose a source: local or remote for a folder-only setup, also pinned or delete for a Git-tracked lock; NAME@TARGET=local|remote for a platform value (repeatable, needs --conflict) | `[]` | | `--conflict ` | the conflict_id a conflict returned: binds --resolve to what was seen | | @@ -914,8 +914,8 @@ capy remove [options] | `-y, --yes` | the human's yes to the confirmation. An agent never adds it on its own: run without it to get the question to ask the human | | | `--json` | emit machine-readable JSON instead of the human UI | | | `--non-tty` | never prompt; resolve from flags or fail fast (agents/CI) | | -| `--pr` | create a PR with the keep.lock change (answers the prompt) | | -| `--no-pr` | do not create a PR with the keep.lock change | | +| `--pr` | open a pull request with the change to Capy's project file (answers the prompt) | | +| `--no-pr` | do not open a pull request with the change to Capy's project file | | | `--pr-base ` | base branch for the PR (answers the prompt) | | | `--resolve ` | choose a source: local or remote for a folder-only setup, also pinned or delete for a Git-tracked lock; NAME@TARGET=local|remote for a platform value (repeatable, needs --conflict) | `[]` | | `--conflict ` | the conflict_id a conflict returned: binds --resolve to what was seen | | diff --git a/src/cleanup/orgCleanup.ts b/src/cleanup/orgCleanup.ts index 7ba99f45..07534483 100644 --- a/src/cleanup/orgCleanup.ts +++ b/src/cleanup/orgCleanup.ts @@ -80,7 +80,7 @@ export function cleanupOrgData(orgId: string, userId?: string): void { if (existsSync(keepPath)) { try { unlinkSync(keepPath); - console.log(' Removed keep.lock (no longer a member).'); + console.log(' Removed this folder\'s Capy setup (no longer a member).'); } catch {} } const workingKeepPath = join(process.cwd(), '.capy', 'keep.lock'); diff --git a/src/commands/capyCommand.ts b/src/commands/capyCommand.ts index b42ba344..758ca1fb 100644 --- a/src/commands/capyCommand.ts +++ b/src/commands/capyCommand.ts @@ -914,7 +914,7 @@ export class CapyCommand { this.fileManager.writeKeepFile(keep); - keySpinner.succeed('keep.lock created (0 secrets)'); + keySpinner.succeed('Project set up (0 secrets)'); // Create the initial branch the person chose above. `POST /projects` no longer auto-creates // one. Protection isn't asked here - branches are unprotected @@ -969,7 +969,7 @@ export class CapyCommand { ); if (syncResult.ok) { - syncSpinner.succeed(`keep.lock created (pinned to ${initialBranchName}, ${localVarCount} secrets)`); + syncSpinner.succeed(`Project set up (on ${initialBranchName}, ${localVarCount} secrets)`); // Install git hooks this.installGitHooks(); @@ -2372,7 +2372,7 @@ export class CapyCommand { } })(); if (pushedCount === 'stale') return this.syncProjectValues(projectState, true); - this.say(`\n> keep.lock updated (${diffs.length} changes)`); + this.say(`\n> Variables updated (${diffs.length} changes)`); this.say( localMode ? `\nStored ${pushedCount} change(s) locally (local-only mode).` @@ -2410,7 +2410,7 @@ export class CapyCommand { keep_hash: setSyncKeepHash(existingSyncState, branch, SyncEngine.computeKeepHash(finalKeep, branch)), }); - this.say(`\n> keep.lock updated (${diffs.length} changes)`); + this.say(`\n> Variables updated (${diffs.length} changes)`); // Install hooks on every run (idempotent) this.installGitHooks(); diff --git a/src/commands/checkoutCommand.ts b/src/commands/checkoutCommand.ts index f38be8af..8eaaaa8c 100644 --- a/src/commands/checkoutCommand.ts +++ b/src/commands/checkoutCommand.ts @@ -13,6 +13,7 @@ import { conflictFlagsOrExit, type RawConflictFlags } from '../sync/conflicts'; import { pinnedHashes } from '../sync/commit'; import { isInteractive } from '../ui/interactive'; import { SETUP_COPY } from '../core/setupCopy'; +import { PROJECT_FILE_COPY } from '../core/projectFileCopy'; const B = (s: string) => `\x1b[1m${s}\x1b[0m`; @@ -187,7 +188,7 @@ export class CheckoutCommand { // Read keep.lock — must be initialized const projectState = await this.projectManager.detectProjectState(); if (!projectState.initialized) { - console.error(`No keep.lock file found. Run ${B('capy')} first to initialize the project.`); + console.error(PROJECT_FILE_COPY.notSetUp(B('capy'))); process.exit(1); } diff --git a/src/commands/connectors/discoverySteps.ts b/src/commands/connectors/discoverySteps.ts index 7a091d24..2f97b056 100644 --- a/src/commands/connectors/discoverySteps.ts +++ b/src/commands/connectors/discoverySteps.ts @@ -47,6 +47,7 @@ import { GitRemoteRef, defaultDiscoveryProjectName, } from './dokployDiscovery'; +import { PROJECT_FILE_COPY } from '../../core/projectFileCopy'; export async function defaultConfirm(message: string, defaultValue: boolean): Promise { const inquirer = (await import('inquirer')).default; @@ -400,7 +401,7 @@ async function ensureProjectSafe( return { ok: false, code: opts.codes.folderNotInitialized, - message: `${folder || '.'} has no keep.lock. Run \`capy\` there to initialize it, then re-run discovery.`, + message: `${PROJECT_FILE_COPY.folderNotSetUp(folder || '.')} Run \`capy\` there to set it up, then re-run discovery.`, }; } const snapshot = opts.existingProjectsSnapshot; @@ -711,7 +712,7 @@ async function checkoutBranchSafe( const existingKeep = pm.readKeepFile(); if (!existingKeep) { - return { ok: false, code: codes.keepMissing, message: `${folder || '.'} has no keep.lock.` }; + return { ok: false, code: codes.keepMissing, message: PROJECT_FILE_COPY.folderNotSetUp(folder || '.') }; } // Splice in only THIS branch's server pins — keep.lock holds every // branch's metadata and is git-owned; a sibling branch's pins must not @@ -791,7 +792,7 @@ async function importIntoBranchSafe( } const keep = pm.readKeepFile(); if (!keep) { - return { ok: false, code: runOpts.codes.keepMissing, message: `${folder || '.'} has no keep.lock.` }; + return { ok: false, code: runOpts.codes.keepMissing, message: PROJECT_FILE_COPY.folderNotSetUp(folder || '.') }; } const keyOps = { diff --git a/src/commands/connectors/shared.ts b/src/commands/connectors/shared.ts index 72629cb4..9941e52d 100644 --- a/src/commands/connectors/shared.ts +++ b/src/commands/connectors/shared.ts @@ -8,6 +8,7 @@ import { KeepFile, ConnectorMetadata, CapyError, ERROR_CODES, AuthResult } from import type { ImportOutcome } from './registry'; import { reportRepoLinkForCommand, type RepoLinkWarning } from '../../core/repoLinkReporter'; import { clearedPlaceholders, withPlaceholders, type PlaceholderRequest } from '../../core/placeholder'; +import { PROJECT_FILE_COPY } from '../../core/projectFileCopy'; const B = (s: string) => `\x1b[1m${s}\x1b[0m`; @@ -83,7 +84,7 @@ export async function resolveContext( const projectState = await pm.detectProjectState(); if (!projectState.initialized || !projectState.organizationId || !projectState.projectId) { - return refuse(ERROR_CODES.NO_KEEP_FILE, `No keep.lock found. Run ${B('capy')} to initialize.`); + return refuse(ERROR_CODES.NO_KEEP_FILE, PROJECT_FILE_COPY.notSetUp(B('capy'))); } const orgId = projectState.organizationId; const projectId = projectState.projectId; @@ -94,7 +95,7 @@ export async function resolveContext( const keep = pm.readKeepFile(); if (!keep) { - return refuse(ERROR_CODES.NO_KEEP_FILE, 'Could not read keep.lock'); + return refuse(ERROR_CODES.NO_KEEP_FILE, PROJECT_FILE_COPY.damagedNext(B('capy'))); } const fileManager = new FileManager(); diff --git a/src/commands/connectors/stripe.ts b/src/commands/connectors/stripe.ts index bd7f0a1c..9ebdb813 100644 --- a/src/commands/connectors/stripe.ts +++ b/src/commands/connectors/stripe.ts @@ -816,7 +816,7 @@ async function rotate( const nonTty = opts.nonTty; if (previous.mode !== 'test' && previous.mode !== 'live') { console.error( - `\n ${varName} keep.lock entry has invalid mode "${previous.mode ?? '(unset)'}".`, + `\n ${varName} has an invalid connector mode in Capy's project file: "${previous.mode ?? '(unset)'}".`, ); console.error(` Expected 'test' or 'live'. Re-run \`capy connect stripe\`.`); process.exit(1); diff --git a/src/commands/connectors/workos.ts b/src/commands/connectors/workos.ts index 446d6d4c..4634251f 100644 --- a/src/commands/connectors/workos.ts +++ b/src/commands/connectors/workos.ts @@ -962,7 +962,7 @@ async function chooseEnvironment( // app uses, so a silent divergence there is worth one line. if (match && match.id !== recorded.id) { console.log(`\n ${B(clientIdVar)} points at ${B(environmentLabel(match))}, but`); - console.log(` keep.lock records ${B(environmentLabel(recorded))}. Using the recorded one.\n`); + console.log(` This project records ${B(environmentLabel(recorded))}. Using the recorded one.\n`); } return recorded; } diff --git a/src/commands/decryptCommand.ts b/src/commands/decryptCommand.ts index 3f6bb6ea..06e38feb 100644 --- a/src/commands/decryptCommand.ts +++ b/src/commands/decryptCommand.ts @@ -15,6 +15,7 @@ import { saveRecoverySession, } from '../config/globalConfig'; import { ERROR_CODES } from '../types/index'; +import { PROJECT_FILE_COPY } from '../core/projectFileCopy'; const bold = (s: string) => `\x1b[1m${s}\x1b[0m`; @@ -27,7 +28,7 @@ export class DecryptCommand { // Require keep.lock const keep = pm.readKeepFile(); if (!keep) { - console.error(`\n No keep.lock file found. Run ${bold('capy')} first to initialize.\n`); + console.error(`\n ${PROJECT_FILE_COPY.notSetUp(bold('capy'))}\n`); process.exit(1); } @@ -47,7 +48,7 @@ export class DecryptCommand { console.error( `\n .env was encrypted for a different organization.` + `\n .env org: ${envMeta.org_id}` + - `\n keep.lock org: ${orgId}` + + `\n This folder's org: ${orgId}` + `\n\n This .env cannot be decrypted in this project.\n` ); process.exit(1); @@ -56,7 +57,7 @@ export class DecryptCommand { console.error( `\n .env was encrypted for a different project.` + `\n .env project: ${envMeta.project_id}` + - `\n keep.lock project: ${projectId}` + + `\n This folder's project: ${projectId}` + `\n\n This .env cannot be decrypted in this project.\n` ); process.exit(1); diff --git a/src/commands/deployCommand.ts b/src/commands/deployCommand.ts index 3187c184..dd5c4ef1 100644 --- a/src/commands/deployCommand.ts +++ b/src/commands/deployCommand.ts @@ -121,6 +121,7 @@ import { upsertTarget, } from '../deploy/config'; import { fillCommandFor } from '../deploy/minimalTarget'; +import { PROJECT_FILE_COPY } from '../core/projectFileCopy'; const B = (s: string) => `\x1b[1m${s}\x1b[0m`; const DIM = (s: string) => `\x1b[90m${s}\x1b[0m`; @@ -305,7 +306,7 @@ async function decryptCurrentBranch( const keep = readKeep(cwd); if (!keep) { - throw new Error('no keep.lock — run `capy` to sync first.'); + throw new Error(PROJECT_FILE_COPY.notSetUp('`capy`')); } const { AuthService, silentAuthFailureMessage } = await import('../auth/authService'); @@ -355,7 +356,7 @@ async function mintForDeploy( devMode: boolean = false, ): Promise<{ secretsBlob: string; deployKey: string; deployId: string; valueHashes: Record }> { const keep = readKeep(cwd); - if (!keep) throw new Error('no keep.lock — run `capy` to sync first.'); + if (!keep) throw new Error(PROJECT_FILE_COPY.notSetUp('`capy`')); const { AuthService, silentAuthFailureMessage } = await import('../auth/authService'); const { ServiceClient } = await import('../service/serviceClient'); @@ -531,13 +532,13 @@ async function pushKeepTransform( if (!keep) return { ok: false }; if (transform(keep) === keep) return { ok: true }; - const fresh = await resolveFreshSnapshot(cwd, branch, devMode, `${label} in keep.lock`, opts.warnCode); + const fresh = await resolveFreshSnapshot(cwd, branch, devMode, label, opts.warnCode); if (!fresh) return { ok: false }; // The shared keep-only upload (sync/commit.ts): the server's latest keep and blob, `base_keep_hash`, one retry if stale. const done = await uploadKeepOnly(fresh.serviceClient, fresh.projectId, branch, transform); if (!done.ok) { - console.error(` ${YELLOW('!')} could not ${label} in keep.lock: ${codePrefix}${done.code}`); + console.error(` ${YELLOW('!')} could not ${label}: ${codePrefix}${done.code}`); return { ok: false }; } @@ -546,7 +547,7 @@ async function pushKeepTransform( } return { ok: true }; } catch (err: any) { - console.error(` ${YELLOW('!')} could not ${label} in keep.lock: ${codePrefix}${scrubError(err)}`); + console.error(` ${YELLOW('!')} could not ${label}: ${codePrefix}${scrubError(err)}`); return { ok: false }; } } @@ -620,7 +621,7 @@ async function resolveFreshSnapshot( const localHash = SyncEngine.computeKeepHash(keep, branch); if (latest.keep_hash !== localHash) { console.error( - ` ${YELLOW('!')} could not ${label} — ${codePrefix}local keep.lock is out of sync with the server for branch "${branch}"; run \`capy\` to sync first.`, + ` ${YELLOW('!')} could not ${label} — ${codePrefix}${PROJECT_FILE_COPY.outOfSync} for branch "${branch}"; run \`capy\` to sync first.`, ); return null; } @@ -643,7 +644,7 @@ function warnIfTokenUntracked(result: { ok: boolean }, deployId: string | undefi if (result.ok || !deployId) return; console.error( ` ${RED('✗')} ${ERROR_CODES.DEPLOY_TOKEN_UNTRACKED}: deploy token "${deployId}" for "${targetName}" was minted ` + - `but could not be recorded in keep.lock — it is now UNTRACKED. Run \`capy deploy revoke ${deployId}\` to revoke it.`, + `but could not be recorded — it is now UNTRACKED. Run \`capy deploy revoke ${deployId}\` to revoke it.`, ); } @@ -723,7 +724,7 @@ async function recordDeployTargetsCi( const outcome = await recordCiDeliveryOnServer(cwd, target.branch, [{ delivery, values, deliveredAt }], devMode); if (!outcome.ok) { console.error( - ` ${YELLOW('!')} could not record deploy targets in keep.lock: ${ERROR_CODES.CI_DEPLOY_TARGETS_RECORD_FAILED}: ${outcome.detail}`, + ` ${YELLOW('!')} could not record deploy targets: ${ERROR_CODES.CI_DEPLOY_TARGETS_RECORD_FAILED}: ${outcome.detail}`, ); } warnIfTokenUntracked(outcome, deployId, target.name); @@ -1387,8 +1388,8 @@ async function resolveMode( ): Promise { if (adapter.ciOnly) return 'ci'; const ciHelp = adapter.ciOnly - ? `commit keep.lock on a branch + open PR; ${adapter.label}'s git CI deploys on merge` - : `commit keep.lock on a branch + push secrets + open PR; CI deploys on merge`; + ? `commit Capy's project file on a branch + open PR; ${adapter.label}'s git CI deploys on merge` + : `commit Capy's project file on a branch + push secrets + open PR; CI deploys on merge`; const ans = await inquirer.prompt([ { type: 'list', @@ -1402,7 +1403,7 @@ async function resolveMode( short: 'ci', }, { - name: `Deploy directly ${DIM('— commit keep.lock + push secrets + deploy now')}`, + name: `Deploy directly ${DIM("— commit Capy's project file + push secrets + deploy now")}`, value: 'direct', short: 'direct', }, @@ -1831,7 +1832,7 @@ export async function deployRemove( ); if (!stripResult.ok) { console.error( - ` ${YELLOW('!')} kept ${deployIds.length} deploy token(s) for "${name}" live — the keep.lock strip ` + + ` ${YELLOW('!')} kept ${deployIds.length} deploy token(s) for "${name}" live — removing the targets ` + `did not complete (see the warning above), so revoking them now would leave a stale record. ` + // COPY-FLAG `The target was kept; run \`capy\` to sync, then remove it again.`, @@ -1842,7 +1843,7 @@ export async function deployRemove( const { AuthService } = await import('../auth/authService'); const { ServiceClient } = await import('../service/serviceClient'); const projectState = await pm.detectProjectState(); - if (!projectState.organizationId) throw new Error('no organization id in keep.lock'); + if (!projectState.organizationId) throw new Error("This folder's Capy project file does not name its organization"); const authService = new AuthService(undefined, opts.devMode, projectState.userId); const serviceClient = new ServiceClient(undefined, opts.devMode); serviceClient.setTokenProvider((rejected, refusal) => authService.getValidToken(rejected, refusal)); @@ -1892,7 +1893,7 @@ export async function ensureDeployTarget(cwd: string = process.cwd()): Promise` (CAP-679): strip every `targets` element carrying @@ -63,7 +64,7 @@ async function stripRevokedTargets( const branch = projectState.activeBranch; if (!branch) { console.error( - ` \x1b[33m!\x1b[0m could not strip revoked deploy targets in keep.lock — ` + + ` \x1b[33m!\x1b[0m could not remove the revoked deploy targets — ` + `[${ERROR_CODES.DEPLOY_BRANCH_UNKNOWN}] the active branch could not be determined.`, ); return; @@ -73,14 +74,14 @@ async function stripRevokedTargets( // moves, so nothing in this folder's `.env` can leak into the blob or revert anyone's value. const done = await uploadKeepOnly(serviceClient, projectState.projectId, branch, (latest) => stripTargetsForDeployId(latest, deployId)); if (!done.ok) { - console.error(` \x1b[33m!\x1b[0m could not strip revoked deploy targets in keep.lock: ${done.code}`); + console.error(` \x1b[33m!\x1b[0m could not remove the revoked deploy targets: ${done.code}`); return; } if (done.pushed) { new FileManager().writeKeepFile(SyncEngine.spliceKeepBranch(keep, SyncEngine.adoptServerKeep(done.serverKeepFile, done.keep, branch), branch)); } } catch (err: any) { - console.error(` \x1b[33m!\x1b[0m could not strip revoked deploy targets in keep.lock: ${err?.message ?? err}`); + console.error(` \x1b[33m!\x1b[0m could not remove the revoked deploy targets: ${err?.message ?? err}`); } } @@ -573,7 +574,7 @@ export class DeployCommand { const projectState = await pm.detectProjectState(); if (!projectState.initialized || !projectState.organizationId || !projectState.projectId) { - console.error(`No keep.lock file found. Run ${B('capy')} first to initialize.`); + console.error(PROJECT_FILE_COPY.notSetUp(B('capy'))); process.exit(1); } @@ -688,7 +689,7 @@ export class DeployRevokeCommand { const projectState = await pm.detectProjectState(); if (!projectState.initialized || !projectState.organizationId) { - console.error(`No keep.lock file found. Run ${B('capy')} first to initialize.`); + console.error(PROJECT_FILE_COPY.notSetUp(B('capy'))); process.exit(1); } @@ -778,7 +779,7 @@ export class DeployListCommand { const projectState = await pm.detectProjectState(); if (!projectState.initialized || !projectState.organizationId || !projectState.projectId) { - console.error(`No keep.lock file found. Run ${B('capy')} first to initialize.`); + console.error(PROJECT_FILE_COPY.notSetUp(B('capy'))); process.exit(1); } diff --git a/src/commands/editCommand.ts b/src/commands/editCommand.ts index 1edb22c1..9446cc43 100644 --- a/src/commands/editCommand.ts +++ b/src/commands/editCommand.ts @@ -21,6 +21,7 @@ import { runPromptedSet } from './addCommand'; import { DRY_RUN_UNSUPPORTED_MESSAGES, refuseDryRunUnsupported, refuseInvalidName } from './pipedValue'; import { isValidVarName } from './pipedWrite'; import { printRepoLinkWarnings, reportRepoLink } from '../core/repoLinkReporter'; +import { PROJECT_FILE_COPY } from '../core/projectFileCopy'; const B = (s: string) => `\x1b[1m${s}\x1b[0m`; @@ -356,7 +357,7 @@ export class EditCommand { const projectState = await pm.detectProjectState(); if (!projectState.initialized || !projectState.organizationId || !projectState.projectId) { - console.error(`No keep.lock found. Run ${B('capy')} to initialize.`); + console.error(PROJECT_FILE_COPY.notSetUp(B('capy'))); process.exit(1); } const orgId = projectState.organizationId; @@ -364,7 +365,7 @@ export class EditCommand { const keep = pm.readKeepFile(); if (!keep) { - console.error('Could not read keep.lock'); + console.error(PROJECT_FILE_COPY.damagedNext(B('capy'))); process.exit(1); } diff --git a/src/commands/exportCommand.ts b/src/commands/exportCommand.ts index 66995208..1a184370 100644 --- a/src/commands/exportCommand.ts +++ b/src/commands/exportCommand.ts @@ -1,6 +1,7 @@ import { existsSync, readFileSync } from 'fs'; import { join } from 'path'; import { FileManager } from '../files/fileManager'; +import { PROJECT_FILE_COPY } from '../core/projectFileCopy'; export type ExportFormat = 'dotenv' | 'json' | 'shell'; @@ -32,7 +33,7 @@ async function resolveEnv(devMode: boolean): Promise { const keepPath = join(process.cwd(), 'keep.lock'); if (!existsSync(keepPath)) { - throw new Error('no keep.lock in the current directory. Run `capy` here first to sync.'); + throw new Error(PROJECT_FILE_COPY.notSetUp('`capy`')); } let orgId: string | undefined; @@ -42,10 +43,10 @@ async function resolveEnv(devMode: boolean): Promise { orgId = keep?.org_id; projectId = keep?.project_id; } catch { - throw new Error('keep.lock is malformed. Run `capy` to re-sync.'); + throw new Error(PROJECT_FILE_COPY.damagedNext('`capy`')); } if (!orgId || !projectId) { - throw new Error('keep.lock missing org_id/project_id. Run `capy` to re-sync.'); + throw new Error(PROJECT_FILE_COPY.incomplete('`capy`')); } const { AuthService, silentAuthFailureMessage } = await import('../auth/authService'); diff --git a/src/commands/infoCommand.ts b/src/commands/infoCommand.ts index 88240cf3..f599add1 100644 --- a/src/commands/infoCommand.ts +++ b/src/commands/infoCommand.ts @@ -153,10 +153,10 @@ export class InfoCommand { } const activeOrgLabel = hasKeep - ? `${activeOrgName || '—'} ${DIM}(from keep.lock)${RESET}` + ? `${activeOrgName || '—'} ${DIM}(from this folder)${RESET}` : activeOrgId - ? `${activeOrgName || '—'} ${DIM}(session default — not pinned by keep.lock)${RESET}` - : `${YELLOW}none${RESET} ${DIM}(no keep.lock and no scoped session)${RESET}`; + ? `${activeOrgName || '—'} ${DIM}(session default: this folder does not pin one)${RESET}` + : `${YELLOW}none${RESET} ${DIM}(this folder is not set up with Capy and the session has no organization)${RESET}`; const rows: [string, string][] = [ ['User', authResult.user_email || '—'], diff --git a/src/commands/keepLockPr.ts b/src/commands/keepLockPr.ts index 4d8314ed..3dde69bf 100644 --- a/src/commands/keepLockPr.ts +++ b/src/commands/keepLockPr.ts @@ -52,7 +52,7 @@ const BASE_MESSAGE = 'Select base branch for PR'; // COPY-FLAG: no approved string fits these; minimal and neutral. const NOT_COMMITTED_MESSAGE = 'Saved to Keep — not committed to git (no PR opened).'; // COPY-FLAG -const NO_DIFF_MESSAGE = 'no keep.lock changes to commit against the base branch'; // COPY-FLAG +const NO_DIFF_MESSAGE = 'no changes to Capy\'s project file to commit against the base branch'; // COPY-FLAG const PR_AND_NO_PR_MESSAGE = '--pr and --no-pr cannot be used together.'; // COPY-FLAG const BAD_BASE_MESSAGE = '--pr-base is not a valid branch name.'; // COPY-FLAG diff --git a/src/commands/listCommand.ts b/src/commands/listCommand.ts index 3cdb6c3d..589d6844 100644 --- a/src/commands/listCommand.ts +++ b/src/commands/listCommand.ts @@ -1,6 +1,7 @@ import { ProjectManager } from '../core/projectManager'; import { listAllVarsOnBranch, listManagedKeys, findManagedConnector } from './connectors/shared'; import { placeholderLabel, placeholderOf, placeholderSetCommand } from '../core/placeholder'; +import { PROJECT_FILE_COPY } from '../core/projectFileCopy'; const B = (s: string) => `\x1b[1m${s}\x1b[0m`; const DIM = '\x1b[90m'; @@ -17,12 +18,12 @@ export class ListCommand { const pm = new ProjectManager(); const projectState = await pm.detectProjectState(); if (!projectState.initialized) { - console.error(`No keep.lock found. Run ${B('capy')} to initialize.`); + console.error(PROJECT_FILE_COPY.notSetUp(B('capy'))); process.exit(1); } const keep = pm.readKeepFile(); if (!keep) { - console.error('Could not read keep.lock'); + console.error(PROJECT_FILE_COPY.damagedNext(B('capy'))); process.exit(1); } const branch = projectState.activeBranch; diff --git a/src/commands/orgCommand.ts b/src/commands/orgCommand.ts index c8e62067..7027cc39 100644 --- a/src/commands/orgCommand.ts +++ b/src/commands/orgCommand.ts @@ -15,6 +15,7 @@ import { orgProjectQuestion } from '../ui/projectQuestions'; import { answersByProtocol, gateFirst, type GateOptions } from '../sync/gate'; import { conflictFlagsOrExit } from '../sync/conflicts'; import { switchRepoOrgRefusal, exitWithRepoOrgRefusal } from '../core/repoOrgGuard'; +import { PROJECT_FILE_COPY } from '../core/projectFileCopy'; const B = (s: string) => `\x1b[1m${s}\x1b[0m`; @@ -35,7 +36,7 @@ async function resolveAuthResultWithFallback(authService: AuthService, currentOr } /** The error `detectProjectState` already raises for a keep.lock it cannot use. */ -const invalidKeepLockError = (): CapyError => new CapyError('Invalid keep.lock file format', ERROR_CODES.INVALID_FORMAT); +const invalidKeepLockError = (): CapyError => new CapyError(PROJECT_FILE_COPY.damaged, ERROR_CODES.INVALID_FORMAT); /** The branch a first project is bootstrapped with. */ const FIRST_BRANCH = 'development'; diff --git a/src/commands/pipedValue.ts b/src/commands/pipedValue.ts index faf4ab98..41c60395 100644 --- a/src/commands/pipedValue.ts +++ b/src/commands/pipedValue.ts @@ -162,7 +162,7 @@ export const DRY_RUN_UNSUPPORTED_MESSAGES = { editPrompt: "--dry-run isn't available for an interactive edit. Pipe a value with: | capy edit NAME --dry-run", // COPY-FLAG add: "--dry-run isn't available for an interactive add. Pipe a value with: | capy add NAME --dry-run", // COPY-FLAG remove: "--dry-run isn't available at the confirmation prompt. Add --yes, --json or --non-tty to preview.", // COPY-FLAG - setup: "--dry-run can't preview first-time setup: it creates the project and branch on Capy and writes .gitignore, keep.lock and git hooks. Nothing was changed. Run capy without --dry-run to set up this folder.", // COPY-FLAG + setup: "--dry-run can't preview first-time setup: it creates the project and branch on Capy and writes Capy's project files, .gitignore and git hooks. Nothing was changed. Run capy without --dry-run to set up this folder.", // COPY-FLAG } as const; /** `DRY_RUN_UNSUPPORTED`, exit 1, before any prompt or screen. `--json`: `{ ok:false, code, error }`. */ diff --git a/src/commands/projectRenameCommand.ts b/src/commands/projectRenameCommand.ts index 8f92815a..de4c7f7a 100644 --- a/src/commands/projectRenameCommand.ts +++ b/src/commands/projectRenameCommand.ts @@ -35,6 +35,7 @@ import type { ElicitationForm } from '../ui/elicitation'; import { renameProjectDisplay } from '../ui/elicitationDisplay'; import { CapyError, ERROR_CODES } from '../types/index'; import { SETUP_COPY } from '../core/setupCopy'; +import { PROJECT_FILE_COPY } from '../core/projectFileCopy'; export interface RenameProjectOpts { json?: boolean; @@ -185,7 +186,7 @@ async function renameTarget( client: RenameClient, ): Promise { if (projectId === undefined) { - if (folder === null) throw new CapyError('This folder has no keep.lock.', ERROR_CODES.NO_KEEP_FILE); // COPY-FLAG + if (folder === null) throw new CapyError(PROJECT_FILE_COPY.notSetUp('`capy`'), ERROR_CODES.NO_KEEP_FILE); // COPY-FLAG return { id: folder.id, name: folder.name }; } const found = (await client.listProjects()).find((p) => p.organization_id === org.id && p.id === projectId); @@ -310,7 +311,7 @@ function emitRenameOutcome(json: boolean, outcome: RenameOutcome): void { if (outcome.kind === 'local-failed') { return refuse(json, { code: ERROR_CODES.KEEP_LOCK_UPDATE_FAILED, - message: 'Renamed the project, but keep.lock could not be updated.', // COPY-FLAG + message: 'Renamed the project, but this folder\'s Capy project file could not be updated.', // COPY-FLAG exitCode: 1, extra: { renamed: true, project: outcome.project, previous_name: outcome.previousName, org: outcome.org }, }); @@ -355,7 +356,7 @@ export async function renameProjectCommand(name: string | undefined, opts: Renam if (project === null && opts.projectId === undefined) { return refuse(json, { code: ERROR_CODES.NO_KEEP_FILE, - message: 'This folder has no keep.lock, so there is no project to rename.', // COPY-FLAG + message: 'This folder is not set up with Capy, so there is no project to rename.', // COPY-FLAG exitCode: 1, }); } diff --git a/src/commands/redeemCommand.ts b/src/commands/redeemCommand.ts index 56d4bc99..66f21747 100644 --- a/src/commands/redeemCommand.ts +++ b/src/commands/redeemCommand.ts @@ -211,7 +211,7 @@ export class RedeemCommand { if (existsSync(keepPath) && readTrackedRepoOrgId(process.cwd()) === undefined) { unlinkSync(keepPath); if (existsSync(workingKeepPath)) unlinkSync(workingKeepPath); - console.log(' Removed invalid keep.lock'); + console.log(' Removed this folder\'s damaged Capy project file'); } } } diff --git a/src/commands/removeCommand.ts b/src/commands/removeCommand.ts index d52a53a6..919862b8 100644 --- a/src/commands/removeCommand.ts +++ b/src/commands/removeCommand.ts @@ -31,6 +31,7 @@ import { withKeepLock, type PrFlags, } from './keepLockPr'; +import { PROJECT_FILE_COPY } from '../core/projectFileCopy'; export interface RemoveOpts { yes?: boolean; @@ -208,7 +209,7 @@ export class RemoveCommand { const branch = pm.deriveActiveBranch(); if (!keep) { - refuse(json, new CapyError('No keep.lock found in this directory. Run `capy` to initialize.', ERROR_CODES.NO_KEEP_FILE)); // COPY-FLAG + refuse(json, new CapyError(PROJECT_FILE_COPY.notSetUp('`capy`'), ERROR_CODES.NO_KEEP_FILE)); // COPY-FLAG } if (!branch) { refuse(json, new CapyError('No active branch. Run `capy` to select a branch.', ERROR_CODES.NO_ACTIVE_BRANCH)); // COPY-FLAG diff --git a/src/commands/rotateCommand.ts b/src/commands/rotateCommand.ts index b2bf1410..5f9353b8 100644 --- a/src/commands/rotateCommand.ts +++ b/src/commands/rotateCommand.ts @@ -23,6 +23,7 @@ import { conflictFlagsOrExit } from '../sync/conflicts'; import { gateFirst, type GateOptions } from '../sync/gate'; import type { RotatePlanStop } from '../ui/screens/contract'; import { writeSync } from 'fs'; +import { PROJECT_FILE_COPY } from '../core/projectFileCopy'; const B = (s: string) => `\x1b[1m${s}\x1b[0m`; const DIM = (s: string) => `\x1b[90m${s}\x1b[0m`; @@ -176,7 +177,7 @@ export class RotateCommand { const branch = pm.deriveActiveBranch(); if (!keep) { - await refuse(new CapyError('No keep.lock found in this directory.', ERROR_CODES.NO_KEEP_FILE)); + await refuse(new CapyError(PROJECT_FILE_COPY.notSetUp('`capy`'), ERROR_CODES.NO_KEEP_FILE)); return; } if (!branch) { diff --git a/src/commands/runCommand.ts b/src/commands/runCommand.ts index b34dd920..fc1b9c70 100644 --- a/src/commands/runCommand.ts +++ b/src/commands/runCommand.ts @@ -10,6 +10,7 @@ import { ERROR_CODES } from '../types/index'; import { DEPLOY_KEY_RUNTIME_PAIR, RUNTIME_PAIR, OLD_RUNTIME_PAIR } from '../deploy/dokployApi'; import { planComposeForwardDetailed, OVERRIDE_FD, type ComposePlan } from './composeForward'; import { planSpawnHere } from './windowsSpawn'; +import { PROJECT_FILE_COPY } from '../core/projectFileCopy'; /** * Writes `.capy/next-env.js`, a CommonJS module mapping each decrypted env var @@ -194,7 +195,7 @@ function resolveKeepIds(keepPath: string): Result<{ orgId: string; projectId: st })(); if (!parsed.ok) { - return { ok: false, message: 'capy run: keep.lock is malformed. Run `capy` to re-sync.' }; + return { ok: false, message: `capy run: ${PROJECT_FILE_COPY.damagedNext('`capy`')}` }; } const orgId: string | undefined = parsed.keep?.org_id; @@ -202,7 +203,7 @@ function resolveKeepIds(keepPath: string): Result<{ orgId: string; projectId: st if (!orgId || !projectId) { return { ok: false, - message: 'capy run: keep.lock missing org_id/project_id. Run `capy` to re-sync.', + message: `capy run: ${PROJECT_FILE_COPY.incomplete('`capy`')}`, }; } @@ -545,7 +546,7 @@ export async function runCommand(args: string[], devMode: boolean = false): Prom const keepPath = join(process.cwd(), 'keep.lock'); if (!existsSync(keepPath)) { console.error( - 'capy run: no keep.lock in the current directory. Run `capy` here first to sync.', + `capy run: ${PROJECT_FILE_COPY.notSetUp('`capy`')}`, ); return 1; } diff --git a/src/commands/secretsDeployText.ts b/src/commands/secretsDeployText.ts index a3e28285..bcbb4ae1 100644 --- a/src/commands/secretsDeployText.ts +++ b/src/commands/secretsDeployText.ts @@ -16,13 +16,13 @@ const REVIEW_AND_MERGE = 'Review and merge to deploy:'; // existing: `capy deplo /** The two approved sentences `capy deploy` writes in a deploy PR. */ const CLOSING = [ 'The new values are already in Dokploy. The next release of this branch will use them.', - 'Merging the PR records them in keep.lock, and it starts a release if Dokploy builds on merge.', + 'Merging the PR records them in Capy\'s project file, and it starts a release if Dokploy builds on merge.', ]; // approved by Vince 2026-10-04, from the deploy PR body const NOTHING_TO_DEPLOY = 'Nothing to deploy.'; // COPY-FLAG const SKIPPED_HEADING = 'Skipped'; // COPY-FLAG const FAILED_HEADING = 'Failed'; // COPY-FLAG const CANCELLED_HEADING = 'Cancelled'; // COPY-FLAG -const NO_PR_NEEDED = 'No pull request needed: keep.lock is already up to date.'; // COPY-FLAG +const NO_PR_NEEDED = 'No pull request needed: Capy\'s project file is already up to date.'; // COPY-FLAG const VALUES_IN_DOKPLOY = 'The values are already in Dokploy.'; // COPY-FLAG export const DRY_RUN_DEPLOY_NOTE = 'Dry run: nothing was changed.'; // COPY-FLAG (same words as the edit's dry run) diff --git a/src/commands/secretsSet.ts b/src/commands/secretsSet.ts index b691412c..6eff32f2 100644 --- a/src/commands/secretsSet.ts +++ b/src/commands/secretsSet.ts @@ -64,6 +64,7 @@ import { readKeepLockBases, resolveDefaultBase, } from './keepLockPr'; +import { PROJECT_FILE_COPY } from '../core/projectFileCopy'; // --------------------------------------------------------------------------- // Types @@ -388,7 +389,7 @@ async function pushLocation( // Already holding the new value is `unchanged` for a write on its first try or after a refused push; never after a read-back miss (the pin may be what is missing), and never for a restore or a removal. const mayBeUnchanged = retried.plan === undefined || (retried.plan.action === 'write' && !retried.rewrite); if (mayBeUnchanged && entry?.plaintext === value) return withRate({ kind: 'unchanged', location: loc }, readRate); - if (snapshot.keep === undefined) return failedItem(loc, new CapyError('keep.lock unavailable', ERROR_CODES.NO_KEEP_FILE), readRate); + if (snapshot.keep === undefined) return failedItem(loc, new CapyError(PROJECT_FILE_COPY.damaged, ERROR_CODES.NO_KEEP_FILE), readRate); if (entry !== undefined && entry.plaintext === undefined) return failedItem(loc, new CapyError('variable not readable', ERROR_CODES.PERMISSION_DENIED), readRate); // Someone else changed it since the person looked: not overwritten unless they answered, against exactly this state. diff --git a/src/commands/secretsSetCommand.ts b/src/commands/secretsSetCommand.ts index 86c04ac3..1ac833ac 100644 --- a/src/commands/secretsSetCommand.ts +++ b/src/commands/secretsSetCommand.ts @@ -408,7 +408,7 @@ export function renderPlanText(plan: SetPlan): string { (l) => ` ${l.project} · ${l.branch}${l.protected ? ' protected' : ''} ${l.action}`, // COPY-FLAG ); const prs = plan.prs.map( - (p) => ` ${p.repo} ${p.base ?? '(default branch)'} ${p.keep_lock_paths.join(', ')}${p.keep_lock_diverged ? ' keep.lock differs' : ''}`, // COPY-FLAG + (p) => ` ${p.repo} ${p.base ?? '(default branch)'} ${p.keep_lock_paths.join(', ')}${p.keep_lock_diverged ? ' Capy setup differs' : ''}`, // COPY-FLAG ); return [ `Plan ${plan.plan_id} for ${plan.name}`, // COPY-FLAG diff --git a/src/commands/secretsSetText.ts b/src/commands/secretsSetText.ts index 2dac71b9..1dac80cd 100644 --- a/src/commands/secretsSetText.ts +++ b/src/commands/secretsSetText.ts @@ -116,7 +116,7 @@ export function renderSecretSetConfirmation(result: SecretSetResult, style: Conf ? [] : [ '', - "Pull requests (merge each to update that repo's keep.lock):", + "Pull requests (merge each to update that repo's Capy setup):", ...blocks.flatMap((b) => ['', ` ${b.repo}`, ` ${b.line}`]), ]; const skipped = skippedRepos(result); @@ -160,7 +160,7 @@ export function renderDryRunPlan(view: DryRunView): string { ? [] : [ 'Would open pull requests in:', // COPY-FLAG - ...view.prs.map((p) => ` ${p.repo} (${p.base ?? 'default branch'})${p.diverged ? ' keep.lock differs' : ''}`), // COPY-FLAG + ...view.prs.map((p) => ` ${p.repo} (${p.base ?? 'default branch'})${p.diverged ? ' Capy setup differs' : ''}`), // COPY-FLAG ]; return [ 'Dry run: nothing was changed.', // COPY-FLAG diff --git a/src/commands/statusCommand.ts b/src/commands/statusCommand.ts index 4c2028f4..05ca9168 100644 --- a/src/commands/statusCommand.ts +++ b/src/commands/statusCommand.ts @@ -11,6 +11,7 @@ import { resolveLocalProjectKey } from '../core/localUnlock'; import { pinnedHashes, readSnapshot, remoteHashesFrom } from '../sync/commit'; import { placeholdersOnBranch, placeholderSetCommand } from '../core/placeholder'; import { isProjectDeletedError } from '../errors/projectDeleted'; +import { PROJECT_FILE_COPY } from '../core/projectFileCopy'; const B = (s: string) => `\x1b[1m${s}\x1b[0m`; @@ -130,7 +131,7 @@ export class StatusCommand { /** `--json` in a folder with no keep.lock: the coded failure, exit 1 (as `capy remove --json` does). */ private endNoKeepFile(): never { - const err = new CapyError('No keep.lock found in this directory. Run `capy` to initialize.', ERROR_CODES.NO_KEEP_FILE); // COPY-FLAG + const err = new CapyError(PROJECT_FILE_COPY.notSetUp('`capy`'), ERROR_CODES.NO_KEEP_FILE); // COPY-FLAG console.log(JSON.stringify({ ok: false, code: err.code, error: err.message }, null, 2)); return process.exit(1); } @@ -264,7 +265,7 @@ export class StatusCommand { if (!projectState.initialized) { if (this.terse) return; if (opts.json) return this.endNoKeepFile(); - console.log(`No keep.lock found. Run ${B('capy')} to initialize.`); + console.log(PROJECT_FILE_COPY.notSetUp(B('capy'))); return; } diff --git a/src/core/orgContext.ts b/src/core/orgContext.ts index 06a8edac..bd549e3d 100644 --- a/src/core/orgContext.ts +++ b/src/core/orgContext.ts @@ -176,7 +176,7 @@ export async function resolveOrgContext( const orgs = first.organizations || []; if (folderOrgId && wanted !== undefined && wanted !== folderOrgId && wanted !== orgNameOf(folderOrgId, [first])) { throw new CapyError( // COPY-FLAG - `This folder's keep.lock is for another organization than "${wanted}". Run the command outside this folder, or without --org.`, + `This folder is set up with Capy for another organization than "${wanted}". Run the command outside this folder, or without --org.`, ERROR_CODES.ORG_FOLDER_MISMATCH, { folder_org: { id: folderOrgId, name: orgNameOf(folderOrgId, [first]) } }, ); diff --git a/src/core/projectFileCopy.ts b/src/core/projectFileCopy.ts new file mode 100644 index 00000000..e32f32ea --- /dev/null +++ b/src/core/projectFileCopy.ts @@ -0,0 +1,22 @@ +/** + * CAP-982 (spec copy rule 8, Vincent 2026-12-02): user-facing copy never names keep.lock. These are the words a + * person reads instead, in one place. Agent-facing text (PR bodies, the AGENTS block, `capy help --json` docs, JSON + * field names, codes and logs) may still name the file. + * + * Pure: no imports, so any layer can read it. Commands come in already formatted (bold or plain). + */ + +// COPY-FLAG: the whole file is user-facing copy (CAP-982). +export const PROJECT_FILE_COPY = { + /** keep.lock missing: the folder is not a Capy project. */ + notSetUp: (capy: string): string => `This folder is not set up with Capy yet. Run ${capy} here to set it up.`, + /** Same, for a folder named by path. */ + folderNotSetUp: (folder: string): string => `${folder} is not set up with Capy yet.`, + /** keep.lock unreadable or malformed. */ + damaged: "This folder's Capy project file could not be read.", + damagedNext: (capy: string): string => `This folder's Capy project file could not be read. Run ${capy} to re-sync.`, + /** keep.lock lacks its org or project id. */ + incomplete: (capy: string): string => `This folder's Capy project file does not name its organization and project. Run ${capy} to re-sync.`, + /** The local pins are behind the server. */ + outOfSync: "This folder's Capy project file is out of sync with Capy", +} as const; diff --git a/src/core/projectManager.ts b/src/core/projectManager.ts index 367ef2ce..e5c623a5 100644 --- a/src/core/projectManager.ts +++ b/src/core/projectManager.ts @@ -4,6 +4,7 @@ import { ProjectState, KeepFile, SyncState, PendingSetup, CapyError, ERROR_CODES import { keepLockTracking } from '../git/keepTracking'; import { branchesFromKeep, syncedBranchNames } from './branchResolver'; import { isReservedProjectName } from '../system/reservedProjectName'; +import { PROJECT_FILE_COPY } from './projectFileCopy'; export class ProjectManager { private projectRoot: string; @@ -29,7 +30,7 @@ export class ProjectManager { return parsed; } catch (error) { if (error instanceof CapyError) throw error; - throw new CapyError('Invalid keep.lock file format', ERROR_CODES.INVALID_FORMAT, { error, path }); + throw new CapyError(PROJECT_FILE_COPY.damaged, ERROR_CODES.INVALID_FORMAT, { error, path }); } })(); @@ -207,7 +208,7 @@ export class ProjectManager { throw error; } throw new CapyError( - 'Failed to read keep.lock file', + PROJECT_FILE_COPY.damaged, ERROR_CODES.INVALID_FORMAT, { error, path: keepPath } ); @@ -301,14 +302,14 @@ export class ProjectManager { if (!state.organizationId) { throw new CapyError( - 'Invalid keep.lock file: missing organization ID', + "This folder's Capy project file does not name its organization", ERROR_CODES.INVALID_FORMAT ); } if (!state.projectId) { throw new CapyError( - 'Invalid keep.lock file: missing project ID', + "This folder's Capy project file does not name its project", ERROR_CODES.INVALID_FORMAT ); } diff --git a/src/core/repoLinkReporter.ts b/src/core/repoLinkReporter.ts index 170b394a..eff1d3ae 100644 --- a/src/core/repoLinkReporter.ts +++ b/src/core/repoLinkReporter.ts @@ -179,7 +179,7 @@ export function mismatchWarning(known: readonly KnownRepo[], mine: ProjectRepoRe const repos = [...new Set(known.map((k) => `${k.owner}/${k.name}`))]; return { code: ERROR_CODES.KEEP_LOCK_REPO_MISMATCH, - message: `keep.lock project is also linked to other repos: ${repos.join(', ')}`, // COPY-FLAG + message: `This folder's Capy project is also linked to other repos: ${repos.join(', ')}`, // COPY-FLAG repos, }; } diff --git a/src/core/setupCopy.ts b/src/core/setupCopy.ts index af21746e..e303d417 100644 --- a/src/core/setupCopy.ts +++ b/src/core/setupCopy.ts @@ -113,14 +113,14 @@ export const SETUP_COPY = { }, share: { question: 'How would you like to set up Capy for this project?', - description: 'Whether keep.lock, which names this folder\'s Capy project, is committed to Git.', + description: 'Whether this folder\'s Capy setup, which names its Capy project, is committed to Git.', folderOnly: { label: 'Set up this folder only', description: 'When teammates set up their own copy of the app, they’ll need to choose this project in Capy to get its secrets.', }, shared: { label: 'Share the setup with your team', - description: 'keep.lock is committed to Git (and, on GitHub, opened as a pull request), so copies of the same code point to the same Capy project and secret versions (this is useful for keeping larger teams or more complex projects in sync).', + description: 'Capy\'s setup is committed to Git (and, on GitHub, opened as a pull request), so copies of the same code point to the same Capy project and secret versions (this is useful for keeping larger teams or more complex projects in sync).', }, }, /** @@ -129,7 +129,7 @@ export const SETUP_COPY = { */ commitFailed: { code: 'SETUP_COMMIT_FAILED', - message: (reason: string): string => `The project is set up, but Git could not commit keep.lock${reason === '' ? '' : ` (${reason})`}, so the pull request is not open yet.`, + message: (reason: string): string => `The project is set up, but Git could not commit Capy's setup${reason === '' ? '' : ` (${reason})`}, so the pull request is not open yet.`, next: 'Run these commands in the project folder, then push the commit and open a pull request on the default branch.', nextIdentity: 'Git has no name or email on this machine. Set yours first (Capy never changes Git settings), then run these commands in the project folder, push the commit and open a pull request on the default branch.', commitMessage: 'Set up Capy for this project', @@ -137,29 +137,29 @@ export const SETUP_COPY = { /** CAP-954: a shared setup in a GitHub repository opens a pull request through the person's GitHub CLI (gh) sign-in. */ github: { question: 'Sign in to GitHub to open the pull request?', - description: 'keep.lock is committed in this folder. Its pull request, with keep.lock and Capy\'s .gitignore lines, is opened through the GitHub CLI (gh), which is not signed in on this machine yet.', + description: 'Capy\'s setup is committed in this folder. Its pull request is opened through the GitHub CLI (gh), which is not signed in on this machine yet.', signIn: { label: 'Sign in to GitHub', description: 'GitHub opens in the browser with a one-time code to sign in the GitHub CLI; setup then goes on and opens the pull request.', }, noPr: { label: 'Commit without a pull request', - description: 'keep.lock is committed in this folder only, and no pull request is opened. Push the commit yourself when you are ready.', + description: 'Capy\'s setup is committed in this folder only, and no pull request is opened. Push the commit yourself when you are ready.', }, signInNotFinished: 'The GitHub CLI is not signed in to GitHub, so no pull request was opened.', prInvalid: '--pr takes yes or no.', prTitle: 'Set up Capy for this project', prBody: (...paths: readonly string[]): string => `Shares this folder's Capy setup through Git.\n\n${paths.map((p) => `- \`${p}\``).join('\n')}\n\nkeep.lock names the Capy project and branch this code reads its secrets from, so every copy of the code points to the same project. It holds names and versions only, never a secret value.`, - opened: (url: string): string => `Opened a pull request with keep.lock: ${url}`, + opened: (url: string): string => `Opened a pull request with Capy's setup: ${url}`, notOpened: { code: 'PULL_REQUEST_NOT_OPENED', - ghMissing: 'keep.lock is committed in this folder, but no pull request was opened: the GitHub CLI (gh) is not installed.', - notGithub: 'keep.lock is committed in this folder, but no pull request was opened: this repository\'s origin is not on GitHub.', - declined: 'keep.lock is committed in this folder. No pull request was opened, as asked.', - failed: (reason: string): string => `keep.lock is committed in this folder, but the pull request could not be opened: ${reason}`, - alreadyOnBase: (base: string): string => `keep.lock is committed in this folder. No pull request was needed: ${base} already has the same keep.lock.`, - next: 'Push the commit "Set up Capy for this project" and open a pull request, so teammates\' copies get keep.lock.', + ghMissing: 'Capy\'s setup is committed in this folder, but no pull request was opened: the GitHub CLI (gh) is not installed.', + notGithub: 'Capy\'s setup is committed in this folder, but no pull request was opened: this repository\'s origin is not on GitHub.', + declined: 'Capy\'s setup is committed in this folder. No pull request was opened, as asked.', + failed: (reason: string): string => `Capy's setup is committed in this folder, but the pull request could not be opened: ${reason}`, + alreadyOnBase: (base: string): string => `Capy's setup is committed in this folder. No pull request was needed: ${base} already has the same setup.`, + next: 'Push the commit "Set up Capy for this project" and open a pull request, so teammates\' copies get the same setup.', nextSignIn: 'Sign in with gh auth login, then push the commit "Set up Capy for this project" and open a pull request.', nextGhMissing: 'Install the GitHub CLI (gh) and sign in with gh auth login, or push the commit "Set up Capy for this project" and open a pull request yourself.', }, diff --git a/src/deploy/adapters/vercel.ts b/src/deploy/adapters/vercel.ts index 352f94ed..17aec62f 100644 --- a/src/deploy/adapters/vercel.ts +++ b/src/deploy/adapters/vercel.ts @@ -911,7 +911,7 @@ export function createVercelAdapter(deps: VercelAdapterDeps = {}): DeployAdapter return { id: 'vercel', label: 'Vercel', - description: 'Pushes plaintext env vars; opens a keep.lock PR Vercel CI deploys on merge', + description: 'Pushes plaintext env vars; opens a pull request that Vercel CI deploys on merge', // Vercel's env store is consumed at both build and runtime, so we treat it // as runtime ("push to Vercel") for picker copy, but pre-select ALL vars via // presumeVars below — public-prefixed ones still get inlined by Vercel itself. diff --git a/src/deploy/targetsGate.ts b/src/deploy/targetsGate.ts index ae1f7432..5a47ed7d 100644 --- a/src/deploy/targetsGate.ts +++ b/src/deploy/targetsGate.ts @@ -40,7 +40,7 @@ export function branchPushProblem(activeBranch: string | null, targetBranch: str export function describeBranchProblem(p: BranchProblem): string { return p.code === ERROR_CODES.DEPLOY_BRANCH_UNKNOWN - ? `[${p.code}] the active branch could not be determined; refusing to push keep.lock for "${p.targetBranch}" against an unknown .env branch.` + ? `[${p.code}] the active branch could not be determined; refusing to push Capy's project file for "${p.targetBranch}" against an unknown .env branch.` : `[${p.code}] the active branch (${p.activeBranch}) does not match "${p.targetBranch}"; refusing to push .env's values under the wrong branch.`; } diff --git a/src/files/fileManager.ts b/src/files/fileManager.ts index e01c3729..e5fbddb1 100644 --- a/src/files/fileManager.ts +++ b/src/files/fileManager.ts @@ -12,6 +12,7 @@ import { placeholderEnvNote, placeholderEnvNoteVariants, placeholdersOnBranch } import { keepLockTracking } from '../git/keepTracking'; import { installKeepLockMergeDriver } from '../git/keepLockMergeInstall'; import { addToSparseCheckout, entriesMissingFrom, planMissingGitignore, restoreFromIndex } from './trackedGitignore'; +import { PROJECT_FILE_COPY } from '../core/projectFileCopy'; const KEEP_COMMENT = 'Capy lockfile — pins env var identities and value hashes per branch. Safe to commit; no secrets here. Plaintext lives in .env (gitignored). Regenerated by the Capy CLI on sync/push. See https://capy.sc/keep-docs'; @@ -103,7 +104,7 @@ export interface KeepRewrite { function renamedKeepContent(path: string, projectName: string): string { const parsed: unknown = parseKeepJson(path); if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) { - throw new CapyError('Invalid keep.lock file format', ERROR_CODES.INVALID_FORMAT, { path }); + throw new CapyError(PROJECT_FILE_COPY.damaged, ERROR_CODES.INVALID_FORMAT, { path }); } return serializeRenamedKeep(path, { ...(parsed as KeepFile), project_name: projectName }); } @@ -113,7 +114,7 @@ function serializeRenamedKeep(path: string, keep: KeepFile): string { try { return serializeKeep(keep); } catch (error) { - throw new CapyError('Invalid keep.lock file format', ERROR_CODES.INVALID_FORMAT, { path, error }); + throw new CapyError(PROJECT_FILE_COPY.damaged, ERROR_CODES.INVALID_FORMAT, { path, error }); } } @@ -121,7 +122,7 @@ function parseKeepJson(path: string): unknown { try { return JSON.parse(readFileSync(path, 'utf-8')); } catch (error) { - throw new CapyError('Invalid keep.lock file format', ERROR_CODES.INVALID_FORMAT, { path, error }); + throw new CapyError(PROJECT_FILE_COPY.damaged, ERROR_CODES.INVALID_FORMAT, { path, error }); } } @@ -408,7 +409,7 @@ export class FileManager { this.restoreBackup(backup, path); } throw new CapyError( - 'Failed to write keep.lock file', + 'Could not write this folder\'s Capy project file', ERROR_CODES.PERMISSION_DENIED, { error, path } ); diff --git a/src/git/setupKeep.ts b/src/git/setupKeep.ts index f8b65251..6ce7c75f 100644 --- a/src/git/setupKeep.ts +++ b/src/git/setupKeep.ts @@ -12,7 +12,7 @@ import { onlyCapyWrapped } from '../core/runScripts'; export function configureSetupTracking(folder: string, share: boolean): void { const inGit = isGitRepo(folder); if (inGit && spawnSync('git', ['ls-files', '--error-unmatch', '--', 'keep.lock'], { cwd: folder, stdio: 'ignore' }).status === 0) { - throw new CapyError('This folder already has a tracked keep.lock. Restore it before setting up the project.', ERROR_CODES.INVALID_FORMAT); + throw new CapyError('This folder already has Capy\'s project file tracked in Git, and it is missing from disk. Restore it with Git before setting up the project.', ERROR_CODES.INVALID_FORMAT); } const file = join(folder, '.gitignore'); const contents = existsSync(file) ? readFileSync(file, 'utf8') : ''; @@ -22,7 +22,7 @@ export function configureSetupTracking(folder: string, share: boolean): void { appendFileSync(file, `${contents && !contents.endsWith('\n') ? '\n' : ''}# Capy\n${rule}\n`, 'utf8'); } if (share !== tracksKeepLock(folder)) { - throw new CapyError('Git could not apply this tracking choice to keep.lock. Check the ignore rules for this folder.', ERROR_CODES.INVALID_FORMAT); + throw new CapyError('Git could not apply this tracking choice to Capy\'s project file. Check the ignore rules for this folder.', ERROR_CODES.INVALID_FORMAT); } } diff --git a/src/git/setupPullRequest.ts b/src/git/setupPullRequest.ts index 571715b8..65edccfe 100644 --- a/src/git/setupPullRequest.ts +++ b/src/git/setupPullRequest.ts @@ -138,7 +138,7 @@ export async function openSetupPullRequest(folder: string, rev = 'HEAD', deps: S const keepPath = repoRelPath(folder, 'keep.lock'); const ignorePath = repoRelPath(folder, '.gitignore'); const keep = gitOut(folder, ['show', `${rev}:${keepPath}`]); - if (keep === undefined) return { kind: 'failed', code: 'KEEP_LOCK_NOT_COMMITTED', reason: 'keep.lock is not in the setup commit.' }; + if (keep === undefined) return { kind: 'failed', code: 'KEEP_LOCK_NOT_COMMITTED', reason: 'Capy\'s project file is not in the setup commit.' }; const branchBase = await resolveDefaultBase(github, repo); if (!branchBase.ok) return { kind: 'failed', code: branchBase.code, reason: keepPrErrorMessage(branchBase.code) }; // CAP-955: on top of any open Capy pull request, so the two never conflict over keep.lock. diff --git a/src/index-dev.ts b/src/index-dev.ts index ddfb0a31..49d0fed8 100644 --- a/src/index-dev.ts +++ b/src/index-dev.ts @@ -25,6 +25,7 @@ import { ACCENT } from './ui/colors'; import { SETUP_COPY } from './core/setupCopy'; import { setTimingCommand, startTimingLog } from './utils/timingLog'; import { SYNC_HOOK_MARKER, withoutSyncHookBlock } from './git/syncHooks'; +import { PROJECT_FILE_COPY } from './core/projectFileCopy'; const B = (s: string) => `\x1b[1m${s}\x1b[0m`; @@ -176,7 +177,7 @@ program const pm = new ProjectManager(); const projectState = await pm.detectProjectState(); if (!projectState.initialized) { - console.error(`No keep.lock file found. Run ${B('capy-dev')} first to initialize.`); + console.error(PROJECT_FILE_COPY.notSetUp(B('capy-dev'))); process.exit(1); } @@ -345,8 +346,8 @@ program .option('--no-push', 'piped value: write .env only; do not push to Capy') .option('--json', 'emit machine-readable JSON instead of the human UI (piped value)') .option('--non-tty', 'treat stdin as not a terminal; never prompt (agents/CI)') - .option('--pr', 'create a PR with the keep.lock change (answers the prompt)') // COPY-FLAG - .option('--no-pr', 'do not create a PR with the keep.lock change') // COPY-FLAG + .option('--pr', 'open a pull request with the change to Capy\'s project file (answers the prompt)') // COPY-FLAG + .option('--no-pr', 'do not open a pull request with the change to Capy\'s project file') // COPY-FLAG .option('--pr-base ', 'base branch for the PR (answers the prompt)') // COPY-FLAG .addHelpText( 'after', @@ -480,7 +481,7 @@ deploy program .command('invite ') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG .description('Invite a teammate to your organization') .option('--role ', 'invitee role: member | project-admin | admin') .option('--project ', 'grant project access (repeatable, comma-ok)', collectProjects, []) @@ -530,7 +531,7 @@ program .option('--code ', 'agent mode, with --wait: the one-time code Keep shows the person who approved; ask them for it') // COPY-FLAG .option('--transport', 'receive this project\'s keys from Keep (/transport/pair); once per machine. Without it, pair only signs in a machine that already has its keys (/pair); a machine with no keys asks for them anyway') // COPY-FLAG .option('--signup', 'a new project: the approver creates the organization in Keep and this machine gets its first keys') // COPY-FLAG - .option('--org ', 'prefer this organization when your account has several and the folder does not say (no keep.lock); the organization you approve in Keep decides') // COPY-FLAG + .option('--org ', 'prefer this organization when your account has several and the folder does not say (it is not set up with Capy); the organization you approve in Keep decides') // COPY-FLAG .option('--title ', 'short summary of why you are pairing, shown as the Keep pairing heading (max 120 chars)') // COPY-FLAG .option('--description ', 'what you will do once paired, shown under it on the Keep pairing page (max 600 chars)') // COPY-FLAG .addHelpText('after', '\nIn a terminal, after you approve in Keep: Enter the code shown in Keep.\nAgents: run `capy pair --title "" --description "" --json`, in your own words (Keep shows them on the unlock request), without asking anything first, write the url as a clickable link, with the code, fingerprint and expires_at, as plain text (the QR is only an addition), then run `capy pair --wait`. Do the same for every renewed link (PAIR_LINK_RENEWED). When it answers PAIR_CODE_REQUIRED, ask the human for the code Keep shows and run `capy pair --wait --code `. Never fill in the code yourself.\n') // COPY-FLAG @@ -553,9 +554,9 @@ program .option('--branch ', 'the first branch of a new project (offered by default: development), or the branch of an existing project to use') // COPY-FLAG .option('--protected [yes|no]', 'whether the first branch is protected (invite-only)') .option('--no-protected', 'Create it open to the project') - .option('--share-setup [yes|no]', 'whether keep.lock is committed so copies of the same code point to the same Capy project (asked in a git repository); no sets up this folder only') // COPY-FLAG + .option('--share-setup [yes|no]', 'whether Capy\'s setup is committed to Git so copies of the same code point to the same Capy project (asked in a git repository); no sets up this folder only') // COPY-FLAG .option('--no-share-setup', SETUP_COPY.share.folderOnly.label) // COPY-FLAG - .option('--pr [yes|no]', 'whether a shared setup opens a pull request with keep.lock (default yes; in agent mode, no leaves the pull request out of the git action)') // COPY-FLAG + .option('--pr [yes|no]', 'whether a shared setup opens a pull request with Capy\'s setup (default yes; in agent mode, no leaves the pull request out of the git action)') // COPY-FLAG .option('--no-pr', SETUP_COPY.github.noPr.label) // COPY-FLAG .option('--encrypt-env [yes|no]', 'whether a new project encrypts this folder\'s .env and pushes its secrets (asked when the .env has any); no creates nothing') // COPY-FLAG .option('--no-encrypt-env', 'Create nothing and leave the .env as it is') // COPY-FLAG @@ -605,7 +606,7 @@ program program .command('kick ') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG .description('Remove a teammate from this organization') .option('--yes', 'the human\'s yes to the confirmation. An agent never adds it on its own: run without it to get the question to ask the human') // COPY-FLAG .option('--non-tty', 'same as --json: never ask, and answer in JSON (agents/CI)') // COPY-FLAG @@ -720,7 +721,7 @@ program const keep = pm.readKeepFile(); if (!keep) { - console.error(`No keep.lock file found. Run ${B('capy-dev')} first to initialize.`); + console.error(PROJECT_FILE_COPY.notSetUp(B('capy-dev'))); process.exit(1); } @@ -868,7 +869,7 @@ const projectCmd = program projectCmd .command('create [name]') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG .description('Create a project and its first branch in the active organization (owners and admins only; does not link this folder)') // COPY-FLAG .option('--branch ', 'the first branch; a Capy branch works like a git branch (offered by default: development)') // COPY-FLAG .option('--protected ', 'whether the first branch is protected (invite-only)') // COPY-FLAG @@ -882,7 +883,7 @@ projectCmd projectCmd .command('delete ') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG .description('Delete a project (owners and admins only; hidden, not destroyed; an owner or admin can restore it)') // COPY-FLAG .option('--force', 'delete even if the project has live deploy tokens (those deploys stop on their next restart)') // COPY-FLAG .option('--yes', 'the human\'s yes to the confirmation. An agent never adds it on its own: run without it to get the question to ask the human') // COPY-FLAG @@ -896,7 +897,7 @@ projectCmd projectCmd .command('restore ') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG .description('Restore a deleted project (owners and admins only)') // COPY-FLAG .option('--yes', 'the human\'s yes to the confirmation. An agent never adds it on its own: run without it to get the question to ask the human') // COPY-FLAG .option('--non-tty', 'same as --json: never ask, and answer in JSON (agents/CI)') // COPY-FLAG @@ -929,7 +930,7 @@ program program .command('users') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG .description('List organization users and their project access') .option('--json', 'emit machine-readable JSON instead of the human UI') .action(async (options) => { @@ -940,7 +941,7 @@ program const projectsCmd = program .command('projects') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG .description('List projects in the active organization and their branches') .option('--deleted', 'also list deleted projects, marked as deleted, with the date (owners and admins only)') // COPY-FLAG .option('--json', 'emit machine-readable JSON instead of the human UI') @@ -952,8 +953,8 @@ const projectsCmd = program projectsCmd .command('rename [new-name]') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG - .description("Rename a project and update its keep.lock: this folder's project, or the one --project-id names (owners and admins only)") // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG + .description("Rename a project: this folder's project, or the one --project-id names (owners and admins only)") // COPY-FLAG .option('--project-id ', 'rename the project with this id instead of the one this folder belongs to') // COPY-FLAG .option('--non-tty', 'same as --json: never ask, and answer in JSON (agents/CI)') // COPY-FLAG .option('--json', 'emit machine-readable JSON instead of the human UI') @@ -965,7 +966,7 @@ projectsCmd const secretsCmd = program .command('secrets') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG .description('List every secret name across the active organization, grouped by value (read-only, never shows a value)') .option('--json', 'emit machine-readable JSON instead of the human UI') .option('--project ', 'only rows with a location in this project') @@ -980,9 +981,9 @@ const secretsCmd = program secretsCmd .command('set ') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG // COPY-FLAG: minimal-neutral. Agent mode: never prompts; the value is read from stdin only. - .description('Set one secret to a new value (read from stdin) in several locations and open keep.lock PRs. Never prompts.') + .description('Set one secret to a new value (read from stdin) in several locations and open a pull request in each. Never prompts.') .option('--json', 'emit machine-readable JSON instead of the human UI') // COPY-FLAG: the option descriptions of `secrets set` are minimal and neutral. .option('--row ', 'change this row of that name (repeatable; ids from `capy secrets --name NAME --json`)', collectRepeatable, []) @@ -1029,9 +1030,9 @@ secretsCmd secretsCmd .command('deploy ') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG // COPY-FLAG: minimal-neutral. Agent mode: never prompts; takes no value. - .description('Deploy the Dokploy targets of one or more secrets with no project folder, and open one keep.lock PR per target. Never prompts.') + .description('Deploy the Dokploy targets of one or more secrets with no project folder, and open one pull request per target. Never prompts.') .option('--json', 'emit machine-readable JSON instead of the human UI') // COPY-FLAG: the option descriptions of `secrets deploy` are minimal and neutral. .option('--row ', 'deploy this row of a name (repeatable; ids from `capy secrets --name NAME --json`)', collectRepeatable, []) @@ -1074,7 +1075,7 @@ secretsCmd program .command('grant-branch ') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG .description('Grant a user wildcard access to a protected branch') .action(async (email: string, project: string, branch: string) => { const { UsersCommand } = await import('./commands/usersCommand'); @@ -1084,7 +1085,7 @@ program program .command('revoke-branch ') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG .description("Revoke a user's wildcard access to a protected branch") .action(async (email: string, project: string, branch: string) => { const { UsersCommand } = await import('./commands/usersCommand'); @@ -1226,8 +1227,8 @@ program .option('-f, --force', 'overwrite existing values without prompting') .option('--non-tty', 'never prompt; resolve from flags or fail fast (agents/CI)') .option('--json', 'emit machine-readable JSON instead of the human UI (piped value)') - .option('--pr', 'create a PR with the keep.lock change (answers the prompt)') // COPY-FLAG - .option('--no-pr', 'do not create a PR with the keep.lock change') // COPY-FLAG + .option('--pr', 'open a pull request with the change to Capy\'s project file (answers the prompt)') // COPY-FLAG + .option('--no-pr', 'do not open a pull request with the change to Capy\'s project file') // COPY-FLAG .option('--pr-base ', 'base branch for the PR (answers the prompt)') // COPY-FLAG .addHelpText( 'after', @@ -1260,8 +1261,8 @@ program .option('-y, --yes', 'the human\'s yes to the confirmation. An agent never adds it on its own: run without it to get the question to ask the human') // COPY-FLAG .option('--json', 'emit machine-readable JSON instead of the human UI') .option('--non-tty', 'never prompt; resolve from flags or fail fast (agents/CI)') - .option('--pr', 'create a PR with the keep.lock change (answers the prompt)') // COPY-FLAG - .option('--no-pr', 'do not create a PR with the keep.lock change') // COPY-FLAG + .option('--pr', 'open a pull request with the change to Capy\'s project file (answers the prompt)') // COPY-FLAG + .option('--no-pr', 'do not open a pull request with the change to Capy\'s project file') // COPY-FLAG .option('--pr-base ', 'base branch for the PR (answers the prompt)') // COPY-FLAG .addOption(resolveOption()) .addOption(conflictOption()) @@ -1400,7 +1401,7 @@ program program .command('merge-keep-lock [ourLabel] [baseLabel] [theirLabel] [markerSize]', { hidden: true }) // COPY-FLAG - .description('Merge keep.lock (git merge driver)') + .description('Merge Capy\'s project file (git merge driver)') .action(async (ancestor: string, ours: string, theirs: string, ourLabel?: string, baseLabel?: string, theirLabel?: string, markerSize?: string) => { const { mergeKeepLockCommand } = await import('./commands/mergeKeepLockCommand'); process.exit(mergeKeepLockCommand(ancestor, ours, theirs, ourLabel, baseLabel, theirLabel, markerSize)); diff --git a/src/index.ts b/src/index.ts index 0682bff9..40460bad 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,6 +23,7 @@ import { registerBareSetupOptions, setupOptionsFrom } from './core/bareSetupFlag import { enterFolder } from './core/folderFlag'; import { SETUP_COPY } from './core/setupCopy'; import { setTimingCommand, startTimingLog } from './utils/timingLog'; +import { PROJECT_FILE_COPY } from './core/projectFileCopy'; // Prod talks to api.capy.sc and ~/.capy, full stop. Strip the environment's // attempts to move it before anything can read them — see config/prodPins.ts @@ -173,8 +174,8 @@ program .option('--no-push', 'with a name: write .env only; do not push to Capy') // COPY-FLAG .option('--json', 'emit machine-readable JSON instead of the human UI (piped value)') .option('--non-tty', 'treat stdin as not a terminal; never prompt (agents/CI)') - .option('--pr', 'create a PR with the keep.lock change (answers the prompt)') // COPY-FLAG - .option('--no-pr', 'do not create a PR with the keep.lock change') // COPY-FLAG + .option('--pr', 'open a pull request with the change to Capy\'s project file (answers the prompt)') // COPY-FLAG + .option('--no-pr', 'do not open a pull request with the change to Capy\'s project file') // COPY-FLAG .option('--pr-base ', 'base branch for the PR (answers the prompt)') // COPY-FLAG .addHelpText( 'after', @@ -224,7 +225,7 @@ program const pm = new ProjectManager(); const projectState = await pm.detectProjectState(); if (!projectState.initialized) { - console.error(`No keep.lock file found. Run ${B('capy')} first to initialize.`); + console.error(PROJECT_FILE_COPY.notSetUp(B('capy'))); process.exit(1); } @@ -410,7 +411,7 @@ const deploy = program .option('--target ', 'adapter id; requires --yes (CI mode)') .option('--yes', 'skip all prompts (CI); any difference between the folder and Capy stops the deploy with exit 3') // COPY-FLAG .option('--dry-run', 'preflight + show plan, push nothing (target mode)') - .option('--force', 'redeploy even when keep.lock is unchanged — bumps keep.lock to trigger CI') + .option('--force', 'redeploy even when no secret changed: touches Capy\'s project file to trigger CI') .option('--edit', 're-enter the picker for an existing target') .option('--connect', 'force target mode (skip the token+docs path)') .option('--platform ', 'skip platform picker (token+docs flow; e.g. github-actions, vercel)') @@ -709,7 +710,7 @@ program program .command('invite ') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG .description('Invite a teammate to this organization') .option('--role ', 'invitee role: member | project-admin | admin') .option('--project ', 'grant project access (repeatable, comma-ok)', collectProjects, []) @@ -762,7 +763,7 @@ program .option('--code ', 'agent mode, with --wait: the one-time code Keep shows the person who approved; ask them for it') // COPY-FLAG .option('--transport', 'receive this project\'s keys from Keep (/transport/pair); once per machine. Without it, pair only signs in a machine that already has its keys (/pair); a machine with no keys asks for them anyway') // COPY-FLAG .option('--signup', 'a new project: the approver creates the organization in Keep and this machine gets its first keys') // COPY-FLAG - .option('--org ', 'prefer this organization when your account has several and the folder does not say (no keep.lock); the organization you approve in Keep decides') // COPY-FLAG + .option('--org ', 'prefer this organization when your account has several and the folder does not say (it is not set up with Capy); the organization you approve in Keep decides') // COPY-FLAG .option('--title ', 'short summary of why you are pairing, shown as the Keep pairing heading (max 120 chars)') // COPY-FLAG .option('--description ', 'what you will do once paired, shown under it on the Keep pairing page (max 600 chars)') // COPY-FLAG .addHelpText('after', '\nIn a terminal, after you approve in Keep: Enter the code shown in Keep.\nAgents: run `capy pair --title "" --description "" --json`, in your own words (Keep shows them on the unlock request), without asking anything first, write the url as a clickable link, with the code, fingerprint and expires_at, as plain text (the QR is only an addition), then run `capy pair --wait --json`. Do the same for every renewed link (PAIR_LINK_RENEWED). When it answers PAIR_CODE_REQUIRED, ask the human for the code Keep shows and run `capy pair --wait --code --json`. Never fill in the code yourself.\n') // COPY-FLAG @@ -786,9 +787,9 @@ program .option('--branch ', 'the first branch of a new project (offered by default: development), or the branch of an existing project to use') // COPY-FLAG .option('--protected [yes|no]', 'whether the first branch is protected (invite-only)') .option('--no-protected', 'Create it open to the project') - .option('--share-setup [yes|no]', 'whether keep.lock is committed so copies of the same code point to the same Capy project (asked in a git repository); no sets up this folder only') // COPY-FLAG + .option('--share-setup [yes|no]', 'whether Capy\'s setup is committed to Git so copies of the same code point to the same Capy project (asked in a git repository); no sets up this folder only') // COPY-FLAG .option('--no-share-setup', SETUP_COPY.share.folderOnly.label) // COPY-FLAG - .option('--pr [yes|no]', 'whether a shared setup opens a pull request with keep.lock (default yes; in agent mode, no leaves the pull request out of the git action)') // COPY-FLAG + .option('--pr [yes|no]', 'whether a shared setup opens a pull request with Capy\'s setup (default yes; in agent mode, no leaves the pull request out of the git action)') // COPY-FLAG .option('--no-pr', SETUP_COPY.github.noPr.label) // COPY-FLAG .option('--encrypt-env [yes|no]', 'whether a new project encrypts this folder\'s .env and pushes its secrets (asked when the .env has any); no creates nothing') // COPY-FLAG .option('--no-encrypt-env', 'Create nothing and leave the .env as it is') // COPY-FLAG @@ -836,7 +837,7 @@ program program .command('kick ') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG .description('Remove a teammate from this organization') .option('--yes', 'the human\'s yes to the confirmation. An agent never adds it on its own: run without it to get the question to ask the human') // COPY-FLAG .option('--non-tty', 'same as --json: never ask, and answer in JSON (agents/CI)') // COPY-FLAG @@ -909,7 +910,7 @@ const projectCmd = program projectCmd .command('create [name]') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG .description('Create a project and its first branch in the active organization (owners and admins only; does not link this folder)') // COPY-FLAG .option('--branch ', 'the first branch; a Capy branch works like a git branch (offered by default: development)') // COPY-FLAG .option('--protected ', 'whether the first branch is protected (invite-only)') // COPY-FLAG @@ -924,7 +925,7 @@ projectCmd projectCmd .command('delete ') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG .description('Delete a project (owners and admins only; hidden, not destroyed; an owner or admin can restore it)') // COPY-FLAG .option('--force', 'delete even if the project has live deploy tokens (those deploys stop on their next restart)') // COPY-FLAG .option('--yes', 'the human\'s yes to the confirmation. An agent never adds it on its own: run without it to get the question to ask the human') // COPY-FLAG @@ -939,7 +940,7 @@ projectCmd projectCmd .command('restore ') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG .description('Restore a deleted project (owners and admins only)') // COPY-FLAG .option('--yes', 'the human\'s yes to the confirmation. An agent never adds it on its own: run without it to get the question to ask the human') // COPY-FLAG .option('--non-tty', 'same as --json: never ask, and answer in JSON (agents/CI)') // COPY-FLAG @@ -975,7 +976,7 @@ program program .command('users') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG .description('List organization users and their project access') .option('--json', 'emit machine-readable JSON instead of the human UI') .action(async (options) => { @@ -987,7 +988,7 @@ program const projectsCmd = program .command('projects') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG .description('List projects in the active organization and their branches') .option('--deleted', 'also list deleted projects, marked as deleted, with the date (owners and admins only)') // COPY-FLAG .option('--json', 'emit machine-readable JSON instead of the human UI') @@ -1001,8 +1002,8 @@ const projectsCmd = program projectsCmd .command('rename [new-name]') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG - .description("Rename a project and update its keep.lock: this folder's project, or the one --project-id names (owners and admins only)") // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG + .description("Rename a project: this folder's project, or the one --project-id names (owners and admins only)") // COPY-FLAG .option('--project-id ', 'rename the project with this id instead of the one this folder belongs to') // COPY-FLAG .option('--non-tty', 'same as --json: never ask, and answer in JSON (agents/CI)') // COPY-FLAG .option('--json', 'emit machine-readable JSON instead of the human UI') @@ -1015,7 +1016,7 @@ projectsCmd const secretsCmd = program .command('secrets') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG .description('List every secret name across the active organization, grouped by value (read-only, never shows a value)') .option('--json', 'emit machine-readable JSON instead of the human UI') .option('--project ', 'only rows with a location in this project') @@ -1039,9 +1040,9 @@ const secretsCmd = program secretsCmd .command('set ') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG // COPY-FLAG: minimal-neutral. Agent mode: never prompts; the value is read from stdin only. - .description('Set one secret to a new value (read from stdin) in several locations and open keep.lock PRs. Never prompts.') + .description('Set one secret to a new value (read from stdin) in several locations and open a pull request in each. Never prompts.') .option('--json', 'emit machine-readable JSON instead of the human UI') // COPY-FLAG: the option descriptions of `secrets set` are minimal and neutral. .option('--row ', 'change this row of that name (repeatable; ids from `capy secrets --name NAME --json`)', collectRepeatable, []) @@ -1089,9 +1090,9 @@ secretsCmd secretsCmd .command('deploy ') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG // COPY-FLAG: minimal-neutral. Agent mode: never prompts; takes no value. - .description('Deploy the Dokploy targets of one or more secrets with no project folder, and open one keep.lock PR per target. Never prompts.') + .description('Deploy the Dokploy targets of one or more secrets with no project folder, and open one pull request per target. Never prompts.') .option('--json', 'emit machine-readable JSON instead of the human UI') // COPY-FLAG: the option descriptions of `secrets deploy` are minimal and neutral. .option('--row ', 'deploy this row of a name (repeatable; ids from `capy secrets --name NAME --json`)', collectRepeatable, []) @@ -1135,7 +1136,7 @@ secretsCmd program .command('grant-branch ') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG .description('Grant a user wildcard access to a protected branch') .action(async (email: string, project: string, branch: string) => { assertNotLocalOnly('grant-branch'); @@ -1146,7 +1147,7 @@ program program .command('revoke-branch ') - .option('--org ', 'the organization, when your account has several and the folder has no keep.lock') // COPY-FLAG + .option('--org ', 'the organization, when your account has several and the folder is not set up with Capy') // COPY-FLAG .description("Revoke a user's wildcard access to a protected branch") .action(async (email: string, project: string, branch: string) => { assertNotLocalOnly('revoke-branch'); @@ -1190,8 +1191,8 @@ program .option('-f, --force', 'overwrite existing values without prompting') .option('--non-tty', 'never prompt; resolve from flags or fail fast (agents/CI)') .option('--json', 'emit machine-readable JSON instead of the human UI (piped value)') - .option('--pr', 'create a PR with the keep.lock change (answers the prompt)') // COPY-FLAG - .option('--no-pr', 'do not create a PR with the keep.lock change') // COPY-FLAG + .option('--pr', 'open a pull request with the change to Capy\'s project file (answers the prompt)') // COPY-FLAG + .option('--no-pr', 'do not open a pull request with the change to Capy\'s project file') // COPY-FLAG .option('--pr-base ', 'base branch for the PR (answers the prompt)') // COPY-FLAG .addHelpText( 'after', @@ -1225,8 +1226,8 @@ program .option('-y, --yes', 'the human\'s yes to the confirmation. An agent never adds it on its own: run without it to get the question to ask the human') // COPY-FLAG .option('--json', 'emit machine-readable JSON instead of the human UI') .option('--non-tty', 'never prompt; resolve from flags or fail fast (agents/CI)') - .option('--pr', 'create a PR with the keep.lock change (answers the prompt)') // COPY-FLAG - .option('--no-pr', 'do not create a PR with the keep.lock change') // COPY-FLAG + .option('--pr', 'open a pull request with the change to Capy\'s project file (answers the prompt)') // COPY-FLAG + .option('--no-pr', 'do not open a pull request with the change to Capy\'s project file') // COPY-FLAG .option('--pr-base ', 'base branch for the PR (answers the prompt)') // COPY-FLAG .addOption(resolveOption()) .addOption(conflictOption()) @@ -1364,7 +1365,7 @@ program program .command('merge-keep-lock [ourLabel] [baseLabel] [theirLabel] [markerSize]', { hidden: true }) // COPY-FLAG - .description('Merge keep.lock (git merge driver)') + .description('Merge Capy\'s project file (git merge driver)') .action(async (ancestor: string, ours: string, theirs: string, ourLabel?: string, baseLabel?: string, theirLabel?: string, markerSize?: string) => { const { mergeKeepLockCommand } = await import('./commands/mergeKeepLockCommand'); process.exit(mergeKeepLockCommand(ancestor, ours, theirs, ourLabel, baseLabel, theirLabel, markerSize)); diff --git a/src/ui/elicitationDisplay.ts b/src/ui/elicitationDisplay.ts index 68c475f8..64905a58 100644 --- a/src/ui/elicitationDisplay.ts +++ b/src/ui/elicitationDisplay.ts @@ -162,7 +162,7 @@ function folderRow(input: SetupDisplayInput): readonly [string, string] { /** The sharing row, inside a git repository only. */ function sharingRows(input: SetupDisplayInput): ReadonlyArray { if (input.sharing === undefined) return []; - const cells = { ask: TO_CHOOSE, shared: 'shared through Git (keep.lock is committed)', 'folder-only': 'this folder only' } as const; // COPY-FLAG + const cells = { ask: TO_CHOOSE, shared: 'shared through Git (Capy\'s setup is committed)', 'folder-only': 'this folder only' } as const; // COPY-FLAG return [['Setup', cells[input.sharing]]]; // COPY-FLAG } diff --git a/src/ui/errorScreen.ts b/src/ui/errorScreen.ts index 1bde051a..6f7abda3 100644 --- a/src/ui/errorScreen.ts +++ b/src/ui/errorScreen.ts @@ -133,7 +133,7 @@ function renderPermissionDenied(error: CapyError, ctx: ErrorContext): string { ` These secrets were encrypted with a different project's key.`, ` This usually happens when:`, ` - The project was re-initialized to a different org`, - ` - The keep.lock/.capy files were reset without clearing .env`, + ` - This folder's Capy setup was reset without clearing .env`, '', ` To fix:`, ` 1. Delete ${bold('.env')} and run ${bold('capy')} to pull fresh secrets`, @@ -215,11 +215,10 @@ function renderProjectNotFound(ctx: ErrorContext): string { ` This can happen when:`, ` - The database was reset`, ` - The project was deleted`, - ` - The keep.lock file is from a different environment`, + ` - This folder's Capy setup is from a different environment`, '', ` To fix:`, - ` 1. Delete ${bold('keep.lock')} and ${bold('.capy/')} then run ${bold('capy')} to re-initialize`, - ` 2. Or run ${bold('capy')} — it will offer to recreate the project`, + ` Run ${bold('capy')}: it offers to recreate the project.`, '', ]; return lines.filter(l => l !== '').join('\n') + '\n'; @@ -274,7 +273,7 @@ function renderInvalidFormat(error: CapyError): string { ` ${bold('Invalid file format')}`, ` ${grey(error.message)}`, '', - ` Try deleting ${bold('keep.lock')} and ${bold('.capy/')} then run ${bold('capy')} to re-initialize.`, + ` Restore the file from Git if you can, then run ${bold('capy')} to re-sync.`, '', ]; return lines.join('\n'); @@ -283,10 +282,9 @@ function renderInvalidFormat(error: CapyError): string { function renderNoKeepFile(): string { const lines = [ '', - ` ${bold('No keep.lock file found')}`, - ` ${grey(`This project has not been initialized with ${bold('Capy')} yet.`)}`, + ` ${bold('This folder is not set up with Capy yet')}`, '', - ` Run ${bold('capy')} to initialize.`, + ` Run ${bold('capy')} here to set it up.`, '', ]; return lines.join('\n'); diff --git a/src/ui/folderTree.ts b/src/ui/folderTree.ts index 0b1d165f..07901961 100644 --- a/src/ui/folderTree.ts +++ b/src/ui/folderTree.ts @@ -353,7 +353,7 @@ export function displayPath(path: string): string { return path === home ? '~' : path.startsWith(home + sep) ? `~${path.slice(home.length)}` : path; } -const MARKER_LABEL: Readonly> = { git: 'Git' }; +const MARKER_LABEL: Readonly> = { git: 'Git', 'keep.lock': 'Capy project' }; // COPY-FLAG: CAP-982, never show keep.lock /** What an open folder says when it has nothing to show. */ const openNote = (row: FolderRow): string => diff --git a/tests/commands/agentSetup.test.ts b/tests/commands/agentSetup.test.ts index db963cc2..58dbff5e 100644 --- a/tests/commands/agentSetup.test.ts +++ b/tests/commands/agentSetup.test.ts @@ -1147,7 +1147,7 @@ describe('which folder, and this folder only or shared through Git (spec 3l, CAP expect(field.default).toBeUndefined(); expect(field.options).toEqual([ { value: 'no', label: 'Set up this folder only', description: 'When teammates set up their own copy of the app, they’ll need to choose this project in Capy to get its secrets.' }, - { value: 'yes', label: 'Share the setup with your team', description: 'keep.lock is committed to Git (and, on GitHub, opened as a pull request), so copies of the same code point to the same Capy project and secret versions (this is useful for keeping larger teams or more complex projects in sync).' }, + { value: 'yes', label: 'Share the setup with your team', description: "Capy's setup is committed to Git (and, on GitHub, opened as a pull request), so copies of the same code point to the same Capy project and secret versions (this is useful for keeping larger teams or more complex projects in sync)." }, ]); expect(out.json!.elicitation.answer.rerun).toBe('capy --folder . --name demo --branch development --protected no --share-setup --encrypt-env yes --choice new --json'); expect(calls.initializeProject).not.toHaveBeenCalled(); diff --git a/tests/commands/editNamePrompt.test.ts b/tests/commands/editNamePrompt.test.ts index c4814461..7122d355 100644 --- a/tests/commands/editNamePrompt.test.ts +++ b/tests/commands/editNamePrompt.test.ts @@ -238,7 +238,7 @@ describe('capy edit with no name still opens the editor', () => { const out = await capture(() => new EditCommand().execute({})); // The temp folder has no keep.lock: the editor's setup is what answers. expect(out.exitCode).toBe(1); - expect(out.stderr).toContain('No keep.lock found'); + expect(out.stderr).toContain('This folder is not set up with Capy yet'); expect(gateRan.mock.calls.length).toBe(1); expect(promptSpy.mock.calls.length).toBe(0); expect(contextSpy.mock.calls.length).toBe(0); diff --git a/tests/commands/redeemRepoOrgGuard.test.ts b/tests/commands/redeemRepoOrgGuard.test.ts index 7ec9b825..41055ada 100644 --- a/tests/commands/redeemRepoOrgGuard.test.ts +++ b/tests/commands/redeemRepoOrgGuard.test.ts @@ -207,7 +207,7 @@ describe.each(NO_ORG_SHAPES)('a keep.lock that is %s', (_name, content) => { expect(result.exit).toBeUndefined(); expect(result.stderr).not.toContain(ERROR_CODES.REPO_ORG_MISMATCH); - expect(result.stdout).toContain('Removed invalid keep.lock'); + expect(result.stdout).toContain("Removed this folder's damaged Capy project file"); expect(existsSync(join(dir, 'keep.lock'))).toBe(false); expect(existsSync(join(dir, '.capy', 'keep.lock'))).toBe(false); expect(f.coDecrypt).toHaveBeenCalledTimes(1); diff --git a/tests/commands/removeCommand.test.ts b/tests/commands/removeCommand.test.ts index 7b37d0d4..27b84d0d 100644 --- a/tests/commands/removeCommand.test.ts +++ b/tests/commands/removeCommand.test.ts @@ -508,6 +508,6 @@ describe('RemoveCommand.execute local refusals', () => { process.chdir(TEST_DIR); const r = await run(['ANY'], { yes: true }); expect(r.exitCode).toBe(1); - expect(r.stderr).toContain('No keep.lock'); + expect(r.stderr).toContain('This folder is not set up with Capy yet'); }); }); diff --git a/tests/commands/rotateRefusals.test.ts b/tests/commands/rotateRefusals.test.ts index 1c685bb4..373e7f00 100644 --- a/tests/commands/rotateRefusals.test.ts +++ b/tests/commands/rotateRefusals.test.ts @@ -138,7 +138,7 @@ describe('every early refusal in rotate reaches the terminal and exits 1', () => test('a directory that was never initialised', async () => { // No keep.lock at all — the very first thing `execute` checks. const r = await refusalInTerminal(() => rotate('ANY', {})); - expect(plain(r.output)).toContain('No keep.lock file found'); + expect(plain(r.output)).toContain('This folder is not set up with Capy yet'); expect(PRINTED_URL.test(r.output)).toBe(false); expect(r.exitCode).toBe(1); }, 30_000); diff --git a/tests/commands/statusSeesNewerPushes.test.ts b/tests/commands/statusSeesNewerPushes.test.ts index 254df9d9..d6afb2e5 100644 --- a/tests/commands/statusSeesNewerPushes.test.ts +++ b/tests/commands/statusSeesNewerPushes.test.ts @@ -220,7 +220,7 @@ describe('status in a folder with no keep.lock', () => { await withTempDir('capy-status-empty', async (dir) => { const w = world(); const human = await runIn(dir, w.server.getDecryptData, () => new StatusCommand().execute()); - expect(human.stdout).toContain('No keep.lock found'); + expect(human.stdout).toContain('This folder is not set up with Capy yet'); expect(human.exitCodes).toEqual([]); const terse = await runIn(dir, w.server.getDecryptData, () => new StatusCommand(true).execute({ json: true })); expect(terse.stdout).toBe(''); diff --git a/tests/core/projectManager.test.ts b/tests/core/projectManager.test.ts index 478f7c82..bfa407d0 100644 --- a/tests/core/projectManager.test.ts +++ b/tests/core/projectManager.test.ts @@ -86,7 +86,7 @@ describe('ProjectManager', () => { mockReadFileSync.mockReturnValue('invalid json'); await expect(projectManager.detectProjectState()).rejects.toThrow(CapyError); - await expect(projectManager.detectProjectState()).rejects.toThrow('Invalid keep.lock file format'); + await expect(projectManager.detectProjectState()).rejects.toThrow("This folder's Capy project file could not be read."); }); }); @@ -169,7 +169,7 @@ describe('ProjectManager', () => { mockReadFileSync.mockReturnValue('invalid json'); expect(() => projectManager.readKeepFile()).toThrow(CapyError); - expect(() => projectManager.readKeepFile()).toThrow('Failed to read keep.lock file'); + expect(() => projectManager.readKeepFile()).toThrow("This folder's Capy project file could not be read."); }); test('should throw CapyError for missing required fields', () => { diff --git a/tests/core/repoLinkReporter.test.ts b/tests/core/repoLinkReporter.test.ts index 31b128e7..9e6546d7 100644 --- a/tests/core/repoLinkReporter.test.ts +++ b/tests/core/repoLinkReporter.test.ts @@ -114,7 +114,7 @@ describe('mismatchWarning', () => { ); expect(warning?.code).toBe(ERROR_CODES.KEEP_LOCK_REPO_MISMATCH); expect(warning?.repos).toEqual(['a/b', 'c/d']); - expect(warning?.message).toBe('keep.lock project is also linked to other repos: a/b, c/d'); + expect(warning?.message).toBe("This folder's Capy project is also linked to other repos: a/b, c/d"); }); test('no warning for no other repos, or when one is this repo (case-insensitive, any folder)', () => { @@ -285,7 +285,7 @@ describe('what it prints', () => { out.mockRestore(); err.mockRestore(); expect(stdoutCalls).toBe(0); - expect(lines).toEqual([' ! keep.lock project is also linked to other repos: x/y']); + expect(lines).toEqual([" ! This folder's Capy project is also linked to other repos: x/y"]); }); test('--json / quiet: nothing printed; the caller carries `warnings` in its envelope', async () => { diff --git a/tests/git/setupKeep.test.ts b/tests/git/setupKeep.test.ts index 2f4abed8..0e069b9d 100644 --- a/tests/git/setupKeep.test.ts +++ b/tests/git/setupKeep.test.ts @@ -49,7 +49,7 @@ describe('effective tracking for a folder', () => { writeFileSync(join(nested, 'keep.lock'), '{}\n'); git(repo, ['add', '--force', 'backend/keep.lock']); expect(tracksKeepLock(repo, 'backend/keep.lock')).toBe(true); - expect(() => configureSetupTracking(nested, false)).toThrow('already has a tracked keep.lock'); + expect(() => configureSetupTracking(nested, false)).toThrow("already has Capy's project file tracked in Git"); }); test('the first shared commit captures pins updated while linking an existing project', () => { diff --git a/tests/integration/cliIntegration.test.ts b/tests/integration/cliIntegration.test.ts index a3adce67..c9e376cc 100644 --- a/tests/integration/cliIntegration.test.ts +++ b/tests/integration/cliIntegration.test.ts @@ -255,7 +255,7 @@ DEBUG=true`; spyOn(fs, 'readFileSync').mockReturnValue('invalid json'); expect(() => projectManager.readKeepFile()).toThrow(CapyError); - expect(() => projectManager.readKeepFile()).toThrow('Failed to read keep.lock file'); + expect(() => projectManager.readKeepFile()).toThrow("This folder's Capy project file could not be read."); }); test('should handle missing required keep file fields', () => { diff --git a/tests/ui/folderTree.test.ts b/tests/ui/folderTree.test.ts index 39939946..5504f547 100644 --- a/tests/ui/folderTree.test.ts +++ b/tests/ui/folderTree.test.ts @@ -69,7 +69,7 @@ describe('folder tree on disk', () => { const info = diskFolders.info(join(root, 'app')); expect(info.markers).toEqual(['.env', 'package.json', 'keep.lock', 'git']); const text = rowText({ info, depth: 1, expanded: false, label: 'app/', children: undefined, isStart: false }); - expect(text).toContain('\x1b[90m.env · package.json · keep.lock · Git\x1b[0m'); + expect(text).toContain('\x1b[90m.env · package.json · Capy project · Git\x1b[0m'); }); test('→ opens and loads; → again goes to the first child; ← goes to the parent, then closes', () => { diff --git a/tests/ui/secretsDryRunTui.test.ts b/tests/ui/secretsDryRunTui.test.ts index 56b73a31..252fc1e4 100644 --- a/tests/ui/secretsDryRunTui.test.ts +++ b/tests/ui/secretsDryRunTui.test.ts @@ -150,7 +150,7 @@ describe('the walk-through changes nothing', () => { const diverged: readonly Loc[] = LOCATIONS.map((l) => (l.project === 'pC' ? { ...l, githubOtherHash: 'ffffffffffffffff' } : l)); const w = world(LOCATIONS, standardRepos(diverged)); const { frames } = await walk(w); - expect(frames.done).toContain('Acme/solo (trunk) keep.lock differs'); + expect(frames.done).toContain('Acme/solo (trunk) Capy setup differs'); expect(frames.done).not.toContain('Acme/mono (main) keep.lock differs'); expectNoWrites(w); }); diff --git a/tests/ui/secretsEditFlow.test.ts b/tests/ui/secretsEditFlow.test.ts index 1232dc6f..bca20ec4 100644 --- a/tests/ui/secretsEditFlow.test.ts +++ b/tests/ui/secretsEditFlow.test.ts @@ -257,7 +257,7 @@ describe('the confirmation', () => { [ '✓ ANTHROPIC_API_KEY updated in 6 locations.', '', - "Pull requests (merge each to update that repo's keep.lock):", + "Pull requests (merge each to update that repo's Capy setup):", '', ' SlideSpeak/slidespeak-monorepo', ' https://github.com/SlideSpeak/slidespeak-monorepo/pull/8401', @@ -286,7 +286,7 @@ describe('the confirmation', () => { }); expect(text).toBe(`✓ ANTHROPIC_API_KEY updated in 6 locations. -Pull requests (merge each to update that repo's keep.lock): +Pull requests (merge each to update that repo's Capy setup): SlideSpeak/slidespeak-monorepo https://github.com/SlideSpeak/slidespeak-monorepo/pull/8401 @@ -329,7 +329,7 @@ until its PR is merged and pulled.`); }); expect(text).toBe(`✓ ANTHROPIC_API_KEY updated in 6 locations. -Pull requests (merge each to update that repo's keep.lock): +Pull requests (merge each to update that repo's Capy setup): SlideSpeak/slidespeak-monorepo https://github.com/SlideSpeak/slidespeak-monorepo/pull/8401 From e2611e818a730f2321c1daff34b96aaedeff4b5a Mon Sep 17 00:00:00 2001 From: cvince Date: Wed, 2 Dec 2026 00:18:00 +0000 Subject: [PATCH 2/5] Setup copy says "your variables" instead of .env (CAP-982) .env stays only where the person needs the file name to act: the "Create a new Capy project from the existing .env file" choice and the folder picker's "Has a .env" marker. Agent-facing lines keep it. --- docs/cli-reference.md | 6 +++--- src/commands/capyCommand.ts | 2 +- src/commands/setupForm.ts | 2 +- src/core/setupCopy.ts | 26 +++++++++++++------------- src/types/index.ts | 2 +- tests/commands/agentSetup.test.ts | 2 +- tests/ui/setupScreen.test.ts | 2 +- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/cli-reference.md b/docs/cli-reference.md index 24dabe89..4dcae992 100644 --- a/docs/cli-reference.md +++ b/docs/cli-reference.md @@ -31,7 +31,7 @@ capy [options] | `--no-discover` | Do not discover application services | | | `--deployments [yes|no]` | whether setup looks for deployment targets to manage secrets deployments to (default yes) | | | `--no-deployments` | Do not look for deployment targets | | -| `--run-scripts [yes|no]` | whether setup changes the local scripts in package.json (dev, test and the like) to start with capy run, so they get the decrypted .env (asked when there are any; default yes); build and deploy scripts are never changed | | +| `--run-scripts [yes|no]` | whether setup changes the local scripts in package.json (dev, test and the like) to start with capy run, so they get the decrypted variables (asked when there are any; default yes); build and deploy scripts are never changed | | | `--no-run-scripts` | Leave package.json as it is | | | `--json` | emit machine-readable JSON instead of the human UI | | | `--non-tty` | same as --json: never ask, and answer in JSON (agents/CI) | | @@ -473,7 +473,7 @@ capy setup [options] | `--no-discover` | Do not discover application services | | | `--deployments [yes|no]` | whether setup looks for deployment targets to manage secrets deployments to (default yes) | | | `--no-deployments` | Do not look for deployment targets | | -| `--run-scripts [yes|no]` | whether setup changes the local scripts in package.json (dev, test and the like) to start with capy run, so they get the decrypted .env (asked when there are any; default yes); build and deploy scripts are never changed | | +| `--run-scripts [yes|no]` | whether setup changes the local scripts in package.json (dev, test and the like) to start with capy run, so they get the decrypted variables (asked when there are any; default yes); build and deploy scripts are never changed | | | `--no-run-scripts` | Leave package.json as it is | | | `--conversation` | ask the folder questions in a Keep conversation instead of in chat: setup opens one and returns its link | | | `--wait` | wait once on the open Keep conversation, for the length of --wait-seconds, then exit; run it again whenever it exits 3 | | @@ -1391,4 +1391,4 @@ Every refusal carries a stable `code` — branch on it, never on message text. - **Codes**: Branch only on the machine-readable `code` field (from --json output or a CapyError), never on human-readable message text — messages may be reworded without notice. - **Conflicts**: Every command that writes from a folder (edit, add, remove, connect, rotate, push, checkout, org, deploy, deploy revoke, deploy targets-remove) runs bare `capy` first; `checkout -b` is the one exception (a new branch carries the uncommitted values of the folder). Off a terminal, if the folder and Capy differ on any variable, nothing is written, the exit code is 3, and stdout is {ok:false, code:"SECRETS_CONFLICT", conflict_id, conflicts:[{name, project, branch, type, pinned, local, remote}]} (fingerprints only, never values; a Dokploy value has {name, target, pinned, local, remote}). Folder-only rows omit pinned and list their available choices. Choosing an absent side removes that name. Ask the person to select from the choices for each row, then rerun the same command with --resolve NAME= for every row (NAME@TARGET=local|remote for a Dokploy value) and --conflict . A state that moved since is SECRETS_CONFLICT_STALE with the fresh rows. There is no resolve-all. `secrets set` and `secrets deploy` take the same --resolve and --conflict for a location that changed since its row was listed. - **Organizations**: These commands work on an organization, not on a folder, and run with no project folder: users, grant-branch, revoke-branch, invite, kick, projects, projects rename --project-id, project create, project delete, project restore, secrets, secrets set, secrets deploy, system. The organization is the one in the keep.lock of the folder when it has one, else the only organization the account belongs to. With several organizations, no keep.lock and nobody to ask, `users --json`, `projects rename` and `project create|delete|restore` refuse with ORG_SELECTION_REQUIRED (exit 3), `orgs:[{id, name}]` and a form asking which; each of those commands takes `--org `, which picks among the account's own organizations only. -- **Elicitation**: A refusal with exit code 3 can carry an `elicitation` next to its `code`: a question for the human, never for you. Write `display` (a markdown table) in your reply exactly as given, without shortening or reordering it and never inside the question. Then ask the short `question` as an elicitation with your question tool: one question per field, every field of the form together in one go (never one, then the next), using the field's own `question` followed by its `description` when it has them, and its `options` or `default` as the choices; without a question tool, end your reply with the `question` and the human answers in chat. `capy setup` adds two things to each of its stops (CAP-940): a form's `instructions`, written from its own fields (ask them all together, list a field with more choices than your question tool holds in chat as text, run `answer.rerun` at once), and `next`, the steps still to come (pairing, the Set up step, the project questions, the finished setup), so you never stop to ask whether to go on; follow both. kind "confirm" is a yes/no ({kind, question, details, display, answer:{yes}}): ask the human; on yes, run the command in `answer.yes`; on no, stop. kind "form" asks for values ({kind, question, details, display, fields:[{name, type, pattern, question?, default?, description?, options?:[{value, label, description?}], other?}], answer:{rerun}}): ask the human for each field, then run `answer.rerun` with the values filled in. A field with `options` is a choice: offer its `options` (the human picks a `label`, with its `description` under it, and you fill in its `value`), plus "Other" when it has `other: true`. A field without `options` is typed in: with a `default`, offer the `default` and "Other"; with no `default`, leave it out of the question tool and ask its `question` in chat, in the same reply as the other questions. A choice with exactly one option and no `other` is already decided (CAP-978): show it as chosen (its label), do not ask it, and fill its `value` into the rerun. A typed field that only offers its `default` gets "Cancel" too; never pick that answer for the human. On "Other", ask the field's `question` in chat and fill in what the human types, as typed; if your question tool adds its own free-text "Other", that is the "Other" choice, so never add a second. On "Cancel", stop. A field with more choices than your question tool holds (4, counting "Other" and "Cancel"), or one with a label or description your question tool can't show word for word, goes in chat instead: list every choice, its label then its description, and let the human answer there. Never shorten, reword, reorder or drop a choice. On a `capy setup` form each field also has `ask`, these rules already applied: ask it where `ask.in` says (`question_tool` or `chat`, and in chat when your question tool can't show it word for word; `decided` is shown as chosen and never asked) with exactly `ask.choices`, in order and word for word; a choice's `then` is "type_in_chat" for "Other" and "stop" for "Cancel"; `default: true` marks the default, which you may show as recommended but never pick. `details` holds names and ids only, never a value. Today: `capy project restore` without --yes refuses with CONFIRMATION_REQUIRED and a confirm (details: {org:{id,name}, project:{id,name,deleted_at}}); `capy project delete` without --yes refuses with CONFIRMATION_REQUIRED and a confirm (details: {org:{id,name}, project:{id,name}, branches:[name], variables:[{name, branches:[name]}], live_deploy_tokens:[{deploy_id, label}], unavailable?:["branches"|"variables"]}); `capy project create` missing the name, `--branch` or `--protected` in agent mode refuses with PROJECT_NAME_REQUIRED, BRANCH_NAME_REQUIRED or BRANCH_PROTECTION_REQUIRED and a form (fields: name, branch, protected (options yes/no); details: {org:{id,name}}); `capy project delete` / `project restore` with a name several projects share refuses with PROJECT_AMBIGUOUS and a form with one `project` field whose options are the projects (details: {org:{id,name}, matches:[{id, name, created_at, variables}]}); `capy kick ` without --yes refuses with CONFIRMATION_REQUIRED and a confirm (details: {org:{id,name}, member:{email}}); `capy projects rename` with no name refuses with PROJECT_NAME_REQUIRED and a form with one `name` field (details: {org:{id,name}, project:{id,name}}); `capy secrets set` / `capy secrets deploy` with a project that is linked to more than one repo refuses with PR_REPO_AMBIGUOUS and a form with one field per such project whose options are its repos (details: {projects:[{id, name, repos:[owner/name[/folder]]}]}); pass the same `--pr-repo` again on the run with `--confirm`. `capy branch -D NAME` without --yes in agent mode refuses with CONFIRMATION_REQUIRED and a confirm (details: {branch:{name}}); `capy remove NAME...` without --yes refuses with REMOVE_NEEDS_TTY and a confirm (details: {branch, variables:[name], removing_all}); `capy system rm NAME` without --yes refuses with SYSTEM_STORE_NEEDS_TTY and a confirm (details: {name, org?}); `capy connect vercel|dokploy` with --overwrite or --discover and without --yes refuses with VERCEL_CONFIRMATION_REQUIRED or DOKPLOY_CONFIRMATION_REQUIRED (exit 3) and a confirm whose `display` lists the terminal's lines (details: {import, replace, clear} or {folders}); `capy connect vercel` with nobody to ask refuses with VERCEL_TEAM_REQUIRED (form, one `team` field whose options are the team slugs; details: {teams:[{id, slug}]}), VERCEL_PROJECT_REQUIRED (form, one typed `project` field; details: {}) or VERCEL_ENVIRONMENT_REQUIRED (form, one `environment` field whose options are the environments; details: {branch, environments:[name]}), all exit 3; `capy connect dokploy` refuses with DOKPLOY_TARGET_AMBIGUOUS (form, one `target` field: each option's label is a saved target and its value that target's flags; details: {targets:[name]}) or DOKPLOY_SETTINGS_MISSING (form asking only what is missing: `base_url`, then `source` (option values `--application` / `--compose`) and `service_id`; details: {}); fill the values into `answer.rerun` as they are. With nobody at a terminal, these picks refuse with a form of one field whose options are the terminal's choices (exit 3): `capy rotate` with no variable, ROTATE_VARIABLE_REQUIRED (field `variable`; details: {branch, variables}); `capy rotate VAR` for an unmanaged variable with several integrations, ROTATE_PROVIDER_REQUIRED (field `provider`; details: {variable, providers}); `capy invite` for a role that needs project access, INVITE_PROJECT_REQUIRED (field `project`, one project; details: {role, projects:[{id, name}]}); `capy connect stripe` with several accounts, STRIPE_ACCOUNT_REQUIRED (field `account`; details: {accounts:[{name, account_id}]}); `capy connect stripe|workos` when the key's variable is unclear, CONNECTOR_VAR_REQUIRED (field `var`; details: {branch, variables}). `capy rotate` has no --json, so its `answer.rerun` ends with --non-tty. A command that works on an organization (users, projects, project create|delete|restore, projects rename, secrets, invite, kick, grant-branch, revoke-branch) with several organizations, no keep.lock and no --org refuses with ORG_SELECTION_REQUIRED (exit 3) and a form with one `org` field whose options are the org ids labelled by name (details: {orgs:[{id, name}]}); its rerun adds --org. `capy agents` (or `capy agents --remove`) without --yes in agent mode refuses with AGENTS_SETUP_NEEDS_TTY and a confirm asking the terminal's question (details: {files:[{path, action}]}); `capy checkout NAME -b --json` without --protected or --no-protected refuses with BRANCH_PROTECTION_REQUIRED and a form with one `protected` field whose option values are the flags `--protected` and `--no-protected` (details: {branch:{name}}); its `answer.rerun` uses --non-tty, because `-b --json` only describes the route. kind "link" hands the human a page to approve on ({kind, url, code, fingerprint?, purpose, expires_at, qr?:{text?, image?:{mime_type, file, data_uri?}}, instructions, answer:{wait}}): write the `url` as a clickable link, with the `code`, the `fingerprint` (the page shows the same one) and `expires_at`, as plain text, every time a link is shown (the `qr`, as `conventions.pairing` says, is only an addition, never the only way), then run `answer.wait` at once in the foreground (it can take up to 9 minutes, so give it a tool timeout of at least 10 minutes), and run it again whenever it exits 3 with PAIR_STILL_WAITING or your tool stopped it early; when it exits 3 with PAIR_LINK_RENEWED the old link expired and the elicitation is a new link: show it to the human the same way and run its `answer.wait` again. Its `instructions` say the same. Pass `--title` and `--description` to `capy pair` and `capy setup`: your own words for what you are doing and why, which Keep shows the human on the unlock request; `capy setup` refuses to start a pairing without them (SETUP_INTENT_REQUIRED, exit 1, with `next_command`). Today `capy pair` in agent mode asks nothing up front (no email, no keys choice: on a machine with no keys it asks for them, and Keep decides after sign-in between the organization keys and a new organization); it refuses with PAIR_APPROVAL_PENDING and a link; once the human approves, the wait refuses with PAIR_CODE_REQUIRED (or PAIR_CODE_MISMATCH after a wrong code) and a form (field: code; details: {attempts_left?}) for the one-time code Keep shows the human; never fill in the code yourself. Bare `capy` in a folder that is not a project, in agent mode, with questions left refuses with INIT_INPUT_REQUIRED and one form that asks only what is unanswered: first, alone, folder when no --folder was typed (options: this folder and every subfolder that holds a .env or a package file, those with a .env first, each option's description saying which it holds, with `other`; when there are more choices than your question tool takes, list every option with its description in chat and let the human answer there, never dropping one; the rerun adds --folder), then org (options: the organizations; asked before the project questions when there are several, with only share beside it), then the Set up step when no --choice was typed (CAP-941: when a choice that creates a project fits, the same form also asks that new project's `name` and first `branch`, and `share` inside Git, so there is one round trip after the code; `details.new_project_fields` names them; they are used only by `existing` and `new`, and a rerun with `--choice import` ignores `--name`, and ignores `--branch` until the project to link is answered, so it asks the project and then its branch; question "What would you like Capy to set up?"; field `choice` offers only the choices that fit: `existing` "Create a new Capy project from the existing .env file" when the .env has secrets, `new` "Create a new Capy project" when it has none, `import` "Start from another project" (link this folder to a project that already exists) when the organization has a project, and `skip` "Skip project setup for now"; when only one fits, `choice` is a field with that one option, already decided (`ask.in` is `decided`): show it as chosen and never ask it; fields `discover` ("Discover application services") and `deployments` ("Manage secrets deployments"), options yes/no, default yes; CAP-960: when the folder's package.json has local scripts (dev, test and the like) also `run_scripts` ("Run your scripts with the encrypted .env"), options yes/no, default yes, its description naming the scripts (`details.scripts`); yes changes each to start with `capy run --`, never build, deploy or install scripts, and the rerun adds --run-scripts; encrypting the .env is always on and is never a field, `details.always.encrypt_line` says it; answering the step is the yes to encrypting, so no separate encrypt question follows; the rerun adds --choice, --discover and --deployments (and --run-scripts when asked); `skip` creates nothing, leaves the .env as it is and ends with `skipped: true` (`capy setup` then returns `setup: "skipped"` and writes no AGENTS block); a --choice that does not fit refuses with SETUP_CHOICE_UNAVAILABLE (exit 3, `extra.choices` lists the ones that fit: ask the human again with those); a --choice, --discover or --deployments that is not one of its values refuses with SETUP_CHOICE_INVALID or SETUP_SCOPE_INVALID; the result carries `setup_choice` and `scope`), project (for `import` only; options: the existing projects), then for a new project (`existing` or `new`) name (its default is a free name: the folder's, or the first free `-2` to `-9`; a name that turns out to be taken refuses with PROJECT_NAME_EXISTS, exit 3, and the same form asking only `name`, its `display` saying the name is taken: ask the human again and run its `answer.rerun`) and branch (its protection is not asked: the first branch starts open, as in the terminal, unless --protected was typed), and for an existing project branch (options: that project's branches, never chosen for the human even when there is one), or, when that project has no branches yet, branch for its first one (default development; the rerun creates it open to the project); and, inside a git repository, share (options yes: "Share the setup with your team", no: "Set up this folder only"; the rerun adds --share-setup); a typed --encrypt-env no still creates nothing and leaves the .env as it is; while folder is asked its `display` only names the folder Capy runs in; otherwise its `display` is the whole summary, so after the human answers, run `answer.rerun` with no further confirmation (details: {folder?, org?, orgs?, projects?, project?, branches?, new_project_fields?, variables}; `variables` is a count). Never answer it yourself and never add --yes on your own. A finished setup can carry `warnings`, each with a `code`, a `message` and a `next` step (today ENV_IN_GIT_HISTORY: the .env was committed to Git, so its old values are still in the history; and GITIGNORE_NOT_COMMITTED: the .gitignore is left out of the commit of a shared setup (and of `git.files`), because it has changes Capy did not make): tell the human each `message` and its `next` step in your reply, and never act on it for them. CAP-960: a finished setup carries `run` ({command, message, note?}): the .env now holds ciphertext, so tell the human `message` and `command` (the command that starts the app with the decrypted .env, or null), and `note` when there is one; start the app, its tests and anything that reads the .env only that way. `scripts` ({file, wrapped, skipped}) lists the package.json scripts Capy changed; in a shared setup package.json is in `git.files` when Capy's change is its only one. CAP-971: discovery is yours. A finished setup whose Set up step looks for services or deployments carries `discover` in place of `summary`: follow its `instructions`. CAP-954: in agent mode Capy commits nothing and runs no gh. A setup shared through Git ("Share the setup with your team") ends with `git`: `folder`, `files`, `commit_message`, `branch`, `base`, `pull_request` ({title, body}, or null with `--pr no` or no origin), `instructions` and `commands`. Follow its `instructions` with your own Git access and access to the Git host: commit exactly `files` in `folder` with `commit_message`, open `pull_request` on `base` from `branch` so it holds only those files (push the commit as `branch` only when its parent is the head of `base` on origin, else make `branch` from `base` on origin); Capy pull requests stack: with an open pull request from a `capy/` branch, open it on the newest open `capy/` branch that no other open pull request is based on, and show the human its link. Never change Git settings or identity yourself; if Git has no name or email, ask the human to set theirs. Without Git tools, run `commands` in `folder` exactly as given. `capy setup --conversation --json` asks those folder questions in a Keep conversation instead (CAP-921): it refuses with CONVERSATION_OPEN (exit 3) and a link whose `purpose` is "conversation" (show its url, fingerprint and expiry the same way, and its `preview` steps), then run `answer.wait` (`capy setup --wait --folder --flow --json`, which finds the conversation from any folder) at once and again on every exit 3. When Keep can't hold the conversation, `capy setup --conversation` refuses with CONVERSATION_ASK_IN_CHAT (exit 3, `extra.conversation_unavailable.reason`: not_signed_in, no_transport_record, no_local_key or refused) and the same question it would have asked: tell the human its `message`, then ask the question in chat as above; its `answer.rerun` keeps `--conversation`, so the next step tries Keep again. On a machine that must pair first, the pairing's commands keep `--conversation`, so the questions go to Keep once it is paired. Waits: CONVERSATION_WAITING means nothing new yet; CONVERSATION_STEP_DONE means the human answered a step in Keep (`step`, `answered_in: "keep"`, `answers`, `goals`): show it as done in one line and run the wait again. Never end your turn between waits while the conversation is open: run `answer.wait` again at once after every exit 3. Nothing is lost if a wait ends or your tool stops it: answers given in Keep while no wait runs are kept and returned by the next wait. To reconnect from a fresh session, run `capy setup --wait --json` in the same folder (add `--flow ` only when more than one conversation is open there), or `capy setup --conversation --json` there, which hands back the open conversation's link with `resumed: true`. CAP-977: CONVERSATION_STEP_REPEATED (exit 1, `shown_in_keep: true`, `step`) means setup asked the human the exact question they had just answered; it was not posted again, Keep shows the step as failed, and the answers are kept: tell the human in one line and report it as a Capy bug, never answer it yourself. The finished setup has `conversation.code` CONVERSATION_DONE. `goals` lists every step with its status. Add `--note -` to the wait to show the human a plain-text note in Keep (piped on stdin, at most 2,000 characters, no links; it is echoed back as `note`), and `--cancel` to end the conversation. CAP-957: one wait (280 seconds by default) runs on through every step the human answers in Keep (run it in the foreground with a tool timeout of at least 6 minutes) and returns early only at the end, at a stop, or when its time is up; CONVERSATION_STEP_DONE then lists every step answered during it in `steps`. Every stop reaches Keep. A refused answer given in Keep is asked again in Keep, so you only see a wait. Any other stop comes to you as its own refusal with `shown_in_keep: true` and `answer.wait`: Keep has already told the human that this step stopped, so tell them its `message` and next step in one line, then run `answer.wait` again once it is done; the conversation carries on from its saved answers. Running `capy setup --conversation` again in a folder whose conversation is still open hands back the same link with `resumed: true`: show it again and run its `answer.wait`. You never answer a question asked in Keep, and you never see a key or a sealed record. +- **Elicitation**: A refusal with exit code 3 can carry an `elicitation` next to its `code`: a question for the human, never for you. Write `display` (a markdown table) in your reply exactly as given, without shortening or reordering it and never inside the question. Then ask the short `question` as an elicitation with your question tool: one question per field, every field of the form together in one go (never one, then the next), using the field's own `question` followed by its `description` when it has them, and its `options` or `default` as the choices; without a question tool, end your reply with the `question` and the human answers in chat. `capy setup` adds two things to each of its stops (CAP-940): a form's `instructions`, written from its own fields (ask them all together, list a field with more choices than your question tool holds in chat as text, run `answer.rerun` at once), and `next`, the steps still to come (pairing, the Set up step, the project questions, the finished setup), so you never stop to ask whether to go on; follow both. kind "confirm" is a yes/no ({kind, question, details, display, answer:{yes}}): ask the human; on yes, run the command in `answer.yes`; on no, stop. kind "form" asks for values ({kind, question, details, display, fields:[{name, type, pattern, question?, default?, description?, options?:[{value, label, description?}], other?}], answer:{rerun}}): ask the human for each field, then run `answer.rerun` with the values filled in. A field with `options` is a choice: offer its `options` (the human picks a `label`, with its `description` under it, and you fill in its `value`), plus "Other" when it has `other: true`. A field without `options` is typed in: with a `default`, offer the `default` and "Other"; with no `default`, leave it out of the question tool and ask its `question` in chat, in the same reply as the other questions. A choice with exactly one option and no `other` is already decided (CAP-978): show it as chosen (its label), do not ask it, and fill its `value` into the rerun. A typed field that only offers its `default` gets "Cancel" too; never pick that answer for the human. On "Other", ask the field's `question` in chat and fill in what the human types, as typed; if your question tool adds its own free-text "Other", that is the "Other" choice, so never add a second. On "Cancel", stop. A field with more choices than your question tool holds (4, counting "Other" and "Cancel"), or one with a label or description your question tool can't show word for word, goes in chat instead: list every choice, its label then its description, and let the human answer there. Never shorten, reword, reorder or drop a choice. On a `capy setup` form each field also has `ask`, these rules already applied: ask it where `ask.in` says (`question_tool` or `chat`, and in chat when your question tool can't show it word for word; `decided` is shown as chosen and never asked) with exactly `ask.choices`, in order and word for word; a choice's `then` is "type_in_chat" for "Other" and "stop" for "Cancel"; `default: true` marks the default, which you may show as recommended but never pick. `details` holds names and ids only, never a value. Today: `capy project restore` without --yes refuses with CONFIRMATION_REQUIRED and a confirm (details: {org:{id,name}, project:{id,name,deleted_at}}); `capy project delete` without --yes refuses with CONFIRMATION_REQUIRED and a confirm (details: {org:{id,name}, project:{id,name}, branches:[name], variables:[{name, branches:[name]}], live_deploy_tokens:[{deploy_id, label}], unavailable?:["branches"|"variables"]}); `capy project create` missing the name, `--branch` or `--protected` in agent mode refuses with PROJECT_NAME_REQUIRED, BRANCH_NAME_REQUIRED or BRANCH_PROTECTION_REQUIRED and a form (fields: name, branch, protected (options yes/no); details: {org:{id,name}}); `capy project delete` / `project restore` with a name several projects share refuses with PROJECT_AMBIGUOUS and a form with one `project` field whose options are the projects (details: {org:{id,name}, matches:[{id, name, created_at, variables}]}); `capy kick ` without --yes refuses with CONFIRMATION_REQUIRED and a confirm (details: {org:{id,name}, member:{email}}); `capy projects rename` with no name refuses with PROJECT_NAME_REQUIRED and a form with one `name` field (details: {org:{id,name}, project:{id,name}}); `capy secrets set` / `capy secrets deploy` with a project that is linked to more than one repo refuses with PR_REPO_AMBIGUOUS and a form with one field per such project whose options are its repos (details: {projects:[{id, name, repos:[owner/name[/folder]]}]}); pass the same `--pr-repo` again on the run with `--confirm`. `capy branch -D NAME` without --yes in agent mode refuses with CONFIRMATION_REQUIRED and a confirm (details: {branch:{name}}); `capy remove NAME...` without --yes refuses with REMOVE_NEEDS_TTY and a confirm (details: {branch, variables:[name], removing_all}); `capy system rm NAME` without --yes refuses with SYSTEM_STORE_NEEDS_TTY and a confirm (details: {name, org?}); `capy connect vercel|dokploy` with --overwrite or --discover and without --yes refuses with VERCEL_CONFIRMATION_REQUIRED or DOKPLOY_CONFIRMATION_REQUIRED (exit 3) and a confirm whose `display` lists the terminal's lines (details: {import, replace, clear} or {folders}); `capy connect vercel` with nobody to ask refuses with VERCEL_TEAM_REQUIRED (form, one `team` field whose options are the team slugs; details: {teams:[{id, slug}]}), VERCEL_PROJECT_REQUIRED (form, one typed `project` field; details: {}) or VERCEL_ENVIRONMENT_REQUIRED (form, one `environment` field whose options are the environments; details: {branch, environments:[name]}), all exit 3; `capy connect dokploy` refuses with DOKPLOY_TARGET_AMBIGUOUS (form, one `target` field: each option's label is a saved target and its value that target's flags; details: {targets:[name]}) or DOKPLOY_SETTINGS_MISSING (form asking only what is missing: `base_url`, then `source` (option values `--application` / `--compose`) and `service_id`; details: {}); fill the values into `answer.rerun` as they are. With nobody at a terminal, these picks refuse with a form of one field whose options are the terminal's choices (exit 3): `capy rotate` with no variable, ROTATE_VARIABLE_REQUIRED (field `variable`; details: {branch, variables}); `capy rotate VAR` for an unmanaged variable with several integrations, ROTATE_PROVIDER_REQUIRED (field `provider`; details: {variable, providers}); `capy invite` for a role that needs project access, INVITE_PROJECT_REQUIRED (field `project`, one project; details: {role, projects:[{id, name}]}); `capy connect stripe` with several accounts, STRIPE_ACCOUNT_REQUIRED (field `account`; details: {accounts:[{name, account_id}]}); `capy connect stripe|workos` when the key's variable is unclear, CONNECTOR_VAR_REQUIRED (field `var`; details: {branch, variables}). `capy rotate` has no --json, so its `answer.rerun` ends with --non-tty. A command that works on an organization (users, projects, project create|delete|restore, projects rename, secrets, invite, kick, grant-branch, revoke-branch) with several organizations, no keep.lock and no --org refuses with ORG_SELECTION_REQUIRED (exit 3) and a form with one `org` field whose options are the org ids labelled by name (details: {orgs:[{id, name}]}); its rerun adds --org. `capy agents` (or `capy agents --remove`) without --yes in agent mode refuses with AGENTS_SETUP_NEEDS_TTY and a confirm asking the terminal's question (details: {files:[{path, action}]}); `capy checkout NAME -b --json` without --protected or --no-protected refuses with BRANCH_PROTECTION_REQUIRED and a form with one `protected` field whose option values are the flags `--protected` and `--no-protected` (details: {branch:{name}}); its `answer.rerun` uses --non-tty, because `-b --json` only describes the route. kind "link" hands the human a page to approve on ({kind, url, code, fingerprint?, purpose, expires_at, qr?:{text?, image?:{mime_type, file, data_uri?}}, instructions, answer:{wait}}): write the `url` as a clickable link, with the `code`, the `fingerprint` (the page shows the same one) and `expires_at`, as plain text, every time a link is shown (the `qr`, as `conventions.pairing` says, is only an addition, never the only way), then run `answer.wait` at once in the foreground (it can take up to 9 minutes, so give it a tool timeout of at least 10 minutes), and run it again whenever it exits 3 with PAIR_STILL_WAITING or your tool stopped it early; when it exits 3 with PAIR_LINK_RENEWED the old link expired and the elicitation is a new link: show it to the human the same way and run its `answer.wait` again. Its `instructions` say the same. Pass `--title` and `--description` to `capy pair` and `capy setup`: your own words for what you are doing and why, which Keep shows the human on the unlock request; `capy setup` refuses to start a pairing without them (SETUP_INTENT_REQUIRED, exit 1, with `next_command`). Today `capy pair` in agent mode asks nothing up front (no email, no keys choice: on a machine with no keys it asks for them, and Keep decides after sign-in between the organization keys and a new organization); it refuses with PAIR_APPROVAL_PENDING and a link; once the human approves, the wait refuses with PAIR_CODE_REQUIRED (or PAIR_CODE_MISMATCH after a wrong code) and a form (field: code; details: {attempts_left?}) for the one-time code Keep shows the human; never fill in the code yourself. Bare `capy` in a folder that is not a project, in agent mode, with questions left refuses with INIT_INPUT_REQUIRED and one form that asks only what is unanswered: first, alone, folder when no --folder was typed (options: this folder and every subfolder that holds a .env or a package file, those with a .env first, each option's description saying which it holds, with `other`; when there are more choices than your question tool takes, list every option with its description in chat and let the human answer there, never dropping one; the rerun adds --folder), then org (options: the organizations; asked before the project questions when there are several, with only share beside it), then the Set up step when no --choice was typed (CAP-941: when a choice that creates a project fits, the same form also asks that new project's `name` and first `branch`, and `share` inside Git, so there is one round trip after the code; `details.new_project_fields` names them; they are used only by `existing` and `new`, and a rerun with `--choice import` ignores `--name`, and ignores `--branch` until the project to link is answered, so it asks the project and then its branch; question "What would you like Capy to set up?"; field `choice` offers only the choices that fit: `existing` "Create a new Capy project from the existing .env file" when the .env has secrets, `new` "Create a new Capy project" when it has none, `import` "Start from another project" (link this folder to a project that already exists) when the organization has a project, and `skip` "Skip project setup for now"; when only one fits, `choice` is a field with that one option, already decided (`ask.in` is `decided`): show it as chosen and never ask it; fields `discover` ("Discover application services") and `deployments` ("Manage secrets deployments"), options yes/no, default yes; CAP-960: when the folder's package.json has local scripts (dev, test and the like) also `run_scripts` ("Run your scripts with your encrypted variables"), options yes/no, default yes, its description naming the scripts (`details.scripts`); yes changes each to start with `capy run --`, never build, deploy or install scripts, and the rerun adds --run-scripts; encrypting the .env is always on and is never a field, `details.always.encrypt_line` says it; answering the step is the yes to encrypting, so no separate encrypt question follows; the rerun adds --choice, --discover and --deployments (and --run-scripts when asked); `skip` creates nothing, leaves the .env as it is and ends with `skipped: true` (`capy setup` then returns `setup: "skipped"` and writes no AGENTS block); a --choice that does not fit refuses with SETUP_CHOICE_UNAVAILABLE (exit 3, `extra.choices` lists the ones that fit: ask the human again with those); a --choice, --discover or --deployments that is not one of its values refuses with SETUP_CHOICE_INVALID or SETUP_SCOPE_INVALID; the result carries `setup_choice` and `scope`), project (for `import` only; options: the existing projects), then for a new project (`existing` or `new`) name (its default is a free name: the folder's, or the first free `-2` to `-9`; a name that turns out to be taken refuses with PROJECT_NAME_EXISTS, exit 3, and the same form asking only `name`, its `display` saying the name is taken: ask the human again and run its `answer.rerun`) and branch (its protection is not asked: the first branch starts open, as in the terminal, unless --protected was typed), and for an existing project branch (options: that project's branches, never chosen for the human even when there is one), or, when that project has no branches yet, branch for its first one (default development; the rerun creates it open to the project); and, inside a git repository, share (options yes: "Share the setup with your team", no: "Set up this folder only"; the rerun adds --share-setup); a typed --encrypt-env no still creates nothing and leaves the .env as it is; while folder is asked its `display` only names the folder Capy runs in; otherwise its `display` is the whole summary, so after the human answers, run `answer.rerun` with no further confirmation (details: {folder?, org?, orgs?, projects?, project?, branches?, new_project_fields?, variables}; `variables` is a count). Never answer it yourself and never add --yes on your own. A finished setup can carry `warnings`, each with a `code`, a `message` and a `next` step (today ENV_IN_GIT_HISTORY: the .env was committed to Git, so its old values are still in the history; and GITIGNORE_NOT_COMMITTED: the .gitignore is left out of the commit of a shared setup (and of `git.files`), because it has changes Capy did not make): tell the human each `message` and its `next` step in your reply, and never act on it for them. CAP-960: a finished setup carries `run` ({command, message, note?}): the .env now holds ciphertext, so tell the human `message` and `command` (the command that starts the app with the decrypted .env, or null), and `note` when there is one; start the app, its tests and anything that reads the .env only that way. `scripts` ({file, wrapped, skipped}) lists the package.json scripts Capy changed; in a shared setup package.json is in `git.files` when Capy's change is its only one. CAP-971: discovery is yours. A finished setup whose Set up step looks for services or deployments carries `discover` in place of `summary`: follow its `instructions`. CAP-954: in agent mode Capy commits nothing and runs no gh. A setup shared through Git ("Share the setup with your team") ends with `git`: `folder`, `files`, `commit_message`, `branch`, `base`, `pull_request` ({title, body}, or null with `--pr no` or no origin), `instructions` and `commands`. Follow its `instructions` with your own Git access and access to the Git host: commit exactly `files` in `folder` with `commit_message`, open `pull_request` on `base` from `branch` so it holds only those files (push the commit as `branch` only when its parent is the head of `base` on origin, else make `branch` from `base` on origin); Capy pull requests stack: with an open pull request from a `capy/` branch, open it on the newest open `capy/` branch that no other open pull request is based on, and show the human its link. Never change Git settings or identity yourself; if Git has no name or email, ask the human to set theirs. Without Git tools, run `commands` in `folder` exactly as given. `capy setup --conversation --json` asks those folder questions in a Keep conversation instead (CAP-921): it refuses with CONVERSATION_OPEN (exit 3) and a link whose `purpose` is "conversation" (show its url, fingerprint and expiry the same way, and its `preview` steps), then run `answer.wait` (`capy setup --wait --folder --flow --json`, which finds the conversation from any folder) at once and again on every exit 3. When Keep can't hold the conversation, `capy setup --conversation` refuses with CONVERSATION_ASK_IN_CHAT (exit 3, `extra.conversation_unavailable.reason`: not_signed_in, no_transport_record, no_local_key or refused) and the same question it would have asked: tell the human its `message`, then ask the question in chat as above; its `answer.rerun` keeps `--conversation`, so the next step tries Keep again. On a machine that must pair first, the pairing's commands keep `--conversation`, so the questions go to Keep once it is paired. Waits: CONVERSATION_WAITING means nothing new yet; CONVERSATION_STEP_DONE means the human answered a step in Keep (`step`, `answered_in: "keep"`, `answers`, `goals`): show it as done in one line and run the wait again. Never end your turn between waits while the conversation is open: run `answer.wait` again at once after every exit 3. Nothing is lost if a wait ends or your tool stops it: answers given in Keep while no wait runs are kept and returned by the next wait. To reconnect from a fresh session, run `capy setup --wait --json` in the same folder (add `--flow ` only when more than one conversation is open there), or `capy setup --conversation --json` there, which hands back the open conversation's link with `resumed: true`. CAP-977: CONVERSATION_STEP_REPEATED (exit 1, `shown_in_keep: true`, `step`) means setup asked the human the exact question they had just answered; it was not posted again, Keep shows the step as failed, and the answers are kept: tell the human in one line and report it as a Capy bug, never answer it yourself. The finished setup has `conversation.code` CONVERSATION_DONE. `goals` lists every step with its status. Add `--note -` to the wait to show the human a plain-text note in Keep (piped on stdin, at most 2,000 characters, no links; it is echoed back as `note`), and `--cancel` to end the conversation. CAP-957: one wait (280 seconds by default) runs on through every step the human answers in Keep (run it in the foreground with a tool timeout of at least 6 minutes) and returns early only at the end, at a stop, or when its time is up; CONVERSATION_STEP_DONE then lists every step answered during it in `steps`. Every stop reaches Keep. A refused answer given in Keep is asked again in Keep, so you only see a wait. Any other stop comes to you as its own refusal with `shown_in_keep: true` and `answer.wait`: Keep has already told the human that this step stopped, so tell them its `message` and next step in one line, then run `answer.wait` again once it is done; the conversation carries on from its saved answers. Running `capy setup --conversation` again in a folder whose conversation is still open hands back the same link with `resumed: true`: show it again and run its `answer.wait`. You never answer a question asked in Keep, and you never see a key or a sealed record. diff --git a/src/commands/capyCommand.ts b/src/commands/capyCommand.ts index 758ca1fb..2d17a9f5 100644 --- a/src/commands/capyCommand.ts +++ b/src/commands/capyCommand.ts @@ -1127,7 +1127,7 @@ export class CapyCommand { return this.resolveSetUpScreen({ offered, fixed: offered.length === 0 ? fitting[0] : undefined, variables, ...this.scriptsRow() }); } - /** CAP-960: the Set up step's "Run your scripts with the encrypted .env" row, when package.json has local scripts to wrap. */ + /** CAP-960: the Set up step's "Run your scripts with your encrypted variables" row, when package.json has local scripts to wrap. */ private scriptsRow(): { readonly scripts?: readonly string[]; readonly bin?: string } { const wrap = folderScriptPlan(process.cwd())?.wrap ?? []; return wrap.length === 0 ? {} : { scripts: wrap, bin: binName(this.devMode) }; diff --git a/src/commands/setupForm.ts b/src/commands/setupForm.ts index f05cb8b5..c102b80c 100644 --- a/src/commands/setupForm.ts +++ b/src/commands/setupForm.ts @@ -306,7 +306,7 @@ function scopeField(name: 'discover' | 'deployments'): ElicitationField { }; } -/** CAP-960: "Run your scripts with the encrypted .env", naming the scripts it changes; on by default like the scope boxes. */ +/** CAP-960: "Run your scripts with your encrypted variables", naming the scripts it changes; on by default like the scope boxes. */ function runScriptsField(scripts: readonly string[], bin: string): ElicitationField { const copy = SCOPE_COPY.runScripts; return { diff --git a/src/core/setupCopy.ts b/src/core/setupCopy.ts index e303d417..0b19e1b1 100644 --- a/src/core/setupCopy.ts +++ b/src/core/setupCopy.ts @@ -31,15 +31,15 @@ export const SETUP_COPY = { question: 'How are you using Capy here?', /** Labels are Vincent's (2026-11-29); `import` means: link this folder to a project that exists (2026-11-27). */ options: { - existing: { label: 'Create a new Capy project from the existing .env file', description: 'This folder\'s .env is imported and encrypted.' }, + existing: { label: 'Create a new Capy project from the existing .env file', description: 'Its variables are imported into the new project and encrypted.' }, new: { label: 'Create a new Capy project', description: 'The project starts empty.' }, import: { label: 'Start from another project', description: 'Link this folder to a Capy project that already exists.' }, - skip: { label: 'Skip project setup for now', description: 'Nothing is created and the .env is left as it is. Run setup again later.' }, + skip: { label: 'Skip project setup for now', description: 'Nothing is created and your variables are left as they are. Run setup again later.' }, } satisfies Record, }, scope: { question: (label: string): string => `${label}?`, - encrypt: { label: 'Encrypt your local .env and manage secrets with Capy', description: 'Always on.' }, + encrypt: { label: 'Encrypt your variables and manage secrets with Capy', description: 'Always on.' }, discover: { label: 'Discover application services', description: 'Capy reads this folder\'s variable names, code and dependencies to find the services your app uses and where each secret is used. Nothing is connected until you choose to.', @@ -54,17 +54,17 @@ export const SETUP_COPY = { }, /** CAP-960: asked only when package.json has local scripts to wrap. Vincent chose wrapping in place (2026-11-30). */ runScripts: { - label: 'Run your scripts with the encrypted .env', + label: 'Run your scripts with your encrypted variables', description: (scripts: readonly string[], bin: string): string => - `After setup the .env holds ciphertext, so your app only gets the real values through ${bin} run. Capy changes ${listOf(scripts)} in package.json to start with "${bin} run --". Build, deploy and install scripts are not changed.`, + `After setup your variables are stored encrypted, so your app only gets the real values through ${bin} run. Capy changes ${listOf(scripts)} in package.json to start with "${bin} run --". Build, deploy and install scripts are not changed.`, yes: (bin: string): string => `The listed scripts start with "${bin} run --", so npm run dev and the others work as before.`, no: (bin: string): string => `package.json is left as it is. Start the app with ${bin} run -- .`, }, }, /** CAP-960: what every finished setup says about running the app (terminal line, JSON `run`, AGENTS block). */ run: { - wrapped: (scripts: readonly string[], bin: string): string => `Your app reads the encrypted .env through ${bin} run: ${listOf(scripts)} in package.json now start with it.`, - prefix: (bin: string): string => `Your .env is now encrypted. To run your app with decrypted secrets, start it with ${bin} run -- .`, + wrapped: (scripts: readonly string[], bin: string): string => `Your app reads its encrypted variables through ${bin} run: ${listOf(scripts)} in package.json now start with it.`, + prefix: (bin: string): string => `Your variables are now encrypted. To run your app with them decrypted, start it with ${bin} run -- .`, skipped: (scripts: readonly string[], bin: string): string => `Not changed, because ${scripts.length === 1 ? 'it chains' : 'they chain'} several shell commands: ${listOf(scripts)}. Put ${bin} run -- in front of the command that needs the secrets.`, agentsLine: 'To start the app, its tests or any command that reads the .env, use the package.json script when it already starts with `capy run`; otherwise run it as `capy run -- ` (for example `capy run -- npm run dev`, `capy run -- make dev`, `capy run -- python app.py`). Without it the app gets ciphertext. Never decrypt the .env any other way.', }, @@ -73,9 +73,9 @@ export const SETUP_COPY = { description: 'The Capy project this folder links to.', newLabel: 'New project', newLabelNamed: (name: string): string => `New project (${name})`, - newWithEnv: 'Import this folder\'s .env into a new project', + newWithEnv: 'Import this folder\'s variables into a new project', newEmpty: 'Start a new project for this folder', - existingWithEnv: 'Link this folder to it. Its secrets replace this .env, and a copy of the old one is kept', + existingWithEnv: 'Link this folder to it. Its secrets replace this folder\'s variables, and a copy of the old ones is kept', existingEmpty: 'Link this folder to it', }, /** The whole form's question while the project questions are asked. */ @@ -178,12 +178,12 @@ export const SETUP_COPY = { confirmImport: 'Link and set up', secrets: (variables: number): string => `${variables} secrets`, question: (secrets: string, project: string, org: string, branch: string): string => `Encrypt these ${secrets} and push to ${project} (${org}) on ${branch}?`, - yes: (project: string, secrets: string): string => `Create ${project}, encrypt the .env and push its ${secrets}`, - description: 'After this the .env holds ciphertext, so check this is the right project first.', - no: 'Nothing is created and the .env is not changed', + yes: (project: string, secrets: string): string => `Create ${project}, encrypt your variables and push its ${secrets}`, + description: 'After this your variables are stored encrypted, so check this is the right project first.', + no: 'Nothing is created and your variables are not changed', }, /** `--run-scripts` (CAP-960). */ - runScriptsFlag: 'whether setup changes the local scripts in package.json (dev, test and the like) to start with capy run, so they get the decrypted .env (asked when there are any; default yes); build and deploy scripts are never changed', + runScriptsFlag: 'whether setup changes the local scripts in package.json (dev, test and the like) to start with capy run, so they get the decrypted variables (asked when there are any; default yes); build and deploy scripts are never changed', runScriptsNoFlag: 'Leave package.json as it is', yes: 'Yes', no: 'No', diff --git a/src/types/index.ts b/src/types/index.ts index 6235807a..a5298da4 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -456,7 +456,7 @@ export interface SetupAnswers { readonly deploymentsAnswer?: string; /** `--pr` / `--no-pr` as typed, as `yes` or `no` (CAP-954): whether a shared setup opens a pull request. No: "Commit without a pull request". */ readonly prAnswer?: string; - /** `--run-scripts` / `--no-run-scripts` as typed, as `yes` or `no` (CAP-960): the Set up step's "Run your scripts with the encrypted .env". */ + /** `--run-scripts` / `--no-run-scripts` as typed, as `yes` or `no` (CAP-960): the Set up step's "Run your scripts with your encrypted variables". */ readonly runScriptsAnswer?: string; } diff --git a/tests/commands/agentSetup.test.ts b/tests/commands/agentSetup.test.ts index 58dbff5e..f933208b 100644 --- a/tests/commands/agentSetup.test.ts +++ b/tests/commands/agentSetup.test.ts @@ -190,7 +190,7 @@ describe('questions left: one INIT_INPUT_REQUIRED form, nothing created or writt expect(form.kind).toBe('form'); expect(fieldNames(out.json)).toEqual(['project']); expect(form.fields[0].options).toEqual([ - { value: 'proj-web', label: 'web', description: 'Link this folder to it. Its secrets replace this .env, and a copy of the old one is kept' }, + { value: 'proj-web', label: 'web', description: 'Link this folder to it. Its secrets replace this folder\'s variables, and a copy of the old ones is kept' }, ]); expect(form.fields[0].description).toBe('The Capy project this folder links to.'); expect(form.answer.rerun).toBe('capy --folder . --project --share-setup no --encrypt-env yes --choice import --json'); diff --git a/tests/ui/setupScreen.test.ts b/tests/ui/setupScreen.test.ts index 44483706..6719ee37 100644 --- a/tests/ui/setupScreen.test.ts +++ b/tests/ui/setupScreen.test.ts @@ -21,7 +21,7 @@ function press(state: SetUpState, ...keys: SetUpKey[]) { return current; } -describe('CAP-960: the "Run your scripts with the encrypted .env" row', () => { +describe('CAP-960: the "Run your scripts with your encrypted variables" row', () => { const withScripts = { offered: [], fixed: 'existing' as const, variables: 2, scripts: ['dev', 'test'], bin: 'capy' }; test('shown only when package.json has scripts to wrap, ticked, naming them', () => { From 8623b0d6ca3dbb25fe09b5a97927b954e9d0ea86 Mon Sep 17 00:00:00 2001 From: cvince Date: Wed, 2 Dec 2026 00:20:52 +0000 Subject: [PATCH 3/5] Parity test allows the folder question to have no description (CAP-982) Its sentence was removed on purpose in ebb9673; its options carry the descriptions, as with the choice question. Recorded in the setup spec. --- tests/commands/elicitationParity.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/commands/elicitationParity.test.ts b/tests/commands/elicitationParity.test.ts index cc0be0ae..bf39a403 100644 --- a/tests/commands/elicitationParity.test.ts +++ b/tests/commands/elicitationParity.test.ts @@ -172,7 +172,8 @@ describe('CAP-951: setup copy has one source, and everything has a description', for (const [shape, input] of Object.entries(SETUP_FORMS)) { for (const f of guided(input).fields) { // The choice's options carry the descriptions; its own sentence was cut (Vincent, 2026-11-30: "useless sentence"). - if (!f.description && f.name !== 'choice') problems.push(`${shape}.${f.name}: no description`); + // The folder question's sentence was cut too (Vincent, 2026-12-01, ebb9673); its options carry the descriptions (CAP-982). + if (!f.description && f.name !== 'choice' && f.name !== 'folder') problems.push(`${shape}.${f.name}: no description`); for (const c of f.ask!.choices) { if (!c.description) problems.push(`${shape}.${f.name}.${c.label}: no description`); else if (c.label.toLowerCase().includes(c.description.replace(/\.$/, '').toLowerCase())) problems.push(`${shape}.${f.name}.${c.label}: description repeats its label`); From db8b97e540349d103fe8c60a58ee60ad06726ffb Mon Sep 17 00:00:00 2001 From: cvince Date: Wed, 2 Dec 2026 00:58:17 +0000 Subject: [PATCH 4/5] Share question uses the agreed wording: Sync through Capy / Sync through Capy and Git (CAP-982) Vincent chose these labels on 2026-12-01 (CAP-979). Descriptions say Capy's setup instead of keep.lock; --share-setup help and the setup display table follow. No "this folder only" left in this question. --- docs/cli-reference.md | 12 ++++++------ src/core/bareSetupFlags.ts | 4 ++-- src/core/setupCopy.ts | 10 +++++----- src/index-dev.ts | 2 +- src/index.ts | 2 +- src/ui/elicitationDisplay.ts | 2 +- tests/commands/agentSetup.test.ts | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/cli-reference.md b/docs/cli-reference.md index 4dcae992..d9127ad4 100644 --- a/docs/cli-reference.md +++ b/docs/cli-reference.md @@ -20,9 +20,9 @@ capy [options] | `--branch ` | the first branch of a new project (offered by default: development), or the branch of an existing project to use; a Capy branch works like a git branch | | | `--protected [yes|no]` | whether the first branch is protected (invite-only) | | | `--no-protected` | Create it open to the project | | -| `--share-setup [yes|no]` | whether keep.lock is committed so copies of the same code point to the same Capy project (asked in a git repository); no sets up this folder only | | -| `--no-share-setup` | Set up this folder only | | -| `--pr [yes|no]` | whether a shared setup opens a pull request with keep.lock (default yes; in agent mode, no leaves the pull request out of the git action) | | +| `--share-setup [yes|no]` | whether Capy's setup is also committed to Git so every copy of the code points to the same Capy project (asked in a git repository); Capy syncs it either way | | +| `--no-share-setup` | Sync through Capy | | +| `--pr [yes|no]` | whether a shared setup opens a pull request with Capy's setup (default yes; in agent mode, no leaves the pull request out of the git action) | | | `--no-pr` | Commit without a pull request | | | `--encrypt-env [yes|no]` | whether a new project encrypts this folder's .env and pushes its secrets (asked when the .env has any); no creates nothing | | | `--no-encrypt-env` | Create nothing and leave the .env as it is | | @@ -462,8 +462,8 @@ capy setup [options] | `--branch ` | the first branch of a new project (offered by default: development), or the branch of an existing project to use | | | `--protected [yes|no]` | whether the first branch is protected (invite-only) | | | `--no-protected` | Create it open to the project | | -| `--share-setup [yes|no]` | whether Capy's setup is committed to Git so copies of the same code point to the same Capy project (asked in a git repository); no sets up this folder only | | -| `--no-share-setup` | Set up this folder only | | +| `--share-setup [yes|no]` | whether Capy's setup is also committed to Git so every copy of the code points to the same Capy project (asked in a git repository); Capy syncs it either way | | +| `--no-share-setup` | Sync through Capy | | | `--pr [yes|no]` | whether a shared setup opens a pull request with Capy's setup (default yes; in agent mode, no leaves the pull request out of the git action) | | | `--no-pr` | Commit without a pull request | | | `--encrypt-env [yes|no]` | whether a new project encrypts this folder's .env and pushes its secrets (asked when the .env has any); no creates nothing | | @@ -1391,4 +1391,4 @@ Every refusal carries a stable `code` — branch on it, never on message text. - **Codes**: Branch only on the machine-readable `code` field (from --json output or a CapyError), never on human-readable message text — messages may be reworded without notice. - **Conflicts**: Every command that writes from a folder (edit, add, remove, connect, rotate, push, checkout, org, deploy, deploy revoke, deploy targets-remove) runs bare `capy` first; `checkout -b` is the one exception (a new branch carries the uncommitted values of the folder). Off a terminal, if the folder and Capy differ on any variable, nothing is written, the exit code is 3, and stdout is {ok:false, code:"SECRETS_CONFLICT", conflict_id, conflicts:[{name, project, branch, type, pinned, local, remote}]} (fingerprints only, never values; a Dokploy value has {name, target, pinned, local, remote}). Folder-only rows omit pinned and list their available choices. Choosing an absent side removes that name. Ask the person to select from the choices for each row, then rerun the same command with --resolve NAME= for every row (NAME@TARGET=local|remote for a Dokploy value) and --conflict . A state that moved since is SECRETS_CONFLICT_STALE with the fresh rows. There is no resolve-all. `secrets set` and `secrets deploy` take the same --resolve and --conflict for a location that changed since its row was listed. - **Organizations**: These commands work on an organization, not on a folder, and run with no project folder: users, grant-branch, revoke-branch, invite, kick, projects, projects rename --project-id, project create, project delete, project restore, secrets, secrets set, secrets deploy, system. The organization is the one in the keep.lock of the folder when it has one, else the only organization the account belongs to. With several organizations, no keep.lock and nobody to ask, `users --json`, `projects rename` and `project create|delete|restore` refuse with ORG_SELECTION_REQUIRED (exit 3), `orgs:[{id, name}]` and a form asking which; each of those commands takes `--org `, which picks among the account's own organizations only. -- **Elicitation**: A refusal with exit code 3 can carry an `elicitation` next to its `code`: a question for the human, never for you. Write `display` (a markdown table) in your reply exactly as given, without shortening or reordering it and never inside the question. Then ask the short `question` as an elicitation with your question tool: one question per field, every field of the form together in one go (never one, then the next), using the field's own `question` followed by its `description` when it has them, and its `options` or `default` as the choices; without a question tool, end your reply with the `question` and the human answers in chat. `capy setup` adds two things to each of its stops (CAP-940): a form's `instructions`, written from its own fields (ask them all together, list a field with more choices than your question tool holds in chat as text, run `answer.rerun` at once), and `next`, the steps still to come (pairing, the Set up step, the project questions, the finished setup), so you never stop to ask whether to go on; follow both. kind "confirm" is a yes/no ({kind, question, details, display, answer:{yes}}): ask the human; on yes, run the command in `answer.yes`; on no, stop. kind "form" asks for values ({kind, question, details, display, fields:[{name, type, pattern, question?, default?, description?, options?:[{value, label, description?}], other?}], answer:{rerun}}): ask the human for each field, then run `answer.rerun` with the values filled in. A field with `options` is a choice: offer its `options` (the human picks a `label`, with its `description` under it, and you fill in its `value`), plus "Other" when it has `other: true`. A field without `options` is typed in: with a `default`, offer the `default` and "Other"; with no `default`, leave it out of the question tool and ask its `question` in chat, in the same reply as the other questions. A choice with exactly one option and no `other` is already decided (CAP-978): show it as chosen (its label), do not ask it, and fill its `value` into the rerun. A typed field that only offers its `default` gets "Cancel" too; never pick that answer for the human. On "Other", ask the field's `question` in chat and fill in what the human types, as typed; if your question tool adds its own free-text "Other", that is the "Other" choice, so never add a second. On "Cancel", stop. A field with more choices than your question tool holds (4, counting "Other" and "Cancel"), or one with a label or description your question tool can't show word for word, goes in chat instead: list every choice, its label then its description, and let the human answer there. Never shorten, reword, reorder or drop a choice. On a `capy setup` form each field also has `ask`, these rules already applied: ask it where `ask.in` says (`question_tool` or `chat`, and in chat when your question tool can't show it word for word; `decided` is shown as chosen and never asked) with exactly `ask.choices`, in order and word for word; a choice's `then` is "type_in_chat" for "Other" and "stop" for "Cancel"; `default: true` marks the default, which you may show as recommended but never pick. `details` holds names and ids only, never a value. Today: `capy project restore` without --yes refuses with CONFIRMATION_REQUIRED and a confirm (details: {org:{id,name}, project:{id,name,deleted_at}}); `capy project delete` without --yes refuses with CONFIRMATION_REQUIRED and a confirm (details: {org:{id,name}, project:{id,name}, branches:[name], variables:[{name, branches:[name]}], live_deploy_tokens:[{deploy_id, label}], unavailable?:["branches"|"variables"]}); `capy project create` missing the name, `--branch` or `--protected` in agent mode refuses with PROJECT_NAME_REQUIRED, BRANCH_NAME_REQUIRED or BRANCH_PROTECTION_REQUIRED and a form (fields: name, branch, protected (options yes/no); details: {org:{id,name}}); `capy project delete` / `project restore` with a name several projects share refuses with PROJECT_AMBIGUOUS and a form with one `project` field whose options are the projects (details: {org:{id,name}, matches:[{id, name, created_at, variables}]}); `capy kick ` without --yes refuses with CONFIRMATION_REQUIRED and a confirm (details: {org:{id,name}, member:{email}}); `capy projects rename` with no name refuses with PROJECT_NAME_REQUIRED and a form with one `name` field (details: {org:{id,name}, project:{id,name}}); `capy secrets set` / `capy secrets deploy` with a project that is linked to more than one repo refuses with PR_REPO_AMBIGUOUS and a form with one field per such project whose options are its repos (details: {projects:[{id, name, repos:[owner/name[/folder]]}]}); pass the same `--pr-repo` again on the run with `--confirm`. `capy branch -D NAME` without --yes in agent mode refuses with CONFIRMATION_REQUIRED and a confirm (details: {branch:{name}}); `capy remove NAME...` without --yes refuses with REMOVE_NEEDS_TTY and a confirm (details: {branch, variables:[name], removing_all}); `capy system rm NAME` without --yes refuses with SYSTEM_STORE_NEEDS_TTY and a confirm (details: {name, org?}); `capy connect vercel|dokploy` with --overwrite or --discover and without --yes refuses with VERCEL_CONFIRMATION_REQUIRED or DOKPLOY_CONFIRMATION_REQUIRED (exit 3) and a confirm whose `display` lists the terminal's lines (details: {import, replace, clear} or {folders}); `capy connect vercel` with nobody to ask refuses with VERCEL_TEAM_REQUIRED (form, one `team` field whose options are the team slugs; details: {teams:[{id, slug}]}), VERCEL_PROJECT_REQUIRED (form, one typed `project` field; details: {}) or VERCEL_ENVIRONMENT_REQUIRED (form, one `environment` field whose options are the environments; details: {branch, environments:[name]}), all exit 3; `capy connect dokploy` refuses with DOKPLOY_TARGET_AMBIGUOUS (form, one `target` field: each option's label is a saved target and its value that target's flags; details: {targets:[name]}) or DOKPLOY_SETTINGS_MISSING (form asking only what is missing: `base_url`, then `source` (option values `--application` / `--compose`) and `service_id`; details: {}); fill the values into `answer.rerun` as they are. With nobody at a terminal, these picks refuse with a form of one field whose options are the terminal's choices (exit 3): `capy rotate` with no variable, ROTATE_VARIABLE_REQUIRED (field `variable`; details: {branch, variables}); `capy rotate VAR` for an unmanaged variable with several integrations, ROTATE_PROVIDER_REQUIRED (field `provider`; details: {variable, providers}); `capy invite` for a role that needs project access, INVITE_PROJECT_REQUIRED (field `project`, one project; details: {role, projects:[{id, name}]}); `capy connect stripe` with several accounts, STRIPE_ACCOUNT_REQUIRED (field `account`; details: {accounts:[{name, account_id}]}); `capy connect stripe|workos` when the key's variable is unclear, CONNECTOR_VAR_REQUIRED (field `var`; details: {branch, variables}). `capy rotate` has no --json, so its `answer.rerun` ends with --non-tty. A command that works on an organization (users, projects, project create|delete|restore, projects rename, secrets, invite, kick, grant-branch, revoke-branch) with several organizations, no keep.lock and no --org refuses with ORG_SELECTION_REQUIRED (exit 3) and a form with one `org` field whose options are the org ids labelled by name (details: {orgs:[{id, name}]}); its rerun adds --org. `capy agents` (or `capy agents --remove`) without --yes in agent mode refuses with AGENTS_SETUP_NEEDS_TTY and a confirm asking the terminal's question (details: {files:[{path, action}]}); `capy checkout NAME -b --json` without --protected or --no-protected refuses with BRANCH_PROTECTION_REQUIRED and a form with one `protected` field whose option values are the flags `--protected` and `--no-protected` (details: {branch:{name}}); its `answer.rerun` uses --non-tty, because `-b --json` only describes the route. kind "link" hands the human a page to approve on ({kind, url, code, fingerprint?, purpose, expires_at, qr?:{text?, image?:{mime_type, file, data_uri?}}, instructions, answer:{wait}}): write the `url` as a clickable link, with the `code`, the `fingerprint` (the page shows the same one) and `expires_at`, as plain text, every time a link is shown (the `qr`, as `conventions.pairing` says, is only an addition, never the only way), then run `answer.wait` at once in the foreground (it can take up to 9 minutes, so give it a tool timeout of at least 10 minutes), and run it again whenever it exits 3 with PAIR_STILL_WAITING or your tool stopped it early; when it exits 3 with PAIR_LINK_RENEWED the old link expired and the elicitation is a new link: show it to the human the same way and run its `answer.wait` again. Its `instructions` say the same. Pass `--title` and `--description` to `capy pair` and `capy setup`: your own words for what you are doing and why, which Keep shows the human on the unlock request; `capy setup` refuses to start a pairing without them (SETUP_INTENT_REQUIRED, exit 1, with `next_command`). Today `capy pair` in agent mode asks nothing up front (no email, no keys choice: on a machine with no keys it asks for them, and Keep decides after sign-in between the organization keys and a new organization); it refuses with PAIR_APPROVAL_PENDING and a link; once the human approves, the wait refuses with PAIR_CODE_REQUIRED (or PAIR_CODE_MISMATCH after a wrong code) and a form (field: code; details: {attempts_left?}) for the one-time code Keep shows the human; never fill in the code yourself. Bare `capy` in a folder that is not a project, in agent mode, with questions left refuses with INIT_INPUT_REQUIRED and one form that asks only what is unanswered: first, alone, folder when no --folder was typed (options: this folder and every subfolder that holds a .env or a package file, those with a .env first, each option's description saying which it holds, with `other`; when there are more choices than your question tool takes, list every option with its description in chat and let the human answer there, never dropping one; the rerun adds --folder), then org (options: the organizations; asked before the project questions when there are several, with only share beside it), then the Set up step when no --choice was typed (CAP-941: when a choice that creates a project fits, the same form also asks that new project's `name` and first `branch`, and `share` inside Git, so there is one round trip after the code; `details.new_project_fields` names them; they are used only by `existing` and `new`, and a rerun with `--choice import` ignores `--name`, and ignores `--branch` until the project to link is answered, so it asks the project and then its branch; question "What would you like Capy to set up?"; field `choice` offers only the choices that fit: `existing` "Create a new Capy project from the existing .env file" when the .env has secrets, `new` "Create a new Capy project" when it has none, `import` "Start from another project" (link this folder to a project that already exists) when the organization has a project, and `skip` "Skip project setup for now"; when only one fits, `choice` is a field with that one option, already decided (`ask.in` is `decided`): show it as chosen and never ask it; fields `discover` ("Discover application services") and `deployments` ("Manage secrets deployments"), options yes/no, default yes; CAP-960: when the folder's package.json has local scripts (dev, test and the like) also `run_scripts` ("Run your scripts with your encrypted variables"), options yes/no, default yes, its description naming the scripts (`details.scripts`); yes changes each to start with `capy run --`, never build, deploy or install scripts, and the rerun adds --run-scripts; encrypting the .env is always on and is never a field, `details.always.encrypt_line` says it; answering the step is the yes to encrypting, so no separate encrypt question follows; the rerun adds --choice, --discover and --deployments (and --run-scripts when asked); `skip` creates nothing, leaves the .env as it is and ends with `skipped: true` (`capy setup` then returns `setup: "skipped"` and writes no AGENTS block); a --choice that does not fit refuses with SETUP_CHOICE_UNAVAILABLE (exit 3, `extra.choices` lists the ones that fit: ask the human again with those); a --choice, --discover or --deployments that is not one of its values refuses with SETUP_CHOICE_INVALID or SETUP_SCOPE_INVALID; the result carries `setup_choice` and `scope`), project (for `import` only; options: the existing projects), then for a new project (`existing` or `new`) name (its default is a free name: the folder's, or the first free `-2` to `-9`; a name that turns out to be taken refuses with PROJECT_NAME_EXISTS, exit 3, and the same form asking only `name`, its `display` saying the name is taken: ask the human again and run its `answer.rerun`) and branch (its protection is not asked: the first branch starts open, as in the terminal, unless --protected was typed), and for an existing project branch (options: that project's branches, never chosen for the human even when there is one), or, when that project has no branches yet, branch for its first one (default development; the rerun creates it open to the project); and, inside a git repository, share (options yes: "Share the setup with your team", no: "Set up this folder only"; the rerun adds --share-setup); a typed --encrypt-env no still creates nothing and leaves the .env as it is; while folder is asked its `display` only names the folder Capy runs in; otherwise its `display` is the whole summary, so after the human answers, run `answer.rerun` with no further confirmation (details: {folder?, org?, orgs?, projects?, project?, branches?, new_project_fields?, variables}; `variables` is a count). Never answer it yourself and never add --yes on your own. A finished setup can carry `warnings`, each with a `code`, a `message` and a `next` step (today ENV_IN_GIT_HISTORY: the .env was committed to Git, so its old values are still in the history; and GITIGNORE_NOT_COMMITTED: the .gitignore is left out of the commit of a shared setup (and of `git.files`), because it has changes Capy did not make): tell the human each `message` and its `next` step in your reply, and never act on it for them. CAP-960: a finished setup carries `run` ({command, message, note?}): the .env now holds ciphertext, so tell the human `message` and `command` (the command that starts the app with the decrypted .env, or null), and `note` when there is one; start the app, its tests and anything that reads the .env only that way. `scripts` ({file, wrapped, skipped}) lists the package.json scripts Capy changed; in a shared setup package.json is in `git.files` when Capy's change is its only one. CAP-971: discovery is yours. A finished setup whose Set up step looks for services or deployments carries `discover` in place of `summary`: follow its `instructions`. CAP-954: in agent mode Capy commits nothing and runs no gh. A setup shared through Git ("Share the setup with your team") ends with `git`: `folder`, `files`, `commit_message`, `branch`, `base`, `pull_request` ({title, body}, or null with `--pr no` or no origin), `instructions` and `commands`. Follow its `instructions` with your own Git access and access to the Git host: commit exactly `files` in `folder` with `commit_message`, open `pull_request` on `base` from `branch` so it holds only those files (push the commit as `branch` only when its parent is the head of `base` on origin, else make `branch` from `base` on origin); Capy pull requests stack: with an open pull request from a `capy/` branch, open it on the newest open `capy/` branch that no other open pull request is based on, and show the human its link. Never change Git settings or identity yourself; if Git has no name or email, ask the human to set theirs. Without Git tools, run `commands` in `folder` exactly as given. `capy setup --conversation --json` asks those folder questions in a Keep conversation instead (CAP-921): it refuses with CONVERSATION_OPEN (exit 3) and a link whose `purpose` is "conversation" (show its url, fingerprint and expiry the same way, and its `preview` steps), then run `answer.wait` (`capy setup --wait --folder --flow --json`, which finds the conversation from any folder) at once and again on every exit 3. When Keep can't hold the conversation, `capy setup --conversation` refuses with CONVERSATION_ASK_IN_CHAT (exit 3, `extra.conversation_unavailable.reason`: not_signed_in, no_transport_record, no_local_key or refused) and the same question it would have asked: tell the human its `message`, then ask the question in chat as above; its `answer.rerun` keeps `--conversation`, so the next step tries Keep again. On a machine that must pair first, the pairing's commands keep `--conversation`, so the questions go to Keep once it is paired. Waits: CONVERSATION_WAITING means nothing new yet; CONVERSATION_STEP_DONE means the human answered a step in Keep (`step`, `answered_in: "keep"`, `answers`, `goals`): show it as done in one line and run the wait again. Never end your turn between waits while the conversation is open: run `answer.wait` again at once after every exit 3. Nothing is lost if a wait ends or your tool stops it: answers given in Keep while no wait runs are kept and returned by the next wait. To reconnect from a fresh session, run `capy setup --wait --json` in the same folder (add `--flow ` only when more than one conversation is open there), or `capy setup --conversation --json` there, which hands back the open conversation's link with `resumed: true`. CAP-977: CONVERSATION_STEP_REPEATED (exit 1, `shown_in_keep: true`, `step`) means setup asked the human the exact question they had just answered; it was not posted again, Keep shows the step as failed, and the answers are kept: tell the human in one line and report it as a Capy bug, never answer it yourself. The finished setup has `conversation.code` CONVERSATION_DONE. `goals` lists every step with its status. Add `--note -` to the wait to show the human a plain-text note in Keep (piped on stdin, at most 2,000 characters, no links; it is echoed back as `note`), and `--cancel` to end the conversation. CAP-957: one wait (280 seconds by default) runs on through every step the human answers in Keep (run it in the foreground with a tool timeout of at least 6 minutes) and returns early only at the end, at a stop, or when its time is up; CONVERSATION_STEP_DONE then lists every step answered during it in `steps`. Every stop reaches Keep. A refused answer given in Keep is asked again in Keep, so you only see a wait. Any other stop comes to you as its own refusal with `shown_in_keep: true` and `answer.wait`: Keep has already told the human that this step stopped, so tell them its `message` and next step in one line, then run `answer.wait` again once it is done; the conversation carries on from its saved answers. Running `capy setup --conversation` again in a folder whose conversation is still open hands back the same link with `resumed: true`: show it again and run its `answer.wait`. You never answer a question asked in Keep, and you never see a key or a sealed record. +- **Elicitation**: A refusal with exit code 3 can carry an `elicitation` next to its `code`: a question for the human, never for you. Write `display` (a markdown table) in your reply exactly as given, without shortening or reordering it and never inside the question. Then ask the short `question` as an elicitation with your question tool: one question per field, every field of the form together in one go (never one, then the next), using the field's own `question` followed by its `description` when it has them, and its `options` or `default` as the choices; without a question tool, end your reply with the `question` and the human answers in chat. `capy setup` adds two things to each of its stops (CAP-940): a form's `instructions`, written from its own fields (ask them all together, list a field with more choices than your question tool holds in chat as text, run `answer.rerun` at once), and `next`, the steps still to come (pairing, the Set up step, the project questions, the finished setup), so you never stop to ask whether to go on; follow both. kind "confirm" is a yes/no ({kind, question, details, display, answer:{yes}}): ask the human; on yes, run the command in `answer.yes`; on no, stop. kind "form" asks for values ({kind, question, details, display, fields:[{name, type, pattern, question?, default?, description?, options?:[{value, label, description?}], other?}], answer:{rerun}}): ask the human for each field, then run `answer.rerun` with the values filled in. A field with `options` is a choice: offer its `options` (the human picks a `label`, with its `description` under it, and you fill in its `value`), plus "Other" when it has `other: true`. A field without `options` is typed in: with a `default`, offer the `default` and "Other"; with no `default`, leave it out of the question tool and ask its `question` in chat, in the same reply as the other questions. A choice with exactly one option and no `other` is already decided (CAP-978): show it as chosen (its label), do not ask it, and fill its `value` into the rerun. A typed field that only offers its `default` gets "Cancel" too; never pick that answer for the human. On "Other", ask the field's `question` in chat and fill in what the human types, as typed; if your question tool adds its own free-text "Other", that is the "Other" choice, so never add a second. On "Cancel", stop. A field with more choices than your question tool holds (4, counting "Other" and "Cancel"), or one with a label or description your question tool can't show word for word, goes in chat instead: list every choice, its label then its description, and let the human answer there. Never shorten, reword, reorder or drop a choice. On a `capy setup` form each field also has `ask`, these rules already applied: ask it where `ask.in` says (`question_tool` or `chat`, and in chat when your question tool can't show it word for word; `decided` is shown as chosen and never asked) with exactly `ask.choices`, in order and word for word; a choice's `then` is "type_in_chat" for "Other" and "stop" for "Cancel"; `default: true` marks the default, which you may show as recommended but never pick. `details` holds names and ids only, never a value. Today: `capy project restore` without --yes refuses with CONFIRMATION_REQUIRED and a confirm (details: {org:{id,name}, project:{id,name,deleted_at}}); `capy project delete` without --yes refuses with CONFIRMATION_REQUIRED and a confirm (details: {org:{id,name}, project:{id,name}, branches:[name], variables:[{name, branches:[name]}], live_deploy_tokens:[{deploy_id, label}], unavailable?:["branches"|"variables"]}); `capy project create` missing the name, `--branch` or `--protected` in agent mode refuses with PROJECT_NAME_REQUIRED, BRANCH_NAME_REQUIRED or BRANCH_PROTECTION_REQUIRED and a form (fields: name, branch, protected (options yes/no); details: {org:{id,name}}); `capy project delete` / `project restore` with a name several projects share refuses with PROJECT_AMBIGUOUS and a form with one `project` field whose options are the projects (details: {org:{id,name}, matches:[{id, name, created_at, variables}]}); `capy kick ` without --yes refuses with CONFIRMATION_REQUIRED and a confirm (details: {org:{id,name}, member:{email}}); `capy projects rename` with no name refuses with PROJECT_NAME_REQUIRED and a form with one `name` field (details: {org:{id,name}, project:{id,name}}); `capy secrets set` / `capy secrets deploy` with a project that is linked to more than one repo refuses with PR_REPO_AMBIGUOUS and a form with one field per such project whose options are its repos (details: {projects:[{id, name, repos:[owner/name[/folder]]}]}); pass the same `--pr-repo` again on the run with `--confirm`. `capy branch -D NAME` without --yes in agent mode refuses with CONFIRMATION_REQUIRED and a confirm (details: {branch:{name}}); `capy remove NAME...` without --yes refuses with REMOVE_NEEDS_TTY and a confirm (details: {branch, variables:[name], removing_all}); `capy system rm NAME` without --yes refuses with SYSTEM_STORE_NEEDS_TTY and a confirm (details: {name, org?}); `capy connect vercel|dokploy` with --overwrite or --discover and without --yes refuses with VERCEL_CONFIRMATION_REQUIRED or DOKPLOY_CONFIRMATION_REQUIRED (exit 3) and a confirm whose `display` lists the terminal's lines (details: {import, replace, clear} or {folders}); `capy connect vercel` with nobody to ask refuses with VERCEL_TEAM_REQUIRED (form, one `team` field whose options are the team slugs; details: {teams:[{id, slug}]}), VERCEL_PROJECT_REQUIRED (form, one typed `project` field; details: {}) or VERCEL_ENVIRONMENT_REQUIRED (form, one `environment` field whose options are the environments; details: {branch, environments:[name]}), all exit 3; `capy connect dokploy` refuses with DOKPLOY_TARGET_AMBIGUOUS (form, one `target` field: each option's label is a saved target and its value that target's flags; details: {targets:[name]}) or DOKPLOY_SETTINGS_MISSING (form asking only what is missing: `base_url`, then `source` (option values `--application` / `--compose`) and `service_id`; details: {}); fill the values into `answer.rerun` as they are. With nobody at a terminal, these picks refuse with a form of one field whose options are the terminal's choices (exit 3): `capy rotate` with no variable, ROTATE_VARIABLE_REQUIRED (field `variable`; details: {branch, variables}); `capy rotate VAR` for an unmanaged variable with several integrations, ROTATE_PROVIDER_REQUIRED (field `provider`; details: {variable, providers}); `capy invite` for a role that needs project access, INVITE_PROJECT_REQUIRED (field `project`, one project; details: {role, projects:[{id, name}]}); `capy connect stripe` with several accounts, STRIPE_ACCOUNT_REQUIRED (field `account`; details: {accounts:[{name, account_id}]}); `capy connect stripe|workos` when the key's variable is unclear, CONNECTOR_VAR_REQUIRED (field `var`; details: {branch, variables}). `capy rotate` has no --json, so its `answer.rerun` ends with --non-tty. A command that works on an organization (users, projects, project create|delete|restore, projects rename, secrets, invite, kick, grant-branch, revoke-branch) with several organizations, no keep.lock and no --org refuses with ORG_SELECTION_REQUIRED (exit 3) and a form with one `org` field whose options are the org ids labelled by name (details: {orgs:[{id, name}]}); its rerun adds --org. `capy agents` (or `capy agents --remove`) without --yes in agent mode refuses with AGENTS_SETUP_NEEDS_TTY and a confirm asking the terminal's question (details: {files:[{path, action}]}); `capy checkout NAME -b --json` without --protected or --no-protected refuses with BRANCH_PROTECTION_REQUIRED and a form with one `protected` field whose option values are the flags `--protected` and `--no-protected` (details: {branch:{name}}); its `answer.rerun` uses --non-tty, because `-b --json` only describes the route. kind "link" hands the human a page to approve on ({kind, url, code, fingerprint?, purpose, expires_at, qr?:{text?, image?:{mime_type, file, data_uri?}}, instructions, answer:{wait}}): write the `url` as a clickable link, with the `code`, the `fingerprint` (the page shows the same one) and `expires_at`, as plain text, every time a link is shown (the `qr`, as `conventions.pairing` says, is only an addition, never the only way), then run `answer.wait` at once in the foreground (it can take up to 9 minutes, so give it a tool timeout of at least 10 minutes), and run it again whenever it exits 3 with PAIR_STILL_WAITING or your tool stopped it early; when it exits 3 with PAIR_LINK_RENEWED the old link expired and the elicitation is a new link: show it to the human the same way and run its `answer.wait` again. Its `instructions` say the same. Pass `--title` and `--description` to `capy pair` and `capy setup`: your own words for what you are doing and why, which Keep shows the human on the unlock request; `capy setup` refuses to start a pairing without them (SETUP_INTENT_REQUIRED, exit 1, with `next_command`). Today `capy pair` in agent mode asks nothing up front (no email, no keys choice: on a machine with no keys it asks for them, and Keep decides after sign-in between the organization keys and a new organization); it refuses with PAIR_APPROVAL_PENDING and a link; once the human approves, the wait refuses with PAIR_CODE_REQUIRED (or PAIR_CODE_MISMATCH after a wrong code) and a form (field: code; details: {attempts_left?}) for the one-time code Keep shows the human; never fill in the code yourself. Bare `capy` in a folder that is not a project, in agent mode, with questions left refuses with INIT_INPUT_REQUIRED and one form that asks only what is unanswered: first, alone, folder when no --folder was typed (options: this folder and every subfolder that holds a .env or a package file, those with a .env first, each option's description saying which it holds, with `other`; when there are more choices than your question tool takes, list every option with its description in chat and let the human answer there, never dropping one; the rerun adds --folder), then org (options: the organizations; asked before the project questions when there are several, with only share beside it), then the Set up step when no --choice was typed (CAP-941: when a choice that creates a project fits, the same form also asks that new project's `name` and first `branch`, and `share` inside Git, so there is one round trip after the code; `details.new_project_fields` names them; they are used only by `existing` and `new`, and a rerun with `--choice import` ignores `--name`, and ignores `--branch` until the project to link is answered, so it asks the project and then its branch; question "What would you like Capy to set up?"; field `choice` offers only the choices that fit: `existing` "Create a new Capy project from the existing .env file" when the .env has secrets, `new` "Create a new Capy project" when it has none, `import` "Start from another project" (link this folder to a project that already exists) when the organization has a project, and `skip` "Skip project setup for now"; when only one fits, `choice` is a field with that one option, already decided (`ask.in` is `decided`): show it as chosen and never ask it; fields `discover` ("Discover application services") and `deployments` ("Manage secrets deployments"), options yes/no, default yes; CAP-960: when the folder's package.json has local scripts (dev, test and the like) also `run_scripts` ("Run your scripts with your encrypted variables"), options yes/no, default yes, its description naming the scripts (`details.scripts`); yes changes each to start with `capy run --`, never build, deploy or install scripts, and the rerun adds --run-scripts; encrypting the .env is always on and is never a field, `details.always.encrypt_line` says it; answering the step is the yes to encrypting, so no separate encrypt question follows; the rerun adds --choice, --discover and --deployments (and --run-scripts when asked); `skip` creates nothing, leaves the .env as it is and ends with `skipped: true` (`capy setup` then returns `setup: "skipped"` and writes no AGENTS block); a --choice that does not fit refuses with SETUP_CHOICE_UNAVAILABLE (exit 3, `extra.choices` lists the ones that fit: ask the human again with those); a --choice, --discover or --deployments that is not one of its values refuses with SETUP_CHOICE_INVALID or SETUP_SCOPE_INVALID; the result carries `setup_choice` and `scope`), project (for `import` only; options: the existing projects), then for a new project (`existing` or `new`) name (its default is a free name: the folder's, or the first free `-2` to `-9`; a name that turns out to be taken refuses with PROJECT_NAME_EXISTS, exit 3, and the same form asking only `name`, its `display` saying the name is taken: ask the human again and run its `answer.rerun`) and branch (its protection is not asked: the first branch starts open, as in the terminal, unless --protected was typed), and for an existing project branch (options: that project's branches, never chosen for the human even when there is one), or, when that project has no branches yet, branch for its first one (default development; the rerun creates it open to the project); and, inside a git repository, share (options yes: "Sync through Capy and Git", no: "Sync through Capy"; the rerun adds --share-setup); a typed --encrypt-env no still creates nothing and leaves the .env as it is; while folder is asked its `display` only names the folder Capy runs in; otherwise its `display` is the whole summary, so after the human answers, run `answer.rerun` with no further confirmation (details: {folder?, org?, orgs?, projects?, project?, branches?, new_project_fields?, variables}; `variables` is a count). Never answer it yourself and never add --yes on your own. A finished setup can carry `warnings`, each with a `code`, a `message` and a `next` step (today ENV_IN_GIT_HISTORY: the .env was committed to Git, so its old values are still in the history; and GITIGNORE_NOT_COMMITTED: the .gitignore is left out of the commit of a shared setup (and of `git.files`), because it has changes Capy did not make): tell the human each `message` and its `next` step in your reply, and never act on it for them. CAP-960: a finished setup carries `run` ({command, message, note?}): the .env now holds ciphertext, so tell the human `message` and `command` (the command that starts the app with the decrypted .env, or null), and `note` when there is one; start the app, its tests and anything that reads the .env only that way. `scripts` ({file, wrapped, skipped}) lists the package.json scripts Capy changed; in a shared setup package.json is in `git.files` when Capy's change is its only one. CAP-971: discovery is yours. A finished setup whose Set up step looks for services or deployments carries `discover` in place of `summary`: follow its `instructions`. CAP-954: in agent mode Capy commits nothing and runs no gh. A setup shared through Git ("Sync through Capy and Git") ends with `git`: `folder`, `files`, `commit_message`, `branch`, `base`, `pull_request` ({title, body}, or null with `--pr no` or no origin), `instructions` and `commands`. Follow its `instructions` with your own Git access and access to the Git host: commit exactly `files` in `folder` with `commit_message`, open `pull_request` on `base` from `branch` so it holds only those files (push the commit as `branch` only when its parent is the head of `base` on origin, else make `branch` from `base` on origin); Capy pull requests stack: with an open pull request from a `capy/` branch, open it on the newest open `capy/` branch that no other open pull request is based on, and show the human its link. Never change Git settings or identity yourself; if Git has no name or email, ask the human to set theirs. Without Git tools, run `commands` in `folder` exactly as given. `capy setup --conversation --json` asks those folder questions in a Keep conversation instead (CAP-921): it refuses with CONVERSATION_OPEN (exit 3) and a link whose `purpose` is "conversation" (show its url, fingerprint and expiry the same way, and its `preview` steps), then run `answer.wait` (`capy setup --wait --folder --flow --json`, which finds the conversation from any folder) at once and again on every exit 3. When Keep can't hold the conversation, `capy setup --conversation` refuses with CONVERSATION_ASK_IN_CHAT (exit 3, `extra.conversation_unavailable.reason`: not_signed_in, no_transport_record, no_local_key or refused) and the same question it would have asked: tell the human its `message`, then ask the question in chat as above; its `answer.rerun` keeps `--conversation`, so the next step tries Keep again. On a machine that must pair first, the pairing's commands keep `--conversation`, so the questions go to Keep once it is paired. Waits: CONVERSATION_WAITING means nothing new yet; CONVERSATION_STEP_DONE means the human answered a step in Keep (`step`, `answered_in: "keep"`, `answers`, `goals`): show it as done in one line and run the wait again. Never end your turn between waits while the conversation is open: run `answer.wait` again at once after every exit 3. Nothing is lost if a wait ends or your tool stops it: answers given in Keep while no wait runs are kept and returned by the next wait. To reconnect from a fresh session, run `capy setup --wait --json` in the same folder (add `--flow ` only when more than one conversation is open there), or `capy setup --conversation --json` there, which hands back the open conversation's link with `resumed: true`. CAP-977: CONVERSATION_STEP_REPEATED (exit 1, `shown_in_keep: true`, `step`) means setup asked the human the exact question they had just answered; it was not posted again, Keep shows the step as failed, and the answers are kept: tell the human in one line and report it as a Capy bug, never answer it yourself. The finished setup has `conversation.code` CONVERSATION_DONE. `goals` lists every step with its status. Add `--note -` to the wait to show the human a plain-text note in Keep (piped on stdin, at most 2,000 characters, no links; it is echoed back as `note`), and `--cancel` to end the conversation. CAP-957: one wait (280 seconds by default) runs on through every step the human answers in Keep (run it in the foreground with a tool timeout of at least 6 minutes) and returns early only at the end, at a stop, or when its time is up; CONVERSATION_STEP_DONE then lists every step answered during it in `steps`. Every stop reaches Keep. A refused answer given in Keep is asked again in Keep, so you only see a wait. Any other stop comes to you as its own refusal with `shown_in_keep: true` and `answer.wait`: Keep has already told the human that this step stopped, so tell them its `message` and next step in one line, then run `answer.wait` again once it is done; the conversation carries on from its saved answers. Running `capy setup --conversation` again in a folder whose conversation is still open hands back the same link with `resumed: true`: show it again and run its `answer.wait`. You never answer a question asked in Keep, and you never see a key or a sealed record. diff --git a/src/core/bareSetupFlags.ts b/src/core/bareSetupFlags.ts index 267dbd91..8539cb32 100644 --- a/src/core/bareSetupFlags.ts +++ b/src/core/bareSetupFlags.ts @@ -20,9 +20,9 @@ export function bareSetupOptions(): readonly Option[] { new Option('--branch ', 'the first branch of a new project (offered by default: development), or the branch of an existing project to use; a Capy branch works like a git branch'), // COPY-FLAG new Option('--protected [yes|no]', 'whether the first branch is protected (invite-only)'), new Option('--no-protected', 'Create it open to the project'), - new Option('--share-setup [yes|no]', 'whether keep.lock is committed so copies of the same code point to the same Capy project (asked in a git repository); no sets up this folder only'), // COPY-FLAG + new Option('--share-setup [yes|no]', 'whether Capy\'s setup is also committed to Git so every copy of the code points to the same Capy project (asked in a git repository); Capy syncs it either way'), // COPY-FLAG new Option('--no-share-setup', SETUP_COPY.share.folderOnly.label), // COPY-FLAG - new Option('--pr [yes|no]', 'whether a shared setup opens a pull request with keep.lock (default yes; in agent mode, no leaves the pull request out of the git action)'), // COPY-FLAG + new Option('--pr [yes|no]', 'whether a shared setup opens a pull request with Capy\'s setup (default yes; in agent mode, no leaves the pull request out of the git action)'), // COPY-FLAG new Option('--no-pr', SETUP_COPY.github.noPr.label), // COPY-FLAG new Option('--encrypt-env [yes|no]', 'whether a new project encrypts this folder\'s .env and pushes its secrets (asked when the .env has any); no creates nothing'), // COPY-FLAG new Option('--no-encrypt-env', 'Create nothing and leave the .env as it is'), // COPY-FLAG diff --git a/src/core/setupCopy.ts b/src/core/setupCopy.ts index 0b19e1b1..1b9e8e1c 100644 --- a/src/core/setupCopy.ts +++ b/src/core/setupCopy.ts @@ -113,14 +113,14 @@ export const SETUP_COPY = { }, share: { question: 'How would you like to set up Capy for this project?', - description: 'Whether this folder\'s Capy setup, which names its Capy project, is committed to Git.', + description: 'Capy keeps this project\'s setup in sync either way. The choice is whether Git carries it as well.', folderOnly: { - label: 'Set up this folder only', - description: 'When teammates set up their own copy of the app, they’ll need to choose this project in Capy to get its secrets.', + label: 'Sync through Capy', + description: 'Capy keeps this project\'s setup in sync. It isn\'t committed to Git, so a teammate setting up their own copy of the code picks this project in Capy.', }, shared: { - label: 'Share the setup with your team', - description: 'Capy\'s setup is committed to Git (and, on GitHub, opened as a pull request), so copies of the same code point to the same Capy project and secret versions (this is useful for keeping larger teams or more complex projects in sync).', + label: 'Sync through Capy and Git', + description: 'Capy\'s setup is also committed to Git (and, on GitHub, opened as a pull request), so every copy of the code points to the same Capy project and secret versions without picking it.', }, }, /** diff --git a/src/index-dev.ts b/src/index-dev.ts index 49d0fed8..db8739b2 100644 --- a/src/index-dev.ts +++ b/src/index-dev.ts @@ -554,7 +554,7 @@ program .option('--branch ', 'the first branch of a new project (offered by default: development), or the branch of an existing project to use') // COPY-FLAG .option('--protected [yes|no]', 'whether the first branch is protected (invite-only)') .option('--no-protected', 'Create it open to the project') - .option('--share-setup [yes|no]', 'whether Capy\'s setup is committed to Git so copies of the same code point to the same Capy project (asked in a git repository); no sets up this folder only') // COPY-FLAG + .option('--share-setup [yes|no]', 'whether Capy\'s setup is also committed to Git so every copy of the code points to the same Capy project (asked in a git repository); Capy syncs it either way') // COPY-FLAG .option('--no-share-setup', SETUP_COPY.share.folderOnly.label) // COPY-FLAG .option('--pr [yes|no]', 'whether a shared setup opens a pull request with Capy\'s setup (default yes; in agent mode, no leaves the pull request out of the git action)') // COPY-FLAG .option('--no-pr', SETUP_COPY.github.noPr.label) // COPY-FLAG diff --git a/src/index.ts b/src/index.ts index 40460bad..bfcfd229 100644 --- a/src/index.ts +++ b/src/index.ts @@ -787,7 +787,7 @@ program .option('--branch ', 'the first branch of a new project (offered by default: development), or the branch of an existing project to use') // COPY-FLAG .option('--protected [yes|no]', 'whether the first branch is protected (invite-only)') .option('--no-protected', 'Create it open to the project') - .option('--share-setup [yes|no]', 'whether Capy\'s setup is committed to Git so copies of the same code point to the same Capy project (asked in a git repository); no sets up this folder only') // COPY-FLAG + .option('--share-setup [yes|no]', 'whether Capy\'s setup is also committed to Git so every copy of the code points to the same Capy project (asked in a git repository); Capy syncs it either way') // COPY-FLAG .option('--no-share-setup', SETUP_COPY.share.folderOnly.label) // COPY-FLAG .option('--pr [yes|no]', 'whether a shared setup opens a pull request with Capy\'s setup (default yes; in agent mode, no leaves the pull request out of the git action)') // COPY-FLAG .option('--no-pr', SETUP_COPY.github.noPr.label) // COPY-FLAG diff --git a/src/ui/elicitationDisplay.ts b/src/ui/elicitationDisplay.ts index 64905a58..0bb9b70a 100644 --- a/src/ui/elicitationDisplay.ts +++ b/src/ui/elicitationDisplay.ts @@ -162,7 +162,7 @@ function folderRow(input: SetupDisplayInput): readonly [string, string] { /** The sharing row, inside a git repository only. */ function sharingRows(input: SetupDisplayInput): ReadonlyArray { if (input.sharing === undefined) return []; - const cells = { ask: TO_CHOOSE, shared: 'shared through Git (Capy\'s setup is committed)', 'folder-only': 'this folder only' } as const; // COPY-FLAG + const cells = { ask: TO_CHOOSE, shared: SETUP_COPY.share.shared.label, 'folder-only': SETUP_COPY.share.folderOnly.label } as const; // COPY-FLAG return [['Setup', cells[input.sharing]]]; // COPY-FLAG } diff --git a/tests/commands/agentSetup.test.ts b/tests/commands/agentSetup.test.ts index f933208b..893cfd8f 100644 --- a/tests/commands/agentSetup.test.ts +++ b/tests/commands/agentSetup.test.ts @@ -1146,8 +1146,8 @@ describe('which folder, and this folder only or shared through Git (spec 3l, CAP expect(field.question).toBe('How would you like to set up Capy for this project?'); expect(field.default).toBeUndefined(); expect(field.options).toEqual([ - { value: 'no', label: 'Set up this folder only', description: 'When teammates set up their own copy of the app, they’ll need to choose this project in Capy to get its secrets.' }, - { value: 'yes', label: 'Share the setup with your team', description: "Capy's setup is committed to Git (and, on GitHub, opened as a pull request), so copies of the same code point to the same Capy project and secret versions (this is useful for keeping larger teams or more complex projects in sync)." }, + { value: 'no', label: 'Sync through Capy', description: "Capy keeps this project's setup in sync. It isn't committed to Git, so a teammate setting up their own copy of the code picks this project in Capy." }, + { value: 'yes', label: 'Sync through Capy and Git', description: "Capy's setup is also committed to Git (and, on GitHub, opened as a pull request), so every copy of the code points to the same Capy project and secret versions without picking it." }, ]); expect(out.json!.elicitation.answer.rerun).toBe('capy --folder . --name demo --branch development --protected no --share-setup --encrypt-env yes --choice new --json'); expect(calls.initializeProject).not.toHaveBeenCalled(); From cb46822552df135d43f6cd4018c35bdea059b4df Mon Sep 17 00:00:00 2001 From: cvince Date: Wed, 2 Dec 2026 00:59:23 +0000 Subject: [PATCH 5/5] Setup display table says synced through Capy / Capy and Git, as the spec has it (CAP-982) --- src/ui/elicitationDisplay.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/elicitationDisplay.ts b/src/ui/elicitationDisplay.ts index 0bb9b70a..06fd38c5 100644 --- a/src/ui/elicitationDisplay.ts +++ b/src/ui/elicitationDisplay.ts @@ -162,7 +162,7 @@ function folderRow(input: SetupDisplayInput): readonly [string, string] { /** The sharing row, inside a git repository only. */ function sharingRows(input: SetupDisplayInput): ReadonlyArray { if (input.sharing === undefined) return []; - const cells = { ask: TO_CHOOSE, shared: SETUP_COPY.share.shared.label, 'folder-only': SETUP_COPY.share.folderOnly.label } as const; // COPY-FLAG + const cells = { ask: TO_CHOOSE, shared: 'synced through Capy and Git', 'folder-only': 'synced through Capy' } as const; // COPY-FLAG return [['Setup', cells[input.sharing]]]; // COPY-FLAG }