@pecot/visual-mcp 1.3.1 → 3.0.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.
Files changed (61) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +12 -12
  3. package/assets/slidev/package.json +1 -1
  4. package/assets/slidev/scripts/eslint/slidev-pages-lint/package.json +1 -1
  5. package/assets/slidev/scripts/eslint/text-constraints/package.json +1 -1
  6. package/cli/dist/commands/drawio/errors.d.ts +5 -4
  7. package/cli/dist/commands/drawio/export.d.ts +6 -5
  8. package/cli/dist/commands/drawio/export.js +0 -2
  9. package/cli/dist/commands/drawio/url.d.ts +2 -1
  10. package/cli/dist/commands/drawio/url.js +0 -1
  11. package/cli/dist/commands/evidence-xlsx/create.d.ts +2 -1
  12. package/cli/dist/commands/evidence-xlsx/create.js +0 -1
  13. package/cli/dist/commands/pptx-ooxml/preview.d.ts +4 -3
  14. package/cli/dist/commands/pptx-ooxml/preview.js +0 -3
  15. package/cli/dist/commands/slidev-project/create.d.ts +2 -1
  16. package/cli/dist/commands/slidev-project/create.js +0 -1
  17. package/cli/dist/commands/slidev-project/lint.d.ts +2 -1
  18. package/cli/dist/commands/slidev-project/sync.d.ts +2 -1
  19. package/cli/dist/commands/slidev-project/sync.js +0 -1
  20. package/cli/dist/commands/slidev-project/theme.d.ts +2 -1
  21. package/cli/dist/commands/slidev-to-pptx/convert.d.ts +6 -5
  22. package/cli/dist/commands/slidev-to-pptx/convert.js +0 -4
  23. package/cli/dist/domain/_shared/failure-kind.d.ts +13 -0
  24. package/cli/dist/domain/_shared/failure-kind.js +103 -0
  25. package/cli/dist/domain/slidev-project/errors.d.ts +5 -4
  26. package/cli/dist/domain/slidev-theme/error-reason.d.ts +9 -5
  27. package/cli/dist/infra/_shared/dependency-root.d.ts +3 -3
  28. package/cli/dist/infra/_shared/dependency-root.js +5 -5
  29. package/cli/dist/infra/_shared/runtime-install.d.ts +1 -1
  30. package/cli/dist/infra/_shared/runtime-install.js +1 -1
  31. package/cli/dist/infra/_shared/slidev-bin.d.ts +1 -1
  32. package/cli/dist/infra/_shared/slidev-bin.js +1 -1
  33. package/cli/dist/infra/playwright/chromium.js +2 -2
  34. package/cli/dist/infra/playwright/host-dependencies.js +1 -1
  35. package/cli/dist/infra/playwright/launch.js +1 -1
  36. package/cli/dist/infra/slidev-to-pptx/pipeline.js +1 -1
  37. package/cli/dist/infra/slidev-to-pptx/runner.js +1 -1
  38. package/cli/dist/mcp/dev-server-registry.d.ts +6 -1
  39. package/cli/dist/mcp/dev-server-registry.js +4 -1
  40. package/cli/dist/mcp/result.d.ts +36 -61
  41. package/cli/dist/mcp/result.js +73 -75
  42. package/cli/dist/mcp/tool-names.d.ts +17 -0
  43. package/cli/dist/mcp/tool-names.js +26 -0
  44. package/cli/dist/mcp/tools/_shared.d.ts +40 -38
  45. package/cli/dist/mcp/tools/_shared.js +63 -72
  46. package/cli/dist/mcp/tools/drawio.js +47 -61
  47. package/cli/dist/mcp/tools/evidence.js +11 -18
  48. package/cli/dist/mcp/tools/setup.d.ts +1 -1
  49. package/cli/dist/mcp/tools/setup.js +18 -38
  50. package/cli/dist/mcp/tools/slide-dev.js +17 -36
  51. package/cli/dist/mcp/tools/slide-page.d.ts +2 -1
  52. package/cli/dist/mcp/tools/slide-page.js +20 -26
  53. package/cli/dist/mcp/tools/slide-theme.js +4 -11
  54. package/cli/dist/mcp/tools/slide.d.ts +2 -2
  55. package/cli/dist/mcp/tools/slide.js +31 -73
  56. package/cli/dist/mcp/warnings.d.ts +24 -0
  57. package/cli/dist/mcp/warnings.js +101 -0
  58. package/cli/dist/mcp/windows-path.js +1 -1
  59. package/npm-shrinkwrap.json +92 -33
  60. package/package.json +2 -2
  61. package/vendor/text-rules/dist/source-hash +1 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pecot-v",
3
- "version": "1.3.1",
3
+ "version": "3.0.0",
4
4
  "description": "pecot-v(pecot-visual)— 可視化・ドキュメント系スキル集(v-drawio, v-slidev, v-evidence)",
