agent-miniprogram 0.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.
- package/LICENSE +21 -0
- package/README.md +128 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +386 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/close.d.ts +3 -0
- package/dist/commands/close.js +6 -0
- package/dist/commands/close.js.map +1 -0
- package/dist/commands/connect.d.ts +4 -0
- package/dist/commands/connect.js +8 -0
- package/dist/commands/connect.js.map +1 -0
- package/dist/commands/data.d.ts +3 -0
- package/dist/commands/data.js +6 -0
- package/dist/commands/data.js.map +1 -0
- package/dist/commands/eval.d.ts +3 -0
- package/dist/commands/eval.js +6 -0
- package/dist/commands/eval.js.map +1 -0
- package/dist/commands/input.d.ts +3 -0
- package/dist/commands/input.js +6 -0
- package/dist/commands/input.js.map +1 -0
- package/dist/commands/launch.d.ts +4 -0
- package/dist/commands/launch.js +7 -0
- package/dist/commands/launch.js.map +1 -0
- package/dist/commands/mock.d.ts +3 -0
- package/dist/commands/mock.js +13 -0
- package/dist/commands/mock.js.map +1 -0
- package/dist/commands/navigate.d.ts +7 -0
- package/dist/commands/navigate.js +10 -0
- package/dist/commands/navigate.js.map +1 -0
- package/dist/commands/screenshot.d.ts +4 -0
- package/dist/commands/screenshot.js +6 -0
- package/dist/commands/screenshot.js.map +1 -0
- package/dist/commands/scroll.d.ts +5 -0
- package/dist/commands/scroll.js +6 -0
- package/dist/commands/scroll.js.map +1 -0
- package/dist/commands/snapshot.d.ts +4 -0
- package/dist/commands/snapshot.js +6 -0
- package/dist/commands/snapshot.js.map +1 -0
- package/dist/commands/tap.d.ts +3 -0
- package/dist/commands/tap.js +6 -0
- package/dist/commands/tap.js.map +1 -0
- package/dist/commands/wait.d.ts +5 -0
- package/dist/commands/wait.js +20 -0
- package/dist/commands/wait.js.map +1 -0
- package/dist/daemon/client.d.ts +6 -0
- package/dist/daemon/client.js +55 -0
- package/dist/daemon/client.js.map +1 -0
- package/dist/daemon/server.d.ts +1 -0
- package/dist/daemon/server.js +369 -0
- package/dist/daemon/server.js.map +1 -0
- package/dist/daemon/session.d.ts +14 -0
- package/dist/daemon/session.js +65 -0
- package/dist/daemon/session.js.map +1 -0
- package/dist/replay/player.d.ts +3 -0
- package/dist/replay/player.js +41 -0
- package/dist/replay/player.js.map +1 -0
- package/dist/replay/recorder.d.ts +15 -0
- package/dist/replay/recorder.js +39 -0
- package/dist/replay/recorder.js.map +1 -0
- package/dist/snapshot/builder.d.ts +16 -0
- package/dist/snapshot/builder.js +371 -0
- package/dist/snapshot/builder.js.map +1 -0
- package/dist/snapshot/refs.d.ts +17 -0
- package/dist/snapshot/refs.js +68 -0
- package/dist/snapshot/refs.js.map +1 -0
- package/package.json +44 -0
- package/skills/agent-miniprogram/SKILL.md +163 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Michael
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Agent Miniprogram
|
|
2
|
+
|
|
3
|
+
A CLI tool for AI-driven WeChat miniprogram automation testing. Designed for use with AI agents like Claude Code.
|
|
4
|
+
|
|
5
|
+
Inspired by [Agent Browser](https://github.com/vercel/agent-browser) (ref system, token-efficient snapshots) and [Agent Device](https://github.com/callstack/agent-device) (daemon architecture, SKILL.md, .amp recordings).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g agent-miniprogram
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
1. [WeChat Developer Tools](https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html) installed
|
|
16
|
+
2. In Developer Tools: **Settings → Security → Enable CLI/HTTP calls**
|
|
17
|
+
3. Node.js 18+
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Start the daemon
|
|
23
|
+
agent-mp daemon
|
|
24
|
+
|
|
25
|
+
# Launch DevTools and connect
|
|
26
|
+
agent-mp launch /path/to/miniprogram
|
|
27
|
+
|
|
28
|
+
# Get snapshot (ref-annotated WXML tree)
|
|
29
|
+
agent-mp snapshot
|
|
30
|
+
|
|
31
|
+
# Tap an element by ref
|
|
32
|
+
agent-mp tap @e5
|
|
33
|
+
|
|
34
|
+
# Type into an input
|
|
35
|
+
agent-mp input @e3 "13800138000"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Snapshot Format
|
|
39
|
+
|
|
40
|
+
`agent-mp snapshot` outputs a compact, ref-annotated tree (~200-400 tokens):
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
Page: /pages/index/index
|
|
44
|
+
|
|
45
|
+
[view @e1]
|
|
46
|
+
[image @e2] src="/img/logo.png"
|
|
47
|
+
[text @e3] "欢迎登录"
|
|
48
|
+
[form @e4]
|
|
49
|
+
[input @e5] placeholder="手机号" (bindinput=onPhoneInput)
|
|
50
|
+
[input @e6] type="password" placeholder="密码" (bindinput=onPasswordInput)
|
|
51
|
+
[button @e7] "登录" (bindtap=onLogin)
|
|
52
|
+
[navigator @e8] → /pages/register/index "注册账号"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- `@eN` refs are assigned per snapshot call and persist in `~/.agent-miniprogram/refs.json`
|
|
56
|
+
- Only semantically meaningful nodes are shown (text, events, attributes)
|
|
57
|
+
- Pure layout containers are folded
|
|
58
|
+
|
|
59
|
+
## Commands
|
|
60
|
+
|
|
61
|
+
See [skills/agent-miniprogram/SKILL.md](skills/agent-miniprogram/SKILL.md) for the full reference.
|
|
62
|
+
|
|
63
|
+
| Command | Description |
|
|
64
|
+
|---------|-------------|
|
|
65
|
+
| `launch <path>` | Launch DevTools and connect |
|
|
66
|
+
| `connect` | Connect to running DevTools |
|
|
67
|
+
| `close` | Close connection |
|
|
68
|
+
| `status` | Show daemon status |
|
|
69
|
+
| `snapshot [--data]` | WXML tree with refs |
|
|
70
|
+
| `screenshot` | Take screenshot |
|
|
71
|
+
| `navigate <url>` | Navigate to page |
|
|
72
|
+
| `back` | Go back |
|
|
73
|
+
| `tap <ref>` | Tap element |
|
|
74
|
+
| `input <ref> <text>` | Type text |
|
|
75
|
+
| `scroll <ref>` | Scroll element |
|
|
76
|
+
| `long-press <ref>` | Long press |
|
|
77
|
+
| `swipe <ref> <dir>` | Swipe gesture |
|
|
78
|
+
| `wait <ref\|ms>` | Wait for element or time |
|
|
79
|
+
| `data [path]` | Read page.data |
|
|
80
|
+
| `eval <code>` | Run JS in AppService |
|
|
81
|
+
| `mock <api> <json>` | Mock wx.* API |
|
|
82
|
+
| `diff snapshot` | Diff vs last snapshot |
|
|
83
|
+
| `record start/stop` | Record interactions |
|
|
84
|
+
| `replay <file.amp>` | Replay recording |
|
|
85
|
+
|
|
86
|
+
## Claude Code Integration
|
|
87
|
+
|
|
88
|
+
Copy or symlink `skills/agent-miniprogram/SKILL.md` to your Claude Code skills directory, or reference it in your project's `CLAUDE.md`.
|
|
89
|
+
|
|
90
|
+
## Development
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
agent-mp <command>
|
|
94
|
+
│
|
|
95
|
+
▼ HTTP POST /rpc (localhost:9430)
|
|
96
|
+
┌─────────────────────────┐
|
|
97
|
+
│ Daemon (Node.js) │ ~/.agent-miniprogram/daemon.json
|
|
98
|
+
│ - session state │ ~/.agent-miniprogram/refs.json
|
|
99
|
+
│ - ref registry │
|
|
100
|
+
└─────────┬───────────────┘
|
|
101
|
+
│ WebSocket
|
|
102
|
+
▼
|
|
103
|
+
微信开发者工具 (miniprogram-automator)
|
|
104
|
+
│
|
|
105
|
+
▼
|
|
106
|
+
小程序(模拟器)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
git clone https://github.com/michaelneale/agent-miniprogram
|
|
111
|
+
cd agent-miniprogram
|
|
112
|
+
npm install
|
|
113
|
+
|
|
114
|
+
# Start daemon (dev mode)
|
|
115
|
+
npm run daemon
|
|
116
|
+
# or
|
|
117
|
+
npx tsx src/daemon/server.ts
|
|
118
|
+
|
|
119
|
+
# Run tests
|
|
120
|
+
npm test
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### File Paths
|
|
124
|
+
|
|
125
|
+
- `~/.agent-miniprogram/daemon.json` — daemon runtime state
|
|
126
|
+
- `~/.agent-miniprogram/refs.json` — element ref registry
|
|
127
|
+
- `~/.agent-miniprogram/last-snapshot.txt` — last snapshot (for diff)
|
|
128
|
+
- `~/.agent-miniprogram/screenshot.png` — default screenshot path
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { program } from 'commander';
|
|
3
|
+
import { rpc } from './daemon/client.js';
|
|
4
|
+
import { replay } from './replay/player.js';
|
|
5
|
+
import * as path from 'path';
|
|
6
|
+
program
|
|
7
|
+
.name('agent-mp')
|
|
8
|
+
.description('AI-driven WeChat miniprogram automation CLI')
|
|
9
|
+
.version('0.1.0');
|
|
10
|
+
// ─── Global options ────────────────────────────────────────────────────────
|
|
11
|
+
program.option('-p, --port <port>', 'daemon port', '9430');
|
|
12
|
+
program.option('--json', 'output JSON');
|
|
13
|
+
// ─── Daemon ────────────────────────────────────────────────────────────────
|
|
14
|
+
program
|
|
15
|
+
.command('daemon')
|
|
16
|
+
.description('Start the daemon server')
|
|
17
|
+
.option('--port <port>', 'port to listen on', '9430')
|
|
18
|
+
.action(async (opts) => {
|
|
19
|
+
process.env.AGENT_MP_PORT = opts.port;
|
|
20
|
+
// Dynamic import to avoid loading automator in CLI process
|
|
21
|
+
await import('./daemon/server.js');
|
|
22
|
+
});
|
|
23
|
+
// ─── Session management ────────────────────────────────────────────────────
|
|
24
|
+
program
|
|
25
|
+
.command('launch')
|
|
26
|
+
.description('Launch WeChat DevTools and connect')
|
|
27
|
+
.argument('<project-path>', 'path to miniprogram project')
|
|
28
|
+
.option('--ws <endpoint>', 'custom WebSocket endpoint')
|
|
29
|
+
.action(async (projectPath, opts) => {
|
|
30
|
+
const port = parseInt(program.opts().port, 10);
|
|
31
|
+
try {
|
|
32
|
+
const result = await rpc('launch', {
|
|
33
|
+
projectPath: path.resolve(projectPath),
|
|
34
|
+
wsEndpoint: opts.ws,
|
|
35
|
+
}, port);
|
|
36
|
+
output({ ok: true, ...result }, 'Launched successfully');
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
die(err.message);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
program
|
|
43
|
+
.command('connect')
|
|
44
|
+
.description('Connect to already-running WeChat DevTools')
|
|
45
|
+
.option('--ws <endpoint>', 'WebSocket endpoint', 'ws://localhost:9420')
|
|
46
|
+
.action(async (opts) => {
|
|
47
|
+
const port = parseInt(program.opts().port, 10);
|
|
48
|
+
try {
|
|
49
|
+
const result = await rpc('connect', { wsEndpoint: opts.ws }, port);
|
|
50
|
+
output(result, 'Connected');
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
die(err.message);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
program
|
|
57
|
+
.command('close')
|
|
58
|
+
.description('Close the miniprogram connection')
|
|
59
|
+
.action(async () => {
|
|
60
|
+
const port = parseInt(program.opts().port, 10);
|
|
61
|
+
try {
|
|
62
|
+
const result = await rpc('close', {}, port);
|
|
63
|
+
output(result, 'Closed');
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
die(err.message);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
program
|
|
70
|
+
.command('status')
|
|
71
|
+
.description('Show daemon connection status')
|
|
72
|
+
.action(async () => {
|
|
73
|
+
const port = parseInt(program.opts().port, 10);
|
|
74
|
+
try {
|
|
75
|
+
const result = await rpc('status', {}, port);
|
|
76
|
+
output(result, result.connected ? `Connected — ${result.currentPage}` : 'Not connected');
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
die(err.message);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
// ─── Inspection ────────────────────────────────────────────────────────────
|
|
83
|
+
program
|
|
84
|
+
.command('snapshot')
|
|
85
|
+
.description('Generate ref-annotated WXML tree')
|
|
86
|
+
.option('--data', 'also output page.data')
|
|
87
|
+
.action(async (opts) => {
|
|
88
|
+
const port = parseInt(program.opts().port, 10);
|
|
89
|
+
try {
|
|
90
|
+
const result = await rpc('snapshot', { data: opts.data }, port);
|
|
91
|
+
if (program.opts().json) {
|
|
92
|
+
console.log(JSON.stringify(result));
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
console.log(result.snapshot);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
die(err.message);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
program
|
|
103
|
+
.command('screenshot')
|
|
104
|
+
.description('Take a screenshot')
|
|
105
|
+
.option('--path <file>', 'save path')
|
|
106
|
+
.action(async (opts) => {
|
|
107
|
+
const port = parseInt(program.opts().port, 10);
|
|
108
|
+
try {
|
|
109
|
+
const result = await rpc('screenshot', { path: opts.path }, port);
|
|
110
|
+
output(result, `Screenshot saved: ${result.path}`);
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
die(err.message);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
program
|
|
117
|
+
.command('data [dot-path]')
|
|
118
|
+
.description('Read page.data (or a specific key path)')
|
|
119
|
+
.action(async (dotPath) => {
|
|
120
|
+
const port = parseInt(program.opts().port, 10);
|
|
121
|
+
try {
|
|
122
|
+
const result = await rpc('data', { path: dotPath }, port);
|
|
123
|
+
if (program.opts().json) {
|
|
124
|
+
console.log(JSON.stringify(result));
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
console.log(JSON.stringify(result.data, null, 2));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
catch (err) {
|
|
131
|
+
die(err.message);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
program
|
|
135
|
+
.command('diff')
|
|
136
|
+
.description('Diff current snapshot against last snapshot')
|
|
137
|
+
.argument('[target]', 'target (only "snapshot" supported)', 'snapshot')
|
|
138
|
+
.action(async (_target) => {
|
|
139
|
+
const port = parseInt(program.opts().port, 10);
|
|
140
|
+
try {
|
|
141
|
+
const result = await rpc('diff', {}, port);
|
|
142
|
+
if (program.opts().json) {
|
|
143
|
+
console.log(JSON.stringify(result));
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
console.log(result.diff);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
die(err.message);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
// ─── Navigation ────────────────────────────────────────────────────────────
|
|
154
|
+
program
|
|
155
|
+
.command('navigate')
|
|
156
|
+
.description('Navigate to a page')
|
|
157
|
+
.argument('<url>', 'page path, e.g. /pages/index/index')
|
|
158
|
+
.option('--type <type>', 'navigation type: navigateTo|reLaunch|switchTab', 'navigateTo')
|
|
159
|
+
.action(async (url, opts) => {
|
|
160
|
+
const port = parseInt(program.opts().port, 10);
|
|
161
|
+
try {
|
|
162
|
+
const result = await rpc('navigate', { url, type: opts.type }, port);
|
|
163
|
+
output(result, `Navigated to ${url}`);
|
|
164
|
+
}
|
|
165
|
+
catch (err) {
|
|
166
|
+
die(err.message);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
program
|
|
170
|
+
.command('back')
|
|
171
|
+
.description('Navigate back')
|
|
172
|
+
.action(async () => {
|
|
173
|
+
const port = parseInt(program.opts().port, 10);
|
|
174
|
+
try {
|
|
175
|
+
const result = await rpc('back', {}, port);
|
|
176
|
+
output(result, 'Navigated back');
|
|
177
|
+
}
|
|
178
|
+
catch (err) {
|
|
179
|
+
die(err.message);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
// ─── Interaction ────────────────────────────────────────────────────────────
|
|
183
|
+
program
|
|
184
|
+
.command('tap')
|
|
185
|
+
.description('Tap an element')
|
|
186
|
+
.argument('<ref>', 'ref (@eN) or CSS selector')
|
|
187
|
+
.action(async (ref) => {
|
|
188
|
+
const port = parseInt(program.opts().port, 10);
|
|
189
|
+
try {
|
|
190
|
+
const result = await rpc('tap', { ref }, port);
|
|
191
|
+
output(result, `Tapped ${ref}`);
|
|
192
|
+
}
|
|
193
|
+
catch (err) {
|
|
194
|
+
die(err.message);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
program
|
|
198
|
+
.command('input')
|
|
199
|
+
.description('Type text into an input element')
|
|
200
|
+
.argument('<ref>', 'ref (@eN) or CSS selector')
|
|
201
|
+
.argument('<text>', 'text to type')
|
|
202
|
+
.action(async (ref, text) => {
|
|
203
|
+
const port = parseInt(program.opts().port, 10);
|
|
204
|
+
try {
|
|
205
|
+
const result = await rpc('input', { ref, text }, port);
|
|
206
|
+
output(result, `Input "${text}" into ${ref}`);
|
|
207
|
+
}
|
|
208
|
+
catch (err) {
|
|
209
|
+
die(err.message);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
program
|
|
213
|
+
.command('scroll')
|
|
214
|
+
.description('Scroll an element')
|
|
215
|
+
.argument('<ref>', 'ref (@eN) or CSS selector')
|
|
216
|
+
.option('--x <n>', 'scroll x offset', '0')
|
|
217
|
+
.option('--y <n>', 'scroll y offset', '0')
|
|
218
|
+
.action(async (ref, opts) => {
|
|
219
|
+
const port = parseInt(program.opts().port, 10);
|
|
220
|
+
try {
|
|
221
|
+
const result = await rpc('scroll', { ref, x: parseInt(opts.x), y: parseInt(opts.y) }, port);
|
|
222
|
+
output(result, `Scrolled ${ref}`);
|
|
223
|
+
}
|
|
224
|
+
catch (err) {
|
|
225
|
+
die(err.message);
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
program
|
|
229
|
+
.command('long-press')
|
|
230
|
+
.description('Long press an element')
|
|
231
|
+
.argument('<ref>', 'ref (@eN) or CSS selector')
|
|
232
|
+
.action(async (ref) => {
|
|
233
|
+
const port = parseInt(program.opts().port, 10);
|
|
234
|
+
try {
|
|
235
|
+
const result = await rpc('longPress', { ref }, port);
|
|
236
|
+
output(result, `Long-pressed ${ref}`);
|
|
237
|
+
}
|
|
238
|
+
catch (err) {
|
|
239
|
+
die(err.message);
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
program
|
|
243
|
+
.command('swipe')
|
|
244
|
+
.description('Swipe within an element')
|
|
245
|
+
.argument('<ref>', 'ref (@eN) or CSS selector')
|
|
246
|
+
.argument('<direction>', 'up|down|left|right')
|
|
247
|
+
.action(async (ref, direction) => {
|
|
248
|
+
const port = parseInt(program.opts().port, 10);
|
|
249
|
+
try {
|
|
250
|
+
const result = await rpc('swipe', { ref, direction }, port);
|
|
251
|
+
output(result, `Swiped ${direction} on ${ref}`);
|
|
252
|
+
}
|
|
253
|
+
catch (err) {
|
|
254
|
+
die(err.message);
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
// ─── Advanced ────────────────────────────────────────────────────────────
|
|
258
|
+
program
|
|
259
|
+
.command('wait')
|
|
260
|
+
.description('Wait for an element, text, or duration (ms)')
|
|
261
|
+
.argument('<target>', 'ref (@eN), selector, milliseconds, or --text value')
|
|
262
|
+
.option('--text <t>', 'wait for text to appear')
|
|
263
|
+
.action(async (target, opts) => {
|
|
264
|
+
const port = parseInt(program.opts().port, 10);
|
|
265
|
+
try {
|
|
266
|
+
const ms = parseInt(target, 10);
|
|
267
|
+
let params;
|
|
268
|
+
if (!isNaN(ms) && String(ms) === target) {
|
|
269
|
+
params = { ms };
|
|
270
|
+
}
|
|
271
|
+
else if (opts.text) {
|
|
272
|
+
params = { text: opts.text };
|
|
273
|
+
}
|
|
274
|
+
else if (target.startsWith('@')) {
|
|
275
|
+
params = { ref: target };
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
params = { selector: target };
|
|
279
|
+
}
|
|
280
|
+
const result = await rpc('wait', params, port);
|
|
281
|
+
output(result, 'Done waiting');
|
|
282
|
+
}
|
|
283
|
+
catch (err) {
|
|
284
|
+
die(err.message);
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
program
|
|
288
|
+
.command('eval')
|
|
289
|
+
.description('Evaluate JS code in AppService context')
|
|
290
|
+
.argument('<code>', 'JavaScript code to execute')
|
|
291
|
+
.action(async (code) => {
|
|
292
|
+
const port = parseInt(program.opts().port, 10);
|
|
293
|
+
try {
|
|
294
|
+
const result = await rpc('eval', { code }, port);
|
|
295
|
+
if (program.opts().json) {
|
|
296
|
+
console.log(JSON.stringify(result));
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
console.log(JSON.stringify(result.result, null, 2));
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
catch (err) {
|
|
303
|
+
die(err.message);
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
program
|
|
307
|
+
.command('mock')
|
|
308
|
+
.description('Mock a wx.* API with a JSON response')
|
|
309
|
+
.argument('<api>', 'API name, e.g. request')
|
|
310
|
+
.argument('<json-response>', 'JSON string')
|
|
311
|
+
.action(async (api, jsonResponse) => {
|
|
312
|
+
const port = parseInt(program.opts().port, 10);
|
|
313
|
+
try {
|
|
314
|
+
let response;
|
|
315
|
+
try {
|
|
316
|
+
response = JSON.parse(jsonResponse);
|
|
317
|
+
}
|
|
318
|
+
catch {
|
|
319
|
+
die(`Invalid JSON: ${jsonResponse}`);
|
|
320
|
+
}
|
|
321
|
+
const result = await rpc('mock', { api, response }, port);
|
|
322
|
+
output(result, `Mocked wx.${api}`);
|
|
323
|
+
}
|
|
324
|
+
catch (err) {
|
|
325
|
+
die(err.message);
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
// ─── Record / Replay ──────────────────────────────────────────────────────
|
|
329
|
+
const recordCmd = program
|
|
330
|
+
.command('record')
|
|
331
|
+
.description('Record and replay interactions');
|
|
332
|
+
recordCmd
|
|
333
|
+
.command('start')
|
|
334
|
+
.description('Start recording')
|
|
335
|
+
.action(async () => {
|
|
336
|
+
const port = parseInt(program.opts().port, 10);
|
|
337
|
+
try {
|
|
338
|
+
const result = await rpc('recordStart', {}, port);
|
|
339
|
+
output(result, 'Recording started');
|
|
340
|
+
}
|
|
341
|
+
catch (err) {
|
|
342
|
+
die(err.message);
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
recordCmd
|
|
346
|
+
.command('stop')
|
|
347
|
+
.description('Stop recording and save to .amp file')
|
|
348
|
+
.option('--output <file>', 'output file path')
|
|
349
|
+
.action(async (opts) => {
|
|
350
|
+
const port = parseInt(program.opts().port, 10);
|
|
351
|
+
try {
|
|
352
|
+
const result = await rpc('recordStop', { output: opts.output }, port);
|
|
353
|
+
output(result, `Recording saved: ${result.path}`);
|
|
354
|
+
}
|
|
355
|
+
catch (err) {
|
|
356
|
+
die(err.message);
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
program
|
|
360
|
+
.command('replay')
|
|
361
|
+
.description('Replay an .amp recording file')
|
|
362
|
+
.argument('<file>', 'path to .amp file')
|
|
363
|
+
.action(async (file) => {
|
|
364
|
+
const port = parseInt(program.opts().port, 10);
|
|
365
|
+
try {
|
|
366
|
+
await replay(file, { port });
|
|
367
|
+
}
|
|
368
|
+
catch (err) {
|
|
369
|
+
die(err.message);
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
// ─── Helpers ──────────────────────────────────────────────────────────────
|
|
373
|
+
function output(data, text) {
|
|
374
|
+
if (program.opts().json) {
|
|
375
|
+
console.log(JSON.stringify(data));
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
console.log(text);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
function die(msg) {
|
|
382
|
+
console.error(`Error: ${msg}`);
|
|
383
|
+
process.exit(1);
|
|
384
|
+
}
|
|
385
|
+
program.parse(process.argv);
|
|
386
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO;KACJ,IAAI,CAAC,UAAU,CAAC;KAChB,WAAW,CAAC,6C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AC;AACH,CAAC,CAAC,CAAC;AAEL,6EAA6E;AAC7E,SAAS,MAAM,CAAC,IAAS,EAAE,IAAY;IACrC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;QACxB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACpC,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAED,SAAS,GAAG,CAAC,GAAW;IACtB,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,EAAE,CAAC,CAAC;IAC/B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"close.js","sourceRoot":"","sources":["../../src/commands/close.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAuB;IACxD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;IAC/B,OAAO,MAAM,GAAG,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { rpc } from '../daemon/client.js';
|
|
2
|
+
export async function connectCommand(opts) {
|
|
3
|
+
const port = opts.port || 9430;
|
|
4
|
+
const wsEndpoint = opts.wsEndpoint || 'ws://localhost:9420';
|
|
5
|
+
const result = await rpc('connect', { wsEndpoint }, port);
|
|
6
|
+
return result;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/commands/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAA4C;IAC/E,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;IAC/B,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,qBAAqB,CAAC;IAC5D,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,SAAS,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,CAAC,CAAC;IAC1D,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/commands/data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAgB,EAAE,OAA0B,EAAE;IAC9E,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;IAC/B,OAAO,MAAM,GAAG,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eval.js","sourceRoot":"","sources":["../../src/commands/eval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAY,EAAE,IAAuB;IACrE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;IAC/B,OAAO,MAAM,GAAG,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../src/commands/input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAW,EAAE,IAAY,EAAE,IAAuB;IACnF,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;IAC/B,OAAO,MAAM,GAAG,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { rpc } from '../daemon/client.js';
|
|
2
|
+
export async function launchCommand(projectPath, opts) {
|
|
3
|
+
const port = opts.port || 9430;
|
|
4
|
+
const result = await rpc('launch', { projectPath, wsEndpoint: opts.wsEndpoint }, port);
|
|
5
|
+
return result;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=launch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launch.js","sourceRoot":"","sources":["../../src/commands/launch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,WAAmB,EAAE,IAA4C;IACnG,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;IAC/B,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC,CAAC;IACvF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|