@agility/cli
v0.0.16
Published
Agility CLI for working with your content.
Downloads
119
Readme
Agility CLI
About the Agility CLI
- Provides a facility to developers to use the new Agility Management API more effectively.
- Provides features to perform operations to login to agility instance, pull the instance, push the instance and clone the instance (coupling of push and pull operations).
- Provides logs on failed records for content and pages.
- Ability to generate Content and Pages in bulk for a Website.
- Deleted Content, Pages, Models, Containers and Assets were not processed from the CLI.
Getting Started
Installation
Using npm
- To install the cli locally using npm, open terminal and type:
npm i @agility/cli
. - For global installation using npm, open terminal and type:
npm i @agility/cli -g
.
Using yarn
- To install the cli locally using yarn, open terminal and type:
yarn add @agility/cli
. - For global installation using yarn, open terminal and type:
yarn global add @agility/cli
.
Using the CLI
Authenticate first
- Login to agility instance using command
agility login
. - A browser window will appear to perform the authentication process. You may have to authorize before proceeding.
- Once authenticated use the following steps to perform operations on your instance.
- You should be a Org Admin, Instance Admin or have a Manager Role in an instance to perform operations in the CLI.
Performing operations on CLI
- To pull an instance use the command
agility pull --guid="<<Provide Guid of your Instance>>" --locale="<<Provide the locale of the Instance>>" --channel="<<Provide the channel to be pulled>>" --baseUrl="<<Optional Parameter to provide the base URL if the pull operation doesn't work. Refer the section "Base URL's".>>"
to pull an instance. - To push an instance use the command
agility push --guid="<<Provide the target Instance guid>> --locale="<<Provide the locale of the Instance>>"
- For instance cloning, this command is a mix of push and pull. Use the command
agility clone --sourceGuid="<<Provide Guid of your source Instance>>" --targetGuid="<<Provide the target Instance guid>>" --locale="<<Provide the locale of the Instance>>" --channel="<<Provide the channel to be cloned>>"
to perform cloning between instances. - To sync Models use the command
agility sync-models --sourceGuid="<<Optional Parameter Guid of your source instance>>" --targetGuid="<<Optional Parameter Guid of your target Instance>>" --pull="<<Optional Parameter value true/false>>" --dryRun="<<Optional Parameter value true/false>>" --filter="<<Optional Parameter folder path where filter file is present. Ex: - C:\Agility\filterModels.json" --folder="<<Optional Parameter name of the folder where files to be exported. If no value is provided, files will be exported to .agility-files folder>>"
. - To access the error logs, navigate to .agility-files/logs/instancelog.txt
Model Sync File samples
- To generate the filter file, use the following JSON format for models and templates: -
{
"Models": ["MyModel"],//referenceName of the models.
"Templates": ["My Template"] //Template name of the templates.
}
- Following is the format of the file generated for the dry run process: -
{
"ModelReferenceName": {
"result":{
"added":{
},
"updated":{
}
},
"TemplateName":{
"result":{
"added":{
},
"updated":{
}
}
}
}
}
//If a model or template is not present in the target instance, then: -
{
referenceName: 'Model with ModelReferenceName will be added.',
templateName: 'Model with TemplateName will be added.'
}
The file is generated at <Folder Name>\models-sync\modelsDryRun.json
(where Folder Name is .agility-files
or the value provided inside the folder parameter).
Model Sync Sample commands
agility model-sync --sourceGuid="abc" --targetGuid="def"
- To Sync everything.agility model-sync --sourceGuid="abc" --targetGuid="def" --filter="C:\myFilter.json"
- Perform Sync operation on a filter.agility model-sync --sourceGuid="abc" --folder="models" --pull=true
- To perform pull operation on a folder models.agility model-sync --targetGuid="def" --folder="models"
- To perform push operation from folder models.agility model-sync --targetGuid="def" --folder="models" filter="C:\myFilter.json"
- To perform push operation on a filter using source folder models.agility model-sync --sourceGuid="abc" --targetGuid="def" --dryRun=true
- To perform Dry Run operation.
Folder Structure
- If a pull or clone instance is initiated, a local folder .agility-files is created.
- Assets are saved inside the assets folder which consists of a json folder which has the metadata of the assets downloaded. The folder structure is .agility-files/assets/json for metadata. Rest assets are present inside the assets folder.
- Galleries are saved inside the .agility-files/assets/galleries in a json format which is the metadata of the galleries of your source instance.
- Containers metadata is present inside .agility-files/containers folder.
- For example, if the locale is en-us, then the Pages and Content metadata is present inside the folder .agility-files/en-us/item for Content and .agility-files/en-us/pages. These are the base folders to create Content and Pages to perform CLI push/clone. There are other folders created i.e. list, nestedsitemap, page, sitemap, state and urlredirections, which are not used by the CLI but are part of pull operation.
- Models metadata is present inside .agility-files/models folder.
- Templates metadata is present inside .agility-files/templates folder.
Base URL's
In some cases when the pull operation fails to fetch the preview key, you need to override the baseUrl for the CLI to perform the pull operation. Following is the list of Base URL's for different locations. Depeneding on the location of the instance use the Base URL value for the pull operation:
- USA: https://mgmt.aglty.io
- Canada: https://mgmt-ca.aglty.io
- Europe: https://mgmt-eu.aglty.io
- Australia: https://mgmt-aus.aglty.io
Resources
Agility CMS
Community
Feedback and Questions
If you have feedback or questions about this starter, please use the Github Issues on this repo, join our Community Slack Channel or create a post on the Agility Developer Community.