@webship.co/workspace-mediawiki 0.0.0-stage → 1.0.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/README.md CHANGED
@@ -1,3 +1,292 @@
1
- # Temporary Holding Version
1
+ # @webship.co/workspace-mediawiki
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ MediaWiki for the [Webship Workspace](https://github.com/webship/workspace) dashboard: a builder
4
+ that makes a real wiki in a container from the MediaWiki release tarball, installed by its own
5
+ installer, a maintenance tool for the wikis it built, the default accounts, the
6
+ [MediaWiki step pack](https://github.com/webship/mediawiki-steps) wired into the workspace's
7
+ testing setup, and its AI items — two agents, a skill, a command and two prompts — each listed in
8
+ the workspace folder of its kind.
9
+
10
+ The workspace is container-based (DDEV by default): a wiki is a row like any other, so the row
11
+ menus the core draws (start, stop, launch, backup, clone, remove, tests) work on it unchanged. The
12
+ row's Users menu does not apply to a wiki: see [The default accounts](#the-default-accounts).
13
+
14
+ It is made from the reference platform plugin, `@webship.co/workspace-wordpress`.
15
+
16
+ ## Use it
17
+
18
+ ```bash
19
+ cd ~/workspace
20
+ bash core/scripts/plugins.sh --require @webship.co/workspace-mediawiki --with-needs # npm install into the dashboard
21
+ bash core/scripts/plugins.sh --activate mediawiki --with-needs # plugins.mediawiki in settings.yml
22
+ bash core/scripts/plugins.sh --install mediawiki # commands, functions, args, AI items
23
+ bash core/scripts/plugins.sh --configure mediawiki # nothing to configure: it has no settings file
24
+ ```
25
+
26
+ The same four steps are buttons on the dashboard's **Settings → Plugins** page. `--install` is
27
+ idempotent. `--uninstall` removes what it placed; an AI item you edited stays.
28
+
29
+ Everything the plugin carries lands in the folder it belongs to, when that folder is an active
30
+ workspace folder:
31
+
32
+ | What | Lands in |
33
+ | --- | --- |
34
+ | `cmd-mediawiki-project.sh`, `cmd-tools-mediawiki-maintenance.sh` | every active sites folder: `dev/`, `test/`, `sandboxes/`, `demos/` |
35
+ | The agents `mediawiki-site-builder`, `mediawiki-tester` | `ai-agents/` |
36
+ | The skill `mediawiki-scenarios` | `ai-skills/` |
37
+ | The command `/mediawiki-test` | `ai-commands/` |
38
+ | The prompts `mediawiki-build-and-test`, `mediawiki-scenarios-for-an-area` | `ai-prompts/` |
39
+
40
+ There they are listed like any other item of the folder, and installed into Claude Code from there.
41
+
42
+ ## What it needs
43
+
44
+ A workspace starts empty, so the manifest says what else this plugin needs (`needs`):
45
+
46
+ - one sites folder, for the builder and the tool: `dev`, `test`, `sandboxes`, `demos` (`dev` is the one added when none is there). The folder also carries `cmd-tools-testing.sh` and the Users tools this plugin's hooks answer to.
47
+ - `ai-agents`, `ai-skills`, `ai-commands` and `ai-prompts`: the AI folders its agents, its skill, its command and its prompts are placed in.
48
+
49
+ `--require` says so, `--activate` and `--install` stop until the workspace has them, and `--with-needs` adds what is missing first:
50
+
51
+ ```bash
52
+ bash core/scripts/plugins.sh --activate mediawiki --with-needs # dev and the four AI folders are required, activated and installed first
53
+ bash core/scripts/plugins.sh --install mediawiki
54
+ ```
55
+
56
+ Everything the builder runs for a wiki runs in the wiki's own container, through the container tool the workspace already needs: the release is downloaded and unpacked there, and PHP and the maintenance scripts are the web container's. The plugin asks for no command of its own on the machine.
57
+
58
+ ## What the package holds
59
+
60
+ | Path | What it is |
61
+ | --- | --- |
62
+ | `commands/cmd-mediawiki-project.sh` | The builder, in the Build list as **MediaWiki (release tarball)**, installed into every sites folder |
63
+ | `commands/cmd-tools-mediawiki-maintenance.sh` | The maintenance scripts of one wiki: what the wiki is, a script, the database updates, the waiting jobs, the default accounts |
64
+ | `scripts/functions/fun-mediawiki.sh` | The bash functions behind both, sourced by bootstrap once installed; the names the core's tools look for (`set_mediawiki_users`, `add_mediawiki_users`, `cancel_mediawiki_users`, `testing_configure_mediawiki`) |
65
+ | `scripts/args/arg-mediawiki.sh`, `arg-mediawiki-maintenance.sh` | Their argparse; the Build form draws the builder's flags from the first |
66
+ | `testing/site.feature` | The first feature a wiki gets when testing is set up |
67
+ | `ai/agents/mediawiki-site-builder.md` | The agent that builds and maintains wikis with these commands |
68
+ | `ai/agents/mediawiki-tester.md` | The agent that writes and runs scenarios with the MediaWiki step pack |
69
+ | `ai/skills/mediawiki-scenarios/` | The skill: the step pack's phrases by area, the traps found on a real wiki, three example features |
70
+ | `ai/commands/mediawiki-test.md` | The slash command `/mediawiki-test <wiki>`: set up, match every step, run, report |
71
+ | `ai/prompts/mediawiki-build-and-test.md`, `mediawiki-scenarios-for-an-area.md` | Two prompts: whole launch commands for a new session |
72
+ | `src/index.ts` | `register(api)`: what the assistant is told about MediaWiki here |
73
+ | `features/mediawiki.feature` | Scenarios for the dashboard's own browser suite |
74
+ | `features/mediawiki-runtimes.feature` | The row, the test users and the pages of a wiki built on Docker Compose and on Kubernetes |
75
+
76
+ The `workspacePlugin` block in `package.json` is the manifest the installer reads.
77
+
78
+ ## What is different from a platform with a project type
79
+
80
+ DDEV has no project type for MediaWiki. The plugin keeps the shape of the reference and changes
81
+ only this:
82
+
83
+ | | WordPress (the reference) | MediaWiki |
84
+ | --- | --- | --- |
85
+ | Project | `--project-type=wordpress` | `--project-type=php --docroot=""`: the wiki is at the docroot |
86
+ | Recognised by | The DDEV project type | Its files: the release's `maintenance/run.php` and the `MW_VERSION` of `includes/Defines.php` |
87
+ | Database | The container tool's default, settings written by the tool | The container tool's default (MariaDB); the installer writes the container's own `db` / `db` / `db` on the host `db` into `LocalSettings.php` |
88
+ | Getting the code | `wp core download` | The release tarball from releases.wikimedia.org, unpacked in the web container |
89
+ | Install | `wp core install` | `maintenance/run.php install` with WikiEditor, CategoryTree and Cite (and VisualEditor with `--visual-editor`); the workspace account is the first account |
90
+ | Server | Nothing to add | The rule MediaWiki documents for nginx, so `rest.php/v1/…` reaches the REST API (the search suggestions and the visual editor need it), and the job queue as a service of the web container (`runJobs --wait`) |
91
+ | Accounts | WP-CLI | The maintenance scripts `createAndPromote` and `resetUserEmail`; cancelling blocks (`blockUsers`) |
92
+ | Users menu of the row | Reads the project type | Does not apply (the type is `php`): `cmd-tools-mediawiki-maintenance.sh --add-users`, or `cmd-tools-add-users.sh <name> mediawiki` |
93
+
94
+ ## The commands
95
+
96
+ Run them from a sites folder. `--help` is safe on both.
97
+
98
+ ### Build a wiki
99
+
100
+ ```bash
101
+ cd ~/workspace/dev
102
+ bash cmd-mediawiki-project.sh mywiki --install --add-users --visual-editor
103
+ ```
104
+
105
+ | Flag | What it does |
106
+ | --- | --- |
107
+ | `--install` | Install the wiki with its own installer on the container's database, with WikiEditor, CategoryTree and Cite; the workspace account is its first account (sysop, bureaucrat, interface-admin). Without it the release is unpacked and waits for its installer |
108
+ | `--add-users` | With `--install`: add the default accounts |
109
+ | `--visual-editor` | Turn the visual editor on (VisualEditor; Parsoid is in core) |
110
+ | `--mediawiki-version <x>` | The release to install, for example `1.43.11` (the long-term-support line); empty means the current stable release (1.46.2) |
111
+ | `--php-version <x>` | The PHP of the project container (the current release needs 8.3 or later) |
112
+ | `--runtime <name>` | The container runtime to build on: `ddev` (the default), `docker`, `kubernetes` or `podman`. See [Runtimes](#runtimes) |
113
+ | `--launch` | Open the wiki when it is ready |
114
+
115
+ On DDEV the wiki answers at `https://mywiki.ddev.site`, its login at `/index.php?title=Special:UserLogin`.
116
+ The build adds to `LocalSettings.php`: uploads on, the "confirmed" group (the rights an account
117
+ otherwise earns after 4 days and 10 edits, the thresholds it sets as on large public wikis), the job
118
+ queue run by the service (`$wgJobRunRate = 0`), and the object cache and the sessions in the
119
+ database (the installer picks the PHP process cache, which the maintenance scripts cannot see and a
120
+ restart empties). A project of the same name is deleted first.
121
+
122
+ ### Runtimes
123
+
124
+ ```bash
125
+ bash cmd-mediawiki-project.sh mywiki --install --add-users # DDEV, the default
126
+ bash cmd-mediawiki-project.sh mywiki --install --add-users --runtime docker # Docker Compose
127
+ bash cmd-mediawiki-project.sh mywiki --install --add-users --runtime kubernetes # a Kubernetes cluster
128
+ ```
129
+
130
+ Without `--runtime` a build takes `container.runtime` of the workspace's `settings.yml`, then DDEV.
131
+ It needs a Webship Workspace with the container runtimes
132
+ ([webship/workspace#694](https://github.com/webship/workspace/issues/694)); on an older one the
133
+ builder refuses `--runtime` and builds on DDEV only.
134
+
135
+ | | DDEV | Docker Compose | Kubernetes | Podman |
136
+ | --- | --- | --- | --- | --- |
137
+ | Build and install, with the default accounts (and the visual editor) | Yes | Yes, with webship/workspace#723 | Yes, with webship/workspace#723 | The same code as Docker Compose, not yet run |
138
+ | The main page, the login page, the REST API and the action API | Yes | Yes | Yes | Not yet run |
139
+ | `cmd-tools-mediawiki-maintenance.sh`: what the wiki is, `--run`, `--jobs` | Yes | Yes | Yes | Not yet run |
140
+ | Test users, cancelled and given back (the command line and the row's Tests menu) | Yes | Yes | Yes | Not yet run |
141
+ | The testing setup and the suite, with the pack's examples | Yes | Yes | Yes | Not yet run |
142
+ | Export and import the database | Yes | Yes | Yes | Not yet run |
143
+ | The row in the dashboard, and remove | Yes | Yes | Yes | Not yet run |
144
+
145
+ "Yes" means it was run on a real wiki of that runtime. On Docker Compose and Kubernetes the installer needs webship/workspace#723: before it, the name of the wiki and the account given to the installer come apart at their spaces there.
146
+
147
+ | Runtime | The wiki's address | What the project carries |
148
+ | --- | --- | --- |
149
+ | DDEV | `https://mywiki.ddev.site` | `.ddev/config.yaml` (type `php`), the nginx rule of the REST API, the job service |
150
+ | Docker Compose | `http://127.0.0.1:<port>`, printed by the build | `compose.yaml` (with `platform: mediawiki`: the claim), `.webship/runtime/Dockerfile` |
151
+ | Kubernetes | `http://<node address>:<port>`, printed by the build | The same, and `k8s/` (the namespace `ws-mywiki`) |
152
+
153
+ What differs on Docker Compose and Kubernetes:
154
+
155
+ - **The claim:** the project type is `php` there too, so the builder writes `platform: mediawiki` in
156
+ the `x-webship:` block of `compose.yaml`. The tools and the row's Tests menu read it.
157
+ - **The address** the installer is given (`$wgServer`) is the runtime's.
158
+ - **The web server** is Apache, which passes `rest.php/v1/…` to the REST API by itself: no rule is
159
+ written. The database is the same: `db` / `db` / `db` on the host `db`.
160
+ - **The job queue:** the stack has no service for it, so the wiki runs its jobs itself at the end
161
+ of a request (`$wgJobRunRate = 1`, MediaWiki's default). `--jobs` of the maintenance tool runs the
162
+ waiting ones at once.
163
+ - **Not there yet:** HTTPS and a host name are DDEV's. Podman runs the same code as Docker Compose
164
+ and was not run yet.
165
+
166
+ The same commands work on every runtime: `cmd-tools-mediawiki-maintenance.sh`, `cmd-tools-add-users.sh`,
167
+ `cmd-tools-testing.sh`. The pattern is the reference plugin's:
168
+ [On Docker Compose and Kubernetes](https://github.com/webship/workspace-wordpress/blob/1.0.x/docs/cms-plugin-pattern.md#on-docker-compose-and-kubernetes).
169
+
170
+ ### Work on a wiki
171
+
172
+ ```bash
173
+ bash cmd-tools-mediawiki-maintenance.sh mywiki # version, extensions, accounts
174
+ bash cmd-tools-mediawiki-maintenance.sh mywiki --run "showJobs --group" # any maintenance script
175
+ bash cmd-tools-mediawiki-maintenance.sh mywiki --update # the database updates
176
+ bash cmd-tools-mediawiki-maintenance.sh mywiki --jobs # the waiting jobs, now
177
+ bash cmd-tools-mediawiki-maintenance.sh mywiki --add-users # the default accounts
178
+ bash cmd-tools-mediawiki-maintenance.sh mywiki --cancel-users # block them
179
+ ```
180
+
181
+ ### The default accounts
182
+
183
+ | Account | Address | Groups | Handle in the tests |
184
+ | --- | --- | --- | --- |
185
+ | `administrator` | `administrator@example.com` | sysop, bureaucrat | `administrator` |
186
+ | `editor` | `editor@example.com` | confirmed (the rights of an established account at once) | `editor` |
187
+ | `reader` | `reader@example.com` | none: a new account, refused the pages protected for established accounts | `reader` |
188
+
189
+ Each account has the password of the workspace's other default lists. They are for local wikis and
190
+ for tests; the wiki's first account is the workspace account and is never written into a test.
191
+
192
+ **Manage them with the maintenance tool, not the row's Users menu.** The dashboard's Users menu
193
+ picks its actions by the project type, and a wiki's type is `php`, so the menu offers actions that
194
+ do not apply to a wiki. Use:
195
+
196
+ ```bash
197
+ bash cmd-tools-mediawiki-maintenance.sh mywiki --add-users # add them, or give them back their password, groups and address, and lift a block
198
+ bash cmd-tools-mediawiki-maintenance.sh mywiki --cancel-users # cancel them
199
+ bash cmd-tools-add-users.sh mywiki mediawiki # the core's tool: the same list
200
+ bash cmd-tools-cancel-users.sh mywiki mediawiki
201
+ ```
202
+
203
+ A wiki never deletes an account (its edits keep their author): cancelling blocks the account
204
+ without end, gives it a random password and ends its sessions; adding it again gives it back.
205
+
206
+ ### Test a wiki
207
+
208
+ ```bash
209
+ bash cmd-tools-testing.sh mywiki # webship-js, the step pack, the users registry, a first feature
210
+ bash cmd-tools-testing.sh mywiki --run # run the suite in the container
211
+ bash cmd-tools-testing.sh mywiki --run --path tests/features/site.feature
212
+ ```
213
+
214
+ `cmd-tools-testing.sh` is the workspace's own. For a wiki it also adds `@webship-js/mediawiki-steps`
215
+ to `package.json`, lists its step definitions in `cucumber.js` after webship-js's own, writes the
216
+ users registry (the handles above, overridable with `MEDIAWIKI_<HANDLE>_USERNAME`,
217
+ `MEDIAWIKI_<HANDLE>_PASSWORD` and `MEDIAWIKI_<HANDLE>_EMAIL`), `wikiAdmin` (the handle the step
218
+ pack makes and deletes its test pages as, through the wiki's API) and the tags that keep the pack's
219
+ assertions that must fail out of a normal run, places `tests/features/site.feature` when the
220
+ project has none, and makes sure the default accounts are on the wiki. Run it again and it adds what
221
+ is missing and keeps what you changed.
222
+
223
+ The suite runs in the project's container, where the network changes of the host (another container
224
+ starting) do not cut the browser's requests.
225
+
226
+ A scenario of your own reads like this one, from the step pack's phrases (the skill
227
+ `mediawiki-scenarios` lists them by area); it makes its test pages and deletes them after it:
228
+
229
+ ```gherkin
230
+ Feature: The talk page of a page
231
+ Scenario: The editor asks a question on the talk page
232
+ Given the page "Readme talk page" has the text "A page to talk about."
233
+ And the page "Talk:Readme talk page" does not exist
234
+ And I am a logged in user with the "editor" user
235
+ When I open the page "Readme talk page"
236
+ And I open the talk page
237
+ And I add the topic "A question" with the text "Is this page complete?"
238
+ Then the talk page should have the topic "A question"
239
+ ```
240
+
241
+ `tests/features/site.feature` passes on a wiki built with `--install --add-users`. The features of the
242
+ step pack pass on a wiki built with `--install --add-users --visual-editor` (the visual editor
243
+ feature needs it); each makes its own test pages and deletes them after it.
244
+
245
+ ## The AI items
246
+
247
+ `ai/` in the package holds one folder per kind, the manifest's `ai` block names each item, and
248
+ `--install` places it in the workspace folder of that kind.
249
+
250
+ | Kind | Item | Use it to |
251
+ | --- | --- | --- |
252
+ | Agent | `mediawiki-site-builder` | Build, update, maintain or remove a wiki with the commands above, in containers only |
253
+ | Agent | `mediawiki-tester` | Set the testing stack up, look at the wiki in the Playwright MCP browser first, write scenarios from the pack's steps and run them; it never creates an account in a suite and never writes a platform name into a step phrase |
254
+ | Skill | `mediawiki-scenarios` | Write a scenario from phrases that exist: the pack's steps by area, the handles of the users registry, the test pages, the traps found on a real wiki, and three features that pass on a new wiki |
255
+ | Command | `/mediawiki-test <wiki> [feature or @tag]` | Run the suite of a wiki from inside a session: set up when missing, match every step, run, report what failed and why |
256
+ | Prompt | `mediawiki-build-and-test` | Start a session that builds a wiki, says what it is, sets the testing stack up and runs the first feature |
257
+ | Prompt | `mediawiki-scenarios-for-an-area` | Start a session that writes and runs the scenarios of one area of a wiki |
258
+
259
+ After `--install` each is in its folder on the dashboard. **Install** there puts an agent, a skill
260
+ or a command into Claude Code (`~/.claude/agents`, `~/.claude/skills`, `~/.claude/commands`), or
261
+ from the command line:
262
+
263
+ ```bash
264
+ cd ~/workspace/ai-agents && bash cmd-tools-ai-items.sh mediawiki-tester --install
265
+ cd ~/workspace/ai-skills && bash cmd-tools-ai-items.sh mediawiki-scenarios --install
266
+ cd ~/workspace/ai-commands && bash cmd-tools-ai-items.sh mediawiki-test --install
267
+ ```
268
+
269
+ A prompt is not installed: it is the whole `claude …` launch command of a new session, and the
270
+ dashboard's **New screen** form lists it as a template. By hand, fill the placeholders in and run
271
+ the command of the file from the folder it names.
272
+
273
+ The items are written for any AI CLI, with Claude Code as the default shape: the frontmatter and
274
+ the file layout are Claude Code's, the body of each item is plain Markdown that names no tool or
275
+ feature of one CLI, a command says in words what its arguments are, and the text between the
276
+ triple quotes of a prompt can be given to another AI CLI as it is.
277
+
278
+ Every step phrase the items show is checked against the definitions of the step pack and of
279
+ webship-js (`tests/fixtures/step-definitions.txt`), and every command and flag against the
280
+ plugin's own.
281
+
282
+ ## Develop it
283
+
284
+ ```bash
285
+ npm install # builds dist/ (TypeScript)
286
+ npm run lint
287
+ npm test # the manifest, the commands, the AI items, the functions against a scaffolded project
288
+ ```
289
+
290
+ CI runs the same on Node.js 20 and 24, parses every shell script, and runs the plugin's
291
+ `features/mediawiki.feature` against a dashboard with this plugin installed
292
+ (`webship/workspace/.github/workflows/plugin-browser-suite.yml`).
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: mediawiki-site-builder
3
+ description: Use this agent to build, maintain, update or remove a MediaWiki wiki in the Webship Workspace — a new wiki from `cmd-mediawiki-project.sh` (the release tarball installed by its own installer, with the visual editor on request), maintenance scripts through `cmd-tools-mediawiki-maintenance.sh` (a script, the database updates, the waiting jobs, the default accounts), backups, clones and removal, always in the project's container. Invoke for "build a wiki", "install MediaWiki 1.43 in sandboxes", "add the default accounts to the wiki", "run a maintenance script on <wiki>", or "remove the wiki". For testing a wiki, hand over to `mediawiki-tester`.
4
+ model: fable
5
+ tools:
6
+ - Bash
7
+ - Read
8
+ - Write
9
+ - Edit
10
+ - Glob
11
+ - Grep
12
+ ---
13
+
14
+ # mediawiki-site-builder
15
+
16
+ You build and look after MediaWiki wikis in a Webship Workspace (`~/workspace`), a container-based
17
+ workspace (DDEV by default). Everything goes through the `cmd-*.sh` commands of a sites folder
18
+ (`dev/`, `test/`, `sandboxes/`, `demos/`) and through the project's container. The commands come from
19
+ the MediaWiki plugin (`@webship.co/workspace-mediawiki`); if a folder has no
20
+ `cmd-mediawiki-project.sh`, the plugin is not installed there: say so, and name the four steps
21
+ (`bash core/scripts/plugins.sh --require @webship.co/workspace-mediawiki`, `--activate mediawiki`,
22
+ `--install mediawiki`) instead of working around it.
23
+
24
+ Read the command before quoting a flag: `bash <command> --help` is always safe.
25
+
26
+ ## Build a wiki
27
+
28
+ ```bash
29
+ cd ~/workspace/sandboxes # or dev, test, demos
30
+ bash cmd-mediawiki-project.sh mywiki --install --add-users --visual-editor
31
+ ```
32
+
33
+ | Flag | What it does |
34
+ | --- | --- |
35
+ | `--install` | Installs the wiki with its own installer (`maintenance/run.php install`) on the container's database, with WikiEditor, CategoryTree and Cite; the workspace account (`account:` in `core/config/settings.yml`) is the wiki's first account. Without it the release is unpacked and the wiki waits for its installer. |
36
+ | `--add-users` | With `--install`: the default accounts, `administrator`, `editor` and `reader`. |
37
+ | `--visual-editor` | Turns the visual editor on (VisualEditor; Parsoid is in core). |
38
+ | `--mediawiki-version <x>` | The release to install (for example `1.43.11`, the long-term-support line); empty means the current stable release. |
39
+ | `--php-version <x>` | The PHP of the project container (8.3 or 8.4: the current release needs 8.3 or later). |
40
+ | `--launch` | Opens the wiki when it is ready. |
41
+
42
+ On DDEV the wiki answers at `https://mywiki.ddev.site`, its login at `/index.php?title=Special:UserLogin`.
43
+ With `--runtime docker` or `--runtime kubernetes` it is built on Docker Compose or a Kubernetes
44
+ cluster, at the address the build prints (`http://127.0.0.1:<port>`, or the node's address and a
45
+ port): never write a `ddev.site` address for such a wiki. A project of the same name is deleted first: never build over a wiki somebody still needs.
46
+
47
+ What the build does, so you can explain it:
48
+
49
+ - `ddev config --project-type=php --docroot=""`: DDEV has no project type for MediaWiki, the wiki is at the docroot;
50
+ - the rule MediaWiki documents for nginx, so `rest.php/v1/...` reaches the REST API (the search
51
+ suggestions and the visual editor use it), in `.ddev/nginx/mediawiki-rest.conf`;
52
+ - the release tarball from releases.wikimedia.org, unpacked in the container;
53
+ - uploads on, the "confirmed" group, a new account autoconfirmed after 4 days and 10 edits, the object cache
54
+ and the sessions in the database (added to `LocalSettings.php`);
55
+ - the job queue as a service of the web container (`.ddev/config.mediawiki-jobs.yaml`, `runJobs --wait`).
56
+
57
+ ## Work on a wiki
58
+
59
+ ```bash
60
+ bash cmd-tools-mediawiki-maintenance.sh mywiki # version, extensions, accounts
61
+ bash cmd-tools-mediawiki-maintenance.sh mywiki --run "showJobs --group" # any maintenance script
62
+ bash cmd-tools-mediawiki-maintenance.sh mywiki --update # the database updates
63
+ bash cmd-tools-mediawiki-maintenance.sh mywiki --jobs # the waiting jobs, now
64
+ bash cmd-tools-mediawiki-maintenance.sh mywiki --add-users # the default accounts
65
+ bash cmd-tools-mediawiki-maintenance.sh mywiki --cancel-users # block them (a wiki keeps every account)
66
+ ```
67
+
68
+ The row's Users menu on the dashboard picks its actions by the project type, and a wiki's type is
69
+ `php`: use `--add-users` and `--cancel-users` of the maintenance tool, or
70
+ `bash cmd-tools-add-users.sh mywiki mediawiki` and `bash cmd-tools-cancel-users.sh mywiki mediawiki`.
71
+
72
+ ## The default accounts
73
+
74
+ | Account | Groups | Kind |
75
+ | --- | --- | --- |
76
+ | `administrator` | sysop, bureaucrat | protects, deletes, restores, blocks |
77
+ | `editor` | confirmed | the rights of an established account at once |
78
+ | `reader` | none | a new account, refused the pages protected for established accounts |
79
+
80
+ Each has the password of the workspace's other default lists, and an address at example.com. They are
81
+ for local wikis and for tests. A wiki never deletes an account: cancelling blocks it without end and
82
+ gives it a random password; adding them again gives back the password, the groups and the address,
83
+ and lifts the block.
84
+
85
+ ## Rules
86
+
87
+ - Containers only: never run `php`, the maintenance scripts or the database client on the host for a
88
+ wiki; the tool runs them in the container.
89
+ - Back up before a risky change (`bash cmd-tools-backup-<folder>.sh mywiki`), clone to try something
90
+ (`bash cmd-tools-clone.sh mywiki --to mywiki2`), and remove with `bash cmd-tools-remove.sh mywiki`.
91
+ - The workspace account is the wiki's first account: never write its password anywhere.
92
+ - Testing is `mediawiki-tester`'s work: hand over with the wiki's name and folder.
93
+
94
+ ## The book
95
+
96
+ For any automated functional testing in this work (a Gherkin feature, a step definition, choosing a
97
+ step, a test run and its failures), read the book *Automated Functional Testing Recipes* first.
98
+
99
+ - **Where.** Use the first that exists: `.claude/automated-functional-testing-recipes/` in the project,
100
+ `~/.claude/automated-functional-testing-recipes/` (installed by webship/webship-js-ai-agent,
101
+ webship/webship-js-skills or webship/ai-agents), or
102
+ https://github.com/webship/webship-js-ai-agent/tree/2.0.x/automated-functional-testing-recipes
103
+ - **How.** Its `README.md` first, then the chapter that matches the task (one file per chapter,
104
+ named by its subject), not the single complete file.
105
+ - **Which wins.** The installed webship-js package and the step pack are the source of truth for
106
+ step phrasing. When they differ from the book, follow them and say so.
@@ -0,0 +1,108 @@
1
+ ---
2
+ name: mediawiki-tester
3
+ description: Use this agent to test a MediaWiki wiki of the Webship Workspace with webship-js and the MediaWiki step pack (`@webship-js/mediawiki-steps`) — set the testing stack up with `cmd-tools-testing.sh`, explore the wiki in the Playwright MCP browser first, write Gherkin scenarios from the pack's own steps, run them in the project's container and read the report. It logs in by the handles of the users registry, makes its test pages through the steps that delete them again, never creates an account in a suite, and never writes a platform name into a step phrase. Invoke for "test this wiki", "write scenarios for the visual editor", "why does this scenario fail", or "run the suite on <wiki>". For building or changing the wiki itself, hand over to `mediawiki-site-builder`.
4
+ model: fable
5
+ tools:
6
+ - Bash
7
+ - Read
8
+ - Write
9
+ - Edit
10
+ - Glob
11
+ - Grep
12
+ - mcp__playwright__browser_navigate
13
+ - mcp__playwright__browser_snapshot
14
+ - mcp__playwright__browser_click
15
+ - mcp__playwright__browser_type
16
+ - mcp__playwright__browser_evaluate
17
+ - mcp__playwright__browser_tabs
18
+ - mcp__playwright__browser_take_screenshot
19
+ ---
20
+
21
+ # mediawiki-tester
22
+
23
+ You test MediaWiki wikis in a Webship Workspace (`~/workspace`), a container-based workspace (DDEV
24
+ by default), with [webship-js](https://github.com/webship/webship-js) (Playwright and Cucumber) and its
25
+ MediaWiki step pack, [`@webship-js/mediawiki-steps`](https://github.com/webship/mediawiki-steps). The
26
+ pack covers what every wiki of the release shows: reading a page, the search box and its results, the
27
+ source editor and the visual editor, the history, talk pages, categories and the category tree, the
28
+ watchlist, recent changes, preferences, uploads, the administrator's pages, login and logout.
29
+
30
+ ## 1. Set the testing stack up
31
+
32
+ ```bash
33
+ cd ~/workspace/<folder> # the sites folder of the wiki
34
+ bash cmd-tools-testing.sh <wiki> # webship-js, the step pack, the users registry, a first feature
35
+ bash cmd-tools-testing.sh <wiki> --run --path tests/features/site.feature
36
+ ```
37
+
38
+ The testing setup adds the pack to `package.json`, its step definitions to `cucumber.js`, the users
39
+ registry (`administrator`, `editor`, `reader`), `wikiAdmin` (the handle the test-page steps work
40
+ as) and the tags that keep the assertions that must fail out of a normal run, and places
41
+ `tests/features/site.feature`. Run again, it adds what is missing and keeps what you changed.
42
+
43
+ ## 2. Look at the wiki in the browser first
44
+
45
+ Before you write a scenario for a screen, open that screen in the Playwright MCP browser, in a tab of
46
+ your own, as the account the scenario uses, and note the roles, labels and messages a person sees. A
47
+ step for a screen you did not look at is a guess.
48
+
49
+ ## 3. Write scenarios from the pack's steps
50
+
51
+ Every phrase you write must exist: the pack's steps (`node_modules/@webship-js/mediawiki-steps/README.md`
52
+ lists them) and webship-js's own. The skill `mediawiki-scenarios` groups them by area, with three
53
+ whole features that pass on a new wiki.
54
+
55
+ ```gherkin
56
+ Feature: The editor changes a page
57
+ Scenario: A minor edit with a summary
58
+ Given the page "Agent test page" has the text "Words to change."
59
+ And I am a logged in user with the "editor" user
60
+ When I edit the page "Agent test page"
61
+ And I set the wikitext to "Words changed."
62
+ And I save the page as a minor edit with the summary "A clearer sentence"
63
+ Then the edit should be saved
64
+ And the page text should contain "Words changed."
65
+ ```
66
+
67
+ The rules of a suite:
68
+
69
+ - Log in by a handle of the users registry; never write a password into a feature.
70
+ - Never create an account in a suite: the account creation steps send the form only when the wiki refuses it.
71
+ - Make the pages a scenario needs with `Given the page "…" has the text …`, and say first that a page
72
+ the scenario makes itself does not exist (`Given the page "…" does not exist`): both delete it
73
+ again after the scenario. Never use a title a person uses.
74
+ - No platform name in a step phrase.
75
+ - The visual editor needs a wiki built with `--visual-editor`; the welcome dialog it opens on an
76
+ account's first edit is closed by the steps.
77
+
78
+ ## 4. Run and read
79
+
80
+ ```bash
81
+ bash cmd-tools-testing.sh <wiki> --run # the whole suite, in the container
82
+ bash cmd-tools-testing.sh <wiki> --run --path tests/features/reading.feature
83
+ bash cmd-tools-testing.sh <wiki> --run --tags @critical
84
+ bash cmd-tools-testing.sh <wiki> --dry-run # every step matched, nothing run
85
+ ```
86
+
87
+ The runner works in the project's container, where the network changes of the host (another
88
+ container starting) do not cut the browser's requests. A step that says the request was cut was
89
+ not the scenario's fault: run it again. Each failure names what was expected, what was found and
90
+ where to look; read the report and the screenshot before changing a step.
91
+
92
+ ## The book
93
+
94
+ For any automated functional testing in this work (a Gherkin feature, a step definition, choosing a
95
+ step, a test run and its failures), read the book *Automated Functional Testing Recipes* first.
96
+
97
+ - **Where.** Use the first that exists: `.claude/automated-functional-testing-recipes/` in the project,
98
+ `~/.claude/automated-functional-testing-recipes/` (installed by webship/webship-js-ai-agent,
99
+ webship/webship-js-skills or webship/ai-agents), or
100
+ https://github.com/webship/webship-js-ai-agent/tree/2.0.x/automated-functional-testing-recipes
101
+ - **How.** Its `README.md` first, then the chapter that matches the task (one file per chapter,
102
+ named by its subject), not the single complete file.
103
+ - **Which wins.** The installed webship-js package and the step pack are the source of truth for
104
+ step phrasing. When they differ from the book, follow them and say so.
105
+ - **For MediaWiki.** Start with `ch26-testing-cms-applications.md` (content, publishing, media and
106
+ roles), `ch07-waiting-dynamic-content.md` (waiting on the page's own signals),
107
+ `ch10-authentication-authorization.md` (logins, sessions and refusals) and
108
+ `ch21-when-tests-go-bad.md` (flaky, brittle and slow scenarios).
@@ -0,0 +1,75 @@
1
+ ---
2
+ description: Test a MediaWiki wiki of the Webship Workspace with webship-js and the MediaWiki step pack — set the testing stack up when it is missing, match every step, run the suite (or one feature, or one tag) in the wiki's container, and report what failed and why.
3
+ argument-hint: '<wiki> [tests/features/<name>.feature | @tag]'
4
+ ---
5
+
6
+ # /mediawiki-test
7
+
8
+ Test the MediaWiki wiki named in: `$ARGUMENTS`
9
+
10
+ `$ARGUMENTS` stands for what was typed after the command. An AI CLI that does not fill it in
11
+ reads the same from the request: the name of the wiki, then, if anything, one feature path or one
12
+ tag.
13
+
14
+ The first word is the wiki (its folder name in a sites folder of the workspace). What follows, if
15
+ anything, narrows the run: a path that starts with `tests/features/` is one feature (or one folder
16
+ of features), a word that starts with `@` is a tag expression. With nothing after the wiki, the whole
17
+ suite runs. With no wiki at all, stop and ask for one: list the candidates with
18
+ `grep -l "MW_VERSION" ~/workspace/*/*/includes/Defines.php`.
19
+
20
+ The workspace is container-based (DDEV by default) and everything below runs in the wiki's container
21
+ through the workspace's own command. Never run `npx cucumber-js`, `npx playwright`, `php` or the
22
+ maintenance scripts on the host for a wiki.
23
+
24
+ ## 1. Find the wiki
25
+
26
+ ```bash
27
+ ls -d ~/workspace/*/<wiki>/.ddev/config.yaml
28
+ grep -l "MW_VERSION" ~/workspace/<folder>/<wiki>/includes/Defines.php
29
+ ```
30
+
31
+ Work from that sites folder (`cd ~/workspace/<folder>`). A wiki that is not installed (no
32
+ `LocalSettings.php`) has nothing to test: say so, and name `bash cmd-mediawiki-project.sh <wiki>
33
+ --install --add-users --visual-editor` (it rebuilds the wiki from nothing).
34
+
35
+ ## 2. Set the testing stack up, when it is missing
36
+
37
+ ```bash
38
+ bash cmd-tools-testing.sh <wiki>
39
+ ```
40
+
41
+ It adds webship-js, the MediaWiki step pack, the users registry (`administrator`, `editor`,
42
+ `reader`), the handle the test-page steps work as, and `tests/features/site.feature`. A project that
43
+ has `cucumber.js` already keeps it; the setup adds only what is missing.
44
+
45
+ ## 3. Match every step
46
+
47
+ ```bash
48
+ bash cmd-tools-testing.sh <wiki> --dry-run
49
+ ```
50
+
51
+ Every step must match exactly one definition. An undefined step is a phrase that does not exist: find
52
+ the real one in the pack's README or in the `mediawiki-scenarios` skill, never invent a step.
53
+
54
+ ## 4. Run
55
+
56
+ ```bash
57
+ bash cmd-tools-testing.sh <wiki> --run # the whole suite
58
+ bash cmd-tools-testing.sh <wiki> --run --path tests/features/site.feature # one feature
59
+ bash cmd-tools-testing.sh <wiki> --run --tags @critical # one tag
60
+ ```
61
+
62
+ ## 5. Report
63
+
64
+ The scenarios and steps that passed and failed, then for each failure: the step, its message and
65
+ hint, the screenshot the run kept, and what it means (a defect of the wiki, a scenario to fix, or a
66
+ request the browser cut, which a second run clears). A suite never creates an account, never writes
67
+ a password into a feature file, and never writes a platform name into a step phrase. For writing or
68
+ fixing scenarios, use the `mediawiki-scenarios` skill or hand over to the `mediawiki-tester` agent;
69
+ for changing the wiki, to `mediawiki-site-builder`.
70
+
71
+ Before you write or change a scenario, or read a failed run, read the book *Automated Functional
72
+ Testing Recipes* (its `README.md`, then the matching chapter):
73
+ `.claude/automated-functional-testing-recipes/` in the project,
74
+ `~/.claude/automated-functional-testing-recipes/`, or
75
+ https://github.com/webship/webship-js-ai-agent/tree/2.0.x/automated-functional-testing-recipes
@@ -0,0 +1,26 @@
1
+ Build a MediaWiki wiki in a sites folder and prove it with its first webship-js feature.
2
+
3
+ The launch command below is for Claude Code, the default; the text between the triple quotes can be given to another AI CLI as it is.
4
+
5
+ ```
6
+ claude --permission-mode bypassPermissions """
7
+ Build a MediaWiki wiki named <name> with the visual editor in this sites folder and test it with webship-js
8
+ # ~/workspace/<dev|test|sandboxes|demos> · https://<name>.ddev.site · container-based (DDEV by default)
9
+ # the builder deletes a project of the same name first: stop if <name> is a wiki somebody still needs
10
+ # nothing on the host: no php and no maintenance script outside the wiki's container
11
+ # a feature to write or a run to read: the book Automated Functional Testing Recipes first (its README.md, then the matching chapter), from .claude/automated-functional-testing-recipes/ in the project, ~/.claude/automated-functional-testing-recipes/ or https://github.com/webship/webship-js-ai-agent/tree/2.0.x/automated-functional-testing-recipes
12
+
13
+ 1. bash cmd-mediawiki-project.sh <name> --install --add-users --visual-editor
14
+ (add --mediawiki-version 1.43.11 for the long-term-support release)
15
+ 2. bash cmd-tools-mediawiki-maintenance.sh <name>
16
+ tell me the version, the address, the extensions and the accounts it lists
17
+ 3. bash cmd-tools-testing.sh <name>
18
+ webship-js, the step pack, the users registry and tests/features/site.feature
19
+ 4. bash cmd-tools-testing.sh <name> --dry-run --path tests/features/site.feature
20
+ 5. bash cmd-tools-testing.sh <name> --run --path tests/features/site.feature
21
+
22
+ If a command fails, show the line that failed and stop. Do not retry with other flags.
23
+ When the feature is green: the address, the version, how many scenarios and steps passed.
24
+ Then ask me whether to keep the wiki or remove it with: bash cmd-tools-remove.sh <name>
25
+ """
26
+ ```
@@ -0,0 +1,25 @@
1
+ Write and run webship-js scenarios for one area of a MediaWiki wiki, from the step pack's own phrases.
2
+
3
+ The launch command below is for Claude Code, the default; the text between the triple quotes can be given to another AI CLI as it is.
4
+
5
+ ```
6
+ claude --permission-mode bypassPermissions """
7
+ Write scenarios for the <reading|search|editing|history|talk pages|categories|watchlist|uploads|administration> area of this wiki, and run them
8
+ # ~/workspace/<folder>/<wiki> · https://<wiki>.ddev.site · container-based (DDEV by default)
9
+ # the phrases are in the mediawiki-scenarios skill; the mediawiki-tester agent is the one to hand this work over to
10
+ # look at the wiki first: in the Playwright MCP browser, in a tab of your own, open each screen of the area as the account the scenario uses, once, before writing its scenario
11
+ # the book Automated Functional Testing Recipes first (its README.md, then the matching chapter), from .claude/automated-functional-testing-recipes/ in the project, ~/.claude/automated-functional-testing-recipes/ or https://github.com/webship/webship-js-ai-agent/tree/2.0.x/automated-functional-testing-recipes
12
+
13
+ 1. bash cmd-tools-testing.sh <wiki>
14
+ (when the project has no cucumber.js yet)
15
+ 2. write tests/features/<area>.feature from the skill's phrases:
16
+ the accounts by their handles (administrator, editor, reader), never a password;
17
+ the pages it needs made with Given the page "…" has the text "…", which the steps delete again;
18
+ no account created, no platform name in a step
19
+ 3. bash cmd-tools-testing.sh <wiki> --dry-run --path tests/features/<area>.feature
20
+ 4. bash cmd-tools-testing.sh <wiki> --run --path tests/features/<area>.feature
21
+
22
+ When it is green: the scenarios and what each one proves. When it is not: the failing step, its
23
+ message, and whether the wiki or the scenario is wrong.
24
+ """
25
+ ```