@rogatio/cli 5.2.2 → 5.2.4
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/node/index.js +104 -159
- package/package.json +1 -1
package/dist/node/index.js
CHANGED
|
@@ -22025,7 +22025,7 @@ var darwin_default = darwinAdapter;
|
|
|
22025
22025
|
var CA_DIR = "/usr/local/share/ca-certificates";
|
|
22026
22026
|
var CERT_PATH = posixJoin2(CA_DIR, "rogatio-ca.crt");
|
|
22027
22027
|
function hasSudo() {
|
|
22028
|
-
const result = spawnSync2("
|
|
22028
|
+
const result = spawnSync2("which", ["sudo"], { timeout: 1e3 });
|
|
22029
22029
|
return result.status === 0;
|
|
22030
22030
|
}
|
|
22031
22031
|
var linuxAdapter = {
|
|
@@ -22257,7 +22257,102 @@ function selectTrustPlatformAdapter(platform) {
|
|
|
22257
22257
|
}
|
|
22258
22258
|
}
|
|
22259
22259
|
|
|
22260
|
-
// packages/cli/src/
|
|
22260
|
+
// packages/cli/src/help.ts
|
|
22261
|
+
function showEditHelp() {
|
|
22262
|
+
console.log(`Usage: rogatio edit [options] [path]
|
|
22263
|
+
|
|
22264
|
+
Launch browser-based editor for .rogatio.json project file.
|
|
22265
|
+
|
|
22266
|
+
Arguments:
|
|
22267
|
+
path Path to .rogatio.json (default: .rogatio.json in current directory)
|
|
22268
|
+
|
|
22269
|
+
Options:
|
|
22270
|
+
--port <n> Fixed port for editor server (default: random)
|
|
22271
|
+
--help, -h Show this help
|
|
22272
|
+
|
|
22273
|
+
The editor runs in your default browser and communicates with a local server
|
|
22274
|
+
bound to 127.0.0.1. Changes are saved atomically to the project file.`);
|
|
22275
|
+
}
|
|
22276
|
+
function showVerifyHelp() {
|
|
22277
|
+
console.log(`Usage: rogatio verify [options] [path]
|
|
22278
|
+
|
|
22279
|
+
Validate a .rogatio.json project file using schema and compiler.
|
|
22280
|
+
|
|
22281
|
+
Arguments:
|
|
22282
|
+
path Path to .rogatio.json (default: .rogatio.json in current directory)
|
|
22283
|
+
Use '-' to read from stdin
|
|
22284
|
+
|
|
22285
|
+
Options:
|
|
22286
|
+
--json Output diagnostics as JSON
|
|
22287
|
+
--help, -h Show this help
|
|
22288
|
+
|
|
22289
|
+
Exit codes:
|
|
22290
|
+
0 Valid (no diagnostics)
|
|
22291
|
+
1 Invalid (diagnostics present)
|
|
22292
|
+
2 Error (IO, parse, or unexpected failure)`);
|
|
22293
|
+
}
|
|
22294
|
+
function showRuntimeHelp() {
|
|
22295
|
+
console.log(`Usage: rogatio runtime <command> [options]
|
|
22296
|
+
rogatio runtime host [path]
|
|
22297
|
+
|
|
22298
|
+
Native messaging runtime control for response-body and request-body rules.
|
|
22299
|
+
|
|
22300
|
+
Commands:
|
|
22301
|
+
install Install the native-messaging host manifest and (on capable
|
|
22302
|
+
platforms) provision the device-local CA (requires --extension-id).
|
|
22303
|
+
CA trust requires root/admin privileges (Linux: sudo, macOS: keychain
|
|
22304
|
+
password, Windows: Administrator).
|
|
22305
|
+
uninstall Remove the native-messaging host manifest and device-local CA trust
|
|
22306
|
+
(idempotent).
|
|
22307
|
+
host [path] Run the native-messaging runtime host. The browser launches this
|
|
22308
|
+
process via the native-messaging manifest to handle rule matching.
|
|
22309
|
+
|
|
22310
|
+
The lifecycle of the runtime (start/stop) is driven from the extension's
|
|
22311
|
+
Start/Stop controls, not the CLI. Run 'rogatio runtime install --extension-id
|
|
22312
|
+
<id>' once to register the host, then use the extension.
|
|
22313
|
+
|
|
22314
|
+
Options:
|
|
22315
|
+
--extension-id Extension ID for native messaging manifest (required for install)
|
|
22316
|
+
--root <dir> Root for confined file mocks (default: project directory)
|
|
22317
|
+
--help, -h Show this help
|
|
22318
|
+
|
|
22319
|
+
Exit codes:
|
|
22320
|
+
0 Stopped cleanly / success
|
|
22321
|
+
1 Invalid project (diagnostics present) or file outside the root
|
|
22322
|
+
2 Error (IO or usage)`);
|
|
22323
|
+
}
|
|
22324
|
+
function showTestHelp() {
|
|
22325
|
+
console.log(`Usage: rogatio test [options] [path] [url...]
|
|
22326
|
+
|
|
22327
|
+
Run offline dry-run tests against a .rogatio.json project file.
|
|
22328
|
+
|
|
22329
|
+
Arguments:
|
|
22330
|
+
path Path to .rogatio.json (default: .rogatio.json in current directory)
|
|
22331
|
+
Use '-' to read project JSON from stdin
|
|
22332
|
+
url... URLs to test; when path is omitted, first URL is detected automatically
|
|
22333
|
+
|
|
22334
|
+
Options:
|
|
22335
|
+
--urls <list> Comma-separated list of URLs to test
|
|
22336
|
+
--urls-file <path> Path to JSON file containing array of test cases
|
|
22337
|
+
Each case: { "url": "...", "method"?: "...", "resourceType"?: "..." }
|
|
22338
|
+
Use '-' to read from stdin
|
|
22339
|
+
--method <m> Default HTTP method for all test cases (GET, POST, etc.)
|
|
22340
|
+
--resource-type <t> Default resource type for all test cases
|
|
22341
|
+
--max-cases <n> Maximum number of test cases (default: 256)
|
|
22342
|
+
--json Output results as JSON
|
|
22343
|
+
--help, -h Show this help
|
|
22344
|
+
|
|
22345
|
+
Test case format (JSON):
|
|
22346
|
+
[
|
|
22347
|
+
{ "url": "https://example.com/", "method": "GET", "resourceType": "main_frame" },
|
|
22348
|
+
{ "url": "https://example.com/script.js" }
|
|
22349
|
+
]
|
|
22350
|
+
|
|
22351
|
+
Exit codes:
|
|
22352
|
+
0 Success (all valid, results may include non-matches)
|
|
22353
|
+
1 Validation/compile/test errors
|
|
22354
|
+
2 Usage error (invalid arguments, missing input)`);
|
|
22355
|
+
}
|
|
22261
22356
|
function showAIHelp() {
|
|
22262
22357
|
console.log(`Usage: rogatio ai <command> [options]
|
|
22263
22358
|
|
|
@@ -22273,6 +22368,8 @@ Commands:
|
|
|
22273
22368
|
Options:
|
|
22274
22369
|
--help, -h Show this help`);
|
|
22275
22370
|
}
|
|
22371
|
+
|
|
22372
|
+
// packages/cli/src/commands/ai.ts
|
|
22276
22373
|
async function promptInput(prompt) {
|
|
22277
22374
|
process.stdout.write(prompt);
|
|
22278
22375
|
for await (const chunk of process.stdin) {
|
|
@@ -23921,10 +24018,7 @@ async function editCommand(args, options = {}) {
|
|
|
23921
24018
|
} else if (!arg.startsWith("-")) {
|
|
23922
24019
|
positionalArgs.push(arg);
|
|
23923
24020
|
} else if (arg === "--help") {
|
|
23924
|
-
|
|
23925
|
-
Options:
|
|
23926
|
-
--port <n> Fixed port (default: random)
|
|
23927
|
-
--help Show help`);
|
|
24021
|
+
showEditHelp();
|
|
23928
24022
|
return { exitCode: Promise.resolve(0), shutdown: () => {
|
|
23929
24023
|
} };
|
|
23930
24024
|
} else {
|
|
@@ -24243,39 +24337,6 @@ function generateEditorHtml(apiBase, csrfToken, filePath, aiConfigured) {
|
|
|
24243
24337
|
|
|
24244
24338
|
// packages/cli/src/commands/runtime.ts
|
|
24245
24339
|
import { dirname as dirname7, isAbsolute, join as join6, relative, resolve as resolve5, sep as sep2 } from "node:path";
|
|
24246
|
-
function showRuntimeHelp() {
|
|
24247
|
-
console.log(`Usage: rogatio runtime <command> [options]
|
|
24248
|
-
rogatio runtime host [path]
|
|
24249
|
-
|
|
24250
|
-
Native messaging runtime control for response-body and request-body rules. The
|
|
24251
|
-
runtime no longer serves an HTTP mock server; mock delivery happens in the
|
|
24252
|
-
consolidated native-messaging host (spec REQ-001..REQ-005).
|
|
24253
|
-
|
|
24254
|
-
Request-body trust commands:
|
|
24255
|
-
install Install the native-messaging host manifest and (on capable
|
|
24256
|
-
platforms) provision the device-local CA (requires --extension-id).
|
|
24257
|
-
CA trust requires root/admin: Linux (sudo), macOS (keychain
|
|
24258
|
-
password), Windows (Administrator).
|
|
24259
|
-
uninstall Remove the native-messaging host manifest and the device-local CA trust (idempotent)
|
|
24260
|
-
|
|
24261
|
-
Native host command:
|
|
24262
|
-
host [path] Run the consolidated native-messaging runtime host. The browser
|
|
24263
|
-
launches this process via the native-messaging manifest; it reads
|
|
24264
|
-
pairing/authorization/mock envelopes from stdin and writes
|
|
24265
|
-
responses to stdout.
|
|
24266
|
-
|
|
24267
|
-
The lifecycle of the runtime (start/stop) is driven from the extension's
|
|
24268
|
-
Start/Stop controls, not the CLI. Run 'rogatio runtime install --extension-id
|
|
24269
|
-
<id>' once to register the host, then use the extension.
|
|
24270
|
-
|
|
24271
|
-
Options:
|
|
24272
|
-
--extension-id Extension ID for native messaging manifest (required for install)
|
|
24273
|
-
--root <dir> Root for confined file mocks (default: project directory)
|
|
24274
|
-
--help, -h Show this help
|
|
24275
|
-
|
|
24276
|
-
The device-local CA / PAC routing capability is invoked from the unified
|
|
24277
|
-
install command on capable platforms; it does not have a separate verb.`);
|
|
24278
|
-
}
|
|
24279
24340
|
function toMatcherOperations2(operations) {
|
|
24280
24341
|
return operations.map(({ groupId, ruleId, matcher }) => ({
|
|
24281
24342
|
kind: "matcher",
|
|
@@ -24994,7 +25055,7 @@ async function handleVerify(args) {
|
|
|
24994
25055
|
}
|
|
24995
25056
|
async function handleRuntime(args) {
|
|
24996
25057
|
if (args.includes("--help") || args.includes("-h")) {
|
|
24997
|
-
|
|
25058
|
+
showRuntimeHelp();
|
|
24998
25059
|
return 0;
|
|
24999
25060
|
}
|
|
25000
25061
|
const result = await runtimeCommand(args);
|
|
@@ -25002,7 +25063,7 @@ async function handleRuntime(args) {
|
|
|
25002
25063
|
}
|
|
25003
25064
|
async function handleAI(args) {
|
|
25004
25065
|
if (args.includes("--help") || args.includes("-h")) {
|
|
25005
|
-
|
|
25066
|
+
showAIHelp();
|
|
25006
25067
|
return 0;
|
|
25007
25068
|
}
|
|
25008
25069
|
return await aiCommand(args);
|
|
@@ -25039,8 +25100,8 @@ Commands:
|
|
|
25039
25100
|
edit [path] Launch browser editor for .rogatio.json
|
|
25040
25101
|
test [path] [url...] Run offline dry-run tests against .rogatio.json
|
|
25041
25102
|
verify [path] Validate .rogatio.json file
|
|
25042
|
-
runtime <install|uninstall|host> Native messaging runtime control
|
|
25043
|
-
runtime host [path] Run the
|
|
25103
|
+
runtime <install|uninstall|host> Native messaging runtime control
|
|
25104
|
+
runtime host [path] Run the native-messaging runtime host
|
|
25044
25105
|
|
|
25045
25106
|
Global Options:
|
|
25046
25107
|
--help, -h Show help
|
|
@@ -25049,122 +25110,6 @@ Global Options:
|
|
|
25049
25110
|
Run 'rogatio <command> --help' for command-specific help.`);
|
|
25050
25111
|
return 0;
|
|
25051
25112
|
}
|
|
25052
|
-
function showEditHelp() {
|
|
25053
|
-
console.log(`Usage: rogatio edit [options] [path]
|
|
25054
|
-
|
|
25055
|
-
Launch browser-based editor for .rogatio.json project file.
|
|
25056
|
-
|
|
25057
|
-
Arguments:
|
|
25058
|
-
path Path to .rogatio.json (default: .rogatio.json in current directory)
|
|
25059
|
-
|
|
25060
|
-
Options:
|
|
25061
|
-
--port <n> Fixed port for editor server (default: random)
|
|
25062
|
-
--help, -h Show this help
|
|
25063
|
-
|
|
25064
|
-
The editor runs in your default browser and communicates with a local server
|
|
25065
|
-
bound to 127.0.0.1. Changes are saved atomically to the project file.`);
|
|
25066
|
-
}
|
|
25067
|
-
function showVerifyHelp() {
|
|
25068
|
-
console.log(`Usage: rogatio verify [options] [path]
|
|
25069
|
-
|
|
25070
|
-
Validate a .rogatio.json project file using schema and compiler.
|
|
25071
|
-
|
|
25072
|
-
Arguments:
|
|
25073
|
-
path Path to .rogatio.json (default: .rogatio.json in current directory)
|
|
25074
|
-
Use '-' to read from stdin
|
|
25075
|
-
|
|
25076
|
-
Options:
|
|
25077
|
-
--json Output diagnostics as JSON
|
|
25078
|
-
--help, -h Show this help
|
|
25079
|
-
|
|
25080
|
-
Exit codes:
|
|
25081
|
-
0 Valid (no diagnostics)
|
|
25082
|
-
1 Invalid (diagnostics present)
|
|
25083
|
-
2 Error (IO, parse, or unexpected failure)`);
|
|
25084
|
-
}
|
|
25085
|
-
function showRuntimeHelp2() {
|
|
25086
|
-
console.log(`Usage: rogatio runtime <command> [options]
|
|
25087
|
-
rogatio runtime host [path]
|
|
25088
|
-
|
|
25089
|
-
Native messaging runtime control for response-body and request-body rules. The
|
|
25090
|
-
runtime no longer serves an HTTP mock server; mock delivery happens in the
|
|
25091
|
-
consolidated native-messaging host (spec REQ-001..REQ-005).
|
|
25092
|
-
|
|
25093
|
-
Request-body trust commands:
|
|
25094
|
-
install Install the native-messaging host manifest and (on capable
|
|
25095
|
-
platforms) provision the device-local CA (requires --extension-id)
|
|
25096
|
-
uninstall Remove the native-messaging host manifest and the device-local CA trust (idempotent)
|
|
25097
|
-
|
|
25098
|
-
Native host command:
|
|
25099
|
-
host [path] Run the consolidated native-messaging runtime host. The browser
|
|
25100
|
-
launches this process via the native-messaging manifest; it reads
|
|
25101
|
-
pairing/authorization/mock envelopes from stdin and writes
|
|
25102
|
-
responses to stdout.
|
|
25103
|
-
|
|
25104
|
-
The lifecycle of the runtime (start/stop) is driven from the extension's
|
|
25105
|
-
Start/Stop controls, not the CLI. Run 'rogatio runtime install --extension-id
|
|
25106
|
-
<id>' once to register the host, then use the extension.
|
|
25107
|
-
|
|
25108
|
-
Options:
|
|
25109
|
-
--root <dir> Root for confined file mocks (default: project directory)
|
|
25110
|
-
--extension-id Extension ID for native messaging manifest (required for install)
|
|
25111
|
-
--help, -h Show this help
|
|
25112
|
-
|
|
25113
|
-
The device-local CA / PAC routing capability is invoked from the unified
|
|
25114
|
-
install command on capable platforms; it does not have a separate verb.
|
|
25115
|
-
|
|
25116
|
-
Exit codes:
|
|
25117
|
-
0 Stopped cleanly / success
|
|
25118
|
-
1 Invalid project (diagnostics present) or file outside the root
|
|
25119
|
-
2 Error (IO or usage)`);
|
|
25120
|
-
}
|
|
25121
|
-
function showTestHelp() {
|
|
25122
|
-
console.log(`Usage: rogatio test [options] [path] [url...]
|
|
25123
|
-
|
|
25124
|
-
Run offline dry-run tests against a .rogatio.json project file.
|
|
25125
|
-
|
|
25126
|
-
Arguments:
|
|
25127
|
-
path Path to .rogatio.json (default: .rogatio.json in current directory)
|
|
25128
|
-
Use '-' to read project JSON from stdin
|
|
25129
|
-
url... URLs to test; when path is omitted, first URL is detected automatically
|
|
25130
|
-
|
|
25131
|
-
Options:
|
|
25132
|
-
--urls <list> Comma-separated list of URLs to test
|
|
25133
|
-
--urls-file <path> Path to JSON file containing array of test cases
|
|
25134
|
-
Each case: { "url": "...", "method"?: "...", "resourceType"?: "..." }
|
|
25135
|
-
Use '-' to read from stdin
|
|
25136
|
-
--method <m> Default HTTP method for all test cases (GET, POST, etc.)
|
|
25137
|
-
--resource-type <t> Default resource type for all test cases
|
|
25138
|
-
--max-cases <n> Maximum number of test cases (default: 256)
|
|
25139
|
-
--json Output results as JSON
|
|
25140
|
-
--help, -h Show this help
|
|
25141
|
-
|
|
25142
|
-
Test case format (JSON):
|
|
25143
|
-
[
|
|
25144
|
-
{ "url": "https://example.com/", "method": "GET", "resourceType": "main_frame" },
|
|
25145
|
-
{ "url": "https://example.com/script.js" }
|
|
25146
|
-
]
|
|
25147
|
-
|
|
25148
|
-
Exit codes:
|
|
25149
|
-
0 Success (all valid, results may include non-matches)
|
|
25150
|
-
1 Validation/compile/test errors
|
|
25151
|
-
2 Usage error (invalid arguments, missing input)`);
|
|
25152
|
-
}
|
|
25153
|
-
function showAIHelp2() {
|
|
25154
|
-
console.log(`Usage: rogatio ai <command> [options]
|
|
25155
|
-
|
|
25156
|
-
AI provider configuration commands.
|
|
25157
|
-
|
|
25158
|
-
Commands:
|
|
25159
|
-
setup Interactively configure AI provider (URL, model, API key)
|
|
25160
|
-
ls List configured AI provider
|
|
25161
|
-
show Show current AI provider configuration (key redacted)
|
|
25162
|
-
delete Delete AI provider configuration
|
|
25163
|
-
test Test connection to AI provider
|
|
25164
|
-
|
|
25165
|
-
Options:
|
|
25166
|
-
--help, -h Show this help`);
|
|
25167
|
-
}
|
|
25168
25113
|
if (process.argv[1] !== void 0 && realpathSync.native(fileURLToPath2(import.meta.url)) === realpathSync.native(resolve8(process.argv[1]))) {
|
|
25169
25114
|
if (basename4(process.argv[1]) === "runtime-host") {
|
|
25170
25115
|
runRuntimeHostEntry().catch((err) => {
|
package/package.json
CHANGED