amxx-builder 1.5.2 → 1.6.1

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/AGENTS.md CHANGED
@@ -8,7 +8,7 @@ Entry: `index.js` (CLI via `commander`). Action: `action-entry.js` → synthesis
8
8
  - Node.js 18+, pure **CommonJS** (`require`), no ESM. Exception: `action-entry.js` uses `import * as core from '@actions/core'` because `@actions/core@3.x` is ESM-only — esbuild transpiles it to CJS in the bundle. Do not "fix" that import back to `require`, it fails to resolve.
9
9
  - **Node 18+ is a deliberate, genuinely minimal floor.** Write code that works on Node 18 — do not use newer-version-only APIs (stable `node:test` features, `fetch`, `AbortSignal.timeout`, …) unless they exist in 18. If a feature truly requires a newer Node, propose raising the minimum in the PR/discussion first; right now there is no practical benefit in raising it (no feature pressure, no dependency forcing it), and a raised floor would only cut off users stuck on 18. CI tests the matrix 18/24 (floor + newest) to keep this honest.
10
10
  - Only dev dep: `esbuild` for bundling the GitHub Action.
11
- - Tests: `node --test` (built-in node:test, zero deps; discovers `test/*.test.js` automatically — keep fixtures out of `test/`). No linter or type checker configured.
11
+ - Tests: `node --test` (built-in node:test, zero deps; discovers `test/*.test.js`). Keep fixtures out of `test/`, and do NOT name non-test scripts `*-test.js` — the runner's default glob (`**/*-test.js`) would execute them as tests. The bundler smoke script is `scripts/smoke.js` (needs a bundled `dist/` + compiler cache, so it is run explicitly, never by the test runner). No linter or type checker configured.
12
12
 
13
13
  ## Architecture: logic lives once in the core
14
14
  - All business logic MUST live in `src/` (the core) and be interface-agnostic: no `process.argv`, no `process.stdout` writes, no `commander`, no JSON-RPC/MCP schemas, no CLI rendering.
@@ -35,13 +35,18 @@ Entry: `index.js` (CLI via `commander`). Action: `action-entry.js` → synthesis
35
35
  | `amxb deploy --build` | Build then deploy |
36
36
  | `amxb watch` | Watch local files, incremental build+deploy |
37
37
  | `amxb init` | Scaffold manifest and optional files |
38
+ | `amxb init --force` | Scaffold, overwriting existing files (default: skip) |
38
39
  | `amxb init --script` | Also create `build.bat` / `build.sh` quick-build scripts |
39
40
  | `amxb clean` | Clean build/ and clone cache |
40
41
  | `amxb clean --all` | Also clean compiler cache |
41
42
  | `amxb cache info` | Show cache contents |
43
+ | `amxb skills-dir` | Print absolute path to the bundled `skills/` dir (used by the opencode bridge plugin) |
44
+ | `amxb opencode-skills` | Print container path(s) of materialized skills (bundled + current project + deps/repos) for the opencode bridge |
42
45
  | `amxb serve` | Start JSON-RPC server for editor integration (stdio transport) |
43
46
  | `npm start` | Alias for `node index.js` |
44
47
 
48
+ The opencode bridge plugin (`.opencode/plugin/amxb-skills.js`, generated by `amxb init --opencode`) registers skills from three sources: the builder's bundled `skills/` (`amxb skills-dir`), the current project's own `skills:`, and all `deps`/`repos` skills read from their manifests (`amxb opencode-skills`; missing ones fetched from the network on demand).
49
+
45
50
  ## Build order (matters)
46
51
  1. Parse manifest (deep-merge with `defaults/amxbuild.defaults.yml`)
47
52
  2. Fetch compiler (`amxxpc`, auto-resolves latest version)
