html2pptx-local-mcp 1.1.32 → 1.1.34
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/cli/dist/commands/edit.d.ts +2 -1
- package/cli/dist/commands/edit.js +13 -30
- package/cli/dist/index.js +0 -0
- package/local-editor-app/next.config.mjs +6 -0
- package/package.json +1 -1
- package/cli/dist/dist/commands/config-show.d.ts +0 -1
- package/cli/dist/dist/commands/config-show.js +0 -16
- package/cli/dist/dist/commands/convert.d.ts +0 -10
- package/cli/dist/dist/commands/convert.js +0 -311
- package/cli/dist/dist/commands/edit.d.ts +0 -34
- package/cli/dist/dist/commands/edit.js +0 -801
- package/cli/dist/dist/commands/init.d.ts +0 -1
- package/cli/dist/dist/commands/init.js +0 -35
- package/cli/dist/dist/commands/logout.d.ts +0 -1
- package/cli/dist/dist/commands/logout.js +0 -19
- package/cli/dist/dist/commands/publish.d.ts +0 -10
- package/cli/dist/dist/commands/publish.js +0 -17
- package/cli/dist/dist/commands/status.d.ts +0 -5
- package/cli/dist/dist/commands/status.js +0 -71
- package/cli/dist/dist/commands/templates.d.ts +0 -13
- package/cli/dist/dist/commands/templates.js +0 -85
- package/cli/dist/dist/commands/whoami.d.ts +0 -5
- package/cli/dist/dist/commands/whoami.js +0 -51
- package/cli/dist/dist/config.d.ts +0 -7
- package/cli/dist/dist/config.js +0 -24
- package/cli/dist/dist/index.d.ts +0 -2
- package/cli/dist/dist/index.js +0 -93
- package/cli/dist/dist/update-check.d.ts +0 -1
- package/cli/dist/dist/update-check.js +0 -30
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function initCommand(): Promise<void>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as p from "@clack/prompts";
|
|
2
|
-
import pc from "picocolors";
|
|
3
|
-
import { loadConfig, saveConfig, getConfigPath } from "../config.js";
|
|
4
|
-
export async function initCommand() {
|
|
5
|
-
p.intro(pc.bgCyan(pc.black(" html2pptx ")));
|
|
6
|
-
const config = await loadConfig();
|
|
7
|
-
const hasExisting = !!config.apiKey;
|
|
8
|
-
if (hasExisting) {
|
|
9
|
-
p.log.info(`Existing API key found: ${pc.dim(config.apiKey.slice(0, 12) + "...")}`);
|
|
10
|
-
}
|
|
11
|
-
p.log.info(`Get your API key at: ${pc.cyan(pc.underline("https://html2pptx.app/dashboard/en?tab=api-keys"))}`);
|
|
12
|
-
const result = await p.group({
|
|
13
|
-
apiKey: () => p.text({
|
|
14
|
-
message: "Enter your API key",
|
|
15
|
-
placeholder: "sk_live_...",
|
|
16
|
-
initialValue: config.apiKey ?? "",
|
|
17
|
-
validate(value) {
|
|
18
|
-
if (!value)
|
|
19
|
-
return "API key is required";
|
|
20
|
-
if (!value.startsWith("sk_live_"))
|
|
21
|
-
return 'API key should start with "sk_live_"';
|
|
22
|
-
},
|
|
23
|
-
}),
|
|
24
|
-
}, {
|
|
25
|
-
onCancel() {
|
|
26
|
-
p.cancel("Setup cancelled.");
|
|
27
|
-
process.exit(0);
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
await saveConfig({
|
|
31
|
-
apiKey: result.apiKey,
|
|
32
|
-
});
|
|
33
|
-
p.log.success(`Config saved to ${pc.dim(getConfigPath())}`);
|
|
34
|
-
p.outro("You're all set! Run " + pc.cyan("html2pptx convert") + " to start.");
|
|
35
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function logoutCommand(): Promise<void>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { unlink } from "node:fs/promises";
|
|
2
|
-
import * as p from "@clack/prompts";
|
|
3
|
-
import pc from "picocolors";
|
|
4
|
-
import { loadConfig, getConfigPath } from "../config.js";
|
|
5
|
-
export async function logoutCommand() {
|
|
6
|
-
const config = await loadConfig();
|
|
7
|
-
if (!config.apiKey) {
|
|
8
|
-
p.log.warn("No API key found. You're already logged out.");
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
try {
|
|
12
|
-
await unlink(getConfigPath());
|
|
13
|
-
p.log.success(`API key removed. Config deleted at ${pc.dim(getConfigPath())}`);
|
|
14
|
-
}
|
|
15
|
-
catch {
|
|
16
|
-
p.log.error("Failed to remove config file.");
|
|
17
|
-
process.exit(1);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `html2pptx templates publish` is intentionally disabled.
|
|
3
|
-
*
|
|
4
|
-
* Marketplace template draft creation is HTML-only and remote-MCP-only:
|
|
5
|
-
* html2pptx_validate_template_html -> html2pptx_publish_template.
|
|
6
|
-
*/
|
|
7
|
-
export interface PublishOptions {
|
|
8
|
-
json?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare function publishCommand(_input: string | undefined, options?: PublishOptions): Promise<void>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import pc from "picocolors";
|
|
2
|
-
const REMOTE_MCP_MESSAGE = "テンプレートdraft作成はHTMLのみ、remote MCPのみ対応しています。\n\n" +
|
|
3
|
-
"CLI / Web UI / REST API からは公開用draftを作成できません。Claude Code / Codex などの remote MCP から " +
|
|
4
|
-
"`html2pptx_validate_template_html` を実行し、すべてのエラーを修正してから " +
|
|
5
|
-
"`html2pptx_publish_template` を呼び出してください。";
|
|
6
|
-
export async function publishCommand(_input, options = {}) {
|
|
7
|
-
bail(REMOTE_MCP_MESSAGE, options);
|
|
8
|
-
}
|
|
9
|
-
function bail(msg, options) {
|
|
10
|
-
if (options.json) {
|
|
11
|
-
console.log(JSON.stringify({ ok: false, error: msg }));
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
console.error(pc.red(msg));
|
|
15
|
-
}
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import * as p from "@clack/prompts";
|
|
2
|
-
import pc from "picocolors";
|
|
3
|
-
import { loadConfig } from "../config.js";
|
|
4
|
-
export async function statusCommand(options = {}) {
|
|
5
|
-
const config = await loadConfig();
|
|
6
|
-
const apiKey = config.apiKey;
|
|
7
|
-
const baseUrl = options.baseUrl ?? config.baseUrl ?? "https://html2pptx.app";
|
|
8
|
-
if (!apiKey) {
|
|
9
|
-
p.log.error("No API key found. Run " + pc.cyan("html2pptx login") + " first.");
|
|
10
|
-
process.exit(1);
|
|
11
|
-
}
|
|
12
|
-
const spinner = p.spinner();
|
|
13
|
-
spinner.start("Fetching usage...");
|
|
14
|
-
try {
|
|
15
|
-
const res = await fetch(`${baseUrl}/api/v1/export/usage`, {
|
|
16
|
-
headers: { Authorization: `Bearer ${apiKey}` },
|
|
17
|
-
});
|
|
18
|
-
if (res.status === 401) {
|
|
19
|
-
spinner.stop("Failed");
|
|
20
|
-
p.log.error("Invalid API key. Run " +
|
|
21
|
-
pc.cyan("html2pptx login") +
|
|
22
|
-
" to update your key.");
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
if (res.status === 403) {
|
|
26
|
-
spinner.stop("Failed");
|
|
27
|
-
p.log.error("Access denied. Your API key may be expired or revoked. Visit " +
|
|
28
|
-
pc.cyan("https://html2pptx.app/dashboard") +
|
|
29
|
-
" to check.");
|
|
30
|
-
process.exit(1);
|
|
31
|
-
}
|
|
32
|
-
if (!res.ok) {
|
|
33
|
-
const text = await res.text();
|
|
34
|
-
throw new Error(`API error ${res.status}: ${text}`);
|
|
35
|
-
}
|
|
36
|
-
const data = (await res.json());
|
|
37
|
-
spinner.stop("Usage retrieved");
|
|
38
|
-
const used = data.usage?.dailyUsed ?? 0;
|
|
39
|
-
const limit = data.limits?.dailyRequestLimit ?? 0;
|
|
40
|
-
const usageBar = renderBar(used, limit);
|
|
41
|
-
p.log.info(pc.bold("Plan: ") + (data.plan?.name ?? "Unknown"));
|
|
42
|
-
p.log.info(pc.bold("Daily Usage: ") +
|
|
43
|
-
`${used} / ${limit} exports ${usageBar}`);
|
|
44
|
-
if (data.usage?.dailyRemaining !== undefined) {
|
|
45
|
-
p.log.info(pc.bold("Remaining: ") + pc.green(String(data.usage.dailyRemaining)));
|
|
46
|
-
}
|
|
47
|
-
if (data.usage?.dayResetsAt) {
|
|
48
|
-
const resetDate = new Date(data.usage.dayResetsAt);
|
|
49
|
-
p.log.info(pc.bold("Resets: ") + resetDate.toLocaleDateString());
|
|
50
|
-
}
|
|
51
|
-
if (data.limits?.requestsPerMinute) {
|
|
52
|
-
p.log.info(pc.bold("Rate Limit: ") + `${data.limits.requestsPerMinute} req/min`);
|
|
53
|
-
}
|
|
54
|
-
if (data.limits?.maxSlidesPerJob) {
|
|
55
|
-
p.log.info(pc.bold("Max Slides: ") + `${data.limits.maxSlidesPerJob} per job`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
catch (e) {
|
|
59
|
-
spinner.stop("Failed");
|
|
60
|
-
p.log.error(e.message);
|
|
61
|
-
process.exit(1);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
function renderBar(used, limit) {
|
|
65
|
-
const width = 20;
|
|
66
|
-
const ratio = limit > 0 ? Math.min(used / limit, 1) : 0;
|
|
67
|
-
const filled = Math.round(ratio * width);
|
|
68
|
-
const empty = width - filled;
|
|
69
|
-
const color = ratio > 0.9 ? pc.red : ratio > 0.7 ? pc.yellow : pc.green;
|
|
70
|
-
return color("\u2588".repeat(filled)) + pc.dim("\u2591".repeat(empty));
|
|
71
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
interface TemplatesOptions {
|
|
2
|
-
json?: boolean;
|
|
3
|
-
baseUrl?: string;
|
|
4
|
-
}
|
|
5
|
-
interface TemplateGetOptions {
|
|
6
|
-
prompt?: boolean;
|
|
7
|
-
html?: boolean;
|
|
8
|
-
json?: boolean;
|
|
9
|
-
baseUrl?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function templatesListCommand(options?: TemplatesOptions): Promise<void>;
|
|
12
|
-
export declare function templatesGetCommand(id?: string, options?: TemplateGetOptions): Promise<void>;
|
|
13
|
-
export {};
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import * as p from "@clack/prompts";
|
|
2
|
-
import pc from "picocolors";
|
|
3
|
-
import { loadConfig } from "../config.js";
|
|
4
|
-
export async function templatesListCommand(options = {}) {
|
|
5
|
-
const config = await loadConfig();
|
|
6
|
-
const baseUrl = options.baseUrl ?? config.baseUrl ?? "https://html2pptx.app";
|
|
7
|
-
const spinner = options.json ? null : p.spinner();
|
|
8
|
-
spinner?.start("Fetching templates...");
|
|
9
|
-
try {
|
|
10
|
-
const res = await fetch(`${baseUrl}/api/templates`);
|
|
11
|
-
if (!res.ok)
|
|
12
|
-
throw new Error(`API error ${res.status}`);
|
|
13
|
-
const data = (await res.json());
|
|
14
|
-
if (options.json) {
|
|
15
|
-
console.log(JSON.stringify(data.templates, null, 2));
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
spinner?.stop(`${data.templates.length} templates found`);
|
|
19
|
-
for (const t of data.templates) {
|
|
20
|
-
p.log.info(`${pc.bold(t.title)} ${pc.dim(`(${t.id})`)}` +
|
|
21
|
-
`\n ${pc.dim(t.category)} | ${t.slides} slides` +
|
|
22
|
-
`\n ${pc.dim(t.description)}`);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
catch (e) {
|
|
26
|
-
spinner?.stop("Failed");
|
|
27
|
-
p.log.error(e.message);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
export async function templatesGetCommand(id, options = {}) {
|
|
32
|
-
const config = await loadConfig();
|
|
33
|
-
const baseUrl = options.baseUrl ?? config.baseUrl ?? "https://html2pptx.app";
|
|
34
|
-
if (!id) {
|
|
35
|
-
p.log.error("Template ID is required. Run " + pc.cyan("html2pptx templates list") + " to see available IDs.");
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}
|
|
38
|
-
const include = [];
|
|
39
|
-
if (options.prompt)
|
|
40
|
-
include.push("prompt");
|
|
41
|
-
if (options.html)
|
|
42
|
-
include.push("html");
|
|
43
|
-
const includeParam = include.length ? `&include=${include.join(",")}` : "";
|
|
44
|
-
const spinner = options.json ? null : p.spinner();
|
|
45
|
-
spinner?.start("Fetching template...");
|
|
46
|
-
try {
|
|
47
|
-
const res = await fetch(`${baseUrl}/api/templates?id=${encodeURIComponent(id)}${includeParam}`);
|
|
48
|
-
if (!res.ok) {
|
|
49
|
-
if (res.status === 404)
|
|
50
|
-
throw new Error(`Template "${id}" not found.`);
|
|
51
|
-
throw new Error(`API error ${res.status}`);
|
|
52
|
-
}
|
|
53
|
-
const data = (await res.json());
|
|
54
|
-
if (options.json) {
|
|
55
|
-
console.log(JSON.stringify(data, null, 2));
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
spinner?.stop("Found");
|
|
59
|
-
p.log.info(pc.bold("Title: ") + data.title);
|
|
60
|
-
p.log.info(pc.bold("ID: ") + data.id);
|
|
61
|
-
p.log.info(pc.bold("Category: ") + data.category);
|
|
62
|
-
p.log.info(pc.bold("Slides: ") + String(data.slides));
|
|
63
|
-
if (data.downloadUrl) {
|
|
64
|
-
p.log.info(pc.bold("PPTX: ") + pc.cyan(data.downloadUrl));
|
|
65
|
-
}
|
|
66
|
-
if (data.htmlUrl) {
|
|
67
|
-
p.log.info(pc.bold("HTML: ") + pc.cyan(data.htmlUrl));
|
|
68
|
-
}
|
|
69
|
-
if (data.prompt) {
|
|
70
|
-
p.log.info("");
|
|
71
|
-
p.log.info(pc.bold("Prompt:"));
|
|
72
|
-
console.log(data.prompt);
|
|
73
|
-
}
|
|
74
|
-
if (data.html) {
|
|
75
|
-
p.log.info("");
|
|
76
|
-
p.log.info(pc.bold("HTML Source:"));
|
|
77
|
-
console.log(data.html);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
catch (e) {
|
|
81
|
-
spinner?.stop("Failed");
|
|
82
|
-
p.log.error(e.message);
|
|
83
|
-
process.exit(1);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import * as p from "@clack/prompts";
|
|
2
|
-
import pc from "picocolors";
|
|
3
|
-
import { loadConfig, getConfigPath } from "../config.js";
|
|
4
|
-
export async function whoamiCommand(options = {}) {
|
|
5
|
-
const config = await loadConfig();
|
|
6
|
-
const apiKey = config.apiKey;
|
|
7
|
-
const baseUrl = options.baseUrl ?? config.baseUrl ?? "https://html2pptx.app";
|
|
8
|
-
if (!apiKey) {
|
|
9
|
-
p.log.error("Not logged in.");
|
|
10
|
-
p.log.info("Run " + pc.cyan("html2pptx login") + " to configure your API key.");
|
|
11
|
-
process.exit(1);
|
|
12
|
-
}
|
|
13
|
-
p.log.info(pc.bold("Config: ") + pc.dim(getConfigPath()));
|
|
14
|
-
p.log.info(pc.bold("API Key: ") + pc.dim(apiKey.slice(0, 12) + "..." + apiKey.slice(-4)));
|
|
15
|
-
const spinner = p.spinner();
|
|
16
|
-
spinner.start("Verifying API key...");
|
|
17
|
-
try {
|
|
18
|
-
const res = await fetch(`${baseUrl}/api/v1/export/usage`, {
|
|
19
|
-
headers: { Authorization: `Bearer ${apiKey}` },
|
|
20
|
-
});
|
|
21
|
-
if (res.status === 401) {
|
|
22
|
-
spinner.stop(pc.red("Invalid"));
|
|
23
|
-
p.log.error("API key is invalid. Run " +
|
|
24
|
-
pc.cyan("html2pptx login") +
|
|
25
|
-
" to update.");
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
if (!res.ok) {
|
|
29
|
-
spinner.stop(pc.yellow("Unknown"));
|
|
30
|
-
p.log.warn(`Could not verify (HTTP ${res.status})`);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const data = (await res.json());
|
|
34
|
-
spinner.stop(pc.green("Authenticated"));
|
|
35
|
-
if (data.plan?.name) {
|
|
36
|
-
p.log.info(pc.bold("Plan: ") + data.plan.name);
|
|
37
|
-
}
|
|
38
|
-
if (data.usage?.dailyUsed !== undefined && data.limits?.dailyRequestLimit !== undefined) {
|
|
39
|
-
p.log.info(pc.bold("Usage: ") +
|
|
40
|
-
`${data.usage.dailyUsed} / ${data.limits.dailyRequestLimit} exports today`);
|
|
41
|
-
}
|
|
42
|
-
if (data.usage?.dailyRemaining !== undefined) {
|
|
43
|
-
p.log.info(pc.bold("Remaining: ") + pc.green(String(data.usage.dailyRemaining)));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
catch (e) {
|
|
47
|
-
spinner.stop("Failed");
|
|
48
|
-
p.log.error(e.message);
|
|
49
|
-
process.exit(1);
|
|
50
|
-
}
|
|
51
|
-
}
|
package/cli/dist/dist/config.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { readFile, writeFile, mkdir } from "node:fs/promises";
|
|
2
|
-
import { homedir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
const CONFIG_DIR = join(homedir(), ".html2pptx");
|
|
5
|
-
const CONFIG_FILE = join(CONFIG_DIR, "config.json");
|
|
6
|
-
export async function loadConfig() {
|
|
7
|
-
try {
|
|
8
|
-
const raw = await readFile(CONFIG_FILE, "utf-8");
|
|
9
|
-
return JSON.parse(raw);
|
|
10
|
-
}
|
|
11
|
-
catch {
|
|
12
|
-
return {};
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export async function saveConfig(config) {
|
|
16
|
-
await mkdir(CONFIG_DIR, { recursive: true });
|
|
17
|
-
await writeFile(CONFIG_FILE, JSON.stringify(config, null, 2) + "\n", {
|
|
18
|
-
encoding: "utf-8",
|
|
19
|
-
mode: 0o600,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
export function getConfigPath() {
|
|
23
|
-
return CONFIG_FILE;
|
|
24
|
-
}
|
package/cli/dist/dist/index.d.ts
DELETED
package/cli/dist/dist/index.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
|
-
import { Command } from "commander";
|
|
4
|
-
import { initCommand } from "./commands/init.js";
|
|
5
|
-
import { convertCommand } from "./commands/convert.js";
|
|
6
|
-
import { statusCommand } from "./commands/status.js";
|
|
7
|
-
import { logoutCommand } from "./commands/logout.js";
|
|
8
|
-
import { whoamiCommand } from "./commands/whoami.js";
|
|
9
|
-
import { configShowCommand } from "./commands/config-show.js";
|
|
10
|
-
import { templatesListCommand, templatesGetCommand } from "./commands/templates.js";
|
|
11
|
-
import { publishCommand } from "./commands/publish.js";
|
|
12
|
-
import { editCommand } from "./commands/edit.js";
|
|
13
|
-
import { checkForUpdates } from "./update-check.js";
|
|
14
|
-
const require = createRequire(import.meta.url);
|
|
15
|
-
const { version } = require("../package.json");
|
|
16
|
-
const program = new Command();
|
|
17
|
-
program
|
|
18
|
-
.name("html2pptx")
|
|
19
|
-
.description("Convert HTML/CSS to editable PowerPoint files")
|
|
20
|
-
.version(version);
|
|
21
|
-
// login (alias for init)
|
|
22
|
-
program
|
|
23
|
-
.command("login")
|
|
24
|
-
.description("Configure your API key")
|
|
25
|
-
.action(initCommand);
|
|
26
|
-
// init (kept for backwards compat)
|
|
27
|
-
program
|
|
28
|
-
.command("init")
|
|
29
|
-
.description("Configure your API key")
|
|
30
|
-
.action(initCommand);
|
|
31
|
-
program
|
|
32
|
-
.command("convert")
|
|
33
|
-
.description("Convert an HTML file to PPTX")
|
|
34
|
-
.argument("[input]", "Path to HTML file")
|
|
35
|
-
.option("-o, --output <file>", "Output PPTX filename")
|
|
36
|
-
.option("-s, --size <size>", 'Slide size: "16:9", "4:3", or "WxH" (e.g. 1600x900)')
|
|
37
|
-
.option("--css <file>", "External CSS file to include")
|
|
38
|
-
.option("--json", "Output result as JSON (for scripting)")
|
|
39
|
-
.option("--open", "Open the PPTX file after conversion")
|
|
40
|
-
.option("--base-url <url>", "API base URL", "https://html2pptx.app")
|
|
41
|
-
.action(convertCommand);
|
|
42
|
-
program
|
|
43
|
-
.command("edit")
|
|
44
|
-
.description("Open a local slide HTML file in the html2pptx visual editor")
|
|
45
|
-
.argument("<input>", "Path to HTML file")
|
|
46
|
-
.option("--port <port>", "Local bridge port. Defaults to auto.")
|
|
47
|
-
.option("--no-open", "Print the editor URL without opening a browser")
|
|
48
|
-
.option("--json", "Output bridge details as JSON")
|
|
49
|
-
.option("--base-url <url>", "Loopback editor base URL. Defaults to the local server registered by node scripts/dev-studio.mjs")
|
|
50
|
-
.action(editCommand);
|
|
51
|
-
program
|
|
52
|
-
.command("status")
|
|
53
|
-
.description("Check your current usage and quota")
|
|
54
|
-
.option("--base-url <url>", "API base URL", "https://html2pptx.app")
|
|
55
|
-
.action(statusCommand);
|
|
56
|
-
program
|
|
57
|
-
.command("whoami")
|
|
58
|
-
.description("Show current authentication status and plan")
|
|
59
|
-
.option("--base-url <url>", "API base URL", "https://html2pptx.app")
|
|
60
|
-
.action(whoamiCommand);
|
|
61
|
-
program
|
|
62
|
-
.command("logout")
|
|
63
|
-
.description("Remove stored API key")
|
|
64
|
-
.action(logoutCommand);
|
|
65
|
-
program
|
|
66
|
-
.command("config")
|
|
67
|
-
.description("Show current configuration")
|
|
68
|
-
.action(configShowCommand);
|
|
69
|
-
const templatesCmd = program
|
|
70
|
-
.command("templates")
|
|
71
|
-
.description("Browse and inspect templates");
|
|
72
|
-
templatesCmd
|
|
73
|
-
.command("list")
|
|
74
|
-
.description("List all available templates")
|
|
75
|
-
.option("--json", "Output as JSON")
|
|
76
|
-
.option("--base-url <url>", "API base URL", "https://html2pptx.app")
|
|
77
|
-
.action(templatesListCommand);
|
|
78
|
-
templatesCmd
|
|
79
|
-
.command("get <id>")
|
|
80
|
-
.description("Get template details (prompt, HTML, download URLs)")
|
|
81
|
-
.option("--prompt", "Include the design prompt")
|
|
82
|
-
.option("--html", "Include the HTML source")
|
|
83
|
-
.option("--json", "Output as JSON")
|
|
84
|
-
.option("--base-url <url>", "API base URL", "https://html2pptx.app")
|
|
85
|
-
.action(templatesGetCommand);
|
|
86
|
-
templatesCmd
|
|
87
|
-
.command("publish [file]")
|
|
88
|
-
.description("Disabled. Template publishing is HTML-only via remote MCP.")
|
|
89
|
-
.option("--json", "Output result as JSON (for scripting)")
|
|
90
|
-
.action(publishCommand);
|
|
91
|
-
// Check for updates (non-blocking)
|
|
92
|
-
checkForUpdates(version);
|
|
93
|
-
program.parse();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function checkForUpdates(currentVersion: string): void;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import pc from "picocolors";
|
|
2
|
-
function isNewer(remote, local) {
|
|
3
|
-
const r = remote.split(".").map(Number);
|
|
4
|
-
const l = local.split(".").map(Number);
|
|
5
|
-
for (let i = 0; i < 3; i++) {
|
|
6
|
-
if ((r[i] ?? 0) > (l[i] ?? 0))
|
|
7
|
-
return true;
|
|
8
|
-
if ((r[i] ?? 0) < (l[i] ?? 0))
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
export function checkForUpdates(currentVersion) {
|
|
14
|
-
// Non-blocking: fire and forget
|
|
15
|
-
fetch("https://registry.npmjs.org/html2pptx-cli/latest", {
|
|
16
|
-
signal: AbortSignal.timeout(3000),
|
|
17
|
-
})
|
|
18
|
-
.then((res) => (res.ok ? res.json() : null))
|
|
19
|
-
.then((data) => {
|
|
20
|
-
if (!data?.version)
|
|
21
|
-
return;
|
|
22
|
-
if (isNewer(data.version, currentVersion)) {
|
|
23
|
-
console.error(pc.yellow(`\n Update available: ${pc.dim(currentVersion)} → ${pc.green(data.version)}`));
|
|
24
|
-
console.error(pc.yellow(` Run ${pc.cyan("npm install -g html2pptx-cli")} to update.\n`));
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
.catch(() => {
|
|
28
|
-
// Silently ignore — don't block the CLI
|
|
29
|
-
});
|
|
30
|
-
}
|