Skip to content

chore(cli,shared,vscode): fix imports to be module level only#2196

Merged
rocketstack-matt merged 4 commits intofinos:mainfrom
markscott-ms:fix-imports
Mar 1, 2026
Merged

chore(cli,shared,vscode): fix imports to be module level only#2196
rocketstack-matt merged 4 commits intofinos:mainfrom
markscott-ms:fix-imports

Conversation

@markscott-ms
Copy link
Contributor

@markscott-ms markscott-ms commented Feb 28, 2026

Description

As identified in #2167 (comment)

This pull request refactors imports across both the CLI and VSCode plugin codebases to standardize how shared types and utilities are imported from the @finos/calm-shared package. The changes remove deep or path-specific imports in favour of importing directly from the package root, which improves maintainability and reduces the risk of breaking changes if internal file structures change.

In other words, imports should only be import {...} from '@finos/shared'.

Refactoring and Simplification of Imports:

  • All imports of CalmChoice, CalmOption, extractOptions, buildDocumentLoader, DocumentLoader, DocumentLoaderOptions, and ValidateOutputFormat are now sourced directly from @finos/calm-shared instead of deep paths like @finos/calm-shared/dist/.... This affects both CLI and VSCode plugin files. [1] [2] [3] [4] [5] [6] [7]

  • The shared package's index.ts (shared/src/index.ts) is updated to export CalmChoice, CalmOption, and ValidateOutputFormat at the top level, enabling the simplified imports.

These changes make the codebase easier to maintain and more robust against internal refactors in the shared library.

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🎨 Code style/formatting changes
  • ♻️ Refactoring (no functional changes)
  • ⚡ Performance improvements
  • ✅ Test additions or updates
  • 🔧 Chore (maintenance, dependencies, CI, etc.)

Affected Components

  • CLI (cli/)
  • Schema (calm/)
  • CALM AI (calm-ai/)
  • CALM Hub (calm-hub/)
  • CALM Hub UI (calm-hub-ui/)
  • CALM Server (calm-server/)
  • CALM Widgets (calm-widgets/)
  • Documentation (docs/)
  • Shared (shared/)
  • VS Code Extension (calm-plugins/vscode/)
  • Dependencies
  • CI/CD

Commit Message Format ✅

Testing

  • I have tested my changes locally
  • I have added/updated unit tests
  • All existing tests pass

Checklist

  • My commits follow the conventional commit format
  • I have updated documentation if necessary
  • I have added tests for my changes (if applicable)
  • My changes follow the project's coding standards

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR standardizes consumption of @finos/calm-shared by removing deep dist/... imports across the CLI and VS Code extension, and updating the shared package barrel exports to support root-level imports.

Changes:

  • Updated shared/src/index.ts to re-export additional shared types (ValidateOutputFormat, CalmChoice, CalmOption) from the package root.
  • Refactored CLI and VS Code extension code to import shared utilities/types directly from @finos/calm-shared.
  • Updated some tests’ imports, but left a couple of deep-path module mocks that no longer align with the new import entrypoint.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
shared/src/index.ts Exposes additional exports at the package root to support module-level imports.
cli/src/command-helpers/validate.ts Replaces deep imports with root @finos/calm-shared imports.
cli/src/command-helpers/generate-options.ts Switches option-related imports to the package root.
cli/src/command-helpers/generate-options.spec.ts Updates type import to root, but mock path still targets deep dist/... module.
cli/src/cli.ts Consolidates shared imports to the package root (document loader + option types).
calm-plugins/vscode/src/features/validation/validation-service.ts Moves document-loader imports to the package root.
calm-plugins/vscode/src/core/services/navigation-service.ts Moves document-loader imports to the package root.
calm-plugins/vscode/src/core/services/navigation-service.spec.ts Updates import to root, but mock path still targets deep dist/... module.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@markscott-ms markscott-ms marked this pull request as draft February 28, 2026 23:54
@markscott-ms markscott-ms marked this pull request as ready for review March 1, 2026 15:57
@rocketstack-matt rocketstack-matt merged commit a9a6460 into finos:main Mar 1, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants