You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are an expert software architect analyzing repository structures. Generate a reorganization plan as JSON.
4
+
5
+
# REPOSITORY NAME
6
+
{repo_name}
7
+
8
+
# REPOSITORY STRUCTURE
9
+
{tree_structure}
10
+
11
+
# ANALYSIS GUIDELINES
12
+
13
+
## 1. Determine Project Type & Standards
14
+
- **Python**: Should have tests/, pyproject.toml/setup.py, __init__.py in packages
15
+
- **JavaScript/Node**: Should have src/, package.json
16
+
- **Go**: Should have cmd/, pkg/, internal/, go.mod
17
+
- **Java**: Should have src/main/java/, src/test/java/
18
+
- **LaTeX**: Should have latex/, figures/, references/, data/ folders
19
+
- **Generic**: Logical grouping, clear separation of concerns
20
+
21
+
## 2. Evaluate Current Structure (1-5 scale)
22
+
- 5: Perfect - follows all conventions
23
+
- 4: Good - minor improvements possible
24
+
- 3: Acceptable - works but could be better
25
+
- 2: Poor - scattered files, confusing structure
26
+
- 1: Chaotic - no clear organization
27
+
28
+
## 3. Critical Issues to Always Fix
29
+
- Missing essential files (__init__.py in Python packages, .gitignore)
30
+
- Configuration files in wrong locations
31
+
- Source files mixed with documentation/tests
32
+
- Invalid file extensions
33
+
- Duplicate or redundant files
34
+
- Empty directories with no purpose
35
+
36
+
## 4. Reorganization Principles
37
+
- **Minimal changes**: Only reorganize if clear benefit exists
38
+
- **Follow conventions**: Use standard patterns for the project type
39
+
- **Preserve build/config**: Don't break build scripts or configuration paths
40
+
- **Group similar files**: When many files of the same type need to be moved, use a single `move_files` action with a glob pattern instead of listing each file individually.
41
+
- **Move directories**: To move an entire directory, use `move_directory` action.
42
+
43
+
## 5. Repository Name Suggestions
44
+
- Based on the project type and purpose visible from the structure, suggest **up to 3 alternative names** that would better reflect the content.
45
+
- Provide suggestions only if the current name seems ambiguous or non‑standard.
46
+
47
+
# DECISION RULES
48
+
1. If structure is already good (score 4-5), return empty actions list
49
+
2. Only suggest moving files if they're clearly in wrong location
50
+
3. Always fix critical issues regardless of overall structure quality
51
+
4. Preserve build scripts and deployment configurations
52
+
5. Use `move_files` for bulk operations (e.g., all .png, all .sty) to keep the plan concise.
53
+
6. Use `move_directory` for moving whole folders (e.g., a dataset folder to data/).
54
+
55
+
# TASK
56
+
Analyze the repository and generate a JSON object with reorganization actions. If no changes are needed, return {{"actions": []}}. Optionally, suggest better repository names.
57
+
58
+
# RESPONSE FORMAT
59
+
Return ONLY valid JSON without any additional text.
"reason": "Move dataset folder under data/ for better organization"
85
+
}},
86
+
{{
87
+
"type": "move_file",
88
+
"source": "current/path/to/file.ext",
89
+
"destination": "new/path/to/file.ext",
90
+
"reason": "File belongs with similar functionality files"
91
+
}},
92
+
{{
93
+
"type": "delete_file",
94
+
"path": "path/to/obsolete/file.ext",
95
+
"reason": "Duplicate/obsolete file"
96
+
}},
97
+
{{
98
+
"type": "delete_directory",
99
+
"path": "path/to/empty/directory",
100
+
"reason": "Empty directory with no purpose"
101
+
}},
102
+
{{
103
+
"type": "create_file",
104
+
"path": "path/to/new/file.ext",
105
+
"content": "File content here",
106
+
"reason": "Missing essential project file"
107
+
}},
108
+
{{
109
+
"type": "rename_file",
110
+
"old_path": "current/path/to/file.ext",
111
+
"new_path": "new/path/to/file.ext",
112
+
"reason": "Incorrect file extension or naming"
113
+
}}
114
+
],
115
+
"suggested_names": [
116
+
"alternative_name_1",
117
+
"alternative_name_2",
118
+
"alternative_name_3"
119
+
]
120
+
}}
121
+
"""
122
+
123
+
validation_prompt = """
124
+
You are a senior software engineer validating repository reorganization plans.
125
+
126
+
# ORIGINAL REPOSITORY STRUCTURE
127
+
{tree_structure}
128
+
129
+
# PROPOSED REORGANIZATION PLAN
130
+
{proposed_plan}
131
+
132
+
# TASK
133
+
Validate the plan based only on structural information (file paths, names, extensions). If you find issues, return a corrected plan. The corrected plan must follow the same JSON format as the original plan. If the plan is already correct, return it unchanged.
134
+
135
+
# RESPONSE FORMAT
136
+
Return ONLY valid JSON without any additional text.
137
+
138
+
{{
139
+
"corrected_plan": {{
140
+
"analysis_summary": {{ ... }},
141
+
"actions": [ ... ],
142
+
"suggested_names": [ ... ]
143
+
}}
144
+
}}
145
+
"""
146
+
147
+
fix_prompt = """
148
+
You are an expert software engineer tasked with fixing compilation/syntax errors in a codebase. You will receive error output and the content of relevant files. Your goal is to produce corrected file content that resolves the errors.
149
+
150
+
# Project Type
151
+
{project_type}
152
+
153
+
# Error Output
154
+
{error_output}
155
+
156
+
157
+
# File Contents
158
+
{files_context}
159
+
160
+
# Instructions
161
+
- Analyze the errors and the provided file contents.
162
+
- For each file that needs changes, provide the corrected full content.
163
+
- Do not change unrelated parts of the code.
164
+
- Ensure your fixes are minimal and correct.
165
+
- Return a JSON object containing a list of fixes.
166
+
167
+
# Response Format
168
+
Return ONLY valid JSON without any additional text.
0 commit comments