Commit Graph
47 Commits
Author SHA1 Message Date
Cooldude2606 82abc2c332 7.0.4 2026-10-17 16:54:48 +01:00
Cooldude2606 f3553dd570 Fix publish issue in some plugins 2026-10-17 00:05:24 +01:00
Cooldude2606 9d19f4eaea 7.0.2 2026-10-16 14:13:17 +01:00
BastiaanandClaude Opus 5.5 8d7d5ff10f Add a readme to every plugin and list them in the main readme (#505)
Commands, Permission Groups, Player Statistics, Reports, Roles, Scenario,
Server UPS and Module Utilities get a readme covering their config,
permissions, commands, web pages and Lua and Node API.

The existing readmes are brought up to date: Auto Restart now that
clusterio marks a restart after a plugin install, Discord Auth gets the
code timeout, command aliases and its Lua API, and the GUI guide says what
the plugin is and has its toolbar examples and an iterator name fixed.

The main readme gets a Plugins section listing each plugin by name and
package with a one line description.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 23:12:48 +01:00
BastiaanandClaude Opus 5.5 8e7ac3c872 Pick a long bracket the json does not close in rcon commands (#506)
exp_reports, exp_roles and exp_groups wrapped the json they send to Lua in
a fixed [=[ ]=] long bracket. A report reason, role name or group name
containing ]=] closed it early and the rest ran as Lua through /sc. Any
player can make a report, so any player could run code on the server.

