jevclaude 0.0.0-stage → 0.2.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/CHANGELOG.md +38 -0
- package/LICENSE +21 -0
- package/README.md +163 -2
- package/README.tr.md +68 -0
- package/dist/cli.js +212 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.js +88 -0
- package/dist/config.js.map +1 -0
- package/dist/core/uitree.js +104 -0
- package/dist/core/uitree.js.map +1 -0
- package/dist/core/xmlwalk.js +25 -0
- package/dist/core/xmlwalk.js.map +1 -0
- package/dist/driver/android/adb.js +141 -0
- package/dist/driver/android/adb.js.map +1 -0
- package/dist/driver/android/driver.js +131 -0
- package/dist/driver/android/driver.js.map +1 -0
- package/dist/driver/android/uia2.js +88 -0
- package/dist/driver/android/uia2.js.map +1 -0
- package/dist/driver/android/xml.js +76 -0
- package/dist/driver/android/xml.js.map +1 -0
- package/dist/driver/ios/driver.js +128 -0
- package/dist/driver/ios/driver.js.map +1 -0
- package/dist/driver/ios/simctl.js +36 -0
- package/dist/driver/ios/simctl.js.map +1 -0
- package/dist/driver/ios/wda.js +95 -0
- package/dist/driver/ios/wda.js.map +1 -0
- package/dist/driver/ios/xml.js +79 -0
- package/dist/driver/ios/xml.js.map +1 -0
- package/dist/driver/select.js +46 -0
- package/dist/driver/select.js.map +1 -0
- package/dist/driver/types.js +2 -0
- package/dist/driver/types.js.map +1 -0
- package/dist/engine/cache.js +64 -0
- package/dist/engine/cache.js.map +1 -0
- package/dist/engine/flow.js +144 -0
- package/dist/engine/flow.js.map +1 -0
- package/dist/engine/runner.js +525 -0
- package/dist/engine/runner.js.map +1 -0
- package/dist/jev/client.js +66 -0
- package/dist/jev/client.js.map +1 -0
- package/dist/jev/providers.js +70 -0
- package/dist/jev/providers.js.map +1 -0
- package/dist/jev/questions.js +107 -0
- package/dist/jev/questions.js.map +1 -0
- package/dist/maestro/convert.js +194 -0
- package/dist/maestro/convert.js.map +1 -0
- package/dist/mcp/server.js +131 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/report/html.js +102 -0
- package/dist/report/html.js.map +1 -0
- package/dist/report/junit.js +26 -0
- package/dist/report/junit.js.map +1 -0
- package/dist/report/text.js +51 -0
- package/dist/report/text.js.map +1 -0
- package/dist/session.js +155 -0
- package/dist/session.js.map +1 -0
- package/dist/setup.js +159 -0
- package/dist/setup.js.map +1 -0
- package/package.json +68 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses [Semantic Versioning](https://semver.org/).
|
|
4
|
+
|
|
5
|
+
## [0.2.1] — 2026-11-25
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- Releases publish through npm Trusted Publishing (OIDC); the `NPM_TOKEN` secret is no longer used.
|
|
9
|
+
- GitHub Actions updated to `actions/checkout@v7` and `actions/setup-node@v7`; CI also tests Node 24.
|
|
10
|
+
|
|
11
|
+
## [0.2.0] — 2026-11-25
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- **iOS simulator support** through WebDriverAgent (`setup ios` installs a pinned prebuilt build) and `simctl`: video, screenshots, crash reports.
|
|
15
|
+
- **Android UiAutomator2 backend.** Screen reads take about 0.2 s and typing supports Unicode (Turkish included). Install it with `setup android`; the `uiautomator dump` fallback remains.
|
|
16
|
+
- **Replay cache** in `.jevclaude/cache/<app>.json`. Re-runs need no model calls for element picks; if a cached selector is gone, the target is re-resolved and the step is reported as `healed`.
|
|
17
|
+
- **Auto-scroll** to find tap and type targets. Progress indicators are detected and waited out.
|
|
18
|
+
- **Flow language v2:**
|
|
19
|
+
- `wait_for`, `if_visible` / `then` / `else`, `run:` sub-flows, `stop`, `hide_keyboard`
|
|
20
|
+
- per-step `optional` and `timeout`
|
|
21
|
+
- flow-level `env`, `tags` and `platform`
|
|
22
|
+
- **Permission dialog policy** (`permissions: allow | deny | stop`).
|
|
23
|
+
- **Pause and resume.** `run_flow` keeps a stopped run alive and the new MCP tool `resume_flow` (`pass | retry | fail`) continues it without relaunching.
|
|
24
|
+
- **Reports:** self-contained HTML (timeline, Jev probabilities, screenshots), JUnit XML, `--trace` per-step screenshots, `--record` video.
|
|
25
|
+
- **CLI:**
|
|
26
|
+
- `doctor`, `init`, `setup android|ios`, `import-maestro`, `export-maestro`
|
|
27
|
+
- multi-file and directory runs, `--devices` for parallel devices, `--tag` filtering
|
|
28
|
+
- **`jevclaude.config.yaml`**, validated with zod.
|
|
29
|
+
- **Project tooling:** Biome lint and format, coverage thresholds, release workflow, issue and PR templates, docs.
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
- The `Device` interface became `Driver`, and parsers are platform-specific.
|
|
33
|
+
- Fewer screen reads per step: snapshots are reused until an action happens.
|
|
34
|
+
|
|
35
|
+
## [0.1.0] — 2026-11-25
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
- Android runner over adb with TypeSafe Jev decisions (element pick, step passed, error visible, risk guard), MCP server, CLI, text reports.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 JevClaude contributors
|
|
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
CHANGED
|
@@ -1,3 +1,164 @@
|
|
|
1
|
-
#
|
|
1
|
+
# JevClaude
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Mobile app testing for Claude Code that doesn't burn your tokens. Works on Android and iOS.**
|
|
4
|
+
|
|
5
|
+
Claude writes a test flow once. A local runner drives the device. [TypeSafe Jev](https://docs.typesafe.ai), a small structured-decision model, makes the per-step calls in about 200 ms each:
|
|
6
|
+
- which element to tap
|
|
7
|
+
- whether the step passed
|
|
8
|
+
- whether an error is showing
|
|
9
|
+
- whether the action is risky
|
|
10
|
+
|
|
11
|
+
A replay cache makes re-runs model-free. Claude only hears back when something fails or Jev isn't sure, and it can then decide and **resume the run where it stopped**.
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
Claude Code ──(MCP: run_flow / resume_flow)──▶ Runner ──▶ Driver
|
|
15
|
+
▲ │ ├─ Android: adb + UiAutomator2 server
|
|
16
|
+
│ short report, only on stop │ └─ iOS: WebDriverAgent + simctl
|
|
17
|
+
│ ├─ 1. deterministic: exact id/text, logcat/crash reports, text checks, spinners
|
|
18
|
+
│ ├─ 2. replay cache: last run's selector (self-heals if it's gone)
|
|
19
|
+
└───────────────────────────────────────────├─ 3. Jev: choice(element) · yes/no(passed? error? risky? permission button?)
|
|
20
|
+
└─ 4. below threshold → paused "uncertain" → Claude decides
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
[Türkçe README](README.tr.md) · [Architecture](docs/architecture.md) · [Flow reference](docs/flow-reference.md) · [How it compares](docs/comparison.md)
|
|
24
|
+
|
|
25
|
+
## Why
|
|
26
|
+
|
|
27
|
+
When Claude Code tests an app by driving the device itself, every step is a full LLM turn: screenshot, read, think, act. That's slow and expensive. Most of those decisions are small and typed:
|
|
28
|
+
- "Which of these 30 elements is the login button?"
|
|
29
|
+
- "Does this screen show the cart: yes or no?"
|
|
30
|
+
|
|
31
|
+
| | Plain Claude Code + adb | JevClaude |
|
|
32
|
+
|---|---|---|
|
|
33
|
+
| What the model sees | screenshots | compact accessibility tree (`[3] Button "Log in" id=btn_login {clickable}`) |
|
|
34
|
+
| Per-step decision | Claude turn | exact match → cache → one Jev call (choice and risk asked together) |
|
|
35
|
+
| Re-running a passing flow | the same cost again | replay cache, zero model calls for element picks |
|
|
36
|
+
| Risky actions (buy, delete, send) | whatever the model decides | blocked by default; the user must approve |
|
|
37
|
+
| AI assertions | — | `expect:` **fails the test** below threshold; the uncertain zone goes back to Claude |
|
|
38
|
+
|
|
39
|
+
Jev input costs about $0.042 per million tokens, and output is free. A 4-question check of the bundled login screen used 2,327 tokens (well under a cent) and took 167–683 ms per call (`npm run jev:smoke`).
|
|
40
|
+
|
|
41
|
+
## Quick start
|
|
42
|
+
|
|
43
|
+
Prerequisites: Node 20 or newer.
|
|
44
|
+
- Android: `adb` and a phone with USB debugging, or an emulator.
|
|
45
|
+
- iOS: macOS with Xcode and a booted simulator.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm install && npm run build
|
|
49
|
+
node dist/cli.js init # jevclaude.config.yaml, flows/smoke.yaml, .env
|
|
50
|
+
# add TYPESAFE_API_KEY (or CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN) to .env
|
|
51
|
+
node dist/cli.js setup android # optional: UiAutomator2 server → ~0.2 s screen reads + Unicode typing
|
|
52
|
+
node dist/cli.js setup ios # boots a simulator if needed, installs WebDriverAgent
|
|
53
|
+
node dist/cli.js doctor # checks tools, devices, servers and the Jev key
|
|
54
|
+
node dist/cli.js run examples/flows/settings-smoke.yaml --html report.html
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Use from Claude Code
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
claude mcp add jevclaude -- node /absolute/path/to/JevClaude/dist/cli.js mcp
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Then ask: *"test the login flow on my phone"*. The bundled skill (`.claude/skills/test-feature`) tells Claude to write one flow, call `run_flow` once, and read only the report.
|
|
64
|
+
|
|
65
|
+
MCP tools:
|
|
66
|
+
|
|
67
|
+
| Tool | What it does |
|
|
68
|
+
|---|---|
|
|
69
|
+
| `list_devices` | Android devices and booted iOS simulators |
|
|
70
|
+
| `snapshot` | the current screen as compact text (cheaper than a screenshot) |
|
|
71
|
+
| `run_flow` | runs a YAML flow; returns a short report and, if it stopped, a `run_id` |
|
|
72
|
+
| `resume_flow` | `pass` / `retry` / `fail` for the stopped step, then continues without relaunching |
|
|
73
|
+
|
|
74
|
+
## Flow example
|
|
75
|
+
|
|
76
|
+
```yaml
|
|
77
|
+
name: login happy path
|
|
78
|
+
app: com.example.shop # Android package or iOS bundle id
|
|
79
|
+
fresh_start: true
|
|
80
|
+
permissions: allow # system permission dialogs: allow | deny | stop (default)
|
|
81
|
+
steps:
|
|
82
|
+
- launch
|
|
83
|
+
- if_visible: "What's new"
|
|
84
|
+
then: [ { tap: { text: "Close" } } ]
|
|
85
|
+
- tap: "Log in button on the welcome screen" # cache → Jev; scrolls to find it
|
|
86
|
+
- type: { into: "email field", text: "${TEST_EMAIL}" } # ${VAR} from env/.env
|
|
87
|
+
- type: { into: { id: password }, text: "${TEST_PASSWORD}", submit: true }
|
|
88
|
+
- wait_for: "Home" # deterministic, up to 10 s
|
|
89
|
+
- expect: "The user is signed in and sees their name" # Jev judges the screen
|
|
90
|
+
- see: "Siparişlerim" # Unicode is fine
|
|
91
|
+
optional: true
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The full syntax is in [docs/flow-reference.md](docs/flow-reference.md). Maestro users can convert flows with `jevclaude import-maestro` and `export-maestro`.
|
|
95
|
+
|
|
96
|
+
## CLI
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
jevclaude run flows/ --junit junit.xml --html report.html # every *.yaml in flows/
|
|
100
|
+
jevclaude run flows/ --devices R58M123,emulator-5554 # same flows on several devices, in parallel
|
|
101
|
+
jevclaude run login.yaml --trace --record # screenshot every step + video
|
|
102
|
+
jevclaude run login.yaml --update-cache # re-resolve targets and refresh the cache
|
|
103
|
+
jevclaude snapshot --platform ios # what Jev would see
|
|
104
|
+
jevclaude import-maestro login.maestro.yaml -o flows/login.yaml
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Reports are written to `reports/<time>-<flow>/`:
|
|
108
|
+
- `report.json`
|
|
109
|
+
- `report.html`: self-contained, with step timeline, Jev probabilities and screenshots
|
|
110
|
+
- `step-NN.png`
|
|
111
|
+
- `run.mp4`, when `--record` is set
|
|
112
|
+
|
|
113
|
+
Exit codes: 0 if everything passed, 1 otherwise.
|
|
114
|
+
|
|
115
|
+
## Decisions and thresholds
|
|
116
|
+
|
|
117
|
+
| Question | How | Rule (configurable in `jevclaude.config.yaml`) |
|
|
118
|
+
|---|---|---|
|
|
119
|
+
| Which element is "the login button"? | exact match → cache → Jev `choice` over on-screen elements | confidence below 0.6 → `uncertain`; `none` → scroll, then `failed` |
|
|
120
|
+
| Does the screen match `expect:`? | Jev `noul` | p ≥ 0.85 passed · p ≤ 0.15 failed · otherwise `uncertain` → Claude |
|
|
121
|
+
| Is an error or crash visible after an action? | logcat / crash reports, then Jev `noul` | crash or p ≥ 0.85 → `failed` |
|
|
122
|
+
| Is this tap or type risky? | Jev `noul`, asked together with the pick and cached once it's known to be safe | p ≥ 0.5 → `blocked` until the user allows it |
|
|
123
|
+
| Permission dialog? | package / alert detection, button by regex, then Jev | per-flow `permissions:` policy |
|
|
124
|
+
| Still loading? | progress-indicator detection | wait up to 15 s |
|
|
125
|
+
|
|
126
|
+
Screen text is untrusted. It is wrapped in `<<<SCREEN … SCREEN>>>` and every question tells Jev to treat it as data, so text inside the app under test can't steer decisions.
|
|
127
|
+
|
|
128
|
+
## Status and limits
|
|
129
|
+
|
|
130
|
+
- **What's verified:**
|
|
131
|
+
- 47 unit tests, 90% line coverage, all run on recorded Android (uiautomator and UiAutomator2) and iOS (WebDriverAgent) screens.
|
|
132
|
+
- The live Jev API is checked with `npm run jev:smoke`.
|
|
133
|
+
- **What's not verified yet:** a full run on a real phone or simulator. See the [e2e checklist](CONTRIBUTING.md#end-to-end-checklist).
|
|
134
|
+
- **Jev's weak spots:** counting, arithmetic and multi-hop reasoning. Check numbers with `see:`.
|
|
135
|
+
- **Text-only:** canvas, games and Flutter apps without semantics produce empty trees. Those need Claude with screenshots.
|
|
136
|
+
- **Android typing:** the adb-only backend types ASCII only. `setup android` enables Unicode.
|
|
137
|
+
- **iOS:** simulator only for now. Real devices need WebDriverAgent signing.
|
|
138
|
+
|
|
139
|
+
## Benchmark
|
|
140
|
+
|
|
141
|
+
`npm run bench -- --runs 3 --baseline` runs each scenario in `bench/scenarios.json` four ways:
|
|
142
|
+
- JevClaude, cold cache
|
|
143
|
+
- JevClaude, warm cache
|
|
144
|
+
- plain `claude -p` driving `adb`
|
|
145
|
+
- optionally Maestro
|
|
146
|
+
|
|
147
|
+
It prints pass rate, median time, tokens and cost. **No numbers are published here until they are measured on a real device.**
|
|
148
|
+
|
|
149
|
+
## Development
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
npm test # vitest
|
|
153
|
+
npm run coverage # thresholds: 80% lines/functions/statements, 70% branches
|
|
154
|
+
npm run lint # biome
|
|
155
|
+
npm run jev:smoke # live Jev check against a recorded screen (needs a key)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) and [SECURITY.md](SECURITY.md).
|
|
159
|
+
|
|
160
|
+
## License
|
|
161
|
+
|
|
162
|
+
MIT. Device servers are installed at runtime from their upstream releases:
|
|
163
|
+
- [appium-uiautomator2-server](https://github.com/appium/appium-uiautomator2-server) (Apache-2.0)
|
|
164
|
+
- [WebDriverAgent](https://github.com/appium/WebDriverAgent) (BSD-3-Clause)
|
package/README.tr.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# JevClaude (Türkçe)
|
|
2
|
+
|
|
3
|
+
**Claude Code için token yakmayan mobil uygulama testi. Android ve iOS'ta çalışır.**
|
|
4
|
+
|
|
5
|
+
Claude test akışını bir kez yazar. Yerel bir çalıştırıcı (runner) cihazı yönetir. Adım başına küçük kararları [TypeSafe Jev](https://docs.typesafe.ai) yaklaşık 200 ms'de verir:
|
|
6
|
+
- hangi elemana dokunulacak
|
|
7
|
+
- adım geçti mi
|
|
8
|
+
- ekranda hata var mı
|
|
9
|
+
- aksiyon riskli mi
|
|
10
|
+
|
|
11
|
+
Tekrar çalıştırmalarda önbellek devreye girer ve model çağrısı yapılmaz. Claude yalnızca bir şey bozulduğunda ya da Jev emin olmadığında devreye girer; kararını verip testi **kaldığı yerden devam ettirebilir**.
|
|
12
|
+
|
|
13
|
+
## Neden?
|
|
14
|
+
|
|
15
|
+
Claude Code telefonu kendisi sürdüğünde her adım tam bir LLM turu oluyor: ekran görüntüsü, okuma, düşünme, aksiyon. Bu hem yavaş hem pahalı. Oysa bu kararların çoğu küçük ve tiplidir: "Bu 30 elemandan hangisi giriş butonu?", "Ekranda sepet görünüyor mu, evet/hayır?". JevClaude'da her adım şu sırayla çözülür:
|
|
16
|
+
|
|
17
|
+
1. **Kesin eşleşme:** id veya metin birebir tutuyorsa model çağrılmaz.
|
|
18
|
+
2. **Önbellek:** bir önceki çalıştırmada bulunan seçici kullanılır. Eleman artık yoksa Jev'e sorulur ve önbellek kendini onarır.
|
|
19
|
+
3. **Jev:** eleman seçimi ve risk tek çağrıda sorulur.
|
|
20
|
+
4. **Claude:** güven eşiğin altındaysa çalıştırma "uncertain" olarak durur; Claude `resume_flow` ile pass, retry ya da fail der.
|
|
21
|
+
|
|
22
|
+
**Risk koruması:** satın alma, silme, mesaj gönderme gibi aksiyonlar varsayılan olarak engellenir. Kullanıcı onay vermeden geçmez.
|
|
23
|
+
|
|
24
|
+
## Hızlı başlangıç
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install && npm run build
|
|
28
|
+
node dist/cli.js init # config, örnek akış ve .env oluşturur
|
|
29
|
+
# .env dosyasına TYPESAFE_API_KEY yaz
|
|
30
|
+
node dist/cli.js setup android # opsiyonel: hızlı okuma + Türkçe karakter yazma (UiAutomator2)
|
|
31
|
+
node dist/cli.js setup ios # simülatörü açar, WebDriverAgent'ı kurar
|
|
32
|
+
node dist/cli.js doctor # her şey hazır mı kontrol eder
|
|
33
|
+
node dist/cli.js run examples/flows/settings-smoke.yaml --html rapor.html
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Claude Code'a bağlamak için:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
claude mcp add jevclaude -- node /tam/yol/JevClaude/dist/cli.js mcp
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Ardından Claude'a *"telefonumda giriş akışını test et"* demen yeterli.
|
|
43
|
+
|
|
44
|
+
## Örnek akış
|
|
45
|
+
|
|
46
|
+
```yaml
|
|
47
|
+
name: giriş testi
|
|
48
|
+
app: com.ornek.magaza
|
|
49
|
+
permissions: allow
|
|
50
|
+
steps:
|
|
51
|
+
- launch
|
|
52
|
+
- tap: "Giriş yap butonu"
|
|
53
|
+
- type: { into: "e-posta alanı", text: "${TEST_EMAIL}" }
|
|
54
|
+
- type: { into: { id: password }, text: "${TEST_PASSWORD}", submit: true }
|
|
55
|
+
- wait_for: "Ana Sayfa"
|
|
56
|
+
- expect: "Kullanıcı giriş yapmış ve adı görünüyor"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Tüm söz dizimi: [docs/flow-reference.md](docs/flow-reference.md). Maestro akışları `jevclaude import-maestro` ile içeri, `export-maestro` ile dışarı aktarılabilir.
|
|
60
|
+
|
|
61
|
+
## Sınırlar
|
|
62
|
+
|
|
63
|
+
- **Jev'in zayıf yanları:** sayma ve aritmetikte zayıf. Sayıları `see:` ile kontrol et.
|
|
64
|
+
- **Görünmeyen ekranlar:** canvas, oyun ve semantics kullanmayan Flutter ekranları boş görünür.
|
|
65
|
+
- **Android'de yazı:** yalnız adb ile ASCII yazılır. Türkçe karakter için `setup android` gerekir.
|
|
66
|
+
- **iOS:** şimdilik yalnızca simülatörde çalışır.
|
|
67
|
+
|
|
68
|
+
Ayrıntılar ve karşılaştırma: [README.md](README.md), [docs/comparison.md](docs/comparison.md).
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { parseArgs } from "node:util";
|
|
5
|
+
import YAML from "yaml";
|
|
6
|
+
import { listDevices } from "./driver/select.js";
|
|
7
|
+
import { loadFlowFile, parseFlow } from "./engine/flow.js";
|
|
8
|
+
import { exportMaestro, importMaestro } from "./maestro/convert.js";
|
|
9
|
+
import { loadDotEnv, runFlow, snapshotText, writeCombinedHtml, writeJUnit } from "./session.js";
|
|
10
|
+
import { doctor, init, setupAndroid, setupIos } from "./setup.js";
|
|
11
|
+
const VERSION = "0.2.1";
|
|
12
|
+
const HELP = `jevclaude ${VERSION} — mobile app testing: Claude plans, Jev decides, the device runner executes.
|
|
13
|
+
|
|
14
|
+
Usage:
|
|
15
|
+
jevclaude run <flow.yaml|dir>... [options] Run flows (directories: every *.yaml inside)
|
|
16
|
+
jevclaude snapshot [--platform P] [--device ID] Print the current screen as compact text
|
|
17
|
+
jevclaude devices List Android devices and booted iOS simulators
|
|
18
|
+
jevclaude doctor Check tools, devices, device servers and the Jev key
|
|
19
|
+
jevclaude init Create jevclaude.config.yaml, flows/ and .env
|
|
20
|
+
jevclaude setup android|ios [--device ID] Install UiAutomator2 server / WebDriverAgent
|
|
21
|
+
jevclaude import-maestro <in.yaml> [-o out] Convert a Maestro flow to a jevclaude flow
|
|
22
|
+
jevclaude export-maestro <in.yaml> [-o out] Convert a jevclaude flow to Maestro YAML
|
|
23
|
+
jevclaude mcp Start the MCP server (stdio) for Claude Code
|
|
24
|
+
|
|
25
|
+
Run options:
|
|
26
|
+
--platform android|ios --device ID --devices ID1,ID2 (same flows on each, in parallel)
|
|
27
|
+
--tag NAME only flows tagged NAME
|
|
28
|
+
--trace screenshot after every step --record record a video
|
|
29
|
+
--junit FILE JUnit XML for CI --html FILE combined HTML report
|
|
30
|
+
--no-cache ignore the replay cache --update-cache re-resolve and overwrite it
|
|
31
|
+
--no-risk-guard don't ask Jev about risky taps --no-error-check skip per-step error checks
|
|
32
|
+
--backend auto|uia2|adb Android screen backend
|
|
33
|
+
|
|
34
|
+
Env: TYPESAFE_API_KEY, or CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (see .env.example)`;
|
|
35
|
+
function collectFlowFiles(paths) {
|
|
36
|
+
return paths.flatMap((p) => statSync(p).isDirectory()
|
|
37
|
+
? readdirSync(p)
|
|
38
|
+
.filter((f) => /\.ya?ml$/.test(f))
|
|
39
|
+
.sort()
|
|
40
|
+
.map((f) => join(p, f))
|
|
41
|
+
: [p]);
|
|
42
|
+
}
|
|
43
|
+
async function cmdRun(argv) {
|
|
44
|
+
const { values, positionals } = parseArgs({
|
|
45
|
+
args: argv,
|
|
46
|
+
allowPositionals: true,
|
|
47
|
+
options: {
|
|
48
|
+
platform: { type: "string" },
|
|
49
|
+
device: { type: "string" },
|
|
50
|
+
devices: { type: "string" },
|
|
51
|
+
tag: { type: "string" },
|
|
52
|
+
trace: { type: "boolean" },
|
|
53
|
+
record: { type: "boolean" },
|
|
54
|
+
junit: { type: "string" },
|
|
55
|
+
html: { type: "string" },
|
|
56
|
+
"no-cache": { type: "boolean" },
|
|
57
|
+
"update-cache": { type: "boolean" },
|
|
58
|
+
"no-risk-guard": { type: "boolean" },
|
|
59
|
+
"no-error-check": { type: "boolean" },
|
|
60
|
+
backend: { type: "string" },
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
if (positionals.length === 0)
|
|
64
|
+
throw new Error("run needs at least one flow file or directory");
|
|
65
|
+
let flows = collectFlowFiles(positionals).map((f) => ({ file: f, flow: loadFlowFile(f) }));
|
|
66
|
+
if (values.tag)
|
|
67
|
+
flows = flows.filter(({ flow }) => flow.tags?.includes(values.tag));
|
|
68
|
+
if (flows.length === 0)
|
|
69
|
+
throw new Error("no flows matched");
|
|
70
|
+
const devices = values.devices ? values.devices.split(",").map((d) => d.trim()) : [values.device];
|
|
71
|
+
const common = {
|
|
72
|
+
platform: values.platform,
|
|
73
|
+
androidBackend: values.backend,
|
|
74
|
+
cache: values["no-cache"] ? "off" : values["update-cache"] ? "update" : undefined,
|
|
75
|
+
record: values.record,
|
|
76
|
+
config: {
|
|
77
|
+
...(values.trace ? { trace: true } : {}),
|
|
78
|
+
...(values["no-risk-guard"] ? { riskGuard: false } : {}),
|
|
79
|
+
...(values["no-error-check"] ? { checkErrorsEveryStep: false } : {}),
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
const runs = [];
|
|
83
|
+
// Flows run one after another per device; devices run in parallel.
|
|
84
|
+
await Promise.all(devices.map(async (device) => {
|
|
85
|
+
const tag = devices.length > 1 ? `[${device}] ` : "";
|
|
86
|
+
for (const { file, flow } of flows) {
|
|
87
|
+
console.error(`\n${tag}▶ ${flow.name ?? file}`);
|
|
88
|
+
try {
|
|
89
|
+
const out = await runFlow(flow, { ...common, device, log: (m) => console.error(` ${tag}${m}`) });
|
|
90
|
+
console.log(`\n${out.text}`);
|
|
91
|
+
runs.push({ result: out.result, usage: out.usage });
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
94
|
+
console.error(`${tag}error in ${file}: ${e.message}`);
|
|
95
|
+
runs.push({
|
|
96
|
+
result: {
|
|
97
|
+
flow: flow.name ?? file,
|
|
98
|
+
app: flow.app,
|
|
99
|
+
device: device ?? "?",
|
|
100
|
+
status: "failed",
|
|
101
|
+
steps: [{ index: 0, step: "setup", status: "failed", decidedBy: "none", detail: e.message, ms: 0 }],
|
|
102
|
+
resumable: false,
|
|
103
|
+
crashes: [],
|
|
104
|
+
totalMs: 0,
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}));
|
|
110
|
+
if (values.html) {
|
|
111
|
+
await writeCombinedHtml(values.html, runs);
|
|
112
|
+
console.error(`HTML: ${values.html}`);
|
|
113
|
+
}
|
|
114
|
+
if (values.junit) {
|
|
115
|
+
await writeJUnit(values.junit, runs.map((r) => r.result));
|
|
116
|
+
console.error(`JUnit: ${values.junit}`);
|
|
117
|
+
}
|
|
118
|
+
const passed = runs.filter((r) => r.result.status === "passed").length;
|
|
119
|
+
console.error(`\n${passed}/${runs.length} flow run(s) passed`);
|
|
120
|
+
return passed === runs.length ? 0 : 1;
|
|
121
|
+
}
|
|
122
|
+
function convertCmd(argv, dir) {
|
|
123
|
+
const { values, positionals } = parseArgs({ args: argv, allowPositionals: true, options: { o: { type: "string", short: "o" } } });
|
|
124
|
+
const input = positionals[0];
|
|
125
|
+
if (!input)
|
|
126
|
+
throw new Error(`${dir}-maestro needs an input file`);
|
|
127
|
+
const src = readFileSync(input, "utf8");
|
|
128
|
+
let out;
|
|
129
|
+
let warnings;
|
|
130
|
+
if (dir === "import") {
|
|
131
|
+
const r = importMaestro(src);
|
|
132
|
+
parseFlow(r.value); // validate
|
|
133
|
+
out = YAML.stringify(r.value);
|
|
134
|
+
warnings = r.warnings;
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
const r = exportMaestro(parseFlow(src));
|
|
138
|
+
out = r.value;
|
|
139
|
+
warnings = r.warnings;
|
|
140
|
+
}
|
|
141
|
+
for (const w of warnings)
|
|
142
|
+
console.error(`warning: ${w}`);
|
|
143
|
+
if (values.o) {
|
|
144
|
+
writeFileSync(values.o, out);
|
|
145
|
+
console.error(`wrote ${values.o}`);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
process.stdout.write(out);
|
|
149
|
+
}
|
|
150
|
+
return 0;
|
|
151
|
+
}
|
|
152
|
+
async function main(argv) {
|
|
153
|
+
loadDotEnv();
|
|
154
|
+
const [cmd, ...args] = argv;
|
|
155
|
+
const log = (m) => console.error(m);
|
|
156
|
+
switch (cmd) {
|
|
157
|
+
case "run":
|
|
158
|
+
return cmdRun(args);
|
|
159
|
+
case "devices": {
|
|
160
|
+
const list = await listDevices();
|
|
161
|
+
console.log(list.length ? list.map((d) => `${d.platform}\t${d.id}\t${d.label}`).join("\n") : "no devices");
|
|
162
|
+
return 0;
|
|
163
|
+
}
|
|
164
|
+
case "snapshot": {
|
|
165
|
+
const { values } = parseArgs({ args, options: { platform: { type: "string" }, device: { type: "string" } } });
|
|
166
|
+
console.log(await snapshotText({ platform: values.platform, device: values.device }));
|
|
167
|
+
return 0;
|
|
168
|
+
}
|
|
169
|
+
case "doctor": {
|
|
170
|
+
const { ok, lines } = await doctor();
|
|
171
|
+
console.log(lines.join("\n"));
|
|
172
|
+
return ok ? 0 : 1;
|
|
173
|
+
}
|
|
174
|
+
case "init":
|
|
175
|
+
await init(log);
|
|
176
|
+
return 0;
|
|
177
|
+
case "setup": {
|
|
178
|
+
const { values, positionals } = parseArgs({ args, allowPositionals: true, options: { device: { type: "string" } } });
|
|
179
|
+
if (positionals[0] === "android")
|
|
180
|
+
await setupAndroid(values.device, log);
|
|
181
|
+
else if (positionals[0] === "ios")
|
|
182
|
+
await setupIos(values.device, log);
|
|
183
|
+
else
|
|
184
|
+
throw new Error("usage: jevclaude setup android|ios");
|
|
185
|
+
return 0;
|
|
186
|
+
}
|
|
187
|
+
case "import-maestro":
|
|
188
|
+
return convertCmd(args, "import");
|
|
189
|
+
case "export-maestro":
|
|
190
|
+
return convertCmd(args, "export");
|
|
191
|
+
case "mcp": {
|
|
192
|
+
const { startMcpServer } = await import("./mcp/server.js");
|
|
193
|
+
await startMcpServer();
|
|
194
|
+
return -1; // keep running
|
|
195
|
+
}
|
|
196
|
+
case "--version":
|
|
197
|
+
case "-v":
|
|
198
|
+
console.log(VERSION);
|
|
199
|
+
return 0;
|
|
200
|
+
default:
|
|
201
|
+
console.log(HELP);
|
|
202
|
+
return cmd && cmd !== "help" && cmd !== "--help" ? 2 : 0;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
main(process.argv.slice(2)).then((code) => {
|
|
206
|
+
if (code >= 0)
|
|
207
|
+
process.exitCode = code;
|
|
208
|
+
}, (err) => {
|
|
209
|
+
console.error(`error: ${err.message}`);
|
|
210
|
+
process.exitCode = 1;
|
|
211
|
+
});
|
|
212
|
+
//# 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,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAa,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAChG,OAAO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} from "zod";
|
|
4
|
+
import { DEFAULT_CONFIG } from "./engine/runner.js";
|
|
5
|
+
export const CONFIG_FILE = "jevclaude.config.yaml";
|
|
6
|
+
const prob = z.number().min(0).max(1);
|
|
7
|
+
export const ConfigSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
jev: z
|
|
10
|
+
.object({
|
|
11
|
+
provider: z.enum(["typesafe", "cloudflare"]).optional(),
|
|
12
|
+
model: z.string().optional(),
|
|
13
|
+
})
|
|
14
|
+
.strict()
|
|
15
|
+
.optional(),
|
|
16
|
+
android: z
|
|
17
|
+
.object({ backend: z.enum(["auto", "uia2", "adb"]).optional() })
|
|
18
|
+
.strict()
|
|
19
|
+
.optional(),
|
|
20
|
+
ios: z.object({ wda_url: z.string().url().optional() }).strict().optional(),
|
|
21
|
+
runner: z
|
|
22
|
+
.object({
|
|
23
|
+
pass: prob.optional(),
|
|
24
|
+
fail: prob.optional(),
|
|
25
|
+
min_pick_confidence: prob.optional(),
|
|
26
|
+
risk_block: prob.optional(),
|
|
27
|
+
risk_guard: z.boolean().optional(),
|
|
28
|
+
check_errors_every_step: z.boolean().optional(),
|
|
29
|
+
settle_ms: z.number().int().min(0).optional(),
|
|
30
|
+
assert_timeout_ms: z.number().int().min(0).optional(),
|
|
31
|
+
wait_for_timeout_ms: z.number().int().min(0).optional(),
|
|
32
|
+
max_scrolls: z.number().int().min(0).max(30).optional(),
|
|
33
|
+
})
|
|
34
|
+
.strict()
|
|
35
|
+
.optional(),
|
|
36
|
+
cache: z.enum(["on", "off", "update"]).optional(),
|
|
37
|
+
reports_dir: z.string().optional(),
|
|
38
|
+
})
|
|
39
|
+
.strict();
|
|
40
|
+
export function loadConfig(path = CONFIG_FILE) {
|
|
41
|
+
if (!existsSync(path))
|
|
42
|
+
return {};
|
|
43
|
+
const result = ConfigSchema.safeParse(YAML.parse(readFileSync(path, "utf8")) ?? {});
|
|
44
|
+
if (!result.success) {
|
|
45
|
+
throw new Error(`Invalid ${path}:\n${result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("\n")}`);
|
|
46
|
+
}
|
|
47
|
+
return result.data;
|
|
48
|
+
}
|
|
49
|
+
export function runnerConfigFrom(cfg) {
|
|
50
|
+
const r = cfg.runner ?? {};
|
|
51
|
+
const out = {};
|
|
52
|
+
if (r.pass !== undefined)
|
|
53
|
+
out.pass = r.pass;
|
|
54
|
+
if (r.fail !== undefined)
|
|
55
|
+
out.fail = r.fail;
|
|
56
|
+
if (r.min_pick_confidence !== undefined)
|
|
57
|
+
out.minPickConfidence = r.min_pick_confidence;
|
|
58
|
+
if (r.risk_block !== undefined)
|
|
59
|
+
out.riskBlock = r.risk_block;
|
|
60
|
+
if (r.risk_guard !== undefined)
|
|
61
|
+
out.riskGuard = r.risk_guard;
|
|
62
|
+
if (r.check_errors_every_step !== undefined)
|
|
63
|
+
out.checkErrorsEveryStep = r.check_errors_every_step;
|
|
64
|
+
if (r.settle_ms !== undefined)
|
|
65
|
+
out.settleMs = r.settle_ms;
|
|
66
|
+
if (r.assert_timeout_ms !== undefined)
|
|
67
|
+
out.assertTimeoutMs = r.assert_timeout_ms;
|
|
68
|
+
if (r.wait_for_timeout_ms !== undefined)
|
|
69
|
+
out.waitForTimeoutMs = r.wait_for_timeout_ms;
|
|
70
|
+
if (r.max_scrolls !== undefined)
|
|
71
|
+
out.maxScrolls = r.max_scrolls;
|
|
72
|
+
return out;
|
|
73
|
+
}
|
|
74
|
+
export const DEFAULT_CONFIG_YAML = `# jevclaude configuration — every key is optional.
|
|
75
|
+
jev:
|
|
76
|
+
provider: typesafe # or cloudflare (keys come from .env)
|
|
77
|
+
model: jev-1.14.0 # pin the version you tuned thresholds on
|
|
78
|
+
android:
|
|
79
|
+
backend: auto # auto | uia2 (fast, Unicode typing) | adb
|
|
80
|
+
runner:
|
|
81
|
+
pass: ${DEFAULT_CONFIG.pass} # Jev yes-probability needed to pass
|
|
82
|
+
fail: ${DEFAULT_CONFIG.fail} # at or below ⇒ failed; between ⇒ uncertain (Claude decides)
|
|
83
|
+
risk_block: ${DEFAULT_CONFIG.riskBlock} # block tap/type at or above this risk
|
|
84
|
+
max_scrolls: ${DEFAULT_CONFIG.maxScrolls} # swipes while searching for a target
|
|
85
|
+
cache: on # on | off | update — replay cache in .jevclaude/cache
|
|
86
|
+
reports_dir: reports
|
|
87
|
+
`;
|
|
88
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAqB,MAAM,oBAAoB,CAAC;AAEvE,MAAM,CAAC,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAEnD,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAEtC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KAC1B,MAAM,CAAC;IACN,GAAG,EAAE,CAAC;SACH,MAAM,CAAC;QACN,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC,QAAQ,EAAE;QACvD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC7B,CAAC;SACD,MAAM,EAAE;SACR,QAAQ,EAAE;IACb,OAAO,EAAE,CAAC;SACP,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;SAC/D,MAAM,EAAE;SACR,QAAQ,EAAE;IACb,GAAG,EAAE,CAAC,CA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