Skip to content

Commit 24acf58

Browse files
Merge branch 'main' into renovate/npm-minimatch-vulnerability
2 parents 40978f6 + 8701123 commit 24acf58

File tree

16 files changed

+578
-57
lines changed

16 files changed

+578
-57
lines changed

.github/workflows/automated-release-calm-server.yml

Lines changed: 497 additions & 0 deletions
Large diffs are not rendered by default.

.github/workflows/automated-release.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,17 @@ jobs:
183183
NEXT_VERSION=$(grep "The next release version is" analysis.txt | sed 's/.*The next release version is \([^[:space:]]\+\).*/\1/')
184184
185185
# Get current version from latest git tag instead of package.json
186-
CURRENT_VERSION=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/cli-v//')
186+
CURRENT_VERSION=$(git describe --tags --abbrev=0 --match 'cli-v*' 2>/dev/null | sed 's/cli-v//')
187+
188+
if [ -z "$CURRENT_VERSION" ]; then
189+
echo "⚠️ No cli-v* git tag found; falling back to package.json version."
190+
CURRENT_VERSION=$(node -p "require('./package.json').version" 2>/dev/null || echo "")
191+
fi
192+
193+
if [ -z "$CURRENT_VERSION" ]; then
194+
echo "⚠️ package.json version unavailable; defaulting current version to 0.0.0."
195+
CURRENT_VERSION="0.0.0"
196+
fi
187197
188198
echo "📋 Extracted versions:"
189199
echo " Current: $CURRENT_VERSION"
@@ -422,7 +432,7 @@ jobs:
422432
contains(github.event.pull_request.labels.*.name, 'automated-release')
423433
steps:
424434
- name: Harden Runner
425-
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2
435+
uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2
426436
with:
427437
egress-policy: audit
428438

@@ -437,6 +447,7 @@ jobs:
437447
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
438448
with:
439449
node-version: 22
450+
registry-url: 'https://registry.npmjs.org'
440451

441452
- name: Install dependencies
442453
run: npm ci
@@ -481,6 +492,8 @@ jobs:
481492
--target main
482493
483494
- name: Publish to NPM
495+
env:
496+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_SEMANTIC_RELEASE }}
484497
run: |
485498
cd cli
486499
npm publish --provenance

.github/workflows/semgrep-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
env:
2222
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
2323
container:
24-
image: semgrep/semgrep@sha256:d3d1be3a3770514d16a6a57b9761575d7536d70f45a5220274f4ec7d55c442b9
24+
image: semgrep/semgrep@sha256:e04d2cb132288d90035db8791d64f610cb255b21e727b94db046243b30c01ae9
2525
if: (github.actor != 'dependabot[bot]')
2626
steps:
2727
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6

calm-plugins/vscode/src/core/services/navigation-service.spec.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { NavigationService } from './navigation-service'
33
import * as fs from 'fs'
44
import * as path from 'path'
55
import * as vscode from 'vscode'
6-
import { buildDocumentLoader } from '@finos/calm-shared/dist/document-loader/document-loader'
6+
import { buildDocumentLoader } from '@finos/calm-shared'
77