Use the next level the json does not contain, like the other plugins do.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 17:07:47 +01:00
Bastiaan e25049397e Merge pull request #496 from bbassie/chore/optional-peer-deps
Mark controller and host as optional peer dependencies
2026-10-14 22:49:25 +01:00
BastiaanandClaude Opus 5.5 68a964cf57 Write plugins without state shared elsewhere as functions (#492)
The instance plugins of exp_groups, exp_reports, exp_roles, exp_scenario
and exp_server_ups, and the controller plugins of exp_reports and
exp_scenario, were classes only to hold their handlers. They are now
init functions with closures, like clusterio's own plugins.

The exp_roles and exp_groups controller plugins stay classes because
exp_scenario reaches their datastores through get(controller).
AutoRestart stays a class because its tests step check() with a fake
clock.

Tests spy on handle() and the hooks to call the handlers. The reports
webhook tests stub fetch instead of replacing postWebhook, and the
feature reconcile test writes the stored records to disk before start.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 21:50:15 +01:00
Cooldude2606 26a801da5e Bump node requirement 2026-10-13 21:06:46 +01:00
Cooldude2606 cdf0cd2e04 Add npmignore to enable packing 2026-10-13 21:01:48 +01:00
BastiaanandClaude Opus 5.5 ea9bf1fb78 Construct plugins with a static fromContext (#487)
Each plugin class now has a private constructor and a static async
fromContext(context) that loads its datastores, constructs the instance
and attaches its handlers and hooks. This replaces the public constructor
followed by init(), and AutoRestart's start().

Datastores are loaded before construction and passed to the constructor,
so the definite assignment assertions on them are gone. Tests build the
plugins through fromContext and pass a wrapped logger in the context
instead of overwriting plugin.logger before init().

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 01:19:53 +01:00
bbassieandClaude Opus 5.5 0ff07c012c Export init functions instead of plugin classes
clusterio logs "using deprecated class export" for every node entrypoint
that exports a Base*Plugin subclass, and the web UI logs "using deprecated
class hooks" for WebPlugin classes. Every entrypoint now has a default
export function, like exp_auto_restart and the exp_roles web plugin.

The classes stay where they hold state, but no longer extend the base
classes. The constructor takes the load context and init() attaches the
hooks the base class used to attach from the on* methods, so the tests can
still call those methods directly. exp_server_ups sends its RCON command
through instance.sendRcon with the plugin name, which is what the removed
BaseInstancePlugin.sendRcon did.

The instance entrypoints of exp_commands, exp_gui, exp_legacy, exp_util
and exp_scenario were empty classes, kept only so the host loads the
plugin and patches its module into the save. An empty function does the
same.

The exp_groups web components read the subscriptions through exported
useGroups, useAssignments and useRoleMappings hooks instead of looking
the plugin up in control.plugins, which only holds class plugins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 00:10:51 +00:00
Bastiaan 53e07aa761 Merge pull request #481 from bbassie/fix/upstream-plugin-changes
Restore seeding without controller.plugins
2026-09-26 22:48:17 +01:00
bbassieandClaude Fable 5.1 7fd66c6ac7 Migrate to ES modules
Clusterio #984 converted its packages to ESM, so a CommonJS plugin can
no longer import @clusterio/lib and plugin entrypoints must name the
full file. Every package gets "type": "module", entrypoints and relative
imports carry the .js extension, and the webpack configs become .cjs as
webpack-cli loads them with require. tsconfig.node.json moves from
node16 to nodenext to match clusterio, which needs it for the JSON
import attributes in its sources.

The tap tests and the shared test helpers use import and
import.meta.dirname. The test scripts pass --type-strip-only so tap
leaves lib's .ts subpath imports to Node's own type stripping, as its
TypeScript loader compiled them without a default export. The lua
runner resolves fengari from the test file it is given, since a bare
import from the shared test directory does not reach the plugin's
devDependencies.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-12 01:10:02 +01:00
bbassieandClaude Fable 5.1 30f1b5ea75 Declare permissions on the plugin declaration
Clusterio #988 added a permissions array to PluginDeclaration and a
type level Permissions registry, and made checkPermission and the web
UI hasPermission helpers take PermissionName. Move the definePermission
calls of exp_groups and exp_scenario into the declaration and add the
names to the registry so the web pages type check. The browser
tsconfigs include index.ts so the augmentation is visible to the web
bundle, matching the in-repo plugins.

The exp_scenario table keeps its tuple form and derives the name union
from it, so a new row is still one line. Seed role permissions are typed
as PermissionName, so a typo in seed.ts is now a compile error rather
than a warning at seed time. The tests register the declared
permissions through registerPluginPermissions instead of importing
permissions.ts for its side effect.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-11 23:27:17 +00:00
bbassieandClaude Fable 5.1 51786c5df9 Export messages and controller types from exp_roles and exp_groups
exp_scenario reached into @expcluster/roles/dist/node/* for the message
classes and the controller plugin type. The package index now re-exports
messages and the ControllerPlugin type, so consumers import from the
package name like they do with @clusterio/lib. The controller export is
type only, which keeps node code out of the web bundle. The test still
requires the controller classes from dist since they cannot be
re-exported at runtime.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-09 17:31:31 +00:00
BastiaanandClaude Fable 5.1 24efb82d0f Encode group permissions as a 1-based array (#472)
encode_group_permissions filled the whitelist and blacklist starting at
index 0. Factorio's table_to_json only serialises a table as a JSON array
when its keys run 1..n, so the permissions reached the instance plugin as
an object and every GroupUpdateRequest failed schema validation.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-09 15:47:01 +01:00
Cooldude2606 810269971b fix: bump to 7.0.1 2026-09-05 17:14:37 +01:00
phidias 72cd203c25 Update GroupViewPage.tsx 2026-09-05 00:57:13 +09:00
bbassieandClaude Opus 5 0bb92966eb Fix type annotations the linter found to be wrong
Async ids come from `get_function_name`, which returns a string, but
were documented as numbers.

`setmetatable` in clusterio's compat module loses `LibCompat` on the
module return, so the require is cast.

`GuiData.__index` accepts a `DataKey` but emmylua needs that as an
index signature on the class.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:18 +00:00
bbassieandClaude Opus 5 c233a9ab06 Defer need-check-nil and clean up stale suppressions
emmylua deserialises an unknown diagnostic code to a catch all that
matches no checker, so every `invisible`, `nil-check` and
`global-element` suppression was silently doing nothing. Renamed to the
emmylua codes. `name-style-check` has no equivalent and is dropped, it
was already disabled under luals.

The `get_tile` suppressions referenced an api typedef bug from 2024
which no longer reproduces.

need-check-nil is deferred rather than disabled on merit: a third of the
407 findings come from MapPosition and BoundingBox being aliased as
`struct|[double, double]`, so every `entity.position.x` reads as
possibly nil. The rest need per site knowledge of runtime invariants.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:18 +00:00
Cooldude2606 a07be7b7ed Bump version in package jsons 2026-07-14 00:50:00 +01:00
Cooldude2606 9019be307c Update to new version of SubscriptionRequest 2026-06-26 14:51:43 +01:00
Cooldude2606 f4766cd20e Fix redirect after group creation 2026-06-26 14:21:28 +01:00
Cooldude2606 9755ec8e3a Use /sc rather than /c 2026-06-26 14:20:32 +01:00
Cooldude2606 6b99378fa2 Fix use of MapSubscriber 2026-06-26 14:20:10 +01:00
Cooldude2606 7318fc3602 Fix lint for global usage 2026-05-27 00:29:12 +01:00
Cooldude2606 bb788f33da Final Cleanup 2026-05-25 20:43:51 +01:00
Cooldude2606 2248f23a8d Added web UI 2026-05-23 03:51:16 +01:00
Cooldude2606 a521cdd901 Change to dev env to fix building 2026-05-22 20:15:36 +01:00
Cooldude2606 230c835103 Add controller plugin 2026-05-21 00:30:17 +01:00
Cooldude2606 dca5086ce3 Add instance plugin 2026-05-20 22:39:44 +01:00
Cooldude2606 7ddfa8e735 Add messages and permissions 2026-05-20 22:39:33 +01:00
Cooldude2606 90d63952d3 Add lua module code 2026-05-20 01:51:09 +01:00
Cooldude2606 b64e109bf1 Plugin Setup exp_groups 2026-05-20 01:48:26 +01:00
Cooldude2606 538714acdb Remove existing plugin 2026-05-19 22:23:47 +01:00
Cooldude2606 9be43e9896 Bump dependencies 2026-01-14 20:15:23 +00:00
Cooldude2606 ce80ae9021 Refactored UPS monitor as clusterio plugin (#398)
* Refactor server ups

* Use catalogs

* Move to own plugin

* Use web config

* Remove External.get_server_ups

* Update workspace version requirement

* Remove need for storage

* Add locale

* Fix CI
2025-08-08 16:36:22 +01:00
phidias ed01de3feb Fix Dependencies Version (#396)
* Update package.json

* Update package.json

* Update package.json

* Update package.json

* Update package.json

* Update package.json
2025-08-04 20:58:23 +01:00
Cooldude2606 aedc3cff6b Fix lint errors on new luals version (#384) 2025-04-06 17:05:40 +01:00
Cooldude2606 3dbdb2071f Update deps 2025-04-06 16:03:58 +01:00
Cooldude2606 d489615542 Add missing type def dep for exp_groups 2024-12-27 20:43:29 +00:00
Cooldude2606 974b28c3b0 Prepare repo for publish 2024-12-24 20:50:48 +00:00
Cooldude2606 99ab54da0a Enable stricter type checks 2024-11-21 00:03:19 +00:00
Cooldude2606 48f55b0547 Resolve all Luals warnings 2024-11-19 22:37:15 +00:00
Cooldude2606 377fb69152 Migration for new helpers library 2024-11-19 22:34:39 +00:00
Cooldude2606 292c1a1b68 Update all code styles 2024-11-19 22:29:35 +00:00
Cooldude2606 446e87b610 Add Clusterio Plugins 2024-11-19 21:51:13 +00:00