@fluentcommerce/ai-skills 0.1.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 +21 -0
- package/README.md +622 -0
- package/bin/cli.mjs +1973 -0
- package/content/cli/agents/fluent-cli/agent.json +149 -0
- package/content/cli/agents/fluent-cli.md +132 -0
- package/content/cli/skills/fluent-bootstrap/SKILL.md +181 -0
- package/content/cli/skills/fluent-cli-index/SKILL.md +63 -0
- package/content/cli/skills/fluent-cli-mcp-cicd/SKILL.md +77 -0
- package/content/cli/skills/fluent-cli-reference/SKILL.md +1031 -0
- package/content/cli/skills/fluent-cli-retailer/SKILL.md +85 -0
- package/content/cli/skills/fluent-cli-settings/SKILL.md +106 -0
- package/content/cli/skills/fluent-connect/SKILL.md +886 -0
- package/content/cli/skills/fluent-module-deploy/SKILL.md +349 -0
- package/content/cli/skills/fluent-profile/SKILL.md +180 -0
- package/content/cli/skills/fluent-workflow/SKILL.md +310 -0
- package/content/dev/agents/fluent-dev/agent.json +88 -0
- package/content/dev/agents/fluent-dev.md +525 -0
- package/content/dev/reference-modules/catalog.json +4754 -0
- package/content/dev/skills/fluent-build/SKILL.md +192 -0
- package/content/dev/skills/fluent-connection-analysis/SKILL.md +386 -0
- package/content/dev/skills/fluent-custom-code/SKILL.md +895 -0
- package/content/dev/skills/fluent-data-module-scaffold/SKILL.md +714 -0
- package/content/dev/skills/fluent-e2e-test/SKILL.md +394 -0
- package/content/dev/skills/fluent-event-api/SKILL.md +945 -0
- package/content/dev/skills/fluent-feature-explain/SKILL.md +603 -0
- package/content/dev/skills/fluent-feature-plan/PLAN_TEMPLATE.md +695 -0
- package/content/dev/skills/fluent-feature-plan/SKILL.md +227 -0
- package/content/dev/skills/fluent-job-batch/SKILL.md +138 -0
- package/content/dev/skills/fluent-mermaid-validate/SKILL.md +86 -0
- package/content/dev/skills/fluent-module-scaffold/SKILL.md +1928 -0
- package/content/dev/skills/fluent-module-validate/SKILL.md +775 -0
- package/content/dev/skills/fluent-pre-deploy-check/SKILL.md +1108 -0
- package/content/dev/skills/fluent-retailer-config/SKILL.md +1111 -0
- package/content/dev/skills/fluent-rule-scaffold/SKILL.md +385 -0
- package/content/dev/skills/fluent-scope-decompose/SKILL.md +1021 -0
- package/content/dev/skills/fluent-session-audit-export/SKILL.md +632 -0
- package/content/dev/skills/fluent-session-summary/SKILL.md +195 -0
- package/content/dev/skills/fluent-settings/SKILL.md +1058 -0
- package/content/dev/skills/fluent-source-onboard/SKILL.md +632 -0
- package/content/dev/skills/fluent-system-monitoring/SKILL.md +767 -0
- package/content/dev/skills/fluent-test-data/SKILL.md +513 -0
- package/content/dev/skills/fluent-trace/SKILL.md +1143 -0
- package/content/dev/skills/fluent-transition-api/SKILL.md +346 -0
- package/content/dev/skills/fluent-version-manage/SKILL.md +744 -0
- package/content/dev/skills/fluent-workflow-analyzer/SKILL.md +959 -0
- package/content/dev/skills/fluent-workflow-builder/SKILL.md +319 -0
- package/content/dev/skills/fluent-workflow-deploy/SKILL.md +267 -0
- package/content/mcp-extn/agents/fluent-mcp.md +69 -0
- package/content/mcp-extn/skills/fluent-mcp-tools/SKILL.md +461 -0
- package/content/mcp-official/agents/fluent-mcp-core.md +91 -0
- package/content/mcp-official/skills/fluent-mcp-core/SKILL.md +94 -0
- package/content/rfl/agents/fluent-rfl.md +56 -0
- package/content/rfl/skills/fluent-rfl-assess/SKILL.md +172 -0
- package/docs/CAPABILITY_MAP.md +77 -0
- package/docs/CLI_COVERAGE.md +47 -0
- package/docs/DEV_WORKFLOW.md +802 -0
- package/docs/FLOW_RUN.md +142 -0
- package/docs/USE_CASES.md +404 -0
- package/metadata.json +156 -0
- package/package.json +51 -0
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fluent-workflow-builder
|
|
3
|
+
description: Create and edit Fluent Commerce workflow JSON definitions. Build rulesets, states, transitions, and triggers. Validate structure before upload. Triggers on "build workflow", "create workflow", "add ruleset", "edit workflow", "workflow json".
|
|
4
|
+
user-invocable: true
|
|
5
|
+
allowed-tools: Bash, Read, Write, Edit, Glob, Grep
|
|
6
|
+
argument-hint: <operation> [workflow-name]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Workflow Builder
|
|
10
|
+
|
|
11
|
+
Create, edit, and validate Fluent Commerce workflow JSON definitions.
|
|
12
|
+
|
|
13
|
+
## Planning Gate
|
|
14
|
+
|
|
15
|
+
**Before creating or modifying any workflow, write a plan using the template from `PLAN_TEMPLATE.md` in the `fluent-feature-plan` skill.** Every table row must carry a Source column (NEW/EXISTING/MODIFIED/REUSED/OOTB).
|
|
16
|
+
|
|
17
|
+
**If this workflow change is part of a larger feature** (rules + settings + webhooks), use `/fluent-feature-plan` first. Then reference the approved plan during implementation.
|
|
18
|
+
|
|
19
|
+
**Workflow-builder specific emphasis — ensure these are covered:**
|
|
20
|
+
|
|
21
|
+
1. **Business Context (§1)** — what business flow this workflow enables or modifies
|
|
22
|
+
2. **State machine (§3.1)** — Mermaid `stateDiagram-v2` with ALL statuses; annotate `:::added`, `:::removed`, `:::modified`. Validate syntax per `/fluent-mermaid-validate`
|
|
23
|
+
3. **Cross-entity flow (§3.2)** — Mermaid `sequenceDiagram` for cross-entity event chains, webhooks, external systems. Validate syntax per `/fluent-mermaid-validate`
|
|
24
|
+
4. **Before/After diff (§3.4)** — if modifying, show changes (or use `workflow.diff`)
|
|
25
|
+
5. **Workflows (§4)** — every workflow created or modified with Source column and current version
|
|
26
|
+
6. **Statuses (§5)** — new/modified statuses with Source column, entity type, which ruleset adds them
|
|
27
|
+
7. **Rulesets (§6)** — rulesets with Source column, trigger event, from/to status, ordered rule list with NEW/OOTB/EXISTING annotations
|
|
28
|
+
8. **Rules Inventory (§7)** — all rules with Source classification
|
|
29
|
+
9. **Settings (§9)** — settings with Source column, context, value type, JSON example for NEW
|
|
30
|
+
10. **Webhooks (§10)** — setting name, method, payload shape, trigger rule
|
|
31
|
+
11. **Scheduled Events (§11)** — event name, delay, purpose
|
|
32
|
+
12. **GraphQL Operations (§12)** — queries/mutations marked as NEW or REUSED pattern
|
|
33
|
+
13. **Deployment Sequence (§17)** — modules before workflows that reference new rules
|
|
34
|
+
|
|
35
|
+
**Write the plan to:** `accounts/<PROFILE>/plans/<YYYY-MM-DD>-workflow-builder-<slug>.md`. Set `Status: PENDING`.
|
|
36
|
+
|
|
37
|
+
Present the full plan content to the user and wait for approval before writing any workflow JSON. On approval, update the file to `Status: APPROVED`. If the user says "just do it", proceed directly (still write the file for audit trail).
|
|
38
|
+
|
|
39
|
+
## Ownership Boundary
|
|
40
|
+
|
|
41
|
+
This skill owns workflow structure/design guidance and validation checklists.
|
|
42
|
+
|
|
43
|
+
Operational workflow commands are owned by `/fluent-workflow`:
|
|
44
|
+
|
|
45
|
+
- `workflow list`
|
|
46
|
+
- `workflow download`
|
|
47
|
+
- `workflow merge`
|
|
48
|
+
- `workflowlog` operations
|
|
49
|
+
|
|
50
|
+
## Pre-Check: Load Source Analysis
|
|
51
|
+
|
|
52
|
+
Before adding custom rules to a workflow, check if `/fluent-custom-code` analysis artifacts exist:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
accounts/<PROFILE>/analysis/custom-code/workflow-rule-map.json
|
|
56
|
+
accounts/<PROFILE>/analysis/custom-code/source-map.json
|
|
57
|
+
accounts/<PROFILE>/analysis/custom-code/constraints.json
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
If found, use them to:
|
|
61
|
+
- `source-map.json` → `modules[].rules[]` — available custom rules, their parameters, and entity types
|
|
62
|
+
- `workflow-rule-map.json` → existing rule-to-workflow bindings (avoid duplicates)
|
|
63
|
+
- `constraints.json` → extension constraints and risks
|
|
64
|
+
|
|
65
|
+
If not found, fall back to workflow JSON analysis only. Treat artifact-gate failures the same as "not found" (for example missing required files, missing hashes, or blocking `missingSources` in `constraints.json`). Suggest running `/fluent-custom-code <PROFILE>` first when adding custom rules.
|
|
66
|
+
|
|
67
|
+
## When to Use
|
|
68
|
+
|
|
69
|
+
- Creating a new workflow from scratch
|
|
70
|
+
- Adding rulesets or states to an existing workflow
|
|
71
|
+
- Editing triggers, rules, or gate conditions
|
|
72
|
+
- Validating workflow JSON before upload
|
|
73
|
+
- Generating workflow fragments for merge operations
|
|
74
|
+
|
|
75
|
+
## Workflow JSON Structure
|
|
76
|
+
|
|
77
|
+
Every Fluent workflow follows this schema:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"retailerId": "<retailer-id>",
|
|
82
|
+
"version": "<semver>",
|
|
83
|
+
"entityType": "ORDER | FULFILMENT | RETURN_ORDER | ARTICLE | WAVE | ...",
|
|
84
|
+
"entitySubtype": "<subtype matching workflow name after ::>",
|
|
85
|
+
"name": "<ENTITY_TYPE>::<SUBTYPE>",
|
|
86
|
+
"description": "<human-readable description>",
|
|
87
|
+
"versionComment": "<what changed in this version>",
|
|
88
|
+
"createdBy": "<retailer-ref>",
|
|
89
|
+
"rulesets": [ ... ],
|
|
90
|
+
"statuses": [ ... ]
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Ruleset Structure
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"name": "<RulesetName>",
|
|
99
|
+
"description": "[<ENTITY_TYPE>] What this ruleset does",
|
|
100
|
+
"type": "<ENTITY_TYPE>",
|
|
101
|
+
"eventType": "NORMAL",
|
|
102
|
+
"rules": [
|
|
103
|
+
{
|
|
104
|
+
"name": "<ACCOUNT>.<MODULE>.<RuleName>",
|
|
105
|
+
"props": {
|
|
106
|
+
"key": "value"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"triggers": [
|
|
111
|
+
{ "status": "<STATUS>" }
|
|
112
|
+
],
|
|
113
|
+
"userActions": []
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Trigger Types
|
|
118
|
+
|
|
119
|
+
Rulesets are triggered by one of:
|
|
120
|
+
|
|
121
|
+
| Trigger | When it fires |
|
|
122
|
+
|---------|---------------|
|
|
123
|
+
| `{ "status": "CREATED" }` | Entity enters CREATED status (platform CREATE event) |
|
|
124
|
+
| `{ "status": "ON_VALIDATION" }` | Entity enters ON_VALIDATION status |
|
|
125
|
+
| No status trigger | Ruleset is triggered by a named event matching the ruleset name |
|
|
126
|
+
|
|
127
|
+
**Convention:** If a ruleset has no `status` trigger, it fires when an event with `name` matching the ruleset name arrives. For example, ruleset `ConfirmValidation` fires on event `ConfirmValidation`.
|
|
128
|
+
|
|
129
|
+
### Statuses Array
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"statuses": [
|
|
134
|
+
{ "name": "CREATED", "category": "BOOKING", "entityType": "ORDER" },
|
|
135
|
+
{ "name": "ON_VALIDATION", "category": "BOOKING", "entityType": "ORDER" },
|
|
136
|
+
{ "name": "COMPLETE", "category": "DONE", "entityType": "ORDER" }
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Categories: `BOOKING`, `FULFILMENT`, `DONE`, `PAYMENT`
|
|
142
|
+
|
|
143
|
+
## Common Rule Patterns
|
|
144
|
+
|
|
145
|
+
### Core Rules (provided by Fluent platform)
|
|
146
|
+
|
|
147
|
+
| Rule | Props | Purpose |
|
|
148
|
+
|------|-------|---------|
|
|
149
|
+
| `<ACCOUNT>.core.SetState` | `status` | Transition entity to new status |
|
|
150
|
+
| `<ACCOUNT>.core.SendEvent` | `eventName` | Fire a named event on current entity |
|
|
151
|
+
| `<ACCOUNT>.core.SendEventOnVerifyingEntityStatus` | `eventName`, `statuses` (comma-separated) | Fire event only if entity is in one of the listed statuses |
|
|
152
|
+
| `<ACCOUNT>.core.SendEventOnVerifyingAllFcStatus` | `eventName`, `statuses` (comma-separated) | Gate: fire event when ALL fulfilment choices reach one of the listed statuses |
|
|
153
|
+
| `<ACCOUNT>.core.ScheduleEvent` | `eventName`, `delay` (seconds) | Schedule a delayed event |
|
|
154
|
+
| `<ACCOUNT>.core.IfEventAttributeValueIsEqual` | `eventAttributeName`, `eventAttributeValue`, `eventName` | Conditional: fire event if attribute matches |
|
|
155
|
+
|
|
156
|
+
### Extension Rules (from custom extension module)
|
|
157
|
+
|
|
158
|
+
| Rule | Key Props | Purpose |
|
|
159
|
+
|------|-----------|---------|
|
|
160
|
+
| `<ACCOUNT>.<MODULE>.UpdateStatusHistory` | `toStatus` | Track status transition in attribute |
|
|
161
|
+
| `<ACCOUNT>.<MODULE>.SendWebhookWithDynamicAttributes` | `setting` | Send webhook with config from Setting |
|
|
162
|
+
| `<ACCOUNT>.<MODULE>.UpdateEntityFromSetting` | `setting` | Batch-update entity from event data via Setting |
|
|
163
|
+
| `<ACCOUNT>.<MODULE>.CreateFulfilmentFromSourcingLocation` | *(from event attrs)* | Create fulfilment from sourcing data |
|
|
164
|
+
| `<ACCOUNT>.<MODULE>.UpsertAttribute` | `attributeName`, `attributeType`, `attributeValue` | Set entity attribute |
|
|
165
|
+
| `<ACCOUNT>.<MODULE>.UpsertAttributeFromPath` | `jsonpath`, `attributeName`, `attributeType` | Extract value via JSON path and set as attribute |
|
|
166
|
+
|
|
167
|
+
## Plan Before Building
|
|
168
|
+
|
|
169
|
+
**Before creating or editing any workflow, present an implementation plan to the user.** The plan should include:
|
|
170
|
+
|
|
171
|
+
1. **State machine design** — All statuses and transitions, shown as a Mermaid `stateDiagram-v2`
|
|
172
|
+
2. **Ruleset inventory** — Every ruleset with its trigger condition, rules, and purpose
|
|
173
|
+
3. **Settings dependencies** — Any settings referenced by rules (webhook URLs, thresholds, feature flags)
|
|
174
|
+
4. **Custom rule requirements** — Any new Java rules needed (entity type, parameters, behavior)
|
|
175
|
+
5. **Cross-entity interactions** — How this workflow interacts with other entity workflows (e.g., ORDER → FULFILMENT)
|
|
176
|
+
6. **Deployment sequence** — What gets deployed in what order
|
|
177
|
+
|
|
178
|
+
For workflow edits, additionally show:
|
|
179
|
+
- **Before/after diff** — What rulesets are being added, removed, or modified
|
|
180
|
+
- **Before/after Mermaid diagrams** — Visual comparison of the state machine changes
|
|
181
|
+
- **Risk assessment** — Impact of changes on existing live entities
|
|
182
|
+
|
|
183
|
+
**Wait for user approval before making any changes to workflow JSON files.**
|
|
184
|
+
|
|
185
|
+
## Building a New Workflow
|
|
186
|
+
|
|
187
|
+
### Step 1: Determine entity type and subtype
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
Workflow name = <ENTITY_TYPE>::<SUBTYPE>
|
|
191
|
+
Example: ORDER::HD, FULFILMENT::DEFAULT, RETURN_ORDER::DEFAULT
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Step 2: Design the state machine
|
|
195
|
+
|
|
196
|
+
List all statuses and the events/rules that transition between them. Example:
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
CREATED → [CREATE ruleset] → ON_VALIDATION
|
|
200
|
+
ON_VALIDATION → [ConfirmValidation event] → IN_PROGRESS
|
|
201
|
+
IN_PROGRESS → [ConfirmShipment event] → SHIPPED
|
|
202
|
+
SHIPPED → [ConfirmDelivery event] → COMPLETE
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Step 3: Build each ruleset
|
|
206
|
+
|
|
207
|
+
For each transition, create a ruleset with:
|
|
208
|
+
1. The rules to execute (in order — rules run sequentially)
|
|
209
|
+
2. A trigger (status trigger for the first ruleset, event-name trigger for the rest)
|
|
210
|
+
|
|
211
|
+
### Step 4: Add gate rulesets (if needed)
|
|
212
|
+
|
|
213
|
+
Gates check child entity statuses before advancing parent. Example:
|
|
214
|
+
|
|
215
|
+
```json
|
|
216
|
+
{
|
|
217
|
+
"name": "NotifyFCComplete",
|
|
218
|
+
"description": "Gate: advance order when all FCs reach terminal status",
|
|
219
|
+
"type": "ORDER",
|
|
220
|
+
"eventType": "NORMAL",
|
|
221
|
+
"rules": [
|
|
222
|
+
{
|
|
223
|
+
"name": "ACCT.core.SendEventOnVerifyingAllFcStatus",
|
|
224
|
+
"props": {
|
|
225
|
+
"eventName": "SourceOrder",
|
|
226
|
+
"statuses": "ASSIGNED,CANCELLED,ESCALATED"
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
],
|
|
230
|
+
"triggers": [],
|
|
231
|
+
"userActions": []
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Step 5: Validate structure
|
|
236
|
+
|
|
237
|
+
Before uploading, verify:
|
|
238
|
+
- [ ] Every status referenced in triggers exists in the `statuses` array
|
|
239
|
+
- [ ] Every `SetState` target status exists in the `statuses` array
|
|
240
|
+
- [ ] Every `SendEvent` target has a matching ruleset name (or is handled elsewhere)
|
|
241
|
+
- [ ] Rule names follow `<ACCOUNT>.<MODULE>.<RuleName>` format
|
|
242
|
+
- [ ] No duplicate ruleset names
|
|
243
|
+
- [ ] Version is bumped from previous
|
|
244
|
+
|
|
245
|
+
## Editing an Existing Workflow
|
|
246
|
+
|
|
247
|
+
### Get current workflow first
|
|
248
|
+
|
|
249
|
+
Use `/fluent-workflow` for download/list operations, then apply this skill's structure and validation patterns.
|
|
250
|
+
|
|
251
|
+
### Make changes
|
|
252
|
+
|
|
253
|
+
Edit the JSON directly. Common operations:
|
|
254
|
+
|
|
255
|
+
**Add a new ruleset:**
|
|
256
|
+
```json
|
|
257
|
+
{
|
|
258
|
+
"name": "NewRulesetName",
|
|
259
|
+
"description": "[ORDER] What it does",
|
|
260
|
+
"type": "ORDER",
|
|
261
|
+
"eventType": "NORMAL",
|
|
262
|
+
"rules": [ ... ],
|
|
263
|
+
"triggers": [ { "status": "IN_PROGRESS" } ],
|
|
264
|
+
"userActions": []
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
**Add a rule to existing ruleset:**
|
|
269
|
+
Find the ruleset in the `rulesets` array, append to its `rules` array.
|
|
270
|
+
|
|
271
|
+
**Change a gate condition:**
|
|
272
|
+
Find the gate ruleset, update the `statuses` prop value.
|
|
273
|
+
|
|
274
|
+
### Upload/merge
|
|
275
|
+
|
|
276
|
+
Use `/fluent-workflow-deploy` for uploading workflows to environments (MCP tool primary, REST API fallback). Use `/fluent-workflow` for listing, downloading, and merging workflows. Use `/fluent-module-deploy` for deploying full module bundles (JAR + settings + workflows together).
|
|
277
|
+
|
|
278
|
+
**Important:** If the workflow references new custom rules, deploy the module first via `/fluent-module-deploy` before uploading the workflow. Unregistered rules cause NO_MATCH events at runtime.
|
|
279
|
+
|
|
280
|
+
## Workflow Fragments
|
|
281
|
+
|
|
282
|
+
Fragments are partial workflow definitions used with `fluent workflow merge`:
|
|
283
|
+
|
|
284
|
+
```json
|
|
285
|
+
{
|
|
286
|
+
"name": "my-customization",
|
|
287
|
+
"description": "Add custom validation step",
|
|
288
|
+
"rulesets": [
|
|
289
|
+
{
|
|
290
|
+
"name": "CustomValidation",
|
|
291
|
+
"description": "Custom validation ruleset",
|
|
292
|
+
"type": "ORDER",
|
|
293
|
+
"eventType": "NORMAL",
|
|
294
|
+
"rules": [ ... ],
|
|
295
|
+
"triggers": [ ... ],
|
|
296
|
+
"userActions": []
|
|
297
|
+
}
|
|
298
|
+
],
|
|
299
|
+
"statuses": [
|
|
300
|
+
{ "name": "CUSTOM_VALIDATING", "category": "BOOKING", "entityType": "ORDER" }
|
|
301
|
+
]
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
Merge adds the fragment's rulesets and statuses to the base workflow. Use this for modular customizations.
|
|
306
|
+
|
|
307
|
+
## Validation Checklist
|
|
308
|
+
|
|
309
|
+
Run through this before uploading any workflow:
|
|
310
|
+
|
|
311
|
+
1. **JSON syntax** — Valid JSON (no trailing commas, correct brackets)
|
|
312
|
+
2. **Required fields** — `retailerId`, `version`, `entityType`, `entitySubtype`, `name`, `rulesets`
|
|
313
|
+
3. **Status coverage** — Every SetState target exists in `statuses`
|
|
314
|
+
4. **Event coverage** — Every SendEvent target has a matching ruleset (or is expected inbound)
|
|
315
|
+
5. **Trigger consistency** — Only one ruleset per status trigger (avoid conflicts)
|
|
316
|
+
6. **Rule naming** — `<ACCOUNT>.<MODULE>.<RuleName>` format, all referenced rules exist in platform
|
|
317
|
+
7. **Gate logic** — Gate statuses include all terminal states for child entities
|
|
318
|
+
8. **Version bump** — Version is higher than currently deployed version
|
|
319
|
+
9. **Description** — `versionComment` describes what changed
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fluent-workflow-deploy
|
|
3
|
+
description: Deploy Fluent Commerce workflows with validation, MCP tool primary strategy, and automatic REST API fallback. Handles pre-flight checks, upload, version verification, and rollback. Triggers on "deploy workflow", "upload workflow", "push workflow", "workflow deploy".
|
|
4
|
+
user-invocable: true
|
|
5
|
+
allowed-tools: Bash, Read, Write, Edit, Glob, Grep
|
|
6
|
+
argument-hint: <workflow-file> [--profile <name>] [--retailer <ref>] [--dry-run]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Workflow Deployer
|
|
10
|
+
|
|
11
|
+
Deploy Fluent Commerce workflow definitions with validation, multiple upload strategies, and automatic fallback.
|
|
12
|
+
|
|
13
|
+
## Planning Gate
|
|
14
|
+
|
|
15
|
+
**Before deploying any workflow, write a plan using the template from `PLAN_TEMPLATE.md` in the `fluent-feature-plan` skill.**
|
|
16
|
+
|
|
17
|
+
**Workflow-deploy specific emphasis -- ensure these are covered:**
|
|
18
|
+
|
|
19
|
+
1. **Business Context (Section 1)** -- what change this workflow update delivers
|
|
20
|
+
2. **Scope (Section 2)** -- workflow name (e.g., `ORDER::HD`), current version -> new version
|
|
21
|
+
3. **Rulesets (Section 6)** -- new/modified/removed rulesets with Source classification
|
|
22
|
+
4. **Rules Inventory (Section 7)** -- confirm all referenced rules exist in `plugin.list`
|
|
23
|
+
5. **Deployment Sequence (Section 17)** -- module deploy BEFORE workflow deploy if new custom rules are referenced
|
|
24
|
+
6. **Rollback Plan (Section 18)** -- previous workflow version to restore
|
|
25
|
+
|
|
26
|
+
**Write the plan to:** `accounts/<PROFILE>/plans/<YYYY-MM-DD>-workflow-deploy-<slug>.md`. Set `Status: PENDING`.
|
|
27
|
+
|
|
28
|
+
Present the full plan content to the user and wait for approval before uploading. On approval, update the file to `Status: APPROVED`. If the user says "just do it", proceed directly (still write the file for audit trail).
|
|
29
|
+
|
|
30
|
+
## Ownership Boundary
|
|
31
|
+
|
|
32
|
+
This skill owns the deployment execution pipeline (validate -> upload -> verify -> rollback).
|
|
33
|
+
|
|
34
|
+
Workflow structure and editing are owned by `/fluent-workflow-builder`.
|
|
35
|
+
Workflow listing and download are owned by `/fluent-workflow`.
|
|
36
|
+
Workflow analysis is owned by `/fluent-workflow-analyzer`.
|
|
37
|
+
|
|
38
|
+
## Module-First Deployment — Check Before Using This Skill
|
|
39
|
+
|
|
40
|
+
**If the workflow is part of a module** (exists in `resources/workflows/` within a module directory), deploy the entire module via `/fluent-module-deploy` using `fluent module install` instead. Module install deploys workflows, settings, and rules as a single atomic unit with proper versioning.
|
|
41
|
+
|
|
42
|
+
**Use this skill only for standalone workflow uploads** — workflows not bundled in a module, hotfixes to individual workflows, or when module install is not applicable.
|
|
43
|
+
|
|
44
|
+
| Scenario | Correct Approach |
|
|
45
|
+
|----------|-----------------|
|
|
46
|
+
| Workflow is in `resources/workflows/` of a module | `/fluent-module-deploy` → `fluent module install` |
|
|
47
|
+
| Workflow changed along with Java rules | `/fluent-build` → `/fluent-module-deploy` (module bundles everything) |
|
|
48
|
+
| Standalone workflow JSON not in any module | This skill (`/fluent-workflow-deploy`) |
|
|
49
|
+
| Hotfix to a single workflow in production | This skill (targeted upload) |
|
|
50
|
+
| Module install excluded workflows (`--exclude workflows`) | This skill (deploy workflows separately) |
|
|
51
|
+
|
|
52
|
+
## When to Use
|
|
53
|
+
|
|
54
|
+
- Uploading a standalone workflow definition not bundled in a module
|
|
55
|
+
- Deploying after `fluent workflow merge` fails to upload (known `token:undefined` bug)
|
|
56
|
+
- Deploying workflows excluded during module install (`--exclude workflows`)
|
|
57
|
+
- Automating workflow deployment in CI/CD pipelines
|
|
58
|
+
- Rolling back to a previous workflow version
|
|
59
|
+
|
|
60
|
+
## Deployment Pipeline
|
|
61
|
+
|
|
62
|
+
### Step 0: Verify CLI Available
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
fluent --version
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
If CLI is not found, warn the user. The CLI is needed for verification (workflow list/download) but not strictly required for upload -- the MCP `workflow.upload` tool and REST API work independently.
|
|
69
|
+
|
|
70
|
+
### Step 1: Pre-flight Checks
|
|
71
|
+
|
|
72
|
+
Before uploading, validate:
|
|
73
|
+
|
|
74
|
+
1. **Read the workflow JSON file** -- confirm it parses as valid JSON
|
|
75
|
+
2. **Verify required fields:** `name`, `retailerId`, `rulesets`, `statuses`
|
|
76
|
+
3. **Query current deployed version:**
|
|
77
|
+
```bash
|
|
78
|
+
fluent workflow list -p <profile> -r <retailer>
|
|
79
|
+
```
|
|
80
|
+
4. **Confirm new version > current version** (warn if same/lower)
|
|
81
|
+
5. **Validate JSON structure** (use `/fluent-workflow-builder` validation checklist)
|
|
82
|
+
6. **Check rule references** -- every rule in `rulesets[].rules[].name` should exist in `plugin.list`. If any are missing, **STOP** and advise deploying the module first.
|
|
83
|
+
|
|
84
|
+
### Step 1.5: Check Pre-Deploy Report (if available)
|
|
85
|
+
|
|
86
|
+
Read the pre-deploy checklist report if it exists:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
accounts/<PROFILE>/analysis/pre-deploy/<MODULE>-<VERSION>.checklist.json
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
If found and `overallResult == "BLOCKED"`, warn the user and list the blocking gates. Do not proceed without explicit user confirmation.
|
|
93
|
+
|
|
94
|
+
### Step 2: Upload (Strategy Selection)
|
|
95
|
+
|
|
96
|
+
Try upload strategies in order:
|
|
97
|
+
|
|
98
|
+
#### Strategy 1 (Primary): MCP `workflow.upload` Tool
|
|
99
|
+
|
|
100
|
+
The `workflow.upload` MCP tool has built-in structure validation and supports dry-run mode:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
workflow.upload({
|
|
104
|
+
workflow: <workflow-json-object>,
|
|
105
|
+
dryRun: true, // Validate without deploying
|
|
106
|
+
validate: true // Run structure checks
|
|
107
|
+
})
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
1. First run with `dryRun: true` to validate
|
|
111
|
+
2. If validation passes, run with `dryRun: false` to deploy
|
|
112
|
+
3. Response includes the new version number
|
|
113
|
+
|
|
114
|
+
**Advantages:** Built-in validation, dryRun mode, no manual auth handling.
|
|
115
|
+
|
|
116
|
+
**When this fails:** MCP server not configured, connection issues, or MCP tool returns error.
|
|
117
|
+
|
|
118
|
+
#### Strategy 2 (Fallback): REST API Direct Upload
|
|
119
|
+
|
|
120
|
+
If MCP tool is unavailable, use the REST API directly:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Extract credentials from CLI profile
|
|
124
|
+
PROFILE_DIR="$HOME/.fluentcommerce/<profile>"
|
|
125
|
+
BASE_URL=$(python3 -c "import json; print(json.load(open('$PROFILE_DIR/profile.json'))['baseUrl'])")
|
|
126
|
+
CLIENT_SECRET=$(python3 -c "import json; print(json.load(open('$PROFILE_DIR/profile.json'))['clientSecret'])")
|
|
127
|
+
ACCOUNT_ID=$(python3 -c "import json; print(json.load(open('$PROFILE_DIR/profile.json'))['id'])")
|
|
128
|
+
|
|
129
|
+
# Get retailer credentials
|
|
130
|
+
RETAILER_FILE="$PROFILE_DIR/retailer.<retailer-ref>.json"
|
|
131
|
+
USERNAME=$(python3 -c "import json; d=json.load(open('$RETAILER_FILE')); print(d['defaultUser']['username'])")
|
|
132
|
+
PASSWORD=$(python3 -c "import json; d=json.load(open('$RETAILER_FILE')); print(d['defaultUser']['password'])")
|
|
133
|
+
|
|
134
|
+
# Authenticate (retailer-scoped token required -- account-level tokens return 403)
|
|
135
|
+
TOKEN=$(curl -s -X POST "$BASE_URL/oauth/token" \
|
|
136
|
+
-H "Content-Type: application/x-www-form-urlencoded" \
|
|
137
|
+
-d "username=$USERNAME&password=$PASSWORD&client_id=$ACCOUNT_ID&client_secret=$CLIENT_SECRET&grant_type=password&scope=api" \
|
|
138
|
+
| python3 -c "import sys,json; print(json.load(sys.stdin)['access_token'])")
|
|
139
|
+
|
|
140
|
+
# Upload
|
|
141
|
+
curl -s -X PUT "$BASE_URL/api/v4.1/workflow" \
|
|
142
|
+
-H "Content-Type: application/json" \
|
|
143
|
+
-H "Authorization: Bearer $TOKEN" \
|
|
144
|
+
-H "fluent.account: $ACCOUNT_ID" \
|
|
145
|
+
-d @<workflow-file>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Success response:**
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"entityId": "2-ORDER::HD::1.51",
|
|
152
|
+
"eventStatus": "COMPLETE"
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Error responses:**
|
|
157
|
+
|
|
158
|
+
| HTTP Code | Cause | Fix |
|
|
159
|
+
|-----------|-------|-----|
|
|
160
|
+
| 401 | Token expired or invalid | Re-authenticate |
|
|
161
|
+
| 403 | Account-level token, not retailer-scoped | Use retailer user credentials |
|
|
162
|
+
| 400 | Invalid workflow JSON | Check structure with `/fluent-workflow-builder` |
|
|
163
|
+
| 409 | Version conflict | Bump version number |
|
|
164
|
+
| 500 | Server error | Retry after 5 seconds |
|
|
165
|
+
|
|
166
|
+
#### Strategy 3 (Last Resort): CLI `fluent workflow merge`
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
fluent workflow merge <fragment-or-workflow> <workflow-name> \
|
|
170
|
+
-p <profile> -r <retailer>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Known issue: The CLI authenticates for the merge but not for the upload step, resulting in `token:undefined`. When this happens, the merged file is still written locally as `<filename>.merged.json`. Proceed to Strategy 2 with the merged file.
|
|
174
|
+
|
|
175
|
+
### Step 3: Verify Deployment
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
fluent workflow list -p <profile> -r <retailer>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Confirm the version number matches the uploaded version.
|
|
182
|
+
|
|
183
|
+
Additionally, download and diff to confirm content:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
fluent workflow download -p <profile> -r <retailer> -w <name> -o /tmp/
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Compare ruleset count and status count between uploaded and downloaded versions.
|
|
190
|
+
|
|
191
|
+
### Step 4: Post-Deploy Validation (Optional)
|
|
192
|
+
|
|
193
|
+
Send a test event to verify the workflow processes correctly:
|
|
194
|
+
|
|
195
|
+
1. Find or create a test entity in a suitable status
|
|
196
|
+
2. `event.build` -- preview the test event payload
|
|
197
|
+
3. `event.send` (dryRun: true) -- validate without sending
|
|
198
|
+
4. `event.send` (dryRun: false) -- send real event
|
|
199
|
+
5. `event.list` -- confirm event processed (eventStatus: COMPLETE/SUCCESS)
|
|
200
|
+
6. `graphql.query` -- verify entity status changed as expected
|
|
201
|
+
|
|
202
|
+
Use `/fluent-e2e-test` for comprehensive post-deploy testing.
|
|
203
|
+
|
|
204
|
+
## Module Dependency Check
|
|
205
|
+
|
|
206
|
+
**Critical:** If the workflow references custom rules (rules with `<ACCOUNT>.<context>.<RuleName>` pattern rather than `FLUENTRETAIL.*`), verify the module containing those rules is deployed:
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
plugin.list({ name: "<RuleName>" })
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
If any referenced rule is not found in the registry, the module must be deployed first via `/fluent-module-deploy`. Deploying a workflow that references unregistered rules causes NO_MATCH events at runtime.
|
|
213
|
+
|
|
214
|
+
**Recommended deployment order:**
|
|
215
|
+
1. Deploy module (registers rules) -- `/fluent-module-deploy`
|
|
216
|
+
2. Deploy workflows (references rules) -- `/fluent-workflow-deploy`
|
|
217
|
+
3. Create/update settings (referenced by rules) -- `/fluent-settings`
|
|
218
|
+
4. Run E2E test -- `/fluent-e2e-test`
|
|
219
|
+
|
|
220
|
+
## Dry Run Mode
|
|
221
|
+
|
|
222
|
+
With `--dry-run`, the deployer performs all steps except the actual upload:
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
1. Parse and validate workflow JSON done
|
|
226
|
+
2. Check current deployed version done
|
|
227
|
+
3. Verify version bump done
|
|
228
|
+
4. Check rule references exist done
|
|
229
|
+
5. Upload workflow SKIPPED
|
|
230
|
+
6. Report what WOULD be deployed
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Rollback
|
|
234
|
+
|
|
235
|
+
To rollback to a previous version:
|
|
236
|
+
|
|
237
|
+
1. Download the previous version:
|
|
238
|
+
```bash
|
|
239
|
+
fluent workflow download -p <profile> -r <retailer> -w <name> -o /tmp/
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
2. Edit the downloaded JSON to bump the version number (must be higher than current)
|
|
243
|
+
3. Upload via MCP tool or REST API
|
|
244
|
+
|
|
245
|
+
Note: Fluent does not support downgrading version numbers. To "rollback," you upload the old content with a new (higher) version number.
|
|
246
|
+
|
|
247
|
+
## Integration with Other Skills
|
|
248
|
+
|
|
249
|
+
| Task | Skill |
|
|
250
|
+
|------|-------|
|
|
251
|
+
| Analyze workflow before deploying | `/fluent-workflow-analyzer` |
|
|
252
|
+
| Edit workflow JSON | `/fluent-workflow-builder` |
|
|
253
|
+
| Download current workflow | `/fluent-workflow` |
|
|
254
|
+
| Deploy module (rules must exist first) | `/fluent-module-deploy` |
|
|
255
|
+
| Pre-deployment validation | `/fluent-pre-deploy-check` |
|
|
256
|
+
| Test after deployment | `/fluent-e2e-test` |
|
|
257
|
+
| Debug deployment failures | `/fluent-trace` |
|
|
258
|
+
|
|
259
|
+
## Tips
|
|
260
|
+
|
|
261
|
+
- **Always backup the current version** before deploying -- download with `fluent workflow download`
|
|
262
|
+
- **Version must always increase** -- Fluent rejects same or lower version numbers
|
|
263
|
+
- **Use retailer-scoped tokens** for REST API -- Account-level tokens get 403 on workflow API
|
|
264
|
+
- **Check the `eventStatus`** in the upload response -- `COMPLETE` means success
|
|
265
|
+
- **The `entityId` in the response** follows format `<retailerId>-<workflowName>::<version>`
|
|
266
|
+
- **Deploy module before workflow** if the workflow references new custom rules
|
|
267
|
+
- **Windows users**: Use `--json` flag for download to avoid `::` filename issues
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fluent-mcp
|
|
3
|
+
description: Fluent Commerce MCP extension agent. Provides intelligent assistance for event dispatch, transition actions, GraphQL queries, batch ingestion, and webhook validation via the Fluent MCP server. Triggers on "fluent mcp", "send event", "graphql query", "batch ingestion".
|
|
4
|
+
tools: Bash, Read, Write, Edit, Glob, Grep
|
|
5
|
+
model: inherit
|
|
6
|
+
skills: fluent-mcp-tools
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Fluent MCP Extension Agent
|
|
10
|
+
|
|
11
|
+
You are a Fluent Commerce MCP specialist. You help users with MCP server operations including event dispatch, transition actions, GraphQL queries, batch ingestion, and webhook validation.
|
|
12
|
+
|
|
13
|
+
## Capabilities
|
|
14
|
+
|
|
15
|
+
- **Event Dispatch**: Build, validate, and send events via the Fluent Event API
|
|
16
|
+
- **Orchestration**: Query user actions/transitions and list registered rules with metadata
|
|
17
|
+
- **GraphQL Operations**: Execute queries and mutations, auto-paginate, batch mutate
|
|
18
|
+
- **Batch Ingestion**: Create batch jobs, send records, check status, get results
|
|
19
|
+
- **Webhook Validation**: Validate webhook payloads and verify signatures
|
|
20
|
+
- **Schema Introspection**: Discover mutations, input types, and field requirements
|
|
21
|
+
|
|
22
|
+
## Authentication
|
|
23
|
+
|
|
24
|
+
Auth strategy priority (first valid method wins):
|
|
25
|
+
|
|
26
|
+
1. **Profile** — `FLUENT_PROFILE` (recommended). Uses SDK `createClientFromProfile()` for automatic credential and retailer resolution.
|
|
27
|
+
2. **OAuth** — `FLUENT_CLIENT_ID` + `FLUENT_CLIENT_SECRET` (+ optional `FLUENT_USERNAME`/`FLUENT_PASSWORD`)
|
|
28
|
+
3. **Token Command** — `TOKEN_COMMAND` (vault/secret manager integration with auto-refresh)
|
|
29
|
+
4. **Static Token** — `FLUENT_ACCESS_TOKEN` (dev fallback, no refresh)
|
|
30
|
+
|
|
31
|
+
## Key Behaviors
|
|
32
|
+
|
|
33
|
+
1. **Always validate config** before operations: use `config.validate` tool
|
|
34
|
+
2. **Use dry-run first** for events: `event.send` with `dryRun: true`
|
|
35
|
+
3. **Prefer `graphql.queryAll`** when fetching all records (auto-pagination)
|
|
36
|
+
4. **Use `graphql.batchMutate`** for bulk updates (up to 50 per request)
|
|
37
|
+
|
|
38
|
+
## Available MCP Tools
|
|
39
|
+
|
|
40
|
+
| Tool | Purpose |
|
|
41
|
+
|------|---------|
|
|
42
|
+
| `config.validate` | Check auth/base URL/retailer config |
|
|
43
|
+
| `health.ping` | Quick connectivity diagnostics |
|
|
44
|
+
| `connection.test` | Full auth + me query verification |
|
|
45
|
+
| `event.build` | Build event payload (no send) |
|
|
46
|
+
| `event.send` | Send event (supports dryRun) |
|
|
47
|
+
| `event.list` | List/filter events |
|
|
48
|
+
| `event.get` | Fetch single event by ID |
|
|
49
|
+
| `workflow.transitions` | Query available user actions/transitions at any state |
|
|
50
|
+
| `plugin.list` | List registered rules with metadata (supports name filter) |
|
|
51
|
+
| `graphql.query` | Execute single GraphQL query/mutation |
|
|
52
|
+
| `graphql.queryAll` | Auto-paginated query (all records) |
|
|
53
|
+
| `graphql.batchMutate` | Batch mutations (up to 50) |
|
|
54
|
+
| `graphql.introspect` | Schema introspection |
|
|
55
|
+
| `batch.create` | Create batch ingestion job |
|
|
56
|
+
| `batch.send` | Send records to batch job |
|
|
57
|
+
| `batch.status` | Check batch job status |
|
|
58
|
+
| `batch.results` | Get batch job results |
|
|
59
|
+
| `webhook.validate` | Validate webhook payload/signature |
|
|
60
|
+
|
|
61
|
+
## Cross-References for Event Questions
|
|
62
|
+
|
|
63
|
+
If a user asks about **event model semantics** (types, categories, statuses, causality, execution model), redirect to `/fluent-event-api`.
|
|
64
|
+
|
|
65
|
+
If a user asks **why an event failed** or needs **diagnostic help**, redirect to `/fluent-trace`.
|
|
66
|
+
|
|
67
|
+
If a user asks about **event volume analytics** or **failure rate monitoring**, redirect to `/fluent-system-monitoring`.
|
|
68
|
+
|
|
69
|
+
This agent owns MCP tool syntax and payload contracts. Event model knowledge and diagnostic logic are owned by the dev skills above.
|