@koinzhang/paseo-plugin-customize 0.1.0 → 0.2.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 +29 -0
- package/README.md +1 -0
- package/client/category-visibility.test.ts +7 -1
- package/client/entries.test.ts +20 -1
- package/client/entries.ts +29 -2
- package/client/mechanism-card.tsx +74 -42
- package/client/surface.tsx +134 -101
- package/client/ui.tsx +65 -0
- package/package.json +1 -1
- package/paseo-plugin.json +1 -0
- package/shared/i18n.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,34 @@ 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.2.1] - 2026-09-28
|
|
9
|
+
|
|
10
|
+
Requires Paseo **>= 0.9.0**.
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- The board no longer shifts sideways when the entry list grows past one page: the list scrollbar is hidden, the provider/project controls stay pinned at the top, and only the entry list scrolls.
|
|
15
|
+
- The search field shows focus on its outer border only, without the inner outline.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Category tabs, the Skills invocation filter, and search now share one top toolbar.
|
|
20
|
+
- The loading-mechanism note became an inline toolbar dropdown; it opens as an overlay and no longer takes a row of its own.
|
|
21
|
+
|
|
22
|
+
[0.2.1]: https://github.com/koinzhang/paseo-plugins/releases/tag/customize-v0.2.1
|
|
23
|
+
|
|
24
|
+
## [0.2.0] - 2026-09-28
|
|
25
|
+
|
|
26
|
+
Requires Paseo **>= 0.9.0**.
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- Skills list can switch between all skills, automatic skills (auto and conditional), and manual-only skills.
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- Switching providers keeps the current category when the next provider supports it; otherwise it selects that provider’s first available category. Switching projects also keeps the current category.
|
|
35
|
+
|
|
8
36
|
## [0.1.0] - 2026-09-25
|
|
9
37
|
|
|
10
38
|
Requires Paseo **>= 0.9.0**.
|
|
@@ -21,4 +49,5 @@ Requires Paseo **>= 0.9.0**.
|
|
|
21
49
|
- Private, persistent scan snapshots with a last-scan tooltip, background refresh after 10 minutes, and retry after failures.
|
|
22
50
|
- Skill aliases that resolve to the same file appear once, while distinct files with the same name remain separate.
|
|
23
51
|
|
|
52
|
+
[0.2.0]: https://github.com/koinzhang/paseo-plugins/releases/tag/customize-v0.2.0
|
|
24
53
|
[0.1.0]: https://www.npmjs.com/package/@koinzhang/paseo-plugin-customize/v/0.1.0
|
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ Requires Paseo >= 0.9.0.
|
|
|
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
11
|
- 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 marks each 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
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.
|
|
13
|
+
- 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.
|
|
13
14
|
- 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.
|
|
14
15
|
- A skill reachable through several symlinked roots appears once. Customize prefers the provider's native path, then `.agents/skills`, then another path. Same-name skills backed by different files remain separate.
|
|
15
16
|
- For OpenCode 1.18, every discovered and permitted skill is advertised automatically, even if its frontmatter contains another agent's `disable-model-invocation` setting. The skill body loads only when the agent calls the `skill` tool; `permission.skill: deny` still hides a skill.
|
|
@@ -19,7 +19,13 @@ test("keeps confirmed capabilities visible when their local scan is incomplete",
|
|
|
19
19
|
assert.equal(visibleCategories("opencode").includes("plugins"), true);
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
test("
|
|
22
|
+
test("keeps the current category when the next provider still offers it", () => {
|
|
23
|
+
assert.equal(resolveCategory("codex", "skills"), "skills");
|
|
24
|
+
assert.equal(resolveCategory("cursor", "mcp"), "mcp");
|
|
25
|
+
assert.equal(resolveCategory("opencode", "rules"), "rules");
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test("selects the first visible category when the next provider lacks it", () => {
|
|
23
29
|
assert.equal(resolveCategory("pi", "mcp"), "instructions");
|
|
24
30
|
assert.equal(resolveCategory("kiro", "commands"), "instructions");
|
|
25
31
|
assert.equal(resolveCategory("cursor", "commands"), "commands");
|
package/client/entries.test.ts
CHANGED
|
@@ -2,7 +2,7 @@ import assert from "node:assert/strict";
|
|
|
2
2
|
import { test } from "node:test";
|
|
3
3
|
import type { Entry } from "../shared/contracts.ts";
|
|
4
4
|
import { messagesFor, resolveAppLanguage } from "../shared/i18n.ts";
|
|
5
|
-
import { countByCategory, groupEntries, projectLabel } from "./entries.ts";
|
|
5
|
+
import { countByCategory, countSkillInvocation, groupEntries, matchesSkillInvocation, projectLabel } from "./entries.ts";
|
|
6
6
|
|
|
7
7
|
const entry = (over: Partial<Entry>): Entry => ({
|
|
8
8
|
id: over.name ?? "x",
|
|
@@ -31,6 +31,25 @@ test("groupEntries: project before user, sources grouped, query filters", () =>
|
|
|
31
31
|
assert.deepEqual(countByCategory(entries), { instructions: 0, rules: 1, skills: 3, mcp: 0, commands: 0, subagents: 0, plugins: 0 });
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
+
test("skill invocation: auto includes conditional, manual is exact, other statuses stay in all", () => {
|
|
35
|
+
const entries = [
|
|
36
|
+
entry({ name: "auto" }),
|
|
37
|
+
entry({ name: "conditional", status: "conditional" }),
|
|
38
|
+
entry({ name: "manual", status: "manual" }),
|
|
39
|
+
entry({ name: "disabled", status: "disabled" }),
|
|
40
|
+
entry({ name: "rule", category: "rules", status: "manual" }),
|
|
41
|
+
];
|
|
42
|
+
assert.equal(matchesSkillInvocation(entries[0]!, "auto"), true);
|
|
43
|
+
assert.equal(matchesSkillInvocation(entries[1]!, "auto"), true);
|
|
44
|
+
assert.equal(matchesSkillInvocation(entries[2]!, "auto"), false);
|
|
45
|
+
assert.equal(matchesSkillInvocation(entries[3]!, "auto"), false);
|
|
46
|
+
assert.equal(matchesSkillInvocation(entries[2]!, "manual"), true);
|
|
47
|
+
assert.deepEqual(countSkillInvocation(entries), { all: 4, auto: 2, manual: 1 });
|
|
48
|
+
assert.deepEqual(groupEntries(entries, "skills", "", "auto").map((group) => group.count), [2, 0]);
|
|
49
|
+
assert.deepEqual(groupEntries(entries, "skills", "manual", "manual")[0]?.sources[0]?.entries.map((item) => item.name), ["manual"]);
|
|
50
|
+
assert.equal(groupEntries(entries, "rules", "", "auto")[0]?.count, 1);
|
|
51
|
+
});
|
|
52
|
+
|
|
34
53
|
test("projectLabel / resolveAppLanguage", () => {
|
|
35
54
|
assert.equal(projectLabel("/Users/me/repo/"), "repo");
|
|
36
55
|
assert.equal(resolveAppLanguage("zh-CN"), "zh-CN");
|
package/client/entries.ts
CHANGED
|
@@ -13,6 +13,27 @@ export interface ScopeGroup {
|
|
|
13
13
|
|
|
14
14
|
const SCOPE_ORDER: readonly Scope[] = ["project", "user"];
|
|
15
15
|
|
|
16
|
+
export const SKILL_INVOCATION_FILTERS = ["all", "auto", "manual"] as const;
|
|
17
|
+
export type SkillInvocationFilter = (typeof SKILL_INVOCATION_FILTERS)[number];
|
|
18
|
+
|
|
19
|
+
/** Auto includes conditional discovery. Manual is explicit invocation only. */
|
|
20
|
+
export function matchesSkillInvocation(entry: Entry, filter: SkillInvocationFilter): boolean {
|
|
21
|
+
if (filter === "all") return true;
|
|
22
|
+
if (filter === "manual") return entry.status === "manual";
|
|
23
|
+
return entry.status === "auto" || entry.status === "conditional";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function countSkillInvocation(entries: readonly Entry[]): Record<SkillInvocationFilter, number> {
|
|
27
|
+
const counts: Record<SkillInvocationFilter, number> = { all: 0, auto: 0, manual: 0 };
|
|
28
|
+
for (const entry of entries) {
|
|
29
|
+
if (entry.category !== "skills") continue;
|
|
30
|
+
counts.all++;
|
|
31
|
+
if (matchesSkillInvocation(entry, "auto")) counts.auto++;
|
|
32
|
+
else if (matchesSkillInvocation(entry, "manual")) counts.manual++;
|
|
33
|
+
}
|
|
34
|
+
return counts;
|
|
35
|
+
}
|
|
36
|
+
|
|
16
37
|
export function countByCategory(entries: readonly Entry[]): Record<Category, number> {
|
|
17
38
|
const out = Object.fromEntries(CATEGORIES.map((category) => [category, 0])) as Record<Category, number>;
|
|
18
39
|
for (const entry of entries) out[entry.category]++;
|
|
@@ -25,12 +46,18 @@ export function matchesQuery(entry: Entry, query: string): boolean {
|
|
|
25
46
|
return [entry.name, entry.dir, entry.source, entry.description ?? ""].some((field) => field.toLowerCase().includes(needle));
|
|
26
47
|
}
|
|
27
48
|
|
|
28
|
-
/** Project first, then user; within a scope, sources keep discovery order. */
|
|
29
|
-
export function groupEntries(
|
|
49
|
+
/** Project first, then user; within a scope, sources keep discovery order. Skill invocation applies only to skills. */
|
|
50
|
+
export function groupEntries(
|
|
51
|
+
entries: readonly Entry[],
|
|
52
|
+
category: Category,
|
|
53
|
+
query: string,
|
|
54
|
+
skillFilter: SkillInvocationFilter = "all",
|
|
55
|
+
): ScopeGroup[] {
|
|
30
56
|
return SCOPE_ORDER.map((scope) => {
|
|
31
57
|
const sources = new Map<string, Entry[]>();
|
|
32
58
|
for (const entry of entries) {
|
|
33
59
|
if (entry.category !== category || entry.scope !== scope || !matchesQuery(entry, query)) continue;
|
|
60
|
+
if (category === "skills" && !matchesSkillInvocation(entry, skillFilter)) continue;
|
|
34
61
|
const list = sources.get(entry.source) ?? [];
|
|
35
62
|
list.push(entry);
|
|
36
63
|
sources.set(entry.source, list);
|
|
@@ -1,74 +1,106 @@
|
|
|
1
1
|
import { Icon } from "@getpaseo/plugin/client/react-native";
|
|
2
2
|
import { useState, type ReactNode } from "react";
|
|
3
|
-
import { Pressable, Text, View } from "react-native";
|
|
3
|
+
import { Platform, Pressable, ScrollView, Text, View } from "react-native";
|
|
4
4
|
import type { Mechanism } from "../shared/mechanisms.ts";
|
|
5
5
|
import type { AppLanguage, Messages } from "../shared/i18n.ts";
|
|
6
|
-
import { CONTROL, FONT_WEIGHT, ICON_SIZE, RADIUS, TEXT } from "./design-tokens.ts";
|
|
6
|
+
import { CONTROL, FONT_WEIGHT, ICON_SIZE, MENU, RADIUS, TEXT } from "./design-tokens.ts";
|
|
7
7
|
import type { Colors } from "./ui.tsx";
|
|
8
8
|
|
|
9
|
-
/**
|
|
9
|
+
/** Inline entry with a dropdown for the provider/category loading details. */
|
|
10
10
|
export function MechanismCard({
|
|
11
11
|
mechanism,
|
|
12
12
|
language,
|
|
13
13
|
colors,
|
|
14
14
|
m,
|
|
15
|
+
compact,
|
|
15
16
|
}: {
|
|
16
17
|
mechanism: Mechanism;
|
|
17
18
|
language: AppLanguage;
|
|
18
19
|
colors: Colors;
|
|
19
20
|
m: Messages;
|
|
21
|
+
compact: boolean;
|
|
20
22
|
}): ReactNode {
|
|
21
23
|
const [open, setOpen] = useState(false);
|
|
22
24
|
const pick = (text: { en: string; zh: string }) => (language === "zh-CN" ? text.zh : text.en);
|
|
25
|
+
const title = mechanism.supported ? m.howItWorks : m.unsupported;
|
|
26
|
+
const icon = mechanism.supported ? "Info" : "Ban";
|
|
23
27
|
const [first, ...rest] = mechanism.notes;
|
|
24
|
-
const expandable = mechanism.locations.length > 0 || rest.length > 0;
|
|
25
28
|
|
|
26
29
|
return (
|
|
27
|
-
<View
|
|
28
|
-
style={{
|
|
29
|
-
borderRadius: RADIUS.overlay,
|
|
30
|
-
borderWidth: 1,
|
|
31
|
-
borderColor: colors.border,
|
|
32
|
-
backgroundColor: colors.surface1,
|
|
33
|
-
paddingHorizontal: 12,
|
|
34
|
-
paddingVertical: 8,
|
|
35
|
-
gap: 6,
|
|
36
|
-
}}
|
|
37
|
-
>
|
|
30
|
+
<View style={{ position: "relative", zIndex: open ? 40 : 1, flexShrink: 0 }}>
|
|
38
31
|
<Pressable
|
|
39
32
|
accessibilityRole="button"
|
|
40
33
|
accessibilityState={{ expanded: open }}
|
|
41
|
-
accessibilityLabel={
|
|
42
|
-
disabled={!expandable}
|
|
43
|
-
hitSlop={CONTROL.hitSlop}
|
|
34
|
+
accessibilityLabel={title}
|
|
44
35
|
onPress={() => setOpen((prev) => !prev)}
|
|
45
|
-
style={{
|
|
36
|
+
style={{
|
|
37
|
+
flexDirection: "row",
|
|
38
|
+
alignItems: "center",
|
|
39
|
+
gap: 6,
|
|
40
|
+
height: CONTROL.searchHeight,
|
|
41
|
+
paddingHorizontal: 10,
|
|
42
|
+
borderRadius: RADIUS.control,
|
|
43
|
+
borderWidth: 1,
|
|
44
|
+
borderColor: colors.border,
|
|
45
|
+
backgroundColor: colors.surface1,
|
|
46
|
+
}}
|
|
46
47
|
>
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<Text style={{ ...TEXT.meta, color: colors.foreground, flex: 1 }}>
|
|
51
|
-
<Text style={{ fontWeight: FONT_WEIGHT.semibold }}>{mechanism.supported ? m.howItWorks : m.unsupported}</Text>
|
|
52
|
-
{first ? ` ${pick(first)}` : ""}
|
|
53
|
-
</Text>
|
|
54
|
-
{expandable ? <Icon name={open ? "ChevronUp" : "ChevronDown"} size={ICON_SIZE.inline} color={colors.foregroundMuted} /> : null}
|
|
48
|
+
<Icon name={icon} size={ICON_SIZE.inline} color={colors.foregroundMuted} />
|
|
49
|
+
<Text style={{ ...TEXT.small, fontWeight: FONT_WEIGHT.medium, color: colors.foreground }}>{title}</Text>
|
|
50
|
+
<Icon name={open ? "ChevronUp" : "ChevronDown"} size={ICON_SIZE.inline} color={colors.foregroundMuted} />
|
|
55
51
|
</Pressable>
|
|
56
52
|
{open ? (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
53
|
+
<>
|
|
54
|
+
<Pressable
|
|
55
|
+
accessibilityRole="button"
|
|
56
|
+
accessibilityLabel={m.closeMenu}
|
|
57
|
+
onPress={() => setOpen(false)}
|
|
58
|
+
style={{
|
|
59
|
+
position: (Platform.OS === "web" ? "fixed" : "absolute") as "absolute",
|
|
60
|
+
top: 0,
|
|
61
|
+
left: 0,
|
|
62
|
+
right: 0,
|
|
63
|
+
bottom: 0,
|
|
64
|
+
}}
|
|
65
|
+
/>
|
|
66
|
+
<View
|
|
67
|
+
style={{
|
|
68
|
+
position: "absolute",
|
|
69
|
+
top: "100%",
|
|
70
|
+
right: 0,
|
|
71
|
+
marginTop: 4,
|
|
72
|
+
width: compact ? 280 : MENU.maxWidth,
|
|
73
|
+
borderRadius: RADIUS.overlay,
|
|
74
|
+
borderWidth: 1,
|
|
75
|
+
borderColor: colors.border,
|
|
76
|
+
backgroundColor: colors.surface1,
|
|
77
|
+
shadowColor: "rgba(0, 0, 0, 0.04)",
|
|
78
|
+
shadowOffset: { width: 0, height: 4 },
|
|
79
|
+
shadowRadius: 16,
|
|
80
|
+
elevation: 4,
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
<ScrollView
|
|
84
|
+
style={{ maxHeight: MENU.visibleRows * MENU.rowHeight + 8 }}
|
|
85
|
+
contentContainerStyle={{ padding: 12, gap: 12 }}
|
|
86
|
+
>
|
|
87
|
+
{first ? <Text style={{ ...TEXT.body, color: colors.foreground }}>{pick(first)}</Text> : null}
|
|
88
|
+
{mechanism.locations.map((location, index) => (
|
|
89
|
+
<View key={index} style={{ flexDirection: "row", gap: 8 }}>
|
|
90
|
+
<Text style={{ ...TEXT.meta, color: colors.foregroundMuted, minWidth: 56 }}>{m.scopes[location.scope]}</Text>
|
|
91
|
+
<Text style={{ ...TEXT.path, color: colors.foreground, flex: 1 }} selectable>
|
|
92
|
+
{location.path}
|
|
93
|
+
</Text>
|
|
94
|
+
</View>
|
|
95
|
+
))}
|
|
96
|
+
{rest.map((note, index) => (
|
|
97
|
+
<Text key={index} style={{ ...TEXT.meta, color: colors.foreground }}>
|
|
98
|
+
• {pick(note)}
|
|
99
|
+
</Text>
|
|
100
|
+
))}
|
|
101
|
+
</ScrollView>
|
|
102
|
+
</View>
|
|
103
|
+
</>
|
|
72
104
|
) : null}
|
|
73
105
|
</View>
|
|
74
106
|
);
|
package/client/surface.tsx
CHANGED
|
@@ -7,27 +7,23 @@ import { resolveCategory, visibleCategories } from "../shared/category-visibilit
|
|
|
7
7
|
import { cachedScanRpc, scanRpc, type Category, type Entry } from "../shared/contracts.ts";
|
|
8
8
|
import { messagesFor } from "../shared/i18n.ts";
|
|
9
9
|
import { MECHANISMS, mechanismFor } from "../shared/mechanisms.ts";
|
|
10
|
-
import {
|
|
10
|
+
import { type ProviderId } from "../shared/providers.ts";
|
|
11
11
|
import { selectionSettings } from "../shared/selection-settings.ts";
|
|
12
12
|
import { CONTROL, ICON_SIZE, PREVIEW_FRACTION, RADIUS, TEXT, pageLayout, titleGap } from "./design-tokens.ts";
|
|
13
13
|
import { Dropdown, type DropdownOption } from "./dropdown.tsx";
|
|
14
|
-
import { countByCategory, groupEntries, projectLabel } from "./entries.ts";
|
|
14
|
+
import { countByCategory, countSkillInvocation, groupEntries, matchesSkillInvocation, projectLabel, SKILL_INVOCATION_FILTERS, type SkillInvocationFilter } from "./entries.ts";
|
|
15
15
|
import { EntryRow } from "./entry-row.tsx";
|
|
16
16
|
import { MechanismCard } from "./mechanism-card.tsx";
|
|
17
17
|
import { PreviewPane } from "./preview-pane.tsx";
|
|
18
18
|
import { enabledProviderOptions, selectedProvider } from "./provider-options.ts";
|
|
19
19
|
import { newestScan, REVISIT_QUERY_POLICY, SCAN_QUERY_POLICY, shouldScanSnapshot } from "./query-policy.ts";
|
|
20
|
-
import { CategoryTabs, ErrorState, IconButton, InlineEmpty, LoadingState, SectionHeader } from "./ui.tsx";
|
|
20
|
+
import { CategoryTabs, ErrorState, IconButton, InlineEmpty, LoadingState, SectionHeader, SegmentedControl } from "./ui.tsx";
|
|
21
21
|
import { useAppLanguage } from "./use-app-language.ts";
|
|
22
22
|
import { readLastWorkspaceId } from "./web.ts";
|
|
23
23
|
|
|
24
24
|
const NO_PROJECT = "";
|
|
25
25
|
const WORKSPACE_PAGE_LIMIT = 200;
|
|
26
26
|
|
|
27
|
-
const lastCategory: Record<ProviderId, Category> = Object.fromEntries(
|
|
28
|
-
PROVIDER_IDS.map((id) => [id, "instructions"]),
|
|
29
|
-
) as Record<ProviderId, Category>;
|
|
30
|
-
|
|
31
27
|
/** Sidebar surface; an unselected project defaults to the last workspace. */
|
|
32
28
|
export function CustomizeSurface({ theme, layout }: PluginSurfaceProps): ReactNode {
|
|
33
29
|
const colors = theme.colors;
|
|
@@ -78,6 +74,8 @@ export function CustomizeSurface({ theme, layout }: PluginSurfaceProps): ReactNo
|
|
|
78
74
|
const [category, setCategoryState] = useState<Category>("instructions");
|
|
79
75
|
const activeCategory = resolveCategory(provider, category);
|
|
80
76
|
const [query, setQuery] = useState("");
|
|
77
|
+
const [searchFocused, setSearchFocused] = useState(false);
|
|
78
|
+
const [skillFilter, setSkillFilter] = useState<SkillInvocationFilter>("all");
|
|
81
79
|
const [selected, setSelected] = useState<Entry | null>(null);
|
|
82
80
|
|
|
83
81
|
const setProvider = (id: string) => {
|
|
@@ -86,17 +84,16 @@ export function CustomizeSurface({ theme, layout }: PluginSurfaceProps): ReactNo
|
|
|
86
84
|
setSelected(null);
|
|
87
85
|
};
|
|
88
86
|
const setCategory = (next: Category) => {
|
|
89
|
-
lastCategory[provider] = next;
|
|
90
87
|
setCategoryState(next);
|
|
88
|
+
setSearchFocused(false);
|
|
91
89
|
setSelected(null);
|
|
92
90
|
};
|
|
93
91
|
|
|
94
92
|
useEffect(() => {
|
|
95
|
-
|
|
96
|
-
lastCategory[provider] = restored;
|
|
97
|
-
setCategoryState(restored);
|
|
93
|
+
setCategoryState((current) => resolveCategory(provider, current));
|
|
98
94
|
setSelected(null);
|
|
99
95
|
setQuery("");
|
|
96
|
+
setSearchFocused(false);
|
|
100
97
|
}, [provider]);
|
|
101
98
|
|
|
102
99
|
const projects = useQuery({
|
|
@@ -134,7 +131,11 @@ export function CustomizeSurface({ theme, layout }: PluginSurfaceProps): ReactNo
|
|
|
134
131
|
const displayed = newestScan(saved.data?.snapshot, result.data);
|
|
135
132
|
const entries = displayed?.entries ?? [];
|
|
136
133
|
const counts = useMemo(() => countByCategory(entries), [entries]);
|
|
137
|
-
const
|
|
134
|
+
const skillCounts = useMemo(() => countSkillInvocation(entries), [entries]);
|
|
135
|
+
const groups = useMemo(
|
|
136
|
+
() => groupEntries(entries, activeCategory, query, skillFilter),
|
|
137
|
+
[entries, activeCategory, query, skillFilter],
|
|
138
|
+
);
|
|
138
139
|
const mechanism = mechanismFor(provider, activeCategory, displayed?.compatibility);
|
|
139
140
|
const compatibility = displayed?.compatibility;
|
|
140
141
|
const compatibilityState = compatibility?.source === "builtIn" ? "supported"
|
|
@@ -146,6 +147,11 @@ export function CustomizeSurface({ theme, layout }: PluginSurfaceProps): ReactNo
|
|
|
146
147
|
if (fresh !== selected) setSelected(fresh ?? null);
|
|
147
148
|
}, [displayed, selected]);
|
|
148
149
|
|
|
150
|
+
useEffect(() => {
|
|
151
|
+
if (!selected || selected.category !== "skills" || matchesSkillInvocation(selected, skillFilter)) return;
|
|
152
|
+
setSelected(null);
|
|
153
|
+
}, [selected, skillFilter]);
|
|
154
|
+
|
|
149
155
|
const onSelect = useCallback((entry: Entry) => {
|
|
150
156
|
setSelected((prev) => (prev?.id === entry.id ? null : entry));
|
|
151
157
|
}, []);
|
|
@@ -156,7 +162,13 @@ export function CustomizeSurface({ theme, layout }: PluginSurfaceProps): ReactNo
|
|
|
156
162
|
count: displayed ? counts[id] : undefined,
|
|
157
163
|
muted: !MECHANISMS[provider][id].supported,
|
|
158
164
|
}));
|
|
159
|
-
const
|
|
165
|
+
const queryActive = query.trim().length > 0;
|
|
166
|
+
const listNarrowed = queryActive || (activeCategory === "skills" && skillFilter !== "all");
|
|
167
|
+
const skillFilterOptions = SKILL_INVOCATION_FILTERS.map((id) => ({
|
|
168
|
+
id,
|
|
169
|
+
label: m.skillFilters[id],
|
|
170
|
+
count: displayed ? skillCounts[id] : undefined,
|
|
171
|
+
}));
|
|
160
172
|
|
|
161
173
|
if (settings.status === "loading") return <LoadingState color={colors.foregroundMuted} />;
|
|
162
174
|
if (settings.status !== "ready") {
|
|
@@ -178,99 +190,120 @@ export function CustomizeSurface({ theme, layout }: PluginSurfaceProps): ReactNo
|
|
|
178
190
|
return (
|
|
179
191
|
<View style={{ flex: 1, minHeight: 0, backgroundColor: colors.surface0 }}>
|
|
180
192
|
<View style={{ flex: selected ? 1 - (compact ? PREVIEW_FRACTION.compact : PREVIEW_FRACTION.regular) : 1, minHeight: 0 }}>
|
|
181
|
-
<
|
|
182
|
-
<View
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
>
|
|
191
|
-
|
|
192
|
-
{compatibility
|
|
193
|
-
<
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
193
|
+
<View style={{ paddingHorizontal: page.padding, paddingTop: page.padding, gap: titleGap(compact), zIndex: 1 }}>
|
|
194
|
+
<View
|
|
195
|
+
style={{
|
|
196
|
+
flexDirection: "row",
|
|
197
|
+
alignItems: "center",
|
|
198
|
+
justifyContent: "flex-end",
|
|
199
|
+
zIndex: 30,
|
|
200
|
+
}}
|
|
201
|
+
>
|
|
202
|
+
<View style={{ flexDirection: "row", alignItems: "center", gap: 14, flexShrink: 1, minWidth: 0 }}>
|
|
203
|
+
{compatibility ? (
|
|
204
|
+
<View accessible accessibilityRole="image" accessibilityLabel={m.compatibility(compatibilityState)}>
|
|
205
|
+
<Icon name={compatibilityState === "off" ? "Link2Off" : "Link2"} size={ICON_SIZE.action} color={compatibilityState === "on" || compatibilityState === "supported" ? colors.statusSuccess : compatibilityState === "off" ? colors.foregroundMuted : colors.statusWarning} />
|
|
206
|
+
</View>
|
|
207
|
+
) : null}
|
|
208
|
+
<Dropdown
|
|
209
|
+
label={m.provider}
|
|
210
|
+
options={providerOptions}
|
|
211
|
+
value={provider}
|
|
212
|
+
onChange={setProvider}
|
|
213
|
+
colors={colors}
|
|
214
|
+
triggerLabel={m.chooseProvider}
|
|
215
|
+
closeLabel={m.closeMenu}
|
|
216
|
+
menuAlign={compact ? "left" : "right"}
|
|
217
|
+
disabled={settings.saving}
|
|
218
|
+
/>
|
|
219
|
+
<Dropdown
|
|
220
|
+
label={m.project}
|
|
221
|
+
options={projectOptions}
|
|
222
|
+
value={projectRoot ?? NO_PROJECT}
|
|
223
|
+
onChange={(id) => {
|
|
224
|
+
if (settings.saving) return;
|
|
225
|
+
void settings.save({ ...settings.values, projectRoot: id }, settings.revision);
|
|
226
|
+
setSelected(null);
|
|
227
|
+
}}
|
|
228
|
+
colors={colors}
|
|
229
|
+
triggerLabel={m.chooseProject}
|
|
230
|
+
closeLabel={m.closeMenu}
|
|
231
|
+
emptyLabel={m.noProject}
|
|
232
|
+
disabled={settings.saving}
|
|
233
|
+
/>
|
|
234
|
+
<IconButton
|
|
235
|
+
icon="RefreshCw"
|
|
236
|
+
label={m.refresh}
|
|
237
|
+
color={colors.foregroundMuted}
|
|
238
|
+
busy={result.isFetching}
|
|
239
|
+
tooltip={displayed ? {
|
|
240
|
+
text: m.lastScanned(new Date(displayed.scannedAt).toLocaleString(language)),
|
|
241
|
+
colors,
|
|
242
|
+
} : undefined}
|
|
243
|
+
onPress={() => {
|
|
244
|
+
void providerSnapshot.refetch();
|
|
245
|
+
void result.refetch();
|
|
246
|
+
}}
|
|
247
|
+
/>
|
|
248
|
+
</View>
|
|
249
|
+
</View>
|
|
250
|
+
<View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8 }}>
|
|
251
|
+
<CategoryTabs options={tabs} value={activeCategory} onChange={setCategory} colors={colors} />
|
|
252
|
+
<View style={{ flexBasis: 220, flexGrow: 1, minWidth: 0, flexDirection: "row", flexWrap: "wrap", justifyContent: "flex-end", alignItems: "center", gap: 8 }}>
|
|
253
|
+
{mechanism.supported && activeCategory === "skills" ? (
|
|
254
|
+
<SegmentedControl
|
|
255
|
+
label={m.skillInvocation}
|
|
256
|
+
options={skillFilterOptions}
|
|
257
|
+
value={skillFilter}
|
|
258
|
+
onChange={setSkillFilter}
|
|
217
259
|
colors={colors}
|
|
218
|
-
triggerLabel={m.chooseProject}
|
|
219
|
-
closeLabel={m.closeMenu}
|
|
220
|
-
emptyLabel={m.noProject}
|
|
221
|
-
disabled={settings.saving}
|
|
222
260
|
/>
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
261
|
+
) : null}
|
|
262
|
+
<MechanismCard key={`${provider}:${activeCategory}`} mechanism={mechanism} language={language} colors={colors} m={m} compact={compact} />
|
|
263
|
+
{mechanism.supported ? (
|
|
264
|
+
<View
|
|
265
|
+
style={{
|
|
266
|
+
width: 220,
|
|
267
|
+
minWidth: 180,
|
|
268
|
+
flexDirection: "row",
|
|
269
|
+
alignItems: "center",
|
|
270
|
+
gap: 6,
|
|
271
|
+
height: CONTROL.searchHeight,
|
|
272
|
+
paddingHorizontal: 10,
|
|
273
|
+
borderRadius: RADIUS.control,
|
|
274
|
+
borderWidth: 1,
|
|
275
|
+
borderColor: searchFocused ? colors.foregroundMuted : colors.border,
|
|
276
|
+
backgroundColor: colors.surface1,
|
|
235
277
|
}}
|
|
236
|
-
|
|
237
|
-
|
|
278
|
+
>
|
|
279
|
+
<Icon name="Search" size={ICON_SIZE.inline} color={colors.foregroundMuted} />
|
|
280
|
+
<TextInput
|
|
281
|
+
value={query}
|
|
282
|
+
onChangeText={setQuery}
|
|
283
|
+
onFocus={() => setSearchFocused(true)}
|
|
284
|
+
onBlur={() => setSearchFocused(false)}
|
|
285
|
+
placeholder={m.search}
|
|
286
|
+
placeholderTextColor={colors.foregroundMuted}
|
|
287
|
+
accessibilityLabel={m.search}
|
|
288
|
+
autoCorrect={false}
|
|
289
|
+
autoCapitalize="none"
|
|
290
|
+
style={{ flex: 1, ...TEXT.small, color: colors.foreground, paddingVertical: 0, borderWidth: 0, ...(Platform.OS === "web" ? ({ outlineStyle: "none" } as object) : null) }}
|
|
291
|
+
/>
|
|
292
|
+
{queryActive ? <IconButton icon="X" label={m.preview.close} color={colors.foregroundMuted} size={ICON_SIZE.inline} onPress={() => setQuery("")} /> : null}
|
|
293
|
+
</View>
|
|
294
|
+
) : null}
|
|
238
295
|
</View>
|
|
239
|
-
<CategoryTabs options={tabs} value={activeCategory} onChange={setCategory} colors={colors} />
|
|
240
|
-
{settings.saveError ? <Text style={{ ...TEXT.small, color: colors.statusDanger }}>{settings.saveError}</Text> : null}
|
|
241
|
-
<MechanismCard key={`${provider}:${activeCategory}`} mechanism={mechanism} language={language} colors={colors} m={m} />
|
|
242
|
-
{result.isError && displayed ? <ErrorState error={result.error} onRetry={() => void result.refetch()} colors={colors} /> : null}
|
|
243
296
|
</View>
|
|
297
|
+
{settings.saveError ? <Text style={{ ...TEXT.small, color: colors.statusDanger }}>{settings.saveError}</Text> : null}
|
|
298
|
+
{result.isError && displayed ? <ErrorState error={result.error} onRetry={() => void result.refetch()} colors={colors} /> : null}
|
|
299
|
+
</View>
|
|
244
300
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
height: CONTROL.searchHeight,
|
|
252
|
-
paddingHorizontal: 10,
|
|
253
|
-
borderRadius: RADIUS.control,
|
|
254
|
-
borderWidth: 1,
|
|
255
|
-
borderColor: colors.border,
|
|
256
|
-
backgroundColor: colors.surface1,
|
|
257
|
-
}}
|
|
258
|
-
>
|
|
259
|
-
<Icon name="Search" size={ICON_SIZE.inline} color={colors.foregroundMuted} />
|
|
260
|
-
<TextInput
|
|
261
|
-
value={query}
|
|
262
|
-
onChangeText={setQuery}
|
|
263
|
-
placeholder={m.search}
|
|
264
|
-
placeholderTextColor={colors.foregroundMuted}
|
|
265
|
-
accessibilityLabel={m.search}
|
|
266
|
-
autoCorrect={false}
|
|
267
|
-
autoCapitalize="none"
|
|
268
|
-
style={{ flex: 1, ...TEXT.small, color: colors.foreground, paddingVertical: 0 }}
|
|
269
|
-
/>
|
|
270
|
-
{filtered ? <IconButton icon="X" label={m.preview.close} color={colors.foregroundMuted} size={ICON_SIZE.inline} onPress={() => setQuery("")} /> : null}
|
|
271
|
-
</View>
|
|
272
|
-
) : null}
|
|
273
|
-
|
|
301
|
+
<ScrollView
|
|
302
|
+
style={{ flex: 1, minHeight: 0, ...(Platform.OS === "web" ? ({ scrollbarWidth: "none", msOverflowStyle: "none" } as object) : null) }}
|
|
303
|
+
contentContainerStyle={{ paddingHorizontal: page.padding, paddingTop: page.gap, paddingBottom: page.padding, gap: page.gap }}
|
|
304
|
+
keyboardShouldPersistTaps="handled"
|
|
305
|
+
showsVerticalScrollIndicator={false}
|
|
306
|
+
>
|
|
274
307
|
{!displayed && (saved.isPending || result.isPending) ? (
|
|
275
308
|
<LoadingState color={colors.foregroundMuted} />
|
|
276
309
|
) : !displayed && (result.isError || saved.isError) ? (
|
|
@@ -286,7 +319,7 @@ export function CustomizeSurface({ theme, layout }: PluginSurfaceProps): ReactNo
|
|
|
286
319
|
/>
|
|
287
320
|
{group.count === 0 ? (
|
|
288
321
|
<InlineEmpty
|
|
289
|
-
text={
|
|
322
|
+
text={listNarrowed ? m.noMatches : group.scope === "project" && !projectRoot ? m.noProject : m.emptyScope(m.scopes[group.scope])}
|
|
290
323
|
color={colors.foregroundMuted}
|
|
291
324
|
/>
|
|
292
325
|
) : (
|
package/client/ui.tsx
CHANGED
|
@@ -225,6 +225,71 @@ export function CategoryTabs<T extends string>({
|
|
|
225
225
|
);
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
+
/** Compact list-mode switch. Height matches the search field. */
|
|
229
|
+
export function SegmentedControl<T extends string>({
|
|
230
|
+
options,
|
|
231
|
+
value,
|
|
232
|
+
onChange,
|
|
233
|
+
colors,
|
|
234
|
+
label,
|
|
235
|
+
}: {
|
|
236
|
+
options: ReadonlyArray<{ id: T; label: string; count?: number }>;
|
|
237
|
+
value: T;
|
|
238
|
+
onChange: (id: T) => void;
|
|
239
|
+
colors: Pick<Colors, "foreground" | "foregroundMuted" | "border" | "surface1" | "surface2">;
|
|
240
|
+
label: string;
|
|
241
|
+
}): ReactNode {
|
|
242
|
+
return (
|
|
243
|
+
<View
|
|
244
|
+
accessibilityRole="tablist"
|
|
245
|
+
accessibilityLabel={label}
|
|
246
|
+
style={{
|
|
247
|
+
flexDirection: "row",
|
|
248
|
+
alignItems: "stretch",
|
|
249
|
+
height: CONTROL.searchHeight,
|
|
250
|
+
borderRadius: RADIUS.control,
|
|
251
|
+
borderWidth: 1,
|
|
252
|
+
borderColor: colors.border,
|
|
253
|
+
backgroundColor: colors.surface1,
|
|
254
|
+
overflow: "hidden",
|
|
255
|
+
flexShrink: 0,
|
|
256
|
+
}}
|
|
257
|
+
>
|
|
258
|
+
{options.map((option, index) => {
|
|
259
|
+
const active = option.id === value;
|
|
260
|
+
return (
|
|
261
|
+
<Pressable
|
|
262
|
+
key={option.id}
|
|
263
|
+
accessibilityRole="tab"
|
|
264
|
+
accessibilityState={{ selected: active }}
|
|
265
|
+
onPress={() => onChange(option.id)}
|
|
266
|
+
style={{
|
|
267
|
+
flexDirection: "row",
|
|
268
|
+
alignItems: "center",
|
|
269
|
+
gap: 6,
|
|
270
|
+
paddingHorizontal: 10,
|
|
271
|
+
borderLeftWidth: index === 0 ? 0 : 1,
|
|
272
|
+
borderLeftColor: colors.border,
|
|
273
|
+
backgroundColor: active ? colors.surface2 : "transparent",
|
|
274
|
+
}}
|
|
275
|
+
>
|
|
276
|
+
<Text
|
|
277
|
+
style={{
|
|
278
|
+
...TEXT.small,
|
|
279
|
+
fontWeight: active ? FONT_WEIGHT.semibold : FONT_WEIGHT.medium,
|
|
280
|
+
color: active ? colors.foreground : colors.foregroundMuted,
|
|
281
|
+
}}
|
|
282
|
+
>
|
|
283
|
+
{option.label}
|
|
284
|
+
</Text>
|
|
285
|
+
{option.count != null ? <Text style={{ ...TEXT.count, color: colors.foregroundMuted }}>{option.count}</Text> : null}
|
|
286
|
+
</Pressable>
|
|
287
|
+
);
|
|
288
|
+
})}
|
|
289
|
+
</View>
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
|
|
228
293
|
export function statusColor(status: Status, colors: Colors): string {
|
|
229
294
|
switch (status) {
|
|
230
295
|
case "auto":
|
package/package.json
CHANGED
package/paseo-plugin.json
CHANGED
package/shared/i18n.ts
CHANGED
|
@@ -37,6 +37,8 @@ export interface Messages {
|
|
|
37
37
|
refresh: string;
|
|
38
38
|
lastScanned: (date: string) => string;
|
|
39
39
|
search: string;
|
|
40
|
+
skillInvocation: string;
|
|
41
|
+
skillFilters: Record<"all" | "auto" | "manual", string>;
|
|
40
42
|
categories: Record<Category, string>;
|
|
41
43
|
scopes: Record<Scope | "managed", string>;
|
|
42
44
|
statuses: Record<Status, string>;
|
|
@@ -83,6 +85,8 @@ const en: Messages = {
|
|
|
83
85
|
refresh: "Rescan",
|
|
84
86
|
lastScanned: (date) => `Last scanned: ${date}`,
|
|
85
87
|
search: "Filter by name or path",
|
|
88
|
+
skillInvocation: "Skill invocation",
|
|
89
|
+
skillFilters: { all: "All", auto: "Auto", manual: "Manual" },
|
|
86
90
|
categories: { instructions: "Instructions", rules: "Rules", skills: "Skills", mcp: "MCP", commands: "Commands", subagents: "Subagents", plugins: "Plugins" },
|
|
87
91
|
scopes: { project: "Project", user: "User", managed: "Managed" },
|
|
88
92
|
statuses: {
|
|
@@ -190,6 +194,8 @@ const zh: Messages = {
|
|
|
190
194
|
refresh: "重新扫描",
|
|
191
195
|
lastScanned: (date) => `上次扫描:${date}`,
|
|
192
196
|
search: "按名称或路径筛选",
|
|
197
|
+
skillInvocation: "技能调用方式",
|
|
198
|
+
skillFilters: { all: "全部", auto: "自动", manual: "仅手动" },
|
|
193
199
|
categories: { instructions: "指令", rules: "规则", skills: "Skills", mcp: "MCP", commands: "命令", subagents: "子代理", plugins: "插件" },
|
|
194
200
|
scopes: { project: "项目级", user: "用户级", managed: "托管" },
|
|
195
201
|
statuses: {
|