@webship.co/workspace-joomla 1.0.7 → 1.0.9
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 +71 -18
- package/{agents → ai/agents}/joomla-site-builder.md +8 -0
- package/{agents → ai/agents}/joomla-tester.md +19 -5
- package/ai/commands/joomla-test.md +91 -0
- package/ai/prompts/joomla-build-and-test.md +27 -0
- package/ai/skills/joomla-scenarios/SKILL.md +232 -0
- package/ai/skills/joomla-scenarios/examples/article-lifecycle.feature +36 -0
- package/ai/skills/joomla-scenarios/examples/groups-and-pages.feature +41 -0
- package/ai/skills/joomla-scenarios/examples/site-and-search.feature +33 -0
- package/dist/src/index.d.ts +10 -2
- package/dist/src/index.js +13 -3
- package/dist/src/index.js.map +1 -1
- package/docs/plugin-items-pattern.md +150 -0
- package/features/joomla.feature +15 -2
- package/package.json +27 -5
- package/scripts/functions/fun-joomla.sh +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Joomla for the [Webship Workspace](https://github.com/webship/workspace) dashboard: a builder
|
|
4
4
|
that makes a real Joomla site in a container, a Joomla CLI tool for the sites it built, the default
|
|
5
5
|
accounts, the [Joomla step pack](https://github.com/webship/joomla-steps) wired into the
|
|
6
|
-
workspace's testing setup, and
|
|
6
|
+
workspace's testing setup, and its AI items — two agents, a skill, a command and a prompt —
|
|
7
|
+
each listed in the workspace folder of its kind.
|
|
7
8
|
|
|
8
9
|
The workspace is container-based (DDEV by default): a Joomla project is a row like any other, so
|
|
9
10
|
the row menus the core draws (start, stop, launch, backup, clone, remove, tests) work on it unchanged.
|
|
@@ -17,19 +18,46 @@ It is made from the reference platform plugin,
|
|
|
17
18
|
cd ~/workspace
|
|
18
19
|
bash core/scripts/plugins.sh --require github:webship/workspace-joomla # npm install into the dashboard
|
|
19
20
|
bash core/scripts/plugins.sh --activate joomla # plugins.joomla in settings.yml
|
|
20
|
-
bash core/scripts/plugins.sh --install joomla # commands, functions, args,
|
|
21
|
+
bash core/scripts/plugins.sh --install joomla # commands, functions, args, AI items
|
|
21
22
|
bash core/scripts/plugins.sh --configure joomla # nothing to configure: it has no settings file
|
|
22
23
|
```
|
|
23
24
|
|
|
24
25
|
The same four steps are buttons on the dashboard's **Settings → Plugins** page. `--install` is
|
|
25
|
-
idempotent. `--uninstall` removes what it placed; an
|
|
26
|
+
idempotent. `--uninstall` removes what it placed; an AI item you edited stays.
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
Everything the plugin carries lands in the folder it belongs to, when that folder is an active
|
|
29
|
+
workspace folder:
|
|
30
|
+
|
|
31
|
+
| What | Lands in |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| `cmd-joomla-project.sh`, `cmd-tools-joomla-cli.sh` | every active sites folder: `dev/`, `test/`, `sandboxes/`, `demos/` |
|
|
34
|
+
| The agents `joomla-site-builder`, `joomla-tester` | `ai-agents/` |
|
|
35
|
+
| The skill `joomla-scenarios` | `ai-skills/` |
|
|
36
|
+
| The command `/joomla-test` | `ai-commands/` |
|
|
37
|
+
| The prompt `joomla-build-and-test` | `ai-prompts/` |
|
|
38
|
+
|
|
39
|
+
There they are listed like any other item of the folder, and installed into Claude Code from there.
|
|
30
40
|
|
|
31
41
|
It needs a Webship Workspace 1.0.7 or later.
|
|
32
42
|
|
|
43
|
+
## What it needs
|
|
44
|
+
|
|
45
|
+
A workspace starts empty, so the manifest says what else this plugin needs (`needs`):
|
|
46
|
+
|
|
47
|
+
- 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.
|
|
48
|
+
- `ai-agents`, `ai-skills`, `ai-commands` and `ai-prompts`: the AI folders its agents, its skill, its command and its prompt are placed in.
|
|
49
|
+
|
|
50
|
+
`--require` says so, `--activate` and `--install` stop until the workspace has them, and `--with-needs` adds what is missing first:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
bash core/scripts/plugins.sh --activate joomla --with-needs # dev and the four AI folders are required, activated and installed first
|
|
54
|
+
bash core/scripts/plugins.sh --install joomla
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Everything the builder runs for a site runs in the site's own container, through the container tool the workspace already needs; the plugin asks for no command of its own on the machine.
|
|
58
|
+
|
|
59
|
+
A workspace that knows none of this (Webship Workspace 1.0.8 and older) ignores the keys: add a sites folder and the AI folders yourself, then `--install joomla` again. A kind whose folder is not there is skipped, and the install says so.
|
|
60
|
+
|
|
33
61
|
## What the package holds
|
|
34
62
|
|
|
35
63
|
| Path | What it is |
|
|
@@ -39,8 +67,12 @@ It needs a Webship Workspace 1.0.7 or later.
|
|
|
39
67
|
| `scripts/functions/fun-joomla.sh` | The bash functions behind both, sourced by bootstrap once installed; the names the core's tools look for (`set_joomla_users`, `add_joomla_users`, `cancel_joomla_users`, `testing_configure_joomla`) |
|
|
40
68
|
| `scripts/args/arg-joomla.sh`, `arg-joomla-cli.sh` | Their argparse; the Build form draws the builder's flags from the first |
|
|
41
69
|
| `testing/site.feature` | The first feature a Joomla project gets when testing is set up |
|
|
42
|
-
| `agents/joomla-site-builder.md` | The agent that builds and maintains Joomla sites with these commands |
|
|
43
|
-
| `agents/joomla-tester.md` | The agent that writes and runs scenarios with the Joomla step pack |
|
|
70
|
+
| `ai/agents/joomla-site-builder.md` | The agent that builds and maintains Joomla sites with these commands |
|
|
71
|
+
| `ai/agents/joomla-tester.md` | The agent that writes and runs scenarios with the Joomla step pack |
|
|
72
|
+
| `ai/skills/joomla-scenarios/` | The skill: the step pack's phrases by area, the traps found on a real site, three example features |
|
|
73
|
+
| `ai/commands/joomla-test.md` | The slash command `/joomla-test <site>`: set up, match every step, run, report |
|
|
74
|
+
| `ai/prompts/joomla-build-and-test.md` | The prompt: a whole launch command for a new session |
|
|
75
|
+
| `docs/plugin-items-pattern.md` | How a plugin carries its own commands and AI items, and how to prove it |
|
|
44
76
|
| `src/index.ts` | `register(api)`: what the assistant is told about Joomla here |
|
|
45
77
|
| `features/joomla.feature` | Scenarios for the dashboard's own browser suite |
|
|
46
78
|
|
|
@@ -121,25 +153,46 @@ webship-js's own, writes the users registry (the handles above, overridable with
|
|
|
121
153
|
project has none, and makes sure the default accounts are on the site. Run it again and it adds what
|
|
122
154
|
is missing and keeps what you changed.
|
|
123
155
|
|
|
124
|
-
## The
|
|
156
|
+
## The AI items
|
|
125
157
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
| `joomla-site-builder` | Build, update, maintain or remove a Joomla site with the commands above, in containers only |
|
|
129
|
-
| `joomla-tester` | Set the testing stack up, look at the site 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 |
|
|
158
|
+
`ai/` in the package holds one folder per kind, the manifest's `ai` block names each item, and
|
|
159
|
+
`--install` places it in the workspace folder of that kind.
|
|
130
160
|
|
|
131
|
-
|
|
132
|
-
|
|
161
|
+
| Kind | Item | Use it to |
|
|
162
|
+
| --- | --- | --- |
|
|
163
|
+
| Agent | `joomla-site-builder` | Build, update, maintain or remove a Joomla site with the commands above, in containers only |
|
|
164
|
+
| Agent | `joomla-tester` | Set the testing stack up, look at the site 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 |
|
|
165
|
+
| Skill | `joomla-scenarios` | Write a scenario from phrases that exist: the pack's steps by area (the administrator, lists and content, users and groups, the public site, search), the handles of the users registry, the traps found on a real site, and three features that pass on a fresh site |
|
|
166
|
+
| Command | `/joomla-test <site> [feature or @tag]` | Run the suite of a site from inside a session: set up when missing, match every step, run, report what failed and why |
|
|
167
|
+
| Prompt | `joomla-build-and-test` | Start a session that builds a site with the sample data, says what it is, sets the testing stack up and runs the first feature |
|
|
168
|
+
|
|
169
|
+
After `--install` each is in its folder on the dashboard. **Install** there puts an agent, a skill
|
|
170
|
+
or a command into Claude Code (`~/.claude/agents`, `~/.claude/skills`, `~/.claude/commands`), or
|
|
171
|
+
from the command line:
|
|
133
172
|
|
|
134
173
|
```bash
|
|
135
|
-
cd ~/workspace/ai-agents
|
|
136
|
-
bash cmd-tools-ai-items.sh joomla-
|
|
174
|
+
cd ~/workspace/ai-agents && bash cmd-tools-ai-items.sh joomla-tester --install
|
|
175
|
+
cd ~/workspace/ai-skills && bash cmd-tools-ai-items.sh joomla-scenarios --install
|
|
176
|
+
cd ~/workspace/ai-commands && bash cmd-tools-ai-items.sh joomla-test --install
|
|
137
177
|
```
|
|
138
178
|
|
|
179
|
+
A prompt is not installed: it is the whole `claude …` launch command of a new session, and the
|
|
180
|
+
dashboard's **New screen** form lists it as a template. By hand, fill the placeholders in and run
|
|
181
|
+
the command of the file from the folder it names.
|
|
182
|
+
|
|
183
|
+
The items are written for any AI CLI, with Claude Code as the default shape: the frontmatter and
|
|
184
|
+
the file layout are Claude Code's, the body of each item is plain Markdown that names no tool or
|
|
185
|
+
feature of one CLI, a command says in words what its arguments are, and the text between the
|
|
186
|
+
triple quotes of a prompt can be given to another AI CLI as it is.
|
|
187
|
+
|
|
188
|
+
Every step phrase the items show is checked against the definitions of the step pack and of
|
|
189
|
+
webship-js (`tests/fixtures/step-definitions.txt`), and every command and flag against the
|
|
190
|
+
plugin's own. The shape is the reference's: [`docs/plugin-items-pattern.md`](docs/plugin-items-pattern.md).
|
|
191
|
+
|
|
139
192
|
## Develop it
|
|
140
193
|
|
|
141
194
|
```bash
|
|
142
195
|
npm install # builds dist/ (TypeScript)
|
|
143
196
|
npm run lint
|
|
144
|
-
npm test # the manifest, the commands, the
|
|
197
|
+
npm test # the manifest, the commands, the AI items, the functions against a scaffolded project
|
|
145
198
|
```
|
|
@@ -103,3 +103,11 @@ stack, with the Joomla step pack).
|
|
|
103
103
|
| The site search finds nothing | The Smart Search index is empty: `--run "finder:index"`. |
|
|
104
104
|
| **Add the test users** in the row's Users menu adds no Joomla account | The menu reads the DDEV project type, and a Joomla project is a `php` project. Use `bash cmd-tools-joomla-cli.sh <name> --add-users` or `bash cmd-tools-add-users.sh <name> joomla`. |
|
|
105
105
|
| `is not a Joomla project` from the CLI tool | The project's docroot has no `cli/joomla.php`: it was not built by this builder. |
|
|
106
|
+
|
|
107
|
+
## What comes with you
|
|
108
|
+
|
|
109
|
+
The Joomla plugin places these beside you, each in the workspace folder of its kind: the agent
|
|
110
|
+
`joomla-tester` (`ai-agents/`), the skill `joomla-scenarios` (`ai-skills/`), the command
|
|
111
|
+
`/joomla-test <site>` (`ai-commands/`) and the prompt `joomla-build-and-test` (`ai-prompts/`),
|
|
112
|
+
which is this agent's whole first job as a launch command: build, say what the site is, set the
|
|
113
|
+
testing stack up, run the first feature.
|
|
@@ -20,8 +20,8 @@ tools:
|
|
|
20
20
|
|
|
21
21
|
# joomla-tester
|
|
22
22
|
|
|
23
|
-
You test Joomla sites in a Webship Workspace (`~/workspace`)
|
|
24
|
-
[webship-js](https://github.com/webship/webship-js) (Playwright and Cucumber) and its Joomla step
|
|
23
|
+
You test Joomla sites 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 Joomla step
|
|
25
25
|
pack, [`@webship-js/joomla-steps`](https://github.com/webship/joomla-steps). The suite lives in
|
|
26
26
|
the project (`cucumber.js`, `tests/features/`, `tests/step-definitions/`) and runs in the project's
|
|
27
27
|
container.
|
|
@@ -69,10 +69,12 @@ A scenario logs in by a **handle** of the users registry (`worldParameters.users
|
|
|
69
69
|
The site and the administrator have a login each, and a step for each:
|
|
70
70
|
|
|
71
71
|
```gherkin
|
|
72
|
-
Given I am a logged in user with the "manager" user
|
|
73
|
-
Given I am logged in to the site with the "member" user
|
|
72
|
+
Given I am a logged in user with the "manager" user
|
|
73
|
+
Given I am logged in to the site with the "member" user
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
+
The first is the administrator's login, the second the site's.
|
|
77
|
+
|
|
76
78
|
| Handle | Account | User group | Logs in to |
|
|
77
79
|
| --- | --- | --- | --- |
|
|
78
80
|
| `admin` | `administrator` | Super Users | the administrator and the site |
|
|
@@ -97,7 +99,9 @@ account's username, not the handle.
|
|
|
97
99
|
- **No password in a feature file**, except where a wrong password is the subject of the scenario.
|
|
98
100
|
- **No platform name in a step phrase.** A step says what a person does or sees: `I am on the login
|
|
99
101
|
page`, `I should see the administrator dashboard`, `I go to the administrator "Users" page`. Never
|
|
100
|
-
a phrase with the platform's name in it
|
|
102
|
+
a phrase with the platform's name in it: the name is a value where a step needs it (`the page
|
|
103
|
+
generator should contain "Joomla"`, `the CMS version should start with "<version>"`). The same
|
|
104
|
+
holds for a custom step you write.
|
|
101
105
|
- **No CSS selector and no address in a scenario when a step of the pack says it.** `the
|
|
102
106
|
administrator "Users" page`, not `/administrator/index.php?option=com_users`.
|
|
103
107
|
- **A custom step is the last resort.** Look in the pack and in webship-js first. If one is really
|
|
@@ -124,3 +128,13 @@ Feature: A manager looks after the articles
|
|
|
124
128
|
|
|
125
129
|
Check every phrase against the installed definitions before you run it: the pack moves, and a phrase
|
|
126
130
|
from memory is a guess.
|
|
131
|
+
|
|
132
|
+
## What comes with you
|
|
133
|
+
|
|
134
|
+
The Joomla plugin places these beside you, each in the workspace folder of its kind:
|
|
135
|
+
|
|
136
|
+
| Item | Where | What it is for |
|
|
137
|
+
| --- | --- | --- |
|
|
138
|
+
| `joomla-scenarios` (skill) | `ai-skills/` | The pack's phrases by area, the traps found on a real site, and three example features that pass on a fresh site |
|
|
139
|
+
| `/joomla-test <site>` (command) | `ai-commands/` | The run itself: set up when missing, match every step, run, report |
|
|
140
|
+
| `joomla-build-and-test` (prompt) | `ai-prompts/` | A new session that builds a site and runs its first feature |
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Test a Joomla site of the Webship Workspace with webship-js and the Joomla 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 site's container, and report what failed and why.
|
|
3
|
+
argument-hint: '<site> [tests/features/<name>.feature | @tag]'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /joomla-test
|
|
7
|
+
|
|
8
|
+
Test the Joomla site 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 site, then, if anything, one feature path or one
|
|
12
|
+
tag.
|
|
13
|
+
|
|
14
|
+
The first word is the site (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
|
|
16
|
+
folder of features), a word that starts with `@` is a tag expression. With nothing after the site,
|
|
17
|
+
the whole suite runs. With no site at all, stop and ask for one: list the candidates with
|
|
18
|
+
`ls ~/workspace/*/*/public/cli/joomla.php`.
|
|
19
|
+
|
|
20
|
+
The workspace is container-based (DDEV by default) and everything below runs in the site's
|
|
21
|
+
container through the workspace's own command. Never run `npx cucumber-js`, `npx playwright`,
|
|
22
|
+
`php`, `composer` or `npm` on the host for a site.
|
|
23
|
+
|
|
24
|
+
## 1. Find the site
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
ls -d ~/workspace/*/<site>/.ddev/config.yaml
|
|
28
|
+
ls ~/workspace/<folder>/<site>/public/cli/joomla.php
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`<folder>` is the sites folder the site is in (`dev`, `test`, `sandboxes`, `demos`). If the
|
|
32
|
+
docroot has no `cli/joomla.php`, stop: this command is for a site built with
|
|
33
|
+
`cmd-joomla-project.sh`. If `<folder>` has no `cmd-tools-testing.sh`, stop and say that the folder
|
|
34
|
+
is not a sites folder of this workspace.
|
|
35
|
+
|
|
36
|
+
## 2. Make sure the testing stack is there
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
cd ~/workspace/<folder>
|
|
40
|
+
grep -c "@webship-js/joomla-steps" <site>/cucumber.js
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
If `cucumber.js` is missing or does not name the step pack, set the stack up (it adds what is
|
|
44
|
+
missing and keeps what was changed):
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
bash cmd-tools-testing.sh <site>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## 3. Match every step, without a browser
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
bash cmd-tools-testing.sh <site> --dry-run # the whole suite
|
|
54
|
+
bash cmd-tools-testing.sh <site> --dry-run --path tests/features/<name>.feature # one feature
|
|
55
|
+
bash cmd-tools-testing.sh <site> --dry-run --tags "@critical" # one tag
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Use the form that matches what was asked. An `Undefined` or `Ambiguous` step is a finding: name
|
|
59
|
+
the feature, the line and the phrase, show the closest phrase the pack defines
|
|
60
|
+
(`grep -hE "^(Given|When|Then)\(" <site>/node_modules/@webship-js/joomla-steps/tests/step-definitions/*.steps.js`),
|
|
61
|
+
and stop before the real run.
|
|
62
|
+
|
|
63
|
+
## 4. Run
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
bash cmd-tools-testing.sh <site> --run # the whole suite
|
|
67
|
+
bash cmd-tools-testing.sh <site> --run --path tests/features/<name>.feature # one feature
|
|
68
|
+
bash cmd-tools-testing.sh <site> --run --tags "@critical" # one tag
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Run it once. Do not add `--retry`, do not tag a scenario `@wip` and do not change a feature to
|
|
72
|
+
make the run pass.
|
|
73
|
+
|
|
74
|
+
## 5. Report
|
|
75
|
+
|
|
76
|
+
Say, in this order:
|
|
77
|
+
|
|
78
|
+
1. The site, its address (`https://<site>.ddev.site`) and what was run (suite, feature or tag).
|
|
79
|
+
2. The totals the run printed: scenarios and steps, passed and failed, and the time.
|
|
80
|
+
3. For each failed scenario: the feature and line, the step that failed, the message with its
|
|
81
|
+
`Why` and `Hint` lines, and what it means for the site — a defect of the site, a scenario that
|
|
82
|
+
asserts something the site never did (a menu item or an article of the sample data on a site
|
|
83
|
+
built without it, an account's username where the page shows its name), or the environment
|
|
84
|
+
(the site was stopped, an account is missing:
|
|
85
|
+
`bash cmd-tools-joomla-cli.sh <site> --add-users` adds the default ones).
|
|
86
|
+
4. Where the report is: `~/workspace/<folder>/<site>/tests/reports/`.
|
|
87
|
+
|
|
88
|
+
A failing suite is a result: report it as it is. Never create an account for a scenario, never
|
|
89
|
+
write a password into a feature file, and never write a platform name into a step phrase. For
|
|
90
|
+
writing or fixing scenarios, use the `joomla-scenarios` skill or hand over to the `joomla-tester`
|
|
91
|
+
agent; for changing the site, to `joomla-site-builder`.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Build a Joomla site 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 Joomla site named <name> 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 site somebody still needs
|
|
10
|
+
# nothing on the host: no php, composer, npm or mysql outside the site's container
|
|
11
|
+
|
|
12
|
+
1. bash cmd-joomla-project.sh <name> --install --add-users --sample-data
|
|
13
|
+
(add --version <x> for a release other than the latest; leave --sample-data out for an empty site)
|
|
14
|
+
if it stops because the workspace account's password is shorter than 12 characters, tell me
|
|
15
|
+
and stop: the password is mine to change (account: pass in core/config/settings.yml)
|
|
16
|
+
2. bash cmd-tools-joomla-cli.sh <name>
|
|
17
|
+
tell me the version, the address and the accounts it lists, with their groups
|
|
18
|
+
3. bash cmd-tools-testing.sh <name>
|
|
19
|
+
webship-js, the step pack, the users registry and tests/features/site.feature
|
|
20
|
+
4. bash cmd-tools-testing.sh <name> --dry-run --path tests/features/site.feature
|
|
21
|
+
5. bash cmd-tools-testing.sh <name> --run --path tests/features/site.feature
|
|
22
|
+
|
|
23
|
+
If a command fails, show the line that failed and stop. Do not retry with other flags.
|
|
24
|
+
When the feature is green: the address, the version, how many scenarios and steps passed.
|
|
25
|
+
Then ask me whether to keep the site or remove it with: bash cmd-tools-remove.sh <name>
|
|
26
|
+
"""
|
|
27
|
+
```
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: joomla-scenarios
|
|
3
|
+
description: Write and run webship-js scenarios for a Joomla site of the Webship Workspace with the Joomla step pack (`@webship-js/joomla-steps`) — the phrases of the pack by area (the administrator and its pages, lists and content, users and groups, the public site, the site login, search), the handles of the users registry, and the workspace command that runs them in the site's container. Use when asked to "write a scenario for this Joomla site", "test the manager account", "which step is there for an article", "add a feature for the search", or when a `.feature` file of a Joomla project is being written or fixed.
|
|
4
|
+
argument-hint: '<site> [what to cover]'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# joomla-scenarios
|
|
8
|
+
|
|
9
|
+
Scenarios for a Joomla site of a Webship Workspace (`~/workspace`, container-based, DDEV by
|
|
10
|
+
default), written from the steps of [`@webship-js/joomla-steps`](https://github.com/webship/joomla-steps)
|
|
11
|
+
and of [webship-js](https://github.com/webship/webship-js) itself, and run in the site's container
|
|
12
|
+
by the workspace's own command. It comes with the Joomla plugin (`@webship.co/workspace-joomla`),
|
|
13
|
+
like the builder (`cmd-joomla-project.sh`), the CLI tool (`cmd-tools-joomla-cli.sh`) and the
|
|
14
|
+
agents `joomla-site-builder` and `joomla-tester`.
|
|
15
|
+
|
|
16
|
+
## Where everything is
|
|
17
|
+
|
|
18
|
+
| What | Where |
|
|
19
|
+
| --- | --- |
|
|
20
|
+
| The site | `~/workspace/<folder>/<site>`, at `https://<site>.ddev.site`, the administrator at `/administrator` (`<folder>` is a sites folder: `dev`, `test`, `sandboxes`, `demos`) |
|
|
21
|
+
| The suite's configuration | `<site>/cucumber.js`: the step definitions it loads and the users registry (`worldParameters.users`) |
|
|
22
|
+
| The features | `<site>/tests/features/*.feature` (`site.feature` is the first one the setup wrote) |
|
|
23
|
+
| The pack's steps | `<site>/node_modules/@webship-js/joomla-steps/tests/step-definitions/*.steps.js` |
|
|
24
|
+
| webship-js's steps | `<site>/node_modules/webship-js/tests/step-definitions/*.js` |
|
|
25
|
+
| The reports | `<site>/tests/reports/` |
|
|
26
|
+
|
|
27
|
+
## The order of work
|
|
28
|
+
|
|
29
|
+
1. **Make sure the testing stack is there.** From the sites folder:
|
|
30
|
+
```bash
|
|
31
|
+
cd ~/workspace/<folder>
|
|
32
|
+
bash cmd-tools-testing.sh <site>
|
|
33
|
+
```
|
|
34
|
+
It adds webship-js, the step pack, the users registry and `tests/features/site.feature`, and
|
|
35
|
+
makes sure the default accounts are on the site. It is safe to run again: it adds what is
|
|
36
|
+
missing and keeps what was changed.
|
|
37
|
+
2. **Read the installed steps before writing a phrase.** They are the source of truth: the pack
|
|
38
|
+
moves, and a phrase from memory is a guess.
|
|
39
|
+
```bash
|
|
40
|
+
cd ~/workspace/<folder>/<site>
|
|
41
|
+
grep -hE "^(Given|When|Then)\(" node_modules/@webship-js/joomla-steps/tests/step-definitions/*.steps.js
|
|
42
|
+
```
|
|
43
|
+
Every step carries a comment block with examples above it; open the file when a phrase is not
|
|
44
|
+
obvious.
|
|
45
|
+
3. **Look at the page first** (the Playwright MCP browser, a tab of your own) when the scenario
|
|
46
|
+
is about a page you have not seen. A scenario written without having seen the page asserts
|
|
47
|
+
what you imagine.
|
|
48
|
+
4. **Write the feature** in `<site>/tests/features/`, from phrases that exist (the lists below).
|
|
49
|
+
5. **Match every step without a browser**, then run the feature, then the suite:
|
|
50
|
+
```bash
|
|
51
|
+
cd ~/workspace/<folder>
|
|
52
|
+
bash cmd-tools-testing.sh <site> --dry-run --path tests/features/<name>.feature
|
|
53
|
+
bash cmd-tools-testing.sh <site> --run --path tests/features/<name>.feature
|
|
54
|
+
bash cmd-tools-testing.sh <site> --run --tags "@critical"
|
|
55
|
+
bash cmd-tools-testing.sh <site> --run
|
|
56
|
+
```
|
|
57
|
+
A dry run says `Undefined` for a phrase no definition matches: fix the phrase, do not write a
|
|
58
|
+
step for it.
|
|
59
|
+
|
|
60
|
+
## Accounts: a handle, never a password
|
|
61
|
+
|
|
62
|
+
A scenario logs in by a handle of the users registry. The administrator and the site have a
|
|
63
|
+
login each, and a step for each. The default accounts are on the site already
|
|
64
|
+
(`bash cmd-tools-joomla-cli.sh <site> --add-users` adds them again if they were removed):
|
|
65
|
+
|
|
66
|
+
| Handle | Account | User group | Logs in to |
|
|
67
|
+
| --- | --- | --- | --- |
|
|
68
|
+
| `admin` | `administrator` | Super Users | the administrator and the site |
|
|
69
|
+
| `manager` | `manager` | Manager | the administrator and the site |
|
|
70
|
+
| `editor` | `editor` | Editor | the site |
|
|
71
|
+
| `member` | `member` | Registered | the site |
|
|
72
|
+
|
|
73
|
+
```gherkin
|
|
74
|
+
Given I am a logged in user with the "manager" user
|
|
75
|
+
Then I should see the administrator dashboard
|
|
76
|
+
Given I am logged in to the site with the "member" user
|
|
77
|
+
Then I should be logged in to the site as "member"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## The phrases, by area
|
|
81
|
+
|
|
82
|
+
Each line is a phrase the pack defines, and each one passed on a site built with
|
|
83
|
+
`bash cmd-joomla-project.sh <site> --install --add-users --sample-data` (the names in quotes are
|
|
84
|
+
that site's). Most `should` steps also take the negative: `should not see`, `should not be`,
|
|
85
|
+
`should not exist`.
|
|
86
|
+
|
|
87
|
+
### The administrator: session, pages, menu
|
|
88
|
+
|
|
89
|
+
```gherkin
|
|
90
|
+
Given I am on the administrator login page
|
|
91
|
+
Given I am a logged in user with the "manager" user
|
|
92
|
+
When I log out of the administrator panel
|
|
93
|
+
Then I should be on the administrator login page
|
|
94
|
+
Then I should see the administrator dashboard
|
|
95
|
+
Then I should be logged in to the administrator panel as "Manager"
|
|
96
|
+
Then I should see the administrator menu
|
|
97
|
+
Then I should see the administrator menu item "Content"
|
|
98
|
+
Then I should not see the administrator menu item "System"
|
|
99
|
+
When I go to the administrator "Articles" page
|
|
100
|
+
Then I should be on the administrator "Articles" page
|
|
101
|
+
Then I should see the administrator page title "Articles"
|
|
102
|
+
Then I should see the "New" toolbar button
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Lists and content
|
|
106
|
+
|
|
107
|
+
```gherkin
|
|
108
|
+
When I create an article titled "An article written by a scenario" with the text "Written by the suite."
|
|
109
|
+
Then the article "An article written by a scenario" should exist
|
|
110
|
+
Then the article "An article written by a scenario" should be published
|
|
111
|
+
When I unpublish the article "An article written by a scenario"
|
|
112
|
+
When I trash the article "An article written by a scenario"
|
|
113
|
+
Then the article "An article written by a scenario" should be trashed
|
|
114
|
+
When I delete the article "An article written by a scenario" permanently
|
|
115
|
+
When I create a category titled "A category written by a scenario"
|
|
116
|
+
When I trash the category "A category written by a scenario"
|
|
117
|
+
When I delete the category "A category written by a scenario" permanently
|
|
118
|
+
When I create a menu titled "A menu written by a scenario"
|
|
119
|
+
Then the menu "A menu written by a scenario" should exist
|
|
120
|
+
When I delete the menu "A menu written by a scenario"
|
|
121
|
+
When I search the list for "no such article anywhere"
|
|
122
|
+
Then I should see an empty list
|
|
123
|
+
Then I should see a success message
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Users, groups and the system
|
|
127
|
+
|
|
128
|
+
```gherkin
|
|
129
|
+
Then the user "manager" should exist
|
|
130
|
+
Then the user "manager" should be in the "Manager" group
|
|
131
|
+
Then the access level "Special" should include the "Manager" group
|
|
132
|
+
Then the group "Manager" should have 1 enabled user
|
|
133
|
+
When I clear all caches
|
|
134
|
+
Then there should not be checked out items
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### The public site, its login and the search
|
|
138
|
+
|
|
139
|
+
```gherkin
|
|
140
|
+
Given I am on the login page
|
|
141
|
+
Given I am on the password reset page
|
|
142
|
+
Given I am on the username reminder page
|
|
143
|
+
Given I am on the profile page
|
|
144
|
+
Then I should see the login form
|
|
145
|
+
Then I should see the password reset form
|
|
146
|
+
Then I should see the username reminder form
|
|
147
|
+
Given I am logged in to the site with the "member" user
|
|
148
|
+
When I log out of the site
|
|
149
|
+
Then I should be logged in to the site as "member"
|
|
150
|
+
Then I should not be logged in to the site
|
|
151
|
+
Then I should see the "Blog" menu item
|
|
152
|
+
When I open the "Blog" menu item
|
|
153
|
+
Then the breadcrumb should show "Home > Blog"
|
|
154
|
+
Then I should see no system messages
|
|
155
|
+
When I search the site for a word from the first article
|
|
156
|
+
Then I should see that word in the search results
|
|
157
|
+
Then I should see at least 1 search result
|
|
158
|
+
When I search the site for "nosuchwordanywhere"
|
|
159
|
+
Then I should see no search results
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
`I am an anonymous user`, `I am on the homepage`, `the page should have a title`,
|
|
163
|
+
`I should see "<text>"` and `the response status code should be 200` are webship-js's own steps;
|
|
164
|
+
its status codes, classes, landmarks and accessibility audits are used as they are and never
|
|
165
|
+
redefined for this platform.
|
|
166
|
+
|
|
167
|
+
## Traps found on a real site
|
|
168
|
+
|
|
169
|
+
- **Two logins, two steps.** `I am a logged in user with the "<handle>" user` is the
|
|
170
|
+
administrator's login, `I am logged in to the site with the "<handle>" user` the site's.
|
|
171
|
+
`editor` and `member` have no administrator: use the site's step for them.
|
|
172
|
+
- **The administrator shows the account's name, not its username.**
|
|
173
|
+
`I should be logged in to the administrator panel as "manager"` fails; the header says
|
|
174
|
+
`Manager`. The site's step (`logged in to the site as "member"`) takes the handle, and the user
|
|
175
|
+
steps (`the user "manager" should be in the "Manager" group`) take the username.
|
|
176
|
+
- **A page a group may not open answers 403**: a manager on the administrator `"Users"` page.
|
|
177
|
+
Assert the status code; the administrator menu of a manager does not list `System` either.
|
|
178
|
+
- **The breadcrumb is the whole trail**: `Home > Blog`, not `Blog`.
|
|
179
|
+
- **The search step needs a page that lists articles first.**
|
|
180
|
+
`I search the site for a word from the first article` reads the word from the page on screen:
|
|
181
|
+
open the homepage before it.
|
|
182
|
+
- **What the sample data brings is not on every site.** The `Blog` menu item, the articles and
|
|
183
|
+
the search index are there only when the site was built with `--sample-data`. A site built
|
|
184
|
+
without it has an empty front page: a scenario about them fails there.
|
|
185
|
+
- **Trashing is not deleting.** A trashed article or category is still on the site:
|
|
186
|
+
`I delete the article "<title>" permanently` after the trash step, or the next run finds it.
|
|
187
|
+
- **`I check in all items` fails when nothing is checked out.** Assert
|
|
188
|
+
`there should not be checked out items` instead, and check in only after a scenario left a
|
|
189
|
+
form open.
|
|
190
|
+
- **The version and the generator are values of a step**, not a part of its phrase:
|
|
191
|
+
`the CMS version should start with "<version>"` reads the System Information page, which is
|
|
192
|
+
for Super Users only, and `the page generator should contain "<name>"` reads the generator
|
|
193
|
+
meta tag of the page. Without an account that may open that page, read the version with
|
|
194
|
+
`bash cmd-tools-joomla-cli.sh <site>`.
|
|
195
|
+
|
|
196
|
+
## Rules
|
|
197
|
+
|
|
198
|
+
- **No account is created in a suite.** No `user:add` in a hook, no registration scenario that
|
|
199
|
+
leaves an account behind. A group the registry does not have is asked for, not made.
|
|
200
|
+
- **Never the workspace account.** The site's own Super User is not in the registry; `admin` is
|
|
201
|
+
the `administrator` default account.
|
|
202
|
+
- **No password in a feature file**, except where a wrong password is the subject.
|
|
203
|
+
- **No platform name in a step phrase**: `I am on the administrator login page`, never a phrase
|
|
204
|
+
that names the platform. The same holds for a custom step.
|
|
205
|
+
- **No selector and no address when a step says it**: `the administrator "Users" page`, not the
|
|
206
|
+
address of the page.
|
|
207
|
+
- **What a scenario creates, it removes** in the same scenario, under a title nobody else uses.
|
|
208
|
+
- **A custom step is the last resort**: look in the pack and in webship-js first, write it in
|
|
209
|
+
`<site>/tests/step-definitions/` with a comment block and examples, and say it may belong in
|
|
210
|
+
the pack.
|
|
211
|
+
- **Everything runs in the container**, through `cmd-tools-testing.sh`. Never `npx cucumber-js`
|
|
212
|
+
or `npx playwright` on the host.
|
|
213
|
+
- **A failing scenario is a result.** No `@wip`, no longer timeout, no looser assertion to turn a
|
|
214
|
+
run green: say what the site did.
|
|
215
|
+
|
|
216
|
+
## Examples that run
|
|
217
|
+
|
|
218
|
+
`examples/` holds three features that pass on a site built with
|
|
219
|
+
`bash cmd-joomla-project.sh <site> --install --add-users --sample-data`. Copy one into the suite
|
|
220
|
+
and run it:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
cp ~/workspace/ai-skills/joomla-scenarios/examples/groups-and-pages.feature ~/workspace/<folder>/<site>/tests/features/
|
|
224
|
+
cd ~/workspace/<folder>
|
|
225
|
+
bash cmd-tools-testing.sh <site> --run --path tests/features/groups-and-pages.feature
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
| Feature | What it shows |
|
|
229
|
+
| --- | --- |
|
|
230
|
+
| `examples/groups-and-pages.feature` | Each default account logging in where its group may, the menu and the pages of a manager, the groups and access levels |
|
|
231
|
+
| `examples/article-lifecycle.feature` | A manager writing, unpublishing, trashing and deleting an article; a category and a menu added and deleted |
|
|
232
|
+
| `examples/site-and-search.feature` | The menu, the breadcrumb, the account pages and the search of the public site (needs `--sample-data`) |
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Feature: A manager writes an article and removes it again
|
|
2
|
+
As a manager
|
|
3
|
+
I want to write, unpublish, trash and delete an article
|
|
4
|
+
So that the suite proves the content screens work and leaves the site as it found it
|
|
5
|
+
|
|
6
|
+
# Trashing is not deleting: the scenario deletes permanently, or the next run finds the item.
|
|
7
|
+
|
|
8
|
+
Scenario: The manager writes an article, takes it down and deletes it
|
|
9
|
+
Given I am a logged in user with the "manager" user
|
|
10
|
+
When I create an article titled "An article written by a scenario" with the text "This article is written and removed by the suite."
|
|
11
|
+
Then I should see a success message
|
|
12
|
+
And the article "An article written by a scenario" should be published
|
|
13
|
+
When I unpublish the article "An article written by a scenario"
|
|
14
|
+
Then the article "An article written by a scenario" should be unpublished
|
|
15
|
+
When I trash the article "An article written by a scenario"
|
|
16
|
+
Then the article "An article written by a scenario" should be trashed
|
|
17
|
+
When I delete the article "An article written by a scenario" permanently
|
|
18
|
+
Then the article "An article written by a scenario" should not exist
|
|
19
|
+
|
|
20
|
+
Scenario: An administrator adds a category and a menu and deletes them
|
|
21
|
+
Given I am a logged in user with the "admin" user
|
|
22
|
+
When I create a category titled "A category written by a scenario"
|
|
23
|
+
Then the category "A category written by a scenario" should exist
|
|
24
|
+
When I trash the category "A category written by a scenario"
|
|
25
|
+
And I delete the category "A category written by a scenario" permanently
|
|
26
|
+
Then the category "A category written by a scenario" should not exist
|
|
27
|
+
When I create a menu titled "A menu written by a scenario"
|
|
28
|
+
Then the menu "A menu written by a scenario" should exist
|
|
29
|
+
When I delete the menu "A menu written by a scenario"
|
|
30
|
+
Then the menu "A menu written by a scenario" should not exist
|
|
31
|
+
|
|
32
|
+
Scenario: A search of the list that finds nothing shows an empty list
|
|
33
|
+
Given I am a logged in user with the "manager" user
|
|
34
|
+
When I go to the administrator "Articles" page
|
|
35
|
+
And I search the list for "no such article anywhere"
|
|
36
|
+
Then I should see an empty list
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Feature: Each account reaches what its user group may use
|
|
2
|
+
As the owner of the site
|
|
3
|
+
I want every default account to log in where its group may and to be refused the rest
|
|
4
|
+
So that a change of permissions is caught by the suite
|
|
5
|
+
|
|
6
|
+
# The accounts are the default ones; a scenario logs in by a handle of the users registry.
|
|
7
|
+
# The administrator and the site have a login each, and a step for each.
|
|
8
|
+
|
|
9
|
+
Scenario: A manager gets the administrator, with the menu of a manager
|
|
10
|
+
Given I am a logged in user with the "manager" user
|
|
11
|
+
Then I should see the administrator dashboard
|
|
12
|
+
And I should be logged in to the administrator panel as "Manager"
|
|
13
|
+
And I should see the administrator menu item "Content"
|
|
14
|
+
And I should not see the administrator menu item "System"
|
|
15
|
+
|
|
16
|
+
Scenario: A manager opens the articles and is refused the users
|
|
17
|
+
Given I am a logged in user with the "manager" user
|
|
18
|
+
When I go to the administrator "Articles" page
|
|
19
|
+
Then the response status code should be 200
|
|
20
|
+
And I should see the "New" toolbar button
|
|
21
|
+
When I go to the administrator "Users" page
|
|
22
|
+
Then the response status code should be 403
|
|
23
|
+
|
|
24
|
+
Scenario: An editor logs in to the site and has no administrator
|
|
25
|
+
Given I am logged in to the site with the "editor" user
|
|
26
|
+
Then I should be logged in to the site as "editor"
|
|
27
|
+
Given I am on the administrator login page
|
|
28
|
+
Then I should not see the administrator dashboard
|
|
29
|
+
|
|
30
|
+
Scenario: The groups and the access levels are the ones the accounts rely on
|
|
31
|
+
Given I am a logged in user with the "admin" user
|
|
32
|
+
Then the user "manager" should be in the "Manager" group
|
|
33
|
+
And the user "member" should not be in the "Manager" group
|
|
34
|
+
And the access level "Special" should include the "Manager" group
|
|
35
|
+
And the group "Manager" should have 1 enabled user
|
|
36
|
+
|
|
37
|
+
Scenario: A visitor is asked to log in before the profile
|
|
38
|
+
Given I am not logged in
|
|
39
|
+
And I am on the profile page
|
|
40
|
+
Then I should see the login form
|
|
41
|
+
And I should not be logged in to the site
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Feature: A visitor finds their way around the site
|
|
2
|
+
As a visitor
|
|
3
|
+
I want the menu, the breadcrumb, the account pages and the search to work
|
|
4
|
+
So that a broken template or search index is caught by the suite
|
|
5
|
+
|
|
6
|
+
# For a site built with --sample-data: the "Blog" menu item, the articles and the search index
|
|
7
|
+
# come from the blog sample data. On a site built without it these scenarios fail.
|
|
8
|
+
|
|
9
|
+
Scenario: The menu leads to the blog, and the breadcrumb says where
|
|
10
|
+
Given I am an anonymous user
|
|
11
|
+
And I am on the homepage
|
|
12
|
+
Then the response status code should be 200
|
|
13
|
+
And I should see the "Blog" menu item
|
|
14
|
+
And I should see no system messages
|
|
15
|
+
When I open the "Blog" menu item
|
|
16
|
+
Then the breadcrumb should show "Home > Blog"
|
|
17
|
+
|
|
18
|
+
Scenario: The account pages are served with their forms
|
|
19
|
+
Given I am on the login page
|
|
20
|
+
Then I should see the login form
|
|
21
|
+
Given I am on the password reset page
|
|
22
|
+
Then I should see the password reset form
|
|
23
|
+
Given I am on the username reminder page
|
|
24
|
+
Then I should see the username reminder form
|
|
25
|
+
|
|
26
|
+
Scenario: The search finds a word of an article, and nothing for a word nobody wrote
|
|
27
|
+
Given I am an anonymous user
|
|
28
|
+
And I am on the homepage
|
|
29
|
+
When I search the site for a word from the first article
|
|
30
|
+
Then I should see that word in the search results
|
|
31
|
+
And I should see at least 1 search result
|
|
32
|
+
When I search the site for "nosuchwordanywhere"
|
|
33
|
+
Then I should see no search results
|
package/dist/src/index.d.ts
CHANGED
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* What the package carries is placed by the installer from the manifest: the builder and the
|
|
5
5
|
* Joomla CLI tool in the sites folders, their functions and argparse under core/scripts/plugins/joomla/,
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* its AI items (ai/ in this package) in the folder of their kind:
|
|
7
|
+
* the agents in AI Agents, the skill in AI Skills, the command in AI Commands, the prompt in AI Prompts.
|
|
8
|
+
* The dashboard needs nothing drawn for it: the builder is in the
|
|
9
|
+
* Build list because it is a cmd-*-project.sh, the row menus are the core's, the AI items are listed
|
|
8
10
|
* like any other. What register() adds is what the assistant is told.
|
|
9
11
|
*
|
|
10
12
|
* Everything the dashboard is asked for goes through `api`; this package requires nothing from the
|
|
@@ -17,6 +19,12 @@ export declare const PLATFORM = "joomla";
|
|
|
17
19
|
export declare const COMMANDS: string[];
|
|
18
20
|
/** The agents the installer places in the AI Agents folder. */
|
|
19
21
|
export declare const AGENTS: string[];
|
|
22
|
+
/** The skill the installer places in the AI Skills folder (a folder each, with its SKILL.md). */
|
|
23
|
+
export declare const SKILLS: string[];
|
|
24
|
+
/** The slash command the installer places in the AI Commands folder. */
|
|
25
|
+
export declare const AI_COMMANDS: string[];
|
|
26
|
+
/** The prompt the installer places in the AI Prompts folder: each a whole launch command for a new session. */
|
|
27
|
+
export declare const PROMPTS: string[];
|
|
20
28
|
/** What the assistant is told about Joomla in this workspace. */
|
|
21
29
|
export declare function assistantContext(): string;
|
|
22
30
|
export declare function register(api: PluginApi): void;
|
package/dist/src/index.js
CHANGED
|
@@ -4,15 +4,17 @@
|
|
|
4
4
|
*
|
|
5
5
|
* What the package carries is placed by the installer from the manifest: the builder and the
|
|
6
6
|
* Joomla CLI tool in the sites folders, their functions and argparse under core/scripts/plugins/joomla/,
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* its AI items (ai/ in this package) in the folder of their kind:
|
|
8
|
+
* the agents in AI Agents, the skill in AI Skills, the command in AI Commands, the prompt in AI Prompts.
|
|
9
|
+
* The dashboard needs nothing drawn for it: the builder is in the
|
|
10
|
+
* Build list because it is a cmd-*-project.sh, the row menus are the core's, the AI items are listed
|
|
9
11
|
* like any other. What register() adds is what the assistant is told.
|
|
10
12
|
*
|
|
11
13
|
* Everything the dashboard is asked for goes through `api`; this package requires nothing from the
|
|
12
14
|
* dashboard's own files, so it can be installed from npm and removed without a trace.
|
|
13
15
|
*/
|
|
14
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.AGENTS = exports.COMMANDS = exports.PLATFORM = void 0;
|
|
17
|
+
exports.PROMPTS = exports.AI_COMMANDS = exports.SKILLS = exports.AGENTS = exports.COMMANDS = exports.PLATFORM = void 0;
|
|
16
18
|
exports.assistantContext = assistantContext;
|
|
17
19
|
exports.register = register;
|
|
18
20
|
/** The plugin's name, which its functions and its user list are named after. */
|
|
@@ -21,6 +23,12 @@ exports.PLATFORM = 'joomla';
|
|
|
21
23
|
exports.COMMANDS = ['cmd-joomla-project.sh', 'cmd-tools-joomla-cli.sh'];
|
|
22
24
|
/** The agents the installer places in the AI Agents folder. */
|
|
23
25
|
exports.AGENTS = ['joomla-site-builder', 'joomla-tester'];
|
|
26
|
+
/** The skill the installer places in the AI Skills folder (a folder each, with its SKILL.md). */
|
|
27
|
+
exports.SKILLS = ['joomla-scenarios'];
|
|
28
|
+
/** The slash command the installer places in the AI Commands folder. */
|
|
29
|
+
exports.AI_COMMANDS = ['joomla-test'];
|
|
30
|
+
/** The prompt the installer places in the AI Prompts folder: each a whole launch command for a new session. */
|
|
31
|
+
exports.PROMPTS = ['joomla-build-and-test'];
|
|
24
32
|
/** What the assistant is told about Joomla in this workspace. */
|
|
25
33
|
function assistantContext() {
|
|
26
34
|
return [
|
|
@@ -32,6 +40,8 @@ function assistantContext() {
|
|
|
32
40
|
'`bash cmd-tools-add-users.sh <name> joomla` adds the same accounts.',
|
|
33
41
|
'`bash cmd-tools-testing.sh <name>` sets up webship-js with the Joomla step pack; `--run` runs the suite.',
|
|
34
42
|
`For Joomla work, hand over to the agents ${exports.AGENTS.map((a) => `\`${a}\``).join(' and ')}.`,
|
|
43
|
+
`The plugin also places the skill ${exports.SKILLS.map((a) => `\`${a}\``).join(', ')} (the step pack's phrases, by area) in ai-skills/,`,
|
|
44
|
+
`the command ${exports.AI_COMMANDS.map((a) => `\`/${a} <site>\``).join(', ')} in ai-commands/ and the prompt ${exports.PROMPTS.map((a) => `\`${a}\``).join(' and ')} in ai-prompts/.`,
|
|
35
45
|
'Never run php, composer, npm or mysql on the host for a project.',
|
|
36
46
|
].join(' ');
|
|
37
47
|
}
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAuBH,4CAcC;AAED,4BAEC;AArCD,gFAAgF;AACnE,QAAA,QAAQ,GAAG,QAAQ,CAAC;AAEjC,+DAA+D;AAClD,QAAA,QAAQ,GAAG,CAAC,uBAAuB,EAAE,yBAAyB,CAAC,CAAC;AAE7E,+DAA+D;AAClD,QAAA,MAAM,GAAG,CAAC,qBAAqB,EAAE,eAAe,CAAC,CAAC;AAE/D,iGAAiG;AACpF,QAAA,MAAM,GAAG,CAAC,kBAAkB,CAAC,CAAC;AAE3C,wEAAwE;AAC3D,QAAA,WAAW,GAAG,CAAC,aAAa,CAAC,CAAC;AAE3C,+GAA+G;AAClG,QAAA,OAAO,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAEjD,iEAAiE;AACjE,SAAgB,gBAAgB;IAC9B,OAAO;QACL,8EAA8E;QAC9E,8GAA8G;QAC9G,6GAA6G;QAC7G,8HAA8H;QAC9H,yHAAyH;QACzH,qEAAqE;QACrE,0GAA0G;QAC1G,4CAA4C,cAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG;QAC1F,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,mCAAmC,eAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB;QACrK,kEAAkE;KACnE,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,150 @@
|
|
|
1
|
+
# A plugin carries its own items
|
|
2
|
+
|
|
3
|
+
Every `@webship.co/workspace-<name>` plugin manages what belongs to it: its `cmd-*.sh` commands and
|
|
4
|
+
its AI items (agents, skills, commands, prompts). The package holds them, the manifest names them,
|
|
5
|
+
and `plugins.sh --install <name>` lists each one in the workspace folder of its kind, when that
|
|
6
|
+
folder is an active workspace folder. `--uninstall` takes them away again. The reference is
|
|
7
|
+
[`@webship.co/workspace-wordpress`](https://github.com/webship/workspace-wordpress), and this plugin
|
|
8
|
+
follows it; below, `<p>` is the plugin's name.
|
|
9
|
+
|
|
10
|
+
## The layout
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
commands/cmd-<p>-project.sh cmd-*.sh scripts only: builders and tools, placed in workspace folders
|
|
14
|
+
commands/cmd-tools-<p>-cli.sh
|
|
15
|
+
ai/agents/<p>-<role>.md one file per agent
|
|
16
|
+
ai/skills/<p>-<topic>/SKILL.md one folder per skill; every file in it is placed (examples/, references/)
|
|
17
|
+
ai/commands/<p>-<verb>.md one file per slash command
|
|
18
|
+
ai/prompts/<p>-<task>.md one file per prompt
|
|
19
|
+
tests/items.test.ts the shape of every item, and that it names nothing that does not exist
|
|
20
|
+
tests/fixtures/step-definitions.txt the step definitions the items' phrases are checked against (a plugin with a step pack)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`commands/` is taken by the `cmd-*.sh` scripts, so the AI items live under `ai/`, one folder per
|
|
24
|
+
kind, named like the manifest's `ai` keys. The installer places an item by the last part of its
|
|
25
|
+
path, whatever folder the package keeps it in, so a plugin that kept its agents in `agents/` moves
|
|
26
|
+
them with `git mv agents ai/agents` and changes two lines of its manifest.
|
|
27
|
+
|
|
28
|
+
## The manifest
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
"files": ["dist/src", "ai", "commands", "docs", "features", "scripts", "testing", "README.md"],
|
|
32
|
+
"workspacePlugin": {
|
|
33
|
+
"name": "<p>",
|
|
34
|
+
"needs": [["dev", "test", "sandboxes", "demos"], "ai-agents", "ai-skills", "ai-commands", "ai-prompts"],
|
|
35
|
+
"commands": { "types": ["sites"], "workspaces": ["dev", "test", "sandboxes", "demos"],
|
|
36
|
+
"files": ["commands/cmd-<p>-project.sh", "commands/cmd-tools-<p>-cli.sh"] },
|
|
37
|
+
"ai": {
|
|
38
|
+
"agents": ["ai/agents/<p>-site-builder.md", "ai/agents/<p>-tester.md"],
|
|
39
|
+
"skills": ["ai/skills/<p>-scenarios"],
|
|
40
|
+
"commands": ["ai/commands/<p>-test.md"],
|
|
41
|
+
"prompts": ["ai/prompts/<p>-build-and-test.md"]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- `ai` is in `files`, or the items are not in the published package.
|
|
47
|
+
- A skill is named by its folder, with no `/SKILL.md` and no trailing slash.
|
|
48
|
+
- `needs` names the folder of every kind the plugin ships, after the folder its commands need. A
|
|
49
|
+
plugin with no `cmd-*.sh` for a sites folder leaves the first entry out; a kind it does not ship
|
|
50
|
+
is left out of `ai` and of `needs`.
|
|
51
|
+
|
|
52
|
+
| Kind | Lands in | Claude Code reads it from |
|
|
53
|
+
| --- | --- | --- |
|
|
54
|
+
| `commands.files` | every active folder `commands.workspaces` names, else every active folder of `commands.types` | the folder itself: `bash cmd-….sh` |
|
|
55
|
+
| `ai.agents` | `ai-agents/<name>.md` | `~/.claude/agents`, after Install |
|
|
56
|
+
| `ai.skills` | `ai-skills/<name>/` | `~/.claude/skills`, after Install |
|
|
57
|
+
| `ai.commands` | `ai-commands/<name>.md` | `~/.claude/commands`, after Install: `/<name>` |
|
|
58
|
+
| `ai.prompts` | `ai-prompts/<name>.md` | nothing: the New screen form lists it as a template for a new session |
|
|
59
|
+
|
|
60
|
+
## The shape of each kind
|
|
61
|
+
|
|
62
|
+
| Kind | Shape |
|
|
63
|
+
| --- | --- |
|
|
64
|
+
| Agent | Frontmatter `name` (the file's name), `description` (when to use it, with the phrases a person says), `model: fable`, `tools`; then what it does, the commands it runs, its rules |
|
|
65
|
+
| Skill | `SKILL.md` with frontmatter `name` (the folder's name) and `description` (what it does, then `Use when …`); files beside it for what is too long or is meant to be copied |
|
|
66
|
+
| Command | Frontmatter `description` and `argument-hint`, no `name` (the file names it); the body reads what was typed from `$ARGUMENTS` |
|
|
67
|
+
| Prompt | No frontmatter. One sentence that says what it is for, then a fenced block holding the whole launch command: `claude --permission-mode bypassPermissions """` … `"""`, with `<placeholders>` to fill in and a `#` line that says where it runs |
|
|
68
|
+
|
|
69
|
+
Names start with the plugin's name (`<p>-…`): an item that is already in the folder under the same
|
|
70
|
+
name is kept, so a name another plugin could also choose would never be placed. A command and a
|
|
71
|
+
prompt never share a name: both end in `~/.claude/commands`.
|
|
72
|
+
|
|
73
|
+
## What an item may say
|
|
74
|
+
|
|
75
|
+
Nothing generic and nothing invented. An item is about what this plugin does in the workspace, and
|
|
76
|
+
every command, flag, path and step phrase in it exists:
|
|
77
|
+
|
|
78
|
+
- commands and flags: the plugin's own (`scripts/args/*.sh`) and the workspace's (`cmd-tools-testing.sh`
|
|
79
|
+
and its flags, `cmd-tools-remove.sh`, `cmd-tools-clone.sh --to`, `cmd-tools-ai-items.sh --install`);
|
|
80
|
+
- step phrases: the plugin's step pack and webship-js, as installed in a real project;
|
|
81
|
+
- the body is for any AI CLI, Claude Code being the default shape: plain Markdown ("run this
|
|
82
|
+
command", "read this file", "the AI assistant") that names no tool or feature of one CLI; the
|
|
83
|
+
frontmatter and a prompt's `claude …` launch line stay, with one line saying that the text between
|
|
84
|
+
the quotes can be given to another AI CLI as it is; a command keeps `$ARGUMENTS` and says in
|
|
85
|
+
words what the arguments are;
|
|
86
|
+
- the workspace is container-based (DDEV by default); no platform name in a step phrase; no
|
|
87
|
+
account created by a scenario; no password, no personal path, addresses at `example.com`.
|
|
88
|
+
|
|
89
|
+
Run every command an item tells its reader to run, and every scenario it shows, on a real site
|
|
90
|
+
before it is pushed. Two of the three example features of the reference failed on their first real
|
|
91
|
+
run, each on a phrase that exists and matched in a dry run.
|
|
92
|
+
|
|
93
|
+
## The tests to copy
|
|
94
|
+
|
|
95
|
+
`tests/items.test.ts` checks, with no site and no network:
|
|
96
|
+
|
|
97
|
+
1. the manifest: one list per kind, each item under `ai/<kind>/`, in the package, named `<p>-…`,
|
|
98
|
+
`ai` in `files`, the folder of each kind in `needs`, no command and prompt of the same name;
|
|
99
|
+
2. the shape of each kind (the table above; the two expressions the dashboard reads a prompt with);
|
|
100
|
+
3. every `cmd-*.sh` an item names is the plugin's or the workspace's, with flags that exist;
|
|
101
|
+
4. every step in a `gherkin` block or a `.feature` file matches a definition in
|
|
102
|
+
`tests/fixtures/step-definitions.txt`, names no platform and carries no password;
|
|
103
|
+
5. the words: container-based, no personal value, the README lists every item.
|
|
104
|
+
|
|
105
|
+
Refresh the fixture from a project whose testing stack is set up, whenever the pack's release
|
|
106
|
+
line changes (`<pack>` is the plugin's step pack):
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
cd ~/workspace/<folder>/<site>
|
|
110
|
+
{ echo "# <pack> <version> and webship-js <version>" ;
|
|
111
|
+
grep -hE "^(Given|When|Then)\(/" node_modules/<pack>/tests/step-definitions/*.steps.js node_modules/webship-js/tests/step-definitions/*.steps.js \
|
|
112
|
+
| sed -nE 's/^(Given|When|Then)\(\/(.*)\/, (\{[^}]*\}, )?(async )?function.*/\2/p' | sort -u ; } > step-definitions.txt
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`tests/needs.test.ts` holds the exact `needs` list, and `tests/plugin.test.ts` that every file the
|
|
116
|
+
manifest names ships.
|
|
117
|
+
|
|
118
|
+
## Prove it on a fresh workspace
|
|
119
|
+
|
|
120
|
+
Never in a workspace somebody works in. `webship-workspace init <folder>` makes an empty one.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
npm pack # in the plugin: the tarball of the branch
|
|
124
|
+
cd <the fresh workspace>
|
|
125
|
+
bash core/scripts/plugins.sh --require <path>/webship.co-workspace-<p>-<version>.tgz # says what it needs
|
|
126
|
+
bash core/scripts/plugins.sh --activate <p> # stops: lists what is not here, changes nothing
|
|
127
|
+
bash core/scripts/plugins.sh --activate <p> --with-needs # adds the folders, then activates
|
|
128
|
+
bash core/scripts/plugins.sh --install <p> # "placed …" once per file
|
|
129
|
+
ls dev ai-agents ai-skills ai-commands ai-prompts # each item in its folder
|
|
130
|
+
bash core/scripts/plugins.sh --list # needs: … met by …
|
|
131
|
+
bash core/scripts/plugins.sh --uninstall <p> # "removed …" once per file
|
|
132
|
+
grep -c "<p>" core/config/plugins.installed.yml # 0: the record is gone
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Then, installed again: build one site with the builder, run each command the items name, copy the
|
|
136
|
+
skill's examples into the suite and run them, look at the four AI folders on the dashboard, and
|
|
137
|
+
remove the site with `cmd-tools-remove.sh`.
|
|
138
|
+
|
|
139
|
+
## What was found on the way
|
|
140
|
+
|
|
141
|
+
- A phrase that matches in a dry run can still fail: a step may need another one before it
|
|
142
|
+
(`I should see the page title` needs `Given I am on a page`), or assert something the site does
|
|
143
|
+
not do as built. Only a real run tells.
|
|
144
|
+
- Content a failed scenario created stays on the site. Name it so it is found, and remove it
|
|
145
|
+
through the CLI tool before the next run (an entry in the trash is not in a list of every status).
|
|
146
|
+
- A folder that is not active gets nothing: the install says `skipped <n> <kind>` for it, and
|
|
147
|
+
places the items when the folder is added. With the folder in `needs`, `--activate` and
|
|
148
|
+
`--install` stop before that and offer to add it.
|
|
149
|
+
- An item a person edited in its folder is kept by `--install` and by `--uninstall`: the record
|
|
150
|
+
holds the hash of what was placed.
|
package/features/joomla.feature
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Feature: The Joomla plugin on the dashboard
|
|
2
|
-
Once the plugin is activated and installed, the sites folders offer the Joomla builder,
|
|
3
|
-
AI
|
|
2
|
+
Once the plugin is activated and installed, the sites folders offer the Joomla 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.
|
|
4
5
|
|
|
5
6
|
Scenario: The plugin is listed on the Plugins page
|
|
6
7
|
Given I am on "/settings/plugins"
|
|
@@ -15,3 +16,15 @@ Feature: The Joomla plugin on the dashboard
|
|
|
15
16
|
Given I am on "/ai-agents"
|
|
16
17
|
Then I should see "joomla-site-builder"
|
|
17
18
|
And I should see "joomla-tester"
|
|
19
|
+
|
|
20
|
+
Scenario: The AI Skills folder lists the skill the plugin ships
|
|
21
|
+
Given I am on "/ai-skills"
|
|
22
|
+
Then I should see "joomla-scenarios"
|
|
23
|
+
|
|
24
|
+
Scenario: The AI Commands folder lists the command the plugin ships
|
|
25
|
+
Given I am on "/ai-commands"
|
|
26
|
+
Then I should see "joomla-test"
|
|
27
|
+
|
|
28
|
+
Scenario: The AI Prompts folder lists the prompt the plugin ships
|
|
29
|
+
Given I am on "/ai-prompts"
|
|
30
|
+
Then I should see "joomla-build-and-test"
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webship.co/workspace-joomla",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Joomla for Webship Workspace: the builder (`cmd-joomla-project.sh`) and the Joomla CLI tool in every sites folder, the default accounts, the Joomla step pack wired into the testing setup, and
|
|
3
|
+
"version": "1.0.9",
|
|
4
|
+
"description": "Joomla for Webship Workspace: the builder (`cmd-joomla-project.sh`) and the Joomla CLI tool in every sites folder, the default accounts, the Joomla step pack wired into the testing setup, and its AI items in their folders: two agents, a skill, a command and a prompt.",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
7
7
|
"license": "ISC",
|
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"dist/src",
|
|
14
|
-
"
|
|
14
|
+
"ai",
|
|
15
15
|
"commands",
|
|
16
|
+
"docs",
|
|
16
17
|
"features",
|
|
17
18
|
"scripts",
|
|
18
19
|
"testing",
|
|
@@ -27,6 +28,18 @@
|
|
|
27
28
|
"workspacePlugin": {
|
|
28
29
|
"name": "joomla",
|
|
29
30
|
"label": "Joomla",
|
|
31
|
+
"needs": [
|
|
32
|
+
[
|
|
33
|
+
"dev",
|
|
34
|
+
"test",
|
|
35
|
+
"sandboxes",
|
|
36
|
+
"demos"
|
|
37
|
+
],
|
|
38
|
+
"ai-agents",
|
|
39
|
+
"ai-skills",
|
|
40
|
+
"ai-commands",
|
|
41
|
+
"ai-prompts"
|
|
42
|
+
],
|
|
30
43
|
"commands": {
|
|
31
44
|
"types": [
|
|
32
45
|
"sites"
|
|
@@ -56,8 +69,17 @@
|
|
|
56
69
|
},
|
|
57
70
|
"ai": {
|
|
58
71
|
"agents": [
|
|
59
|
-
"agents/joomla-site-builder.md",
|
|
60
|
-
"agents/joomla-tester.md"
|
|
72
|
+
"ai/agents/joomla-site-builder.md",
|
|
73
|
+
"ai/agents/joomla-tester.md"
|
|
74
|
+
],
|
|
75
|
+
"skills": [
|
|
76
|
+
"ai/skills/joomla-scenarios"
|
|
77
|
+
],
|
|
78
|
+
"commands": [
|
|
79
|
+
"ai/commands/joomla-test.md"
|
|
80
|
+
],
|
|
81
|
+
"prompts": [
|
|
82
|
+
"ai/prompts/joomla-build-and-test.md"
|
|
61
83
|
]
|
|
62
84
|
},
|
|
63
85
|
"features": [
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
# The step pack a Joomla project is tested with, and the release line it is required at.
|
|
21
21
|
readonly JOOMLA_STEPS_PACKAGE='@webship-js/joomla-steps';
|
|
22
|
-
readonly JOOMLA_STEPS_VERSION='^2.
|
|
22
|
+
readonly JOOMLA_STEPS_VERSION='^2.2.0';
|
|
23
23
|
|
|
24
24
|
# The release a build falls back on when the latest one cannot be read: the one this plugin was proven on.
|
|
25
25
|
readonly JOOMLA_PROVEN_VERSION='6.2.0';
|