@rogatio/cli 6.20.5 → 6.20.7

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
@@ -107,7 +107,7 @@ rogatio ai test
107
107
  rogatio ai delete
108
108
  ```
109
109
 
110
- Configuration is stored at `~/.config/rogatio/provider.json` (Linux), `~/Library/Application Support/rogatio/provider.json` (macOS), or `%LOCALAPPDATA%\rogatio\provider.json` (Windows) with `600` permissions.
110
+ Configuration is stored at `~/.config/rogatio/provider.json` (Linux), `~/Library/Application Support/rogatio/provider.json` (macOS), or `%LOCALAPPDATA%\rogatio\provider.json` (Windows). On POSIX the config directory mode is `700` and `provider.json` is `600`.
111
111
 
112
112
  When AI is configured, `rogatio edit` shows an **AI Assist** button on the project title row. Click it to:
113
113
  - Generate rules from natural language
@@ -2270,11 +2270,12 @@ function sameOrigin(a, b) {
2270
2270
  }
2271
2271
 
2272
2272
  // packages/runtime/dist/node/index.js
2273
+ import { constants } from "node:fs";
2273
2274
  import * as fs from "node:fs/promises";
2274
2275
  import * as path from "node:path";
2275
2276
  import { isIP as isIP2 } from "node:net";
2276
- import { constants, existsSync } from "node:fs";
2277
- import { open, readlink, realpath } from "node:fs/promises";
2277
+ import { constants as constants2, existsSync } from "node:fs";
2278
+ import { open as open2, readlink, realpath } from "node:fs/promises";
2278
2279
  import { isAbsolute, relative } from "node:path";
2279
2280
  import { close, fstat, read } from "node:fs";
2280
2281
  import { createRequire } from "node:module";
@@ -2283,10 +2284,10 @@ import { join as join5 } from "node:path";
2283
2284
  import { createPrivateKey, sign, verify, X509Certificate as X509Certificate3 } from "node:crypto";
2284
2285
  import { constants as fsConstants } from "node:fs";
2285
2286
  import {
2286
- lstat,
2287
+ lstat as lstat2,
2287
2288
  mkdir as mkdir2,
2288
- open as open2,
2289
- readFile as readFile2,
2289
+ open as open3,
2290
+ readFile,
2290
2291
  rename,
2291
2292
  rm,
2292
2293
  stat
@@ -2295,24 +2296,24 @@ import { basename, dirname as dirname2, isAbsolute as isAbsolute2, join as join2
2295
2296
  import { X509Certificate } from "node:crypto";
2296
2297
  import { generateKeyPairSync, webcrypto } from "node:crypto";
2297
2298
  import { spawn, spawnSync } from "node:child_process";
2298
- import { accessSync, constants as constants3 } from "node:fs";
2299
+ import { accessSync, constants as constants4 } from "node:fs";
2299
2300
  import { mkdtemp as mkdtemp2, rm as rm3 } from "node:fs/promises";
2300
2301
  import { tmpdir as tmpdir2 } from "node:os";
2301
2302
  import { dirname as dirname3, join as join4 } from "node:path";
2302
2303
  import { join as posixJoin } from "node:path/posix";
2303
- import { constants as constants2 } from "node:fs";
2304
- import { lstat as lstat2, mkdtemp, open as open3, rm as rm2 } from "node:fs/promises";
2304
+ import { constants as constants3 } from "node:fs";
2305
+ import { lstat as lstat3, mkdtemp, open as open4, rm as rm2 } from "node:fs/promises";
2305
2306
  import { tmpdir } from "node:os";
2306
2307
  import { join as join3 } from "node:path";
2307
2308
  import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
2308
- import { accessSync as accessSync2, constants as constants4, mkdirSync, unlinkSync } from "node:fs";
2309
+ import { accessSync as accessSync2, constants as constants5, mkdirSync, unlinkSync } from "node:fs";
2309
2310
  import { dirname as dirname4 } from "node:path";
2310
2311
  import { join as posixJoin2 } from "node:path/posix";
2311
2312
  import { spawn as spawn3, spawnSync as spawnSync3 } from "node:child_process";
2312
- import { accessSync as accessSync3, constants as constants5 } from "node:fs";
2313
+ import { accessSync as accessSync3, constants as constants6 } from "node:fs";
2313
2314
  import { join as posixJoin3 } from "node:path/posix";
2314
- import { constants as constants6 } from "node:fs";
2315
- import { open as open4, realpath as realpath2 } from "node:fs/promises";
2315
+ import { constants as constants7 } from "node:fs";
2316
+ import { open as open5, realpath as realpath2 } from "node:fs/promises";
2316
2317
  import { isAbsolute as isAbsolute3 } from "node:path";
2317
2318
  import { Buffer as Buffer2 } from "node:buffer";
2318
2319
  import { existsSync as existsSync2 } from "node:fs";
@@ -21147,8 +21148,24 @@ function sleep(ms) {
21147
21148
  function calculateRetryDelay(attempt) {
21148
21149
  return RETRY_DELAY_BASE * 2 ** attempt + Math.random() * 100;
21149
21150
  }
21150
- function providerStatusError(status) {
21151
- return new Error(`HTTP ${status}`);
21151
+ function publicRequestUrl(url) {
21152
+ let parsed;
21153
+ try {
21154
+ parsed = new URL(url);
21155
+ } catch {
21156
+ return void 0;
21157
+ }
21158
+ parsed.username = "";
21159
+ parsed.password = "";
21160
+ parsed.search = "";
21161
+ parsed.hash = "";
21162
+ return parsed.href;
21163
+ }
21164
+ function providerStatusError(status, url) {
21165
+ const requestUrl = publicRequestUrl(url);
21166
+ return new Error(
21167
+ requestUrl === void 0 ? `HTTP ${status}` : `HTTP ${status} for ${requestUrl}`
21168
+ );
21152
21169
  }
21153
21170
  async function releaseResponse(response) {
21154
21171
  await response.body?.cancel().catch(() => void 0);
@@ -21203,7 +21220,7 @@ async function fetchProvider(url, init, timeoutMs, signal) {
21203
21220
  throw e;
21204
21221
  }
21205
21222
  if (terminalStatus !== void 0) {
21206
- throw providerStatusError(terminalStatus);
21223
+ throw providerStatusError(terminalStatus, url);
21207
21224
  }
21208
21225
  }
21209
21226
  throw lastError;
@@ -21783,6 +21800,9 @@ async function runAIAssist(request, config, validate, dryRun, client) {
21783
21800
  }
21784
21801
  throw new Error(`Max fix attempts (${MAX_FIX_ATTEMPTS}) reached`);
21785
21802
  }
21803
+ var PRIVATE_DIR_MODE = 448;
21804
+ var PRIVATE_FILE_MODE = 384;
21805
+ var NOT_REGULAR_FILE = "provider config path is not a regular file";
21786
21806
  function getConfigDir() {
21787
21807
  const platform = process.platform;
21788
21808
  if (platform === "win32") {
@@ -21812,24 +21832,95 @@ function getConfigDir() {
21812
21832
  function getProviderConfigPath() {
21813
21833
  return path.join(getConfigDir(), "provider.json");
21814
21834
  }
21835
+ function optionalFlag(flag) {
21836
+ return typeof flag === "number" ? flag : 0;
21837
+ }
21838
+ function writeFlags() {
21839
+ return constants.O_WRONLY | constants.O_CREAT | constants.O_TRUNC | optionalFlag(constants.O_NOFOLLOW) | optionalFlag(constants.O_NONBLOCK);
21840
+ }
21841
+ function readFlags() {
21842
+ return constants.O_RDONLY | optionalFlag(constants.O_NOFOLLOW) | optionalFlag(constants.O_NONBLOCK);
21843
+ }
21844
+ function isRegularProviderFile(info) {
21845
+ return info.isFile() && !info.isSymbolicLink() && !info.isFIFO();
21846
+ }
21847
+ function errnoCode(error) {
21848
+ return error.code;
21849
+ }
21850
+ function isRejectedOpenError(error) {
21851
+ const code = errnoCode(error);
21852
+ return code === "ELOOP" || code === "ENXIO" || code === "EISDIR";
21853
+ }
21854
+ async function assertRegularProviderFile(configPath) {
21855
+ const info = await fs.lstat(configPath);
21856
+ if (!isRegularProviderFile(info)) {
21857
+ throw new Error(NOT_REGULAR_FILE);
21858
+ }
21859
+ }
21860
+ async function openProviderFile(configPath, flags, mode) {
21861
+ let handle;
21862
+ try {
21863
+ handle = mode === void 0 ? await fs.open(configPath, flags) : await fs.open(configPath, flags, mode);
21864
+ } catch (error) {
21865
+ if (isRejectedOpenError(error)) throw new Error(NOT_REGULAR_FILE);
21866
+ throw error;
21867
+ }
21868
+ try {
21869
+ const opened = await handle.stat();
21870
+ if (!isRegularProviderFile(opened)) {
21871
+ throw new Error(NOT_REGULAR_FILE);
21872
+ }
21873
+ return handle;
21874
+ } catch (error) {
21875
+ await handle.close().catch(() => void 0);
21876
+ throw error;
21877
+ }
21878
+ }
21815
21879
  async function readProviderConfig() {
21816
21880
  const configPath = getProviderConfigPath();
21817
21881
  try {
21818
- const content = await fs.readFile(configPath, "utf8");
21882
+ await assertRegularProviderFile(configPath);
21883
+ } catch (error) {
21884
+ if (errnoCode(error) === "ENOENT") return null;
21885
+ throw error;
21886
+ }
21887
+ let handle;
21888
+ try {
21889
+ handle = await openProviderFile(configPath, readFlags());
21890
+ } catch (error) {
21891
+ if (errnoCode(error) === "ENOENT") return null;
21892
+ throw error;
21893
+ }
21894
+ try {
21895
+ const content = await handle.readFile({ encoding: "utf8" });
21819
21896
  return JSON.parse(content);
21820
- } catch (e) {
21821
- if (e.code === "ENOENT") {
21822
- return null;
21823
- }
21824
- throw e;
21897
+ } finally {
21898
+ await handle.close().catch(() => void 0);
21825
21899
  }
21826
21900
  }
21827
21901
  async function writeProviderConfig(config) {
21828
21902
  const configPath = getProviderConfigPath();
21829
21903
  const configDir = path.dirname(configPath);
21830
- await fs.mkdir(configDir, { recursive: true });
21904
+ await fs.mkdir(configDir, { recursive: true, mode: PRIVATE_DIR_MODE });
21905
+ await fs.chmod(configDir, PRIVATE_DIR_MODE);
21906
+ try {
21907
+ await assertRegularProviderFile(configPath);
21908
+ } catch (error) {
21909
+ if (errnoCode(error) !== "ENOENT") throw error;
21910
+ }
21831
21911
  const content = JSON.stringify(config, null, 2);
21832
- await fs.writeFile(configPath, content, { mode: 384 });
21912
+ const handle = await openProviderFile(
21913
+ configPath,
21914
+ writeFlags(),
21915
+ PRIVATE_FILE_MODE
21916
+ );
21917
+ try {
21918
+ await handle.chmod(PRIVATE_FILE_MODE);
21919
+ await handle.writeFile(Buffer.from(content, "utf8"));
21920
+ await handle.chmod(PRIVATE_FILE_MODE);
21921
+ } finally {
21922
+ await handle.close();
21923
+ }
21833
21924
  }
21834
21925
  async function deleteProviderConfig() {
21835
21926
  const configPath = getProviderConfigPath();
@@ -22177,7 +22268,7 @@ async function darwinPathOf(fd) {
22177
22268
  }
22178
22269
  function isConfinedFileSupported() {
22179
22270
  if (process.platform === "linux") {
22180
- return typeof constants.O_NOFOLLOW === "number" && typeof constants.O_DIRECTORY === "number" && typeof constants.O_NONBLOCK === "number" && existsSync("/proc/self/fd");
22271
+ return typeof constants2.O_NOFOLLOW === "number" && typeof constants2.O_DIRECTORY === "number" && typeof constants2.O_NONBLOCK === "number" && existsSync("/proc/self/fd");
22181
22272
  }
22182
22273
  return darwinConfinedAvailable();
22183
22274
  }
@@ -22198,7 +22289,7 @@ function fromNodeHandle(file) {
22198
22289
  }
22199
22290
  var linuxOps = {
22200
22291
  async openRelative(dirFd, component, flags) {
22201
- return fromNodeHandle(await open(fdRelativePath(dirFd, component), flags));
22292
+ return fromNodeHandle(await open2(fdRelativePath(dirFd, component), flags));
22202
22293
  },
22203
22294
  async pathOf(fd) {
22204
22295
  try {
@@ -22231,9 +22322,9 @@ async function proveDescriptorWithinRoot(file, canonicalRoot, pathOf) {
22231
22322
  }
22232
22323
  function openFlags(directory) {
22233
22324
  if (directory) {
22234
- return constants.O_RDONLY | constants.O_DIRECTORY | constants.O_NOFOLLOW;
22325
+ return constants2.O_RDONLY | constants2.O_DIRECTORY | constants2.O_NOFOLLOW;
22235
22326
  }
22236
- return constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK;
22327
+ return constants2.O_RDONLY | constants2.O_NOFOLLOW | constants2.O_NONBLOCK;
22237
22328
  }
22238
22329
  async function openConfinedUsing(root, logicalPath, ops) {
22239
22330
  const normalized = normalizeLogicalPath(logicalPath);
@@ -22243,7 +22334,7 @@ async function openConfinedUsing(root, logicalPath, ops) {
22243
22334
  try {
22244
22335
  const canonicalRoot = await realpath(root);
22245
22336
  parent = fromNodeHandle(
22246
- await open(canonicalRoot, constants.O_RDONLY | constants.O_DIRECTORY)
22337
+ await open2(canonicalRoot, constants2.O_RDONLY | constants2.O_DIRECTORY)
22247
22338
  );
22248
22339
  for (let index = 0; index < components.length - 1; index += 1) {
22249
22340
  const component = components[index] ?? "";
@@ -22561,7 +22652,7 @@ async function writeFileAtomic(path2, data, mode) {
22561
22652
  let created = false;
22562
22653
  let handle;
22563
22654
  try {
22564
- handle = await open2(tmp, flags, 384);
22655
+ handle = await open3(tmp, flags, 384);
22565
22656
  created = true;
22566
22657
  await handle.writeFile(data, "utf8");
22567
22658
  await handle.chmod(mode ?? 420);
@@ -22602,9 +22693,9 @@ function caCertificateMatchesPrivateKey(certPem, keyPem) {
22602
22693
  async function readNoFollowRegularFile(path2) {
22603
22694
  let handle;
22604
22695
  try {
22605
- const info = await lstat(path2);
22696
+ const info = await lstat2(path2);
22606
22697
  if (!info.isFile()) return void 0;
22607
- handle = await open2(path2, fsConstants.O_RDONLY | noFollowFlag());
22698
+ handle = await open3(path2, fsConstants.O_RDONLY | noFollowFlag());
22608
22699
  const opened = await handle.stat();
22609
22700
  if (!opened.isFile()) return void 0;
22610
22701
  return await handle.readFile({ encoding: "utf8" });
@@ -22633,7 +22724,7 @@ async function readPreviousRogatioCa(caCertFile) {
22633
22724
  async function assertReadableIfRegular(path2, snapshot2) {
22634
22725
  if (snapshot2 !== void 0) return;
22635
22726
  try {
22636
- const info = await lstat(path2);
22727
+ const info = await lstat2(path2);
22637
22728
  if (!info.isFile()) return;
22638
22729
  } catch {
22639
22730
  return;
@@ -22736,7 +22827,7 @@ function createRequestBodyTrustController(options = {}) {
22736
22827
  async function readRecordedDirs() {
22737
22828
  if (!recordsManifestDirs) return void 0;
22738
22829
  try {
22739
- return parseRecordedDirs(await readFile2(manifestRecordPath, "utf8"));
22830
+ return parseRecordedDirs(await readFile(manifestRecordPath, "utf8"));
22740
22831
  } catch {
22741
22832
  return void 0;
22742
22833
  }
@@ -22754,7 +22845,7 @@ function createRequestBodyTrustController(options = {}) {
22754
22845
  async function snapshotFile(path2) {
22755
22846
  let previous;
22756
22847
  try {
22757
- previous = await readFile2(path2, "utf8");
22848
+ previous = await readFile(path2, "utf8");
22758
22849
  } catch {
22759
22850
  previous = void 0;
22760
22851
  }
@@ -22867,8 +22958,8 @@ function createRequestBodyTrustController(options = {}) {
22867
22958
  async function reusableCaMaterial() {
22868
22959
  try {
22869
22960
  const [keyStat, certStat] = await Promise.all([
22870
- lstat(caKeyFile),
22871
- lstat(caCertFile)
22961
+ lstat2(caKeyFile),
22962
+ lstat2(caCertFile)
22872
22963
  ]);
22873
22964
  if (!keyStat.isFile() || !certStat.isFile()) return false;
22874
22965
  if (process.platform !== "win32") {
@@ -22877,8 +22968,8 @@ function createRequestBodyTrustController(options = {}) {
22877
22968
  if (uid !== void 0 && keyStat.uid !== uid) return false;
22878
22969
  }
22879
22970
  const [certPem, keyPem] = await Promise.all([
22880
- readFile2(caCertFile, "utf8"),
22881
- readFile2(caKeyFile, "utf8")
22971
+ readFile(caCertFile, "utf8"),
22972
+ readFile(caKeyFile, "utf8")
22882
22973
  ]);
22883
22974
  return caCertificateMatchesPrivateKey(certPem, keyPem);
22884
22975
  } catch {
@@ -22992,7 +23083,7 @@ function createRequestBodyTrustController(options = {}) {
22992
23083
  let installedNew = false;
22993
23084
  if (caTrustInstaller && !installerCalled) {
22994
23085
  installerCalled = true;
22995
- await caTrustInstaller(await readFile2(caCertFile, "utf8"));
23086
+ await caTrustInstaller(await readFile(caCertFile, "utf8"));
22996
23087
  installedNew = true;
22997
23088
  }
22998
23089
  if (reusable && siblingAnchor && (installedNew || !caTrustInstaller)) {
@@ -23085,7 +23176,7 @@ function createRequestBodyTrustController(options = {}) {
23085
23176
  let installed = dirs.length > 0;
23086
23177
  for (const dir of dirs) {
23087
23178
  try {
23088
- const raw = await readFile2(join2(dir, `${hostName}.json`), "utf8");
23179
+ const raw = await readFile(join2(dir, `${hostName}.json`), "utf8");
23089
23180
  const parsed = JSON.parse(raw);
23090
23181
  if (!isWellFormedManifest(parsed) || !manifestAcceptable(parsed)) {
23091
23182
  installed = false;
@@ -23117,7 +23208,7 @@ function createRequestBodyTrustController(options = {}) {
23117
23208
  let binaryPath;
23118
23209
  for (const dir of dirs) {
23119
23210
  try {
23120
- const raw = await readFile2(join2(dir, `${hostName}.json`), "utf8");
23211
+ const raw = await readFile(join2(dir, `${hostName}.json`), "utf8");
23121
23212
  const parsed = JSON.parse(raw);
23122
23213
  if (!isWellFormedManifest(parsed) || !manifestAcceptable(parsed)) {
23123
23214
  manifestValid = false;
@@ -23168,14 +23259,14 @@ function createRequestBodyTrustController(options = {}) {
23168
23259
  return { install, uninstall, status, verify: verify2 };
23169
23260
  }
23170
23261
  var INSTALL_CERT_NAME = "ca.crt";
23171
- function optionalFlag(flag) {
23262
+ function optionalFlag2(flag) {
23172
23263
  return typeof flag === "number" ? flag : 0;
23173
23264
  }
23174
23265
  function exclusiveWriteFlags() {
23175
- return constants2.O_WRONLY | constants2.O_CREAT | constants2.O_EXCL | constants2.O_TRUNC | optionalFlag(constants2.O_NOFOLLOW);
23266
+ return constants3.O_WRONLY | constants3.O_CREAT | constants3.O_EXCL | constants3.O_TRUNC | optionalFlag2(constants3.O_NOFOLLOW);
23176
23267
  }
23177
- function readFlags() {
23178
- return constants2.O_RDONLY | optionalFlag(constants2.O_NOFOLLOW) | optionalFlag(constants2.O_NONBLOCK);
23268
+ function readFlags2() {
23269
+ return constants3.O_RDONLY | optionalFlag2(constants3.O_NOFOLLOW) | optionalFlag2(constants3.O_NONBLOCK);
23179
23270
  }
23180
23271
  function refuseCertificateFile(message) {
23181
23272
  throw new TrustError("trust.internal", message, [
@@ -23183,7 +23274,7 @@ function refuseCertificateFile(message) {
23183
23274
  ]);
23184
23275
  }
23185
23276
  async function writeExclusiveCertificate(certPath, pem) {
23186
- const handle = await open3(certPath, exclusiveWriteFlags(), 384);
23277
+ const handle = await open4(certPath, exclusiveWriteFlags(), 384);
23187
23278
  try {
23188
23279
  await handle.writeFile(Buffer.from(pem, "utf8"));
23189
23280
  await handle.chmod(384);
@@ -23194,7 +23285,7 @@ async function writeExclusiveCertificate(certPath, pem) {
23194
23285
  async function assertCertificateReady(certPath, pem) {
23195
23286
  let info;
23196
23287
  try {
23197
- info = await lstat2(certPath);
23288
+ info = await lstat3(certPath);
23198
23289
  } catch {
23199
23290
  refuseCertificateFile("certificate file is not a regular file");
23200
23291
  }
@@ -23203,7 +23294,7 @@ async function assertCertificateReady(certPath, pem) {
23203
23294
  }
23204
23295
  let handle;
23205
23296
  try {
23206
- handle = await open3(certPath, readFlags());
23297
+ handle = await open4(certPath, readFlags2());
23207
23298
  const opened = await handle.stat();
23208
23299
  if (!opened.isFile() || opened.isFIFO() || opened.isSymbolicLink()) {
23209
23300
  refuseCertificateFile("certificate file is not a regular file");
@@ -23283,12 +23374,12 @@ var darwinAdapter = {
23283
23374
  reasons.push("tooling-missing");
23284
23375
  }
23285
23376
  try {
23286
- accessSync(manifestDir, constants3.W_OK);
23377
+ accessSync(manifestDir, constants4.W_OK);
23287
23378
  } catch {
23288
23379
  reasons.push("manifest-dir-unwritable");
23289
23380
  }
23290
23381
  try {
23291
- accessSync(caDir, constants3.W_OK);
23382
+ accessSync(caDir, constants4.W_OK);
23292
23383
  } catch {
23293
23384
  reasons.push("keychain-unwritable");
23294
23385
  }
@@ -23425,7 +23516,7 @@ function exists(path2) {
23425
23516
  }
23426
23517
  function writable(path2) {
23427
23518
  try {
23428
- accessSync2(path2, constants4.W_OK);
23519
+ accessSync2(path2, constants5.W_OK);
23429
23520
  return true;
23430
23521
  } catch {
23431
23522
  return false;
@@ -23462,7 +23553,7 @@ function p11kitAnchorsDir() {
23462
23553
  function needsElevation(dir) {
23463
23554
  if (writable(dir)) return false;
23464
23555
  try {
23465
- accessSync2(dir, constants4.W_OK);
23556
+ accessSync2(dir, constants5.W_OK);
23466
23557
  } catch (err) {
23467
23558
  if (nodeCode(err) === "ENOENT" && writable(dirname4(dir))) return false;
23468
23559
  }
@@ -23479,13 +23570,13 @@ function manifestDirFor(browser) {
23479
23570
  }
23480
23571
  function canHostManifest(dir) {
23481
23572
  try {
23482
- accessSync2(dir, constants4.W_OK);
23573
+ accessSync2(dir, constants5.W_OK);
23483
23574
  return true;
23484
23575
  } catch (err) {
23485
23576
  if (nodeCode(err) !== "ENOENT") return false;
23486
23577
  }
23487
23578
  try {
23488
- accessSync2(dirname4(dir), constants4.W_OK);
23579
+ accessSync2(dirname4(dir), constants5.W_OK);
23489
23580
  return true;
23490
23581
  } catch {
23491
23582
  return false;
@@ -23676,7 +23767,7 @@ var win32Adapter = {
23676
23767
  reasons.push("tooling-missing");
23677
23768
  }
23678
23769
  try {
23679
- accessSync3(manifestDir, constants5.W_OK);
23770
+ accessSync3(manifestDir, constants6.W_OK);
23680
23771
  } catch {
23681
23772
  reasons.push("manifest-dir-unwritable");
23682
23773
  }
@@ -24667,7 +24758,7 @@ async function resolveConfinedRoot(value) {
24667
24758
  }
24668
24759
  let directory;
24669
24760
  try {
24670
- directory = await open4(value, constants6.O_RDONLY | constants6.O_DIRECTORY);
24761
+ directory = await open5(value, constants7.O_RDONLY | constants7.O_DIRECTORY);
24671
24762
  const info = await directory.stat();
24672
24763
  if (!info.isDirectory()) return failure("runtime.root-invalid");
24673
24764
  return { ok: true, value: await realpath2(value) };
@@ -28805,11 +28896,11 @@ import {
28805
28896
  access,
28806
28897
  mkdir as mkdir3,
28807
28898
  readdir,
28808
- readFile as readFile3,
28899
+ readFile as readFile2,
28809
28900
  rename as rename2,
28810
28901
  stat as stat2,
28811
28902
  unlink as unlink2,
28812
- writeFile as writeFile2
28903
+ writeFile
28813
28904
  } from "node:fs/promises";
28814
28905
  import { basename as basename2, dirname as dirname5, join as join7 } from "node:path";
28815
28906
  var ProjectStorageError = class extends Error {
@@ -28907,7 +28998,7 @@ function isJsonFilename(name) {
28907
28998
  async function isDiscoverableProjectFile(id2) {
28908
28999
  let parsed;
28909
29000
  try {
28910
- parsed = JSON.parse(await readFile3(id2, "utf-8"));
29001
+ parsed = JSON.parse(await readFile2(id2, "utf-8"));
28911
29002
  } catch {
28912
29003
  return false;
28913
29004
  }
@@ -28971,7 +29062,7 @@ function migrateLoadedProject(parsed) {
28971
29062
  }
28972
29063
  async function readDocument(id2) {
28973
29064
  try {
28974
- const content = await readFile3(id2, "utf-8");
29065
+ const content = await readFile2(id2, "utf-8");
28975
29066
  const parsed = JSON.parse(content);
28976
29067
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
28977
29068
  throw new ProjectFileError(
@@ -29026,7 +29117,7 @@ async function writeDocument(id2, data) {
29026
29117
  );
29027
29118
  }
29028
29119
  await mkdir3(dirname5(id2), { recursive: true });
29029
- await writeFile2(tempPath, JSON.stringify(data, null, 2), "utf-8");
29120
+ await writeFile(tempPath, JSON.stringify(data, null, 2), "utf-8");
29030
29121
  await rename2(tempPath, id2);
29031
29122
  } catch (e) {
29032
29123
  if (e instanceof ProjectFileError) throw e;
@@ -29702,7 +29793,7 @@ function createServer3(handler, options = {}) {
29702
29793
 
29703
29794
  // packages/cli/src/server/routes.ts
29704
29795
  import { randomBytes as randomBytes4, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
29705
- import { readFile as readFile5 } from "node:fs/promises";
29796
+ import { readFile as readFile4 } from "node:fs/promises";
29706
29797
  import { dirname as dirname9, isAbsolute as isAbsolute5, resolve as resolve5 } from "node:path";
29707
29798
 
29708
29799
  // packages/dry-run/dist/node/index.js
@@ -30075,7 +30166,7 @@ function previewRuleAction(operation, url) {
30075
30166
  }
30076
30167
 
30077
30168
  // packages/cli/src/mock-root-config.ts
30078
- import { mkdir as mkdir4, readFile as readFile4, realpath as realpath3, rename as rename3, writeFile as writeFile3 } from "node:fs/promises";
30169
+ import { mkdir as mkdir4, readFile as readFile3, realpath as realpath3, rename as rename3, writeFile as writeFile2 } from "node:fs/promises";
30079
30170
  import { homedir } from "node:os";
30080
30171
  import { dirname as dirname8, isAbsolute as isAbsolute4, join as join8, resolve as resolve4 } from "node:path";
30081
30172
  function mockRootConfigPath(env = process.env) {
@@ -30093,7 +30184,7 @@ async function canonicalProjectPath(filePath) {
30093
30184
  async function readMap(env) {
30094
30185
  let raw;
30095
30186
  try {
30096
- raw = await readFile4(mockRootConfigPath(env), "utf8");
30187
+ raw = await readFile3(mockRootConfigPath(env), "utf8");
30097
30188
  } catch {
30098
30189
  return {};
30099
30190
  }
@@ -30121,7 +30212,7 @@ async function writeMap(map, env) {
30121
30212
  const path2 = mockRootConfigPath(env);
30122
30213
  await mkdir4(dirname8(path2), { recursive: true });
30123
30214
  const temporary = `${path2}.${process.pid}.tmp`;
30124
- await writeFile3(
30215
+ await writeFile2(
30125
30216
  temporary,
30126
30217
  `${JSON.stringify({ projects: map }, null, 2)}
