@oyster-lib/cli 2.0.2 → 2.1.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.
Files changed (2) hide show
  1. package/dist/index.js +1951 -1878
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -23796,570 +23796,837 @@ axios.HttpStatusCode = HttpStatusCode_default;
23796
23796
  axios.default = axios;
23797
23797
  var axios_default = axios;
23798
23798
 
23799
- // src/config.ts
23800
- import fs from "fs";
23801
- import path from "path";
23802
- import os2 from "os";
23803
- function getConfigDir() {
23804
- const xdgConfig = process.env.XDG_CONFIG_HOME ?? path.join(os2.homedir(), ".config");
23805
- return path.join(xdgConfig, "oyster");
23806
- }
23807
- var CONFIG_DIR = getConfigDir();
23808
- var CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
23809
- function loadConfig() {
23810
- try {
23811
- if (!fs.existsSync(CONFIG_FILE)) {
23812
- return {};
23813
- }
23814
- const content = fs.readFileSync(CONFIG_FILE, "utf-8");
23815
- return JSON.parse(content);
23816
- } catch {
23817
- return {};
23818
- }
23819
- }
23820
- function saveConfig(config) {
23821
- if (!fs.existsSync(CONFIG_DIR)) {
23822
- fs.mkdirSync(CONFIG_DIR, { recursive: true, mode: 448 });
23823
- }
23824
- fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2), { mode: 384 });
23825
- }
23826
- function getApiKey() {
23827
- if (process.env.OYSTER_API_KEY) {
23828
- return process.env.OYSTER_API_KEY;
23829
- }
23830
- const config = loadConfig();
23831
- return config.api_key ?? null;
23832
- }
23833
- function getServerUrl() {
23834
- if (process.env.OYSTER_SERVER_URL) {
23835
- return process.env.OYSTER_SERVER_URL;
23799
+ // ../../node_modules/ora/index.js
23800
+ import process11 from "node:process";
23801
+
23802
+ // ../../node_modules/ora/node_modules/chalk/source/vendor/ansi-styles/index.js
23803
+ var ANSI_BACKGROUND_OFFSET2 = 10;
23804
+ var wrapAnsi162 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
23805
+ var wrapAnsi2562 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
23806
+ var wrapAnsi16m2 = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
23807
+ var styles3 = {
23808
+ modifier: {
23809
+ reset: [0, 0],
23810
+ bold: [1, 22],
23811
+ dim: [2, 22],
23812
+ italic: [3, 23],
23813
+ underline: [4, 24],
23814
+ overline: [53, 55],
23815
+ inverse: [7, 27],
23816
+ hidden: [8, 28],
23817
+ strikethrough: [9, 29]
23818
+ },
23819
+ color: {
23820
+ black: [30, 39],
23821
+ red: [31, 39],
23822
+ green: [32, 39],
23823
+ yellow: [33, 39],
23824
+ blue: [34, 39],
23825
+ magenta: [35, 39],
23826
+ cyan: [36, 39],
23827
+ white: [37, 39],
23828
+ blackBright: [90, 39],
23829
+ gray: [90, 39],
23830
+ grey: [90, 39],
23831
+ redBright: [91, 39],
23832
+ greenBright: [92, 39],
23833
+ yellowBright: [93, 39],
23834
+ blueBright: [94, 39],
23835
+ magentaBright: [95, 39],
23836
+ cyanBright: [96, 39],
23837
+ whiteBright: [97, 39]
23838
+ },
23839
+ bgColor: {
23840
+ bgBlack: [40, 49],
23841
+ bgRed: [41, 49],
23842
+ bgGreen: [42, 49],
23843
+ bgYellow: [43, 49],
23844
+ bgBlue: [44, 49],
23845
+ bgMagenta: [45, 49],
23846
+ bgCyan: [46, 49],
23847
+ bgWhite: [47, 49],
23848
+ bgBlackBright: [100, 49],
23849
+ bgGray: [100, 49],
23850
+ bgGrey: [100, 49],
23851
+ bgRedBright: [101, 49],
23852
+ bgGreenBright: [102, 49],
23853
+ bgYellowBright: [103, 49],
23854
+ bgBlueBright: [104, 49],
23855
+ bgMagentaBright: [105, 49],
23856
+ bgCyanBright: [106, 49],
23857
+ bgWhiteBright: [107, 49]
23836
23858
  }
23837
- const config = loadConfig();
23838
- return config.server_url ?? "https://oyster-platform.com";
23839
- }
23840
- function getApiBaseUrl() {
23841
- return `${getServerUrl()}/api/v1/cli`;
23842
- }
23843
- function requireLogin() {
23844
- const apiKey = getApiKey();
23845
- if (!apiKey) {
23846
- throw new Error("ログインしていません。先に `oyster login` を実行してください。");
23859
+ };
23860
+ var modifierNames2 = Object.keys(styles3.modifier);
23861
+ var foregroundColorNames2 = Object.keys(styles3.color);
23862
+ var backgroundColorNames2 = Object.keys(styles3.bgColor);
23863
+ var colorNames2 = [...foregroundColorNames2, ...backgroundColorNames2];
23864
+ function assembleStyles2() {
23865
+ const codes = new Map;
23866
+ for (const [groupName, group] of Object.entries(styles3)) {
23867
+ for (const [styleName, style] of Object.entries(group)) {
23868
+ styles3[styleName] = {
23869
+ open: `\x1B[${style[0]}m`,
23870
+ close: `\x1B[${style[1]}m`
23871
+ };
23872
+ group[styleName] = styles3[styleName];
23873
+ codes.set(style[0], style[1]);
23874
+ }
23875
+ Object.defineProperty(styles3, groupName, {
23876
+ value: group,
23877
+ enumerable: false
23878
+ });
23847
23879
  }
23848
- return apiKey;
23849
- }
23850
-
23851
- // src/commands/login.ts
23852
- function setLogin(program2) {
23853
- program2.command("login").description("Oyster にログインして API キーを取得する").option("-s, --server <url>", "サーバー URL を指定").action(async (options) => {
23854
- try {
23855
- if (options.server) {
23856
- let parsed;
23857
- try {
23858
- parsed = new URL(options.server);
23859
- } catch {
23860
- console.error(source_default.red("✗ 無効なサーバー URL です"));
23861
- process.exit(1);
23880
+ Object.defineProperty(styles3, "codes", {
23881
+ value: codes,
23882
+ enumerable: false
23883
+ });
23884
+ styles3.color.close = "\x1B[39m";
23885
+ styles3.bgColor.close = "\x1B[49m";
23886
+ styles3.color.ansi = wrapAnsi162();
23887
+ styles3.color.ansi256 = wrapAnsi2562();
23888
+ styles3.color.ansi16m = wrapAnsi16m2();
23889
+ styles3.bgColor.ansi = wrapAnsi162(ANSI_BACKGROUND_OFFSET2);
23890
+ styles3.bgColor.ansi256 = wrapAnsi2562(ANSI_BACKGROUND_OFFSET2);
23891
+ styles3.bgColor.ansi16m = wrapAnsi16m2(ANSI_BACKGROUND_OFFSET2);
23892
+ Object.defineProperties(styles3, {
23893
+ rgbToAnsi256: {
23894
+ value(red, green, blue) {
23895
+ if (red === green && green === blue) {
23896
+ if (red < 8) {
23897
+ return 16;
23898
+ }
23899
+ if (red > 248) {
23900
+ return 231;
23901
+ }
23902
+ return Math.round((red - 8) / 247 * 24) + 232;
23862
23903
  }
23863
- if (!["https:", "http:"].includes(parsed.protocol)) {
23864
- console.error(source_default.red("✗ サーバー URL は http または https である必要があります"));
23865
- process.exit(1);
23904
+ return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
23905
+ },
23906
+ enumerable: false
23907
+ },
23908
+ hexToRgb: {
23909
+ value(hex) {
23910
+ const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
23911
+ if (!matches) {
23912
+ return [0, 0, 0];
23866
23913
  }
23867
- const config2 = loadConfig();
23868
- config2.server_url = options.server;
23869
- saveConfig(config2);
23870
- }
23871
- const serverUrl = options.server ?? getServerUrl();
23872
- console.log(source_default.cyan(`サーバー: ${serverUrl}`));
23873
- console.log();
23874
- const { email } = await import_prompts.default({
23875
- type: "text",
23876
- name: "email",
23877
- message: "メールアドレス:"
23878
- });
23879
- if (!email) {
23880
- console.log(source_default.yellow("キャンセルしました"));
23881
- return;
23882
- }
23883
- const { password } = await import_prompts.default({
23884
- type: "password",
23885
- name: "password",
23886
- message: "パスワード:"
23887
- });
23888
- if (!password) {
23889
- console.log(source_default.yellow("キャンセルしました"));
23890
- return;
23891
- }
23892
- const loginUrl = `${serverUrl}/api/v1/cli/login`;
23893
- const response = await axios_default.post(loginUrl, { email, password });
23894
- const { api_key, user } = response.data;
23895
- const config = loadConfig();
23896
- config.api_key = api_key;
23897
- config.server_url = serverUrl;
23898
- config.user = user;
23899
- saveConfig(config);
23900
- console.log();
23901
- console.log(source_default.green("✓ ログインに成功しました"));
23902
- console.log(source_default.gray(` ユーザー: ${user.name} (${user.email})`));
23903
- console.log(source_default.gray(` 設定は ~/.config/oyster/config.json に保存されました`));
23904
- } catch (error) {
23905
- if (axios_default.isAxiosError(error) && error.response) {
23906
- const status = error.response.status;
23907
- const message = error.response.data?.message ?? "Unknown error";
23908
- if (status === 401) {
23909
- console.error(source_default.red("✗ メールアドレスまたはパスワードが正しくありません"));
23914
+ let [colorString] = matches;
23915
+ if (colorString.length === 3) {
23916
+ colorString = [...colorString].map((character) => character + character).join("");
23917
+ }
23918
+ const integer = Number.parseInt(colorString, 16);
23919
+ return [
23920
+ integer >> 16 & 255,
23921
+ integer >> 8 & 255,
23922
+ integer & 255
23923
+ ];
23924
+ },
23925
+ enumerable: false
23926
+ },
23927
+ hexToAnsi256: {
23928
+ value: (hex) => styles3.rgbToAnsi256(...styles3.hexToRgb(hex)),
23929
+ enumerable: false
23930
+ },
23931
+ ansi256ToAnsi: {
23932
+ value(code) {
23933
+ if (code < 8) {
23934
+ return 30 + code;
23935
+ }
23936
+ if (code < 16) {
23937
+ return 90 + (code - 8);
23938
+ }
23939
+ let red;
23940
+ let green;
23941
+ let blue;
23942
+ if (code >= 232) {
23943
+ red = ((code - 232) * 10 + 8) / 255;
23944
+ green = red;
23945
+ blue = red;
23910
23946
  } else {
23911
- console.error(source_default.red(`✗ ログイン失敗: ${message} (HTTP ${status})`));
23947
+ code -= 16;
23948
+ const remainder = code % 36;
23949
+ red = Math.floor(code / 36) / 5;
23950
+ green = Math.floor(remainder / 6) / 5;
23951
+ blue = remainder % 6 / 5;
23912
23952
  }
23913
- } else {
23914
- console.error(source_default.red(`✗ ログイン失敗: ${error.message}`));
23915
- }
23916
- process.exit(1);
23953
+ const value = Math.max(red, green, blue) * 2;
23954
+ if (value === 0) {
23955
+ return 30;
23956
+ }
23957
+ let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
23958
+ if (value === 2) {
23959
+ result += 60;
23960
+ }
23961
+ return result;
23962
+ },
23963
+ enumerable: false
23964
+ },
23965
+ rgbToAnsi: {
23966
+ value: (red, green, blue) => styles3.ansi256ToAnsi(styles3.rgbToAnsi256(red, green, blue)),
23967
+ enumerable: false
23968
+ },
23969
+ hexToAnsi: {
23970
+ value: (hex) => styles3.ansi256ToAnsi(styles3.hexToAnsi256(hex)),
23971
+ enumerable: false
23917
23972
  }
23918
23973
  });
23974
+ return styles3;
23919
23975
  }
23976
+ var ansiStyles2 = assembleStyles2();
23977
+ var ansi_styles_default2 = ansiStyles2;
23920
23978
 
23921
- // src/commands/init.ts
23922
- var import_prompts2 = __toESM(require_prompts3(), 1);
23923
- import { spawnSync } from "child_process";
23924
-
23925
- // src/templates/index.ts
23926
- import fs2 from "fs";
23927
- import path2 from "path";
23928
-
23929
- // src/templates/frontend.ts
23930
- function generateFrontendFiles(domain, appName) {
23931
- if (!domain)
23932
- throw new Error("domain は必須です");
23933
- if (!appName)
23934
- throw new Error("appName は必須です");
23935
- const base = `frontend/${domain}`;
23979
+ // ../../node_modules/ora/node_modules/chalk/source/vendor/supports-color/index.js
23980
+ import process3 from "node:process";
23981
+ import os2 from "node:os";
23982
+ import tty2 from "node:tty";
23983
+ function hasFlag2(flag, argv = globalThis.Deno ? globalThis.Deno.args : process3.argv) {
23984
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
23985
+ const position = argv.indexOf(prefix + flag);
23986
+ const terminatorPosition = argv.indexOf("--");
23987
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
23988
+ }
23989
+ var { env: env2 } = process3;
23990
+ var flagForceColor2;
23991
+ if (hasFlag2("no-color") || hasFlag2("no-colors") || hasFlag2("color=false") || hasFlag2("color=never")) {
23992
+ flagForceColor2 = 0;
23993
+ } else if (hasFlag2("color") || hasFlag2("colors") || hasFlag2("color=true") || hasFlag2("color=always")) {
23994
+ flagForceColor2 = 1;
23995
+ }
23996
+ function envForceColor2() {
23997
+ if ("FORCE_COLOR" in env2) {
23998
+ if (env2.FORCE_COLOR === "true") {
23999
+ return 1;
24000
+ }
24001
+ if (env2.FORCE_COLOR === "false") {
24002
+ return 0;
24003
+ }
24004
+ return env2.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env2.FORCE_COLOR, 10), 3);
24005
+ }
24006
+ }
24007
+ function translateLevel2(level) {
24008
+ if (level === 0) {
24009
+ return false;
24010
+ }
23936
24011
  return {
23937
- [`${base}/src/apps/${appName}/index.ts`]: generateAppEntryPoint(appName),
23938
- [`${base}/src/shared/index.ts`]: generateSharedIndex(),
23939
- [`${base}/src/index.css`]: generateIndexCss(),
23940
- [`${base}/package.json`]: generateFrontendPackageJson(domain),
23941
- [`${base}/tsconfig.json`]: generateFrontendTsconfig(),
23942
- [`${base}/tailwind.config.js`]: generateTailwindConfig()
24012
+ level,
24013
+ hasBasic: true,
24014
+ has256: level >= 2,
24015
+ has16m: level >= 3
23943
24016
  };
23944
24017
  }
23945
- function generateAppEntryPoint(appName) {
23946
- const componentName = appName.charAt(0).toUpperCase() + appName.slice(1);
23947
- return `import React from 'react'
23948
-
23949
- /**
23950
- * ${componentName} - フロントエンドエントリーポイント
23951
- */
23952
- export default function ${componentName}() {
23953
- return (
23954
- <div className="p-4">
23955
- <h1 className="text-2xl font-bold">${componentName}</h1>
23956
- <p>Welcome to ${appName}</p>
23957
- </div>
23958
- )
24018
+ function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
24019
+ const noFlagForceColor = envForceColor2();
24020
+ if (noFlagForceColor !== undefined) {
24021
+ flagForceColor2 = noFlagForceColor;
24022
+ }
24023
+ const forceColor = sniffFlags ? flagForceColor2 : noFlagForceColor;
24024
+ if (forceColor === 0) {
24025
+ return 0;
24026
+ }
24027
+ if (sniffFlags) {
24028
+ if (hasFlag2("color=16m") || hasFlag2("color=full") || hasFlag2("color=truecolor")) {
24029
+ return 3;
24030
+ }
24031
+ if (hasFlag2("color=256")) {
24032
+ return 2;
24033
+ }
24034
+ }
24035
+ if ("TF_BUILD" in env2 && "AGENT_NAME" in env2) {
24036
+ return 1;
24037
+ }
24038
+ if (haveStream && !streamIsTTY && forceColor === undefined) {
24039
+ return 0;
24040
+ }
24041
+ const min = forceColor || 0;
24042
+ if (env2.TERM === "dumb") {
24043
+ return min;
24044
+ }
24045
+ if (process3.platform === "win32") {
24046
+ const osRelease = os2.release().split(".");
24047
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
24048
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
24049
+ }
24050
+ return 1;
24051
+ }
24052
+ if ("CI" in env2) {
24053
+ if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => (key in env2))) {
24054
+ return 3;
24055
+ }
24056
+ if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => (sign in env2)) || env2.CI_NAME === "codeship") {
24057
+ return 1;
24058
+ }
24059
+ return min;
24060
+ }
24061
+ if ("TEAMCITY_VERSION" in env2) {
24062
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env2.TEAMCITY_VERSION) ? 1 : 0;
24063
+ }
24064
+ if (env2.COLORTERM === "truecolor") {
24065
+ return 3;
24066
+ }
24067
+ if (env2.TERM === "xterm-kitty") {
24068
+ return 3;
24069
+ }
24070
+ if (env2.TERM === "xterm-ghostty") {
24071
+ return 3;
24072
+ }
24073
+ if (env2.TERM === "wezterm") {
24074
+ return 3;
24075
+ }
24076
+ if ("TERM_PROGRAM" in env2) {
24077
+ const version = Number.parseInt((env2.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
24078
+ switch (env2.TERM_PROGRAM) {
24079
+ case "iTerm.app": {
24080
+ return version >= 3 ? 3 : 2;
24081
+ }
24082
+ case "Apple_Terminal": {
24083
+ return 2;
24084
+ }
24085
+ }
24086
+ }
24087
+ if (/-256(color)?$/i.test(env2.TERM)) {
24088
+ return 2;
24089
+ }
24090
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env2.TERM)) {
24091
+ return 1;
24092
+ }
24093
+ if ("COLORTERM" in env2) {
24094
+ return 1;
24095
+ }
24096
+ return min;
23959
24097
  }
23960
- `;
24098
+ function createSupportsColor2(stream4, options = {}) {
24099
+ const level = _supportsColor2(stream4, {
24100
+ streamIsTTY: stream4 && stream4.isTTY,
24101
+ ...options
24102
+ });
24103
+ return translateLevel2(level);
23961
24104
  }
23962
- function generateSharedIndex() {
23963
- return `/**
23964
- * 共有モジュール
23965
- * アプリ間で共有するユーティリティや型をここからエクスポートする
23966
- */
24105
+ var supportsColor2 = {
24106
+ stdout: createSupportsColor2({ isTTY: tty2.isatty(1) }),
24107
+ stderr: createSupportsColor2({ isTTY: tty2.isatty(2) })
24108
+ };
24109
+ var supports_color_default2 = supportsColor2;
23967
24110
 
23968
- export {}
23969
- `;
24111
+ // ../../node_modules/ora/node_modules/chalk/source/utilities.js
24112
+ function stringReplaceAll2(string, substring, replacer) {
24113
+ let index = string.indexOf(substring);
24114
+ if (index === -1) {
24115
+ return string;
24116
+ }
24117
+ const substringLength = substring.length;
24118
+ let endIndex = 0;
24119
+ let returnValue = "";
24120
+ do {
24121
+ returnValue += string.slice(endIndex, index) + substring + replacer;
24122
+ endIndex = index + substringLength;
24123
+ index = string.indexOf(substring, endIndex);
24124
+ } while (index !== -1);
24125
+ returnValue += string.slice(endIndex);
24126
+ return returnValue;
24127
+ }
24128
+ function stringEncaseCRLFWithFirstIndex2(string, prefix, postfix, index) {
24129
+ let endIndex = 0;
24130
+ let returnValue = "";
24131
+ do {
24132
+ const gotCR = string[index - 1] === "\r";
24133
+ returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? `\r
24134
+ ` : `
24135
+ `) + postfix;
24136
+ endIndex = index + 1;
24137
+ index = string.indexOf(`
24138
+ `, endIndex);
24139
+ } while (index !== -1);
24140
+ returnValue += string.slice(endIndex);
24141
+ return returnValue;
23970
24142
  }
23971
- function generateIndexCss() {
23972
- return `@import 'tailwindcss';
23973
24143
 
23974
- /* カスタムスタイルをここに追加 */
23975
- `;
24144
+ // ../../node_modules/ora/node_modules/chalk/source/index.js
24145
+ var { stdout: stdoutColor2, stderr: stderrColor2 } = supports_color_default2;
24146
+ var GENERATOR2 = Symbol("GENERATOR");
24147
+ var STYLER2 = Symbol("STYLER");
24148
+ var IS_EMPTY2 = Symbol("IS_EMPTY");
24149
+ var levelMapping2 = [
24150
+ "ansi",
24151
+ "ansi",
24152
+ "ansi256",
24153
+ "ansi16m"
24154
+ ];
24155
+ var styles4 = Object.create(null);
24156
+ var applyOptions2 = (object, options = {}) => {
24157
+ if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
24158
+ throw new Error("The `level` option should be an integer from 0 to 3");
24159
+ }
24160
+ const colorLevel = stdoutColor2 ? stdoutColor2.level : 0;
24161
+ object.level = options.level === undefined ? colorLevel : options.level;
24162
+ };
24163
+ var chalkFactory2 = (options) => {
24164
+ const chalk2 = (...strings) => strings.join(" ");
24165
+ applyOptions2(chalk2, options);
24166
+ Object.setPrototypeOf(chalk2, createChalk2.prototype);
24167
+ return chalk2;
24168
+ };
24169
+ function createChalk2(options) {
24170
+ return chalkFactory2(options);
23976
24171
  }
23977
- function generateFrontendPackageJson(domain) {
23978
- const pkg = {
23979
- name: `@oyster-apps/${domain}`,
23980
- version: "1.0.0",
23981
- private: true,
23982
- dependencies: {
23983
- react: "^19.0.0",
23984
- "react-dom": "^19.0.0",
23985
- "@oyster-lib/core": "*"
23986
- },
23987
- devDependencies: {
23988
- typescript: "^5.8.0",
23989
- "@types/react": "^19.0.0",
23990
- "@types/react-dom": "^19.0.0",
23991
- esbuild: "^0.24.0",
23992
- tailwindcss: "^4.0.0"
24172
+ Object.setPrototypeOf(createChalk2.prototype, Function.prototype);
24173
+ for (const [styleName, style] of Object.entries(ansi_styles_default2)) {
24174
+ styles4[styleName] = {
24175
+ get() {
24176
+ const builder = createBuilder2(this, createStyler2(style.open, style.close, this[STYLER2]), this[IS_EMPTY2]);
24177
+ Object.defineProperty(this, styleName, { value: builder });
24178
+ return builder;
23993
24179
  }
23994
24180
  };
23995
- return JSON.stringify(pkg, null, 2) + `
23996
- `;
23997
24181
  }
23998
- function generateFrontendTsconfig() {
23999
- const tsconfig = {
24000
- compilerOptions: {
24001
- target: "ES2022",
24002
- module: "ESNext",
24003
- moduleResolution: "bundler",
24004
- jsx: "react-jsx",
24005
- esModuleInterop: true,
24006
- strict: true,
24007
- skipLibCheck: true,
24008
- forceConsistentCasingInFileNames: true,
24009
- resolveJsonModule: true,
24010
- declaration: true,
24011
- outDir: "./.build",
24012
- baseUrl: ".",
24013
- paths: {
24014
- "components/*": ["./src/apps/*/index.ts"],
24015
- components: ["./src/apps/*/index.ts"],
24016
- "shared/*": ["./src/shared/index.ts"],
24017
- shared: ["./src/shared/index.ts"]
24018
- }
24019
- },
24020
- include: ["src/**/*"],
24021
- exclude: ["node_modules", ".build"]
24182
+ styles4.visible = {
24183
+ get() {
24184
+ const builder = createBuilder2(this, this[STYLER2], true);
24185
+ Object.defineProperty(this, "visible", { value: builder });
24186
+ return builder;
24187
+ }
24188
+ };
24189
+ var getModelAnsi2 = (model, level, type, ...arguments_) => {
24190
+ if (model === "rgb") {
24191
+ if (level === "ansi16m") {
24192
+ return ansi_styles_default2[type].ansi16m(...arguments_);
24193
+ }
24194
+ if (level === "ansi256") {
24195
+ return ansi_styles_default2[type].ansi256(ansi_styles_default2.rgbToAnsi256(...arguments_));
24196
+ }
24197
+ return ansi_styles_default2[type].ansi(ansi_styles_default2.rgbToAnsi(...arguments_));
24198
+ }
24199
+ if (model === "hex") {
24200
+ return getModelAnsi2("rgb", level, type, ...ansi_styles_default2.hexToRgb(...arguments_));
24201
+ }
24202
+ return ansi_styles_default2[type][model](...arguments_);
24203
+ };
24204
+ var usedModels2 = ["rgb", "hex", "ansi256"];
24205
+ for (const model of usedModels2) {
24206
+ styles4[model] = {
24207
+ get() {
24208
+ const { level } = this;
24209
+ return function(...arguments_) {
24210
+ const styler = createStyler2(getModelAnsi2(model, levelMapping2[level], "color", ...arguments_), ansi_styles_default2.color.close, this[STYLER2]);
24211
+ return createBuilder2(this, styler, this[IS_EMPTY2]);
24212
+ };
24213
+ }
24214
+ };
24215
+ const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
24216
+ styles4[bgModel] = {
24217
+ get() {
24218
+ const { level } = this;
24219
+ return function(...arguments_) {
24220
+ const styler = createStyler2(getModelAnsi2(model, levelMapping2[level], "bgColor", ...arguments_), ansi_styles_default2.bgColor.close, this[STYLER2]);
24221
+ return createBuilder2(this, styler, this[IS_EMPTY2]);
24222
+ };
24223
+ }
24022
24224
  };
24023
- return JSON.stringify(tsconfig, null, 2) + `
24024
- `;
24025
24225
  }
24026
- function generateTailwindConfig() {
24027
- return `/** @type {import('tailwindcss').Config} */
24028
- module.exports = {
24029
- content: [
24030
- './src/**/*.{js,ts,jsx,tsx}'
24031
- ],
24032
- theme: {
24033
- extend: {}
24226
+ var proto2 = Object.defineProperties(() => {}, {
24227
+ ...styles4,
24228
+ level: {
24229
+ enumerable: true,
24230
+ get() {
24231
+ return this[GENERATOR2].level;
24034
24232
  },
24035
- plugins: []
24036
- }
24037
- `;
24038
- }
24039
-
24040
- // src/templates/backend.ts
24041
- function generateBackendFiles(domain) {
24042
- if (!domain)
24043
- throw new Error("domain は必須です");
24233
+ set(level) {
24234
+ this[GENERATOR2].level = level;
24235
+ }
24236
+ }
24237
+ });
24238
+ var createStyler2 = (open, close, parent) => {
24239
+ let openAll;
24240
+ let closeAll;
24241
+ if (parent === undefined) {
24242
+ openAll = open;
24243
+ closeAll = close;
24244
+ } else {
24245
+ openAll = parent.openAll + open;
24246
+ closeAll = close + parent.closeAll;
24247
+ }
24044
24248
  return {
24045
- "backend/server.ts": generateServerTs(),
24046
- "backend/package.json": generateBackendPackageJson(),
24047
- "backend/tsconfig.json": generateBackendTsconfig(),
24048
- [`backend/prisma/${domain}/schema.prisma`]: generatePrismaSchema(domain)
24249
+ open,
24250
+ close,
24251
+ openAll,
24252
+ closeAll,
24253
+ parent
24049
24254
  };
24050
- }
24051
- function generateServerTs() {
24052
- return `import express from 'express'
24053
-
24054
- const app = express()
24055
- const port = process.env.PORT ? parseInt(process.env.PORT) : 1616
24255
+ };
24256
+ var createBuilder2 = (self2, _styler, _isEmpty) => {
24257
+ const builder = (...arguments_) => applyStyle2(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
24258
+ Object.setPrototypeOf(builder, proto2);
24259
+ builder[GENERATOR2] = self2;
24260
+ builder[STYLER2] = _styler;
24261
+ builder[IS_EMPTY2] = _isEmpty;
24262
+ return builder;
24263
+ };
24264
+ var applyStyle2 = (self2, string) => {
24265
+ if (self2.level <= 0 || !string) {
24266
+ return self2[IS_EMPTY2] ? "" : string;
24267
+ }
24268
+ let styler = self2[STYLER2];
24269
+ if (styler === undefined) {
24270
+ return string;
24271
+ }
24272
+ const { openAll, closeAll } = styler;
24273
+ if (string.includes("\x1B")) {
24274
+ while (styler !== undefined) {
24275
+ string = stringReplaceAll2(string, styler.close, styler.open);
24276
+ styler = styler.parent;
24277
+ }
24278
+ }
24279
+ const lfIndex = string.indexOf(`
24280
+ `);
24281
+ if (lfIndex !== -1) {
24282
+ string = stringEncaseCRLFWithFirstIndex2(string, closeAll, openAll, lfIndex);
24283
+ }
24284
+ return openAll + string + closeAll;
24285
+ };
24286
+ Object.defineProperties(createChalk2.prototype, styles4);
24287
+ var chalk2 = createChalk2();
24288
+ var chalkStderr2 = createChalk2({ level: stderrColor2 ? stderrColor2.level : 0 });
24289
+ var source_default2 = chalk2;
24056
24290
 
24057
- app.use(express.json())
24291
+ // ../../node_modules/cli-cursor/index.js
24292
+ import process6 from "node:process";
24058
24293
 
24059
- app.get('/health', (_req, res) => {
24060
- res.json({ status: 'ok' })
24061
- })
24294
+ // ../../node_modules/restore-cursor/index.js
24295
+ import process5 from "node:process";
24062
24296
 
24063
- app.listen(port, () => {
24064
- console.log(\`Action Server listening on port \${port}\`)
24065
- })
24066
- `;
24297
+ // ../../node_modules/mimic-function/index.js
24298
+ var copyProperty = (to, from, property, ignoreNonConfigurable) => {
24299
+ if (property === "length" || property === "prototype") {
24300
+ return;
24301
+ }
24302
+ if (property === "arguments" || property === "caller") {
24303
+ return;
24304
+ }
24305
+ const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
24306
+ const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
24307
+ if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
24308
+ return;
24309
+ }
24310
+ Object.defineProperty(to, property, fromDescriptor);
24311
+ };
24312
+ var canCopyProperty = function(toDescriptor, fromDescriptor) {
24313
+ return toDescriptor === undefined || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
24314
+ };
24315
+ var changePrototype = (to, from) => {
24316
+ const fromPrototype = Object.getPrototypeOf(from);
24317
+ if (fromPrototype === Object.getPrototypeOf(to)) {
24318
+ return;
24319
+ }
24320
+ Object.setPrototypeOf(to, fromPrototype);
24321
+ };
24322
+ var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
24323
+ ${fromBody}`;
24324
+ var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
24325
+ var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
24326
+ var changeToString = (to, from, name) => {
24327
+ const withName = name === "" ? "" : `with ${name.trim()}() `;
24328
+ const newToString = wrappedToString.bind(null, withName, from.toString());
24329
+ Object.defineProperty(newToString, "name", toStringName);
24330
+ const { writable, enumerable, configurable } = toStringDescriptor;
24331
+ Object.defineProperty(to, "toString", { value: newToString, writable, enumerable, configurable });
24332
+ };
24333
+ function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
24334
+ const { name } = to;
24335
+ for (const property of Reflect.ownKeys(from)) {
24336
+ copyProperty(to, from, property, ignoreNonConfigurable);
24337
+ }
24338
+ changePrototype(to, from);
24339
+ changeToString(to, from, name);
24340
+ return to;
24067
24341
  }
24068
- function generateBackendPackageJson() {
24069
- const pkg = {
24070
- name: "@oyster-apps/backend",
24071
- version: "1.0.0",
24072
- private: true,
24073
- scripts: {
24074
- start: "TS_NODE_TRANSPILE_ONLY=true node --max-old-space-size=2048 -r ts-node/register -r tsconfig-paths/register server.ts"
24075
- },
24076
- dependencies: {
24077
- express: "^4.21.0",
24078
- "@prisma/client": "^6.0.0"
24079
- },
24080
- devDependencies: {
24081
- typescript: "^5.8.0",
24082
- "ts-node": "^10.9.0",
24083
- "tsconfig-paths": "^4.2.0",
24084
- "@types/express": "^5.0.0",
24085
- "@types/node": "^22.0.0",
24086
- prisma: "^6.0.0"
24342
+
24343
+ // ../../node_modules/restore-cursor/node_modules/onetime/index.js
24344
+ var calledFunctions = new WeakMap;
24345
+ var onetime = (function_, options = {}) => {
24346
+ if (typeof function_ !== "function") {
24347
+ throw new TypeError("Expected a function");
24348
+ }
24349
+ let returnValue;
24350
+ let callCount = 0;
24351
+ const functionName = function_.displayName || function_.name || "<anonymous>";
24352
+ const onetime2 = function(...arguments_) {
24353
+ calledFunctions.set(onetime2, ++callCount);
24354
+ if (callCount === 1) {
24355
+ returnValue = function_.apply(this, arguments_);
24356
+ function_ = undefined;
24357
+ } else if (options.throw === true) {
24358
+ throw new Error(`Function \`${functionName}\` can only be called once`);
24087
24359
  }
24360
+ return returnValue;
24088
24361
  };
24089
- return JSON.stringify(pkg, null, 2) + `
24090
- `;
24091
- }
24092
- function generateBackendTsconfig() {
24093
- const tsconfig = {
24094
- compilerOptions: {
24095
- target: "ES2022",
24096
- module: "CommonJS",
24097
- moduleResolution: "node",
24098
- esModuleInterop: true,
24099
- strict: true,
24100
- skipLibCheck: true,
24101
- forceConsistentCasingInFileNames: true,
24102
- resolveJsonModule: true,
24103
- outDir: "./dist",
24104
- rootDir: ".",
24105
- declaration: true,
24106
- baseUrl: ".",
24107
- paths: {
24108
- "prisma/*": ["./prisma/*"]
24109
- }
24110
- },
24111
- include: ["**/*.ts"],
24112
- exclude: ["node_modules", "dist"]
24113
- };
24114
- return JSON.stringify(tsconfig, null, 2) + `
24115
- `;
24116
- }
24117
- function generatePrismaSchema(domain) {
24118
- return `// Prisma Schema for ${domain}
24119
- // https://www.prisma.io/docs/prisma-schema
24362
+ mimicFunction(onetime2, function_);
24363
+ calledFunctions.set(onetime2, callCount);
24364
+ return onetime2;
24365
+ };
24366
+ onetime.callCount = (function_) => {
24367
+ if (!calledFunctions.has(function_)) {
24368
+ throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
24369
+ }
24370
+ return calledFunctions.get(function_);
24371
+ };
24372
+ var onetime_default = onetime;
24120
24373
 
24121
- generator client {
24122
- provider = "prisma-client-js"
24123
- output = "../../node_modules/.prisma/${domain}"
24374
+ // ../../node_modules/restore-cursor/node_modules/signal-exit/dist/mjs/signals.js
24375
+ var signals = [];
24376
+ signals.push("SIGHUP", "SIGINT", "SIGTERM");
24377
+ if (process.platform !== "win32") {
24378
+ signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
24124
24379
  }
24125
-
24126
- datasource db {
24127
- provider = "postgresql"
24128
- url = env("DATABASE_URL")
24380
+ if (process.platform === "linux") {
24381
+ signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
24129
24382
  }
24130
24383
 
24131
- // Add your models here
24132
- // model Example {
24133
- // id Int @id @default(autoincrement())
24134
- // name String
24135
- // createdAt DateTime @default(now()) @map("created_at")
24136
- // updatedAt DateTime @updatedAt @map("updated_at")
24137
- //
24138
- // @@map("examples")
24139
- // }
24140
- `;
24141
- }
24384
+ // ../../node_modules/restore-cursor/node_modules/signal-exit/dist/mjs/index.js
24385
+ var processOk = (process4) => !!process4 && typeof process4 === "object" && typeof process4.removeListener === "function" && typeof process4.emit === "function" && typeof process4.reallyExit === "function" && typeof process4.listeners === "function" && typeof process4.kill === "function" && typeof process4.pid === "number" && typeof process4.on === "function";
24386
+ var kExitEmitter = Symbol.for("signal-exit emitter");
24387
+ var global2 = globalThis;
24388
+ var ObjectDefineProperty = Object.defineProperty.bind(Object);
24142
24389
 
24143
- // src/templates/index.ts
24144
- function generateAllFiles(domain, appName) {
24145
- if (!domain)
24146
- throw new Error("domain は必須です");
24147
- if (!appName)
24148
- throw new Error("appName は必須です");
24149
- return {
24150
- ...generateFrontendFiles(domain, appName),
24151
- ...generateBackendFiles(domain),
24152
- ...generateCommonFiles(domain, appName)
24390
+ class Emitter {
24391
+ emitted = {
24392
+ afterExit: false,
24393
+ exit: false
24153
24394
  };
24154
- }
24155
- function generateAppFiles(domain, appName) {
24156
- if (!domain)
24157
- throw new Error("domain は必須です");
24158
- if (!appName)
24159
- throw new Error("appName は必須です");
24160
- return {
24161
- [`frontend/${domain}/src/apps/${appName}/index.ts`]: generateAppEntryPoint(appName)
24395
+ listeners = {
24396
+ afterExit: [],
24397
+ exit: []
24162
24398
  };
24399
+ count = 0;
24400
+ id = Math.random();
24401
+ constructor() {
24402
+ if (global2[kExitEmitter]) {
24403
+ return global2[kExitEmitter];
24404
+ }
24405
+ ObjectDefineProperty(global2, kExitEmitter, {
24406
+ value: this,
24407
+ writable: false,
24408
+ enumerable: false,
24409
+ configurable: false
24410
+ });
24411
+ }
24412
+ on(ev, fn) {
24413
+ this.listeners[ev].push(fn);
24414
+ }
24415
+ removeListener(ev, fn) {
24416
+ const list = this.listeners[ev];
24417
+ const i = list.indexOf(fn);
24418
+ if (i === -1) {
24419
+ return;
24420
+ }
24421
+ if (i === 0 && list.length === 1) {
24422
+ list.length = 0;
24423
+ } else {
24424
+ list.splice(i, 1);
24425
+ }
24426
+ }
24427
+ emit(ev, code, signal) {
24428
+ if (this.emitted[ev]) {
24429
+ return false;
24430
+ }
24431
+ this.emitted[ev] = true;
24432
+ let ret = false;
24433
+ for (const fn of this.listeners[ev]) {
24434
+ ret = fn(code, signal) === true || ret;
24435
+ }
24436
+ if (ev === "exit") {
24437
+ ret = this.emit("afterExit", code, signal) || ret;
24438
+ }
24439
+ return ret;
24440
+ }
24163
24441
  }
24164
- function generateCommonFiles(domain, appName) {
24442
+
24443
+ class SignalExitBase {
24444
+ }
24445
+ var signalExitWrap = (handler) => {
24165
24446
  return {
24166
- ".gitignore": generateGitignore(),
24167
- "README.md": generateReadme(domain, appName)
24447
+ onExit(cb, opts) {
24448
+ return handler.onExit(cb, opts);
24449
+ },
24450
+ load() {
24451
+ return handler.load();
24452
+ },
24453
+ unload() {
24454
+ return handler.unload();
24455
+ }
24168
24456
  };
24169
- }
24170
- function generateGitignore() {
24171
- return `# Dependencies
24172
- node_modules/
24173
-
24174
- # Build output
24175
- .build/
24176
- dist/
24177
-
24178
- # Environment
24179
- .env
24180
- .env.local
24181
- .env.*.local
24182
-
24183
- # IDE
24184
- .vscode/
24185
- .idea/
24186
-
24187
- # OS
24188
- .DS_Store
24189
- Thumbs.db
24457
+ };
24190
24458
 
24191
- # Logs
24192
- *.log
24193
- npm-debug.log*
24194
- yarn-debug.log*
24195
- pnpm-debug.log*
24196
- `;
24459
+ class SignalExitFallback extends SignalExitBase {
24460
+ onExit() {
24461
+ return () => {};
24462
+ }
24463
+ load() {}
24464
+ unload() {}
24197
24465
  }
24198
- function generateReadme(domain, appName) {
24199
- return `# Oyster Apps - ${domain}
24200
-
24201
- This repository contains the frontend and backend code for the **${domain}** domain on the Oyster platform.
24202
-
24203
- ## Structure
24204
-
24205
- \`\`\`
24206
- frontend/${domain}/ # Frontend applications
24207
- src/apps/${appName}/ # ${appName} app entry point
24208
- src/shared/ # Shared modules
24209
- backend/ # Backend (Action Server)
24210
- prisma/${domain}/ # Prisma schema
24211
- \`\`\`
24212
24466
 
24213
- ## Apps
24214
-
24215
- - **${appName}** - \`frontend/${domain}/src/apps/${appName}/index.ts\`
24216
-
24217
- ## Deploy
24218
-
24219
- \`\`\`bash
24220
- oyster deploy -d ${domain} -a ${appName}
24221
- \`\`\`
24222
-
24223
- ## Migrate
24224
-
24225
- \`\`\`bash
24226
- oyster migrate -d ${domain} -a ${appName}
24227
- \`\`\`
24228
- `;
24229
- }
24230
- function writeFiles(rootDir, files, force) {
24231
- const created = [];
24232
- const skipped = [];
24233
- for (const [relativePath, content] of Object.entries(files)) {
24234
- const fullPath = path2.resolve(rootDir, relativePath);
24235
- if (!fullPath.startsWith(path2.resolve(rootDir) + path2.sep)) {
24236
- throw new Error(`不正なパスが検出されました: ${relativePath}`);
24237
- }
24238
- const dir = path2.dirname(fullPath);
24239
- if (!fs2.existsSync(dir)) {
24240
- fs2.mkdirSync(dir, { recursive: true });
24241
- }
24242
- if (fs2.existsSync(fullPath) && !force) {
24243
- skipped.push(relativePath);
24244
- continue;
24467
+ class SignalExit extends SignalExitBase {
24468
+ #hupSig = process4.platform === "win32" ? "SIGINT" : "SIGHUP";
24469
+ #emitter = new Emitter;
24470
+ #process;
24471
+ #originalProcessEmit;
24472
+ #originalProcessReallyExit;
24473
+ #sigListeners = {};
24474
+ #loaded = false;
24475
+ constructor(process4) {
24476
+ super();
24477
+ this.#process = process4;
24478
+ this.#sigListeners = {};
24479
+ for (const sig of signals) {
24480
+ this.#sigListeners[sig] = () => {
24481
+ const listeners = this.#process.listeners(sig);
24482
+ let { count } = this.#emitter;
24483
+ const p = process4;
24484
+ if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
24485
+ count += p.__signal_exit_emitter__.count;
24486
+ }
24487
+ if (listeners.length === count) {
24488
+ this.unload();
24489
+ const ret = this.#emitter.emit("exit", null, sig);
24490
+ const s = sig === "SIGHUP" ? this.#hupSig : sig;
24491
+ if (!ret)
24492
+ process4.kill(process4.pid, s);
24493
+ }
24494
+ };
24245
24495
  }
24246
- fs2.writeFileSync(fullPath, content, "utf-8");
24247
- created.push(relativePath);
24496
+ this.#originalProcessReallyExit = process4.reallyExit;
24497
+ this.#originalProcessEmit = process4.emit;
24248
24498
  }
24249
- return { created, skipped };
24250
- }
24251
-
24252
- // src/commands/init.ts
24253
- function setInit(program2) {
24254
- program2.command("init").description("リポジトリを Oyster アプリ構成で初期化する").option("-d, --domain <name>", "ドメイン名を指定").option("-a, --app <name>", "アプリ名を指定").option("--force", "既存ファイルを上書きする", false).option("--add-app", "既存リポジトリに新しいアプリを追加する", false).action(async (options) => {
24255
- try {
24256
- requireLogin();
24257
- try {
24258
- spawnSync("git", ["rev-parse", "--is-inside-work-tree"], {
24259
- stdio: ["pipe", "pipe", "pipe"]
24260
- });
24261
- } catch {
24262
- console.error(source_default.red("✗ カレントディレクトリは git リポジトリではありません。"));
24263
- console.error(source_default.gray(" 先に `git init` を実行してください。"));
24264
- process.exit(1);
24265
- }
24266
- let domainName = options.domain;
24267
- if (!domainName) {
24268
- const { value } = await import_prompts2.default({
24269
- type: "text",
24270
- name: "value",
24271
- message: "ドメイン名:",
24272
- validate: (v) => v.length > 0 ? true : "ドメイン名は必須です"
24273
- });
24274
- if (!value) {
24275
- console.log(source_default.yellow("キャンセルしました"));
24276
- return;
24277
- }
24278
- domainName = value;
24279
- }
24280
- let appName = options.app;
24281
- if (!appName) {
24282
- const { value } = await import_prompts2.default({
24283
- type: "text",
24284
- name: "value",
24285
- message: "アプリ名:",
24286
- validate: (v) => v.length > 0 ? true : "アプリ名は必須です"
24287
- });
24288
- if (!value) {
24289
- console.log(source_default.yellow("キャンセルしました"));
24290
- return;
24291
- }
24292
- appName = value;
24293
- }
24294
- const safeNamePattern = /^[a-zA-Z0-9_-]+$/;
24295
- if (!safeNamePattern.test(domainName)) {
24296
- console.error(source_default.red("✗ ドメイン名には英数字、ハイフン、アンダースコアのみ使用できます"));
24297
- process.exit(1);
24298
- }
24299
- if (!safeNamePattern.test(appName)) {
24300
- console.error(source_default.red("✗ アプリ名には英数字、ハイフン、アンダースコアのみ使用できます"));
24301
- process.exit(1);
24302
- }
24303
- const isAddApp = options.addApp ?? false;
24304
- const files = isAddApp ? generateAppFiles(domainName, appName) : generateAllFiles(domainName, appName);
24305
- const cwd = process.cwd();
24306
- const force = options.force ?? false;
24307
- console.log();
24308
- console.log(source_default.cyan("初期化設定:"));
24309
- console.log(source_default.gray(` ドメイン : ${domainName}`));
24310
- console.log(source_default.gray(` アプリ : ${appName}`));
24311
- console.log(source_default.gray(` モード : ${isAddApp ? "アプリ追加" : "初回初期化"}`));
24312
- console.log(source_default.gray(` 上書き : ${force ? "はい" : "いいえ"}`));
24313
- console.log();
24314
- const result = writeFiles(cwd, files, force);
24315
- if (result.created.length > 0) {
24316
- console.log(source_default.green("作成されたファイル:"));
24317
- for (const f of result.created) {
24318
- console.log(source_default.green(` + ${f}`));
24319
- }
24499
+ onExit(cb, opts) {
24500
+ if (!processOk(this.#process)) {
24501
+ return () => {};
24502
+ }
24503
+ if (this.#loaded === false) {
24504
+ this.load();
24505
+ }
24506
+ const ev = opts?.alwaysLast ? "afterExit" : "exit";
24507
+ this.#emitter.on(ev, cb);
24508
+ return () => {
24509
+ this.#emitter.removeListener(ev, cb);
24510
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
24511
+ this.unload();
24320
24512
  }
24321
- if (result.skipped.length > 0) {
24322
- console.log();
24323
- console.log(source_default.yellow("スキップされたファイル(既存):"));
24324
- for (const f of result.skipped) {
24325
- console.log(source_default.yellow(` ~ ${f}`));
24326
- }
24327
- console.log(source_default.gray(" 上書きするには --force オプションを使用してください"));
24513
+ };
24514
+ }
24515
+ load() {
24516
+ if (this.#loaded) {
24517
+ return;
24518
+ }
24519
+ this.#loaded = true;
24520
+ this.#emitter.count += 1;
24521
+ for (const sig of signals) {
24522
+ try {
24523
+ const fn = this.#sigListeners[sig];
24524
+ if (fn)
24525
+ this.#process.on(sig, fn);
24526
+ } catch (_) {}
24527
+ }
24528
+ this.#process.emit = (ev, ...a) => {
24529
+ return this.#processEmit(ev, ...a);
24530
+ };
24531
+ this.#process.reallyExit = (code) => {
24532
+ return this.#processReallyExit(code);
24533
+ };
24534
+ }
24535
+ unload() {
24536
+ if (!this.#loaded) {
24537
+ return;
24538
+ }
24539
+ this.#loaded = false;
24540
+ signals.forEach((sig) => {
24541
+ const listener = this.#sigListeners[sig];
24542
+ if (!listener) {
24543
+ throw new Error("Listener not defined for signal: " + sig);
24328
24544
  }
24329
- if (result.created.length > 0) {
24330
- console.log();
24331
- try {
24332
- for (const f of result.created) {
24333
- spawnSync("git", ["add", "--", f], {
24334
- stdio: ["pipe", "pipe", "pipe"]
24335
- });
24336
- }
24337
- console.log(source_default.green(`✓ ${result.created.length} ファイルを git に追加しました`));
24338
- } catch {
24339
- console.log(source_default.yellow("⚠ git add に失敗しました。手動で追加してください。"));
24340
- }
24341
- console.log();
24342
- console.log(source_default.cyan("次のステップ:"));
24343
- console.log(source_default.gray(` git commit -m "Initialize oyster app: ${appName}"`));
24344
- console.log(source_default.gray(" git push"));
24345
- console.log(source_default.gray(` oyster deploy -d ${domainName} -a ${appName}`));
24545
+ try {
24546
+ this.#process.removeListener(sig, listener);
24547
+ } catch (_) {}
24548
+ });
24549
+ this.#process.emit = this.#originalProcessEmit;
24550
+ this.#process.reallyExit = this.#originalProcessReallyExit;
24551
+ this.#emitter.count -= 1;
24552
+ }
24553
+ #processReallyExit(code) {
24554
+ if (!processOk(this.#process)) {
24555
+ return 0;
24556
+ }
24557
+ this.#process.exitCode = code || 0;
24558
+ this.#emitter.emit("exit", this.#process.exitCode, null);
24559
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
24560
+ }
24561
+ #processEmit(ev, ...args) {
24562
+ const og = this.#originalProcessEmit;
24563
+ if (ev === "exit" && processOk(this.#process)) {
24564
+ if (typeof args[0] === "number") {
24565
+ this.#process.exitCode = args[0];
24346
24566
  }
24347
- } catch (error) {
24348
- console.error(source_default.red(`✗ ${error.message}`));
24349
- process.exit(1);
24567
+ const ret = og.call(this.#process, ev, ...args);
24568
+ this.#emitter.emit("exit", this.#process.exitCode, null);
24569
+ return ret;
24570
+ } else {
24571
+ return og.call(this.#process, ev, ...args);
24350
24572
  }
24351
- });
24573
+ }
24352
24574
  }
24575
+ var process4 = globalThis.process;
24576
+ var {
24577
+ onExit,
24578
+ load,
24579
+ unload
24580
+ } = signalExitWrap(processOk(process4) ? new SignalExit(process4) : new SignalExitFallback);
24581
+
24582
+ // ../../node_modules/restore-cursor/index.js
24583
+ var terminal = process5.stderr.isTTY ? process5.stderr : process5.stdout.isTTY ? process5.stdout : undefined;
24584
+ var restoreCursor = terminal ? onetime_default(() => {
24585
+ onExit(() => {
24586
+ terminal.write("\x1B[?25h");
24587
+ }, { alwaysLast: true });
24588
+ }) : () => {};
24589
+ var restore_cursor_default = restoreCursor;
24590
+
24591
+ // ../../node_modules/cli-cursor/index.js
24592
+ var isHidden = false;
24593
+ var cliCursor = {};
24594
+ cliCursor.show = (writableStream = process6.stderr) => {
24595
+ if (!writableStream.isTTY) {
24596
+ return;
24597
+ }
24598
+ isHidden = false;
24599
+ writableStream.write("\x1B[?25h");
24600
+ };
24601
+ cliCursor.hide = (writableStream = process6.stderr) => {
24602
+ if (!writableStream.isTTY) {
24603
+ return;
24604
+ }
24605
+ restore_cursor_default();
24606
+ isHidden = true;
24607
+ writableStream.write("\x1B[?25l");
24608
+ };
24609
+ cliCursor.toggle = (force, writableStream) => {
24610
+ if (force !== undefined) {
24611
+ isHidden = force;
24612
+ }
24613
+ if (isHidden) {
24614
+ cliCursor.show(writableStream);
24615
+ } else {
24616
+ cliCursor.hide(writableStream);
24617
+ }
24618
+ };
24619
+ var cli_cursor_default = cliCursor;
24353
24620
 
24354
24621
  // ../../node_modules/ora/index.js
24355
- import process11 from "node:process";
24622
+ var import_cli_spinners = __toESM(require_cli_spinners(), 1);
24356
24623
 
24357
- // ../../node_modules/ora/node_modules/chalk/source/vendor/ansi-styles/index.js
24358
- var ANSI_BACKGROUND_OFFSET2 = 10;
24359
- var wrapAnsi162 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
24360
- var wrapAnsi2562 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
24361
- var wrapAnsi16m2 = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
24362
- var styles3 = {
24624
+ // ../../node_modules/log-symbols/node_modules/chalk/source/vendor/ansi-styles/index.js
24625
+ var ANSI_BACKGROUND_OFFSET3 = 10;
24626
+ var wrapAnsi163 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
24627
+ var wrapAnsi2563 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
24628
+ var wrapAnsi16m3 = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
24629
+ var styles5 = {
24363
24630
  modifier: {
24364
24631
  reset: [0, 0],
24365
24632
  bold: [1, 22],
@@ -24412,39 +24679,39 @@ var styles3 = {
24412
24679
  bgWhiteBright: [107, 49]
24413
24680
  }
24414
24681
  };
24415
- var modifierNames2 = Object.keys(styles3.modifier);
24416
- var foregroundColorNames2 = Object.keys(styles3.color);
24417
- var backgroundColorNames2 = Object.keys(styles3.bgColor);
24418
- var colorNames2 = [...foregroundColorNames2, ...backgroundColorNames2];
24419
- function assembleStyles2() {
24682
+ var modifierNames3 = Object.keys(styles5.modifier);
24683
+ var foregroundColorNames3 = Object.keys(styles5.color);
24684
+ var backgroundColorNames3 = Object.keys(styles5.bgColor);
24685
+ var colorNames3 = [...foregroundColorNames3, ...backgroundColorNames3];
24686
+ function assembleStyles3() {
24420
24687
  const codes = new Map;
24421
- for (const [groupName, group] of Object.entries(styles3)) {
24688
+ for (const [groupName, group] of Object.entries(styles5)) {
24422
24689
  for (const [styleName, style] of Object.entries(group)) {
24423
- styles3[styleName] = {
24690
+ styles5[styleName] = {
24424
24691
  open: `\x1B[${style[0]}m`,
24425
24692
  close: `\x1B[${style[1]}m`
24426
24693
  };
24427
- group[styleName] = styles3[styleName];
24694
+ group[styleName] = styles5[styleName];
24428
24695
  codes.set(style[0], style[1]);
24429
24696
  }
24430
- Object.defineProperty(styles3, groupName, {
24697
+ Object.defineProperty(styles5, groupName, {
24431
24698
  value: group,
24432
24699
  enumerable: false
24433
24700
  });
24434
24701
  }
24435
- Object.defineProperty(styles3, "codes", {
24702
+ Object.defineProperty(styles5, "codes", {
24436
24703
  value: codes,
24437
24704
  enumerable: false
24438
24705
  });
24439
- styles3.color.close = "\x1B[39m";
24440
- styles3.bgColor.close = "\x1B[49m";
24441
- styles3.color.ansi = wrapAnsi162();
24442
- styles3.color.ansi256 = wrapAnsi2562();
24443
- styles3.color.ansi16m = wrapAnsi16m2();
24444
- styles3.bgColor.ansi = wrapAnsi162(ANSI_BACKGROUND_OFFSET2);
24445
- styles3.bgColor.ansi256 = wrapAnsi2562(ANSI_BACKGROUND_OFFSET2);
24446
- styles3.bgColor.ansi16m = wrapAnsi16m2(ANSI_BACKGROUND_OFFSET2);
24447
- Object.defineProperties(styles3, {
24706
+ styles5.color.close = "\x1B[39m";
24707
+ styles5.bgColor.close = "\x1B[49m";
24708
+ styles5.color.ansi = wrapAnsi163();
24709
+ styles5.color.ansi256 = wrapAnsi2563();
24710
+ styles5.color.ansi16m = wrapAnsi16m3();
24711
+ styles5.bgColor.ansi = wrapAnsi163(ANSI_BACKGROUND_OFFSET3);
24712
+ styles5.bgColor.ansi256 = wrapAnsi2563(ANSI_BACKGROUND_OFFSET3);
24713
+ styles5.bgColor.ansi16m = wrapAnsi16m3(ANSI_BACKGROUND_OFFSET3);
24714
+ Object.defineProperties(styles5, {
24448
24715
  rgbToAnsi256: {
24449
24716
  value(red, green, blue) {
24450
24717
  if (red === green && green === blue) {
@@ -24480,7 +24747,7 @@ function assembleStyles2() {
24480
24747
  enumerable: false
24481
24748
  },
24482
24749
  hexToAnsi256: {
24483
- value: (hex) => styles3.rgbToAnsi256(...styles3.hexToRgb(hex)),
24750
+ value: (hex) => styles5.rgbToAnsi256(...styles5.hexToRgb(hex)),
24484
24751
  enumerable: false
24485
24752
  },
24486
24753
  ansi256ToAnsi: {
@@ -24518,48 +24785,48 @@ function assembleStyles2() {
24518
24785
  enumerable: false
24519
24786
  },
24520
24787
  rgbToAnsi: {
24521
- value: (red, green, blue) => styles3.ansi256ToAnsi(styles3.rgbToAnsi256(red, green, blue)),
24788
+ value: (red, green, blue) => styles5.ansi256ToAnsi(styles5.rgbToAnsi256(red, green, blue)),
24522
24789
  enumerable: false
24523
24790
  },
24524
24791
  hexToAnsi: {
24525
- value: (hex) => styles3.ansi256ToAnsi(styles3.hexToAnsi256(hex)),
24792
+ value: (hex) => styles5.ansi256ToAnsi(styles5.hexToAnsi256(hex)),
24526
24793
  enumerable: false
24527
24794
  }
24528
24795
  });
24529
- return styles3;
24796
+ return styles5;
24530
24797
  }
24531
- var ansiStyles2 = assembleStyles2();
24532
- var ansi_styles_default2 = ansiStyles2;
24798
+ var ansiStyles3 = assembleStyles3();
24799
+ var ansi_styles_default3 = ansiStyles3;
24533
24800
 
24534
- // ../../node_modules/ora/node_modules/chalk/source/vendor/supports-color/index.js
24535
- import process3 from "node:process";
24801
+ // ../../node_modules/log-symbols/node_modules/chalk/source/vendor/supports-color/index.js
24802
+ import process7 from "node:process";
24536
24803
  import os3 from "node:os";
24537
- import tty2 from "node:tty";
24538
- function hasFlag2(flag, argv = globalThis.Deno ? globalThis.Deno.args : process3.argv) {
24804
+ import tty3 from "node:tty";
24805
+ function hasFlag3(flag, argv = globalThis.Deno ? globalThis.Deno.args : process7.argv) {
24539
24806
  const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
24540
24807
  const position = argv.indexOf(prefix + flag);
24541
24808
  const terminatorPosition = argv.indexOf("--");
24542
24809
  return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
24543
24810
  }
24544
- var { env: env2 } = process3;
24545
- var flagForceColor2;
24546
- if (hasFlag2("no-color") || hasFlag2("no-colors") || hasFlag2("color=false") || hasFlag2("color=never")) {
24547
- flagForceColor2 = 0;
24548
- } else if (hasFlag2("color") || hasFlag2("colors") || hasFlag2("color=true") || hasFlag2("color=always")) {
24549
- flagForceColor2 = 1;
24811
+ var { env: env3 } = process7;
24812
+ var flagForceColor3;
24813
+ if (hasFlag3("no-color") || hasFlag3("no-colors") || hasFlag3("color=false") || hasFlag3("color=never")) {
24814
+ flagForceColor3 = 0;
24815
+ } else if (hasFlag3("color") || hasFlag3("colors") || hasFlag3("color=true") || hasFlag3("color=always")) {
24816
+ flagForceColor3 = 1;
24550
24817
  }
24551
- function envForceColor2() {
24552
- if ("FORCE_COLOR" in env2) {
24553
- if (env2.FORCE_COLOR === "true") {
24818
+ function envForceColor3() {
24819
+ if ("FORCE_COLOR" in env3) {
24820
+ if (env3.FORCE_COLOR === "true") {
24554
24821
  return 1;
24555
24822
  }
24556
- if (env2.FORCE_COLOR === "false") {
24823
+ if (env3.FORCE_COLOR === "false") {
24557
24824
  return 0;
24558
24825
  }
24559
- return env2.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env2.FORCE_COLOR, 10), 3);
24826
+ return env3.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env3.FORCE_COLOR, 10), 3);
24560
24827
  }
24561
24828
  }
24562
- function translateLevel2(level) {
24829
+ function translateLevel3(level) {
24563
24830
  if (level === 0) {
24564
24831
  return false;
24565
24832
  }
@@ -24570,67 +24837,67 @@ function translateLevel2(level) {
24570
24837
  has16m: level >= 3
24571
24838
  };
24572
24839
  }
24573
- function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
24574
- const noFlagForceColor = envForceColor2();
24840
+ function _supportsColor3(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
24841
+ const noFlagForceColor = envForceColor3();
24575
24842
  if (noFlagForceColor !== undefined) {
24576
- flagForceColor2 = noFlagForceColor;
24843
+ flagForceColor3 = noFlagForceColor;
24577
24844
  }
24578
- const forceColor = sniffFlags ? flagForceColor2 : noFlagForceColor;
24845
+ const forceColor = sniffFlags ? flagForceColor3 : noFlagForceColor;
24579
24846
  if (forceColor === 0) {
24580
24847
  return 0;
24581
24848
  }
24582
24849
  if (sniffFlags) {
24583
- if (hasFlag2("color=16m") || hasFlag2("color=full") || hasFlag2("color=truecolor")) {
24850
+ if (hasFlag3("color=16m") || hasFlag3("color=full") || hasFlag3("color=truecolor")) {
24584
24851
  return 3;
24585
24852
  }
24586
- if (hasFlag2("color=256")) {
24853
+ if (hasFlag3("color=256")) {
24587
24854
  return 2;
24588
24855
  }
24589
24856
  }
24590
- if ("TF_BUILD" in env2 && "AGENT_NAME" in env2) {
24857
+ if ("TF_BUILD" in env3 && "AGENT_NAME" in env3) {
24591
24858
  return 1;
24592
24859
  }
24593
24860
  if (haveStream && !streamIsTTY && forceColor === undefined) {
24594
24861
  return 0;
24595
24862
  }
24596
24863
  const min = forceColor || 0;
24597
- if (env2.TERM === "dumb") {
24864
+ if (env3.TERM === "dumb") {
24598
24865
  return min;
24599
24866
  }
24600
- if (process3.platform === "win32") {
24867
+ if (process7.platform === "win32") {
24601
24868
  const osRelease = os3.release().split(".");
24602
24869
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
24603
24870
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
24604
24871
  }
24605
24872
  return 1;
24606
24873
  }
24607
- if ("CI" in env2) {
24608
- if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => (key in env2))) {
24874
+ if ("CI" in env3) {
24875
+ if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => (key in env3))) {
24609
24876
  return 3;
24610
24877
  }
24611
- if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => (sign in env2)) || env2.CI_NAME === "codeship") {
24878
+ if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => (sign in env3)) || env3.CI_NAME === "codeship") {
24612
24879
  return 1;
24613
24880
  }
24614
24881
  return min;
24615
24882
  }
24616
- if ("TEAMCITY_VERSION" in env2) {
24617
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env2.TEAMCITY_VERSION) ? 1 : 0;
24883
+ if ("TEAMCITY_VERSION" in env3) {
24884
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env3.TEAMCITY_VERSION) ? 1 : 0;
24618
24885
  }
24619
- if (env2.COLORTERM === "truecolor") {
24886
+ if (env3.COLORTERM === "truecolor") {
24620
24887
  return 3;
24621
24888
  }
24622
- if (env2.TERM === "xterm-kitty") {
24889
+ if (env3.TERM === "xterm-kitty") {
24623
24890
  return 3;
24624
24891
  }
24625
- if (env2.TERM === "xterm-ghostty") {
24892
+ if (env3.TERM === "xterm-ghostty") {
24626
24893
  return 3;
24627
24894
  }
24628
- if (env2.TERM === "wezterm") {
24895
+ if (env3.TERM === "wezterm") {
24629
24896
  return 3;
24630
24897
  }
24631
- if ("TERM_PROGRAM" in env2) {
24632
- const version = Number.parseInt((env2.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
24633
- switch (env2.TERM_PROGRAM) {
24898
+ if ("TERM_PROGRAM" in env3) {
24899
+ const version = Number.parseInt((env3.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
24900
+ switch (env3.TERM_PROGRAM) {
24634
24901
  case "iTerm.app": {
24635
24902
  return version >= 3 ? 3 : 2;
24636
24903
  }
@@ -24639,32 +24906,32 @@ function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
24639
24906
  }
24640
24907
  }
24641
24908
  }
24642
- if (/-256(color)?$/i.test(env2.TERM)) {
24909
+ if (/-256(color)?$/i.test(env3.TERM)) {
24643
24910
  return 2;
24644
24911
  }
24645
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env2.TERM)) {
24912
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env3.TERM)) {
24646
24913
  return 1;
24647
24914
  }
24648
- if ("COLORTERM" in env2) {
24915
+ if ("COLORTERM" in env3) {
24649
24916
  return 1;
24650
24917
  }
24651
24918
  return min;
24652
24919
  }
24653
- function createSupportsColor2(stream4, options = {}) {
24654
- const level = _supportsColor2(stream4, {
24920
+ function createSupportsColor3(stream4, options = {}) {
24921
+ const level = _supportsColor3(stream4, {
24655
24922
  streamIsTTY: stream4 && stream4.isTTY,
24656
24923
  ...options
24657
24924
  });
24658
- return translateLevel2(level);
24925
+ return translateLevel3(level);
24659
24926
  }
24660
- var supportsColor2 = {
24661
- stdout: createSupportsColor2({ isTTY: tty2.isatty(1) }),
24662
- stderr: createSupportsColor2({ isTTY: tty2.isatty(2) })
24927
+ var supportsColor3 = {
24928
+ stdout: createSupportsColor3({ isTTY: tty3.isatty(1) }),
24929
+ stderr: createSupportsColor3({ isTTY: tty3.isatty(2) })
24663
24930
  };
24664
- var supports_color_default2 = supportsColor2;
24931
+ var supports_color_default3 = supportsColor3;
24665
24932
 
24666
- // ../../node_modules/ora/node_modules/chalk/source/utilities.js
24667
- function stringReplaceAll2(string, substring, replacer) {
24933
+ // ../../node_modules/log-symbols/node_modules/chalk/source/utilities.js
24934
+ function stringReplaceAll3(string, substring, replacer) {
24668
24935
  let index = string.indexOf(substring);
24669
24936
  if (index === -1) {
24670
24937
  return string;
@@ -24680,7 +24947,7 @@ function stringReplaceAll2(string, substring, replacer) {
24680
24947
  returnValue += string.slice(endIndex);
24681
24948
  return returnValue;
24682
24949
  }
24683
- function stringEncaseCRLFWithFirstIndex2(string, prefix, postfix, index) {
24950
+ function stringEncaseCRLFWithFirstIndex3(string, prefix, postfix, index) {
24684
24951
  let endIndex = 0;
24685
24952
  let returnValue = "";
24686
24953
  do {
@@ -24696,101 +24963,101 @@ function stringEncaseCRLFWithFirstIndex2(string, prefix, postfix, index) {
24696
24963
  return returnValue;
24697
24964
  }
24698
24965
 
24699
- // ../../node_modules/ora/node_modules/chalk/source/index.js
24700
- var { stdout: stdoutColor2, stderr: stderrColor2 } = supports_color_default2;
24701
- var GENERATOR2 = Symbol("GENERATOR");
24702
- var STYLER2 = Symbol("STYLER");
24703
- var IS_EMPTY2 = Symbol("IS_EMPTY");
24704
- var levelMapping2 = [
24966
+ // ../../node_modules/log-symbols/node_modules/chalk/source/index.js
24967
+ var { stdout: stdoutColor3, stderr: stderrColor3 } = supports_color_default3;
24968
+ var GENERATOR3 = Symbol("GENERATOR");
24969
+ var STYLER3 = Symbol("STYLER");
24970
+ var IS_EMPTY3 = Symbol("IS_EMPTY");
24971
+ var levelMapping3 = [
24705
24972
  "ansi",
24706
24973
  "ansi",
24707
24974
  "ansi256",
24708
24975
  "ansi16m"
24709
24976
  ];
24710
- var styles4 = Object.create(null);
24711
- var applyOptions2 = (object, options = {}) => {
24977
+ var styles6 = Object.create(null);
24978
+ var applyOptions3 = (object, options = {}) => {
24712
24979
  if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
24713
24980
  throw new Error("The `level` option should be an integer from 0 to 3");
24714
24981
  }
24715
- const colorLevel = stdoutColor2 ? stdoutColor2.level : 0;
24982
+ const colorLevel = stdoutColor3 ? stdoutColor3.level : 0;
24716
24983
  object.level = options.level === undefined ? colorLevel : options.level;
24717
24984
  };
24718
- var chalkFactory2 = (options) => {
24719
- const chalk2 = (...strings) => strings.join(" ");
24720
- applyOptions2(chalk2, options);
24721
- Object.setPrototypeOf(chalk2, createChalk2.prototype);
24722
- return chalk2;
24985
+ var chalkFactory3 = (options) => {
24986
+ const chalk3 = (...strings) => strings.join(" ");
24987
+ applyOptions3(chalk3, options);
24988
+ Object.setPrototypeOf(chalk3, createChalk3.prototype);
24989
+ return chalk3;
24723
24990
  };
24724
- function createChalk2(options) {
24725
- return chalkFactory2(options);
24991
+ function createChalk3(options) {
24992
+ return chalkFactory3(options);
24726
24993
  }
24727
- Object.setPrototypeOf(createChalk2.prototype, Function.prototype);
24728
- for (const [styleName, style] of Object.entries(ansi_styles_default2)) {
24729
- styles4[styleName] = {
24994
+ Object.setPrototypeOf(createChalk3.prototype, Function.prototype);
24995
+ for (const [styleName, style] of Object.entries(ansi_styles_default3)) {
24996
+ styles6[styleName] = {
24730
24997
  get() {
24731
- const builder = createBuilder2(this, createStyler2(style.open, style.close, this[STYLER2]), this[IS_EMPTY2]);
24998
+ const builder = createBuilder3(this, createStyler3(style.open, style.close, this[STYLER3]), this[IS_EMPTY3]);
24732
24999
  Object.defineProperty(this, styleName, { value: builder });
24733
25000
  return builder;
24734
25001
  }
24735
25002
  };
24736
25003
  }
24737
- styles4.visible = {
25004
+ styles6.visible = {
24738
25005
  get() {
24739
- const builder = createBuilder2(this, this[STYLER2], true);
25006
+ const builder = createBuilder3(this, this[STYLER3], true);
24740
25007
  Object.defineProperty(this, "visible", { value: builder });
24741
25008
  return builder;
24742
25009
  }
24743
25010
  };
24744
- var getModelAnsi2 = (model, level, type, ...arguments_) => {
25011
+ var getModelAnsi3 = (model, level, type, ...arguments_) => {
24745
25012
  if (model === "rgb") {
24746
25013
  if (level === "ansi16m") {
24747
- return ansi_styles_default2[type].ansi16m(...arguments_);
25014
+ return ansi_styles_default3[type].ansi16m(...arguments_);
24748
25015
  }
24749
25016
  if (level === "ansi256") {
24750
- return ansi_styles_default2[type].ansi256(ansi_styles_default2.rgbToAnsi256(...arguments_));
25017
+ return ansi_styles_default3[type].ansi256(ansi_styles_default3.rgbToAnsi256(...arguments_));
24751
25018
  }
24752
- return ansi_styles_default2[type].ansi(ansi_styles_default2.rgbToAnsi(...arguments_));
25019
+ return ansi_styles_default3[type].ansi(ansi_styles_default3.rgbToAnsi(...arguments_));
24753
25020
  }
24754
25021
  if (model === "hex") {
24755
- return getModelAnsi2("rgb", level, type, ...ansi_styles_default2.hexToRgb(...arguments_));
25022
+ return getModelAnsi3("rgb", level, type, ...ansi_styles_default3.hexToRgb(...arguments_));
24756
25023
  }
24757
- return ansi_styles_default2[type][model](...arguments_);
25024
+ return ansi_styles_default3[type][model](...arguments_);
24758
25025
  };
24759
- var usedModels2 = ["rgb", "hex", "ansi256"];
24760
- for (const model of usedModels2) {
24761
- styles4[model] = {
25026
+ var usedModels3 = ["rgb", "hex", "ansi256"];
25027
+ for (const model of usedModels3) {
25028
+ styles6[model] = {
24762
25029
  get() {
24763
25030
  const { level } = this;
24764
25031
  return function(...arguments_) {
24765
- const styler = createStyler2(getModelAnsi2(model, levelMapping2[level], "color", ...arguments_), ansi_styles_default2.color.close, this[STYLER2]);
24766
- return createBuilder2(this, styler, this[IS_EMPTY2]);
25032
+ const styler = createStyler3(getModelAnsi3(model, levelMapping3[level], "color", ...arguments_), ansi_styles_default3.color.close, this[STYLER3]);
25033
+ return createBuilder3(this, styler, this[IS_EMPTY3]);
24767
25034
  };
24768
25035
  }
24769
25036
  };
24770
25037
  const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
24771
- styles4[bgModel] = {
25038
+ styles6[bgModel] = {
24772
25039
  get() {
24773
25040
  const { level } = this;
24774
25041
  return function(...arguments_) {
24775
- const styler = createStyler2(getModelAnsi2(model, levelMapping2[level], "bgColor", ...arguments_), ansi_styles_default2.bgColor.close, this[STYLER2]);
24776
- return createBuilder2(this, styler, this[IS_EMPTY2]);
25042
+ const styler = createStyler3(getModelAnsi3(model, levelMapping3[level], "bgColor", ...arguments_), ansi_styles_default3.bgColor.close, this[STYLER3]);
25043
+ return createBuilder3(this, styler, this[IS_EMPTY3]);
24777
25044
  };
24778
25045
  }
24779
25046
  };
24780
25047
  }
24781
- var proto2 = Object.defineProperties(() => {}, {
24782
- ...styles4,
25048
+ var proto3 = Object.defineProperties(() => {}, {
25049
+ ...styles6,
24783
25050
  level: {
24784
25051
  enumerable: true,
24785
25052
  get() {
24786
- return this[GENERATOR2].level;
25053
+ return this[GENERATOR3].level;
24787
25054
  },
24788
25055
  set(level) {
24789
- this[GENERATOR2].level = level;
25056
+ this[GENERATOR3].level = level;
24790
25057
  }
24791
25058
  }
24792
25059
  });
24793
- var createStyler2 = (open, close, parent) => {
25060
+ var createStyler3 = (open, close, parent) => {
24794
25061
  let openAll;
24795
25062
  let closeAll;
24796
25063
  if (parent === undefined) {
@@ -24808,1400 +25075,1206 @@ var createStyler2 = (open, close, parent) => {
24808
25075
  parent
24809
25076
  };
24810
25077
  };
24811
- var createBuilder2 = (self2, _styler, _isEmpty) => {
24812
- const builder = (...arguments_) => applyStyle2(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
24813
- Object.setPrototypeOf(builder, proto2);
24814
- builder[GENERATOR2] = self2;
24815
- builder[STYLER2] = _styler;
24816
- builder[IS_EMPTY2] = _isEmpty;
25078
+ var createBuilder3 = (self2, _styler, _isEmpty) => {
25079
+ const builder = (...arguments_) => applyStyle3(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
25080
+ Object.setPrototypeOf(builder, proto3);
25081
+ builder[GENERATOR3] = self2;
25082
+ builder[STYLER3] = _styler;
25083
+ builder[IS_EMPTY3] = _isEmpty;
24817
25084
  return builder;
24818
25085
  };
24819
- var applyStyle2 = (self2, string) => {
25086
+ var applyStyle3 = (self2, string) => {
24820
25087
  if (self2.level <= 0 || !string) {
24821
- return self2[IS_EMPTY2] ? "" : string;
25088
+ return self2[IS_EMPTY3] ? "" : string;
24822
25089
  }
24823
- let styler = self2[STYLER2];
25090
+ let styler = self2[STYLER3];
24824
25091
  if (styler === undefined) {
24825
25092
  return string;
24826
25093
  }
24827
25094
  const { openAll, closeAll } = styler;
24828
25095
  if (string.includes("\x1B")) {
24829
25096
  while (styler !== undefined) {
24830
- string = stringReplaceAll2(string, styler.close, styler.open);
25097
+ string = stringReplaceAll3(string, styler.close, styler.open);
24831
25098
  styler = styler.parent;
24832
25099
  }
24833
25100
  }
24834
25101
  const lfIndex = string.indexOf(`
24835
25102
  `);
24836
25103
  if (lfIndex !== -1) {
24837
- string = stringEncaseCRLFWithFirstIndex2(string, closeAll, openAll, lfIndex);
25104
+ string = stringEncaseCRLFWithFirstIndex3(string, closeAll, openAll, lfIndex);
24838
25105
  }
24839
25106
  return openAll + string + closeAll;
24840
25107
  };
24841
- Object.defineProperties(createChalk2.prototype, styles4);
24842
- var chalk2 = createChalk2();
24843
- var chalkStderr2 = createChalk2({ level: stderrColor2 ? stderrColor2.level : 0 });
24844
- var source_default2 = chalk2;
24845
-
24846
- // ../../node_modules/cli-cursor/index.js
24847
- import process6 from "node:process";
24848
-
24849
- // ../../node_modules/restore-cursor/index.js
24850
- import process5 from "node:process";
25108
+ Object.defineProperties(createChalk3.prototype, styles6);
25109
+ var chalk3 = createChalk3();
25110
+ var chalkStderr3 = createChalk3({ level: stderrColor3 ? stderrColor3.level : 0 });
25111
+ var source_default3 = chalk3;
24851
25112
 
24852
- // ../../node_modules/mimic-function/index.js
24853
- var copyProperty = (to, from, property, ignoreNonConfigurable) => {
24854
- if (property === "length" || property === "prototype") {
24855
- return;
24856
- }
24857
- if (property === "arguments" || property === "caller") {
24858
- return;
25113
+ // ../../node_modules/log-symbols/node_modules/is-unicode-supported/index.js
25114
+ import process8 from "node:process";
25115
+ function isUnicodeSupported() {
25116
+ if (process8.platform !== "win32") {
25117
+ return process8.env.TERM !== "linux";
24859
25118
  }
24860
- const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
24861
- const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
24862
- if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
24863
- return;
24864
- }
24865
- Object.defineProperty(to, property, fromDescriptor);
24866
- };
24867
- var canCopyProperty = function(toDescriptor, fromDescriptor) {
24868
- return toDescriptor === undefined || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
24869
- };
24870
- var changePrototype = (to, from) => {
24871
- const fromPrototype = Object.getPrototypeOf(from);
24872
- if (fromPrototype === Object.getPrototypeOf(to)) {
24873
- return;
24874
- }
24875
- Object.setPrototypeOf(to, fromPrototype);
24876
- };
24877
- var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
24878
- ${fromBody}`;
24879
- var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
24880
- var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
24881
- var changeToString = (to, from, name) => {
24882
- const withName = name === "" ? "" : `with ${name.trim()}() `;
24883
- const newToString = wrappedToString.bind(null, withName, from.toString());
24884
- Object.defineProperty(newToString, "name", toStringName);
24885
- const { writable, enumerable, configurable } = toStringDescriptor;
24886
- Object.defineProperty(to, "toString", { value: newToString, writable, enumerable, configurable });
24887
- };
24888
- function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
24889
- const { name } = to;
24890
- for (const property of Reflect.ownKeys(from)) {
24891
- copyProperty(to, from, property, ignoreNonConfigurable);
24892
- }
24893
- changePrototype(to, from);
24894
- changeToString(to, from, name);
24895
- return to;
25119
+ return Boolean(process8.env.CI) || Boolean(process8.env.WT_SESSION) || Boolean(process8.env.TERMINUS_SUBLIME) || process8.env.ConEmuTask === "{cmd::Cmder}" || process8.env.TERM_PROGRAM === "Terminus-Sublime" || process8.env.TERM_PROGRAM === "vscode" || process8.env.TERM === "xterm-256color" || process8.env.TERM === "alacritty" || process8.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
24896
25120
  }
24897
25121
 
24898
- // ../../node_modules/restore-cursor/node_modules/onetime/index.js
24899
- var calledFunctions = new WeakMap;
24900
- var onetime = (function_, options = {}) => {
24901
- if (typeof function_ !== "function") {
24902
- throw new TypeError("Expected a function");
24903
- }
24904
- let returnValue;
24905
- let callCount = 0;
24906
- const functionName = function_.displayName || function_.name || "<anonymous>";
24907
- const onetime2 = function(...arguments_) {
24908
- calledFunctions.set(onetime2, ++callCount);
24909
- if (callCount === 1) {
24910
- returnValue = function_.apply(this, arguments_);
24911
- function_ = undefined;
24912
- } else if (options.throw === true) {
24913
- throw new Error(`Function \`${functionName}\` can only be called once`);
24914
- }
24915
- return returnValue;
24916
- };
24917
- mimicFunction(onetime2, function_);
24918
- calledFunctions.set(onetime2, callCount);
24919
- return onetime2;
25122
+ // ../../node_modules/log-symbols/index.js
25123
+ var main = {
25124
+ info: source_default3.blue("ℹ"),
25125
+ success: source_default3.green(""),
25126
+ warning: source_default3.yellow(""),
25127
+ error: source_default3.red("✖")
24920
25128
  };
24921
- onetime.callCount = (function_) => {
24922
- if (!calledFunctions.has(function_)) {
24923
- throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
24924
- }
24925
- return calledFunctions.get(function_);
25129
+ var fallback = {
25130
+ info: source_default3.blue("i"),
25131
+ success: source_default3.green("√"),
25132
+ warning: source_default3.yellow("‼"),
25133
+ error: source_default3.red("×")
24926
25134
  };
24927
- var onetime_default = onetime;
25135
+ var logSymbols = isUnicodeSupported() ? main : fallback;
25136
+ var log_symbols_default = logSymbols;
24928
25137
 
24929
- // ../../node_modules/restore-cursor/node_modules/signal-exit/dist/mjs/signals.js
24930
- var signals = [];
24931
- signals.push("SIGHUP", "SIGINT", "SIGTERM");
24932
- if (process.platform !== "win32") {
24933
- signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
25138
+ // ../../node_modules/strip-ansi/node_modules/ansi-regex/index.js
25139
+ function ansiRegex({ onlyFirst = false } = {}) {
25140
+ const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
25141
+ const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
25142
+ const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
25143
+ const pattern = `${osc}|${csi}`;
25144
+ return new RegExp(pattern, onlyFirst ? undefined : "g");
24934
25145
  }
24935
- if (process.platform === "linux") {
24936
- signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
25146
+
25147
+ // ../../node_modules/strip-ansi/index.js
25148
+ var regex = ansiRegex();
25149
+ function stripAnsi(string) {
25150
+ if (typeof string !== "string") {
25151
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
25152
+ }
25153
+ return string.replace(regex, "");
24937
25154
  }
24938
25155
 
24939
- // ../../node_modules/restore-cursor/node_modules/signal-exit/dist/mjs/index.js
24940
- var processOk = (process4) => !!process4 && typeof process4 === "object" && typeof process4.removeListener === "function" && typeof process4.emit === "function" && typeof process4.reallyExit === "function" && typeof process4.listeners === "function" && typeof process4.kill === "function" && typeof process4.pid === "number" && typeof process4.on === "function";
24941
- var kExitEmitter = Symbol.for("signal-exit emitter");
24942
- var global2 = globalThis;
24943
- var ObjectDefineProperty = Object.defineProperty.bind(Object);
25156
+ // ../../node_modules/get-east-asian-width/lookup-data.js
25157
+ var ambiguousRanges = [161, 161, 164, 164, 167, 168, 170, 170, 173, 174, 176, 180, 182, 186, 188, 191, 198, 198, 208, 208, 215, 216, 222, 225, 230, 230, 232, 234, 236, 237, 240, 240, 242, 243, 247, 250, 252, 252, 254, 254, 257, 257, 273, 273, 275, 275, 283, 283, 294, 295, 299, 299, 305, 307, 312, 312, 319, 322, 324, 324, 328, 331, 333, 333, 338, 339, 358, 359, 363, 363, 462, 462, 464, 464, 466, 466, 468, 468, 470, 470, 472, 472, 474, 474, 476, 476, 593, 593, 609, 609, 708, 708, 711, 711, 713, 715, 717, 717, 720, 720, 728, 731, 733, 733, 735, 735, 768, 879, 913, 929, 931, 937, 945, 961, 963, 969, 1025, 1025, 1040, 1103, 1105, 1105, 8208, 8208, 8211, 8214, 8216, 8217, 8220, 8221, 8224, 8226, 8228, 8231, 8240, 8240, 8242, 8243, 8245, 8245, 8251, 8251, 8254, 8254, 8308, 8308, 8319, 8319, 8321, 8324, 8364, 8364, 8451, 8451, 8453, 8453, 8457, 8457, 8467, 8467, 8470, 8470, 8481, 8482, 8486, 8486, 8491, 8491, 8531, 8532, 8539, 8542, 8544, 8555, 8560, 8569, 8585, 8585, 8592, 8601, 8632, 8633, 8658, 8658, 8660, 8660, 8679, 8679, 8704, 8704, 8706, 8707, 8711, 8712, 8715, 8715, 8719, 8719, 8721, 8721, 8725, 8725, 8730, 8730, 8733, 8736, 8739, 8739, 8741, 8741, 8743, 8748, 8750, 8750, 8756, 8759, 8764, 8765, 8776, 8776, 8780, 8780, 8786, 8786, 8800, 8801, 8804, 8807, 8810, 8811, 8814, 8815, 8834, 8835, 8838, 8839, 8853, 8853, 8857, 8857, 8869, 8869, 8895, 8895, 8978, 8978, 9312, 9449, 9451, 9547, 9552, 9587, 9600, 9615, 9618, 9621, 9632, 9633, 9635, 9641, 9650, 9651, 9654, 9655, 9660, 9661, 9664, 9665, 9670, 9672, 9675, 9675, 9678, 9681, 9698, 9701, 9711, 9711, 9733, 9734, 9737, 9737, 9742, 9743, 9756, 9756, 9758, 9758, 9792, 9792, 9794, 9794, 9824, 9825, 9827, 9829, 9831, 9834, 9836, 9837, 9839, 9839, 9886, 9887, 9919, 9919, 9926, 9933, 9935, 9939, 9941, 9953, 9955, 9955, 9960, 9961, 9963, 9969, 9972, 9972, 9974, 9977, 9979, 9980, 9982, 9983, 10045, 10045, 10102, 10111, 11094, 11097, 12872, 12879, 57344, 63743, 65024, 65039, 65533, 65533, 127232, 127242, 127248, 127277, 127280, 127337, 127344, 127373, 127375, 127376, 127387, 127404, 917760, 917999, 983040, 1048573, 1048576, 1114109];
25158
+ var fullwidthRanges = [12288, 12288, 65281, 65376, 65504, 65510];
25159
+ var halfwidthRanges = [8361, 8361, 65377, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65512, 65518];
25160
+ var narrowRanges = [32, 126, 162, 163, 165, 166, 172, 172, 175, 175, 10214, 10221, 10629, 10630];
25161
+ var wideRanges = [4352, 4447, 8986, 8987, 9001, 9002, 9193, 9196, 9200, 9200, 9203, 9203, 9725, 9726, 9748, 9749, 9776, 9783, 9800, 9811, 9855, 9855, 9866, 9871, 9875, 9875, 9889, 9889, 9898, 9899, 9917, 9918, 9924, 9925, 9934, 9934, 9940, 9940, 9962, 9962, 9970, 9971, 9973, 9973, 9978, 9978, 9981, 9981, 9989, 9989, 9994, 9995, 10024, 10024, 10060, 10060, 10062, 10062, 10067, 10069, 10071, 10071, 10133, 10135, 10160, 10160, 10175, 10175, 11035, 11036, 11088, 11088, 11093, 11093, 11904, 11929, 11931, 12019, 12032, 12245, 12272, 12287, 12289, 12350, 12353, 12438, 12441, 12543, 12549, 12591, 12593, 12686, 12688, 12773, 12783, 12830, 12832, 12871, 12880, 42124, 42128, 42182, 43360, 43388, 44032, 55203, 63744, 64255, 65040, 65049, 65072, 65106, 65108, 65126, 65128, 65131, 94176, 94180, 94192, 94198, 94208, 101589, 101631, 101662, 101760, 101874, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110882, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110951, 110960, 111355, 119552, 119638, 119648, 119670, 126980, 126980, 127183, 127183, 127374, 127374, 127377, 127386, 127488, 127490, 127504, 127547, 127552, 127560, 127568, 127569, 127584, 127589, 127744, 127776, 127789, 127797, 127799, 127868, 127870, 127891, 127904, 127946, 127951, 127955, 127968, 127984, 127988, 127988, 127992, 128062, 128064, 128064, 128066, 128252, 128255, 128317, 128331, 128334, 128336, 128359, 128378, 128378, 128405, 128406, 128420, 128420, 128507, 128591, 128640, 128709, 128716, 128716, 128720, 128722, 128725, 128728, 128732, 128735, 128747, 128748, 128756, 128764, 128992, 129003, 129008, 129008, 129292, 129338, 129340, 129349, 129351, 129535, 129648, 129660, 129664, 129674, 129678, 129734, 129736, 129736, 129741, 129756, 129759, 129770, 129775, 129784, 131072, 196605, 196608, 262141];
24944
25162
 
24945
- class Emitter {
24946
- emitted = {
24947
- afterExit: false,
24948
- exit: false
24949
- };
24950
- listeners = {
24951
- afterExit: [],
24952
- exit: []
24953
- };
24954
- count = 0;
24955
- id = Math.random();
24956
- constructor() {
24957
- if (global2[kExitEmitter]) {
24958
- return global2[kExitEmitter];
24959
- }
24960
- ObjectDefineProperty(global2, kExitEmitter, {
24961
- value: this,
24962
- writable: false,
24963
- enumerable: false,
24964
- configurable: false
24965
- });
24966
- }
24967
- on(ev, fn) {
24968
- this.listeners[ev].push(fn);
24969
- }
24970
- removeListener(ev, fn) {
24971
- const list = this.listeners[ev];
24972
- const i = list.indexOf(fn);
24973
- if (i === -1) {
24974
- return;
24975
- }
24976
- if (i === 0 && list.length === 1) {
24977
- list.length = 0;
25163
+ // ../../node_modules/get-east-asian-width/utilities.js
25164
+ var isInRange = (ranges, codePoint) => {
25165
+ let low = 0;
25166
+ let high = Math.floor(ranges.length / 2) - 1;
25167
+ while (low <= high) {
25168
+ const mid = Math.floor((low + high) / 2);
25169
+ const i = mid * 2;
25170
+ if (codePoint < ranges[i]) {
25171
+ high = mid - 1;
25172
+ } else if (codePoint > ranges[i + 1]) {
25173
+ low = mid + 1;
24978
25174
  } else {
24979
- list.splice(i, 1);
25175
+ return true;
24980
25176
  }
24981
25177
  }
24982
- emit(ev, code, signal) {
24983
- if (this.emitted[ev]) {
24984
- return false;
24985
- }
24986
- this.emitted[ev] = true;
24987
- let ret = false;
24988
- for (const fn of this.listeners[ev]) {
24989
- ret = fn(code, signal) === true || ret;
25178
+ return false;
25179
+ };
25180
+
25181
+ // ../../node_modules/get-east-asian-width/lookup.js
25182
+ var minimumAmbiguousCodePoint = ambiguousRanges[0];
25183
+ var maximumAmbiguousCodePoint = ambiguousRanges.at(-1);
25184
+ var minimumFullWidthCodePoint = fullwidthRanges[0];
25185
+ var maximumFullWidthCodePoint = fullwidthRanges.at(-1);
25186
+ var minimumHalfWidthCodePoint = halfwidthRanges[0];
25187
+ var maximumHalfWidthCodePoint = halfwidthRanges.at(-1);
25188
+ var minimumNarrowCodePoint = narrowRanges[0];
25189
+ var maximumNarrowCodePoint = narrowRanges.at(-1);
25190
+ var minimumWideCodePoint = wideRanges[0];
25191
+ var maximumWideCodePoint = wideRanges.at(-1);
25192
+ var commonCjkCodePoint = 19968;
25193
+ var [wideFastPathStart, wideFastPathEnd] = findWideFastPathRange(wideRanges);
25194
+ function findWideFastPathRange(ranges) {
25195
+ let fastPathStart = ranges[0];
25196
+ let fastPathEnd = ranges[1];
25197
+ for (let index = 0;index < ranges.length; index += 2) {
25198
+ const start = ranges[index];
25199
+ const end = ranges[index + 1];
25200
+ if (commonCjkCodePoint >= start && commonCjkCodePoint <= end) {
25201
+ return [start, end];
24990
25202
  }
24991
- if (ev === "exit") {
24992
- ret = this.emit("afterExit", code, signal) || ret;
25203
+ if (end - start > fastPathEnd - fastPathStart) {
25204
+ fastPathStart = start;
25205
+ fastPathEnd = end;
24993
25206
  }
24994
- return ret;
24995
25207
  }
25208
+ return [fastPathStart, fastPathEnd];
24996
25209
  }
24997
-
24998
- class SignalExitBase {
24999
- }
25000
- var signalExitWrap = (handler) => {
25001
- return {
25002
- onExit(cb, opts) {
25003
- return handler.onExit(cb, opts);
25004
- },
25005
- load() {
25006
- return handler.load();
25007
- },
25008
- unload() {
25009
- return handler.unload();
25010
- }
25011
- };
25210
+ var isAmbiguous = (codePoint) => {
25211
+ if (codePoint < minimumAmbiguousCodePoint || codePoint > maximumAmbiguousCodePoint) {
25212
+ return false;
25213
+ }
25214
+ return isInRange(ambiguousRanges, codePoint);
25215
+ };
25216
+ var isFullWidth = (codePoint) => {
25217
+ if (codePoint < minimumFullWidthCodePoint || codePoint > maximumFullWidthCodePoint) {
25218
+ return false;
25219
+ }
25220
+ return isInRange(fullwidthRanges, codePoint);
25221
+ };
25222
+ var isWide = (codePoint) => {
25223
+ if (codePoint >= wideFastPathStart && codePoint <= wideFastPathEnd) {
25224
+ return true;
25225
+ }
25226
+ if (codePoint < minimumWideCodePoint || codePoint > maximumWideCodePoint) {
25227
+ return false;
25228
+ }
25229
+ return isInRange(wideRanges, codePoint);
25012
25230
  };
25013
25231
 
25014
- class SignalExitFallback extends SignalExitBase {
25015
- onExit() {
25016
- return () => {};
25232
+ // ../../node_modules/get-east-asian-width/index.js
25233
+ function validate(codePoint) {
25234
+ if (!Number.isSafeInteger(codePoint)) {
25235
+ throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
25017
25236
  }
25018
- load() {}
25019
- unload() {}
25237
+ }
25238
+ function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
25239
+ validate(codePoint);
25240
+ if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
25241
+ return 2;
25242
+ }
25243
+ return 1;
25020
25244
  }
25021
25245
 
25022
- class SignalExit extends SignalExitBase {
25023
- #hupSig = process4.platform === "win32" ? "SIGINT" : "SIGHUP";
25024
- #emitter = new Emitter;
25025
- #process;
25026
- #originalProcessEmit;
25027
- #originalProcessReallyExit;
25028
- #sigListeners = {};
25029
- #loaded = false;
25030
- constructor(process4) {
25031
- super();
25032
- this.#process = process4;
25033
- this.#sigListeners = {};
25034
- for (const sig of signals) {
25035
- this.#sigListeners[sig] = () => {
25036
- const listeners = this.#process.listeners(sig);
25037
- let { count } = this.#emitter;
25038
- const p = process4;
25039
- if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
25040
- count += p.__signal_exit_emitter__.count;
25041
- }
25042
- if (listeners.length === count) {
25043
- this.unload();
25044
- const ret = this.#emitter.emit("exit", null, sig);
25045
- const s = sig === "SIGHUP" ? this.#hupSig : sig;
25046
- if (!ret)
25047
- process4.kill(process4.pid, s);
25048
- }
25049
- };
25050
- }
25051
- this.#originalProcessReallyExit = process4.reallyExit;
25052
- this.#originalProcessEmit = process4.emit;
25246
+ // ../../node_modules/string-width/index.js
25247
+ var import_emoji_regex = __toESM(require_emoji_regex(), 1);
25248
+ var segmenter = new Intl.Segmenter;
25249
+ var defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
25250
+ function stringWidth(string, options = {}) {
25251
+ if (typeof string !== "string" || string.length === 0) {
25252
+ return 0;
25053
25253
  }
25054
- onExit(cb, opts) {
25055
- if (!processOk(this.#process)) {
25056
- return () => {};
25254
+ const {
25255
+ ambiguousIsNarrow = true,
25256
+ countAnsiEscapeCodes = false
25257
+ } = options;
25258
+ if (!countAnsiEscapeCodes) {
25259
+ string = stripAnsi(string);
25260
+ }
25261
+ if (string.length === 0) {
25262
+ return 0;
25263
+ }
25264
+ let width = 0;
25265
+ const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
25266
+ for (const { segment: character } of segmenter.segment(string)) {
25267
+ const codePoint = character.codePointAt(0);
25268
+ if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
25269
+ continue;
25057
25270
  }
25058
- if (this.#loaded === false) {
25059
- this.load();
25271
+ if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
25272
+ continue;
25060
25273
  }
25061
- const ev = opts?.alwaysLast ? "afterExit" : "exit";
25062
- this.#emitter.on(ev, cb);
25063
- return () => {
25064
- this.#emitter.removeListener(ev, cb);
25065
- if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
25066
- this.unload();
25067
- }
25068
- };
25069
- }
25070
- load() {
25071
- if (this.#loaded) {
25072
- return;
25274
+ if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
25275
+ continue;
25073
25276
  }
25074
- this.#loaded = true;
25075
- this.#emitter.count += 1;
25076
- for (const sig of signals) {
25077
- try {
25078
- const fn = this.#sigListeners[sig];
25079
- if (fn)
25080
- this.#process.on(sig, fn);
25081
- } catch (_) {}
25277
+ if (codePoint >= 55296 && codePoint <= 57343) {
25278
+ continue;
25082
25279
  }
25083
- this.#process.emit = (ev, ...a) => {
25084
- return this.#processEmit(ev, ...a);
25085
- };
25086
- this.#process.reallyExit = (code) => {
25087
- return this.#processReallyExit(code);
25088
- };
25089
- }
25090
- unload() {
25091
- if (!this.#loaded) {
25092
- return;
25280
+ if (codePoint >= 65024 && codePoint <= 65039) {
25281
+ continue;
25093
25282
  }
25094
- this.#loaded = false;
25095
- signals.forEach((sig) => {
25096
- const listener = this.#sigListeners[sig];
25097
- if (!listener) {
25098
- throw new Error("Listener not defined for signal: " + sig);
25099
- }
25100
- try {
25101
- this.#process.removeListener(sig, listener);
25102
- } catch (_) {}
25103
- });
25104
- this.#process.emit = this.#originalProcessEmit;
25105
- this.#process.reallyExit = this.#originalProcessReallyExit;
25106
- this.#emitter.count -= 1;
25107
- }
25108
- #processReallyExit(code) {
25109
- if (!processOk(this.#process)) {
25110
- return 0;
25283
+ if (defaultIgnorableCodePointRegex.test(character)) {
25284
+ continue;
25111
25285
  }
25112
- this.#process.exitCode = code || 0;
25113
- this.#emitter.emit("exit", this.#process.exitCode, null);
25114
- return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
25115
- }
25116
- #processEmit(ev, ...args) {
25117
- const og = this.#originalProcessEmit;
25118
- if (ev === "exit" && processOk(this.#process)) {
25119
- if (typeof args[0] === "number") {
25120
- this.#process.exitCode = args[0];
25121
- }
25122
- const ret = og.call(this.#process, ev, ...args);
25123
- this.#emitter.emit("exit", this.#process.exitCode, null);
25124
- return ret;
25125
- } else {
25126
- return og.call(this.#process, ev, ...args);
25286
+ if (import_emoji_regex.default().test(character)) {
25287
+ width += 2;
25288
+ continue;
25127
25289
  }
25290
+ width += eastAsianWidth(codePoint, eastAsianWidthOptions);
25128
25291
  }
25292
+ return width;
25129
25293
  }
25130
- var process4 = globalThis.process;
25131
- var {
25132
- onExit,
25133
- load,
25134
- unload
25135
- } = signalExitWrap(processOk(process4) ? new SignalExit(process4) : new SignalExitFallback);
25136
25294
 
25137
- // ../../node_modules/restore-cursor/index.js
25138
- var terminal = process5.stderr.isTTY ? process5.stderr : process5.stdout.isTTY ? process5.stdout : undefined;
25139
- var restoreCursor = terminal ? onetime_default(() => {
25140
- onExit(() => {
25141
- terminal.write("\x1B[?25h");
25142
- }, { alwaysLast: true });
25143
- }) : () => {};
25144
- var restore_cursor_default = restoreCursor;
25295
+ // ../../node_modules/is-interactive/index.js
25296
+ function isInteractive({ stream: stream4 = process.stdout } = {}) {
25297
+ return Boolean(stream4 && stream4.isTTY && process.env.TERM !== "dumb" && !("CI" in process.env));
25298
+ }
25145
25299
 
25146
- // ../../node_modules/cli-cursor/index.js
25147
- var isHidden = false;
25148
- var cliCursor = {};
25149
- cliCursor.show = (writableStream = process6.stderr) => {
25150
- if (!writableStream.isTTY) {
25151
- return;
25300
+ // ../../node_modules/is-unicode-supported/index.js
25301
+ import process9 from "node:process";
25302
+ function isUnicodeSupported2() {
25303
+ const { env: env4 } = process9;
25304
+ const { TERM, TERM_PROGRAM } = env4;
25305
+ if (process9.platform !== "win32") {
25306
+ return TERM !== "linux";
25152
25307
  }
25153
- isHidden = false;
25154
- writableStream.write("\x1B[?25h");
25155
- };
25156
- cliCursor.hide = (writableStream = process6.stderr) => {
25157
- if (!writableStream.isTTY) {
25158
- return;
25308
+ return Boolean(env4.WT_SESSION) || Boolean(env4.TERMINUS_SUBLIME) || env4.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env4.TERMINAL_EMULATOR === "JetBrains-JediTerm";
25309
+ }
25310
+
25311
+ // ../../node_modules/stdin-discarder/index.js
25312
+ import process10 from "node:process";
25313
+ var ASCII_ETX_CODE = 3;
25314
+
25315
+ class StdinDiscarder {
25316
+ #activeCount = 0;
25317
+ start() {
25318
+ this.#activeCount++;
25319
+ if (this.#activeCount === 1) {
25320
+ this.#realStart();
25321
+ }
25159
25322
  }
25160
- restore_cursor_default();
25161
- isHidden = true;
25162
- writableStream.write("\x1B[?25l");
25163
- };
25164
- cliCursor.toggle = (force, writableStream) => {
25165
- if (force !== undefined) {
25166
- isHidden = force;
25323
+ stop() {
25324
+ if (this.#activeCount <= 0) {
25325
+ throw new Error("`stop` called more times than `start`");
25326
+ }
25327
+ this.#activeCount--;
25328
+ if (this.#activeCount === 0) {
25329
+ this.#realStop();
25330
+ }
25167
25331
  }
25168
- if (isHidden) {
25169
- cliCursor.show(writableStream);
25170
- } else {
25171
- cliCursor.hide(writableStream);
25332
+ #realStart() {
25333
+ if (process10.platform === "win32" || !process10.stdin.isTTY) {
25334
+ return;
25335
+ }
25336
+ process10.stdin.setRawMode(true);
25337
+ process10.stdin.on("data", this.#handleInput);
25338
+ process10.stdin.resume();
25172
25339
  }
25173
- };
25174
- var cli_cursor_default = cliCursor;
25340
+ #realStop() {
25341
+ if (!process10.stdin.isTTY) {
25342
+ return;
25343
+ }
25344
+ process10.stdin.off("data", this.#handleInput);
25345
+ process10.stdin.pause();
25346
+ process10.stdin.setRawMode(false);
25347
+ }
25348
+ #handleInput(chunk) {
25349
+ if (chunk[0] === ASCII_ETX_CODE) {
25350
+ process10.emit("SIGINT");
25351
+ }
25352
+ }
25353
+ }
25354
+ var stdinDiscarder = new StdinDiscarder;
25355
+ var stdin_discarder_default = stdinDiscarder;
25175
25356
 
25176
25357
  // ../../node_modules/ora/index.js
25177
- var import_cli_spinners = __toESM(require_cli_spinners(), 1);
25358
+ var import_cli_spinners2 = __toESM(require_cli_spinners(), 1);
25178
25359
 
25179
- // ../../node_modules/log-symbols/node_modules/chalk/source/vendor/ansi-styles/index.js
25180
- var ANSI_BACKGROUND_OFFSET3 = 10;
25181
- var wrapAnsi163 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
25182
- var wrapAnsi2563 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
25183
- var wrapAnsi16m3 = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
25184
- var styles5 = {
25185
- modifier: {
25186
- reset: [0, 0],
25187
- bold: [1, 22],
25188
- dim: [2, 22],
25189
- italic: [3, 23],
25190
- underline: [4, 24],
25191
- overline: [53, 55],
25192
- inverse: [7, 27],
25193
- hidden: [8, 28],
25194
- strikethrough: [9, 29]
25195
- },
25196
- color: {
25197
- black: [30, 39],
25198
- red: [31, 39],
25199
- green: [32, 39],
25200
- yellow: [33, 39],
25201
- blue: [34, 39],
25202
- magenta: [35, 39],
25203
- cyan: [36, 39],
25204
- white: [37, 39],
25205
- blackBright: [90, 39],
25206
- gray: [90, 39],
25207
- grey: [90, 39],
25208
- redBright: [91, 39],
25209
- greenBright: [92, 39],
25210
- yellowBright: [93, 39],
25211
- blueBright: [94, 39],
25212
- magentaBright: [95, 39],
25213
- cyanBright: [96, 39],
25214
- whiteBright: [97, 39]
25215
- },
25216
- bgColor: {
25217
- bgBlack: [40, 49],
25218
- bgRed: [41, 49],
25219
- bgGreen: [42, 49],
25220
- bgYellow: [43, 49],
25221
- bgBlue: [44, 49],
25222
- bgMagenta: [45, 49],
25223
- bgCyan: [46, 49],
25224
- bgWhite: [47, 49],
25225
- bgBlackBright: [100, 49],
25226
- bgGray: [100, 49],
25227
- bgGrey: [100, 49],
25228
- bgRedBright: [101, 49],
25229
- bgGreenBright: [102, 49],
25230
- bgYellowBright: [103, 49],
25231
- bgBlueBright: [104, 49],
25232
- bgMagentaBright: [105, 49],
25233
- bgCyanBright: [106, 49],
25234
- bgWhiteBright: [107, 49]
25235
- }
25236
- };
25237
- var modifierNames3 = Object.keys(styles5.modifier);
25238
- var foregroundColorNames3 = Object.keys(styles5.color);
25239
- var backgroundColorNames3 = Object.keys(styles5.bgColor);
25240
- var colorNames3 = [...foregroundColorNames3, ...backgroundColorNames3];
25241
- function assembleStyles3() {
25242
- const codes = new Map;
25243
- for (const [groupName, group] of Object.entries(styles5)) {
25244
- for (const [styleName, style] of Object.entries(group)) {
25245
- styles5[styleName] = {
25246
- open: `\x1B[${style[0]}m`,
25247
- close: `\x1B[${style[1]}m`
25360
+ class Ora {
25361
+ #linesToClear = 0;
25362
+ #isDiscardingStdin = false;
25363
+ #lineCount = 0;
25364
+ #frameIndex = -1;
25365
+ #lastSpinnerFrameTime = 0;
25366
+ #options;
25367
+ #spinner;
25368
+ #stream;
25369
+ #id;
25370
+ #initialInterval;
25371
+ #isEnabled;
25372
+ #isSilent;
25373
+ #indent;
25374
+ #text;
25375
+ #prefixText;
25376
+ #suffixText;
25377
+ color;
25378
+ constructor(options) {
25379
+ if (typeof options === "string") {
25380
+ options = {
25381
+ text: options
25248
25382
  };
25249
- group[styleName] = styles5[styleName];
25250
- codes.set(style[0], style[1]);
25251
25383
  }
25252
- Object.defineProperty(styles5, groupName, {
25253
- value: group,
25254
- enumerable: false
25255
- });
25256
- }
25257
- Object.defineProperty(styles5, "codes", {
25258
- value: codes,
25259
- enumerable: false
25260
- });
25261
- styles5.color.close = "\x1B[39m";
25262
- styles5.bgColor.close = "\x1B[49m";
25263
- styles5.color.ansi = wrapAnsi163();
25264
- styles5.color.ansi256 = wrapAnsi2563();
25265
- styles5.color.ansi16m = wrapAnsi16m3();
25266
- styles5.bgColor.ansi = wrapAnsi163(ANSI_BACKGROUND_OFFSET3);
25267
- styles5.bgColor.ansi256 = wrapAnsi2563(ANSI_BACKGROUND_OFFSET3);
25268
- styles5.bgColor.ansi16m = wrapAnsi16m3(ANSI_BACKGROUND_OFFSET3);
25269
- Object.defineProperties(styles5, {
25270
- rgbToAnsi256: {
25271
- value(red, green, blue) {
25272
- if (red === green && green === blue) {
25273
- if (red < 8) {
25274
- return 16;
25275
- }
25276
- if (red > 248) {
25277
- return 231;
25278
- }
25279
- return Math.round((red - 8) / 247 * 24) + 232;
25280
- }
25281
- return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
25282
- },
25283
- enumerable: false
25284
- },
25285
- hexToRgb: {
25286
- value(hex) {
25287
- const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
25288
- if (!matches) {
25289
- return [0, 0, 0];
25290
- }
25291
- let [colorString] = matches;
25292
- if (colorString.length === 3) {
25293
- colorString = [...colorString].map((character) => character + character).join("");
25294
- }
25295
- const integer = Number.parseInt(colorString, 16);
25296
- return [
25297
- integer >> 16 & 255,
25298
- integer >> 8 & 255,
25299
- integer & 255
25300
- ];
25301
- },
25302
- enumerable: false
25303
- },
25304
- hexToAnsi256: {
25305
- value: (hex) => styles5.rgbToAnsi256(...styles5.hexToRgb(hex)),
25306
- enumerable: false
25307
- },
25308
- ansi256ToAnsi: {
25309
- value(code) {
25310
- if (code < 8) {
25311
- return 30 + code;
25312
- }
25313
- if (code < 16) {
25314
- return 90 + (code - 8);
25315
- }
25316
- let red;
25317
- let green;
25318
- let blue;
25319
- if (code >= 232) {
25320
- red = ((code - 232) * 10 + 8) / 255;
25321
- green = red;
25322
- blue = red;
25323
- } else {
25324
- code -= 16;
25325
- const remainder = code % 36;
25326
- red = Math.floor(code / 36) / 5;
25327
- green = Math.floor(remainder / 6) / 5;
25328
- blue = remainder % 6 / 5;
25384
+ this.#options = {
25385
+ color: "cyan",
25386
+ stream: process11.stderr,
25387
+ discardStdin: true,
25388
+ hideCursor: true,
25389
+ ...options
25390
+ };
25391
+ this.color = this.#options.color;
25392
+ this.spinner = this.#options.spinner;
25393
+ this.#initialInterval = this.#options.interval;
25394
+ this.#stream = this.#options.stream;
25395
+ this.#isEnabled = typeof this.#options.isEnabled === "boolean" ? this.#options.isEnabled : isInteractive({ stream: this.#stream });
25396
+ this.#isSilent = typeof this.#options.isSilent === "boolean" ? this.#options.isSilent : false;
25397
+ this.text = this.#options.text;
25398
+ this.prefixText = this.#options.prefixText;
25399
+ this.suffixText = this.#options.suffixText;
25400
+ this.indent = this.#options.indent;
25401
+ if (process11.env.NODE_ENV === "test") {
25402
+ this._stream = this.#stream;
25403
+ this._isEnabled = this.#isEnabled;
25404
+ Object.defineProperty(this, "_linesToClear", {
25405
+ get() {
25406
+ return this.#linesToClear;
25407
+ },
25408
+ set(newValue) {
25409
+ this.#linesToClear = newValue;
25329
25410
  }
25330
- const value = Math.max(red, green, blue) * 2;
25331
- if (value === 0) {
25332
- return 30;
25411
+ });
25412
+ Object.defineProperty(this, "_frameIndex", {
25413
+ get() {
25414
+ return this.#frameIndex;
25333
25415
  }
25334
- let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
25335
- if (value === 2) {
25336
- result += 60;
25416
+ });
25417
+ Object.defineProperty(this, "_lineCount", {
25418
+ get() {
25419
+ return this.#lineCount;
25337
25420
  }
25338
- return result;
25339
- },
25340
- enumerable: false
25341
- },
25342
- rgbToAnsi: {
25343
- value: (red, green, blue) => styles5.ansi256ToAnsi(styles5.rgbToAnsi256(red, green, blue)),
25344
- enumerable: false
25345
- },
25346
- hexToAnsi: {
25347
- value: (hex) => styles5.ansi256ToAnsi(styles5.hexToAnsi256(hex)),
25348
- enumerable: false
25349
- }
25350
- });
25351
- return styles5;
25352
- }
25353
- var ansiStyles3 = assembleStyles3();
25354
- var ansi_styles_default3 = ansiStyles3;
25355
-
25356
- // ../../node_modules/log-symbols/node_modules/chalk/source/vendor/supports-color/index.js
25357
- import process7 from "node:process";
25358
- import os4 from "node:os";
25359
- import tty3 from "node:tty";
25360
- function hasFlag3(flag, argv = globalThis.Deno ? globalThis.Deno.args : process7.argv) {
25361
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
25362
- const position = argv.indexOf(prefix + flag);
25363
- const terminatorPosition = argv.indexOf("--");
25364
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
25365
- }
25366
- var { env: env3 } = process7;
25367
- var flagForceColor3;
25368
- if (hasFlag3("no-color") || hasFlag3("no-colors") || hasFlag3("color=false") || hasFlag3("color=never")) {
25369
- flagForceColor3 = 0;
25370
- } else if (hasFlag3("color") || hasFlag3("colors") || hasFlag3("color=true") || hasFlag3("color=always")) {
25371
- flagForceColor3 = 1;
25372
- }
25373
- function envForceColor3() {
25374
- if ("FORCE_COLOR" in env3) {
25375
- if (env3.FORCE_COLOR === "true") {
25376
- return 1;
25377
- }
25378
- if (env3.FORCE_COLOR === "false") {
25379
- return 0;
25421
+ });
25380
25422
  }
25381
- return env3.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env3.FORCE_COLOR, 10), 3);
25382
- }
25383
- }
25384
- function translateLevel3(level) {
25385
- if (level === 0) {
25386
- return false;
25387
- }
25388
- return {
25389
- level,
25390
- hasBasic: true,
25391
- has256: level >= 2,
25392
- has16m: level >= 3
25393
- };
25394
- }
25395
- function _supportsColor3(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
25396
- const noFlagForceColor = envForceColor3();
25397
- if (noFlagForceColor !== undefined) {
25398
- flagForceColor3 = noFlagForceColor;
25399
25423
  }
25400
- const forceColor = sniffFlags ? flagForceColor3 : noFlagForceColor;
25401
- if (forceColor === 0) {
25402
- return 0;
25424
+ get indent() {
25425
+ return this.#indent;
25403
25426
  }
25404
- if (sniffFlags) {
25405
- if (hasFlag3("color=16m") || hasFlag3("color=full") || hasFlag3("color=truecolor")) {
25406
- return 3;
25407
- }
25408
- if (hasFlag3("color=256")) {
25409
- return 2;
25427
+ set indent(indent = 0) {
25428
+ if (!(indent >= 0 && Number.isInteger(indent))) {
25429
+ throw new Error("The `indent` option must be an integer from 0 and up");
25410
25430
  }
25431
+ this.#indent = indent;
25432
+ this.#updateLineCount();
25411
25433
  }
25412
- if ("TF_BUILD" in env3 && "AGENT_NAME" in env3) {
25413
- return 1;
25434
+ get interval() {
25435
+ return this.#initialInterval ?? this.#spinner.interval ?? 100;
25414
25436
  }
25415
- if (haveStream && !streamIsTTY && forceColor === undefined) {
25416
- return 0;
25417
- }
25418
- const min = forceColor || 0;
25419
- if (env3.TERM === "dumb") {
25420
- return min;
25437
+ get spinner() {
25438
+ return this.#spinner;
25421
25439
  }
25422
- if (process7.platform === "win32") {
25423
- const osRelease = os4.release().split(".");
25424
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
25425
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
25440
+ set spinner(spinner) {
25441
+ this.#frameIndex = -1;
25442
+ this.#initialInterval = undefined;
25443
+ if (typeof spinner === "object") {
25444
+ if (spinner.frames === undefined) {
25445
+ throw new Error("The given spinner must have a `frames` property");
25446
+ }
25447
+ this.#spinner = spinner;
25448
+ } else if (!isUnicodeSupported2()) {
25449
+ this.#spinner = import_cli_spinners.default.line;
25450
+ } else if (spinner === undefined) {
25451
+ this.#spinner = import_cli_spinners.default.dots;
25452
+ } else if (spinner !== "default" && import_cli_spinners.default[spinner]) {
25453
+ this.#spinner = import_cli_spinners.default[spinner];
25454
+ } else {
25455
+ throw new Error(`There is no built-in spinner named '${spinner}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`);
25426
25456
  }
25427
- return 1;
25428
25457
  }
25429
- if ("CI" in env3) {
25430
- if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => (key in env3))) {
25431
- return 3;
25432
- }
25433
- if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => (sign in env3)) || env3.CI_NAME === "codeship") {
25434
- return 1;
25435
- }
25436
- return min;
25458
+ get text() {
25459
+ return this.#text;
25437
25460
  }
25438
- if ("TEAMCITY_VERSION" in env3) {
25439
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env3.TEAMCITY_VERSION) ? 1 : 0;
25461
+ set text(value = "") {
25462
+ this.#text = value;
25463
+ this.#updateLineCount();
25440
25464
  }
25441
- if (env3.COLORTERM === "truecolor") {
25442
- return 3;
25465
+ get prefixText() {
25466
+ return this.#prefixText;
25443
25467
  }
25444
- if (env3.TERM === "xterm-kitty") {
25445
- return 3;
25468
+ set prefixText(value = "") {
25469
+ this.#prefixText = value;
25470
+ this.#updateLineCount();
25446
25471
  }
25447
- if (env3.TERM === "xterm-ghostty") {
25448
- return 3;
25472
+ get suffixText() {
25473
+ return this.#suffixText;
25449
25474
  }
25450
- if (env3.TERM === "wezterm") {
25451
- return 3;
25475
+ set suffixText(value = "") {
25476
+ this.#suffixText = value;
25477
+ this.#updateLineCount();
25452
25478
  }
25453
- if ("TERM_PROGRAM" in env3) {
25454
- const version = Number.parseInt((env3.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
25455
- switch (env3.TERM_PROGRAM) {
25456
- case "iTerm.app": {
25457
- return version >= 3 ? 3 : 2;
25458
- }
25459
- case "Apple_Terminal": {
25460
- return 2;
25461
- }
25479
+ get isSpinning() {
25480
+ return this.#id !== undefined;
25481
+ }
25482
+ #getFullPrefixText(prefixText = this.#prefixText, postfix = " ") {
25483
+ if (typeof prefixText === "string" && prefixText !== "") {
25484
+ return prefixText + postfix;
25485
+ }
25486
+ if (typeof prefixText === "function") {
25487
+ return prefixText() + postfix;
25462
25488
  }
25489
+ return "";
25463
25490
  }
25464
- if (/-256(color)?$/i.test(env3.TERM)) {
25465
- return 2;
25491
+ #getFullSuffixText(suffixText = this.#suffixText, prefix = " ") {
25492
+ if (typeof suffixText === "string" && suffixText !== "") {
25493
+ return prefix + suffixText;
25494
+ }
25495
+ if (typeof suffixText === "function") {
25496
+ return prefix + suffixText();
25497
+ }
25498
+ return "";
25466
25499
  }
25467
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env3.TERM)) {
25468
- return 1;
25500
+ #updateLineCount() {
25501
+ const columns = this.#stream.columns ?? 80;
25502
+ const fullPrefixText = this.#getFullPrefixText(this.#prefixText, "-");
25503
+ const fullSuffixText = this.#getFullSuffixText(this.#suffixText, "-");
25504
+ const fullText = " ".repeat(this.#indent) + fullPrefixText + "--" + this.#text + "--" + fullSuffixText;
25505
+ this.#lineCount = 0;
25506
+ for (const line of stripAnsi(fullText).split(`
25507
+ `)) {
25508
+ this.#lineCount += Math.max(1, Math.ceil(stringWidth(line, { countAnsiEscapeCodes: true }) / columns));
25509
+ }
25469
25510
  }
25470
- if ("COLORTERM" in env3) {
25471
- return 1;
25511
+ get isEnabled() {
25512
+ return this.#isEnabled && !this.#isSilent;
25472
25513
  }
25473
- return min;
25474
- }
25475
- function createSupportsColor3(stream4, options = {}) {
25476
- const level = _supportsColor3(stream4, {
25477
- streamIsTTY: stream4 && stream4.isTTY,
25478
- ...options
25479
- });
25480
- return translateLevel3(level);
25481
- }
25482
- var supportsColor3 = {
25483
- stdout: createSupportsColor3({ isTTY: tty3.isatty(1) }),
25484
- stderr: createSupportsColor3({ isTTY: tty3.isatty(2) })
25485
- };
25486
- var supports_color_default3 = supportsColor3;
25487
-
25488
- // ../../node_modules/log-symbols/node_modules/chalk/source/utilities.js
25489
- function stringReplaceAll3(string, substring, replacer) {
25490
- let index = string.indexOf(substring);
25491
- if (index === -1) {
25492
- return string;
25514
+ set isEnabled(value) {
25515
+ if (typeof value !== "boolean") {
25516
+ throw new TypeError("The `isEnabled` option must be a boolean");
25517
+ }
25518
+ this.#isEnabled = value;
25493
25519
  }
25494
- const substringLength = substring.length;
25495
- let endIndex = 0;
25496
- let returnValue = "";
25497
- do {
25498
- returnValue += string.slice(endIndex, index) + substring + replacer;
25499
- endIndex = index + substringLength;
25500
- index = string.indexOf(substring, endIndex);
25501
- } while (index !== -1);
25502
- returnValue += string.slice(endIndex);
25503
- return returnValue;
25504
- }
25505
- function stringEncaseCRLFWithFirstIndex3(string, prefix, postfix, index) {
25506
- let endIndex = 0;
25507
- let returnValue = "";
25508
- do {
25509
- const gotCR = string[index - 1] === "\r";
25510
- returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? `\r
25511
- ` : `
25512
- `) + postfix;
25513
- endIndex = index + 1;
25514
- index = string.indexOf(`
25515
- `, endIndex);
25516
- } while (index !== -1);
25517
- returnValue += string.slice(endIndex);
25518
- return returnValue;
25519
- }
25520
-
25521
- // ../../node_modules/log-symbols/node_modules/chalk/source/index.js
25522
- var { stdout: stdoutColor3, stderr: stderrColor3 } = supports_color_default3;
25523
- var GENERATOR3 = Symbol("GENERATOR");
25524
- var STYLER3 = Symbol("STYLER");
25525
- var IS_EMPTY3 = Symbol("IS_EMPTY");
25526
- var levelMapping3 = [
25527
- "ansi",
25528
- "ansi",
25529
- "ansi256",
25530
- "ansi16m"
25531
- ];
25532
- var styles6 = Object.create(null);
25533
- var applyOptions3 = (object, options = {}) => {
25534
- if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
25535
- throw new Error("The `level` option should be an integer from 0 to 3");
25520
+ get isSilent() {
25521
+ return this.#isSilent;
25536
25522
  }
25537
- const colorLevel = stdoutColor3 ? stdoutColor3.level : 0;
25538
- object.level = options.level === undefined ? colorLevel : options.level;
25539
- };
25540
- var chalkFactory3 = (options) => {
25541
- const chalk3 = (...strings) => strings.join(" ");
25542
- applyOptions3(chalk3, options);
25543
- Object.setPrototypeOf(chalk3, createChalk3.prototype);
25544
- return chalk3;
25545
- };
25546
- function createChalk3(options) {
25547
- return chalkFactory3(options);
25548
- }
25549
- Object.setPrototypeOf(createChalk3.prototype, Function.prototype);
25550
- for (const [styleName, style] of Object.entries(ansi_styles_default3)) {
25551
- styles6[styleName] = {
25552
- get() {
25553
- const builder = createBuilder3(this, createStyler3(style.open, style.close, this[STYLER3]), this[IS_EMPTY3]);
25554
- Object.defineProperty(this, styleName, { value: builder });
25555
- return builder;
25523
+ set isSilent(value) {
25524
+ if (typeof value !== "boolean") {
25525
+ throw new TypeError("The `isSilent` option must be a boolean");
25556
25526
  }
25557
- };
25558
- }
25559
- styles6.visible = {
25560
- get() {
25561
- const builder = createBuilder3(this, this[STYLER3], true);
25562
- Object.defineProperty(this, "visible", { value: builder });
25563
- return builder;
25527
+ this.#isSilent = value;
25564
25528
  }
25565
- };
25566
- var getModelAnsi3 = (model, level, type, ...arguments_) => {
25567
- if (model === "rgb") {
25568
- if (level === "ansi16m") {
25569
- return ansi_styles_default3[type].ansi16m(...arguments_);
25529
+ frame() {
25530
+ const now = Date.now();
25531
+ if (this.#frameIndex === -1 || now - this.#lastSpinnerFrameTime >= this.interval) {
25532
+ this.#frameIndex = ++this.#frameIndex % this.#spinner.frames.length;
25533
+ this.#lastSpinnerFrameTime = now;
25570
25534
  }
25571
- if (level === "ansi256") {
25572
- return ansi_styles_default3[type].ansi256(ansi_styles_default3.rgbToAnsi256(...arguments_));
25535
+ const { frames } = this.#spinner;
25536
+ let frame = frames[this.#frameIndex];
25537
+ if (this.color) {
25538
+ frame = source_default2[this.color](frame);
25573
25539
  }
25574
- return ansi_styles_default3[type].ansi(ansi_styles_default3.rgbToAnsi(...arguments_));
25575
- }
25576
- if (model === "hex") {
25577
- return getModelAnsi3("rgb", level, type, ...ansi_styles_default3.hexToRgb(...arguments_));
25540
+ const fullPrefixText = typeof this.#prefixText === "string" && this.#prefixText !== "" ? this.#prefixText + " " : "";
25541
+ const fullText = typeof this.text === "string" ? " " + this.text : "";
25542
+ const fullSuffixText = typeof this.#suffixText === "string" && this.#suffixText !== "" ? " " + this.#suffixText : "";
25543
+ return fullPrefixText + frame + fullText + fullSuffixText;
25578
25544
  }
25579
- return ansi_styles_default3[type][model](...arguments_);
25580
- };
25581
- var usedModels3 = ["rgb", "hex", "ansi256"];
25582
- for (const model of usedModels3) {
25583
- styles6[model] = {
25584
- get() {
25585
- const { level } = this;
25586
- return function(...arguments_) {
25587
- const styler = createStyler3(getModelAnsi3(model, levelMapping3[level], "color", ...arguments_), ansi_styles_default3.color.close, this[STYLER3]);
25588
- return createBuilder3(this, styler, this[IS_EMPTY3]);
25589
- };
25590
- }
25591
- };
25592
- const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
25593
- styles6[bgModel] = {
25594
- get() {
25595
- const { level } = this;
25596
- return function(...arguments_) {
25597
- const styler = createStyler3(getModelAnsi3(model, levelMapping3[level], "bgColor", ...arguments_), ansi_styles_default3.bgColor.close, this[STYLER3]);
25598
- return createBuilder3(this, styler, this[IS_EMPTY3]);
25599
- };
25545
+ clear() {
25546
+ if (!this.#isEnabled || !this.#stream.isTTY) {
25547
+ return this;
25600
25548
  }
25601
- };
25602
- }
25603
- var proto3 = Object.defineProperties(() => {}, {
25604
- ...styles6,
25605
- level: {
25606
- enumerable: true,
25607
- get() {
25608
- return this[GENERATOR3].level;
25609
- },
25610
- set(level) {
25611
- this[GENERATOR3].level = level;
25549
+ this.#stream.cursorTo(0);
25550
+ for (let index = 0;index < this.#linesToClear; index++) {
25551
+ if (index > 0) {
25552
+ this.#stream.moveCursor(0, -1);
25553
+ }
25554
+ this.#stream.clearLine(1);
25612
25555
  }
25556
+ if (this.#indent || this.lastIndent !== this.#indent) {
25557
+ this.#stream.cursorTo(this.#indent);
25558
+ }
25559
+ this.lastIndent = this.#indent;
25560
+ this.#linesToClear = 0;
25561
+ return this;
25613
25562
  }
25614
- });
25615
- var createStyler3 = (open, close, parent) => {
25616
- let openAll;
25617
- let closeAll;
25618
- if (parent === undefined) {
25619
- openAll = open;
25620
- closeAll = close;
25621
- } else {
25622
- openAll = parent.openAll + open;
25623
- closeAll = close + parent.closeAll;
25624
- }
25625
- return {
25626
- open,
25627
- close,
25628
- openAll,
25629
- closeAll,
25630
- parent
25631
- };
25632
- };
25633
- var createBuilder3 = (self2, _styler, _isEmpty) => {
25634
- const builder = (...arguments_) => applyStyle3(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
25635
- Object.setPrototypeOf(builder, proto3);
25636
- builder[GENERATOR3] = self2;
25637
- builder[STYLER3] = _styler;
25638
- builder[IS_EMPTY3] = _isEmpty;
25639
- return builder;
25640
- };
25641
- var applyStyle3 = (self2, string) => {
25642
- if (self2.level <= 0 || !string) {
25643
- return self2[IS_EMPTY3] ? "" : string;
25644
- }
25645
- let styler = self2[STYLER3];
25646
- if (styler === undefined) {
25647
- return string;
25648
- }
25649
- const { openAll, closeAll } = styler;
25650
- if (string.includes("\x1B")) {
25651
- while (styler !== undefined) {
25652
- string = stringReplaceAll3(string, styler.close, styler.open);
25653
- styler = styler.parent;
25563
+ render() {
25564
+ if (this.#isSilent) {
25565
+ return this;
25654
25566
  }
25567
+ this.clear();
25568
+ this.#stream.write(this.frame());
25569
+ this.#linesToClear = this.#lineCount;
25570
+ return this;
25655
25571
  }
25656
- const lfIndex = string.indexOf(`
25572
+ start(text) {
25573
+ if (text) {
25574
+ this.text = text;
25575
+ }
25576
+ if (this.#isSilent) {
25577
+ return this;
25578
+ }
25579
+ if (!this.#isEnabled) {
25580
+ if (this.text) {
25581
+ this.#stream.write(`- ${this.text}
25657
25582
  `);
25658
- if (lfIndex !== -1) {
25659
- string = stringEncaseCRLFWithFirstIndex3(string, closeAll, openAll, lfIndex);
25660
- }
25661
- return openAll + string + closeAll;
25662
- };
25663
- Object.defineProperties(createChalk3.prototype, styles6);
25664
- var chalk3 = createChalk3();
25665
- var chalkStderr3 = createChalk3({ level: stderrColor3 ? stderrColor3.level : 0 });
25666
- var source_default3 = chalk3;
25667
-
25668
- // ../../node_modules/log-symbols/node_modules/is-unicode-supported/index.js
25669
- import process8 from "node:process";
25670
- function isUnicodeSupported() {
25671
- if (process8.platform !== "win32") {
25672
- return process8.env.TERM !== "linux";
25673
- }
25674
- return Boolean(process8.env.CI) || Boolean(process8.env.WT_SESSION) || Boolean(process8.env.TERMINUS_SUBLIME) || process8.env.ConEmuTask === "{cmd::Cmder}" || process8.env.TERM_PROGRAM === "Terminus-Sublime" || process8.env.TERM_PROGRAM === "vscode" || process8.env.TERM === "xterm-256color" || process8.env.TERM === "alacritty" || process8.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
25675
- }
25676
-
25677
- // ../../node_modules/log-symbols/index.js
25678
- var main = {
25679
- info: source_default3.blue("ℹ"),
25680
- success: source_default3.green("✔"),
25681
- warning: source_default3.yellow("⚠"),
25682
- error: source_default3.red("✖")
25683
- };
25684
- var fallback = {
25685
- info: source_default3.blue("i"),
25686
- success: source_default3.green("√"),
25687
- warning: source_default3.yellow("‼"),
25688
- error: source_default3.red("×")
25689
- };
25690
- var logSymbols = isUnicodeSupported() ? main : fallback;
25691
- var log_symbols_default = logSymbols;
25692
-
25693
- // ../../node_modules/strip-ansi/node_modules/ansi-regex/index.js
25694
- function ansiRegex({ onlyFirst = false } = {}) {
25695
- const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
25696
- const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
25697
- const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
25698
- const pattern = `${osc}|${csi}`;
25699
- return new RegExp(pattern, onlyFirst ? undefined : "g");
25700
- }
25701
-
25702
- // ../../node_modules/strip-ansi/index.js
25703
- var regex = ansiRegex();
25704
- function stripAnsi(string) {
25705
- if (typeof string !== "string") {
25706
- throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
25707
- }
25708
- return string.replace(regex, "");
25709
- }
25710
-
25711
- // ../../node_modules/get-east-asian-width/lookup-data.js
25712
- var ambiguousRanges = [161, 161, 164, 164, 167, 168, 170, 170, 173, 174, 176, 180, 182, 186, 188, 191, 198, 198, 208, 208, 215, 216, 222, 225, 230, 230, 232, 234, 236, 237, 240, 240, 242, 243, 247, 250, 252, 252, 254, 254, 257, 257, 273, 273, 275, 275, 283, 283, 294, 295, 299, 299, 305, 307, 312, 312, 319, 322, 324, 324, 328, 331, 333, 333, 338, 339, 358, 359, 363, 363, 462, 462, 464, 464, 466, 466, 468, 468, 470, 470, 472, 472, 474, 474, 476, 476, 593, 593, 609, 609, 708, 708, 711, 711, 713, 715, 717, 717, 720, 720, 728, 731, 733, 733, 735, 735, 768, 879, 913, 929, 931, 937, 945, 961, 963, 969, 1025, 1025, 1040, 1103, 1105, 1105, 8208, 8208, 8211, 8214, 8216, 8217, 8220, 8221, 8224, 8226, 8228, 8231, 8240, 8240, 8242, 8243, 8245, 8245, 8251, 8251, 8254, 8254, 8308, 8308, 8319, 8319, 8321, 8324, 8364, 8364, 8451, 8451, 8453, 8453, 8457, 8457, 8467, 8467, 8470, 8470, 8481, 8482, 8486, 8486, 8491, 8491, 8531, 8532, 8539, 8542, 8544, 8555, 8560, 8569, 8585, 8585, 8592, 8601, 8632, 8633, 8658, 8658, 8660, 8660, 8679, 8679, 8704, 8704, 8706, 8707, 8711, 8712, 8715, 8715, 8719, 8719, 8721, 8721, 8725, 8725, 8730, 8730, 8733, 8736, 8739, 8739, 8741, 8741, 8743, 8748, 8750, 8750, 8756, 8759, 8764, 8765, 8776, 8776, 8780, 8780, 8786, 8786, 8800, 8801, 8804, 8807, 8810, 8811, 8814, 8815, 8834, 8835, 8838, 8839, 8853, 8853, 8857, 8857, 8869, 8869, 8895, 8895, 8978, 8978, 9312, 9449, 9451, 9547, 9552, 9587, 9600, 9615, 9618, 9621, 9632, 9633, 9635, 9641, 9650, 9651, 9654, 9655, 9660, 9661, 9664, 9665, 9670, 9672, 9675, 9675, 9678, 9681, 9698, 9701, 9711, 9711, 9733, 9734, 9737, 9737, 9742, 9743, 9756, 9756, 9758, 9758, 9792, 9792, 9794, 9794, 9824, 9825, 9827, 9829, 9831, 9834, 9836, 9837, 9839, 9839, 9886, 9887, 9919, 9919, 9926, 9933, 9935, 9939, 9941, 9953, 9955, 9955, 9960, 9961, 9963, 9969, 9972, 9972, 9974, 9977, 9979, 9980, 9982, 9983, 10045, 10045, 10102, 10111, 11094, 11097, 12872, 12879, 57344, 63743, 65024, 65039, 65533, 65533, 127232, 127242, 127248, 127277, 127280, 127337, 127344, 127373, 127375, 127376, 127387, 127404, 917760, 917999, 983040, 1048573, 1048576, 1114109];
25713
- var fullwidthRanges = [12288, 12288, 65281, 65376, 65504, 65510];
25714
- var halfwidthRanges = [8361, 8361, 65377, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65512, 65518];
25715
- var narrowRanges = [32, 126, 162, 163, 165, 166, 172, 172, 175, 175, 10214, 10221, 10629, 10630];
25716
- var wideRanges = [4352, 4447, 8986, 8987, 9001, 9002, 9193, 9196, 9200, 9200, 9203, 9203, 9725, 9726, 9748, 9749, 9776, 9783, 9800, 9811, 9855, 9855, 9866, 9871, 9875, 9875, 9889, 9889, 9898, 9899, 9917, 9918, 9924, 9925, 9934, 9934, 9940, 9940, 9962, 9962, 9970, 9971, 9973, 9973, 9978, 9978, 9981, 9981, 9989, 9989, 9994, 9995, 10024, 10024, 10060, 10060, 10062, 10062, 10067, 10069, 10071, 10071, 10133, 10135, 10160, 10160, 10175, 10175, 11035, 11036, 11088, 11088, 11093, 11093, 11904, 11929, 11931, 12019, 12032, 12245, 12272, 12287, 12289, 12350, 12353, 12438, 12441, 12543, 12549, 12591, 12593, 12686, 12688, 12773, 12783, 12830, 12832, 12871, 12880, 42124, 42128, 42182, 43360, 43388, 44032, 55203, 63744, 64255, 65040, 65049, 65072, 65106, 65108, 65126, 65128, 65131, 94176, 94180, 94192, 94198, 94208, 101589, 101631, 101662, 101760, 101874, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110882, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110951, 110960, 111355, 119552, 119638, 119648, 119670, 126980, 126980, 127183, 127183, 127374, 127374, 127377, 127386, 127488, 127490, 127504, 127547, 127552, 127560, 127568, 127569, 127584, 127589, 127744, 127776, 127789, 127797, 127799, 127868, 127870, 127891, 127904, 127946, 127951, 127955, 127968, 127984, 127988, 127988, 127992, 128062, 128064, 128064, 128066, 128252, 128255, 128317, 128331, 128334, 128336, 128359, 128378, 128378, 128405, 128406, 128420, 128420, 128507, 128591, 128640, 128709, 128716, 128716, 128720, 128722, 128725, 128728, 128732, 128735, 128747, 128748, 128756, 128764, 128992, 129003, 129008, 129008, 129292, 129338, 129340, 129349, 129351, 129535, 129648, 129660, 129664, 129674, 129678, 129734, 129736, 129736, 129741, 129756, 129759, 129770, 129775, 129784, 131072, 196605, 196608, 262141];
25717
-
25718
- // ../../node_modules/get-east-asian-width/utilities.js
25719
- var isInRange = (ranges, codePoint) => {
25720
- let low = 0;
25721
- let high = Math.floor(ranges.length / 2) - 1;
25722
- while (low <= high) {
25723
- const mid = Math.floor((low + high) / 2);
25724
- const i = mid * 2;
25725
- if (codePoint < ranges[i]) {
25726
- high = mid - 1;
25727
- } else if (codePoint > ranges[i + 1]) {
25728
- low = mid + 1;
25729
- } else {
25730
- return true;
25583
+ }
25584
+ return this;
25585
+ }
25586
+ if (this.isSpinning) {
25587
+ return this;
25588
+ }
25589
+ if (this.#options.hideCursor) {
25590
+ cli_cursor_default.hide(this.#stream);
25591
+ }
25592
+ if (this.#options.discardStdin && process11.stdin.isTTY) {
25593
+ this.#isDiscardingStdin = true;
25594
+ stdin_discarder_default.start();
25731
25595
  }
25596
+ this.render();
25597
+ this.#id = setInterval(this.render.bind(this), this.interval);
25598
+ return this;
25732
25599
  }
25733
- return false;
25734
- };
25735
-
25736
- // ../../node_modules/get-east-asian-width/lookup.js
25737
- var minimumAmbiguousCodePoint = ambiguousRanges[0];
25738
- var maximumAmbiguousCodePoint = ambiguousRanges.at(-1);
25739
- var minimumFullWidthCodePoint = fullwidthRanges[0];
25740
- var maximumFullWidthCodePoint = fullwidthRanges.at(-1);
25741
- var minimumHalfWidthCodePoint = halfwidthRanges[0];
25742
- var maximumHalfWidthCodePoint = halfwidthRanges.at(-1);
25743
- var minimumNarrowCodePoint = narrowRanges[0];
25744
- var maximumNarrowCodePoint = narrowRanges.at(-1);
25745
- var minimumWideCodePoint = wideRanges[0];
25746
- var maximumWideCodePoint = wideRanges.at(-1);
25747
- var commonCjkCodePoint = 19968;
25748
- var [wideFastPathStart, wideFastPathEnd] = findWideFastPathRange(wideRanges);
25749
- function findWideFastPathRange(ranges) {
25750
- let fastPathStart = ranges[0];
25751
- let fastPathEnd = ranges[1];
25752
- for (let index = 0;index < ranges.length; index += 2) {
25753
- const start = ranges[index];
25754
- const end = ranges[index + 1];
25755
- if (commonCjkCodePoint >= start && commonCjkCodePoint <= end) {
25756
- return [start, end];
25600
+ stop() {
25601
+ if (!this.#isEnabled) {
25602
+ return this;
25757
25603
  }
25758
- if (end - start > fastPathEnd - fastPathStart) {
25759
- fastPathStart = start;
25760
- fastPathEnd = end;
25604
+ clearInterval(this.#id);
25605
+ this.#id = undefined;
25606
+ this.#frameIndex = 0;
25607
+ this.clear();
25608
+ if (this.#options.hideCursor) {
25609
+ cli_cursor_default.show(this.#stream);
25610
+ }
25611
+ if (this.#options.discardStdin && process11.stdin.isTTY && this.#isDiscardingStdin) {
25612
+ stdin_discarder_default.stop();
25613
+ this.#isDiscardingStdin = false;
25761
25614
  }
25615
+ return this;
25762
25616
  }
25763
- return [fastPathStart, fastPathEnd];
25764
- }
25765
- var isAmbiguous = (codePoint) => {
25766
- if (codePoint < minimumAmbiguousCodePoint || codePoint > maximumAmbiguousCodePoint) {
25767
- return false;
25617
+ succeed(text) {
25618
+ return this.stopAndPersist({ symbol: log_symbols_default.success, text });
25768
25619
  }
25769
- return isInRange(ambiguousRanges, codePoint);
25770
- };
25771
- var isFullWidth = (codePoint) => {
25772
- if (codePoint < minimumFullWidthCodePoint || codePoint > maximumFullWidthCodePoint) {
25773
- return false;
25620
+ fail(text) {
25621
+ return this.stopAndPersist({ symbol: log_symbols_default.error, text });
25774
25622
  }
25775
- return isInRange(fullwidthRanges, codePoint);
25776
- };
25777
- var isWide = (codePoint) => {
25778
- if (codePoint >= wideFastPathStart && codePoint <= wideFastPathEnd) {
25779
- return true;
25623
+ warn(text) {
25624
+ return this.stopAndPersist({ symbol: log_symbols_default.warning, text });
25780
25625
  }
25781
- if (codePoint < minimumWideCodePoint || codePoint > maximumWideCodePoint) {
25782
- return false;
25626
+ info(text) {
25627
+ return this.stopAndPersist({ symbol: log_symbols_default.info, text });
25783
25628
  }
25784
- return isInRange(wideRanges, codePoint);
25785
- };
25786
-
25787
- // ../../node_modules/get-east-asian-width/index.js
25788
- function validate(codePoint) {
25789
- if (!Number.isSafeInteger(codePoint)) {
25790
- throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
25629
+ stopAndPersist(options = {}) {
25630
+ if (this.#isSilent) {
25631
+ return this;
25632
+ }
25633
+ const prefixText = options.prefixText ?? this.#prefixText;
25634
+ const fullPrefixText = this.#getFullPrefixText(prefixText, " ");
25635
+ const symbolText = options.symbol ?? " ";
25636
+ const text = options.text ?? this.text;
25637
+ const separatorText = symbolText ? " " : "";
25638
+ const fullText = typeof text === "string" ? separatorText + text : "";
25639
+ const suffixText = options.suffixText ?? this.#suffixText;
25640
+ const fullSuffixText = this.#getFullSuffixText(suffixText, " ");
25641
+ const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText + `
25642
+ `;
25643
+ this.stop();
25644
+ this.#stream.write(textToWrite);
25645
+ return this;
25791
25646
  }
25792
25647
  }
25793
- function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
25794
- validate(codePoint);
25795
- if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
25796
- return 2;
25797
- }
25798
- return 1;
25648
+ function ora(options) {
25649
+ return new Ora(options);
25799
25650
  }
25800
25651
 
25801
- // ../../node_modules/string-width/index.js
25802
- var import_emoji_regex = __toESM(require_emoji_regex(), 1);
25803
- var segmenter = new Intl.Segmenter;
25804
- var defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
25805
- function stringWidth(string, options = {}) {
25806
- if (typeof string !== "string" || string.length === 0) {
25807
- return 0;
25652
+ // src/config.ts
25653
+ import fs from "fs";
25654
+ import path from "path";
25655
+ import os4 from "os";
25656
+ function getConfigDir() {
25657
+ const xdgConfig = process.env.XDG_CONFIG_HOME ?? path.join(os4.homedir(), ".config");
25658
+ return path.join(xdgConfig, "oyster");
25659
+ }
25660
+ var CONFIG_DIR = getConfigDir();
25661
+ var CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
25662
+ function loadConfig() {
25663
+ try {
25664
+ if (!fs.existsSync(CONFIG_FILE)) {
25665
+ return {};
25666
+ }
25667
+ const content = fs.readFileSync(CONFIG_FILE, "utf-8");
25668
+ return JSON.parse(content);
25669
+ } catch {
25670
+ return {};
25808
25671
  }
25809
- const {
25810
- ambiguousIsNarrow = true,
25811
- countAnsiEscapeCodes = false
25812
- } = options;
25813
- if (!countAnsiEscapeCodes) {
25814
- string = stripAnsi(string);
25672
+ }
25673
+ function saveConfig(config) {
25674
+ if (!fs.existsSync(CONFIG_DIR)) {
25675
+ fs.mkdirSync(CONFIG_DIR, { recursive: true, mode: 448 });
25815
25676
  }
25816
- if (string.length === 0) {
25817
- return 0;
25677
+ fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2), { mode: 384 });
25678
+ }
25679
+ function getApiKey() {
25680
+ if (process.env.OYSTER_API_KEY) {
25681
+ return process.env.OYSTER_API_KEY;
25818
25682
  }
25819
- let width = 0;
25820
- const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
25821
- for (const { segment: character } of segmenter.segment(string)) {
25822
- const codePoint = character.codePointAt(0);
25823
- if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
25824
- continue;
25825
- }
25826
- if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
25827
- continue;
25828
- }
25829
- if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
25830
- continue;
25831
- }
25832
- if (codePoint >= 55296 && codePoint <= 57343) {
25833
- continue;
25834
- }
25835
- if (codePoint >= 65024 && codePoint <= 65039) {
25836
- continue;
25837
- }
25838
- if (defaultIgnorableCodePointRegex.test(character)) {
25839
- continue;
25840
- }
25841
- if (import_emoji_regex.default().test(character)) {
25842
- width += 2;
25843
- continue;
25844
- }
25845
- width += eastAsianWidth(codePoint, eastAsianWidthOptions);
25683
+ const config = loadConfig();
25684
+ return config.api_key ?? null;
25685
+ }
25686
+ function getServerUrl() {
25687
+ if (process.env.OYSTER_SERVER_URL) {
25688
+ return process.env.OYSTER_SERVER_URL;
25846
25689
  }
25847
- return width;
25690
+ const config = loadConfig();
25691
+ return config.server_url ?? "https://oyster-platform.com";
25848
25692
  }
25849
-
25850
- // ../../node_modules/is-interactive/index.js
25851
- function isInteractive({ stream: stream4 = process.stdout } = {}) {
25852
- return Boolean(stream4 && stream4.isTTY && process.env.TERM !== "dumb" && !("CI" in process.env));
25693
+ function getApiBaseUrl() {
25694
+ return `${getServerUrl()}/api/v1/cli`;
25853
25695
  }
25854
-
25855
- // ../../node_modules/is-unicode-supported/index.js
25856
- import process9 from "node:process";
25857
- function isUnicodeSupported2() {
25858
- const { env: env4 } = process9;
25859
- const { TERM, TERM_PROGRAM } = env4;
25860
- if (process9.platform !== "win32") {
25861
- return TERM !== "linux";
25696
+ function requireLogin() {
25697
+ const apiKey = getApiKey();
25698
+ if (!apiKey) {
25699
+ throw new Error("ログインしていません。先に `oyster login` を実行してください。");
25862
25700
  }
25863
- return Boolean(env4.WT_SESSION) || Boolean(env4.TERMINUS_SUBLIME) || env4.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env4.TERMINAL_EMULATOR === "JetBrains-JediTerm";
25701
+ return apiKey;
25864
25702
  }
25865
25703
 
25866
- // ../../node_modules/stdin-discarder/index.js
25867
- import process10 from "node:process";
25868
- var ASCII_ETX_CODE = 3;
25869
-
25870
- class StdinDiscarder {
25871
- #activeCount = 0;
25872
- start() {
25873
- this.#activeCount++;
25874
- if (this.#activeCount === 1) {
25875
- this.#realStart();
25876
- }
25877
- }
25878
- stop() {
25879
- if (this.#activeCount <= 0) {
25880
- throw new Error("`stop` called more times than `start`");
25881
- }
25882
- this.#activeCount--;
25883
- if (this.#activeCount === 0) {
25884
- this.#realStop();
25885
- }
25704
+ // src/utils/browser.ts
25705
+ import { exec } from "child_process";
25706
+ function openBrowser(url2) {
25707
+ const platform = process.platform;
25708
+ let command;
25709
+ if (platform === "darwin") {
25710
+ command = `open "${url2}"`;
25711
+ } else if (platform === "win32") {
25712
+ command = `start "" "${url2}"`;
25713
+ } else {
25714
+ command = `xdg-open "${url2}"`;
25886
25715
  }
25887
- #realStart() {
25888
- if (process10.platform === "win32" || !process10.stdin.isTTY) {
25889
- return;
25890
- }
25891
- process10.stdin.setRawMode(true);
25892
- process10.stdin.on("data", this.#handleInput);
25893
- process10.stdin.resume();
25716
+ exec(command, (error) => {
25717
+ if (error) {}
25718
+ });
25719
+ }
25720
+
25721
+ // src/commands/login.ts
25722
+ async function browserLogin(serverUrl) {
25723
+ const deviceUrl = `${serverUrl}/api/v1/cli/auth/device`;
25724
+ const deviceRes = await axios_default.post(deviceUrl);
25725
+ const { device_code, user_code, verification_url, expires_in, interval } = deviceRes.data;
25726
+ const authorizeUrl = `${verification_url}?user_code=${encodeURIComponent(user_code)}`;
25727
+ console.log();
25728
+ console.log(source_default.cyan("ブラウザで認証ページを開いています..."));
25729
+ console.log();
25730
+ console.log(` 認証コード: ${source_default.bold.white(user_code)}`);
25731
+ console.log();
25732
+ console.log(source_default.gray(` ブラウザが開かない場合は以下の URL を開いてください:`));
25733
+ console.log(source_default.gray(` ${authorizeUrl}`));
25734
+ console.log();
25735
+ openBrowser(authorizeUrl);
25736
+ const spinner = ora("ブラウザでの承認を待っています...").start();
25737
+ const pollUrl = `${serverUrl}/api/v1/cli/auth/poll`;
25738
+ const pollInterval = (interval || 5) * 1000;
25739
+ const timeout = (expires_in || 900) * 1000;
25740
+ const startTime = Date.now();
25741
+ while (Date.now() - startTime < timeout) {
25742
+ await new Promise((resolve) => setTimeout(resolve, pollInterval));
25743
+ try {
25744
+ const pollRes = await axios_default.get(pollUrl, {
25745
+ params: { device_code }
25746
+ });
25747
+ const { status, api_key, user } = pollRes.data;
25748
+ if (status === "approved") {
25749
+ spinner.succeed("認証が承認されました");
25750
+ const config = loadConfig();
25751
+ config.api_key = api_key;
25752
+ config.server_url = serverUrl;
25753
+ config.user = user;
25754
+ saveConfig(config);
25755
+ console.log();
25756
+ console.log(source_default.green("✓ ログインに成功しました"));
25757
+ console.log(source_default.gray(` ユーザー: ${user.name} (${user.email})`));
25758
+ console.log(source_default.gray(` 設定は ~/.config/oyster/config.json に保存されました`));
25759
+ return;
25760
+ }
25761
+ if (status === "expired") {
25762
+ spinner.fail("セッションが期限切れになりました");
25763
+ console.error(source_default.red("✗ もう一度 `oyster login` を実行してください"));
25764
+ process.exit(1);
25765
+ }
25766
+ } catch {}
25894
25767
  }
25895
- #realStop() {
25896
- if (!process10.stdin.isTTY) {
25897
- return;
25898
- }
25899
- process10.stdin.off("data", this.#handleInput);
25900
- process10.stdin.pause();
25901
- process10.stdin.setRawMode(false);
25768
+ spinner.fail("タイムアウトしました");
25769
+ console.error(source_default.red("✗ もう一度 `oyster login` を実行してください"));
25770
+ process.exit(1);
25771
+ }
25772
+ async function passwordLogin(serverUrl) {
25773
+ const { email } = await import_prompts.default({
25774
+ type: "text",
25775
+ name: "email",
25776
+ message: "メールアドレス:"
25777
+ });
25778
+ if (!email) {
25779
+ console.log(source_default.yellow("キャンセルしました"));
25780
+ return;
25902
25781
  }
25903
- #handleInput(chunk) {
25904
- if (chunk[0] === ASCII_ETX_CODE) {
25905
- process10.emit("SIGINT");
25906
- }
25782
+ const { password } = await import_prompts.default({
25783
+ type: "password",
25784
+ name: "password",
25785
+ message: "パスワード:"
25786
+ });
25787
+ if (!password) {
25788
+ console.log(source_default.yellow("キャンセルしました"));
25789
+ return;
25907
25790
  }
25791
+ const loginUrl = `${serverUrl}/api/v1/cli/login`;
25792
+ const response = await axios_default.post(loginUrl, { email, password });
25793
+ const { api_key, user } = response.data;
25794
+ const config = loadConfig();
25795
+ config.api_key = api_key;
25796
+ config.server_url = serverUrl;
25797
+ config.user = user;
25798
+ saveConfig(config);
25799
+ console.log();
25800
+ console.log(source_default.green("✓ ログインに成功しました"));
25801
+ console.log(source_default.gray(` ユーザー: ${user.name} (${user.email})`));
25802
+ console.log(source_default.gray(` 設定は ~/.config/oyster/config.json に保存されました`));
25908
25803
  }
25909
- var stdinDiscarder = new StdinDiscarder;
25910
- var stdin_discarder_default = stdinDiscarder;
25911
-
25912
- // ../../node_modules/ora/index.js
25913
- var import_cli_spinners2 = __toESM(require_cli_spinners(), 1);
25914
-
25915
- class Ora {
25916
- #linesToClear = 0;
25917
- #isDiscardingStdin = false;
25918
- #lineCount = 0;
25919
- #frameIndex = -1;
25920
- #lastSpinnerFrameTime = 0;
25921
- #options;
25922
- #spinner;
25923
- #stream;
25924
- #id;
25925
- #initialInterval;
25926
- #isEnabled;
25927
- #isSilent;
25928
- #indent;
25929
- #text;
25930
- #prefixText;
25931
- #suffixText;
25932
- color;
25933
- constructor(options) {
25934
- if (typeof options === "string") {
25935
- options = {
25936
- text: options
25937
- };
25938
- }
25939
- this.#options = {
25940
- color: "cyan",
25941
- stream: process11.stderr,
25942
- discardStdin: true,
25943
- hideCursor: true,
25944
- ...options
25945
- };
25946
- this.color = this.#options.color;
25947
- this.spinner = this.#options.spinner;
25948
- this.#initialInterval = this.#options.interval;
25949
- this.#stream = this.#options.stream;
25950
- this.#isEnabled = typeof this.#options.isEnabled === "boolean" ? this.#options.isEnabled : isInteractive({ stream: this.#stream });
25951
- this.#isSilent = typeof this.#options.isSilent === "boolean" ? this.#options.isSilent : false;
25952
- this.text = this.#options.text;
25953
- this.prefixText = this.#options.prefixText;
25954
- this.suffixText = this.#options.suffixText;
25955
- this.indent = this.#options.indent;
25956
- if (process11.env.NODE_ENV === "test") {
25957
- this._stream = this.#stream;
25958
- this._isEnabled = this.#isEnabled;
25959
- Object.defineProperty(this, "_linesToClear", {
25960
- get() {
25961
- return this.#linesToClear;
25962
- },
25963
- set(newValue) {
25964
- this.#linesToClear = newValue;
25804
+ function setLogin(program2) {
25805
+ program2.command("login").description("Oyster にログインして API キーを取得する").option("-s, --server <url>", "サーバー URL を指定").option("--no-browser", "ブラウザを使わずメール/パスワードでログイン").action(async (options) => {
25806
+ try {
25807
+ if (options.server) {
25808
+ let parsed;
25809
+ try {
25810
+ parsed = new URL(options.server);
25811
+ } catch {
25812
+ console.error(source_default.red("✗ 無効なサーバー URL です"));
25813
+ process.exit(1);
25965
25814
  }
25966
- });
25967
- Object.defineProperty(this, "_frameIndex", {
25968
- get() {
25969
- return this.#frameIndex;
25815
+ if (!["https:", "http:"].includes(parsed.protocol)) {
25816
+ console.error(source_default.red("✗ サーバー URL は http または https である必要があります"));
25817
+ process.exit(1);
25970
25818
  }
25971
- });
25972
- Object.defineProperty(this, "_lineCount", {
25973
- get() {
25974
- return this.#lineCount;
25819
+ const config = loadConfig();
25820
+ config.server_url = options.server;
25821
+ saveConfig(config);
25822
+ }
25823
+ const serverUrl = options.server ?? getServerUrl();
25824
+ console.log(source_default.cyan(`サーバー: ${serverUrl}`));
25825
+ if (options.browser === false) {
25826
+ await passwordLogin(serverUrl);
25827
+ } else {
25828
+ await browserLogin(serverUrl);
25829
+ }
25830
+ } catch (error) {
25831
+ if (axios_default.isAxiosError(error) && error.response) {
25832
+ const status = error.response.status;
25833
+ const message = error.response.data?.message ?? "Unknown error";
25834
+ if (status === 401) {
25835
+ console.error(source_default.red("✗ メールアドレスまたはパスワードが正しくありません"));
25836
+ } else {
25837
+ console.error(source_default.red(`✗ ログイン失敗: ${message} (HTTP ${status})`));
25975
25838
  }
25976
- });
25839
+ } else {
25840
+ console.error(source_default.red(`✗ ログイン失敗: ${error.message}`));
25841
+ }
25842
+ process.exit(1);
25977
25843
  }
25978
- }
25979
- get indent() {
25980
- return this.#indent;
25981
- }
25982
- set indent(indent = 0) {
25983
- if (!(indent >= 0 && Number.isInteger(indent))) {
25984
- throw new Error("The `indent` option must be an integer from 0 and up");
25844
+ });
25845
+ }
25846
+
25847
+ // src/commands/init.ts
25848
+ var import_prompts2 = __toESM(require_prompts3(), 1);
25849
+ import { spawnSync } from "child_process";
25850
+
25851
+ // src/templates/index.ts
25852
+ import fs2 from "fs";
25853
+ import path2 from "path";
25854
+
25855
+ // src/templates/frontend.ts
25856
+ function generateFrontendFiles(domain, appName) {
25857
+ if (!domain)
25858
+ throw new Error("domain は必須です");
25859
+ if (!appName)
25860
+ throw new Error("appName は必須です");
25861
+ const base = `frontend/${domain}`;
25862
+ return {
25863
+ [`${base}/src/apps/${appName}/index.ts`]: generateAppEntryPoint(appName),
25864
+ [`${base}/src/shared/index.ts`]: generateSharedIndex(),
25865
+ [`${base}/src/index.css`]: generateIndexCss(),
25866
+ [`${base}/package.json`]: generateFrontendPackageJson(domain),
25867
+ [`${base}/tsconfig.json`]: generateFrontendTsconfig(),
25868
+ [`${base}/tailwind.config.js`]: generateTailwindConfig()
25869
+ };
25870
+ }
25871
+ function generateAppEntryPoint(appName) {
25872
+ const componentName = appName.charAt(0).toUpperCase() + appName.slice(1);
25873
+ return `import React from 'react'
25874
+
25875
+ /**
25876
+ * ${componentName} - フロントエンドエントリーポイント
25877
+ */
25878
+ export default function ${componentName}() {
25879
+ return (
25880
+ <div className="p-4">
25881
+ <h1 className="text-2xl font-bold">${componentName}</h1>
25882
+ <p>Welcome to ${appName}</p>
25883
+ </div>
25884
+ )
25885
+ }
25886
+ `;
25887
+ }
25888
+ function generateSharedIndex() {
25889
+ return `/**
25890
+ * 共有モジュール
25891
+ * アプリ間で共有するユーティリティや型をここからエクスポートする
25892
+ */
25893
+
25894
+ export {}
25895
+ `;
25896
+ }
25897
+ function generateIndexCss() {
25898
+ return `@import 'tailwindcss';
25899
+
25900
+ /* カスタムスタイルをここに追加 */
25901
+ `;
25902
+ }
25903
+ function generateFrontendPackageJson(domain) {
25904
+ const pkg = {
25905
+ name: `@oyster-apps/${domain}`,
25906
+ version: "1.0.0",
25907
+ private: true,
25908
+ dependencies: {
25909
+ react: "^19.0.0",
25910
+ "react-dom": "^19.0.0",
25911
+ "@oyster-lib/core": "*"
25912
+ },
25913
+ devDependencies: {
25914
+ typescript: "^5.8.0",
25915
+ "@types/react": "^19.0.0",
25916
+ "@types/react-dom": "^19.0.0",
25917
+ esbuild: "^0.24.0",
25918
+ tailwindcss: "^4.0.0"
25985
25919
  }
25986
- this.#indent = indent;
25987
- this.#updateLineCount();
25988
- }
25989
- get interval() {
25990
- return this.#initialInterval ?? this.#spinner.interval ?? 100;
25991
- }
25992
- get spinner() {
25993
- return this.#spinner;
25994
- }
25995
- set spinner(spinner) {
25996
- this.#frameIndex = -1;
25997
- this.#initialInterval = undefined;
25998
- if (typeof spinner === "object") {
25999
- if (spinner.frames === undefined) {
26000
- throw new Error("The given spinner must have a `frames` property");
25920
+ };
25921
+ return JSON.stringify(pkg, null, 2) + `
25922
+ `;
25923
+ }
25924
+ function generateFrontendTsconfig() {
25925
+ const tsconfig = {
25926
+ compilerOptions: {
25927
+ target: "ES2022",
25928
+ module: "ESNext",
25929
+ moduleResolution: "bundler",
25930
+ jsx: "react-jsx",
25931
+ esModuleInterop: true,
25932
+ strict: true,
25933
+ skipLibCheck: true,
25934
+ forceConsistentCasingInFileNames: true,
25935
+ resolveJsonModule: true,
25936
+ declaration: true,
25937
+ outDir: "./.build",
25938
+ baseUrl: ".",
25939
+ paths: {
25940
+ "components/*": ["./src/apps/*/index.ts"],
25941
+ components: ["./src/apps/*/index.ts"],
25942
+ "shared/*": ["./src/shared/index.ts"],
25943
+ shared: ["./src/shared/index.ts"]
26001
25944
  }
26002
- this.#spinner = spinner;
26003
- } else if (!isUnicodeSupported2()) {
26004
- this.#spinner = import_cli_spinners.default.line;
26005
- } else if (spinner === undefined) {
26006
- this.#spinner = import_cli_spinners.default.dots;
26007
- } else if (spinner !== "default" && import_cli_spinners.default[spinner]) {
26008
- this.#spinner = import_cli_spinners.default[spinner];
26009
- } else {
26010
- throw new Error(`There is no built-in spinner named '${spinner}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`);
26011
- }
26012
- }
26013
- get text() {
26014
- return this.#text;
26015
- }
26016
- set text(value = "") {
26017
- this.#text = value;
26018
- this.#updateLineCount();
26019
- }
26020
- get prefixText() {
26021
- return this.#prefixText;
26022
- }
26023
- set prefixText(value = "") {
26024
- this.#prefixText = value;
26025
- this.#updateLineCount();
26026
- }
26027
- get suffixText() {
26028
- return this.#suffixText;
26029
- }
26030
- set suffixText(value = "") {
26031
- this.#suffixText = value;
26032
- this.#updateLineCount();
26033
- }
26034
- get isSpinning() {
26035
- return this.#id !== undefined;
26036
- }
26037
- #getFullPrefixText(prefixText = this.#prefixText, postfix = " ") {
26038
- if (typeof prefixText === "string" && prefixText !== "") {
26039
- return prefixText + postfix;
26040
- }
26041
- if (typeof prefixText === "function") {
26042
- return prefixText() + postfix;
26043
- }
26044
- return "";
26045
- }
26046
- #getFullSuffixText(suffixText = this.#suffixText, prefix = " ") {
26047
- if (typeof suffixText === "string" && suffixText !== "") {
26048
- return prefix + suffixText;
26049
- }
26050
- if (typeof suffixText === "function") {
26051
- return prefix + suffixText();
26052
- }
26053
- return "";
26054
- }
26055
- #updateLineCount() {
26056
- const columns = this.#stream.columns ?? 80;
26057
- const fullPrefixText = this.#getFullPrefixText(this.#prefixText, "-");
26058
- const fullSuffixText = this.#getFullSuffixText(this.#suffixText, "-");
26059
- const fullText = " ".repeat(this.#indent) + fullPrefixText + "--" + this.#text + "--" + fullSuffixText;
26060
- this.#lineCount = 0;
26061
- for (const line of stripAnsi(fullText).split(`
26062
- `)) {
26063
- this.#lineCount += Math.max(1, Math.ceil(stringWidth(line, { countAnsiEscapeCodes: true }) / columns));
26064
- }
26065
- }
26066
- get isEnabled() {
26067
- return this.#isEnabled && !this.#isSilent;
26068
- }
26069
- set isEnabled(value) {
26070
- if (typeof value !== "boolean") {
26071
- throw new TypeError("The `isEnabled` option must be a boolean");
25945
+ },
25946
+ include: ["src/**/*"],
25947
+ exclude: ["node_modules", ".build"]
25948
+ };
25949
+ return JSON.stringify(tsconfig, null, 2) + `
25950
+ `;
25951
+ }
25952
+ function generateTailwindConfig() {
25953
+ return `/** @type {import('tailwindcss').Config} */
25954
+ module.exports = {
25955
+ content: [
25956
+ './src/**/*.{js,ts,jsx,tsx}'
25957
+ ],
25958
+ theme: {
25959
+ extend: {}
25960
+ },
25961
+ plugins: []
25962
+ }
25963
+ `;
25964
+ }
25965
+
25966
+ // src/templates/backend.ts
25967
+ function generateBackendFiles(domain) {
25968
+ if (!domain)
25969
+ throw new Error("domain は必須です");
25970
+ return {
25971
+ "backend/server.ts": generateServerTs(),
25972
+ "backend/package.json": generateBackendPackageJson(),
25973
+ "backend/tsconfig.json": generateBackendTsconfig(),
25974
+ [`backend/prisma/${domain}/schema.prisma`]: generatePrismaSchema(domain)
25975
+ };
25976
+ }
25977
+ function generateServerTs() {
25978
+ return `import express from 'express'
25979
+
25980
+ const app = express()
25981
+ const port = process.env.PORT ? parseInt(process.env.PORT) : 1616
25982
+
25983
+ app.use(express.json())
25984
+
25985
+ app.get('/health', (_req, res) => {
25986
+ res.json({ status: 'ok' })
25987
+ })
25988
+
25989
+ app.listen(port, () => {
25990
+ console.log(\`Action Server listening on port \${port}\`)
25991
+ })
25992
+ `;
25993
+ }
25994
+ function generateBackendPackageJson() {
25995
+ const pkg = {
25996
+ name: "@oyster-apps/backend",
25997
+ version: "1.0.0",
25998
+ private: true,
25999
+ scripts: {
26000
+ start: "TS_NODE_TRANSPILE_ONLY=true node --max-old-space-size=2048 -r ts-node/register -r tsconfig-paths/register server.ts"
26001
+ },
26002
+ dependencies: {
26003
+ express: "^4.21.0",
26004
+ "@prisma/client": "^6.0.0"
26005
+ },
26006
+ devDependencies: {
26007
+ typescript: "^5.8.0",
26008
+ "ts-node": "^10.9.0",
26009
+ "tsconfig-paths": "^4.2.0",
26010
+ "@types/express": "^5.0.0",
26011
+ "@types/node": "^22.0.0",
26012
+ prisma: "^6.0.0"
26072
26013
  }
26073
- this.#isEnabled = value;
26074
- }
26075
- get isSilent() {
26076
- return this.#isSilent;
26077
- }
26078
- set isSilent(value) {
26079
- if (typeof value !== "boolean") {
26080
- throw new TypeError("The `isSilent` option must be a boolean");
26014
+ };
26015
+ return JSON.stringify(pkg, null, 2) + `
26016
+ `;
26017
+ }
26018
+ function generateBackendTsconfig() {
26019
+ const tsconfig = {
26020
+ compilerOptions: {
26021
+ target: "ES2022",
26022
+ module: "CommonJS",
26023
+ moduleResolution: "node",
26024
+ esModuleInterop: true,
26025
+ strict: true,
26026
+ skipLibCheck: true,
26027
+ forceConsistentCasingInFileNames: true,
26028
+ resolveJsonModule: true,
26029
+ outDir: "./dist",
26030
+ rootDir: ".",
26031
+ declaration: true,
26032
+ baseUrl: ".",
26033
+ paths: {
26034
+ "prisma/*": ["./prisma/*"]
26035
+ }
26036
+ },
26037
+ include: ["**/*.ts"],
26038
+ exclude: ["node_modules", "dist"]
26039
+ };
26040
+ return JSON.stringify(tsconfig, null, 2) + `
26041
+ `;
26042
+ }
26043
+ function generatePrismaSchema(domain) {
26044
+ return `// Prisma Schema for ${domain}
26045
+ // https://www.prisma.io/docs/prisma-schema
26046
+
26047
+ generator client {
26048
+ provider = "prisma-client-js"
26049
+ output = "../../node_modules/.prisma/${domain}"
26050
+ }
26051
+
26052
+ datasource db {
26053
+ provider = "postgresql"
26054
+ url = env("DATABASE_URL")
26055
+ }
26056
+
26057
+ // Add your models here
26058
+ // model Example {
26059
+ // id Int @id @default(autoincrement())
26060
+ // name String
26061
+ // createdAt DateTime @default(now()) @map("created_at")
26062
+ // updatedAt DateTime @updatedAt @map("updated_at")
26063
+ //
26064
+ // @@map("examples")
26065
+ // }
26066
+ `;
26067
+ }
26068
+
26069
+ // src/templates/index.ts
26070
+ function generateAllFiles(domain, appName) {
26071
+ if (!domain)
26072
+ throw new Error("domain は必須です");
26073
+ if (!appName)
26074
+ throw new Error("appName は必須です");
26075
+ return {
26076
+ ...generateFrontendFiles(domain, appName),
26077
+ ...generateBackendFiles(domain),
26078
+ ...generateCommonFiles(domain, appName)
26079
+ };
26080
+ }
26081
+ function generateAppFiles(domain, appName) {
26082
+ if (!domain)
26083
+ throw new Error("domain は必須です");
26084
+ if (!appName)
26085
+ throw new Error("appName は必須です");
26086
+ return {
26087
+ [`frontend/${domain}/src/apps/${appName}/index.ts`]: generateAppEntryPoint(appName)
26088
+ };
26089
+ }
26090
+ function generateCommonFiles(domain, appName) {
26091
+ return {
26092
+ ".gitignore": generateGitignore(),
26093
+ "README.md": generateReadme(domain, appName)
26094
+ };
26095
+ }
26096
+ function generateGitignore() {
26097
+ return `# Dependencies
26098
+ node_modules/
26099
+
26100
+ # Build output
26101
+ .build/
26102
+ dist/
26103
+
26104
+ # Environment
26105
+ .env
26106
+ .env.local
26107
+ .env.*.local
26108
+
26109
+ # IDE
26110
+ .vscode/
26111
+ .idea/
26112
+
26113
+ # OS
26114
+ .DS_Store
26115
+ Thumbs.db
26116
+
26117
+ # Logs
26118
+ *.log
26119
+ npm-debug.log*
26120
+ yarn-debug.log*
26121
+ pnpm-debug.log*
26122
+ `;
26123
+ }
26124
+ function generateReadme(domain, appName) {
26125
+ return `# Oyster Apps - ${domain}
26126
+
26127
+ This repository contains the frontend and backend code for the **${domain}** domain on the Oyster platform.
26128
+
26129
+ ## Structure
26130
+
26131
+ \`\`\`
26132
+ frontend/${domain}/ # Frontend applications
26133
+ src/apps/${appName}/ # ${appName} app entry point
26134
+ src/shared/ # Shared modules
26135
+ backend/ # Backend (Action Server)
26136
+ prisma/${domain}/ # Prisma schema
26137
+ \`\`\`
26138
+
26139
+ ## Apps
26140
+
26141
+ - **${appName}** - \`frontend/${domain}/src/apps/${appName}/index.ts\`
26142
+
26143
+ ## Deploy
26144
+
26145
+ \`\`\`bash
26146
+ oyster deploy -d ${domain} -a ${appName}
26147
+ \`\`\`
26148
+
26149
+ ## Migrate
26150
+
26151
+ \`\`\`bash
26152
+ oyster migrate -d ${domain} -a ${appName}
26153
+ \`\`\`
26154
+ `;
26155
+ }
26156
+ function writeFiles(rootDir, files, force) {
26157
+ const created = [];
26158
+ const skipped = [];
26159
+ for (const [relativePath, content] of Object.entries(files)) {
26160
+ const fullPath = path2.resolve(rootDir, relativePath);
26161
+ if (!fullPath.startsWith(path2.resolve(rootDir) + path2.sep)) {
26162
+ throw new Error(`不正なパスが検出されました: ${relativePath}`);
26081
26163
  }
26082
- this.#isSilent = value;
26083
- }
26084
- frame() {
26085
- const now = Date.now();
26086
- if (this.#frameIndex === -1 || now - this.#lastSpinnerFrameTime >= this.interval) {
26087
- this.#frameIndex = ++this.#frameIndex % this.#spinner.frames.length;
26088
- this.#lastSpinnerFrameTime = now;
26164
+ const dir = path2.dirname(fullPath);
26165
+ if (!fs2.existsSync(dir)) {
26166
+ fs2.mkdirSync(dir, { recursive: true });
26089
26167
  }
26090
- const { frames } = this.#spinner;
26091
- let frame = frames[this.#frameIndex];
26092
- if (this.color) {
26093
- frame = source_default2[this.color](frame);
26168
+ if (fs2.existsSync(fullPath) && !force) {
26169
+ skipped.push(relativePath);
26170
+ continue;
26094
26171
  }
26095
- const fullPrefixText = typeof this.#prefixText === "string" && this.#prefixText !== "" ? this.#prefixText + " " : "";
26096
- const fullText = typeof this.text === "string" ? " " + this.text : "";
26097
- const fullSuffixText = typeof this.#suffixText === "string" && this.#suffixText !== "" ? " " + this.#suffixText : "";
26098
- return fullPrefixText + frame + fullText + fullSuffixText;
26172
+ fs2.writeFileSync(fullPath, content, "utf-8");
26173
+ created.push(relativePath);
26099
26174
  }
26100
- clear() {
26101
- if (!this.#isEnabled || !this.#stream.isTTY) {
26102
- return this;
26103
- }
26104
- this.#stream.cursorTo(0);
26105
- for (let index = 0;index < this.#linesToClear; index++) {
26106
- if (index > 0) {
26107
- this.#stream.moveCursor(0, -1);
26175
+ return { created, skipped };
26176
+ }
26177
+
26178
+ // src/commands/init.ts
26179
+ function setInit(program2) {
26180
+ program2.command("init").description("リポジトリを Oyster アプリ構成で初期化する").option("-d, --domain <name>", "ドメイン名を指定").option("-a, --app <name>", "アプリ名を指定").option("--force", "既存ファイルを上書きする", false).option("--add-app", "既存リポジトリに新しいアプリを追加する", false).action(async (options) => {
26181
+ try {
26182
+ requireLogin();
26183
+ try {
26184
+ spawnSync("git", ["rev-parse", "--is-inside-work-tree"], {
26185
+ stdio: ["pipe", "pipe", "pipe"]
26186
+ });
26187
+ } catch {
26188
+ console.error(source_default.red("✗ カレントディレクトリは git リポジトリではありません。"));
26189
+ console.error(source_default.gray(" 先に `git init` を実行してください。"));
26190
+ process.exit(1);
26108
26191
  }
26109
- this.#stream.clearLine(1);
26110
- }
26111
- if (this.#indent || this.lastIndent !== this.#indent) {
26112
- this.#stream.cursorTo(this.#indent);
26113
- }
26114
- this.lastIndent = this.#indent;
26115
- this.#linesToClear = 0;
26116
- return this;
26117
- }
26118
- render() {
26119
- if (this.#isSilent) {
26120
- return this;
26121
- }
26122
- this.clear();
26123
- this.#stream.write(this.frame());
26124
- this.#linesToClear = this.#lineCount;
26125
- return this;
26126
- }
26127
- start(text) {
26128
- if (text) {
26129
- this.text = text;
26130
- }
26131
- if (this.#isSilent) {
26132
- return this;
26133
- }
26134
- if (!this.#isEnabled) {
26135
- if (this.text) {
26136
- this.#stream.write(`- ${this.text}
26137
- `);
26192
+ let domainName = options.domain;
26193
+ if (!domainName) {
26194
+ const { value } = await import_prompts2.default({
26195
+ type: "text",
26196
+ name: "value",
26197
+ message: "ドメイン名:",
26198
+ validate: (v) => v.length > 0 ? true : "ドメイン名は必須です"
26199
+ });
26200
+ if (!value) {
26201
+ console.log(source_default.yellow("キャンセルしました"));
26202
+ return;
26203
+ }
26204
+ domainName = value;
26138
26205
  }
26139
- return this;
26140
- }
26141
- if (this.isSpinning) {
26142
- return this;
26143
- }
26144
- if (this.#options.hideCursor) {
26145
- cli_cursor_default.hide(this.#stream);
26146
- }
26147
- if (this.#options.discardStdin && process11.stdin.isTTY) {
26148
- this.#isDiscardingStdin = true;
26149
- stdin_discarder_default.start();
26150
- }
26151
- this.render();
26152
- this.#id = setInterval(this.render.bind(this), this.interval);
26153
- return this;
26154
- }
26155
- stop() {
26156
- if (!this.#isEnabled) {
26157
- return this;
26158
- }
26159
- clearInterval(this.#id);
26160
- this.#id = undefined;
26161
- this.#frameIndex = 0;
26162
- this.clear();
26163
- if (this.#options.hideCursor) {
26164
- cli_cursor_default.show(this.#stream);
26165
- }
26166
- if (this.#options.discardStdin && process11.stdin.isTTY && this.#isDiscardingStdin) {
26167
- stdin_discarder_default.stop();
26168
- this.#isDiscardingStdin = false;
26169
- }
26170
- return this;
26171
- }
26172
- succeed(text) {
26173
- return this.stopAndPersist({ symbol: log_symbols_default.success, text });
26174
- }
26175
- fail(text) {
26176
- return this.stopAndPersist({ symbol: log_symbols_default.error, text });
26177
- }
26178
- warn(text) {
26179
- return this.stopAndPersist({ symbol: log_symbols_default.warning, text });
26180
- }
26181
- info(text) {
26182
- return this.stopAndPersist({ symbol: log_symbols_default.info, text });
26183
- }
26184
- stopAndPersist(options = {}) {
26185
- if (this.#isSilent) {
26186
- return this;
26206
+ let appName = options.app;
26207
+ if (!appName) {
26208
+ const { value } = await import_prompts2.default({
26209
+ type: "text",
26210
+ name: "value",
26211
+ message: "アプリ名:",
26212
+ validate: (v) => v.length > 0 ? true : "アプリ名は必須です"
26213
+ });
26214
+ if (!value) {
26215
+ console.log(source_default.yellow("キャンセルしました"));
26216
+ return;
26217
+ }
26218
+ appName = value;
26219
+ }
26220
+ const safeNamePattern = /^[a-zA-Z0-9_-]+$/;
26221
+ if (!safeNamePattern.test(domainName)) {
26222
+ console.error(source_default.red("✗ ドメイン名には英数字、ハイフン、アンダースコアのみ使用できます"));
26223
+ process.exit(1);
26224
+ }
26225
+ if (!safeNamePattern.test(appName)) {
26226
+ console.error(source_default.red("✗ アプリ名には英数字、ハイフン、アンダースコアのみ使用できます"));
26227
+ process.exit(1);
26228
+ }
26229
+ const isAddApp = options.addApp ?? false;
26230
+ const files = isAddApp ? generateAppFiles(domainName, appName) : generateAllFiles(domainName, appName);
26231
+ const cwd = process.cwd();
26232
+ const force = options.force ?? false;
26233
+ console.log();
26234
+ console.log(source_default.cyan("初期化設定:"));
26235
+ console.log(source_default.gray(` ドメイン : ${domainName}`));
26236
+ console.log(source_default.gray(` アプリ : ${appName}`));
26237
+ console.log(source_default.gray(` モード : ${isAddApp ? "アプリ追加" : "初回初期化"}`));
26238
+ console.log(source_default.gray(` 上書き : ${force ? "はい" : "いいえ"}`));
26239
+ console.log();
26240
+ const result = writeFiles(cwd, files, force);
26241
+ if (result.created.length > 0) {
26242
+ console.log(source_default.green("作成されたファイル:"));
26243
+ for (const f of result.created) {
26244
+ console.log(source_default.green(` + ${f}`));
26245
+ }
26246
+ }
26247
+ if (result.skipped.length > 0) {
26248
+ console.log();
26249
+ console.log(source_default.yellow("スキップされたファイル(既存):"));
26250
+ for (const f of result.skipped) {
26251
+ console.log(source_default.yellow(` ~ ${f}`));
26252
+ }
26253
+ console.log(source_default.gray(" 上書きするには --force オプションを使用してください"));
26254
+ }
26255
+ if (result.created.length > 0) {
26256
+ console.log();
26257
+ try {
26258
+ for (const f of result.created) {
26259
+ spawnSync("git", ["add", "--", f], {
26260
+ stdio: ["pipe", "pipe", "pipe"]
26261
+ });
26262
+ }
26263
+ console.log(source_default.green(`✓ ${result.created.length} ファイルを git に追加しました`));
26264
+ } catch {
26265
+ console.log(source_default.yellow("⚠ git add に失敗しました。手動で追加してください。"));
26266
+ }
26267
+ console.log();
26268
+ console.log(source_default.cyan("次のステップ:"));
26269
+ console.log(source_default.gray(` git commit -m "Initialize oyster app: ${appName}"`));
26270
+ console.log(source_default.gray(" git push"));
26271
+ console.log(source_default.gray(` oyster deploy -d ${domainName} -a ${appName}`));
26272
+ }
26273
+ } catch (error) {
26274
+ console.error(source_default.red(`✗ ${error.message}`));
26275
+ process.exit(1);
26187
26276
  }
26188
- const prefixText = options.prefixText ?? this.#prefixText;
26189
- const fullPrefixText = this.#getFullPrefixText(prefixText, " ");
26190
- const symbolText = options.symbol ?? " ";
26191
- const text = options.text ?? this.text;
26192
- const separatorText = symbolText ? " " : "";
26193
- const fullText = typeof text === "string" ? separatorText + text : "";
26194
- const suffixText = options.suffixText ?? this.#suffixText;
26195
- const fullSuffixText = this.#getFullSuffixText(suffixText, " ");
26196
- const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText + `
26197
- `;
26198
- this.stop();
26199
- this.#stream.write(textToWrite);
26200
- return this;
26201
- }
26202
- }
26203
- function ora(options) {
26204
- return new Ora(options);
26277
+ });
26205
26278
  }
26206
26279
 
26207
26280
  // src/commands/deploy.ts