@showly/mcp-server 0.5.0 → 0.6.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 +33 -8
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +35 -21
- package/dist/showly-hosting-skill.d.ts +2 -0
- package/dist/showly-hosting-skill.js +2 -0
- package/manifest.json +1 -1
- package/package.json +7 -7
- package/skills/showly-hosting/SKILL.md +8 -8
- package/skills/showly-reports/SKILL.md +109 -0
- package/skills/showly-reports/THIRD_PARTY_LICENSES.txt +118 -0
- package/skills/showly-reports/references/format.md +64 -0
- package/skills/showly-reports/references/upstream.md +25 -0
- package/skills/showly-reports/scripts/report.mjs +98 -0
- package/skills/showly-reports/scripts/vendor/am.mjs +8218 -0
- package/skills/showly-reports/scripts/vendor/upstream.json +12 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Showly's static-report entrypoint. Keep the vendored renderer unmodified.
|
|
3
|
+
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
import { parseArgs } from "node:util";
|
|
8
|
+
import { spawnSync } from "node:child_process";
|
|
9
|
+
|
|
10
|
+
const usage = `Showly reports — local static HTML (Node.js 20+)
|
|
11
|
+
node report.mjs render <draft.md|-> -o <index.html> [--theme auto|blueprint|shadcn|paper]
|
|
12
|
+
node report.mjs patch <index.html> --panel <title> --from <panel.md>
|
|
13
|
+
node report.mjs lint <draft.md|-> [--style off|80|strict]
|
|
14
|
+
node report.mjs help <format|flow|sequence|tree|timeline|limits|annot|kv|callout|patch|theme>
|
|
15
|
+
node report.mjs list
|
|
16
|
+
Rendering also accepts --template sheet|doc, --mode auto|light|dark and --style.
|
|
17
|
+
Files stay local; use Showly hosting to share them. Video and configuration commands
|
|
18
|
+
are not supported by this entrypoint. The renderer updates with Showly.`;
|
|
19
|
+
|
|
20
|
+
function main(args) {
|
|
21
|
+
if (Number(process.versions.node.split(".")[0]) < 20) {
|
|
22
|
+
console.error(
|
|
23
|
+
"Showly reports requires Node.js 20 or newer. Hosting installation still supports Node.js 18.",
|
|
24
|
+
);
|
|
25
|
+
return 2;
|
|
26
|
+
}
|
|
27
|
+
if (!args.length || args[0] === "--help") {
|
|
28
|
+
console.log(usage);
|
|
29
|
+
return 0;
|
|
30
|
+
}
|
|
31
|
+
const { values, positionals } = parseArgs({
|
|
32
|
+
args,
|
|
33
|
+
allowPositionals: true,
|
|
34
|
+
options: {
|
|
35
|
+
out: { type: "string", short: "o" },
|
|
36
|
+
"no-open": { type: "boolean" },
|
|
37
|
+
theme: { type: "string" },
|
|
38
|
+
template: { type: "string" },
|
|
39
|
+
mode: { type: "string" },
|
|
40
|
+
style: { type: "string" },
|
|
41
|
+
panel: { type: "string" },
|
|
42
|
+
from: { type: "string" },
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
const [command, topic] = positionals;
|
|
46
|
+
if (!["render", "patch", "lint", "help", "list"].includes(command)) {
|
|
47
|
+
throw new Error(`Unsupported report command: ${command}\n${usage}`);
|
|
48
|
+
}
|
|
49
|
+
if (command === "help" && (!topic || topic === "video")) {
|
|
50
|
+
console.log(usage);
|
|
51
|
+
return topic ? 2 : 0;
|
|
52
|
+
}
|
|
53
|
+
// Explicit output keeps files out of the temporary upstream configuration home.
|
|
54
|
+
if (command === "render" && !values.out?.trim()) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
"render requires -o <path>, usually a dedicated report directory's index.html",
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
if (command === "patch" && topic && topic !== "-") {
|
|
60
|
+
const root = readFileSync(topic, "utf8").match(/<html\b[^>]*>/)?.[0] ?? "";
|
|
61
|
+
if (/\sdata-video\b/.test(root)) {
|
|
62
|
+
throw new Error(
|
|
63
|
+
"Video pages cannot be patched by Showly's static report renderer.",
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const configHome = mkdtempSync(join(tmpdir(), "showly-report-"));
|
|
68
|
+
try {
|
|
69
|
+
const child = spawnSync(
|
|
70
|
+
process.execPath,
|
|
71
|
+
[
|
|
72
|
+
fileURLToPath(new URL("./vendor/am.mjs", import.meta.url)),
|
|
73
|
+
...args,
|
|
74
|
+
"--no-open",
|
|
75
|
+
],
|
|
76
|
+
{
|
|
77
|
+
stdio: "inherit",
|
|
78
|
+
env: {
|
|
79
|
+
...process.env,
|
|
80
|
+
AM_HOME: configHome,
|
|
81
|
+
AM_NO_OPEN: "1",
|
|
82
|
+
AM_NO_UPDATE_CHECK: "1",
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
);
|
|
86
|
+
if (child.error) throw child.error;
|
|
87
|
+
return child.status ?? 1;
|
|
88
|
+
} finally {
|
|
89
|
+
rmSync(configHome, { recursive: true, force: true });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
try {
|
|
94
|
+
process.exitCode = main(process.argv.slice(2));
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.error(error.message);
|
|
97
|
+
process.exitCode = 2;
|
|
98
|
+
}
|