The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
fix: scan piped foreach grouping blocks
Dante306c21772993
diff --git a/scripts/lib/powershell-destructive-command.js b/scripts/lib/powershell-destructive-command.jsindex 8fad906a5..c5b90d048 100644--- a/scripts/lib/powershell-destructive-command.js+++ b/scripts/lib/powershell-destructive-command.js@@ -428,6 +428,7 @@ function invokesContainerResult(prefix, options = {}) {const pipelineStart = clause.lastIndexOf('|');const pipelineCommand = clause.slice(pipelineStart + 1).trim();const isForeachLoopHeader = Boolean(options.groupingExpression) &&+ pipelineStart === -1 &&/^foreach$/i.test(pipelineCommand);return /(?:^|\s)(?:&|\.)\s*$/.test(clause) ||/\.\s*(?:foreach|where)\s*$/i.test(clause) ||diff --git a/tests/lib/powershell-destructive-command.test.js b/tests/lib/powershell-destructive-command.test.jsindex cd023a3c1..e4f7210ba 100644--- a/tests/lib/powershell-destructive-command.test.js+++ b/tests/lib/powershell-destructive-command.test.js@@ -488,6 +488,9 @@ test('distinguishes foreach statements from the pipeline alias', () => {expectRules('1 | foreach { Remove-Item -Force C:/tmp/demo }', [RULES.REMOVE_FORCE,]);+ expectRules('1 | foreach ({ Remove-Item -Force C:/tmp/demo })', [+ RULES.REMOVE_FORCE,+ ]);});test('classifies invoked static script-block variables but leaves assignments inert', () => {