github-search-cli 0.8.2 → 9.1.0
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 +109 -50
- package/bin/ghfind.js +3 -13
- package/dist/chunk-TUMYR2IC.js +57 -0
- package/dist/cli.js +3761 -0
- package/dist/config-DFL44OVL.js +14 -0
- package/package.json +3 -1
- package/scripts/postinstall.js +106 -106
- package/src/bookmarks.ts +4 -17
- package/src/cli.ts +90 -61
- package/src/config.ts +2 -2
- package/src/history.ts +16 -52
- package/src/notifications.ts +5 -12
- package/src/output.ts +124 -55
- package/src/saved-searches.ts +4 -12
- package/src/search-state.ts +229 -0
- package/src/search.ts +99 -2
- package/src/session.ts +6 -18
- package/src/storage.ts +106 -0
- package/src/themes.ts +47 -7
- package/src/trending.ts +27 -150
- package/src/tui.ts +1087 -270
- package/src/types.ts +2 -0
- package/src/update-check.ts +162 -0
- package/src/watch.ts +23 -11
- package/vendor/bun.exe +0 -0
package/README.md
CHANGED
|
@@ -25,11 +25,11 @@ npm install -g github-search-cli
|
|
|
25
25
|
> **No separate runtime needed!** The package bundles a Bun binary, so the TUI
|
|
26
26
|
> works out of the box on Windows, macOS, and Linux — no Node FFI, no `--experimental-ffi`.
|
|
27
27
|
>
|
|
28
|
-
> | Runtime
|
|
29
|
-
>
|
|
30
|
-
> | Bundled Bun | ✅
|
|
31
|
-
> | System Bun
|
|
32
|
-
> | Node 20+
|
|
28
|
+
> | Runtime | TUI | CLI modes |
|
|
29
|
+
> | ----------- | --- | --------- |
|
|
30
|
+
> | Bundled Bun | ✅ | ✅ |
|
|
31
|
+
> | System Bun | ✅ | ✅ |
|
|
32
|
+
> | Node 20+ | ✅ | ✅ |
|
|
33
33
|
|
|
34
34
|
## Use
|
|
35
35
|
|
|
@@ -67,61 +67,87 @@ ghfind --completion fish | source
|
|
|
67
67
|
|
|
68
68
|
---
|
|
69
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
70
|
## Features
|
|
83
71
|
|
|
84
72
|
<table>
|
|
85
73
|
<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
74
|
<tr><td><b>Trending</b></td><td>Today, week, month, year — filter by language</td></tr>
|
|
87
|
-
<tr><td><b>Bookmarks</b></td><td
|
|
88
|
-
<tr><td><b>Deep-dive</b></td><td
|
|
89
|
-
<tr><td><b>Compare</b></td><td
|
|
90
|
-
<tr><td><b>Explore</b></td><td
|
|
91
|
-
<tr><td><b>History</b></td><td
|
|
92
|
-
<tr><td><b>
|
|
93
|
-
<tr><td><b>
|
|
75
|
+
<tr><td><b>Bookmarks</b></td><td>Space → Bookmark / Bookmarks panel — save repos, tag them</td></tr>
|
|
76
|
+
<tr><td><b>Deep-dive</b></td><td>Space → Deep-dive — languages, contributors, README, activity chart</td></tr>
|
|
77
|
+
<tr><td><b>Compare</b></td><td>Space → Compare select / Compare view — side-by-side, select 2+ repos</td></tr>
|
|
78
|
+
<tr><td><b>Explore</b></td><td>Space → Topics — browse popular GitHub topics</td></tr>
|
|
79
|
+
<tr><td><b>History</b></td><td>Space → History — recall past searches</td></tr>
|
|
80
|
+
<tr><td><b>Saved</b></td><td>Space → Saved searches — load or save queries</td></tr>
|
|
81
|
+
<tr><td><b>Export</b></td><td>Space → Export — JSON, CSV, Markdown to file</td></tr>
|
|
82
|
+
<tr><td><b>Share</b></td><td>Space → Share repo — copy repo link to clipboard</td></tr>
|
|
83
|
+
<tr><td><b>Notifications</b></td><td>Space → Notifications — view & dismiss alerts</td></tr>
|
|
84
|
+
<tr><td><b>Graph</b></td><td>Space → Activity graph — commit chart, fullscreen toggle</td></tr>
|
|
85
|
+
<tr><td><b>Help</b></td><td><code>?</code> / <code>Ctrl+H</code> — keybindings reference</td></tr>
|
|
94
86
|
<tr><td><b>Watch</b></td><td><code>--watch</code> — poll for new results</td></tr>
|
|
95
87
|
</table>
|
|
96
88
|
|
|
97
89
|
<details>
|
|
98
90
|
<summary>Keybindings</summary>
|
|
99
91
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
|
103
|
-
|
|
|
104
|
-
|
|
|
105
|
-
| `
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
108
|
-
| `
|
|
109
|
-
| `
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
|
122
|
-
|
|
|
123
|
-
|
|
124
|
-
|
|
92
|
+
**Global shortcuts** (main view, no overlay active)
|
|
93
|
+
|
|
94
|
+
| Key | Action |
|
|
95
|
+
| --------------------- | ---------------------------------------------- |
|
|
96
|
+
| `/` | Focus search input |
|
|
97
|
+
| `Enter` | Execute search / open selected repo in browser |
|
|
98
|
+
| `↑` / `↓` — `j` / `k` | Navigate results & menus |
|
|
99
|
+
| `Space` | Open leader menu (contextual actions) |
|
|
100
|
+
| `Tab` | Auto-complete search qualifier |
|
|
101
|
+
| `?` or `Ctrl+H` | Help overlay |
|
|
102
|
+
| `1`–`5` | Switch trending tabs (Today → All) |
|
|
103
|
+
| `←` / `→` — `h` / `l` | Switch trending tabs (left/right) |
|
|
104
|
+
| `PageUp` | Jump to top of results |
|
|
105
|
+
| `PageDown` | Load next page of results |
|
|
106
|
+
| `Esc` | Close current overlay |
|
|
107
|
+
| `q` | Quit ghfind |
|
|
108
|
+
|
|
109
|
+
**Leader menu** — press `Space`, navigate with `↑`/`↓`, press `Enter` to dispatch
|
|
110
|
+
|
|
111
|
+
Actions shown depend on current mode (search vs trending) and selection:
|
|
112
|
+
|
|
113
|
+
| Menu item | Description |
|
|
114
|
+
| --------------- | ------------------------------------------------------- |
|
|
115
|
+
| Sort | Cycle sort strategy (best-match, stars, updated, forks) |
|
|
116
|
+
| Limit | Cycle result limit (10, 25, 50, 100) |
|
|
117
|
+
| Refresh | Re-run current search (or reload trending) |
|
|
118
|
+
| Toggle trending | Switch between search and trending views |
|
|
119
|
+
| Deep-dive | Show languages, contributors, README excerpt |
|
|
120
|
+
| Readme | Full README viewer |
|
|
121
|
+
| Activity graph | Toggle commit chart fullscreen |
|
|
122
|
+
| Bookmark | Save / unsave selected repo |
|
|
123
|
+
| Compare | Add/remove repo to comparison set |
|
|
124
|
+
| Compare view | Show side-by-side comparison table |
|
|
125
|
+
| Open in browser | Open selected repo URL |
|
|
126
|
+
| History | Recall past searches |
|
|
127
|
+
| Saved searches | Load a saved search |
|
|
128
|
+
| Save search | Save current query |
|
|
129
|
+
| Export | Export results to JSON / CSV / Markdown |
|
|
130
|
+
| Share repo | Copy repo link to clipboard |
|
|
131
|
+
| Notifications | View and dismiss alerts |
|
|
132
|
+
| Topics | Browse popular GitHub topics |
|
|
133
|
+
| Bookmarks panel | Browse saved bookmarks |
|
|
134
|
+
| Help | Keybindings reference |
|
|
135
|
+
|
|
136
|
+
**Overlay-specific shortcuts**
|
|
137
|
+
|
|
138
|
+
| Key | Context | Action |
|
|
139
|
+
| --------------- | ---------------------------------------------------- | ------------------------------------------- |
|
|
140
|
+
| `Esc` / `q` | Any overlay | Close overlay |
|
|
141
|
+
| `Enter` | Leader / History / Saved / Export / Topics / Share | Confirm selection |
|
|
142
|
+
| `d` | History / Bookmarks / Saved searches / Notifications | Delete current entry |
|
|
143
|
+
| `Ctrl+X` | History | Clear all history |
|
|
144
|
+
| `Ctrl+C` | Notifications | Dismiss all notifications |
|
|
145
|
+
| `Y` / `N` / `L` | Update modal | Yes (install) / No (skip) / Later (dismiss) |
|
|
146
|
+
|
|
147
|
+
Trending tabs: `1`–`5` (Today → All) or `←`/`→` — `h`/`l`
|
|
148
|
+
|
|
149
|
+
> Most actions are accessed via the **leader menu** (`Space`). This keeps the keymap minimal while providing a full command palette. The leader menu filters actions contextually — items that don't apply (e.g., Bookmark with no repo selected) are hidden.
|
|
150
|
+
|
|
125
151
|
</details>
|
|
126
152
|
|
|
127
153
|
---
|
|
@@ -177,6 +203,39 @@ npm run build # build dist/
|
|
|
177
203
|
|
|
178
204
|
---
|
|
179
205
|
|
|
206
|
+
### v9.1.0
|
|
207
|
+
|
|
208
|
+
- Bundle `vendor/` and `dist/` in npm package for offline install support
|
|
209
|
+
- Remove dead Strategy 3 fallback in `bin/ghfind.js` (Node cannot import `.ts`)
|
|
210
|
+
- Fix postinstall to exit with code 1 on Bun download failure
|
|
211
|
+
- Update bundled Bun version from 1.3.12 to 1.3.14
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
### v0.8.2
|
|
215
|
+
|
|
216
|
+
- Added automatic update checking against the npm registry
|
|
217
|
+
- Added leader menu (Space) consolidating all contextual actions
|
|
218
|
+
- Added update modal with Y/N/L (install now / skip / dismiss)
|
|
219
|
+
- Added topic explorer, notifications panel, and saved searches overlay
|
|
220
|
+
- Added activity graph toggle (commit chart fullscreen)
|
|
221
|
+
- Added README viewer (full markdown rendering in TUI)
|
|
222
|
+
- Added result auto-complete for search qualifiers (Tab)
|
|
223
|
+
- Added PageUp/PageDown for quick navigation
|
|
224
|
+
- Added Ctrl+X to clear history, Ctrl+C to clear all notifications
|
|
225
|
+
- Improved export error handling and format selection
|
|
226
|
+
- Updated keybindings reference
|
|
227
|
+
|
|
228
|
+
### v0.8.1
|
|
229
|
+
|
|
230
|
+
- Fixed postinstall to download Bun binary correctly on all platforms
|
|
231
|
+
- Fixed zip asset names to match Bun's current release naming
|
|
232
|
+
- Fixed zip parsing to use central directory instead of local file headers
|
|
233
|
+
- Removed `vendor/` from npm package (Bun binary downloaded at install time)
|
|
234
|
+
- Changed `postinstall` to use `node` instead of `bun run` (works without Bun pre-installed)
|
|
235
|
+
- TUI now works on Node.js 20+ via bundled Bun binary
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
180
239
|
## License
|
|
181
240
|
|
|
182
|
-
MIT
|
|
241
|
+
MIT
|
package/bin/ghfind.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* ghfind — npm bin entry point.
|
|
4
4
|
* Requires Node.js >= 20 or Bun.
|
|
@@ -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));
|
|
@@ -0,0 +1,57 @@
|
|
|
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: "premium-dark",
|
|
19
|
+
// New default: premium dark with sharp edges
|
|
20
|
+
cacheTtlSeconds: 300,
|
|
21
|
+
defaultTab: "search"
|
|
22
|
+
};
|
|
23
|
+
function configPath() {
|
|
24
|
+
const envPath = process.env.GHFIND_CONFIG;
|
|
25
|
+
if (envPath) return envPath;
|
|
26
|
+
const xdg = process.env.XDG_CONFIG_HOME;
|
|
27
|
+
const base = xdg ? join(xdg, "ghfind") : join(homedir(), ".config", "ghfind");
|
|
28
|
+
return join(base, "config.json");
|
|
29
|
+
}
|
|
30
|
+
function loadConfig() {
|
|
31
|
+
const path = configPath();
|
|
32
|
+
try {
|
|
33
|
+
const raw = readFileSync(path, "utf-8");
|
|
34
|
+
const parsed = JSON.parse(raw);
|
|
35
|
+
return mergeWithEnv({ ...DEFAULTS, ...parsed });
|
|
36
|
+
} catch {
|
|
37
|
+
return mergeWithEnv({ ...DEFAULTS });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function saveConfig(config) {
|
|
41
|
+
const path = configPath();
|
|
42
|
+
const dir = path.slice(0, Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\")));
|
|
43
|
+
mkdirSync(dir, { recursive: true });
|
|
44
|
+
writeFileSync(path, JSON.stringify(config, null, 2));
|
|
45
|
+
}
|
|
46
|
+
function mergeWithEnv(config) {
|
|
47
|
+
if (process.env.GITHUB_TOKEN) config.githubToken = process.env.GITHUB_TOKEN;
|
|
48
|
+
return config;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
stateDir,
|
|
53
|
+
cacheDir,
|
|
54
|
+
configPath,
|
|
55
|
+
loadConfig,
|
|
56
|
+
saveConfig
|
|
57
|
+
};
|