fix(atlas): match omo as a path segment

This commit is contained in:
YeonGyu-Kim
2026-05-16 17:52:28 +09:00
parent 63519ec563
commit 82ec099c3a
2 changed files with 17 additions and 1 deletions
+16
View File
@@ -0,0 +1,16 @@
import { describe, expect, test } from "bun:test"
import { isOmoPath } from "./omo-path"
describe("isOmoPath", () => {
test("#given a path under an omo directory #when checking the path #then it matches the omo segment", () => {
expect(isOmoPath(".omo/plans/work.md")).toBe(true)
expect(isOmoPath("/repo/.omo/plans/work.md")).toBe(true)
expect(isOmoPath(String.raw`C:\repo\.omo\plans\work.md`)).toBe(true)
})
test("#given a path whose directory merely ends with omo #when checking the path #then it does not match", () => {
expect(isOmoPath("/repo/work.omo/plans/work.md")).toBe(false)
expect(isOmoPath("/repo/.omo-backup/plans/work.md")).toBe(false)
expect(isOmoPath("/repo/notes.omo")).toBe(false)
})
})
+1 -1
View File
@@ -4,5 +4,5 @@
* Uses path segment matching instead of substring matching.
*/
export function isOmoPath(filePath: string): boolean {
return /\.omo[/\\]/.test(filePath)
return /(^|[/\\])\.omo([/\\]|$)/.test(filePath)
}