mobile-automator 0.31.0 → 0.31.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobile-automator",
3
- "version": "0.31.0",
3
+ "version": "0.31.2",
4
4
  "description": "Host-agnostic mauto CLI for AI-driven mobile QA automation — analyzes a mobile project and drives devices through mobile-mcp.",
5
5
  "homepage": "https://github.com/sh3lan93/mobile-automator#readme",
6
6
  "repository": {
@@ -282,4 +282,8 @@ function evaluate(assertion = {}, ctx = {}) {
282
282
  return result(type, true, pass, message);
283
283
  }
284
284
 
285
- module.exports = { MECHANICAL_TYPES, evaluate };
285
+ // `matches`/`findFirst` are exported for the real-device E2E harness
286
+ // (sample-app/scripts/lib/resolve.js), which resolves tap targets with THIS
287
+ // matcher so the harness and `mauto assert` can never disagree about what a
288
+ // target string means (#94).
289
+ module.exports = { MECHANICAL_TYPES, evaluate, matches, findFirst };
@@ -12,14 +12,14 @@
12
12
 
13
13
  const fs = require('fs');
14
14
  const path = require('path');
15
- const Ajv = require('ajv');
16
15
 
17
16
  const { formatError } = require('../schemas/format-error');
17
+ const { createCliAjv } = require('../schemas/cli-ajv');
18
18
 
19
19
  const CONFIG_SCHEMA_PATH = path.resolve(__dirname, '../schemas/config_schema.json');
20
20
 
21
21
  const schema = JSON.parse(fs.readFileSync(CONFIG_SCHEMA_PATH, 'utf8'));
22
- const ajv = new Ajv({ allErrors: true, strict: false });
22
+ const ajv = createCliAjv();
23
23
 
24
24
  // Resolve a local `$ref` ("#/definitions/stringList") to a fixpoint: a
25
25
  // resolved node may itself be another `$ref` (e.g. a `$ref` to a `$ref`), so
@@ -2,9 +2,9 @@
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
- const Ajv = require('ajv');
6
5
 
7
6
  const { formatError } = require('../schemas/format-error');
7
+ const { createCliAjv } = require('../schemas/cli-ajv');
8
8
 
9
9
  // Path to the canonical scenario schema, bundled inside the package.
10
10
  // src/scenario/validator.js -> ../schemas/scenario_schema.json
@@ -13,7 +13,7 @@ const DEFAULT_SCHEMA_PATH = path.resolve(__dirname, '../schemas/scenario_schema.
13
13
  class ScenarioValidator {
14
14
  constructor({ schemaPath = DEFAULT_SCHEMA_PATH } = {}) {
15
15
  const schema = JSON.parse(fs.readFileSync(schemaPath, 'utf8'));
16
- const ajv = new Ajv({ allErrors: true, strict: false });
16
+ const ajv = createCliAjv();
17
17
  this._validateFn = ajv.compile(schema);
18
18
  }
19
19
 
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+
3
+ // The only place the CLI's Ajv instance is constructed (#191).
4
+ //
5
+ // There used to be two hand-copied `new Ajv({ allErrors: true, strict: false })`
6
+ // literals — one in src/config/schema.js, one in src/scenario/validator.js —
7
+ // plus a third mirror in the schema lint guard tied to them by nothing but a
8
+ // comment. Three copies of "the CLI's own options" that nothing kept true:
9
+ // change the options in src and the guard would keep vouching for the old
10
+ // ones. A guard that hand-maintains a copy of the thing it guards is itself a
11
+ // drift surface — the same lesson that produced docs-corpus.js.
12
+ //
13
+ // Everything that needs the CLI's Ajv — both call sites above, the unit tests
14
+ // that validate envelopes against the shipped schemas, and
15
+ // tests/lint/schemas-valid.test.js, which compiles every schema with the real
16
+ // instance — now consumes this factory. That guard also fails on any other
17
+ // construction site in src/ or bin/, so the options cannot quietly return as
18
+ // literals.
19
+
20
+ const Ajv = require('ajv');
21
+
22
+ // allErrors: true — `mauto validate` and config validation report every
23
+ // problem in one pass, not just the first one they hit.
24
+ // strict: false — result_schema.json declares `format: "date-time"` and no
25
+ // instance here registers formats, so strict mode would turn Ajv's warning
26
+ // into an error. The CLI tolerates the warning rather than claim format
27
+ // checking it does not actually do.
28
+ function createCliAjv() {
29
+ return new Ajv({ allErrors: true, strict: false });
30
+ }
31
+
32
+ module.exports = { createCliAjv };