@buaa_smat/hometrans 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/config-store.js +8 -0
- package/dist/cli/config.js +1 -0
- package/dist/cli/init.js +30 -1
- package/dist/context/index.js +5 -1
- package/package.json +3 -2
- /package/{agents → tools}/test-tools/autotest/README.md +0 -0
- /package/{agents → tools}/test-tools/autotest/config.yaml.example +0 -0
- /package/{agents → tools}/test-tools/autotest/pyproject.toml +0 -0
- /package/{agents → tools}/test-tools/autotest/report_tool.py +0 -0
- /package/{agents → tools}/test-tools/autotest/self_test_runner.py +0 -0
- /package/{agents → tools}/test-tools/autotest/testcases_schema.md +0 -0
- /package/{agents → tools}/test-tools/autotest/testcases_tool.py +0 -0
- /package/{agents → tools}/test-tools/autotest/uv.lock +0 -0
- /package/{agents → tools}/test-tools/harmony_autotest-0.1.0-py3-none-any.whl +0 -0
- /package/{agents → tools}/test-tools/hypium-6.1.0.210-py3-none-any.whl +0 -0
- /package/{agents → tools}/test-tools/hypium_mcp-0.6.5-py3-none-any.whl +0 -0
- /package/{agents → tools}/test-tools/xdevice-6.1.0.210-py3-none-any.whl +0 -0
- /package/{agents → tools}/test-tools/xdevice_devicetest-6.1.0.210-py3-none-any.whl +0 -0
- /package/{agents → tools}/test-tools/xdevice_ohos-6.1.0.210-py3-none-any.whl +0 -0
package/dist/cli/config-store.js
CHANGED
|
@@ -14,6 +14,10 @@ export function getConfigDir() {
|
|
|
14
14
|
export function getConfigPath() {
|
|
15
15
|
return path.join(getConfigDir(), 'config.json');
|
|
16
16
|
}
|
|
17
|
+
/** 工具目录:~/.hometrans/tools,`ht init` 把打包的 tools/ 拷贝到此。 */
|
|
18
|
+
export function getToolsDir() {
|
|
19
|
+
return path.join(getConfigDir(), 'tools');
|
|
20
|
+
}
|
|
17
21
|
/** 把 ~/foo 展开为 $HOME/foo;非 ~ 开头原样返回。 */
|
|
18
22
|
export function expandHome(p) {
|
|
19
23
|
if (!p)
|
|
@@ -100,6 +104,7 @@ export async function loadHomeTransConfig() {
|
|
|
100
104
|
const config = {
|
|
101
105
|
editors: defaultEditors(),
|
|
102
106
|
params: defaultUserParams(),
|
|
107
|
+
tool_path: '',
|
|
103
108
|
};
|
|
104
109
|
await fs.mkdir(getConfigDir(), { recursive: true });
|
|
105
110
|
await fs.writeFile(configPath, JSON.stringify(config, null, 2) + '\n', 'utf-8');
|
|
@@ -125,6 +130,9 @@ export async function loadHomeTransConfig() {
|
|
|
125
130
|
else {
|
|
126
131
|
config.params = { ...defaultUserParams(), ...config.params };
|
|
127
132
|
}
|
|
133
|
+
if (typeof config.tool_path !== 'string') {
|
|
134
|
+
config.tool_path = '';
|
|
135
|
+
}
|
|
128
136
|
delete config.sdkPaths;
|
|
129
137
|
return config;
|
|
130
138
|
}
|
package/dist/cli/config.js
CHANGED
|
@@ -26,6 +26,7 @@ export async function configCommand() {
|
|
|
26
26
|
console.log(` OHOS_SDK_PATH : ${config.params.OHOS_SDK_PATH || '(not set)'}`);
|
|
27
27
|
console.log(` HMS_SDK_PATH : ${config.params.HMS_SDK_PATH || '(not set)'}`);
|
|
28
28
|
console.log(` TEST_API_KEY : ${maskedKey}`);
|
|
29
|
+
console.log(` tool_path : ${config.tool_path || '(not set)'}`);
|
|
29
30
|
console.log('');
|
|
30
31
|
// Full config content
|
|
31
32
|
console.log(' Full Content:');
|
package/dist/cli/init.js
CHANGED
|
@@ -13,7 +13,7 @@ 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, saveHomeTransConfig, } from './config-store.js';
|
|
16
|
+
import { expandHome, getConfigPath, getToolsDir, loadHomeTransConfig, saveHomeTransConfig, } from './config-store.js';
|
|
17
17
|
function ensureChalkColor() {
|
|
18
18
|
if (process.stdout.isTTY && chalk.level === 0) {
|
|
19
19
|
chalk.level = 1;
|
|
@@ -50,6 +50,23 @@ function resolveSkillsRoot() {
|
|
|
50
50
|
function resolveAgentsRoot() {
|
|
51
51
|
return path.resolve(__dirname, '..', '..', 'agents');
|
|
52
52
|
}
|
|
53
|
+
function resolveToolsRoot() {
|
|
54
|
+
return path.resolve(__dirname, '..', '..', 'tools');
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Copy the bundled `tools/` folder into ~/.hometrans/tools and record the
|
|
58
|
+
* destination in config.tool_path. Returns the destination path, or null if
|
|
59
|
+
* the package ships no tools/ folder.
|
|
60
|
+
*/
|
|
61
|
+
async function installTools(toolsRoot, config) {
|
|
62
|
+
if (!(await dirExists(toolsRoot)))
|
|
63
|
+
return null;
|
|
64
|
+
const toolsDest = getToolsDir();
|
|
65
|
+
await copyDirRecursive(toolsRoot, toolsDest);
|
|
66
|
+
config.tool_path = toolsDest;
|
|
67
|
+
await saveHomeTransConfig(config);
|
|
68
|
+
return toolsDest;
|
|
69
|
+
}
|
|
53
70
|
function resolveAutotestDir(agentsRoot) {
|
|
54
71
|
return path.join(agentsRoot, 'test-tools', 'autotest');
|
|
55
72
|
}
|
|
@@ -198,6 +215,7 @@ export async function initCommand(options = {}) {
|
|
|
198
215
|
console.log(chalk.gray('\n Android-to-HarmonyOS skill & agent installer for AI editors\n'));
|
|
199
216
|
const skillsRoot = resolveSkillsRoot();
|
|
200
217
|
const agentsRoot = resolveAgentsRoot();
|
|
218
|
+
const toolsRoot = resolveToolsRoot();
|
|
201
219
|
const hasSkills = await dirExists(skillsRoot);
|
|
202
220
|
const hasAgents = await dirExists(agentsRoot);
|
|
203
221
|
if (!hasSkills && !hasAgents) {
|
|
@@ -296,6 +314,17 @@ export async function initCommand(options = {}) {
|
|
|
296
314
|
catch (err) {
|
|
297
315
|
console.log(chalk.red(` ! autotest config.yaml: ${err.message}`));
|
|
298
316
|
}
|
|
317
|
+
// Copy bundled tools/ into ~/.hometrans/tools and record tool_path.
|
|
318
|
+
try {
|
|
319
|
+
const toolsDest = await installTools(toolsRoot, config);
|
|
320
|
+
if (toolsDest) {
|
|
321
|
+
console.log(chalk.green(` + tools copied -> ${prettyHome(toolsDest)}`));
|
|
322
|
+
console.log(chalk.gray(` tool_path set in ${prettyHome(getConfigPath())}`));
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
catch (err) {
|
|
326
|
+
console.log(chalk.red(` ! tools copy: ${err.message}`));
|
|
327
|
+
}
|
|
299
328
|
console.log('');
|
|
300
329
|
const editorsToSetup = editors.filter((e) => selectedEditors.includes(e.name));
|
|
301
330
|
const result = { configured: [], skipped: [], errors: [] };
|
package/dist/context/index.js
CHANGED
|
@@ -96,7 +96,8 @@ async function loadHomeTransConfig() {
|
|
|
96
96
|
if (!await fileExists(configPath)) {
|
|
97
97
|
const config2 = {
|
|
98
98
|
editors: defaultEditors(),
|
|
99
|
-
params: defaultUserParams()
|
|
99
|
+
params: defaultUserParams(),
|
|
100
|
+
tool_path: ""
|
|
100
101
|
};
|
|
101
102
|
await fs.mkdir(getConfigDir(), { recursive: true });
|
|
102
103
|
await fs.writeFile(configPath, JSON.stringify(config2, null, 2) + "\n", "utf-8");
|
|
@@ -123,6 +124,9 @@ async function loadHomeTransConfig() {
|
|
|
123
124
|
} else {
|
|
124
125
|
config.params = { ...defaultUserParams(), ...config.params };
|
|
125
126
|
}
|
|
127
|
+
if (typeof config.tool_path !== "string") {
|
|
128
|
+
config.tool_path = "";
|
|
129
|
+
}
|
|
126
130
|
delete config.sdkPaths;
|
|
127
131
|
return config;
|
|
128
132
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buaa_smat/hometrans",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "HomeTrans (Android-to-HarmonyOS) skill + agent installer. Run `ht init` to distribute conversion skills and subagents into AI editors.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"dist",
|
|
13
13
|
"skills",
|
|
14
|
-
"agents"
|
|
14
|
+
"agents",
|
|
15
|
+
"tools"
|
|
15
16
|
],
|
|
16
17
|
"scripts": {
|
|
17
18
|
"build": "node scripts/build.js",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|