Commit Graph
57 Commits
Author SHA1 Message Date
Chris Scott 1e00e68e76 refactor: clean up preview-server implementation and tests 2026-06-21 21:13:14 -04:00
Chris Scott a214212b7b refactor: replace dev-proxy with preview-server, simplify proxy utils 2026-06-21 20:25:15 -04:00
Chris Scott 9afd5f04d5 feat: add dev-server preview system with proxy, file serving, and HTML artifact preview
Adds a full dev-server preview system including:
- Backend proxy/upgrade handler for dev server traffic
- File-serving backend route with CSP headers
- DevServerPreviewButton and HtmlArtifactPanel components
- HTML artifact detection and preview in messages
- File preview improvements with mobile support
- Shared types and settings schema for dev server config
- Comprehensive test coverage for all new code
2026-06-21 14:37:53 -04:00
Chris Scott 55af93062a refactor: extract CredentialProvider service and consolidate git-auth utilities (#283)
* refactor: extract CredentialProvider service and consolidate git-auth utilities

* refactor: add git-credentials route and gh env plugin, pass internal token to OpenCode

* refactor: update credential provider integration and git route

* refactor: integrate credential provider across git auth, routes, and IPC
2026-06-20 21:52:18 -04:00
Chris Scott 6e80cdfb8c feat: add skill installer (#279)
* feat: add skill installer with install/uninstall and settings UI

* feat: refactor skill installer with extracted SkillLibraryList component

* feat: simplify SkillsEditor, extract SkillLibraryList

* feat: refactor skill installer components and add github utility
2026-06-17 23:11:29 -04:00
Chris Scott 24d34f28a3 Revert "feat: add skill installer with install/uninstall and settings UI (#277)" (#278)
This reverts commit 9cb2bb156b.
2026-06-17 23:09:34 -04:00
Chris Scott 9cb2bb156b feat: add skill installer with install/uninstall and settings UI (#277)
* feat: add skill installer with install/uninstall and settings UI

* feat: refactor skill installer with extracted SkillLibraryList component

* feat: simplify SkillsEditor, extract SkillLibraryList
2026-06-17 22:52:05 -04:00
Chris Scott 8133b655b0 refactor: persist assistant repo in database with ID migration (#271) 2026-06-09 14:46:39 -04:00
Chris Scott 0d384d6cf0 refactor: move assistant workspace install before OpenCode server start (#263)
* refactor: move assistant workspace install before OpenCode server start

* refactor: skip assistant-mode status fetch on open, use repo fullPath and cached session
2026-06-07 13:35:19 -04:00
Chris Scott ec7a47dc10 feat: replay session statuses on upstream reconnect and add compact type (#268) 2026-06-06 23:02:48 -04:00
Chris Scott 12b7387e11 refactor(sse): harden SSE with queue-based writer, backpressure, and directory-aware batching
- Replace promise-chaining SSE writer with queue-based pump with MAX_QUEUED_FRAMES backpressure
- Make frontend parts batcher directory-aware with (sessionID, directory) composite key
- Add session content versioning for reliable content change detection
- Add TOOLS_CACHEBUST arg for selective Docker cache invalidation
- Add docker-upgrade.sh modes (cached/tools/full)
- Fix plugin install timeout and spawn error handling
- Fix assistant session endpoint path and ordering params
2026-06-06 11:11:10 -04:00
Chris Scott cc89a524c4 fix(schedules): clean up orphaned schedule records when repo is deleted (#255)
* fix(schedules): clean up orphaned schedule records and add schedule URL state management

* refactor(schedules): consolidate schedule tab state into useScheduleUrlState

* fix(schedules): cascade delete schedule runs/jobs and preserve assistant schedules in orphan cleanup

* refactor(schedules): replace deleteJobsByRepo with prepareRepoDelete, add lightweight ID query, remove dead mock

* refactor(schedules): consolidate PromptTemplateDialog form state into single object
2026-06-05 18:07:25 -04:00
Chris Scott 70cb62b77b feat(schedules): support scheduling jobs for the Assistant workspace (#254)
* feat(schedules): support scheduling jobs for the Assistant workspace

* refactor(schedules): extract assistant repo constants, rename workspace to schedule-target

* feat(navigation): add schedules link to session drawer menu

* fix(schedules): document Assistant repoId=0 in generated schedule-management skill
2026-06-05 11:16:31 -04:00
Chris Scott 36b8f1453f feat(assistant): warm assistant workspace on startup and extract buildAssistantRepo (#246)
* feat(assistant): warm assistant workspace on startup and extract buildAssistantRepo

* feat(notification): rich notification content with shared format helpers (#245)

* loop: notification-format completed after 2 iterations

* refactor: deduplicate permission display logic into shared package

* refactor: consolidate assistant repo construction into buildAssistantRepo
2026-05-31 16:07:12 -04:00
Chris Scott 626a4c42d1 feat(notification): rich notification content with shared format helpers (#245)
* loop: notification-format completed after 2 iterations

* refactor: deduplicate permission display logic into shared package
2026-05-31 13:07:04 -04:00
Chris Scott dbd6866682 feat(assistant): self-configuring assistant mode (#244)
* test(backend): replace better-sqlite3 test mock with node:sqlite

Reimplement the bun:sqlite test mock on top of node:sqlite with an
explicit BEGIN/COMMIT/ROLLBACK transaction wrapper.

* feat(assistant): self-configuring assistant mode

Add a self-editable assistant workspace and the APIs that support it:
- POST /assistant/reload disposes and re-bootstraps the assistant
  instance (directory-scoped, rate-limited) so agent.md edits apply.
- Internal settings API accepts non-secret TTS/STT patches via
  dedicated partial schemas.
- Strip the generated agent persona from opencode.json on repair so
  user-customized agents are preserved across config recovery.
- Cache the last assistant session id to avoid redundant session
  listing on launch.

* style(repo): align worktree and workspace tabs with primary/orange theme
2026-05-31 11:38:02 -04:00
Chris Scott a86e4b1238 feat(ocm-cli): workspace repo sync and manager token targeting (#233) 2026-05-23 19:49:44 -04:00
Chris Scott 74cdeb3926 fix: update settings and skills handling with assistant redirect (#220)
* fix: enable swipe-back suspension on more drawer and remove unused variable

* refactor(frontend): improve dialog component and settings navigation

* fix: disable route swipe suspension in MoreDrawer to prevent unintended navigation

* fix(frontend): enable swipe-back suspension on more drawer route

* refactor(frontend): improve mobile navigation drawer and tab bar

* feat: add schedules service and workspace hook with navigation updates

* chore: add workspace hook, schedules library, and tests

* fix: prevent MoreDrawer sentinel from undoing navigation

* feat: per-agent model selection and UI refinements (#217)

* feat: per-agent model selection and UI refinements

- Add agentModels store with setAgentModel/getAgentModel
- PromptInput uses session model priority and stores agent model on change
- useContextUsage derives model from assistant message instead of global
- Migrate sub-agent/subtask badges from purple to blue with refined styling
- Fix MoreDrawer sentinel to skip history-back on navigation

* refactor: improve per-agent model selection and task tool call status indicators

* feat: add repo management skill and internal repos API

* fix: improve assistant session launcher and UI components

* fix: update atomic-json test assertions

* refactor: split Assistant Mode instructions between AGENTS.md and assistant.md

* loop: todo-header-mobile completed after 3 iterations (#218)

* loop: stt-perf-1 completed after 5 iterations

* fix: load audio worklet per recording context

* fix: canonicalize assistant navigation routes

* fix: adjust scroll-up threshold for header visibility

* fix: update settings and skills handling with assistant redirect

* refactor: simplify context usage indicator and extract token sum helper

* feat: add currently selected model row to popover and fix responsive truncate
2026-05-07 18:36:03 -04:00
Chris Scott c3d6549f01 feat: add assistant mode, SSE streaming, and OpenCode server integration (#214) 2026-05-02 21:51:37 -04:00
Chris Scott d0ddda01de Revert "feat: seed Assistant workspace with update-configuration skill and improved docs"
This reverts commit 6a14bc6b69.
2026-04-27 18:07:41 +00:00
Chris Scott 6a14bc6b69 feat: seed Assistant workspace with update-configuration skill and improved docs 2026-04-27 17:54:03 +00:00
Chris Scott 3dd8e34f98 refactor: introduce OpenCodeSupervisor for server lifecycle management (#200)
Replace direct opencodeServerManager calls with a supervisor that
provides health polling, operation locking, and a 4-step recovery
pipeline (restart, debug capture, rollback, seed default config).

Add archiveBrokenConfig to SettingsService for backup before rollback.
Wire supervisor into all route factories with graceful fallback to
direct manager calls. Add health watch configuration defaults and
env vars.
2026-04-25 19:02:47 -04:00
Chris Scott c894ff5756 Feat/assistant session list (#198)
* feat: add assistant mode integration and fix test environment

- Add assistant-mode service for managing assistant workspace files (AGENTS.md, opencode.json)
- Add backend GET/POST routes for assistant-mode status and initialization
- Add AssistantRedirect page and useAssistantSessionLauncher hook
- Update mobile navigation to include Assistant tab (replaces Alerts)
- Fix React.act compatibility by setting NODE_ENV=test in vitest config
- Add shared Zod schemas for AssistantMode types and requests

* feat: enhance assistant mode with session list view and legacy config migration

- Add session list view for assistant mode with full workspace management
- Migrate legacy opencode.json permission format to granular permissions
- Enable assistant navigation from mobile tab bar and repo switcher
- Preserve assistant context in session routes via query params
- Auto-restart OpenCode server after assistant mode initialization
- Add comprehensive tests for legacy config detection and navigation
2026-04-24 18:35:47 -04:00
Chris Scott 4a90dda1a0 refactor - Add tabs menu - fix swipe nav 2026-04-19 12:48:12 -04:00
Chris Scott 8437efe16d loop: model-fallback-fix completed after 3 iterations 2026-04-14 20:42:50 -04:00
Chris Scott 8cfc6c0a17 fix: read config from file for reload and improve provider validation
- Change reloadConfig to read from opencode.json file instead of HTTP API
- Add logging for OpenCode PATCH responses to aid debugging
- Make providerId optional in schema with custom validation when needed
- Update test to mock fs.readFile instead of fetch
2026-04-13 21:44:39 -04:00
Chris Scott 1f6180e03c Add OpenCode models editor with mobile repos UI refactoring 2026-04-13 14:24:52 -04:00
Chris Scott 9669570e97 fix: protect existing workspace state during host import 2026-04-12 12:33:56 -04:00
itz4blitzandChris Scott 6b1a1e2005 feat: add explicit OpenCode host import and repo relink (#176)
* feat: add explicit OpenCode host import and repo relink

* fix: tighten OpenCode import and relink reporting

* Add OpenCode config schema and JSONC parser imports

* Fix repo relinking and state availability detection for config-only imports

* Remove unused exports and internalize row-shape types

* Remove unused reserveScheduleJobNextRun function

---------

Co-authored-by: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
2026-04-12 10:50:37 -04:00
Chris Scott c3cba72b51 Update skills UI components for managed skills (#165)
* ralph: ralph-repo-level-skills-dialog-skillseditor-fix completed after 4 iterations

* Remove parent session notification and child session tracking from Ralph loops

Sending promptAsync to parent sessions on loop completion could resume
work in previously inactive sessions. Removed parentSessionId from
RalphState, child session tracking maps, and all related event handling.
Watchdog stall detection still works via the session status API.

* Migrate global skills to workspace path

* Add skill injection to scheduled job prompts

* Refactor schedules UI with MultiSelect and tab menu

* Update skills UI components for managed skills
2026-03-22 14:52:32 -04:00
Chris Scott 4bd0940ab9 Add skills editor UI, backend service, shared schema, and promote unused-vars to error 2026-03-22 11:37:02 -04:00
Chris Scott 47524876aa Refactor schedule service and add cron support 2026-03-22 11:14:30 -04:00
Chris Scott 1e863c5fc5 Add cron-based scheduling with prompt templates integration (#164) 2026-03-21 23:33:03 -04:00
21a2094cfd Pr 158 (#161)
* feat: discover local repos and reconnect OpenCode sessions

Replace one-by-one local repo setup with parent-folder discovery and path-aware repo linking so first-time installs can recover existing OpenCode chats. Add first-run import support and onboarding docs for standalone OpenCode users, including Docker path-matching guidance.

* fix: address session discovery review feedback

* fix: improve delete/unlink messaging for local vs cloned repos

* feat: discover local repos and reconnect OpenCode sessions (#158)

---------

Co-authored-by: itz4blitz <justinscroggins@outlook.com>
Co-authored-by: itz4blitz <60281870+itz4blitz@users.noreply.github.com>
2026-03-20 21:06:09 -04:00
Chris ScottandNiu Shuai 5746033fde Test fix branch (#157)
* fix(lsp): Fixes pyright LSP initialization timeout

* test(lsp): Add unit tests for bin directory initialization

- Add reinitializeBinDirectory() public method for testing
- Add 7 comprehensive test cases
- Cover success scenarios, error handling, and edge cases
- Achieve 100% code and branch coverage

* Refactor OpenCode server for testability and fix bin directory tests

* Standardize test ENV mocks and modernize imports

---------

Co-authored-by: Niu Shuai <guisu2010@gmail.com>
2026-03-08 21:40:37 -04:00
Niu ShuaiandChris Scott 62343366f6 fix(lsp): Fixes LSP initialization timeout (#152)
* fix(lsp): Fixes pyright LSP initialization timeout

* test(lsp): Add unit tests for bin directory initialization

- Add reinitializeBinDirectory() public method for testing
- Add 7 comprehensive test cases
- Cover success scenarios, error handling, and edge cases
- Achieve 100% code and branch coverage

* Refactor OpenCode server for testability and fix bin directory tests

---------

Co-authored-by: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
2026-03-08 21:36:07 -04:00
Chris Scott ebb0db0cad Replace shell commands with native fs in repo service 2026-03-07 22:46:28 -05:00
Chris Scott a911a2f759 Restore enhanced source control features from PR #138
PR #145 accidentally reverted all source control enhancements from PR #138. This cherry-picks those changes back: discard changes functionality, commit detail view, commit file diffs, diff truncation, and UI improvements.
2026-02-23 16:43:28 -05:00
Chris Scott 3461f86556 Add memory plugin with semantic search and session planning (#145)
* Add memory plugin with semantic search and session planning

* Clarify Memory Plugin is optional in docs
2026-02-23 15:08:56 -05:00
theepicsaxguyandChris Scott da283a82cf Feature/enhanced source control (#138)
* feat: enhance source control with discard and commit detail views

- Add discard changes functionality with confirmation dialog
- Implement commit detail view with file list and diffs
- Update commit badges: blue for unpushed (local), purple for pushed (remote)
- Display current branch in commits header
- Reuse existing components (DeleteDialog, FileDiffView, GitFlatFileList)
- Add proper error handling and toast notifications
- Extend backend API with /discard and /commit/:hash endpoints
- Update types to include CommitDetails and CommitFile interfaces

Backend:
- Add discardChanges() method to GitService
- Add getCommitDetails() and getCommitDiff() methods
- Add POST /:id/git/discard endpoint
- Add GET /:id/git/commit/:hash and /:id/git/commit/:hash/diff endpoints

Frontend:
- Add discard button (rotate-left icon) to file items
- Add gitDiscardFiles API function and useGit mutation
- Create CommitDetailView component
- Update CommitsTab with color coding and branch display
- Extend SourceControlPanel for commit detail navigation
- Add confirmation dialog using DeleteDialog pattern

Tests:
- Backend tests passing with 77% line coverage
- Linting passes for all modified files
- Type safety maintained throughout

BREAKING CHANGES: None

* Fix critical bugs from code review

- Fix syntax error in GitService.ts (missing closing brace for getCommitDiff)
- Make AUTH_SECRET mandatory in crypto.ts to prevent weak encryption fallback
- Fix race condition in PassphraseHandler by using unique request IDs
- Add error logging to ssh-key-manager catch blocks
- Add type guards (isGitCredential, filterGitCredentials) to replace unsafe assertions
- Fix TypeScript errors and variable shadowing in GitService and settings
- Remove unused variable in sshHostKeyHandler
- Update GitService tests with proper mock data structure

All changes verified: lint passes, typecheck passes, 102/103 tests pass

* Fix critical bugs from code review

- Fix git restore command syntax (--source=HEAD → --source HEAD)
- Use crypto.randomBytes for secure requestId generation
- Add requestId to SSH host key broadcast for frontend compatibility
- Add missing onDiscard prop to GitFlatFileList
- Remove dead code (187 unreachable lines) in ChangesTab
- Fix regex alternation bug in commit stat parsing
- Optimize getCommitDetails with --numstat (N+1 → 1 git call)
- Optimize unpushed commit check to use merge-base instead of full list
- Remove useless conditional in handleDiscard
- Fix type contract violation in CommitDetailView onSelect

* fix: resolve code review issues

- Add missing handleDiscard function in ChangesTab.tsx
- Fix duplicate requestId property in sshHostKeyHandler.ts
- Remove unnecessary type assertion in settings.ts

* feat: enhance source control with commit view improvements and diff fixes

- Add readOnly mode to GitFlatFileList to hide stage/unstage buttons in commit view
- Fix commit file diff display by using correct git show command syntax
- Add line stats display (+additions/-deletions) for each file in commit view
- Show total commit stats in header (Changed Files N +X -Y)
- Fix commit file list parsing to use --name-status and --numstat
- Add 500KB diff size limit with truncation warning
- Fix discard changes for untracked files by deleting them directly
- Update Dockerfile to copy backend/node_modules correctly
- Fix TypeScript error in CommitDetailView onFileSelect call

* Refactor API error handling and enhance source control functionality

* Fix code review issues: OAuth error handling, unpushed detection, comments, and duplicates

- Remove shared handleApiError import from OAuth and restore local pattern

- Fix isCommitUnpushed to use getUnpushedCommitHashes for correct upstream detection

- Remove inline comments from ssh-key-manager.ts (style violation)

- Remove duplicate fetchCommitDiff function

- Add missing getErrorMessage import to repo-git.ts

* Refactor imports and type assertions in GitService, SSH tests, and handleApiError

* Refactor GitService methods for improved error handling and code clarity; add discardChanges functionality and enhance commit details retrieval

* Refactor Git and SSH services: streamline imports, enhance error handling, and remove unused code

* Refactor source control components: remove unused useGitAction hook and enhance error handling in handleGitAction

* Enhance error handling in Git routes and improve UI components for better user experience

* Remove unnecessary blank line in GitService class

* Fix commit log parsing and rename detection in GitService

* Refactor source control UI for full-screen diffs, improve mobile view, and add discard confirmation dialog

* Fix lint warnings and ignore test files in GitGuardian scan

---------

Co-authored-by: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
2026-02-21 21:57:05 -05:00
Chris Scott 7341dce1ef Add skip SSH host key verification and fix self-hosted server support (#121)
* Add SSH host key verification with automatic trust and SCP-style URL support

* Fix TypeScript errors for SSH host key schema and test mocks
2026-02-11 22:58:13 -05:00
Chris Scott 414f39b809 feat: SSH Authentication Keys v2 (#113)
* feat: add SSH authentication keys v2 for Git operations

Add comprehensive SSH key authentication support for Git operations including:
- SSH host key verification with user approval flow
- Encrypted SSH key storage with passphrase support
- SSH connection testing endpoint
- Real-time host key change warnings

Backend changes:
- New SSHHostKeyHandler for managing host key verification via IPC
- Add passphrase handler for locked SSH keys
- Add SSH key manager utilities (key writing, validation, cleanup)
- Add crypto utilities for secure key/secret encryption
- Add SSH validation utilities for key format checking
- Add SSH routes for host key response handling
- Enhance GitAuthService with SSH setup and environment methods
- Update GitService to handle SSH authentication for push/fetch/pull
- Update OpenCode server to support SSH keys with SSH config generation
- Add database migration for trusted_ssh_hosts table
- Add settings endpoint for SSH connection testing

Frontend changes:
- Add SSHHostKeyDialog for host key verification UI
- Add PassphraseModal for SSH key passphrase input
- Update GitCredentialDialog with SSH key type and testing
- Update GitSettings to manage SSH keys
- Add SSH API client and hooks (useSSH, usePassphraseHandler)

Shared changes:
- Add SSH schemas and types

Test coverage:
- Integration tests for SSH flow
- IPC handler tests for host key and passphrase
- SSH route tests
- SSH utility validation tests
- Updated existing tests for SSH-aware changes
2026-02-08 00:06:44 -05:00
Chris Scott e3716bb294 Refactor: Consolidate git services into single GitService class + Settings dialog improvements (#111)
* refactor: consolidate git services into single GitService class

Merges GitBranchService, GitCommitService, GitDiffService, GitFetchPullService,
GitLogService, GitPushService, and GitStatusService into one cohesive GitService
that simplifies architecture and follows SOLID principles. Updates all route
handlers and tests to use the new consolidated service. Moves GitBranch interface
to shared types location.

* Refactor settings dialog to use URL-based state management with tab synchronization

* Update social preview image
2026-02-06 21:59:18 -05:00
Chris Scott 40c954488e Merge dev to main - SSE refactoring & UI improvements (#105)
* Remove unused variables from routes and migrations

* Use structured logging instead of console in archive service

* Remove unused test variables and configure ESLint for test files

* refactor sse directory management with reference counting and improve message invalidation

* simplify question prompt Other option handling and increase max height

Remove redundant Cancel/Confirm buttons, use main Next/Confirm button for custom input, prevent double selection in single-select mode, auto-scroll textarea on focus, increase max-height from 40vh to 70vh
2026-02-01 21:49:29 -05:00
theepicsaxguy c32819fc1c feat: auto-create remote branches on push (#91) 2026-01-31 12:06:07 -05:00
Chris Scott cb1714a4e0 Merge dev: STT feature, git date fixes, and session improvements (#82)
* fix session last active

* Feature/sst (#81)

* Use CSS field-sizing for textarea auto-height and abort STT recording on clear

* Fix invalid date display in git commits

* Use Unix timestamps for git log dates
2026-01-26 13:03:02 -05:00
Chris Scott 353b9d4495 Fix git porcelain output parsing and deduplicate staged/unstaged file entries 2026-01-23 00:42:36 -05:00
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
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 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