@@ -65,7 +70,7 @@ Entry: `index.js` (CLI via `commander`). Action: `action-entry.js` → synthesis
65
70
  ```bash
66
71
  npm ci
67
72
  npm run bundle # esbuild action-entry.js → dist/index.js + scripts/gen-licenses.js → dist/licenses.txt
68
- node scripts/smoke-test.js # runs the bundled action with INPUT_* env, asserts GITHUB_OUTPUT name output
73
+ node scripts/smoke.js # runs the bundled action with INPUT_* env, asserts GITHUB_OUTPUT name output
69
74
  # Commit dist/, update package.json version, push tags, publish to npm (idempotent: re-runs are no-ops)
70
75
  ```
71
76
  This is automated in `.github/workflows/release.yml` on `v*.*.*` tags.
@@ -109,3 +114,8 @@ This is automated in `.github/workflows/release.yml` on `v*.*.*` tags.
109
114
  ## DEPS_LIST files
110
115
  Repos can contain a `DEPS_LIST` file (one dep per line, `owner/repo@ref[:include_path]`).
111
116
  Overridden by `deps_override` on that repo. Global `deps` in manifest win over everything.
117
+
118
+ ## AI skill: migration (`skills/`)
119
+ - `skills/amxb-migration/SKILL.md` is a standalone agent skill for migrating existing AMXX projects onto amxb. It ships in the npm package (`files` includes `skills/`) and is referenced by direct raw URL from the README.
120
+ - The skill MUST stay self-contained: it may reference only public docs/URLs and amxb CLI behavior, never local repo files (`templates/`, `defaults/`, `src/`, …) — it runs inside third-party projects before amxb is installed.
121
+ - It can bootstrap amxb itself (step 0: global install via npm/install scripts or `npx --yes amxx-builder@latest`). When changing the CLI surface (commands, flags, manifest fields), keep this file in sync.
package/README.md CHANGED
@@ -56,6 +56,10 @@ $env:AMXB_VERSION="v1.2.3"; irm https://raw.githubusercontent.com/AmxxModularEco
56
56
 
57
57
  Требования: **Node.js 18+**. git не требуется для установки и сборки — нужен только если манифест использует `github.ssh: true` (приватные репозитории по SSH-ключам).
58
58
 
