@backifydev/cli 0.3.20 → 0.3.21

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.
Files changed (3) hide show
  1. package/README.md +380 -358
  2. package/dist/index.js +397 -99
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,358 +1,380 @@
1
- # @backifydev/cli
2
-
3
- ## Coding-tool MCP bridge
4
-
5
- `backify mcp [--organization <organization-id>]` bridges stdio to the single
6
- organization MCP at `https://mcp.backify.dev`. Sign in explicitly using
7
- `backify login --organization <organization-id> --organization-access`; application
8
- sessions remain app-scoped and cannot administer organizations. The bridge rereads
9
- credentials per request and pins the organization until restarted. Discover and
10
- describe customer API operations, prepare changes, obtain explicit user approval,
11
- then execute with a one-use confirmation. All API permissions and release policies
12
- still apply. See the [plugin guide](../../docs/coding-tool-plugins.md).
13
-
14
- `backify tools configure --agent copilot|cursor|gemini` adds the selected host's
15
- native HTTP configuration for that same MCP. Cline and Windsurf/Cascade additionally
16
- require `--config <exact-editor-config-path>`. `--dry-run` previews without writing;
17
- `--transport stdio` selects the existing local bridge instead. Existing settings
18
- and other MCP servers are preserved; conflicting Backify entries and JSONC files
19
- are never overwritten. Native HTTP authorization opens the existing Backify portal
20
- for explicit organization consent and gives the coding tool only an opaque MCP
21
- token. This requires the updated server/portal rollout; it is not deployed by
22
- running the setup command. Native sessions last up to an hour and require
23
- reauthorization/re-registration after expiration or an MCP server restart.
24
- Application instruction selection additionally supports `--agent cursor`,
25
- `--agent cline` and `--agent windsurf`.
26
- The bridge now exchanges browser-approved account access for an organization-
27
- and audience-bound MCP token; the updated CLI and MCP host must roll out together.
28
-
29
-
30
- ## API integration discovery
31
-
32
- 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).
33
-
34
- ## Source-bound worker build provenance
35
-
36
- The opt-in protected CI workflow creates one worker build with OIDC-signed evidence.
37
- Use **backify workload provenance verify --policy ... --report ... --bundle ...
38
- --trusted-root ...** with reviewed source, workflow, application and image pins.
39
- Independent rebuilds and base-supplier signatures are optional stronger checks;
40
- policy-required evidence and invalid signatures still fail closed. The baseline
41
- does not claim reproduction or supplier authentication. This does not authorize
42
- deployment or change existing HCR v1 installation behavior. See the
43
- [build provenance guide](../../docs/worker-build-provenance.md).
44
-
45
- ## Local runtime and hosted containers
46
-
47
- Use runtime install --version vX.Y.Z --sha256 <reviewed-hash> [--archive <zip>]
48
- and runtime doctor for an explicitly reviewed self-contained local HCR. Native
49
- PostgreSQL tools are a separate prerequisite. The source includes a Windows/macOS/
50
- Linux CI matrix; published release assets remain an operator release step.
51
-
52
- The full-stack scaffold includes a Dockerfile and a same-origin production HTTP
53
- server. ship accepts this container path for both Backify Cloud and customer Azure;
54
- CI builds an immutable registry digest and publishes to Preview, not directly live.
55
- Production promotion retains optional independent approval. See
56
- [provider configuration and rollout](../../docs/hosting-provider-config.md).
57
-
58
- ## Explicit local development identity
59
-
60
- Declare auth intent and run dev --identity-users local-users.json --backend-port
61
- 3000 with reviewed repository-contained user profiles. identity users|issue|clear
62
- --local --json uses the authenticated operator session; issue additionally requires
63
- --user <reviewed-UUID>. Issuance deliberately returns a private five-minute local
64
- credential, not a production JWT or operator/workload token. Do not log or commit
65
- its output. No anonymous login, cookie, roles or production fallback is created.
66
- See [local identity boundaries and profile format](../../docs/local-development.md).
67
-
68
- ## Read-only local data inspection
69
-
70
- `backify inspect events --local --json` reports only status counts and the latest
71
- 100 event metadata rows. The Events panel uses the same authenticated loopback API;
72
- neither view reveals payloads, producer keys or lease receipts. The local broker
73
- persists leases, attempts and deduplication across worker restarts in private
74
- snapshots. It remains a single-worker local emulator, not a production cloud queue.
75
-
76
- In full mode, enabled declared events instead use an owned dedicated PostgreSQL
77
- inbox after explicit review of the HCR SQL asset and --apply-migrations approval.
78
- Old snapshot records keep their IDs, keys and receipts and drain locally; native
79
- payloads/receipts are never copied into snapshots. Combined inspection remains
80
- metadata-only. Missing initialized schema or ownership is never recreated on
81
- restart. Native emission acceptance preserves process-local hooks without firing
82
- them for duplicate keys; hooks are not distributed subscriptions.
83
-
84
- The authenticated dashboard includes Data, Jobs, Events and Logs panels. Native inspection
85
- uses actual scoped PostgreSQL/filesystem providers; unavailable providers are not
86
- replaced with empty emulator responses. Row pages, file metadata and explicit
87
- text/binary previews are bounded. Credential-named row fields are redacted and
88
- all data is rendered as text. No data editing/deletion controls are added.
89
-
90
- Use `backify inspect tables|rows|buckets|objects|preview|events --local --json` for stable
91
- operator-facing JSON. Row inspection needs `--table`; objects/preview need
92
- `--bucket`, and preview also needs `--key`. Optional `--limit`/`--offset`
93
- page rows/objects; `--prefix` filters object metadata. Arbitrary SQL, writes,
94
- cloud fallback and unchecked pagination are rejected. See the
95
- [local guide](../../docs/local-development.md) for bounds and browser/native tests.
96
-
97
-
98
- ## Authenticated workload packaging
99
-
100
- An explicit `auth` declaration now configures request-scoped end-user verification
101
- in packaged HTTP/worker hosts. Plans report a read-only public-trust directory,
102
- `BACKIFY_APPLICATION_AUTH_TRUST_FILE` and independently pinned organization,
103
- application and environment IDs. Missing or mismatched scope/trust fails startup;
104
- corrupt or stale mounted rotations fail requests closed. Issuer enrollment, fleet
105
- installation and production rollout remain blockers; no keys or tokens are bundled.
106
- New authenticated artifacts also require BACKIFY_APPLICATION_AUTH_STATE_FILE and
107
- a separate writable private persistent directory. Use workload trust-state plan,
108
- then workload trust-state initialize with --confirm, absolute --trust-file and
109
- --state-file, independently pinned --organization/--application/--environment,
110
- and the reviewed --revision. Initialization refuses existing state; bootstrap never
111
- recreates missing state. Journal rollback/mutation and corruption fail closed even
112
- after a process restart. Lock/volume recovery and Windows ACLs remain operator duties.
113
- See [application identity](../../docs/application-identity.md).
114
-
115
-
116
- ## Operator public-trust polling
117
-
118
- Use `backify workload trust-sync plan|once|run --configuration <absolute-json>`
119
- outside workloads. Review `plan` first; `once` and `run` require `--confirm`.
120
- The strict configuration pins scope/agent and management issuer/audience/public key,
121
- and supplies distinct absolute credential/public-output/private-journal paths.
122
- Initialize the operator journal explicitly with the reviewed trust-state workflow;
123
- do not reuse a workload journal or mount management credentials in applications.
124
-
125
- Plans do not read credentials, network or write. Polling rereads the private token,
126
- verifies versioned signed delivery, atomically publishes public-only trust, and
127
- uses serial bounded backoff and SIGINT/SIGTERM shutdown. Missing state, rollback,
128
- mutations and retained locks fail closed; failed publication retains evidence.
129
- Windows ACLs remain an operator duty. Eligible polls can trigger public-document
130
- renewal only with the separate, explicitly initialized opt-in control-plane ledger.
131
- The CLI never generates issuer trust, rotates keys, renews agent credentials,
132
- installs fleet services or makes deployment production-ready.
133
- See [configuration and recovery limits](../../docs/application-identity.md#signed-operator-trust-delivery).
134
-
135
- Local development supports --mode lightweight and --mode full. PostgreSQL engine
136
- or migration intent selects full mode automatically. Full mode starts isolated
137
- native PostgreSQL/HCR services; set --hcr-path/BACKIFY_LOCAL_HCR_PATH for an approved
138
- HCR artifact and --postgres-bin/BACKIFY_LOCAL_POSTGRES_BIN for PostgreSQL tools.
139
- Review pending SQL before passing --apply-migrations. --hcr-port/--database-port
140
- configure service ports; the existing --port configures the local dashboard.
141
- Missing prerequisites fail explicitly, and shutdown preserves local data.
142
- See [full-fidelity local services](../../docs/architecture/local-full-fidelity.md).
143
-
144
- Native jobs require paired --job-artifacts <reviewed-json> and --job-worker
145
- <repository-relative-packaged-directory>. First review and approve both jobs SQL
146
- assets with --apply-migrations; restarts retain data without repeating approval.
147
- The bundle must be a separately packaged worker matching the reviewed SHA-256
148
- and current normalized manifest. Native admission selects full mode and never
149
- falls back to the snapshot executor. Canonical enqueue, acknowledged backend
150
- schedules and manual operator dispatch execute through independent pinned Node
151
- processes against the real queue. Native cancellation is pending-only; native
152
- UUID retry creates one stable new run per scoped failed source/current worker
153
- artifact, preserving original payloads/pins/history. Replay does not repeat a
154
- completed retry; retry a newly failed UUID for another attempt. Original legacy rows/payloads/pins remain retained;
155
- explicit failed-row retry creates a new native run. Worker-declared schedules are
156
- discovered before backend import through the bounded hcr-schedules-v1 protocol.
157
- Support is pinned in the immutable bundle header, not mutable artifact metadata;
158
- older bundles retain explicit legacy-backend-declarations-only scheduling.
159
- Discovery enables SDK job registration only and never invokes handlers. It is not
160
- an OS sandbox or hosted scheduler. Auth-enabled workers now require an additional
161
- --job-auth <reviewed-json> pinning repository-relative public trust/private existing
162
- antirollback state, exact scope, revision and trust byte digest. Fresh local ownership
163
- adopts the reviewed scope; retained scope conflicts refuse without changing data.
164
- Mounts are rechecked before execution; local identity fixtures cannot be mixed in.
165
- Explicit --job-trust-sync <reviewed-json> enables signed active-worker trust renewal
166
- in the CLI supervisor. Management configuration/credentials are never forwarded
167
- to application processes. Exact publication digests and owned IPC update existing
168
- mounts only; watch reload retains accepted pins, while whole CLI restart requires
169
- reviewing current auth descriptor bytes/revision. Identical shared historical mounts
170
- follow one configuration; separate mounts may specify trustSyncFile. Existing valid
171
- trust survives management outages, expiry remains fail-closed, and shutdown aborts
172
- owned polling. This does not renew management credentials or install a fleet.
173
- Explicit --job-history
174
- <reviewed-json> admission activates up to fifteen unique original workers alongside
175
- the current worker. Supply each original artifactVersion, workerDirectory and
176
- manifestFile, plus authFile when its original manifest enables auth. The original
177
- portable manifest digest and actual bundle must match, all versions must also be
178
- reviewed in --job-artifacts, and resources/issuer scope must remain compatible with
179
- the current owned application. Retired source/migrations are not imported/applied.
180
- Receipts stay original-pinned; historical schedule declarations are not resynced.
181
- Current dispatch/retry/discovery stay current-worker owned. Exact duplicate old-pin
182
- acknowledgement can recover a lost schedule checkpoint, but never create new old
183
- runs or repin history. Active workers share bounded concurrency; metadata omits
184
- paths/trust mounts. This is not signed cloud/fleet activation or an OS sandbox.
185
- See [reviewed workflow and limits](../../docs/local-development.md#reviewed-independent-native-jobs).
186
-
187
- Set up, connect, record requests, and ship a Backify application repository. CLI 0.3.0 adds the connected AI delivery workflow.
188
-
189
- ## Full-stack starter
190
-
191
- For a runnable personal task application, add `--template tasks`:
192
-
193
- ```bash
194
- backify scaffold --app app_xxxxx --name personal-tasks --template tasks
195
- npm install
196
- npm run dev
197
- ```
198
-
199
- The task template declares authentication, database and jobs, wires the frontend
200
- and HTTP handlers, supplies an additive schema declaration, and includes tests
201
- for validation, trusted ownership and cross-user isolation. Development explicitly
202
- uses local document providers and two reviewed local identities. Issue a short-lived
203
- user token with `backify identity issue --local --user 44444444-4444-4444-4444-444444444444`
204
- and use the development-only token field. No provider connections are required.
205
- The production build removes this field; verified production sign-in remains a
206
- deployment prerequisite. Local PostgreSQL/runtime prerequisites are not installed
207
- automatically. The generated README distinguishes emulation from real-engine
208
- migration tests. Full local mode accepts the same additive schema declaration;
209
- review it and run `npm run dev:full -- --apply-migrations` to approve pending DDL.
210
- The existing minimal starter remains the default.
211
-
212
- In an empty folder, run backify scaffold --app app_xxxxx --name my-application
213
- with the application ID supplied by Backify. It writes a React/Vite frontend, Hono
214
- HTTP server, declaration-only scheduled worker, tests and current project guidance.
215
- It never installs dependencies, provisions resources or overwrites existing source.
216
- Identical output is idempotent; linked paths, existing applications, modified
217
- instructions and conflicting files fail before generated files are written.
218
- Use compatible workspace builds until these source-only CLI/SDK additions are released.
219
- Run npm install, npm test, npm run typecheck, npm run build and npm run dev in the
220
- generated project. The same-origin /api proxy avoids exposing workload tokens to React.
221
- The liveness endpoint is public; private business APIs require trusted end-user
222
- authorization, which is deliberately not fabricated by this starter.
223
- See [local workflow and browser verification](../../docs/local-development.md).
224
-
225
- ## Independent OCI workloads
226
-
227
- Explicit canonical job producers use optional BACKIFY_JOB_ARTIFACT_SHA256 and
228
- BACKIFY_JOB_BINDING host configuration. The target worker digest is independent
229
- of the HTTP bundle digest. A binding without a pin refuses before application
230
- code loads. Plans keep deploymentReady false and require reviewed HCR worker
231
- bindings plus the additive producer SQL; packaging never installs SQL or
232
- automatically activates registered artifacts. Unconfigured enqueue and legacy
233
- schedules remain unchanged. See [durable jobs](../../docs/hcr-jobs.md).
234
-
235
- backify workload plan --kind http|worker emits a non-mutating JSON plan. Workers
236
- require --entry pointing to a declaration-only module. backify workload package
237
- also requires --base-image with an approved digest-pinned Node 22+ image reference;
238
- it writes an isolated generated context without replacing customer Dockerfiles.
239
- Bundle/artifact pins, private mounted workload credentials and unsupported-provider
240
- checks fail closed. This does not build images, enroll identities or deploy apps.
241
- See [workload contracts and limits](../../docs/architecture/oci-workloads.md).
242
-
243
- ## Local full-stack workflow
244
-
245
- The current source includes portable YAML validation, isolated server workers,
246
- source/manifest watching, persistent local state, job/schedule inspection and an
247
- authenticated loopback dashboard:
248
-
249
- ~~~sh
250
- backify validate --json
251
- backify dev --open
252
- backify dev --frontend web --frontend-port 5173 --backend-port 3000 --json
253
- backify dev --frontend web --frontend-adapter static --frontend-port 5173 --json
254
- backify status --local --json
255
- backify jobs list --local
256
- backify jobs run --local --name daily-report
257
- backify logs --local
258
- backify test --json
259
- ~~~
260
-
261
- Declare a Node entrypoint in backify.yaml. The SDK local runtime is installed before
262
- application code loads. The CLI adds .backify/ to the ignore file; never commit its
263
- records, files or queued payloads. Local mode does not use cloud credentials.
264
- Full mode starts separate PostgreSQL/HCR services and applies only explicitly
265
- approved SQL. Lightweight mode retains the document emulator. Optional --frontend
266
- supervises an already-installed Vite frontend inside the repository; --backend-port
267
- injects PORT, which application servers must honor. Vite keeps the application
268
- configuration/HMR but cannot disable mandatory strict filesystem checks or private
269
- state/secret exclusions. Canonical-path checks also refuse linked/junction access.
270
- No frontend receives runtime
271
- credentials. JSON dev lifecycle uses stdout; child diagnostics use stderr. Agents
272
- may stop an IPC-launched CLI with backify-stop. See [local development and limits](../../docs/local-development.md).
273
- These additions have not been published to npm.
274
-
275
- For encrypted development secrets, declare capabilities.secrets, create a key in
276
- an existing private directory outside the repository, and supply values only via stdin:
277
-
278
- ~~~sh
279
- backify secrets local init --key-file /private/backify-local.key
280
- backify secrets local set SERVICE_TOKEN --key-file /private/backify-local.key --stdin
281
- backify secrets local list --key-file /private/backify-local.key
282
- backify dev --local-secrets-key /private/backify-local.key
283
- ~~~
284
-
285
- The ignored vault contains authenticated AES-256-GCM ciphertext only. The external
286
- key stays outside builds/snapshots; plaintext reaches only the backend through IPC.
287
- SDK logs redact values, but arbitrary console output/application writes do not.
288
- Retained vaults fail closed without their key. Restart/rebuild to reload changes.
289
- Windows private ACLs remain the operator's responsibility. Non-empty local vaults
290
- with packaged native job workers refuse until a reviewed worker secret broker exists.
291
- The opt-in static adapter requires index.html rather than Vite/package installation
292
- and provides protected assets, nested live reload and public backend configuration;
293
- it does not compile source or implement SSR. See the linked local guide for limits.
294
-
295
- ## Connected delivery
296
-
297
- ```sh
298
- npx @backifydev/cli init --app app_xxxxx
299
- npx @backifydev/cli doctor
300
- npx @backifydev/cli sync
301
- npx @backifydev/cli login
302
- npx @backifydev/cli status
303
- npx @backifydev/cli report --check
304
- npx @backifydev/cli pull
305
- npx @backifydev/cli ship
306
- ```
307
-
308
- `login` in an application folder, or `connect --reauth`, opens `https://auth.backify.dev` for sign-in and explicit CLI approval. Choose 7, 14, 30, or 90 days; after approval the CLI saves an application-scoped credential in `~/.backify.json` and continues automatically. The browser can then be closed. No copied setup prompt or pasted credential is required. `login` outside an application retains general sign-in for later connection. Set `BACKIFY_AUTH_URL` for a different authorization host (HTTPS, or loopback HTTP for local development); legacy `BACKIFY_PORTAL_URL` and `portalUrl` configuration remain supported. `login <token> [organizationId]` remains available for scripted development.
309
-
310
- 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.
311
-
312
- `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.
313
-
314
- 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.
315
-
316
- 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.
317
-
318
- See the [agent setup guide](https://agent.backify.dev/).
319
-
320
- Copy the application's setup prompt from Backify. It contains only the public app reference and https://agent.backify.dev/; the guide supplies fresh-machine prerequisite checks, npx commands, browser authorization and workspace setup. No global CLI installation, organization ID or pairing code is needed. Run `npx @backifydev/cli@latest connect --app <app-id> --reauth --api https://api.backify.dev/api`, adding `--clone` for a fresh workspace according to the guide. Keep the command running while the user selects the app's organization and approves access in the browser. The CLI receives and saves the app-scoped credential in the user's home configuration; it never belongs in chat, project files or Git. Supported browser approvals last 7, 14, 30, or 90 days. Existing pairing options remain available for legacy prompts; use `--pair-stdin` with private terminal input, never shell arguments, logs, environment variables or temporary files. The default API is `https://api.backify.dev/api`; trusted nonproduction environments can override it with `BACKIFY_API_URL` or `--api`. HTTPS is required outside loopback.
321
-
322
- `init` adds a persistent delivery guide linked from the existing agent instructions. For every user request associated with the application, including setup, questions, deployment, application work, and Backify platform troubleshooting, the agent sends only the user's own text through stdin to `backify prompt record --stdin --id <UUID> --type <build|deploy|fixing|other>`, optionally adding repeated `--filename <basename>` arguments. Reuse the UUID on retries. The command never reads attachments; their bodies, extracted text, full paths, and credentials must not be submitted. Setup/pairing requests are recorded with secrets replaced by [REDACTED], never excluded. The CLI and API redact recognized Backify session tokens and pairing codes; redact all other secrets before submission. History is displayed oldest-first under the application. This is an explicit agent workflow, not an automatic interceptor for every coding tool. Record the model, AI coding tool, and effective access for each request with --model, --ai-tool, and --access-level whenever known. Access is a short description of the tool’s actual filesystem, network, and approval permissions at the time of the request, not its Backify role. Use only exposed session information; never guess unknown values or inspect credentials to discover them. Omit unknown fields; older or incomplete records display “Not recorded”. These values are self-reported metadata, not verified authorization. Reuse the same metadata on retries. Model and tool names are limited to 200 characters each; access descriptions to 500. Never include secrets, tokens, full paths, or configuration file contents. Include the exposed model family and version, for example gpt-6-luna or gpt-6.1-sol, rather than only the tool name. Separate filesystem, network, and approval access descriptions with semicolons so each appears as a separate badge. The CLI automatically records the installed @backifydev/sdk version from the project or its hoisted node_modules, never the dependency range. Use --sdk-version to preserve the original installed version on retries or when auto-detection is unavailable; SDK versions are limited to 100 characters. Unknown SDK and model versions remain “Not recorded”; never guess them. Use build for application features and application bug fixes, deploy for shipping or launching, fixing only for Backify platform/SDK/CLI/connection/hosting troubleshooting (not application-code bugs), and other for setup, questions, or uncategorized requests. The API defaults new requests without a type to other; older untyped records remain visible as Not recorded. Record requests received before authentication in conversation order as soon as connected; never persist credentials to queue them. Types are classifications, not success/failure statuses.
323
-
324
- `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.
325
-
326
- `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.
327
-
328
- `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.
329
-
330
- Connections now report the device hostname, operating system, architecture, and installed CLI version. Browser-based `connect` exchanges a general sign-in token for an application-scoped device session. Application **People & access → CLI access** shows these sessions and lets access managers revoke individual devices; source managers can revoke their own. Existing connections may need reconnecting to record device details. See [CLI access and country lookup configuration](../../docs/cli-access.md) for privacy, permissions and deployment requirements.
331
- ## Environment diagnostics before onboarding
332
-
333
- Backify is TypeScript-first: prefer React/Vite and an explicit TypeScript backend
334
- for new applications. Existing frameworks are assessed individually and custom
335
- containers remain an advanced hosting path. Doctor and local reports expose
336
- advisory support tiers without rejecting existing stacks or claiming verified SDK
337
- integration. See [application support](../../docs/application-support.md).
338
-
339
- Container delivery supports repository-root npm applications with a lockfile and
340
- start script without requiring a Dockerfile or local Docker installation. Custom
341
- Dockerfiles take precedence and support other languages; that does not imply SDK
342
- support for those languages. Generated GitHub workflows verify the exact production
343
- image before registry publication. See [application build verification](../../docs/application-build-contract.md)
344
- for supported layouts, diagnostics, limitations and rollout requirements.
345
-
346
- Run `backify doctor --environment` before connection or initialization when the CLI is already installed. It checks Node.js, npm, optional Git, a unique workspace write/read/cleanup, and real loopback HTTP without changing application configuration. Missing terminal or Node.js/npm must be diagnosed by the coding environment before the CLI can run.
347
-
348
- Add `--network` for bounded, credential-free probes of the public guide, documentation, anonymous API health and npm package metadata. Add `--capability <capability-name>` to probe that capability's documentation. No arbitrary endpoints, pairing credentials or tokens are accepted. Public production endpoints are tested, not a configured nonproduction API; diagnose a trusted override separately before connection.
349
-
350
- JSON reports distinguish failed and unverified checks, network/HTTP failure classes and recovery guidance. A zero exit code means no tested required check failed, not that skipped network checks or application tests passed; inspect `verified` and individual checks. Native agent approval, cross-session persistence, browser authentication and deployment authorization cannot be inferred by CLI probes. Git is required for connected delivery but optional for unconnected local work.
351
-
352
- 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.
353
-
354
- ## Safe SDK upgrades and local magic links
355
-
356
- 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.
357
-
358
- 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.
1
+ # @backifydev/cli
2
+
3
+ ## Browser pages opened by the CLI
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.
6
+
7
+ ## Guided integration connections
8
+
9
+ ```sh
10
+ backify integrations connect hubspot --environment ENVIRONMENT_UUID --operations contacts.list,contacts.create
11
+ ```
12
+
13
+ The workspace supplies the application; use `--app` to select it explicitly. The command requests read operations by default, asks for selection when definitions or environments are ambiguous, and waits for manager review and provider setup. Approved connection IDs and generated bindings return to the CLI; provider credentials stay server-side.
14
+
15
+ Use `--no-browser` to open the printed review URL manually, `--no-wait` to return immediately, or `--timeout 600` to bound the wait. Resume with `backify integrations connect --adoption ADOPTION_UUID`. Pending or blocked setup returns exit code 2. User-owned installations return `userConnectionFlowRequired: true` after provider registration setup; implement each signed-in application user's independent connection flow with the server SDK.
16
+
17
+ ## Custom domains from a coding tool
18
+
19
+ ```sh
20
+ backify domains connect app.example.com --environment production
21
+ ```
22
+
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.
24
+
25
+ ## Coding-tool MCP bridge
26
+
27
+ `backify mcp [--organization <organization-id>]` bridges stdio to the single
28
+ organization MCP at `https://mcp.backify.dev`. Sign in explicitly using
29
+ `backify login --organization <organization-id> --organization-access`; application
30
+ sessions remain app-scoped and cannot administer organizations. The bridge rereads
31
+ credentials per request and pins the organization until restarted. Discover and
32
+ describe customer API operations, prepare changes, obtain explicit user approval,
33
+ then execute with a one-use confirmation. All API permissions and release policies
34
+ still apply. See the [plugin guide](../../docs/coding-tool-plugins.md).
35
+
36
+ `backify tools configure --agent copilot|cursor|gemini` adds the selected host's
37
+ native HTTP configuration for that same MCP. Cline and Windsurf/Cascade additionally
38
+ require `--config <exact-editor-config-path>`. `--dry-run` previews without writing;
39
+ `--transport stdio` selects the existing local bridge instead. Existing settings
40
+ and other MCP servers are preserved; conflicting Backify entries and JSONC files
41
+ are never overwritten. Native HTTP authorization opens the existing Backify portal
42
+ for explicit organization consent and gives the coding tool only an opaque MCP
43
+ token. This requires the updated server/portal rollout; it is not deployed by
44
+ running the setup command. Native sessions last up to an hour and require
45
+ reauthorization/re-registration after expiration or an MCP server restart.
46
+ Application instruction selection additionally supports `--agent cursor`,
47
+ `--agent cline` and `--agent windsurf`.
48
+ The bridge now exchanges browser-approved account access for an organization-
49
+ and audience-bound MCP token; the updated CLI and MCP host must roll out together.
50
+
51
+
52
+ ## API integration discovery
53
+
54
+ 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).
55
+
56
+ ## Source-bound worker build provenance
57
+
58
+ The opt-in protected CI workflow creates one worker build with OIDC-signed evidence.
59
+ Use **backify workload provenance verify --policy ... --report ... --bundle ...
60
+ --trusted-root ...** with reviewed source, workflow, application and image pins.
61
+ Independent rebuilds and base-supplier signatures are optional stronger checks;
62
+ policy-required evidence and invalid signatures still fail closed. The baseline
63
+ does not claim reproduction or supplier authentication. This does not authorize
64
+ deployment or change existing HCR v1 installation behavior. See the
65
+ [build provenance guide](../../docs/worker-build-provenance.md).
66
+
67
+ ## Local runtime and hosted containers
68
+
69
+ Use runtime install --version vX.Y.Z --sha256 <reviewed-hash> [--archive <zip>]
70
+ and runtime doctor for an explicitly reviewed self-contained local HCR. Native
71
+ PostgreSQL tools are a separate prerequisite. The source includes a Windows/macOS/
72
+ Linux CI matrix; published release assets remain an operator release step.
73
+
74
+ The full-stack scaffold includes a Dockerfile and a same-origin production HTTP
75
+ server. ship accepts this container path for both Backify Cloud and customer Azure;
76
+ CI builds an immutable registry digest and publishes to Preview, not directly live.
77
+ Production promotion retains optional independent approval. See
78
+ [provider configuration and rollout](../../docs/hosting-provider-config.md).
79
+
80
+ ## Explicit local development identity
81
+
82
+ Declare auth intent and run dev --identity-users local-users.json --backend-port
83
+ 3000 with reviewed repository-contained user profiles. identity users|issue|clear
84
+ --local --json uses the authenticated operator session; issue additionally requires
85
+ --user <reviewed-UUID>. Issuance deliberately returns a private five-minute local
86
+ credential, not a production JWT or operator/workload token. Do not log or commit
87
+ its output. No anonymous login, cookie, roles or production fallback is created.
88
+ See [local identity boundaries and profile format](../../docs/local-development.md).
89
+
90
+ ## Read-only local data inspection
91
+
92
+ `backify inspect events --local --json` reports only status counts and the latest
93
+ 100 event metadata rows. The Events panel uses the same authenticated loopback API;
94
+ neither view reveals payloads, producer keys or lease receipts. The local broker
95
+ persists leases, attempts and deduplication across worker restarts in private
96
+ snapshots. It remains a single-worker local emulator, not a production cloud queue.
97
+
98
+ In full mode, enabled declared events instead use an owned dedicated PostgreSQL
99
+ inbox after explicit review of the HCR SQL asset and --apply-migrations approval.
100
+ Old snapshot records keep their IDs, keys and receipts and drain locally; native
101
+ payloads/receipts are never copied into snapshots. Combined inspection remains
102
+ metadata-only. Missing initialized schema or ownership is never recreated on
103
+ restart. Native emission acceptance preserves process-local hooks without firing
104
+ them for duplicate keys; hooks are not distributed subscriptions.
105
+
106
+ The authenticated dashboard includes Data, Jobs, Events and Logs panels. Native inspection
107
+ uses actual scoped PostgreSQL/filesystem providers; unavailable providers are not
108
+ replaced with empty emulator responses. Row pages, file metadata and explicit
109
+ text/binary previews are bounded. Credential-named row fields are redacted and
110
+ all data is rendered as text. No data editing/deletion controls are added.
111
+
112
+ Use `backify inspect tables|rows|buckets|objects|preview|events --local --json` for stable
113
+ operator-facing JSON. Row inspection needs `--table`; objects/preview need
114
+ `--bucket`, and preview also needs `--key`. Optional `--limit`/`--offset`
115
+ page rows/objects; `--prefix` filters object metadata. Arbitrary SQL, writes,
116
+ cloud fallback and unchecked pagination are rejected. See the
117
+ [local guide](../../docs/local-development.md) for bounds and browser/native tests.
118
+
119
+
120
+ ## Authenticated workload packaging
121
+
122
+ An explicit `auth` declaration now configures request-scoped end-user verification
123
+ in packaged HTTP/worker hosts. Plans report a read-only public-trust directory,
124
+ `BACKIFY_APPLICATION_AUTH_TRUST_FILE` and independently pinned organization,
125
+ application and environment IDs. Missing or mismatched scope/trust fails startup;
126
+ corrupt or stale mounted rotations fail requests closed. Issuer enrollment, fleet
127
+ installation and production rollout remain blockers; no keys or tokens are bundled.
128
+ New authenticated artifacts also require BACKIFY_APPLICATION_AUTH_STATE_FILE and
129
+ a separate writable private persistent directory. Use workload trust-state plan,
130
+ then workload trust-state initialize with --confirm, absolute --trust-file and
131
+ --state-file, independently pinned --organization/--application/--environment,
132
+ and the reviewed --revision. Initialization refuses existing state; bootstrap never
133
+ recreates missing state. Journal rollback/mutation and corruption fail closed even
134
+ after a process restart. Lock/volume recovery and Windows ACLs remain operator duties.
135
+ See [application identity](../../docs/application-identity.md).
136
+
137
+
138
+ ## Operator public-trust polling
139
+
140
+ Use `backify workload trust-sync plan|once|run --configuration <absolute-json>`
141
+ outside workloads. Review `plan` first; `once` and `run` require `--confirm`.
142
+ The strict configuration pins scope/agent and management issuer/audience/public key,
143
+ and supplies distinct absolute credential/public-output/private-journal paths.
144
+ Initialize the operator journal explicitly with the reviewed trust-state workflow;
145
+ do not reuse a workload journal or mount management credentials in applications.
146
+
147
+ Plans do not read credentials, network or write. Polling rereads the private token,
148
+ verifies versioned signed delivery, atomically publishes public-only trust, and
149
+ uses serial bounded backoff and SIGINT/SIGTERM shutdown. Missing state, rollback,
150
+ mutations and retained locks fail closed; failed publication retains evidence.
151
+ Windows ACLs remain an operator duty. Eligible polls can trigger public-document
152
+ renewal only with the separate, explicitly initialized opt-in control-plane ledger.
153
+ The CLI never generates issuer trust, rotates keys, renews agent credentials,
154
+ installs fleet services or makes deployment production-ready.
155
+ See [configuration and recovery limits](../../docs/application-identity.md#signed-operator-trust-delivery).
156
+
157
+ Local development supports --mode lightweight and --mode full. PostgreSQL engine
158
+ or migration intent selects full mode automatically. Full mode starts isolated
159
+ native PostgreSQL/HCR services; set --hcr-path/BACKIFY_LOCAL_HCR_PATH for an approved
160
+ HCR artifact and --postgres-bin/BACKIFY_LOCAL_POSTGRES_BIN for PostgreSQL tools.
161
+ Review pending SQL before passing --apply-migrations. --hcr-port/--database-port
162
+ configure service ports; the existing --port configures the local dashboard.
163
+ Missing prerequisites fail explicitly, and shutdown preserves local data.
164
+ See [full-fidelity local services](../../docs/architecture/local-full-fidelity.md).
165
+
166
+ Native jobs require paired --job-artifacts <reviewed-json> and --job-worker
167
+ <repository-relative-packaged-directory>. First review and approve both jobs SQL
168
+ assets with --apply-migrations; restarts retain data without repeating approval.
169
+ The bundle must be a separately packaged worker matching the reviewed SHA-256
170
+ and current normalized manifest. Native admission selects full mode and never
171
+ falls back to the snapshot executor. Canonical enqueue, acknowledged backend
172
+ schedules and manual operator dispatch execute through independent pinned Node
173
+ processes against the real queue. Native cancellation is pending-only; native
174
+ UUID retry creates one stable new run per scoped failed source/current worker
175
+ artifact, preserving original payloads/pins/history. Replay does not repeat a
176
+ completed retry; retry a newly failed UUID for another attempt. Original legacy rows/payloads/pins remain retained;
177
+ explicit failed-row retry creates a new native run. Worker-declared schedules are
178
+ discovered before backend import through the bounded hcr-schedules-v1 protocol.
179
+ Support is pinned in the immutable bundle header, not mutable artifact metadata;
180
+ older bundles retain explicit legacy-backend-declarations-only scheduling.
181
+ Discovery enables SDK job registration only and never invokes handlers. It is not
182
+ an OS sandbox or hosted scheduler. Auth-enabled workers now require an additional
183
+ --job-auth <reviewed-json> pinning repository-relative public trust/private existing
184
+ antirollback state, exact scope, revision and trust byte digest. Fresh local ownership
185
+ adopts the reviewed scope; retained scope conflicts refuse without changing data.
186
+ Mounts are rechecked before execution; local identity fixtures cannot be mixed in.
187
+ Explicit --job-trust-sync <reviewed-json> enables signed active-worker trust renewal
188
+ in the CLI supervisor. Management configuration/credentials are never forwarded
189
+ to application processes. Exact publication digests and owned IPC update existing
190
+ mounts only; watch reload retains accepted pins, while whole CLI restart requires
191
+ reviewing current auth descriptor bytes/revision. Identical shared historical mounts
192
+ follow one configuration; separate mounts may specify trustSyncFile. Existing valid
193
+ trust survives management outages, expiry remains fail-closed, and shutdown aborts
194
+ owned polling. This does not renew management credentials or install a fleet.
195
+ Explicit --job-history
196
+ <reviewed-json> admission activates up to fifteen unique original workers alongside
197
+ the current worker. Supply each original artifactVersion, workerDirectory and
198
+ manifestFile, plus authFile when its original manifest enables auth. The original
199
+ portable manifest digest and actual bundle must match, all versions must also be
200
+ reviewed in --job-artifacts, and resources/issuer scope must remain compatible with
201
+ the current owned application. Retired source/migrations are not imported/applied.
202
+ Receipts stay original-pinned; historical schedule declarations are not resynced.
203
+ Current dispatch/retry/discovery stay current-worker owned. Exact duplicate old-pin
204
+ acknowledgement can recover a lost schedule checkpoint, but never create new old
205
+ runs or repin history. Active workers share bounded concurrency; metadata omits
206
+ paths/trust mounts. This is not signed cloud/fleet activation or an OS sandbox.
207
+ See [reviewed workflow and limits](../../docs/local-development.md#reviewed-independent-native-jobs).
208
+
209
+ Set up, connect, record requests, and ship a Backify application repository. CLI 0.3.0 adds the connected AI delivery workflow.
210
+
211
+ ## Full-stack starter
212
+
213
+ For a runnable personal task application, add `--template tasks`:
214
+
215
+ ```bash
216
+ backify scaffold --app app_xxxxx --name personal-tasks --template tasks
217
+ npm install
218
+ npm run dev
219
+ ```
220
+
221
+ The task template declares authentication, database and jobs, wires the frontend
222
+ and HTTP handlers, supplies an additive schema declaration, and includes tests
223
+ for validation, trusted ownership and cross-user isolation. Development explicitly
224
+ uses local document providers and two reviewed local identities. Issue a short-lived
225
+ user token with `backify identity issue --local --user 44444444-4444-4444-4444-444444444444`
226
+ and use the development-only token field. No provider connections are required.
227
+ The production build removes this field; verified production sign-in remains a
228
+ deployment prerequisite. Local PostgreSQL/runtime prerequisites are not installed
229
+ automatically. The generated README distinguishes emulation from real-engine
230
+ migration tests. Full local mode accepts the same additive schema declaration;
231
+ review it and run `npm run dev:full -- --apply-migrations` to approve pending DDL.
232
+ The existing minimal starter remains the default.
233
+
234
+ In an empty folder, run backify scaffold --app app_xxxxx --name my-application
235
+ with the application ID supplied by Backify. It writes a React/Vite frontend, Hono
236
+ HTTP server, declaration-only scheduled worker, tests and current project guidance.
237
+ It never installs dependencies, provisions resources or overwrites existing source.
238
+ Identical output is idempotent; linked paths, existing applications, modified
239
+ instructions and conflicting files fail before generated files are written.
240
+ Use compatible workspace builds until these source-only CLI/SDK additions are released.
241
+ Run npm install, npm test, npm run typecheck, npm run build and npm run dev in the
242
+ generated project. The same-origin /api proxy avoids exposing workload tokens to React.
243
+ The liveness endpoint is public; private business APIs require trusted end-user
244
+ authorization, which is deliberately not fabricated by this starter.
245
+ See [local workflow and browser verification](../../docs/local-development.md).
246
+
247
+ ## Independent OCI workloads
248
+
249
+ Explicit canonical job producers use optional BACKIFY_JOB_ARTIFACT_SHA256 and
250
+ BACKIFY_JOB_BINDING host configuration. The target worker digest is independent
251
+ of the HTTP bundle digest. A binding without a pin refuses before application
252
+ code loads. Plans keep deploymentReady false and require reviewed HCR worker
253
+ bindings plus the additive producer SQL; packaging never installs SQL or
254
+ automatically activates registered artifacts. Unconfigured enqueue and legacy
255
+ schedules remain unchanged. See [durable jobs](../../docs/hcr-jobs.md).
256
+
257
+ backify workload plan --kind http|worker emits a non-mutating JSON plan. Workers
258
+ require --entry pointing to a declaration-only module. backify workload package
259
+ also requires --base-image with an approved digest-pinned Node 22+ image reference;
260
+ it writes an isolated generated context without replacing customer Dockerfiles.
261
+ Bundle/artifact pins, private mounted workload credentials and unsupported-provider
262
+ checks fail closed. This does not build images, enroll identities or deploy apps.
263
+ See [workload contracts and limits](../../docs/architecture/oci-workloads.md).
264
+
265
+ ## Local full-stack workflow
266
+
267
+ The current source includes portable YAML validation, isolated server workers,
268
+ source/manifest watching, persistent local state, job/schedule inspection and an
269
+ authenticated loopback dashboard:
270
+
271
+ ~~~sh
272
+ backify validate --json
273
+ backify dev --open
274
+ backify dev --frontend web --frontend-port 5173 --backend-port 3000 --json
275
+ backify dev --frontend web --frontend-adapter static --frontend-port 5173 --json
276
+ backify status --local --json
277
+ backify jobs list --local
278
+ backify jobs run --local --name daily-report
279
+ backify logs --local
280
+ backify test --json
281
+ ~~~
282
+
283
+ Declare a Node entrypoint in backify.yaml. The SDK local runtime is installed before
284
+ application code loads. The CLI adds .backify/ to the ignore file; never commit its
285
+ records, files or queued payloads. Local mode does not use cloud credentials.
286
+ Full mode starts separate PostgreSQL/HCR services and applies only explicitly
287
+ approved SQL. Lightweight mode retains the document emulator. Optional --frontend
288
+ supervises an already-installed Vite frontend inside the repository; --backend-port
289
+ injects PORT, which application servers must honor. Vite keeps the application
290
+ configuration/HMR but cannot disable mandatory strict filesystem checks or private
291
+ state/secret exclusions. Canonical-path checks also refuse linked/junction access.
292
+ No frontend receives runtime
293
+ credentials. JSON dev lifecycle uses stdout; child diagnostics use stderr. Agents
294
+ may stop an IPC-launched CLI with backify-stop. See [local development and limits](../../docs/local-development.md).
295
+ These additions have not been published to npm.
296
+
297
+ For encrypted development secrets, declare capabilities.secrets, create a key in
298
+ an existing private directory outside the repository, and supply values only via stdin:
299
+
300
+ ~~~sh
301
+ backify secrets local init --key-file /private/backify-local.key
302
+ backify secrets local set SERVICE_TOKEN --key-file /private/backify-local.key --stdin
303
+ backify secrets local list --key-file /private/backify-local.key
304
+ backify dev --local-secrets-key /private/backify-local.key
305
+ ~~~
306
+
307
+ The ignored vault contains authenticated AES-256-GCM ciphertext only. The external
308
+ key stays outside builds/snapshots; plaintext reaches only the backend through IPC.
309
+ SDK logs redact values, but arbitrary console output/application writes do not.
310
+ Retained vaults fail closed without their key. Restart/rebuild to reload changes.
311
+ Windows private ACLs remain the operator's responsibility. Non-empty local vaults
312
+ with packaged native job workers refuse until a reviewed worker secret broker exists.
313
+ The opt-in static adapter requires index.html rather than Vite/package installation
314
+ and provides protected assets, nested live reload and public backend configuration;
315
+ it does not compile source or implement SSR. See the linked local guide for limits.
316
+
317
+ ## Connected delivery
318
+
319
+ ```sh
320
+ npx @backifydev/cli init --app app_xxxxx
321
+ npx @backifydev/cli doctor
322
+ npx @backifydev/cli sync
323
+ npx @backifydev/cli login
324
+ npx @backifydev/cli status
325
+ npx @backifydev/cli report --check
326
+ npx @backifydev/cli pull
327
+ npx @backifydev/cli ship
328
+ ```
329
+
330
+ `login` in an application folder, or `connect --reauth`, opens `https://auth.backify.dev` for sign-in and explicit CLI approval. Choose 7, 14, 30, or 90 days; after approval the CLI saves an application-scoped credential in `~/.backify.json` and continues automatically. The browser can then be closed. No copied setup prompt or pasted credential is required. `login` outside an application retains general sign-in for later connection. Set `BACKIFY_AUTH_URL` for a different authorization host (HTTPS, or loopback HTTP for local development); legacy `BACKIFY_PORTAL_URL` and `portalUrl` configuration remain supported. `login <token> [organizationId]` remains available for scripted development.
331
+
332
+ 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.
333
+
334
+ `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.
335
+
336
+ 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.
337
+
338
+ 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.
339
+
340
+ See the [agent setup guide](https://agent.backify.dev/).
341
+
342
+ Copy the application's setup prompt from Backify. It contains only the public app reference and https://agent.backify.dev/; the guide supplies fresh-machine prerequisite checks, npx commands, browser authorization and workspace setup. No global CLI installation, organization ID or pairing code is needed. Run `npx @backifydev/cli@latest connect --app <app-id> --reauth --api https://api.backify.dev/api`, adding `--clone` for a fresh workspace according to the guide. Keep the command running while the user selects the app's organization and approves access in the browser. The CLI receives and saves the app-scoped credential in the user's home configuration; it never belongs in chat, project files or Git. Supported browser approvals last 7, 14, 30, or 90 days. Existing pairing options remain available for legacy prompts; use `--pair-stdin` with private terminal input, never shell arguments, logs, environment variables or temporary files. The default API is `https://api.backify.dev/api`; trusted nonproduction environments can override it with `BACKIFY_API_URL` or `--api`. HTTPS is required outside loopback.
343
+
344
+ `init` adds a persistent delivery guide linked from the existing agent instructions. For every user request associated with the application, including setup, questions, deployment, application work, and Backify platform troubleshooting, the agent sends only the user's own text through stdin to `backify prompt record --stdin --id <UUID> --type <build|deploy|fixing|other>`, optionally adding repeated `--filename <basename>` arguments. Reuse the UUID on retries. The command never reads attachments; their bodies, extracted text, full paths, and credentials must not be submitted. Setup/pairing requests are recorded with secrets replaced by [REDACTED], never excluded. The CLI and API redact recognized Backify session tokens and pairing codes; redact all other secrets before submission. History is displayed oldest-first under the application. This is an explicit agent workflow, not an automatic interceptor for every coding tool. Record the model, AI coding tool, and effective access for each request with --model, --ai-tool, and --access-level whenever known. Access is a short description of the tool’s actual filesystem, network, and approval permissions at the time of the request, not its Backify role. Use only exposed session information; never guess unknown values or inspect credentials to discover them. Omit unknown fields; older or incomplete records display “Not recorded”. These values are self-reported metadata, not verified authorization. Reuse the same metadata on retries. Model and tool names are limited to 200 characters each; access descriptions to 500. Never include secrets, tokens, full paths, or configuration file contents. Include the exposed model family and version, for example gpt-6-luna or gpt-6.1-sol, rather than only the tool name. Separate filesystem, network, and approval access descriptions with semicolons so each appears as a separate badge. The CLI automatically records the installed @backifydev/sdk version from the project or its hoisted node_modules, never the dependency range. Use --sdk-version to preserve the original installed version on retries or when auto-detection is unavailable; SDK versions are limited to 100 characters. Unknown SDK and model versions remain “Not recorded”; never guess them. Use build for application features and application bug fixes, deploy for shipping or launching, fixing only for Backify platform/SDK/CLI/connection/hosting troubleshooting (not application-code bugs), and other for setup, questions, or uncategorized requests. The API defaults new requests without a type to other; older untyped records remain visible as Not recorded. Record requests received before authentication in conversation order as soon as connected; never persist credentials to queue them. Types are classifications, not success/failure statuses.
345
+
346
+ `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.
347
+
348
+ `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.
349
+
350
+ `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.
351
+
352
+ Connections now report the device hostname, operating system, architecture, and installed CLI version. Browser-based `connect` exchanges a general sign-in token for an application-scoped device session. Application **People & access → CLI access** shows these sessions and lets access managers revoke individual devices; source managers can revoke their own. Existing connections may need reconnecting to record device details. See [CLI access and country lookup configuration](../../docs/cli-access.md) for privacy, permissions and deployment requirements.
353
+ ## Environment diagnostics before onboarding
354
+
355
+ Backify is TypeScript-first: prefer React/Vite and an explicit TypeScript backend
356
+ for new applications. Existing frameworks are assessed individually and custom
357
+ containers remain an advanced hosting path. Doctor and local reports expose
358
+ advisory support tiers without rejecting existing stacks or claiming verified SDK
359
+ integration. See [application support](../../docs/application-support.md).
360
+
361
+ Container delivery supports repository-root npm applications with a lockfile and
362
+ start script without requiring a Dockerfile or local Docker installation. Custom
363
+ Dockerfiles take precedence and support other languages; that does not imply SDK
364
+ support for those languages. Generated GitHub workflows verify the exact production
365
+ image before registry publication. See [application build verification](../../docs/application-build-contract.md)
366
+ for supported layouts, diagnostics, limitations and rollout requirements.
367
+
368
+ Run `backify doctor --environment` before connection or initialization when the CLI is already installed. It checks Node.js, npm, optional Git, a unique workspace write/read/cleanup, and real loopback HTTP without changing application configuration. Missing terminal or Node.js/npm must be diagnosed by the coding environment before the CLI can run.
369
+
370
+ Add `--network` for bounded, credential-free probes of the public guide, documentation, anonymous API health and npm package metadata. Add `--capability <capability-name>` to probe that capability's documentation. No arbitrary endpoints, pairing credentials or tokens are accepted. Public production endpoints are tested, not a configured nonproduction API; diagnose a trusted override separately before connection.
371
+
372
+ JSON reports distinguish failed and unverified checks, network/HTTP failure classes and recovery guidance. A zero exit code means no tested required check failed, not that skipped network checks or application tests passed; inspect `verified` and individual checks. Native agent approval, cross-session persistence, browser authentication and deployment authorization cannot be inferred by CLI probes. Git is required for connected delivery but optional for unconnected local work.
373
+
374
+ 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.
375
+
376
+ ## Safe SDK upgrades and local magic links
377
+
378
+ 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.
379
+
380
+ 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.