@backifydev/cli 0.3.0 → 0.3.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.
Files changed (2) hide show
  1. package/dist/index.js +72 -3
  2. package/package.json +20 -7
package/dist/index.js CHANGED
@@ -11,8 +11,63 @@ import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync
11
11
  import { basename, dirname, join as join2, resolve } from "node:path";
12
12
  import { spawnSync } from "node:child_process";
13
13
 
14
+ // ../platform/dist/delivery.js
15
+ var deliveryInstructions = `# Backify application delivery and prompt history
16
+
17
+ Instruction version: 3
18
+ Versioned guide: https://agent.backify.dev/v3/delivery.md
19
+
20
+ These instructions are for AI coding tools building applications on Backify, not the Backify platform implementation. Complete the application and deliver a verified deployment, not just SDK setup. Respect the coding tool's own permissions and confirmation settings; preserve unrelated work and applicable repository instructions.
21
+
22
+ ## Connect and initialize
23
+
24
+ Use the connection command from the copied Backify prompt. The application ID, organization, API address, and single-use pairing code are already supplied there; never invent them. Pairing expires after 15 minutes. Never record the code or setup prompt in project files, Git, prompt history, or logs. The CLI stores an application-scoped session outside the repository. If access expires, obtain a new setup prompt or use CLI browser login.
25
+
26
+ Inspect the workspace before connecting. In an empty project folder, add --clone to the supplied connect command to clone the connected repository without a separate GitHub login. In an existing repository, verify it matches the connected repository and branch; never overwrite unrelated files or force-push. Do not clone into a non-empty folder.
27
+
28
+ Run the initialization command supplied in the prompt. Read the installed AGENTS.md and BACKIFY-WORKFLOW.md before changing application code. Initialization installs this workflow alongside the persistent SDK instructions. Follow https://agent.backify.dev/v3 for instruction version 3; use the guide matching backify.json in an existing application. Do not silently upgrade its managed instruction version or overwrite instructions outside the managed block.
29
+
30
+ Run the following to discover the connected hosting target, repository, branch, reports, releases, and deployment failures:
31
+
32
+ npx @backifydev/cli@0.3.0 status
33
+
34
+ Connection and initialization may proceed without application requirements. Then ask what to build if none were supplied; never invent requirements or record this setup text as a user requirement.
35
+
36
+ ## Record each user request
37
+
38
+ For EVERY user request to build or modify this application, including the initial requirements supplied alongside or after setup, record only the user's own requirement text before changing application code. Submit the text through standard input to:
39
+
40
+ npx @backifydev/cli@0.3.0 prompt record --stdin --id <new-UUID> [--filename <basename> ...]
41
+
42
+ Record requests separately and in order. Generate a new UUID per request and reuse that UUID on retries. Add one --filename argument per attachment, using only its basename. Never send attachment bodies, extracted text, images, full paths, assistant responses, tool output, secrets, connection commands, or this setup/pairing block. Filename arguments are metadata only; never read attachment bodies to submit them. If recording fails, retry or report the blocker; never silently claim a request was recorded.
43
+
44
+ ## Build for the connected hosting target
45
+
46
+ Inspect the framework, lockfile, scripts, configuration, and applicable repository instructions before editing. Preserve the existing framework. Use @backifydev/sdk for platform capabilities, verify API signatures against its installed types and https://docs.backify.dev/capabilities/, and do not directly provision external infrastructure.
47
+
48
+ For Backify Cloud, build a static application with a build script and index.html in its output. For customer Azure, provide a working repository-root Dockerfile whose HTTP server listens on 0.0.0.0:8080. Backify handles deployment to the existing authorized target; neither application code nor the coding tool should provision cloud infrastructure.
49
+
50
+ Do not claim unsupported hosted server functions or SDK execution paths work. Report unsupported runtime requirements instead of substituting another platform. Keep secrets server-side and out of browser code, project files, and Git.
51
+
52
+ ## Verify, push, and publish
53
+
54
+ Run:
55
+
56
+ npx @backifydev/cli@0.3.0 report --check
57
+
58
+ Fix relevant failures, then commit only application changes for this request using a meaningful message. Never commit credentials or unrelated user changes. Then run:
59
+
60
+ npx @backifydev/cli@0.3.0 ship
61
+
62
+ The CLI verifies the repository and branch, runs checks, pushes committed source using a short-lived repository-scoped credential, waits for the exact source's healthy preview, and publishes through existing Backify permissions and policy. It never stages or commits files, force-pushes, changes hosting, fabricates preview testing, or bypasses approval. Use --preview-only only when the user requests a preview.
63
+
64
+ If testing or approval is required, return the preview URL and explain the remaining action. Otherwise return the verified production URL and actual check results only after healthy activation. Inspect failures with the status command, fix them, and retry without asking the user to perform routine deployment steps. Never invent a successful check or deployment.
65
+
66
+ These instructions are an explicit agent workflow, not a universal chat interceptor. Request capture depends on the coding tool following this guide or an integration invoking the recording command.
67
+ `;
68
+
14
69
  // ../platform/dist/index.js
