@bagdock/cli 0.6.0 → 0.6.1

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.
Files changed (2) hide show
  1. package/dist/bagdock.js +11 -3
  2. package/package.json +1 -1
package/dist/bagdock.js CHANGED
@@ -2580,6 +2580,14 @@ function getApiBase() {
2580
2580
  function getDashboardBase() {
2581
2581
  return _dashboardBase;
2582
2582
  }
2583
+ function normalizeUrl(raw) {
2584
+ let url = raw.replace(/^['"]|['"]$/g, "").replace(/\/+$/, "");
2585
+ if (!/^https?:\/\//i.test(url)) {
2586
+ console.error(source_default.red(`Invalid URL (must start with http:// or https://): ${raw}`));
2587
+ process.exit(1);
2588
+ }
2589
+ return url;
2590
+ }
2583
2591
  function loadLocalEnv() {
2584
2592
  const envPath = join(process.cwd(), ".env.local");
2585
2593
  if (!existsSync(envPath)) {
@@ -2605,9 +2613,9 @@ function loadLocalEnv() {
2605
2613
  console.error(source_default.dim("Add BAGDOCK_API_URL=https://your-ngrok-url to .env.local"));
2606
2614
  process.exit(1);
2607
2615
  }
2608
- _apiBase = apiUrl;
2616
+ _apiBase = normalizeUrl(apiUrl);
2609
2617
  if (vars["BAGDOCK_DASHBOARD_URL"]) {
2610
- _dashboardBase = vars["BAGDOCK_DASHBOARD_URL"];
2618
+ _dashboardBase = normalizeUrl(vars["BAGDOCK_DASHBOARD_URL"]);
2611
2619
  }
2612
2620
  console.log(source_default.dim(`Using local env → ${_apiBase}`));
2613
2621
  }
@@ -5278,9 +5286,9 @@ init_config();
5278
5286
  var program2 = new Command;
5279
5287
  program2.name("bagdock").description("Bagdock developer CLI — built for humans, AI agents, and CI/CD pipelines").version("0.6.0").option("--json", "Force JSON output (auto-enabled in non-TTY)").option("-q, --quiet", "Suppress status messages (implies --json)").option("--api-key <key>", "API key to use for this invocation").option("-p, --profile <name>", "Profile to use (overrides BAGDOCK_PROFILE)").option("--env <environment>", "Override environment for this invocation (live, test)").option("--ngrok", "Use API URLs from .env.local (for ngrok tunnels)").hook("preAction", (_thisCommand, actionCommand) => {
5280
5288
  const opts = program2.opts();
5289
+ setOutputMode({ json: opts.json, quiet: opts.quiet });
5281
5290
  if (opts.ngrok)
5282
5291
  loadLocalEnv();
5283
- setOutputMode({ json: opts.json, quiet: opts.quiet });
5284
5292
  if (opts.apiKey)
5285
5293
  setApiKeyOverride(opts.apiKey);
5286
5294
  if (opts.profile)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bagdock/cli",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Bagdock developer CLI — build, test, and deploy apps and edges on the Bagdock platform",
5
5
  "keywords": [
6
6
  "bagdock",