context-pattern-matching.yaml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. id: example-context-pattern-matching
  2. name: "Example: Context Pattern Matching"
  3. description: |
  4. Demonstrates how pattern matching works for expectedContextFiles.
  5. This test uses THREE different patterns that all match the same file:
  6. 1. Just filename: "code.md"
  7. 2. Partial path: "standards/code.md"
  8. 3. Full path: ".opencode/context/core/standards/code.md"
  9. All three will match if the agent reads:
  10. .opencode/context/core/standards/code.md
  11. The evaluator uses:
  12. - actualFile.includes(expectedPattern) OR
  13. - actualFile.endsWith(expectedPattern)
  14. So any of these patterns will work!
  15. category: developer
  16. prompts:
  17. - text: |
  18. What are the coding standards for this project?
  19. approvalStrategy:
  20. type: auto-approve
  21. behavior:
  22. mustUseAnyOf:
  23. - [read]
  24. - [glob, read]
  25. requiresContext: true
  26. # All three patterns match the same file!
  27. expectedContextFiles:
  28. - code.md # endsWith match
  29. - standards/code.md # includes match
  30. - .opencode/context/core/standards/code.md # includes match (full path)
  31. expectedViolations:
  32. - rule: context-loading
  33. shouldViolate: false
  34. severity: error
  35. timeout: 90000
  36. tags:
  37. - example
  38. - context-loading
  39. - pattern-matching