@pecot/visual-mcp 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/assets/slidev/deck-lint.config.js +2 -2
  3. package/assets/slidev/deck-lint.env.config.js +2 -2
  4. package/assets/slidev/package.json +7 -7
  5. package/assets/slidev/runtime/package.json +11 -11
  6. package/assets/slidev/scripts/eslint/_shared/dist/lib/drawio-geometry.js +10 -10
  7. package/assets/slidev/scripts/eslint/_shared/dist/lib/text-measurer.d.ts +2 -2
  8. package/assets/slidev/scripts/eslint/_shared/dist/lib/text-measurer.js +4 -4
  9. package/assets/slidev/scripts/eslint/_shared/dist/tsconfig.tsbuildinfo +1 -1
  10. package/assets/slidev/scripts/eslint/_shared/lib/drawio-geometry.ts +10 -10
  11. package/assets/slidev/scripts/eslint/_shared/lib/text-measurer.ts +4 -4
  12. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-content-before-frontmatter.js +1 -1
  13. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-missing-marker-cell.js +4 -4
  14. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-missing-page.js +1 -1
  15. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-numeric-asset-prefix.js +1 -1
  16. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-numeric-filename-prefix.js +1 -1
  17. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-scaled-drawio.js +3 -3
  18. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-triple-hyphen-in-frontmatter.js +3 -3
  19. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-unknown-props.js +3 -3
  20. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/one-slide-per-file.js +1 -1
  21. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/require-matching-length.js +1 -1
  22. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/require-slides-entry.js +1 -1
  23. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/validate-clicks.js +7 -7
  24. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/tsconfig.tsbuildinfo +1 -1
  25. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-content-before-frontmatter.ts +1 -1
  26. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-missing-marker-cell.ts +4 -4
  27. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-missing-page.ts +1 -1
  28. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-numeric-asset-prefix.ts +1 -1
  29. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-numeric-filename-prefix.ts +1 -1
  30. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-scaled-drawio.ts +3 -3
  31. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-triple-hyphen-in-frontmatter.ts +3 -3
  32. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-unknown-props.ts +3 -3
  33. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/one-slide-per-file.ts +1 -1
  34. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/require-matching-length.ts +1 -1
  35. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/require-slides-entry.ts +1 -1
  36. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/validate-clicks.ts +7 -7
  37. package/assets/slidev/scripts/eslint/slidev-pages-lint/package.json +1 -1
  38. package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/max-chars.js +6 -6
  39. package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/textlint-body.js +3 -3
  40. package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/textlint.js +2 -2
  41. package/assets/slidev/scripts/eslint/text-constraints/dist/tsconfig.tsbuildinfo +1 -1
  42. package/assets/slidev/scripts/eslint/text-constraints/lib/rules/max-chars.ts +6 -6
  43. package/assets/slidev/scripts/eslint/text-constraints/lib/rules/textlint-body.ts +3 -3
  44. package/assets/slidev/scripts/eslint/text-constraints/lib/rules/textlint.ts +2 -2
  45. package/assets/slidev/scripts/eslint/text-constraints/package.json +1 -1
  46. package/assets/slidev/scripts/eslint/validate-references/dist/index.js +1 -1
  47. package/assets/slidev/scripts/eslint/validate-references/dist/lib/schema-validator.js +1 -1
  48. package/assets/slidev/scripts/eslint/validate-references/dist/lib/semantic-validator.js +12 -12
  49. package/assets/slidev/scripts/eslint/validate-references/dist/tsconfig.tsbuildinfo +1 -1
  50. package/assets/slidev/scripts/eslint/validate-references/index.ts +1 -1
  51. package/assets/slidev/scripts/eslint/validate-references/lib/schema-validator.ts +2 -2
  52. package/assets/slidev/scripts/eslint/validate-references/lib/semantic-validator.ts +12 -12
  53. package/assets/slidev/scripts/eslint/validate-references/package.json +1 -1
  54. package/cli/dist/cli.js +11 -10
  55. package/cli/dist/commands/chromium/host-dependencies.js +14 -7
  56. package/cli/dist/commands/drawio/export.js +27 -24
  57. package/cli/dist/commands/drawio/theme.js +8 -8
  58. package/cli/dist/commands/drawio/url.js +40 -32
  59. package/cli/dist/commands/evidence-xlsx/create.js +19 -18
  60. package/cli/dist/commands/pptx-ooxml/preview.js +26 -30
  61. package/cli/dist/commands/slidev-project/create.js +27 -26
  62. package/cli/dist/commands/slidev-project/linked-theme.js +5 -5
  63. package/cli/dist/commands/slidev-project/lint.js +29 -27
  64. package/cli/dist/commands/slidev-project/sync.js +35 -34
  65. package/cli/dist/commands/slidev-project/theme.js +19 -18
  66. package/cli/dist/commands/slidev-to-pptx/convert.d.ts +4 -0
  67. package/cli/dist/commands/slidev-to-pptx/convert.js +88 -75
  68. package/cli/dist/diagnostics.d.ts +38 -0
  69. package/cli/dist/diagnostics.js +46 -0
  70. package/cli/dist/domain/_shared/ports.d.ts +0 -1
  71. package/cli/dist/domain/_shared/text-check.js +2 -2
  72. package/cli/dist/domain/drawio/export.js +4 -4
  73. package/cli/dist/domain/drawio/label-text.js +1 -1
  74. package/cli/dist/domain/drawio/url.d.ts +11 -7
  75. package/cli/dist/domain/drawio/url.js +67 -45
  76. package/cli/dist/domain/evidence-xlsx/image-dimensions.js +14 -14
  77. package/cli/dist/domain/evidence-xlsx/spec-schema.js +26 -26
  78. package/cli/dist/domain/pptx-ooxml/merge.js +3 -3
  79. package/cli/dist/domain/pptx-ooxml/prerender-replace.d.ts +1 -0
  80. package/cli/dist/domain/pptx-ooxml/prerender-replace.js +3 -3
  81. package/cli/dist/domain/slidev-project/generated-files.d.ts +1 -1
  82. package/cli/dist/domain/slidev-project/generated-files.js +36 -36
  83. package/cli/dist/domain/slidev-project/initial-pages.js +4 -4
  84. package/cli/dist/domain/slidev-project/lint.js +11 -11
  85. package/cli/dist/domain/slidev-project/sync.js +13 -13
  86. package/cli/dist/domain/slidev-project/warnings.js +4 -4
  87. package/cli/dist/domain/slidev-theme/declaration.js +9 -9
  88. package/cli/dist/domain/slidev-theme/references.js +10 -10
  89. package/cli/dist/domain/slidev-theme/store-layout.js +6 -6
  90. package/cli/dist/domain/slidev-theme/talk-theme.js +13 -13
  91. package/cli/dist/domain/slidev-theme/theme-spec.js +5 -5
  92. package/cli/dist/domain/slidev-to-pptx/errors.js +3 -3
  93. package/cli/dist/infra/_shared/dependency-root.js +4 -4
  94. package/cli/dist/infra/_shared/patch-apply.js +6 -5
  95. package/cli/dist/infra/_shared/runtime-install.d.ts +12 -84
  96. package/cli/dist/infra/_shared/runtime-install.js +74 -108
  97. package/cli/dist/infra/_shared/slidev-bin.js +1 -1
  98. package/cli/dist/infra/drawio/icons.js +3 -3
  99. package/cli/dist/infra/drawio/pdf.js +1 -1
  100. package/cli/dist/infra/drawio/screenshot.js +10 -9
  101. package/cli/dist/infra/evidence-xlsx/workbook-writer.js +2 -2
  102. package/cli/dist/infra/playwright/chromium.js +4 -3
  103. package/cli/dist/infra/playwright/host-dependencies.js +8 -8
  104. package/cli/dist/infra/playwright/launch.js +5 -5
  105. package/cli/dist/infra/pptx-ooxml/soffice.js +2 -2
  106. package/cli/dist/infra/slidev-project/eslint-runner.js +10 -9
  107. package/cli/dist/infra/slidev-project/fs.js +6 -6
  108. package/cli/dist/infra/slidev-theme/store.js +18 -15
  109. package/cli/dist/infra/slidev-to-pptx/cache-store.js +6 -6
  110. package/cli/dist/infra/slidev-to-pptx/console-logger.d.ts +5 -5
  111. package/cli/dist/infra/slidev-to-pptx/console-logger.js +19 -20
  112. package/cli/dist/infra/slidev-to-pptx/dom-converter.d.ts +1 -1
  113. package/cli/dist/infra/slidev-to-pptx/dom-converter.js +12 -12
  114. package/cli/dist/infra/slidev-to-pptx/index.js +1 -9
  115. package/cli/dist/infra/slidev-to-pptx/pipeline.d.ts +2 -2
  116. package/cli/dist/infra/slidev-to-pptx/pipeline.js +56 -56
  117. package/cli/dist/infra/slidev-to-pptx/prerender-capture.js +14 -14
  118. package/cli/dist/infra/slidev-to-pptx/prerender.js +10 -10
  119. package/cli/dist/infra/slidev-to-pptx/runner.js +1 -0
  120. package/cli/dist/infra/slidev-to-pptx/scanner.js +10 -10
  121. package/cli/dist/infra/slidev-to-pptx/server.d.ts +2 -1
  122. package/cli/dist/infra/slidev-to-pptx/server.js +3 -3
  123. package/cli/dist/infra/slidev-to-pptx/single-pass-worker.js +39 -39
  124. package/cli/dist/infra/slidev-to-pptx/slide-worker.js +3 -3
  125. package/cli/dist/infra/slidev-to-pptx/visibility-helpers.js +8 -8
  126. package/cli/dist/mcp/dev-server-registry.js +10 -9
  127. package/cli/dist/mcp/queue.js +1 -1
  128. package/cli/dist/mcp/result.js +4 -4
  129. package/cli/dist/mcp/serve.js +5 -3
  130. package/cli/dist/mcp/server.js +2 -2
  131. package/cli/dist/mcp/tools/_shared.d.ts +1 -1
  132. package/cli/dist/mcp/tools/_shared.js +47 -38
  133. package/cli/dist/mcp/tools/drawio.js +23 -22
  134. package/cli/dist/mcp/tools/evidence.js +8 -8
  135. package/cli/dist/mcp/tools/setup.js +26 -26
  136. package/cli/dist/mcp/tools/slide-dev.js +20 -20
  137. package/cli/dist/mcp/tools/slide-page.js +39 -37
  138. package/cli/dist/mcp/tools/slide-theme.js +6 -6
  139. package/cli/dist/mcp/tools/slide.js +52 -50
  140. package/cli/dist/mcp/windows-path.js +8 -7
  141. package/cli/dist/node-runtime.d.ts +6 -1
  142. package/cli/dist/node-runtime.js +16 -8
  143. package/npm-shrinkwrap.json +46 -52
  144. package/package.json +6 -6
  145. package/vendor/text-rules/dist/source-hash +1 -1
