@quicktvui/ai-cli 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -0
- package/bin/quicktvui-ai-create-project.js +8 -0
- package/bin/quicktvui-aicreate-project.js +8 -0
- package/docs/esapp-protocol.md +134 -0
- package/lib/index.js +2317 -3
- package/package.json +7 -2
- package/scripts/install +44 -0
- package/scripts/install.ps1 +28 -0
- package/templates/quicktvui-template/.eslintrc.cjs +15 -0
- package/templates/quicktvui-template/.husky/pre-commit +4 -0
- package/templates/quicktvui-template/.prettierrc.json +8 -0
- package/templates/quicktvui-template/.vscode/extensions.json +7 -0
- package/templates/quicktvui-template/LICENSE +201 -0
- package/templates/quicktvui-template/README.md +36 -0
- package/templates/quicktvui-template/package-lock.json +12108 -0
- package/templates/quicktvui-template/package.json +29 -0
- package/templates/quicktvui-template/src/App.vue +30 -0
- package/templates/quicktvui-template/src/assets/logo.png +0 -0
- package/templates/quicktvui-template/src/components/WebRTCPlayer.ts +48 -0
- package/templates/quicktvui-template/src/main.ts +29 -0
- package/templates/quicktvui-template/src/routes.ts +21 -0
- package/templates/quicktvui-template/src/views/cast.vue +42 -0
- package/templates/quicktvui-template/src/views/error.vue +32 -0
- package/templates/quicktvui-template/src/views/home.vue +60 -0
- package/templates/quicktvui-template/tsconfig.json +19 -0
- package/templates/quicktvui-template/yarn.lock +6077 -0
package/README.md
CHANGED
|
@@ -15,7 +15,17 @@ quicktvui-ai init
|
|
|
15
15
|
quicktvui-ai doctor
|
|
16
16
|
quicktvui-ai validate
|
|
17
17
|
quicktvui-ai update
|
|
18
|
+
quicktvui-ai create-project quick-tv-app
|
|
19
|
+
quicktvui-ai setup-vue-env --project ./quick-tv-app
|
|
20
|
+
quicktvui-ai setup-android-env --project ./quick-tv-app
|
|
21
|
+
quicktvui-ai setup-all-env --project ./quick-tv-app
|
|
22
|
+
quicktvui-ai run-dev --project ./quick-tv-app
|
|
23
|
+
quicktvui-ai run-esapp --project ./quick-tv-app --pkg es.hello.world
|
|
18
24
|
quicktvui-ai prompt --lang zh
|
|
25
|
+
|
|
26
|
+
# alias commands for create-project
|
|
27
|
+
quicktvui-ai-create-project quick-tv-app
|
|
28
|
+
quicktvui-aicreate-project quick-tv-app
|
|
19
29
|
```
|
|
20
30
|
|
|
21
31
|
## Default install path
|
|
@@ -26,8 +36,36 @@ quicktvui-ai prompt --lang zh
|
|
|
26
36
|
|
|
27
37
|
- `--dir <path>`: custom skill path
|
|
28
38
|
- `--project <path>`: custom project root for rule checks
|
|
39
|
+
- `--dest <path>`: destination base directory for `create-project`
|
|
40
|
+
- `--offline`: use bundled template directly for `create-project`
|
|
41
|
+
- `--skip-install`: skip dependency install for `create-project`
|
|
29
42
|
- `--strict`: fail on doctor check issues
|
|
30
43
|
- `--lang <code>`: prompt language for `prompt` command (`zh` or `en`)
|
|
44
|
+
- `--node-major <n>`: target Node.js LTS major for `setup-vue-env` (default `20`)
|
|
45
|
+
- `--skip-node-install`: skip Node.js install stage in `setup-vue-env`
|
|
46
|
+
- `--force-node-install`: force Node.js install stage in `setup-vue-env`
|
|
47
|
+
- `--skip-yarn-install`: skip yarn global install in `setup-vue-env`
|
|
48
|
+
- `--skip-quicktvui-cli-install`: skip `@quicktvui/cli` global install in `setup-vue-env`
|
|
49
|
+
- `--skip-project-install`: skip project dependency install in `setup-vue-env`
|
|
50
|
+
- `--auto-emulator <true|false>`: auto create/start emulator when no adb device
|
|
51
|
+
- `--adb-path <path>`: custom adb path/command (or use env `QUICKTVUI_ADB_PATH`)
|
|
52
|
+
- `--device-ip <ip[:port]>`: preferred real device endpoint for `adb connect`
|
|
53
|
+
- `--avd-name <name>`: custom AVD name for `setup-android-env`
|
|
54
|
+
- `--headless`: start emulator with `-no-window -no-audio`
|
|
55
|
+
- `--runtime-setup-mode <direct|qui>`: runtime setup mode (default `direct`)
|
|
56
|
+
- `--runtime-version <version>`: pin runtime version in `direct` mode
|
|
57
|
+
- `--runtime-url <url>`: use custom runtime apk url in `direct` mode
|
|
58
|
+
- `--server-host <ip>`: override debug server host IP
|
|
59
|
+
- `--force-runtime-install`: force reinstall runtime in `direct` mode
|
|
60
|
+
- `--skip-runtime-setup`: skip runtime setup in `setup-android-env`/`run-dev`
|
|
61
|
+
- `--auto-load-local-bundle <true|false>`: auto trigger runtime to load local bundle in `run-dev`
|
|
62
|
+
- `--port <n>`: dev server port used by `run-dev` auto load (default `38989`)
|
|
63
|
+
- `--skip-env-check`: skip environment stage in `run-dev`
|
|
64
|
+
- `--runtime-package <pkg>`: runtime package for `run-esapp` (default `com.extscreen.runtime`)
|
|
65
|
+
- `--device <serial>`: target adb serial for `run-esapp`
|
|
66
|
+
- `--esapp-uri <uri>`: raw launch URI (`esapp://`, `quicktv://`, `appcast://`)
|
|
67
|
+
- `--esapp-query <json>`: extra query params JSON merged in structured mode
|
|
68
|
+
- `--pkg --ver --min-ver --repository --uri --from --args --exp --flags --use-latest`: structured `esapp://action/start` params
|
|
31
69
|
|
|
32
70
|
## Typical flow
|
|
33
71
|
|
|
@@ -38,6 +76,97 @@ quicktvui-ai doctor
|
|
|
38
76
|
|
|
39
77
|
Then reload your AI agent so it rescans local skills.
|
|
40
78
|
|
|
79
|
+
## Create project with network fallback
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
quicktvui-ai create-project quick-tv-app
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
This command:
|
|
86
|
+
|
|
87
|
+
1. Tries to clone `quicktvui-template` from GitHub.
|
|
88
|
+
2. Falls back to the bundled local template if clone fails.
|
|
89
|
+
3. Updates `package.json` (`name`, `version`).
|
|
90
|
+
4. Ensures `@quicktvui/ai` exists in `devDependencies`.
|
|
91
|
+
5. Installs dependencies (`yarn install`, or `npm install` fallback).
|
|
92
|
+
|
|
93
|
+
## Configure Android env (device/emulator + runtime)
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
quicktvui-ai setup-android-env --project ./quick-tv-app
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
This command:
|
|
100
|
+
|
|
101
|
+
1. Detects Android SDK root (auto creates a default SDK root when missing).
|
|
102
|
+
2. Detects Android SDK/adb/emulator tools. `@quicktvui/ai-cli` does not bundle adb.
|
|
103
|
+
3. If sdkmanager/avdmanager is missing, it auto-downloads and installs official Android Command-line Tools.
|
|
104
|
+
4. If adb is missing, it auto-installs `platform-tools` (with size estimate + sdkmanager progress).
|
|
105
|
+
5. Detects connected adb devices, and asks whether to use connected device.
|
|
106
|
+
6. If user doesn't use connected device (or no device exists), it asks for real-device IP and runs `adb connect`.
|
|
107
|
+
7. If still no real device, asks whether to download/start official Google Android emulator.
|
|
108
|
+
8. Checks Google repository reachability before emulator download; if unavailable, asks user to install emulator manually.
|
|
109
|
+
9. Prints estimated download size and then starts sdkmanager download (progress shown by sdkmanager).
|
|
110
|
+
10. Installs runtime APK and configures debug server host (direct mode by default).
|
|
111
|
+
11. Launches runtime app and waits it enters running state.
|
|
112
|
+
|
|
113
|
+
To use official interactive setup flow instead of direct mode:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
quicktvui-ai setup-android-env --project ./quick-tv-app --runtime-setup-mode qui
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Configure Vue env (Node + package manager)
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
quicktvui-ai setup-vue-env --project ./quick-tv-app
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
This command:
|
|
126
|
+
|
|
127
|
+
1. Ensures Node.js LTS (macOS/Windows auto install).
|
|
128
|
+
2. Ensures `yarn` and `@quicktvui/cli` are installed globally.
|
|
129
|
+
3. Installs project dependencies (`yarn install` or `npm install` fallback).
|
|
130
|
+
|
|
131
|
+
## Configure All Dev Envs
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
quicktvui-ai setup-all-env --project ./quick-tv-app
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
This command runs `setup-vue-env` and `setup-android-env` sequentially.
|
|
138
|
+
|
|
139
|
+
## Run development server
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
quicktvui-ai run-dev --project ./quick-tv-app
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
This command:
|
|
146
|
+
|
|
147
|
+
1. Runs `setup-android-env` by default.
|
|
148
|
+
2. Starts project dev script (`yarn dev`, `pnpm dev`, or `npm run dev`).
|
|
149
|
+
3. Waits for local server port (default `38989`) and auto triggers runtime to load local bundle.
|
|
150
|
+
4. Supports `run-esapp` structured options (`--pkg/--ver/--repository/...`) or `--esapp-uri` to override auto launch URI.
|
|
151
|
+
|
|
152
|
+
## Run ES app by protocol
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# structured mode (recommended for AI)
|
|
156
|
+
quicktvui-ai run-esapp --project ./quick-tv-app --pkg es.hello.world --from cmd
|
|
157
|
+
|
|
158
|
+
# local dev bundle
|
|
159
|
+
quicktvui-ai run-esapp --project ./quick-tv-app --pkg es.hello.world --uri 192.168.1.10:38989
|
|
160
|
+
|
|
161
|
+
# remote repository + pinned version
|
|
162
|
+
quicktvui-ai run-esapp --project ./quick-tv-app --pkg liulipeng/com.zoo --ver 1.0.0 --repository http://repo.quicktvui.com/repository/rpk
|
|
163
|
+
|
|
164
|
+
# raw URI passthrough (full compatibility)
|
|
165
|
+
quicktvui-ai run-esapp --esapp-uri 'esapp://action/start?from=cmd&pkg=es.hello.world&uri=assets://hello.rpk'
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Full protocol reference: [`docs/esapp-protocol.md`](./docs/esapp-protocol.md)
|
|
169
|
+
|
|
41
170
|
## Generate LLM install prompt
|
|
42
171
|
|
|
43
172
|
```bash
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# ESApp Protocol Reference (`esapp://`, `quicktv://`, `appcast://`)
|
|
2
|
+
|
|
3
|
+
This document summarizes runtime launch protocol behavior from:
|
|
4
|
+
|
|
5
|
+
- `es-sdk/sdk-core-entry/src/main/AndroidManifest.xml`
|
|
6
|
+
- `es-sdk/sdk-core/src/main/java/eskit/sdk/core/utils/MapperUtils.java`
|
|
7
|
+
- `es-sdk/sdk-core/src/main/java/eskit/sdk/core/protocol/Protocol_2.java`
|
|
8
|
+
- `es-sdk/sdk-core/src/main/java/eskit/sdk/core/EsData.java`
|
|
9
|
+
|
|
10
|
+
## 1) Supported URI Schemes
|
|
11
|
+
|
|
12
|
+
Runtime entry activity accepts:
|
|
13
|
+
|
|
14
|
+
- `esapp://`
|
|
15
|
+
- `quicktv://`
|
|
16
|
+
- `appcast://`
|
|
17
|
+
|
|
18
|
+
## 2) Parsing Modes
|
|
19
|
+
|
|
20
|
+
### Mode A: V1 action URI (recommended for command tools)
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
esapp://action/start?from=cmd&pkg=es.hello.world&...
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Behavior:
|
|
27
|
+
|
|
28
|
+
- Recognized only when `scheme=esapp` and `host=action`.
|
|
29
|
+
- `/start` maps to `action=start_es`.
|
|
30
|
+
- All query params are forwarded to protocol JSON.
|
|
31
|
+
|
|
32
|
+
### Mode B: V2 package URI (esapp/quicktv/appcast)
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
esapp://es.hello.world?from=cmd
|
|
36
|
+
esapp://es.hello.world/1.0.3?from=cmd
|
|
37
|
+
quicktv://es.hello.world?from=cmd
|
|
38
|
+
appcast://es.hello.world/1.0.3?from=cmd
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Behavior:
|
|
42
|
+
|
|
43
|
+
- If `repository` is absent:
|
|
44
|
+
- `host` is treated as `pkg`
|
|
45
|
+
- first path segment (if present) is treated as `ver`
|
|
46
|
+
- If `repository` is present:
|
|
47
|
+
- `pkg = host + "/" + firstPathSegment`
|
|
48
|
+
- `ver = secondPathSegment` (optional)
|
|
49
|
+
|
|
50
|
+
Repository-mode examples:
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
esapp://huantv/zoo?repository=http://repo.example/rpk&from=cmd
|
|
54
|
+
esapp://huantv/zoo/1.0.0?repository=http://repo.example/rpk&from=cmd
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 3) Required Fields
|
|
58
|
+
|
|
59
|
+
At dispatch stage (`Protocol_2`):
|
|
60
|
+
|
|
61
|
+
- `from` is required (empty is rejected)
|
|
62
|
+
- `pkg` is required for `start_es`
|
|
63
|
+
|
|
64
|
+
So command tools should always include:
|
|
65
|
+
|
|
66
|
+
- `from=cmd` (or your caller id)
|
|
67
|
+
- `pkg=<es-package>`
|
|
68
|
+
|
|
69
|
+
## 4) Launch Query Parameters (Runtime `EsData` mapping)
|
|
70
|
+
|
|
71
|
+
Supported startup keys include:
|
|
72
|
+
|
|
73
|
+
- `pkg`
|
|
74
|
+
- `ver`
|
|
75
|
+
- `minVer`
|
|
76
|
+
- `repository`
|
|
77
|
+
- `uri`
|
|
78
|
+
- `args` (JSON string)
|
|
79
|
+
- `exp` (JSON string)
|
|
80
|
+
- `flags`
|
|
81
|
+
- `useLatest`
|
|
82
|
+
- `name`
|
|
83
|
+
- `icon`
|
|
84
|
+
- `isCard`
|
|
85
|
+
- `transparent`
|
|
86
|
+
- `pageTag`
|
|
87
|
+
- `pageLimit`
|
|
88
|
+
- `bgColor`
|
|
89
|
+
- `enc`
|
|
90
|
+
- `checkNetwork`
|
|
91
|
+
- `splash`
|
|
92
|
+
- `feature_single_activity`
|
|
93
|
+
|
|
94
|
+
## 5) Flags Compatibility
|
|
95
|
+
|
|
96
|
+
`flags` supports legacy values and maps internally:
|
|
97
|
+
|
|
98
|
+
- `100 -> CLEAR_TASK`
|
|
99
|
+
- `200 -> SINGLE_TASK`
|
|
100
|
+
- `300 -> SINGLE_TOP`
|
|
101
|
+
- `400 -> SINGLE_INSTANCE`
|
|
102
|
+
- `236 -> CLEAR_TASK | SINGLE_TASK`
|
|
103
|
+
- `364 -> CLEAR_TASK | SINGLE_TOP`
|
|
104
|
+
- `500 -> CLEAR_TASK | SINGLE_INSTANCE`
|
|
105
|
+
|
|
106
|
+
## 6) URI Source Types (`uri=...`)
|
|
107
|
+
|
|
108
|
+
Runtime supports common local/remote load forms through `uri`, including:
|
|
109
|
+
|
|
110
|
+
- LAN debug server: `192.168.x.x:38989` or `http://192.168.x.x:38989`
|
|
111
|
+
- Remote package: `http://.../xxx.rpk` or `https://...`
|
|
112
|
+
- Assets: `assets://...`
|
|
113
|
+
- Local file: `file://...`
|
|
114
|
+
|
|
115
|
+
## 7) ADB Launch Form
|
|
116
|
+
|
|
117
|
+
Typical launch command:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
adb shell am start \
|
|
121
|
+
-a android.intent.action.VIEW \
|
|
122
|
+
-p com.extscreen.runtime \
|
|
123
|
+
-d 'esapp://action/start?from=cmd&pkg=es.hello.world'
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## 8) CLI Support (`@quicktvui/ai-cli`)
|
|
127
|
+
|
|
128
|
+
`quicktvui-ai run-esapp` supports:
|
|
129
|
+
|
|
130
|
+
- Raw URI passthrough: `--esapp-uri '<uri>'` (full compatibility)
|
|
131
|
+
- Structured launch: `--pkg/--ver/--min-ver/--repository/--uri/--args/--exp/...`
|
|
132
|
+
- Extra custom query map: `--esapp-query '{"k":"v"}'`
|
|
133
|
+
|
|
134
|
+
This combination covers all runtime protocol variants while preserving backward compatibility.
|