Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README-es.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ Usa restricciones de versión estilo Composer:
<!-- Restricciones de rango -->
<download software="temporal" version="^1.20.0" />
<download software="dolt" version="~0.50.0" />
<!-- Y con un espacio o una coma, O con ||, rangos con guion, comodines, exclusiones -->
<download software="buf" version="^1.28 || ^2.0" />
<download software="protoc" version="25.0 - 26.1" />
<download software="mago" version="1.0.*, !=1.0.1" />

<!-- Restricciones de estabilidad -->
<download software="tool" version="^1.0.0@beta" />
Expand All @@ -343,7 +347,7 @@ Usa restricciones de versión estilo Composer:
</actions>
```

Un pre-release en una restricción fija la estabilidad mínima con cualquier operador, incluso en `<3.5.0-beta.2`; redúcela con `@alpha` o `@dev`.
Un pre-release en una restricción fija la estabilidad mínima con cualquier operador, incluso en `<3.5.0-beta.2`; redúcela con `@alpha` o `@dev`. Una palabra clave sin número también es un límite, como en Composer: `>2.0-beta` acepta `2.0.0-RC1` y `2.0.0`. Una versión exacta con pre-release u otro sufijo solo coincide con esa etiqueta: `2.0-beta` no acepta `2.0.0-beta.3` ni `2.0.0`, y `2.12.0-hotfix` no acepta `2.12.0-hotfix.2`. Las mayúsculas no importan: `1.0.0-arm64` coincide con la etiqueta `1.0.0-ARM64`, y `^1.0-Linux` acepta `1.0.0-linux`. Un pre-release puede ir pegado al número, como en las etiquetas: `^2.0.0rc1`.

### Opciones de Configuración Avanzadas

Expand Down
6 changes: 5 additions & 1 deletion README-ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,10 @@ DLoad поддерживает три типа загрузки, которые
<!-- Диапазонные ограничения -->
<download software="temporal" version="^1.20.0" />
<download software="dolt" version="~0.50.0" />
<!-- И через пробел или запятую, ИЛИ через ||, диапазоны через дефис, маски, исключения -->
<download software="buf" version="^1.28 || ^2.0" />
<download software="protoc" version="25.0 - 26.1" />
<download software="mago" version="1.0.*, !=1.0.1" />

<!-- Ограничения стабильности -->
<download software="tool" version="^1.0.0@beta" />
Expand All @@ -344,7 +348,7 @@ DLoad поддерживает три типа загрузки, которые
</actions>
```

Pre-release в ограничении задаёт минимальную стабильность при любом операторе, даже в `<3.5.0-beta.2`; понизить её можно через `@alpha` или `@dev`.
Pre-release в ограничении задаёт минимальную стабильность при любом операторе, даже в `<3.5.0-beta.2`; понизить её можно через `@alpha` или `@dev`. Ключевое слово без номера тоже служит границей, как в Composer: `>2.0-beta` берёт `2.0.0-RC1` и `2.0.0`. Точная версия с pre-release или другим суффиксом совпадает только с этим тегом: `2.0-beta` не берёт ни `2.0.0-beta.3`, ни `2.0.0`, а `2.12.0-hotfix` не берёт `2.12.0-hotfix.2`. Регистр не важен: `1.0.0-arm64` совпадает с тегом `1.0.0-ARM64`, а `^1.0-Linux` берёт `1.0.0-linux`. Pre-release может идти сразу за номером, как в тегах: `^2.0.0rc1`.

### Расширенные настройки

Expand Down
6 changes: 5 additions & 1 deletion README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ DLoad 支持三种下载类型,它们决定了资源的处理方式:
<!-- 范围约束 -->
<download software="temporal" version="^1.20.0" />
<download software="dolt" version="~0.50.0" />
<!-- 空格或逗号表示“与”,|| 表示“或”,连字符范围、通配符、排除 -->
<download software="buf" version="^1.28 || ^2.0" />
<download software="protoc" version="25.0 - 26.1" />
<download software="mago" version="1.0.*, !=1.0.1" />

