@mohitkumawat/warmup-cli 1.2.7 → 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 +7 -7
- package/scripts/postinstall.js +27 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mohitkumawat/warmup-cli",
|
|
3
|
-
"version": "1.2.
|
|
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
|
-
"
|
|
49
|
-
"
|
|
48
|
+
"ts-node": "^10.9.2",
|
|
49
|
+
"typescript": "^5.3.3"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": ">=16.0.0"
|
package/scripts/postinstall.js
CHANGED
|
@@ -15,17 +15,33 @@ const cyan = '\x1b[36m';
|
|
|
15
15
|
|
|
16
16
|
const message = `
|
|
17
17
|
${bright}${green}WarmUp CLI has been installed successfully!${reset}
|
|
18
|
-
|
|
19
|
-
To finish the setup and start pre-warming Claude, please run:
|
|
20
|
-
${bright}${yellow} warmup setup${reset}
|
|
21
|
-
|
|
22
|
-
${bright}${cyan}Why run setup?${reset}
|
|
23
|
-
- It configures your daily work schedule.
|
|
24
|
-
- It calculates the optimal 5-hour window.
|
|
25
|
-
- It installs the background scheduler for your OS.
|
|
26
|
-
|
|
27
|
-
${bright}Note:${reset} Ensure Claude Code is already installed and authenticated.
|
|
28
|
-
Check the docs at: ${cyan}https://github.com/mohit-kumawat/warmup${reset}
|
|
18
|
+
Starting initial setup...
|
|
29
19
|
`;
|
|
30
20
|
|
|
31
21
|
process.stdout.write(message);
|
|
22
|
+
|
|
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
|
|
35
|
+
execSync('warmup setup', { stdio: 'inherit' });
|
|
36
|
+
} else {
|
|
37
|
+
throw new Error('No interactive terminal available');
|
|
38
|
+
}
|
|
39
|
+
} catch (err) {
|
|
40
|
+
// If the warmup command isn't immediately available, fails, or we're in CI
|
|
41
|
+
const fallbackMessage = `
|
|
42
|
+
${bright}${yellow}Could not automatically start setup.${reset}
|
|
43
|
+
To finish the setup and start pre-warming Claude, please run:
|
|
44
|
+
${bright}${cyan} warmup setup${reset}
|
|
45
|
+
`;
|
|
46
|
+
process.stdout.write(fallbackMessage);
|
|
47
|
+
}
|