From 867c0eadad7844d2b9711e8ca2cf7a04e2d60cb7 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 9 Jul 2026 22:15:10 -0500 Subject: [PATCH 1/4] refac --- .../src/lib/components/FileBrowser.svelte | 13 ++-- .../src/lib/components/FileEditor.svelte | 23 ++++++- .../frontend/src/lib/components/GitBar.svelte | 49 +++++++++++--- .../src/lib/components/GitView.svelte | 64 +++++++++++++------ .../src/lib/stores/gitStatus.svelte.ts | 1 + cptr/utils/git.py | 19 ++++-- 6 files changed, 128 insertions(+), 41 deletions(-) diff --git a/cptr/frontend/src/lib/components/FileBrowser.svelte b/cptr/frontend/src/lib/components/FileBrowser.svelte index 50d0c97..04277e7 100644 --- a/cptr/frontend/src/lib/components/FileBrowser.svelte +++ b/cptr/frontend/src/lib/components/FileBrowser.svelte @@ -1231,10 +1231,15 @@ class="flex shrink-0 items-center gap-1 text-[0.625rem] font-mono font-medium" use:tooltip={gitStatusTooltip(fileGitStatus, entry)} > - +{fileGitStatus.additions ?? 0} - -{fileGitStatus.deletions ?? 0} + {#if fileGitStatus.binary} + {entryGitDecoration.char} + {:else} + +{fileGitStatus.additions ?? 0} + -{fileGitStatus.deletions ?? 0} + {/if} {/if} {#if entry.type !== 'directory' && entry.size !== null} diff --git a/cptr/frontend/src/lib/components/FileEditor.svelte b/cptr/frontend/src/lib/components/FileEditor.svelte index eddc75d..87935da 100644 --- a/cptr/frontend/src/lib/components/FileEditor.svelte +++ b/cptr/frontend/src/lib/components/FileEditor.svelte @@ -1026,6 +1026,17 @@ return `${(bytes / 1048576).toFixed(1)} MB`; } + function gitStatusChar(status: string): string { + const chars: Record = { + added: 'A', + untracked: 'U', + modified: 'M', + deleted: 'D', + renamed: 'R' + }; + return chars[status] ?? '?'; + } + onDestroy(() => { destroyEditor(); revokeBinaryUrl(); @@ -1041,8 +1052,12 @@ {fileData.name} {#if currentFileStatus} - +{currentFileStatus.additions ?? 0} - -{currentFileStatus.deletions ?? 0} + {#if currentFileStatus.binary} + {gitStatusChar(currentFileStatus.status)} + {:else} + +{currentFileStatus.additions ?? 0} + -{currentFileStatus.deletions ?? 0} + {/if} {/if} @@ -1325,6 +1340,10 @@ color: #ef4444; } + .file-git-status { + color: var(--color-gray-500); + } + :global(.dark) .file-git-additions { color: #4ade80; } diff --git a/cptr/frontend/src/lib/components/GitBar.svelte b/cptr/frontend/src/lib/components/GitBar.svelte index 94cf2a0..3bb355c 100644 --- a/cptr/frontend/src/lib/components/GitBar.svelte +++ b/cptr/frontend/src/lib/components/GitBar.svelte @@ -44,6 +44,7 @@ unstaged?: boolean; staged_status?: string; unstaged_status?: string; + binary?: boolean; additions?: number; deletions?: number; }; @@ -673,6 +674,25 @@ return `${Math.floor(s / 86400)}d`; } + function statusChar(status: string): { char: string; color: string } { + switch (status) { + case 'added': + return { char: 'A', color: 'text-green-500' }; + case 'untracked': + return { char: 'U', color: 'text-green-500' }; + case 'modified': + return { char: 'M', color: 'text-amber-500' }; + case 'deleted': + return { char: 'D', color: 'text-red-400' }; + case 'renamed': + return { char: 'R', color: 'text-blue-400' }; + case 'conflict': + return { char: '!', color: 'text-orange-500' }; + default: + return { char: '?', color: 'text-gray-400' }; + } + } + const syncAction = $derived.by(() => { if (!gitStatus) return { label: $t('git.fetch'), icon: 'refresh', action: doFetch }; if (gitStatus.behind > 0) @@ -799,9 +819,11 @@ {#if totalChanges > 0}{$t('git.changedCount', { count: totalChanges })}+{totalAdditions} - -{totalDeletions}{#if totalAdditions || totalDeletions}+{totalAdditions} + -{totalDeletions}{/if} >{/if} {#if actionMsg} {#each gitStatus?.files ?? [] as file (file.path)} {@const fp = fPath(file.path)} + {@const sc = statusChar(file.status)} - {#if gitStatus.ahead > 0} 0} + ↑{gitStatus.ahead}{/if} - {#if gitStatus.behind > 0}↓{gitStatus.behind}{/if} - {#if totalChanges > 0} + ↑{gitStatus.ahead} + + {/if} + {#if gitStatus.behind > 0} + + ↓{gitStatus.behind} + + {/if} + {#if totalChanges > 0} + {$t('git.changedCount', { count: totalChanges })}{#if totalAdditions || totalDeletions}+{totalAdditions} - -{totalDeletions}{/if} - >{/if} - {#if actionMsg} + {$t('git.changedCount', { count: totalChanges })} + + {#if totalAdditions || totalDeletions} + + +{totalAdditions} + -{totalDeletions} + + {/if} + {/if} + {#if actionMsg} + {actionMsg}{/if} + > + {actionMsg} + + {/if}
From 1e3c3a9177d3fd84d5d9b59b883e46e2ff3e9dde Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 9 Jul 2026 22:45:24 -0500 Subject: [PATCH 4/4] refac --- CHANGELOG.md | 7 +++++++ pyproject.toml | 2 +- uv.lock | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc9fd9b..f96db97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.8.7] - 2026-07-09 + +### Fixed + +- 🗂️ **Clearer Git status.** File changes now show a clear status instead of misleading line totals for images and other non-text files. +- 🤖 **More reliable Claude Code chats.** Image attachments and separate thinking sections now appear and finish more reliably. + ## [0.8.6] - 2026-07-09 ### Added diff --git a/pyproject.toml b/pyproject.toml index e882fcc..2e18835 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "cptr" -version = "0.8.6" +version = "0.8.7" description = "Your computer, from anywhere. Code, manage, and control your machine from the web." license = {file = "LICENSE"} readme = "README.md" diff --git a/uv.lock b/uv.lock index 6c2ced7..8b650d6 100644 --- a/uv.lock +++ b/uv.lock @@ -284,7 +284,7 @@ wheels = [ [[package]] name = "cptr" -version = "0.8.6" +version = "0.8.7" source = { editable = "." } dependencies = [ { name = "aiosqlite" },