@buaa_smat/hometrans 26.0.4 → 26.0.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.
Files changed (102) hide show
  1. package/agents/code-reviewer.md +2 -0
  2. package/agents/model-render-worker.md +1 -1
  3. package/i18n/agents/code-reviewer.md +2 -0
  4. package/i18n/agents/model-render-worker.md +1 -1
  5. package/i18n/skills/a2h-app-migrate/SKILL.md +51 -3
  6. package/i18n/skills/a2h-app-migrate/references/workflow.yaml +140 -32
  7. package/i18n/skills/a2h-app-migrate/scripts/dag_graph.mjs +297 -0
  8. package/i18n/skills/a2h-app-migrate/scripts/validate_workflow.mjs +134 -21
  9. package/i18n/skills/a2h-app-migrate/test/test_finalize.mjs +21 -4
  10. package/i18n/skills/a2h-app-migrate/test/test_image_probe.mjs +3 -3
  11. package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
  12. package/i18n/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +1 -1
  13. package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +12 -5
  14. package/i18n/skills/a2h-arkts-logic-coder/SKILL.md +7 -8
  15. package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +1 -1
  16. package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +27 -15
  17. package/i18n/skills/a2h-batch-ui-align/SKILL.md +1 -1
  18. package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +4 -0
  19. package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +36 -0
  20. package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +4 -0
  21. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +4 -0
  22. package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +3 -3
  23. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +8 -0
  24. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_in_linear.ts +164 -0
  25. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/self_drawn_sheet.ts +105 -0
  26. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/staggered_lanes.ts +127 -0
  27. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/window_size_constant.ts +114 -0
  28. package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +4 -1
  29. package/i18n/skills/a2h-page-specgen/references/spec-example.md +35 -5
  30. package/i18n/skills/a2h-page-specgen/references/spec-template.md +4 -4
  31. package/i18n/skills/a2h-spec-generate/SKILL.md +3 -1
  32. package/i18n/skills/a2h-spec-generate/references/fusion-task-contract.md +15 -3
  33. package/i18n/skills/a2h-spec-generate/references/review-checklist.md +1 -0
  34. package/i18n/skills/a2h-spec-generate/references/spec-sample-complex.md +16 -0
  35. package/i18n/skills/a2h-spec-generate/references/spec-sample-transfer.md +16 -0
  36. package/i18n/skills/a2h-spec-generate/references/spec-samples.md +5 -1
  37. package/i18n/skills/a2h-spec-generate/references/synthesis-rules.md +21 -1
  38. package/i18n/skills/a2h-spec-generate/references/worker-rules.md +25 -2
  39. package/i18n/skills/a2h-spec-generate/scripts/check_spec.ts +121 -6
  40. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +2 -1
  41. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-e2e.test.ts +3 -0
  42. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +16 -2
  43. package/i18n/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +11 -2
  44. package/i18n/skills/a2h-spec-generate/test/check-spec.test.ts +35 -0
  45. package/package.json +1 -1
  46. package/skills/a2h-app-migrate/SKILL.md +53 -5
  47. package/skills/a2h-app-migrate/references/workflow.yaml +140 -32
  48. package/skills/a2h-app-migrate/scripts/assert_dag_complete.mjs +226 -0
  49. package/skills/a2h-app-migrate/scripts/dag_graph.mjs +297 -0
  50. package/skills/a2h-app-migrate/scripts/dag_process_executor.mjs +199 -0
  51. package/skills/a2h-app-migrate/scripts/dag_production_executor.mjs +897 -0
  52. package/skills/a2h-app-migrate/scripts/dag_runner.mjs +1767 -0
  53. package/skills/a2h-app-migrate/scripts/ledger.mjs +15 -2
  54. package/skills/a2h-app-migrate/scripts/lib-yaml-lite.mjs +8 -2
  55. package/skills/a2h-app-migrate/scripts/resume_plan.mjs +3 -8
  56. package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +134 -21
  57. package/skills/a2h-app-migrate/test/test_dag_complete.mjs +222 -0
  58. package/skills/a2h-app-migrate/test/test_dag_production.mjs +670 -0
  59. package/skills/a2h-app-migrate/test/test_dag_runner.mjs +423 -0
  60. package/skills/a2h-app-migrate/test/test_finalize.mjs +21 -4
  61. package/skills/a2h-app-migrate/test/test_image_probe.mjs +1 -1
  62. package/skills/a2h-app-migrate/test/test_resume_plan.mjs +16 -1
  63. package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +1 -1
  64. package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +12 -5
  65. package/skills/a2h-arkts-logic-coder/SKILL.md +7 -8
  66. package/skills/a2h-arkts-logic-coder/references/ISSUES.md +1 -1
  67. package/skills/a2h-arkts-logic-coder/references/code-generation.md +27 -15
  68. package/skills/a2h-batch-ui-align/SKILL.md +1 -1
  69. package/skills/a2h-batch-ui-align/references/cards/widgets.md +4 -0
  70. package/skills/a2h-batch-ui-align/references/checker-rules.md +36 -0
  71. package/skills/a2h-batch-ui-align/references/conversion-procedure.md +4 -0
  72. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +4 -0
  73. package/skills/a2h-batch-ui-align/references/step5-convert.md +3 -3
  74. package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +49 -3
  75. package/skills/a2h-batch-ui-align/scripts/static_check/core/android.ts +36 -0
  76. package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +8 -0
  77. package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +8 -0
  78. package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_in_linear.ts +164 -0
  79. package/skills/a2h-batch-ui-align/scripts/static_check/rules/self_drawn_sheet.ts +105 -0
  80. package/skills/a2h-batch-ui-align/scripts/static_check/rules/staggered_lanes.ts +127 -0
  81. package/skills/a2h-batch-ui-align/scripts/static_check/rules/window_size_constant.ts +114 -0
  82. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_coolmall_ds1123.test.mjs +433 -0
  83. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_overlay_in_linear.test.mjs +288 -0
  84. package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +46 -0
  85. package/skills/a2h-page-specgen/references/scenario-authoring.md +4 -1
  86. package/skills/a2h-page-specgen/references/spec-example.md +35 -5
  87. package/skills/a2h-page-specgen/references/spec-template.md +4 -4
  88. package/skills/a2h-spec-generate/SKILL.md +3 -1
  89. package/skills/a2h-spec-generate/references/fusion-task-contract.md +15 -3
  90. package/skills/a2h-spec-generate/references/review-checklist.md +1 -0
  91. package/skills/a2h-spec-generate/references/spec-sample-complex.md +16 -0
  92. package/skills/a2h-spec-generate/references/spec-sample-transfer.md +16 -0
  93. package/skills/a2h-spec-generate/references/spec-samples.md +5 -1
  94. package/skills/a2h-spec-generate/references/synthesis-rules.md +21 -1
  95. package/skills/a2h-spec-generate/references/worker-rules.md +25 -2
  96. package/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +3 -1
  97. package/skills/a2h-spec-generate/scripts/check_spec.ts +262 -6
  98. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +12 -2
  99. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-e2e.test.ts +3 -0
  100. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +16 -2
  101. package/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +54 -3
  102. package/skills/a2h-spec-generate/test/check-spec.test.ts +247 -0
