@webship.co/workspace-mediawiki 0.0.0-stage → 1.0.0
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 +241 -2
- package/ai/agents/mediawiki-site-builder.md +104 -0
- package/ai/agents/mediawiki-tester.md +108 -0
- package/ai/commands/mediawiki-test.md +75 -0
- package/ai/prompts/mediawiki-build-and-test.md +26 -0
- package/ai/prompts/mediawiki-scenarios-for-an-area.md +25 -0
- package/ai/skills/mediawiki-scenarios/SKILL.md +85 -0
- package/ai/skills/mediawiki-scenarios/examples/administration.feature +16 -0
- package/ai/skills/mediawiki-scenarios/examples/editing.feature +25 -0
- package/ai/skills/mediawiki-scenarios/examples/reading-and-search.feature +41 -0
- package/commands/cmd-mediawiki-project.sh +32 -0
- package/commands/cmd-tools-mediawiki-maintenance.sh +26 -0
- package/dist/src/index.d.ts +29 -0
- package/dist/src/index.js +53 -0
- package/dist/src/index.js.map +1 -0
- package/features/mediawiki.feature +36 -0
- package/package.json +95 -4
- package/scripts/args/arg-mediawiki-maintenance.sh +25 -0
- package/scripts/args/arg-mediawiki.sh +29 -0
- package/scripts/functions/fun-mediawiki.sh +437 -0
- package/testing/site.feature +48 -0
package/README.md
CHANGED
|
@@ -1,3 +1,242 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @webship.co/workspace-mediawiki
|
|
2
2
|
|
|
3
|
-
|
|
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
|
+
|
|
75
|
+
The `workspacePlugin` block in `package.json` is the manifest the installer reads.
|
|
76
|
+
|
|
77
|
+
## What is different from a platform with a project type
|
|
78
|
+
|
|
79
|
+
DDEV has no project type for MediaWiki. The plugin keeps the shape of the reference and changes
|
|
80
|
+
only this:
|
|
81
|
+
|
|
82
|
+
| | WordPress (the reference) | MediaWiki |
|
|
83
|
+
| --- | --- | --- |
|
|
84
|
+
| Project | `--project-type=wordpress` | `--project-type=php --docroot=""`: the wiki is at the docroot |
|
|
85
|
+
| Recognised by | The DDEV project type | Its files: the release's `maintenance/run.php` and the `MW_VERSION` of `includes/Defines.php` |
|
|
86
|
+
| 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` |
|
|
87
|
+
| Getting the code | `wp core download` | The release tarball from releases.wikimedia.org, unpacked in the web container |
|
|
88
|
+
| 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 |
|
|
89
|
+
| 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`) |
|
|
90
|
+
| Accounts | WP-CLI | The maintenance scripts `createAndPromote` and `resetUserEmail`; cancelling blocks (`blockUsers`) |
|
|
91
|
+
| 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` |
|
|
92
|
+
|
|
93
|
+
## The commands
|
|
94
|
+
|
|
95
|
+
Run them from a sites folder. `--help` is safe on both.
|
|
96
|
+
|
|
97
|
+
### Build a wiki
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
cd ~/workspace/dev
|
|
101
|
+
bash cmd-mediawiki-project.sh mywiki --install --add-users --visual-editor
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
| Flag | What it does |
|
|
105
|
+
| --- | --- |
|
|
106
|
+
| `--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 |
|
|
107
|
+
| `--add-users` | With `--install`: add the default accounts |
|
|
108
|
+
| `--visual-editor` | Turn the visual editor on (VisualEditor; Parsoid is in core) |
|
|
109
|
+
| `--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) |
|
|
110
|
+
| `--php-version <x>` | The PHP of the project container (the current release needs 8.3 or later) |
|
|
111
|
+
| `--launch` | Open the wiki when it is ready |
|
|
112
|
+
|
|
113
|
+
The wiki answers at `https://mywiki.ddev.site`, its login at `/index.php?title=Special:UserLogin`.
|
|
114
|
+
The build adds to `LocalSettings.php`: uploads on, the "confirmed" group (the rights an account
|
|
115
|
+
otherwise earns after 4 days and 10 edits, the thresholds it sets as on large public wikis), the job
|
|
116
|
+
queue run by the service (`$wgJobRunRate = 0`), and the object cache and the sessions in the
|
|
117
|
+
database (the installer picks the PHP process cache, which the maintenance scripts cannot see and a
|
|
118
|
+
restart empties). A project of the same name is deleted first.
|
|
119
|
+
|
|
120
|
+
### Work on a wiki
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
bash cmd-tools-mediawiki-maintenance.sh mywiki # version, extensions, accounts
|
|
124
|
+
bash cmd-tools-mediawiki-maintenance.sh mywiki --run "showJobs --group" # any maintenance script
|
|
125
|
+
bash cmd-tools-mediawiki-maintenance.sh mywiki --update # the database updates
|
|
126
|
+
bash cmd-tools-mediawiki-maintenance.sh mywiki --jobs # the waiting jobs, now
|
|
127
|
+
bash cmd-tools-mediawiki-maintenance.sh mywiki --add-users # the default accounts
|
|
128
|
+
bash cmd-tools-mediawiki-maintenance.sh mywiki --cancel-users # block them
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### The default accounts
|
|
132
|
+
|
|
133
|
+
| Account | Address | Groups | Handle in the tests |
|
|
134
|
+
| --- | --- | --- | --- |
|
|
135
|
+
| `administrator` | `administrator@example.com` | sysop, bureaucrat | `administrator` |
|
|
136
|
+
| `editor` | `editor@example.com` | confirmed (the rights of an established account at once) | `editor` |
|
|
137
|
+
| `reader` | `reader@example.com` | none: a new account, refused the pages protected for established accounts | `reader` |
|
|
138
|
+
|
|
139
|
+
Each account has the password of the workspace's other default lists. They are for local wikis and
|
|
140
|
+
for tests; the wiki's first account is the workspace account and is never written into a test.
|
|
141
|
+
|
|
142
|
+
**Manage them with the maintenance tool, not the row's Users menu.** The dashboard's Users menu
|
|
143
|
+
picks its actions by the project type, and a wiki's type is `php`, so the menu offers actions that
|
|
144
|
+
do not apply to a wiki. Use:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
bash cmd-tools-mediawiki-maintenance.sh mywiki --add-users # add them, or give them back their password, groups and address, and lift a block
|
|
148
|
+
bash cmd-tools-mediawiki-maintenance.sh mywiki --cancel-users # cancel them
|
|
149
|
+
bash cmd-tools-add-users.sh mywiki mediawiki # the core's tool: the same list
|
|
150
|
+
bash cmd-tools-cancel-users.sh mywiki mediawiki
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
A wiki never deletes an account (its edits keep their author): cancelling blocks the account
|
|
154
|
+
without end, gives it a random password and ends its sessions; adding it again gives it back.
|
|
155
|
+
|
|
156
|
+
### Test a wiki
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
bash cmd-tools-testing.sh mywiki # webship-js, the step pack, the users registry, a first feature
|
|
160
|
+
bash cmd-tools-testing.sh mywiki --run # run the suite in the container
|
|
161
|
+
bash cmd-tools-testing.sh mywiki --run --path tests/features/site.feature
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
`cmd-tools-testing.sh` is the workspace's own. For a wiki it also adds `@webship-js/mediawiki-steps`
|
|
165
|
+
to `package.json`, lists its step definitions in `cucumber.js` after webship-js's own, writes the
|
|
166
|
+
users registry (the handles above, overridable with `MEDIAWIKI_<HANDLE>_USERNAME`,
|
|
167
|
+
`MEDIAWIKI_<HANDLE>_PASSWORD` and `MEDIAWIKI_<HANDLE>_EMAIL`), `wikiAdmin` (the handle the step
|
|
168
|
+
pack makes and deletes its test pages as, through the wiki's API) and the tags that keep the pack's
|
|
169
|
+
assertions that must fail out of a normal run, places `tests/features/site.feature` when the
|
|
170
|
+
project has none, and makes sure the default accounts are on the wiki. Run it again and it adds what
|
|
171
|
+
is missing and keeps what you changed.
|
|
172
|
+
|
|
173
|
+
The suite runs in the project's container, where the network changes of the host (another container
|
|
174
|
+
starting) do not cut the browser's requests.
|
|
175
|
+
|
|
176
|
+
A scenario of your own reads like this one, from the step pack's phrases (the skill
|
|
177
|
+
`mediawiki-scenarios` lists them by area); it makes its test pages and deletes them after it:
|
|
178
|
+
|
|
179
|
+
```gherkin
|
|
180
|
+
Feature: The talk page of a page
|
|
181
|
+
Scenario: The editor asks a question on the talk page
|
|
182
|
+
Given the page "Readme talk page" has the text "A page to talk about."
|
|
183
|
+
And the page "Talk:Readme talk page" does not exist
|
|
184
|
+
And I am a logged in user with the "editor" user
|
|
185
|
+
When I open the page "Readme talk page"
|
|
186
|
+
And I open the talk page
|
|
187
|
+
And I add the topic "A question" with the text "Is this page complete?"
|
|
188
|
+
Then the talk page should have the topic "A question"
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
`tests/features/site.feature` passes on a wiki built with `--install --add-users`. The features of the
|
|
192
|
+
step pack pass on a wiki built with `--install --add-users --visual-editor` (the visual editor
|
|
193
|
+
feature needs it); each makes its own test pages and deletes them after it.
|
|
194
|
+
|
|
195
|
+
## The AI items
|
|
196
|
+
|
|
197
|
+
`ai/` in the package holds one folder per kind, the manifest's `ai` block names each item, and
|
|
198
|
+
`--install` places it in the workspace folder of that kind.
|
|
199
|
+
|
|
200
|
+
| Kind | Item | Use it to |
|
|
201
|
+
| --- | --- | --- |
|
|
202
|
+
| Agent | `mediawiki-site-builder` | Build, update, maintain or remove a wiki with the commands above, in containers only |
|
|
203
|
+
| 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 |
|
|
204
|
+
| 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 |
|
|
205
|
+
| 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 |
|
|
206
|
+
| 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 |
|
|
207
|
+
| Prompt | `mediawiki-scenarios-for-an-area` | Start a session that writes and runs the scenarios of one area of a wiki |
|
|
208
|
+
|
|
209
|
+
After `--install` each is in its folder on the dashboard. **Install** there puts an agent, a skill
|
|
210
|
+
or a command into Claude Code (`~/.claude/agents`, `~/.claude/skills`, `~/.claude/commands`), or
|
|
211
|
+
from the command line:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
cd ~/workspace/ai-agents && bash cmd-tools-ai-items.sh mediawiki-tester --install
|
|
215
|
+
cd ~/workspace/ai-skills && bash cmd-tools-ai-items.sh mediawiki-scenarios --install
|
|
216
|
+
cd ~/workspace/ai-commands && bash cmd-tools-ai-items.sh mediawiki-test --install
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
A prompt is not installed: it is the whole `claude …` launch command of a new session, and the
|
|
220
|
+
dashboard's **New screen** form lists it as a template. By hand, fill the placeholders in and run
|
|
221
|
+
the command of the file from the folder it names.
|
|
222
|
+
|
|
223
|
+
The items are written for any AI CLI, with Claude Code as the default shape: the frontmatter and
|
|
224
|
+
the file layout are Claude Code's, the body of each item is plain Markdown that names no tool or
|
|
225
|
+
feature of one CLI, a command says in words what its arguments are, and the text between the
|
|
226
|
+
triple quotes of a prompt can be given to another AI CLI as it is.
|
|
227
|
+
|
|
228
|
+
Every step phrase the items show is checked against the definitions of the step pack and of
|
|
229
|
+
webship-js (`tests/fixtures/step-definitions.txt`), and every command and flag against the
|
|
230
|
+
plugin's own.
|
|
231
|
+
|
|
232
|
+
## Develop it
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
npm install # builds dist/ (TypeScript)
|
|
236
|
+
npm run lint
|
|
237
|
+
npm test # the manifest, the commands, the AI items, the functions against a scaffolded project
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
CI runs the same on Node.js 20 and 24, parses every shell script, and runs the plugin's
|
|
241
|
+
`features/mediawiki.feature` against a dashboard with this plugin installed
|
|
242
|
+
(`webship/workspace/.github/workflows/plugin-browser-suite.yml`).
|
|
@@ -0,0 +1,104 @@
|
|
|
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
|
+
The wiki answers at `https://mywiki.ddev.site`, its login at `/index.php?title=Special:UserLogin`.
|
|
43
|
+
A project of the same name is deleted first: never build over a wiki somebody still needs.
|
|
44
|
+
|
|
45
|
+
What the build does, so you can explain it:
|
|
46
|
+
|
|
47
|
+
- `ddev config --project-type=php --docroot=""`: DDEV has no project type for MediaWiki, the wiki is at the docroot;
|
|
48
|
+
- the rule MediaWiki documents for nginx, so `rest.php/v1/...` reaches the REST API (the search
|
|
49
|
+
suggestions and the visual editor use it), in `.ddev/nginx/mediawiki-rest.conf`;
|
|
50
|
+
- the release tarball from releases.wikimedia.org, unpacked in the container;
|
|
51
|
+
- uploads on, the "confirmed" group, a new account autoconfirmed after 4 days and 10 edits, the object cache
|
|
52
|
+
and the sessions in the database (added to `LocalSettings.php`);
|
|
53
|
+
- the job queue as a service of the web container (`.ddev/config.mediawiki-jobs.yaml`, `runJobs --wait`).
|
|
54
|
+
|
|
55
|
+
## Work on a wiki
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
bash cmd-tools-mediawiki-maintenance.sh mywiki # version, extensions, accounts
|
|
59
|
+
bash cmd-tools-mediawiki-maintenance.sh mywiki --run "showJobs --group" # any maintenance script
|
|
60
|
+
bash cmd-tools-mediawiki-maintenance.sh mywiki --update # the database updates
|
|
61
|
+
bash cmd-tools-mediawiki-maintenance.sh mywiki --jobs # the waiting jobs, now
|
|
62
|
+
bash cmd-tools-mediawiki-maintenance.sh mywiki --add-users # the default accounts
|
|
63
|
+
bash cmd-tools-mediawiki-maintenance.sh mywiki --cancel-users # block them (a wiki keeps every account)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The row's Users menu on the dashboard picks its actions by the project type, and a wiki's type is
|
|
67
|
+
`php`: use `--add-users` and `--cancel-users` of the maintenance tool, or
|
|
68
|
+
`bash cmd-tools-add-users.sh mywiki mediawiki` and `bash cmd-tools-cancel-users.sh mywiki mediawiki`.
|
|
69
|
+
|
|
70
|
+
## The default accounts
|
|
71
|
+
|
|
72
|
+
| Account | Groups | Kind |
|
|
73
|
+
| --- | --- | --- |
|
|
74
|
+
| `administrator` | sysop, bureaucrat | protects, deletes, restores, blocks |
|
|
75
|
+
| `editor` | confirmed | the rights of an established account at once |
|
|
76
|
+
| `reader` | none | a new account, refused the pages protected for established accounts |
|
|
77
|
+
|
|
78
|
+
Each has the password of the workspace's other default lists, and an address at example.com. They are
|
|
79
|
+
for local wikis and for tests. A wiki never deletes an account: cancelling blocks it without end and
|
|
80
|
+
gives it a random password; adding them again gives back the password, the groups and the address,
|
|
81
|
+
and lifts the block.
|
|
82
|
+
|
|
83
|
+
## Rules
|
|
84
|
+
|
|
85
|
+
- Containers only: never run `php`, the maintenance scripts or the database client on the host for a
|
|
86
|
+
wiki; the tool runs them in the container.
|
|
87
|
+
- Back up before a risky change (`bash cmd-tools-backup-<folder>.sh mywiki`), clone to try something
|
|
88
|
+
(`bash cmd-tools-clone.sh mywiki --to mywiki2`), and remove with `bash cmd-tools-remove.sh mywiki`.
|
|
89
|
+
- The workspace account is the wiki's first account: never write its password anywhere.
|
|
90
|
+
- Testing is `mediawiki-tester`'s work: hand over with the wiki's name and folder.
|
|
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.
|
|
@@ -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
|
+
```
|