Skip to content

fix: orchcli init now clones repos in user's current directory#32

Merged
mohit-nagaraj merged 5 commits intomainfrom
fix/project-location-config
Aug 31, 2025
Merged

fix: orchcli init now clones repos in user's current directory#32
mohit-nagaraj merged 5 commits intomainfrom
fix/project-location-config

Conversation

@mohit-nagaraj
Copy link
Copy Markdown
Member

What this PR does / why we need it:

This PR fixes a critical issue where orchcli init was cloning repositories (UI and Core) into the CLI's
installation directory (e.g., /usr/local/bin/) instead of the user's current working directory. This caused
permission issues, prevented managing multiple projects, and led to unexpected behavior.

The PR introduces a configuration management system that:

  • Tracks project locations in a JSON config file stored next to the CLI executable
  • Ensures repositories are cloned in the user's current directory
  • Allows managing multiple projects from different directories
  • Updates all commands (start, stop, logs, status, restart) to use the configuration

Which issue(s) this PR fixes:
Fixes #31

Special notes for your reviewer:

  • The config file (orchcli-config.json) is stored next to the orchcli executable or in ~/.orchcli/ as a fallback
  • Each project maintains its own configuration with paths to UI/Core repos
  • The config supports multiple projects and tracks the current active project
  • Added orchcli-config.json to .gitignore to prevent committing local configurations

Checklist

This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.

  • Design: A design document was considered and is present (link) or not required
  • PR: The PR description is expressive enough and will help future contributors
  • Code: Write code that humans can understand and Keep it simple
  • Refactor: You have left the code cleaner than you found it (Boy Scout Rule)
  • Upgrade: Impact of this change on upgrade flows was considered and addressed if required
  • Testing: New code requires new unit tests. New features and bug fixes require at least one e2e test
  • Documentation: A user-guide update was considered and is present (link) or not required. You want a user-guide
    update if it's a user facing feature / API change.
  • Community: Announcement to the community was considered

Release note:

NONE

- Added config management system to track project locations
- Store project paths in orchcli-config.json next to executable
- All commands (start, stop, logs, etc.) now use config to find projects
- Support for multiple projects in different directories
- Repos are cloned in user's current directory, not CLI install location

Fixes permission issues and enables proper project organization
- Renamed configuration-related functions to use PascalCase for consistency
- Adjusted directory and file permission settings for improved security
- Simplified conditional logic in various functions for better readability
- Updated tests to reflect changes in function names and configurations
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @mohit-nagaraj, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical issue in orchcli init where repositories were incorrectly cloned into the CLI's installation directory, leading to permission problems and hindering multi-project management. The core change introduces a robust configuration management system that ensures repositories are cloned into the user's current working directory and allows for tracking and managing multiple development projects. This significantly improves the user experience by providing proper project isolation and persistent configuration.

Highlights

  • Corrected Repository Cloning Location: orchcli init now clones UI and Core repositories into the user's current working directory instead of the CLI's installation path, resolving permission issues and enabling proper project management.
  • Introduced Configuration Management System: A new system tracks project locations and settings in a orchcli-config.json file, supporting multiple projects and their respective UI/Core paths and development modes.
  • Updated Core Commands: All orchcli commands (start, stop, logs, status, restart) have been updated to leverage the new configuration system, ensuring they operate correctly within the context of the active project.
  • Improved User Experience: The changes facilitate managing multiple orchcli projects from different directories and provide clearer output regarding project initialization.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@dosubot dosubot bot added area/config Config, env, CORS, middlewares kind/refactor Code refactoring and technical improvements labels Aug 31, 2025
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively resolves the issue of orchcli init cloning repositories into the wrong directory by introducing a robust configuration management system. The changes correctly use the user's current working directory for new projects and store project-specific paths in a configuration file. This allows for managing multiple projects and makes the CLI's behavior predictable. The updates to other commands (start, stop, etc.) to use this new configuration system are well-implemented and consistent. My review includes a critical point about preventing race conditions when modifying the configuration file and suggestions to improve the newly added unit tests to ensure they are testing the intended functionality.

- Standardized directory permission settings using constants for better readability
- Enhanced error handling in directory creation functions
- Updated comments for clarity and future use of the removeProjectConfig function
@mohit-nagaraj mohit-nagaraj force-pushed the fix/project-location-config branch from fc59c8a to 3313a52 Compare August 31, 2025 14:47
- Implement file locking using github.com/gofrs/flock
- Protect config read-modify-write operations from race conditions
- Add comprehensive tests for concurrent config access
- Ensure atomic writes to prevent data corruption
- Refactor config tests to use actual SaveConfig/LoadConfig functions
- Fix unchecked error returns from fileLock.Unlock()
- Format test files with gofmt -s
- Update test workflow to use Go 1.22 only
@mohit-nagaraj mohit-nagaraj merged commit bfaac18 into main Aug 31, 2025
4 checks passed
@mohit-nagaraj mohit-nagaraj deleted the fix/project-location-config branch August 31, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config, env, CORS, middlewares kind/refactor Code refactoring and technical improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

orchcli init clones repos in CLI install directory instead of user's current directory

1 participant