@web-auto/camo 0.1.16 → 0.1.18

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": "@web-auto/camo",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "Camoufox Browser CLI - Cross-platform browser automation",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { fileURLToPath } from 'node:url';
3
3
  import path from 'node:path';
4
+ import { readFileSync } from 'node:fs';
4
5
  import { listProfiles, getDefaultProfile, loadConfig, hasStartScript, setRepoRoot } from './utils/config.mjs';
5
6
  import { printHelp, printProfilesAndHint } from './utils/help.mjs';
6
7
  import { handleProfileCommand } from './commands/profile.mjs';
@@ -34,6 +35,19 @@ import { ensureProgressEventDaemon } from './events/daemon.mjs';
34
35
 
35
36
  const CURRENT_DIR = path.dirname(fileURLToPath(import.meta.url));
36
37
  const START_SCRIPT_REL = path.join('runtime', 'infra', 'utils', 'scripts', 'service', 'start-browser-service.mjs');
38
+ const PACKAGE_JSON_PATH = path.resolve(CURRENT_DIR, '..', 'package.json');
39
+
40
+ function readCliVersion() {
41
+ try {
42
+ const raw = JSON.parse(readFileSync(PACKAGE_JSON_PATH, 'utf8'));
43
+ const version = String(raw?.version || '').trim();
44
+ return version || '0.0.0';
45
+ } catch {
46
+ return '0.0.0';
47
+ }
48
+ }
49
+
50
+ const CLI_VERSION = readCliVersion();
37
51
 
38
52
  function readFlagValue(args, names) {
39
53
  for (let i = 0; i < args.length; i += 1) {
@@ -177,6 +191,11 @@ async function main() {
177
191
  return;
178
192
  }
179
193
 
194
+ if (cmd === 'version' || cmd === '--version' || cmd === '-v') {
195
+ console.log(CLI_VERSION);
196
+ return;
197
+ }
198
+
180
199
  if (cmd === '__session-watchdog') {
181
200
  await handleSessionWatchdogCommand(args);
182
201
  return;
@@ -96,6 +96,7 @@ SYSTEM:
96
96
 
97
97
  SYSTEM:
98
98
  shutdown Shutdown browser-service (stops all sessions)
99
+ version | --version | -v Print camo CLI version
99
100
  help
100
101
 
101
102
  EXAMPLES: