@cxtms/cx-schema 1.6.1 → 1.6.4

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.
@@ -6,6 +6,91 @@ argument-hint: <entity name or question about fields>
6
6
 
7
7
  Shared domain reference for CargoXplorer entities. Used by `cx-workflow` and `cx-module` skills for entity field names, types, navigation properties, enums, and customValues extension patterns.
8
8
 
9
+ ## CX Server Authentication & Management
10
+
11
+ The CLI can authenticate against CX environments and manage server resources. Auth is required for push, delete, execute, logs, publish, and org commands.
12
+
13
+ ### Authentication
14
+
15
+ ```bash
16
+ # Login to a CX environment (OAuth2 + PKCE — opens browser)
17
+ npx cx-cli login https://tms-v3-dev.usatrt.com
18
+
19
+ # Logout from current session
20
+ npx cx-cli logout
21
+ ```
22
+
23
+ The session is stored at `~/.cxtms/<project-dir>/.session.json`, scoped by project directory name. Each project gets its own server session. The CLI auto-refreshes expired tokens.
24
+
25
+ ### PAT Tokens (alternative to OAuth)
26
+
27
+ For CI/CD or headless environments, use Personal Access Tokens instead of interactive OAuth:
28
+
29
+ ```bash
30
+ # Check PAT status and setup instructions
31
+ npx cx-cli pat setup
32
+
33
+ # Create a new PAT token (requires OAuth login first)
34
+ npx cx-cli pat create "my-ci-token"
35
+
36
+ # List active PAT tokens
37
+ npx cx-cli pat list
38
+
39
+ # Revoke a PAT token
40
+ npx cx-cli pat revoke <tokenId>
41
+ ```
42
+
43
+ After creating a PAT, add to `.env` in your project root:
44
+ ```
45
+ CXTMS_AUTH=pat_xxxxx...
46
+ CXTMS_SERVER=https://tms-v3-dev.usatrt.com
47
+ ```
48
+
49
+ When `CXTMS_AUTH` is set, the CLI skips OAuth and uses the PAT token directly. `CXTMS_SERVER` provides the server URL (or set `server` in `app.yaml`).
50
+
51
+ ### Organization Management
52
+
53
+ ```bash
54
+ # List organizations on the server
55
+ npx cx-cli orgs list
56
+
57
+ # Select an organization interactively
58
+ npx cx-cli orgs select
59
+
60
+ # Set active organization by ID
61
+ npx cx-cli orgs use <orgId>
62
+
63
+ # Show current context (server, org, app)
64
+ npx cx-cli orgs use
65
+ ```
66
+
67
+ The active org is cached in the session file and used by all server commands. Override with `--org <id>`.
68
+
69
+ ### Session Resolution
70
+
71
+ Server commands resolve the target session in this order:
72
+ 1. `CXTMS_AUTH` env var → PAT token auth (with `CXTMS_SERVER` or `app.yaml` server field)
73
+ 2. `~/.cxtms/<project-dir>/.session.json` → project-scoped OAuth session
74
+ 3. Not logged in → error
75
+
76
+ ### Publish
77
+
78
+ ```bash
79
+ # Publish all modules and workflows from current project
80
+ npx cx-cli publish
81
+
82
+ # Publish only a specific feature directory
83
+ npx cx-cli publish --feature billing
84
+ npx cx-cli publish billing
85
+
86
+ # Publish with explicit org ID
87
+ npx cx-cli publish --org 42
88
+ ```
89
+
90
+ Validates all YAML files first, then pushes modules and workflows to the server. Skips files with validation errors and reports results.
91
+
92
+ ---
93
+
9
94
  ## Feature File Layout
10
95
 
11
96
  All modules and workflows are organized under feature directories:
@@ -15,6 +15,9 @@ You are a CargoXplorer module YAML builder. You generate schema-valid YAML for C
15
15
  - **List schemas**: `npx cx-cli list`
16
16
  - **Extract**: `npx cx-cli extract <source> <component> --to <target>` — move components between modules
17
17
  - **Feature folder**: `npx cx-cli create module <name> --template <template> --feature <feature-name>`
18
+ - **Push to server**: `npx cx-cli appmodule push <file.yaml>` — creates or updates module on the CX server
19
+ - **Delete from server**: `npx cx-cli appmodule delete <appModuleId>` — removes a module by UUID
20
+ - **Publish all**: `npx cx-cli publish [--feature <name>]` — push all modules and workflows to the server
18
21
 
19
22
  ## Generation Workflow
20
23
 
@@ -384,6 +387,29 @@ Reusable select components (e.g., `Countries/Select`, `Ports/Select`) follow thi
384
387
 
385
388
  ---
386
389
 
