@webship.co/workspace-umami 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +15 -0
- package/README.md +197 -2
- package/ai/agents/umami-builder.md +61 -0
- package/ai/agents/umami-tester.md +54 -0
- package/ai/commands/umami-test.md +29 -0
- package/ai/prompts/umami-build-and-test.md +20 -0
- package/ai/prompts/umami-scenarios-for-a-project.md +18 -0
- package/ai/skills/umami-scenarios/SKILL.md +70 -0
- package/ai/skills/umami-scenarios/examples/people.feature +14 -0
- package/ai/skills/umami-scenarios/examples/session.feature +15 -0
- package/ai/skills/umami-scenarios/examples/websites.feature +21 -0
- package/commands/cmd-umami-project.sh +31 -0
- package/dist/src/index.d.ts +30 -0
- package/dist/src/index.js +54 -0
- package/dist/src/index.js.map +1 -0
- package/features/umami-runtimes.feature +51 -0
- package/features/umami.feature +35 -0
- package/package.json +112 -4
- package/scripts/args/arg-umami.sh +19 -0
- package/scripts/functions/fun-umami.sh +397 -0
- package/scripts/umami-admin.py +104 -0
- package/testing/site.feature +19 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Webship.co
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,198 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center"><img src="https://raw.githubusercontent.com/webship/workspace-umami/1.0.x/assets/logo.svg" alt="Umami logo: this plugin supports Umami" width="96"></p>
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# @webship.co/workspace-umami
|
|
4
|
+
|
|
5
|
+
Umami for the [Webship Workspace](https://github.com/webship/workspace) dashboard: a builder that runs Umami
|
|
6
|
+
(privacy-friendly web analytics) from its official image, with the project's PostgreSQL; the
|
|
7
|
+
[step pack for Umami](https://github.com/webship/umami-steps) wired into the testing setup of such a project; and its AI
|
|
8
|
+
items (two agents, a skill, a command and two prompts for building and testing Umami projects), each listed in the
|
|
9
|
+
workspace folder of its kind.
|
|
10
|
+
|
|
11
|
+
- **Umami from GHCR, by digest:**
|
|
12
|
+
|
|
13
|
+
| Release | Image |
|
|
14
|
+
| --- | --- |
|
|
15
|
+
| 3.5.1 | `ghcr.io/umami-software/umami@sha256:3a7d6bc4a873db874c0674fd38cddb2507d416dc7beccacd19e2d196d02222a0` |
|
|
16
|
+
|
|
17
|
+
- **The project's PostgreSQL 17** (the core's own, db/db/db) is its database: the row's Backup and Restore dump and load
|
|
18
|
+
it as for any project, and the [PostgreSQL plugin](https://github.com/webship/workspace-postgresql) adds its DATABASE
|
|
19
|
+
menu.
|
|
20
|
+
- **No default password.** The app seeds its admin as admin / umami. At the first start the plugin replaces that
|
|
21
|
+
password through the app's own API with the one in `.webship-umami/admin-password` (0600), read on the script's input,
|
|
22
|
+
never on a command line; a build that cannot replace it stops and says not to leave the project running.
|
|
23
|
+
- **No request elsewhere.** Its telemetry and update check are off (`DISABLE_TELEMETRY`, `DISABLE_UPDATES`), and the
|
|
24
|
+
icons of its websites come from the app itself (`FAVICON_URL=/favicon-32x32.png`): by default it loads each website's
|
|
25
|
+
icon from a favicon service elsewhere. Its PNG icon, not `/favicon.ico`: an image of that exact address drew nothing
|
|
26
|
+
in Chromium (a broken icon beside each website). The first feature checks the icon is drawn and is the app's own.
|
|
27
|
+
- **Every container capped** through the core's runtime layer: Umami 768 MB, PostgreSQL 384 MB, and DDEV's web container
|
|
28
|
+
512 MB on DDEV or the stack's mail catcher 128 MB elsewhere.
|
|
29
|
+
- **On DDEV,** Umami runs as a service of the project (`.ddev/docker-compose.umami.yaml`), and DDEV's nginx sends the
|
|
30
|
+
project's address to it (the plugin's own `.ddev/nginx_full/nginx-site.conf`, with the scheme in `X-Forwarded-Proto`).
|
|
31
|
+
- **On Docker Compose, Podman and Kubernetes,** the image is the runtime layer's generic stack (its web container), and
|
|
32
|
+
its own start (`scripts/start-docker.sh`: the database's migrations, then its server) is the server, as the stack's
|
|
33
|
+
user (what the start writes is given to that user at the build).
|
|
34
|
+
|
|
35
|
+
### A newer release
|
|
36
|
+
|
|
37
|
+
The builder pins one release, in one place: `UMAMI_IMAGE` in `scripts/functions/fun-umami.sh`. To take a newer one:
|
|
38
|
+
read its digest (`docker buildx imagetools inspect ghcr.io/umami-software/umami:<version>`), put it and its name there
|
|
39
|
+
(and in the step pack's demo), and run the proofs of the Runtimes table again.
|
|
40
|
+
|
|
41
|
+
## Security
|
|
42
|
+
|
|
43
|
+
- **The sign-in token is not a cookie.** Umami keeps it in the browser's localStorage (`umami.auth`), where its page's
|
|
44
|
+
script reads it; it sets no cookie, so there is no cookie flag to set behind TLS. The first feature checks what really
|
|
45
|
+
exists: `Then the web analytics' sign-in should be kept safe for its scheme` (a token after a sign-in, never in an
|
|
46
|
+
address, carried by no cookie, and on https no cookie of the app without Secure). Signing out clears the token.
|
|
47
|
+
- **Passwords** only in 0600 files of the project's folder, given to the plugin's script on its input.
|
|
48
|
+
|
|
49
|
+
## Licence of the platform
|
|
50
|
+
|
|
51
|
+
Umami is MIT. The plugin carries no code of it: the image comes from GHCR, and the plugin's own script only talks to
|
|
52
|
+
its API.
|
|
53
|
+
|
|
54
|
+
## Use it
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
cd ~/workspace
|
|
58
|
+
bash core/scripts/plugins.sh --require umami --with-needs # npm install into the dashboard
|
|
59
|
+
bash core/scripts/plugins.sh --activate umami --with-needs # plugins.umami in settings.yml
|
|
60
|
+
bash core/scripts/plugins.sh --install umami # the builder, functions, args, AI items
|
|
61
|
+
bash core/scripts/plugins.sh --configure umami # nothing to configure: it has no settings file
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The same four steps are buttons on the dashboard's **Settings → Plugins** page.
|
|
65
|
+
|
|
66
|
+
| What | Lands in |
|
|
67
|
+
| --- | --- |
|
|
68
|
+
| `cmd-umami-project.sh` | every active sites folder: `dev/`, `test/`, `sandboxes/`, `demos/` |
|
|
69
|
+
| The agents `umami-builder`, `umami-tester` | `ai-agents/` |
|
|
70
|
+
| The skill `umami-scenarios` | `ai-skills/` |
|
|
71
|
+
| The command `/umami-test` | `ai-commands/` |
|
|
72
|
+
| The prompts `umami-build-and-test`, `umami-scenarios-for-a-project` | `ai-prompts/` |
|
|
73
|
+
|
|
74
|
+
## What it needs
|
|
75
|
+
|
|
76
|
+
A workspace starts empty, so the manifest says what else this plugin needs (`needs`):
|
|
77
|
+
|
|
78
|
+
- one sites folder, for the builder: `dev`, `test`, `sandboxes`, `demos` (`dev` is the one added when none is there).
|
|
79
|
+
- `ai-agents`, `ai-skills`, `ai-commands` and `ai-prompts`: the AI folders its items are placed in.
|
|
80
|
+
- Webship Workspace 1.0.60 or newer: the containers are capped through the core's runtime layer (`rt_memory`). An older
|
|
81
|
+
workspace is told so before anything is made.
|
|
82
|
+
- Python 3 on this machine, for the plugin's script against the app's API (its standard library only).
|
|
83
|
+
|
|
84
|
+
Everything else Umami does runs in its containers, through the container tool the workspace already needs.
|
|
85
|
+
|
|
86
|
+
## What the package holds
|
|
87
|
+
|
|
88
|
+
| Path | What it is |
|
|
89
|
+
| --- | --- |
|
|
90
|
+
| `commands/cmd-umami-project.sh` | The builder, in the Build list as **Umami (web analytics)** |
|
|
91
|
+
| `scripts/functions/fun-umami.sh` | The bash functions behind it; the names the core's tools look for (`set_umami_users`, `add_umami_users`, `cancel_umami_users`, `testing_configure_umami`, `umami_is_project`) |
|
|
92
|
+
| `scripts/args/arg-umami.sh` | Its argparse (`--runtime`, `--install`, `--launch`); the Build form draws the builder's flags from it |
|
|
93
|
+
| `scripts/umami-admin.py` | Replaces the default admin password, makes or removes a user, through the app's API, its passwords on the input |
|
|
94
|
+
| `testing/site.feature` | The first feature a project gets when testing is set up |
|
|
95
|
+
| `ai/` | The agents, the skill, the command and the prompts |
|
|
96
|
+
| `src/index.ts` | `register(api)`: what the assistant is told about Umami here |
|
|
97
|
+
| `features/umami.feature`, `features/umami-runtimes.feature` | Scenarios for the dashboard's own browser suite |
|
|
98
|
+
|
|
99
|
+
## The commands
|
|
100
|
+
|
|
101
|
+
### Build and serve
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
cd ~/workspace/dev
|
|
105
|
+
bash cmd-umami-project.sh stats --install # Umami 3.5.1 with PostgreSQL 17, at https://stats.ddev.site
|
|
106
|
+
bash cmd-umami-project.sh stats --install --runtime docker # on Docker Compose (or podman, kubernetes)
|
|
107
|
+
bash cmd-umami-project.sh stats --install --launch # and open it in a browser
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The builder deletes a project of the same name first. The project's folder holds `.webship-umami/` (0700): `umami.env`
|
|
111
|
+
(the app's settings and secret, 0600), `admin-password` (0600), `app-secret` and `two-factor-key` (0600),
|
|
112
|
+
`umami-admin.py`.
|
|
113
|
+
|
|
114
|
+
### Backup and restore
|
|
115
|
+
|
|
116
|
+
The database is the project's PostgreSQL: the row's Backup archives the folder and dumps the database with the core's
|
|
117
|
+
own PostgreSQL dump; Restore loads it back.
|
|
118
|
+
|
|
119
|
+
### Test a project
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
bash cmd-tools-testing.sh stats # webship-js, the step pack, the admin and the file of its password, a first feature
|
|
123
|
+
bash cmd-tools-testing.sh stats --run
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The testing hook (`testing_configure_umami`) adds `@webship-js/umami-steps` to the project's `package.json`, its step
|
|
127
|
+
definitions to `cucumber.js` after webship-js's own, the project's address as the launch URL, the admin's name and the
|
|
128
|
+
path of the project's password file (read at the run, never written into `cucumber.js`), and
|
|
129
|
+
`tests/features/site.feature`.
|
|
130
|
+
|
|
131
|
+
### Runtimes
|
|
132
|
+
|
|
133
|
+
| Runtime | The address | Proven with this builder |
|
|
134
|
+
| --- | --- | --- |
|
|
135
|
+
| DDEV (the default) | `https://<name>.ddev.site` | Yes: built from nothing with `--install` in 36 s (the default admin password replaced through the API); the step pack 5/5 (`not @demo`); the testing hook, its first feature 2/2 twice (the sign-in kept safe on https); the viewer made and removed; a backup with the core's PostgreSQL dump; a stop (10.7 s) and start (28 s), the admin signing in after it. memory.peak: Umami 373 MiB of 768 MiB, PostgreSQL 99 MiB of 384 MiB, DDEV's web 512 MiB of 512 MiB (its page cache: 53 MiB in use, no OOM) |
|
|
136
|
+
| Docker Compose (`--runtime docker`) | `http://127.0.0.1:<port>` | Yes: the default password replaced, the step pack 5/5, the viewer made and removed, a backup restored (the admin signs in after it), a stop (0.5 s); memory.peak: Umami 337 MiB of 768 MiB, PostgreSQL 117 MiB of 384 MiB, the mail catcher 42 MiB of 128 MiB |
|
|
137
|
+
| Podman (`--runtime podman`) | `http://127.0.0.1:<port>` | Yes: the same; a stop in 1.1 s; memory.peak: Umami 388 MiB of 768 MiB, PostgreSQL 154 MiB of 384 MiB, the mail catcher 36 MiB of 128 MiB |
|
|
138
|
+
| Kubernetes (`--runtime kubernetes`) | `http://<node address>:<NodePort>` | Yes (kind, its node capped at 3500 MB): the same, no error of the browser and none in the app's log; memory.peak: Umami 451 MiB of 768 MiB, PostgreSQL 149 MiB of 384 MiB, the mail catcher 34 MiB of 128 MiB |
|
|
139
|
+
|
|
140
|
+
Each proof ran Umami 3.5.1 on core 1.0.67, the step pack's `not @demo` lane (the admin's session and its token, a wrong
|
|
141
|
+
password, a view-only user, a website added, renamed and deleted, page views sent and counted) from this machine
|
|
142
|
+
against the project's address, with no request outside it and no OOM kill (`journalctl -k`) in any.
|
|
143
|
+
|
|
144
|
+
Lando and Docksal are runtimes of the workspace too, not proven with this builder yet: it says so and stops, before
|
|
145
|
+
anything is made.
|
|
146
|
+
|
|
147
|
+
### Users
|
|
148
|
+
|
|
149
|
+
`cmd-tools-add-users.sh <name> umami` makes the user `webship-viewer` (View only: it reads the statistics and changes
|
|
150
|
+
nothing); its password is in `.webship-umami/webship-viewer-password` (0600, never shown). `cmd-tools-cancel-users.sh
|
|
151
|
+
<name> umami` removes it and its file. The step pack makes the users a scenario needs through the admin's dialog, and
|
|
152
|
+
removes them.
|
|
153
|
+
|
|
154
|
+
## The AI items
|
|
155
|
+
|
|
156
|
+
| Item | Kind | What it is for |
|
|
157
|
+
| --- | --- | --- |
|
|
158
|
+
| `umami-builder` | agent | Builds and keeps Umami projects: their admin, users, backups |
|
|
159
|
+
| `umami-tester` | agent | Writes and runs scenarios with the step pack |
|
|
160
|
+
| `umami-scenarios` | skill | The step pack's phrases, the rules that keep a suite green, three example features |
|
|
161
|
+
| `/umami-test <project>` | command | Sets the pack up when missing, matches every step, runs, reports |
|
|
162
|
+
| `umami-build-and-test` | prompt | Builds an Umami project and proves it |
|
|
163
|
+
| `umami-scenarios-for-a-project` | prompt | Writes and runs scenarios for its websites and people |
|
|
164
|
+
|
|
165
|
+
Every item says the workspace is container-based (DDEV by default), and the agents and the skill send the reader to
|
|
166
|
+
the book *Automated Functional Testing Recipes* first.
|
|
167
|
+
|
|
168
|
+
```gherkin
|
|
169
|
+
Feature: A website added and counted
|
|
170
|
+
|
|
171
|
+
Scenario: Page views sent to a new website are counted
|
|
172
|
+
Given I am signed in to the web analytics as its admin
|
|
173
|
+
When I add the website "Seed Swap" for the domain "seeds.example"
|
|
174
|
+
And I send page views of "/", "/swaps" and "/swaps" to the website "Seed Swap"
|
|
175
|
+
Then the website "Seed Swap" should count 3 views
|
|
176
|
+
And the pages of the website "Seed Swap" should list "/swaps" with 2 visitors
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Develop it
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
npm install
|
|
183
|
+
npm test # builds, then the unit tests: the manifest, the scripts, the AI items, the needs
|
|
184
|
+
npm run lint # the TypeScript compiler, no output
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
CI runs the same on Node.js 24 and 26, checks that every shell script parses, and runs the plugin's webship-js
|
|
188
|
+
features against a dashboard with the plugin installed (`featuresSite`:
|
|
189
|
+
`cmd-umami-project.sh ci-umami --install --runtime docker`).
|
|
190
|
+
|
|
191
|
+
## License
|
|
192
|
+
|
|
193
|
+
ISC (see `LICENSE`). The package carries no code of Umami.
|
|
194
|
+
|
|
195
|
+
## Logo
|
|
196
|
+
|
|
197
|
+
The Umami logo in this README comes from Simple Icons 16.37.0, filled with the colour the set lists for the brand; the
|
|
198
|
+
set is CC0-1.0. The Umami name and logo are their owner's; this plugin is not affiliated with or endorsed by them.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: umami-builder
|
|
3
|
+
description: Use this agent to build, start or fix an Umami project in the Webship Workspace — run Umami with `cmd-umami-project.sh` (its official image on GHCR by digest, with the project's PostgreSQL), replace its default admin password, make its users, back it up and restore it, and read why it does not start. Use when an Umami project needs making, changing or mending.
|
|
4
|
+
model: fable
|
|
5
|
+
tools:
|
|
6
|
+
- Bash
|
|
7
|
+
- Read
|
|
8
|
+
- Write
|
|
9
|
+
- Edit
|
|
10
|
+
- Glob
|
|
11
|
+
- Grep
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# umami-builder
|
|
15
|
+
|
|
16
|
+
You build and keep Umami projects in a Webship Workspace (`~/workspace`), a container-based workspace (DDEV by
|
|
17
|
+
default). Nothing runs on the host but the plugin's small script that talks to the app's API: Umami and its database
|
|
18
|
+
are in the project's containers.
|
|
19
|
+
|
|
20
|
+
## The book
|
|
21
|
+
|
|
22
|
+
For any automated functional testing in this work (a Gherkin feature, a step definition, choosing a
|
|
23
|
+
step, a test run and its failures), read the book *Automated Functional Testing Recipes* first.
|
|
24
|
+
|
|
25
|
+
- **Where.** Use the first that exists: `.claude/automated-functional-testing-recipes/` in the project,
|
|
26
|
+
`~/.claude/automated-functional-testing-recipes/` (installed by webship/webship-js-ai-agent,
|
|
27
|
+
webship/webship-js-skills or webship/ai-agents), or
|
|
28
|
+
https://github.com/webship/webship-js-ai-agent/tree/2.0.x/automated-functional-testing-recipes
|
|
29
|
+
- **How.** Its `README.md` first, then the chapter that matches the task (one file per chapter,
|
|
30
|
+
named by its subject), not the single complete file.
|
|
31
|
+
- **Which wins.** The installed webship-js package and the step pack are the source of truth for
|
|
32
|
+
step phrasing. When they differ from the book, follow them and say so.
|
|
33
|
+
|
|
34
|
+
## Make a project
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
cd ~/workspace/dev
|
|
38
|
+
bash cmd-umami-project.sh <name> --install # Umami 3.5.1 with PostgreSQL 17, at https://<name>.ddev.site
|
|
39
|
+
bash cmd-umami-project.sh <name> --install --runtime docker # on Docker Compose (or podman, kubernetes)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The builder deletes a project of the same name first: stop if <name> is a project somebody still needs.
|
|
43
|
+
|
|
44
|
+
## Where things are
|
|
45
|
+
|
|
46
|
+
- `<project>/.webship-umami/` (0700): `umami.env` (the app's settings and secret, 0600), `admin-password` (0600),
|
|
47
|
+
`umami-admin.py` (replaces the default admin password, makes or removes a user, through the app's API, its passwords
|
|
48
|
+
on the input).
|
|
49
|
+
- The database is the project's PostgreSQL 17 (db/db/db): the row's Backup and Restore dump and load it.
|
|
50
|
+
- The app seeds its admin as admin / umami: the builder replaces that password at the first start. A project left with
|
|
51
|
+
the default password is a project anyone may sign in to: rebuild it with `--install`.
|
|
52
|
+
|
|
53
|
+
## Change a project
|
|
54
|
+
|
|
55
|
+
- A user: `bash cmd-tools-add-users.sh <name> umami` makes webship-viewer (View only; its password in
|
|
56
|
+
`.webship-umami/`); `bash cmd-tools-cancel-users.sh <name> umami` removes it.
|
|
57
|
+
- No request elsewhere: keep `DISABLE_TELEMETRY`, `DISABLE_UPDATES` and `FAVICON_URL=/favicon-32x32.png` in its settings.
|
|
58
|
+
- Never print a password, the app's secret or a sign-in token; read them from their files when needed.
|
|
59
|
+
- A newer release: its digest goes in `UMAMI_IMAGE` of the plugin's functions, and its proofs run again.
|
|
60
|
+
|
|
61
|
+
Report the address, what you changed, and the last lines of what failed, secrets masked.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: umami-tester
|
|
3
|
+
description: Use this agent to test an Umami project with webship-js and the step pack for Umami (`@webship-js/umami-steps`) in the Webship Workspace — build it with `cmd-umami-project.sh`, set the testing stack up with `cmd-tools-testing.sh`, write scenarios that sign in, add websites, send page views the way the tracker does, read what the overview counts and give users a role, run them and read why one fails. Use when an Umami project needs features, a failing scenario needs fixing, or a run needs reading.
|
|
4
|
+
model: fable
|
|
5
|
+
tools:
|
|
6
|
+
- Bash
|
|
7
|
+
- Read
|
|
8
|
+
- Write
|
|
9
|
+
- Edit
|
|
10
|
+
- Glob
|
|
11
|
+
- Grep
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# umami-tester
|
|
15
|
+
|
|
16
|
+
You test Umami projects of a Webship Workspace (`~/workspace`), a container-based workspace (DDEV by
|
|
17
|
+
default), with webship-js and the step pack for Umami.
|
|
18
|
+
|
|
19
|
+
## The book
|
|
20
|
+
|
|
21
|
+
For any automated functional testing in this work (a Gherkin feature, a step definition, choosing a
|
|
22
|
+
step, a test run and its failures), read the book *Automated Functional Testing Recipes* first.
|
|
23
|
+
|
|
24
|
+
- **Where.** Use the first that exists: `.claude/automated-functional-testing-recipes/` in the project,
|
|
25
|
+
`~/.claude/automated-functional-testing-recipes/` (installed by webship/webship-js-ai-agent,
|
|
26
|
+
webship/webship-js-skills or webship/ai-agents), or
|
|
27
|
+
https://github.com/webship/webship-js-ai-agent/tree/2.0.x/automated-functional-testing-recipes
|
|
28
|
+
- **How.** Its `README.md` first, then the chapter that matches the task (one file per chapter,
|
|
29
|
+
named by its subject), not the single complete file.
|
|
30
|
+
- **Which wins.** The installed webship-js package and the step pack are the source of truth for
|
|
31
|
+
step phrasing. When they differ from the book, follow them and say so.
|
|
32
|
+
- **For Umami.** Start with `ch10-authentication-authorization.md` (signing in, a view-only user),
|
|
33
|
+
`ch06-form-testing-recipes.md` (the website and user dialogs), `ch08-modal-dialog-testing.md` (the confirmations)
|
|
34
|
+
and `ch07-waiting-dynamic-content.md` (numbers that count up, a page view that arrives later).
|
|
35
|
+
|
|
36
|
+
## Set up and run
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
cd ~/workspace/dev
|
|
40
|
+
bash cmd-umami-project.sh <name> --install # Umami and its admin
|
|
41
|
+
bash cmd-tools-testing.sh <name> # webship-js, the step pack, the admin and its password file, a first feature
|
|
42
|
+
bash cmd-tools-testing.sh <name> --run
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## How the pack reads Umami
|
|
46
|
+
|
|
47
|
+
- Its phrases say "the web analytics", never the platform's name (the skill `umami-scenarios` lists them).
|
|
48
|
+
- The admin's password is read from its file (`.webship-umami/admin-password`); a user a scenario makes gets a random
|
|
49
|
+
password in memory. Every website and user a scenario makes is removed at its end, by its exact name.
|
|
50
|
+
- The sign-in token lives in the browser's localStorage, not a cookie: a secret, never printed.
|
|
51
|
+
- A new project has no data: a scenario adds its website and sends its page views (to the app only), and the overview's
|
|
52
|
+
numbers are read once they have stopped counting up.
|
|
53
|
+
|
|
54
|
+
Report what ran, what passed, and for each failure the step, its message, and the change you propose.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Test a Umami project of the Webship Workspace with webship-js and the step pack for Umami — set the testing stack up when it is missing, match every step, run the suite (or one feature, or a tag), and read why a scenario fails.
|
|
3
|
+
argument-hint: '<project> [tests/features/<name>.feature | @tag]'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /umami-test
|
|
7
|
+
|
|
8
|
+
Test the Umami project named in: `$ARGUMENTS`
|
|
9
|
+
|
|
10
|
+
`$ARGUMENTS` stands for what was typed after the command: the project's name, then a feature or a tag to run alone.
|
|
11
|
+
|
|
12
|
+
The workspace is container-based (DDEV by default). Work in the sites folder the project is in (`~/workspace/dev`
|
|
13
|
+
unless told otherwise).
|
|
14
|
+
|
|
15
|
+
1. When the project is not there, build it: `bash cmd-umami-project.sh <project> --install`.
|
|
16
|
+
2. When it has no testing stack yet (no `cucumber.js` in its folder), set it up: `bash cmd-tools-testing.sh <project>`.
|
|
17
|
+
3. Match every step before running: `bash cmd-tools-testing.sh <project> --dry-run`. An undefined step is a phrase the
|
|
18
|
+
pack or webship-js does not have: the skill `umami-scenarios` says which one to use.
|
|
19
|
+
4. Run it: `bash cmd-tools-testing.sh <project> --run`, or `--run --path tests/features/<name>.feature`, or
|
|
20
|
+
`--run --tags @<tag>`.
|
|
21
|
+
5. Read a failure from its message and hint: the pack says what it expected, what it found and what to try.
|
|
22
|
+
|
|
23
|
+
Before you write or change a scenario, or read a failed run, read the book *Automated Functional
|
|
24
|
+
Testing Recipes* (its `README.md`, then the matching chapter):
|
|
25
|
+
`.claude/automated-functional-testing-recipes/` in the project,
|
|
26
|
+
`~/.claude/automated-functional-testing-recipes/`, or
|
|
27
|
+
https://github.com/webship/webship-js-ai-agent/tree/2.0.x/automated-functional-testing-recipes
|
|
28
|
+
|
|
29
|
+
Report what ran, what passed, and for each failure the step, its message, and the change you propose.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Build a Umami project in a sites folder, serve it, and prove it with webship-js.
|
|
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 the Umami project named <name> in this sites folder, serve it 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 project somebody still needs
|
|
10
|
+
# nothing on the host: never print a password, the app's secret, a session cookie or a CSRF token
|
|
11
|
+
# a feature to write or a run to read: the book Automated Functional Testing Recipes first (its README.md, then the matching chapter), from .claude/automated-functional-testing-recipes/ in the project, ~/.claude/automated-functional-testing-recipes/ or https://github.com/webship/webship-js-ai-agent/tree/2.0.x/automated-functional-testing-recipes
|
|
12
|
+
|
|
13
|
+
1. bash cmd-umami-project.sh <name> --install (Umami with PostgreSQL, its default admin password replaced: a few minutes)
|
|
14
|
+
2. bash cmd-tools-testing.sh <name> (webship-js, the step pack for Umami, the admin and its password file, a first feature)
|
|
15
|
+
3. bash cmd-tools-testing.sh <name> --run, and read every failure from its message and hint
|
|
16
|
+
4. Add one scenario of your own for <what the statistics should show>, from the skill umami-scenarios, and run it
|
|
17
|
+
|
|
18
|
+
Report the address, what ran, what passed, and what you changed.
|
|
19
|
+
"""
|
|
20
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Write webship-js scenarios for a Umami project that already exists in the Webship Workspace.
|
|
2
|
+
|
|
3
|
+
The launch command below is for Claude Code, the default; the text between the triple quotes can be given to another AI CLI as it is.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
claude --permission-mode bypassPermissions """
|
|
7
|
+
Write webship-js scenarios for the Umami project <name> in this sites folder
|
|
8
|
+
# ~/workspace/<dev|test|sandboxes|demos> · https://<name>.ddev.site · container-based (DDEV by default)
|
|
9
|
+
# the step pack for Umami removes every website and user a scenario makes
|
|
10
|
+
# a feature to write or a run to read: the book Automated Functional Testing Recipes first (its README.md, then the matching chapter), from .claude/automated-functional-testing-recipes/ in the project, ~/.claude/automated-functional-testing-recipes/ or https://github.com/webship/webship-js-ai-agent/tree/2.0.x/automated-functional-testing-recipes
|
|
11
|
+
|
|
12
|
+
1. When the project has no cucumber.js, run bash cmd-tools-testing.sh <name>
|
|
13
|
+
2. Write tests/features/websites.feature (a website added, its tracking code, page views sent and counted, its pages) and tests/features/people.feature (the admin's session, a view-only user who may not add a website), with the skill umami-scenarios
|
|
14
|
+
3. bash cmd-tools-testing.sh <name> --run, until every scenario passes for a reason you can say
|
|
15
|
+
|
|
16
|
+
Report the scenarios, what ran, and what passed.
|
|
17
|
+
"""
|
|
18
|
+
```
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: umami-scenarios
|
|
3
|
+
description: The phrases of the step pack for Umami (@webship-js/umami-steps) for webship-js scenarios of an Umami project built in the container-based Webship Workspace (DDEV by default) with cmd-umami-project.sh — signing in as the admin or a user the scenario made, a wrong password refused, the sign-in token kept safe for the scheme, users and their roles, websites added, renamed and deleted, their tracking code, page views sent the way the tracker does, the views, visitors, pages and referrers the overview counts, no outside requests. Use when writing or fixing a feature for such a project, or when a step about the web analytics does not match.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Scenarios for an Umami project
|
|
7
|
+
|
|
8
|
+
A person signs in, adds the website to count, puts its tracking code on the site, and reads how many people came and
|
|
9
|
+
what they read. The pack's phrases say "the web analytics", never the platform's name. The workspace is container-based
|
|
10
|
+
(DDEV by default). The examples are whole features: `examples/session.feature` (the admin's session, a wrong password),
|
|
11
|
+
`examples/websites.feature` (a website added, counted, renamed and deleted) and `examples/people.feature` (a view-only
|
|
12
|
+
helper).
|
|
13
|
+
|
|
14
|
+
## The book
|
|
15
|
+
|
|
16
|
+
For any automated functional testing in this work (a Gherkin feature, a step definition, choosing a
|
|
17
|
+
step, a test run and its failures), read the book *Automated Functional Testing Recipes* first.
|
|
18
|
+
|
|
19
|
+
- **Where.** Use the first that exists: `.claude/automated-functional-testing-recipes/` in the project,
|
|
20
|
+
`~/.claude/automated-functional-testing-recipes/` (installed by webship/webship-js-ai-agent,
|
|
21
|
+
webship/webship-js-skills or webship/ai-agents), or
|
|
22
|
+
https://github.com/webship/webship-js-ai-agent/tree/2.0.x/automated-functional-testing-recipes
|
|
23
|
+
- **How.** Its `README.md` first, then the chapter that matches the task (one file per chapter,
|
|
24
|
+
named by its subject), not the single complete file.
|
|
25
|
+
- **Which wins.** The installed webship-js package and the step pack are the source of truth for
|
|
26
|
+
step phrasing. When they differ from the book, follow them and say so.
|
|
27
|
+
- **For Umami.** Start with `ch10-authentication-authorization.md` (signing in, a view-only user),
|
|
28
|
+
`ch06-form-testing-recipes.md` (the website and user dialogs), `ch08-modal-dialog-testing.md` (the confirmations)
|
|
29
|
+
and `ch07-waiting-dynamic-content.md` (numbers that count up, a page view that arrives later).
|
|
30
|
+
|
|
31
|
+
## Keeping a suite green
|
|
32
|
+
|
|
33
|
+
- The admin is "admin"; its password is read from `.webship-umami/admin-password` (the testing setup names the file).
|
|
34
|
+
Never write a password into a feature. The app's default password never stays: the builder replaces it.
|
|
35
|
+
- A new project has no data: a scenario adds its own website and sends its own page views (paths only, to the app
|
|
36
|
+
only); every website and user it makes is removed at its end, by its exact name.
|
|
37
|
+
- The sign-in token is in the browser's localStorage (`umami.auth`), not a cookie: the pack keeps it secret, and
|
|
38
|
+
"kept safe for its scheme" checks what really exists.
|
|
39
|
+
- The overview's numbers count up when they appear: the steps read them once they have stopped.
|
|
40
|
+
|
|
41
|
+
## The phrases
|
|
42
|
+
|
|
43
|
+
21 step definitions; each has five examples in its JSDoc block.
|
|
44
|
+
|
|
45
|
+
### `umami-session.steps.js` (10)
|
|
46
|
+
|
|
47
|
+
- `Given I am signed in to the web analytics as its admin`
|
|
48
|
+
- `Given I am signed in to the web analytics as "<user>"` (a user the scenario made)
|
|
49
|
+
- `When I sign out of the web analytics`
|
|
50
|
+
- `Then I should be signed out of the web analytics`
|
|
51
|
+
- `Then the web analytics should refuse "<user>" with a wrong password`
|
|
52
|
+
- `Then the web analytics' sign-in should be kept safe for its scheme`
|
|
53
|
+
- `Given the web analytics has a user "<name>" with the role "<Admin|User|View only>"`
|
|
54
|
+
- `Then the web analytics should list the user "<name>" as "<role>"`
|
|
55
|
+
- `Then the web analytics should offer "<button>"` / `should not offer`
|
|
56
|
+
- `Then the web analytics should make no outside requests`
|
|
57
|
+
|
|
58
|
+
### `umami-websites.steps.js` (11)
|
|
59
|
+
|
|
60
|
+
- `When I add the website "<name>" for the domain "<domain>"`
|
|
61
|
+
- `Then the web analytics should list the website "<name>"` / `should not list`
|
|
62
|
+
- `When I change the name of the website "<name>" to "<new>"` (or `the domain`)
|
|
63
|
+
- `Then the website "<name>" should show its icon` (drawn, and from the app itself)
|
|
64
|
+
- `Then the tracking code of the website "<name>" should load the tracker`
|
|
65
|
+
- `When I delete the website "<name>"`
|
|
66
|
+
- `When I send page views of "<path>" and "<path>" to the website "<name>"`
|
|
67
|
+
- `Then the website "<name>" should count <n> views` (or `visitors`, `visits`; optionally `at least`)
|
|
68
|
+
- `Then the pages of the website "<name>" should list "<path>" with <n> visitors`
|
|
69
|
+
- `Then the referrers of the website "<name>" should list "<domain>"`
|
|
70
|
+
- `When I filter the stats of the website "<name>" by the path "<path>"`
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Feature: A helper who may only read the statistics
|
|
2
|
+
As the keeper of the project's website statistics
|
|
3
|
+
I want to give a helper view-only access
|
|
4
|
+
So that they read the numbers and change nothing
|
|
5
|
+
|
|
6
|
+
Scenario: A view-only user may not add a website
|
|
7
|
+
Given I am signed in to the web analytics as its admin
|
|
8
|
+
And the web analytics has a user "plot-keeper" with the role "View only"
|
|
9
|
+
Then the web analytics should list the user "plot-keeper" as "View only"
|
|
10
|
+
When I sign out of the web analytics
|
|
11
|
+
And I am signed in to the web analytics as "plot-keeper"
|
|
12
|
+
Then the web analytics should not offer "Add website"
|
|
13
|
+
When I sign out of the web analytics
|
|
14
|
+
Then I should be signed out of the web analytics
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Feature: Signing in to the web analytics
|
|
2
|
+
As the keeper of the project's website statistics
|
|
3
|
+
I want to sign in and out, and keep my sign-in safe
|
|
4
|
+
So that only the people I choose see the statistics
|
|
5
|
+
|
|
6
|
+
Scenario: The admin signs in and out
|
|
7
|
+
Given I am signed in to the web analytics as its admin
|
|
8
|
+
Then the web analytics' sign-in should be kept safe for its scheme
|
|
9
|
+
And the web analytics should offer "Add website"
|
|
10
|
+
When I sign out of the web analytics
|
|
11
|
+
Then I should be signed out of the web analytics
|
|
12
|
+
And the web analytics should make no outside requests
|
|
13
|
+
|
|
14
|
+
Scenario: A wrong password is refused
|
|
15
|
+
Then the web analytics should refuse "admin" with a wrong password
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Feature: A website added and counted
|
|
2
|
+
As the keeper of the project's website statistics
|
|
3
|
+
I want to add a website, give it its tracking code and see its visits counted
|
|
4
|
+
So that each site is counted under its own name
|
|
5
|
+
|
|
6
|
+
Scenario: Page views sent to a new website are counted
|
|
7
|
+
Given I am signed in to the web analytics as its admin
|
|
8
|
+
When I add the website "Seed Swap" for the domain "seeds.example"
|
|
9
|
+
Then the website "Seed Swap" should show its icon
|
|
10
|
+
And the tracking code of the website "Seed Swap" should load the tracker
|
|
11
|
+
When I send page views of "/", "/swaps" and "/swaps" to the website "Seed Swap"
|
|
12
|
+
Then the website "Seed Swap" should count 3 views
|
|
13
|
+
And the pages of the website "Seed Swap" should list "/swaps" with 2 visitors
|
|
14
|
+
|
|
15
|
+
Scenario: A website renamed, then deleted
|
|
16
|
+
Given I am signed in to the web analytics as its admin
|
|
17
|
+
When I add the website "Garden Club" for the domain "garden.example"
|
|
18
|
+
And I change the name of the website "Garden Club" to "Garden Club News"
|
|
19
|
+
Then the web analytics should list the website "Garden Club News"
|
|
20
|
+
When I delete the website "Garden Club News"
|
|
21
|
+
Then the web analytics should not list the website "Garden Club News"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# workspace-name: Umami (web analytics)
|
|
4
|
+
|
|
5
|
+
# Installed by the Umami plugin (plugins.sh --install umami); __WORKSPACE__ is the workspace it was installed into.
|
|
6
|
+
#
|
|
7
|
+
# Run Umami 3.5.1 from its official image on GHCR, by digest, with the project's PostgreSQL 17. With --install its
|
|
8
|
+
# default admin password (admin / umami) is replaced at the first start with the one in .webship-umami/admin-password
|
|
9
|
+
# (0600). The workspace is container-based (DDEV by default, at https://<name>.ddev.site); --runtime docker, podman or
|
|
10
|
+
# kubernetes builds it on Docker Compose, Podman or a Kubernetes cluster instead.
|
|
11
|
+
|
|
12
|
+
# Bootstrap.
|
|
13
|
+
# Find the workspace tooling from this script, so a fresh clone needs no setup.
|
|
14
|
+
WORKSPACE_SCRIPTS="${WORKSPACE_SCRIPTS:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../core/scripts" && pwd)}";
|
|
15
|
+
source ${WORKSPACE_SCRIPTS}/bootstrap.sh || exit 1 ;
|
|
16
|
+
|
|
17
|
+
# Load workspace settings.
|
|
18
|
+
eval $(parse_yaml ${WORKSPACE_CONFIG}/workspace.__WORKSPACE__.settings.yml);
|
|
19
|
+
|
|
20
|
+
# Distribution.
|
|
21
|
+
distribution_name="umami";
|
|
22
|
+
distribution_title="Umami";
|
|
23
|
+
distribution_webroot="";
|
|
24
|
+
|
|
25
|
+
ARGPARSE_DESCRIPTION="Build a ${distribution_title} project in __WORKSPACE__"
|
|
26
|
+
# The args file comes with the plugin: core/scripts/plugins/umami/ is where plugins.sh --install puts it.
|
|
27
|
+
source ${WORKSPACE_SCRIPTS}/plugins/umami/args/arg-umami.sh || exit 1 ;
|
|
28
|
+
|
|
29
|
+
shift $#;
|
|
30
|
+
|
|
31
|
+
umami_build ;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Umami for Webship Workspace: a plugin for Umami, privacy-friendly web analytics.
|
|
3
|
+
*
|
|
4
|
+
* What the package carries is placed by the installer from the manifest: the builder in the sites folders, its
|
|
5
|
+
* functions, argparse and machine files (the script that replaces the default admin password and makes or removes a
|
|
6
|
+
* user through the app's API, a first feature) under core/scripts/plugins/umami/, and its AI items (ai/) in the AI
|
|
7
|
+
* folders. The builder runs Umami from its official image on GHCR by digest, with the project's PostgreSQL (the core's
|
|
8
|
+
* own: its backup is the core's dump), its default admin password replaced at the first start, and no request
|
|
9
|
+
* elsewhere. The step pack (@webship-js/umami-steps) goes into the testing setup of such a project with the core's
|
|
10
|
+
* `cmd-tools-testing.sh <project>`. What register() adds is what the assistant is told.
|
|
11
|
+
*
|
|
12
|
+
* Everything the dashboard is asked for goes through `api`; this package requires nothing from the dashboard's own
|
|
13
|
+
* files, so it can be installed from npm and removed without a trace.
|
|
14
|
+
*/
|
|
15
|
+
import type { PluginApi } from '@webship.co/workspace-plugin-api';
|
|
16
|
+
/** The plugin's name, which its functions are named after. */
|
|
17
|
+
export declare const PLATFORM = "umami";
|
|
18
|
+
/** The commands the installer places in every sites folder. */
|
|
19
|
+
export declare const COMMANDS: string[];
|
|
20
|
+
/** The agents the installer places in the AI Agents folder. */
|
|
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 prompts the installer places in the AI Prompts folder: whole launch commands for a new session. */
|
|
27
|
+
export declare const PROMPTS: string[];
|
|
28
|
+
/** What the assistant is told about Umami in this workspace. */
|
|
29
|
+
export declare function assistantContext(): string;
|
|
30
|
+
export declare function register(api: PluginApi): void;
|