@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,192 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fluent-build
|
|
3
|
+
description: Build, version, package, and deploy Fluent Commerce extension modules. Handles Maven compilation, version bumping, module packaging, and deployment. Triggers on "build module", "bump version", "package module", "deploy module", "maven build".
|
|
4
|
+
user-invocable: true
|
|
5
|
+
allowed-tools: Bash, Read, Write, Edit, Glob, Grep
|
|
6
|
+
argument-hint: [build|version|package|deploy|full] [--skip-tests]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Build and Packaging
|
|
10
|
+
|
|
11
|
+
Build and package Fluent extension modules with consistent versioning.
|
|
12
|
+
|
|
13
|
+
## Planning Gate
|
|
14
|
+
|
|
15
|
+
**Before version bumping or packaging, write a plan using the template from `PLAN_TEMPLATE.md` in the `fluent-feature-plan` skill.** Plain `mvn clean install` builds (no version change) are exempt.
|
|
16
|
+
|
|
17
|
+
**Build-specific emphasis — ensure these are covered:**
|
|
18
|
+
|
|
19
|
+
1. **Business Context (Section 1)** — what change drives this version bump
|
|
20
|
+
2. **Scope (Section 2)** — current version → new version, bump type (patch/minor/major) with rationale
|
|
21
|
+
3. **Files (Section 6)** — all pom.xml files, module.json, CHANGELOG.md that will be modified
|
|
22
|
+
4. **Impacted retailers (Section 4.8)** — which environments get the new version
|
|
23
|
+
5. **Test Plan (Section 8)** — confirm tests pass before versioning
|
|
24
|
+
6. **Deployment Sequence (Section 9)** — build → test → version bump → package → deploy order
|
|
25
|
+
|
|
26
|
+
**Write the plan to:** `accounts/<PROFILE>/plans/<YYYY-MM-DD>-build-<slug>.md`. Set `Status: PENDING`.
|
|
27
|
+
|
|
28
|
+
Present the full plan content to the user and wait for approval before bumping versions. 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:
|
|
33
|
+
|
|
34
|
+
- version bumping
|
|
35
|
+
- Maven build/test execution
|
|
36
|
+
- module ZIP packaging
|
|
37
|
+
|
|
38
|
+
This skill does **not** own deployment runbooks. For deployment:
|
|
39
|
+
|
|
40
|
+
- use `/fluent-module-deploy` for manual installs
|
|
41
|
+
- use `flow-run` for guarded automation and JSON run reporting
|
|
42
|
+
|
|
43
|
+
## When to Use
|
|
44
|
+
|
|
45
|
+
- Java rule or utility code changed
|
|
46
|
+
- Workflow JSON, settings, or resource files changed in `resources/`
|
|
47
|
+
- module version needs bumping before redeploy
|
|
48
|
+
- a new deployable ZIP artifact is required
|
|
49
|
+
- build errors need diagnosis and recovery
|
|
50
|
+
|
|
51
|
+
## Pre-Check: Module Validation (Enforced Gate)
|
|
52
|
+
|
|
53
|
+
Before building, check the cached validation report from `/fluent-module-validate`:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
accounts/<PROFILE>/analysis/module-validate/<module-name>.report.json
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**This is a gating check, not advisory:**
|
|
60
|
+
|
|
61
|
+
1. **Report exists and `summary.status == "NEEDS_FIXES"`** -- **STOP**. List all FAIL items from the report. Ask the user to confirm proceeding despite validation failures. Do NOT silently continue.
|
|
62
|
+
|
|
63
|
+
2. **Report exists and `summary.status == "READY_FOR_BUILD"`** -- proceed with build.
|
|
64
|
+
|
|
65
|
+
3. **Report is missing or stale** (content hash in `.hash` file doesn't match current source) -- **run `/fluent-module-validate` inline** before building. This ensures validation is always current. If inline validation finds FAIL items, apply the same gating behavior as case 1.
|
|
66
|
+
|
|
67
|
+
The validation report checks: module.json structure, POM consistency, version alignment, rule wiring, test coverage, and more. Building a module that fails validation wastes time and may produce a broken artifact.
|
|
68
|
+
|
|
69
|
+
## Pre-Check: Load Source Analysis
|
|
70
|
+
|
|
71
|
+
Before building, check if `/fluent-custom-code` analysis artifacts exist:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
accounts/<PROFILE>/analysis/custom-code/source-map.json
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
If found, read to discover:
|
|
78
|
+
- `modules[].buildRoot` — correct directory to run Maven from
|
|
79
|
+
- `modules[].buildCommand` — build command
|
|
80
|
+
- `modules[].packageScript` — packaging script path
|
|
81
|
+
- `modules[].outputArtifact` — expected output ZIP
|
|
82
|
+
- `modules[].version` — current version (for bump validation)
|
|
83
|
+
|
|
84
|
+
If not found, fall back to the defaults below. Treat artifact-gate failures as "not found" (for example missing required files, missing hashes, or blocking `missingSources` in `constraints.json`).
|
|
85
|
+
|
|
86
|
+
## Prerequisites Check
|
|
87
|
+
|
|
88
|
+
Run before building:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
node --version
|
|
92
|
+
java --version
|
|
93
|
+
mvn --version
|
|
94
|
+
fluent --version
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Use the repository-supported runtime versions for your environment.
|
|
98
|
+
|
|
99
|
+
## 1) Version Bump (required before redeploy)
|
|
100
|
+
|
|
101
|
+
> **Full version lifecycle:** For version status, sync, CHANGELOG updates, and git tagging, use `/fluent-version-manage`. This section covers the minimum bump needed before a build.
|
|
102
|
+
|
|
103
|
+
### When to Bump
|
|
104
|
+
|
|
105
|
+
**A version bump is required whenever ANY content in the module changes — not just Java code.**
|
|
106
|
+
|
|
107
|
+
| Change Type | Examples | Bump Required? | Why |
|
|
108
|
+
|------------|---------|---------------|-----|
|
|
109
|
+
| Java code | New rule, bug fix, refactor | **YES** | JAR filename includes version; CLI skips upload if same version exists |
|
|
110
|
+
| Workflow JSON | New ruleset, status change, rule reorder | **YES** | Module version tracks what's deployed; without bump the module install looks identical to last deploy |
|
|
111
|
+
| Settings | New setting, value change | **YES** | Same reason — traceability of what version introduced the change |
|
|
112
|
+
| Resources | New assets, config templates | **YES** | Packaged into the module ZIP; version is the audit trail |
|
|
113
|
+
| No content change | Re-deploy same content | **NO** | Use `--force` flag if re-install is needed |
|
|
114
|
+
|
|
115
|
+
**Key gotcha:** The Fluent CLI checks the plugin JAR filename against what's already uploaded. If `fc-module-<name>-0.0.30.jar` is already active, uploading the same version results in `"already uploaded: Active - nothing more to do"` — the JAR is silently skipped. **Both `resources/module.json` AND all `pom.xml` files must be bumped in sync**, because Maven uses the POM version for the JAR filename while the CLI uses `module.json` version for the module-level check.
|
|
116
|
+
|
|
117
|
+
### Version Sync — All Files Must Match
|
|
118
|
+
|
|
119
|
+
Fluent ignores re-uploading the same module version. Keep these files in sync:
|
|
120
|
+
|
|
121
|
+
| File | Field |
|
|
122
|
+
|---|---|
|
|
123
|
+
| `plugins/pom.xml` | parent `<version>` |
|
|
124
|
+
| `plugins/rules/<module-alias>/pom.xml` | parent/module `<version>` |
|
|
125
|
+
| `plugins/types/<module-alias>/pom.xml` | parent/module `<version>` |
|
|
126
|
+
| `plugins/util/<module-alias>/pom.xml` | parent/module `<version>` |
|
|
127
|
+
| `resources/module.json` | `"version"` |
|
|
128
|
+
|
|
129
|
+
### Bump Procedure
|
|
130
|
+
|
|
131
|
+
1. Read current `resources/module.json` version.
|
|
132
|
+
2. Increment patch version (or minor/major per semver rationale).
|
|
133
|
+
3. Update `resources/module.json` version field.
|
|
134
|
+
4. Update all POM files — use Maven to ensure consistency:
|
|
135
|
+
```bash
|
|
136
|
+
cd plugins/ && mvn versions:set -DnewVersion=<NEW_VERSION> -DgenerateBackupPoms=false
|
|
137
|
+
```
|
|
138
|
+
5. Verify old version no longer exists in the module source tree:
|
|
139
|
+
```bash
|
|
140
|
+
grep -r "<old-version>" plugins/*/pom.xml resources/module.json
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## 2) Build
|
|
144
|
+
|
|
145
|
+
From `plugins/`:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# Full build
|
|
149
|
+
mvn clean install
|
|
150
|
+
|
|
151
|
+
# Build without tests
|
|
152
|
+
mvn clean install -DskipTests
|
|
153
|
+
|
|
154
|
+
# Build targeted module with dependencies
|
|
155
|
+
mvn clean install -pl rules/<module-alias> -am
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## 3) Package
|
|
159
|
+
|
|
160
|
+
After a successful build, create a deployable ZIP:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Bash (macOS/Linux/Git Bash on Windows)
|
|
164
|
+
./scripts/build-module.sh
|
|
165
|
+
./scripts/build-module.sh -p # skip plugins (packaging only)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
```powershell
|
|
169
|
+
# PowerShell (Windows native)
|
|
170
|
+
.\scripts\build-module.ps1
|
|
171
|
+
.\scripts\build-module.ps1 -SkipPlugins
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Expected output:
|
|
175
|
+
|
|
176
|
+
`dist/fluent-commerce-<module-name>-<VERSION>.zip`
|
|
177
|
+
|
|
178
|
+
## 4) Hand Off to Deploy Owner
|
|
179
|
+
|
|
180
|
+
After packaging completes:
|
|
181
|
+
|
|
182
|
+
- manual path: `/fluent-module-deploy`
|
|
183
|
+
- automated path: `npx @fluentcommerce/ai-skills flow-run --deploy --yes ...`
|
|
184
|
+
|
|
185
|
+
## Common Build Failures
|
|
186
|
+
|
|
187
|
+
| Symptom | Likely cause | First check |
|
|
188
|
+
|---|---|---|
|
|
189
|
+
| `cannot find symbol` | import/type mismatch | validate changed classes and imports |
|
|
190
|
+
| dependency/module not found | wrong module scope/build root | run from `plugins/` and include `-am` where needed |
|
|
191
|
+
| tests fail after model changes | fixture/schema drift | update test fixtures and expected payloads |
|
|
192
|
+
| package script succeeds but ZIP missing expected assets | resource path mismatch | verify `resources/` contents and module build script inputs |
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fluent-connection-analysis
|
|
3
|
+
description: Analyze workflow connection topology across rulesets and workflows. Produces internal/cross-entity/cross-workflow maps, static-vs-dynamic runtime diffs, and webhook/setting conformance inventories with Mermaid output. Triggers on "connection analysis", "workflow connections", "cross workflow dependencies", "orphaned rulesets", "process flow classification", "webhook dependency map", "expected vs observed rulesets", "runtime workflow diff".
|
|
4
|
+
user-invocable: true
|
|
5
|
+
allowed-tools: Bash, Read, Write, Edit, Glob, Grep
|
|
6
|
+
argument-hint: <workflow-file-or-name> [--deep] [--mermaid] [--output <path>] [--validate <entity-ref> --entity-type ORDER|FULFILMENT] [--from <iso> --to <iso>]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Fluent Connection Analysis
|
|
10
|
+
|
|
11
|
+
Connection-focused analysis for Fluent workflows. Use this when the main question is not just "what statuses exist?" but "how does work move between rulesets/workflows and where are the risky dependency points?"
|
|
12
|
+
|
|
13
|
+
## Ownership Boundary
|
|
14
|
+
|
|
15
|
+
This skill owns:
|
|
16
|
+
- connection topology (internal, cross-entity, cross-workflow)
|
|
17
|
+
- orphan/missing-target detection
|
|
18
|
+
- process-flow type classification
|
|
19
|
+
- webhook and setting dependency extraction
|
|
20
|
+
|
|
21
|
+
Related skills:
|
|
22
|
+
- Workflow structure baseline -> `/fluent-workflow-analyzer`
|
|
23
|
+
- Workflow edits/fixes -> `/fluent-workflow-builder`
|
|
24
|
+
- Runtime failure correlation -> `/fluent-trace`
|
|
25
|
+
- Settings validation -> `/fluent-settings`
|
|
26
|
+
|
|
27
|
+
## When to Use
|
|
28
|
+
|
|
29
|
+
- Mapping dependencies before changing a workflow
|
|
30
|
+
- Explaining "what triggers what" across entities
|
|
31
|
+
- Finding orphaned rulesets and missing SendEvent targets
|
|
32
|
+
- Auditing integration/webhook touchpoints
|
|
33
|
+
- Producing architecture handover docs with Mermaid diagrams
|
|
34
|
+
- Comparing static expected paths vs runtime observed execution after an event/mutation
|
|
35
|
+
- Verifying rule-referenced settings exist and are valid in live context
|
|
36
|
+
|
|
37
|
+
## Seamless Default Bundle
|
|
38
|
+
|
|
39
|
+
Run this skill as a single-pass bundle by default:
|
|
40
|
+
|
|
41
|
+
1. Static connection topology + risk checks
|
|
42
|
+
2. Settings conformance (`rule props -> live setting status`)
|
|
43
|
+
3. Runtime diff (when `--validate` inputs are provided)
|
|
44
|
+
|
|
45
|
+
If `--validate` is not provided, still emit sections 1-2 and explicitly mark runtime diff as `NOT_RUN`.
|
|
46
|
+
|
|
47
|
+
## Connection Analysis Procedure
|
|
48
|
+
|
|
49
|
+
### 1) Gather Workflow Set
|
|
50
|
+
|
|
51
|
+
1. Resolve target workflow(s) (local file or via `/fluent-workflow` download).
|
|
52
|
+
2. For dependency analysis, load adjacent workflows in the same retailer (ORDER + FULFILMENT + child types).
|
|
53
|
+
3. Build indexes:
|
|
54
|
+
- rulesets by `(type, name)`
|
|
55
|
+
- statuses by `(entityType, name)`
|
|
56
|
+
- event emitters by `eventName` — scan ALL rules with `eventName` or `noMatchEventName` props (SendEvent, ScheduleEvent, ForwardEvent*, SendEventOnVerifying*, and any other event-emitting rule)
|
|
57
|
+
|
|
58
|
+
### 2) Build Connection Graph
|
|
59
|
+
|
|
60
|
+
For each ruleset:
|
|
61
|
+
1. Identify incoming edges:
|
|
62
|
+
- event-name match (`event.name == ruleset.name`)
|
|
63
|
+
- status-trigger match (`triggers[].status`)
|
|
64
|
+
2. Identify outgoing edges:
|
|
65
|
+
- `SendEvent(eventName)` -> target ruleset(s)
|
|
66
|
+
- `SetState(status)` -> status transition edges
|
|
67
|
+
3. Classify each edge:
|
|
68
|
+
- `internal`: same workflow/entity scope
|
|
69
|
+
- `cross-entity`: different entity type
|
|
70
|
+
- `cross-workflow`: target flexType/workflow differs
|
|
71
|
+
4. Annotate conditional edges:
|
|
72
|
+
- If a ruleset has a `subtype` field (e.g. `"subtype": "HD_WH"`), mark all its incoming edges as **conditional on subtype**. The event fires for all subtypes but only this ruleset's trigger scope matches the specific subtype.
|
|
73
|
+
- In the report, label conditional edges: `ConfirmPick --(HD_WH only)--> RequestShipment`
|
|
74
|
+
|
|
75
|
+
### 3) Detect Risks
|
|
76
|
+
|
|
77
|
+
Run these checks:
|
|
78
|
+
- orphaned rulesets (no trigger and no inbound SendEvent)
|
|
79
|
+
- missing SendEvent targets (no ruleset receives emitted event)
|
|
80
|
+
- trigger conflicts (multiple rulesets for same status in same type)
|
|
81
|
+
- dead-end non-terminal statuses
|
|
82
|
+
- unreachable statuses (never targeted by SetState)
|
|
83
|
+
|
|
84
|
+
**Duplicate ruleset severity calibration:**
|
|
85
|
+
- Same name + same entity type + same subtype (or both subtype-empty) + **overlapping trigger statuses** = **HIGH** (ambiguous runtime behavior)
|
|
86
|
+
- Same name + same entity type + same subtype (or both subtype-empty) + **non-overlapping trigger statuses** = **MEDIUM** (maintenance ambiguity; often intentional normal-vs-late variants)
|
|
87
|
+
- Same name + same entity type + **different subtype filters** = **INFO** (usually intentional subtype partitioning; document explicitly)
|
|
88
|
+
|
|
89
|
+
### 4) Process Flow Classification
|
|
90
|
+
|
|
91
|
+
Classify each ruleset into one flow type. There are 6 categories (not 5):
|
|
92
|
+
|
|
93
|
+
| Type | Condition | Examples |
|
|
94
|
+
|------|-----------|---------|
|
|
95
|
+
| `CREATE` | Ruleset name is `CREATE` | ORDER.CREATE, FULFILMENT.CREATE |
|
|
96
|
+
| `SCHEDULED_EVENT` | Ruleset receives event fired by `ScheduleEvent` | ValidationGraceExpired |
|
|
97
|
+
| `CROSS_ENTITY_EVENT` | Ruleset receives event fired by `SendEventForOrder`, `SendEventForAllFulfilmentChoices`, `SendEventForAllFulfilments`, or other cross-entity Send rules | NotifyFCComplete, RouteFulfilmentChoice, CancelFulfilment |
|
|
98
|
+
| `USER_ACTION` | Ruleset has non-empty `userActions[]` | CancelOrder, EscalateFulfilmentChoice |
|
|
99
|
+
| `INTERNAL_EVENT` | Ruleset receives event fired by `SendEvent` or `ForwardEvent*` from another ruleset **within the same entity type** | ValidateOrder (from CREATE), ProcessOrder (from ConfirmValidation), TransitionToShipped (from NotifyFulfilmentShipped) |
|
|
100
|
+
| `INTEGRATION_EVENT` | No inbound SendEvent from any ruleset in the workflow; event arrives from external system | ConfirmValidation, ConfirmPick, ConfirmShipment, ConfirmDelivery |
|
|
101
|
+
|
|
102
|
+
**How to distinguish INTERNAL_EVENT from INTEGRATION_EVENT:**
|
|
103
|
+
1. Build the emitter index by scanning ALL event-emitting rule patterns in the workflow:
|
|
104
|
+
- `core.SendEvent` → `eventName` prop
|
|
105
|
+
- `core.ScheduleEvent` → `eventName` prop
|
|
106
|
+
- `ForwardEventBy*` (e.g. `ForwardEventByFulfilmentChoiceType`) → `eventName` prop
|
|
107
|
+
- `SendEventOnVerifying*` (e.g. `SendEventOnVerifyingAttributeValue`) → both `eventName` AND `noMatchEventName` props
|
|
108
|
+
- `SendEventOnVerifyingAllFulfilment*States` → `eventName` prop
|
|
109
|
+
- **Catch-all:** Any rule with an `eventName` or `noMatchEventName` prop emits events — include it.
|
|
110
|
+
Record each emitted event name and which ruleset emits it.
|
|
111
|
+
2. If a ruleset's name appears as an emitted `eventName` from another ruleset in the same entity type → `INTERNAL_EVENT`.
|
|
112
|
+
3. If a ruleset's name does NOT appear as any emitted `eventName` in the workflow → `INTEGRATION_EVENT` (external inbound).
|
|
113
|
+
4. Conditional emitters count: `noMatchEventName` targets, scheduled event targets, and gate-pattern event targets (from `SendEventOnVerifyingAll*`) are all internal emitters.
|
|
114
|
+
5. **Dual classification:** A ruleset can be both a USER_ACTION (has `userActions[]`) and an INTERNAL_EVENT target (e.g. `CancelOrder` is a user action but also sent by `GracePeriodTimeoutCancel`). Use the primary classification per priority order, but note dual roles in the report.
|
|
115
|
+
|
|
116
|
+
Priority for deterministic classification (first match wins):
|
|
117
|
+
1. `CREATE`
|
|
118
|
+
2. `SCHEDULED_EVENT`
|
|
119
|
+
3. `CROSS_ENTITY_EVENT`
|
|
120
|
+
4. `USER_ACTION`
|
|
121
|
+
5. `INTERNAL_EVENT`
|
|
122
|
+
6. `INTEGRATION_EVENT`
|
|
123
|
+
|
|
124
|
+
### 5) Webhook + Setting Dependency Mapping
|
|
125
|
+
|
|
126
|
+
Detect webhook/integration patterns by:
|
|
127
|
+
- rule name patterns (`webhook`, `notify`, `callback`, `publish`, `subscribe`)
|
|
128
|
+
- rule props referencing webhook/setting keys
|
|
129
|
+
|
|
130
|
+
Detect setting usage by prop-key/value patterns:
|
|
131
|
+
- `setting`, `config`, `parameter`, `option`, `property`
|
|
132
|
+
|
|
133
|
+
Output:
|
|
134
|
+
- ruleset -> webhook touchpoints
|
|
135
|
+
- ruleset -> setting keys
|
|
136
|
+
- setting -> dependent rulesets/workflows
|
|
137
|
+
- setting runtime contract status (`FOUND`, `MISSING`, `EMPTY`, `INVALID_FORMAT`)
|
|
138
|
+
|
|
139
|
+
Runtime setting verification:
|
|
140
|
+
1. For each extracted setting key, query live settings using **cascading scope resolution**:
|
|
141
|
+
- First: `RETAILER` + retailer `contextId`
|
|
142
|
+
- Then: `ACCOUNT` + `contextId=0`
|
|
143
|
+
- Use the first scope where the setting is found.
|
|
144
|
+
Module-installed settings often default to `ACCOUNT` scope. Always check both before reporting `MISSING`.
|
|
145
|
+
2. Validate existence and value shape:
|
|
146
|
+
- `MISSING`: no setting found.
|
|
147
|
+
- `EMPTY`: found but `value` and `lobValue` are empty.
|
|
148
|
+
- `INVALID_FORMAT`: value exists but does not match expected shape (for example webhook JSON missing `url`).
|
|
149
|
+
- `FOUND`: exists with plausible value shape.
|
|
150
|
+
3. Emit a contract table: `setting -> referencedByRulesets -> runtimeStatus -> notes`.
|
|
151
|
+
|
|
152
|
+
For full CRUD/migration workflows, hand off to `/fluent-settings`.
|
|
153
|
+
|
|
154
|
+
### 6) Produce Deliverables
|
|
155
|
+
|
|
156
|
+
Always generate:
|
|
157
|
+
1. Connection Summary (counts by internal/cross-entity/cross-workflow)
|
|
158
|
+
2. Risk Findings (ordered by severity)
|
|
159
|
+
3. Process Flow Table (ruleset -> flow type)
|
|
160
|
+
4. Integration Dependency Table (webhook + settings)
|
|
161
|
+
|
|
162
|
+
When `--mermaid` is enabled, generate:
|
|
163
|
+
- state machine per entity (`stateDiagram-v2`)
|
|
164
|
+
- event/connection flow (`flowchart TD`)
|
|
165
|
+
- cross-entity lifecycle (`flowchart LR`)
|
|
166
|
+
|
|
167
|
+
**Mermaid syntax:** Validate all generated diagrams against `/fluent-mermaid-validate` rules before output (no colons in free text, no unicode arrows, quoted special-char labels).
|
|
168
|
+
|
|
169
|
+
**Mermaid accuracy rules:**
|
|
170
|
+
- Dotted-line labels between entities must use **event names**, not rule names. If a rule (e.g. `CreateFulfilmentFromSourcingLocation`) creates a child entity, label the edge as "creates entity" or the subsequent CREATE event, not the rule class name.
|
|
171
|
+
- Cross-entity lifecycle must show **intermediate statuses** when an entity transitions through multiple states. E.g. if ReportShortpick sends both NotifyFulfilmentShipped and NotifyFulfilmentDelivered, show the ORDER transitioning through SHIPPED before COMPLETED, not skipping directly to COMPLETED.
|
|
172
|
+
- Annotate subtype-conditional paths in diagrams: `RequestShipment [HD_WH]`, `ReadyForPickup [CC_PFS]`.
|
|
173
|
+
|
|
174
|
+
### 7) Validate Against Live Data (`--validate`)
|
|
175
|
+
|
|
176
|
+
Use this when you have a real entity and want to compare "what the static connection graph predicts" vs "what actually executed at runtime". Requires `--validate <entity-ref> --entity-type <TYPE>`.
|
|
177
|
+
|
|
178
|
+
#### 7a) Resolve Entity and Determine Scope
|
|
179
|
+
|
|
180
|
+
1. Accept entity ref and type from CLI arguments. Supported types: `ORDER`, `FULFILMENT`, `FULFILMENT_CHOICE`, `ARTICLE`.
|
|
181
|
+
2. Query the entity to confirm it exists and retrieve its current status and subtype:
|
|
182
|
+
```
|
|
183
|
+
graphql.query: { orders(ref: ["<REF>"]) { edges { node { id ref type status } } } }
|
|
184
|
+
```
|
|
185
|
+
(Adjust root field for entity type: `orders`, `fulfilments`, etc.)
|
|
186
|
+
3. Determine the workflow flexType from entity type + subtype (e.g. `ORDER::HD`, `FULFILMENT::HD_WH`).
|
|
187
|
+
4. Load the matching workflow JSON from the local workflow set (Steps 1-2 of the main procedure). If not found locally, download it.
|
|
188
|
+
5. Run Steps 2-4 (Build Connection Graph, Detect Risks, Process Flow Classification) on the workflow to produce the **expected connection graph** — the full set of rulesets, edges, and conditional branches.
|
|
189
|
+
|
|
190
|
+
#### 7b) Query Live Orchestration Events
|
|
191
|
+
|
|
192
|
+
Fetch all orchestration events for the entity:
|
|
193
|
+
```
|
|
194
|
+
event.list({
|
|
195
|
+
"context.entityRef": "<ENTITY_REF>",
|
|
196
|
+
"context.entityType": "<ENTITY_TYPE>",
|
|
197
|
+
"eventType": "ORCHESTRATION_AUDIT",
|
|
198
|
+
"count": 200
|
|
199
|
+
})
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Also collect business orchestration events for name-level matching:
|
|
203
|
+
```
|
|
204
|
+
event.list({
|
|
205
|
+
"context.entityRef": "<ENTITY_REF>",
|
|
206
|
+
"context.entityType": "<ENTITY_TYPE>",
|
|
207
|
+
"eventType": "ORCHESTRATION",
|
|
208
|
+
"count": 200
|
|
209
|
+
})
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
If more than 200 events exist, paginate using `start` offset until all events are collected for both queries.
|
|
213
|
+
|
|
214
|
+
For each returned event, extract:
|
|
215
|
+
- `name` — the event/ruleset name that fired
|
|
216
|
+
- `status` — event status (SUCCESS, FAILED, etc.)
|
|
217
|
+
- `createdOn` — timestamp for timing analysis
|
|
218
|
+
- `entityId`, `entityRef`, `entityType` — confirm entity scope
|
|
219
|
+
- `attributes` — any rule-specific attributes (subtype, status transitions)
|
|
220
|
+
- `category` — especially `ruleSet`, `rule`, `ACTION`, `exception` from `ORCHESTRATION_AUDIT`
|
|
221
|
+
|
|
222
|
+
#### 7c) Cross-Entity Event Tracing
|
|
223
|
+
|
|
224
|
+
For entity types that spawn or interact with child entities, also query child events:
|
|
225
|
+
|
|
226
|
+
- **ORDER** entities: query events for related fulfilment choices and fulfilments:
|
|
227
|
+
```
|
|
228
|
+
event.list({
|
|
229
|
+
"context.rootEntityRef": "<ORDER_REF>",
|
|
230
|
+
"context.rootEntityType": "ORDER",
|
|
231
|
+
"context.entityType": "FULFILMENT_CHOICE",
|
|
232
|
+
"eventType": "ORCHESTRATION",
|
|
233
|
+
"count": 200
|
|
234
|
+
})
|
|
235
|
+
```
|
|
236
|
+
Repeat for `context.entityType: "FULFILMENT"`.
|
|
237
|
+
|
|
238
|
+
- **FULFILMENT** entities: query events for the parent order:
|
|
239
|
+
```
|
|
240
|
+
event.list({
|
|
241
|
+
"context.entityRef": "<FULFILMENT_REF>",
|
|
242
|
+
"context.entityType": "FULFILMENT",
|
|
243
|
+
"eventType": "ORCHESTRATION",
|
|
244
|
+
"count": 200
|
|
245
|
+
})
|
|
246
|
+
```
|
|
247
|
+
Also query any articles linked to the fulfilment.
|
|
248
|
+
|
|
249
|
+
Collect all cross-entity events into a separate list for cross-entity edge validation.
|
|
250
|
+
|
|
251
|
+
#### 7d) Map Actual Events to Expected Rulesets
|
|
252
|
+
|
|
253
|
+
For each ruleset in the expected connection graph:
|
|
254
|
+
|
|
255
|
+
1. **Direct match**: Check if an ORCHESTRATION event with the same `name` as the ruleset name exists in the collected events. If found, mark as **MATCHED**.
|
|
256
|
+
2. **Conditional branch check**: If the ruleset has a `subtype` filter (e.g. `HD_WH` only), check whether the entity's actual subtype matches. If the subtype does not match, mark as **SKIPPED (subtype mismatch: entity is <actual>, ruleset requires <expected>)**.
|
|
257
|
+
3. **Gate ruleset check**: For gate-pattern rulesets (e.g. `SendEventOnVerifyingAllFulfilmentStates`), check if the gate event was emitted by looking for the gate's `eventName` in the event list. If the gate condition was not met, mark as **SKIPPED (gate condition not met)**.
|
|
258
|
+
4. **Cross-entity event check**: For rulesets that emit cross-entity events (via `SendEventForOrder`, `SendEventForAllFulfilmentChoices`, `SendEventForAllFulfilments`), verify the target event appears in the cross-entity event list. If found, mark as **MATCHED (cross-entity)**. If not found, mark as **SKIPPED (cross-entity event not propagated)**.
|
|
259
|
+
5. **Status precondition check**: If a ruleset triggers on a specific status and the entity never reached that status (based on observed SetState transitions), mark as **SKIPPED (status <STATUS> never reached)**.
|
|
260
|
+
|
|
261
|
+
For each observed event that does NOT correspond to any expected ruleset, mark as **UNEXPECTED**.
|
|
262
|
+
|
|
263
|
+
#### 7e) Timing Analysis
|
|
264
|
+
|
|
265
|
+
Sort all matched events by `createdOn` timestamp and compute:
|
|
266
|
+
- **Duration between consecutive events**: time from one ruleset completion to the next
|
|
267
|
+
- **Total execution span**: time from first event to last event
|
|
268
|
+
- **Slowest transition**: the largest gap between consecutive events (potential bottleneck)
|
|
269
|
+
- **Gate wait time**: for gate rulesets, time between the last contributing child event and the gate event firing
|
|
270
|
+
|
|
271
|
+
Flag any gap exceeding 5 seconds as a potential delay indicator.
|
|
272
|
+
|
|
273
|
+
#### 7f) Produce Validate Report
|
|
274
|
+
|
|
275
|
+
Generate the report with these sections:
|
|
276
|
+
|
|
277
|
+
**Expected Path vs Actual Path Table:**
|
|
278
|
+
```
|
|
279
|
+
| Ruleset | Flow Type | Expected | Observed | Status | Evidence |
|
|
280
|
+
|---------|-----------|----------|----------|--------|----------|
|
|
281
|
+
| CREATE | CREATE | yes | yes | MATCHED | evt-001 |
|
|
282
|
+
| ValidateOrder | INTERNAL_EVENT | yes | yes | MATCHED | evt-002 |
|
|
283
|
+
| ConfirmValidation | INTEGRATION_EVENT | yes | yes | MATCHED | evt-003 |
|
|
284
|
+
| RequestShipment | INTERNAL_EVENT | yes | no | SKIPPED | subtype mismatch: entity is CC, ruleset requires HD_WH |
|
|
285
|
+
| ReadyForPickup | INTERNAL_EVENT | yes | yes | MATCHED | evt-004 |
|
|
286
|
+
| UnknownExternalEvt | - | no | yes | UNEXPECTED | evt-099 |
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
**Summary Counts:**
|
|
290
|
+
```
|
|
291
|
+
MATCHED: <N> rulesets executed as expected
|
|
292
|
+
SKIPPED: <N> rulesets not executed (with reasons)
|
|
293
|
+
UNEXPECTED: <N> events observed but not in expected path
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
**Skipped Rulesets Detail:**
|
|
297
|
+
For each SKIPPED ruleset, explain the skip reason:
|
|
298
|
+
- `subtype mismatch` — entity subtype does not match ruleset filter
|
|
299
|
+
- `status never reached` — prerequisite status was never set
|
|
300
|
+
- `gate condition not met` — gate ruleset waiting on child entities that are not all in required state
|
|
301
|
+
- `cross-entity event not propagated` — expected cross-entity event was not observed on child/parent
|
|
302
|
+
- `conditional guard` — rule-level guard/attribute condition not satisfied
|
|
303
|
+
|
|
304
|
+
**Conditional Branch Report:**
|
|
305
|
+
```
|
|
306
|
+
Branch Point: <ruleset with multiple outgoing conditional edges>
|
|
307
|
+
Taken: <branch that was observed> (subtype: HD_WH)
|
|
308
|
+
Not taken: <branch not observed> (subtype: CC_PFS) — SKIPPED
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
**Timing Analysis:**
|
|
312
|
+
```
|
|
313
|
+
| From | To | Duration | Flag |
|
|
314
|
+
|------|----|----------|------|
|
|
315
|
+
| CREATE | ValidateOrder | 120ms | |
|
|
316
|
+
| ValidateOrder | ConfirmValidation | 45200ms | SLOW (>5s) |
|
|
317
|
+
| ConfirmValidation | ReadyForPickup | 340ms | |
|
|
318
|
+
Total span: 45.66s | Slowest: ValidateOrder -> ConfirmValidation (45.2s)
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
**Cross-Entity Propagation:**
|
|
322
|
+
```
|
|
323
|
+
| Source Entity | Event Emitted | Target Entity Type | Target Event | Status |
|
|
324
|
+
|--------------|---------------|--------------------|--------------|--------|
|
|
325
|
+
| ORDER:ORD-001 | NotifyFCComplete | FULFILMENT_CHOICE | RouteFulfilmentChoice | MATCHED |
|
|
326
|
+
| ORDER:ORD-001 | CancelFulfilment | FULFILMENT | CancelFulfilment | NOT FOUND |
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
When `--output <path>` is specified, write the full report to the given file. When `--mermaid` is also enabled, annotate the connection graph diagram with color-coded edges: green for MATCHED, grey for SKIPPED, red for UNEXPECTED.
|
|
330
|
+
|
|
331
|
+
#### 7g) Runtime Settings Conformance (required in validate mode)
|
|
332
|
+
|
|
333
|
+
In `--validate` mode, always add a settings conformance section:
|
|
334
|
+
|
|
335
|
+
1. Reuse extracted setting refs from Step 5 (webhook + non-webhook settings).
|
|
336
|
+
2. Query live settings for each key using **cascading scope resolution**:
|
|
337
|
+
- First: `RETAILER` (contextId = retailer id)
|
|
338
|
+
- Then: `ACCOUNT` (contextId = 0)
|
|
339
|
+
- Use the first scope where the setting is found.
|
|
340
|
+
Record which scope the setting was found at — this is important for the conformance table.
|
|
341
|
+
3. Evaluate status:
|
|
342
|
+
- `FOUND`
|
|
343
|
+
- `MISSING`
|
|
344
|
+
- `EMPTY`
|
|
345
|
+
- `INVALID_FORMAT` (for example webhook JSON without `url`)
|
|
346
|
+
- `CONTRACT_MISMATCH` (exists but runtime evidence suggests wrong value; for example webhook request endpoint differs from configured setting URL)
|
|
347
|
+
4. If `ORCHESTRATION_AUDIT` contains webhook action evidence, compare:
|
|
348
|
+
- configured webhook URL from setting
|
|
349
|
+
- observed `Request Endpoint` in audit attributes
|
|
350
|
+
and emit mismatch findings.
|
|
351
|
+
|
|
352
|
+
Settings conformance table:
|
|
353
|
+
```
|
|
354
|
+
| Setting | Referenced By | Runtime Status | Evidence |
|
|
355
|
+
|---------|----------------|----------------|----------|
|
|
356
|
+
| webhook.order.created | ORDER.CREATE | FOUND | setting id=... |
|
|
357
|
+
| webhook.carrier.shipment.request | FULFILMENT.RequestShipment | CONTRACT_MISMATCH | configured=https://x, observed=https://y |
|
|
358
|
+
| update.fulfilment.confirmPick | FULFILMENT.ConfirmPick | MISSING | no settings edge |
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
## Output Template
|
|
362
|
+
|
|
363
|
+
```text
|
|
364
|
+
=== Connection Analysis: <WORKFLOW_NAME> ===
|
|
365
|
+
|
|
366
|
+
Topology:
|
|
367
|
+
Internal edges: <N>
|
|
368
|
+
Cross-entity edges: <N>
|
|
369
|
+
Cross-workflow edges: <N>
|
|
370
|
+
|
|
371
|
+
Findings:
|
|
372
|
+
[CRITICAL|HIGH|MEDIUM] <finding>
|
|
373
|
+
|
|
374
|
+
Process Flow Classification:
|
|
375
|
+
<Ruleset> -> <FlowType>
|
|
376
|
+
|
|
377
|
+
Webhook/Setting Dependencies:
|
|
378
|
+
<Ruleset> -> webhook:<keys> setting:<keys>
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
## Decision Rules
|
|
382
|
+
|
|
383
|
+
- If the user needs full state machine quality checks -> include `/fluent-workflow-analyzer`.
|
|
384
|
+
- If gaps are found and user asks for fixes -> switch to `/fluent-workflow-builder`.
|
|
385
|
+
- If runtime behavior differs from static analysis -> pivot to `/fluent-trace`.
|
|
386
|
+
|