@heybox/hb-sdk 0.4.4 → 0.4.6
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 +78 -29
- package/dist/cli-chunks/{create-DAW1oAnH.cjs → create-BahMMgJH.cjs} +1 -1
- package/dist/cli-chunks/{dev-BA_4fnzO.cjs → dev-CTuXVPpU.cjs} +1 -1
- package/dist/cli-chunks/{doctor-Bbv8Lzu_.cjs → doctor-9gg3ZIvt.cjs} +1 -1
- package/dist/cli-chunks/{index-D7-awGYB.cjs → index-CLne_LW7.cjs} +3 -3
- package/dist/cli-chunks/{index-Bboot1us.cjs → index-DuwxUSkq.cjs} +181 -44
- package/dist/cli-chunks/{login-BQo2pIkq.cjs → login-OqaEx-Wd.cjs} +153 -2
- package/dist/cli-chunks/{deploy-BaLyuR1X.cjs → remote-zX17hOT4.cjs} +1008 -304
- package/dist/cli-chunks/{session-DiyDXvXu.cjs → session-D7lF9mpd.cjs} +347 -9
- package/dist/cli.cjs +1 -1
- package/dist/devtools/mock-host/main.js +430 -391
- package/dist/miniapp-publish.cjs.js +30 -0
- package/dist/miniapp-publish.esm.js +16 -1
- package/dist/templates/vue3-vite-ts/README.md.ejs +1 -1
- package/dist/templates/vue3-vite-ts/package.json.ejs +1 -1
- package/package.json +1 -1
- package/skill/SKILL.md +25 -18
- package/skill/references/api-root.md +2 -2
- package/skill/references/cli.md +120 -350
- package/skill/scripts/sync-references.mjs +84 -5
- package/skill/skill.json +4 -4
- package/types/miniapp-publish/index.d.ts +15 -0
|
@@ -203,9 +203,50 @@ const cliDevSection = [
|
|
|
203
203
|
extractSection(cliGuide, '## Mock runtime 边界'),
|
|
204
204
|
].filter(Boolean).join('\n\n');
|
|
205
205
|
const cliDeploySection = extractSection(cliGuide, '## 部署发布');
|
|
206
|
+
const cliRemoteSection = extractSection(cliGuide, '## 远端管理命令');
|
|
206
207
|
const cliLoginSection = extractSection(cliGuide, '## CLI 登录态');
|
|
207
208
|
const cliDoctorSection = extractSection(cliGuide, '## Agent Skill doctor');
|
|
208
209
|
const cliUpdateSection = extractSection(cliGuide, '## 版本提醒');
|
|
210
|
+
const cliCommandSurface = `hb-sdk create <project-name>
|
|
211
|
+
hb-sdk dev [--port <port>] [--mock-port <port>] [--runtime-url <url>] [--no-open]
|
|
212
|
+
hb-sdk login [--login-base-url <url>] [--no-select-entity]
|
|
213
|
+
hb-sdk login status
|
|
214
|
+
hb-sdk login clear
|
|
215
|
+
hb-sdk doctor
|
|
216
|
+
hb-sdk remote access
|
|
217
|
+
hb-sdk remote entity list
|
|
218
|
+
hb-sdk remote entity current
|
|
219
|
+
hb-sdk remote entity switch <entity-id>
|
|
220
|
+
hb-sdk remote list [--status <status>] [--keyword <text>]
|
|
221
|
+
hb-sdk remote create --name <name> [--preview-image-url <url>] [--yes] [--force-bind]
|
|
222
|
+
hb-sdk remote bind <mini-program-id> [--force]
|
|
223
|
+
hb-sdk remote info
|
|
224
|
+
hb-sdk remote update [--name <name>] [--preview-image-url <url>]
|
|
225
|
+
hb-sdk remote allowlist list
|
|
226
|
+
hb-sdk remote allowlist add <heybox-id...>
|
|
227
|
+
hb-sdk remote allowlist remove <heybox-id...>
|
|
228
|
+
hb-sdk remote allowlist set <heybox-id...>
|
|
229
|
+
hb-sdk remote deploy --release-note <text> [--skip-build] [--auto-publish]
|
|
230
|
+
hb-sdk remote versions
|
|
231
|
+
hb-sdk remote preview <version>
|
|
232
|
+
hb-sdk remote release <version> [--yes]
|
|
233
|
+
hb-sdk remote withdraw <version> [--yes] [--reason <text>]
|
|
234
|
+
hb-sdk remote take-down [--yes]
|
|
235
|
+
hb-sdk remote reopen [--yes]
|
|
236
|
+
|
|
237
|
+
Removed: hb-sdk deploy`;
|
|
238
|
+
|
|
239
|
+
const cliRemoteEntitySection = `Developer entity selection lives under \`hb-sdk remote entity\`:
|
|
240
|
+
|
|
241
|
+
${fenced('bash', `hb-sdk remote entity list
|
|
242
|
+
hb-sdk remote entity current
|
|
243
|
+
hb-sdk remote entity switch <entity-id>`)}
|
|
244
|
+
|
|
245
|
+
The authoritative current entity is the developer platform server-side current entity. The CLI auth cache may contain a \`selectedEntity\` value, but that value is only a hint snapshot for \`hb-sdk login status\` display and drift troubleshooting. Do not use \`selectedEntity\` as the source of truth for permissions, ownership, create, bind, deploy, or release decisions.
|
|
246
|
+
|
|
247
|
+
\`hb-sdk login\` tries to make the server-side current entity explicit after browser login. Zero entities leaves login successful and prints a guidance message. One entity is displayed and, when needed, switched to current. Multiple entities in a TTY prompt for a choice; multiple entities in non-interactive mode do not block login but tell the user to run \`hb-sdk remote entity switch <entity-id>\`. Passing \`--no-select-entity\` writes only the login state and does not modify the server-side current entity.`;
|
|
248
|
+
|
|
249
|
+
const cliRemoteEntityDeploySection = `Before precheck, build, upload, or submit audit, \`hb-sdk remote deploy\` must verify that the current project's bound mini-program belongs to the server-side current entity. If \`detail.entity_id\` differs from the current entity, the command fails with both entity ids/names and suggests \`hb-sdk remote entity switch <entity-id>\`. It must not auto-switch entities and must not continue into precheck/build/upload/submit on mismatch.`;
|
|
209
250
|
|
|
210
251
|
const files = new Map();
|
|
211
252
|
|
|
@@ -296,6 +337,8 @@ files.set('cli.md', `${header('CLI reference', [
|
|
|
296
337
|
['Create a mini-program template', 'create-a-mini-program-template'],
|
|
297
338
|
['Local dev and mock runtime', 'local-dev-and-mock-runtime'],
|
|
298
339
|
['Deploy and backend operations', 'deploy-and-backend-operations'],
|
|
340
|
+
['Remote entity scope', 'remote-entity-scope'],
|
|
341
|
+
['Remote management commands', 'remote-management-commands'],
|
|
299
342
|
['CLI login cache', 'cli-login-cache'],
|
|
300
343
|
['Agent Skill doctor', 'agent-skill-doctor'],
|
|
301
344
|
['Update reminders', 'update-reminders'],
|
|
@@ -303,7 +346,7 @@ files.set('cli.md', `${header('CLI reference', [
|
|
|
303
346
|
['Generated template README', 'generated-template-readme'],
|
|
304
347
|
])}## When to use the CLI
|
|
305
348
|
|
|
306
|
-
Use the bundled \`hb-sdk\` CLI when the task is about creating an external mini-program project, starting local Vite development, debugging SDK calls in a browser mock runtime host,
|
|
349
|
+
Use the bundled \`hb-sdk\` CLI when the task is about creating an external mini-program project, starting local Vite development, debugging SDK calls in a browser mock runtime host, managing the CLI's own Heybox auth cache, or inspecting/switching the developer platform current entity for remote mini-program management.
|
|
307
350
|
|
|
308
351
|
Do not use the CLI to replace iframe SDK calls. \`hb-sdk login\` is for CLI commands only and does not change \`auth.login()\`, \`user.getInfo()\`, \`network.request()\`, or mock-host user state.
|
|
309
352
|
|
|
@@ -311,7 +354,9 @@ The CLI, templates, and mock host are owned by \`${packageJson.name}\`. Do not c
|
|
|
311
354
|
|
|
312
355
|
## Command surface
|
|
313
356
|
|
|
314
|
-
${fenced('
|
|
357
|
+
${fenced('text', cliCommandSurface)}
|
|
358
|
+
|
|
359
|
+
Top-level \`hb-sdk deploy\` has been hard-cut and must not be documented as a valid compatibility alias. Keep \`hb-sdk login\` top-level because it manages CLI login state, not a specific remote mini-program.
|
|
315
360
|
|
|
316
361
|
## Create a mini-program template
|
|
317
362
|
|
|
@@ -334,16 +379,49 @@ Use \`hb-sdk dev\` for local browser SDK debugging. Use the Mock runtime host's
|
|
|
334
379
|
|
|
335
380
|
${cliDeploySection}
|
|
336
381
|
|
|
382
|
+
${cliRemoteEntityDeploySection}
|
|
383
|
+
|
|
337
384
|
Agent rules:
|
|
338
385
|
|
|
339
|
-
- Use \`hb-sdk deploy --release-note <text>\` for normal build, upload, and submit-audit flows.
|
|
340
|
-
-
|
|
386
|
+
- Use \`hb-sdk remote deploy --release-note <text>\` for normal build, upload, and submit-audit flows.
|
|
387
|
+
- Verify remote deploy guidance says current-entity mismatch fails before precheck/build/upload/submit and never auto-switches the developer entity.
|
|
388
|
+
- Never recommend top-level \`hb-sdk deploy\`; it has been removed rather than retained as a compatibility alias.
|
|
389
|
+
- After non-auto deploy succeeds, suggest \`hb-sdk remote versions\` and then \`hb-sdk remote release <version>\` after approval. Do not send the user to Open for manual publish when the CLI command exists.
|
|
390
|
+
- Use \`hb-sdk remote allowlist add <heybox_id>\` when preview access needs to be granted.
|
|
391
|
+
- Use \`--api-base-url <url>\` or \`HB_SDK_API_BASE_URL\` for remote platform backend APIs.
|
|
341
392
|
- Use \`--allow-unsafe-api-base-url\` or \`HB_SDK_ALLOW_UNSAFE_API_BASE_URL=1\` only for local backend debugging against non-Heybox or non-HTTPS API origins.
|
|
342
|
-
- Use \`--login-base-url <url>\` or \`HB_SDK_LOGIN_BASE_URL\` for CLI browser login and
|
|
393
|
+
- Use \`--login-base-url <url>\` or \`HB_SDK_LOGIN_BASE_URL\` for CLI browser login and remote command login-environment validation.
|
|
343
394
|
- Use \`packages/hb-sdk/src/cli/config.ts\` with \`RylaiServiceTagConfig\` only when Heybox backend API requests need the development-only \`x-rylai-service-tag\` header and matching \`special_tag\` query parameter.
|
|
344
395
|
- Custom base URLs must be origin-only; API origins must be Heybox trusted HTTPS unless the unsafe debug switch is explicit. Do not include path, query, or hash.
|
|
345
396
|
- Do not expect custom base URLs to affect \`hb-sdk doctor\`, npm latest checks, or mock-host \`network.request()\`.
|
|
346
397
|
|
|
398
|
+
## Remote entity scope
|
|
399
|
+
|
|
400
|
+
${cliRemoteEntitySection}
|
|
401
|
+
|
|
402
|
+
Agent rules:
|
|
403
|
+
|
|
404
|
+
- Treat the server-side current entity as the authority for remote create, bind, deploy, list, access, versions, preview, release, withdraw, take-down, and reopen workflows.
|
|
405
|
+
- Treat CLI \`selectedEntity\` as a display/debug snapshot only; it can drift from the server-side current entity and must not be used as a permission source.
|
|
406
|
+
- Use \`hb-sdk remote entity current\` when a user needs to confirm which entity create/deploy will use.
|
|
407
|
+
- Use \`hb-sdk remote entity switch <entity-id>\` to change entity scope. Do not recommend \`--entity-id\` or an environment variable as a remote command override.
|
|
408
|
+
- \`hb-sdk remote list\` lists mini-programs in the current entity scope only; do not promise cross-entity aggregation.
|
|
409
|
+
|
|
410
|
+
## Remote management commands
|
|
411
|
+
|
|
412
|
+
${cliRemoteSection}
|
|
413
|
+
|
|
414
|
+
Agent rules:
|
|
415
|
+
|
|
416
|
+
- Use \`hb-sdk remote entity list/current/switch\` for developer entity inspection and switching.
|
|
417
|
+
- Use \`hb-sdk remote create --name <name>\` for create-and-bind and \`hb-sdk remote bind <mini-program-id>\` for binding an existing manageable remote mini-program.
|
|
418
|
+
- Explain that \`remote create\` creates under the current entity and that multi-entity non-TTY usage must confirm with \`--yes\`; \`--yes\` confirms current-entity usage but does not switch entities.
|
|
419
|
+
- Explain that \`remote bind\` verifies the mini-program is manageable by the current entity and does not write \`package.json.heybox.miniProgramId\` on entity mismatch.
|
|
420
|
+
- Use \`hb-sdk remote info\`, \`hb-sdk remote update\`, \`hb-sdk remote access\`, \`hb-sdk remote list\`, \`hb-sdk remote versions\`, \`hb-sdk remote preview <version>\`, and \`hb-sdk remote allowlist ...\` instead of sending users to Open when a matching CLI command exists.
|
|
421
|
+
- Treat \`hb-sdk remote list\` as discovery only. Dangerous write commands still target the bound mini-program from \`package.json.heybox.miniProgramId\`.
|
|
422
|
+
- Require confirmation or \`--yes\` for \`hb-sdk remote release\`, \`hb-sdk remote withdraw\`, \`hb-sdk remote take-down\`, and \`hb-sdk remote reopen\`.
|
|
423
|
+
- Use \`--json\` for script consumption and keep stdout as exactly one JSON object.
|
|
424
|
+
|
|
347
425
|
## CLI login cache
|
|
348
426
|
|
|
349
427
|
${cliLoginSection}
|
|
@@ -351,6 +429,7 @@ ${cliLoginSection}
|
|
|
351
429
|
Agent rules:
|
|
352
430
|
|
|
353
431
|
- Keep CLI auth cache separate from iframe SDK login state.
|
|
432
|
+
- Keep \`selectedEntity\` guidance explicit: it is only a hint snapshot, while every remote command uses the server-side current entity.
|
|
354
433
|
- It is correct to say status output is redacted.
|
|
355
434
|
- Do not expose or template pkey, cookie, token, or private credential values.
|
|
356
435
|
- Use \`hb-sdk login clear\` only to clear the \`hb-sdk\` CLI namespace.
|
package/skill/skill.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hb-sdk",
|
|
3
|
-
"skillVersion": "0.4.
|
|
3
|
+
"skillVersion": "0.4.6+skill.1c7149a95a0b",
|
|
4
4
|
"sdk": {
|
|
5
5
|
"package": "@heybox/hb-sdk",
|
|
6
|
-
"version": "0.4.
|
|
7
|
-
"compatibility": "0.4.
|
|
6
|
+
"version": "0.4.6",
|
|
7
|
+
"compatibility": "0.4.6"
|
|
8
8
|
},
|
|
9
9
|
"source": "https://open.xiaoheihe.cn/agent-skills/hb-sdk",
|
|
10
|
-
"integrity": "sha256-
|
|
10
|
+
"integrity": "sha256-1c7149a95a0b5d0ffeaa479456186dab5f3bc06865fd5c28a975682381267811"
|
|
11
11
|
}
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
export declare const MINIAPP_UPLOAD_SCOPE = "activity";
|
|
2
2
|
export declare const ACTIVITY_UPLOAD_KEY_MAX_LENGTH = 64;
|
|
3
|
+
export declare const USER_MINIPROGRAM_ACCESS_STATUS_API_PATH = "/mall/developer/user_miniprogram/access_status";
|
|
4
|
+
export declare const DEVELOPER_ENTITY_LIST_API_PATH = "/mall/developer/entity/list";
|
|
5
|
+
export declare const DEVELOPER_ENTITY_SWITCH_API_PATH = "/mall/developer/entity/switch";
|
|
6
|
+
export declare const LIST_USER_MINIPROGRAM_API_PATH = "/mall/developer/user_miniprogram/list";
|
|
7
|
+
export declare const CREATE_USER_MINIPROGRAM_API_PATH = "/mall/developer/user_miniprogram/create";
|
|
8
|
+
export declare const UPDATE_USER_MINIPROGRAM_API_PATH = "/mall/developer/user_miniprogram/update";
|
|
9
|
+
export declare const DETAIL_USER_MINIPROGRAM_API_PATH = "/mall/developer/user_miniprogram/detail";
|
|
10
|
+
export declare const USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH = "/mall/developer/user_miniprogram/preview_allowlist";
|
|
11
|
+
export declare const UPDATE_USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH = "/mall/developer/user_miniprogram/preview_allowlist/update";
|
|
3
12
|
export declare const PRECHECK_USER_MINIPROGRAM_VERSION_API_PATH = "/mall/developer/user_miniprogram/version/precheck";
|
|
4
13
|
export declare const SUBMIT_USER_MINIPROGRAM_AUDIT_API_PATH = "/mall/developer/user_miniprogram/version/submit_audit";
|
|
14
|
+
export declare const USER_MINIPROGRAM_VERSION_PREVIEW_INFO_API_PATH = "/mall/developer/user_miniprogram/version/preview_info";
|
|
15
|
+
export declare const WITHDRAW_USER_MINIPROGRAM_VERSION_API_PATH = "/mall/developer/user_miniprogram/version/withdraw";
|
|
16
|
+
export declare const RELEASE_USER_MINIPROGRAM_VERSION_API_PATH = "/mall/developer/user_miniprogram/version/release";
|
|
17
|
+
export declare const TAKE_DOWN_USER_MINIPROGRAM_API_PATH = "/mall/developer/user_miniprogram/take_down";
|
|
18
|
+
export declare const REOPEN_USER_MINIPROGRAM_API_PATH = "/mall/developer/user_miniprogram/reopen";
|
|
19
|
+
export declare const LIST_USER_MINIPROGRAM_VERSION_API_PATH = "/mall/developer/user_miniprogram/version/list";
|
|
5
20
|
export { isValidMiniappManifestVersion as isValidVersion } from '../miniapp-manifest/schema';
|
|
6
21
|
export declare function normalizeRelativePath(relativePath: string): string;
|
|
7
22
|
export declare function relativePathContainsNodeModulesSegment(relativePath: string): boolean;
|