Skip to content

Commit

Permalink
remove visualize command and dependencies. Fixes #827 (#829)
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanm3341 authored Jan 23, 2025
1 parent 4662c57 commit 898dde9
Show file tree
Hide file tree
Showing 17 changed files with 47 additions and 1,043 deletions.
55 changes: 15 additions & 40 deletions cli/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CALM CLI

A command line interface to interact with the CALM schema.
You can use these tools to create an architecture from a CALM pattern, validate that an architecture conforms to a given pattern, and create visualizations of architectures and patterns so that you can see what your architecture looks like.
You can use these tools to create an architecture from a CALM pattern, or validate that an architecture conforms to a given pattern.

## Using the CLI

Expand All @@ -26,7 +26,6 @@ Options:
-h, --help display help for command

Commands:
visualize [options] Produces an SVG file representing a visualization of the CALM Specification.
generate [options] Generate an architecture from a CALM pattern file.
validate [options] Validate that an architecture conforms to a given CALM pattern.
help [command] display help for command
Expand Down Expand Up @@ -80,7 +79,6 @@ Options:
-h, --help display help for command
```
This command can output warnings and errors - the command will only exit with an error code if there are errors present in the output.
Warnings are sometimes provided as hints about how to improve the architecture, but they are not essential for the architecture to match the pattern.
Expand Down Expand Up @@ -163,32 +161,12 @@ You would get an output which includes a warning like this:
which is just letting you know that you have left in some placeholder values which might have been generated with the generate command.
This isn't a full break, but it implies that you've forgotten to fill out a detail in your architecture.
### Visualizing the CALM schema
In order to take a look at the architecture that you're working on, beyond just staring at a json file, you can use the visualize command.
This command accepts either an architecture or a pattern as it's input (not both), and will output an SVG file.
You can then open up that file in the browser to see a box and line diagram which represents your architecture.
```shell
% calm visualize --help
Usage: calm visualize [options]
Produces an SVG file representing a visualization of the CALM Specification.
Options:
-a, --architecture <file> Path to an architecture of a CALM pattern.
-p, --pattern <file> Path to a CALM pattern.
-o, --output <file> Path location at which to output the SVG. (default: "calm-visualization.svg")
-v, --verbose Enable verbose logging. (default: false)
-h, --help display help for command
```
## Coding for the CLI
The CLI module has its logic split into two modules, `cli` and `shared`. Both are managed by [npm workspaces](https://docs.npmjs.com/cli/v8/using-npm/workspaces).
The CLI module has its logic split into two modules, `cli` and `shared`. Both are managed by [npm workspaces](https://docs.npmjs.com/cli/v8/using-npm/workspaces).
* `cli` module is for anything pertaining to the calling of the core logic, the CLI wrapper
* `shared` module is where the logic being delegated to actually sits, so that it can be re-used for other use-cases if required.
- `cli` module is for anything pertaining to the calling of the core logic, the CLI wrapper
- `shared` module is where the logic being delegated to actually sits, so that it can be re-used for other use-cases if required.
### Getting Started
Expand All @@ -208,29 +186,28 @@ npm run link:cli
npm run watch
```
### CLI Tests
There are currently two types of tests;
* `cli` tests - these are end-to-end and involve linking the package as part of the test so that we can assert on actual `calm X` invocations.
* `shared` tests - these are where the core logic tests live, like how validation behaves etc.
- `cli` tests - these are end-to-end and involve linking the package as part of the test so that we can assert on actual `calm X` invocations.
- `shared` tests - these are where the core logic tests live, like how validation behaves etc.
## Releasing the CLI
Publishing of the CLI to NPM is controlled via [this action](https://github.com/finos/architecture-as-code/blob/main/.github/workflows/publish-cli-to-npm.yml) - this action is triggered whenever a GitHub release is created. To create a github release you can do one of the following;
### Through the Github UI
* 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 (e.g., "First Release").
* 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.
- 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 (e.g., "First Release").
- 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.
### Through the GitHub CLI (`gh`)
Expand All @@ -241,5 +218,3 @@ gh auth login
# Step 2: Create the release.
gh release create <version> --title "<release_title>" --notes "<release_description>"
```
5 changes: 2 additions & 3 deletions cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@finos/calm-cli",
"version": "0.3.0",
"version": "0.4.0",
"description": "A set of tools for interacting with the Common Architecture Language Model (CALM)",
"main": "dist/index.js",
"files": [
Expand Down Expand Up @@ -28,7 +28,6 @@
"author": "",
"license": "ISC",
"dependencies": {
"canvas": "^3.0.0",
"commander": "^12.0.0",
"copyfiles": "^2.4.1",
"mkdirp": "^3.0.1"
Expand All @@ -54,4 +53,4 @@
"typescript": "^5.4.3",
"xml2js": "^0.6.2"
}
}
}
19 changes: 1 addition & 18 deletions cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /usr/bin/env node

import { CALM_META_SCHEMA_DIRECTORY, getFormattedOutput, runGenerate, validate, visualizeArchitecture, visualizePattern, exitBasedOffOfValidationOutcome } from '@finos/calm-shared';
import { CALM_META_SCHEMA_DIRECTORY, getFormattedOutput, runGenerate, validate, exitBasedOffOfValidationOutcome } from '@finos/calm-shared';
import { Option, program } from 'commander';
import path from 'path';
import { mkdirp } from 'mkdirp';
Expand All @@ -21,23 +21,6 @@ program
.version(version)
.description('A set of tools for interacting with the Common Architecture Language Model (CALM)');

program
.command('visualize')
.description('Produces an SVG file representing a visualization of the CALM Specification.')
.addOption(new Option(ARCHITECTURE_OPTION, 'Path to an architecture of a CALM pattern.').conflicts('pattern'))
.addOption(new Option(PATTERN_OPTION, 'Path to a CALM pattern.').conflicts('architecture'))
.requiredOption(OUTPUT_OPTION, 'Path location at which to output the SVG.', 'calm-visualization.svg')
.option(VERBOSE_OPTION, 'Enable verbose logging.', false)
.action(async (options) => {
if (options.architecture) {
await visualizeArchitecture(options.architecture, options.output, !!options.verbose);
} else if (options.pattern) {
await visualizePattern(options.pattern, options.output, !!options.verbose);
} else {
program.error(`error: one of required options '${ARCHITECTURE_OPTION}' or '${PATTERN_OPTION}' not specified`);
}
});

program
.command('generate')
.description('Generate an architecture from a CALM pattern file.')
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ In modern software development, architecture is often disconnected from the actu
- **Ensuring Control and Compliance**: Align architectural designs with organizational standards and policies, making it easier to measure and enforce compliance.

> **Quick Start**
> To get started with CALM, [install the CLI](working-with-calm/installation) and try your first commands to visualize and validate architectures.
> To get started with CALM, [install the CLI](working-with-calm/installation) and try your first commands to generate and validate architectures.
## Key Benefits

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/introduction/key-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ One of the most powerful aspects of CALM is its ability to validate architecture

Understanding complex architectures can be challenging, especially when dealing with large systems. CALM provides visualization tools that generate intuitive, easy-to-understand diagrams directly from your architectural definitions.

- **Instant Diagrams**: Use the `visualize` command in CALM CLI to produce SVG files representing your architecture, facilitating discussions and reviews.
- **Instant Diagrams**: Use the `calm-visualizer` app to generate a diagram from your architecture, facilitating discussions and reviews.
- **Dynamic Views**: Switch between different views of the same architecture, highlighting specific relationships or components as needed.

## 4. Patterns and Reuse
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/introduction/what-is-calm.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ To start using CALM, you can install the CALM CLI and begin exploring its capabi
```shell
npm install -g @finos/calm-cli
```
2. **Explore the CLI Commands**: Use the CLI to generate, validate, and visualize architectural patterns and architectures.
2. **Explore the CLI Commands**: Use the CLI to generate and validate architectural patterns and architectures.
3. **Join the Community**: Contribute to the CALM monorepo, engage with other architects, and help evolve the standard.

1 change: 0 additions & 1 deletion docs/docs/working-with-calm/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ Explore the topics below to get hands-on experience with CALM:
- [Using the CLI](using-the-cli): Understand the basic usage of the CALM CLI and how to access its commands.
- [Generate](generate): Discover how to generate architectural architectures from predefined patterns.
- [Validate](validate): Learn how to validate your architecture against CALM patterns to ensure compliance.
- [Visualize](visualize): See how to create visual representations of your architecture directly from CALM definitions.

Let's get started and make the most of CALM’s capabilities!
1 change: 0 additions & 1 deletion docs/docs/working-with-calm/using-the-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ A set of tools for interacting with the Common Architecture Language Model (CALM
Options: -V, --version output the version number -h, --help display help for command

Commands:
visualize [options] Produces an SVG file representing a visualization of the CALM Specification.
generate [options] Generate an architecture from a CALM pattern file.
validate [options] Validate that an architecture conforms to a given CALM pattern.
help [command] display help for command
Expand Down
36 changes: 0 additions & 36 deletions docs/docs/working-with-calm/visualize.md

This file was deleted.

Loading

0 comments on commit 898dde9

Please sign in to comment.