⚡ Zero-dependency plcbundle library exclusively for Bun
1/**
2 * Example detect function for filtering operations
3 *
4 * Usage:
5 * bun src/cli.ts detect --detect ./examples/detect.ts
6 */
7
8export function detect({ op }: { op: any }) {
9 const labels = [];
10
11 // Example: Detect test accounts
12 if (op.did.startsWith('did:plc:aa')) {
13 labels.push('test-account');
14 }
15
16 // Example: Detect by handle pattern
17 if (op.operation?.alsoKnownAs?.[0]?.includes('.test')) {
18 labels.push('test-handle');
19 }
20
21 // Example: Detect accounts created in 2024
22 if (op.createdAt?.match(/^\d{4}\-(03|06)/)) {
23 labels.push('created-march-june');
24 }
25
26 return labels;
27}