@rogatio/cli 6.7.1 → 6.8.0

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
@@ -36,10 +36,10 @@ rogatio <command> [options]
36
36
 
37
37
  | Command | Description |
38
38
  | --- | --- |
39
- | `rogatio edit [path]` | Launch the browser editor for `.rogatio.json`. `--port <n>` fixes the port; `--no-open` skips opening a browser. |
40
- | `rogatio verify [path]` | Validate a `.rogatio.json` file (schema + compiler). |
39
+ | `rogatio edit [path]` | Launch the browser editor. Any filename is accepted; the default is `.rogatio.json` in the current directory. `--port <n>` fixes the port; `--no-open` skips opening a browser. Edits save back to the file that was opened. |
40
+ | `rogatio verify [path]` | Validate a project file (schema + compiler). Any filename is accepted; the default is `.rogatio.json` in the current directory. |
41
41
  | `rogatio import requestly <export.json>` | Migrate a Requestly export into `.rogatio.json`. `--out <path>` chooses the file (default `.rogatio.json`); `--merge` appends onto an existing project; `--json` prints the report. |
42
- | `rogatio test [path] [url...]` | Run offline dry-run tests against `.rogatio.json`. |
42
+ | `rogatio test [path] [url...]` | Run offline dry-run tests. Any filename is accepted; the default is `.rogatio.json` in the current directory. |
43
43
  | `rogatio ai <setup\|ls\|show\|delete\|test>` | AI provider configuration. `setup` interactive; `ls` list; `show` redacted; `delete` remove; `test` connection. |
44
44
  | `rogatio runtime <install\|uninstall\|verify>` | Register the native-messaging host with `install` and trust the device-local CA in one **transactional** call; it needs elevated privileges (Linux `sudo`, macOS keychain authorization, Windows Administrator) and rolls back with exit `1` and `trust unsupported: <reasons>` when a capability or elevation is missing. Release users never pass `--extension-id`. That flag is only for development (a local unpacked build without the release key) and for forks. `uninstall` removes the host manifest, the device-local CA files, and the CA trust installation (idempotent). `verify` reports whether manifest, `runtime-host` wrapper, allowed origins, and CA trust are all valid, and fails when `allowed_origins` omits the release ID. Release users never pass `--extension-id` on verify either. |
45
45
  | `rogatio runtime host [path]` | Run the consolidated native-messaging host for the project (pair/authorize/body transforms over stdio). Normally launched by the browser; run manually only for debugging. `--root <dir>` overrides the confined file root; `--mock-port <n>` binds the loopback mock-response faucet. |
@@ -1682,6 +1682,9 @@ function validateProjectDetailed(value) {
1682
1682
  const errors = semanticIssues(snapshot2.value);
1683
1683
  return errors.length > 0 ? { valid: false, errors } : { valid: true, data: value };
1684
1684
  }
1685
+ function validateProject(value) {
1686
+ return validateProjectDetailed(value).valid;
1687
+ }
1685
1688
 
1686
1689
  // packages/compiler/dist/node/index.js
