@wayai/cli 0.3.165 → 0.3.166

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
@@ -17528,11 +17528,33 @@ function ensureRealSubdirNoSymlink(root, target, create) {
17528
17528
  }
17529
17529
  return true;
17530
17530
  }
17531
+ function isUnder(parent, child) {
17532
+ const rel = path.relative(parent, child);
17533
+ return rel === "" || rel !== ".." && !rel.startsWith(`..${path.sep}`) && !path.isAbsolute(rel);
17534
+ }
17535
+ function isSymlink(p) {
17536
+ try {
17537
+ return fs.lstatSync(p).isSymbolicLink();
17538
+ } catch {
17539
+ return false;
17540
+ }
17541
+ }
17542
+ function workspaceRefusal(message) {
17543
+ const err = expected(message);
17544
+ err.isWorkspaceRefusal = true;
17545
+ return err;
17546
+ }
17547
+ function isWorkspaceRefusal(err) {
17548
+ return err?.isWorkspaceRefusal === true;
17549
+ }
17550
+ function symlinkRefusal(rel, kind) {
17551
+ return workspaceRefusal(
17552
+ `${rel} is a symlink, is reached through one, or is not a ${kind}. The CLI never reads or writes workspace config through a symlink \u2014 make it a real ${kind}.`
17553
+ );
17554
+ }
17531
17555
  function requireRealSubdirNoSymlink(root, target, create) {
17532
17556
  if (ensureRealSubdirNoSymlink(root, target, create)) return;
17533
- throw expected(
17534
- `${path.relative(path.dirname(root), target)} is reached through a symlink (or a file is in the way). The CLI never reads or writes workspace config through a symlink \u2014 make it a real directory.`
17535
- );
17557
+ throw symlinkRefusal(path.relative(path.dirname(root), target), "directory");
17536
17558
  }
17537
17559
  function requireRealHubFolder(hubFolder, create) {
17538
17560
  if (!create) {
@@ -17553,11 +17575,7 @@ function requireRealHubFolder(hubFolder, create) {
17553
17575
  } catch {
17554
17576
  continue;
17555
17577
  }
17556
- if (!st.isFile()) {
17557
- throw expected(
17558
- `${path.join(path.basename(hubFolder), name)} is a symlink (or not a file). The CLI never reads or writes workspace config through a symlink \u2014 make it a real file.`
17559
- );
17560
- }
17578
+ if (!st.isFile()) throw symlinkRefusal(path.join(path.basename(hubFolder), name), "file");
17561
17579
  }
17562
17580
  }
17563
17581
  function readRealFileOrThrow(root, abs) {
@@ -17568,11 +17586,7 @@ function readRealFileOrThrow(root, abs) {
17568
17586
  return null;
17569
17587
  }
17570
17588
  const bytes = st.isFile() ? readFileNoFollow(root, abs) : null;
17571
- if (!bytes) {
17572
- throw expected(
17573
- `${path.relative(path.dirname(root), abs)} is a symlink (or reached through one). The CLI never reads or writes workspace config through a symlink \u2014 make it a real file.`
17574
- );
17575
- }
17589
+ if (!bytes) throw symlinkRefusal(path.relative(path.dirname(root), abs), "file");
17576
17590
  return bytes.toString("utf-8");
17577
17591
  }
