@rayu-dev/rayu-cli 1.1.7 → 1.1.9

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": "@rayu-dev/rayu-cli",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "description": "Rayu-CLI — a multi-provider AI coding CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  const fs = require('fs');
4
+ const os = require('os');
5
+ const path = require('path');
4
6
 
5
7
  const message = [
6
8
  '',
@@ -22,13 +24,25 @@ const message = [
22
24
  '',
23
25
  ].join('\n') + '\n';
24
26
 
25
- // npm v7+ buffers lifecycle script stdout write directly to /dev/tty
26
- // so the message always appears in the user's terminal
27
+ // Write the first-run marker so the binary does not show the message again
28
+ function writeMarker() {
29
+ try {
30
+ const dir = path.join(os.homedir(), '.rayu');
31
+ fs.mkdirSync(dir, { recursive: true });
32
+ fs.writeFileSync(path.join(dir, '.installed'), 'postinstall', 'utf8');
33
+ } catch (_) {}
34
+ }
35
+
36
+ // npm v7+ pipes lifecycle script stdout/stderr, so we open /dev/tty directly
37
+ // to write straight to the user's terminal (proven to work with PTY parent).
27
38
  try {
28
- const tty = fs.openSync('/dev/tty', 'w');
29
- fs.writeSync(tty, message);
30
- fs.closeSync(tty);
39
+ const fd = fs.openSync('/dev/tty', 'w');
40
+ fs.writeSync(fd, message);
41
+ fs.closeSync(fd);
42
+ // Postinstall showed the message — mark as done so binary skips it
43
+ writeMarker();
31
44
  } catch (_) {
32
- // /dev/tty unavailable (Windows, CI) — fall back to stdout
45
+ // No controlling terminal (CI, Docker, Windows) — fall through.
46
+ // The binary will show the message on the user's first rayu run instead.
33
47
  process.stdout.write(message);
34
48
  }