Features: - 30+ Custom Skills (cognitive, development, UI/UX, autonomous agents) - RalphLoop autonomous agent integration - Multi-AI consultation (Qwen) - Agent management system with sync capabilities - Custom hooks for session management - MCP servers integration - Plugin marketplace setup - Comprehensive installation script Components: - Skills: always-use-superpowers, ralph, brainstorming, ui-ux-pro-max, etc. - Agents: 100+ agents across engineering, marketing, product, etc. - Hooks: session-start-superpowers, qwen-consult, ralph-auto-trigger - Commands: /brainstorm, /write-plan, /execute-plan - MCP Servers: zai-mcp-server, web-search-prime, web-reader, zread - Binaries: ralphloop wrapper Installation: ./supercharge.sh
75 lines
2.4 KiB
JavaScript
75 lines
2.4 KiB
JavaScript
import { readStdin } from './stdin.js';
|
|
import { parseTranscript } from './transcript.js';
|
|
import { render } from './render/index.js';
|
|
import { countConfigs } from './config-reader.js';
|
|
import { getGitStatus } from './git.js';
|
|
import { getUsage } from './usage-api.js';
|
|
import { loadConfig } from './config.js';
|
|
import { fileURLToPath } from 'node:url';
|
|
export async function main(overrides = {}) {
|
|
const deps = {
|
|
readStdin,
|
|
parseTranscript,
|
|
countConfigs,
|
|
getGitStatus,
|
|
getUsage,
|
|
loadConfig,
|
|
render,
|
|
now: () => Date.now(),
|
|
log: console.log,
|
|
...overrides,
|
|
};
|
|
try {
|
|
const stdin = await deps.readStdin();
|
|
if (!stdin) {
|
|
deps.log('[claude-hud] Initializing...');
|
|
return;
|
|
}
|
|
const transcriptPath = stdin.transcript_path ?? '';
|
|
const transcript = await deps.parseTranscript(transcriptPath);
|
|
const { claudeMdCount, rulesCount, mcpCount, hooksCount } = await deps.countConfigs(stdin.cwd);
|
|
const config = await deps.loadConfig();
|
|
const gitStatus = config.gitStatus.enabled
|
|
? await deps.getGitStatus(stdin.cwd)
|
|
: null;
|
|
// Only fetch usage if enabled in config (replaces env var requirement)
|
|
const usageData = config.display.showUsage !== false
|
|
? await deps.getUsage()
|
|
: null;
|
|
const sessionDuration = formatSessionDuration(transcript.sessionStart, deps.now);
|
|
const ctx = {
|
|
stdin,
|
|
transcript,
|
|
claudeMdCount,
|
|
rulesCount,
|
|
mcpCount,
|
|
hooksCount,
|
|
sessionDuration,
|
|
gitStatus,
|
|
usageData,
|
|
config,
|
|
};
|
|
deps.render(ctx);
|
|
}
|
|
catch (error) {
|
|
deps.log('[claude-hud] Error:', error instanceof Error ? error.message : 'Unknown error');
|
|
}
|
|
}
|
|
export function formatSessionDuration(sessionStart, now = () => Date.now()) {
|
|
if (!sessionStart) {
|
|
return '';
|
|
}
|
|
const ms = now() - sessionStart.getTime();
|
|
const mins = Math.floor(ms / 60000);
|
|
if (mins < 1)
|
|
return '<1m';
|
|
if (mins < 60)
|
|
return `${mins}m`;
|
|
const hours = Math.floor(mins / 60);
|
|
const remainingMins = mins % 60;
|
|
return `${hours}h ${remainingMins}m`;
|
|
}
|
|
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
void main();
|
|
}
|
|
//# sourceMappingURL=index.js.map
|