Enforces minimum version checks for dependencies #9

Merged
AlexKucera merged 2 commits from version_checker into master 2025-11-09 18:28:16 +01:00
Showing only changes of commit d078215361 - Show all commits
+3 -3
View File
@@ -143,9 +143,9 @@ export class DependencyChecker {
]);
coderabbitai[bot] commented 2025-11-09 18:07:39 +01:00 (Migrated from github.com)
Review

⚠️ Potential issue | 🔴 Critical

Typst version parsing fails due to case-sensitive regex

typst --version outputs Typst 0.13.0 … (capital “T”). With the current case-sensitive pattern, match returns null, version stays null, and meetsMinimumVersion defaults to true, so outdated Typst installs never trigger the new warning. Please make the regex case-insensitive (or match [Tt]ypst) so the version is actually parsed.

Apply this diff to fix the issue:

-			ExecutableChecker.checkDependency('Typst', typstExec, '--version', /typst\s+([\d.]+)/, DEPENDENCY_CONSTANTS.MINIMUM_VERSIONS.typst),
+			ExecutableChecker.checkDependency('Typst', typstExec, '--version', /typst\s+([\d.]+)/i, DEPENDENCY_CONSTANTS.MINIMUM_VERSIONS.typst),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

			ExecutableChecker.checkDependency('Typst', typstExec, '--version', /typst\s+([\d.]+)/i, DEPENDENCY_CONSTANTS.MINIMUM_VERSIONS.typst),
			ExecutableChecker.checkDependency('ImageMagick', imagemagickExec, '--version', /ImageMagick\s+([\d.-]+)/, DEPENDENCY_CONSTANTS.MINIMUM_VERSIONS.imagemagick)
🤖 Prompt for AI Agents
In src/core/DependencyChecker.ts around lines 147 to 148, the regex used to
parse Typst's version is case-sensitive and fails to match output like "Typst
0.13.0"; update the pattern to be case-insensitive (e.g. add the i flag or use
[Tt]ypst) so the version is correctly extracted, then proceed with the existing
version comparison logic so outdated Typst installs trigger the warning as
intended.

✅ Addressed in commit d078215

_⚠️ Potential issue_ | _🔴 Critical_ **Typst version parsing fails due to case-sensitive regex** `typst --version` outputs `Typst 0.13.0 …` (capital “T”). With the current case-sensitive pattern, `match` returns `null`, `version` stays `null`, and `meetsMinimumVersion` defaults to `true`, so outdated Typst installs never trigger the new warning. Please make the regex case-insensitive (or match `[Tt]ypst`) so the version is actually parsed. Apply this diff to fix the issue: ```diff - ExecutableChecker.checkDependency('Typst', typstExec, '--version', /typst\s+([\d.]+)/, DEPENDENCY_CONSTANTS.MINIMUM_VERSIONS.typst), + ExecutableChecker.checkDependency('Typst', typstExec, '--version', /typst\s+([\d.]+)/i, DEPENDENCY_CONSTANTS.MINIMUM_VERSIONS.typst), ``` <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. ```suggestion ExecutableChecker.checkDependency('Typst', typstExec, '--version', /typst\s+([\d.]+)/i, DEPENDENCY_CONSTANTS.MINIMUM_VERSIONS.typst), ExecutableChecker.checkDependency('ImageMagick', imagemagickExec, '--version', /ImageMagick\s+([\d.-]+)/, DEPENDENCY_CONSTANTS.MINIMUM_VERSIONS.imagemagick) ``` </details> <!-- suggestion_end --> <details> <summary>🤖 Prompt for AI Agents</summary> ``` In src/core/DependencyChecker.ts around lines 147 to 148, the regex used to parse Typst's version is case-sensitive and fails to match output like "Typst 0.13.0"; update the pattern to be case-insensitive (e.g. add the i flag or use [Tt]ypst) so the version is correctly extracted, then proceed with the existing version comparison logic so outdated Typst installs trigger the warning as intended. ``` </details> <!-- fingerprinting:phantom:medusa:sabertoothed --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit d078215
const [pandocInfo, typstInfo, imagemagickInfo] = await Promise.all([
ExecutableChecker.checkDependency('Pandoc', pandocExec, '--version', /pandoc\s+([\d.]+)/, DEPENDENCY_CONSTANTS.MINIMUM_VERSIONS.pandoc),
ExecutableChecker.checkDependency('Typst', typstExec, '--version', /typst\s+([\d.]+)/, DEPENDENCY_CONSTANTS.MINIMUM_VERSIONS.typst),
ExecutableChecker.checkDependency('ImageMagick', imagemagickExec, '--version', /ImageMagick\s+([\d.-]+)/, DEPENDENCY_CONSTANTS.MINIMUM_VERSIONS.imagemagick)
ExecutableChecker.checkDependency('Pandoc', pandocExec, '--version', /pandoc\s+([\d.]+)/i, DEPENDENCY_CONSTANTS.MINIMUM_VERSIONS.pandoc),
ExecutableChecker.checkDependency('Typst', typstExec, '--version', /typst\s+([\d.]+)/i, DEPENDENCY_CONSTANTS.MINIMUM_VERSIONS.typst),
ExecutableChecker.checkDependency('ImageMagick', imagemagickExec, '--version', /ImageMagick\s+([\d.-]+)/i, DEPENDENCY_CONSTANTS.MINIMUM_VERSIONS.imagemagick)
]);
const missingDependencies = [pandocInfo, typstInfo, imagemagickInfo]