@pecot/visual-mcp 1.3.0 → 2.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.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +44 -14
- package/assets/slidev/package.json +2 -2
- package/assets/slidev/runtime/package.json +1 -1
- package/cli/dist/commands/drawio/errors.d.ts +5 -4
- package/cli/dist/commands/drawio/export.d.ts +6 -5
- package/cli/dist/commands/drawio/export.js +0 -2
- package/cli/dist/commands/drawio/url.d.ts +2 -1
- package/cli/dist/commands/drawio/url.js +0 -1
- package/cli/dist/commands/evidence-xlsx/create.d.ts +2 -1
- package/cli/dist/commands/evidence-xlsx/create.js +0 -1
- package/cli/dist/commands/pptx-ooxml/preview.d.ts +4 -3
- package/cli/dist/commands/pptx-ooxml/preview.js +0 -3
- package/cli/dist/commands/slidev-project/create.d.ts +2 -1
- package/cli/dist/commands/slidev-project/create.js +0 -1
- package/cli/dist/commands/slidev-project/lint.d.ts +2 -1
- package/cli/dist/commands/slidev-project/sync.d.ts +2 -1
- package/cli/dist/commands/slidev-project/sync.js +0 -1
- package/cli/dist/commands/slidev-project/theme.d.ts +2 -1
- package/cli/dist/commands/slidev-to-pptx/convert.d.ts +6 -5
- package/cli/dist/commands/slidev-to-pptx/convert.js +0 -4
- package/cli/dist/domain/_shared/failure-kind.d.ts +13 -0
- package/cli/dist/domain/_shared/failure-kind.js +103 -0
- package/cli/dist/domain/evidence-xlsx/layout.d.ts +2 -3
- package/cli/dist/domain/evidence-xlsx/ooxml.d.ts +1 -8
- package/cli/dist/domain/evidence-xlsx/ooxml.js +35 -24
- package/cli/dist/domain/slidev-project/errors.d.ts +5 -4
- package/cli/dist/domain/slidev-theme/error-reason.d.ts +9 -5
- package/cli/dist/infra/_shared/dependency-root.d.ts +3 -3
- package/cli/dist/infra/_shared/dependency-root.js +5 -5
- package/cli/dist/infra/_shared/runtime-install.d.ts +1 -1
- package/cli/dist/infra/_shared/runtime-install.js +1 -1
- package/cli/dist/infra/_shared/slidev-bin.d.ts +1 -1
- package/cli/dist/infra/_shared/slidev-bin.js +1 -1
- package/cli/dist/infra/playwright/chromium.js +2 -2
- package/cli/dist/infra/playwright/host-dependencies.js +1 -1
- package/cli/dist/infra/playwright/launch.js +1 -1
- package/cli/dist/infra/slidev-to-pptx/pipeline.js +1 -1
- package/cli/dist/infra/slidev-to-pptx/runner.js +1 -1
- package/cli/dist/mcp/dev-server-registry.d.ts +2 -1
- package/cli/dist/mcp/result.d.ts +19 -5
- package/cli/dist/mcp/result.js +2 -0
- package/cli/dist/mcp/tool-names.d.ts +17 -0
- package/cli/dist/mcp/tool-names.js +26 -0
- package/cli/dist/mcp/tools/_shared.d.ts +4 -3
- package/cli/dist/mcp/tools/_shared.js +10 -6
- package/cli/dist/mcp/tools/drawio.js +8 -3
- package/cli/dist/mcp/tools/evidence.js +3 -1
- package/cli/dist/mcp/tools/setup.d.ts +1 -1
- package/cli/dist/mcp/tools/setup.js +5 -3
- package/cli/dist/mcp/tools/slide-dev.js +4 -1
- package/cli/dist/mcp/tools/slide-page.d.ts +2 -1
- package/cli/dist/mcp/tools/slide-page.js +4 -2
- package/cli/dist/mcp/tools/slide-theme.js +4 -1
- package/cli/dist/mcp/tools/slide.js +4 -2
- package/npm-shrinkwrap.json +113 -60
- package/package.json +1 -1
- package/vendor/text-rules/dist/source-hash +1 -1
package/README.md
CHANGED
|
@@ -26,7 +26,35 @@ MCP クライアントに 1 エントリ登録するだけで pecot-visual の
|
|
|
26
26
|
"mcpServers": {
|
|
27
27
|
"pecot-visual": {
|
|
28
28
|
"command": "npx",
|
|
29
|
-
"args": ["-y", "@pecot/visual-mcp"]
|
|
29
|
+
"args": ["-y", "--prefix=/", "@pecot/visual-mcp"]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`--prefix=/` は、pnpm の `devEngines` を宣言したリポジトリの中で起動しても止まらないようにするための指定です。
|
|
36
|
+
`--prefix` を付けないと、そのリポジトリを cwd にした npx が `EBADDEVENGINES` で止まります。
|
|
37
|
+
npm には devEngines の判定だけを外す公式の手段が無く、要望(npm/rfcs#830)は not_planned で閉じています。
|
|
38
|
+
|
|
39
|
+
パッケージは `--package=` ではなく、位置引数で渡してください。
|
|
40
|
+
`--package=` で渡すと、npm が `npm_config_package` をサーバの子プロセスに残します。
|
|
41
|
+
すると、テーマの依存の取得(pnpm と corepack のどちらも無いとき)が打つ npx が、これを読んで別のパッケージを実行します。
|
|
42
|
+
|
|
43
|
+
`--prefix=/` には次の副作用があります。
|
|
44
|
+
|
|
45
|
+
- 利用者のリポジトリの `.npmrc` を読まず、globalconfig も `/etc/npmrc` になる。registry・proxy・cafile は `~/.npmrc` に置く
|
|
46
|
+
- `npm_config_prefix=/` などの環境変数がサーバに引き継がれる。サーバの子で `npm i -g` を打つと `/lib/node_modules` を向く
|
|
47
|
+
|
|
48
|
+
`runtime_setup` は `npm install --prefix` で置き場を明示します。
|
|
49
|
+
テーマの依存の取得(pnpm)は、talk-dir を cwd か `--dir` で指します。どちらも、この副作用の影響を受けません。
|
|
50
|
+
|
|
51
|
+
この副作用を避けたいときは、先に `npm i -g @pecot/visual-mcp` で入れて、コマンドを直接登録します。
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"mcpServers": {
|
|
56
|
+
"pecot-visual": {
|
|
57
|
+
"command": "pecot-visual-mcp"
|
|
30
58
|
}
|
|
31
59
|
}
|
|
32
60
|
}
|
|
@@ -40,7 +68,7 @@ MCP クライアントに 1 エントリ登録するだけで pecot-visual の
|
|
|
40
68
|
"mcpServers": {
|
|
41
69
|
"pecot-visual": {
|
|
42
70
|
"command": "npx",
|
|
43
|
-
"args": ["-y", "@pecot/visual-mcp"],
|
|
71
|
+
"args": ["-y", "--prefix=/", "@pecot/visual-mcp"],
|
|
44
72
|
"env": { "PLUGIN_DATA": "/home/<user>/pecot-visual-data" }
|
|
45
73
|
}
|
|
46
74
|
}
|
|
@@ -54,7 +82,7 @@ Windows の MCP クライアントから使う場合は WSL2 経由で起動し
|
|
|
54
82
|
"mcpServers": {
|
|
55
83
|
"pecot-visual": {
|
|
56
84
|
"command": "wsl",
|
|
57
|
-
"args": ["npx", "-y", "@pecot/visual-mcp"]
|
|
85
|
+
"args": ["npx", "-y", "--prefix=/", "@pecot/visual-mcp"]
|
|
58
86
|
}
|
|
59
87
|
}
|
|
60
88
|
}
|
|
@@ -67,14 +95,14 @@ WSL 側に `PLUGIN_DATA` を渡すには、`env` を `args` に含めます。Wi
|
|
|
67
95
|
"mcpServers": {
|
|
68
96
|
"pecot-visual": {
|
|
69
97
|
"command": "wsl",
|
|
70
|
-
"args": ["env", "PLUGIN_DATA=/home/<user>/pecot-visual-data", "npx", "-y", "@pecot/visual-mcp"]
|
|
98
|
+
"args": ["env", "PLUGIN_DATA=/home/<user>/pecot-visual-data", "npx", "-y", "--prefix=/", "@pecot/visual-mcp"]
|
|
71
99
|
}
|
|
72
100
|
}
|
|
73
101
|
}
|
|
74
102
|
```
|
|
75
103
|
|
|
76
104
|
WSL 内の npx が非ログインシェルの PATH に無い場合は、次のように指定します。
|
|
77
|
-
`"args": ["-e", "bash", "-lc", "npx -y @pecot/visual-mcp"]`
|
|
105
|
+
`"args": ["-e", "bash", "-lc", "npx -y --prefix=/ @pecot/visual-mcp"]`
|
|
78
106
|
|
|
79
107
|
ツールのパス引数には `C:\...` と `\\wsl.localhost\<distro>\...` をそのまま渡せます。
|
|
80
108
|
変換の対象はツール引数のみです。spec ファイル等の中身に書かれたパスは変換しません。
|
|
@@ -87,33 +115,33 @@ WSL 内の絶対パス(例: `/home/alice/deck`)で返ります。
|
|
|
87
115
|
|
|
88
116
|
## 初回の操作
|
|
89
117
|
|
|
90
|
-
`
|
|
118
|
+
`runtime_setup` ツールを 1 回呼んでください。スライド変換・スクリーンショット系が使う重量依存
|
|
91
119
|
(Slidev / dom-to-pptx / Chromium、所要は約 80 秒)を取得します。取得結果は永続し、
|
|
92
120
|
サーバを再起動しても再実行は不要です。
|
|
93
121
|
|
|
94
122
|
依存は `$XDG_DATA_HOME/pecot/pecot-visual/mcp-dist/` に置きます。
|
|
95
123
|
`XDG_DATA_HOME` が無ければ、`~/.local/share/pecot/pecot-visual/mcp-dist/` に置きます。
|
|
96
124
|
登録の `env` に `PLUGIN_DATA` を書いたときは、そのディレクトリの `mcp-dist/` に置きます。
|
|
97
|
-
置き場を変えたあとは `
|
|
125
|
+
置き場を変えたあとは `runtime_setup` を呼び直してください。
|
|
98
126
|
既存デッキの `node_modules` のリンクは、`slide_sync` で張り直してください。
|
|
99
127
|
|
|
100
128
|
通信を復号するプロキシの配下で使うときは、プロキシの CA 証明書を、Node の環境変数 `NODE_EXTRA_CA_CERTS` に PEM ファイルのパスで渡してください。
|
|
101
|
-
pecot は証明書を同梱しません。登録の `env` に書けば、`
|
|
129
|
+
pecot は証明書を同梱しません。登録の `env` に書けば、`runtime_setup` の取得と、テーマの依存の取得(pnpm)にも使われます。
|
|
102
130
|
WSL 経由で登録するときは、`PLUGIN_DATA` と同じく、`args` の `env` に WSL 側のパスで含めてください。
|
|
103
131
|
|
|
104
|
-
`
|
|
132
|
+
`runtime_setup` 未実行でも使えるツール: `drawio_create` / `evidence_create` / `slide_lint` / `slide_page` / `slide_theme`
|
|
105
133
|
|
|
106
|
-
`
|
|
134
|
+
`runtime_setup` 実行後に使えるツール: `slide_create` / `slide_sync` / `slide_convert` /
|
|
107
135
|
`slide_dev` / `drawio_export`
|
|
108
136
|
|
|
109
|
-
`drawio_create` は URL の生成だけなら `
|
|
110
|
-
Chromium を使うため `
|
|
137
|
+
`drawio_create` は URL の生成だけなら `runtime_setup` は不要ですが、PNG 出力を指定する場合は
|
|
138
|
+
Chromium を使うため `runtime_setup` が必要です。
|
|
111
139
|
|
|
112
140
|
## ツール
|
|
113
141
|
|
|
114
142
|
| ツール | 用途 |
|
|
115
143
|
|---|---|
|
|
116
|
-
| `
|
|
144
|
+
| `runtime_setup` | 永続依存(Slidev ランタイム・Chromium)の取得 |
|
|
117
145
|
| `slide_create` | Slidev プロジェクトの新規作成 |
|
|
118
146
|
| `slide_sync` | テーマを参照する talk-dir は、依存の版でテーマを取得して node_modules を張り直し、生成ファイル(vite.config.ts・start.mjs)を本体の今の内容にそろえる。旧形式の talk-dir は `theme` で指定したテーマを参照する形へ移す |
|
|
119
147
|
| `slide_lint` | Slidev ページの ESLint チェック |
|
|
@@ -127,7 +155,9 @@ Chromium を使うため `setup` が必要です。
|
|
|
127
155
|
|
|
128
156
|
## 失敗したとき
|
|
129
157
|
|
|
130
|
-
`
|
|
158
|
+
`runtime_setup` が必要なツールを `runtime_setup` 前に呼ぶと、`runtime_setup` を案内する応答が返ります。`runtime_setup` を呼んでから再実行してください。
|
|
159
|
+
|
|
160
|
+
`EBADDEVENGINES` で止まるときは、登録の `args` に `--prefix=/` が付いているか確認してください。
|
|
131
161
|
|
|
132
162
|
## 版
|
|
133
163
|
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"c8": "^12.0.0",
|
|
33
33
|
"eslint": "^10.14.0",
|
|
34
34
|
"eslint-config-prettier": "^10.1.8",
|
|
35
|
-
"eslint-plugin-vue": "^10.12.
|
|
35
|
+
"eslint-plugin-vue": "^10.12.1",
|
|
36
36
|
"globals": "^17.14.0",
|
|
37
37
|
"jszip": "^3.10.2",
|
|
38
38
|
"playwright": "^1.65.0",
|
|
39
39
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
40
|
-
"typescript-eslint": "^8.72.
|
|
40
|
+
"typescript-eslint": "^8.72.2",
|
|
41
41
|
"typescript7": "npm:typescript@^7.0.2",
|
|
42
42
|
"vue-eslint-parser": "^10.4.2",
|
|
43
43
|
"yaml": "^2.9.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:
|
|
4
|
-
constructor(message: string, reason:
|
|
4
|
+
readonly reason: FailureReason;
|
|
5
|
+
constructor(message: string, reason: FailureReason);
|
|
5
6
|
}
|
|
6
7
|
export declare class DrawioUrlRuntimeError extends Error {
|
|
7
|
-
readonly reason:
|
|
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:
|
|
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:
|
|
4
|
-
constructor(message: string, reason:
|
|
4
|
+
readonly reason: FailureReason;
|
|
5
|
+
constructor(message: string, reason: FailureReason);
|
|
5
6
|
}
|
|
6
7
|
export declare class DrawioExportRuntimeError extends Error {
|
|
7
|
-
readonly reason:
|
|
8
|
-
constructor(message: string, reason:
|
|
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):
|
|
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):
|
|
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):
|
|
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:
|
|
35
|
-
constructor(message: string, reason:
|
|
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):
|
|
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):
|
|
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):
|
|
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):
|
|
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):
|
|
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:
|
|
121
|
-
constructor(message: string, reason:
|
|
121
|
+
readonly reason: FailureReason;
|
|
122
|
+
constructor(message: string, reason: FailureReason);
|
|
122
123
|
}
|
|
123
124
|
export declare class SlideConvertRuntimeError extends Error {
|
|
124
|
-
readonly reason:
|
|
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:
|
|
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):
|
|
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` と MCP の `data.reason` に載る失敗の名前。
|
|
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`(と `data.reason`)で返しうる名前の一覧。
|
|
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
|
|
@@ -123,9 +123,8 @@ export interface ImageAnchor {
|
|
|
123
123
|
readonly heightEmu: number;
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
126
|
-
注記図形 1
|
|
127
|
-
|
|
128
|
-
これは pic 側の colOff / rowOff が 0 であることに依存するため、両者は一緒に変える。
|
|
126
|
+
注記図形 1 件の共通部分。オフセットはグループ内の座標 (画像左上が原点) の EMU で、
|
|
127
|
+
`a:off` にそのまま入る。
|
|
129
128
|
*/
|
|
130
129
|
interface AnnotationShapeBase {
|
|
131
130
|
readonly offsetXEmu: number;
|
|
@@ -59,14 +59,7 @@ styles.xml。要素順 `fonts → fills → borders → cellStyleXfs → cellXfs
|
|
|
59
59
|
*/
|
|
60
60
|
export declare function buildStylesXml(): string;
|
|
61
61
|
/**
|
|
62
|
-
drawing1.xml
|
|
63
|
-
`xdr:oneCellAnchor` の子要素順は `xdr:from → xdr:ext → (xdr:pic|xdr:sp) → xdr:clientData`。
|
|
64
|
-
`xdr:pic` の子要素順は `nvPicPr → blipFill → spPr`。
|
|
65
|
-
`r:embed` の rId は placement の並び順で振るため、buildDrawingRelsXml と同じ順で渡す。
|
|
66
|
-
|
|
67
|
-
注記図形は画像と同じアンカーセルに置き、画像左上からの EMU オフセットを
|
|
68
|
-
colOff / rowOff で与える (画像側の colOff / rowOff が 0 であることに依存する)。
|
|
69
|
-
cNvPr の id は画像・注記を通した連番で、drawing 全体で一意にする。
|
|
62
|
+
drawing1.xml。`r:embed` の rId は placement の並び順で振るため、buildDrawingRelsXml と同じ順で渡す。
|
|
70
63
|
*/
|
|
71
64
|
export declare function buildDrawingXml(placements: readonly ImagePlacement[]): string;
|
|
72
65
|
/**
|