@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 +291 -2
- package/ai/agents/mediawiki-site-builder.md +106 -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 +33 -0
- package/commands/cmd-tools-mediawiki-maintenance.sh +26 -0
- package/dist/src/index.d.ts +29 -0
- package/dist/src/index.js +54 -0
- package/dist/src/index.js.map +1 -0
- package/features/mediawiki-runtimes.feature +54 -0
- package/features/mediawiki.feature +36 -0
- package/package.json +97 -4
- package/scripts/args/arg-mediawiki-maintenance.sh +25 -0
- package/scripts/args/arg-mediawiki.sh +34 -0
- package/scripts/functions/fun-mediawiki.sh +491 -0
- package/testing/site.feature +48 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mediawiki-scenarios
|
|
3
|
+
description: Write webship-js scenarios for a MediaWiki wiki of the Webship Workspace from phrases that exist — the MediaWiki step pack's steps by area (reading, search, the editors, history, talk pages, categories, watchlist, preferences, uploads, administration, the session), the handles of the users registry, the test pages a scenario makes and the steps delete, the traps found on a real wiki, and three features that pass on a new wiki. Use when writing or fixing a scenario for a wiki, choosing a step for a wiki screen, or turning a manual check of a wiki into a feature.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# mediawiki-scenarios
|
|
7
|
+
|
|
8
|
+
Scenarios for a wiki built with the MediaWiki plugin (`bash cmd-mediawiki-project.sh <wiki> --install
|
|
9
|
+
--add-users --visual-editor`) in a container-based workspace (DDEV by default), tested with webship-js
|
|
10
|
+
and `@webship-js/mediawiki-steps` once `bash cmd-tools-testing.sh <wiki>` set the project up. Every
|
|
11
|
+
phrase below exists in the pack or in webship-js; a scenario names no platform.
|
|
12
|
+
|
|
13
|
+
## Accounts and test pages
|
|
14
|
+
|
|
15
|
+
- `Given I am a logged in user with the "editor" user`: `administrator` (sysop, bureaucrat),
|
|
16
|
+
`editor` (confirmed), `reader` (a new account). `Given I am an anonymous user` for a visitor.
|
|
17
|
+
- `Given the page "…" has the text "…"` (one line, `\n` for a new line, `with the summary "…"` for
|
|
18
|
+
the history), or `has the text:` with a doc string: a test page, made through the wiki's API as
|
|
19
|
+
`wikiAdmin` and deleted after the scenario. A page a person made is never overwritten.
|
|
20
|
+
- `Given the page "…" does not exist`: for the page the scenario makes itself (it is deleted after it).
|
|
21
|
+
- `Given the page "…" is protected so that only autoconfirmed users can edit it` (or `administrators`).
|
|
22
|
+
- `Given the file "Name.png" is uploaded from "tests/fixtures/blue-square.png"` and `Given the account
|
|
23
|
+
"reader" is not blocked`.
|
|
24
|
+
|
|
25
|
+
## Phrases by area
|
|
26
|
+
|
|
27
|
+
| Area | Steps |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| Reading | `I open the page "…"`, `I should see the page "…"`, `the page text should contain "…"`, `the page should have the section "…"`, `the page should have these sections in order:`, `the contents list should list "…"`, `I follow "…" in the contents list`, `I should be at the section "…"`, `the page should link to the page "…"` (or `the missing page`), `the page should link to the external site "…"`, `I follow the link to the page "…"`, `the reference "1" should read "…"`, `the scripts of the page should all load` |
|
|
30
|
+
| Categories | `the page should be in the category "…"`, `I follow the category "…"`, `the category should list the page "…"` (or `the subcategory`), `I expand the category "…" in the category tree`, `the category tree should show "…" under "…"` |
|
|
31
|
+
| Search | `I type "…" in the search box`, `the search suggestions should list "…"`, `I choose the suggestion "…"`, `I search for "…"`, `the search results should list the page "…"`, `the search result "…" should mention "…"`, `the search should find 1 page` (or `no page`) |
|
|
32
|
+
| Source editor | `I edit the page "…"`, `I set the wikitext to "…"` (or `to:`), `I add the wikitext "…"`, `I preview the page`, `the preview should show "…"`, `I show my changes`, `the changes should show "…" added` (or `removed`), `I save the page as a minor edit with the summary "…"`, `the edit should be saved`, `the page should be created` |
|
|
33
|
+
| Visual editor | `I edit the page "…" in the visual editor`, `I type "…" in the visual editor`, `I save the page with the summary "…"`, `the visual editor should not be open` |
|
|
34
|
+
| Conflicts and refusals | `another account saves the page "…" with the text "…"`, `I should see an edit conflict`, `the edit conflict should keep my text "…"`, `editing the page "…" should be refused with "…"` |
|
|
35
|
+
| History and talk | `I open the history of the page "…"`, `the history should list the revision "…" by "editor"`, `I compare the revisions "…" and "…"`, `I undo the revision "…"`, `I open the talk page`, `I add the topic "…" with the text "…"`, `the talk page should have the topic "…"` |
|
|
36
|
+
| Watchlist and preferences | `I watch the page`, `I stop watching the page`, `my watchlist should list the page "…"`, `the recent changes should show a change to "…" with the summary "…"`, `I open my preferences`, `I tick the preference "…"`, `I save my preferences` |
|
|
37
|
+
| Files | `I upload the file "tests/fixtures/blue-square.png" as "Name.png" ignoring warnings`, `I should see the file "Name.png"`, `the upload should be held back with the warning "…"` |
|
|
38
|
+
| Administration | `I protect the page "…" so that only administrators can edit it`, `I remove the protection of the page "…"`, `I delete the page "…" with the reason "…"`, `I restore the page "…" with the reason "…"`, `I block the account "reader" for "1 day" with the reason "…"`, `I unblock the account "reader" with the reason "…"`, `the account "reader" should be blocked`, `the page "…" should not exist` |
|
|
39
|
+
| Session | `I log in as "editor" with the login form`, `I log in with the user name "…" and the password "…"`, `the login should be refused with "…"`, `I log out`, `I should be logged in as "editor"`, `nobody should be logged in`, `I try to create the account "…" with the password "…" and the confirmation "…"`, `the account creation should be refused with "…"` |
|
|
40
|
+
|
|
41
|
+
## Traps found on a real wiki
|
|
42
|
+
|
|
43
|
+
- A link in the categories box to a category without a page is a red link that opens the editor:
|
|
44
|
+
make the category's page first.
|
|
45
|
+
- The search finds a page by a word of its text; a title typed exactly opens that page instead of the
|
|
46
|
+
results: search for a word, not a title.
|
|
47
|
+
- Five failed logins of one account from one address in five minutes lock it for five minutes: try
|
|
48
|
+
wrong passwords with a name no other scenario uses.
|
|
49
|
+
- The visual editor's welcome dialog and the watchlist popover are closed by the steps; a plain
|
|
50
|
+
`I press "…"` behind them does nothing.
|
|
51
|
+
- A history row is found by its summary: give the setup revisions summaries of their own.
|
|
52
|
+
- Make the pages a page links to before the page itself: a link to a page made later stays red until a
|
|
53
|
+
job of the wiki draws the page again.
|
|
54
|
+
- An undo's summary differs between releases ("Undid revision …", "Undo revision …"): save the undo with a
|
|
55
|
+
summary of your own when a scenario looks for it in the history.
|
|
56
|
+
|
|
57
|
+
## Examples
|
|
58
|
+
|
|
59
|
+
- [`examples/reading-and-search.feature`](examples/reading-and-search.feature): a page, its links, the search box and a full search.
|
|
60
|
+
- [`examples/editing.feature`](examples/editing.feature): the source editor with its changes, the history, the visual editor.
|
|
61
|
+
- [`examples/administration.feature`](examples/administration.feature): a protected page refused, a page deleted and restored.
|
|
62
|
+
|
|
63
|
+
Copy them into `tests/features/` of the project and run them:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
bash cmd-tools-testing.sh <wiki> --run --path tests/features/editing.feature
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## The book
|
|
70
|
+
|
|
71
|
+
For any automated functional testing in this work (a Gherkin feature, a step definition, choosing a
|
|
72
|
+
step, a test run and its failures), read the book *Automated Functional Testing Recipes* first.
|
|
73
|
+
|
|
74
|
+
- **Where.** Use the first that exists: `.claude/automated-functional-testing-recipes/` in the project,
|
|
75
|
+
`~/.claude/automated-functional-testing-recipes/` (installed by webship/webship-js-ai-agent,
|
|
76
|
+
webship/webship-js-skills or webship/ai-agents), or
|
|
77
|
+
https://github.com/webship/webship-js-ai-agent/tree/2.0.x/automated-functional-testing-recipes
|
|
78
|
+
- **How.** Its `README.md` first, then the chapter that matches the task (one file per chapter,
|
|
79
|
+
named by its subject), not the single complete file.
|
|
80
|
+
- **Which wins.** The installed webship-js package and the step pack are the source of truth for
|
|
81
|
+
step phrasing. When they differ from the book, follow them and say so.
|
|
82
|
+
- **For MediaWiki.** Start with `ch26-testing-cms-applications.md` (content, publishing, media and
|
|
83
|
+
roles), `ch07-waiting-dynamic-content.md` (waiting on the page's own signals),
|
|
84
|
+
`ch10-authentication-authorization.md` (logins, sessions and refusals) and
|
|
85
|
+
`ch21-when-tests-go-bad.md` (flaky, brittle and slow scenarios).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Feature: The administrator protects and deletes pages
|
|
2
|
+
A page protected for established accounts refuses a new account; a deleted page can be restored.
|
|
3
|
+
|
|
4
|
+
Scenario: The new account is refused a protected page
|
|
5
|
+
Given the page "Skill protected page" has the text "Only established accounts edit this page."
|
|
6
|
+
And the page "Skill protected page" is protected so that only autoconfirmed users can edit it
|
|
7
|
+
And I am a logged in user with the "reader" user
|
|
8
|
+
Then editing the page "Skill protected page" should be refused with "This page has been protected to prevent editing or other actions."
|
|
9
|
+
|
|
10
|
+
Scenario: A page deleted and restored
|
|
11
|
+
Given the page "Skill deleted page" has the text "A page to delete and restore."
|
|
12
|
+
And I am a logged in user with the "administrator" user
|
|
13
|
+
When I delete the page "Skill deleted page" with the reason "A test of the deletion"
|
|
14
|
+
Then the page "Skill deleted page" should not exist
|
|
15
|
+
When I restore the page "Skill deleted page" with the reason "A test of the restore"
|
|
16
|
+
Then the page "Skill deleted page" should exist
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Feature: Editing a page
|
|
2
|
+
The editor changes a page in the source editor and in the visual editor, and the history shows
|
|
3
|
+
each change by its summary. The visual editor needs a wiki built with --visual-editor.
|
|
4
|
+
|
|
5
|
+
Scenario: The source editor, with the changes checked before the save
|
|
6
|
+
Given the page "Skill editing page" has the text "Words to change." with the summary "First version"
|
|
7
|
+
And I am a logged in user with the "editor" user
|
|
8
|
+
When I edit the page "Skill editing page"
|
|
9
|
+
And I set the wikitext to "Words changed in the source editor."
|
|
10
|
+
And I show my changes
|
|
11
|
+
Then the changes should show "Words changed in the source editor." added
|
|
12
|
+
When I save the page with the summary "A clearer sentence"
|
|
13
|
+
Then the edit should be saved
|
|
14
|
+
When I open the history of the page "Skill editing page"
|
|
15
|
+
Then the history should list the revision "A clearer sentence" by "editor"
|
|
16
|
+
And the history should list the revision "First version" by "administrator"
|
|
17
|
+
|
|
18
|
+
Scenario: The visual editor
|
|
19
|
+
Given the page "Skill visual page" has the text "A page to change."
|
|
20
|
+
And I am a logged in user with the "editor" user
|
|
21
|
+
When I edit the page "Skill visual page" in the visual editor
|
|
22
|
+
And I type " Typed in the visual editor." in the visual editor
|
|
23
|
+
And I save the page with the summary "A sentence in the visual editor"
|
|
24
|
+
Then the visual editor should not be open
|
|
25
|
+
And the page text should contain "Typed in the visual editor."
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Feature: Reading and searching the wiki
|
|
2
|
+
A reader opens a page with its sections and links, and finds a page by the search box and by
|
|
3
|
+
a full search. The scenarios make their own pages, which are deleted after each one.
|
|
4
|
+
|
|
5
|
+
Background:
|
|
6
|
+
Given the page "Skill second page" has the text "The page the reading page links to."
|
|
7
|
+
And the page "Skill reading page" has the text:
|
|
8
|
+
"""
|
|
9
|
+
Lighthouses guide ships along the coast.
|
|
10
|
+
|
|
11
|
+
== Overview ==
|
|
12
|
+
A page of the wiki: [[Skill second page]].
|
|
13
|
+
|
|
14
|
+
== History ==
|
|
15
|
+
A page that does not exist yet: [[Skill page not written]].
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
Scenario: A visitor reads the page and follows a link
|
|
19
|
+
Given I am an anonymous user
|
|
20
|
+
When I open the page "Skill reading page"
|
|
21
|
+
Then I should see the page "Skill reading page"
|
|
22
|
+
And the page should have the section "Overview"
|
|
23
|
+
And the page should link to the page "Skill second page"
|
|
24
|
+
And the page should link to the missing page "Skill page not written"
|
|
25
|
+
When I follow the link to the page "Skill second page"
|
|
26
|
+
Then I should see the page "Skill second page"
|
|
27
|
+
|
|
28
|
+
Scenario: The search box suggests the page
|
|
29
|
+
Given I am an anonymous user
|
|
30
|
+
And I am on the page "Main Page"
|
|
31
|
+
When I type "Skill readi" in the search box
|
|
32
|
+
Then the search suggestions should list "Skill reading page"
|
|
33
|
+
When I choose the suggestion "Skill reading page"
|
|
34
|
+
Then I should see the page "Skill reading page"
|
|
35
|
+
|
|
36
|
+
Scenario: A full search finds the page by a word of its text
|
|
37
|
+
Given I am an anonymous user
|
|
38
|
+
And I am on the page "Main Page"
|
|
39
|
+
When I search for "lighthouses"
|
|
40
|
+
Then the search results should list the page "Skill reading page"
|
|
41
|
+
And the search result "Skill reading page" should mention "lighthouses"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# workspace-name: MediaWiki (release tarball)
|
|
4
|
+
|
|
5
|
+
# Installed by the MediaWiki plugin (plugins.sh --install mediawiki); __WORKSPACE__ is the workspace it was installed into.
|
|
6
|
+
#
|
|
7
|
+
# Build a wiki in a container from the MediaWiki release tarball: on DDEV (the default) at
|
|
8
|
+
# https://<name>.ddev.site (project type php, the wiki at the docroot), and with --runtime docker,
|
|
9
|
+
# podman or kubernetes on that runtime, at the address the build prints. With --install it is installed by its own installer on
|
|
10
|
+
# the container's database, with the extensions a default wiki uses, and the workspace account is its
|
|
11
|
+
# first account; with --add-users it also gets the default accounts; with --visual-editor, the visual
|
|
12
|
+
# editor.
|
|
13
|
+
|
|
14
|
+
# Bootstrap.
|
|
15
|
+
# Find the workspace tooling from this script, so a fresh clone needs no setup.
|
|
16
|
+
WORKSPACE_SCRIPTS="${WORKSPACE_SCRIPTS:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../core/scripts" && pwd)}";
|
|
17
|
+
source ${WORKSPACE_SCRIPTS}/bootstrap.sh || exit 1 ;
|
|
18
|
+
|
|
19
|
+
# Load workspace settings.
|
|
20
|
+
eval $(parse_yaml ${WORKSPACE_CONFIG}/workspace.__WORKSPACE__.settings.yml);
|
|
21
|
+
|
|
22
|
+
# Distribution.
|
|
23
|
+
distribution_name="mediawiki";
|
|
24
|
+
distribution_title="MediaWiki";
|
|
25
|
+
distribution_webroot="";
|
|
26
|
+
|
|
27
|
+
ARGPARSE_DESCRIPTION="Build a ${distribution_title} wiki in __WORKSPACE__"
|
|
28
|
+
# The args file comes with the plugin: core/scripts/plugins/mediawiki/ is where plugins.sh --install puts it.
|
|
29
|
+
source ${WORKSPACE_SCRIPTS}/plugins/mediawiki/args/arg-mediawiki.sh || exit 1 ;
|
|
30
|
+
|
|
31
|
+
shift $#;
|
|
32
|
+
|
|
33
|
+
mediawiki_build ;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# Installed by the MediaWiki plugin (plugins.sh --install mediawiki); __WORKSPACE__ is the workspace it was installed into.
|
|
4
|
+
#
|
|
5
|
+
# The maintenance scripts of one wiki of this workspace, in its container (maintenance/run.php): say
|
|
6
|
+
# what the wiki is, run a script, run the database updates, run the waiting jobs, add or cancel the
|
|
7
|
+
# default accounts. Nothing here runs on the host.
|
|
8
|
+
|
|
9
|
+
# Bootstrap.
|
|
10
|
+
# Find the workspace tooling from this script, so a fresh clone needs no setup.
|
|
11
|
+
WORKSPACE_SCRIPTS="${WORKSPACE_SCRIPTS:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../core/scripts" && pwd)}";
|
|
12
|
+
source ${WORKSPACE_SCRIPTS}/bootstrap.sh || exit 1 ;
|
|
13
|
+
|
|
14
|
+
# Load workspace settings.
|
|
15
|
+
eval $(parse_yaml ${WORKSPACE_CONFIG}/workspace.__WORKSPACE__.settings.yml);
|
|
16
|
+
|
|
17
|
+
# Distribution.
|
|
18
|
+
distribution_name="mediawiki";
|
|
19
|
+
|
|
20
|
+
ARGPARSE_DESCRIPTION="Run the maintenance scripts of a MediaWiki wiki of __WORKSPACE__: status, a script, updates, jobs, the default accounts"
|
|
21
|
+
# The args file comes with the plugin: core/scripts/plugins/mediawiki/ is where plugins.sh --install puts it.
|
|
22
|
+
source ${WORKSPACE_SCRIPTS}/plugins/mediawiki/args/arg-mediawiki-maintenance.sh || exit 1 ;
|
|
23
|
+
|
|
24
|
+
shift $#;
|
|
25
|
+
|
|
26
|
+
mediawiki_maintenance_tool ;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MediaWiki for Webship Workspace: a platform plugin.
|
|
3
|
+
*
|
|
4
|
+
* What the package carries is placed by the installer from the manifest: the builder and the
|
|
5
|
+
* maintenance tool in the sites folders, their functions and argparse under core/scripts/plugins/mediawiki/,
|
|
6
|
+
* and its AI items (ai/ in this package) in the folder of their kind: the agents in AI Agents, the skill
|
|
7
|
+
* in AI Skills, the command in AI Commands, the prompts in AI Prompts. The dashboard needs nothing drawn
|
|
8
|
+
* for it: the builder is in the Build list because it is a cmd-*-project.sh, the row menus are the
|
|
9
|
+
* core's, the AI items are listed like any other. What register() adds is what the assistant is told.
|
|
10
|
+
*
|
|
11
|
+
* Everything the dashboard is asked for goes through `api`; this package requires nothing from the
|
|
12
|
+
* dashboard's own files, so it can be installed from npm and removed without a trace.
|
|
13
|
+
*/
|
|
14
|
+
import type { PluginApi } from '@webship.co/workspace-plugin-api';
|
|
15
|
+
/** The plugin's name. A wiki is a DDEV project of type php: the plugin knows it by its files. */
|
|
16
|
+
export declare const PLATFORM = "mediawiki";
|
|
17
|
+
/** The commands the installer places in every sites folder. */
|
|
18
|
+
export declare const COMMANDS: string[];
|
|
19
|
+
/** The agents the installer places in the AI Agents folder. */
|
|
20
|
+
export declare const AGENTS: string[];
|
|
21
|
+
/** The skill the installer places in the AI Skills folder (a folder each, with its SKILL.md). */
|
|
22
|
+
export declare const SKILLS: string[];
|
|
23
|
+
/** The slash command the installer places in the AI Commands folder. */
|
|
24
|
+
export declare const AI_COMMANDS: string[];
|
|
25
|
+
/** The prompts the installer places in the AI Prompts folder: each a whole launch command for a new session. */
|
|
26
|
+
export declare const PROMPTS: string[];
|
|
27
|
+
/** What the assistant is told about MediaWiki in this workspace. */
|
|
28
|
+
export declare function assistantContext(): string;
|
|
29
|
+
export declare function register(api: PluginApi): void;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MediaWiki for Webship Workspace: a platform plugin.
|
|
4
|
+
*
|
|
5
|
+
* What the package carries is placed by the installer from the manifest: the builder and the
|
|
6
|
+
* maintenance tool in the sites folders, their functions and argparse under core/scripts/plugins/mediawiki/,
|
|
7
|
+
* and its AI items (ai/ in this package) in the folder of their kind: the agents in AI Agents, the skill
|
|
8
|
+
* in AI Skills, the command in AI Commands, the prompts in AI Prompts. The dashboard needs nothing drawn
|
|
9
|
+
* for it: the builder is in the Build list because it is a cmd-*-project.sh, the row menus are the
|
|
10
|
+
* core's, the AI items are listed like any other. What register() adds is what the assistant is told.
|
|
11
|
+
*
|
|
12
|
+
* Everything the dashboard is asked for goes through `api`; this package requires nothing from the
|
|
13
|
+
* dashboard's own files, so it can be installed from npm and removed without a trace.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.PROMPTS = exports.AI_COMMANDS = exports.SKILLS = exports.AGENTS = exports.COMMANDS = exports.PLATFORM = void 0;
|
|
17
|
+
exports.assistantContext = assistantContext;
|
|
18
|
+
exports.register = register;
|
|
19
|
+
/** The plugin's name. A wiki is a DDEV project of type php: the plugin knows it by its files. */
|
|
20
|
+
exports.PLATFORM = 'mediawiki';
|
|
21
|
+
/** The commands the installer places in every sites folder. */
|
|
22
|
+
exports.COMMANDS = ['cmd-mediawiki-project.sh', 'cmd-tools-mediawiki-maintenance.sh'];
|
|
23
|
+
/** The agents the installer places in the AI Agents folder. */
|
|
24
|
+
exports.AGENTS = ['mediawiki-site-builder', 'mediawiki-tester'];
|
|
25
|
+
/** The skill the installer places in the AI Skills folder (a folder each, with its SKILL.md). */
|
|
26
|
+
exports.SKILLS = ['mediawiki-scenarios'];
|
|
27
|
+
/** The slash command the installer places in the AI Commands folder. */
|
|
28
|
+
exports.AI_COMMANDS = ['mediawiki-test'];
|
|
29
|
+
/** The prompts the installer places in the AI Prompts folder: each a whole launch command for a new session. */
|
|
30
|
+
exports.PROMPTS = ['mediawiki-build-and-test', 'mediawiki-scenarios-for-an-area'];
|
|
31
|
+
/** What the assistant is told about MediaWiki in this workspace. */
|
|
32
|
+
function assistantContext() {
|
|
33
|
+
return [
|
|
34
|
+
'MediaWiki (a plugin, @webship.co/workspace-mediawiki): a wiki is built with',
|
|
35
|
+
'`bash cmd-mediawiki-project.sh <name> --install --add-users --visual-editor` from a sites folder (dev, test, sandboxes, demos),',
|
|
36
|
+
'from the release tarball (the current stable release, or `--mediawiki-version <x>`), installed by its own installer',
|
|
37
|
+
'in a container like every other project (project type php, the wiki at the docroot): on DDEV by default, at https://<name>.ddev.site,',
|
|
38
|
+
'or with `--runtime docker` or `--runtime kubernetes` on Docker Compose or a Kubernetes cluster, at the address the build prints;',
|
|
39
|
+
'with WikiEditor, CategoryTree and Cite (and the visual editor with `--visual-editor`), uploads on and the job queue run by a service of the container.',
|
|
40
|
+
'`bash cmd-tools-mediawiki-maintenance.sh <name>` says what the wiki is; `--run "<script> <args>"` runs a maintenance script in it,',
|
|
41
|
+
'`--update` runs the database updates, `--jobs` runs the waiting jobs,',
|
|
42
|
+
'`--add-users` adds the default accounts (administrator, editor, reader) and `--cancel-users` blocks them (a wiki never deletes an account).',
|
|
43
|
+
'The row\'s Users menu does not apply to a wiki (its project type is php): use the maintenance tool for the accounts.',
|
|
44
|
+
'`bash cmd-tools-testing.sh <name>` sets up webship-js with the MediaWiki step pack; `--run` runs the suite.',
|
|
45
|
+
`For MediaWiki work, hand over to the agents ${exports.AGENTS.map((a) => `\`${a}\``).join(' and ')}.`,
|
|
46
|
+
`The plugin also places the skill ${exports.SKILLS.map((a) => `\`${a}\``).join(', ')} (the step pack's phrases, by area) in ai-skills/,`,
|
|
47
|
+
`the command ${exports.AI_COMMANDS.map((a) => `\`/${a} <wiki>\``).join(', ')} in ai-commands/ and the prompts ${exports.PROMPTS.map((a) => `\`${a}\``).join(' and ')} in ai-prompts/.`,
|
|
48
|
+
'Never run php or the maintenance scripts on the host for a project; the database settings in its LocalSettings.php are the container\'s own (db, db, db).',
|
|
49
|
+
].join(' ');
|
|
50
|
+
}
|
|
51
|
+
function register(api) {
|
|
52
|
+
api.addAssistantContext(assistantContext);
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAuBH,4CAkBC;AAED,4BAEC;AAzCD,iGAAiG;AACpF,QAAA,QAAQ,GAAG,WAAW,CAAC;AAEpC,+DAA+D;AAClD,QAAA,QAAQ,GAAG,CAAC,0BAA0B,EAAE,oCAAoC,CAAC,CAAC;AAE3F,+DAA+D;AAClD,QAAA,MAAM,GAAG,CAAC,wBAAwB,EAAE,kBAAkB,CAAC,CAAC;AAErE,iGAAiG;AACpF,QAAA,MAAM,GAAG,CAAC,qBAAqB,CAAC,CAAC;AAE9C,wEAAwE;AAC3D,QAAA,WAAW,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAE9C,gHAAgH;AACnG,QAAA,OAAO,GAAG,CAAC,0BAA0B,EAAE,iCAAiC,CAAC,CAAC;AAEvF,oEAAoE;AACpE,SAAgB,gBAAgB;IAC9B,OAAO;QACL,6EAA6E;QAC7E,iIAAiI;QACjI,qHAAqH;QACrH,uIAAuI;QACvI,kIAAkI;QAClI,wJAAwJ;QACxJ,oIAAoI;QACpI,uEAAuE;QACvE,6IAA6I;QAC7I,sHAAsH;QACtH,6GAA6G;QAC7G,+CAA+C,cAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG;QAC7F,oCAAoC,cAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,oDAAoD;QAChI,eAAe,mBAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,oCAAoC,eAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB;QACtK,2JAA2J;KAC5J,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;AAED,SAAgB,QAAQ,CAAC,GAAc;IACrC,GAAG,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Feature: A wiki on Docker Compose and on Kubernetes
|
|
2
|
+
The builder builds on DDEV by default, and with --runtime on Docker Compose or on a Kubernetes cluster. A wiki
|
|
3
|
+
built there has the row a DDEV site has: its state, its own address, the runtime's menu, and the test users of
|
|
4
|
+
the plugin in its Tests menu.
|
|
5
|
+
|
|
6
|
+
# Each scenario drives a real wiki of that runtime, built with cmd-mediawiki-project.sh --runtime: the first
|
|
7
|
+
# running one the workspace holds that the plugin claims. Without one it is skipped, with the reason. In the
|
|
8
|
+
# plugin's CI the Docker Compose wiki is the one the manifest's featuresSite builds.
|
|
9
|
+
|
|
10
|
+
@needs-runtime-docker @needs-platform-mediawiki
|
|
11
|
+
Scenario: A wiki built on Docker Compose runs at its own address, with the DOCKER menu
|
|
12
|
+
Given I am on the folder of the "docker" site
|
|
13
|
+
Then the row of the "docker" site should show "Running"
|
|
14
|
+
And the row of the "docker" site should link to the address of its runtime
|
|
15
|
+
And the address of the "docker" site should answer
|
|
16
|
+
And the row of the "docker" site should carry the "DOCKER" menu and no DDEV menu
|
|
17
|
+
|
|
18
|
+
@needs-runtime-docker @needs-platform-mediawiki
|
|
19
|
+
Scenario: The Tests menu of a wiki on Docker Compose offers the test users
|
|
20
|
+
Given I am on the folder of the "docker" site
|
|
21
|
+
When I open the "tests" menu of the "docker" site
|
|
22
|
+
Then the open menu should offer "Add the test users"
|
|
23
|
+
And the open menu should offer "Cancel the test users"
|
|
24
|
+
|
|
25
|
+
@needs-runtime-docker @needs-platform-mediawiki
|
|
26
|
+
Scenario: The wiki on Docker Compose is installed: its main page and its login page
|
|
27
|
+
Given I am on the folder of the "docker" site
|
|
28
|
+
When I open "/index.php?title=Main_Page" on the "docker" site
|
|
29
|
+
Then I should see "Main Page"
|
|
30
|
+
When I open "/index.php?title=Special:UserLogin" on the "docker" site
|
|
31
|
+
Then I should see "Keep me logged in"
|
|
32
|
+
|
|
33
|
+
@needs-runtime-kubernetes @needs-platform-mediawiki
|
|
34
|
+
Scenario: A wiki built on Kubernetes runs at the address of its node, with the K8S menu
|
|
35
|
+
Given I am on the folder of the "kubernetes" site
|
|
36
|
+
Then the row of the "kubernetes" site should show "Running"
|
|
37
|
+
And the row of the "kubernetes" site should link to the address of its runtime
|
|
38
|
+
And the address of the "kubernetes" site should answer
|
|
39
|
+
And the row of the "kubernetes" site should carry the "K8S" menu and no DDEV menu
|
|
40
|
+
|
|
41
|
+
@needs-runtime-kubernetes @needs-platform-mediawiki
|
|
42
|
+
Scenario: The Tests menu of a wiki on Kubernetes offers the test users
|
|
43
|
+
Given I am on the folder of the "kubernetes" site
|
|
44
|
+
When I open the "tests" menu of the "kubernetes" site
|
|
45
|
+
Then the open menu should offer "Add the test users"
|
|
46
|
+
And the open menu should offer "Cancel the test users"
|
|
47
|
+
|
|
48
|
+
@needs-runtime-kubernetes @needs-platform-mediawiki
|
|
49
|
+
Scenario: The wiki on Kubernetes is installed: its main page and its login page
|
|
50
|
+
Given I am on the folder of the "kubernetes" site
|
|
51
|
+
When I open "/index.php?title=Main_Page" on the "kubernetes" site
|
|
52
|
+
Then I should see "Main Page"
|
|
53
|
+
When I open "/index.php?title=Special:UserLogin" on the "kubernetes" site
|
|
54
|
+
Then I should see "Keep me logged in"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Feature: The MediaWiki plugin on the dashboard
|
|
2
|
+
Once the plugin is activated and installed, the sites folders offer the MediaWiki builder, each
|
|
3
|
+
AI folder lists the items of its kind the plugin ships, and the Plugins page lists the plugin
|
|
4
|
+
with its steps.
|
|
5
|
+
|
|
6
|
+
# Settings lists every plugin that was added; the package and what the plugin ships are on its own page.
|
|
7
|
+
Scenario: Settings lists the plugin, and its own page names its package and what it ships
|
|
8
|
+
Given I am on "/settings"
|
|
9
|
+
Then I should see "MediaWiki"
|
|
10
|
+
When I go to "/settings/plugin/mediawiki"
|
|
11
|
+
Then I should see "@webship.co/workspace-mediawiki"
|
|
12
|
+
And I should see "cmd-mediawiki-project.sh"
|
|
13
|
+
And I should see "mediawiki-site-builder"
|
|
14
|
+
|
|
15
|
+
Scenario: A sites folder offers the MediaWiki builder
|
|
16
|
+
Given I am on "/dev"
|
|
17
|
+
Then "option[value='cmd-mediawiki-project.sh']" should be attached
|
|
18
|
+
|
|
19
|
+
# The AI folders are searched by name: with every plugin on, a folder lists more than one page of items.
|
|
20
|
+
Scenario: The AI Agents folder lists the agents the plugin ships
|
|
21
|
+
Given I am on "/ai-agents?q=mediawiki-"
|
|
22
|
+
Then I should see "mediawiki-site-builder"
|
|
23
|
+
And I should see "mediawiki-tester"
|
|
24
|
+
|
|
25
|
+
Scenario: The AI Skills folder lists the skill the plugin ships
|
|
26
|
+
Given I am on "/ai-skills?q=mediawiki-scenarios"
|
|
27
|
+
Then I should see "mediawiki-scenarios"
|
|
28
|
+
|
|
29
|
+
Scenario: The AI Commands folder lists the command the plugin ships
|
|
30
|
+
Given I am on "/ai-commands?q=mediawiki-test"
|
|
31
|
+
Then I should see "mediawiki-test"
|
|
32
|
+
|
|
33
|
+
Scenario: The AI Prompts folder lists the prompts the plugin ships
|
|
34
|
+
Given I am on "/ai-prompts?q=mediawiki-"
|
|
35
|
+
Then I should see "mediawiki-build-and-test"
|
|
36
|
+
And I should see "mediawiki-scenarios-for-an-area"
|
package/package.json
CHANGED
|
@@ -1,6 +1,99 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webship.co/workspace-mediawiki",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "MediaWiki for Webship Workspace: the builder (`cmd-mediawiki-project.sh`, the release tarball installed by its own installer, with the visual editor on request) and the maintenance tool in every sites folder, the default accounts, the MediaWiki step pack wired into the testing setup, and its AI items in their folders: two agents, a skill, a command and two prompts.",
|
|
5
|
+
"main": "dist/src/index.js",
|
|
6
|
+
"types": "dist/src/index.d.ts",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/webship/workspace-mediawiki.git"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist/src",
|
|
14
|
+
"ai",
|
|
15
|
+
"commands",
|
|
16
|
+
"features",
|
|
17
|
+
"scripts",
|
|
18
|
+
"testing",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc -p tsconfig.json",
|
|
23
|
+
"prepare": "npm run build",
|
|
24
|
+
"test": "npm run build && node --test dist/tests/*.test.js",
|
|
25
|
+
"lint": "tsc -p tsconfig.json --noEmit"
|
|
26
|
+
},
|
|
27
|
+
"workspacePlugin": {
|
|
28
|
+
"name": "mediawiki",
|
|
29
|
+
"label": "MediaWiki",
|
|
30
|
+
"needs": [
|
|
31
|
+
[
|
|
32
|
+
"dev",
|
|
33
|
+
"test",
|
|
34
|
+
"sandboxes",
|
|
35
|
+
"demos"
|
|
36
|
+
],
|
|
37
|
+
"ai-agents",
|
|
38
|
+
"ai-skills",
|
|
39
|
+
"ai-commands",
|
|
40
|
+
"ai-prompts"
|
|
41
|
+
],
|
|
42
|
+
"commands": {
|
|
43
|
+
"types": [
|
|
44
|
+
"sites"
|
|
45
|
+
],
|
|
46
|
+
"workspaces": [
|
|
47
|
+
"dev",
|
|
48
|
+
"test",
|
|
49
|
+
"sandboxes",
|
|
50
|
+
"demos"
|
|
51
|
+
],
|
|
52
|
+
"files": [
|
|
53
|
+
"commands/cmd-mediawiki-project.sh",
|
|
54
|
+
"commands/cmd-tools-mediawiki-maintenance.sh"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"functions": [
|
|
59
|
+
"scripts/functions/fun-mediawiki.sh"
|
|
60
|
+
],
|
|
61
|
+
"args": [
|
|
62
|
+
"scripts/args/arg-mediawiki.sh",
|
|
63
|
+
"scripts/args/arg-mediawiki-maintenance.sh"
|
|
64
|
+
],
|
|
65
|
+
"machine": [
|
|
66
|
+
"testing/site.feature"
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"ai": {
|
|
70
|
+
"agents": [
|
|
71
|
+
"ai/agents/mediawiki-site-builder.md",
|
|
72
|
+
"ai/agents/mediawiki-tester.md"
|
|
73
|
+
],
|
|
74
|
+
"skills": [
|
|
75
|
+
"ai/skills/mediawiki-scenarios"
|
|
76
|
+
],
|
|
77
|
+
"commands": [
|
|
78
|
+
"ai/commands/mediawiki-test.md"
|
|
79
|
+
],
|
|
80
|
+
"prompts": [
|
|
81
|
+
"ai/prompts/mediawiki-build-and-test.md",
|
|
82
|
+
"ai/prompts/mediawiki-scenarios-for-an-area.md"
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
"features": [
|
|
86
|
+
"features/mediawiki.feature",
|
|
87
|
+
"features/mediawiki-runtimes.feature"
|
|
88
|
+
],
|
|
89
|
+
"featuresSite": "cmd-mediawiki-project.sh ci-mediawiki --install --add-users --runtime docker"
|
|
90
|
+
},
|
|
91
|
+
"devDependencies": {
|
|
92
|
+
"@types/node": "^24.0.0",
|
|
93
|
+
"@webship.co/workspace-plugin-api": "^1.0.11",
|
|
94
|
+
"typescript": "^5.9.0"
|
|
95
|
+
},
|
|
96
|
+
"publishConfig": {
|
|
97
|
+
"access": "public"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
argparse "$@" <<ARGEOF || exit 1
|
|
4
|
+
parser.add_argument('PROJECT_NAME',
|
|
5
|
+
help='The MediaWiki project in this workspace.')
|
|
6
|
+
parser.add_argument('-r', '--run',
|
|
7
|
+
default="_none_",
|
|
8
|
+
help='A maintenance script to run in the wiki, with its arguments, as maintenance/run.php takes it. Example: --run "showJobs --group"')
|
|
9
|
+
parser.add_argument('-u', '--update',
|
|
10
|
+
action='store_true',
|
|
11
|
+
default=False,
|
|
12
|
+
help='Run the database updates of the wiki (update --quick), after a new release or a new extension.')
|
|
13
|
+
parser.add_argument('-j', '--jobs',
|
|
14
|
+
action='store_true',
|
|
15
|
+
default=False,
|
|
16
|
+
help='Run the jobs that are waiting in the job queue now.')
|
|
17
|
+
parser.add_argument('-a', '--add-users',
|
|
18
|
+
action='store_true',
|
|
19
|
+
default=False,
|
|
20
|
+
help='Add the default accounts. An account that is already there gets its password, groups and address back, and a block on it is lifted.')
|
|
21
|
+
parser.add_argument('-c', '--cancel-users',
|
|
22
|
+
action='store_true',
|
|
23
|
+
default=False,
|
|
24
|
+
help='Cancel the default accounts: a wiki keeps every account, so each is blocked without end and gets a random password.')
|
|
25
|
+
ARGEOF
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
argparse "$@" <<ARGEOF || exit 1
|
|
4
|
+
parser.add_argument('PROJECT_NAME',
|
|
5
|
+
help='The name of the project: its folder, and its name on the container runtime (on DDEV its host name too).')
|
|
6
|
+
parser.add_argument('--runtime',
|
|
7
|
+
dest='RUNTIME',
|
|
8
|
+
default="_none_",
|
|
9
|
+
choices=['ddev', 'docker', 'podman', 'kubernetes'],
|
|
10
|
+
help='The container runtime to build on: ddev (the default, or container.runtime of settings.yml), docker (Docker Compose), podman or kubernetes.')
|
|
11
|
+
parser.add_argument('-i', '--install',
|
|
12
|
+
action='store_true',
|
|
13
|
+
default=False,
|
|
14
|
+
help='Install the wiki with its own installer on the container database; the workspace account is its first account.')
|
|
15
|
+
parser.add_argument('-a', '--add-users',
|
|
16
|
+
action='store_true',
|
|
17
|
+
default=False,
|
|
18
|
+
help='With --install, add the default accounts (administrator, editor, reader): the ones the test scenarios log in as.')
|
|
19
|
+
parser.add_argument('-v', '--visual-editor',
|
|
20
|
+
action='store_true',
|
|
21
|
+
default=False,
|
|
22
|
+
help='Turn the visual editor on (VisualEditor, with Parsoid from core), beside WikiEditor, CategoryTree and Cite.')
|
|
23
|
+
parser.add_argument('-m', '--mediawiki-version',
|
|
24
|
+
default="",
|
|
25
|
+
help='The release to install, from releases.wikimedia.org; empty means the current stable release. Example: --mediawiki-version 1.43.11')
|
|
26
|
+
parser.add_argument('-l', '--launch',
|
|
27
|
+
action='store_true',
|
|
28
|
+
default=False,
|
|
29
|
+
help='Open the wiki in a browser when it is ready.')
|
|
30
|
+
parser.add_argument('--php-version',
|
|
31
|
+
default="",
|
|
32
|
+
choices=['8.4', '8.3'],
|
|
33
|
+
help='PHP version for the project container; empty means the default of the container tool. Example: --php-version 8.4')
|
|
34
|
+
ARGEOF
|