exe-watcher 0.2.8 → 0.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/dist/cli.js CHANGED
@@ -6734,6 +6734,23 @@ function parseDateRangeFlags(from, to) {
6734
6734
  var MS_PER_DAY3 = 24 * 60 * 60 * 1e3;
6735
6735
  var DEFAULT_COLD_START_HISTORY_DAYS = 7;
6736
6736
  var DEFAULT_PROGRESSIVE_CHUNK_DAYS = 30;
6737
+ var ALL_TIME_HISTORY_DAYS = 365;
6738
+ var THIRTY_DAY_HISTORY_DAYS = 30;
6739
+ var WEEK_HISTORY_DAYS = 7;
6740
+ function resolveColdStartHistoryDays(period, now = /* @__PURE__ */ new Date()) {
6741
+ switch (period) {
6742
+ case "today":
6743
+ return 1;
6744
+ case "week":
6745
+ return WEEK_HISTORY_DAYS;
6746
+ case "30days":
6747
+ return THIRTY_DAY_HISTORY_DAYS;
6748
+ case "month":
6749
+ return Math.max(now.getDate(), 1);
6750
+ case "all":
6751
+ return ALL_TIME_HISTORY_DAYS;
6752
+ }
6753
+ }
6737
6754
  function nextLocalMidnight(dateString) {
6738
6755
  return new Date(
6739
6756
  parseInt(dateString.slice(0, 4), 10),
@@ -6767,7 +6784,7 @@ import { createRequire as createRequire2 } from "module";
6767
6784
  var require2 = createRequire2(import.meta.url);
6768
6785
  var { version } = require2("../package.json");
6769
6786
  var MS_PER_DAY4 = 24 * 60 * 60 * 1e3;
6770
- var BACKFILL_DAYS = 365;
6787
+ var BACKFILL_DAYS = ALL_TIME_HISTORY_DAYS;
6771
6788
  function toDateString(date) {
6772
6789
  return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
6773
6790
  }
@@ -6797,8 +6814,8 @@ function getDateRange2(period) {
6797
6814
  return { range: { start, end }, label: "Last 30 Days" };
6798
6815
  }
6799
6816
  case "all": {
6800
- const start = new Date(now.getFullYear(), now.getMonth() - 6, now.getDate());
6801
- return { range: { start, end }, label: "Last 6 months" };
6817
+ const start = new Date(now.getFullYear(), now.getMonth(), now.getDate() - (ALL_TIME_HISTORY_DAYS - 1));
6818
+ return { range: { start, end }, label: "All Time" };
6802
6819
  }
6803
6820
  default: {
6804
6821
  const start = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 6);
@@ -7047,6 +7064,7 @@ program.command("status").description("Compact status output (today + week + mon
7047
7064
  if (opts.format === "menubar-json") {
7048
7065
  const periodInfo = getDateRange2(opts.period);
7049
7066
  const now = /* @__PURE__ */ new Date();
7067
+ const selectedPeriodHistoryDays = resolveColdStartHistoryDays(opts.period, now);
7050
7068
  const todayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate());
7051
7069
  const yesterdayEnd = new Date(todayStart.getTime() - 1);
7052
7070
  const yesterdayStr = toDateString(new Date(todayStart.getTime() - MS_PER_DAY4));
@@ -7064,7 +7082,8 @@ program.command("status").description("Compact status output (today + week + mon
7064
7082
  lastComputedDate: c.lastComputedDate,
7065
7083
  todayStart,
7066
7084
  yesterdayEnd,
7067
- backfillDays: BACKFILL_DAYS
7085
+ backfillDays: BACKFILL_DAYS,
7086
+ coldStartHistoryDays: selectedPeriodHistoryDays
7068
7087
  });
7069
7088
  if (effectiveGapStart.getTime() <= yesterdayEnd.getTime()) {
7070
7089
  const gapRange = { start: effectiveGapStart, end: yesterdayEnd };