github-search-cli 0.9.0 → 9.1.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/README.md CHANGED
@@ -202,8 +202,19 @@ npm run build # build dist/
202
202
  ```
203
203
 
204
204
  ---
205
+ ### v0.9.1
206
+
207
+ - bug fix TUI layout issues on small terminals
208
+ - npm package search(beta)
209
+ - a new landing screen
210
+
211
+ ### v0.9.0
212
+
213
+ - Bundle `vendor/` and `dist/` in npm package for offline install support
214
+ - Remove dead Strategy 3 fallback in `bin/ghfind.js` (Node cannot import `.ts`)
215
+ - Fix postinstall to exit with code 1 on Bun download failure
216
+ - Update bundled Bun version from 1.3.12 to 1.3.14
205
217
 
206
- ## Changelog
207
218
 
208
219
  ### v0.8.2
209
220
 
package/bin/ghfind.js CHANGED
@@ -10,9 +10,8 @@
10
10
  import { existsSync } from "fs";
11
11
  import { spawnSync } from "child_process";
12
12
  import { join, dirname } from "path";
13
- import { fileURLToPath } from "url";
13
+ import { fileURLToPath, pathToFileURL } from "url";
14
14
  import { platform } from "os";
15
-
16
15
  const __dirname = dirname(fileURLToPath(import.meta.url));
17
16
  const PKG_DIR = join(__dirname, "..");
18
17
 
@@ -37,16 +36,7 @@ if (existsSync(BUN_BIN) && existsSync(srcCli)) {
37
36
  // Strategy 2: Use bundled dist/cli.js with Node (non-interactive only on Node 23+)
38
37
  if (existsSync(distCli)) {
39
38
  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");
39
+ await import(pathToFileURL(distCli).href);
50
40
  } catch (err) {
51
41
  console.error("Failed to start ghfind. Node.js >= 20 or Bun required.");
52
42
  console.error(err instanceof Error ? err.message : String(err));
@@ -7,7 +7,7 @@ _ghfind() {
7
7
  cur="${COMP_WORDS[COMP_CWORD]}"
8
8
  prev="${COMP_WORDS[COMP_CWORD-1]}"
9
9
 
10
- opts="--json --csv --markdown --count --limit --sort --token --trending --since --pipe --format --watch --interval --version --help --completion"
10
+ opts="--json --csv --markdown --count --limit --sort --token --trending --since --pipe --format --registry --watch --interval --version --help --completion pkg"
11
11
 
12
12
  case "${prev}" in
13
13
  --sort)
@@ -30,6 +30,10 @@ _ghfind() {
30
30
  COMPREPLY=( $(compgen -W "bash zsh fish" -- "${cur}") )
31
31
  return 0
32
32
  ;;
33
+ --registry)
34
+ COMPREPLY=( $(compgen -W "npm" -- "${cur}") )
35
+ return 0
36
+ ;;
33
37
  --limit|--interval)
34
38
  return 0
35
39
  ;;
@@ -12,6 +12,8 @@ complete -c ghfind -l trending -d "Trending mode"
12
12
  complete -c ghfind -l since -d "Trending period" -r -f -a "daily weekly monthly"
13
13
  complete -c ghfind -l pipe -d "Pipe target" -r -f -a "clone open"
14
14
  complete -c ghfind -l format -d "Output format" -r -f -a "urls names ssh-urls clone-commands ids"
15
+ complete -c ghfind -l registry -d "Registry for pkg" -r -f -a "npm"
16
+
15
17
  complete -c ghfind -l watch -d "Watch mode"
16
18
  complete -c ghfind -l interval -d "Watch interval seconds" -r
17
19
  complete -c ghfind -l version -d "Print version"
@@ -15,6 +15,8 @@ _ghfind() {
15
15
  '--since[Trending period]:(daily weekly monthly)'
16
16
  '--pipe[Pipe target]:(clone open)'
17
17
  '--format[Output format]:(urls names ssh-urls clone-commands ids)'
18
+ '--registry[Registry for pkg]:(npm)'
19
+
18
20
  '--watch[Watch mode]'
19
21
  '--interval[Watch interval seconds]:seconds:'
20
22
  '--version[Print version]'
package/demo.svg CHANGED
@@ -12,55 +12,60 @@
12
12
  <rect width="100%" height="100%" fill="#0d0d1a"/>
13
13
 
14
14
  <!-- Window -->
15
- <rect x="12" y="10" width="876" height="783" fill="#1e1e2e" rx="8" filter="url(#shadow)"/>
16
- <rect x="12" y="10" width="876" height="36" fill="#181825" rx="8"/>
17
- <rect x="12" y="46" width="876" height="2" fill="#313244"/>
15
+ <rect x="12" y="10" width="876" height="783" fill="#1a1b26" rx="8" filter="url(#shadow)"/>
16
+ <rect x="12" y="10" width="876" height="36" fill="#16161e" rx="8"/>
17
+ <rect x="12" y="46" width="876" height="2" fill="#24283b"/>
18
18
 
19
19
  <!-- Traffic lights -->
20
- <circle cx="24" cy="28" r="5" fill="#f38ba8"/>
21
- <circle cx="42" cy="28" r="5" fill="#f9e2af"/>
22
- <circle cx="60" cy="28" r="5" fill="#a6e3a1"/>
23
- <text x="450" y="34" fill="#6c7086" font-family="'JetBrains Mono','Fira Code',monospace" font-size="13" text-anchor="middle">search-cli — terminal GitHub browser</text>
20
+ <circle cx="24" cy="28" r="5" fill="#f7768e"/>
21
+ <circle cx="42" cy="28" r="5" fill="#e0af68"/>
22
+ <circle cx="60" cy="28" r="5" fill="#9ece6a"/>
23
+ <text x="450" y="34" fill="#565f89" font-family="'JetBrains Mono','Fira Code',monospace" font-size="13" text-anchor="middle">ghfind — terminal GitHub browser</text>
24
24
 
25
25
  <g font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">
26
- <text x="14" y="62" fill="#6c7086" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">search-cli — GitHub repo browser [t]rending [/]search [g]raph [r]efresh [q]uit</text>
27
- <rect x="14" y="69" width="860" height="54.5" fill="#1e1e2e" stroke="#89b4fa" stroke-width="1" rx="3"/>
28
- <text x="22" y="88" fill="#89b4fa" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">&gt; language:TypeScript stars:&gt;1000</text>
29
- <text x="14" y="150.2" fill="#6c7086" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">sort: stars limit: 50 (s=cycle sort l=cycle limit)</text>
30
- <rect x="14" y="159.3" width="432" height="378" fill="#1e1e2e" stroke="#45475a" stroke-width="1" rx="3"/>
31
- <text x="22" y="177.5" fill="#89b4fa" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14"> Results </text>
32
- <rect x="18" y="178.20000000000002" width="424" height="20" fill="#2d5bcf" rx="3"/>
33
- <text x="24" y="198.5" fill="#ffffff" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">shadcn/ui ★ 78.5k</text>
34
- <text x="24" y="221.6" fill="#cdd6f4" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">vercel/next.js ★ 129k</text>
35
- <text x="24" y="244.7" fill="#cdd6f4" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">tailwindlabs/tailwindcss ★ 84.2k</text>
36
- <text x="24" y="267.8" fill="#cdd6f4" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">tauri-apps/tauri ★ 84.1k</text>
37
- <text x="24" y="290.9" fill="#cdd6f4" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">oven-sh/bun ★ 74.5k</text>
38
- <text x="24" y="314" fill="#cdd6f4" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">n8n-io/n8n ★ 54.4k</text>
39
- <text x="24" y="337.1" fill="#cdd6f4" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">astral-sh/ruff ★ 36.1k</text>
40
- <text x="24" y="360.20000000000005" fill="#cdd6f4" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">missive/emoji-mart ★ 8.8k</text>
41
- <text x="24" y="383.3" fill="#cdd6f4" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">sharkdp/bat ★ 50.3k</text>
42
- <text x="24" y="406.4" fill="#cdd6f4" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">BurntSushi/ripgrep ★ 48.8k</text>
43
- <text x="24" y="429.5" fill="#cdd6f4" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">jdx/mise ★ 14.3k</text>
44
- <text x="24" y="452.6" fill="#cdd6f4" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">nektos/act ★ 56.1k</text>
45
- <text x="24" y="475.70000000000005" fill="#cdd6f4" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">astral-sh/uv ★ 40.2k</text>
46
- <text x="24" y="498.8" fill="#cdd6f4" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">zed-industries/zed ★ 52k</text>
47
- <rect x="450" y="159.3" width="432" height="378" fill="#1e1e2e" stroke="#45475a" stroke-width="1" rx="3"/>
48
- <text x="456" y="177.5" fill="#a6e3a1" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14"> Details </text>
49
- <text x="458" y="198.5" fill="#6c7086" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">Name shadcn/ui</text>
50
- <text x="458" y="221.6" fill="#6c7086" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">Stars 78,500</text>
51
- <text x="458" y="244.7" fill="#6c7086" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">Forks 4,200</text>
52
- <text x="458" y="267.8" fill="#6c7086" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">Lang TypeScript</text>
53
- <text x="458" y="290.9" fill="#6c7086" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">Updated 2026-07-12</text>
54
- <text x="458" y="314" fill="#6c7086" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">Topics react, ui, components, shadcn</text>
55
- <text x="458" y="360.20000000000005" fill="#cdd6f4" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">Beautifully designed components built with Radix UI and</text>
56
- <text x="458" y="383.3" fill="#cdd6f4" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">Tailwind CSS.</text>
57
- <text x="458" y="429.5" fill="#89b4fa" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">https://github.com/shadcn/ui</text>
58
- <rect x="14" y="489" width="860" height="25" fill="#181825" rx="3"/>
59
- <rect x="14" y="489" width="860" height="2" fill="#45475a"/>
60
- <text x="18" y="521.9" fill="#6c7086" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">15,842 results (↑↓ nav Enter open o browser Ctrl+R history)</text>
61
- <rect x="338.79999999999995" y="70" width="5.76" height="16" fill="#89b4fa" opacity="0.8">
62
- <animate attributeName="opacity" values="0.8;0.1;0.8" dur="1s" repeatCount="indefinite"/>
63
- </rect>
26
+ <text x="14" y="62" fill="#565f89" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">ghfind — GitHub repo browser [t]rending [/]search [g]raph [r]efresh [q]uit</text>
27
+ <rect x="14" y="69" width="860" height="54.5" fill="#1a1b26" stroke="#7aa2f7" stroke-width="1" rx="3"/>
28
+ <text x="22" y="88" fill="#7aa2f7" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">&gt; language:TypeScript stars:&gt;1000</text>
29
+ <text x="14" y="150.2" fill="#565f89" font-family="'JetBrains Mono','Fira Code','Cascadia Code',monospace" font-size="14">sort: stars limit: 50 (s=cycle sort l=cycle limit)</text>
30
+ <rect x="14" y="159.3" width="432" height="378" fill="#24283b" stroke="#1f2335" stroke-width="1"/>
31
+ <!-- Search results list -->
32
+ <rect x="14" y="159.3" width="432" height="19" fill="#7aa2f7" opacity="0.15"/>
33
+ <text x="22" y="173" fill="#c0caf5">✓ facebook/react ★ 218k JavaScript</text>
34
+ <text x="22" y="193" fill="#c0caf5">✓ vercel/next.js ★ 116k TypeScript</text>
35
+ <text x="22" y="213" fill="#c0caf5">✓ microsoft/vscode ★ 158k TypeScript</text>
36
+ <text x="22" y="233" fill="#c0caf5">✓ tanstack/router ★ 15k TypeScript</text>
37
+ <text x="22" y="253" fill="#c0caf5">✓ tailwindlabs/tailwindcss ★ 81k TypeScript</text>
38
+ <text x="22" y="273" fill="#c0caf5">✓ denoland/deno ★ 93k Rust</text>
39
+ <text x="22" y="293" fill="#c0caf5">✓ oven-sh/bun ★ 65k TypeScript</text>
40
+ <text x="22" y="313" fill="#c0caf5">✓ sagoie/open-tui ★ 3.2k TypeScript</text>
41
+ <text x="22" y="333" fill="#e0af68">→ ghfind/cli ★ 4.8k TypeScript</text>
42
+ <text x="22" y="353" fill="#c0caf5">✓ biomejs/biome ★ 28k Rust</text>
43
+ <!-- ... more results ... -->
44
+ <text x="14" y="525" fill="#565f89"> 10 of 847 results [Page 1/85]</text>
64
45
 
46
+ <rect x="456" y="159.3" width="418" height="378" fill="#24283b" stroke="#1f2335" stroke-width="1"/>
47
+ <!-- Right panel: repo info -->
48
+ <text x="468" y="183" fill="#bb9af7" font-weight="bold">facebook/react</text>
49
+ <text x="468" y="203" fill="#565f89">React is a JavaScript library for building user interfaces</text>
50
+ <text x="468" y="228" fill="#e0af68">★ 218,847</text>
51
+ <text x="540" y="228" fill="#565f89"> Forks: 46,231</text>
52
+ <text x="468" y="248" fill="#9ece6a">License: MIT</text>
53
+ <text x="468" y="268" fill="#7aa2f7">Language: JavaScript</text>
54
+ <text x="468" y="293" fill="#c0caf5">Updated: today</text>
55
+ <text x="468" y="318" fill="#565f89">Topics: react, javascript, ui, frontend, framework</text>
56
+
57
+ <text x="468" y="348" fill="#7aa2f7" font-weight="bold">Description</text>
58
+ <text x="468" y="368" fill="#c0caf5">A declarative, efficient, and flexible JavaScript library</text>
59
+ <text x="468" y="383" fill="#c0caf5">for building user interfaces.</text>
60
+
61
+ <text x="468" y="413" fill="#7aa2f7" font-weight="bold">README Preview</text>
62
+ <text x="468" y="433" fill="#c0caf5"># React</text>
63
+ <text x="468" y="453" fill="#565f89"> A JavaScript library for building user interfaces</text>
64
+ <text x="468" y="478" fill="#565f89"> ──────────────────────────────────────────────────</text>
65
+ <text x="468" y="503" fill="#c0caf5">React lets you build user interfaces out of individual</text>
66
+ <text x="468" y="518" fill="#c0caf5">pieces called components.</text>
67
+
68
+ <rect x="456" y="545" width="418" height="40" fill="#16161e" stroke="#1f2335"/>
69
+ <text x="468" y="570" fill="#565f89"> [r]eadme [d]eepdive [→] open [h]elp [q]uit</text>
65
70
  </g>
66
- </svg>
71
+ </svg>
@@ -0,0 +1,56 @@
1
+ // src/config.ts
2
+ import { homedir } from "os";
3
+ import { join } from "path";
4
+ import { mkdirSync, readFileSync, writeFileSync } from "fs";
5
+ function stateDir() {
6
+ const xdg = process.env.XDG_STATE_HOME;
7
+ const base = xdg ? join(xdg, "ghfind") : join(homedir(), ".local", "share", "ghfind");
8
+ return base;
9
+ }
10
+ function cacheDir() {
11
+ const xdg = process.env.XDG_CACHE_HOME;
12
+ const base = xdg ? join(xdg, "ghfind") : join(homedir(), ".cache", "ghfind");
13
+ return base;
14
+ }
15
+ var DEFAULTS = {
16
+ defaultSort: "best-match",
17
+ defaultLimit: 50,
18
+ theme: "tokyo-night",
19
+ cacheTtlSeconds: 300,
20
+ defaultTab: "search"
21
+ };
22
+ function configPath() {
23
+ const envPath = process.env.GHFIND_CONFIG;
24
+ if (envPath) return envPath;
25
+ const xdg = process.env.XDG_CONFIG_HOME;
26
+ const base = xdg ? join(xdg, "ghfind") : join(homedir(), ".config", "ghfind");
27
+ return join(base, "config.json");
28
+ }
29
+ function loadConfig() {
30
+ const path = configPath();
31
+ try {
32
+ const raw = readFileSync(path, "utf-8");
33
+ const parsed = JSON.parse(raw);
34
+ return mergeWithEnv({ ...DEFAULTS, ...parsed });
35
+ } catch {
36
+ return mergeWithEnv({ ...DEFAULTS });
37
+ }
38
+ }
39
+ function saveConfig(config) {
40
+ const path = configPath();
41
+ const dir = path.slice(0, Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\")));
42
+ mkdirSync(dir, { recursive: true });
43
+ writeFileSync(path, JSON.stringify(config, null, 2));
44
+ }
45
+ function mergeWithEnv(config) {
46
+ if (process.env.GITHUB_TOKEN) config.githubToken = process.env.GITHUB_TOKEN;
47
+ return config;
48
+ }
49
+
50
+ export {
51
+ stateDir,
52
+ cacheDir,
53
+ configPath,
54
+ loadConfig,
55
+ saveConfig
56
+ };