@midscene/cli 0.8.3 → 0.8.5-beta-20241122072506.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/bin/midscene +0 -2
- package/dist/es/index.js +16677 -316
- package/dist/lib/index.js +16443 -304
- package/package.json +13 -8
- package/dist/es/help.js +0 -114
- package/dist/lib/help.js +0 -115
- package/dist/types/help.d.ts +0 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/cli",
|
|
3
3
|
"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.",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.5-beta-20241122072506.0",
|
|
5
5
|
"repository": "https://github.com/web-infra-dev/midscene",
|
|
6
6
|
"homepage": "https://midscenejs.com/",
|
|
7
7
|
"jsnext:source": "./src/index.ts",
|
|
@@ -15,22 +15,27 @@
|
|
|
15
15
|
"bin"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"dotenv": "16.4.5",
|
|
19
18
|
"http-server": "14.1.1",
|
|
20
|
-
"minimist": "1.2.5",
|
|
21
|
-
"ora-classic": "5.4.2",
|
|
22
19
|
"puppeteer": "23.0.2",
|
|
23
|
-
"
|
|
24
|
-
"@midscene/
|
|
20
|
+
"@midscene/web": "0.8.5-beta-20241122072506.0",
|
|
21
|
+
"@midscene/core": "0.8.5-beta-20241122072506.0"
|
|
25
22
|
},
|
|
26
23
|
"devDependencies": {
|
|
27
24
|
"@modern-js/module-tools": "2.60.6",
|
|
25
|
+
"@types/js-yaml": "4.0.9",
|
|
28
26
|
"@types/minimist": "1.2.5",
|
|
29
27
|
"@types/node": "^18.0.0",
|
|
30
28
|
"@types/yargs": "17.0.32",
|
|
29
|
+
"chalk": "4.1.2",
|
|
30
|
+
"cli-spinners": "3.2.0",
|
|
31
|
+
"dotenv": "16.4.5",
|
|
31
32
|
"execa": "9.3.0",
|
|
33
|
+
"glob": "11.0.0",
|
|
34
|
+
"js-yaml": "4.1.0",
|
|
35
|
+
"restore-cursor": "5.1.0",
|
|
32
36
|
"typescript": "~5.0.4",
|
|
33
|
-
"vitest": "^1.6.0"
|
|
37
|
+
"vitest": "^1.6.0",
|
|
38
|
+
"yargs": "17.7.2"
|
|
34
39
|
},
|
|
35
40
|
"engines": {
|
|
36
41
|
"node": ">=16.0.0"
|
|
@@ -47,6 +52,6 @@
|
|
|
47
52
|
"new": "modern new",
|
|
48
53
|
"upgrade": "modern upgrade",
|
|
49
54
|
"test": "vitest --run",
|
|
50
|
-
"test:
|
|
55
|
+
"test:ai": "AITEST=true vitest --run"
|
|
51
56
|
}
|
|
52
57
|
}
|
package/dist/es/help.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
3
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
// package.json
|
|
7
|
-
var require_package = __commonJS({
|
|
8
|
-
"package.json"(exports, module) {
|
|
9
|
-
module.exports = {
|
|
10
|
-
name: "@midscene/cli",
|
|
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.3",
|
|
13
|
-
repository: "https://github.com/web-infra-dev/midscene",
|
|
14
|
-
homepage: "https://midscenejs.com/",
|
|
15
|
-
"jsnext:source": "./src/index.ts",
|
|
16
|
-
main: "./dist/lib/index.js",
|
|
17
|
-
bin: {
|
|
18
|
-
midscene: "./bin/midscene"
|
|
19
|
-
},
|
|
20
|
-
files: ["dist", "README.md", "bin"],
|
|
21
|
-
scripts: {
|
|
22
|
-
dev: "modern dev",
|
|
23
|
-
build: "modern build",
|
|
24
|
-
"build:watch": "modern build -w",
|
|
25
|
-
new: "modern new",
|
|
26
|
-
upgrade: "modern upgrade",
|
|
27
|
-
test: "vitest --run",
|
|
28
|
-
"test:all": "AITEST=true vitest --run",
|
|
29
|
-
prepublishOnly: "npm run build"
|
|
30
|
-
},
|
|
31
|
-
dependencies: {
|
|
32
|
-
"@midscene/web": "workspace:*",
|
|
33
|
-
dotenv: "16.4.5",
|
|
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"
|
|
39
|
-
},
|
|
40
|
-
devDependencies: {
|
|
41
|
-
"@modern-js/module-tools": "2.60.6",
|
|
42
|
-
"@types/minimist": "1.2.5",
|
|
43
|
-
"@types/node": "^18.0.0",
|
|
44
|
-
"@types/yargs": "17.0.32",
|
|
45
|
-
execa: "9.3.0",
|
|
46
|
-
typescript: "~5.0.4",
|
|
47
|
-
vitest: "^1.6.0"
|
|
48
|
-
},
|
|
49
|
-
engines: {
|
|
50
|
-
node: ">=16.0.0"
|
|
51
|
-
},
|
|
52
|
-
publishConfig: {
|
|
53
|
-
access: "public",
|
|
54
|
-
registry: "https://registry.npmjs.org"
|
|
55
|
-
},
|
|
56
|
-
license: "MIT"
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
// src/help.ts
|
|
62
|
-
var versionFromPkgJson = require_package().version;
|
|
63
|
-
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'
|
|
97
|
-
|
|
98
|
-
# serve the current directory and visit the index.html file
|
|
99
|
-
midscene --serve . --url "index.html" --assert "the content title is 'My App'"
|
|
100
|
-
|
|
101
|
-
Examples with Chinese Prompts
|
|
102
|
-
# headed 模式(即可见浏览器)访问 baidu.com 并搜索“天气”
|
|
103
|
-
midscene --headed --url "https://www.baidu.com" --action "在搜索框输入 '天气', 敲回车" --wait-for 界面上出现了天气信息
|
|
104
|
-
|
|
105
|
-
# 访问 Github 状态页面并将状态保存到 ./status.json
|
|
106
|
-
midscene --url "https://www.githubstatus.com/" \\
|
|
107
|
-
--query-output status.json \\
|
|
108
|
-
--query '{serviceName: string, status: string}[], github 页面的服务状态,返回服务名称'
|
|
109
|
-
`);
|
|
110
|
-
process.exit(0);
|
|
111
|
-
} else if (process.argv.indexOf("--version") !== -1) {
|
|
112
|
-
console.log(`@midscene/cli version ${versionFromPkgJson}`);
|
|
113
|
-
process.exit(0);
|
|
114
|
-
}
|
package/dist/lib/help.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
4
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
// package.json
|
|
8
|
-
var require_package = __commonJS({
|
|
9
|
-
"package.json"(exports, module2) {
|
|
10
|
-
module2.exports = {
|
|
11
|
-
name: "@midscene/cli",
|
|
12
|
-
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.",
|
|
13
|
-
version: "0.8.3",
|
|
14
|
-
repository: "https://github.com/web-infra-dev/midscene",
|
|
15
|
-
homepage: "https://midscenejs.com/",
|
|
16
|
-
"jsnext:source": "./src/index.ts",
|
|
17
|
-
main: "./dist/lib/index.js",
|
|
18
|
-
bin: {
|
|
19
|
-
midscene: "./bin/midscene"
|
|
20
|
-
},
|
|
21
|
-
files: ["dist", "README.md", "bin"],
|
|
22
|
-
scripts: {
|
|
23
|
-
dev: "modern dev",
|
|
24
|
-
build: "modern build",
|
|
25
|
-
"build:watch": "modern build -w",
|
|
26
|
-
new: "modern new",
|
|
27
|
-
upgrade: "modern upgrade",
|
|
28
|
-
test: "vitest --run",
|
|
29
|
-
"test:all": "AITEST=true vitest --run",
|
|
30
|
-
prepublishOnly: "npm run build"
|
|
31
|
-
},
|
|
32
|
-
dependencies: {
|
|
33
|
-
"@midscene/web": "workspace:*",
|
|
34
|
-
dotenv: "16.4.5",
|
|
35
|
-
"http-server": "14.1.1",
|
|
36
|
-
minimist: "1.2.5",
|
|
37
|
-
"ora-classic": "5.4.2",
|
|
38
|
-
puppeteer: "23.0.2",
|
|
39
|
-
yargs: "17.7.2"
|
|
40
|
-
},
|
|
41
|
-
devDependencies: {
|
|
42
|
-
"@modern-js/module-tools": "2.60.6",
|
|
43
|
-
"@types/minimist": "1.2.5",
|
|
44
|
-
"@types/node": "^18.0.0",
|
|
45
|
-
"@types/yargs": "17.0.32",
|
|
46
|
-
execa: "9.3.0",
|
|
47
|
-
typescript: "~5.0.4",
|
|
48
|
-
vitest: "^1.6.0"
|
|
49
|
-
},
|
|
50
|
-
engines: {
|
|
51
|
-
node: ">=16.0.0"
|
|
52
|
-
},
|
|
53
|
-
publishConfig: {
|
|
54
|
-
access: "public",
|
|
55
|
-
registry: "https://registry.npmjs.org"
|
|
56
|
-
},
|
|
57
|
-
license: "MIT"
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
// src/help.ts
|
|
63
|
-
var versionFromPkgJson = require_package().version;
|
|
64
|
-
if (process.argv.indexOf("--help") !== -1) {
|
|
65
|
-
console.log(`
|
|
66
|
-
@midscene/cli version ${versionFromPkgJson}, Docs: https://midscenejs.com/
|
|
67
|
-
|
|
68
|
-
Midscene.js helps you automate browser actions, assertions, and data extraction by AI.
|
|
69
|
-
Usage: midscene [options] [actions]
|
|
70
|
-
|
|
71
|
-
Options:
|
|
72
|
-
--serve <root-directory> Serve the local path as a static server, optional
|
|
73
|
-
--url <url> The URL to visit, required. If --serve is provided, provide the path to the file to visit
|
|
74
|
-
--user-agent <ua> The user agent to use, optional
|
|
75
|
-
--viewport-width <width> The width of the viewport, optional
|
|
76
|
-
--viewport-height <height> The height of the viewport, optional
|
|
77
|
-
--viewport-scale <scale> The device scale factor (dpr), optional
|
|
78
|
-
--headed Run in headed mode, default false
|
|
79
|
-
--help Display this help message
|
|
80
|
-
--version Display the version
|
|
81
|
-
|
|
82
|
-
Actions (the order matters, can be used multiple times):
|
|
83
|
-
--action <action> Perform an action, optional
|
|
84
|
-
--assert <assert> Perform an assert, optional. The process will be terminated if the assertion is not met.
|
|
85
|
-
--query-output <path> Save the result of the query to a file, this must be put before --query, optional
|
|
86
|
-
--query <query> Perform a query, optional
|
|
87
|
-
--wait-for <assertion> Wait for a condition to be met. The timeout is set to 15 seconds. optional
|
|
88
|
-
--sleep <ms> Sleep for a number of milliseconds, optional
|
|
89
|
-
|
|
90
|
-
Examples:
|
|
91
|
-
# headed mode (i.e. visible browser) to visit bing.com and search for 'weather today'
|
|
92
|
-
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"
|
|
93
|
-
|
|
94
|
-
# visit github status page and save the status to ./status.json
|
|
95
|
-
midscene --url "https://www.githubstatus.com/" \\
|
|
96
|
-
--query-output status.json \\
|
|
97
|
-
--query '{name: string, status: string}[], service status of github page'
|
|
98
|
-
|
|
99
|
-
# serve the current directory and visit the index.html file
|
|
100
|
-
midscene --serve . --url "index.html" --assert "the content title is 'My App'"
|
|
101
|
-
|
|
102
|
-
Examples with Chinese Prompts
|
|
103
|
-
# headed 模式(即可见浏览器)访问 baidu.com 并搜索“天气”
|
|
104
|
-
midscene --headed --url "https://www.baidu.com" --action "在搜索框输入 '天气', 敲回车" --wait-for 界面上出现了天气信息
|
|
105
|
-
|
|
106
|
-
# 访问 Github 状态页面并将状态保存到 ./status.json
|
|
107
|
-
midscene --url "https://www.githubstatus.com/" \\
|
|
108
|
-
--query-output status.json \\
|
|
109
|
-
--query '{serviceName: string, status: string}[], github 页面的服务状态,返回服务名称'
|
|
110
|
-
`);
|
|
111
|
-
process.exit(0);
|
|
112
|
-
} else if (process.argv.indexOf("--version") !== -1) {
|
|
113
|
-
console.log(`@midscene/cli version ${versionFromPkgJson}`);
|
|
114
|
-
process.exit(0);
|
|
115
|
-
}
|
package/dist/types/help.d.ts
DELETED