@backifydev/cli 0.3.23 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,30 @@
2
2
 
3
3
  ## Browser pages opened by the CLI
4
4
 
5
- Every page the CLI opens is a standalone page under `/cli/…` (or the CLI sign-in page), outside the portal navigation and focused on the single task the coding tool needs the user to perform: sign in and authorize the CLI, approve an integration and connect its provider account, or confirm a custom domain and add its DNS records. Links are validated by the CLI before opening; anything else is rejected.
5
+ Every page the CLI opens is a standalone page under `/tasks/…` or `/cli/…` (or the CLI sign-in page), outside the portal navigation and focused on the single task the coding tool needs the user to perform: sign in and authorize the CLI, approve an integration and connect its provider account, or confirm a custom domain and add its DNS records. Links are validated by the CLI before opening; anything else is rejected.
6
+
7
+ ## Steps only a person may perform
8
+
9
+ Some steps must be done by a person in the browser under their own Backify permissions. These include signing in with Microsoft or GitHub, approving a plan or someone else's request, paying, granting consent and permanently deleting things. For these, the CLI requests a **human task**, opens its page at `/tasks/<task-id>`, prints the match code the page will show, and waits. Agents may pre-fill a task but never complete it.
10
+
11
+ ```sh
12
+ backify signup # without an account: sign up, choose a plan and approve this CLI's access
13
+ backify github connect # install or choose the Backify GitHub App
14
+ backify azure connect --subscription <id> --region swedencentral
15
+ backify azure reconnect|update-agent|uninstall|remove --connection <cloud-connection-id>
16
+ backify task start approval --set approvalId=<id>
17
+ backify task start confirm.destructive --set action=workspace.delete --set targetId=<workspace-id>
18
+ backify task get|wait|open <task-id>
19
+ backify org | backify billing | backify members invite ada@example.com --role Admin
20
+ backify members add ada@example.com bo@example.com --app <application-id>="Application owner" # members get it now, new people by invitation
21
+ backify members list --status invited | backify members invitations | backify members join-links | backify members domains
22
+ ```
23
+
24
+ These commands use the organization access from `backify login --organization <id> --organization-access`. `backify ops run` does the same automatically: when Backify answers `409 human_task_required` for an operation only a person may perform, it requests the named task with the identifiers from the request and waits. Use `--no-browser`, `--no-wait` and `--timeout <seconds>`, then resume with `backify task wait <task-id>`.
25
+
26
+ Exit codes: 0 means the person completed the task, 2 means it is still waiting, and 1 means it was declined, expired or failed. The kinds are `github.install`, `azure.connect`, `azure.elevate`, `azure.agent_update`, `azure.uninstall`, `azure.remove`, `approval`, `sso.test_signin`, `entra.app_setup`, `entra.shared_consent`, `integration.adopt`, `integration.account`, `auth.setup`, `confirm.destructive`, `domain.confirm` and `signup`.
27
+
28
+ Payment and plan changes after signup stay in the portal; `backify billing` shows the status.
6
29
 
7
30
  ## Guided integration connections
8
31
 
@@ -20,7 +43,7 @@ Use `--no-browser` to open the printed review URL manually, `--no-wait` to retur
20
43
  backify domains connect app.example.com --environment production
21
44
  ```
22
45
 
23
- Opens a standalone setup page where an authorized domain manager signs in and confirms the hostname and environment; omit either to choose on the page. The command returns as soon as the domain is confirmed (exit code 0, `confirmed: true`) with the expected `https://<hostname>` and what happens next. It does not wait for DNS: after the user adds the records shown on the page, Backify verifies them automatically, issues managed HTTPS and starts routing. Use `--no-browser`, `--no-wait` or `--timeout <seconds>`, and read the current status with `backify domains connect --request REQUEST_UUID`. Exit code 2 means not yet confirmed or blocked. The CLI never changes DNS or approves the domain itself.
46
+ Requests a Backify task and opens its page at `/tasks/<task-id>`, where an authorized domain manager signs in, checks that the page shows the match code the CLI printed, and confirms the hostname and environment; omit either to choose on the page. The command returns as soon as the domain is confirmed (exit code 0, `confirmed: true`) with the expected `https://<hostname>` and what happens next. It does not wait for DNS: after the user adds the records shown on the page, Backify verifies them automatically, issues managed HTTPS and starts routing. Use `--no-browser`, `--no-wait` or `--timeout <seconds>`, and read the current status with `backify domains connect --request TASK_UUID`. Exit code 2 means not yet confirmed or blocked. The CLI never changes DNS or approves the domain itself.
24
47
 
