yaver-cli 1.99.3 → 1.99.5

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": "yaver-cli",
3
- "version": "1.99.3",
3
+ "version": "1.99.5",
4
4
  "mcpName": "io.github.kivanccakmak/yaver",
5
5
  "description": "Unified npm bootstrap for the Yaver agent, SDK injection, and local-first developer runtime",
6
6
  "bin": {
@@ -2,7 +2,7 @@ const fs = require('fs');
2
2
  const { analyzeProject } = require('../analyzer');
3
3
  const { loadSDKManifest } = require('../sdk-manifest');
4
4
 
5
- async function doctor() {
5
+ async function doctor(options = {}) {
6
6
  if (!fs.existsSync('package.json')) {
7
7
  console.error('❌ No package.json found. Run this from your RN project root.');
8
8
  process.exit(1);
@@ -84,6 +84,15 @@ async function doctor() {
84
84
  console.log(` ${analysis.missingModules.length} missing (push with --ignore-missing)`);
85
85
  console.log(` ${analysis.warnings.length} warnings`);
86
86
  console.log(` ${hardErrors.length} critical issues\n`);
87
+
88
+ if (options.strict) {
89
+ const failCount = hardErrors.length + analysis.missingModules.length;
90
+ if (failCount > 0) {
91
+ console.error(`❌ doctor --strict: ${hardErrors.length} critical issue(s), ${analysis.missingModules.length} missing module(s)`);
92
+ process.exit(1);
93
+ }
94
+ console.log('✅ doctor --strict: project is Yaver-compatible');
95
+ }
87
96
  }
88
97
 
89
98
  module.exports = { doctor };
@@ -12,19 +12,26 @@ async function push(options = {}) {
12
12
  const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
13
13
  const sdkManifest = loadSDKManifest();
14
14
 
15
- // Find device
16
- if (!quiet) console.log('📡 Finding device...');
17
- const device = await discoverDevice(options.device);
18
- if (!quiet) console.log(`✅ Found: ${device.name} (${device.ip})`);
19
-
20
- // Fetch health + verify SDK
21
- const health = await fetchHealth(device);
22
- const platform = health.platform || 'ios';
23
-
24
- if (health.hermes?.bytecodeVersion !== sdkManifest.hermes.bytecodeVersion) {
25
- console.error(`�� Hermes BC mismatch: device BC${health.hermes?.bytecodeVersion}, CLI BC${sdkManifest.hermes.bytecodeVersion}`);
26
- console.error(' Update the npm package or the yaver.io app.');
27
- process.exit(1);
15
+ let device = null;
16
+ let platform = options.platform || 'ios';
17
+
18
+ if (!options.bundleOnly) {
19
+ // Find device
20
+ if (!quiet) console.log('📡 Finding device...');
21
+ device = await discoverDevice(options.device);
22
+ if (!quiet) console.log(`✅ Found: ${device.name} (${device.ip})`);
23
+
24
+ // Fetch health + verify SDK
25
+ const health = await fetchHealth(device);
26
+ platform = health.platform || 'ios';
27
+
28
+ if (health.hermes?.bytecodeVersion !== sdkManifest.hermes.bytecodeVersion) {
29
+ console.error(`❌ Hermes BC mismatch: device BC${health.hermes?.bytecodeVersion}, CLI BC${sdkManifest.hermes.bytecodeVersion}`);
30
+ console.error(' Update the npm package or the yaver.io app.');
31
+ process.exit(1);
32
+ }
33
+ } else if (!quiet) {
34
+ console.log(`📦 Bundle-only mode (no device push, platform=${platform})`);
28
35
  }
29
36
 
30
37
  // Analyze compatibility
@@ -65,9 +72,16 @@ async function push(options = {}) {
65
72
  process.exit(1);
66
73
  }
67
74
 
68
- // Push
69
75
  const moduleName = getModuleName(pkg);
70
76
  const bundleData = fs.readFileSync(bundlePath);
77
+
78
+ if (options.bundleOnly) {
79
+ const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
80
+ if (!quiet) console.log(`\n📦 Bundle ready in ${elapsed}s — ${(bundleData.length / 1024).toFixed(1)} KB at ${bundlePath}\n`);
81
+ return;
82
+ }
83
+
84
+ // Push
71
85
  if (!quiet) console.log(`📤 Pushing ${(bundleData.length / 1024).toFixed(1)} KB...`);
72
86
 
73
87
  const result = await pushBundle(device, bundleData, {
package/src/index.js CHANGED
@@ -15,7 +15,8 @@ Commands:
15
15
  init Analyze project, show compatibility, create yaver.json
16
16
  push [--device <ip>] [--watch] Bundle + validate + push to device
17
17
  push --ignore-missing Push even with missing native modules
18
- doctor Deep compatibility report with fix suggestions
18
+ push --bundle-only [--platform P] Bundle + Hermes compile without pushing (CI)
19
+ doctor [--strict] Deep compatibility report (non-zero exit in --strict)
19
20
  devices List discovered devices
20
21
  modules List all SDK native modules
21
22
  reset [--device <ip>] Clear pushed bundle on device
@@ -161,6 +162,12 @@ function parseArgs(args) {
161
162
  opts.watch = true;
162
163
  } else if (arg === '--ignore-missing') {
163
164
  opts.ignoreMissing = true;
165
+ } else if (arg === '--strict') {
166
+ opts.strict = true;
167
+ } else if (arg === '--bundle-only') {
168
+ opts.bundleOnly = true;
169
+ } else if (arg === '--platform' && args[i + 1]) {
170
+ opts.platform = args[++i];
164
171
  } else if (arg === '--force') {
165
172
  opts.force = true;
166
173
  } else if (arg === '--quiet' || arg === '-q') {
@@ -7,6 +7,10 @@
7
7
  // Must NEVER fail npm install. This is best-effort bootstrap only.
8
8
 
9
9
  const { ensureAgentBinary, runAgentCommand } = require("./agent-runtime");
10
+ const { execSync } = require("child_process");
11
+ const fs = require("fs");
12
+ const os = require("os");
13
+ const path = require("path");
10
14
 
11
15
  function envEnabled(name) {
12
16
  const raw = String(process.env[name] || "").trim().toLowerCase();
@@ -24,6 +28,58 @@ function log(message) {
24
28
  console.error(`[yaver postinstall] ${message}`);
25
29
  }
26
30
 
31
+ // Make sure `yaver` resolves on PATH for the next shell session. npm's
32
+ // global prefix (e.g. ~/.npm-global/bin) is not on PATH by default on
33
+ // most Linux distros — so `npm install -g yaver-cli` succeeds but
34
+ // `yaver auth` then exits with command-not-found. That is the #1 fail
35
+ // mode on fresh machines, so we self-heal by appending a one-line,
36
+ // idempotent PATH export into the user's shell rc files. Never throws.
37
+ function ensurePathOnUnix() {
38
+ try {
39
+ if (process.platform === "win32") return; // Windows users have Scoop/Winget
40
+ const prefix = (process.env.npm_config_prefix || "").trim();
41
+ if (!prefix) return;
42
+ const binDir = path.join(prefix, "bin");
43
+ if (!fs.existsSync(path.join(binDir, "yaver"))) return;
44
+
45
+ const currentPath = (process.env.PATH || "").split(path.delimiter);
46
+ if (currentPath.includes(binDir)) return;
47
+
48
+ // Also confirm `yaver` isn't already findable under a different name
49
+ // (e.g. brew-installed /opt/homebrew/bin/yaver takes precedence).
50
+ try {
51
+ const found = execSync("command -v yaver", { stdio: ["ignore", "pipe", "ignore"] })
52
+ .toString()
53
+ .trim();
54
+ if (found) return;
55
+ } catch (_) {
56
+ // `command -v` returns nonzero when not found — fall through and patch PATH.
57
+ }
58
+
59
+ const home = os.homedir();
60
+ const rcFiles = [".bashrc", ".zshrc", ".profile"]
61
+ .map((f) => path.join(home, f))
62
+ .filter((p) => fs.existsSync(p));
63
+
64
+ const marker = "# yaver-cli PATH";
65
+ const line = `case \":$PATH:\" in *\":${binDir}:\"*) ;; *) export PATH=\"${binDir}:$PATH\" ;; esac`;
66
+ const block = `\n${marker} (added by yaver-cli postinstall)\n${line}\n`;
67
+
68
+ let patched = false;
69
+ for (const rc of rcFiles) {
70
+ const content = fs.readFileSync(rc, "utf8");
71
+ if (content.includes(marker)) continue;
72
+ fs.appendFileSync(rc, block);
73
+ patched = true;
74
+ }
75
+ if (patched) {
76
+ log(`Added ${binDir} to PATH in shell rc files. Run 'exec $SHELL -l' or open a new terminal.`);
77
+ }
78
+ } catch (err) {
79
+ // Best-effort only.
80
+ }
81
+ }
82
+
27
83
  async function main() {
28
84
  if (envEnabled("YAVER_SKIP_POSTINSTALL") || envEnabled("YAVER_SKIP_POSTINSTALL_BOOTSTRAP")) {
29
85
  return;
@@ -39,6 +95,8 @@ async function main() {
39
95
  return;
40
96
  }
41
97
 
98
+ ensurePathOnUnix();
99
+
42
100
  if (process.platform !== "linux" && process.platform !== "darwin") {
43
101
  return;
44
102
  }