1687
1690
  var ISSUE_CODES = {
@@ -25718,10 +25721,10 @@ function selectTrustPlatformAdapter(platform) {
25718
25721
  function showEditHelp() {
25719
25722
  console.log(`Usage: rogatio edit [options] [path]
25720
25723
 
25721
- Launch browser-based editor for .rogatio.json project file.
25724
+ Launch browser-based editor for a Rogatio project file.
25722
25725
 
25723
25726
  Arguments:
25724
- path Path to .rogatio.json (default: .rogatio.json in current directory)
25727
+ path Project file (any filename; default: .rogatio.json in the current directory)
25725
25728
 
25726
25729
  Options:
25727
25730
  --port <n> Fixed port for editor server (default: random)
@@ -25729,15 +25732,16 @@ Options:
25729
25732
  --help, -h Show this help
25730
25733
 
25731
25734
  The editor runs in your default browser and communicates with a local server
25732
- bound to 127.0.0.1. Changes are saved atomically to the project file.`);
25735
+ bound to 127.0.0.1. Changes are saved atomically to the file that was opened.
25736
+ When path is omitted, the CLI looks for .rogatio.json in the current directory.`);
25733
25737
  }
25734
25738
  function showVerifyHelp() {
25735
25739
  console.log(`Usage: rogatio verify [options] [path]
25736
25740
 
25737
- Validate a .rogatio.json project file using schema and compiler.
25741
+ Validate a Rogatio project file using schema and compiler.
25738
25742
 
25739
25743
  Arguments:
25740
- path Path to .rogatio.json (default: .rogatio.json in current directory)
25744
+ path Project file (any filename; default: .rogatio.json in the current directory)
25741
25745
  Use '-' to read from stdin
25742
25746
 
25743
25747
  Options:
@@ -25795,10 +25799,10 @@ Exit codes:
25795
25799
  function showTestHelp() {
25796
25800
  console.log(`Usage: rogatio test [options] [path] [url...]
25797
25801
 
25798
- Run offline dry-run tests against a .rogatio.json project file.
25802
+ Run offline dry-run tests against a Rogatio project file.
25799
25803
 
25800
25804
  Arguments:
25801
- path Path to .rogatio.json (default: .rogatio.json in current directory)
25805
+ path Project file (any filename; default: .rogatio.json in the current directory)
25802
25806
  Use '-' to read project JSON from stdin
25803
25807
  url... URLs to test; when path is omitted, first URL is detected automatically
25804
25808
 
@@ -25834,7 +25838,7 @@ Arguments:
25834
25838
  rule, or an object with a rules array)
25835
25839
 
25836
25840
  Options:
25837
- --out <path> Project file to write (default: .rogatio.json in the current directory)
25841
+ --out <path> Project file to write (any filename; default: .rogatio.json in the current directory)
25838
25842
  --merge Append imported groups onto an existing version-2 project
25839
25843
  --json Print the import report as JSON
25840
25844
  --help, -h Show this help
@@ -27246,6 +27250,36 @@ function pickWord(words, byte) {
27246
27250
  function isRogatioProjectFilename(name) {
27247
27251
  return name === ".rogatio.json" || name.endsWith(".rogatio.json");
27248
27252
  }
27253
+ function isJsonFilename(name) {
27254
+ return name.toLowerCase().endsWith(".json");
27255
+ }
27256
+ async function isDiscoverableProjectFile(id2) {
27257
+ let parsed;
27258
+ try {
27259
+ parsed = JSON.parse(await readFile5(id2, "utf-8"));
27260
+ } catch {
27261
+ return false;
27262
+ }
27263
+ const version = projectVersion(parsed);
27264
+ if (version === null) return false;
27265
+ const candidate = version === 1 ? migrateDiscoveredV1(parsed) : parsed;
27266
+ if (candidate === null) return false;
27267
+ return validateProject(candidate);
27268
+ }
27269
+ function projectVersion(data) {
27270
+ if (data === null || typeof data !== "object" || Array.isArray(data)) {
27271
+ return null;
27272
+ }
27273
+ if (!Object.hasOwn(data, "version")) return null;
27274
+ const version = data.version;
27275
+ if (version === 1 || version === 2) return version;
27276
+ return null;
27277
+ }
27278
+ function migrateDiscoveredV1(data) {
27279
+ const migrated = migrateV1Project(data);
27280
+ if (!migrated.ok) return null;
27281
+ return migrated.project;
27282
+ }
27249
27283
  function projectName(data) {
27250
27284
  if (data === null || typeof data !== "object" || Array.isArray(data)) {
27251
27285
  return "";
@@ -27387,10 +27421,11 @@ function createJsonFileProjectStorage() {
27387
27421
  }
27388
27422
  const refs = [];
27389
27423
  for (const entry of entries) {
27390
- if (entry.isDirectory() || !isRogatioProjectFilename(entry.name)) {
27391
- continue;
27392
- }
27424
+ if (entry.isDirectory()) continue;
27425
+ const named = isRogatioProjectFilename(entry.name);
27426
+ if (!named && !isJsonFilename(entry.name)) continue;
27393
27427
  const id2 = join6(scope, entry.name);
27428
+ if (!named && !await isDiscoverableProjectFile(id2)) continue;
27394
27429
  let name = "";
27395
27430
  try {
27396
27431
  const data = await readDocument(id2);
@@ -30804,10 +30839,10 @@ function showHelp() {
30804
30839
  Usage: rogatio <command> [options]
30805
30840
 
30806
30841
  Commands:
30807
- edit [path] Launch browser editor for .rogatio.json
30808
- test [path] [url...] Run offline dry-run tests against .rogatio.json
30809
- verify [path] Validate .rogatio.json file
30810
- import requestly <export.json> Migrate a Requestly export into .rogatio.json
30842
+ edit [path] Launch browser editor (default: .rogatio.json; any filename)
30843
+ test [path] [url...] Run offline dry-run tests (default: .rogatio.json; any filename)
30844
+ verify [path] Validate a project file (default: .rogatio.json; any filename)
30845
+ import requestly <export.json> Migrate a Requestly export (default --out: .rogatio.json)
30811
30846
  runtime <install|uninstall|verify|host> Native messaging runtime control
30812
30847
  runtime host [path] Run the native-messaging runtime host
30813
30848
  ai <setup|ls|show|delete|test> AI provider configuration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogatio/cli",
3
- "version": "6.7.1",
3
+ "version": "6.8.0",
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.",
@@ -46,8 +46,8 @@
46
46
  "@rogatio/requestly-import": "workspace:*",
47
47
  "@rogatio/runtime": "workspace:*",
48
48
  "@rogatio/schema": "workspace:*",
49
- "@types/node": "26.6.2",
49
+ "@types/node": "26.6.3",
50
50
  "typescript": "7.0.2",
51
- "vitest": "5.0.1"
51
+ "vitest": "5.0.2"
52
52
  }
53
53
  }