From adb02fe90f43921611a278cae3c30ddf06ac4c96 Mon Sep 17 00:00:00 2001
From: kccarlos <110118511+kccarlos@users.noreply.github.com>
Date: Sun, 7 Sep 2025 01:11:05 -0700
Subject: [PATCH 1/4] feat: token counting progress
---
src/web/src/hooks/useTokenCounts.ts | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/web/src/hooks/useTokenCounts.ts b/src/web/src/hooks/useTokenCounts.ts
index 16e5ca1..edc1a77 100644
--- a/src/web/src/hooks/useTokenCounts.ts
+++ b/src/web/src/hooks/useTokenCounts.ts
@@ -139,5 +139,3 @@ export function useTokenCounts({
return { counts, total, busy }
}
-
-
From a791baf3ba00393470c092580e3a5758cf64328d Mon Sep 17 00:00:00 2001
From: kccarlos <110118511+kccarlos@users.noreply.github.com>
Date: Sun, 7 Sep 2025 01:28:29 -0700
Subject: [PATCH 2/4] fix: single token counting pass app wide
---
src/web/src/App.tsx | 85 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 85 insertions(+)
diff --git a/src/web/src/App.tsx b/src/web/src/App.tsx
index 3079538..e2f10b7 100644
--- a/src/web/src/App.tsx
+++ b/src/web/src/App.tsx
@@ -849,6 +849,91 @@ function App() {
return null
}
+ // Small helper: use context to feed TokenUsage without prop-drilling
+ function TokenUsageWithContext({
+ filesCount,
+ instructionsTokens,
+ fileTreeTokens,
+ limit,
+ }: {
+ filesCount: number
+ instructionsTokens: number
+ fileTreeTokens: number
+ limit: number
+ }) {
+ const { total } = useTokenCountsContext()
+ const src = useCallback(() => total, [total])
+ return (
+
+ )
+ }
+
+ // Bridge: keeps your StatusBar messages/progress exactly as before, now fed by the context.
+ function TokenCountingStatusBridge({
+ includeTree,
+ treeBusy,
+ }: {
+ includeTree: boolean
+ treeBusy: boolean
+ }) {
+ const { busy, progress } = useTokenCountsContext()
+ useEffect(() => {
+ const anotherTaskLoading =
+ appStatus.state === 'LOADING' && 'task' in appStatus && appStatus.task !== 'tokens'
+
+ const tokenWorkActive = busy || treeBusy
+ const selectedWeight = includeTree ? 85 : 100
+ const treeWeight = includeTree ? 15 : 0
+ const selectedPortion = Math.round((Math.max(0, Math.min(100, progress.percent)) * selectedWeight) / 100)
+ const treePortion = treeBusy ? 0 : treeWeight
+ const overallPercent = Math.max(0, Math.min(100, selectedPortion + treePortion))
+
+ if (tokenWorkActive) {
+ if (!anotherTaskLoading && currentDir !== null) {
+ const files = selectedPaths.size
+ const msg =
+ files > 0
+ ? `Counting tokens for ${files.toLocaleString()} selected file${files === 1 ? '' : 's'}…`
+ : 'Counting tokens…'
+ setAppStatus({
+ state: 'LOADING',
+ task: 'tokens',
+ message: `${msg} ${overallPercent}%`,
+ progress: overallPercent,
+ })
+ try {
+ console.info('[app-status]', {
+ state: 'LOADING',
+ task: 'tokens',
+ message: `${msg} ${overallPercent}%`,
+ progress: overallPercent,
+ })
+ } catch {}
+ }
+ } else {
+ if (
+ appStatus.state === 'LOADING' &&
+ 'task' in appStatus &&
+ appStatus.task === 'tokens' &&
+ currentDir !== null
+ ) {
+ setAppStatus({ state: 'READY', message: 'Token counts updated.' })
+ try {
+ console.info('[app-status]', { state: 'READY', message: 'Token counts updated.' })
+ } catch {}
+ }
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [busy, treeBusy, progress.percent, includeTree, currentDir, selectedPaths.size])
+ return null
+ }
+
return (
Date: Sun, 7 Sep 2025 01:57:44 -0700
Subject: [PATCH 3/4] fix: binary file handling
---
src/electron/workers/nodeGitWorker.ts | 2 -
src/web/src/App.tsx | 85 ---------------------------
2 files changed, 87 deletions(-)
diff --git a/src/electron/workers/nodeGitWorker.ts b/src/electron/workers/nodeGitWorker.ts
index 00706f0..612115e 100644
--- a/src/electron/workers/nodeGitWorker.ts
+++ b/src/electron/workers/nodeGitWorker.ts
@@ -265,5 +265,3 @@ parentPort?.on('message', async (m: Msg) => {
err((m as any).id ?? -1, e?.message ?? String(e))
}
})
-
-
diff --git a/src/web/src/App.tsx b/src/web/src/App.tsx
index e2f10b7..3079538 100644
--- a/src/web/src/App.tsx
+++ b/src/web/src/App.tsx
@@ -849,91 +849,6 @@ function App() {
return null
}
- // Small helper: use context to feed TokenUsage without prop-drilling
- function TokenUsageWithContext({
- filesCount,
- instructionsTokens,
- fileTreeTokens,
- limit,
- }: {
- filesCount: number
- instructionsTokens: number
- fileTreeTokens: number
- limit: number
- }) {
- const { total } = useTokenCountsContext()
- const src = useCallback(() => total, [total])
- return (
-
- )
- }
-
- // Bridge: keeps your StatusBar messages/progress exactly as before, now fed by the context.
- function TokenCountingStatusBridge({
- includeTree,
- treeBusy,
- }: {
- includeTree: boolean
- treeBusy: boolean
- }) {
- const { busy, progress } = useTokenCountsContext()
- useEffect(() => {
- const anotherTaskLoading =
- appStatus.state === 'LOADING' && 'task' in appStatus && appStatus.task !== 'tokens'
-
- const tokenWorkActive = busy || treeBusy
- const selectedWeight = includeTree ? 85 : 100
- const treeWeight = includeTree ? 15 : 0
- const selectedPortion = Math.round((Math.max(0, Math.min(100, progress.percent)) * selectedWeight) / 100)
- const treePortion = treeBusy ? 0 : treeWeight
- const overallPercent = Math.max(0, Math.min(100, selectedPortion + treePortion))
-
- if (tokenWorkActive) {
- if (!anotherTaskLoading && currentDir !== null) {
- const files = selectedPaths.size
- const msg =
- files > 0
- ? `Counting tokens for ${files.toLocaleString()} selected file${files === 1 ? '' : 's'}…`
- : 'Counting tokens…'
- setAppStatus({
- state: 'LOADING',
- task: 'tokens',
- message: `${msg} ${overallPercent}%`,
- progress: overallPercent,
- })
- try {
- console.info('[app-status]', {
- state: 'LOADING',
- task: 'tokens',
- message: `${msg} ${overallPercent}%`,
- progress: overallPercent,
- })
- } catch {}
- }
- } else {
- if (
- appStatus.state === 'LOADING' &&
- 'task' in appStatus &&
- appStatus.task === 'tokens' &&
- currentDir !== null
- ) {
- setAppStatus({ state: 'READY', message: 'Token counts updated.' })
- try {
- console.info('[app-status]', { state: 'READY', message: 'Token counts updated.' })
- } catch {}
- }
- }
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [busy, treeBusy, progress.percent, includeTree, currentDir, selectedPaths.size])
- return null
- }
-
return (
Date: Wed, 7 Jan 2026 13:57:09 -0800
Subject: [PATCH 4/4] ci: change domain
---
src/web/package.json | 2 +-
src/web/public/CNAME | 2 --
src/web/vite.config.ts | 2 +-
3 files changed, 2 insertions(+), 4 deletions(-)
delete mode 100644 src/web/public/CNAME
diff --git a/src/web/package.json b/src/web/package.json
index 5a3d80b..8f8fcea 100644
--- a/src/web/package.json
+++ b/src/web/package.json
@@ -6,7 +6,7 @@
"type": "git",
"url": "https://github.com/kccarlos/gitcontext.git"
},
- "homepage": "https://gitcontext.xyz/",
+ "homepage": "https://kccarlos.github.io/gitcontext/",
"bugs": {
"url": "https://github.com/kccarlos/gitcontext/issues"
},
diff --git a/src/web/public/CNAME b/src/web/public/CNAME
deleted file mode 100644
index a5ea565..0000000
--- a/src/web/public/CNAME
+++ /dev/null
@@ -1,2 +0,0 @@
-gitcontext.xyz
-
diff --git a/src/web/vite.config.ts b/src/web/vite.config.ts
index fa3c2f9..55b3198 100644
--- a/src/web/vite.config.ts
+++ b/src/web/vite.config.ts
@@ -9,7 +9,7 @@ const isElectron = process.env.ELECTRON === '1'
// https://vite.dev/config/
export default defineConfig({
- base: isElectron ? './' : '/',
+ base: isElectron ? './' : '/gitcontext/',
plugins: [
react(),
wasm(),