@pecot/visual-mcp 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/assets/slidev/deck-lint.config.js +2 -2
- package/assets/slidev/deck-lint.env.config.js +2 -2
- package/assets/slidev/package.json +1 -1
- package/assets/slidev/scripts/eslint/_shared/dist/lib/drawio-geometry.js +10 -10
- package/assets/slidev/scripts/eslint/_shared/dist/lib/text-measurer.d.ts +2 -2
- package/assets/slidev/scripts/eslint/_shared/dist/lib/text-measurer.js +4 -4
- package/assets/slidev/scripts/eslint/_shared/dist/tsconfig.tsbuildinfo +1 -1
- package/assets/slidev/scripts/eslint/_shared/lib/drawio-geometry.ts +10 -10
- package/assets/slidev/scripts/eslint/_shared/lib/text-measurer.ts +4 -4
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-content-before-frontmatter.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-missing-marker-cell.js +4 -4
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-missing-page.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-numeric-asset-prefix.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-numeric-filename-prefix.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-scaled-drawio.js +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-triple-hyphen-in-frontmatter.js +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-unknown-props.js +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/one-slide-per-file.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/require-matching-length.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/require-slides-entry.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/validate-clicks.js +7 -7
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/tsconfig.tsbuildinfo +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-content-before-frontmatter.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-missing-marker-cell.ts +4 -4
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-missing-page.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-numeric-asset-prefix.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-numeric-filename-prefix.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-scaled-drawio.ts +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-triple-hyphen-in-frontmatter.ts +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-unknown-props.ts +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/one-slide-per-file.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/require-matching-length.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/require-slides-entry.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/validate-clicks.ts +7 -7
- package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/max-chars.js +6 -6
- package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/textlint-body.js +3 -3
- package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/textlint.js +2 -2
- package/assets/slidev/scripts/eslint/text-constraints/dist/tsconfig.tsbuildinfo +1 -1
- package/assets/slidev/scripts/eslint/text-constraints/lib/rules/max-chars.ts +6 -6
- package/assets/slidev/scripts/eslint/text-constraints/lib/rules/textlint-body.ts +3 -3
- package/assets/slidev/scripts/eslint/text-constraints/lib/rules/textlint.ts +2 -2
- package/assets/slidev/scripts/eslint/validate-references/dist/index.js +1 -1
- package/assets/slidev/scripts/eslint/validate-references/dist/lib/semantic-validator.js +12 -12
- package/assets/slidev/scripts/eslint/validate-references/dist/tsconfig.tsbuildinfo +1 -1
- package/assets/slidev/scripts/eslint/validate-references/index.ts +1 -1
- package/assets/slidev/scripts/eslint/validate-references/lib/semantic-validator.ts +12 -12
- package/cli/dist/cli.js +8 -8
- package/cli/dist/commands/chromium/host-dependencies.js +3 -3
- package/cli/dist/commands/drawio/export.js +15 -15
- package/cli/dist/commands/drawio/theme.js +7 -7
- package/cli/dist/commands/drawio/url.js +14 -14
- package/cli/dist/commands/evidence-xlsx/create.js +11 -11
- package/cli/dist/commands/pptx-ooxml/preview.js +13 -13
- package/cli/dist/commands/slidev-project/create.js +12 -12
- package/cli/dist/commands/slidev-project/linked-theme.js +5 -5
- package/cli/dist/commands/slidev-project/lint.js +13 -13
- package/cli/dist/commands/slidev-project/sync.js +19 -19
- package/cli/dist/commands/slidev-project/theme.js +9 -9
- package/cli/dist/commands/slidev-to-pptx/convert.js +47 -47
- package/cli/dist/domain/_shared/text-check.js +2 -2
- package/cli/dist/domain/drawio/export.js +4 -4
- package/cli/dist/domain/drawio/label-text.js +1 -1
- package/cli/dist/domain/drawio/url.js +27 -27
- package/cli/dist/domain/evidence-xlsx/image-dimensions.js +14 -14
- package/cli/dist/domain/evidence-xlsx/spec-schema.js +26 -26
- package/cli/dist/domain/pptx-ooxml/merge.js +3 -3
- package/cli/dist/domain/slidev-project/generated-files.d.ts +1 -1
- package/cli/dist/domain/slidev-project/generated-files.js +34 -34
- package/cli/dist/domain/slidev-project/initial-pages.js +4 -4
- package/cli/dist/domain/slidev-project/lint.js +11 -11
- package/cli/dist/domain/slidev-project/sync.js +13 -13
- package/cli/dist/domain/slidev-project/warnings.js +4 -4
- package/cli/dist/domain/slidev-theme/declaration.js +9 -9
- package/cli/dist/domain/slidev-theme/references.js +10 -10
- package/cli/dist/domain/slidev-theme/store-layout.js +6 -6
- package/cli/dist/domain/slidev-theme/talk-theme.js +13 -13
- package/cli/dist/domain/slidev-theme/theme-spec.js +5 -5
- package/cli/dist/domain/slidev-to-pptx/errors.js +3 -3
- package/cli/dist/infra/_shared/dependency-root.js +4 -4
- package/cli/dist/infra/_shared/patch-apply.js +6 -5
- package/cli/dist/infra/_shared/runtime-install.js +4 -3
- package/cli/dist/infra/_shared/slidev-bin.js +1 -1
- package/cli/dist/infra/drawio/icons.js +3 -3
- package/cli/dist/infra/drawio/pdf.js +1 -1
- package/cli/dist/infra/drawio/screenshot.js +10 -9
- package/cli/dist/infra/evidence-xlsx/workbook-writer.js +2 -2
- package/cli/dist/infra/playwright/chromium.js +4 -3
- package/cli/dist/infra/playwright/host-dependencies.js +8 -8
- package/cli/dist/infra/playwright/launch.js +5 -5
- package/cli/dist/infra/pptx-ooxml/soffice.js +2 -2
- package/cli/dist/infra/slidev-project/eslint-runner.js +10 -9
- package/cli/dist/infra/slidev-project/fs.js +6 -6
- package/cli/dist/infra/slidev-theme/store.js +18 -15
- package/cli/dist/infra/slidev-to-pptx/cache-store.js +6 -6
- package/cli/dist/infra/slidev-to-pptx/dom-converter.js +12 -12
- package/cli/dist/infra/slidev-to-pptx/pipeline.d.ts +1 -1
- package/cli/dist/infra/slidev-to-pptx/pipeline.js +54 -54
- package/cli/dist/infra/slidev-to-pptx/prerender-capture.js +14 -14
- package/cli/dist/infra/slidev-to-pptx/prerender.js +10 -10
- package/cli/dist/infra/slidev-to-pptx/runner.js +1 -0
- package/cli/dist/infra/slidev-to-pptx/scanner.js +10 -10
- package/cli/dist/infra/slidev-to-pptx/server.js +2 -2
- package/cli/dist/infra/slidev-to-pptx/single-pass-worker.js +39 -39
- package/cli/dist/infra/slidev-to-pptx/slide-worker.js +3 -3
- package/cli/dist/infra/slidev-to-pptx/visibility-helpers.js +8 -8
- package/cli/dist/mcp/dev-server-registry.js +10 -9
- package/cli/dist/mcp/queue.js +1 -1
- package/cli/dist/mcp/result.js +4 -4
- package/cli/dist/mcp/serve.js +1 -1
- package/cli/dist/mcp/server.js +2 -2
- package/cli/dist/mcp/tools/_shared.d.ts +1 -1
- package/cli/dist/mcp/tools/_shared.js +36 -37
- package/cli/dist/mcp/tools/drawio.js +22 -22
- package/cli/dist/mcp/tools/evidence.js +8 -8
- package/cli/dist/mcp/tools/setup.js +26 -26
- package/cli/dist/mcp/tools/slide-dev.js +20 -20
- package/cli/dist/mcp/tools/slide-page.js +36 -36
- package/cli/dist/mcp/tools/slide-theme.js +6 -6
- package/cli/dist/mcp/tools/slide.js +49 -49
- package/cli/dist/mcp/windows-path.js +8 -7
- package/cli/dist/node-runtime.d.ts +6 -1
- package/cli/dist/node-runtime.js +16 -8
- package/npm-shrinkwrap.json +3 -3
- package/package.json +2 -2
- package/vendor/text-rules/dist/source-hash +1 -1
|
@@ -31,7 +31,7 @@ export async function buildInitialPages(references, files) {
|
|
|
31
31
|
const usable = references.filter((entry) => {
|
|
32
32
|
const isUsable = PAGE_STEM.test(entry.name);
|
|
33
33
|
if (!isUsable)
|
|
34
|
-
warnings.push(
|
|
34
|
+
warnings.push(`layout name cannot be used as a page file name, so it is left out of the initial pages: ${entry.name}`);
|
|
35
35
|
return isUsable;
|
|
36
36
|
});
|
|
37
37
|
const sorted = usable.toSorted((a, b) => a.name.localeCompare(b.name));
|
|
@@ -56,15 +56,15 @@ export async function buildInitialPages(references, files) {
|
|
|
56
56
|
if (first === undefined) {
|
|
57
57
|
return {
|
|
58
58
|
pages: [],
|
|
59
|
-
warnings: [...warnings, '
|
|
59
|
+
warnings: [...warnings, 'the theme has no layouts, so no initial page was created (fix: check layouts/ in the theme)'],
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
return {
|
|
63
63
|
pages: [{ filename: `${first.name}.md`, content: `---\nlayout: ${first.name}\n---\n` }],
|
|
64
64
|
warnings: [
|
|
65
65
|
...warnings,
|
|
66
|
-
|
|
67
|
-
+ '
|
|
66
|
+
`the theme reference has no examples, so the initial page has only layout: ${first.name}; `
|
|
67
|
+
+ 'add examples to references/ in the theme to create initial pages with a skeleton',
|
|
68
68
|
],
|
|
69
69
|
};
|
|
70
70
|
}
|
|
@@ -37,19 +37,19 @@ talk-dir マーカー検証。振り分けは domain/slidev-project/sync.ts の
|
|
|
37
37
|
*/
|
|
38
38
|
export async function assertTalkDirectory(directory, fs) {
|
|
39
39
|
if (!path.isAbsolute(directory)) {
|
|
40
|
-
throw new SlideLintUsageError(`--dir
|
|
40
|
+
throw new SlideLintUsageError(`--dir must be an absolute path: ${directory}`, 'relative-dir');
|
|
41
41
|
}
|
|
42
42
|
const info = await fs.talkDirectoryExists(directory);
|
|
43
43
|
if (!info.exists) {
|
|
44
|
-
throw new SlideLintRuntimeError(`
|
|
44
|
+
throw new SlideLintRuntimeError(`directory not found: ${directory}`, 'dir-not-found');
|
|
45
45
|
}
|
|
46
46
|
if (!info.isDirectory) {
|
|
47
|
-
throw new SlideLintRuntimeError(`
|
|
47
|
+
throw new SlideLintRuntimeError(`not a directory: ${directory}`, 'not-a-directory');
|
|
48
48
|
}
|
|
49
49
|
const hasSlidesMd = await fs.doesSlidesMdExist(directory);
|
|
50
50
|
if (!hasSlidesMd) {
|
|
51
|
-
throw new SlideLintRuntimeError(`
|
|
52
|
-
+ ' pecotv slide create
|
|
51
|
+
throw new SlideLintRuntimeError(`not a talk-dir (no slides.md): ${directory}; `
|
|
52
|
+
+ 'specify a talk-dir created by pecotv slide create', 'not-talk-dir');
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
@@ -71,13 +71,13 @@ export async function runSlideLint(options, dependencies) {
|
|
|
71
71
|
});
|
|
72
72
|
// timedOut 時も SIGTERM で exitCode は null になるため、起動失敗より先に判定する。
|
|
73
73
|
if (result.timedOut) {
|
|
74
|
-
throw new SlideLintRuntimeError(`eslint
|
|
74
|
+
throw new SlideLintRuntimeError(`eslint did not finish in time: ${summarizeStderr(result.stderr)}`, 'eslint-timeout');
|
|
75
75
|
}
|
|
76
76
|
if (result.exitCode === null) {
|
|
77
|
-
throw new SlideLintRuntimeError(`eslint
|
|
77
|
+
throw new SlideLintRuntimeError(`eslint failed to start: ${summarizeStderr(result.stderr)}`, 'eslint-not-launched');
|
|
78
78
|
}
|
|
79
79
|
if (result.exitCode !== 0 && result.exitCode !== 1) {
|
|
80
|
-
throw new SlideLintRuntimeError(`eslint
|
|
80
|
+
throw new SlideLintRuntimeError(`eslint exited abnormally (exit ${String(result.exitCode)}): ${summarizeStderr(result.stderr)}`, 'eslint-failed');
|
|
81
81
|
}
|
|
82
82
|
// eslint が辿れなかった symlink dir の検出は lint 結果と独立。走査失敗以外で
|
|
83
83
|
// outcome / exit code を動かさないため、集計の外側で合流させる。
|
|
@@ -90,10 +90,10 @@ function parseEslintReport(stdout) {
|
|
|
90
90
|
parsed = JSON.parse(stdout);
|
|
91
91
|
}
|
|
92
92
|
catch (error) {
|
|
93
|
-
throw new SlideLintRuntimeError(`eslint
|
|
93
|
+
throw new SlideLintRuntimeError(`cannot parse the eslint JSON output: ${formatError(error)}`, 'invalid-report');
|
|
94
94
|
}
|
|
95
95
|
if (!Array.isArray(parsed)) {
|
|
96
|
-
throw new SlideLintRuntimeError('eslint
|
|
96
|
+
throw new SlideLintRuntimeError('eslint JSON output is not an array', 'invalid-report');
|
|
97
97
|
}
|
|
98
98
|
// eslint-disable-next-line no-restricted-syntax -- JSON.parse 戻り値の narrowing
|
|
99
99
|
return parsed;
|
|
@@ -147,7 +147,7 @@ const STDERR_EXCERPT_LIMIT = 400;
|
|
|
147
147
|
function summarizeStderr(stderr) {
|
|
148
148
|
const trimmed = stderr.trim();
|
|
149
149
|
if (trimmed === '')
|
|
150
|
-
return '(stderr
|
|
150
|
+
return '(no stderr)';
|
|
151
151
|
if (trimmed.length <= STDERR_EXCERPT_LIMIT)
|
|
152
152
|
return trimmed;
|
|
153
153
|
return `${trimmed.slice(0, STDERR_EXCERPT_LIMIT)}...`;
|
|
@@ -39,28 +39,28 @@ talk-dir マーカー検証。
|
|
|
39
39
|
*/
|
|
40
40
|
export async function assertTalkDirectory(directory, fs) {
|
|
41
41
|
if (!path.isAbsolute(directory)) {
|
|
42
|
-
throw new SlideSyncUsageError(`--dir
|
|
42
|
+
throw new SlideSyncUsageError(`--dir must be an absolute path: ${directory}`, 'relative-dir');
|
|
43
43
|
}
|
|
44
44
|
const info = await fs.talkDirectoryExists(directory);
|
|
45
45
|
if (!info.exists) {
|
|
46
|
-
throw new SlideSyncRuntimeError(`
|
|
46
|
+
throw new SlideSyncRuntimeError(`directory not found: ${directory}`, 'dir-not-found');
|
|
47
47
|
}
|
|
48
48
|
if (!info.isDirectory) {
|
|
49
|
-
throw new SlideSyncRuntimeError(`
|
|
49
|
+
throw new SlideSyncRuntimeError(`not a directory: ${directory}`, 'not-a-directory');
|
|
50
50
|
}
|
|
51
51
|
const hasSlidesMd = await fs.doesSlidesMdExist(directory);
|
|
52
52
|
if (!hasSlidesMd) {
|
|
53
|
-
throw new SlideSyncRuntimeError(`
|
|
54
|
-
+ ' pecotv slide create
|
|
53
|
+
throw new SlideSyncRuntimeError(`not a talk-dir (no slides.md): ${directory}; `
|
|
54
|
+
+ 'specify a talk-dir created by pecotv slide create', 'not-talk-dir');
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
function themeRequiredMessage(directory) {
|
|
58
|
-
return `${directory}
|
|
58
|
+
return `${directory} is a talk-dir from before migration that does not reference a theme; specify the theme to migrate to: `
|
|
59
59
|
+ `slide sync --dir ${directory} --theme <theme-spec>`
|
|
60
|
-
+
|
|
60
|
+
+ ` (MCP: slide_sync with dir: ${directory}, theme: <theme-spec>)`;
|
|
61
61
|
}
|
|
62
|
-
const IGNORED_THEME_WARNING = '--theme
|
|
63
|
-
+ '
|
|
62
|
+
const IGNORED_THEME_WARNING = '--theme was not used because this talk-dir already references a theme; '
|
|
63
|
+
+ 'to change the theme or its version, edit the dependency in package.json and run sync';
|
|
64
64
|
/**
|
|
65
65
|
sync の工程。talk-dir を 3 通りに分けて進める。
|
|
66
66
|
|
|
@@ -81,8 +81,8 @@ export async function runSlideSync(options, dependencies) {
|
|
|
81
81
|
await assertTalkDirectory(options.directory, dependencies.fs);
|
|
82
82
|
if (options.nodeModulesOnly) {
|
|
83
83
|
if (options.theme !== undefined) {
|
|
84
|
-
throw new SlideSyncUsageError('--node-modules-only
|
|
85
|
-
+ '
|
|
84
|
+
throw new SlideSyncUsageError('--node-modules-only and --theme cannot be used together; '
|
|
85
|
+
+ 'use --node-modules-only to relink node_modules only, or --theme to migrate', 'theme-with-node-modules-only');
|
|
86
86
|
}
|
|
87
87
|
return await relink(options, dependencies, []);
|
|
88
88
|
}
|
|
@@ -151,7 +151,7 @@ async function migrate(directory, themeSpec, dependencies) {
|
|
|
151
151
|
catch (error) {
|
|
152
152
|
if (error instanceof SlideSyncRuntimeError || error instanceof SlideSyncUsageError)
|
|
153
153
|
throw error;
|
|
154
|
-
throw new SlideSyncRuntimeError(
|
|
154
|
+
throw new SlideSyncRuntimeError(`migration failed: ${formatError(error)}`, 'migrate-failed');
|
|
155
155
|
}
|
|
156
156
|
let nodeModulesTarget;
|
|
157
157
|
try {
|
|
@@ -183,7 +183,7 @@ function wrapLinkError(error) {
|
|
|
183
183
|
// theme-name-mismatch など、原因の文言を持つ例外は包み直さない。
|
|
184
184
|
if (error instanceof SlideCreateRuntimeError)
|
|
185
185
|
return error;
|
|
186
|
-
return new SlideSyncRuntimeError(`node_modules
|
|
186
|
+
return new SlideSyncRuntimeError(`relinking node_modules failed: ${formatError(error)}`, 'symlink-failed');
|
|
187
187
|
}
|
|
188
188
|
/* c8 ignore start -- 非 Error 例外 (string throw 等) は本実装範囲では未発生、防御網のみ */
|
|
189
189
|
function formatError(error) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// 利用者に伝える警告の文言。create・convert が同じ文言を使う。
|
|
2
|
-
export const LINK_COLOR_OMITTED_WARNING = 'pptx.linkColor
|
|
3
|
-
+ '
|
|
4
|
-
export const EAST_ASIAN_FONT_OMITTED_WARNING = 'pptx.eastAsianFont
|
|
5
|
-
+ '
|
|
2
|
+
export const LINK_COLOR_OMITTED_WARNING = 'pptx.linkColor is omitted, so links are not converted in the PPTX (no hyperlinks are added); '
|
|
3
|
+
+ 'to convert links, set pptx.linkColor in pecot-theme.json to 6 hex digits';
|
|
4
|
+
export const EAST_ASIAN_FONT_OMITTED_WARNING = 'pptx.eastAsianFont is omitted, so no East Asian font is written to the PPTX; '
|
|
5
|
+
+ 'to set the Japanese font, set pptx.eastAsianFont in pecot-theme.json to a font name';
|
|
6
6
|
//# sourceMappingURL=warnings.js.map
|
|
@@ -10,7 +10,7 @@ export const THEME_DECLARATION_FILE_NAME = 'pecot-theme.json';
|
|
|
10
10
|
export const SUPPORTED_SCHEMA = 1;
|
|
11
11
|
// 誤りの文言に添える、契約の節の案内。
|
|
12
12
|
const CONTRACT_FILE = 'contracts/theme-declaration.md';
|
|
13
|
-
const SHAPE_SECTION =
|
|
13
|
+
const SHAPE_SECTION = `the \`${THEME_DECLARATION_FILE_NAME}\` section of ${CONTRACT_FILE}`;
|
|
14
14
|
export class ThemeDeclarationError extends Error {
|
|
15
15
|
reason;
|
|
16
16
|
constructor(message, reason) {
|
|
@@ -35,7 +35,7 @@ const fontSizesSchema = z.object({
|
|
|
35
35
|
});
|
|
36
36
|
const pptxSchema = z.object({
|
|
37
37
|
eastAsianFont: name.optional(),
|
|
38
|
-
linkColor: z.string().regex(/^[\da-f]{6}$/iu, '6
|
|
38
|
+
linkColor: z.string().regex(/^[\da-f]{6}$/iu, 'must be 6 hex digits').optional(),
|
|
39
39
|
});
|
|
40
40
|
const lintSchema = z.object({ rules: z.record(z.string(), severity).optional() });
|
|
41
41
|
const layoutsSchema = z.object({ references: name.optional() });
|
|
@@ -62,27 +62,27 @@ JSON を読んだ unknown 値を宣言として検証し、省いた項目を既
|
|
|
62
62
|
*/
|
|
63
63
|
export function parseThemeDeclaration(raw) {
|
|
64
64
|
if (!isRecord(raw)) {
|
|
65
|
-
throw new ThemeDeclarationError(`${THEME_DECLARATION_FILE_NAME}
|
|
65
|
+
throw new ThemeDeclarationError(`${THEME_DECLARATION_FILE_NAME} must be an object (see ${SHAPE_SECTION})`, 'invalid-shape');
|
|
66
66
|
}
|
|
67
67
|
const { schema } = raw;
|
|
68
68
|
if (typeof schema === 'number' && schema !== SUPPORTED_SCHEMA) {
|
|
69
69
|
return {
|
|
70
70
|
declaration: DEFAULT_THEME_DECLARATION,
|
|
71
71
|
warnings: [
|
|
72
|
-
`${THEME_DECLARATION_FILE_NAME}
|
|
72
|
+
`${THEME_DECLARATION_FILE_NAME} schema ${String(schema)} is not supported (supported: ${String(SUPPORTED_SCHEMA)}); ignoring the declaration and continuing with the defaults`,
|
|
73
73
|
],
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
const parsed = declarationSchema.safeParse(raw);
|
|
77
77
|
if (!parsed.success) {
|
|
78
78
|
const detail = parsed.error.issues
|
|
79
|
-
.map(issue => `${issue.path.map(String).join('.') || '(
|
|
79
|
+
.map(issue => `${issue.path.map(String).join('.') || '(top level)'}: ${issue.message}`)
|
|
80
80
|
.join('; ');
|
|
81
|
-
throw new ThemeDeclarationError(
|
|
81
|
+
throw new ThemeDeclarationError(`invalid shape of ${THEME_DECLARATION_FILE_NAME}: ${detail} (see ${SHAPE_SECTION})`, 'invalid-shape');
|
|
82
82
|
}
|
|
83
83
|
const unknownRules = Object.keys(parsed.data.lint?.rules ?? {}).filter(id => !KNOWN_RULES.has(id));
|
|
84
84
|
if (unknownRules.length > 0) {
|
|
85
|
-
throw new ThemeDeclarationError(
|
|
85
|
+
throw new ThemeDeclarationError(`lint.rules in ${THEME_DECLARATION_FILE_NAME} has rules the deck lint does not have: ${unknownRules.join(', ')} (see the "lint.rules" part of ${SHAPE_SECTION})`, 'unknown-rule');
|
|
86
86
|
}
|
|
87
87
|
return { declaration: resolve(parsed.data), warnings: [] };
|
|
88
88
|
}
|
|
@@ -95,7 +95,7 @@ export async function readThemeDeclaration(files, themeRoot) {
|
|
|
95
95
|
if (text === undefined) {
|
|
96
96
|
return {
|
|
97
97
|
declaration: DEFAULT_THEME_DECLARATION,
|
|
98
|
-
warnings: [
|
|
98
|
+
warnings: [`theme ${themeRoot} has no ${THEME_DECLARATION_FILE_NAME} declaration; continuing with the defaults`],
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
let raw;
|
|
@@ -104,7 +104,7 @@ export async function readThemeDeclaration(files, themeRoot) {
|
|
|
104
104
|
}
|
|
105
105
|
catch (error) {
|
|
106
106
|
const reason = error instanceof Error ? error.message : String(error);
|
|
107
|
-
throw new ThemeDeclarationError(
|
|
107
|
+
throw new ThemeDeclarationError(`cannot read ${filePath} as JSON: ${reason} (see ${SHAPE_SECTION})`, 'invalid-shape');
|
|
108
108
|
}
|
|
109
109
|
return parseThemeDeclaration(raw);
|
|
110
110
|
}
|
|
@@ -11,7 +11,7 @@ const COMMON_FILE_NAME = '_common.yaml';
|
|
|
11
11
|
/**
|
|
12
12
|
分類を読めなかったときの復旧導線。テーマ側の宣言を直す案内を、分類まわりの警告に必ず添える。
|
|
13
13
|
*/
|
|
14
|
-
const CATEGORY_SYNC_HINT = '
|
|
14
|
+
const CATEGORY_SYNC_HINT = 'check layout_categories in references/_common.yaml of the theme';
|
|
15
15
|
function isDeclarationFile(fileName, extension) {
|
|
16
16
|
return fileName.endsWith(extension) && !fileName.startsWith('_');
|
|
17
17
|
}
|
|
@@ -27,7 +27,7 @@ warnings) {
|
|
|
27
27
|
}
|
|
28
28
|
default: {
|
|
29
29
|
if (typeof value === 'string' && value !== '') {
|
|
30
|
-
warnings.push(
|
|
30
|
+
warnings.push(`unknown status in ${fileName}: ${value}; treating it as stable`);
|
|
31
31
|
}
|
|
32
32
|
return 'stable';
|
|
33
33
|
}
|
|
@@ -97,8 +97,8 @@ export async function resolveLayoutReferences(files, options) {
|
|
|
97
97
|
*/
|
|
98
98
|
const UNCATEGORIZED_CATEGORY = {
|
|
99
99
|
id: UNCATEGORIZED,
|
|
100
|
-
label: '
|
|
101
|
-
question: `category
|
|
100
|
+
label: 'Uncategorized',
|
|
101
|
+
question: `layouts whose category is unset or unknown (${CATEGORY_SYNC_HINT})`,
|
|
102
102
|
};
|
|
103
103
|
/**
|
|
104
104
|
`layout_categories` の 1 要素を `LayoutCategory` へ写す。`id` / `label` / `question` が
|
|
@@ -119,7 +119,7 @@ function toLayoutCategory(value) {
|
|
|
119
119
|
function categoriesUnusable(commonPath, reason) {
|
|
120
120
|
return {
|
|
121
121
|
categories: [],
|
|
122
|
-
warnings: [
|
|
122
|
+
warnings: [`cannot read the layout categories (${commonPath}: ${reason}); continuing without categories (fix: ${CATEGORY_SYNC_HINT})`],
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
125
|
async function findCommonFile(files, directories) {
|
|
@@ -146,14 +146,14 @@ export async function readLayoutCategories(files, directories) {
|
|
|
146
146
|
const found = await findCommonFile(files, directories);
|
|
147
147
|
const lastDirectory = directories.at(-1) ?? '';
|
|
148
148
|
if (found === undefined) {
|
|
149
|
-
return categoriesUnusable(path.join(lastDirectory, COMMON_FILE_NAME), '
|
|
149
|
+
return categoriesUnusable(path.join(lastDirectory, COMMON_FILE_NAME), 'file not found');
|
|
150
150
|
}
|
|
151
151
|
let items;
|
|
152
152
|
try {
|
|
153
153
|
const parsed = parse(found.text);
|
|
154
154
|
const raw = isRecord(parsed) ? parsed['layout_categories'] : undefined;
|
|
155
155
|
if (!Array.isArray(raw))
|
|
156
|
-
throw new TypeError('layout_categories
|
|
156
|
+
throw new TypeError('layout_categories is not found as an array');
|
|
157
157
|
items = raw;
|
|
158
158
|
}
|
|
159
159
|
catch (error) {
|
|
@@ -178,14 +178,14 @@ export async function readLayoutCategories(files, directories) {
|
|
|
178
178
|
}
|
|
179
179
|
if (categories.length === 0) {
|
|
180
180
|
// 全滅は「分類が読めなかった」のと利用者から見て区別がつかないので、同じ 1 行に合流させる。
|
|
181
|
-
return categoriesUnusable(found.path, `layout_categories
|
|
181
|
+
return categoriesUnusable(found.path, `layout_categories has no usable item (0 of ${String(items.length)})`);
|
|
182
182
|
}
|
|
183
183
|
const warnings = [];
|
|
184
184
|
if (reserved > 0) {
|
|
185
|
-
warnings.push(`layout_categories
|
|
185
|
+
warnings.push(`ignoring reserved layout_categories id ${UNCATEGORIZED} (${String(reserved)} item(s)); ${CATEGORY_SYNC_HINT}`);
|
|
186
186
|
}
|
|
187
187
|
if (malformed > 0) {
|
|
188
|
-
warnings.push(`layout_categories
|
|
188
|
+
warnings.push(`skipped part of layout_categories (id, label or question missing: ${String(malformed)} item(s)); ${CATEGORY_SYNC_HINT}`);
|
|
189
189
|
}
|
|
190
190
|
return { categories, warnings };
|
|
191
191
|
}
|
|
@@ -86,18 +86,18 @@ export function classifyGitFailure(stderr) {
|
|
|
86
86
|
export function gitFailureAdvice(kind, spec) {
|
|
87
87
|
switch (kind) {
|
|
88
88
|
case 'connection': {
|
|
89
|
-
return
|
|
90
|
-
+ 'SSL
|
|
89
|
+
return `cannot connect to the theme source: ${spec.url} (fix: check the network and proxy; `
|
|
90
|
+
+ 'if it stops at SSL certificate verification, set git http.sslCAInfo to the CA bundle of the TLS-intercepting proxy)';
|
|
91
91
|
}
|
|
92
92
|
case 'auth': {
|
|
93
|
-
return
|
|
94
|
-
+ 'git
|
|
93
|
+
return `authentication failed for the theme source: ${spec.url} `
|
|
94
|
+
+ '(fix: set up git credentials, a credential helper or an SSH key, and retry)';
|
|
95
95
|
}
|
|
96
96
|
case 'tag': {
|
|
97
|
-
return
|
|
97
|
+
return `tag not found in the theme source ${spec.url}: ${spec.tag} (fix: check the tag name; branch names are not accepted)`;
|
|
98
98
|
}
|
|
99
99
|
case 'unknown': {
|
|
100
|
-
return
|
|
100
|
+
return `git could not fetch the theme source: ${spec.url}`;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
}
|
|
@@ -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
|
-
+
|
|
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 = '
|
|
27
|
-
+ '
|
|
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(
|
|
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(
|
|
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
|
|
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
|
|
121
|
-
+
|
|
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(
|
|
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}
|
|
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
|
|
179
|
-
+ '
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
29
|
-
+ ` (
|
|
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
|
-
//
|
|
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 = '
|
|
300
|
-
+ '
|
|
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
|
|
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
|
|
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(
|
|
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
|
|
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
|
|
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 で表す。
|
|
@@ -83,7 +83,7 @@ export function runtimeInstallPlan(manifestPath) {
|
|
|
83
83
|
const dependencies = dependencyMap(manifest['dependencies']);
|
|
84
84
|
const coreVersion = dependencies['@slidev/cli'];
|
|
85
85
|
if (coreVersion === undefined || coreVersion === '') {
|
|
86
|
-
throw new Error(
|
|
86
|
+
throw new Error(`dependencies in ${manifestPath} has no version for @slidev/cli (the distribution is corrupted)`);
|
|
87
87
|
}
|
|
88
88
|
const specs = Object.entries(dependencies)
|
|
89
89
|
.filter(([, range]) => !LOCAL_PROTOCOL_PATTERN.test(range))
|
|
@@ -151,7 +151,7 @@ options) {
|
|
|
151
151
|
// eslint-disable-next-line unicorn/no-null -- 同上
|
|
152
152
|
signal: null,
|
|
153
153
|
stdout: '',
|
|
154
|
-
stderr: '
|
|
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
155
|
timedOut: false,
|
|
156
156
|
failedStage: 'npm',
|
|
157
157
|
};
|
|
@@ -181,7 +181,7 @@ options) {
|
|
|
181
181
|
// eslint-disable-next-line unicorn/no-null -- 同上
|
|
182
182
|
signal: null,
|
|
183
183
|
stdout: '',
|
|
184
|
-
stderr:
|
|
184
|
+
stderr: `catalog: entries that should be replaced at distribution remain in ${options.manifestPath}: ${unresolved.join(', ')}`,
|
|
185
185
|
timedOut: false,
|
|
186
186
|
failedStage: 'npm',
|
|
187
187
|
};
|
|
@@ -205,6 +205,7 @@ options) {
|
|
|
205
205
|
...plan.specs,
|
|
206
206
|
]);
|
|
207
207
|
const result = await spawnPromise(locked.command, locked.commandArguments, {
|
|
208
|
+
// interface-env: none
|
|
208
209
|
env: process.env,
|
|
209
210
|
timeoutMs: RUNTIME_INSTALL_TIMEOUT_MS,
|
|
210
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(
|
|
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);
|
|
@@ -21,7 +21,7 @@ export function createIconResolver(iconRoot, options = {}) {
|
|
|
21
21
|
return (relativePath, color) => {
|
|
22
22
|
// 空文字 / `/` 単独は `.svg` 単一ファイル名 (`iconRoot/.svg`) を解決してしまうため早期 reject
|
|
23
23
|
if (relativePath === '' || relativePath === '/') {
|
|
24
|
-
options.warn?.(
|
|
24
|
+
options.warn?.(`empty icon path: ${relativePath}`);
|
|
25
25
|
return undefined;
|
|
26
26
|
}
|
|
27
27
|
const withExtension = relativePath.endsWith('.svg') ? relativePath : `${relativePath}.svg`;
|
|
@@ -29,11 +29,11 @@ export function createIconResolver(iconRoot, options = {}) {
|
|
|
29
29
|
const resolved = path.resolve(iconRoot, withExtension);
|
|
30
30
|
const normalizedRoot = path.resolve(iconRoot);
|
|
31
31
|
if (resolved !== normalizedRoot && !resolved.startsWith(`${normalizedRoot}${path.sep}`)) {
|
|
32
|
-
options.warn?.(
|
|
32
|
+
options.warn?.(`icon path resolves outside iconRoot: ${relativePath}`);
|
|
33
33
|
return undefined;
|
|
34
34
|
}
|
|
35
35
|
if (!existsSync(resolved)) {
|
|
36
|
-
options.warn?.(
|
|
36
|
+
options.warn?.(`icon not found: ${resolved}`);
|
|
37
37
|
return undefined;
|
|
38
38
|
}
|
|
39
39
|
let svgText = readFileSync(resolved, 'utf8');
|