snapshot-checker 0.8.3 → 0.8.7

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 (241) hide show
  1. package/README.md +185 -48
  2. package/dist/src/cli.d.ts +10 -1
  3. package/dist/src/cli.d.ts.map +1 -1
  4. package/dist/src/cli.js +78 -35
  5. package/dist/src/cli.js.map +1 -1
  6. package/dist/{commands → src/commands}/report-user.d.ts +1 -1
  7. package/dist/src/commands/report-user.d.ts.map +1 -0
  8. package/dist/{commands → src/commands}/report-user.js +2 -2
  9. package/dist/src/commands/report-user.js.map +1 -0
  10. package/dist/{commands → src/commands}/report.d.ts +1 -1
  11. package/dist/src/commands/report.d.ts.map +1 -0
  12. package/dist/{commands → src/commands}/report.js +2 -2
  13. package/dist/src/commands/report.js.map +1 -0
  14. package/dist/src/index.d.ts +3 -3
  15. package/dist/src/index.d.ts.map +1 -1
  16. package/dist/src/index.js +3 -3
  17. package/dist/src/index.js.map +1 -1
  18. package/dist/src/lib/cli/env.d.ts +9 -0
  19. package/dist/src/lib/cli/env.d.ts.map +1 -0
  20. package/dist/src/lib/cli/env.js +25 -0
  21. package/dist/src/lib/cli/env.js.map +1 -0
  22. package/dist/src/lib/cli/errors.d.ts +13 -0
  23. package/dist/src/lib/cli/errors.d.ts.map +1 -0
  24. package/dist/src/lib/cli/errors.js +23 -0
  25. package/dist/src/lib/cli/errors.js.map +1 -0
  26. package/dist/src/lib/cli/fatal.d.ts +2 -0
  27. package/dist/src/lib/cli/fatal.d.ts.map +1 -0
  28. package/dist/src/lib/cli/fatal.js +15 -0
  29. package/dist/src/lib/cli/fatal.js.map +1 -0
  30. package/dist/src/lib/cli/global_options.d.ts +4 -0
  31. package/dist/src/lib/cli/global_options.d.ts.map +1 -0
  32. package/dist/src/lib/cli/global_options.js +27 -0
  33. package/dist/src/lib/cli/global_options.js.map +1 -0
  34. package/dist/src/lib/cli/output.d.ts +26 -0
  35. package/dist/src/lib/cli/output.d.ts.map +1 -0
  36. package/dist/src/lib/cli/output.js +83 -0
  37. package/dist/src/lib/cli/output.js.map +1 -0
  38. package/dist/src/lib/cli/pkg_runtime.d.ts +2 -0
  39. package/dist/src/lib/cli/pkg_runtime.d.ts.map +1 -0
  40. package/dist/src/lib/cli/pkg_runtime.js +4 -0
  41. package/dist/src/lib/cli/pkg_runtime.js.map +1 -0
  42. package/dist/src/lib/cli/shell_identifiers.d.ts +24 -0
  43. package/dist/src/lib/cli/shell_identifiers.d.ts.map +1 -0
  44. package/dist/src/lib/cli/shell_identifiers.js +67 -0
  45. package/dist/src/lib/cli/shell_identifiers.js.map +1 -0
  46. package/dist/src/lib/cli/shell_params.d.ts +25 -0
  47. package/dist/src/lib/cli/shell_params.d.ts.map +1 -0
  48. package/dist/src/lib/cli/shell_params.js +61 -0
  49. package/dist/src/lib/cli/shell_params.js.map +1 -0
  50. package/dist/src/lib/cli/validation.d.ts +8 -0
  51. package/dist/src/lib/cli/validation.d.ts.map +1 -0
  52. package/dist/src/lib/cli/validation.js +44 -0
  53. package/dist/src/lib/cli/validation.js.map +1 -0
  54. package/dist/src/lib/{version.d.ts → cli/version.d.ts} +6 -2
  55. package/dist/src/lib/cli/version.d.ts.map +1 -0
  56. package/dist/src/lib/{version.js → cli/version.js} +25 -6
  57. package/dist/src/lib/cli/version.js.map +1 -0
  58. package/dist/src/lib/command_suite/globals.d.ts +8 -0
  59. package/dist/src/lib/command_suite/globals.d.ts.map +1 -0
  60. package/dist/src/lib/{scenario_globals.js → command_suite/globals.js} +4 -4
  61. package/dist/src/lib/command_suite/globals.js.map +1 -0
  62. package/dist/src/lib/command_suite/runner.d.ts +24 -0
  63. package/dist/src/lib/command_suite/runner.d.ts.map +1 -0
  64. package/dist/src/lib/command_suite/runner.js +27 -0
  65. package/dist/src/lib/command_suite/runner.js.map +1 -0
  66. package/dist/src/lib/execution/command_suite_modules.d.ts +5 -0
  67. package/dist/src/lib/execution/command_suite_modules.d.ts.map +1 -0
  68. package/dist/src/lib/execution/command_suite_modules.js +12 -0
  69. package/dist/src/lib/execution/command_suite_modules.js.map +1 -0
  70. package/dist/src/lib/execution/execution_error.d.ts +7 -0
  71. package/dist/src/lib/execution/execution_error.d.ts.map +1 -0
  72. package/dist/src/lib/execution/execution_error.js +13 -0
  73. package/dist/src/lib/execution/execution_error.js.map +1 -0
  74. package/dist/src/lib/execution/execution_paths.d.ts +5 -0
  75. package/dist/src/lib/execution/execution_paths.d.ts.map +1 -0
  76. package/dist/src/lib/execution/execution_paths.js +13 -0
  77. package/dist/src/lib/execution/execution_paths.js.map +1 -0
  78. package/dist/src/lib/execution/output_validate.d.ts +31 -0
  79. package/dist/src/lib/execution/output_validate.d.ts.map +1 -0
  80. package/dist/src/lib/execution/output_validate.js +119 -0
  81. package/dist/src/lib/execution/output_validate.js.map +1 -0
  82. package/dist/src/lib/execution/plan.d.ts +69 -0
  83. package/dist/src/lib/execution/plan.d.ts.map +1 -0
  84. package/dist/src/lib/execution/plan.js +347 -0
  85. package/dist/src/lib/execution/plan.js.map +1 -0
  86. package/dist/src/lib/execution/register_execution.d.ts +4 -0
  87. package/dist/src/lib/execution/register_execution.d.ts.map +1 -0
  88. package/dist/src/lib/execution/register_execution.js +151 -0
  89. package/dist/src/lib/execution/register_execution.js.map +1 -0
  90. package/dist/src/lib/execution/run_manifest.d.ts +67 -0
  91. package/dist/src/lib/execution/run_manifest.d.ts.map +1 -0
  92. package/dist/src/lib/execution/run_manifest.js +332 -0
  93. package/dist/src/lib/execution/run_manifest.js.map +1 -0
  94. package/dist/src/lib/preflight/preflight.d.ts.map +1 -0
  95. package/dist/src/lib/{preflight.js → preflight/preflight.js} +11 -15
  96. package/dist/src/lib/preflight/preflight.js.map +1 -0
  97. package/dist/src/lib/preflight/preflight_check.d.ts +36 -0
  98. package/dist/src/lib/preflight/preflight_check.d.ts.map +1 -0
  99. package/dist/src/lib/preflight/preflight_check.js +482 -0
  100. package/dist/src/lib/preflight/preflight_check.js.map +1 -0
  101. package/dist/src/lib/preflight/register_preflight.d.ts +4 -0
  102. package/dist/src/lib/preflight/register_preflight.d.ts.map +1 -0
  103. package/dist/src/lib/preflight/register_preflight.js +47 -0
  104. package/dist/src/lib/preflight/register_preflight.js.map +1 -0
  105. package/dist/src/lib/preflight/shell_exec.d.ts +12 -0
  106. package/dist/src/lib/preflight/shell_exec.d.ts.map +1 -0
  107. package/dist/src/lib/preflight/shell_exec.js +25 -0
  108. package/dist/src/lib/preflight/shell_exec.js.map +1 -0
  109. package/dist/src/lib/{app_spec.d.ts → report/app.d.ts} +1 -1
  110. package/dist/src/lib/{app_spec.d.ts.map → report/app.d.ts.map} +1 -1
  111. package/dist/src/lib/{app_spec.js → report/app.js} +1 -1
  112. package/dist/src/lib/{app_spec.js.map → report/app.js.map} +1 -1
  113. package/dist/src/lib/{report_scenario.d.ts → report/command_suite.d.ts} +14 -7
  114. package/dist/src/lib/report/command_suite.d.ts.map +1 -0
  115. package/dist/src/lib/{report_scenario.js → report/command_suite.js} +97 -41
  116. package/dist/src/lib/report/command_suite.js.map +1 -0
  117. package/dist/src/lib/{perf_decode.d.ts → report/decode.d.ts} +3 -3
  118. package/dist/src/lib/report/decode.d.ts.map +1 -0
  119. package/dist/src/lib/{perf_decode.js → report/decode.js} +5 -3
  120. package/dist/src/lib/report/decode.js.map +1 -0
  121. package/dist/src/lib/{format.d.ts → report/format.d.ts} +0 -2
  122. package/dist/src/lib/report/format.d.ts.map +1 -0
  123. package/dist/src/lib/{format.js → report/format.js} +2 -8
  124. package/dist/src/lib/report/format.js.map +1 -0
  125. package/dist/src/lib/report/hdc.d.ts.map +1 -0
  126. package/dist/src/lib/report/hdc.js.map +1 -0
  127. package/dist/src/lib/report/hiperf_compat.d.ts +14 -0
  128. package/dist/src/lib/report/hiperf_compat.d.ts.map +1 -0
  129. package/dist/src/lib/report/hiperf_compat.js +20 -0
  130. package/dist/src/lib/report/hiperf_compat.js.map +1 -0
  131. package/dist/src/lib/report/hiperf_raw_data_probe.d.ts +29 -0
  132. package/dist/src/lib/report/hiperf_raw_data_probe.d.ts.map +1 -0
  133. package/dist/src/lib/report/hiperf_raw_data_probe.js +93 -0
  134. package/dist/src/lib/report/hiperf_raw_data_probe.js.map +1 -0
  135. package/dist/src/lib/{host_commands.d.ts → report/host.d.ts} +2 -14
  136. package/dist/src/lib/report/host.d.ts.map +1 -0
  137. package/dist/src/lib/report/host.js +57 -0
  138. package/dist/src/lib/report/host.js.map +1 -0
  139. package/dist/src/lib/{paths.d.ts → report/paths.d.ts} +7 -4
  140. package/dist/src/lib/report/paths.d.ts.map +1 -0
  141. package/dist/src/lib/{paths.js → report/paths.js} +22 -12
  142. package/dist/src/lib/report/paths.js.map +1 -0
  143. package/dist/src/lib/{pipeline.d.ts → report/pipeline.d.ts} +3 -2
  144. package/dist/src/lib/report/pipeline.d.ts.map +1 -0
  145. package/dist/src/lib/{pipeline.js → report/pipeline.js} +2 -2
  146. package/dist/src/lib/report/pipeline.js.map +1 -0
  147. package/dist/src/lib/{presets.d.ts → report/presets.d.ts} +6 -6
  148. package/dist/src/lib/report/presets.d.ts.map +1 -0
  149. package/dist/src/lib/{presets.js → report/presets.js} +12 -9
  150. package/dist/src/lib/report/presets.js.map +1 -0
  151. package/dist/src/logger.d.ts +3 -3
  152. package/dist/src/logger.d.ts.map +1 -1
  153. package/dist/src/logger.js +17 -19
  154. package/dist/src/logger.js.map +1 -1
  155. package/package.json +11 -15
  156. package/skills/snapshot-checker/SKILL.md +137 -0
  157. package/skills/snapshot-checker/agents/openai.yaml +4 -0
  158. package/skills/snapshot-checker/references/capture_profile.md +74 -0
  159. package/skills/snapshot-checker/references/cli_options.md +87 -0
  160. package/skills/snapshot-checker/references/error_codes.md +80 -0
  161. package/skills/snapshot-checker/references/output_layout.md +42 -0
  162. package/skills/snapshot-checker/references/report_vs_report_user.md +35 -0
  163. package/dist/commands/forkall.d.ts +0 -44
  164. package/dist/commands/forkall.d.ts.map +0 -1
  165. package/dist/commands/forkall.js +0 -322
  166. package/dist/commands/forkall.js.map +0 -1
  167. package/dist/commands/report-user.d.ts.map +0 -1
  168. package/dist/commands/report-user.js.map +0 -1
  169. package/dist/commands/report.d.ts.map +0 -1
  170. package/dist/commands/report.js.map +0 -1
  171. package/dist/demos/context-demo.d.ts +0 -10
  172. package/dist/demos/context-demo.d.ts.map +0 -1
  173. package/dist/demos/context-demo.js +0 -69
  174. package/dist/demos/context-demo.js.map +0 -1
  175. package/dist/demos/mac-example.d.ts +0 -21
  176. package/dist/demos/mac-example.d.ts.map +0 -1
  177. package/dist/demos/mac-example.js +0 -37
  178. package/dist/demos/mac-example.js.map +0 -1
  179. package/dist/demos/timeout-demo.d.ts +0 -5
  180. package/dist/demos/timeout-demo.d.ts.map +0 -1
  181. package/dist/demos/timeout-demo.js +0 -35
  182. package/dist/demos/timeout-demo.js.map +0 -1
  183. package/dist/src/bin.d.ts +0 -3
  184. package/dist/src/bin.d.ts.map +0 -1
  185. package/dist/src/bin.js +0 -57
  186. package/dist/src/bin.js.map +0 -1
  187. package/dist/src/executor.d.ts +0 -5
  188. package/dist/src/executor.d.ts.map +0 -1
  189. package/dist/src/executor.js +0 -3
  190. package/dist/src/executor.js.map +0 -1
  191. package/dist/src/group_specs.d.ts +0 -2
  192. package/dist/src/group_specs.d.ts.map +0 -1
  193. package/dist/src/group_specs.js +0 -2
  194. package/dist/src/group_specs.js.map +0 -1
  195. package/dist/src/lib/format.d.ts.map +0 -1
  196. package/dist/src/lib/format.js.map +0 -1
  197. package/dist/src/lib/hdc.d.ts.map +0 -1
  198. package/dist/src/lib/hdc.js.map +0 -1
  199. package/dist/src/lib/host_commands.d.ts.map +0 -1
  200. package/dist/src/lib/host_commands.js +0 -108
  201. package/dist/src/lib/host_commands.js.map +0 -1
  202. package/dist/src/lib/paths.d.ts.map +0 -1
  203. package/dist/src/lib/paths.js.map +0 -1
  204. package/dist/src/lib/perf_decode.d.ts.map +0 -1
  205. package/dist/src/lib/perf_decode.js.map +0 -1
  206. package/dist/src/lib/pipeline.d.ts.map +0 -1
  207. package/dist/src/lib/pipeline.js.map +0 -1
  208. package/dist/src/lib/preflight.d.ts.map +0 -1
  209. package/dist/src/lib/preflight.js.map +0 -1
  210. package/dist/src/lib/presets.d.ts.map +0 -1
  211. package/dist/src/lib/presets.js.map +0 -1
  212. package/dist/src/lib/report_scenario.d.ts.map +0 -1
  213. package/dist/src/lib/report_scenario.js.map +0 -1
  214. package/dist/src/lib/scenario.d.ts +0 -22
  215. package/dist/src/lib/scenario.d.ts.map +0 -1
  216. package/dist/src/lib/scenario.js +0 -21
  217. package/dist/src/lib/scenario.js.map +0 -1
  218. package/dist/src/lib/scenario_globals.d.ts +0 -8
  219. package/dist/src/lib/scenario_globals.d.ts.map +0 -1
  220. package/dist/src/lib/scenario_globals.js.map +0 -1
  221. package/dist/src/lib/version.d.ts.map +0 -1
  222. package/dist/src/lib/version.js.map +0 -1
  223. package/dist/src/run_command.d.ts +0 -2
  224. package/dist/src/run_command.d.ts.map +0 -1
  225. package/dist/src/run_command.js +0 -2
  226. package/dist/src/run_command.js.map +0 -1
  227. package/dist/src/run_groups.d.ts +0 -2
  228. package/dist/src/run_groups.d.ts.map +0 -1
  229. package/dist/src/run_groups.js +0 -2
  230. package/dist/src/run_groups.js.map +0 -1
  231. package/dist/src/runners/index.d.ts +0 -2
  232. package/dist/src/runners/index.d.ts.map +0 -1
  233. package/dist/src/runners/index.js +0 -2
  234. package/dist/src/runners/index.js.map +0 -1
  235. package/dist/src/types.d.ts +0 -2
  236. package/dist/src/types.d.ts.map +0 -1
  237. package/dist/src/types.js +0 -2
  238. package/dist/src/types.js.map +0 -1
  239. /package/dist/src/lib/{preflight.d.ts → preflight/preflight.d.ts} +0 -0
  240. /package/dist/src/lib/{hdc.d.ts → report/hdc.d.ts} +0 -0
  241. /package/dist/src/lib/{hdc.js → report/hdc.js} +0 -0
