@arthony/keybook 0.1.0 → 0.2.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 +16 -6
- package/dist/cli.js +25 -2
- package/package.json +34 -18
package/README.md
CHANGED
|
@@ -5,16 +5,29 @@ shortcuts and short recipes of your most-used apps. Launch `keybook`,
|
|
|
5
5
|
fuzzy-search by intent ("finder new tab", "terminal here"), and learn your
|
|
6
6
|
shortcuts along the way.
|
|
7
7
|
|
|
8
|
+

|
|
9
|
+
|
|
8
10
|
## Install
|
|
9
11
|
|
|
12
|
+
```bash
|
|
13
|
+
brew install ariyapong/tap/keybook
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Or via npm:
|
|
17
|
+
|
|
10
18
|
```bash
|
|
11
19
|
npm install -g @arthony/keybook
|
|
12
20
|
# or run without installing:
|
|
13
|
-
npx @arthony/keybook
|
|
21
|
+
npx -p @arthony/keybook keybook
|
|
14
22
|
```
|
|
15
23
|
|
|
16
|
-
Requires
|
|
17
|
-
|
|
24
|
+
Requires macOS. The Homebrew tap installs Node 22 automatically; the npm
|
|
25
|
+
route assumes you already have Node 22+. Both install the `keybook`
|
|
26
|
+
command and the `kb` alias.
|
|
27
|
+
|
|
28
|
+
**Terminal.app users:** if `⌥⌫` doesn't delete a word in the search input,
|
|
29
|
+
enable *Terminal → Settings → Profiles → Keyboard → "Use Option as Meta
|
|
30
|
+
key"*, or use `⌃W` (works in any terminal).
|
|
18
31
|
|
|
19
32
|
## Usage
|
|
20
33
|
|
|
@@ -78,9 +91,6 @@ first-run seeding), `src/search.ts` (fzf), `src/tui` (Ink components),
|
|
|
78
91
|
`src/cli.ts` (commander entry), `seed/` (bundled starter data). Design docs are
|
|
79
92
|
in `docs/superpowers/`.
|
|
80
93
|
|
|
81
|
-
If `pnpm lint` reports a missing Biome binary, run `pnpm approve-builds`
|
|
82
|
-
(pnpm skips package build scripts by default).
|
|
83
|
-
|
|
84
94
|
## License
|
|
85
95
|
|
|
86
96
|
MIT
|
package/dist/cli.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
4
|
import { spawn } from "child_process";
|
|
5
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
6
|
+
import { dirname as dirname2, join as join3 } from "path";
|
|
7
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
5
8
|
import { Command } from "commander";
|
|
6
9
|
import { render } from "ink";
|
|
7
10
|
import { createElement } from "react";
|
|
@@ -163,7 +166,7 @@ function Footer({
|
|
|
163
166
|
}) {
|
|
164
167
|
return /* @__PURE__ */ jsxs(Box, { marginTop: 1, justifyContent: "space-between", children: [
|
|
165
168
|
/* @__PURE__ */ jsxs(Text, { color: "gray", children: [
|
|
166
|
-
"\u2191\u2193 move \u23CE copy \u238B quit (",
|
|
169
|
+
"\u2191\u2193 move \u23CE copy \u238B quit \u2325\u232B/\u2303W del word \u2303U clear (",
|
|
167
170
|
resultCount,
|
|
168
171
|
")"
|
|
169
172
|
] }),
|
|
@@ -307,6 +310,14 @@ function SearchInput({ query }) {
|
|
|
307
310
|
] });
|
|
308
311
|
}
|
|
309
312
|
|
|
313
|
+
// src/tui/input.ts
|
|
314
|
+
function deleteWordBack(query) {
|
|
315
|
+
const trimmed = query.replace(/\s+$/, "");
|
|
316
|
+
const lastSpace = trimmed.lastIndexOf(" ");
|
|
317
|
+
if (lastSpace === -1) return "";
|
|
318
|
+
return trimmed.slice(0, lastSpace + 1);
|
|
319
|
+
}
|
|
320
|
+
|
|
310
321
|
// src/tui/layout.ts
|
|
311
322
|
var RESERVED_ROWS = 4;
|
|
312
323
|
function visibleListHeight(terminalRows) {
|
|
@@ -353,6 +364,16 @@ function App({ entries, errorCount = 0, onCopy = copyToClipboard }) {
|
|
|
353
364
|
}
|
|
354
365
|
return;
|
|
355
366
|
}
|
|
367
|
+
if (key.meta && (key.backspace || key.delete) || key.ctrl && input === "w") {
|
|
368
|
+
setQuery(deleteWordBack);
|
|
369
|
+
setSelected(0);
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
if (key.ctrl && input === "u") {
|
|
373
|
+
setQuery("");
|
|
374
|
+
setSelected(0);
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
356
377
|
if (key.backspace || key.delete) {
|
|
357
378
|
setQuery((q) => q.slice(0, -1));
|
|
358
379
|
setSelected(0);
|
|
@@ -383,8 +404,10 @@ function App({ entries, errorCount = 0, onCopy = copyToClipboard }) {
|
|
|
383
404
|
}
|
|
384
405
|
|
|
385
406
|
// src/cli.ts
|
|
407
|
+
var pkgPath = join3(dirname2(fileURLToPath2(import.meta.url)), "..", "package.json");
|
|
408
|
+
var pkg = JSON.parse(readFileSync2(pkgPath, "utf8"));
|
|
386
409
|
var program = new Command();
|
|
387
|
-
program.name("keybook").description("Search keyboard shortcuts & recipes for your apps").version(
|
|
410
|
+
program.name("keybook").description("Search keyboard shortcuts & recipes for your apps").version(pkg.version);
|
|
388
411
|
program.command("path").description("Print the data directory").action(() => {
|
|
389
412
|
console.log(runPath());
|
|
390
413
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arthony/keybook",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"publishConfig": {
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
5
7
|
"description": "A macOS TUI for searching keyboard shortcuts and recipes of your favorite apps",
|
|
6
8
|
"keywords": [
|
|
7
9
|
"cli",
|
|
@@ -15,22 +17,27 @@
|
|
|
15
17
|
"productivity"
|
|
16
18
|
],
|
|
17
19
|
"homepage": "https://github.com/Ariyapong/keybook#readme",
|
|
18
|
-
"repository": {
|
|
19
|
-
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/Ariyapong/keybook.git"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/Ariyapong/keybook/issues"
|
|
26
|
+
},
|
|
20
27
|
"author": "Ariyapong Wimolnoch",
|
|
21
28
|
"type": "module",
|
|
22
|
-
"bin": {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
29
|
+
"bin": {
|
|
30
|
+
"keybook": "dist/cli.js",
|
|
31
|
+
"kb": "dist/cli.js"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist",
|
|
35
|
+
"seed",
|
|
36
|
+
"README.md",
|
|
37
|
+
"LICENSE"
|
|
38
|
+
],
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=22"
|
|
34
41
|
},
|
|
35
42
|
"dependencies": {
|
|
36
43
|
"commander": "^12.1.0",
|
|
@@ -50,5 +57,14 @@
|
|
|
50
57
|
"typescript": "^5.6.0",
|
|
51
58
|
"vitest": "^2.1.0"
|
|
52
59
|
},
|
|
53
|
-
"license": "MIT"
|
|
54
|
-
|
|
60
|
+
"license": "MIT",
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "tsup",
|
|
63
|
+
"dev": "tsx src/cli.ts",
|
|
64
|
+
"test": "vitest run",
|
|
65
|
+
"test:watch": "vitest",
|
|
66
|
+
"typecheck": "tsc --noEmit",
|
|
67
|
+
"lint": "biome check .",
|
|
68
|
+
"format": "biome format --write ."
|
|
69
|
+
}
|
|
70
|
+
}
|