claudeNativePluginScan.ts ×7

Frontier kind: Code frontier

unlabeled · c_682b056c4b2b

212 tests · 18659 LOC · 67 files · introduces 0 tests · 88 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges88 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1839 ranges18659 lines · 67 files · Browse complete extent
All tests (intent)
212 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 88 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/claude/customizations/scan/claudeNativePluginScan.ts 88 introduced LOC · 7 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- claudeNativePluginScan.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { URI } from '../../../../../../base/common/uri.js';
7 > import { ResourceSet } from '../../../../../../base/common/map.js';
8 > import { IFileService } from '../../../../../files/common/files.js';
9 > import { ILogService } from '../../../../../log/common/log.js';
10 > import { detectPluginFormat, parsePlugin, readJsonFile, type IParsedPlugin } from '../../../../../agentPlugins/common/pluginParsers.js';
11 >
12 > /**
13 > * A Claude-native plugin enabled via `enabledPlugins` and resolved to its
14 > * real on-disk root, paired with its parsed components.
15 > */
16 > export interface IResolvedNativePlugin {
17 > /** The `enabledPlugins` id, e.g. `telegram@claude-plugins-official`. */
18 > readonly id: string;
19 > /** The resolved plugin root directory (a real, openable `file:` URI). */
20 > readonly root: URI;
21 > /** The plugin's parsed components (skills / agents / hooks / MCP / rules). */
22 > readonly parsed: IParsedPlugin;
23 > }
24 >
25 > /**
26 > * The marketplace id used by Claude for in-place `@skills-dir` plugins,
27 > * which live under `<scope>/.claude/skills/<name>/` rather than the
28 > * marketplace cache.
29 > */
30 > const SKILLS_DIR_MARKETPLACE = 'skills-dir';
31 >
32 > /**
33 > * The settings files a Claude session reads `enabledPlugins` from, in
34 > * **ascending precedence** (`user < project < local`, per the SDK: a
35 > * `false` in `.claude/settings.local.json` disables a plugin that project
36 > * or user settings enabled). Iterating in this order and letting later
37 > * scopes overwrite earlier ones yields the effective enabled set. The
38 > * `managed` scope is intentionally excluded.
39 > */
40 function claudeSettingsFilesByPrecedence(workingDirectory: URI | undefined, userHome: URI): URI[] {
41 const files: URI[] = [URI.joinPath(userHome, '.claude', 'settings.json')];
46 return files;
47 }
49 > /**
50 > * Computes the effective set of enabled plugin ids across the settings
51 > * scopes. A plugin's value may be `true`, a `string[]` (version
52 > * constraint), or an object (extended form) — all of which mean
53 > * **enabled**; only `false` disables. Later scopes override earlier ones.
54 > */
55 async function resolveEnabledPluginIds(workingDirectory: URI | undefined, userHome: URI, fileService: IFileService): Promise<string[]> {
56 const effective = new Map<string, boolean>();
77 return [...effective].filter(([, enabled]) => enabled).map(([id]) => id);
78 }
80 > /** Splits an `enabledPlugins` id into its `plugin` and `marketplace` parts. */
81 function splitPluginId(id: string): { readonly plugin: string; readonly marketplace: string } | undefined {
82 const at = id.lastIndexOf('@');
97 return { plugin, marketplace };
98 }
100 > /**
101 > * Whether `dir` contains a readable plugin manifest in any supported
102 > * format. Reuses the shared {@link detectPluginFormat} so the scanner
103 > * recognizes Claude (`.claude-plugin/plugin.json`), Open Plugins
104 > * (`.plugin/plugin.json`), and Copilot (`plugin.json`) layouts — the same
105 > * formats {@link parsePlugin} can parse — rather than only the Claude one.
106 > */
107 async function hasManifest(dir: URI, fileService: IFileService): Promise<boolean> {
108 const format = await detectPluginFormat(dir, fileService);
109 return fileService.exists(URI.joinPath(dir, format.manifestPath));
110 }
112 > /**
113 > * Resolves an in-place `@skills-dir` plugin to its root, preferring the
114 > * workspace scope over the user scope. Accepts a candidate only when it
115 > * holds a plugin manifest.
116 > */
117 async function resolveSkillsDirRoot(plugin: string, workingDirectory: URI | undefined, userHome: URI, fileService: IFileService): Promise<URI | undefined> {
118 const candidates: URI[] = [];
128 return undefined;
129 }
131 > /**
132 > * Resolves a marketplace plugin to its installed cache root. The real
133 > * layout is `~/.claude/plugins/cache/<marketplace>/<plugin>/<version>/`,
134 > * so the id maps directly to `<marketplace>/<plugin>`; the version dir is
135 > * the (single, or newest-`mtime`) child that holds a plugin manifest. The
136 > * base dir itself is accepted when it directly holds a manifest (no
137 > * version subdir). Returns `undefined` (caller warns + skips) when no
138 > * manifest-bearing candidate is found.
139 > */
140 async function resolveMarketplaceCacheRoot(plugin: string, marketplace: string, userHome: URI, fileService: IFileService): Promise<URI | undefined> {
141 const base = URI.joinPath(userHome, '.claude', 'plugins', 'cache', marketplace, plugin);
167 return best?.uri;
168 }
170 > /**
171 > * Scans a Claude session's `enabledPlugins` (user / project / local
172 > * settings) and resolves each enabled native plugin to its on-disk root,
173 > * parsing its bundled components with the shared {@link parsePlugin}.
174 > *
175 > * This is **discovery only** — native `.claude` plugins are already loaded
176 > * by the SDK runtime via `settingSources`, so the result is never fed into
177 > * `Options.plugins`; it only surfaces the plugins (and their components)
178 > * in the customization list with real, editable URIs. The post-materialize
179 > * filter (against the live SDK `system/init.plugins` list) hides any plugin
180 > * the live session did not actually load.
181 > *
182 > * Resolution is fail-soft: an id whose root cannot be located, or whose
183 > * manifest fails to parse, is logged and skipped rather than throwing.
184 > */
185 export async function scanClaudeNativePlugins(
186 workingDirectory: URI | undefined,