
























@@ -60,12 +60,13 @@ describe("ensureSkillsWatcher", () => {
60606161expect(watchMock).toHaveBeenCalledTimes(1);
6262const firstCall = (
63-watchMock.mock.calls as unknown as Array<[string[], { ignored?: unknown }]>
63+watchMock.mock.calls as unknown as Array<[string[], { depth?: number; ignored?: unknown }]>
6464)[0];
6565const targets = firstCall?.[0] ?? [];
6666const opts = firstCall?.[1] ?? {};
67676868expect(opts.ignored).toBe(refreshModule.shouldIgnoreSkillsWatchPath);
69+expect(opts.depth).toBe(2);
6970const posix = (p: string) => p.replaceAll("\\", "/");
7071expect(targets).toEqual(
7172expect.arrayContaining([
@@ -100,6 +101,34 @@ describe("ensureSkillsWatcher", () => {
100101expect(ignored("/tmp/workspace/skills/my-skill/SKILL.md", {})).toBe(false);
101102});
102103104+it("keeps grouped skill folders within the watcher traversal depth", async () => {
105+vi.useFakeTimers();
106+const seen: SkillsChangeEvent[] = [];
107+refreshModule.registerSkillsChangeListener((change) => {
108+seen.push(change);
109+});
110+refreshModule.ensureSkillsWatcher({
111+workspaceDir: "/tmp/workspace",
112+config: { skills: { load: { watchDebounceMs: 10 } } },
113+});
114+115+const firstCall = (
116+watchMock.mock.calls as unknown as Array<[string[], { depth?: number; ignored?: unknown }]>
117+)[0];
118+expect(firstCall?.[1]?.depth).toBe(2);
119+120+createdWatchers[0]?.emit("change", "/tmp/workspace/skills/group/demo/SKILL.md");
121+await vi.advanceTimersByTimeAsync(10);
122+123+expect(seen).toEqual([
124+{
125+workspaceDir: "/tmp/workspace",
126+reason: "watch",
127+changedPath: "/tmp/workspace/skills/group/demo/SKILL.md",
128+},
129+]);
130+});
131+103132it.each(["add", "change", "unlink", "unlinkDir"] as const)(
104133"refreshes skills snapshots on %s",
105134async (event) => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。