@tai2/aco 0.2.2 → 0.2.5
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/README.md +12 -0
- package/dist/cli.js +116 -4
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,6 +31,18 @@ npm i -g @tai2/aco
|
|
|
31
31
|
npx @tai2/aco --help
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
+
## Use with Claude Code
|
|
35
|
+
|
|
36
|
+
Install the `aco` plugin so Claude Code can drive sessions for you:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
claude plugin marketplace add tai2/aco
|
|
40
|
+
claude plugin install aco@aco
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then ask your agent things like "tap the login button on the simulator" or
|
|
44
|
+
"screenshot the current screen" — it shells out to `aco`.
|
|
45
|
+
|
|
34
46
|
## Usage
|
|
35
47
|
|
|
36
48
|
### Discover devices
|
package/dist/cli.js
CHANGED
|
@@ -3,6 +3,97 @@
|
|
|
3
3
|
// src/cli.ts
|
|
4
4
|
import { Command } from "@commander-js/extra-typings";
|
|
5
5
|
|
|
6
|
+
// package.json
|
|
7
|
+
var package_default = {
|
|
8
|
+
name: "@tai2/aco",
|
|
9
|
+
version: "0.2.5",
|
|
10
|
+
description: "Appium Command-line Operator \u2014 drive an Appium session from the shell, one command at a time.",
|
|
11
|
+
type: "module",
|
|
12
|
+
license: "MIT",
|
|
13
|
+
author: "tai2",
|
|
14
|
+
homepage: "https://github.com/tai2/aco#readme",
|
|
15
|
+
repository: {
|
|
16
|
+
type: "git",
|
|
17
|
+
url: "git+https://github.com/tai2/aco.git"
|
|
18
|
+
},
|
|
19
|
+
bugs: {
|
|
20
|
+
url: "https://github.com/tai2/aco/issues"
|
|
21
|
+
},
|
|
22
|
+
keywords: [
|
|
23
|
+
"appium",
|
|
24
|
+
"cli",
|
|
25
|
+
"mobile",
|
|
26
|
+
"ios",
|
|
27
|
+
"android",
|
|
28
|
+
"webdriver",
|
|
29
|
+
"automation",
|
|
30
|
+
"e2e"
|
|
31
|
+
],
|
|
32
|
+
bin: {
|
|
33
|
+
aco: "./dist/cli.js"
|
|
34
|
+
},
|
|
35
|
+
files: ["dist"],
|
|
36
|
+
engines: {
|
|
37
|
+
node: ">=20"
|
|
38
|
+
},
|
|
39
|
+
publishConfig: {
|
|
40
|
+
access: "public",
|
|
41
|
+
provenance: true
|
|
42
|
+
},
|
|
43
|
+
packageManager: "pnpm@10.33.4",
|
|
44
|
+
scripts: {
|
|
45
|
+
dev: "tsx src/cli.ts",
|
|
46
|
+
"dev:watch": "tsx watch src/cli.ts",
|
|
47
|
+
build: "tsup",
|
|
48
|
+
typecheck: "tsc --noEmit && tsc -p e2e/tsconfig.json --noEmit",
|
|
49
|
+
test: "vitest run",
|
|
50
|
+
"test:watch": "vitest",
|
|
51
|
+
"test:e2e": "vitest run --config vitest.e2e.config.ts",
|
|
52
|
+
"e2e:ios": "pnpm run build && ACO_E2E_PLATFORM=ios pnpm run test:e2e",
|
|
53
|
+
"e2e:android": "pnpm run build && ACO_E2E_PLATFORM=android pnpm run test:e2e",
|
|
54
|
+
format: "biome format --write .",
|
|
55
|
+
"format:check": "biome format .",
|
|
56
|
+
lint: "biome lint .",
|
|
57
|
+
"lint:fix": "biome lint --write .",
|
|
58
|
+
check: "biome check .",
|
|
59
|
+
verify: "pnpm run check && pnpm run typecheck && pnpm run test && pnpm run build",
|
|
60
|
+
"aut:install": "pnpm --dir aut install",
|
|
61
|
+
"aut:prebuild": "pnpm --dir aut run prebuild",
|
|
62
|
+
"aut:start": "pnpm --dir aut run start",
|
|
63
|
+
"aut:build:ios": "pnpm --dir aut run build:ios",
|
|
64
|
+
"aut:build:android": "pnpm --dir aut run build:android",
|
|
65
|
+
"gen:extensions": "node --import tsx/esm scripts/generate-extensions.ts",
|
|
66
|
+
prepublishOnly: "pnpm run verify",
|
|
67
|
+
version: "biome format --write package.json && git add package.json",
|
|
68
|
+
"release:patch": 'npm version patch -m "Release %s" && git push --follow-tags',
|
|
69
|
+
"release:minor": 'npm version minor -m "Release %s" && git push --follow-tags',
|
|
70
|
+
"release:major": 'npm version major -m "Release %s" && git push --follow-tags'
|
|
71
|
+
},
|
|
72
|
+
dependencies: {
|
|
73
|
+
"@appium/logger": "^2.0.8",
|
|
74
|
+
"@commander-js/extra-typings": "^12.0.0",
|
|
75
|
+
"@xmldom/xmldom": "^0.9.10",
|
|
76
|
+
"appium-adb": "^15.0.0",
|
|
77
|
+
"appium-ios-device": "^3.1.14",
|
|
78
|
+
commander: "^12.0.0",
|
|
79
|
+
webdriverio: "^9.27.2",
|
|
80
|
+
xpath: "^0.0.34"
|
|
81
|
+
},
|
|
82
|
+
devDependencies: {
|
|
83
|
+
"@biomejs/biome": "^1.9.0",
|
|
84
|
+
"@types/node": "^20.0.0",
|
|
85
|
+
"appium-uiautomator2-driver": "^7.5.2",
|
|
86
|
+
"appium-xcuitest-driver": "^11.9.0",
|
|
87
|
+
tsup: "^8.0.0",
|
|
88
|
+
tsx: "^4.0.0",
|
|
89
|
+
typescript: "^5.4.0",
|
|
90
|
+
vitest: "^1.0.0"
|
|
91
|
+
},
|
|
92
|
+
pnpm: {
|
|
93
|
+
onlyBuiltDependencies: ["esbuild"]
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
6
97
|
// src/lib/actions.ts
|
|
7
98
|
var MOVE_DEFAULT_DURATION = 100;
|
|
8
99
|
var TAP_DEFAULT_DURATION = 100;
|
|
@@ -292,6 +383,14 @@ function resolveConnection(flags) {
|
|
|
292
383
|
|
|
293
384
|
// src/lib/wd-client.ts
|
|
294
385
|
import { attach, remote } from "webdriverio";
|
|
386
|
+
function stripForbiddenHeaders(requestOptions) {
|
|
387
|
+
const { headers } = requestOptions;
|
|
388
|
+
if (headers instanceof Headers) {
|
|
389
|
+
headers.delete("Connection");
|
|
390
|
+
headers.delete("Content-Length");
|
|
391
|
+
}
|
|
392
|
+
return requestOptions;
|
|
393
|
+
}
|
|
295
394
|
async function attachBrowser(conn) {
|
|
296
395
|
return attach({
|
|
297
396
|
sessionId: conn.sessionId,
|
|
@@ -303,7 +402,8 @@ async function attachBrowser(conn) {
|
|
|
303
402
|
isMobile: true,
|
|
304
403
|
isIOS: conn.platform === "ios",
|
|
305
404
|
isAndroid: conn.platform === "android",
|
|
306
|
-
logLevel: "silent"
|
|
405
|
+
logLevel: "silent",
|
|
406
|
+
transformRequest: stripForbiddenHeaders
|
|
307
407
|
});
|
|
308
408
|
}
|
|
309
409
|
var DEFAULT_SESSION_TIMEOUT_MS = 3e5;
|
|
@@ -316,6 +416,7 @@ async function createBrowser(opts) {
|
|
|
316
416
|
logLevel: "silent",
|
|
317
417
|
connectionRetryTimeout: opts.connectionTimeoutMs ?? DEFAULT_SESSION_TIMEOUT_MS,
|
|
318
418
|
connectionRetryCount: 0,
|
|
419
|
+
transformRequest: stripForbiddenHeaders,
|
|
319
420
|
// Only forwarded when set; undefined user/key means no auth header.
|
|
320
421
|
...opts.user !== void 0 ? { user: opts.user } : {},
|
|
321
422
|
...opts.key !== void 0 ? { key: opts.key } : {},
|
|
@@ -4766,7 +4867,12 @@ function registerSessionList(session) {
|
|
|
4766
4867
|
|
|
4767
4868
|
// src/commands/session/start.ts
|
|
4768
4869
|
import { spawn as spawn2 } from "child_process";
|
|
4769
|
-
import {
|
|
4870
|
+
import {
|
|
4871
|
+
createWriteStream as createWriteStream2,
|
|
4872
|
+
mkdirSync as mkdirSync3,
|
|
4873
|
+
readFileSync as readFileSync3,
|
|
4874
|
+
realpathSync
|
|
4875
|
+
} from "fs";
|
|
4770
4876
|
import { homedir as homedir4 } from "os";
|
|
4771
4877
|
import { join as join4 } from "path";
|
|
4772
4878
|
|
|
@@ -5073,7 +5179,13 @@ function readFirstLine(stream, timeoutMs) {
|
|
|
5073
5179
|
});
|
|
5074
5180
|
}
|
|
5075
5181
|
async function detachAndExit(sessionTimeoutSec) {
|
|
5076
|
-
const
|
|
5182
|
+
const invoked = process.argv[1];
|
|
5183
|
+
let entry;
|
|
5184
|
+
try {
|
|
5185
|
+
entry = invoked ? realpathSync(invoked) : void 0;
|
|
5186
|
+
} catch {
|
|
5187
|
+
entry = invoked;
|
|
5188
|
+
}
|
|
5077
5189
|
if (!entry || !entry.endsWith(".js")) {
|
|
5078
5190
|
process.stderr.write(
|
|
5079
5191
|
"aco: --detach is not supported in dev mode (tsx). Run the built `dist/cli.js` to use --detach.\n"
|
|
@@ -5989,7 +6101,7 @@ function compareSemver(a, b) {
|
|
|
5989
6101
|
assertSupportedNodeVersion("20.0.0");
|
|
5990
6102
|
var program = new Command().name("aco").description(
|
|
5991
6103
|
"Appium Command-line Operator -- start a session, then drive it from the shell."
|
|
5992
|
-
).version(
|
|
6104
|
+
).version(package_default.version).showHelpAfterError();
|
|
5993
6105
|
registerSession(program);
|
|
5994
6106
|
registerElement(program);
|
|
5995
6107
|
registerSource(program);
|