@heybox/hb-sdk 0.6.6-alpha.1 → 0.6.6-alpha.3

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.
Files changed (34) hide show
  1. package/README.md +41 -6
  2. package/dist/cli-chunks/build-De-QADpA.cjs +137 -0
  3. package/dist/cli-chunks/context-CvZs9ZBf.cjs +311 -0
  4. package/dist/cli-chunks/{create-DlU4nWz_.cjs → create-B5gGBaSV.cjs} +1 -1
  5. package/dist/cli-chunks/{dev-Bb4U965a.cjs → dev-BcCWCeac.cjs} +11 -42
  6. package/dist/cli-chunks/{doctor-DwDqOLdV.cjs → doctor-BhBM4cWH.cjs} +1 -1
  7. package/dist/cli-chunks/{context-D-cb_pNY.cjs → index-BQm5XmMC.cjs} +19 -308
  8. package/dist/cli-chunks/{index-B6gnwx39.cjs → index-DyUo67lf.cjs} +3 -3
  9. package/dist/cli-chunks/{index-gP0K2xx1.cjs → index-QAkYgxPI.cjs} +32 -16
  10. package/dist/cli-chunks/{login-BFIcNgmi.cjs → login-BNLH13Zd.cjs} +2 -2
  11. package/dist/cli-chunks/project-vite-VcJMyz1l.cjs +45 -0
  12. package/dist/cli-chunks/remote-BE53wntR.cjs +1504 -0
  13. package/dist/cli-chunks/{remote-YESvKni6.cjs → runtime-gate-B2MQf1vc.cjs} +7 -1501
  14. package/dist/cli-chunks/{session-BRwveiW8.cjs → session-YJ8xNESM.cjs} +1 -1
  15. package/dist/cli.cjs +1 -1
  16. package/dist/devtools/mock-host/main.js +149 -3
  17. package/dist/index.cjs.js +1 -1
  18. package/dist/index.esm.js +1 -1
  19. package/dist/templates/vue3-vite-ts/README.md.ejs +2 -2
  20. package/dist/templates/vue3-vite-ts/package.json.ejs +1 -1
  21. package/dist/vite.cjs.js +1 -1
  22. package/dist/vite.esm.js +1 -1
  23. package/package.json +1 -1
  24. package/skill/SKILL.md +19 -14
  25. package/skill/references/api-protocol.md +3 -2
  26. package/skill/references/api-root.md +20 -7
  27. package/skill/references/cli.md +33 -1
  28. package/skill/references/recipes.md +53 -0
  29. package/skill/references/safety-boundaries.md +1 -1
  30. package/skill/scripts/sync-references.mjs +23 -1
  31. package/skill/skill.json +4 -4
  32. package/types/index.d.ts +1 -1
  33. package/types/modules/share/types.d.ts +11 -0
  34. package/types/protocol.d.ts +1 -1
@@ -207,6 +207,7 @@ const authGuide = frontmatterless(read('apps/docs/hb-sdk/guide/auth.md'));
207
207
  const lifecycleGuide = frontmatterless(read('apps/docs/hb-sdk/guide/lifecycle.md'));
208
208
  const errorGuide = frontmatterless(read('apps/docs/hb-sdk/guide/error-handling.md'));
209
209
  const loginGate = frontmatterless(read('apps/docs/hb-sdk/recipes/login-gate.md'));
210
+ const communityShare = frontmatterless(read('apps/docs/hb-sdk/recipes/community-share.md'));
210
211
  const customInstance = frontmatterless(read('apps/docs/hb-sdk/recipes/custom-instance.md'));
211
212
  const referenceHome = frontmatterless(read('apps/docs/hb-sdk/reference/index.md'));
212
213
  const quickStartSection = extractSection(readme, '## 快速开始');
@@ -220,6 +221,7 @@ const manifestSection = extractSection(readme, '## Manifest');
220
221
  const cliSummarySection = extractSection(readme, '## CLI');
221
222
  const cliCreateSection = extractSection(cliGuide, '## 创建工坊小程序');
222
223
  const cliDevSection = extractSection(cliGuide, '## 推荐调试流程');
224
+ const cliBuildSection = extractSection(cliGuide, '## 生产构建');
223
225
  const cliDeploySection = extractSection(cliGuide, '## 部署发布');
224
226
  const cliRemoteSection = extractSection(cliGuide, '## 远端管理命令');
225
227
  const cliLoginSection = extractSection(cliGuide, '## CLI 登录态');