390
+ ## Server Module Commands
391
+
392
+ ### Push / Delete
393
+
394
+ ```bash
395
+ # Push a module YAML to the server (creates or updates)
396
+ npx cx-cli appmodule push modules/my-module.yaml
397
+
398
+ # Push with explicit org ID
399
+ npx cx-cli appmodule push modules/my-module.yaml --org 42
400
+
401
+ # Delete an app module by UUID
402
+ npx cx-cli appmodule delete <appModuleId>
403
+
404
+ # Publish all modules and workflows (validates first)
405
+ npx cx-cli publish
406
+ npx cx-cli publish --feature billing
407
+ ```
408
+
409
+ Push reads `module.appModuleId` from the YAML, queries the server, and creates or updates accordingly. Requires an active session (`cx-cli login` or PAT token — see cx-core skill).
410
+
411
+ ---
412
+
387
413
  # Generation Rules
388
414
 
389
415
  1. **Always scaffold via `cx-cli create module` first** — never write YAML from scratch, never copy templates manually
@@ -13,6 +13,12 @@ You are a CargoXplorer workflow YAML builder. You generate schema-valid YAML for
13
13
  - **Examples**: `npx cx-cli example <task>` — show example YAML for a task
14
14
  - **List schemas**: `npx cx-cli list --type workflow` — shows all available task schemas in the Tasks section
15
15
  - **Feature folder**: `npx cx-cli create workflow <name> --template <template> --feature <feature-name>`
16
+ - **Push to server**: `npx cx-cli workflow push <file.yaml>` — creates or updates workflow on the CX server
17
+ - **Delete from server**: `npx cx-cli workflow delete <workflowId>` — removes a workflow by UUID
18
+ - **Execute**: `npx cx-cli workflow execute <workflowId|file.yaml> [--vars '<json>']` — trigger a workflow execution
19
+ - **List logs**: `npx cx-cli workflow logs <workflowId|file.yaml> [--from YYYY-MM-DD] [--to YYYY-MM-DD]` — list executions with log availability
20
+ - **Download log**: `npx cx-cli workflow log <executionId> [--json] [--console] [--output <file>]` — download execution log
21
+ - **Publish all**: `npx cx-cli publish [--feature <name>]` — push all modules and workflows to the server
16
22
 
17
23
  ## Generation Workflow
18
24
 
@@ -307,14 +313,71 @@ Implicit variable: `iteration` (zero-based).
307
313
 
308
314
  ---
309
315
 
310
- ## Debugging Workflow Executions
316
+ ## Server Workflow Commands
311
317
 
312
- When TMS MCP returns gzip file URLs for workflow execution logs, decompress with:
318
+ ### Push / Delete
313
319
 
314
320
  ```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>"
321
+ # Push a workflow YAML to the server (creates or updates)
322
+ npx cx-cli workflow push workflows/my-workflow.yaml
323
+
324
+ # Delete a workflow by UUID
325
+ npx cx-cli workflow delete <workflowId>
326
+
327
+ # Publish all modules and workflows (validates first)
328
+ npx cx-cli publish
329
+ npx cx-cli publish --feature billing
330
+ ```
331
+
332
+ Push reads `workflow.workflowId` from the YAML, queries the server, and creates or updates accordingly. Requires an active session (`cx-cli login` or PAT token — see cx-core skill).
333
+
334
+ ### Execute
335
+
336
+ ```bash
337
+ # Execute a workflow by UUID or YAML file
338
+ npx cx-cli workflow execute <workflowId>
339
+ npx cx-cli workflow execute workflows/my-workflow.yaml
340
+
341
+ # Pass input variables as JSON
342
+ npx cx-cli workflow execute <workflowId> --vars '{"city": "London", "count": 5}'
343
+ ```
344
+
345
+ Returns execution result including `executionId`, `isAsync`, `outputs` (for Sync workflows).
346
+
347
+ ### Execution Logs
348
+
349
+ ```bash
350
+ # List executions with log availability (sorted desc by date)
351
+ npx cx-cli workflow logs <workflowId|file.yaml>
352
+
353
+ # Filter by date range
354
+ npx cx-cli workflow logs <workflowId> --from 2026-01-01 --to 2026-01-31
355
+
356
+ # Download a specific execution log (saves to temp dir by default)
357
+ npx cx-cli workflow log <executionId>
358
+
359
+ # Save to specific file
360
+ npx cx-cli workflow log <executionId> --output mylog.txt
361
+
362
+ # Print to stdout
363
+ npx cx-cli workflow log <executionId> --console
364
+
365
+ # Download JSON log (richer data: inputs, outputs, timing, metadata)
366
+ npx cx-cli workflow log <executionId> --json
367
+
368
+ # JSON log to stdout
369
+ npx cx-cli workflow log <executionId> --json --console
316
370
  ```
317
371
 
372
+ `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).
373
+
374
+ ### Debugging Tips
375
+
376
+ - Use `--json` for detailed structured data (ExecutionId, Inputs, Outputs, Exception, timing)
377
+ - Text logs show step-by-step execution trace with timestamps
378
+ - Sync workflow executions may not appear in `workflow logs` — they return results inline
379
+ - Use `workflow execute --vars` to test workflows with specific inputs
380
+
318
381
  ---
319
382
 
320
383
  ## Generation Rules