IBM i Git Sync 🚀
A Visual Studio Code extension designed for IBM i (AS/400) developers.
This tool bridges the gap between traditional IBM i development and modern Git-based workflows, providing a seamless, single-click solution for syncing code to GitLab and compiling it on the server.
Features ✨
- One-Click Sync & Compile: Push your local AS/400 source code directly to GitLab and trigger a compilation on the server with a single shortcut (
Ctrl+Shift+S).
- Smart Collision Detection: Automatically detects if another developer has modified the file in GitLab since your last sync. Prevents accidental overwrites of your team's work.
- Built-in Diff Tool: If a conflict is detected, easily compare the remote GitLab version with your local AS/400 version side-by-side before deciding how to proceed.
- Intelligent Compilation: Automatically identifies the object type (e.g.,
CBLLE, RPGLE, PF, DSPF) and runs the correct compile command (CRTBNDCBL, CRTBNDRPG, CRTPF, etc.) on the IBM i.
- Clean Error Reporting: Filters out noisy system messages (CPC, CPD) and displays only relevant compiler errors (e.g., LNC, RNF) in a dedicated Output Channel.
- Status Bar Integration: A sleek, non-intrusive UI experience for resolving conflicts and pushing resolved code.
Prerequisites 📋
Before using this extension, ensure you have the following:
- Visual Studio Code installed.
- Code for IBM i extension installed and connected to your IBM i system.
- A GitLab Personal Access Token with
api and read_repository scopes.
- The GitLab Project ID of the repository where you want to sync your code.
Installation 📦
From VSIX (Recommended for Team Distribution)
- Download the
ibmi-git-sync-x.x.x.vsix file.
- Open VS Code.
- Go to the Extensions view (
Ctrl+Shift+X).
- Click the
... menu in the top right corner of the Extensions view.
- Select Install from VSIX...
- Locate and select the downloaded
.vsix file.
Local Development Setup
- Clone this repository.
- Run
npm install in the terminal to install dependencies.
- Press
F5 to open a new VS Code window with the extension loaded for debugging.
Configuration ⚙️
After installation, you must configure the extension with your GitLab details.
- Open VS Code Settings (
Ctrl+,).
- Search for
IBM i Git Sync.
- Fill in the following fields:
- GitLab URL: The base URL of your GitLab instance (e.g.,
https://gitlab.company.com).
- Project ID: The numeric ID of your GitLab project (found on the project's homepage).
- Default Branch: The branch you want to push to (e.g.,
main or develop).
- Personal Access Token: Your GitLab token.
Usage 🛠️
- Connect to your IBM i system using the Code for IBM i extension.
- Open a source file (e.g.,
HH.CBLLE) from your library.
- Make your changes in the editor.
- Press
Ctrl+Shift+S (or run IBM i: Sync & Compile from the Command Palette).
- Enter a brief commit message when prompted.
- The extension will:
- Check for conflicts.
- Push the code to GitLab.
- Compile the code on the IBM i.
- Notify you of success or show the error log in the Output Channel.
Conflict Resolution Flow
If the extension detects that the file in GitLab was modified by someone else (or if you modified it from a different machine without syncing), it will alert you:
- Click Compare (Diff) in the warning dialog.
- Review the differences between the remote GitLab version (left) and your local version (right).
- Make any necessary adjustments to your local code.
- Click the ☁️ Push Resolved button that appears in the bottom Status Bar to force the push and compile.
Architecture Highlights 🏗️
This extension is built with a clean, modular architecture:
ConfigService: Manages VS Code settings securely.
SyncManager: Handles the complex business logic of state management, collision detection, and UX flow.
GitLab API Utility: Interacts with the GitLab v4 API for fetching history and pushing code.
IBM i API Utility: Wraps the Code for IBM i execution commands and provides smart compilation rules.
Contributing 🤝
Contributions, issues, and feature requests are welcome!
- Fork the repository.
- Create your feature branch (
git checkout -b feature/AmazingFeature).
- Commit your changes (
git commit -m 'Add some AmazingFeature').
- Push to the branch (
git push origin feature/AmazingFeature).
- Open a Pull Request.
License 📄
This project is licensed under the MIT License - see the LICENSE file for details.