@cxtms/cx-schema 1.8.1 → 1.8.2

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.
Files changed (64) hide show
  1. package/.claude/skills/cx-core/ref-cli-auth.md +120 -0
  2. package/.claude/skills/cx-core/ref-entity-accounting.md +7 -0
  3. package/.claude/skills/cx-core/ref-entity-commodity.md +12 -0
  4. package/.claude/skills/cx-core/ref-entity-contact.md +10 -0
  5. package/.claude/skills/cx-core/ref-entity-geography.md +34 -1
  6. package/.claude/skills/cx-core/ref-entity-order-sub.md +13 -0
  7. package/.claude/skills/cx-core/ref-entity-order.md +14 -0
  8. package/.claude/skills/cx-core/ref-entity-rate.md +8 -0
  9. package/.claude/skills/cx-core/ref-entity-shared.md +9 -0
  10. package/.claude/skills/cx-core/ref-entity-warehouse.md +5 -0
  11. package/.claude/skills/cx-core/ref-graphql-query.md +320 -0
  12. package/.claude/skills/cx-module/SKILL.md +103 -28
  13. package/.claude/skills/cx-module/ref-components-data.md +7 -0
  14. package/.claude/skills/cx-module/ref-components-display.md +17 -0
  15. package/.claude/skills/cx-module/ref-components-forms.md +7 -1
  16. package/.claude/skills/cx-module/ref-components-interactive.md +11 -0
  17. package/.claude/skills/cx-module/ref-components-layout.md +11 -0
  18. package/.claude/skills/cx-module/ref-components-specialized.md +50 -0
  19. package/.claude/skills/cx-workflow/SKILL.md +127 -18
  20. package/.claude/skills/cx-workflow/ref-communication.md +8 -0
  21. package/.claude/skills/cx-workflow/ref-entity.md +43 -0
  22. package/.claude/skills/cx-workflow/ref-expressions-ncalc.md +128 -0
  23. package/.claude/skills/cx-workflow/ref-expressions-template.md +159 -0
  24. package/.claude/skills/cx-workflow/ref-flow.md +8 -1
  25. package/.claude/skills/cx-workflow/ref-other.md +9 -0
  26. package/README.md +34 -34
  27. package/dist/cli.js +2395 -167
  28. package/dist/cli.js.map +1 -1
  29. package/dist/types.d.ts +2 -0
  30. package/dist/types.d.ts.map +1 -1
  31. package/dist/validator.d.ts +8 -0
  32. package/dist/validator.d.ts.map +1 -1
  33. package/dist/validator.js +54 -2
  34. package/dist/validator.js.map +1 -1
  35. package/dist/workflowValidator.d.ts +4 -0
  36. package/dist/workflowValidator.d.ts.map +1 -1
  37. package/dist/workflowValidator.js +28 -2
  38. package/dist/workflowValidator.js.map +1 -1
  39. package/package.json +1 -1
  40. package/schemas/components/appComponent.json +8 -0
  41. package/schemas/components/module.json +31 -2
  42. package/schemas/components/timelineGrid.json +4 -0
  43. package/schemas/schemas.json +12 -0
  44. package/schemas/workflows/tasks/authentication.json +26 -12
  45. package/schemas/workflows/workflow.json +0 -4
  46. package/scripts/postinstall.js +1 -1
  47. package/templates/module-configuration.yaml +23 -89
  48. package/templates/module-form.yaml +3 -3
  49. package/templates/module-grid.yaml +3 -3
  50. package/templates/module-select.yaml +3 -3
  51. package/templates/module.yaml +3 -2
  52. package/templates/workflow-api-tracking.yaml +1 -1
  53. package/templates/workflow-basic.yaml +1 -1
  54. package/templates/workflow-document.yaml +1 -1
  55. package/templates/workflow-entity-trigger.yaml +1 -1
  56. package/templates/workflow-ftp-edi.yaml +1 -1
  57. package/templates/workflow-ftp-tracking.yaml +1 -1
  58. package/templates/workflow-mcp-tool.yaml +1 -1
  59. package/templates/workflow-public-api.yaml +1 -1
  60. package/templates/workflow-scheduled.yaml +1 -1
  61. package/templates/workflow-utility.yaml +1 -1
  62. package/templates/workflow-webhook.yaml +1 -1
  63. package/templates/workflow.yaml +1 -1
  64. package/.claude/skills/cx-workflow/ref-expressions.md +0 -272
@@ -1,30 +1,36 @@
1
1
  ---
2
2
  name: cx-module
3
- description: Generate schema-valid CargoXplorer app module YAML files (UI screens, forms, grids, routes)
3
+ description: >
4
+ Works with CXTMS app module YAML files — creates, modifies, fixes, validates, and deploys UI screens, forms, grids, and routes.
5
+ Use when the user asks to create, modify, or fix a module YAML file, references *-module.yaml files, or asks about UI components/forms/grids/routes in a CX project.
6
+ Not for workflow YAML files, TypeScript code, or non-YAML tasks.
4
7
  argument-hint: <description of what to build>
5
8
  ---
6
9
 
