@backifydev/cli 0.3.15 → 0.3.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -317,7 +317,7 @@ You can start from an empty folder without a Git repository. `init` creates a mi
317
317
 
318
318
  See the [agent setup guide](https://agent.backify.dev/).
319
319
 
320
- Copy the application AI prompt in Backify to receive the application ID, organization ID, and an application-scoped, single-use pairing code; the agent guide supplies the connection and initialization commands. Codes expire after 15 minutes; redeemed sessions expire after seven days. Add `--clone` even when the current folder contains AI coding-tool scaffolding. Empty directories of any name are allowed. Hidden tool-metadata directories and files, Markdown instruction files, and default `work/` and `outputs/` directories may contain tool settings or artifacts. The CLI clones into a temporary directory, validates collisions, then merges without deleting or overwriting existing tool files. Existing Git metadata, root application source, and symlinked tool directories are rejected; file conflicts stop before repository files are installed. Credentials are stored in the user's home configuration, not the project. The default API is `https://api.backify.dev/api`; local development can override it with `BACKIFY_API_URL` or the connection command's `--api` option. HTTPS is required outside loopback.
320
+ Copy the application AI prompt in Backify to receive the application ID, organization ID, and an application-scoped, single-use pairing code; the agent guide supplies the connection and initialization commands. Codes expire after 15 minutes; redeemed sessions expire after seven days. Add `--clone` even when the current folder contains AI coding-tool scaffolding. Empty directories of any name are allowed. Hidden tool-metadata directories and files, Markdown instruction files, and default `work/` and `outputs/` directories may contain tool settings or artifacts. The CLI clones into a temporary directory, validates collisions, then merges without deleting or overwriting existing tool files. Existing Git metadata, root application source, and symlinked tool directories are rejected; file conflicts stop before repository files are installed. Credentials are stored in the user's home configuration, not the project. Running the setup prompt authorizes the CLI to save this application-scoped session with restricted filesystem permissions; no separate confirmation is needed solely for local credential storage. Prefer `connect --pair-stdin` and send the single-use code through the terminal tool's private stdin channel. Never embed it in shell commands, logs, environment variables, or temporary files. If private stdin is unavailable, omit pairing and use browser login. The legacy `--pair <code>` option remains compatible but exposes the code in process arguments. Actual sandbox restrictions still apply. The default API is `https://api.backify.dev/api`; local development can override it with `BACKIFY_API_URL` or the connection command's `--api` option. HTTPS is required outside loopback.
321
321
 
322
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
323
 
package/dist/index.js CHANGED
@@ -35412,12 +35412,12 @@ function manifestDiagnostics(manifest, used, authentication) {
35412
35412
  // ../platform/dist/delivery.js
35413
35413
  var deliveryInstructions = `# Backify application delivery and prompt history
35414
35414
 
35415
- Instruction version: 10
35416
- Versioned guide: https://agent.backify.dev/v10/delivery.md
35415
+ Instruction version: 11
35416
+ Versioned guide: https://agent.backify.dev/v11/delivery.md
35417
35417
 
35418
35418
  ## Environment and documentation prerequisites
35419
35419
 
35420
- Before installation or connection, read https://agent.backify.dev/v10 for execution capability checks, required endpoints (including https://docs.backify.dev), native permission requests, verified retries and fallback guidance. Follow the current tool's supported approval mechanism; never bypass restrictions. Read relevant capability documentation before implementation. Local validation must not depend on cloud deployment.
35420
+ Before installation or connection, read https://agent.backify.dev/v11 for execution capability checks, required endpoints (including https://docs.backify.dev), native permission requests, verified retries and fallback guidance. Follow the current tool's supported approval mechanism; never bypass restrictions. Read relevant capability documentation before implementation. Local validation must not depend on cloud deployment.
35421
35421
 
35422
35422
  Before application implementation, all required setup checks and connected status must be verified OK. If any required check fails or remains unverified after supported recovery, stop setup and implementation; do not build a local website, minimal shell, placeholder, dependency-free fallback, or downloadable application archive. Report the blockers and recommend running the setup prompt in an AI coding tool such as Codex, Claude Code, or VS Code with GitHub Copilot agent mode, with terminal access, a persistent writable workspace, package installation, outbound HTTPS/DNS, and test execution enabled. Tool names alone do not guarantee readiness. Do not ask the application requirements question while setup is blocked. Later preview approval or deployment failures do not invalidate an already verified setup gate.
35423
35423
 
@@ -35427,9 +35427,9 @@ These instructions are for AI coding tools building applications on Backify, not
35427
35427
 
35428
35428
  The copied Backify prompt supplies App Id, Organization, and, when available, Pair, plus this guide reference and a privacy warning. Substitute those values for <app-id>, <organization-id>, and <pairing-code> below; never invent them. Use npx @backifydev/cli@latest so tool-specific setup and metadata-preserving cloning are available. The public API URL is https://api.backify.dev/api. For a nonproduction environment, replace the --api value with an explicitly trusted endpoint, or omit --api when using a trusted BACKIFY_API_URL override; never send a pairing code to an unverified endpoint.
35429
35429
 
35430
- npx @backifydev/cli@latest connect --app <app-id> --organization <organization-id> --api https://api.backify.dev/api --pair <pairing-code>
35430
+ npx @backifydev/cli@latest connect --app <app-id> --organization <organization-id> --api https://api.backify.dev/api --pair-stdin
35431
35431
 
35432
- If Pair is absent, omit --pair and use CLI browser login. Pairing expires after 15 minutes. Never record the code in project files, Git, prompt history, or logs. Record the user-supplied setup request in prompt history only after redacting credentials; do not drop the request. The CLI stores an application-scoped session outside the repository. If CLI access expires, use the browser reauthentication workflow below, never another setup prompt. A fresh pairing code is needed only if initial pairing expired or was consumed.
35432
+ If Pair is absent, omit --pair-stdin and use CLI browser login. Pairing expires after 15 minutes. Never record the code in project files, Git, prompt history, or logs. Record the user-supplied setup request in prompt history only after redacting credentials; do not drop the request. Running the user-supplied setup prompt authorizes CLI connection and storage of its application-scoped session in ~/.backify.json outside the repository, with owner-only filesystem access. This is expected setup behavior; do not ask for separate confirmation solely because the CLI saves this credential. Keep pairing codes and session tokens out of project files, Git, logs, shell command text and process arguments. Use the terminal tool's stdin/input channel for Pair with --pair-stdin (CLI 0.3.16 or later); do not use echo, shell interpolation, environment variables, or temporary files to carry the code. If the tool cannot supply private stdin, use browser login instead. Respect actual sandbox restrictions and use the supported native approval mechanism when access is required; this authorization does not override a denial. If CLI access expires, use the browser reauthentication workflow below, never another setup prompt. A fresh pairing code is needed only if initial pairing expired or was consumed.
35433
35433
 
35434
35434
  Before connecting, inspect the current folder. If it is not a Git repository, is missing its .git directory or file, or has no Git remote, add --clone to the connect command. Default AI coding-tool directories and instruction files do not make a workspace an existing application. Run connect --clone in the current folder even when tool scaffolding exists, including configuration, rules, agents, skills, commands, prompts, and work/output directories. This is tool-independent: preserve the current tool's metadata and instructions regardless of its name; never delete or overwrite them to make the folder empty. The CLI recognizes empty directories of any name, hidden tool-metadata directories and files, Markdown instruction files, and default work/outputs directories, including their contents. It clones into a temporary folder, checks for file conflicts, and safely merges the repository into the current workspace. If actual application source or an existing .git is present, or repository files conflict with existing entries, stop and reconcile the workspace or use a new folder; never overwrite user work. In an existing repository with a remote, verify it matches the connected repository and branch; never overwrite unrelated files or force-push.
35435
35435
 
@@ -35437,7 +35437,7 @@ Initialize using App Id from the copied prompt and the current tool selection:
35437
35437
 
35438
35438
  npx @backifydev/cli@latest init --app <app-id> --agent <current-tool>
35439
35439
 
35440
- For a tool without a built-in preset, replace --agent <current-tool> with --instruction-file <relative-path>. Read BACKIFY.md and the instruction file used by the current AI coding tool before changing application code. Create or update only instruction files used by that tool; never create files for other coding tools. Use --agent for a built-in tool preset or --instruction-file <relative-path> for the current tool's native instruction file, as described in the setup guide. Initialization installs this workflow alongside the persistent SDK instructions. Follow https://agent.backify.dev/v10 for instruction version 10; 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.
35440
+ For a tool without a built-in preset, replace --agent <current-tool> with --instruction-file <relative-path>. Read BACKIFY.md and the instruction file used by the current AI coding tool before changing application code. Create or update only instruction files used by that tool; never create files for other coding tools. Use --agent for a built-in tool preset or --instruction-file <relative-path> for the current tool's native instruction file, as described in the setup guide. Initialization installs this workflow alongside the persistent SDK instructions. Follow https://agent.backify.dev/v11 for instruction version 11; 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.
35441
35441
 
35442
35442
  Run the following to discover the connected hosting target, repository, branch, reports, releases, and deployment failures:
35443
35443
 
@@ -35519,7 +35519,7 @@ These instructions are an explicit agent workflow, not a universal chat intercep
35519
35519
  `;
35520
35520
 
35521
35521
  // ../platform/dist/index.js
35522
- var INSTRUCTION_VERSION = 10;
35522
+ var INSTRUCTION_VERSION = 11;
35523
35523
  var SDK_PACKAGE = "@backifydev/sdk";
35524
35524
  var DOCS_URL = "https://docs.backify.dev";
35525
35525
  var MAIL_LIMITS = Object.freeze({
@@ -35813,13 +35813,39 @@ function integrationDiscoveryPath(command3, options) {
35813
35813
  throw new Error("Use backify integrations list|catalog|search|describe|contract|types");
35814
35814
  }
35815
35815
 
35816
+ // src/pairing.ts
35817
+ async function pairingCode(args2, input) {
35818
+ const stdinCount = args2.filter((value) => value === "--pair-stdin").length;
35819
+ const pairCount = args2.filter((value) => value === "--pair").length;
35820
+ if (stdinCount > 1 || pairCount > 1 || stdinCount && pairCount)
35821
+ throw new Error("Use exactly one of --pair-stdin or --pair <code>.");
35822
+ if (!stdinCount && !pairCount) return void 0;
35823
+ let code;
35824
+ if (stdinCount) {
35825
+ if (input.isTTY) throw new Error("Send the pairing code through stdin using --pair-stdin.");
35826
+ const chunks = [];
35827
+ let size = 0;
35828
+ for await (const chunk of input) {
35829
+ const bytes = Buffer.from(chunk);
35830
+ size += bytes.length;
35831
+ if (size > 256) throw new Error("Invalid pairing input; expected one 64-character hexadecimal code.");
35832
+ chunks.push(bytes);
35833
+ }
35834
+ code = Buffer.concat(chunks).toString("utf8").trim();
35835
+ } else {
35836
+ code = args2[args2.indexOf("--pair") + 1] ?? "";
35837
+ }
35838
+ if (!/^[0-9a-f]{64}$/i.test(code)) throw new Error("Invalid pairing input; expected one 64-character hexadecimal code.");
35839
+ return code;
35840
+ }
35841
+
35816
35842
  // src/cli-session.ts
35817
35843
  import { hostname, platform, release, arch } from "node:os";
35818
35844
 
35819
35845
  // package.json
35820
35846
  var package_default = {
35821
35847
  name: "@backifydev/cli",
35822
- version: "0.3.15",
35848
+ version: "0.3.16",
35823
35849
  description: "Command-line setup and diagnostics for Backify applications",
35824
35850
  type: "module",
35825
35851
  bin: {
@@ -41838,7 +41864,7 @@ async function main() {
41838
41864
  break;
41839
41865
  case "connect": {
41840
41866
  const appId = option("--app") ?? projectApplication(), key = "app_" + applicationGuid(appId).replaceAll("-", "");
41841
- const code = option("--pair"), organizationId = option("--organization") ?? userConfig.sessions?.[key]?.organizationId ?? userConfig.organizationId;
41867
+ const code = await pairingCode(args, process.stdin), organizationId = option("--organization") ?? userConfig.sessions?.[key]?.organizationId ?? userConfig.organizationId;
41842
41868
  const address = apiAddress(option("--api") ?? process.env.BACKIFY_API_URL ?? userConfig.apiUrl ?? "https://api.backify.dev/api");
41843
41869
  if (code) {
41844
41870
  if (!organizationId) throw new Error("The setup prompt must supply the organization.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backifydev/cli",
3
- "version": "0.3.15",
3
+ "version": "0.3.16",
4
4
  "description": "Command-line setup and diagnostics for Backify applications",
5
5
  "type": "module",
6
6
  "bin": {