CLI Walkthrough
This lesson walks through a complete CLI session from first login to creating and validating your first module file. Follow along in your terminal. You will use these commands every day as a CXTMS developer.
Prerequisites
- Node.js 18 or later installed
- Access credentials for a CXTMS development server
- Your organization ID (ask your team lead if unsure)
Step 1: Verify the CLI is Available
Confirm npx can reach the CLI before starting:
bash1npx cxtms --version
Expected output:
cxtms/2.1.0 win32-x64 node-v20.11.0
If you see a version number, you are ready. If the command fails, verify your Node.js installation with node --version.
Step 2: Log In to the Development Server
Authenticate with your development environment:
bash1npx cxtms login https://tms-v3-dev.usatrt.com
The CLI opens your default browser to the CXTMS login page. Sign in with your credentials. After successful authentication, the browser shows a confirmation message and the CLI prints:
1✓ Logged in successfully2 Server: https://tms-v3-dev.usatrt.com3 User: you@yourcompany.com4 Session saved to ~/.cxtms/my-project/.session.json
Close the browser tab and return to your terminal.
Step 3: List Available Organizations
See which organizations are available on the server:
bash1npx cxtms orgs list
Expected output:
1Organizations on https://tms-v3-dev.usatrt.com:2 ID Name Status3 ---- ---------------------- --------4 1 Demo Freight Co. Active5 42 Acme Logistics Dev Active67Active org: (none selected)
Step 4: Select Your Working Organization
Set the active organization. You can use the interactive picker:
bash1npx cxtms orgs select
Or set it directly by ID (faster once you know the ID):
bash1npx cxtms orgs use 42
Confirm the context is correct:
bash1npx cxtms orgs use
Expected output:
1Current context:2 Server: https://tms-v3-dev.usatrt.com3 Org: 42 — Acme Logistics Dev4 App: acme-logistics (v1.4.2)
All subsequent server commands will target organization 42 until you change it.
Step 5: Explore Available Commands
Get the full command list:
bash1npx cxtms --help
Explore a specific command's options:
bash1npx cxtms create --help2npx cxtms publish --help
List all available module and workflow schema names:
bash1npx cxtms list
This shows every component the CLI knows about — module templates, workflow task schemas, and their schema names.
Step 6: Check Module Templates
Before creating a module, explore what templates are available and what the grid template produces:
bash1# See an example of the grid template structure2npx cxtms example dataGrid
The output shows an annotated YAML snippet for a data grid component — the same structure that will be generated when you scaffold a grid module.
Check the schema for form fields to understand what field types are supported:
bash1npx cxtms schema formField
Step 7: Scaffold a Sample Module
Create a project directory and scaffold your first module. This example creates a grid that lists Orders:
bash1# Create a feature directory structure2mkdir -p features/shipments/modules34# Scaffold a grid module with the --feature flag (auto-places in features/shipments/modules/)5npx cxtms create module "Order List" --template grid --feature shipments
Expected output:
✓ Created features/shipments/modules/order-list-module.yaml
Open the generated file in your editor. Notice it contains:
- A
moduleIdUUID generated automatically entityKind: Orderas the default entity- A
viewsarray with a sample data grid view - A
routesarray registering the module in the navigation - Placeholder column definitions to customize
Step 8: Validate the Generated File
Validate the newly created file to confirm it is schema-valid before making any changes:
bash1npx cxtms features/shipments/modules/order-list-module.yaml
Expected output:
✓ features/shipments/modules/order-list-module.yaml — valid
Now make a deliberate mistake to see what a validation error looks like. Open the file and delete the required field property from one of the column definitions, then validate again:
bash1npx cxtms features/shipments/modules/order-list-module.yaml
Example error output:
1✗ features/shipments/modules/order-list-module.yaml2 [views[0].columns[0]] Required property 'field' is missing
The error message tells you exactly which path in the YAML is invalid. Fix the mistake and re-validate before continuing.
Step 9: Explore Component Schemas
Before customizing your module's columns, check what properties a column definition supports:
bash1npx cxtms schema columnDef
To see what filter types are available for grid views:
bash1npx cxtms schema filterDef
To see an example of a complete data grid view with columns and filters:
bash1npx cxtms example dataGrid
Use these commands any time you need to look up what properties are available or what values an enum accepts. The schemas are always in sync with the server's current version — you never need to dig through documentation.
Step 10: Validate All Features
When working across multiple feature directories, validate everything at once:
bash1npx cxtms features/
Expected output when all files are valid:
1✓ features/shipments/modules/order-list-module.yaml — valid2 1 file(s) validated, 0 error(s)
This is the command to run before every publish or deploy to catch any issues across the entire project.
What's Next
You now have a working CLI setup and have completed the essential workflow:
- Login → 2. Select org → 3. Scaffold → 4. Validate → 5. Customize → 6. Re-validate → 7. Deploy
In the upcoming topics, you will learn how to customize module YAML files to build real Order and Contact screens, and how to author workflow YAML files to automate business processes.
For reference, the full set of auth and org commands covered in this topic:
bash1npx cxtms login <server> # OAuth2 interactive login2npx cxtms logout # End session3npx cxtms pat create "<name>" # Create a PAT for CI/CD4npx cxtms pat list # List active PATs5npx cxtms pat revoke <id> # Revoke a PAT6npx cxtms orgs list # List organizations7npx cxtms orgs select # Interactive org picker8npx cxtms orgs use <id> # Set active org by ID9npx cxtms orgs use # Show current context