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 pipeline for compilation, AI code review, and syncing code to GitLab.
Features ✨
- Full CI/CD Pipeline in VS Code: Push your local AS/400 source code directly to GitLab and trigger compilation on the server with a single shortcut (
Ctrl+Shift+S).
- AI-Powered Quality Gate: Automatically reviews your COBOL/RPGLE code against your team's custom standards using the built-in GitHub Copilot engine before allowing a push.
- Auto-Refactoring & Fixes: If the AI detects standards violations, seamlessly hand over the issues to Copilot Chat to automatically fix the code while strictly preserving AS/400 column indentation.
- 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.
- Intelligent Compilation: Automatically identifies the object type (e.g.,
CBLLE, RPGLE) and runs the correct compile command (CRTBNDCBL, CRTBNDRPG, etc.) on the IBM i.
Security First 🛡️
We take enterprise data protection seriously. This extension implements strict security measures:
- Enterprise AI Privacy: The Code Review process leverages the native VS Code
vscode.lm API (Copilot Chat). No source code is sent to unauthorized third-party external APIs, keeping your data within your approved enterprise ecosystem.
- Secret Management: Your GitLab Personal Access Token is never stored in plain text or in your
settings.json. It is securely encrypted and stored inside your operating system's native credential vault using VS Code's SecretStorage API.
- Encrypted Transit: The extension rigorously enforces HTTPS for all GitLab API communications to prevent man-in-the-middle (MITM) attacks.
- Command Injection Prevention: All IBM i object names (Library, Source File, Member) are strictly sanitized. The extension blocks any special characters before passing commands to the server.
Prerequisites 📋
Before using this extension, ensure you have the following:
- Visual Studio Code (v1.90.0 or higher) installed.
- Code for IBM i extension installed and connected to your IBM i system.
- GitHub Copilot Chat extension installed and authenticated.
- 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.
Configuration ⚙️
You need to configure the extension in three steps:
Step 1: Workspace Settings
- Open VS Code Settings (
Ctrl+,).
- Search for
IBM i Git Sync.
- Fill in the following mandatory fields:
- GitLab URL: The base URL of your GitLab instance (Must start with
https://).
- Project ID: The numeric ID of your GitLab project.
- Default Branch: The branch you want to push to (e.g.,
main).
Step 2: Secure Token Storage
- Open the VS Code Command Palette (
Ctrl+Shift+P).
- Search for and run the command:
IBM i Git Sync: Set GitLab Token.
- Paste your GitLab token when prompted and hit Enter.
Step 3: Quality Standards
- Create a file named
standards.md in the root of your VS Code workspace.
- Define your team's coding standards in this file (e.g., requiring Modification Logs, structure rules). The AI will use this file to review every commit.
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 and make your changes.
- Press
Ctrl+Shift+S (or run IBM i: Sync & Compile).
- The extension will run the complete pipeline:
- Phase 1: Compile the code on the IBM i.
- Phase 2: Run AI Standards Review against
standards.md.
- Phase 3: Decision Gate (If issues are found, you can Force Push, Cancel, or send the code to Copilot Chat for auto-fixing).
- Phase 4: Push to GitLab (adding a warning badge to the commit message if forced).
Conflict Resolution Flow 🔀
If the extension detects that the file in GitLab was modified by someone else:
- Click Compare (Diff) in the warning dialog.
- Review the changes in the split-screen Diff Editor.
- Once resolved manually, click the
☁️ Push Resolved button in the bottom Status Bar.
Architecture Highlights 🏗️
This extension is built with a clean, modular architecture:
AIService: Orchestrates local Copilot LLM interactions and prompt injection for automated Code Reviews and Refactoring.
ConfigService: Manages configurations and OS-level secret storage 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.
License 📄
This project is proprietary and confidential. Unauthorized copying or distribution is strictly prohibited.