@mohitkumawat/warmup-cli 1.2.15 → 1.2.16
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/README.md +5 -5
- package/dist/commands/execute.d.ts +24 -1
- package/dist/commands/execute.d.ts.map +1 -1
- package/dist/commands/execute.js +53 -21
- package/dist/commands/execute.js.map +1 -1
- package/dist/commands/setup.d.ts +7 -0
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +94 -5
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +12 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/uninstall.d.ts.map +1 -1
- package/dist/commands/uninstall.js +15 -0
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/config.d.ts +16 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +17 -0
- package/dist/config.js.map +1 -1
- package/dist/index.js +0 -0
- package/dist/notify.d.ts +14 -0
- package/dist/notify.d.ts.map +1 -0
- package/dist/notify.js +91 -0
- package/dist/notify.js.map +1 -0
- package/dist/runtime.d.ts +10 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +39 -8
- package/dist/runtime.js.map +1 -1
- package/dist/scheduler/index.d.ts +17 -0
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +42 -0
- package/dist/scheduler/index.js.map +1 -1
- package/dist/scheduler/linux.d.ts.map +1 -1
- package/dist/scheduler/linux.js +3 -10
- package/dist/scheduler/linux.js.map +1 -1
- package/dist/scheduler/macos.d.ts +38 -0
- package/dist/scheduler/macos.d.ts.map +1 -1
- package/dist/scheduler/macos.js +158 -23
- package/dist/scheduler/macos.js.map +1 -1
- package/dist/scheduler/script.d.ts +18 -0
- package/dist/scheduler/script.d.ts.map +1 -0
- package/dist/scheduler/script.js +62 -0
- package/dist/scheduler/script.js.map +1 -0
- package/dist/scheduler/windows.js +1 -1
- package/dist/ui.d.ts +1 -0
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +40 -11
- package/dist/ui.js.map +1 -1
- package/dist/warmup.d.ts +39 -0
- package/dist/warmup.d.ts.map +1 -1
- package/dist/warmup.js +55 -0
- package/dist/warmup.js.map +1 -1
- package/package.json +1 -1
package/dist/warmup.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NEAR_SCHEDULE_DEDUP_WINDOW_MINUTES = exports.NEAR_SCHEDULE_TOLERANCE_MINUTES = void 0;
|
|
3
4
|
exports.isClaudeInstalled = isClaudeInstalled;
|
|
4
5
|
exports.isClaudeAuthenticated = isClaudeAuthenticated;
|
|
5
6
|
exports.getClaudeVersion = getClaudeVersion;
|
|
6
7
|
exports.executeWarmup = executeWarmup;
|
|
7
8
|
exports.shouldBootRecover = shouldBootRecover;
|
|
9
|
+
exports.shouldRunNearSchedule = shouldRunNearSchedule;
|
|
10
|
+
exports.shouldLogSkip = shouldLogSkip;
|
|
8
11
|
const child_process_1 = require("child_process");
|
|
9
12
|
const config_1 = require("./config");
|
|
10
13
|
const runtime_1 = require("./runtime");
|
|
@@ -159,4 +162,56 @@ function shouldBootRecover(config, now = new Date()) {
|
|
|
159
162
|
const mostRecentScheduledOccurrence = (0, config_1.getMostRecentScheduledOccurrence)(config.schedule.time, config.schedule.timezone, now);
|
|
160
163
|
return !(0, config_1.hasSuccessfulRunSince)(mostRecentScheduledOccurrence);
|
|
161
164
|
}
|
|
165
|
+
/** Tolerance (minutes) around the scheduled time for a "normal" run. Must stay
|
|
166
|
+
* in sync with the default passed to isNearScheduledTime below. */
|
|
167
|
+
exports.NEAR_SCHEDULE_TOLERANCE_MINUTES = 5;
|
|
168
|
+
/**
|
|
169
|
+
* Dedup window (minutes) for the near-schedule run. Two near-schedule fires for
|
|
170
|
+
* the same occurrence both fall within ±tolerance of the scheduled minute, so
|
|
171
|
+
* they are at most 2*tolerance apart; the window must exceed that to dedup a
|
|
172
|
+
* re-fire. 15 > 2*5 leaves a 5-minute margin. If the tolerance grows, grow this.
|
|
173
|
+
*/
|
|
174
|
+
exports.NEAR_SCHEDULE_DEDUP_WINDOW_MINUTES = 15;
|
|
175
|
+
/**
|
|
176
|
+
* Whether to run a normal (near-schedule) pre-warm now: within tolerance of the
|
|
177
|
+
* scheduled time AND no successful run in the recent dedup window. A recency
|
|
178
|
+
* window — not the most-recent scheduled occurrence — is used so a fire a few
|
|
179
|
+
* minutes BEFORE the scheduled minute is not wrongly suppressed by yesterday's
|
|
180
|
+
* success (which getMostRecentScheduledOccurrence would round back to). A
|
|
181
|
+
* RunAtLoad login moments after the scheduled fire is still deduped.
|
|
182
|
+
*/
|
|
183
|
+
function shouldRunNearSchedule(config, now = new Date()) {
|
|
184
|
+
if (!config.schedule.enabled)
|
|
185
|
+
return false;
|
|
186
|
+
if (!(0, config_1.isNearScheduledTime)(config.schedule.time, config.schedule.timezone, exports.NEAR_SCHEDULE_TOLERANCE_MINUTES, now)) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
const windowStart = new Date(now.getTime() - exports.NEAR_SCHEDULE_DEDUP_WINDOW_MINUTES * 60 * 1000);
|
|
190
|
+
return !(0, config_1.hasSuccessfulRunSince)(windowStart);
|
|
191
|
+
}
|
|
192
|
+
/** Latest point after the scheduled time at which a missed window is still
|
|
193
|
+
* worth recording (keeps stale overnight gaps out of the log). */
|
|
194
|
+
const SKIP_LOG_MAX_ELAPSED_MINUTES = 18 * 60;
|
|
195
|
+
/**
|
|
196
|
+
* Whether to record a "skipped" entry: the scheduled time passed, the 5-hour
|
|
197
|
+
* recovery window has expired (so {@link shouldBootRecover} declined), and no
|
|
198
|
+
* run or skip has been recorded yet for this occurrence. This turns the old
|
|
199
|
+
* silent no-op — the literal "never runs even if I open my pc later" — into a
|
|
200
|
+
* visible signal, recorded at most once per day.
|
|
201
|
+
*/
|
|
202
|
+
function shouldLogSkip(config, now = new Date()) {
|
|
203
|
+
if (!config.schedule.enabled)
|
|
204
|
+
return false;
|
|
205
|
+
const elapsedMinutes = (0, config_1.getMinutesSinceScheduled)(config.schedule.time, config.schedule.timezone, now);
|
|
206
|
+
// Within the recovery window shouldBootRecover handles it; far past it the
|
|
207
|
+
// miss is stale and not worth surfacing.
|
|
208
|
+
if (elapsedMinutes < 5 * 60 || elapsedMinutes > SKIP_LOG_MAX_ELAPSED_MINUTES) {
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
const mostRecentScheduledOccurrence = (0, config_1.getMostRecentScheduledOccurrence)(config.schedule.time, config.schedule.timezone, now);
|
|
212
|
+
// Suppress the skip if anything already happened for this occurrence —
|
|
213
|
+
// including a failure, so we never log a contradicting "skipped" after a
|
|
214
|
+
// "failed".
|
|
215
|
+
return !(0, config_1.hasOutcomeSince)(mostRecentScheduledOccurrence);
|
|
216
|
+
}
|
|
162
217
|
//# sourceMappingURL=warmup.js.map
|
package/dist/warmup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warmup.js","sourceRoot":"","sources":["../src/warmup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"warmup.js","sourceRoot":"","sources":["../src/warmup.ts"],"names":[],"mappings":";;;AAcA,8CAWC;AAGD,sDAYC;AAGD,4CAcC;AAUD,sCAyFC;AAYD,8CAsBC;AAsBD,sDAcC;AAaD,sCA2BC;AA1QD,iDAA0C;AAC1C,qCASkB;AAClB,uCAAkD;AAElD,4CAA4C;AAC5C,SAAgB,iBAAiB;IAC/B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,yBAAS,EAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,EAAE;YAChD,QAAQ,EAAE,OAAO;YACjB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAChC,CAAC,CAAC;QACH,OAAO,MAAM,C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