kittyhtml 0.2.0 → 0.2.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 +11 -7
- package/package.json +1 -1
- package/src/cli.js +12 -1
package/README.md
CHANGED
|
@@ -9,12 +9,16 @@ Built for AI agents that have something nice to show you — a styled report, a
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
|
|
13
|
-
npm install
|
|
14
|
-
npm link # exposes the `kittyhtml` binary on your PATH
|
|
12
|
+
npm install -g kittyhtml
|
|
15
13
|
```
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
Or one-shot, no install:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npx kittyhtml --demo
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Requires Node 20+. Pulls in [`@napi-rs/canvas`](https://www.npmjs.com/package/@napi-rs/canvas) (prebuilt native binary, no compile step) and `dropflow`. Two deps total, ~90 KB tarball.
|
|
18
22
|
|
|
19
23
|
## Use
|
|
20
24
|
|
|
@@ -70,15 +74,15 @@ See the [DropFlow README](https://github.com/chearon/dropflow#supported-css-rule
|
|
|
70
74
|
|
|
71
75
|
## Fonts
|
|
72
76
|
|
|
73
|
-
|
|
77
|
+
`Noto Sans` (regular, bold, italic, bold-italic) and `Noto Sans Mono` (regular, bold) ship inside the package as latin-subset TTFs (~160 KB total). No CDN fetch on first run; works offline. Reference them in HTML with `font-family: 'Noto Sans', sans-serif` and `font-family: 'Noto Sans Mono', monospace`.
|
|
74
78
|
|
|
75
79
|
## Claude Code skill
|
|
76
80
|
|
|
77
|
-
A bundled skill lets Claude Code render output as a styled inline image when you ask for it as "kittyhtml" or "khtml":
|
|
81
|
+
A bundled skill lets Claude Code render output as a styled inline image when you ask for it as "kittyhtml" or "khtml". After a global install:
|
|
78
82
|
|
|
79
83
|
```sh
|
|
80
84
|
mkdir -p ~/.claude/skills
|
|
81
|
-
cp -r skill/kittyhtml ~/.claude/skills/
|
|
85
|
+
cp -r "$(npm root -g)/kittyhtml/skill/kittyhtml" ~/.claude/skills/
|
|
82
86
|
```
|
|
83
87
|
|
|
84
88
|
Then in any Claude Code session: *"give me this report as kittyhtml"* — the agent will generate DropFlow-compatible HTML and pipe it through this CLI. The skill is narrow on purpose; it only triggers on those keywords.
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -80,6 +80,17 @@ function loadDemoHtml() {
|
|
|
80
80
|
return readFileSync(join(here, '..', 'examples', 'demo.html'), 'utf8');
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
// readFileSync(0) crashes with EAGAIN when stdin is in non-blocking mode and
|
|
84
|
+
// the upstream process hasn't flushed yet (common with `claude -p ... | kittyhtml`).
|
|
85
|
+
// Async iteration over process.stdin yields back to the event loop and waits
|
|
86
|
+
// for data, so it handles any pipe pacing correctly.
|
|
87
|
+
async function readStdin() {
|
|
88
|
+
process.stdin.setEncoding('utf8');
|
|
89
|
+
let buf = '';
|
|
90
|
+
for await (const chunk of process.stdin) buf += chunk;
|
|
91
|
+
return buf;
|
|
92
|
+
}
|
|
93
|
+
|
|
83
94
|
async function main() {
|
|
84
95
|
const opts = parseArgs(process.argv.slice(2));
|
|
85
96
|
|
|
@@ -89,7 +100,7 @@ async function main() {
|
|
|
89
100
|
} else if (opts.file) {
|
|
90
101
|
html = readFileSync(opts.file, 'utf8');
|
|
91
102
|
} else if (!process.stdin.isTTY) {
|
|
92
|
-
html =
|
|
103
|
+
html = await readStdin();
|
|
93
104
|
} else {
|
|
94
105
|
process.stdout.write(HELP);
|
|
95
106
|
process.exit(1);
|