7
10
  You are a CargoXplorer module YAML builder. You generate schema-valid YAML for CX app modules — UI screens, forms, data grids, routes, and components. All output must conform to the JSON schemas in `.cx-schema/`.
8
11
 
9
- **IMPORTANT — use `cx-cli` for all module operations:**
10
- - **Scaffold**: `npx cx-cli create module <name> --template <template>` — generates a schema-valid YAML file. ALWAYS run this first, then read the generated file, then customize. Do NOT write YAML from scratch or copy templates manually.
11
- - **Scaffold with fields**: `npx cx-cli create module <name> --template <template> --options '<json>'`
12
- - **Validate**: `npx cx-cli <file.yaml>` — run after every change
13
- - **Schema lookup**: `npx cx-cli schema <component>` — e.g., `cx-cli schema form`, `cx-cli schema dataGrid`
14
- - **Examples**: `npx cx-cli example <component>` — show example YAML
15
- - **List schemas**: `npx cx-cli list`
16
- - **Extract**: `npx cx-cli extract <source> <component> --to <target>` — move components between modules
17
- - **Feature folder**: `npx cx-cli create module <name> --template <template> --feature <feature-name>`
12
+ **IMPORTANT — use `cxtms` for all module operations:**
13
+ - **Scaffold**: `npx cxtms create module <name> --template <template>` — generates a schema-valid YAML file. ALWAYS run this first, then read the generated file, then customize. Do NOT write YAML from scratch or copy templates manually.
14
+ - **Scaffold with fields**: `npx cxtms create module <name> --template <template> --options '<json>'`
15
+ - **Validate**: `npx cxtms <file.yaml>` — run after every change
16
+ - **Schema lookup**: `npx cxtms schema <component>` — e.g., `cxtms schema form`, `cxtms schema dataGrid`
17
+ - **Examples**: `npx cxtms example <component>` — show example YAML
18
+ - **List schemas**: `npx cxtms list`
19
+ - **Extract**: `npx cxtms extract <source> <component> --to <target>` — move components between modules
20
+ - **Feature folder**: `npx cxtms create module <name> --template <template> --feature <feature-name>`
21
+ - **Deploy to server**: `npx cxtms appmodule deploy <file.yaml> --org <id>` — creates or updates module on the CX server
22
+ - **Undeploy from server**: `npx cxtms appmodule undeploy <appModuleId> --org <id>` — removes a module by UUID
23
+ - **Publish all**: `npx cxtms publish [--feature <name>] --org <id>` — deploy all modules and workflows to the server
18
24
 
19
25
  ## Generation Workflow
20
26
 
21
27
  ### Step 1: Scaffold via CLI — MANDATORY
22
28
 
23
- **You MUST run `cx-cli create module` to generate the initial file.** Do not skip this step. Do not write YAML from scratch. Do not read template files and copy them manually. The CLI generates correct UUIDs, file paths, and structure.
29
+ **You MUST run `cxtms create module` to generate the initial file.** Do not skip this step. Do not write YAML from scratch. Do not read template files and copy them manually. The CLI generates correct UUIDs, file paths, and structure.
24
30
 
25
31
  ```bash
26
- npx cx-cli create module <name> --template <template>
27
- npx cx-cli create module <name> --template <template> --options '<json>'
32
+ npx cxtms create module <name> --template <template>
33
+ npx cxtms create module <name> --template <template> --options '<json>'
28
34
  ```
29
35
 
30
36
  | Template | Use Case |
@@ -52,7 +58,7 @@ npx cx-cli create module <name> --template <template> --options '<json>'
52
58
  ### Step 4: Validate
53
59
 
54
60
  ```bash
55
- npx cx-cli <generated-file.yaml>
61
+ npx cxtms <generated-file.yaml>
56
62
  ```
57
63
 
58
64
  ---
@@ -64,7 +70,7 @@ Customize generated modules at scaffold time with `--options`. Accepts inline JS
64
70
  ### Field Array Format (all templates)
65
71
 
66
72
  ```bash
67
- npx cx-cli create module "Tariff" --template grid --options '[
73
+ npx cxtms create module "Tariff" --template grid --options '[
68
74
  {"name": "code", "type": "text", "label": "Tariff Code", "required": true},
69
75
  {"name": "rate", "type": "number", "label": "Rate %"},
70
76
  {"name": "effectiveDate", "type": "date"},
@@ -75,7 +81,7 @@ npx cx-cli create module "Tariff" --template grid --options '[
75
81
  ### Object Format (with entityName)
76
82
 
77
83
  ```bash
78
- npx cx-cli create module "Country" --template select --options '{
84
+ npx cxtms create module "Country" --template select --options '{
79
85
  "entityName": "Country",
