@pecot/visual-mcp 3.1.1-dev.142 → 3.1.1-dev.144

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.
Files changed (101) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/cli/dist/commands/drawio/export.d.ts +9 -24
  3. package/cli/dist/commands/drawio/export.js +15 -135
  4. package/cli/dist/commands/drawio/theme.d.ts +3 -3
  5. package/cli/dist/commands/drawio/theme.js +10 -10
  6. package/cli/dist/commands/drawio/url.d.ts +9 -26
  7. package/cli/dist/commands/drawio/url.js +18 -131
  8. package/cli/dist/commands/evidence-xlsx/create.d.ts +4 -12
  9. package/cli/dist/commands/evidence-xlsx/create.js +9 -92
  10. package/cli/dist/commands/slidev-project/create.d.ts +5 -30
  11. package/cli/dist/commands/slidev-project/create.js +12 -136
  12. package/cli/dist/commands/slidev-project/linked-theme.d.ts +1 -1
  13. package/cli/dist/commands/slidev-project/linked-theme.js +2 -2
  14. package/cli/dist/commands/slidev-project/lint.d.ts +8 -37
  15. package/cli/dist/commands/slidev-project/lint.js +16 -161
  16. package/cli/dist/commands/slidev-project/sync.d.ts +7 -26
  17. package/cli/dist/commands/slidev-project/sync.js +15 -156
  18. package/cli/dist/commands/slidev-project/theme.d.ts +2 -13
  19. package/cli/dist/commands/slidev-project/theme.js +3 -93
  20. package/cli/dist/commands/slidev-to-pptx/convert.d.ts +10 -17
  21. package/cli/dist/commands/slidev-to-pptx/convert.js +25 -266
  22. package/cli/dist/diagnostics.d.ts +0 -4
  23. package/cli/dist/diagnostics.js +0 -6
  24. package/cli/dist/domain/_shared/failure-kind.d.ts +2 -2
  25. package/cli/dist/domain/_shared/failure-kind.js +2 -2
  26. package/cli/dist/domain/_shared/ports.d.ts +3 -4
  27. package/cli/dist/domain/evidence-xlsx/image-dimensions.d.ts +1 -1
  28. package/cli/dist/domain/pptx-ooxml/preview-normalize.d.ts +0 -12
  29. package/cli/dist/domain/pptx-ooxml/preview-normalize.js +1 -25
  30. package/cli/dist/domain/slidev-project/errors.js +2 -2
  31. package/cli/dist/domain/slidev-project/generated-files.js +3 -3
  32. package/cli/dist/domain/slidev-project/lint.d.ts +7 -7
  33. package/cli/dist/domain/slidev-project/lint.js +8 -8
  34. package/cli/dist/domain/slidev-project/package-json.d.ts +1 -1
  35. package/cli/dist/domain/slidev-project/package-json.js +2 -2
  36. package/cli/dist/domain/slidev-project/sync.d.ts +11 -11
  37. package/cli/dist/domain/slidev-project/sync.js +18 -19
  38. package/cli/dist/domain/slidev-theme/deck-lint-input.js +1 -1
  39. package/cli/dist/domain/slidev-theme/declaration.js +1 -1
  40. package/cli/dist/domain/slidev-theme/skeleton.js +1 -1
  41. package/cli/dist/domain/slidev-theme/talk-theme.d.ts +3 -3
  42. package/cli/dist/domain/slidev-theme/talk-theme.js +5 -7
  43. package/cli/dist/domain/slidev-to-pptx/config.d.ts +1 -1
  44. package/cli/dist/domain/slidev-to-pptx/config.js +1 -1
  45. package/cli/dist/domain/slidev-to-pptx/errors.d.ts +4 -4
  46. package/cli/dist/domain/slidev-to-pptx/errors.js +4 -4
  47. package/cli/dist/domain/slidev-to-pptx/types.d.ts +1 -1
  48. package/cli/dist/infra/_shared/dependency-root.d.ts +9 -67
  49. package/cli/dist/infra/_shared/dependency-root.js +15 -126
  50. package/cli/dist/infra/_shared/flock.js +1 -2
  51. package/cli/dist/infra/_shared/plugin-root.d.ts +3 -5
  52. package/cli/dist/infra/_shared/plugin-root.js +5 -12
  53. package/cli/dist/infra/evidence-xlsx/workbook-writer.d.ts +1 -1
  54. package/cli/dist/infra/playwright/chromium.d.ts +4 -15
  55. package/cli/dist/infra/playwright/chromium.js +6 -18
  56. package/cli/dist/infra/playwright/host-dependencies.d.ts +2 -2
  57. package/cli/dist/infra/playwright/host-dependencies.js +6 -6
  58. package/cli/dist/infra/pptx-ooxml/soffice.js +1 -1
  59. package/cli/dist/infra/slidev-project/eslint-runner.d.ts +1 -1
  60. package/cli/dist/infra/slidev-project/eslint-runner.js +2 -2
  61. package/cli/dist/infra/slidev-to-pptx/index.js +1 -1
  62. package/cli/dist/infra/slidev-to-pptx/pipeline.js +1 -1
  63. package/cli/dist/infra/slidev-to-pptx/prerender-capture.js +1 -1
  64. package/cli/dist/infra/slidev-to-pptx/server.js +2 -2
  65. package/cli/dist/main.d.ts +3 -0
  66. package/cli/dist/main.js +28 -0
  67. package/cli/dist/mcp/result.d.ts +5 -1
  68. package/cli/dist/mcp/result.js +9 -1
  69. package/cli/dist/mcp/serve.d.ts +2 -3
  70. package/cli/dist/mcp/serve.js +4 -5
  71. package/cli/dist/mcp/server.d.ts +5 -1
  72. package/cli/dist/mcp/server.js +10 -7
  73. package/cli/dist/mcp/tool-names.js +4 -1
  74. package/cli/dist/mcp/tools/_shared.d.ts +1 -1
  75. package/cli/dist/mcp/tools/_shared.js +2 -2
  76. package/cli/dist/mcp/tools/drawio.js +12 -15
  77. package/cli/dist/mcp/tools/evidence.js +2 -2
  78. package/cli/dist/mcp/tools/file.d.ts +31 -0
  79. package/cli/dist/mcp/tools/file.js +482 -0
  80. package/cli/dist/mcp/tools/index.d.ts +1 -1
  81. package/cli/dist/mcp/tools/index.js +6 -3
  82. package/cli/dist/mcp/tools/setup.js +3 -3
  83. package/cli/dist/mcp/tools/slide-dev.js +6 -7
  84. package/cli/dist/mcp/tools/slide-page.js +3 -3
  85. package/cli/dist/mcp/tools/slide-theme.d.ts +0 -1
  86. package/cli/dist/mcp/tools/slide-theme.js +2 -3
  87. package/cli/dist/mcp/tools/slide.d.ts +4 -4
  88. package/cli/dist/mcp/tools/slide.js +13 -14
  89. package/cli/dist/node-runtime.d.ts +2 -2
  90. package/cli/dist/node-runtime.js +4 -13
  91. package/cli/dist/version.d.ts +1 -8
  92. package/cli/dist/version.js +2 -11
  93. package/npm-shrinkwrap.json +7 -17
  94. package/package.json +2 -3
  95. package/bin/pecot-visual-mcp.mjs +0 -10
  96. package/cli/dist/cli.d.ts +0 -5
  97. package/cli/dist/cli.js +0 -109
  98. package/cli/dist/commands/chromium/host-dependencies.d.ts +0 -18
  99. package/cli/dist/commands/chromium/host-dependencies.js +0 -75
  100. package/cli/dist/commands/pptx-ooxml/preview.d.ts +0 -74
  101. package/cli/dist/commands/pptx-ooxml/preview.js +0 -399
