@haakco/hostingctl 1.0.833 → 1.0.834

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
@@ -293,11 +293,15 @@ that would delete more than `--max-delete-percent` (default 50) of either side s
293
293
  (`too-many-deletes`, exit 1). The folder's `.hostingctl/` keeps which environment folder it is linked to and
294
294
  the sync listings; it is never copied by `pull`, `push` or `sync`, and a folder linked to one environment folder
295
295
  refuses another (`linked-elsewhere`). Like `push`, `sync` leaves `wp-config.php` alone unless
296
- `--with-wp-config`. There is no `--preview` yet: `--dry-run` describes the run and contacts nothing.
296
+ `--with-wp-config`. `--preview` runs bisync's dry run and lists what would be added, updated and deleted, each
297
+ named by the side it changed on (`here:` or `environment:`), and changes nothing; a first run lists only its
298
+ counts. `--dry-run` describes the run and contacts nothing.
297
299
 
298
300
  **Mount.** `files mount env:/path ./empty-folder --environment <uuid> --user <login>` shows the environment
299
301
  folder read-only in an empty local folder until Ctrl-C unmounts it; it writes nothing, so it needs no
300
- `--confirm`. It needs macFUSE or FUSE-T on macOS and FUSE (`/dev/fuse` and `fusermount3`) on Linux; without
302
+ `--confirm`. New remote files appear within 30 seconds. If the environment becomes unreachable, listings already
303
+ read stay visible and reading a file fails until it is back; Ctrl-C still unmounts cleanly.
304
+ It needs macFUSE or FUSE-T on macOS and FUSE (`/dev/fuse` and `fusermount3`) on Linux; without
301
305
  them, and on Windows for now, it refuses with what to install and exits 2 (`mount-unavailable`).
302
306
 
303
307
  **The copy engine.** The first local `files` command fetches the official rclone 1.75.2 release (about
package/dist/main.js CHANGED
@@ -42280,6 +42280,92 @@ async function logout(context, rest) {
42280
42280
  remoteError
42281
42281
  };
42282
42282
  }
