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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Prefer standalone? Skip step 1. `SOURCE_MODE=auto` installs into the server's ow

SourceMod automatically requires Metamod. Framework upgrades preserve private configs, custom changes and disabled stock plugins. Exact version pins never silently become latest.

Server owners can manage third-party plugins from public GitHub/private GitLab releases or compile SourcePawn directly from individual repositories using `.source/plugins.json` and `egg plugins` panel console commands. Repository recipes track exact commits, use a pinned SourceMod compiler, and declare include dependencies. Preview and approve an exact package, then install it at the next normal restart. No node access or plugin CI pipeline is needed. [Per-server plugin configuration, source builds, updates and rollback](docs/reference/plugins.md).
Server owners can manage third-party plugins from public GitHub/private GitLab releases or compile SourcePawn directly from individual repositories using `.source/plugins.json` and `egg plugins` panel console commands. Set `"auto_approve": true` to install ready packages automatically at normal startup, or retain exact-package manual approval. Repository recipes use a pinned SourceMod compiler and declared include dependencies; branches/releases can track updates or be pinned to exact versions. No node access or plugin CI pipeline is needed. [Per-server plugin configuration, source builds, updates and rollback](docs/reference/plugins.md).

The fresh-install password policy offers **one join password per server**, using EFF words and monthly rotation after opt-in. The wizard also supports per-game/node sharing and cron schedules with a timezone. Existing nodes retain their saved per-game/token/hour policy. Password generation is opt-in at both node and server; RCON credentials remain separate.

