@solongate/proxy 0.82.41 → 0.82.42

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.
@@ -523,6 +523,8 @@ function flagBool(flags, name) {
523
523
  // src/commands/policy.ts
524
524
  var USAGE = usage("solongate policy", "manage cloud policies", [
525
525
  ["policy list", "list all policies"],
526
+ ["policy create <name>", "create a new empty policy"],
527
+ ["policy delete <id>", "delete a policy"],
526
528
  ["policy show <id>", "show one policy (rules, mode)"],
527
529
  ["policy allow <id> [--command|--path|--url <val>]", "append an ALLOW rule"],
528
530
  ["policy deny <id> [--command|--path|--url <val>]", "append a DENY rule"],
@@ -572,6 +574,22 @@ async function run(argv) {
572
574
  printRules(p.rules);
573
575
  return 0;
574
576
  }
577
+ case "create": {
578
+ const name = positionals.slice(1).join(" ").trim();
579
+ if (!name) return err(" Usage: policy create <name>"), 1;
580
+ const res = await api.policies.create({ id: `policy-${Date.now()}`, name, rules: [], mode: "denylist" });
581
+ if (json) return printJson(res), 0;
582
+ err(green(` \u2713 Created "${name}"`) + dim(` (${res.id})`));
583
+ return 0;
584
+ }
585
+ case "delete": {
586
+ const id = positionals[1];
587
+ if (!id) return err(" Usage: policy delete <id>"), 1;
588
+ const res = await api.policies.remove(id);
589
+ if (json) return printJson(res), 0;
590
+ err(green(` \u2713 Deleted ${res.policy_id}`));
591
+ return 0;
592
+ }
575
593
  case "allow":
576
594
  case "deny": {
577
595
  const effect = sub === "allow" ? "ALLOW" : "DENY";
package/dist/index.js CHANGED
@@ -11394,6 +11394,22 @@ async function run(argv) {
11394
11394
  printRules(p.rules);
11395
11395
  return 0;
11396
11396
  }
11397
+ case "create": {
11398
+ const name = positionals.slice(1).join(" ").trim();
11399
+ if (!name) return err(" Usage: policy create <name>"), 1;
11400
+ const res = await api.policies.create({ id: `policy-${Date.now()}`, name, rules: [], mode: "denylist" });
11401
+ if (json) return printJson(res), 0;
11402
+ err(green(` \u2713 Created "${name}"`) + dim(` (${res.id})`));
11403
+ return 0;
11404
+ }
11405
+ case "delete": {
11406
+ const id = positionals[1];
11407
+ if (!id) return err(" Usage: policy delete <id>"), 1;
11408
+ const res = await api.policies.remove(id);
11409
+ if (json) return printJson(res), 0;
11410
+ err(green(` \u2713 Deleted ${res.policy_id}`));
11411
+ return 0;
11412
+ }
11397
11413
  case "allow":
11398
11414
  case "deny": {
11399
11415
  const effect = sub === "allow" ? "ALLOW" : "DENY";
@@ -11508,6 +11524,8 @@ var init_policy = __esm({
11508
11524
  init_format();
11509
11525
  USAGE = usage("solongate policy", "manage cloud policies", [
11510
11526
  ["policy list", "list all policies"],
11527
+ ["policy create <name>", "create a new empty policy"],
11528
+ ["policy delete <id>", "delete a policy"],
11511
11529
  ["policy show <id>", "show one policy (rules, mode)"],
11512
11530
  ["policy allow <id> [--command|--path|--url <val>]", "append an ALLOW rule"],
11513
11531
  ["policy deny <id> [--command|--path|--url <val>]", "append a DENY rule"],
@@ -15912,6 +15930,8 @@ function printHelp() {
15912
15930
  cmd("logs-server status", "show the local audit-log service status");
15913
15931
  head("Policies");
15914
15932
  cmd("policy list", "list all policies");
15933
+ cmd("policy create <name>", "create a new empty policy");
15934
+ cmd("policy delete <id>", "delete a policy");
15915
15935
  cmd("policy show <id>", "show one policy (rules, mode)");
15916
15936
  cmd("policy allow <id> [--command|--path|--url <val>]", "add an ALLOW rule");
15917
15937
  cmd("policy deny <id> [--command|--path|--url <val>]", "add a DENY rule");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.82.41",
3
+ "version": "0.82.42",
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": {