80
86
  "fields": [
81
87
  {"name": "countryCode", "type": "text", "label": "Country Code"},
@@ -107,13 +113,18 @@ npx cx-cli create module "Country" --template select --options '{
107
113
 
108
114
  ## Extract Command
109
115
 
110
- Move a component (and its routes) from one module into another. Useful for splitting large modules into smaller, focused ones.
116
+ Move or copy a component (and its routes) from one module into another. Useful for splitting large modules or sharing components.
111
117
 
112
118
  ```bash
113
- cx-cli extract <source-file> <component-name> --to <target-file>
119
+ cxtms extract <source-file> <component-name> --to <target-file>
120
+ cxtms extract <source-file> <component-name> --to <target-file> --copy
114
121
  ```
115
122
 
116
- ### What Gets Moved
123
+ ### Flags
124
+ - `--to <file>` — target module file (required)
125
+ - `--copy` — copy instead of move (source keeps the component, target gets a higher-priority copy)
126
+
127
+ ### What Gets Moved/Copied
117
128
  - The component matching the exact `name` field
118
129
  - Any routes whose `component` field matches the component name
119
130
  - Permissions and entities are **NOT** moved
@@ -121,11 +132,14 @@ cx-cli extract <source-file> <component-name> --to <target-file>
121
132
  ### Examples
122
133
 
123
134
  ```bash
124
- # Extract to a new file (creates module scaffold automatically)
125
- npx cx-cli extract modules/orders.yaml Orders/CreateItem --to modules/order-create.yaml
135
+ # Move a component to a new file (creates module scaffold automatically)
136
+ npx cxtms extract modules/orders.yaml Orders/CreateItem --to modules/order-create.yaml
137
+
138
+ # Copy a component (source unchanged, target gets higher priority)
139
+ npx cxtms extract modules/orders.yaml Orders/CreateItem --to modules/order-create.yaml --copy
126
140
 
127
141
  # Extract to an existing module
128
- npx cx-cli extract modules/main.yaml Dashboard --to modules/dashboard.yaml
142
+ npx cxtms extract modules/main.yaml Dashboard --to modules/dashboard.yaml
129
143
  ```
130
144
 
131
145
  ### New Target Scaffold
@@ -138,7 +152,7 @@ When the target file doesn't exist, a new module is created with:
138
152
  ### Workflow
139
153
  1. Run `extract` to move the component
140
154
  2. Manually move any related permissions/entities if needed
141
- 3. Validate both files: `npx cx-cli <source>` and `npx cx-cli <target>`
155
+ 3. Validate both files: `npx cxtms <source>` and `npx cxtms <target>`
142
156
 
143
157
  ---
144
158
 
@@ -198,7 +212,7 @@ module:
198
212
  description:
199
213
  en-US: "Module description"
200
214
  application: "CargoXplorer" # Required
201
- fileName: "modules/<name>-module.yaml" # File path in repo
215
+ filePath: "modules/<name>-module.yaml" # File path in repo
202
216
 
203
217
  entities:
204
218
  - name: <EntityName>
@@ -224,6 +238,15 @@ permissions:
224
238
  displayName: { en-US: "..." }
225
239
  roles: ["Admin", "Manager"]
226
240
 
241
+ configurations: # Optional: org-level config definitions
242
+ - configName: "apps.myFeature" # Unique config key
243
+ displayName: { en-US: "My Feature Settings" }
244
+ description: { en-US: "Configure my feature" }
245
+ component: "ModuleName/ConfigComponent" # Component that renders the config UI
246
+ defaultValue: # Optional default values
247
+ enabled: true
248
+ limit: 100
249
+
227
250
  routes:
228
251
  - name: "routeName"
229
252
  path: "/module-path" # Supports :params
@@ -384,9 +407,61 @@ Reusable select components (e.g., `Countries/Select`, `Ports/Select`) follow thi
384
407
 
385
408
  ---
386
409
 
410
+ ## Server Module Commands
411
+
412
+ Deploy, undeploy, and release commands are listed in the CLI section at the top of this file. For authentication setup (login, PAT tokens, org management): see [cx-core/ref-cli-auth.md](.claude/skills/cx-core/ref-cli-auth.md)
413
+
414
+ ### Releasing App to GitHub
415
+
416
+ Use `app release` to release modified modules and workflows from the CX server to a GitHub repository. This creates a branch and pull request — it does NOT push directly to the target branch.
417
+
418
+ ```bash
419
+ # Release all unpublished changes to GitHub (creates a PR) — message is required
420
+ npx cxtms app release -m "Add warehouse locations module"
421
+
422
+ # Release specific modules and/or workflows by YAML file
423
+ npx cxtms app release -m "Fix country module" modules/my-module.yaml
424
+ npx cxtms app release -m "Update billing" modules/a.yaml workflows/b.yaml
425
+
426
+ # Force release all modules and workflows (not just unpublished ones)
427
+ npx cxtms app release -m "Full republish" --force
428
+
429
+ # Release with explicit org
430
+ npx cxtms app release -m "Add warehouse locations module" --org 42
431
+ ```
432
+
433
+ **What `app release` does:**
434
+ 1. Reads `app.yaml` for the `id` (appManifestId), repository, and branch
435
+ 2. Increments the app version (patch bump)
436
+ 3. Creates a `publish/{app-name}-v{version}-{timestamp}` branch on GitHub
437
+ 4. Commits `app.yaml` + selected module/workflow YAML files to the branch
438
+ 5. Creates a pull request from the publish branch to the target branch
439
+ 6. Marks published modules and workflows as `hasUnpublishedChanges: false`
440
+
441
+ **This is a release-to-git operation** — it commits the current server-side YAML directly to GitHub via the API. No local git repo is involved. The modules and workflows being released are taken from the CX server database, not from local files. The YAML file arguments only identify *which* items to include by their IDs.
442
+
443
+ **Important:** Modules and workflows must be deployed to the TMS server before they can be released. Use `cxtms appmodule deploy` or `cxtms workflow deploy` first, then `cxtms app release` to commit them to GitHub.
444
+
445
+ **Do NOT run `app release` automatically.** Only release when the user explicitly requests it. Releasing creates a branch and PR on GitHub, so it should be done once when all changes are ready — not after every deploy.
446
+
447
+ **Prerequisites:**
448
+ - `app.yaml` must exist with a valid `id` field
449
+ - The app manifest must be installed on the server (`app install` first)
450
+ - The server must have a GitHub token configured for the organization
451
+ - The repository and branch must be set on the app manifest
452
+
453
+ **Related commands:**
454
+ - `npx cxtms app install` — install/refresh app from GitHub into the server
455
+ - `npx cxtms app install --force` — force reinstall even if same version
456
+ - `npx cxtms app install --branch develop` — install from a specific branch
457
+ - `npx cxtms app install --skip-changed` — skip modules with local changes
458
+ - `npx cxtms app list` — list installed app manifests on the server
459
+
460
+ ---
461
+
387
462
  # Generation Rules
388
463
 
389
- 1. **Always scaffold via `cx-cli create module` first** — never write YAML from scratch, never copy templates manually
464
+ 1. **Always scaffold via `cxtms create module` first** — never write YAML from scratch, never copy templates manually
390
465
  2. **Use localized strings** `{ en-US: "..." }` for all user-visible text
391
466
  3. **Follow naming conventions**:
392
467
  - Module names: PascalCase (e.g., `WarehouseLocations`)
@@ -394,9 +469,9 @@ Reusable select components (e.g., `Countries/Select`, `Ports/Select`) follow thi
394
469
  - Route paths: kebab-case (e.g., `/warehouse-locations`)
395
470
  - Permission names: PascalCase with slashes (e.g., `WarehouseLocations/Read`, `System/Contacts/Update`)
396
471
  4. **Template expressions** use `{{ expression }}` syntax (double curly braces)
397
- 5. **Include fileName** property pointing to the YAML file location
472
+ 5. **Include filePath** property pointing to the YAML file location
398
473
  6. **Set proper entityKind** when defining entities (Order, Contact, OrderEntity, AccountingTransaction, Calendar, CalendarEvent, Other)
399
474
  7. **DataGrid options** requires ALL properties: query, rootEntityName, entityKeys, navigationType, enableDynamicGrid, enableViews, enableSearch, enablePagination, enableColumns, enableFilter, defaultView, onRowClick
400
475
  8. **Form component** requires `validationSchema` in props
401
- 9. **Do not change `appModuleId` or `fileName`** — set correctly by CLI scaffold
402
- 10. **Always validate** the final YAML: `npx cx-cli <file.yaml>`
476
+ 9. **Do not change `appModuleId` or `filePath`** — set correctly by CLI scaffold
477
+ 10. **Always validate** the final YAML: `npx cxtms <file.yaml>`
@@ -1,5 +1,12 @@
1
1
  # Data & Collection Components
2
2
 
3
+ ## Contents
4
+ - Collection component
5
+ - List component
6
+ - ListItem component
7
+ - Datasource component
8
+ - Script component
9
+
3
10
  ## collection
4
11
 
5
12
  Iterates over data items and renders children as templates. Supports drag-and-drop reordering.
@@ -1,5 +1,18 @@
1
1
  # Data Display Components
2
2
 
3
+ ## Contents
4
+ - DataGrid component
5
+ - Text component
6
+ - Markup component
7
+ - Badge component
8
+ - Icon component
9
+ - Image component
10
+ - Photo component
11
+ - Summary component
12
+ - Diff component
13
+ - Viewer component
14
+ - Embed component
15
+
3
16
  ## dataGrid
4
17
 
5
18
  Full-featured data table with views, filtering, sorting, pagination, and row actions.
@@ -31,7 +44,11 @@ Full-featured data table with views, filtering, sorting, pagination, and row act
31
44
  | `defaultView` | `string` | — | Default view name |
32
45
  | `defaultPageSize` | `number` | `20` | Rows per page |
33
46
  | `enableRefresh` | `boolean` | — | Auto-refresh |
47
+ | `refreshInterval` | `number` | `30000` | Auto-refresh polling interval (ms) |
34
48
  | `enableChangeTracking` | `boolean` | `true` | Track data changes |
49
+ | `highlightNew` | `boolean` | `true` | Highlight newly added rows |
50
+ | `highlightUpdated` | `boolean` | `true` | Highlight rows with updated values |
51
+ | `highlightForRefreshes` | `number` | `1` | Per-row TTL — refresh cycles a highlight persists |
35
52
  | `onRowClick` | `action[]` | — | Default row click action |
36
53
  | `onDataLoad` | `action[]` | — | Action after data loads |
37
54
  | `items` | `any` | — | Static data (instead of query) |
@@ -1,5 +1,11 @@
1
1
  # Form & Input Components
2
2
 
3
+ ## Contents
4
+ - Form component
5
+ - Field component
6
+ - FieldCollection component
7
+ - BarcodeScanner component
8
+
3
9
  ## form
4
10
 
5
11
  Data entry form with validation, queries, and submission. Wraps React Hook Form's FormProvider.
@@ -182,7 +188,7 @@ Polymorphic form field — renders different input types based on `type` prop.
182
188
  | `onFocus` | Fires on focus |
183
189
  | `onKeyPress` | Fires on keypress (data: `key`, `keyCode`) |
184
190
  | `onSelectValue` | Fires on select-async value selection |
185
- | `onEditClick` | Fires when edit icon clicked (select-async, permission-gated) |
191
+ | `onEditClick` | Fires when edit icon clicked. Supported on text and select-async fields. Passes current form values (with optional `valueFieldName`) to the action context |
186
192
 
187
193
  ```yaml
188
194
  # Text field
@@ -1,5 +1,16 @@
1
1
  # Interactive & Navigation Components
2
2
 
3
+ ## Contents
4
+ - Button component
5
+ - Dropdown component
6
+ - MenuButton component
7
+ - Link component
8
+ - Redirect component
9
+ - Navbar component
10
+ - NavbarItem component
11
+ - NavbarLink component
12
+ - NavDropdown component
13
+
3
14
  ## button
4
15
 
5
16
  MUI Button with icon, label, loading state, and action dispatch.
@@ -1,5 +1,16 @@
1
1
  # Layout & Structure Components
2
2
 
3
+ ## Contents
4
+ - Layout component
5
+ - Row component
6
+ - Col component
7
+ - Header component
8
+ - Tabs component
9
+ - Toolbar component
10
+ - Card component
11
+ - Line component
12
+ - Slot component
13
+
3
14
  ## layout
4
15
 
5
16
  General-purpose container. Renders MUI Grid or Box with flexbox.
@@ -1,5 +1,15 @@
1
1
  # Specialized Components
2
2
 
3
+ ## Contents
4
+ - Calendar component
5
+ - Notes component
6
+ - Dashboard component
7
+ - DashboardWidget component
8
+ - Widget component
9
+ - Timeline component
10
+ - TimelineGrid component
11
+ - OAuth2 component
12
+
3
13
  ## calendar
4
14
 
5
15
  FullCalendar integration with GraphQL event sources, timezone support, and programmatic control.
@@ -331,7 +341,9 @@ CSS Grid-based timeline with swim lanes, drill-down, and virtual scrolling.
331
341
  | `view` | `day \| week \| month \| year` | `week` | Time view |
332
342
  | `startDate` / `endDate` | `string` | — | Date range |
333
343
  | `eventSources` | `EventSource[]` | — | Event data sources |
344
+ | `eventSources[].query.name` | `string` | `query1`, `query2`... | Source name, used as key in `summaryComponent` `dataSources` |
334
345
  | `eventTemplate` | `ComponentProps` | — | Custom event template |
346
+ | `summaryComponent` | `ComponentProps` | — | Custom component rendered per column in the summary row. Replaces numeric totals when set. |
335
347
  | `options.height` | `string \| number` | `600` | Container height |
336
348
  | `options.cellHeight` | `number` | `60/100` | Cell height (px) |
337
349
  | `options.groupBy` | `string` | — | Field for swim lane grouping |
@@ -342,6 +354,14 @@ CSS Grid-based timeline with swim lanes, drill-down, and virtual scrolling.
342
354
  | `options.showWeekends` | `boolean` | `true` | Show weekends |
343
355
  | `options.showTotalCount` | `boolean` | `false` | Show event totals |
344
356
 
357
+ **Summary component variables** (available when `summaryComponent` is set):
358
+ | Variable | Type | Description |
359
+ |----------|------|-------------|
360
+ | `dataSources` | `Record<string, TimelineEvent[]>` | Per-source events filtered to the column, keyed by `query.name` |
361
+ | `column` | `ColumnDefinition` | Column metadata (`id`, `label`, `date`, `startDate`, `endDate`) |
362
+ | `columnIndex` | `number` | Zero-based column index |
363
+ | `totalCount` | `number` | Total event count for the column across all sources |
364
+
345
365
  **Events:**
346
366
  | Event | Data | Description |
347
367
  |-------|------|-------------|
@@ -387,6 +407,36 @@ props:
387
407
  props: { date: "{{ date }}", assignee: "{{ row }}" }
388
408
  ```
389
409
 
410
+ **Summary component example** (per-source breakdown per column):
411
+ ```yaml
412
+ component: timeline-grid
413
+ props:
414
+ view: week
415
+ options: { height: 600, enableNavigation: true }
416
+ eventSources:
417
+ - query:
418
+ name: ups
419
+ command: "query($s:String!,$e:String!){ upsShipments(start:$s,end:$e){ id date title } }"
420
+ variables: { s: "{{ startDate }}", e: "{{ endDate }}" }
421
+ path: upsShipments
422
+ - query:
423
+ name: fedex
424
+ command: "query($s:String!,$e:String!){ fedexShipments(start:$s,end:$e){ id date title } }"
425
+ variables: { s: "{{ startDate }}", e: "{{ endDate }}" }
426
+ path: fedexShipments
427
+ summaryComponent:
428
+ component: layout
429
+ props:
430
+ direction: column
431
+ children:
432
+ - component: text
433
+ props: { value: "UPS: {{ dataSources.ups.length }}" }
434
+ - component: text
435
+ props: { value: "FedEx: {{ dataSources.fedex.length }}" }
436
+ - component: text
437
+ props: { value: "Total: {{ totalCount }}" }
438
+ ```
439
+
390
440
  ---
391
441
 
392
442
  ## oauth2
@@ -1,27 +1,36 @@
1
1
  ---
2
2
  name: cx-workflow
3
- description: Generate schema-valid CargoXplorer workflow YAML files (standard process and Flow state machine workflows)
3
+ description: >
4
+ Works with CXTMS workflow YAML files — creates, modifies, fixes, validates, and deploys standard process and Flow state machine workflows.
5
+ Use when the user asks to create, modify, or fix a workflow YAML file, references workflow/*.yaml files, or asks about workflow tasks/triggers/activities in a CX project.
6
+ Not for module YAML files, TypeScript code, or non-YAML tasks.
4
7
  argument-hint: <description of what to build>
5
8
  ---
6
9
 
7
10
  You are a CargoXplorer workflow YAML builder. You generate schema-valid YAML for CX workflows — both standard process workflows (activities, steps, triggers) and Flow state machine workflows (entity lifecycle, states, transitions). All output must conform to the JSON schemas in `.cx-schema/`.
8
11
 
9
- **IMPORTANT — use `cx-cli` for all workflow operations:**
10
- - **Scaffold**: `npx cx-cli create workflow <name> --template <template>` — generates a schema-valid YAML file. ALWAYS run this first, then read the generated file, then customize. Do NOT write YAML from scratch or copy templates manually.
11
- - **Validate**: `npx cx-cli <file.yaml>` — run after every change
12
- - **Schema lookup**: `npx cx-cli schema <task>` — e.g., `cx-cli schema graphql`, `cx-cli schema foreach`, `cx-cli schema action-event`. Schema names use kebab-case file names. Case-insensitive: `ActionEvent` resolves to `action-event`.
13
- - **Examples**: `npx cx-cli example <task>` — show example YAML for a task
14
- - **List schemas**: `npx cx-cli list --type workflow` — shows all available task schemas in the Tasks section
15
- - **Feature folder**: `npx cx-cli create workflow <name> --template <template> --feature <feature-name>`
12
+ **IMPORTANT — use `cxtms` for all workflow operations:**
13
+ - **Scaffold**: `npx cxtms create workflow <name> --template <template>` — generates a schema-valid YAML file. ALWAYS run this first, then read the generated file, then customize. Do NOT write YAML from scratch or copy templates manually.
14
+ - **Validate**: `npx cxtms <file.yaml>` — run after every change
15
+ - **Schema lookup**: `npx cxtms schema <task>` — e.g., `cxtms schema graphql`, `cxtms schema foreach`, `cxtms schema action-event`. Schema names use kebab-case file names. Case-insensitive: `ActionEvent` resolves to `action-event`.
16
+ - **Examples**: `npx cxtms example <task>` — show example YAML for a task
17
+ - **List schemas**: `npx cxtms list --type workflow` — shows all available task schemas in the Tasks section
18
+ - **Feature folder**: `npx cxtms create workflow <name> --template <template> --feature <feature-name>`
19
+ - **Deploy to server**: `npx cxtms workflow deploy <file.yaml> --org <id>` — creates or updates workflow on the CX server
20
+ - **Undeploy from server**: `npx cxtms workflow undeploy <workflowId> --org <id>` — removes a workflow by UUID
21
+ - **Execute**: `npx cxtms workflow execute <workflowId|file.yaml> --org <id> [--vars '<json>'] [--file varName=path]` — trigger a workflow execution (--file uploads a local file and passes the URL as a variable)
22
+ - **List logs**: `npx cxtms workflow logs <workflowId|file.yaml> --org <id> [--from YYYY-MM-DD] [--to YYYY-MM-DD]` — list executions with log availability
23
+ - **Download log**: `npx cxtms workflow log <executionId> --org <id> [--json] [--console] [--output <file>]` — download execution log
24
+ - **Publish all**: `npx cxtms publish [--feature <name>] --org <id>` — deploy all modules and workflows to the server
16
25
 
17
26
  ## Generation Workflow
18
27
 
19
28
  ### Step 1: Scaffold via CLI — MANDATORY
20
29
 
21
- **You MUST run `cx-cli create workflow` to generate the initial file.** Do not skip this step. Do not write YAML from scratch. Do not read template files and copy them manually. The CLI generates correct UUIDs, file paths, and structure.
30
+ **You MUST run `cxtms create workflow` to generate the initial file.** Do not skip this step. Do not write YAML from scratch. Do not read template files and copy them manually. The CLI generates correct UUIDs, file paths, and structure.
22
31
 
23
32
  ```bash
24
- npx cx-cli create workflow <name> --template <template>
33
+ npx cxtms create workflow <name> --template <template>
25
34
  ```
26
35
 
27
36
  | Template | Use Case |
@@ -71,7 +80,7 @@ npx cx-cli create workflow <name> --template <template>
71
80
  ### Step 4: Validate
72
81
 
73
82
  ```bash
74
- npx cx-cli <generated-file.yaml>
83
+ npx cxtms <generated-file.yaml>
75
84
  ```
76
85
 
77
86
  ### File Placement
@@ -182,7 +191,8 @@ events: # Workflow-level event handlers
182
191
 
183
192
  ## Variable References (quick summary)
184
193
 
185
- For full reference: `!cat .claude/skills/cx-workflow/ref-expressions.md`
194
+ For template expressions and value directives: see [ref-expressions-template.md](.claude/skills/cx-workflow/ref-expressions-template.md)
195
+ For NCalc conditions and functions: see [ref-expressions-ncalc.md](.claude/skills/cx-workflow/ref-expressions-ncalc.md)
186
196
 
187
197
  **`{{ path }}`** — in step inputs. Single `{{ }}` returns raw object. Multiple returns string interpolation.
188
198
  **`[variable]`** — in conditions and `expression:` directives. NCalc syntax.
@@ -285,7 +295,8 @@ Implicit variable: `iteration` (zero-based).
285
295
 
286
296
  | Reference | Load |
287
297
  |-----------|------|
288
- | Expressions & Functions | `!cat .claude/skills/cx-workflow/ref-expressions.md` |
298
+ | Template Expressions & Value Directives | `!cat .claude/skills/cx-workflow/ref-expressions-template.md` |
299
+ | NCalc Expressions & Functions | `!cat .claude/skills/cx-workflow/ref-expressions-ncalc.md` |
289
300
  | Flow Workflows (state machines) | `!cat .claude/skills/cx-workflow/ref-flow.md` |
290
301
 
291
302
  ## Dynamic Schema Access (load on demand)
@@ -307,19 +318,117 @@ Implicit variable: `iteration` (zero-based).
307
318
 
308
319
  ---
309
320
 
310
- ## Debugging Workflow Executions
321
+ ## Server Workflow Commands
311
322
 
312
- When TMS MCP returns gzip file URLs for workflow execution logs, decompress with:
323
+ Deploy, undeploy, and release commands are listed in the CLI section at the top of this file. For authentication setup (login, PAT tokens, org management): see [cx-core/ref-cli-auth.md](.claude/skills/cx-core/ref-cli-auth.md)
324
+
325
+ ### Releasing App to GitHub
326
+
327
+ Use `app release` to release modified workflows and modules from the CX server to a GitHub repository. This creates a branch and pull request — it does NOT push directly to the target branch.
313
328
 
314
329
  ```bash
315
- node -e "const https=require('https'),zlib=require('zlib'),fs=require('fs');https.get(process.argv[1],r=>r.pipe(zlib.createGunzip()).pipe(fs.createWriteStream(process.argv[2])))" "<url>" "<output-file>"
330
+ # Release all unpublished changes to GitHub (creates a PR) message is required
331
+ npx cxtms app release -m "Add order notification workflow"
332
+
333
+ # Release specific workflows and/or modules by YAML file
334
+ npx cxtms app release -m "Fix tracking workflow" workflows/my-workflow.yaml
335
+ npx cxtms app release -m "Update shipping" workflows/a.yaml modules/b.yaml
336
+
337
+ # Force release all workflows and modules (not just unpublished ones)
338
+ npx cxtms app release -m "Full republish" --force
339
+
340
+ # Release with explicit org
341
+ npx cxtms app release -m "Add order notification workflow" --org 42
316
342
  ```
317
343
 
344
+ **What `app release` does:**
345
+ 1. Reads `app.yaml` for the `id` (appManifestId), repository, and branch
346
+ 2. Increments the app version (patch bump)
347
+ 3. Creates a `publish/{app-name}-v{version}-{timestamp}` branch on GitHub
348
+ 4. Commits `app.yaml` + selected workflow/module YAML files to the branch
349
+ 5. Creates a pull request from the publish branch to the target branch
350
+ 6. Marks published workflows and modules as `hasUnpublishedChanges: false`
351
+
352
+ **This is a release-to-git operation** — it commits the current server-side YAML directly to GitHub via the API. No local git repo is involved. The workflows and modules being released are taken from the CX server database, not from local files. The YAML file arguments only identify *which* items to include by their IDs.
353
+
354
+ **Important:** Workflows and modules must be deployed to the TMS server before they can be released. Use `cxtms workflow deploy` or `cxtms appmodule deploy` first, then `cxtms app release` to commit them to GitHub.
355
+
356
+ **Do NOT run `app release` automatically.** Only release when the user explicitly requests it. Releasing creates a branch and PR on GitHub, so it should be done once when all changes are ready — not after every deploy.
357
+
358
+ **Prerequisites:**
359
+ - `app.yaml` must exist with a valid `id` field
360
+ - The app manifest must be installed on the server (`app install` first)
361
+ - The server must have a GitHub token configured for the organization
362
+ - The repository and branch must be set on the app manifest
363
+
364
+ **Related commands:**
365
+ - `npx cxtms app install` — install/refresh app from GitHub into the server
366
+ - `npx cxtms app install --force` — force reinstall even if same version
367
+ - `npx cxtms app install --branch develop` — install from a specific branch
368
+ - `npx cxtms app install --skip-changed` — skip modules with local changes
369
+ - `npx cxtms app list` — list installed app manifests on the server
370
+
371
+ ### Execute
372
+
373
+ ```bash
374
+ # Execute a workflow by UUID or YAML file
375
+ npx cxtms workflow execute <workflowId>
376
+ npx cxtms workflow execute workflows/my-workflow.yaml
377
+
378
+ # Pass input variables as JSON
379
+ npx cxtms workflow execute <workflowId> --vars '{"city": "London", "count": 5}'
380
+
381
+ # Upload a local file and pass its URL as a workflow variable
382
+ npx cxtms workflow execute workflow.yaml --file importFile=/path/to/data.csv
383
+
384
+ # Combine variables and file uploads
385
+ npx cxtms workflow execute workflow.yaml --vars '{"mode": "preview"}' --file importFile=data.csv --file templateFile=template.xlsx
386
+ ```
387
+
388
+ `--file varName=path` uploads the local file to the server via presigned URL and sets the resulting URL as the named variable. Can be specified multiple times.
389
+
390
+ Returns execution result including `executionId`, `isAsync`, `outputs` (for Sync workflows).
391
+
392
+ ### Execution Logs
393
+
394
+ ```bash
395
+ # List executions with log availability (sorted desc by date)
396
+ npx cxtms workflow logs <workflowId|file.yaml>
397
+
398
+ # Filter by date range
399
+ npx cxtms workflow logs <workflowId> --from 2026-01-01 --to 2026-01-31
400
+
401
+ # Download a specific execution log (saves to temp dir by default)
402
+ npx cxtms workflow log <executionId>
403
+
404
+ # Save to specific file
405
+ npx cxtms workflow log <executionId> --output mylog.txt
406
+
407
+ # Print to stdout
408
+ npx cxtms workflow log <executionId> --console
409
+
410
+ # Download JSON log (richer data: inputs, outputs, timing, metadata)
411
+ npx cxtms workflow log <executionId> --json
412
+
413
+ # JSON log to stdout
414
+ npx cxtms workflow log <executionId> --json --console
415
+ ```
416
+
417
+ `workflow logs` shows a table with execution status, date, duration, user, and log availability indicators (filled/empty circle). `workflow log` downloads the actual log content from the server (gzip-compressed S3 URLs).
418
+
419
+ ### Debugging Tips
420
+
421
+ - Use `--json` for detailed structured data (ExecutionId, Inputs, Outputs, Exception, timing)
422
+ - Text logs show step-by-step execution trace with timestamps
423
+ - Sync workflow executions may not appear in `workflow logs` — they return results inline
424
+ - Use `workflow execute --vars` to test workflows with specific inputs
425
+ - Use `workflow execute --file varName=path` to upload local files for workflows that expect file URL inputs
426
+
318
427
  ---
319
428
 
320
429
  ## Generation Rules
321
430
 
322
- 1. **Always scaffold via `cx-cli create workflow` first** — never write YAML from scratch, never copy templates manually
431
+ 1. **Always scaffold via `cxtms create workflow` first** — never write YAML from scratch, never copy templates manually
323
432
  2. **Naming conventions**: step names PascalCase, variables camelCase, states PascalCase, transitions camelCase
324
433
  3. **Template expressions** use `{{ expression }}` — NCalc conditions use `[variable]`
325
434
  4. **Do not change `workflowId` or `filePath`** — set correctly by CLI scaffold
@@ -327,4 +436,4 @@ node -e "const https=require('https'),zlib=require('zlib'),fs=require('fs');http
327
436
  6. **Flow workflows** require `entity`, `states`, `transitions` (no `activities`)
328
437
  7. **Entity triggers** require `entityName` and `eventType`
329
438
  8. **Always use null-safe `?`** on variable paths — `Activity?.Step?.output?` — unless referencing guaranteed system variables (see Variable References section)
330
- 9. **Always validate** the final YAML: `npx cx-cli <file.yaml>`
439
+ 9. **Always validate** the final YAML: `npx cxtms <file.yaml>`
@@ -1,5 +1,13 @@
1
1
  # Communication & Document Tasks Reference
2
2
 
3
+ ## Contents
4
+ - Email/Send task (send emails with templates and attachments)
5
+ - Email/VerifyCode task (send and verify email verification codes)
6
+ - Document/Render task (render PDF or Excel from HTML templates)
7
+ - Document/Send task (send a previously rendered document)
8
+ - Attachment tasks (Create, Update, Thumbnail, PdfThumbnail, RegenerateThumbnails)
9
+ - PdfDocument/Merge task (merge multiple PDFs into one)
10
+
3
11
  ## Email/Send
4
12
 
5
13
  Sends emails with optional templates and attachments.