Connect CLI
Constructor’s Connect CLI is a command line interface that interacts with Constructor connectors. With Connect CLI, you can map and transform your catalog data via any connector, allowing you to easily develop and manage your catalog integrations.
Why use it?
Connect CLI plays a critical role in the connector ecosystem as it allows you to specify how data is ingested across all your Constructor indexes. As a result, you can expedite your catalog integration and import data into Constructor with minimal effort.
How it works
Data mapping and transformation takes place within a connector via the Connect CLI. When the connector handles your catalog data, it will pipe it through the templates you write and maintain via the Connect CLI map and transform it into a format Constructor can ingest.
The Connect CLI has four phases: mapping, transformation, testing, and deployment.
- Mapping: Your raw data first runs through a mapping template. The mapping template will identify your
items
,variations
, anditem groups
within the data.- ❗Note: This phase is only required for the Omni Connector. If you're using a partner-based connector (for example, Salesforce, Akeneo, etc.), then the mapping template is already included.
- Transformation: The transformation phase involves generating fixtures filled with your
item
,variation
, anditem group
catalog data and developing templates to transform your data based on those fixtures. - Testing: During the testing phase, you can either execute individual templates against their corresponding fixtures, and/or run a test suite to execute your automated tests.
- Deployment: Once you are satisfied with your integration, you will deploy your templates. When the connector runs again, it will use those templates to ingest your catalog data into Constructor.
Learn more about the development flow and commands here.
What is a fixture?
Fixtures are files that contain raw data for your
items
,variations
, anditem groups
(that is, the data before any transformations).You’ll use these fixtures during development to execute and test your templates. Fixtures always follow the same data structure that will be run through a connector during the ingestion process.
Data flow
The flow of data through connector can be visualized like this:
You can learn more about this flow in our Development flow article. We also encourage you to explore each template type you can use with the Connect CLI
What tools do I need?
We recommend the below integrations to help you develop, test, and deploy templates using the Connect CLI:
A working terminal + a code editor
Using the Connect CLI, you'll generate a new repository and maintain your catalog integration using this repository. We recommend having a terminal and a code editor (for example, Visual Studio Code) when working with the CLI.
Right at your fingertips
The repository generated by the Connect CLI is integrated with VSCode.
For example, you can hit F5 to immediately run the template file that is currently open, or use the debugger tab to execute it with more details.
A place to store your repository
With Connect CLI, you'll initialize a git repository. You'll need a place to store it, such as GitHub, GitLab or BitBucket.
It's dangerous to go alone
Good tooling makes all the difference. The repository generated by the Connect CLI already ships with a couple of GitHub actions:
- Test: If someone opens a pull request, it automatically runs the test suite.
- Deploy: You can manually deploy your templates to a selected environment from any branch.
Note that you'll need to setup your
CONNECT_AUTH_TOKEN
GitHub secret to ensure authentication works. Learn more here.
Updated about 2 months ago