Spaces:
Sleeping
Sleeping
File size: 4,982 Bytes
f8a1b9b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
Guidelines for Creating and Utilizing Tools in tools.py:
1. Initial Assessment:
- Before creating new tools, read through tools.py to understand the existing tools and their functionalities.
2. Tool Creation:
- Create new tools as functions within tools.py. If tools.py doesn't exist, create it.
- Ensure tools are designed to be imported and executed via terminal commands, not run directly.
3. Function Design:
- Develop tools for tasks requiring precision or those not easily executable manually.
- Make tools generalizable to handle a wide range of inputs, ensuring reusability for future tasks.
- For example, instead of creating a function for a specific stock or URL, design it to accept any stock ticker or URL as an argument.
- Name functions to reflect their general nature, ensuring they are not limited to a specific use case. This enhances flexibility and adaptability for future applications.
4. Output:
- Tools must always print their output.
5. Execution:
- Do not run tools.py directly. Import functions and execute them with the correct parameters via terminal.
- Always use the `python -c "..."` command to run tools, ensuring no additional scripts are created for execution.
6. Generalization:
- Thoroughly assess the potential range of inputs and design functions to accommodate the broadest possible spectrum of arguments.
- Design functions to accept parameters that cover the most general cases, allowing them to handle a wide variety of scenarios.
- Ensure that functions can handle various data types and structures, allowing for maximum flexibility and adaptability.
- If a request involves distinct tasks, create separate functions for each to maintain clarity and modularity.
- Regularly review and refactor functions to enhance their generalization capabilities as new requirements emerge.
7. Error Handling:
- If errors occur, rewrite functions to resolve them.
8. Script Management:
- Never delete existing content in tools.py as it is a standing script used by the system. You can add tools to create your own functionality and this is encouraged.
- All new functionality should be executed via python -c commands rather than modifying tools.py.
- Avoid creating additional .py scripts for function execution. Always import and run with proper arguments using the `python -c "..."` command.
9. Post-Creation:
- After creating tools, execute them to fulfill user requests unless the request was solely for tool creation.
# Git Smart Clone Instructions
## Overview
This enhanced git cloning system provides automatic code visualization and context extraction for any public repository. When you clone a repository using `git-smartclone`, it will:
1. Clone the repository normally
2. Generate interactive HTML flowcharts for all Python files
3. Extract repository context using gitingest.com
## Installation
1. Ensure you have Python 3.x installed
2. Install required packages:
```bash
pip install pyflowchart requests gitpython
```
3. Add the ProjectTemplates directory to your PATH
4. Copy git-smartclone.ps1 to your ProjectTemplates directory
## Usage
Instead of using regular `git clone`, use:
```powershell
git-smartclone <repository-url>
```
Example:
```powershell
git-smartclone https://github.com/username/repo.git
```
## What You Get
After cloning, you'll find:
1. The cloned repository in your current directory
2. A `flowcharts` directory inside the repository containing:
- Interactive HTML flowcharts for each Python file
- Open these in your browser to see visual code representations
- Click elements to explore the code structure
- Export options for PNG/SVG if needed
3. A `{repo-name}_context.txt` file containing:
- Repository context from gitingest.com
- Code architecture insights
- Key file and directory explanations
## Viewing Results
1. Flowcharts:
- Navigate to the `flowcharts` directory
- Open any `*_flowchart.html` file in your browser
- Interactive elements allow you to:
* Zoom in/out
* Pan around
* Click nodes to see details
* Export as PNG/SVG
2. Repository Context:
- Open `{repo-name}_context.txt`
- Contains AI-generated insights about the codebase
- Helps understand the repository structure
## Benefits
- Instant code visualization
- Better understanding of code flow
- Quick repository context
- Time-saving code exploration
- Enhanced code comprehension
## Notes
- Works best with Python repositories
- Requires internet connection for gitingest.com
- Large repositories may take longer to process
- Empty Python files are automatically skipped
## Troubleshooting
If flowcharts aren't generating:
1. Ensure pyflowchart is installed: `pip install pyflowchart`
2. Check Python file isn't empty
3. Verify file has valid Python syntax
If context extraction fails:
1. Verify repository URL is public
2. Check internet connection
3. Ensure URL is from github.com
|