@supacloud/admin 0.1.0 → 0.1.2

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.
Binary file
package/dist/index.js CHANGED
@@ -4144,12 +4144,23 @@ var require_bcrypt_pbkdf = __commonJS((exports, module) => {
4144
4144
  };
4145
4145
  });
4146
4146
 
4147
+ // node_modules/cpu-features/build/Release/cpufeatures.node
4148
+ var require_cpufeatures = __commonJS((exports, module) => {
4149
+ module.exports = __require("./cpufeatures-1yrn0vtw.node");
4150
+ });
4151
+
4152
+ // node_modules/cpu-features/lib/index.js
4153
+ var require_lib2 = __commonJS((exports, module) => {
4154
+ var binding = require_cpufeatures();
4155
+ module.exports = binding.getCPUInfo;
4156
+ });
4157
+
4147
4158
  // node_modules/ssh2/lib/protocol/constants.js
4148
4159
  var require_constants = __commonJS((exports, module) => {
4149
4160
  var crypto = __require("crypto");
4150
4161
  var cpuInfo;
4151
4162
  try {
4152
- cpuInfo = (()=>{throw new Error("Cannot require module "+"cpu-features");})()();
4163
+ cpuInfo = require_lib2()();
4153
4164
  } catch {}
4154
4165
  var { bindingAvailable, CIPHER_INFO, MAC_INFO } = require_crypto();
4155
4166
  var eddsaSupported = (() => {
@@ -4746,9 +4757,14 @@ var require_utils = __commonJS((exports, module) => {
4746
4757
  };
4747
4758
  });
4748
4759
 
4760
+ // node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node
4761
+ var require_sshcrypto = __commonJS((exports, module) => {
4762
+ module.exports = __require("./sshcrypto-w7mnkyjv.node");
4763
+ });
4764
+
4749
4765
  // node_modules/ssh2/lib/protocol/crypto/poly1305.js
4750
4766
  var require_poly1305 = __commonJS((exports, module) => {
4751
- var __dirname = "/Volumes/Data/workspace/supacloud/packages/admin/node_modules/ssh2/lib/protocol/crypto", __filename = "/Volumes/Data/workspace/supacloud/packages/admin/node_modules/ssh2/lib/protocol/crypto/poly1305.js";
4767
+ var __dirname = "/home/runner/work/supacloud/supacloud/packages/admin/node_modules/ssh2/lib/protocol/crypto", __filename = "/home/runner/work/supacloud/supacloud/packages/admin/node_modules/ssh2/lib/protocol/crypto/poly1305.js";
4752
4768
  var createPoly1305 = function() {
4753
4769
  var _scriptDir = typeof document !== "undefined" && document.currentScript ? document.currentScript.src : undefined;
4754
4770
  if (typeof __filename !== "undefined")
@@ -5232,7 +5248,7 @@ var require_crypto = __commonJS((exports, module) => {
5232
5248
  var ChaChaPolyDecipher;
5233
5249
  var GenericDecipher;
5234
5250
  try {
5235
- binding = (()=>{throw new Error("Cannot require module "+"./crypto/build/Release/sshcrypto.node");})();
5251
+ binding = require_sshcrypto();
5236
5252
  ({
5237
5253
  AESGCMCipher,
5238
5254
  ChaChaPolyCipher,
@@ -7521,7 +7537,7 @@ ${formatted}-----END ${type} KEY-----`;
7521
7537
 
7522
7538
  // node_modules/ssh2/lib/agent.js
7523
7539
  var require_agent = __commonJS((exports, module) => {
7524
- var __dirname = "/Volumes/Data/workspace/supacloud/packages/admin/node_modules/ssh2/lib";
7540
+ var __dirname = "/home/runner/work/supacloud/supacloud/packages/admin/node_modules/ssh2/lib";
7525
7541
  var { Socket } = __require("net");
7526
7542
  var { Duplex } = __require("stream");
7527
7543
  var { resolve: resolve2 } = __require("path");
@@ -18787,7 +18803,7 @@ var require_keygen = __commonJS((exports, module) => {
18787
18803
  });
18788
18804
 
18789
18805
  // node_modules/ssh2/lib/index.js
18790
- var require_lib2 = __commonJS((exports, module) => {
18806
+ var require_lib3 = __commonJS((exports, module) => {
18791
18807
  var {
18792
18808
  AgentProtocol,
18793
18809
  BaseAgent,
@@ -23162,7 +23178,7 @@ class HttpTransport {
23162
23178
  }
23163
23179
 
23164
23180
  // src/shared/transports/ssh.ts
23165
- var import_ssh2 = __toESM(require_lib2(), 1);
23181
+ var import_ssh2 = __toESM(require_lib3(), 1);
23166
23182
  var BLOCKED_COMMANDS = [
23167
23183
  "rm -rf /",
23168
23184
  "mkfs",
@@ -23338,6 +23354,7 @@ class SshTransport {
23338
23354
  // src/shared/tools/ssh-tools.ts
23339
23355
  var SAFE_CONTAINER_NAME = /^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,127}$/;
23340
23356
  var SAFE_PROJECT_REF = /^[a-z0-9-]{1,20}$/;
23357
+ var SAFE_RELEASE_TAG = /^[a-zA-Z0-9._-]{1,80}$/;
23341
23358
  var SAFE_TIMEOUT_SECONDS = 300;
23342
23359
  var ALLOWED_EXEC_PREFIXES = [
23343
23360
  "systemctl ",
@@ -23373,6 +23390,26 @@ function assertSafeContainerName(value) {
23373
23390
  }
23374
23391
  return value;
23375
23392
  }
23393
+ function assertSafeReleaseTag(value) {
23394
+ if (!SAFE_RELEASE_TAG.test(value)) {
23395
+ throw new Error("Invalid release version");
23396
+ }
23397
+ return value;
23398
+ }
23399
+ function assertSafeGithubProxy(value) {
23400
+ const trimmed = value.trim();
23401
+ if (/[\s\n\r;&|`$<>]/.test(trimmed)) {
23402
+ throw new Error("Invalid github_proxy");
23403
+ }
23404
+ if (trimmed.toLowerCase() === "direct" || trimmed.toLowerCase() === "none") {
23405
+ return trimmed;
23406
+ }
23407
+ const parsed = new URL(trimmed);
23408
+ if (!["http:", "https:"].includes(parsed.protocol)) {
23409
+ throw new Error("Invalid github_proxy protocol");
23410
+ }
23411
+ return parsed.toString();
23412
+ }
23376
23413
  function getExecTimeoutMs(timeoutSeconds) {
23377
23414
  const seconds = timeoutSeconds || 60;
23378
23415
  if (!Number.isFinite(seconds) || seconds <= 0 || seconds > SAFE_TIMEOUT_SECONDS) {
@@ -23420,6 +23457,7 @@ Actions: ping, setup, install, upgrade, diagnose, exec, troubleshoot, container_
23420
23457
  edge_runtime: exports_external.enum(["bun"]).optional().describe("[install] Runtime (default: bun)"),
23421
23458
  storage_type: exports_external.enum(["juicefs", "garage", "rustfs", "minio", "external"]).optional().describe("[install] Storage backend"),
23422
23459
  version: exports_external.string().optional().describe("[upgrade] Specific version"),
23460
+ github_proxy: exports_external.string().optional().describe("[upgrade] GitHub proxy prefix, e.g. https://ghproxy.net/ or direct"),
23423
23461
  focus: exports_external.enum(["all", "containers", "database", "network", "disk", "logs"]).optional().describe("[troubleshoot] Focus area"),
23424
23462
  container: exports_external.string().optional().describe("[container_logs] Container name"),
23425
23463
  lines: exports_external.number().optional().describe("[container_logs] Number of log lines (default: 100)"),
@@ -23488,7 +23526,12 @@ ${result.stderr.slice(-500)}`;
23488
23526
  break;
23489
23527
  }
23490
23528
  case "upgrade": {
23491
- const cmd = args.version ? `cd ~/supacloud && git fetch && git checkout ${args.version} && bash install.sh` : `cd ~/supacloud && git pull && bash install.sh`;
23529
+ const envParts = [
23530
+ args.version ? `SUPACLOUD_UPGRADE_TAG=${assertSafeReleaseTag(args.version)}` : "",
23531
+ args.github_proxy ? `SUPACLOUD_GITHUB_PROXY=${assertSafeGithubProxy(args.github_proxy)}` : ""
23532
+ ].filter(Boolean);
23533
+ const envPrefix = envParts.length > 0 ? `${envParts.join(" ")} ` : "";
23534
+ const cmd = "if [ ! -x /usr/local/bin/supacloud ]; then " + "echo 'SupaCloud binary not found at /usr/local/bin/supacloud; run ssh install first.' >&2; exit 127; " + `fi; ${envPrefix}/usr/local/bin/supacloud upgrade --yes`;
23492
23535
  const r = await ssh.exec(cmd, 600000);
23493
23536
  text = r.success ? `✅ Upgrade done
23494
23537
  ${r.stdout.slice(-300)}` : `❌ Failed (exit ${r.code})
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supacloud/admin",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Platform administration CLI for SupaCloud operators",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
Binary file
Binary file