@seeed-studio/sensecraft-cli 0.3.2 → 0.4.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/INSTALL.md +151 -190
- package/README-zh.md +463 -0
- package/README.md +9 -13
- package/package.json +2 -1
- package/scripts/test-install.js +1 -1
- package/skills/README.md +14 -35
- package/skills/sensecraft-cli/SKILL.md +134 -0
- package/skills/{sensecraft-apps → sensecraft-cli}/create-app/SKILL.md +16 -16
- package/skills/{sensecraft-apps → sensecraft-cli}/create-app/assets/manifest-template.json +1 -1
- package/skills/{sensecraft-apps/create-app/reference-manifest.md → sensecraft-cli/create-app/references/manifest.md} +17 -14
- package/skills/{sensecraft-apps/commands.md → sensecraft-cli/references/app-commands.md} +8 -10
- package/skills/{sensecraft-apps/reference-app-fields.md → sensecraft-cli/references/app-fields.md} +2 -2
- package/skills/{sensecraft-apps/SKILL.md → sensecraft-cli/references/apps.md} +26 -38
- package/skills/{sensecraft-devices-cloud/commands.md → sensecraft-cli/references/cloud-commands.md} +1 -1
- package/skills/{sensecraft-devices-cloud/SKILL.md → sensecraft-cli/references/cloud.md} +4 -14
- package/skills/{confirmation.md → sensecraft-cli/references/confirmation.md} +2 -2
- package/skills/{sensecraft-data/commands.md → sensecraft-cli/references/data-commands.md} +33 -12
- package/skills/{sensecraft-data/SKILL.md → sensecraft-cli/references/data.md} +10 -20
- package/skills/{sensecraft-files/commands.md → sensecraft-cli/references/file-commands.md} +1 -1
- package/skills/{sensecraft-files/SKILL.md → sensecraft-cli/references/files.md} +3 -11
- package/skills/{sensecraft-models/commands.md → sensecraft-cli/references/model-commands.md} +5 -6
- package/skills/{sensecraft-models/SKILL.md → sensecraft-cli/references/models.md} +17 -27
- package/skills/{sensecraft-recamera/commands.md → sensecraft-cli/references/recamera-commands.md} +3 -3
- package/skills/{sensecraft-recamera/SKILL.md → sensecraft-cli/references/recamera.md} +6 -16
- package/skills/{sensecraft-apps/reference-tool-blocks.md → sensecraft-cli/references/tool-blocks.md} +19 -3
- package/skills/sensecraft-ai/SKILL.md +0 -134
- /package/skills/{sensecraft-apps → sensecraft-cli}/create-app/assets/validate_manifest.py +0 -0
- /package/skills/{sensecraft-models/reference-model-fields.md → sensecraft-cli/references/model-fields.md} +0 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sensecraft-cli
|
|
3
|
+
description: >-
|
|
4
|
+
Operates the SenseCraft CLI across SenseCraft Data (devices, groups, telemetry),
|
|
5
|
+
SenseCraft AI (model library, reCamera), and CodeCraft Hub (applications).
|
|
6
|
+
Use when the user mentions SenseCraft, SenseCraft Data, SenseCraft AI, CodeCraft Hub,
|
|
7
|
+
应用, 模型库, 上传模型, reCamera, 设备, or sensecraft-cli.
|
|
8
|
+
Open only the reference file for the product being used.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# SenseCraft CLI
|
|
12
|
+
|
|
13
|
+
`sensecraft-cli` is the terminal for the SenseCraft cloud platform. This file is the only entry. Product procedures live in `references/`. A finished local project becomes an app through the nested `create-app` skill.
|
|
14
|
+
|
|
15
|
+
| Product | What it covers | Commands |
|
|
16
|
+
|---------|----------------|----------|
|
|
17
|
+
| SenseCraft Data | devices, groups, telemetry | `device` · `group` · `data` |
|
|
18
|
+
| SenseCraft AI | model library, reCamera | `model` · `recamera` · `cloud` |
|
|
19
|
+
| [CodeCraft Hub](https://codecraft.seeed.cc/hub) | applications | `app` |
|
|
20
|
+
|
|
21
|
+
All three platforms are accessed with an open Access Key. Create or manage a key at https://account.seeed.cc/account/access-keys.
|
|
22
|
+
|
|
23
|
+
SenseCraft Data: [`references/data.md`](references/data.md).
|
|
24
|
+
|
|
25
|
+
## Agent rules
|
|
26
|
+
|
|
27
|
+
1. **Use the Access Key before any cloud call**
|
|
28
|
+
- Every cloud command uses the Access Key. SenseCraft Data calls its OpenAPI. `app` / `model` / `file` / `cloud` / `recamera` call `{ai-host}/openapi` with HTTP Basic (no access_token, no `/aiserverapi`)
|
|
29
|
+
- Never send the Access Key as a fake Bearer/JWT
|
|
30
|
+
2. **Always run auth check first** (ask user to fix if missing):
|
|
31
|
+
```bash
|
|
32
|
+
sensecraft-cli auth info
|
|
33
|
+
```
|
|
34
|
+
Published commands require an active **SenseCAP Access Key** → `{ai-host}/openapi` + HTTP Basic.
|
|
35
|
+
3. **Do not run bare `auth init`** — that wizard needs a TTY. In this shell, use the split flow. Each command exits and prints JSON. Show `verification_url` and end the turn before polling:
|
|
36
|
+
```bash
|
|
37
|
+
sensecraft-cli auth init --site Global --no-wait
|
|
38
|
+
sensecraft-cli auth init --device-code <device_code>
|
|
39
|
+
sensecraft-cli auth init --device-code <device_code> --key-id <access_id>
|
|
40
|
+
```
|
|
41
|
+
Create a key with `--label <name> --access-level read-write` (or `only-read`) instead of `--key-id`. Use Global for SenseCraft AI and CodeCraft Hub. China is SenseCraft Data only. Do not print `access_token` or `access_key`. If the user already has a key, they can run `auth add` locally.
|
|
42
|
+
4. **L2 confirmation is a separate chat turn** — follow [references/confirmation.md](references/confirmation.md). 「删这个63760」/「删除应用 demo」is **intent, not confirmation**. Ask first (操作类型 + 环境 + 对象 ID), wait for `确认`/`confirm`, **then** `--yes`. Never add `--yes` on the same turn as the first request. Applies to: app/model create·update·publish·unpublish·delete, upload attach, cloud deploy, device bind/unbind, group create/rename/delete/move.
|
|
43
|
+
5. **Treat tokens and keys as secrets** — do not echo full `access_token`, `refresh_token`, or `access_key`. **Public model artifacts are not downloadable** — if the user asks for 下载地址 / 下载链接 / download URL / 怎么下载, that is the same as asking for `file_url`: refuse the address, explain deploy-only (`cloud deploy` or Console). Never run `model download --url-only` on public models.
|
|
44
|
+
6. **Success = indented JSON on stdout**; failure = stderr + non-zero exit. Parse stdout only on success.
|
|
45
|
+
7. **Local USB / IP flashing is L3** — do not pretend remote auto-flash. Classic reCamera (`40`): [`sensecraft-recamera`](references/recamera.md) (`check` / `open` the AI deploy page). Other USB benches: Console `/ai/device/local/32|36|37|41|52`. Do **not** use `/ai/recamera` (it 301s to Grove `36`) or `/ai/device/local/40` (no such bench).
|
|
46
|
+
8. **Upgrading the CLI itself** is `sensecraft-cli update` (npm registry, then `npm install -g`). This is not `app update` or `model update`. Uninstall with `npm uninstall -g @seeed-studio/sensecraft-cli`. Do not delete `~/.config/sensecraft-cli` unless the user asked to clear the saved Access Key.
|
|
47
|
+
|
|
48
|
+
## Auth
|
|
49
|
+
|
|
50
|
+
`auth init` runs Device Flow (`client_id=sensecraft-cli`), exchanges the login for an Access Key, and stores `key_id` + `access_key`. Daily calls use HTTP Basic on SenseCraft Data `/openapi` and on `{ai-host}/openapi` (SenseCraft AI and CodeCraft Hub). An existing key can be saved with `auth add`. Create or manage keys at https://account.seeed.cc/account/access-keys.
|
|
51
|
+
|
|
52
|
+
Bare `auth init` asks the user to pick Global or China. The split flow takes `--site` instead. The China site supports SenseCraft Data only. To use SenseCraft AI or CodeCraft Hub, select Global. Do not point the CLI at another host. The login access token stays in the local pending file and is not printed.
|
|
53
|
+
|
|
54
|
+
`auth info` shows the active Access Key (site, org, key id). Secrets are not printed.
|
|
55
|
+
|
|
56
|
+
## Intent → skill / command routing
|
|
57
|
+
|
|
58
|
+
| User intent | Use | Notes |
|
|
59
|
+
|-------------|-----|--------|
|
|
60
|
+
| SenseCraft Data: list/bind device, groups, telemetry | [`sensecraft-data`](references/data.md) | Shipped today |
|
|
61
|
+
| Browse / search CodeCraft Hub, view app | [`sensecraft-apps`](references/apps.md) + `app list` / `app view` | **CLI shipped** (list/view) |
|
|
62
|
+
| App fields / tool-blocks / BOM guidance | same apps skill references | Config OK; real flash = L3 |
|
|
63
|
+
| Author a new app (create + info + images + BOM + blocks) | [`create-app`](create-app/SKILL.md) | One batch confirmation; stops before publish |
|
|
64
|
+
| Create / update / publish / unpublish / delete / bom app | same + `app …` / `app bom …` | **CLI shipped** (L2 `--yes`; publish also `--agree-declaration`; bare `create --name` not L2) |
|
|
65
|
+
| Upload image/file/firmware/static/archive and obtain `file_url` | [`sensecraft-files`](references/files.md) + `file upload` | Types `1`–`2` require `--model-id`/`--app-id --yes`/`--for-app`/`--unlinked`; type `5` requires `--flow-id`; types `3`–`6` direct |
|
|
66
|
+
| Model library search/view/download/constants | [`sensecraft-models`](references/models.md) | **CLI shipped** |
|
|
67
|
+
| Upload / publish / unpublish / delete model | same + `model upload --id --yes` / `create\|update\|publish\|unpublish\|delete` | Attach bumps patch version like Console |
|
|
68
|
+
| Classic reCamera (`40`) pick / check / open deploy page | [`sensecraft-recamera`](references/recamera.md) + `app/model list --uniform-type 40` + `recamera check` / `open` | **CLI shipped**. Flash is Console L3 (IP/USB). Not `cloud deploy`. Not Pro `53`. |
|
|
69
|
+
| reCamera Pro model library | [`sensecraft-models`](references/models.md) + `model create --target recamera-pro` / `recamera-pro resolve` | Deploy is local IP/USB L3 — not `cloud deploy` |
|
|
70
|
+
| Jetson / cloud kit list & deploy | [`sensecraft-devices-cloud`](references/cloud.md) + `cloud …` | **CLI shipped** (list/view/deploy/order). SenseCraft AI, not SenseCraft Data `device` |
|
|
71
|
+
| Local USB/IP model deploy or firmware flash | [`sensecraft-recamera`](references/recamera.md) then Console Deploy, or `/ai/device/local/32\|36\|37\|41\|52` | **L3 only**; CLI does not talk to the device |
|
|
72
|
+
|
|
73
|
+
## Cross-domain example
|
|
74
|
+
|
|
75
|
+
SenseCraft Data telemetry → pick a public model → deploy to Jetson:
|
|
76
|
+
|
|
77
|
+
1. `sensecraft-cli auth info`
|
|
78
|
+
2. SenseCraft Data: `data latest --eui <eui>` (Access Key)
|
|
79
|
+
3. SenseCraft AI: `model list --public --name "…"` → `model view --id …` (metadata only; **no** `model download`)
|
|
80
|
+
4. Confirm with user → `cloud deploy --eui <jetson-eui> --model-id … --yes` (device pulls firmware at apply time)
|
|
81
|
+
5. `cloud order --request-id …`
|
|
82
|
+
|
|
83
|
+
## Product-term disambiguation
|
|
84
|
+
|
|
85
|
+
| User says | Possible meanings | Default choice |
|
|
86
|
+
|-----------|-------------------|----------------|
|
|
87
|
+
| application / App Store | CodeCraft Hub app vs in-doc deploy tool-block | **CodeCraft Hub** (`sensecraft-apps`) |
|
|
88
|
+
| device | SenseCraft Data node/gateway vs SenseCraft AI cloud device vs local USB board | Telemetry/bind → **sensecraft-data**; cloud device → devices-cloud; USB/serial → Console local (L3) |
|
|
89
|
+
| deploy a model | Cloud `deploy_model` vs local flash vs app tool-block | Ask which target; local flash = L3 |
|
|
90
|
+
| model download URL / download link / how to download | Public library artifact URL vs private owner file | **Public → no URL**, explain deploy; private My Models → `model download --out` (do not paste URL) |
|
|
91
|
+
| Data | SenseCraft Data telemetry vs training dataset | Telemetry → **sensecraft-data**; dataset → Console |
|
|
92
|
+
| Agent | Watcher Agent vs in-console AI Bot vs these Skills | These Skills ≠ Bot; Watcher has separate auth |
|
|
93
|
+
|
|
94
|
+
## Capability levels
|
|
95
|
+
|
|
96
|
+
| Level | Meaning | Examples |
|
|
97
|
+
|-------|---------|----------|
|
|
98
|
+
| L1 Scriptable | Agent may run directly | list / view / auth info / `auth init --no-wait` then later `--device-code` |
|
|
99
|
+
| L2 Confirm | Ask user first | publish (+ declaration), unpublish, delete, deploy |
|
|
100
|
+
| L3 Interactive | Human-in-the-loop | bare `auth init`, Web Serial flash, payment |
|
|
101
|
+
| L4 Ops-only | Do not expose to end-user Agent | Admin `judge_app` |
|
|
102
|
+
|
|
103
|
+
## Shipped commands
|
|
104
|
+
|
|
105
|
+
Published commands use an Access Key. SenseCraft Data uses its OpenAPI. SenseCraft AI and CodeCraft Hub use `{ai-host}/openapi`.
|
|
106
|
+
|
|
107
|
+
1. **CodeCraft Hub** — `app` list/view/fields/blocks/doc; create/update; publish/unpublish/delete (L2); BOM search/list/set; tool-block config via JSON (real flash = L3).
|
|
108
|
+
2. **SenseCraft AI** — model library (list/view/constants; **private** download only; public models deploy-only); `model upload --id --yes`; create/update; publish/unpublish/delete (L2). Cloud devices: `cloud device` / `cloud deploy` / `cloud order`. Classic reCamera 40: `recamera check` / `recamera open` (flash is L3).
|
|
109
|
+
3. **Files** — `file upload` is shared. Types 1–2 require `--model-id` / `--app-id --yes` / `--for-app` / `--unlinked` before the OSS POST. Type 5 also requires `--flow-id`.
|
|
110
|
+
4. **Local USB** — Other benches: Console `/ai/device/local/32|36|37|41|52`.
|
|
111
|
+
|
|
112
|
+
## When something is missing
|
|
113
|
+
|
|
114
|
+
SenseCraft AI and CodeCraft Hub commands are `model` / `recamera` / `cloud` and `app`. `file` is shared. If a command fails:
|
|
115
|
+
|
|
116
|
+
1. Run `sensecraft-cli auth info` — need an active Access Key.
|
|
117
|
+
2. Do **not** call SenseCraft Data `device`/`data` as a substitute.
|
|
118
|
+
3. Do **not** scrape Console cookies or invent HTTP with guessed tokens.
|
|
119
|
+
4. Open the matching file under `references/`. Do not invent a second skill.
|
|
120
|
+
|
|
121
|
+
## References
|
|
122
|
+
|
|
123
|
+
Read the file for the product in use. Leave the others closed.
|
|
124
|
+
|
|
125
|
+
| When | Read |
|
|
126
|
+
|------|------|
|
|
127
|
+
| Devices, groups, telemetry | [references/data.md](references/data.md), [references/data-commands.md](references/data-commands.md) |
|
|
128
|
+
| Applications | [references/apps.md](references/apps.md), [references/app-commands.md](references/app-commands.md), [references/app-fields.md](references/app-fields.md), [references/tool-blocks.md](references/tool-blocks.md) |
|
|
129
|
+
| Turn a local project into an app | [create-app/SKILL.md](create-app/SKILL.md) |
|
|
130
|
+
| Model library | [references/models.md](references/models.md), [references/model-commands.md](references/model-commands.md), [references/model-fields.md](references/model-fields.md) |
|
|
131
|
+
| Classic reCamera | [references/recamera.md](references/recamera.md), [references/recamera-commands.md](references/recamera-commands.md) |
|
|
132
|
+
| Cloud devices | [references/cloud.md](references/cloud.md), [references/cloud-commands.md](references/cloud-commands.md) |
|
|
133
|
+
| File upload | [references/files.md](references/files.md), [references/file-commands.md](references/file-commands.md) |
|
|
134
|
+
| Write confirmation | [references/confirmation.md](references/confirmation.md) |
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: create-app
|
|
3
|
-
description: Create a
|
|
3
|
+
description: Create a CodeCraft Hub app from a finished local project using a versioned local manifest (sensecraft-app.json) as the single source of truth — mine the project for app info, create the app in one go, then keep later edits local-first and push updates safely with drift detection. Use whenever the user wants to turn a finished or current project into a SenseCraft app, "publish my project" to SenseCraft, make an app from this repo/codebase, or update an app that has a sensecraft-app.json manifest — even if they only say "make this project an app" or "push my app changes". Publishing, unpublishing, deleting, and cloning stay with the parent sensecraft-cli skill.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# create-app
|
|
7
7
|
|
|
8
|
-
Turn a finished local project into a
|
|
8
|
+
Turn a finished local project into a CodeCraft Hub app through a local manifest: gather → write manifest → one-go create → local-first updates.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Entry skill: [`../SKILL.md`](../SKILL.md). App lifecycle (publish / unpublish / delete / clone): [`../references/apps.md`](../references/apps.md).
|
|
11
11
|
|
|
12
|
-
>
|
|
12
|
+
> L2 writes follow [../references/confirmation.md](../references/confirmation.md). Auth, site, and output rules in the entry skill still apply. Below is only what create-app adds.
|
|
13
13
|
|
|
14
14
|
## Why the manifest exists
|
|
15
15
|
|
|
16
16
|
The manifest makes the workflow resumable and safe. It remembers the `app_id` so a retry never spawns a duplicate (the server allows duplicate names). It records what was last pushed so a later Console edit is detected as drift instead of silently overwritten. And in a project without git, its timestamped archive snapshots are the only version history — treat them as precious.
|
|
17
17
|
|
|
18
|
-
Manifest schema, field-by-field: [
|
|
18
|
+
Manifest schema, field-by-field: [references/manifest.md](references/manifest.md). Starting template: [assets/manifest-template.json](assets/manifest-template.json).
|
|
19
19
|
|
|
20
20
|
## Manifest files on disk
|
|
21
21
|
|
|
@@ -36,7 +36,7 @@ Mine first, ask approval once at the end.
|
|
|
36
36
|
- `README*` → `app_name` / `excerpt` candidates (excerpt ≤ 300 UTF-16 code units).
|
|
37
37
|
- `package.json` / firmware README → name, `license`, `author`.
|
|
38
38
|
- `docs/`, `images/`, `assets/`, `screenshots/` → image candidates: JPG/JPEG/PNG/GIF/WebP, ≤ 5 MB each, up to 16, first = cover, prefer 4:3. No usable cover yet is fine — a private draft doesn't need one; publishing does. The user decides when to choose, upload, or generate one.
|
|
39
|
-
- **Deployment plan**: the steps serve non-developers who can only use the tool blocks provided — plan what they do on the app page (connect, run a block, configure, use), never how the project is built. Read [
|
|
39
|
+
- **Deployment plan**: the steps serve non-developers who can only use the tool blocks provided — plan what they do on the app page (connect, run a block, configure, use), never how the project is built. Read [../references/tool-blocks.md](../references/tool-blocks.md) before drafting to know what's available. An artifact you can't upload yet never removes a block the flow needs; resolve the config per the reference and mark what's pending. Note candidate artifacts (firmware bins, model files, flow JSON) without deciding yet.
|
|
40
40
|
- Hardware mentions (XIAO, Grove, reCamera…) → BOM candidates; resolve SKUs with `sensecraft-cli app bom search --name "<kw>"`.
|
|
41
41
|
2. **Fill gaps in ONE consolidated question round**: present a brief overview of the app fields and the deployment steps, then ask for what is missing — `scene` pick (list ids from `sensecraft-cli model constants` → `app_scenarios_array`; propose the best match), `allow_clone`, `allow_commerce`, and anything you flagged for the user to decide. If a step can't be completed by that audience, surface it here with options instead of writing a flow that contradicts itself. `app_name` defaults to the project's own name — propose any embellishment in the round rather than renaming silently. BOM default scope: **the device plus app-specific accessories named in the project docs** (ordinary cables, computers, and generic tools are excluded). When no Seeed SKU resolves via `app bom search`, custom BOM rows (name/quantity/note/buy_url, no `id`) are the correct fallback.
|
|
42
42
|
3. **Write the manifest** from the template with `identity.app_id: null`, `sync.local_revision: 1`.
|
|
@@ -70,17 +70,17 @@ Contest entry is a later `app update --activity-id <id>`. CLI also writes `"allo
|
|
|
70
70
|
Published text is what plaza users actually read — mine it from the project, but author it deliberately.
|
|
71
71
|
|
|
72
72
|
- `excerpt`: what the app is, who it is for, why it is interesting. Nothing else — no hardware/framework spec dump, no deploy steps, no version history or changelog.
|
|
73
|
-
- `deployment.blocks` prose: short onboarding steps — necessary prep, main actions, how to start and stop. Include a step only if the feature exists. Target structure: an intro of at most two short paragraphs, then one step per distinct user action (typically 3–5 steps). No full menu enumeration, no exhaustive troubleshooting, no spec tables, no restating the excerpt inside steps. Inline formatting in `content` is HTML, not Markdown. Images and video are uploaded first, then linked; see [
|
|
73
|
+
- `deployment.blocks` prose: short onboarding steps — necessary prep, main actions, how to start and stop. Include a step only if the feature exists. Target structure: an intro of at most two short paragraphs, then one step per distinct user action (typically 3–5 steps). No full menu enumeration, no exhaustive troubleshooting, no spec tables, no restating the excerpt inside steps. Inline formatting in `content` is HTML, not Markdown. Images and video are uploaded first, then linked; see [../references/tool-blocks.md#content-format](../references/tool-blocks.md#content-format).
|
|
74
74
|
- Review once before every push: would a first-time user find every sentence clear, with nothing repeated?
|
|
75
75
|
|
|
76
76
|
## Workflow B — create (one-go)
|
|
77
77
|
|
|
78
|
-
1. **Preflight**: Run `sensecraft-cli auth info`. Need an active SenseCAP Access Key. If missing,
|
|
78
|
+
1. **Preflight**: Run `sensecraft-cli auth info`. Need an active SenseCAP Access Key. If missing, use the split `auth init` flow in [`../SKILL.md`](../SKILL.md). Do not run bare `auth init`.
|
|
79
79
|
2. **Upload assets**, writing each returned `file_url` back into the manifest entry:
|
|
80
80
|
|
|
81
81
|
- Images: `sensecraft-cli file upload --path <img> --type 1 --for-app` (unlinked, 5 MB cap). Keep manifest order; index 0 = cover.
|
|
82
|
-
- Firmware/binaries for blocks: check binaries for embedded credentials before uploading — build outputs can compile tokens in; if anything shows up, flag it and let the user decide. Whatever the upload decision, a block the flow needs stays in the doc: fill its config per [
|
|
83
|
-
3. **Build the payload** from the manifest per the projection in [
|
|
82
|
+
- Firmware/binaries for blocks: check binaries for embedded credentials before uploading — build outputs can compile tokens in; if anything shows up, flag it and let the user decide. Whatever the upload decision, a block the flow needs stays in the doc: fill its config per [../references/tool-blocks.md](../references/tool-blocks.md) and mark unfilled values as pending (e.g. firmware built locally by the end user). Upload itself: `sensecraft-cli file upload --path <fw> --type 4` → put the URL on the `flash-firmware` block as flat `firmware_url`, with `firmware_name` and string `firmware_size`. Do not nest those fields under `config`. The editor wraps them into `config` when the doc is opened.
|
|
83
|
+
3. **Build the payload** from the manifest per the projection in [references/manifest.md](references/manifest.md#manifest--cli-payload). Omit keys that have no values — the CLI rejects an empty `images: []` but accepts the key absent. Write the projection to `.sensecraft/sensecraft-app.payload.json` (transient — delete after the push).
|
|
84
84
|
4. **Create** — deliberately not L2, no `--yes`:
|
|
85
85
|
```bash
|
|
86
86
|
sensecraft-cli app create --from-json .sensecraft/sensecraft-app.payload.json
|
|
@@ -93,11 +93,11 @@ Published text is what plaza users actually read — mine it from the project, b
|
|
|
93
93
|
|
|
94
94
|
## Workflow C — update (local-first)
|
|
95
95
|
|
|
96
|
-
The manifest leads, the remote follows. Every remote write below is L2: **one confirmation per batch, on a separate chat turn** ([
|
|
96
|
+
The manifest leads, the remote follows. Every remote write below is L2: **one confirmation per batch, on a separate chat turn** ([../references/confirmation.md](../references/confirmation.md)) — the user's first request is intent, not confirmation.
|
|
97
97
|
|
|
98
98
|
1. **Edit the manifest first** (user or agent), bump `sync.local_revision`, validate as in Workflow A step 4.
|
|
99
99
|
2. **Preflight + env guard**: `auth info` — `remote_type`/`org_id` must match `identity`. Mismatch → stop; the user either switches auth or explicitly adopts the new env into the manifest.
|
|
100
|
-
3. **Drift check**: `sensecraft-cli app view --id <app_id> --sketch`, project the remote into the same sections the manifest covers, compare with `sync.last_pushed_hash` (algorithm pinned in [
|
|
100
|
+
3. **Drift check**: `sensecraft-cli app view --id <app_id> --sketch`, project the remote into the same sections the manifest covers, compare with `sync.last_pushed_hash` (algorithm pinned in [references/manifest.md](references/manifest.md#sync--local-vs-remote-bookkeeping)). Same → push. Different → the app was changed outside this manifest: show the field-level diff and use your judgment — merge what doesn't conflict, bring real conflicts to the user as a concrete proposal. Never silently overwrite someone else's edits.
|
|
101
101
|
4. **Confirm once for the whole batch**: state environment, app name + id, and every pending change (fields, images, BOM rows, blocks). Wait for the user's `确认` / `yes` reply.
|
|
102
102
|
5. **Push only what changed**:
|
|
103
103
|
| Changed section | Command |
|
|
@@ -105,13 +105,13 @@ The manifest leads, the remote follows. Every remote write below is L2: **one co
|
|
|
105
105
|
| info fields and/or image set | `sensecraft-cli app update --id <app_id> --from-json .sensecraft/sensecraft-app.patch.json --yes` (sparse OK — CLI merges missing info keys from the sketch) |
|
|
106
106
|
| BOM | `sensecraft-cli app bom set --id <app_id> --from-json .sensecraft/sensecraft-app.materials.json --yes` |
|
|
107
107
|
| deployment blocks | include `deployment` in the `app update` patch |
|
|
108
|
-
- **Images**: upload new/changed files with `--type 1 --for-app` (compare `sha256` in the manifest), then send the **full** `images[]` URL array in the update patch. Never use `--app-id` attach here — it prepends one image and scrambles the manifest order (see [../commands.md](../commands.md)).
|
|
108
|
+
- **Images**: upload new/changed files with `--type 1 --for-app` (compare `sha256` in the manifest), then send the **full** `images[]` URL array in the update patch. Never use `--app-id` attach here — it prepends one image and scrambles the manifest order (see [../references/app-commands.md](../references/app-commands.md)).
|
|
109
109
|
6. **Verify** per the parent rule: success may return `{}`, so re-read with `app view --id <app_id> --sketch` (and `app bom list --id <app_id>` when BOM changed).
|
|
110
110
|
7. **Record**: `last_pushed_revision = local_revision`, new hash + time; archive snapshot; suggest `git add` when in git.
|
|
111
111
|
8. **Published app**: the update saves a **draft** — the plaza copy is unchanged until publish (parent skill). Under review (`be_public=2`) the CLI refuses — stop and say so.
|
|
112
112
|
|
|
113
113
|
## Field and block rules
|
|
114
114
|
|
|
115
|
-
- App info + BOM: [../
|
|
116
|
-
- Deployment layout + tool-block configs: [../
|
|
117
|
-
- CLI flags for every command above: [../commands.md](../commands.md)
|
|
115
|
+
- App info + BOM: [../references/app-fields.md](../references/app-fields.md)
|
|
116
|
+
- Deployment layout + tool-block configs: [../references/tool-blocks.md](../references/tool-blocks.md)
|
|
117
|
+
- CLI flags for every command above: [../references/app-commands.md](../references/app-commands.md)
|
|
@@ -13,7 +13,7 @@ Integer, currently `1`. Bump only when the schema changes shape.
|
|
|
13
13
|
| Key | Filled when | Notes |
|
|
14
14
|
|-----|-------------|-------|
|
|
15
15
|
| `app_id` | after create | `null` until created. Once set, NEVER re-run create for this manifest |
|
|
16
|
-
| `remote_type` | preflight | `Global` / `China` / `Private` from `auth info`. Update flow hard-stops on mismatch |
|
|
16
|
+
| `remote_type` | preflight | `Global` / `China` / `Private` from `auth info`. Update flow hard-stops on mismatch. CodeCraft Hub requires Global; China supports SenseCraft Data only |
|
|
17
17
|
| `org_id` | preflight | from `auth info` |
|
|
18
18
|
| `account` | preflight | from `auth info` |
|
|
19
19
|
| `created_at` | after create | **Local UTC timestamp recorded when create succeeds** — the CLI returns no created time |
|
|
@@ -30,7 +30,7 @@ Integer, currently `1`. Bump only when the schema changes shape.
|
|
|
30
30
|
| `allow_clone` | `0` or `1` only |
|
|
31
31
|
| `allow_commerce` | `0` or `1` only |
|
|
32
32
|
|
|
33
|
-
Full field compliance: [
|
|
33
|
+
Full field compliance: [../../references/app-fields.md](../../references/app-fields.md).
|
|
34
34
|
|
|
35
35
|
## `images` — local paths with upload state
|
|
36
36
|
|
|
@@ -47,11 +47,11 @@ Formats JPG/JPEG/PNG/GIF/WebP, ≤ 5 MB each, prefer 4:3. SVG is rejected by the
|
|
|
47
47
|
|
|
48
48
|
## `deployment.blocks`
|
|
49
49
|
|
|
50
|
-
Flat ordered array, copied through to the payload unchanged. Blocks before the first `step` = introduction; each `step` starts a deploy step. Tool-block configs (`flash-firmware`, `deploy-ai-model`, …): [
|
|
50
|
+
Flat ordered array, copied through to the payload unchanged. Blocks before the first `step` = introduction; each `step` starts a deploy step. Tool-block configs (`flash-firmware`, `deploy-ai-model`, …): [../../references/tool-blocks.md](../../references/tool-blocks.md). After `file upload --type 4`, put the URL on the `flash-firmware` block as flat `firmware_url` (plus `firmware_name` and string `firmware_size`). Do not nest those fields under `config`. The editor wraps them into `config` when the doc is opened.
|
|
51
51
|
|
|
52
52
|
## `bom.materials`
|
|
53
53
|
|
|
54
|
-
Seeed catalog rows carry `id` (SKU), `quantity`, `name`, `note`, `buy_url` — never `price`/`pic_url` (resolved by SKU server-side). Custom rows carry `name` + `quantity` (required) and optionally `note` / `buy_url` — no `id`, no image, no price. Details: [
|
|
54
|
+
Seeed catalog rows carry `id` (SKU), `quantity`, `name`, `note`, `buy_url` — never `price`/`pic_url` (resolved by SKU server-side). Custom rows carry `name` + `quantity` (required) and optionally `note` / `buy_url` — no `id`, no image, no price. Details: [../../references/app-fields.md](../../references/app-fields.md#bom-materials).
|
|
55
55
|
|
|
56
56
|
## `sync` — local vs remote bookkeeping
|
|
57
57
|
|
|
@@ -90,7 +90,7 @@ Never include `be_public` / `privacy` in any payload.
|
|
|
90
90
|
|
|
91
91
|
## Worked example
|
|
92
92
|
|
|
93
|
-
See [assets/manifest-template.json](assets/manifest-template.json) for a fresh manifest (pre-create), and below for the same manifest after a successful create:
|
|
93
|
+
See [../assets/manifest-template.json](../assets/manifest-template.json) for a fresh manifest (pre-create), and below for the same manifest after a successful create:
|
|
94
94
|
|
|
95
95
|
```json
|
|
96
96
|
{
|
|
@@ -121,24 +121,27 @@ See [assets/manifest-template.json](assets/manifest-template.json) for a fresh m
|
|
|
121
121
|
],
|
|
122
122
|
"deployment": {
|
|
123
123
|
"blocks": [
|
|
124
|
-
{ "id": "intro_1", "type": "paragraph", "content": "
|
|
125
|
-
{ "id": "step_1", "type": "step", "title": "
|
|
124
|
+
{ "id": "intro_1", "type": "paragraph", "content": "What this app does.", "indent": 0 },
|
|
125
|
+
{ "id": "step_1", "type": "step", "title": "Flash firmware", "content": "Flash firmware", "expanded": true, "indent": 0 },
|
|
126
126
|
{
|
|
127
127
|
"id": "ff_1",
|
|
128
128
|
"type": "flash-firmware",
|
|
129
|
-
"
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
129
|
+
"device_id": "113991115",
|
|
130
|
+
"device_type": "32",
|
|
131
|
+
"flash_mode": "bin",
|
|
132
|
+
"firmware_url": "https://files.seeedstudio.com/…/firmware.bin",
|
|
133
|
+
"firmware_name": "firmware.bin",
|
|
134
|
+
"firmware_size": "412316",
|
|
135
|
+
"flash_address": "0x0",
|
|
136
|
+
"muse_gadget": false,
|
|
137
|
+
"full_flash": false
|
|
135
138
|
}
|
|
136
139
|
]
|
|
137
140
|
},
|
|
138
141
|
"bom": {
|
|
139
142
|
"materials": [
|
|
140
143
|
{
|
|
141
|
-
"id": "
|
|
144
|
+
"id": "113991115",
|
|
142
145
|
"quantity": "1",
|
|
143
146
|
"name": "Seeed Studio XIAO ESP32S3 Sense",
|
|
144
147
|
"note": "Main MCU",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# sensecraft-apps — CLI commands
|
|
2
2
|
|
|
3
|
-
Target binary: `sensecraft-cli` (this repo). Auth: active **SenseCAP Access Key** (`auth init
|
|
3
|
+
Target binary: `sensecraft-cli` (this repo). Auth: active **SenseCAP Access Key** (`auth init`) → `{ai-host}/openapi`.
|
|
4
4
|
|
|
5
5
|
> Status: **shipped**. Every command below is implemented — run it rather than describing it. If a flag is rejected, check `--help` instead of assuming the feature is missing.
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ Target binary: `sensecraft-cli` (this repo). Auth: active **SenseCAP Access Key*
|
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
sensecraft-cli auth info
|
|
11
|
-
sensecraft-cli auth init --
|
|
11
|
+
sensecraft-cli auth init --site Global --no-wait # split flow; see SKILL.md
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
## Commands
|
|
@@ -21,14 +21,13 @@ List apps.
|
|
|
21
21
|
|
|
22
22
|
| Flag | Default | Notes |
|
|
23
23
|
| --------------------- | ----------------------- | ------------------------------------------------------------ |
|
|
24
|
-
| `--public` | |
|
|
24
|
+
| `--public` | | CodeCraft Hub (`be_public=1`). Required for the store; not the default |
|
|
25
25
|
| `--mine` | default if neither flag | My apps. Omit both visibility flags for the same result |
|
|
26
26
|
| `--name` | | Search keyword → API `app_name` (Console app list) |
|
|
27
27
|
| `--scene` | | Scene id |
|
|
28
28
|
| `--uniform-type` | | Device type → API `uniform_type` (`40` reCamera, `32` XIAO ESP32S3, `53` reCamera Pro) |
|
|
29
29
|
| `--sort` | | `popular` → `order_type=1`, `newest` → `2`, `likes` → `3`. Omit to leave `order_type` unset |
|
|
30
30
|
| `--priority-activity-id` | | Positive integer. Only with `--sort popular`. If omitted on popular, CLI fills the first ongoing activity |
|
|
31
|
-
| `--tag-id` | | Competition filter → `tag_id` |
|
|
32
31
|
| `--mark-type` | | `1` = my likes, `0` = my collections |
|
|
33
32
|
| `--likes` | | `mark_type=1` and `be_public=1`. Not with `--mine` |
|
|
34
33
|
| `--collections` | | `mark_type=0` and `be_public=1`. Not with `--mine` |
|
|
@@ -36,10 +35,9 @@ List apps.
|
|
|
36
35
|
| `--sandbox` | | Sample JSON, no network. Includes `sandbox_query` |
|
|
37
36
|
|
|
38
37
|
```bash
|
|
39
|
-
#
|
|
38
|
+
# CodeCraft Hub. Omit visibility flags for my apps. Hot sort is explicit.
|
|
40
39
|
sensecraft-cli app list --public --name "vision" --scene <scene_id> --page 1 --length 20
|
|
41
40
|
sensecraft-cli app list --public --sort popular --length 12
|
|
42
|
-
sensecraft-cli app list --public --sort popular --tag-id 1
|
|
43
41
|
sensecraft-cli app list --public --sort newest
|
|
44
42
|
sensecraft-cli app list --public --likes
|
|
45
43
|
sensecraft-cli app list --public --collections
|
|
@@ -112,7 +110,7 @@ Use stdout `deployment` in `app create` / `app update`, or skip this step and pa
|
|
|
112
110
|
|
|
113
111
|
Rejects `be_public=1` / `privacy=1`. Do **not** confuse with `app update` (existing app → L2).
|
|
114
112
|
|
|
115
|
-
**Success output:** CLI always prints `app_id`, `console_url`, and `detail_url` on
|
|
113
|
+
**Success output:** CLI always prints `app_id`, `console_url`, and `detail_url` on CodeCraft Hub (`https://codecraft.seeed.cc/hub`, or `https://test-codecraft.seeed.cc/hub` when the AI host contains `test-`, including `remote_type=Develop`):
|
|
116
114
|
|
|
117
115
|
- edit: `/application/edit?id=<app_id>`
|
|
118
116
|
- my app detail: `/view-application/<app_id>-<slug>?from=user-center&tab=custom`
|
|
@@ -171,7 +169,7 @@ sensecraft-cli app update --id <app_id> --activity-id 1 --yes
|
|
|
171
169
|
sensecraft-cli app update --id <app_id> --cancel-activity-id 1 --yes
|
|
172
170
|
```
|
|
173
171
|
|
|
174
|
-
`activity_id` must be a positive integer. List
|
|
172
|
+
`activity_id` must be a positive integer. List activities in progress with `app activity list` first. Before POST, CLI loads the server activity list (activities that have not ended, which can include ones that have not started). If that request succeeds and does not contain the id, CLI does not POST. A failed list request is ignored. The server still rejects a bad id with `11202` and a missing or expired activity with `25000` `Activity does not exist or has expired` (the whole edit is discarded). Omitting `activity_id` does not change existing activity tags. `tags` is not read by the server.
|
|
175
173
|
|
|
176
174
|
`cancel_activity_id` must be a positive integer. CLI sends it as a JSON number and does not check the ongoing list or change `allow_clone`. Omitting it leaves participation unchanged. The same id cannot be both `activity_id` and `cancel_activity_id`.
|
|
177
175
|
|
|
@@ -190,7 +188,7 @@ When `--activity-id` is set and this JSON does not include `allow_clone`, CLI se
|
|
|
190
188
|
- `withdraw` → `POST /flow/app/v3/callback_sketch` with `{app_id}` only, and only when `be_public=2`. Public apps: `unpublish`. Private apps: nothing to withdraw.
|
|
191
189
|
- `delete` → `POST /flow/app/v2/delete_app` — **private + owner** (`be_public=0`)
|
|
192
190
|
- **Never** send privacy `1`
|
|
193
|
-
- All require a **separate chat confirm** ([
|
|
191
|
+
- All require a **separate chat confirm** ([confirmation.md](confirmation.md)) then `--yes`; `publish` also requires `--agree-declaration`. 「删除应用 demo」is intent — ask first.
|
|
194
192
|
|
|
195
193
|
```bash
|
|
196
194
|
# after the user replies 确认:
|
|
@@ -202,7 +200,7 @@ sensecraft-cli app delete --id <app_id> --yes
|
|
|
202
200
|
|
|
203
201
|
### `app activity list`
|
|
204
202
|
|
|
205
|
-
**Status: implemented.** Read-only. `GET /activity/list` with no `time` query. stdout is `{ "list": [...] }`
|
|
203
|
+
**Status: implemented.** Read-only. No Access Key. `GET /activity/list` with no `time` query. stdout is `{ "list": [...] }` for activities in progress now: numeric `activity_id`, `name`, `guide_url`, and `start_time` / `end_time` as UTC timestamps (`2026-10-18T16:00:00Z`). Rows outside that window, or missing an id, name, or either time, are dropped. Tag ids are not shown.
|
|
206
204
|
|
|
207
205
|
```bash
|
|
208
206
|
sensecraft-cli app activity list
|
package/skills/{sensecraft-apps/reference-app-fields.md → sensecraft-cli/references/app-fields.md}
RENAMED
|
@@ -19,7 +19,7 @@ Agent fill-in guide for SenseCraft custom apps (v3). Aligns with Console `infoFo
|
|
|
19
19
|
| `author` | string | recommended on save | current user id/account |
|
|
20
20
|
| `activity_id` | positive integer | no | Join this activity. Omit or send blank to leave existing activity tags unchanged. CLI sends a JSON number. `0`, negatives, and non-integers are rejected before POST. Server: not a positive integer → `11202` `Request parameters are invalid`; missing / unpublished / deleted / outside start–end → `25000` `Activity does not exist or has expired` (the whole edit is discarded). |
|
|
21
21
|
| `cancel_activity_id` | positive integer | no | Leave this activity. Omit or send blank to leave participation unchanged. CLI sends a JSON number and does not change `allow_clone`. Must not equal `activity_id`. |
|
|
22
|
-
| `flow_data` / `model_data` | Node-RED sync | only with `node-red` block | `flow_data`
|
|
22
|
+
| `flow_data` / `model_data` | Node-RED sync | only with `node-red` block | Block `config.flow_data` and `config.model_data` are objects, not strings. On save the app writes `JSON.stringify(config.flow_data)` to this top-level `flow_data` string and copies `model_data` here. |
|
|
23
23
|
|
|
24
24
|
### Create vs update
|
|
25
25
|
|
|
@@ -82,7 +82,7 @@ Custom rows are exactly `name` / `quantity` / `note` / `buy_url` (Console `build
|
|
|
82
82
|
{
|
|
83
83
|
"materials": [
|
|
84
84
|
{
|
|
85
|
-
"id": "
|
|
85
|
+
"id": "113991115",
|
|
86
86
|
"quantity": "1",
|
|
87
87
|
"name": "Seeed Studio XIAO ESP32S3 Sense",
|
|
88
88
|
"note": "Main MCU",
|
|
@@ -1,24 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
`app create --from-md` or `app update --from-md` (see docs/md-to-app.md).
|
|
11
|
-
That compiles editor HTML before the write. `app doc compile` only previews.
|
|
12
|
-
There is no import-md command.
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
# SenseCraft Apps (Application Plaza)
|
|
16
|
-
|
|
17
|
-
Domain skill for **SenseCraft AI applications**. Auth: **Access Key** → `{ai-host}/openapi` (HTTP Basic).
|
|
18
|
-
|
|
19
|
-
Parent router: [`../sensecraft-ai/SKILL.md`](../sensecraft-ai/SKILL.md).
|
|
20
|
-
SenseCAP IoT: [`../sensecraft-data/SKILL.md`](../sensecraft-data/SKILL.md).
|
|
21
|
-
Child skill: [`create-app/SKILL.md`](create-app/SKILL.md) — manifest-driven app lifecycle: mine a finished local project into a versioned `sensecraft-app.json` manifest (source of truth), create the app in one go, then local-first updates with drift detection (one batch confirmation per push). Publish / unpublish / delete stay in this file.
|
|
1
|
+
# CodeCraft Hub
|
|
2
|
+
|
|
3
|
+
Site: https://codecraft.seeed.cc/hub
|
|
4
|
+
|
|
5
|
+
Domain skill for **CodeCraft Hub applications**. Auth: **Access Key** (HTTP Basic). The China site supports SenseCraft Data only; use Global for CodeCraft Hub.
|
|
6
|
+
|
|
7
|
+
Parent router: [`../SKILL.md`](../SKILL.md).
|
|
8
|
+
SenseCAP IoT: [`data.md`](data.md).
|
|
9
|
+
Child skill: [`../create-app/SKILL.md`](../create-app/SKILL.md) — manifest-driven app lifecycle: mine a finished local project into a versioned `sensecraft-app.json` manifest (source of truth), create the app in one go, then local-first updates with drift detection (one batch confirmation per push). Publish / unpublish / delete stay in this file.
|
|
22
10
|
|
|
23
11
|
## Agent rules
|
|
24
12
|
|
|
@@ -26,11 +14,11 @@ Child skill: [`create-app/SKILL.md`](create-app/SKILL.md) — manifest-driven ap
|
|
|
26
14
|
```bash
|
|
27
15
|
sensecraft-cli auth info
|
|
28
16
|
```
|
|
29
|
-
Need an active **SenseCAP Access Key**. If missing,
|
|
30
|
-
2. **L2 confirm is a separate chat turn** ([
|
|
17
|
+
Need an active **SenseCAP Access Key**. If missing, use the split `auth init` flow in [`../SKILL.md`](../SKILL.md). Do not run bare `auth init`.
|
|
18
|
+
2. **L2 confirm is a separate chat turn** ([confirmation.md](confirmation.md)) before: `publish` (`--agree-declaration`), `unpublish`, `withdraw`, `delete`, `like`, `unlike`, `collect`, `uncollect`, `mark-deploy`, `clone`, **`app update` / `bom set`**. 「删除应用 demo」is **not** confirmation — ask `将从{环境}环境删除应用 demo(ID: …)。删除后可能无法恢复。是否确认执行?`, wait for `确认`, then `--yes`. Never pass `--yes` on the same turn as the first request. **Exception — batch authoring:** [`create-app`](../create-app/SKILL.md) confirms a whole push batch (fields + images + BOM + blocks) in one turn instead of per write; its one-go `app create` needs no confirmation at all.
|
|
31
19
|
**`app create` is not L2** — including `--from-json` with full fields (create + internal follow-up `update_app` on the **new** `app_id` only). Prefer one-shot create when the payload is ready. Still tell the user what will be created before running create.
|
|
32
20
|
3. **Privacy values**: submit review → `privacy` / flow uses **`2`** (pending); unpublish/private → **`0`**. **Never send `1`** (ops-approved public; Admin only).
|
|
33
|
-
4. Tool-block **configuration** may be written into `deployment.blocks`. **Executing** flash / USB deploy / container install on hardware is **L3**. Classic reCamera (`40`): [`sensecraft-recamera`](
|
|
21
|
+
4. Tool-block **configuration** may be written into `deployment.blocks`. **Executing** flash / USB deploy / container install on hardware is **L3**. Classic reCamera (`40`): [`sensecraft-recamera`](recamera.md) (`check` / `open`). Other benches: Console `/ai/device/local/32|36|37|41|52`. `flash-firmware` run is out of scope this pass.
|
|
34
22
|
5. Parse indented JSON on stdout; on failure read stderr + exit code. After `app update`, **re-read** the app — success body may be `{}`.
|
|
35
23
|
6. **Rename / edit info**: sparse `{"app_name":"…"}` is OK (CLI merges other info fields from sketch). Do not invent HTTP; do **not** put `be_public=1` in user JSON. For **already published** apps the CLI injects `be_public=1` (Console info save) and returns `sketch_saved` — plaza copy is unchanged until `app publish`.
|
|
36
24
|
7. **Lifecycle vs Console**: edit / publish / unpublish / delete / BOM / cover only for **your** apps (`user_id` == profile). Another user's plaza app cannot be edited. `be_public=2` locks owner edit. `be_public=1` owner may save sketch then `app publish` (草稿). Delete only `be_public=0`.
|
|
@@ -40,8 +28,8 @@ Child skill: [`create-app/SKILL.md`](create-app/SKILL.md) — manifest-driven ap
|
|
|
40
28
|
|
|
41
29
|
| Area | Status |
|
|
42
30
|
| ---------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
43
|
-
|
|
|
44
|
-
| `app list` / `app view` / `app fields` / `app blocks` / `app activity list` | **Implemented**.
|
|
31
|
+
| Access Key | **Implemented** (`auth init` or `auth add`; `app` uses `{ai-host}/openapi` Basic) |
|
|
32
|
+
| `app list` / `app view` / `app fields` / `app blocks` / `app activity list` | **Implemented**. CodeCraft Hub hot list is `--public --sort popular` |
|
|
45
33
|
| `app doc compile` | **Implemented**. Markdown → editor `deployment.blocks`. No auth, no network. `app create --from-md` / `app update --from-md` compile then write. `--from-json` fills video, file-link, and image HTML, and rejects raw Markdown in text-block `content` |
|
|
46
34
|
| `app create` / `update` / `publish` / `unpublish` / `withdraw` / `delete` | **Implemented** (L2 = `--yes`; publish also `--agree-declaration`; **`create` never needs `--yes`**, even with full `--from-json`). `withdraw` is review-only (`be_public=2`); `unpublish` is for an already public app |
|
|
47
35
|
| `app like` / `unlike` / `collect` / `uncollect` / `mark-deploy` / `clone` | **Implemented** (L2 = `--yes`) |
|
|
@@ -100,7 +88,7 @@ sensecraft-cli app unpublish --id <app_id> --yes # privacy=0 private / withdr
|
|
|
100
88
|
sensecraft-cli app delete --id <app_id> --yes # private only (be_public=0)
|
|
101
89
|
```
|
|
102
90
|
|
|
103
|
-
`app publish` matches Console 「发布确认」: show https://sensecraft.seeed.cc/legal/en/declaration and warn that review locks editing; only then pass `--agree-declaration --yes`. Missing either flag → non-zero. API body is still only `{app_id, privacy:2}` (agreement is client-side, like Console `warrantyAccepted`). stdout includes `detail_url`: the creator-center page (
|
|
91
|
+
`app publish` matches Console 「发布确认」: show https://sensecraft.seeed.cc/legal/en/declaration and warn that review locks editing; only then pass `--agree-declaration --yes`. Missing either flag → non-zero. API body is still only `{app_id, privacy:2}` (agreement is client-side, like Console `warrantyAccepted`). stdout includes `detail_url`: the creator-center page (`https://codecraft.seeed.cc/hub/view-application/<id>-<slug>?from=user-center&tab=custom`). Give the user that URL. Do **not** invent `/application/detail/<id>` — that is the plaza page and does not open the private draft.
|
|
104
92
|
|
|
105
93
|
**Never** send `privacy=1` (ops-approved public). After editing a **published** app, tell the user plaza is unchanged until they confirm `app publish --agree-declaration --yes`.
|
|
106
94
|
|
|
@@ -124,15 +112,15 @@ Seeed rows need `id`(=SKU). Custom rows omit `id`. No manual custom image upload
|
|
|
124
112
|
sensecraft-cli app blocks
|
|
125
113
|
```
|
|
126
114
|
Use `app_scenarios_array` from constants and the two static catalogs; never invent option ids or block shapes.
|
|
127
|
-
1. Fill required app info (see [
|
|
128
|
-
2. Build intro + stepped deploy + tool-blocks ([
|
|
129
|
-
3. BOM: Seeed SKU rows and/or custom rows ([
|
|
115
|
+
1. Fill required app info (see [app-fields.md](app-fields.md)).
|
|
116
|
+
2. Build intro + stepped deploy + tool-blocks ([tool-blocks.md](tool-blocks.md)). When the source is Markdown, run `sensecraft-cli app create --from-md <file>` (add `--from-json` for scene, cover, BOM, and tool-blocks). JSON `deployment.blocks` are appended after the compiled document. `app doc compile --from-md` only previews. Do not leave `**bold**` or list markers in JSON `content`.
|
|
117
|
+
3. BOM: Seeed SKU rows and/or custom rows ([app-fields.md](app-fields.md#bom-materials))
|
|
130
118
|
4. **Prefer one-shot create** when JSON is complete (**no `--yes`**):
|
|
131
119
|
```bash
|
|
132
120
|
sensecraft-cli app create --from-json ./app.json
|
|
133
121
|
# CLI returns app_id + console_url + detail_url (even if update_app body was {}).
|
|
134
|
-
# detail_url is https://
|
|
135
|
-
# (test AI host → https://test-
|
|
122
|
+
# detail_url is https://codecraft.seeed.cc/hub/view-application/<id>-<slug>?from=user-center&tab=custom
|
|
123
|
+
# (test AI host or remote_type Develop → https://test-codecraft.seeed.cc/hub). from=user-center loads the sketch cover.
|
|
136
124
|
# A non-empty web_link on a list item is the link to give the user.
|
|
137
125
|
# Restore JSON may have pic_url (list) or images[] (view); CLI writes both.
|
|
138
126
|
# Show links to the user. NEVER re-run create because stdout looked empty —
|
|
@@ -160,7 +148,7 @@ Never put `be_public=1` / `privacy=1` in JSON; use `app publish`.
|
|
|
160
148
|
| `license` | text | often with save | string |
|
|
161
149
|
| `be_public` | 0/1/2 | lifecycle | 0 private, 1 public (ops), 2 pending review |
|
|
162
150
|
|
|
163
|
-
Full table + `update_app` keys: [
|
|
151
|
+
Full table + `update_app` keys: [app-fields.md](app-fields.md).
|
|
164
152
|
|
|
165
153
|
## Deploy docs + tool-blocks (summary)
|
|
166
154
|
|
|
@@ -179,7 +167,7 @@ Structure: `deployment.blocks` flat array.
|
|
|
179
167
|
| `deploy-container-app` | Edge container app in the app doc | Config OK; installing the container is L3 |
|
|
180
168
|
| `node-red` / `aily-blockly` | Flow / Blockly projects | Lower priority unless user asks |
|
|
181
169
|
|
|
182
|
-
Details: [
|
|
170
|
+
Details: [tool-blocks.md](tool-blocks.md).
|
|
183
171
|
|
|
184
172
|
## BOM (summary)
|
|
185
173
|
|
|
@@ -194,7 +182,7 @@ Base: `{host}/openapi` with HTTP Basic (`key_id`:`access_key`).
|
|
|
194
182
|
|
|
195
183
|
| Action | Method | Path |
|
|
196
184
|
| ------- | ------ | ---------------------------------------------------------------- |
|
|
197
|
-
| List | GET | `/flow/app/v2/list_app` (`be_public`, `order_type` `1`/`2`/`3`, `priority_activity_id`, `
|
|
185
|
+
| List | GET | `/flow/app/v2/list_app` (`be_public`, `order_type` `1`/`2`/`3`, `priority_activity_id`, `mark_type` `1`/`0`) |
|
|
198
186
|
| Activities | GET | `/activity/list` (no `time`) |
|
|
199
187
|
| View | GET | `/flow/app/v3/view_app` |
|
|
200
188
|
| Create | POST | `/flow/app/v3/create_app` |
|
|
@@ -209,6 +197,6 @@ Authoritative field dump (Console repo): `website-sensecraft-console/docs/app-ed
|
|
|
209
197
|
|
|
210
198
|
## Additional resources
|
|
211
199
|
|
|
212
|
-
- [commands.md](commands.md) — CLI flags for every shipped `app` subcommand
|
|
213
|
-
- [
|
|
214
|
-
- [
|
|
200
|
+
- [app-commands.md](app-commands.md) — CLI flags for every shipped `app` subcommand
|
|
201
|
+
- [app-fields.md](app-fields.md) — app info + BOM compliance
|
|
202
|
+
- [tool-blocks.md](tool-blocks.md) — tool-block configs and selection
|