15
- var INSTRUCTION_VERSION = 2;
70
+ var INSTRUCTION_VERSION = 3;
16
71
  var SDK_PACKAGE = "@backifydev/sdk";
17
72
  var DOCS_URL = "https://docs.backify.dev";
18
73
  var capability = (name, imp, description, stateful = false, provisioner = name) => ({ name, import: imp, version: 1, stateful, provisioner, docs: `${DOCS_URL}/capabilities/${name}`, description, destructiveRemovalRequiresApproval: stateful });
@@ -68,6 +123,10 @@ Require explicit confirmation before destructive data operations or removing sta
68
123
  Inspect the framework, lockfile, scripts, configuration, and applicable repository instructions before editing. Preserve the existing framework and unrelated work. Implement the requested application rather than stopping at SDK setup; ask what to build if requirements are missing.
69
124
  Run relevant tests, typechecking, lint, and builds using the repository's scripts when available. Report changes, checks, and remaining blockers accurately; do not claim unverified success.
70
125
 
126
+ ## Connected application delivery
127
+
128
+ For connected applications, follow \`BACKIFY-WORKFLOW.md\` and https://agent.backify.dev/v${INSTRUCTION_VERSION}/delivery.md before changing application code. Record every user build or modification request, including initial requirements, with attachment filenames only; never submit attachment contents or setup credentials. Verify checks and publish through the connected CLI workflow without bypassing testing, approval, or coding-tool permissions. Report only verified deployment URLs.
129
+
71
130
  ## Instruction maintenance
72
131
 
73
132
  The authoritative documentation is ${DOCS_URL}/. The root at https://agent.backify.dev/ always shows the latest guide; use the versioned guide above for this repository's installed instructions.
@@ -123,10 +182,18 @@ var BACKIFY_SCHEMA = { $schema: "https://json-schema.org/draft/2020-12/schema",
123
182
  // src/delivery.ts
124
183
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
125
184
  import { join } from "node:path";
126
- var deliveryInstructions = "# Backify delivery and prompt history\n\nFor EVERY subsequent user request to build or modify this application, record only the user's own request text before changing code through standard input to:\n\n npx @backifydev/cli@0.3.0 prompt record --stdin --id <new-UUID> [--filename <basename> ...]\n\nRecord requests separately and in order. Reuse the UUID on retries. Never include setup instructions, pairing commands, assistant responses, tool output, attachment contents, extracted text, images, full paths, or credentials. Filename arguments are metadata only; never read attachment bodies to submit them. Retry and report recording failures instead of silently dropping prompts.\n\nUse npx @backifydev/cli@0.3.0 status to inspect hosting and repository readiness. Run npx @backifydev/cli@0.3.0 report --check, fix failures, and commit only application changes relevant to this request. Then run npx @backifydev/cli@0.3.0 ship. The CLI verifies the connected repository and branch, runs checks, pushes committed source with short-lived repository-scoped credentials, waits for its healthy preview, and requests policy-governed publication. It never stages or commits files, force-pushes, changes hosting, or fabricates preview testing.\n\nWhen testing or approval is required, return the preview URL and remaining action. Return a production URL only after healthy activation is verified. Respect the coding tool's permissions and preserve unrelated work. Use --preview-only only when the user requests a preview. Report unsupported hosted runtime requirements instead of substituting another platform.\n\nCredentials belong outside the project. Never store pairing codes or session tokens here or in Git. Expired access requires a new setup prompt or browser login. These instructions are an explicit agent workflow, not a universal chat interceptor.\n";
185
+ import { createHash } from "node:crypto";
186
+ var previousGeneratedWorkflowHashes = /* @__PURE__ */ new Set(["6eb280ae7bdb14c390011686c41400f59c023304c3015d8440b7e80aaafa1c11", "545e03a1d5b996ade179e0e60ed5c86accdadc1982c1c25efd094e34f72f47ee"]);
187
+ function validateDeliveryInstructions(root) {
188
+ const path = join(root, "BACKIFY-WORKFLOW.md");
189
+ if (existsSync(path)) {
190
+ const existing = readFileSync(path, "utf8").replace(/\r\n/g, "\n");
191
+ if (existing !== deliveryInstructions && !previousGeneratedWorkflowHashes.has(createHash("sha256").update(existing).digest("hex"))) throw new Error("BACKIFY-WORKFLOW.md contains different instructions. Review it before initializing; it will not be overwritten.");
192
+ }
193
+ }
127
194
  function installDeliveryInstructions(root, instructionFiles2) {
195
+ validateDeliveryInstructions(root);
128
196
  const path = join(root, "BACKIFY-WORKFLOW.md");
129
- if (existsSync(path) && readFileSync(path, "utf8") !== deliveryInstructions) throw new Error("BACKIFY-WORKFLOW.md contains different instructions. Review it before initializing; it will not be overwritten.");
130
197
  writeFileSync(path, deliveryInstructions);
131
198
  for (const relative of instructionFiles2) {
132
199
  const instructionPath = join(root, relative), content = readFileSync(instructionPath, "utf8");
@@ -158,7 +225,9 @@ function synchronize(root = process.cwd()) {
158
225
  const value = JSON.parse(readFileSync2(path, "utf8")), issues = validateConfig(value);
159
226
  if (issues.length) throw new Error(issues.join("; "));
160
227
  if (value.instructionVersion > INSTRUCTION_VERSION) throw new Error("This app uses newer instructions. Install a matching or newer CLI before syncing.");
228
+ validateDeliveryInstructions(root);
161
229
  updateInstructions(root);
230
+ installDeliveryInstructions(root, instructionFiles);
162
231
  value.instructionVersion = INSTRUCTION_VERSION;
163
232
  writeFileSync2(path, JSON.stringify(value, null, 2) + "\n");
164
233
  }
package/package.json CHANGED
@@ -1,10 +1,15 @@
1
1
  {
2
2
  "name": "@backifydev/cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Command-line setup and diagnostics for Backify applications",
5
5
  "type": "module",
6
- "bin": { "backify": "dist/index.js" },
7
- "files": ["dist/index.js", "README.md"],
6
+ "bin": {
7
+ "backify": "dist/index.js"
8
+ },
9
+ "files": [
10
+ "dist/index.js",
11
+ "README.md"
12
+ ],
8
13
  "scripts": {
9
14
  "prebuild": "npm run build --workspace @backify/platform",
10
15
  "build": "esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/index.js",
@@ -14,11 +19,19 @@
14
19
  "pretest": "npm run build --workspace @backify/platform",
15
20
  "test": "vitest run"
16
21
  },
17
- "publishConfig": { "access": "public" },
18
- "repository": { "type": "git", "url": "git+https://github.com/frejnorling/backify.git", "directory": "packages/cli" },
19
- "homepage": "https://agent.backify.dev/",
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/frejnorling/backify.git",
28
+ "directory": "packages/cli"
29
+ },
30
+ "homepage": "https://agent.backify.dev/",
20
31
  "license": "MIT",
21
- "engines": { "node": ">=20" },
32
+ "engines": {
33
+ "node": ">=20"
34
+ },
22
35
  "devDependencies": {
23
36
  "@backify/platform": "*",
24
37
  "@types/node": "^24.3.1",