@@ -23,24 +23,24 @@ export declare const LAYOUT_CATALOG_OUTPUT_SHAPE: {
23
23
  }, z.core.$strict>>;
24
24
  };
25
25
  /**
26
- `pecotv slide create` 相当。`theme` で指定したテーマを参照する Slidev プロジェクトを生成し、
26
+ `theme` で指定したテーマを参照する Slidev プロジェクトを生成し、
27
27
  生成直後のデッキ全体 lint 結果を data に載せて返す (lint 違反は成否に影響しない)。
28
28
  */
29
29
  export declare function slideCreateTool(buildDependencies?: () => SlideCreateDependencies, buildRuntimeDependencies?: () => RuntimeDependencies): ToolDefinition;
30
30
  /**
31
- `pecotv slide convert` 相当。`slidev build` と in-process pipeline を起動するため、11 ツールの中で最も長時間かかる。
31
+ `slidev build` と in-process pipeline を起動するため、11 ツールの中で最も長時間かかる。
32
32
  progress ハートビートは server.ts 側が一律で送り、文言は工程と変換の件数・割合に差し替える。
33
33
  */
34
34
  export declare function slideConvertTool(buildDependencies?: () => SlideConvertDependencies, buildRuntimeDependencies?: () => RuntimeDependencies): ToolDefinition;
35
35
  /**
36
- `pecotv slide sync` 相当。移行前の talk-dir は、`theme` で指定したテーマを参照する形へ移す。
36
+ 移行前の talk-dir は、`theme` で指定したテーマを参照する形へ移す。
37
37
  テンプレート由来のファイルを消し、作品領域 (slides.md / pages/*.md / public/slides/) は残す。
38
38
  移行済みの talk-dir (`theme:` が依存のテーマを指す) は、package.json の依存の版でテーマを取得して node_modules を張り直す。
39
39
  本体の生成ファイル (vite.config.ts・start.mjs) は本体の今の内容にそろえ、ほかのファイルは変えない。
40
40
  */
41
41
  export declare function slideSyncTool(buildDependencies?: () => SlideSyncDependencies, buildRuntimeDependencies?: () => RuntimeDependencies): ToolDefinition;
42
42
  /**
43
- `pecotv slide lint` 相当。違反の検出は「報告が成果」なので、違反があっても成功で返す (CLI は exit 1)。
43
+ 違反の検出は「報告が成果」なので、違反があっても成功で返す。
44
44
  違反の有無は outcome の項目で読む。
45
45
  */
46
46
  export declare function slideLintTool(buildDependencies?: () => SlideLintDependencies): ToolDefinition;
@@ -1,5 +1,5 @@
1
1
  // MCP ツール定義のうち slide 系 4 件 (slide_create / slide_convert / slide_sync / slide_lint)。
2
- // deps はハンドラ内で組み立てる (既定 deps は CLAUDE_PLUGIN_ROOT 未設定で throw し、top-level だと tools/list ごと落ちる)。
2
+ // deps はハンドラ内で組み立てる。
3
3
  import path from 'node:path';
4
4
  import { z } from 'zod';
5
5
  import { errorToReason as slideCreateErrorToReason, executeSlideCreate, slideCreateDefaultDependencies, } from '../../commands/slidev-project/create.js';
@@ -10,7 +10,7 @@ import { failureKindOf } from '../../domain/_shared/failure-kind.js';
10
10
  import { parsePathArguments, toCallToolResult } from '../result.js';
