devflow-kit 1.7.0 → 1.8.0

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.
Files changed (195) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +31 -1
  3. package/dist/cli.js +3 -1
  4. package/dist/commands/hud.d.ts +22 -0
  5. package/dist/commands/hud.js +180 -0
  6. package/dist/commands/init.d.ts +1 -0
  7. package/dist/commands/init.js +112 -3
  8. package/dist/commands/list.js +1 -0
  9. package/dist/commands/uninstall.js +9 -16
  10. package/dist/hud/cache.d.ts +14 -0
  11. package/dist/hud/cache.js +54 -0
  12. package/dist/hud/colors.d.ts +23 -0
  13. package/dist/hud/colors.js +62 -0
  14. package/dist/hud/components/config-counts.d.ts +8 -0
  15. package/dist/hud/components/config-counts.js +91 -0
  16. package/dist/hud/components/context-usage.d.ts +8 -0
  17. package/dist/hud/components/context-usage.js +49 -0
  18. package/dist/hud/components/diff-stats.d.ts +3 -0
  19. package/dist/hud/components/diff-stats.js +36 -0
  20. package/dist/hud/components/directory.d.ts +3 -0
  21. package/dist/hud/components/directory.js +10 -0
  22. package/dist/hud/components/git-ahead-behind.d.ts +3 -0
  23. package/dist/hud/components/git-ahead-behind.js +16 -0
  24. package/dist/hud/components/git-branch.d.ts +3 -0
  25. package/dist/hud/components/git-branch.js +14 -0
  26. package/dist/hud/components/model.d.ts +3 -0
  27. package/dist/hud/components/model.js +21 -0
  28. package/dist/hud/components/release-info.d.ts +3 -0
  29. package/dist/hud/components/release-info.js +9 -0
  30. package/dist/hud/components/session-cost.d.ts +3 -0
  31. package/dist/hud/components/session-cost.js +9 -0
  32. package/dist/hud/components/session-duration.d.ts +3 -0
  33. package/dist/hud/components/session-duration.js +18 -0
  34. package/dist/hud/components/todo-progress.d.ts +3 -0
  35. package/dist/hud/components/todo-progress.js +11 -0
  36. package/dist/hud/components/usage-quota.d.ts +3 -0
  37. package/dist/hud/components/usage-quota.js +45 -0
  38. package/dist/hud/components/version-badge.d.ts +3 -0
  39. package/dist/hud/components/version-badge.js +80 -0
  40. package/dist/hud/components/worktree-count.d.ts +3 -0
  41. package/dist/hud/components/worktree-count.js +8 -0
  42. package/dist/hud/config.d.ts +10 -0
  43. package/dist/hud/config.js +55 -0
  44. package/dist/hud/credentials.d.ts +17 -0
  45. package/dist/hud/credentials.js +99 -0
  46. package/dist/hud/git.d.ts +7 -0
  47. package/dist/hud/git.js +153 -0
  48. package/dist/hud/index.d.ts +2 -0
  49. package/dist/hud/index.js +81 -0
  50. package/dist/hud/render.d.ts +7 -0
  51. package/dist/hud/render.js +111 -0
  52. package/dist/hud/stdin.d.ts +6 -0
  53. package/dist/hud/stdin.js +25 -0
  54. package/dist/hud/transcript.d.ts +7 -0
  55. package/dist/hud/transcript.js +130 -0
  56. package/dist/hud/types.d.ts +116 -0
  57. package/dist/hud/types.js +2 -0
  58. package/dist/hud/usage-api.d.ts +7 -0
  59. package/dist/hud/usage-api.js +84 -0
  60. package/dist/utils/manifest.d.ts +1 -0
  61. package/package.json +5 -2
  62. package/plugins/devflow-accessibility/.claude-plugin/plugin.json +1 -1
  63. package/plugins/devflow-ambient/.claude-plugin/plugin.json +1 -1
  64. package/plugins/devflow-ambient/agents/scrutinizer.md +6 -4
  65. package/plugins/devflow-ambient/agents/shepherd.md +26 -12
  66. package/plugins/devflow-ambient/agents/simplifier.md +24 -15
  67. package/plugins/devflow-audit-claude/.claude-plugin/plugin.json +1 -1
  68. package/plugins/devflow-code-review/.claude-plugin/plugin.json +1 -1
  69. package/plugins/devflow-core-skills/.claude-plugin/plugin.json +1 -1
  70. package/plugins/devflow-debug/.claude-plugin/plugin.json +1 -1
  71. package/plugins/devflow-frontend-design/.claude-plugin/plugin.json +1 -1
  72. package/plugins/devflow-go/.claude-plugin/plugin.json +1 -1
  73. package/plugins/devflow-implement/.claude-plugin/plugin.json +1 -1
  74. package/plugins/devflow-implement/agents/scrutinizer.md +6 -4
  75. package/plugins/devflow-implement/agents/shepherd.md +26 -12
  76. package/plugins/devflow-implement/agents/simplifier.md +24 -15
  77. package/plugins/devflow-implement/skills/self-review/references/stub-detection.md +135 -0
  78. package/plugins/devflow-java/.claude-plugin/plugin.json +1 -1
  79. package/plugins/devflow-python/.claude-plugin/plugin.json +1 -1
  80. package/plugins/devflow-react/.claude-plugin/plugin.json +1 -1
  81. package/plugins/devflow-resolve/.claude-plugin/plugin.json +1 -1
  82. package/plugins/devflow-resolve/agents/simplifier.md +24 -15
  83. package/plugins/devflow-rust/.claude-plugin/plugin.json +1 -1
  84. package/plugins/devflow-self-review/.claude-plugin/plugin.json +1 -1
  85. package/plugins/devflow-self-review/agents/scrutinizer.md +6 -4
  86. package/plugins/devflow-self-review/agents/simplifier.md +24 -15
  87. package/plugins/devflow-self-review/skills/self-review/references/stub-detection.md +135 -0
  88. package/plugins/devflow-specify/.claude-plugin/plugin.json +1 -1
  89. package/plugins/devflow-typescript/.claude-plugin/plugin.json +1 -1
  90. package/scripts/hud/cache.d.ts +14 -0
  91. package/scripts/hud/cache.d.ts.map +1 -0
  92. package/scripts/hud/cache.js +54 -0
  93. package/scripts/hud/cache.js.map +1 -0
  94. package/scripts/hud/colors.d.ts +23 -0
  95. package/scripts/hud/colors.d.ts.map +1 -0
  96. package/scripts/hud/colors.js +62 -0
  97. package/scripts/hud/colors.js.map +1 -0
  98. package/scripts/hud/components/config-counts.d.ts +8 -0
  99. package/scripts/hud/components/config-counts.d.ts.map +1 -0
  100. package/scripts/hud/components/config-counts.js +91 -0
  101. package/scripts/hud/components/config-counts.js.map +1 -0
  102. package/scripts/hud/components/context-usage.d.ts +8 -0
  103. package/scripts/hud/components/context-usage.d.ts.map +1 -0
  104. package/scripts/hud/components/context-usage.js +49 -0
  105. package/scripts/hud/components/context-usage.js.map +1 -0
  106. package/scripts/hud/components/diff-stats.d.ts +3 -0
  107. package/scripts/hud/components/diff-stats.d.ts.map +1 -0
  108. package/scripts/hud/components/diff-stats.js +36 -0
  109. package/scripts/hud/components/diff-stats.js.map +1 -0
  110. package/scripts/hud/components/directory.d.ts +3 -0
  111. package/scripts/hud/components/directory.d.ts.map +1 -0
  112. package/scripts/hud/components/directory.js +10 -0
  113. package/scripts/hud/components/directory.js.map +1 -0
  114. package/scripts/hud/components/git-ahead-behind.d.ts +3 -0
  115. package/scripts/hud/components/git-ahead-behind.d.ts.map +1 -0
  116. package/scripts/hud/components/git-ahead-behind.js +16 -0
  117. package/scripts/hud/components/git-ahead-behind.js.map +1 -0
  118. package/scripts/hud/components/git-branch.d.ts +3 -0
  119. package/scripts/hud/components/git-branch.d.ts.map +1 -0
  120. package/scripts/hud/components/git-branch.js +14 -0
  121. package/scripts/hud/components/git-branch.js.map +1 -0
  122. package/scripts/hud/components/model.d.ts +3 -0
  123. package/scripts/hud/components/model.d.ts.map +1 -0
  124. package/scripts/hud/components/model.js +21 -0
  125. package/scripts/hud/components/model.js.map +1 -0
  126. package/scripts/hud/components/release-info.d.ts +3 -0
  127. package/scripts/hud/components/release-info.d.ts.map +1 -0
  128. package/scripts/hud/components/release-info.js +9 -0
  129. package/scripts/hud/components/release-info.js.map +1 -0
  130. package/scripts/hud/components/session-cost.d.ts +3 -0
  131. package/scripts/hud/components/session-cost.d.ts.map +1 -0
  132. package/scripts/hud/components/session-cost.js +9 -0
  133. package/scripts/hud/components/session-cost.js.map +1 -0
  134. package/scripts/hud/components/session-duration.d.ts +3 -0
  135. package/scripts/hud/components/session-duration.d.ts.map +1 -0
  136. package/scripts/hud/components/session-duration.js +18 -0
  137. package/scripts/hud/components/session-duration.js.map +1 -0
  138. package/scripts/hud/components/todo-progress.d.ts +3 -0
  139. package/scripts/hud/components/todo-progress.d.ts.map +1 -0
  140. package/scripts/hud/components/todo-progress.js +11 -0
  141. package/scripts/hud/components/todo-progress.js.map +1 -0
  142. package/scripts/hud/components/usage-quota.d.ts +3 -0
  143. package/scripts/hud/components/usage-quota.d.ts.map +1 -0
  144. package/scripts/hud/components/usage-quota.js +45 -0
  145. package/scripts/hud/components/usage-quota.js.map +1 -0
  146. package/scripts/hud/components/version-badge.d.ts +3 -0
  147. package/scripts/hud/components/version-badge.d.ts.map +1 -0
  148. package/scripts/hud/components/version-badge.js +80 -0
  149. package/scripts/hud/components/version-badge.js.map +1 -0
  150. package/scripts/hud/components/worktree-count.d.ts +3 -0
  151. package/scripts/hud/components/worktree-count.d.ts.map +1 -0
  152. package/scripts/hud/components/worktree-count.js +8 -0
  153. package/scripts/hud/components/worktree-count.js.map +1 -0
  154. package/scripts/hud/config.d.ts +10 -0
  155. package/scripts/hud/config.d.ts.map +1 -0
  156. package/scripts/hud/config.js +55 -0
  157. package/scripts/hud/config.js.map +1 -0
  158. package/scripts/hud/credentials.d.ts +17 -0
  159. package/scripts/hud/credentials.d.ts.map +1 -0
  160. package/scripts/hud/credentials.js +99 -0
  161. package/scripts/hud/credentials.js.map +1 -0
  162. package/scripts/hud/git.d.ts +7 -0
  163. package/scripts/hud/git.d.ts.map +1 -0
  164. package/scripts/hud/git.js +153 -0
  165. package/scripts/hud/git.js.map +1 -0
  166. package/scripts/hud/index.d.ts +2 -0
  167. package/scripts/hud/index.d.ts.map +1 -0
  168. package/scripts/hud/index.js +81 -0
  169. package/scripts/hud/index.js.map +1 -0
  170. package/scripts/hud/render.d.ts +7 -0
  171. package/scripts/hud/render.d.ts.map +1 -0
  172. package/scripts/hud/render.js +111 -0
  173. package/scripts/hud/render.js.map +1 -0
  174. package/scripts/hud/stdin.d.ts +6 -0
  175. package/scripts/hud/stdin.d.ts.map +1 -0
  176. package/scripts/hud/stdin.js +25 -0
  177. package/scripts/hud/stdin.js.map +1 -0
  178. package/scripts/hud/transcript.d.ts +7 -0
  179. package/scripts/hud/transcript.d.ts.map +1 -0
  180. package/scripts/hud/transcript.js +130 -0
  181. package/scripts/hud/transcript.js.map +1 -0
  182. package/scripts/hud/types.d.ts +116 -0
  183. package/scripts/hud/types.d.ts.map +1 -0
  184. package/scripts/hud/types.js +2 -0
  185. package/scripts/hud/types.js.map +1 -0
  186. package/scripts/hud/usage-api.d.ts +7 -0
  187. package/scripts/hud/usage-api.d.ts.map +1 -0
  188. package/scripts/hud/usage-api.js +84 -0
  189. package/scripts/hud/usage-api.js.map +1 -0
  190. package/scripts/hud.sh +5 -0
  191. package/shared/agents/scrutinizer.md +6 -4
  192. package/shared/agents/shepherd.md +26 -12
  193. package/shared/agents/simplifier.md +24 -15
  194. package/shared/skills/self-review/references/stub-detection.md +135 -0
  195. package/src/templates/settings.json +1 -1