30127
30218
  `,
@@ -30334,7 +30425,7 @@ function createRoutes(context) {
30334
30425
  }
30335
30426
  if (pathname === "/vendor/editor.js" && method === "GET") {
30336
30427
  try {
30337
- const bundle = await readFile5(context.editorBundlePath, "utf-8");
30428
+ const bundle = await readFile4(context.editorBundlePath, "utf-8");
30338
30429
  res.writeHead(200, {
30339
30430
  "Content-Type": "text/javascript; charset=utf-8"
30340
30431
  });
@@ -30352,7 +30443,7 @@ function createRoutes(context) {
30352
30443
  }
30353
30444
  if (pathname === "/vendor/editor.css" && method === "GET") {
30354
30445
  try {
30355
- const css = await readFile5(context.editorCssPath, "utf-8");
30446
+ const css = await readFile4(context.editorCssPath, "utf-8");
30356
30447
  res.writeHead(200, {
30357
30448
  "Content-Type": "text/css; charset=utf-8"
30358
30449
  });
@@ -30376,7 +30467,7 @@ function createRoutes(context) {
30376
30467
  return;
30377
30468
  }
30378
30469
  try {
30379
- const font = await readFile5(resolve5(context.editorFontsPath, fileName));
30470
+ const font = await readFile4(resolve5(context.editorFontsPath, fileName));
30380
30471
  res.writeHead(200, {
30381
30472
  "Content-Type": "font/woff2"
30382
30473
  });
@@ -31506,7 +31597,7 @@ function generateEditorHtml(filePath, aiConfigured) {
31506
31597
  }
31507
31598
 
31508
31599
  // packages/cli/src/commands/import.ts
31509
- import { access as access2, readFile as readFile6 } from "node:fs/promises";
31600
+ import { access as access2, readFile as readFile5 } from "node:fs/promises";
31510
31601
  import { resolve as resolve7 } from "node:path";
31511
31602
 
31512
31603
  // packages/requestly-import/dist/node/index.js
@@ -33362,7 +33453,7 @@ async function importCommand(args) {
33362
33453
  const flags = parsed.flags;
33363
33454
  let exportData;
33364
33455
  try {
33365
- exportData = JSON.parse(await readFile6(flags.sourcePath, "utf8"));
33456
+ exportData = JSON.parse(await readFile5(flags.sourcePath, "utf8"));
33366
33457
  } catch (error) {
33367
33458
  console.error(`Error: ${errorMessage(error)}`);
33368
33459
  return 2;
@@ -33381,7 +33472,7 @@ async function importCommand(args) {
33381
33472
  }
33382
33473
  let existing;
33383
33474
  try {
33384
- existing = JSON.parse(await readFile6(flags.outputPath, "utf8"));
33475
+ existing = JSON.parse(await readFile5(flags.outputPath, "utf8"));
33385
33476
  } catch (error) {
33386
33477
  console.error(`Error: ${errorMessage(error)}`);
33387
33478
  return 2;
@@ -33520,7 +33611,7 @@ function errorMessage(error) {
33520
33611
  }
33521
33612
 
33522
33613
  // packages/cli/src/commands/runtime.ts
33523
- import { chmod, mkdir as mkdir5, rm as rm4, writeFile as writeFile4 } from "node:fs/promises";
33614
+ import { chmod as chmod2, mkdir as mkdir5, rm as rm4, writeFile as writeFile3 } from "node:fs/promises";
33524
33615
  import { dirname as dirname10, join as join9, resolve as resolve8 } from "node:path";
33525
33616
  function generateHostWrapper(rogatioCommand, logPath) {
33526
33617
  const parts = rogatioCommand.split(" ");
@@ -33541,8 +33632,8 @@ async function writeHostWrapper(hostPath, installRoot) {
33541
33632
  `${process.execPath} ${process.argv[1] ?? "rogatio"}`,
33542
33633
  logPath
33543
33634
  );
33544
- await writeFile4(hostPath, script, "utf8");
33545
- await chmod(hostPath, 493);
33635
+ await writeFile3(hostPath, script, "utf8");
33636
+ await chmod2(hostPath, 493);
33546
33637
  }
33547
33638
  function makeTrustController() {
33548
33639
  return createInstalledTrustController();
@@ -33834,7 +33925,7 @@ async function runRuntimeHostEntry() {
33834
33925
  }
33835
33926
 
33836
33927
  // packages/cli/src/commands/test.ts
33837
- import { readFile as readFile7 } from "node:fs/promises";
33928
+ import { readFile as readFile6 } from "node:fs/promises";
33838
33929
  import { resolve as resolve9 } from "node:path";
33839
33930
  function usageError(message) {
33840
33931
  return `Error: ${message}
@@ -33992,7 +34083,7 @@ async function testCommandImpl(args, stdinInput, captureOutput, options = {}) {
33992
34083
  for (const url of positionalUrls) urlCases.push({ url });
33993
34084
  if (urlsFile) {
33994
34085
  try {
33995
- const content = urlsFile === "-" ? stdinInput ?? "" : await readFile7(urlsFile, "utf8");
34086
+ const content = urlsFile === "-" ? stdinInput ?? "" : await readFile6(urlsFile, "utf8");
33996
34087
  const parsed = JSON.parse(content);
33997
34088
  if (!Array.isArray(parsed)) {
33998
34089
  const output = usageError(`${urlsFile} must contain a JSON array`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogatio/cli",
3
- "version": "6.20.5",
3
+ "version": "6.20.7",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Local-first browser request and response rules — editor host, file verification, test runner, and runtime dispatch.",