@solongate/proxy 0.83.34 → 0.83.35

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.
@@ -15,6 +15,23 @@ export declare const cyan: (s: string) => string;
15
15
  * (used for long or continuation lines). Returns the whole block as one string.
16
16
  */
17
17
  export declare function usage(title: string, tagline: string, rows: Array<[string, string?]>, footer?: string): string;
18
+ /**
19
+ * What a command's switch falls through to when the first positional is not one
20
+ * of its subcommands.
21
+ *
22
+ * Printing the usage block on its own was the old behaviour everywhere, and it
23
+ * reads as though the command simply has no default: a correct-looking help
24
+ * screen appears, and finding the mistake means diffing it against what you
25
+ * typed. Naming the token first costs one line and removes that step.
26
+ *
27
+ * `solongate ghost -g` is the case that made it obvious. The parser treats only
28
+ * `--x` as a flag, so a single-dash token arrives as a SUBCOMMAND, and the
29
+ * result was a help screen that looked like a successful command.
30
+ *
31
+ * The empty case still happens: a command invoked with a flag and no subcommand
32
+ * has nothing to name, and `Unknown subcommand: ""` would be worse than none.
33
+ */
34
+ export declare function unknownSub(command: string, sub: string, usageText: string): number;
18
35
  /** Color a decision string (ALLOW green, DENY/DENIED red). */
19
36
  export declare function decisionColor(decision: string): string;
