remove debug
This commit is contained in:
@@ -8259,3 +8259,292 @@ There should also be a small operation to purge empty folders at the end.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
_**Agent (model default, mode Agent)**_
|
||||||
|
|
||||||
|
|
||||||
|
Adding a function to remove empty folders at the end of the script. Checking the end of the script:
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="read" data-tool-name="read_file_v2">
|
||||||
|
<details><summary>Tool use: **read_file_v2** • Read file: a:\1 Amazon_Active_Projects\3 ProjectStructure\organize_textures.ps1</summary>
|
||||||
|
|
||||||
|
</details>
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="read" data-tool-name="read_file_v2">
|
||||||
|
<details><summary>Tool use: **read_file_v2** • Read file: a:\1 Amazon_Active_Projects\3 ProjectStructure\organize_textures.ps1</summary>
|
||||||
|
|
||||||
|
</details>
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
Adding a function to remove empty folders and calling it at the end. Checking where the helper functions are defined:
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="read" data-tool-name="read_file_v2">
|
||||||
|
<details><summary>Tool use: **read_file_v2** • Read file: a:\1 Amazon_Active_Projects\3 ProjectStructure\organize_textures.ps1</summary>
|
||||||
|
|
||||||
|
</details>
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
Adding a function to remove empty folders and calling it at the end:
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="read" data-tool-name="read_file_v2">
|
||||||
|
<details><summary>Tool use: **read_file_v2** • Read file: a:\1 Amazon_Active_Projects\3 ProjectStructure\organize_textures.ps1</summary>
|
||||||
|
|
||||||
|
</details>
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
Adding a function to remove empty folders after the helper functions, then calling it at the end:
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="unknown" data-tool-name="edit_file_v2">
|
||||||
|
<details>
|
||||||
|
<summary>Tool use: **edit_file_v2**</summary>
|
||||||
|
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"relativeWorkspacePath": "a:\\1 Amazon_Active_Projects\\3 ProjectStructure\\organize_textures.ps1"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Additional data:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"codeblockId": "5ad7abd3-af49-44de-8265-ffa35a44e317"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Status: **completed**
|
||||||
|
|
||||||
|
|
||||||
|
</details>
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
Added a function to remove empty folders at the end of the script. It:
|
||||||
|
|
||||||
|
1. **Recursively processes folders** from the bottom up (subdirectories first)
|
||||||
|
2. **Checks if each folder is empty** after processing its subdirectories
|
||||||
|
3. **Removes empty folders** (except the root texture folder)
|
||||||
|
4. **Reports the count** of removed folders
|
||||||
|
|
||||||
|
This runs after all file organization is complete, cleaning up empty folders left after moving files and deleting duplicates. The script will show how many empty folders were removed.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
_**User**_
|
||||||
|
|
||||||
|
@pwsh (265-1075) excellent, let's remove debug.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
_**Agent (model default, mode Agent)**_
|
||||||
|
|
||||||
|
|
||||||
|
Removing all debug output. Searching for debug statements:
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="unknown" data-tool-name="ripgrep_raw_search">
|
||||||
|
<details>
|
||||||
|
<summary>Tool use: **ripgrep_raw_search**</summary>
|
||||||
|
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"pattern": "\\[DEBUG\\]",
|
||||||
|
"path": "a:\\1 Amazon_Active_Projects\\3 ProjectStructure\\organize_textures.ps1",
|
||||||
|
"caseInsensitive": false
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Result:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": {
|
||||||
|
"pattern": "\\[DEBUG\\]",
|
||||||
|
"path": "a:\\1 Amazon_Active_Projects\\3 ProjectStructure\\organize_textures.ps1",
|
||||||
|
"outputMode": "content",
|
||||||
|
"workspaceResults": {
|
||||||
|
"a:\\1 Amazon_Active_Projects\\3 ProjectStructure": {
|
||||||
|
"content": {
|
||||||
|
"matches": [
|
||||||
|
{
|
||||||
|
"file": "organize_textures.ps1",
|
||||||
|
"matches": [
|
||||||
|
{
|
||||||
|
"lineNumber": 172,
|
||||||
|
"content": " Write-Host \" [DEBUG] StripPrefix enabled for group with $($Files.Count) file(s)\" -ForegroundColor Magenta"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"lineNumber": 176,
|
||||||
|
"content": " Write-Host \" [DEBUG] Original: '$($firstFile.Name)' -> Stripped: '$strippedName'\" -ForegroundColor Gray"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"lineNumber": 182,
|
||||||
|
"content": " Write-Host \" [DEBUG] Using stripped name: '$fileName'\" -ForegroundColor Green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"lineNumber": 184,
|
||||||
|
"content": " Write-Host \" [DEBUG] No prefix found, keeping original: '$fileName'\" -ForegroundColor Yellow"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"lineNumber": 197,
|
||||||
|
"content": " Write-Host \" [DEBUG] All suffixes: $($allSuffixes -join ', ')\" -ForegroundColor Gray"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"lineNumber": 203,
|
||||||
|
"content": " Write-Host \" [DEBUG] All files share common suffix, using: '$fileName'\" -ForegroundColor Green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"lineNumber": 207,
|
||||||
|
"content": " Write-Host \" [DEBUG] Final filename: '$fileName'\" -ForegroundColor Cyan"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"totalLines": 7,
|
||||||
|
"totalMatchedLines": 7
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Status: **completed**
|
||||||
|
|
||||||
|
|
||||||
|
</details>
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
Reading the section with debug statements to remove them:
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="read" data-tool-name="read_file_v2">
|
||||||
|
<details><summary>Tool use: **read_file_v2** • Read file: a:\1 Amazon_Active_Projects\3 ProjectStructure\organize_textures.ps1</summary>
|
||||||
|
|
||||||
|
</details>
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
Removing all debug statements:
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="unknown" data-tool-name="edit_file_v2">
|
||||||
|
<details>
|
||||||
|
<summary>Tool use: **edit_file_v2**</summary>
|
||||||
|
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"relativeWorkspacePath": "a:\\1 Amazon_Active_Projects\\3 ProjectStructure\\organize_textures.ps1"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Additional data:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"codeblockId": "bc2633e5-4947-44a4-b04c-2129bf7ebe97"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Status: **completed**
|
||||||
|
|
||||||
|
|
||||||
|
</details>
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
Verifying all debug statements are removed:
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="unknown" data-tool-name="ripgrep_raw_search">
|
||||||
|
<details>
|
||||||
|
<summary>Tool use: **ripgrep_raw_search**</summary>
|
||||||
|
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"pattern": "\\[DEBUG\\]",
|
||||||
|
"path": "a:\\1 Amazon_Active_Projects\\3 ProjectStructure\\organize_textures.ps1",
|
||||||
|
"caseInsensitive": false
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Result:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": {
|
||||||
|
"pattern": "\\[DEBUG\\]",
|
||||||
|
"path": "a:\\1 Amazon_Active_Projects\\3 ProjectStructure\\organize_textures.ps1",
|
||||||
|
"outputMode": "content",
|
||||||
|
"workspaceResults": {
|
||||||
|
"a:\\1 Amazon_Active_Projects\\3 ProjectStructure": {
|
||||||
|
"content": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Status: **completed**
|
||||||
|
|
||||||
|
|
||||||
|
</details>
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
Removed all debug statements. The script will run without debug output and only show the main progress messages.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -169,19 +169,13 @@ function Process-DuplicateGroup {
|
|||||||
|
|
||||||
# If StripPrefix is enabled, always strip prefix from the filename
|
# If StripPrefix is enabled, always strip prefix from the filename
|
||||||
if ($StripPrefix) {
|
if ($StripPrefix) {
|
||||||
Write-Host " [DEBUG] StripPrefix enabled for group with $($Files.Count) file(s)" -ForegroundColor Magenta
|
|
||||||
# Always try to strip prefix - if file has a prefix, it will be removed
|
# Always try to strip prefix - if file has a prefix, it will be removed
|
||||||
$strippedName = Get-FileNameWithoutPrefix -FileName $firstFile.Name -ValidPrefixes $ValidPrefixes
|
$strippedName = Get-FileNameWithoutPrefix -FileName $firstFile.Name -ValidPrefixes $ValidPrefixes
|
||||||
|
|
||||||
Write-Host " [DEBUG] Original: '$($firstFile.Name)' -> Stripped: '$strippedName'" -ForegroundColor Gray
|
|
||||||
|
|
||||||
# Use stripped name if it's different from original (prefix was removed)
|
# Use stripped name if it's different from original (prefix was removed)
|
||||||
# Otherwise keep original (file had no prefix to strip)
|
# Otherwise keep original (file had no prefix to strip)
|
||||||
if ($strippedName -ne $firstFile.Name) {
|
if ($strippedName -ne $firstFile.Name) {
|
||||||
$fileName = $strippedName
|
$fileName = $strippedName
|
||||||
Write-Host " [DEBUG] Using stripped name: '$fileName'" -ForegroundColor Green
|
|
||||||
} else {
|
|
||||||
Write-Host " [DEBUG] No prefix found, keeping original: '$fileName'" -ForegroundColor Yellow
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# If we have multiple files with same checksum, try to find common suffix
|
# If we have multiple files with same checksum, try to find common suffix
|
||||||
@@ -194,17 +188,12 @@ function Process-DuplicateGroup {
|
|||||||
$allSuffixes += $suffix
|
$allSuffixes += $suffix
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host " [DEBUG] All suffixes: $($allSuffixes -join ', ')" -ForegroundColor Gray
|
|
||||||
|
|
||||||
# If all files strip to the same suffix, use that
|
# If all files strip to the same suffix, use that
|
||||||
$uniqueSuffixes = @($allSuffixes | Select-Object -Unique)
|
$uniqueSuffixes = @($allSuffixes | Select-Object -Unique)
|
||||||
if ($uniqueSuffixes.Count -eq 1 -and $uniqueSuffixes[0] -ne $firstFile.Name) {
|
if ($uniqueSuffixes.Count -eq 1 -and $uniqueSuffixes[0] -ne $firstFile.Name) {
|
||||||
$fileName = [string]$uniqueSuffixes[0]
|
$fileName = [string]$uniqueSuffixes[0]
|
||||||
Write-Host " [DEBUG] All files share common suffix, using: '$fileName'" -ForegroundColor Green
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host " [DEBUG] Final filename: '$fileName'" -ForegroundColor Cyan
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ensure fileName is never null or empty
|
# Ensure fileName is never null or empty
|
||||||
|
|||||||
Reference in New Issue
Block a user