claudeup 1.7.0 → 3.3.0
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/bin/claudeup.js +20 -2
- package/package.json +10 -19
- package/src/data/cli-tools.js +123 -0
- package/src/data/cli-tools.ts +140 -0
- package/{dist → src}/data/marketplaces.js +23 -24
- package/src/data/marketplaces.ts +95 -0
- package/src/data/mcp-servers.js +509 -0
- package/src/data/mcp-servers.ts +526 -0
- package/src/data/statuslines.js +159 -0
- package/src/data/statuslines.ts +188 -0
- package/src/index.js +4 -0
- package/src/index.ts +5 -0
- package/{dist → src}/main.js +46 -47
- package/src/main.tsx +145 -0
- package/src/opentui.d.ts +191 -0
- package/src/prerunner/index.js +87 -0
- package/src/prerunner/index.ts +124 -0
- package/{dist → src}/services/claude-runner.js +9 -10
- package/src/services/claude-runner.ts +31 -0
- package/{dist → src}/services/claude-settings.js +72 -33
- package/src/services/claude-settings.ts +934 -0
- package/src/services/local-marketplace.js +339 -0
- package/src/services/local-marketplace.ts +489 -0
- package/{dist → src}/services/mcp-registry.js +13 -14
- package/src/services/mcp-registry.ts +105 -0
- package/{dist → src}/services/plugin-manager.js +61 -13
- package/src/services/plugin-manager.ts +693 -0
- package/{dist → src}/services/plugin-mcp-config.js +19 -18
- package/src/services/plugin-mcp-config.ts +242 -0
- package/{dist → src}/services/update-cache.js +7 -8
- package/src/services/update-cache.ts +78 -0
- package/{dist → src}/services/version-check.js +15 -14
- package/src/services/version-check.ts +122 -0
- package/src/types/index.js +1 -0
- package/src/types/index.ts +141 -0
- package/src/ui/App.js +213 -0
- package/src/ui/App.tsx +359 -0
- package/src/ui/components/CategoryHeader.js +9 -0
- package/src/ui/components/CategoryHeader.tsx +41 -0
- package/{dist → src}/ui/components/ScrollableList.js +19 -6
- package/src/ui/components/ScrollableList.tsx +98 -0
- package/src/ui/components/SearchInput.js +19 -0
- package/src/ui/components/SearchInput.tsx +56 -0
- package/src/ui/components/StyledText.js +39 -0
- package/src/ui/components/StyledText.tsx +70 -0
- package/src/ui/components/TabBar.js +38 -0
- package/src/ui/components/TabBar.tsx +88 -0
- package/src/ui/components/layout/Panel.js +6 -0
- package/src/ui/components/layout/Panel.tsx +62 -0
- package/src/ui/components/layout/ProgressBar.js +14 -0
- package/src/ui/components/layout/ProgressBar.tsx +47 -0
- package/src/ui/components/layout/ScopeTabs.js +6 -0
- package/src/ui/components/layout/ScopeTabs.tsx +53 -0
- package/src/ui/components/layout/ScreenLayout.js +21 -0
- package/src/ui/components/layout/ScreenLayout.tsx +147 -0
- package/src/ui/components/layout/index.js +4 -0
- package/src/ui/components/layout/index.ts +4 -0
- package/src/ui/components/modals/ConfirmModal.js +14 -0
- package/src/ui/components/modals/ConfirmModal.tsx +59 -0
- package/src/ui/components/modals/InputModal.js +16 -0
- package/src/ui/components/modals/InputModal.tsx +68 -0
- package/src/ui/components/modals/LoadingModal.js +14 -0
- package/src/ui/components/modals/LoadingModal.tsx +40 -0
- package/src/ui/components/modals/MessageModal.js +16 -0
- package/src/ui/components/modals/MessageModal.tsx +64 -0
- package/src/ui/components/modals/ModalContainer.js +56 -0
- package/src/ui/components/modals/ModalContainer.tsx +104 -0
- package/src/ui/components/modals/SelectModal.js +26 -0
- package/src/ui/components/modals/SelectModal.tsx +82 -0
- package/src/ui/components/modals/index.js +6 -0
- package/src/ui/components/modals/index.ts +6 -0
- package/src/ui/hooks/index.js +3 -0
- package/src/ui/hooks/index.ts +3 -0
- package/{dist → src}/ui/hooks/useAsyncData.js +21 -22
- package/src/ui/hooks/useAsyncData.ts +127 -0
- package/src/ui/hooks/useKeyboard.js +13 -0
- package/src/ui/hooks/useKeyboard.ts +26 -0
- package/src/ui/hooks/useKeyboardHandler.js +39 -0
- package/src/ui/hooks/useKeyboardHandler.ts +63 -0
- package/{dist → src}/ui/screens/CliToolsScreen.js +60 -54
- package/src/ui/screens/CliToolsScreen.tsx +468 -0
- package/src/ui/screens/EnvVarsScreen.js +154 -0
- package/src/ui/screens/EnvVarsScreen.tsx +269 -0
- package/{dist → src}/ui/screens/McpRegistryScreen.js +56 -55
- package/src/ui/screens/McpRegistryScreen.tsx +331 -0
- package/{dist → src}/ui/screens/McpScreen.js +46 -47
- package/src/ui/screens/McpScreen.tsx +392 -0
- package/src/ui/screens/ModelSelectorScreen.js +292 -0
- package/src/ui/screens/ModelSelectorScreen.tsx +441 -0
- package/{dist → src}/ui/screens/PluginsScreen.js +305 -293
- package/src/ui/screens/PluginsScreen.tsx +1231 -0
- package/src/ui/screens/StatusLineScreen.js +200 -0
- package/src/ui/screens/StatusLineScreen.tsx +411 -0
- package/src/ui/screens/index.js +7 -0
- package/src/ui/screens/index.ts +7 -0
- package/src/ui/state/AnimationContext.js +34 -0
- package/src/ui/state/AnimationContext.tsx +76 -0
- package/{dist → src}/ui/state/AppContext.js +31 -32
- package/src/ui/state/AppContext.tsx +235 -0
- package/{dist → src}/ui/state/DimensionsContext.js +16 -17
- package/src/ui/state/DimensionsContext.tsx +144 -0
- package/{dist → src}/ui/state/reducer.js +89 -90
- package/src/ui/state/reducer.ts +467 -0
- package/src/ui/state/types.js +1 -0
- package/src/ui/state/types.ts +273 -0
- package/{dist → src}/utils/command-utils.js +3 -4
- package/src/utils/command-utils.ts +20 -0
- package/{dist → src}/utils/fuzzy-search.js +2 -3
- package/src/utils/fuzzy-search.ts +138 -0
- package/{dist → src}/utils/string-utils.js +6 -6
- package/src/utils/string-utils.ts +88 -0
- package/dist/data/cli-tools.d.ts +0 -13
- package/dist/data/cli-tools.d.ts.map +0 -1
- package/dist/data/cli-tools.js +0 -124
- package/dist/data/cli-tools.js.map +0 -1
- package/dist/data/marketplaces.d.ts +0 -6
- package/dist/data/marketplaces.d.ts.map +0 -1
- package/dist/data/marketplaces.js.map +0 -1
- package/dist/data/mcp-servers.d.ts +0 -8
- package/dist/data/mcp-servers.d.ts.map +0 -1
- package/dist/data/mcp-servers.js +0 -503
- package/dist/data/mcp-servers.js.map +0 -1
- package/dist/data/statuslines.d.ts +0 -10
- package/dist/data/statuslines.d.ts.map +0 -1
- package/dist/data/statuslines.js +0 -160
- package/dist/data/statuslines.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -90
- package/dist/index.js.map +0 -1
- package/dist/main.d.ts +0 -3
- package/dist/main.d.ts.map +0 -1
- package/dist/main.js.map +0 -1
- package/dist/prerunner/index.d.ts +0 -7
- package/dist/prerunner/index.d.ts.map +0 -1
- package/dist/prerunner/index.js +0 -64
- package/dist/prerunner/index.js.map +0 -1
- package/dist/services/claude-runner.d.ts +0 -7
- package/dist/services/claude-runner.d.ts.map +0 -1
- package/dist/services/claude-runner.js.map +0 -1
- package/dist/services/claude-settings.d.ts +0 -73
- package/dist/services/claude-settings.d.ts.map +0 -1
- package/dist/services/claude-settings.js.map +0 -1
- package/dist/services/local-marketplace.d.ts +0 -111
- package/dist/services/local-marketplace.d.ts.map +0 -1
- package/dist/services/local-marketplace.js +0 -599
- package/dist/services/local-marketplace.js.map +0 -1
- package/dist/services/mcp-registry.d.ts +0 -10
- package/dist/services/mcp-registry.d.ts.map +0 -1
- package/dist/services/mcp-registry.js.map +0 -1
- package/dist/services/plugin-manager.d.ts +0 -65
- package/dist/services/plugin-manager.d.ts.map +0 -1
- package/dist/services/plugin-manager.js.map +0 -1
- package/dist/services/plugin-mcp-config.d.ts +0 -52
- package/dist/services/plugin-mcp-config.d.ts.map +0 -1
- package/dist/services/plugin-mcp-config.js.map +0 -1
- package/dist/services/update-cache.d.ts +0 -16
- package/dist/services/update-cache.d.ts.map +0 -1
- package/dist/services/update-cache.js.map +0 -1
- package/dist/services/version-check.d.ts +0 -20
- package/dist/services/version-check.d.ts.map +0 -1
- package/dist/services/version-check.js.map +0 -1
- package/dist/types/index.d.ts +0 -105
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -2
- package/dist/types/index.js.map +0 -1
- package/dist/ui/InkApp.d.ts +0 -5
- package/dist/ui/InkApp.d.ts.map +0 -1
- package/dist/ui/InkApp.js +0 -188
- package/dist/ui/InkApp.js.map +0 -1
- package/dist/ui/components/CategoryHeader.d.ts +0 -16
- package/dist/ui/components/CategoryHeader.d.ts.map +0 -1
- package/dist/ui/components/CategoryHeader.js +0 -11
- package/dist/ui/components/CategoryHeader.js.map +0 -1
- package/dist/ui/components/ScrollableList.d.ts +0 -16
- package/dist/ui/components/ScrollableList.d.ts.map +0 -1
- package/dist/ui/components/ScrollableList.js.map +0 -1
- package/dist/ui/components/SearchInput.d.ts +0 -18
- package/dist/ui/components/SearchInput.d.ts.map +0 -1
- package/dist/ui/components/SearchInput.js +0 -30
- package/dist/ui/components/SearchInput.js.map +0 -1
- package/dist/ui/components/TabBar.d.ts +0 -8
- package/dist/ui/components/TabBar.d.ts.map +0 -1
- package/dist/ui/components/TabBar.js +0 -18
- package/dist/ui/components/TabBar.js.map +0 -1
- package/dist/ui/components/layout/Footer.d.ts +0 -14
- package/dist/ui/components/layout/Footer.d.ts.map +0 -1
- package/dist/ui/components/layout/Footer.js +0 -23
- package/dist/ui/components/layout/Footer.js.map +0 -1
- package/dist/ui/components/layout/Header.d.ts +0 -4
- package/dist/ui/components/layout/Header.d.ts.map +0 -1
- package/dist/ui/components/layout/Header.js +0 -25
- package/dist/ui/components/layout/Header.js.map +0 -1
- package/dist/ui/components/layout/Panel.d.ts +0 -22
- package/dist/ui/components/layout/Panel.d.ts.map +0 -1
- package/dist/ui/components/layout/Panel.js +0 -8
- package/dist/ui/components/layout/Panel.js.map +0 -1
- package/dist/ui/components/layout/ProgressBar.d.ts +0 -12
- package/dist/ui/components/layout/ProgressBar.d.ts.map +0 -1
- package/dist/ui/components/layout/ProgressBar.js +0 -16
- package/dist/ui/components/layout/ProgressBar.js.map +0 -1
- package/dist/ui/components/layout/ScopeTabs.d.ts +0 -12
- package/dist/ui/components/layout/ScopeTabs.d.ts.map +0 -1
- package/dist/ui/components/layout/ScopeTabs.js +0 -8
- package/dist/ui/components/layout/ScopeTabs.js.map +0 -1
- package/dist/ui/components/layout/ScreenLayout.d.ts +0 -30
- package/dist/ui/components/layout/ScreenLayout.d.ts.map +0 -1
- package/dist/ui/components/layout/ScreenLayout.js +0 -23
- package/dist/ui/components/layout/ScreenLayout.js.map +0 -1
- package/dist/ui/components/layout/index.d.ts +0 -7
- package/dist/ui/components/layout/index.d.ts.map +0 -1
- package/dist/ui/components/layout/index.js +0 -7
- package/dist/ui/components/layout/index.js.map +0 -1
- package/dist/ui/components/modals/ConfirmModal.d.ts +0 -14
- package/dist/ui/components/modals/ConfirmModal.d.ts.map +0 -1
- package/dist/ui/components/modals/ConfirmModal.js +0 -15
- package/dist/ui/components/modals/ConfirmModal.js.map +0 -1
- package/dist/ui/components/modals/InputModal.d.ts +0 -16
- package/dist/ui/components/modals/InputModal.d.ts.map +0 -1
- package/dist/ui/components/modals/InputModal.js +0 -23
- package/dist/ui/components/modals/InputModal.js.map +0 -1
- package/dist/ui/components/modals/LoadingModal.d.ts +0 -8
- package/dist/ui/components/modals/LoadingModal.d.ts.map +0 -1
- package/dist/ui/components/modals/LoadingModal.js +0 -8
- package/dist/ui/components/modals/LoadingModal.js.map +0 -1
- package/dist/ui/components/modals/MessageModal.d.ts +0 -14
- package/dist/ui/components/modals/MessageModal.d.ts.map +0 -1
- package/dist/ui/components/modals/MessageModal.js +0 -17
- package/dist/ui/components/modals/MessageModal.js.map +0 -1
- package/dist/ui/components/modals/ModalContainer.d.ts +0 -7
- package/dist/ui/components/modals/ModalContainer.d.ts.map +0 -1
- package/dist/ui/components/modals/ModalContainer.js +0 -38
- package/dist/ui/components/modals/ModalContainer.js.map +0 -1
- package/dist/ui/components/modals/SelectModal.d.ts +0 -17
- package/dist/ui/components/modals/SelectModal.d.ts.map +0 -1
- package/dist/ui/components/modals/SelectModal.js +0 -33
- package/dist/ui/components/modals/SelectModal.js.map +0 -1
- package/dist/ui/components/modals/index.d.ts +0 -7
- package/dist/ui/components/modals/index.d.ts.map +0 -1
- package/dist/ui/components/modals/index.js +0 -7
- package/dist/ui/components/modals/index.js.map +0 -1
- package/dist/ui/hooks/index.d.ts +0 -3
- package/dist/ui/hooks/index.d.ts.map +0 -1
- package/dist/ui/hooks/index.js +0 -3
- package/dist/ui/hooks/index.js.map +0 -1
- package/dist/ui/hooks/useAsyncData.d.ts +0 -40
- package/dist/ui/hooks/useAsyncData.d.ts.map +0 -1
- package/dist/ui/hooks/useAsyncData.js.map +0 -1
- package/dist/ui/hooks/useKeyboardNavigation.d.ts +0 -27
- package/dist/ui/hooks/useKeyboardNavigation.d.ts.map +0 -1
- package/dist/ui/hooks/useKeyboardNavigation.js +0 -82
- package/dist/ui/hooks/useKeyboardNavigation.js.map +0 -1
- package/dist/ui/screens/CliToolsScreen.d.ts +0 -4
- package/dist/ui/screens/CliToolsScreen.d.ts.map +0 -1
- package/dist/ui/screens/CliToolsScreen.js.map +0 -1
- package/dist/ui/screens/EnvVarsScreen.d.ts +0 -4
- package/dist/ui/screens/EnvVarsScreen.d.ts.map +0 -1
- package/dist/ui/screens/EnvVarsScreen.js +0 -145
- package/dist/ui/screens/EnvVarsScreen.js.map +0 -1
- package/dist/ui/screens/McpRegistryScreen.d.ts +0 -4
- package/dist/ui/screens/McpRegistryScreen.d.ts.map +0 -1
- package/dist/ui/screens/McpRegistryScreen.js.map +0 -1
- package/dist/ui/screens/McpScreen.d.ts +0 -4
- package/dist/ui/screens/McpScreen.d.ts.map +0 -1
- package/dist/ui/screens/McpScreen.js.map +0 -1
- package/dist/ui/screens/ModelSelectorScreen.d.ts +0 -4
- package/dist/ui/screens/ModelSelectorScreen.d.ts.map +0 -1
- package/dist/ui/screens/ModelSelectorScreen.js +0 -143
- package/dist/ui/screens/ModelSelectorScreen.js.map +0 -1
- package/dist/ui/screens/PluginsScreen.d.ts +0 -4
- package/dist/ui/screens/PluginsScreen.d.ts.map +0 -1
- package/dist/ui/screens/PluginsScreen.js.map +0 -1
- package/dist/ui/screens/StatusLineScreen.d.ts +0 -4
- package/dist/ui/screens/StatusLineScreen.d.ts.map +0 -1
- package/dist/ui/screens/StatusLineScreen.js +0 -197
- package/dist/ui/screens/StatusLineScreen.js.map +0 -1
- package/dist/ui/screens/index.d.ts +0 -8
- package/dist/ui/screens/index.d.ts.map +0 -1
- package/dist/ui/screens/index.js +0 -8
- package/dist/ui/screens/index.js.map +0 -1
- package/dist/ui/state/AppContext.d.ts +0 -40
- package/dist/ui/state/AppContext.d.ts.map +0 -1
- package/dist/ui/state/AppContext.js.map +0 -1
- package/dist/ui/state/DimensionsContext.d.ts +0 -27
- package/dist/ui/state/DimensionsContext.d.ts.map +0 -1
- package/dist/ui/state/DimensionsContext.js.map +0 -1
- package/dist/ui/state/reducer.d.ts +0 -4
- package/dist/ui/state/reducer.d.ts.map +0 -1
- package/dist/ui/state/reducer.js.map +0 -1
- package/dist/ui/state/types.d.ts +0 -266
- package/dist/ui/state/types.d.ts.map +0 -1
- package/dist/ui/state/types.js +0 -2
- package/dist/ui/state/types.js.map +0 -1
- package/dist/utils/command-utils.d.ts +0 -8
- package/dist/utils/command-utils.d.ts.map +0 -1
- package/dist/utils/command-utils.js.map +0 -1
- package/dist/utils/fuzzy-search.d.ts +0 -33
- package/dist/utils/fuzzy-search.d.ts.map +0 -1
- package/dist/utils/fuzzy-search.js.map +0 -1
- package/dist/utils/string-utils.d.ts +0 -24
- package/dist/utils/string-utils.d.ts.map +0 -1
- package/dist/utils/string-utils.js.map +0 -1
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import fs from "fs-extra";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import { execSync } from "node:child_process";
|
|
5
|
+
const CLAUDE_PLUGINS_DIR = path.join(os.homedir(), ".claude", "plugins", "marketplaces");
|
|
6
|
+
const KNOWN_MARKETPLACES_FILE = path.join(os.homedir(), ".claude", "plugins", "known_marketplaces.json");
|
|
7
|
+
/**
|
|
8
|
+
* Read known_marketplaces.json (Claude Code's internal marketplace tracking)
|
|
9
|
+
*/
|
|
10
|
+
async function readKnownMarketplaces() {
|
|
11
|
+
try {
|
|
12
|
+
if (await fs.pathExists(KNOWN_MARKETPLACES_FILE)) {
|
|
13
|
+
return await fs.readJson(KNOWN_MARKETPLACES_FILE);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
// Return empty if can't read
|
|
18
|
+
}
|
|
19
|
+
return {};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get git remote URL from a marketplace directory
|
|
23
|
+
*/
|
|
24
|
+
function getGitRemote(marketplacePath) {
|
|
25
|
+
try {
|
|
26
|
+
const gitDir = path.join(marketplacePath, ".git");
|
|
27
|
+
if (!fs.existsSync(gitDir))
|
|
28
|
+
return undefined;
|
|
29
|
+
const result = execSync("git remote get-url origin", {
|
|
30
|
+
cwd: marketplacePath,
|
|
31
|
+
encoding: "utf-8",
|
|
32
|
+
timeout: 5000,
|
|
33
|
+
}).trim();
|
|
34
|
+
// Convert SSH URL to HTTPS format: git@github.com:user/repo.git -> user/repo
|
|
35
|
+
if (result.startsWith("git@github.com:")) {
|
|
36
|
+
return result.replace("git@github.com:", "").replace(/\.git$/, "");
|
|
37
|
+
}
|
|
38
|
+
// HTTPS URL: https://github.com/user/repo -> user/repo
|
|
39
|
+
if (result.includes("github.com")) {
|
|
40
|
+
const match = result.match(/github\.com[/:]([^/]+\/[^/\s.]+)/);
|
|
41
|
+
if (match)
|
|
42
|
+
return match[1].replace(/\.git$/, "");
|
|
43
|
+
}
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Scan a single marketplace directory and return marketplace info
|
|
52
|
+
*/
|
|
53
|
+
async function scanSingleMarketplace(marketplacePath, marketplaceName) {
|
|
54
|
+
const manifestPath = path.join(marketplacePath, ".claude-plugin", "marketplace.json");
|
|
55
|
+
if (!(await fs.pathExists(manifestPath)))
|
|
56
|
+
return null;
|
|
57
|
+
try {
|
|
58
|
+
const manifest = await fs.readJson(manifestPath);
|
|
59
|
+
const gitRepo = getGitRemote(marketplacePath);
|
|
60
|
+
const plugins = [];
|
|
61
|
+
const validManifestPlugins = [];
|
|
62
|
+
let manifestModified = false;
|
|
63
|
+
if (manifest.plugins && Array.isArray(manifest.plugins)) {
|
|
64
|
+
for (const plugin of manifest.plugins) {
|
|
65
|
+
// Try to scan plugin directory for component counts
|
|
66
|
+
let agents = [];
|
|
67
|
+
let commands = [];
|
|
68
|
+
let skills = [];
|
|
69
|
+
let mcpServers = [];
|
|
70
|
+
// Handle both string sources (local paths) and object sources (remote URLs)
|
|
71
|
+
const sourceStr = typeof plugin.source === "string" ? plugin.source : null;
|
|
72
|
+
if (sourceStr) {
|
|
73
|
+
const pluginPath = path.join(marketplacePath, sourceStr.replace("./", ""));
|
|
74
|
+
// Remove plugins whose source directory doesn't exist
|
|
75
|
+
if (!(await fs.pathExists(pluginPath))) {
|
|
76
|
+
manifestModified = true;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
// Scan for agents
|
|
81
|
+
const agentsDir = path.join(pluginPath, "agents");
|
|
82
|
+
if (await fs.pathExists(agentsDir)) {
|
|
83
|
+
const agentFiles = await fs.readdir(agentsDir);
|
|
84
|
+
agents = agentFiles
|
|
85
|
+
.filter((f) => f.endsWith(".md"))
|
|
86
|
+
.map((f) => f.replace(".md", ""));
|
|
87
|
+
}
|
|
88
|
+
// Scan for commands
|
|
89
|
+
const commandsDir = path.join(pluginPath, "commands");
|
|
90
|
+
if (await fs.pathExists(commandsDir)) {
|
|
91
|
+
const cmdFiles = await fs.readdir(commandsDir);
|
|
92
|
+
commands = cmdFiles
|
|
93
|
+
.filter((f) => f.endsWith(".md"))
|
|
94
|
+
.map((f) => f.replace(".md", ""));
|
|
95
|
+
}
|
|
96
|
+
// Scan for skills
|
|
97
|
+
const skillsDir = path.join(pluginPath, "skills");
|
|
98
|
+
if (await fs.pathExists(skillsDir)) {
|
|
99
|
+
const skillFiles = await fs.readdir(skillsDir);
|
|
100
|
+
skills = skillFiles.filter((f) => f.endsWith(".md") ||
|
|
101
|
+
fs.statSync(path.join(skillsDir, f)).isDirectory());
|
|
102
|
+
}
|
|
103
|
+
// Scan for MCP servers
|
|
104
|
+
const mcpDir = path.join(pluginPath, "mcp-servers");
|
|
105
|
+
if (await fs.pathExists(mcpDir)) {
|
|
106
|
+
const mcpFiles = await fs.readdir(mcpDir);
|
|
107
|
+
mcpServers = mcpFiles
|
|
108
|
+
.filter((f) => f.endsWith(".json"))
|
|
109
|
+
.map((f) => f.replace(".json", ""));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
// Ignore scan errors
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
validManifestPlugins.push(plugin);
|
|
117
|
+
plugins.push({
|
|
118
|
+
name: plugin.name,
|
|
119
|
+
version: plugin.version || "0.0.0",
|
|
120
|
+
description: plugin.description || "",
|
|
121
|
+
source: plugin.source,
|
|
122
|
+
category: plugin.category,
|
|
123
|
+
author: plugin.author,
|
|
124
|
+
strict: plugin.strict,
|
|
125
|
+
lspServers: plugin.lspServers,
|
|
126
|
+
agents,
|
|
127
|
+
commands,
|
|
128
|
+
skills,
|
|
129
|
+
mcpServers,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// Update marketplace.json if we removed invalid plugins
|
|
134
|
+
if (manifestModified) {
|
|
135
|
+
manifest.plugins = validManifestPlugins;
|
|
136
|
+
await fs.writeJson(manifestPath, manifest, { spaces: 2 });
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
name: manifest.name || marketplaceName,
|
|
140
|
+
description: manifest.description || manifest.metadata?.description || "",
|
|
141
|
+
plugins,
|
|
142
|
+
gitRepo,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Scan local marketplace cache and return marketplace info
|
|
151
|
+
* Includes both:
|
|
152
|
+
* - Marketplaces in ~/.claude/plugins/marketplaces/
|
|
153
|
+
* - Directory-based marketplaces from known_marketplaces.json
|
|
154
|
+
*/
|
|
155
|
+
export async function scanLocalMarketplaces() {
|
|
156
|
+
const marketplaces = new Map();
|
|
157
|
+
// 1. Scan marketplaces from the standard directory
|
|
158
|
+
if (await fs.pathExists(CLAUDE_PLUGINS_DIR)) {
|
|
159
|
+
try {
|
|
160
|
+
const entries = await fs.readdir(CLAUDE_PLUGINS_DIR, {
|
|
161
|
+
withFileTypes: true,
|
|
162
|
+
});
|
|
163
|
+
for (const entry of entries) {
|
|
164
|
+
if (!entry.isDirectory())
|
|
165
|
+
continue;
|
|
166
|
+
const marketplacePath = path.join(CLAUDE_PLUGINS_DIR, entry.name);
|
|
167
|
+
const marketplace = await scanSingleMarketplace(marketplacePath, entry.name);
|
|
168
|
+
if (marketplace) {
|
|
169
|
+
marketplaces.set(entry.name, marketplace);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
// Ignore read errors
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// 2. Add directory-based marketplaces from known_marketplaces.json
|
|
178
|
+
try {
|
|
179
|
+
const known = await readKnownMarketplaces();
|
|
180
|
+
for (const [name, entry] of Object.entries(known)) {
|
|
181
|
+
// Only add if it's a directory source AND not already in the map
|
|
182
|
+
if (entry.source.source === "directory" &&
|
|
183
|
+
entry.installLocation &&
|
|
184
|
+
!marketplaces.has(name)) {
|
|
185
|
+
if (await fs.pathExists(entry.installLocation)) {
|
|
186
|
+
const marketplace = await scanSingleMarketplace(entry.installLocation, name);
|
|
187
|
+
if (marketplace) {
|
|
188
|
+
marketplaces.set(name, marketplace);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
// Ignore errors reading known_marketplaces
|
|
196
|
+
}
|
|
197
|
+
return marketplaces;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Get a specific local marketplace by name
|
|
201
|
+
*/
|
|
202
|
+
export async function getLocalMarketplace(name) {
|
|
203
|
+
const marketplaces = await scanLocalMarketplaces();
|
|
204
|
+
return marketplaces.get(name);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Check if a marketplace exists in local cache
|
|
208
|
+
*/
|
|
209
|
+
export async function hasLocalMarketplace(name) {
|
|
210
|
+
const marketplacePath = path.join(CLAUDE_PLUGINS_DIR, name);
|
|
211
|
+
const manifestPath = path.join(marketplacePath, ".claude-plugin", "marketplace.json");
|
|
212
|
+
return fs.pathExists(manifestPath);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Repair a plugin's plugin.json by adding missing agents/commands/skills arrays
|
|
216
|
+
* based on what files exist on disk.
|
|
217
|
+
*
|
|
218
|
+
* This fixes plugins where the author forgot to add the arrays to plugin.json,
|
|
219
|
+
* causing Claude Code to not load the agents/commands even though files exist.
|
|
220
|
+
*/
|
|
221
|
+
export async function repairPluginJson(pluginPath) {
|
|
222
|
+
const pluginJsonPath = path.join(pluginPath, ".claude-plugin", "plugin.json");
|
|
223
|
+
const pluginName = path.basename(pluginPath);
|
|
224
|
+
const result = {
|
|
225
|
+
repaired: false,
|
|
226
|
+
pluginName,
|
|
227
|
+
added: { agents: [], commands: [], skills: [] },
|
|
228
|
+
};
|
|
229
|
+
if (!(await fs.pathExists(pluginJsonPath))) {
|
|
230
|
+
return result;
|
|
231
|
+
}
|
|
232
|
+
try {
|
|
233
|
+
const pluginJson = await fs.readJson(pluginJsonPath);
|
|
234
|
+
let modified = false;
|
|
235
|
+
// Scan and add agents if array is missing
|
|
236
|
+
const agentsDir = path.join(pluginPath, "agents");
|
|
237
|
+
if (await fs.pathExists(agentsDir)) {
|
|
238
|
+
const files = (await fs.readdir(agentsDir))
|
|
239
|
+
.filter((f) => f.endsWith(".md"))
|
|
240
|
+
.map((f) => `./agents/${f}`);
|
|
241
|
+
if (files.length > 0 && !pluginJson.agents) {
|
|
242
|
+
pluginJson.agents = files;
|
|
243
|
+
result.added.agents = files;
|
|
244
|
+
modified = true;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
// Scan and add commands if array is missing
|
|
248
|
+
const commandsDir = path.join(pluginPath, "commands");
|
|
249
|
+
if (await fs.pathExists(commandsDir)) {
|
|
250
|
+
const files = (await fs.readdir(commandsDir))
|
|
251
|
+
.filter((f) => f.endsWith(".md"))
|
|
252
|
+
.map((f) => `./commands/${f}`);
|
|
253
|
+
if (files.length > 0 && !pluginJson.commands) {
|
|
254
|
+
pluginJson.commands = files;
|
|
255
|
+
result.added.commands = files;
|
|
256
|
+
modified = true;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
// Scan and add skills if array is missing
|
|
260
|
+
const skillsDir = path.join(pluginPath, "skills");
|
|
261
|
+
if (await fs.pathExists(skillsDir)) {
|
|
262
|
+
const entries = await fs.readdir(skillsDir, { withFileTypes: true });
|
|
263
|
+
const skills = entries
|
|
264
|
+
.filter((e) => e.isDirectory() || e.name.endsWith(".md"))
|
|
265
|
+
.map((e) => `./skills/${e.name}`);
|
|
266
|
+
if (skills.length > 0 && !pluginJson.skills) {
|
|
267
|
+
pluginJson.skills = skills;
|
|
268
|
+
result.added.skills = skills;
|
|
269
|
+
modified = true;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
if (modified) {
|
|
273
|
+
await fs.writeJson(pluginJsonPath, pluginJson, { spaces: 2 });
|
|
274
|
+
result.repaired = true;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
catch {
|
|
278
|
+
// Ignore repair errors for individual plugins
|
|
279
|
+
}
|
|
280
|
+
return result;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Repair all plugins in a marketplace
|
|
284
|
+
*/
|
|
285
|
+
export async function repairMarketplacePlugins(marketplaceName) {
|
|
286
|
+
const result = {
|
|
287
|
+
marketplace: marketplaceName,
|
|
288
|
+
repaired: [],
|
|
289
|
+
};
|
|
290
|
+
const marketplacePath = path.join(CLAUDE_PLUGINS_DIR, marketplaceName);
|
|
291
|
+
const manifestPath = path.join(marketplacePath, ".claude-plugin", "marketplace.json");
|
|
292
|
+
if (!(await fs.pathExists(manifestPath))) {
|
|
293
|
+
return result;
|
|
294
|
+
}
|
|
295
|
+
try {
|
|
296
|
+
const manifest = await fs.readJson(manifestPath);
|
|
297
|
+
if (manifest.plugins && Array.isArray(manifest.plugins)) {
|
|
298
|
+
for (const plugin of manifest.plugins) {
|
|
299
|
+
if (plugin.source) {
|
|
300
|
+
const pluginPath = path.join(marketplacePath, plugin.source.replace("./", ""));
|
|
301
|
+
const repairResult = await repairPluginJson(pluginPath);
|
|
302
|
+
if (repairResult.repaired) {
|
|
303
|
+
result.repaired.push(repairResult);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
catch {
|
|
310
|
+
// Ignore errors
|
|
311
|
+
}
|
|
312
|
+
return result;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Repair all plugins in all marketplaces
|
|
316
|
+
*/
|
|
317
|
+
export async function repairAllMarketplaces() {
|
|
318
|
+
const results = [];
|
|
319
|
+
if (!(await fs.pathExists(CLAUDE_PLUGINS_DIR))) {
|
|
320
|
+
return results;
|
|
321
|
+
}
|
|
322
|
+
try {
|
|
323
|
+
const entries = await fs.readdir(CLAUDE_PLUGINS_DIR, {
|
|
324
|
+
withFileTypes: true,
|
|
325
|
+
});
|
|
326
|
+
for (const entry of entries) {
|
|
327
|
+
if (!entry.isDirectory())
|
|
328
|
+
continue;
|
|
329
|
+
const repairResult = await repairMarketplacePlugins(entry.name);
|
|
330
|
+
if (repairResult.repaired.length > 0) {
|
|
331
|
+
results.push(repairResult);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
catch {
|
|
336
|
+
// Return empty on error
|
|
337
|
+
}
|
|
338
|
+
return results;
|
|
339
|
+
}
|