5
5
  "author": {
6
6
  "name": "pecot"
package/README.md CHANGED
@@ -45,7 +45,7 @@ npm には devEngines の判定だけを外す公式の手段が無く、要望
45
45
  - 利用者のリポジトリの `.npmrc` を読まず、globalconfig も `/etc/npmrc` になる。registry・proxy・cafile は `~/.npmrc` に置く
46
46
  - `npm_config_prefix=/` などの環境変数がサーバに引き継がれる。サーバの子で `npm i -g` を打つと `/lib/node_modules` を向く
47
47
 
48
- `setup` は `npm install --prefix` で置き場を明示します。
48
+ `runtime_setup` は `npm install --prefix` で置き場を明示します。
49
49
  テーマの依存の取得(pnpm)は、talk-dir を cwd か `--dir` で指します。どちらも、この副作用の影響を受けません。
50
50
 
51
51
  この副作用を避けたいときは、先に `npm i -g @pecot/visual-mcp` で入れて、コマンドを直接登録します。
@@ -106,8 +106,8 @@ WSL 内の npx が非ログインシェルの PATH に無い場合は、次の
106
106
 
107
107
  ツールのパス引数には `C:\...` と `\\wsl.localhost\<distro>\...` をそのまま渡せます。
108
108
  変換の対象はツール引数のみです。spec ファイル等の中身に書かれたパスは変換しません。
109
- 応答の `artifacts` と `data` は、ドライブレター形式なら `/mnt/<drive>/...`、UNC 形式なら
110
- WSL 内の絶対パス(例: `/home/alice/deck`)で返ります。
109
+ 応答のパスの項目(`file`・`outPath` など)は、WSL 内のパスで返ります。
110
+ ドライブレター形式なら `/mnt/<drive>/...`、UNC 形式なら WSL 内の絶対パス(例: `/home/alice/deck`)です。
111
111
  `/etc/wsl.conf` の `[automount] root` を既定から変えている場合は、その値を環境変数
112
112
  `PECOTV_WSL_MOUNT_ROOT` に設定してください。
113
113
 
@@ -115,33 +115,33 @@ WSL 内の絶対パス(例: `/home/alice/deck`)で返ります。
115
115
 
116
116
  ## 初回の操作
117
117
 
118
- `setup` ツールを 1 回呼んでください。スライド変換・スクリーンショット系が使う重量依存
118
+ `runtime_setup` ツールを 1 回呼んでください。スライド変換・スクリーンショット系が使う重量依存
119
119
  (Slidev / dom-to-pptx / Chromium、所要は約 80 秒)を取得します。取得結果は永続し、
120
120
  サーバを再起動しても再実行は不要です。
121
121
 
122
122
  依存は `$XDG_DATA_HOME/pecot/pecot-visual/mcp-dist/` に置きます。
123
123
  `XDG_DATA_HOME` が無ければ、`~/.local/share/pecot/pecot-visual/mcp-dist/` に置きます。
124
124
  登録の `env` に `PLUGIN_DATA` を書いたときは、そのディレクトリの `mcp-dist/` に置きます。
125
- 置き場を変えたあとは `setup` を呼び直してください。
125
+ 置き場を変えたあとは `runtime_setup` を呼び直してください。
126
126
  既存デッキの `node_modules` のリンクは、`slide_sync` で張り直してください。
127
127
 
128
128
  通信を復号するプロキシの配下で使うときは、プロキシの CA 証明書を、Node の環境変数 `NODE_EXTRA_CA_CERTS` に PEM ファイルのパスで渡してください。
129
- pecot は証明書を同梱しません。登録の `env` に書けば、`setup` の取得と、テーマの依存の取得(pnpm)にも使われます。
129
+ pecot は証明書を同梱しません。登録の `env` に書けば、`runtime_setup` の取得と、テーマの依存の取得(pnpm)にも使われます。
130
130
  WSL 経由で登録するときは、`PLUGIN_DATA` と同じく、`args` の `env` に WSL 側のパスで含めてください。
131
131
 
132
- `setup` 未実行でも使えるツール: `drawio_create` / `evidence_create` / `slide_lint` / `slide_page` / `slide_theme`
132
+ `runtime_setup` 未実行でも使えるツール: `drawio_create` / `evidence_create` / `slide_lint` / `slide_page` / `slide_theme`
133
133
 
134
- `setup` 実行後に使えるツール: `slide_create` / `slide_sync` / `slide_convert` /
134
+ `runtime_setup` 実行後に使えるツール: `slide_create` / `slide_sync` / `slide_convert` /
135
135
  `slide_dev` / `drawio_export`
136
136
 
137
- `drawio_create` は URL の生成だけなら `setup` は不要ですが、PNG 出力を指定する場合は
138
- Chromium を使うため `setup` が必要です。
137
+ `drawio_create` は URL の生成だけなら `runtime_setup` は不要ですが、PNG 出力を指定する場合は
138
+ Chromium を使うため `runtime_setup` が必要です。
139
139
 
140
140
  ## ツール
141
141
 
142
142
  | ツール | 用途 |
143
143
  |---|---|
144
- | `setup` | 永続依存(Slidev ランタイム・Chromium)の取得 |
144
+ | `runtime_setup` | 永続依存(Slidev ランタイム・Chromium)の取得 |
145
145
  | `slide_create` | Slidev プロジェクトの新規作成 |
146
146
  | `slide_sync` | テーマを参照する talk-dir は、依存の版でテーマを取得して node_modules を張り直し、生成ファイル(vite.config.ts・start.mjs)を本体の今の内容にそろえる。旧形式の talk-dir は `theme` で指定したテーマを参照する形へ移す |
147
147
  | `slide_lint` | Slidev ページの ESLint チェック |
@@ -155,7 +155,7 @@ Chromium を使うため `setup` が必要です。
155
155
 
156
156
  ## 失敗したとき
157
157
 
158
- `setup` が必要なツールを `setup` 前に呼ぶと、`setup` を案内する応答が返ります。`setup` を呼んでから再実行してください。
158
+ `runtime_setup` が必要なツールを `runtime_setup` 前に呼ぶと、`runtime_setup` を案内する応答が返ります。`runtime_setup` を呼んでから再実行してください。
159
159
 
160
160
  `EBADDEVENGINES` で止まるときは、登録の `args` に `--prefix=/` が付いているか確認してください。
161
161
 
@@ -30,7 +30,7 @@
30
30
  "@types/js-yaml": "^4.0.9",
31
31
  "@types/node": "^22.20.5",
32
32
  "c8": "^12.0.0",
33
- "eslint": "^10.14.0",
33
+ "eslint": "^10.15.0",
34
34
  "eslint-config-prettier": "^10.1.8",
35
35
  "eslint-plugin-vue": "^10.12.1",
36
36
  "globals": "^17.14.0",
@@ -16,7 +16,7 @@
16
16
  "eslint": "^10.0.0"
17
17
  },