17578
17592
  function readFileNoFollow(root, abs) {
@@ -17767,10 +17781,9 @@ function resolveWorkspaceDir() {
17767
17781
  return resolveLayout(gitRoot).hubsDir;
17768
17782
  }
17769
17783
  function readHubYaml(yamlPath) {
17770
- if (!fs3.existsSync(yamlPath)) return null;
17784
+ if (!fs3.existsSync(yamlPath) || isSymlink(yamlPath)) return null;
17771
17785
  try {
17772
- const content = fs3.readFileSync(yamlPath, "utf-8");
17773
- const config = yaml.load(content);
17786
+ const config = yaml.load(fs3.readFileSync(yamlPath, "utf-8"));
17774
17787
  if (!config?.hub_id || !config.hub_environment) return null;
17775
17788
  return { hubId: config.hub_id, hubEnvironment: config.hub_environment };
17776
17789
  } catch {
@@ -17796,10 +17809,9 @@ function filterPreviewHubs(hubs) {
17796
17809
  return hubs.filter(isPreviewHub);
17797
17810
  }
17798
17811
  function readNewHubYaml(yamlPath) {
17799
- if (!fs3.existsSync(yamlPath)) return null;
17812
+ if (!fs3.existsSync(yamlPath) || isSymlink(yamlPath)) return null;
17800
17813
  try {
17801
- const content = fs3.readFileSync(yamlPath, "utf-8");
17802
- const config = yaml.load(content);
17814
+ const config = yaml.load(fs3.readFileSync(yamlPath, "utf-8"));
17803
17815
  if (config?.hub_id) return null;
17804
17816
  if (!config?.hub?.name) return null;
17805
17817
  return { hubName: config.hub.name, hubType: config.hub.hub_type };
@@ -17882,6 +17894,7 @@ function getChangedHubs(workspaceDir) {
17882
17894
  }
17883
17895
  const hubs = [];
17884
17896
  for (const hubFolder of hubFolders) {
17897
+ if (!isRealDirectory(hubFolder)) continue;
17885
17898
  const meta = readHubYaml(path3.join(hubFolder, "hub.yaml")) || readHubYaml(path3.join(hubFolder, "wayai.yaml"));
17886
17899
  if (meta) {
17887
17900
  hubs.push({ hubFolder, hubId: meta.hubId, hubEnvironment: meta.hubEnvironment });
@@ -17941,30 +17954,28 @@ function autoRenameHubFolder(currentFolder, hubName, hubEnvironment, hubId, prev
17941
17954
  function findEnclosingHubFolder(workspaceDir) {
17942
17955
  let current = process.cwd();
17943
17956
  const stop = path3.resolve(workspaceDir);
17944
- while (true) {
17957
+ while (isUnder(stop, current)) {
17945
17958
  const meta = readHubYaml(path3.join(current, "hub.yaml")) || readHubYaml(path3.join(current, "wayai.yaml"));
17946
17959
  if (meta) {
17947
17960
  return { hubFolder: current, hubId: meta.hubId, hubEnvironment: meta.hubEnvironment };
17948
17961
  }
17949
17962
  if (current === stop) return null;
17950
- const parent = path3.dirname(current);
17951
- if (parent === current) return null;
17952
- current = parent;
17963
+ current = path3.dirname(current);
17953
17964
  }
17965
+ return null;
17954
17966
  }
17955
17967
  function findEnclosingNewHubFolder(workspaceDir) {
17956
17968
  let current = process.cwd();
17957
17969
  const stop = path3.resolve(workspaceDir);
17958
- while (true) {
17970
+ while (isUnder(stop, current)) {
17959
17971
  const meta = readNewHubYaml(path3.join(current, "hub.yaml")) || readNewHubYaml(path3.join(current, "wayai.yaml"));
17960
17972
  if (meta) {
17961
17973
  return { hubFolder: current, hubName: meta.hubName, hubType: meta.hubType };
17962
17974
  }
17963
17975
  if (current === stop) return null;
17964
- const parent = path3.dirname(current);
17965
- if (parent === current) return null;
17966
- current = parent;
17976
+ current = path3.dirname(current);
17967
17977
  }
17978
+ return null;
17968
17979
  }
17969
17980
  function resolvePushTarget(workspaceDir, existingHubs, newHubs, selector) {
17970
17981
  if (selector) {
@@ -18066,6 +18077,7 @@ var init_workspace = __esm({
18066
18077
  "use strict";
18067
18078
  init_utils();
18068
18079
  init_layout();
18080
+ init_fs_safety();
18069
18081
  }
18070
18082
  });
18071
18083
 
@@ -18080,6 +18092,11 @@ function rootConfigPath(gitRoot) {
18080
18092
  return path4.join(gitRoot, ROOT_CONFIG_FILE);
18081
18093
  }
18082
18094
  function loadYamlMapping(file) {
18095
+ for (const p of [file, path4.dirname(file)]) {
18096
+ if (isSymlink(p)) {
18097
+ return { kind: "malformed", reason: `${path4.basename(p)} is a symlink \u2014 make it a real ${p === file ? "file" : "directory"}` };
18098
+ }
18099
+ }
18083
18100
  let raw;
18084
18101
  try {
18085
18102
  raw = fs4.readFileSync(file, "utf-8");
@@ -18107,6 +18124,7 @@ var init_workspace_manifest = __esm({
18107
18124
  "src/lib/workspace-manifest.ts"() {
18108
18125
  "use strict";
18109
18126
  init_layout();
18127
+ init_fs_safety();
18110
18128
  WORKSPACE_MANIFEST_FILE = "wayai.yaml";
18111
18129
  WORKSPACE_MANIFEST_LABEL = `${WAYAI_LAYOUT.wsDir}/${WORKSPACE_MANIFEST_FILE}`;
18112
18130
  ROOT_CONFIG_FILE = ".wayai.yaml";
@@ -18903,7 +18921,7 @@ var init_registry = __esm({
18903
18921
 
18904
18922
  // src/lib/version-cache.ts
18905
18923
  import { existsSync as existsSync3, readFileSync as readFileSync6, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "fs";
18906
- import { dirname as dirname5, join as join7 } from "path";
18924
+ import { dirname as dirname6, join as join7 } from "path";
18907
18925
  import { homedir as homedir2 } from "os";
18908
18926
  function getVersionCachePath(filename = CLI_CACHE_FILE) {
18909
18927
  return join7(homedir2(), ".wayai", filename);
@@ -18933,7 +18951,7 @@ function isVersionCacheStale(filename = CLI_CACHE_FILE, maxAgeMs = MAX_AGE_24H_M
18933
18951
  }
18934
18952
  function writeVersionCache(filename, cache) {
18935
18953
  const path35 = getVersionCachePath(filename);
18936
- const dir = dirname5(path35);
18954
+ const dir = dirname6(path35);
18937
18955
  if (!existsSync3(dir)) mkdirSync2(dir, { recursive: true });
18938
18956
  writeFileSync2(path35, JSON.stringify(cache));
18939
18957
  }
@@ -20583,7 +20601,9 @@ function scanResourceFiles(dir, prefix = "") {
20583
20601
  const entries = fs9.readdirSync(dir, { withFileTypes: true });
20584
20602
  for (const entry of entries) {
20585
20603
  const relPath = prefix ? `${prefix}/${entry.name}` : entry.name;
20586
- if (entry.isDirectory()) {
20604
+ if (entry.isSymbolicLink()) {
20605
+ throw symlinkRefusal(relPath, "file or folder");
20606
+ } else if (entry.isDirectory()) {
20587
20607
  files.push(...scanResourceFiles(path11.join(dir, entry.name), relPath));
20588
20608
  } else if (entry.isFile()) {
20589
20609
  const fullPath = path11.join(dir, entry.name);
@@ -20963,6 +20983,18 @@ var init_eval_attachments = __esm({
20963
20983
  import * as fs11 from "fs";
20964
20984
  import * as path13 from "path";
20965
20985
  import * as yaml6 from "js-yaml";
20986
+ function refuseConsumedLink(hubFolder, dir, entry) {
20987
+ if (!entry.isSymbolicLink()) return;
20988
+ const abs = path13.join(dir, entry.name);
20989
+ let toDir = false;
20990
+ try {
20991
+ toDir = fs11.statSync(abs).isDirectory();
20992
+ } catch {
20993
+ }
20994
+ if (toDir || entry.name.endsWith(".yaml")) {
20995
+ throw symlinkRefusal(path13.relative(hubFolder, abs), "file or folder");
20996
+ }
20997
+ }
20966
20998
  function parseHubFolder(hubFolder, opts) {
20967
20999
  requireRealHubFolder(hubFolder, false);
20968
21000
  const yamlPath = resolveHubYamlPath(hubFolder);
@@ -20997,8 +21029,14 @@ function parseHubFolder(hubFolder, opts) {
20997
21029
  if (typeof resolved.instructions === "string" && resolved.instructions.endsWith(".md")) {
20998
21030
  const instrValue = resolved.instructions;
20999
21031
  const instructionsPath = instrValue.startsWith("agents/") ? path13.join(hubFolder, instrValue) : path13.join(hubFolder, "agents", instrValue);
21000
- if (fs11.existsSync(instructionsPath)) {
21001
- resolved.instructions = fs11.readFileSync(instructionsPath, "utf-8");
21032
+ if (!isUnder(path13.join(hubFolder, "agents"), instructionsPath)) {
21033
+ throw workspaceRefusal(
21034
+ `Agent instructions path "${instrValue}" (agent "${agent.name}") must stay inside agents/.`
21035
+ );
21036
+ }
21037
+ const instructions = readRealFileOrThrow(hubFolder, instructionsPath);
21038
+ if (instructions !== null) {
21039
+ resolved.instructions = instructions;
21002
21040
  } else {
21003
21041
  throw expected(
21004
21042
  `Agent instructions file not found: ${instructionsPath} (referenced by agent "${agent.name}")`
@@ -21006,9 +21044,8 @@ function parseHubFolder(hubFolder, opts) {
21006
21044
  }
21007
21045
  } else if (resolved.instructions === void 0 && typeof agent.name === "string") {
21008
21046
  const conventionPath = path13.join(hubFolder, "agents", `${slugify(agent.name)}.md`);
21009
- if (fs11.existsSync(conventionPath)) {
21010
- resolved.instructions = fs11.readFileSync(conventionPath, "utf-8");
21011
- }
21047
+ const instructions = readRealFileOrThrow(hubFolder, conventionPath);
21048
+ if (instructions !== null) resolved.instructions = instructions;
21012
21049
  }
21013
21050
  return resolved;
21014
21051
  });
@@ -21067,6 +21104,7 @@ function scanEvalYamlFiles(hubFolder, bytesByHash) {
21067
21104
  const seen = /* @__PURE__ */ new Set();
21068
21105
  const topEntries = fs11.readdirSync(evalsDir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
21069
21106
  for (const entry of topEntries) {
21107
+ refuseConsumedLink(hubFolder, evalsDir, entry);
21070
21108
  if (entry.isFile() && entry.name.endsWith(".yaml")) {
21071
21109
  collectEval(evals, seen, path13.join(evalsDir, entry.name), `evals/${entry.name}`, null, hubFolder, bytesByHash);
21072
21110
  } else if (entry.isDirectory()) {
@@ -21074,6 +21112,7 @@ function scanEvalYamlFiles(hubFolder, bytesByHash) {
21074
21112
  const setDir = path13.join(evalsDir, setName);
21075
21113
  const setEntries = fs11.readdirSync(setDir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
21076
21114
  for (const sub of setEntries) {
21115
+ refuseConsumedLink(hubFolder, setDir, sub);
21077
21116
  if (sub.isDirectory()) {
21078
21117
  throw expected(
21079
21118
  `Nested scenario sets are not supported: ${path13.relative(hubFolder, path13.join(setDir, sub.name))}. Move scenarios up to evals/${setName}/.`
@@ -21209,6 +21248,7 @@ function scanJourneyYamlFiles(hubFolder, bytesByHash) {
21209
21248
  const seen = /* @__PURE__ */ new Set();
21210
21249
  const entries = fs11.readdirSync(journeysDir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
21211
21250
  for (const entry of entries) {
21251
+ refuseConsumedLink(hubFolder, journeysDir, entry);
21212
21252
  if (entry.isDirectory()) {
21213
21253
  throw expected(
21214
21254
  `Subfolders are not supported under journeys/: ${path13.relative(hubFolder, path13.join(journeysDir, entry.name))}. A journey owns its own managed scenario set \u2014 put each journey in a single journeys/<slug>.yaml file.`
@@ -21290,7 +21330,7 @@ function scanAgentYamlFiles(hubFolder) {
21290
21330
  const agents = [];
21291
21331
  for (const file of yamlFiles) {
21292
21332
  const filePath = path13.join(agentsDir, file);
21293
- const content = fs11.readFileSync(filePath, "utf-8");
21333
+ const content = readRealFileOrThrow(hubFolder, filePath) ?? "";
21294
21334
  let agent;
21295
21335
  try {
21296
21336
  agent = yaml6.load(content);
@@ -21325,6 +21365,7 @@ function parseResources(hubFolder, configResources) {
21325
21365
  if (res.skill_name) resource.skill_name = res.skill_name;
21326
21366
  const resSlug = slugify(resource.name);
21327
21367
  const resDir = path13.join(resourcesDir, resSlug);
21368
+ requireRealSubdirNoSymlink(hubFolder, resDir, false);
21328
21369
  if (fs11.existsSync(resDir)) {
21329
21370
  const files = scanResourceFiles(resDir, "");
21330
21371
  if (files.length > 0) {
@@ -21842,10 +21883,6 @@ function isProductionFolder(meta) {
21842
21883
  function filterEditableBases(bases) {
21843
21884
  return bases.filter((b) => !isProductionFolder(b.meta));
21844
21885
  }
21845
- function isUnder(parent, child) {
21846
- const rel = path17.relative(parent, child);
21847
- return rel === "" || !rel.startsWith("..") && !path17.isAbsolute(rel);
21848
- }
21849
21886
  function findEnclosingBaseFolder(basesDir, cwd) {
21850
21887
  let dir = path17.resolve(cwd);
21851
21888
  const stop = path17.resolve(basesDir);
@@ -21923,6 +21960,7 @@ var init_base_workspace = __esm({
21923
21960
  init_expected();
21924
21961
  init_base_id();
21925
21962
  init_fs_safety();
21963
+ init_fs_safety();
21926
21964
  BASE_META_FILE = "base.yaml";
21927
21965
  }
21928
21966
  });
@@ -23122,8 +23160,8 @@ async function autoRenameAgentFiles(client, hubId, hubFolder, organizationId, re
23122
23160
  if (fs16.existsSync(agentsDir)) {
23123
23161
  const yamlFiles = fs16.readdirSync(agentsDir).filter((f) => f.endsWith(".yaml"));
23124
23162
  for (const file of yamlFiles) {
23163
+ const content = readRealFileOrThrow(hubFolder, path22.join(agentsDir, file)) ?? "";
23125
23164
  try {
23126
- const content = fs16.readFileSync(path22.join(agentsDir, file), "utf-8");
23127
23165
  const agent = yaml11.load(content);
23128
23166
  if (agent?.id && agent.name) {
23129
23167
  agentsWithIds.push({ id: agent.id, name: agent.name });
@@ -23568,7 +23606,8 @@ async function pullCommand(args2) {
23568
23606
  }
23569
23607
  action = "apply";
23570
23608
  }
23571
- } catch {
23609
+ } catch (err) {
23610
+ if (isWorkspaceRefusal(err)) throw err;
23572
23611
  action = "overwrite";
23573
23612
  }
23574
23613
  if (action === "overwrite") console.log("Writing hub configuration...");
@@ -23643,6 +23682,7 @@ var init_pull = __esm({
23643
23682
  init_utils();
23644
23683
  init_resource_files();
23645
23684
  init_hub_materializer();
23685
+ init_fs_safety();
23646
23686
  init_push();
23647
23687
  init_workspace();
23648
23688
  init_layout();
@@ -28230,6 +28270,7 @@ function parseOrgResources(orgDir) {
28230
28270
  if (Array.isArray(res.tags)) resource.tags = res.tags;
28231
28271
  if (Array.isArray(res.folders)) resource.folders = res.folders;
28232
28272
  const resDir = path32.join(resourcesDir, slugify(resource.name));
28273
+ requireRealSubdirNoSymlink(orgDir, resDir, false);
28233
28274
  if (fs23.existsSync(resDir)) {
28234
28275
  const files = scanResourceFiles(resDir, "");
28235
28276
  if (files.length > 0) resource.files = files;
@@ -30617,7 +30658,7 @@ var init_actions = __esm({
30617
30658
 
30618
30659
  // src/data/commands/attachments.ts
30619
30660
  import { Command as Command2 } from "commander";
30620
- import { readFileSync as readFileSync18 } from "fs";
30661
+ import { readFileSync as readFileSync17 } from "fs";
30621
30662
  function findAttachmentByFilename(attachments, filename) {
30622
30663
  return attachments.find((a) => a.key.endsWith(`/${filename}`)) ?? null;
30623
30664
  }
@@ -30658,7 +30699,7 @@ function buildAttachmentsCommand() {
30658
30699
  printOutput(data, outputFormat(this));
30659
30700
  return;
30660
30701
  }
30661
- const body = readFileSync18(opts.file);
30702
+ const body = readFileSync17(opts.file);
30662
30703
  await client.upload(uploadPathFrom(data?.upload_url), body, opts.contentType);
30663
30704
  printOutput({ ...data, uploaded: true }, outputFormat(this));
30664
30705
  });
@@ -31138,8 +31179,8 @@ var init_providers = __esm({
31138
31179
 
31139
31180
  // src/data/commands/report.ts
31140
31181
  import { Command as Command6 } from "commander";
31141
- import { readFileSync as readFileSync19 } from "fs";
31142
- import { dirname as dirname12, join as join30 } from "path";
31182
+ import { readFileSync as readFileSync18 } from "fs";
31183
+ import { dirname as dirname13, join as join30 } from "path";
31143
31184
  import { fileURLToPath as fileURLToPath2 } from "url";
31144
31185
  function resolveCliVersion() {
31145
31186
  for (const candidate of [
@@ -31147,7 +31188,7 @@ function resolveCliVersion() {
31147
31188
  join30(here, "..", "..", "..", "package.json")
31148
31189
  ]) {
31149
31190
  try {
31150
- const version = JSON.parse(readFileSync19(candidate, "utf-8")).version;
31191
+ const version = JSON.parse(readFileSync18(candidate, "utf-8")).version;
31151
31192
  if (typeof version === "string" && version) return version;
31152
31193
  } catch {
31153
31194
  }
@@ -31343,13 +31384,13 @@ var init_report2 = __esm({
31343
31384
  init_terminal_output();
31344
31385
  init_workspace();
31345
31386
  init_skill_version();
31346
- here = dirname12(fileURLToPath2(import.meta.url));
31387
+ here = dirname13(fileURLToPath2(import.meta.url));
31347
31388
  }
31348
31389
  });
31349
31390
 
31350
31391
  // src/data/commands/credentials.ts
31351
31392
  import { Command as Command7 } from "commander";
31352
- import { readFileSync as readFileSync20 } from "fs";
31393
+ import { readFileSync as readFileSync19 } from "fs";
31353
31394
  function withValueSourceOptions(cmd, what) {
31354
31395
  return cmd.option(
31355
31396
  "--file <path>",
@@ -31362,7 +31403,7 @@ async function resolveValue(opts, label) {
31362
31403
  throw expected("--file cannot be combined with --value-stdin or --value-prompt \u2014 pass one.");
31363
31404
  }
31364
31405
  try {
31365
- return readFileSync20(opts.file).toString("base64");
31406
+ return readFileSync19(opts.file).toString("base64");
31366
31407
  } catch (e) {
31367
31408
  throw expected(`--file ${opts.file}: ${e instanceof Error ? e.message : "could not be read"}`);
31368
31409
  }
@@ -31511,7 +31552,7 @@ var init_credentials = __esm({
31511
31552
 
31512
31553
  // src/data/commands/sql.ts
31513
31554
  import { Command as Command8 } from "commander";
31514
- import { readFileSync as readFileSync21 } from "fs";
31555
+ import { readFileSync as readFileSync20 } from "fs";
31515
31556
  function buildBasesSqlCommand() {
31516
31557
  return withBaseOption(new Command8("sql")).description("Execute a read-only SQL query against base data").argument("[query]", "SQL query (SELECT only)").option("--file <path>", "Read SQL from a file instead of the argument").option(
31517
31558
  "--param <kv...>",
@@ -31521,7 +31562,7 @@ function buildBasesSqlCommand() {
31521
31562
  let query;
31522
31563
  if (opts.file) {
31523
31564
  try {
31524
- query = readFileSync21(opts.file, "utf-8").trim();
31565
+ query = readFileSync20(opts.file, "utf-8").trim();
31525
31566
  } catch (e) {
31526
31567
  throw expected(`--file ${opts.file}: ${e instanceof Error ? e.message : "could not be read"}`);
31527
31568
  }
@@ -32176,8 +32217,8 @@ var init_file_types = __esm({
32176
32217
 
32177
32218
  // src/data/commands/files.ts
32178
32219
  import { Command as Command12 } from "commander";
32179
- import { readFileSync as readFileSync22, writeFileSync as writeFileSync10 } from "fs";
32180
- import { basename as basename19 } from "path";
32220
+ import { readFileSync as readFileSync21, writeFileSync as writeFileSync10 } from "fs";
32221
+ import { basename as basename20 } from "path";
32181
32222
  function renderFileDiff(fileType, filePath, from, to, d) {
32182
32223
  console.log(sanitizeTerminalText(`${fileType}/${filePath}: v${from} \u2192 v${to}`));
32183
32224
  const md = d.metadata_delta;
@@ -32209,7 +32250,7 @@ function renderFileDiff(fileType, filePath, from, to, d) {
32209
32250
  }
32210
32251
  function downloadTarget(remotePath, to) {
32211
32252
  if (to) return to;
32212
- const derived = basename19(remotePath);
32253
+ const derived = basename20(remotePath);
32213
32254
  if (derived === "" || derived === "." || derived === "..") {
32214
32255
  throw expected(
32215
32256
  `Cannot derive a local filename from "${remotePath}" \u2014 pass --to <local> to name it.`
@@ -32225,7 +32266,7 @@ function buildFilesCommand() {
32225
32266
  "Upload a local file to a path (e.g. wayai files put reports q3/summary.pdf --file ./summary.pdf)"
32226
32267
  ).requiredOption("--file <local>", "Local file to upload").option("--content-type <type>", "MIME type", "application/octet-stream").action(async function(fileType, filePath, opts) {
32227
32268
  const base = pathSegment(requireBase(this), "--base");
32228
- const body = readFileSync22(opts.file);
32269
+ const body = readFileSync21(opts.file);
32229
32270
  const client = await createDataClient();
32230
32271
  printOutput(
32231
32272
  await client.upload(
@@ -33274,9 +33315,9 @@ init_errors2();
33274
33315
  init_mask_secrets();
33275
33316
  init_utils();
33276
33317
  init_registry();
33277
- import { readFileSync as readFileSync23 } from "fs";
33318
+ import { readFileSync as readFileSync22 } from "fs";
33278
33319
  import { fileURLToPath as fileURLToPath3 } from "url";
33279
- import { dirname as dirname13, join as join31 } from "path";
33320
+ import { dirname as dirname14, join as join31 } from "path";
33280
33321
 
33281
33322
  // src/lib/version-refresh.ts
33282
33323
  init_version_cache();
@@ -33431,8 +33472,8 @@ Run \`wayai admin skill install\` to update.`);
33431
33472
  }
33432
33473
 
33433
33474
  // src/index.ts
33434
- var __dirname = dirname13(fileURLToPath3(import.meta.url));
33435
- var pkg = JSON.parse(readFileSync23(join31(__dirname, "..", "package.json"), "utf-8"));
33475
+ var __dirname = dirname14(fileURLToPath3(import.meta.url));
33476
+ var pkg = JSON.parse(readFileSync22(join31(__dirname, "..", "package.json"), "utf-8"));
33436
33477
  var [, , command, ...args] = process.argv;
33437
33478
  var isBackgroundRefresh = command === REFRESH_COMMAND;
33438
33479
  if (!isBackgroundRefresh) initSentry(command, pkg.version);