Flox users
- Clone the git repo and
cdinto the directory. - Run
flox activate. The first time you do this, it will locally install all the dependencies and Node packages, and configure the environment ready for you to develop and test.
- Install Node v22.11.0 (use
nvmto manage Node versions if needed). - Make sure
libuuid.sois installed (ldconfig -p | grep libuuid) and install it if not (instructions will depend on your OS). - Clone the git repo and
cdinto the directory - Run the following:
npm install
npm run build
npx link cliThe CLI module has its logic split into two modules, cli and shared. Both are managed by npm workspaces.
climodule is for anything pertaining to the calling of the core logic, the CLI wrappersharedmodule is where the logic being delegated to actually sits, so that it can be re-used for other use-cases if required.
Ensure you've cloned the repository - then go to the root of the repository and execute;
# Step 1: Install all necessary dependencies for the workspace
npm install
# Step 2: Build the workspace (compiles source code for all workspaces)
npm run build
# Step 3: Link the workspace locally for testing
npm run link:cli
# Step 4 : Run `watch` to check for changes automatically and re-bundle. This watching is via `chokidar` and isn't instant - give it a second or two to propagate changes.
npm run watchThere are currently two types of tests;
clitests - these are end-to-end and involve linking the package as part of the test so that we can assert on actualcalm Xinvocations.sharedtests - these are where the core logic tests live, like how validation behaves etc.
$ cd cli
# create local distribution package in /tmp directory
$ npm pack --pack-destination /tmp
# install from the local distribution package.
# Note: this will replace an existing calm cli install in the global area
$ npm install -g /tmp/finos-calm-cli-<version-identifier>.tgz
# run manual verfication of the new version, e.g,.
# calm --help
# calm init-ai --helpThe CLI uses semantic-release for automated releases. Version management follows these principles:
- Git tags are the source of truth for version numbers
- package.json version remains as a baseline/fallback but doesn't need manual updates
- Semantic-release automatically determines the next version based on commit messages
- Releases are triggered automatically when commits are merged to
main
The version field in package.json should be left as-is and not manually updated. Semantic-release will use git tags to determine the correct version during publishing, while the package.json version serves as a baseline for tooling compatibility.
Releases are fully automated via semantic-release when commits are merged to main:
- Commit analysis - Semantic-release analyzes commit messages since the last release
- Version calculation - Determines next version based on conventional commit types
- Git tag creation - Creates a new version tag (e.g.,
cli-v1.2.0) - NPM publishing - Publishes to npm using the git tag version
- GitHub release - Creates a GitHub release with auto-generated changelog
Note: The information below describes the legacy manual release process. The CLI now uses automated releases via semantic-release, but this is kept for reference.
Before performing this process, one must update the package.json to represent the new version and tag that will be created.
{
"name": "@finos/calm-cli",
"version": "0.6.0",
"description": "A set of tools for interacting with the Common Architecture Language Model (CALM)"
}Once this is done, publishing of the CLI to NPM is controlled via this action - this action is triggered whenever a GitHub release is created. To create a github release you can do one of the following;
- Go to your repository on GitHub.
- Click on the Releases tab (under "Code").
- Click the Draft a new release button.
- Fill in:
- Tag version: Enter the version number (e.g., v1.0.0).
- Release title: Name the release to be the same as the tag version
- Description: Add details about what’s included in the release.
- Target: Leave as main (or your default branch).
- Click Publish release to create the release and trigger the workflow.
# Step 1: Authenticate with GitHub if you haven't already
gh auth login
# Step 2: Create the release.
gh release create <version> --title "<release_title>" --notes "<release_description>"The OWASP dependency check tool will run on PRs and periodically on the committed code, but it can be helpful to be able to run this locally to investigate CVEs.
To use the dependency check tool locally, first install the tool following the instructions for your operating system here.
Once that is done the tool is configured as a script in the package.json, run npm run dependency-check; the reports will be output to cli/dependency-check-report.