@kvell007/embed-labs-cli 0.1.0-alpha.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 +277 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5388 -0
- package/dist/index.js.map +1 -0
- package/package.json +27 -0
package/README.md
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# @embed-labs/cli
|
|
2
|
+
|
|
3
|
+
Command-line interface for Embed Labs Cloud.
|
|
4
|
+
|
|
5
|
+
## Package Status
|
|
6
|
+
|
|
7
|
+
This package is a publish candidate, but it is not ready for public npm publish
|
|
8
|
+
yet. The workspace manifest intentionally remains marked `private: true` until
|
|
9
|
+
package names, license, npm scope ownership, support URLs, and release approval
|
|
10
|
+
are complete.
|
|
11
|
+
|
|
12
|
+
## What It Provides
|
|
13
|
+
|
|
14
|
+
- `embed` binary exposed by the npm `bin` entry after install.
|
|
15
|
+
- First-run diagnostic command for CLI runtime, auth, Local Bridge, local scans,
|
|
16
|
+
and Cloud API readiness.
|
|
17
|
+
- Local bridge startup and status commands.
|
|
18
|
+
- Auth token login, logout, and status commands.
|
|
19
|
+
- Account registration, API key issue/list, token usage metering, and billing
|
|
20
|
+
statement preview commands.
|
|
21
|
+
- Server-side application source generation through Cloud API agents, followed by
|
|
22
|
+
task artifacts and downloads.
|
|
23
|
+
- Debug tool, device, serial, SSH, and flash commands routed through the local
|
|
24
|
+
bridge.
|
|
25
|
+
- Project, task, artifact, and cloud status commands routed through the cloud
|
|
26
|
+
API.
|
|
27
|
+
- Approval request, list, show, approve, and reject commands routed through the
|
|
28
|
+
cloud API.
|
|
29
|
+
- Human-readable output by default and `--json` output for automation.
|
|
30
|
+
|
|
31
|
+
The installed binary is the primary interface. Package and library APIs are
|
|
32
|
+
secondary implementation details for now; do not treat `@embed-labs/cli` as a
|
|
33
|
+
public SDK until a versioned API contract is approved.
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
After the package is approved for public release:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install -g @embed-labs/cli
|
|
41
|
+
embed --help
|
|
42
|
+
embed help getting-started
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Local package testing before public npm publish:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm run build
|
|
49
|
+
npm pack --workspace @embed-labs/cli --pack-destination ./tmp
|
|
50
|
+
npm install -g ./tmp/embed-labs-cli-*.tgz
|
|
51
|
+
embed --help
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Internal workspace usage without global install:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm run build
|
|
58
|
+
node packages/cli/dist/index.js --help
|
|
59
|
+
node packages/cli/dist/index.js help getting-started
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Quick Start
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
embed --help
|
|
66
|
+
embed help getting-started
|
|
67
|
+
embed doctor
|
|
68
|
+
embed auth login --token <token>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
For the current public API plus local TaishanPi verification path, see
|
|
72
|
+
`docs/runbooks/PUBLIC_CLI_USER_VERIFICATION.md`.
|
|
73
|
+
|
|
74
|
+
For the cloud build path:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
embed build template list
|
|
78
|
+
embed build template show <template_id>
|
|
79
|
+
embed build workspace provision --account <account_id> --project <project_id> --template <template_id>
|
|
80
|
+
embed build workspace source put <workspace_id> --file ./main.c:src/main.c
|
|
81
|
+
embed build application generate --workspace <workspace_id> --prompt "Create a minimal Linux app"
|
|
82
|
+
embed cloud task artifacts <task_id>
|
|
83
|
+
embed artifact download <artifact_id> --output ./artifact.bin
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
For local hardware access:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
embed bridge start
|
|
90
|
+
embed device list
|
|
91
|
+
embed flash plan --board <rp2350|taishanpi> --artifact ./artifact.bin
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
For cloud API workflows, point the CLI at a running cloud API service:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
EMBED_CLOUD_API_URL=http://127.0.0.1:18100 embed cloud status
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Interaction Modes
|
|
101
|
+
|
|
102
|
+
- Human terminal: run `embed` directly and read the default output.
|
|
103
|
+
- Local scripts and CI: run `embed ... --json` and parse the response envelope.
|
|
104
|
+
- Localhost tools: start `embed bridge start` and call the Local Bridge HTTP API
|
|
105
|
+
only from trusted same-host tools.
|
|
106
|
+
- Remote AI: use Cloud API tasks, events, artifacts, and evidence instead of
|
|
107
|
+
direct local bridge or unrestricted hardware access.
|
|
108
|
+
- Future IDE and Warp flows: wrap the same CLI, Local Bridge, and Cloud API
|
|
109
|
+
boundaries rather than depending on internal package APIs.
|
|
110
|
+
|
|
111
|
+
Remote AI should not receive raw Local Bridge URLs, serial/USB/SSH/debug
|
|
112
|
+
handles, flash endpoints, or localhost tunnels. Hardware-changing operations
|
|
113
|
+
remain local and approval-gated.
|
|
114
|
+
|
|
115
|
+
## Common Commands
|
|
116
|
+
|
|
117
|
+
`embed --help` is intentionally a short first-run guide. Use
|
|
118
|
+
`embed help getting-started` for the guided workflow or `embed help commands`
|
|
119
|
+
for the full command reference.
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
embed doctor [--json]
|
|
123
|
+
|
|
124
|
+
embed auth login --token <token> [--profile default]
|
|
125
|
+
embed auth status
|
|
126
|
+
embed auth logout
|
|
127
|
+
|
|
128
|
+
embed account create --email <email> [--display-name <name>] [--json]
|
|
129
|
+
embed account show <account_id> [--json]
|
|
130
|
+
embed account keys create --account <account_id> [--name <name>] [--json]
|
|
131
|
+
embed account keys list --account <account_id> [--json]
|
|
132
|
+
embed account keys revoke <api_key_id> [--json]
|
|
133
|
+
|
|
134
|
+
embed usage record --api-key <key>|--api-key-id <api_key_id> --model <model> --input-tokens <n> --output-tokens <n> [--provider <name>] [--operation <name>] [--task <task_id>] [--request-id <id>] [--json]
|
|
135
|
+
embed usage summary --account <account_id>|--api-key-id <api_key_id> [--from <iso>] [--to <iso>] [--json]
|
|
136
|
+
embed usage events --account <account_id> [--api-key-id <api_key_id>] [--from <iso>] [--to <iso>] [--limit 100] [--json]
|
|
137
|
+
embed billing statement --account <account_id> [--from <iso>] [--to <iso>] [--json]
|
|
138
|
+
embed billing balance --account <account_id> [--json]
|
|
139
|
+
embed billing recharge create --account <account_id> --amount-usd <amount> [--provider mock|stripe|onchain] [--chain <chain>] [--token <symbol>] [--qr] [--json]
|
|
140
|
+
embed billing recharge submit-tx <recharge_session_id> --tx-hash <hash> [--json]
|
|
141
|
+
embed billing recharge list --account <account_id> [--json]
|
|
142
|
+
embed billing recharge show <recharge_session_id> [--json]
|
|
143
|
+
embed billing snapshot create --account <account_id> [--from <iso>] [--to <iso>] [--json]
|
|
144
|
+
embed billing snapshot list --account <account_id> [--json]
|
|
145
|
+
embed billing snapshot show <billing_snapshot_id> [--json]
|
|
146
|
+
|
|
147
|
+
embed build template list [--json]
|
|
148
|
+
embed build template show <template_id> [--json]
|
|
149
|
+
embed build workspace provision --account <account_id> --project <project_id> [--template <template_id>] [--copy-mode auto|copy|symlink|skeleton] [--require-seed] [--dry-run] [--json]
|
|
150
|
+
embed build workspace list --account <account_id> [--json]
|
|
151
|
+
embed build workspace show <workspace_id> [--json]
|
|
152
|
+
embed build workspace source put <workspace_id> [--account <account_id>] --file <local_path>:<source_path> [--file <local_path>:<source_path>] [--json]
|
|
153
|
+
embed build application stub --workspace <workspace_id> [--account <account_id>] [--json]
|
|
154
|
+
embed build application generate --workspace <workspace_id> --prompt <request> [--account <account_id>] [--target <source_path>] [--provider stub|openai|cc|claude-code] [--model <model>] [--json]
|
|
155
|
+
|
|
156
|
+
embed bridge start [--host 127.0.0.1] [--port 18083]
|
|
157
|
+
embed bridge status [--json]
|
|
158
|
+
|
|
159
|
+
embed debug tools [--json]
|
|
160
|
+
|
|
161
|
+
embed device list [--json]
|
|
162
|
+
embed device probe --host <host> --ports 22,15301 [--serial-path <path>] [--timeout-ms 1000] [--json]
|
|
163
|
+
|
|
164
|
+
embed serial list [--json]
|
|
165
|
+
embed serial capture --path <port> [--baud 115200] [--duration 5] [--json]
|
|
166
|
+
embed ssh run --host <host> [--user root] -- <command> [--json]
|
|
167
|
+
|
|
168
|
+
embed flash plan --board <rp2350|taishanpi> [--artifact file.uf2] [--image-dir dir] [--json]
|
|
169
|
+
embed flash run --board <rp2350|taishanpi> --approve [--artifact file.uf2] [--image-dir dir] [--json]
|
|
170
|
+
embed task list [--json]
|
|
171
|
+
embed task status <local_job_id> [--json]
|
|
172
|
+
|
|
173
|
+
embed project create <name> [--board <board_id>] [--workspace <path>] [--json]
|
|
174
|
+
embed project list [--json]
|
|
175
|
+
embed project status <project_id> [--json]
|
|
176
|
+
|
|
177
|
+
embed ask --prompt <request> [--project <project_id>] [--board <board_id>] [--json]
|
|
178
|
+
embed cloud status [--json]
|
|
179
|
+
embed cloud task create [--kind build.firmware] [--progress-text "Task created."] [--json]
|
|
180
|
+
embed cloud task list [--json]
|
|
181
|
+
embed cloud task status <task_id> [--json]
|
|
182
|
+
embed cloud task events <task_id> [--json]
|
|
183
|
+
embed cloud task artifacts <task_id> [--json]
|
|
184
|
+
embed cloud task evidence <task_id> [--json]
|
|
185
|
+
embed cloud task event append <task_id> [--state <state>] [--progress-stage <stage>|--stage <stage>] [--progress-text <text>|--message <text>] [--progress-percent 0-100] [--severity info|warning|error] [--type <event_type>] [--artifact-json '<json>'] [--evidence-json '<json>'] [--json]
|
|
186
|
+
embed artifact status <artifact_id> [--json]
|
|
187
|
+
|
|
188
|
+
embed approval request --task <task_id> --action <action> --risk <low|medium|high|destructive> --plan-summary <summary> [--affected-device <id>] [--affected-artifact <id>] [--expires-at <iso>] [--json]
|
|
189
|
+
embed approval list --task <task_id> [--json]
|
|
190
|
+
embed approval show <approval_id> [--json]
|
|
191
|
+
embed approval approve <approval_id> [--decided-by <name>] [--json]
|
|
192
|
+
embed approval reject <approval_id> [--decided-by <name>] [--json]
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
`embed approval request` creates a task-scoped approval record with the Cloud
|
|
196
|
+
API. Repeat `--affected-artifact` to attach multiple artifact IDs. Approval
|
|
197
|
+
commands record request and decision state in the Cloud API only. They do not
|
|
198
|
+
execute Local Bridge actions; any future local runner must re-check the approval
|
|
199
|
+
record before running one bounded localhost action.
|
|
200
|
+
|
|
201
|
+
`embed account keys create` returns the raw API key only in the creation
|
|
202
|
+
response. Store it in a secret manager or environment variable; future list and
|
|
203
|
+
summary commands show metadata, key prefix, and usage totals but never the raw
|
|
204
|
+
key. `embed usage record` is the current metering ingestion path used by smoke
|
|
205
|
+
tests and future billing reports. Reusing the same `request_id` for the same
|
|
206
|
+
API key returns the original usage record so callers can safely retry without
|
|
207
|
+
double counting. `embed account keys revoke` marks a key unusable for future
|
|
208
|
+
usage ingestion while preserving historical usage and billing evidence.
|
|
209
|
+
`embed usage events` lists the account's raw usage records for audit and
|
|
210
|
+
settlement investigation without exposing raw API key material. Event reads are
|
|
211
|
+
bounded; the server default is 100 and the current maximum is 500.
|
|
212
|
+
|
|
213
|
+
`embed billing statement` reads the account's recorded token usage and applies
|
|
214
|
+
the Cloud API's configured input/output micro USD per-token rates. It is a
|
|
215
|
+
preview for product and settlement validation, not an invoice or payment action.
|
|
216
|
+
`embed billing recharge create --provider onchain --qr` creates a wallet payment
|
|
217
|
+
session and renders the payment URI as a terminal QR. After paying from a wallet,
|
|
218
|
+
`embed billing recharge submit-tx <recharge_session_id> --tx-hash <hash>` sends
|
|
219
|
+
the payment evidence to the server for confirmation and crediting.
|
|
220
|
+
`embed billing snapshot create` freezes one statement preview result so later
|
|
221
|
+
queries can compare against a stable settlement input. Snapshots are still MVP
|
|
222
|
+
preview records; they are not invoices and do not collect payment.
|
|
223
|
+
|
|
224
|
+
## Environment
|
|
225
|
+
|
|
226
|
+
- `EMBED_BRIDGE_URL`: local bridge URL used by bridge-backed commands. Default:
|
|
227
|
+
`http://127.0.0.1:18083`.
|
|
228
|
+
- `EMBED_CLOUD_API_URL`: cloud API URL used by cloud-backed commands. Default:
|
|
229
|
+
`http://127.0.0.1:18100`.
|
|
230
|
+
- `EMBED_API_TOKEN`: auth token source for non-interactive sessions.
|
|
231
|
+
- `EMBED_AUTH_PROFILE`: profile name used with `EMBED_API_TOKEN`.
|
|
232
|
+
- `EMBED_AUTH_FILE`: token file path for `embed auth login`. Default:
|
|
233
|
+
`.embed-labs/auth.json`.
|
|
234
|
+
- `EMBED_BILLING_INPUT_MICROUSD_PER_TOKEN` and
|
|
235
|
+
`EMBED_BILLING_OUTPUT_MICROUSD_PER_TOKEN`: Cloud API server-side statement
|
|
236
|
+
preview rates. These are read by the Cloud API process, not by the CLI.
|
|
237
|
+
|
|
238
|
+
`embed doctor --json` is safe to run before services are started. Missing Local
|
|
239
|
+
Bridge or Cloud API services are reported inside the structured doctor result as
|
|
240
|
+
`unreachable` or `not_ready`; the command does not start services or mutate
|
|
241
|
+
hardware or Cloud API state.
|
|
242
|
+
|
|
243
|
+
## Hardware Support Boundary
|
|
244
|
+
|
|
245
|
+
The CLI delegates hardware actions to `@embed-labs/local-bridge`; it does not
|
|
246
|
+
perform direct hardware access itself.
|
|
247
|
+
|
|
248
|
+
Current local workflows are intentionally guarded:
|
|
249
|
+
|
|
250
|
+
- Device commands can report local detection and probe evidence.
|
|
251
|
+
- `embed debug tools` reports local debug tool availability and version/help
|
|
252
|
+
evidence without opening probes or starting debug sessions.
|
|
253
|
+
- RP2350 UF2 flashing requires a mounted UF2 volume, a `.uf2` artifact, a ready
|
|
254
|
+
flash plan, and explicit `--approve`.
|
|
255
|
+
- TaishanPi flash planning can validate expected image files and local tool
|
|
256
|
+
availability, but real destructive TaishanPi flashing is guarded and not
|
|
257
|
+
enabled. `embed flash run --board taishanpi --approve` remains blocked until
|
|
258
|
+
the exact hardware profile and Board Pack command templates are accepted.
|
|
259
|
+
|
|
260
|
+
These commands should be treated as current local evidence and planning tools,
|
|
261
|
+
not broad hardware support claims.
|
|
262
|
+
|
|
263
|
+
## Runtime Requirements
|
|
264
|
+
|
|
265
|
+
- Node.js 20 or newer.
|
|
266
|
+
- A running local bridge for debug tool, device, serial, SSH, flash, and local task
|
|
267
|
+
commands. Start it with `embed bridge start`.
|
|
268
|
+
- A running Embed Labs Cloud API for account, usage, billing statement, project,
|
|
269
|
+
cloud task, artifact, approval, and ask commands.
|
|
270
|
+
|
|
271
|
+
## Publish Readiness
|
|
272
|
+
|
|
273
|
+
Before public publish, confirm the runbook checklist in
|
|
274
|
+
`docs/runbooks/CLI_NPM_PACKAGING.md`, including approved SPDX license metadata,
|
|
275
|
+
repository, issue tracker, homepage, support metadata, changelog or release
|
|
276
|
+
notes, final npm scope ownership, executable verification for `embed`, and
|
|
277
|
+
removal of `private: true` only in an approved metadata task.
|
package/dist/index.d.ts
ADDED