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
24 changes: 24 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# DLoad

A PHP CLI (`vendor/bin/dload`, also shipped as a PHAR) that downloads binaries and PHARs from GitHub and GitLab releases into a project, driven by the project's `dload.xml`; it also builds custom RoadRunner binaries through Velox.

- `src/Module/*` holds the modules (Repository, Downloader, Registry, Installer, Velox…); `src/Bootstrap.php` wires the container.
- `resources/software.json` is the built-in software registry; `dload.xsd` is the schema of `dload.xml`.
- `1.x` is the development and release branch: branch from it and target pull requests at it.
- Tests run on Testo: `vendor/bin/testo --json`. Static analysis: `composer psalm`. Code style: `composer cs:fix`.

## Docs and skills follow behaviour

A change a user can observe — a new feature, attribute, option, environment variable, or a different default — lands together with its documentation in the same pull request:

- `README.md`, then the same change in every translation (`README-ru.md`, `README-es.md`, `README-zh.md`), keeping each file's anchor style.
- `dload.xsd` for anything new in `dload.xml`; `resources/software.schema.json` for anything new in `software.json`.
- `skills/dload-fetch-tool` — the skill shipped to projects that use DLoad; its references describe how entries, tokens and the version registry behave, so they go stale with the code.

`skills/` is the source of truth for skills. `.agents/skills` and `.claude/skills` are copies installed from `skills.json`; edit `skills/` only.

## Releases

release-please cuts releases from `1.x`: it writes `CHANGELOG.md` and `resources/version.json` from the commit history, so both files are generated — leave them to it.

Commit subjects follow conventional commits, and the type picks the changelog section (`.github/.release-please-config.json`): `feat`, `fix`, `perf`, `docs`, `refactor` are listed; `test`, `chore`, `ci`, `build`, `style` are hidden. A commit carrying several changes lists each as its own conventional line at the top of the body, so every change reaches its section.
50 changes: 0 additions & 50 deletions CLAUDE.md

This file was deleted.

