@thebushidocollective/han 1.28.1 → 1.28.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/README.md +21 -52
- package/dist/lib/build-info.generated.d.ts +1 -1
- package/dist/lib/build-info.generated.js +1 -1
- package/dist/lib/hook-cache.js +2 -2
- package/dist/lib/hook-cache.js.map +1 -1
- package/dist/lib/main.js +2 -15
- package/dist/lib/main.js.map +1 -1
- package/package.json +6 -6
- package/dist/lib/commands/update.d.ts +0 -30
- package/dist/lib/commands/update.d.ts.map +0 -1
- package/dist/lib/commands/update.js +0 -246
- package/dist/lib/commands/update.js.map +0 -1
package/README.md
CHANGED
|
@@ -6,44 +6,13 @@ A curated marketplace of Claude Code plugins built on the foundation of the seve
|
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
### Quick Install (Recommended)
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
curl -fsSL https://han.guru/install.sh | sh
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Homebrew (macOS & Linux)
|
|
9
|
+
Use npx to run han (no installation required):
|
|
18
10
|
|
|
19
11
|
```bash
|
|
20
|
-
|
|
12
|
+
npx @thebushidocollective/han plugin install
|
|
21
13
|
```
|
|
22
14
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npm install -g @thebushidocollective/han
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### Manual Download
|
|
30
|
-
|
|
31
|
-
Download the latest binary for your platform from [GitHub Releases](https://github.com/TheBushidoCollective/han/releases/latest):
|
|
32
|
-
|
|
33
|
-
| Platform | Download |
|
|
34
|
-
|----------|----------|
|
|
35
|
-
| macOS Apple Silicon | [han-darwin-arm64](https://github.com/TheBushidoCollective/han/releases/latest/download/han-darwin-arm64) |
|
|
36
|
-
| macOS Intel | [han-darwin-x64](https://github.com/TheBushidoCollective/han/releases/latest/download/han-darwin-x64) |
|
|
37
|
-
| Linux x64 | [han-linux-x64](https://github.com/TheBushidoCollective/han/releases/latest/download/han-linux-x64) |
|
|
38
|
-
| Linux ARM64 | [han-linux-arm64](https://github.com/TheBushidoCollective/han/releases/latest/download/han-linux-arm64) |
|
|
39
|
-
| Windows x64 | [han-windows-x64.exe](https://github.com/TheBushidoCollective/han/releases/latest/download/han-windows-x64.exe) |
|
|
40
|
-
|
|
41
|
-
After downloading, move the binary to a directory in your PATH (e.g., `/usr/local/bin`) and make it executable:
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
chmod +x han-darwin-arm64
|
|
45
|
-
mv han-darwin-arm64 /usr/local/bin/han
|
|
46
|
-
```
|
|
15
|
+
This always uses the latest version automatically.
|
|
47
16
|
|
|
48
17
|
## Plugin Categories
|
|
49
18
|
|
|
@@ -56,19 +25,19 @@ Han organizes plugins into four categories inspired by Japanese samurai traditio
|
|
|
56
25
|
|
|
57
26
|
## Commands
|
|
58
27
|
|
|
59
|
-
###
|
|
28
|
+
### plugin install
|
|
60
29
|
|
|
61
30
|
Install plugins interactively or automatically.
|
|
62
31
|
|
|
63
32
|
```bash
|
|
64
33
|
# Interactive mode - browse and select plugins
|
|
65
|
-
han plugin install
|
|
34
|
+
npx @thebushidocollective/han plugin install
|
|
66
35
|
|
|
67
36
|
# Auto-detect mode - AI analyzes codebase and recommends plugins
|
|
68
|
-
han plugin install --auto
|
|
37
|
+
npx @thebushidocollective/han plugin install --auto
|
|
69
38
|
|
|
70
39
|
# Install specific plugin by name
|
|
71
|
-
han plugin install <plugin-name>
|
|
40
|
+
npx @thebushidocollective/han plugin install <plugin-name>
|
|
72
41
|
```
|
|
73
42
|
|
|
74
43
|
**Options:**
|
|
@@ -83,61 +52,61 @@ han plugin install <plugin-name>
|
|
|
83
52
|
- `project`: Install to `.claude/settings.json` (shared via git)
|
|
84
53
|
- `local`: Install to `.claude/settings.local.json` (git-ignored)
|
|
85
54
|
|
|
86
|
-
###
|
|
55
|
+
### plugin uninstall
|
|
87
56
|
|
|
88
57
|
Remove a specific plugin.
|
|
89
58
|
|
|
90
59
|
```bash
|
|
91
|
-
han plugin uninstall <plugin-name> [--scope <project|local>]
|
|
60
|
+
npx @thebushidocollective/han plugin uninstall <plugin-name> [--scope <project|local>]
|
|
92
61
|
```
|
|
93
62
|
|
|
94
|
-
###
|
|
63
|
+
### plugin search
|
|
95
64
|
|
|
96
65
|
Search for plugins in the Han marketplace.
|
|
97
66
|
|
|
98
67
|
```bash
|
|
99
|
-
han plugin search [query]
|
|
68
|
+
npx @thebushidocollective/han plugin search [query]
|
|
100
69
|
```
|
|
101
70
|
|
|
102
|
-
###
|
|
71
|
+
### hook run
|
|
103
72
|
|
|
104
73
|
Run a command in directories matching a pattern.
|
|
105
74
|
|
|
106
75
|
```bash
|
|
107
|
-
han hook run --dirs-with <pattern> -- <command>
|
|
76
|
+
npx @thebushidocollective/han hook run --dirs-with <pattern> -- <command>
|
|
108
77
|
```
|
|
109
78
|
|
|
110
79
|
**Examples:**
|
|
111
80
|
|
|
112
81
|
```bash
|
|
113
82
|
# Run npm test in all directories with package.json
|
|
114
|
-
han hook run --dirs-with package.json -- npm test
|
|
83
|
+
npx @thebushidocollective/han hook run --dirs-with package.json -- npm test
|
|
115
84
|
|
|
116
85
|
# Run mix compile in Elixir projects
|
|
117
|
-
han hook run --dirs-with mix.exs -- mix compile --warnings-as-errors
|
|
86
|
+
npx @thebushidocollective/han hook run --dirs-with mix.exs -- mix compile --warnings-as-errors
|
|
118
87
|
|
|
119
88
|
# Only run in directories passing a test command
|
|
120
|
-
han hook run --dirs-with mix.exs --test-dir "grep -qE ':credo' mix.exs" -- mix credo
|
|
89
|
+
npx @thebushidocollective/han hook run --dirs-with mix.exs --test-dir "grep -qE ':credo' mix.exs" -- mix credo
|
|
121
90
|
```
|
|
122
91
|
|
|
123
|
-
###
|
|
92
|
+
### hook test
|
|
124
93
|
|
|
125
94
|
Validate hook configurations for all installed plugins.
|
|
126
95
|
|
|
127
96
|
```bash
|
|
128
97
|
# Validate hook structure and syntax only
|
|
129
|
-
han hook test
|
|
98
|
+
npx @thebushidocollective/han hook test
|
|
130
99
|
|
|
131
100
|
# Validate AND execute hooks to verify they run successfully
|
|
132
|
-
han hook test --execute
|
|
101
|
+
npx @thebushidocollective/han hook test --execute
|
|
133
102
|
```
|
|
134
103
|
|
|
135
|
-
###
|
|
104
|
+
### uninstall
|
|
136
105
|
|
|
137
106
|
Remove all Han plugins and marketplace configuration.
|
|
138
107
|
|
|
139
108
|
```bash
|
|
140
|
-
han uninstall
|
|
109
|
+
npx @thebushidocollective/han uninstall
|
|
141
110
|
```
|
|
142
111
|
|
|
143
112
|
## Philosophy
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const HAN_VERSION = "1.28.
|
|
1
|
+
export declare const HAN_VERSION = "1.28.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- **buki-\\*** (\u6B66\u5668 weapons): Skills for specific technologies and frameworks\n- **do-\\*** (\u9053 disciplines): Specialized agents for development practices and workflows\n- **sensei-\\*** (\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: `buki-typescript` suggests TypeScript development\n - Example: `sensei-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 buki-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 `sensei-github`\n - URLs containing `gitlab.com` or other GitLab instances \u2192 recommend `sensei-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 buki-\\* plugins\n- Cross-reference development practices with available do-\\* plugins\n- Cross-reference integrations with available sensei-\\* 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\", \"buki-typescript\", \"buki-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.28.
|
|
2
|
+
export const HAN_VERSION = "1.28.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- **buki-\\*** (武器 weapons): Skills for specific technologies and frameworks\n- **do-\\*** (道 disciplines): Specialized agents for development practices and workflows\n- **sensei-\\*** (先生 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: `buki-typescript` suggests TypeScript development\n - Example: `sensei-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 buki-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 `sensei-github`\n - URLs containing `gitlab.com` or other GitLab instances → recommend `sensei-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 buki-\\* plugins\n- Cross-reference development practices with available do-\\* plugins\n- Cross-reference integrations with available sensei-\\* 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\", \"buki-typescript\", \"buki-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
|
package/dist/lib/hook-cache.js
CHANGED
|
@@ -47,8 +47,8 @@ function loadNativeModule() {
|
|
|
47
47
|
// For Bun compiled binaries: embedded native module
|
|
48
48
|
// This MUST be a bare require with a static string literal for Bun to detect and embed
|
|
49
49
|
try {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
cachedNativeModule =
|
|
51
|
+
require("../native/han-native.darwin-arm64.node");
|
|
52
52
|
return cachedNativeModule;
|
|
53
53
|
}
|
|
54
54
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook-cache.js","sourceRoot":"","sources":["../../lib/hook-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,8EAA8E;AAC9E,MAAM,cAAc,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAOtD;;GAEG;AACH,IAAI,kBAAkB,GAAwB,IAAI,CAAC;AAEnD;;;;;;;;;GASG;AACH,SAAS,gBAAgB;IACxB,IAAI,kBAAkB,EAAE,CAAC;QACxB,OAAO,kBAAkB,CAAC;IAC3B,CAAC;IAED,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,6DAA6D;IAC7D,IAAI,CAAC;QACJ,kBAAkB,GAAG,cAAc,CAClC,kCAAkC,CAClB,CAAC;QAClB,OAAO,kBAAkB,CAAC;IAC3B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACZ,MAAM,CAAC,IAAI,CACV,qCAAqC,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CACjF,CAAC;IACH,CAAC;IAED,8CAA8C;IAC9C,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,GA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C,OAAO,iBAAiB,CAAC,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC1D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC9B,UAAkB,EAClB,QAAgB,EAChB,OAAe,EACf,QAAkB;IAElB,MAAM,cAAc,GAAG,iBAAiB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC/D,OAAO,UAAU,CAAC,OAAO,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AACtD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,0BAA0B,CACzC,OAAe,EACf,cAAwB;IAExB,OAAO,YAAY,CAAC,0BAA0B,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;AACzE,CAAC"}
|
package/dist/lib/main.js
CHANGED
|
@@ -3,11 +3,10 @@ import { readFileSync } from "node:fs";
|
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { Command } from "commander";
|
|
6
|
+
import { HAN_VERSION } from "./build-info.generated.js";
|
|
6
7
|
import { registerAliasCommands } from "./commands/aliases.js";
|
|
7
8
|
import { registerHookCommands } from "./commands/hook/index.js";
|
|
8
9
|
import { registerPluginCommands } from "./commands/plugin/index.js";
|
|
9
|
-
import { checkAndAutoUpdate, registerUpdateCommand, } from "./commands/update.js";
|
|
10
|
-
import { HAN_VERSION } from "./build-info.generated.js";
|
|
11
10
|
// Version is injected at build time for binary builds, otherwise read from package.json
|
|
12
11
|
const version = (() => {
|
|
13
12
|
if (HAN_VERSION) {
|
|
@@ -30,18 +29,6 @@ program
|
|
|
30
29
|
// Register command groups
|
|
31
30
|
registerPluginCommands(program);
|
|
32
31
|
registerHookCommands(program);
|
|
33
|
-
registerUpdateCommand(program);
|
|
34
32
|
registerAliasCommands(program);
|
|
35
|
-
|
|
36
|
-
async function main() {
|
|
37
|
-
// Check for updates and auto-update if available
|
|
38
|
-
// If an update happens, this will re-exec and not return
|
|
39
|
-
const reexecing = await checkAndAutoUpdate();
|
|
40
|
-
if (reexecing) {
|
|
41
|
-
// Wait indefinitely - the child process will exit for us
|
|
42
|
-
await new Promise(() => { });
|
|
43
|
-
}
|
|
44
|
-
program.parse();
|
|
45
|
-
}
|
|
46
|
-
main();
|
|
33
|
+
program.parse();
|
|
47
34
|
//# 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,
|
|
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,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,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.28.
|
|
3
|
+
"version": "1.28.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",
|
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
"README.md"
|
|
51
51
|
],
|
|
52
52
|
"optionalDependencies": {
|
|
53
|
-
"@thebushidocollective/han-darwin-arm64": "1.28.
|
|
54
|
-
"@thebushidocollective/han-darwin-x64": "1.28.
|
|
55
|
-
"@thebushidocollective/han-linux-arm64": "1.28.
|
|
56
|
-
"@thebushidocollective/han-linux-x64": "1.28.
|
|
57
|
-
"@thebushidocollective/han-win32-x64": "1.28.
|
|
53
|
+
"@thebushidocollective/han-darwin-arm64": "1.28.2",
|
|
54
|
+
"@thebushidocollective/han-darwin-x64": "1.28.2",
|
|
55
|
+
"@thebushidocollective/han-linux-arm64": "1.28.2",
|
|
56
|
+
"@thebushidocollective/han-linux-x64": "1.28.2",
|
|
57
|
+
"@thebushidocollective/han-win32-x64": "1.28.2"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@anthropic-ai/claude-agent-sdk": "0.1.50",
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Command } from "commander";
|
|
2
|
-
export type InstallMethod = "homebrew" | "npm" | "standalone" | "unknown";
|
|
3
|
-
/**
|
|
4
|
-
* Detect if running via npx
|
|
5
|
-
* npx runs from a temporary cache directory like ~/.npm/_npx/
|
|
6
|
-
*/
|
|
7
|
-
export declare function isRunningViaNpx(): boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Detect how han was installed
|
|
10
|
-
*/
|
|
11
|
-
export declare function detectInstallMethod(): InstallMethod;
|
|
12
|
-
/**
|
|
13
|
-
* Get the current version from package.json (not by spawning han)
|
|
14
|
-
*/
|
|
15
|
-
export declare function getCurrentVersion(): string;
|
|
16
|
-
/**
|
|
17
|
-
* Get the latest version from npm with timeout
|
|
18
|
-
*/
|
|
19
|
-
export declare function getLatestVersion(): Promise<string>;
|
|
20
|
-
/**
|
|
21
|
-
* Check for updates and auto-update if available
|
|
22
|
-
* Call this at startup to enable auto-updates
|
|
23
|
-
* Returns true if an update was performed and re-exec is in progress
|
|
24
|
-
*/
|
|
25
|
-
export declare function checkAndAutoUpdate(): Promise<boolean>;
|
|
26
|
-
/**
|
|
27
|
-
* Register the update command
|
|
28
|
-
*/
|
|
29
|
-
export declare function registerUpdateCommand(program: Command): void;
|
|
30
|
-
//# sourceMappingURL=update.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../lib/commands/update.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,KAAK,GAAG,YAAY,GAAG,SAAS,CAAC;AAE1E;;;GAGG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAYzC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,aAAa,CAmCnD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAgB1C;AAED;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAUxD;AAyDD;;;;GAIG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC,CA8C3D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0E5D"}
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
import { execSync, spawn, spawnSync } from "node:child_process";
|
|
2
|
-
import { existsSync, readFileSync, readlinkSync } from "node:fs";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { HAN_VERSION } from "../build-info.generated.js";
|
|
6
|
-
/**
|
|
7
|
-
* Detect if running via npx
|
|
8
|
-
* npx runs from a temporary cache directory like ~/.npm/_npx/
|
|
9
|
-
*/
|
|
10
|
-
export function isRunningViaNpx() {
|
|
11
|
-
const scriptPath = process.argv[1] || "";
|
|
12
|
-
// npx creates temporary directories with _npx in the path
|
|
13
|
-
if (scriptPath.includes("_npx")) {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
// Also check npm_execpath which is set when running via npm/npx
|
|
17
|
-
const npmExecPath = process.env.npm_execpath || "";
|
|
18
|
-
if (npmExecPath.includes("npx")) {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Detect how han was installed
|
|
25
|
-
*/
|
|
26
|
-
export function detectInstallMethod() {
|
|
27
|
-
try {
|
|
28
|
-
const hanPath = execSync("which han", { encoding: "utf8" }).trim();
|
|
29
|
-
// Check if it's a Homebrew installation
|
|
30
|
-
if (hanPath.includes("/homebrew/") || hanPath.includes("/Cellar/")) {
|
|
31
|
-
return "homebrew";
|
|
32
|
-
}
|
|
33
|
-
// Check if it's a symlink to node_modules (npm install -g)
|
|
34
|
-
try {
|
|
35
|
-
const realPath = readlinkSync(hanPath);
|
|
36
|
-
if (realPath.includes("node_modules")) {
|
|
37
|
-
return "npm";
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
catch {
|
|
41
|
-
// Not a symlink, check if it's in a node_modules path
|
|
42
|
-
if (hanPath.includes("node_modules")) {
|
|
43
|
-
return "npm";
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
// Check for standalone binary (installed via curl script)
|
|
47
|
-
if (hanPath.includes("/.local/bin") || hanPath.includes("/usr/local/bin")) {
|
|
48
|
-
// Check if there's a node_modules nearby
|
|
49
|
-
const binDir = dirname(hanPath);
|
|
50
|
-
if (!existsSync(join(binDir, "../lib/node_modules"))) {
|
|
51
|
-
return "standalone";
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return "npm"; // Default to npm if we can't determine
|
|
55
|
-
}
|
|
56
|
-
catch {
|
|
57
|
-
return "unknown";
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Get the current version from package.json (not by spawning han)
|
|
62
|
-
*/
|
|
63
|
-
export function getCurrentVersion() {
|
|
64
|
-
// Use build-time injected version if available
|
|
65
|
-
if (HAN_VERSION) {
|
|
66
|
-
return HAN_VERSION;
|
|
67
|
-
}
|
|
68
|
-
// Otherwise read from package.json
|
|
69
|
-
try {
|
|
70
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
71
|
-
// Go up 3 levels: commands -> lib -> dist -> package.json
|
|
72
|
-
const packageJson = JSON.parse(readFileSync(join(__dirname, "..", "..", "..", "package.json"), "utf-8"));
|
|
73
|
-
return packageJson.version;
|
|
74
|
-
}
|
|
75
|
-
catch {
|
|
76
|
-
return "unknown";
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Get the latest version from npm with timeout
|
|
81
|
-
*/
|
|
82
|
-
export async function getLatestVersion() {
|
|
83
|
-
try {
|
|
84
|
-
const result = execSync("npm view @thebushidocollective/han version 2>/dev/null", { encoding: "utf8", timeout: 5000 }).trim();
|
|
85
|
-
return result;
|
|
86
|
-
}
|
|
87
|
-
catch {
|
|
88
|
-
return "unknown";
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Perform update and re-exec the current command
|
|
93
|
-
* Returns true if update was performed and re-exec happened
|
|
94
|
-
*/
|
|
95
|
-
async function performUpdateAndReexec() {
|
|
96
|
-
const installMethod = detectInstallMethod();
|
|
97
|
-
let updateCommand;
|
|
98
|
-
let updateArgs;
|
|
99
|
-
switch (installMethod) {
|
|
100
|
-
case "homebrew":
|
|
101
|
-
updateCommand = "brew";
|
|
102
|
-
updateArgs = ["upgrade", "han"];
|
|
103
|
-
break;
|
|
104
|
-
case "npm":
|
|
105
|
-
updateCommand = "npm";
|
|
106
|
-
updateArgs = ["install", "-g", "@thebushidocollective/han@latest"];
|
|
107
|
-
break;
|
|
108
|
-
case "standalone":
|
|
109
|
-
updateCommand = "sh";
|
|
110
|
-
updateArgs = ["-c", "curl -fsSL https://han.guru/install.sh | sh"];
|
|
111
|
-
break;
|
|
112
|
-
default:
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
// Perform update silently
|
|
116
|
-
const result = spawnSync(updateCommand, updateArgs, {
|
|
117
|
-
stdio: "pipe",
|
|
118
|
-
shell: installMethod === "standalone",
|
|
119
|
-
});
|
|
120
|
-
if (result.status !== 0) {
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
// Re-exec with the same arguments
|
|
124
|
-
const args = process.argv.slice(2);
|
|
125
|
-
const hanPath = execSync("which han", { encoding: "utf8" }).trim();
|
|
126
|
-
// Spawn the new version with the same args and inherit stdio
|
|
127
|
-
const child = spawn(hanPath, args, {
|
|
128
|
-
stdio: "inherit",
|
|
129
|
-
env: { ...process.env, HAN_SKIP_UPDATE_CHECK: "1" },
|
|
130
|
-
});
|
|
131
|
-
child.on("exit", (code) => {
|
|
132
|
-
process.exit(code ?? 0);
|
|
133
|
-
});
|
|
134
|
-
// Return true to signal we're re-execing (caller should not continue)
|
|
135
|
-
return true;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Check for updates and auto-update if available
|
|
139
|
-
* Call this at startup to enable auto-updates
|
|
140
|
-
* Returns true if an update was performed and re-exec is in progress
|
|
141
|
-
*/
|
|
142
|
-
export async function checkAndAutoUpdate() {
|
|
143
|
-
// Skip if explicitly disabled or already checking
|
|
144
|
-
if (process.env.HAN_SKIP_UPDATE_CHECK === "1") {
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
// Skip if running via npx - npx handles versioning automatically
|
|
148
|
-
// (uses local package.json version if specified, otherwise fetches latest)
|
|
149
|
-
if (isRunningViaNpx()) {
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
const args = process.argv.slice(2);
|
|
153
|
-
// Skip for version/help flags - these should be fast
|
|
154
|
-
if (args.includes("--version") ||
|
|
155
|
-
args.includes("-V") ||
|
|
156
|
-
args.includes("--help") ||
|
|
157
|
-
args.includes("-h") ||
|
|
158
|
-
args.length === 0) {
|
|
159
|
-
return false;
|
|
160
|
-
}
|
|
161
|
-
// Skip for update command itself
|
|
162
|
-
if (args[0] === "update") {
|
|
163
|
-
return false;
|
|
164
|
-
}
|
|
165
|
-
try {
|
|
166
|
-
const currentVersion = getCurrentVersion();
|
|
167
|
-
const latestVersion = await getLatestVersion();
|
|
168
|
-
if (currentVersion !== latestVersion && latestVersion !== "unknown") {
|
|
169
|
-
console.error(`Updating han: ${currentVersion} → ${latestVersion}...`);
|
|
170
|
-
const reexeced = await performUpdateAndReexec();
|
|
171
|
-
if (reexeced) {
|
|
172
|
-
return true;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
catch {
|
|
177
|
-
// Silently ignore update check failures
|
|
178
|
-
}
|
|
179
|
-
return false;
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Register the update command
|
|
183
|
-
*/
|
|
184
|
-
export function registerUpdateCommand(program) {
|
|
185
|
-
program
|
|
186
|
-
.command("update")
|
|
187
|
-
.description("Update han to the latest version")
|
|
188
|
-
.option("--check", "Only check for updates, don't install")
|
|
189
|
-
.action(async (options) => {
|
|
190
|
-
const currentVersion = getCurrentVersion();
|
|
191
|
-
const latestVersion = await getLatestVersion();
|
|
192
|
-
console.log(`Current version: ${currentVersion}`);
|
|
193
|
-
console.log(`Latest version: ${latestVersion}`);
|
|
194
|
-
if (currentVersion === latestVersion) {
|
|
195
|
-
console.log("\n✅ You're already on the latest version!");
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
if (options.check) {
|
|
199
|
-
console.log(`\n📦 Update available: ${currentVersion} → ${latestVersion}`);
|
|
200
|
-
console.log("Run 'han update' to install the update.");
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
const installMethod = detectInstallMethod();
|
|
204
|
-
console.log(`\nInstallation method: ${installMethod}`);
|
|
205
|
-
console.log("Updating...\n");
|
|
206
|
-
let updateCommand;
|
|
207
|
-
let updateArgs;
|
|
208
|
-
switch (installMethod) {
|
|
209
|
-
case "homebrew":
|
|
210
|
-
updateCommand = "brew";
|
|
211
|
-
updateArgs = ["upgrade", "han"];
|
|
212
|
-
break;
|
|
213
|
-
case "npm":
|
|
214
|
-
updateCommand = "npm";
|
|
215
|
-
updateArgs = ["install", "-g", "@thebushidocollective/han@latest"];
|
|
216
|
-
break;
|
|
217
|
-
case "standalone":
|
|
218
|
-
// Re-run the install script
|
|
219
|
-
console.log("Downloading latest version...");
|
|
220
|
-
updateCommand = "sh";
|
|
221
|
-
updateArgs = ["-c", "curl -fsSL https://han.guru/install.sh | sh"];
|
|
222
|
-
break;
|
|
223
|
-
default:
|
|
224
|
-
console.error("Could not determine installation method. Please update manually:");
|
|
225
|
-
console.error(" npm: npm install -g @thebushidocollective/han");
|
|
226
|
-
console.error(" homebrew: brew upgrade han");
|
|
227
|
-
console.error(" curl: curl -fsSL https://han.guru/install.sh | sh");
|
|
228
|
-
process.exit(1);
|
|
229
|
-
}
|
|
230
|
-
const result = spawnSync(updateCommand, updateArgs, {
|
|
231
|
-
stdio: "inherit",
|
|
232
|
-
shell: installMethod === "standalone",
|
|
233
|
-
});
|
|
234
|
-
if (result.status === 0) {
|
|
235
|
-
const newVersion = execSync("han --version", {
|
|
236
|
-
encoding: "utf8",
|
|
237
|
-
}).trim();
|
|
238
|
-
console.log(`\n✅ Successfully updated to version ${newVersion}`);
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
console.error("\n❌ Update failed. Please try updating manually.");
|
|
242
|
-
process.exit(1);
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
//# sourceMappingURL=update.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../lib/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAIzD;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC9B,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,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