devflow-kit 1.6.1 → 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.
- package/CHANGELOG.md +45 -0
- package/README.md +31 -0
- package/dist/cli.js +3 -1
- package/dist/commands/hud.d.ts +22 -0
- package/dist/commands/hud.js +180 -0
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +114 -5
- package/dist/commands/list.js +1 -0
- package/dist/commands/uninstall.js +9 -16
- package/dist/hud/cache.d.ts +14 -0
- package/dist/hud/cache.js +54 -0
- package/dist/hud/colors.d.ts +23 -0
- package/dist/hud/colors.js +62 -0
- package/dist/hud/components/config-counts.d.ts +8 -0
- package/dist/hud/components/config-counts.js +91 -0
- package/dist/hud/components/context-usage.d.ts +8 -0
- package/dist/hud/components/context-usage.js +49 -0
- package/dist/hud/components/diff-stats.d.ts +3 -0
- package/dist/hud/components/diff-stats.js +36 -0
- package/dist/hud/components/directory.d.ts +3 -0
- package/dist/hud/components/directory.js +10 -0
- package/dist/hud/components/git-ahead-behind.d.ts +3 -0
- package/dist/hud/components/git-ahead-behind.js +16 -0
- package/dist/hud/components/git-branch.d.ts +3 -0
- package/dist/hud/components/git-branch.js +14 -0
- package/dist/hud/components/model.d.ts +3 -0
- package/dist/hud/components/model.js +21 -0
- package/dist/hud/components/release-info.d.ts +3 -0
- package/dist/hud/components/release-info.js +9 -0
- package/dist/hud/components/session-cost.d.ts +3 -0
- package/dist/hud/components/session-cost.js +9 -0
- package/dist/hud/components/session-duration.d.ts +3 -0
- package/dist/hud/components/session-duration.js +18 -0
- package/dist/hud/components/todo-progress.d.ts +3 -0
- package/dist/hud/components/todo-progress.js +11 -0
- package/dist/hud/components/usage-quota.d.ts +3 -0
- package/dist/hud/components/usage-quota.js +45 -0
- package/dist/hud/components/version-badge.d.ts +3 -0
- package/dist/hud/components/version-badge.js +80 -0
- package/dist/hud/components/worktree-count.d.ts +3 -0
- package/dist/hud/components/worktree-count.js +8 -0
- package/dist/hud/config.d.ts +10 -0
- package/dist/hud/config.js +55 -0
- package/dist/hud/credentials.d.ts +17 -0
- package/dist/hud/credentials.js +99 -0
- package/dist/hud/git.d.ts +7 -0
- package/dist/hud/git.js +153 -0
- package/dist/hud/index.d.ts +2 -0
- package/dist/hud/index.js +81 -0
- package/dist/hud/render.d.ts +7 -0
- package/dist/hud/render.js +111 -0
- package/dist/hud/stdin.d.ts +6 -0
- package/dist/hud/stdin.js +25 -0
- package/dist/hud/transcript.d.ts +7 -0
- package/dist/hud/transcript.js +130 -0
- package/dist/hud/types.d.ts +116 -0
- package/dist/hud/types.js +2 -0
- package/dist/hud/usage-api.d.ts +7 -0
- package/dist/hud/usage-api.js +84 -0
- package/dist/utils/manifest.d.ts +1 -0
- package/package.json +5 -2
- package/plugins/devflow-accessibility/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-ambient/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-ambient/agents/scrutinizer.md +6 -4
- package/plugins/devflow-ambient/agents/shepherd.md +26 -12
- package/plugins/devflow-ambient/agents/simplifier.md +24 -15
- package/plugins/devflow-ambient/agents/skimmer.md +71 -21
- package/plugins/devflow-audit-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-code-review/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-core-skills/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-debug/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-frontend-design/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-go/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-implement/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-implement/agents/scrutinizer.md +6 -4
- package/plugins/devflow-implement/agents/shepherd.md +26 -12
- package/plugins/devflow-implement/agents/simplifier.md +24 -15
- package/plugins/devflow-implement/agents/skimmer.md +71 -21
- package/plugins/devflow-implement/commands/implement-teams.md +1 -1
- package/plugins/devflow-implement/commands/implement.md +1 -1
- package/plugins/devflow-implement/skills/self-review/references/stub-detection.md +135 -0
- package/plugins/devflow-java/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-python/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-react/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-resolve/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-resolve/agents/simplifier.md +24 -15
- package/plugins/devflow-rust/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-self-review/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-self-review/agents/scrutinizer.md +6 -4
- package/plugins/devflow-self-review/agents/simplifier.md +24 -15
- package/plugins/devflow-self-review/skills/self-review/references/stub-detection.md +135 -0
- package/plugins/devflow-specify/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-specify/agents/skimmer.md +71 -21
- package/plugins/devflow-specify/commands/specify-teams.md +1 -1
- package/plugins/devflow-specify/commands/specify.md +1 -1
- package/plugins/devflow-typescript/.claude-plugin/plugin.json +1 -1
- package/scripts/hud/cache.d.ts +14 -0
- package/scripts/hud/cache.d.ts.map +1 -0
- package/scripts/hud/cache.js +54 -0
- package/scripts/hud/cache.js.map +1 -0
- package/scripts/hud/colors.d.ts +23 -0
- package/scripts/hud/colors.d.ts.map +1 -0
- package/scripts/hud/colors.js +62 -0
- package/scripts/hud/colors.js.map +1 -0
- package/scripts/hud/components/config-counts.d.ts +8 -0
- package/scripts/hud/components/config-counts.d.ts.map +1 -0
- package/scripts/hud/components/config-counts.js +91 -0
- package/scripts/hud/components/config-counts.js.map +1 -0
- package/scripts/hud/components/context-usage.d.ts +8 -0
- package/scripts/hud/components/context-usage.d.ts.map +1 -0
- package/scripts/hud/components/context-usage.js +49 -0
- package/scripts/hud/components/context-usage.js.map +1 -0
- package/scripts/hud/components/diff-stats.d.ts +3 -0
- package/scripts/hud/components/diff-stats.d.ts.map +1 -0
- package/scripts/hud/components/diff-stats.js +36 -0
- package/scripts/hud/components/diff-stats.js.map +1 -0
- package/scripts/hud/components/directory.d.ts +3 -0
- package/scripts/hud/components/directory.d.ts.map +1 -0
- package/scripts/hud/components/directory.js +10 -0
- package/scripts/hud/components/directory.js.map +1 -0
- package/scripts/hud/components/git-ahead-behind.d.ts +3 -0
- package/scripts/hud/components/git-ahead-behind.d.ts.map +1 -0
- package/scripts/hud/components/git-ahead-behind.js +16 -0
- package/scripts/hud/components/git-ahead-behind.js.map +1 -0
- package/scripts/hud/components/git-branch.d.ts +3 -0
- package/scripts/hud/components/git-branch.d.ts.map +1 -0
- package/scripts/hud/components/git-branch.js +14 -0
- package/scripts/hud/components/git-branch.js.map +1 -0
- package/scripts/hud/components/model.d.ts +3 -0
- package/scripts/hud/components/model.d.ts.map +1 -0
- package/scripts/hud/components/model.js +21 -0
- package/scripts/hud/components/model.js.map +1 -0
- package/scripts/hud/components/release-info.d.ts +3 -0
- package/scripts/hud/components/release-info.d.ts.map +1 -0
- package/scripts/hud/components/release-info.js +9 -0
- package/scripts/hud/components/release-info.js.map +1 -0
- package/scripts/hud/components/session-cost.d.ts +3 -0
- package/scripts/hud/components/session-cost.d.ts.map +1 -0
- package/scripts/hud/components/session-cost.js +9 -0
- package/scripts/hud/components/session-cost.js.map +1 -0
- package/scripts/hud/components/session-duration.d.ts +3 -0
- package/scripts/hud/components/session-duration.d.ts.map +1 -0
- package/scripts/hud/components/session-duration.js +18 -0
- package/scripts/hud/components/session-duration.js.map +1 -0
- package/scripts/hud/components/todo-progress.d.ts +3 -0
- package/scripts/hud/components/todo-progress.d.ts.map +1 -0
- package/scripts/hud/components/todo-progress.js +11 -0
- package/scripts/hud/components/todo-progress.js.map +1 -0
- package/scripts/hud/components/usage-quota.d.ts +3 -0
- package/scripts/hud/components/usage-quota.d.ts.map +1 -0
- package/scripts/hud/components/usage-quota.js +45 -0
- package/scripts/hud/components/usage-quota.js.map +1 -0
- package/scripts/hud/components/version-badge.d.ts +3 -0
- package/scripts/hud/components/version-badge.d.ts.map +1 -0
- package/scripts/hud/components/version-badge.js +80 -0
- package/scripts/hud/components/version-badge.js.map +1 -0
- package/scripts/hud/components/worktree-count.d.ts +3 -0
- package/scripts/hud/components/worktree-count.d.ts.map +1 -0
- package/scripts/hud/components/worktree-count.js +8 -0
- package/scripts/hud/components/worktree-count.js.map +1 -0
- package/scripts/hud/config.d.ts +10 -0
- package/scripts/hud/config.d.ts.map +1 -0
- package/scripts/hud/config.js +55 -0
- package/scripts/hud/config.js.map +1 -0
- package/scripts/hud/credentials.d.ts +17 -0
- package/scripts/hud/credentials.d.ts.map +1 -0
- package/scripts/hud/credentials.js +99 -0
- package/scripts/hud/credentials.js.map +1 -0
- package/scripts/hud/git.d.ts +7 -0
- package/scripts/hud/git.d.ts.map +1 -0
- package/scripts/hud/git.js +153 -0
- package/scripts/hud/git.js.map +1 -0
- package/scripts/hud/index.d.ts +2 -0
- package/scripts/hud/index.d.ts.map +1 -0
- package/scripts/hud/index.js +81 -0
- package/scripts/hud/index.js.map +1 -0
- package/scripts/hud/render.d.ts +7 -0
- package/scripts/hud/render.d.ts.map +1 -0
- package/scripts/hud/render.js +111 -0
- package/scripts/hud/render.js.map +1 -0
- package/scripts/hud/stdin.d.ts +6 -0
- package/scripts/hud/stdin.d.ts.map +1 -0
- package/scripts/hud/stdin.js +25 -0
- package/scripts/hud/stdin.js.map +1 -0
- package/scripts/hud/transcript.d.ts +7 -0
- package/scripts/hud/transcript.d.ts.map +1 -0
- package/scripts/hud/transcript.js +130 -0
- package/scripts/hud/transcript.js.map +1 -0
- package/scripts/hud/types.d.ts +116 -0
- package/scripts/hud/types.d.ts.map +1 -0
- package/scripts/hud/types.js +2 -0
- package/scripts/hud/types.js.map +1 -0
- package/scripts/hud/usage-api.d.ts +7 -0
- package/scripts/hud/usage-api.d.ts.map +1 -0
- package/scripts/hud/usage-api.js +84 -0
- package/scripts/hud/usage-api.js.map +1 -0
- package/scripts/hud.sh +5 -0
- package/shared/agents/scrutinizer.md +6 -4
- package/shared/agents/shepherd.md +26 -12
- package/shared/agents/simplifier.md +24 -15
- package/shared/agents/skimmer.md +71 -21
- package/shared/skills/self-review/references/stub-detection.md +135 -0
- package/src/templates/settings.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANSI color helpers — no dependencies, precompiled escape sequences.
|
|
3
|
+
* Used by HUD components for direct terminal output (not @clack/prompts).
|
|
4
|
+
*/
|
|
5
|
+
export declare function bold(s: string): string;
|
|
6
|
+
export declare function dim(s: string): string;
|
|
7
|
+
export declare function red(s: string): string;
|
|
8
|
+
export declare function green(s: string): string;
|
|
9
|
+
export declare function yellow(s: string): string;
|
|
10
|
+
export declare function blue(s: string): string;
|
|
11
|
+
export declare function magenta(s: string): string;
|
|
12
|
+
export declare function cyan(s: string): string;
|
|
13
|
+
export declare function gray(s: string): string;
|
|
14
|
+
export declare function white(s: string): string;
|
|
15
|
+
export declare function orange(s: string): string;
|
|
16
|
+
export declare function brightRed(s: string): string;
|
|
17
|
+
export declare function boldRed(s: string): string;
|
|
18
|
+
export declare function bgGreen(s: string): string;
|
|
19
|
+
export declare function bgYellow(s: string): string;
|
|
20
|
+
export declare function bgRed(s: string): string;
|
|
21
|
+
export declare function truncate(s: string, max: number): string;
|
|
22
|
+
export declare function stripAnsi(s: string): string;
|
|
23
|
+
//# sourceMappingURL=colors.d.ts.map
|
|
@@ -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,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,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,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,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,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,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,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,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,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,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,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,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
|