visor-ai 0.2.6 → 0.2.7

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/adapters.js CHANGED
@@ -373,11 +373,11 @@ export class RealAppiumAdapter {
373
373
  async tapPoint(x, y) {
374
374
  const driver = this.requireDriver();
375
375
  if (this.platform === 'android') {
376
- await driver.execute('mobile: clickGesture', [{ x, y }]);
376
+ await driver.execute('mobile: clickGesture', { x, y });
377
377
  return;
378
378
  }
379
379
  if (this.platform === 'ios') {
380
- await driver.execute('mobile: tap', [{ x, y }]);
380
+ await driver.execute('mobile: tap', { x, y });
381
381
  return;
382
382
  }
383
383
  throw new Error(`Coordinate tap is unsupported for platform: ${this.platform}`);
@@ -390,16 +390,26 @@ export class RealAppiumAdapter {
390
390
  const width = Math.max(1, Math.round(size.width * 0.8));
391
391
  const height = Math.max(1, Math.round(size.height * 0.8));
392
392
  if (this.platform === 'android') {
393
- await driver.execute('mobile: scrollGesture', [
394
- { left, top, width, height, direction, percent: gesturePercent }
395
- ]);
393
+ await driver.execute('mobile: scrollGesture', {
394
+ left,
395
+ top,
396
+ width,
397
+ height,
398
+ direction,
399
+ percent: gesturePercent
400
+ });
396
401
  return;
397
402
  }
398
403
  if (this.platform === 'ios') {
399
404
  try {
400
- await driver.execute('mobile: scrollGesture', [
401
- { left, top, width, height, direction, percent: gesturePercent }
402
- ]);
405
+ await driver.execute('mobile: scrollGesture', {
406
+ left,
407
+ top,
408
+ width,
409
+ height,
410
+ direction,
411
+ percent: gesturePercent
412
+ });
403
413
  return;
404
414
  }
405
415
  catch {
package/dist/cli.js CHANGED
@@ -1,3 +1,4 @@
1
+ import fs from 'node:fs';
1
2
  import { DEFAULT_SERVER_URL } from './adapters.js';
2
3
  import { DaemonRequestTimeoutError, DaemonUnavailableError, runDaemonAction, runDaemonScenario, startVisorDaemon, statusVisorDaemon, stopVisorDaemon } from './daemon.js';
3
4
  import { DeviceSelectionError, resolveRunningDevice } from './devices.js';
@@ -6,6 +7,15 @@ import { writeReports } from './report.js';
6
7
  import { determinismCheck } from './runner.js';
7
8
  import { errorMessage, makeId, utcNowIso } from './utils.js';
8
9
  import { parseAndValidate } from './validator.js';
10
+ function packageVersion() {
11
+ try {
12
+ const packageJson = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
13
+ return typeof packageJson.version === 'string' ? packageJson.version : 'unknown';
14
+ }
15
+ catch {
16
+ return 'unknown';
17
+ }
18
+ }
9
19
  const ACTION_COMMANDS = new Set([
10
20
  'tap',
11
21
  'navigate',
@@ -102,7 +112,8 @@ function helpText() {
102
112
  '',
103
113
  'Usage:',
104
114
  ' visor <command> [options]',
105
- ' visor --help',
115
+ ' visor --help | -h',
116
+ ' visor --version | -v',
106
117
  '',
107
118
  'Commands:',
108
119
  ' validate <scenario>',
@@ -119,7 +130,7 @@ function helpText() {
119
130
  ' visor start --server-url http://127.0.0.1:4723',
120
131
  ' visor run scenarios/checkout-smoke.json --output artifacts-test',
121
132
  ' visor scroll --device emulator-5554 --direction down',
122
- ' node dist/main.js status'
133
+ ' visor status'
123
134
  ].join('\n');
124
135
  }
125
136
  function envelopeOk(commandId, startedAt, artifacts = [], nextAction = '') {
@@ -262,11 +273,22 @@ function cmdHelp() {
262
273
  'visor start --server-url http://127.0.0.1:4723',
263
274
  'visor run scenarios/checkout-smoke.json --output artifacts-test',
264
275
  'visor scroll --device emulator-5554 --direction down',
265
- 'node dist/main.js status'
276
+ 'visor status'
266
277
  ]
267
278
  };
268
279
  return { code: 0, response };
269
280
  }
281
+ function cmdVersion() {
282
+ const commandId = makeId('cmd');
283
+ const startedAt = utcNowIso();
284
+ const version = packageVersion();
285
+ const response = envelopeOk(commandId, startedAt, [], 'none');
286
+ response.data = {
287
+ version,
288
+ versionText: version
289
+ };
290
+ return { code: 0, response };
291
+ }
270
292
  export async function cmdValidate(parsed) {
271
293
  const commandId = makeId('cmd');
272
294
  const startedAt = utcNowIso();
@@ -557,6 +579,9 @@ export async function executeCommand(argv) {
557
579
  argv.includes('-h')) {
558
580
  return cmdHelp();
559
581
  }
582
+ if (argv.includes('--version') || argv.includes('-v')) {
583
+ return cmdVersion();
584
+ }
560
585
  const parsed = parseCommand(argv);
561
586
  if (parsed.command === 'validate') {
562
587
  return cmdValidate(parsed);
package/dist/main.js CHANGED
@@ -12,6 +12,12 @@ function isHelpData(value) {
12
12
  'usageText' in value &&
13
13
  typeof value.usageText === 'string');
14
14
  }
15
+ function isVersionData(value) {
16
+ return Boolean(value &&
17
+ typeof value === 'object' &&
18
+ 'versionText' in value &&
19
+ typeof value.versionText === 'string');
20
+ }
15
21
  async function main(argv = process.argv.slice(2)) {
16
22
  try {
17
23
  if (argv[0] === '__daemon') {
@@ -22,6 +28,9 @@ async function main(argv = process.argv.slice(2)) {
22
28
  if (isHelpData(result.response.data)) {
23
29
  console.log(result.response.data.usageText);
24
30
  }
31
+ else if (isVersionData(result.response.data)) {
32
+ console.log(result.response.data.versionText);
33
+ }
25
34
  else {
26
35
  console.log(JSON.stringify(result.response, null, 2));
27
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "visor-ai",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Visor CLI for LLM-driven mobile app interaction and artifact capture",
5
5
  "type": "module",
6
6
  "license": "MIT",