MCPcopy Index your code
hub / github.com/anus-dev/ANUS / shouldConfirmExecute

Method shouldConfirmExecute

packages/core/src/tools/shell.ts:71–96  ·  view source on GitHub ↗
(
    _abortSignal: AbortSignal,
  )

Source from the content-addressed store, hash-verified

69 }
70
71 override async shouldConfirmExecute(
72 _abortSignal: AbortSignal,
73 ): Promise<ToolCallConfirmationDetails | false> {
74 const command = stripShellWrapper(this.params.command);
75 const rootCommands = [...new Set(getCommandRoots(command))];
76 const commandsToConfirm = rootCommands.filter(
77 (command) => !this.allowlist.has(command),
78 );
79
80 if (commandsToConfirm.length === 0) {
81 return false; // already approved and whitelisted
82 }
83
84 const confirmationDetails: ToolExecuteConfirmationDetails = {
85 type: 'exec',
86 title: 'Confirm Shell Command',
87 command: this.params.command,
88 rootCommand: commandsToConfirm.join(', '),
89 onConfirm: async (outcome: ToolConfirmationOutcome) => {
90 if (outcome === ToolConfirmationOutcome.ProceedAlways) {
91 commandsToConfirm.forEach((command) => this.allowlist.add(command));
92 }
93 },
94 };
95 return confirmationDetails;
96 }
97
98 async execute(
99 signal: AbortSignal,

Callers

nothing calls this directly

Calls 3

stripShellWrapperFunction · 0.85
getCommandRootsFunction · 0.85
addMethod · 0.80

Tested by

no test coverage detected