42283
+ // src/commands/dev-metadata.ts
42284
+ /** `hostingctl dev`: Plan 43's local copy of one WordPress site, from `files pull` and a Plan 63 database export. */
42285
+ var DEV_USAGE = [
42286
+ "Usage: hostingctl dev prepare <folder> --company <slug> --environment <uuid> --database <uuid> --from <env-path>",
42287
+ " --user <login> [sign-in] (--dry-run | --confirm)",
42288
+ " hostingctl dev start [<folder>]",
42289
+ " hostingctl dev status [<folder>]",
42290
+ " hostingctl dev stop [<folder>]",
42291
+ " hostingctl dev refresh [<folder>] --user <login> [sign-in] (--dry-run | --confirm)",
42292
+ " hostingctl dev delete [<folder>] (--dry-run | --confirm)",
42293
+ " Sign in as for files pull: --key-file <path>, --password-stdin or --password-file <path>; with none, the SSH agent.",
42294
+ "",
42295
+ " prepare Make a new folder with the site's files (files pull of --from, the WordPress folder such as",
42296
+ " /wordpress), a fresh export of its database, a local wp-config.php and a Compose file.",
42297
+ " start Run it with Docker on this computer: the site and Mailpit on 127.0.0.1 only. The first start",
42298
+ " imports the database and replaces the site's address with the local one.",
42299
+ " status Where it came from, when the files and the database were taken, and what is running.",
42300
+ " stop Stop it; files and database stay.",
42301
+ " refresh Prepare a new copy beside it with newer files and a fresh database, then swap it in. The old copy",
42302
+ " is kept as <folder>.previous-<time>; a failed refresh leaves the working copy as it was.",
42303
+ " delete Stop it and remove the folder and its database.",
42304
+ "",
42305
+ "The folder defaults to the current one. The copy is unsanitized: it is your own data, so keep it private.",
42306
+ "Its database is never pushed back. Exit 0 done, 1 refused, 2 not run (also when Docker is missing)."
42307
+ ].join("\n");
42308
+ var DEV_METADATA = {
42309
+ name: "dev",
42310
+ summary: "A local copy of one WordPress site with its database, run with Docker.",
42311
+ usage: DEV_USAGE,
42312
+ flags: [
42313
+ {
42314
+ name: "--environment",
42315
+ takesValue: true,
42316
+ description: "prepare: the environment the site runs in."
42317
+ },
42318
+ {
42319
+ name: "--database",
42320
+ takesValue: true,
42321
+ description: "prepare: the site's database to export."
42322
+ },
42323
+ {
42324
+ name: "--from",
42325
+ takesValue: true,
42326
+ description: "prepare: the site's folder in the environment (env:/path), such as env:/wordpress."
42327
+ },
42328
+ {
42329
+ name: "--user",
42330
+ takesValue: true,
42331
+ description: "The environment's SFTP login the files are pulled with."
42332
+ },
42333
+ {
42334
+ name: "--key-file",
42335
+ takesValue: true,
42336
+ description: "Sign in with the private key in this file."
42337
+ },
42338
+ {
42339
+ name: "--password-stdin",
42340
+ takesValue: false,
42341
+ description: "Read the login's password, or the key's passphrase, from standard input."
42342
+ },
42343
+ {
42344
+ name: "--password-file",
42345
+ takesValue: true,
42346
+ description: "Read the login's password, or the key's passphrase, from a private file (mode 600)."
42347
+ }
42348
+ ],
42349
+ subcommands: [
42350
+ "prepare",
42351
+ "start",
42352
+ "status",
42353
+ "stop",
42354
+ "refresh",
42355
+ "delete"
42356
+ ]
42357
+ };
42358
+ /** The `dev` actions that run Docker on this computer and never reach the API, so they need no session. */
42359
+ var LOCAL_ACTIONS = /* @__PURE__ */ new Set([
42360
+ "start",
42361
+ "stop",
42362
+ "status",
42363
+ "delete"
42364
+ ]);
42365
+ /** Whether `argv` names one of those. */
42366
+ function isLocalDevCommand(argv) {
42367
+ return LOCAL_ACTIONS.has(positional(argv)[0] ?? "");
42368
+ }
42283
42369
  // src/commands/company-scope.ts
