@buaa_smat/hometrans 0.1.0 → 0.1.2

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 (136) hide show
  1. package/README.md +141 -124
  2. package/agents/build-fixer.md +1 -0
  3. package/agents/code-review-fix.md +1 -0
  4. package/agents/code-reviewer.md +1 -0
  5. package/agents/logic-coding.md +1 -0
  6. package/agents/logic-context-builder.md +1 -0
  7. package/agents/review-fixer.md +1 -0
  8. package/agents/self-test-fixer.md +1 -0
  9. package/agents/self-tester.md +260 -233
  10. package/agents/spec-generator.md +1 -0
  11. package/agents/test-tools/autotest/README.md +223 -0
  12. package/agents/test-tools/autotest/config.yaml.example +58 -0
  13. package/agents/test-tools/autotest/pyproject.toml +16 -0
  14. package/agents/test-tools/autotest/report_tool.py +759 -0
  15. package/agents/test-tools/autotest/self_test_runner.py +773 -0
  16. package/agents/test-tools/autotest/testcases_schema.md +143 -0
  17. package/agents/test-tools/autotest/testcases_tool.py +215 -0
  18. package/agents/test-tools/autotest/uv.lock +3156 -0
  19. package/agents/test-tools/harmony_autotest-0.1.0-py3-none-any.whl +0 -0
  20. package/agents/test-tools/hypium-6.1.0.210-py3-none-any.whl +0 -0
  21. package/agents/test-tools/hypium_mcp-0.6.5-py3-none-any.whl +0 -0
  22. package/agents/test-tools/xdevice-6.1.0.210-py3-none-any.whl +0 -0
  23. package/agents/test-tools/xdevice_devicetest-6.1.0.210-py3-none-any.whl +0 -0
  24. package/agents/test-tools/xdevice_ohos-6.1.0.210-py3-none-any.whl +0 -0
  25. package/dist/cli/config-store.js +27 -2
  26. package/dist/cli/config.js +17 -6
  27. package/dist/cli/index.js +3 -2
  28. package/dist/cli/init.js +135 -22
  29. package/dist/cli/mcp.js +2 -2
  30. package/dist/context/index.js +165 -69
  31. package/package.json +59 -60
  32. package/skills/code-dev-review-fix/SKILL.md +279 -0
  33. package/skills/code-dev-review-fix-workspace/evals/evals.json +56 -0
  34. package/skills/code-dev-review-fix-workspace/iteration-1/routing-results.md +23 -0
  35. package/skills/convert_pipeline/SKILL.md +423 -439
  36. package/skills/hmos-resources-convert/SKILL.md +623 -0
  37. package/skills/hmos-resources-convert/evals/evals.json +171 -0
  38. package/skills/hmos-resources-convert/references/conversion-rules.md +663 -0
  39. package/skills/hmos-resources-convert/references/dependency-analysis-rules.md +388 -0
  40. package/skills/hmos-resources-convert/references/resource-mapping-rules.md +457 -0
  41. package/skills/hmos-resources-convert/references/xml-drawable-to-svg-rules.md +513 -0
  42. package/skills/hmos-resources-convert/template/AppScope/app.json5 +10 -0
  43. package/skills/hmos-resources-convert/template/AppScope/resources/base/element/string.json +8 -0
  44. package/skills/hmos-resources-convert/template/AppScope/resources/base/media/background.png +0 -0
  45. package/skills/hmos-resources-convert/template/AppScope/resources/base/media/foreground.png +0 -0
  46. package/skills/hmos-resources-convert/template/AppScope/resources/base/media/layered_image.json +7 -0
  47. package/skills/hmos-resources-convert/template/build-profile.json5 +42 -0
  48. package/skills/hmos-resources-convert/template/code-linter.json5 +32 -0
  49. package/skills/hmos-resources-convert/template/entry/build-profile.json5 +33 -0
  50. package/skills/hmos-resources-convert/template/entry/hvigorfile.ts +6 -0
  51. package/skills/hmos-resources-convert/template/entry/obfuscation-rules.txt +23 -0
  52. package/skills/hmos-resources-convert/template/entry/oh-package.json5 +10 -0
  53. package/skills/hmos-resources-convert/template/entry/src/main/ets/entryability/EntryAbility.ets +48 -0
  54. package/skills/hmos-resources-convert/template/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +16 -0
  55. package/skills/hmos-resources-convert/template/entry/src/main/ets/pages/Index.ets +23 -0
  56. package/skills/hmos-resources-convert/template/entry/src/main/module.json5 +55 -0
  57. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/color.json +8 -0
  58. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/float.json +8 -0
  59. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/string.json +16 -0
  60. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/background.png +0 -0
  61. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/foreground.png +0 -0
  62. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/layered_image.json +7 -0
  63. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/startIcon.png +0 -0
  64. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/profile/backup_config.json +3 -0
  65. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/profile/main_pages.json +5 -0
  66. package/skills/hmos-resources-convert/template/entry/src/main/resources/dark/element/color.json +8 -0
  67. package/skills/hmos-resources-convert/template/entry/src/mock/mock-config.json5 +2 -0
  68. package/skills/hmos-resources-convert/template/entry/src/ohosTest/ets/test/Ability.test.ets +35 -0
  69. package/skills/hmos-resources-convert/template/entry/src/ohosTest/ets/test/List.test.ets +5 -0
  70. package/skills/hmos-resources-convert/template/entry/src/ohosTest/module.json5 +16 -0
  71. package/skills/hmos-resources-convert/template/entry/src/test/List.test.ets +5 -0
  72. package/skills/hmos-resources-convert/template/entry/src/test/LocalUnit.test.ets +33 -0
  73. package/skills/hmos-resources-convert/template/hvigor/hvigor-config.json5 +23 -0
  74. package/skills/hmos-resources-convert/template/hvigorfile.ts +6 -0
  75. package/skills/hmos-resources-convert/template/oh-package-lock.json5 +28 -0
  76. package/skills/hmos-resources-convert/template/oh-package.json5 +10 -0
  77. package/skills/hmos-resources-convert/tools/apktool.bat +85 -0
  78. package/skills/hmos-resources-convert/tools/apktool_3.0.1.jar +0 -0
  79. package/skills/hmos-ui-align/SKILL.md +182 -0
  80. package/skills/hmos-ui-align/config-example.json +11 -0
  81. package/skills/hmos-ui-align/config.json +11 -0
  82. package/skills/hmos-ui-align/diff_analysis.md +53 -0
  83. package/skills/hmos-ui-align/page_align.md +62 -0
  84. package/skills/hmos-ui-align/readme.md +231 -0
  85. package/skills/hmos-ui-align/references/Comparison_Template.md +2 -0
  86. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Link/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/217/214/345/220/221/345/220/214/346/255/245.md +648 -0
  87. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Observed/350/243/205/351/245/260/345/231/250/345/222/214@ObjectLink/350/243/205/351/245/260/345/231/250/357/274/232/345/265/214/345/245/227/347/261/273/345/257/271/350/261/241/345/261/236/346/200/247/345/217/230/345/214/226.md +2089 -0
  88. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Prop/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/215/225/345/220/221/345/220/214/346/255/245.md +1033 -0
  89. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Provide/350/243/205/351/245/260/345/231/250/345/222/214@Consume/350/243/205/351/245/260/345/231/250/357/274/232/344/270/216/345/220/216/344/273/243/347/273/204/344/273/266/345/217/214/345/220/221/345/220/214/346/255/245.md +1183 -0
  90. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@State/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/347/212/266/346/200/201.md +576 -0
  91. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Track/350/243/205/351/245/260/345/231/250/357/274/232class/345/257/271/350/261/241/345/261/236/346/200/247/347/272/247/346/233/264/346/226/260.md +297 -0
  92. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Watch/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/346/233/264/346/224/271/351/200/232/347/237/245.md +395 -0
  93. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/AppStorage/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200/347/232/204UI/347/212/266/346/200/201/345/255/230/345/202/250.md +903 -0
  94. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md +106 -0
  95. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/LocalStorage/357/274/232/351/241/265/351/235/242/347/272/247UI/347/212/266/346/200/201/345/255/230/345/202/250.md +1178 -0
  96. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/MVVM/346/250/241/345/274/217V1.md +911 -0
  97. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md +911 -0
  98. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/PersistentStorage/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +355 -0
  99. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243//347/256/241/347/220/206/345/272/224/347/224/250/346/213/245/346/234/211/347/232/204/347/212/266/346/200/201/346/246/202/350/277/260.md +11 -0
  100. package/skills/hmos-ui-align/references/UI_Analysis_Template.md +4 -0
  101. package/skills/hmos-ui-align/references/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2535 -0
  102. package/skills/hmos-ui-align/references/android-to-harmonyOS-ui-interaction-mapping-reference.md +555 -0
  103. package/skills/hmos-ui-align/references/android-to-harmonyOS-ui-layout-mapping-reference.md +117 -0
  104. package/skills/hmos-ui-align/scripts/app_feature_verify.py +443 -0
  105. package/skills/hmos-ui-align/scripts/navigation-capure.md +37 -0
  106. package/skills/hmos-ui-align/scripts/page_capture.py +592 -0
  107. package/skills/hmos-ui-align-batch/SKILL.md +99 -0
  108. package/skills/hmos-ui-align-batch/references/conversion-procedure.md +180 -0
  109. package/skills/hmos-ui-align-batch/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2535 -0
  110. package/skills/hmos-ui-align-batch/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +555 -0
  111. package/skills/hmos-ui-align-batch/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +117 -0
  112. package/skills/hmos-ui-align-batch/references/mvvm/@Link/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/217/214/345/220/221/345/220/214/346/255/245.md +648 -0
  113. package/skills/hmos-ui-align-batch/references/mvvm/@Observed/350/243/205/351/245/260/345/231/250/345/222/214@ObjectLink/350/243/205/351/245/260/345/231/250/357/274/232/345/265/214/345/245/227/347/261/273/345/257/271/350/261/241/345/261/236/346/200/247/345/217/230/345/214/226.md +2089 -0
  114. package/skills/hmos-ui-align-batch/references/mvvm/@Prop/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/215/225/345/220/221/345/220/214/346/255/245.md +1033 -0
  115. package/skills/hmos-ui-align-batch/references/mvvm/@Provide/350/243/205/351/245/260/345/231/250/345/222/214@Consume/350/243/205/351/245/260/345/231/250/357/274/232/344/270/216/345/220/216/344/273/243/347/273/204/344/273/266/345/217/214/345/220/221/345/220/214/346/255/245.md +1183 -0
  116. package/skills/hmos-ui-align-batch/references/mvvm/@State/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/347/212/266/346/200/201.md +576 -0
  117. package/skills/hmos-ui-align-batch/references/mvvm/@Track/350/243/205/351/245/260/345/231/250/357/274/232class/345/257/271/350/261/241/345/261/236/346/200/247/347/272/247/346/233/264/346/226/260.md +297 -0
  118. package/skills/hmos-ui-align-batch/references/mvvm/@Watch/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/346/233/264/346/224/271/351/200/232/347/237/245.md +395 -0
  119. package/skills/hmos-ui-align-batch/references/mvvm/AppStorage/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200/347/232/204UI/347/212/266/346/200/201/345/255/230/345/202/250.md +903 -0
  120. package/skills/hmos-ui-align-batch/references/mvvm/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md +106 -0
  121. package/skills/hmos-ui-align-batch/references/mvvm/LocalStorage/357/274/232/351/241/265/351/235/242/347/272/247UI/347/212/266/346/200/201/345/255/230/345/202/250.md +1178 -0
  122. package/skills/hmos-ui-align-batch/references/mvvm/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md +911 -0
  123. package/skills/hmos-ui-align-batch/references/mvvm/PersistentStorage/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +355 -0
  124. package/skills/hmos-ui-align-batch/references/mvvm//347/256/241/347/220/206/345/272/224/347/224/250/346/213/245/346/234/211/347/232/204/347/212/266/346/200/201/346/246/202/350/277/260.md +11 -0
  125. package/skills/hmos-ui-align-batch/scripts/android_parse_fast.py +1606 -0
  126. package/skills/self-test/SKILL.md +369 -0
  127. package/skills/self-test/readme.md +309 -0
  128. package/skills/spec-generator-skill/SKILL.md +332 -0
  129. package/skills/spec-generator-skill/references/android-platform-tokens.md +105 -0
  130. package/skills/spec-generator-skill/references/spec-sample-1.md +78 -0
  131. package/skills/spec-generator-skill/references/spec-sample-2.md +58 -0
  132. package/skills/spec-generator-skill/references/spec-sample-3.md +116 -0
  133. package/skills/spec-generator-skill/references/step4-report-template.md +33 -0
  134. package/agents/self-test-setup.md +0 -165
  135. package/dist/context/resources/sdkConfig.json +0 -24
  136. package/src/context/resources/sdkConfig.json +0 -24