11
11
  import { captureCommandOutput, chromiumDefaultDependencies, ensureChromium, ensureRuntimeDependencies, formatError, MISSING_RUNTIME_OUTPUT_SHAPE, normalizeThemeArgument, optionalFields, PATH_REJECTION_OUTPUT_SHAPE, runtimeDefaultDependencies, toolOutputFields, WINDOWS_PATH_NOTE, withPresence, } from './_shared.js';
12
12
  /**
13
- 失敗時の ToolResult。data は対応する CLI コマンドの `--json` error payload と同形にする。
13
+ 失敗時の ToolResult。
14
14
  */
15
15
  function failureResult(event, reason, error, extra = {}) {
16
16
  return {
@@ -148,7 +148,7 @@ const slideCreateInput = z.object({
148
148
  .describe('Delete and overwrite when the destination already exists'),
149
149
  });
150
150
  /**
151
- `pecotv slide create` 相当。`theme` で指定したテーマを参照する Slidev プロジェクトを生成し、
151
+ `theme` で指定したテーマを参照する Slidev プロジェクトを生成し、
152
152
  生成直後のデッキ全体 lint 結果を data に載せて返す (lint 違反は成否に影響しない)。
153
153
  */
154
154
  export function slideCreateTool(buildDependencies = slideCreateDefaultDependencies, buildRuntimeDependencies = runtimeDefaultDependencies) {
@@ -190,11 +190,11 @@ export function slideCreateTool(buildDependencies = slideCreateDefaultDependenci
190
190
  const execution = await executeSlideCreate(input.project_dir,
191
191
  // 人間向けの catalog 整形出力は stdout を汚すので出さない。
192
192
  // 同じ元データは layouts に構造化して載る。
193
- { theme: normalized.theme, force: input.force, emitCatalog: false }, dependencies);
193
+ { theme: normalized.theme, force: input.force }, dependencies);
194
194
  return output.finish({
195
195
  ok: true,
196
196
  data: execution.data,
197
- message: `slide create: succeeded (${execution.summary.projectDirectory})`,
197
+ message: `slide_create: succeeded (${execution.summary.projectDirectory})`,
198
198
  });
199
199
  }
200
200
  catch (error) {
@@ -227,7 +227,7 @@ const slideConvertInput = z.object({
227
227
  .describe('Whether to read the diff cache. Even with false, the cache is rebuilt when the conversion completes'),
228
228
  });
229
229
  /**
230
- `pecotv slide convert` 相当。`slidev build` と in-process pipeline を起動するため、11 ツールの中で最も長時間かかる。
230
+ `slidev build` と in-process pipeline を起動するため、11 ツールの中で最も長時間かかる。
231
231
  progress ハートビートは server.ts 側が一律で送り、文言は工程と変換の件数・割合に差し替える。
232
232
  */
233
233
  export function slideConvertTool(buildDependencies = slideConvertDefaultDependencies, buildRuntimeDependencies = runtimeDefaultDependencies) {
@@ -259,7 +259,7 @@ export function slideConvertTool(buildDependencies = slideConvertDefaultDependen
259
259
  return toCallToolResult(unavailable);
260
260
  const output = captureCommandOutput();
261
261
  try {
262
- // json: false 相当で呼び、出力を捕捉する。warning の行は warnings、失敗のときの出力は log に入る。
262
+ // 出力を捕捉する。warning の行は warnings、失敗のときの出力は log に入る。
263
263
  const dependencies = {
264
264
  ...buildDependencies(),
265
265
  stdout: output.stdout,
@@ -273,7 +273,6 @@ export function slideConvertTool(buildDependencies = slideConvertDefaultDependen
273
273
  ?? await resolveDefaultOut(path.resolve(input.project_dir), output.stderr);
274
274
  const options = {
275
275
  out,
276
- json: false,
277
276
  cache: input.cache,
278
277
  ...(input.theme !== undefined && { theme: input.theme }),
279
278
  ...(input.spacing_json_path !== undefined && { spacingJson: input.spacing_json_path }),
@@ -286,7 +285,7 @@ export function slideConvertTool(buildDependencies = slideConvertDefaultDependen
286
285
  return output.finish({
287
286
  ok: true,
288
287
  data: execution.data,
289
- message: `slide convert: ${execution.summary.inputAbs} -> ${execution.summary.outputAbs}`
288
+ message: `slide_convert: ${execution.summary.inputAbs} -> ${execution.summary.outputAbs}`
290
289
  + ` (${String(Math.round(execution.summary.durationMs))}ms)`,
291
290
  });
292
291
  }
@@ -307,7 +306,7 @@ const slideSyncInput = z.object({
307
306
  + 'A migrated talk-dir that references a theme behaves the same even when this is omitted. The generated files (vite.config.ts, start.mjs) are also aligned with the current content of the plugin. Cannot be specified together with theme'),
308
307
  });
309
308
  /**
310
- `pecotv slide sync` 相当。移行前の talk-dir は、`theme` で指定したテーマを参照する形へ移す。
309
+ 移行前の talk-dir は、`theme` で指定したテーマを参照する形へ移す。
311
310
  テンプレート由来のファイルを消し、作品領域 (slides.md / pages/*.md / public/slides/) は残す。
312
311
  移行済みの talk-dir (`theme:` が依存のテーマを指す) は、package.json の依存の版でテーマを取得して node_modules を張り直す。
313
312
  本体の生成ファイル (vite.config.ts・start.mjs) は本体の今の内容にそろえ、ほかのファイルは変えない。
@@ -372,7 +371,7 @@ export function slideSyncTool(buildDependencies = slideSyncDefaultDependencies,
372
371
  };
373
372
  }
374
373
  function syncSuccessMessage(summary) {
375
- const base = `slide sync: succeeded (${summary.directory})`;
374
+ const base = `slide_sync: succeeded (${summary.directory})`;
376
375
  if (summary.theme === undefined)
377
376
  return base;
378
377
  const themeText = `${base}; theme: ${summary.theme.name} (${summary.theme.spec})`;
@@ -385,7 +384,7 @@ const slideLintInput = z.object({
385
384
  .describe('Absolute path of the talk-dir to lint. Relative paths are not accepted. ' + WINDOWS_PATH_NOTE),
386
385
  });
387
386
  /**
388
- `pecotv slide lint` 相当。違反の検出は「報告が成果」なので、違反があっても成功で返す (CLI は exit 1)。
387
+ 違反の検出は「報告が成果」なので、違反があっても成功で返す。
389
388
  違反の有無は outcome の項目で読む。
390
389
  */
391
390
  export function slideLintTool(buildDependencies = slideLintDefaultDependencies) {
@@ -418,9 +417,9 @@ export function slideLintTool(buildDependencies = slideLintDefaultDependencies)
418
417
  ok: true,
419
418
  data,
420
419
  message: hasViolations
421
- ? `slide lint: violations found (${summary.directory}); ${String(summary.errorCount)} errors`
420
+ ? `slide_lint: violations found (${summary.directory}); ${String(summary.errorCount)} errors`
422
421
  + `; ${String(summary.warningCount)} warnings`
423
- : `slide lint: succeeded (${summary.directory}); ${String(summary.lintedFileCount)} files linted`,
422
+ : `slide_lint: succeeded (${summary.directory}); ${String(summary.lintedFileCount)} files linted`,
424
423
  });
425
424
  }
426
425
  catch (error) {
@@ -13,13 +13,13 @@ export declare const MINIMUM_NODE_VERSIONS: Readonly<Record<number, string>>;
13
13
  export declare function suggestedNodeVersion(): string;
14
14
  /**
15
15
  起動してよい版なら undefined、止めるべき版なら字下げ無しの複数行の案内文を返す。
16
- CLI は診断行の共通の関数に渡し、続きの行の字下げはそちらが付ける。
16
+ main.ts は診断行の共通の関数に渡し、続きの行の字下げはそちらが付ける。
17
17
  表に無い major は、表の最大 major より新しければ修正後のリリースとみなして許可し、
18
18
  それ以外(24 未満・サポート終了の 25 系)は止める。
19
19
  */
20
20
  export declare function nodeRuntimeGuidance(version: string): string | undefined;
21
21
  /**
22
- launcher と hook がそのまま書く形。続きの行の先頭に空白 2 つを付けた案内文を返す。
22
+ hook がそのまま書く形。続きの行の先頭に空白 2 つを付けた案内文を返す。
23
23
  */
24
24
  export declare function checkNodeRuntime(version: string): string | undefined;
25
25
  //# sourceMappingURL=node-runtime.d.ts.map
@@ -1,14 +1,5 @@
1
- // 起動する Node.js の版判定。既知の脆弱性の修正を含まない版では CLI と MCP サーバを起動しない。
2
- // MCP サーバの stderr は利用者の目に入らないため、警告ではなく起動拒否にする。
3
- // 層構成(domain ← infra ← mcp)のどこにも属さない起動前の確認なので src 直下に置く。
4
- //
5
- // このファイルは Node.js 24 の型除去(type stripping)でそのまま実行できる構文だけで書く。
6
- // enum・namespace・パラメータプロパティを使わず、他モジュールを import しない。
7
- // ランチャーと hook が node から直接読み込んで checkNodeRuntime を呼ぶため。
8
- //
9
- // 判定は cli.ts の main() で行う。CLI は nodeRuntimeGuidance の結果を診断行の共通の関数に渡す
10
- // (続きの行の字下げは共通の関数が付ける)。静的 import の評価後に動くため、import の段階で落ちる
11
- // 古い major(23 以前)では案内を出せないことがある。判定だけのエントリモジュールには分けない。
1
+ // 起動する Node.js の版判定。既知の脆弱性の修正を含まない版では MCP サーバを起動しない(判定は main.ts)。
2
+ // hook が node の型除去で直接読むので、enum・namespace・パラメータプロパティ・import を使わない。
12
3
  /**
13
4
  系列(major)ごとの最低版。2026-10-21 の Node.js セキュリティリリース
14
5
  (Brotli 展開の RCE CVE-2026-111497 ほか)の修正版。25 系はサポート終了で修正版が無い。
@@ -65,7 +56,7 @@ function guidance(version) {
65
56
  }
66
57
  /**
67
58
  起動してよい版なら undefined、止めるべき版なら字下げ無しの複数行の案内文を返す。
68
- CLI は診断行の共通の関数に渡し、続きの行の字下げはそちらが付ける。
59
+ main.ts は診断行の共通の関数に渡し、続きの行の字下げはそちらが付ける。
69
60
  表に無い major は、表の最大 major より新しければ修正後のリリースとみなして許可し、
70
61
  それ以外(24 未満・サポート終了の 25 系)は止める。
71
62
  */
@@ -84,7 +75,7 @@ export function nodeRuntimeGuidance(version) {
84
75
  return isAtLeast(actual, minimumVersion.tuple) ? undefined : guidance(version);
85
76
  }
86
77
  /**
87
- launcher と hook がそのまま書く形。続きの行の先頭に空白 2 つを付けた案内文を返す。
78
+ hook がそのまま書く形。続きの行の先頭に空白 2 つを付けた案内文を返す。
88
79
  */
89
80
  export function checkNodeRuntime(version) {
90
81
  return nodeRuntimeGuidance(version)?.split('\n').join('\n ');
@@ -1,12 +1,5 @@
1
1
  /**
2
- version を解決する。
3
-
4
- プラグインルートの決定 (CLAUDE_PLUGIN_ROOT env → source 相対) は resolvePluginRoot() に
5
- 委ねる。ここが持つのは「そのルート直下の `.claude-plugin/plugin.json` から version を
6
- 読み、読めなければ "0.0.0+dev"」という 1 段だけ。
7
-
8
- bin/pecotv ラッパー経由では CLAUDE_PLUGIN_ROOT が未設定でも親 bin から再注入される。
9
- そのため env なしの source 相対ルートは `node dist/cli.js` 直叩き時のみ到達する。
2
+ version を解決する。プラグインルート直下の `.claude-plugin/plugin.json` から読み、読めなければ "0.0.0+dev"。
10
3
  */
11
4
  export declare function readVersion(): string;
12
5
  export declare function loadVersionFromPluginJson(manifestPath: string): string | undefined;
@@ -1,18 +1,10 @@
1
- // プラグイン版数の解決。cli.ts と commands/ の双方から参照するため、cli.ts から独立させている
2
- // (commands → cli.ts の import は循環になる)。
1
+ // プラグインの版の解決。
3
2
  import { readFileSync } from 'node:fs';
4
3
  import path from 'node:path';
5
4
  import { resolvePluginRoot } from './infra/_shared/plugin-root.js';
6
5
  const DEFAULT_VERSION = '0.0.0+dev';
7
6
  /**
8
- version を解決する。
9
-
10
- プラグインルートの決定 (CLAUDE_PLUGIN_ROOT env → source 相対) は resolvePluginRoot() に
11
- 委ねる。ここが持つのは「そのルート直下の `.claude-plugin/plugin.json` から version を
12
- 読み、読めなければ "0.0.0+dev"」という 1 段だけ。
13
-
14
- bin/pecotv ラッパー経由では CLAUDE_PLUGIN_ROOT が未設定でも親 bin から再注入される。
15
- そのため env なしの source 相対ルートは `node dist/cli.js` 直叩き時のみ到達する。
7
+ version を解決する。プラグインルート直下の `.claude-plugin/plugin.json` から読み、読めなければ "0.0.0+dev"。
16
8
  */
17
9
  export function readVersion() {
18
10
  const manifestPath = path.join(resolvePluginRoot(), '.claude-plugin/plugin.json');
@@ -21,7 +13,6 @@ export function readVersion() {
21
13
  export function loadVersionFromPluginJson(manifestPath) {
22
14
  let parsed;
23
15
  try {
24
- // path joined from CLAUDE_PLUGIN_ROOT or import.meta.url relative.
25
16
  // eslint-disable-next-line security/detect-non-literal-fs-filename
26
17
  parsed = JSON.parse(readFileSync(manifestPath, 'utf8'));
27
18
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@pecot/visual-mcp",
3
- "version": "3.1.1-dev.142",
3
+ "version": "3.1.1-dev.144",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@pecot/visual-mcp",
9
- "version": "3.1.1-dev.142",
9
+ "version": "3.1.1-dev.144",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@cffnpwr/textlint-plugin-comments": "1.0.0",
@@ -18,7 +18,6 @@
18
18
  "@textlint/textlint-plugin-markdown": "^15.8.0",
19
19
  "@xmldom/xmldom": "^0.9.12",
20
20
  "ajv": "^8.20.0",
21
- "commander": "^15.1.0",
22
21
  "eslint": "^10.15.0",
23
22
  "js-yaml": "^4.3.2",
24
23
  "mime-types": "^2.1.35",
@@ -35,7 +34,7 @@
35
34
  "zod": "^4.6.7"
36
35
  },
37
36
  "bin": {
38
- "pecot-visual-mcp": "bin/pecot-visual-mcp.mjs"
37
+ "pecot-visual-mcp": "cli/dist/main.js"
39
38
  },
40
39
  "engines": {
41
40
  "node": "^24.22.1 || >=26.12.1"
@@ -1079,12 +1078,12 @@
1079
1078
  }
1080
1079
  },
1081
1080
  "node_modules/commander": {
1082
- "version": "15.1.0",
1083
- "resolved": "https://registry.npmjs.org/commander/-/commander-15.1.0.tgz",
1084
- "integrity": "sha512-cgnQ88TRrWcC7pVq46RzJVRMktu3W2RcbnoidnfBsl1bmDCBwJS/udcIZpKoCrbAYYaCqsz1yZCVIgbIaU3ddQ==",
1081
+ "version": "8.3.0",
1082
+ "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz",
1083
+ "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==",
1085
1084
  "license": "MIT",
1086
1085
  "engines": {
1087
- "node": ">=22.12.0"
1086
+ "node": ">= 12"
1088
1087
  }
1089
1088
  },
1090
1089
  "node_modules/commandpost": {
@@ -2781,15 +2780,6 @@
2781
2780
  "katex": "cli.js"
2782
2781
  }
2783
2782
  },
2784
- "node_modules/katex/node_modules/commander": {
2785
- "version": "8.3.0",
2786
- "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz",
2787
- "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==",
2788
- "license": "MIT",
2789
- "engines": {
2790
- "node": ">= 12"
2791
- }
2792
- },
2793
2783
  "node_modules/keyv": {
2794
2784
  "version": "5.6.0",
2795
2785
  "resolved": "https://registry.npmjs.org/keyv/-/keyv-5.6.0.tgz",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pecot/visual-mcp",
3
- "version": "3.1.1-dev.142",
3
+ "version": "3.1.1-dev.144",
4
4
  "type": "module",
5
5
  "description": "pecotv MCP server (standalone distribution)",
6
6
  "license": "MIT",
@@ -10,7 +10,7 @@
10
10
  "directory": "plugins/pecot-visual"
11
11
  },
12
12
  "bin": {
13
- "pecot-visual-mcp": "bin/pecot-visual-mcp.mjs"
13
+ "pecot-visual-mcp": "cli/dist/main.js"
14
14
  },
15
15
  "engines": {
16
16
  "node": "^24.22.1 || >=26.12.1"
@@ -18,7 +18,6 @@
18
18
  "dependencies": {
19
19
  "@modelcontextprotocol/server": "^2.4.0",
20
20
  "@xmldom/xmldom": "^0.9.12",
21
- "commander": "^15.1.0",
22
21
  "mime-types": "^2.1.35",
23
22
  "playwright": "^1.65.0",
24
23
  "xpath": "^0.0.36",
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- import path from 'node:path'
3
- import { fileURLToPath } from 'node:url'
4
-
5
- const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
6
- process.env.CLAUDE_PLUGIN_ROOT = root
7
- // 配布物は MCP サーバ専用エントリ。登録例が引数なしでも mcp として起動させる。
8
- if (!process.argv.slice(2).includes('mcp')) process.argv.splice(2, 0, 'mcp')
9
- const { main } = await import(path.join(root, 'cli/dist/cli.js'))
10
- main()
package/cli/dist/cli.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function createProgram(): Command;
3
- export declare function applyExitOverrideRecursively(command: Command): void;
4
- export declare function main(nodeVersion?: string): void;
5
- //# sourceMappingURL=cli.d.ts.map
package/cli/dist/cli.js DELETED
@@ -1,109 +0,0 @@
1
- import { realpathSync } from 'node:fs';
2
- import { pathToFileURL } from 'node:url';
3
- import { Command, CommanderError } from 'commander';
4
- import { createChromiumHostDependenciesCommand, hostDependenciesCommandDefaultDependencies, } from './commands/chromium/host-dependencies.js';
5
- import { createDrawioExportCommand, drawioExportDefaultDependencies, } from './commands/drawio/export.js';
6
- import { createDrawioUrlCommand, drawioUrlDefaultDependencies, } from './commands/drawio/url.js';
7
- import { createEvidenceCreateCommand, evidenceCreateDefaultDependencies, } from './commands/evidence-xlsx/create.js';
8
- import { createPptxPreviewCommand, pptxPreviewDefaultDependencies, } from './commands/pptx-ooxml/preview.js';
9
- import { createSlideCreateCommand, slideCreateDefaultDependencies, } from './commands/slidev-project/create.js';
10
- import { createSlideLintCommand, slideLintDefaultDependencies, } from './commands/slidev-project/lint.js';
11
- import { createSlideThemeCommand, slideThemeDefaultDependencies, } from './commands/slidev-project/theme.js';
12
- import { createSlideConvertCommand, slideConvertDefaultDependencies, } from './commands/slidev-to-pptx/convert.js';
13
- import { createSlideSyncCommand, slideSyncDefaultDependencies, } from './commands/slidev-project/sync.js';
14
- import { createDiagnostics, writeData } from './diagnostics.js';
15
- import { nodeRuntimeGuidance } from './node-runtime.js';
16
- import { readVersion } from './version.js';
17
- export function createProgram() {
18
- const program = new Command();
19
- program.name('pecotv').version(readVersion());
20
- program
21
- .command('hello')
22
- .description('greet from TS runtime')
23
- .action(() => {
24
- writeData(process.stdout, 'hello from pecotv (ts)');
25
- });
26
- const pptx = new Command('pptx').description('operate on PPTX files');
27
- pptx.addCommand(createPptxPreviewCommand(pptxPreviewDefaultDependencies));
28
- program.addCommand(pptx);
29
- const slide = new Command('slide').description('operate on Slidev projects');
30
- slide.addCommand(createSlideCreateCommand(slideCreateDefaultDependencies));
31
- slide.addCommand(createSlideConvertCommand(slideConvertDefaultDependencies));
32
- slide.addCommand(createSlideSyncCommand(slideSyncDefaultDependencies));
33
- slide.addCommand(createSlideLintCommand(slideLintDefaultDependencies));
34
- slide.addCommand(createSlideThemeCommand(slideThemeDefaultDependencies));
35
- program.addCommand(slide);
36
- const drawio = new Command('drawio').description('operate on drawio diagrams');
37
- drawio.addCommand(createDrawioUrlCommand(drawioUrlDefaultDependencies));
38
- drawio.addCommand(createDrawioExportCommand(drawioExportDefaultDependencies));
39
- program.addCommand(drawio);
40
- const chromiumCommand = new Command('chromium').description('operate on the Playwright Chromium runtime');
41
- chromiumCommand.addCommand(createChromiumHostDependenciesCommand(hostDependenciesCommandDefaultDependencies));
42
- program.addCommand(chromiumCommand);
43
- const evidence = new Command('evidence').description('operate on evidence xlsx files');
44
- evidence.addCommand(createEvidenceCreateCommand(evidenceCreateDefaultDependencies));
45
- program.addCommand(evidence);
46
- // mcp の実装は src/mcp/ に置く (ESLint zone: commands → mcp の import 禁止)。
47
- // ここでは Command の外形だけを組み、MCP SDK を引き込む実装は action 内の dynamic import に
48
- // 遅らせる。静的 import にすると `pecotv --help` を含む全コマンドの起動が SDK の読み込み分
49
- // (計測 約 60ms) 重くなるため。
50
- const mcp = program
51
- .command('mcp')
52
- .description('serve as an MCP server over stdio (stdin/stdout)');
53
- /* c8 ignore start -- action は dynamic import して実 process.stdin/stdout へ接続する。
54
- 単体テストから起動すると vitest worker の stdout ごと差し替えてしまう。このルートは
55
- tests/e2e/mcp-stdio.test.ts が実プロセスの spawn で担保する。 */
56
- mcp.action(async () => {
57
- const { executeMcpServe, mcpServeDefaultDependencies } = await import('./mcp/serve.js');
58
- executeMcpServe(mcpServeDefaultDependencies);
59
- });
60
- /* c8 ignore stop */
61
- return program;
62
- }
63
- // commander 14 の addCommand は親の exitOverride を継承しない。
64
- // そのため group command (pptx / slide / drawio / evidence) は素のままだと自前で process.exit(1) してしまう。
65
- // program から辿れる全 command へ再帰適用して、想定内終了を必ず CommanderError として
66
- // main() の catch まで同期伝播させる。引数なしの exitOverride() は leaf の自前設定と同一で冪等。
67
- // exitOverride() で対象 Command を変更するため readonly 化できない。
68
- // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
69
- export function applyExitOverrideRecursively(command) {
70
- command.exitOverride();
71
- for (const child of command.commands)
72
- applyExitOverrideRecursively(child);
73
- }
74
- export function main(nodeVersion = process.versions.node) {
75
- const runtimeError = nodeRuntimeGuidance(nodeVersion);
76
- if (runtimeError !== undefined) {
77
- createDiagnostics(process.stderr).error(runtimeError);
78
- process.exitCode = 1;
79
- return;
80
- }
81
- const program = createProgram();
82
- applyExitOverrideRecursively(program);
83
- try {
84
- program.parse(process.argv);
85
- }
86
- catch (error) {
87
- // exitOverride() を有効にしたサブコマンドからの想定内終了 (validation エラー / --help / --version)。
88
- // configureOutput が writeErr で stdout/stderr 出力を済ませているため、ここでは exit code のみ反映する。
89
- // 非 CommanderError ルートは commander の仕様上 parse から発生しない (action 内例外は Promise reject ルートへ)。
90
- /* c8 ignore start */
91
- if (!(error instanceof CommanderError))
92
- throw error;
93
- /* c8 ignore stop */
94
- process.exitCode = error.exitCode === 0 ? 0 : 2;
95
- }
96
- }
97
- /* v8 ignore start -- 直接起動時のみ通るルート。挙動は tests/e2e/version.test.ts で担保 */
98
- if (process.argv[1] !== undefined) {
99
- // import.meta.url は symlink を解決した実体パスを指すため、argv[1] 側も realpath に揃える。
100
- // 揃えないと bin ラッパー等の symlink 経由起動で一致せず、何もせず exit 0 で終わる。
101
- // main() を import して呼ぶルートでも、import 元プロセスの argv[1] が実ファイルである必要がある。
102
- // eslint-disable-next-line security/detect-non-literal-fs-filename -- 起動された自分自身のパス
103
- const selfUrl = pathToFileURL(realpathSync(process.argv[1])).href;
104
- if (import.meta.url === selfUrl) {
105
- main();
106
- }
107
- }
108
- /* v8 ignore stop */
109
- //# sourceMappingURL=cli.js.map
@@ -1,18 +0,0 @@
1
- import { Command } from 'commander';
2
- import { type HostDependencies } from '../../infra/playwright/host-dependencies.js';
3
- /**
4
- OS のライブラリが足りず、入れられなかったときの exit code。
5
- */
6
- export declare const HOST_DEPS_MISSING_EXIT_CODE = 2;
7
- /**
8
- --require-launch のとき、OS のライブラリ以外の原因で起動できなかったときの exit code。
9
- */
10
- export declare const LAUNCH_FAILED_EXIT_CODE = 3;
11
- export interface HostDependenciesCommandDependencies {
12
- readonly hostDeps: () => HostDependencies;
13
- readonly stderr: NodeJS.WritableStream;
14
- readonly setExitCode: (code: number) => void;
15
- }
16
- export declare function hostDependenciesCommandDefaultDependencies(): HostDependenciesCommandDependencies;
17
- export declare function createChromiumHostDependenciesCommand(buildDependencies: () => HostDependenciesCommandDependencies): Command;
18
- //# sourceMappingURL=host-dependencies.d.ts.map
@@ -1,75 +0,0 @@
1
- // `pecotv chromium host-deps` 実装。Chromium が起動するのに要る OS のライブラリを確認し、
2
- // 足りなければ入れる (#1217)。bin/pecotv の bootstrap が Chromium 取得の直後に呼ぶ。
3
- // テストの前提確認 (scripts/ci/chromium-preflight.sh) は --require-launch 付きで呼び、
4
- // 起動できないなら原因を問わず本実行の前に落とす。
5
- //
6
- // 判定と導入の本体は infra/playwright/host-dependencies.ts。ここは結果を利用者向けの文言と
7
- // exit code に写すだけにする。
8
- import { Command } from 'commander';
9
- import { createDiagnostics } from '../../diagnostics.js';
10
- import { ensureChromiumHostDependencies, hostDependenciesDefaultDependencies, } from '../../infra/playwright/host-dependencies.js';
11
- /**
12
- OS のライブラリが足りず、入れられなかったときの exit code。
13
- */
14
- export const HOST_DEPS_MISSING_EXIT_CODE = 2;
15
- /**
16
- --require-launch のとき、OS のライブラリ以外の原因で起動できなかったときの exit code。
17
- */
18
- export const LAUNCH_FAILED_EXIT_CODE = 3;
19
- export function hostDependenciesCommandDefaultDependencies() {
20
- return {
21
- hostDeps: hostDependenciesDefaultDependencies,
22
- stderr: process.stderr,
23
- setExitCode: (code) => {
24
- process.exitCode = code;
25
- },
26
- };
27
- }
28
- export function createChromiumHostDependenciesCommand(buildDependencies) {
29
- return new Command('host-deps')
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
- .action(async (options) => {
33
- const dependencies = buildDependencies();
34
- const diagnostics = createDiagnostics(dependencies.stderr);
35
- // apt-get は数分かかり得るため、始める前に何を入れるかを stderr に出す。
36
- const hostDependencies = {
37
- ...dependencies.hostDeps(),
38
- notify: (message) => {
39
- diagnostics.note(message);
40
- },
41
- };
42
- const outcome = await ensureChromiumHostDependencies(hostDependencies);
43
- switch (outcome.status) {
44
- case 'ok': {
45
- hostDependencies.record('ok');
46
- return;
47
- }
48
- case 'installed': {
49
- diagnostics.done({ verb: 'add', target: outcome.packages.join(' ') });
50
- hostDependencies.record('ok');
51
- return;
52
- }
53
- case 'missing': {
54
- diagnostics.error(outcome.detail);
55
- hostDependencies.record('missing');
56
- dependencies.setExitCode(HOST_DEPS_MISSING_EXIT_CODE);
57
- return;
58
- }
59
- case 'launch-failed': {
60
- // 実行ファイル未取得等。取得は bin/pecotv の別の段が担うため、記録だけして通す。
61
- hostDependencies.record('launch-failed');
62
- const message = `Chromium failed to launch (cause other than OS libraries): ${outcome.detail}`;
63
- if (options.requireLaunch === true) {
64
- diagnostics.error(message);
65
- dependencies.setExitCode(LAUNCH_FAILED_EXIT_CODE);
66
- }
67
- else {
68
- diagnostics.warning(message);
69
- }
70
- return;
71
- }
72
- }
73
- });
74
- }
75
- //# sourceMappingURL=host-dependencies.js.map
@@ -1,74 +0,0 @@
1
- import type { FailureReason } from '../../domain/_shared/failure-kind.js';
2
- import { Command } from 'commander';
3
- import { type PreviewDivergenceFinding } from '../../domain/pptx-ooxml/preview-normalize.js';
4
- import type { PdfConverter, PptxArchive, XmlEngine } from '../../domain/_shared/ports.js';
5
- interface PreviewOptions {
6
- readonly out?: string;
7
- readonly report?: string;
8
- readonly detectOnly?: boolean;
9
- }
10
- export interface PreviewDependencies {
11
- readonly archive: PptxArchive;
12
- readonly engine: XmlEngine;
13
- readonly pdfConverter: PdfConverter;
14
- readonly stdout: NodeJS.WritableStream;
15
- readonly stderr: NodeJS.WritableStream;
16
- readonly now: () => number;
17
- }
18
- /**
19
- slide 番号付きの検知結果。レポート / イベントの 1 要素。
20
- */
21
- export interface SlideFinding {
22
- readonly slide: number;
23
- readonly rule: PreviewDivergenceFinding['rule'];
24
- readonly shapeName?: string;
25
- }
26
- export interface PreviewResultSummary {
27
- readonly inputAbs: string;
28
- readonly outputAbs?: string;
29
- readonly findings: readonly SlideFinding[];
30
- readonly normalized: number;
31
- readonly detectOnly: boolean;
32
- readonly durationMs: number;
33
- }
34
- export declare class PreviewRuntimeError extends Error {
35
- readonly reason: FailureReason;
36
- constructor(message: string, reason: FailureReason);
37
- }
38
- export declare function runPreview(inputPath: string, options: Readonly<PreviewOptions>, dependencies: PreviewDependencies): Promise<PreviewResultSummary>;
39
- export interface PptxPreviewOptions {
40
- readonly input: string;
41
- /**
42
- 省略時は `<input-dir>/<input-stem>.preview.pdf` を導出する (detect-only 時は出力しない)。
43
- */
44
- readonly out?: string;
45
- readonly report?: string;
46
- readonly detectOnly: boolean;
47
- }
48
- /**
49
- `--json` の成功イベント。detect-only では PDF を作らないため `output` キーごと落ちる。
50
- */
51
- export interface PptxPreviewResultData {
52
- readonly event: 'pptx.preview.done';
53
- readonly input: string;
54
- readonly output?: string;
55
- readonly detectOnly: boolean;
56
- readonly normalized: number;
57
- readonly findings: readonly SlideFinding[];
58
- readonly durationMs: number;
59
- }
60
- /**
61
- プレビューを実行し、`--json` と同形の結果オブジェクトを返す。
62
- CLI の action と MCP ツールはどちらもこの関数を呼ぶ (実行と結果組み立ての単一実装)。
63
- */
64
- export declare function executePptxPreview(options: Readonly<PptxPreviewOptions>, dependencies: PreviewDependencies): Promise<PptxPreviewResultData>;
65
- /**
66
- 実行失敗時の exit code。usage エラー (exit 2) は commander が cli.ts の main へ委譲するため、
67
- 本コマンド自身が設定するのは 1 のみ。
68
- */
69
- export declare const PPTX_PREVIEW_FAILURE_EXIT_CODE = 1;
70
- export declare function errorToReason(error: unknown): FailureReason;
71
- export declare function createPptxPreviewCommand(buildDependencies: () => PreviewDependencies): Command;
72
- export declare function pptxPreviewDefaultDependencies(): PreviewDependencies;
73
- export {};
74
- //# sourceMappingURL=preview.d.ts.map