@pecot/visual-mcp 1.1.0 → 1.3.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/.claude-plugin/plugin.json +1 -1
- package/assets/slidev/deck-lint.config.js +2 -2
- package/assets/slidev/deck-lint.env.config.js +2 -2
- package/assets/slidev/package.json +7 -7
- package/assets/slidev/runtime/package.json +11 -11
- package/assets/slidev/scripts/eslint/_shared/dist/lib/drawio-geometry.js +10 -10
- package/assets/slidev/scripts/eslint/_shared/dist/lib/text-measurer.d.ts +2 -2
- package/assets/slidev/scripts/eslint/_shared/dist/lib/text-measurer.js +4 -4
- package/assets/slidev/scripts/eslint/_shared/dist/tsconfig.tsbuildinfo +1 -1
- package/assets/slidev/scripts/eslint/_shared/lib/drawio-geometry.ts +10 -10
- package/assets/slidev/scripts/eslint/_shared/lib/text-measurer.ts +4 -4
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-content-before-frontmatter.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-missing-marker-cell.js +4 -4
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-missing-page.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-numeric-asset-prefix.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-numeric-filename-prefix.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-scaled-drawio.js +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-triple-hyphen-in-frontmatter.js +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-unknown-props.js +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/one-slide-per-file.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/require-matching-length.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/require-slides-entry.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/validate-clicks.js +7 -7
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/tsconfig.tsbuildinfo +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-content-before-frontmatter.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-missing-marker-cell.ts +4 -4
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-missing-page.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-numeric-asset-prefix.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-numeric-filename-prefix.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-scaled-drawio.ts +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-triple-hyphen-in-frontmatter.ts +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-unknown-props.ts +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/one-slide-per-file.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/require-matching-length.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/require-slides-entry.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/validate-clicks.ts +7 -7
- package/assets/slidev/scripts/eslint/slidev-pages-lint/package.json +1 -1
- package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/max-chars.js +6 -6
- package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/textlint-body.js +3 -3
- package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/textlint.js +2 -2
- package/assets/slidev/scripts/eslint/text-constraints/dist/tsconfig.tsbuildinfo +1 -1
- package/assets/slidev/scripts/eslint/text-constraints/lib/rules/max-chars.ts +6 -6
- package/assets/slidev/scripts/eslint/text-constraints/lib/rules/textlint-body.ts +3 -3
- package/assets/slidev/scripts/eslint/text-constraints/lib/rules/textlint.ts +2 -2
- package/assets/slidev/scripts/eslint/text-constraints/package.json +1 -1
- package/assets/slidev/scripts/eslint/validate-references/dist/index.js +1 -1
- package/assets/slidev/scripts/eslint/validate-references/dist/lib/schema-validator.js +1 -1
- package/assets/slidev/scripts/eslint/validate-references/dist/lib/semantic-validator.js +12 -12
- package/assets/slidev/scripts/eslint/validate-references/dist/tsconfig.tsbuildinfo +1 -1
- package/assets/slidev/scripts/eslint/validate-references/index.ts +1 -1
- package/assets/slidev/scripts/eslint/validate-references/lib/schema-validator.ts +2 -2
- package/assets/slidev/scripts/eslint/validate-references/lib/semantic-validator.ts +12 -12
- package/assets/slidev/scripts/eslint/validate-references/package.json +1 -1
- package/cli/dist/cli.js +11 -10
- package/cli/dist/commands/chromium/host-dependencies.js +14 -7
- package/cli/dist/commands/drawio/export.js +27 -24
- package/cli/dist/commands/drawio/theme.js +8 -8
- package/cli/dist/commands/drawio/url.js +40 -32
- package/cli/dist/commands/evidence-xlsx/create.js +19 -18
- package/cli/dist/commands/pptx-ooxml/preview.js +26 -30
- package/cli/dist/commands/slidev-project/create.js +27 -26
- package/cli/dist/commands/slidev-project/linked-theme.js +5 -5
- package/cli/dist/commands/slidev-project/lint.js +29 -27
- package/cli/dist/commands/slidev-project/sync.js +35 -34
- package/cli/dist/commands/slidev-project/theme.js +19 -18
- package/cli/dist/commands/slidev-to-pptx/convert.d.ts +4 -0
- package/cli/dist/commands/slidev-to-pptx/convert.js +88 -75
- package/cli/dist/diagnostics.d.ts +38 -0
- package/cli/dist/diagnostics.js +46 -0
- package/cli/dist/domain/_shared/ports.d.ts +0 -1
- package/cli/dist/domain/_shared/text-check.js +2 -2
- package/cli/dist/domain/drawio/export.js +4 -4
- package/cli/dist/domain/drawio/label-text.js +1 -1
- package/cli/dist/domain/drawio/url.d.ts +11 -7
- package/cli/dist/domain/drawio/url.js +67 -45
- package/cli/dist/domain/evidence-xlsx/image-dimensions.js +14 -14
- package/cli/dist/domain/evidence-xlsx/spec-schema.js +26 -26
- package/cli/dist/domain/pptx-ooxml/merge.js +3 -3
- package/cli/dist/domain/pptx-ooxml/prerender-replace.d.ts +1 -0
- package/cli/dist/domain/pptx-ooxml/prerender-replace.js +3 -3
- package/cli/dist/domain/slidev-project/generated-files.d.ts +1 -1
- package/cli/dist/domain/slidev-project/generated-files.js +36 -36
- package/cli/dist/domain/slidev-project/initial-pages.js +4 -4
- package/cli/dist/domain/slidev-project/lint.js +11 -11
- package/cli/dist/domain/slidev-project/sync.js +13 -13
- package/cli/dist/domain/slidev-project/warnings.js +4 -4
- package/cli/dist/domain/slidev-theme/declaration.js +9 -9
- package/cli/dist/domain/slidev-theme/references.js +10 -10
- package/cli/dist/domain/slidev-theme/store-layout.js +6 -6
- package/cli/dist/domain/slidev-theme/talk-theme.js +13 -13
- package/cli/dist/domain/slidev-theme/theme-spec.js +5 -5
- package/cli/dist/domain/slidev-to-pptx/errors.js +3 -3
- package/cli/dist/infra/_shared/dependency-root.js +4 -4
- package/cli/dist/infra/_shared/patch-apply.js +6 -5
- package/cli/dist/infra/_shared/runtime-install.d.ts +12 -84
- package/cli/dist/infra/_shared/runtime-install.js +74 -108
- package/cli/dist/infra/_shared/slidev-bin.js +1 -1
- package/cli/dist/infra/drawio/icons.js +3 -3
- package/cli/dist/infra/drawio/pdf.js +1 -1
- package/cli/dist/infra/drawio/screenshot.js +10 -9
- package/cli/dist/infra/evidence-xlsx/workbook-writer.js +2 -2
- package/cli/dist/infra/playwright/chromium.js +4 -3
- package/cli/dist/infra/playwright/host-dependencies.js +8 -8
- package/cli/dist/infra/playwright/launch.js +5 -5
- package/cli/dist/infra/pptx-ooxml/soffice.js +2 -2
- package/cli/dist/infra/slidev-project/eslint-runner.js +10 -9
- package/cli/dist/infra/slidev-project/fs.js +6 -6
- package/cli/dist/infra/slidev-theme/store.js +18 -15
- package/cli/dist/infra/slidev-to-pptx/cache-store.js +6 -6
- package/cli/dist/infra/slidev-to-pptx/console-logger.d.ts +5 -5
- package/cli/dist/infra/slidev-to-pptx/console-logger.js +19 -20
- package/cli/dist/infra/slidev-to-pptx/dom-converter.d.ts +1 -1
- package/cli/dist/infra/slidev-to-pptx/dom-converter.js +12 -12
- package/cli/dist/infra/slidev-to-pptx/index.js +1 -9
- package/cli/dist/infra/slidev-to-pptx/pipeline.d.ts +2 -2
- package/cli/dist/infra/slidev-to-pptx/pipeline.js +56 -56
- package/cli/dist/infra/slidev-to-pptx/prerender-capture.js +14 -14
- package/cli/dist/infra/slidev-to-pptx/prerender.js +10 -10
- package/cli/dist/infra/slidev-to-pptx/runner.js +1 -0
- package/cli/dist/infra/slidev-to-pptx/scanner.js +10 -10
- package/cli/dist/infra/slidev-to-pptx/server.d.ts +2 -1
- package/cli/dist/infra/slidev-to-pptx/server.js +3 -3
- package/cli/dist/infra/slidev-to-pptx/single-pass-worker.js +39 -39
- package/cli/dist/infra/slidev-to-pptx/slide-worker.js +3 -3
- package/cli/dist/infra/slidev-to-pptx/visibility-helpers.js +8 -8
- package/cli/dist/mcp/dev-server-registry.js +10 -9
- package/cli/dist/mcp/queue.js +1 -1
- package/cli/dist/mcp/result.js +4 -4
- package/cli/dist/mcp/serve.js +5 -3
- package/cli/dist/mcp/server.js +2 -2
- package/cli/dist/mcp/tools/_shared.d.ts +1 -1
- package/cli/dist/mcp/tools/_shared.js +47 -38
- package/cli/dist/mcp/tools/drawio.js +23 -22
- package/cli/dist/mcp/tools/evidence.js +8 -8
- package/cli/dist/mcp/tools/setup.js +26 -26
- package/cli/dist/mcp/tools/slide-dev.js +20 -20
- package/cli/dist/mcp/tools/slide-page.js +39 -37
- package/cli/dist/mcp/tools/slide-theme.js +6 -6
- package/cli/dist/mcp/tools/slide.js +52 -50
- package/cli/dist/mcp/windows-path.js +8 -7
- package/cli/dist/node-runtime.d.ts +6 -1
- package/cli/dist/node-runtime.js +16 -8
- package/npm-shrinkwrap.json +46 -52
- package/package.json +6 -6
- package/vendor/text-rules/dist/source-hash +1 -1
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
10
10
|
import path from 'node:path';
|
|
11
11
|
import { Command } from 'commander';
|
|
12
|
+
import { createDiagnostics, passthrough, writeData } from '../../diagnostics.js';
|
|
12
13
|
import { classifyTalkTheme } from '../../domain/slidev-theme/talk-theme.js';
|
|
13
14
|
import { readThemeDeclaration } from '../../domain/slidev-theme/declaration.js';
|
|
14
15
|
import { ThemeSpecError, parseThemeSpec } from '../../domain/slidev-theme/theme-spec.js';
|
|
@@ -53,27 +54,27 @@ commander コマンドファクトリ。コマンド名は `sync`、`slide` グ
|
|
|
53
54
|
*/
|
|
54
55
|
export function createSlideSyncCommand(buildDependencies) {
|
|
55
56
|
const command = new Command('sync')
|
|
56
|
-
.description('talk-dir
|
|
57
|
-
+ '
|
|
58
|
-
+ '
|
|
59
|
-
+ '
|
|
60
|
-
.requiredOption('--dir <path>', '
|
|
61
|
-
.option('--theme <spec>', '
|
|
62
|
-
.option('--node-modules-only', 'node_modules
|
|
63
|
-
.option('--json', 'machine-readable
|
|
57
|
+
.description('sync a talk-dir; a pre-migration talk-dir that holds a template copy is moved to reference the theme given by --theme'
|
|
58
|
+
+ ' (template-derived files are removed; slides.md, pages/*.md and public/slides/ are kept); '
|
|
59
|
+
+ 'a migrated talk-dir fetches the theme at the version in package.json dependencies and rebuilds node_modules; '
|
|
60
|
+
+ 'generated files (vite.config.ts, start.mjs) are aligned with the current plugin output; nothing else changes')
|
|
61
|
+
.requiredOption('--dir <path>', 'absolute path of the talk-dir to sync')
|
|
62
|
+
.option('--theme <spec>', 'theme referenced by a pre-migration talk-dir (git+https://<host>/<owner>/<repo>.git#<tag> or file:<path>)')
|
|
63
|
+
.option('--node-modules-only', 'rebuild node_modules only (a normal sync of a migrated talk-dir does the same)', false)
|
|
64
|
+
.option('--json', 'print machine-readable JSON to stdout', false)
|
|
64
65
|
.exitOverride()
|
|
65
66
|
.configureOutput({
|
|
66
67
|
writeErr: (string_) => {
|
|
67
68
|
const dependencies = buildDependencies();
|
|
68
69
|
if (doesArgvWantJson(process.argv)) {
|
|
69
|
-
dependencies.stdout
|
|
70
|
+
writeData(dependencies.stdout, JSON.stringify({
|
|
70
71
|
event: 'slide.sync.error',
|
|
71
72
|
reason: 'invalid-option',
|
|
72
73
|
detail: string_.replace(/^error:[ \t]*/i, '').trim(),
|
|
73
|
-
})
|
|
74
|
+
}));
|
|
74
75
|
}
|
|
75
76
|
else {
|
|
76
|
-
dependencies.stderr
|
|
77
|
+
passthrough(dependencies.stderr, string_);
|
|
77
78
|
}
|
|
78
79
|
},
|
|
79
80
|
})
|
|
@@ -94,7 +95,7 @@ export function createSlideSyncCommand(buildDependencies) {
|
|
|
94
95
|
writeSyncSummary(summary, dependencies.stdout);
|
|
95
96
|
});
|
|
96
97
|
if (isWantsJson) {
|
|
97
|
-
dependencies.stdout
|
|
98
|
+
writeData(dependencies.stdout, JSON.stringify(execution.data));
|
|
98
99
|
}
|
|
99
100
|
else {
|
|
100
101
|
writeAutoDeckLintReport(execution.lint, execution.summary.directory, dependencies);
|
|
@@ -104,14 +105,14 @@ export function createSlideSyncCommand(buildDependencies) {
|
|
|
104
105
|
const reason = errorToReason(error);
|
|
105
106
|
const detail = formatError(error);
|
|
106
107
|
if (isWantsJson) {
|
|
107
|
-
dependencies.stdout
|
|
108
|
+
writeData(dependencies.stdout, JSON.stringify({
|
|
108
109
|
event: 'slide.sync.error',
|
|
109
110
|
reason,
|
|
110
111
|
detail,
|
|
111
|
-
})
|
|
112
|
+
}));
|
|
112
113
|
}
|
|
113
114
|
else {
|
|
114
|
-
dependencies.stderr.
|
|
115
|
+
createDiagnostics(dependencies.stderr).error(`slide sync failed: ${detail}`);
|
|
115
116
|
}
|
|
116
117
|
process.exitCode = toExitCode(error);
|
|
117
118
|
}
|
|
@@ -129,27 +130,27 @@ function writeSyncSummary(summary,
|
|
|
129
130
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
130
131
|
stdout) {
|
|
131
132
|
const { theme } = summary;
|
|
132
|
-
const themeLine = theme === undefined ? undefined : `
|
|
133
|
+
const themeLine = theme === undefined ? undefined : ` theme: ${theme.name} (${theme.spec})`;
|
|
133
134
|
if (summary.nodeModulesOnly) {
|
|
134
|
-
stdout
|
|
135
|
+
writeData(stdout, `slide sync (node_modules only): success (${summary.directory})`);
|
|
135
136
|
if (themeLine !== undefined)
|
|
136
|
-
stdout
|
|
137
|
-
stdout
|
|
137
|
+
writeData(stdout, themeLine);
|
|
138
|
+
writeData(stdout, ` node_modules → ${summary.nodeModulesTarget}`);
|
|
138
139
|
return;
|
|
139
140
|
}
|
|
140
|
-
stdout
|
|
141
|
+
writeData(stdout, `slide sync: success (${summary.directory})`);
|
|
141
142
|
if (themeLine !== undefined)
|
|
142
|
-
stdout
|
|
143
|
+
writeData(stdout, themeLine);
|
|
143
144
|
if (summary.mode === 'relink') {
|
|
144
145
|
if (theme !== undefined)
|
|
145
|
-
stdout
|
|
146
|
-
stdout
|
|
147
|
-
stdout
|
|
146
|
+
writeData(stdout, ` location: ${theme.directory}`);
|
|
147
|
+
writeData(stdout, ` node_modules → ${summary.nodeModulesTarget}`);
|
|
148
|
+
writeData(stdout, ' nothing changed except node_modules');
|
|
148
149
|
return;
|
|
149
150
|
}
|
|
150
|
-
stdout
|
|
151
|
-
stdout
|
|
152
|
-
stdout
|
|
151
|
+
writeData(stdout, ` node_modules → ${summary.nodeModulesTarget}`);
|
|
152
|
+
writeData(stdout, ` removed (${String(summary.removed.length)}): ${summary.removed.join(', ')}`);
|
|
153
|
+
writeData(stdout, ' kept slides.md, pages/*.md and public/slides/; rewrote theme: in slides.md and the dependency in package.json');
|
|
153
154
|
}
|
|
154
155
|
/**
|
|
155
156
|
`slide sync` の実処理と機械可読な結果組み立て。CLI action と MCP ツールの双方がここを通る。
|
|
@@ -163,7 +164,7 @@ export async function executeSlideSync(options,
|
|
|
163
164
|
dependencies, onSynced) {
|
|
164
165
|
const summary = await runSyncCore(options, dependencies);
|
|
165
166
|
for (const warning of summary.warnings)
|
|
166
|
-
dependencies.stderr.
|
|
167
|
+
createDiagnostics(dependencies.stderr).warning(warning);
|
|
167
168
|
onSynced?.(summary);
|
|
168
169
|
// 同期後のデッキ全体 lint。違反があっても sync の成否は変えない。
|
|
169
170
|
const lint = await runAutoDeckLint(summary.directory, dependencies);
|
|
@@ -203,12 +204,12 @@ stderr) {
|
|
|
203
204
|
try {
|
|
204
205
|
const { data } = await executeSlideTheme({ dir: directory }, { files: new NodeThemeFiles() });
|
|
205
206
|
for (const warning of data.warnings)
|
|
206
|
-
stderr.
|
|
207
|
+
createDiagnostics(stderr).warning(warning);
|
|
207
208
|
return { categories: data.categories, layouts: data.layouts };
|
|
208
209
|
}
|
|
209
210
|
catch (error) {
|
|
210
211
|
// 移行前の形 (theme: none) もここに来る。一覧を空にして、同期の成否は変えない。
|
|
211
|
-
stderr.
|
|
212
|
+
createDiagnostics(stderr).warning(`cannot read layout catalog: ${directory}: ${formatError(error)}`);
|
|
212
213
|
return { categories: [], layouts: [] };
|
|
213
214
|
}
|
|
214
215
|
}
|
|
@@ -231,11 +232,11 @@ dependencies) {
|
|
|
231
232
|
storeRoot: dependencies.themeStoreRoot ?? themeStoreRoot,
|
|
232
233
|
currentDirectory: dependencies.currentDirectory ?? process.cwd(),
|
|
233
234
|
dependencyRoot,
|
|
234
|
-
warn: (message) => { dependencies.stderr.
|
|
235
|
+
warn: (message) => { createDiagnostics(dependencies.stderr).warning(message); },
|
|
235
236
|
}),
|
|
236
237
|
ensureThemeLinked: dependencies.ensureThemeLinked ?? (directory => ensureTalkThemeLinked(directory, linkedThemeDefaultDependencies(dependencyRoot,
|
|
237
238
|
/* c8 ignore next -- 実 git の取得中に出る警告の出力先。テストは実 git に出ない */
|
|
238
|
-
{ warn: (message) => { dependencies.stderr.
|
|
239
|
+
{ warn: (message) => { createDiagnostics(dependencies.stderr).warning(message); } }))),
|
|
239
240
|
});
|
|
240
241
|
}
|
|
241
242
|
/**
|
|
@@ -249,7 +250,7 @@ async function prepareMigrationTheme(themeOption, talkDirectory, context) {
|
|
|
249
250
|
assertDependencyRootAvailable(dependencyRoot);
|
|
250
251
|
const storeRoot = context.storeRoot();
|
|
251
252
|
if (storeRoot === undefined) {
|
|
252
|
-
throw new SlideCreateRuntimeError('
|
|
253
|
+
throw new SlideCreateRuntimeError('cannot determine the theme location (fix: check the data directory CLAUDE_PLUGIN_DATA)', 'theme-unknown');
|
|
253
254
|
}
|
|
254
255
|
const fetched = await context.fetch(spec, {
|
|
255
256
|
storeRoot,
|
|
@@ -316,7 +317,7 @@ export function slideSyncDefaultDependencies() {
|
|
|
316
317
|
const pluginRoot = process.env['CLAUDE_PLUGIN_ROOT'];
|
|
317
318
|
/* c8 ignore next 3 -- bin/pecotv が CLAUDE_PLUGIN_ROOT を必ず export するため未設定ルートは実運用で発生しない */
|
|
318
319
|
if (pluginRoot === undefined || pluginRoot === '') {
|
|
319
|
-
throw new SlideSyncRuntimeError('CLAUDE_PLUGIN_ROOT
|
|
320
|
+
throw new SlideSyncRuntimeError('CLAUDE_PLUGIN_ROOT is not set', 'unknown');
|
|
320
321
|
}
|
|
321
322
|
const dependencyRoot = pluginDependencyRoot();
|
|
322
323
|
return {
|
|
@@ -13,12 +13,13 @@
|
|
|
13
13
|
import path from 'node:path';
|
|
14
14
|
import { Command } from 'commander';
|
|
15
15
|
import { THEME_DECLARATION_FILE_NAME, readThemeDeclaration, } from '../../domain/slidev-theme/declaration.js';
|
|
16
|
+
import { createDiagnostics, passthrough, writeData } from '../../diagnostics.js';
|
|
16
17
|
import { themeErrorReason } from '../../domain/slidev-theme/error-reason.js';
|
|
17
18
|
import { buildLayoutCatalog, readLayoutCategories, resolveLayoutReferences, } from '../../domain/slidev-theme/references.js';
|
|
18
19
|
import { resolveTalkTheme } from '../../domain/slidev-theme/talk-theme.js';
|
|
19
20
|
import { NodeThemeFiles } from '../../infra/slidev-theme/fs.js';
|
|
20
|
-
const LINK_COLOR_WARNING = 'pptx.linkColor
|
|
21
|
-
+
|
|
21
|
+
const LINK_COLOR_WARNING = 'pptx.linkColor is omitted, so links are not converted in PPTX (no hyperlinks are added) '
|
|
22
|
+
+ `(fix: set pptx.linkColor in ${THEME_DECLARATION_FILE_NAME} to a 6-digit hex value to convert links)`;
|
|
22
23
|
/**
|
|
23
24
|
`slide theme` の実処理。CLI action と MCP ツール(slide_theme)、lint・page・convert もここを通る。
|
|
24
25
|
|
|
@@ -85,19 +86,19 @@ stdout,
|
|
|
85
86
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
86
87
|
stderr) {
|
|
87
88
|
const { theme } = data;
|
|
88
|
-
stdout
|
|
89
|
-
stdout
|
|
90
|
-
stdout
|
|
91
|
-
stdout
|
|
89
|
+
writeData(stdout, `slide theme: ${theme.name} (${theme.spec})`);
|
|
90
|
+
writeData(stdout, ` theme root: ${theme.directory}`);
|
|
91
|
+
writeData(stdout, ` declaration: ${theme.declared ? 'present' : 'absent'}`);
|
|
92
|
+
writeData(stdout, ` layouts: ${String(data.layouts.length)}`);
|
|
92
93
|
for (const category of data.categories) {
|
|
93
|
-
stdout
|
|
94
|
+
writeData(stdout, ` --- ${category.label}: ${category.question} ---`);
|
|
94
95
|
const members = data.layouts.filter(entry => entry.category === category.id);
|
|
95
96
|
for (const layout of members) {
|
|
96
|
-
stdout
|
|
97
|
+
writeData(stdout, ` - ${layout.deprecated ? '[deprecated] ' : ''}${layout.layout}: ${layout.description}`);
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
for (const warning of data.warnings) {
|
|
100
|
-
stderr.
|
|
101
|
+
createDiagnostics(stderr).warning(warning);
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
/**
|
|
@@ -111,22 +112,22 @@ exit code: 成功 = 0 / 解決・宣言の失敗 = 1 / usage error = 2(command
|
|
|
111
112
|
*/
|
|
112
113
|
export function createSlideThemeCommand(buildDependencies) {
|
|
113
114
|
const command = new Command('theme')
|
|
114
|
-
.description('talk-dir
|
|
115
|
-
.option('--dir <path>', 'talk-dir
|
|
116
|
-
.option('--json', 'machine-readable
|
|
115
|
+
.description('print the theme declaration and layout list referenced by a talk-dir')
|
|
116
|
+
.option('--dir <path>', 'talk-dir path (default: current directory)')
|
|
117
|
+
.option('--json', 'print machine-readable JSON to stdout', false)
|
|
117
118
|
.exitOverride()
|
|
118
119
|
.configureOutput({
|
|
119
120
|
writeErr: (string_) => {
|
|
120
121
|
const dependencies = buildDependencies();
|
|
121
122
|
if (doesArgvWantJson(process.argv)) {
|
|
122
|
-
dependencies.stdout
|
|
123
|
+
writeData(dependencies.stdout, JSON.stringify({
|
|
123
124
|
event: 'slide.theme.error',
|
|
124
125
|
reason: 'invalid-option',
|
|
125
126
|
detail: string_.replace(/^error:[ \t]*/i, '').trim(),
|
|
126
|
-
})
|
|
127
|
+
}));
|
|
127
128
|
}
|
|
128
129
|
else {
|
|
129
|
-
dependencies.stderr
|
|
130
|
+
passthrough(dependencies.stderr, string_);
|
|
130
131
|
}
|
|
131
132
|
},
|
|
132
133
|
})
|
|
@@ -137,7 +138,7 @@ export function createSlideThemeCommand(buildDependencies) {
|
|
|
137
138
|
try {
|
|
138
139
|
const { data } = await executeSlideTheme({ dir: directory }, dependencies);
|
|
139
140
|
if (isWantsJson) {
|
|
140
|
-
dependencies.stdout
|
|
141
|
+
writeData(dependencies.stdout, JSON.stringify(data));
|
|
141
142
|
}
|
|
142
143
|
else {
|
|
143
144
|
writeHumanReport(data, dependencies.stdout, dependencies.stderr);
|
|
@@ -147,10 +148,10 @@ export function createSlideThemeCommand(buildDependencies) {
|
|
|
147
148
|
const reason = errorToReason(error);
|
|
148
149
|
const detail = formatError(error);
|
|
149
150
|
if (isWantsJson) {
|
|
150
|
-
dependencies.stdout
|
|
151
|
+
writeData(dependencies.stdout, JSON.stringify({ event: 'slide.theme.error', reason, detail }));
|
|
151
152
|
}
|
|
152
153
|
else {
|
|
153
|
-
dependencies.stderr.
|
|
154
|
+
createDiagnostics(dependencies.stderr).error(`slide theme failed: ${detail}`);
|
|
154
155
|
}
|
|
155
156
|
process.exitCode = 1;
|
|
156
157
|
}
|
|
@@ -24,6 +24,10 @@ export interface SlideConvertOptions {
|
|
|
24
24
|
readonly transitionType?: TransitionType;
|
|
25
25
|
readonly transitionDurationMs?: number;
|
|
26
26
|
readonly morphOption?: MorphOption;
|
|
27
|
+
/**
|
|
28
|
+
進捗の詳しさ。省略時は infra の既定 (normal)。verbose・debug は進捗を stderr に note: で出す
|
|
29
|
+
*/
|
|
30
|
+
readonly logLevel?: 'normal' | 'verbose' | 'debug';
|
|
27
31
|
}
|
|
28
32
|
export interface SlideConvertDependencies {
|
|
29
33
|
readonly slidevRunner: SlidevRunner;
|