@@ -17,14 +17,14 @@ export class ThemeResolveError extends Error {
17
17
  const NO_THEME = 'none';
18
18
  // 失敗の文言に添える、復旧の案内。CLI と MCP のどちらから呼ばれても読めるよう、両方の手順を 1 か所で持つ。
19
19
  function relinkAdvice(talkDirectory) {
20
- return `slide sync --dir ${talkDirectory} --node-modules-only で張り直してください`
21
- + `(MCP では slide_sync の dir: ${talkDirectory}, node_modules_only: true)`;
20
+ return `run slide sync --dir ${talkDirectory} --node-modules-only to relink`
21
+ + ` (MCP: slide_sync with dir: ${talkDirectory}, node_modules_only: true)`;
22
22
  }
23
23
  /**
24
24
  移行前の talk-dir を止めるときの案内。CLI と MCP のどちらから読んでも打てるよう、両方の手順を持つ。
25
25
  */
26
- export const MIGRATE_ADVICE = 'テーマを参照する形へ移行するには slide sync --theme <theme-spec> を実行してください'
27
- + '(MCP では slide_sync の theme に <theme-spec> を渡します)';
26
+ export const MIGRATE_ADVICE = 'to migrate to a theme reference, run slide sync --theme <theme-spec>'
27
+ + ' (MCP: slide_sync with theme: <theme-spec>)';
28
28
  /**
29
29
  `<talk>/slides.md` の frontmatter `theme:` を読む。
30
30
  無い・読めない・`none` は undefined(テーマを指していない)。
@@ -52,7 +52,7 @@ async function readDependencies(files, talkDirectory) {
52
52
  const file = path.join(talkDirectory, 'package.json');
53
53
  const text = await files.readText(file);
54
54
  if (text === undefined) {
55
- throw new ThemeResolveError(`${file} がありません。talk-dir の package.json の dependencies にテーマが要ります。`
55
+ throw new ThemeResolveError(`file not found: ${file}; the theme must be in dependencies of the talk-dir package.json; `
56
56
  + relinkAdvice(talkDirectory), 'theme-unlinked');
57
57
  }
58
58
  let raw;
@@ -61,7 +61,7 @@ async function readDependencies(files, talkDirectory) {
61
61
  }
62
62
  catch (error) {
63
63
  const reason = error instanceof Error ? error.message : String(error);
64
- throw new ThemeResolveError(`${file} を JSON として読めません: ${reason}。${relinkAdvice(talkDirectory)}`, 'theme-unlinked');
64
+ throw new ThemeResolveError(`cannot read ${file} as JSON: ${reason}; ${relinkAdvice(talkDirectory)}`, 'theme-unlinked');
65
65
  }
66
66
  const record = isRecord(raw) ? raw : {};
67
67
  const rawDependencies = isRecord(record['dependencies']) ? record['dependencies'] : {};
@@ -111,14 +111,14 @@ async function findThemeRoot(files, talkDirectory, name) {
111
111
  }
112
112
  async function requireThemeDependency(files, talkDirectory, theme) {
113
113
  if (isPathTheme(theme)) {
114
- throw new ThemeResolveError(`slides.md の theme: ${theme} はパス形式です。パス形式のテーマは pecotv では未対応です。${MIGRATE_ADVICE}`, 'theme-none');
114
+ throw new ThemeResolveError(`theme in slides.md is a path: ${theme}; path themes are not supported by pecotv; ${MIGRATE_ADVICE}`, 'theme-none');
115
115
  }
116
116
  const dependencies = await readDependencies(files, talkDirectory);
117
117
  const name = candidateNames(theme).find(candidate => dependencies.has(candidate));
118
118
  const spec = name === undefined ? undefined : dependencies.get(name);
119
119
  if (name === undefined || spec === undefined) {
120
- throw new ThemeResolveError(`slides.md の theme: ${theme} に当たるパッケージが package.json の dependencies にありません`
121
- + `(探した名前: ${candidateNames(theme).join(', ')})。dependencies にテーマを足し、`
120
+ throw new ThemeResolveError(`no package for the theme in slides.md is in dependencies of package.json: ${theme} `
121
+ + `(searched names: ${candidateNames(theme).join(', ')}); add the theme to dependencies, then `
122
122
  + relinkAdvice(talkDirectory), 'theme-unlinked');
123
123
  }
124
124
  return { name, spec };
@@ -149,7 +149,7 @@ export async function resolveTalkTheme(files, talkDirectory) {
149
149
  const { name, spec } = await requireThemeDependency(files, talkDirectory, theme);
150
150
  const directory = await findThemeRoot(files, talkDirectory, name);
151
151
  if (directory === undefined) {
152
- throw new ThemeResolveError(`テーマ ${name} が ${path.join(talkDirectory, 'node_modules', name)} にも、上位の node_modules にも見つかりません。`
152
+ throw new ThemeResolveError(`theme not found in ${path.join(talkDirectory, 'node_modules', name)} or in any parent node_modules: ${name}; `
153
153
  + relinkAdvice(talkDirectory), 'theme-unlinked');
154
154
  }
155
155
  return { name, spec, directory, linked: directory === path.join(talkDirectory, 'node_modules', name) };
@@ -167,7 +167,7 @@ async function hasThemeDeclaration(files, directory) {
167
167
  export async function themeNoneError(files, talkDirectory) {
168
168
  const message = await hasThemeDeclaration(files, talkDirectory)
169
169
  ? themeRootMessage(talkDirectory)
170
- : `${talkDirectory} はテーマを参照していません(slides.md の theme: が none か未指定です)。${MIGRATE_ADVICE}`;
170
+ : `${talkDirectory} does not reference a theme (theme in slides.md is none or unset); ${MIGRATE_ADVICE}`;
171
171
  return new ThemeResolveError(message, 'theme-none');
172
172
  }
173
173
  /**
@@ -175,8 +175,8 @@ export async function themeNoneError(files, talkDirectory) {
175
175
  テーマの dir を移行前の talk-dir と取り違えると、sync が layouts・components を消しうるため、文言を分けて止める。
176
176
  */
177
177
  export function themeRootMessage(directory) {
178
- return `${directory} は ${THEME_DECLARATION_FILE_NAME} を持つテーマの dir です。talk-dir ではないため、talk-dir として扱いません。`
179
- + 'テーマを参照する talk-dir を別に作り、その dir を指定してください';
178
+ return `not a talk-dir (it is a theme dir with ${THEME_DECLARATION_FILE_NAME}): ${directory}; `
179
+ + 'create a separate talk-dir that references the theme and specify that dir';
180
180
  }
181
181
  /**
182
182
  talk-dir がテーマをどう持つかを 3 通りに分ける。node_modules には触れない。
@@ -30,23 +30,23 @@ export function parseThemeSpec(text) {
30
30
  if (text.startsWith(FILE_PREFIX)) {
31
31
  const filePath = text.slice(FILE_PREFIX.length);
32
32
  if (filePath === '') {
33
- throw new ThemeSpecError(`テーマの指定 '${text}' に path がありません`, 'unsupported-spec');
33
+ throw new ThemeSpecError(`theme spec has no path: ${text}`, 'unsupported-spec');
34
34
  }
35
35
  return { kind: 'file', path: filePath };
36
36
  }
37
37
  if (!GIT_PREFIX.test(text)) {
38
- throw new ThemeSpecError(`テーマの指定 '${text}' は解釈できません。git+https://<host>/<owner>/<repo>.git#<tag> か file:<path> で書いてください`, 'unsupported-spec');
38
+ throw new ThemeSpecError(`cannot parse the theme spec: ${text} (fix: write git+https://<host>/<owner>/<repo>.git#<tag> or file:<path>)`, 'unsupported-spec');
39
39
  }
40
40
  const hashIndex = text.indexOf('#');
41
41
  if (hashIndex === -1 || hashIndex === text.length - 1) {
42
- throw new ThemeSpecError(`テーマの指定 '${text}' にタグがありません。#<tag> を付けてください`, 'tag-required');
42
+ throw new ThemeSpecError(`theme spec has no tag: ${text} (fix: add #<tag>)`, 'tag-required');
43
43
  }
44
44
  const tag = text.slice(hashIndex + 1);
45
45
  if (tag.startsWith(SEMVER_RANGE_PREFIX)) {
46
- throw new ThemeSpecError(`テーマの指定 '${text}' の範囲指定(#semver:)は使えません。タグを 1 つ書いてください`, 'semver-range');
46
+ throw new ThemeSpecError(`semver ranges (#semver:) are not allowed in the theme spec: ${text} (fix: write a single tag)`, 'semver-range');
47
47
  }
48
48
  if (!isSemverTag(tag)) {
49
- throw new ThemeSpecError(`テーマの指定 '${text}' の '${tag}' はタグの書式でない(例: 1.2.3 か v1.2.3)`, 'tag-format');
49
+ throw new ThemeSpecError(`invalid tag format in the theme spec: ${tag} in ${text} (e.g. 1.2.3 or v1.2.3)`, 'tag-format');
50
50
  }
51
51
  const url = text.slice('git+'.length, hashIndex);
52
52
  return { kind: 'git', url, tag };
@@ -24,9 +24,9 @@ export class PipelineTimeoutError extends Error {
24
24
  errors;
25
25
  constructor(idleTimeoutMs, options) {
26
26
  const { elapsedMs } = options;
27
- const lastProgress = options.lastProgress ?? '進捗なし (スキャン開始前)';
28
- super(`${idleTimeoutMs.toString()}ms 進捗なし`
29
- + ` (経過 ${elapsedMs.toString()}ms, 最終進捗: ${lastProgress})`);
27
+ const lastProgress = options.lastProgress ?? 'no progress (before the scan started)';
28
+ super(`no progress for ${idleTimeoutMs.toString()}ms`
29
+ + ` (elapsed ${elapsedMs.toString()}ms, last progress: ${lastProgress})`);
30
30
  this.name = 'PipelineTimeoutError';
31
31
  this.idleTimeoutMs = idleTimeoutMs;
32
32
  this.elapsedMs = elapsedMs;
@@ -150,8 +150,8 @@ function isMatchingSegments(pattern, target) {
150
150
  環境変数の値。未設定・空白のみは undefined。
151
151
  */
152
152
  export function trimmedEnvironment(name) {
153
- // eslint-disable-next-line security/detect-object-injection -- name は本ファイル内の固定文字列
154
- const raw = process.env[name];
153
+ // interface-env: CLAUDE_PLUGIN_ROOT PECOTV_DEPENDENCY_ROOT PECOTV_RUNTIME_DIR
154
+ const raw = process.env[name]; // eslint-disable-line security/detect-object-injection -- name は本ファイル内の固定文字列
155
155
  if (raw === undefined)
156
156
  return undefined;
157
157
  const trimmed = raw.trim();
@@ -296,8 +296,8 @@ function resolveFrom(bases, specifier) {
296
296
  呼び出し元は、自分がどちらの配布形態かを判定しない。
297
297
  判定できるのは依存ルートの実在だけで、配布形態そのものではない。
298
298
  */
299
- export const DEPENDENCY_RECOVERY_HINT = 'プラグイン配布ではデータ置き場の runtime/ を削除して pecotv を起動し直してください(依存の準備がやり直されます)。'
300
- + '単体配布では `setup` ツールを実行してください(実行時依存を取得します)。';
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)';
301
301
  /**
302
302
  実行時依存が揃っているかの判定に使う specifier。
303
303
 
@@ -66,7 +66,7 @@ function collectPatchDigests(root, relative, digests) {
66
66
  entries = readdirSync(directory, { withFileTypes: true });
67
67
  }
68
68
  catch (error) {
69
- return isNotFound(error) ? undefined : `patches ディレクトリを読めません (${directory}): ${describeError(error)}`;
69
+ return isNotFound(error) ? undefined : `cannot read the patches directory: ${directory} (${describeError(error)})`;
70
70
  }
71
71
  for (const entry of entries) {
72
72
  const child = path.join(relative, entry.name);
@@ -85,7 +85,7 @@ function collectPatchDigests(root, relative, digests) {
85
85
  catch (error) {
86
86
  if (isNotFound(error))
87
87
  continue;
88
- return `パッチファイルを読めません (${path.join(root, child)}): ${describeError(error)}`;
88
+ return `cannot read the patch file: ${path.join(root, child)} (${describeError(error)})`;
89
89
  }
90
90
  }
91
91
  return undefined;
@@ -137,7 +137,7 @@ options) {
137
137
  const resolvedRoot = realpathOrUndefined(options.root);
138
138
  const resolvedPatches = realpathOrUndefined(options.patchesDirectory);
139
139
  if (resolvedRoot === undefined || resolvedPatches === undefined) {
140
- return startFailure(`パッチ適用の基準パスを解決できません (${resolvedRoot === undefined ? options.root : options.patchesDirectory})`);
140
+ return startFailure(`cannot resolve the base path for applying patches: ${resolvedRoot === undefined ? options.root : options.patchesDirectory}`);
141
141
  }
142
142
  const locked = withFlock(options.lockPath, options.nodeCommand ?? process.execPath, [
143
143
  options.patchPackageEntry,
@@ -146,6 +146,7 @@ options) {
146
146
  ]);
147
147
  const result = await (options.runner ?? spawnPromise)(locked.command, locked.commandArguments, {
148
148
  cwd: options.root,
149
+ // interface-env: none
149
150
  env: process.env,
150
151
  timeoutMs: PATCH_APPLY_TIMEOUT_MS,
151
152
  signal: options.signal,
@@ -169,10 +170,10 @@ patch-dir が実体を指さないときは、`No patch files found` だけを
169
170
  */
170
171
  function patchAppShortfall(stdout, expected) {
171
172
  if (stdout.includes('No patch files found')) {
172
- return `patch-package がパッチを 1 件も見つけませんでした (期待 ${String(expected)} 件)。--patch-dir の指す先が違います。`;
173
+ return `patch-package found no patches (expected ${String(expected)}); --patch-dir points to the wrong directory`;
173
174
  }
174
175
  const applied = (stdout.match(/✔/gu) ?? []).length;
175
- return applied >= expected ? undefined : `patch-package の適用が ${String(applied)} 件で、期待の ${String(expected)} 件に足りません。`;
176
+ return applied >= expected ? undefined : `patch-package applied ${String(applied)} patches, fewer than the expected ${String(expected)}`;
176
177
  }
177
178
  /**
178
179
  起動する前に諦めた失敗。SpawnResult は起動なしを exitCode: null で表す。
@@ -1,52 +1,15 @@
1
1
  import type { SpawnResult } from '../../domain/_shared/spawn-result.js';
2
2
  /**
3
3
  本体の実行時依存の manifest を置く dir。プラグインのルートからの相対パス。
4
-
5
- 単体配布の install 対象はこの dir の package.json から得る。
6
4
  */
7
5
  export declare const RUNTIME_MANIFEST_DIRECTORY: string;
8
6
  /**
9
- 取得の上限時間 (ms)。
10
-
11
- 計測では 631MB / 455 エントリで 37 秒かかった(`.pecot/work/982/exp/persist-deps.sh`)。
12
- chromium 取得(計測 33 秒に対し上限 300 秒)と同じだけの余裕を取る。
7
+ 取得の上限時間 (ms)。計測 37 秒(631MB)に対し、chromium 取得と同じ約 10 倍の余裕を取る。
13
8
  */
14
9
  export declare const RUNTIME_INSTALL_TIMEOUT_MS = 600000;
15
10
  /**
16
- slidev 中核パッケージの固定版。
17
-
18
- manifest は `@slidev/cli` / `@slidev/client` を完全一致の版で宣言する。ただし、宣言が範囲に変わっても固定版で入れる。
19
- 永続層は `--no-package-lock` で install するため、そのまま渡すと時点ごとに別の 53.x へ解決される。
20
- slidev の中核パッケージは、互いを完全一致の版で要求する。
21
- npm レジストリの `@slidev/cli@53.0.0` の dependencies で確認した。
22
- `@slidev/parser` / `@slidev/client` / `@slidev/types` を、いずれも `53.0.0` 固定で引く。
23
- そのため cli だけが上位版へ動くと、nested に別版の parser / client が入る。
24
- すると、pptx 差分キャッシュの slideHash を求める parser と、slidev build の parser がずれる。
25
- cli/package.json の slidev-parser-pin-reason と同じ理由。
26
-
27
- 対処として lockfile を持たせる案もある。
28
- ただし lockfile は「解決結果を再現する」だけで、中核パッケージ同士の版一致は保証しない。
29
- 初回解決が cli 52.16 / parser 52.15 なら、その食い違いを固定してしまう。
30
- よって中核パッケージを同一版に固定する方を採る。
31
- この値はプラグイン配布の構成と同じで、中核 4 本(cli / client / parser / types)とも 53.0.0 になる。
32
- cli/package.json の `@slidev/parser` の pin と同値であることを、unit test で固定する。
33
- `@slidev/theme-default` は別の版系列(0.25.x)なので対象に含めない。
34
- */
35
- export declare const SLIDEV_CORE_VERSION = "53.0.0";
36
- /**
37
- 永続層へ入れる patch-package の版。完全一致で固定する。
38
-
39
- 本体の実行時依存は patch を持たない。
40
- patch-package を入れる理由は、テーマの置き場が使うことにある。
41
- 使う箇所は infra/slidev-theme/store.ts の applyThemePatches の中。
42
- `resolveDependency('patch-package/package.json')` で解決する。
43
-
44
- 永続層は `--no-package-lock` で install するため、caret のままだと時点ごとに別の 8.x へ解決される。
45
- slidev 中核パッケージと同じ理由で、検証した版だけを配る(Epic #152)。
46
-
47
- 監査 manifest(scripts/release/runtime-manifest.mjs)は同じ規則を写して、同値比較で固定している。
48
-
49
- 値は plugins/pecot-visual/package.json の devDependencies と同値にし、unit test で固定する。
11
+ 永続層へ入れる patch-package の版(完全一致)。テーマの patch 適用が使う。
12
+ plugins/pecot-visual/package.json の devDependencies と同値で、unit test が固定する。
50
13
  */
51
14
  export declare const PATCH_PACKAGE_RANGE = "8.0.1";
52
15
  /**
@@ -58,22 +21,8 @@ export interface RuntimeInstallPlan {
58
21
  }
59
22
  /**
60
23
  永続層へ install する内容を実行時依存の manifest から組み立てる。
61
-
62
- specs には次を入れる。
63
- - manifest の `dependencies`。`workspace:` 等のローカル参照は除く。
64
- - `devDependencies` の `dom-to-pptx`。pptx 変換の bundle 供給元になる。
65
- - `@slidev/parser`。
66
-
67
- slidev 中核パッケージは、range ではなく `SLIDEV_CORE_VERSION` で固定する。
68
-
69
- overrides には、manifest の `overrides` をそのまま写す。
70
- manifest は推移依存の版を overrides で pin している。
71
- install 対象を manifest から導く設計なので、解決の pin だけ落とすと、
72
- 永続層とプラグイン配布で別の推移依存を掴む。
73
-
74
- manifest が読めないときも、取得は諦めない。
75
- 最低限 `@slidev/parser` は返し、npm 側のエラーを呼び出し元へ見せる。
76
- ここで空を返すと、「install は成功したのに何も入らない」という判別しづらい状態になる。
24
+ slidev 中核パッケージは manifest の `@slidev/cli` の版で固定し、overrides は manifest から写す。
25
+ manifest が読めない、または `@slidev/cli` の版が無い・空のときは配布の破損として throw する(版なしの install を避ける)。
77
26
  */
78
27
  export declare function runtimeInstallPlan(manifestPath: string): RuntimeInstallPlan;
79
28
  /**
@@ -82,18 +31,12 @@ export declare function runtimeInstallPlan(manifestPath: string): RuntimeInstall
82
31
  export declare function runtimeInstallSpecs(manifestPath: string): readonly string[];
83
32
  /**
84
33
  永続層の取得済み判定に使う印。install 対象(specs と overrides)の内容から導く。
85
-
86
- 永続層は版を持たない固定パスなので、利用者が新版へ上げて manifest の依存が変わっても、
87
- 「解決できる」だけでは前の版の残骸と区別できない。
88
- 印には、pecotv の版そのものではなく install 対象の内容を使う。
89
- 依存が変わらない版上げで、600MB の再取得を強いないため。
34
+ pecotv の版ではなく内容を使うのは、依存が変わらない版上げで 600MB の再取得を避けるため。
90
35
  */
91
36
  export declare function runtimeInstallStamp(manifestPath: string): string;
92
37
  /**
93
38
  永続層への取得を排他するロックのパス。場所を決められなければ undefined。
94
-
95
- chromium 側(installLockPath)は依存ルートの `node_modules` に置く。
96
- こちらは `node_modules` を作る側なので、永続層の直下に置く(install 前に mkdir する)。
39
+ `node_modules` を作る側なので、chromium 側と違い永続層の直下に置く。
97
40
  */
98
41
  export declare function runtimeInstallLockPath(): string | undefined;
99
42
  /**
@@ -121,26 +64,11 @@ export interface InstallRuntimeDependenciesOptions {
121
64
  readonly npmCommand?: string | undefined;
122
65
  }
123
66
  /**
124
- 永続層へ実行時依存を install する。取得先は無ければここで作る(runtimeDependencyRoot は作らない)。
125
-
126
- `--prefix` を有効にするには、install 先に package.json が必要になる。
127
- 無いと npm は上位へ遡り、HOME 直下など意図しない場所へ書き込む。
128
- 毎回書き直すのは冪等だからで、途中終了した前回の残骸(package.json だけ欠けた状態)から復帰する意味もある。
129
-
130
- 単体配布は MCP クライアントごとに別プロセスが立つ。
131
- そのため複数セッションからの `setup` が、同じ `node_modules` へ同時に実行され得る。
132
- chromium 取得と同じ flock(1) で直列化する。
133
- flock(1) が無い環境では、ロックなしで実行する。
134
-
135
- stamp は install が成功したときにだけ置く。
136
- 先に消しておくのは、途中で失敗した install の残骸を「取得済み」と誤判定させないため。
137
-
138
- npm 自体は、npx 経由の起動なら必ず同居する。
139
- 解決できない環境では spawnPromise が `exitCode: null` を返し、呼び出し元が理由付きの失敗として扱う。
140
-
141
- env は利用者環境のものを引き継ぐ。
142
- 取得先と proxy の指定は利用者側の変数で行われるため、絞り込まない。
143
- プロキシの CA は利用者が `NODE_EXTRA_CA_CERTS` で渡す。
67
+ 永続層へ実行時依存を install する。取得先は無ければここで作る。
68
+ `--prefix` を使うには install 先に package.json が要る(無いと npm は上位へ遡る)ので、毎回書き直す。
69
+ 複数セッションの `setup` が並走し得るため、flock(1) で直列化する(無い環境ではロックなし)。
70
+ stamp は成功時だけ置き、先に消す。途中で失敗した残骸を取得済みと誤判定させないため。
71
+ manifest から plan を組めないときは、起動失敗(exitCode: null, failedStage: 'npm')として返す。
144
72
  */
145
73
  export declare function installRuntimeDependencies(options: Readonly<InstallRuntimeDependenciesOptions>): Promise<RuntimeInstallResult>;
146
74
  //# sourceMappingURL=runtime-install.d.ts.map
@@ -1,19 +1,7 @@
1
- // 永続層(`${データ置き場}/mcp-dist`)への実行時依存の取得。
1
+ // 永続層(`${データ置き場}/mcp-dist`)への実行時依存の取得。単体配布でだけ動く。
2
+ // 取得対象は assets/slidev/runtime/package.json から読み、ここで列挙し直さない。
2
3
  //
3
- // 単体配布でだけ動く。
4
- // プラグイン配布の実行時依存は、bin/pecotv の作る実行用ミラー(wrapper が渡す `PECOTV_DEPENDENCY_ROOT`)に置かれる。
5
- // そのため `setup` ツールは、取得済みと判定して何もしない。
6
- // 判定は infra/_shared/dependency-root.ts の areRuntimeDependenciesInstalled が行う。
7
- //
8
- // 取得するパッケージの根拠は、本体が持つ実行時依存の manifest(assets/slidev/runtime/package.json)に置く。
9
- // talk-dir は依存ルートの `node_modules` へ symlink を張って slidev build を回す。
10
- // よって永続層に必要なのは、manifest の宣言する runtime 依存そのものになる。
11
- // 二重管理を避けるため、ここで列挙し直さず読み取る。
12
- // `overrides` も同じ理由で、manifest から写す。
13
- // 本体の実行時依存は patch を持たない。テーマの patch はテーマの置き場(infra/slidev-theme/store.ts)が当てる。
14
- //
15
- // 読み書きするのは、runtimeDependencyRoot() 配下と、引数で渡る manifest だけ。
16
- // 呼び出し元から任意のパスは渡らないため、本ファイル全体で security/detect-non-literal-fs-filename を disable する。
4
+ // 読み書きするのは、runtimeDependencyRoot() 配下と、引数で渡る manifest だけ。任意のパスは渡らない。
17
5
  /* eslint-disable security/detect-non-literal-fs-filename */
18
6
  import { createHash } from 'node:crypto';
19
7
  import { readFileSync } from 'node:fs';
@@ -25,39 +13,13 @@ import { withFlock } from './flock.js';
25
13
  import { spawnPromise } from './process.js';
26
14
  /**
27
15
  本体の実行時依存の manifest を置く dir。プラグインのルートからの相対パス。
28
-
29
- 単体配布の install 対象はこの dir の package.json から得る。
30
16
  */
31
17
  export const RUNTIME_MANIFEST_DIRECTORY = path.join('assets', 'slidev', 'runtime');
32
18
  /**
33
- 取得の上限時間 (ms)。
34
-
35
- 計測では 631MB / 455 エントリで 37 秒かかった(`.pecot/work/982/exp/persist-deps.sh`)。
36
- chromium 取得(計測 33 秒に対し上限 300 秒)と同じだけの余裕を取る。
19
+ 取得の上限時間 (ms)。計測 37 秒(631MB)に対し、chromium 取得と同じ約 10 倍の余裕を取る。
37
20
  */
38
21
  export const RUNTIME_INSTALL_TIMEOUT_MS = 600_000;
39
22
  /**
40
- slidev 中核パッケージの固定版。
41
-
42
- manifest は `@slidev/cli` / `@slidev/client` を完全一致の版で宣言する。ただし、宣言が範囲に変わっても固定版で入れる。
43
- 永続層は `--no-package-lock` で install するため、そのまま渡すと時点ごとに別の 53.x へ解決される。
44
- slidev の中核パッケージは、互いを完全一致の版で要求する。
45
- npm レジストリの `@slidev/cli@53.0.0` の dependencies で確認した。
46
- `@slidev/parser` / `@slidev/client` / `@slidev/types` を、いずれも `53.0.0` 固定で引く。
47
- そのため cli だけが上位版へ動くと、nested に別版の parser / client が入る。
48
- すると、pptx 差分キャッシュの slideHash を求める parser と、slidev build の parser がずれる。
49
- cli/package.json の slidev-parser-pin-reason と同じ理由。
50
-
51
- 対処として lockfile を持たせる案もある。
52
- ただし lockfile は「解決結果を再現する」だけで、中核パッケージ同士の版一致は保証しない。
53
- 初回解決が cli 52.16 / parser 52.15 なら、その食い違いを固定してしまう。
54
- よって中核パッケージを同一版に固定する方を採る。
55
- この値はプラグイン配布の構成と同じで、中核 4 本(cli / client / parser / types)とも 53.0.0 になる。
56
- cli/package.json の `@slidev/parser` の pin と同値であることを、unit test で固定する。
57
- `@slidev/theme-default` は別の版系列(0.25.x)なので対象に含めない。
58
- */
59
- export const SLIDEV_CORE_VERSION = '53.0.0';
60
- /**
61
23
  固定版で install する slidev 中核パッケージ。
62
24
  */
63
25
  const SLIDEV_CORE_PACKAGES = new Set([
@@ -67,19 +29,8 @@ const SLIDEV_CORE_PACKAGES = new Set([
67
29
  '@slidev/types',
68
30
  ]);
69
31
  /**
70
- 永続層へ入れる patch-package の版。完全一致で固定する。
71
-
72
- 本体の実行時依存は patch を持たない。
73
- patch-package を入れる理由は、テーマの置き場が使うことにある。
74
- 使う箇所は infra/slidev-theme/store.ts の applyThemePatches の中。
75
- `resolveDependency('patch-package/package.json')` で解決する。
76
-
77
- 永続層は `--no-package-lock` で install するため、caret のままだと時点ごとに別の 8.x へ解決される。
78
- slidev 中核パッケージと同じ理由で、検証した版だけを配る(Epic #152)。
79
-
80
- 監査 manifest(scripts/release/runtime-manifest.mjs)は同じ規則を写して、同値比較で固定している。
81
-
82
- 値は plugins/pecot-visual/package.json の devDependencies と同値にし、unit test で固定する。
32
+ 永続層へ入れる patch-package の版(完全一致)。テーマの patch 適用が使う。
33
+ plugins/pecot-visual/package.json の devDependencies と同値で、unit test が固定する。
83
34
  */
84
35
  export const PATCH_PACKAGE_RANGE = '8.0.1';
85
36
  /**
@@ -95,7 +46,7 @@ function dependencyMap(value) {
95
46
  : {};
96
47
  }
97
48
  /**
98
- manifest を読む。読めない・object でないときは空の manifest 扱い。
49
+ manifest を読む。読めない・object でないときは空の manifest 扱い(版が無いので呼び出し側が throw する)。
99
50
  */
100
51
  function readManifest(manifestPath) {
101
52
  let parsed;
@@ -108,33 +59,39 @@ function readManifest(manifestPath) {
108
59
  return isRecord(parsed) ? parsed : {};
109
60
  }
110
61
  /**
62
+ `catalog:` が残っていないかを見る依存フィールド。scripts/release/catalog.mjs が置き換える対象と同じ。
63
+ */
64
+ const CATALOG_CHECKED_FIELDS = new Set(['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies']);
65
+ /**
66
+ manifest の依存の range が `catalog:` で始まる依存の名前。配布時に置き換わるはずのものが残っているかを見る。
67
+ */
68
+ function unresolvedCatalogNames(manifestPath) {
69
+ const manifest = readManifest(manifestPath);
70
+ return Object.entries(manifest)
71
+ .filter(([field]) => CATALOG_CHECKED_FIELDS.has(field))
72
+ .flatMap(([, section]) => Object.entries(dependencyMap(section)))
73
+ .filter(([, range]) => range.startsWith('catalog:'))
74
+ .map(([name]) => name);
75
+ }
76
+ /**
111
77
  永続層へ install する内容を実行時依存の manifest から組み立てる。
112
-
113
- specs には次を入れる。
114
- - manifest の `dependencies`。`workspace:` 等のローカル参照は除く。
115
- - `devDependencies` の `dom-to-pptx`。pptx 変換の bundle 供給元になる。
116
- - `@slidev/parser`。
117
-
118
- slidev 中核パッケージは、range ではなく `SLIDEV_CORE_VERSION` で固定する。
119
-
120
- overrides には、manifest の `overrides` をそのまま写す。
121
- manifest は推移依存の版を overrides で pin している。
122
- install 対象を manifest から導く設計なので、解決の pin だけ落とすと、
123
- 永続層とプラグイン配布で別の推移依存を掴む。
124
-
125
- manifest が読めないときも、取得は諦めない。
126
- 最低限 `@slidev/parser` は返し、npm 側のエラーを呼び出し元へ見せる。
127
- ここで空を返すと、「install は成功したのに何も入らない」という判別しづらい状態になる。
78
+ slidev 中核パッケージは manifest の `@slidev/cli` の版で固定し、overrides は manifest から写す。
79
+ manifest が読めない、または `@slidev/cli` の版が無い・空のときは配布の破損として throw する(版なしの install を避ける)。
128
80
  */
129
81
  export function runtimeInstallPlan(manifestPath) {
130
82
  const manifest = readManifest(manifestPath);
131
- const specs = Object.entries(dependencyMap(manifest['dependencies']))
83
+ const dependencies = dependencyMap(manifest['dependencies']);
84
+ const coreVersion = dependencies['@slidev/cli'];
85
+ if (coreVersion === undefined || coreVersion === '') {
86
+ throw new Error(`dependencies in ${manifestPath} has no version for @slidev/cli (the distribution is corrupted)`);
87
+ }
88
+ const specs = Object.entries(dependencies)
132
89
  .filter(([, range]) => !LOCAL_PROTOCOL_PATTERN.test(range))
133
- .map(([name, range]) => `${name}@${pinnedRange(name, range)}`);
90
+ .map(([name, range]) => `${name}@${pinnedRange(name, range, coreVersion)}`);
134
91
  const domToPptx = dependencyMap(manifest['devDependencies'])['dom-to-pptx'];
135
92
  if (domToPptx !== undefined)
136
93
  specs.push(`dom-to-pptx@${domToPptx}`);
137
- specs.push(`@slidev/parser@${SLIDEV_CORE_VERSION}`, `patch-package@${PATCH_PACKAGE_RANGE}`);
94
+ specs.push(`@slidev/parser@${coreVersion}`, `patch-package@${PATCH_PACKAGE_RANGE}`);
138
95
  const overrides = manifest['overrides'];
139
96
  return {
140
97
  specs,
@@ -142,10 +99,10 @@ export function runtimeInstallPlan(manifestPath) {
142
99
  };
143
100
  }
144
101
  /**
145
- slidev 中核パッケージは宣言 range ではなく固定版で install する。
102
+ slidev 中核パッケージは宣言 range ではなく coreVersion(`@slidev/cli` の版)で、それ以外は宣言 range で install する。
146
103
  */
147
- function pinnedRange(name, range) {
148
- return SLIDEV_CORE_PACKAGES.has(name) ? SLIDEV_CORE_VERSION : range;
104
+ function pinnedRange(name, range, coreVersion) {
105
+ return SLIDEV_CORE_PACKAGES.has(name) ? coreVersion : range;
149
106
  }
150
107
  /**
151
108
  永続層へ install する specifier。
@@ -155,11 +112,7 @@ export function runtimeInstallSpecs(manifestPath) {
155
112
  }
156
113
  /**
157
114
  永続層の取得済み判定に使う印。install 対象(specs と overrides)の内容から導く。
158
-
159
- 永続層は版を持たない固定パスなので、利用者が新版へ上げて manifest の依存が変わっても、
160
- 「解決できる」だけでは前の版の残骸と区別できない。
161
- 印には、pecotv の版そのものではなく install 対象の内容を使う。
162
- 依存が変わらない版上げで、600MB の再取得を強いないため。
115
+ pecotv の版ではなく内容を使うのは、依存が変わらない版上げで 600MB の再取得を避けるため。
163
116
  */
164
117
  export function runtimeInstallStamp(manifestPath) {
165
118
  return stampOf(runtimeInstallPlan(manifestPath));
@@ -174,35 +127,18 @@ function stampOf(plan) {
174
127
  }
175
128
  /**
176
129
  永続層への取得を排他するロックのパス。場所を決められなければ undefined。
177
-
178
- chromium 側(installLockPath)は依存ルートの `node_modules` に置く。
179
- こちらは `node_modules` を作る側なので、永続層の直下に置く(install 前に mkdir する)。
130
+ `node_modules` を作る側なので、chromium 側と違い永続層の直下に置く。
180
131
  */
181
132
  export function runtimeInstallLockPath() {
182
133
  const root = runtimeDependencyRoot();
183
134
  return root === undefined ? undefined : path.join(root, '.pecotv-runtime-install.lock');
184
135
  }
185
136
  /**
186
- 永続層へ実行時依存を install する。取得先は無ければここで作る(runtimeDependencyRoot は作らない)。
187
-
188
- `--prefix` を有効にするには、install 先に package.json が必要になる。
189
- 無いと npm は上位へ遡り、HOME 直下など意図しない場所へ書き込む。
190
- 毎回書き直すのは冪等だからで、途中終了した前回の残骸(package.json だけ欠けた状態)から復帰する意味もある。
191
-
192
- 単体配布は MCP クライアントごとに別プロセスが立つ。
193
- そのため複数セッションからの `setup` が、同じ `node_modules` へ同時に実行され得る。
194
- chromium 取得と同じ flock(1) で直列化する。
195
- flock(1) が無い環境では、ロックなしで実行する。
196
-
197
- stamp は install が成功したときにだけ置く。
198
- 先に消しておくのは、途中で失敗した install の残骸を「取得済み」と誤判定させないため。
199
-
200
- npm 自体は、npx 経由の起動なら必ず同居する。
201
- 解決できない環境では spawnPromise が `exitCode: null` を返し、呼び出し元が理由付きの失敗として扱う。
202
-
203
- env は利用者環境のものを引き継ぐ。
204
- 取得先と proxy の指定は利用者側の変数で行われるため、絞り込まない。
205
- プロキシの CA は利用者が `NODE_EXTRA_CA_CERTS` で渡す。
137
+ 永続層へ実行時依存を install する。取得先は無ければここで作る。
138
+ `--prefix` を使うには install 先に package.json が要る(無いと npm は上位へ遡る)ので、毎回書き直す。
139
+ 複数セッションの `setup` が並走し得るため、flock(1) で直列化する(無い環境ではロックなし)。
140
+ stamp は成功時だけ置き、先に消す。途中で失敗した残骸を取得済みと誤判定させないため。
141
+ manifest から plan を組めないときは、起動失敗(exitCode: null, failedStage: 'npm')として返す。
206
142
  */
207
143
  export async function installRuntimeDependencies(
208
144
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types -- AbortSignal 用
@@ -215,12 +151,41 @@ options) {
215
151
  // eslint-disable-next-line unicorn/no-null -- 同上
216
152
  signal: null,
217
153
  stdout: '',
218
- stderr: 'HOME と XDG_DATA_HOME が未設定のため、実行時依存の取得先 (データ置き場の mcp-dist/) を決められません。PLUGIN_DATA に絶対パスを指定してください',
154
+ stderr: 'cannot decide where to fetch the runtime dependencies (mcp-dist/ in the data directory) because HOME and XDG_DATA_HOME are unset; set PLUGIN_DATA to an absolute path',
155
+ timedOut: false,
156
+ failedStage: 'npm',
157
+ };
158
+ }
159
+ let plan;
160
+ try {
161
+ plan = runtimeInstallPlan(options.manifestPath);
162
+ }
163
+ catch (error) {
164
+ return {
165
+ // eslint-disable-next-line unicorn/no-null -- SpawnResult は起動失敗を exitCode: null で表す
166
+ exitCode: null,
167
+ // eslint-disable-next-line unicorn/no-null -- 同上
168
+ signal: null,
169
+ stdout: '',
170
+ stderr: error instanceof Error ? error.message : String(error),
171
+ timedOut: false,
172
+ failedStage: 'npm',
173
+ };
174
+ }
175
+ // 配布時に catalog: は範囲へ置き換わる。残っていれば npm は解決できないので、起動せずに返す。
176
+ const unresolved = unresolvedCatalogNames(options.manifestPath);
177
+ if (unresolved.length > 0) {
178
+ return {
179
+ // eslint-disable-next-line unicorn/no-null -- SpawnResult は起動失敗を exitCode: null で表す
180
+ exitCode: null,
181
+ // eslint-disable-next-line unicorn/no-null -- 同上
182
+ signal: null,
183
+ stdout: '',
184
+ stderr: `catalog: entries that should be replaced at distribution remain in ${options.manifestPath}: ${unresolved.join(', ')}`,
219
185
  timedOut: false,
220
186
  failedStage: 'npm',
221
187
  };
222
188
  }
223
- const plan = runtimeInstallPlan(options.manifestPath);
224
189
  await mkdir(root, { recursive: true });
225
190
  await writeFile(path.join(root, 'package.json'), `${JSON.stringify({
226
191
  name: 'pecotv-runtime',
@@ -240,6 +205,7 @@ options) {
240
205
  ...plan.specs,
241
206
  ]);
242
207
  const result = await spawnPromise(locked.command, locked.commandArguments, {
208
+ // interface-env: none
243
209
  env: process.env,
244
210
  timeoutMs: RUNTIME_INSTALL_TIMEOUT_MS,
245
211
  signal: options.signal,
@@ -25,7 +25,7 @@ dev サーバ (mcp/dev-server-registry.ts) は、起動試行の try/catch が `
25
25
  export function resolveSlidevBin() {
26
26
  const packageJsonPath = resolveDependency('@slidev/cli/package.json', import.meta.url);
27
27
  if (packageJsonPath === undefined) {
28
- throw new Error(`@slidev/cli が解決できません。${DEPENDENCY_RECOVERY_HINT}`);
28
+ throw new Error(`cannot resolve @slidev/cli; ${DEPENDENCY_RECOVERY_HINT}`);
29
29
  }
30
30
  // eslint-disable-next-line no-restricted-syntax -- JSON.parse 戻り値の narrowing
31
31
  const packageJson = requireFromHere(packageJsonPath);