<!-- 稳定性约束 -->
<download software="tool" version="^1.0.0@beta" />
Expand All @@ -343,7 +347,7 @@ DLoad 支持三种下载类型,它们决定了资源的处理方式:
</actions>
```

约束中的预发布版本会为任何运算符设定最低稳定性,即使是 `<3.5.0-beta.2`;可用 `@alpha` 或 `@dev` 降低。
约束中的预发布版本会为任何运算符设定最低稳定性,即使是 `<3.5.0-beta.2`;可用 `@alpha` 或 `@dev` 降低。不带编号的关键字也是边界,与 Composer 一致:`>2.0-beta` 会选中 `2.0.0-RC1` 和 `2.0.0`。带预发布或其他后缀的精确版本只匹配该标签:`2.0-beta` 不会选中 `2.0.0-beta.3` 或 `2.0.0`,`2.12.0-hotfix` 也不会选中 `2.12.0-hotfix.2`。大小写无关:`1.0.0-arm64` 匹配标签 `1.0.0-ARM64`,`^1.0-Linux` 会选中 `1.0.0-linux`。预发布版本可以像标签那样紧跟在版本号后面:`^2.0.0rc1`。

### 高级配置选项

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,10 @@ Use Composer-style version constraints:
<!-- Range constraints -->
<download software="temporal" version="^1.20.0" />
<download software="dolt" version="~0.50.0" />
<!-- AND by a space or a comma, OR by ||, hyphen ranges, wildcards, exclusions -->
<download software="buf" version="^1.28 || ^2.0" />
<download software="protoc" version="25.0 - 26.1" />
<download software="mago" version="1.0.*, !=1.0.1" />

<!-- Stability constraints -->
<download software="tool" version="^1.0.0@beta" />
Expand All @@ -345,7 +349,7 @@ Use Composer-style version constraints:
</actions>
```

A pre-release in a constraint sets the minimum stability for any operator, even for `<3.5.0-beta.2`; lower it with `@alpha` or `@dev`.
A pre-release in a constraint sets the minimum stability for any operator, even for `<3.5.0-beta.2`; lower it with `@alpha` or `@dev`. A keyword without a number is a bound too, as in Composer: `>2.0-beta` takes `2.0.0-RC1` and `2.0.0`. An exact version with a pre-release or another suffix matches only that tag: `2.0-beta` takes neither `2.0.0-beta.3` nor `2.0.0`, and `2.12.0-hotfix` not `2.12.0-hotfix.2`. Case does not matter: `1.0.0-arm64` matches the tag `1.0.0-ARM64`, and `^1.0-Linux` takes `1.0.0-linux`. A pre-release may follow the number right away, as in tags: `^2.0.0rc1`.