@@ -0,0 +1,62 @@
1
+ /**
2
+ * ANSI color helpers — no dependencies, precompiled escape sequences.
3
+ * Used by HUD components for direct terminal output (not @clack/prompts).
4
+ */
5
+ const ESC = '\x1b[';
6
+ const RESET = `${ESC}0m`;
7
+ export function bold(s) {
8
+ return `${ESC}1m${s}${RESET}`;
9
+ }
10
+ export function dim(s) {
11
+ return `${ESC}2m${s}${RESET}`;
12
+ }
13
+ export function red(s) {
14
+ return `${ESC}31m${s}${RESET}`;
15
+ }
16
+ export function green(s) {
17
+ return `${ESC}32m${s}${RESET}`;
18
+ }
19
+ export function yellow(s) {
20
+ return `${ESC}33m${s}${RESET}`;
21
+ }
22
+ export function blue(s) {
23
+ return `${ESC}34m${s}${RESET}`;
24
+ }
25
+ export function magenta(s) {
26
+ return `${ESC}35m${s}${RESET}`;
27
+ }
28
+ export function cyan(s) {
29
+ return `${ESC}36m${s}${RESET}`;
30
+ }
31
+ export function gray(s) {
32
+ return `${ESC}90m${s}${RESET}`;
33
+ }
34
+ export function white(s) {
35
+ return `${ESC}37m${s}${RESET}`;
36
+ }
37
+ export function orange(s) {
38
+ return `${ESC}38;5;208m${s}${RESET}`;
39
+ }
40
+ export function brightRed(s) {
41
+ return `${ESC}91m${s}${RESET}`;
42
+ }
43
+ export function boldRed(s) {
44
+ return `${ESC}1;31m${s}${RESET}`;
45
+ }
46
+ export function bgGreen(s) {
47
+ return `${ESC}42m${s}${RESET}`;
48
+ }
49
+ export function bgYellow(s) {
50
+ return `${ESC}43m${s}${RESET}`;
51
+ }
52
+ export function bgRed(s) {
53
+ return `${ESC}41m${s}${RESET}`;
54
+ }
55
+ export function truncate(s, max) {
56
+ return s.length > max ? s.slice(0, max - 1) + '\u2026' : s;
57
+ }
58
+ const ANSI_PATTERN = /\x1b\[[0-9;]*m/g;
59
+ export function stripAnsi(s) {
60
+ return s.replace(ANSI_PATTERN, '');
61
+ }
62
+ //# sourceMappingURL=colors.js.map
@@ -0,0 +1,8 @@
1
+ import type { ComponentResult, GatherContext, ConfigCountsData } from '../types.js';
2
+ /**
3
+ * Gather configuration counts for the configCounts component.
4
+ * Exported for use by the main HUD entry point.
5
+ */
6
+ export declare function gatherConfigCounts(cwd: string): ConfigCountsData;
7
+ export default function configCounts(ctx: GatherContext): Promise<ComponentResult | null>;
8
+ //# sourceMappingURL=config-counts.d.ts.map
@@ -0,0 +1,91 @@
1
+ import * as fs from 'node:fs';
2
+ import * as path from 'node:path';
3
+ import { homedir } from 'node:os';
4
+ import { dim } from '../colors.js';
5
+ function countClaudeMdFiles(cwd) {
6
+ let count = 0;
7
+ // Check project CLAUDE.md
8
+ if (fs.existsSync(path.join(cwd, 'CLAUDE.md')))
9
+ count++;
10
+ // Check user CLAUDE.md
11
+ const claudeDir = process.env.CLAUDE_CONFIG_DIR ||
12
+ path.join(process.env.HOME || homedir(), '.claude');
13
+ if (fs.existsSync(path.join(claudeDir, 'CLAUDE.md')))
14
+ count++;
15
+ return count;
16
+ }
17
+ function countFromSettings(settingsPath) {
18
+ try {
19
+ const settings = JSON.parse(fs.readFileSync(settingsPath, 'utf-8'));
20
+ const mcpServers = settings.mcpServers
21
+ ? Object.keys(settings.mcpServers).length
22
+ : 0;
23
+ let hooks = 0;
24
+ if (settings.hooks) {
25
+ const hooksObj = settings.hooks;
26
+ for (const event of Object.values(hooksObj)) {
27
+ if (Array.isArray(event))
28
+ hooks += event.length;
29
+ }
30
+ }
31
+ return { mcpServers, hooks };
32
+ }
33
+ catch {
34
+ return { mcpServers: 0, hooks: 0 };
35
+ }
36
+ }
37
+ /**
38
+ * Gather configuration counts for the configCounts component.
39
+ * Exported for use by the main HUD entry point.
40
+ */
41
+ export function gatherConfigCounts(cwd) {
42
+ const claudeDir = process.env.CLAUDE_CONFIG_DIR ||
43
+ path.join(process.env.HOME || homedir(), '.claude');
44
+ const claudeMdFiles = countClaudeMdFiles(cwd);
45
+ // Count rules (.md/.mdc files in .claude/rules)
46
+ let rules = 0;
47
+ for (const rulesDir of [
48
+ path.join(cwd, '.claude', 'rules'),
49
+ path.join(claudeDir, 'rules'),
50
+ ]) {
51
+ try {
52
+ const files = fs.readdirSync(rulesDir);
53
+ rules += files.filter((f) => f.endsWith('.md') || f.endsWith('.mdc')).length;
54
+ }
55
+ catch {
56
+ /* ignore */
57
+ }
58
+ }
59
+ // Aggregate settings from user and project
60
+ const userSettings = countFromSettings(path.join(claudeDir, 'settings.json'));
61
+ const projectSettings = countFromSettings(path.join(cwd, '.claude', 'settings.json'));
62
+ return {
63
+ claudeMdFiles,
64
+ rules,
65
+ mcpServers: userSettings.mcpServers + projectSettings.mcpServers,
66
+ hooks: userSettings.hooks + projectSettings.hooks,
67
+ };
68
+ }
69
+ export default async function configCounts(ctx) {
70
+ if (!ctx.configCounts)
71
+ return null;
72
+ const { claudeMdFiles, rules: ruleCount, mcpServers, hooks: hookCount } = ctx.configCounts;
73
+ const skillCount = ctx.transcript?.skills.length ?? 0;
74
+ const parts = [];
75
+ if (claudeMdFiles > 0)
76
+ parts.push(`${claudeMdFiles} CLAUDE.md`);
77
+ if (ruleCount > 0)
78
+ parts.push(`${ruleCount} rules`);
79
+ if (mcpServers > 0)
80
+ parts.push(`${mcpServers} MCPs`);
81
+ if (hookCount > 0)
82
+ parts.push(`${hookCount} hooks`);
83
+ if (skillCount > 0)
84
+ parts.push(`${skillCount} skills`);
85
+ if (parts.length === 0)
86
+ return null;
87
+ const raw = parts.join(' \u00B7 ');
88
+ const text = parts.map((p) => dim(p)).join(dim(' \u00B7 '));
89
+ return { text, raw };
90
+ }
91
+ //# sourceMappingURL=config-counts.js.map
@@ -0,0 +1,8 @@
1
+ import type { ComponentResult, GatherContext } from '../types.js';
2
+ /**
3
+ * Context window usage component.
4
+ * Visual bar with 3-tier color gradient matching usage-quota: green / yellow / red.
5
+ * At >85% appends token breakdown: (in: Nk).
6
+ */
7
+ export default function contextUsage(ctx: GatherContext): Promise<ComponentResult | null>;
8
+ //# sourceMappingURL=context-usage.d.ts.map
@@ -0,0 +1,49 @@
1
+ import { dim, green, yellow, red } from '../colors.js';
2
+ const BAR_WIDTH = 8;
3
+ /**
4
+ * Context window usage component.
5
+ * Visual bar with 3-tier color gradient matching usage-quota: green / yellow / red.
6
+ * At >85% appends token breakdown: (in: Nk).
7
+ */
8
+ export default async function contextUsage(ctx) {
9
+ const cw = ctx.stdin.context_window;
10
+ if (!cw)
11
+ return null;
12
+ let pct = null;
13
+ if (cw.used_percentage !== undefined) {
14
+ pct = Math.round(cw.used_percentage);
15
+ }
16
+ else if (cw.context_window_size && cw.current_usage?.input_tokens !== undefined) {
17
+ pct = Math.round((cw.current_usage.input_tokens / cw.context_window_size) * 100);
18
+ }
19
+ if (pct === null)
20
+ return null;
21
+ const filled = Math.round((pct / 100) * BAR_WIDTH);
22
+ const empty = BAR_WIDTH - filled;
23
+ let colorFn;
24
+ if (pct < 50) {
25
+ colorFn = green;
26
+ }
27
+ else if (pct < 80) {
28
+ colorFn = yellow;
29
+ }
30
+ else {
31
+ colorFn = red;
32
+ }
33
+ const filledBar = '\u2588'.repeat(filled);
34
+ const emptyBar = '\u2591'.repeat(empty);
35
+ let suffix = '';
36
+ if (pct > 85 && cw.current_usage?.input_tokens !== undefined) {
37
+ const inK = Math.round(cw.current_usage.input_tokens / 1000);
38
+ suffix = ` (in: ${inK}k)`;
39
+ }
40
+ const raw = `Current Session ${filledBar}${emptyBar} ${pct}%${suffix}`;
41
+ const text = dim('Current Session ') +
42
+ colorFn(filledBar) +
43
+ dim(emptyBar) +
44
+ ' ' +
45
+ colorFn(`${pct}%`) +
46
+ (suffix ? dim(suffix) : '');
47
+ return { text, raw };
48
+ }
49
+ //# sourceMappingURL=context-usage.js.map
@@ -0,0 +1,3 @@
1
+ import type { ComponentResult, GatherContext } from '../types.js';
2
+ export default function diffStats(ctx: GatherContext): Promise<ComponentResult | null>;
3
+ //# sourceMappingURL=diff-stats.d.ts.map
@@ -0,0 +1,36 @@
1
+ import { dim, green, red } from '../colors.js';
2
+ export default async function diffStats(ctx) {
3
+ if (!ctx.git)
4
+ return null;
5
+ const { filesChanged, additions, deletions } = ctx.git;
6
+ if (filesChanged === 0 && additions === 0 && deletions === 0)
7
+ return null;
8
+ const filePart = filesChanged > 0
9
+ ? `${filesChanged} file${filesChanged === 1 ? '' : 's'}`
10
+ : '';
11
+ const lineParts = [];
12
+ if (additions > 0)
13
+ lineParts.push(`+${additions}`);
14
+ if (deletions > 0)
15
+ lineParts.push(`-${deletions}`);
16
+ const sections = [];
17
+ const rawSections = [];
18
+ if (filePart) {
19
+ sections.push(dim(filePart));
20
+ rawSections.push(filePart);
21
+ }
22
+ if (lineParts.length > 0) {
23
+ const lineText = lineParts
24
+ .map((p) => (p.startsWith('+') ? green(p) : red(p)))
25
+ .join(' ');
26
+ sections.push(lineText);
27
+ rawSections.push(lineParts.join(' '));
28
+ }
29
+ if (sections.length === 0)
30
+ return null;
31
+ return {
32
+ text: sections.join(dim(' \u00B7 ')),
33
+ raw: rawSections.join(' \u00B7 '),
34
+ };
35
+ }
36
+ //# sourceMappingURL=diff-stats.js.map
@@ -0,0 +1,3 @@
1
+ import type { ComponentResult, GatherContext } from '../types.js';
2
+ export default function directory(ctx: GatherContext): Promise<ComponentResult | null>;
3
+ //# sourceMappingURL=directory.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { bold, white } from '../colors.js';
2
+ import * as path from 'node:path';
3
+ export default async function directory(ctx) {
4
+ const cwd = ctx.stdin.cwd;
5
+ if (!cwd)
6
+ return null;
7
+ const name = path.basename(cwd);
8
+ return { text: bold(white(name)), raw: name };
9
+ }
10
+ //# sourceMappingURL=directory.js.map
@@ -0,0 +1,3 @@
1
+ import type { ComponentResult, GatherContext } from '../types.js';
2
+ export default function gitAheadBehind(ctx: GatherContext): Promise<ComponentResult | null>;
3
+ //# sourceMappingURL=git-ahead-behind.d.ts.map
@@ -0,0 +1,16 @@
1
+ import { dim } from '../colors.js';
2
+ export default async function gitAheadBehind(ctx) {
3
+ if (!ctx.git)
4
+ return null;
5
+ const { ahead, behind } = ctx.git;
6
+ if (ahead === 0 && behind === 0)
7
+ return null;
8
+ const rawParts = [];
9
+ if (ahead > 0)
10
+ rawParts.push(`${ahead}\u2191`);
11
+ if (behind > 0)
12
+ rawParts.push(`${behind}\u2193`);
13
+ const raw = rawParts.join(' ');
14
+ return { text: dim(raw), raw };
15
+ }
16
+ //# sourceMappingURL=git-ahead-behind.js.map
@@ -0,0 +1,3 @@
1
+ import type { ComponentResult, GatherContext } from '../types.js';
2
+ export default function gitBranch(ctx: GatherContext): Promise<ComponentResult | null>;
3
+ //# sourceMappingURL=git-branch.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { white, yellow, green } from '../colors.js';
2
+ export default async function gitBranch(ctx) {
3
+ if (!ctx.git)
4
+ return null;
5
+ const dirtyMark = ctx.git.dirty ? '*' : '';
6
+ const stagedMark = ctx.git.staged ? '+' : '';
7
+ const indicator = dirtyMark + stagedMark;
8
+ const text = white(ctx.git.branch) +
9
+ (dirtyMark ? yellow(dirtyMark) : '') +
10
+ (stagedMark ? green(stagedMark) : '');
11
+ const raw = ctx.git.branch + indicator;
12
+ return { text, raw };
13
+ }
14
+ //# sourceMappingURL=git-branch.js.map
@@ -0,0 +1,3 @@
1
+ import type { ComponentResult, GatherContext } from '../types.js';
2
+ export default function model(ctx: GatherContext): Promise<ComponentResult | null>;
3
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1,21 @@
1
+ import { dim, white } from '../colors.js';
2
+ export default async function model(ctx) {
3
+ const name = ctx.stdin.model?.display_name;
4
+ if (!name)
5
+ return null;
6
+ // Strip "Claude " prefix and trailing context info like "(1M context)" for brevity
7
+ const short = name
8
+ .replace(/^Claude\s+/i, '')
9
+ .replace(/\s*\(\d+[KkMm]\s*context\)\s*$/, '');
10
+ const cwSize = ctx.stdin.context_window?.context_window_size;
11
+ let sizeStr = '';
12
+ if (cwSize) {
13
+ sizeStr =
14
+ cwSize >= 1_000_000
15
+ ? ` [${Math.round(cwSize / 1_000_000)}m]`
16
+ : ` [${Math.round(cwSize / 1000)}k]`;
17
+ }
18
+ const raw = short + sizeStr;
19
+ return { text: white(short) + (sizeStr ? dim(sizeStr) : ''), raw };
20
+ }
21
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1,3 @@
1
+ import type { ComponentResult, GatherContext } from '../types.js';
2
+ export default function releaseInfo(ctx: GatherContext): Promise<ComponentResult | null>;
3
+ //# sourceMappingURL=release-info.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { dim } from '../colors.js';
2
+ export default async function releaseInfo(ctx) {
3
+ if (!ctx.git?.lastTag)
4
+ return null;
5
+ const { lastTag, commitsSinceTag } = ctx.git;
6
+ const raw = commitsSinceTag > 0 ? `${lastTag} +${commitsSinceTag}` : lastTag;
7
+ return { text: dim(raw), raw };
8
+ }
9
+ //# sourceMappingURL=release-info.js.map
@@ -0,0 +1,3 @@
1
+ import type { ComponentResult, GatherContext } from '../types.js';
2
+ export default function sessionCost(ctx: GatherContext): Promise<ComponentResult | null>;
3
+ //# sourceMappingURL=session-cost.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { dim } from '../colors.js';
2
+ export default async function sessionCost(ctx) {
3
+ const cost = ctx.stdin.cost?.total_cost_usd;
4
+ if (cost == null)
5
+ return null;
6
+ const formatted = `$${cost.toFixed(2)}`;
7
+ return { text: dim(formatted), raw: formatted };
8
+ }
9
+ //# sourceMappingURL=session-cost.js.map
@@ -0,0 +1,3 @@
1
+ import type { ComponentResult, GatherContext } from '../types.js';
2
+ export default function sessionDuration(ctx: GatherContext): Promise<ComponentResult | null>;
3
+ //# sourceMappingURL=session-duration.d.ts.map
@@ -0,0 +1,18 @@
1
+ import { dim } from '../colors.js';
2
+ export default async function sessionDuration(ctx) {
3
+ if (!ctx.sessionStartTime)
4
+ return null;
5
+ const elapsed = Math.floor((Date.now() - ctx.sessionStartTime) / 1000);
6
+ const minutes = Math.floor(elapsed / 60);
7
+ const hours = Math.floor(minutes / 60);
8
+ let label;
9
+ if (hours > 0) {
10
+ label = `${hours}h ${minutes % 60}m`;
11
+ }
12
+ else {
13
+ label = `${minutes}m`;
14
+ }
15
+ const text = `\u23F1 ${label}`;
16
+ return { text: dim(text), raw: text };
17
+ }
18
+ //# sourceMappingURL=session-duration.js.map
@@ -0,0 +1,3 @@
1
+ import type { ComponentResult, GatherContext } from '../types.js';
2
+ export default function todoProgress(ctx: GatherContext): Promise<ComponentResult | null>;
3
+ //# sourceMappingURL=todo-progress.d.ts.map
@@ -0,0 +1,11 @@
1
+ import { dim } from '../colors.js';
2
+ export default async function todoProgress(ctx) {
3
+ if (!ctx.transcript)
4
+ return null;
5
+ const { todos } = ctx.transcript;
6
+ if (todos.total === 0)
7
+ return null;
8
+ const label = `${todos.completed}/${todos.total} todos`;
9
+ return { text: dim(label), raw: label };
10
+ }
11
+ //# sourceMappingURL=todo-progress.js.map
@@ -0,0 +1,3 @@
1
+ import type { ComponentResult, GatherContext } from '../types.js';
2
+ export default function usageQuota(ctx: GatherContext): Promise<ComponentResult | null>;
3
+ //# sourceMappingURL=usage-quota.d.ts.map
@@ -0,0 +1,45 @@
1
+ import { green, yellow, red, dim } from '../colors.js';
2
+ const BAR_WIDTH = 8;
3
+ function renderBar(percent) {
4
+ const filled = Math.round((percent / 100) * BAR_WIDTH);
5
+ const empty = BAR_WIDTH - filled;
6
+ let colorFn;
7
+ if (percent < 50) {
8
+ colorFn = green;
9
+ }
10
+ else if (percent < 80) {
11
+ colorFn = yellow;
12
+ }
13
+ else {
14
+ colorFn = red;
15
+ }
16
+ const filledBar = '\u2588'.repeat(filled);
17
+ const emptyBar = '\u2591'.repeat(empty);
18
+ const text = colorFn(filledBar) +
19
+ dim(emptyBar) +
20
+ ' ' +
21
+ colorFn(`${percent}%`);
22
+ const raw = `${filledBar}${emptyBar} ${percent}%`;
23
+ return { text, raw };
24
+ }
25
+ export default async function usageQuota(ctx) {
26
+ if (!ctx.usage)
27
+ return null;
28
+ const { fiveHourPercent, sevenDayPercent } = ctx.usage;
29
+ const parts = [];
30
+ if (fiveHourPercent !== null) {
31
+ const bar = renderBar(Math.round(fiveHourPercent));
32
+ parts.push({ text: dim('5h ') + bar.text, raw: `5h ${bar.raw}` });
33
+ }
34
+ if (sevenDayPercent !== null) {
35
+ const bar = renderBar(Math.round(sevenDayPercent));
36
+ parts.push({ text: dim('7d ') + bar.text, raw: `7d ${bar.raw}` });
37
+ }
38
+ if (parts.length === 0)
39
+ return null;
40
+ const sep = dim(' \u00B7 ');
41
+ const text = dim('Session ') + parts.map((p) => p.text).join(sep);
42
+ const raw = 'Session ' + parts.map((p) => p.raw).join(' \u00B7 ');
43
+ return { text, raw };
44
+ }
45
+ //# sourceMappingURL=usage-quota.js.map
@@ -0,0 +1,3 @@
1
+ import type { ComponentResult, GatherContext } from '../types.js';
2
+ export default function versionBadge(ctx: GatherContext): Promise<ComponentResult | null>;
3
+ //# sourceMappingURL=version-badge.d.ts.map
@@ -0,0 +1,80 @@
1
+ import { execFile } from 'node:child_process';
2
+ import * as fs from 'node:fs';
3
+ import * as path from 'node:path';
4
+ import { yellow } from '../colors.js';
5
+ import { readCache, writeCache } from '../cache.js';
6
+ const VERSION_CACHE_KEY = 'version-check';
7
+ const VERSION_CACHE_TTL = 24 * 60 * 60 * 1000; // 24 hours
8
+ function getCurrentVersion(devflowDir) {
9
+ // Try manifest.json first (most reliable for installed version)
10
+ try {
11
+ const manifestPath = path.join(devflowDir, 'manifest.json');
12
+ const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
13
+ if (typeof manifest.version === 'string')
14
+ return manifest.version;
15
+ }
16
+ catch {
17
+ // Fall through
18
+ }
19
+ // Try package.json as fallback
20
+ try {
21
+ const pkgPath = path.join(path.dirname(new URL(import.meta.url).pathname), '..', '..', '..', 'package.json');
22
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
23
+ if (typeof pkg.version === 'string')
24
+ return pkg.version;
25
+ }
26
+ catch {
27
+ // Fall through
28
+ }
29
+ return null;
30
+ }
31
+ function fetchLatestVersion() {
32
+ return new Promise((resolve) => {
33
+ execFile('npm', ['view', 'devflow-kit', 'version', '--json'], { timeout: 5000 }, (err, stdout) => {
34
+ if (err) {
35
+ resolve(null);
36
+ return;
37
+ }
38
+ try {
39
+ const parsed = JSON.parse(stdout.trim());
40
+ resolve(typeof parsed === 'string' ? parsed : null);
41
+ }
42
+ catch {
43
+ const trimmed = stdout.trim();
44
+ resolve(trimmed || null);
45
+ }
46
+ });
47
+ });
48
+ }
49
+ function compareVersions(current, latest) {
50
+ const a = current.split('.').map(Number);
51
+ const b = latest.split('.').map(Number);
52
+ for (let i = 0; i < 3; i++) {
53
+ if ((a[i] || 0) < (b[i] || 0))
54
+ return -1;
55
+ if ((a[i] || 0) > (b[i] || 0))
56
+ return 1;
57
+ }
58
+ return 0;
59
+ }
60
+ export default async function versionBadge(ctx) {
61
+ const current = getCurrentVersion(ctx.devflowDir);
62
+ if (!current)
63
+ return null;
64
+ // Check cache
65
+ let info = readCache(VERSION_CACHE_KEY);
66
+ if (!info) {
67
+ const latest = await fetchLatestVersion();
68
+ if (latest) {
69
+ info = { current, latest };
70
+ writeCache(VERSION_CACHE_KEY, info, VERSION_CACHE_TTL);
71
+ }
72
+ }
73
+ if (info && compareVersions(info.current, info.latest) < 0) {
74
+ const badge = `\u2726 Devflow v${info.latest} \u00B7 update: npx devflow-kit init`;
75
+ return { text: yellow(badge), raw: badge };
76
+ }
77
+ // Don't show version when up to date
78
+ return null;
79
+ }
80
+ //# sourceMappingURL=version-badge.js.map
@@ -0,0 +1,3 @@
1
+ import type { ComponentResult, GatherContext } from '../types.js';
2
+ export default function worktreeCount(ctx: GatherContext): Promise<ComponentResult | null>;
3
+ //# sourceMappingURL=worktree-count.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { dim } from '../colors.js';
2
+ export default async function worktreeCount(ctx) {
3
+ if (!ctx.git || ctx.git.worktreeCount <= 1)
4
+ return null;
5
+ const raw = `${ctx.git.worktreeCount} worktrees`;
6
+ return { text: dim(raw), raw };
7
+ }
8
+ //# sourceMappingURL=worktree-count.js.map
@@ -0,0 +1,10 @@
1
+ import type { HudConfig, ComponentId } from './types.js';
2
+ /**
3
+ * All 14 HUD components in display order.
4
+ */
5
+ export declare const HUD_COMPONENTS: readonly ComponentId[];
6
+ export declare function getConfigPath(): string;
7
+ export declare function loadConfig(): HudConfig;
8
+ export declare function saveConfig(config: HudConfig): void;
9
+ export declare function resolveComponents(config: HudConfig): ComponentId[];
10
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1,55 @@
1
+ import * as fs from 'node:fs';
2
+ import * as path from 'node:path';
3
+ import { homedir } from 'node:os';
4
+ /**
5
+ * All 14 HUD components in display order.
6
+ */
7
+ export const HUD_COMPONENTS = [
8
+ 'directory',
9
+ 'gitBranch',
10
+ 'gitAheadBehind',
11
+ 'diffStats',
12
+ 'releaseInfo',
13
+ 'worktreeCount',
14
+ 'model',
15
+ 'contextUsage',
16
+ 'versionBadge',
17
+ 'sessionDuration',
18
+ 'sessionCost',
19
+ 'usageQuota',
20
+ 'todoProgress',
21
+ 'configCounts',
22
+ ];
23
+ export function getConfigPath() {
24
+ const devflowDir = process.env.DEVFLOW_DIR || path.join(process.env.HOME || homedir(), '.devflow');
25
+ return path.join(devflowDir, 'hud.json');
26
+ }
27
+ export function loadConfig() {
28
+ const configPath = getConfigPath();
29
+ try {
30
+ const raw = fs.readFileSync(configPath, 'utf-8');
31
+ const parsed = JSON.parse(raw);
32
+ return {
33
+ enabled: parsed.enabled !== false,
34
+ detail: parsed.detail === true,
35
+ };
36
+ }
37
+ catch {
38
+ return { enabled: true, detail: false };
39
+ }
40
+ }
41
+ export function saveConfig(config) {
42
+ const configPath = getConfigPath();
43
+ const dir = path.dirname(configPath);
44
+ if (!fs.existsSync(dir)) {
45
+ fs.mkdirSync(dir, { recursive: true });
46
+ }
47
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');
48
+ }
49
+ export function resolveComponents(config) {
50
+ if (config.enabled)
51
+ return [...HUD_COMPONENTS];
52
+ // Version badge always renders so users see upgrade notifications
53
+ return ['versionBadge'];
54
+ }
55
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1,17 @@
1
+ export interface OAuthCredentials {
2
+ accessToken: string;
3
+ subscriptionType?: string;
4
+ }
5
+ /** Resolve the Claude config directory, respecting CLAUDE_CONFIG_DIR. */
6
+ export declare function getClaudeDir(): string;
7
+ /** Read OAuth credentials from ~/.claude/.credentials.json. Injectable claudeDir for tests. */
8
+ export declare function readCredentialsFile(claudeDir?: string): OAuthCredentials | null;
9
+ /** Read OAuth token from macOS Keychain. Returns null on non-darwin or failure. */
10
+ export declare function readKeychainToken(): Promise<string | null>;
11
+ /**
12
+ * Get OAuth credentials using platform-appropriate strategy.
13
+ * macOS: Keychain first, then file fallback. Other platforms: file only.
14
+ * Hybrid: if Keychain has token but no subscriptionType, merge from file.
15
+ */
16
+ export declare function getCredentials(): Promise<OAuthCredentials | null>;
17
+ //# sourceMappingURL=credentials.d.ts.map