@@ -31,6 +31,9 @@ const VIOLATING = [
31
31
  "背景色 #FF0000",
32
32
  "按钮位于列表右侧",
33
33
  "",
34
+ "## 数据契约",
35
+ "不涉及外部数据",
36
+ "",
34
37
  "## 场景一",
35
38
  "- 1. 用户点击后展示内容",
36
39
  "",
@@ -42,11 +45,34 @@ const CLEAN = [
42
45
  "## UI序列",
43
46
  "开关默认关闭",
44
47
  "",
48
+ "## 数据契约",
49
+ "不涉及外部数据",
50
+ "",
45
51
  "## 场景一",
46
52
  "- 1. 用户打开开关后保存该状态",
47
53
  "",
48
54
  ].join("\n");
49
55
 
56
+ /** A SPEC whose data contract declares one external field (the 00时 / uint8 shape). */
57
+ const DATA_SPEC = [
58
+ "# 时间显示SPEC",
59
+ "",
60
+ "## UI序列",
61
+ "主页-逐小时预报",
62
+ "",
63
+ "## 数据契约",
64
+ "- 字段:time",
65
+ "- 类型:string",
66
+ "- 字节长度:12",
67
+ "- 取值域:yyyyMMddHHmm",
68
+ "- 样例:202611121100",
69
+ "- 语义来源:接口时间字段定义",
70
+ "",
71
+ "## 场景一",
72
+ "- 1. 用户查看逐小时预报时,时间标签取该字段的第 9 至第 10 个字符并拼接为“11时”",
73
+ "",
74
+ ].join("\n");
75
+
50
76
  // A spec hitting only vague wording (warn level): structurally complete, no errors at all — pins down "warns do not change the exit code"
51
77
  const WARN_ONLY = [
52
78
  "# 提示SPEC",
@@ -54,6 +80,9 @@ const WARN_ONLY = [
54
80
  "## UI序列",
55
81
  "点击后显示相应提示信息",
56
82
  "",
83
+ "## 数据契约",
84
+ "不涉及外部数据",
85
+ "",
57
86
  "## 场景一",
58
87
  "- 1. 用户点击按钮后显示相应提示信息",
59
88
  "",
@@ -126,6 +155,92 @@ test("checkSpecText returns [] for a clean minimal spec", () => {
126
155
  assert.deepEqual(checkSpecText(CLEAN), []);
127
156
  });
128
157
 
158
+ // ---- data contract (the input shape is part of the SPEC) ----------------------
159
+
160
+ const dataFindings = (text: string) => checkSpecText(text).filter((f) => f.rule === "data-contract");
161
+
162
+ test("a data contract block declaring one external field is clean", () => {
163
+ assert.deepEqual(checkSpecText(DATA_SPEC), []);
164
+ });
165
+
166
+ test("a missing `## 数据契约` section is an error (opt out explicitly when no external data)", () => {
167
+ const missing = CLEAN.replace("## 数据契约\n不涉及外部数据\n\n", "");
168
+ const findings = dataFindings(missing);
169
+ assert.equal(findings.length, 1);
170
+ assert.equal(findings[0].level, "error");
171
+ assert.match(findings[0].note, /missing.*数据契约|missing.*Data Contract/);
172
+ });
173
+
174
+ test("the opt-out line is accepted only when it is the whole body", () => {
175
+ const mixed = CLEAN.replace("不涉及外部数据", "- 字段:time\n- 类型:string\n- 字节长度:12\n- 取值域:yyyyMMddHHmm\n- 样例:202611121100\n- 语义来源:接口时间字段定义\n不涉及外部数据");
176
+ assert.ok(dataFindings(mixed).some((f) => f.note.includes("opt-out")));
177
+ });
178
+
179
+ test("a contract block missing one required key is an error naming the key", () => {
180
+ const missingKey = DATA_SPEC.replace("- 字节长度:12\n", "");
181
+ const findings = dataFindings(missingKey);
182
+ assert.equal(findings.length, 1);
183
+ assert.match(findings[0].note, /字节长度|byte length/i);
184
+ });
185
+
186
+ test("contract keys must appear in the documented order", () => {
187
+ const reordered = DATA_SPEC.replace("- 字段:time\n- 类型:string", "- 类型:string\n- 字段:time");
188
+ assert.ok(dataFindings(reordered).some((f) => f.note.includes("order")));
189
+ });
190
+
191
+ test("a contract block with a duplicated key is an error", () => {
192
+ const dup = DATA_SPEC.replace("- 样例:202611121100", "- 样例:202611121100\n- 样例:202611121101");
193
+ assert.ok(dataFindings(dup).some((f) => f.note.includes("sample") || f.note.includes("样例")));
194
+ });
195
+
196
+ test("the data contract must sit after UI序列 and before the first scenario", () => {
197
+ const late = CLEAN.replace("## 数据契约\n不涉及外部数据\n\n", "") + "\n## 数据契约\n不涉及外部数据\n";
198
+ assert.ok(dataFindings(late).some((f) => f.note.includes("before every scenario")));
199
+
200
+ const beforeUi = [
201
+ "# 干净SPEC",
202
+ "",
203
+ "## 数据契约",
204
+ "不涉及外部数据",
205
+ "",
206
+ "## UI序列",
207
+ "开关默认关闭",
208
+ "",
209
+ "## 场景一",
210
+ "- 1. 用户打开开关后保存该状态",
211
+ "",
212
+ ].join("\n");
213
+ assert.ok(dataFindings(beforeUi).some((f) => f.note.includes("after") && f.note.includes("UI序列")));
214
+ });
215
+
216
+ test("a second data contract section is an error", () => {
217
+ const twice = CLEAN.replace("## 场景一", "## 数据契约\n不涉及外部数据\n\n## 场景一");
218
+ assert.ok(dataFindings(twice).some((f) => f.note.includes("at most once") || f.note.includes("exactly one")));
219
+ });
220
+
221
+ test("en: `## Data Contract` with field keys is accepted, and a missing one is reported", () => {
222
+ const en = [
223
+ "# TimeSPEC",
224
+ "",
225
+ "## UI Sequence",
226
+ "Home - Hourly forecast",
227
+ "",
228
+ "## Data Contract",
229
+ "- Field: time",
230
+ "- Type: string",
231
+ "- Byte length: 12",
232
+ "- Range: yyyyMMddHHmm",
233
+ "- Sample: 202611121100",
234
+ "- Semantic source: interface time field definition",
235
+ "",
236
+ "## Scenario 1",
237
+ "- 1. The user opens the hourly forecast",
238
+ "",
239
+ ].join("\n");
240
+ assert.deepEqual(checkSpecText(en), []);
241
+ assert.ok(dataFindings(en.replace("## Data Contract\n", "## Notes\n")).some((f) => f.note.includes("数据契约") || f.note.includes("Data Contract")));
242
+ });
243
+
129
244
  test("checkSpecFile reads a file and returns exactly checkSpecText's findings", () => {
130
245
  const file = path.join(tmp(), "演示-SPEC.md");
131
246
  fs.writeFileSync(file, VIOLATING);
@@ -375,6 +490,9 @@ const CLEAN_EN = [
375
490
  "## UI Sequence",
376
491
  "Switch off by default",
377
492
  "",
493
+ "## Data Contract",
494
+ "No external data",
495
+ "",
378
496
  "## Scenario 1",
379
497
  "- 1. The user turns the switch on and the state is saved",
380
498
  "",
@@ -428,3 +546,132 @@ test("en: a step citing `Scenario N` gets the same self-reference warning as `
428
546
  assert.ok(zh.some((f) => f.rule === "步骤自引用" && f.level === "warn"));
429
547
  assert.ok(en.some((f) => f.rule === "步骤自引用" && f.level === "warn"), JSON.stringify(en));
430
548
  });
549
+
550
+ // ---- State space: no catch-all fallback --------------------------------------
551
+
552
+ /** A structurally valid spec with the given scenario overview and step. */
553
+ function stateSpec(overview: string, step = "- 1. 请求返回后列表更新"): string {
554
+ return [
555
+ "# 列表SPEC",
556
+ "",
557
+ "## UI序列",
558
+ "列表-状态",
559
+ "",
560
+ "## 场景一",
561
+ "",
562
+ "### 场景概述",
563
+ "",
564
+ overview,
565
+ "",
566
+ "### 场景逻辑步骤",
567
+ "",
568
+ step,
569
+ "",
570
+ ].join("\n");
571
+ }
572
+
573
+ const stateFindings = (text: string) => checkSpecText(text).filter((f) => f.rule.startsWith("state-space"));
574
+
575
+ test("a catch-all fallback is an error: it makes every state it does not name legal", () => {
576
+ for (const body of [
577
+ "- 1. 请求返回后列表更新,否则不发生更新",
578
+ "- 1. 请求返回后列表更新,其余情况不发生更新",
579
+ "- 1. 请求返回后列表更新,其他情况不产生可见变化",
580
+ ]) {
581
+ const [hit] = stateFindings(stateSpec("状态展示", body));
582
+ assert.ok(hit, `must flag: ${body}`);
583
+ assert.equal(hit.level, "error");
584
+ }
585
+ });
586
+
587
+ test("one state, one result: a single-state no-change line is not a catch-all", () => {
588
+ for (const overview of [
589
+ "请求失败时搜索结果列表不发生更新",
590
+ "用户关闭弹窗时已保存的单位不发生变化",
591
+ ]) {
592
+ assert.deepEqual(stateFindings(stateSpec(overview)), [], `must pass: ${overview}`);
593
+ }
594
+ });
595
+
596
+ test("an overview merging two states into one no-change line is a warning", () => {
597
+ const merged = stateFindings(stateSpec("天气数据未取得成功或数据为空时,列表不发生更新"));
598
+ assert.equal(merged.length, 1);
599
+ assert.equal(merged[0].level, "warn");
600
+ assert.deepEqual(
601
+ stateFindings(stateSpec("天气数据未取得成功时,列表不发生更新")),
602
+ []
603
+ );
604
+ });
605
+
606
+ // ---- State list: one row per state -------------------------------------------
607
+
608
+ const ALL_STATES = [
609
+ "- 首帧:显示 `%1$d km/h` 与 `0%`",
610
+ "- 加载中:显示刷新指示",
611
+ "- 成功:显示地点列表",
612
+ "- 数据为空:显示空列表",
613
+ "- 数据不足:显示已返回的条目",
614
+ "- 失败:弹出 toast “Couldn't get the name of the area”",
615
+ "- 非默认语言:时刻显示 “Сейчас”",
616
+ "- 离开后重新进入:恢复上一次的列表",
617
+ ];
618
+
619
+ /** A structurally valid page-flow spec with the given state rows. */
620
+ function stateListSpec(rows: string[]): string {
621
+ return [
622
+ "# 列表SPEC",
623
+ "",
624
+ "## UI序列",
625
+ "列表-状态",
626
+ "",
627
+ "## 数据契约",
628
+ "不涉及外部数据",
629
+ "",
630
+ "## 状态清单",
631
+ "",
632
+ ...rows,
633
+ "",
634
+ "## 场景一",
635
+ "- 1. 请求返回后列表更新",
636
+ "",
637
+ ].join("\n");
638
+ }
639
+
640
+ const stateListFindings = (text: string, required = false) =>
641
+ checkSpecText(text, { requireStateList: required }).filter((f) => f.rule.startsWith("state-space(State-List)"));
642
+
643
+ test("a page flow with all eight state rows passes", () => {
644
+ assert.deepEqual(stateListFindings(stateListSpec(ALL_STATES), true), []);
645
+ });
646
+
647
+ test("a missing state row is an error when the list is required", () => {
648
+ const findings = stateListFindings(
649
+ stateListSpec(ALL_STATES.filter((row) => !row.startsWith("- 加载中"))),
650
+ true
651
+ );
652
+ assert.equal(findings.length, 1);
653
+ assert.match(findings[0].note, /加载中/);
654
+ });
655
+
656
+ test("the state list is optional outside page flows, but its shape is always judged", () => {
657
+ const without = "# 列表SPEC\n\n## UI序列\n列表-状态\n\n## 场景一\n- 1. 请求返回后列表更新\n";
658
+ assert.deepEqual(stateListFindings(without, false), []);
659
+ assert.equal(stateListFindings(without, true).length, 1);
660
+ const empty = stateListFindings(stateListSpec(["- 加载中:"]), false);
661
+ assert.equal(empty.length, 1);
662
+ assert.match(empty[0].note, /empty state cell/);
663
+ const noReason = stateListFindings(stateListSpec(["- 加载中:不适用"]), false);
664
+ assert.equal(noReason.length, 1);
665
+ assert.match(noReason[0].note, /needs a reason/);
666
+ const catchAll = stateListFindings(stateListSpec(["- 失败:否则不发生更新"]), false);
667
+ assert.ok(catchAll.some((f) => /catch-all/.test(f.note)));
668
+ });
669
+
670
+ test("the state list must sit between `## UI序列` and the first scenario", () => {
671
+ const text = [
672
+ "# 列表SPEC", "", "## UI序列", "列表-状态", "", "## 场景一",
673
+ "- 1. 请求返回后列表更新", "", "## 状态清单", "", ...ALL_STATES, "",
674
+ ].join("\n");
675
+ const findings = checkSpecText(text).filter((f) => f.rule === "structure");
676
+ assert.ok(findings.some((f) => /must sit between/.test(f.note)), JSON.stringify(findings));
677
+ });