sagacloud 0.2.0 → 0.3.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sagacloud",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Deploy and manage Static, SPA, and Node.js apps on SagaCloud via the sagacloud CLI.",
5
5
  "author": {
6
6
  "name": "SagaSoft",
package/dist/index.js CHANGED
@@ -21,8 +21,17 @@ import { parse as parseJsonc, printParseErrorCode } from "jsonc-parser";
21
21
  import { z } from "zod";
22
22
  var DEFAULT_API_BASE_URL = "https://app.sagasoft.xyz";
23
23
  var DEFAULT_PANEL_BASE_URL = "https://app.sagasoft.xyz";
24
+ var SagaCloudDomainEntrySchema = z.union([
25
+ z.string().min(1),
26
+ z.object({
27
+ fqdn: z.string().min(1),
28
+ primary: z.boolean().optional(),
29
+ mode: z.enum(["auto", "saga_root", "saga_subdomain", "custom_external"]).optional()
30
+ })
31
+ ]);
24
32
  var SagaCloudJsoncSchema = z.object({
25
33
  $schema: z.string().optional(),
34
+ app_name: z.string().min(1).optional(),
26
35
  name: z.string().min(1).optional(),
27
36
  site_id: z.string().optional(),
28
37
  type: z.enum(["static", "spa", "php", "node", "nextjs"]).optional(),
@@ -33,9 +42,25 @@ var SagaCloudJsoncSchema = z.object({
33
42
  start_command: z.string().optional(),
34
43
  port: z.union([z.number().int().min(1).max(65535), z.string()]).optional(),
35
44
  spa_fallback: z.boolean().optional(),
36
- domains: z.array(z.string()).optional(),
45
+ healthcheck_path: z.string().optional(),
46
+ domains: z.array(SagaCloudDomainEntrySchema).optional(),
47
+ cdn: z.object({
48
+ enabled: z.boolean().optional(),
49
+ waf: z.boolean().optional(),
50
+ purge_on_deploy: z.boolean().optional()
51
+ }).optional(),
52
+ resources: z.object({
53
+ memory: z.union([z.string(), z.number()]).optional(),
54
+ cpus: z.union([z.string(), z.number()]).optional()
55
+ }).optional(),
56
+ env_file: z.string().optional(),
37
57
  ignore: z.array(z.string()).optional(),
38
- vars: z.record(z.union([z.string(), z.number(), z.boolean()])).optional()
58
+ vars: z.record(z.union([z.string(), z.number(), z.boolean()])).optional(),
59
+ deploy: z.object({
60
+ detach: z.boolean().optional(),
61
+ force_rebuild: z.boolean().optional(),
62
+ sync_domains: z.boolean().optional()
63
+ }).optional()
39
64
  });
40
65
  function getAuthDir() {
41
66
  return path.join(os.homedir(), ".config", "sagacloud");
@@ -867,6 +892,24 @@ async function createArchiveFromDirectory(targetDir, extraIgnorePatterns = [], i
867
892
  }
868
893
 
869
894
  // src/commands/deploy.ts
895
+ async function resolveWranglerStyleTargetSite(client, optsSite, configuredName, jsonc, link) {
896
+ if (optsSite) return optsSite;
897
+ if (jsonc?.site_id) return jsonc.site_id;
898
+ const targetName = (configuredName || "").trim();
899
+ if (targetName) {
900
+ if (link?.site_id && link.site_name && link.site_name.trim().toLowerCase() === targetName.toLowerCase()) {
901
+ return link.site_id;
902
+ }
903
+ const listRes = await client.rpc("saga_cloud.api.hosting.list_sites", {
904
+ query: { limit: 100 }
905
+ });
906
+ const matched = (listRes.sites || []).find(
907
+ (s) => (s.site_name || "").trim().toLowerCase() === targetName.toLowerCase()
908
+ );
909
+ return matched ? matched.name : "";
910
+ }
911
+ return link?.site_id || "";
912
+ }
870
913
  function parseDotEnvText(raw) {
871
914
  const rows = [];
872
915
  for (const line of raw.split(/\r?\n/)) {
@@ -883,6 +926,56 @@ function parseDotEnvText(raw) {
883
926
  }
884
927
  return rows;
885
928
  }
929
+ function normalizeConfiguredDomains(entries) {
930
+ if (!entries?.length) return [];
931
+ const out = [];
932
+ const seen = /* @__PURE__ */ new Set();
933
+ for (const item of entries) {
934
+ const raw = typeof item === "string" ? { fqdn: item } : item;
935
+ const fqdn = (raw.fqdn || "").replace(/^https?:\/\//i, "").split("/")[0].trim().toLowerCase().replace(/\.+$/, "");
936
+ if (!fqdn || seen.has(fqdn)) continue;
937
+ seen.add(fqdn);
938
+ out.push({ fqdn, primary: Boolean(raw.primary), mode: raw.mode || "auto" });
939
+ }
940
+ return out;
941
+ }
942
+ async function reconcileConfiguredDomains(client, site, specs) {
943
+ if (specs.length === 0) return site;
944
+ let latestSite = site;
945
+ const attached = new Set((latestSite.domains || []).map((d) => (d.fqdn || "").toLowerCase()));
946
+ for (const spec of specs) {
947
+ if (attached.has(spec.fqdn)) {
948
+ if (spec.primary && (latestSite.domain || "").toLowerCase() !== spec.fqdn) {
949
+ const upRes = await client.rpc("saga_cloud.api.hosting.update_site_domain", {
950
+ method: "POST",
951
+ body: { site_id: latestSite.name, fqdn: spec.fqdn, make_primary: true }
952
+ });
953
+ latestSite = upRes.site || latestSite;
954
+ }
955
+ continue;
956
+ }
957
+ const addRes = await client.rpc("saga_cloud.api.hosting.add_site_domain", {
958
+ method: "POST",
959
+ body: {
960
+ site_id: latestSite.name,
961
+ domain_mode: spec.mode,
962
+ custom_fqdn: spec.fqdn,
963
+ make_primary: spec.primary
964
+ }
965
+ });
966
+ latestSite = addRes.site || latestSite;
967
+ attached.add(spec.fqdn);
968
+ const added = addRes.added_domain || (latestSite.domains || []).find((d) => d.fqdn.toLowerCase() === spec.fqdn);
969
+ if (added?.dns_auto_configured) {
970
+ console.log(pc3.green(`\u2713 Domain ${spec.fqdn} attached with automatic DNS + Edge SSL (${added.domain_mode})`));
971
+ } else if (added?.cname_target) {
972
+ console.log(pc3.yellow(`\u25D0 External domain ${spec.fqdn} attached \u2014 point CNAME -> ${pc3.cyan(added.cname_target)}, then run: sagacloud domains verify ${spec.fqdn}`));
973
+ } else {
974
+ console.log(pc3.green(`\u2713 Domain ${spec.fqdn} attached`));
975
+ }
976
+ }
977
+ return latestSite;
978
+ }
886
979
  function registerDeployCommands(program2) {
887
980
  program2.command("deploy").alias("up").description("Deploy local static/SPA output, Express/Node source, or Git site to SagaCloud").option("--site <siteId>", "Target Site ID (overrides .sagacloud/project.json)").option("--name <siteName>", "Site name when creating a new site").option("--dir <outputDir>", "Pre-built static output directory (e.g. ./dist)").option("--build", "Run local build command before packaging static output").option("--no-build", "Skip running local build command").option("--static", "Deploy as static HTML/PHP site").option("--spa", "Deploy as Single Page App (Nginx try_files /index.html)").option("--node", "Deploy as Node.js / Express / SSR application").option("--port <port>", "Listening HTTP port for Node.js app", "3000").option("--start <cmd>", "Start command for Node.js app").option("--git", "Trigger remote Git redeploy instead of uploading local files").option("--force", "Bypass build cache on remote rebuild", false).option("--with-env <file>", "Load and push .env file variables before building").option("--detach", "Queue deployment and exit without streaming build logs", false).option("--yes", "Skip interactive prompts", false).action(
888
981
  async (opts) => {
@@ -891,7 +984,14 @@ function registerDeployCommands(program2) {
891
984
  const { config: jsonc } = readRepoJsoncConfig(cwd);
892
985
  const link = readLocalLink(cwd);
893
986
  const detected = detectProject(cwd);
894
- const existingSiteId = opts.site || link?.site_id || jsonc?.site_id || "";
987
+ const configuredName = (opts.name || jsonc?.app_name || jsonc?.name || "").trim() || void 0;
988
+ const existingSiteId = await resolveWranglerStyleTargetSite(
989
+ client,
990
+ opts.site,
991
+ configuredName,
992
+ jsonc,
993
+ link
994
+ );
895
995
  if (opts.git) {
896
996
  const targetId = resolveActiveSiteId(cwd, existingSiteId);
897
997
  const spin2 = p2.spinner();
@@ -958,7 +1058,7 @@ function registerDeployCommands(program2) {
958
1058
  );
959
1059
  const uploadSpin = p2.spinner();
960
1060
  uploadSpin.start("Uploading bundle to SagaCloud...");
961
- const zipName = `${(jsonc?.name || path4.basename(cwd) || "bundle").replace(/[^a-z0-9-]+/gi, "-")}.zip`;
1061
+ const zipName = `${(jsonc?.app_name || jsonc?.name || path4.basename(cwd) || "bundle").replace(/[^a-z0-9-]+/gi, "-")}.zip`;
962
1062
  const uploaded = await client.uploadBundle(archive.buffer, zipName, siteType);
963
1063
  uploadSpin.stop(`Uploaded (${uploaded.detected_entry})`);
964
1064
  const mergedVars = /* @__PURE__ */ new Map();
@@ -967,8 +1067,9 @@ function registerDeployCommands(program2) {
967
1067
  mergedVars.set(k, String(v));
968
1068
  }
969
1069
  }
970
- if (opts.withEnv) {
971
- const envPath = path4.resolve(cwd, opts.withEnv);
1070
+ const envFilesToLoad = [jsonc?.env_file, opts.withEnv].filter((f) => Boolean(f));
1071
+ for (const relEnv of envFilesToLoad) {
1072
+ const envPath = path4.resolve(cwd, relEnv);
972
1073
  if (!fs4.existsSync(envPath)) throw new Error(`Env file not found: ${envPath}`);
973
1074
  for (const item of parseDotEnvText(fs4.readFileSync(envPath, "utf8"))) {
974
1075
  mergedVars.set(item.key, item.value);
@@ -979,6 +1080,9 @@ function registerDeployCommands(program2) {
979
1080
  value,
980
1081
  is_build_time: siteType === "static"
981
1082
  }));
1083
+ const forceRebuild = opts.force || Boolean(jsonc?.deploy?.force_rebuild);
1084
+ const detachMode = opts.detach || Boolean(jsonc?.deploy?.detach);
1085
+ const domainSpecs = jsonc?.deploy?.sync_domains === false ? [] : normalizeConfiguredDomains(jsonc?.domains);
982
1086
  let targetSite;
983
1087
  let dep;
984
1088
  if (existingSiteId) {
@@ -996,7 +1100,7 @@ function registerDeployCommands(program2) {
996
1100
  method: "POST",
997
1101
  body: {
998
1102
  site_id: existingSiteId,
999
- force_rebuild: true,
1103
+ force_rebuild: forceRebuild !== false,
1000
1104
  new_zip_file_url: uploaded.file_url
1001
1105
  }
1002
1106
  }
@@ -1005,15 +1109,32 @@ function registerDeployCommands(program2) {
1005
1109
  query: { site_id: existingSiteId, limit: 1 }
1006
1110
  })).site;
1007
1111
  dep = res.deployment;
1112
+ if (!link || link.site_id !== targetSite.name || link.site_name !== targetSite.site_name) {
1113
+ writeLocalLink(
1114
+ {
1115
+ site_id: targetSite.name,
1116
+ site_name: targetSite.site_name,
1117
+ tenant_id: link?.tenant_id,
1118
+ site_type: siteType,
1119
+ runtime_variant: runtimeVariant,
1120
+ output_dir: siteType === "static" ? outputRel : ""
1121
+ },
1122
+ cwd
1123
+ );
1124
+ }
1008
1125
  depSpin.stop(`Deployment v${dep.version_number} queued for ${targetSite.domain}`);
1009
1126
  } else {
1010
- const defaultName = opts.name || jsonc?.name || path4.basename(cwd).toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/^-|-$/g, "") || "sagacloud-app";
1011
- const siteName = opts.yes ? defaultName : String(
1012
- await p2.text({
1127
+ const fallbackFolderName = path4.basename(cwd).toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/^-|-$/g, "") || "sagacloud-app";
1128
+ const defaultName = configuredName || fallbackFolderName;
1129
+ let siteName = defaultName;
1130
+ if (!configuredName && !opts.yes) {
1131
+ const nameAns = await p2.text({
1013
1132
  message: `Create new ${siteType.toUpperCase()} site name`,
1014
1133
  initialValue: defaultName
1015
- })
1016
- );
1134
+ });
1135
+ if (p2.isCancel(nameAns)) process.exit(1);
1136
+ siteName = String(nameAns);
1137
+ }
1017
1138
  const createSpin = p2.spinner();
1018
1139
  createSpin.start(`Creating ${siteType} site '${siteName}'...`);
1019
1140
  const res = await client.rpc(
@@ -1028,9 +1149,15 @@ function registerDeployCommands(program2) {
1028
1149
  zip_file_url: uploaded.file_url,
1029
1150
  is_spa: runtimeVariant === "spa",
1030
1151
  ports_exposes: siteType === "node" ? String(opts.port || jsonc?.port || detected.port || "3000") : "80",
1152
+ base_directory: jsonc?.base_directory || "",
1031
1153
  install_command: jsonc?.install_command || "",
1032
1154
  build_command: siteType === "node" ? jsonc?.build_command || detected.buildCommand || "" : "",
1033
1155
  start_command: siteType === "node" ? opts.start || jsonc?.start_command || detected.startCommand || "npm start" : "",
1156
+ healthcheck_path: jsonc?.healthcheck_path || "",
1157
+ cdn_enabled: jsonc?.cdn?.enabled,
1158
+ waf_enabled: jsonc?.cdn?.waf,
1159
+ limits_memory: jsonc?.resources?.memory !== void 0 ? String(jsonc.resources.memory) : "",
1160
+ limits_cpus: jsonc?.resources?.cpus !== void 0 ? String(jsonc.resources.cpus) : "",
1034
1161
  publish_directory: siteType === "static" ? outputRel : "",
1035
1162
  env_vars: envPayload.length > 0 ? envPayload : void 0
1036
1163
  }
@@ -1042,6 +1169,7 @@ function registerDeployCommands(program2) {
1042
1169
  writeLocalLink(
1043
1170
  {
1044
1171
  site_id: targetSite.name,
1172
+ site_name: targetSite.site_name,
1045
1173
  tenant_id: info.tenant,
1046
1174
  site_type: siteType,
1047
1175
  runtime_variant: runtimeVariant,
@@ -1051,7 +1179,10 @@ function registerDeployCommands(program2) {
1051
1179
  );
1052
1180
  createSpin.stop(`Created ${targetSite.name} -> ${pc3.cyan(targetSite.live_url || targetSite.domain)}`);
1053
1181
  }
1054
- if (opts.detach || !dep.deployment_uuid) {
1182
+ if (domainSpecs.length > 0) {
1183
+ targetSite = await reconcileConfiguredDomains(client, targetSite, domainSpecs);
1184
+ }
1185
+ if (detachMode || !dep.deployment_uuid) {
1055
1186
  console.log(pc3.dim(`Deployment ${dep.name} queued. Check progress with: sagacloud logs`));
1056
1187
  return;
1057
1188
  }
@@ -1216,12 +1347,14 @@ function registerOpsCommands(program2) {
1216
1347
  "saga_cloud.api.hosting.list_deployments",
1217
1348
  { query: { site_id: siteId, limit: Number(opts.limit || 15) } }
1218
1349
  );
1219
- const table = new Table3({ head: ["Version", "ID", "Trigger", "Status", "Live", "Rollback", "Created"] });
1350
+ const table = new Table3({ head: ["Version", "ID", "Channel", "By", "Status", "Live", "Rollback", "Created"] });
1220
1351
  for (const d of res.deployments || []) {
1352
+ const chan = d.cli_token_name ? `${(d.trigger_channel || "cli").toUpperCase()} (${d.cli_token_name})` : (d.trigger_channel || d.trigger_type).toUpperCase();
1221
1353
  table.push([
1222
1354
  `v${d.version_number}`,
1223
1355
  d.name,
1224
- d.trigger_type,
1356
+ chan,
1357
+ d.triggered_by || "-",
1225
1358
  d.status === "finished" ? pc5.green(d.status) : d.status === "failed" ? pc5.red(d.status) : d.status,
1226
1359
  d.is_active ? pc5.green("ACTIVE") : "-",
1227
1360
  d.can_instant_rollback ? "Yes" : "-",
@@ -1273,20 +1406,24 @@ function registerOpsCommands(program2) {
1273
1406
  }
1274
1407
  console.log(table.toString());
1275
1408
  });
1276
- domains.command("add <fqdn>").description("Attach a custom external domain or subdomain").option("--site <siteId>", "Site ID").option("--primary", "Make primary domain", false).action(async (fqdn, opts) => {
1409
+ domains.command("add <fqdns...>").description("Attach one or more owned SagaCloud or custom external domains").option("--site <siteId>", "Site ID").option("--primary", "Set the last added domain as primary live URL", false).action(async (fqdns, opts) => {
1277
1410
  const siteId = resolveActiveSiteId(process.cwd(), opts.site);
1278
1411
  const client = new SagaCloudClient();
1279
- const res = await client.rpc(
1280
- "saga_cloud.api.hosting.add_site_domain",
1281
- {
1412
+ for (let i = 0; i < fqdns.length; i += 1) {
1413
+ const cleanFqdn = fqdns[i].replace(/^https?:\/\//i, "").split("/")[0].trim().toLowerCase().replace(/\.+$/, "");
1414
+ const makePrimary = Boolean(opts.primary) && i === fqdns.length - 1;
1415
+ const res = await client.rpc("saga_cloud.api.hosting.add_site_domain", {
1282
1416
  method: "POST",
1283
- body: { site_id: siteId, domain_mode: "custom_external", custom_fqdn: fqdn, make_primary: Boolean(opts.primary) }
1417
+ body: { site_id: siteId, domain_mode: "auto", custom_fqdn: cleanFqdn, make_primary: makePrimary }
1418
+ });
1419
+ const added = res.added_domain || (res.site.domains || []).find((d) => d.fqdn.toLowerCase() === cleanFqdn);
1420
+ console.log(pc5.green(`Added ${cleanFqdn} to ${res.site.site_name}`));
1421
+ if (added?.dns_auto_configured) {
1422
+ console.log(pc5.green(`\u2713 Automatic workspace DNS + Edge SSL configured (${added.domain_mode})`));
1423
+ } else if (added?.cname_target) {
1424
+ console.log(`Point DNS CNAME: ${pc5.bold(cleanFqdn)} -> ${pc5.cyan(added.cname_target)}`);
1425
+ console.log(pc5.dim(`Then verify SSL with: sagacloud domains verify ${cleanFqdn}`));
1284
1426
  }
1285
- );
1286
- console.log(pc5.green(`Added ${fqdn} to ${res.site.site_name}`));
1287
- if (res.added_domain?.cname_target) {
1288
- console.log(`Point DNS CNAME: ${pc5.bold(fqdn)} -> ${pc5.cyan(res.added_domain.cname_target)}`);
1289
- console.log(pc5.dim(`Then verify SSL with: sagacloud domains verify ${fqdn}`));
1290
1427
  }
1291
1428
  });
1292
1429
  domains.command("verify <fqdn>").description("Verify DNS CNAME and issue Edge SSL").option("--site <siteId>", "Site ID").action(async (fqdn, opts) => {
@@ -1385,10 +1522,11 @@ function registerProjectCommands(program2) {
1385
1522
  const res = await client.rpc("saga_cloud.api.hosting.list_sites", {
1386
1523
  query: { site_type: opts.type, limit: 100 }
1387
1524
  });
1388
- const table = new Table4({ head: ["Site ID", "Name", "Type", "Status", "Live URL"] });
1525
+ const table = new Table4({ head: ["Site ID", "Name", "Type", "Status", "Last Deploy", "Live URL"] });
1389
1526
  for (const s of res.sites || []) {
1390
1527
  const statusColor = s.status === "Online" ? pc6.green(s.status) : s.status === "Failed" ? pc6.red(s.status) : pc6.yellow(s.status);
1391
- table.push([s.name, s.site_name, `${s.site_type}/${s.runtime_variant}`, statusColor, s.live_url || s.domain]);
1528
+ const actor = s.last_deployed_by ? `${(s.last_deploy_channel || "web").toUpperCase()} \xB7 ${s.last_deployed_by}` : "-";
1529
+ table.push([s.name, s.site_name, `${s.site_type}/${s.runtime_variant}`, statusColor, actor, s.live_url || s.domain]);
1392
1530
  }
1393
1531
  console.log(table.toString());
1394
1532
  });
@@ -1419,6 +1557,7 @@ function registerProjectCommands(program2) {
1419
1557
  const detected = detectProject(process.cwd());
1420
1558
  const linkPath = writeLocalLink({
1421
1559
  site_id: details.site.name,
1560
+ site_name: details.site.site_name,
1422
1561
  tenant_id: info.tenant,
1423
1562
  site_type: details.site.site_type,
1424
1563
  runtime_variant: details.site.runtime_variant,
@@ -1455,7 +1594,7 @@ function registerProjectCommands(program2) {
1455
1594
  const jsoncLines = [
1456
1595
  "{",
1457
1596
  ` // Auto-detected: ${detected.frameworkLabel}`,
1458
- ` "name": ${JSON.stringify(siteName)},`,
1597
+ ` "app_name": ${JSON.stringify(siteName)},`,
1459
1598
  ` "type": ${JSON.stringify(detected.runtimeVariant)},`,
1460
1599
  ...detected.buildCommand ? [` "build_command": ${JSON.stringify(detected.buildCommand)},`] : [],
1461
1600
  ...detected.siteType === "static" ? [
@@ -1463,8 +1602,13 @@ function registerProjectCommands(program2) {
1463
1602
  ` "spa_fallback": ${detected.runtimeVariant === "spa"},`
1464
1603
  ] : [
1465
1604
  ` "start_command": ${JSON.stringify(startCmd)},`,
1466
- ` "port": ${port},`
1605
+ ` "port": ${port},`,
1606
+ ` // "healthcheck_path": "/health",`
1467
1607
  ],
1608
+ ` // Add owned SagaCloud domains or external domains to auto-attach on deploy:`,
1609
+ ` // "domains": ["app.example.com"],`,
1610
+ ` // "env_file": ".env.production",`,
1611
+ ` "cdn": { "enabled": true, "waf": false, "purge_on_deploy": true },`,
1468
1612
  ` "ignore": ["node_modules", ".git", ".env*", "tests"]`,
1469
1613
  "}",
1470
1614
  ""
@@ -1480,12 +1624,14 @@ function registerProjectCommands(program2) {
1480
1624
  query: { site_id: siteId, limit: 5 }
1481
1625
  });
1482
1626
  const s = res.site;
1483
- console.log(`${pc6.bold("Site:")} ${s.site_name} (${s.name})`);
1484
- console.log(`${pc6.bold("Type:")} ${s.site_type} / ${s.runtime_variant} (${s.source_type})`);
1485
- console.log(`${pc6.bold("Status:")} ${s.status}`);
1486
- console.log(`${pc6.bold("Live URL:")} ${s.live_url || s.domain}`);
1487
- console.log(`${pc6.bold("SSL / CDN:")} SSL=${s.ssl_status || "-"} \xB7 EdgeCDN=${s.cdn_enabled ? "On" : "Off"} \xB7 Shield=${s.waf_enabled ? "On" : "Off"}`);
1488
- console.log(`${pc6.bold("Deployed:")} ${s.last_deployed_at || "-"}`);
1627
+ const deployActor = s.last_deployed_by ? `${s.last_deployed_by} (${(s.last_deploy_channel || "web").toUpperCase()})` : "-";
1628
+ console.log(`${pc6.bold("Site:")} ${s.site_name} (${s.name})`);
1629
+ console.log(`${pc6.bold("Type:")} ${s.site_type} / ${s.runtime_variant} (${s.source_type})`);
1630
+ console.log(`${pc6.bold("Status:")} ${s.status}`);
1631
+ console.log(`${pc6.bold("Live URL:")} ${s.live_url || s.domain}`);
1632
+ console.log(`${pc6.bold("SSL / CDN:")} SSL=${s.ssl_status || "-"} \xB7 EdgeCDN=${s.cdn_enabled ? "On" : "Off"} \xB7 Shield=${s.waf_enabled ? "On" : "Off"}`);
1633
+ console.log(`${pc6.bold("Deployed:")} ${s.last_deployed_at || "-"}`);
1634
+ console.log(`${pc6.bold("Deployed By:")} ${deployActor}`);
1489
1635
  });
1490
1636
  program2.command("open").description("Open site Live URL in browser").option("--site <siteId>", "Site ID").action(async (opts) => {
1491
1637
  const siteId = resolveActiveSiteId(process.cwd(), opts.site);
@@ -1611,7 +1757,7 @@ function registerSkillCommands(program2) {
1611
1757
 
1612
1758
  // src/index.ts
1613
1759
  var program = new Command();
1614
- program.name("sagacloud").description("SagaCloud CLI \u2014 deploy Static, SPA, Express & Node.js apps cleanly").version("0.2.0");
1760
+ program.name("sagacloud").description("SagaCloud CLI \u2014 deploy Static, SPA, Express & Node.js apps cleanly").version("0.3.0");
1615
1761
  registerAuthCommands(program);
1616
1762
  registerProjectCommands(program);
1617
1763
  registerDeployCommands(program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sagacloud",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Official CLI for SagaCloud Web & App Hosting",
5
5
  "license": "MIT",
6
6
  "author": "SagaSoft",
@@ -90,7 +90,7 @@ sagacloud deploy --git --force --site <site_id>
90
90
  - `sagacloud env push .env.production` (always run `sagacloud deploy` afterward to apply changes)
91
91
  - `sagacloud env pull .env.local`
92
92
  - **Rollback instant or source version:** `sagacloud deployments` → `sagacloud rollback v2`
93
- - **Custom domains & Edge SSL:** `sagacloud domains add app.example.com` → instruct user to set CNAME target → `sagacloud domains verify app.example.com`
93
+ - **Custom domains & Edge SSL:** `sagacloud domains add app.example.com [second.example.com]` (`mode: "auto"` detects owned workspace domains automatically vs external CNAME targets; configure `"domains"` array in `sagacloud.jsonc` for additive merge on `deploy`), or verify SSL with `sagacloud domains verify app.example.com`
94
94
  - **Purge Edge CDN cache:** `sagacloud purge`
95
95
  - **Container power control:** `sagacloud start | stop | restart`
96
96
  - **Generate GitHub Actions workflow:** `sagacloud ci init` (creates `.github/workflows/sagacloud.yml` expecting `secrets.SAGACLOUD_TOKEN`)
@@ -6,7 +6,7 @@ Place `sagacloud.jsonc` (or `sagacloud.json`) in the root of your repository. Tr
6
6
 
7
7
  | Field | Type | Description |
8
8
  | --- | --- | --- |
9
- | `name` | `string` | Default site slug/name when creating a new site |
9
+ | `app_name` (or `name`) | `string` | Default site/app name when creating a new site |
10
10
  | `site_id` | `string` | Explicit target Site ID (`site_...`) if not using `.sagacloud/project.json` |
11
11
  | `type` | `"static" \| "spa" \| "php" \| "node" \| "nextjs"` | Runtime mode override |
12
12
  | `base_directory` | `string` | Optional monorepo subdirectory |
@@ -16,9 +16,14 @@ Place `sagacloud.jsonc` (or `sagacloud.json`) in the root of your repository. Tr
16
16
  | `start_command` | `string` | Start command for Node/SSR runtime (e.g. `npm start`, `node server.js`) |
17
17
  | `port` | `number \| string` | Listening HTTP port inside Node container (default `3000`) |
18
18
  | `spa_fallback` | `boolean` | When `true`, unknown routes rewrite to `/index.html` (`type: "spa"`) |
19
- | `domains` | `string[]` | Custom domains reference list |
19
+ | `healthcheck_path` | `string` | Optional HTTP health check path for Node/SSR apps |
20
+ | `domains` | `(string \| { fqdn, primary?, mode? })[]` | Multiple domains to auto-attach safely on deploy (`mode`: `auto` \| `saga_root` \| `saga_subdomain` \| `custom_external`) |
21
+ | `cdn` | `{ enabled?, waf?, purge_on_deploy? }` | Edge CDN / WAF toggles for new sites |
22
+ | `resources` | `{ memory?, cpus? }` | Container resource limits (e.g. `"512m"`, `"1"`) |
23
+ | `env_file` | `string` | Default `.env` file synced cleanly during `sagacloud deploy` |
20
24
  | `ignore` | `string[]` | Extra glob patterns excluded from upload archive (`node_modules`, `.git`, `.env*`, `.sagacloud`, `sagacloud.json*` are always excluded) |
21
- | `vars` | `Record<string, string \| number \| boolean>` | Non-secret environment variables pushed automatically on `sagacloud deploy` |
25
+ | `vars` | `Record<string, string \| number \| boolean>` | Non-secret environment variables pushed automatically on `sagacloud deploy` (merged, never wipes dashboard secrets) |
26
+ | `deploy` | `{ detach?, force_rebuild?, sync_domains? }` | Default deploy command behavior |
22
27
 
23
28
  ## Auto-Detection Defaults
24
29