@fluentcommerce/ai-skills 0.1.0 → 0.2.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.

Potentially problematic release.


This version of @fluentcommerce/ai-skills might be problematic. Click here for more details.

Files changed (31) hide show
  1. package/README.md +10 -16
  2. package/content/cli/skills/fluent-bootstrap/SKILL.md +9 -0
  3. package/content/cli/skills/fluent-cli-reference/SKILL.md +0 -408
  4. package/content/cli/skills/fluent-module-deploy/SKILL.md +21 -127
  5. package/content/dev/agents/fluent-dev/AGENT.md +76 -0
  6. package/content/dev/agents/fluent-dev/agent.json +2 -12
  7. package/content/dev/agents/fluent-dev.md +5 -6
  8. package/content/dev/skills/fluent-build/SKILL.md +16 -38
  9. package/content/dev/skills/fluent-feature-plan/PLAN_TEMPLATE.md +9 -13
  10. package/content/dev/skills/fluent-feature-plan/SKILL.md +8 -14
  11. package/content/dev/skills/fluent-module-scaffold/SKILL.md +9 -78
  12. package/content/dev/skills/fluent-pre-deploy-check/SKILL.md +5 -23
  13. package/content/dev/skills/fluent-retailer-config/SKILL.md +9 -0
  14. package/content/dev/skills/fluent-rule-scaffold/SKILL.md +9 -0
  15. package/content/dev/skills/fluent-scope-decompose/SKILL.md +1 -1
  16. package/content/dev/skills/fluent-settings/SKILL.md +10 -0
  17. package/content/dev/skills/fluent-source-onboard/SKILL.md +9 -0
  18. package/content/dev/skills/fluent-sourcing/SKILL.md +1171 -0
  19. package/content/dev/skills/fluent-use-case-discover/SKILL.md +471 -0
  20. package/content/dev/skills/fluent-use-case-discover/SPEC_TEMPLATE.md +260 -0
  21. package/content/dev/skills/fluent-version-manage/SKILL.md +10 -0
  22. package/content/dev/skills/fluent-workflow-builder/SKILL.md +10 -3
  23. package/content/mcp-extn/agents/fluent-mcp.md +65 -2
  24. package/content/mcp-extn/skills/fluent-mcp-tools/SKILL.md +343 -4
  25. package/docs/CAPABILITY_MAP.md +3 -7
  26. package/docs/USE_CASES.md +4 -3
  27. package/docs/USE_CASES.pdf +0 -0
  28. package/metadata.json +8 -9
  29. package/package.json +2 -6
  30. package/content/dev/skills/fluent-data-module-scaffold/SKILL.md +0 -714
  31. package/content/dev/skills/fluent-workflow-deploy/SKILL.md +0 -267
@@ -1,267 +0,0 @@
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