Commit Graph
221 Commits
Author SHA1 Message Date
Chris Scott 570a67e7b0 feat: add MiniScanner component and git service tests
- Extract session busy indicator to reusable MiniScanner component
- Refactor SessionCard to use MiniScanner for cleaner code
- Add comprehensive tests for GitBranchService, GitDiffService
- Add repo-git route tests
2026-01-19 22:09:40 -05:00
Chris Scott 7f30a28be9 fix(frontend): eslint config for tests and minor hook fixes
- Add eslint rules for test files with proper tsconfig and globals
- Add no-empty rule exception for PromptInput
- Remove unused renderTrigger dependency from useMemo in virtualized-text-view
- Fix session status to properly set idle state when assistant message completes
2026-01-19 22:07:12 -05:00
theepicsaxguyandChris Scott e91c54ba20 Git Source Control Integration (#74)
* feat(source-control): add commits and file management components

- Introduced `CommitsTab` for displaying commit history with relative time formatting.
- Added `GitFlatFileItem` and `GitFlatFileList` for managing file statuses in the source control panel.
- Implemented `SourceControlPanel` to encapsulate source control functionalities including changes, commits, and branches.
- Enhanced `useGit` hook to manage git operations such as fetch, pull, push, commit, stage, and unstage files with appropriate error handling and toast notifications.
- Updated `RepoDetail` to integrate the new source control panel and provide a user interface for source control actions.
- Defined `GitCommit` type for better type safety in commit-related operations.

* refactor: streamline error handling in Git operations and update error imports

* feat: enhance Git services and ESLint configuration for improved functionality

* refactor: update method signatures for consistency and clarity in Git services

* feat: refactor git services and improve error handling

- Remove unused imports and clean up code in repos.ts and git-operations.ts.
- Simplify error handling in repo.ts by enforcing message property in ErrorWithMessage interface.
- Update GitPushService to remove unnecessary database parameter in methods.
- Enhance executeCommand function to better handle command execution results.
- Update tests to use mocked functions for better isolation and clarity.
- Add specific ESLint rules for test files to accommodate common testing patterns.
- Introduce tsconfig.test.json for better TypeScript configuration in tests.
- Update vitest.config.ts to use the new test TypeScript configuration.

* refactor: remove esbuild configuration from Vitest setup

* feat: enhance Source Control Panel with branch management and integrate into RepoDetail and SessionDetail pages

* feat: implement Git authentication service and refactor related services

- Add GitAuthService to handle Git environment setup with credentials.
- Refactor GitBranchService, GitCommitService, GitFetchPullService, GitPushService, GitStatusService, and GitLogService to utilize the new GitAuthService.
- Remove GitCommandUtils and related error handling for Git operations.
- Delete git-operations.ts and associated tests as functionality is now integrated into other services.
- Update TypeScript configuration to enable composite projects for better build management.

* feat: refactor Git services to improve structure and update imports

* refactor: simplify error utility functions and update test cases for Git services

* feat: refactor GitAuthService and update related tests for improved credential handling

* feat: implement GitDiffService and related endpoints for file diff functionality

* feat: add emitDeclarationOnly option to TypeScript configuration files

* feat: enhance GitLogService to fetch remote branches and improve error handling in repo commands

* feat: update Git command execution to remove fallback and enhance environment variable handling

* feat: add repository authentication tracking

- Add `requires_auth` column to repos table
- Implement auth check in GitAuthService
- Update cloneRepo to detect public/private repos
- Add test coverage for auth-related functionality
- Improve UI styling for auth-related indicators

* feat(git): implement interactive Git authentication with askpass

- Add GitAskpassService to handle credential requests from Git
- Implement askpass script that communicates with backend
- Update GitAuthService to use askpass instead of direct credential
  injection
- Add new endpoint for branch listing and status
- Improve branch name handling in GitBranchService
- Enhance error handling in GitDiffService for untracked files
- Add upstream branch checking and setup in GitFetchPullService
- Update UI components for better visual consistency
- Fix various minor UI styling issues

* feat(git): enhance Git authentication with improved askpass support

- Update askpass endpoint to handle hostname parameter and return full
  credential object
- Replace `createNoPromptGitEnv` with `createSilentGitEnv` for better
  VSCode compatibility
- Add compiled Node.js askpass script for broader compatibility
- Enhance GitBranchService to return detailed branch information with
  upstream tracking
- Improve branch listing UI with better sorting and display
- Update GitAuthService to use askpass for all operations with proper
  credential handling
- Fix various UI styling issues in diff view and source control panel
- Update test mocks to use new silent environment function
- Add proper error handling and credential caching in GitAskpassService

* feat(git-auth): implement IPC-based Git authentication system

- Add new IPC server infrastructure for handling Git credential requests
- Implement AskpassHandler to manage Git authentication through IPC
- Replace previous HTTP-based askpass system with local IPC
  communication
- Remove deprecated GitAskpassService and related HTTP endpoints
- Update GitAuthService to use IPC-based authentication flow
- Add new shell scripts for Git askpass integration (askpass.sh,
  askpass-main.js)
- Remove database column 'requires_auth' as it's no longer needed
- Update all Git service classes to use new authentication approach
- Improve error handling and credential caching
- Add proper cleanup for IPC server on shutdown

* fix(frontend): correct GitBranch type usage in BranchesTab and BranchSwitcher

* fix(ipc): handle empty responses and add logging for askpass handler

- Handle empty response bodies in askpass-main.ts to prevent JSON parse errors
- Add logging to IPC server for debugging request/response issues
- Add logging to AskpassHandler for credential lookup visibility

* fix(ipc): return empty credentials for silent fetches instead of failing

Silent fetch operations (used when fetching commit history on repo open)
should return empty credentials gracefully rather than failing, allowing
git to proceed without credentials for public repos or cached credentials.

* chore(ipc): add detailed logging for debugging askpass requests

- Log handler registration and lookup paths
- Log incoming request details
- Log handler response results

* chore(askpass): add comprehensive debugging to trace IPC communication

- Add detailed stderr logging to askpass-main.ts for all steps
- Log environment variables and paths at initialization
- Log IPC connection attempts and responses
- Log JSON parsing results

This will help trace where the IPC communication fails.

* chore(debug): add comprehensive logging to trace git environment and IPC requests

- Log GIT_ASKPASS, VSCODE_GIT_IPC_HANDLE, GIT_TERMINAL_PROMPT env vars when executing git
- Log all incoming IPC requests with URL and body
- Log handler registration status

* Integrate GitAuthService throughout repo operations

- Add GitAuthService parameter to all repo service functions
- Replace direct git env creation with GitAuthService.getGitEnvironment()
- Update route handlers to pass GitAuthService to service calls
- Remove createSilentGitEnv utility in favor of centralized auth
- Ensure consistent git authentication across all operations

* refactor: consolidate git services and remove duplicate fetch service

- Remove GitFetchService and consolidate into GitFetchPullService
- Clean up duplicate git authentication logic across services
- Simplify repo service by removing redundant environment handling
- Update tests to reflect consolidated service structure
- Remove unused imports and streamline API endpoints
- Reduce codebase complexity by eliminating service duplication

* refactor: clean up unnecessary config changes and improve git API types

* feat(git): add GitCommit interface and fix push mutation

* feat(git): fix source control panel issues

- Fix unstaged file diff showing all changes instead of working directory only
- Remove auto-refresh (10s) to reduce git command spam
- Add reset/revert mutation for unpushed local commits
- Fix branch creation/switching to update database
- Add unpushed commit detection and visual indicator in commits tab
- Handle no-upstream branch status gracefully

* fix(git): improve branch listing and remove regex parsing issue

- Fix branch name parsing to use full name instead of regex capturing only first word
- Add refresh button for branches
- Show remote branches with Globe icon and make them non-clickable
- Add 'local' label for branches without upstream tracking
- Handle remotes/ prefix properly in branch detection

* fix(git): remove duplicate refresh button

* fix(git): properly extract branch name from git output

- Extract branch name before whitespace/bracket in git branch -vv -a output
- When clicking remote branch, checkout local tracking branch instead of remote reference

* fix(git): remove duplicate refresh button from branches tab

* fix: improve source control panel mobile layout

- Set full height on mobile for better screen utilization
- Add larger centered close button on mobile
- Hide default close button when custom one is shown on mobile

* Remove git credential test feature

The test credential button in settings was broken because it tried to test
authentication against just the host URL (e.g., https://github.com/) instead
of a repository path. Since git credentials are already handled correctly
through the askpass mechanism when cloning repositories, the test button
was redundant and has been removed.

Changes:
- Remove /test-credential endpoint from settings routes
- Remove testGitCredential API from frontend
- Remove TestCredentialRequest/Response types
- Remove test button and related state from GitSettings component

* fix: resolve Copilot review issues

- Remove duplicate GitCommit interface definition
- Fix CSS typos: bg-linear-to-br -> bg-gradient-to-br
- Fix typo: /sessflex-shrink-0 -> flex-shrink-0
- Add *.test.js to .gitignore and remove compiled test files
- Fix missing closing brace in useGit.test.tsx
- Remove unused maskToken function

* fix(git): correct ahead/behind count order and add renamed file path parsing

- Fix git rev-list output parsing: ahead comes first, behind second
- Add oldPath extraction for renamed (R) and copied (C) files in status
- Refactor git service tests to use consistent mocking patterns
- Add missing Database and SettingsService mocks to prevent test failures

---------

Co-authored-by: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
2026-01-19 22:03:42 -05:00
Chris Scott d035e196bd Fix/permission dialog id bug (#71)
* Fix permission dialog using wrong ID and add typed permission labels

- Fix critical bug: pass permission.id instead of permission.permission when responding
- Replace hardcoded switch statement with PERMISSION_LABELS derived from OpenCode types
- Add all permission types from PermissionConfig schema
* Add per-repo reset permissions feature
- Add POST /api/repos/:id/reset-permissions endpoint that disposes OpenCode instance
- Add resetRepoPermissions API function in frontend
- Add Reset Permissions button in RepoDetail header and mobile dropdown
- Add confirmation dialog explaining the action clears Allow Always permissions

* Improve OpenCode config error handling and UI responsiveness
2026-01-17 13:26:42 -05:00
Chris Scott 2bd2b024b8 refactor: replace OpenCode server restarts with config reloads for faster updates (#70) 2026-01-17 12:40:22 -05:00
Chris Scott 8be0bbd8a0 Merge branch 'main' of https://github.com/chriswritescode-dev/opencode-manager 2026-01-15 20:54:42 -05:00
Naman Rajpal 1e4b756973 fix: allow text paste on iOS by checking clipboard text before files (#64) 2026-01-15 20:53:48 -05:00
Chris Scott cf13bed2db Merge remote-tracking branch 'origin/main' 2026-01-15 20:50:45 -05:00
Chris Scott d428f19922 Add settings to mobile menu and fix header styling 2026-01-15 20:49:57 -05:00
Ishaan Sharma 9efcbc5688 Fix invisible code blocks in dark mode (#65) 2026-01-15 20:49:52 -05:00
Chris Scott 2ba959ac0b Add app loader and skeleton states 2026-01-15 19:03:25 -05:00
Chris Scott 7ba2cf2328 Add session ID filter to SSE error handling 2026-01-15 18:29:55 -05:00
Chris Scott fc5e532abb Update session UI with improved header and scroll masks 2026-01-15 18:02:53 -05:00
Chris Scott 99cc7c5c43 Optimize repo list spacing and layout adjustments 2026-01-15 18:02:52 -05:00
Chris Scott 47a5c50f65 Update RepoDetail component 2026-01-15 17:19:28 -05:00
Ishaan Sharma e3f95ad3b6 chore: make File Changes section collapsible (#60) 2026-01-15 16:26:45 -05:00
Chris Scott 078fbd1a05 Add config sync mode to prevent config file overwrites on startup (#63)
Fixes #62

- Config file in workspace volume is now the source of truth
* Preserve raw config content with comments instead of re-stringifying parsed JSON
* Sync provider credentials to OpenCode server when adding or removing API keys
* Add error handling for session errors with toast notifications and inline message display
* Refactor provider settings to manage API keys directly with edit/delete support
2026-01-15 10:39:38 -05:00
Naman RajpalandChris Scott f3505de0e1 Add Markdown Preview to FilePreview Component (#51)
* Adding markdown preview in FilePreview

* Refactor markdown rendering into reusable components

* Fix: Make syntax highlighting theme-aware

* Refactor: Follow project conventions for naming and CSS organization

* Refactor: Use virtualization infrastructure for markdown preview

- Add loadAll(), fullContent, isFullyLoaded to useVirtualizedContent hook
- Expose new methods via VirtualizedTextView ref handle
- Remove duplicate fetch in FilePreview, use ref methods instead
- Add 1MB size limit for markdown preview with user-friendly message

---------

Co-authored-by: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
2026-01-13 18:51:41 -05:00
Chris Scott f0d97f8d6e Fix issue #42: Support absolute paths when adding local repos (#52)
Add ability to import existing git repositories from absolute paths by copying them to the workspace.

Backend changes:
- Add helper functions: isValidGitRepo(), checkRepoNameAvailable(), copyRepoToWorkspace()
- Add checkoutBranchSafely() helper for consistent branch handling across codebase
- Modify initLocalRepo() to detect absolute vs relative paths
- For absolute paths: validate, check if git repo, copy to workspace using git clone --local
- For relative paths: maintain existing behavior (create new empty git repo)
- Refactor switchBranch() to use shared checkoutBranchSafely() helper
- Fail with clear error message if repo name already exists in workspace

Frontend changes:
- Update UI placeholder and help text to explain absolute path support
- Branch help text adapts based on input type (absolute vs relative)
2026-01-13 10:15:07 -05:00
Chris Scott 3ab55fc682 Refactor SessionCard layout to vertically stack checkbox with busy indicator 2026-01-13 09:37:05 -05:00
Chris Scott cd8d87710e Fix message ID comparison for alphanumeric IDs 2026-01-13 00:16:09 -05:00
Chris Scott f7fd3176d4 Refactor SSE event handling and consolidate notification contexts 2026-01-12 23:56:50 -05:00
Chris Scott dc9a57b361 fix TypeScript errors for updated OpenAPI types 2026-01-10 20:10:48 -05:00
Chris Scott 8695f7c745 add drag and drop repo reordering functionality 2026-01-10 19:40:42 -05:00
Chris Scott 17ee96d316 regenerate OpenAPI spec and add model selection components 2026-01-10 18:39:12 -05:00
Chris Scott 9ed292af2a add OpenCode upgrade endpoint and UI button (#49) 2026-01-10 10:27:24 -05:00
Chris Scott 3af1cfbaac fix repo mcp dialog desktop fullscreen layout 2026-01-04 18:12:59 -05:00
Chris Scott a6fd795eaa Implement session-level todo state management with inline display 2026-01-04 18:08:09 -05:00
Chris Scott 84c947d19a Add fallback copy method for non-HTTPS clipboard access 2026-01-04 17:42:16 -05:00
Chris Scott b9b139ce48 fix untracked file diff regex pattern and add tests 2026-01-04 17:23:26 -05:00
Chris Scott ed4bc17987 add typecheck script and fix TypeScript errors (#48) 2026-01-04 17:11:53 -05:00
Justin CarlsonandChris Scott cd9a552bf8 fix: centralize iOS safe area and refactor list components (#47)
* fix: add iOS safe-area-inset-top support for fullscreen overlays

- Add pt-safe CSS utility class for safe-area-inset-top
- Create FullscreenSheet component with built-in safe-area support
- Add fullscreen prop to DialogContent for fullscreen dialogs
- Update FileBrowserSheet to use FullscreenSheet
- Update MobileFilePreviewModal to use FullscreenSheet
- Add pt-safe to SettingsDialog mobile view

Fixes status bar overlap on iOS devices with notch/Dynamic Island

* fix: add pt-safe to main page headers

- Header.tsx (main repos page)
- SessionDetailHeader.tsx (session page)

* docs: add TDD refactoring plan for iOS safe area

* remove plan file from repo

* refactor: centralize iOS safe area handling with PageHeader component

- Add PageHeader component with pt-safe, sticky, z-10, border-b styling
- Add TDD test infrastructure (vitest config, testing-library, jsdom)
- Refactor Header, SessionDetailHeader, RepoDetailHeader, Workspace to use PageHeader
- Fix missing pt-safe on RepoDetailHeader and Workspace pages
- All header safe area styling now has single fix point

* fix: add pt-safe to remaining fullscreen dialogs and sheets

- GitChangesSheet, FilePreviewDialog: add fullscreen prop
- ModelSelectDialog, RepoMcpDialog: add pt-safe class
- EditSessionTitleDialog: add pt-safe on mobile

* fix: use mobile-first positioning for large dialogs

Dialogs need top-0 positioning on mobile for pt-safe to work.
Centered dialogs don't benefit from safe area padding.

* fix: add mobileFullscreen prop to DialogContent

- Fullscreen on mobile with pt-safe, centered on desktop
- Simplifies large dialog styling

* fix: use inline styles for iOS safe area to fix CSS cascade issues

- Convert pt-safe/pb-safe to @utility directives with iOS 11 fallback
- Use inline styles on DialogContent for reliable safe-area padding
- Position close button with calc(env(safe-area-inset-top) + 1rem)
- Add 10 tests for DialogContent safe-area behavior

* refactor: extract ListToolbar and Header components for reuse

- Add ListToolbar component for search/select all/delete UI
- Add Header compound component (Header.Root, Header.Title, etc.)
- Update SessionList and RepoList to use ListToolbar
- Mobile delete: deletes selected or all if none selected
- Cancel delete now clears selection
- Remove unused layout components

---------

Co-authored-by: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
2026-01-04 14:05:59 -05:00
Chris Scott 8166044d6e Fix eslint (#46)
* Fix mobile image upload and paste with improved file type handling

* Replace older sessions header with separator line

* Add ESLint no-console rules and fix lint errors

- Add eslint configuration for backend with no-console rule
- Add reusable error type guard utility
- Replace all error: any with error: unknown and type guards across backend
- Update logger to use console.warn/console.error only
- Remove unused variables and dead code functions
- Fix regex escape characters
- Update AGENTS.md with lint commands and requirements
2026-01-03 15:19:28 -05:00
Chris Scott c9bf962ac0 Fix mobile paste (#45)
* Fix mobile image upload and paste with improved file type handling

* Replace older sessions header with separator line
2026-01-03 11:44:39 -05:00
Chris Scott 4b175604e9 Refactor session list with card component and date grouping 2026-01-03 00:51:05 -05:00
Chris Scott 6af39af424 Add AI-generated session titles with loading indicator and debouncing 2026-01-03 00:36:09 -05:00
Chris Scott ec10be823e Remove iconOnly prop from branch selector in RepoDetailHeader 2026-01-02 23:29:23 -05:00
Chris Scott 9c8bb3b8f6 Add edit session title dialog with clear button for mobile, inline editing for desktop 2026-01-02 23:25:12 -05:00
Chris Scott 005861ddf9 Add SquareFill icon component and update TTS/stop button styling with responsive cost display 2026-01-02 23:00:13 -05:00
Chris Scott 507860329d Show active branch name in SessionDetailHeader on desktop 2026-01-02 21:58:54 -05:00
Chris Scott f1a7d36433 Add configurable global git identity settings with new Git tab (#43) 2025-12-31 13:52:55 -05:00
Chris Scott a736e98880 Add multiple git credentials support with migration 2025-12-31 10:47:55 -05:00
Chris Scott 15643ae06b Add provider connection status tracking and API key setup flow 2025-12-30 08:54:26 -05:00
Chris ScottandOpenCode Agent b88d8a4bf3 Fix permission approval for subagent sessions by tracking source directory (#38)
When permission events arrive via SSE, record which repo/directory they
came from. Use this mapping in getClient() to ensure the correct directory
parameter is sent when approving permissions for subagent sessions.

Fixes #33

Co-authored-by: OpenCode Agent <agent@opencode.ai>
2025-12-29 08:35:45 -05:00
Chris Scott d7873241e0 Add image and PDF attachment support with drag-drop and paste 2025-12-28 22:52:16 -05:00
Chris Scott cc04cb073c Add MCP server search functionality to repo dialog 2025-12-28 21:32:15 -05:00
Chris Scott cad84d2f63 Improve OpenCode config error handling and toast notifications 2025-12-28 21:10:00 -05:00
Chris Scott 876b444599 Add config rollback and startup error recovery 2025-12-28 20:52:36 -05:00
Chris Scott 120d087910 Add support for GitHub shorthand repo URLs 2025-12-27 19:27:37 -05:00
Chris Scott ee99bb65fc Reorder branch switcher dropdown: view changes and add branch at top, scrollable branch list below 2025-12-27 18:19:57 -05:00