Skip to content

Comments

feat(editor): support opening .code-workspace files for VS Code/Cursor#78

Merged
helizaga merged 3 commits intocoderabbitai:mainfrom
Stormix:feat/workspace-file-support
Jan 13, 2026
Merged

feat(editor): support opening .code-workspace files for VS Code/Cursor#78
helizaga merged 3 commits intocoderabbitai:mainfrom
Stormix:feat/workspace-file-support

Conversation

@Stormix
Copy link
Contributor

@Stormix Stormix commented Jan 12, 2026

Pull Request

Description

Add support for opening .code-workspace files when launching editors from gtr.

This introduces a small helper to resolve workspace files, updates the VS Code and Cursor editor adapters to optionally open a workspace instead of a folder, and adds configuration to control this behavior.

Motivation

Many projects rely on .code-workspace files to define multi-root setups, editor settings, and recommended extensions. Currently, gtr always opens the worktree directory, even when a workspace file is present, requiring users to manually open it afterward.

This change makes gtr respect workspace files when available, improving the editor workflow while keeping existing behavior as a fallback.

Fixes #77

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring (no functional changes)
  • Other (please describe):

Testing

Manual Testing Checklist

Tested on:

  • macOS
  • Linux (specify distro: **_**)
  • Windows (WSL / Ubuntu)

Core functionality tested:

  • git gtr new <branch> - Create worktree
  • git gtr go <branch> - Navigate to worktree
  • git gtr editor <branch> - Open in editor (if applicable)
  • git gtr ai <branch> - Start AI tool (if applicable)
  • git gtr rm <branch> - Remove worktree
  • git gtr list - List worktrees
  • git gtr config - Configuration commands (if applicable)
  • Other commands affected by this change: **__**

Test Steps

  1. Create a worktree with a .code-workspace file in the root
  2. Run git gtr editor <branch> and verify the workspace file is opened
  3. Set gtr.editor.workspace to a specific file and verify it is respected
  4. Set workspace to none and verify the editor opens the folder instead
  5. Remove or rename the workspace file and verify fallback behavior

Expected behavior:

  • Editor opens the workspace file when configured or auto-detected
  • Editor falls back to opening the worktree directory when no workspace is found or when disabled

Actual behavior:

  • Matches expected behavior

Breaking Changes

  • This PR introduces breaking changes
  • I have discussed this in an issue first
  • Migration guide is included in documentation

Checklist

