shincloud-cli 1.3.0 → 1.4.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.
package/dist/index.js CHANGED
@@ -47,6 +47,27 @@ var ApiClient = class {
47
47
  return `/v1/server/${encodeURIComponent(this.servername)}`;
48
48
  }
49
49
  // ================================================================
50
+ // サーバーサービスAPI(/v1/server・servername非依存)
51
+ // ================================================================
52
+ async listServerPlans(params) {
53
+ return this.get("/v1/server/plans", params);
54
+ }
55
+ async registerServer(data, idempotencyKey) {
56
+ return this.post("/v1/server", data, idempotencyHeaders(idempotencyKey));
57
+ }
58
+ async listServers() {
59
+ return this.get("/v1/server");
60
+ }
61
+ async getServerSignupStatus(servername2) {
62
+ return this.get(`/v1/server/${enc(servername2)}/signup-status`);
63
+ }
64
+ async getServerMemo(servername2) {
65
+ return this.get(`/v1/server/${enc(servername2)}/memo`);
66
+ }
67
+ async updateServerMemo(servername2, data) {
68
+ return this.put(`/v1/server/${enc(servername2)}/memo`, data);
69
+ }
70
+ // ================================================================
50
71
  // サーバー情報
51
72
  // ================================================================
52
73
  async getServerInfo() {
@@ -553,6 +574,21 @@ var ApiClient = class {
553
574
  wphostingSitePath(contractId2, servername2) {
554
575
  return `${this.wphostingPath(contractId2)}/sites/${enc(servername2)}`;
555
576
  }
577
+ async listWphostingPlans(params) {
578
+ return this.get("/v1/wphosting/plans", params);
579
+ }
580
+ async registerWphosting(data, idempotencyKey) {
581
+ return this.post("/v1/wphosting", data, idempotencyHeaders(idempotencyKey));
582
+ }
583
+ async listWphostingContracts() {
584
+ return this.get("/v1/wphosting");
585
+ }
586
+ async getWphostingMemo(contractId2) {
587
+ return this.get(`${this.wphostingPath(contractId2)}/memo`);
588
+ }
589
+ async updateWphostingMemo(contractId2, data) {
590
+ return this.put(`${this.wphostingPath(contractId2)}/memo`, data);
591
+ }
556
592
  async listWphostingSites(contractId2) {
557
593
  return this.get(`${this.wphostingPath(contractId2)}/sites`);
558
594
  }
@@ -818,13 +854,128 @@ function idempotencyHeaders(idempotencyKey) {
818
854
  return idempotencyKey === void 0 ? void 0 : { "Idempotency-Key": idempotencyKey };
819
855
  }
820
856
 
857
+ // ../../shared/dist/billing-confirmation.js
858
+ function formatYen(value) {
859
+ return `${String(value).replace(/\B(?=(\d{3})+(?!\d))/g, ",")}\u5186`;
860
+ }
861
+ function planLabel(planId, planName) {
862
+ return planName === void 0 || planName === planId ? `\u30D7\u30E9\u30F3 ${planId}` : `${planName}\u30D7\u30E9\u30F3\uFF08${planId}\uFF09`;
863
+ }
864
+ function planNameFromPlans(plans, planId) {
865
+ const list = plans?.plans;
866
+ if (!Array.isArray(list))
867
+ return void 0;
868
+ for (const plan of list) {
869
+ const record3 = plan;
870
+ if (record3?.plan_id !== planId)
871
+ continue;
872
+ if (typeof record3.plan_name !== "string" || record3.plan_name === "") {
873
+ return void 0;
874
+ }
875
+ return record3.plan_name;
876
+ }
877
+ return void 0;
878
+ }
879
+ async function resolvePlanName(fetchPlans, planId) {
880
+ try {
881
+ return planNameFromPlans(await fetchPlans(), planId);
882
+ } catch {
883
+ return void 0;
884
+ }
885
+ }
886
+ function billingConfirmationDetailLines(details) {
887
+ const lines = [];
888
+ for (const detail of details) {
889
+ lines.push(`${detail.label}: ${detail.value}`);
890
+ if (detail.note !== void 0)
891
+ lines.push(` \u203B ${detail.note}`);
892
+ }
893
+ return lines;
894
+ }
895
+ function billingPaymentLines(totalPrice) {
896
+ return [
897
+ `\u304A\u652F\u6255\u3044\u91D1\u984D: ${formatYen(totalPrice)}\uFF08\u7A0E\u8FBC\u30FB\u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u9069\u7528\u5F8C\u306E\u5B9F\u652F\u6255\u984D\uFF09`,
898
+ "\u304A\u652F\u6255\u3044\u65B9\u6CD5: \u30D7\u30EA\u30DA\u30A4\u30C9\u6B8B\u9AD8\u304B\u3089\u306E\u5F15\u304D\u843D\u3068\u3057"
899
+ ];
900
+ }
901
+ function autoRenewDetail(autoRenew, options = {}) {
902
+ if (!autoRenew) {
903
+ return {
904
+ label: "\u81EA\u52D5\u66F4\u65B0",
905
+ value: "\u7121\u52B9",
906
+ note: "\u5951\u7D04\u671F\u9650\u307E\u3067\u306B\u624B\u52D5\u3067\u66F4\u65B0\u3057\u306A\u3044\u5834\u5408\u306F\u5931\u52B9\u3057\u307E\u3059\u3002"
907
+ };
908
+ }
909
+ return {
910
+ label: "\u81EA\u52D5\u66F4\u65B0",
911
+ value: "\u6709\u52B9\uFF08\u6B21\u56DE\u4EE5\u964D\u306E\u66F4\u65B0\u3082\u81EA\u52D5\u3067\u8AB2\u91D1\u3055\u308C\u307E\u3059\uFF09",
912
+ note: options.fromDefault ? `${options.optionName ?? "--auto-renew"} \u3092\u6307\u5B9A\u3057\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u65E2\u5B9A\u5024\u306E\u6709\u52B9\u304C\u9069\u7528\u3055\u308C\u307E\u3059\u3002` : void 0
913
+ };
914
+ }
915
+ function partnerCodeDetail(partnerCode) {
916
+ if (partnerCode === void 0)
917
+ return void 0;
918
+ return {
919
+ label: "\u304A\u53D6\u6B21\u5E97\u30B3\u30FC\u30C9",
920
+ value: partnerCode,
921
+ note: "\u5B58\u5728\u3057\u306A\u3044\u30B3\u30FC\u30C9\u3067\u3082\u7533\u8FBC\u306F\u6210\u7ACB\u3057\u3001\u30A8\u30E9\u30FC\u306B\u306A\u308A\u307E\u305B\u3093\u3002\u8868\u8A18\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
922
+ };
923
+ }
924
+ function serverIdDetail(serverId) {
925
+ return {
926
+ label: "\u5E0C\u671B\u30B5\u30FC\u30D0\u30FCID",
927
+ value: serverId ?? "\u6307\u5B9A\u306A\u3057\uFF08\u81EA\u52D5\u3067\u63A1\u756A\u3055\u308C\u307E\u3059\uFF09"
928
+ };
929
+ }
930
+ function compactDetails(details) {
931
+ return details.filter((detail) => detail !== void 0);
932
+ }
933
+
821
934
  // ../../shared/dist/brand-config.js
935
+ function resolveServerPlanBrand(brand, service, planId) {
936
+ if (service === "server" && planId !== void 0) {
937
+ const override = brand.serverPlanOverrides?.find((o) => planId.startsWith(o.planIdPrefix));
938
+ if (override !== void 0) {
939
+ return {
940
+ serviceName: override.serviceName,
941
+ termsUrl: override.termsUrl,
942
+ privacyUrl: override.privacyUrl
943
+ };
944
+ }
945
+ }
946
+ return service === "server" ? {
947
+ serviceName: brand.serverServiceName,
948
+ termsUrl: brand.serverTermsUrl,
949
+ privacyUrl: brand.serverPrivacyUrl
950
+ } : {
951
+ serviceName: brand.wphostingServiceName,
952
+ termsUrl: brand.wphostingTermsUrl,
953
+ privacyUrl: brand.wphostingPrivacyUrl
954
+ };
955
+ }
822
956
  function domainLegalNoticeLines(brand) {
823
957
  return [
824
958
  `\u30B5\u30FC\u30D3\u30B9\u5229\u7528\u898F\u7D04: ${brand.domainTermsUrl}`,
825
959
  `\u500B\u4EBA\u60C5\u5831\u306E\u53D6\u308A\u6271\u3044\u306B\u3064\u3044\u3066: ${brand.domainPrivacyUrl}`
826
960
  ];
827
961
  }
962
+ function signupOperationName(brand, service, planId) {
963
+ const { serviceName } = resolveServerPlanBrand(brand, service, planId);
964
+ if (serviceName === void 0) {
965
+ throw new Error(`${service}\u306E\u30B5\u30FC\u30D3\u30B9\u540D\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093`);
966
+ }
967
+ return `${serviceName} \u65B0\u898F\u304A\u7533\u3057\u8FBC\u307F`;
968
+ }
969
+ function signupLegalNoticeLines(brand, service, planId) {
970
+ const { termsUrl, privacyUrl } = resolveServerPlanBrand(brand, service, planId);
971
+ if (termsUrl === void 0 || privacyUrl === void 0) {
972
+ throw new Error(`${service}\u306E\u5229\u7528\u898F\u7D04\u30FB\u500B\u4EBA\u60C5\u5831URL\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093`);
973
+ }
974
+ return [
975
+ `\u30B5\u30FC\u30D3\u30B9\u5229\u7528\u898F\u7D04: ${termsUrl}`,
976
+ `\u500B\u4EBA\u60C5\u5831\u306E\u53D6\u308A\u6271\u3044\u306B\u3064\u3044\u3066: ${privacyUrl}`
977
+ ];
978
+ }
828
979
 
829
980
  // ../../shared/dist/domain-acquisition-permission.js
830
981
  function record(value) {
@@ -858,8 +1009,11 @@ async function withDomainAcquisitionPermissionDiagnosis(client2, request) {
858
1009
  }
859
1010
  }
860
1011
 
861
- // ../core/dist/commands/auth/login.js
862
- import { password, select } from "@inquirer/prompts";
1012
+ // ../core/dist/lib/command-helper.js
1013
+ import { createInterface } from "readline/promises";
1014
+ import { randomUUID } from "crypto";
1015
+ import { stdin as input, stderr as output } from "process";
1016
+ import { confirm } from "@inquirer/prompts";
863
1017
 
864
1018
  // ../core/dist/lib/config.js
865
1019
  import fs from "fs";
@@ -887,6 +1041,10 @@ function saveConfig(brand, config) {
887
1041
  fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
888
1042
  }
889
1043
  function getActiveProfile(brand, profileName) {
1044
+ if (profileName) {
1045
+ const config2 = loadConfig(brand);
1046
+ return config2.profiles[profileName] || null;
1047
+ }
890
1048
  const envPrefix = brand.brand.toUpperCase();
891
1049
  const envApiKey = process.env[`${envPrefix}_API_KEY`] || process.env["XSERVER_API_KEY"];
892
1050
  const envServername = process.env[`${envPrefix}_SERVERNAME`] || process.env["XSERVER_SERVERNAME"];
@@ -897,7 +1055,7 @@ function getActiveProfile(brand, profileName) {
897
1055
  };
898
1056
  }
899
1057
  const config = loadConfig(brand);
900
- const name = profileName || config.defaultProfile || "default";
1058
+ const name = config.defaultProfile || "default";
901
1059
  return config.profiles[name] || null;
902
1060
  }
903
1061
 
@@ -907,114 +1065,6 @@ function resolveApiBase(brand) {
907
1065
  return (process.env[`${envPrefix}_API_BASE_URL`] ?? process.env.XSERVER_API_BASE_URL ?? brand.apiBase).replace(/\/+$/, "");
908
1066
  }
909
1067
 
910
- // ../core/dist/lib/auth-service-info.js
911
- var SERVICE_ORDER = ["server", "domain", "wphosting"];
912
- var NO_DEFAULT_SERVER = "__XSERVER_NO_DEFAULT_SERVER__";
913
- function servernameChoices(targets) {
914
- return [
915
- ...targets.map((target) => ({ value: target, name: target })),
916
- {
917
- value: NO_DEFAULT_SERVER,
918
- name: "\u56FA\u5B9A\u3057\u306A\u3044\uFF08\u30B3\u30DE\u30F3\u30C9\u5B9F\u884C\u6642\u306B --servername \u3067\u6307\u5B9A\uFF09"
919
- }
920
- ];
921
- }
922
- function record2(value) {
923
- return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
924
- }
925
- function strings(value) {
926
- return Array.isArray(value) ? value.filter((item) => typeof item === "string" && item !== "") : [];
927
- }
928
- function stringValue(value, fallback) {
929
- return typeof value === "string" && value !== "" ? value : fallback;
930
- }
931
- function parseAuthApiKeyInfo(meData) {
932
- const rawServices = record2(meData.services);
933
- const services = [];
934
- for (const name of SERVICE_ORDER) {
935
- const block = record2(rawServices?.[name]);
936
- if (!block)
937
- continue;
938
- const service = {
939
- name,
940
- permissionType: stringValue(block.permission_type, "unknown"),
941
- targetMode: stringValue(block.target_mode, "unknown"),
942
- targets: strings(block.targets)
943
- };
944
- if (name === "domain" && typeof block.allow_acquisition === "boolean") {
945
- service.allowAcquisition = block.allow_acquisition;
946
- }
947
- if (name === "wphosting") {
948
- service.siteTargetMode = stringValue(block.site_target_mode, "unknown");
949
- service.sites = strings(block.sites);
950
- }
951
- services.push(service);
952
- }
953
- return {
954
- expiresAt: typeof meData.expires_at === "string" ? meData.expires_at : null,
955
- services
956
- };
957
- }
958
- function hasAuthService(info, name) {
959
- return info.services.some((service) => service.name === name);
960
- }
961
- function permissionLabel(value) {
962
- if (value === "full")
963
- return "\u3059\u3079\u3066\u306E\u64CD\u4F5C";
964
- if (value === "read")
965
- return "\u8AAD\u307F\u53D6\u308A\u5C02\u7528";
966
- if (value === "custom")
967
- return "\u30AB\u30B9\u30BF\u30E0";
968
- return value === "unknown" ? "\u4E0D\u660E" : value;
969
- }
970
- function targetLines(service) {
971
- if (service.name === "wphosting") {
972
- if (service.targetMode === "all")
973
- return [" \u5BFE\u8C61\u5951\u7D04: \u3059\u3079\u3066"];
974
- return [" \u5BFE\u8C61\u5951\u7D04:", ...service.targets.map((target) => ` - ${target}`)];
975
- }
976
- const label = service.name === "server" ? "\u5BFE\u8C61\u30B5\u30FC\u30D0\u30FC" : "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3";
977
- if (service.targetMode === "all") {
978
- return [` ${label}: \u3059\u3079\u3066`];
979
- }
980
- const lines = [` ${label}:`];
981
- lines.push(...service.targets.map((target) => ` - ${target}`));
982
- return lines;
983
- }
984
- function siteTargetLines(service) {
985
- if (service.name !== "wphosting")
986
- return [];
987
- if (service.siteTargetMode === "all")
988
- return [" \u5BFE\u8C61\u30B5\u30A4\u30C8: \u3059\u3079\u3066"];
989
- const sites = service.sites ?? [];
990
- return [" \u5BFE\u8C61\u30B5\u30A4\u30C8:", ...sites.map((site) => ` - ${site}`)];
991
- }
992
- function formatAuthApiKeyInfo(info) {
993
- const lines = ["\u5229\u7528\u53EF\u80FD\u306A\u30B5\u30FC\u30D3\u30B9:"];
994
- if (info.services.length === 0) {
995
- lines.push(" \u306A\u3057");
996
- }
997
- for (const service of info.services) {
998
- const label = service.name === "server" ? "Server" : service.name === "domain" ? "Domain" : "XServer for WordPress";
999
- lines.push(` ${label}`);
1000
- lines.push(` \u6A29\u9650: ${permissionLabel(service.permissionType)}`);
1001
- lines.push(...targetLines(service));
1002
- lines.push(...siteTargetLines(service));
1003
- if (service.name === "domain" && service.allowAcquisition !== void 0) {
1004
- lines.push(` \u53D6\u5F97\u30FB\u79FB\u7BA1\u30FB\u66F4\u65B0: ${service.allowAcquisition ? "\u8A31\u53EF\u3055\u308C\u3066\u3044\u307E\u3059" : "\u8A31\u53EF\u3055\u308C\u3066\u3044\u307E\u305B\u3093"}`);
1005
- }
1006
- }
1007
- if (info.expiresAt) {
1008
- lines.push("", `API\u30AD\u30FC\u6709\u52B9\u671F\u9650: ${info.expiresAt}`);
1009
- }
1010
- return lines;
1011
- }
1012
-
1013
- // ../core/dist/lib/command-helper.js
1014
- import { createInterface } from "readline/promises";
1015
- import { stdin as input, stderr as output } from "process";
1016
- import { confirm } from "@inquirer/prompts";
1017
-
1018
1068
  // ../core/dist/lib/output.js
1019
1069
  function formatOutput(data, format) {
1020
1070
  if (format === "json") {
@@ -1115,6 +1165,134 @@ function padRight(str, targetWidth) {
1115
1165
  return str + " ".repeat(padding);
1116
1166
  }
1117
1167
 
1168
+ // ../core/dist/lib/domain-validation.js
1169
+ var DNS_TYPES = /* @__PURE__ */ new Set(["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SRV"]);
1170
+ var IDEMPOTENCY_KEY_PATTERN = /^[A-Za-z0-9_-]{8,64}$/;
1171
+ function isObject(value) {
1172
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1173
+ }
1174
+ function parseInteger(value, optionName, minimum, maximum) {
1175
+ if (!/^\d+$/.test(value)) {
1176
+ throw new Error(`${optionName} \u306F\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
1177
+ }
1178
+ const parsed = Number(value);
1179
+ if (!Number.isSafeInteger(parsed) || parsed < minimum || maximum !== void 0 && parsed > maximum) {
1180
+ const range = maximum === void 0 ? `${minimum}\u4EE5\u4E0A` : `${minimum}\uFF5E${maximum}`;
1181
+ throw new Error(`${optionName} \u306F${range}\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
1182
+ }
1183
+ return parsed;
1184
+ }
1185
+ function parseStrictBoolean(value, optionName) {
1186
+ if (value === "true")
1187
+ return true;
1188
+ if (value === "false")
1189
+ return false;
1190
+ throw new Error(`${optionName} \u306F true \u307E\u305F\u306F false \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
1191
+ }
1192
+ function parseNameservers(value) {
1193
+ const nameservers = value.split(",").map((item) => item.trim()).filter(Boolean);
1194
+ if (nameservers.length < 1 || nameservers.length > 13) {
1195
+ throw new Error("--nameservers \u306F1\uFF5E13\u4EF6\u3092\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
1196
+ }
1197
+ validateNameserverHostnames(nameservers, 253);
1198
+ if (new Set(nameservers.map((item) => item.toLowerCase())).size !== nameservers.length) {
1199
+ throw new Error("\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\u3092\u91CD\u8907\u3057\u3066\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093");
1200
+ }
1201
+ return nameservers;
1202
+ }
1203
+ function parseRegistrationNameservers(value) {
1204
+ const nameservers = value.split(",").map((item) => item.trim()).filter(Boolean);
1205
+ if (nameservers.length < 1 || nameservers.length > 6) {
1206
+ throw new Error("--nameservers \u306F1\uFF5E6\u4EF6\u3092\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
1207
+ }
1208
+ validateNameserverHostnames(nameservers, 255);
1209
+ if (new Set(nameservers.map((item) => item.toLowerCase())).size !== nameservers.length) {
1210
+ throw new Error("\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\u3092\u91CD\u8907\u3057\u3066\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093");
1211
+ }
1212
+ return nameservers;
1213
+ }
1214
+ function validateNameserverHostnames(nameservers, maximumLength) {
1215
+ const hostnamePattern = /^[A-Za-z0-9]([A-Za-z0-9.-]*[A-Za-z0-9])?$/;
1216
+ for (const nameserver of nameservers) {
1217
+ if (nameserver.length > maximumLength || !hostnamePattern.test(nameserver)) {
1218
+ throw new Error(`\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\u306F\u5404${maximumLength}\u6587\u5B57\u4EE5\u5185\u306E\u30DB\u30B9\u30C8\u540D\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
1219
+ }
1220
+ }
1221
+ }
1222
+ function parseWhoisData(value) {
1223
+ let parsed;
1224
+ try {
1225
+ parsed = JSON.parse(value);
1226
+ } catch {
1227
+ throw new Error("--data \u306F\u6709\u52B9\u306AJSON\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
1228
+ }
1229
+ if (!isObject(parsed)) {
1230
+ throw new Error("--data \u306FJSON\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
1231
+ }
1232
+ if (Object.prototype.hasOwnProperty.call(parsed, "whois_privacy_flag")) {
1233
+ throw new Error("whois_privacy_flag \u306F\u5EC3\u6B62\u3055\u308C\u3066\u3044\u307E\u3059\u3002whois_privacy \u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044");
1234
+ }
1235
+ const hasPrivacy = Object.prototype.hasOwnProperty.call(parsed, "whois_privacy");
1236
+ const hasFields = Object.prototype.hasOwnProperty.call(parsed, "fields");
1237
+ if (!hasPrivacy && !hasFields) {
1238
+ throw new Error("--data \u306B\u306F whois_privacy \u307E\u305F\u306F fields \u306E\u3044\u305A\u308C\u304B\u304C\u5FC5\u8981\u3067\u3059");
1239
+ }
1240
+ if (hasPrivacy && typeof parsed.whois_privacy !== "boolean") {
1241
+ throw new Error("whois_privacy \u306Fboolean\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
1242
+ }
1243
+ if (hasFields && !isObject(parsed.fields)) {
1244
+ throw new Error("fields \u306FJSON\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
1245
+ }
1246
+ return parsed;
1247
+ }
1248
+ function validateDnsType(value) {
1249
+ const type = value.toUpperCase();
1250
+ if (!DNS_TYPES.has(type)) {
1251
+ throw new Error("--type \u306F A / AAAA / CNAME / MX / TXT / NS / SRV \u306E\u3044\u305A\u308C\u304B\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
1252
+ }
1253
+ return type;
1254
+ }
1255
+ function validateDnsHost(value) {
1256
+ if (value.length === 0 || value.length > 64) {
1257
+ throw new Error("--host \u306F1\uFF5E64\u6587\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
1258
+ }
1259
+ return value;
1260
+ }
1261
+ function validateDnsContent(value) {
1262
+ if (value.length === 0 || value.length > 1024) {
1263
+ throw new Error("--content \u306F1\uFF5E1024\u6587\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
1264
+ }
1265
+ return value;
1266
+ }
1267
+ function validateDnsId(value) {
1268
+ if (!/^[1-9]\d*$/.test(value)) {
1269
+ throw new Error("dns_id \u306F\u6B63\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
1270
+ }
1271
+ return value;
1272
+ }
1273
+ function validateIdempotencyKey(value) {
1274
+ if (!IDEMPOTENCY_KEY_PATTERN.test(value)) {
1275
+ throw new Error("--idempotency-key \u306F\u82F1\u6570\u5B57\u30FB_\u30FB-\u306E8\uFF5E64\u6587\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
1276
+ }
1277
+ return value;
1278
+ }
1279
+ function validateDate(value, optionName) {
1280
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
1281
+ throw new Error(`${optionName} \u306FYYYY-MM-DD\u5F62\u5F0F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
1282
+ }
1283
+ const [year, month, day] = value.split("-").map(Number);
1284
+ const date = new Date(Date.UTC(year, month - 1, day));
1285
+ if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day) {
1286
+ throw new Error(`${optionName} \u306B\u5B58\u5728\u3059\u308B\u65E5\u4ED8\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
1287
+ }
1288
+ return value;
1289
+ }
1290
+ function requireAtLeastOneField(data, message) {
1291
+ if (Object.keys(data).length === 0) {
1292
+ throw new Error(message);
1293
+ }
1294
+ }
1295
+
1118
1296
  // ../core/dist/lib/command-helper.js
1119
1297
  function findRoot(cmd) {
1120
1298
  let root = cmd;
@@ -1169,49 +1347,248 @@ async function confirmDestructiveAction(cmd, message) {
1169
1347
  process.exit(1);
1170
1348
  }
1171
1349
  }
1172
- function billingPurchasePhrase(domain, totalPrice) {
1173
- return `${domain} \u3092\u7A0E\u8FBC${totalPrice}\u5186\u3067\u627F\u8A8D`;
1174
- }
1175
- function billingPurchaseMessage(params) {
1176
- const phrase = billingPurchasePhrase(params.domain, params.totalPrice);
1177
- return [
1178
- `\u8AB2\u91D1\u78BA\u8A8D: ${params.operation}`,
1179
- `\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3: ${params.domain}`,
1180
- `\u7A0E\u8FBC\u5408\u8A08: ${params.totalPrice}\u5186`,
1181
- ...domainLegalNoticeLines(params.brand),
1182
- "\u7533\u8ACB\u5F8C\u306F\u8AB2\u91D1\u3055\u308C\u3001\u539F\u5247\u53D6\u308A\u6D88\u3057\u3067\u304D\u307E\u305B\u3093\u3002",
1183
- `\u7D9A\u884C\u3059\u308B\u5834\u5408\u306F\u6B21\u3092\u6B63\u78BA\u306B\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044: ${phrase}`,
1184
- ""
1185
- ].join("\n");
1350
+ var defaultBillingConfirmationIo = { input, output };
1351
+ function billingPurchasePhrase(subject, totalPrice) {
1352
+ return `${subject} \u3092\u7A0E\u8FBC${formatYen(totalPrice)}\u3067\u627F\u8A8D`;
1353
+ }
1354
+ function billingConfirmationMessage(params) {
1355
+ const phrase = billingPurchasePhrase(params.confirmSubject, params.totalPrice);
1356
+ return [
1357
+ `\u8AB2\u91D1\u78BA\u8A8D: ${params.operation}`,
1358
+ `${params.targetLabel}: ${params.target}`,
1359
+ ...billingConfirmationDetailLines(params.details ?? []),
1360
+ ...billingPaymentLines(params.totalPrice),
1361
+ ...params.legalNoticeLines,
1362
+ "\u7533\u8ACB\u3059\u308B\u3068\u8AB2\u91D1\u3055\u308C\u3001\u53D6\u308A\u6D88\u305B\u307E\u305B\u3093\u3002",
1363
+ `\u7D9A\u884C\u3059\u308B\u5834\u5408\u306F\u6B21\u3092\u6B63\u78BA\u306B\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044: ${phrase}`,
1364
+ ""
1365
+ ].join("\n");
1366
+ }
1367
+ function assertBillingTty(io) {
1368
+ if (!io.input.isTTY || !io.output.isTTY) {
1369
+ throw new Error("\u8AB2\u91D1\u3092\u4F34\u3046\u5B9F\u7533\u8ACB\u306F\u5BFE\u8A71\u7AEF\u672B\uFF08TTY\uFF09\u3067\u306E\u307F\u5B9F\u884C\u3067\u304D\u307E\u3059\u3002\u975E\u5BFE\u8A71\u74B0\u5883\u3067\u306F --dry-run \u306E\u307F\u5229\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
1370
+ }
1371
+ }
1372
+ var BillingCancelledError = class extends Error {
1373
+ constructor(message) {
1374
+ super(message);
1375
+ this.name = "BillingCancelledError";
1376
+ }
1377
+ };
1378
+ var RESEND_GUIDANCE = /* @__PURE__ */ Symbol.for("xnp.cli.billingResendGuidance");
1379
+ function attachResendGuidance(error, lines) {
1380
+ if (typeof error === "object" && error !== null) {
1381
+ error[RESEND_GUIDANCE] = lines;
1382
+ }
1383
+ }
1384
+ function billingResendGuidance(error) {
1385
+ if (typeof error === "object" && error !== null) {
1386
+ const lines = error[RESEND_GUIDANCE];
1387
+ if (Array.isArray(lines))
1388
+ return lines;
1389
+ }
1390
+ return void 0;
1391
+ }
1392
+ async function confirmBillingPurchase(params, io = defaultBillingConfirmationIo) {
1393
+ assertBillingTty(io);
1394
+ io.output.write(billingConfirmationMessage(params));
1395
+ const phrase = billingPurchasePhrase(params.confirmSubject, params.totalPrice);
1396
+ const rl = createInterface({
1397
+ input: io.input,
1398
+ output: io.output,
1399
+ terminal: true
1400
+ });
1401
+ try {
1402
+ const answer = (await rl.question("> ")).trim();
1403
+ if (answer !== phrase) {
1404
+ throw new BillingCancelledError("\u78BA\u8A8D\u6587\u5B57\u5217\u304C\u4E00\u81F4\u3057\u306A\u3044\u305F\u3081\u3001\u5B9F\u7533\u8ACB\u3092\u4E2D\u6B62\u3057\u307E\u3057\u305F\u3002");
1405
+ }
1406
+ } finally {
1407
+ rl.close();
1408
+ }
1409
+ }
1410
+ async function executeBillingPurchase(params) {
1411
+ console.error(`Idempotency-Key: ${params.idempotencyKey}`);
1412
+ try {
1413
+ const result = await params.execute();
1414
+ console.error(`${params.operation}\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F\u3002`);
1415
+ return result;
1416
+ } catch (error) {
1417
+ attachResendGuidance(error, [
1418
+ "\u5165\u529B\u4E0D\u5099\u30FB\u6B8B\u9AD8\u4E0D\u8DB3\u30FB\u4FA1\u683C\u4E0D\u4E00\u81F4\u306A\u3069\u3067\u5374\u4E0B\u3055\u308C\u305F\u5834\u5408\u306F\u3001\u3053\u306E\u30AD\u30FC\u306E\u307E\u307E\u518D\u5B9F\u884C\u3067\u304D\u307E\u3059\u3002",
1419
+ `\u5FDC\u7B54\u3092\u53D7\u3051\u53D6\u308C\u306A\u304B\u3063\u305F\u5834\u5408\u3084\u30B5\u30FC\u30D0\u30FC\u30A8\u30E9\u30FC\u306E\u5834\u5408\u306F\u3001\u307E\u305A\u540C\u3058\u30AD\u30FC\u3067\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u5B8C\u4E86\u6E08\u307F\u306A\u3089\u524D\u56DE\u306E\u7D50\u679C\u3092\u53D6\u5F97\u3067\u304D\u307E\u3059\u3002\u51E6\u7406\u304C\u5B8C\u4E86\u3057\u3066\u3044\u306A\u3044\u5834\u5408\u306F48\u6642\u9593 409 DUPLICATE_REQUEST \u306B\u306A\u308B\u305F\u3081\u3001${params.statusCommand ?? `domain show ${params.subject}`} \u3068\u8ACB\u6C42\u5C65\u6B74\u3067\u72B6\u614B\u3092\u78BA\u8A8D\u3057\u3001\u672A\u5B9F\u884C\u3068\u78BA\u8A8D\u3067\u304D\u305F\u3068\u304D\u306E\u307F\u65B0\u3057\u3044\u30AD\u30FC\u3067\u518D\u7533\u8ACB\u3057\u3066\u304F\u3060\u3055\u3044\u3002`
1420
+ ]);
1421
+ throw error;
1422
+ }
1423
+ }
1424
+ async function runBillingPurchase(flow) {
1425
+ if (!flow.options.agreeToTerms) {
1426
+ throw new Error("\u7533\u8FBC\u306Edry-run\u304A\u3088\u3073\u5B9F\u7533\u8ACB\u306B\u306F --agree-to-terms \u306B\u3088\u308B\u5229\u7528\u898F\u7D04\u3078\u306E\u660E\u793A\u540C\u610F\u304C\u5FC5\u8981\u3067\u3059");
1427
+ }
1428
+ const preview = await flow.preview();
1429
+ if (flow.options.dryRun) {
1430
+ printResult(preview, flow.format);
1431
+ return;
1432
+ }
1433
+ const expectedTotalPrice = parseNonnegativeInteger(flow.options.expectedTotalPrice, "--expected-total-price");
1434
+ const idempotencyKey = validateIdempotencyKey(flow.options.idempotencyKey ?? randomUUID());
1435
+ const totalPrice = totalPriceFromPreview(preview, expectedTotalPrice);
1436
+ if (!flow.options.confirmPurchase) {
1437
+ throw new Error("\u5B9F\u7533\u8ACB\u306B\u306F --confirm-purchase \u304C\u5FC5\u8981\u3067\u3059\uFF08--yes \u3067\u306F\u7701\u7565\u3067\u304D\u307E\u305B\u3093\uFF09\u3002\u7D9A\u3051\u3066TTY\u3067\u78BA\u8A8D\u6587\u5B57\u5217\u306E\u5165\u529B\u3082\u5FC5\u8981\u3067\u3059");
1438
+ }
1439
+ const confirmationIo = flow.confirmationIo ?? defaultBillingConfirmationIo;
1440
+ assertBillingTty(confirmationIo);
1441
+ const { target, confirmSubject } = await flow.resolveTarget();
1442
+ await confirmBillingPurchase({
1443
+ operation: flow.operation,
1444
+ target,
1445
+ targetLabel: flow.targetLabel,
1446
+ details: flow.details,
1447
+ totalPrice,
1448
+ legalNoticeLines: flow.legalNoticeLines,
1449
+ confirmSubject
1450
+ }, confirmationIo);
1451
+ const result = await executeBillingPurchase({
1452
+ idempotencyKey,
1453
+ operation: flow.operation,
1454
+ subject: target,
1455
+ statusCommand: flow.statusCommand,
1456
+ execute: () => flow.execute(idempotencyKey)
1457
+ });
1458
+ printResult(result, flow.format);
1459
+ }
1460
+ function parseNonnegativeInteger(value, optionName) {
1461
+ if (!/^\d+$/.test(value))
1462
+ throw new Error(`${optionName} \u306F\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
1463
+ const parsed = Number(value);
1464
+ if (!Number.isSafeInteger(parsed) || parsed < 0) {
1465
+ throw new Error(`${optionName} \u306F0\u4EE5\u4E0A\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
1466
+ }
1467
+ return parsed;
1468
+ }
1469
+ function totalPriceFromPreview(preview, expectedTotalPrice) {
1470
+ const totalPrice = Number(preview?.total_price);
1471
+ if (!Number.isFinite(totalPrice)) {
1472
+ throw new Error("dry-run\u7D50\u679C\u304B\u3089\u5408\u8A08\u91D1\u984D\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002");
1473
+ }
1474
+ if (totalPrice !== expectedTotalPrice) {
1475
+ throw new Error(`\u4FA1\u683C\u4E0D\u4E00\u81F4\u306E\u305F\u3081\u5B9F\u7533\u8ACB\u3092\u4E2D\u6B62\u3057\u307E\u3057\u305F\uFF08\u898B\u7A4D ${totalPrice}\u5186 / \u6307\u5B9A ${expectedTotalPrice}\u5186\uFF09\u3002`);
1476
+ }
1477
+ return totalPrice;
1478
+ }
1479
+ function pickDefined(obj) {
1480
+ const result = {};
1481
+ for (const [key, value] of Object.entries(obj)) {
1482
+ if (value !== void 0)
1483
+ result[key] = value;
1484
+ }
1485
+ return result;
1486
+ }
1487
+
1488
+ // ../core/dist/commands/auth/login.js
1489
+ import { password, select } from "@inquirer/prompts";
1490
+
1491
+ // ../core/dist/lib/auth-service-info.js
1492
+ var SERVICE_ORDER = ["server", "domain", "wphosting"];
1493
+ var NO_DEFAULT_SERVER = "__XSERVER_NO_DEFAULT_SERVER__";
1494
+ function servernameChoices(targets) {
1495
+ return [
1496
+ ...targets.map((target) => ({ value: target, name: target })),
1497
+ {
1498
+ value: NO_DEFAULT_SERVER,
1499
+ name: "\u56FA\u5B9A\u3057\u306A\u3044\uFF08\u30B3\u30DE\u30F3\u30C9\u5B9F\u884C\u6642\u306B --servername \u3067\u6307\u5B9A\uFF09"
1500
+ }
1501
+ ];
1502
+ }
1503
+ function record2(value) {
1504
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
1505
+ }
1506
+ function strings(value) {
1507
+ return Array.isArray(value) ? value.filter((item) => typeof item === "string" && item !== "") : [];
1508
+ }
1509
+ function stringValue(value, fallback) {
1510
+ return typeof value === "string" && value !== "" ? value : fallback;
1511
+ }
1512
+ function parseAuthApiKeyInfo(meData) {
1513
+ const rawServices = record2(meData.services);
1514
+ const services = [];
1515
+ for (const name of SERVICE_ORDER) {
1516
+ const block = record2(rawServices?.[name]);
1517
+ if (!block)
1518
+ continue;
1519
+ const service = {
1520
+ name,
1521
+ permissionType: stringValue(block.permission_type, "unknown"),
1522
+ targetMode: stringValue(block.target_mode, "unknown"),
1523
+ targets: strings(block.targets)
1524
+ };
1525
+ if (name === "domain" && typeof block.allow_acquisition === "boolean") {
1526
+ service.allowAcquisition = block.allow_acquisition;
1527
+ }
1528
+ if (name === "wphosting") {
1529
+ service.siteTargetMode = stringValue(block.site_target_mode, "unknown");
1530
+ service.sites = strings(block.sites);
1531
+ }
1532
+ services.push(service);
1533
+ }
1534
+ return {
1535
+ expiresAt: typeof meData.expires_at === "string" ? meData.expires_at : null,
1536
+ services
1537
+ };
1538
+ }
1539
+ function hasAuthService(info, name) {
1540
+ return info.services.some((service) => service.name === name);
1541
+ }
1542
+ function permissionLabel(value) {
1543
+ if (value === "full")
1544
+ return "\u3059\u3079\u3066\u306E\u64CD\u4F5C";
1545
+ if (value === "read")
1546
+ return "\u8AAD\u307F\u53D6\u308A\u5C02\u7528";
1547
+ if (value === "custom")
1548
+ return "\u30AB\u30B9\u30BF\u30E0";
1549
+ return value === "unknown" ? "\u4E0D\u660E" : value;
1550
+ }
1551
+ function targetLines(service) {
1552
+ if (service.name === "wphosting") {
1553
+ if (service.targetMode === "all")
1554
+ return [" \u5BFE\u8C61\u5951\u7D04: \u3059\u3079\u3066"];
1555
+ return [" \u5BFE\u8C61\u5951\u7D04:", ...service.targets.map((target) => ` - ${target}`)];
1556
+ }
1557
+ const label = service.name === "server" ? "\u5BFE\u8C61\u30B5\u30FC\u30D0\u30FC" : "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3";
1558
+ if (service.targetMode === "all") {
1559
+ return [` ${label}: \u3059\u3079\u3066`];
1560
+ }
1561
+ const lines = [` ${label}:`];
1562
+ lines.push(...service.targets.map((target) => ` - ${target}`));
1563
+ return lines;
1564
+ }
1565
+ function siteTargetLines(service) {
1566
+ if (service.name !== "wphosting")
1567
+ return [];
1568
+ if (service.siteTargetMode === "all")
1569
+ return [" \u5BFE\u8C61\u30B5\u30A4\u30C8: \u3059\u3079\u3066"];
1570
+ const sites = service.sites ?? [];
1571
+ return [" \u5BFE\u8C61\u30B5\u30A4\u30C8:", ...sites.map((site) => ` - ${site}`)];
1186
1572
  }
1187
- async function confirmBillingPurchase(params) {
1188
- if (!input.isTTY || !output.isTTY) {
1189
- throw new Error("\u8AB2\u91D1\u3092\u4F34\u3046\u5B9F\u7533\u8ACB\u306F\u5BFE\u8A71\u7AEF\u672B\uFF08TTY\uFF09\u3067\u306E\u307F\u5B9F\u884C\u3067\u304D\u307E\u3059\u3002\u975E\u5BFE\u8A71\u74B0\u5883\u3067\u306F --dry-run \u306E\u307F\u5229\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
1573
+ function formatAuthApiKeyInfo(info) {
1574
+ const lines = ["\u5229\u7528\u53EF\u80FD\u306A\u30B5\u30FC\u30D3\u30B9:"];
1575
+ if (info.services.length === 0) {
1576
+ lines.push(" \u306A\u3057");
1190
1577
  }
1191
- const phrase = billingPurchasePhrase(params.domain, params.totalPrice);
1192
- output.write(billingPurchaseMessage(params));
1193
- const rl = createInterface({ input, output, terminal: true });
1194
- try {
1195
- const answer = (await rl.question("> ")).trim();
1196
- if (answer !== phrase) {
1197
- throw new Error("\u78BA\u8A8D\u6587\u5B57\u5217\u304C\u4E00\u81F4\u3057\u306A\u3044\u305F\u3081\u3001\u5B9F\u7533\u8ACB\u3092\u4E2D\u6B62\u3057\u307E\u3057\u305F\u3002");
1578
+ for (const service of info.services) {
1579
+ const label = service.name === "server" ? "Server" : service.name === "domain" ? "Domain" : "XServer for WordPress";
1580
+ lines.push(` ${label}`);
1581
+ lines.push(` \u6A29\u9650: ${permissionLabel(service.permissionType)}`);
1582
+ lines.push(...targetLines(service));
1583
+ lines.push(...siteTargetLines(service));
1584
+ if (service.name === "domain" && service.allowAcquisition !== void 0) {
1585
+ lines.push(` \u53D6\u5F97\u30FB\u79FB\u7BA1\u30FB\u66F4\u65B0: ${service.allowAcquisition ? "\u8A31\u53EF\u3055\u308C\u3066\u3044\u307E\u3059" : "\u8A31\u53EF\u3055\u308C\u3066\u3044\u307E\u305B\u3093"}`);
1198
1586
  }
1199
- } finally {
1200
- rl.close();
1201
1587
  }
1202
- }
1203
- function printIdempotencyKeyNotice(idempotencyKey, domain) {
1204
- console.error(`Idempotency-Key: ${idempotencyKey}`);
1205
- console.error("\u5165\u529B\u4E0D\u5099\u30FB\u6B8B\u9AD8\u4E0D\u8DB3\u30FB\u4FA1\u683C\u4E0D\u4E00\u81F4\u306A\u3069\u3067\u5374\u4E0B\u3055\u308C\u305F\u5834\u5408\u306F\u3001\u3053\u306E\u30AD\u30FC\u306E\u307E\u307E\u518D\u5B9F\u884C\u3067\u304D\u307E\u3059\u3002");
1206
- console.error(`\u5FDC\u7B54\u3092\u53D7\u3051\u53D6\u308C\u306A\u304B\u3063\u305F\u5834\u5408\u3084\u30B5\u30FC\u30D0\u30FC\u30A8\u30E9\u30FC\u306E\u5834\u5408\u306F\u3001\u540C\u3058\u30AD\u30FC\u3067\u306E\u518D\u9001\u306F48\u6642\u9593 409 DUPLICATE_REQUEST \u306B\u306A\u308A\u307E\u3059\u3002domain show ${domain} \u3068\u8ACB\u6C42\u5C65\u6B74\u3067\u72B6\u614B\u3092\u78BA\u8A8D\u3057\u3001\u672A\u5B9F\u884C\u3068\u78BA\u8A8D\u3067\u304D\u305F\u3068\u304D\u306E\u307F\u65B0\u3057\u3044\u30AD\u30FC\u3067\u518D\u7533\u8ACB\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);
1207
- }
1208
- function pickDefined(obj) {
1209
- const result = {};
1210
- for (const [key, value] of Object.entries(obj)) {
1211
- if (value !== void 0)
1212
- result[key] = value;
1588
+ if (info.expiresAt) {
1589
+ lines.push("", `API\u30AD\u30FC\u6709\u52B9\u671F\u9650: ${info.expiresAt}`);
1213
1590
  }
1214
- return result;
1591
+ return lines;
1215
1592
  }
1216
1593
 
1217
1594
  // ../core/dist/lib/resolve-servername-from-me.js
@@ -1428,6 +1805,113 @@ function registerServerInfoCommands(parent, brand) {
1428
1805
  });
1429
1806
  }
1430
1807
 
1808
+ // ../core/dist/lib/signup-validation.js
1809
+ function parsePlanIds(value) {
1810
+ const plans = value.split(",").map((item) => item.trim()).filter(Boolean);
1811
+ if (plans.length === 0)
1812
+ throw new Error("--plan-id \u306F1\u4EF6\u4EE5\u4E0A\u306E\u30D7\u30E9\u30F3ID\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
1813
+ return plans.join(",");
1814
+ }
1815
+ function parseSignupPeriod(value) {
1816
+ return parseInteger(value, "--period", 1, 60);
1817
+ }
1818
+ function parseWphostingSignupPeriod(value) {
1819
+ return parseSignupPeriod(value);
1820
+ }
1821
+ function parseAutoRenew(value) {
1822
+ return parseStrictBoolean(value, "--auto-renew");
1823
+ }
1824
+ function validatePartnerCode(value) {
1825
+ if (value.length === 0 || value.length > 50 || !/^[A-Za-z0-9]+$/.test(value)) {
1826
+ throw new Error("--partner-code \u306F50\u6587\u5B57\u4EE5\u5185\u306EASCII\u82F1\u6570\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
1827
+ }
1828
+ return value;
1829
+ }
1830
+ function validateSignupServerId(value) {
1831
+ if (!/^[a-z][0-9a-z]+$/.test(value)) {
1832
+ throw new Error("--server-id \u306F\u5C0F\u6587\u5B57\u82F1\u5B57\u3067\u59CB\u307E\u308B2\u6587\u5B57\u4EE5\u4E0A\u306E\u5C0F\u6587\u5B57\u82F1\u6570\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
1833
+ }
1834
+ return value;
1835
+ }
1836
+ function validateSignupMemo(value) {
1837
+ if (value.length > 500)
1838
+ throw new Error("--memo \u306F500\u6587\u5B57\u4EE5\u5185\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
1839
+ return value;
1840
+ }
1841
+
1842
+ // ../core/dist/commands/server/account.js
1843
+ function explicitServername(parent) {
1844
+ const value = parent.opts().servername;
1845
+ if (typeof value !== "string" || value.length === 0) {
1846
+ throw new Error("--servername \u3067\u5BFE\u8C61\u30B5\u30FC\u30D0\u30FC\u540D\u3092\u660E\u793A\u3057\u3066\u304F\u3060\u3055\u3044");
1847
+ }
1848
+ return value;
1849
+ }
1850
+ function registerServerAccountCommands(parent, brand) {
1851
+ parent.command("plans").description("\u7533\u8FBC\u53EF\u80FD\u306A\u30B5\u30FC\u30D0\u30FC\u30D7\u30E9\u30F3\u3092\u53D6\u5F97").option("--plan-id <list>", "\u30D7\u30E9\u30F3ID\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\uFF09").action(async (opts) => {
1852
+ const params = opts.planId === void 0 ? void 0 : { plan_id: parsePlanIds(opts.planId) };
1853
+ printResult(await resolveClient(parent, brand).listServerPlans(params), getFormat(parent));
1854
+ });
1855
+ parent.command("contracts").description("\u30B5\u30FC\u30D0\u30FC\u5951\u7D04").command("list").description("\u30B5\u30FC\u30D0\u30FC\u5951\u7D04\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
1856
+ printResult(await resolveClient(parent, brand).listServers(), getFormat(parent));
1857
+ });
1858
+ parent.command("signup-status").description("\u30B5\u30FC\u30D0\u30FC\u7533\u8FBC\u51E6\u7406\u72B6\u6CC1\u3092\u53D6\u5F97").action(async () => {
1859
+ printResult(await resolveClient(parent, brand).getServerSignupStatus(explicitServername(parent)), getFormat(parent));
1860
+ });
1861
+ const memo = parent.command("memo").description("\u30B5\u30FC\u30D0\u30FC\u5951\u7D04\u30E1\u30E2");
1862
+ memo.command("show").description("\u30E1\u30E2\u3092\u53D6\u5F97").action(async () => {
1863
+ printResult(await resolveClient(parent, brand).getServerMemo(explicitServername(parent)), getFormat(parent));
1864
+ });
1865
+ memo.command("update").description("\u30E1\u30E2\u3092\u66F4\u65B0").requiredOption("--memo <memo>", "\u30E1\u30E2\uFF08\u7A7A\u6587\u5B57\u53EF\u3001500\u6587\u5B57\u4EE5\u5185\uFF09").action(async (opts) => {
1866
+ printResult(await resolveClient(parent, brand).updateServerMemo(explicitServername(parent), {
1867
+ memo: validateSignupMemo(opts.memo)
1868
+ }), getFormat(parent));
1869
+ });
1870
+ parent.command("signup").description("\u30B5\u30FC\u30D0\u30FC\u3092\u65B0\u898F\u5951\u7D04").requiredOption("--plan-id <id>", "\u30D7\u30E9\u30F3ID").requiredOption("--period <months>", "\u5951\u7D04\u671F\u9593\uFF08\u6708\u6570\u3002server plans \u304C\u8FD4\u3057\u305F months \u304B\u3089\u6307\u5B9A\uFF09").requiredOption("--expected-total-price <yen>", "\u4E8B\u524D\u78BA\u8A8D\u3057\u305F\u7A0E\u8FBC\u5408\u8A08\u91D1\u984D\uFF080\u4EE5\u4E0A\u306E\u6574\u6570\uFF09").option("--server-id <id>", "\u5E0C\u671B\u30B5\u30FC\u30D0\u30FCID").option("--partner-code <code>", "\u30D1\u30FC\u30C8\u30CA\u30FC\u30B3\u30FC\u30C9\uFF08ASCII\u82F1\u6570\u5B57\u300150\u6587\u5B57\u4EE5\u5185\uFF09").option("--auto-renew <bool>", "\u81EA\u52D5\u66F4\u65B0\uFF08true / false\uFF09").option("--dry-run", "\u30D7\u30EC\u30D3\u30E5\u30FC\u306E\u307F\u5B9F\u884C").option("--confirm-purchase", "\u8AB2\u91D1\u3092\u4F34\u3046\u7533\u8ACB\u3092\u660E\u793A\u7684\u306B\u78BA\u8A8D").option("--agree-to-terms", "\u5229\u7528\u898F\u7D04\u306B\u540C\u610F").option("--idempotency-key <key>", "\u5B9F\u7533\u8ACB\u306E\u51AA\u7B49\u6027\u30AD\u30FC\uFF08\u82F1\u6570\u5B57\u30FB_\u30FB-\u306E8\uFF5E64\u6587\u5B57\uFF09").action(async (opts) => {
1871
+ const expectedTotalPrice = parseInteger(opts.expectedTotalPrice, "--expected-total-price", 0);
1872
+ const period = parseSignupPeriod(opts.period);
1873
+ const serverId = opts.serverId === void 0 ? void 0 : validateSignupServerId(opts.serverId);
1874
+ const partnerCode = opts.partnerCode === void 0 ? void 0 : validatePartnerCode(opts.partnerCode);
1875
+ const autoRenew = opts.autoRenew === void 0 ? void 0 : parseAutoRenew(opts.autoRenew);
1876
+ const baseData = {
1877
+ plan_id: opts.planId,
1878
+ period,
1879
+ expected_total_price: expectedTotalPrice,
1880
+ agree_to_terms: true,
1881
+ ...pickDefined({
1882
+ server_id: serverId,
1883
+ partner_code: partnerCode,
1884
+ auto_renew: autoRenew
1885
+ })
1886
+ };
1887
+ const client2 = resolveClient(parent, brand);
1888
+ await runBillingPurchase({
1889
+ format: getFormat(parent),
1890
+ options: opts,
1891
+ operation: signupOperationName(brand, "server", opts.planId),
1892
+ targetLabel: "\u7533\u8FBC\u5185\u5BB9",
1893
+ resolveTarget: async () => {
1894
+ const planName = await resolvePlanName(() => client2.listServerPlans({ plan_id: opts.planId }), opts.planId);
1895
+ return {
1896
+ target: `${planLabel(opts.planId, planName)} / \u5951\u7D04\u671F\u9593 ${period}\u304B\u6708`,
1897
+ confirmSubject: `${planName ?? opts.planId} ${period}\u304B\u6708`
1898
+ };
1899
+ },
1900
+ details: compactDetails([
1901
+ serverIdDetail(serverId),
1902
+ autoRenewDetail(autoRenew ?? true, {
1903
+ fromDefault: autoRenew === void 0
1904
+ }),
1905
+ partnerCodeDetail(partnerCode)
1906
+ ]),
1907
+ legalNoticeLines: signupLegalNoticeLines(brand, "server", opts.planId),
1908
+ statusCommand: `${brand.commandName} server contracts list`,
1909
+ preview: () => client2.registerServer({ ...baseData, dry_run: true }),
1910
+ execute: (idempotencyKey) => client2.registerServer({ ...baseData, dry_run: false }, idempotencyKey)
1911
+ });
1912
+ });
1913
+ }
1914
+
1431
1915
  // ../core/dist/commands/server/cron/index.js
1432
1916
  function registerCronCommands(parent, brand) {
1433
1917
  const cron = parent.command("cron").description("Cron\u8A2D\u5B9A");
@@ -2637,137 +3121,7 @@ function registerMeCommand(program, brand) {
2637
3121
  }
2638
3122
 
2639
3123
  // ../core/dist/commands/domain/index.js
2640
- import { randomUUID } from "crypto";
2641
-
2642
- // ../core/dist/lib/domain-validation.js
2643
- var DNS_TYPES = /* @__PURE__ */ new Set(["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SRV"]);
2644
- var IDEMPOTENCY_KEY_PATTERN = /^[A-Za-z0-9_-]{8,64}$/;
2645
- function isObject(value) {
2646
- return typeof value === "object" && value !== null && !Array.isArray(value);
2647
- }
2648
- function parseInteger(value, optionName, minimum, maximum) {
2649
- if (!/^\d+$/.test(value)) {
2650
- throw new Error(`${optionName} \u306F\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
2651
- }
2652
- const parsed = Number(value);
2653
- if (!Number.isSafeInteger(parsed) || parsed < minimum || maximum !== void 0 && parsed > maximum) {
2654
- const range = maximum === void 0 ? `${minimum}\u4EE5\u4E0A` : `${minimum}\uFF5E${maximum}`;
2655
- throw new Error(`${optionName} \u306F${range}\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
2656
- }
2657
- return parsed;
2658
- }
2659
- function parseStrictBoolean(value, optionName) {
2660
- if (value === "true")
2661
- return true;
2662
- if (value === "false")
2663
- return false;
2664
- throw new Error(`${optionName} \u306F true \u307E\u305F\u306F false \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
2665
- }
2666
- function parseNameservers(value) {
2667
- const nameservers = value.split(",").map((item) => item.trim()).filter(Boolean);
2668
- if (nameservers.length < 1 || nameservers.length > 13) {
2669
- throw new Error("--nameservers \u306F1\uFF5E13\u4EF6\u3092\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2670
- }
2671
- validateNameserverHostnames(nameservers, 253);
2672
- if (new Set(nameservers.map((item) => item.toLowerCase())).size !== nameservers.length) {
2673
- throw new Error("\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\u3092\u91CD\u8907\u3057\u3066\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093");
2674
- }
2675
- return nameservers;
2676
- }
2677
- function parseRegistrationNameservers(value) {
2678
- const nameservers = value.split(",").map((item) => item.trim()).filter(Boolean);
2679
- if (nameservers.length < 1 || nameservers.length > 6) {
2680
- throw new Error("--nameservers \u306F1\uFF5E6\u4EF6\u3092\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2681
- }
2682
- validateNameserverHostnames(nameservers, 255);
2683
- if (new Set(nameservers.map((item) => item.toLowerCase())).size !== nameservers.length) {
2684
- throw new Error("\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\u3092\u91CD\u8907\u3057\u3066\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093");
2685
- }
2686
- return nameservers;
2687
- }
2688
- function validateNameserverHostnames(nameservers, maximumLength) {
2689
- const hostnamePattern = /^[A-Za-z0-9]([A-Za-z0-9.-]*[A-Za-z0-9])?$/;
2690
- for (const nameserver of nameservers) {
2691
- if (nameserver.length > maximumLength || !hostnamePattern.test(nameserver)) {
2692
- throw new Error(`\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\u306F\u5404${maximumLength}\u6587\u5B57\u4EE5\u5185\u306E\u30DB\u30B9\u30C8\u540D\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
2693
- }
2694
- }
2695
- }
2696
- function parseWhoisData(value) {
2697
- let parsed;
2698
- try {
2699
- parsed = JSON.parse(value);
2700
- } catch {
2701
- throw new Error("--data \u306F\u6709\u52B9\u306AJSON\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2702
- }
2703
- if (!isObject(parsed)) {
2704
- throw new Error("--data \u306FJSON\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2705
- }
2706
- if (Object.prototype.hasOwnProperty.call(parsed, "whois_privacy_flag")) {
2707
- throw new Error("whois_privacy_flag \u306F\u5EC3\u6B62\u3055\u308C\u3066\u3044\u307E\u3059\u3002whois_privacy \u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044");
2708
- }
2709
- const hasPrivacy = Object.prototype.hasOwnProperty.call(parsed, "whois_privacy");
2710
- const hasFields = Object.prototype.hasOwnProperty.call(parsed, "fields");
2711
- if (!hasPrivacy && !hasFields) {
2712
- throw new Error("--data \u306B\u306F whois_privacy \u307E\u305F\u306F fields \u306E\u3044\u305A\u308C\u304B\u304C\u5FC5\u8981\u3067\u3059");
2713
- }
2714
- if (hasPrivacy && typeof parsed.whois_privacy !== "boolean") {
2715
- throw new Error("whois_privacy \u306Fboolean\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2716
- }
2717
- if (hasFields && !isObject(parsed.fields)) {
2718
- throw new Error("fields \u306FJSON\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2719
- }
2720
- return parsed;
2721
- }
2722
- function validateDnsType(value) {
2723
- const type = value.toUpperCase();
2724
- if (!DNS_TYPES.has(type)) {
2725
- throw new Error("--type \u306F A / AAAA / CNAME / MX / TXT / NS / SRV \u306E\u3044\u305A\u308C\u304B\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2726
- }
2727
- return type;
2728
- }
2729
- function validateDnsHost(value) {
2730
- if (value.length === 0 || value.length > 64) {
2731
- throw new Error("--host \u306F1\uFF5E64\u6587\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2732
- }
2733
- return value;
2734
- }
2735
- function validateDnsContent(value) {
2736
- if (value.length === 0 || value.length > 1024) {
2737
- throw new Error("--content \u306F1\uFF5E1024\u6587\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2738
- }
2739
- return value;
2740
- }
2741
- function validateDnsId(value) {
2742
- if (!/^[1-9]\d*$/.test(value)) {
2743
- throw new Error("dns_id \u306F\u6B63\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2744
- }
2745
- return value;
2746
- }
2747
- function validateIdempotencyKey(value) {
2748
- if (!IDEMPOTENCY_KEY_PATTERN.test(value)) {
2749
- throw new Error("--idempotency-key \u306F\u82F1\u6570\u5B57\u30FB_\u30FB-\u306E8\uFF5E64\u6587\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2750
- }
2751
- return value;
2752
- }
2753
- function validateDate(value, optionName) {
2754
- if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
2755
- throw new Error(`${optionName} \u306FYYYY-MM-DD\u5F62\u5F0F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
2756
- }
2757
- const [year, month, day] = value.split("-").map(Number);
2758
- const date = new Date(Date.UTC(year, month - 1, day));
2759
- if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day) {
2760
- throw new Error(`${optionName} \u306B\u5B58\u5728\u3059\u308B\u65E5\u4ED8\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
2761
- }
2762
- return value;
2763
- }
2764
- function requireAtLeastOneField(data, message) {
2765
- if (Object.keys(data).length === 0) {
2766
- throw new Error(message);
2767
- }
2768
- }
2769
-
2770
- // ../core/dist/commands/domain/index.js
3124
+ import { randomUUID as randomUUID2 } from "crypto";
2771
3125
  function dnsData(opts) {
2772
3126
  return pickDefined({
2773
3127
  host: opts.host === void 0 ? void 0 : validateDnsHost(opts.host),
@@ -2782,7 +3136,7 @@ function addPurchaseOptions(command) {
2782
3136
  }
2783
3137
  function purchaseValues(opts) {
2784
3138
  const expectedTotalPrice = parseInteger(opts.expectedTotalPrice, "--expected-total-price", 0);
2785
- const idempotencyKey = validateIdempotencyKey(opts.idempotencyKey ?? randomUUID());
3139
+ const idempotencyKey = validateIdempotencyKey(opts.idempotencyKey ?? randomUUID2());
2786
3140
  return { expectedTotalPrice, idempotencyKey };
2787
3141
  }
2788
3142
  function requirePurchaseConfirmation(opts) {
@@ -2795,16 +3149,7 @@ function requireTermsAgreement(opts) {
2795
3149
  throw new Error("\u65B0\u898F\u53D6\u5F97\u30FB\u79FB\u7BA1\u306B\u306F --agree-to-terms \u306B\u3088\u308B\u300C\u30B5\u30FC\u30D3\u30B9\u5229\u7528\u898F\u7D04\u300D\u304A\u3088\u3073\u300C\u500B\u4EBA\u60C5\u5831\u306E\u53D6\u308A\u6271\u3044\u306B\u3064\u3044\u3066\u300D\u3078\u306E\u660E\u793A\u540C\u610F\u304C\u5FC5\u8981\u3067\u3059");
2796
3150
  }
2797
3151
  }
2798
- function printPurchaseWarning(operation, domain, totalPrice, brand) {
2799
- console.error([
2800
- `\u8AB2\u91D1\u64CD\u4F5C: ${operation}`,
2801
- `\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3: ${domain}`,
2802
- `\u7A0E\u8FBC\u5408\u8A08\u91D1\u984D: ${totalPrice}\u5186`,
2803
- ...domainLegalNoticeLines(brand),
2804
- "\u5B9F\u7533\u8ACB\u5F8C\u306F\u539F\u5247\u53D6\u308A\u6D88\u305B\u307E\u305B\u3093\u3002"
2805
- ].join("\n"));
2806
- }
2807
- function totalPriceFromPreview(preview, expectedTotalPrice) {
3152
+ function totalPriceFromPreview2(preview, expectedTotalPrice) {
2808
3153
  const totalPrice = Number(preview?.total_price);
2809
3154
  if (!Number.isFinite(totalPrice)) {
2810
3155
  throw new Error("dry-run\u7D50\u679C\u304B\u3089\u5408\u8A08\u91D1\u984D\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002");
@@ -2905,18 +3250,23 @@ function registerDomainCommands(parent, brand) {
2905
3250
  printResult(preview, getFormat(parent));
2906
3251
  return;
2907
3252
  }
2908
- printPreview(preview, getFormat(parent));
2909
- const totalPrice = totalPriceFromPreview(preview, expectedTotalPrice);
2910
- printPurchaseWarning("\u30C9\u30E1\u30A4\u30F3\u65B0\u898F\u53D6\u5F97", domain, totalPrice, brand);
3253
+ const totalPrice = totalPriceFromPreview2(preview, expectedTotalPrice);
2911
3254
  requirePurchaseConfirmation(opts);
2912
3255
  await confirmBillingPurchase({
2913
3256
  operation: "\u30C9\u30E1\u30A4\u30F3\u65B0\u898F\u53D6\u5F97",
2914
- domain,
3257
+ target: domain,
3258
+ targetLabel: "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3",
2915
3259
  totalPrice,
2916
- brand
3260
+ legalNoticeLines: domainLegalNoticeLines(brand),
3261
+ confirmSubject: domain
2917
3262
  });
2918
- printIdempotencyKeyNotice(idempotencyKey, domain);
2919
- printResult(await withDomainAcquisitionPermissionDiagnosis(client2, () => client2.registerDomain({ ...baseData, dry_run: false }, idempotencyKey)), getFormat(parent));
3263
+ const result = await executeBillingPurchase({
3264
+ idempotencyKey,
3265
+ operation: "\u30C9\u30E1\u30A4\u30F3\u65B0\u898F\u53D6\u5F97",
3266
+ subject: domain,
3267
+ execute: () => withDomainAcquisitionPermissionDiagnosis(client2, () => client2.registerDomain({ ...baseData, dry_run: false }, idempotencyKey))
3268
+ });
3269
+ printResult(result, getFormat(parent));
2920
3270
  });
2921
3271
  addPurchaseOptions(parent.command("transfer <domain>").description("\u30C9\u30E1\u30A4\u30F3\u79FB\u7BA1\u3092\u7533\u8ACB").option("--agree-to-terms", "\u30C9\u30E1\u30A4\u30F3\u79FB\u7BA1\u306E\u300C\u30B5\u30FC\u30D3\u30B9\u5229\u7528\u898F\u7D04\u300D\u304A\u3088\u3073\u300C\u500B\u4EBA\u60C5\u5831\u306E\u53D6\u308A\u6271\u3044\u306B\u3064\u3044\u3066\u300D\u306B\u540C\u610F").requiredOption("--auth-code <code>", "\u79FB\u7BA1\u5143\u3067\u53D6\u5F97\u3057\u305FAuthCode")).action(async (domain, opts) => {
2922
3272
  requireTermsAgreement(opts);
@@ -2932,18 +3282,23 @@ function registerDomainCommands(parent, brand) {
2932
3282
  printResult(preview, getFormat(parent));
2933
3283
  return;
2934
3284
  }
2935
- printPreview(preview, getFormat(parent));
2936
- const totalPrice = totalPriceFromPreview(preview, expectedTotalPrice);
2937
- printPurchaseWarning("\u30C9\u30E1\u30A4\u30F3\u79FB\u7BA1", domain, totalPrice, brand);
3285
+ const totalPrice = totalPriceFromPreview2(preview, expectedTotalPrice);
2938
3286
  requirePurchaseConfirmation(opts);
2939
3287
  await confirmBillingPurchase({
2940
3288
  operation: "\u30C9\u30E1\u30A4\u30F3\u79FB\u7BA1",
2941
- domain,
3289
+ target: domain,
3290
+ targetLabel: "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3",
2942
3291
  totalPrice,
2943
- brand
3292
+ legalNoticeLines: domainLegalNoticeLines(brand),
3293
+ confirmSubject: domain
3294
+ });
3295
+ const result = await executeBillingPurchase({
3296
+ idempotencyKey,
3297
+ operation: "\u30C9\u30E1\u30A4\u30F3\u79FB\u7BA1",
3298
+ subject: domain,
3299
+ execute: () => withDomainAcquisitionPermissionDiagnosis(client2, () => client2.transferDomain(domain, { ...baseData, dry_run: false }, idempotencyKey))
2944
3300
  });
2945
- printIdempotencyKeyNotice(idempotencyKey, domain);
2946
- printResult(await withDomainAcquisitionPermissionDiagnosis(client2, () => client2.transferDomain(domain, { ...baseData, dry_run: false }, idempotencyKey)), getFormat(parent));
3301
+ printResult(result, getFormat(parent));
2947
3302
  });
2948
3303
  addPurchaseOptions(parent.command("renew <domain>").description("\u30C9\u30E1\u30A4\u30F3\u5951\u7D04\u3092\u66F4\u65B0").requiredOption("--years <n>", "\u66F4\u65B0\u5E74\u6570\uFF081\uFF5E5\uFF09").requiredOption("--current-expiry-date <date>", "\u73FE\u5728\u306E\u6709\u52B9\u671F\u9650\uFF08YYYY-MM-DD\uFF09")).action(async (domain, opts) => {
2949
3304
  const { expectedTotalPrice, idempotencyKey } = purchaseValues(opts);
@@ -2958,23 +3313,28 @@ function registerDomainCommands(parent, brand) {
2958
3313
  printResult(preview, getFormat(parent));
2959
3314
  return;
2960
3315
  }
2961
- printPreview(preview, getFormat(parent));
2962
- const totalPrice = totalPriceFromPreview(preview, expectedTotalPrice);
2963
- printPurchaseWarning("\u30C9\u30E1\u30A4\u30F3\u5951\u7D04\u66F4\u65B0", domain, totalPrice, brand);
3316
+ const totalPrice = totalPriceFromPreview2(preview, expectedTotalPrice);
2964
3317
  requirePurchaseConfirmation(opts);
2965
3318
  await confirmBillingPurchase({
2966
3319
  operation: "\u30C9\u30E1\u30A4\u30F3\u5951\u7D04\u66F4\u65B0",
2967
- domain,
3320
+ target: domain,
3321
+ targetLabel: "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3",
2968
3322
  totalPrice,
2969
- brand
3323
+ legalNoticeLines: domainLegalNoticeLines(brand),
3324
+ confirmSubject: domain
3325
+ });
3326
+ const result = await executeBillingPurchase({
3327
+ idempotencyKey,
3328
+ operation: "\u30C9\u30E1\u30A4\u30F3\u5951\u7D04\u66F4\u65B0",
3329
+ subject: domain,
3330
+ execute: () => withDomainAcquisitionPermissionDiagnosis(client2, () => client2.renewDomain(domain, { ...baseData, dry_run: false }, idempotencyKey))
2970
3331
  });
2971
- printIdempotencyKeyNotice(idempotencyKey, domain);
2972
- printResult(await withDomainAcquisitionPermissionDiagnosis(client2, () => client2.renewDomain(domain, { ...baseData, dry_run: false }, idempotencyKey)), getFormat(parent));
3332
+ printResult(result, getFormat(parent));
2973
3333
  });
2974
3334
  }
2975
3335
 
2976
3336
  // ../core/dist/commands/wphosting/index.js
2977
- import { randomUUID as randomUUID2 } from "crypto";
3337
+ import { randomUUID as randomUUID3 } from "crypto";
2978
3338
 
2979
3339
  // ../core/dist/lib/wphosting-validation.js
2980
3340
  var DNS_TYPES2 = /* @__PURE__ */ new Set(["A", "AAAA", "CNAME", "MX", "TXT", "SRV"]);
@@ -3116,7 +3476,7 @@ function siteCategory(parent, name, description) {
3116
3476
  return category;
3117
3477
  }
3118
3478
  function asyncKey(opts) {
3119
- const key = validateWphostingIdempotencyKey(String(opts.idempotencyKey ?? randomUUID2()));
3479
+ const key = validateWphostingIdempotencyKey(String(opts.idempotencyKey ?? randomUUID3()));
3120
3480
  console.error(`Idempotency-Key: ${key}\uFF08\u518D\u5B9F\u884C\u6642\u306F\u540C\u3058\u30AD\u30FC\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF09`);
3121
3481
  return key;
3122
3482
  }
@@ -3540,8 +3900,73 @@ function registerWphostingUsers(parent, brand) {
3540
3900
  });
3541
3901
  }
3542
3902
 
3903
+ // ../core/dist/commands/wphosting/account.js
3904
+ function explicitContractId(parent) {
3905
+ return validateWphostingContractId(String(parent.opts().contractId));
3906
+ }
3907
+ function registerWphostingAccountCommands(parent, brand) {
3908
+ parent.command("plans").description("\u7533\u8FBC\u53EF\u80FD\u306AWPhosting\u30D7\u30E9\u30F3\u3092\u53D6\u5F97").option("--plan-id <list>", "\u30D7\u30E9\u30F3ID\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\uFF09").action(async (opts) => {
3909
+ const params = opts.planId === void 0 ? void 0 : { plan_id: parsePlanIds(opts.planId) };
3910
+ printResult(await resolveClient(parent, brand).listWphostingPlans(params), getFormat(parent));
3911
+ });
3912
+ parent.command("contracts").description("WPhosting\u5951\u7D04").command("list").description("WPhosting\u5951\u7D04\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
3913
+ printResult(await resolveClient(parent, brand).listWphostingContracts(), getFormat(parent));
3914
+ });
3915
+ const memo = parent.command("memo").description("WPhosting\u5951\u7D04\u30E1\u30E2");
3916
+ memo.command("show").description("\u30E1\u30E2\u3092\u53D6\u5F97").action(async () => {
3917
+ const contractId2 = explicitContractId(parent);
3918
+ printResult(await resolveClient(parent, brand).getWphostingMemo(contractId2), getFormat(parent));
3919
+ });
3920
+ memo.command("update").description("\u30E1\u30E2\u3092\u66F4\u65B0").requiredOption("--memo <memo>", "\u30E1\u30E2\uFF08\u7A7A\u6587\u5B57\u53EF\u3001500\u6587\u5B57\u4EE5\u5185\uFF09").action(async (opts) => {
3921
+ const contractId2 = explicitContractId(parent);
3922
+ printResult(await resolveClient(parent, brand).updateWphostingMemo(contractId2, {
3923
+ memo: validateSignupMemo(opts.memo)
3924
+ }), getFormat(parent));
3925
+ });
3926
+ parent.command("signup").description("WPhosting\u3092\u65B0\u898F\u5951\u7D04").requiredOption("--plan-id <id>", "\u30D7\u30E9\u30F3ID").requiredOption("--period <months>", "\u5951\u7D04\u671F\u9593\uFF08\u6708\u6570\u3002wphosting plans \u304C\u8FD4\u3057\u305F months \u304B\u3089\u6307\u5B9A\uFF09").requiredOption("--expected-total-price <yen>", "\u4E8B\u524D\u78BA\u8A8D\u3057\u305F\u7A0E\u8FBC\u5408\u8A08\u91D1\u984D\uFF080\u4EE5\u4E0A\u306E\u6574\u6570\uFF09").option("--partner-code <code>", "\u30D1\u30FC\u30C8\u30CA\u30FC\u30B3\u30FC\u30C9\uFF08ASCII\u82F1\u6570\u5B57\u300150\u6587\u5B57\u4EE5\u5185\uFF09").option("--auto-renew <bool>", "\u81EA\u52D5\u66F4\u65B0\uFF08true / false\uFF09").option("--dry-run", "\u30D7\u30EC\u30D3\u30E5\u30FC\u306E\u307F\u5B9F\u884C").option("--confirm-purchase", "\u8AB2\u91D1\u3092\u4F34\u3046\u7533\u8ACB\u3092\u660E\u793A\u7684\u306B\u78BA\u8A8D").option("--agree-to-terms", "\u5229\u7528\u898F\u7D04\u306B\u540C\u610F").option("--idempotency-key <key>", "\u5B9F\u7533\u8ACB\u306E\u51AA\u7B49\u6027\u30AD\u30FC\uFF08\u82F1\u6570\u5B57\u30FB_\u30FB-\u306E8\uFF5E64\u6587\u5B57\uFF09").action(async (opts) => {
3927
+ const expectedTotalPrice = parseInteger(opts.expectedTotalPrice, "--expected-total-price", 0);
3928
+ const period = parseWphostingSignupPeriod(opts.period);
3929
+ const partnerCode = opts.partnerCode === void 0 ? void 0 : validatePartnerCode(opts.partnerCode);
3930
+ const autoRenew = opts.autoRenew === void 0 ? void 0 : parseAutoRenew(opts.autoRenew);
3931
+ const baseData = {
3932
+ plan_id: opts.planId,
3933
+ period,
3934
+ expected_total_price: expectedTotalPrice,
3935
+ agree_to_terms: true,
3936
+ ...pickDefined({
3937
+ partner_code: partnerCode,
3938
+ auto_renew: autoRenew
3939
+ })
3940
+ };
3941
+ const client2 = resolveClient(parent, brand);
3942
+ await runBillingPurchase({
3943
+ format: getFormat(parent),
3944
+ options: opts,
3945
+ operation: signupOperationName(brand, "wphosting"),
3946
+ targetLabel: "\u7533\u8FBC\u5185\u5BB9",
3947
+ resolveTarget: async () => {
3948
+ const planName = await resolvePlanName(() => client2.listWphostingPlans({ plan_id: opts.planId }), opts.planId);
3949
+ return {
3950
+ target: `${planLabel(opts.planId, planName)} / \u5951\u7D04\u671F\u9593 ${period}\u304B\u6708`,
3951
+ confirmSubject: `${planName ?? opts.planId} ${period}\u304B\u6708`
3952
+ };
3953
+ },
3954
+ details: compactDetails([
3955
+ autoRenewDetail(autoRenew ?? true, {
3956
+ fromDefault: autoRenew === void 0
3957
+ }),
3958
+ partnerCodeDetail(partnerCode)
3959
+ ]),
3960
+ legalNoticeLines: signupLegalNoticeLines(brand, "wphosting"),
3961
+ statusCommand: `${brand.commandName} wphosting contracts list`,
3962
+ preview: () => client2.registerWphosting({ ...baseData, dry_run: true }),
3963
+ execute: (idempotencyKey) => client2.registerWphosting({ ...baseData, dry_run: false }, idempotencyKey)
3964
+ });
3965
+ });
3966
+ }
3967
+
3543
3968
  // ../core/dist/index.js
3544
- function run(brand, version = "0.0.0") {
3969
+ function createProgram(brand, version = "0.0.0") {
3545
3970
  const program = new Command();
3546
3971
  program.name(brand.commandName).description(`${brand.displayName} CLI`).version(version).option("--format <format>", "\u51FA\u529B\u5F62\u5F0F (json, table)", (value) => {
3547
3972
  if (!["json", "table"].includes(value)) {
@@ -3552,12 +3977,14 @@ function run(brand, version = "0.0.0") {
3552
3977
  registerAuthCommands(program, brand);
3553
3978
  registerMeCommand(program, brand);
3554
3979
  if (isWphostingSupportedBrand(brand)) {
3555
- const wphosting = program.command("wphosting").description("XServer for WordPress API").requiredOption("--contract-id <id>", "WPhosting\u5951\u7D04ID\uFF08\u4F8B: WP-AB234567\uFF09");
3980
+ const wphosting = program.command("wphosting").description("XServer for WordPress API").option("--contract-id <id>", "WPhosting\u5951\u7D04ID\uFF08\u4F8B: WP-AB234567\uFF09");
3981
+ registerWphostingAccountCommands(wphosting, brand);
3556
3982
  registerWphostingCommands(wphosting, brand);
3557
3983
  }
3558
3984
  const domain = program.command("domain").description("\u30C9\u30E1\u30A4\u30F3\u30B5\u30FC\u30D3\u30B9API\uFF08\u53D6\u5F97\u30FB\u5951\u7D04\u30FBDNS\u30FBWhois\u306A\u3069\uFF09");
3559
3985
  registerDomainCommands(domain, brand);
3560
3986
  const server = program.command("server").description("\u30B5\u30FC\u30D0\u30FC\u7BA1\u7406API\uFF08WordPress\u30FB\u30E1\u30FC\u30EB\u30FBDB\u306A\u3069\uFF09").option("--servername <name>", "\u30B5\u30FC\u30D0\u30FC\u540D\uFF08\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u3092\u4E0A\u66F8\u304D\uFF09");
3987
+ registerServerAccountCommands(server, brand);
3561
3988
  registerServerInfoCommands(server, brand);
3562
3989
  registerCronCommands(server, brand);
3563
3990
  registerSshCommands(server, brand);
@@ -3590,7 +4017,17 @@ function run(brand, version = "0.0.0") {
3590
4017
  registerXPageSpeedCommands(server, brand);
3591
4018
  registerAutoBackupCommands(server, brand);
3592
4019
  registerMysqlBackupCommands(server, brand);
4020
+ return program;
4021
+ }
4022
+ function run(brand, version = "0.0.0") {
4023
+ const program = createProgram(brand, version);
3593
4024
  program.parseAsync(process.argv).catch((err) => {
4025
+ const resendGuidance = billingResendGuidance(err);
4026
+ const printResendGuidance = () => {
4027
+ for (const line of resendGuidance ?? []) {
4028
+ console.error(line);
4029
+ }
4030
+ };
3594
4031
  if (err instanceof ApiError) {
3595
4032
  console.error(`\u30A8\u30E9\u30FC [${err.errorCode}]: ${err.message}`);
3596
4033
  if (err.errors.length > 0) {
@@ -3598,15 +4035,23 @@ function run(brand, version = "0.0.0") {
3598
4035
  console.error(` - ${e}`);
3599
4036
  }
3600
4037
  }
4038
+ printResendGuidance();
4039
+ process.exitCode = 1;
4040
+ return;
4041
+ }
4042
+ if (err instanceof BillingCancelledError) {
4043
+ console.error(err.message);
3601
4044
  process.exitCode = 1;
3602
4045
  return;
3603
4046
  }
3604
4047
  if (err instanceof Error) {
3605
4048
  console.error(`\u30A8\u30E9\u30FC: ${err.message}`);
4049
+ printResendGuidance();
3606
4050
  process.exitCode = 1;
3607
4051
  return;
3608
4052
  }
3609
4053
  console.error("\u4E88\u671F\u3057\u306A\u3044\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F");
4054
+ printResendGuidance();
3610
4055
  process.exitCode = 1;
3611
4056
  });
3612
4057
  }
@@ -3614,7 +4059,7 @@ function run(brand, version = "0.0.0") {
3614
4059
  // package.json
3615
4060
  var package_default = {
3616
4061
  name: "shincloud-cli",
3617
- version: "1.3.0",
4062
+ version: "1.4.0",
3618
4063
  description: "Official CLI for Shincloud API \u2014 manage your Shincloud hosting from the terminal",
3619
4064
  type: "module",
3620
4065
  bin: {
@@ -3661,8 +4106,11 @@ run({
3661
4106
  brand: "shincloud",
3662
4107
  apiBase: "https://api.shin-server.jp",
3663
4108
  displayName: "\u30B7\u30F3\u30AF\u30E9\u30A6\u30C9 API",
4109
+ serverServiceName: "\u30B7\u30F3\u30EC\u30F3\u30BF\u30EB\u30B5\u30FC\u30D0\u30FC",
3664
4110
  domainTermsUrl: "https://www.shin-domain.jp/rule/rule.php",
3665
4111
  domainPrivacyUrl: "https://www.shin-domain.jp/privacy_announcement.php",
4112
+ serverTermsUrl: "https://www.shin-server.jp/rule.php",
4113
+ serverPrivacyUrl: "https://www.shin-server.jp/privacy_announcement.php",
3666
4114
  commandName: "shincloud",
3667
4115
  configDir: "shincloud-cli"
3668
4116
  }, package_default.version);