Skip to content

Add dynamic tool path detection in install.sh#216

Open
Shiven0504 wants to merge 2 commits intomsitarzewski:mainfrom
Shiven0504:feature/dynamic-tool-path-detection
Open

Add dynamic tool path detection in install.sh#216
Shiven0504 wants to merge 2 commits intomsitarzewski:mainfrom
Shiven0504:feature/dynamic-tool-path-detection

Conversation

@Shiven0504
Copy link

Summary

  • Adds --path <dir> flag to override the default install directory for any tool
  • Adds environment variable fallbacks (CLAUDE_CONFIG_DIR, COPILOT_AGENT_DIR, CURSOR_RULES_DIR, etc.) checked before hardcoded defaults
  • Warns users when parent directories don't exist (non-fatal — they're still created)
  • Adds a VS Code chat.agentFilesLocations hint after Copilot install (addresses install script uses wrong location for vscode copilot #185)

Path resolution priority: --path flag > env var > default

Test plan

  • ./scripts/install.sh --tool cursor --path /tmp/test-cursor installs to custom path
  • CLAUDE_CONFIG_DIR=/tmp/test-claude ./scripts/install.sh --tool claude-code respects env var
  • ./scripts/install.sh --tool copilot shows VS Code settings hint
  • ./scripts/install.sh --path /tmp/test (without --tool) exits with error
  • Default behavior unchanged when no --path or env vars are set
  • ./scripts/install.sh --help shows updated usage with new flags and env vars

Closes #205
Addresses #185

Replace hardcoded install paths with a flexible resolution system:
--path flag > environment variable > default path.

- Add --path <dir> flag to override install directory for any tool
- Add env var support (CLAUDE_CONFIG_DIR, COPILOT_AGENT_DIR, etc.)
- Warn when parent directories don't exist before creating them
- Add VS Code chat.agentFilesLocations hint after Copilot install

Closes msitarzewski#205, addresses msitarzewski#185
Copy link
Owner

@msitarzewski msitarzewski left a comment

Choose a reason for hiding this comment

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

Hey @Shiven0504 — nice work here! The --path flag is a great addition and the resolve_path() / warn_if_missing pattern is clean. This covers #205, #185, and #218 in one shot, which is exactly what we need.

One ask before we merge: could you drop the per-tool environment variables (CLAUDE_CONFIG_DIR, COPILOT_AGENT_DIR, ANTIGRAVITY_DIR, etc.)? The --path flag already gives users the escape hatch for non-standard installs, so the env vars add documentation and maintenance surface without a clear use case driving them. Keeping just --path keeps things tight.

That means:

  • Remove the env var block from the header comments
  • Simplify resolve_path() to just check CUSTOM_PATH vs default (two tiers instead of three)
  • Drop the ${CLAUDE_CONFIG_DIR:+...}, ${COPILOT_AGENT_DIR:-...}, etc. from each installer call

Everything else looks good to go. Thanks for putting this together!

Address PR review feedback: drop CLAUDE_CONFIG_DIR, COPILOT_AGENT_DIR,
and other per-tool environment variables. The --path flag is sufficient
as the single escape hatch for non-standard installs.
@Shiven0504 Shiven0504 force-pushed the feature/dynamic-tool-path-detection branch 2 times, most recently from ab66a91 to 552a555 Compare March 16, 2026 03:31
@Shiven0504
Copy link
Author

Hii @msitarzewski , thanks for the review! I've done the 3 changes -

  1. I've now removed the env var block from the header comments (lines 29-30 now go straight from --help to Platform support, so no more CLAUDE_CONFIG_DIR etc.)

  2. Also I've simplified resolve_path() at line 275, it now takes just one arg (the default path) and checks CUSTOM_PATH vs that default.

  3. Then I've dropped all the env var references from installer calls so now things like ${CLAUDE_CONFIG_DIR:+...} and ${COPILOT_AGENT_DIR:-...} are gone. Each installer now just calls resolve_path "default_path" directly (lines 300, 352, 370, 393, 409, 436, 452, 467, 482). Copilot at line 320 checks CUSTOM_PATH directly since it handles two destinations.

The --path flag (line 526), warn_if_missing (line 285) and the copilot VS Code hint (line 345) are all still in place. Let me know if anything else needs modification!

@Shiven0504
Copy link
Author

Also, I noticed the repo has lint-agents.sh but no test suite for install.sh. Would you like me to add a dry-run mode (--dry-run) that prints what would happen without copying files which would make it easier to test.

I can implement something like that in future, or perhaps it would be better if i open up a new discussion before doing anything new 😄

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] Add dynamic tool path detection in install.sh

2 participants