@mohitkumawat/warmup-cli 1.2.8 → 1.2.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": "@mohitkumawat/warmup-cli",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "description": "Pre-warm your Claude rate limits while you sleep. One command, zero daily effort.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -32,21 +32,21 @@
32
32
  },
33
33
  "homepage": "https://github.com/mohit-kumawat/warmup#readme",
34
34
  "dependencies": {
35
+ "boxen": "^5.1.2",
35
36
  "chalk": "^4.1.2",
36
37
  "commander": "^11.1.0",
37
- "inquirer": "^8.2.6",
38
- "ora": "^5.4.1",
39
- "boxen": "^5.1.2",
40
38
  "figures": "^3.2.0",
41
39
  "gradient-string": "^2.0.2",
40
+ "inquirer": "^8.2.6",
41
+ "ora": "^5.4.1",
42
42
  "string-width": "^4.2.3"
43
43
  },
44
44
  "devDependencies": {
45
- "@types/inquirer": "^8.2.10",
46
45
  "@types/gradient-string": "^1.1.6",
46
+ "@types/inquirer": "^8.2.10",
47
47
  "@types/node": "^20.11.0",
48
- "typescript": "^5.3.3",
49
- "ts-node": "^10.9.2"
48
+ "ts-node": "^10.9.2",
49
+ "typescript": "^5.3.3"
50
50
  },
51
51
  "engines": {
52
52
  "node": ">=16.0.0"
@@ -20,27 +20,28 @@ Starting initial setup...
20
20
 
21
21
  process.stdout.write(message);
22
22
 
23
- // Automatically trigger "warmup setup" if we are in an interactive terminal
24
- if (process.stdout.isTTY) {
25
- try {
26
- const { execSync } = require('child_process');
27
-
28
- // We run it synchronously so the user is immediately dropped into the setup prompt
23
+ // Automatically trigger "warmup setup" if possible
24
+ try {
25
+ const { execSync } = require('child_process');
26
+ const fs = require('fs');
27
+
28
+ // npm often pipes stdout/stderr during postinstall, obscuring interactive prompts.
29
+ // By reading/writing directly to the TTY device, we ensure the prompt is visible.
30
+ if (fs.existsSync('/dev/tty')) {
31
+ const tty = fs.openSync('/dev/tty', 'r+');
32
+ execSync('warmup setup', { stdio: [tty, tty, tty] });
33
+ } else if (process.stdout.isTTY) {
34
+ // Fallback for Windows or environments without /dev/tty but with interactive stdout
29
35
  execSync('warmup setup', { stdio: 'inherit' });
30
- } catch (err) {
31
- // If the warmup command isn't immediately available or fails, fallback to instructions
32
- const fallbackMessage = `
33
- ${bright}${yellow}Could not automatically start setup.${reset}
34
- To finish the setup and start pre-warming Claude, please run:
35
- ${bright}${cyan} warmup setup${reset}
36
- `;
37
- process.stdout.write(fallbackMessage);
36
+ } else {
37
+ throw new Error('No interactive terminal available');
38
38
  }
39
- } else {
40
- // CI/CD or non-interactive environments
39
+ } catch (err) {
40
+ // If the warmup command isn't immediately available, fails, or we're in CI
41
41
  const fallbackMessage = `
42
+ ${bright}${yellow}Could not automatically start setup.${reset}
42
43
  To finish the setup and start pre-warming Claude, please run:
43
- ${bright}${yellow} warmup setup${reset}
44
+ ${bright}${cyan} warmup setup${reset}
44
45
  `;
45
46
  process.stdout.write(fallbackMessage);
46
47
  }