Push & Pull Configuration
The Serval CLI enables you to manage your team’s workflows locally, allowing you to use your preferred development tools and integrate with version control systems like Git.Authentication
Before you can pull or push workflows, you need to authenticate with Serval:- The CLI will display a device code and URL
- Visit the URL in your browser (e.g.,
https://app.serval.com/auth/device?code=XXXX-1234
) - Confirm the authentication in your browser
- The CLI will automatically detect successful authentication
Finding Your Team Prefix
To work with a team’s workflows, you need its prefix. You can find team prefixes by:- Visiting admin settings in Serval
- Navigating to the Teams section
- Looking for the team prefix (e.g.,
EXA
,DEV
,OPS
)
Pulling Workflows
To download a team’s workflows and configuration:Directory Structure
- Team Directory: Named after the team prefix (e.g.,
EXA/
) - team.yaml: Contains team-level metadata and configuration
- workflows/: Contains all workflows for the team
- Workflow Folders: Each workflow has its own directory with:
index.ts
: The TypeScript implementation of the workflowworkflow.yaml
: Workflow metadata and configuration
Workflow Metadata (workflow.yaml)
Each workflow includes aworkflow.yaml
file with the following structure:
- name: Display name of the workflow
- description: Detailed description of what the workflow does
- slug: URL-friendly identifier (must match the folder name)
- deployed: Whether the workflow is active in Serval
- approval_procedure: Defines who can approve workflow runs
- version: Workflow version number
Editing Workflows
Once pulled, you can edit workflows using any text editor or IDE:- Modify workflow code: Edit the
index.ts
file to change workflow behavior - Update metadata: Modify
workflow.yaml
to change description, approval procedures, etc. - Test locally: Use your standard TypeScript development tools
- Version control: Commit changes to Git or your preferred VCS
Pushing Changes
After making local changes, push them back to Serval:- Validate your local changes
- Compare with the remote state
- Upload modified workflows
- Update workflow versions
- Deploy changes if
deployed: true
Push Behavior
- New workflows: Created if they don’t exist in Serval
- Modified workflows: Updated with your changes
- Deleted workflows: Not automatically deleted (manual deletion required in UI)
- Validation: The CLI validates YAML syntax and basic structure before pushing
Working with Multiple Teams
You can manage workflows for multiple teams:Best Practices
Version Control
-
Initialize Git in your workflow directory:
-
Use branches for workflow changes:
Development Workflow
-
Pull latest: Always pull before making changes
- Make changes: Edit workflows locally
- Test: Validate your TypeScript code
- Commit: Save changes to version control
-
Push: Deploy to Serval