59
+ **Visual Studio Code**
60
+
61
+ Расширение для VSCode - [AMXB — AMX Mod X Builder](https://marketplace.visualstudio.com/items?itemName=amxx-modular-ecosystem.amxb-vscode).
62
+
59
63
  ## Использование
60
64
 
61
65
  ```bash
@@ -76,10 +80,15 @@ amxb init --deploy # + создать .env с заготовк
76
80
  amxb init --plugin <name> # + создать amxmodx/scripting/<name>.sma
77
81
  amxb init --workflow # + создать .github/workflows/ci.yml
78
82
  amxb init --script # + создать build.bat / build.sh для быстрого запуска amxb build
83
+ amxb init --opencode # + создать .opencode/ (opencode.json с MCP-конфигом + мост скиллов)
84
+ amxb init --force # перезаписать существующие файлы (по умолчанию пропускаются)
85
+ amxb init --force --with-manifest # + перезаписать и существующий amxbuild.yml (без --with-manifest манифест не трогается)
79
86
 
80
87
  amxb clean # очистить build/ и кэш клонов
81
88
  amxb clean --all # + кэш компилятора
82
89
  amxb cache info # показать содержимое кэша
90
+
91
+ amxb opencode-skills # пути к материализованным скиллам (bundled + проект + deps/repos) для моста opencode
83
92
  ```
84
93
 
85
94
  Кэш хранится в `%LOCALAPPDATA%\amxx-builder` (Windows) или `~/.cache/amxx-builder` (Unix).
@@ -241,6 +250,8 @@ AMXB_DEPLOY_RCON_CMD=amxx load {plugin}
241
250
  deploy:
242
251
  path: /home/user/hlds/cstrike # корень сервера (где лежат addons/, models/)
243
252
  amxmodx_path: addons/amxmodx # default: addons/amxmodx
253
+ assets_path: "" # default: "" = корень deploy.path (assets/models, assets/sound → models/, sound/)
254
+ # Задайте, например, "{name}", чтобы зеркалировать layout архива
244
255
  watch_debounce_ms: 500 # мс стабильности файла перед ребилдом (default: 500)
245
256
  exclude: # пути от deploy.path, которые не перезаписываются
246
257
  - addons/amxmodx/configs/ # сохранить конфиги сервера
@@ -252,6 +263,13 @@ deploy:
252
263
  command: "amxx load {plugin}" # {plugin} = имя без .amxx; пусто = не слать
253
264
  ```
254
265
 
266
+ > **Деплой аддитивен.** `amxb deploy` только копирует файлы из `build/` в `deploy.path` и
267
+ > никогда не удаляет на сервере то, чего нет в источнике — на сервере могут жить и другие
268
+ > плагины/файлы, не управляемые этим манифестом. Удаление с сервера происходит только в
269
+ > watch-режиме для файлов, удалённых локально во время слежения. Если нужно «вычистить»
270
+ > осиротевшие файлы (например, после переименования плагина) — удалите их вручную или
271
+ > очистите каталог перед `amxb deploy`.
272
+
255
273
  `amxb watch` отслеживает изменения в `amxmodx/` и `assets/`:
256
274
 
257
275
  - `.sma` → пересобрать плагин, задеплоить `.amxx`, послать RCON
@@ -332,7 +350,7 @@ name: CI
332
350
 
333
351
  on:
334
352
  push:
335
- branches: [master, feature/**, fix/**]
353
+ branches: [master, main, feature/**, fix/**]
336
354
  paths-ignore:
337
355
  - "**.md"
338
356
  pull_request:
@@ -445,6 +463,34 @@ repos:
445
463
  ref: latest # автоматически берёт тег последнего GitHub release
446
464
  ```
447
465
 
466
+ ## deps: fungun.net
467
+
468
+ [fungun.net](https://fungun.net) — магазин закрытых AMXX-плагинов. Архивов и
469
+ GitHub-репозиториев у плагинов нет, но файлы `.inc` публично видны на странице
470
+ плагина без покупки. Указать такой инклюд как зависимость можно полной формой
471
+ записи `deps` через `source: fungun` — id плагина из ссылки магазина
472
+ (`.../?p=show&id=106` → `106`), либо сразу полную ссылку на страницу:
473
+
474
+ ```yaml
475
+ deps:
476
+ # id плагина из адреса страницы магазина
477
+ - source: fungun
478
+ id: 106
479
+
480
+ # или полная ссылка на страницу плагина
481
+ - source: fungun
482
+ url: https://fungun.net/shop/?p=show&id=106
483
+ ```
484
+
485
+ amxb открывает страницу, находит модалку с файлом `.inc` и кладёт его в
486
+ `build/_includes/`. Страница кэшируется в `<cache>/fungun/<id>/` на сутки: раз в
487
+ день кэш устаревает и перечитывается, чтобы подхватывать обновления `.inc` у
488
+ продавца (в отличие от git/release-кэшей, которые неизменяемы — у fungun нет
489
+ версии, которую можно запинить). `--no-fetch` использует кэш как есть, а если
490
+ очередное обновление страницы не удалось — сборка продолжается на прошлой
491
+ рабочей копии. Если на странице плагина нет `.inc` вовсе — сборка остановится
492
+ с понятной ошибкой.
493
+
448
494
  ## Полный пример
449
495
 
450
496
  Все доступные опции: [`example/amxbuild.yml`](example/amxbuild.yml).
@@ -467,8 +513,116 @@ MCP сервер предоставляет агенту opencode информа
467
513
  }
468
514
  ```
469
515
 
470
- **Все 11 инструментов** от просмотра `.inc` файлов до построения дерева зависимостей —
471
- описаны в [`docs/mcp/INDEX.md`](docs/mcp/INDEX.md) с таблицей и ссылками на полную документацию каждого инструмента.
516
+ Автоматически это настраивается командой `amxb init --opencode`: она создаёт
517
+ `.opencode/opencode.json` с этим MCP-конфигом и файл `.opencode/plugin/amxb-skills.js`,
518
+ тонкий мост, который при каждом старте opencode регистрирует скиллы из трёх источников:
519
+ собственные bundled-скиллы сборщика (`amxb skills-dir`), скиллы текущего проекта из его
520
+ `amxbuild.yml` (`skills:`) и скиллы всех `deps`/`repos`, прочитанные из их манифестов
521
+ (`amxb opencode-skills`; отсутствующие зависимости докачиваются из сети по требованию).
522
+ Абсолютных путей в `opencode.json` нет. Повторный запуск пропускает существующие файлы
523
+ (мержит конфиг), `--force` перезаписывает.
524
+
525
+ > Существующие файлы `.opencode/plugin/amxb-skills.js` автоматически не обновляются:
526
+ > чтобы получить версию с тремя источниками, пересоздайте плагин командой
527
+ > `amxb init --opencode --force` (или создайте файл заново).
528
+
529
+ **23 инструмента** — от просмотра `.inc` файлов до построения дерева зависимостей —
530
+ доступны через MCP. Каталог задокументированных инструментов (включая агент-доки и
531
+ скиллы) — в [`docs/mcp/INDEX.md`](docs/mcp/INDEX.md).
532
+
533
+ Агент-доки и скиллы теперь объявляются в самом манифесте: верхнеуровневые `docs:`
534
+ (справочная документация) и `skills:` (инструкции для агента). Они предназначены
535
+ **только агенту** — не попадают в `build/` и архив, и ничего не отдаётся по умолчанию,
536
+ пока автор не объявил запись явно. Пять инструментов обслуживают их: `get_dep_manifest`
537
+ возвращает сырой `amxbuild.yml` зависимости вместе со сводкой её `docs:`/`skills:`;
538
+ `list_agent_docs` / `get_agent_docs` и `list_agent_skills` / `get_agent_skills` читают
539
+ объявления как текущего проекта, так и зависимости (`dep`/`repo`). Содержимое,
540
+ полученное из зависимости, считается предоставленным её автором и непроверенным:
541
+ источник правды по API — `.inc` файлы. Подробнее — в
542
+ [`docs/mcp/INDEX.md`](docs/mcp/INDEX.md).
543
+
544
+ ```yaml
545
+ docs:
546
+ - file: docs/API.md # путь внутри репо
547
+ name: API # по умолчанию — имя файла без расширения
548
+ description: Публичный API плагина
549
+ skills:
550
+ - file: skills/config.md # одиночный скилл-файл
551
+ name: config
552
+ - dir: skills/deep-config # скилл-папка (SKILL.md + references)
553
+ name: deep-config
554
+ ```
555
+
556
+ ## Скилл миграции для ИИ-агентов
557
+
558
+ Для проектов, которые ещё не используют amxb, есть готовый скилл **amxb-migration**:
559
+ он переводит репозиторий AMXX-плагинов на `amxbuild.yml`, подключает `deps`,
560
+ настраивает `.gitignore` / CI / MCP и заменяет старые скрипты сборки.
561
+
562
+ В проекте, созданном через `amxb init --opencode`, скиллы amxb (включая
563
+ `amxb-migration`) подхватываются opencode автоматически: мост-плагин
564
+ `.opencode/plugin/amxb-skills.js` при каждом старте регистрирует не только
565
+ bundled-скиллы сборщика, но и скиллы текущего проекта и его `deps`/`repos`.
566
+
567
+ Канонический файл скилла (можно подключать по прямой ссылке до установки самого amxb —
568
+ шаг 0 скилла ставит amxb при необходимости):
569
+
570
+ - `skills/amxb-migration/SKILL.md` в этом репозитории
571
+ - Прямая ссылка: <https://raw.githubusercontent.com/AmxxModularEcosystem/amxx-builder/master/skills/amxb-migration/SKILL.md>
572
+
573
+ ### Использование без установки (по ссылке)
574
+
575
+ Установка нужна только для **авто-подхвата** скилла (агент сам находит его по
576
+ `description` в frontmatter) и для работы **без доступа в сеть**. Но скилл —
577
+ это просто самодостаточный markdown: агенту достаточно явно дать ссылку на
578
+ файл, и он сам прочитает инструкции и будет им следовать.
579
+
580
+ Пример промпта агенту (opencode, Claude Code и т.п.):
581
+
582
+ > Мигрируй проект на amxb. Прочитай и следуй: https://raw.githubusercontent.com/AmxxModularEcosystem/amxx-builder/master/skills/amxb-migration/SKILL.md
583
+
584
+ Условия работоспособности этого способа:
585
+
586
+ - у агента есть доступ в сеть (разрешён `webfetch` / `curl`); в песочнице
587
+ без сети остаётся только установка или вставка текста файла в промпт;
588
+ - давать **raw-ссылку** (`raw.githubusercontent.com`), а не страницу
589
+ репозитория — иначе агент получит HTML-обёртку GitHub;
590
+ - скилл надо явно упоминать в каждом запросе — авто-триггер по описанию
591
+ работает только у установленного скилла;
592
+ - файл должен быть запушен в `master` (пока правки не в репозитории,
593
+ ссылка вернёт 404).
594
+
595
+ Для разовой миграции достаточно ссылки. Для регулярного использования —
596
+ установите скилл один раз глобально, дальше он будет подхватываться сам.
597
+
598
+ ### Установка в сторонний проект
599
+
600
+ **opencode** (в проект):
601
+
602
+ ```bash
603
+ mkdir -p .opencode/skills/amxb-migration
604
+ curl -fsSL https://raw.githubusercontent.com/AmxxModularEcosystem/amxx-builder/master/skills/amxb-migration/SKILL.md \
605
+ -o .opencode/skills/amxb-migration/SKILL.md
606
+ ```
607
+
608
+ **opencode** (глобально, во все проекты):
609
+
610
+ ```bash
611
+ mkdir -p ~/.config/opencode/skills/amxb-migration
612
+ curl -fsSL https://raw.githubusercontent.com/AmxxModularEcosystem/amxx-builder/master/skills/amxb-migration/SKILL.md \
613
+ -o ~/.config/opencode/skills/amxb-migration/SKILL.md
614
+ ```
615
+
616
+ **Claude Code** (в проект или глобально):
617
+
618
+ ```bash
619
+ mkdir -p .claude/skills/amxb-migration # или ~/.claude/skills/amxb-migration
620
+ curl -fsSL https://raw.githubusercontent.com/AmxxModularEcosystem/amxx-builder/master/skills/amxb-migration/SKILL.md \
621
+ -o .claude/skills/amxb-migration/SKILL.md
622
+ ```
623
+
624
+ После установки перезапустите агента, чтобы скилл подхватился. Скилл сам подскажет
625
+ установку amxb, если тот ещё не установлен в окружении.
472
626
 
473
627
  ## Приоритеты
474
628
 
@@ -27,6 +27,9 @@ output:
27
27
 
28
28
  plugins: []
29
29
 
30
+ docs: []
31
+ skills: []
32
+
30
33
  assets:
31
34
  on_conflict: last_wins
32
35
  sources:
@@ -34,6 +37,10 @@ assets:
34
37
 
35
38
  deploy:
36
39
  amxmodx_path: addons/amxmodx
40
+ # Empty assets path = deploy root (server root), matching the schema default:
41
+ # local assets/ land where the game reads them, NOT under a {name}/ subfolder
42
+ # (output.assets_path '{name}' only shapes the distribution archive).
43
+ assets_path: ""
37
44
  watch_debounce_ms: 500
38
45
  exclude: []
39
46
  rcon: