agent-reader 1.1.0 → 1.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/bin/agent-reader.js +7 -1
- package/package.json +1 -1
- package/src/cli/commands.js +7 -1
- package/src/core/exporter.js +12 -2
- package/src/mcp/server.js +1 -1
package/bin/agent-reader.js
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
cleanCommand,
|
|
5
5
|
doctorCommand,
|
|
6
6
|
exportCommand,
|
|
7
|
+
mcpStubCommand,
|
|
7
8
|
openCommand,
|
|
8
9
|
renderCommand,
|
|
9
10
|
runCommandSafely,
|
|
@@ -16,7 +17,7 @@ const program = new Command();
|
|
|
16
17
|
program
|
|
17
18
|
.name('agent-reader')
|
|
18
19
|
.description('AI Agent output beautifier and slideshow generator')
|
|
19
|
-
.version('1.1.
|
|
20
|
+
.version('1.1.1');
|
|
20
21
|
|
|
21
22
|
setupCommonCommandOptions(
|
|
22
23
|
program
|
|
@@ -80,4 +81,9 @@ program
|
|
|
80
81
|
.option('--days <days>', 'max age in days', '7')
|
|
81
82
|
.action((options) => runCommandSafely(() => cleanCommand(options)));
|
|
82
83
|
|
|
84
|
+
program
|
|
85
|
+
.command('mcp')
|
|
86
|
+
.description('Start MCP server on stdio')
|
|
87
|
+
.action(() => runCommandSafely(() => mcpStubCommand()));
|
|
88
|
+
|
|
83
89
|
await program.parseAsync(process.argv);
|
package/package.json
CHANGED
package/src/cli/commands.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { promises as fs } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
3
4
|
import open from 'open';
|
|
4
5
|
import { execa } from 'execa';
|
|
5
6
|
import { renderMarkdown } from '../core/renderer.js';
|
|
@@ -49,6 +50,9 @@ function normalizeMode(options) {
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
async function readAllFromStdin() {
|
|
53
|
+
if (process.stdin.isTTY) {
|
|
54
|
+
throw new Error('stdin is a terminal — pipe content or use a file path instead (e.g. echo "# hi" | agent-reader render --stdin)');
|
|
55
|
+
}
|
|
52
56
|
const chunks = [];
|
|
53
57
|
for await (const chunk of process.stdin) {
|
|
54
58
|
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
@@ -591,7 +595,9 @@ export async function cleanCommand(options) {
|
|
|
591
595
|
}
|
|
592
596
|
|
|
593
597
|
export async function mcpStubCommand() {
|
|
594
|
-
const
|
|
598
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
599
|
+
const serverPath = path.resolve(__dirname, '..', 'mcp', 'server.js');
|
|
600
|
+
const result = await execa('node', [serverPath], { stdio: 'inherit' });
|
|
595
601
|
return result;
|
|
596
602
|
}
|
|
597
603
|
|
package/src/core/exporter.js
CHANGED
|
@@ -723,14 +723,24 @@ export async function exportPDF(html, options = {}) {
|
|
|
723
723
|
|
|
724
724
|
if (htmlPath) {
|
|
725
725
|
await page.goto(pathToFileURL(path.resolve(htmlPath)).toString(), {
|
|
726
|
-
waitUntil: '
|
|
726
|
+
waitUntil: 'domcontentloaded',
|
|
727
727
|
});
|
|
728
728
|
} else {
|
|
729
729
|
await page.setContent(html, {
|
|
730
|
-
waitUntil: '
|
|
730
|
+
waitUntil: 'domcontentloaded',
|
|
731
731
|
});
|
|
732
732
|
}
|
|
733
733
|
|
|
734
|
+
// Wait for images and fonts to finish loading before generating PDF
|
|
735
|
+
await page.evaluate(() =>
|
|
736
|
+
Promise.all([
|
|
737
|
+
document.fonts?.ready,
|
|
738
|
+
...Array.from(document.images).map((img) =>
|
|
739
|
+
img.complete ? Promise.resolve() : new Promise((r) => { img.onload = r; img.onerror = r; }),
|
|
740
|
+
),
|
|
741
|
+
]),
|
|
742
|
+
);
|
|
743
|
+
|
|
734
744
|
await page.addStyleTag({
|
|
735
745
|
content: `
|
|
736
746
|
@page {
|