### Advanced Configuration Options

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
],
"require": {
"php": ">=8.2",
"composer/semver": "^3.4",
"internal/container": "^1.0",
"internal/destroy": "^1.0",
"internal/path": "^1.2",
Expand All @@ -36,6 +35,7 @@
},
"require-dev": {
"buggregator/trap": "^1.15",
"composer/semver": "^3.4",
"dereuromark/composer-prefer-lowest": "^0.1.10",
"llm/skills": "^1.9",
"roxblnfk/unpoly": "^1.8.1",
Expand Down
156 changes: 78 additions & 78 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion dload.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
• "~1.0.0" - Tilde constraint
• "^2.12.0-feature" - With feature suffix
• "^2.12.0@beta" - With explicit stability
• "^2.12.0-hotfix@rc" - Combined feature and stability
• "^2.12.0-hotfix@alpha" - Feature builds, alpha ones included
• "2025.1.0-rc.2" - One pre-release
• "^2025.1.0-rc.1" - Range from a pre-release on
• ">=1.0 &lt;2.0 || ^3.0" - Range and alternatives
</xs:documentation>
</xs:annotation>
</xs:attribute>
Expand Down
2 changes: 1 addition & 1 deletion skills/dload-fetch-tool/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Done when the block has a `<repository>` whose `asset-pattern` matches every OS/
| Attribute | Purpose |
|---|---|
| `software` | Alias or name of the tool (built-in or inline). Required. |
| `version` | Composer-style constraint: `^2025.1`, `~1.0.0`, `^2.12.0@beta`, `^2.12.0-hotfix@rc`, one pre-release like `2025.1.0-rc.2`, or a range from one like `^2025.1.0-rc.1`. Omit for latest stable. Pre-releases order by stability (`nightly < snapshot < dev < unstable < alpha < preview < beta < pre < RC < stable`), then by number; `stable` by default. A pre-release in a constraint sets the minimum stability for any operator, even `<3.5.0-beta.2`; lower it with `@alpha`/`@dev`. A tagged build like `2025.1.0-rc.2-linux` orders right after its pre-release: an exact `2025.1.0-rc.2` skips it, `>2025.1.0-rc.2` takes it. Numbers may have more than three parts (`1.2.3.4`); trailing zero parts don't count (`1.2.3` = `1.2.3.0`). |
| `version` | Composer-style constraint: `^2025.1`, `~1.0.0`, `^2.12.0@beta`, `^2.12.0-hotfix@alpha` (feature builds, alpha ones included), one pre-release like `2025.1.0-rc.2`, or a range from one like `^2025.1.0-rc.1`. Omit for latest stable. Pre-releases order by stability (`nightly < snapshot < dev < unstable < alpha < preview < beta < pre < RC < stable`), then by number; `stable` by default. A pre-release in a constraint sets the minimum stability for any operator, even `<3.5.0-beta.2`; lower it with `@alpha`/`@dev`. A keyword without a number is a bound too: `>2.0-beta` takes `2.0.0-RC1` and `2.0.0`. An exact version with a pre-release or another suffix is that one tag: `2.0-beta` skips `2.0.0-beta.3`, `2.12.0-hotfix` skips `2.12.0-hotfix.2`; after `^`, `~` or a comparison a non-stability suffix is a feature the tag must contain. A tagged build like `2025.1.0-rc.2-linux` orders right after its pre-release: an exact `2025.1.0-rc.2` skips it, `>2025.1.0-rc.2` takes it. Numbers may have more than three parts (`1.2.3.4`), in constraints too (`>=1.2.3.4.5`); trailing zero parts don't count (`1.2.3` = `1.2.3.0`). Case doesn't matter (`-ARM64` = `-arm64`, `^1.0-Linux` takes `1.0.0-linux`), and a pre-release may be glued to the number as in tags (`^2.0.0rc1`). |
| `extract-path` | Target folder (default: project root). |
| `type` | `binary` (default), `phar` (required for PHAR — skips extraction), `archive` (unpack the whole asset keeping its folder layout). |

Expand Down
2 changes: 2 additions & 0 deletions skills/dload-fetch-tool/references/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ curl -s "https://api.github.com/repos/<owner>/<repo>/releases?per_page=20" \
```

- `prerelease: true` while `version` demands stable → lower the stability (`@beta`/`@RC`/`@alpha`).
- Tag has a word after the number (`1.2.0-linux`, `1.2.0-arm64`) → a feature build of preview stability, skipped while `version` demands stable. Only a whole stability word marks a pre-release (`-beta2`, `rc1`, `-a1`): `-arm64` or `-build.5` is not alpha or beta.
- `version` is an exact version with a suffix (`2.12.0-hotfix`, `2025.1.0-rc.2`) → it matches only that tag, not `2.12.0-hotfix.2` or `2025.1.0-rc.2-linux`; use `^` or `>=` to take later builds.
- `draft: true` → invisible to dload until published.
- Tags carry text before the version (`bun-v1.4.2`, `cli-v2.0.0`) → set `tag-prefix` on the `<repository>`; without it the tags do not parse and every release is skipped. See [`registry-entry.md`](registry-entry.md#tag-prefix).
- Tag is on GitHub but dload picks an older one → the version registry still holds a fresh check; rerun with `dload get --refresh`. A release inserted below the top of the listing (e.g. a GitLab release with a backdated date) needs `dload cache:clear <alias>`. See [`version-registry.md`](version-registry.md).
Expand Down
5 changes: 3 additions & 2 deletions src/Module/Binary/BinaryVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ public static function fromBinaryOutput(string $output): static
/**
* Pattern to extract semantic version (X.Y.Z, or more parts like X.Y.Z.W) from text.
* Only a pre-release may follow the number right away, like `2.0.0rc1`: another word glued to it,
* like `1.2.3_amd64`, is not a part of the version.
* like `1.2.3_amd64`, is not a part of the version. Nor is a lone `a` or `b`: like the `c` of
* OpenSSL's `1.1.1c`, it is a patch letter, not an alpha or a beta.
*/
private static function outputVersionPattern(): string
{
return '/(?:version:?\s*)?(?:v(?:er(?:sion)?)?\.?\s*)?' . parent::VERSION_SEMVER_NUMBER_PATTERN
. '((?:[-+]|(?=(?:' . PreRelease::keywordPattern() . ')\d*\b))[\w.-]+)?/i';
. '((?:[-+]|(?=(?![ab](?![a-z]|[._-]?\d))' . PreRelease::wordPattern() . '))[\w.-]+)?/i';
}

/**
Expand Down
40 changes: 40 additions & 0 deletions src/Module/Version/Comparison.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

declare(strict_types=1);

namespace Internal\DLoad\Module\Version;

/**
* One comparison of a version constraint against a bound, e.g. `>=1.2.3` or `<3.5.0-beta.2`.
*
* A bound with a pre-release or another tail is a single release and compares as in sorting, tails included.
* A bound without one names a version number: every build of that number counts as the number,
* so `>=1.2` accepts `1.2.0-beta` and `<1.2` rejects it, as Composer does with `-dev` bounds.
*
* @internal
*/
final class Comparison
{
private function __construct(
public readonly Operator $operator,
public readonly Version $bound,
private readonly bool $withPreRelease,
) {}

/**
* @param non-empty-string $number Version number, e.g. `1.2.3`
* @param string $tail Pre-release or another tail of the bound with its separator, e.g. `-beta.1`, `rc1`
* or `-hotfix`, read as {@see Version} reads it; empty for none
*/
public static function create(Operator $operator, string $number, string $tail = ''): self
{
return new self($operator, Version::fromVersionString($number . $tail), $tail !== '');
}

public function isSatisfiedBy(Version $version): bool
{
return $this->operator->accepts(
$this->withPreRelease ? $version->compare($this->bound) : $version->compareNumber($this->bound),
);
}
}
Loading
Loading