25
48
  ## Coding-tool MCP bridge
26
49
 
@@ -48,276 +71,72 @@ server restarts. Application instruction selection additionally supports
48
71
  `--agent cursor`, `--agent cline` and `--agent windsurf`.
49
72
 
50
73
 
74
+ ## Organization operations from the terminal
75
+
76
+ `backify ops` runs any operation in the organization catalog (the same operations
77
+ the MCP's `list_operations`, `describe_operation`, `read_operation` and
78
+ `execute_operation` tools expose) directly, for people and for agents without MCP:
79
+
80
+ ```bash
81
+ backify ops search members # ranked; synonyms, plurals and small typos match
82
+ backify ops search --group Apps --limit 50 # one area; plain `ops search` lists the groups
83
+ backify ops describe Apps.Get # route, parameters, body schema, scopes, example
84
+ backify ops get Apps.Get --param id=<application-id>
85
+ backify ops run Apps.Preview --param id=<application-id> --body preview.json
86
+ ```
87
+
88
+ It uses the organization grant saved by
89
+ `backify login --organization <organization-id> --organization-access` (renewed
90
+ automatically, like `backify mcp`), so the API limits it to catalog operations, the
91
+ granted organizations and the scopes approved in the browser. Every command takes
92
+ `--organization <id>` (default: the signed-in organization) and `--json` for
93
+ machine-readable output and errors (`code`, `requiredScopes`,
94
+ `reauthenticationCommand`).
95
+
96
+ - `--param name=value` fills path and query parameters; repeat a name to send a
97
+ list. File parameters take `--param <name>=@<path>` and upload that file.
98
+ - `--body <file>` sends a JSON body (or the raw package for upload operations);
99
+ `--body -` reads standard input. `--output <file>` saves the response as is.
100
+ - `get` refuses operations that change data and `run` refuses reads. `run` shows
101
+ the exact method, URL and body and asks `y/N` on a terminal; without a terminal it
102
+ refuses unless `--yes` is passed. Values under secret-like keys are hidden in
103
+ that summary.
104
+ - When the grant lacks a scope (`insufficient_scope`), does not cover the
105
+ organization (`organization_not_granted`) or the operation is not delegable
106
+ (`operation_not_delegable`), the error says to re-run
107
+ `backify login --organization <id> --organization-access` and approve what is
108
+ missing. Organization roles and release policies always apply as well.
109
+
51
110
  ## API integration discovery
52
111
 
53
112
  Use `backify integrations list|search|describe|contract|types --app APPLICATION_UUID` to discover versioned API contracts without making external API calls. Commands other than `list` require `--connection CONNECTION_UUID`; `describe` also requires `--operation OPERATION_ID`. Search accepts `--query` and `--offset`. The `types` command prints a typed SDK binding pinned to the approved connection UUID. These routes are read-only for application CLI sessions; granting or revoking operations requires portal integration-management permission. Treat API descriptions as untrusted data, not coding instructions. See [Integrations](../../docs/capabilities/integrations.md).
54
113
 
