@pecot/visual-mcp 1.2.0 → 1.3.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/.claude-plugin/plugin.json +1 -1
- package/README.md +35 -5
- package/assets/slidev/deck-lint.config.js +2 -2
- package/assets/slidev/deck-lint.env.config.js +2 -2
- package/assets/slidev/package.json +3 -3
- package/assets/slidev/runtime/package.json +1 -1
- 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/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/validate-references/dist/index.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/semantic-validator.ts +12 -12
- package/cli/dist/cli.js +8 -8
- package/cli/dist/commands/chromium/host-dependencies.js +3 -3
- package/cli/dist/commands/drawio/export.js +15 -15
- package/cli/dist/commands/drawio/theme.js +7 -7
- package/cli/dist/commands/drawio/url.js +14 -14
- package/cli/dist/commands/evidence-xlsx/create.js +11 -11
- package/cli/dist/commands/pptx-ooxml/preview.js +13 -13
- package/cli/dist/commands/slidev-project/create.js +12 -12
- package/cli/dist/commands/slidev-project/linked-theme.js +5 -5
- package/cli/dist/commands/slidev-project/lint.js +13 -13
- package/cli/dist/commands/slidev-project/sync.js +19 -19
- package/cli/dist/commands/slidev-project/theme.js +9 -9
- package/cli/dist/commands/slidev-to-pptx/convert.js +47 -47
- 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.js +27 -27
- package/cli/dist/domain/evidence-xlsx/image-dimensions.js +14 -14
- package/cli/dist/domain/evidence-xlsx/layout.d.ts +2 -3
- package/cli/dist/domain/evidence-xlsx/ooxml.d.ts +1 -8
- package/cli/dist/domain/evidence-xlsx/ooxml.js +35 -24
- 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/slidev-project/generated-files.d.ts +1 -1
- package/cli/dist/domain/slidev-project/generated-files.js +34 -34
- 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.js +4 -3
- 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/dom-converter.js +12 -12
- package/cli/dist/infra/slidev-to-pptx/pipeline.d.ts +1 -1
- package/cli/dist/infra/slidev-to-pptx/pipeline.js +54 -54
- 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.js +2 -2
- 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 +1 -1
- 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 +36 -37
- package/cli/dist/mcp/tools/drawio.js +22 -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 +36 -36
- package/cli/dist/mcp/tools/slide-theme.js +6 -6
- package/cli/dist/mcp/tools/slide.js +49 -49
- 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 +25 -31
- package/package.json +2 -2
- package/vendor/text-rules/dist/source-hash +1 -1
package/cli/dist/cli.js
CHANGED
|
@@ -12,7 +12,7 @@ import { createSlideThemeCommand, slideThemeDefaultDependencies, } from './comma
|
|
|
12
12
|
import { createSlideConvertCommand, slideConvertDefaultDependencies, } from './commands/slidev-to-pptx/convert.js';
|
|
13
13
|
import { createSlideSyncCommand, slideSyncDefaultDependencies, } from './commands/slidev-project/sync.js';
|
|
14
14
|
import { createDiagnostics, writeData } from './diagnostics.js';
|
|
15
|
-
import {
|
|
15
|
+
import { nodeRuntimeGuidance } from './node-runtime.js';
|
|
16
16
|
import { readVersion } from './version.js';
|
|
17
17
|
export function createProgram() {
|
|
18
18
|
const program = new Command();
|
|
@@ -23,24 +23,24 @@ export function createProgram() {
|
|
|
23
23
|
.action(() => {
|
|
24
24
|
writeData(process.stdout, 'hello from pecotv (ts)');
|
|
25
25
|
});
|
|
26
|
-
const pptx = new Command('pptx').description('PPTX
|
|
26
|
+
const pptx = new Command('pptx').description('operate on PPTX files');
|
|
27
27
|
pptx.addCommand(createPptxPreviewCommand(pptxPreviewDefaultDependencies));
|
|
28
28
|
program.addCommand(pptx);
|
|
29
|
-
const slide = new Command('slide').description('Slidev
|
|
29
|
+
const slide = new Command('slide').description('operate on Slidev projects');
|
|
30
30
|
slide.addCommand(createSlideCreateCommand(slideCreateDefaultDependencies));
|
|
31
31
|
slide.addCommand(createSlideConvertCommand(slideConvertDefaultDependencies));
|
|
32
32
|
slide.addCommand(createSlideSyncCommand(slideSyncDefaultDependencies));
|
|
33
33
|
slide.addCommand(createSlideLintCommand(slideLintDefaultDependencies));
|
|
34
34
|
slide.addCommand(createSlideThemeCommand(slideThemeDefaultDependencies));
|
|
35
35
|
program.addCommand(slide);
|
|
36
|
-
const drawio = new Command('drawio').description('drawio
|
|
36
|
+
const drawio = new Command('drawio').description('operate on drawio diagrams');
|
|
37
37
|
drawio.addCommand(createDrawioUrlCommand(drawioUrlDefaultDependencies));
|
|
38
38
|
drawio.addCommand(createDrawioExportCommand(drawioExportDefaultDependencies));
|
|
39
39
|
program.addCommand(drawio);
|
|
40
|
-
const chromiumCommand = new Command('chromium').description('Playwright Chromium
|
|
40
|
+
const chromiumCommand = new Command('chromium').description('operate on the Playwright Chromium runtime');
|
|
41
41
|
chromiumCommand.addCommand(createChromiumHostDependenciesCommand(hostDependenciesCommandDefaultDependencies));
|
|
42
42
|
program.addCommand(chromiumCommand);
|
|
43
|
-
const evidence = new Command('evidence').description('
|
|
43
|
+
const evidence = new Command('evidence').description('operate on evidence xlsx files');
|
|
44
44
|
evidence.addCommand(createEvidenceCreateCommand(evidenceCreateDefaultDependencies));
|
|
45
45
|
program.addCommand(evidence);
|
|
46
46
|
// mcp の実装は src/mcp/ に置く (ESLint zone: commands → mcp の import 禁止)。
|
|
@@ -49,7 +49,7 @@ export function createProgram() {
|
|
|
49
49
|
// (計測 約 60ms) 重くなるため。
|
|
50
50
|
const mcp = program
|
|
51
51
|
.command('mcp')
|
|
52
|
-
.description('MCP
|
|
52
|
+
.description('serve as an MCP server over stdio (stdin/stdout)');
|
|
53
53
|
/* c8 ignore start -- action は dynamic import して実 process.stdin/stdout へ接続する。
|
|
54
54
|
単体テストから起動すると vitest worker の stdout ごと差し替えてしまう。このルートは
|
|
55
55
|
tests/e2e/mcp-stdio.test.ts が実プロセスの spawn で担保する。 */
|
|
@@ -72,7 +72,7 @@ export function applyExitOverrideRecursively(command) {
|
|
|
72
72
|
applyExitOverrideRecursively(child);
|
|
73
73
|
}
|
|
74
74
|
export function main(nodeVersion = process.versions.node) {
|
|
75
|
-
const runtimeError =
|
|
75
|
+
const runtimeError = nodeRuntimeGuidance(nodeVersion);
|
|
76
76
|
if (runtimeError !== undefined) {
|
|
77
77
|
createDiagnostics(process.stderr).error(runtimeError);
|
|
78
78
|
process.exitCode = 1;
|
|
@@ -27,8 +27,8 @@ export function hostDependenciesCommandDefaultDependencies() {
|
|
|
27
27
|
}
|
|
28
28
|
export function createChromiumHostDependenciesCommand(buildDependencies) {
|
|
29
29
|
return new Command('host-deps')
|
|
30
|
-
.description('
|
|
31
|
-
.option('--require-launch', 'OS
|
|
30
|
+
.description('check the OS libraries Chromium needs to launch and install any that are missing')
|
|
31
|
+
.option('--require-launch', 'also fail when Chromium cannot launch for a reason other than OS libraries (for test preconditions)')
|
|
32
32
|
.action(async (options) => {
|
|
33
33
|
const dependencies = buildDependencies();
|
|
34
34
|
const diagnostics = createDiagnostics(dependencies.stderr);
|
|
@@ -59,7 +59,7 @@ export function createChromiumHostDependenciesCommand(buildDependencies) {
|
|
|
59
59
|
case 'launch-failed': {
|
|
60
60
|
// 実行ファイル未取得等。取得は bin/pecotv の別の段が担うため、記録だけして通す。
|
|
61
61
|
hostDependencies.record('launch-failed');
|
|
62
|
-
const message = `Chromium
|
|
62
|
+
const message = `Chromium failed to launch (cause other than OS libraries): ${outcome.detail}`;
|
|
63
63
|
if (options.requireLaunch === true) {
|
|
64
64
|
diagnostics.error(message);
|
|
65
65
|
dependencies.setExitCode(LAUNCH_FAILED_EXIT_CODE);
|
|
@@ -67,7 +67,7 @@ PDF 同時出力時は兄弟 PDF が SVG 自身を上書きし、`--no-pdf` 時
|
|
|
67
67
|
export function assertOutputExtension(output, options) {
|
|
68
68
|
if (output === undefined || output === '' || options.printHash || (path.extname(output).toLowerCase() !== PDF_EXTENSION))
|
|
69
69
|
return;
|
|
70
|
-
throw new DrawioExportUsageError(`-o
|
|
70
|
+
throw new DrawioExportUsageError(`-o cannot use the ${PDF_EXTENSION} extension: ${path.resolve(output)} (fix: the output is SVG, so use an extension such as ${OUTPUT_SUFFIX})`, 'invalid-output-extension');
|
|
71
71
|
}
|
|
72
72
|
export async function runDrawioExport(inputFile, options,
|
|
73
73
|
// DI 経由の write は mutate メソッド。
|
|
@@ -87,7 +87,7 @@ dependencies) {
|
|
|
87
87
|
xml = await dependencies.readFile(absoluteInput);
|
|
88
88
|
}
|
|
89
89
|
catch (error) {
|
|
90
|
-
throw new DrawioExportRuntimeError(
|
|
90
|
+
throw new DrawioExportRuntimeError(`cannot read input file: ${absoluteInput}: ${formatError(error)}`, 'input-not-found');
|
|
91
91
|
}
|
|
92
92
|
const iconRoot = path.resolve(options.icons);
|
|
93
93
|
const resolveIcon = createIconResolver(iconRoot);
|
|
@@ -109,21 +109,21 @@ dependencies) {
|
|
|
109
109
|
}
|
|
110
110
|
const resolved = resolveIconsForExport(xml, resolveIcon);
|
|
111
111
|
if (resolved.unresolved.length > 0) {
|
|
112
|
-
throw new DrawioExportRuntimeError(`icon://
|
|
112
|
+
throw new DrawioExportRuntimeError(`cannot resolve icon:// references (icons root: ${iconRoot}): ${resolved.unresolved.join(', ')}`, 'icon-unresolved');
|
|
113
113
|
}
|
|
114
114
|
let svg;
|
|
115
115
|
try {
|
|
116
116
|
svg = await dependencies.exportSvg(resolved.xml);
|
|
117
117
|
}
|
|
118
118
|
catch (error) {
|
|
119
|
-
throw new DrawioExportRuntimeError(`SVG export
|
|
119
|
+
throw new DrawioExportRuntimeError(`SVG export failed: ${formatError(error)}`, 'export-failed');
|
|
120
120
|
}
|
|
121
121
|
const baked = embedSourceHash(forceLightColorScheme(svg), sourceSha256);
|
|
122
122
|
try {
|
|
123
123
|
await dependencies.writeFile(absoluteOutput, baked);
|
|
124
124
|
}
|
|
125
125
|
catch (error) {
|
|
126
|
-
throw new DrawioExportRuntimeError(
|
|
126
|
+
throw new DrawioExportRuntimeError(`cannot write output file: ${absoluteOutput}: ${formatError(error)}`, 'output-write-failed');
|
|
127
127
|
}
|
|
128
128
|
const pdfResult = options.pdf
|
|
129
129
|
? await writeSiblingPdf(baked, pdfPath, dependencies)
|
|
@@ -152,7 +152,7 @@ dependencies) {
|
|
|
152
152
|
return { pdfFile: pdfPath, pdfFailed: false };
|
|
153
153
|
}
|
|
154
154
|
catch (error) {
|
|
155
|
-
createDiagnostics(dependencies.stderr).warning(`PDF
|
|
155
|
+
createDiagnostics(dependencies.stderr).warning(`PDF export failed: ${formatError(error)}`);
|
|
156
156
|
// 古い PDF の削除失敗は独立した警告として数えない。今回の PDF 失敗 1 件(pdfFailed /
|
|
157
157
|
// warnings: 1 / exit 3)に集約し、JSON と exit code には出さず stderr の行だけで知らせる。
|
|
158
158
|
// 呼び出し側は `pdf: null` を見て隣の PDF を今回の出力として扱わない前提にする。
|
|
@@ -160,7 +160,7 @@ dependencies) {
|
|
|
160
160
|
await dependencies.removeFile(pdfPath);
|
|
161
161
|
}
|
|
162
162
|
catch (removeError) {
|
|
163
|
-
createDiagnostics(dependencies.stderr).warning(
|
|
163
|
+
createDiagnostics(dependencies.stderr).warning(`cannot remove the previous PDF: ${pdfPath}: ${formatError(removeError)}`);
|
|
164
164
|
}
|
|
165
165
|
return { pdfFile: undefined, pdfFailed: true };
|
|
166
166
|
}
|
|
@@ -239,22 +239,22 @@ function doesArgvWantJson(argv) {
|
|
|
239
239
|
function parseIcons(raw) {
|
|
240
240
|
const value = String(raw);
|
|
241
241
|
if (value === '') {
|
|
242
|
-
throw new DrawioExportUsageError('option --icons
|
|
242
|
+
throw new DrawioExportUsageError('option --icons requires the root directory that resolves icon:// (fix: pass --icons <dir>)', 'missing-icons-root');
|
|
243
243
|
}
|
|
244
244
|
return value;
|
|
245
245
|
}
|
|
246
246
|
export function createDrawioExportCommand(buildDependencies) {
|
|
247
247
|
const command = new Command('export')
|
|
248
|
-
.description('drawio XML
|
|
249
|
-
.argument('<input>', '
|
|
248
|
+
.description('export drawio XML to a static SVG and a sibling PDF')
|
|
249
|
+
.argument('<input>', 'input .drawio file path')
|
|
250
250
|
// CLI 側は required に据え置く(既定を持つのは MCP の drawio_export だけ)。
|
|
251
251
|
// 呼び出し側が talk-dir 相対の public/assets/icons など、解決の root を明示して渡す。
|
|
252
252
|
// プラグイン同梱カタログを既定にすると、誤った root で通知なしに解決されうる。
|
|
253
|
-
.requiredOption('--icons <dir>', '
|
|
254
|
-
.option('-o, --output <path>',
|
|
255
|
-
.option('--no-pdf', '
|
|
256
|
-
.option('--print-hash', '
|
|
257
|
-
.option('--json', 'machine-readable
|
|
253
|
+
.requiredOption('--icons <dir>', 'root directory that resolves icon://')
|
|
254
|
+
.option('-o, --output <path>', `output SVG path (default: <input>${OUTPUT_SUFFIX})`)
|
|
255
|
+
.option('--no-pdf', 'do not write the sibling PDF (extension replaced with .pdf)')
|
|
256
|
+
.option('--print-hash', 'print only the composite hash for staleness checks to stdout, without exporting', false)
|
|
257
|
+
.option('--json', 'print machine-readable JSON to stdout', false)
|
|
258
258
|
.exitOverride()
|
|
259
259
|
.configureOutput({
|
|
260
260
|
writeErr: (string_) => {
|
|
@@ -88,7 +88,7 @@ async function hasTheme(files, directory, names) {
|
|
|
88
88
|
return false;
|
|
89
89
|
}
|
|
90
90
|
function invalidTheme(option, detail) {
|
|
91
|
-
return new DrawioUrlUsageError(`
|
|
91
|
+
return new DrawioUrlUsageError(`invalid --theme (${detail}): ${option}`, 'invalid-theme');
|
|
92
92
|
}
|
|
93
93
|
async function themeFromOption(option,
|
|
94
94
|
// DI の port(関数と AbortSignal)を持つため readonly 化できない。
|
|
@@ -98,7 +98,7 @@ dependencies, files, currentDirectory, info) {
|
|
|
98
98
|
const spec = parseThemeSpec(option);
|
|
99
99
|
const storeRoot = (dependencies.themeStoreRoot ?? themeStoreRoot)();
|
|
100
100
|
if (storeRoot === undefined) {
|
|
101
|
-
throw new DrawioUrlRuntimeError('
|
|
101
|
+
throw new DrawioUrlRuntimeError('cannot determine the theme location (fix: check the data directory CLAUDE_PLUGIN_DATA)', 'theme-unknown');
|
|
102
102
|
}
|
|
103
103
|
const fetched = await (dependencies.fetchTheme ?? fetchTheme)(spec, {
|
|
104
104
|
storeRoot,
|
|
@@ -113,10 +113,10 @@ dependencies, files, currentDirectory, info) {
|
|
|
113
113
|
const spec = parseThemeSpec(option);
|
|
114
114
|
/* c8 ignore next 3 -- FILE_PREFIX で始まる指定は parseThemeSpec が必ず file kind にする */
|
|
115
115
|
if (spec.kind !== 'file')
|
|
116
|
-
throw invalidTheme(option, '
|
|
116
|
+
throw invalidTheme(option, 'cannot be parsed');
|
|
117
117
|
const directory = path.resolve(currentDirectory, spec.path);
|
|
118
118
|
if (!(await hasTheme(files, directory, [THEME_DECLARATION_FILE_NAME, 'package.json']))) {
|
|
119
|
-
throw invalidTheme(option,
|
|
119
|
+
throw invalidTheme(option, `theme ${directory} has neither ${THEME_DECLARATION_FILE_NAME} nor package.json`);
|
|
120
120
|
}
|
|
121
121
|
return await themeFromRoot(files, 'option', await packageNameOf(files, directory), directory, info);
|
|
122
122
|
}
|
|
@@ -126,8 +126,8 @@ dependencies, files, currentDirectory, info) {
|
|
|
126
126
|
if (await hasTheme(files, directory, [THEME_DECLARATION_FILE_NAME])) {
|
|
127
127
|
return await themeFromRoot(files, 'option', await packageNameOf(files, directory), directory, info);
|
|
128
128
|
}
|
|
129
|
-
throw invalidTheme(option,
|
|
130
|
-
+ 'git+https://<host>/<owner>/<repo>.git#<tag
|
|
129
|
+
throw invalidTheme(option, `neither a talk-dir nor a theme root: ${directory} has no ${SLIDES_FILE_NAME} or ${THEME_DECLARATION_FILE_NAME}; `
|
|
130
|
+
+ '(fix: pass git+https://<host>/<owner>/<repo>.git#<tag>, file:<path>, or a talk-dir path)');
|
|
131
131
|
}
|
|
132
132
|
const resolved = await resolveTalkTheme(files, directory);
|
|
133
133
|
return await themeFromRoot(files, 'option', resolved.name, resolved.directory, info);
|
|
@@ -156,7 +156,7 @@ dependencies, info) {
|
|
|
156
156
|
catch (error) {
|
|
157
157
|
// 移行前の talk-dir は、今は動いている図の作成を止めず、既定値で続ける。
|
|
158
158
|
if (error instanceof ThemeResolveError && error.reason === 'theme-none') {
|
|
159
|
-
info(`${talk}
|
|
159
|
+
info(`${talk} does not reference a theme; checking with the plugin default fonts. ${MIGRATE_ADVICE}`);
|
|
160
160
|
return FALLBACK_THEME;
|
|
161
161
|
}
|
|
162
162
|
throw error;
|
|
@@ -37,7 +37,7 @@ dependencies) {
|
|
|
37
37
|
xml = await dependencies.readFile(absolute);
|
|
38
38
|
}
|
|
39
39
|
catch (error) {
|
|
40
|
-
throw new DrawioUrlRuntimeError(
|
|
40
|
+
throw new DrawioUrlRuntimeError(`cannot read input file: ${absolute}: ${formatError(error)}`, 'input-not-found');
|
|
41
41
|
}
|
|
42
42
|
const trimmed = xml.trim();
|
|
43
43
|
// 書体・文字サイズを確かめる宣言を決める。解けないテーマは、成果物を作る前にここで止める。
|
|
@@ -108,7 +108,7 @@ async function assertLabelsClean(xml, lintText) {
|
|
|
108
108
|
violations = await collectTextViolations(labelTexts(xml), lintText);
|
|
109
109
|
}
|
|
110
110
|
catch (error) {
|
|
111
|
-
throw new DrawioUrlRuntimeError(
|
|
111
|
+
throw new DrawioUrlRuntimeError(`text rules check failed: ${formatError(error)}`, 'text-lint-failed');
|
|
112
112
|
}
|
|
113
113
|
if (violations.length > 0) {
|
|
114
114
|
throw new DrawioUrlRuntimeError(formatTextViolations(violations), 'text-violation', violations);
|
|
@@ -129,7 +129,7 @@ dependencies) {
|
|
|
129
129
|
// 書き出すのは表示用 HTML だけなので、それ以外の拡張子は成果物を作る前に弾く。
|
|
130
130
|
// 入力の読み込みより先に確認し、UsageError のときは成果物と警告を残さない。
|
|
131
131
|
if (outputFile !== undefined && path.extname(outputFile).toLowerCase() !== '.html') {
|
|
132
|
-
throw new DrawioUrlUsageError(`-o
|
|
132
|
+
throw new DrawioUrlUsageError(`-o accepts only the .html extension: ${outputFile}`, 'invalid-output-extension');
|
|
133
133
|
}
|
|
134
134
|
const summary = await runDrawioUrl(inputFile, options, dependencies);
|
|
135
135
|
const diagnostics = createDiagnostics(dependencies.stderr);
|
|
@@ -145,7 +145,7 @@ dependencies) {
|
|
|
145
145
|
await dependencies.writeFile(outputFile, renderRedirectHtml(summary.url));
|
|
146
146
|
}
|
|
147
147
|
catch (error) {
|
|
148
|
-
throw new DrawioUrlRuntimeError(
|
|
148
|
+
throw new DrawioUrlRuntimeError(`cannot write output file: ${outputFile}: ${formatError(error)}`, 'output-write-failed');
|
|
149
149
|
}
|
|
150
150
|
artifacts.push(outputFile);
|
|
151
151
|
if (options.png) {
|
|
@@ -157,7 +157,7 @@ dependencies) {
|
|
|
157
157
|
artifacts.push(pngPath);
|
|
158
158
|
}
|
|
159
159
|
catch (error) {
|
|
160
|
-
diagnostics.warning(`PNG
|
|
160
|
+
diagnostics.warning(`PNG export failed: ${formatError(error)}`);
|
|
161
161
|
warningCount += 1;
|
|
162
162
|
isPngFailed = true;
|
|
163
163
|
}
|
|
@@ -225,19 +225,19 @@ function doesArgvWantJson(argv) {
|
|
|
225
225
|
}
|
|
226
226
|
function parseMode(raw) {
|
|
227
227
|
if (typeof raw !== 'string' || !VALID_MODES.has(raw)) {
|
|
228
|
-
throw new DrawioUrlUsageError(`option --mode
|
|
228
|
+
throw new DrawioUrlUsageError(`option --mode accepts only view or edit: ${String(raw)}`, 'invalid-mode');
|
|
229
229
|
}
|
|
230
230
|
return raw === 'edit' ? 'edit' : 'view';
|
|
231
231
|
}
|
|
232
232
|
export function createDrawioUrlCommand(buildDependencies) {
|
|
233
233
|
const command = new Command('url')
|
|
234
|
-
.description('drawio XML
|
|
235
|
-
.argument('<input>', '
|
|
236
|
-
.option('--mode <mode>', 'view
|
|
237
|
-
.option('-o, --output <path>', '
|
|
238
|
-
.option('--json', 'machine-readable
|
|
239
|
-
.option('--theme <spec>', '
|
|
240
|
-
.option('--no-png', '
|
|
234
|
+
.description('turn drawio XML into artifacts that open directly in a browser (viewer HTML / rendered PNG)')
|
|
235
|
+
.argument('<input>', 'input .drawio file path')
|
|
236
|
+
.option('--mode <mode>', 'view or edit (cli-surface §2.4; the generated URL is the same)', 'view')
|
|
237
|
+
.option('-o, --output <path>', 'output path of the viewer HTML (.html only; when given, no URL is printed to stdout)')
|
|
238
|
+
.option('--json', 'print machine-readable JSON to stdout', false)
|
|
239
|
+
.option('--theme <spec>', 'theme used to check fonts and font sizes (git+https://<host>/<owner>/<repo>.git#<tag>, file:<path>, or a talk-dir or theme root path); default: the diagram\'s ancestor talk-dir, else the plugin default')
|
|
240
|
+
.option('--no-png', 'do not write the PNG alongside -o (default: write the PNG)', true)
|
|
241
241
|
.exitOverride()
|
|
242
242
|
.configureOutput({
|
|
243
243
|
writeErr: (string_) => {
|
|
@@ -308,7 +308,7 @@ export function drawioUrlDefaultDependencies() {
|
|
|
308
308
|
const pluginRoot = process.env['CLAUDE_PLUGIN_ROOT'];
|
|
309
309
|
/* c8 ignore next 3 -- bin/pecotv が CLAUDE_PLUGIN_ROOT を必ず export する。未設定は実運用で発生しない */
|
|
310
310
|
if (pluginRoot === undefined || pluginRoot === '') {
|
|
311
|
-
throw new DrawioUrlRuntimeError('CLAUDE_PLUGIN_ROOT
|
|
311
|
+
throw new DrawioUrlRuntimeError('CLAUDE_PLUGIN_ROOT is not set', 'unknown');
|
|
312
312
|
}
|
|
313
313
|
const dependencyRoot = pluginDependencyRoot();
|
|
314
314
|
return {
|
|
@@ -53,18 +53,18 @@ dependencies) {
|
|
|
53
53
|
text = await dependencies.readFile(inputPath);
|
|
54
54
|
}
|
|
55
55
|
catch (error) {
|
|
56
|
-
throw new EvidenceCreateError(`spec JSON
|
|
56
|
+
throw new EvidenceCreateError(`cannot read spec JSON: ${inputPath}: ${formatError(error)}`, 'input-not-found');
|
|
57
57
|
}
|
|
58
58
|
let raw;
|
|
59
59
|
try {
|
|
60
60
|
raw = JSON.parse(text);
|
|
61
61
|
}
|
|
62
62
|
catch (error) {
|
|
63
|
-
throw new EvidenceCreateError(`spec JSON
|
|
63
|
+
throw new EvidenceCreateError(`cannot parse spec JSON: ${inputPath}: ${formatError(error)}`, 'invalid-json');
|
|
64
64
|
}
|
|
65
65
|
const parsed = parseEvidenceSpec(raw);
|
|
66
66
|
if (!parsed.ok) {
|
|
67
|
-
throw new EvidenceCreateError(`spec
|
|
67
|
+
throw new EvidenceCreateError(`spec validation failed (${parsed.errors.length.toString()} errors)\n${formatSpecErrors(parsed.errors)}`, 'invalid-spec');
|
|
68
68
|
}
|
|
69
69
|
// 文面は、caption を補う前の spec から取る。xlsx を書く前に全件を確認する
|
|
70
70
|
await assertTextsClean(parsed.written, dependencies.lintText);
|
|
@@ -80,7 +80,7 @@ async function assertTextsClean(spec, lintText) {
|
|
|
80
80
|
violations = await collectTextViolations(specTexts(spec), lintText);
|
|
81
81
|
}
|
|
82
82
|
catch (error) {
|
|
83
|
-
throw new EvidenceCreateError(
|
|
83
|
+
throw new EvidenceCreateError(`text rules check failed: ${formatError(error)}`, 'text-lint-failed');
|
|
84
84
|
}
|
|
85
85
|
if (violations.length > 0) {
|
|
86
86
|
throw new EvidenceCreateError(formatTextViolations(violations), 'text-violation', violations);
|
|
@@ -104,10 +104,10 @@ dependencies) {
|
|
|
104
104
|
}
|
|
105
105
|
export function createEvidenceCreateCommand(buildDependencies) {
|
|
106
106
|
return new Command('create')
|
|
107
|
-
.description('
|
|
108
|
-
.requiredOption('--input <path>', 'EvidenceSpec JSON
|
|
109
|
-
.option('--out <path>', '
|
|
110
|
-
.option('--json', 'machine-readable
|
|
107
|
+
.description('generate a work-evidence xlsx from an EvidenceSpec JSON')
|
|
108
|
+
.requiredOption('--input <path>', 'EvidenceSpec JSON path')
|
|
109
|
+
.option('--out <path>', 'output xlsx path (an existing file is overwritten)', DEFAULT_OUT)
|
|
110
|
+
.option('--json', 'print machine-readable JSON to stdout', false)
|
|
111
111
|
.exitOverride()
|
|
112
112
|
.configureOutput({
|
|
113
113
|
writeErr: (string_) => {
|
|
@@ -165,12 +165,12 @@ export function evidenceCreateDefaultDependencies() {
|
|
|
165
165
|
function writeHumanSummary(
|
|
166
166
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types -- write は mutate メソッド
|
|
167
167
|
stdout, data) {
|
|
168
|
-
writeData(stdout,
|
|
169
|
-
writeData(stdout,
|
|
168
|
+
writeData(stdout, `created: ${data.outPath}`);
|
|
169
|
+
writeData(stdout, `items: ${data.items.toString()} / annotations: ${data.annotations.toString()}`);
|
|
170
170
|
if (data.skipped.length === 0) {
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
173
|
-
writeData(stdout,
|
|
173
|
+
writeData(stdout, `skipped: ${data.skipped.length.toString()}`);
|
|
174
174
|
for (const entry of data.skipped) {
|
|
175
175
|
writeData(stdout, ` - ${entry.path} (${entry.reason})`);
|
|
176
176
|
}
|
|
@@ -126,7 +126,7 @@ async function sha256Of(filePath) {
|
|
|
126
126
|
return createHash('sha256').update(buffer).digest('hex');
|
|
127
127
|
}
|
|
128
128
|
function inputOpenFailure(inputAbs, error) {
|
|
129
|
-
return new PreviewRuntimeError(`input PPTX
|
|
129
|
+
return new PreviewRuntimeError(`cannot open input PPTX: ${inputAbs}: ${formatError(error)}`, 'input-open-failed');
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
132
|
入力 PPTX の sha256。入力が無い・読めない場合は input-open-failed に倒す。
|
|
@@ -168,7 +168,7 @@ dependencies) {
|
|
|
168
168
|
const detectAfterSha = await sha256Of(inputAbs);
|
|
169
169
|
/* c8 ignore next 6 -- detect-only は read-only 設計のため sha 変化ルートは到達不能。Acceptance 3 の防御網 */
|
|
170
170
|
if (detectAfterSha !== detectInputSha) {
|
|
171
|
-
throw new PreviewRuntimeError(
|
|
171
|
+
throw new PreviewRuntimeError(`input PPTX changed (sha256 mismatch): ${inputAbs}`, 'input-mutated');
|
|
172
172
|
}
|
|
173
173
|
const summary = {
|
|
174
174
|
inputAbs,
|
|
@@ -201,7 +201,7 @@ dependencies) {
|
|
|
201
201
|
const afterSha = await sha256Of(inputAbs);
|
|
202
202
|
/* c8 ignore next 6 -- 入力は read-only 設計のため sha 変化ルートは到達不能。Acceptance 3 の防御網 */
|
|
203
203
|
if (afterSha !== inputSha) {
|
|
204
|
-
throw new PreviewRuntimeError(
|
|
204
|
+
throw new PreviewRuntimeError(`input PPTX changed (sha256 mismatch): ${inputAbs}`, 'input-mutated');
|
|
205
205
|
}
|
|
206
206
|
const summary = {
|
|
207
207
|
inputAbs,
|
|
@@ -231,14 +231,14 @@ dependencies) {
|
|
|
231
231
|
}
|
|
232
232
|
catch (error) {
|
|
233
233
|
if (error instanceof SofficeTimeoutError) {
|
|
234
|
-
throw new PreviewRuntimeError(`soffice
|
|
234
|
+
throw new PreviewRuntimeError(`soffice PDF conversion timed out after ${String(error.timeoutMs)}ms`, 'soffice-timeout');
|
|
235
235
|
}
|
|
236
236
|
if (error instanceof SofficeSpawnError) {
|
|
237
|
-
throw new PreviewRuntimeError(`soffice (LibreOffice)
|
|
238
|
-
+
|
|
237
|
+
throw new PreviewRuntimeError(`soffice (LibreOffice) is not installed; run 'sudo apt-get install -y libreoffice-impress'`
|
|
238
|
+
+ `: ${error.stderr}`, 'soffice-not-found');
|
|
239
239
|
}
|
|
240
240
|
/* c8 ignore next 5 -- PdfConverter は SofficeSpawnError / SofficeTimeoutError 以外を投げない契約。防御網 */
|
|
241
|
-
throw new PreviewRuntimeError(`PDF
|
|
241
|
+
throw new PreviewRuntimeError(`PDF conversion failed: ${formatError(error)}`, 'soffice-conversion-failed');
|
|
242
242
|
}
|
|
243
243
|
// soffice は変換失敗でも exit 0 を返すため、PDF の実在・非空を必須条件とする。
|
|
244
244
|
// soffice 本体 (libreoffice-core) だけが入った環境では PPTX を load できず、
|
|
@@ -246,8 +246,8 @@ dependencies) {
|
|
|
246
246
|
// ここに置かないと利用者に届かない。
|
|
247
247
|
const pdfSize = await pdfFileSize(result.pdfPath);
|
|
248
248
|
if (pdfSize === 0) {
|
|
249
|
-
throw new PreviewRuntimeError(`soffice
|
|
250
|
-
+
|
|
249
|
+
throw new PreviewRuntimeError(`soffice did not produce a PDF (output PDF missing or empty): ${result.pdfPath}`
|
|
250
|
+
+ `; PPTX conversion requires libreoffice-impress`
|
|
251
251
|
+ ` ('sudo apt-get install -y libreoffice-impress')`, 'soffice-conversion-failed');
|
|
252
252
|
}
|
|
253
253
|
return result.pdfPath;
|
|
@@ -315,19 +315,19 @@ export function errorToReason(error) {
|
|
|
315
315
|
function formatFindingLine(finding) {
|
|
316
316
|
const shape = finding.shapeName === undefined ? '(unnamed)' : `"${finding.shapeName}"`;
|
|
317
317
|
return `slide ${String(finding.slide)}: shape ${shape}`
|
|
318
|
-
+ ` — spAutoFit + wrap=none (LibreOffice
|
|
318
|
+
+ ` — spAutoFit + wrap=none (known LibreOffice centered-rendering difference)`;
|
|
319
319
|
}
|
|
320
320
|
function doesArgvWantJson(argv) {
|
|
321
321
|
return argv.includes('--json');
|
|
322
322
|
}
|
|
323
323
|
export function createPptxPreviewCommand(buildDependencies) {
|
|
324
324
|
const command = new Command('preview')
|
|
325
|
-
.description('
|
|
325
|
+
.description('generate a preview PDF of a PPTX, correcting LibreOffice rendering differences; the original PPTX is not modified')
|
|
326
326
|
.argument('<input>', 'input .pptx path')
|
|
327
|
-
.option('--out <path>', 'output .pdf path (
|
|
327
|
+
.option('--out <path>', 'output .pdf path (default: <input-dir>/<input-stem>.preview.pdf)')
|
|
328
328
|
.option('--json', 'emit machine-readable result on stdout', false)
|
|
329
329
|
.option('--report <path>', 'write findings JSON to <path>')
|
|
330
|
-
.option('--detect-only', 'soffice
|
|
330
|
+
.option('--detect-only', 'print only the detection report without calling soffice', false)
|
|
331
331
|
.exitOverride()
|
|
332
332
|
.configureOutput({
|
|
333
333
|
writeErr: (string_) => {
|
|
@@ -64,13 +64,13 @@ warnings) {
|
|
|
64
64
|
// 生成先には、取得の後まで触れない。生成先の存在と依存ルートの実体は、取得の前に確かめる。
|
|
65
65
|
const destination = await talkDirectoryExists(projectAbsolute);
|
|
66
66
|
if (!options.force && destination.exists) {
|
|
67
|
-
throw new SlideCreateUsageError(`
|
|
67
|
+
throw new SlideCreateUsageError(`destination already exists (use --force to overwrite): ${projectAbsolute}`, 'dest-exists');
|
|
68
68
|
}
|
|
69
69
|
const dependencyRoot = dependencies.dependencyRoot ?? dependencies.pluginRoot;
|
|
70
70
|
assertDependencyRootAvailable(dependencyRoot);
|
|
71
71
|
const storeRoot = (dependencies.themeStoreRoot ?? themeStoreRoot)();
|
|
72
72
|
if (storeRoot === undefined) {
|
|
73
|
-
throw new SlideCreateRuntimeError('
|
|
73
|
+
throw new SlideCreateRuntimeError('cannot determine the theme location (fix: check the data directory CLAUDE_PLUGIN_DATA)', 'theme-unknown');
|
|
74
74
|
}
|
|
75
75
|
const fetched = await (dependencies.fetchTheme ?? fetchTheme)(spec, {
|
|
76
76
|
storeRoot,
|
|
@@ -168,13 +168,13 @@ export function emitLayoutCatalog(catalog,
|
|
|
168
168
|
stdout) {
|
|
169
169
|
const { categories, layouts } = catalog;
|
|
170
170
|
writeData(stdout, '='.repeat(60));
|
|
171
|
-
writeData(stdout, 'Layout Catalog (Step 2
|
|
171
|
+
writeData(stdout, 'Layout Catalog (read it fully before plan mode in Step 2)');
|
|
172
172
|
writeData(stdout, `${'='.repeat(60)}\n\n`);
|
|
173
173
|
for (const category of categories) {
|
|
174
174
|
writeData(stdout, `--- ${category.label}: ${category.question} ---\n\n`);
|
|
175
175
|
const members = layouts.filter(entry => entry.category === category.id);
|
|
176
176
|
if (members.length === 0) {
|
|
177
|
-
writeData(stdout, '(
|
|
177
|
+
writeData(stdout, '(no matching layouts)\n\n');
|
|
178
178
|
continue;
|
|
179
179
|
}
|
|
180
180
|
for (const { layout, description, deprecated } of members) {
|
|
@@ -209,11 +209,11 @@ function doesArgvWantJson(argv) {
|
|
|
209
209
|
}
|
|
210
210
|
export function createSlideCreateCommand(buildDependencies) {
|
|
211
211
|
const command = new Command('create')
|
|
212
|
-
.description('
|
|
213
|
-
.argument('<project-dir>', '
|
|
214
|
-
.requiredOption('--theme <spec>', '
|
|
215
|
-
.option('--force', '
|
|
216
|
-
.option('--json', 'machine-readable
|
|
212
|
+
.description('create a Slidev presentation that references a theme')
|
|
213
|
+
.argument('<project-dir>', 'destination directory')
|
|
214
|
+
.requiredOption('--theme <spec>', 'theme spec (git+https://<host>/<owner>/<repo>.git#<tag> or file:<path>)')
|
|
215
|
+
.option('--force', 'overwrite an existing directory', false)
|
|
216
|
+
.option('--json', 'print machine-readable JSON to stdout', false)
|
|
217
217
|
.exitOverride()
|
|
218
218
|
.configureOutput({
|
|
219
219
|
writeErr: (string_) => {
|
|
@@ -242,7 +242,7 @@ export function createSlideCreateCommand(buildDependencies) {
|
|
|
242
242
|
const execution = await executeSlideCreate(projectDirectory, options, dependencies, (summary) => {
|
|
243
243
|
if (isWantsJson)
|
|
244
244
|
return;
|
|
245
|
-
writeData(dependencies.stdout, `slide create:
|
|
245
|
+
writeData(dependencies.stdout, `slide create: success (${summary.projectDirectory})`);
|
|
246
246
|
writeData(dependencies.stdout, ` theme=${summary.theme.name}, ${String(Math.round(summary.durationMs))}ms`);
|
|
247
247
|
});
|
|
248
248
|
if (isWantsJson) {
|
|
@@ -263,7 +263,7 @@ export function createSlideCreateCommand(buildDependencies) {
|
|
|
263
263
|
}));
|
|
264
264
|
}
|
|
265
265
|
else {
|
|
266
|
-
createDiagnostics(dependencies.stderr).error(`slide create
|
|
266
|
+
createDiagnostics(dependencies.stderr).error(`slide create failed: ${detail}`);
|
|
267
267
|
}
|
|
268
268
|
process.exitCode = toExitCode(error);
|
|
269
269
|
}
|
|
@@ -283,7 +283,7 @@ export function slideCreateDefaultDependencies() {
|
|
|
283
283
|
const pluginRoot = process.env['CLAUDE_PLUGIN_ROOT'];
|
|
284
284
|
/* c8 ignore next 3 -- bin/pecotv が CLAUDE_PLUGIN_ROOT を必ず export するため未設定ルートは実運用で発生しない */
|
|
285
285
|
if (pluginRoot === undefined || pluginRoot === '') {
|
|
286
|
-
throw new SlideCreateRuntimeError('CLAUDE_PLUGIN_ROOT
|
|
286
|
+
throw new SlideCreateRuntimeError('CLAUDE_PLUGIN_ROOT is not set', 'unknown');
|
|
287
287
|
}
|
|
288
288
|
const dependencyRoot = pluginDependencyRoot();
|
|
289
289
|
return {
|
|
@@ -75,7 +75,7 @@ dependencies, options = {}) {
|
|
|
75
75
|
return await unmanagedTheme(talkDirectory, dependencies.files, options);
|
|
76
76
|
const storeRoot = dependencies.storeRoot();
|
|
77
77
|
if (storeRoot === undefined) {
|
|
78
|
-
throw new ThemeFetchError('
|
|
78
|
+
throw new ThemeFetchError('cannot determine the theme location (fix: check the data directory CLAUDE_PLUGIN_DATA)', 'unknown');
|
|
79
79
|
}
|
|
80
80
|
const fetched = await dependencies.fetchTheme(spec, {
|
|
81
81
|
storeRoot,
|
|
@@ -85,15 +85,15 @@ dependencies, options = {}) {
|
|
|
85
85
|
signal: dependencies.signal,
|
|
86
86
|
});
|
|
87
87
|
if (fetched.name !== reference.name) {
|
|
88
|
-
throw new SlideCreateRuntimeError(`package.json
|
|
89
|
-
+ 'dependencies
|
|
88
|
+
throw new SlideCreateRuntimeError(`package.json dependencies lists ${reference.name} but the fetched theme name is ${fetched.name} `
|
|
89
|
+
+ '(fix: set the dependencies key to the theme name)', 'theme-name-mismatch');
|
|
90
90
|
}
|
|
91
91
|
// 張り直しが要らない普段の起動でも、生成ファイルは本体の今の内容にそろえる。
|
|
92
92
|
const regeneratedFiles = await dependencies.syncGeneratedFiles(talkDirectory, { themeName: fetched.name });
|
|
93
93
|
const isRegenerated = regeneratedFiles.length > 0;
|
|
94
94
|
if (isRegenerated) {
|
|
95
|
-
dependencies.warn?.(
|
|
96
|
-
+ '
|
|
95
|
+
dependencies.warn?.(`rewrote ${regeneratedFiles.join(', ')} to match the current plugin output; `
|
|
96
|
+
+ 'these files are generated, so manual edits are not kept (fix: put extra Vite settings in setup/vite-plugins.ts)');
|
|
97
97
|
}
|
|
98
98
|
const link = { name: fetched.name, directory: fetched.directory };
|
|
99
99
|
const theme = { ...link, spec: reference.spec };
|