@thebushidocollective/han 1.41.0 → 1.41.2
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/han.js +76 -0
- package/dist/lib/build-info.generated.d.ts +1 -1
- package/dist/lib/build-info.generated.js +1 -1
- package/dist/lib/commands/mcp/index.d.ts +3 -0
- package/dist/lib/commands/mcp/index.d.ts.map +1 -0
- package/dist/lib/commands/mcp/index.js +13 -0
- package/dist/lib/commands/mcp/index.js.map +1 -0
- package/dist/lib/commands/mcp/server.d.ts +2 -0
- package/dist/lib/commands/mcp/server.d.ts.map +1 -0
- package/dist/lib/commands/mcp/server.js +167 -0
- package/dist/lib/commands/mcp/server.js.map +1 -0
- package/dist/lib/commands/mcp/tools.d.ts +25 -0
- package/dist/lib/commands/mcp/tools.d.ts.map +1 -0
- package/dist/lib/commands/mcp/tools.js +293 -0
- package/dist/lib/commands/mcp/tools.js.map +1 -0
- package/dist/lib/main.js +2 -0
- package/dist/lib/main.js.map +1 -1
- package/package.json +6 -6
package/bin/han.js
CHANGED
|
@@ -160,6 +160,43 @@ function tryRunBinary() {
|
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
+
// Retry logic for CDN propagation delays
|
|
164
|
+
async function waitForPackageAvailability(packageName, maxRetries = 5) {
|
|
165
|
+
const baseDelay = 2000; // 2 seconds
|
|
166
|
+
|
|
167
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
168
|
+
try {
|
|
169
|
+
const controller = new AbortController();
|
|
170
|
+
const timeout = setTimeout(() => controller.abort(), 5000);
|
|
171
|
+
|
|
172
|
+
const response = await fetch(
|
|
173
|
+
`https://registry.npmjs.org/${packageName}`,
|
|
174
|
+
{ signal: controller.signal },
|
|
175
|
+
);
|
|
176
|
+
clearTimeout(timeout);
|
|
177
|
+
|
|
178
|
+
if (response.ok) {
|
|
179
|
+
const data = await response.json();
|
|
180
|
+
if (data["dist-tags"]?.latest) {
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
} catch {
|
|
185
|
+
// Network error, continue retrying
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (attempt < maxRetries) {
|
|
189
|
+
const delay = baseDelay * 2 ** (attempt - 1); // Exponential backoff
|
|
190
|
+
console.error(
|
|
191
|
+
`\x1b[33m⏳ Waiting for package availability (attempt ${attempt}/${maxRetries})...\x1b[0m`,
|
|
192
|
+
);
|
|
193
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
|
|
163
200
|
// Run binary - no JS fallback in production
|
|
164
201
|
if (!tryRunBinary()) {
|
|
165
202
|
const platformKey = getPlatformKey();
|
|
@@ -173,6 +210,45 @@ if (!tryRunBinary()) {
|
|
|
173
210
|
process.exit(1);
|
|
174
211
|
}
|
|
175
212
|
|
|
213
|
+
// Check if this might be a CDN propagation issue and retry
|
|
214
|
+
const scriptPath = fileURLToPath(import.meta.url);
|
|
215
|
+
if (scriptPath.includes("_npx") && !process.env.HAN_NO_RETRY) {
|
|
216
|
+
console.error(
|
|
217
|
+
`\x1b[33m⚠ Platform binary not found, checking for CDN propagation delay...\x1b[0m`,
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
const isAvailable = await waitForPackageAvailability(packageName);
|
|
221
|
+
|
|
222
|
+
if (isAvailable) {
|
|
223
|
+
// Clear cache and retry once more
|
|
224
|
+
try {
|
|
225
|
+
execSync("npx clear-npx-cache", { stdio: "pipe" });
|
|
226
|
+
} catch {
|
|
227
|
+
const { homedir } = await import("node:os");
|
|
228
|
+
const npxCachePath = join(homedir(), ".npm", "_npx");
|
|
229
|
+
if (existsSync(npxCachePath)) {
|
|
230
|
+
const { rmSync } = await import("node:fs");
|
|
231
|
+
rmSync(npxCachePath, { recursive: true, force: true });
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
console.error(`\x1b[32m✓ Package available, retrying...\x1b[0m`);
|
|
236
|
+
|
|
237
|
+
const args = process.argv.slice(2);
|
|
238
|
+
const result = spawnSync(
|
|
239
|
+
"npx",
|
|
240
|
+
["-y", "@thebushidocollective/han@latest", ...args],
|
|
241
|
+
{
|
|
242
|
+
stdio: "inherit",
|
|
243
|
+
env: { ...process.env, HAN_NO_RETRY: "1" },
|
|
244
|
+
shell: true,
|
|
245
|
+
},
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
process.exit(result.status ?? 0);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
176
252
|
console.error(
|
|
177
253
|
`\x1b[31mError: Platform binary not found for ${platformKey}\x1b[0m`,
|
|
178
254
|
);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const HAN_VERSION = "1.41.
|
|
1
|
+
export declare const HAN_VERSION = "1.41.2";
|
|
2
2
|
export declare const DETECT_PLUGINS_PROMPT = "<!--\nThis prompt template is dynamically enhanced in shared.ts with:\n1. GIT REPOSITORY section - Remote URL to determine hosting platform (GitHub, GitLab, etc.)\n2. CURRENTLY INSTALLED PLUGINS section - List of plugins already installed (if any)\n3. CODEBASE STATISTICS section - File extensions and config file names from codebase-analyzer.ts\n4. AVAILABLE PLUGINS IN MARKETPLACE section - Plugin list from marketplace.json\n\nThese sections are appended to this base prompt at runtime.\n-->\n\n# Han Plugin Installer Assistant\n\nYou are a Han plugin installer assistant. Your goal is to analyze the current codebase and recommend appropriate Claude Code plugins from the Han marketplace.\n\nThe available plugins from the marketplace are provided below. ONLY recommend plugins from this list.\n\n## Plugin Categories\n\n- **jutsu-\\*** (\u6B66\u5668 weapons): Skills for specific technologies and frameworks\n- **do-\\*** (\u9053 disciplines): Specialized agents for development practices and workflows\n- **hashi-\\*** (\u5148\u751F teachers): MCP servers for external integrations\n- **bushido**: Core quality principles (ALWAYS recommend this)\n\n## Your Analysis Process\n\n### STEP 1: Analyze currently installed plugins (if provided)\n\n- Check if CURRENTLY INSTALLED PLUGINS section is provided in the prompt\n- If provided, you should:\n - **Understand why each plugin was likely added**: Look at plugin descriptions and infer original use case\n - Example: `jutsu-typescript` suggests TypeScript development\n - Example: `hashi-github` suggests GitHub integration needs\n - Example: `do-frontend-development` suggests frontend focus\n - **Determine if each plugin is still relevant**:\n - Use the codebase statistics and configuration files to verify if the technology/practice is still in use\n - A plugin is still relevant if its associated technology/practice is actively used in the codebase\n - A plugin may be irrelevant if:\n - The technology was removed (e.g., no more .ts files but jutsu-typescript is installed)\n - The project migrated to a different platform (e.g., moved from GitHub to GitLab)\n - The framework changed (e.g., migrated from React to Vue)\n - **Keep relevant plugins in your recommendations**: If a plugin is still relevant, include it in your final list\n - **Exclude irrelevant plugins**: If a plugin is no longer needed, do not include it in your recommendations\n\n### STEP 2: Check git repository hosting platform (if provided)\n\n- Check if GIT REPOSITORY section is provided in the prompt\n- If provided, examine the remote URL to determine the hosting platform:\n - URLs containing `github.com` \u2192 recommend `hashi-github`\n - URLs containing `gitlab.com` or other GitLab instances \u2192 recommend `hashi-gitlab`\n - This helps integrate Claude Code with the project's issue tracking, PRs/MRs, and CI/CD\n\n### STEP 3: Review pre-computed codebase statistics (if provided)\n\n- Check if CODEBASE STATISTICS section is provided in the prompt\n- If provided, you have:\n - **File extension counts** (e.g., .ts: 456, .py: 123) - interpret these as technologies\n - .ts, .tsx, .jsx = TypeScript/JavaScript\n - .py = Python\n - .rs = Rust\n - .go = Go\n - .rb = Ruby\n - .ex, .exs = Elixir\n - .vue = Vue.js\n - etc.\n - **Config file names** (e.g., package.json, Cargo.toml, go.mod) - these reveal frameworks and tools\n- If statistics are NOT provided, use Glob to discover file types\n - Example: glob(\"\\*_/_.ts\") to find TypeScript files\n - Example: glob(\"\\*_/_.py\") to find Python files\n\n### STEP 4: Examine key configuration files\n\n- Config files are already identified in the statistics (if provided)\n- Use Read tool to examine important config files:\n - package.json - reveals Node.js frameworks, dependencies\n - Cargo.toml - reveals Rust dependencies\n - go.mod - reveals Go dependencies\n - requirements.txt, pyproject.toml - reveals Python dependencies\n - mix.exs - reveals Elixir dependencies\n- Use Grep to search for framework-specific patterns\n - Example: grep(\"import.\\*react\") to confirm React usage\n - Example: grep(\"from django\") to confirm Django usage\n\n### STEP 5: Identify technologies and patterns\n\n- Programming languages (TypeScript, Python, Go, Rust, Ruby, etc.)\n- Frameworks and libraries (React, Vue, Django, Rails, etc.)\n- Testing frameworks (Jest, Pytest, RSpec, etc.)\n- Build tools and infrastructure (Docker, Kubernetes, etc.)\n- Development practices (API development, frontend development, mobile, etc.)\n- Content patterns (blog posts, documentation, CMS usage)\n- CI/CD configurations\n- Accessibility tooling\n\n### STEP 6: Match findings to available plugins\n\n- Look at the plugin descriptions and keywords below\n- Cross-reference detected technologies with available jutsu-\\* plugins\n- Cross-reference development practices with available do-\\* plugins\n- Cross-reference integrations with available hashi-\\* plugins\n- ONLY recommend plugins from the list provided\n- Aim for 3-8 total plugins that best match the codebase\n- Always include \"bushido\" as it's the core plugin\n\n## Output Format\n\nReturn ONLY a JSON array of recommended plugin names from the available plugins list:\n\n```json\n[\"bushido\", \"jutsu-typescript\", \"jutsu-react\", \"do-frontend-development\"]\n```\n\n**CRITICAL**: Only recommend plugins that appear in the AVAILABLE PLUGINS list below. Never recommend plugins not in the list.\n";
|
|
3
3
|
//# sourceMappingURL=build-info.generated.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// Auto-generated by build-bundle.js - DO NOT EDIT
|
|
2
|
-
export const HAN_VERSION = "1.41.
|
|
2
|
+
export const HAN_VERSION = "1.41.2";
|
|
3
3
|
export const DETECT_PLUGINS_PROMPT = "<!--\nThis prompt template is dynamically enhanced in shared.ts with:\n1. GIT REPOSITORY section - Remote URL to determine hosting platform (GitHub, GitLab, etc.)\n2. CURRENTLY INSTALLED PLUGINS section - List of plugins already installed (if any)\n3. CODEBASE STATISTICS section - File extensions and config file names from codebase-analyzer.ts\n4. AVAILABLE PLUGINS IN MARKETPLACE section - Plugin list from marketplace.json\n\nThese sections are appended to this base prompt at runtime.\n-->\n\n# Han Plugin Installer Assistant\n\nYou are a Han plugin installer assistant. Your goal is to analyze the current codebase and recommend appropriate Claude Code plugins from the Han marketplace.\n\nThe available plugins from the marketplace are provided below. ONLY recommend plugins from this list.\n\n## Plugin Categories\n\n- **jutsu-\\*** (武器 weapons): Skills for specific technologies and frameworks\n- **do-\\*** (道 disciplines): Specialized agents for development practices and workflows\n- **hashi-\\*** (先生 teachers): MCP servers for external integrations\n- **bushido**: Core quality principles (ALWAYS recommend this)\n\n## Your Analysis Process\n\n### STEP 1: Analyze currently installed plugins (if provided)\n\n- Check if CURRENTLY INSTALLED PLUGINS section is provided in the prompt\n- If provided, you should:\n - **Understand why each plugin was likely added**: Look at plugin descriptions and infer original use case\n - Example: `jutsu-typescript` suggests TypeScript development\n - Example: `hashi-github` suggests GitHub integration needs\n - Example: `do-frontend-development` suggests frontend focus\n - **Determine if each plugin is still relevant**:\n - Use the codebase statistics and configuration files to verify if the technology/practice is still in use\n - A plugin is still relevant if its associated technology/practice is actively used in the codebase\n - A plugin may be irrelevant if:\n - The technology was removed (e.g., no more .ts files but jutsu-typescript is installed)\n - The project migrated to a different platform (e.g., moved from GitHub to GitLab)\n - The framework changed (e.g., migrated from React to Vue)\n - **Keep relevant plugins in your recommendations**: If a plugin is still relevant, include it in your final list\n - **Exclude irrelevant plugins**: If a plugin is no longer needed, do not include it in your recommendations\n\n### STEP 2: Check git repository hosting platform (if provided)\n\n- Check if GIT REPOSITORY section is provided in the prompt\n- If provided, examine the remote URL to determine the hosting platform:\n - URLs containing `github.com` → recommend `hashi-github`\n - URLs containing `gitlab.com` or other GitLab instances → recommend `hashi-gitlab`\n - This helps integrate Claude Code with the project's issue tracking, PRs/MRs, and CI/CD\n\n### STEP 3: Review pre-computed codebase statistics (if provided)\n\n- Check if CODEBASE STATISTICS section is provided in the prompt\n- If provided, you have:\n - **File extension counts** (e.g., .ts: 456, .py: 123) - interpret these as technologies\n - .ts, .tsx, .jsx = TypeScript/JavaScript\n - .py = Python\n - .rs = Rust\n - .go = Go\n - .rb = Ruby\n - .ex, .exs = Elixir\n - .vue = Vue.js\n - etc.\n - **Config file names** (e.g., package.json, Cargo.toml, go.mod) - these reveal frameworks and tools\n- If statistics are NOT provided, use Glob to discover file types\n - Example: glob(\"\\*_/_.ts\") to find TypeScript files\n - Example: glob(\"\\*_/_.py\") to find Python files\n\n### STEP 4: Examine key configuration files\n\n- Config files are already identified in the statistics (if provided)\n- Use Read tool to examine important config files:\n - package.json - reveals Node.js frameworks, dependencies\n - Cargo.toml - reveals Rust dependencies\n - go.mod - reveals Go dependencies\n - requirements.txt, pyproject.toml - reveals Python dependencies\n - mix.exs - reveals Elixir dependencies\n- Use Grep to search for framework-specific patterns\n - Example: grep(\"import.\\*react\") to confirm React usage\n - Example: grep(\"from django\") to confirm Django usage\n\n### STEP 5: Identify technologies and patterns\n\n- Programming languages (TypeScript, Python, Go, Rust, Ruby, etc.)\n- Frameworks and libraries (React, Vue, Django, Rails, etc.)\n- Testing frameworks (Jest, Pytest, RSpec, etc.)\n- Build tools and infrastructure (Docker, Kubernetes, etc.)\n- Development practices (API development, frontend development, mobile, etc.)\n- Content patterns (blog posts, documentation, CMS usage)\n- CI/CD configurations\n- Accessibility tooling\n\n### STEP 6: Match findings to available plugins\n\n- Look at the plugin descriptions and keywords below\n- Cross-reference detected technologies with available jutsu-\\* plugins\n- Cross-reference development practices with available do-\\* plugins\n- Cross-reference integrations with available hashi-\\* plugins\n- ONLY recommend plugins from the list provided\n- Aim for 3-8 total plugins that best match the codebase\n- Always include \"bushido\" as it's the core plugin\n\n## Output Format\n\nReturn ONLY a JSON array of recommended plugin names from the available plugins list:\n\n```json\n[\"bushido\", \"jutsu-typescript\", \"jutsu-react\", \"do-frontend-development\"]\n```\n\n**CRITICAL**: Only recommend plugins that appear in the AVAILABLE PLUGINS list below. Never recommend plugins not in the list.\n";
|
|
4
4
|
//# sourceMappingURL=build-info.generated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/commands/mcp/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAY1D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { startMcpServer } from "./server.js";
|
|
2
|
+
export function registerMcpCommands(program) {
|
|
3
|
+
program
|
|
4
|
+
.command("mcp")
|
|
5
|
+
.description("Start the Han MCP server.\n" +
|
|
6
|
+
"Exposes tools for running hook commands from installed plugins.\n\n" +
|
|
7
|
+
"This command is typically invoked by Claude Code when the hashi-han plugin is installed.\n" +
|
|
8
|
+
"It uses stdio for JSON-RPC communication.")
|
|
9
|
+
.action(async () => {
|
|
10
|
+
await startMcpServer();
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/commands/mcp/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IACnD,OAAO;SACL,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CACX,6BAA6B;QAC5B,qEAAqE;QACrE,4FAA4F;QAC5F,2CAA2C,CAC5C;SACA,MAAM,CAAC,KAAK,IAAI,EAAE;QAClB,MAAM,cAAc,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../lib/commands/mcp/server.ts"],"names":[],"mappings":"AAgMA,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CA6BpD"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { createInterface } from "node:readline";
|
|
2
|
+
import { discoverPluginTools, executePluginTool, } from "./tools.js";
|
|
3
|
+
// Cache discovered tools
|
|
4
|
+
let cachedTools = null;
|
|
5
|
+
function discoverTools() {
|
|
6
|
+
if (!cachedTools) {
|
|
7
|
+
cachedTools = discoverPluginTools();
|
|
8
|
+
}
|
|
9
|
+
return cachedTools;
|
|
10
|
+
}
|
|
11
|
+
function formatToolsForMcp(tools) {
|
|
12
|
+
return tools.map((tool) => ({
|
|
13
|
+
name: tool.name,
|
|
14
|
+
description: tool.description,
|
|
15
|
+
inputSchema: {
|
|
16
|
+
type: "object",
|
|
17
|
+
properties: {
|
|
18
|
+
verbose: {
|
|
19
|
+
type: "boolean",
|
|
20
|
+
description: "Show full command output (default: false). When false, output is captured and returned on failure.",
|
|
21
|
+
},
|
|
22
|
+
failFast: {
|
|
23
|
+
type: "boolean",
|
|
24
|
+
description: "Stop on first failure when running in multiple directories (default: true for MCP calls).",
|
|
25
|
+
},
|
|
26
|
+
directory: {
|
|
27
|
+
type: "string",
|
|
28
|
+
description: "Run only in this specific directory (relative to project root). If not specified, runs in all applicable directories.",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
required: [],
|
|
32
|
+
},
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
function handleInitialize() {
|
|
36
|
+
return {
|
|
37
|
+
protocolVersion: "2024-11-05",
|
|
38
|
+
capabilities: {
|
|
39
|
+
tools: {},
|
|
40
|
+
},
|
|
41
|
+
serverInfo: {
|
|
42
|
+
name: "han",
|
|
43
|
+
version: "1.0.0",
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function handleToolsList() {
|
|
48
|
+
const tools = discoverTools();
|
|
49
|
+
return {
|
|
50
|
+
tools: formatToolsForMcp(tools),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
async function handleToolsCall(params) {
|
|
54
|
+
const tools = discoverTools();
|
|
55
|
+
const tool = tools.find((t) => t.name === params.name);
|
|
56
|
+
if (!tool) {
|
|
57
|
+
throw {
|
|
58
|
+
code: -32602,
|
|
59
|
+
message: `Unknown tool: ${params.name}`,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const args = params.arguments || {};
|
|
63
|
+
const verbose = args.verbose === true;
|
|
64
|
+
const failFast = args.failFast !== false; // Default to true for MCP
|
|
65
|
+
const directory = typeof args.directory === "string" ? args.directory : undefined;
|
|
66
|
+
try {
|
|
67
|
+
const result = await executePluginTool(tool, {
|
|
68
|
+
verbose,
|
|
69
|
+
failFast,
|
|
70
|
+
directory,
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
content: [
|
|
74
|
+
{
|
|
75
|
+
type: "text",
|
|
76
|
+
text: result.output,
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
isError: !result.success,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
84
|
+
return {
|
|
85
|
+
content: [
|
|
86
|
+
{
|
|
87
|
+
type: "text",
|
|
88
|
+
text: `Error executing ${params.name}: ${message}`,
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
isError: true,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async function handleRequest(request) {
|
|
96
|
+
try {
|
|
97
|
+
let result;
|
|
98
|
+
switch (request.method) {
|
|
99
|
+
case "initialize":
|
|
100
|
+
result = handleInitialize();
|
|
101
|
+
break;
|
|
102
|
+
case "initialized":
|
|
103
|
+
// Notification, no response needed
|
|
104
|
+
return { jsonrpc: "2.0", id: request.id, result: {} };
|
|
105
|
+
case "tools/list":
|
|
106
|
+
result = handleToolsList();
|
|
107
|
+
break;
|
|
108
|
+
case "tools/call":
|
|
109
|
+
result = await handleToolsCall(request.params);
|
|
110
|
+
break;
|
|
111
|
+
default:
|
|
112
|
+
throw {
|
|
113
|
+
code: -32601,
|
|
114
|
+
message: `Method not found: ${request.method}`,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
jsonrpc: "2.0",
|
|
119
|
+
id: request.id,
|
|
120
|
+
result,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
const errorObj = typeof error === "object" && error !== null && "code" in error
|
|
125
|
+
? error
|
|
126
|
+
: { code: -32603, message: String(error) };
|
|
127
|
+
return {
|
|
128
|
+
jsonrpc: "2.0",
|
|
129
|
+
id: request.id,
|
|
130
|
+
error: errorObj,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function sendResponse(response) {
|
|
135
|
+
const json = JSON.stringify(response);
|
|
136
|
+
process.stdout.write(`${json}\n`);
|
|
137
|
+
}
|
|
138
|
+
export async function startMcpServer() {
|
|
139
|
+
const rl = createInterface({
|
|
140
|
+
input: process.stdin,
|
|
141
|
+
terminal: false,
|
|
142
|
+
});
|
|
143
|
+
for await (const line of rl) {
|
|
144
|
+
if (!line.trim())
|
|
145
|
+
continue;
|
|
146
|
+
try {
|
|
147
|
+
const request = JSON.parse(line);
|
|
148
|
+
const response = await handleRequest(request);
|
|
149
|
+
// Only send response if there's an id (not a notification)
|
|
150
|
+
if (request.id !== undefined) {
|
|
151
|
+
sendResponse(response);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
// JSON parse error
|
|
156
|
+
sendResponse({
|
|
157
|
+
jsonrpc: "2.0",
|
|
158
|
+
error: {
|
|
159
|
+
code: -32700,
|
|
160
|
+
message: "Parse error",
|
|
161
|
+
data: String(error),
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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AAY,CAAC,QAAyB;IAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACtC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc;IACnC,MAAM,EAAE,GAAG,eAAe,CAAC;QAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,QAAQ,EAAE,KAAK;KACf,CAAC,CAAC;IAEH,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,EAAE,EAAE,CAAC;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YAAE,SAAS;QAE3B,IAAI,CAAC;YACJ,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAmB,CAAC;YACnD,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,CAAC;YAE9C,2DAA2D;YAC3D,IAAI,OAAO,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;gBAC9B,YAAY,CAAC,QAAQ,CAAC,CAAC;YACxB,CAAC;QACF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,mBAAmB;YACnB,YAAY,CAAC;gBACZ,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE;oBACN,IAAI,EAAE,CAAC,KAAK;oBACZ,OAAO,EAAE,aAAa;oBACtB,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC;iBACnB;aACD,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface PluginTool {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
pluginName: string;
|
|
5
|
+
hookName: string;
|
|
6
|
+
pluginRoot: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Discover all plugin tools from installed plugins
|
|
10
|
+
*/
|
|
11
|
+
export declare function discoverPluginTools(): PluginTool[];
|
|
12
|
+
export interface ExecuteToolOptions {
|
|
13
|
+
verbose?: boolean;
|
|
14
|
+
failFast?: boolean;
|
|
15
|
+
directory?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ExecuteToolResult {
|
|
18
|
+
success: boolean;
|
|
19
|
+
output: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Execute a plugin tool
|
|
23
|
+
*/
|
|
24
|
+
export declare function executePluginTool(tool: PluginTool, options: ExecuteToolOptions): Promise<ExecuteToolResult>;
|
|
25
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../../lib/commands/mcp/tools.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACnB;AAwQD;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,UAAU,EAAE,CAiClD;AAED,MAAM,WAAW,kBAAkB;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACtC,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,kBAAkB,GACzB,OAAO,CAAC,iBAAiB,CAAC,CAqE5B"}
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { loadPluginConfig } from "../../hook-config.js";
|
|
4
|
+
import { runConfiguredHook } from "../../validate.js";
|
|
5
|
+
/**
|
|
6
|
+
* Get Claude config directory
|
|
7
|
+
*/
|
|
8
|
+
function getClaudeConfigDir() {
|
|
9
|
+
if (process.env.CLAUDE_CONFIG_DIR) {
|
|
10
|
+
return process.env.CLAUDE_CONFIG_DIR;
|
|
11
|
+
}
|
|
12
|
+
const homeDir = process.env.HOME || process.env.USERPROFILE;
|
|
13
|
+
if (!homeDir) {
|
|
14
|
+
return "";
|
|
15
|
+
}
|
|
16
|
+
return join(homeDir, ".claude");
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Read settings from a file
|
|
20
|
+
*/
|
|
21
|
+
function readSettings(path) {
|
|
22
|
+
if (!existsSync(path)) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get all enabled plugins and marketplace configurations from all settings scopes
|
|
34
|
+
*/
|
|
35
|
+
function getEnabledPluginsAndMarketplaces() {
|
|
36
|
+
const plugins = new Map();
|
|
37
|
+
const marketplaces = new Map();
|
|
38
|
+
// Read user settings first (lowest priority)
|
|
39
|
+
const configDir = getClaudeConfigDir();
|
|
40
|
+
if (configDir) {
|
|
41
|
+
const userSettingsPath = join(configDir, "settings.json");
|
|
42
|
+
const userSettings = readSettings(userSettingsPath);
|
|
43
|
+
if (userSettings) {
|
|
44
|
+
if (userSettings.extraKnownMarketplaces) {
|
|
45
|
+
for (const [name, config] of Object.entries(userSettings.extraKnownMarketplaces)) {
|
|
46
|
+
marketplaces.set(name, config);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (userSettings.enabledPlugins) {
|
|
50
|
+
for (const [key, enabled] of Object.entries(userSettings.enabledPlugins)) {
|
|
51
|
+
if (enabled && key.includes("@")) {
|
|
52
|
+
const [pluginName, marketplace] = key.split("@");
|
|
53
|
+
plugins.set(pluginName, marketplace);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// Read project settings (overrides user)
|
|
60
|
+
const projectSettingsPath = join(process.cwd(), ".claude", "settings.json");
|
|
61
|
+
const projectSettings = readSettings(projectSettingsPath);
|
|
62
|
+
if (projectSettings) {
|
|
63
|
+
if (projectSettings.extraKnownMarketplaces) {
|
|
64
|
+
for (const [name, config] of Object.entries(projectSettings.extraKnownMarketplaces)) {
|
|
65
|
+
marketplaces.set(name, config);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (projectSettings.enabledPlugins) {
|
|
69
|
+
for (const [key, enabled] of Object.entries(projectSettings.enabledPlugins)) {
|
|
70
|
+
if (enabled && key.includes("@")) {
|
|
71
|
+
const [pluginName, marketplace] = key.split("@");
|
|
72
|
+
plugins.set(pluginName, marketplace);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Read local settings (highest priority, can override)
|
|
78
|
+
const localSettingsPath = join(process.cwd(), ".claude", "settings.local.json");
|
|
79
|
+
const localSettings = readSettings(localSettingsPath);
|
|
80
|
+
if (localSettings) {
|
|
81
|
+
if (localSettings.extraKnownMarketplaces) {
|
|
82
|
+
for (const [name, config] of Object.entries(localSettings.extraKnownMarketplaces)) {
|
|
83
|
+
marketplaces.set(name, config);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (localSettings.enabledPlugins) {
|
|
87
|
+
for (const [key, enabled] of Object.entries(localSettings.enabledPlugins)) {
|
|
88
|
+
if (enabled && key.includes("@")) {
|
|
89
|
+
const [pluginName, marketplace] = key.split("@");
|
|
90
|
+
plugins.set(pluginName, marketplace);
|
|
91
|
+
}
|
|
92
|
+
else if (!enabled && key.includes("@")) {
|
|
93
|
+
const [pluginName] = key.split("@");
|
|
94
|
+
plugins.delete(pluginName);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return { plugins, marketplaces };
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Find plugin in a marketplace root directory
|
|
103
|
+
*/
|
|
104
|
+
function findPluginInMarketplace(marketplaceRoot, pluginName) {
|
|
105
|
+
const potentialPaths = [
|
|
106
|
+
join(marketplaceRoot, "jutsu", pluginName),
|
|
107
|
+
join(marketplaceRoot, "do", pluginName),
|
|
108
|
+
join(marketplaceRoot, "hashi", pluginName),
|
|
109
|
+
join(marketplaceRoot, pluginName),
|
|
110
|
+
];
|
|
111
|
+
for (const path of potentialPaths) {
|
|
112
|
+
if (existsSync(path)) {
|
|
113
|
+
return path;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Resolve a path to absolute, relative to cwd
|
|
120
|
+
*/
|
|
121
|
+
function resolvePathToAbsolute(path) {
|
|
122
|
+
if (path.startsWith("/")) {
|
|
123
|
+
return path;
|
|
124
|
+
}
|
|
125
|
+
return join(process.cwd(), path);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Get plugin directory based on plugin name, marketplace, and marketplace config
|
|
129
|
+
*/
|
|
130
|
+
function getPluginDir(pluginName, marketplace, marketplaceConfig) {
|
|
131
|
+
// If marketplace config specifies a directory source, use that path
|
|
132
|
+
if (marketplaceConfig?.source?.source === "directory") {
|
|
133
|
+
const directoryPath = marketplaceConfig.source.path;
|
|
134
|
+
if (directoryPath) {
|
|
135
|
+
const absolutePath = resolvePathToAbsolute(directoryPath);
|
|
136
|
+
const found = findPluginInMarketplace(absolutePath, pluginName);
|
|
137
|
+
if (found) {
|
|
138
|
+
return found;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// Check if we're in the marketplace repo itself (for development)
|
|
143
|
+
const cwd = process.cwd();
|
|
144
|
+
if (existsSync(join(cwd, ".claude-plugin", "marketplace.json"))) {
|
|
145
|
+
const found = findPluginInMarketplace(cwd, pluginName);
|
|
146
|
+
if (found) {
|
|
147
|
+
return found;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// Fall back to the default shared config path
|
|
151
|
+
const configDir = getClaudeConfigDir();
|
|
152
|
+
if (!configDir) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
const marketplaceRoot = join(configDir, "plugins", "marketplaces", marketplace);
|
|
156
|
+
if (!existsSync(marketplaceRoot)) {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
return findPluginInMarketplace(marketplaceRoot, pluginName);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Generate a human-readable description for a hook tool
|
|
163
|
+
*/
|
|
164
|
+
function generateToolDescription(pluginName, hookName, pluginConfig) {
|
|
165
|
+
const hookDef = pluginConfig.hooks[hookName];
|
|
166
|
+
if (!hookDef) {
|
|
167
|
+
return `Run ${hookName} for ${pluginName}`;
|
|
168
|
+
}
|
|
169
|
+
// Build a description based on the hook definition
|
|
170
|
+
const parts = [];
|
|
171
|
+
// Describe what the hook does based on its name
|
|
172
|
+
const actionMap = {
|
|
173
|
+
test: "Run tests",
|
|
174
|
+
lint: "Run linter",
|
|
175
|
+
format: "Check formatting",
|
|
176
|
+
typecheck: "Run type checking",
|
|
177
|
+
compile: "Compile code",
|
|
178
|
+
build: "Build project",
|
|
179
|
+
};
|
|
180
|
+
const action = actionMap[hookName] || `Run ${hookName}`;
|
|
181
|
+
parts.push(action);
|
|
182
|
+
// Add context about the plugin
|
|
183
|
+
const technology = pluginName.replace(/^(jutsu|do|hashi)-/, "");
|
|
184
|
+
parts.push(`for ${technology}`);
|
|
185
|
+
// Add info about where it runs
|
|
186
|
+
if (hookDef.dirsWith && hookDef.dirsWith.length > 0) {
|
|
187
|
+
parts.push(`(in directories with ${hookDef.dirsWith.join(" or ")})`);
|
|
188
|
+
}
|
|
189
|
+
// Add the actual command for reference
|
|
190
|
+
parts.push(`- runs: ${hookDef.command}`);
|
|
191
|
+
return parts.join(" ");
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Discover all plugin tools from installed plugins
|
|
195
|
+
*/
|
|
196
|
+
export function discoverPluginTools() {
|
|
197
|
+
const tools = [];
|
|
198
|
+
const { plugins, marketplaces } = getEnabledPluginsAndMarketplaces();
|
|
199
|
+
for (const [pluginName, marketplace] of plugins.entries()) {
|
|
200
|
+
const marketplaceConfig = marketplaces.get(marketplace);
|
|
201
|
+
const pluginRoot = getPluginDir(pluginName, marketplace, marketplaceConfig);
|
|
202
|
+
if (!pluginRoot) {
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
// Load plugin config to discover hooks
|
|
206
|
+
const pluginConfig = loadPluginConfig(pluginRoot, false);
|
|
207
|
+
if (!pluginConfig || !pluginConfig.hooks) {
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
// Create a tool for each hook
|
|
211
|
+
for (const hookName of Object.keys(pluginConfig.hooks)) {
|
|
212
|
+
const toolName = `${pluginName}_${hookName}`.replace(/-/g, "_");
|
|
213
|
+
tools.push({
|
|
214
|
+
name: toolName,
|
|
215
|
+
description: generateToolDescription(pluginName, hookName, pluginConfig),
|
|
216
|
+
pluginName,
|
|
217
|
+
hookName,
|
|
218
|
+
pluginRoot,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return tools;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Execute a plugin tool
|
|
226
|
+
*/
|
|
227
|
+
export async function executePluginTool(tool, options) {
|
|
228
|
+
const { verbose = false, failFast = true, directory } = options;
|
|
229
|
+
// Capture console output
|
|
230
|
+
const outputLines = [];
|
|
231
|
+
const originalLog = console.log;
|
|
232
|
+
const originalError = console.error;
|
|
233
|
+
console.log = (...args) => {
|
|
234
|
+
outputLines.push(args.join(" "));
|
|
235
|
+
if (verbose) {
|
|
236
|
+
originalLog.apply(console, args);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
console.error = (...args) => {
|
|
240
|
+
outputLines.push(args.join(" "));
|
|
241
|
+
if (verbose) {
|
|
242
|
+
originalError.apply(console, args);
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
let success = true;
|
|
246
|
+
try {
|
|
247
|
+
// Set CLAUDE_PLUGIN_ROOT for the hook
|
|
248
|
+
process.env.CLAUDE_PLUGIN_ROOT = tool.pluginRoot;
|
|
249
|
+
// Use runConfiguredHook but catch the exit
|
|
250
|
+
const originalExit = process.exit;
|
|
251
|
+
let exitCode = 0;
|
|
252
|
+
process.exit = ((code) => {
|
|
253
|
+
exitCode = code ?? 0;
|
|
254
|
+
throw new Error(`__EXIT_${exitCode}__`);
|
|
255
|
+
});
|
|
256
|
+
try {
|
|
257
|
+
await runConfiguredHook({
|
|
258
|
+
pluginName: tool.pluginName,
|
|
259
|
+
hookName: tool.hookName,
|
|
260
|
+
failFast,
|
|
261
|
+
cache: true, // Always use caching for MCP
|
|
262
|
+
only: directory,
|
|
263
|
+
verbose, // Pass through verbose mode
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
catch (e) {
|
|
267
|
+
const error = e;
|
|
268
|
+
if (error.message?.startsWith("__EXIT_")) {
|
|
269
|
+
exitCode = Number.parseInt(error.message.replace("__EXIT_", "").replace("__", ""), 10);
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
throw e;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
finally {
|
|
276
|
+
process.exit = originalExit;
|
|
277
|
+
}
|
|
278
|
+
success = exitCode === 0;
|
|
279
|
+
}
|
|
280
|
+
catch (error) {
|
|
281
|
+
success = false;
|
|
282
|
+
outputLines.push(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
283
|
+
}
|
|
284
|
+
finally {
|
|
285
|
+
console.log = originalLog;
|
|
286
|
+
console.error = originalError;
|
|
287
|
+
}
|
|
288
|
+
return {
|
|
289
|
+
success,
|
|
290
|
+
output: outputLines.join("\n") || (success ? "Success" : "Failed"),
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../../lib/commands/mcp/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAqB,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AA0BtD;;GAEG;AACH,SAAS,kBAAkB;IAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC;QACnC,OAAO,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;IACtC,CAAC;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;IAC5D,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAO,EAAE,CAAC;IACX,CAAC;IACD,OAAO,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,IAAY;IACjC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACb,CAAC;IACD,IAAI,CAAC;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC;AAED;;GAEG;AACH,SAAS,gCAAgC;IAIxC,MAAM,OAAO,GA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CAAC,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACZ,MAAM,KAAK,GAAG,CAAU,CAAC;YACzB,IAAI,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC1C,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YACxF,CAAC;iBAAM,CAAC;gBACP,MAAM,CAAC,CAAC;YACT,CAAC;QACF,CAAC;gBAAS,CAAC;YACV,OAAO,CAAC,IAAI,GAAG,YAAY,CAAC;QAC7B,CAAC;QAED,OAAO,GAAG,QAAQ,KAAK,CAAC,CAAC;IAC1B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,GAAG,KAAK,CAAC;QAChB,WAAW,CAAC,IAAI,CAAC,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACtF,CAAC;YAAS,CAAC;QACV,OAAO,CAAC,GAAG,GAAG,WAAW,CAAC;QAC1B,OAAO,CAAC,KAAK,GAAG,aAAa,CAAC;IAC/B,CAAC;IAED,OAAO;QACN,OAAO;QACP,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;KAClE,CAAC;AACH,CAAC"}
|
package/dist/lib/main.js
CHANGED
|
@@ -6,6 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
import { HAN_VERSION } from "./build-info.generated.js";
|
|
7
7
|
import { registerAliasCommands } from "./commands/aliases.js";
|
|
8
8
|
import { registerHookCommands } from "./commands/hook/index.js";
|
|
9
|
+
import { registerMcpCommands } from "./commands/mcp/index.js";
|
|
9
10
|
import { registerPluginCommands } from "./commands/plugin/index.js";
|
|
10
11
|
// Version is injected at build time for binary builds, otherwise read from package.json
|
|
11
12
|
const version = (() => {
|
|
@@ -29,6 +30,7 @@ program
|
|
|
29
30
|
// Register command groups
|
|
30
31
|
registerPluginCommands(program);
|
|
31
32
|
registerHookCommands(program);
|
|
33
|
+
registerMcpCommands(program);
|
|
32
34
|
registerAliasCommands(program);
|
|
33
35
|
program.parse();
|
|
34
36
|
//# sourceMappingURL=main.js.map
|
package/dist/lib/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../lib/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,wFAAwF;AACxF,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE;IACrB,IAAI,WAAW,EAAE,CAAC;QACjB,OAAO,WAAW,CAAC;IACpB,CAAC;IACD,IAAI,CAAC;QACJ,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1D,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC7B,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAA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AC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1D,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC7B,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CAClE,CAAC;QACF,OAAO,WAAW,CAAC,OAAO,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,eAAe,CAAC;IACxB,CAAC;AACF,CAAC,CAAC,EAAE,CAAC;AAEL,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACL,IAAI,CAAC,KAAK,CAAC;KACX,WAAW,CAAC,6DAA6D,CAAC;KAC1E,OAAO,CAAC,OAAO,CAAC,CAAC;AAEnB,0BAA0B;AAC1B,sBAAsB,CAAC,OAAO,CAAC,CAAC;AAChC,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC9B,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC7B,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAE/B,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thebushidocollective/han",
|
|
3
|
-
"version": "1.41.
|
|
3
|
+
"version": "1.41.2",
|
|
4
4
|
"description": "CLI for installing and managing curated Claude Code plugins from the Han marketplace",
|
|
5
5
|
"main": "dist/lib/main.js",
|
|
6
6
|
"types": "dist/lib/main.d.ts",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"README.md"
|
|
52
52
|
],
|
|
53
53
|
"optionalDependencies": {
|
|
54
|
-
"@thebushidocollective/han-darwin-arm64": "1.41.
|
|
55
|
-
"@thebushidocollective/han-darwin-x64": "1.41.
|
|
56
|
-
"@thebushidocollective/han-linux-arm64": "1.41.
|
|
57
|
-
"@thebushidocollective/han-linux-x64": "1.41.
|
|
58
|
-
"@thebushidocollective/han-win32-x64": "1.41.
|
|
54
|
+
"@thebushidocollective/han-darwin-arm64": "1.41.2",
|
|
55
|
+
"@thebushidocollective/han-darwin-x64": "1.41.2",
|
|
56
|
+
"@thebushidocollective/han-linux-arm64": "1.41.2",
|
|
57
|
+
"@thebushidocollective/han-linux-x64": "1.41.2",
|
|
58
|
+
"@thebushidocollective/han-win32-x64": "1.41.2"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@anthropic-ai/claude-agent-sdk": "0.1.50",
|