tapflow 0.0.1 → 0.1.0-alpha.2
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 +186 -0
- package/bin/tapflow.js +2 -1
- package/dist/commands/agent-start.d.ts +7 -0
- package/dist/commands/agent-start.d.ts.map +1 -0
- package/dist/commands/agent-start.js +78 -0
- package/dist/commands/agent-start.js.map +1 -0
- package/dist/commands/boot.d.ts +2 -0
- package/dist/commands/boot.d.ts.map +1 -0
- package/dist/commands/boot.js +47 -0
- package/dist/commands/boot.js.map +1 -0
- package/dist/commands/devices.d.ts +2 -0
- package/dist/commands/devices.d.ts.map +1 -0
- package/dist/commands/devices.js +85 -0
- package/dist/commands/devices.js.map +1 -0
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +41 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts +5 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +64 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/logs.d.ts +5 -0
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/commands/logs.js +22 -0
- package/dist/commands/logs.js.map +1 -0
- package/dist/commands/relay-start.d.ts +5 -0
- package/dist/commands/relay-start.d.ts.map +1 -0
- package/dist/commands/relay-start.js +24 -0
- package/dist/commands/relay-start.js.map +1 -0
- package/dist/commands/reset.d.ts +2 -0
- package/dist/commands/reset.d.ts.map +1 -0
- package/dist/commands/reset.js +49 -0
- package/dist/commands/reset.js.map +1 -0
- package/dist/commands/start.d.ts +6 -0
- package/dist/commands/start.d.ts.map +1 -0
- package/dist/commands/start.js +77 -0
- package/dist/commands/start.js.map +1 -0
- package/dist/commands/status.d.ts +4 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +56 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +56 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/doctor.d.ts +12 -0
- package/dist/lib/doctor.d.ts.map +1 -0
- package/dist/lib/doctor.js +118 -0
- package/dist/lib/doctor.js.map +1 -0
- package/dist/lib/ios-boot.d.ts +3 -0
- package/dist/lib/ios-boot.d.ts.map +1 -0
- package/dist/lib/ios-boot.js +44 -0
- package/dist/lib/ios-boot.js.map +1 -0
- package/dist/lib/platform.d.ts +2 -0
- package/dist/lib/platform.d.ts.map +1 -0
- package/dist/lib/platform.js +10 -0
- package/dist/lib/platform.js.map +1 -0
- package/dist/lib/print.d.ts +13 -0
- package/dist/lib/print.d.ts.map +1 -0
- package/dist/lib/print.js +55 -0
- package/dist/lib/print.js.map +1 -0
- package/dist/lib/tapflow-dir.d.ts +3 -0
- package/dist/lib/tapflow-dir.d.ts.map +1 -0
- package/dist/lib/tapflow-dir.js +8 -0
- package/dist/lib/tapflow-dir.js.map +1 -0
- package/package.json +58 -5
package/LICENSE
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tapflow 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
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="docs/public/logo-hero.svg" height="72" alt="tapflow" />
|
|
3
|
+
|
|
4
|
+
<h3>Self-hosted iOS & Android simulator streaming for QA teams</h3>
|
|
5
|
+
|
|
6
|
+
<p>
|
|
7
|
+
Run simulators in the browser — no Appetize, no BrowserStack, no monthly fees.<br />
|
|
8
|
+
App data never leaves your network.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p>
|
|
12
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="MIT License" /></a>
|
|
13
|
+
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen" alt="Node.js ≥ 20" /></a>
|
|
14
|
+
<img src="https://img.shields.io/badge/platform-macOS-lightgrey" alt="macOS Agent" />
|
|
15
|
+
<a href="https://github.com/jo-duchan/tapflow/blob/main/CONTRIBUTING.md"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs welcome" /></a>
|
|
16
|
+
</p>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Demo
|
|
22
|
+
|
|
23
|
+
<div align="center">
|
|
24
|
+
<a href="https://github.com/user-attachments/assets/01914ed2-f35c-4230-ae01-166ffe6af395" target="_blank" rel="noopener noreferrer">
|
|
25
|
+
<img src="https://raw.githubusercontent.com/jo-duchan/tapflow/main/docs/public/demo-thumbnail.png" alt="tapflow demo — click to play" width="100%" />
|
|
26
|
+
</a>
|
|
27
|
+
<p><em>Click to play</em></p>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Why tapflow?
|
|
33
|
+
|
|
34
|
+
| Solution | Problem |
|
|
35
|
+
|----------|---------|
|
|
36
|
+
| Appetize / BrowserStack | Expensive — app data leaves your network |
|
|
37
|
+
| Physical devices | Cost, loss, management overhead |
|
|
38
|
+
| Xcode / Android Studio | Every QA member needs their own Mac + full toolchain setup |
|
|
39
|
+
| **tapflow** | Use the Mac you already own — data stays on-prem, QA team uses a browser |
|
|
40
|
+
|
|
41
|
+
## Features
|
|
42
|
+
|
|
43
|
+
- **Browser-based** — QA team needs no installation. Any modern browser works.
|
|
44
|
+
- **iOS Simulator** — JPEG frame streaming at ~30 fps via SimulatorKit IOSurface. No WebDriverAgent required.
|
|
45
|
+
- **Android Emulator** — H.264 streaming via [scrcpy](https://github.com/Genymobile/scrcpy) at ~30 fps.
|
|
46
|
+
- **Touch, swipe & pinch** — real-time input forwarded to the simulator.
|
|
47
|
+
- **App Center** — upload `.app.zip` (iOS) or `.apk` (Android), manage builds by status (Backlog / In Progress / Done / Rejected).
|
|
48
|
+
- **Session Recordings** — record QA sessions, share with your team. Retained for 72 hours.
|
|
49
|
+
- **Mac Resources** — CPU & RAM monitoring per agent. Spot overloaded hosts before assigning sessions.
|
|
50
|
+
- **Team management** — invite links, roles (Admin / Developer / QA / Viewer), Personal Access Tokens for CI/CD.
|
|
51
|
+
- **Self-hosted** — deploy anywhere. No cloud dependency.
|
|
52
|
+
|
|
53
|
+
## How it works
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
Browser (QA team) ←─ WebSocket ─→ Relay Server ←─ WebSocket (outbound) ─→ Mac Agent
|
|
57
|
+
(Linux / Mac) (iOS · Android)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
1. The **Mac Agent** connects *outbound* to the relay — no inbound firewall rules needed.
|
|
61
|
+
2. QA opens the **dashboard** in any browser and sees all available devices.
|
|
62
|
+
3. Touch events are forwarded in real time; the screen streams back to the browser.
|
|
63
|
+
4. The **relay** also serves the dashboard SPA on the same port — no separate web server needed.
|
|
64
|
+
|
|
65
|
+
## Quick Start
|
|
66
|
+
|
|
67
|
+
### 1. Install
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
npm install -g tapflow
|
|
71
|
+
# or: yarn global add tapflow | pnpm add -g tapflow
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 2. Start relay + agent
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
tapflow start
|
|
78
|
+
# ✓ Relay started on http://localhost:4000
|
|
79
|
+
# ✓ iOS Agent connected (3 simulators available)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
This starts both the relay and the agent on the same Mac (local mode).
|
|
83
|
+
|
|
84
|
+
### 3. Create the first admin account
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
tapflow init
|
|
88
|
+
# ? Admin email: admin@yourteam.com
|
|
89
|
+
# ? Password: ********
|
|
90
|
+
# ✓ Admin account created
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 4. Open the dashboard
|
|
94
|
+
|
|
95
|
+
Navigate to `http://localhost:4000` and sign in with the account you just created.
|
|
96
|
+
|
|
97
|
+
> **Having issues?** Run `tapflow doctor` to auto-diagnose Node.js, Xcode, `adb`, and other prerequisites.
|
|
98
|
+
|
|
99
|
+
## Requirements
|
|
100
|
+
|
|
101
|
+
| Component | Requirements |
|
|
102
|
+
|-----------|-------------|
|
|
103
|
+
| **Relay server** | Node.js ≥ 20, any OS (Linux/macOS), ~512 MB RAM |
|
|
104
|
+
| **iOS Agent** | macOS, Xcode with iOS Simulator Runtime, Node.js ≥ 20 |
|
|
105
|
+
| **Android Agent** | macOS, Android SDK (`adb` in `$PATH` or `$ANDROID_HOME` set), AVD with `google_apis/arm64-v8a` (android-34), Node.js ≥ 20 |
|
|
106
|
+
| **Browser (QA)** | Any modern browser — Chrome, Firefox, Safari, Edge |
|
|
107
|
+
|
|
108
|
+
## Self-Hosting
|
|
109
|
+
|
|
110
|
+
### Local (single Mac)
|
|
111
|
+
|
|
112
|
+
Relay and agent on the same machine — ideal for a single developer or small team.
|
|
113
|
+
|
|
114
|
+
```sh
|
|
115
|
+
tapflow start
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Team (separate relay server)
|
|
119
|
+
|
|
120
|
+
Run the relay on a Linux server or dedicated Mac. Each Mac with simulators runs the agent.
|
|
121
|
+
|
|
122
|
+
**Relay server:**
|
|
123
|
+
|
|
124
|
+
```sh
|
|
125
|
+
# Recommended: PM2 for automatic restarts
|
|
126
|
+
npm install -g pm2 tapflow
|
|
127
|
+
JWT_SECRET=$(openssl rand -hex 32) pm2 start tapflow --name relay -- relay start
|
|
128
|
+
pm2 save && pm2 startup
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Each Mac agent:**
|
|
132
|
+
|
|
133
|
+
```sh
|
|
134
|
+
tapflow agent start --relay wss://your-relay-url
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
> For nginx / Caddy reverse proxy setup and external access, see [Self-Hosting the Relay](https://jo-duchan.github.io/tapflow/guide/self-hosting).
|
|
138
|
+
|
|
139
|
+
## CLI Reference
|
|
140
|
+
|
|
141
|
+
| Command | Description |
|
|
142
|
+
|---------|-------------|
|
|
143
|
+
| `tapflow start` | Start relay + agent together (local mode) |
|
|
144
|
+
| `tapflow relay start` | Start relay only |
|
|
145
|
+
| `tapflow agent start --relay <url>` | Start agent and connect to a relay |
|
|
146
|
+
| `tapflow init` | Create the first admin account |
|
|
147
|
+
| `tapflow doctor` | Diagnose environment (Node, Xcode, adb…) |
|
|
148
|
+
| `tapflow devices` | List available simulators and emulators |
|
|
149
|
+
| `tapflow boot <name\|udid>` | Boot a simulator or emulator |
|
|
150
|
+
| `tapflow status` | Show connected agents, devices, active sessions |
|
|
151
|
+
| `tapflow reset` | Shut down all simulators and emulators |
|
|
152
|
+
| `tapflow logs` | Show recent relay log entries |
|
|
153
|
+
|
|
154
|
+
Full reference → [CLI docs](https://jo-duchan.github.io/tapflow/reference/cli)
|
|
155
|
+
|
|
156
|
+
## Documentation
|
|
157
|
+
|
|
158
|
+
**[jo-duchan.github.io/tapflow](https://jo-duchan.github.io/tapflow)**
|
|
159
|
+
|
|
160
|
+
- [Introduction](https://jo-duchan.github.io/tapflow/guide/introduction)
|
|
161
|
+
- [Quick Start](https://jo-duchan.github.io/tapflow/guide/getting-started)
|
|
162
|
+
- [Self-Hosting the Relay](https://jo-duchan.github.io/tapflow/guide/self-hosting)
|
|
163
|
+
- [iOS Agent Setup](https://jo-duchan.github.io/tapflow/guide/ios-agent)
|
|
164
|
+
- [Android Agent Setup](https://jo-duchan.github.io/tapflow/guide/android-agent)
|
|
165
|
+
- [Uploading Builds (CI/CD)](https://jo-duchan.github.io/tapflow/guide/upload-builds)
|
|
166
|
+
- [CLI Reference](https://jo-duchan.github.io/tapflow/reference/cli)
|
|
167
|
+
- [Troubleshooting](https://jo-duchan.github.io/tapflow/guide/troubleshooting)
|
|
168
|
+
|
|
169
|
+
## Development
|
|
170
|
+
|
|
171
|
+
**Requirements**: Node.js ≥ 20, pnpm ≥ 9
|
|
172
|
+
|
|
173
|
+
```sh
|
|
174
|
+
git clone https://github.com/jo-duchan/tapflow.git
|
|
175
|
+
cd tapflow
|
|
176
|
+
pnpm install
|
|
177
|
+
pnpm dev
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for branch strategy, commit conventions, and architecture overview.
|
|
181
|
+
|
|
182
|
+
## License
|
|
183
|
+
|
|
184
|
+
[MIT](LICENSE) — Copyright © 2025-present tapflow contributors
|
|
185
|
+
|
|
186
|
+
> tapflow bundles [scrcpy-server](https://github.com/Genymobile/scrcpy) (Apache-2.0) for Android screen streaming. See [NOTICE](NOTICE) for full attribution.
|
package/bin/tapflow.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import '../dist/index.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-start.d.ts","sourceRoot":"","sources":["../../src/commands/agent-start.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,KAAK,CAAA;CACrC;AAUD,wBAAsB,aAAa,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqE1E"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AndroidAgent } from '@tapflowio/android-agent';
|
|
3
|
+
import { banner, createSpinner } from '../lib/print.js';
|
|
4
|
+
import { hasAdb } from '../lib/platform.js';
|
|
5
|
+
import { resolveAndBootIOSDevice } from '../lib/ios-boot.js';
|
|
6
|
+
const DEFAULT_RELAY = 'ws://localhost:4000';
|
|
7
|
+
const relayUrlSchema = z
|
|
8
|
+
.string()
|
|
9
|
+
.refine((v) => v.startsWith('ws://') || v.startsWith('wss://'), {
|
|
10
|
+
message: '--relay must start with ws:// or wss://',
|
|
11
|
+
});
|
|
12
|
+
export async function cmdAgentStart(opts) {
|
|
13
|
+
const isMac = process.platform === 'darwin';
|
|
14
|
+
const rawRelay = opts.relay ?? DEFAULT_RELAY;
|
|
15
|
+
const relayResult = relayUrlSchema.safeParse(rawRelay);
|
|
16
|
+
if (!relayResult.success) {
|
|
17
|
+
banner('error', 'INVALID CONFIG', [relayResult.error.issues[0].message]);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
const relayUrl = relayResult.data;
|
|
21
|
+
const explicit = opts.platform;
|
|
22
|
+
const runIOS = explicit === 'ios' || explicit === 'all' || (!explicit && isMac);
|
|
23
|
+
const runAndroid = explicit === 'android' || explicit === 'all' || (!explicit && hasAdb());
|
|
24
|
+
if (!runIOS && !runAndroid) {
|
|
25
|
+
banner('error', 'NO PLATFORM AVAILABLE', [
|
|
26
|
+
'No iOS simulator or Android adb found.',
|
|
27
|
+
'Run `tapflow doctor` to diagnose.',
|
|
28
|
+
]);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
const agents = [];
|
|
32
|
+
// ── iOS Agent ─────────────────────────────────────────────────────────────
|
|
33
|
+
if (runIOS) {
|
|
34
|
+
const iosAgent = await resolveAndBootIOSDevice(opts.device);
|
|
35
|
+
const iosSpinner = createSpinner('Connecting iOS agent…');
|
|
36
|
+
iosSpinner.start();
|
|
37
|
+
try {
|
|
38
|
+
await iosAgent.connect(relayUrl);
|
|
39
|
+
iosSpinner.stop(true);
|
|
40
|
+
agents.push(iosAgent);
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
iosSpinner.stop(false);
|
|
44
|
+
banner('error', 'IOS CONNECTION FAILED', [e.message]);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// ── Android Agent ─────────────────────────────────────────────────────────
|
|
49
|
+
if (runAndroid) {
|
|
50
|
+
const androidAgent = new AndroidAgent({ deviceFilter: opts.device });
|
|
51
|
+
const androidSpinner = createSpinner('Connecting Android agent…');
|
|
52
|
+
androidSpinner.start();
|
|
53
|
+
try {
|
|
54
|
+
await androidAgent.connect(relayUrl);
|
|
55
|
+
androidSpinner.stop(true);
|
|
56
|
+
agents.push(androidAgent);
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
androidSpinner.stop(false);
|
|
60
|
+
if (runIOS && agents.length > 0) {
|
|
61
|
+
console.log(` ⚠ Android: ${e.message}`);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
banner('error', 'ANDROID CONNECTION FAILED', [e.message]);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
banner('success', 'TAPFLOW AGENT READY', [
|
|
70
|
+
`Relay : ${relayUrl}`,
|
|
71
|
+
'Press Ctrl+C to stop.',
|
|
72
|
+
]);
|
|
73
|
+
process.on('SIGINT', () => {
|
|
74
|
+
agents.forEach((a) => a.disconnect());
|
|
75
|
+
process.exit(0);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=agent-start.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-start.js","sourceRoot":"","sources":["../../src/commands/agent-start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAQ5D,MAAM,aAAa,GAAG,qBAAqB,CAAA;AAE3C,MAAM,cAAc,GAAG,CAAC;KACrB,MAAM,EAAE;KACR,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;IAC9D,OAAO,EAAE,yCAAyC;CACnD,CAAC,CAAA;AAEJ,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAuB;IACzD,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAA;IAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,IAAI,aAAa,CAAA;IAC5C,MAAM,WAAW,GAAG,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC,C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,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAA;QACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boot.d.ts","sourceRoot":"","sources":["../../src/commands/boot.ts"],"names":[],"mappings":"AAGA,wBAAsB,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA+C/D"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { execSync, spawn } from 'node:child_process';
|
|
2
|
+
import { banner, createSpinner, step } from '../lib/print.js';
|
|
3
|
+
export async function cmdBoot(nameOrUdid) {
|
|
4
|
+
// iOS 먼저 탐색
|
|
5
|
+
if (process.platform === 'darwin') {
|
|
6
|
+
try {
|
|
7
|
+
const raw = execSync('xcrun simctl list devices --json', { encoding: 'utf8', stdio: 'pipe' });
|
|
8
|
+
const data = JSON.parse(raw);
|
|
9
|
+
const target = Object.values(data.devices).flat().find((d) => d.udid === nameOrUdid || d.name === nameOrUdid);
|
|
10
|
+
if (target) {
|
|
11
|
+
if (target.state === 'Booted') {
|
|
12
|
+
step(`${target.name} is already booted.`);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const spinner = createSpinner(`Booting iOS Simulator: ${target.name}…`);
|
|
16
|
+
spinner.start();
|
|
17
|
+
execSync(`xcrun simctl boot ${target.udid}`, { stdio: 'pipe' });
|
|
18
|
+
spinner.stop(true);
|
|
19
|
+
step(`${target.name} booted.`);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
catch { /* xcrun unavailable */ }
|
|
24
|
+
}
|
|
25
|
+
// Android AVD 탐색
|
|
26
|
+
try {
|
|
27
|
+
execSync('which emulator', { stdio: 'pipe' });
|
|
28
|
+
const avdList = execSync('emulator -list-avds', { encoding: 'utf8', stdio: 'pipe' })
|
|
29
|
+
.trim().split('\n').map((l) => l.trim()).filter(Boolean);
|
|
30
|
+
const target = avdList.find((avd) => avd === nameOrUdid);
|
|
31
|
+
if (target) {
|
|
32
|
+
// emulator는 실행 후 종료되지 않으므로 detached로 백그라운드 기동
|
|
33
|
+
const child = spawn('emulator', [`@${target}`], { detached: true, stdio: 'ignore' });
|
|
34
|
+
child.unref();
|
|
35
|
+
step(`Android AVD: ${target} is starting in the background.`);
|
|
36
|
+
step('Run `tapflow devices` to check boot status.');
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch { /* emulator unavailable */ }
|
|
41
|
+
banner('error', 'DEVICE NOT FOUND', [
|
|
42
|
+
`"${nameOrUdid}" does not match any simulator or AVD.`,
|
|
43
|
+
'Run `tapflow devices` to see available devices.',
|
|
44
|
+
]);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=boot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boot.js","sourceRoot":"","sources":["../../src/commands/boot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAE7D,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,UAAkB;IAC9C,YAAY;IACZ,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClC,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,QAAQ,CAAC,kCAAkC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;YAC7F,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAE1B,CAAA;YACD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAA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AU,CAAC,CAAA;QACxD,IAAI,MAAM,EAAE,CAAC;YACX,8CAA8C;YAC9C,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC,IAAI,MAAM,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAA;YACpF,KAAK,CAAC,KAAK,EAAE,CAAA;YACb,IAAI,CAAC,gBAAgB,MAAM,iCAAiC,CAAC,CAAA;YAC7D,IAAI,CAAC,6CAA6C,CAAC,CAAA;YACnD,OAAM;QACR,CAAC;IACH,CAAC;IAAC,MAAM,CAAC,CAAC,0BAA0B,CAAC,CAAC;IAEtC,MAAM,CAAC,OAAO,EAAE,kBAAkB,EAAE;QAClC,IAAI,UAAU,wCAAwC;QACtD,iDAAiD;KAClD,CAAC,CAAA;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devices.d.ts","sourceRoot":"","sources":["../../src/commands/devices.ts"],"names":[],"mappings":"AASA,wBAAgB,UAAU,IAAI,IAAI,CA+EjC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
import { banner } from '../lib/print.js';
|
|
3
|
+
export function cmdDevices() {
|
|
4
|
+
const sections = [];
|
|
5
|
+
// ── iOS ───────────────────────────────────────────────────────────────────
|
|
6
|
+
try {
|
|
7
|
+
const raw = execSync('xcrun simctl list devices --json', { encoding: 'utf8', stdio: 'pipe' });
|
|
8
|
+
const data = JSON.parse(raw);
|
|
9
|
+
const all = Object.values(data.devices).flat().filter((d) => d.udid);
|
|
10
|
+
const booted = all.filter((d) => d.state === 'Booted');
|
|
11
|
+
const available = all.filter((d) => d.state === 'Shutdown');
|
|
12
|
+
const lines = [];
|
|
13
|
+
if (booted.length > 0) {
|
|
14
|
+
lines.push(' Booted:');
|
|
15
|
+
for (const d of booted)
|
|
16
|
+
lines.push(` ● ${d.name} ${d.udid}`);
|
|
17
|
+
}
|
|
18
|
+
if (available.length > 0) {
|
|
19
|
+
lines.push(' Available:');
|
|
20
|
+
for (const d of available.slice(0, 20))
|
|
21
|
+
lines.push(` ○ ${d.name} ${d.udid}`);
|
|
22
|
+
if (available.length > 20)
|
|
23
|
+
lines.push(` … and ${available.length - 20} more`);
|
|
24
|
+
}
|
|
25
|
+
if (lines.length > 0)
|
|
26
|
+
sections.push('iOS Simulators:\n' + lines.join('\n'));
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// xcrun not available — skip iOS section
|
|
30
|
+
}
|
|
31
|
+
// ── Android ───────────────────────────────────────────────────────────────
|
|
32
|
+
try {
|
|
33
|
+
execSync('which adb', { stdio: 'pipe' });
|
|
34
|
+
const runningLines = [];
|
|
35
|
+
try {
|
|
36
|
+
const adbOut = execSync('adb devices', { encoding: 'utf8', stdio: 'pipe' });
|
|
37
|
+
const running = adbOut.trim().split('\n').slice(1).filter((l) => l.startsWith('emulator-'));
|
|
38
|
+
for (const line of running) {
|
|
39
|
+
const serial = line.split('\t')[0]?.trim() ?? '';
|
|
40
|
+
try {
|
|
41
|
+
const name = execSync(`adb -s ${serial} emu avd name`, { encoding: 'utf8', stdio: 'pipe' })
|
|
42
|
+
.split('\n')[0]?.trim() ?? serial;
|
|
43
|
+
runningLines.push(` ● ${name} ${serial}`);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
runningLines.push(` ● ${serial}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch { /* adb devices failed */ }
|
|
51
|
+
const availableLines = [];
|
|
52
|
+
try {
|
|
53
|
+
const avdOut = execSync('emulator -list-avds', { encoding: 'utf8', stdio: 'pipe' }).trim();
|
|
54
|
+
const allAvds = avdOut ? avdOut.split('\n').map((l) => l.trim()).filter(Boolean) : [];
|
|
55
|
+
const runningNames = runningLines.map((l) => l.split(' ')[0]?.replace(' ● ', '') ?? '');
|
|
56
|
+
for (const avd of allAvds) {
|
|
57
|
+
if (!runningNames.includes(avd))
|
|
58
|
+
availableLines.push(` ○ ${avd}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch { /* emulator not in PATH */ }
|
|
62
|
+
const lines = [];
|
|
63
|
+
if (runningLines.length > 0) {
|
|
64
|
+
lines.push(' Running:');
|
|
65
|
+
lines.push(...runningLines);
|
|
66
|
+
}
|
|
67
|
+
if (availableLines.length > 0) {
|
|
68
|
+
lines.push(' Available:');
|
|
69
|
+
lines.push(...availableLines);
|
|
70
|
+
}
|
|
71
|
+
if (lines.length > 0)
|
|
72
|
+
sections.push('Android AVDs:\n' + lines.join('\n'));
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// adb not in PATH — skip Android section
|
|
76
|
+
}
|
|
77
|
+
if (sections.length === 0) {
|
|
78
|
+
banner('error', 'NO DEVICES FOUND', ['Run `tapflow doctor` to diagnose your environment.']);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
console.log();
|
|
82
|
+
console.log(sections.join('\n\n'));
|
|
83
|
+
console.log();
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=devices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devices.js","sourceRoot":"","sources":["../../src/commands/devices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAQxC,MAAM,UAAU,UAAU;IACxB,MAAM,QAAQ,GAAa,EAAE,CAAA;IAE7B,6EAA6E;IAC7E,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,QAAQ,CAAC,kCAAkC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;QAC7F,MAAM,IAAI,GAAG,IAAI,CAAC,KAA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,KAAK,CAAC,MAAM,GAAG,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAC3E,CAAC;IAAC,MAAM,CAAC;QACP,yCAAyC;IAC3C,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,CAAC,OAAO,EAAE,kBAAkB,EAAE,CAAC,oDAAoD,CAAC,CAAC,CAAA;QAC3F,OAAM;IACR,CAAC;IAED,OAAO,CAAC,GAAG,EAAE,CAAA;IACb,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;IAClC,OAAO,CAAC,GAAG,EAAE,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAiBA,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAyB/C"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { runDoctorChecks } from '../lib/doctor.js';
|
|
2
|
+
import { banner, step, GREEN, RED, BOLD, DIM, R } from '../lib/print.js';
|
|
3
|
+
function printChecks(checks) {
|
|
4
|
+
let hasFailure = false;
|
|
5
|
+
for (const check of checks) {
|
|
6
|
+
if (check.ok) {
|
|
7
|
+
console.log(` ${GREEN}✓${R} ${check.label}`);
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
console.log(` ${RED}✗${R} ${check.label}`);
|
|
11
|
+
if (check.detail)
|
|
12
|
+
console.log(`${DIM} → ${check.detail}${R}`);
|
|
13
|
+
hasFailure = true;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return hasFailure;
|
|
17
|
+
}
|
|
18
|
+
export async function cmdDoctor() {
|
|
19
|
+
console.log('\ntapflow doctor\n');
|
|
20
|
+
const result = await runDoctorChecks();
|
|
21
|
+
let hasFailure = false;
|
|
22
|
+
hasFailure = printChecks(result.common) || hasFailure;
|
|
23
|
+
if (result.ios) {
|
|
24
|
+
console.log(`\n ${BOLD}iOS${R}`);
|
|
25
|
+
hasFailure = printChecks(result.ios) || hasFailure;
|
|
26
|
+
}
|
|
27
|
+
if (result.android) {
|
|
28
|
+
console.log(`\n ${BOLD}Android${R}`);
|
|
29
|
+
hasFailure = printChecks(result.android) || hasFailure;
|
|
30
|
+
}
|
|
31
|
+
console.log();
|
|
32
|
+
if (hasFailure) {
|
|
33
|
+
banner('error', 'SOME CHECKS FAILED', ['Fix the issues above before running `tapflow start`.']);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
step('All checks passed.');
|
|
38
|
+
console.log();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAoB,MAAM,kBAAkB,CAAA;AACpE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAA;AAExE,SAAS,WAAW,CAAC,MAAqB;IACxC,IAAI,UAAU,GAAG,KAAK,CAAA;IACtB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,EAAE,EAAE,CAAC;YACb,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,KAAK,CAAC,KAAK,EAAE,CAAC,CAAA;QAChD,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,KAAK,CAAC,KAAK,EAAE,CAAC,CAAA;YAC5C,IAAI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commands/init.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAgE9D"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as readline from 'node:readline/promises';
|
|
2
|
+
import { stdin as input, stdout as output } from 'node:process';
|
|
3
|
+
import { createSpinner, banner, step } from '../lib/print.js';
|
|
4
|
+
export async function cmdInit(opts) {
|
|
5
|
+
const baseUrl = (opts.relay ?? 'http://localhost:4000').replace(/^wss?:\/\//, 'http://');
|
|
6
|
+
const rl = readline.createInterface({ input, output });
|
|
7
|
+
const email = (await rl.question(' ? Admin email: ')).trim();
|
|
8
|
+
// Node.js has no native password-input API. Suppress echo via readline's internal
|
|
9
|
+
// _writeToOutput hook — a widely used convention that remains stable across versions.
|
|
10
|
+
process.stdout.write(' ? Password: ');
|
|
11
|
+
const rlAny = rl;
|
|
12
|
+
const origWriteToOutput = rlAny._writeToOutput;
|
|
13
|
+
if (origWriteToOutput)
|
|
14
|
+
rlAny._writeToOutput = () => { };
|
|
15
|
+
const password = (await rl.question('')).trim();
|
|
16
|
+
if (origWriteToOutput)
|
|
17
|
+
rlAny._writeToOutput = origWriteToOutput;
|
|
18
|
+
process.stdout.write('\n');
|
|
19
|
+
rl.close();
|
|
20
|
+
if (!email) {
|
|
21
|
+
banner('error', 'INVALID INPUT', ['Email is required.']);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
if (!password || password.length < 8) {
|
|
25
|
+
banner('error', 'INVALID INPUT', ['Password must be at least 8 characters.']);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
const spinner = createSpinner('Creating admin account...');
|
|
29
|
+
spinner.start();
|
|
30
|
+
let res = null;
|
|
31
|
+
try {
|
|
32
|
+
res = await fetch(`${baseUrl}/api/v1/auth/init`, {
|
|
33
|
+
method: 'POST',
|
|
34
|
+
headers: { 'Content-Type': 'application/json' },
|
|
35
|
+
body: JSON.stringify({ email, password }),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
spinner.stop(false);
|
|
40
|
+
banner('error', 'Could not connect to relay', [
|
|
41
|
+
`Relay not found at ${baseUrl}`,
|
|
42
|
+
'Run tapflow start first, then tapflow init.',
|
|
43
|
+
]);
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
if (!res.ok) {
|
|
47
|
+
spinner.stop(false);
|
|
48
|
+
const data = await res.json();
|
|
49
|
+
if (res.status === 403) {
|
|
50
|
+
banner('error', 'Already initialized', [
|
|
51
|
+
'An admin account already exists.',
|
|
52
|
+
'Use Settings → Team in the dashboard to manage users.',
|
|
53
|
+
]);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
banner('error', 'Failed to create admin', [data.error ?? `HTTP ${res.status}`]);
|
|
57
|
+
}
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
spinner.stop(true);
|
|
61
|
+
banner('success', 'Admin account created', [`Email: ${email}`]);
|
|
62
|
+
step(`Open ${baseUrl} to sign in`);
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAM7D,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAiB;IAC7C,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,uBAAuB,CAAC,CAAC,O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O,aAAa,CAAC,CAAA;AACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../src/commands/logs.ts"],"names":[],"mappings":"AAEA,wBAAsB,OAAO,CAAC,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBrF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DIM, RED, R } from '../lib/print.js';
|
|
2
|
+
export async function cmdLogs(opts) {
|
|
3
|
+
const base = (opts.relay ?? 'http://localhost:4000').replace(/^ws/, 'http');
|
|
4
|
+
const lines = opts.lines ?? 100;
|
|
5
|
+
const url = `${base}/api/v1/logs?lines=${lines}`;
|
|
6
|
+
const res = await fetch(url).catch(() => null);
|
|
7
|
+
if (!res || !res.ok) {
|
|
8
|
+
console.error(`\n ${RED}✗${R} Could not reach relay at ${base}\n Make sure tapflow is running.\n`);
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
const entries = await res.json();
|
|
12
|
+
if (entries.length === 0) {
|
|
13
|
+
console.log(`\n ${DIM}No log entries yet.${R}\n`);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
console.log();
|
|
17
|
+
for (const line of entries) {
|
|
18
|
+
console.log(` ${DIM}${line}${R}`);
|
|
19
|
+
}
|
|
20
|
+
console.log();
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=logs.js.map
|