@midscene/cli 0.8.2 → 0.8.3-beta-20241120030727.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/help.js CHANGED
@@ -9,7 +9,7 @@ var require_package = __commonJS({
9
9
  module.exports = {
10
10
  name: "@midscene/cli",
11
11
  description: "An AI-powered automation SDK can control the page, perform assertions, and extract data in JSON format using natural language. See https://midscenejs.com/ for details.",
12
- version: "0.8.2",
12
+ version: "0.8.3-beta-20241120030727.0",
13
13
  repository: "https://github.com/web-infra-dev/midscene",
14
14
  homepage: "https://midscenejs.com/",
15
15
  "jsnext:source": "./src/index.ts",
@@ -25,24 +25,28 @@ var require_package = __commonJS({
25
25
  new: "modern new",
26
26
  upgrade: "modern upgrade",
27
27
  test: "vitest --run",
28
- "test:all": "AITEST=true vitest --run",
28
+ "test:ai": "AITEST=true vitest --run",
29
29
  prepublishOnly: "npm run build"
30
30
  },
31
31
  dependencies: {
32
32
  "@midscene/web": "workspace:*",
33
- dotenv: "16.4.5",
33
+ "@midscene/core": "workspace:*",
34
34
  "http-server": "14.1.1",
35
- minimist: "1.2.5",
36
- "ora-classic": "5.4.2",
37
- puppeteer: "23.0.2",
38
- yargs: "17.7.2"
35
+ puppeteer: "23.0.2"
39
36
  },
40
37
  devDependencies: {
38
+ dotenv: "16.4.5",
39
+ minimist: "1.2.5",
41
40
  "@modern-js/module-tools": "2.60.6",
41
+ "@types/js-yaml": "4.0.9",
42
42
  "@types/minimist": "1.2.5",
43
43
  "@types/node": "^18.0.0",
44
44
  "@types/yargs": "17.0.32",
45
+ chalk: "4.1.2",
46
+ "cli-spinners": "3.2.0",
45
47
  execa: "9.3.0",
48
+ glob: "11.0.0",
49
+ "js-yaml": "4.1.0",
46
50
  typescript: "~5.0.4",
47
51
  vitest: "^1.6.0"
48
52
  },
@@ -61,52 +65,16 @@ var require_package = __commonJS({
61
65
  // src/help.ts
62
66
  var versionFromPkgJson = require_package().version;
63
67
  if (process.argv.indexOf("--help") !== -1) {
64
- console.log(`
65
- @midscene/cli version ${versionFromPkgJson}, Docs: https://midscenejs.com/
66
-
67
- Midscene.js helps you automate browser actions, assertions, and data extraction by AI.
68
- Usage: midscene [options] [actions]
69
-
70
- Options:
71
- --serve <root-directory> Serve the local path as a static server, optional
72
- --url <url> The URL to visit, required. If --serve is provided, provide the path to the file to visit
73
- --user-agent <ua> The user agent to use, optional
74
- --viewport-width <width> The width of the viewport, optional
75
- --viewport-height <height> The height of the viewport, optional
76
- --viewport-scale <scale> The device scale factor (dpr), optional
77
- --headed Run in headed mode, default false
78
- --help Display this help message
79
- --version Display the version
80
-
81
- Actions (the order matters, can be used multiple times):
82
- --action <action> Perform an action, optional
83
- --assert <assert> Perform an assert, optional. The process will be terminated if the assertion is not met.
84
- --query-output <path> Save the result of the query to a file, this must be put before --query, optional
85
- --query <query> Perform a query, optional
86
- --wait-for <assertion> Wait for a condition to be met. The timeout is set to 15 seconds. optional
87
- --sleep <ms> Sleep for a number of milliseconds, optional
88
-
89
- Examples:
90
- # headed mode (i.e. visible browser) to visit bing.com and search for 'weather today'
91
- midscene --headed --url "https://wwww.bing.com" --action "type 'weather today' in search box, hit enter" --wait-for "there is weather info in the page"
92
-
93
- # visit github status page and save the status to ./status.json
94
- midscene --url "https://www.githubstatus.com/" \\
95
- --query-output status.json \\
96
- --query '{name: string, status: string}[], service status of github page'
68
+ console.log(`@midscene/cli v${versionFromPkgJson}
97
69
 
98
- # serve the current directory and visit the index.html file
99
- midscene --serve . --url "index.html" --assert "the content title is 'My App'"
70
+ Midscene.js helps you automate browser actions, assertions, and data extraction by AI.
71
+ Usage: midscene <path-to-yaml-file-or-directory> [options]
100
72
 
101
- Examples with Chinese Prompts
102
- # headed 模式(即可见浏览器)访问 baidu.com 并搜索“天气”
103
- midscene --headed --url "https://www.baidu.com" --action "在搜索框输入 '天气', 敲回车" --wait-for 界面上出现了天气信息
73
+ Options:
74
+ --headed Run the browser in headed mode to see the browser UI (default: false)
75
+ --keep-window Keep the browser window open after the script finishes. This is useful when debugging, but will consume more resources (default: false)
104
76
 
105
- # 访问 Github 状态页面并将状态保存到 ./status.json
106
- midscene --url "https://www.githubstatus.com/" \\
107
- --query-output status.json \\
108
- --query '{serviceName: string, status: string}[], github 页面的服务状态,返回服务名称'
109
- `);
77
+ For more information, please refer to https://midscenejs.com/automate-with-scripts-in-yaml`);
110
78
  process.exit(0);
111
79
  } else if (process.argv.indexOf("--version") !== -1) {
112
80
  console.log(`@midscene/cli version ${versionFromPkgJson}`);