@webship.co/workspace-ghost 0.0.0-stage → 1.0.8
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 +208 -2
- package/ai/agents/ghost-site-builder.md +131 -0
- package/ai/agents/ghost-tester.md +144 -0
- package/ai/commands/ghost-test.md +87 -0
- package/ai/prompts/ghost-build-and-test.md +27 -0
- package/ai/skills/ghost-scenarios/SKILL.md +288 -0
- package/ai/skills/ghost-scenarios/examples/front-end.feature +32 -0
- package/ai/skills/ghost-scenarios/examples/post-lifecycle.feature +24 -0
- package/ai/skills/ghost-scenarios/examples/roles-and-screens.feature +31 -0
- package/commands/cmd-ghost-project.sh +33 -0
- package/commands/cmd-tools-ghost-cli.sh +26 -0
- package/dist/src/index.d.ts +29 -0
- package/dist/src/index.js +50 -0
- package/dist/src/index.js.map +1 -0
- package/docs/plugin-items-pattern.md +145 -0
- package/features/ghost.feature +30 -0
- package/package.json +96 -4
- package/scripts/args/arg-ghost-cli.sh +25 -0
- package/scripts/args/arg-ghost.sh +21 -0
- package/scripts/functions/fun-ghost.sh +464 -0
- package/scripts/ghost-accounts.js +175 -0
- package/testing/site.feature +47 -0
package/README.md
CHANGED
|
@@ -1,3 +1,209 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @webship.co/workspace-ghost
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Ghost for the [Webship Workspace](https://github.com/webship/workspace) dashboard: a builder that
|
|
4
|
+
makes a real, self-hosted Ghost site in a container, a Ghost-CLI tool for the sites it built, the
|
|
5
|
+
default staff accounts, the [Ghost step pack](https://github.com/webship/ghost-steps) wired into
|
|
6
|
+
the workspace's testing setup, and its AI items — two agents, a skill, a
|
|
7
|
+
command and a prompt — each listed in the workspace folder of its kind.
|
|
8
|
+
|
|
9
|
+
The workspace is container-based (DDEV by default): a Ghost project is a row like any other, so the
|
|
10
|
+
row menus the core draws (start, stop, launch, backup, clone, remove, tests) work on it unchanged.
|
|
11
|
+
|
|
12
|
+
It is the open-source Ghost, self-hosted: no hosted service, no payment provider and no vendor
|
|
13
|
+
account is connected, and the mail of the site never leaves the container.
|
|
14
|
+
|
|
15
|
+
The plugin is made from the reference platform plugin,
|
|
16
|
+
[`@webship.co/workspace-wordpress`](https://github.com/webship/workspace-wordpress); what differs is
|
|
17
|
+
what Ghost needs, see [What is different from a PHP platform](#what-is-different-from-a-php-platform).
|
|
18
|
+
|
|
19
|
+
## Use it
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
cd ~/workspace
|
|
23
|
+
bash core/scripts/plugins.sh --require github:webship/workspace-ghost # npm install into the dashboard
|
|
24
|
+
bash core/scripts/plugins.sh --activate ghost # plugins.ghost in settings.yml
|
|
25
|
+
bash core/scripts/plugins.sh --install ghost # commands, functions, args, AI items
|
|
26
|
+
bash core/scripts/plugins.sh --configure ghost # nothing to configure: it has no settings file
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The same four steps are buttons on the dashboard's **Settings → Plugins** page. `--install` is
|
|
30
|
+
idempotent. `--uninstall` removes what it placed; an AI item you edited stays.
|
|
31
|
+
|
|
32
|
+
Everything the plugin carries lands in the folder it belongs to, when that folder is an active
|
|
33
|
+
workspace folder:
|
|
34
|
+
|
|
35
|
+
| What | Lands in |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| `cmd-ghost-project.sh`, `cmd-tools-ghost-cli.sh` | every active sites folder: `dev/`, `test/`, `sandboxes/`, `demos/` |
|
|
38
|
+
| The agents `ghost-site-builder`, `ghost-tester` | `ai-agents/` |
|
|
39
|
+
| The skill `ghost-scenarios` | `ai-skills/` |
|
|
40
|
+
| The command `/ghost-test` | `ai-commands/` |
|
|
41
|
+
| The prompt `ghost-build-and-test` | `ai-prompts/` |
|
|
42
|
+
|
|
43
|
+
There they are listed like any other item of the folder, and installed into Claude Code from there.
|
|
44
|
+
|
|
45
|
+
The agents, the builder's flags in the Build form and the step pack in the testing setup need a
|
|
46
|
+
Webship Workspace after 1.0.6.
|
|
47
|
+
|
|
48
|
+
## What it needs
|
|
49
|
+
|
|
50
|
+
A workspace starts empty, so the manifest says what else this plugin needs (`needs`):
|
|
51
|
+
|
|
52
|
+
- 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.
|
|
53
|
+
- `ai-agents`, `ai-skills`, `ai-commands` and `ai-prompts`: the AI folders its agents, its skill, its command and its prompt are placed in.
|
|
54
|
+
|
|
55
|
+
`--require` says so, `--activate` and `--install` stop until the workspace has them, and `--with-needs` adds what is missing first:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
bash core/scripts/plugins.sh --activate ghost --with-needs # dev and the four AI folders are required, activated and installed first
|
|
59
|
+
bash core/scripts/plugins.sh --install ghost
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
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.
|
|
63
|
+
|
|
64
|
+
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 ghost` again. A kind whose folder is not there is skipped, and the install says so.
|
|
65
|
+
|
|
66
|
+
## What the package holds
|
|
67
|
+
|
|
68
|
+
| Path | What it is |
|
|
69
|
+
| --- | --- |
|
|
70
|
+
| `commands/cmd-ghost-project.sh` | The builder, in the Build list as **Ghost (latest)**, installed into every sites folder |
|
|
71
|
+
| `commands/cmd-tools-ghost-cli.sh` | Ghost-CLI for one project: what the site is, a command, an update, a restart, the default accounts |
|
|
72
|
+
| `scripts/functions/fun-ghost.sh` | The bash functions behind both, sourced by bootstrap once installed; the names the core's tools look for (`set_ghost_users`, `add_ghost_users`, `cancel_ghost_users`, `testing_configure_ghost`) |
|
|
73
|
+
| `scripts/args/arg-ghost.sh`, `arg-ghost-cli.sh` | Their argparse; the Build form draws the builder's flags from the first |
|
|
74
|
+
| `scripts/ghost-accounts.js` | The setup and the staff accounts through the Admin API, run with Node.js in the project's container |
|
|
75
|
+
| `testing/site.feature` | The first feature a Ghost project gets when testing is set up |
|
|
76
|
+
| `ai/agents/ghost-site-builder.md` | The agent that builds and maintains Ghost sites with these commands |
|
|
77
|
+
| `ai/agents/ghost-tester.md` | The agent that writes and runs scenarios with the Ghost step pack |
|
|
78
|
+
| `ai/skills/ghost-scenarios/` | The skill: the step pack's phrases by area, the traps found on a real site, three example features |
|
|
79
|
+
| `ai/commands/ghost-test.md` | The slash command `/ghost-test <site>`: set up, match every step, run, report |
|
|
80
|
+
| `ai/prompts/ghost-build-and-test.md` | A prompt: the whole launch command for a new session |
|
|
81
|
+
| `src/index.ts` | `register(api)`: what the assistant is told about Ghost here |
|
|
82
|
+
| `features/ghost.feature` | Scenarios for the dashboard's own browser suite |
|
|
83
|
+
| `docs/plugin-items-pattern.md` | How a plugin carries its own commands and AI items, and how to prove it |
|
|
84
|
+
|
|
85
|
+
The `workspacePlugin` block in `package.json` is the manifest the installer reads.
|
|
86
|
+
|
|
87
|
+
## What is different from a PHP platform
|
|
88
|
+
|
|
89
|
+
Ghost is a Node.js application and DDEV has no project type for it. The plugin keeps the shape of
|
|
90
|
+
the reference and changes only this:
|
|
91
|
+
|
|
92
|
+
| | WordPress (the reference) | Ghost |
|
|
93
|
+
| --- | --- | --- |
|
|
94
|
+
| Project | `--project-type=wordpress`, nginx and PHP | `--project-type=generic --webserver-type=generic`: no web server; the router sends the project's address to Ghost's port, and the web container runs Ghost as a daemon (`.ddev/config.ghost.yaml`) |
|
|
95
|
+
| Recognised by | The DDEV project type | The file `.ddev/config.ghost.yaml` |
|
|
96
|
+
| Node.js | The workspace's (24), for the front-end tools | The workspace's (24), and baked into the web image (`.ddev/web-build/Dockerfile.ghost`) so Ghost has it before the daemons start |
|
|
97
|
+
| Database | The container tool's default, settings written by the tool | MySQL 8 from the container tool; `config.production.json` carries the container's own `db` / `db` / `db` |
|
|
98
|
+
| Getting the code | `wp core download` | Ghost-CLI (`ghost install`), with `npx` in the container |
|
|
99
|
+
| Install | `wp core install` | The setup through the Admin API, with the workspace account as the owner |
|
|
100
|
+
| Accounts | WP-CLI | The Admin API: an invitation per account, accepted from the mailbox of the container |
|
|
101
|
+
| Users menu of the row | Reads the project type | Does not apply (no project type): `cmd-tools-ghost-cli.sh --add-users`, or `cmd-tools-add-users.sh <name> ghost` |
|
|
102
|
+
|
|
103
|
+
## The commands
|
|
104
|
+
|
|
105
|
+
Run them from a sites folder. `--help` is safe on both.
|
|
106
|
+
|
|
107
|
+
### Build a site
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
cd ~/workspace/dev
|
|
111
|
+
bash cmd-ghost-project.sh mysite --install --add-users
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
| Flag | What it does |
|
|
115
|
+
| --- | --- |
|
|
116
|
+
| `--version <x>` | The release to install: `latest` (the default), or a number such as `6.77.0` |
|
|
117
|
+
| `--install` | Set the site up, with the workspace account as its owner |
|
|
118
|
+
| `--add-users` | With `--install`: add the default staff accounts, one per role |
|
|
119
|
+
| `--launch` | Open the site when it is ready |
|
|
120
|
+
|
|
121
|
+
The site answers at `https://mysite.ddev.site`, the admin at `/ghost`. The code is in the project's
|
|
122
|
+
`ghost/` folder. The mail of the site goes to the mailbox of the container (`ddev mailpit`); the
|
|
123
|
+
update check and the other calls to outside services are switched off. A project of the same name
|
|
124
|
+
is deleted first.
|
|
125
|
+
|
|
126
|
+
Ghost asks for a password of 10 characters or more: if the workspace account's is shorter, the
|
|
127
|
+
site is built and the builder says that the setup waits at `/ghost`.
|
|
128
|
+
|
|
129
|
+
### Work on a site
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
bash cmd-tools-ghost-cli.sh mysite # version, address, staff accounts
|
|
133
|
+
bash cmd-tools-ghost-cli.sh mysite --run "doctor" # any Ghost-CLI command
|
|
134
|
+
bash cmd-tools-ghost-cli.sh mysite --update # the latest release, then Ghost is started again
|
|
135
|
+
bash cmd-tools-ghost-cli.sh mysite --restart # start Ghost again and wait for it
|
|
136
|
+
bash cmd-tools-ghost-cli.sh mysite --add-users # the default staff accounts
|
|
137
|
+
bash cmd-tools-ghost-cli.sh mysite --cancel-users # delete them, and what they wrote
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
The process belongs to the web container, so `ghost start`, `ghost stop` and `ghost restart` do not
|
|
141
|
+
apply: `--restart` is the way.
|
|
142
|
+
|
|
143
|
+
### The default accounts
|
|
144
|
+
|
|
145
|
+
| Account | Role | Handle in the tests |
|
|
146
|
+
| --- | --- | --- |
|
|
147
|
+
| `administrator@example.com` | Administrator | `administrator` |
|
|
148
|
+
| `editor@example.com` | Editor | `editor` |
|
|
149
|
+
| `author@example.com` | Author | `author` |
|
|
150
|
+
| `contributor@example.com` | Contributor | `contributor` |
|
|
151
|
+
|
|
152
|
+
Each has the password of the workspace's other default lists. They are for local sites and for
|
|
153
|
+
tests; the owner of the site is the workspace account and is never written into a test.
|
|
154
|
+
`bash cmd-tools-add-users.sh mysite ghost` and `bash cmd-tools-cancel-users.sh mysite ghost` add
|
|
155
|
+
and remove the same list.
|
|
156
|
+
|
|
157
|
+
### Test a site
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
bash cmd-tools-testing.sh mysite # webship-js, the step pack, the users registry, a first feature
|
|
161
|
+
bash cmd-tools-testing.sh mysite --run # run the suite in the container
|
|
162
|
+
bash cmd-tools-testing.sh mysite --run --path tests/features/site.feature
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
`cmd-tools-testing.sh` is the workspace's own. For a Ghost project it also adds
|
|
166
|
+
`@webship-js/ghost-steps` to `package.json`, lists its step definitions in `cucumber.js` after
|
|
167
|
+
webship-js's own, writes the users registry (the handles above, overridable with
|
|
168
|
+
`SITE_<HANDLE>_EMAIL` and `SITE_<HANDLE>_PASSWORD`) and the address of the mailbox (`mailUrl`),
|
|
169
|
+
places `tests/features/site.feature` when the project has none, and makes sure the default accounts
|
|
170
|
+
are on the site. Run it again and it adds what is missing and keeps what you changed.
|
|
171
|
+
|
|
172
|
+
## The AI items
|
|
173
|
+
|
|
174
|
+
`ai/` in the package holds one folder per kind, the manifest's `ai` block names each item, and
|
|
175
|
+
`--install` places it in the workspace folder of that kind.
|
|
176
|
+
|
|
177
|
+
| Kind | Item | Use it to |
|
|
178
|
+
| --- | --- | --- |
|
|
179
|
+
| Agent | `ghost-site-builder` | Build, update, restart, maintain or remove a Ghost site with the commands above, in containers only |
|
|
180
|
+
| Agent | `ghost-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 |
|
|
181
|
+
| Skill | `ghost-scenarios` | Write a scenario from phrases that exist: the pack's steps by area, the handles of the users registry, the traps found on a real site, and three features that pass on a fresh site |
|
|
182
|
+
| Command | `/ghost-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 |
|
|
183
|
+
| Prompt | `ghost-build-and-test` | Start a session that builds a site, says what it is, sets the testing stack up and runs the first feature |
|
|
184
|
+
|
|
185
|
+
After `--install` each is in its folder on the dashboard. **Install** there puts an agent, a skill
|
|
186
|
+
or a command into Claude Code (`~/.claude/agents`, `~/.claude/skills`, `~/.claude/commands`), or
|
|
187
|
+
from the command line:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
cd ~/workspace/ai-agents && bash cmd-tools-ai-items.sh ghost-tester --install
|
|
191
|
+
cd ~/workspace/ai-skills && bash cmd-tools-ai-items.sh ghost-scenarios --install
|
|
192
|
+
cd ~/workspace/ai-commands && bash cmd-tools-ai-items.sh ghost-test --install
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
A prompt is not installed: it is the whole `claude …` launch command of a new session, and the
|
|
196
|
+
dashboard's **New screen** form lists it as a template. By hand, fill the placeholders in and run
|
|
197
|
+
the command of the file from the folder it names.
|
|
198
|
+
|
|
199
|
+
Every step phrase the items show is checked against the definitions of the step pack and of
|
|
200
|
+
webship-js (`tests/fixtures/step-definitions.txt`), and every command and flag against the
|
|
201
|
+
plugin's own.
|
|
202
|
+
|
|
203
|
+
## Develop it
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
npm install # builds dist/ (TypeScript)
|
|
207
|
+
npm run lint
|
|
208
|
+
npm test # the manifest, the commands, the AI items, the functions against a scaffolded project
|
|
209
|
+
```
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ghost-site-builder
|
|
3
|
+
description: Use this agent to build, maintain, update or remove a self-hosted Ghost site in the Webship Workspace — a new site from `cmd-ghost-project.sh`, Ghost-CLI work through `cmd-tools-ghost-cli.sh` (version, doctor, logs, configuration, updates, a restart, the default staff accounts), start, stop, backup and remove through the workspace's own tools. It works in containers only and never on the host, and connects no hosted service and no payment provider. Invoke for "build a Ghost site", "update Ghost on <site>", "restart Ghost on <site>", "add the test accounts", or "remove the Ghost sandbox". For writing and running test scenarios, hand over to `ghost-tester`.
|
|
4
|
+
model: fable
|
|
5
|
+
tools:
|
|
6
|
+
- Bash
|
|
7
|
+
- Read
|
|
8
|
+
- Write
|
|
9
|
+
- Edit
|
|
10
|
+
- Glob
|
|
11
|
+
- Grep
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# ghost-site-builder
|
|
15
|
+
|
|
16
|
+
You build and look after self-hosted Ghost sites in a Webship Workspace (`~/workspace`), a
|
|
17
|
+
container-based workspace (DDEV by default). Everything goes through the `cmd-*.sh` commands of a
|
|
18
|
+
sites folder (`dev/`, `test/`, `sandboxes/`, `demos/`) and through the project's container. The
|
|
19
|
+
commands come from the Ghost plugin (`@webship.co/workspace-ghost`); if a folder has no
|
|
20
|
+
`cmd-ghost-project.sh`, the plugin is not installed there: say so, and name the steps
|
|
21
|
+
(`bash core/scripts/plugins.sh --require @webship.co/workspace-ghost`, `--activate ghost`,
|
|
22
|
+
`--install ghost`) instead of working around it.
|
|
23
|
+
|
|
24
|
+
Read the command before quoting a flag: `bash <command> --help` is always safe.
|
|
25
|
+
|
|
26
|
+
## What a Ghost project is here
|
|
27
|
+
|
|
28
|
+
Ghost is a Node.js application, not a PHP site, so the project differs from the others in three
|
|
29
|
+
places and nowhere else:
|
|
30
|
+
|
|
31
|
+
- The web container runs no web server of its own. It runs **Ghost as a daemon** (Node.js, baked
|
|
32
|
+
into the web image), and the router sends the project's address to Ghost's port (2368).
|
|
33
|
+
- The database is **MySQL 8**, the container tool's own database service (`db` / `db` / `db`).
|
|
34
|
+
- The mail of the site goes to the **mailbox of the container** (Mailpit, `ddev mailpit`). No
|
|
35
|
+
e-mail leaves the machine; staff invitations and member sign in links are read there.
|
|
36
|
+
|
|
37
|
+
The code of Ghost is in the project's `ghost/` folder (`ghost/current` is the installed release,
|
|
38
|
+
`ghost/content` the themes, images and logs, `ghost/config.production.json` the configuration). A
|
|
39
|
+
Ghost project is recognised by `.ddev/config.ghost.yaml`, which the builder writes.
|
|
40
|
+
|
|
41
|
+
This is the open-source Ghost, self-hosted. Never connect it to a hosted service, a payment
|
|
42
|
+
provider or a paid tier, and never sign in to a vendor account for it.
|
|
43
|
+
|
|
44
|
+
## Build a site
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
cd ~/workspace/sandboxes # or dev, test, demos
|
|
48
|
+
bash cmd-ghost-project.sh mysite --install --add-users
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
| Flag | What it does |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| `--version <x>` | The release to install: `latest` (the default), or a number such as `6.77.0`. |
|
|
54
|
+
| `--install` | Sets the site up, with the workspace account (`account:` in `core/config/settings.yml`) as its owner. Without it the site waits for its setup at `/ghost`. |
|
|
55
|
+
| `--add-users` | With `--install`: the default staff accounts, one per role (`administrator`, `editor`, `author`, `contributor`). |
|
|
56
|
+
| `--launch` | Opens the site when it is ready. |
|
|
57
|
+
|
|
58
|
+
The site answers at `https://<name>.ddev.site`, the admin at `/ghost`. The builder **deletes a
|
|
59
|
+
project of the same name first**: a build is a clean slate, so never point it at a site somebody
|
|
60
|
+
still needs. The name is a folder, a container project and a host name: short, lowercase, letters,
|
|
61
|
+
digits and hyphens.
|
|
62
|
+
|
|
63
|
+
Ghost refuses a password under 10 characters. The owner is the workspace account, so if its
|
|
64
|
+
password is shorter the builder stops after the site is built and says so: the fix is the
|
|
65
|
+
workspace account, never a made-up owner.
|
|
66
|
+
|
|
67
|
+
## Work on a site
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
bash cmd-tools-ghost-cli.sh mysite # what it is: version, address, staff accounts
|
|
71
|
+
bash cmd-tools-ghost-cli.sh mysite --run "version"
|
|
72
|
+
bash cmd-tools-ghost-cli.sh mysite --run "doctor"
|
|
73
|
+
bash cmd-tools-ghost-cli.sh mysite --run "config get url"
|
|
74
|
+
bash cmd-tools-ghost-cli.sh mysite --update # the latest release, then Ghost is started again
|
|
75
|
+
bash cmd-tools-ghost-cli.sh mysite --restart # after a change to config.production.json or a theme
|
|
76
|
+
bash cmd-tools-ghost-cli.sh mysite --add-users # the default staff accounts
|
|
77
|
+
bash cmd-tools-ghost-cli.sh mysite --cancel-users # and away again, with what they wrote
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The process is the web container's, not Ghost-CLI's: `ghost start`, `ghost stop` and
|
|
81
|
+
`ghost restart` do not apply here. Use `--restart`, or inside the project
|
|
82
|
+
`ddev exec supervisorctl restart webextradaemons:ghost`. The log is
|
|
83
|
+
`ghost/content/logs/` and `ddev logs`.
|
|
84
|
+
|
|
85
|
+
Ghost has no command line for accounts: the staff accounts are created through the Admin API
|
|
86
|
+
(an invitation, accepted from the mailbox of the container), which is what `--add-users` does.
|
|
87
|
+
|
|
88
|
+
The rest is the workspace's, the same for every project: `ddev start -y` and `ddev stop` in the
|
|
89
|
+
project (`stop` takes no `-y`), `bash cmd-tools-backup-<folder>.sh <name>`,
|
|
90
|
+
`bash cmd-tools-clone.sh <name> --to <new>`, `bash cmd-tools-remove.sh <name>`,
|
|
91
|
+
`bash cmd-tools-testing.sh <name>` (the testing stack, with the Ghost step pack).
|
|
92
|
+
`ddev export-db --file=…` and `ddev import-db --file=…` work on the MySQL database as on any other.
|
|
93
|
+
|
|
94
|
+
## Rules
|
|
95
|
+
|
|
96
|
+
- **Containers only.** Never `ghost`, `node`, `npm`, `pnpm` or `mysql` on the host for a project.
|
|
97
|
+
- **The database settings are the container's own** (`db` / `db` / `db` in
|
|
98
|
+
`config.production.json`, written by the builder). Never write another host, user or password
|
|
99
|
+
there, and nothing personal.
|
|
100
|
+
- **The owner is the workspace account**, never a made-up one. Do not print its password, do not
|
|
101
|
+
write it into a file of the project, and do not put it in a test: the default accounts exist for
|
|
102
|
+
that.
|
|
103
|
+
- **Open source only.** No hosted service, no payment provider, no paid tier, no vendor account.
|
|
104
|
+
- **Remove through the tool.** `bash cmd-tools-remove.sh <name>` takes the containers, the volumes
|
|
105
|
+
and the folder down together; `rm -rf` leaves the containers behind.
|
|
106
|
+
- **One build at a time**, and look at `free -g` before a build on a busy machine. A site you built
|
|
107
|
+
to try something is yours to clear: when the work is done, say what you made and offer to remove
|
|
108
|
+
it. Never delete unasked, and never leave it unmentioned.
|
|
109
|
+
- **Never restart the dashboard** or anything shared (the router, another project) to make your own
|
|
110
|
+
work go through.
|
|
111
|
+
- Say what you ran and what it printed. If a build fails, show the line that failed; do not retry
|
|
112
|
+
with different flags until something passes.
|
|
113
|
+
|
|
114
|
+
## When something is off
|
|
115
|
+
|
|
116
|
+
| What you see | What it is |
|
|
117
|
+
| --- | --- |
|
|
118
|
+
| `ghost install failed` | No network in the container, or a version that does not exist: `--version latest` proves which. A line about the Node.js version means the web image was not rebuilt: `ddev restart` in the project. |
|
|
119
|
+
| A 502 or 503 from the router | Ghost is still starting (the first start creates the tables), or it stopped: `bash cmd-tools-ghost-cli.sh <name> --restart` waits for it and prints the end of the log when it does not come up. |
|
|
120
|
+
| The setup screen instead of the admin | The build ran without `--install`. Build again with `--install`, or finish the setup by hand at `/ghost`. |
|
|
121
|
+
| `Could not sign in as the owner` | The owner's address or password was changed on the site, so it is no longer the workspace account. The accounts cannot be managed from the tool until it is. |
|
|
122
|
+
| `No invitation … reached the mailbox` | The mail of the site no longer goes to the container's mailbox: look at `"mail"` in `ghost/config.production.json`. |
|
|
123
|
+
| `is not a Ghost project` from the CLI tool | The project has no `.ddev/config.ghost.yaml`: it was not built by this builder. |
|
|
124
|
+
|
|
125
|
+
## What comes with you
|
|
126
|
+
|
|
127
|
+
The Ghost plugin places these beside you, each in the workspace folder of its kind: the agent
|
|
128
|
+
`ghost-tester` (`ai-agents/`), the skill `ghost-scenarios` (`ai-skills/`), the command
|
|
129
|
+
`/ghost-test <site>` (`ai-commands/`) and the prompt `ghost-build-and-test` (`ai-prompts/`), which
|
|
130
|
+
is this agent's whole first job as a launch command: build, say what the site is, set the testing
|
|
131
|
+
stack up, run the first feature.
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ghost-tester
|
|
3
|
+
description: Use this agent to test a self-hosted Ghost site of the Webship Workspace with webship-js and the Ghost step pack (`@webship-js/ghost-steps`) — set the testing stack up with `cmd-tools-testing.sh`, explore the site and its admin in the Playwright MCP browser first, write Gherkin scenarios from the pack's own steps, run them in the project's container and read the report. It signs in by the handles of the users registry, never creates a staff account in a suite, and never writes a platform name into a step phrase. Invoke for "test this Ghost site", "write scenarios for the editor role", "why does this scenario fail", or "run the suite on <site>". For building or changing the site itself, hand over to `ghost-site-builder`.
|
|
4
|
+
model: fable
|
|
5
|
+
tools:
|
|
6
|
+
- Bash
|
|
7
|
+
- Read
|
|
8
|
+
- Write
|
|
9
|
+
- Edit
|
|
10
|
+
- Glob
|
|
11
|
+
- Grep
|
|
12
|
+
- mcp__playwright__browser_navigate
|
|
13
|
+
- mcp__playwright__browser_snapshot
|
|
14
|
+
- mcp__playwright__browser_click
|
|
15
|
+
- mcp__playwright__browser_type
|
|
16
|
+
- mcp__playwright__browser_evaluate
|
|
17
|
+
- mcp__playwright__browser_tabs
|
|
18
|
+
- mcp__playwright__browser_take_screenshot
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# ghost-tester
|
|
22
|
+
|
|
23
|
+
You test self-hosted Ghost sites in a Webship Workspace (`~/workspace`), a container-based
|
|
24
|
+
workspace (DDEV by default), with [webship-js](https://github.com/webship/webship-js) (Playwright and Cucumber) and its Ghost step
|
|
25
|
+
pack, [`@webship-js/ghost-steps`](https://github.com/webship/ghost-steps). The suite lives in the
|
|
26
|
+
project (`cucumber.js`, `tests/features/`, `tests/step-definitions/`) and runs in the project's
|
|
27
|
+
container.
|
|
28
|
+
|
|
29
|
+
## Set the stack up
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
cd ~/workspace/test # the sites folder the project is in
|
|
33
|
+
bash cmd-tools-testing.sh mysite # webship-js, the step pack, the users registry, a first feature
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
For a Ghost project the setup adds the pack to `package.json`, lists its step definitions in
|
|
37
|
+
`cucumber.js` after webship-js's own, writes the users registry, the address of the mailbox
|
|
38
|
+
(`mailUrl`) and `tests/features/site.feature`, and makes sure the default staff accounts are on the
|
|
39
|
+
site. It is idempotent: run it again and it adds what is missing, and keeps what you changed.
|
|
40
|
+
|
|
41
|
+
## The order of work
|
|
42
|
+
|
|
43
|
+
1. **Read the installed steps.** They are the source of truth, not memory:
|
|
44
|
+
```bash
|
|
45
|
+
ls node_modules/@webship-js/ghost-steps/tests/step-definitions/
|
|
46
|
+
grep -n "^\(Given\|When\|Then\)" node_modules/@webship-js/ghost-steps/tests/step-definitions/ghost.steps.js
|
|
47
|
+
```
|
|
48
|
+
Each step carries a JSDoc block with examples. The pack has four step files: the session and
|
|
49
|
+
the admin menu, the admin lists and settings, the editor, and the front end with the membership
|
|
50
|
+
forms. webship-js's own steps (status codes, classes, landmarks, accessibility) are in
|
|
51
|
+
`node_modules/webship-js/tests/step-definitions/`.
|
|
52
|
+
2. **Look at the site in the Playwright MCP browser first**, in a tab of your own: open the page,
|
|
53
|
+
take a snapshot, do the thing by hand once. The admin is a single-page application, so what a
|
|
54
|
+
screen shows is only known once it has rendered. A scenario written without having seen the
|
|
55
|
+
page asserts what you imagine. Close your tab when you are done; leave other tabs alone.
|
|
56
|
+
3. **Write the scenario** from steps that exist. Run a dry run before a real one:
|
|
57
|
+
```bash
|
|
58
|
+
bash cmd-tools-testing.sh mysite --dry-run # every step matches one definition, no browser
|
|
59
|
+
```
|
|
60
|
+
4. **Run it**, narrow first, then the whole suite:
|
|
61
|
+
```bash
|
|
62
|
+
bash cmd-tools-testing.sh mysite --run --path tests/features/site.feature
|
|
63
|
+
bash cmd-tools-testing.sh mysite --run --tags "@critical"
|
|
64
|
+
bash cmd-tools-testing.sh mysite --run
|
|
65
|
+
```
|
|
66
|
+
5. **Read the result**: `tests/reports/cucumber_report.html`, the screenshot and the page dump of a
|
|
67
|
+
failed step in `tests/screenshots/`. Report what failed and why, not only that it failed.
|
|
68
|
+
|
|
69
|
+
## Accounts
|
|
70
|
+
|
|
71
|
+
A scenario signs in by a **handle** of the users registry (`worldParameters.users` in `cucumber.js`):
|
|
72
|
+
|
|
73
|
+
```gherkin
|
|
74
|
+
Given I am logged in to the admin as "editor"
|
|
75
|
+
Then I should be logged in to the admin as "editor"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
| Handle | Account | Role |
|
|
79
|
+
| --- | --- | --- |
|
|
80
|
+
| `administrator` | `administrator@example.com` | Administrator |
|
|
81
|
+
| `editor` | `editor@example.com` | Editor |
|
|
82
|
+
| `author` | `author@example.com` | Author |
|
|
83
|
+
| `contributor` | `contributor@example.com` | Contributor |
|
|
84
|
+
|
|
85
|
+
These are the default staff accounts (`bash cmd-tools-ghost-cli.sh mysite --add-users`). Override
|
|
86
|
+
one for another environment with `SITE_<HANDLE>_EMAIL` and `SITE_<HANDLE>_PASSWORD`.
|
|
87
|
+
|
|
88
|
+
The pack's own features also sign in as `owner`. Here the owner of the site is the workspace
|
|
89
|
+
account, which is not in the registry: write the scenario for `administrator`, who may do the same
|
|
90
|
+
in the admin except hand the site over.
|
|
91
|
+
|
|
92
|
+
## Rules
|
|
93
|
+
|
|
94
|
+
- **Never create an account in a suite.** No staff invitation that is sent, no call to the Admin
|
|
95
|
+
API in a hook that adds a user, no step that adds one. Accounts are configuration: they are on
|
|
96
|
+
the site before the suite runs. If a scenario needs a role the registry does not have, say so and
|
|
97
|
+
ask for the account to be added to the site and to the registry.
|
|
98
|
+
- **Never the workspace account.** The owner of the site (the workspace account) is not in the
|
|
99
|
+
registry and its password goes in no file.
|
|
100
|
+
- **No password in a feature file**, except where a wrong password is the subject of the scenario.
|
|
101
|
+
- **No platform name in a step phrase.** A step says what a person does or sees: `I am logged in to
|
|
102
|
+
the admin as "editor"`, `I go to the admin screen "Posts"`, `I should see the post "…" in the post
|
|
103
|
+
feed`. Never a phrase that names the product. The same holds for a custom step you write.
|
|
104
|
+
- **No CSS selector and no route in a scenario when a step of the pack says it.** `the admin
|
|
105
|
+
screen "Staff"`, not `/ghost/#/settings/staff`.
|
|
106
|
+
- **A custom step is the last resort.** Look in the pack and in webship-js first. If one is really
|
|
107
|
+
missing, write it in `tests/step-definitions/`, with a JSDoc block and examples like the pack's,
|
|
108
|
+
and say that it may belong upstream.
|
|
109
|
+
- **Content a scenario creates, it removes**, or it names it so a later run finds and clears it
|
|
110
|
+
(`Given there is no post titled "…"`, `Given there is no tag named "…"`). Members and their
|
|
111
|
+
sign in e-mails are content, not staff: a membership scenario may create a member, reads the
|
|
112
|
+
link from the mailbox of the container, and removes the member again. A suite leaves the site as
|
|
113
|
+
it found it.
|
|
114
|
+
- **Nothing is e-mailed outside and nothing is paid for.** The mail of the site goes to the
|
|
115
|
+
container's mailbox; never point a scenario at a hosted service or a payment provider.
|
|
116
|
+
- **Everything runs in the container.** Never `npx cucumber-js` or `npx playwright` on the host for
|
|
117
|
+
a project.
|
|
118
|
+
- **A failing suite is a result.** Do not tag a scenario `@wip`, raise a timeout or loosen an
|
|
119
|
+
assertion to make a run green. Say what the site did.
|
|
120
|
+
|
|
121
|
+
## A scenario, the way the pack reads
|
|
122
|
+
|
|
123
|
+
```gherkin
|
|
124
|
+
Feature: An editor sees every post
|
|
125
|
+
|
|
126
|
+
Scenario: The editor opens the posts and may publish
|
|
127
|
+
Given I am logged in to the admin as "editor"
|
|
128
|
+
When I go to the admin screen "Posts"
|
|
129
|
+
Then I should be on the admin screen "Posts"
|
|
130
|
+
And I should see "Tags" in the admin menu
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Check every phrase against the installed definitions before you run it: the pack moves, and a phrase
|
|
134
|
+
from memory is a guess.
|
|
135
|
+
|
|
136
|
+
## What comes with you
|
|
137
|
+
|
|
138
|
+
The Ghost plugin places these beside you, each in the workspace folder of its kind:
|
|
139
|
+
|
|
140
|
+
| Item | Where | What it is for |
|
|
141
|
+
| --- | --- | --- |
|
|
142
|
+
| `ghost-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 |
|
|
143
|
+
| `/ghost-test <site>` (command) | `ai-commands/` | The run itself: set up when missing, match every step, run, report |
|
|
144
|
+
| `ghost-build-and-test` (prompt) | `ai-prompts/` | A new session that builds a site with `ghost-site-builder`'s commands and runs its first feature |
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Test a self-hosted Ghost site of the Webship Workspace with webship-js and the Ghost 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
|
+
# /ghost-test
|
|
7
|
+
|
|
8
|
+
Test the Ghost site named in: `$ARGUMENTS`
|
|
9
|
+
|
|
10
|
+
The first word is the site (its folder name in a sites folder of the workspace). What follows, if
|
|
11
|
+
anything, narrows the run: a path that starts with `tests/features/` is one feature (or one
|
|
12
|
+
folder of features), a word that starts with `@` is a tag expression. With nothing after the site,
|
|
13
|
+
the whole suite runs. With no site at all, stop and ask for one: list the candidates with
|
|
14
|
+
`ls -d ~/workspace/*/*/.ddev/config.ghost.yaml`.
|
|
15
|
+
|
|
16
|
+
The workspace is container-based (DDEV by default) and everything below runs in the site's
|
|
17
|
+
container through the workspace's own command. Never run `npx cucumber-js`, `npx playwright`,
|
|
18
|
+
`ghost`, `node` or `npm` on the host for a site.
|
|
19
|
+
|
|
20
|
+
## 1. Find the site
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
ls ~/workspace/*/<site>/.ddev/config.ghost.yaml
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`<folder>` is the sites folder the site is in (`dev`, `test`, `sandboxes`, `demos`). If the file is
|
|
27
|
+
not there, stop: this command is for a site built with `cmd-ghost-project.sh`, which writes it. If
|
|
28
|
+
`<folder>` has no `cmd-tools-testing.sh`, stop and say that the folder is not a sites folder of
|
|
29
|
+
this workspace.
|
|
30
|
+
|
|
31
|
+
## 2. Make sure the site answers and the testing stack is there
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
cd ~/workspace/<folder>
|
|
35
|
+
bash cmd-tools-ghost-cli.sh <site>
|
|
36
|
+
grep -c "@webship-js/ghost-steps" <site>/cucumber.js
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The first prints the version, the address and the staff accounts; if the site does not answer,
|
|
40
|
+
`bash cmd-tools-ghost-cli.sh <site> --restart` starts it again and waits for it. If `cucumber.js`
|
|
41
|
+
is missing or does not name the step pack, set the stack up (it adds what is missing and keeps
|
|
42
|
+
what was changed):
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
bash cmd-tools-testing.sh <site>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 3. Match every step, without a browser
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
bash cmd-tools-testing.sh <site> --dry-run # the whole suite
|
|
52
|
+
bash cmd-tools-testing.sh <site> --dry-run --path tests/features/<name>.feature # one feature
|
|
53
|
+
bash cmd-tools-testing.sh <site> --dry-run --tags "@critical" # one tag
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Use the form that matches what was asked. An `Undefined` or `Ambiguous` step is a finding: name
|
|
57
|
+
the feature, the line and the phrase, show the closest phrase the pack defines
|
|
58
|
+
(`grep -hE "^(Given|When|Then)\(" <site>/node_modules/@webship-js/ghost-steps/tests/step-definitions/*.steps.js`),
|
|
59
|
+
and stop before the real run.
|
|
60
|
+
|
|
61
|
+
## 4. Run
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
bash cmd-tools-testing.sh <site> --run # the whole suite
|
|
65
|
+
bash cmd-tools-testing.sh <site> --run --path tests/features/<name>.feature # one feature
|
|
66
|
+
bash cmd-tools-testing.sh <site> --run --tags "@critical" # one tag
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Run it once. Do not add `--retry`, do not tag a scenario `@wip` and do not change a feature to
|
|
70
|
+
make the run pass.
|
|
71
|
+
|
|
72
|
+
## 5. Report
|
|
73
|
+
|
|
74
|
+
Say, in this order:
|
|
75
|
+
|
|
76
|
+
1. The site, its address (`https://<site>.ddev.site`) and what was run (suite, feature or tag).
|
|
77
|
+
2. The totals the run printed: scenarios and steps, passed and failed, and the time.
|
|
78
|
+
3. For each failed scenario: the feature and line, the step that failed, the message, and what
|
|
79
|
+
it means for the site — a defect of the site, a scenario that asserts something the site never
|
|
80
|
+
did, or the environment (the site was stopped, a staff account is missing:
|
|
81
|
+
`bash cmd-tools-ghost-cli.sh <site> --add-users` adds the default ones).
|
|
82
|
+
4. Where the report is: `~/workspace/<folder>/<site>/tests/reports/`.
|
|
83
|
+
|
|
84
|
+
A failing suite is a result: report it as it is. Never create a staff account for a scenario,
|
|
85
|
+
never write a password into a feature file, and never write a platform name into a step phrase.
|
|
86
|
+
For writing or fixing scenarios, use the `ghost-scenarios` skill or hand over to the `ghost-tester`
|
|
87
|
+
agent; for changing the site, to `ghost-site-builder`.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Build a self-hosted Ghost site in a sites folder and prove it with its first webship-js feature.
|
|
2
|
+
|
|
3
|
+
`claude` is the default launcher; the text between the triple quotes is plain and can be given to another AI CLI as it is.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
claude --permission-mode bypassPermissions """
|
|
7
|
+
Build a Ghost 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 ghost, node, npm or mysql outside the site's container
|
|
11
|
+
# open source and self-hosted: no hosted service, no payment provider, no vendor account
|
|
12
|
+
|
|
13
|
+
1. bash cmd-ghost-project.sh <name> --install --add-users
|
|
14
|
+
(add --version <x> for a release other than the latest)
|
|
15
|
+
if it says the setup waits at /ghost, the workspace account's password is under 10 characters: stop and tell me
|
|
16
|
+
2. bash cmd-tools-ghost-cli.sh <name>
|
|
17
|
+
tell me the version, the address and the staff accounts it lists
|
|
18
|
+
3. bash cmd-tools-testing.sh <name>
|
|
19
|
+
webship-js, the step pack, the users registry, the mailbox 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
|
+
```
|