@pollinations/cli 0.1.52 → 0.1.53

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/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var init_package = __esm({
14
14
  "package.json"() {
15
15
  package_default = {
16
16
  name: "@pollinations/cli",
17
- version: "0.1.52",
17
+ version: "0.1.53",
18
18
  description: "The Pollinations CLI \u2014 for humans, AI agents, and everything in between",
19
19
  type: "module",
20
20
  bin: {
@@ -2087,7 +2087,8 @@ var resolveHarnessKey = async (harness, options) => {
2087
2087
 
2088
2088
  // src/harnesses/snapshot.ts
2089
2089
  import { createHash } from "crypto";
2090
- import { join as join3 } from "path";
2090
+ import { lstatSync, readlinkSync, renameSync as renameSync2, symlinkSync } from "fs";
2091
+ import { basename as basename5, dirname as dirname9, join as join3 } from "path";
2091
2092
  var sha256 = (content) => createHash("sha256").update(content).digest("hex");
2092
2093
  var snapshotPath = (ctx, id, paths) => {
2093
2094
  const key = sha256(paths.join("\n")).slice(0, 12);
@@ -2102,12 +2103,25 @@ var writeSnapshot = (ctx, id, paths, snapshot) => writeTextAtomic(
2102
2103
  var captureFiles = (paths) => Object.fromEntries(
2103
2104
  paths.map((path) => [
2104
2105
  path,
2105
- { before: readTextIfExists(path), afterHash: null }
2106
+ {
2107
+ before: readTextIfExists(path),
2108
+ symlink: lstatSync(path, {
2109
+ throwIfNoEntry: false
2110
+ })?.isSymbolicLink() ? readlinkSync(path) : void 0,
2111
+ afterHash: null
2112
+ }
2106
2113
  ])
2107
2114
  );
2108
2115
  var restoreFiles = (files9) => {
2109
2116
  for (const [path, file] of Object.entries(files9)) {
2110
- if (file.before === null) removeIfExists(path);
2117
+ if (file.symlink !== void 0) {
2118
+ const tmp = join3(
2119
+ dirname9(path),
2120
+ `.${basename5(path)}.${process.pid}.tmp`
2121
+ );
2122
+ symlinkSync(file.symlink, tmp, "file");
2123
+ renameSync2(tmp, path);
2124
+ } else if (file.before === null) removeIfExists(path);
2111
2125
  else writeTextAtomic(path, file.before);
2112
2126
  }
2113
2127
  };
@@ -6203,7 +6217,7 @@ var sandboxCommand = new Command22("sandbox").description("E2B sandboxes billed
6203
6217
  init_output();
6204
6218
  import { execSync, spawnSync as spawnSync5 } from "child_process";
6205
6219
  import { existsSync as existsSync4, readFileSync as readFileSync8 } from "fs";
6206
- import { dirname as dirname9, join as join16, resolve as resolve3, sep } from "path";
6220
+ import { dirname as dirname10, join as join16, resolve as resolve3, sep } from "path";
6207
6221
  import { fileURLToPath } from "url";
6208
6222
  import { Command as Command23 } from "commander";
6209
6223
  var PACKAGE_NAME = "@pollinations/cli";
@@ -6211,13 +6225,13 @@ var REGISTRY_URL = "https://registry.npmjs.org/@pollinations%2Fcli/latest";
6211
6225
  function findPackageRoot(fromDir) {
6212
6226
  let dir = resolve3(fromDir);
6213
6227
  while (!existsSync4(join16(dir, "package.json"))) {
6214
- const parent = dirname9(dir);
6228
+ const parent = dirname10(dir);
6215
6229
  if (parent === dir) throw new Error("could not locate package.json");
6216
6230
  dir = parent;
6217
6231
  }
6218
6232
  return dir;
6219
6233
  }
6220
- var packageDir = findPackageRoot(dirname9(fileURLToPath(import.meta.url)));
6234
+ var packageDir = findPackageRoot(dirname10(fileURLToPath(import.meta.url)));
6221
6235
  var currentVersion = JSON.parse(readFileSync8(join16(packageDir, "package.json"), "utf-8")).version;
6222
6236
  function detectInstallKind(dir, globalRoot) {
6223
6237
  const resolvedDir = resolve3(dir);
@@ -6318,7 +6332,7 @@ var updateCommand = new Command23("update").description(
6318
6332
  init_api();
6319
6333
  init_config();
6320
6334
  import { createReadStream } from "fs";
6321
- import { basename as basename5 } from "path";
6335
+ import { basename as basename6 } from "path";
6322
6336
  import { Command as Command24 } from "commander";
6323
6337
  init_output();
6324
6338
  var encodeExtValue = (value) => encodeURIComponent(value).replace(
@@ -6343,7 +6357,7 @@ var uploadCommand = new Command24("upload").description(
6343
6357
  Authorization: `Bearer ${key}`,
6344
6358
  "Content-Type": mime,
6345
6359
  "Content-Length": String(size),
6346
- ...fileNameHeaders(basename5(file))
6360
+ ...fileNameHeaders(basename6(file))
6347
6361
  },
6348
6362
  body: createReadStream(file),
6349
6363
  duplex: "half"