@koinzhang/paseo-plugin-customize 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +5 -3
- package/client/dropdown.tsx +1 -1
- package/client/entry-card.tsx +1 -1
- package/client/entry-row.tsx +1 -1
- package/client/mechanism-card.tsx +1 -1
- package/client/preview-pane.tsx +1 -1
- package/client/screen-id.ts +2 -0
- package/client/sidebar-item.tsx +14 -0
- package/client/slash-command.test.ts +1 -1
- package/client/slash-command.ts +3 -2
- package/client/surface.tsx +5 -13
- package/client/translations.test.ts +30 -0
- package/client/translations.ts +12 -0
- package/client/ui.tsx +1 -1
- package/client/use-app-language.ts +5 -21
- package/client/web.ts +0 -76
- package/client/workspace-root.test.ts +40 -0
- package/client/workspace-root.ts +7 -0
- package/index.client.tsx +16 -21
- package/package.json +2 -2
- package/paseo-plugin.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,24 @@ All notable changes to `@koinzhang/paseo-plugin-customize` are documented in thi
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.4.1] - 2026-11-26
|
|
9
|
+
|
|
10
|
+
Requires Paseo **>= 0.17.4**.
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Align the development SDK and its client/protocol peers with Paseo 0.17.4; the minimum supported host is now 0.17.4.
|
|
15
|
+
- Resolve the last workspace's project through the public SDK workspace handle instead of plugin-owned pagination with a 21-page cutoff. Keep the existing query cache and project fallback.
|
|
16
|
+
- Use Paseo's public SDK language subscription and translated command labels instead of polling private browser settings and re-registering commands. The board now follows the app language on native as well as web; existing wording, selections, and scan caches are unchanged.
|
|
17
|
+
|
|
18
|
+
## [0.4.0] - 2026-11-05
|
|
19
|
+
|
|
20
|
+
Requires Paseo **>= 0.15.0**.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- Align with Paseo 0.15: the Customize board is a screen with a sidebar header row (replacing the deprecated `addSurface` / `addSidebarItem`), `/customize` and the Command Center item open it through `openScreen`, and UI components import from `@getpaseo/plugin/client/ui`.
|
|
25
|
+
|
|
8
26
|
## [0.3.0] - 2026-09-28
|
|
9
27
|
|
|
10
28
|
Requires Paseo **>= 0.9.0**.
|
|
@@ -30,6 +48,8 @@ Requires Paseo **>= 0.9.0**.
|
|
|
30
48
|
- The Rescan icon in the toolbar now matches the search, chevron, and mechanism icons at 14 px.
|
|
31
49
|
- Entry icons in list rows and cards are 14 px and centered with the title; the view toggle no longer shows a hover tooltip.
|
|
32
50
|
|
|
51
|
+
[0.4.1]: https://github.com/koinzhang/paseo-plugins/releases/tag/customize-v0.4.1
|
|
52
|
+
[0.4.0]: https://github.com/koinzhang/paseo-plugins/releases/tag/customize-v0.4.0
|
|
33
53
|
[0.3.0]: https://github.com/koinzhang/paseo-plugins/releases/tag/customize-v0.3.0
|
|
34
54
|
|
|
35
55
|
## [0.2.1] - 2026-09-28
|
package/README.md
CHANGED
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
One board that scans local agent configuration for a project: **instructions** (AGENTS.md, CLAUDE.md …), **rules**, **skills**, **MCP servers**, **commands**, **subagents**, and **plugins** at project and user level.
|
|
4
4
|
|
|
5
|
-
Requires Paseo >= 0.
|
|
5
|
+
Requires Paseo >= 0.17.4. Development uses `@getpaseo/plugin` 0.17.4 with matching client/protocol peers.
|
|
6
6
|
|
|
7
7
|
## What you get
|
|
8
8
|
|
|
9
9
|
- A **Customize** item in the sidebar's top navigation (next to New workspace, History, Search, Schedules) and in the Command Center opens the board.
|
|
10
10
|
- Submit `/customize` in an agent composer to open the board. It selects the agent's Provider and workspace Project when available, updating each independently and keeping the current selection for any unavailable value.
|
|
11
|
+
- Board and command text follow Paseo's current app language on web and native, using the public SDK language subscription instead of polling private browser settings. Switching language keeps the board selection and scan cache.
|
|
12
|
+
- The remembered workspace's project is resolved through the SDK workspace handle; Customize no longer duplicates workspace pagination or stops searching after 21 pages. The web route bridge remains because screens do not expose the active workspace.
|
|
11
13
|
- Top-right **Provider** and **Project** pickers. The Provider menu lists enabled Paseo providers that Customize can scan, including Cursor, Cline, CodeBuddy Code, Gemini CLI, Goose, Grok Build, Kilo Code, Kiro CLI, Kimi Code, Qwen Code, and TraeCode CLI. It groups Built-in providers above ACP ones, each group sorted by name and separated by a divider, and marks each option as Built-in or ACP. Choices persist on the Paseo host; before a project is chosen, it defaults to the workspace you were last on. The Project menu lists every Paseo project.
|
|
12
|
-
- Tabs for Instructions / Rules / Skills / MCP / Commands / Subagents / Plugins. Each tab starts with a "how it loads" note for that provider and then **Project** and **User** sections grouped by source directory.
|
|
14
|
+
- Tabs for the categories the selected provider supports — Instructions / Rules / Skills / MCP / Commands / Subagents / Plugins. Each tab starts with a "how it loads" note for that provider and then **Project** and **User** sections grouped by source directory.
|
|
13
15
|
- On Skills, a switch beside search shows all skills, automatic skills (Auto and Conditional), or manual-only skills. Disabled and not-loaded skills stay under All. The choice stays on the page and is not saved with Provider or Project.
|
|
14
16
|
- Entries can be shown as a list or as a responsive card grid. The toggle to the right of the search field switches views (grid icon = card view, list icon = list view). Cards carry the same name, status, description, path/reason, token estimate, and Agent Plugins badge, reflow from one to three columns with the panel width, and open the same preview pane. The choice is saved on the Paseo host together with Provider and Project.
|
|
15
17
|
- A link icon to the left of Provider marks agents that search shared skill directories; providers without compatibility support show no icon. Cursor's icon follows its local `thirdPartyExtensibilityEnabled` IDE setting; OpenCode's follows its external-skill environment flags. The icon and skill explanation update on the next scan when those settings change.
|
|
@@ -46,7 +48,7 @@ Per-provider mechanisms and their sources are recorded in [`specs/001-customize-
|
|
|
46
48
|
## Install
|
|
47
49
|
|
|
48
50
|
```bash
|
|
49
|
-
paseo plugin add koinzhang/paseo-plugins
|
|
51
|
+
paseo plugin add github:koinzhang/paseo-plugins:customize
|
|
50
52
|
```
|
|
51
53
|
|
|
52
54
|
## Development
|
package/client/dropdown.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Icon } from "@getpaseo/plugin/client/
|
|
1
|
+
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
2
2
|
import { Fragment, useState, type ReactNode } from "react";
|
|
3
3
|
import { Platform, Pressable, ScrollView, Text, View } from "react-native";
|
|
4
4
|
import { CONTROL, FONT_WEIGHT, ICON_SIZE, MENU, RADIUS, TEXT } from "./design-tokens.ts";
|
package/client/entry-card.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Icon } from "@getpaseo/plugin/client/
|
|
1
|
+
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
2
2
|
import { memo, type ReactNode } from "react";
|
|
3
3
|
import { Pressable, Text, View } from "react-native";
|
|
4
4
|
import type { Entry } from "../shared/contracts.ts";
|
package/client/entry-row.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Icon } from "@getpaseo/plugin/client/
|
|
1
|
+
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
2
2
|
import { memo, type ReactNode } from "react";
|
|
3
3
|
import { Pressable, Text, View } from "react-native";
|
|
4
4
|
import type { Category, Entry } from "../shared/contracts.ts";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Icon } from "@getpaseo/plugin/client/
|
|
1
|
+
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
2
2
|
import { useState, type ReactNode } from "react";
|
|
3
3
|
import { Platform, Pressable, ScrollView, Text, View } from "react-native";
|
|
4
4
|
import type { Mechanism } from "../shared/mechanisms.ts";
|
package/client/preview-pane.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { openExternalUrl, useRpc } from "@getpaseo/plugin/client";
|
|
2
|
-
import { ScrollView, copyText, useToast } from "@getpaseo/plugin/client/
|
|
2
|
+
import { ScrollView, copyText, useToast } from "@getpaseo/plugin/client/ui";
|
|
3
3
|
import { useQuery } from "@tanstack/react-query";
|
|
4
4
|
import type { ReactNode } from "react";
|
|
5
5
|
import { Text, View } from "react-native";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PluginSidebarItemProps } from "@getpaseo/plugin/client";
|
|
2
|
+
import { SidebarRow } from "@getpaseo/plugin/client/ui";
|
|
3
|
+
import { CUSTOMIZE_SCREEN_ID } from "./screen-id.ts";
|
|
4
|
+
|
|
5
|
+
/** Sidebar header row that opens the Customize screen. */
|
|
6
|
+
export function CustomizeSidebarItem({ currentScreen, openScreen }: PluginSidebarItemProps) {
|
|
7
|
+
return (
|
|
8
|
+
<SidebarRow
|
|
9
|
+
icon="FolderCog"
|
|
10
|
+
active={currentScreen?.screenId === CUSTOMIZE_SCREEN_ID}
|
|
11
|
+
onPress={() => openScreen({ screenId: CUSTOMIZE_SCREEN_ID })}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -9,7 +9,7 @@ function commandContext(provider: string, projectRootPath: string, rpc: (name: s
|
|
|
9
9
|
agent: { provider },
|
|
10
10
|
workspace: { projectRootPath },
|
|
11
11
|
rpc: (contract: { name: string }, input: unknown) => rpc(contract.name, input),
|
|
12
|
-
|
|
12
|
+
openScreen: (input: { screenId: string }) => opened.push(input.screenId),
|
|
13
13
|
} as unknown as PluginAgentCommandContext;
|
|
14
14
|
return { context, opened };
|
|
15
15
|
}
|
package/client/slash-command.ts
CHANGED
|
@@ -2,11 +2,12 @@ import { settingsRpc } from "@getpaseo/plugin";
|
|
|
2
2
|
import type { PluginAgentCommandContext } from "@getpaseo/plugin/client";
|
|
3
3
|
import { isProviderId } from "../shared/providers.ts";
|
|
4
4
|
import { selectionSettings } from "../shared/selection-settings.ts";
|
|
5
|
+
import { CUSTOMIZE_SCREEN_ID } from "./screen-id.ts";
|
|
5
6
|
|
|
6
7
|
const { read, write } = settingsRpc(selectionSettings.id);
|
|
7
8
|
|
|
8
9
|
/** Navigate even if the current agent cannot supply a usable board selection. */
|
|
9
|
-
export async function openCustomizeFromAgent({ agent, workspace, rpc,
|
|
10
|
+
export async function openCustomizeFromAgent({ agent, workspace, rpc, openScreen }: PluginAgentCommandContext): Promise<void> {
|
|
10
11
|
const provider = isProviderId(agent.provider) ? agent.provider : null;
|
|
11
12
|
const projectRoot = workspace.projectRootPath?.trim() ? workspace.projectRootPath : null;
|
|
12
13
|
try {
|
|
@@ -31,6 +32,6 @@ export async function openCustomizeFromAgent({ agent, workspace, rpc, openSurfac
|
|
|
31
32
|
}
|
|
32
33
|
throw new Error("Customize selection changed concurrently; try again");
|
|
33
34
|
} finally {
|
|
34
|
-
|
|
35
|
+
openScreen({ screenId: CUSTOMIZE_SCREEN_ID });
|
|
35
36
|
}
|
|
36
37
|
}
|
package/client/surface.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { Icon, ScrollView, TextInput } from "@getpaseo/plugin/client/
|
|
1
|
+
import { type PluginScreenProps, usePaseo, useRpc, useSettings } from "@getpaseo/plugin/client";
|
|
2
|
+
import { Icon, ScrollView, TextInput } from "@getpaseo/plugin/client/ui";
|
|
3
3
|
import { useQuery } from "@tanstack/react-query";
|
|
4
4
|
import { useCallback, useEffect, useMemo, useState, type ReactNode } from "react";
|
|
5
5
|
import { Platform, Text, View } from "react-native";
|
|
@@ -22,12 +22,12 @@ import { newestScan, REVISIT_QUERY_POLICY, SCAN_QUERY_POLICY, shouldScanSnapshot
|
|
|
22
22
|
import { CategoryTabs, ErrorState, IconButton, InlineEmpty, LoadingState, SectionHeader, SegmentedControl } from "./ui.tsx";
|
|
23
23
|
import { useAppLanguage } from "./use-app-language.ts";
|
|
24
24
|
import { readLastWorkspaceId } from "./web.ts";
|
|
25
|
+
import { loadWorkspaceProjectRoot } from "./workspace-root.ts";
|
|
25
26
|
|
|
26
27
|
const NO_PROJECT = "";
|
|
27
|
-
const WORKSPACE_PAGE_LIMIT = 200;
|
|
28
28
|
|
|
29
29
|
/** Sidebar surface; an unselected project defaults to the last workspace. */
|
|
30
|
-
export function CustomizeSurface({ theme, layout }:
|
|
30
|
+
export function CustomizeSurface({ theme, layout }: PluginScreenProps): ReactNode {
|
|
31
31
|
const colors = theme.colors;
|
|
32
32
|
const compact = layout.compact;
|
|
33
33
|
const page = pageLayout(compact);
|
|
@@ -57,15 +57,7 @@ export function CustomizeSurface({ theme, layout }: PluginSurfaceProps): ReactNo
|
|
|
57
57
|
enabled: workspaceId !== null,
|
|
58
58
|
staleTime: 60_000,
|
|
59
59
|
...REVISIT_QUERY_POLICY,
|
|
60
|
-
queryFn:
|
|
61
|
-
let page = await paseo.workspaces.list({ page: { limit: WORKSPACE_PAGE_LIMIT } });
|
|
62
|
-
for (let pages = 0; ; pages++) {
|
|
63
|
-
const hit = page.entries.find((workspace) => workspace.id === workspaceId);
|
|
64
|
-
if (hit) return hit.projectRootPath;
|
|
65
|
-
if (!page.pageInfo.hasMore || !page.pageInfo.nextCursor || pages >= 20) return null;
|
|
66
|
-
page = await paseo.workspaces.list({ page: { limit: WORKSPACE_PAGE_LIMIT, cursor: page.pageInfo.nextCursor } });
|
|
67
|
-
}
|
|
68
|
-
},
|
|
60
|
+
queryFn: () => loadWorkspaceProjectRoot(paseo, workspaceId),
|
|
69
61
|
});
|
|
70
62
|
const workspaceRoot = lastWorkspace.data ?? null;
|
|
71
63
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { test } from "node:test";
|
|
3
|
+
import { messagesFor, resolveAppLanguage } from "../shared/i18n.ts";
|
|
4
|
+
import { customizeTranslations } from "./translations.ts";
|
|
5
|
+
|
|
6
|
+
test("SDK command resources preserve Customize titles and slash descriptions", () => {
|
|
7
|
+
for (const locale of ["en", "zh-CN"] as const) {
|
|
8
|
+
const messages = messagesFor(locale);
|
|
9
|
+
assert.deepEqual(customizeTranslations.resources[locale], {
|
|
10
|
+
title: messages.title,
|
|
11
|
+
openBoard: messages.openBoard,
|
|
12
|
+
});
|
|
13
|
+
assert.equal(messages.title, "Customize");
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test("command labels are immutable SDK messages rather than a captured language string", () => {
|
|
18
|
+
for (const key of ["title", "openBoard"] as const) {
|
|
19
|
+
const message = customizeTranslations.message(key);
|
|
20
|
+
assert.equal(typeof message, "object");
|
|
21
|
+
assert.equal(Object.isFrozen(message), true);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("resolved host locales keep the existing board catalog and English fallback", () => {
|
|
26
|
+
assert.equal(resolveAppLanguage("zh-CN"), "zh-CN");
|
|
27
|
+
assert.equal(resolveAppLanguage("zh-Hans-CN"), "zh-CN");
|
|
28
|
+
assert.equal(resolveAppLanguage("en-US"), "en");
|
|
29
|
+
assert.equal(resolveAppLanguage("fr-FR"), "en");
|
|
30
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineTranslations } from "@getpaseo/plugin/client";
|
|
2
|
+
import { messagesFor } from "../shared/i18n.ts";
|
|
3
|
+
|
|
4
|
+
const english = messagesFor("en");
|
|
5
|
+
const chinese = messagesFor("zh-CN");
|
|
6
|
+
|
|
7
|
+
export const customizeTranslations = defineTranslations({
|
|
8
|
+
resources: {
|
|
9
|
+
en: { title: english.title, openBoard: english.openBoard },
|
|
10
|
+
"zh-CN": { title: chinese.title, openBoard: chinese.openBoard },
|
|
11
|
+
},
|
|
12
|
+
});
|
package/client/ui.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Icon } from "@getpaseo/plugin/client/
|
|
1
|
+
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
2
2
|
import { useState, type ReactNode } from "react";
|
|
3
3
|
import { ActivityIndicator, Pressable, Text, View, type StyleProp, type ViewStyle } from "react-native";
|
|
4
4
|
import type { Status } from "../shared/contracts.ts";
|
|
@@ -1,28 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { readAppLanguage, subscribeAppLanguage } from "./web.ts";
|
|
1
|
+
import { useTranslation } from "@getpaseo/plugin/client";
|
|
2
|
+
import { messagesFor, resolveAppLanguage, type AppLanguage, type Messages } from "../shared/i18n.ts";
|
|
3
|
+
import { customizeTranslations } from "./translations.ts";
|
|
5
4
|
|
|
6
|
-
const defaultLanguage = (): AppLanguage => "en";
|
|
7
|
-
const noSubscription = () => () => {};
|
|
8
|
-
|
|
9
|
-
/** Paseo app language (Settings → Language, `system` → OS preference); `en` off web. */
|
|
10
5
|
export function useAppLanguage(): AppLanguage {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
Platform.OS === "web" ? readAppLanguage : defaultLanguage,
|
|
14
|
-
defaultLanguage,
|
|
15
|
-
);
|
|
6
|
+
const { locale } = useTranslation(customizeTranslations);
|
|
7
|
+
return resolveAppLanguage(locale);
|
|
16
8
|
}
|
|
17
9
|
|
|
18
10
|
export function useMessages(): Messages {
|
|
19
11
|
return messagesFor(useAppLanguage());
|
|
20
12
|
}
|
|
21
|
-
|
|
22
|
-
export function currentAppLanguage(): AppLanguage {
|
|
23
|
-
return Platform.OS === "web" ? readAppLanguage() : "en";
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function watchAppLanguage(onChange: () => void): () => void {
|
|
27
|
-
return Platform.OS === "web" ? subscribeAppLanguage(onChange) : () => {};
|
|
28
|
-
}
|
package/client/web.ts
CHANGED
|
@@ -1,89 +1,13 @@
|
|
|
1
|
-
// Browser-only bridge: the SDK does not expose the app language, and the host
|
|
2
|
-
// leaves `<html lang="en">` static. The Paseo `language` setting lives in the
|
|
3
|
-
// app settings blob in localStorage; keep DOM / storage access here and call it
|
|
4
|
-
// only on the web platform.
|
|
5
|
-
import { resolveAppLanguage, type AppLanguage } from "../shared/i18n.ts";
|
|
6
1
|
import { workspaceIdFromPath } from "./route.ts";
|
|
7
2
|
|
|
8
|
-
const APP_SETTINGS_KEY = "@paseo:app-settings";
|
|
9
|
-
/** Same-window writes do not fire `storage`; poll the (small) settings string. */
|
|
10
|
-
const POLL_MS = 1_500;
|
|
11
|
-
|
|
12
3
|
type BrowserEventTarget = {
|
|
13
4
|
addEventListener(type: string, listener: () => void): void;
|
|
14
5
|
removeEventListener(type: string, listener: () => void): void;
|
|
15
6
|
};
|
|
16
7
|
const browser = globalThis as unknown as BrowserEventTarget & {
|
|
17
8
|
location?: { pathname: string };
|
|
18
|
-
localStorage?: { getItem(key: string): string | null };
|
|
19
|
-
navigator?: { languages?: readonly string[]; language?: string };
|
|
20
|
-
document?: BrowserEventTarget;
|
|
21
9
|
};
|
|
22
10
|
|
|
23
|
-
function readLanguageSetting(): string | null {
|
|
24
|
-
try {
|
|
25
|
-
const raw = browser.localStorage?.getItem(APP_SETTINGS_KEY);
|
|
26
|
-
if (!raw) return null;
|
|
27
|
-
const parsed = JSON.parse(raw) as { language?: unknown };
|
|
28
|
-
return typeof parsed.language === "string" ? parsed.language : null;
|
|
29
|
-
} catch {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function systemLanguages(): readonly string[] {
|
|
35
|
-
const nav = browser.navigator;
|
|
36
|
-
if (!nav) return [];
|
|
37
|
-
if (nav.languages && nav.languages.length > 0) return nav.languages;
|
|
38
|
-
return nav.language ? [nav.language] : [];
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
let current: AppLanguage = "en";
|
|
42
|
-
let initialized = false;
|
|
43
|
-
const listeners = new Set<() => void>();
|
|
44
|
-
let stopWatching: (() => void) | null = null;
|
|
45
|
-
|
|
46
|
-
function refresh(): void {
|
|
47
|
-
const next = resolveAppLanguage(readLanguageSetting(), systemLanguages());
|
|
48
|
-
if (next === current) return;
|
|
49
|
-
current = next;
|
|
50
|
-
for (const listener of [...listeners]) listener();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function readAppLanguage(): AppLanguage {
|
|
54
|
-
if (!initialized) {
|
|
55
|
-
initialized = true;
|
|
56
|
-
current = resolveAppLanguage(readLanguageSetting(), systemLanguages());
|
|
57
|
-
}
|
|
58
|
-
return current;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function subscribeAppLanguage(onChange: () => void): () => void {
|
|
62
|
-
listeners.add(onChange);
|
|
63
|
-
if (!stopWatching) {
|
|
64
|
-
readAppLanguage();
|
|
65
|
-
const timer = setInterval(refresh, POLL_MS);
|
|
66
|
-
browser.addEventListener?.("storage", refresh);
|
|
67
|
-
browser.addEventListener?.("focus", refresh);
|
|
68
|
-
browser.addEventListener?.("languagechange", refresh);
|
|
69
|
-
browser.document?.addEventListener?.("visibilitychange", refresh);
|
|
70
|
-
stopWatching = () => {
|
|
71
|
-
clearInterval(timer);
|
|
72
|
-
browser.removeEventListener?.("storage", refresh);
|
|
73
|
-
browser.removeEventListener?.("focus", refresh);
|
|
74
|
-
browser.removeEventListener?.("languagechange", refresh);
|
|
75
|
-
browser.document?.removeEventListener?.("visibilitychange", refresh);
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
return () => {
|
|
79
|
-
listeners.delete(onChange);
|
|
80
|
-
if (listeners.size === 0 && stopWatching) {
|
|
81
|
-
stopWatching();
|
|
82
|
-
stopWatching = null;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
11
|
// The sidebar surface has no workspace context, and the SDK exposes no active
|
|
88
12
|
// workspace. Remember the last `/workspace/<id>` route the user was on so the
|
|
89
13
|
// board can default to that workspace's project.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { test } from "node:test";
|
|
3
|
+
import type { PluginPaseoApi } from "@getpaseo/plugin/client";
|
|
4
|
+
import { loadWorkspaceProjectRoot } from "./workspace-root.ts";
|
|
5
|
+
|
|
6
|
+
function workspacePaseo(refresh: () => Promise<{ projectRootPath: string } | null>) {
|
|
7
|
+
const ids: string[] = [];
|
|
8
|
+
const paseo = {
|
|
9
|
+
workspaces: {
|
|
10
|
+
ref(workspaceId: string) {
|
|
11
|
+
ids.push(workspaceId);
|
|
12
|
+
return { refresh };
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
} as unknown as Pick<PluginPaseoApi, "workspaces">;
|
|
16
|
+
return { paseo, ids };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
test("workspace project lookup delegates to the SDK handle without plugin-owned pagination", async () => {
|
|
20
|
+
const { paseo, ids } = workspacePaseo(async () => ({ projectRootPath: "/project" }));
|
|
21
|
+
assert.equal(await loadWorkspaceProjectRoot(paseo, "last-workspace"), "/project");
|
|
22
|
+
assert.deepEqual(ids, ["last-workspace"]);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("no remembered workspace leaves the default project fallback without an SDK lookup", async () => {
|
|
26
|
+
const { paseo, ids } = workspacePaseo(async () => assert.fail("No workspace should be refreshed"));
|
|
27
|
+
assert.equal(await loadWorkspaceProjectRoot(paseo, null), null);
|
|
28
|
+
assert.deepEqual(ids, []);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test("a missing workspace leaves the existing project fallback", async () => {
|
|
32
|
+
const { paseo, ids } = workspacePaseo(async () => null);
|
|
33
|
+
assert.equal(await loadWorkspaceProjectRoot(paseo, "missing-workspace"), null);
|
|
34
|
+
assert.deepEqual(ids, ["missing-workspace"]);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test("workspace refresh failures reach the query's existing error handling", async () => {
|
|
38
|
+
const { paseo } = workspacePaseo(async () => { throw new Error("offline"); });
|
|
39
|
+
await assert.rejects(loadWorkspaceProjectRoot(paseo, "last-workspace"), /offline/);
|
|
40
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PluginPaseoApi } from "@getpaseo/plugin/client";
|
|
2
|
+
|
|
3
|
+
export async function loadWorkspaceProjectRoot(paseo: Pick<PluginPaseoApi, "workspaces">, workspaceId: string | null): Promise<string | null> {
|
|
4
|
+
if (workspaceId === null) return null;
|
|
5
|
+
const workspace = await paseo.workspaces.ref(workspaceId).refresh();
|
|
6
|
+
return workspace?.projectRootPath ?? null;
|
|
7
|
+
}
|
package/index.client.tsx
CHANGED
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
import type { PluginClientContext } from "@getpaseo/plugin/client";
|
|
2
2
|
import { Platform } from "react-native";
|
|
3
|
+
import { CustomizeSidebarItem } from "./client/sidebar-item.tsx";
|
|
4
|
+
import { CUSTOMIZE_SCREEN_ID } from "./client/screen-id.ts";
|
|
3
5
|
import { CustomizeSurface } from "./client/surface.tsx";
|
|
4
6
|
import { openCustomizeFromAgent } from "./client/slash-command.ts";
|
|
5
|
-
import {
|
|
7
|
+
import { customizeTranslations } from "./client/translations.ts";
|
|
6
8
|
import { trackWorkspaceRoute } from "./client/web.ts";
|
|
7
|
-
import { messagesFor } from "./shared/i18n.ts";
|
|
8
9
|
|
|
9
|
-
const SURFACE_ID = "customize";
|
|
10
|
-
|
|
11
|
-
/** Command titles follow the app language; the host has no update(), so re-register on change. */
|
|
12
10
|
function addCommands(client: PluginClientContext): () => void {
|
|
13
|
-
const messages = messagesFor(currentAppLanguage());
|
|
14
11
|
const removeCommandCenterItem = client.addCommandCenterItem({
|
|
15
12
|
id: "open-customize",
|
|
16
|
-
title:
|
|
13
|
+
title: customizeTranslations.message("title"),
|
|
17
14
|
icon: "FolderCog",
|
|
18
15
|
keywords: ["customize", "agents.md", "claude.md", "rules", "skills", "mcp", "instructions", "provider"],
|
|
19
16
|
context: "global",
|
|
20
|
-
onSelect({
|
|
21
|
-
|
|
17
|
+
onSelect({ openScreen }) {
|
|
18
|
+
openScreen({ screenId: CUSTOMIZE_SCREEN_ID });
|
|
22
19
|
},
|
|
23
20
|
});
|
|
24
21
|
const removeSlashCommand = client.addSlashCommand({
|
|
25
22
|
name: "customize",
|
|
26
|
-
description:
|
|
23
|
+
description: customizeTranslations.message("openBoard"),
|
|
27
24
|
argumentHint: "",
|
|
28
25
|
context: "agent",
|
|
29
26
|
onSubmit: openCustomizeFromAgent,
|
|
@@ -36,22 +33,20 @@ function addCommands(client: PluginClientContext): () => void {
|
|
|
36
33
|
|
|
37
34
|
export default function contribute(client: PluginClientContext) {
|
|
38
35
|
const stopRouteTracking = Platform.OS === "web" ? trackWorkspaceRoute() : () => {};
|
|
39
|
-
client.
|
|
40
|
-
|
|
41
|
-
id: "customize",
|
|
36
|
+
client.addScreen({
|
|
37
|
+
id: CUSTOMIZE_SCREEN_ID,
|
|
42
38
|
title: "Customize",
|
|
43
|
-
|
|
44
|
-
surface: SURFACE_ID,
|
|
39
|
+
Component: CustomizeSurface,
|
|
45
40
|
});
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
removeCommands = addCommands(client);
|
|
41
|
+
client.addSidebarHeaderItem({
|
|
42
|
+
id: CUSTOMIZE_SCREEN_ID,
|
|
43
|
+
title: "Customize",
|
|
44
|
+
Component: CustomizeSidebarItem,
|
|
51
45
|
});
|
|
46
|
+
|
|
47
|
+
const removeCommands = addCommands(client);
|
|
52
48
|
return () => {
|
|
53
49
|
stopRouteTracking();
|
|
54
|
-
stopLanguage();
|
|
55
50
|
removeCommands();
|
|
56
51
|
};
|
|
57
52
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koinzhang/paseo-plugin-customize",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Inspect local instructions, rules, skills, MCP servers, commands, subagents, and plugins for Paseo providers.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"test": "node --experimental-strip-types --test server/*.test.ts client/*.test.ts"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@getpaseo/plugin": "0.
|
|
28
|
+
"@getpaseo/plugin": "0.17.4",
|
|
29
29
|
"@tanstack/react-query": "^5.90.11",
|
|
30
30
|
"@types/node": "^24.13.5",
|
|
31
31
|
"@types/react": "~19.2.0",
|