github-search-cli 0.8.0 → 0.8.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 CHANGED
@@ -1,145 +1,182 @@
1
- # ghfind
2
-
3
- > Search GitHub repos from your terminal. No browser needed.
4
-
5
- <p align="center">
6
- <img src="https://raw.githubusercontent.com/codersdfs/search-cli/main/demo.svg" alt="ghfind demo" width="100%">
7
- </p>
8
-
9
- ---
10
-
11
- ## Install
12
-
13
- ```bash
14
- npm install -g github-search-cli
15
- ```
16
-
17
- ## Use
18
-
19
- ```bash
20
- # TUI
21
- ghfind
22
-
23
- # pipe
24
- ghfind "language:Rust stars:>1000" --json | jq '.[].fullName'
25
- ghfind "language:Zig" --count
26
- ghfind --trending --json --since weekly
27
- ```
28
-
29
- ### Non-interactive
30
-
31
- ```bash
32
- ghfind "query" --json # JSON
33
- ghfind "query" --csv # CSV
34
- ghfind "query" --markdown # Markdown
35
- ghfind "query" --count # count only
36
- ghfind "query" --format urls # one URL per line
37
- ghfind "query" --pipe open # open in browser
38
- ghfind "query" --pipe clone # clone commands
39
- ghfind --trending --json # trending as JSON
40
- ghfind --watch "query" # poll every 300s
41
- ```
42
-
43
- ### Completions
44
-
45
- ```bash
46
- source <(ghfind --completion bash)
47
- source <(ghfind --completion zsh)
48
- ghfind --completion fish | source
49
- ```
50
-
51
- ---
52
-
53
- ## Features
54
-
55
- <table>
56
- <tr><td><b>Search</b></td><td>Free-text + qualifiers (<code>language:</code>, <code>stars:</code>, <code>topic:</code>), sort by stars/updated/forks</td></tr>
57
- <tr><td><b>Trending</b></td><td>Today, week, month, year — filter by language</td></tr>
58
- <tr><td><b>Bookmarks</b></td><td><code>b</code> / <code>B</code> — save repos, tag them</td></tr>
59
- <tr><td><b>Deep-dive</b></td><td><code>d</code> — languages, contributors, README, activity chart</td></tr>
60
- <tr><td><b>Compare</b></td><td><code>c</code> / <code>C</code> — side-by-side, select 2+ repos</td></tr>
61
- <tr><td><b>Explore</b></td><td><code>E</code> — browse popular topics</td></tr>
62
- <tr><td><b>History</b></td><td><code>Ctrl+R</code> — recall past searches</td></tr>
63
- <tr><td><b>Export</b></td><td><code>Ctrl+E</code> — JSON, CSV, Markdown to file</td></tr>
64
- <tr><td><b>Share</b></td><td><code>Ctrl+P</code> — copy to clipboard (markdown, plain, gh-cli)</td></tr>
65
- <tr><td><b>Watch</b></td><td><code>--watch</code> — poll for new results</td></tr>
66
- </table>
67
-
68
- <details>
69
- <summary>Keybindings</summary>
70
-
71
- | Key | Action |
72
- |-----|--------|
73
- | `/` | Focus search |
74
- | `Enter` | Search / open repo |
75
- | `↑`/`↓` / `j`/`k` | Navigate |
76
- | `t` | Toggle search / trending |
77
- | `s` | Cycle sort |
78
- | `l` | Cycle limit |
79
- | `r` | Refresh |
80
- | `d` | Deep-dive |
81
- | `o` | Open in browser |
82
- | `b` / `B` | Bookmark / bookmarks panel |
83
- | `c` / `C` | Compare select / view |
84
- | `E` | Topic explorer |
85
- | `Tab` | Auto-complete qualifier |
86
- | `?` / `Ctrl+H` | Help |
87
- | `Ctrl+R` | History |
88
- | `Ctrl+S` / `Ctrl+O` | Save / open searches |
89
- | `Ctrl+E` | Export |
90
- | `Ctrl+N` | Notifications |
91
- | `Ctrl+P` | Share |
92
- | `Esc` | Close overlay |
93
- | `q` | Quit |
94
-
95
- Trending tabs: `1`–`5` (Today → All) or `←`/`→` / `h`/`l`
96
- </details>
97
-
98
- ---
99
-
100
- ## Search syntax
101
-
102
- ```
103
- language:Rust stars:>1000 topic:cli
104
- "machine learning" language:Python stars:>5000
105
- topic:cli -language:JavaScript
106
- org:rust-lang language:Rust
107
- ```
108
-
109
- Prefix with `-` to exclude. Supported: `language`, `stars`, `fork`, `archived`, `topic`, `user`, `org`, `repo`, `updated`, `pushed`, `visibility`, `license`, `created`, `size`, `in`.
110
-
111
- ---
112
-
113
- ## Config
114
-
115
- `~/.config/ghfind/config.json` (auto-created, or run `ghfind init`):
116
-
117
- ```json
118
- {
119
- "defaultSort": "stars",
120
- "defaultLimit": 50,
121
- "theme": "tokyo-night",
122
- "githubToken": "ghp_..."
123
- }
124
- ```
125
-
126
- Env: `GITHUB_TOKEN`, `GHFIND_CONFIG`, `XDG_CONFIG_HOME`, `XDG_STATE_HOME`
127
-
128
- ---
129
-
130
- ## From source
131
-
132
- ```bash
133
- git clone https://github.com/codersdfs/search-cli.git
134
- cd ghfind
135
- npm install
136
- npm start # TUI
137
- npm test # 100+ tests
138
- npm run build
139
- ```
140
-
141
- ---
142
-
143
- ## License
144
-
1
+ # ghfind
2
+
3
+ > Search GitHub repos from your terminal. No browser needed.
4
+
5
+ <p align="center">
6
+ <a href="https://x.com/frankli23709971">
7
+ <img src="https://img.shields.io/badge/made%20by-%40frankli23709971-000000?logo=x&labelColor=000000&color=000000&link=https://x.com/frankli23709971" alt="Made by @frankli23709971">
8
+ </a>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <img src="https://raw.githubusercontent.com/codersdfs/search-cli/main/demo.svg" alt="ghfind demo" width="100%">
13
+ </p>
14
+
15
+ [![MIT License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
16
+
17
+ ---
18
+
19
+ ## Install
20
+
21
+ ```bash
22
+ npm install -g github-search-cli
23
+ ```
24
+
25
+ > **No separate runtime needed!** The package bundles a Bun binary, so the TUI
26
+ > works out of the box on Windows, macOS, and Linux — no Node FFI, no `--experimental-ffi`.
27
+ >
28
+ > | Runtime | TUI | CLI modes |
29
+ > |---------|-----|-----------|
30
+ > | Bundled Bun | ✅ | ✅ |
31
+ > | System Bun | ✅ | ✅ |
32
+ > | Node 20+ | ✅ | ✅ |
33
+
34
+ ## Use
35
+
36
+ ```bash
37
+ # TUI
38
+ ghfind
39
+
40
+ # pipe
41
+ ghfind "language:Rust stars:>1000" --json | jq '.[].fullName'
42
+ ghfind "language:Zig" --count
43
+ ghfind --trending --json --since weekly
44
+ ```
45
+
46
+ ### Non-interactive
47
+
48
+ ```bash
49
+ ghfind "query" --json # JSON
50
+ ghfind "query" --csv # CSV
51
+ ghfind "query" --markdown # Markdown
52
+ ghfind "query" --count # count only
53
+ ghfind "query" --format urls # one URL per line
54
+ ghfind "query" --pipe open # open in browser
55
+ ghfind "query" --pipe clone # clone commands
56
+ ghfind --trending --json # trending as JSON
57
+ ghfind --watch "query" # poll every 300s
58
+ ```
59
+
60
+ ### Completions
61
+
62
+ ```bash
63
+ source <(ghfind --completion bash)
64
+ source <(ghfind --completion zsh)
65
+ ghfind --completion fish | source
66
+ ```
67
+
68
+ ---
69
+
70
+ ## Changelog
71
+
72
+ ### v0.8.1
73
+ - Fixed postinstall to download Bun binary correctly on all platforms
74
+ - Fixed zip asset names to match Bun's current release naming
75
+ - Fixed zip parsing to use central directory instead of local file headers
76
+ - Removed `vendor/` from npm package (Bun binary downloaded at install time)
77
+ - Changed `postinstall` to use `node` instead of `bun run` (works without Bun pre-installed)
78
+ - TUI now works on Node.js 20+ via bundled Bun binary
79
+
80
+ ---
81
+
82
+ ## Features
83
+
84
+ <table>
85
+ <tr><td><b>Search</b></td><td>Free-text + qualifiers (<code>language:</code>, <code>stars:</code>, <code>topic:</code>), sort by stars/updated/forks</td></tr>
86
+ <tr><td><b>Trending</b></td><td>Today, week, month, year — filter by language</td></tr>
87
+ <tr><td><b>Bookmarks</b></td><td><code>b</code> / <code>B</code> — save repos, tag them</td></tr>
88
+ <tr><td><b>Deep-dive</b></td><td><code>d</code> — languages, contributors, README, activity chart</td></tr>
89
+ <tr><td><b>Compare</b></td><td><code>c</code> / <code>C</code> — side-by-side, select 2+ repos</td></tr>
90
+ <tr><td><b>Explore</b></td><td><code>E</code> — browse popular topics</td></tr>
91
+ <tr><td><b>History</b></td><td><code>Ctrl+R</code> — recall past searches</td></tr>
92
+ <tr><td><b>Export</b></td><td><code>Ctrl+E</code> — JSON, CSV, Markdown to file</td></tr>
93
+ <tr><td><b>Share</b></td><td><code>Ctrl+P</code> — copy to clipboard (markdown, plain, gh-cli)</td></tr>
94
+ <tr><td><b>Watch</b></td><td><code>--watch</code> — poll for new results</td></tr>
95
+ </table>
96
+
97
+ <details>
98
+ <summary>Keybindings</summary>
99
+
100
+ | Key | Action |
101
+ |-----|--------|
102
+ | `/` | Focus search |
103
+ | `Enter` | Search / open repo |
104
+ | `↑`/`↓` / `j`/`k` | Navigate |
105
+ | `t` | Toggle search / trending |
106
+ | `s` | Cycle sort |
107
+ | `l` | Cycle limit |
108
+ | `r` | Refresh |
109
+ | `d` | Deep-dive |
110
+ | `o` | Open in browser |
111
+ | `b` / `B` | Bookmark / bookmarks panel |
112
+ | `c` / `C` | Compare select / view |
113
+ | `E` | Topic explorer |
114
+ | `Tab` | Auto-complete qualifier |
115
+ | `?` / `Ctrl+H` | Help |
116
+ | `Ctrl+R` | History |
117
+ | `Ctrl+S` / `Ctrl+O` | Save / open searches |
118
+ | `Ctrl+E` | Export |
119
+ | `Ctrl+N` | Notifications |
120
+ | `Ctrl+P` | Share |
121
+ | `Esc` | Close overlay |
122
+ | `q` | Quit |
123
+
124
+ Trending tabs: `1`–`5` (Today → All) or `←`/`→` / `h`/`l`
125
+ </details>
126
+
127
+ ---
128
+
129
+ ## Search syntax
130
+
131
+ ```
132
+ language:Rust stars:>1000 topic:cli
133
+ "machine learning" language:Python stars:>5000
134
+ topic:cli -language:JavaScript
135
+ org:rust-lang language:Rust
136
+ ```
137
+
138
+ Prefix with `-` to exclude. Supported: `language`, `stars`, `fork`, `archived`, `topic`, `user`, `org`, `repo`, `updated`, `pushed`, `visibility`, `license`, `created`, `size`, `in`.
139
+
140
+ ---
141
+
142
+ ## Config
143
+
144
+ `~/.config/ghfind/config.json` (auto-created, or run `ghfind init`):
145
+
146
+ ```json
147
+ {
148
+ "defaultSort": "stars",
149
+ "defaultLimit": 50,
150
+ "theme": "tokyo-night",
151
+ "githubToken": "ghp_..."
152
+ }
153
+ ```
154
+
155
+ Env: `GITHUB_TOKEN`, `GHFIND_CONFIG`, `XDG_CONFIG_HOME`, `XDG_STATE_HOME`
156
+
157
+ ---
158
+
159
+ ## From source
160
+
161
+ ```bash
162
+ git clone https://github.com/codersdfs/search-cli.git
163
+ cd ghfind
164
+
165
+ # With Bun (recommended for TUI)
166
+ bun install
167
+ bun start # TUI
168
+ bun test # 102 tests
169
+ bun run build # build dist/
170
+
171
+ # Or with npm
172
+ npm install
173
+ npm start # TUI (requires Node 20-22 for native FFI)
174
+ npm test # vitest (TUI render test needs Bun)
175
+ npm run build # build dist/
176
+ ```
177
+
178
+ ---
179
+
180
+ ## License
181
+
145
182
  MIT
package/bin/ghfind.js CHANGED
@@ -1,14 +1,55 @@
1
1
  #!/usr/bin/env node
2
- /**
3
- * ghfind — npm bin entry point.
4
- * Requires Node.js >= 20.
5
- */
6
- import { createRequire } from "module";
7
- const require = createRequire(import.meta.url);
8
- try {
9
- await import("../src/cli.ts");
10
- } catch (err) {
11
- console.error("Failed to start ghfind. Node.js >= 20 required.");
12
- console.error(err instanceof Error ? err.message : String(err));
13
- process.exit(1);
14
- }
2
+ /**
3
+ * ghfind — npm bin entry point.
4
+ * Requires Node.js >= 20 or Bun.
5
+ *
6
+ * Uses the bundled Bun binary (vendor/bun.exe) to run the TypeScript source
7
+ * directly, so users don't need to install Bun separately. Falls back to
8
+ * the bundled dist/cli.js if present, or system Bun/Node.
9
+ */
10
+ import { existsSync } from "fs";
11
+ import { spawnSync } from "child_process";
12
+ import { join, dirname } from "path";
13
+ import { fileURLToPath } from "url";
14
+ import { platform } from "os";
15
+
16
+ const __dirname = dirname(fileURLToPath(import.meta.url));
17
+ const PKG_DIR = join(__dirname, "..");
18
+
19
+ // Path to bundled Bun binary
20
+ const BUN_BIN = join(PKG_DIR, "vendor", platform() === "win32" ? "bun.exe" : "bun");
21
+
22
+ // Path to bundled dist
23
+ const distCli = join(PKG_DIR, "dist", "cli.js");
24
+
25
+ // Path to source
26
+ const srcCli = join(PKG_DIR, "src", "cli.ts");
27
+
28
+ // Strategy 1: Use bundled Bun to run source directly (always works, no Node FFI needed)
29
+ if (existsSync(BUN_BIN) && existsSync(srcCli)) {
30
+ const result = spawnSync(BUN_BIN, ["run", srcCli, ...process.argv.slice(2)], {
31
+ stdio: "inherit",
32
+ env: { ...process.env, GHFIND_BUNDLED: "1" },
33
+ });
34
+ process.exit(result.status ?? 0);
35
+ }
36
+
37
+ // Strategy 2: Use bundled dist/cli.js with Node (non-interactive only on Node 23+)
38
+ if (existsSync(distCli)) {
39
+ try {
40
+ await import(distCli);
41
+ } catch (err) {
42
+ console.error("Failed to start ghfind. Node.js >= 20 or Bun required.");
43
+ console.error(err instanceof Error ? err.message : String(err));
44
+ process.exit(1);
45
+ }
46
+ } else {
47
+ // Strategy 3: Fallback to system Bun/Node running source
48
+ try {
49
+ await import("../src/cli.ts");
50
+ } catch (err) {
51
+ console.error("Failed to start ghfind. Node.js >= 20 or Bun required.");
52
+ console.error(err instanceof Error ? err.message : String(err));
53
+ process.exit(1);
54
+ }
55
+ }
@@ -1,19 +1,19 @@
1
- # ghfind fish completion
2
- # Source: source (ghfind --completion fish | psub)
3
-
4
- complete -c ghfind -l json -d "JSON output"
5
- complete -c ghfind -l csv -d "CSV output"
6
- complete -c ghfind -l markdown -d "Markdown table output"
7
- complete -c ghfind -l count -d "Only result count"
8
- complete -c ghfind -l limit -d "Max results" -r
9
- complete -c ghfind -l sort -d "Sort strategy" -r -f -a "best-match stars updated forks"
10
- complete -c ghfind -l token -d "GitHub token" -r
11
- complete -c ghfind -l trending -d "Trending mode"
12
- complete -c ghfind -l since -d "Trending period" -r -f -a "daily weekly monthly"
13
- complete -c ghfind -l pipe -d "Pipe target" -r -f -a "clone open"
14
- complete -c ghfind -l format -d "Output format" -r -f -a "urls names ssh-urls clone-commands ids"
15
- complete -c ghfind -l watch -d "Watch mode"
16
- complete -c ghfind -l interval -d "Watch interval seconds" -r
17
- complete -c ghfind -l version -d "Print version"
18
- complete -c ghfind -l help -d "Print help"
1
+ # ghfind fish completion
2
+ # Source: source (ghfind --completion fish | psub)
3
+
4
+ complete -c ghfind -l json -d "JSON output"
5
+ complete -c ghfind -l csv -d "CSV output"
6
+ complete -c ghfind -l markdown -d "Markdown table output"
7
+ complete -c ghfind -l count -d "Only result count"
8
+ complete -c ghfind -l limit -d "Max results" -r
9
+ complete -c ghfind -l sort -d "Sort strategy" -r -f -a "best-match stars updated forks"
10
+ complete -c ghfind -l token -d "GitHub token" -r
11
+ complete -c ghfind -l trending -d "Trending mode"
12
+ complete -c ghfind -l since -d "Trending period" -r -f -a "daily weekly monthly"
13
+ complete -c ghfind -l pipe -d "Pipe target" -r -f -a "clone open"
14
+ complete -c ghfind -l format -d "Output format" -r -f -a "urls names ssh-urls clone-commands ids"
15
+ complete -c ghfind -l watch -d "Watch mode"
16
+ complete -c ghfind -l interval -d "Watch interval seconds" -r
17
+ complete -c ghfind -l version -d "Print version"
18
+ complete -c ghfind -l help -d "Print help"
19
19
  complete -c ghfind -l completion -d "Shell" -r -f -a "bash zsh fish"
@@ -1,27 +1,27 @@
1
- # ghfind zsh completion
2
- # Source: source <(ghfind --completion zsh)
3
-
4
- _ghfind() {
5
- local -a opts
6
- opts=(
7
- '--json[JSON output]'
8
- '--csv[CSV output]'
9
- '--markdown[Markdown table output]'
10
- '--count[Only result count]'
11
- '--limit[Max results]:limit:'
12
- '--sort[Sort strategy]:(best-match stars updated forks)'
13
- '--token[GitHub token]:token:'
14
- '--trending[Trending mode]'
15
- '--since[Trending period]:(daily weekly monthly)'
16
- '--pipe[Pipe target]:(clone open)'
17
- '--format[Output format]:(urls names ssh-urls clone-commands ids)'
18
- '--watch[Watch mode]'
19
- '--interval[Watch interval seconds]:seconds:'
20
- '--version[Print version]'
21
- '--help[Print help]'
22
- '--completion[Shell]:(bash zsh fish)'
23
- )
24
- _arguments "${opts[@]}" '*:query:'
25
- }
26
-
1
+ # ghfind zsh completion
2
+ # Source: source <(ghfind --completion zsh)
3
+
4
+ _ghfind() {
5
+ local -a opts
6
+ opts=(
7
+ '--json[JSON output]'
8
+ '--csv[CSV output]'
9
+ '--markdown[Markdown table output]'
10
+ '--count[Only result count]'
11
+ '--limit[Max results]:limit:'
12
+ '--sort[Sort strategy]:(best-match stars updated forks)'
13
+ '--token[GitHub token]:token:'
14
+ '--trending[Trending mode]'
15
+ '--since[Trending period]:(daily weekly monthly)'
16
+ '--pipe[Pipe target]:(clone open)'
17
+ '--format[Output format]:(urls names ssh-urls clone-commands ids)'
18
+ '--watch[Watch mode]'
19
+ '--interval[Watch interval seconds]:seconds:'
20
+ '--version[Print version]'
21
+ '--help[Print help]'
22
+ '--completion[Shell]:(bash zsh fish)'
23
+ )
24
+ _arguments "${opts[@]}" '*:query:'
25
+ }
26
+
27
27
  compdef _ghfind ghfind