agenthud 0.12.2 → 0.12.4

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/index.js CHANGED
@@ -15,4 +15,4 @@ Error: Node.js ${MIN_NODE_VERSION}+ is required (current: ${process.version})
15
15
  process.exit(1);
16
16
  }
17
17
  if (!process.env.NODE_ENV) process.env.NODE_ENV = "production";
18
- import("./main-YCUCY2QP.js");
18
+ import("./main-PNDDQ5WC.js");
@@ -465,12 +465,21 @@ function formatEffectiveOptionsLine(command, fields) {
465
465
  if (fields.model) parts.push(`model=${fields.model}`);
466
466
  return `${command} \u2192 ${parts.join(" ")}`;
467
467
  }
468
+ function expandCombinedShortFlags(args) {
469
+ return args.flatMap((arg) => {
470
+ if (/^-[a-zA-Z]{2,}$/.test(arg)) {
471
+ return arg.slice(1).split("").map((ch) => `-${ch}`);
472
+ }
473
+ return arg;
474
+ });
475
+ }
468
476
  function todayLocalMidnight() {
469
477
  const now = /* @__PURE__ */ new Date();
470
478
  return new Date(now.getFullYear(), now.getMonth(), now.getDate());
471
479
  }
472
480
  function parseArgs(args, config) {
473
481
  if (args[0] === "watch") args = args.slice(1);
482
+ args = expandCombinedShortFlags(args);
474
483
  if (args.includes("--help") || args.includes("-h")) {
475
484
  return { mode: "watch", command: "help" };
476
485
  }
@@ -1293,8 +1302,8 @@ function truncateByWidth(text, maxWidth) {
1293
1302
  }
1294
1303
  var widthCache = /* @__PURE__ */ new Map();
1295
1304
  function getDisplayWidth(s) {
1296
- const cached = widthCache.get(s);
1297
- if (cached !== void 0) return cached;
1305
+ const cached2 = widthCache.get(s);
1306
+ if (cached2 !== void 0) return cached2;
1298
1307
  const w = stringWidth(s);
1299
1308
  widthCache.set(s, w);
1300
1309
  return w;
@@ -1670,8 +1679,7 @@ import {
1670
1679
  existsSync as existsSync6,
1671
1680
  mkdirSync as mkdirSync2,
1672
1681
  readFileSync as readFileSync7,
1673
- unlinkSync,
1674
- writeFileSync as writeFileSync3
1682
+ unlinkSync
1675
1683
  } from "fs";
1676
1684
  import { homedir as homedir3 } from "os";
1677
1685
  import { dirname as dirname2, join as join6 } from "path";
@@ -1680,8 +1688,28 @@ import { fileURLToPath as fileURLToPath2 } from "url";
1680
1688
 
1681
1689
  // src/utils/openInDefaultApp.ts
1682
1690
  import { spawn } from "child_process";
1683
- import { existsSync as existsSync4, readFileSync as readFileSync5 } from "fs";
1691
+ import { existsSync as existsSync4 } from "fs";
1684
1692
  import { join as join4 } from "path";
1693
+
1694
+ // src/utils/platform.ts
1695
+ import { readFileSync as readFileSync5 } from "fs";
1696
+ var cached = null;
1697
+ function isWSL() {
1698
+ if (cached !== null) return cached;
1699
+ if (process.env.WSL_DISTRO_NAME) {
1700
+ cached = true;
1701
+ return cached;
1702
+ }
1703
+ try {
1704
+ const ver = readFileSync5("/proc/version", "utf-8");
1705
+ cached = /microsoft|wsl/i.test(ver);
1706
+ } catch {
1707
+ cached = false;
1708
+ }
1709
+ return cached;
1710
+ }
1711
+
1712
+ // src/utils/openInDefaultApp.ts
1685
1713
  function buildOpenCommand(platform, path, opts = {}) {
1686
1714
  switch (platform) {
1687
1715
  case "darwin":
@@ -1695,15 +1723,6 @@ function buildOpenCommand(platform, path, opts = {}) {
1695
1723
  return null;
1696
1724
  }
1697
1725
  }
1698
- function isWSL() {
1699
- if (process.env.WSL_DISTRO_NAME) return true;
1700
- try {
1701
- const ver = readFileSync5("/proc/version", "utf-8");
1702
- return /microsoft|wsl/i.test(ver);
1703
- } catch {
1704
- return false;
1705
- }
1706
- }
1707
1726
  function commandExists(command) {
1708
1727
  const PATH = process.env.PATH ?? "";
1709
1728
  const sep = process.platform === "win32" ? ";" : ":";
@@ -2281,13 +2300,13 @@ var REPORT_TOKEN_WARN_THRESHOLD = 3e5;
2281
2300
  async function generateDailySummary(opts) {
2282
2301
  ensureUserPromptFile("daily");
2283
2302
  const isToday = isSameLocalDay2(opts.date, opts.today);
2284
- const cached = dailyCachePath(opts.date);
2303
+ const cached2 = dailyCachePath(opts.date);
2285
2304
  const dateLabel = dateKey(opts.date);
2286
- if (!isToday && !opts.force && existsSync6(cached)) {
2305
+ if (!isToday && !opts.force && existsSync6(cached2)) {
2287
2306
  try {
2288
- const content = readFileSync7(cached, "utf-8");
2307
+ const content = readFileSync7(cached2, "utf-8");
2289
2308
  if (opts.announce) {
2290
- process.stderr.write(`cached summary from ${cached}
2309
+ process.stderr.write(`cached summary from ${cached2}
2291
2310
  `);
2292
2311
  }
2293
2312
  if (opts.streamToStdout) {
@@ -2342,29 +2361,17 @@ async function generateDailySummary(opts) {
2342
2361
  );
2343
2362
  }
2344
2363
  if (sessionCount === 0 && activityCount === 0 && commitCount === 0) {
2345
- const stub = `## Context
2346
-
2347
- No activity recorded for ${dateLabel}.
2348
- No claude call was issued \u2014 the report was empty.
2349
- `;
2350
- try {
2351
- writeFileSync3(cached, stub, "utf-8");
2352
- } catch {
2353
- }
2354
2364
  if (opts.announce) {
2355
2365
  process.stderr.write(
2356
- `${dateLabel} has no activity \u2014 wrote stub to ${cached}, skipped claude
2366
+ `${dateLabel} has no activity \u2014 skipping (no file written)
2357
2367
  `
2358
2368
  );
2359
2369
  }
2360
- if (opts.streamToStdout) {
2361
- process.stdout.write(stub);
2362
- }
2363
2370
  return {
2364
2371
  code: 0,
2365
- markdown: stub,
2372
+ markdown: "",
2366
2373
  fromCache: false,
2367
- skipped: false,
2374
+ skipped: true,
2368
2375
  usage: null
2369
2376
  };
2370
2377
  }
@@ -2416,14 +2423,14 @@ No claude call was issued \u2014 the report was empty.
2416
2423
  const result = await spawnClaude({
2417
2424
  prompt,
2418
2425
  stdin: reportMarkdown,
2419
- cachePath: cached,
2426
+ cachePath: cached2,
2420
2427
  streamToStdout: opts.streamToStdout,
2421
2428
  model: opts.model
2422
2429
  });
2423
2430
  if (stopTicker) stopTicker();
2424
2431
  if (opts.announce && result.code === 0) {
2425
2432
  process.stderr.write("\n");
2426
- process.stderr.write(`saved to ${cached}
2433
+ process.stderr.write(`saved to ${cached2}
2427
2434
  `);
2428
2435
  if (result.usage) {
2429
2436
  process.stderr.write(`${formatUsage(result.usage)}
@@ -2451,7 +2458,8 @@ async function runSummary(options2) {
2451
2458
  detailLimit: options2.detailLimit,
2452
2459
  withGit: options2.withGit
2453
2460
  });
2454
- if (res.code === 0 && !res.skipped) {
2461
+ const indexRefreshNeeded = res.code === 0 && (!res.skipped || options2.openIndex === true);
2462
+ if (indexRefreshNeeded) {
2455
2463
  try {
2456
2464
  regenerateIndex(summariesDir());
2457
2465
  } catch {
@@ -2460,7 +2468,7 @@ async function runSummary(options2) {
2460
2468
  if (options2.open && res.code === 0 && !res.skipped) {
2461
2469
  await openInDefaultApp(dailyCachePath(options2.date));
2462
2470
  }
2463
- if (options2.openIndex && res.code === 0 && !res.skipped) {
2471
+ if (options2.openIndex && res.code === 0) {
2464
2472
  await openInDefaultApp(join6(summariesDir(), "index.md"));
2465
2473
  }
2466
2474
  return res.code;
@@ -2542,7 +2550,7 @@ async function runRangeSummary(options2) {
2542
2550
  withGit: options2.withGit
2543
2551
  });
2544
2552
  if (res.skipped) {
2545
- process.stderr.write(`agenthud: ${label} \u2014 skipped by user.
2553
+ process.stderr.write(`agenthud: ${label} \u2014 skipped.
2546
2554
  `);
2547
2555
  skippedCount++;
2548
2556
  continue;
@@ -2563,8 +2571,17 @@ async function runRangeSummary(options2) {
2563
2571
  dailyMarkdowns.push({ date: d, markdown: text });
2564
2572
  }
2565
2573
  if (dailyMarkdowns.length === 0) {
2566
- process.stderr.write("agenthud: no daily summaries to combine.\n");
2567
- return 1;
2574
+ process.stderr.write(
2575
+ "no daily activity in this range \u2014 nothing to combine\n"
2576
+ );
2577
+ if (options2.openIndex) {
2578
+ try {
2579
+ regenerateIndex(summariesDir());
2580
+ } catch {
2581
+ }
2582
+ await openInDefaultApp(join6(summariesDir(), "index.md"));
2583
+ }
2584
+ return 0;
2568
2585
  }
2569
2586
  const metaInput = dailyMarkdowns.map(({ date, markdown }) => `# ${dateKey(date)}
2570
2587
 
@@ -4703,10 +4720,14 @@ function installAltScreenCleanup() {
4703
4720
 
4704
4721
  // src/utils/legacyConfig.ts
4705
4722
  import { join as join7, resolve } from "path";
4706
- function isLegacyProjectConfig(cwd, home) {
4723
+ var WSL_WINDOWS_USER_HOME = /^\/mnt\/[a-z]\/Users\/[^/]+\/?$/i;
4724
+ function isLegacyProjectConfig(cwd, home, opts = {}) {
4707
4725
  const legacy = resolve(join7(cwd, ".agenthud", "config.yaml"));
4708
4726
  const global = resolve(join7(home, ".agenthud", "config.yaml"));
4709
- return legacy !== global;
4727
+ if (legacy === global) return false;
4728
+ const wsl = opts.isWSL ?? isWSL();
4729
+ if (wsl && WSL_WINDOWS_USER_HOME.test(cwd)) return false;
4730
+ return true;
4710
4731
  }
4711
4732
 
4712
4733
  // src/main.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agenthud",
3
- "version": "0.12.2",
3
+ "version": "0.12.4",
4
4
  "description": "CLI tool to monitor agent status in real-time. Works with Claude Code, multi-agent workflows, and any AI agent system.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",