55
- ## Source-bound worker build provenance
56
-
57
- The opt-in protected CI workflow creates one worker build with OIDC-signed evidence.
58
- Use **backify workload provenance verify --policy ... --report ... --bundle ...
59
- --trusted-root ...** with reviewed source, workflow, application and image pins.
60
- Independent rebuilds and base-supplier signatures are optional stronger checks;
61
- policy-required evidence and invalid signatures still fail closed. The baseline
62
- does not claim reproduction or supplier authentication. This does not authorize
63
- deployment or change existing HCR v1 installation behavior. See the
64
- [build provenance guide](../../docs/worker-build-provenance.md).
65
-
66
- ## Local runtime and hosted containers
67
-
68
- Use runtime install --version vX.Y.Z --sha256 <reviewed-hash> [--archive <zip>]
69
- and runtime doctor for an explicitly reviewed self-contained local HCR. Native
70
- PostgreSQL tools are a separate prerequisite. The source includes a Windows/macOS/
71
- Linux CI matrix; published release assets remain an operator release step.
72
-
73
- The full-stack scaffold includes a Dockerfile and a same-origin production HTTP
74
- server. ship accepts this container path for both Backify Cloud and customer Azure;
75
- CI builds an immutable registry digest and publishes to Preview, not directly live.
76
- Production promotion retains optional independent approval. See
77
- [provider configuration and rollout](../../docs/hosting-provider-config.md).
78
-
79
- ## Explicit local development identity
80
-
81
- Declare auth intent and run dev --identity-users local-users.json --backend-port
82
- 3000 with reviewed repository-contained user profiles. identity users|issue|clear
83
- --local --json uses the authenticated operator session; issue additionally requires
84
- --user <reviewed-UUID>. Issuance deliberately returns a private five-minute local
85
- credential, not a production JWT or operator/workload token. Do not log or commit
86
- its output. No anonymous login, cookie, roles or production fallback is created.
87
- See [local identity boundaries and profile format](../../docs/local-development.md).
88
-
89
- ## Read-only local data inspection
90
-
91
- `backify inspect events --local --json` reports only status counts and the latest
92
- 100 event metadata rows. The Events panel uses the same authenticated loopback API;
93
- neither view reveals payloads, producer keys or lease receipts. The local broker
94
- persists leases, attempts and deduplication across worker restarts in private
95
- snapshots. It remains a single-worker local emulator, not a production cloud queue.
96
-
97
- In full mode, enabled declared events instead use an owned dedicated PostgreSQL
98
- inbox after explicit review of the HCR SQL asset and --apply-migrations approval.
99
- Old snapshot records keep their IDs, keys and receipts and drain locally; native
100
- payloads/receipts are never copied into snapshots. Combined inspection remains
101
- metadata-only. Missing initialized schema or ownership is never recreated on
102
- restart. Native emission acceptance preserves process-local hooks without firing
103
- them for duplicate keys; hooks are not distributed subscriptions.
104
-
105
- The authenticated dashboard includes Data, Jobs, Events and Logs panels. Native inspection
106
- uses actual scoped PostgreSQL/filesystem providers; unavailable providers are not
107
- replaced with empty emulator responses. Row pages, file metadata and explicit
108
- text/binary previews are bounded. Credential-named row fields are redacted and
109
- all data is rendered as text. No data editing/deletion controls are added.
110
-
111
- Use `backify inspect tables|rows|buckets|objects|preview|events --local --json` for stable
112
- operator-facing JSON. Row inspection needs `--table`; objects/preview need
113
- `--bucket`, and preview also needs `--key`. Optional `--limit`/`--offset`
114
- page rows/objects; `--prefix` filters object metadata. Arbitrary SQL, writes,
115
- cloud fallback and unchecked pagination are rejected. See the
116
- [local guide](../../docs/local-development.md) for bounds and browser/native tests.
117
-
118
-
119
- ## Authenticated workload packaging
120
-
121
- An explicit `auth` declaration now configures request-scoped end-user verification
122
- in packaged HTTP/worker hosts. Plans report a read-only public-trust directory,
123
- `BACKIFY_APPLICATION_AUTH_TRUST_FILE` and independently pinned organization,
124
- application and environment IDs. Missing or mismatched scope/trust fails startup;
125
- corrupt or stale mounted rotations fail requests closed. Issuer enrollment, fleet
126
- installation and production rollout remain blockers; no keys or tokens are bundled.
127
- New authenticated artifacts also require BACKIFY_APPLICATION_AUTH_STATE_FILE and
128
- a separate writable private persistent directory. Use workload trust-state plan,
129
- then workload trust-state initialize with --confirm, absolute --trust-file and
130
- --state-file, independently pinned --organization/--application/--environment,
131
- and the reviewed --revision. Initialization refuses existing state; bootstrap never
132
- recreates missing state. Journal rollback/mutation and corruption fail closed even
133
- after a process restart. Lock/volume recovery and Windows ACLs remain operator duties.
134
- See [application identity](../../docs/application-identity.md).
135
-
136
-
137
- ## Operator public-trust polling
138
-
139
- Use `backify workload trust-sync plan|once|run --configuration <absolute-json>`
140
- outside workloads. Review `plan` first; `once` and `run` require `--confirm`.
141
- The strict configuration pins scope/agent and management issuer/audience/public key,
142
- and supplies distinct absolute credential/public-output/private-journal paths.
143
- Initialize the operator journal explicitly with the reviewed trust-state workflow;
144
- do not reuse a workload journal or mount management credentials in applications.
145
-
146
- Plans do not read credentials, network or write. Polling rereads the private token,
147
- verifies versioned signed delivery, atomically publishes public-only trust, and
148
- uses serial bounded backoff and SIGINT/SIGTERM shutdown. Missing state, rollback,
149
- mutations and retained locks fail closed; failed publication retains evidence.
150
- Windows ACLs remain an operator duty. Eligible polls can trigger public-document
151
- renewal only with the separate, explicitly initialized opt-in control-plane ledger.
152
- The CLI never generates issuer trust, rotates keys, renews agent credentials,
153
- installs fleet services or makes deployment production-ready.
154
- See [configuration and recovery limits](../../docs/application-identity.md#signed-operator-trust-delivery).
155
-
156
- Local development supports --mode lightweight and --mode full. PostgreSQL engine
157
- or migration intent selects full mode automatically. Full mode starts isolated
158
- native PostgreSQL/HCR services; set --hcr-path/BACKIFY_LOCAL_HCR_PATH for an approved
159
- HCR artifact and --postgres-bin/BACKIFY_LOCAL_POSTGRES_BIN for PostgreSQL tools.
160
- Review pending SQL before passing --apply-migrations. --hcr-port/--database-port
161
- configure service ports; the existing --port configures the local dashboard.
162
- Missing prerequisites fail explicitly, and shutdown preserves local data.
163
- See [full-fidelity local services](../../docs/architecture/local-full-fidelity.md).
164
-
165
- Native jobs require paired --job-artifacts <reviewed-json> and --job-worker
166
- <repository-relative-packaged-directory>. First review and approve both jobs SQL
167
- assets with --apply-migrations; restarts retain data without repeating approval.
168
- The bundle must be a separately packaged worker matching the reviewed SHA-256
169
- and current normalized manifest. Native admission selects full mode and never
170
- falls back to the snapshot executor. Canonical enqueue, acknowledged backend
171
- schedules and manual operator dispatch execute through independent pinned Node
172
- processes against the real queue. Native cancellation is pending-only; native
173
- UUID retry creates one stable new run per scoped failed source/current worker
174
- artifact, preserving original payloads/pins/history. Replay does not repeat a
175
- completed retry; retry a newly failed UUID for another attempt. Original legacy rows/payloads/pins remain retained;
176
- explicit failed-row retry creates a new native run. Worker-declared schedules are
177
- discovered before backend import through the bounded hcr-schedules-v1 protocol.
178
- Support is pinned in the immutable bundle header, not mutable artifact metadata;
179
- older bundles retain explicit legacy-backend-declarations-only scheduling.
180
- Discovery enables SDK job registration only and never invokes handlers. It is not
181
- an OS sandbox or hosted scheduler. Auth-enabled workers now require an additional
182
- --job-auth <reviewed-json> pinning repository-relative public trust/private existing
183
- antirollback state, exact scope, revision and trust byte digest. Fresh local ownership
184
- adopts the reviewed scope; retained scope conflicts refuse without changing data.
185
- Mounts are rechecked before execution; local identity fixtures cannot be mixed in.
186
- Explicit --job-trust-sync <reviewed-json> enables signed active-worker trust renewal
187
- in the CLI supervisor. Management configuration/credentials are never forwarded
188
- to application processes. Exact publication digests and owned IPC update existing
189
- mounts only; watch reload retains accepted pins, while whole CLI restart requires
190
- reviewing current auth descriptor bytes/revision. Identical shared historical mounts
191
- follow one configuration; separate mounts may specify trustSyncFile. Existing valid
192
- trust survives management outages, expiry remains fail-closed, and shutdown aborts
193
- owned polling. This does not renew management credentials or install a fleet.
194
- Explicit --job-history
195
- <reviewed-json> admission activates up to fifteen unique original workers alongside
196
- the current worker. Supply each original artifactVersion, workerDirectory and
197
- manifestFile, plus authFile when its original manifest enables auth. The original
198
- portable manifest digest and actual bundle must match, all versions must also be
199
- reviewed in --job-artifacts, and resources/issuer scope must remain compatible with
200
- the current owned application. Retired source/migrations are not imported/applied.
201
- Receipts stay original-pinned; historical schedule declarations are not resynced.
202
- Current dispatch/retry/discovery stay current-worker owned. Exact duplicate old-pin
203
- acknowledgement can recover a lost schedule checkpoint, but never create new old
204
- runs or repin history. Active workers share bounded concurrency; metadata omits
205
- paths/trust mounts. This is not signed cloud/fleet activation or an OS sandbox.
206
- See [reviewed workflow and limits](../../docs/local-development.md#reviewed-independent-native-jobs).
207
-
208
- Set up, connect, record requests, and ship a Backify application repository. CLI 0.3.0 adds the connected AI delivery workflow.
209
-
210
- ## Full-stack starter
211
-
212
- For a runnable personal task application, add `--template tasks`:
114
+ ## Apps: new, dev, lock and check
213
115
 
214
- ```bash
215
- backify scaffold --app app_xxxxx --name personal-tasks --template tasks
216
- npm install
217
- npm run dev
116
+ ```sh
117
+ npx @backifydev/cli new my-app --template web # web (React + backend), api (backend only) or worker (jobs only)
118
+ cd my-app && npm install
119
+ npm run dev # backify dev
120
+ npx backify lock # writes backify.lock.json
121
+ npx backify check # what CI runs before building the image
218
122
  ```
219
123
 
220
- For a real PostgreSQL backend, choose `--template postgres`. It supplies Hono,
221
- Drizzle, pg, a typed schema, SQL migrations and generation metadata. `npm run dev`
222
- uses full local PostgreSQL; review migrations before `--apply-migrations`.
223
- Run `npm run db:generate` after schema edits and keep Backify as the sole migration
224
- executor. See [the relational application guide](../../docs/postgresql-applications.md).
225
-
226
- The task template declares authentication, database and jobs, wires the frontend
227
- and HTTP handlers, supplies an additive schema declaration, and includes tests
228
- for validation, trusted ownership and cross-user isolation. Development explicitly
229
- uses local document providers and two reviewed local identities. Issue a short-lived
230
- user token with `backify identity issue --local --user 44444444-4444-4444-4444-444444444444`
231
- and use the development-only token field. No provider connections are required.
232
- The production build removes this field; verified production sign-in remains a
233
- deployment prerequisite. Local PostgreSQL/runtime prerequisites are not installed
234
- automatically. The generated README distinguishes emulation from real-engine
235
- migration tests. Full local mode accepts the same additive schema declaration;
236
- review it and run `npm run dev:full -- --apply-migrations` to approve pending DDL.
237
- The existing minimal starter remains the default.
238
-
239
- In an empty folder, run backify scaffold --app app_xxxxx --name my-application
240
- with the application ID supplied by Backify. It writes a React/Vite frontend, Hono
241
- HTTP server, declaration-only scheduled worker, tests and current project guidance.
242
- It never installs dependencies, provisions resources or overwrites existing source.
243
- Identical output is idempotent; linked paths, existing applications, modified
244
- instructions and conflicting files fail before generated files are written.
245
- Use compatible workspace builds until these source-only CLI/SDK additions are released.
246
- Run npm install, npm test, npm run typecheck, npm run build and npm run dev in the
247
- generated project. The same-origin /api proxy avoids exposing workload tokens to React.
248
- The liveness endpoint is public; private business APIs require trusted end-user
249
- authorization, which is deliberately not fabricated by this starter.
250
- See [local workflow and browser verification](../../docs/local-development.md).
251
-
252
- ## Independent OCI workloads
253
-
254
- Explicit canonical job producers use optional BACKIFY_JOB_ARTIFACT_SHA256 and
255
- BACKIFY_JOB_BINDING host configuration. The target worker digest is independent
256
- of the HTTP bundle digest. A binding without a pin refuses before application
257
- code loads. Plans keep deploymentReady false and require reviewed HCR worker
258
- bindings plus the additive producer SQL; packaging never installs SQL or
259
- automatically activates registered artifacts. Unconfigured enqueue and legacy
260
- schedules remain unchanged. See [durable jobs](../../docs/hcr-jobs.md).
261
-
262
- backify workload plan --kind http|worker emits a non-mutating JSON plan. Workers
263
- require --entry pointing to a declaration-only module. backify workload package
264
- also requires --base-image with an approved digest-pinned Node 22+ image reference;
265
- it writes an isolated generated context without replacing customer Dockerfiles.
266
- Bundle/artifact pins, private mounted workload credentials and unsupported-provider
267
- checks fail closed. This does not build images, enroll identities or deploy apps.
268
- See [workload contracts and limits](../../docs/architecture/oci-workloads.md).
269
-
270
- ## Local full-stack workflow
271
-
272
- The current source includes portable YAML validation, isolated server workers,
273
- source/manifest watching, persistent local state, job/schedule inspection and an
274
- authenticated loopback dashboard:
275
-
276
- ~~~sh
277
- backify validate --json
278
- backify dev --open
279
- backify dev --frontend web --frontend-port 5173 --backend-port 3000 --json
280
- backify dev --frontend web --frontend-adapter static --frontend-port 5173 --json
281
- backify status --local --json
282
- backify jobs list --local
283
- backify jobs run --local --name daily-report
284
- backify logs --local
285
- backify test --json
286
- ~~~
287
-
288
- Declare a Node entrypoint in backify.yaml. The SDK local runtime is installed before
289
- application code loads. The CLI adds .backify/ to the ignore file; never commit its
290
- records, files or queued payloads. Local mode does not use cloud credentials.
291
- Full mode starts separate PostgreSQL/HCR services and applies only explicitly
292
- approved SQL. Lightweight mode retains the document emulator. Optional --frontend
293
- supervises an already-installed Vite frontend inside the repository; --backend-port
294
- injects PORT, which application servers must honor. Vite keeps the application
295
- configuration/HMR but cannot disable mandatory strict filesystem checks or private
296
- state/secret exclusions. Canonical-path checks also refuse linked/junction access.
297
- No frontend receives runtime
298
- credentials. JSON dev lifecycle uses stdout; child diagnostics use stderr. Agents
299
- may stop an IPC-launched CLI with backify-stop. See [local development and limits](../../docs/local-development.md).
300
- These additions have not been published to npm.
301
-
302
- For encrypted development secrets, declare capabilities.secrets, create a key in
303
- an existing private directory outside the repository, and supply values only via stdin:
304
-
305
- ~~~sh
306
- backify secrets local init --key-file /private/backify-local.key
307
- backify secrets local set SERVICE_TOKEN --key-file /private/backify-local.key --stdin
308
- backify secrets local list --key-file /private/backify-local.key
309
- backify dev --local-secrets-key /private/backify-local.key
310
- ~~~
311
-
312
- The ignored vault contains authenticated AES-256-GCM ciphertext only. The external
313
- key stays outside builds/snapshots; plaintext reaches only the backend through IPC.
314
- SDK logs redact values, but arbitrary console output/application writes do not.
315
- Retained vaults fail closed without their key. Restart/rebuild to reload changes.
316
- Windows private ACLs remain the operator's responsibility. Non-empty local vaults
317
- with packaged native job workers refuse until a reviewed worker secret broker exists.
318
- The opt-in static adapter requires index.html rather than Vite/package installation
319
- and provides protected assets, nested live reload and public backend configuration;
320
- it does not compile source or implement SSR. See the linked local guide for limits.
124
+ An app is one repository and one container image that runs as process roles (`web`, `worker`, `migrate`). Routes, jobs, schedules and event handlers are declared in server code with `@backifydev/sdk/app`; `backify.config.ts` holds buckets, auth providers, secret names and allowed hosts. See the [runtime contract](../../docs/architecture/app-runtime-contract.md).
125
+
126
+ `backify dev` runs the app like production on one machine:
127
+ - a private PostgreSQL cluster in `.backify/dev/postgres` with the platform's `migrate`, `runtime` and `inspect` roles (PostgreSQL 16+ must be installed; set `BACKIFY_POSTGRES_BIN` if it is not found);
128
+ - migrations through the migrate role, then the web and worker roles, rebuilt and restarted when server code or migrations change;
129
+ - the Vite dev server for web apps;
130
+ - a local gateway on one port with development sign-in at `/.backify/auth/login`, verified user tokens forwarded to the backend, `/files/{bucket}` for public buckets, and a local broker for storage (files in `.backify/dev/storage`), mail (saved to `.backify/dev/mail`) and outbound HTTP limited to `http.allow`. AI and integrations are available in preview environments only.
131
+
132
+ Local secret values go in `.backify/secrets.local.json` (`{ "NAME": "value" }`); never commit them.
133
+
134
+ `backify lock` bundles the server entry and runs it once in describe mode, with no credentials, platform variables or database, to collect declarations. It writes `backify.lock.json`: routes with auth and an OpenAPI document, jobs, schedules, event subscriptions, migration digests and capabilities. It refuses to write the file when:
135
+ - a declaration is not at module top level, or uses a computed name, path, cron or auth;
136
+ - code uses a capability that `backify.config.ts` does not configure.
137
+
138
+ A public POST/PUT/PATCH/DELETE route produces a warning. `backify lock --check` and `backify check` fail when the committed lockfile no longer matches the code; `check` first runs the app's `typecheck`, `lint`, `test` and `build` scripts (`--lockfile-only` skips them).
139
+
321
140
 
322
141
  ## Connected delivery
323
142
 
@@ -336,11 +155,11 @@ npx @backifydev/cli ship
336
155
 
337
156
  Authenticated application commands recover automatically from a known expired credential or an API 401: they open browser approval, replace the saved application credential, and retry the rejected request once. Permission errors (403), network failures, and service errors do not trigger sign-in or write retries. Use `--no-browser` for unattended work. With `--json`, authentication failures include `code: "authentication_required"` and `reauthenticationCommand: "backify connect --reauth"`. A coding agent should ask its user to sign in before starting explicit recovery. The callback accepts only the selected authorization origin and matching random state/application/organization, is bound to `127.0.0.1`, and closes after approval or a five-minute timeout. Browser local-network access may need approval. A remotely hosted or headless coding tool needs a browser on the CLI host that can reach this loopback listener; this flow does not add remote device-code authentication.
338
157
 
339
- `init` installs `@backifydev/sdk`, writes `backify.json` and `BACKIFY.md`, and maintains only the selected coding tool's Backify block. Use `--agent codex` (`AGENTS.md`), `--agent claude` (`CLAUDE.md`), `--agent copilot` (`.github/copilot-instructions.md`), `--agent gemini` (`GEMINI.md`), `--agent cursor`/`--agent windsurf` (`AGENTS.md`), or `--agent cline` (`.clinerules/backify.md`). The CLI remembers the selection for `init`, `sync`, and `doctor`; new projects default to Codex. For any other tool, pass `--instruction-file <relative-path>` to use its native instruction or rule file, including nested paths; this is remembered too. It preserves other instructions and does not create or modify other tools' files.
158
+ `init` installs `@backifydev/sdk`, updates `app.id`, `instructionVersion` and coding-tool metadata in `backify.config.ts`, writes `BACKIFY.md`, and maintains only the selected coding tool's Backify block. Use `--agent codex` (`AGENTS.md`), `--agent claude` (`CLAUDE.md`), `--agent copilot` (`.github/copilot-instructions.md`), `--agent gemini` (`GEMINI.md`), `--agent cursor`/`--agent windsurf` (`AGENTS.md`), or `--agent cline` (`.clinerules/backify.md`). The CLI remembers the selection for `init`, `sync`, and `doctor`; new projects default to Codex. For any other tool, pass `--instruction-file <relative-path>` to use its native instruction or rule file, including nested paths; this is remembered too. It preserves other instructions and does not create or modify other tools' files.
340
159
 
341
160
  The app configuration stores `instructionVersion`, matching the version declared in each managed block and its immutable guide at `https://agent.backify.dev/v<number>`. The agent root always serves the latest guide as plain text. `doctor` detects version/content drift and malformed markers. Use `npx @backifydev/cli@latest sync` to explicitly upgrade all blocks and the configuration together; unrelated configuration and unmanaged instructions remain unchanged.
342
161
 
343
- You can start from an empty folder without a Git repository. `init` creates a minimal private `package.json` before installing the SDK, without choosing a framework. Add the application's framework and development/build scripts afterward. Existing manifests are preserved; in a non-empty application or monorepo, run `init` from the appropriate JavaScript/TypeScript package directory.
162
+ For a new application, start with `backify new <name> --template web|api|worker` before connecting. `init` installs the selected coding tool instructions into that app. Existing older workspaces using `backify.json` remain readable until a deliberate migration. Existing manifests are preserved; in a non-empty application or monorepo, run `init` from the appropriate JavaScript/TypeScript package directory.
344
163
 
345
164
  See the [agent setup guide](https://agent.backify.dev/).
346
165
 
@@ -350,7 +169,7 @@ Copy the application's setup prompt from Backify. It contains only the public ap
350
169
 
351
170
  `pull` checks the connected application, repository, branch, and repository root, then fetches GitHub using a short-lived scoped credential. It fast-forwards only a clean, non-diverged branch. Incoming updates blocked by local changes, untracked files, or diverged history return a blocked result and a nonzero exit code; nothing is stashed, reset, rebased, or force-pushed. Connecting an existing repository runs this update automatically, and the agent guide requires it before editing each new user request. It is not a background watcher.
352
171
 
353
- `ship` runs configured checks, verifies the repository/branch, and pushes already-committed source using a short-lived repository-scoped GitHub App credential. It never stages, commits, force-pushes, or fabricates preview testing. By default it waits for the exact healthy preview and returns its URL without requesting production publication. Plain requests such as “Now deploy” and approval to merge and retry remain preview-only; production requires an explicit user request to deploy to production. Instruction version 10 (CLI 0.3.12) makes this distinction explicit in installed guidance. Promote the preview in the portal, or explicitly run `ship --production-deploy` to request publication through existing policy and permissions. Required testing/approval returns a pending state and preview URL, not a false successful production deployment. The legacy `--preview-only` flag remains supported but cannot be combined with `--production-deploy`. Use `--timeout <seconds>` to change the default 1200-second wait. Applications must currently be at the repository root; Backify Cloud needs static index.html output, and customer Azure supports managed Node/npm builds or a custom Dockerfile serving port 8080. Local Docker is not required.
172
+ `ship` runs configured checks, verifies the repository/branch, and pushes already-committed source using a short-lived repository-scoped GitHub App credential. It never stages, commits, force-pushes, or fabricates preview testing. By default it waits for the exact healthy preview and returns its URL without requesting production publication. Plain requests such as “Now deploy” and approval to merge and retry remain preview-only; production requires an explicit user request to deploy to production. Instruction version 10 (CLI 0.3.12) makes this distinction explicit in installed guidance. Promote the preview in the portal, or explicitly run `ship --production-deploy` to request publication through existing policy and permissions. Required testing/approval returns a pending state and preview URL, not a false successful production deployment. The legacy `--preview-only` flag remains supported but cannot be combined with `--production-deploy`. Use `--timeout <seconds>` to change the default 1200-second wait. Applications must currently be at the repository root. CI checks the committed lockfile, builds and verifies one image, then uploads a release. The web role serves port 8080; web apps also upload a static frontend. Local Docker is not required for backify dev.
354
173
 
355
174
  `disconnect` revokes that user's application CLI sessions. `logout` removes local credentials only. Prompt histories and local reports remain subject to application permissions. Deploy the matching API and publish CLI 0.3.0 before enabling this flow in production.
356
175
 
@@ -363,10 +182,9 @@ containers remain an advanced hosting path. Doctor and local reports expose
363
182
  advisory support tiers without rejecting existing stacks or claiming verified SDK
364
183
  integration. See [application support](../../docs/application-support.md).
365
184
 
366
- Container delivery supports repository-root npm applications with a lockfile and
367
- start script without requiring a Dockerfile or local Docker installation. Custom
368
- Dockerfiles take precedence and support other languages; that does not imply SDK
369
- support for those languages. Generated GitHub workflows verify the exact production
185
+ Container delivery uses a repository-root Dockerfile and committed backify.lock.json.
186
+ The SDK entrypoint runs web, worker and migrate roles. Local Docker is not required
187
+ for backify dev. Hosting a custom language does not imply SDK support for it. Generated GitHub workflows verify the exact production
370
188
  image before registry publication. See [application build verification](../../docs/application-build-contract.md)
371
189
  for supported layouts, diagnostics, limitations and rollout requirements.
372
190
 
@@ -378,8 +196,7 @@ JSON reports distinguish failed and unverified checks, network/HTTP failure clas
378
196
 
379
197
  The CLI cannot grant agent permissions: follow the supported native authorization mechanism described in [the central guide](https://agent.backify.dev), retry after approval and verify. Without approval support or after denial, report minimum required access and switch or configure environments; never bypass restrictions. The ordinary `doctor` command retains its repository instruction checks. Local probes do not verify the real application or replace reading capability documentation.
380
198
 
381
- ## Safe SDK upgrades and local magic links
199
+ ## Safe SDK upgrades
382
200
 
383
201
  Run backify upgrade from a clean npm app checkout to choose the latest stable compatible SDK, validate with application checks, and restore the previous locked dependencies on failure. Pre-1.0 updates stay within the installed minor. Package upgrades preserve the repository's instruction version; older versioned guides remain supported by newer CLIs.
384
202
 
385
- With reviewed --identity-users fixtures and the Vite or static frontend adapter, local sign-in uses the frontend's /.backify/auth/login. Read captured magic links using backify identity inbox --local and confirm in the requesting browser. No real email is sent. See [application maintenance](../../docs/application-maintenance.md) for prerequisites and emulation limits.