@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
package/cli/dist/cli.js
CHANGED
|
@@ -11,7 +11,8 @@ import { createSlideLintCommand, slideLintDefaultDependencies, } from './command
|
|
|
11
11
|
import { createSlideThemeCommand, slideThemeDefaultDependencies, } from './commands/slidev-project/theme.js';
|
|
12
12
|
import { createSlideConvertCommand, slideConvertDefaultDependencies, } from './commands/slidev-to-pptx/convert.js';
|
|
13
13
|
import { createSlideSyncCommand, slideSyncDefaultDependencies, } from './commands/slidev-project/sync.js';
|
|
14
|
-
import {
|
|
14
|
+
import { createDiagnostics, writeData } from './diagnostics.js';
|
|
15
|
+
import { nodeRuntimeGuidance } from './node-runtime.js';
|
|
15
16
|
import { readVersion } from './version.js';
|
|
16
17
|
export function createProgram() {
|
|
17
18
|
const program = new Command();
|
|
@@ -20,26 +21,26 @@ export function createProgram() {
|
|
|
20
21
|
.command('hello')
|
|
21
22
|
.description('greet from TS runtime')
|
|
22
23
|
.action(() => {
|
|
23
|
-
process.stdout
|
|
24
|
+
writeData(process.stdout, 'hello from pecotv (ts)');
|
|
24
25
|
});
|
|
25
|
-
const pptx = new Command('pptx').description('PPTX
|
|
26
|
+
const pptx = new Command('pptx').description('operate on PPTX files');
|
|
26
27
|
pptx.addCommand(createPptxPreviewCommand(pptxPreviewDefaultDependencies));
|
|
27
28
|
program.addCommand(pptx);
|
|
28
|
-
const slide = new Command('slide').description('Slidev
|
|
29
|
+
const slide = new Command('slide').description('operate on Slidev projects');
|
|
29
30
|
slide.addCommand(createSlideCreateCommand(slideCreateDefaultDependencies));
|
|
30
31
|
slide.addCommand(createSlideConvertCommand(slideConvertDefaultDependencies));
|
|
31
32
|
slide.addCommand(createSlideSyncCommand(slideSyncDefaultDependencies));
|
|
32
33
|
slide.addCommand(createSlideLintCommand(slideLintDefaultDependencies));
|
|
33
34
|
slide.addCommand(createSlideThemeCommand(slideThemeDefaultDependencies));
|
|
34
35
|
program.addCommand(slide);
|
|
35
|
-
const drawio = new Command('drawio').description('drawio
|
|
36
|
+
const drawio = new Command('drawio').description('operate on drawio diagrams');
|
|
36
37
|
drawio.addCommand(createDrawioUrlCommand(drawioUrlDefaultDependencies));
|
|
37
38
|
drawio.addCommand(createDrawioExportCommand(drawioExportDefaultDependencies));
|
|
38
39
|
program.addCommand(drawio);
|
|
39
|
-
const chromiumCommand = new Command('chromium').description('Playwright Chromium
|
|
40
|
+
const chromiumCommand = new Command('chromium').description('operate on the Playwright Chromium runtime');
|
|
40
41
|
chromiumCommand.addCommand(createChromiumHostDependenciesCommand(hostDependenciesCommandDefaultDependencies));
|
|
41
42
|
program.addCommand(chromiumCommand);
|
|
42
|
-
const evidence = new Command('evidence').description('
|
|
43
|
+
const evidence = new Command('evidence').description('operate on evidence xlsx files');
|
|
43
44
|
evidence.addCommand(createEvidenceCreateCommand(evidenceCreateDefaultDependencies));
|
|
44
45
|
program.addCommand(evidence);
|
|
45
46
|
// mcp の実装は src/mcp/ に置く (ESLint zone: commands → mcp の import 禁止)。
|
|
@@ -48,7 +49,7 @@ export function createProgram() {
|
|
|
48
49
|
// (計測 約 60ms) 重くなるため。
|
|
49
50
|
const mcp = program
|
|
50
51
|
.command('mcp')
|
|
51
|
-
.description('MCP
|
|
52
|
+
.description('serve as an MCP server over stdio (stdin/stdout)');
|
|
52
53
|
/* c8 ignore start -- action は dynamic import して実 process.stdin/stdout へ接続する。
|
|
53
54
|
単体テストから起動すると vitest worker の stdout ごと差し替えてしまう。このルートは
|
|
54
55
|
tests/e2e/mcp-stdio.test.ts が実プロセスの spawn で担保する。 */
|
|
@@ -71,9 +72,9 @@ export function applyExitOverrideRecursively(command) {
|
|
|
71
72
|
applyExitOverrideRecursively(child);
|
|
72
73
|
}
|
|
73
74
|
export function main(nodeVersion = process.versions.node) {
|
|
74
|
-
const runtimeError =
|
|
75
|
+
const runtimeError = nodeRuntimeGuidance(nodeVersion);
|
|
75
76
|
if (runtimeError !== undefined) {
|
|
76
|
-
process.stderr.
|
|
77
|
+
createDiagnostics(process.stderr).error(runtimeError);
|
|
77
78
|
process.exitCode = 1;
|
|
78
79
|
return;
|
|
79
80
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
// 判定と導入の本体は infra/playwright/host-dependencies.ts。ここは結果を利用者向けの文言と
|
|
7
7
|
// exit code に写すだけにする。
|
|
8
8
|
import { Command } from 'commander';
|
|
9
|
+
import { createDiagnostics } from '../../diagnostics.js';
|
|
9
10
|
import { ensureChromiumHostDependencies, hostDependenciesDefaultDependencies, } from '../../infra/playwright/host-dependencies.js';
|
|
10
11
|
/**
|
|
11
12
|
OS のライブラリが足りず、入れられなかったときの exit code。
|
|
@@ -26,15 +27,16 @@ export function hostDependenciesCommandDefaultDependencies() {
|
|
|
26
27
|
}
|
|
27
28
|
export function createChromiumHostDependenciesCommand(buildDependencies) {
|
|
28
29
|
return new Command('host-deps')
|
|
29
|
-
.description('
|
|
30
|
-
.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)')
|
|
31
32
|
.action(async (options) => {
|
|
32
33
|
const dependencies = buildDependencies();
|
|
34
|
+
const diagnostics = createDiagnostics(dependencies.stderr);
|
|
33
35
|
// apt-get は数分かかり得るため、始める前に何を入れるかを stderr に出す。
|
|
34
36
|
const hostDependencies = {
|
|
35
37
|
...dependencies.hostDeps(),
|
|
36
38
|
notify: (message) => {
|
|
37
|
-
|
|
39
|
+
diagnostics.note(message);
|
|
38
40
|
},
|
|
39
41
|
};
|
|
40
42
|
const outcome = await ensureChromiumHostDependencies(hostDependencies);
|
|
@@ -44,12 +46,12 @@ export function createChromiumHostDependenciesCommand(buildDependencies) {
|
|
|
44
46
|
return;
|
|
45
47
|
}
|
|
46
48
|
case 'installed': {
|
|
47
|
-
|
|
49
|
+
diagnostics.done({ verb: 'add', target: outcome.packages.join(' ') });
|
|
48
50
|
hostDependencies.record('ok');
|
|
49
51
|
return;
|
|
50
52
|
}
|
|
51
53
|
case 'missing': {
|
|
52
|
-
|
|
54
|
+
diagnostics.error(outcome.detail);
|
|
53
55
|
hostDependencies.record('missing');
|
|
54
56
|
dependencies.setExitCode(HOST_DEPS_MISSING_EXIT_CODE);
|
|
55
57
|
return;
|
|
@@ -57,9 +59,14 @@ export function createChromiumHostDependenciesCommand(buildDependencies) {
|
|
|
57
59
|
case 'launch-failed': {
|
|
58
60
|
// 実行ファイル未取得等。取得は bin/pecotv の別の段が担うため、記録だけして通す。
|
|
59
61
|
hostDependencies.record('launch-failed');
|
|
60
|
-
|
|
61
|
-
if (options.requireLaunch === true)
|
|
62
|
+
const message = `Chromium failed to launch (cause other than OS libraries): ${outcome.detail}`;
|
|
63
|
+
if (options.requireLaunch === true) {
|
|
64
|
+
diagnostics.error(message);
|
|
62
65
|
dependencies.setExitCode(LAUNCH_FAILED_EXIT_CODE);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
diagnostics.warning(message);
|
|
69
|
+
}
|
|
63
70
|
return;
|
|
64
71
|
}
|
|
65
72
|
}
|
|
@@ -24,6 +24,7 @@ import { mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
|
24
24
|
import path from 'node:path';
|
|
25
25
|
import { Command } from 'commander';
|
|
26
26
|
import { collectIconReferences, computeSourceHash, embedSourceHash, forceLightColorScheme, resolveIconsForExport, siblingPath } from '../../domain/drawio/export.js';
|
|
27
|
+
import { createDiagnostics, passthrough, writeData } from '../../diagnostics.js';
|
|
27
28
|
import { createIconResolver } from '../../infra/drawio/icons.js';
|
|
28
29
|
import { exportPdf } from '../../infra/drawio/pdf.js';
|
|
29
30
|
import { exportViaEmbed } from '../../infra/drawio/screenshot.js';
|
|
@@ -66,7 +67,7 @@ PDF 同時出力時は兄弟 PDF が SVG 自身を上書きし、`--no-pdf` 時
|
|
|
66
67
|
export function assertOutputExtension(output, options) {
|
|
67
68
|
if (output === undefined || output === '' || options.printHash || (path.extname(output).toLowerCase() !== PDF_EXTENSION))
|
|
68
69
|
return;
|
|
69
|
-
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');
|
|
70
71
|
}
|
|
71
72
|
export async function runDrawioExport(inputFile, options,
|
|
72
73
|
// DI 経由の write は mutate メソッド。
|
|
@@ -86,7 +87,7 @@ dependencies) {
|
|
|
86
87
|
xml = await dependencies.readFile(absoluteInput);
|
|
87
88
|
}
|
|
88
89
|
catch (error) {
|
|
89
|
-
throw new DrawioExportRuntimeError(
|
|
90
|
+
throw new DrawioExportRuntimeError(`cannot read input file: ${absoluteInput}: ${formatError(error)}`, 'input-not-found');
|
|
90
91
|
}
|
|
91
92
|
const iconRoot = path.resolve(options.icons);
|
|
92
93
|
const resolveIcon = createIconResolver(iconRoot);
|
|
@@ -108,21 +109,21 @@ dependencies) {
|
|
|
108
109
|
}
|
|
109
110
|
const resolved = resolveIconsForExport(xml, resolveIcon);
|
|
110
111
|
if (resolved.unresolved.length > 0) {
|
|
111
|
-
throw new DrawioExportRuntimeError(`icon://
|
|
112
|
+
throw new DrawioExportRuntimeError(`cannot resolve icon:// references (icons root: ${iconRoot}): ${resolved.unresolved.join(', ')}`, 'icon-unresolved');
|
|
112
113
|
}
|
|
113
114
|
let svg;
|
|
114
115
|
try {
|
|
115
116
|
svg = await dependencies.exportSvg(resolved.xml);
|
|
116
117
|
}
|
|
117
118
|
catch (error) {
|
|
118
|
-
throw new DrawioExportRuntimeError(`SVG export
|
|
119
|
+
throw new DrawioExportRuntimeError(`SVG export failed: ${formatError(error)}`, 'export-failed');
|
|
119
120
|
}
|
|
120
121
|
const baked = embedSourceHash(forceLightColorScheme(svg), sourceSha256);
|
|
121
122
|
try {
|
|
122
123
|
await dependencies.writeFile(absoluteOutput, baked);
|
|
123
124
|
}
|
|
124
125
|
catch (error) {
|
|
125
|
-
throw new DrawioExportRuntimeError(
|
|
126
|
+
throw new DrawioExportRuntimeError(`cannot write output file: ${absoluteOutput}: ${formatError(error)}`, 'output-write-failed');
|
|
126
127
|
}
|
|
127
128
|
const pdfResult = options.pdf
|
|
128
129
|
? await writeSiblingPdf(baked, pdfPath, dependencies)
|
|
@@ -151,7 +152,7 @@ dependencies) {
|
|
|
151
152
|
return { pdfFile: pdfPath, pdfFailed: false };
|
|
152
153
|
}
|
|
153
154
|
catch (error) {
|
|
154
|
-
dependencies.stderr.
|
|
155
|
+
createDiagnostics(dependencies.stderr).warning(`PDF export failed: ${formatError(error)}`);
|
|
155
156
|
// 古い PDF の削除失敗は独立した警告として数えない。今回の PDF 失敗 1 件(pdfFailed /
|
|
156
157
|
// warnings: 1 / exit 3)に集約し、JSON と exit code には出さず stderr の行だけで知らせる。
|
|
157
158
|
// 呼び出し側は `pdf: null` を見て隣の PDF を今回の出力として扱わない前提にする。
|
|
@@ -159,7 +160,7 @@ dependencies) {
|
|
|
159
160
|
await dependencies.removeFile(pdfPath);
|
|
160
161
|
}
|
|
161
162
|
catch (removeError) {
|
|
162
|
-
dependencies.stderr.
|
|
163
|
+
createDiagnostics(dependencies.stderr).warning(`cannot remove the previous PDF: ${pdfPath}: ${formatError(removeError)}`);
|
|
163
164
|
}
|
|
164
165
|
return { pdfFile: undefined, pdfFailed: true };
|
|
165
166
|
}
|
|
@@ -238,37 +239,38 @@ function doesArgvWantJson(argv) {
|
|
|
238
239
|
function parseIcons(raw) {
|
|
239
240
|
const value = String(raw);
|
|
240
241
|
if (value === '') {
|
|
241
|
-
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');
|
|
242
243
|
}
|
|
243
244
|
return value;
|
|
244
245
|
}
|
|
245
246
|
export function createDrawioExportCommand(buildDependencies) {
|
|
246
247
|
const command = new Command('export')
|
|
247
|
-
.description('drawio XML
|
|
248
|
-
.argument('<input>', '
|
|
248
|
+
.description('export drawio XML to a static SVG and a sibling PDF')
|
|
249
|
+
.argument('<input>', 'input .drawio file path')
|
|
249
250
|
// CLI 側は required に据え置く(既定を持つのは MCP の drawio_export だけ)。
|
|
250
251
|
// 呼び出し側が talk-dir 相対の public/assets/icons など、解決の root を明示して渡す。
|
|
251
252
|
// プラグイン同梱カタログを既定にすると、誤った root で通知なしに解決されうる。
|
|
252
|
-
.requiredOption('--icons <dir>', '
|
|
253
|
-
.option('-o, --output <path>',
|
|
254
|
-
.option('--no-pdf', '
|
|
255
|
-
.option('--print-hash', '
|
|
256
|
-
.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)
|
|
257
258
|
.exitOverride()
|
|
258
259
|
.configureOutput({
|
|
259
260
|
writeErr: (string_) => {
|
|
260
261
|
const dependencies = buildDependencies();
|
|
261
262
|
if (doesArgvWantJson(process.argv)) {
|
|
262
|
-
dependencies.stdout
|
|
263
|
+
writeData(dependencies.stdout, JSON.stringify({
|
|
263
264
|
event: 'drawio.export.error',
|
|
264
265
|
reason: 'invalid-option',
|
|
265
266
|
detail: string_.replace(/^error:[ \t]*/i, '').trim(),
|
|
266
|
-
})
|
|
267
|
+
}));
|
|
267
268
|
}
|
|
268
269
|
else {
|
|
269
|
-
dependencies.stderr
|
|
270
|
+
passthrough(dependencies.stderr, string_);
|
|
270
271
|
}
|
|
271
272
|
},
|
|
273
|
+
writeOut: (string_) => { writeData(buildDependencies().stdout, string_); },
|
|
272
274
|
})
|
|
273
275
|
.action(async (input, raw) => {
|
|
274
276
|
const dependencies = buildDependencies();
|
|
@@ -290,17 +292,18 @@ export function createDrawioExportCommand(buildDependencies) {
|
|
|
290
292
|
try {
|
|
291
293
|
const execution = await executeDrawioExport(input, options, dependencies);
|
|
292
294
|
if (isJson) {
|
|
293
|
-
dependencies.stdout
|
|
295
|
+
writeData(dependencies.stdout, JSON.stringify(execution.data));
|
|
294
296
|
}
|
|
295
297
|
else if (execution.outputFile === undefined) {
|
|
296
298
|
// 呼び出し側(公開フック)が値をそのまま変数に取れるよう、素の出力は
|
|
297
299
|
// ハッシュ 1 行だけにする。
|
|
298
|
-
dependencies.stdout
|
|
300
|
+
writeData(dependencies.stdout, execution.sourceSha256);
|
|
299
301
|
}
|
|
300
302
|
else {
|
|
301
|
-
|
|
303
|
+
const diagnostics = createDiagnostics(dependencies.stderr);
|
|
304
|
+
diagnostics.done({ verb: 'create', target: execution.outputFile });
|
|
302
305
|
if (execution.pdfFile !== undefined) {
|
|
303
|
-
|
|
306
|
+
diagnostics.done({ verb: 'create', target: execution.pdfFile });
|
|
304
307
|
}
|
|
305
308
|
}
|
|
306
309
|
if (execution.exitCode !== 0) {
|
|
@@ -319,10 +322,10 @@ function writeFailure(
|
|
|
319
322
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
320
323
|
dependencies, isJson, reason, detail) {
|
|
321
324
|
if (isJson) {
|
|
322
|
-
dependencies.stdout
|
|
325
|
+
writeData(dependencies.stdout, JSON.stringify({ event: 'drawio.export.error', reason, detail }));
|
|
323
326
|
}
|
|
324
327
|
else {
|
|
325
|
-
dependencies.stderr.
|
|
328
|
+
createDiagnostics(dependencies.stderr).error(detail);
|
|
326
329
|
}
|
|
327
330
|
}
|
|
328
331
|
export function drawioExportDefaultDependencies() {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// - talk-dir: 祖先 D が slides.md を持ち、図が D/public/ の下にあるときだけ。
|
|
8
8
|
// 書体は常に確かめる。5 段のサイズは、talk-dir の中か `--theme` 指定のときだけ確かめる。
|
|
9
9
|
// 移行前の talk-dir(theme-none)は既定値で続ける。解けないテーマ(theme-unlinked・取得や宣言の失敗)は止める。
|
|
10
|
-
// 宣言の欠落や schema の違いの警告は、図の作者には直せない。
|
|
10
|
+
// 宣言の欠落や schema の違いの警告は、図の作者には直せない。note で出し、exit 3 の件数に数えない。
|
|
11
11
|
import path from 'node:path';
|
|
12
12
|
import { isRecord } from '../../domain/_shared/json.js';
|
|
13
13
|
import { THEME_DECLARATION_FILE_NAME, readThemeDeclaration } from '../../domain/slidev-theme/declaration.js';
|
|
@@ -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;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// 0 = success (warnings なし)。
|
|
6
6
|
// 1 = RuntimeError (input/output IO failure、文面の違反、文章規則の判定の失敗、解けないテーマ)。
|
|
7
7
|
// 2 = UsageError (invalid option / -o の拡張子が .html でない / テーマの指定の誤り)。
|
|
8
|
-
// 3 = warnings present (validateHtml
|
|
8
|
+
// 3 = warnings present (validateHtml の warning or icon resolver warn が 1 件以上)。
|
|
9
9
|
/* eslint-disable security/detect-non-literal-fs-filename -- input は CLI 引数として受理する想定。信頼境界外だが open API 仕様 */
|
|
10
10
|
import { performance } from 'node:perf_hooks';
|
|
11
11
|
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
@@ -21,6 +21,7 @@ import { pluginDependencyRoot } from '../../infra/_shared/dependency-root.js';
|
|
|
21
21
|
import { createIconResolver, defaultIconRoot } from '../../infra/drawio/icons.js';
|
|
22
22
|
import { capturePng } from '../../infra/drawio/screenshot.js';
|
|
23
23
|
import { defaultLintText } from '../../infra/text-lint.js';
|
|
24
|
+
import { createDiagnostics, passthrough, writeData } from '../../diagnostics.js';
|
|
24
25
|
import { DrawioUrlRuntimeError, DrawioUrlUsageError } from './errors.js';
|
|
25
26
|
import { resolveDrawioTheme, themeData, themeFontNames } from './theme.js';
|
|
26
27
|
export { DrawioUrlRuntimeError, DrawioUrlUsageError } from './errors.js';
|
|
@@ -29,22 +30,23 @@ export async function runDrawioUrl(inputFile, options,
|
|
|
29
30
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types -- write は可変。DI 経由の write は mutate メソッド
|
|
30
31
|
dependencies) {
|
|
31
32
|
const start = dependencies.now();
|
|
33
|
+
const diagnostics = createDiagnostics(dependencies.stderr);
|
|
32
34
|
const absolute = path.resolve(inputFile);
|
|
33
35
|
let xml;
|
|
34
36
|
try {
|
|
35
37
|
xml = await dependencies.readFile(absolute);
|
|
36
38
|
}
|
|
37
39
|
catch (error) {
|
|
38
|
-
throw new DrawioUrlRuntimeError(
|
|
40
|
+
throw new DrawioUrlRuntimeError(`cannot read input file: ${absolute}: ${formatError(error)}`, 'input-not-found');
|
|
39
41
|
}
|
|
40
42
|
const trimmed = xml.trim();
|
|
41
43
|
// 書体・文字サイズを確かめる宣言を決める。解けないテーマは、成果物を作る前にここで止める。
|
|
42
|
-
const theme = await resolveDrawioTheme(absolute, options.theme, dependencies, (message) => {
|
|
44
|
+
const theme = await resolveDrawioTheme(absolute, options.theme, dependencies, (message) => { diagnostics.note(message); });
|
|
43
45
|
// 文面の違反があれば、警告の確認や成果物の生成より前に止める
|
|
44
46
|
await assertLabelsClean(trimmed, dependencies.lintText);
|
|
45
47
|
let warningCount = 0;
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
+
// 診断のうち、exit code に反映するのは warning だけ。
|
|
49
|
+
// note (fontColor 二重指定など) は stderr に流すが、exit code には影響させない。
|
|
48
50
|
// 書体は常に確かめる。5 段のサイズは、テーマが決まったとき(talk-dir の中か --theme 指定)だけ確かめる。
|
|
49
51
|
const { fontSizes } = theme;
|
|
50
52
|
const validators = [
|
|
@@ -54,10 +56,14 @@ dependencies) {
|
|
|
54
56
|
...(fontSizes === undefined ? [] : [(value) => validateSlideFontSizes(value, fontSizes)]),
|
|
55
57
|
];
|
|
56
58
|
for (const validate of validators) {
|
|
57
|
-
for (const
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
for (const finding of validate(trimmed)) {
|
|
60
|
+
if (finding.severity === 'warning') {
|
|
61
|
+
diagnostics.warning(finding.message);
|
|
60
62
|
warningCount += 1;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
diagnostics.note(finding.message);
|
|
66
|
+
}
|
|
61
67
|
}
|
|
62
68
|
}
|
|
63
69
|
// pluginRoot は env 必須の deps のまま据え置く。
|
|
@@ -74,7 +80,7 @@ dependencies) {
|
|
|
74
80
|
if (reportedIconWarnings.has(message))
|
|
75
81
|
return;
|
|
76
82
|
reportedIconWarnings.add(message);
|
|
77
|
-
|
|
83
|
+
diagnostics.warning(message);
|
|
78
84
|
warningCount += 1;
|
|
79
85
|
},
|
|
80
86
|
});
|
|
@@ -102,7 +108,7 @@ async function assertLabelsClean(xml, lintText) {
|
|
|
102
108
|
violations = await collectTextViolations(labelTexts(xml), lintText);
|
|
103
109
|
}
|
|
104
110
|
catch (error) {
|
|
105
|
-
throw new DrawioUrlRuntimeError(
|
|
111
|
+
throw new DrawioUrlRuntimeError(`text rules check failed: ${formatError(error)}`, 'text-lint-failed');
|
|
106
112
|
}
|
|
107
113
|
if (violations.length > 0) {
|
|
108
114
|
throw new DrawioUrlRuntimeError(formatTextViolations(violations), 'text-violation', violations);
|
|
@@ -123,9 +129,10 @@ dependencies) {
|
|
|
123
129
|
// 書き出すのは表示用 HTML だけなので、それ以外の拡張子は成果物を作る前に弾く。
|
|
124
130
|
// 入力の読み込みより先に確認し、UsageError のときは成果物と警告を残さない。
|
|
125
131
|
if (outputFile !== undefined && path.extname(outputFile).toLowerCase() !== '.html') {
|
|
126
|
-
throw new DrawioUrlUsageError(`-o
|
|
132
|
+
throw new DrawioUrlUsageError(`-o accepts only the .html extension: ${outputFile}`, 'invalid-output-extension');
|
|
127
133
|
}
|
|
128
134
|
const summary = await runDrawioUrl(inputFile, options, dependencies);
|
|
135
|
+
const diagnostics = createDiagnostics(dependencies.stderr);
|
|
129
136
|
let warningCount = summary.warningCount;
|
|
130
137
|
const artifacts = [];
|
|
131
138
|
let payload;
|
|
@@ -138,7 +145,7 @@ dependencies) {
|
|
|
138
145
|
await dependencies.writeFile(outputFile, renderRedirectHtml(summary.url));
|
|
139
146
|
}
|
|
140
147
|
catch (error) {
|
|
141
|
-
throw new DrawioUrlRuntimeError(
|
|
148
|
+
throw new DrawioUrlRuntimeError(`cannot write output file: ${outputFile}: ${formatError(error)}`, 'output-write-failed');
|
|
142
149
|
}
|
|
143
150
|
artifacts.push(outputFile);
|
|
144
151
|
if (options.png) {
|
|
@@ -150,7 +157,7 @@ dependencies) {
|
|
|
150
157
|
artifacts.push(pngPath);
|
|
151
158
|
}
|
|
152
159
|
catch (error) {
|
|
153
|
-
|
|
160
|
+
diagnostics.warning(`PNG export failed: ${formatError(error)}`);
|
|
154
161
|
warningCount += 1;
|
|
155
162
|
isPngFailed = true;
|
|
156
163
|
}
|
|
@@ -218,34 +225,35 @@ function doesArgvWantJson(argv) {
|
|
|
218
225
|
}
|
|
219
226
|
function parseMode(raw) {
|
|
220
227
|
if (typeof raw !== 'string' || !VALID_MODES.has(raw)) {
|
|
221
|
-
throw new DrawioUrlUsageError(`option --mode
|
|
228
|
+
throw new DrawioUrlUsageError(`option --mode accepts only view or edit: ${String(raw)}`, 'invalid-mode');
|
|
222
229
|
}
|
|
223
230
|
return raw === 'edit' ? 'edit' : 'view';
|
|
224
231
|
}
|
|
225
232
|
export function createDrawioUrlCommand(buildDependencies) {
|
|
226
233
|
const command = new Command('url')
|
|
227
|
-
.description('drawio XML
|
|
228
|
-
.argument('<input>', '
|
|
229
|
-
.option('--mode <mode>', 'view
|
|
230
|
-
.option('-o, --output <path>', '
|
|
231
|
-
.option('--json', 'machine-readable
|
|
232
|
-
.option('--theme <spec>', '
|
|
233
|
-
.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)
|
|
234
241
|
.exitOverride()
|
|
235
242
|
.configureOutput({
|
|
236
243
|
writeErr: (string_) => {
|
|
237
244
|
const dependencies = buildDependencies();
|
|
238
245
|
if (doesArgvWantJson(process.argv)) {
|
|
239
|
-
dependencies.stdout
|
|
246
|
+
writeData(dependencies.stdout, JSON.stringify({
|
|
240
247
|
event: 'drawio.url.error',
|
|
241
248
|
reason: 'invalid-option',
|
|
242
249
|
detail: string_.replace(/^error:[ \t]*/i, '').trim(),
|
|
243
|
-
})
|
|
250
|
+
}));
|
|
244
251
|
}
|
|
245
252
|
else {
|
|
246
|
-
dependencies.stderr
|
|
253
|
+
passthrough(dependencies.stderr, string_);
|
|
247
254
|
}
|
|
248
255
|
},
|
|
256
|
+
writeOut: (string_) => { writeData(buildDependencies().stdout, string_); },
|
|
249
257
|
})
|
|
250
258
|
.action(async (input, raw) => {
|
|
251
259
|
const dependencies = buildDependencies();
|
|
@@ -261,10 +269,10 @@ export function createDrawioUrlCommand(buildDependencies) {
|
|
|
261
269
|
}
|
|
262
270
|
catch (error) {
|
|
263
271
|
if (raw['json'] === true) {
|
|
264
|
-
dependencies.stdout
|
|
272
|
+
writeData(dependencies.stdout, JSON.stringify(errorData(error)));
|
|
265
273
|
}
|
|
266
274
|
else {
|
|
267
|
-
dependencies.stderr.
|
|
275
|
+
createDiagnostics(dependencies.stderr).error(formatError(error));
|
|
268
276
|
}
|
|
269
277
|
process.exitCode = 2;
|
|
270
278
|
return;
|
|
@@ -272,13 +280,13 @@ export function createDrawioUrlCommand(buildDependencies) {
|
|
|
272
280
|
try {
|
|
273
281
|
const execution = await executeDrawioUrl(input, options, dependencies);
|
|
274
282
|
if (options.json) {
|
|
275
|
-
dependencies.stdout
|
|
283
|
+
writeData(dependencies.stdout, JSON.stringify(execution.data));
|
|
276
284
|
}
|
|
277
285
|
else if (execution.outputFile === undefined) {
|
|
278
|
-
dependencies.stdout
|
|
286
|
+
writeData(dependencies.stdout, execution.url);
|
|
279
287
|
}
|
|
280
288
|
else {
|
|
281
|
-
dependencies.stderr.
|
|
289
|
+
createDiagnostics(dependencies.stderr).done({ verb: 'create', target: execution.outputFile });
|
|
282
290
|
}
|
|
283
291
|
if (execution.exitCode !== 0) {
|
|
284
292
|
process.exitCode = execution.exitCode;
|
|
@@ -286,10 +294,10 @@ export function createDrawioUrlCommand(buildDependencies) {
|
|
|
286
294
|
}
|
|
287
295
|
catch (error) {
|
|
288
296
|
if (options.json) {
|
|
289
|
-
dependencies.stdout
|
|
297
|
+
writeData(dependencies.stdout, JSON.stringify(errorData(error)));
|
|
290
298
|
}
|
|
291
299
|
else {
|
|
292
|
-
dependencies.stderr.
|
|
300
|
+
createDiagnostics(dependencies.stderr).error(formatError(error));
|
|
293
301
|
}
|
|
294
302
|
process.exitCode = toExitCode(error);
|
|
295
303
|
}
|
|
@@ -300,7 +308,7 @@ export function drawioUrlDefaultDependencies() {
|
|
|
300
308
|
const pluginRoot = process.env['CLAUDE_PLUGIN_ROOT'];
|
|
301
309
|
/* c8 ignore next 3 -- bin/pecotv が CLAUDE_PLUGIN_ROOT を必ず export する。未設定は実運用で発生しない */
|
|
302
310
|
if (pluginRoot === undefined || pluginRoot === '') {
|
|
303
|
-
throw new DrawioUrlRuntimeError('CLAUDE_PLUGIN_ROOT
|
|
311
|
+
throw new DrawioUrlRuntimeError('CLAUDE_PLUGIN_ROOT is not set', 'unknown');
|
|
304
312
|
}
|
|
305
313
|
const dependencyRoot = pluginDependencyRoot();
|
|
306
314
|
return {
|