@@ -87,10 +87,20 @@ async function fileExists(p) {
87
87
  * 加载 editors 配置。文件不存在时写入默认值再返回。
88
88
  * 解析失败时抛错,避免静默覆盖用户手动修改。
89
89
  */
90
+ export function defaultUserParams() {
91
+ return {
92
+ OHOS_SDK_PATH: '',
93
+ HMS_SDK_PATH: '',
94
+ TEST_API_KEY: '',
95
+ };
96
+ }
90
97
  export async function loadHomeTransConfig() {
91
98
  const configPath = getConfigPath();
92
99
  if (!(await fileExists(configPath))) {
93
- const config = { editors: defaultEditors() };
100
+ const config = {
101
+ editors: defaultEditors(),
102
+ params: defaultUserParams(),
103
+ };
94
104
  await fs.mkdir(getConfigDir(), { recursive: true });
95
105
  await fs.writeFile(configPath, JSON.stringify(config, null, 2) + '\n', 'utf-8');
96
106
  return config;
@@ -106,5 +116,20 @@ export async function loadHomeTransConfig() {
106
116
  if (!parsed || typeof parsed !== 'object' || !Array.isArray(parsed.editors)) {
107
117
  throw new Error(`Invalid config.json shape at ${configPath}: top-level must be { "editors": [...] }.`);
108
118
  }
109
- return parsed;
119
+ const config = parsed;
120
+ // Migrate legacy `sdkPaths` field, fill in any missing params keys.
121
+ const legacy = parsed.sdkPaths;
122
+ if (!config.params) {
123
+ config.params = { ...defaultUserParams(), ...(legacy ?? {}) };
124
+ }
125
+ else {
126
+ config.params = { ...defaultUserParams(), ...config.params };
127
+ }
128
+ delete config.sdkPaths;
129
+ return config;
130
+ }
131
+ export async function saveHomeTransConfig(config) {
132
+ const configPath = getConfigPath();
133
+ await fs.mkdir(getConfigDir(), { recursive: true });
134
+ await fs.writeFile(configPath, JSON.stringify(config, null, 2) + '\n', 'utf-8');
110
135
  }
@@ -8,21 +8,32 @@ import fs from 'node:fs/promises';
8
8
  import { getConfigPath, loadHomeTransConfig } from './config-store.js';
9
9
  export async function configCommand() {
10
10
  const configPath = getConfigPath();
11
- // 触发不存在则写默认值的逻辑
12
- await loadHomeTransConfig();
11
+ const config = await loadHomeTransConfig();
13
12
  const raw = await fs.readFile(configPath, 'utf-8');
14
13
  console.log('');
15
- console.log(' HomeTrans Editor Config');
16
- console.log(' =======================');
14
+ console.log(' HomeTrans Config');
15
+ console.log(' ================');
17
16
  console.log('');
18
17
  console.log(` Path: ${configPath}`);
19
18
  console.log('');
20
- console.log(' Content:');
19
+ // User parameters
20
+ const maskedKey = config.params.TEST_API_KEY
21
+ ? config.params.TEST_API_KEY.slice(0, 4) +
22
+ '***' +
23
+ config.params.TEST_API_KEY.slice(-4)
24
+ : '(not set)';
25
+ console.log(' Parameters:');
26
+ console.log(` OHOS_SDK_PATH : ${config.params.OHOS_SDK_PATH || '(not set)'}`);
27
+ console.log(` HMS_SDK_PATH : ${config.params.HMS_SDK_PATH || '(not set)'}`);
28
+ console.log(` TEST_API_KEY : ${maskedKey}`);
29
+ console.log('');
30
+ // Full config content
31
+ console.log(' Full Content:');
21
32
  console.log('');
22
33
  for (const line of raw.replace(/\r?\n$/, '').split(/\r?\n/)) {
23
34
  console.log(` ${line}`);
24
35
  }
25
36
  console.log('');
26
- console.log(' Edit this file to add or modify editors, then re-run `ht init`.');
37
+ console.log(' Edit this file to modify config, then re-run `ht init`.');
27
38
  console.log('');
28
39
  }
package/dist/cli/index.js CHANGED
@@ -15,8 +15,9 @@ program
15
15
  program
16
16
  .command('init')
17
17
  .description('Initialize HomeTrans — select editors and install skills, agents, and MCP servers')
18
- .action(async () => {
19
- await initCommand();
18
+ .option('-a, --all', 'Skip interactive selection and configure all editors')
19
+ .action(async (opts) => {
20
+ await initCommand(opts);
20
21
  });
21
22
  program
22
23
  .command('mcp')
package/dist/cli/init.js CHANGED
@@ -13,7 +13,12 @@ import chalk from 'chalk';
13
13
  import figlet from 'figlet';
14
14
  import inquirer from 'inquirer';
15
15
  import { setupMcpForAllEditors } from './mcp-setup.js';
16
- import { expandHome, loadHomeTransConfig, } from './config-store.js';
16
+ import { expandHome, loadHomeTransConfig, saveHomeTransConfig, } from './config-store.js';
17
+ function ensureChalkColor() {
18
+ if (process.stdout.isTTY && chalk.level === 0) {
19
+ chalk.level = 1;
20
+ }
21
+ }
17
22
  const __filename = fileURLToPath(import.meta.url);
18
23
  const __dirname = path.dirname(__filename);
19
24
  export async function dirExists(dirPath) {
@@ -45,6 +50,50 @@ function resolveSkillsRoot() {
45
50
  function resolveAgentsRoot() {
46
51
  return path.resolve(__dirname, '..', '..', 'agents');
47
52
  }
53
+ function resolveAutotestDir(agentsRoot) {
54
+ return path.join(agentsRoot, 'test-tools', 'autotest');
55
+ }
56
+ /**
57
+ * Initialize / refresh `agents/test-tools/autotest/config.yaml`:
58
+ * - If config.yaml does not exist, seed it from config.yaml.example.
59
+ * - Replace every `api_key: "..."` line with the supplied apiKey.
60
+ *
61
+ * Returns a status string for the result summary, or null if nothing was done
62
+ * (e.g., the autotest folder isn't present in this package).
63
+ */
64
+ async function refreshAutotestConfig(autotestDir, apiKey) {
65
+ const examplePath = path.join(autotestDir, 'config.yaml.example');
66
+ const configPath = path.join(autotestDir, 'config.yaml');
67
+ const hasExample = await fs
68
+ .access(examplePath)
69
+ .then(() => true)
70
+ .catch(() => false);
71
+ if (!hasExample)
72
+ return null;
73
+ let seeded = false;
74
+ const hasConfig = await fs
75
+ .access(configPath)
76
+ .then(() => true)
77
+ .catch(() => false);
78
+ if (!hasConfig) {
79
+ await fs.copyFile(examplePath, configPath);
80
+ seeded = true;
81
+ }
82
+ if (!apiKey) {
83
+ return seeded
84
+ ? `autotest config.yaml seeded (api_key left as placeholder)`
85
+ : null;
86
+ }
87
+ const original = await fs.readFile(configPath, 'utf-8');
88
+ // Match `api_key: <value>` with optional quoting, preserve indent + key.
89
+ const updated = original.replace(/^(\s*api_key\s*:\s*)(?:"[^"]*"|'[^']*'|\S+)\s*$/gm, (_m, prefix) => `${prefix}"${apiKey}"`);
90
+ if (updated !== original) {
91
+ await fs.writeFile(configPath, updated, 'utf-8');
92
+ }
93
+ return seeded
94
+ ? `autotest config.yaml seeded + api_key filled`
95
+ : `autotest config.yaml api_key refreshed`;
96
+ }
48
97
  async function installSkillsTo(skillsRoot, targetDir) {
49
98
  let entries;
50
99
  try {
@@ -142,7 +191,8 @@ async function detectInstalledEditors(editors) {
142
191
  }
143
192
  return status;
144
193
  }
145
- export async function initCommand() {
194
+ export async function initCommand(options = {}) {
195
+ ensureChalkColor();
146
196
  const banner = figlet.textSync('HomeTrans', { font: 'Standard' });
147
197
  console.log(chalk.cyan(`\n${banner.trimEnd()}`));
148
198
  console.log(chalk.gray('\n Android-to-HarmonyOS skill & agent installer for AI editors\n'));
@@ -158,31 +208,94 @@ export async function initCommand() {
158
208
  process.exitCode = 1;
159
209
  return;
160
210
  }
161
- const { editors } = await loadHomeTransConfig();
211
+ const config = await loadHomeTransConfig();
212
+ const { editors } = config;
162
213
  const installedStatus = await detectInstalledEditors(editors);
163
- const choices = editors.map((editor) => {
164
- const installed = installedStatus.get(editor.name);
165
- const label = installed
166
- ? `${editor.name} ${chalk.green('(detected)')}`
167
- : `${editor.name} ${chalk.gray('(not detected)')}`;
168
- return {
169
- name: label,
170
- value: editor.name,
171
- checked: installed,
172
- };
173
- });
174
- const { selectedEditors } = await inquirer.prompt([
175
- {
176
- type: 'checkbox',
177
- name: 'selectedEditors',
178
- message: 'Select editors to configure:',
179
- choices,
180
- },
181
- ]);
214
+ let selectedEditors;
215
+ if (options.all) {
216
+ selectedEditors = editors.map((e) => e.name);
217
+ console.log(chalk.blue(' --all: selecting all editors.\n'));
218
+ }
219
+ else {
220
+ const choices = editors.map((editor) => {
221
+ const installed = installedStatus.get(editor.name);
222
+ const label = installed
223
+ ? `${editor.name} ${chalk.green('(detected)')}`
224
+ : `${editor.name} ${chalk.gray('(not detected)')}`;
225
+ return {
226
+ name: label,
227
+ value: editor.name,
228
+ checked: installed,
229
+ };
230
+ });
231
+ try {
232
+ const answers = await inquirer.prompt([
233
+ {
234
+ type: 'checkbox',
235
+ name: 'selectedEditors',
236
+ message: 'Select editors to configure (arrow keys + space to toggle, enter to confirm):',
237
+ choices,
238
+ },
239
+ ]);
240
+ selectedEditors = answers.selectedEditors;
241
+ }
242
+ catch {
243
+ console.log(chalk.yellow('\n Interactive selection failed. Auto-selecting all detected editors.'));
244
+ console.log(chalk.gray(' Tip: use --all to skip interactive selection.\n'));
245
+ selectedEditors = editors
246
+ .filter((e) => installedStatus.get(e.name))
247
+ .map((e) => e.name);
248
+ }
249
+ }
182
250
  if (selectedEditors.length === 0) {
183
251
  console.log(chalk.yellow('\n No editors selected. Nothing to do.\n'));
184
252
  return;
185
253
  }
254
+ // --- User parameters (SDK paths, test API key) ---
255
+ console.log('');
256
+ console.log(chalk.blue(' Parameter Configuration'));
257
+ console.log(chalk.gray(' (press Enter to keep current value or leave empty)\n'));
258
+ try {
259
+ const answers = await inquirer.prompt([
260
+ {
261
+ type: 'input',
262
+ name: 'OHOS_SDK_PATH',
263
+ message: 'OHOS_SDK_PATH:',
264
+ default: config.params.OHOS_SDK_PATH || undefined,
265
+ },
266
+ {
267
+ type: 'input',
268
+ name: 'HMS_SDK_PATH',
269
+ message: 'HMS_SDK_PATH:',
270
+ default: config.params.HMS_SDK_PATH || undefined,
271
+ },
272
+ {
273
+ type: 'input',
274
+ name: 'TEST_API_KEY',
275
+ message: 'TEST_API_KEY (for autotest config.yaml):',
276
+ default: config.params.TEST_API_KEY || undefined,
277
+ },
278
+ ]);
279
+ config.params.OHOS_SDK_PATH = answers.OHOS_SDK_PATH.trim();
280
+ config.params.HMS_SDK_PATH = answers.HMS_SDK_PATH.trim();
281
+ config.params.TEST_API_KEY = answers.TEST_API_KEY.trim();
282
+ await saveHomeTransConfig(config);
283
+ }
284
+ catch {
285
+ console.log(chalk.yellow(' Parameter prompts skipped (non-interactive mode).'));
286
+ }
287
+ // Initialize / refresh autotest config.yaml from the example template.
288
+ try {
289
+ const autotestDir = resolveAutotestDir(agentsRoot);
290
+ const status = await refreshAutotestConfig(autotestDir, config.params.TEST_API_KEY);
291
+ if (status) {
292
+ console.log(chalk.green(` + ${status}`));
293
+ console.log(chalk.gray(` ${path.join(autotestDir, 'config.yaml')}`));
294
+ }
295
+ }
296
+ catch (err) {
297
+ console.log(chalk.red(` ! autotest config.yaml: ${err.message}`));
298
+ }
186
299
  console.log('');
187
300
  const editorsToSetup = editors.filter((e) => selectedEditors.includes(e.name));
188
301
  const result = { configured: [], skipped: [], errors: [] };
package/dist/cli/mcp.js CHANGED
@@ -34,11 +34,11 @@ const EXTRACT_COMMIT_CONTEXT_TOOL = {
34
34
  },
35
35
  ohosSdkPath: {
36
36
  type: 'string',
37
- description: 'OpenHarmony SDK ETS 目录绝对路径(如 D:/DevEco Studio/sdk/default/openharmony/ets)。未传则读环境变量 HOMETRANS_OHOS_SDK_PATH。',
37
+ description: 'OpenHarmony SDK ETS 目录绝对路径(如 D:/DevEco Studio/sdk/default/openharmony/ets)。未传则读环境变量 OHOS_SDK_PATH。',
38
38
  },
39
39
  hmsSdkPath: {
40
40
  type: 'string',
41
- description: 'HMS SDK ETS 目录绝对路径(如 D:/DevEco Studio/sdk/default/hms/ets)。未传则读环境变量 HOMETRANS_HMS_SDK_PATH。',
41
+ description: 'HMS SDK ETS 目录绝对路径(如 D:/DevEco Studio/sdk/default/hms/ets)。未传则读环境变量 HMS_SDK_PATH。',
42
42
  },
43
43
  },
44
44
  required: ['projectPath', 'commitId'],