42284
42370
  /**
42285
42371
  * Which company a command is about: `--company`, then `HOSTINGCTL_COMPANY`, then the company the stored session's
@@ -60331,7 +60417,8 @@ var hostingProviderListingDataSchema = object({
60331
60417
  entries: array(hostingProviderListingEntryDataSchema),
60332
60418
  siteRoots: array(string()),
60333
60419
  truncated: boolean(),
60334
- database: union([hostingProviderDatabaseFactsDataSchema, _null()])
60420
+ database: union([hostingProviderDatabaseFactsDataSchema, _null()]),
60421
+ rsyncVersion: string().nullable()
60335
60422
  });
60336
60423
  var hostingProviderSiteDatabaseDataSchema = object({
60337
60424
  application: string(),
@@ -60388,6 +60475,7 @@ object({
60388
60475
  publicKey: string().nullable(),
60389
60476
  pinnedHostKey: string().nullable(),
60390
60477
  certificateHost: string().nullable(),
60478
+ sshConnectionUuid: string().nullable(),
60391
60479
  connections: int(),
60392
60480
  speedLimit: string().nullable(),
60393
60481
  requestsPerSecond: int().nullable(),
@@ -62841,6 +62929,7 @@ var storeHostingProviderConnectionRequestSchema = object({
62841
62929
  requestsPerSecond: int().min(1).max(20).nullish(),
62842
62930
  retryWaitSeconds: int().min(1).max(600).nullish(),
62843
62931
  hostImports: int().min(1).max(4).optional(),
62932
+ sshConnectionUuid: uuid().nullish().describe("\"Through SSH\": a database reached by running its client on the old server over this SFTP connection."),
62844
62933
  certificateHost: string().max(253).regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*\.?$/).nullish()
62845
62934
  }).describe("A new provider connection: protocol, address, account, start folder, sign-in and the old-host limits.\n\n`retention` defaults to `saved`; a `single-use` connection (a login entered for one run) carries no name.\nEvery field is checked here before any network call, so the wizard can tie an error to its field. A key\n(supplied or generated) is SFTP-only; a generated key carries no credential because Hosting makes it. The\nlimits are bounded to the same ranges as the table's check constraints.");
62846
62935
  var storeHostingRegistryConnectionRequestSchema = object({
@@ -63323,6 +63412,7 @@ var updateHostingProviderConnectionRequestSchema = object({
63323
63412
  requestsPerSecond: int().min(1).max(20).nullish(),
63324
63413
  retryWaitSeconds: int().min(1).max(600).nullish(),
63325
63414
  hostImports: int().min(1).max(4).optional(),
63415
+ sshConnectionUuid: uuid().nullish().describe("\"Through SSH\": a database reached by running its client on the old server over this SFTP connection."),
63326
63416
  certificateHost: string().max(253).regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*\.?$/).nullish()
63327
63417
  }).describe("A change to a provider connection, submitted as the whole definition again.\n\n`credential` is optional: omitting it keeps the stored secret, sending one replaces it. Changing the sign-in\ntype needs a new credential, except to a generated key, which Hosting makes. Any change to what is connected\nto clears the verified state; the service decides that by comparing with what is stored.");
63328
63418
  var updateHostingRegistryConnectionRequestSchema = object({
@@ -72791,81 +72881,6 @@ function workloadPair(rest) {
72791
72881
  workloadUuid
72792
72882
  };
72793
72883
  }
72794
- // src/commands/dev-metadata.ts
72795
- /** `hostingctl dev`: Plan 43's local copy of one WordPress site, from `files pull` and a Plan 63 database export. */
72796
- var DEV_USAGE = [
72797
- "Usage: hostingctl dev prepare <folder> --company <slug> --environment <uuid> --database <uuid> --from <env-path>",
72798
- " --user <login> [sign-in] (--dry-run | --confirm)",
72799
- " hostingctl dev start [<folder>]",
72800
- " hostingctl dev status [<folder>]",
72801
- " hostingctl dev stop [<folder>]",
72802
- " hostingctl dev refresh [<folder>] --user <login> [sign-in] (--dry-run | --confirm)",
72803
- " hostingctl dev delete [<folder>] (--dry-run | --confirm)",
72804
- " Sign in as for files pull: --key-file <path>, --password-stdin or --password-file <path>; with none, the SSH agent.",
72805
- "",
72806
- " prepare Make a new folder with the site's files (files pull of --from, the WordPress folder such as",
72807
- " /wordpress), a fresh export of its database, a local wp-config.php and a Compose file.",
72808
- " start Run it with Docker on this computer: the site and Mailpit on 127.0.0.1 only. The first start",
72809
- " imports the database and replaces the site's address with the local one.",
72810
- " status Where it came from, when the files and the database were taken, and what is running.",
72811
- " stop Stop it; files and database stay.",
72812
- " refresh Prepare a new copy beside it with newer files and a fresh database, then swap it in. The old copy",
72813
- " is kept as <folder>.previous-<time>; a failed refresh leaves the working copy as it was.",
72814
- " delete Stop it and remove the folder and its database.",
72815
- "",
72816
- "The folder defaults to the current one. The copy is unsanitized: it is your own data, so keep it private.",
72817
- "Its database is never pushed back. Exit 0 done, 1 refused, 2 not run (also when Docker is missing)."
72818
- ].join("\n");
72819
- var DEV_METADATA = {
72820
- name: "dev",
72821
- summary: "A local copy of one WordPress site with its database, run with Docker.",
72822
- usage: DEV_USAGE,
72823
- flags: [
72824
- {
72825
- name: "--environment",
72826
- takesValue: true,
72827
- description: "prepare: the environment the site runs in."
72828
- },
72829
- {
72830
- name: "--database",
72831
- takesValue: true,
72832
- description: "prepare: the site's database to export."
72833
- },
72834
- {
72835
- name: "--from",
72836
- takesValue: true,
72837
- description: "prepare: the site's folder in the environment (env:/path), such as env:/wordpress."
72838
- },
72839
- {
72840
- name: "--user",
72841
- takesValue: true,
72842
- description: "The environment's SFTP login the files are pulled with."
72843
- },
72844
- {
72845
- name: "--key-file",
72846
- takesValue: true,
72847
- description: "Sign in with the private key in this file."
72848
- },
72849
- {
72850
- name: "--password-stdin",
72851
- takesValue: false,
72852
- description: "Read the login's password, or the key's passphrase, from standard input."
72853
- },
72854
- {
72855
- name: "--password-file",
72856
- takesValue: true,
72857
- description: "Read the login's password, or the key's passphrase, from a private file (mode 600)."
72858
- }
72859
- ],
72860
- subcommands: [
72861
- "prepare",
72862
- "start",
72863
- "status",
72864
- "stop",
72865
- "refresh",
72866
- "delete"
72867
- ]
72868
- };
72869
72884
  // src/commands/dev-database.ts
