skills.test.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { describe, expect, it } from 'bun:test';
  2. import { getSkillPermissionsForAgent } from './skills';
  3. describe('skills permissions', () => {
  4. it('should allow all skills for orchestrator by default', () => {
  5. const permissions = getSkillPermissionsForAgent('orchestrator');
  6. expect(permissions['*']).toBe('allow');
  7. });
  8. it('should deny all skills for other agents by default', () => {
  9. const permissions = getSkillPermissionsForAgent('designer');
  10. expect(permissions['*']).toBe('deny');
  11. });
  12. it('should allow recommended skills for specific agents', () => {
  13. // Designer should have agent-browser allowed
  14. const designerPerms = getSkillPermissionsForAgent('designer');
  15. expect(designerPerms['agent-browser']).toBe('allow');
  16. // Developer (orchestrator) should have simplify allowed (and everything else via *)
  17. const orchPerms = getSkillPermissionsForAgent('orchestrator');
  18. expect(orchPerms.simplify).toBe('allow');
  19. });
  20. it('should honor explicit skill list overrides', () => {
  21. // Override with empty list
  22. const emptyPerms = getSkillPermissionsForAgent('orchestrator', []);
  23. expect(emptyPerms['*']).toBe('deny');
  24. expect(Object.keys(emptyPerms).length).toBe(1);
  25. // Override with specific list
  26. const specificPerms = getSkillPermissionsForAgent('designer', [
  27. 'my-skill',
  28. '!bad-skill',
  29. ]);
  30. expect(specificPerms['*']).toBe('deny');
  31. expect(specificPerms['my-skill']).toBe('allow');
  32. expect(specificPerms['bad-skill']).toBe('deny');
  33. });
  34. it('should honor wildcard in explicit list', () => {
  35. const wildcardPerms = getSkillPermissionsForAgent('designer', ['*']);
  36. expect(wildcardPerms['*']).toBe('allow');
  37. });
  38. });