@backifydev/cli 0.3.4 → 0.3.5

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 +246 -2
  2. package/dist/index.js +22629 -1044
  3. package/package.json +50 -46
package/README.md CHANGED
@@ -1,6 +1,250 @@
1
- # @backifydev/cli
2
-
1
+ # @backifydev/cli
2
+
3
+ ## Source-bound worker build provenance
4
+
5
+ The opt-in protected CI workflow creates one worker build with OIDC-signed evidence.
6
+ Use **backify workload provenance verify --policy ... --report ... --bundle ...
7
+ --trusted-root ...** with reviewed source, workflow, application and image pins.
8
+ Independent rebuilds and base-supplier signatures are optional stronger checks;
9
+ policy-required evidence and invalid signatures still fail closed. The baseline
10
+ does not claim reproduction or supplier authentication. This does not authorize
11
+ deployment or change existing HCR v1 installation behavior. See the
12
+ [build provenance guide](../../docs/worker-build-provenance.md).
13
+
14
+ ## Local runtime and hosted containers
15
+
16
+ Use runtime install --version vX.Y.Z --sha256 <reviewed-hash> [--archive <zip>]
17
+ and runtime doctor for an explicitly reviewed self-contained local HCR. Native
18
+ PostgreSQL tools are a separate prerequisite. The source includes a Windows/macOS/
19
+ Linux CI matrix; published release assets remain an operator release step.
20
+
21
+ The full-stack scaffold includes a Dockerfile and a same-origin production HTTP
22
+ server. ship accepts this container path for both Backify Cloud and customer Azure;
23
+ CI builds an immutable registry digest and publishes to Preview, not directly live.
24
+ Production promotion retains optional independent approval. See
25
+ [provider configuration and rollout](../../docs/hosting-provider-config.md).
26
+
27
+ ## Immutable worker artifact planning
28
+
29
+ `backify workload artifact-plan --organization <UUID> --app <UUID> --environment <UUID> --deployment <UUID> --source-commit <commit> --image <registry/repository@sha256:digest> --jobs-file worker-jobs.json --entry src/worker.ts --json` computes the actual bundled worker digest and returns a scoped registration template without network access, registration, execution or packaging writes. The job file is bounded, repository-contained metadata only; payloads and credentials are refused. Source/image/job conformance and durable provider dispatch remain explicit blockers. See the [worker artifact guide](../../docs/worker-artifacts.md).
30
+
31
+ ## Explicit local development identity
32
+
33
+ Declare auth intent and run dev --identity-users local-users.json --backend-port
34
+ 3000 with reviewed repository-contained user profiles. identity users|issue|clear
35
+ --local --json uses the authenticated operator session; issue additionally requires
36
+ --user <reviewed-UUID>. Issuance deliberately returns a private five-minute local
37
+ credential, not a production JWT or operator/workload token. Do not log or commit
38
+ its output. No anonymous login, cookie, roles or production fallback is created.
39
+ See [local identity boundaries and profile format](../../docs/local-development.md).
40
+
41
+ ## Read-only local data inspection
42
+
43
+ `backify inspect events --local --json` reports only status counts and the latest
44
+ 100 event metadata rows. The Events panel uses the same authenticated loopback API;
45
+ neither view reveals payloads, producer keys or lease receipts. The local broker
46
+ persists leases, attempts and deduplication across worker restarts in private
47
+ snapshots. It remains a single-worker local emulator, not a production cloud queue.
48
+
49
+ In full mode, enabled declared events instead use an owned dedicated PostgreSQL
50
+ inbox after explicit review of the HCR SQL asset and --apply-migrations approval.
51
+ Old snapshot records keep their IDs, keys and receipts and drain locally; native
52
+ payloads/receipts are never copied into snapshots. Combined inspection remains
53
+ metadata-only. Missing initialized schema or ownership is never recreated on
54
+ restart. Native emission acceptance preserves process-local hooks without firing
55
+ them for duplicate keys; hooks are not distributed subscriptions.
56
+
57
+ The authenticated dashboard includes Data, Jobs, Events and Logs panels. Native inspection
58
+ uses actual scoped PostgreSQL/filesystem providers; unavailable providers are not
59
+ replaced with empty emulator responses. Row pages, file metadata and explicit
60
+ text/binary previews are bounded. Credential-named row fields are redacted and
61
+ all data is rendered as text. No data editing/deletion controls are added.
62
+
63
+ Use `backify inspect tables|rows|buckets|objects|preview|events --local --json` for stable
64
+ operator-facing JSON. Row inspection needs `--table`; objects/preview need
65
+ `--bucket`, and preview also needs `--key`. Optional `--limit`/`--offset`
66
+ page rows/objects; `--prefix` filters object metadata. Arbitrary SQL, writes,
67
+ cloud fallback and unchecked pagination are rejected. See the
68
+ [local guide](../../docs/local-development.md) for bounds and browser/native tests.
69
+
70
+
71
+ ## Authenticated workload packaging
72
+
73
+ An explicit `auth` declaration now configures request-scoped end-user verification
74
+ in packaged HTTP/worker hosts. Plans report a read-only public-trust directory,
75
+ `BACKIFY_APPLICATION_AUTH_TRUST_FILE` and independently pinned organization,
76
+ application and environment IDs. Missing or mismatched scope/trust fails startup;
77
+ corrupt or stale mounted rotations fail requests closed. Issuer enrollment, fleet
78
+ installation and production rollout remain blockers; no keys or tokens are bundled.
79
+ New authenticated artifacts also require BACKIFY_APPLICATION_AUTH_STATE_FILE and
80
+ a separate writable private persistent directory. Use workload trust-state plan,
81
+ then workload trust-state initialize with --confirm, absolute --trust-file and
82
+ --state-file, independently pinned --organization/--application/--environment,
83
+ and the reviewed --revision. Initialization refuses existing state; bootstrap never
84
+ recreates missing state. Journal rollback/mutation and corruption fail closed even
85
+ after a process restart. Lock/volume recovery and Windows ACLs remain operator duties.
86
+ See [application identity](../../docs/application-identity.md).
87
+
88
+
89
+ ## Operator public-trust polling
90
+
91
+ Use `backify workload trust-sync plan|once|run --configuration <absolute-json>`
92
+ outside workloads. Review `plan` first; `once` and `run` require `--confirm`.
93
+ The strict configuration pins scope/agent and management issuer/audience/public key,
94
+ and supplies distinct absolute credential/public-output/private-journal paths.
95
+ Initialize the operator journal explicitly with the reviewed trust-state workflow;
96
+ do not reuse a workload journal or mount management credentials in applications.
97
+
98
+ Plans do not read credentials, network or write. Polling rereads the private token,
99
+ verifies versioned signed delivery, atomically publishes public-only trust, and
100
+ uses serial bounded backoff and SIGINT/SIGTERM shutdown. Missing state, rollback,
101
+ mutations and retained locks fail closed; failed publication retains evidence.
102
+ Windows ACLs remain an operator duty. Eligible polls can trigger public-document
103
+ renewal only with the separate, explicitly initialized opt-in control-plane ledger.
104
+ The CLI never generates issuer trust, rotates keys, renews agent credentials,
105
+ installs fleet services or makes deployment production-ready.
106
+ See [configuration and recovery limits](../../docs/application-identity.md#signed-operator-trust-delivery).
107
+
108
+ Local development supports --mode lightweight and --mode full. PostgreSQL engine
109
+ or migration intent selects full mode automatically. Full mode starts isolated
110
+ native PostgreSQL/HCR services; set --hcr-path/BACKIFY_LOCAL_HCR_PATH for an approved
111
+ HCR artifact and --postgres-bin/BACKIFY_LOCAL_POSTGRES_BIN for PostgreSQL tools.
112
+ Review pending SQL before passing --apply-migrations. --hcr-port/--database-port
113
+ configure service ports; the existing --port configures the local dashboard.
114
+ Missing prerequisites fail explicitly, and shutdown preserves local data.
115
+ See [full-fidelity local services](../../docs/architecture/local-full-fidelity.md).
116
+
117
+ Native jobs require paired --job-artifacts <reviewed-json> and --job-worker
118
+ <repository-relative-packaged-directory>. First review and approve both jobs SQL
119
+ assets with --apply-migrations; restarts retain data without repeating approval.
120
+ The bundle must be a separately packaged worker matching the reviewed SHA-256
121
+ and current normalized manifest. Native admission selects full mode and never
122
+ falls back to the snapshot executor. Canonical enqueue, acknowledged backend
123
+ schedules and manual operator dispatch execute through independent pinned Node
124
+ processes against the real queue. Native cancellation is pending-only; native
125
+ UUID retry creates one stable new run per scoped failed source/current worker
126
+ artifact, preserving original payloads/pins/history. Replay does not repeat a
127
+ completed retry; retry a newly failed UUID for another attempt. Original legacy rows/payloads/pins remain retained;
128
+ explicit failed-row retry creates a new native run. Worker-declared schedules are
129
+ discovered before backend import through the bounded hcr-schedules-v1 protocol.
130
+ Support is pinned in the immutable bundle header, not mutable artifact metadata;
131
+ older bundles retain explicit legacy-backend-declarations-only scheduling.
132
+ Discovery enables SDK job registration only and never invokes handlers. It is not
133
+ an OS sandbox or hosted scheduler. Auth-enabled workers now require an additional
134
+ --job-auth <reviewed-json> pinning repository-relative public trust/private existing
135
+ antirollback state, exact scope, revision and trust byte digest. Fresh local ownership
136
+ adopts the reviewed scope; retained scope conflicts refuse without changing data.
137
+ Mounts are rechecked before execution; local identity fixtures cannot be mixed in.
138
+ Explicit --job-trust-sync <reviewed-json> enables signed active-worker trust renewal
139
+ in the CLI supervisor. Management configuration/credentials are never forwarded
140
+ to application processes. Exact publication digests and owned IPC update existing
141
+ mounts only; watch reload retains accepted pins, while whole CLI restart requires
142
+ reviewing current auth descriptor bytes/revision. Identical shared historical mounts
143
+ follow one configuration; separate mounts may specify trustSyncFile. Existing valid
144
+ trust survives management outages, expiry remains fail-closed, and shutdown aborts
145
+ owned polling. This does not renew management credentials or install a fleet.
146
+ Explicit --job-history
147
+ <reviewed-json> admission activates up to fifteen unique original workers alongside
148
+ the current worker. Supply each original artifactVersion, workerDirectory and
149
+ manifestFile, plus authFile when its original manifest enables auth. The original
150
+ portable manifest digest and actual bundle must match, all versions must also be
151
+ reviewed in --job-artifacts, and resources/issuer scope must remain compatible with
152
+ the current owned application. Retired source/migrations are not imported/applied.
153
+ Receipts stay original-pinned; historical schedule declarations are not resynced.
154
+ Current dispatch/retry/discovery stay current-worker owned. Exact duplicate old-pin
155
+ acknowledgement can recover a lost schedule checkpoint, but never create new old
156
+ runs or repin history. Active workers share bounded concurrency; metadata omits
157
+ paths/trust mounts. This is not signed cloud/fleet activation or an OS sandbox.
158
+ See [reviewed workflow and limits](../../docs/local-development.md#reviewed-independent-native-jobs).
159
+
3
160
  Set up, connect, record requests, and ship a Backify application repository. CLI 0.3.0 adds the connected AI delivery workflow.
161
+
162
+ ## Full-stack starter
163
+
164
+ In an empty folder, run backify scaffold --app app_xxxxx --name my-application
165
+ with the application ID supplied by Backify. It writes a React/Vite frontend, Hono
166
+ HTTP server, declaration-only scheduled worker, tests and current project guidance.
167
+ It never installs dependencies, provisions resources or overwrites existing source.
168
+ Identical output is idempotent; linked paths, existing applications, modified
169
+ instructions and conflicting files fail before generated files are written.
170
+ Use compatible workspace builds until these source-only CLI/SDK additions are released.
171
+ Run npm install, npm test, npm run typecheck, npm run build and npm run dev in the
172
+ generated project. The same-origin /api proxy avoids exposing workload tokens to React.
173
+ The liveness endpoint is public; private business APIs require trusted end-user
174
+ authorization, which is deliberately not fabricated by this starter.
175
+ See [local workflow and browser verification](../../docs/local-development.md).
176
+
177
+ ## Independent OCI workloads
178
+
179
+ Explicit canonical job producers use optional BACKIFY_JOB_ARTIFACT_SHA256 and
180
+ BACKIFY_JOB_BINDING host configuration. The target worker digest is independent
181
+ of the HTTP bundle digest. A binding without a pin refuses before application
182
+ code loads. Plans keep deploymentReady false and require reviewed HCR worker
183
+ bindings plus the additive producer SQL; packaging never installs SQL or
184
+ automatically activates registered artifacts. Unconfigured enqueue and legacy
185
+ schedules remain unchanged. See [durable jobs](../../docs/hcr-jobs.md).
186
+
187
+ backify workload plan --kind http|worker emits a non-mutating JSON plan. Workers
188
+ require --entry pointing to a declaration-only module. backify workload package
189
+ also requires --base-image with an approved digest-pinned Node 22+ image reference;
190
+ it writes an isolated generated context without replacing customer Dockerfiles.
191
+ Bundle/artifact pins, private mounted workload credentials and unsupported-provider
192
+ checks fail closed. This does not build images, enroll identities or deploy apps.
193
+ See [workload contracts and limits](../../docs/architecture/oci-workloads.md).
194
+
195
+ ## Local full-stack workflow
196
+
197
+ The current source includes portable YAML validation, isolated server workers,
198
+ source/manifest watching, persistent local state, job/schedule inspection and an
199
+ authenticated loopback dashboard:
200
+
201
+ ~~~sh
202
+ backify validate --json
203
+ backify dev --open
204
+ backify dev --frontend web --frontend-port 5173 --backend-port 3000 --json
205
+ backify dev --frontend web --frontend-adapter static --frontend-port 5173 --json
206
+ backify status --local --json
207
+ backify jobs list --local
208
+ backify jobs run --local --name daily-report
209
+ backify logs --local
210
+ backify test --json
211
+ ~~~
212
+
213
+ Declare a Node entrypoint in backify.yaml. The SDK local runtime is installed before
214
+ application code loads. The CLI adds .backify/ to the ignore file; never commit its
215
+ records, files or queued payloads. Local mode does not use cloud credentials.
216
+ Full mode starts separate PostgreSQL/HCR services and applies only explicitly
217
+ approved SQL. Lightweight mode retains the document emulator. Optional --frontend
218
+ supervises an already-installed Vite frontend inside the repository; --backend-port
219
+ injects PORT, which application servers must honor. Vite keeps the application
220
+ configuration/HMR but cannot disable mandatory strict filesystem checks or private
221
+ state/secret exclusions. Canonical-path checks also refuse linked/junction access.
222
+ No frontend receives runtime
223
+ credentials. JSON dev lifecycle uses stdout; child diagnostics use stderr. Agents
224
+ may stop an IPC-launched CLI with backify-stop. See [local development and limits](../../docs/local-development.md).
225
+ These additions have not been published to npm.
226
+
227
+ For encrypted development secrets, declare capabilities.secrets, create a key in
228
+ an existing private directory outside the repository, and supply values only via stdin:
229
+
230
+ ~~~sh
231
+ backify secrets local init --key-file /private/backify-local.key
232
+ backify secrets local set SERVICE_TOKEN --key-file /private/backify-local.key --stdin
233
+ backify secrets local list --key-file /private/backify-local.key
234
+ backify dev --local-secrets-key /private/backify-local.key
235
+ ~~~
236
+
237
+ The ignored vault contains authenticated AES-256-GCM ciphertext only. The external
238
+ key stays outside builds/snapshots; plaintext reaches only the backend through IPC.
239
+ SDK logs redact values, but arbitrary console output/application writes do not.
240
+ Retained vaults fail closed without their key. Restart/rebuild to reload changes.
241
+ Windows private ACLs remain the operator's responsibility. Non-empty local vaults
242
+ with packaged native job workers refuse until a reviewed worker secret broker exists.
243
+ The opt-in static adapter requires index.html rather than Vite/package installation
244
+ and provides protected assets, nested live reload and public backend configuration;
245
+ it does not compile source or implement SSR. See the linked local guide for limits.
246
+
247
+ ## Connected delivery
4
248
 
5
249
  ```sh
6
250
  npx @backifydev/cli init --app app_xxxxx