@hmharness/domain-harmony 0.8.0 → 0.13.1

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/emulator.js CHANGED
@@ -26,7 +26,21 @@ export function imageRoot() {
26
26
  return join(localAppData(), 'Huawei', 'Sdk');
27
27
  }
28
28
  function emulatorExe() {
29
- return join(process.env.HM_DEVECO_HOME ?? 'C:\\DevEco-Studio', 'tools', 'emulator', 'Emulator.exe');
29
+ // same discoverability contract as findHdc: honor HM_DEVECO_HOME, then
30
+ // probe the standard install locations. The bare-drive default missed the
31
+ // common "Program Files" install and broke every emulator tool on stock
32
+ // DevEco setups (day-18 SELFFEED: the agent had to fake a junction).
33
+ if (process.env.HM_DEVECO_HOME)
34
+ return join(process.env.HM_DEVECO_HOME, 'tools', 'emulator', 'Emulator.exe');
35
+ for (const home of ['C:\\Program Files\\Huawei\\DevEco Studio', 'D:\\Program Files\\Huawei\\DevEco Studio', 'C:\\DevEco-Studio']) {
36
+ const cand = join(home, 'tools', 'emulator', 'Emulator.exe');
37
+ try {
38
+ accessSync(cand);
39
+ return cand;
40
+ }
41
+ catch { /* next */ }
42
+ }
43
+ return join('C:\\DevEco-Studio', 'tools', 'emulator', 'Emulator.exe');
30
44
  }
31
45
  async function readLists() {
32
46
  try {
package/dist/index.d.ts CHANGED
@@ -14,7 +14,7 @@ export { parseSdkVersion, compareSdk, capabilitiesFor, CAPABILITY_MATRIX, type S
14
14
  export { harmonyBuildDoctor, diagnoseBuildFailure, firstErrorBlock } from './builddoctor.ts';
15
15
  export { harmonyProjectProfile, profileProject } from './profile.ts';
16
16
  export { harmonySign, resolveSigningIdentity, ensureDebugProfile, signHap, hapsignToolPaths, type SigningIdentity } from './signing.ts';
17
- export { harmonyDeviceTest, runDeviceTest, type DeviceTestStep } from './ondevice.ts';
17
+ export { harmonyDeviceTest, runDeviceTest, type DeviceTestStep, type DeviceTestOptions } from './ondevice.ts';
18
18
  export { harmonyApiLookup, buildApiIndex, loadApiIndex, lookupSymbol, parseDeclaration, sdkApiDir, type ApiIndex, type ApiSymbolEntry } from './apikg.ts';
19
19
  export { harmonyUiRegression, runUiRegression, captureDeviceScreen, type UiRegressionCase, type UiRegressionResult } from './uiregress.ts';
20
20
  export { harmonyImageDownloadCheck } from './emulator.ts';
package/dist/index.js CHANGED
@@ -23,7 +23,19 @@ import { harmonyApiLookup } from "./apikg.js";
23
23
  import { harmonyUiRegression } from "./uiregress.js";
24
24
  const exec = promisify(execFile);
25
25
  function devecoHome() {
26
- return process.env.HM_DEVECO_HOME ?? 'C:\\DevEco-Studio';
26
+ if (process.env.HM_DEVECO_HOME)
27
+ return process.env.HM_DEVECO_HOME;
28
+ // standard install locations probed in order: the old bare-drive default
29
+ // missed the common "Program Files" install and broke every device tool
30
+ // on stock DevEco setups (mcp-serve round-trip test caught it)
31
+ for (const home of ['C:\\Program Files\\Huawei\\DevEco Studio', 'D:\\Program Files\\Huawei\\DevEco Studio', 'C:\\DevEco-Studio']) {
32
+ try {
33
+ accessSync(join(home, 'sdk', 'default', 'openharmony', 'toolchains', 'hdc.exe'));
34
+ return home;
35
+ }
36
+ catch { /* next */ }
37
+ }
38
+ return 'C:\\DevEco-Studio';
27
39
  }
28
40
  async function run(cmd, args, timeoutMs = 20_000, cwd, extraEnv) {
29
41
  try {
package/dist/ondevice.js CHANGED
@@ -38,10 +38,12 @@ export async function runDeviceTest(o) {
38
38
  }
39
39
  });
40
40
  const steps = [];
41
- // 1. install
42
- let r = await run(['install', '-r', o.hap], 120_000);
41
+ // 1. install - hdc mangles mixed-separator paths into "cwd + G:/..." on
42
+ // Windows: always hand it a resolved native absolute path
43
+ const hapNative = resolve(o.hap);
44
+ let r = await run(['install', '-r', hapNative], 120_000);
43
45
  if (!r.ok || /fail/i.test(r.out))
44
- r = await run(['app', 'install', '-r', o.hap], 120_000);
46
+ r = await run(['app', 'install', '-r', hapNative], 120_000);
45
47
  steps.push({ step: 'install', pass: r.ok && /success/i.test(r.out), detail: r.out.slice(0, 200) });
46
48
  if (!steps[0].pass)
47
49
  return steps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/domain-harmony",
3
- "version": "0.8.0",
3
+ "version": "0.13.1",
4
4
  "description": "hmharness HarmonyOS domain core: device, toolchain, build, and project lifecycle capabilities. HarmonyOS is the framework's native domain, not an add-on.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",