-
Notifications
You must be signed in to change notification settings - Fork 125
Description
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:allseveral times locally. - List the contents of
logs/— ~45+ files of various formats accumulate. - Search
package.jsonfor acleanscript — 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 inlogs/— 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 inlogs/before running. (3) How existing npm scripts are implemented in the codebase — searchpackage.jsonfor patterns with pwsh invocations. (4) Whether a.gitkeepor similar sentinel file exists inlogs/. (5) Whether the PowerShellRemove-Itemapproach is consistent with other script invocations in package.json. (6) Check.gitignoreto confirmlogs/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:logsnpm script using the research document. The plan should cover: (1) Adding the npm script topackage.jsonusing PowerShellGet-ChildItem | Remove-Itempattern consistent with other pwsh-based npm scripts. (2) Deciding whether to preserve any sentinel files (.gitkeep) during cleanup. (3) Verifying the script handles an emptylogs/directory without errors. (4) Testing the script by runningnpm run clean:logsafternpm 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:logsnpm script following the plan. Steps: (1) Add"clean:logs": "pwsh -NoProfile -Command \"Get-ChildItem -Path logs -File -Recurse | Remove-Item -Force\""to thescriptssection ofpackage.json. (2) Runnpm run lint:allto populatelogs/with result files. (3) Runnpm run clean:logsand verify all files are removed. (4) Runnpm run clean:logsagain on an empty directory to verify no errors. (5) Runnpm run lint:psto 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:logsnpm script changes. Verify: (1) The script is added topackage.jsonin 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 thelogs/directory itself. (5) No other package.json changes were introduced. (6) Thelogs/directory is confirmed gitignored via.gitignore.
References
package.json— npm scripts sectionlogs/— target directory (~45 accumulated files).gitignore— confirms[Ll]ogs/is gitignored