Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(ok): reveal global skills in Finder (PRD-7831) (#3264)

tim-inkeepbb418ca89513
diff --git a/.changeset/lucky-pears-repeat.md b/.changeset/lucky-pears-repeat.md
new file mode 100644
index 000000000..a286c3b1f
--- /dev/null
+++ b/.changeset/lucky-pears-repeat.md
@@ -0,0 +1,6 @@
+---
+'@inkeep/open-knowledge-desktop': patch
+'@inkeep/open-knowledge-core': patch
+---
+
+Fix "Reveal in Finder" for global skills and skill bundle folders. Global skills live outside every project (`~/.claude/skills`, `~/.agents/skills`, the plugin caches, `~/.ok/skills`), so the desktop's path containment silently refused every reveal from the Skills panel. Those roots are now admitted the same way the bug-report dir is. Nested bundle folders (`scripts/`, `references/`) also gain the Reveal item their sibling file rows already had.
diff --git a/packages/app/src/components/EditorTabTargetMenuItems.tsx b/packages/app/src/components/EditorTabTargetMenuItems.tsx
index 5b3257d0e..29a24ec3d 100644
--- a/packages/app/src/components/EditorTabTargetMenuItems.tsx
+++ b/packages/app/src/components/EditorTabTargetMenuItems.tsx
@@ -36,6 +36,7 @@ import {
emitFileTreeMenuActionDuplicate,
emitFileTreeMenuActionImportTemplate,
} from '@/lib/file-tree-menu-action-events';
+import { revealInFileManagerLabel } from '@/lib/reveal-label';
import { scheduleClipboardWrite } from '@/lib/share/clipboard-adapter';
import {
buildDocShareInput,
@@ -148,9 +149,7 @@ export function EditorTabTargetMenuItems({
});
}
- let revealLabel = t`Open containing folder`;
- if (bridge?.platform === 'darwin') revealLabel = t`Reveal in Finder`;
- else if (bridge?.platform === 'win32') revealLabel = t`Reveal in File Explorer`;
+ const revealLabel = revealInFileManagerLabel(bridge?.platform ?? 'linux');
const noWorkspaceHint = workspace ? null : t`No workspace`;
const fullPath = workspace
? joinWorkspacePath(workspace.contentDir, relativePath, workspace.pathSeparator)
diff --git a/packages/app/src/components/FileTree.tsx b/packages/app/src/components/FileTree.tsx
index f89be1b3b..49818e424 100644
--- a/packages/app/src/components/FileTree.tsx
+++ b/packages/app/src/components/FileTree.tsx
@@ -202,6 +202,7 @@ import {
import { importTemplate } from '@/lib/folder-config-api';
import { isOverlayLayerOpen } from '@/lib/overlay-layers';
import { parseServerResponse, parseSuccessOrWarn } from '@/lib/parse-server-response';
+import { revealInFileManagerLabel } from '@/lib/reveal-label';
import { scheduleClipboardWrite } from '@/lib/share/clipboard-adapter';
import {
buildDocShareInput,
@@ -467,18 +468,6 @@ interface WorkspaceInfo {
pathSeparator: '/' | '\\';
}
-/**
- * Platform-specific label for the file-manager reveal action. Mirrors VS Code's copy.
- * Linux verb asymmetry (Open vs Reveal) is intentional — no stable Linux file-manager
- * brand to "Reveal in"; a normalizing fix to "Reveal in Files" would be incorrect on
- * most distros.
- */
-function revealInFileManagerLabel(platform: 'darwin' | 'win32' | 'linux'): string {
- if (platform === 'darwin') return t`Reveal in Finder`;
- if (platform === 'win32') return t`Reveal in File Explorer`;
- return t`Open containing folder`;
-}
-
const DROPDOWN_FILE_TARGET_MENU_PRIMITIVES = {
Item: DropdownMenuItem,
Separator: DropdownMenuSeparator,
diff --git a/packages/app/src/components/SkillRevealMenuItem.dom.test.tsx b/packages/app/src/components/SkillRevealMenuItem.dom.test.tsx
new file mode 100644
index 000000000..252f95b6c
--- /dev/null
+++ b/packages/app/src/components/SkillRevealMenuItem.dom.test.tsx
@@ -0,0 +1,91 @@
+/**
+ * `SkillRevealMenuItem` is the single reveal row behind every skills menu
+ * surface (skill row, SKILL.md, bundle files, bundle folders), so its two gates
+ * and its label are load-bearing for all of them at once: dropping the
+ * `!bridge` guard throws on non-desktop hosts, dropping the `!absolutePath`
+ * guard renders a row whose click reveals `undefined`, and hardcoding the macOS
+ * label mislabels the shipping Windows and Linux desktops.
+ */
+
+import { render, screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuTrigger,
+} from '@/components/ui/dropdown-menu';
+import * as linguiShim from '../../tests/lingui-macro-shim';
+
+vi.doMock('@lingui/react/macro', () => linguiShim);
+
+const showItemInFolder = vi.fn();
+
+function setBridge(platform: 'darwin' | 'win32' | 'linux' | null) {
+ if (platform === null) {
+ Reflect.deleteProperty(window, 'okDesktop');
+ return;
+ }
+ Object.defineProperty(window, 'okDesktop', {
+ configurable: true,
+ value: { platform, shell: { showItemInFolder } },
+ });
+}
+
+async function renderItem(absolutePath: string | undefined) {
+ const { SkillRevealMenuItem } = await import('./skill-actions');
+ render(
+ <DropdownMenu open>
+ <DropdownMenuTrigger />
+ <DropdownMenuContent>
+ <SkillRevealMenuItem absolutePath={absolutePath} />
+ </DropdownMenuContent>
+ </DropdownMenu>,
+ );
+}
+
+describe('SkillRevealMenuItem', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ setBridge('darwin');
+ });
+
+ afterEach(() => {
+ setBridge(null);
+ });
+
+ test('reveals the given path when clicked', async () => {
+ await renderItem('/Users/tester/.claude/skills/demo/SKILL.md');
+
+ await userEvent.click(screen.getByText('Reveal in Finder'));
+
+ expect(showItemInFolder).toHaveBeenCalledWith('/Users/tester/.claude/skills/demo/SKILL.md');
+ });
+
+ test('renders nothing when the path is unknown', async () => {
+ await renderItem(undefined);
+
+ expect(screen.queryByText('Reveal in Finder')).toBeNull();
+ expect(showItemInFolder).not.toHaveBeenCalled();
+ });
+
+ test('renders nothing off desktop, where there is no bridge to reveal through', async () => {
+ setBridge(null);
+ await renderItem('/Users/tester/.claude/skills/demo/SKILL.md');
+
+ expect(screen.queryByText('Reveal in Finder')).toBeNull();
+ });
+
+ test('names the platform file manager rather than always saying Finder', async () => {
+ setBridge('win32');
+ await renderItem('C:\\Users\\tester\\.claude\\skills\\demo\\SKILL.md');
+ expect(screen.getByText('Reveal in File Explorer')).toBeTruthy();
+ expect(screen.queryByText('Reveal in Finder')).toBeNull();
+ });
+
+ test('uses the neutral Linux verb — no stable file-manager brand to reveal in', async () => {
+ setBridge('linux');
+ await renderItem('/home/tester/.claude/skills/demo/SKILL.md');
+ expect(screen.getByText('Open containing folder')).toBeTruthy();
+ });
+});
diff --git a/packages/app/src/components/SkillsTree.tsx b/packages/app/src/components/SkillsTree.tsx
index 0df68fcfa..d0a22351d 100644
--- a/packages/app/src/components/SkillsTree.tsx
+++ b/packages/app/src/components/SkillsTree.tsx
@@ -34,6 +34,7 @@ import {
type SkillActions,
SkillContextMenuItems,
SkillFileContextMenuItems,
+ SkillRevealMenuItem,
} from '@/components/skill-actions';
import {
applyInstallClusters,
@@ -692,14 +693,25 @@ export function SkillsTree({
/>
);
} else if (node.isDir) {
- // Every bundle dir offers New file seeded with its own path.
+ // Every bundle dir offers New file seeded with its own path,
+ // plus the same Reveal its sibling file rows carry — a nested
+ // folder is the one row kind that could not be opened on disk.
// `node.sub` is non-null here (the null case is handled above).
menuItems = (
- <DropdownMenuItem
- onSelect={() => actions.requestFileCreate(skill, `${node.sub}/`)}
- >
- <Trans>New file</Trans>
- </DropdownMenuItem>
+ <>
+ <SkillRevealMenuItem
+ absolutePath={
+ skill.absolutePath
+ ? `${skillDir(skill.absolutePath)}/${node.sub}`
+ : undefined
+ }
+ />
+ <DropdownMenuItem
+ onSelect={() => actions.requestFileCreate(skill, `${node.sub}/`)}
+ >
+ <Trans>New file</Trans>
+ </DropdownMenuItem>
+ </>
);
} else {
menuItems = (
diff --git a/packages/app/src/components/skill-actions.tsx b/packages/app/src/components/skill-actions.tsx
index aa234d757..99600cb85 100644
--- a/packages/app/src/components/skill-actions.tsx
+++ b/packages/app/src/components/skill-actions.tsx
@@ -55,6 +55,7 @@ import {
SkillMenuSubTrigger,
} from '@/components/skill-menu-primitives';
import { useOpenSkill } from '@/hooks/use-open-skill';
+import { revealInFileManagerLabel } from '@/lib/reveal-label';
import { scheduleClipboardWrite } from '@/lib/share/clipboard-adapter';
import { skillDir, useSkillScopeLabels } from '@/lib/skill-scope';
import { convertSkillLocation, duplicateSkill, installSkill } from '@/lib/skills-api';
@@ -339,6 +340,33 @@ export function useSkillActions(): SkillActions {
const EMPTY_NAME_SET: ReadonlySet<string> = new Set();
+/**
+ * Reveal one on-disk skill path in the OS file manager. Renders nothing off
+ * desktop or when the path is unknown. Shared by every skills menu so the row
+ * kinds cannot disagree about when reveal is offered, and labelled through the
+ * same per-platform helper the file tree and editor tabs use — desktop ships on
+ * Windows and Linux, where "Reveal in Finder" is wrong.
+ */
+export function SkillRevealMenuItem({
+ absolutePath,
+ menuKind = 'dropdown',
+}: {
+ absolutePath: string | undefined;
+ menuKind?: SkillMenuKind;
+}) {
+ const bridge = typeof window !== 'undefined' ? window.okDesktop : undefined;
+ if (!bridge || !absolutePath) return null;
+ return (
+ <SkillMenuItem
+ menuKind={menuKind}
+ onSelect={() => void bridge.shell.showItemInFolder(absolutePath)}
+ >
+ <FolderOpen aria-hidden />
+ {revealInFileManagerLabel(bridge.platform)}
+ </SkillMenuItem>
+ );
+}
+
/**
* File actions shared by bundle-file rows in the Skills sidebar and editor tabs.
* Paths resolve from the skill directory rather than from its SKILL.md entry.
@@ -355,7 +383,6 @@ export function SkillFileContextMenuItems({
menuKind?: SkillMenuKind;
}) {
const { t } = useLingui();
- const bridge = typeof window !== 'undefined' ? window.okDesktop : undefined;
const absoluteFile = skill.absolutePath
? `${skillDir(skill.absolutePath)}/${filePath}`
: undefined;
@@ -380,15 +407,7 @@ export function SkillFileContextMenuItems({
<PencilLine aria-hidden />
<Trans>Rename</Trans>
</SkillMenuItem>
- {bridge && absoluteFile ? (
- <SkillMenuItem
- menuKind={menuKind}
- onSelect={() => void bridge.shell.showItemInFolder(absoluteFile)}
- >
- <FolderOpen aria-hidden />
- <Trans>Reveal in Finder</Trans>
- </SkillMenuItem>
- ) : null}
+ <SkillRevealMenuItem absolutePath={absoluteFile} menuKind={menuKind} />
<SkillMenuSub menuKind={menuKind}>
<SkillMenuSubTrigger menuKind={menuKind}>
<Copy aria-hidden />
@@ -491,7 +510,6 @@ function SkillTargetMenuItems({
const { t } = useLingui();
const scopeLabels = useSkillScopeLabels();
const hostToggles = useSkillHostToggles(skill, actions);
- const bridge = typeof window !== 'undefined' ? window.okDesktop : undefined;
const absolutePath = skill.absolutePath;
async function copy(text: string) {
@@ -506,15 +524,7 @@ function SkillTargetMenuItems({
return (
<>
<SkillMenuGroup menuKind={menuKind}>
- {bridge && absolutePath ? (
- <SkillMenuItem
- menuKind={menuKind}
- onSelect={() => void bridge.shell.showItemInFolder(absolutePath)}
- >
- <FolderOpen aria-hidden />
- <Trans>Reveal in Finder</Trans>
- </SkillMenuItem>
- ) : null}
+ <SkillRevealMenuItem absolutePath={absolutePath} menuKind={menuKind} />
{openWithAi}
<SkillMenuSub menuKind={menuKind}>
<SkillMenuSubTrigger menuKind={menuKind}>
diff --git a/packages/app/src/lib/reveal-label.ts b/packages/app/src/lib/reveal-label.ts
new file mode 100644
index 000000000..13cff27ec
--- /dev/null
+++ b/packages/app/src/lib/reveal-label.ts
@@ -0,0 +1,18 @@
+import { t } from '@lingui/core/macro';
+
+/**
+ * Platform-specific label for the file-manager reveal action. Mirrors VS Code's copy.
+ * Linux verb asymmetry (Open vs Reveal) is intentional — no stable Linux file-manager
+ * brand to "Reveal in"; a normalizing fix to "Reveal in Files" would be incorrect on
+ * most distros.
+ *
+ * Shared by every reveal surface (file tree rows, editor tabs, skills menus) so a
+ * Windows or Linux user never sees one menu say "Finder" and its sibling say the
+ * right thing. `t` resolves at call time against the active locale, so this must be
+ * called per render rather than hoisted to a module constant.
+ */
+export function revealInFileManagerLabel(platform: 'darwin' | 'win32' | 'linux'): string {
+ if (platform === 'darwin') return t`Reveal in Finder`;
+ if (platform === 'win32') return t`Reveal in File Explorer`;
+ return t`Open containing folder`;
+}
diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.po
index fd2c2ad7d..65902ca59 100644
--- a/packages/app/src/locales/en/messages.po
+++ b/packages/app/src/locales/en/messages.po
@@ -7556,8 +7556,7 @@ msgstr "Open CodeMirror's lint diagnostics panel."
msgid "Open comment"
msgstr "Open comment"
-#: src/components/EditorTabTargetMenuItems.tsx
-#: src/components/FileTree.tsx
+#: src/lib/reveal-label.ts
msgid "Open containing folder"
msgstr "Open containing folder"
@@ -9119,18 +9118,15 @@ msgstr "Reuse one tab when clicking through the sidebars. Off opens every click
msgid "Reused if it already exists, created if not."
msgstr "Reused if it already exists, created if not."
-#: src/components/EditorTabTargetMenuItems.tsx
-#: src/components/FileTree.tsx
+#: src/lib/reveal-label.ts
msgid "Reveal in File Explorer"
msgstr "Reveal in File Explorer"
#: src/components/BugReportHistory.tsx
#: src/components/command-palette-commands.ts
-#: src/components/EditorTabTargetMenuItems.tsx
#: src/components/FileSidebar.tsx
-#: src/components/FileTree.tsx
#: src/components/ReportBugDialogBody.tsx
-#: src/components/skill-actions.tsx
+#: src/lib/reveal-label.ts
msgid "Reveal in Finder"
msgstr "Reveal in Finder"
diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.po
index a5b192b19..27059879b 100644
--- a/packages/app/src/locales/pseudo/messages.po
+++ b/packages/app/src/locales/pseudo/messages.po
@@ -7552,8 +7552,7 @@ msgstr ""
msgid "Open comment"
msgstr ""
-#: src/components/EditorTabTargetMenuItems.tsx
-#: src/components/FileTree.tsx
+#: src/lib/reveal-label.ts
msgid "Open containing folder"
msgstr ""
@@ -9115,18 +9114,15 @@ msgstr ""
msgid "Reused if it already exists, created if not."
msgstr ""
-#: src/components/EditorTabTargetMenuItems.tsx
-#: src/components/FileTree.tsx
+#: src/lib/reveal-label.ts
msgid "Reveal in File Explorer"
msgstr ""
#: src/components/BugReportHistory.tsx
#: src/components/command-palette-commands.ts
-#: src/components/EditorTabTargetMenuItems.tsx
#: src/components/FileSidebar.tsx
-#: src/components/FileTree.tsx
#: src/components/ReportBugDialogBody.tsx
-#: src/components/skill-actions.tsx
+#: src/lib/reveal-label.ts
msgid "Reveal in Finder"
msgstr ""
diff --git a/packages/core/src/skills-catalog/harness-homes.test.ts b/packages/core/src/skills-catalog/harness-homes.test.ts
index fc35863d6..a9f41a759 100644
--- a/packages/core/src/skills-catalog/harness-homes.test.ts
+++ b/packages/core/src/skills-catalog/harness-homes.test.ts
@@ -1,6 +1,6 @@
-import { join } from 'node:path';
+import { join, sep } from 'node:path';
import { describe, expect, test } from 'vitest';
-import { projectHarnessHomes } from './harness-homes.ts';
+import { harnessHomes, projectHarnessHomes, userGlobalSkillRoots } from './harness-homes.ts';
describe('projectHarnessHomes', () => {
test('uses project roots for hosts whose user and project layouts differ', () => {
@@ -21,3 +21,30 @@ describe('projectHarnessHomes', () => {
expect(harnesses).not.toContain('claude-desktop');
});
});
+
+describe('userGlobalSkillRoots', () => {
+ test('covers every harness home plus the `.ok/skills` store', () => {
+ const home = '/Users/tester';
+ const roots = userGlobalSkillRoots(home);
+
+ for (const { dir } of harnessHomes(home)) expect(roots).toContain(dir);
+ // The loop above shrinks with the production function, so it would pass
+ // vacuously if a root were dropped. These spell out the whole expected set
+ // independently — one per source: the store, an editor dir, the vendor-
+ // neutral hub, and the plugin-provider cache.
+ expect(roots).toContain(join(home, '.ok', 'skills'));
+ expect(roots).toContain(join(home, '.claude', 'skills'));
+ expect(roots).toContain(join(home, '.agents', 'skills'));
+ expect(roots).toContain(join(home, '.claude', 'plugins'));
+ });
+
+ test('stays under the given home — it is a containment allowlist, not a home pass', () => {
+ const home = '/Users/tester';
+ for (const root of userGlobalSkillRoots(home)) {
+ // `sep`, not a literal '/': the function builds paths with `join`, so a
+ // POSIX-only assertion would be false on win32 (a shipping desktop target).
+ expect(root.startsWith(`${home}${sep}`)).toBe(true);
+ expect(root).not.toBe(home);
+ }
+ });
+});
diff --git a/packages/core/src/skills-catalog/harness-homes.ts b/packages/core/src/skills-catalog/harness-homes.ts
index 1e9b3ee1a..5d1d9154b 100644
--- a/packages/core/src/skills-catalog/harness-homes.ts
+++ b/packages/core/src/skills-catalog/harness-homes.ts
@@ -66,6 +66,17 @@ export function harnessHomes(home: string = homedir()): HarnessHome[] {
];
}
+/**
+ * Every user-global directory a skill can legitimately live in: the harness
+ * homes plus the `~/.ok/skills` store. Each segment is home-derived and
+ * constant — nothing here comes from a caller — which is what lets the desktop
+ * admit them as reveal roots without widening path containment to the whole
+ * home dir.
+ */
+export function userGlobalSkillRoots(home: string = homedir()): string[] {
+ return [...harnessHomes(home).map((h) => h.dir), join(home, '.ok', 'skills')];
+}
+
/**
* The PROJECT-scoped harness skill dirs — `<projectDir>/.<harness>/skills` for
* every harness that keeps a bare project skill-dir layout. Derived from
diff --git a/packages/core/src/skills-catalog/index.ts b/packages/core/src/skills-catalog/index.ts
index 6bd8a43ce..f0e3b6cce 100644
--- a/packages/core/src/skills-catalog/index.ts
+++ b/packages/core/src/skills-catalog/index.ts
@@ -67,7 +67,7 @@ export {
enumerateInstalledSkills,
type InstalledSkillsResult,
} from './enumerate.ts';
-export { harnessHomes } from './harness-homes.ts';
+export { harnessHomes, userGlobalSkillRoots } from './harness-homes.ts';
export {
SKILL_IMPORT_MAX_BUNDLE_FILES,
SKILL_IMPORT_MAX_FILE_BYTES,
diff --git a/packages/desktop/src/main/index.ts b/packages/desktop/src/main/index.ts
index 5db2570d5..6a70bd43a 100644
--- a/packages/desktop/src/main/index.ts
+++ b/packages/desktop/src/main/index.ts
@@ -278,6 +278,7 @@ import {
import {
detectProtocol as detectProtocolImpl,
recordHandoff as recordHandoffImpl,
+ revealAllowedRoots,
showItemInFolder as showItemInFolderImpl,
spawnCursor as spawnCursorImpl,
trashItem as trashItemImpl,
@@ -4642,11 +4643,7 @@ function registerIpcHandlers() {
{
platform: process.platform,
projectPath: callerProjectPath,
- // The bug-report zip lives in `~/.ok/bug-reports/`, outside every
- // project, so the review/failure card's Reveal would otherwise be
- // refused (`out-of-project`, or `no-project-bound` from a Navigator
- // window). This dir is main-derived, not renderer-influenced.
- allowedRoots: [dirname(defaultBugReportZipPath())],
+ allowedRoots: revealAllowedRoots(),
showItemInFolder: (p) => shell.showItemInFolder(p),
},
path,
diff --git a/packages/desktop/src/main/ipc-handlers.showItemInFolder.test.ts b/packages/desktop/src/main/ipc-handlers.showItemInFolder.test.ts
index 3b46868f5..011ef42ed 100644
--- a/packages/desktop/src/main/ipc-handlers.showItemInFolder.test.ts
+++ b/packages/desktop/src/main/ipc-handlers.showItemInFolder.test.ts
@@ -10,12 +10,57 @@
* Navigator window hit `no-project-bound`.
*/
+import { homedir } from 'node:os';
import { join } from 'node:path';
+import { userGlobalSkillRoots } from '@inkeep/open-knowledge-core/skills-catalog';
import { describe, expect, test } from 'vitest';
-import { showItemInFolder } from './ipc-handlers.ts';
+import { revealAllowedRoots, showItemInFolder } from './ipc-handlers.ts';
+const HOME = '/Users/tester';
const BUG_REPORTS = '/Users/tester/.ok/bug-reports';
const PROJECT = '/Users/tester/projects/demo';
+/** The roots main passes for skill reveals — same derivation as `main/index.ts`. */
+const SKILL_ROOTS = userGlobalSkillRoots(HOME);
+
+/**
+ * The POLICY the handler feeds its predicate. Asserted independently of the
+ * predicate because the main-process wiring is not reachable from tests: with
+ * the roots built inline at the call site, dropping them was a silent no-op
+ * that every predicate test still passed.
+ */
+describe('revealAllowedRoots — the policy the reveal handler passes in', () => {
+ test('carries the bug-report dir and every user-global skill root', () => {
+ const roots = revealAllowedRoots();
+ const home = homedir();
+
+ expect(roots).toContain(join(home, '.ok', 'bug-reports'));
+ // Spelled out rather than derived from `userGlobalSkillRoots`: an assertion
+ // built from the function under test shrinks with it and passes vacuously.
+ expect(roots).toContain(join(home, '.claude', 'skills'));
+ expect(roots).toContain(join(home, '.agents', 'skills'));
+ expect(roots).toContain(join(home, '.claude', 'plugins'));
+ expect(roots).toContain(join(home, '.ok', 'skills'));
+ });
+
+ test('admits a real global skill path and still refuses a sibling home dir', () => {
+ const home = homedir();
+ const reveal = (p: string) =>
+ showItemInFolder(
+ {
+ platform: process.platform,
+ projectPath: join(home, 'projects', 'demo'),
+ allowedRoots: revealAllowedRoots(),
+ showItemInFolder: () => {},
+ },
+ p,
+ );
+
+ expect(reveal(join(home, '.claude', 'skills', 'build-ok-dmg', 'SKILL.md'))).toEqual({
+ ok: true,
+ });
+ expect(reveal(join(home, '.ssh', 'id_rsa'))).toEqual({ ok: false, reason: 'out-of-project' });
+ });
+});
describe('showItemInFolder — allowedRoots for bug-report zips', () => {
test('editor window (project bound) reveals a bug-report zip via allowedRoots', () => {
@@ -92,6 +137,55 @@ describe('showItemInFolder — allowedRoots for bug-report zips', () => {
expect(revealed).toEqual([]);
});
+ test('a global skill in a harness home is revealed via allowedRoots', () => {
+ // Regression guard: global skills live outside every project, so before
+ // their roots joined `allowedRoots` the Skills panel's Reveal rendered but
+ // did nothing for every one of them.
+ const skillMd = join(SKILL_ROOTS[0] ?? '', 'migrate-to-codex', 'SKILL.md');
+ const revealed: string[] = [];
+ const outcome = showItemInFolder(
+ {
+ platform: 'darwin',
+ projectPath: PROJECT,
+ allowedRoots: [BUG_REPORTS, ...SKILL_ROOTS],
+ showItemInFolder: (p) => revealed.push(p),
+ },
+ skillMd,
+ );
+ expect(outcome).toEqual({ ok: true });
+ expect(revealed).toEqual([skillMd]);
+ });
+
+ test('every user-global skill root is admitted', () => {
+ for (const root of SKILL_ROOTS) {
+ const dir = join(root, 'some-skill', 'references');
+ expect(
+ showItemInFolder(
+ {
+ platform: 'darwin',
+ projectPath: PROJECT,
+ allowedRoots: [BUG_REPORTS, ...SKILL_ROOTS],
+ showItemInFolder: () => {},
+ },
+ dir,
+ ),
+ ).toEqual({ ok: true });
+ }
+ });
+
+ test('a non-skill path in the same home is still refused', () => {
+ const outcome = showItemInFolder(
+ {
+ platform: 'darwin',
+ projectPath: PROJECT,
+ allowedRoots: [BUG_REPORTS, ...SKILL_ROOTS],
+ showItemInFolder: () => {},
+ },
+ '/Users/tester/.ssh/id_rsa',
+ );
+ expect(outcome).toEqual({ ok: false, reason: 'out-of-project' });
+ });
+
test('Navigator window with no project and no allowedRoots refuses', () => {
const revealed: string[] = [];
const outcome = showItemInFolder(
diff --git a/packages/desktop/src/main/ipc-handlers.ts b/packages/desktop/src/main/ipc-handlers.ts
index 1072a38f4..52e22f90d 100644
--- a/packages/desktop/src/main/ipc-handlers.ts
+++ b/packages/desktop/src/main/ipc-handlers.ts
@@ -11,6 +11,8 @@
import { execFile } from 'node:child_process';
import { join } from 'node:path';
+import { okBugReportsDir } from '@inkeep/open-knowledge';
+import { userGlobalSkillRoots } from '@inkeep/open-knowledge-core/skills-catalog';
import {
createOsProbe,
type ExecFileLike,
@@ -274,6 +276,21 @@ type ShowItemInFolderOutcome =
| { ok: true }
| { ok: false; reason: 'invalid-format' | 'no-project-bound' | 'out-of-project' };
+/**
+ * The trusted roots a reveal may target besides the caller window's project:
+ * the bug-report zip dir, plus every user-global skill dir (harness homes,
+ * plugin caches, the `.ok/skills` store). Both classes are main-derived from
+ * the home dir with no renderer influence.
+ *
+ * This is the POLICY that feeds `showItemInFolder`'s predicate, and it lives
+ * beside that predicate deliberately: the main-process handler wiring is not
+ * reachable from tests, so a policy expressed inline at the call site could
+ * silently lose a root without any test going red.
+ */
+export function revealAllowedRoots(): string[] {
+ return [okBugReportsDir(), ...userGlobalSkillRoots()];
+}
+
/** Injected deps for `showItemInFolder` — the electron `shell.showItemInFolder` and platform/projectPath. */
interface ShowItemInFolderDeps {
readonly platform: NodeJS.Platform;