A comprehensive command-line interface for working with the Common Architecture Language Model (CALM)
NOTE: This is a CLI-only command. @finos/calm-cli does not export functions for programmatic use.
The copilot-chatmode command sets up AI-powered development assistance for CALM architecture modeling by configuring a specialized VSCode chatmode with comprehensive tool prompts, schema definitions, and validation guidance for GitHub Copilot integration.
Augment a git repository with CALM VSCode chatmode for AI assistance.
/**
* Augment a git repository with a CALM VSCode chatmode for AI assistance
* @command calm copilot-chatmode [options]
*/
interface CopilotChatmodeCommandOptions {
/** Target directory
* CLI flags: -d, --directory <path>
* Default: "."
*/
directory?: string;
/** Enable verbose logging
* CLI flags: -v, --verbose
* Default: false
*/
verbose?: boolean;
}Usage Examples:
# Setup in current directory
calm copilot-chatmode
# Setup in specific directory
calm copilot-chatmode -d /path/to/calm-project
# Setup with verbose logging
calm copilot-chatmode -d . -vThe command performs the following steps:
Directory Validation
Resource Validation
Directory Creation
.github/chatmodes/ directory structureChatmode Configuration
Tool Prompt Creation
File: .github/chatmodes/CALM.chatmode.md
Main chatmode configuration providing GitHub Copilot with specialized CALM knowledge including:
Directory: .github/chatmodes/calm-prompts/
Specialized tool prompts for each CALM component:
Each tool includes:
After running the command:
.github/
└── chatmodes/
├── CALM.chatmode.md # Main chatmode configuration
└── calm-prompts/
├── architecture-creation.md
├── node-creation.md
├── relationship-creation.md
├── interface-creation.md
├── metadata-creation.md
├── control-creation.md
├── flow-creation.md
├── pattern-creation.md
└── documentation-creation.mdOnce set up:
Creating a Node:
User: Create a database node with PostgreSQL interface
AI: [Uses node-creation.md tool prompt to generate correct CALM node structure]Validating Schema:
User: Validate this architecture against CALM schema
AI: [Uses architecture validation guidance to check structure]Creating Relationships:
User: Add a relationship from api-service to database
AI: [Uses relationship-creation.md tool prompt for correct relationship structure]The command validates bundled resources before setup:
The chatmode configuration and tool prompt files are pre-packaged with the @finos/calm-cli npm package during installation. These resources originate from the calm-ai directory in the source repository and are copied into the package's dist/calm-ai/ directory during the build process.
When you run calm copilot-chatmode, the command copies these bundled resources from your installed npm package to your project's .github/chatmodes/ directory. This ensures you always have the latest chatmode configuration that matches your installed version of the CLI.
Note: If you need to update the chatmode files after a CLI upgrade, simply run calm copilot-chatmode again to replace them with the updated versions.
Target Directory Does Not Exist:
❌ Failed to setup AI tools: Target path is not a directorySolution: Verify directory path is correct and exists.
Not a Git Repository:
⚠️ Warning: No .git directory found. This may not be a git repository.Note: This is a warning; setup continues but GitHub integration may not work.
Missing Bundled Resources:
❌ Missing bundled file: tools/node-creation.mdSolution: Reinstall @finos/calm-cli package.
Corrupted Bundled Files:
⚠️ Bundled file appears empty: CALM.chatmode.mdSolution: Reinstall @finos/calm-cli package.
Directory Creation Failed:
❌ Failed to setup AI tools: EACCES: permission deniedSolution: Verify write permissions for target directory.
If some tool prompts fail but more than half succeed, setup continues with a warning:
⚠️ Tool prompts summary: 7 succeeded, 2 failed
Failed files: flow-creation.md, pattern-creation.md
⚠️ Some tool prompts failed - AI functionality may be limitedIf more than half fail, setup aborts:
❌ More than half of tool prompts failed - AI functionality will be severely limited
Tool prompt setup failed: 6/9 files failedThe chatmode requires:
While the command warns if .git is not found, it's not strictly required. However, for full GitHub integration:
git initgit add .github && git commit -m "Add CALM chatmode"The command follows GitHub Copilot conventions:
.github/chatmodes/CALM.chatmode.mdcalm-prompts/*.mdAfter setup, you can customize tool prompts:
.github/chatmodes/calm-prompts/Example Customization:
<!-- node-creation.md -->
# Custom Project Requirements
For our project, all nodes must include:
- owner field in metadata
- cost-center field in metadata
- environment tag (dev/staging/prod)
[...original content...]VSCode with GitHub Copilot automatically discovers chatmodes in:
.github/chatmodes/ directory*.chatmode.md patternTool prompts are referenced by the main chatmode configuration and accessed by Copilot when relevant to user requests.
The chatmode provides Copilot with:
Create CALM architectures with AI assistance:
# Setup chatmode
calm copilot-chatmode
# Open VSCode and use Copilot Chat
# "Create a microservices architecture with API gateway"
# Copilot uses CALM chatmode to generate correct structureGet validation help from AI:
# VSCode Copilot Chat
# "Why is my CALM architecture failing validation?"
# Copilot uses schema knowledge to diagnose issuesApply CALM patterns with guidance:
# VSCode Copilot Chat
# "Apply API gateway pattern to my architecture"
# Copilot uses pattern-creation.md for correct pattern structureLearn CALM schema through interactive AI assistance:
# VSCode Copilot Chat
# "Explain CALM interface structure and oneOf constraints"
# Copilot uses interface-creation.md for detailed explanationCommit chatmode configuration for team use:
# Setup chatmode
calm copilot-chatmode
# Commit for team
git add .github/chatmodes
git commit -m "Add CALM AI assistance chatmode"
git push
# Team members pull and use immediately
git pull
# Open VSCode - chatmode availableTrack team-specific customizations:
# Customize tool prompts
vi .github/chatmodes/calm-prompts/node-creation.md
# Commit customizations
git add .github/chatmodes/calm-prompts/
git commit -m "Add team-specific CALM node requirements"
git pushPossible Causes:
Solutions:
.github/chatmodes/CALM.chatmode.md existsPossible Causes:
Solutions:
calm copilot-chatmode to repair❌ Failed to setup AI tools: EACCES: permission deniedSolutions:
Set up chatmode for multiple CALM projects:
# Project 1
calm copilot-chatmode -d ~/projects/calm-project-1
# Project 2
calm copilot-chatmode -d ~/projects/calm-project-2
# Each project gets independent chatmode configurationInclude in project initialization scripts:
#!/bin/bash
# init-calm-project.sh
# Initialize git repository
git init
# Create initial architecture
calm generate -p pattern.json -o architecture.json
# Setup AI assistance
calm copilot-chatmode
# Commit initial setup
git add .
git commit -m "Initial CALM project setup with AI assistance"Verify chatmode configuration in CI:
# .github/workflows/validate-chatmode.yml
name: Validate CALM Chatmode
on: [push, pull_request]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Verify chatmode files exist
run: |
test -f .github/chatmodes/CALM.chatmode.md
test -d .github/chatmodes/calm-prompts
ls .github/chatmodes/calm-prompts/*.mdThe chatmode setup may be enhanced in future versions:
If setup fails:
-v for verbose outputFor issues with chatmode functionality:
Install with Tessl CLI
npx tessl i tessl/npm-finos--calm-cli