88
// Mock vscode
99
vi.mock('vscode', () => ({
@@ -39,7 +39,7 @@ vi.mock('fs', () => ({
3939
}))
4040

4141
// Mock document loader
42-
vi.mock('@finos/calm-shared/dist/document-loader/document-loader', () => ({
42+
vi.mock('@finos/calm-shared', () => ({
4343
buildDocumentLoader: vi.fn(),
4444
}))
4545

@@ -65,7 +65,7 @@ describe('NavigationService', () => {
6565
}
6666

6767
vi.mocked(buildDocumentLoader).mockReturnValue(mockDocLoader)
68-
68+
6969
// Reset vscode mocks
7070
// @ts-ignore
7171
vscode.workspace.workspaceFolders = undefined
@@ -96,8 +96,8 @@ describe('NavigationService', () => {
9696
// @ts-ignore
9797
vscode.workspace.workspaceFolders = undefined
9898

99-
const result = await navigationService.navigate('node1', {
100-
'detailed-architecture': 'detail.json'
99+
const result = await navigationService.navigate('node1', {
100+
'detailed-architecture': 'detail.json'
101101
})
102102

103103
expect(result).toBe(false)
@@ -114,7 +114,7 @@ describe('NavigationService', () => {
114114
const targetPath = '/workspace/detail.json'
115115
mockDocLoader.resolvePath.mockReturnValue(targetPath)
116116
vi.mocked(fs.existsSync).mockReturnValue(true)
117-
117+
118118
// Setup open document
119119
const mockDoc = { uri: { fsPath: targetPath } }
120120
vi.mocked(vscode.workspace.openTextDocument).mockResolvedValue(mockDoc as any)
@@ -147,8 +147,8 @@ describe('NavigationService', () => {
147147
mockDocLoader.resolvePath.mockReturnValue(targetPath)
148148
vi.mocked(fs.existsSync).mockReturnValue(false)
149149

150-
const result = await navigationService.navigate('node1', {
151-
'detailed-architecture': 'detail.json'
150+
const result = await navigationService.navigate('node1', {
151+
'detailed-architecture': 'detail.json'
152152
})
153153

154154
expect(vscode.window.showWarningMessage).toHaveBeenCalledWith(expect.stringContaining('File not found'))
@@ -163,9 +163,9 @@ describe('NavigationService', () => {
163163

164164
const httpUrl = 'http://example.com/arch.json'
165165
mockDocLoader.resolvePath.mockReturnValue(undefined) // or whatever resolvePath returns for unresolvable
166-
167-
const result = await navigationService.navigate('node1', {
168-
'detailed-architecture': httpUrl
166+
167+
const result = await navigationService.navigate('node1', {
168+
'detailed-architecture': httpUrl
169169
})
170170

171171
expect(vscode.window.showWarningMessage).toHaveBeenCalledWith(
@@ -200,7 +200,7 @@ describe('NavigationService', () => {
200200
expect(buildDocumentLoader).toHaveBeenCalledWith(expect.objectContaining({
201201
urlToLocalMap: expect.any(Map)
202202
}))
203-
203+
204204
// Verify map content passed to loader
205205
const callArgs = vi.mocked(buildDocumentLoader).mock.calls[0][0]
206206
expect(callArgs.urlToLocalMap?.get('http://example.com')).toContain('local/path')

calm-plugins/vscode/src/core/services/navigation-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
buildDocumentLoader,
66
DocumentLoader,
77
DocumentLoaderOptions
8-
} from '@finos/calm-shared/dist/document-loader/document-loader'
8+
} from '@finos/calm-shared'
99
import { Config } from '../ports/config'
1010
import type { Logger } from '../ports/logger'
1111

calm-plugins/vscode/src/features/validation/validation-service.spec.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,14 @@ vi.mock('@finos/calm-shared', async () => {
7676
loadTimeline: vi.fn(),
7777
SchemaDirectory: vi.fn().mockImplementation(() => ({
7878
loadSchemas: vi.fn()
79+
})),
80+
buildDocumentLoader: vi.fn(() => ({
81+
loadMissingDocument: vi.fn(),
82+
initialise: vi.fn()
7983
}))
8084
}
8185
})
8286

83-
// Mock document loader
84-
vi.mock('@finos/calm-shared/dist/document-loader/document-loader', () => ({
85-
buildDocumentLoader: vi.fn(() => ({
86-
loadMissingDocument: vi.fn(),
87-
initialise: vi.fn()
88-
}))
89-
}))
90-
9187
// Mock CalmSchemaRegistry
9288
vi.mock('../../core/services/calm-schema-registry', () => ({
9389
CalmSchemaRegistry: vi.fn().mockImplementation(() => ({

calm-plugins/vscode/src/features/validation/validation-service.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import {
77
loadArchitectureAndPattern,
88
loadTimeline,
99
enrichWithDocumentPositions,
10-
parseDocumentWithPositions
10+
parseDocumentWithPositions,
11+
buildDocumentLoader,
12+
DocumentLoader
1113
} from '@finos/calm-shared'
12-
import { buildDocumentLoader, DocumentLoader } from '@finos/calm-shared/dist/document-loader/document-loader'
1314
import type { Logger } from '../../core/ports/logger'
1415
import type { Config } from '../../core/ports/config'
1516
import { CalmSchemaRegistry } from '../../core/services/calm-schema-registry'

calm-server/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Changelog
2+
3+
All notable changes to the CALM Server will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.2.0] - 2026-03-01
9+
10+
### Changed
11+
- Manual release triggered
12+

calm-server/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@finos/calm-server",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "CALM Server - A server implementation for the Common Architecture Language Model",
55
"homepage": "https://calm.finos.org",
66
"repository": {
@@ -48,4 +48,4 @@
4848
"typescript": "^5.8.2",
4949
"vitest": "^3.1.1"
5050
}
51-
}
51+
}

cli/src/cli.spec.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {
2-
CALM_META_SCHEMA_DIRECTORY,
32
Docifier,
43
DocifyMode,
54
TemplateProcessingMode,
6-
TemplateProcessor
5+
TemplateProcessor,
6+
DocumentLoader
77
} from '@finos/calm-shared';
88
import { Command } from 'commander';
99
import { MockInstance } from 'vitest';
@@ -14,12 +14,12 @@ let validateModule: typeof import('./command-helpers/validate');
1414
let serverModule: typeof import('./server/cli-server');
1515
let templateModule: typeof import('./command-helpers/template');
1616
let optionsModule: typeof import('./command-helpers/generate-options');
17-
let fileSystemDocLoaderModule: typeof import('@finos/calm-shared/dist/document-loader/file-system-document-loader');
1817
let setupCLI: typeof import('./cli').setupCLI;
1918
let cliConfigModule: typeof import('./cli-config');
2019

2120
describe('CLI Commands', () => {
2221
let program: Command;
22+
let mockDocLoader: DocumentLoader;
2323

2424
beforeEach(async () => {
2525
vi.resetModules();
@@ -30,7 +30,6 @@ describe('CLI Commands', () => {
3030
serverModule = await import('./server/cli-server');
3131
templateModule = await import('./command-helpers/template');
3232
optionsModule = await import('./command-helpers/generate-options');
33-
fileSystemDocLoaderModule = await import('@finos/calm-shared/dist/document-loader/file-system-document-loader');
3433

3534
vi.spyOn(calmShared, 'runGenerate').mockResolvedValue(undefined);
3635
vi.spyOn(calmShared.TemplateProcessor.prototype, 'processTemplate').mockResolvedValue(undefined);
@@ -44,8 +43,12 @@ describe('CLI Commands', () => {
4443

4544
vi.spyOn(optionsModule, 'promptUserForOptions').mockResolvedValue([]);
4645

47-
vi.spyOn(fileSystemDocLoaderModule, 'FileSystemDocumentLoader').mockImplementation(vi.fn());
48-
vi.spyOn(fileSystemDocLoaderModule.FileSystemDocumentLoader.prototype, 'loadMissingDocument').mockResolvedValue({});
46+
mockDocLoader = {
47+
initialise: vi.fn().mockResolvedValue(undefined),
48+
loadMissingDocument: vi.fn().mockResolvedValue({}),
49+
resolvePath: vi.fn().mockReturnValue(undefined)
50+
};
51+
vi.spyOn(calmShared, 'buildDocumentLoader').mockReturnValue(mockDocLoader);
4952

5053
const cliModule = await import('./cli');
5154
setupCLI = cliModule.setupCLI;
@@ -64,10 +67,14 @@ describe('CLI Commands', () => {
6467
'--schema-directory', 'schemas',
6568
]);
6669

67-
expect(fileSystemDocLoaderModule.FileSystemDocumentLoader.prototype.loadMissingDocument).toHaveBeenCalledWith('pattern.json', 'pattern');
70+
expect(mockDocLoader.loadMissingDocument).toHaveBeenCalledWith('pattern.json', 'pattern');
6871
expect(optionsModule.promptUserForOptions).toHaveBeenCalled();
6972

70-
expect(fileSystemDocLoaderModule.FileSystemDocumentLoader).toHaveBeenCalledWith([CALM_META_SCHEMA_DIRECTORY, 'schemas'], true, process.cwd());
73+
expect(calmShared.buildDocumentLoader).toHaveBeenCalledWith(expect.objectContaining({
74+
schemaDirectoryPath: 'schemas',
75+
debug: true,
76+
basePath: process.cwd()
77+
}));
7178

7279
expect(calmShared.runGenerate).toHaveBeenCalledWith(
7380
{}, 'output.json', true, expect.any(calmShared.SchemaDirectory), []

0 commit comments

Comments
 (0)