Tool to send cross-session opencode messages, including as request-response pattern
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

implement glob pattern matching for dir filter

rektide 264a9b51 07931a3d

+16 -1
+16 -1
cli.ts
··· 36 36 }; 37 37 } 38 38 39 + function matchesPattern(sessionDir: string, pattern: string): boolean { 40 + const hasWildcard = pattern.includes("*"); 41 + 42 + if (!hasWildcard) { 43 + return sessionDir === pattern; 44 + } 45 + 46 + const regexPattern = pattern 47 + .replace(/\*/g, ".*") 48 + .replace(/\?/g, "."); 49 + const regex = new RegExp(`^${regexPattern}$`); 50 + 51 + return regex.test(sessionDir); 52 + } 53 + 39 54 async function listSessions(dir?: string): Promise<Session[]> { 40 55 const storagePath = await getOpenCodeStoragePath(); 41 56 const sessionPath = join(storagePath, "session"); ··· 62 77 const content = await readFile(sessionFilePath, "utf-8"); 63 78 const session: Session = JSON.parse(content); 64 79 65 - if (dir && !session.directory.includes(dir)) continue; 80 + if (dir && !matchesPattern(session.directory, dir)) continue; 66 81 67 82 sessions.push(session); 68 83 }