72870
72885
  /** How often, and for how long, `dev prepare` waits for the export it asked for. */
72871
72886
  var EXPORT_POLL_MS = 5e3;
@@ -72949,7 +72964,7 @@ var FILES_LOCAL_USAGE = [
72949
72964
  " hostingctl files push <local-folder> <env-path> --environment <uuid> --user <login>",
72950
72965
  " [--delete [--max-delete <n>]] [--with-wp-config] (--preview | --dry-run | --confirm)",
72951
72966
  " hostingctl files sync <env-path> <local-folder> --two-way --environment <uuid> --user <login>",
72952
- " [--max-delete-percent <n>] [--resync] [--with-wp-config] (--dry-run | --confirm)",
72967
+ " [--max-delete-percent <n>] [--resync] [--with-wp-config] (--preview | --dry-run | --confirm)",
72953
72968
  " hostingctl files mount <env-path> <mountpoint> --environment <uuid> --user <login>",
72954
72969
  " hostingctl files connect --environment <uuid> --user <login> [--key-file <path>]",
72955
72970
  " Sign in with --key-file <path> (its passphrase, if any, from --password-stdin or --password-file),",
@@ -72976,7 +72991,8 @@ var FILES_LOCAL_USAGE = [
72976
72991
  " never prints a password.",
72977
72992
  "",
72978
72993
  "Environment paths start at the login's home (/srv, where the application trees are); / is that folder.",
72979
- "--preview lists what a pull or push would add, update and delete and changes nothing; --dry-run says what",
72994
+ "--preview lists what a pull, push or sync would add, update and delete and changes nothing (a sync names the",
72995
+ "side each change was made on); --dry-run says what",
72980
72996
  "the command would do and contacts nothing; --confirm does it. A deleting pull or push previews first and",
72981
72997
  "refuses more than --max-delete deletions (default 100). Any failed transfer cancels the deletions.",
72982
72998
  "pull, push and sync leave out .git, wp-content/cache and .hostingctl; push and sync leave wp-config.php alone",
@@ -73009,7 +73025,7 @@ var FILES_LOCAL_FLAGS = [
73009
73025
  {
73010
73026
  name: "--preview",
73011
73027
  takesValue: false,
73012
- description: "pull/push: list what would be added, updated and deleted, and change nothing."
73028
+ description: "pull/push/sync: list what would be added, updated and deleted, and change nothing."
73013
73029
  },
73014
73030
  {
73015
73031
  name: "--with-wp-config",
@@ -73140,9 +73156,9 @@ function mountArguments(remote, mountpoint) {
73140
73156
  "30s"
73141
73157
  ];
73142
73158
  }
73143
- /** Whether an argument list only looks: a dry run prints no progress. */
73144
- function isDryRun(args) {
73145
- return args.includes("--dry-run");
73159
+ /** Whether a run prints no progress: a dry run only looks, and a mount's stats are not a transfer. */
73160
+ function isQuiet(args) {
73161
+ return args.includes("--dry-run") || args[0] === "mount";
73146
73162
  }
73147
73163
  function filters(rules) {
73148
73164
  return rules.flatMap((rule) => ["--filter", rule]);
@@ -73473,6 +73489,8 @@ var COMMON_ARGUMENTS = [
73473
73489
  "--timeout",
73474
73490
  "60s"
73475
73491
  ];
73492
+ /** At most this many bisync notices are kept. */
73493
+ var NOTICE_LIMIT = 1e4;
73476
73494
  /** At most this many failed names are kept. */
73477
73495
  var FAILED_LIMIT = 100;
73478
73496
  /** How long rclone gets to stop on its own after Ctrl-C before it is killed. */
@@ -73508,7 +73526,8 @@ async function runEngine(program, args, env, options = {}) {
73508
73526
  stdout: "",
73509
73527
  stats: null,
73510
73528
  failed: [],
73511
- lastError: null
73529
+ lastError: null,
73530
+ notices: []
73512
73531
  };
73513
73532
  const windows = process.platform === "win32";
73514
73533
  const child = spawn(program, [...COMMON_ARGUMENTS, ...args], {
@@ -73560,21 +73579,22 @@ function readLog(lines) {
73560
73579
  let stats = null;
73561
73580
  const failed = /* @__PURE__ */ new Set();
73562
73581
  let lastError = null;
73582
+ const notices = [];
73563
73583
  for (const line of lines) {
73564
73584
  stats = statsOf(line) ?? stats;
73565
73585
  const entry = parsed$1(line);
73586
+ const notice = bisyncNotice(entry);
73587
+ if (notice !== null && notices.length < NOTICE_LIMIT) notices.push(notice);
73566
73588
  if (entry === null || entry.level !== "error" && entry.level !== "critical") continue;
73567
73589
  if (typeof entry.msg === "string") lastError = entry.msg.slice(0, 500);
73568
- const object = entry.object;
73569
- const type = entry.objectType;
73570
- if (typeof object === "string" && object !== "" && typeof type === "string" && type.endsWith(".Object")) {
73571
- if (failed.size < FAILED_LIMIT) failed.add(object);
73572
- }
73590
+ const object = failedObject(entry);
73591
+ if (object !== null && failed.size < FAILED_LIMIT) failed.add(object);
73573
73592
  }
73574
73593
  return {
73575
73594
  stats,
73576
73595
  failed: [...failed],
73577
- lastError
73596
+ lastError,
73597
+ notices
73578
73598
  };
73579
73599
  }
73580
73600
  /** The outcome a run's status, stats and last error amount to. */
@@ -73596,6 +73616,17 @@ async function obscure(program, password, env) {
73596
73616
  if (run.status !== 0 || value === "") throw new Error("The copy engine could not prepare the password.");
73597
73617
  return value;
73598
73618
  }
73619
+ /** The object an error names, when it names one. */
73620
+ function failedObject(entry) {
73621
+ const object = entry.object;
73622
+ const type = entry.objectType;
73623
+ return typeof object === "string" && object !== "" && typeof type === "string" && type.endsWith(".Object") ? object : null;
73624
+ }
73625
+ /** A bisync per-file notice (`- Path1 …`), or null for every other log line. */
73626
+ function bisyncNotice(entry) {
73627
+ const said = entry?.msg;
73628
+ return entry?.level === "notice" && typeof said === "string" && said.startsWith("- Path") ? said : null;
73629
+ }
73599
73630
  function parsed$1(line) {
73600
73631
  const trimmed = line.trim();
73601
73632
  if (!trimmed.startsWith("{")) return null;
@@ -73731,7 +73762,7 @@ async function openSession(context, command) {
73731
73762
  return {
73732
73763
  program,
73733
73764
  env,
73734
- run: async (args) => await runEngine(program, args, env, { onStats: watched && !isDryRun(args) ? progressLines() : void 0 })
73765
+ run: async (args) => await runEngine(program, args, env, { onStats: watched && !isQuiet(args) ? progressLines() : void 0 })
73735
73766
  };
73736
73767
  }
73737
73768
  /** One progress line on stderr per stats line, with the predicted finish, for a person watching a long transfer. */
@@ -82186,6 +82217,30 @@ function isFolder$1(path) {
82186
82217
  return false;
82187
82218
  }
82188
82219
  }
82220
+ // src/commands/files-local-two-way-preview.ts
82221
+ /**
82222
+ * What a two-way sync would do, from `bisync --dry-run`'s per-file notices. Path1 is this computer and Path2 the
82223
+ * environment; each name says on which side it changed, and the change goes to the other side. Mirrors
82224
+ * `crates/hostingctl/src/commands/files_local/two_way_preview.rs`.
82225
+ */
82226
+ function bisyncPreview(notices) {
82227
+ const shown = {
82228
+ adds: [],
82229
+ updates: [],
82230
+ deletes: [],
82231
+ kept: []
82232
+ };
82233
+ for (const notice of notices) {
82234
+ const found = /^- (Path1|Path2)\s+(File is new|File changed|File was deleted)[^-]*- (.+)$/.exec(notice);
82235
+ if (found === null) continue;
82236
+ const [, side, change, name] = found;
82237
+ const entry = `${side === "Path1" ? "here" : "environment"}: ${name?.trim() ?? ""}`;
82238
+ if (change === "File is new") shown.adds.push(entry);
82239
+ else if (change === "File changed") shown.updates.push(entry);
82240
+ else shown.deletes.push(entry);
82241
+ }
82242
+ return shown;
82243
+ }
82189
82244
  // src/commands/files-local-two-way.ts
82190
82245
  /**
82191
82246
  * `files sync <env-path> <local-folder> --two-way`: rclone bisync between a folder on this computer and one in the
@@ -82195,13 +82250,7 @@ function isFolder$1(path) {
82195
82250
  /** The linked folder's own state: never synced, pulled or pushed. */
82196
82251
  var STATE_FOLDER = ".hostingctl";
82197
82252
  async function twoWayCommand(context, rest) {
82198
- if (!context.flags.has("--two-way")) throw new UsageError("files sync changes both sides, so it needs --two-way. To copy one way, use files pull or files push.");
82199
- const [remoteRaw, localRaw, extra] = rest;
82200
- if (remoteRaw === void 0 || localRaw === void 0 || extra !== void 0) throw new UsageError(FILES_LOCAL_USAGE);
82201
- if (localRaw.startsWith(`env:`)) throw new UsageError("Name the environment folder first, then the folder on this computer: hostingctl files sync env:/path ./folder --two-way");
82202
- const remote = environmentPath(remoteRaw);
82203
- const local = resolve(localRaw);
82204
- if (!isFolder(local)) throw new UsageError(`${local} is not a folder on this computer.`);
82253
+ const { remote, local } = folders(context, rest);
82205
82254
  const percent = maxDeletePercent(context);
82206
82255
  const link = {
82207
82256
  environment: requiredFlag$4(context, "--environment", FILES_LOCAL_USAGE),
@@ -82212,11 +82261,38 @@ async function twoWayCommand(context, rest) {
82212
82261
  const rules = context.flags.has("--with-wp-config") ? DEFAULT_FILTERS : [...DEFAULT_FILTERS, PUSH_PROTECTED];
82213
82262
  const workdir = join(local, STATE_FOLDER, "sync");
82214
82263
  const resync = context.flags.has("--resync") || linked === null || !hasListings(workdir);
82215
- return await engineWrite(context, "sync", `Sync ${local} and ${shownPath(remote)} both ways: ${resync ? "copy each side's missing and newer files to the other, deleting nothing" : "copy the changes and deletions made on either side since the last sync"}. A file changed on both sides keeps both copies. Refuses to delete more than ${String(percent)}% of either side. Left out: ${leftOut(rules)}.`, async (session) => {
82264
+ const description = `Sync ${local} and ${shownPath(remote)} both ways: ${resync ? "copy each side's missing and newer files to the other, deleting nothing" : "copy the changes and deletions made on either side since the last sync"}. A file changed on both sides keeps both copies. Refuses to delete more than ${String(percent)}% of either side. Left out: ${leftOut(rules)}.`;
82265
+ const args = twoWayArguments(local, remoteSpec(remote), workdir, rules, percent, resync);
82266
+ if (context.flags.has("--preview")) {
82267
+ loginFlags(context);
82268
+ const session = await openSession(context, "sync");
82269
+ if ("kind" in session) return session;
82270
+ const run = await session.run([...args, "--dry-run"]);
82271
+ const counts = resync ? run.stats : null;
82272
+ return {
82273
+ ...twoWayResult(run, local),
82274
+ preview: bisyncPreview(run.notices),
82275
+ transferred: counts
82276
+ };
82277
+ }
82278
+ return await engineWrite(context, "sync", description, async (session) => {
82216
82279
  writeLink(local, link);
82217
- return twoWayResult(await session.run(twoWayArguments(local, remoteSpec(remote), workdir, rules, percent, resync)), local);
82280
+ return twoWayResult(await session.run(args), local);
82218
82281
  });
82219
82282
  }
82283
+ /** The environment folder and the local folder a sync names, refused before anything is read. */
82284
+ function folders(context, rest) {
82285
+ if (!context.flags.has("--two-way")) throw new UsageError("files sync changes both sides, so it needs --two-way. To copy one way, use files pull or files push.");
82286
+ const [remoteRaw, localRaw, extra] = rest;
82287
+ if (remoteRaw === void 0 || localRaw === void 0 || extra !== void 0) throw new UsageError(FILES_LOCAL_USAGE);
82288
+ if (localRaw.startsWith(`env:`)) throw new UsageError("Name the environment folder first, then the folder on this computer: hostingctl files sync env:/path ./folder --two-way");
82289
+ const local = resolve(localRaw);
82290
+ if (!isFolder(local)) throw new UsageError(`${local} is not a folder on this computer.`);
82291
+ return {
82292
+ remote: environmentPath(remoteRaw),
82293
+ local
82294
+ };
82295
+ }
82220
82296
  /** One bisync run as the report: its refusals named, and every conflict copy now in the folder listed. */
82221
82297
  function twoWayResult(run, local) {
82222
82298
  const result = {
@@ -86117,6 +86193,7 @@ function describeConnection$2(one) {
86117
86193
  const speed = one.speedLimit ?? "off";
86118
86194
  const requests = one.requestsPerSecond === null ? "off" : String(one.requestsPerSecond);
86119
86195
  const lines = [connectionLine(one), ` start folder ${one.startPath}; limits: ${String(one.connections)} at once, speed ${speed}, requests a second ${requests}, ${String(one.hostImports)} import(s) at once`];
86196
+ if (one.sshConnectionUuid) lines.push(` through SSH connection ${one.sshConnectionUuid}`);
86120
86197
  if (one.lastFailureReason !== null) lines.push(` last check failed: ${one.lastFailureReason}`);
86121
86198
  if (one.publicKey !== null) lines.push(" Add this public key on the old host:", ` ${one.publicKey}`);
86122
86199
  if (one.status !== "verified" && one.status !== "revoked") lines.push(` Check it: \`hostingctl provider-connections check ${one.uuid} --environment <uuid> --wait --confirm\``);
@@ -86142,7 +86219,7 @@ function describeCheck$1(check) {
86142
86219
  /** The database a site's configuration names, without its password (`--json` carries it). */
86143
86220
  function siteDatabaseLines(site) {
86144
86221
  const prefix = site.tablePrefix === null ? "" : `, table prefix ${site.tablePrefix}`;
86145
- const route = site.sshNeeded ? "It listens only on the old server, so it can be reached only through the site's SSH login, not directly." : "Add it as a database connection with these details; the password is in --json.";
86222
+ const route = site.sshNeeded ? "It listens only on the old server, so add it through SSH: a database connection with sshConnectionUuid set to the site's SFTP connection." : "Add it as a database connection with these details; the password is in --json.";
86146
86223
  return [`Site database (${site.application}, ${site.configFile}): ${site.kind} ${site.username}@${site.host}:${String(site.port)}/${site.name}${prefix}; password ${site.password === null ? "not found" : "found"}.`, route];
86147
86224
  }
86148
86225
  /** A provider answer as a person reads it. */
@@ -86203,6 +86280,7 @@ var USAGE$4 = [
86203
86280
  "check --wait follows the check to its end, prints each stage as pass or FAIL, and exits 1 when it failed.",
86204
86281
  "check --site-folder also reads that folder's wp-config.php, .env or config.php and reports the site's database.",
86205
86282
  "Every write needs --confirm (check too); --dry-run sends nothing. Credentials occur only in private request files.",
86283
+ "A database reached through SSH names its SFTP connection as sshConnectionUuid in the request file.",
86206
86284
  "Omit --file on rotate only for a generated-key connection. Only its public key is returned.",
86207
86285
  "limits: [--preset normal|gentle|very-gentle] [--connections <1-8>] [--speed-limit <rate>]",
86208
86286
  " [--requests-per-second <1-20>] [--host-imports <1-4>] [--retry-wait <30s>]",
@@ -86369,6 +86447,7 @@ function currentDefinition(current) {
86369
86447
  name: current.name,
86370
86448
  retention: current.retention,
86371
86449
  certificateHost: current.certificateHost,
86450
+ sshConnectionUuid: current.sshConnectionUuid,
86372
86451
  connections: current.connections,
86373
86452
  hostImports: current.hostImports,
86374
86453
  requestsPerSecond: current.requestsPerSecond,
@@ -91722,7 +91801,7 @@ function writeUpdateState(state, env = process.env) {
91722
91801
  } catch {}
91723
91802
  }
91724
91803
  // src/version.ts
91725
- var VERSION = "1.0.833";
91804
+ var VERSION = "1.0.834";
91726
91805
  // src/commands/update.ts
91727
91806
  /**
91728
91807
  * `update` — bring this copy of the CLI up to the published version.
@@ -91796,7 +91875,7 @@ var update = {
91796
91875
  }, process.env);
91797
91876
  return {
91798
91877
  ...known,
91799
- current: after ?? "1.0.833",
91878
+ current: after ?? "1.0.834",
91800
91879
  latest: after ?? latest,
91801
91880
  upToDate: after !== null && (latest === null || !isNewerVersion(latest, after)),
91802
91881
  action: "run",
@@ -92082,7 +92161,7 @@ async function printUpdateNotice(options) {
92082
92161
  }, env, { waitMs: NOTICE_LOCK_WAIT_MS });
92083
92162
  } catch {}
92084
92163
  if (latest === null) return;
92085
- if (!isNewerVersion(latest, "1.0.833")) return;
92164
+ if (!isNewerVersion(latest, "1.0.834")) return;
92086
92165
  process.stderr.write(`A newer hostingctl is published: ${latest} (this copy is ${VERSION}). Run \`hostingctl update\` to update.\n`);
92087
92166
  }
92088
92167
  /** Whether an environment variable is set to something, which is how CI and the opt-out are read. */
@@ -92110,10 +92189,14 @@ async function main(argv) {
92110
92189
  if (command.name === login.name) return await dispatch(command, argv);
92111
92190
  if (command.name === auth.name && isSessionlessAuthCommand(argv)) return isPublicAuthCommand(argv) ? await dispatchPublic(argv, command) : await dispatch(command, argv);
92112
92191
  if (command.name === mailbox$1.name && isSessionlessMailboxCommand(argv)) return await dispatchPublic(argv, command);
92113
- if (commandsWithoutApi.has(command.name)) return await dispatch(command, argv);
92192
+ if (runsWithoutApi(command.name, argv)) return await dispatch(command, argv);
92114
92193
  await configureTarget(argv);
92115
92194
  return await dispatch(command, argv);
92116
92195
  }
92196
+ /** The machine-only commands, and the `dev` lifecycle actions that run Docker here and never reach the API. */
92197
+ function runsWithoutApi(name, argv) {
92198
+ return commandsWithoutApi.has(name) || name === DEV_METADATA.name && isLocalDevCommand(argv);
92199
+ }
92117
92200
  /**
92118
92201
  * Run one command, and tell the client afterwards when a newer version is published.
92119
92202
  *