package/README.md CHANGED
@@ -4,33 +4,15 @@
4
4
 
5
5
  **主场景为 `report`**:按 checkpoint 风险目标采集 trace/perf,可选 hstack 与 sourcemap 解析,输出 `dump_stack.*`。
6
6
 
7
- **0.7.0 相对 0.6.x 的破坏性变更**
7
+ ---
8
8
 
9
- - `report` 默认 `--trace-from` 由 `hitrace` 改为 **`mix`**(采集默认带 `--raw-data`,analysis 默认预处理 hitrace 并使用 **perfFirst** sidecar)。
10
- - 日志格式统一为行首 `[ISO8601] {级别} {正文}`(无 consola 颜色)。
11
- - 依赖升级:`hiperf_txt_parser` 2.0、`hm-pt-core` 1.0、`hmtrace-parser` 0.8;analysis trace 解码改由 pipeline 编排;公共类型与 trace 机制自 `hm-pt-core` 导入。
12
- - 若需与 0.6.x 相同默认行为,显式传入 `--trace-from hitrace`。
9
+ ## 安装
13
10
 
14
- **前置条件**
11
+ ### 前置条件
15
12
 
16
13
  - **Node.js** ≥ 18。
17
14
  - PATH 中可用 **`hdc`**,并已连接目标设备。
