@rogatio/cli 6.20.4 → 6.20.6
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 +1 -1
- package/dist/node/index.js +153 -75
- package/package.json +1 -1
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)
|
|
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
|
package/dist/node/index.js
CHANGED
|
@@ -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
|
|
2289
|
-
readFile
|
|
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
|
|
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
|
|
2304
|
-
import { lstat as
|
|
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
|
|
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
|
|
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
|
|
2315
|
-
import { open as
|
|
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";
|
|
@@ -21783,6 +21784,9 @@ async function runAIAssist(request, config, validate, dryRun, client) {
|
|
|
21783
21784
|
}
|
|
21784
21785
|
throw new Error(`Max fix attempts (${MAX_FIX_ATTEMPTS}) reached`);
|
|
21785
21786
|
}
|
|
21787
|
+
var PRIVATE_DIR_MODE = 448;
|
|
21788
|
+
var PRIVATE_FILE_MODE = 384;
|
|
21789
|
+
var NOT_REGULAR_FILE = "provider config path is not a regular file";
|
|
21786
21790
|
function getConfigDir() {
|
|
21787
21791
|
const platform = process.platform;
|
|
21788
21792
|
if (platform === "win32") {
|
|
@@ -21812,24 +21816,95 @@ function getConfigDir() {
|
|
|
21812
21816
|
function getProviderConfigPath() {
|
|
21813
21817
|
return path.join(getConfigDir(), "provider.json");
|
|
21814
21818
|
}
|
|
21819
|
+
function optionalFlag(flag) {
|
|
21820
|
+
return typeof flag === "number" ? flag : 0;
|
|
21821
|
+
}
|
|
21822
|
+
function writeFlags() {
|
|
21823
|
+
return constants.O_WRONLY | constants.O_CREAT | constants.O_TRUNC | optionalFlag(constants.O_NOFOLLOW) | optionalFlag(constants.O_NONBLOCK);
|
|
21824
|
+
}
|
|
21825
|
+
function readFlags() {
|
|
21826
|
+
return constants.O_RDONLY | optionalFlag(constants.O_NOFOLLOW) | optionalFlag(constants.O_NONBLOCK);
|
|
21827
|
+
}
|
|
21828
|
+
function isRegularProviderFile(info) {
|
|
21829
|
+
return info.isFile() && !info.isSymbolicLink() && !info.isFIFO();
|
|
21830
|
+
}
|
|
21831
|
+
function errnoCode(error) {
|
|
21832
|
+
return error.code;
|
|
21833
|
+
}
|
|
21834
|
+
function isRejectedOpenError(error) {
|
|
21835
|
+
const code = errnoCode(error);
|
|
21836
|
+
return code === "ELOOP" || code === "ENXIO" || code === "EISDIR";
|
|
21837
|
+
}
|
|
21838
|
+
async function assertRegularProviderFile(configPath) {
|
|
21839
|
+
const info = await fs.lstat(configPath);
|
|
21840
|
+
if (!isRegularProviderFile(info)) {
|
|
21841
|
+
throw new Error(NOT_REGULAR_FILE);
|
|
21842
|
+
}
|
|
21843
|
+
}
|
|
21844
|
+
async function openProviderFile(configPath, flags, mode) {
|
|
21845
|
+
let handle;
|
|
21846
|
+
try {
|
|
21847
|
+
handle = mode === void 0 ? await fs.open(configPath, flags) : await fs.open(configPath, flags, mode);
|
|
21848
|
+
} catch (error) {
|
|
21849
|
+
if (isRejectedOpenError(error)) throw new Error(NOT_REGULAR_FILE);
|
|
21850
|
+
throw error;
|
|
21851
|
+
}
|
|
21852
|
+
try {
|
|
21853
|
+
const opened = await handle.stat();
|
|
21854
|
+
if (!isRegularProviderFile(opened)) {
|
|
21855
|
+
throw new Error(NOT_REGULAR_FILE);
|
|
21856
|
+
}
|
|
21857
|
+
return handle;
|
|
21858
|
+
} catch (error) {
|
|
21859
|
+
await handle.close().catch(() => void 0);
|
|
21860
|
+
throw error;
|
|
21861
|
+
}
|
|
21862
|
+
}
|
|
21815
21863
|
async function readProviderConfig() {
|
|
21816
21864
|
const configPath = getProviderConfigPath();
|
|
21817
21865
|
try {
|
|
21818
|
-
|
|
21866
|
+
await assertRegularProviderFile(configPath);
|
|
21867
|
+
} catch (error) {
|
|
21868
|
+
if (errnoCode(error) === "ENOENT") return null;
|
|
21869
|
+
throw error;
|
|
21870
|
+
}
|
|
21871
|
+
let handle;
|
|
21872
|
+
try {
|
|
21873
|
+
handle = await openProviderFile(configPath, readFlags());
|
|
21874
|
+
} catch (error) {
|
|
21875
|
+
if (errnoCode(error) === "ENOENT") return null;
|
|
21876
|
+
throw error;
|
|
21877
|
+
}
|
|
21878
|
+
try {
|
|
21879
|
+
const content = await handle.readFile({ encoding: "utf8" });
|
|
21819
21880
|
return JSON.parse(content);
|
|
21820
|
-
}
|
|
21821
|
-
|
|
21822
|
-
return null;
|
|
21823
|
-
}
|
|
21824
|
-
throw e;
|
|
21881
|
+
} finally {
|
|
21882
|
+
await handle.close().catch(() => void 0);
|
|
21825
21883
|
}
|
|
21826
21884
|
}
|
|
21827
21885
|
async function writeProviderConfig(config) {
|
|
21828
21886
|
const configPath = getProviderConfigPath();
|
|
21829
21887
|
const configDir = path.dirname(configPath);
|
|
21830
|
-
await fs.mkdir(configDir, { recursive: true });
|
|
21888
|
+
await fs.mkdir(configDir, { recursive: true, mode: PRIVATE_DIR_MODE });
|
|
21889
|
+
await fs.chmod(configDir, PRIVATE_DIR_MODE);
|
|
21890
|
+
try {
|
|
21891
|
+
await assertRegularProviderFile(configPath);
|
|
21892
|
+
} catch (error) {
|
|
21893
|
+
if (errnoCode(error) !== "ENOENT") throw error;
|
|
21894
|
+
}
|
|
21831
21895
|
const content = JSON.stringify(config, null, 2);
|
|
21832
|
-
|
|
21896
|
+
const handle = await openProviderFile(
|
|
21897
|
+
configPath,
|
|
21898
|
+
writeFlags(),
|
|
21899
|
+
PRIVATE_FILE_MODE
|
|
21900
|
+
);
|
|
21901
|
+
try {
|
|
21902
|
+
await handle.chmod(PRIVATE_FILE_MODE);
|
|
21903
|
+
await handle.writeFile(Buffer.from(content, "utf8"));
|
|
21904
|
+
await handle.chmod(PRIVATE_FILE_MODE);
|
|
21905
|
+
} finally {
|
|
21906
|
+
await handle.close();
|
|
21907
|
+
}
|
|
21833
21908
|
}
|
|
21834
21909
|
async function deleteProviderConfig() {
|
|
21835
21910
|
const configPath = getProviderConfigPath();
|
|
@@ -22177,7 +22252,7 @@ async function darwinPathOf(fd) {
|
|
|
22177
22252
|
}
|
|
22178
22253
|
function isConfinedFileSupported() {
|
|
22179
22254
|
if (process.platform === "linux") {
|
|
22180
|
-
return typeof
|
|
22255
|
+
return typeof constants2.O_NOFOLLOW === "number" && typeof constants2.O_DIRECTORY === "number" && typeof constants2.O_NONBLOCK === "number" && existsSync("/proc/self/fd");
|
|
22181
22256
|
}
|
|
22182
22257
|
return darwinConfinedAvailable();
|
|
22183
22258
|
}
|
|
@@ -22198,7 +22273,7 @@ function fromNodeHandle(file) {
|
|
|
22198
22273
|
}
|
|
22199
22274
|
var linuxOps = {
|
|
22200
22275
|
async openRelative(dirFd, component, flags) {
|
|
22201
|
-
return fromNodeHandle(await
|
|
22276
|
+
return fromNodeHandle(await open2(fdRelativePath(dirFd, component), flags));
|
|
22202
22277
|
},
|
|
22203
22278
|
async pathOf(fd) {
|
|
22204
22279
|
try {
|
|
@@ -22231,9 +22306,9 @@ async function proveDescriptorWithinRoot(file, canonicalRoot, pathOf) {
|
|
|
22231
22306
|
}
|
|
22232
22307
|
function openFlags(directory) {
|
|
22233
22308
|
if (directory) {
|
|
22234
|
-
return
|
|
22309
|
+
return constants2.O_RDONLY | constants2.O_DIRECTORY | constants2.O_NOFOLLOW;
|
|
22235
22310
|
}
|
|
22236
|
-
return
|
|
22311
|
+
return constants2.O_RDONLY | constants2.O_NOFOLLOW | constants2.O_NONBLOCK;
|
|
22237
22312
|
}
|
|
22238
22313
|
async function openConfinedUsing(root, logicalPath, ops) {
|
|
22239
22314
|
const normalized = normalizeLogicalPath(logicalPath);
|
|
@@ -22243,7 +22318,7 @@ async function openConfinedUsing(root, logicalPath, ops) {
|
|
|
22243
22318
|
try {
|
|
22244
22319
|
const canonicalRoot = await realpath(root);
|
|
22245
22320
|
parent = fromNodeHandle(
|
|
22246
|
-
await
|
|
22321
|
+
await open2(canonicalRoot, constants2.O_RDONLY | constants2.O_DIRECTORY)
|
|
22247
22322
|
);
|
|
22248
22323
|
for (let index = 0; index < components.length - 1; index += 1) {
|
|
22249
22324
|
const component = components[index] ?? "";
|
|
@@ -22561,7 +22636,7 @@ async function writeFileAtomic(path2, data, mode) {
|
|
|
22561
22636
|
let created = false;
|
|
22562
22637
|
let handle;
|
|
22563
22638
|
try {
|
|
22564
|
-
handle = await
|
|
22639
|
+
handle = await open3(tmp, flags, 384);
|
|
22565
22640
|
created = true;
|
|
22566
22641
|
await handle.writeFile(data, "utf8");
|
|
22567
22642
|
await handle.chmod(mode ?? 420);
|
|
@@ -22602,9 +22677,9 @@ function caCertificateMatchesPrivateKey(certPem, keyPem) {
|
|
|
22602
22677
|
async function readNoFollowRegularFile(path2) {
|
|
22603
22678
|
let handle;
|
|
22604
22679
|
try {
|
|
22605
|
-
const info = await
|
|
22680
|
+
const info = await lstat2(path2);
|
|
22606
22681
|
if (!info.isFile()) return void 0;
|
|
22607
|
-
handle = await
|
|
22682
|
+
handle = await open3(path2, fsConstants.O_RDONLY | noFollowFlag());
|
|
22608
22683
|
const opened = await handle.stat();
|
|
22609
22684
|
if (!opened.isFile()) return void 0;
|
|
22610
22685
|
return await handle.readFile({ encoding: "utf8" });
|
|
@@ -22633,7 +22708,7 @@ async function readPreviousRogatioCa(caCertFile) {
|
|
|
22633
22708
|
async function assertReadableIfRegular(path2, snapshot2) {
|
|
22634
22709
|
if (snapshot2 !== void 0) return;
|
|
22635
22710
|
try {
|
|
22636
|
-
const info = await
|
|
22711
|
+
const info = await lstat2(path2);
|
|
22637
22712
|
if (!info.isFile()) return;
|
|
22638
22713
|
} catch {
|
|
22639
22714
|
return;
|
|
@@ -22736,7 +22811,7 @@ function createRequestBodyTrustController(options = {}) {
|
|
|
22736
22811
|
async function readRecordedDirs() {
|
|
22737
22812
|
if (!recordsManifestDirs) return void 0;
|
|
22738
22813
|
try {
|
|
22739
|
-
return parseRecordedDirs(await
|
|
22814
|
+
return parseRecordedDirs(await readFile(manifestRecordPath, "utf8"));
|
|
22740
22815
|
} catch {
|
|
22741
22816
|
return void 0;
|
|
22742
22817
|
}
|
|
@@ -22754,7 +22829,7 @@ function createRequestBodyTrustController(options = {}) {
|
|
|
22754
22829
|
async function snapshotFile(path2) {
|
|
22755
22830
|
let previous;
|
|
22756
22831
|
try {
|
|
22757
|
-
previous = await
|
|
22832
|
+
previous = await readFile(path2, "utf8");
|
|
22758
22833
|
} catch {
|
|
22759
22834
|
previous = void 0;
|
|
22760
22835
|
}
|
|
@@ -22867,8 +22942,8 @@ function createRequestBodyTrustController(options = {}) {
|
|
|
22867
22942
|
async function reusableCaMaterial() {
|
|
22868
22943
|
try {
|
|
22869
22944
|
const [keyStat, certStat] = await Promise.all([
|
|
22870
|
-
|
|
22871
|
-
|
|
22945
|
+
lstat2(caKeyFile),
|
|
22946
|
+
lstat2(caCertFile)
|
|
22872
22947
|
]);
|
|
22873
22948
|
if (!keyStat.isFile() || !certStat.isFile()) return false;
|
|
22874
22949
|
if (process.platform !== "win32") {
|
|
@@ -22877,8 +22952,8 @@ function createRequestBodyTrustController(options = {}) {
|
|
|
22877
22952
|
if (uid !== void 0 && keyStat.uid !== uid) return false;
|
|
22878
22953
|
}
|
|
22879
22954
|
const [certPem, keyPem] = await Promise.all([
|
|
22880
|
-
|
|
22881
|
-
|
|
22955
|
+
readFile(caCertFile, "utf8"),
|
|
22956
|
+
readFile(caKeyFile, "utf8")
|
|
22882
22957
|
]);
|
|
22883
22958
|
return caCertificateMatchesPrivateKey(certPem, keyPem);
|
|
22884
22959
|
} catch {
|
|
@@ -22992,7 +23067,7 @@ function createRequestBodyTrustController(options = {}) {
|
|
|
22992
23067
|
let installedNew = false;
|
|
22993
23068
|
if (caTrustInstaller && !installerCalled) {
|
|
22994
23069
|
installerCalled = true;
|
|
22995
|
-
await caTrustInstaller(await
|
|
23070
|
+
await caTrustInstaller(await readFile(caCertFile, "utf8"));
|
|
22996
23071
|
installedNew = true;
|
|
22997
23072
|
}
|
|
22998
23073
|
if (reusable && siblingAnchor && (installedNew || !caTrustInstaller)) {
|
|
@@ -23085,7 +23160,7 @@ function createRequestBodyTrustController(options = {}) {
|
|
|
23085
23160
|
let installed = dirs.length > 0;
|
|
23086
23161
|
for (const dir of dirs) {
|
|
23087
23162
|
try {
|
|
23088
|
-
const raw = await
|
|
23163
|
+
const raw = await readFile(join2(dir, `${hostName}.json`), "utf8");
|
|
23089
23164
|
const parsed = JSON.parse(raw);
|
|
23090
23165
|
if (!isWellFormedManifest(parsed) || !manifestAcceptable(parsed)) {
|
|
23091
23166
|
installed = false;
|
|
@@ -23117,7 +23192,7 @@ function createRequestBodyTrustController(options = {}) {
|
|
|
23117
23192
|
let binaryPath;
|
|
23118
23193
|
for (const dir of dirs) {
|
|
23119
23194
|
try {
|
|
23120
|
-
const raw = await
|
|
23195
|
+
const raw = await readFile(join2(dir, `${hostName}.json`), "utf8");
|
|
23121
23196
|
const parsed = JSON.parse(raw);
|
|
23122
23197
|
if (!isWellFormedManifest(parsed) || !manifestAcceptable(parsed)) {
|
|
23123
23198
|
manifestValid = false;
|
|
@@ -23168,14 +23243,14 @@ function createRequestBodyTrustController(options = {}) {
|
|
|
23168
23243
|
return { install, uninstall, status, verify: verify2 };
|
|
23169
23244
|
}
|
|
23170
23245
|
var INSTALL_CERT_NAME = "ca.crt";
|
|
23171
|
-
function
|
|
23246
|
+
function optionalFlag2(flag) {
|
|
23172
23247
|
return typeof flag === "number" ? flag : 0;
|
|
23173
23248
|
}
|
|
23174
23249
|
function exclusiveWriteFlags() {
|
|
23175
|
-
return
|
|
23250
|
+
return constants3.O_WRONLY | constants3.O_CREAT | constants3.O_EXCL | constants3.O_TRUNC | optionalFlag2(constants3.O_NOFOLLOW);
|
|
23176
23251
|
}
|
|
23177
|
-
function
|
|
23178
|
-
return
|
|
23252
|
+
function readFlags2() {
|
|
23253
|
+
return constants3.O_RDONLY | optionalFlag2(constants3.O_NOFOLLOW) | optionalFlag2(constants3.O_NONBLOCK);
|
|
23179
23254
|
}
|
|
23180
23255
|
function refuseCertificateFile(message) {
|
|
23181
23256
|
throw new TrustError("trust.internal", message, [
|
|
@@ -23183,7 +23258,7 @@ function refuseCertificateFile(message) {
|
|
|
23183
23258
|
]);
|
|
23184
23259
|
}
|
|
23185
23260
|
async function writeExclusiveCertificate(certPath, pem) {
|
|
23186
|
-
const handle = await
|
|
23261
|
+
const handle = await open4(certPath, exclusiveWriteFlags(), 384);
|
|
23187
23262
|
try {
|
|
23188
23263
|
await handle.writeFile(Buffer.from(pem, "utf8"));
|
|
23189
23264
|
await handle.chmod(384);
|
|
@@ -23194,7 +23269,7 @@ async function writeExclusiveCertificate(certPath, pem) {
|
|
|
23194
23269
|
async function assertCertificateReady(certPath, pem) {
|
|
23195
23270
|
let info;
|
|
23196
23271
|
try {
|
|
23197
|
-
info = await
|
|
23272
|
+
info = await lstat3(certPath);
|
|
23198
23273
|
} catch {
|
|
23199
23274
|
refuseCertificateFile("certificate file is not a regular file");
|
|
23200
23275
|
}
|
|
@@ -23203,7 +23278,7 @@ async function assertCertificateReady(certPath, pem) {
|
|
|
23203
23278
|
}
|
|
23204
23279
|
let handle;
|
|
23205
23280
|
try {
|
|
23206
|
-
handle = await
|
|
23281
|
+
handle = await open4(certPath, readFlags2());
|
|
23207
23282
|
const opened = await handle.stat();
|
|
23208
23283
|
if (!opened.isFile() || opened.isFIFO() || opened.isSymbolicLink()) {
|
|
23209
23284
|
refuseCertificateFile("certificate file is not a regular file");
|
|
@@ -23283,12 +23358,12 @@ var darwinAdapter = {
|
|
|
23283
23358
|
reasons.push("tooling-missing");
|
|
23284
23359
|
}
|
|
23285
23360
|
try {
|
|
23286
|
-
accessSync(manifestDir,
|
|
23361
|
+
accessSync(manifestDir, constants4.W_OK);
|
|
23287
23362
|
} catch {
|
|
23288
23363
|
reasons.push("manifest-dir-unwritable");
|
|
23289
23364
|
}
|
|
23290
23365
|
try {
|
|
23291
|
-
accessSync(caDir,
|
|
23366
|
+
accessSync(caDir, constants4.W_OK);
|
|
23292
23367
|
} catch {
|
|
23293
23368
|
reasons.push("keychain-unwritable");
|
|
23294
23369
|
}
|
|
@@ -23425,7 +23500,7 @@ function exists(path2) {
|
|
|
23425
23500
|
}
|
|
23426
23501
|
function writable(path2) {
|
|
23427
23502
|
try {
|
|
23428
|
-
accessSync2(path2,
|
|
23503
|
+
accessSync2(path2, constants5.W_OK);
|
|
23429
23504
|
return true;
|
|
23430
23505
|
} catch {
|
|
23431
23506
|
return false;
|
|
@@ -23462,7 +23537,7 @@ function p11kitAnchorsDir() {
|
|
|
23462
23537
|
function needsElevation(dir) {
|
|
23463
23538
|
if (writable(dir)) return false;
|
|
23464
23539
|
try {
|
|
23465
|
-
accessSync2(dir,
|
|
23540
|
+
accessSync2(dir, constants5.W_OK);
|
|
23466
23541
|
} catch (err) {
|
|
23467
23542
|
if (nodeCode(err) === "ENOENT" && writable(dirname4(dir))) return false;
|
|
23468
23543
|
}
|
|
@@ -23479,13 +23554,13 @@ function manifestDirFor(browser) {
|
|
|
23479
23554
|
}
|
|
23480
23555
|
function canHostManifest(dir) {
|
|
23481
23556
|
try {
|
|
23482
|
-
accessSync2(dir,
|
|
23557
|
+
accessSync2(dir, constants5.W_OK);
|
|
23483
23558
|
return true;
|
|
23484
23559
|
} catch (err) {
|
|
23485
23560
|
if (nodeCode(err) !== "ENOENT") return false;
|
|
23486
23561
|
}
|
|
23487
23562
|
try {
|
|
23488
|
-
accessSync2(dirname4(dir),
|
|
23563
|
+
accessSync2(dirname4(dir), constants5.W_OK);
|
|
23489
23564
|
return true;
|
|
23490
23565
|
} catch {
|
|
23491
23566
|
return false;
|
|
@@ -23676,7 +23751,7 @@ var win32Adapter = {
|
|
|
23676
23751
|
reasons.push("tooling-missing");
|
|
23677
23752
|
}
|
|
23678
23753
|
try {
|
|
23679
|
-
accessSync3(manifestDir,
|
|
23754
|
+
accessSync3(manifestDir, constants6.W_OK);
|
|
23680
23755
|
} catch {
|
|
23681
23756
|
reasons.push("manifest-dir-unwritable");
|
|
23682
23757
|
}
|
|
@@ -23899,13 +23974,16 @@ function generatePacScript(routes, endpoint, options) {
|
|
|
23899
23974
|
""
|
|
23900
23975
|
].join("\n");
|
|
23901
23976
|
}
|
|
23977
|
+
function schemaDiagnosticCode(keyword) {
|
|
23978
|
+
return keyword.startsWith("schema.") ? keyword : `schema.${keyword}`;
|
|
23979
|
+
}
|
|
23902
23980
|
function diagnoseProjectData(projectData) {
|
|
23903
23981
|
const diagnostics = [];
|
|
23904
23982
|
const schemaResult = validateProjectDetailed(projectData);
|
|
23905
23983
|
if (!schemaResult.valid) {
|
|
23906
23984
|
for (const error of schemaResult.errors) {
|
|
23907
23985
|
diagnostics.push({
|
|
23908
|
-
code:
|
|
23986
|
+
code: schemaDiagnosticCode(error.keyword),
|
|
23909
23987
|
severity: "error",
|
|
23910
23988
|
path: error.instancePath || "/",
|
|
23911
23989
|
message: error.message,
|
|
@@ -24664,7 +24742,7 @@ async function resolveConfinedRoot(value) {
|
|
|
24664
24742
|
}
|
|
24665
24743
|
let directory;
|
|
24666
24744
|
try {
|
|
24667
|
-
directory = await
|
|
24745
|
+
directory = await open5(value, constants7.O_RDONLY | constants7.O_DIRECTORY);
|
|
24668
24746
|
const info = await directory.stat();
|
|
24669
24747
|
if (!info.isDirectory()) return failure("runtime.root-invalid");
|
|
24670
24748
|
return { ok: true, value: await realpath2(value) };
|
|
@@ -28802,11 +28880,11 @@ import {
|
|
|
28802
28880
|
access,
|
|
28803
28881
|
mkdir as mkdir3,
|
|
28804
28882
|
readdir,
|
|
28805
|
-
readFile as
|
|
28883
|
+
readFile as readFile2,
|
|
28806
28884
|
rename as rename2,
|
|
28807
28885
|
stat as stat2,
|
|
28808
28886
|
unlink as unlink2,
|
|
28809
|
-
writeFile
|
|
28887
|
+
writeFile
|
|
28810
28888
|
} from "node:fs/promises";
|
|
28811
28889
|
import { basename as basename2, dirname as dirname5, join as join7 } from "node:path";
|
|
28812
28890
|
var ProjectStorageError = class extends Error {
|
|
@@ -28904,7 +28982,7 @@ function isJsonFilename(name) {
|
|
|
28904
28982
|
async function isDiscoverableProjectFile(id2) {
|
|
28905
28983
|
let parsed;
|
|
28906
28984
|
try {
|
|
28907
|
-
parsed = JSON.parse(await
|
|
28985
|
+
parsed = JSON.parse(await readFile2(id2, "utf-8"));
|
|
28908
28986
|
} catch {
|
|
28909
28987
|
return false;
|
|
28910
28988
|
}
|
|
@@ -28968,7 +29046,7 @@ function migrateLoadedProject(parsed) {
|
|
|
28968
29046
|
}
|
|
28969
29047
|
async function readDocument(id2) {
|
|
28970
29048
|
try {
|
|
28971
|
-
const content = await
|
|
29049
|
+
const content = await readFile2(id2, "utf-8");
|
|
28972
29050
|
const parsed = JSON.parse(content);
|
|
28973
29051
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
28974
29052
|
throw new ProjectFileError(
|
|
@@ -29023,7 +29101,7 @@ async function writeDocument(id2, data) {
|
|
|
29023
29101
|
);
|
|
29024
29102
|
}
|
|
29025
29103
|
await mkdir3(dirname5(id2), { recursive: true });
|
|
29026
|
-
await
|
|
29104
|
+
await writeFile(tempPath, JSON.stringify(data, null, 2), "utf-8");
|
|
29027
29105
|
await rename2(tempPath, id2);
|
|
29028
29106
|
} catch (e) {
|
|
29029
29107
|
if (e instanceof ProjectFileError) throw e;
|
|
@@ -29699,7 +29777,7 @@ function createServer3(handler, options = {}) {
|
|
|
29699
29777
|
|
|
29700
29778
|
// packages/cli/src/server/routes.ts
|
|
29701
29779
|
import { randomBytes as randomBytes4, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
|
|
29702
|
-
import { readFile as
|
|
29780
|
+
import { readFile as readFile4 } from "node:fs/promises";
|
|
29703
29781
|
import { dirname as dirname9, isAbsolute as isAbsolute5, resolve as resolve5 } from "node:path";
|
|
29704
29782
|
|
|
29705
29783
|
// packages/dry-run/dist/node/index.js
|
|
@@ -30072,7 +30150,7 @@ function previewRuleAction(operation, url) {
|
|
|
30072
30150
|
}
|
|
30073
30151
|
|
|
30074
30152
|
// packages/cli/src/mock-root-config.ts
|
|
30075
|
-
import { mkdir as mkdir4, readFile as
|
|
30153
|
+
import { mkdir as mkdir4, readFile as readFile3, realpath as realpath3, rename as rename3, writeFile as writeFile2 } from "node:fs/promises";
|
|
30076
30154
|
import { homedir } from "node:os";
|
|
30077
30155
|
import { dirname as dirname8, isAbsolute as isAbsolute4, join as join8, resolve as resolve4 } from "node:path";
|
|
30078
30156
|
function mockRootConfigPath(env = process.env) {
|
|
@@ -30090,7 +30168,7 @@ async function canonicalProjectPath(filePath) {
|
|
|
30090
30168
|
async function readMap(env) {
|
|
30091
30169
|
let raw;
|
|
30092
30170
|
try {
|
|
30093
|
-
raw = await
|
|
30171
|
+
raw = await readFile3(mockRootConfigPath(env), "utf8");
|
|
30094
30172
|
} catch {
|
|
30095
30173
|
return {};
|
|
30096
30174
|
}
|
|
@@ -30118,7 +30196,7 @@ async function writeMap(map, env) {
|
|
|
30118
30196
|
const path2 = mockRootConfigPath(env);
|
|
30119
30197
|
await mkdir4(dirname8(path2), { recursive: true });
|
|
30120
30198
|
const temporary = `${path2}.${process.pid}.tmp`;
|
|
30121
|
-
await
|
|
30199
|
+
await writeFile2(
|
|
30122
30200
|
temporary,
|
|
30123
30201
|
`${JSON.stringify({ projects: map }, null, 2)}
|
|
30124
30202
|
`,
|
|
@@ -30331,7 +30409,7 @@ function createRoutes(context) {
|
|
|
30331
30409
|
}
|
|
30332
30410
|
if (pathname === "/vendor/editor.js" && method === "GET") {
|
|
30333
30411
|
try {
|
|
30334
|
-
const bundle = await
|
|
30412
|
+
const bundle = await readFile4(context.editorBundlePath, "utf-8");
|
|
30335
30413
|
res.writeHead(200, {
|
|
30336
30414
|
"Content-Type": "text/javascript; charset=utf-8"
|
|
30337
30415
|
});
|
|
@@ -30349,7 +30427,7 @@ function createRoutes(context) {
|
|
|
30349
30427
|
}
|
|
30350
30428
|
if (pathname === "/vendor/editor.css" && method === "GET") {
|
|
30351
30429
|
try {
|
|
30352
|
-
const css = await
|
|
30430
|
+
const css = await readFile4(context.editorCssPath, "utf-8");
|
|
30353
30431
|
res.writeHead(200, {
|
|
30354
30432
|
"Content-Type": "text/css; charset=utf-8"
|
|
30355
30433
|
});
|
|
@@ -30373,7 +30451,7 @@ function createRoutes(context) {
|
|
|
30373
30451
|
return;
|
|
30374
30452
|
}
|
|
30375
30453
|
try {
|
|
30376
|
-
const font = await
|
|
30454
|
+
const font = await readFile4(resolve5(context.editorFontsPath, fileName));
|
|
30377
30455
|
res.writeHead(200, {
|
|
30378
30456
|
"Content-Type": "font/woff2"
|
|
30379
30457
|
});
|
|
@@ -31503,7 +31581,7 @@ function generateEditorHtml(filePath, aiConfigured) {
|
|
|
31503
31581
|
}
|
|
31504
31582
|
|
|
31505
31583
|
// packages/cli/src/commands/import.ts
|
|
31506
|
-
import { access as access2, readFile as
|
|
31584
|
+
import { access as access2, readFile as readFile5 } from "node:fs/promises";
|
|
31507
31585
|
import { resolve as resolve7 } from "node:path";
|
|
31508
31586
|
|
|
31509
31587
|
// packages/requestly-import/dist/node/index.js
|
|
@@ -33359,7 +33437,7 @@ async function importCommand(args) {
|
|
|
33359
33437
|
const flags = parsed.flags;
|
|
33360
33438
|
let exportData;
|
|
33361
33439
|
try {
|
|
33362
|
-
exportData = JSON.parse(await
|
|
33440
|
+
exportData = JSON.parse(await readFile5(flags.sourcePath, "utf8"));
|
|
33363
33441
|
} catch (error) {
|
|
33364
33442
|
console.error(`Error: ${errorMessage(error)}`);
|
|
33365
33443
|
return 2;
|
|
@@ -33378,7 +33456,7 @@ async function importCommand(args) {
|
|
|
33378
33456
|
}
|
|
33379
33457
|
let existing;
|
|
33380
33458
|
try {
|
|
33381
|
-
existing = JSON.parse(await
|
|
33459
|
+
existing = JSON.parse(await readFile5(flags.outputPath, "utf8"));
|
|
33382
33460
|
} catch (error) {
|
|
33383
33461
|
console.error(`Error: ${errorMessage(error)}`);
|
|
33384
33462
|
return 2;
|
|
@@ -33517,7 +33595,7 @@ function errorMessage(error) {
|
|
|
33517
33595
|
}
|
|
33518
33596
|
|
|
33519
33597
|
// packages/cli/src/commands/runtime.ts
|
|
33520
|
-
import { chmod, mkdir as mkdir5, rm as rm4, writeFile as
|
|
33598
|
+
import { chmod as chmod2, mkdir as mkdir5, rm as rm4, writeFile as writeFile3 } from "node:fs/promises";
|
|
33521
33599
|
import { dirname as dirname10, join as join9, resolve as resolve8 } from "node:path";
|
|
33522
33600
|
function generateHostWrapper(rogatioCommand, logPath) {
|
|
33523
33601
|
const parts = rogatioCommand.split(" ");
|
|
@@ -33538,8 +33616,8 @@ async function writeHostWrapper(hostPath, installRoot) {
|
|
|
33538
33616
|
`${process.execPath} ${process.argv[1] ?? "rogatio"}`,
|
|
33539
33617
|
logPath
|
|
33540
33618
|
);
|
|
33541
|
-
await
|
|
33542
|
-
await
|
|
33619
|
+
await writeFile3(hostPath, script, "utf8");
|
|
33620
|
+
await chmod2(hostPath, 493);
|
|
33543
33621
|
}
|
|
33544
33622
|
function makeTrustController() {
|
|
33545
33623
|
return createInstalledTrustController();
|
|
@@ -33764,7 +33842,7 @@ async function runtimeHostCommand(args, options = {}) {
|
|
|
33764
33842
|
if (!schemaResult.valid) {
|
|
33765
33843
|
for (const issue of schemaResult.errors) {
|
|
33766
33844
|
console.error(
|
|
33767
|
-
`${issue.instancePath || "/"}/: ${issue.message} (
|
|
33845
|
+
`${issue.instancePath || "/"}/: ${issue.message} (${schemaDiagnosticCode(issue.keyword)})`
|
|
33768
33846
|
);
|
|
33769
33847
|
}
|
|
33770
33848
|
return 1;
|
|
@@ -33831,7 +33909,7 @@ async function runRuntimeHostEntry() {
|
|
|
33831
33909
|
}
|
|
33832
33910
|
|
|
33833
33911
|
// packages/cli/src/commands/test.ts
|
|
33834
|
-
import { readFile as
|
|
33912
|
+
import { readFile as readFile6 } from "node:fs/promises";
|
|
33835
33913
|
import { resolve as resolve9 } from "node:path";
|
|
33836
33914
|
function usageError(message) {
|
|
33837
33915
|
return `Error: ${message}
|
|
@@ -33989,7 +34067,7 @@ async function testCommandImpl(args, stdinInput, captureOutput, options = {}) {
|
|
|
33989
34067
|
for (const url of positionalUrls) urlCases.push({ url });
|
|
33990
34068
|
if (urlsFile) {
|
|
33991
34069
|
try {
|
|
33992
|
-
const content = urlsFile === "-" ? stdinInput ?? "" : await
|
|
34070
|
+
const content = urlsFile === "-" ? stdinInput ?? "" : await readFile6(urlsFile, "utf8");
|
|
33993
34071
|
const parsed = JSON.parse(content);
|
|
33994
34072
|
if (!Array.isArray(parsed)) {
|
|
33995
34073
|
const output = usageError(`${urlsFile} must contain a JSON array`);
|
package/package.json
CHANGED