Lines 1653-1693javascript
1653function nestedShellStartupTargetUncertain(tokens) {
1654 const executable = shellExecutable(tokens[0]);
1655 if (['csh', 'elvish', 'fish', 'nu', 'tcsh'].includes(executable)) return true;
1656 for (let index = 1; index < tokens.length; index++) {
1657 const option = tokens[index];
1658 if (option === '--' || option === '-c') break;
1659 if (/^-[^-]*c/.test(option)) {
1660 return /^-[^-]*[il]/.test(option);
1662 if (['--init-file', '--rcfile'].includes(option)
1663 || option.startsWith('--init-file=')
1664 || option.startsWith('--rcfile=')) return true;
1665 if (option === '-C' && executable === 'fish') return true;
1666 if (/^-[^-]*[il]/.test(option)) return true;
1667 if (['-O', '-o'].includes(option)) index += 1;
1668 else if (!option.startsWith('-')) break;
1673function nestedShellArgumentCommitInvocation(tokens, payload, initialCwd) {
1674 if (!/(?:^|[^A-Za-z0-9_])eval(?:[^A-Za-z0-9_]|$)|\$(?:[@*]|[1-9][0-9]*)/.test(payload)) {
1675 return null;
LowEval
Package source references a known benign dynamic code generation pattern.
src/hook.mjsView on unpkg · L1673 1677 const payloadIndex = tokens.indexOf(payload);
1678 if (payloadIndex < 0 || payloadIndex === tokens.length - 1) return null;
1679 return literalCommitDetails(tokens.slice(payloadIndex + 1).join(' '), initialCwd);
1682// Shell nesting, pipelines, background jobs, and command substitution change
1683// cwd/execution scope in ways a non-executing parser cannot prove. A commit in
1684// such a command is denied by the agent guard and can be retried as a direct
1685// Git command, while ordinary `a && b`/`a || b` chains remain supported.
1686function hasUncertainShellSyntax(command) {
1688 let escaped = false;
1689 for (let i = 0; i < command.length; i++) {
1690 const char = command[i];