@intra-mart/accel 0.5.0-dev.202608040843 → 0.5.0-dev.202608180918
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -31
- package/dist/asset/deployer.d.ts +2 -0
- package/dist/asset/deployer.js +11 -9
- package/dist/asset/git-provider.d.ts +1 -0
- package/dist/asset/git-provider.js +20 -9
- package/dist/asset/updater.d.ts +9 -2
- package/dist/asset/updater.js +12 -6
- package/dist/asset/walker.d.ts +2 -1
- package/dist/asset/walker.js +36 -0
- package/dist/commands/asset-provider.d.ts +1 -1
- package/dist/commands/asset-provider.js +2 -2
- package/dist/commands/attach.d.ts +116 -82
- package/dist/commands/attach.js +176 -145
- package/dist/commands/cache.js +11 -19
- package/dist/commands/deploy.d.ts +53 -32
- package/dist/commands/deploy.js +112 -75
- package/dist/commands/detach.d.ts +18 -0
- package/dist/commands/detach.js +69 -54
- package/dist/commands/init.d.ts +117 -83
- package/dist/commands/init.js +119 -98
- package/dist/commands/login.d.ts +12 -10
- package/dist/commands/login.js +14 -10
- package/dist/commands/preset.js +26 -33
- package/dist/commands/run-wrapper.d.ts +15 -0
- package/dist/commands/run-wrapper.js +62 -0
- package/dist/commands/switch.d.ts +48 -20
- package/dist/commands/switch.js +201 -176
- package/dist/commands/update.d.ts +142 -87
- package/dist/commands/update.js +342 -296
- package/dist/core/color-env.d.ts +1 -0
- package/dist/core/color-env.js +6 -0
- package/dist/core/constants.d.ts +0 -1
- package/dist/core/constants.js +0 -3
- package/dist/core/errors.d.ts +6 -0
- package/dist/core/errors.js +16 -0
- package/dist/core/logger.d.ts +15 -0
- package/dist/core/logger.js +1 -0
- package/dist/core/paths.d.ts +6 -0
- package/dist/core/paths.js +22 -0
- package/dist/core/types.d.ts +6 -1
- package/dist/core/validation.d.ts +34 -0
- package/dist/core/validation.js +87 -0
- package/dist/deploy/api-client.d.ts +1 -0
- package/dist/deploy/api-client.js +7 -1
- package/dist/git/config-file.d.ts +3 -0
- package/dist/git/config-file.js +178 -0
- package/dist/git/errors.d.ts +5 -0
- package/dist/git/errors.js +21 -2
- package/dist/git/git-objects.d.ts +11 -0
- package/dist/git/git-objects.js +49 -0
- package/dist/git/http.d.ts +2 -2
- package/dist/git/http.js +22 -10
- package/dist/git/index-file.d.ts +17 -0
- package/dist/git/index-file.js +111 -0
- package/dist/git/object-cache.d.ts +1 -0
- package/dist/git/object-cache.js +11 -15
- package/dist/git/object-store.d.ts +4 -0
- package/dist/git/object-store.js +82 -107
- package/dist/git/pack-parse.d.ts +19 -0
- package/dist/git/pack-parse.js +261 -0
- package/dist/git/pack-store.d.ts +20 -0
- package/dist/git/pack-store.js +144 -0
- package/dist/git/read-capped.d.ts +1 -0
- package/dist/git/read-capped.js +26 -0
- package/dist/git/redact-url.d.ts +1 -0
- package/dist/git/redact-url.js +14 -0
- package/dist/git/repo-layout.d.ts +5 -0
- package/dist/git/repo-layout.js +44 -0
- package/dist/git/smart-http.d.ts +3 -2
- package/dist/git/smart-http.js +5 -5
- package/dist/git/untracked.d.ts +11 -0
- package/dist/git/untracked.js +93 -0
- package/dist/git/worktree-status.d.ts +4 -0
- package/dist/git/worktree-status.js +140 -0
- package/dist/git/zlib-inflate.d.ts +7 -0
- package/dist/git/zlib-inflate.js +78 -0
- package/dist/i18n/en.js +12 -0
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/ja.js +12 -0
- package/dist/i18n/zh_CN.js +12 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -2
- package/dist/interactive/asset-messages.d.ts +2 -1
- package/dist/interactive/asset-messages.js +4 -4
- package/dist/interactive/clack-logger.d.ts +2 -0
- package/dist/interactive/clack-logger.js +11 -0
- package/dist/interactive/credential-auth.d.ts +2 -0
- package/dist/interactive/credential-auth.js +7 -6
- package/dist/interactive/credentials-prompts.js +10 -6
- package/dist/interactive/next-steps.d.ts +2 -1
- package/dist/interactive/next-steps.js +3 -3
- package/dist/interactive/progress.d.ts +8 -1
- package/dist/interactive/progress.js +0 -0
- package/dist/interactive/prompts.d.ts +3 -33
- package/dist/interactive/prompts.js +23 -111
- package/dist/interactive/summary.d.ts +2 -1
- package/dist/interactive/summary.js +3 -3
- package/dist/juggling/resolve.d.ts +7 -0
- package/dist/juggling/resolve.js +18 -0
- package/dist/lib.d.ts +34 -0
- package/dist/lib.js +29 -0
- package/dist/utils/args.d.ts +4 -1
- package/dist/utils/args.js +26 -3
- package/dist/utils/githooks-sync.d.ts +3 -1
- package/dist/utils/githooks-sync.js +37 -37
- package/dist/utils/mcp-generate.d.ts +26 -0
- package/dist/utils/mcp-generate.js +313 -0
- package/dist/utils/preset-io.d.ts +1 -0
- package/dist/utils/preset-io.js +5 -2
- package/dist/utils/settings-io.d.ts +1 -0
- package/dist/utils/settings-io.js +1 -1
- package/package.json +20 -13
- package/dist/utils/mcp-sync.d.ts +0 -4
- package/dist/utils/mcp-sync.js +0 -103
package/README.md
CHANGED
|
@@ -130,6 +130,7 @@ accel update
|
|
|
130
130
|
- `--asset-server-url` / `--asset-ref` で取得元のリポジトリ・ブランチを変更できます(リポジトリの移転やブランチ再編への追従)。変更した取得元は記録され、以降の update の既定になります。
|
|
131
131
|
- 配備時のコミットが取得できない場合(資材リポジトリの履歴書き換え等)も、ユーザー編集を失わないフォールバックモードで更新を続行できます。対話モードでは確認の上で続行し、非対話モードでは `--allow-missing-base` の指定時のみ続行します(対話モードでも同フラグ指定時は確認を省略します)。
|
|
132
132
|
- 未コミットの変更がある状態での実行は推奨しません(警告が表示されます)。update 前のコミットを推奨します。
|
|
133
|
+
- 更新後、MCP 設定ファイルを再生成し、構成変更を反映します(詳細は「[MCP 設定の自動生成](#mcp-設定の自動生成)」)。
|
|
133
134
|
|
|
134
135
|
#### 非対話モード
|
|
135
136
|
|
|
@@ -171,6 +172,7 @@ accel switch --feature jssp
|
|
|
171
172
|
- **ユーザーが編集したファイルには一切触れません**。切り替えで上書き・削除の対象になった編集済みファイルはそのまま保持してスキップし、終了時に「切り替えが適用されていないファイル」として一覧表示します。`update` と異なり、コンフリクトマーカーの挿入は行いません。
|
|
172
173
|
- 未編集のファイルは新しい構成の内容で上書きされ、新構成で不要になった資材は削除、新たに必要になった資材は追加されます。
|
|
173
174
|
- install / build は変更されたファイルに `package.json` またはロックファイル(`bun.lock` 等)が含まれる場合のみ実行します。skills などの切り替えだけであれば実行されず、すぐに完了します。スキップされた編集済みファイルがある状態で install / build が失敗した場合は、スキップしたファイルが原因の可能性がある旨をあわせて表示します。
|
|
175
|
+
- 切り替え後、MCP 設定ファイルを再生成し、モジュール構成の変更を反映します(詳細は「[MCP 設定の自動生成](#mcp-設定の自動生成)」)。
|
|
174
176
|
- 対話モードでは、モジュール・機能・エージェントを現在の設定を初期値として選択し直せます。プリセット(後述「[`accel preset`](#accel-preset)」)が登録されている場合は、最初にプリセットを利用するかの選択肢が表示され、プリセットを選ぶと3項目の選択をスキップしてプリセットの内容に切り替わります(`--module` / `--feature` / `--agent` / `--preset` のいずれかを指定した場合は、この選択肢は表示されません)。
|
|
175
177
|
- `--preset` でプリセットを指定して切り替えることもできます(`--module` / `--feature` / `--agent` との同時指定はエラー)。対話モードでも 3 項目の選択はスキップされ、適用確認に直行します。
|
|
176
178
|
|
|
@@ -297,6 +299,7 @@ accel detach
|
|
|
297
299
|
|
|
298
300
|
- 配備時からハッシュが変わっていないファイルを削除
|
|
299
301
|
- ユーザーが編集したファイルはスキップ(警告表示)
|
|
302
|
+
- MCP 設定ファイル(`.mcp.json` 等)からは CLI が生成したエントリのみを除去(ファイル自体とユーザーが追加したエントリは残る。詳細は「[MCP 設定の自動生成](#mcp-設定の自動生成)」)
|
|
300
303
|
- `.accel/` ディレクトリを削除
|
|
301
304
|
|
|
302
305
|
### `accel login`
|
|
@@ -310,8 +313,8 @@ accel login
|
|
|
310
313
|
|
|
311
314
|
- `endpoint`(テキスト入力)と `apiKey`(マスク入力)を対話で入力します。
|
|
312
315
|
- 入力したトークンの有効性を iAP に問い合わせて確認します。検証に失敗(401 など)した場合や接続エラーの場合は、その場で再入力を促します。
|
|
313
|
-
- 検証に成功した時点で `.accel/credentials.json` に保存します。**API
|
|
314
|
-
- `.accel/credentials.json` の保存に成功すると、プロジェクト内の MCP
|
|
316
|
+
- 検証に成功した時点で `.accel/credentials.json` に保存します。**APIキーは機密情報のため、ファイルは自動的に `.gitignore` に追加されます**(コミット対象外)。
|
|
317
|
+
- `.accel/credentials.json` の保存に成功すると、プロジェクト内の MCP 設定ファイルを自動生成します(詳細は後述「[MCP 設定の自動生成](#mcp-設定の自動生成)」)。
|
|
315
318
|
|
|
316
319
|
#### 非対話モード
|
|
317
320
|
|
|
@@ -326,7 +329,7 @@ ACCEL_API_KEY=*** accel login \
|
|
|
326
329
|
- `endpoint` / `apiKey` は **フラグ > 環境変数 > `.accel/credentials.json`** の優先順位で解決します。
|
|
327
330
|
- `endpoint`: `--endpoint` / `ACCEL_ENDPOINT`
|
|
328
331
|
- `apiKey`: `--api-key` / `ACCEL_API_KEY`
|
|
329
|
-
- **API
|
|
332
|
+
- **APIキーは機密情報のため、CI では `ACCEL_API_KEY` 環境変数での指定を推奨します**(`--api-key` はプロセス一覧やCIログに漏れ得ます)。
|
|
330
333
|
- トークン検証は1回だけ実行します。**失敗時は再入力せず、エラーメッセージを表示して非0終了します**。
|
|
331
334
|
- 検証成功時に `.accel/credentials.json` へ保存します(対話モードと同様、`.gitignore` に自動追記)。
|
|
332
335
|
- `endpoint` / `apiKey` のいずれかが解決できない場合はエラー終了します。
|
|
@@ -350,9 +353,9 @@ accel deploy
|
|
|
350
353
|
|
|
351
354
|
- プロジェクトのルートで実行します。ビルド成果物は `./target/` 配下に出力されている前提です(`mvn package` で生成される `<artifactId>-<version>.zip`)。
|
|
352
355
|
- 初回実行時に iAP の接続情報(エンドポイントURL・APIキー)の入力を求めます。入力値は `.accel/credentials.json` に保存され、保存値で接続できる限り次回以降は再入力不要です。事前に `accel login`(前述)で設定しておくこともできます。
|
|
353
|
-
- **API
|
|
356
|
+
- **APIキーは機密情報のため、`.accel/credentials.json` は自動的に `.gitignore` に追加されます**(コミット対象外)。
|
|
354
357
|
- デプロイ実行前に、接続情報の有効性を iAP に問い合わせて確認します。保存済みのエンドポイント/APIキーが誤っていて**接続エラーや認証エラー(401 など)になった場合は、その場で再入力を促し、接続できるまでリトライします**。中断したい場合は ESC / Ctrl+C で抜けられます。
|
|
355
|
-
- `.accel/credentials.json` に値を保存/更新したタイミングで、プロジェクト内の MCP
|
|
358
|
+
- `.accel/credentials.json` に値を保存/更新したタイミングで、プロジェクト内の MCP 設定ファイルを自動生成します(詳細は後述「[MCP 設定の自動生成](#mcp-設定の自動生成)」)。非対話モードでは `credentials.json` を保存しないため MCP 設定の生成も行いません。
|
|
356
359
|
- 既存のステージング環境を一覧から選択します(ステージングは iAP 側で事前に作成しておく必要があります)。
|
|
357
360
|
- デプロイ対象の zip は、`.accel/settings.json` の `artifactId` と `projectVersion` から `<artifactId>-<projectVersion>.zip` を `./target/` 配下で特定し、見つかれば自動選択します。見つからない場合は `./target/` 配下の zip を一覧から選択します(単一なら自動選択)。
|
|
358
361
|
- ビルド成果物とは別に管理している共通の imm など、**追加のアーカイブファイル**(`.imm` / `.zip`)を `--additional-file` で複数指定できます。複数ファイルは送信順に展開され、同一パスのエントリは後勝ちで上書きされます。デフォルトの順番は「`--additional-file` の指定順 → ビルド成果物(最後)」で、`--additional-file` を指定した場合はデプロイ前に順番の確認・変更ができます。
|
|
@@ -399,7 +402,7 @@ ACCEL_API_KEY=*** accel deploy \
|
|
|
399
402
|
- `--additional-file` は任意です。指定した場合は各パスの存在・拡張子(`.imm` / `.zip`)・重複を検証し、違反があればエラー終了します。デプロイ順は「`--additional-file` の指定順 → ビルド成果物(最後)」で固定です(順番確認プロンプトは出しません)。
|
|
400
403
|
- `--description` は任意です。最終確認プロンプトは出さず、即デプロイします。
|
|
401
404
|
- **フラグ未指定時、テナント環境セットアップ/サンプルデータセットアップは実行しません**(対話が必要なため)。`--tenant-setup` / `--sample-setup` を指定した場合のみ、デプロイ成功後に対象のセットアップを一括実行します(両指定時はテナント環境セットアップ → サンプルデータセットアップの順。テナント側が失敗してもサンプル側は実行します)。セットアップが失敗した場合は、デプロイ自体は成功している旨を表示した上で非0終了します。自動ログイン付きURLはデプロイ結果に含めて表示します。
|
|
402
|
-
- フラグ/環境変数で渡した接続情報は **`.accel/credentials.json` に保存しません**(CI
|
|
405
|
+
- フラグ/環境変数で渡した接続情報は **`.accel/credentials.json` に保存しません**(CIランナーに機密情報を残さないため)。
|
|
403
406
|
|
|
404
407
|
#### オプション一覧
|
|
405
408
|
|
|
@@ -426,42 +429,38 @@ ACCEL_API_KEY=*** accel deploy \
|
|
|
426
429
|
|
|
427
430
|
`endpoint` には iAP のベースURL を指定します。
|
|
428
431
|
|
|
429
|
-
### MCP
|
|
432
|
+
### MCP 設定の自動生成
|
|
430
433
|
|
|
431
|
-
`.accel/
|
|
434
|
+
資材リポジトリが提供する MCP 設定テンプレート(断片)を `.accel/mcp/` に保持しておき、コーディングエージェント用の MCP 設定ファイルを自動生成します。iAP への接続先 URL と API キーは生成時にテンプレートへ埋め込まれるため、`.mcp.json` などを手動で設定する必要はありません。
|
|
432
435
|
|
|
433
|
-
-
|
|
434
|
-
-
|
|
436
|
+
- テンプレートは `init` / `attach` / `update` / `switch` の資材展開時に `.accel/mcp/` へ保持されます。選択したモジュールなどの構成に応じて、含まれる MCP サーバー定義が切り替わります。
|
|
437
|
+
- 生成される設定は選択したエージェントに応じて `.mcp.json`(claude-code)/ `.vscode/mcp.json`(github-copilot)/ `.codex/config.toml`(codex)です。
|
|
435
438
|
|
|
436
|
-
|
|
437
|
-
|---|---|---|
|
|
438
|
-
| `claude-code` | `.mcp.json`(プロジェクトルート) | `mcpServers.<name>.headers.Authorization` |
|
|
439
|
-
| `codex` | `.codex/config.toml`(プロジェクトルート配下) | `[mcp_servers.<name>]` の `http_headers.Authorization`(`env_http_headers` 設定済みのエントリはスキップ) |
|
|
440
|
-
| `github-copilot` | `.vscode/mcp.json` | `servers.<name>.headers.Authorization` |
|
|
439
|
+
#### 生成タイミング
|
|
441
440
|
|
|
442
|
-
|
|
441
|
+
- `init` / `attach` / `update` / `switch`(資材展開の成功後)。ただし iAP の接続情報(URL・API キー)を必要とするエントリは、接続情報が未設定の間は生成されません(`accel login` を促す案内が表示されます)。接続情報が不要なエントリ(固定 URL の MCP サーバーなど)はこの時点で生成されます。
|
|
442
|
+
- `accel login`(対話・非対話の両方、検証成功時)。接続情報を必要とするエントリはここで生成されます。
|
|
443
|
+
- `accel deploy`(対話モードでの初回入力時/再入力ループの成功時)。**非対話モード**は `credentials.json` を保存しないため生成しません。
|
|
444
|
+
- `update` / `switch` 後の再生成により、モジュール構成の変更が MCP 設定にも反映されます。
|
|
443
445
|
|
|
444
|
-
|
|
446
|
+
#### 既存設定とのマージ
|
|
445
447
|
|
|
446
|
-
|
|
447
|
-
- `url` が `credentials.json` の `endpoint` を**前方一致**で含む(例: `endpoint=https://example.com/imart` → `url=https://example.com/imart/im_logic` など)
|
|
448
|
+
既に MCP 設定ファイルが存在する場合は、エントリ単位でマージします:
|
|
448
449
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
- `
|
|
454
|
-
- `accel deploy`(対話モードでの初回入力時/再入力ループの成功時)
|
|
455
|
-
- `accel deploy`(**非対話モード**)は `credentials.json` を保存しないため、MCP 同期も発生しません
|
|
450
|
+
- CLI が生成した iAP のサーバーエントリ(管理エントリ)は、生成のたびに最新の内容で上書きされます(API キー・URL の更新を反映するため)。
|
|
451
|
+
- **ユーザーが追加した iAP 以外のサーバーエントリと、その他の設定内容には触れません。**
|
|
452
|
+
- 何度実行しても同じエントリが重複することはありません。構成変更で不要になった管理エントリは自動的に削除されます(前回の生成内容は `.accel/mcp-state.json`〔ローカル専用・`.gitignore` 対象〕に記録されます)。
|
|
453
|
+
- `accel detach` 実行時は、管理エントリのみが除去されます(ファイル自体とユーザー追加エントリは残ります)。
|
|
454
|
+
- 注意: `.codex/config.toml` はマージ時に再整形されるため、手書きのコメントは保持されません。
|
|
456
455
|
|
|
457
456
|
#### エラー・ログ方針
|
|
458
457
|
|
|
459
|
-
-
|
|
460
|
-
-
|
|
458
|
+
- 生成は best-effort で、いずれの段階で失敗してもコマンド自体の成否には影響しません。
|
|
459
|
+
- 生成・更新したファイルは情報メッセージで表示し、スキップ・失敗は警告として表示します。
|
|
461
460
|
|
|
462
461
|
### pre-commit フックの自動配置
|
|
463
462
|
|
|
464
|
-
MCP
|
|
463
|
+
生成された MCP 設定ファイルに埋め込まれた API キーを誤って git にコミット・pushしてしまう事故を防ぐため、接続情報の保存時(`login` / `deploy` 対話モード)に pre-commit フックをプロジェクトへ自動配置します。
|
|
465
464
|
|
|
466
465
|
- 配置されるファイル:
|
|
467
466
|
- `.githooks/pre-commit` — コミット前チェックスクリプト
|
|
@@ -497,7 +496,8 @@ accel init my-project --juggling-project /path/to/juggling-project
|
|
|
497
496
|
my-project/
|
|
498
497
|
├── .accel/
|
|
499
498
|
│ ├── settings.json # プロジェクト設定
|
|
500
|
-
│
|
|
499
|
+
│ ├── hashsum.txt # 配備資材のハッシュ
|
|
500
|
+
│ └── mcp/ # MCP 設定テンプレート(資材が提供する場合のみ)
|
|
501
501
|
├── .claude/ # agent=claude-code 時
|
|
502
502
|
│ ├── CLAUDE.md
|
|
503
503
|
│ └── skills/
|
|
@@ -511,11 +511,13 @@ my-project/
|
|
|
511
511
|
|
|
512
512
|
- `.accel/settings.json` — プロジェクト設定。git管理対象、手動編集可。資材リポジトリのURL・ref・配備時のコミットSHA(`assetSource`)を記録し、`accel update` / `accel switch` が参照
|
|
513
513
|
- `.accel/hashsum.txt` — 配備ファイルのハッシュ。`update` / `switch` / `detach` 時のユーザー編集検出に使用
|
|
514
|
+
- `.accel/mcp/` — MCP 設定テンプレート(断片)の保持先。資材リポジトリが提供する場合のみ作られる。接続情報を含まないため git 管理対象(詳細は「[MCP 設定の自動生成](#mcp-設定の自動生成)」)
|
|
514
515
|
- `.accel/credentials.json` — iAP接続情報(endpoint / APIキー)。`accel deploy` 初回実行時に生成。APIキーを含むため `.gitignore` 対象(git管理対象外)
|
|
516
|
+
- `.accel/mcp-state.json` — MCP 設定の生成記録(前回生成した管理エントリ名)。ローカル専用のため `.gitignore` 対象(git管理対象外)
|
|
515
517
|
- `.accel/presets/` — 構成プリセット(1プリセット1ファイル)。`accel preset create` で生成。チーム共有のため git 管理対象(詳細は「[`accel preset`](#accel-preset)」)
|
|
516
518
|
- `.githooks/` — APIキーの誤コミットを防ぐ pre-commit フック。`accel login` / `accel deploy` による接続情報の保存時に配置(詳細は「[pre-commit フックの自動配置](#pre-commit-フックの自動配置)」)
|
|
517
519
|
|
|
518
|
-
|
|
520
|
+
`.accel/mcp/` のテンプレートからは、エージェント別の MCP 設定ファイル(`.mcp.json` / `.codex/config.toml` / `.vscode/mcp.json`)が生成されます。iAP 接続用のエントリは `credentials.json` の保存(`accel login` / `accel deploy`)を待って生成されます。詳細は「[MCP 設定の自動生成](#mcp-設定の自動生成)」を参照してください。
|
|
519
521
|
|
|
520
522
|
このほか、資材リポジトリから取得したデータの資材キャッシュがユーザーのホームディレクトリ配下(`~/.accel/cache`。環境変数 `ACCEL_CACHE_DIR` で変更可能)に作られます。プロジェクトディレクトリ内には作られません。詳細は「[`accel cache`](#accel-cache)」を参照してください。
|
|
521
523
|
|
package/dist/asset/deployer.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type ProgressCallbacks = {
|
|
|
8
8
|
onDownloadStart?: () => void;
|
|
9
9
|
onSectionDeploy?: (section: string, files: string[]) => void;
|
|
10
10
|
onMessages?: (messages: AssetMessage[]) => void;
|
|
11
|
+
onPathRejected?: (kind: "project" | "assetRepo", path: string) => void;
|
|
11
12
|
onInstallStart?: (command: string) => void;
|
|
12
13
|
onBuildStart?: (command: string) => void;
|
|
13
14
|
};
|
|
@@ -19,6 +20,7 @@ export type DeployOptions = {
|
|
|
19
20
|
skipExistingFiles?: boolean;
|
|
20
21
|
onExistingFile?: ExistingFileHandler;
|
|
21
22
|
progress?: ProgressCallbacks;
|
|
23
|
+
signal?: AbortSignal;
|
|
22
24
|
};
|
|
23
25
|
export type DeployResult = {
|
|
24
26
|
deployedFiles: string[];
|
package/dist/asset/deployer.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { writeFile, mkdir, stat } from "node:fs/promises";
|
|
2
2
|
import { join, dirname, resolve, sep } from "node:path";
|
|
3
3
|
import { buildEvalContext } from "../core/eval-context.js";
|
|
4
|
-
import {
|
|
4
|
+
import { normalizeAbort } from "../core/errors.js";
|
|
5
|
+
import { walkAssetRepo, replacementsFor } from "./walker.js";
|
|
5
6
|
import { createMessageCollector } from "./messages.js";
|
|
6
7
|
import { renderAssetContent } from "./renderer.js";
|
|
7
8
|
import { runInstallBuild } from "./installer.js";
|
|
@@ -26,11 +27,7 @@ const isWithinDir = (parentDir, candidate) => {
|
|
|
26
27
|
const prefix = parent.endsWith(sep) ? parent : parent + sep;
|
|
27
28
|
return target.startsWith(prefix);
|
|
28
29
|
};
|
|
29
|
-
const collectReplacements = (entry) =>
|
|
30
|
-
if (!entry.meta?.replacements)
|
|
31
|
-
return [];
|
|
32
|
-
return entry.meta.replacements;
|
|
33
|
-
};
|
|
30
|
+
const collectReplacements = (entry) => replacementsFor(entry);
|
|
34
31
|
export const ROOT_SECTION = "(root)";
|
|
35
32
|
const sectionOf = (relativePath) => {
|
|
36
33
|
const idx = relativePath.indexOf("/");
|
|
@@ -55,7 +52,7 @@ const groupSections = (entries) => {
|
|
|
55
52
|
return [...groups.values()];
|
|
56
53
|
};
|
|
57
54
|
export const deployAssets = async (options) => {
|
|
58
|
-
const { projectDir, settings, provider, noInstall, skipExistingFiles, onExistingFile, progress, } = options;
|
|
55
|
+
const { projectDir, settings, provider, noInstall, skipExistingFiles, onExistingFile, progress, signal, } = options;
|
|
59
56
|
try {
|
|
60
57
|
progress?.onFetchStart?.();
|
|
61
58
|
const repoDir = await provider.fetch();
|
|
@@ -70,15 +67,16 @@ export const deployAssets = async (options) => {
|
|
|
70
67
|
const allEntries = await walkAssetRepo(tree, semver, context, messageCollector.collect);
|
|
71
68
|
const entries = allEntries.filter((entry) => {
|
|
72
69
|
if (!isWithinDir(projectDir, join(projectDir, entry.relativePath))) {
|
|
73
|
-
|
|
70
|
+
progress?.onPathRejected?.("project", entry.relativePath);
|
|
74
71
|
return false;
|
|
75
72
|
}
|
|
76
73
|
if (!isWithinDir(repoDir, resolve(repoDir, entry.sourceRelPath))) {
|
|
77
|
-
|
|
74
|
+
progress?.onPathRejected?.("assetRepo", entry.sourceRelPath);
|
|
78
75
|
return false;
|
|
79
76
|
}
|
|
80
77
|
return true;
|
|
81
78
|
});
|
|
79
|
+
signal?.throwIfAborted();
|
|
82
80
|
progress?.onDownloadStart?.();
|
|
83
81
|
await provider.materialize([
|
|
84
82
|
...new Set(entries.map((e) => e.sourceRelPath)),
|
|
@@ -110,6 +108,7 @@ export const deployAssets = async (options) => {
|
|
|
110
108
|
}
|
|
111
109
|
toDeploy.push(entry);
|
|
112
110
|
}
|
|
111
|
+
signal?.throwIfAborted();
|
|
113
112
|
const hashEntries = await mapWithConcurrency(toDeploy, FS_CONCURRENCY, async (entry) => {
|
|
114
113
|
const targetPath = entry.relativePath;
|
|
115
114
|
const destPath = join(projectDir, targetPath);
|
|
@@ -144,6 +143,9 @@ export const deployAssets = async (options) => {
|
|
|
144
143
|
}
|
|
145
144
|
return { deployedFiles, hashEntries, skippedFiles, overwrittenFiles };
|
|
146
145
|
}
|
|
146
|
+
catch (err) {
|
|
147
|
+
throw normalizeAbort(err, signal);
|
|
148
|
+
}
|
|
147
149
|
finally {
|
|
148
150
|
await provider.cleanup().catch(() => { });
|
|
149
151
|
}
|
|
@@ -11,5 +11,6 @@ export type GitAssetProvider = AssetProvider & {
|
|
|
11
11
|
};
|
|
12
12
|
export type GitAssetProviderOptions = {
|
|
13
13
|
locale?: string;
|
|
14
|
+
signal?: AbortSignal;
|
|
14
15
|
};
|
|
15
16
|
export declare const createGitAssetProvider: (repoUrl: string, ref: string, options?: GitAssetProviderOptions) => GitAssetProvider;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { isAbortError } from "../core/errors.js";
|
|
1
2
|
import { getMessage } from "../i18n/index.js";
|
|
2
|
-
import { isGitAuthError, isGitObjectMissingError, isGitServerUnsupportedError, } from "../git/errors.js";
|
|
3
|
+
import { isGitAuthError, isGitObjectMissingError, isGitProxyError, isGitServerUnsupportedError, } from "../git/errors.js";
|
|
3
4
|
import { createObjectStore, } from "../git/object-store.js";
|
|
4
5
|
import { ensureUrlSidecar, repoStoreDir, resolveCacheRoot, } from "../git/object-cache.js";
|
|
6
|
+
import { redactUrlCredentials } from "../git/redact-url.js";
|
|
5
7
|
import { assertServerSupported, fetchCapabilities, fetchPack, isValidOid, resolveRef, } from "../git/smart-http.js";
|
|
6
8
|
const MAX_WANTS_PER_REQUEST = 1000;
|
|
7
9
|
const META_FILENAME = "_meta.json";
|
|
@@ -15,7 +17,7 @@ const isHttpUrl = (url) => {
|
|
|
15
17
|
}
|
|
16
18
|
};
|
|
17
19
|
export const createGitAssetProvider = (repoUrl, ref, options = {}) => {
|
|
18
|
-
const { locale = "en" } = options;
|
|
20
|
+
const { locale = "en", signal } = options;
|
|
19
21
|
let store = null;
|
|
20
22
|
let commit = null;
|
|
21
23
|
const withHint = (message, cause) => {
|
|
@@ -25,13 +27,18 @@ export const createGitAssetProvider = (repoUrl, ref, options = {}) => {
|
|
|
25
27
|
if (isGitServerUnsupportedError(cause)) {
|
|
26
28
|
return `${message}\n${getMessage("error.gitServerUnsupported", locale)}`;
|
|
27
29
|
}
|
|
30
|
+
if (isGitProxyError(cause)) {
|
|
31
|
+
return `${message}\n${getMessage("error.gitProxyHint", locale)}`;
|
|
32
|
+
}
|
|
28
33
|
return message;
|
|
29
34
|
};
|
|
30
35
|
const ensureStore = async () => {
|
|
31
36
|
if (store)
|
|
32
37
|
return store;
|
|
33
38
|
if (!isHttpUrl(repoUrl)) {
|
|
34
|
-
throw new Error(getMessage("error.gitUrlUnsupported", locale, {
|
|
39
|
+
throw new Error(getMessage("error.gitUrlUnsupported", locale, {
|
|
40
|
+
url: redactUrlCredentials(repoUrl),
|
|
41
|
+
}));
|
|
35
42
|
}
|
|
36
43
|
const dir = repoStoreDir(resolveCacheRoot(), repoUrl);
|
|
37
44
|
store = await createObjectStore({ dir });
|
|
@@ -62,7 +69,7 @@ export const createGitAssetProvider = (repoUrl, ref, options = {}) => {
|
|
|
62
69
|
missing.push(oid);
|
|
63
70
|
}
|
|
64
71
|
for (let i = 0; i < missing.length; i += MAX_WANTS_PER_REQUEST) {
|
|
65
|
-
const pack = await fetchPack(repoUrl, missing.slice(i, i + MAX_WANTS_PER_REQUEST));
|
|
72
|
+
const pack = await fetchPack(repoUrl, missing.slice(i, i + MAX_WANTS_PER_REQUEST), { signal });
|
|
66
73
|
await store.writePack(pack, "blobs");
|
|
67
74
|
}
|
|
68
75
|
};
|
|
@@ -110,15 +117,19 @@ export const createGitAssetProvider = (repoUrl, ref, options = {}) => {
|
|
|
110
117
|
const pack = await fetchPack(repoUrl, [oid], {
|
|
111
118
|
deepenOne: true,
|
|
112
119
|
filterBlobNone: true,
|
|
120
|
+
signal,
|
|
113
121
|
});
|
|
114
122
|
await store.writePack(pack, label);
|
|
115
123
|
}
|
|
116
124
|
await listRootFilesAt(oid);
|
|
117
125
|
};
|
|
118
126
|
const rethrowWithServerDiagnosis = async (original) => {
|
|
119
|
-
if (!isGitAuthError(original)
|
|
127
|
+
if (!isGitAuthError(original) &&
|
|
128
|
+
!isGitProxyError(original) &&
|
|
129
|
+
!isAbortError(original) &&
|
|
130
|
+
signal?.aborted !== true) {
|
|
120
131
|
try {
|
|
121
|
-
assertServerSupported(repoUrl, await fetchCapabilities(repoUrl));
|
|
132
|
+
assertServerSupported(repoUrl, await fetchCapabilities(repoUrl, signal));
|
|
122
133
|
}
|
|
123
134
|
catch (diagErr) {
|
|
124
135
|
if (isGitServerUnsupportedError(diagErr))
|
|
@@ -150,7 +161,7 @@ export const createGitAssetProvider = (repoUrl, ref, options = {}) => {
|
|
|
150
161
|
const opened = await ensureStore();
|
|
151
162
|
try {
|
|
152
163
|
try {
|
|
153
|
-
const resolved = await resolveRef(repoUrl, ref);
|
|
164
|
+
const resolved = await resolveRef(repoUrl, ref, signal);
|
|
154
165
|
if (!resolved) {
|
|
155
166
|
throw new Error(`ref not found on server: ${ref}`);
|
|
156
167
|
}
|
|
@@ -163,7 +174,7 @@ export const createGitAssetProvider = (repoUrl, ref, options = {}) => {
|
|
|
163
174
|
}
|
|
164
175
|
catch (err) {
|
|
165
176
|
const reason = err instanceof Error ? err.message : String(err);
|
|
166
|
-
throw new Error(withHint(`Failed to fetch the asset repository from ${repoUrl} (ref: ${ref}). Check the URL and ref: ${reason}`, err));
|
|
177
|
+
throw new Error(withHint(`Failed to fetch the asset repository from ${redactUrlCredentials(repoUrl)} (ref: ${ref}). Check the URL and ref: ${reason}`, err));
|
|
167
178
|
}
|
|
168
179
|
return opened.dir;
|
|
169
180
|
},
|
|
@@ -210,7 +221,7 @@ export const createGitAssetProvider = (repoUrl, ref, options = {}) => {
|
|
|
210
221
|
}
|
|
211
222
|
catch (err) {
|
|
212
223
|
const reason = err instanceof Error ? err.message : String(err);
|
|
213
|
-
throw new Error(withHint(`Failed to fetch commit ${sha} from ${repoUrl} (history may have been rewritten): ${reason}`, err));
|
|
224
|
+
throw new Error(withHint(`Failed to fetch commit ${sha} from ${redactUrlCredentials(repoUrl)} (history may have been rewritten): ${reason}`, err));
|
|
214
225
|
}
|
|
215
226
|
return commitTreeOf(sha);
|
|
216
227
|
},
|
package/dist/asset/updater.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export type RenderedAsset = {
|
|
|
9
9
|
sha1: string;
|
|
10
10
|
};
|
|
11
11
|
export type RenderedPlan = Map<string, RenderedAsset>;
|
|
12
|
-
export declare const buildRenderedPlan: (tree: AssetTree, settings: AccelSettings, materialize?: (files: string[]) => Promise<void>, collect?: MessageSink) => Promise<RenderedPlan>;
|
|
12
|
+
export declare const buildRenderedPlan: (tree: AssetTree, settings: AccelSettings, materialize?: (files: string[]) => Promise<void>, collect?: MessageSink, onPathRejected?: (kind: "project" | "assetRepo", path: string) => void) => Promise<RenderedPlan>;
|
|
13
13
|
export type FileState = {
|
|
14
14
|
relativePath: string;
|
|
15
15
|
base: RenderedAsset | null;
|
|
@@ -35,6 +35,13 @@ export declare const classifySwitch: (states: FileState[]) => UpdateAction[];
|
|
|
35
35
|
export declare const classifyAll: (states: FileState[], merge: MergeFn, fallback?: {
|
|
36
36
|
keepEdited: boolean;
|
|
37
37
|
}) => Promise<UpdateAction[]>;
|
|
38
|
+
export type UpdaterProgressCallbacks = {
|
|
39
|
+
onRenderStart?: (side: "theirs" | "base") => void;
|
|
40
|
+
onClassifyStart?: (fileCount: number) => void;
|
|
41
|
+
onApplyStart?: (changeCount: number) => void;
|
|
42
|
+
onFileApplied?: (relativePath: string, outcome: UpdateAction["outcome"]) => void;
|
|
43
|
+
onPathRejected?: (kind: "project" | "assetRepo", path: string) => void;
|
|
44
|
+
};
|
|
38
45
|
export type UpdateSummary = {
|
|
39
46
|
updated: string[];
|
|
40
47
|
merged: string[];
|
|
@@ -51,7 +58,7 @@ export type UpdateSummary = {
|
|
|
51
58
|
skippedSwitch: string[];
|
|
52
59
|
changedFileCount: number;
|
|
53
60
|
};
|
|
54
|
-
export declare const applyUpdateActions: (projectDir: string, actions: UpdateAction[]) => Promise<UpdateSummary>;
|
|
61
|
+
export declare const applyUpdateActions: (projectDir: string, actions: UpdateAction[], progress?: UpdaterProgressCallbacks) => Promise<UpdateSummary>;
|
|
55
62
|
export declare const buildUpdatedRecords: (oldEntries: HashsumEntry[], actions: UpdateAction[]) => {
|
|
56
63
|
hashEntries: HashsumEntry[];
|
|
57
64
|
deployedAssets: Record<string, string>;
|
package/dist/asset/updater.js
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { mkdir, readFile, unlink, writeFile } from "node:fs/promises";
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
3
|
import { buildEvalContext } from "../core/eval-context.js";
|
|
4
|
-
import { walkAssetRepo } from "./walker.js";
|
|
4
|
+
import { walkAssetRepo, replacementsFor } from "./walker.js";
|
|
5
5
|
import { renderAssetContent } from "./renderer.js";
|
|
6
6
|
import { computeSha1 } from "../utils/hash.js";
|
|
7
7
|
import { FS_CONCURRENCY, mapWithConcurrency } from "../utils/concurrency.js";
|
|
8
8
|
import { isSafeRelPath } from "../utils/safe-rel-path.js";
|
|
9
|
-
export const buildRenderedPlan = async (tree, settings, materialize, collect) => {
|
|
9
|
+
export const buildRenderedPlan = async (tree, settings, materialize, collect, onPathRejected) => {
|
|
10
10
|
const context = buildEvalContext(settings);
|
|
11
11
|
const entries = await walkAssetRepo(tree, settings.accelplatformVersion.semver, context, collect);
|
|
12
12
|
const safeEntries = entries.filter((entry) => {
|
|
13
|
-
if (!isSafeRelPath(entry.relativePath)
|
|
14
|
-
|
|
13
|
+
if (!isSafeRelPath(entry.relativePath)) {
|
|
14
|
+
onPathRejected?.("project", entry.relativePath);
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
if (!isSafeRelPath(entry.sourceRelPath)) {
|
|
18
|
+
onPathRejected?.("assetRepo", entry.sourceRelPath);
|
|
15
19
|
return false;
|
|
16
20
|
}
|
|
17
21
|
return true;
|
|
@@ -23,7 +27,7 @@ export const buildRenderedPlan = async (tree, settings, materialize, collect) =>
|
|
|
23
27
|
}
|
|
24
28
|
const rendered = await mapWithConcurrency(safeEntries, FS_CONCURRENCY, async (entry) => {
|
|
25
29
|
const raw = await tree.readFile(entry.sourceRelPath);
|
|
26
|
-
const content = renderAssetContent(raw, entry.relativePath, entry
|
|
30
|
+
const content = renderAssetContent(raw, entry.relativePath, replacementsFor(entry), context);
|
|
27
31
|
return {
|
|
28
32
|
relativePath: entry.relativePath,
|
|
29
33
|
content,
|
|
@@ -296,7 +300,8 @@ export const classifyAll = async (states, merge, fallback) => {
|
|
|
296
300
|
}
|
|
297
301
|
return actions;
|
|
298
302
|
};
|
|
299
|
-
export const applyUpdateActions = async (projectDir, actions) => {
|
|
303
|
+
export const applyUpdateActions = async (projectDir, actions, progress) => {
|
|
304
|
+
progress?.onApplyStart?.(actions.filter((a) => a.op !== "none").length);
|
|
300
305
|
const summary = {
|
|
301
306
|
updated: [],
|
|
302
307
|
merged: [],
|
|
@@ -324,6 +329,7 @@ export const applyUpdateActions = async (projectDir, actions) => {
|
|
|
324
329
|
for (const action of actions) {
|
|
325
330
|
if (action.op !== "none") {
|
|
326
331
|
summary.changedFileCount++;
|
|
332
|
+
progress?.onFileApplied?.(action.relativePath, action.outcome);
|
|
327
333
|
}
|
|
328
334
|
switch (action.outcome) {
|
|
329
335
|
case "updated":
|
package/dist/asset/walker.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MetaJson, EvalContext } from "../core/types.js";
|
|
1
|
+
import type { MetaJson, EvalContext, Replacement } from "../core/types.js";
|
|
2
2
|
import type { AssetTree } from "./asset-tree.js";
|
|
3
3
|
import type { MessageSink } from "./messages.js";
|
|
4
4
|
export type AssetEntry = {
|
|
@@ -6,5 +6,6 @@ export type AssetEntry = {
|
|
|
6
6
|
relativePath: string;
|
|
7
7
|
meta: MetaJson | null;
|
|
8
8
|
};
|
|
9
|
+
export declare const replacementsFor: (entry: AssetEntry) => Replacement[];
|
|
9
10
|
export declare const walkAssetDir: (tree: AssetTree, context: EvalContext) => Promise<AssetEntry[]>;
|
|
10
11
|
export declare const walkAssetRepo: (tree: AssetTree, targetSemver: string, context: EvalContext, collect?: MessageSink) => Promise<AssetEntry[]>;
|
package/dist/asset/walker.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { evaluateCondition } from "../core/condition-evaluator.js";
|
|
2
2
|
import { emptyEvalContext } from "../core/eval-context.js";
|
|
3
3
|
const META_FILE = "_meta.json";
|
|
4
|
+
export const replacementsFor = (entry) => entry.meta?.type === "mcp" ? [] : (entry.meta?.replacements ?? []);
|
|
4
5
|
const joinPosix = (...parts) => parts.filter((p) => p !== "").join("/");
|
|
5
6
|
const dirnamePosix = (p) => {
|
|
6
7
|
const idx = p.lastIndexOf("/");
|
|
@@ -56,6 +57,30 @@ const resolveRenameRule = (rules, context, dir) => {
|
|
|
56
57
|
}
|
|
57
58
|
return null;
|
|
58
59
|
};
|
|
60
|
+
const MCP_HOLD_DIR = ".accel/mcp";
|
|
61
|
+
const selectMcpFiles = (rules, context, available) => {
|
|
62
|
+
if (rules === undefined) {
|
|
63
|
+
return [...available].filter((n) => n !== META_FILE).sort();
|
|
64
|
+
}
|
|
65
|
+
if (!Array.isArray(rules))
|
|
66
|
+
return [];
|
|
67
|
+
const selected = new Set();
|
|
68
|
+
for (const rule of rules) {
|
|
69
|
+
if (!rule || typeof rule !== "object")
|
|
70
|
+
continue;
|
|
71
|
+
if (typeof rule.file !== "string")
|
|
72
|
+
continue;
|
|
73
|
+
if (rule.condition != null && typeof rule.condition !== "object")
|
|
74
|
+
continue;
|
|
75
|
+
if (rule.condition != null && !evaluateCondition(rule.condition, context)) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (rule.file === META_FILE || !available.has(rule.file))
|
|
79
|
+
continue;
|
|
80
|
+
selected.add(rule.file);
|
|
81
|
+
}
|
|
82
|
+
return [...selected].sort();
|
|
83
|
+
};
|
|
59
84
|
const findMatchingVersionDirs = async (tree, vtree, targetSemver) => {
|
|
60
85
|
const root = vtree.get("");
|
|
61
86
|
if (!root)
|
|
@@ -93,6 +118,17 @@ const walkDirectory = async (tree, vtree, dir, baseDir, parentMeta, context, col
|
|
|
93
118
|
collect(ownMeta.messages, context);
|
|
94
119
|
}
|
|
95
120
|
const relativeOf = (p) => p === baseDir ? "" : baseDir === "" ? p : p.slice(baseDir.length + 1);
|
|
121
|
+
if (ownMeta?.type === "mcp") {
|
|
122
|
+
const outputPath = relativeOf(dir);
|
|
123
|
+
for (const name of selectMcpFiles(ownMeta.files, context, node.files)) {
|
|
124
|
+
entries.push({
|
|
125
|
+
sourceRelPath: joinPosix(dir, name),
|
|
126
|
+
relativePath: joinPosix(MCP_HOLD_DIR, outputPath, name),
|
|
127
|
+
meta: effectiveMeta,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return entries;
|
|
131
|
+
}
|
|
96
132
|
if (ownMeta?.type === "file") {
|
|
97
133
|
const parentRelative = relativeOf(dirnamePosix(dir));
|
|
98
134
|
if (ownMeta.rename && ownMeta.rename.length > 0) {
|
|
@@ -4,4 +4,4 @@ export type AssetProviderArgs = {
|
|
|
4
4
|
assetServerUrl?: string;
|
|
5
5
|
assetRef?: string;
|
|
6
6
|
};
|
|
7
|
-
export declare const selectAssetProvider: (args: AssetProviderArgs, locale: string) => Promise<AssetProvider>;
|
|
7
|
+
export declare const selectAssetProvider: (args: AssetProviderArgs, locale: string, signal?: AbortSignal) => Promise<AssetProvider>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DEFAULT_ASSET_REPO_URL, DEFAULT_ASSET_REF, } from "../core/constants.js";
|
|
2
2
|
import { createFileAssetProvider } from "../asset/file-provider.js";
|
|
3
3
|
import { createGitAssetProvider } from "../asset/git-provider.js";
|
|
4
|
-
export const selectAssetProvider = async (args, locale) => {
|
|
4
|
+
export const selectAssetProvider = async (args, locale, signal) => {
|
|
5
5
|
if (args.assetSource) {
|
|
6
6
|
return createFileAssetProvider(args.assetSource);
|
|
7
7
|
}
|
|
8
|
-
return createGitAssetProvider(args.assetServerUrl ?? DEFAULT_ASSET_REPO_URL, args.assetRef ?? DEFAULT_ASSET_REF, { locale });
|
|
8
|
+
return createGitAssetProvider(args.assetServerUrl ?? DEFAULT_ASSET_REPO_URL, args.assetRef ?? DEFAULT_ASSET_REF, { locale, signal });
|
|
9
9
|
};
|