59 changes: 57 additions & 2 deletions README-es.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Con DLoad puedes:
- [Registro de Software Personalizado](#registro-de-software-personalizado)
- [Definir Software](#definir-software)
- [Elementos de Software](#elementos-de-software)
- [Servidores Autoalojados](#servidores-autoalojados)
- [Casos de Uso](#casos-de-uso)
- [Configurar Entorno de Desarrollo](#configurar-entorno-de-desarrollo)
- [Configurar Nuevo Proyecto](#configurar-nuevo-proyecto)
Expand Down Expand Up @@ -588,8 +589,8 @@ El binario de RoadRunner construido incluirá solo los plugins especificados en

#### Configuración de Repository

- **type**: Actualmente soporta "github"
- **uri**: Ruta del repositorio (ej., "username/repo")
- **type**: "github" o "gitlab"
- **uri**: Ruta del repositorio (ej., "username/repo") o su URL en un servidor autoalojado, consulta [Servidores Autoalojados](#servidores-autoalojados)
- **asset-pattern**: Patrón regex para hacer match con assets de release
- **tag-prefix**: Texto antes de la versión en los tags de release, p. ej. `bun-` para `bun-v1.4.2`. Los releases con otros tags se ignoran, así que de un monorepo con tags por componente (release-please) solo se usa el componente seleccionado

Expand All @@ -605,6 +606,56 @@ El binario de RoadRunner construido incluirá solo los plugins especificados en
- **extract-path**: Directorio de extracción opcional
- Funciona en cualquier sistema (sin filtrado por SO/arquitectura)

### Servidores Autoalojados

Un repositorio en GitHub Enterprise Server, en un GitLab autoalojado o en cualquier otra instancia on-premise
se indica con su URL en `uri`, en lugar de una ruta en `github.com` / `gitlab.com`:

```xml
<registry>
<software name="Tool" alias="tool">
<repository type="github" uri="https://ghe.example.com/my-org/tool" />
</software>
<software name="Other" alias="other">
<repository type="gitlab" uri="https://gitlab.example.com:8443/group/subgroup/other" />
</software>
</registry>
```

- El esquema, el host y el puerto de la URL son el servidor; la ruta es el repositorio: `owner/repo` para GitHub,
la ruta completa del proyecto con subgrupos para GitLab. Una `/` final y el sufijo `.git` se ignoran,
así que también sirve una URL de clonado. La URL de una página dentro del repositorio (`/releases`, `/-/tags`) es un error.
- El esquema es obligatorio: `ghe.example.com/my-org/tool` no es una URL, y dload nunca toma un servidor de ella.
- Una URL del host público (`https://github.com/owner/repo`, `https://gitlab.com/group/project`) significa el host
público, igual que una ruta simple.
- La API se encuentra en `{server}/api/v3` para GitHub Enterprise Server y en `{server}/api/v4` para GitLab.
Un GitLab instalado bajo una raíz de URL relativa (`https://example.com/gitlab/...`) no está soportado.

El token se declara por servidor en una variable de entorno con su nombre: `DLOAD_TOKEN_` seguido del
host en mayúsculas, donde un punto se convierte en `_` y un guion en `__`; un puerto distinto del predeterminado
va después de `___`. Una dirección IPv6 empieza por `_` y enumera sus ocho grupos. Cada servidor tiene su propio
nombre, así que `ghe.example.com` y `ghe-example.com` nunca comparten un token. El esquema no forma parte del nombre.

| Servidor | Variable del token |
|---------------------------|-------------------------------------------------|
| `github.com` | `DLOAD_TOKEN_GITHUB_COM`, luego `GITHUB_TOKEN` |
| `gitlab.com` | `DLOAD_TOKEN_GITLAB_COM`, luego `GITLAB_TOKEN` |
| `ghe.example.com` | `DLOAD_TOKEN_GHE_EXAMPLE_COM` |
| `git-lab.example.com` | `DLOAD_TOKEN_GIT__LAB_EXAMPLE_COM` |
| `gitlab.example.com:8443` | `DLOAD_TOKEN_GITLAB_EXAMPLE_COM___8443` |
| `http://[::1]:8080` | `DLOAD_TOKEN__0_0_0_0_0_0_0_1___8080` |

```bash
DLOAD_TOKEN_GHE_EXAMPLE_COM=your_token_here ./vendor/bin/dload get
```

La configuración no puede elegir qué variable se lee, así que un `dload.xml` de terceros no puede enviar
tus tokens a ningún sitio. `GITHUB_TOKEN` y `GITLAB_TOKEN` nunca se envían a un servidor autoalojado, y
el token de un servidor solo va a ese esquema, host y puerto exactos, y se descarta cuando el servidor redirige a otro sitio.

Se permite `http` sin cifrar, p. ej. para una API falsa local en tests (`uri="http://127.0.0.1:8080/owner/repo"`), pero el token
solo se envía por él a `localhost`, `127.0.0.0/8` y `[::1]`.

## Casos de Uso

### Configurar Entorno de Desarrollo
Expand Down Expand Up @@ -682,6 +733,10 @@ GITLAB_TOKEN=your_token_here ./vendor/bin/dload get

Agrégalo a las variables de entorno CI/CD para descargas automatizadas.

`DLOAD_TOKEN_GITHUB_COM` y `DLOAD_TOKEN_GITLAB_COM` tienen prioridad sobre `GITHUB_TOKEN` y `GITLAB_TOKEN`,
lo que ayuda cuando esos nombres ya los usa otra herramienta. Los servidores autoalojados tienen sus propias variables,
consulta [Servidores Autoalojados](#servidores-autoalojados).

## Configuración de Gitlab CI

Al crear un release en Gitlab, asegúrate de subir tus assets a la página del release a través del
Expand Down
59 changes: 57 additions & 2 deletions README-ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ DLoad решает распространённую проблему в PHP-пр
- [Пользовательский реестр ПО](#пользовательский-реестр-по)
- [Определение ПО](#определение-по)
- [Элементы ПО](#элементы-по)
- [Собственные серверы](#собственные-серверы)
- [Сценарии использования](#сценарии-использования)
- [Настройка среды разработки](#настройка-среды-разработки)
- [Настройка нового проекта](#настройка-нового-проекта)
Expand Down Expand Up @@ -590,8 +591,8 @@ DLoad автоматически управляет процессом сбор

#### Конфигурация репозитория

- **type**: В настоящее время поддерживает "github"
- **uri**: Путь репозитория (например, "username/repo")
- **type**: "github" или "gitlab"
- **uri**: Путь репозитория (например, "username/repo") или его URL на собственном сервере, см. [Собственные серверы](#собственные-серверы)
- **asset-pattern**: Regex-паттерн для соответствия ресурсам релиза
- **tag-prefix**: Текст перед версией в тегах релизов, например `bun-` для `bun-v1.4.2`. Релизы с другими тегами игнорируются, поэтому из монорепозитория с тегами по компонентам (release-please) берётся только нужный компонент

Expand All @@ -607,6 +608,56 @@ DLoad автоматически управляет процессом сбор
- **extract-path**: Опциональная папка извлечения
- Работает на любой системе (без фильтрации по ОС/архитектуре)

### Собственные серверы

Репозиторий на GitHub Enterprise Server, собственном GitLab или любом другом локально развёрнутом экземпляре
задаётся в `uri` своим URL вместо пути на `github.com` / `gitlab.com`:

```xml
<registry>
<software name="Tool" alias="tool">
<repository type="github" uri="https://ghe.example.com/my-org/tool" />
</software>
<software name="Other" alias="other">
<repository type="gitlab" uri="https://gitlab.example.com:8443/group/subgroup/other" />
</software>
</registry>
```

- Схема, хост и порт URL — это сервер, путь — репозиторий: `owner/repo` для GitHub, полный путь проекта
с подгруппами для GitLab. Завершающий `/` и суффикс `.git` игнорируются, поэтому подойдёт и URL для клонирования.
URL страницы внутри репозитория (`/releases`, `/-/tags`) — ошибка.
- Схема обязательна: `ghe.example.com/my-org/tool` — не URL, и сервер из такого значения dload никогда не берёт.
- URL публичного хоста (`https://github.com/owner/repo`, `https://gitlab.com/group/project`) означает публичный
хост, как и просто путь.
- API находится по адресу `{server}/api/v3` для GitHub Enterprise Server и `{server}/api/v4` для GitLab.
GitLab, установленный с относительным корнем URL (`https://example.com/gitlab/...`), не поддерживается.

Токен задаётся для каждого сервера в отдельной переменной окружения, названной по нему: `DLOAD_TOKEN_`, а за ним
хост в верхнем регистре, где точка заменяется на `_`, а дефис — на `__`; порт, отличный от стандартного, идёт
после `___`. IPv6-адрес начинается с `_` и перечисляет все восемь групп. У каждого сервера своё имя,
поэтому `ghe.example.com` и `ghe-example.com` никогда не получат один и тот же токен. Схема в имя не входит.

| Сервер | Переменная с токеном |
|---------------------------|-------------------------------------------------|
| `github.com` | `DLOAD_TOKEN_GITHUB_COM`, затем `GITHUB_TOKEN` |
| `gitlab.com` | `DLOAD_TOKEN_GITLAB_COM`, затем `GITLAB_TOKEN` |
| `ghe.example.com` | `DLOAD_TOKEN_GHE_EXAMPLE_COM` |
| `git-lab.example.com` | `DLOAD_TOKEN_GIT__LAB_EXAMPLE_COM` |
| `gitlab.example.com:8443` | `DLOAD_TOKEN_GITLAB_EXAMPLE_COM___8443` |
| `http://[::1]:8080` | `DLOAD_TOKEN__0_0_0_0_0_0_0_1___8080` |

```bash
DLOAD_TOKEN_GHE_EXAMPLE_COM=your_token_here ./vendor/bin/dload get
```

Конфигурация не может выбрать, какая переменная будет прочитана, поэтому сторонний `dload.xml` не сможет отправить
ваши токены куда-либо ещё. `GITHUB_TOKEN` и `GITLAB_TOKEN` никогда не отправляются на собственный сервер, а
токен сервера уходит только на точно совпадающие схему, хост и порт и отбрасывается, если сервер перенаправляет на другой адрес.

Обычный `http` допускается, например, для локального фейкового API в тестах (`uri="http://127.0.0.1:8080/owner/repo"`), но токен
передаётся по нему только на `localhost`, `127.0.0.0/8` и `[::1]`.

## Сценарии использования

### Настройка среды разработки
Expand Down Expand Up @@ -684,6 +735,10 @@ GITLAB_TOKEN=your_token_here ./vendor/bin/dload get

Добавьте в переменные окружения CI/CD для автоматических загрузок.

`DLOAD_TOKEN_GITHUB_COM` и `DLOAD_TOKEN_GITLAB_COM` имеют приоритет над `GITHUB_TOKEN` и `GITLAB_TOKEN`,
что пригодится, если эти имена уже заняты другим инструментом. У собственных серверов свои переменные,
см. [Собственные серверы](#собственные-серверы).

## Конфигурация Gitlab CI

При создании релиза в Gitlab обязательно загрузите артефакты на страницу релиза через
Expand Down
Loading
Loading