Summary
No mechanism exists to clean accumulated log files from the logs/ directory. Developers running npm run lint:all repeatedly accumulate stale JSON, XML, TXT, SARIF, and MD files with no way to reset. Add a clean:logs npm script.
Current Behavior
The logs/ directory grows indefinitely. After extended local development, ~45+ files accumulate. There is no npm run clean:logs or equivalent command.
Expected Behavior
Running npm run clean:logs removes all files from logs/ while preserving the directory itself.
Root Cause
No cleanup script was added when the logs/ directory was established as the standard output location for linting tools.
Files Requiring Changes
| File |
Change |
package.json |
Add clean:logs npm script |
Reproduction Steps
- Run
npm run lint:all several times locally.
- List the contents of
logs/ — ~45+ files of various formats accumulate.
- Search
package.json for a clean script — none exists.
Fix Guidance
Add to the scripts section of package.json:
"clean:logs": "pwsh -NoProfile -Command \"Get-ChildItem -Path logs -File -Recurse | Remove-Item -Force\""
This uses PowerShell consistent with all other pwsh-based npm scripts in the project. The -Recurse flag handles any nested files, and -File ensures the directory itself is preserved.
Unit Testing and Code Coverage Requirements
No Pester tests required — this is a package.json-only change. Manual verification: run npm run clean:logs and confirm logs/ is empty. Run again on an empty directory to confirm no errors.
RPI Framework Starter Prompts
Research Phase
Select Task Researcher from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Research the logs/ directory cleanup needs in hve-core. Investigate: (1) The current contents and file types in logs/ — list the directory and categorize files by format (JSON, XML, TXT, SARIF, MD). (2) Whether any scripts or CI workflows depend on specific files existing in logs/ before running. (3) How existing npm scripts are implemented in the codebase — search package.json for patterns with pwsh invocations. (4) Whether a .gitkeep or similar sentinel file exists in logs/. (5) Whether the PowerShell Remove-Item approach is consistent with other script invocations in package.json. (6) Check .gitignore to confirm logs/ is gitignored.
Plan Phase
Select Task Planner from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Plan the addition of a clean:logs npm script using the research document. The plan should cover: (1) Adding the npm script to package.json using PowerShell Get-ChildItem | Remove-Item pattern consistent with other pwsh-based npm scripts. (2) Deciding whether to preserve any sentinel files (.gitkeep) during cleanup. (3) Verifying the script handles an empty logs/ directory without errors. (4) Testing the script by running npm run clean:logs after npm run lint:all.
Implement Phase
Select Task Implementor from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Implement the clean:logs npm script following the plan. Steps: (1) Add "clean:logs": "pwsh -NoProfile -Command \"Get-ChildItem -Path logs -File -Recurse | Remove-Item -Force\"" to the scripts section of package.json. (2) Run npm run lint:all to populate logs/ with result files. (3) Run npm run clean:logs and verify all files are removed. (4) Run npm run clean:logs again on an empty directory to verify no errors. (5) Run npm run lint:ps to confirm no PSScriptAnalyzer issues introduced.
Review Phase
Select Task Reviewer from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Review the clean:logs npm script changes. Verify: (1) The script is added to package.json in alphabetical order within the scripts section. (2) The PowerShell command follows the same invocation pattern as other pwsh-based scripts (no -ExecutionPolicy, uses -NoProfile). (3) The script handles empty directories gracefully. (4) The script removes files recursively but preserves the logs/ directory itself. (5) No other package.json changes were introduced. (6) The logs/ directory is confirmed gitignored via .gitignore.
References
package.json — npm scripts section
logs/ — target directory (~45 accumulated files)
.gitignore — confirms [Ll]ogs/ is gitignored
Summary
No mechanism exists to clean accumulated log files from the
logs/directory. Developers runningnpm run lint:allrepeatedly accumulate stale JSON, XML, TXT, SARIF, and MD files with no way to reset. Add aclean:logsnpm script.Current Behavior
The
logs/directory grows indefinitely. After extended local development, ~45+ files accumulate. There is nonpm run clean:logsor equivalent command.Expected Behavior
Running
npm run clean:logsremoves all files fromlogs/while preserving the directory itself.Root Cause
No cleanup script was added when the
logs/directory was established as the standard output location for linting tools.Files Requiring Changes
package.jsonclean:logsnpm scriptReproduction Steps
npm run lint:allseveral times locally.logs/— ~45+ files of various formats accumulate.package.jsonfor acleanscript — none exists.Fix Guidance
Add to the
scriptssection ofpackage.json:This uses PowerShell consistent with all other pwsh-based npm scripts in the project. The
-Recurseflag handles any nested files, and-Fileensures the directory itself is preserved.Unit Testing and Code Coverage Requirements
No Pester tests required — this is a package.json-only change. Manual verification: run
npm run clean:logsand confirmlogs/is empty. Run again on an empty directory to confirm no errors.RPI Framework Starter Prompts
Research Phase
Select Task Researcher from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Plan Phase
Select Task Planner from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Implement Phase
Select Task Implementor from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Review Phase
Select Task Reviewer from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
References
package.json— npm scripts sectionlogs/— target directory (~45 accumulated files).gitignore— confirms[Ll]ogs/is gitignored