@mohitkumawat/warmup-cli 1.1.2
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/LICENSE +21 -0
- package/README.md +107 -0
- package/dist/commands/execute.d.ts +6 -0
- package/dist/commands/execute.d.ts.map +1 -0
- package/dist/commands/execute.js +52 -0
- package/dist/commands/execute.js.map +1 -0
- package/dist/commands/pause.d.ts +2 -0
- package/dist/commands/pause.d.ts.map +1 -0
- package/dist/commands/pause.js +18 -0
- package/dist/commands/pause.js.map +1 -0
- package/dist/commands/resume.d.ts +2 -0
- package/dist/commands/resume.d.ts.map +1 -0
- package/dist/commands/resume.js +18 -0
- package/dist/commands/resume.js.map +1 -0
- package/dist/commands/setup.d.ts +2 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +173 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +14 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/test.d.ts +2 -0
- package/dist/commands/test.d.ts.map +1 -0
- package/dist/commands/test.js +27 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/commands/uninstall.d.ts +2 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +38 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/update.d.ts +2 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +112 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/config.d.ts +51 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +320 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +113 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime.d.ts +9 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +91 -0
- package/dist/runtime.js.map +1 -0
- package/dist/scheduler/index.d.ts +15 -0
- package/dist/scheduler/index.d.ts.map +1 -0
- package/dist/scheduler/index.js +103 -0
- package/dist/scheduler/index.js.map +1 -0
- package/dist/scheduler/linux.d.ts +12 -0
- package/dist/scheduler/linux.d.ts.map +1 -0
- package/dist/scheduler/linux.js +301 -0
- package/dist/scheduler/linux.js.map +1 -0
- package/dist/scheduler/macos.d.ts +16 -0
- package/dist/scheduler/macos.d.ts.map +1 -0
- package/dist/scheduler/macos.js +170 -0
- package/dist/scheduler/macos.js.map +1 -0
- package/dist/scheduler/windows.d.ts +14 -0
- package/dist/scheduler/windows.d.ts.map +1 -0
- package/dist/scheduler/windows.js +139 -0
- package/dist/scheduler/windows.js.map +1 -0
- package/dist/ui.d.ts +19 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +329 -0
- package/dist/ui.js.map +1 -0
- package/dist/warmup.d.ts +32 -0
- package/dist/warmup.d.ts.map +1 -0
- package/dist/warmup.js +154 -0
- package/dist/warmup.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.updateCommand = updateCommand;
|
|
7
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const ora_1 = __importDefault(require("ora"));
|
|
10
|
+
const config_1 = require("../config");
|
|
11
|
+
const scheduler_1 = require("../scheduler");
|
|
12
|
+
const ui_1 = require("../ui");
|
|
13
|
+
const runtime_1 = require("../runtime");
|
|
14
|
+
const ACCENT = chalk_1.default.hex('#6C5CE7');
|
|
15
|
+
const DIM = chalk_1.default.gray;
|
|
16
|
+
/** Generate choices for work start time (30 min increments) */
|
|
17
|
+
function generateStartTimeChoices() {
|
|
18
|
+
const choices = [];
|
|
19
|
+
for (let h = 0; h < 24; h++) {
|
|
20
|
+
for (const m of [0, 30]) {
|
|
21
|
+
const period = h >= 12 ? 'PM' : 'AM';
|
|
22
|
+
const h12 = h > 12 ? h - 12 : h === 0 ? 12 : h;
|
|
23
|
+
const mStr = m.toString().padStart(2, '0');
|
|
24
|
+
const label = `${h12}:${mStr} ${period}`;
|
|
25
|
+
const minutesSinceMidnight = h * 60 + m;
|
|
26
|
+
let suffix = '';
|
|
27
|
+
if (h === 9 && m === 0)
|
|
28
|
+
suffix = ' ← standard';
|
|
29
|
+
if (h === 10 && m === 0)
|
|
30
|
+
suffix = ' ← common';
|
|
31
|
+
choices.push({
|
|
32
|
+
name: `${label}${suffix}`,
|
|
33
|
+
value: minutesSinceMidnight,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return choices;
|
|
38
|
+
}
|
|
39
|
+
/** Calculate the optimal pre-warm time based on user feedback */
|
|
40
|
+
function calculateOptimalPrewarm(startMins, exhaustMins) {
|
|
41
|
+
let prewarmMins = startMins + exhaustMins - (5 * 60);
|
|
42
|
+
if (prewarmMins > startMins) {
|
|
43
|
+
prewarmMins = startMins;
|
|
44
|
+
}
|
|
45
|
+
if (prewarmMins < 0) {
|
|
46
|
+
prewarmMins += 24 * 60;
|
|
47
|
+
}
|
|
48
|
+
const h = Math.floor(prewarmMins / 60) % 24;
|
|
49
|
+
const m = prewarmMins % 60;
|
|
50
|
+
const timeStr = `${h.toString().padStart(2, '0')}:${m.toString().padStart(2, '0')}`;
|
|
51
|
+
const resetMins = (prewarmMins + 5 * 60) % (24 * 60);
|
|
52
|
+
const resetH = Math.floor(resetMins / 60);
|
|
53
|
+
const resetM = resetMins % 60;
|
|
54
|
+
const resetStr = (0, config_1.formatHour)(resetH, resetM);
|
|
55
|
+
const explanation = `To ensure your rate limit window resets completely at ${resetStr} exactly when you run out, we'll run the pre-warm at ${(0, config_1.formatHour)(h, m)}.`;
|
|
56
|
+
return { time: timeStr, h, m, explanation };
|
|
57
|
+
}
|
|
58
|
+
async function updateCommand() {
|
|
59
|
+
(0, ui_1.printMiniLogo)();
|
|
60
|
+
const config = (0, config_1.readConfig)();
|
|
61
|
+
if (!config) {
|
|
62
|
+
(0, ui_1.printNotSetup)();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const [curH, curM] = config.schedule.time.split(':').map(Number);
|
|
66
|
+
console.log(` ${DIM('Current schedule:')} ${ACCENT((0, config_1.formatHour)(curH, curM))} ${DIM(`(${config.schedule.timezone})`)}`);
|
|
67
|
+
console.log('');
|
|
68
|
+
const { startMins } = await inquirer_1.default.prompt([{
|
|
69
|
+
type: 'list',
|
|
70
|
+
name: 'startMins',
|
|
71
|
+
message: 'When do you usually start your heavy Claude usage each day?',
|
|
72
|
+
choices: generateStartTimeChoices(),
|
|
73
|
+
default: 9 * 60, // 9:00 AM
|
|
74
|
+
pageSize: 12,
|
|
75
|
+
}]);
|
|
76
|
+
const { exhaustMins } = await inquirer_1.default.prompt([{
|
|
77
|
+
type: 'list',
|
|
78
|
+
name: 'exhaustMins',
|
|
79
|
+
message: 'How quickly do you usually hit your Pro/Max rate limit after starting?',
|
|
80
|
+
choices: [
|
|
81
|
+
{ name: '< 1 hour', value: 60 },
|
|
82
|
+
{ name: '1-2 hours', value: 120 },
|
|
83
|
+
{ name: '2-3 hours', value: 180 },
|
|
84
|
+
{ name: '3-4 hours', value: 240 },
|
|
85
|
+
{ name: 'I rarely hit the limit / 5+ hours', value: 300 }
|
|
86
|
+
],
|
|
87
|
+
default: 120, // 2 hours
|
|
88
|
+
}]);
|
|
89
|
+
// Calculate
|
|
90
|
+
const { time, h, m, explanation } = calculateOptimalPrewarm(startMins, exhaustMins);
|
|
91
|
+
console.log('');
|
|
92
|
+
console.log(` ${chalk_1.default.bgCyan.black(' OPTIMAL SCHEDULE ')}`);
|
|
93
|
+
console.log(` ${chalk_1.default.cyan('💡')} ${DIM(explanation)}`);
|
|
94
|
+
console.log('');
|
|
95
|
+
const spinner = (0, ora_1.default)({
|
|
96
|
+
text: 'Updating schedule...',
|
|
97
|
+
color: 'magenta',
|
|
98
|
+
}).start();
|
|
99
|
+
try {
|
|
100
|
+
config.schedule.time = time;
|
|
101
|
+
config.schedule.enabled = true;
|
|
102
|
+
config.runtime = (0, runtime_1.resolveRuntimePaths)();
|
|
103
|
+
(0, scheduler_1.installSchedule)({ hour: h, minute: m, runtime: config.runtime });
|
|
104
|
+
(0, config_1.writeConfig)(config);
|
|
105
|
+
spinner.succeed('Schedule updated');
|
|
106
|
+
await (0, ui_1.animateSetupComplete)(config);
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
spinner.fail(`Update failed: ${err.message}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":";;;;;AA8DA,sCA+DC;AA7HD,wDAAgC;AAChC,kDAA0B;AAC1B,8CAAsB;AACtB,sCAAgE;AAChE,4CAAgE;AAChE,8BAA2E;AAC3E,wCAAiD;AAEjD,MAAM,MAAM,GAAG,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AACpC,MAAM,GAAG,GAAG,eAAK,CAAC,IAAI,CAAC;AAEvB,+DAA+D;AAC/D,SAAS,wBAAwB;IAC/B,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5B,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;YACxB,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;YACrC,MAAM,GAAG,GAAG,CAA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CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACzD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAGhB,MAAM,OAAO,GAAG,IAAA,aAAG,EAAC;QAClB,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,SAAS;KACjB,CAAC,CAAC,KAAK,EAAE,CAAC;IAEX,IAAI,CAAC;QACH,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;QAC5B,MAAM,CAAC,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;QAC/B,MAAM,CAAC,OAAO,GAAG,IAAA,6BAAmB,GAAE,CAAC;QACvC,IAAA,2BAAe,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QACjE,IAAA,oBAAW,EAAC,MAAM,CAAC,CAAC;QAEpB,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QACpC,MAAM,IAAA,yBAAoB,EAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,OAAO,CAAC,IAAI,CAAC,kBAAkB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IAChD,CAAC;AACH,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { RuntimePaths } from './runtime';
|
|
2
|
+
export interface WarmupConfig {
|
|
3
|
+
version: string;
|
|
4
|
+
schedule: {
|
|
5
|
+
time: string;
|
|
6
|
+
timezone: string;
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
};
|
|
9
|
+
runtime?: RuntimePaths;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
updatedAt: string;
|
|
12
|
+
}
|
|
13
|
+
export interface LogEntry {
|
|
14
|
+
timestamp: string;
|
|
15
|
+
status: 'success' | 'failed' | 'boot-recovery';
|
|
16
|
+
message: string;
|
|
17
|
+
tokensUsed?: number;
|
|
18
|
+
scheduledTime?: string;
|
|
19
|
+
actualTime?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function getConfigDir(): string;
|
|
22
|
+
export declare function getLogsDir(): string;
|
|
23
|
+
export declare function ensureConfigDir(): void;
|
|
24
|
+
export declare function configExists(): boolean;
|
|
25
|
+
export declare function readConfig(): WarmupConfig | null;
|
|
26
|
+
export declare function writeConfig(config: WarmupConfig): void;
|
|
27
|
+
export declare function createDefaultConfig(time: string, timezone: string, runtime: RuntimePaths): WarmupConfig;
|
|
28
|
+
export declare function getDateStringInTimezone(date: Date, timezone: string): string;
|
|
29
|
+
export declare function writeLog(entry: LogEntry, timezone: string): void;
|
|
30
|
+
export declare function getLatestLog(): LogEntry | null;
|
|
31
|
+
export declare function getLogsForDate(date: string): LogEntry[];
|
|
32
|
+
export declare function hasSuccessfulRunSince(since: Date): boolean;
|
|
33
|
+
export declare function detectTimezone(): string;
|
|
34
|
+
export declare function formatTimeLocal(date: Date, timezone: string): string;
|
|
35
|
+
export declare function formatDateTimeLocal(date: Date, timezone: string): string;
|
|
36
|
+
/** Format 24h (hour, minute) to 12-hour display string like "5:00 AM" */
|
|
37
|
+
export declare function formatHour(hour: number, min: number): string;
|
|
38
|
+
/** Get the next occurrence of the scheduled time */
|
|
39
|
+
export declare function getNextFireTime(config: WarmupConfig, now?: Date): Date;
|
|
40
|
+
/** Get the estimated window reset time (fire time + 5 hours) */
|
|
41
|
+
export declare function getWindowResetTime(fireTime: Date): Date;
|
|
42
|
+
/** Calculate how far through the 5-hour window we are (0 to 1) */
|
|
43
|
+
export declare function getWindowProgress(lastFireTime: Date): number;
|
|
44
|
+
export declare function getMinutesSinceScheduled(scheduleTime: string, timezone: string, now?: Date): number;
|
|
45
|
+
export declare function getMostRecentScheduledOccurrence(scheduleTime: string, timezone: string, now?: Date): Date;
|
|
46
|
+
/**
|
|
47
|
+
* Check if a given time (hour:minute) is approximately "now" in the user's timezone.
|
|
48
|
+
* Used to decide if the scheduler fired at the right time vs. a boot-recovery.
|
|
49
|
+
*/
|
|
50
|
+
export declare function isNearScheduledTime(scheduleTime: string, timezone: string, toleranceMinutes?: number, now?: Date): boolean;
|
|
51
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,eAAe,CAAC;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAYD,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,wBAAgB,eAAe,IAAI,IAAI,CAOtC;AAED,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED,wBAAgB,UAAU,IAAI,YAAY,GAAG,IAAI,CAqBhD;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAItD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE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;GAGG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,gBAAgB,GAAE,MAAU,EAC5B,GAAG,GAAE,IAAiB,GACrB,OAAO,CAST"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getConfigDir = getConfigDir;
|
|
40
|
+
exports.getLogsDir = getLogsDir;
|
|
41
|
+
exports.ensureConfigDir = ensureConfigDir;
|
|
42
|
+
exports.configExists = configExists;
|
|
43
|
+
exports.readConfig = readConfig;
|
|
44
|
+
exports.writeConfig = writeConfig;
|
|
45
|
+
exports.createDefaultConfig = createDefaultConfig;
|
|
46
|
+
exports.getDateStringInTimezone = getDateStringInTimezone;
|
|
47
|
+
exports.writeLog = writeLog;
|
|
48
|
+
exports.getLatestLog = getLatestLog;
|
|
49
|
+
exports.getLogsForDate = getLogsForDate;
|
|
50
|
+
exports.hasSuccessfulRunSince = hasSuccessfulRunSince;
|
|
51
|
+
exports.detectTimezone = detectTimezone;
|
|
52
|
+
exports.formatTimeLocal = formatTimeLocal;
|
|
53
|
+
exports.formatDateTimeLocal = formatDateTimeLocal;
|
|
54
|
+
exports.formatHour = formatHour;
|
|
55
|
+
exports.getNextFireTime = getNextFireTime;
|
|
56
|
+
exports.getWindowResetTime = getWindowResetTime;
|
|
57
|
+
exports.getWindowProgress = getWindowProgress;
|
|
58
|
+
exports.getMinutesSinceScheduled = getMinutesSinceScheduled;
|
|
59
|
+
exports.getMostRecentScheduledOccurrence = getMostRecentScheduledOccurrence;
|
|
60
|
+
exports.isNearScheduledTime = isNearScheduledTime;
|
|
61
|
+
const fs = __importStar(require("fs"));
|
|
62
|
+
const path = __importStar(require("path"));
|
|
63
|
+
const os = __importStar(require("os"));
|
|
64
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
65
|
+
function getWarmupBaseDir() {
|
|
66
|
+
const override = process.env.WARMUP_CONFIG_DIR;
|
|
67
|
+
return override ? path.resolve(override) : path.join(os.homedir(), '.warmup');
|
|
68
|
+
}
|
|
69
|
+
const DATE_LOG_PATTERN = /^\d{4}-\d{2}-\d{2}\.log$/;
|
|
70
|
+
const CONFIG_DIR = getWarmupBaseDir();
|
|
71
|
+
const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
|
|
72
|
+
const LOGS_DIR = path.join(CONFIG_DIR, 'logs');
|
|
73
|
+
function getConfigDir() {
|
|
74
|
+
return CONFIG_DIR;
|
|
75
|
+
}
|
|
76
|
+
function getLogsDir() {
|
|
77
|
+
return LOGS_DIR;
|
|
78
|
+
}
|
|
79
|
+
function ensureConfigDir() {
|
|
80
|
+
if (!fs.existsSync(CONFIG_DIR)) {
|
|
81
|
+
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
82
|
+
}
|
|
83
|
+
if (!fs.existsSync(LOGS_DIR)) {
|
|
84
|
+
fs.mkdirSync(LOGS_DIR, { recursive: true });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function configExists() {
|
|
88
|
+
return fs.existsSync(CONFIG_FILE);
|
|
89
|
+
}
|
|
90
|
+
function readConfig() {
|
|
91
|
+
if (!fs.existsSync(CONFIG_FILE))
|
|
92
|
+
return null;
|
|
93
|
+
try {
|
|
94
|
+
const raw = fs.readFileSync(CONFIG_FILE, 'utf-8');
|
|
95
|
+
const parsed = JSON.parse(raw);
|
|
96
|
+
if (parsed.runtime) {
|
|
97
|
+
const { nodePath, cliEntry, claudePath } = parsed.runtime;
|
|
98
|
+
if (!nodePath || !cliEntry || !claudePath) {
|
|
99
|
+
delete parsed.runtime;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return parsed;
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
console.error(chalk_1.default.yellow(' ⚠ Config file is corrupted: ') +
|
|
106
|
+
chalk_1.default.gray(CONFIG_FILE) + '\n' +
|
|
107
|
+
chalk_1.default.gray(' Run ') + chalk_1.default.hex('#6C5CE7')('warmup setup') +
|
|
108
|
+
chalk_1.default.gray(' to reconfigure.'));
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function writeConfig(config) {
|
|
113
|
+
ensureConfigDir();
|
|
114
|
+
config.updatedAt = new Date().toISOString();
|
|
115
|
+
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2), 'utf-8');
|
|
116
|
+
}
|
|
117
|
+
function createDefaultConfig(time, timezone, runtime) {
|
|
118
|
+
return {
|
|
119
|
+
version: '1.0.0',
|
|
120
|
+
schedule: {
|
|
121
|
+
time,
|
|
122
|
+
timezone,
|
|
123
|
+
enabled: true,
|
|
124
|
+
},
|
|
125
|
+
runtime,
|
|
126
|
+
createdAt: new Date().toISOString(),
|
|
127
|
+
updatedAt: new Date().toISOString(),
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
// ── Logging ──
|
|
131
|
+
let lastCleanDate = '';
|
|
132
|
+
function getDateStringInTimezone(date, timezone) {
|
|
133
|
+
const parts = new Intl.DateTimeFormat('en-US', {
|
|
134
|
+
timeZone: timezone,
|
|
135
|
+
year: 'numeric',
|
|
136
|
+
month: '2-digit',
|
|
137
|
+
day: '2-digit',
|
|
138
|
+
}).formatToParts(date);
|
|
139
|
+
const values = new Map(parts.map(part => [part.type, part.value]));
|
|
140
|
+
return `${values.get('year')}-${values.get('month')}-${values.get('day')}`;
|
|
141
|
+
}
|
|
142
|
+
function getDatedLogFiles() {
|
|
143
|
+
if (!fs.existsSync(LOGS_DIR))
|
|
144
|
+
return [];
|
|
145
|
+
return fs.readdirSync(LOGS_DIR)
|
|
146
|
+
.filter(file => DATE_LOG_PATTERN.test(file))
|
|
147
|
+
.sort()
|
|
148
|
+
.reverse();
|
|
149
|
+
}
|
|
150
|
+
function readLogFile(fileName) {
|
|
151
|
+
const logFile = path.join(LOGS_DIR, fileName);
|
|
152
|
+
if (!fs.existsSync(logFile))
|
|
153
|
+
return [];
|
|
154
|
+
const content = fs.readFileSync(logFile, 'utf-8').trim();
|
|
155
|
+
if (!content)
|
|
156
|
+
return [];
|
|
157
|
+
const lines = content.split('\n').filter(line => line.trim());
|
|
158
|
+
return lines.map(line => {
|
|
159
|
+
try {
|
|
160
|
+
return JSON.parse(line);
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
}).filter((entry) => entry !== null);
|
|
166
|
+
}
|
|
167
|
+
function writeLog(entry, timezone) {
|
|
168
|
+
ensureConfigDir();
|
|
169
|
+
const timestamp = new Date(entry.timestamp);
|
|
170
|
+
const safeDate = Number.isNaN(timestamp.getTime()) ? new Date() : timestamp;
|
|
171
|
+
const date = getDateStringInTimezone(safeDate, timezone);
|
|
172
|
+
const logFile = path.join(LOGS_DIR, `${date}.log`);
|
|
173
|
+
const line = JSON.stringify(entry) + '\n';
|
|
174
|
+
fs.appendFileSync(logFile, line, 'utf-8');
|
|
175
|
+
// Auto-rotate: delete logs older than 30 days (at most once per day)
|
|
176
|
+
if (lastCleanDate !== date) {
|
|
177
|
+
lastCleanDate = date;
|
|
178
|
+
cleanOldLogs(30);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function getLatestLog() {
|
|
182
|
+
for (const file of getDatedLogFiles()) {
|
|
183
|
+
const logs = readLogFile(file);
|
|
184
|
+
if (logs.length > 0) {
|
|
185
|
+
return logs[logs.length - 1];
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
function getLogsForDate(date) {
|
|
191
|
+
return readLogFile(`${date}.log`);
|
|
192
|
+
}
|
|
193
|
+
function hasSuccessfulRunSince(since) {
|
|
194
|
+
const threshold = since.getTime();
|
|
195
|
+
return getDatedLogFiles().some(file => readLogFile(file).some(entry => {
|
|
196
|
+
if (!(entry.status === 'success' || entry.status === 'boot-recovery')) {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
const timestamp = new Date(entry.timestamp).getTime();
|
|
200
|
+
return !Number.isNaN(timestamp) && timestamp >= threshold;
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
function cleanOldLogs(maxDays) {
|
|
204
|
+
const cutoff = new Date();
|
|
205
|
+
cutoff.setDate(cutoff.getDate() - maxDays);
|
|
206
|
+
const cutoffStr = cutoff.toISOString().split('T')[0];
|
|
207
|
+
for (const file of getDatedLogFiles()) {
|
|
208
|
+
const dateStr = file.replace('.log', '');
|
|
209
|
+
if (dateStr < cutoffStr) {
|
|
210
|
+
try {
|
|
211
|
+
fs.unlinkSync(path.join(LOGS_DIR, file));
|
|
212
|
+
}
|
|
213
|
+
catch { }
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
// ── Timezone ──
|
|
218
|
+
function detectTimezone() {
|
|
219
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
220
|
+
}
|
|
221
|
+
function formatTimeLocal(date, timezone) {
|
|
222
|
+
return date.toLocaleTimeString('en-US', {
|
|
223
|
+
timeZone: timezone,
|
|
224
|
+
hour: 'numeric',
|
|
225
|
+
minute: '2-digit',
|
|
226
|
+
hour12: true,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
function formatDateTimeLocal(date, timezone) {
|
|
230
|
+
return date.toLocaleString('en-US', {
|
|
231
|
+
timeZone: timezone,
|
|
232
|
+
weekday: 'short',
|
|
233
|
+
month: 'short',
|
|
234
|
+
day: 'numeric',
|
|
235
|
+
hour: 'numeric',
|
|
236
|
+
minute: '2-digit',
|
|
237
|
+
hour12: true,
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
// ── Shared Formatting ──
|
|
241
|
+
/** Format 24h (hour, minute) to 12-hour display string like "5:00 AM" */
|
|
242
|
+
function formatHour(hour, min) {
|
|
243
|
+
const period = hour >= 12 ? 'PM' : 'AM';
|
|
244
|
+
const h12 = hour > 12 ? hour - 12 : hour === 0 ? 12 : hour;
|
|
245
|
+
return `${h12}:${min.toString().padStart(2, '0')} ${period}`;
|
|
246
|
+
}
|
|
247
|
+
// ── Schedule Helpers ──
|
|
248
|
+
/**
|
|
249
|
+
* Get the current hour and minute in a given IANA timezone.
|
|
250
|
+
* Uses Intl to reliably extract timezone-local components.
|
|
251
|
+
*/
|
|
252
|
+
function getNowInTimezone(timezone, now = new Date()) {
|
|
253
|
+
const parts = new Intl.DateTimeFormat('en-US', {
|
|
254
|
+
timeZone: timezone,
|
|
255
|
+
hour: 'numeric',
|
|
256
|
+
minute: 'numeric',
|
|
257
|
+
hour12: false,
|
|
258
|
+
}).formatToParts(now);
|
|
259
|
+
let hour = 0;
|
|
260
|
+
let minute = 0;
|
|
261
|
+
for (const p of parts) {
|
|
262
|
+
if (p.type === 'hour')
|
|
263
|
+
hour = parseInt(p.value, 10);
|
|
264
|
+
if (p.type === 'minute')
|
|
265
|
+
minute = parseInt(p.value, 10);
|
|
266
|
+
}
|
|
267
|
+
// Intl hour12:false can return 24 for midnight in some locales
|
|
268
|
+
if (hour === 24)
|
|
269
|
+
hour = 0;
|
|
270
|
+
return { hour, minute, date: now };
|
|
271
|
+
}
|
|
272
|
+
/** Get the next occurrence of the scheduled time */
|
|
273
|
+
function getNextFireTime(config, now = new Date()) {
|
|
274
|
+
const [schedH, schedM] = config.schedule.time.split(':').map(Number);
|
|
275
|
+
const { hour: nowH, minute: nowM } = getNowInTimezone(config.schedule.timezone, now);
|
|
276
|
+
// Calculate minutes until schedule
|
|
277
|
+
const nowMinutes = nowH * 60 + nowM;
|
|
278
|
+
const schedMinutes = schedH * 60 + schedM;
|
|
279
|
+
let diffMinutes = schedMinutes - nowMinutes;
|
|
280
|
+
if (diffMinutes <= 0)
|
|
281
|
+
diffMinutes += 24 * 60; // tomorrow
|
|
282
|
+
return new Date(now.getTime() + diffMinutes * 60 * 1000);
|
|
283
|
+
}
|
|
284
|
+
/** Get the estimated window reset time (fire time + 5 hours) */
|
|
285
|
+
function getWindowResetTime(fireTime) {
|
|
286
|
+
const reset = new Date(fireTime);
|
|
287
|
+
reset.setHours(reset.getHours() + 5);
|
|
288
|
+
return reset;
|
|
289
|
+
}
|
|
290
|
+
/** Calculate how far through the 5-hour window we are (0 to 1) */
|
|
291
|
+
function getWindowProgress(lastFireTime) {
|
|
292
|
+
const now = new Date();
|
|
293
|
+
const elapsed = now.getTime() - lastFireTime.getTime();
|
|
294
|
+
const windowMs = 5 * 60 * 60 * 1000; // 5 hours
|
|
295
|
+
return Math.min(1, Math.max(0, elapsed / windowMs));
|
|
296
|
+
}
|
|
297
|
+
function getMinutesSinceScheduled(scheduleTime, timezone, now = new Date()) {
|
|
298
|
+
const [schedH, schedM] = scheduleTime.split(':').map(Number);
|
|
299
|
+
const { hour: nowH, minute: nowM } = getNowInTimezone(timezone, now);
|
|
300
|
+
const schedMinutes = schedH * 60 + schedM;
|
|
301
|
+
const nowMinutes = nowH * 60 + nowM;
|
|
302
|
+
return (nowMinutes - schedMinutes + (24 * 60)) % (24 * 60);
|
|
303
|
+
}
|
|
304
|
+
function getMostRecentScheduledOccurrence(scheduleTime, timezone, now = new Date()) {
|
|
305
|
+
const minutesSinceScheduled = getMinutesSinceScheduled(scheduleTime, timezone, now);
|
|
306
|
+
return new Date(now.getTime() - minutesSinceScheduled * 60 * 1000);
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Check if a given time (hour:minute) is approximately "now" in the user's timezone.
|
|
310
|
+
* Used to decide if the scheduler fired at the right time vs. a boot-recovery.
|
|
311
|
+
*/
|
|
312
|
+
function isNearScheduledTime(scheduleTime, timezone, toleranceMinutes = 5, now = new Date()) {
|
|
313
|
+
const [schedH, schedM] = scheduleTime.split(':').map(Number);
|
|
314
|
+
const { hour: nowH, minute: nowM } = getNowInTimezone(timezone, now);
|
|
315
|
+
const schedMinutes = schedH * 60 + schedM;
|
|
316
|
+
const nowMinutes = nowH * 60 + nowM;
|
|
317
|
+
const diff = Math.abs(schedMinutes - nowMinutes);
|
|
318
|
+
return diff <= toleranceMinutes || (24 * 60 - diff) <= toleranceMinutes;
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,oCAEC;AAED,gCAEC;AAED,0CAOC;AAED,oCAEC;AAED,gCAqBC;AAED,kCAIC;AAED,kDAYC;AAMD,0DAUC;AA4BD,4BAeC;AAED,oCAQC;AAED,wCAEC;AAED,sDAWC;AAiBD,wCAEC;AAED,0CAOC;AAED,kDAUC;AAKD,gCAIC;AA6BD,0CAWC;AAGD,gDAIC;AAGD,8CAKC;AAED,4DAQC;AAED,4EAGC;AAMD,kDAcC;AApUD,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,kDAA0B;AAwB1B,SAAS,gBAAgB;IACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAC/C,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;AAChF,CAAC;AAED,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AACpD,MAAM,UAAU,GAAG,gBAAgB,EAAE,CAAC;AACtC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AACzD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AAE/C,SAAgB,YAAY;IAC1B,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAgB,UAAU;IACxB,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAgB,eAAe;IAC7B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,C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MAAY,IAAI,IAAI,EAAE;IAC7G,MAAM,qBAAqB,GAAG,wBAAwB,CAAC,YAAY,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;IACpF,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,qBAAqB,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;AACrE,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CACjC,YAAoB,EACpB,QAAgB,EAChB,mBAA2B,CAAC,EAC5B,MAAY,IAAI,IAAI,EAAE;IAEtB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7D,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAErE,MAAM,YAAY,GAAG,MAAM,GAAG,EAAE,GAAG,MAAM,CAAC;IAC1C,MAAM,UAAU,GAAG,IAAI,GAAG,EAAE,GAAG,IAAI,CAAC;IACpC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,GAAG,UAAU,CAAC,CAAC;IAEjD,OAAO,IAAI,IAAI,gBAAgB,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,gBAAgB,CAAC;AAC1E,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
const commander_1 = require("commander");
|
|
38
|
+
const setup_1 = require("./commands/setup");
|
|
39
|
+
const status_1 = require("./commands/status");
|
|
40
|
+
const test_1 = require("./commands/test");
|
|
41
|
+
const pause_1 = require("./commands/pause");
|
|
42
|
+
const resume_1 = require("./commands/resume");
|
|
43
|
+
const update_1 = require("./commands/update");
|
|
44
|
+
const uninstall_1 = require("./commands/uninstall");
|
|
45
|
+
const execute_1 = require("./commands/execute");
|
|
46
|
+
const program = new commander_1.Command();
|
|
47
|
+
program
|
|
48
|
+
.name('warmup')
|
|
49
|
+
.description('Pre-warm your Claude rate limits while you sleep.')
|
|
50
|
+
.version('1.0.0');
|
|
51
|
+
program
|
|
52
|
+
.command('setup')
|
|
53
|
+
.description('Set up warmup with your preferred pre-warm time')
|
|
54
|
+
.action(async () => {
|
|
55
|
+
await (0, setup_1.setupCommand)();
|
|
56
|
+
});
|
|
57
|
+
program
|
|
58
|
+
.command('status')
|
|
59
|
+
.description('Show your schedule, last run, and rate limit window progress')
|
|
60
|
+
.action(async () => {
|
|
61
|
+
await (0, status_1.statusCommand)();
|
|
62
|
+
});
|
|
63
|
+
program
|
|
64
|
+
.command('test')
|
|
65
|
+
.description('Fire a pre-warm right now (counts as a real pre-warm)')
|
|
66
|
+
.action(async () => {
|
|
67
|
+
await (0, test_1.testCommand)();
|
|
68
|
+
});
|
|
69
|
+
program
|
|
70
|
+
.command('pause')
|
|
71
|
+
.description('Pause the daily pre-warm schedule')
|
|
72
|
+
.action(async () => {
|
|
73
|
+
await (0, pause_1.pauseCommand)();
|
|
74
|
+
});
|
|
75
|
+
program
|
|
76
|
+
.command('resume')
|
|
77
|
+
.description('Resume the daily pre-warm schedule')
|
|
78
|
+
.action(async () => {
|
|
79
|
+
await (0, resume_1.resumeCommand)();
|
|
80
|
+
});
|
|
81
|
+
program
|
|
82
|
+
.command('update')
|
|
83
|
+
.description('Change your pre-warm time')
|
|
84
|
+
.action(async () => {
|
|
85
|
+
await (0, update_1.updateCommand)();
|
|
86
|
+
});
|
|
87
|
+
program
|
|
88
|
+
.command('uninstall')
|
|
89
|
+
.description('Remove the scheduled task (keeps config)')
|
|
90
|
+
.action(async () => {
|
|
91
|
+
await (0, uninstall_1.uninstallCommand)();
|
|
92
|
+
});
|
|
93
|
+
// Hidden command: called by the OS scheduler
|
|
94
|
+
program
|
|
95
|
+
.command('_execute-warmup', { hidden: true })
|
|
96
|
+
.description('Internal: execute pre-warm (called by OS scheduler)')
|
|
97
|
+
.action(async () => {
|
|
98
|
+
await (0, execute_1.executeCommand)();
|
|
99
|
+
});
|
|
100
|
+
// Default: show status if set up, otherwise show help
|
|
101
|
+
program
|
|
102
|
+
.action(async () => {
|
|
103
|
+
const { readConfig } = await Promise.resolve().then(() => __importStar(require('./config')));
|
|
104
|
+
const config = readConfig();
|
|
105
|
+
if (config) {
|
|
106
|
+
await (0, status_1.statusCommand)();
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
program.help();
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
program.parse();
|
|
113
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAAoC;AACpC,4CAAgD;AAChD,8CAAkD;AAClD,0CAA8C;AAC9C,4CAAgD;AAChD,8CAAkD;AAClD,8CAAkD;AAClD,oDAAwD;AACxD,gDAAoD;AAEpD,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CAAC,mDAAmD,CAAC;KAChE,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,iDAAiD,CAAC;KAC9D,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,IAAA,oBAAY,GAAE,CAAC;AACvB,CAAC,CAAC,CAAC;AAEL,OAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,8DAA8D,CAAC;KAC3E,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,IAAA,sBAAa,GAAE,CAAC;AACxB,CAAC,CAAC,CAAC;AAEL,OAAO;KACJ,OAAO,C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IAC5B,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,IAAA,sBAAa,GAAE,CAAC;IACxB,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface RuntimePaths {
|
|
2
|
+
nodePath: string;
|
|
3
|
+
cliEntry: string;
|
|
4
|
+
claudePath: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function findExecutable(command: string): string | null;
|
|
7
|
+
export declare function parseClaudeAuthStatus(raw: string): boolean;
|
|
8
|
+
export declare function resolveRuntimePaths(cliEntry?: string): RuntimePaths;
|
|
9
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAmBD,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiB7D;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAO1D;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,GAAE,MAAwB,GAAG,YAAY,CAepF"}
|