From 82ec099c3a8132c28564e89fd91ca29e2e9759b2 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sat, 16 May 2026 17:52:28 +0900 Subject: [PATCH] fix(atlas): match omo as a path segment --- src/hooks/atlas/omo-path.test.ts | 16 ++++++++++++++++ src/hooks/atlas/omo-path.ts | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/hooks/atlas/omo-path.test.ts diff --git a/src/hooks/atlas/omo-path.test.ts b/src/hooks/atlas/omo-path.test.ts new file mode 100644 index 000000000..95bd14bd3 --- /dev/null +++ b/src/hooks/atlas/omo-path.test.ts @@ -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) + }) +}) diff --git a/src/hooks/atlas/omo-path.ts b/src/hooks/atlas/omo-path.ts index 035879428..1b7d2cccc 100644 --- a/src/hooks/atlas/omo-path.ts +++ b/src/hooks/atlas/omo-path.ts @@ -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) }