Before submitting this PR, please check:

  • I have read CONTRIBUTING.md
  • My code follows the project's style guidelines
  • I have performed manual testing on at least one platform
  • I have updated documentation (README.md, CLAUDE.md, etc.) if needed
  • My changes work on multiple platforms (or I've noted platform-specific behavior)
  • I have added/updated shell completions (if adding new commands or flags)
  • I have tested with both git gtr (production) and ./bin/gtr (development)
  • No new external dependencies are introduced (Bash + git only)
  • All existing functionality still works

Additional Context

This change is intentionally opt-in and conservative:

  • Existing behavior remains the default
  • Workspace support only applies to editors that support it (VS Code, Cursor)
  • Users can explicitly disable workspace detection if undesired

License Acknowledgment

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache License 2.0.

Summary by CodeRabbit

  • New Features

    • Added support for opening workspace files in VS Code and Cursor editors; workspace selection can be configured, auto-detected, or disabled.
  • Documentation

    • Updated configuration docs, examples, and templates to document the new workspace setting and behavior.
    • README examples updated to reflect revised tool/config examples.

✏️ Tip: You can customize this high-level summary in your review settings.

- Add resolve_workspace_file() helper to detect workspace files
- Update cursor.sh and vscode.sh adapters to accept optional workspace arg
- Auto-detect *.code-workspace files in worktree root
- Add gtr.editor.workspace config option (or defaults.workspace in .gtrconfig)
- Support 'none' value to disable workspace lookup entirely
- Update documentation (configuration.md, .gtrconfig.example, CLAUDE.md)
@coderabbitai
Copy link

coderabbitai bot commented Jan 12, 2026

Walkthrough

Adds workspace-file support for VS Code/Cursor: new config key gtr.editor.workspace, workspace resolution logic in bin/gtr, and editor adapters updated to prefer opening a resolved workspace file when present.

Changes

Cohort / File(s) Summary
Documentation & Templates
CLAUDE.md, docs/configuration.md, templates/.gtrconfig.example, README.md
Introduce and document new gtr.editor.workspace option, describe values (<path>, none, auto-detect), add "Workspace files" guidance and update examples.
Core CLI Logic
bin/gtr
Add resolve_workspace_file(worktree_path) to locate workspace files; pass resolved workspace as an optional second argument to editor-launch codepaths (cmd_create, cmd_editor); add public config declaration for gtr.editor.workspace.
Editor Adapters
adapters/editor/vscode.sh, adapters/editor/cursor.sh
Extend editor_open() to accept an optional workspace_file parameter and open the workspace file when provided and valid; otherwise fall back to opening the folder path.
Config Mapping
lib/config.sh
Map gtr.editor.workspace <-> .gtrconfig editor.workspace keys in config mapping/listing functions.
CLI Entry
bin/gtr (usage changes reflected in bin/gtr)
Ensure editor-open target selection uses a resolved target variable so workspace overrides don't leak across calls.

Sequence Diagram

sequenceDiagram
    participant User
    participant gtr as bin/gtr
    participant FS as Filesystem
    participant Adapter as Editor Adapter
    participant Editor as VS Code/Cursor

    User->>gtr: gtr editor / gtr create --editor
    gtr->>gtr: resolve_workspace_file(worktree_path)
    gtr->>FS: Read config gtr.editor.workspace / .gtrconfig editor.workspace
    alt Config == "none"
        gtr->>gtr: skip workspace lookup
    else Config specifies path
        gtr->>FS: check configured workspace file exists
    else (no config)
        gtr->>FS: auto-detect *.code-workspace at worktree root
    end
    gtr->>Adapter: editor_open(path, workspace_file?)
    alt workspace_file present and valid
        Adapter->>Editor: open workspace_file
    else
        Adapter->>Editor: open folder path
    end
    Editor-->>User: editor ready
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A tiny hop, a workspace found,
I sniff the root and look around.
If config says none, I skip the trail,
Else I open the file without fail.
Hooray — the editor greets with a bound! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning README.md changes update AI tool examples (claude, codex) which are outside the workspace feature scope, though minor and not breaking. Consider reverting README.md AI tool example changes or document them as a separate concern to keep this PR focused on workspace file support.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the primary feature: adding support for opening .code-workspace files for VS Code/Cursor editors.
Linked Issues check ✅ Passed All objectives from issue #77 are met: configuration option (gtr.editor.workspace) added, auto-detection implemented, workspace-only behavior for compatible editors, editor adapters updated, and affected commands properly modified.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 12aaed1 and 0ef4628.

📒 Files selected for processing (5)
  • CLAUDE.md
  • README.md
  • bin/gtr
  • lib/config.sh
  • templates/.gtrconfig.example
🚧 Files skipped from review as they are similar to previous changes (2)
  • templates/.gtrconfig.example
  • CLAUDE.md
🧰 Additional context used
📓 Path-based instructions (7)
bin/gtr

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

bin/gtr: Dispatch commands through cmd_* functions in bin/gtr (case block lines 36‑77)
Update GTR_VERSION on line 8 of bin/gtr when releasing; this affects gtr version / --version output

Global set -e in bin/gtr: guard non-critical commands with || true

list --porcelain output must remain stable for scripting purposes

bin/gtr: Update bin/gtr version constant (GTR_VERSION) when releasing a new version
Update help text in bin/gtr by searching for 'Available editors:' in cmd_help function and load_editor_adapter function when adding a new editor adapter
Update help text in bin/gtr by searching for 'Available AI tools:' in cmd_help function and load_ai_adapter function when adding a new AI tool adapter

Files:

  • bin/gtr
{bin/gtr,lib/**/*.sh,adapters/**/*.sh}

📄 CodeRabbit inference engine (.github/instructions/testing.instructions.md)

{bin/gtr,lib/**/*.sh,adapters/**/*.sh}: All commands must exit 0 (except intentional failures) and produce expected side-effects
No unquoted path errors; spaces must be handled in file paths
Hooks must run only once per creation/removal event

Files:

  • bin/gtr
  • lib/config.sh
lib/**/*.sh

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

lib/**/*.sh: Core libraries (lib/core.sh, lib/config.sh, lib/ui.sh, lib/copy.sh, lib/hooks.sh, lib/platform.sh) must be sourced at startup and implement specific functionality
Maintain backwards compatibility with Git <2.22 by using fallback rev-parse --abbrev-ref HEAD instead of branch --show-current

lib/**/*.sh: Maintain backwards compatibility with existing configs in shell scripts
Quote all paths to support spaces in directory names
Use log_error / log_info from lib/ui.sh for user messages
Implement Git version fallbacks (e.g., Git 2.22+ --show-current vs older rev-parse); check lib/core.sh:97-100 for example
Add new config keys with gtr.<name> prefix to avoid collisions
For performance-sensitive loops (e.g., directory scans), prefer built-ins (find, grep) with minimal subshells
For any new Git command, add fallback for older versions or guard with detection

lib/**/*.sh: Maintain backwards compatibility with existing configurations when modifying core functionality in lib/*.sh files
Follow POSIX-compatible Bash patterns targeting Bash 3.2+ when modifying core functionality in lib/*.sh files
Provide clear error messages via log_error and log_info from lib/ui.sh when modifying core functionality

Files:

  • lib/config.sh
**/*.sh

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.sh: Always quote paths to handle spaces and special characters; avoid unguarded globbing
Keep set -e active in shell scripts; ensure non-critical failures are guarded with command || true

**/*.sh: Use shebang #!/usr/bin/env bash (not /bin/bash or /bin/sh) for Bash scripts
Use snake_case naming for functions in Bash scripts
Use snake_case for local variables and UPPER_CASE for constants/environment variables in Bash scripts
Use 2-space indentation (no tabs) in Bash scripts
Always quote variables and paths in Bash scripts to prevent word splitting and globbing issues
Check return codes and use || exit 1 or || return 1 for error handling in Bash scripts
Use set -e for error handling in Bash scripts
Use local keyword for function-scoped variables in Bash scripts

Files:

  • lib/config.sh
lib/config.sh

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

For multi-value git config keys, use git config --add to merge and deduplicate values rather than overwriting the entire list

Files:

  • lib/config.sh
**/*.{bash,fish,sh}

📄 CodeRabbit inference engine (.github/instructions/sh.instructions.md)

**/*.{bash,fish,sh}: Bash 3.2+ compatible (macOS default), but 4.0+ features allowed where appropriate
Always quote variables: use "$var" not $var
Use function-scoped variables: local var="value"
Check return codes; functions return 1 on failure
Use snake_case for functions and variables, UPPER_CASE for constants
Prefer [ ] over [[ ]] for POSIX portability; use [[ only when needed
Always quote glob inputs; disable unintended globbing with set -f temporarily if required
Avoid associative arrays in shell scripts; use simple string/loop constructs for Bash 3.2+ compatibility
Avoid readarray and process substitution unsupported in older Bash
Debug with bash -x ./bin/gtr <cmd> or wrap suspicious blocks with set -x / set +x
Check function presence with declare -f create_worktree or declare -f resolve_target
Use stderr for variable inspection: echo "DEBUG var=$var" >&2 to keep stdout clean for command substitution
Keep dependencies minimal: only use git, sed, awk, find, grep; avoid jq/curl unless justified
Check availability of external commands before use when adding new tools
Use "${var}" for variable expansion; for line loops use while IFS= read -r line; do ... done to preserve spaces
Sanitize branch names via sanitize_branch_name function; do NOT duplicate logic elsewhere
Everything is sourced at startup with set -e enabled; functions call each other directly; no subshells except for hooks and AI tools

Files:

  • lib/config.sh
README.md

📄 CodeRabbit inference engine (CLAUDE.md)

README.md: Update README.md with installation/setup instructions when adding a new editor adapter
Update README.md with installation instructions and use cases when adding a new AI tool adapter

Files:

  • README.md
🧠 Learnings (1)
📚 Learning: 2025-12-29T18:46:36.983Z
Learnt from: helizaga
Repo: coderabbitai/git-worktree-runner PR: 64
File: bin/gtr:746-750
Timestamp: 2025-12-29T18:46:36.983Z
Learning: When error messages reference missing CLI tools (such as gh for GitHub CLI), use platform-agnostic installation guidance by directing users to the official website (e.g., https://cli.github.com/) instead of platform-specific package managers (brew, apt, choco) to ensure the guidance works across all operating systems. Apply this messaging to the bin/gtr script where applicable.

Applied to files:

  • bin/gtr
🔇 Additional comments (10)
lib/config.sh (2)

93-94: LGTM!

The mapping correctly adds gtr.editor.workspaceeditor.workspace for .gtrconfig support, following the established pattern in this file.


309-310: LGTM!

The reverse mapping editor.workspacegtr.editor.workspace is correctly added to maintain bidirectional consistency with the cfg_map_to_file_key function.

README.md (3)

123-123: LGTM!

Documentation update aligns with the default AI tool being claude in the quick setup examples.


194-194: LGTM!

Example updated to use codex as the override, providing variety from the default claude example.


299-299: LGTM!

AI tool list reordered to prioritize commonly used tools (claude, codex, copilot) while maintaining all available options.

bin/gtr (5)

38-51: LGTM!

The editor_open function correctly implements workspace file support:

  • Optional workspace parameter with safe default
  • File existence check before using workspace
  • Proper variable quoting throughout

1319-1348: Well-structured implementation with clear precedence rules.

The function correctly implements:

  1. Opt-out via "none" config value
  2. Explicit config takes precedence (no auto-detect fallback if file missing)
  3. Auto-detection as last resort

One minor note: find output order is filesystem-dependent, so if multiple .code-workspace files exist, the selected file may vary across systems. This is acceptable for auto-detection but worth documenting.


314-317: LGTM!

Workspace resolution is correctly integrated into the create flow, passing the resolved workspace file to editor_open.


715-718: LGTM!

Consistent with the cmd_create integration pattern. Workspace resolution is correctly wired into the editor command flow.


1577-1578: LGTM!

Help text accurately describes the new configuration option and its three modes (explicit path, auto-detection, and "none" to disable).


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@helizaga helizaga marked this pull request as ready for review January 12, 2026 23:42
@helizaga helizaga requested a review from NatoBoram as a code owner January 12, 2026 23:42
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @bin/gtr:
- Around line 1319-1321: Add the new configuration option description to the
cmd_help output under the CONFIGURATION OPTIONS section so users can discover
it; update the help text string in the cmd_help function to include an entry for
"gtr.editor.workspace" with a short description like: "gtr.editor.workspace    
VS Code/Cursor workspace file path (relative to worktree root, or \"none\" to
disable)" so it appears alongside the other options in the help output.
🧹 Nitpick comments (1)
bin/gtr (1)

1341-1346: Non-deterministic ordering when multiple workspace files exist.

The find | head -1 returns the first file found, but filesystem ordering is not guaranteed. If users have multiple .code-workspace files, results may vary across runs or systems.

Consider sorting for deterministic behavior:

🔧 Proposed fix for deterministic ordering
   # Auto-detect: find first .code-workspace in worktree root
   local ws_file
-  ws_file=$(find "$worktree_path" -maxdepth 1 -name "*.code-workspace" -type f 2>/dev/null | head -1)
+  ws_file=$(find "$worktree_path" -maxdepth 1 -name "*.code-workspace" -type f 2>/dev/null | LC_ALL=C sort | head -1)
   if [ -n "$ws_file" ]; then
     echo "$ws_file"
   fi
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7e6c608 and 12aaed1.

📒 Files selected for processing (6)
  • CLAUDE.md
  • adapters/editor/cursor.sh
  • adapters/editor/vscode.sh
  • bin/gtr
  • docs/configuration.md
  • templates/.gtrconfig.example
🧰 Additional context used
📓 Path-based instructions (9)
adapters/{editor,ai}/**/*.sh

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

adapters/{editor,ai}/**/*.sh: Adapters in adapters/{editor,ai} must each implement two functions with strict contracts: Editor requires editor_can_open and editor_open <path>; AI requires ai_can_start and ai_start <path> [args...]
Adapter functions must check tool availability using command -v, emit errors via log_error, never silently fail, and avoid side effects outside the target directory

Files:

  • adapters/editor/vscode.sh
  • adapters/editor/cursor.sh
**/*.sh

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.sh: Always quote paths to handle spaces and special characters; avoid unguarded globbing
Keep set -e active in shell scripts; ensure non-critical failures are guarded with command || true

**/*.sh: Use shebang #!/usr/bin/env bash (not /bin/bash or /bin/sh) for Bash scripts
Use snake_case naming for functions in Bash scripts
Use snake_case for local variables and UPPER_CASE for constants/environment variables in Bash scripts
Use 2-space indentation (no tabs) in Bash scripts
Always quote variables and paths in Bash scripts to prevent word splitting and globbing issues
Check return codes and use || exit 1 or || return 1 for error handling in Bash scripts
Use set -e for error handling in Bash scripts
Use local keyword for function-scoped variables in Bash scripts

Files:

  • adapters/editor/vscode.sh
  • adapters/editor/cursor.sh
adapters/editor/**/*.sh

📄 CodeRabbit inference engine (.github/instructions/editor.instructions.md)

adapters/editor/**/*.sh: Editor adapter must implement editor_can_open() function that probes for command availability using command -v operator
Editor adapter must implement editor_open <path> function that opens the given path in the editor
Quote all paths in shell commands to support spaces and special characters
Use log_error function with actionable installation guidance when the editor command is not found
Do not change PWD globally in editor adapters; avoid using subshells when opening editors
Keep adapter implementations lean: avoid project scans, blocking prompts, and unnecessary logic
Name editor adapter files using lowercase tool name (e.g., zed.sh for the Zed editor, not uppercase)
If editor command is missing, fail clearly with an error message; do not silently defer to a file browser fallback

Files:

  • adapters/editor/vscode.sh
  • adapters/editor/cursor.sh
**/*.{bash,fish,sh}

📄 CodeRabbit inference engine (.github/instructions/sh.instructions.md)

**/*.{bash,fish,sh}: Bash 3.2+ compatible (macOS default), but 4.0+ features allowed where appropriate
Always quote variables: use "$var" not $var
Use function-scoped variables: local var="value"
Check return codes; functions return 1 on failure
Use snake_case for functions and variables, UPPER_CASE for constants
Prefer [ ] over [[ ]] for POSIX portability; use [[ only when needed
Always quote glob inputs; disable unintended globbing with set -f temporarily if required
Avoid associative arrays in shell scripts; use simple string/loop constructs for Bash 3.2+ compatibility
Avoid readarray and process substitution unsupported in older Bash
Debug with bash -x ./bin/gtr <cmd> or wrap suspicious blocks with set -x / set +x
Check function presence with declare -f create_worktree or declare -f resolve_target
Use stderr for variable inspection: echo "DEBUG var=$var" >&2 to keep stdout clean for command substitution
Keep dependencies minimal: only use git, sed, awk, find, grep; avoid jq/curl unless justified
Check availability of external commands before use when adding new tools
Use "${var}" for variable expansion; for line loops use while IFS= read -r line; do ... done to preserve spaces
Sanitize branch names via sanitize_branch_name function; do NOT duplicate logic elsewhere
Everything is sourced at startup with set -e enabled; functions call each other directly; no subshells except for hooks and AI tools

Files:

  • adapters/editor/vscode.sh
  • adapters/editor/cursor.sh
{bin/gtr,lib/**/*.sh,adapters/**/*.sh}

📄 CodeRabbit inference engine (.github/instructions/testing.instructions.md)

{bin/gtr,lib/**/*.sh,adapters/**/*.sh}: All commands must exit 0 (except intentional failures) and produce expected side-effects
No unquoted path errors; spaces must be handled in file paths
Hooks must run only once per creation/removal event

Files:

  • adapters/editor/vscode.sh
  • adapters/editor/cursor.sh
  • bin/gtr
adapters/**/*.sh

📄 CodeRabbit inference engine (.github/instructions/testing.instructions.md)

Adapter sourcing must be verifiable with function existence checks like editor_can_open and ai_can_start

Files:

  • adapters/editor/vscode.sh
  • adapters/editor/cursor.sh
adapters/editor/*.sh

📄 CodeRabbit inference engine (CLAUDE.md)

adapters/editor/*.sh: Editor adapters must implement editor_can_open() function that returns 0 if the editor is available and non-zero otherwise
Editor adapters must implement editor_open(path) function that opens the editor at the specified path
Editor adapter files must be placed in adapters/editor/ directory and follow the naming pattern adapters/editor/<name>.sh

Files:

  • adapters/editor/vscode.sh
  • adapters/editor/cursor.sh
adapters/{editor,ai}/*.sh

📄 CodeRabbit inference engine (CLAUDE.md)

Editor and AI adapters should use log_error from lib/ui.sh for user-facing error messages

Files:

  • adapters/editor/vscode.sh
  • adapters/editor/cursor.sh
bin/gtr

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

bin/gtr: Dispatch commands through cmd_* functions in bin/gtr (case block lines 36‑77)
Update GTR_VERSION on line 8 of bin/gtr when releasing; this affects gtr version / --version output

Global set -e in bin/gtr: guard non-critical commands with || true

list --porcelain output must remain stable for scripting purposes

bin/gtr: Update bin/gtr version constant (GTR_VERSION) when releasing a new version
Update help text in bin/gtr by searching for 'Available editors:' in cmd_help function and load_editor_adapter function when adding a new editor adapter
Update help text in bin/gtr by searching for 'Available AI tools:' in cmd_help function and load_ai_adapter function when adding a new AI tool adapter

Files:

  • bin/gtr
🧠 Learnings (1)
📚 Learning: 2025-12-29T18:46:36.983Z
Learnt from: helizaga
Repo: coderabbitai/git-worktree-runner PR: 64
File: bin/gtr:746-750
Timestamp: 2025-12-29T18:46:36.983Z
Learning: When error messages reference missing CLI tools (such as gh for GitHub CLI), use platform-agnostic installation guidance by directing users to the official website (e.g., https://cli.github.com/) instead of platform-specific package managers (brew, apt, choco) to ensure the guidance works across all operating systems. Apply this messaging to the bin/gtr script where applicable.

Applied to files:

  • bin/gtr
🧬 Code graph analysis (1)
adapters/editor/cursor.sh (2)
adapters/editor/vim.sh (1)
  • editor_can_open (5-7)
lib/ui.sh (1)
  • log_error (12-14)
🔇 Additional comments (10)
CLAUDE.md (2)

446-446: LGTM!

The new gtr.editor.workspace configuration key is well-documented with clear description of its purpose and auto-detection behavior.


463-474: LGTM!

The .gtrconfig key mapping table is properly updated with the new gtr.editor.workspacedefaults.workspace mapping, maintaining consistent formatting with existing entries.

templates/.gtrconfig.example (1)

57-62: LGTM!

The workspace configuration documentation is clear and comprehensive. It properly explains:

  • Explicit workspace file path configuration
  • Auto-detection fallback behavior
  • The none value to disable workspace lookup

The commented examples follow the established template pattern.

adapters/editor/cursor.sh (1)

9-25: LGTM!

The implementation correctly:

  • Accepts an optional workspace_file parameter with proper default
  • Uses properly quoted variables throughout
  • Falls back to directory opening when workspace is not provided or doesn't exist
  • Follows the adapter contract and coding guidelines
adapters/editor/vscode.sh (1)

9-25: LGTM!

The implementation is consistent with the cursor.sh adapter:

  • Optional workspace parameter with safe default
  • Proper variable quoting
  • Correct fallback behavior when workspace file is missing
docs/configuration.md (2)

109-114: LGTM!

The new gtr.editor.workspace configuration option is well-documented with clear comments explaining the behavior and default auto-detection.


123-131: LGTM!

The "Workspace files" section provides clear documentation of the workspace resolution behavior:

  1. Explicit configuration takes precedence
  2. none disables lookup
  3. Auto-detection of *.code-workspace files
  4. Fallback to folder opening

This matches the implementation described in the PR and provides users with actionable guidance.

bin/gtr (3)

38-51: LGTM!

The function correctly handles the optional workspace parameter with proper fallback behavior. The target variable approach cleanly separates the decision logic from the command execution, and quoting is correct for paths with spaces.


314-317: LGTM!

Correct integration of workspace resolution into the create workflow. The workspace file is resolved after loading the adapter, allowing adapters to potentially provide their own resolve_workspace_file override if needed.


715-718: LGTM!

Consistent implementation matching the cmd_create pattern.

- Add missing config key mapping in lib/config.sh for gtr.editor.workspace
- Fix .gtrconfig key naming: defaults.workspace → editor.workspace for consistency
- Fix bug: explicit config now takes precedence (no auto-detect fallback when file missing)
- Update README examples to use claude instead of aider
@helizaga helizaga force-pushed the feat/workspace-file-support branch from 550c774 to 02dff6c Compare January 12, 2026 23:53
@helizaga
Copy link
Collaborator

helizaga commented Jan 13, 2026

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 13, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

1 similar comment
@coderabbitai
Copy link

coderabbitai bot commented Jan 13, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@helizaga helizaga merged commit ad0f839 into coderabbitai:main Jan 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Support opening .code-workspace files instead of folders for VS Code/Cursor

2 participants