@quicktvui/ai-cli 0.1.0 → 1.1.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/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,38 @@ 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
+ - `--gemini-dir <path>`: custom Gemini config directory (default `~/.gemini`, or `$GEMINI_CLI_HOME/.gemini`)
45
+ - `--skip-gemini-config`: skip updating Gemini bridge config during `init`/`update`
46
+ - `--node-major <n>`: target Node.js LTS major for `setup-vue-env` (default `20`)
47
+ - `--skip-node-install`: skip Node.js install stage in `setup-vue-env`
48
+ - `--force-node-install`: force Node.js install stage in `setup-vue-env`
49
+ - `--skip-yarn-install`: skip yarn global install in `setup-vue-env`
50
+ - `--skip-quicktvui-cli-install`: skip `@quicktvui/cli` global install in `setup-vue-env`
51
+ - `--skip-project-install`: skip project dependency install in `setup-vue-env`
52
+ - `--auto-emulator <true|false>`: auto create/start emulator when no adb device
53
+ - `--adb-path <path>`: custom adb path/command (or use env `QUICKTVUI_ADB_PATH`)
54
+ - `--device-ip <ip[:port]>`: preferred real device endpoint for `adb connect`
55
+ - `--avd-name <name>`: custom AVD name for `setup-android-env`
56
+ - `--headless`: start emulator with `-no-window -no-audio`
57
+ - `--runtime-setup-mode <direct|qui>`: runtime setup mode (default `direct`)
58
+ - `--runtime-version <version>`: pin runtime version in `direct` mode
59
+ - `--runtime-url <url>`: use custom runtime apk url in `direct` mode
60
+ - `--server-host <ip>`: override debug server host IP
61
+ - `--force-runtime-install`: force reinstall runtime in `direct` mode
62
+ - `--skip-runtime-setup`: skip runtime setup in `setup-android-env`/`run-dev`
63
+ - `--auto-load-local-bundle <true|false>`: auto trigger runtime to load local bundle in `run-dev`
64
+ - `--port <n>`: dev server port used by `run-dev` auto load (default `38989`)
65
+ - `--skip-env-check`: skip environment stage in `run-dev`
66
+ - `--runtime-package <pkg>`: runtime package for `run-esapp` (default `com.extscreen.runtime`)
67
+ - `--device <serial>`: target adb serial for `run-esapp`
68
+ - `--esapp-uri <uri>`: raw launch URI (`esapp://`, `quicktv://`, `appcast://`)
69
+ - `--esapp-query <json>`: extra query params JSON merged in structured mode
70
+ - `--pkg --ver --min-ver --repository --uri --from --args --exp --flags --use-latest`: structured `esapp://action/start` params
31
71
 
32
72
  ## Typical flow
33
73
 
@@ -38,6 +78,103 @@ quicktvui-ai doctor
38
78
 
39
79
  Then reload your AI agent so it rescans local skills.
40
80
 
