@bahulam/code 2.6.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/README.md +80 -0
- package/package.json +49 -0
- package/pulse/app/activity/page.tsx +190 -0
- package/pulse/app/api/activity/route.ts +138 -0
- package/pulse/app/api/benchmark/route.ts +113 -0
- package/pulse/app/api/benchmarks/route.ts +195 -0
- package/pulse/app/api/costs/route.ts +88 -0
- package/pulse/app/api/export/route.ts +77 -0
- package/pulse/app/api/history/route.ts +11 -0
- package/pulse/app/api/import/route.ts +31 -0
- package/pulse/app/api/memory/route.ts +50 -0
- package/pulse/app/api/plans/route.ts +9 -0
- package/pulse/app/api/projects/[slug]/route.ts +96 -0
- package/pulse/app/api/projects/route.ts +121 -0
- package/pulse/app/api/sessions/[id]/replay/route.ts +20 -0
- package/pulse/app/api/sessions/[id]/route.ts +31 -0
- package/pulse/app/api/sessions/route.ts +112 -0
- package/pulse/app/api/settings/route.ts +14 -0
- package/pulse/app/api/stats/route.ts +143 -0
- package/pulse/app/api/todos/route.ts +9 -0
- package/pulse/app/api/tools/route.ts +160 -0
- package/pulse/app/benchmarks/page.tsx +224 -0
- package/pulse/app/costs/page.tsx +179 -0
- package/pulse/app/export/page.tsx +465 -0
- package/pulse/app/favicon.ico +0 -0
- package/pulse/app/globals.css +263 -0
- package/pulse/app/help/page.tsx +143 -0
- package/pulse/app/history/page.tsx +157 -0
- package/pulse/app/layout.tsx +46 -0
- package/pulse/app/memory/page.tsx +365 -0
- package/pulse/app/overview-client.tsx +393 -0
- package/pulse/app/page.tsx +14 -0
- package/pulse/app/plans/page.tsx +308 -0
- package/pulse/app/projects/[slug]/page.tsx +390 -0
- package/pulse/app/projects/page.tsx +110 -0
- package/pulse/app/sessions/[id]/page.tsx +243 -0
- package/pulse/app/sessions/page.tsx +39 -0
- package/pulse/app/settings/page.tsx +188 -0
- package/pulse/app/todos/page.tsx +211 -0
- package/pulse/app/tools/page.tsx +249 -0
- package/pulse/cli.js +164 -0
- package/pulse/components/activity/day-of-week-chart.tsx +35 -0
- package/pulse/components/activity/streak-card.tsx +36 -0
- package/pulse/components/costs/cache-efficiency-panel.tsx +76 -0
- package/pulse/components/costs/cost-by-project-chart.tsx +48 -0
- package/pulse/components/costs/cost-over-time-chart.tsx +95 -0
- package/pulse/components/costs/model-token-table.tsx +60 -0
- package/pulse/components/global-search.tsx +193 -0
- package/pulse/components/keyboard-nav-provider.tsx +23 -0
- package/pulse/components/layout/bottom-nav.tsx +53 -0
- package/pulse/components/layout/client-layout.tsx +31 -0
- package/pulse/components/layout/sidebar-context.tsx +50 -0
- package/pulse/components/layout/sidebar.tsx +183 -0
- package/pulse/components/layout/top-bar.tsx +121 -0
- package/pulse/components/overview/activity-heatmap.tsx +107 -0
- package/pulse/components/overview/conversation-table.tsx +148 -0
- package/pulse/components/overview/model-breakdown-donut.tsx +95 -0
- package/pulse/components/overview/peak-hours-chart.tsx +87 -0
- package/pulse/components/overview/project-activity-donut.tsx +96 -0
- package/pulse/components/overview/stat-card.tsx +102 -0
- package/pulse/components/overview/usage-over-time-chart.tsx +166 -0
- package/pulse/components/projects/project-card.tsx +175 -0
- package/pulse/components/sessions/replay/assistant-markdown.tsx +94 -0
- package/pulse/components/sessions/replay/compaction-card.tsx +25 -0
- package/pulse/components/sessions/replay/session-sidebar.tsx +231 -0
- package/pulse/components/sessions/replay/token-accumulation-chart.tsx +98 -0
- package/pulse/components/sessions/replay/tool-call-badge.tsx +127 -0
- package/pulse/components/sessions/replay/turn-cards.tsx +220 -0
- package/pulse/components/sessions/replay/user-tool-result.tsx +158 -0
- package/pulse/components/sessions/session-badges.tsx +49 -0
- package/pulse/components/sessions/session-table.tsx +299 -0
- package/pulse/components/theme-provider.tsx +44 -0
- package/pulse/components/tools/feature-adoption-table.tsx +58 -0
- package/pulse/components/tools/mcp-server-panel.tsx +45 -0
- package/pulse/components/tools/tool-ranking-chart.tsx +57 -0
- package/pulse/components/tools/version-history-table.tsx +32 -0
- package/pulse/components/ui/alert.tsx +66 -0
- package/pulse/components/ui/badge.tsx +48 -0
- package/pulse/components/ui/breadcrumb.tsx +109 -0
- package/pulse/components/ui/button.tsx +64 -0
- package/pulse/components/ui/calendar.tsx +220 -0
- package/pulse/components/ui/card.tsx +92 -0
- package/pulse/components/ui/command.tsx +158 -0
- package/pulse/components/ui/dialog.tsx +158 -0
- package/pulse/components/ui/input.tsx +21 -0
- package/pulse/components/ui/popover.tsx +89 -0
- package/pulse/components/ui/progress.tsx +31 -0
- package/pulse/components/ui/select.tsx +190 -0
- package/pulse/components/ui/separator.tsx +28 -0
- package/pulse/components/ui/sheet.tsx +143 -0
- package/pulse/components/ui/skeleton.tsx +13 -0
- package/pulse/components/ui/table.tsx +116 -0
- package/pulse/components/ui/tabs.tsx +91 -0
- package/pulse/components/ui/tooltip.tsx +57 -0
- package/pulse/components/use-global-keyboard-nav.ts +79 -0
- package/pulse/components.json +23 -0
- package/pulse/eslint.config.mjs +18 -0
- package/pulse/lib/bahulam-paths.ts +23 -0
- package/pulse/lib/claude-reader.ts +592 -0
- package/pulse/lib/decode.ts +129 -0
- package/pulse/lib/pricing.ts +102 -0
- package/pulse/lib/replay-parser.ts +165 -0
- package/pulse/lib/tool-categories.ts +127 -0
- package/pulse/lib/utils.ts +6 -0
- package/pulse/next-env.d.ts +6 -0
- package/pulse/next.config.ts +16 -0
- package/pulse/package.json +45 -0
- package/pulse/postcss.config.mjs +7 -0
- package/pulse/public/activity.png +0 -0
- package/pulse/public/cc-lens.png +0 -0
- package/pulse/public/command-k.png +0 -0
- package/pulse/public/costs.png +0 -0
- package/pulse/public/dashboard-dark.png +0 -0
- package/pulse/public/dashboard-white.png +0 -0
- package/pulse/public/export.png +0 -0
- package/pulse/public/file.svg +1 -0
- package/pulse/public/globe.svg +1 -0
- package/pulse/public/next.svg +1 -0
- package/pulse/public/projects.png +0 -0
- package/pulse/public/session-chat.png +0 -0
- package/pulse/public/todos.png +0 -0
- package/pulse/public/tools.png +0 -0
- package/pulse/public/vercel.svg +1 -0
- package/pulse/public/window.svg +1 -0
- package/pulse/tsconfig.json +34 -0
- package/pulse/types/claude.ts +294 -0
- package/src/agents/loader.mjs +94 -0
- package/src/agents/multi_workflow_loader.mjs +330 -0
- package/src/agents/parser.mjs +205 -0
- package/src/agents/scaffold.mjs +222 -0
- package/src/agents/teams.mjs +123 -0
- package/src/agents/workflow_loader.mjs +122 -0
- package/src/agents/workflow_scaffold.mjs +249 -0
- package/src/auth/oauth.mjs +220 -0
- package/src/auth/tarang-auth.mjs +306 -0
- package/src/commands/agent.mjs +220 -0
- package/src/commands/workflow.mjs +581 -0
- package/src/config/cli-args.mjs +200 -0
- package/src/config/env.mjs +263 -0
- package/src/config/hook-runner.mjs +100 -0
- package/src/config/memory-loader.mjs +32 -0
- package/src/config/settings-loader.mjs +45 -0
- package/src/config/settings.mjs +132 -0
- package/src/context/ast-parser.mjs +298 -0
- package/src/context/bm25.mjs +85 -0
- package/src/context/retriever.mjs +308 -0
- package/src/context/skeleton.mjs +134 -0
- package/src/context/symbol-indexer.mjs +375 -0
- package/src/core/agent-history.mjs +111 -0
- package/src/core/agent-loop.mjs +486 -0
- package/src/core/approval-log.mjs +104 -0
- package/src/core/approval.mjs +476 -0
- package/src/core/attachments.mjs +380 -0
- package/src/core/backend-url.mjs +55 -0
- package/src/core/cache-control.mjs +92 -0
- package/src/core/cache.mjs +105 -0
- package/src/core/callback-client.mjs +180 -0
- package/src/core/checkpoints.mjs +142 -0
- package/src/core/compact-history.mjs +127 -0
- package/src/core/context-envelope.mjs +54 -0
- package/src/core/context-manager.mjs +198 -0
- package/src/core/error-guidance.mjs +311 -0
- package/src/core/file-diff.mjs +217 -0
- package/src/core/headless.mjs +448 -0
- package/src/core/hooks-manager.mjs +87 -0
- package/src/core/jsonl-writer.mjs +449 -0
- package/src/core/local-agent.mjs +537 -0
- package/src/core/local-store.mjs +836 -0
- package/src/core/mode-selector.mjs +51 -0
- package/src/core/output-filter.mjs +177 -0
- package/src/core/paths.mjs +190 -0
- package/src/core/policy-resolver.mjs +156 -0
- package/src/core/pricing.mjs +336 -0
- package/src/core/project-artifacts.mjs +39 -0
- package/src/core/project-context-loader.mjs +139 -0
- package/src/core/providers.mjs +219 -0
- package/src/core/rate-limit-display.mjs +121 -0
- package/src/core/rate-limiter.mjs +119 -0
- package/src/core/resume-mode.mjs +192 -0
- package/src/core/risk-tier.mjs +337 -0
- package/src/core/safety.mjs +203 -0
- package/src/core/scheduler.mjs +173 -0
- package/src/core/session-manager.mjs +360 -0
- package/src/core/session.mjs +143 -0
- package/src/core/settings-sync.mjs +85 -0
- package/src/core/stagnation.mjs +57 -0
- package/src/core/stream-client.mjs +829 -0
- package/src/core/streaming.mjs +182 -0
- package/src/core/system-prompt.mjs +140 -0
- package/src/core/tasks.mjs +196 -0
- package/src/core/tool-executor.mjs +1950 -0
- package/src/core/trust.mjs +158 -0
- package/src/core/work-scope.mjs +248 -0
- package/src/hooks/engine.mjs +162 -0
- package/src/index.mjs +426 -0
- package/src/mcp/client.mjs +253 -0
- package/src/mcp/transport-shttp.mjs +130 -0
- package/src/mcp/transport-sse.mjs +131 -0
- package/src/mcp/transport-ws.mjs +134 -0
- package/src/onboarding/preflight.mjs +360 -0
- package/src/permissions/checker.mjs +57 -0
- package/src/permissions/command-classifier.mjs +652 -0
- package/src/permissions/injection-check.mjs +60 -0
- package/src/permissions/path-check.mjs +102 -0
- package/src/permissions/prompt.mjs +73 -0
- package/src/permissions/sandbox.mjs +112 -0
- package/src/plugins/loader.mjs +138 -0
- package/src/skills/installer.mjs +188 -0
- package/src/skills/loader.mjs +252 -0
- package/src/skills/runner.mjs +55 -0
- package/src/state/orbit.mjs +263 -0
- package/src/state/verbosity.mjs +99 -0
- package/src/telemetry/index.mjs +96 -0
- package/src/terminal/agents.mjs +177 -0
- package/src/terminal/analytics.mjs +292 -0
- package/src/terminal/ansi.mjs +695 -0
- package/src/terminal/init.mjs +145 -0
- package/src/terminal/main.mjs +269 -0
- package/src/terminal/repl-explore.mjs +35 -0
- package/src/terminal/repl-format.mjs +257 -0
- package/src/terminal/repl-render.mjs +561 -0
- package/src/terminal/repl-resume.mjs +625 -0
- package/src/terminal/repl-state.mjs +103 -0
- package/src/terminal/repl-utils.mjs +34 -0
- package/src/terminal/repl.mjs +3832 -0
- package/src/terminal/skills.mjs +54 -0
- package/src/terminal/tool-display.mjs +240 -0
- package/src/tools/agent.mjs +137 -0
- package/src/tools/ask-user.mjs +61 -0
- package/src/tools/bash.mjs +231 -0
- package/src/tools/cron-create.mjs +120 -0
- package/src/tools/cron-delete.mjs +49 -0
- package/src/tools/cron-list.mjs +37 -0
- package/src/tools/edit.mjs +82 -0
- package/src/tools/enter-worktree.mjs +69 -0
- package/src/tools/exit-worktree.mjs +57 -0
- package/src/tools/glob.mjs +117 -0
- package/src/tools/grep.mjs +129 -0
- package/src/tools/lint.mjs +71 -0
- package/src/tools/ls.mjs +58 -0
- package/src/tools/lsp.mjs +115 -0
- package/src/tools/multi-edit.mjs +94 -0
- package/src/tools/notebook-edit.mjs +96 -0
- package/src/tools/project-overview.mjs +641 -0
- package/src/tools/read-mcp-resource.mjs +57 -0
- package/src/tools/read.mjs +138 -0
- package/src/tools/registry.mjs +116 -0
- package/src/tools/remote-trigger.mjs +84 -0
- package/src/tools/send-message.mjs +64 -0
- package/src/tools/skill.mjs +52 -0
- package/src/tools/test-runner.mjs +49 -0
- package/src/tools/todo-write.mjs +68 -0
- package/src/tools/tool-search.mjs +77 -0
- package/src/tools/web-fetch.mjs +65 -0
- package/src/tools/web-search.mjs +89 -0
- package/src/tools/write.mjs +55 -0
- package/src/ui/approval.mjs +263 -0
- package/src/ui/banner.mjs +235 -0
- package/src/ui/commands.mjs +537 -0
- package/src/ui/formatter.mjs +409 -0
- package/src/ui/icons.mjs +164 -0
- package/src/ui/input-dock.mjs +444 -0
- package/src/ui/markdown.mjs +278 -0
- package/src/ui/mission-report.mjs +296 -0
- package/src/ui/palette.mjs +189 -0
- package/src/ui/slash-commands.mjs +245 -0
- package/src/ui/spinner.mjs +116 -0
- package/src/ui/sub-agent.mjs +152 -0
- package/src/ui/term.mjs +159 -0
- package/src/ui/text-layout.mjs +127 -0
- package/src/ui/tool-card.mjs +463 -0
- package/src/ui/tool-details.mjs +312 -0
- package/src/ui/transcript-block.mjs +21 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Banner & Branding — Bahulam Code CLI startup display.
|
|
3
|
+
*
|
|
4
|
+
* Uses the semantic palette (`paint.brand.*`) so the same banner renders
|
|
5
|
+
* correctly across truecolor, 256-color, ansi16, and monochrome terminals.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { execSync } from 'node:child_process';
|
|
9
|
+
import * as path from 'node:path';
|
|
10
|
+
|
|
11
|
+
import { icons } from './icons.mjs';
|
|
12
|
+
import { paint, strip } from './palette.mjs';
|
|
13
|
+
import { term } from './term.mjs';
|
|
14
|
+
|
|
15
|
+
const out = process.stderr;
|
|
16
|
+
const write = (s) => { try { out.write(s); } catch {} };
|
|
17
|
+
|
|
18
|
+
// ── Brand banner ─────────────────────────────────────────────────────────
|
|
19
|
+
|
|
20
|
+
// BAHULAM CODE is the product wordmark; the 0xB0 motif is preserved as a
|
|
21
|
+
// dev-culture callback beneath it.
|
|
22
|
+
|
|
23
|
+
// Renders a gradient purple → magenta → cyan across the given string, one
|
|
24
|
+
// codepoint at a time. Falls back to a plain (no-color) string when the
|
|
25
|
+
// terminal doesn't support color at all.
|
|
26
|
+
function gradientText(text) {
|
|
27
|
+
if (!term().color) return text;
|
|
28
|
+
const chars = [...text];
|
|
29
|
+
const painters = [paint.brand.primary, paint.brand.accent, paint.brand.data];
|
|
30
|
+
return chars.map((ch, i) => painters[Math.floor((i / Math.max(1, chars.length)) * painters.length)](ch)).join('');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Render the framed BAHULAM CODE wordmark. Box is 24 cols wide, 3 rows
|
|
35
|
+
* tall, and fits any terminal ≥40 cols.
|
|
36
|
+
*/
|
|
37
|
+
function wordmarkFrame() {
|
|
38
|
+
const dim = paint.text.dim;
|
|
39
|
+
const top = dim('╔════════════════════════╗');
|
|
40
|
+
const bottom = dim('╚════════════════════════╝');
|
|
41
|
+
const inner = dim('║');
|
|
42
|
+
// ║ BAHULAM CODE ║ — 3-space pad each side around a 18-char wordmark
|
|
43
|
+
const glyph = paint.bold(gradientText('BAHULAM CODE'));
|
|
44
|
+
const bodyPad = ' '.repeat(5);
|
|
45
|
+
const tailPad = ' '.repeat(6);
|
|
46
|
+
return [
|
|
47
|
+
` ${top}`,
|
|
48
|
+
` ${inner}${bodyPad}${glyph}${tailPad}${inner}`,
|
|
49
|
+
` ${bottom}`,
|
|
50
|
+
].join('\n');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Print the branded orbital banner.
|
|
55
|
+
*/
|
|
56
|
+
export function printBanner(version = '') {
|
|
57
|
+
const dim = paint.text.dim;
|
|
58
|
+
const orbit = paint.brand.accent(icons.orbit);
|
|
59
|
+
const dev = paint.brand.data('0xB0');
|
|
60
|
+
const vTag = version ? `${dim(' — ')}${dim('v' + version)}` : '';
|
|
61
|
+
|
|
62
|
+
write('\n');
|
|
63
|
+
write(` ${orbit} ${dim('· orbit')}\n`);
|
|
64
|
+
write('\n');
|
|
65
|
+
write(`${wordmarkFrame()}\n`);
|
|
66
|
+
write('\n');
|
|
67
|
+
write(` ${dim('the coding agent')}\n`);
|
|
68
|
+
write(` ${dev}${vTag}\n`);
|
|
69
|
+
write('\n');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// ── Project info bar ─────────────────────────────────────────────────────
|
|
73
|
+
|
|
74
|
+
const BAR_WIDTH = 60;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Print project info bar with version, project name, and git info.
|
|
78
|
+
*/
|
|
79
|
+
export function printProjectInfo(version) {
|
|
80
|
+
const cwd = process.cwd();
|
|
81
|
+
const projectName = path.basename(cwd);
|
|
82
|
+
const gitInfo = getGitInfo(cwd);
|
|
83
|
+
|
|
84
|
+
const sep = paint.text.dim(' │ ');
|
|
85
|
+
let info = ` ${paint.text.dim('v' + version)}${sep}${paint.bold(projectName)}`;
|
|
86
|
+
if (gitInfo) {
|
|
87
|
+
info += `${sep}${paint.state.warn(gitInfo)}`;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const padCount = Math.max(0, BAR_WIDTH - strip(info).length - 1);
|
|
91
|
+
const border = paint.brand.primary;
|
|
92
|
+
|
|
93
|
+
write(`${border('┌' + '─'.repeat(BAR_WIDTH) + '┐')}\n`);
|
|
94
|
+
write(`${border('│')} ${info}${' '.repeat(padCount)}${border('│')}\n`);
|
|
95
|
+
write(`${border('└' + '─'.repeat(BAR_WIDTH) + '┘')}\n`);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// ── Hints ────────────────────────────────────────────────────────────────
|
|
99
|
+
|
|
100
|
+
export function printHints() {
|
|
101
|
+
const env = process.env.TARANG_ENV || process.env.NODE_ENV || 'production';
|
|
102
|
+
const dim = paint.text.dim;
|
|
103
|
+
const accent = paint.brand.data;
|
|
104
|
+
|
|
105
|
+
write(`${paint.state.success('Type your instructions')}, or ${accent('/help')} for commands\n`);
|
|
106
|
+
write(`${dim('Ctrl+C')}${dim('=exit ')}${dim('/clear')}${dim('=reset ')}${dim('/config')}${dim('=settings ')}${dim('/login')}${dim('=auth')}\n`);
|
|
107
|
+
write(`${dim('env:' + env + ' models:configured via browser (/config)')}\n`);
|
|
108
|
+
write('\n');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// ── Auth + config ────────────────────────────────────────────────────────
|
|
112
|
+
|
|
113
|
+
export function printAuthStatus(creds) {
|
|
114
|
+
const check = paint.state.success(icons.pass);
|
|
115
|
+
const cross = paint.state.danger(icons.fail);
|
|
116
|
+
const dim = paint.text.dim;
|
|
117
|
+
|
|
118
|
+
const tokenOk = !!creds.token;
|
|
119
|
+
const env = process.env.TARANG_ENV || process.env.NODE_ENV || 'production';
|
|
120
|
+
|
|
121
|
+
write(` Auth: ${tokenOk
|
|
122
|
+
? `${check} logged in ${dim('(/whoami for details)')}`
|
|
123
|
+
: `${cross} not logged in ${dim('(/login)')}`}\n`);
|
|
124
|
+
write(` Env: ${dim(env)}\n`);
|
|
125
|
+
write(` Mode: ${dim(creds.mode || 'auto')}\n`);
|
|
126
|
+
write('\n');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function printStyledConfig(creds) {
|
|
130
|
+
const check = paint.state.success(icons.pass);
|
|
131
|
+
const cross = paint.state.danger(icons.fail);
|
|
132
|
+
const dim = paint.text.dim;
|
|
133
|
+
|
|
134
|
+
const mask = (val) => {
|
|
135
|
+
if (!val) return `${cross} not set`;
|
|
136
|
+
if (val.length <= 8) return `${check} ****`;
|
|
137
|
+
return `${check} ${val.slice(0, 6)}...${val.slice(-4)}`;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const env = process.env.TARANG_ENV || process.env.NODE_ENV || 'production';
|
|
141
|
+
|
|
142
|
+
write(`\n${paint.bold('Bahulam Code Configuration')} ${dim('(~/.bahulam/config.json)')}\n`);
|
|
143
|
+
write(`${dim('─'.repeat(50))}\n`);
|
|
144
|
+
write(` Token: ${mask(creds.token)}\n`);
|
|
145
|
+
write(` OpenRouter: ${mask(creds.openRouterKey)}\n`);
|
|
146
|
+
write(` Anthropic: ${mask(creds.anthropicKey)}\n`);
|
|
147
|
+
write(` Environment: ${dim(env)}\n`);
|
|
148
|
+
write(` Backend URL: ${dim(creds.backendUrl)}\n`);
|
|
149
|
+
write(` Mode: ${dim(creds.mode || 'auto')}\n`);
|
|
150
|
+
write('\n');
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function printGoodbye() {
|
|
154
|
+
write(`\n${paint.bold(paint.brand.primary('Goodbye!'))}\n\n`);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// ── Git probe ────────────────────────────────────────────────────────────
|
|
158
|
+
|
|
159
|
+
function getGitInfo(cwd) {
|
|
160
|
+
try {
|
|
161
|
+
const branch = execSync('git branch --show-current', {
|
|
162
|
+
cwd, encoding: 'utf-8', timeout: 2000, stdio: ['pipe', 'pipe', 'pipe'],
|
|
163
|
+
}).trim();
|
|
164
|
+
if (!branch) return null;
|
|
165
|
+
|
|
166
|
+
const status = execSync('git status --porcelain', {
|
|
167
|
+
cwd, encoding: 'utf-8', timeout: 2000, stdio: ['pipe', 'pipe', 'pipe'],
|
|
168
|
+
}).trim();
|
|
169
|
+
const changes = status ? status.split('\n').filter(Boolean).length : 0;
|
|
170
|
+
|
|
171
|
+
return changes > 0 ? `⎇ ${branch} (${changes} changed)` : `⎇ ${branch}`;
|
|
172
|
+
} catch {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// ── OAuth success page (unchanged from prior version) ────────────────────
|
|
178
|
+
|
|
179
|
+
export function getLoginSuccessHTML() {
|
|
180
|
+
return `<!DOCTYPE html>
|
|
181
|
+
<html>
|
|
182
|
+
<head>
|
|
183
|
+
<meta charset="utf-8">
|
|
184
|
+
<title>Bahulam Code - Login Successful</title>
|
|
185
|
+
<style>
|
|
186
|
+
body {
|
|
187
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
188
|
+
background: #0d1117;
|
|
189
|
+
color: #c9d1d9;
|
|
190
|
+
display: flex;
|
|
191
|
+
justify-content: center;
|
|
192
|
+
align-items: center;
|
|
193
|
+
min-height: 100vh;
|
|
194
|
+
margin: 0;
|
|
195
|
+
}
|
|
196
|
+
.container {
|
|
197
|
+
text-align: center;
|
|
198
|
+
padding: 40px;
|
|
199
|
+
}
|
|
200
|
+
.logo {
|
|
201
|
+
font-size: 48px;
|
|
202
|
+
font-weight: bold;
|
|
203
|
+
margin-bottom: 8px;
|
|
204
|
+
}
|
|
205
|
+
.dev { color: #3fb950; }
|
|
206
|
+
.bahulam { color: #58a6ff; }
|
|
207
|
+
.bahulam { color: #7c3aed; letter-spacing: 4px; }
|
|
208
|
+
.check {
|
|
209
|
+
font-size: 64px;
|
|
210
|
+
color: #3fb950;
|
|
211
|
+
margin: 24px 0;
|
|
212
|
+
}
|
|
213
|
+
h1 {
|
|
214
|
+
color: #f0f6fc;
|
|
215
|
+
font-size: 24px;
|
|
216
|
+
margin: 16px 0 8px;
|
|
217
|
+
}
|
|
218
|
+
p {
|
|
219
|
+
color: #8b949e;
|
|
220
|
+
font-size: 16px;
|
|
221
|
+
}
|
|
222
|
+
</style>
|
|
223
|
+
</head>
|
|
224
|
+
<body>
|
|
225
|
+
<div class="container">
|
|
226
|
+
<div class="logo">
|
|
227
|
+
<span class="bahulam">BAHULAM CODE</span>
|
|
228
|
+
</div>
|
|
229
|
+
<div class="check">✓</div>
|
|
230
|
+
<h1>Login Successful!</h1>
|
|
231
|
+
<p>You can close this tab and return to your terminal.</p>
|
|
232
|
+
</div>
|
|
233
|
+
</body>
|
|
234
|
+
</html>`;
|
|
235
|
+
}
|