18
18
  "devDependencies": {
19
- "eslint": "^10.14.0"
19
+ "eslint": "^10.15.0"
20
20
  },
21
21
  "engines": {
22
22
  "node": "^24.22.1 || >=26.12.1"
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "devDependencies": {
21
21
  "@eslint/markdown": "^8.0.3",
22
- "eslint": "^10.14.0"
22
+ "eslint": "^10.15.0"
23
23
  },
24
24
  "engines": {
25
25
  "node": "^24.22.1 || >=26.12.1"
@@ -1,14 +1,15 @@
1
+ import type { FailureReason } from '../../domain/_shared/failure-kind.js';
1
2
  import type { TextViolation } from '../../domain/_shared/text-check.js';
2
3
  export declare class DrawioUrlUsageError extends Error {
3
- readonly reason: string;
4
- constructor(message: string, reason: string);
4
+ readonly reason: FailureReason;
5
+ constructor(message: string, reason: FailureReason);
5
6
  }
6
7
  export declare class DrawioUrlRuntimeError extends Error {
7
- readonly reason: string;
8
+ readonly reason: FailureReason;
8
9
  readonly violations?: readonly TextViolation[] | undefined;
9
10
  /**
10
11
  reason が text-violation のときの違反の全件。
11
12
  */
12
- constructor(message: string, reason: string, violations?: readonly TextViolation[] | undefined);
13
+ constructor(message: string, reason: FailureReason, violations?: readonly TextViolation[] | undefined);
13
14
  }
14
15
  //# sourceMappingURL=errors.d.ts.map
@@ -1,11 +1,12 @@
1
+ import type { FailureReason } from '../../domain/_shared/failure-kind.js';
1
2
  import { Command } from 'commander';
2
3
  export declare class DrawioExportUsageError extends Error {
3
- readonly reason: string;
4
- constructor(message: string, reason: string);
4
+ readonly reason: FailureReason;
5
+ constructor(message: string, reason: FailureReason);
5
6
  }
6
7
  export declare class DrawioExportRuntimeError extends Error {
7
- readonly reason: string;
8
- constructor(message: string, reason: string);
8
+ readonly reason: FailureReason;
9
+ constructor(message: string, reason: FailureReason);
9
10
  }
10
11
  export interface DrawioExportOptions {
11
12
  readonly icons: string;
@@ -94,7 +95,7 @@ export(または `--print-hash` のハッシュ算出)を実行し、`--json
94
95
  呼び出し元(commander action / MCP ツール)に残るのは「どう見せるか」だけにする。
95
96
  */
96
97
  export declare function executeDrawioExport(inputFile: string, options: Readonly<DrawioExportOptions>, dependencies: DrawioExportDependencies): Promise<DrawioExportExecution>;
97
- export declare function errorToReason(error: unknown): string;
98
+ export declare function errorToReason(error: unknown): FailureReason;
98
99
  /**
99
100
  例外を exit code 規約へ写す(2 = UsageError、1 = それ以外)。
100
101
 
@@ -18,8 +18,6 @@
18
18
  // 1 = RuntimeError (input/output IO failure・icon 未解決・export 失敗)。
19
19
  // 2 = UsageError (invalid option)。
20
20
  // 3 = warnings present (PDF 生成失敗)。
21
- // input/output は CLI 引数として受理する想定で、信頼境界外ではあるが open API 仕様。
22
- /* eslint-disable security/detect-non-literal-fs-filename */
23
21
  import { mkdir, readFile, rm, writeFile } from 'node:fs/promises';
24
22
  import path from 'node:path';
25
23
  import { Command } from 'commander';
@@ -1,3 +1,4 @@
1
+ import type { FailureReason } from '../../domain/_shared/failure-kind.js';
1
2
  import { Command } from 'commander';
2
3
  import type { LintText } from '../../domain/_shared/text-check.js';
3
4
  import type { ThemeFiles } from '../../domain/slidev-theme/ports.js';
@@ -109,7 +110,7 @@ export declare function executeDrawioUrl(inputFile: string, options: Readonly<Dr
109
110
  /**
110
111
  失敗の reason。テーマの解決・取得・宣言・指定の失敗は `theme-<reason>`(`themeErrorReason`)にする。
111
112
  */
112
- export declare function errorToReason(error: unknown): string;
113
+ export declare function errorToReason(error: unknown): FailureReason;
113
114
  /**
114
115
  `--json` のエラーイベントと MCP の data に載せる内容。CLI と MCP が同じ組み立てを使う。
115
116
  */
@@ -6,7 +6,6 @@
6
6
  // 1 = RuntimeError (input/output IO failure、文面の違反、文章規則の判定の失敗、解けないテーマ)。
7
7
  // 2 = UsageError (invalid option / -o の拡張子が .html でない / テーマの指定の誤り)。
8
8
  // 3 = warnings present (validateHtml の warning or icon resolver warn が 1 件以上)。
9
- /* eslint-disable security/detect-non-literal-fs-filename -- input は CLI 引数として受理する想定。信頼境界外だが open API 仕様 */
10
9
  import { performance } from 'node:perf_hooks';
11
10
  import { mkdir, readFile, writeFile } from 'node:fs/promises';
12
11
  import path from 'node:path';
@@ -1,3 +1,4 @@
1
+ import type { FailureReason } from '../../domain/_shared/failure-kind.js';
1
2
  import { Command } from 'commander';
2
3
  import type { LintText, TextViolation } from '../../domain/_shared/text-check.js';
3
4
  import type { NormalizedEvidenceSpec } from '../../domain/evidence-xlsx/spec-schema.js';
@@ -61,7 +62,7 @@ CLI の action と MCP ツールはどちらもこの関数を呼ぶ (実行と
61
62
  export declare function executeEvidenceCreate(options: Readonly<EvidenceCreateOptions>, dependencies: EvidenceCreateDependencies): Promise<EvidenceCreateResultData>;
62
63
  export declare function createEvidenceCreateCommand(buildDependencies: () => EvidenceCreateDependencies): Command;
63
64
  export declare function evidenceCreateDefaultDependencies(): EvidenceCreateDependencies;
64
- export declare function errorToReason(error: unknown): string;
65
+ export declare function errorToReason(error: unknown): FailureReason;
65
66
  /**
66
67
  `--json` のエラーイベントと MCP の data に載せる内容。CLI と MCP が同じ組み立てを使う。
67
68
  */
@@ -8,7 +8,6 @@
8
8
  // output-write-failed では、部分生成物が残り得る。
9
9
  // 2 = commander の usage エラー。required option 未指定などが当たり、cli.ts の main が変換する。
10
10
  // ただし --help / --version は commander の想定内終了なので exit 0 とする。
11
- /* eslint-disable security/detect-non-literal-fs-filename -- --input / --out は CLI 引数として受理する仕様 */
12
11
  import { readFile } from 'node:fs/promises';
13
12
  import path from 'node:path';
14
13
  import { Command } from 'commander';
@@ -1,3 +1,4 @@
1
+ import type { FailureReason } from '../../domain/_shared/failure-kind.js';
1
2
  import { Command } from 'commander';
2
3
  import { type PreviewDivergenceFinding } from '../../domain/pptx-ooxml/preview-normalize.js';
3
4
  import type { PdfConverter, PptxArchive, XmlEngine } from '../../domain/_shared/ports.js';
@@ -31,8 +32,8 @@ export interface PreviewResultSummary {
31
32
  readonly durationMs: number;
32
33
  }
33
34
  export declare class PreviewRuntimeError extends Error {
34
- readonly reason: string;
35
- constructor(message: string, reason: string);
35
+ readonly reason: FailureReason;
36
+ constructor(message: string, reason: FailureReason);
36
37
  }
37
38
  export declare function runPreview(inputPath: string, options: Readonly<PreviewOptions>, dependencies: PreviewDependencies): Promise<PreviewResultSummary>;
38
39
  export interface PptxPreviewOptions {
@@ -66,7 +67,7 @@ export declare function executePptxPreview(options: Readonly<PptxPreviewOptions>
66
67
  本コマンド自身が設定するのは 1 のみ。
67
68
  */
68
69
  export declare const PPTX_PREVIEW_FAILURE_EXIT_CODE = 1;
69
- export declare function errorToReason(error: unknown): string;
70
+ export declare function errorToReason(error: unknown): FailureReason;
70
71
  export declare function createPptxPreviewCommand(buildDependencies: () => PreviewDependencies): Command;
71
72
  export declare function pptxPreviewDefaultDependencies(): PreviewDependencies;
72
73
  export {};
@@ -6,9 +6,6 @@
6
6
  // 全 entry を読み取り、slide part のみプレビュー正規化 (noAutofit + wrap=square) して mkdtemp に一時 PPTX を書き出す。
7
7
  // soffice で PDF 化して --out へ copy する。一時 dir は finally で必ず削除する。
8
8
  // 成果物生成ルート (slide convert) には組み込まない。
9
- // 出力 path / report path / mkdtemp 先は CLI 引数由来で、リテラルではない。
10
- // 本コマンド自身が出力先を生成する責務を持つため、本ファイル全体で security/detect-non-literal-fs-filename を disable する。
11
- /* eslint-disable security/detect-non-literal-fs-filename */
12
9
  import { performance } from 'node:perf_hooks';
13
10
  import { createHash } from 'node:crypto';
14
11
  import { copyFile, mkdir, mkdtemp, readFile, rm, stat, writeFile } from 'node:fs/promises';
@@ -1,3 +1,4 @@
1
+ import type { FailureReason } from '../../domain/_shared/failure-kind.js';
1
2
  import { Command } from 'commander';
2
3
  import type { ThemeFiles } from '../../domain/slidev-theme/ports.js';
3
4
  import type { LayoutCatalog } from '../../domain/slidev-theme/references.js';
@@ -101,7 +102,7 @@ export declare function emitLayoutCatalog(catalog: Readonly<Pick<LayoutCatalog,
101
102
  /**
102
103
  失敗の reason。テーマの取得・宣言・指定の失敗は `theme-<reason>`(`themeErrorReason`)にする。
103
104
  */
104
- export declare function errorToReason(error: unknown): string;
105
+ export declare function errorToReason(error: unknown): FailureReason;
105
106
  /**
106
107
  失敗時の exit code。usage error(引数の誤り、テーマの指定の誤り)= 2、それ以外の実行失敗 = 1。
107
108
  */
@@ -4,7 +4,6 @@
4
4
  // 続けて、生成先の確認 → slides.md と package.json の生成 → 初期ページ → public/slides。
5
5
  // その後、vite.config.ts と start.mjs の生成 → node_modules の組み立て(実ディレクトリと項目ごとの相対 symlink)。
6
6
  // 組み立ては同じ親の下の一時 dir で行い、最後に入れ替える。失敗したら一時 dir を消す。
7
- /* eslint-disable security/detect-non-literal-fs-filename */
8
7
  import { randomBytes } from 'node:crypto';
9
8
  import { performance } from 'node:perf_hooks';
10
9
  import { mkdir, rename, rm, writeFile } from 'node:fs/promises';
@@ -1,3 +1,4 @@
1
+ import type { FailureReason } from '../../domain/_shared/failure-kind.js';
1
2
  import { Command } from 'commander';
2
3
  import type { EslintRunner, SlideLintSummary } from '../../domain/slidev-project/lint.js';
3
4
  export interface SlideLintOptions {
@@ -73,7 +74,7 @@ export declare function writeAutoDeckLintReport(report: Readonly<AutoDeckLintRep
73
74
  `--json` 出力の `slide.create.done` / `slide.sync.done` に載せる lint 要約フィールド。
74
75
  */
75
76
  export declare function autoDeckLintJsonField(report: Readonly<AutoDeckLintReport>): Readonly<Record<string, unknown>>;
76
- export declare function errorToReason(error: unknown): string;
77
+ export declare function errorToReason(error: unknown): FailureReason;
77
78
  export declare function isUsageError(error: unknown): boolean;
78
79
  /**
79
80
  失敗時の exit code。usage error = 2、それ以外の実行失敗 = 1(違反ありの 1 は成功ルート)。
@@ -1,3 +1,4 @@
1
+ import type { FailureReason } from '../../domain/_shared/failure-kind.js';
1
2
  import { Command } from 'commander';
2
3
  import type { ThemeFiles } from '../../domain/slidev-theme/ports.js';
3
4
  import { fetchTheme } from '../../infra/slidev-theme/store.js';
@@ -72,7 +73,7 @@ export interface SlideSyncExecution {
72
73
  ここで書き、違反一覧より先に出す。MCP ツールは渡さない。
73
74
  */
74
75
  export declare function executeSlideSync(options: Readonly<SlideSyncOptions>, dependencies: SlideSyncDependencies, onSynced?: (summary: Readonly<SlideSyncResultSummary>) => void): Promise<SlideSyncExecution>;
75
- export declare function errorToReason(error: unknown): string;
76
+ export declare function errorToReason(error: unknown): FailureReason;
76
77
  export declare function isUsageError(error: unknown): boolean;
77
78
  /**
78
79
  失敗時の exit code。usage error = 2、それ以外の実行失敗 = 1。
@@ -5,7 +5,6 @@
5
5
  // commander DI / exitOverride / configureOutput.writeErr / 二段例外型は、
6
6
  // slidev-project/create.ts を踏襲する。
7
7
  // 実体ロジックは domain/slidev-project/sync.ts、fs 操作は infra/slidev-project/fs.ts に分離している。
8
- /* eslint-disable security/detect-non-literal-fs-filename */
9
8
  import { readFile, writeFile } from 'node:fs/promises';
10
9
  import path from 'node:path';
11
10
  import { Command } from 'commander';
@@ -1,3 +1,4 @@
1
+ import type { FailureReason } from '../../domain/_shared/failure-kind.js';
1
2
  import { Command } from 'commander';
2
3
  import type { ResolvedThemeDeclaration } from '../../domain/slidev-theme/declaration.js';
3
4
  import type { DeckLintInput } from '../../domain/slidev-theme/deck-lint-input.js';
@@ -46,7 +47,7 @@ export declare function executeSlideTheme(options: Readonly<SlideThemeOptions>,
46
47
  失敗の reason。テーマに関わる例外は `theme-<reason>` で、それ以外は `unknown`。
47
48
  変換は domain の `themeErrorReason` が 1 か所で持つ。
48
49
  */
49
- export declare function errorToReason(error: unknown): string;
50
+ export declare function errorToReason(error: unknown): FailureReason;
50
51
  /**
51
52
  commander コマンドファクトリ。コマンド名は `theme`、`slide` グループ配下に登録する想定。
52
53
 
@@ -1,3 +1,4 @@
1
+ import type { FailureReason } from '../../domain/_shared/failure-kind.js';
1
2
  import { Command } from 'commander';
2
3
  import type { PptxArchive, SlidevPptxPipeline, SlidevRunner, XmlEngine } from '../../domain/_shared/ports.js';
3
4
  import type { PipelineCacheSummary, PipelineError, PipelineTiming } from '../../domain/slidev-to-pptx/types.js';
@@ -117,11 +118,11 @@ export interface OuterTiming {
117
118
  readonly mergeAndPostprocess: number;
118
119
  }
119
120
  export declare class SlideConvertUsageError extends Error {
120
- readonly reason: string;
121
- constructor(message: string, reason: string);
121
+ readonly reason: FailureReason;
122
+ constructor(message: string, reason: FailureReason);
122
123
  }
123
124
  export declare class SlideConvertRuntimeError extends Error {
124
- readonly reason: string;
125
+ readonly reason: FailureReason;
125
126
  /**
126
127
  pipeline が積んだ警告。throw の時点では未取得なこともあるため後付けで代入する
127
128
  (新インスタンスに作り直すと、実際に失敗した位置の stack を失う)。
@@ -131,11 +132,11 @@ export declare class SlideConvertRuntimeError extends Error {
131
132
  pipeline が積んだ変換エラー(スライド単位・要素単位)。warnings と同じく後付けで代入する。
132
133
  */
133
134
  pipelineErrors?: readonly PipelineError[];
134
- constructor(message: string, reason: string);
135
+ constructor(message: string, reason: FailureReason);
135
136
  }
136
137
  export declare function validateTheme(theme: string): void;
137
138
  export declare function runSlideConvert(projectDirectory: string, options: Readonly<SlideConvertOptions>, dependencies: SlideConvertDependencies): Promise<SlideConvertResultSummary>;
138
- export declare function errorToReason(error: unknown): string;
139
+ export declare function errorToReason(error: unknown): FailureReason;
139
140
  /**
140
141
  失敗時の exit code。usage error = 2、それ以外の実行失敗 = 1。
141
142
  */
@@ -4,10 +4,6 @@
4
4
  // pipeline の実装は `infra/slidev-to-pptx/InProcessSlidevPptxPipeline`。
5
5
  // cli 側の純粋ロジック `domain/pptx-ooxml/merge.ts` で結合して --out に書き出す。
6
6
  // SlidevRunner / SlidevPptxPipeline は port 経由で DI される (tech-advisor B1)。
7
- // 出力 path / 中間 mkdir 先は CLI 引数由来で、リテラルではない。
8
- // 本コマンド自身が出力ディレクトリを生成する責務を持つ。
9
- // そのため本ファイル全体で security/detect-non-literal-fs-filename を disable する。
10
- /* eslint-disable security/detect-non-literal-fs-filename */
11
7
  import { performance } from 'node:perf_hooks';
12
8
  import { access, readFile, mkdir, readdir, rm, stat } from 'node:fs/promises';
13
9
  import path from 'node:path';
@@ -0,0 +1,13 @@
1
+ export declare const FAILURE_KINDS: readonly ['broken-reference', 'cancelled', 'chromium-host-deps-missing', 'chromium-install-failed', 'chromium-not-installed', 'copy-failed', 'dest-exists', 'dev-server-cancelled', 'dev-server-exited', 'dev-server-port-in-use', 'dev-server-spawn-failed', 'dev-server-timeout', 'dir-not-found', 'eslint-failed', 'eslint-not-launched', 'eslint-timeout', 'export-failed', 'file-exists', 'icon-unresolved', 'input-not-found', 'invalid-file-name', 'invalid-json', 'invalid-option', 'invalid-output-extension', 'invalid-path', 'invalid-report', 'invalid-spec', 'invalid-staging-json', 'invalid-theme', 'merge-failed', 'migrate-failed', 'no-valid-images', 'node-modules-unresolved', 'not-a-directory', 'not-talk-dir', 'numeric-filename-prefix', 'output-write-failed', 'pptx-convert-failed', 'pptx-convert-timeout', 'project-not-found', 'reference-read-failed', 'runtime-dependencies-not-installed', 'runtime-install-failed', 'skeleton-unavailable', 'slides-md-not-found', 'slidev-build-failed', 'slidev-build-timeout', 'symlink-failed', 'talk-dir-not-found', 'text-lint-failed', 'text-violation', 'theme-auth', 'theme-connection', 'theme-install', 'theme-invalid-shape', 'theme-name-mismatch', 'theme-none', 'theme-required', 'theme-root', 'theme-semver-range', 'theme-tag', 'theme-tag-format', 'theme-tag-required', 'theme-unknown', 'theme-unknown-rule', 'theme-unlinked', 'theme-unsupported-spec', 'theme-with-node-modules-only', 'unknown', 'unknown-layout', 'write-failed'];
2
+ export type FailureKind = typeof FAILURE_KINDS[number];
3
+ export declare const CLI_ONLY_FAILURE_REASONS: readonly ['input-mutated', 'input-open-failed', 'invalid-mode', 'invalid-morph-option', 'invalid-transition-duration-ms', 'invalid-transition-type', 'missing-icons-root', 'missing-option', 'relative-dir', 'soffice-conversion-failed', 'soffice-not-found', 'soffice-timeout'];
4
+ /**
5
+ CLI の `--json` の `reason` に載る失敗の名前。MCP は failureKindOf で kind に写して返す。
6
+ */
7
+ export type FailureReason = FailureKind | typeof CLI_ONLY_FAILURE_REASONS[number];
8
+ export declare function isFailureKind(reason: string): reason is FailureKind;
9
+ /**
10
+ MCP の結果の `kind`。CLI だけの名前は MCP に届かないが、届いたときは `unknown` にする。
11
+ */
12
+ export declare function failureKindOf(reason: FailureReason): FailureKind;
13
+ //# sourceMappingURL=failure-kind.d.ts.map
@@ -0,0 +1,103 @@
1
+ // MCP ツールが失敗の結果の `kind` で返しうる名前の一覧。
2
+ // 定義書の exit_status[].kind の集合との一致は、failure-kinds-definition.test.ts が確かめる。
3
+ // eslint-disable-next-line no-restricted-syntax -- 名前の一覧から型を作るため、要素をリテラルの型のまま残す
4
+ export const FAILURE_KINDS = [
5
+ 'broken-reference',
6
+ 'cancelled',
7
+ 'chromium-host-deps-missing',
8
+ 'chromium-install-failed',
9
+ 'chromium-not-installed',
10
+ 'copy-failed',
11
+ 'dest-exists',
12
+ 'dev-server-cancelled',
13
+ 'dev-server-exited',
14
+ 'dev-server-port-in-use',
15
+ 'dev-server-spawn-failed',
16
+ 'dev-server-timeout',
17
+ 'dir-not-found',
18
+ 'eslint-failed',
19
+ 'eslint-not-launched',
20
+ 'eslint-timeout',
21
+ 'export-failed',
22
+ 'file-exists',
23
+ 'icon-unresolved',
24
+ 'input-not-found',
25
+ 'invalid-file-name',
26
+ 'invalid-json',
27
+ 'invalid-option',
28
+ 'invalid-output-extension',
29
+ 'invalid-path',
30
+ 'invalid-report',
31
+ 'invalid-spec',
32
+ 'invalid-staging-json',
33
+ 'invalid-theme',
34
+ 'merge-failed',
35
+ 'migrate-failed',
36
+ 'no-valid-images',
37
+ 'node-modules-unresolved',
38
+ 'not-a-directory',
39
+ 'not-talk-dir',
40
+ 'numeric-filename-prefix',
41
+ 'output-write-failed',
42
+ 'pptx-convert-failed',
43
+ 'pptx-convert-timeout',
44
+ 'project-not-found',
45
+ 'reference-read-failed',
46
+ 'runtime-dependencies-not-installed',
47
+ 'runtime-install-failed',
48
+ 'skeleton-unavailable',
49
+ 'slides-md-not-found',
50
+ 'slidev-build-failed',
51
+ 'slidev-build-timeout',
52
+ 'symlink-failed',
53
+ 'talk-dir-not-found',
54
+ 'text-lint-failed',
55
+ 'text-violation',
56
+ 'theme-auth',
57
+ 'theme-connection',
58
+ 'theme-install',
59
+ 'theme-invalid-shape',
60
+ 'theme-name-mismatch',
61
+ 'theme-none',
62
+ 'theme-required',
63
+ 'theme-root',
64
+ 'theme-semver-range',
65
+ 'theme-tag',
66
+ 'theme-tag-format',
67
+ 'theme-tag-required',
68
+ 'theme-unknown',
69
+ 'theme-unknown-rule',
70
+ 'theme-unlinked',
71
+ 'theme-unsupported-spec',
72
+ 'theme-with-node-modules-only',
73
+ 'unknown',
74
+ 'unknown-layout',
75
+ 'write-failed',
76
+ ];
77
+ // CLI の引数の解釈と、MCP ツールの無いコマンド(pptx preview)だけが `--json` の reason に出す名前。
78
+ // MCP は引数を inputSchema と parsePathArguments で先に確かめるため、これらは返らない。
79
+ // eslint-disable-next-line no-restricted-syntax -- 名前の一覧から型を作るため、要素をリテラルの型のまま残す
80
+ export const CLI_ONLY_FAILURE_REASONS = [
81
+ 'input-mutated',
82
+ 'input-open-failed',
83
+ 'invalid-mode',
84
+ 'invalid-morph-option',
85
+ 'invalid-transition-duration-ms',
86
+ 'invalid-transition-type',
87
+ 'missing-icons-root',
88
+ 'missing-option',
89
+ 'relative-dir',
90
+ 'soffice-conversion-failed',
91
+ 'soffice-not-found',
92
+ 'soffice-timeout',
93
+ ];
94
+ export function isFailureKind(reason) {
95
+ return FAILURE_KINDS.some(kind => kind === reason);
96
+ }
97
+ /**
98
+ MCP の結果の `kind`。CLI だけの名前は MCP に届かないが、届いたときは `unknown` にする。
99
+ */
100
+ export function failureKindOf(reason) {
101
+ return isFailureKind(reason) ? reason : 'unknown';
102
+ }
103
+ //# sourceMappingURL=failure-kind.js.map
@@ -1,9 +1,10 @@
1
+ import type { FailureReason } from '../_shared/failure-kind.js';
1
2
  export declare class SlideCreateUsageError extends Error {
2
- readonly reason: string;
3
- constructor(message: string, reason: string);
3
+ readonly reason: FailureReason;
4
+ constructor(message: string, reason: FailureReason);
4
5
  }
5
6
  export declare class SlideCreateRuntimeError extends Error {
6
- readonly reason: string;
7
- constructor(message: string, reason: string);
7
+ readonly reason: FailureReason;
8
+ constructor(message: string, reason: FailureReason);
8
9
  }
9
10
  //# sourceMappingURL=errors.d.ts.map
@@ -1,7 +1,11 @@
1
- import { ThemeDeclarationError } from './declaration.js';
2
- import { ThemeFetchError } from './store-layout.js';
3
- import { ThemeResolveError } from './talk-theme.js';
4
- import { ThemeSpecError } from './theme-spec.js';
1
+ import { ThemeDeclarationError, type ThemeDeclarationErrorReason } from './declaration.js';
2
+ import { ThemeFetchError, type ThemeFetchErrorReason } from './store-layout.js';
3
+ import { ThemeResolveError, type ThemeResolveErrorReason } from './talk-theme.js';
4
+ import { ThemeSpecError, type ThemeSpecErrorReason } from './theme-spec.js';
5
+ /**
6
+ テーマの失敗の reason。`ThemeResolveError` の reason は最初から `theme-` を含む。
7
+ */
8
+ export type ThemeErrorReason = ThemeResolveErrorReason | `theme-${ThemeFetchErrorReason | ThemeDeclarationErrorReason | ThemeSpecErrorReason}`;
5
9
  export type ThemeError = ThemeResolveError | ThemeDeclarationError | ThemeFetchError | ThemeSpecError;
6
10
  /**
7
11
  テーマの解決・宣言・取得・指定のどれかの例外か。
@@ -11,5 +15,5 @@ export declare function isThemeError(error: unknown): error is ThemeError;
11
15
  失敗の reason。テーマに関わる例外だけ `theme-<reason>` の形で返し、それ以外は undefined。
12
16
  `ThemeResolveError` の reason は最初から `theme-` を含むので、そのまま返す。
13
17
  */
14
- export declare function themeErrorReason(error: unknown): string | undefined;
18
+ export declare function themeErrorReason(error: unknown): ThemeErrorReason | undefined;
15
19
  //# sourceMappingURL=error-reason.d.ts.map
@@ -86,8 +86,8 @@ create / sync は deps 経由で依存ルートを受け取っており、その
86
86
  判定は `node_modules` の実在ではなく、代表パッケージ(RUNTIME_DEPENDENCY_PROBES)が
87
87
  その `node_modules` 配下から引けるかで行う。
88
88
  areRuntimeDependenciesInstalled と基準を揃え、次の食い違いを避ける。
89
- npm が版衝突で `<配布パッケージ>/node_modules` を掘った場合に、
90
- symlink は依存を含まないツリーを指すのに、setup は永続層へ install する状態になる。
89
+ npm が版衝突で `<配布パッケージ>/node_modules` を掘ると、symlink は依存を含まないツリーを指す。
90
+ 一方で runtime_setup は永続層へ install する。
91
91
  */
92
92
  export declare function resolveTalkDirectoryNodeModules(dependencyRoot: string): string | undefined;
93
93
  /**
@@ -126,7 +126,7 @@ export declare function runtimeInstallStampPath(): string | undefined;
126
126
 
127
127
  同梱依存(プラグイン配布)を先に見る。
128
128
  本モジュール自身の位置も基準に含めるのは、CLAUDE_PLUGIN_ROOT が立っていなくても、同梱の node_modules から引けるため。
129
- env の有無で「未取得」と誤判定して、`setup` が 600MB の npm install を始めるのを防ぐ。
129
+ env の有無で「未取得」と誤判定して、`runtime_setup` が 600MB の npm install を始めるのを防ぐ。
130
130
  単体配布では、本モジュールは `_npx/<hash>/node_modules/<pkg>/cli/dist/infra/_shared/` にある。
131
131
  隣の node_modules には起動層しか無いので、この基準では解決できず永続層へ降りる。
132
132
 
@@ -16,7 +16,7 @@
16
16
  // これは MCP クライアントの接続タイムアウトを超える。
17
17
  // Claude Code の MCP_TIMEOUT は既定 30000ms。
18
18
  //
19
- // そこで重量依存だけをデータ置き場の `mcp-dist/node_modules` へ置き、`setup` ツールが取得する。
19
+ // そこで重量依存だけをデータ置き場の `mcp-dist/node_modules` へ置き、`runtime_setup` ツールが取得する。
20
20
  // この領域は npx の作り直しの影響を受けず残る。
21
21
  // chromium が `~/.cache/ms-playwright` を使うのと同じ構造になる。
22
22
  // データ置き場の解決は bin/_lib.sh の plugin_data_dir_resolve と同じ。
@@ -250,8 +250,8 @@ create / sync は deps 経由で依存ルートを受け取っており、その
250
250
  判定は `node_modules` の実在ではなく、代表パッケージ(RUNTIME_DEPENDENCY_PROBES)が
251
251
  その `node_modules` 配下から引けるかで行う。
252
252
  areRuntimeDependenciesInstalled と基準を揃え、次の食い違いを避ける。
253
- npm が版衝突で `<配布パッケージ>/node_modules` を掘った場合に、
254
- symlink は依存を含まないツリーを指すのに、setup は永続層へ install する状態になる。
253
+ npm が版衝突で `<配布パッケージ>/node_modules` を掘ると、symlink は依存を含まないツリーを指す。
254
+ 一方で runtime_setup は永続層へ install する。
255
255
  */
256
256
  export function resolveTalkDirectoryNodeModules(dependencyRoot) {
257
257
  const runtimeRoot = runtimeDependencyRoot();
@@ -297,7 +297,7 @@ function resolveFrom(bases, specifier) {
297
297
  判定できるのは依存ルートの実在だけで、配布形態そのものではない。
298
298
  */
299
299
  export const DEPENDENCY_RECOVERY_HINT = 'for the plugin distribution, delete runtime/ in the data directory and restart pecotv (the dependencies are prepared again); '
300
- + 'for the standalone distribution, call the `setup` tool (it fetches the runtime dependencies)';
300
+ + 'for the standalone distribution, call the `runtime_setup` tool (it fetches the runtime dependencies)';
301
301
  /**
302
302
  実行時依存が揃っているかの判定に使う specifier。
303
303
 
@@ -370,7 +370,7 @@ function readRuntimeInstallStamp() {
370
370
 
371
371
  同梱依存(プラグイン配布)を先に見る。
372
372
  本モジュール自身の位置も基準に含めるのは、CLAUDE_PLUGIN_ROOT が立っていなくても、同梱の node_modules から引けるため。
373
- env の有無で「未取得」と誤判定して、`setup` が 600MB の npm install を始めるのを防ぐ。
373
+ env の有無で「未取得」と誤判定して、`runtime_setup` が 600MB の npm install を始めるのを防ぐ。
374
374
  単体配布では、本モジュールは `_npx/<hash>/node_modules/<pkg>/cli/dist/infra/_shared/` にある。
375
375
  隣の node_modules には起動層しか無いので、この基準では解決できず永続層へ降りる。
376
376
 
@@ -66,7 +66,7 @@ export interface InstallRuntimeDependenciesOptions {
66
66
  /**
67
67
  永続層へ実行時依存を install する。取得先は無ければここで作る。
68
68
  `--prefix` を使うには install 先に package.json が要る(無いと npm は上位へ遡る)ので、毎回書き直す。
69
- 複数セッションの `setup` が並走し得るため、flock(1) で直列化する(無い環境ではロックなし)。
69
+ 複数セッションの `runtime_setup` が並走し得るため、flock(1) で直列化する(無い環境ではロックなし)。
70
70
  stamp は成功時だけ置き、先に消す。途中で失敗した残骸を取得済みと誤判定させないため。
71
71
  manifest から plan を組めないときは、起動失敗(exitCode: null, failedStage: 'npm')として返す。
72
72
  */
@@ -136,7 +136,7 @@ export function runtimeInstallLockPath() {
136
136
  /**
137
137
  永続層へ実行時依存を install する。取得先は無ければここで作る。
138
138
  `--prefix` を使うには install 先に package.json が要る(無いと npm は上位へ遡る)ので、毎回書き直す。
139
- 複数セッションの `setup` が並走し得るため、flock(1) で直列化する(無い環境ではロックなし)。
139
+ 複数セッションの `runtime_setup` が並走し得るため、flock(1) で直列化する(無い環境ではロックなし)。
140
140
  stamp は成功時だけ置き、先に消す。途中で失敗した残骸を取得済みと誤判定させないため。
141
141
  manifest から plan を組めないときは、起動失敗(exitCode: null, failedStage: 'npm')として返す。
142
142
  */