Initialize the Project from the CLI

You can now begin working on your Catalyst project from the CLI. The first step is to initialize the project in an empty directory. This will be the home directory of your project and all of the project files will be saved in it.

You can learn more about this from the Project Directory Structure help page. You can learn about initializing a project in detail from the CLI help documentation.

We will only initialize the Integration function in the Java environment for this project.

  1. Create a folder for the project on your local machine and navigate to it from the terminal.

  2. Initialize a project by executing the following command from that directory:

copy
$
catalyst init
  1. Select Functions using the space bar. Press the Enter key to initialize.

catalyst_gitbot_init_1

  1. The CLI will now ask you to associate a Catalyst project with the directory. Associate it with the project that we created earlier from the console. Select GitHubBot from the list and press Enter. catalyst_gitbot_init_2

  2. The CLI will initiate the function setup. Select Integration as the function type.
    catalyst_gitbot_init_3

  3. Select Cliq as the service and press Enter.
    catalyst_gitbot_init_4

  4. All Cliq handlers classes will be selected by default. You can leave it as it is, or select only bot_handler, command_handler, and function_handler from the list. Press Enter.
    catalyst_gitbot_init_5

  5. Select the latest supported runtime of Java as the function stack, and press Enter.
    catalyst_gitbot_init_6

  6. Enter “GithubExtension” as the folder name and “MainClass” as the class name. Press Enter each time.
    catalyst_gitbot_init_7

The CLI will download and install the latest Catalyst Java SDK package.

Note: Ensure that you enter the class name and folder name exactly as instructed, because the application's code contains the same names.
The functions directory is now created in the standard structure. Catalyst initialization is complete.

Your project directory is now set up with the functions directory (CATALYST_FUNCTIONS_HOME) along with configuration files and dependencies. The project directory also contains the catalyst.json configuration file and a hidden catalyst.rc file.

This will be the final structure of your project directory.

catalyst_gitbot_proj_dir_struct

Note: This image includes an additional file GithubConstants.java. We will create this file while configuring the functions directory in the next step.

Last Updated 2023-12-15 18:54:08 +0530 +0530