Git Upload Helper
VSCode からワンクリックで SFTP / S3 へのアップロードと
CloudFront キャッシュ削除 を行える拡張機能。
開発・ステージング・本番環境のファイル転送を自動化します。
EN Overview
Git Upload Helper is a Visual Studio Code extension that automates file uploads to SFTP/S3 and CloudFront cache invalidation with a single click. Perfect for automating file transfers across development, staging, and production environments.
Key Features
- Auto-detect Git diff / recently modified files
- Support for both SFTP and S3
- DryRun (simulation mode)
- CloudFront cache invalidation
- Per-target include/exclude rules
- Auto-generate configuration UI
- Real-time operation logs in output panel
- Multi-language support (Japanese, English, and custom languages)
⚠️ 必ず開発環境でテストしてから本番環境で使用してください。本拡張機能で起きた事故は一切責任を負いません。
⚠️ Always test in your development environment before using in production. We assume no responsibility for any accidents that occur with this extension.
🚀 主な機能
- Git 差分 / 最近更新ファイルの自動検出
- SFTP / S3 両対応
- DryRun(シミュレーション)
- CloudFront キャッシュ削除(ボタン or 自動)
- ターゲットごとの include / exclude ルール
- 設定ファイル自動生成・編集 UI 付き
- 出力パネルでリアルタイム進行ログ確認
- 多言語対応(日本語、英語、カスタム言語)
⚙️ 設定ファイル(.vscode/git-upload.json)
最初は「セットアップ」ボタンで自動生成されます。
以下は SFTP(stage)と S3(prod)の例です。
{
"recentMinutes": 30,
"targets": {
"stage": {
"type": "sftp",
"label": "ステージ環境(SFTP)",
"baseRemotePath": "/home/www/html",
"pathRules": [{ "stripPrefix": "www", "remoteSubDir": "" }],
"host": "example.com",
"user": "ec2-user",
"privateKeyPath": "~/.ssh/id_rsa",
"exclude": ["**/node_modules/**", "**/.git/**"],
"cloudFront": {
"distributionId": "XXXXXXXXX",
"paths": ["/*"],
"region": "ap-northeast-1",
"accessKeyId": "AKIAEXAMPLE123",
"secretAccessKey": "XXXXXXXXXXXXXXXXXXXXXX"
}
},
"prod": {
"type": "s3",
"label": "本番環境(S3)",
"baseRemotePath": "s3://my-bucket-name/www",
"pathRules": [{ "stripPrefix": "www", "remoteSubDir": "" }],
"region": "ap-northeast-1",
"accessKeyId": "AKIAEXAMPLE123",
"secretAccessKey": "XXXXXXXXXXXXXXXXXXXXXX",
"exclude": ["**/node_modules/**", "**/.git/**"],
"cloudFront": {
"distributionId": "XXXXXXXXX",
"paths": ["/*"]
}
}
}
}
設定ファイルのプロパティ詳細
ルートレベル:
| プロパティ |
型 |
説明 |
recentMinutes |
number |
「最近更新ファイル」モード時の検出対象(デフォルト: 30 分) |
exclude |
string[] |
グローバル除外パターン(全ターゲット共通) |
targets |
object |
アップロード先の定義 |
各ターゲットの共通プロパティ:
| プロパティ |
型 |
必須 |
説明 |
type |
"sftp" | "s3" |
○ |
アップロード先の種類 |
label |
string |
|
UI に表示される名前 |
baseRemotePath |
string |
○ |
リモート側のベースパス(SFTP: /path/to/dir, S3: s3://bucket/path) |
pathRules |
object[] |
○ |
ローカルパスをリモートパスに変換するルール |
include |
string[] |
|
インクルードパターン(指定時は他は除外) |
exclude |
string[] |
|
エクスクルードパターン |
pathRules の構造:
"pathRules": [
{
"stripPrefix": "www", // ローカルパスから削除
"remoteSubDir": "" // リモート側のサブディレクトリ
}
]
例:www/html/index.html → stripPrefix: "www" → /html/index.html
SFTP 固有プロパティ:
| プロパティ |
型 |
必須 |
説明 |
host |
string |
○ |
ホスト名/IP |
user |
string |
○ |
ユーザー名 |
port |
number |
|
ポート番号(デフォルト: 22) |
password |
string |
|
パスワード(privateKeyPath がない場合) |
privateKeyPath |
string |
|
秘密鍵のパス(~/.ssh/id_rsa など) |
passphrase |
string |
|
秘密鍵のパスフレーズ |
S3 固有プロパティ:
| プロパティ |
型 |
必須 |
説明 |
region |
string |
○ |
AWS リージョン(例: ap-northeast-1) |
accessKeyId |
string |
○ |
AWS アクセスキー |
secretAccessKey |
string |
○ |
AWS シークレットキー |
CloudFront(オプション):
"cloudFront": {
"distributionId": "XXXXXXXXX", // CloudFront ディストリビューション ID
"paths": ["/*"], // 削除対象パター(デフォルト: ["/*"])
"region": "ap-northeast-1", // AWS リージョン(省略時は target の region を使用)
"accessKeyId": "...", // AWS キー(省略時は target の認証情報を使用)
"secretAccessKey": "..." // AWS シークレット
}
🧭 使い方
- VSCode 左サイドバー → 「Git Upload」 を開く
- 上部の「アップロード環境」セレクトでターゲットを選択
- ドライラン実行 → アップロード対象を確認
- アップロード実行
- 必要に応じて CloudFront キャッシュ削除 ボタンをクリック
出力パネル「Git Upload Helper」で進捗と結果を確認できます。
⚙️ exclude / include ルール
ターゲットごとに除外パターンを設定可能です。
"exclude": [
"**/node_modules/**",
"**/.git/**",
"**/*.tmp",
"**/*.bak"
]
include も設定可能です(exclude と併用可)。
"include": [
"www/html/**",
"www/main/css/**"
]
🌍 多言語対応
このプリケーションは複数の言語をサポートしています。
対応言語
言語の切り替え
パネル内の「言語」セレクトボックスから言語を選択します。
選択した言語は自動的に保存され、次回起動時も適用されます。
カスタム言語の追加
独自の言語ファイルをプロジェクトに追加できます。
手順:
- プロジェクトの
.vscode/ ディレクトリに git-upload-locales/ フォルダを作成
- 言語コード名の JSON ファイルを作成(例:
fr.json for フランス語)
- JSON ファイルに言語別メッセージを定義
例(.vscode/git-upload-locales/fr.json):
{
"language": "Langue",
"uploadEnvironment": "Environnement d'upload",
"uploadMode": "Mode d'upload",
"gitDiff": "Git Diff",
"recentUpdate": "Mises à jour récentes",
...
}
利用可能なキーは src/i18n/locales/ja.json を参照してください。
カスタム言語の構造
ユーザーが追加した言語ファイルは以下の場所に配置します:
project-root/
└── .vscode/
└── git-upload-locales/
├── fr.json # フランス語
├── de.json # ドイツ語
└── ...
拡張機能は起動時にこのディレクトリをスキャンし、
利用可能な言語すべてを自動的にドロップダウンに表示します。
☁️ CloudFront 設定
CloudFront 設定があるターゲットのみ
「キャッシュ削除」ボタンが表示されます。
"cloudFront": {
"distributionId": "XXXXXXXX",
"paths": ["/*"],
"region": "ap-northeast-1",
"accessKeyId": "AKIAXXXXXXXXX",
"secretAccessKey": "XXXXXXXXXXXXXXXXXXXXXX"
}
AWS 認証情報はターゲット共通設定を利用可能。
S3 ターゲットの場合は自動的に region / key を流用します。
📜 出力ログ例
=== ドライラン開始: target=stage type=sftp files=2 ===
[DryRun: ステージ環境(SFTP)]
----------------------------------------
ローカル: www/html/index.html
アップロード先: /home/www/html/index.html
----------------------------------------
合計: 2件
=== ドライラン完了 ===
=== アップロード開始: target=prod type=s3 files=2 ===
[S3 アップロード] my-bucket/www/html/index.html
✔ verify OK (size: 63,285 / time: 2025/11/11 09:34:43)
===アップロード完了 ===
🪪 ライセンス
All Rights Reserved © 2025 niii
このソフトウェアは以下の制限のもとで提供されます:
- ✅ 使用: 個人的・商用目的での使用は自由
- ✅ 修正: ローカル環境での改変・カスタマイズは自由
- ❌ 再配布: 変更されたバージョンの配布は禁止
- ❌ 改変配布: ソースコードの改変・加工したバージョンの公開・配布は禁止
- ❌ 再ライセンス: ライセンス条件の変更は禁止
使用条件:
本ソフトウェアの使用により、以下を同意するものとします:
- 本ソフトウェアはそのまま提供され、明示的・黙示的な保証はありません
- 本ソフトウェアの使用によって生じた損害について、作者は一切の責任を負いません
- このライセンス条項を遵守しない使用・配布は違反です