enbu 0.4.0 → 0.5.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.mjs CHANGED
@@ -6,6 +6,7 @@ import { basename, join, posix, resolve, win32 } from "node:path";
6
6
  import { access, lstat, mkdir, readFile, readdir, readlink, realpath, writeFile } from "node:fs/promises";
7
7
  import * as actualFS from "node:fs";
8
8
  import { constants } from "node:fs";
9
+ import { createHash } from "node:crypto";
9
10
  import { fileURLToPath } from "node:url";
10
11
  import { lstatSync, readdir as readdir$1, readdirSync, readlinkSync, realpathSync } from "fs";
11
12
  import { EventEmitter } from "node:events";
@@ -1142,7 +1143,7 @@ For more information, visit: https://github.com/9wick/enbu
1142
1143
  * フォールバック値として'0.0.0-dev'を使用します。
1143
1144
  */
1144
1145
  const showVersion = () => {
1145
- process.stdout.write(`0.4.0\n`);
1146
+ process.stdout.write(`0.5.0-beta.1\n`);
1146
1147
  };
1147
1148
 
1148
1149
  //#endregion
@@ -14331,7 +14332,7 @@ var require_public_api = /* @__PURE__ */ __commonJSMin(((exports) => {
14331
14332
  }
14332
14333
  return doc;
14333
14334
  }
14334
- function parse(src, reviver, options) {
14335
+ function parse$1(src, reviver, options) {
14335
14336
  let _reviver = void 0;
14336
14337
  if (typeof reviver === "function") _reviver = reviver;
14337
14338
  else if (options === void 0 && reviver && typeof reviver === "object") options = reviver;
@@ -14358,7 +14359,7 @@ var require_public_api = /* @__PURE__ */ __commonJSMin(((exports) => {
14358
14359
  if (identity$1.isDocument(value) && !_replacer) return value.toString(options);
14359
14360
  return new Document$1.Document(value, _replacer, options).toString(options);
14360
14361
  }
14361
- exports.parse = parse;
14362
+ exports.parse = parse$1;
14362
14363
  exports.parseAllDocuments = parseAllDocuments;
14363
14364
  exports.parseDocument = parseDocument;
14364
14365
  exports.stringify = stringify;
@@ -14572,6 +14573,21 @@ function _joinExpects(values$1, separator) {
14572
14573
  return list[0] ?? "never";
14573
14574
  }
14574
14575
  /**
14576
+ * A Valibot error with useful information.
14577
+ */
14578
+ var ValiError = class extends Error {
14579
+ /**
14580
+ * Creates a Valibot error with useful information.
14581
+ *
14582
+ * @param issues The error issues.
14583
+ */
14584
+ constructor(issues) {
14585
+ super(issues[0].message);
14586
+ this.name = "ValiError";
14587
+ this.issues = issues;
14588
+ }
14589
+ };
14590
+ /**
14575
14591
  * Creates a brand transformation action.
14576
14592
  *
14577
14593
  * @param name The brand name.
@@ -15039,6 +15055,20 @@ function unknown() {
15039
15055
  }
15040
15056
  };
15041
15057
  }
15058
+ /**
15059
+ * Parses an unknown input based on a schema.
15060
+ *
15061
+ * @param schema The schema to be used.
15062
+ * @param input The input to be parsed.
15063
+ * @param config The parse configuration.
15064
+ *
15065
+ * @returns The parsed input.
15066
+ */
15067
+ function parse(schema$6, input, config$1) {
15068
+ const dataset = schema$6["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
15069
+ if (dataset.issues) throw new ValiError(dataset.issues);
15070
+ return dataset.value;
15071
+ }
15042
15072
  /* @__NO_SIDE_EFFECTS__ */
15043
15073
  function pipe(...pipe$1) {
15044
15074
  return {
@@ -15977,6 +16007,11 @@ const resolveEnvVariables = (rawFlow, processEnv, dotEnv) => {
15977
16007
  * - Runtime版スキーマのみを定義(brand/metadata込み)
15978
16008
  * - JSON Schema生成には typeMode: 'input' を使用
15979
16009
  *
16010
+ * 入出力変換:
16011
+ * - YAML入力では `text` キーを使用
16012
+ * - InteractableSelectorSpecSchema: text → interactableText に変換
16013
+ * - AnySelectorSpecSchema: text → anyText に変換
16014
+ *
15980
16015
  * 各セレクタはBranded Typeスキーマを使用し、format検証も行う。
15981
16016
  * これにより1段階で形式検証 + Branded Type化が完了する。
15982
16017
  *
@@ -15991,27 +16026,14 @@ const resolveEnvVariables = (rawFlow, processEnv, dotEnv) => {
15991
16026
  *
15992
16027
  * 出力はBranded Type (CssSelector)
15993
16028
  */
15994
- const CssSelectorSchema$1 = object({ css: pipe(CssSelectorSchema, description("CSSセレクタ形式で要素を指定"), metadata({ exampleValues: ["#login-button", ".submit-btn"] })) });
15995
- /**
15996
- * InteractableTextセレクタスキーマ
15997
- *
15998
- * インタラクティブ要素(ボタン、リンク、入力欄等)をテキスト内容で検索する。
15999
- * click, fill, type, hover, select, assertEnabled, assertChecked で使用。
16000
- * 例: { interactableText: "ログイン" }
16001
- *
16002
- * 出力はBranded Type (InteractableTextSelector)
16003
- */
16004
- const InteractableTextSelectorSchema$1 = object({ interactableText: pipe(InteractableTextSelectorSchema, description("インタラクティブ要素をテキスト内容で検索"), metadata({ exampleValues: ["ログイン", "送信する"] })) });
16029
+ const CssSelectorSchema$1 = object({ css: pipe(CssSelectorSchema, description("Specify element by CSS selector"), metadata({ exampleValues: ["#login-button", ".submit-btn"] })) });
16005
16030
  /**
16006
- * AnyTextセレクタスキーマ
16007
- *
16008
- * 全ての要素(静的テキスト含む)をテキスト内容で検索する。
16009
- * assertVisible, assertNotVisible, scrollIntoView, wait で使用。
16010
- * 例: { anyText: "Welcome" }
16031
+ * テキストセレクタ入力スキーマ(YAML入力用)
16011
16032
  *
16012
- * 出力はBranded Type (AnyTextSelector)
16033
+ * ユーザーは text キーで指定し、内部で用途に応じて
16034
+ * interactableText または anyText に変換される。
16013
16035
  */
16014
- const AnyTextSelectorSchema$1 = object({ anyText: pipe(AnyTextSelectorSchema, description("全要素をテキスト内容で検索"), metadata({ exampleValues: ["Welcome", "エラーメッセージ"] })) });
16036
+ const TextInputSchema = object({ text: pipe(string(), minLength(1, "textセレクタは空文字列にできません"), description("テキスト内容で要素を検索"), metadata({ exampleValues: ["ログイン", "送信"] })) });
16015
16037
  /**
16016
16038
  * XPathセレクタスキーマ
16017
16039
  *
@@ -16020,30 +16042,35 @@ const AnyTextSelectorSchema$1 = object({ anyText: pipe(AnyTextSelectorSchema, de
16020
16042
  *
16021
16043
  * 出力はBranded Type (XpathSelector)
16022
16044
  */
16023
- const XpathSelectorSchema$1 = object({ xpath: pipe(XpathSelectorSchema, description("XPath形式で要素を指定"), metadata({ exampleValues: ["//button[@type='submit']"] })) });
16045
+ const XpathSelectorSchema$1 = object({ xpath: pipe(XpathSelectorSchema, description("Specify element by XPath"), metadata({ exampleValues: ["//button[@type='submit']"] })) });
16024
16046
  /**
16025
16047
  * インタラクティブ要素用セレクタ指定スキーマ
16026
16048
  *
16027
- * css, interactableText, xpath のいずれか1つのみを指定する。
16049
+ * 入力: css, text, xpath のいずれか1つのみを指定する。
16050
+ * text入力の場合、transformで `{ interactableText: ... }` に変換される。
16028
16051
  * click, fill, type, hover, select, assertEnabled, assertChecked で使用。
16029
16052
  */
16030
- const InteractableSelectorSpecSchema = union([
16053
+ const InteractableSelectorSpecSchema = pipe(union([
16031
16054
  CssSelectorSchema$1,
16032
- InteractableTextSelectorSchema$1,
16055
+ TextInputSchema,
16033
16056
  XpathSelectorSchema$1
16034
- ]);
16057
+ ]), transform((input) => M(input).with({ text: z.string }, ({ text }) => {
16058
+ return { interactableText: parse(InteractableTextSelectorSchema, text) };
16059
+ }).with({ css: z._ }, (cssInput) => cssInput).with({ xpath: z._ }, (xpathInput) => xpathInput).exhaustive()));
16035
16060
  /**
16036
16061
  * 全要素用セレクタ指定スキーマ
16037
16062
  *
16038
- * css, anyText, xpath のいずれか1つのみを指定する。
16063
+ * 入力: css, text, xpath のいずれか1つのみを指定する。
16064
+ * text入力の場合、transformで `{ anyText: ... }` に変換される。
16039
16065
  * assertVisible, assertNotVisible, scrollIntoView, wait で使用。
16040
16066
  */
16041
- const AnySelectorSpecSchema = union([
16067
+ const AnySelectorSpecSchema = pipe(union([
16042
16068
  CssSelectorSchema$1,
16043
- AnyTextSelectorSchema$1,
16069
+ TextInputSchema,
16044
16070
  XpathSelectorSchema$1
16045
- ]);
16046
- union([InteractableSelectorSpecSchema, AnySelectorSpecSchema]);
16071
+ ]), transform((input) => M(input).with({ text: z.string }, ({ text }) => {
16072
+ return { anyText: parse(AnyTextSelectorSchema, text) };
16073
+ }).with({ css: z._ }, (cssInput) => cssInput).with({ xpath: z._ }, (xpathInput) => xpathInput).exhaustive()));
16047
16074
  /**
16048
16075
  * Clickコマンドスキーマ定義
16049
16076
  *
@@ -16067,7 +16094,7 @@ union([InteractableSelectorSpecSchema, AnySelectorSpecSchema]);
16067
16094
  * 文字列を直接指定した場合、インタラクティブ要素のテキスト検索として解釈する。
16068
16095
  * InteractableTextSelectorとしてBranded Type化される。
16069
16096
  */
16070
- const ClickShorthandSchema = pipe(object({ click: pipe(InteractableTextSelectorSchema, metadata({ exampleValues: ["ログイン", "送信ボタン"] })) }), metadata({ description: "テキストで要素を指定してクリック" }), transform((input) => ({
16097
+ const ClickShorthandSchema = pipe(object({ click: pipe(InteractableTextSelectorSchema, metadata({ exampleValues: ["Login", "Submit button"] })) }), metadata({ description: "Click on element specified by text" }), transform((input) => ({
16071
16098
  command: "click",
16072
16099
  interactableText: input.click
16073
16100
  })));
@@ -16080,7 +16107,7 @@ const ClickShorthandSchema = pipe(object({ click: pipe(InteractableTextSelectorS
16080
16107
  *
16081
16108
  * InteractableSelectorSpecSchemaを使用。format検証 + Branded Type化が1段階で完了。
16082
16109
  */
16083
- const ClickDetailedSchema = pipe(object({ click: InteractableSelectorSpecSchema }), metadata({ description: "セレクタで要素を指定してクリック" }), transform((input) => {
16110
+ const ClickDetailedSchema = pipe(object({ click: InteractableSelectorSpecSchema }), metadata({ description: "Click on element specified by selector" }), transform((input) => {
16084
16111
  return {
16085
16112
  command: "click",
16086
16113
  ...input.click
@@ -16095,7 +16122,7 @@ const ClickDetailedSchema = pipe(object({ click: InteractableSelectorSpecSchema
16095
16122
  * JSON Schema生成には typeMode: 'input' を使用し、
16096
16123
  * このRuntime版スキーマから入力形式のJSON Schemaを生成する。
16097
16124
  */
16098
- const ClickYamlSchema = pipe(union([ClickShorthandSchema, ClickDetailedSchema]), description("要素をクリックする"), metadata({ category: "インタラクション" }));
16125
+ const ClickYamlSchema = pipe(union([ClickShorthandSchema, ClickDetailedSchema]), description("要素をクリックする"), metadata({ category: "Interaction" }));
16099
16126
  /**
16100
16127
  * Hoverコマンドスキーマ定義
16101
16128
  *
@@ -16119,7 +16146,7 @@ const ClickYamlSchema = pipe(union([ClickShorthandSchema, ClickDetailedSchema]),
16119
16146
  * 文字列を直接指定した場合、インタラクティブ要素のテキスト検索として解釈する。
16120
16147
  * InteractableTextSelectorとしてBranded Type化される。
16121
16148
  */
16122
- const HoverShorthandSchema = pipe(object({ hover: pipe(InteractableTextSelectorSchema, metadata({ exampleValues: ["ログイン", "メニュー"] })) }), metadata({ description: "テキストで要素を指定してホバー" }), transform((input) => ({
16149
+ const HoverShorthandSchema = pipe(object({ hover: pipe(InteractableTextSelectorSchema, metadata({ exampleValues: ["Login", "Menu"] })) }), metadata({ description: "Hover over element specified by text" }), transform((input) => ({
16123
16150
  command: "hover",
16124
16151
  interactableText: input.hover
16125
16152
  })));
@@ -16132,7 +16159,7 @@ const HoverShorthandSchema = pipe(object({ hover: pipe(InteractableTextSelectorS
16132
16159
  *
16133
16160
  * InteractableSelectorSpecSchemaを使用。format検証 + Branded Type化が1段階で完了。
16134
16161
  */
16135
- const HoverDetailedSchema = pipe(object({ hover: InteractableSelectorSpecSchema }), metadata({ description: "セレクタで要素を指定してホバー" }), transform((input) => {
16162
+ const HoverDetailedSchema = pipe(object({ hover: InteractableSelectorSpecSchema }), metadata({ description: "Hover over element specified by selector" }), transform((input) => {
16136
16163
  return {
16137
16164
  command: "hover",
16138
16165
  ...input.hover
@@ -16147,7 +16174,7 @@ const HoverDetailedSchema = pipe(object({ hover: InteractableSelectorSpecSchema
16147
16174
  * JSON Schema生成には typeMode: 'input' を使用し、
16148
16175
  * このRuntime版スキーマから入力形式のJSON Schemaを生成する。
16149
16176
  */
16150
- const HoverYamlSchema = pipe(union([HoverShorthandSchema, HoverDetailedSchema]), description("要素にホバーする"), metadata({ category: "インタラクション" }));
16177
+ const HoverYamlSchema = pipe(union([HoverShorthandSchema, HoverDetailedSchema]), description("要素にホバーする"), metadata({ category: "Interaction" }));
16151
16178
  /**
16152
16179
  * ScrollIntoViewコマンドスキーマ定義
16153
16180
  *
@@ -16171,7 +16198,7 @@ const HoverYamlSchema = pipe(union([HoverShorthandSchema, HoverDetailedSchema]),
16171
16198
  * 文字列を直接指定した場合、全要素をテキスト検索として解釈する。
16172
16199
  * AnyTextSelectorとしてBranded Type化される。
16173
16200
  */
16174
- const ScrollIntoViewShorthandSchema = pipe(object({ scrollIntoView: pipe(AnyTextSelectorSchema, metadata({ exampleValues: ["送信ボタン", "フッター"] })) }), metadata({ description: "テキストで要素を指定してスクロール" }), transform((input) => ({
16201
+ const ScrollIntoViewShorthandSchema = pipe(object({ scrollIntoView: pipe(AnyTextSelectorSchema, metadata({ exampleValues: ["Submit button", "Footer"] })) }), metadata({ description: "Scroll to element specified by text" }), transform((input) => ({
16175
16202
  command: "scrollIntoView",
16176
16203
  anyText: input.scrollIntoView
16177
16204
  })));
@@ -16184,7 +16211,7 @@ const ScrollIntoViewShorthandSchema = pipe(object({ scrollIntoView: pipe(AnyText
16184
16211
  *
16185
16212
  * AnySelectorSpecSchemaを使用。format検証 + Branded Type化が1段階で完了。
16186
16213
  */
16187
- const ScrollIntoViewDetailedSchema = pipe(object({ scrollIntoView: AnySelectorSpecSchema }), metadata({ description: "セレクタで要素を指定してスクロール" }), transform((input) => {
16214
+ const ScrollIntoViewDetailedSchema = pipe(object({ scrollIntoView: AnySelectorSpecSchema }), metadata({ description: "Scroll to element specified by selector" }), transform((input) => {
16188
16215
  return {
16189
16216
  command: "scrollIntoView",
16190
16217
  ...input.scrollIntoView
@@ -16199,7 +16226,7 @@ const ScrollIntoViewDetailedSchema = pipe(object({ scrollIntoView: AnySelectorSp
16199
16226
  * JSON Schema生成には typeMode: 'input' を使用し、
16200
16227
  * このRuntime版スキーマから入力形式のJSON Schemaを生成する。
16201
16228
  */
16202
- const ScrollIntoViewYamlSchema = pipe(union([ScrollIntoViewShorthandSchema, ScrollIntoViewDetailedSchema]), description("要素が表示されるまでスクロール"), metadata({ category: "ナビゲーション" }));
16229
+ const ScrollIntoViewYamlSchema = pipe(union([ScrollIntoViewShorthandSchema, ScrollIntoViewDetailedSchema]), description("要素が表示されるまでスクロール"), metadata({ category: "Navigation" }));
16203
16230
  /**
16204
16231
  * スクロールコマンドスキーマ定義
16205
16232
  *
@@ -16224,7 +16251,7 @@ const ScrollDirectionSchema = pipe(picklist([
16224
16251
  "down",
16225
16252
  "left",
16226
16253
  "right"
16227
- ]), description("スクロール方向"));
16254
+ ]), description("Scroll direction"));
16228
16255
  /**
16229
16256
  * ScrollコマンドYAMLスキーマ(Single Source of Truth)
16230
16257
  *
@@ -16236,14 +16263,14 @@ const ScrollDirectionSchema = pipe(picklist([
16236
16263
  */
16237
16264
  const ScrollYamlSchema = pipe(object({ scroll: pipe(object({
16238
16265
  direction: ScrollDirectionSchema,
16239
- amount: pipe(number(), description("スクロール量(ピクセル)"), metadata({ exampleValues: [100, 500] }))
16266
+ amount: pipe(number(), description("Scroll amount (pixels)"), metadata({ exampleValues: [100, 500] }))
16240
16267
  }), metadata({ exampleValues: [{
16241
16268
  direction: "down",
16242
16269
  amount: 300
16243
16270
  }, {
16244
16271
  direction: "up",
16245
16272
  amount: 100
16246
- }] })) }), description("ページをスクロールする"), metadata({ category: "ナビゲーション" }), transform((input) => ({
16273
+ }] })) }), description("ページをスクロールする"), metadata({ category: "Navigation" }), transform((input) => ({
16247
16274
  command: "scroll",
16248
16275
  direction: input.scroll.direction,
16249
16276
  amount: input.scroll.amount
@@ -16278,32 +16305,34 @@ const LoadStateSchema = pipe(picklist([
16278
16305
  "load",
16279
16306
  "domcontentloaded",
16280
16307
  "networkidle"
16281
- ]), description("ページの読み込み状態"));
16282
- const WaitMsSchema = pipe(object({ wait: pipe(number(), description("待機時間(ミリ秒)"), metadata({ exampleValues: [1e3, 3e3] })) }), metadata({ description: "指定ミリ秒待機" }), transform((input) => ({
16308
+ ]), description("Page load state"));
16309
+ const WaitMsSchema = pipe(object({ wait: pipe(number(), description("Wait time (milliseconds)"), metadata({ exampleValues: [1e3, 3e3] })) }), metadata({ description: "Wait for specified milliseconds" }), transform((input) => ({
16283
16310
  command: "wait",
16284
16311
  ms: input.wait
16285
16312
  })));
16286
- const WaitCssSchema = pipe(object({ wait: object({ css: pipe(CssSelectorSchema, description("CSSセレクタ形式で要素を指定"), metadata({ exampleValues: ["#login-button", ".submit-btn"] })) }) }), metadata({ description: "CSSセレクタで指定した要素が表示されるまで待機" }), transform((input) => ({
16313
+ const WaitCssSchema = pipe(object({ wait: object({ css: pipe(CssSelectorSchema, description("Specify element by CSS selector"), metadata({ exampleValues: ["#login-button", ".submit-btn"] })) }) }), metadata({ description: "Wait until element specified by CSS selector is visible" }), transform((input) => ({
16287
16314
  command: "wait",
16288
16315
  css: input.wait.css
16289
16316
  })));
16290
- const WaitAnyTextSchema = pipe(object({ wait: object({ anyText: pipe(AnyTextSelectorSchema, description("全要素をテキスト内容で検索"), metadata({ exampleValues: ["ログイン", "送信する"] })) }) }), metadata({ description: "テキストで指定した要素が表示されるまで待機" }), transform((input) => ({
16291
- command: "wait",
16292
- anyText: input.wait.anyText
16293
- })));
16294
- const WaitXpathSchema = pipe(object({ wait: object({ xpath: pipe(XpathSelectorSchema, description("XPath形式で要素を指定"), metadata({ exampleValues: ["//button[@type='submit']"] })) }) }), metadata({ description: "XPathで指定した要素が表示されるまで待機" }), transform((input) => ({
16317
+ const WaitTextSchema = pipe(object({ wait: object({ text: pipe(string(), minLength(1, "textセレクタは空文字列にできません"), description("テキスト内容で要素を検索"), metadata({ exampleValues: ["ログイン", "送信"] })) }) }), metadata({ description: "Wait until element specified by text is visible" }), transform((input) => {
16318
+ return {
16319
+ command: "wait",
16320
+ anyText: parse(AnyTextSelectorSchema, input.wait.text)
16321
+ };
16322
+ }));
16323
+ const WaitXpathSchema = pipe(object({ wait: object({ xpath: pipe(XpathSelectorSchema, description("Specify element by XPath"), metadata({ exampleValues: ["//button[@type='submit']"] })) }) }), metadata({ description: "Wait until element specified by XPath is visible" }), transform((input) => ({
16295
16324
  command: "wait",
16296
16325
  xpath: input.wait.xpath
16297
16326
  })));
16298
- const WaitLoadSchema = pipe(object({ wait: object({ load: pipe(LoadStateSchema, metadata({ exampleValues: ["networkidle", "domcontentloaded"] })) }) }), metadata({ description: "ページの読み込み状態が指定の状態になるまで待機" }), transform((input) => ({
16327
+ const WaitLoadSchema = pipe(object({ wait: object({ load: pipe(LoadStateSchema, metadata({ exampleValues: ["networkidle", "domcontentloaded"] })) }) }), metadata({ description: "Wait until page reaches specified load state" }), transform((input) => ({
16299
16328
  command: "wait",
16300
16329
  load: input.wait.load
16301
16330
  })));
16302
- const WaitUrlSchema = pipe(object({ wait: object({ url: pipe(string(), description("待機するURL(部分一致)"), metadata({ exampleValues: ["https://example.com", "/dashboard"] })) }) }), metadata({ description: "URLが指定の文字列を含むまで待機" }), transform((input) => ({
16331
+ const WaitUrlSchema = pipe(object({ wait: object({ url: pipe(string(), description("URL to wait for (partial match)"), metadata({ exampleValues: ["https://example.com", "/dashboard"] })) }) }), metadata({ description: "Wait until URL contains specified string" }), transform((input) => ({
16303
16332
  command: "wait",
16304
16333
  url: input.wait.url
16305
16334
  })));
16306
- const WaitFnSchema = pipe(object({ wait: object({ fn: pipe(JsExpressionSchema, description("待機条件の関数"), metadata({ exampleValues: ["() => document.readyState === \"complete\""] })) }) }), metadata({ description: "関数が真を返すまで待機" }), transform((input) => ({
16335
+ const WaitFnSchema = pipe(object({ wait: object({ fn: pipe(JsExpressionSchema, description("Wait condition function"), metadata({ exampleValues: ["() => document.readyState === \"complete\""] })) }) }), metadata({ description: "Wait until function returns true" }), transform((input) => ({
16307
16336
  command: "wait",
16308
16337
  fn: input.wait.fn
16309
16338
  })));
@@ -16318,12 +16347,12 @@ const WaitFnSchema = pipe(object({ wait: object({ fn: pipe(JsExpressionSchema, d
16318
16347
  const WaitYamlSchema = pipe(union([
16319
16348
  WaitMsSchema,
16320
16349
  WaitCssSchema,
16321
- WaitAnyTextSchema,
16350
+ WaitTextSchema,
16322
16351
  WaitXpathSchema,
16323
16352
  WaitLoadSchema,
16324
16353
  WaitUrlSchema,
16325
16354
  WaitFnSchema
16326
- ]), description("指定の条件まで待機する"), metadata({ category: "待機" }));
16355
+ ]), description("指定の条件まで待機する"), metadata({ category: "Wait" }));
16327
16356
  /**
16328
16357
  * Assert系コマンドスキーマ定義
16329
16358
  *
@@ -16357,7 +16386,7 @@ const WaitYamlSchema = pipe(union([
16357
16386
  * 文字列を直接指定した場合、全要素をテキスト検索として解釈する。
16358
16387
  * AnyTextSelectorとしてBranded Type化される。
16359
16388
  */
16360
- const AssertVisibleShorthandSchema = pipe(object({ assertVisible: pipe(AnyTextSelectorSchema, metadata({ exampleValues: ["ログインボタン", "送信完了"] })) }), metadata({ description: "テキストで要素を指定して表示を検証" }), transform((input) => ({
16389
+ const AssertVisibleShorthandSchema = pipe(object({ assertVisible: pipe(AnyTextSelectorSchema, metadata({ exampleValues: ["Login button", "Submit completed"] })) }), metadata({ description: "テキストで要素を指定して表示を検証" }), transform((input) => ({
16361
16390
  command: "assertVisible",
16362
16391
  anyText: input.assertVisible
16363
16392
  })));
@@ -16385,7 +16414,7 @@ const AssertVisibleDetailedSchema = pipe(object({ assertVisible: AnySelectorSpec
16385
16414
  * JSON Schema生成には typeMode: 'input' を使用し、
16386
16415
  * このRuntime版スキーマから入力形式のJSON Schemaを生成する。
16387
16416
  */
16388
- const AssertVisibleYamlSchema = pipe(union([AssertVisibleShorthandSchema, AssertVisibleDetailedSchema]), description("要素が表示されていることを検証する"), metadata({ category: "検証" }));
16417
+ const AssertVisibleYamlSchema = pipe(union([AssertVisibleShorthandSchema, AssertVisibleDetailedSchema]), description("要素が表示されていることを検証する"), metadata({ category: "Assertion" }));
16389
16418
  /**
16390
16419
  * 簡略形式スキーマ
16391
16420
  *
@@ -16393,7 +16422,7 @@ const AssertVisibleYamlSchema = pipe(union([AssertVisibleShorthandSchema, Assert
16393
16422
  * 文字列を直接指定した場合、全要素をテキスト検索として解釈する。
16394
16423
  * AnyTextSelectorとしてBranded Type化される。
16395
16424
  */
16396
- const AssertNotVisibleShorthandSchema = pipe(object({ assertNotVisible: pipe(AnyTextSelectorSchema, metadata({ exampleValues: ["エラーメッセージ", "非表示要素"] })) }), metadata({ description: "テキストで要素を指定して非表示を検証" }), transform((input) => ({
16425
+ const AssertNotVisibleShorthandSchema = pipe(object({ assertNotVisible: pipe(AnyTextSelectorSchema, metadata({ exampleValues: ["Error message", "Hidden element"] })) }), metadata({ description: "テキストで要素を指定して非表示を検証" }), transform((input) => ({
16397
16426
  command: "assertNotVisible",
16398
16427
  anyText: input.assertNotVisible
16399
16428
  })));
@@ -16421,7 +16450,7 @@ const AssertNotVisibleDetailedSchema = pipe(object({ assertNotVisible: AnySelect
16421
16450
  * JSON Schema生成には typeMode: 'input' を使用し、
16422
16451
  * このRuntime版スキーマから入力形式のJSON Schemaを生成する。
16423
16452
  */
16424
- const AssertNotVisibleYamlSchema = pipe(union([AssertNotVisibleShorthandSchema, AssertNotVisibleDetailedSchema]), description("要素が非表示であることを検証する"), metadata({ category: "検証" }));
16453
+ const AssertNotVisibleYamlSchema = pipe(union([AssertNotVisibleShorthandSchema, AssertNotVisibleDetailedSchema]), description("要素が非表示であることを検証する"), metadata({ category: "Assertion" }));
16425
16454
  /**
16426
16455
  * 簡略形式スキーマ
16427
16456
  *
@@ -16429,7 +16458,7 @@ const AssertNotVisibleYamlSchema = pipe(union([AssertNotVisibleShorthandSchema,
16429
16458
  * 文字列を直接指定した場合、インタラクティブ要素のテキスト検索として解釈する。
16430
16459
  * InteractableTextSelectorとしてBranded Type化される。
16431
16460
  */
16432
- const AssertEnabledShorthandSchema = pipe(object({ assertEnabled: pipe(InteractableTextSelectorSchema, metadata({ exampleValues: ["送信ボタン", "入力フィールド"] })) }), metadata({ description: "テキストで要素を指定して有効を検証" }), transform((input) => ({
16461
+ const AssertEnabledShorthandSchema = pipe(object({ assertEnabled: pipe(InteractableTextSelectorSchema, metadata({ exampleValues: ["Submit button", "Input field"] })) }), metadata({ description: "テキストで要素を指定して有効を検証" }), transform((input) => ({
16433
16462
  command: "assertEnabled",
16434
16463
  interactableText: input.assertEnabled
16435
16464
  })));
@@ -16457,7 +16486,7 @@ const AssertEnabledDetailedSchema = pipe(object({ assertEnabled: InteractableSel
16457
16486
  * JSON Schema生成には typeMode: 'input' を使用し、
16458
16487
  * このRuntime版スキーマから入力形式のJSON Schemaを生成する。
16459
16488
  */
16460
- const AssertEnabledYamlSchema = pipe(union([AssertEnabledShorthandSchema, AssertEnabledDetailedSchema]), description("要素が有効であることを検証する"), metadata({ category: "検証" }));
16489
+ const AssertEnabledYamlSchema = pipe(union([AssertEnabledShorthandSchema, AssertEnabledDetailedSchema]), description("要素が有効であることを検証する"), metadata({ category: "Assertion" }));
16461
16490
  /**
16462
16491
  * 簡略形式スキーマ
16463
16492
  *
@@ -16466,7 +16495,7 @@ const AssertEnabledYamlSchema = pipe(union([AssertEnabledShorthandSchema, Assert
16466
16495
  * checkedフィールドは省略されるため、UseDefaultになる。
16467
16496
  * InteractableTextSelectorとしてBranded Type化される。
16468
16497
  */
16469
- const AssertCheckedShorthandSchema = pipe(object({ assertChecked: pipe(InteractableTextSelectorSchema, metadata({ exampleValues: ["利用規約に同意", "メール通知を有効化"] })) }), metadata({ description: "テキストで要素を指定してチェック状態を検証" }), transform((input) => ({
16498
+ const AssertCheckedShorthandSchema = pipe(object({ assertChecked: pipe(InteractableTextSelectorSchema, metadata({ exampleValues: ["Agree to terms", "Enable email notifications"] })) }), metadata({ description: "テキストで要素を指定してチェック状態を検証" }), transform((input) => ({
16470
16499
  command: "assertChecked",
16471
16500
  interactableText: input.assertChecked,
16472
16501
  checked: UseDefault
@@ -16487,16 +16516,20 @@ const AssertCheckedCssSchema = pipe(object({ assertChecked: object({
16487
16516
  checked: input.assertChecked.checked ?? UseDefault
16488
16517
  })));
16489
16518
  /**
16490
- * assertChecked: { interactableText: "...", checked?: boolean }
16519
+ * assertChecked: { text: "...", checked?: boolean }
16520
+ *
16521
+ * YAML入力形式は text を使用し、内部で interactableText に変換される。
16491
16522
  */
16492
- const AssertCheckedInteractableTextSchema = pipe(object({ assertChecked: object({
16493
- interactableText: pipe(InteractableTextSelectorSchema, description("インタラクティブ要素をテキスト内容で検索"), metadata({ exampleValues: ["利用規約に同意", "メール通知を有効化"] })),
16523
+ const AssertCheckedTextSchema = pipe(object({ assertChecked: object({
16524
+ text: pipe(string(), minLength(1, "textセレクタは空文字列にできません"), description("テキスト内容で要素を検索"), metadata({ exampleValues: ["同意する", "通知を有効にする"] })),
16494
16525
  checked: CheckedFieldSchema
16495
- }) }), metadata({ description: "テキストで要素を指定してチェック状態を検証" }), transform((input) => ({
16496
- command: "assertChecked",
16497
- interactableText: input.assertChecked.interactableText,
16498
- checked: input.assertChecked.checked ?? UseDefault
16499
- })));
16526
+ }) }), metadata({ description: "テキストで要素を指定してチェック状態を検証" }), transform((input) => {
16527
+ return {
16528
+ command: "assertChecked",
16529
+ interactableText: parse(InteractableTextSelectorSchema, input.assertChecked.text),
16530
+ checked: input.assertChecked.checked ?? UseDefault
16531
+ };
16532
+ }));
16500
16533
  /**
16501
16534
  * assertChecked: { xpath: "...", checked?: boolean }
16502
16535
  */
@@ -16513,10 +16546,12 @@ const AssertCheckedXpathSchema = pipe(object({ assertChecked: object({
16513
16546
  *
16514
16547
  * 3種類のセレクタをunionで組み合わせる。
16515
16548
  * checkedが省略された場合はUseDefaultになる。
16549
+ *
16550
+ * 注意: text キーを入力として受け入れ、内部で interactableText に変換する。
16516
16551
  */
16517
16552
  const AssertCheckedDetailedSchema = union([
16518
16553
  AssertCheckedCssSchema,
16519
- AssertCheckedInteractableTextSchema,
16554
+ AssertCheckedTextSchema,
16520
16555
  AssertCheckedXpathSchema
16521
16556
  ]);
16522
16557
  /**
@@ -16528,7 +16563,7 @@ const AssertCheckedDetailedSchema = union([
16528
16563
  * JSON Schema生成には typeMode: 'input' を使用し、
16529
16564
  * このRuntime版スキーマから入力形式のJSON Schemaを生成する。
16530
16565
  */
16531
- const AssertCheckedYamlSchema = pipe(union([AssertCheckedShorthandSchema, AssertCheckedDetailedSchema]), description("チェックボックス/ラジオボタンの状態を検証する"), metadata({ category: "検証" }));
16566
+ const AssertCheckedYamlSchema = pipe(union([AssertCheckedShorthandSchema, AssertCheckedDetailedSchema]), description("チェックボックス/ラジオボタンの状態を検証する"), metadata({ category: "Assertion" }));
16532
16567
  /**
16533
16568
  * 入力系コマンドスキーマ定義
16534
16569
  *
@@ -16552,36 +16587,40 @@ const AssertCheckedYamlSchema = pipe(union([AssertCheckedShorthandSchema, Assert
16552
16587
  /**
16553
16588
  * valueフィールドスキーマ(type用)
16554
16589
  */
16555
- const TypeValueSchema = pipe(string(), description("入力するテキスト"), metadata({ exampleValues: ["ユーザー名", "test@example.com"] }));
16590
+ const TypeValueSchema = pipe(string(), description("Text to input"), metadata({ exampleValues: ["Username", "test@example.com"] }));
16556
16591
  /**
16557
16592
  * type: { css: "...", value: "..." }
16558
16593
  */
16559
16594
  const TypeCssSchema = pipe(object({ type: object({
16560
- css: pipe(CssSelectorSchema, description("CSSセレクタ形式で要素を指定"), metadata({ exampleValues: ["#username", ".email-input"] })),
16595
+ css: pipe(CssSelectorSchema, description("Specify element by CSS selector"), metadata({ exampleValues: ["#username", ".email-input"] })),
16561
16596
  value: TypeValueSchema
16562
- }) }), metadata({ description: "CSSセレクタで要素を指定して入力" }), transform((input) => ({
16597
+ }) }), metadata({ description: "Input to element specified by CSS selector" }), transform((input) => ({
16563
16598
  command: "type",
16564
16599
  css: input.type.css,
16565
16600
  value: input.type.value
16566
16601
  })));
16567
16602
  /**
16568
- * type: { interactableText: "...", value: "..." }
16603
+ * type: { text: "...", value: "..." }
16604
+ *
16605
+ * YAML入力形式は text を使用し、内部で interactableText に変換される。
16569
16606
  */
16570
- const TypeInteractableTextSchema = pipe(object({ type: object({
16571
- interactableText: pipe(InteractableTextSelectorSchema, description("インタラクティブ要素をテキスト内容で検索"), metadata({ exampleValues: ["メールアドレス", "ユーザー名"] })),
16607
+ const TypeTextSchema = pipe(object({ type: object({
16608
+ text: pipe(string(), minLength(1, "textセレクタは空文字列にできません"), description("テキスト内容で要素を検索"), metadata({ exampleValues: ["メールアドレス", "ユーザー名"] })),
16572
16609
  value: TypeValueSchema
16573
- }) }), metadata({ description: "テキストで要素を指定して入力" }), transform((input) => ({
16574
- command: "type",
16575
- interactableText: input.type.interactableText,
16576
- value: input.type.value
16577
- })));
16610
+ }) }), metadata({ description: "Input to element specified by text" }), transform((input) => {
16611
+ return {
16612
+ command: "type",
16613
+ interactableText: parse(InteractableTextSelectorSchema, input.type.text),
16614
+ value: input.type.value
16615
+ };
16616
+ }));
16578
16617
  /**
16579
16618
  * type: { xpath: "...", value: "..." }
16580
16619
  */
16581
16620
  const TypeXpathSchema = pipe(object({ type: object({
16582
- xpath: pipe(XpathSelectorSchema, description("XPath形式で要素を指定"), metadata({ exampleValues: ["//input[@name='email']"] })),
16621
+ xpath: pipe(XpathSelectorSchema, description("Specify element by XPath"), metadata({ exampleValues: ["//input[@name='email']"] })),
16583
16622
  value: TypeValueSchema
16584
- }) }), metadata({ description: "XPathで要素を指定して入力" }), transform((input) => ({
16623
+ }) }), metadata({ description: "Input to element specified by XPath" }), transform((input) => ({
16585
16624
  command: "type",
16586
16625
  xpath: input.type.xpath,
16587
16626
  value: input.type.value
@@ -16596,42 +16635,46 @@ const TypeXpathSchema = pipe(object({ type: object({
16596
16635
  */
16597
16636
  const TypeYamlSchema = pipe(union([
16598
16637
  TypeCssSchema,
16599
- TypeInteractableTextSchema,
16638
+ TypeTextSchema,
16600
16639
  TypeXpathSchema
16601
- ]), description("要素にテキストを入力する(既存テキストに追加)"), metadata({ category: "入力" }));
16640
+ ]), description("要素にテキストを入力する(既存テキストに追加)"), metadata({ category: "Input" }));
16602
16641
  /**
16603
16642
  * valueフィールドスキーマ(fill用)
16604
16643
  */
16605
- const FillValueSchema = pipe(string(), description("入力するテキスト(既存テキストをクリアして入力)"), metadata({ exampleValues: ["新しいユーザー名", "new@example.com"] }));
16644
+ const FillValueSchema = pipe(string(), description("Text to input (clears existing text)"), metadata({ exampleValues: ["New username", "new@example.com"] }));
16606
16645
  /**
16607
16646
  * fill: { css: "...", value: "..." }
16608
16647
  */
16609
16648
  const FillCssSchema = pipe(object({ fill: object({
16610
- css: pipe(CssSelectorSchema, description("CSSセレクタ形式で要素を指定"), metadata({ exampleValues: ["#email", ".password-input"] })),
16649
+ css: pipe(CssSelectorSchema, description("Specify element by CSS selector"), metadata({ exampleValues: ["#email", ".password-input"] })),
16611
16650
  value: FillValueSchema
16612
- }) }), metadata({ description: "CSSセレクタで要素を指定して入力" }), transform((input) => ({
16651
+ }) }), metadata({ description: "Fill element specified by CSS selector" }), transform((input) => ({
16613
16652
  command: "fill",
16614
16653
  css: input.fill.css,
16615
16654
  value: input.fill.value
16616
16655
  })));
16617
16656
  /**
16618
- * fill: { interactableText: "...", value: "..." }
16657
+ * fill: { text: "...", value: "..." }
16658
+ *
16659
+ * YAML入力形式は text を使用し、内部で interactableText に変換される。
16619
16660
  */
16620
- const FillInteractableTextSchema = pipe(object({ fill: object({
16621
- interactableText: pipe(InteractableTextSelectorSchema, description("インタラクティブ要素をテキスト内容で検索"), metadata({ exampleValues: ["メールアドレス", "パスワード"] })),
16661
+ const FillTextSchema = pipe(object({ fill: object({
16662
+ text: pipe(string(), minLength(1, "textセレクタは空文字列にできません"), description("テキスト内容で要素を検索"), metadata({ exampleValues: ["メールアドレス", "パスワード"] })),
16622
16663
  value: FillValueSchema
16623
- }) }), metadata({ description: "テキストで要素を指定して入力" }), transform((input) => ({
16624
- command: "fill",
16625
- interactableText: input.fill.interactableText,
16626
- value: input.fill.value
16627
- })));
16664
+ }) }), metadata({ description: "Fill element specified by text" }), transform((input) => {
16665
+ return {
16666
+ command: "fill",
16667
+ interactableText: parse(InteractableTextSelectorSchema, input.fill.text),
16668
+ value: input.fill.value
16669
+ };
16670
+ }));
16628
16671
  /**
16629
16672
  * fill: { xpath: "...", value: "..." }
16630
16673
  */
16631
16674
  const FillXpathSchema = pipe(object({ fill: object({
16632
- xpath: pipe(XpathSelectorSchema, description("XPath形式で要素を指定"), metadata({ exampleValues: ["//input[@type='password']"] })),
16675
+ xpath: pipe(XpathSelectorSchema, description("Specify element by XPath"), metadata({ exampleValues: ["//input[@type='password']"] })),
16633
16676
  value: FillValueSchema
16634
- }) }), metadata({ description: "XPathで要素を指定して入力" }), transform((input) => ({
16677
+ }) }), metadata({ description: "Fill element specified by XPath" }), transform((input) => ({
16635
16678
  command: "fill",
16636
16679
  xpath: input.fill.xpath,
16637
16680
  value: input.fill.value
@@ -16646,42 +16689,46 @@ const FillXpathSchema = pipe(object({ fill: object({
16646
16689
  */
16647
16690
  const FillYamlSchema = pipe(union([
16648
16691
  FillCssSchema,
16649
- FillInteractableTextSchema,
16692
+ FillTextSchema,
16650
16693
  FillXpathSchema
16651
- ]), description("要素にテキストを入力する(既存テキストをクリアして入力)"), metadata({ category: "入力" }));
16694
+ ]), description("要素にテキストを入力する(既存テキストをクリアして入力)"), metadata({ category: "Input" }));
16652
16695
  /**
16653
16696
  * valueフィールドスキーマ(select用)
16654
16697
  */
16655
- const SelectValueSchema = pipe(string(), description("選択するオプションの値"), metadata({ exampleValues: ["japan", "option1"] }));
16698
+ const SelectValueSchema = pipe(string(), description("Option value to select"), metadata({ exampleValues: ["japan", "option1"] }));
16656
16699
  /**
16657
16700
  * select: { css: "...", value: "..." }
16658
16701
  */
16659
16702
  const SelectCssSchema = pipe(object({ select: object({
16660
- css: pipe(CssSelectorSchema, description("CSSセレクタ形式で要素を指定"), metadata({ exampleValues: ["#country", ".language-select"] })),
16703
+ css: pipe(CssSelectorSchema, description("Specify element by CSS selector"), metadata({ exampleValues: ["#country", ".language-select"] })),
16661
16704
  value: SelectValueSchema
16662
- }) }), metadata({ description: "CSSセレクタで要素を指定して選択" }), transform((input) => ({
16705
+ }) }), metadata({ description: "Select option from element specified by CSS selector" }), transform((input) => ({
16663
16706
  command: "select",
16664
16707
  css: input.select.css,
16665
16708
  value: input.select.value
16666
16709
  })));
16667
16710
  /**
16668
- * select: { interactableText: "...", value: "..." }
16711
+ * select: { text: "...", value: "..." }
16712
+ *
16713
+ * YAML入力形式は text を使用し、内部で interactableText に変換される。
16669
16714
  */
16670
- const SelectInteractableTextSchema = pipe(object({ select: object({
16671
- interactableText: pipe(InteractableTextSelectorSchema, description("インタラクティブ要素をテキスト内容で検索"), metadata({ exampleValues: ["国を選択", "言語"] })),
16715
+ const SelectTextSchema = pipe(object({ select: object({
16716
+ text: pipe(string(), minLength(1, "textセレクタは空文字列にできません"), description("テキスト内容で要素を検索"), metadata({ exampleValues: ["国選択", "言語"] })),
16672
16717
  value: SelectValueSchema
16673
- }) }), metadata({ description: "テキストで要素を指定して選択" }), transform((input) => ({
16674
- command: "select",
16675
- interactableText: input.select.interactableText,
16676
- value: input.select.value
16677
- })));
16718
+ }) }), metadata({ description: "Select option from element specified by text" }), transform((input) => {
16719
+ return {
16720
+ command: "select",
16721
+ interactableText: parse(InteractableTextSelectorSchema, input.select.text),
16722
+ value: input.select.value
16723
+ };
16724
+ }));
16678
16725
  /**
16679
16726
  * select: { xpath: "...", value: "..." }
16680
16727
  */
16681
16728
  const SelectXpathSchema = pipe(object({ select: object({
16682
- xpath: pipe(XpathSelectorSchema, description("XPath形式で要素を指定"), metadata({ exampleValues: ["//select[@name='country']"] })),
16729
+ xpath: pipe(XpathSelectorSchema, description("Specify element by XPath"), metadata({ exampleValues: ["//select[@name='country']"] })),
16683
16730
  value: SelectValueSchema
16684
- }) }), metadata({ description: "XPathで要素を指定して選択" }), transform((input) => ({
16731
+ }) }), metadata({ description: "Select option from element specified by XPath" }), transform((input) => ({
16685
16732
  command: "select",
16686
16733
  xpath: input.select.xpath,
16687
16734
  value: input.select.value
@@ -16696,9 +16743,9 @@ const SelectXpathSchema = pipe(object({ select: object({
16696
16743
  */
16697
16744
  const SelectYamlSchema = pipe(union([
16698
16745
  SelectCssSchema,
16699
- SelectInteractableTextSchema,
16746
+ SelectTextSchema,
16700
16747
  SelectXpathSchema
16701
- ]), description("セレクトボックスからオプションを選択する"), metadata({ category: "入力" }));
16748
+ ]), description("セレクトボックスからオプションを選択する"), metadata({ category: "Input" }));
16702
16749
  /**
16703
16750
  * シンプルコマンドスキーマ定義
16704
16751
  *
@@ -16725,7 +16772,7 @@ const SelectYamlSchema = pipe(union([
16725
16772
  *
16726
16773
  * URLを開く。Branded TypeのUrlとして型安全に変換。
16727
16774
  */
16728
- const OpenYamlSchema = pipe(object({ open: pipe(UrlSchema, description("開くURL"), metadata({ exampleValues: ["https://example.com", "https://google.com"] })) }), description("URLを開く"), metadata({ category: "ナビゲーション" }), transform((input) => ({
16775
+ const OpenYamlSchema = pipe(object({ open: pipe(UrlSchema, description("URL to open"), metadata({ exampleValues: ["https://example.com", "https://google.com"] })) }), description("URLを開く"), metadata({ category: "Navigation" }), transform((input) => ({
16729
16776
  command: "open",
16730
16777
  url: input.open
16731
16778
  })));
@@ -16736,12 +16783,12 @@ const OpenYamlSchema = pipe(object({ open: pipe(UrlSchema, description("開くUR
16736
16783
  *
16737
16784
  * キーを押す。Branded TypeのKeyboardKeyとして型安全に変換。
16738
16785
  */
16739
- const PressYamlSchema = pipe(object({ press: pipe(KeyboardKeySchema, description("押すキー"), metadata({ exampleValues: [
16786
+ const PressYamlSchema = pipe(object({ press: pipe(KeyboardKeySchema, description("Key to press"), metadata({ exampleValues: [
16740
16787
  "Enter",
16741
16788
  "Escape",
16742
16789
  "Tab",
16743
16790
  "ArrowDown"
16744
- ] })) }), description("キーを押す"), metadata({ category: "インタラクション" }), transform((input) => ({
16791
+ ] })) }), description("キーを押す"), metadata({ category: "Interaction" }), transform((input) => ({
16745
16792
  command: "press",
16746
16793
  key: input.press
16747
16794
  })));
@@ -16753,7 +16800,7 @@ const PressYamlSchema = pipe(object({ press: pipe(KeyboardKeySchema, description
16753
16800
  * パスのみを指定した場合、fullオプションはデフォルト値を使用。
16754
16801
  * Branded TypeのFilePathとして型安全に変換。
16755
16802
  */
16756
- const ScreenshotShorthandSchema = pipe(object({ screenshot: pipe(FilePathSchema, description("スクリーンショットの保存パス"), metadata({ exampleValues: ["./screenshot.png", "./output/screen.png"] })) }), transform((input) => ({
16803
+ const ScreenshotShorthandSchema = pipe(object({ screenshot: pipe(FilePathSchema, description("Screenshot save path"), metadata({ exampleValues: ["./screenshot.png", "./output/screen.png"] })) }), transform((input) => ({
16757
16804
  command: "screenshot",
16758
16805
  path: input.screenshot,
16759
16806
  full: UseDefault
@@ -16767,8 +16814,8 @@ const ScreenshotShorthandSchema = pipe(object({ screenshot: pipe(FilePathSchema,
16767
16814
  * Branded TypeのFilePathとして型安全に変換。
16768
16815
  */
16769
16816
  const ScreenshotDetailedSchema = pipe(object({ screenshot: object({
16770
- path: pipe(FilePathSchema, description("スクリーンショットの保存パス"), metadata({ exampleValues: ["./screenshot.png", "./output/screen.png"] })),
16771
- full: optional(pipe(boolean(), description("フルページスクリーンショットを取得するか"), metadata({ exampleValues: [true, false] })))
16817
+ path: pipe(FilePathSchema, description("Screenshot save path"), metadata({ exampleValues: ["./screenshot.png", "./output/screen.png"] })),
16818
+ full: optional(pipe(boolean(), description("Whether to take a full-page screenshot"), metadata({ exampleValues: [true, false] })))
16772
16819
  }) }), transform((input) => ({
16773
16820
  command: "screenshot",
16774
16821
  path: input.screenshot.path,
@@ -16783,7 +16830,7 @@ const ScreenshotDetailedSchema = pipe(object({ screenshot: object({
16783
16830
  *
16784
16831
  * fullオプションが指定されない場合、UseDefaultシンボルを使用。
16785
16832
  */
16786
- const ScreenshotYamlSchema = pipe(union([ScreenshotShorthandSchema, ScreenshotDetailedSchema]), description("スクリーンショットを取得する"), metadata({ category: "キャプチャ" }));
16833
+ const ScreenshotYamlSchema = pipe(union([ScreenshotShorthandSchema, ScreenshotDetailedSchema]), description("スクリーンショットを取得する"), metadata({ category: "Capture" }));
16787
16834
  /**
16788
16835
  * EvalコマンドYAMLスキーマ(Single Source of Truth)
16789
16836
  *
@@ -16791,7 +16838,7 @@ const ScreenshotYamlSchema = pipe(union([ScreenshotShorthandSchema, ScreenshotDe
16791
16838
  *
16792
16839
  * JavaScriptを実行する。Branded TypeのJsExpressionとして型安全に変換。
16793
16840
  */
16794
- const EvalYamlSchema = pipe(object({ eval: pipe(JsExpressionSchema, description("実行するJavaScriptコード"), metadata({ exampleValues: ["console.log(\"hello\")", "document.title"] })) }), description("JavaScriptを実行する"), metadata({ category: "その他" }), transform((input) => ({
16841
+ const EvalYamlSchema = pipe(object({ eval: pipe(JsExpressionSchema, description("JavaScript code to execute"), metadata({ exampleValues: ["console.log(\"hello\")", "document.title"] })) }), description("JavaScriptを実行する"), metadata({ category: "Other" }), transform((input) => ({
16795
16842
  command: "eval",
16796
16843
  script: input.eval
16797
16844
  })));
@@ -17160,13 +17207,18 @@ const buildRawFlowData = (root) => ({
17160
17207
  });
17161
17208
  /**
17162
17209
  * 解決済みRawFlowDataからFlowを構築する
17210
+ *
17211
+ * @param resolvedRawFlow - 環境変数解決済みのRawFlowData
17212
+ * @param filePath - フローファイルの絶対パス
17213
+ * @returns 成功時: Flowオブジェクト、失敗時: ParseError
17163
17214
  */
17164
- const buildFlow = (resolvedRawFlow, fileName) => validateCommands(resolvedRawFlow.steps).map((validatedCommands) => ({
17165
- name: fileName.replace(/\.enbu\.yaml$/, ""),
17215
+ const buildFlow = (resolvedRawFlow, filePath) => validateCommands(resolvedRawFlow.steps).map((validatedCommands) => ({
17216
+ name: path.basename(filePath).replace(/\.enbu\.yaml$/, ""),
17166
17217
  env: resolvedRawFlow.env,
17167
- steps: validatedCommands
17218
+ steps: validatedCommands,
17219
+ filePath
17168
17220
  }));
17169
- const parseFlowYaml = (yamlContent, fileName, processEnv, dotEnv) => safeYamlParse(yamlContent).andThen(validateRootStructure).map(buildRawFlowData).andThen((rawFlow) => resolveEnvVariables(rawFlow, processEnv, dotEnv)).andThen((resolvedRawFlow) => buildFlow(resolvedRawFlow, fileName));
17221
+ const parseFlowYaml = (yamlContent, filePath, processEnv, dotEnv) => safeYamlParse(yamlContent).andThen(validateRootStructure).map(buildRawFlowData).andThen((rawFlow) => resolveEnvVariables(rawFlow, processEnv, dotEnv)).andThen((resolvedRawFlow) => buildFlow(resolvedRawFlow, filePath));
17170
17222
  /**
17171
17223
  * SelectorSpecまたはResolvedSelectorSpecからセレクタ文字列を取得する
17172
17224
  *
@@ -18696,6 +18748,25 @@ const executeFlow = (flow, options) => {
18696
18748
  * eslint.config.mjsで除外設定済み。
18697
18749
  */
18698
18750
  /**
18751
+ * ファイルパスからセッション名を生成する
18752
+ *
18753
+ * ファイルパスに基づいて一意のセッション名を生成する。
18754
+ * SHA-256ハッシュの先頭6文字を使用し、衝突確率を低く抑えながら
18755
+ * 識別しやすい長さのセッション名を生成する。
18756
+ *
18757
+ * @param filePath - フローファイルの絶対パス
18758
+ * @returns `enbu-{flowName}-{hash}` 形式のセッション名
18759
+ *
18760
+ * @example
18761
+ * ```typescript
18762
+ * generateSessionNameFromPath('/path/to/login.enbu.yaml')
18763
+ * // => 'enbu-login-a1b2c3'
18764
+ * ```
18765
+ */
18766
+ const generateSessionNameFromPath = (filePath) => {
18767
+ return `enbu-${basename(filePath).replace(/\.enbu\.yaml$/, "")}-${createHash("sha256").update(filePath).digest("hex").slice(0, 6)}`;
18768
+ };
18769
+ /**
18699
18770
  * ScreenshotResultからパスを取得する
18700
18771
  *
18701
18772
  * スクリーンショットが撮影成功した場合はパスを返し、
@@ -18744,12 +18815,11 @@ const discoverFlowFiles = (files, cwd) => {
18744
18815
  * @returns 成功時: Flowオブジェクト、失敗時: OrchestratorError
18745
18816
  */
18746
18817
  const loadSingleFlow = (filePath, processEnv, inputEnv) => {
18747
- const fileName = basename(filePath);
18748
18818
  return import_index_cjs$1.ResultAsync.fromPromise(readFile(filePath, "utf-8"), (error) => ({
18749
18819
  type: "load_error",
18750
18820
  message: `Failed to read file: ${error instanceof Error ? error.message : String(error)}`,
18751
18821
  filePath
18752
- })).andThen((yamlContent) => parseFlowYaml(yamlContent, fileName, processEnv, inputEnv).mapErr((error) => ({
18822
+ })).andThen((yamlContent) => parseFlowYaml(yamlContent, filePath, processEnv, inputEnv).mapErr((error) => ({
18753
18823
  type: "load_error",
18754
18824
  message: formatParseErrorMessage(error),
18755
18825
  filePath
@@ -18784,16 +18854,20 @@ const loadAllFlows = (flowFiles, processEnv, inputEnv) => {
18784
18854
  /**
18785
18855
  * FlowExecutionOptionsを構築する
18786
18856
  *
18857
+ * @param flow - 実行対象のフロー
18787
18858
  * @param input - 実行オプション
18788
18859
  * @param cwd - 作業ディレクトリ
18789
18860
  * @returns FlowExecutionOptions
18790
18861
  */
18791
- const buildFlowExecutionOptions = (input, cwd) => {
18862
+ const buildFlowExecutionOptions = (flow, input, cwd) => {
18792
18863
  return {
18793
18864
  session: input.sessionName !== void 0 ? {
18794
18865
  type: "name",
18795
18866
  value: input.sessionName
18796
- } : { type: "default" },
18867
+ } : {
18868
+ type: "name",
18869
+ value: generateSessionNameFromPath(flow.filePath)
18870
+ },
18797
18871
  headed: input.headed ?? DEFAULT_OPTIONS.headed,
18798
18872
  env: input.env ?? DEFAULT_OPTIONS.env,
18799
18873
  commandTimeoutMs: input.commandTimeoutMs ?? DEFAULT_OPTIONS.commandTimeoutMs,
@@ -18838,7 +18912,7 @@ const notifyFlowProgress = async (input, flowName, status, duration, stepTotal)
18838
18912
  const executeSingleFlow = async (flow, input) => {
18839
18913
  const startTime = Date.now();
18840
18914
  await notifyFlowProgress(input, flow.name, "start", 0, flow.steps.length);
18841
- return (await executeFlow(flow, buildFlowExecutionOptions(input, input.cwd))).match(async (flowResult) => {
18915
+ return (await executeFlow(flow, buildFlowExecutionOptions(flow, input, input.cwd))).match(async (flowResult) => {
18842
18916
  const duration = Date.now() - startTime;
18843
18917
  const status = flowResult.status;
18844
18918
  await notifyFlowProgress(input, flow.name, status, duration, void 0);