Skip to content

Conversation

@ezyang
Copy link
Owner

@ezyang ezyang commented Mar 17, 2025

Stack from ghstack (oldest at bottom):

I want you to do a refactor. The idea is that we want to make every tool implementation in tools/ take an extra argument at the start which is the Git root directory. We compute the root directory in main.py off of path once and then pass it in everywhere. Do the refactor in two phases. First, adjust all the tool calls to have a new argument and pass it in from main.py. Second, adjust the implementations to directly make use of the argument instead of recomputing it from scratch. You may have to plumb this argument into helper functions. Don't be lazy.

01e2ed8  (Base revision)
5a44f7f  Update glob_files function to accept git_root parameter
fe12c5d  Update grep_files function to accept git_root parameter
734bba8  Update ls_directory function to accept git_root parameter
41341d4  Fix ls_directory function and move try-except to the correct location
29e9dce  Remove redundant is_git_repository check in ls_directory
b5f6e5a  Update git_grep function to accept git_root parameter and remove redundant check
3f039c3  Update grep_files to pass git_root to git_grep
bd3021f  Update glob function to accept git_root parameter
2ed1f38  Update glob_files to pass git_root to glob
bab215b  Auto-commit format changes
HEAD     Auto-commit lint changes

codemcp-id: 156-refactor-add-git-root-dir-parameter-to-all-tool-im

[ghstack-poisoned]
ezyang added a commit that referenced this pull request Mar 17, 2025
I want you to do a refactor. The idea is that we want to make every tool implementation in tools/ take an extra argument at the start which is the Git root directory. We compute the root directory in main.py off of path once and then pass it in everywhere. Do the refactor in two phases. First, adjust all the tool calls to have a new argument and pass it in from main.py. Second, adjust the implementations to directly make use of the argument instead of recomputing it from scratch. You may have to plumb this argument into helper functions. Don't be lazy.

```git-revs
01e2ed8  (Base revision)
5a44f7f  Update glob_files function to accept git_root parameter
fe12c5d  Update grep_files function to accept git_root parameter
734bba8  Update ls_directory function to accept git_root parameter
41341d4  Fix ls_directory function and move try-except to the correct location
29e9dce  Remove redundant is_git_repository check in ls_directory
b5f6e5a  Update git_grep function to accept git_root parameter and remove redundant check
3f039c3  Update grep_files to pass git_root to git_grep
bd3021f  Update glob function to accept git_root parameter
2ed1f38  Update glob_files to pass git_root to glob
bab215b  Auto-commit format changes
HEAD     Auto-commit lint changes
```

codemcp-id: 156-refactor-add-git-root-dir-parameter-to-all-tool-im
ghstack-source-id: 5248f36
Pull-Request-resolved: #132
@ezyang ezyang closed this Mar 19, 2025
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.

2 participants