-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Notes: Adding a VS Code Extension to Code Bandit
1. Approaches to Adding a VS Code Extension
a. Separate Extension Package
- Recommended: Create a distinct VS Code extension project (e.g., in a
vscode/orpackages/vscode-extension/folder). - The extension acts as a client, calling Code Bandit’s core logic—either by invoking the CLI or, preferably, by reusing shared logic moved into a library.
- The extension will have its own
package.json(with VS Code-specific fields) and configuration. - Benefits: Clear separation, easier maintenance and publishing, avoids entangling VS Code-specific dependencies with the CLI.
b. Code Reuse
- Refactor the core logic (AI interactions, file system routines, etc.) into a reusable package (e.g.,
core). - Both the CLI and VS Code extension import this core package to avoid code duplication.
2. Monorepo Migration
a. Advantages
- Using a monorepo (via pnpm workspaces, Turborepo, Yarn workspaces, etc.) is advantageous when multiple packages exist:
- CLI app (current)
- VS Code extension
- Shared logic packages (
core) - Other future interfaces
- Simplifies dependencies, versioning, and cross-project refactoring.
- Makes testing and isolating packages easier.
b. Overhead
- Slightly more setup and tooling, but well-supported for TypeScript/Node projects.
- Provides clear structure as the project and its interfaces grow.
3. Direct Integration Into Current package.json
a. Problems
- Mixing CLI and VS Code extension in the root
package.jsoncan cause:- Package bloat (unnecessary dependencies for each environment)
- Conflicting fields (VS Code requires its own manifest fields)
- Maintenance headaches as the project evolves
b. When It's Okay
- Acceptable for rapid prototyping, but not advised for serious development or publishing.
- Long-term, each interface (CLI, extension) should have its own manifest and configuration.
Recommendation
- Adopt a monorepo (
packages/cli/,packages/core/,packages/vscode-extension/) when developing a VS Code extension. - Move reusable parts to a
corepackage for sharing between CLI and editor extension. - Keep package manifests separate (do not combine CLI and VS Code fields in one
package.json).
Let me know if you need example directory scaffolding or extension manifests!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels