mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
* feat: add schedule permission config and workspace tracking Adds permission configuration for scheduled jobs (migration 016) and workspace ID tracking on schedule runs (migration 017). Includes service logic, UI controls, schema updates, and full test coverage. * refactor: convert permission ruleset to object format, exclude active schedule worktrees from sibling repos * refine: reduce destructive bash patterns to host-level commands only
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { DEFAULT_DESTRUCTIVE_BASH_PATTERNS, buildSchedulePermissionRuleset } from '@opencode-manager/shared/schemas'
|
|
|
|
describe('buildSchedulePermissionRuleset', () => {
|
|
it('returns the allow-all baseline with default deny rules when given null', () => {
|
|
const result = buildSchedulePermissionRuleset(null)
|
|
|
|
expect(result['*']).toBe('allow')
|
|
expect(result.external_directory).toBe('deny')
|
|
for (const pattern of DEFAULT_DESTRUCTIVE_BASH_PATTERNS) {
|
|
expect(result.bash?.[pattern]).toBe('deny')
|
|
}
|
|
})
|
|
|
|
it('returns only the allow-all baseline when all permissions are granted', () => {
|
|
const result = buildSchedulePermissionRuleset({ allowExternalDirectory: true, bashDenyPatterns: [] })
|
|
|
|
expect(result).toEqual({ '*': 'allow' })
|
|
})
|
|
|
|
it('includes a single custom bash deny pattern alongside external_directory deny', () => {
|
|
const result = buildSchedulePermissionRuleset({ allowExternalDirectory: false, bashDenyPatterns: ['rm -rf *'] })
|
|
|
|
expect(result).toEqual({
|
|
'*': 'allow',
|
|
external_directory: 'deny',
|
|
bash: { 'rm -rf *': 'deny' },
|
|
})
|
|
})
|
|
})
|