@lingxia/skill 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -0
- package/bin/install.mjs +247 -0
- package/package.json +49 -0
- package/scripts/sync.mjs +69 -0
- package/skill/SKILL.md +334 -0
- package/skill/app/apple-sdk.md +312 -0
- package/skill/app/applinks.md +289 -0
- package/skill/app/project.md +760 -0
- package/skill/cli/lxdev.md +195 -0
- package/skill/cli/reference.md +481 -0
- package/skill/examples/hello-host-js/README.md +25 -0
- package/skill/examples/hello-host-js/home/lxapp.json +12 -0
- package/skill/examples/hello-host-js/home/pages/home/index.json +4 -0
- package/skill/examples/hello-host-js/home/pages/home/index.ts +14 -0
- package/skill/examples/hello-host-js/home/pages/home/index.tsx +15 -0
- package/skill/examples/hello-host-js/lingxia.yaml +39 -0
- package/skill/examples/hello-host-rust/Cargo.toml +15 -0
- package/skill/examples/hello-host-rust/README.md +44 -0
- package/skill/examples/hello-host-rust/home/lxapp.json +13 -0
- package/skill/examples/hello-host-rust/home/pages/home/index.html +46 -0
- package/skill/examples/hello-host-rust/home/pages/home/index.json +4 -0
- package/skill/examples/hello-host-rust/lingxia.yaml +32 -0
- package/skill/examples/hello-host-rust/src/lib.rs +58 -0
- package/skill/examples/hello-lxapp/README.md +29 -0
- package/skill/examples/hello-lxapp/lxapp.config.ts +8 -0
- package/skill/examples/hello-lxapp/lxapp.json +14 -0
- package/skill/examples/hello-lxapp/package.json +14 -0
- package/skill/examples/hello-lxapp/pages/home/index.json +4 -0
- package/skill/examples/hello-lxapp/pages/home/index.ts +35 -0
- package/skill/examples/hello-lxapp/pages/home/index.tsx +34 -0
- package/skill/lxapp/bridge.md +654 -0
- package/skill/lxapp/components.md +375 -0
- package/skill/lxapp/guide.md +675 -0
- package/skill/lxapp/lx-api.md +481 -0
- package/skill/native/development.md +414 -0
- package/skill/reference/file-lifecycle.md +325 -0
- package/skill/skill-manifest.json +6 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# `lxdev` — Drive a running dev session
|
|
2
|
+
|
|
3
|
+
`lxdev` is the external automation client for a running LingXia `lingxia dev` session. It ships from the same crate as `lingxia` and is on `PATH` after a standard install. Use it to inspect / drive the host app's browser tabs, the lxapps inside it, and the dev log stream — without rebuilding or restarting the dev session.
|
|
4
|
+
|
|
5
|
+
This is the **agent-facing** dev surface: every command takes plain flags, prints predictable JSON (with `--json`), and never owns a long-running process. Run it from anywhere inside the project tree.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## How it finds the session
|
|
10
|
+
|
|
11
|
+
`lingxia dev` writes one file per active session under `.lingxia/sessions/<session_id>.json` and removes it on clean exit. `lxdev` scans that directory on every invocation. Each file records:
|
|
12
|
+
|
|
13
|
+
| Field | Purpose |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `session_id` | `<unix-ms>-<uuid>`; stable for the whole session |
|
|
16
|
+
| `pid` | The `lingxia dev` process — diagnostics only |
|
|
17
|
+
| `platform` | `android` / `ios` / `macos` / `harmony` / `lxapp` |
|
|
18
|
+
| `started_at` | Unix milliseconds |
|
|
19
|
+
| `ws_url` | `ws://host:port` the dev websocket is listening on |
|
|
20
|
+
| `log_file` | Path to the session's JSONL log file |
|
|
21
|
+
|
|
22
|
+
There is no daemon. The CLI process that started the session owns its file; nothing else writes there.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Selecting a session
|
|
27
|
+
|
|
28
|
+
When `lxdev` is invoked **without** `--session` or `--platform`:
|
|
29
|
+
|
|
30
|
+
- **One live session in the project** → use it (no probe).
|
|
31
|
+
- **Multiple live sessions** → refuse and list candidates. The user must add `--session <id-prefix>` or `--platform <name>`.
|
|
32
|
+
|
|
33
|
+
Why refuse rather than pick a default? In a project where a human and an agent (Claude / Codex / CI) might both be running dev sessions concurrently, "default to the most recent" silently routes commands to the wrong target. Explicit selection beats a guess.
|
|
34
|
+
|
|
35
|
+
Flags (both are global — they go before the subcommand):
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
lxdev --session 20260520-abc browser tabs
|
|
39
|
+
lxdev --platform ios browser tabs
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`--session` matches by prefix, so a short unique fragment is enough. `--platform` is exact (case-insensitive). Selectors error out if zero or multiple sessions match.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## `lxdev sessions`
|
|
47
|
+
|
|
48
|
+
Inspect / clean up session state:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
lxdev sessions # human-readable table
|
|
52
|
+
lxdev sessions --json # JSON array — each entry has a `stale` boolean
|
|
53
|
+
lxdev sessions prune # remove session files whose WS server no longer responds
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
A session is considered **stale** when a 200ms TCP probe to its `ws_url` fails. Stale entries are normally cleaned up automatically — by the next `lingxia dev` startup (which prunes before checking same-platform conflicts), and by `lxdev` when ambiguity forces it to probe. `lxdev sessions prune` is the manual escape hatch after a hard crash (`kill -9`, IDE force-stop, etc.).
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Subcommand families
|
|
61
|
+
|
|
62
|
+
`lxdev` exposes four families of commands, all of which target a single resolved session:
|
|
63
|
+
|
|
64
|
+
### `lxdev browser …`
|
|
65
|
+
|
|
66
|
+
Drive the host app's browser tabs. Roughly a subset of Playwright's automation surface, scoped to a single LingXia browser instance:
|
|
67
|
+
|
|
68
|
+
`open`, `tabs`, `current`, `activate`, `close`, `reload`, `back`, `forward`, `eval`, `query`, `wait`, `wait-url`, `wait-navigation`, `click`, `type`, `fill`, `press`, `scroll`, `scroll-to`, `cookies list|set|delete|clear`, `screenshot`.
|
|
69
|
+
|
|
70
|
+
Most subcommands accept `--tab current|<tab-id>` (default: `current`) and `--json`. Wait/navigation commands take `--timeout-ms`.
|
|
71
|
+
|
|
72
|
+
**Screenshot** captures a PNG of the tab's visible content via the platform WebView's native snapshot API. By default writes to `.lingxia/screenshots/<tab>-<ts>.png`; pass `--output <path>` or `--output -` for stdout, or `--json` to get the base64-encoded payload inline.
|
|
73
|
+
|
|
74
|
+
This is the **WebView-scope** screenshot — only web content, no host UI overlays. For the entire window (including native sidebars, surfaces, etc.) see `lxdev app screenshot` below.
|
|
75
|
+
|
|
76
|
+
| Platform | WebView screenshot | App/window screenshot |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| macOS | ✅ WKWebView `takeSnapshotWithConfiguration:` → `NSImage` → `NSBitmapImageRep` PNG | ✅ `NSView.cacheDisplayInRect:toBitmapImageRep:` (no Screen Recording permission needed) |
|
|
79
|
+
| iOS | ✅ WKWebView `takeSnapshotWithConfiguration:` → `UIImagePNGRepresentation` | ✅ `UIWindow.layer.renderInContext:` (key UIWindow via scene + fallback chain) |
|
|
80
|
+
| Android | ✅ `WebView.draw(Canvas)` onto a `Bitmap` → `Bitmap.compress(PNG)` via JNI | ✅ `PixelCopy.request(window.decorView)` (API 26+) → `View.draw(Canvas)` fallback |
|
|
81
|
+
| HarmonyOS | ✅ `WebviewController.webPageSnapshot` → `image.PixelMap` → `ImagePacker` PNG | ✅ `window.snapshot` → `ImagePacker` PNG |
|
|
82
|
+
|
|
83
|
+
All platforms time out after 5 seconds. The PNG bytes are returned to the CLI base64-encoded in the JSON envelope; `lxdev` decodes and writes the binary file.
|
|
84
|
+
|
|
85
|
+
### `lxdev app …`
|
|
86
|
+
|
|
87
|
+
Operate at the host-app scope (not lxapp-scope): window enumeration and full window screenshot.
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
lxdev app windows # list all NSWindow / Activity / UIWindow
|
|
91
|
+
lxdev app windows --json # same as JSON
|
|
92
|
+
lxdev app screenshot # capture key/focused window
|
|
93
|
+
lxdev app screenshot --scope screen # full device display (default off iOS)
|
|
94
|
+
lxdev app screenshot --scope window # app's own window only (default on iOS)
|
|
95
|
+
lxdev app screenshot --window <id> # specific window (id from `app windows`); window scope only
|
|
96
|
+
lxdev app screenshot --output ~/x.png # custom path; default .lingxia/screenshots/app-<platform>-<ts>.png
|
|
97
|
+
lxdev app screenshot --output - # PNG bytes to stdout
|
|
98
|
+
lxdev app screenshot --json # JSON envelope (window-scope only — screen scope writes a file)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
#### Scope: `screen` vs `window`
|
|
102
|
+
|
|
103
|
+
These two scopes capture **different things**; the same command produces different output across platforms because Apple's iOS doesn't expose a host-side screen-capture CLI.
|
|
104
|
+
|
|
105
|
+
- **`screen`** — full device display via host tools (`adb shell screencap` / `hdc shell snapshot_display` / `screencapture`). Includes IME, status bar, dialogs from other windows, system overlays. No in-app code, no consent prompt, no foreground service. Default on android / harmony / macos.
|
|
106
|
+
- **`window`** — only the app's own window via the in-app `PixelCopy` / `webPageSnapshot` / `UIWindow.layer.render` path. Excludes IME and system bars. Required default on **iOS** (no public CLI screen capture) and the only way to target a specific `--window` on multi-window platforms (macOS).
|
|
107
|
+
|
|
108
|
+
| Platform | Default | `--scope screen` | `--scope window` |
|
|
109
|
+
|---|---|---|---|
|
|
110
|
+
| android | screen | adb screencap (full incl. IME) | PixelCopy (app window) |
|
|
111
|
+
| harmony | screen | hdc snapshot_display (full incl. IME) | webPageSnapshot (app window) |
|
|
112
|
+
| macos | screen | screencapture (full display) | NSWindow capture |
|
|
113
|
+
| **ios** | **window** | **errors — Apple platform limit** | UIWindow.layer.render |
|
|
114
|
+
|
|
115
|
+
If you're using `lxdev` to verify a layout change against an IME / keyboard scenario, you need `--scope screen` (the default everywhere except iOS). On iOS that case can only be verified manually because there's no CLI screen-capture tool — Apple does not expose one through `xcrun devicectl` today.
|
|
116
|
+
|
|
117
|
+
**Multi-window** matters mainly on desktop. On macOS, `lx.surface({kind:'window'})` creates a separate NSWindow. Use `lxdev app windows` to enumerate; `--window <id>` selects one in `window` scope (the `id` is the platform-native window number — NSWindow.windowNumber on macOS, HWND on future Windows). Mobile platforms have a single foreground window and `--window` is ignored.
|
|
118
|
+
|
|
119
|
+
#### How `screen` finds the right device
|
|
120
|
+
|
|
121
|
+
`lingxia dev` set up an `adb forward` / `hdc fport` mapping when it created the session — the port forward is the only persistent record of which physical device this session belongs to. `lxdev` discovers the device at screenshot time by reading `adb forward --list` (or `hdc fport ls`) and matching its `ws_url` port against the host side of every forward. No device id is duplicated into session metadata, so there's nothing to keep in sync — the forward table is the source of truth.
|
|
122
|
+
|
|
123
|
+
### `lxdev lxapp …`
|
|
124
|
+
|
|
125
|
+
Manage lxapps running inside the session:
|
|
126
|
+
|
|
127
|
+
`list`, `current`, `info`, `pages`, `page`, `eval`, `open`, `close`, `restart`, `uninstall`.
|
|
128
|
+
|
|
129
|
+
`lxdev lxapp eval` runs JavaScript inside the lxapp's Logic runtime (AppService); useful for inspecting state or invoking actions without a UI round-trip.
|
|
130
|
+
|
|
131
|
+
### `lxdev logs`
|
|
132
|
+
|
|
133
|
+
Tail and filter the session log stream:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
lxdev logs # last 200 lines
|
|
137
|
+
lxdev logs -f # follow
|
|
138
|
+
lxdev logs -f --level error # filter by level
|
|
139
|
+
lxdev logs --source webview --grep CSP # filter by source + text
|
|
140
|
+
lxdev logs --path pages/home --json # JSONL output
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Levels: `verbose`, `debug`, `info`, `warn`, `error`.
|
|
144
|
+
Sources: `native`, `webview`, `logic`, `web_view_console`, `lx_app_service_console`.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Concurrency rules
|
|
149
|
+
|
|
150
|
+
The whole design is built around "a human and one or more agents may be doing dev in parallel." The rules are:
|
|
151
|
+
|
|
152
|
+
1. **`lingxia dev` refuses to start a second same-platform session** unless `--parallel` is passed. This is the primary defense — if you never trip this, you'll never have an ambiguous `lxdev` call.
|
|
153
|
+
2. **`lxdev` refuses to act when ambiguity exists.** It will not silently pick a session for you; it prints the candidates and asks for a `--session` / `--platform`.
|
|
154
|
+
3. **Stale sessions don't count.** Pruning happens in three places (`lingxia dev` startup, `lxdev sessions prune`, and `lxdev` itself when ambiguity forces it), so a hard-crashed `lingxia dev` won't keep blocking future runs.
|
|
155
|
+
4. **`--parallel` is per-launch.** It does not persist; each subsequent `lingxia dev` for that platform must opt in again.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Typical agent flow
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# Discover what's available
|
|
163
|
+
lxdev sessions
|
|
164
|
+
|
|
165
|
+
# Single session, no ambiguity → zero-arg invocation
|
|
166
|
+
lxdev browser open https://example.com
|
|
167
|
+
lxdev browser eval --js "document.title"
|
|
168
|
+
lxdev logs -f --level warn
|
|
169
|
+
|
|
170
|
+
# Visual regression / what-does-the-user-see
|
|
171
|
+
lxdev app windows # see all host windows
|
|
172
|
+
lxdev app screenshot # current focused window
|
|
173
|
+
lxdev browser screenshot # just the web content of the current tab
|
|
174
|
+
|
|
175
|
+
# Two sessions running (e.g. ios + harmony) → disambiguate by platform
|
|
176
|
+
lxdev --platform ios browser tabs
|
|
177
|
+
lxdev --platform harmony logs --grep BridgeError
|
|
178
|
+
|
|
179
|
+
# After a crash leaves residue
|
|
180
|
+
lxdev sessions prune
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Symptom router
|
|
186
|
+
|
|
187
|
+
| Symptom | Fix |
|
|
188
|
+
|---|---|
|
|
189
|
+
| `No active dev session found` | Run `lingxia dev` in this project. |
|
|
190
|
+
| `Multiple active dev sessions match` | Add `--session <prefix>` or `--platform <name>`. |
|
|
191
|
+
| `All matching dev sessions are unreachable` | Run `lxdev sessions prune`, then start a fresh `lingxia dev`. |
|
|
192
|
+
| `Existing <platform> dev session is already running` (from `lingxia dev`) | Stop the other one, or pass `--parallel` if you genuinely want two. |
|
|
193
|
+
| `lxdev` connects but commands hang | The host app likely lost its bridge — restart `lingxia dev`. |
|
|
194
|
+
|
|
195
|
+
For the underlying design rationale (why no daemon, why this specific file layout), see the project draft `docs/draft/dev-session-multi.md` in the LingXia repo.
|
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
# CLI Command Reference
|
|
2
|
+
|
|
3
|
+
Complete reference for the `lingxia` command-line interface. This skill assumes the CLI is already installed and you are working inside a LingXia project. For first-time install and onboarding, see `docs/quick-start.md`.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Global Options
|
|
8
|
+
|
|
9
|
+
| Option | Description |
|
|
10
|
+
|--------|-------------|
|
|
11
|
+
| `--version`, `-V` | Print version |
|
|
12
|
+
| `--help`, `-h` | Print help |
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Commands
|
|
17
|
+
|
|
18
|
+
### `lingxia new`
|
|
19
|
+
|
|
20
|
+
Create a new LingXia project.
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
lingxia new [name] [options]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Arguments:**
|
|
27
|
+
|
|
28
|
+
| Argument | Description | Required |
|
|
29
|
+
|----------|-------------|----------|
|
|
30
|
+
| `name` | Project name | No (prompted if omitted) |
|
|
31
|
+
|
|
32
|
+
**Options:**
|
|
33
|
+
|
|
34
|
+
| Option | Description | Default |
|
|
35
|
+
|--------|-------------|---------|
|
|
36
|
+
| `-t, --project-type <type>` | Project type: `native-app` or `lxapp` | prompted |
|
|
37
|
+
| `-p, --platform <platforms>` | Target platforms (comma-separated): android, ios, harmony, all | prompted |
|
|
38
|
+
| `--package-id <id>` | Package identifier (e.g., com.example.app) | prompted |
|
|
39
|
+
| `--icon <path>` | Path to app icon (PNG, recommended 1024x1024) | none |
|
|
40
|
+
| `-y, --yes` | Skip confirmation prompts | false |
|
|
41
|
+
|
|
42
|
+
**Examples:**
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Interactive mode
|
|
46
|
+
lingxia new
|
|
47
|
+
|
|
48
|
+
# With project name
|
|
49
|
+
lingxia new my-app
|
|
50
|
+
|
|
51
|
+
# Non-interactive with all options
|
|
52
|
+
lingxia new my-app -t native-app -p android,ios --package-id com.example.myapp -y
|
|
53
|
+
|
|
54
|
+
# Create LxApp only
|
|
55
|
+
lingxia new my-lxapp -t lxapp -y
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
### `lingxia build`
|
|
61
|
+
|
|
62
|
+
Build the project.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
lingxia build [options]
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Options:**
|
|
69
|
+
|
|
70
|
+
| Option | Description | Default |
|
|
71
|
+
|--------|-------------|---------|
|
|
72
|
+
| `--release` | Release build (optimized) | false (debug) |
|
|
73
|
+
| `--env <env>` | Build environment: `developer` (or `dev`), `preview`, `release` | `developer` |
|
|
74
|
+
| `-f, --features <features>` | Rust features to enable (comma-separated) | none |
|
|
75
|
+
| `--abis <abis>` | Android ABIs (comma-separated): `arm64-v8a`, `armeabi-v7a` | auto (`arm64-v8a`) |
|
|
76
|
+
| `--macos-arch <arch>` | macOS build architecture: `arm64`, `x86_64` | host arch |
|
|
77
|
+
| `--platform <platforms>` | Platforms to build (comma-separated) | all detected |
|
|
78
|
+
| `--skip-native` | Skip native Rust library compilation | false |
|
|
79
|
+
|
|
80
|
+
> **`--env` vs `--release`** — independent. `--env` chooses an environment slot (which determines the suffixed package id, the backend URL, and whether the launcher icon is badged); `--release` toggles the compiler's release profile. `lingxia build --env release --release` is the shippable combination. The CLI prints `ℹ Build env: <env> (default|--env)` on every build. See [App Project → Env versions](../app/project.md#environment-versions) for what each env produces.
|
|
81
|
+
|
|
82
|
+
**Examples:**
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Development build (default: --env developer)
|
|
86
|
+
lingxia build
|
|
87
|
+
|
|
88
|
+
# Optimized release build for shipping
|
|
89
|
+
lingxia build --env release --release
|
|
90
|
+
|
|
91
|
+
# Preview build (side-by-side installable next to release)
|
|
92
|
+
lingxia build --env preview
|
|
93
|
+
|
|
94
|
+
# Build for specific platform
|
|
95
|
+
lingxia build --platform android
|
|
96
|
+
|
|
97
|
+
# Skip native compilation (use existing binaries)
|
|
98
|
+
lingxia build --skip-native
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
When a host project has `lingxia.yaml`, `lingxia build` also prepares configured host assets. LxApp builds generate the Native client automatically when `lxapp.config.ts` contains `native`.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
### `lingxia clean`
|
|
106
|
+
|
|
107
|
+
Remove generated artifacts for the current project context.
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
lingxia clean
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Context rules:
|
|
114
|
+
|
|
115
|
+
- In a host app project with `lingxia.yaml`, cleans host outputs, generated host assets, platform build directories, configured bundle `dist/` directories, and native `target/`.
|
|
116
|
+
- In an lxapp or lxplugin project, cleans local `dist/` or `dist-plugin/`, `node_modules/`, and LingXia view build cache.
|
|
117
|
+
- In a standalone Apple Swift Package, such as runner development packages without `lingxia.yaml`, cleans `.build/` and `.lingxia/`.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
### `lingxia package`
|
|
122
|
+
|
|
123
|
+
Package release artifacts for publishing or delivery.
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
lingxia package [options]
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`lingxia package` always performs a release package build.
|
|
130
|
+
|
|
131
|
+
For native host projects, publishable Android artifacts are staged under
|
|
132
|
+
`dist/android/`; macOS update zips are written under `dist/macos/`.
|
|
133
|
+
|
|
134
|
+
**Options:**
|
|
135
|
+
|
|
136
|
+
| Option | Description | Default |
|
|
137
|
+
|--------|-------------|---------|
|
|
138
|
+
| `--env <env>` | Build environment: `developer` (or `dev`), `preview`, `release` | `release` |
|
|
139
|
+
| `-f, --features <features>` | Rust features to enable (comma-separated) | none |
|
|
140
|
+
| `--abis <abis>` | Android ABIs (comma-separated): `arm64-v8a`, `armeabi-v7a` | auto (`arm64-v8a`) |
|
|
141
|
+
| `--macos-arch <arch>` | macOS package architecture: `arm64`, `x86_64` | host arch |
|
|
142
|
+
| `--platform <platforms>` | Platforms to package (comma-separated) | all detected |
|
|
143
|
+
| `--skip-native` | Skip native Rust library compilation | false |
|
|
144
|
+
| `--framework <framework>` | Override lxapp view framework detection: `react`, `vue`, `html` | auto-detect |
|
|
145
|
+
| `--progress <mode>` | LxApp progress output mode: `task`, `plain` | default CLI output |
|
|
146
|
+
|
|
147
|
+
**Examples:**
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Package the current project for publishing
|
|
151
|
+
lingxia package
|
|
152
|
+
|
|
153
|
+
# Package only macOS output
|
|
154
|
+
lingxia package --platform macos
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
### `lingxia dev`
|
|
160
|
+
|
|
161
|
+
Development mode for both app and lxapp projects.
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
lingxia dev [options]
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Behavior depends on the current project:
|
|
168
|
+
|
|
169
|
+
- In an app project, `lingxia dev` builds, installs, launches the host app, and starts a local dev websocket for `lxdev`.
|
|
170
|
+
- Android and Harmony dev sessions set reverse port forwarding so the device app can reach the local dev server.
|
|
171
|
+
- iOS dev sessions embed a LAN dev websocket URL into the dev build; the iOS device must be able to reach the host Mac on the local network.
|
|
172
|
+
- In a standalone lxapp project, `lingxia dev` builds the lxapp and launches LingXia Runner on macOS.
|
|
173
|
+
|
|
174
|
+
**Options:**
|
|
175
|
+
|
|
176
|
+
| Option | Description | Default |
|
|
177
|
+
|--------|-------------|---------|
|
|
178
|
+
| `-p, --platform <platform>` | Target platform: `android`, `ios`, `macos`, `harmony` | auto-detect for app projects |
|
|
179
|
+
| `-d, --device <id>` | Target device ID (required if multiple connected) | auto-detect |
|
|
180
|
+
| `--release` | Release build (optimized) | false (debug) |
|
|
181
|
+
| `--env <env>` | Build environment: `developer` (or `dev`), `preview`, `release` | `developer` |
|
|
182
|
+
| `-f, --features <features>` | Rust features to enable (comma-separated) | none |
|
|
183
|
+
| `--skip-native` | Skip native Rust library compilation | false |
|
|
184
|
+
| `--abis <abis>` | Android ABIs (comma-separated): `arm64-v8a`, `armeabi-v7a` | auto (`arm64-v8a`) |
|
|
185
|
+
| `--macos-arch <arch>` | macOS build architecture: `arm64`, `x86_64` (must match host for local app dev) | host arch |
|
|
186
|
+
| `--framework <framework>` | Override lxapp view framework detection: `react`, `vue`, `html` | auto-detect |
|
|
187
|
+
| `--progress <mode>` | LxApp progress output mode: `task`, `plain` | default CLI output |
|
|
188
|
+
| `--reinstall` | Reinstall app by uninstalling existing one first (best effort) | false |
|
|
189
|
+
|
|
190
|
+
**Examples:**
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
# App project: build, install, and launch
|
|
194
|
+
lingxia dev
|
|
195
|
+
|
|
196
|
+
# App project: target a specific device
|
|
197
|
+
lingxia dev -d deviceid
|
|
198
|
+
|
|
199
|
+
# Standalone lxapp project: build and launch Runner
|
|
200
|
+
lingxia dev
|
|
201
|
+
|
|
202
|
+
# Use release build
|
|
203
|
+
lingxia dev --release
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
> **Note:** For standalone lxapp projects, `--device`, `--abis`, and non-macOS `--platform` are not supported. Runner currently launches locally on macOS.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
### `lingxia install`
|
|
211
|
+
|
|
212
|
+
Install the built app to a device.
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
lingxia install [options]
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**Options:**
|
|
219
|
+
|
|
220
|
+
| Option | Description | Default |
|
|
221
|
+
|--------|-------------|---------|
|
|
222
|
+
| `-a, --artifact <path>` | Path to artifact file (APK/HAP) | auto-detected |
|
|
223
|
+
| `-d, --device <id>` | Target device ID | auto-detect |
|
|
224
|
+
| `--reinstall` | Reinstall app by uninstalling existing one first (best effort) | false |
|
|
225
|
+
|
|
226
|
+
**Examples:**
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
# Install to default device
|
|
230
|
+
lingxia install
|
|
231
|
+
|
|
232
|
+
# Install specific artifact
|
|
233
|
+
lingxia install -a ./build/app-debug.apk
|
|
234
|
+
|
|
235
|
+
# Install to specific device
|
|
236
|
+
lingxia install -d emulator-5554
|
|
237
|
+
|
|
238
|
+
# Reinstall cleanly before install
|
|
239
|
+
lingxia install --reinstall
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
### `lingxia launch`
|
|
245
|
+
|
|
246
|
+
Launch the installed app on a device.
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
lingxia launch [bundle_id] [options]
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**Options:**
|
|
253
|
+
|
|
254
|
+
| Option | Description | Default |
|
|
255
|
+
|--------|-------------|---------|
|
|
256
|
+
| `-d, --device <id>` | Target device ID | auto-detect |
|
|
257
|
+
| `-p, --platform <platform>` | Target platform | auto-detect |
|
|
258
|
+
| `--restart` | Restart app by terminating an existing instance before launch (best effort) | false |
|
|
259
|
+
|
|
260
|
+
**Examples:**
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
# Launch inferred app on default device
|
|
264
|
+
lingxia launch
|
|
265
|
+
|
|
266
|
+
# Launch specific app on a specific device
|
|
267
|
+
lingxia launch com.example.app -d emulator-5554 -p android
|
|
268
|
+
|
|
269
|
+
# Restart the app before launching
|
|
270
|
+
lingxia launch --restart
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
> **Note:** `--restart` is currently supported for Android and iOS. HarmonyOS currently supports plain `launch` only.
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
### `lingxia icon`
|
|
278
|
+
|
|
279
|
+
Generate or update app icons from a source image.
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
lingxia icon <icon_path> [options]
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
**Arguments:**
|
|
286
|
+
|
|
287
|
+
| Argument | Description | Required |
|
|
288
|
+
|----------|-------------|----------|
|
|
289
|
+
| `icon_path` | Path to source icon (PNG, recommended 1024x1024) | Yes |
|
|
290
|
+
|
|
291
|
+
**Options:**
|
|
292
|
+
|
|
293
|
+
| Option | Description | Default |
|
|
294
|
+
|--------|-------------|---------|
|
|
295
|
+
| `-p, --platform <platform>` | Target platform | all from config |
|
|
296
|
+
| `-b, --background-color <color>` | Background color for adaptive icons (hex) | #FFFFFF |
|
|
297
|
+
|
|
298
|
+
**Examples:**
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
# Generate icons for all platforms
|
|
302
|
+
lingxia icon logo.png
|
|
303
|
+
|
|
304
|
+
# With custom background color
|
|
305
|
+
lingxia icon logo.png -b "#1E88E5"
|
|
306
|
+
|
|
307
|
+
# For specific platform only
|
|
308
|
+
lingxia icon logo.png -p android
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
### `lingxia publish`
|
|
314
|
+
|
|
315
|
+
Publish a package to the API server.
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
lingxia publish --token <token> [options]
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
**Options:**
|
|
322
|
+
|
|
323
|
+
| Option | Description | Default |
|
|
324
|
+
|--------|-------------|---------|
|
|
325
|
+
| `--token <token>` | Bearer token (`LINGXIA_AUTH_TOKEN` env var also accepted) | required |
|
|
326
|
+
| `--lingxia-server <url>` | LingXia server URL (falls back to `app.lingxiaServer` when available) | from config |
|
|
327
|
+
| `--package-path <path>` | Path to the package file (`app` only) | auto |
|
|
328
|
+
| `--platform <platform>` | App platform to publish: `android`, `macos` | required for multi-platform app projects |
|
|
329
|
+
| `--release-type <type>` | Release channel: `release`, `preview`, `developer` (required for lxapp) | none |
|
|
330
|
+
| `--framework <framework>` | Override lxapp view framework detection: `react`, `vue`, `html` | auto-detect |
|
|
331
|
+
| `--progress <mode>` | LxApp progress output mode: `task`, `plain` | default CLI output |
|
|
332
|
+
|
|
333
|
+
**Auto-detection:**
|
|
334
|
+
|
|
335
|
+
| Project file | Target | ID source | Version source |
|
|
336
|
+
|---|---|---|---|
|
|
337
|
+
| `lxapp.json` | `lxapp` | `appId` | `version` |
|
|
338
|
+
| `lxplugin.json` | `lxplugin` | `lxPluginId` | `version` |
|
|
339
|
+
| `lingxia.yaml` | `app` | `app.lingxiaId` | `app.productVersion` |
|
|
340
|
+
|
|
341
|
+
**Examples:**
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
# Set token once via env var
|
|
345
|
+
export LINGXIA_AUTH_TOKEN=lx_dev_your_token
|
|
346
|
+
|
|
347
|
+
# Publish lxapp (auto-detected from lxapp.json; packages current project automatically)
|
|
348
|
+
lingxia publish --release-type developer
|
|
349
|
+
|
|
350
|
+
# Publish preview build
|
|
351
|
+
lingxia publish --release-type preview
|
|
352
|
+
|
|
353
|
+
# Publish lxplugin (auto-detected from lxplugin.json)
|
|
354
|
+
lingxia publish --lingxia-server http://localhost:8080
|
|
355
|
+
|
|
356
|
+
# Publish Android host app package
|
|
357
|
+
lingxia publish --platform android --token <token>
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
> **Note:** `lxapp` and `lxplugin` publish always package the current project first. Only `app` publish supports `--package-path`.
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
### `lingxia doctor`
|
|
365
|
+
|
|
366
|
+
Check development environment setup.
|
|
367
|
+
|
|
368
|
+
```bash
|
|
369
|
+
lingxia doctor
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
**No options.**
|
|
373
|
+
|
|
374
|
+
Prints pass/warn/fail checks for common + target platforms.
|
|
375
|
+
|
|
376
|
+
Use `--platform` to scope checks:
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
lingxia doctor --platform android
|
|
380
|
+
lingxia doctor --platform harmony
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
### `lingxia ds`
|
|
386
|
+
|
|
387
|
+
Interact with developer services (Apple, Harmony, etc.).
|
|
388
|
+
|
|
389
|
+
```bash
|
|
390
|
+
lingxia ds <platform> <command>
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
**Platforms:**
|
|
394
|
+
|
|
395
|
+
| Platform | Description |
|
|
396
|
+
|----------|-------------|
|
|
397
|
+
| `apple` | Apple Developer Services |
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
### `lingxia ds apple`
|
|
402
|
+
|
|
403
|
+
Interact with Apple Developer Services.
|
|
404
|
+
|
|
405
|
+
```bash
|
|
406
|
+
lingxia ds apple <command>
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
**Commands:**
|
|
410
|
+
|
|
411
|
+
| Command | Description |
|
|
412
|
+
|---------|-------------|
|
|
413
|
+
| `teams` | List development teams |
|
|
414
|
+
| `certificates` | List certificates |
|
|
415
|
+
| `identifiers` | List bundle identifiers (App IDs) |
|
|
416
|
+
| `devices` | List registered devices |
|
|
417
|
+
| `profiles` | List provisioning profiles |
|
|
418
|
+
|
|
419
|
+
**Examples:**
|
|
420
|
+
|
|
421
|
+
```bash
|
|
422
|
+
# List development teams
|
|
423
|
+
lingxia ds apple teams
|
|
424
|
+
|
|
425
|
+
# List certificates
|
|
426
|
+
lingxia ds apple certificates
|
|
427
|
+
|
|
428
|
+
# List bundle identifiers
|
|
429
|
+
lingxia ds apple identifiers
|
|
430
|
+
|
|
431
|
+
# List registered devices
|
|
432
|
+
lingxia ds apple devices
|
|
433
|
+
|
|
434
|
+
# List provisioning profiles
|
|
435
|
+
lingxia ds apple profiles
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
> **Note:** Requires authentication via `lingxia auth login` with password mode.
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
## Environment Variables
|
|
443
|
+
|
|
444
|
+
Required during build/dev for the listed platforms. One-time SDK installation is covered in `docs/quick-start.md`; the variables below must be present in your shell every time you build.
|
|
445
|
+
|
|
446
|
+
| Variable | Used by | Description |
|
|
447
|
+
|----------|---------|-------------|
|
|
448
|
+
| `ANDROID_SDK_ROOT` | android | Android SDK root path |
|
|
449
|
+
| `ANDROID_NDK_ROOT` | android | Android NDK path (e.g. `$ANDROID_SDK_ROOT/ndk/28.2.13676358`) |
|
|
450
|
+
| `OHOS_NDK_HOME` | harmony | Harmony command-line tools SDK path |
|
|
451
|
+
| `JAVA_HOME` | android | Java JDK path |
|
|
452
|
+
|
|
453
|
+
If a platform build complains about missing tools, run `lingxia doctor --platform <p>` to see exactly what's missing.
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
## Configuration Files
|
|
458
|
+
|
|
459
|
+
This reference focuses on commands and flags. File schemas live in the dedicated guides:
|
|
460
|
+
|
|
461
|
+
| File | Purpose | Canonical guide |
|
|
462
|
+
|---|---|---|
|
|
463
|
+
| `lingxia.yaml` | Host app metadata, platform config, runtime-facing build inputs | [App Project](../app/project.md) |
|
|
464
|
+
| `lxapp.json` | LxApp runtime metadata such as `appId`, `version`, and `pages` | [LxApp Development Guide](../lxapp/guide.md) |
|
|
465
|
+
| `lxapp.config.ts` | LxApp build config such as aliases, view tooling, and `staticDirs` | [LxApp Development Guide](../lxapp/guide.md) |
|
|
466
|
+
|
|
467
|
+
Quick reminders:
|
|
468
|
+
|
|
469
|
+
- `lingxia.yaml` is the source of truth for host app build metadata.
|
|
470
|
+
- `homeAppVersion` is generated into runtime `app.json`; you do not set it manually.
|
|
471
|
+
- Storage/cache limits live under `storage`; set `storage.cacheMaxSizeMB` to `0` to disable usercache size enforcement.
|
|
472
|
+
- When `splash` is configured, CLI requires a PNG source image and writes `splashTimeout` into runtime `app.json`.
|
|
473
|
+
|
|
474
|
+
---
|
|
475
|
+
|
|
476
|
+
## Exit Codes
|
|
477
|
+
|
|
478
|
+
| Code | Meaning |
|
|
479
|
+
|------|---------|
|
|
480
|
+
| 0 | Success |
|
|
481
|
+
| 1 | Error |
|