amxx-builder 1.6.0 → 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 +6 -2
- package/README.md +57 -3
- package/defaults/amxbuild.defaults.yml +7 -0
- package/mcp/handlers.js +294 -145
- package/mcp/registry.js +196 -23
- package/package.json +1 -1
- package/skills/amxb-migration/SKILL.md +19 -5
- package/src/agent-assets.js +206 -0
- package/src/asset-fetcher.js +33 -48
- package/src/build-service.js +17 -8
- package/src/cli.js +36 -4
- package/src/collector.js +9 -1
- package/src/commands/init.js +56 -5
- package/src/commands/opencode-skills.js +47 -0
- package/src/commands/serve.js +302 -111
- package/src/commands/skills-dir.js +21 -0
- package/src/commands/watch.js +48 -19
- package/src/compile-utils.js +11 -2
- package/src/compiler-fetcher.js +196 -41
- package/src/compiler.js +26 -14
- package/src/dep-graph.js +27 -0
- package/src/deployer.js +39 -15
- package/src/deps-resolver.js +108 -6
- package/src/deps-tree.js +2 -1
- package/src/download.js +132 -0
- package/src/fs-utils.js +35 -1
- package/src/fungun-fetcher.js +28 -8
- package/src/include-tree.js +28 -61
- package/src/jsonrpc-transport.js +53 -5
- package/src/manifest-path.js +18 -1
- package/src/manifest.js +77 -19
- package/src/opencode-skills.js +262 -0
- package/src/release-fetcher.js +26 -33
- package/src/repo-fetcher.js +276 -33
- package/src/retry.js +3 -1
- package/src/dep-docs.js +0 -115
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`
|
|
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.
|
|
@@ -40,9 +40,13 @@ Entry: `index.js` (CLI via `commander`). Action: `action-entry.js` → synthesis
|
|
|
40
40
|
| `amxb clean` | Clean build/ and clone cache |
|
|
41
41
|
| `amxb clean --all` | Also clean compiler cache |
|
|
42
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 |
|
|
43
45
|
| `amxb serve` | Start JSON-RPC server for editor integration (stdio transport) |
|
|
44
46
|
| `npm start` | Alias for `node index.js` |
|
|
45
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
|
+
|
|
46
50
|
## Build order (matters)
|
|
47
51
|
1. Parse manifest (deep-merge with `defaults/amxbuild.defaults.yml`)
|
|
48
52
|
2. Fetch compiler (`amxxpc`, auto-resolves latest version)
|
|
@@ -66,7 +70,7 @@ Entry: `index.js` (CLI via `commander`). Action: `action-entry.js` → synthesis
|
|
|
66
70
|
```bash
|
|
67
71
|
npm ci
|
|
68
72
|
npm run bundle # esbuild action-entry.js → dist/index.js + scripts/gen-licenses.js → dist/licenses.txt
|
|
69
|
-
node scripts/smoke
|
|
73
|
+
node scripts/smoke.js # runs the bundled action with INPUT_* env, asserts GITHUB_OUTPUT name output
|
|
70
74
|
# Commit dist/, update package.json version, push tags, publish to npm (idempotent: re-runs are no-ops)
|
|
71
75
|
```
|
|
72
76
|
This is automated in `.github/workflows/release.yml` on `v*.*.*` tags.
|
package/README.md
CHANGED
|
@@ -80,11 +80,15 @@ amxb init --deploy # + создать .env с заготовк
|
|
|
80
80
|
amxb init --plugin <name> # + создать amxmodx/scripting/<name>.sma
|
|
81
81
|
amxb init --workflow # + создать .github/workflows/ci.yml
|
|
82
82
|
amxb init --script # + создать build.bat / build.sh для быстрого запуска amxb build
|
|
83
|
+
amxb init --opencode # + создать .opencode/ (opencode.json с MCP-конфигом + мост скиллов)
|
|
83
84
|
amxb init --force # перезаписать существующие файлы (по умолчанию пропускаются)
|
|
85
|
+
amxb init --force --with-manifest # + перезаписать и существующий amxbuild.yml (без --with-manifest манифест не трогается)
|
|
84
86
|
|
|
85
87
|
amxb clean # очистить build/ и кэш клонов
|
|
86
88
|
amxb clean --all # + кэш компилятора
|
|
87
89
|
amxb cache info # показать содержимое кэша
|
|
90
|
+
|
|
91
|
+
amxb opencode-skills # пути к материализованным скиллам (bundled + проект + deps/repos) для моста opencode
|
|
88
92
|
```
|
|
89
93
|
|
|
90
94
|
Кэш хранится в `%LOCALAPPDATA%\amxx-builder` (Windows) или `~/.cache/amxx-builder` (Unix).
|
|
@@ -246,6 +250,8 @@ AMXB_DEPLOY_RCON_CMD=amxx load {plugin}
|
|
|
246
250
|
deploy:
|
|
247
251
|
path: /home/user/hlds/cstrike # корень сервера (где лежат addons/, models/)
|
|
248
252
|
amxmodx_path: addons/amxmodx # default: addons/amxmodx
|
|
253
|
+
assets_path: "" # default: "" = корень deploy.path (assets/models, assets/sound → models/, sound/)
|
|
254
|
+
# Задайте, например, "{name}", чтобы зеркалировать layout архива
|
|
249
255
|
watch_debounce_ms: 500 # мс стабильности файла перед ребилдом (default: 500)
|
|
250
256
|
exclude: # пути от deploy.path, которые не перезаписываются
|
|
251
257
|
- addons/amxmodx/configs/ # сохранить конфиги сервера
|
|
@@ -257,6 +263,13 @@ deploy:
|
|
|
257
263
|
command: "amxx load {plugin}" # {plugin} = имя без .amxx; пусто = не слать
|
|
258
264
|
```
|
|
259
265
|
|
|
266
|
+
> **Деплой аддитивен.** `amxb deploy` только копирует файлы из `build/` в `deploy.path` и
|
|
267
|
+
> никогда не удаляет на сервере то, чего нет в источнике — на сервере могут жить и другие
|
|
268
|
+
> плагины/файлы, не управляемые этим манифестом. Удаление с сервера происходит только в
|
|
269
|
+
> watch-режиме для файлов, удалённых локально во время слежения. Если нужно «вычистить»
|
|
270
|
+
> осиротевшие файлы (например, после переименования плагина) — удалите их вручную или
|
|
271
|
+
> очистите каталог перед `amxb deploy`.
|
|
272
|
+
|
|
260
273
|
`amxb watch` отслеживает изменения в `amxmodx/` и `assets/`:
|
|
261
274
|
|
|
262
275
|
- `.sma` → пересобрать плагин, задеплоить `.amxx`, послать RCON
|
|
@@ -500,9 +513,45 @@ MCP сервер предоставляет агенту opencode информа
|
|
|
500
513
|
}
|
|
501
514
|
```
|
|
502
515
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
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
|
+
```
|
|
506
555
|
|
|
507
556
|
## Скилл миграции для ИИ-агентов
|
|
508
557
|
|
|
@@ -510,6 +559,11 @@ MCP сервер предоставляет агенту opencode информа
|
|
|
510
559
|
он переводит репозиторий AMXX-плагинов на `amxbuild.yml`, подключает `deps`,
|
|
511
560
|
настраивает `.gitignore` / CI / MCP и заменяет старые скрипты сборки.
|
|
512
561
|
|
|
562
|
+
В проекте, созданном через `amxb init --opencode`, скиллы amxb (включая
|
|
563
|
+
`amxb-migration`) подхватываются opencode автоматически: мост-плагин
|
|
564
|
+
`.opencode/plugin/amxb-skills.js` при каждом старте регистрирует не только
|
|
565
|
+
bundled-скиллы сборщика, но и скиллы текущего проекта и его `deps`/`repos`.
|
|
566
|
+
|
|
513
567
|
Канонический файл скилла (можно подключать по прямой ссылке до установки самого amxb —
|
|
514
568
|
шаг 0 скилла ставит amxb при необходимости):
|
|
515
569
|
|
|
@@ -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:
|