Expand Down
1 change: 1 addition & 0 deletions docs/examples/plugins-source.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"version": 1,
"check_interval_hours": 6,
"auto_approve": true,
"plugins": [
{
"id": "dxlevel-restrict",
Expand Down
71 changes: 62 additions & 9 deletions docs/reference/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Server owners can manage third-party release packages and build SourcePawn plugins directly from repositories through the panel file manager and console. This works in standalone and node-managed servers; packages, credentials, toolchains, approvals and rollback files stay in the server's private volume. No node access is needed.

The manager checks at startup and every six hours by default. It downloads and previews available versions, then waits for approval of an exact package. Approved installs, updates, rollbacks and removals happen before the game launches on the next normal restart. It never hot reloads plugins or forces a restart. Failed release checks keep the installed files usable.
The manager checks at startup and every six hours by default. Manual manifests wait for approval of an exact package. Set `"auto_approve": true` to automatically queue successful downloads/builds for installation. Installs, updates, rollbacks and removals happen before the game launches during normal startup. Checks while the game runs only stage and queue packages; they never hot reload plugins or force a restart. Failed checks and builds keep installed files usable.

## Configuration

Expand Down Expand Up @@ -98,6 +98,58 @@ The third release asset is a loose `simple-chat.smx`, with no archive. Its `from

Mappings can place files below `addons`, `cfg`, `scripts`, `materials`, `models`, `sound`, `resource` and `maps`. A package can contain extensions, translations, gamedata and default configuration along with plugins. Missing sources, duplicate destinations, ambiguous assets, traversal, archive links, special files and oversized packages are rejected. Downloads are limited to 256 MiB, expanded archives to 512 MiB, individual files to 64 MiB and archive entries to 10,000. Ordinary ZIP archives are supported; ZIP64, multi-disk and self-extracting executable ZIP layouts are rejected. Release recipes do not compile source. No repository/install scripts run and runtime dependencies are not installed automatically.

## Automatic installation and pins

Add `"auto_approve": true` beside `version` in the existing manifest to cover
first installs and updates without per-version console approvals:

```json
{
"version": 1,
"check_interval_hours": 6,
"auto_approve": true,
"plugins": []
}
```

Keep your existing entries in `plugins`. Omitting `auto_approve` or setting it
to `false` retains manual approval. A plugin's own `"auto_approve": false` or
`true` overrides the manifest policy. `egg plugins list` shows the effective
`approval=auto` or `approval=manual` for each tracked entry.

The automatic flow is: check, download/build, verify the staged package, queue
it, and install before the game starts. Ready cached packages also qualify
after switching to automatic mode, including when the provider is offline.
Packages successfully prepared during startup can install on that launch.
Startup checks retain a shared 30-second budget; longer source builds retry
in the background and their completed packages wait for the next normal restart.
Only the newest successfully staged automatic snapshot is queued; a failed
newer check/build retains the previous valid package and installed files.

Version selection works independently of approval policy. For release assets,
use `pin` for an exact release tag. For source builds, use `source.ref` for a
branch, tag or full commit SHA. Pin every include dependency's `source.ref` to
a full commit too when reproducible source inputs are required. Changing a pin
selects a new version for the same automatic installation flow. Missing pins
never fall back to latest. Without exact pins, configured branches and release
channels continue tracking updates.

Automatic installs still block on unowned file collisions, framework ownership,
or locally edited managed code. They never imply `replace` or adoption. Fix the
conflict through the existing preview/keep/adopt/explicit-approval workflow.
Config, data, logs and other preserved paths retain their existing behavior.

Valid explicit pending installs, rollbacks and uninstalls take precedence for
that startup. A content recipe edit, including a changed pin, invalidates an
older approval and allows the newly selected automatic package to install.
Later automatic checks follow the configured source again: disable
automatic approval or pin the desired revision when holding a rollback, and
remove a recipe when uninstalling a tracked package permanently. Turning auto
off cancels automatic pending actions while retaining staging and explicit
approvals. `cancel` removes a queued action, but a later check can queue it again
while automatic mode remains enabled. Policy edits alone do not change package
IDs or invalidate explicit approvals.

## Build directly from a repository

Give each repository its own plugin entry. Adding `build` selects source mode:
Expand All @@ -118,7 +170,7 @@ places the resulting plugins in the active directory:
"url": "https://gitlab.edgegamers.io",
"repository": "source/plugins/counter-strike/dxlevel-restrict",
"credential": "edgegamers-gitlab",
"ref": "main"
"ref": "master"
},
"build": {
"sourcemod": "1.13.0.7478",
Expand Down Expand Up @@ -161,10 +213,11 @@ Source checks have a five-minute budget per repository and each compiler process
has a one-minute limit. Startup retains its overall 30-second check budget;
timed-out source builds retry in the background scheduler after the game starts.
An unchanged, intact available build is reused. Build errors retain installed
files and earlier staged packages. Approvals still bind exact bytes and recipes;
a later commit does not change an already approved pending install. Source
packages use the same preview, approval, normal-restart installation, local-edit
protection, rollback and removal commands as release packages.
files and earlier staged packages. Explicit approvals still bind exact bytes and
recipes; a later commit does not change an explicitly approved pending install.
Source packages use the same automatic/manual approval policy, normal-startup
installation, local-edit protection, rollback and removal commands as release
packages.

The manager executes only the compiler from the selected official toolchain,
with fixed arguments, a minimal environment, bounded diagnostics and named
Expand All @@ -189,7 +242,7 @@ The `source.credential` value refers to a key in this object. Use a project or p

Keep this file private in the panel; do not put tokens in console commands, repository URLs or the manifest. The manager does not put tokens in the game process environment or shared node cache. Installed game plugins run as the server user and can read server files, including this credentials file; install code you trust. GitHub acquisition supports public release assets.

## Check, review and approve
## Check, review and approve manually

Enter commands in the panel console, one complete line at a time:

Expand All @@ -202,13 +255,13 @@ egg plugins preview match-tools
egg plugins approve match-tools <snapshot-id>
```

Replace `<snapshot-id>` with the full 64-character SHA-256 package ID printed by `preview`. Review every mapped path and any collision or modification notices. Approval binds that exact staged content and recipe; it does not approve whatever upstream publishes later. `egg plugins update match-tools <snapshot-id>` is an alias for `approve`.
These approval commands are optional in automatic mode. Replace `<snapshot-id>` with the full 64-character SHA-256 package ID printed by `preview`. Review every mapped path and any collision or modification notices. An explicit approval binds that exact staged content and recipe; it does not approve whatever upstream publishes later. `egg plugins update match-tools <snapshot-id>` is an alias for `approve`.

To cancel a queued install, rollback or uninstall before restarting, run `egg plugins cancel match-tools`. Cancellation retains the staged package and existing game files.

Restart through the panel when ready. The startup notice reports completion, and update notices name available and installed versions. All `SourceEgg | Plugins |` messages remain visible even when the console filter or log level hides ordinary lines. The masked messages also go to local logs and configured node console delivery.

Changing a mapping or other recipe setting invalidates its earlier approval. Run `check`, inspect the new `preview`, and approve the new exact ID. When the managed path set changes, review the new preview before approving its exact package ID. Editing `.source/plugins.json` is supported while the game runs; checks and commands reload it. If malformed configuration prevents initialization, the game can still start: fix the file and issue a plugin command to retry. Restart to resume automatic checks. An unrecoverable interrupted file transaction prevents startup until it is repaired.
Changing a mapping or other content recipe setting invalidates its earlier approval. Run `check`; automatic mode validates and queues the new package, while manual mode waits for preview/approval of the new exact ID. Approval policy changes alone retain package identities. Editing `.source/plugins.json` is supported while the game runs; checks and commands reload it. If malformed configuration prevents initialization, the game can still start: fix the file and issue a plugin command to retry. Restart to resume scheduled checks. An unrecoverable interrupted file transaction prevents startup until it is repaired.

You can add a recipe through the console instead of editing the manifest. The JSON object must fit on one line:

Expand Down
52 changes: 52 additions & 0 deletions docs/superpowers/plans/2026-10-30-automatic-plugin-installs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Automatic Plugin Installs Implementation Plan

> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.

**Goal:** Install opted-in ready plugin versions on normal startup without routine package approvals.

**Architecture:** Add an inherited boolean approval policy and reuse installer preview/pending transactions. Queue cached/checked snapshots before one startup apply pass so ready builds install on that launch, while explicit pending actions retain priority.

**Tech Stack:** Go 1.27, existing plugin manager/installer, JSON manifests.

**Spec:** `docs/superpowers/specs/2026-10-30-automatic-plugin-installs-design.md`.

## Global Constraints

- Manifest `auto_approve` defaults to false; per-plugin optional boolean overrides it.
- Policy never changes recipe hashes or staged package identities.
- Preserve the 30-second startup check budget; install only with the game stopped.
- Automatic queueing always uses `replace=false` and existing ownership/edit checks.
- Explicit pending install/rollback/uninstall actions take precedence for that startup.
- Preserve failed-build fallback, configuration/data/logs, pins and recovery.

## Review Focus

- Already staged packages must install after enabling auto even with the provider offline.
- A manual rollback/uninstall must not be undone during the same startup.
- Turning automatic approval off must cancel persisted automatic work across recreation.
- Cached source builds and failed newer builds must retain correct automatic snapshots.
- A stale queued revision must not override a newly resolved already-installed revision.

### Task 1: Automatic approval policy and lifecycle

**Files:**
- Modify `internal/plugins/model.go`, `state.go`, `manager.go`, `commands.go`.
- Create `internal/plugins/automatic.go`, `automatic_test.go`.
- Modify `README.md`, `docs/reference/plugins.md`, `docs/examples/plugins-source.json`.
- Update ignored `dist/css-server-config/plugins*.json` and `SETUP.txt`.

**Interfaces:**
- Manifest `AutoApprove bool`; Plugin `AutoApprove *bool`; pendingAction `Automatic bool`, all JSON `auto_approve`/`automatic` with omission where appropriate.
- `(*Manager).autoApprove(Plugin) bool` resolves overrides.
- `(*Manager).queueAutomatic(Plugin, Snapshot)` previews and queues without replacing explicit actions.
- `(*Manager).applyPending() error` applies the existing action loop once after startup discovery.
- `recipeHash(Plugin)` excludes approval policy.

- [x] Add behavior regressions for all validation/review-focus cases; run and observe failures.
- [x] Add policy fields, hash exclusion, effective list output and automatic queue/cancellation logic.
- [x] Refactor startup discovery/apply ordering; keep explicit actions protected and remove installed matching availability.
- [x] Run focused regressions and the existing full plugin/egg lifecycle suite; resolve failures.
- [x] Document automatic mode, pins, conflicts, explicit action behavior and restart timing; opt this server into automatic tracking.
- [x] Run `go test -race ./...`, `go vet ./...`, `CGO_ENABLED=0 go build ./cmd/...`, formatting and manifest validation.
- [x] Commit the feature and docs; record the completion contract in the execution ledger.
- [x] Obtain a fresh whole-branch review, fix actionable findings with RED→GREEN tests, push and open a PR.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Automatic plugin installs

The server owner chose automatic tracking of configured branches and releases
and explicitly asked to proceed without further design questions. Eliminate
routine exact-package approvals for opted-in first installs and updates.

## Approach

Add manifest-level `auto_approve: true`. Omitted/false retains manual approval
for existing manifests. An optional per-plugin boolean overrides the manifest.
Release `pin` and source/dependency `ref` keep their existing selection semantics;
exact version pins and full commit refs work with either approval policy.
Approval policy does not affect recipe hashes or staged package identities.

The alternatives were manual approval of every package, automatic tracking,
and automatic installation with all source/include revisions frozen. The owner
chose tracking; pinned operation remains supported through existing selectors.

## Lifecycle

Checks validate/build in staging and queue eligible automatic snapshots using
the existing installer preview with `replace=false`. Checks while the game is
running never write game files. New successful snapshots supersede previous
automatic pending installs; failed checks/builds preserve installed files and
previous valid staging. A currently installed matching revision clears stale
automatic pending installs.

At startup, collect ready cached snapshots and check for updates within the
existing 30-second budget, then apply pending actions before launching the game.
Ready packages can install on that startup, including cached packages when the
provider is unavailable. Source builds exceeding the startup budget retry in
the background and wait for the next normal restart.

Valid explicit manual install/rollback/uninstall actions take precedence for
that startup. Automatic policy does not supersede them during discovery. A
content edit (including a changed pin) invalidates the older approval, allowing
the new automatic package to install on that startup. Future
automatic checks follow the configured source again; pin or disable automatic
approval when intentionally holding a rollback or uninstalling a tracked entry.
Disabling automatic approval cancels automatic pending actions, preserving
explicit approvals and staged packages. Cancel alone removes a queued action;
a later automatic check may queue it again.

## Boundaries

No forced restarts, hot installs, automatic replacement of local edits, automatic
adoption of unowned files, new pin commands, or changes to framework ownership.
File collisions and changed managed files block that automatic install with a
clear message. Config/data/log preservation and transaction recovery remain.
List output identifies the effective approval policy. Update reference docs,
examples and this server's generated manifests to opt into automatic tracking.

## Validation

Exercise first startup, offline existing staging, source builds and failures,
background queueing, per-plugin overrides, policy opt-out, explicit actions,
local edit conflicts, pinned release selection and unchanged package hashes.
Run the full race-test suite, vet, builds and a fresh whole-branch review.
Loading
Loading