@webship.co/workspace-filament 0.0.0-stage → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +271 -2
- package/ai/agents/filament-site-builder.md +108 -0
- package/ai/agents/filament-tester.md +131 -0
- package/ai/commands/filament-test.md +95 -0
- package/ai/prompts/filament-build-and-test.md +25 -0
- package/ai/prompts/filament-scenarios-for-a-resource.md +32 -0
- package/ai/skills/filament-scenarios/SKILL.md +127 -0
- package/ai/skills/filament-scenarios/examples/form-and-modal.feature +23 -0
- package/ai/skills/filament-scenarios/examples/session-and-navigation.feature +22 -0
- package/ai/skills/filament-scenarios/examples/table.feature +28 -0
- package/commands/cmd-filament-project.sh +38 -0
- package/dist/src/index.d.ts +34 -0
- package/dist/src/index.js +57 -0
- package/dist/src/index.js.map +1 -0
- package/features/filament-runtimes.feature +53 -0
- package/features/filament.feature +43 -0
- package/package.json +96 -4
- package/scripts/args/arg-filament.sh +39 -0
- package/scripts/functions/fun-filament.sh +478 -0
- package/testing/panel.feature +34 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Write and run the webship-js scenarios of one resource of a Filament admin panel: its list, its form and its actions.
|
|
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 the scenarios of the <resource> resource of the admin panel of this app, and run them
|
|
8
|
+
# ~/workspace/<folder>/<app> · https://<app>.ddev.site · container-based (DDEV by default)
|
|
9
|
+
# the phrases are in the filament-scenarios skill; the filament-tester agent is the one to hand this work over to
|
|
10
|
+
# look at the panel first: in the Playwright MCP browser, in a tab of your own, open the list, the form and the actions of the resource by hand once before writing a scenario
|
|
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
|
+
The resource: <the name of its list in the sidebar, as "Products">.
|
|
14
|
+
Cover: its list (a search, a sorting, a filter and its indicator, the columns, the pages),
|
|
15
|
+
its form (each kind of field it has, a refusal of a required field, a save), and its actions (a row action, a bulk action with its confirmation).
|
|
16
|
+
|
|
17
|
+
Read the installed steps first:
|
|
18
|
+
grep -hE '^(Given|When|Then)\(' node_modules/@webship-js/filament-steps/tests/step-definitions/*.steps.js
|
|
19
|
+
|
|
20
|
+
Write one feature in tests/features/<resource>.feature, from phrases that exist.
|
|
21
|
+
Log in by the handle of the users registry (administrator):
|
|
22
|
+
no password in the feature, no account created by a scenario, no platform name in a step phrase.
|
|
23
|
+
What a scenario makes, it deletes (Given there is no "<record>" in the "<list>" list removes a leftover first); put back a sorting, a filter or a choice of columns a scenario changed.
|
|
24
|
+
|
|
25
|
+
Then, from the sites folder (cd ..):
|
|
26
|
+
bash cmd-tools-testing.sh <app> --dry-run --path tests/features/<resource>.feature
|
|
27
|
+
bash cmd-tools-testing.sh <app> --run --path tests/features/<resource>.feature
|
|
28
|
+
|
|
29
|
+
A failing scenario is a result: tell me what the panel did, do not loosen the scenario.
|
|
30
|
+
When you are done: the scenarios, the result of the run, and any step you could not find in the packs
|
|
31
|
+
"""
|
|
32
|
+
```
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: filament-scenarios
|
|
3
|
+
description: Write webship-js scenarios for a Filament admin panel of a Laravel app from phrases that exist — the steps of @webship-js/filament-steps by area (the sidebar and the pages, the tables, the forms and their fields, repeaters and builders, modals and slide-overs, relation managers and view pages, widgets, the global search, the notifications drawer, the theme, the tenants) and the Laravel pack's steps it brings along (the login, the toasts, the errors under a field, the mail, the error pages), the handles of the users registry, the traps found on a real panel, and three example features. Use when writing or fixing a scenario for an app with a panel, choosing a step, or checking that a phrase exists.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# filament-scenarios
|
|
7
|
+
|
|
8
|
+
Scenarios for a Filament admin panel, written with webship-js and two step packs:
|
|
9
|
+
[`@webship-js/filament-steps`](https://github.com/webship/filament-steps) (the panel) and
|
|
10
|
+
[`@webship-js/laravel-steps`](https://github.com/webship/laravel-steps), which the panel's pack loads
|
|
11
|
+
itself (the login, the toasts, the errors under a field, the mail, the framework's pages). The
|
|
12
|
+
installed packages are the source of truth: check a phrase there before using it
|
|
13
|
+
(`node_modules/@webship-js/filament-steps/tests/step-definitions/`, each step with five examples).
|
|
14
|
+
In a Webship Workspace, a container-based workspace (DDEV by default), `bash cmd-tools-testing.sh <app>`
|
|
15
|
+
sets the suite up and `bash cmd-tools-testing.sh <app> --run` runs it in the app's container.
|
|
16
|
+
|
|
17
|
+
## The accounts
|
|
18
|
+
|
|
19
|
+
The users registry of `cucumber.js` names the accounts by handle; the Webship Workspace writes them
|
|
20
|
+
(`bash cmd-tools-add-users.sh <app> filament`):
|
|
21
|
+
|
|
22
|
+
| Handle | What the panel does with it |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| `administrator` | lets it in (its address is verified) |
|
|
25
|
+
| `unverified` | refuses it at its login form ("These credentials do not match our records."); a session of it gets the 403 page |
|
|
26
|
+
|
|
27
|
+
A scenario never creates or deletes an account, and never writes a password: `When I fill in
|
|
28
|
+
"Password" with the password of "administrator"`.
|
|
29
|
+
|
|
30
|
+
## Phrases by area
|
|
31
|
+
|
|
32
|
+
**The session** (the Laravel pack's steps, on the panel's login page):
|
|
33
|
+
`Given I am a logged in user with the "administrator" user`, `When I log in as "administrator" with
|
|
34
|
+
the login form`, `When I log in with the email "nobody@example.com" and the password "Wrong-password-1"`,
|
|
35
|
+
`Then the "Email address" field should have the error "These credentials do not match our records."`,
|
|
36
|
+
`When I log out`, `Then I should be logged in as "administrator"`, `Then I should not be logged in`,
|
|
37
|
+
`Then I should see the login form`, `Then the user menu should offer "Sign out"`.
|
|
38
|
+
|
|
39
|
+
**The sidebar and the pages:** `Given I am on the "Products" list`, `When I open "Shop Dashboard"
|
|
40
|
+
from the sidebar`, `Then the sidebar should list "Products"`, `Then the "Orders" item of the sidebar
|
|
41
|
+
should show a badge`, `Then the sidebar should show "Products" as the current page`, `When I collapse
|
|
42
|
+
the "Shop" group of the sidebar`, `Then the page heading should be "Products"`, `Then the breadcrumbs
|
|
43
|
+
should read "Products › List"`, `Then I should be on the "Products" list`, `When I open "<record>"
|
|
44
|
+
from the list`, `When I create a new record from the list`, `When I open the "Edit" page of the
|
|
45
|
+
record`.
|
|
46
|
+
|
|
47
|
+
**A table:** `When I search the list for "kettle"`, `Then the list should count 3 products`, `Then
|
|
48
|
+
the list should have 10 rows`, `Then the list should show "<record>"`, `Then the "<record>" row
|
|
49
|
+
should show "<value>" in the "Brand" column`, `Then the first row of the list should be "<record>"`,
|
|
50
|
+
`Then the list should be empty`, `When I sort the list by "Price" in descending order`, `Then the list
|
|
51
|
+
should be sorted by "Price" in descending order`, `When I choose "Only deleted records" in the
|
|
52
|
+
"Deleted records" filter`, `Then the list should have the filter "Only deleted records"`, `When I
|
|
53
|
+
remove the filter "Only deleted records"`, `When I clear all filters`, `When I choose the
|
|
54
|
+
"Processing" tab of the list`, `When I hide the "SKU" column`, `When I go to page 2 of the list`,
|
|
55
|
+
`When I show 25 products per page`, `When I group the list by "Order date"`, `When I select all
|
|
56
|
+
products on the page`, `Then the selection should read "3 records selected"`, `When I run the bulk
|
|
57
|
+
action "Delete selected"`, `When I turn reordering of the list on`. A relation manager's table is
|
|
58
|
+
named by its heading: `Then the "Addresses" list should be empty`.
|
|
59
|
+
|
|
60
|
+
**Actions and modals:** `When I run the "Ship" action on the "<record>" row`, `Then the "<record>"
|
|
61
|
+
row should offer the "Process" action`, `When I run the "Edit" action of the page`, `When I run the
|
|
62
|
+
"New address" action of the "Addresses" list`, `Then the "Send email" modal should be open`, `Then the
|
|
63
|
+
"Ship" slide-over should be open`, `Then the modal should ask "Are you sure you would like to do
|
|
64
|
+
this?"`, `When I confirm the modal`, `When I cancel the modal`, `When I close the open modal`, `Then
|
|
65
|
+
no modal should be open`; and the toasts (the Laravel pack): `Then I should see the success
|
|
66
|
+
notification "Saved"`.
|
|
67
|
+
|
|
68
|
+
**A form:** `When I set "Status" to "New"`, `When I set these fields:`, `Then "Status" should be set
|
|
69
|
+
to "New"`, `Then the "Number" field should be read only`, `Then the form should show the field
|
|
70
|
+
"Salary"`, `When I open the "Employment" tab`, `When I go to the next step of the wizard`, `Then the
|
|
71
|
+
wizard should be on the "Order Items" step`, `When I add a row to "Order items"`, `When I set
|
|
72
|
+
"Quantity" to "2" in row 1 of "Order items"`, `When I add the "Milestone" block to "Plan"`, `Then the
|
|
73
|
+
rows of "Plan" should be "Milestone" and "Checkpoint"`, `When I move row 2 of "Plan" up`, `When I
|
|
74
|
+
remove row 1 of "Plan"`, `When I add the property "desk" with the value "B7" to "Metadata"`, `When I
|
|
75
|
+
upload "photo.jpg" to the "Images" field`, `Then the "Images" field should hold the file "photo.jpg"`,
|
|
76
|
+
`When I save the form`, `When I create the record`, `When I delete the record`, `Given there is no
|
|
77
|
+
"<record>" in the "Tasks" list`; and the field errors (the Laravel pack): `Then the "Title" field
|
|
78
|
+
should block submission as required`.
|
|
79
|
+
|
|
80
|
+
**What a page shows to be read:** `Then the stat "Revenue / Customer" should show a value`, `Then
|
|
81
|
+
the "Customer Growth" chart should be drawn`, `Then the page should show the widget "Flagged Orders"`,
|
|
82
|
+
`Then the "Title" entry should read "<value>"`.
|
|
83
|
+
|
|
84
|
+
**Around the pages:** `When I search the panel for "kettle"`, `Then the global search should find
|
|
85
|
+
"<record>"`, `Then the global search should find nothing`, `When I open the notifications drawer`,
|
|
86
|
+
`Then the notifications drawer should list "New order"`, `When I clear the notifications drawer`,
|
|
87
|
+
`When I switch the admin theme to "dark"`, `Then the admin theme should be "dark"`, `When I switch the
|
|
88
|
+
current tenant to "<team>"`, `Then the current tenant should be "<team>"`.
|
|
89
|
+
|
|
90
|
+
## Traps found on a real panel
|
|
91
|
+
|
|
92
|
+
- **Labels carry a required mark.** The form writes "Name*": name the field "Name".
|
|
93
|
+
- **A list that searches the server** shows its options only once something is typed: `When I set
|
|
94
|
+
"Customer" to "<name>"` types the name and picks the option.
|
|
95
|
+
- **Some cells copy their text on a click** (an order number): `When I open "<record>" from the list`
|
|
96
|
+
clicks another cell of the row.
|
|
97
|
+
- **The demo refuses its tables' deletions** with a warning toast, and keeps deleted orders and
|
|
98
|
+
employees until "Force delete" on their edit page.
|
|
99
|
+
- **The dashboard keeps its filters in the session**, the tables their per-page choice: put back what
|
|
100
|
+
a scenario changed.
|
|
101
|
+
- **The login is limited to five attempts a minute from one browser**, whatever the account: keep the
|
|
102
|
+
session reuse of `cucumber.js` on, and log in through the form only where a scenario tests the form.
|
|
103
|
+
- **Error pages** log a failed resource in the browser console: tag their scenarios `@js-off`.
|
|
104
|
+
|
|
105
|
+
## Examples
|
|
106
|
+
|
|
107
|
+
Three features in `examples/` pass on the demo app the Webship Workspace builds
|
|
108
|
+
(`cmd-filament-project.sh <name> --install --add-users --demo`) and change nothing in it:
|
|
109
|
+
`session-and-navigation.feature`, `table.feature`, `form-and-modal.feature`.
|
|
110
|
+
|
|
111
|
+
## The book
|
|
112
|
+
|
|
113
|
+
For any automated functional testing in this work (a Gherkin feature, a step definition, choosing a
|
|
114
|
+
step, a test run and its failures), read the book *Automated Functional Testing Recipes* first.
|
|
115
|
+
|
|
116
|
+
- **Where.** Use the first that exists: `.claude/automated-functional-testing-recipes/` in the project,
|
|
117
|
+
`~/.claude/automated-functional-testing-recipes/` (installed by webship/webship-js-ai-agent,
|
|
118
|
+
webship/webship-js-skills or webship/ai-agents), or
|
|
119
|
+
https://github.com/webship/webship-js-ai-agent/tree/2.0.x/automated-functional-testing-recipes
|
|
120
|
+
- **How.** Its `README.md` first, then the chapter that matches the task (one file per chapter,
|
|
121
|
+
named by its subject), not the single complete file.
|
|
122
|
+
- **Which wins.** The installed webship-js package and the step pack are the source of truth for
|
|
123
|
+
step phrasing. When they differ from the book, follow them and say so.
|
|
124
|
+
- **For Filament.** Start with `ch06-form-testing-recipes.md` (the fields of a form and their
|
|
125
|
+
errors), `ch08-modal-dialog-testing.md` (the modals and slide-overs of the actions),
|
|
126
|
+
`ch09-table-list-testing.md` (the tables of the resources) and `ch07-waiting-dynamic-content.md`
|
|
127
|
+
(a panel that answers every action from the server).
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Feature: The fields of a form
|
|
2
|
+
On the panel's demo app built by the Webship Workspace (--demo). Nothing here is saved.
|
|
3
|
+
|
|
4
|
+
Background:
|
|
5
|
+
Given I am a logged in user with the "administrator" user
|
|
6
|
+
|
|
7
|
+
Scenario: A required field left empty keeps the form from being sent
|
|
8
|
+
Given I am on the "Tasks" list
|
|
9
|
+
When I create a new record from the list
|
|
10
|
+
And I create the record
|
|
11
|
+
Then the "Title" field should block submission as required
|
|
12
|
+
And the page heading should be "Create Task"
|
|
13
|
+
|
|
14
|
+
Scenario: The fields a form shows as another field changes, on its tabs
|
|
15
|
+
Given I am on the "Employees" list
|
|
16
|
+
When I create a new record from the list
|
|
17
|
+
Then the "Personal" tab should be open
|
|
18
|
+
When I open the "Employment" tab
|
|
19
|
+
And I set "Employment type" to "Contractor"
|
|
20
|
+
Then the form should show the field "Hourly rate"
|
|
21
|
+
And the form should not show the field "Salary"
|
|
22
|
+
When I set "Employment type" to "Full Time"
|
|
23
|
+
Then the form should show the field "Salary"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Feature: The session and the sidebar of the panel
|
|
2
|
+
On the panel's demo app built by the Webship Workspace (cmd-filament-project.sh <name> --install
|
|
3
|
+
--add-users --demo): its admin panel is at the root of the app, its login page at /login.
|
|
4
|
+
|
|
5
|
+
Scenario: The administrator logs in and finds the pages of the panel in its sidebar
|
|
6
|
+
Given I am a logged in user with the "administrator" user
|
|
7
|
+
Then I should be logged in as "administrator"
|
|
8
|
+
And the sidebar should list "Products"
|
|
9
|
+
And the sidebar should list "Employees"
|
|
10
|
+
When I open "Products" from the sidebar
|
|
11
|
+
Then I should be on the "Products" list
|
|
12
|
+
And the breadcrumbs should read "Products › List"
|
|
13
|
+
And the sidebar should show "Products" as the current page
|
|
14
|
+
|
|
15
|
+
@js-off
|
|
16
|
+
Scenario: The panel refuses the account whose address is not verified
|
|
17
|
+
Given I am an anonymous user
|
|
18
|
+
When I go to "/login"
|
|
19
|
+
And I fill in "Email address" with the email of "unverified"
|
|
20
|
+
And I fill in "Password" with the password of "unverified"
|
|
21
|
+
And I press "Sign in"
|
|
22
|
+
Then the "Email address" field should have the error "These credentials do not match our records."
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Feature: The list of the products
|
|
2
|
+
On the panel's demo app built by the Webship Workspace (--demo): its products come from its own
|
|
3
|
+
seed. Nothing here changes a record.
|
|
4
|
+
|
|
5
|
+
Background:
|
|
6
|
+
Given I am a logged in user with the "administrator" user
|
|
7
|
+
And I am on the "Products" list
|
|
8
|
+
|
|
9
|
+
Scenario: A search that finds nothing, and the list back
|
|
10
|
+
When I search the list for "no product of the app has this name"
|
|
11
|
+
Then the list should be empty
|
|
12
|
+
When I clear the search of the list
|
|
13
|
+
Then the list should have 10 rows
|
|
14
|
+
|
|
15
|
+
Scenario: Sorting both ways, and the records per page
|
|
16
|
+
When I sort the list by "Price" in descending order
|
|
17
|
+
Then the list should be sorted by "Price" in descending order
|
|
18
|
+
When I show 5 products per page
|
|
19
|
+
Then the list should have 5 rows
|
|
20
|
+
When I show 10 products per page
|
|
21
|
+
Then the list should have 10 rows
|
|
22
|
+
|
|
23
|
+
Scenario: A bulk action the demo refuses, with its confirmation
|
|
24
|
+
When I select all products on the page
|
|
25
|
+
Then the selection should read "10 records selected"
|
|
26
|
+
When I run the bulk action "Delete selected"
|
|
27
|
+
And I confirm the modal
|
|
28
|
+
Then I should see the warning notification "Now, now, don't be cheeky, leave some records for others to play with!"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# workspace-name: Filament (admin panel on Laravel)
|
|
4
|
+
|
|
5
|
+
# Installed by the Filament plugin (plugins.sh --install filament); __WORKSPACE__ is the workspace it was installed into.
|
|
6
|
+
#
|
|
7
|
+
# Build a Laravel app with an admin panel in a container, on DDEV (the default) at
|
|
8
|
+
# https://<name>.ddev.site, or with --runtime docker, podman, kubernetes, lando or docksal on that
|
|
9
|
+
# runtime, at the address the build prints: a new app made by
|
|
10
|
+
# the Laravel plugin's builder (the official installer and a starter kit) with the panel installed the
|
|
11
|
+
# documented way (its admin panel at /admin), or with --demo the panel's official demo app (its admin
|
|
12
|
+
# panel at the root of the app). With --install its database is migrated and the workspace account is
|
|
13
|
+
# the panel's first account; with --add-users it also gets the default accounts. The panel's CLI is
|
|
14
|
+
# Artisan, through the Laravel plugin's tool: bash cmd-tools-laravel-artisan.sh <name> --run "about".
|
|
15
|
+
|
|
16
|
+
# Bootstrap.
|
|
17
|
+
# Find the workspace tooling from this script, so a fresh clone needs no setup.
|
|
18
|
+
WORKSPACE_SCRIPTS="${WORKSPACE_SCRIPTS:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../core/scripts" && pwd)}";
|
|
19
|
+
source ${WORKSPACE_SCRIPTS}/bootstrap.sh || exit 1 ;
|
|
20
|
+
|
|
21
|
+
# Load workspace settings.
|
|
22
|
+
eval $(parse_yaml ${WORKSPACE_CONFIG}/workspace.__WORKSPACE__.settings.yml);
|
|
23
|
+
|
|
24
|
+
# Set the starter kit of a new app (the Laravel plugin's builder makes it).
|
|
25
|
+
site_starter_kit="livewire";
|
|
26
|
+
|
|
27
|
+
# Distribution.
|
|
28
|
+
distribution_name="filament";
|
|
29
|
+
distribution_title="Filament";
|
|
30
|
+
distribution_webroot="public";
|
|
31
|
+
|
|
32
|
+
ARGPARSE_DESCRIPTION="Build a Laravel app with a ${distribution_title} admin panel in __WORKSPACE__"
|
|
33
|
+
# The args file comes with the plugin: core/scripts/plugins/filament/ is where plugins.sh --install puts it.
|
|
34
|
+
source ${WORKSPACE_SCRIPTS}/plugins/filament/args/arg-filament.sh || exit 1 ;
|
|
35
|
+
|
|
36
|
+
shift $#;
|
|
37
|
+
|
|
38
|
+
filament_build ;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filament for Webship Workspace: a platform plugin that builds on the Laravel plugin.
|
|
3
|
+
*
|
|
4
|
+
* What the package carries is placed by the installer from the manifest: the builder in the sites
|
|
5
|
+
* folders, its functions and argparse under core/scripts/plugins/filament/ (with the first feature of
|
|
6
|
+
* a panel's testing setup), and its AI items (ai/ in this package) in the folder of their kind: the
|
|
7
|
+
* agents in AI Agents, the skill in AI Skills, the command in AI Commands, the prompts in AI Prompts. It
|
|
8
|
+
* needs the Laravel plugin (the manifest's `needs`): a new app starts from that plugin's builder, the
|
|
9
|
+
* accounts are written with its writer, and the panel's CLI is its Artisan tool. The dashboard needs
|
|
10
|
+
* nothing drawn for it: the builder is in the Build list because it is a cmd-*-project.sh, the row menus
|
|
11
|
+
* are the core's, the AI items are listed like any other. What register() adds is what the assistant is
|
|
12
|
+
* told.
|
|
13
|
+
*
|
|
14
|
+
* Everything the dashboard is asked for goes through `api`; this package requires nothing from the
|
|
15
|
+
* dashboard's own files, so it can be installed from npm and removed without a trace.
|
|
16
|
+
*/
|
|
17
|
+
import type { PluginApi } from '@webship.co/workspace-plugin-api';
|
|
18
|
+
/** The plugin's name. An app with a panel is a project of the DDEV type `laravel`, with filament/filament in its composer.json. */
|
|
19
|
+
export declare const PLATFORM = "filament";
|
|
20
|
+
/** The plugin this one builds on: its builder, its account writer and its Artisan tool. */
|
|
21
|
+
export declare const BASE = "laravel";
|
|
22
|
+
/** The commands the installer places in every sites folder. The panel's CLI is the Laravel plugin's Artisan tool. */
|
|
23
|
+
export declare const COMMANDS: string[];
|
|
24
|
+
/** The agents the installer places in the AI Agents folder. */
|
|
25
|
+
export declare const AGENTS: string[];
|
|
26
|
+
/** The skill the installer places in the AI Skills folder (a folder each, with its SKILL.md). */
|
|
27
|
+
export declare const SKILLS: string[];
|
|
28
|
+
/** The slash command the installer places in the AI Commands folder. */
|
|
29
|
+
export declare const AI_COMMANDS: string[];
|
|
30
|
+
/** The prompts the installer places in the AI Prompts folder: each a whole launch command for a new session. */
|
|
31
|
+
export declare const PROMPTS: string[];
|
|
32
|
+
/** What the assistant is told about Filament in this workspace. */
|
|
33
|
+
export declare function assistantContext(): string;
|
|
34
|
+
export declare function register(api: PluginApi): void;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Filament for Webship Workspace: a platform plugin that builds on the Laravel plugin.
|
|
4
|
+
*
|
|
5
|
+
* What the package carries is placed by the installer from the manifest: the builder in the sites
|
|
6
|
+
* folders, its functions and argparse under core/scripts/plugins/filament/ (with the first feature of
|
|
7
|
+
* a panel's testing setup), and its AI items (ai/ in this package) in the folder of their kind: the
|
|
8
|
+
* agents in AI Agents, the skill in AI Skills, the command in AI Commands, the prompts in AI Prompts. It
|
|
9
|
+
* needs the Laravel plugin (the manifest's `needs`): a new app starts from that plugin's builder, the
|
|
10
|
+
* accounts are written with its writer, and the panel's CLI is its Artisan tool. The dashboard needs
|
|
11
|
+
* nothing drawn for it: the builder is in the Build list because it is a cmd-*-project.sh, the row menus
|
|
12
|
+
* are the core's, the AI items are listed like any other. What register() adds is what the assistant is
|
|
13
|
+
* told.
|
|
14
|
+
*
|
|
15
|
+
* Everything the dashboard is asked for goes through `api`; this package requires nothing from the
|
|
16
|
+
* dashboard's own files, so it can be installed from npm and removed without a trace.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.PROMPTS = exports.AI_COMMANDS = exports.SKILLS = exports.AGENTS = exports.COMMANDS = exports.BASE = exports.PLATFORM = void 0;
|
|
20
|
+
exports.assistantContext = assistantContext;
|
|
21
|
+
exports.register = register;
|
|
22
|
+
/** The plugin's name. An app with a panel is a project of the DDEV type `laravel`, with filament/filament in its composer.json. */
|
|
23
|
+
exports.PLATFORM = 'filament';
|
|
24
|
+
/** The plugin this one builds on: its builder, its account writer and its Artisan tool. */
|
|
25
|
+
exports.BASE = 'laravel';
|
|
26
|
+
/** The commands the installer places in every sites folder. The panel's CLI is the Laravel plugin's Artisan tool. */
|
|
27
|
+
exports.COMMANDS = ['cmd-filament-project.sh'];
|
|
28
|
+
/** The agents the installer places in the AI Agents folder. */
|
|
29
|
+
exports.AGENTS = ['filament-site-builder', 'filament-tester'];
|
|
30
|
+
/** The skill the installer places in the AI Skills folder (a folder each, with its SKILL.md). */
|
|
31
|
+
exports.SKILLS = ['filament-scenarios'];
|
|
32
|
+
/** The slash command the installer places in the AI Commands folder. */
|
|
33
|
+
exports.AI_COMMANDS = ['filament-test'];
|
|
34
|
+
/** The prompts the installer places in the AI Prompts folder: each a whole launch command for a new session. */
|
|
35
|
+
exports.PROMPTS = ['filament-build-and-test', 'filament-scenarios-for-a-resource'];
|
|
36
|
+
/** What the assistant is told about Filament in this workspace. */
|
|
37
|
+
function assistantContext() {
|
|
38
|
+
return [
|
|
39
|
+
'Filament (a plugin, @webship.co/workspace-filament, which needs the Laravel plugin): an app with an admin panel is built with',
|
|
40
|
+
'`bash cmd-filament-project.sh <name> --install --add-users` from a sites folder (dev, test, sandboxes, demos):',
|
|
41
|
+
'a new Laravel app made by the Laravel plugin\'s builder (`--starter-kit livewire|react|vue`) with the panel installed the documented way, its admin panel at /admin;',
|
|
42
|
+
'or with `--demo` the panel\'s official demo app (a shop, a blog, an HR suite, its own seed), its admin panel at the root of the app and a second panel with teams at /app.',
|
|
43
|
+
'It runs in a container like every other project: on DDEV by default, at https://<name>.ddev.site, or with `--runtime docker|podman|kubernetes|lando|docksal`',
|
|
44
|
+
'on that runtime, at the address the build prints; `--production` runs it as a live app runs.',
|
|
45
|
+
'The panel\'s CLI is Artisan through the Laravel plugin\'s tool: `bash cmd-tools-laravel-artisan.sh <name> --run "<artisan command>"` (make:filament-resource, filament:upgrade, about).',
|
|
46
|
+
'`bash cmd-tools-add-users.sh <name> filament` adds the default accounts (administrator, its address verified: the panel lets it in; unverified: the panel refuses it).',
|
|
47
|
+
'`bash cmd-tools-testing.sh <name>` sets up webship-js with the Filament step pack (it brings the Laravel step pack along); `--run` runs the suite.',
|
|
48
|
+
`For Filament work, hand over to the agents ${exports.AGENTS.map((a) => `\`${a}\``).join(' and ')}.`,
|
|
49
|
+
`The plugin also places the skill ${exports.SKILLS.map((a) => `\`${a}\``).join(', ')} (the step pack's phrases, by area) in ai-skills/,`,
|
|
50
|
+
`the command ${exports.AI_COMMANDS.map((a) => `\`/${a} <app>\``).join(', ')} in ai-commands/ and the prompts ${exports.PROMPTS.map((a) => `\`${a}\``).join(' and ')} in ai-prompts/.`,
|
|
51
|
+
'Never run php, composer, npm or artisan on the host for a project; never write database settings into its .env by hand.',
|
|
52
|
+
].join(' ');
|
|
53
|
+
}
|
|
54
|
+
function register(api) {
|
|
55
|
+
api.addAssistantContext(assistantContext);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AA0BH,4CAgBC;AAED,4BAEC;AA1CD,mIAAmI;AACtH,QAAA,QAAQ,GAAG,UAAU,CAAC;AAEnC,2FAA2F;AAC9E,QAAA,IAAI,GAAG,SAAS,CAAC;AAE9B,qHAAqH;AACxG,QAAA,QAAQ,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAEpD,+DAA+D;AAClD,QAAA,MAAM,GAAG,CAAC,uBAAuB,EAAE,iBAAiB,CAAC,CAAC;AAEnE,iGAAiG;AACpF,QAAA,MAAM,GAAG,CAAC,oBAAoB,CAAC,CAAC;AAE7C,wEAAwE;AAC3D,QAAA,WAAW,GAAG,CAAC,eAAe,CAAC,CAAC;AAE7C,gHAAgH;AACnG,QAAA,OAAO,GAAG,CAAC,yBAAyB,EAAE,mCAAmC,CAAC,CAAC;AAExF,mEAAmE;AACnE,SAAgB,gBAAgB;IAC9B,OAAO;QACL,+HAA+H;QAC/H,gHAAgH;QAChH,sKAAsK;QACtK,4KAA4K;QAC5K,8JAA8J;QAC9J,8FAA8F;QAC9F,yLAAyL;QACzL,wKAAwK;QACxK,oJAAoJ;QACpJ,8CAA8C,cAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG;QAC5F,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,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,oCAAoC,eAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB;QACrK,yHAAyH;KAC1H,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,53 @@
|
|
|
1
|
+
Feature: An app with a panel on Docker Compose and on Kubernetes
|
|
2
|
+
The builder builds on DDEV by default, and with --runtime on Docker Compose, Podman, Kubernetes, Lando or
|
|
3
|
+
Docksal. An app built on Docker Compose or Kubernetes has the row a DDEV site has: its state, its own address,
|
|
4
|
+
the runtime's menu, and the test users of the plugin in its Tests menu.
|
|
5
|
+
|
|
6
|
+
# Each scenario drives a real app of that runtime, built with cmd-filament-project.sh --runtime: the first running
|
|
7
|
+
# one the workspace holds that the plugin claims. Without one it is skipped, with the reason. In the plugin's CI
|
|
8
|
+
# the Docker Compose app is the one the manifest's featuresSite builds (the panel's demo app). The login page
|
|
9
|
+
# is read by what a login form of either kind of app shows: the demo's panel is at the root, a new app's at /admin.
|
|
10
|
+
|
|
11
|
+
@needs-runtime-docker @needs-platform-filament
|
|
12
|
+
Scenario: An app built on Docker Compose runs at its own address, with the DOCKER menu
|
|
13
|
+
Given I am on the folder of the "docker" site
|
|
14
|
+
Then the row of the "docker" site should show "Running"
|
|
15
|
+
And the row of the "docker" site should link to the address of its runtime
|
|
16
|
+
And the address of the "docker" site should answer
|
|
17
|
+
And the row of the "docker" site should carry the "DOCKER" menu and no DDEV menu
|
|
18
|
+
|
|
19
|
+
@needs-runtime-docker @needs-platform-filament
|
|
20
|
+
Scenario: The Tests menu of an app on Docker Compose offers the test users
|
|
21
|
+
Given I am on the folder of the "docker" site
|
|
22
|
+
When I open the "tests" menu of the "docker" site
|
|
23
|
+
Then the open menu should offer "Add the test users"
|
|
24
|
+
And the open menu should offer "Cancel the test users"
|
|
25
|
+
|
|
26
|
+
@needs-runtime-docker @needs-platform-filament
|
|
27
|
+
Scenario: The app on Docker Compose is installed: its login page
|
|
28
|
+
Given I am on the folder of the "docker" site
|
|
29
|
+
When I open "/login" on the "docker" site
|
|
30
|
+
Then I should see "Email address"
|
|
31
|
+
And I should see "Password"
|
|
32
|
+
|
|
33
|
+
@needs-runtime-kubernetes @needs-platform-filament
|
|
34
|
+
Scenario: An app built on Kubernetes runs at the address of its node, with the K8S menu
|
|
35
|
+
Given I am on the folder of the "kubernetes" site
|
|
36
|
+
Then the row of the "kubernetes" site should show "Running"
|
|
37
|
+
And the row of the "kubernetes" site should link to the address of its runtime
|
|
38
|
+
And the address of the "kubernetes" site should answer
|
|
39
|
+
And the row of the "kubernetes" site should carry the "K8S" menu and no DDEV menu
|
|
40
|
+
|
|
41
|
+
@needs-runtime-kubernetes @needs-platform-filament
|
|
42
|
+
Scenario: The Tests menu of an app on Kubernetes offers the test users
|
|
43
|
+
Given I am on the folder of the "kubernetes" site
|
|
44
|
+
When I open the "tests" menu of the "kubernetes" site
|
|
45
|
+
Then the open menu should offer "Add the test users"
|
|
46
|
+
And the open menu should offer "Cancel the test users"
|
|
47
|
+
|
|
48
|
+
@needs-runtime-kubernetes @needs-platform-filament
|
|
49
|
+
Scenario: The app on Kubernetes is installed: its login page
|
|
50
|
+
Given I am on the folder of the "kubernetes" site
|
|
51
|
+
When I open "/login" on the "kubernetes" site
|
|
52
|
+
Then I should see "Email address"
|
|
53
|
+
And I should see "Password"
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Feature: The Filament plugin on the dashboard
|
|
2
|
+
Once the plugin is activated and installed, with the Laravel plugin it needs, the sites folders
|
|
3
|
+
offer the builder of an app with an admin panel, each AI folder lists the items of its kind the
|
|
4
|
+
plugin ships, and the Settings page lists the plugin with its own page.
|
|
5
|
+
|
|
6
|
+
# Settings lists every plugin that was added; the package and what the plugin ships are on its own page.
|
|
7
|
+
Scenario: Settings lists the plugin, and its own page names its package and what it ships
|
|
8
|
+
Given I am on "/settings"
|
|
9
|
+
Then I should see "Filament"
|
|
10
|
+
When I go to "/settings/plugin/filament"
|
|
11
|
+
Then I should see "@webship.co/workspace-filament"
|
|
12
|
+
And I should see "cmd-filament-project.sh"
|
|
13
|
+
And I should see "filament-site-builder"
|
|
14
|
+
|
|
15
|
+
# The plugin builds on the Laravel plugin: activating it with what it needs brings that one too.
|
|
16
|
+
Scenario: The Laravel plugin it needs is on Settings as well
|
|
17
|
+
Given I am on "/settings/plugin/laravel"
|
|
18
|
+
Then I should see "@webship.co/workspace-laravel"
|
|
19
|
+
And I should see "cmd-laravel-project.sh"
|
|
20
|
+
|
|
21
|
+
Scenario: A sites folder offers the builder of an app with an admin panel next to the Laravel one
|
|
22
|
+
Given I am on "/dev"
|
|
23
|
+
Then "option[value='cmd-filament-project.sh']" should be attached
|
|
24
|
+
And "option[value='cmd-laravel-project.sh']" should be attached
|
|
25
|
+
|
|
26
|
+
# The AI folders are searched by name: with every plugin on, a folder lists more than one page of items.
|
|
27
|
+
Scenario: The AI Agents folder lists the agents the plugin ships
|
|
28
|
+
Given I am on "/ai-agents?q=filament-"
|
|
29
|
+
Then I should see "filament-site-builder"
|
|
30
|
+
And I should see "filament-tester"
|
|
31
|
+
|
|
32
|
+
Scenario: The AI Skills folder lists the skill the plugin ships
|
|
33
|
+
Given I am on "/ai-skills?q=filament-scenarios"
|
|
34
|
+
Then I should see "filament-scenarios"
|
|
35
|
+
|
|
36
|
+
Scenario: The AI Commands folder lists the command the plugin ships
|
|
37
|
+
Given I am on "/ai-commands?q=filament-test"
|
|
38
|
+
Then I should see "filament-test"
|
|
39
|
+
|
|
40
|
+
Scenario: The AI Prompts folder lists the prompts the plugin ships
|
|
41
|
+
Given I am on "/ai-prompts?q=filament-"
|
|
42
|
+
Then I should see "filament-build-and-test"
|
|
43
|
+
And I should see "filament-scenarios-for-a-resource"
|
package/package.json
CHANGED
|
@@ -1,6 +1,98 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webship.co/workspace-filament",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Filament for Webship Workspace: the builder (`cmd-filament-project.sh`, a new Laravel app with the admin panel installed, or the panel's official demo app) in every sites folder, built on the Laravel plugin, the default accounts, the Filament step pack wired into the testing setup next to the Laravel one, and its AI items in their folders: two agents, a skill, a command and two prompts.",
|
|
5
|
+
"main": "dist/src/index.js",
|
|
6
|
+
"types": "dist/src/index.d.ts",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/webship/workspace-filament.git"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist/src",
|
|
14
|
+
"ai",
|
|
15
|
+
"commands",
|
|
16
|
+
"features",
|
|
17
|
+
"scripts",
|
|
18
|
+
"testing",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc -p tsconfig.json",
|
|
23
|
+
"prepare": "npm run build",
|
|
24
|
+
"test": "npm run build && node --test dist/tests/*.test.js",
|
|
25
|
+
"lint": "tsc -p tsconfig.json --noEmit"
|
|
26
|
+
},
|
|
27
|
+
"workspacePlugin": {
|
|
28
|
+
"name": "filament",
|
|
29
|
+
"label": "Filament",
|
|
30
|
+
"needs": [
|
|
31
|
+
[
|
|
32
|
+
"dev",
|
|
33
|
+
"test",
|
|
34
|
+
"sandboxes",
|
|
35
|
+
"demos"
|
|
36
|
+
],
|
|
37
|
+
"laravel",
|
|
38
|
+
"ai-agents",
|
|
39
|
+
"ai-skills",
|
|
40
|
+
"ai-commands",
|
|
41
|
+
"ai-prompts"
|
|
42
|
+
],
|
|
43
|
+
"commands": {
|
|
44
|
+
"types": [
|
|
45
|
+
"sites"
|
|
46
|
+
],
|
|
47
|
+
"workspaces": [
|
|
48
|
+
"dev",
|
|
49
|
+
"test",
|
|
50
|
+
"sandboxes",
|
|
51
|
+
"demos"
|
|
52
|
+
],
|
|
53
|
+
"files": [
|
|
54
|
+
"commands/cmd-filament-project.sh"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"functions": [
|
|
59
|
+
"scripts/functions/fun-filament.sh"
|
|
60
|
+
],
|
|
61
|
+
"args": [
|
|
62
|
+
"scripts/args/arg-filament.sh"
|
|
63
|
+
],
|
|
64
|
+
"machine": [
|
|
65
|
+
"testing/panel.feature"
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
"ai": {
|
|
69
|
+
"agents": [
|
|
70
|
+
"ai/agents/filament-site-builder.md",
|
|
71
|
+
"ai/agents/filament-tester.md"
|
|
72
|
+
],
|
|
73
|
+
"skills": [
|
|
74
|
+
"ai/skills/filament-scenarios"
|
|
75
|
+
],
|
|
76
|
+
"commands": [
|
|
77
|
+
"ai/commands/filament-test.md"
|
|
78
|
+
],
|
|
79
|
+
"prompts": [
|
|
80
|
+
"ai/prompts/filament-build-and-test.md",
|
|
81
|
+
"ai/prompts/filament-scenarios-for-a-resource.md"
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
"features": [
|
|
85
|
+
"features/filament.feature",
|
|
86
|
+
"features/filament-runtimes.feature"
|
|
87
|
+
],
|
|
88
|
+
"featuresSite": "cmd-filament-project.sh ci-filament --demo --install --add-users --runtime docker"
|
|
89
|
+
},
|
|
90
|
+
"devDependencies": {
|
|
91
|
+
"@types/node": "^24.0.0",
|
|
92
|
+
"@webship.co/workspace-plugin-api": "^1.0.11",
|
|
93
|
+
"typescript": "^5.9.0"
|
|
94
|
+
},
|
|
95
|
+
"publishConfig": {
|
|
96
|
+
"access": "public"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
argparse "$@" <<ARGEOF || exit 1
|
|
4
|
+
parser.add_argument('PROJECT_NAME',
|
|
5
|
+
help='The name of the project: its folder, and its name on the container runtime (on DDEV its host name too).')
|
|
6
|
+
parser.add_argument('--runtime',
|
|
7
|
+
dest='RUNTIME',
|
|
8
|
+
default="_none_",
|
|
9
|
+
choices=['ddev', 'docker', 'podman', 'kubernetes', 'lando', 'docksal'],
|
|
10
|
+
help='The container runtime to build on: ddev (the default, or container.runtime of settings.yml), docker (Docker Compose), podman, kubernetes, lando or docksal.')
|
|
11
|
+
parser.add_argument('-d', '--demo',
|
|
12
|
+
action='store_true',
|
|
13
|
+
default=False,
|
|
14
|
+
help='Build the official demo app of the panel (a shop, a blog and an HR suite, with its own seed and two panels) instead of a new app with a panel.')
|
|
15
|
+
parser.add_argument('-k', '--starter-kit',
|
|
16
|
+
default="${site_starter_kit}",
|
|
17
|
+
choices=['livewire', 'react', 'vue'],
|
|
18
|
+
help='Without --demo: the official starter kit the new app is made from, by the builder of the Laravel plugin. Example: --starter-kit react [default %(default)s]')
|
|
19
|
+
parser.add_argument('-i', '--install',
|
|
20
|
+
action='store_true',
|
|
21
|
+
default=False,
|
|
22
|
+
help='Migrate the database (with --demo: and run its seed), with the workspace account as the first account of the panel.')
|
|
23
|
+
parser.add_argument('-a', '--add-users',
|
|
24
|
+
action='store_true',
|
|
25
|
+
default=False,
|
|
26
|
+
help='With --install, add the default accounts: the ones the test scenarios log in as.')
|
|
27
|
+
parser.add_argument('-p', '--production',
|
|
28
|
+
action='store_true',
|
|
29
|
+
default=False,
|
|
30
|
+
help='Run the app as a live app runs: APP_ENV=production and APP_DEBUG=false (the error pages instead of the debug page).')
|
|
31
|
+
parser.add_argument('-l', '--launch',
|
|
32
|
+
action='store_true',
|
|
33
|
+
default=False,
|
|
34
|
+
help='Open the panel in a browser when it is ready.')
|
|
35
|
+
parser.add_argument('--php-version',
|
|
36
|
+
default="8.4",
|
|
37
|
+
choices=['8.5', '8.4', '8.3'],
|
|
38
|
+
help='PHP version for the project container (the demo app needs 8.4 or later). Example: --php-version 8.5 [default %(default)s]')
|
|
39
|
+
ARGEOF
|