@@ -227,6 +229,7 @@ const cliDoctorSection = extractSection(cliGuide, '## Agent Skill doctor');
227
229
  const cliUpdateSection = extractSection(cliGuide, '## 版本提醒');
228
230
  const cliCommandSurface = `hb-sdk create <project-name>
229
231
  hb-sdk dev [--port <port>] [--mock-port <port>] [--no-open]
232
+ hb-sdk build [--env <name>] [--verbose]
230
233
  hb-sdk login
231
234
  hb-sdk login status
232
235
  hb-sdk login clear
@@ -344,6 +347,7 @@ files.set('cli.md', `${header('CLI reference', [
344
347
  'packages/hb-sdk/src/cli/index.ts',
345
348
  'packages/hb-sdk/src/cli/commands/create.ts',
346
349
  'packages/hb-sdk/src/cli/commands/dev.ts',
350
+ 'packages/hb-sdk/src/cli/commands/build.ts',
347
351
  'packages/hb-sdk/src/cli/commands/login.ts',
348
352
  'apps/docs/hb-sdk/guide/cli.md',
349
353
  ])}${contents([
@@ -351,6 +355,7 @@ files.set('cli.md', `${header('CLI reference', [
351
355
  ['Command surface', 'command-surface'],
352
356
  ['Create a mini-program template', 'create-a-mini-program-template'],
353
357
  ['Local debugging', 'local-debugging'],
358
+ ['Production build', 'production-build'],
354
359
  ['Deploy and publish', 'deploy-and-publish'],
355
360
  ['Developer account scope', 'developer-account-scope'],
356
361
  ['Remote management commands', 'remote-management-commands'],
@@ -386,6 +391,17 @@ ${cliDevSection}
386
391
 
387
392
  Use \`hb-sdk dev\` to open the local debugging page. The "在 Mac 版 APP 中启动" button opens the page in the Mac App; the "Mobile App" QR code opens it in the phone App after a LAN interface is selected. These entries remain available without CLI login or project binding, but managed capabilities are denied by default. The phone and computer must be on the same LAN. If an embedded browser cannot open the App, use the system browser.
388
393
 
394
+ ## Production build
395
+
396
+ ${cliBuildSection}
397
+
398
+ Agent rules:
399
+
400
+ - Use \`hb-sdk build [--env <name>] [--verbose]\` as the recommended production build entry.
401
+ - Require explicit \`miniappManifest()\` configuration and keep typechecking in the project's \`scripts.build\`.
402
+ - Do not claim \`hb-sdk build\` needs login, binding, or network access, and do not invent unsupported build flags.
403
+ - Existing \`vite build\` projects remain compatible and must not be auto-migrated.
404
+
389
405
  ## Deploy and publish
390
406
 
391
407
  ${rewriteBundledCliLinks(cliDeploySection)}
@@ -462,6 +478,7 @@ files.set('recipes.md', `${header('Recipes', [
462
478
  'apps/docs/hb-sdk/guide/lifecycle.md',
463
479
  'apps/docs/hb-sdk/guide/error-handling.md',
464
480
  'apps/docs/hb-sdk/recipes/login-gate.md',
481
+ 'apps/docs/hb-sdk/recipes/community-share.md',
465
482
  'apps/docs/hb-sdk/recipes/custom-instance.md',
466
483
  ])}${contents([
467
484
  ['Quick start', 'quick-start'],
@@ -469,6 +486,7 @@ files.set('recipes.md', `${header('Recipes', [
469
486
  ['Lifecycle events', 'lifecycle-events'],
470
487
  ['Error handling', 'error-handling'],
471
488
  ['Login gate recipe', 'login-gate-recipe'],
489
+ ['Community share recipe', 'community-share-recipe'],
472
490
  ['Custom instance recipe', 'custom-instance-recipe'],
473
491
  ])}## Quick start
474
492
 
@@ -490,6 +508,10 @@ ${rewriteBundledRecipeLinks(errorGuide)}
490
508
 
491
509
  ${rewriteBundledRecipeLinks(loginGate)}
492
510
 
511
+ ## Community share recipe
512
+
513
+ ${rewriteBundledRecipeLinks(communityShare)}
514
+
493
515
  ## Custom instance recipe
494
516
 
495
517
  ${rewriteBundledRecipeLinks(customInstance)}
@@ -506,7 +528,7 @@ ${capabilityBoundaries}
506
528
 
507
529
  - Do not instruct mini-program code to read, extract, forward, store, or depend on token, cookie, phone number, or private credentials.
508
530
  - Negative safety statements that explain the SDK does not expose token/cookie/private credentials are correct and should be preserved.
509
- - Do not use raw share protocol fields, JS callbacks, activity reporting, post publishing, custom buttons, or upload-only flows.
531
+ - Do not use raw share protocol fields, JS callbacks, activity reporting, direct post publishing, custom buttons, or upload-only flows. Public \`share.*({ post })\` options only preset an editable client post flow.
510
532
  - Do not use storage delete, clear, info listing, V2, or global Heybox client storage access.
511
533
  - Do not pass host-only protocol fields through \`network.request\`.
512
534
  - Do not build raw \`postMessage\` bridge flows in iframe business code.
package/skill/skill.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "hb-sdk",
3
- "skillVersion": "0.6.6-alpha.1+skill.2799351c9553",
3
+ "skillVersion": "0.6.6-alpha.3+skill.7940a3d57a8b",
4
4
  "sdk": {
5
5
  "package": "@heybox/hb-sdk",
6
- "version": "0.6.6-alpha.1",
7
- "compatibility": "0.6.6-alpha.1"
6
+ "version": "0.6.6-alpha.3",
7
+ "compatibility": "0.6.6-alpha.3"
8
8
  },
9
9
  "source": "https://open.xiaoheihe.cn/agent-skills/hb-sdk",
10
- "integrity": "sha256-2799351c9553f32af834bd0a53e6d016d647aafb275dff139ddd0dfaf2261321"
10
+ "integrity": "sha256-7940a3d57a8b57fb3045378c068cc875bea2def32d926fcef19e0accad67901b"
11
11
  }
package/types/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export type { MiniProgramEventHandler, MiniProgramEventName, MiniProgramEventPay
4
4
  export type { LoginPayload, LoginResult, MiniProgramAuthModule } from './modules/auth';
5
5
  export type { DeleteCurrentUserLeaderboardEntryPayload, DeleteCurrentUserLeaderboardEntryResult, GetCurrentUserLeaderboardEntryPayload, GetCurrentUserLeaderboardEntryResult, GetLeaderboardInfoPayload, GetLeaderboardInfoResult, GetLeaderboardListPayload, GetLeaderboardListResult, LeaderboardEntry, LeaderboardOrder, MiniProgramCloudLeaderboardModule, MiniProgramCloudModule, SubmitLeaderboardEntryPayload, SubmitLeaderboardEntryResult, } from './modules/cloud';
6
6
  export type { BasePlatformAccountInfo, CurrentUserAvatarConfig, CurrentUserAvatarDecoration, CurrentUserBbsInfo, CurrentUserDetail, CurrentUserLevelInfo, CurrentUserMedal, CurrentUserProfile, EpicPlatformAccountInfo, GetCurrentUserDetailPayload, GetCurrentUserDetailResult, GetCurrentUserProfilePayload, GetCurrentUserProfileResult, GetPlatformAccountInfoPayload, GetPlatformAccountInfoResult, GetPlatformAccountOverviewPayload, GetPlatformAccountOverviewResult, GetSteamGameListOptions, GetSteamGameListPayload, GetSteamGameListResult, GetUserInfoPayload, GetUserInfoResult, MiniProgramUserInfo, MiniProgramUserInfoResult, MiniProgramUserModule, MobilePlatformAccountInfo, PcHardwareAccountInfo, PlatformAccountInfoMap, PlatformAccountOverview, PlatformAccountResult, PlatformAccountType, PlatformStatItem, PsnPlatformAccountInfo, SteamGameListData, SteamGameListItem, SteamGameListSort, SteamGamePrice, SteamPlatformAccountInfo, SwitchPlatformAccountInfo, UserScopedResult, XboxPlatformAccountInfo, } from './modules/user';
7
- export type { MiniProgramScreenshotOptions, MiniProgramScreenshotRect, MiniProgramShareChannel, MiniProgramShareModule, MiniProgramShowShareMenuOptions, ScreenshotPayload, ScreenshotResult, ShowShareMenuPayload, ShowShareMenuResult, } from './modules/share';
7
+ export type { MiniProgramScreenshotOptions, MiniProgramScreenshotRect, MiniProgramShareChannel, MiniProgramShareModule, MiniProgramSharePostOptions, MiniProgramShowShareMenuOptions, ScreenshotPayload, ScreenshotResult, ShowShareMenuPayload, ShowShareMenuResult, } from './modules/share';
8
8
  export type { GetWindowInfoPayload, GetWindowInfoResult, MiniProgramNavigationBarForegroundStyle, MiniProgramSafeArea, MiniProgramSetNavigationBarStyleOptions, MiniProgramViewportModule, MiniProgramWindowInfoResult, SetNavigationBarStylePayload, SetNavigationBarStyleResult, } from './modules/viewport';
9
9
  export type { GetStoragePayload, GetStorageResult, MiniProgramStorageModule, SetStoragePayload, } from './modules/storage';
10
10
  export type { MiniProgramNetworkHeaders, MiniProgramNetworkModule, MiniProgramNetworkParams, MiniProgramNetworkRequestConfig, MiniProgramNetworkRequestMethod, MiniProgramNetworkResponse, MiniProgramNetworkValidateStatus, NetworkRequestPayload, NetworkResponsePayload, } from './modules/network';
@@ -5,6 +5,13 @@
5
5
  * 不同宿主环境可支持的渠道集合可能不同;未传 `channel` 时由客户端自行展示默认分享面板。
6
6
  */
7
7
  export type MiniProgramShareChannel = 'wechatSession' | 'wechatTimeline' | 'qqFriend' | 'qzone' | 'weibo';
8
+ /** 社区发帖预置配置。 */
9
+ export interface MiniProgramSharePostOptions {
10
+ /** 默认发布分区 ID;普通分享只使用第一项,截图分享支持多项。 */
11
+ topicIds?: (string | number)[];
12
+ /** 预置话题内容,不包含首尾 `#`。 */
13
+ topics?: string[];
14
+ }
8
15
  /**
9
16
  * 展示基础分享面板的配置。
10
17
  *
@@ -22,6 +29,8 @@ export interface MiniProgramShowShareMenuOptions {
22
29
  imageUrl?: string;
23
30
  /** 指定分享渠道;不传则由客户端展示默认分享面板。 */
24
31
  channel?: MiniProgramShareChannel;
32
+ /** 转发到社区时使用的分区与话题预置;`null` 等同于不配置。 */
33
+ post?: MiniProgramSharePostOptions | null;
25
34
  }
26
35
  /**
27
36
  * 截图区域。
@@ -52,4 +61,6 @@ export interface MiniProgramScreenshotOptions {
52
61
  delay?: number;
53
62
  /** 是否展示保存到相册能力。 */
54
63
  saveToAlbum?: boolean;
64
+ /** 转发到社区时使用的分区与话题预置;`null` 等同于不配置。 */
65
+ post?: MiniProgramSharePostOptions | null;
55
66
  }
@@ -10,7 +10,7 @@ export type { DeleteCurrentUserLeaderboardEntryPayload, DeleteCurrentUserLeaderb
10
10
  export type { GetCurrentUserDetailPayload, GetCurrentUserDetailResult, GetCurrentUserProfilePayload, GetCurrentUserProfileResult, GetPlatformAccountInfoPayload, GetPlatformAccountInfoResult, GetPlatformAccountOverviewPayload, GetPlatformAccountOverviewResult, GetSteamGameListOptions, GetSteamGameListPayload, GetSteamGameListResult, GetUserInfoPayload, GetUserInfoResult, MiniProgramUserInfo, MiniProgramUserInfoResult, SteamGameListData, SteamGameListItem, SteamGameListSort, SteamGamePrice, } from './modules/user';
11
11
  export type { ScreenshotPayload, ScreenshotResult } from './modules/share/screenshot';
12
12
  export type { ShowShareMenuPayload, ShowShareMenuResult } from './modules/share/show-share-menu';
13
- export type { MiniProgramScreenshotOptions, MiniProgramScreenshotRect, MiniProgramShareChannel, MiniProgramShowShareMenuOptions, } from './modules/share';
13
+ export type { MiniProgramScreenshotOptions, MiniProgramScreenshotRect, MiniProgramShareChannel, MiniProgramSharePostOptions, MiniProgramShowShareMenuOptions, } from './modules/share';
14
14
  export type { GetStoragePayload, GetStorageResult, SetStoragePayload } from './modules/storage';
15
15
  export type { GetWindowInfoPayload, GetWindowInfoResult, MiniProgramNavigationBarForegroundStyle, MiniProgramSafeArea, MiniProgramSetNavigationBarStyleOptions, MiniProgramWindowInfoResult, SetNavigationBarStylePayload, SetNavigationBarStyleResult, } from './modules/viewport';
16
16
  export type { MiniProgramNetworkHeaders, MiniProgramNetworkParams, MiniProgramNetworkRequestConfig, MiniProgramNetworkRequestMethod, MiniProgramNetworkResponse, MiniProgramNetworkValidateStatus, NetworkRequestPayload, NetworkResponsePayload, } from './modules/network';