81
+ `init`/`update` also auto-maintains Gemini global context files:
82
+
83
+ - updates `~/.gemini/GEMINI.md` with QuickTVUI `@.../SKILL.md` bridge block
84
+ - ensures `~/.gemini/settings.json` contains `context.fileName` entries:
85
+ `GEMINI.md`, `AGENTS.md`, `SKILL.md`, `CONTEXT.md`
86
+
87
+ ## Create project with network fallback
88
+
89
+ ```bash
90
+ quicktvui-ai create-project quick-tv-app
91
+ ```
92
+
93
+ This command:
94
+
95
+ 1. Tries to clone `quicktvui-template` from GitHub.
96
+ 2. Falls back to the bundled local template if clone fails.
97
+ 3. Updates `package.json` (`name`, `version`).
98
+ 4. Ensures `@quicktvui/ai` exists in `devDependencies`.
99
+ 5. Installs dependencies (`yarn install`, or `npm install` fallback).
100
+
101
+ ## Configure Android env (device/emulator + runtime)
102
+
103
+ ```bash
104
+ quicktvui-ai setup-android-env --project ./quick-tv-app
105
+ ```
106
+
107
+ This command:
108
+
109
+ 1. Detects Android SDK root (auto creates a default SDK root when missing).
110
+ 2. Detects Android SDK/adb/emulator tools. `@quicktvui/ai-cli` does not bundle adb.
111
+ 3. If sdkmanager/avdmanager is missing, it auto-downloads and installs official Android Command-line Tools.
112
+ 4. If adb is missing, it auto-installs `platform-tools` (with size estimate + sdkmanager progress).
113
+ 5. Detects connected adb devices, and asks whether to use connected device.
114
+ 6. If user doesn't use connected device (or no device exists), it asks for real-device IP and runs `adb connect`.
115
+ 7. If still no real device, asks whether to download/start official Google Android emulator.
116
+ 8. Checks Google repository reachability before emulator download; if unavailable, asks user to install emulator manually.
117
+ 9. Prints estimated download size and then starts sdkmanager download (progress shown by sdkmanager).
118
+ 10. Installs runtime APK and configures debug server host (direct mode by default).
119
+ 11. Launches runtime app and waits it enters running state.
120
+
121
+ To use official interactive setup flow instead of direct mode:
122
+
123
+ ```bash
124
+ quicktvui-ai setup-android-env --project ./quick-tv-app --runtime-setup-mode qui
125
+ ```
126
+
127
+ ## Configure Vue env (Node + package manager)
128
+
129
+ ```bash
130
+ quicktvui-ai setup-vue-env --project ./quick-tv-app
131
+ ```
132
+
133
+ This command:
134
+
135
+ 1. Ensures Node.js LTS (macOS/Windows auto install).
136
+ 2. Ensures `yarn` and `@quicktvui/cli` are installed globally.
137
+ 3. Installs project dependencies (`yarn install` or `npm install` fallback).
138
+
139
+ ## Configure All Dev Envs
140
+
141
+ ```bash
142
+ quicktvui-ai setup-all-env --project ./quick-tv-app
143
+ ```
144
+
145
+ This command runs `setup-vue-env` and `setup-android-env` sequentially.
146
+
147
+ ## Run development server
148
+
149
+ ```bash
150
+ quicktvui-ai run-dev --project ./quick-tv-app
151
+ ```
152
+
153
+ This command:
154
+
155
+ 1. Runs `setup-android-env` by default.
156
+ 2. Starts project dev script (`yarn dev`, `pnpm dev`, or `npm run dev`).
157
+ 3. Waits for local server port (default `38989`) and auto triggers runtime to load local bundle.
158
+ 4. Supports `run-esapp` structured options (`--pkg/--ver/--repository/...`) or `--esapp-uri` to override auto launch URI.
159
+
160
+ ## Run ES app by protocol
161
+
162
+ ```bash
163
+ # structured mode (recommended for AI)
164
+ quicktvui-ai run-esapp --project ./quick-tv-app --pkg es.hello.world --from cmd
165
+
166
+ # local dev bundle
167
+ quicktvui-ai run-esapp --project ./quick-tv-app --pkg es.hello.world --uri 192.168.1.10:38989
168
+
169
+ # remote repository + pinned version
170
+ quicktvui-ai run-esapp --project ./quick-tv-app --pkg liulipeng/com.zoo --ver 1.0.0 --repository http://repo.quicktvui.com/repository/rpk
171
+
172
+ # raw URI passthrough (full compatibility)
173
+ quicktvui-ai run-esapp --esapp-uri 'esapp://action/start?from=cmd&pkg=es.hello.world&uri=assets://hello.rpk'
174
+ ```
175
+
176
+ Full protocol reference: [`docs/esapp-protocol.md`](./docs/esapp-protocol.md)
177
+
41
178
  ## Generate LLM install prompt
42
179
 
43
180
  ```bash
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { runCli } = require("../lib/index");
4
+
5
+ runCli(["create-project", ...process.argv.slice(2)]).catch((error) => {
6
+ console.error(`[quicktvui-ai] ${error.message}`);
7
+ process.exit(1);
8
+ });
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { runCli } = require("../lib/index");
4
+
5
+ runCli(["create-project", ...process.argv.slice(2)]).catch((error) => {
6
+ console.error(`[quicktvui-ai] ${error.message}`);
7
+ process.exit(1);
8
+ });
@@ -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.