20
37
  /**
@@ -606,6 +606,11 @@ function usage(title, tagline, rows, footer = "Add --json for machine-readable o
606
606
  if (footer) lines.push("", ` ${c.dim}${footer}${c.reset}`);
607
607
  return lines.join("\n");
608
608
  }
609
+ function unknownSub(command, sub, usageText) {
610
+ if (sub) err(`${red(" \u2717 ")}Unknown ${command} subcommand: ${cyan(sub)}`);
611
+ err(usageText);
612
+ return 1;
613
+ }
609
614
  function decisionColor(decision) {
610
615
  const d = decision.toUpperCase();
611
616
  if (d === "ALLOW") return green(d);
@@ -833,10 +838,7 @@ async function run(argv) {
833
838
  return 0;
834
839
  }
835
840
  default:
836
- err(` Unknown: policy ${sub}
837
- `);
838
- err(USAGE);
839
- return 1;
841
+ return unknownSub("policy", sub, USAGE);
840
842
  }
841
843
  }
842
844
  function printRules(rules) {
@@ -925,7 +927,7 @@ async function run2(argv) {
925
927
  return 0;
926
928
  }
927
929
  default:
928
- return err(USAGE2), 1;
930
+ return unknownSub("ratelimit", sub, USAGE2);
929
931
  }
930
932
  }
931
933
 
@@ -1004,7 +1006,7 @@ async function run3(argv) {
1004
1006
  return err(green(` \u2713 Removed custom pattern "${name}"`)), 0;
1005
1007
  }
1006
1008
  default:
1007
- return err(USAGE3), 1;
1009
+ return unknownSub("dlp", sub, USAGE3);
1008
1010
  }
1009
1011
  }
1010
1012
 
@@ -1089,7 +1091,7 @@ async function run4(argv) {
1089
1091
  return err(green(` \u2713 Stopped hiding "${glob}"`) + dim(` (${saved.ghost.patterns.length} route(s) left)`)), 0;
1090
1092
  }
1091
1093
  default:
1092
- return err(USAGE4), 1;
1094
+ return unknownSub("ghost", sub, USAGE4);
1093
1095
  }
1094
1096
  }
1095
1097
 
@@ -1158,7 +1160,7 @@ async function run5(argv) {
1158
1160
  return 0;
1159
1161
  }
1160
1162
  default:
1161
- return err(USAGE5), 1;
1163
+ return unknownSub("stats", sub, USAGE5);
1162
1164
  }
1163
1165
  }
1164
1166
 
@@ -1594,7 +1596,7 @@ async function run9(argv) {
1594
1596
  return err(green(` \u2713 Removed ${id}`)), 0;
1595
1597
  }
1596
1598
  default:
1597
- return err(USAGE7), 1;
1599
+ return unknownSub("alerts", sub, USAGE7);
1598
1600
  }
1599
1601
  }
1600
1602
 
@@ -1636,7 +1638,7 @@ async function run10(argv) {
1636
1638
  return err(green(` \u2713 Removed ${id}`)), 0;
1637
1639
  }
1638
1640
  default:
1639
- return err(USAGE8), 1;
1641
+ return unknownSub("webhooks", sub, USAGE8);
1640
1642
  }
1641
1643
  }
1642
1644
 
package/dist/index.js CHANGED
@@ -11620,6 +11620,11 @@ function usage(title, tagline, rows, footer = "Add --json for machine-readable o
11620
11620
  if (footer) lines.push("", ` ${c.dim}${footer}${c.reset}`);
11621
11621
  return lines.join("\n");
11622
11622
  }
11623
+ function unknownSub(command, sub, usageText) {
11624
+ if (sub) err(`${red(" \u2717 ")}Unknown ${command} subcommand: ${cyan(sub)}`);
11625
+ err(usageText);
11626
+ return 1;
11627
+ }
11623
11628
  function decisionColor2(decision) {
11624
11629
  const d = decision.toUpperCase();
11625
11630
  if (d === "ALLOW") return green(d);
@@ -13127,10 +13132,7 @@ async function run2(argv) {
13127
13132
  return 0;
13128
13133
  }
13129
13134
  default:
13130
- err(` Unknown: policy ${sub}
13131
- `);
13132
- err(USAGE);
13133
- return 1;
13135
+ return unknownSub("policy", sub, USAGE);
13134
13136
  }
13135
13137
  }
13136
13138
  function printRules(rules) {
@@ -13234,7 +13236,7 @@ async function run3(argv) {
13234
13236
  return 0;
13235
13237
  }
13236
13238
  default:
13237
- return err(USAGE2), 1;
13239
+ return unknownSub("ratelimit", sub, USAGE2);
13238
13240
  }
13239
13241
  }
13240
13242
  var USAGE2, modeColor2;
@@ -13319,7 +13321,7 @@ async function run4(argv) {
13319
13321
  return err(green(` \u2713 Removed custom pattern "${name}"`)), 0;
13320
13322
  }
13321
13323
  default:
13322
- return err(USAGE3), 1;
13324
+ return unknownSub("dlp", sub, USAGE3);
13323
13325
  }
13324
13326
  }
13325
13327
  var USAGE3, modeColor3;
@@ -13413,7 +13415,7 @@ async function run5(argv) {
13413
13415
  return err(green(` \u2713 Stopped hiding "${glob}"`) + dim(` (${saved.ghost.patterns.length} route(s) left)`)), 0;
13414
13416
  }
13415
13417
  default:
13416
- return err(USAGE4), 1;
13418
+ return unknownSub("ghost", sub, USAGE4);
13417
13419
  }
13418
13420
  }
13419
13421
  var USAGE4, modeColor4, isBlanketGlob;
@@ -13495,7 +13497,7 @@ async function run6(argv) {
13495
13497
  return 0;
13496
13498
  }
13497
13499
  default:
13498
- return err(USAGE5), 1;
13500
+ return unknownSub("stats", sub, USAGE5);
13499
13501
  }
13500
13502
  }
13501
13503
  var USAGE5;
@@ -13807,7 +13809,7 @@ async function run9(argv) {
13807
13809
  return err(green(` \u2713 Removed ${id}`)), 0;
13808
13810
  }
13809
13811
  default:
13810
- return err(USAGE7), 1;
13812
+ return unknownSub("alerts", sub, USAGE7);
13811
13813
  }
13812
13814
  }
13813
13815
  var USAGE7;
@@ -13859,7 +13861,7 @@ async function run10(argv) {
13859
13861
  return err(green(` \u2713 Removed ${id}`)), 0;
13860
13862
  }
13861
13863
  default:
13862
- return err(USAGE8), 1;
13864
+ return unknownSub("webhooks", sub, USAGE8);
13863
13865
  }
13864
13866
  }
13865
13867
  var USAGE8;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.83.34",
3
+ "version": "0.83.35",
4
4
  "description": "AI tool security proxy: protect any AI tool server with customizable policies, path/command constraints, rate limiting, and audit logging. No code changes required.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -61,12 +61,12 @@
61
61
  "node": ">=20.0.0"
62
62
  },
63
63
  "optionalDependencies": {
64
- "@solongate/guard-linux-x64": "0.83.34",
65
- "@solongate/guard-linux-arm64": "0.83.34",
66
- "@solongate/guard-darwin-x64": "0.83.34",
67
- "@solongate/guard-darwin-arm64": "0.83.34",
68
- "@solongate/guard-win32-x64": "0.83.34",
69
- "@solongate/guard-win32-arm64": "0.83.34"
64
+ "@solongate/guard-linux-x64": "0.83.35",
65
+ "@solongate/guard-linux-arm64": "0.83.35",
66
+ "@solongate/guard-darwin-x64": "0.83.35",
67
+ "@solongate/guard-darwin-arm64": "0.83.35",
68
+ "@solongate/guard-win32-x64": "0.83.35",
69
+ "@solongate/guard-win32-arm64": "0.83.35"
70
70
  },
71
71
  "dependencies": {
72
72
  "@modelcontextprotocol/sdk": "^1.26.0",