18
- - 本机 analysis 依赖 **`hiperf_txt_parser` ^2.0**、**`hm-pt-core` ^1.0**、**`hmtrace-parser` ^0.8**(随 `npm install` 安装):hitrace 预处理与索引由 hmtrace 构建,公共类型与 trace 机制由 hm-pt-core 提供,样本级并行解码与 hitrace 合并由 hiperf 完成。
19
-
20
- ## 架构与 hmcommand-runner
21
-
22
- 自 **0.8.x** 起,命令调度与执行引擎已提取为独立 npm 包 **[`hmcommand-runner`](https://www.npmjs.com/package/hmcommand-runner)**(`1.0.0`):
23
-
24
- | 层级 | 包 / 目录 | 职责 |
25
- |------|-----------|------|
26
- | 执行框架 | `hmcommand-runner` | `CommandDef` 类型、组调度(`group:N`)、Shell/Builtin/Embed Runner、通用 CLI 注册器 |
27
- | 领域场景 | `commands/`、`src/lib/presets.ts` 等 | forkall/report 场景、hdc/hiperf/hitrace 命令拼装与解码 |
28
-
29
- `snapshot-checker` 的公开 API(`resolveScenario`、`runScenarioGroups`、`executeAll` 等)继续从主包 re-export,现有 `import from 'snapshot-checker'` 的代码无需修改。若只需通用命令编排框架,可直接依赖 `hmcommand-runner`。
30
-
31
- ---
32
-
33
- ## 安装
15
+ - 本机 analysis 依赖 **`hiperf_txt_parser` ^2.2**、**`hm-pt-core` ^2.0**、**`hmtrace-parser` ^0.9**(随 `npm install` 安装):hitrace 预处理与索引由 hmtrace 构建,公共类型与 trace 机制由 hm-pt-core 提供,样本级并行解码与 hitrace 合并由 hiperf 完成。
34
16
 
35
17
  ### 直接安装(推荐)
36
18
 
@@ -60,6 +42,8 @@ npm start -- report --help # 或: node dist/src/cli.js report --help
60
42
  npm run dev -- report --help
61
43
  ```
62
44
 
45
+ 独立二进制(`npm run build:bin`)与 npm 全局安装共用同一套命令注册;版本号均来自 `package.json`(pkg 构建时注入 `HYPER_STARTUP_CHECKER_BUNDLED_VERSION`)。
46
+
63
47
  ---
64
48
 
65
49
  ## `report` 命令
@@ -81,7 +65,7 @@ checkpoint 镜像失效等风险的专项采集与分析。按 `--risk-targets`
81
65
 
82
66
  ### analysis 阶段 trace 解码
83
67
 
84
- analysis 通过 `src/lib/pipeline.ts` 的 pipeline 执行,trace 解码由 `src/lib/perf_decode.ts` 编排(不再在 checker 内逐样本循环):
68
+ analysis 通过 `src/lib/report/pipeline.ts` 的 pipeline 执行,trace 解码由 `src/lib/report/decode.ts` 编排(不再在 checker 内逐样本循环):
85
69
 
86
70
  1. 按 `--trace-format-profile`(或 `auto` 时从设备读取的 format)构建 trace registry。
87
71
  2. 若 `--trace-from` 为 `hitrace` 或 `mix`:主线程一次调用 `hmtrace-parser` 的 `buildHitraceIndexSnapshot` 解析 `workspace/hyperstart_hitrace.txt`。
@@ -110,7 +94,7 @@ analysis 通过 `src/lib/pipeline.ts` 的 pipeline 执行,trace 解码由 `src
110
94
 
111
95
  | 选项 | 说明 |
112
96
  | ---- | ---- |
113
- | `--app <app>` | 应用包名 |
97
+ | `--app <app>` | 应用包名(**`--list` / `--dry-run` / 正式执行均必填**) |
114
98
  | `--risk-targets <targets>` | 风险事件类型,默认 `all` |
115
99
  | `--trace-from <source>` | **采集**:hiperf record 是否 `--raw-data`(`mix` 默认带,`hiperf` 带,`hitrace` 不带)。**analysis**:是否预处理 hitrace 及 sidecar 策略(见上表);与 `--trace-format-profile` 独立 |
116
100
  | `--hstack-tool-path <path>` | hstack 可执行文件;不配置则跳过 |
@@ -127,13 +111,16 @@ analysis 通过 `src/lib/pipeline.ts` 的 pipeline 执行,trace 解码由 `src
127
111
  | `--skip-non-backtrack` | `backtrackFS` 使用 `keepNonFsRevoked: false` |
128
112
  | `--drop-failed-samples` | 丢弃无 trace 解析器的 raw 样本 |
129
113
 
130
- **全局选项**(对各子命令均生效)
114
+ **全局选项**(对各子命令均生效;完整说明见下文「Agent 闭环」)
131
115
 
132
116
  | 选项 | 说明 |
133
117
  | ---- | ---- |
134
118
  | `--hdc-target <sn>` | 全部 `hdc` 命令加 `-t <sn>` |
135
119
  | `--parse-concurrency <n>` | perf **加载**与 **trace 解码** 的 Worker 数,默认 `1`;`profile=auto` 且 format 含主线程 `transformFieldDict` 时解码回退单线程 |
120
+ | `--output-format <text\|json>` | CLI 结果格式,默认 `text` |
121
+ | `--log-level <level>` | 覆盖环境变量中的默认日志级别 |
136
122
  | `--log-file [path]` | 日志追加写文件;省略 path 时写入 `<output-dir>/workspace/checker.log` |
123
+ | `--continue-on-error` | 忽略失败并继续后续阶段(默认遇错即停) |
137
124
 
138
125
  ### 使用方式
139
126
 
@@ -160,7 +147,7 @@ analysis 通过 `src/lib/pipeline.ts` 的 pipeline 执行,trace 解码由 `src
160
147
  **`--list` 输出格式**(节选):
161
148
 
162
149
  ```text
163
- [report] 场景命令(按 group 展示):
150
+ [report] 命令套件(按 group 展示):
164
151
 
165
152
  Group: init
166
153
  [mac] hdc shell remount — hdc shell remount
@@ -190,12 +177,15 @@ Group: monitor
190
177
 
191
178
  ```text
192
179
  output/
180
+ ├── plan.json # plan 命令生成(执行前)
181
+ ├── run_manifest.json # apply 写入(执行状态)
193
182
  ├── dump_stack.txt # 最终调用栈(文本)
194
- ├── dump_stack.json # 同上(JSON
183
+ ├── dump_stack.json # 同上(JSON);validate 必需
195
184
  ├── dump_stack.xlsx # 同上(Excel)
196
185
  ├── perf_txt/
197
186
  │ └── hyperstart_perf.data.txt # 设备 hiperf dump 文本
198
187
  └── workspace/ # 中间产物
188
+ ├── checker.log # --log-file 默认路径
199
189
  ├── hyperstart_log.txt # hilog 采集
200
190
  ├── hyperstart_hitrace.txt
201
191
  ├── perf.data
@@ -275,6 +265,17 @@ snapshot-checker report --app com.example.app \
275
265
  --sourcemap-dir /path/to/sourcemaps
276
266
  ```
277
267
 
268
+ **相机应用完整采集(`hitrace` + `rls` profile)**
269
+
270
+ ```bash
271
+ snapshot-checker report --app com.huawei.hmos.camera --output-dir .\output_camera --trace-format-profile rls --risk-targets all --backtrack-delay 75 --duration 75 --log-file --parse-concurrency 1 --log-key "pid" --trace-from hitrace --skip-backtrack
272
+ ```
273
+
274
+ - `--trace-from hitrace`:采集不带 `--raw-data`,analysis 使用 **hitraceFirst** sidecar(与 0.6.x 默认一致)。
275
+ - `--trace-format-profile rls`:使用 RLS trace 解码 profile。
276
+ - `--skip-backtrack`:跳过 `backtrackFS` 后处理;`--backtrack-delay` / `--duration` 均为 75 秒。
277
+ - `--log-file`:日志写入 `.\output_camera\workspace\checker.log`(Windows 路径写法;Unix 可改为 `./output_camera`)。
278
+
278
279
  **正式采集(需已连接 hdc 设备)**
279
280
 
280
281
  ```bash
@@ -285,6 +286,20 @@ snapshot-checker report --app com.example.app --output-dir ./output
285
286
 
286
287
  **常见错误**
287
288
 
289
+ 缺 `--app`(退出码 `2`):
290
+
291
+ ```bash
292
+ snapshot-checker report --dry-run
293
+ # ERROR_MISSING_APP: report requires --app <bundle_name>.
294
+ ```
295
+
296
+ 未知 `--group`(退出码 `2`,json 模式含 `available_groups`):
297
+
298
+ ```bash
299
+ snapshot-checker report --dry-run --app com.example.app --group missing
300
+ # UNKNOWN_GROUP: Group 'missing' does not exist.
301
+ ```
302
+
288
303
  无效 `--trace-from` 值会直接报错并退出,例如:
289
304
 
290
305
  ```bash
@@ -308,57 +323,179 @@ snapshot-checker report-user --dry-run --app com.example.app --ability EntryAbil
308
323
 
309
324
  ---
310
325
 
311
- ## `forkall` 命令(已过时)
326
+ ## Agent 闭环
312
327
 
313
- > **已过时**:请改用 `report`。`forkall` 仅保留兼容,后续可能移除。
328
+ `snapshot-checker --help` 除命令套件子命令 `report`、`report-user` 外,还提供下列**顶层命令**(`report` 与 `report-user` 输出目录结构一致,闭环命令不按套件嵌套):
314
329
 
315
- 针对单一 `--event-path` 做监控或「改配置后重启再采」。支持 `--mode monitor`(默认)与 `reboot-monitor`。详见 `snapshot-checker forkall --help` 或 `commands/forkall.ts`。
330
+ | 命令 | 说明 |
331
+ | ---- | ---- |
332
+ | `preflight` | 运行前环境检查(Node、hdc、设备、应用、输出目录、命令套件权限等) |
333
+ | `plan` | 生成可保存的执行计划 `plan.json`(不连设备、不执行);默认 `--command-suite report` |
334
+ | `apply` | 按 `plan.json` 执行采集与分析,写入 `run_manifest.json`;采用 plan 中 `execution_options` 与 `global_options`,不可覆盖(不一致时退出码 `2` / `PLAN_OPTION_OVERRIDE`) |
335
+ | `status` | 读取 `run_manifest.json` 执行状态 |
336
+ | `validate` | 验收 `output-dir` 产物(必需 `dump_stack.json`) |
337
+
338
+ **推荐 Agent 顺序**:`preflight` → `plan` → `apply` → `status` → `validate`。详细契约见 [`skills/snapshot-checker/SKILL.md`](skills/snapshot-checker/SKILL.md)。
316
339
 
317
340
  ```bash
318
- snapshot-checker forkall --event-path checkpoint/vfs_snapshot_dump_monitor --app com.example.app
341
+ snapshot-checker preflight --app com.example.app --output-dir ./output --output-format json
342
+ snapshot-checker plan --command-suite report --app com.example.app --output-dir ./output --output-format json
343
+ snapshot-checker apply --plan ./output/plan.json --output-format json
344
+ snapshot-checker status --output-dir ./output --output-format json
345
+ snapshot-checker validate --output-dir ./output --output-format json
319
346
  ```
320
347
 
321
- ---
348
+ ### 全局选项
322
349
 
323
- ## 测试
350
+ 对各子命令均生效(含顶层命令与 `report` / `report-user`):
351
+
352
+ | 选项 | 说明 |
353
+ | ---- | ---- |
354
+ | `--output-format <text\|json>` | CLI 结果写出格式,默认 `text`;**与 `--output-dir`(采集产物目录)无关** |
355
+ | `--log-level <level>` | 日志级别;未设则读环境变量,默认 `info` |
356
+ | `--log-file [path]` | 日志追加写文件;省略 path 时写入 `<output-dir>/workspace/checker.log` |
357
+ | `--hdc-target <sn>` | 全部 `hdc` 命令加 `-t <sn>` |
358
+ | `--parse-concurrency <n>` | perf 加载与 trace 解码 Worker 数,默认 `1` |
359
+
360
+ ### `--output-format json`
361
+
362
+ - **stdout**:仅一行 JSON(含 `schema_version: "1"`、`ok`、命令结果或 `error.code`)。
363
+ - **stderr**:结构化日志与进度;自动设置 `NO_COLOR=1`。
364
+ - 适用于 `--list`、`--dry-run`、正式执行,以及 `preflight` / `plan` / `apply` / `status` / `validate`。
365
+
366
+ ### 退出码
367
+
368
+ | 退出码 | 含义 |
369
+ | ------ | ---- |
370
+ | `0` | 成功 |
371
+ | `1` | 执行失败、验收失败、preflight 有 `fail` 检查项 |
372
+ | `2` | 参数/契约错误(如缺 `--app`、未知 `--group`、Shell 参数非法、plan 文件无效或摘要不匹配) |
373
+
374
+ 常见 `error.code`:`ERROR_MISSING_APP`、`ERROR_MISSING_ABILITY`、`UNKNOWN_GROUP`、`INVALID_IDENTIFIER`、`INVALID_NUMERIC`、`INVALID_PATH`、`PLAN_CHANGED`、`PLAN_VERSION_MISMATCH`、`PLAN_OPTION_OVERRIDE`、`PLAN_NOT_FOUND`、`MANIFEST_NOT_FOUND`、`MANIFEST_INVALID_JSON`、`MANIFEST_INVALID`、`MANIFEST_UNSUPPORTED_SCHEMA`。完整列表见 [`skills/snapshot-checker/references/error_codes.md`](skills/snapshot-checker/references/error_codes.md)。
375
+
376
+ ### 环境变量
377
+
378
+ | 变量 | 说明 |
379
+ | ---- | ---- |
380
+ | `HYPER_STARTUP_CHECKER_LOG_LEVEL` | 默认日志级别(优先于 `LOG_LEVEL`) |
381
+ | `HYPER_STARTUP_CHECKER_BUNDLED_VERSION` | pkg 二进制嵌入版本(构建注入) |
382
+ | `NO_COLOR` / `FORCE_COLOR` | 控制台颜色 |
383
+
384
+ 旧名 `SNAPSHOT_CHECKER_LOG_LEVEL`、`SNAPSHOT_CHECKER_BUNDLED_VERSION` 仍可读,建议迁移至上表新名。
385
+
386
+ ### Agent 调用与评测
387
+
388
+ Agent 相关能力已接入 CLI 与测试;**契约细节以 Skill 为准**,上文提供速查。
389
+
390
+ - 技能文档:[`skills/snapshot-checker/SKILL.md`](skills/snapshot-checker/SKILL.md)
391
+ - 集成说明:[`skills/INTEGRATION.md`](skills/INTEGRATION.md)
392
+ - 端到端评测:`tests/agent_e2e.test.ts`(仅解析 JSON 与退出码,无需真实设备)
393
+ - 安全与 Plan 完整性:`tests/shell_identifiers.test.ts`、`tests/shell_params.test.ts`、`tests/plan_integrity.test.ts`
324
394
 
325
395
  ```bash
326
- npm test # 单元与集成
327
- npm run test:perf # 性能回归
328
- npm run test:all # 全部
329
- npm run format # Prettier 格式化 src / commands / tests / demos
330
- npm run format:check # 仅检查格式(CI 可用)
396
+ npm run test -- tests/agent_e2e.test.ts
331
397
  ```
332
398
 
399
+ 离线预览计划(无需设备):
400
+
401
+ ```bash
402
+ snapshot-checker plan --command-suite report --app com.example.app --output-dir ./output --output-format json
403
+ # 等价:snapshot-checker report --dry-run --app com.example.app --output-format json
404
+ ```
405
+
406
+ ---
407
+
408
+ ## 架构与 hmcommand-runner
409
+
410
+ 自 **0.8.x** 起,命令调度与执行引擎已提取为独立 npm 包 **[`hmcommand-runner`](https://www.npmjs.com/package/hmcommand-runner)**(当前依赖 `^1.3.2`):
411
+
412
+ | 层级 | 包 / 目录 | 职责 |
413
+ |------|-----------|------|
414
+ | 执行框架 | `hmcommand-runner` | `CommandDef` 类型、组调度(`group:N`)、Shell/Builtin/Embed Runner、`registerCommandSuites` |
415
+ | 领域命令套件 | `src/commands/`、`src/lib/report/` 等 | report/report-user 命令套件、hdc/hiperf/hitrace 命令拼装与解码 |
416
+
417
+ `snapshot-checker` 的公开 API(`resolveCommandSuite`、`runCommandSuiteGroups`、`executeAll` 等)从主包 re-export(底层委托 `hmcommand-runner`)。npm 仍可通过 `snapshot-checker/commands/report` 引用命令套件模块。若只需通用命令编排框架,可直接依赖 `hmcommand-runner`。
418
+
419
+ ---
420
+
333
421
  ## 作为库使用
334
422
 
335
423
  ```ts
336
- import { resolveScenario, runScenarioGroups } from "snapshot-checker";
424
+ import { resolveCommandSuite, runCommandSuiteGroups } from "snapshot-checker";
337
425
  import * as report from "snapshot-checker/commands/report";
338
426
 
339
427
  // dryRun: true 与 CLI --dry-run 相同,applyOptions 不会创建 outputDir
340
- const { groups, defaultGroupOrder } = resolveScenario(
428
+ const { groups, defaultGroupOrder } = resolveCommandSuite(
341
429
  report,
342
430
  { app: "com.example.app", riskTargets: "all", dryRun: true },
343
431
  { hdcTarget: "DEVICE01" },
344
432
  );
345
433
 
346
- await runScenarioGroups({ groups, defaultGroupOrder, stopOnError: true });
434
+ await runCommandSuiteGroups({ groups, defaultGroupOrder });
347
435
  ```
348
436
 
349
- 独立示例:`demos/consumer-app`(见该目录 `README.md`)。
437
+ 默认遇错即停;需忽略失败继续时传 `stopOnError: false`。
350
438
 
351
439
  ---
352
440
 
353
- ## CLI 场景框架
441
+ ## CLI 命令套件框架
442
+
443
+ 本工具将 `src/commands/*.ts` 静态注册为子命令,并由顶层命令提供 Agent 闭环(见「Agent 闭环」)。每个命令套件导出 **`groups`**、**`defaultGroupOrder`**,可选 **`options`** 与 **`applyOptions(opts)`**。
444
+
445
+ - **`src/commands/`**:设备联调命令套件,**`report`**(主套件)、**`report-user`**(无 hidumper/revoke_switch 权限)。
446
+ - **`src/lib/`**:领域实现(如 `lib/report/decode.ts`、`lib/report/pipeline.ts`、`lib/report/command_suite.ts`);调度类型与执行器来自 **`hmcommand-runner`**。
447
+
448
+ `plan.json` 主要字段:`command_suite`、`command_suite_options`、`commands`、`commands_digest`、`execution_options`(如 `ignorePlatform`)、`tool_version`;`plan --output-format json` 的 stdout 含 `ok: true`、`command: "plan"`。`run_manifest.json` 与 preflight JSON 中套件标识同为 `command_suite`。
354
449
 
355
- 本工具按命名场景(`commands/*.ts`、`demos/*.ts`)注册子命令。每个场景导出 **`groups`**、**`defaultGroupOrder`**,可选 **`options`** **`applyOptions(opts)`**。
450
+ 命令套件子命令通用开关:`--list`、`--dry-run`、`-g,--group`、`--wait`、`--silent`、`--continue-on-error` 等。完整列表见 `snapshot-checker <command> --help`。
356
451
 
357
- - **`commands/`**:设备联调场景,主场景 **`report`**、**`report-user`**(无 hidumper/revoke_switch 权限);**`forkall`** 已过时(analysis 默认 `--trace-from mix`)。
358
- - **`demos/`**:示例场景(`context-demo`、`timeout-demo` 等)。
359
- - **`src/`**:实现采用 **下划线** 源文件名(如 `group_specs.ts`、`run_command.ts`、`lib/perf_decode.ts`、`runners/platform_shell_executor.ts`)。
452
+ ---
453
+
454
+ ## 测试
455
+
456
+ ```bash
457
+ npm test # 单元与集成
458
+ npm run test:perf # 性能回归
459
+ npm run test:all # 全部
460
+ npm run format # Prettier 格式化 src / tests
461
+ npm run format:check # 仅检查格式(CI 可用)
462
+ ```
463
+
464
+ Agent 相关测试见上文「Agent 闭环 → Agent 调用与评测」。
465
+
466
+ ---
467
+
468
+ ## 更新说明
469
+
470
+ ### 0.8.6 依赖升级
471
+
472
+ - **`hmtrace-parser` ^0.9.0**:内置 profile 统一为 `rls`(`default` 为其别名);`checkpoint_revoked` 字段改为 `checkpoint_monitor_id` / `revoke_reason`,FS 类型自动展开 `revoke_reason`;`vfs_snapshot_dump_monitor` 支持 `op_flag` 可读化。CLI 行为不变,仍通过 `--trace-format-profile rls` 选用该 profile。
473
+
474
+ ### 0.8.5 依赖升级
475
+
476
+ - **`hm-pt-core` ^2.0**:`RecordSample.id` / `time` / `stream_id` / `period` 统一为 `bigint`,与 hiperf 2.1+ 对齐;hiperf / hmtrace 均复用该类型,pipeline 不再需要类型断言。
477
+ - **`hiperf_txt_parser` ^2.2**:依赖 hm-pt-core 2.0;fieldDict 解码后 raw 行改为键值展示,测试侧用保留 hex raw 的 fixture 模拟「perf 已解码」场景。
478
+ - **`hmtrace-parser` ^0.8.3**、**`hmcommand-runner` ^1.3.2**:小版本对齐,无 CLI 行为变更。
479
+
480
+ ### 0.7.0 相对 0.6.x 的破坏性变更
481
+
482
+ - `report` 默认 `--trace-from` 由 `hitrace` 改为 **`mix`**(采集默认带 `--raw-data`,analysis 默认预处理 hitrace 并使用 **perfFirst** sidecar)。
483
+ - 日志格式统一为行首 `[ISO8601] {级别} {正文}`(无 consola 颜色)。
484
+ - 依赖升级:`hiperf_txt_parser` 2.0、`hm-pt-core` 1.0、`hmtrace-parser` 0.8;analysis trace 解码改由 pipeline 编排;公共类型与 trace 机制自 `hm-pt-core` 导入。
485
+ - 若需与 0.6.x 相同默认行为,显式传入 `--trace-from hitrace`。
360
486
 
361
- 通用开关(各场景子命令可用):`--list`、`--dry-run`、`--stop-on-error`、`-g,--group`、`--wait`、`--silent` 等。完整列表见 `snapshot-checker <scene> --help`。
487
+ ### 0.8.x Agent-friendly 变更(相对早期 0.8)
488
+
489
+ - **统一 CLI 入口**:npm 与 pkg 独立二进制共用 `src/cli.ts`,能力一致(含 `report-user`、`--list`、`--dry-run`、顶层闭环命令)。
490
+ - **默认 fail-fast**:命令套件执行遇错即停;需继续时使用 `--continue-on-error`(`--stop-on-error` 为同义显式写法)。失败时仍会补跑 `restore` 组。
491
+ - **参数校验**:`report` / `report-user` / `plan` 要求非空 `--app`;未知 `--group` 返回退出码 `2` 与稳定错误码(如 `ERROR_MISSING_APP`、`UNKNOWN_GROUP`)。
492
+ - **Shell 安全边界**:进入 Shell 或重定向的参数经统一校验——标识符白名单(`--app`、`--ability`、`--log-key`、`--hitrace-tag`、`--hdc-target` 等 → `INVALID_IDENTIFIER`);数值纯整数解析(`--duration`、`--buffer-size` → `INVALID_NUMERIC`);路径拒绝 Shell 元字符(`--output-dir`、`--hstack-tool-path`、`--sourcemap-dir` → `INVALID_PATH`)。
493
+ - **Plan 完整性**:`plan.json` 含 `commands_digest` 与 `execution_options`(如 `ignorePlatform`);`apply` 校验存储 commands 与重新生成 commands 的双摘要,并**始终**采用 plan 保存的执行选项与全局选项(与 plan 不一致的 `apply --ignore-platform`、`--hdc-target`、`--parse-concurrency` 返回 `PLAN_OPTION_OVERRIDE`,需重新 `plan`);`0.x` 版本兼容比较 major+minor。
494
+ - **机器可读输出**:全局 `--output-format json`(与采集目录 `--output-dir` 无关);json 模式下 **stdout 仅 JSON**,日志写 **stderr**。
495
+ - **顶层闭环命令**:`preflight`、`plan`、`apply`、`status`、`validate`(详见「Agent 闭环」)。
496
+ - **环境变量**:`HYPER_STARTUP_CHECKER_LOG_LEVEL`、`HYPER_STARTUP_CHECKER_BUNDLED_VERSION`(旧名 `SNAPSHOT_CHECKER_*` 仍可读)。
497
+ - **CommandSuite 命名**(依赖 `hmcommand-runner@^1.3.0`):原 `Scenario*` API 与 JSON 字段 `scenario` / `scenario_options` 分别改为 `CommandSuite*`、`command_suite` / `command_suite_options`;`plan` / `preflight` 使用 `--command-suite`。
498
+ - **命令套件源码位置**:`report` / `report-user` 定义迁至 `src/commands/`,CLI 静态注册(不再扫描目录动态加载)。
362
499
 
363
500
  ### License
364
501
 
package/dist/src/cli.d.ts CHANGED
@@ -1,3 +1,12 @@
1
1
  #!/usr/bin/env node
2
- export {};
2
+ import type { Command } from "commander";
3
+ export declare function createHyperStartUpCheckerProgram(): Command;
4
+ export interface RunHyperStartUpCheckerCliOptions {
5
+ /** 是否在解析前执行 pkg 二进制 preflight(默认 true) */
6
+ preflight?: boolean;
7
+ /** 自定义 argv,默认 `process.argv` */
8
+ argv?: readonly string[];
9
+ }
10
+ /** 注册场景子命令并解析 CLI(npm 与独立二进制共用)。 */
11
+ export declare function runHyperStartUpCheckerCli(options?: RunHyperStartUpCheckerCliOptions): Promise<void>;
3
12
  //# sourceMappingURL=cli.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgDzC,wBAAgB,gCAAgC,IAAI,OAAO,CAoC1D;AAED,MAAM,WAAW,gCAAgC;IAC/C,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iCAAiC;IACjC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED,oCAAoC;AACpC,wBAAsB,yBAAyB,CAC7C,OAAO,GAAE,gCAAqC,GAC7C,OAAO,CAAC,IAAI,CAAC,CAgGf"}
package/dist/src/cli.js CHANGED
@@ -1,13 +1,19 @@
1
1
  #!/usr/bin/env node
2
2
  import { program, Option } from "commander";
3
- import { dirname, join } from "node:path";
4
- import { fileURLToPath } from "node:url";
5
- import { registerScenarios, } from "hmcommand-runner/cli";
3
+ import { registerCommandSuites } from "hmcommand-runner/cli";
6
4
  import { setLoggerHooks, setGlobalLogLevelFromCli as setRunnerLogLevelFromCli, registerLogFilePathForTee, } from "hmcommand-runner";
7
- import { attachLoggerFileSink, createModuleLogger, resolveLogDumpPath, restoreBaselineLogLevel, setGlobalLogLevelFromCli, SNAPSHOT_CHECKER_LOG_LEVEL_CHOICES, } from "./logger.js";
8
- import { buildApplyOptionsInput } from "./lib/scenario_globals.js";
9
- import { formatInvocationCommandLine, readSnapshotCheckerVersion, } from "./lib/version.js";
10
- const cliModuleDir = dirname(fileURLToPath(import.meta.url));
5
+ import { REPORT_GUARANTEED_ON_FAILURE_GROUP_NAMES } from "./lib/command_suite/runner.js";
6
+ import * as reportMod from "./commands/report.js";
7
+ import * as reportUserMod from "./commands/report-user.js";
8
+ import { attachLoggerFileSink, createModuleLogger, resolveLogDumpPath, restoreBaselineLogLevel, setGlobalLogLevelFromCli, HYPER_STARTUP_CHECKER_LOG_LEVEL_CHOICES, } from "./logger.js";
9
+ import { buildApplyOptionsInput } from "./lib/command_suite/globals.js";
10
+ import { formatInvocationCommandLine, readHyperStartUpCheckerVersion, SNAPSHOT_CHECKER_CLI_NAME, } from "./lib/cli/version.js";
11
+ import { runBinaryPreflight } from "./lib/preflight/preflight.js";
12
+ import { handleCliFatalError } from "./lib/cli/fatal.js";
13
+ import { collectReportOutputArtifacts, resolveOutputFormatFromCli, } from "./lib/cli/output.js";
14
+ import { clearPendingCommandSuiteError, takePendingCommandSuiteError } from "./lib/execution/execution_error.js";
15
+ import { registerPreflightCommand } from "./lib/preflight/register_preflight.js";
16
+ import { registerExecutionCommands } from "./lib/execution/register_execution.js";
11
17
  const cliLogger = createModuleLogger(import.meta.url);
12
18
  setLoggerHooks({
13
19
  onQuietSilentAttach: () => {
@@ -20,46 +26,58 @@ setLoggerHooks({
20
26
  setGlobalLogLevelFromCli(level);
21
27
  },
22
28
  });
23
- program
24
- .name("snapshot-checker")
25
- .description("顺序执行 bat / mac / shell 命令")
26
- .version(readSnapshotCheckerVersion())
27
- .configureHelp({ showGlobalOptions: true })
28
- .addOption(new Option("--log-level <level>", "日志级别;未设则读 SNAPSHOT_CHECKER_LOG_LEVEL / LOG_LEVEL,默认 info").choices([...SNAPSHOT_CHECKER_LOG_LEVEL_CHOICES]))
29
- .addOption(new Option("--log-file [path]", "日志与子进程输出追加写文件;省略 path <output-dir>/workspace/checker.log"))
30
- .addOption(new Option("--hdc-target <sn>", "hdc -t 目标设备序列号;指定后全部 hdc 命令带 -t"))
31
- .addOption(new Option("--parse-concurrency <n>", "hiperf_txt_parser 解析/解码/写回并发 Worker 数,默认 1(串行,无 Worker 开销)").default(1));
32
- async function main() {
33
- await registerScenarios({
34
- program: program,
35
- scenarioDirs: [
29
+ export function createHyperStartUpCheckerProgram() {
30
+ return program
31
+ .name(SNAPSHOT_CHECKER_CLI_NAME)
32
+ .description("顺序执行 bat / mac / shell 命令")
33
+ .version(readHyperStartUpCheckerVersion())
34
+ .configureHelp({ showGlobalOptions: true })
35
+ .addOption(new Option("--log-level <level>", "日志级别;未设则读 HYPER_STARTUP_CHECKER_LOG_LEVEL / LOG_LEVEL,默认 info").choices([...HYPER_STARTUP_CHECKER_LOG_LEVEL_CHOICES]))
36
+ .addOption(new Option("--log-file [path]", "日志与子进程输出追加写文件;省略 path <output-dir>/workspace/checker.log"))
37
+ .addOption(new Option("--hdc-target <sn>", "hdc -t 目标设备序列号;指定后全部 hdc 命令带 -t"))
38
+ .addOption(new Option("--parse-concurrency <n>", "hiperf_txt_parser 解析/解码/写回并发 Worker 数,默认 1(串行,无 Worker 开销)").default(1))
39
+ .addOption(new Option("--output-format <format>", "CLI 结果写出格式(stdout);与采集产物目录 --output-dir 无关:text(默认)或 json").choices(["text", "json"]));
40
+ }
41
+ /** 注册场景子命令并解析 CLI(npm 与独立二进制共用)。 */
42
+ export async function runHyperStartUpCheckerCli(options = {}) {
43
+ const { preflight = true, argv = process.argv } = options;
44
+ if (preflight) {
45
+ runBinaryPreflight(argv.slice(2));
46
+ }
47
+ const rootProgram = createHyperStartUpCheckerProgram();
48
+ registerPreflightCommand(rootProgram);
49
+ registerExecutionCommands(rootProgram, argv);
50
+ await registerCommandSuites({
51
+ program: rootProgram,
52
+ commandSuiteModules: [
36
53
  {
37
- dirPath: join(cliModuleDir, "..", "commands"),
38
- displayPrefix: "commands",
54
+ commandName: "report",
55
+ module: reportMod,
56
+ displayPath: "commands/report.ts",
39
57
  },
40
58
  {
41
- dirPath: join(cliModuleDir, "..", "demos"),
42
- displayPrefix: "demos",
59
+ commandName: "report-user",
60
+ module: reportUserMod,
61
+ displayPath: "commands/report-user.ts",
43
62
  },
44
63
  ],
45
- mergeScenarioOptions: (scenarioOpts, globals) => buildApplyOptionsInput(scenarioOpts, {
64
+ mergeCommandSuiteOptions: (commandSuiteOpts, globals) => buildApplyOptionsInput(commandSuiteOpts, {
46
65
  hdcTarget: globals.hdcTarget,
47
66
  parseConcurrency: globals.parseConcurrency,
48
67
  }),
49
68
  onBeforeRun: async ({ globals, opts }) => {
69
+ clearPendingCommandSuiteError();
50
70
  const logFileOpt = globals.logFile;
51
71
  const skipLogSinkOnList = opts.list === true &&
52
72
  (logFileOpt === undefined ||
53
73
  logFileOpt === true ||
54
74
  (typeof logFileOpt === "string" && logFileOpt.trim() === ""));
55
- const logDumpPath = skipLogSinkOnList
56
- ? undefined
57
- : resolveLogDumpPath(globals);
75
+ const logDumpPath = skipLogSinkOnList ? undefined : resolveLogDumpPath(globals);
58
76
  if (logDumpPath === undefined) {
59
77
  return {};
60
78
  }
61
- const commandLine = formatInvocationCommandLine();
62
- const version = readSnapshotCheckerVersion();
79
+ const commandLine = formatInvocationCommandLine(argv);
80
+ const version = readHyperStartUpCheckerVersion();
63
81
  const detachChecker = attachLoggerFileSink(logDumpPath, {
64
82
  commandLine,
65
83
  version,
@@ -73,14 +91,39 @@ async function main() {
73
91
  };
74
92
  },
75
93
  logger: cliLogger,
94
+ guaranteedOnFailureGroupNames: [...REPORT_GUARANTEED_ON_FAILURE_GROUP_NAMES],
95
+ resolveOutputFormat: ({ globals }) => resolveOutputFormatFromCli(globals),
96
+ buildCommandSuiteResultExtras: async ({ commandName, opts, mode, failed }) => {
97
+ if (mode === "run" && failed) {
98
+ const pending = takePendingCommandSuiteError();
99
+ if (pending) {
100
+ return {
101
+ error: pending,
102
+ errors: [pending.message],
103
+ };
104
+ }
105
+ }
106
+ if (mode !== "run" || failed) {
107
+ return {};
108
+ }
109
+ if (commandName !== "report" && commandName !== "report-user") {
110
+ return {};
111
+ }
112
+ return {
113
+ outputs: collectReportOutputArtifacts(typeof opts.outputDir === "string" ? opts.outputDir : undefined),
114
+ };
115
+ },
76
116
  });
77
- program.hook("preAction", (thisCommand) => {
78
- const { logLevel } = thisCommand.optsWithGlobals();
117
+ rootProgram.hook("preAction", (thisCommand) => {
118
+ const { logLevel, outputFormat } = thisCommand.optsWithGlobals();
119
+ if (outputFormat === "json") {
120
+ process.env.NO_COLOR = "1";
121
+ process.env.FORCE_COLOR = "0";
122
+ }
79
123
  setGlobalLogLevelFromCli(logLevel);
80
124
  setRunnerLogLevelFromCli(logLevel);
81
125
  });
82
- await program.parseAsync();
126
+ await rootProgram.parseAsync(argv);
83
127
  }
84
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
85
- main();
128
+ runHyperStartUpCheckerCli().catch((error) => handleCliFatalError(error, process.argv));
86
129
  //# sourceMappingURL=cli.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EACL,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,cAAc,EACd,wBAAwB,IAAI,wBAAwB,EACpD,yBAAyB,GAC1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,wBAAwB,EACxB,kCAAkC,GACnC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAE1B,MAAM,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE7D,MAAM,SAAS,GAAG,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEtD,cAAc,CAAC;IACb,mBAAmB,EAAE,GAAG,EAAE;QACxB,wBAAwB,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;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Y,KAAK,MAAM,EAAE,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC;YAC3B,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,GAAG,CAAC;QAChC,CAAC;QACD,wBAAwB,CAAC,QAAQ,CAAC,CAAC;QACnC,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,MAAM,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC;AAED,yBAAyB,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { Groups } from "../src/types.js";
1
+ import type { Groups } from "hmcommand-runner";
2
2
  /** report-user 场景占位;内容由 `applyOptions` 注入 */
3
3
  export declare const groups: Groups;
4
4
  export declare const defaultGroupOrder: string[];
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-user.d.ts","sourceRoot":"","sources":["../../../src/commands/report-user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAO/C,6CAA6C;AAC7C,eAAO,MAAM,MAAM,EAAE,MAAW,CAAC;AAEjC,eAAO,MAAM,iBAAiB,EAAE,MAAM,EAAoC,CAAC;AAE3E,eAAO,MAAM,OAAO;;;;;;;;;;IAOnB,CAAC;AAEF,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,GAAG,EAAE;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,MAAM,EAAE,CAAA;CAAE,CAElD"}
@@ -1,4 +1,4 @@
1
- import { applyReportScenarioOptions, REPORT_DEFAULT_GROUP_ORDER, REPORT_OPTIONS, } from "../src/lib/report_scenario.js";
1
+ import { applyReportCommandSuiteOptions, REPORT_DEFAULT_GROUP_ORDER, REPORT_OPTIONS, } from "../lib/report/command_suite.js";
2
2
  /** report-user 场景占位;内容由 `applyOptions` 注入 */
3
3
  export const groups = {};
4
4
  export const defaultGroupOrder = [...REPORT_DEFAULT_GROUP_ORDER];
@@ -12,6 +12,6 @@ export const options = [
12
12
  ];
13
13
  /** 注入 init/monitor/collect/restore/filter/analysis 流水线(无 hidumper / revoke_switch) */
14
14
  export function applyOptions(ctx) {
15
- return applyReportScenarioOptions(ctx, "user");
15
+ return applyReportCommandSuiteOptions(ctx, "user");
16
16
  }
17
17
  //# sourceMappingURL=report-user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-user.js","sourceRoot":"","sources":["../../../src/commands/report-user.ts"],"names":[],"mappings":"AACA,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,EAC1B,cAAc,GACf,MAAM,gCAAgC,CAAC;AAExC,6CAA6C;AAC7C,MAAM,CAAC,MAAM,MAAM,GAAW,EAAE,CAAC;AAEjC,MAAM,CAAC,MAAM,iBAAiB,GAAa,CAAC,GAAG,0BAA0B,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,GAAG,cAAc;IACjB;QACE,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EAAE,yCAAyC;QACtD,SAAS,EAAE,QAAQ;KACpB;CACF,CAAC;AAEF,sFAAsF;AACtF,MAAM,UAAU,YAAY,CAAC,GAI5B;IACC,OAAO,8BAA8B,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { Groups } from "../src/types.js";
1
+ import type { Groups } from "hmcommand-runner";
2
2
  /** report 场景占位;内容由 `applyOptions` 注入 */
3
3
  export declare const groups: Groups;
4
4
  export declare const defaultGroupOrder: string[];
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../src/commands/report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAO/C,wCAAwC;AACxC,eAAO,MAAM,MAAM,EAAE,MAAW,CAAC;AAEjC,eAAO,MAAM,iBAAiB,EAAE,MAAM,EAAoC,CAAC;AAE3E,eAAO,MAAM,OAAO;;;;;;;;;;IAQnB,CAAC;AAEF,oEAAoE;AACpE,wBAAgB,YAAY,CAAC,GAAG,EAAE;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,MAAM,EAAE,CAAA;CAAE,CAElD"}
@@ -1,4 +1,4 @@
1
- import { applyReportScenarioOptions, REPORT_DEFAULT_GROUP_ORDER, REPORT_OPTIONS, } from "../src/lib/report_scenario.js";
1
+ import { applyReportCommandSuiteOptions, REPORT_DEFAULT_GROUP_ORDER, REPORT_OPTIONS, } from "../lib/report/command_suite.js";
2
2
  /** report 场景占位;内容由 `applyOptions` 注入 */
3
3
  export const groups = {};
4
4
  export const defaultGroupOrder = [...REPORT_DEFAULT_GROUP_ORDER];
@@ -12,6 +12,6 @@ export const options = [
12
12
  ];
13
13
  /** 注入 init/monitor/collect/restore/filter/analysis 流水线及风险目标等派生命令 */
14
14
  export function applyOptions(ctx) {
15
- return applyReportScenarioOptions(ctx, "full");
15
+ return applyReportCommandSuiteOptions(ctx, "full");
16
16
  }
17
17
  //# sourceMappingURL=report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.js","sourceRoot":"","sources":["../../../src/commands/report.ts"],"names":[],"mappings":"AACA,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,EAC1B,cAAc,GACf,MAAM,gCAAgC,CAAC;AAExC,wCAAwC;AACxC,MAAM,CAAC,MAAM,MAAM,GAAW,EAAE,CAAC;AAEjC,MAAM,CAAC,MAAM,iBAAiB,GAAa,CAAC,GAAG,0BAA0B,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,GAAG,cAAc;IACjB;QACE,KAAK,EAAE,kBAAkB;QACzB,WAAW,EACT,uEAAuE;QACzE,SAAS,EAAE,QAAQ;KACpB;CACF,CAAC;AAEF,oEAAoE;AACpE,MAAM,UAAU,YAAY,CAAC,GAI5B;IACC,OAAO,8BAA8B,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC"}
@@ -1,7 +1,7 @@
1
1
  export { executeOne, executeAll, finalizeBackgroundProcesses, getCommandsToRun, getCommandsToRunWithRepeat, getGroupChunks, runGroupChunks, isSupportedOnCurrentPlatform, type GroupChunk, type GroupSpec, type RunGroupChunksOptions, type ExecuteAllOptions, } from "hmcommand-runner";
2
2
  export { parseGroupSpecs } from "hmcommand-runner";
3
- export { buildApplyOptionsInput, resolveScenario, runScenarioGroups, normalizeGroupCliArg, type ScenarioGlobalOptions, type ScenarioModuleLike, type RunScenarioGroupsInput, type RunScenarioGroupsResult, } from "./lib/scenario.js";
4
- export { createHdcCli, type HdcCli } from "./lib/hdc.js";
5
- export { CommandKind, createCommandContext, getCurrentPlatformKind } from "hmcommand-runner";
3
+ export { buildApplyOptionsInput, resolveCommandSuite, runCommandSuiteGroups, normalizeGroupCliArg, type CommandSuiteGlobalOptions, type CommandSuiteModule, type RunCommandSuiteGroupsInput, type RunCommandSuiteGroupsResult, } from "./lib/command_suite/runner.js";
4
+ export { createHdcCli, type HdcCli } from "./lib/report/hdc.js";
5
+ export { CommandKind, createCommandContext, getCurrentPlatformKind, } from "hmcommand-runner";
6
6
  export type { CommandContext, CommandDef, CommandResult, RunOptions, Groups, } from "hmcommand-runner";
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,2BAA2B,EAC3B,gBAAgB,EAChB,0BAA0B,EAC1B,cAAc,EACd,cAAc,EACd,4BAA4B,EAC5B,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,GAC7B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC7F,YAAY,EACV,cAAc,EACd,UAAU,EACV,aAAa,EACb,UAAU,EACV,MAAM,GACP,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,2BAA2B,EAC3B,gBAAgB,EAChB,0BAA0B,EAC1B,cAAc,EACd,cAAc,EACd,4BAA4B,EAC5B,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,GACjC,M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