mirror of
https://github.com/davidkaya/aryx.git
synced 2026-08-06 19:58:43 +02:00
feat: add tool-specific approval overrides
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -2,8 +2,10 @@ import { describe, expect, test } from 'bun:test';
|
||||
|
||||
import type { PatternDefinition } from '@shared/domain/pattern';
|
||||
import {
|
||||
applySessionApprovalSettings,
|
||||
applyScratchpadSessionConfig,
|
||||
createScratchpadSessionConfig,
|
||||
resolveSessionApprovalSettings,
|
||||
resolveSessionToolingSelection,
|
||||
resolveSessionTitle,
|
||||
resolveScratchpadSessionConfig,
|
||||
@@ -143,3 +145,30 @@ describe('session tooling helpers', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('session approval helpers', () => {
|
||||
test('normalizes session approval overrides and applies them over pattern defaults', () => {
|
||||
const pattern = {
|
||||
...createPattern(),
|
||||
approvalPolicy: {
|
||||
rules: [{ kind: 'tool-call' as const }],
|
||||
autoApprovedToolNames: ['git.status'],
|
||||
},
|
||||
};
|
||||
|
||||
expect(resolveSessionApprovalSettings(createSession())).toBeUndefined();
|
||||
expect(
|
||||
applySessionApprovalSettings(
|
||||
pattern,
|
||||
createSession({
|
||||
approvalSettings: {
|
||||
autoApprovedToolNames: ['git.diff', ' git.diff '],
|
||||
},
|
||||
}),
|
||||
).approvalPolicy,
|
||||
).toEqual({
|
||||
rules: [{ kind: 'tool-call' }],
|
||||
autoApprovedToolNames: ['git.diff'],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user