@heybox/hb-sdk 0.6.4 → 0.6.5
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/dist/cli-chunks/{context-BEgbP7mM.cjs → context-DjepdCaa.cjs} +1 -1
- package/dist/cli-chunks/{create-BHsWWo3V.cjs → create-D3BBKay9.cjs} +1 -1
- package/dist/cli-chunks/{dev-CSjs2OYB.cjs → dev-C3u5FXIy.cjs} +4 -4
- package/dist/cli-chunks/{doctor-B3AOQgyN.cjs → doctor-DEgZa2qC.cjs} +1 -1
- package/dist/cli-chunks/{index-BGFf6g7V.cjs → index-B5gEl9ow.cjs} +2 -2
- package/dist/cli-chunks/{index-B0zGksOA.cjs → index-CKat0ExC.cjs} +13 -13
- package/dist/cli-chunks/{login-ClQuL2r6.cjs → login-B6gERpSX.cjs} +2 -2
- package/dist/cli-chunks/{remote-ib5THDbw.cjs → remote-BfQiZzeJ.cjs} +4 -4
- package/dist/cli-chunks/{session-D7nmqMiy.cjs → session-DPEq__gB.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/templates/vue3-vite-ts/README.md.ejs +4 -8
- package/dist/vite.cjs.js +1 -1
- package/dist/vite.esm.js +1 -1
- package/package.json +1 -1
- package/skill/SKILL.md +33 -47
- package/skill/references/api-root.md +1 -1
- package/skill/references/cli.md +66 -237
- package/skill/references/recipes.md +20 -28
- package/skill/scripts/sync-references.mjs +33 -53
- package/skill/skill.json +4 -4
|
@@ -5,7 +5,7 @@ var fs = require('node:fs/promises');
|
|
|
5
5
|
var path = require('node:path');
|
|
6
6
|
var require$$0 = require('fs');
|
|
7
7
|
var require$$1 = require('path');
|
|
8
|
-
var index = require('./index-
|
|
8
|
+
var index = require('./index-CKat0ExC.cjs');
|
|
9
9
|
require('node:module');
|
|
10
10
|
require('os');
|
|
11
11
|
require('readline');
|
|
@@ -9,8 +9,8 @@ var node_url = require('node:url');
|
|
|
9
9
|
var net = require('node:net');
|
|
10
10
|
var node_http = require('node:http');
|
|
11
11
|
var browser = require('./browser-RAy8e8cV.cjs');
|
|
12
|
-
var index = require('./index-
|
|
13
|
-
var context = require('./context-
|
|
12
|
+
var index = require('./index-CKat0ExC.cjs');
|
|
13
|
+
var context = require('./context-DjepdCaa.cjs');
|
|
14
14
|
require('node:process');
|
|
15
15
|
require('node:buffer');
|
|
16
16
|
require('node:util');
|
|
@@ -24,7 +24,7 @@ require('events');
|
|
|
24
24
|
require('stream');
|
|
25
25
|
require('buffer');
|
|
26
26
|
require('util');
|
|
27
|
-
require('./session-
|
|
27
|
+
require('./session-DPEq__gB.cjs');
|
|
28
28
|
require('node:crypto');
|
|
29
29
|
require('fs');
|
|
30
30
|
require('constants');
|
|
@@ -670,7 +670,7 @@ function createHeyboxProtocol(payload) {
|
|
|
670
670
|
/** 构建时替换为当前发布包的实际版本。 */
|
|
671
671
|
const HB_SDK_VERSION = typeof undefined === 'string'
|
|
672
672
|
? undefined
|
|
673
|
-
: '0.6.
|
|
673
|
+
: '0.6.5';
|
|
674
674
|
|
|
675
675
|
const DEFAULT_APP_PORT = 5173;
|
|
676
676
|
const DEFAULT_MOCK_PORT = 5174;
|
|
@@ -4,7 +4,7 @@ var fs$1 = require('node:fs');
|
|
|
4
4
|
var fs = require('node:fs/promises');
|
|
5
5
|
var os = require('node:os');
|
|
6
6
|
var path = require('node:path');
|
|
7
|
-
var index = require('./index-
|
|
7
|
+
var index = require('./index-CKat0ExC.cjs');
|
|
8
8
|
require('node:module');
|
|
9
9
|
require('path');
|
|
10
10
|
require('os');
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index$2 = require('./index-
|
|
3
|
+
var index$2 = require('./index-CKat0ExC.cjs');
|
|
4
4
|
var require$$0$2 = require('fs');
|
|
5
5
|
var require$$2$1 = require('crypto');
|
|
6
6
|
var require$$1$2 = require('path');
|
|
7
7
|
var require$$0$3 = require('assert');
|
|
8
8
|
var require$$4$2 = require('events');
|
|
9
9
|
var require$$1$1 = require('util');
|
|
10
|
-
var context$1 = require('./context-
|
|
10
|
+
var context$1 = require('./context-DjepdCaa.cjs');
|
|
11
11
|
var require$$0$5 = require('net');
|
|
12
12
|
var require$$0$4 = require('url');
|
|
13
13
|
var require$$2$2 = require('http');
|
|
@@ -234,19 +234,19 @@ function requireArgument () {
|
|
|
234
234
|
|
|
235
235
|
var command = {};
|
|
236
236
|
|
|
237
|
-
const require$5 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
237
|
+
const require$5 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-CKat0ExC.cjs', document.baseURI).href)));
|
|
238
238
|
function __require$4() { return require$5("node:events"); }
|
|
239
239
|
|
|
240
|
-
const require$4 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
240
|
+
const require$4 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-CKat0ExC.cjs', document.baseURI).href)));
|
|
241
241
|
function __require$3() { return require$4("node:child_process"); }
|
|
242
242
|
|
|
243
|
-
const require$3 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
243
|
+
const require$3 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-CKat0ExC.cjs', document.baseURI).href)));
|
|
244
244
|
function __require$2() { return require$3("node:path"); }
|
|
245
245
|
|
|
246
|
-
const require$2 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
246
|
+
const require$2 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-CKat0ExC.cjs', document.baseURI).href)));
|
|
247
247
|
function __require$1() { return require$2("node:fs"); }
|
|
248
248
|
|
|
249
|
-
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
249
|
+
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-CKat0ExC.cjs', document.baseURI).href)));
|
|
250
250
|
function __require() { return require$1("node:process"); }
|
|
251
251
|
|
|
252
252
|
var help = {};
|
|
@@ -13347,7 +13347,7 @@ function getPathname(pathWithQuery) {
|
|
|
13347
13347
|
}
|
|
13348
13348
|
|
|
13349
13349
|
const CLI_VERSION_PLACEHOLDER = ['__HB', 'SDK', 'CLI', 'VERSION__'].join('_');
|
|
13350
|
-
const BUILT_CLI_VERSION = '0.6.
|
|
13350
|
+
const BUILT_CLI_VERSION = '0.6.5';
|
|
13351
13351
|
const PACKAGE_JSON_CANDIDATES = [
|
|
13352
13352
|
path.resolve(__dirname, '..', '..', 'package.json'),
|
|
13353
13353
|
path.resolve(__dirname, '..', 'package.json'),
|
|
@@ -13668,31 +13668,31 @@ function createCommandLoggerResolver(options) {
|
|
|
13668
13668
|
};
|
|
13669
13669
|
}
|
|
13670
13670
|
const defaultClearLoginStatus = async (...args) => {
|
|
13671
|
-
const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-
|
|
13671
|
+
const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-B6gERpSX.cjs'); });
|
|
13672
13672
|
return clearLoginStatus(...args);
|
|
13673
13673
|
};
|
|
13674
13674
|
const defaultLoginToHeybox = async (...args) => {
|
|
13675
|
-
const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-
|
|
13675
|
+
const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-B6gERpSX.cjs'); });
|
|
13676
13676
|
return loginToHeybox(...args);
|
|
13677
13677
|
};
|
|
13678
13678
|
const defaultPrintLoginStatus = async (...args) => {
|
|
13679
|
-
const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-
|
|
13679
|
+
const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-B6gERpSX.cjs'); });
|
|
13680
13680
|
return printLoginStatus(...args);
|
|
13681
13681
|
};
|
|
13682
13682
|
const defaultRunCreateCommand = async (...args) => {
|
|
13683
|
-
const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-
|
|
13683
|
+
const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-D3BBKay9.cjs'); });
|
|
13684
13684
|
return runCreateCommand(...args);
|
|
13685
13685
|
};
|
|
13686
13686
|
const defaultRunDevCommand = async (...args) => {
|
|
13687
|
-
const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-
|
|
13687
|
+
const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-C3u5FXIy.cjs'); });
|
|
13688
13688
|
return runDevCommand(...args);
|
|
13689
13689
|
};
|
|
13690
13690
|
const defaultRunDoctorCommand = async (...args) => {
|
|
13691
|
-
const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-
|
|
13691
|
+
const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-DEgZa2qC.cjs'); });
|
|
13692
13692
|
return runDoctorCommand(...args);
|
|
13693
13693
|
};
|
|
13694
13694
|
const defaultRunRemoteCommand = async (...args) => {
|
|
13695
|
-
const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-
|
|
13695
|
+
const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-BfQiZzeJ.cjs'); });
|
|
13696
13696
|
return runRemoteCommand(...args);
|
|
13697
13697
|
};
|
|
13698
13698
|
function resolveStandaloneLogger(options, verbose) {
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
var promises = require('node:readline/promises');
|
|
4
4
|
var node_crypto = require('node:crypto');
|
|
5
5
|
var node_http = require('node:http');
|
|
6
|
-
var session = require('./session-
|
|
6
|
+
var session = require('./session-DPEq__gB.cjs');
|
|
7
7
|
var browser = require('./browser-RAy8e8cV.cjs');
|
|
8
|
-
var index = require('./index-
|
|
8
|
+
var index = require('./index-CKat0ExC.cjs');
|
|
9
9
|
require('node:path');
|
|
10
10
|
require('fs');
|
|
11
11
|
require('constants');
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var promises = require('node:readline/promises');
|
|
4
|
-
var index = require('./index-
|
|
5
|
-
var session = require('./session-
|
|
4
|
+
var index = require('./index-CKat0ExC.cjs');
|
|
5
|
+
var session = require('./session-DPEq__gB.cjs');
|
|
6
6
|
var childProcess = require('node:child_process');
|
|
7
7
|
var fs = require('node:fs');
|
|
8
8
|
var fs$1 = require('node:fs/promises');
|
|
9
9
|
var path = require('node:path');
|
|
10
|
-
var context = require('./context-
|
|
10
|
+
var context = require('./context-DjepdCaa.cjs');
|
|
11
11
|
require('node:module');
|
|
12
12
|
require('path');
|
|
13
13
|
require('os');
|
|
@@ -264,7 +264,7 @@ async function createDefaultCosClient(uploadToken) {
|
|
|
264
264
|
};
|
|
265
265
|
}
|
|
266
266
|
async function loadCosConstructor() {
|
|
267
|
-
const cosModule = await Promise.resolve().then(function () { return require('./index-
|
|
267
|
+
const cosModule = await Promise.resolve().then(function () { return require('./index-B5gEl9ow.cjs'); }).then(function (n) { return n.index; });
|
|
268
268
|
return cosModule.default;
|
|
269
269
|
}
|
|
270
270
|
function formatSize(bytes) {
|
package/dist/cli.cjs
CHANGED
package/dist/index.cjs.js
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# <%= projectName %>
|
|
2
2
|
|
|
3
|
-
这是通过 `hb-sdk create`
|
|
3
|
+
这是通过 `hb-sdk create` 生成的小黑盒工坊小程序模板。项目使用 Vue 3、Vite、TypeScript 和 `@heybox/hb-sdk`。
|
|
4
4
|
|
|
5
5
|
## 使用命令
|
|
6
6
|
|
|
@@ -19,9 +19,9 @@ npm run deploy
|
|
|
19
19
|
|
|
20
20
|
## 开发模式
|
|
21
21
|
|
|
22
|
-
- `npm run dev
|
|
22
|
+
- `npm run dev`:打开本地调试页,可以使用浏览器 Mock,也可以在 Mac 版 APP 或手机小黑盒 APP 中验收。手机和电脑需要处于同一局域网。
|
|
23
23
|
- `npm run build`:先执行 TypeScript 检查,再构建生产产物。
|
|
24
|
-
- `npm run deploy -- --release-note "..."
|
|
24
|
+
- `npm run deploy -- --release-note "..."`:检查、构建、上传并提交审核。首次提交前先运行 `npx hb-sdk login`,再用 `npx hb-sdk remote create` 创建小程序,或用 `npx hb-sdk remote bind <mini-program-id>` 绑定已有小程序。审核通过后,用 `hb-sdk remote release <version>` 发布。
|
|
25
25
|
|
|
26
26
|
## 更多能力
|
|
27
27
|
|
|
@@ -40,10 +40,6 @@ await hbSDK.storage.setStorage({
|
|
|
40
40
|
data: { theme: 'dark' },
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
const response = await hbSDK.network.request({
|
|
44
|
-
method: 'GET',
|
|
45
|
-
url: 'https://jsonplaceholder.typicode.com/todos/1',
|
|
46
|
-
});
|
|
47
43
|
```
|
|
48
44
|
|
|
49
|
-
|
|
45
|
+
工坊小程序默认不能进行网络请求,网络权限暂未开放申请。
|
package/dist/vite.cjs.js
CHANGED
package/dist/vite.esm.js
CHANGED
package/package.json
CHANGED
package/skill/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: hb-sdk
|
|
3
|
-
description: Uses @heybox/hb-sdk and its hb-sdk CLI
|
|
3
|
+
description: Uses @heybox/hb-sdk and its hb-sdk CLI to build, debug, review, and publish workshop mini-programs for the Heybox App. Use for public SDK APIs, lifecycle events, hb-sdk create/dev/login/doctor, browser Mock and device debugging, or publishing checks. Don't use for private credentials, internal Heybox client protocols, private package paths, or non-Heybox SDKs.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# hb-sdk Agent Procedure
|
|
@@ -9,19 +9,19 @@ Apply these instructions when writing, reviewing, or debugging code that consume
|
|
|
9
9
|
|
|
10
10
|
## Step 1: Classify the task
|
|
11
11
|
|
|
12
|
-
1. If the task is
|
|
12
|
+
1. If the task is workshop mini-program business code, use the root package import path `@heybox/hb-sdk`.
|
|
13
13
|
2. If the task is parent-container runtime, bridge-server, protocol contract, or `@heybox/hb-sdk-runtime` work, use `@heybox/hb-sdk/protocol` only for shared constants and types.
|
|
14
|
-
3. If the task is project scaffolding, local
|
|
14
|
+
3. If the task is project scaffolding, local startup, browser Mock, device debugging, CLI login, Agent Skill diagnosis, or CLI troubleshooting, use the `hb-sdk` CLI workflow.
|
|
15
15
|
4. If the task is reviewing a mini-program for submission, listing, audit, publishing, content compliance, data/privacy compliance, runtime quality, or icon/cover design requirements, use the online publishing rules workflow.
|
|
16
16
|
5. If the task asks for direct login-state extraction, cookies, tokens, raw Heybox client protocols, or internal hb-sdk package paths, refuse that approach and use the public SDK or CLI boundary instead.
|
|
17
|
-
6. If the task is not about Heybox
|
|
17
|
+
6. If the task is not about Heybox workshop mini-program SDK usage, CLI usage, protocol contracts, or listing/audit/compliance review, do not apply this skill.
|
|
18
18
|
|
|
19
19
|
## Step 2: Load only the needed reference
|
|
20
20
|
|
|
21
21
|
1. For root SDK imports, singleton usage, modules, and errors, read `references/api-root.md`.
|
|
22
|
-
2. For host/runtime protocol contracts only, read `references/api-protocol.md`. Do not use this reference
|
|
22
|
+
2. For host/runtime protocol contracts only, read `references/api-protocol.md`. Do not use this reference for mini-program business code.
|
|
23
23
|
3. For common business flows, read `references/recipes.md`.
|
|
24
|
-
4. For CLI commands, local
|
|
24
|
+
4. For CLI commands, local debugging, device debugging, CLI login, Agent Skill doctor, and update reminders, read `references/cli.md`.
|
|
25
25
|
5. For allowed/forbidden capabilities and security boundaries, read `references/safety-boundaries.md`.
|
|
26
26
|
6. For Vite build manifest behavior, read `references/api-root.md` and `references/safety-boundaries.md`.
|
|
27
27
|
7. For generated documentation provenance and deeper API lookup paths, read `references/llms-index.md`.
|
|
@@ -36,71 +36,57 @@ Apply these instructions when writing, reviewing, or debugging code that consume
|
|
|
36
36
|
3. Never import from internal hb-sdk implementation paths; only use the documented package entrypoints.
|
|
37
37
|
4. Prefer named imports for focused code and the default `hbSDK` singleton for compact page-level examples.
|
|
38
38
|
|
|
39
|
-
## Step 4: Implement
|
|
39
|
+
## Step 4: Implement workshop mini-program code
|
|
40
40
|
|
|
41
41
|
1. Call `await ready()` or `await hbSDK.ready()` near page startup when the page uses SDK capabilities.
|
|
42
42
|
2. Use `user.getInfo()` to read current login state without triggering login.
|
|
43
43
|
3. Use `auth.login()` only when the user action requires login.
|
|
44
|
-
4. Handle `HbMiniProgramSDKError` for
|
|
44
|
+
4. Handle `HbMiniProgramSDKError` for SDK initialization and capability failures.
|
|
45
45
|
5. Handle `HbMiniProgramNetworkError` separately when HTTP completed but `validateStatus` rejected the status.
|
|
46
46
|
6. Cancel lifecycle/event subscriptions returned by `on()` when the page or component unmounts.
|
|
47
|
-
7.
|
|
47
|
+
7. Use the default SDK instance exposed by the root package.
|
|
48
48
|
|
|
49
49
|
## Step 5: Use CLI workflows
|
|
50
50
|
|
|
51
|
-
1. Use `hb-sdk create <project-name>` to scaffold a
|
|
52
|
-
2. Use `hb-sdk dev` for
|
|
53
|
-
3. Use
|
|
54
|
-
4. Use `hb-sdk
|
|
55
|
-
5. Use `hb-sdk remote
|
|
56
|
-
6. Use `hb-sdk remote
|
|
57
|
-
7. Use `hb-sdk remote
|
|
58
|
-
8. Use `hb-sdk remote deploy --
|
|
59
|
-
9.
|
|
60
|
-
10.
|
|
61
|
-
11.
|
|
62
|
-
12.
|
|
63
|
-
13.
|
|
64
|
-
14.
|
|
65
|
-
15. Use `--json` for script consumption of `hb-sdk remote` commands. With `--json`, stdout must contain exactly one JSON object; progress, warnings, update reminders, and verbose diagnostics must not pollute stdout.
|
|
66
|
-
16. Do not expect custom base URLs to affect `hb-sdk doctor`, npm latest checks, or mock-host `network.request()`.
|
|
67
|
-
17. Use the Mock runtime host's "在 Mac 版 APP 中启动" button for Mac App debugging, or the "Mobile App" QR code after selecting a LAN interface for phone App debugging; these entrypoints remain available in anonymous mode. The phone must be on the same LAN and use a Heybox App version that supports the mini-program dev shell.
|
|
68
|
-
18. Use `--port`, `--mock-port`, and `--no-open` when the default Vite/mock ports or browser opening behavior need to be controlled.
|
|
69
|
-
19. Use `hb-sdk login`, `hb-sdk login status`, and `hb-sdk login clear` only for the CLI's own Heybox auth cache. Keep `hb-sdk login` top-level; it is not a remote mini-program command.
|
|
70
|
-
20. Treat `selectedEntity` in the CLI auth cache as a non-authoritative hint snapshot only. Every remote command must use the server-side current entity as the source of truth.
|
|
71
|
-
21. Use `hb-sdk doctor` to diagnose whether the local `hb-sdk` skill matches the installed SDK and remote latest skill metadata.
|
|
72
|
-
22. Do not use `hb-sdk doctor` to auto-install skills; when installation or refresh is needed, tell the user to run `npx skills add https://open.xiaoheihe.cn/agent-skills/hb-sdk`.
|
|
73
|
-
23. If doctor reports `SDK_MISMATCH`, upgrade `@heybox/hb-sdk@latest` before reinstalling the skill.
|
|
74
|
-
24. Do not treat CLI login cache as iframe SDK login state; it does not change `auth.login()`, `user.getInfo()`, `network.request()`, or mock-user behavior.
|
|
75
|
-
25. Keep the CLI and mock runtime under `@heybox/hb-sdk`; do not create or revive a separate mock runtime package.
|
|
76
|
-
26. Do not pass `mini_program_id` or `entity_id` as general CLI flags or environment variables; the mini-program id must come from `package.json.heybox.miniProgramId`, and the entity must come from the server-side current entity.
|
|
77
|
-
27. Do not import deploy / upload internals from outside the CLI; the only externally consumable subpath for publish-pipeline helpers is `@heybox/hb-sdk/miniapp-publish`.
|
|
51
|
+
1. Use `hb-sdk create <project-name>` to scaffold a workshop mini-program.
|
|
52
|
+
2. Use `hb-sdk dev` for browser, Mac App, or mobile App debugging. These entries remain available without CLI login or project binding, but managed capabilities are denied by default.
|
|
53
|
+
3. Use `--port`, `--mock-port`, and `--no-open` when the default local ports or browser opening behavior need to be controlled.
|
|
54
|
+
4. Use `hb-sdk login`, `hb-sdk login status`, and `hb-sdk login clear` only for development and publishing commands. This login does not change the mini-program user's login state.
|
|
55
|
+
5. Use `hb-sdk remote entity current` to confirm the current developer account and `hb-sdk remote entity switch <entity-id>` to change it before remote operations.
|
|
56
|
+
6. Use `hb-sdk remote create` to create and bind a mini-program; use `hb-sdk remote bind <mini-program-id>` to bind an existing manageable mini-program.
|
|
57
|
+
7. Use `hb-sdk remote info`, `hb-sdk remote list`, `hb-sdk remote access`, `hb-sdk remote versions`, `hb-sdk remote preview <version>`, and `hb-sdk remote allowlist ...` for remote inspection and preview management.
|
|
58
|
+
8. Use `hb-sdk remote deploy --release-note <text>` to check, build, upload, and submit the current project for audit. Do not recommend the removed top-level `hb-sdk deploy` alias.
|
|
59
|
+
9. After approval, use `hb-sdk remote release <version>` for manual release or `--auto-publish` when an eligible low-risk version should release automatically.
|
|
60
|
+
10. Treat approval, release, and public display as separate states. Do not promise square, search, or recommendation visibility after release.
|
|
61
|
+
11. Use `hb-sdk remote withdraw`, `hb-sdk remote take-down`, `hb-sdk remote reopen`, and square visibility commands only after showing the target and obtaining required confirmation.
|
|
62
|
+
12. Use `--json` for script consumption and `--verbose` only when concise output is insufficient for diagnosis.
|
|
63
|
+
13. Use `hb-sdk doctor` to diagnose whether the local Skill matches the installed SDK; follow its output to install or refresh the Skill.
|
|
64
|
+
14. Do not print or expose cookies, tokens, private headers, or other credentials.
|
|
78
65
|
|
|
79
66
|
## Step 6: Preserve capability boundaries
|
|
80
67
|
|
|
81
|
-
For
|
|
68
|
+
For workshop mini-program business code:
|
|
82
69
|
|
|
83
70
|
1. Do not read or request tokens, cookies, phone numbers, or private credentials from the SDK.
|
|
84
71
|
2. Do not expose raw share protocol fields, JS callbacks, activity reporting, custom buttons, post publishing, or upload-only flows.
|
|
85
72
|
3. Do not use unsupported storage operations such as delete, clear, info listing, or global client storage access.
|
|
86
|
-
4.
|
|
87
|
-
5. Do not
|
|
73
|
+
4. Use only the public `network.request` configuration.
|
|
74
|
+
5. Do not use private package paths or client protocols.
|
|
88
75
|
6. Build artifacts may include `dist/manifest.json`; business code should not fetch a deployed manifest directly because it is not a CDN asset.
|
|
89
76
|
|
|
90
77
|
For CLI and local development:
|
|
91
78
|
|
|
92
79
|
1. Do not print, persist in templates, or pass through pkey, cookies, tokens, or private credentials.
|
|
93
|
-
2. Do not use `hb-sdk login` as a workaround for
|
|
94
|
-
3.
|
|
95
|
-
4. Keep the Vite `miniappManifest()` plugin enabled
|
|
96
|
-
5.
|
|
97
|
-
6. Treat remote dev context as optional diagnostics and initialization data. Do not use a public mini-program detail request as a dev startup gate.
|
|
80
|
+
2. Do not use `hb-sdk login` as a workaround for mini-program user authentication.
|
|
81
|
+
3. Use the built-in local debugging page instead of creating another browser Mock.
|
|
82
|
+
4. Keep the Vite `miniappManifest()` plugin enabled.
|
|
83
|
+
5. Treat browser Mock settings as local-only; they must not be presented as online permissions.
|
|
98
84
|
|
|
99
85
|
For host/runtime/protocol-maintenance code:
|
|
100
86
|
|
|
101
87
|
1. Use `@heybox/hb-sdk/protocol` for shared constants and type contracts.
|
|
102
|
-
2. Keep raw protocol details inside the host/runtime boundary; do not leak them into app-facing SDK examples or
|
|
103
|
-
3.
|
|
88
|
+
2. Keep raw protocol details inside the host/runtime boundary; do not leak them into app-facing SDK examples or workshop mini-program business code.
|
|
89
|
+
3. Preserve compatibility with existing SDK clients.
|
|
104
90
|
|
|
105
91
|
## Step 7: Validate changes
|
|
106
92
|
|
|
@@ -111,7 +97,7 @@ For host/runtime/protocol-maintenance code:
|
|
|
111
97
|
3. When preparing a package release, run `pnpm --filter @heybox/hb-sdk run release:prepare -- --bump patch` or `pnpm --filter @heybox/hb-sdk run release:prepare -- --version <x.y.z>`. The release assistant updates both package versions, inserts `packages/hb-sdk/CHANGELOG.md`, and runs `check:changelog`. Use `--ai-command "<command>"` or `HB_SDK_CHANGELOG_AI_COMMAND` when an AI writer should rewrite the Conventional Commit draft. Review the entry for Mini-program developers and Host/Runtime integration maintainers, and do not expose Runtime internal adapter, state-machine, or security-policy details.
|
|
112
98
|
4. When modifying this repo's source skill at `packages/hb-sdk/skill` and preparing distributable artifacts, also run:
|
|
113
99
|
- `node packages/hb-sdk/skill/scripts/package-skill.mjs`
|
|
114
|
-
5. When modifying CLI,
|
|
100
|
+
5. When modifying CLI, local debugging, package exports, or package dependency direction, also run:
|
|
115
101
|
- `pnpm --filter @heybox/hb-sdk run check:boundary`
|
|
116
102
|
- `pnpm --filter @heybox/hb-sdk run test:unit`
|
|
117
103
|
6. Inspect the generated zip before distribution:
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
## Package metadata
|
|
20
20
|
|
|
21
21
|
- Package: `@heybox/hb-sdk`
|
|
22
|
-
- Version at generation time: `0.6.
|
|
22
|
+
- Version at generation time: `0.6.5`
|
|
23
23
|
- Public root export: `@heybox/hb-sdk`
|
|
24
24
|
- Protocol export: `@heybox/hb-sdk/protocol`
|
|
25
25
|
- Vite plugin export: `@heybox/hb-sdk/vite`
|