···11+/**
22+ * Example: Advanced detect function with multiple criteria
33+ *
44+ * Usage:
55+ * bun src/cli.ts detect --detect ./examples/detect-advanced.ts
66+ */
77+88+export function detect({ op }: { op: any }) {
99+ const labels = [];
1010+1111+ // Check for custom PDS
1212+ const pds = op.operation?.services?.atproto_pds?.endpoint;
1313+ if (pds && !pds.includes('bsky.social') && !pds.includes('bsky.network')) {
1414+ labels.push('custom-pds');
1515+ }
1616+1717+ // Check for multiple handles
1818+ if (op.operation?.alsoKnownAs?.length > 1) {
1919+ labels.push('multi-handle');
2020+ }
2121+2222+ // Check for rotation keys (security update)
2323+ if (op.operation?.rotationKeys) {
2424+ labels.push('rotation-keys');
2525+ }
2626+2727+ // Check for verification methods
2828+ const verificationMethods = op.operation?.verificationMethods;
2929+ if (verificationMethods && Object.keys(verificationMethods).length > 1) {
3030+ labels.push('multi-verification');
3131+ }
3232+3333+ // Detect by DID pattern
3434+ if (op.did.match(/^did:plc:[a-z]{24}$/)) {
3535+ labels.push('standard-did');
3636+ }
3737+3838+ return labels;
3939+}
+15
examples/detect.ts
···11+/**
22+ * Example detect function for use with plcbundle "detect" command
33+ */
44+55+export function detect({ op }: { op: any }) {
66+ const labels = [];
77+88+ if (op.did.startsWith('did:plc:aa')) {
99+ labels.push('test');
1010+ }
1111+1212+ // Add your custom detection logic here
1313+1414+ return labels;
1515+}
+22
examples/filter.ts
···11+/**
22+ * Example: Filter operations and export to JSONL
33+ *
44+ * Usage:
55+ * bun examples/filter.ts > filtered.jsonl
66+ */
77+88+import { PLCBundle } from '../src';
99+1010+const bundle = new PLCBundle('./data/bundles');
1111+1212+let matched = 0;
1313+1414+await bundle.processBundles(1, 10, (op) => {
1515+ // Filter: Only operations from 2024
1616+ if (op.createdAt.startsWith('2024')) {
1717+ console.log(JSON.stringify(op));
1818+ matched++;
1919+ }
2020+});
2121+2222+console.error(`\n✓ Filtered ${matched} operations`);