@thebushidocollective/han 1.41.2 → 1.42.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/dist/lib/build-info.generated.d.ts +1 -1
- package/dist/lib/build-info.generated.js +1 -1
- package/dist/lib/claude-settings.d.ts +73 -0
- package/dist/lib/claude-settings.d.ts.map +1 -0
- package/dist/lib/claude-settings.js +159 -0
- package/dist/lib/claude-settings.js.map +1 -0
- package/dist/lib/commands/hook/dispatch.d.ts.map +1 -1
- package/dist/lib/commands/hook/dispatch.js +4 -77
- package/dist/lib/commands/hook/dispatch.js.map +1 -1
- package/dist/lib/commands/mcp/server.d.ts.map +1 -1
- package/dist/lib/commands/mcp/server.js +37 -20
- package/dist/lib/commands/mcp/server.js.map +1 -1
- package/dist/lib/commands/mcp/tools.d.ts.map +1 -1
- package/dist/lib/commands/mcp/tools.js +27 -124
- package/dist/lib/commands/mcp/tools.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const HAN_VERSION = "1.
|
|
1
|
+
export declare const HAN_VERSION = "1.42.1";
|
|
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.
|
|
2
|
+
export const HAN_VERSION = "1.42.1";
|
|
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,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marketplace source configuration
|
|
3
|
+
*/
|
|
4
|
+
export interface MarketplaceSource {
|
|
5
|
+
source: "directory" | "git" | "github";
|
|
6
|
+
path?: string;
|
|
7
|
+
url?: string;
|
|
8
|
+
repo?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Marketplace configuration
|
|
12
|
+
*/
|
|
13
|
+
export interface MarketplaceConfig {
|
|
14
|
+
source: MarketplaceSource;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Claude Code settings structure
|
|
18
|
+
*/
|
|
19
|
+
export interface ClaudeSettings {
|
|
20
|
+
extraKnownMarketplaces?: Record<string, MarketplaceConfig>;
|
|
21
|
+
enabledPlugins?: Record<string, boolean>;
|
|
22
|
+
hooks?: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Settings file locations in order of precedence (lowest to highest priority):
|
|
26
|
+
* 1. User settings (~/.claude/settings.json) - Personal global settings
|
|
27
|
+
* 2. Project settings (.claude/settings.json) - Team-shared project settings
|
|
28
|
+
* 3. Local settings (.claude/settings.local.json) - Personal project-specific settings
|
|
29
|
+
* 4. Enterprise managed settings (managed-settings.json) - Cannot be overridden
|
|
30
|
+
*
|
|
31
|
+
* @see https://code.claude.com/docs/en/settings
|
|
32
|
+
*/
|
|
33
|
+
export type SettingsScope = "user" | "project" | "local" | "enterprise";
|
|
34
|
+
/**
|
|
35
|
+
* Get Claude config directory (~/.claude)
|
|
36
|
+
*/
|
|
37
|
+
export declare function getClaudeConfigDir(): string;
|
|
38
|
+
/**
|
|
39
|
+
* Get project directory (current working directory)
|
|
40
|
+
*/
|
|
41
|
+
export declare function getProjectDir(): string;
|
|
42
|
+
/**
|
|
43
|
+
* Read settings from a file path
|
|
44
|
+
*/
|
|
45
|
+
export declare function readSettingsFile(path: string): ClaudeSettings | null;
|
|
46
|
+
/**
|
|
47
|
+
* Get all settings file paths in order of precedence (lowest to highest)
|
|
48
|
+
*/
|
|
49
|
+
export declare function getSettingsPaths(): {
|
|
50
|
+
scope: SettingsScope;
|
|
51
|
+
path: string;
|
|
52
|
+
}[];
|
|
53
|
+
/**
|
|
54
|
+
* Get all enabled plugins and marketplace configurations from merged settings.
|
|
55
|
+
*
|
|
56
|
+
* Settings are merged in order of precedence:
|
|
57
|
+
* 1. User settings (~/.claude/settings.json) - lowest priority
|
|
58
|
+
* 2. Project settings (.claude/settings.json)
|
|
59
|
+
* 3. Local settings (.claude/settings.local.json)
|
|
60
|
+
* 4. Enterprise settings (managed-settings.json) - highest priority
|
|
61
|
+
*
|
|
62
|
+
* @see https://code.claude.com/docs/en/settings
|
|
63
|
+
*/
|
|
64
|
+
export declare function getMergedPluginsAndMarketplaces(): {
|
|
65
|
+
plugins: Map<string, string>;
|
|
66
|
+
marketplaces: Map<string, MarketplaceConfig>;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Get merged settings from all scopes.
|
|
70
|
+
* This performs a deep merge with higher priority settings overriding lower ones.
|
|
71
|
+
*/
|
|
72
|
+
export declare function getMergedSettings(): ClaudeSettings;
|
|
73
|
+
//# sourceMappingURL=claude-settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-settings.d.ts","sourceRoot":"","sources":["../../lib/claude-settings.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,MAAM,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ,CAAC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,MAAM,EAAE,iBAAiB,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC3D,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,YAAY,CAAC;AAExE;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAS3C;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CASpE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI;IAAE,KAAK,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAkC3E;AA2CD;;;;;;;;;;GAUG;AACH,wBAAgB,+BAA+B,IAAI;IAClD,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CAC7C,CAcA;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CAiClD"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* Get Claude config directory (~/.claude)
|
|
5
|
+
*/
|
|
6
|
+
export function getClaudeConfigDir() {
|
|
7
|
+
if (process.env.CLAUDE_CONFIG_DIR) {
|
|
8
|
+
return process.env.CLAUDE_CONFIG_DIR;
|
|
9
|
+
}
|
|
10
|
+
const homeDir = process.env.HOME || process.env.USERPROFILE;
|
|
11
|
+
if (!homeDir) {
|
|
12
|
+
return "";
|
|
13
|
+
}
|
|
14
|
+
return join(homeDir, ".claude");
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Get project directory (current working directory)
|
|
18
|
+
*/
|
|
19
|
+
export function getProjectDir() {
|
|
20
|
+
return process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Read settings from a file path
|
|
24
|
+
*/
|
|
25
|
+
export function readSettingsFile(path) {
|
|
26
|
+
if (!existsSync(path)) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get all settings file paths in order of precedence (lowest to highest)
|
|
38
|
+
*/
|
|
39
|
+
export function getSettingsPaths() {
|
|
40
|
+
const paths = [];
|
|
41
|
+
const configDir = getClaudeConfigDir();
|
|
42
|
+
const projectDir = getProjectDir();
|
|
43
|
+
// 1. User settings (lowest priority)
|
|
44
|
+
if (configDir) {
|
|
45
|
+
paths.push({
|
|
46
|
+
scope: "user",
|
|
47
|
+
path: join(configDir, "settings.json"),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
// 2. Project settings (team-shared)
|
|
51
|
+
paths.push({
|
|
52
|
+
scope: "project",
|
|
53
|
+
path: join(projectDir, ".claude", "settings.json"),
|
|
54
|
+
});
|
|
55
|
+
// 3. Local settings (personal project-specific)
|
|
56
|
+
paths.push({
|
|
57
|
+
scope: "local",
|
|
58
|
+
path: join(projectDir, ".claude", "settings.local.json"),
|
|
59
|
+
});
|
|
60
|
+
// 4. Enterprise managed settings (highest priority, cannot be overridden)
|
|
61
|
+
if (configDir) {
|
|
62
|
+
paths.push({
|
|
63
|
+
scope: "enterprise",
|
|
64
|
+
path: join(configDir, "managed-settings.json"),
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return paths;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Merge enabled plugins from multiple settings files.
|
|
71
|
+
* Higher priority settings override lower priority ones.
|
|
72
|
+
* Setting a plugin to false explicitly disables it.
|
|
73
|
+
*/
|
|
74
|
+
function mergeEnabledPlugins(base, settings) {
|
|
75
|
+
if (!settings.enabledPlugins)
|
|
76
|
+
return;
|
|
77
|
+
for (const [key, enabled] of Object.entries(settings.enabledPlugins)) {
|
|
78
|
+
if (!key.includes("@"))
|
|
79
|
+
continue;
|
|
80
|
+
const [pluginName, marketplace] = key.split("@");
|
|
81
|
+
if (enabled) {
|
|
82
|
+
base.set(pluginName, marketplace);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
// Explicitly disabled - remove from map
|
|
86
|
+
base.delete(pluginName);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Merge marketplace configurations from multiple settings files.
|
|
92
|
+
* Higher priority settings override lower priority ones.
|
|
93
|
+
*/
|
|
94
|
+
function mergeMarketplaces(base, settings) {
|
|
95
|
+
if (!settings.extraKnownMarketplaces)
|
|
96
|
+
return;
|
|
97
|
+
for (const [name, config] of Object.entries(settings.extraKnownMarketplaces)) {
|
|
98
|
+
base.set(name, config);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Get all enabled plugins and marketplace configurations from merged settings.
|
|
103
|
+
*
|
|
104
|
+
* Settings are merged in order of precedence:
|
|
105
|
+
* 1. User settings (~/.claude/settings.json) - lowest priority
|
|
106
|
+
* 2. Project settings (.claude/settings.json)
|
|
107
|
+
* 3. Local settings (.claude/settings.local.json)
|
|
108
|
+
* 4. Enterprise settings (managed-settings.json) - highest priority
|
|
109
|
+
*
|
|
110
|
+
* @see https://code.claude.com/docs/en/settings
|
|
111
|
+
*/
|
|
112
|
+
export function getMergedPluginsAndMarketplaces() {
|
|
113
|
+
const plugins = new Map();
|
|
114
|
+
const marketplaces = new Map();
|
|
115
|
+
// Process settings in order of precedence (lowest to highest)
|
|
116
|
+
for (const { path } of getSettingsPaths()) {
|
|
117
|
+
const settings = readSettingsFile(path);
|
|
118
|
+
if (settings) {
|
|
119
|
+
mergeMarketplaces(marketplaces, settings);
|
|
120
|
+
mergeEnabledPlugins(plugins, settings);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return { plugins, marketplaces };
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get merged settings from all scopes.
|
|
127
|
+
* This performs a deep merge with higher priority settings overriding lower ones.
|
|
128
|
+
*/
|
|
129
|
+
export function getMergedSettings() {
|
|
130
|
+
const merged = {};
|
|
131
|
+
for (const { path } of getSettingsPaths()) {
|
|
132
|
+
const settings = readSettingsFile(path);
|
|
133
|
+
if (settings) {
|
|
134
|
+
// Merge extraKnownMarketplaces
|
|
135
|
+
if (settings.extraKnownMarketplaces) {
|
|
136
|
+
merged.extraKnownMarketplaces = {
|
|
137
|
+
...merged.extraKnownMarketplaces,
|
|
138
|
+
...settings.extraKnownMarketplaces,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
// Merge enabledPlugins
|
|
142
|
+
if (settings.enabledPlugins) {
|
|
143
|
+
merged.enabledPlugins = {
|
|
144
|
+
...merged.enabledPlugins,
|
|
145
|
+
...settings.enabledPlugins,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
// Merge hooks
|
|
149
|
+
if (settings.hooks) {
|
|
150
|
+
merged.hooks = {
|
|
151
|
+
...merged.hooks,
|
|
152
|
+
...settings.hooks,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return merged;
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=claude-sett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AAsB;oBAChC,GAAG,QAAQ,CAAC,sBAAsB;iBAClC,CAAC;YACH,CAAC;YAED,uBAAuB;YACvB,IAAI,QAAQ,CAAC,cAAc,EAAE,CAAC;gBAC7B,MAAM,CAAC,cAAc,GAAG;oBACvB,GAAG,MAAM,CAAC,cAAc;oBACxB,GAAG,QAAQ,CAAC,cAAc;iBAC1B,CAAC;YACH,CAAC;YAED,cAAc;YACd,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;gBACpB,MAAM,CAAC,KAAK,GAAG;oBACd,GAAG,MAAM,CAAC,KAAK;oBACf,GAAG,QAAQ,CAAC,KAAK;iBACjB,CAAC;YACH,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../../lib/commands/hook/dispatch.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../../lib/commands/hook/dispatch.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+PzC,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,OAAO,GAAG,IAAI,CAiB/D"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { execSync } from "node:child_process";
|
|
2
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
+
import { getClaudeConfigDir, getMergedPluginsAndMarketplaces, } from "../../claude-settings.js";
|
|
4
5
|
/**
|
|
5
6
|
* Read and parse stdin JSON payload from Claude Code hooks
|
|
6
7
|
*/
|
|
@@ -25,81 +26,6 @@ function getStdinPayload() {
|
|
|
25
26
|
}
|
|
26
27
|
return cachedStdinPayload;
|
|
27
28
|
}
|
|
28
|
-
/**
|
|
29
|
-
* Get Claude config directory
|
|
30
|
-
*/
|
|
31
|
-
function getClaudeConfigDir() {
|
|
32
|
-
if (process.env.CLAUDE_CONFIG_DIR) {
|
|
33
|
-
return process.env.CLAUDE_CONFIG_DIR;
|
|
34
|
-
}
|
|
35
|
-
const homeDir = process.env.HOME || process.env.USERPROFILE;
|
|
36
|
-
if (!homeDir) {
|
|
37
|
-
return "";
|
|
38
|
-
}
|
|
39
|
-
return join(homeDir, ".claude");
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Read settings from a file
|
|
43
|
-
*/
|
|
44
|
-
function readSettings(path) {
|
|
45
|
-
if (!existsSync(path)) {
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
try {
|
|
49
|
-
return JSON.parse(readFileSync(path, "utf8"));
|
|
50
|
-
}
|
|
51
|
-
catch {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Get all enabled plugins and marketplace configurations from settings
|
|
57
|
-
*/
|
|
58
|
-
function getEnabledPluginsAndMarketplaces() {
|
|
59
|
-
const plugins = new Map();
|
|
60
|
-
const marketplaces = new Map();
|
|
61
|
-
// Read project settings
|
|
62
|
-
const projectSettingsPath = join(process.cwd(), ".claude", "settings.json");
|
|
63
|
-
const projectSettings = readSettings(projectSettingsPath);
|
|
64
|
-
if (projectSettings) {
|
|
65
|
-
if (projectSettings.extraKnownMarketplaces) {
|
|
66
|
-
for (const [name, config] of Object.entries(projectSettings.extraKnownMarketplaces)) {
|
|
67
|
-
marketplaces.set(name, config);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
if (projectSettings.enabledPlugins) {
|
|
71
|
-
for (const [key, enabled] of Object.entries(projectSettings.enabledPlugins)) {
|
|
72
|
-
if (enabled && key.includes("@")) {
|
|
73
|
-
const [pluginName, marketplace] = key.split("@");
|
|
74
|
-
plugins.set(pluginName, marketplace);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
// Read local settings (can override project settings)
|
|
80
|
-
const localSettingsPath = join(process.cwd(), ".claude", "settings.local.json");
|
|
81
|
-
const localSettings = readSettings(localSettingsPath);
|
|
82
|
-
if (localSettings) {
|
|
83
|
-
if (localSettings.extraKnownMarketplaces) {
|
|
84
|
-
for (const [name, config] of Object.entries(localSettings.extraKnownMarketplaces)) {
|
|
85
|
-
marketplaces.set(name, config);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
if (localSettings.enabledPlugins) {
|
|
89
|
-
for (const [key, enabled] of Object.entries(localSettings.enabledPlugins)) {
|
|
90
|
-
if (enabled && key.includes("@")) {
|
|
91
|
-
const [pluginName, marketplace] = key.split("@");
|
|
92
|
-
plugins.set(pluginName, marketplace);
|
|
93
|
-
}
|
|
94
|
-
else if (!enabled && key.includes("@")) {
|
|
95
|
-
const [pluginName] = key.split("@");
|
|
96
|
-
plugins.delete(pluginName);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return { plugins, marketplaces };
|
|
102
|
-
}
|
|
103
29
|
/**
|
|
104
30
|
* Find plugin in a marketplace root directory
|
|
105
31
|
*/
|
|
@@ -218,10 +144,11 @@ function executeCommandHook(command, pluginRoot, timeout) {
|
|
|
218
144
|
}
|
|
219
145
|
}
|
|
220
146
|
/**
|
|
221
|
-
* Dispatch hooks of a specific type across all installed plugins
|
|
147
|
+
* Dispatch hooks of a specific type across all installed plugins.
|
|
148
|
+
* Uses merged settings from all scopes (user, project, local, enterprise).
|
|
222
149
|
*/
|
|
223
150
|
function dispatchHooks(hookType) {
|
|
224
|
-
const { plugins, marketplaces } =
|
|
151
|
+
const { plugins, marketplaces } = getMergedPluginsAndMarketplaces();
|
|
225
152
|
if (plugins.size === 0) {
|
|
226
153
|
return;
|
|
227
154
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../../../../lib/commands/hook/dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../../../../lib/commands/hook/dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EACN,kBAAkB,EAClB,+BAA+B,GAE/B,MAAM,0BAA0B,CAAC;AAElC;;GAEG;AACH,SAAS,gBAAgB;IACxB,IAAI,CAAC;QACJ,+CAA+C;QAC/C,MAAM,KAAK,GAAG,YAAY,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QACvC,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACF,CAAC;IAAC,MAAM,CAAC;QACR,uDAAuD;IACxD,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAED,iDAAiD;AACjD,IAAI,kBAA8D,CAAC;AACnE,SAAS,eAAe;IACvB,IAAI,kBAAkB,KAAK,SAAS,EAAE,CAAC;QACtC,kBAAkB,GAAG,gBAAgB,EAAE,CAAC;IACzC,CAAC;IACD,OAAO,kBAAkB,CAAC;AAC3B,CAAC;AAoBD;;GAEG;AACH,SAAS,uBAAuB,CAC/B,eAAuB,EACvB,UAAkB;IAElB,MAAM,cAAc,GAAG;QACtB,IAAI,CAAC,eAAe,EAAE,OAAO,EAAE,UAAU,CAAC;QAC1C,IAAI,CAAC,eAAe,EAAE,IAAI,EAAE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tE,gBAAgB;QAChB,2DAA2D;QAC3D,2FAA2F;QAC3F,uDAAuD;QACvD,sFAAsF;QACtF,KAAK,CACN;SACA,MAAM,CAAC,CAAC,QAAgB,EAAE,EAAE;QAC5B,aAAa,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../lib/commands/mcp/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../lib/commands/mcp/server.ts"],"names":[],"mappings":"AAmOA,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CA6BpD"}
|
|
@@ -9,28 +9,41 @@ function discoverTools() {
|
|
|
9
9
|
return cachedTools;
|
|
10
10
|
}
|
|
11
11
|
function formatToolsForMcp(tools) {
|
|
12
|
-
return tools.map((tool) =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
return tools.map((tool) => {
|
|
13
|
+
// Generate a human-readable title from the tool name
|
|
14
|
+
const title = tool.hookName.charAt(0).toUpperCase() + tool.hookName.slice(1);
|
|
15
|
+
const technology = tool.pluginName.replace(/^(jutsu|do|hashi)-/, "");
|
|
16
|
+
const techDisplay = technology.charAt(0).toUpperCase() + technology.slice(1);
|
|
17
|
+
return {
|
|
18
|
+
name: tool.name,
|
|
19
|
+
description: tool.description,
|
|
20
|
+
annotations: {
|
|
21
|
+
title: `${title} ${techDisplay}`,
|
|
22
|
+
readOnlyHint: false, // These tools may modify files (e.g., formatters)
|
|
23
|
+
destructiveHint: false, // Not destructive - can be safely re-run
|
|
24
|
+
idempotentHint: true, // Safe to run multiple times with same result
|
|
25
|
+
openWorldHint: false, // Works with local files only
|
|
26
|
+
},
|
|
27
|
+
inputSchema: {
|
|
28
|
+
type: "object",
|
|
29
|
+
properties: {
|
|
30
|
+
verbose: {
|
|
31
|
+
type: "boolean",
|
|
32
|
+
description: "Show full command output in real-time. Set to true when debugging failures or when you want to see progress. Default: false (output captured and returned).",
|
|
33
|
+
},
|
|
34
|
+
failFast: {
|
|
35
|
+
type: "boolean",
|
|
36
|
+
description: "Stop immediately on first failure. Set to false to see all errors across all directories. Default: true.",
|
|
37
|
+
},
|
|
38
|
+
directory: {
|
|
39
|
+
type: "string",
|
|
40
|
+
description: "Limit execution to a specific directory path (relative to project root, e.g., 'packages/core' or 'src'). If omitted, runs in all applicable directories.",
|
|
41
|
+
},
|
|
29
42
|
},
|
|
43
|
+
required: [],
|
|
30
44
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}));
|
|
45
|
+
};
|
|
46
|
+
});
|
|
34
47
|
}
|
|
35
48
|
function handleInitialize() {
|
|
36
49
|
return {
|
|
@@ -102,6 +115,10 @@ async function handleRequest(request) {
|
|
|
102
115
|
case "initialized":
|
|
103
116
|
// Notification, no response needed
|
|
104
117
|
return { jsonrpc: "2.0", id: request.id, result: {} };
|
|
118
|
+
case "ping":
|
|
119
|
+
// Simple ping/pong for health checks
|
|
120
|
+
result = {};
|
|
121
|
+
break;
|
|
105
122
|
case "tools/list":
|
|
106
123
|
result = handleToolsList();
|
|
107
124
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../../lib/commands/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACN,mBAAmB,EACnB,iBAAiB,GAEjB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../../lib/commands/mcp/server.ts"],"names":[],"mappings":"AAAA,O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,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../../lib/commands/mcp/tools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../../lib/commands/mcp/tools.ts"],"names":[],"mappings":"AAUA,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;AAqID;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,UAAU,EAAE,CAqClD;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,CA0E5B"}
|
|
@@ -1,103 +1,8 @@
|
|
|
1
|
-
import { existsSync
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
+
import { getClaudeConfigDir, getMergedPluginsAndMarketplaces, } from "../../claude-settings.js";
|
|
3
4
|
import { loadPluginConfig } from "../../hook-config.js";
|
|
4
5
|
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
6
|
/**
|
|
102
7
|
* Find plugin in a marketplace root directory
|
|
103
8
|
*/
|
|
@@ -159,43 +64,41 @@ function getPluginDir(pluginName, marketplace, marketplaceConfig) {
|
|
|
159
64
|
return findPluginInMarketplace(marketplaceRoot, pluginName);
|
|
160
65
|
}
|
|
161
66
|
/**
|
|
162
|
-
* Generate a human-readable description for a hook tool
|
|
67
|
+
* Generate a human-readable description for a hook tool with natural language examples
|
|
163
68
|
*/
|
|
164
69
|
function generateToolDescription(pluginName, hookName, pluginConfig) {
|
|
165
70
|
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
71
|
const technology = pluginName.replace(/^(jutsu|do|hashi)-/, "");
|
|
184
|
-
|
|
185
|
-
//
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
72
|
+
const techDisplay = technology.charAt(0).toUpperCase() + technology.slice(1);
|
|
73
|
+
// Rich descriptions with natural language trigger examples
|
|
74
|
+
const descriptions = {
|
|
75
|
+
test: (tech, display) => `Run ${display} tests. Triggers: "run the tests", "run ${tech} tests", "check if tests pass", "execute test suite"`,
|
|
76
|
+
lint: (tech, display) => `Lint ${display} code for issues and style violations. Triggers: "lint the code", "check for ${tech} issues", "run the linter", "check code quality"`,
|
|
77
|
+
typecheck: (_tech, display) => `Type-check ${display} code for type errors. Triggers: "check types", "run type checking", "verify types", "typescript check"`,
|
|
78
|
+
format: (_tech, display) => `Check and fix ${display} code formatting. Triggers: "format the code", "check formatting", "fix formatting", "run formatter"`,
|
|
79
|
+
build: (_tech, display) => `Build the ${display} project. Triggers: "build the project", "compile the code", "run the build"`,
|
|
80
|
+
compile: (tech, display) => `Compile ${display} code. Triggers: "compile the code", "run compilation", "build ${tech}"`,
|
|
81
|
+
};
|
|
82
|
+
const descFn = descriptions[hookName];
|
|
83
|
+
let desc = descFn
|
|
84
|
+
? descFn(technology, techDisplay)
|
|
85
|
+
: `Run ${hookName} for ${techDisplay}. Triggers: "run ${hookName}", "${hookName} the ${technology} code"`;
|
|
86
|
+
// Add context about where it runs
|
|
87
|
+
if (hookDef?.dirsWith && hookDef.dirsWith.length > 0) {
|
|
88
|
+
desc += `. Runs in directories containing: ${hookDef.dirsWith.join(", ")}`;
|
|
89
|
+
}
|
|
90
|
+
// Add the actual command for transparency
|
|
91
|
+
if (hookDef?.command) {
|
|
92
|
+
desc += `. Command: ${hookDef.command}`;
|
|
93
|
+
}
|
|
94
|
+
return desc;
|
|
192
95
|
}
|
|
193
96
|
/**
|
|
194
97
|
* Discover all plugin tools from installed plugins
|
|
195
98
|
*/
|
|
196
99
|
export function discoverPluginTools() {
|
|
197
100
|
const tools = [];
|
|
198
|
-
const { plugins, marketplaces } =
|
|
101
|
+
const { plugins, marketplaces } = getMergedPluginsAndMarketplaces();
|
|
199
102
|
for (const [pluginName, marketplace] of plugins.entries()) {
|
|
200
103
|
const marketplaceConfig = marketplaces.get(marketplace);
|
|
201
104
|
const pluginRoot = getPluginDir(pluginName, marketplace, marketplaceConfig);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../../lib/commands/mcp/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../../lib/commands/mcp/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACN,kBAAkB,EAClB,+BAA+B,GAE/B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAqB,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAUtD;;GAEG;AACH,SAAS,uBAAuB,CAC/B,eAAuB,EACvB,UAAkB;IAElB,MAAM,cAAc,GAAG;QACtB,IAAI,CAAC,eAAe,EAAE,OAAO,EAAE,UAAU,CAAC;QAC1C,IAAI,CAAC,eAAe,EAAE,IAAI,EAAE,UAAU,CAAC;QACvC,IAAI,CAAC,eAAe,EAAE,OAAO,EAAE,UAAU,CAAC;QAC1C,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC;KACjC,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE,CAAC;QACnC,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC;QACb,CAAC;IACF,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AAED;;GAEG;AACH,SAAS,qBAAqB,CAAC,IAAY;IAC1C,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC;IACb,CAA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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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thebushidocollective/han",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.42.1",
|
|
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.
|
|
55
|
-
"@thebushidocollective/han-darwin-x64": "1.
|
|
56
|
-
"@thebushidocollective/han-linux-arm64": "1.
|
|
57
|
-
"@thebushidocollective/han-linux-x64": "1.
|
|
58
|
-
"@thebushidocollective/han-win32-x64": "1.
|
|
54
|
+
"@thebushidocollective/han-darwin-arm64": "1.42.1",
|
|
55
|
+
"@thebushidocollective/han-darwin-x64": "1.42.1",
|
|
56
|
+
"@thebushidocollective/han-linux-arm64": "1.42.1",
|
|
57
|
+
"@thebushidocollective/han-linux-x64": "1.42.1",
|
|
58
|
+
"@thebushidocollective/han-win32-x64": "1.42.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@anthropic-ai/claude-agent-sdk": "0.1.50",
|