@intra-mart/accel 0.5.0-dev.202608030656 → 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 +103 -32
- 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.d.ts +31 -0
- package/dist/commands/preset.js +389 -0
- package/dist/commands/run-wrapper.d.ts +15 -0
- package/dist/commands/run-wrapper.js +62 -0
- package/dist/commands/switch.d.ts +49 -17
- package/dist/commands/switch.js +206 -122
- package/dist/commands/update.d.ts +142 -83
- package/dist/commands/update.js +359 -261
- 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 +14 -1
- package/dist/core/validation.d.ts +34 -0
- package/dist/core/validation.js +87 -0
- package/dist/core/validators.d.ts +2 -0
- package/dist/core/validators.js +7 -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 +47 -0
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/ja.js +47 -0
- package/dist/i18n/zh_CN.js +47 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -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 +24 -0
- package/dist/utils/preset-io.js +167 -0
- package/dist/utils/settings-io.d.ts +2 -0
- package/dist/utils/settings-io.js +2 -2
- 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
|
@@ -122,12 +122,15 @@ accel update
|
|
|
122
122
|
|
|
123
123
|
- ユーザーが編集したファイルの内容は保持されます。編集箇所と資材の更新が重なった場合はコンフリクトマーカー(git と同じ `<<<<<<<` 形式)が挿入されるので、該当ファイルを手動で解決してください。コンフリクトの発生は正常終了扱いで、終了時に対象ファイルの一覧が表示されます。
|
|
124
124
|
- 対話モードでは、最初に**既存の設定を利用するか**を確認します(デフォルト: Yes)。利用する場合は各設定の再入力をスキップし、現在の設定(CLIオプションの指定があればその値で上書き)のまま更新に進みます。再入力を選んだ場合は、iAPバージョン・モジュール・機能・エージェントなどの設定を**現在値を初期値として**変更できます。
|
|
125
|
+
- プリセット(後述「[`accel preset`](#accel-preset)」)が登録されている場合は、「既存の設定を利用 / プリセット○○を利用 / 設定を再入力」の選択になります。プリセットを選ぶと、モジュール・機能・エージェントがプリセットの内容に切り替わった状態で更新に進みます(`--preset` 指定時は設定確定済みのため、この確認をスキップして事前サマリーと適用確認に直行します)。
|
|
125
126
|
- 既存の設定に不正な値やカタログとの不整合がある場合は、対象の項目と理由を通知した上で再入力になります(確認はスキップ)。
|
|
127
|
+
- `--preset` でプリセットを指定すると、モジュール・機能・エージェントをプリセットの内容に一括で変更できます。`--module` / `--feature` / `--agent` との同時指定はエラーになります。
|
|
126
128
|
- 非対話モードでは `init` と同じオプションで変更を指定でき、未指定の項目は現在の設定を維持します。
|
|
127
129
|
- IM-Juggling プロジェクトとの連携は、設定の再入力時に IM-Juggling プロジェクトのプロンプトを空にして確定するか、`--juggling-project ""`(空文字)を指定すると解除できます。
|
|
128
130
|
- `--asset-server-url` / `--asset-ref` で取得元のリポジトリ・ブランチを変更できます(リポジトリの移転やブランチ再編への追従)。変更した取得元は記録され、以降の update の既定になります。
|
|
129
131
|
- 配備時のコミットが取得できない場合(資材リポジトリの履歴書き換え等)も、ユーザー編集を失わないフォールバックモードで更新を続行できます。対話モードでは確認の上で続行し、非対話モードでは `--allow-missing-base` の指定時のみ続行します(対話モードでも同フラグ指定時は確認を省略します)。
|
|
130
132
|
- 未コミットの変更がある状態での実行は推奨しません(警告が表示されます)。update 前のコミットを推奨します。
|
|
133
|
+
- 更新後、MCP 設定ファイルを再生成し、構成変更を反映します(詳細は「[MCP 設定の自動生成](#mcp-設定の自動生成)」)。
|
|
131
134
|
|
|
132
135
|
#### 非対話モード
|
|
133
136
|
|
|
@@ -144,6 +147,7 @@ accel update --non-interactive --module im_workflow,im_activiti
|
|
|
144
147
|
|
|
145
148
|
| オプション | 型 | 説明 | デフォルト |
|
|
146
149
|
|---|---|---|---|
|
|
150
|
+
| `--preset` | string | 適用するプリセット名(後述「[`accel preset`](#accel-preset)」)。モジュール・機能・エージェントをプリセットの内容に変更する。`--module` / `--feature` / `--agent` とは同時指定不可 | - |
|
|
147
151
|
| `--non-interactive` | boolean | 非対話モード | `false` |
|
|
148
152
|
| `--skip-install` | boolean | 更新後の install / build をスキップ | `false` |
|
|
149
153
|
| `--asset-server-url` | string | 資材を取得するgitリポジトリのURL(HTTP(S) のみ)を変更する。変更は記録され、以降の既定になる | 記録済みのURL |
|
|
@@ -168,12 +172,21 @@ accel switch --feature jssp
|
|
|
168
172
|
- **ユーザーが編集したファイルには一切触れません**。切り替えで上書き・削除の対象になった編集済みファイルはそのまま保持してスキップし、終了時に「切り替えが適用されていないファイル」として一覧表示します。`update` と異なり、コンフリクトマーカーの挿入は行いません。
|
|
169
173
|
- 未編集のファイルは新しい構成の内容で上書きされ、新構成で不要になった資材は削除、新たに必要になった資材は追加されます。
|
|
170
174
|
- install / build は変更されたファイルに `package.json` またはロックファイル(`bun.lock` 等)が含まれる場合のみ実行します。skills などの切り替えだけであれば実行されず、すぐに完了します。スキップされた編集済みファイルがある状態で install / build が失敗した場合は、スキップしたファイルが原因の可能性がある旨をあわせて表示します。
|
|
171
|
-
-
|
|
175
|
+
- 切り替え後、MCP 設定ファイルを再生成し、モジュール構成の変更を反映します(詳細は「[MCP 設定の自動生成](#mcp-設定の自動生成)」)。
|
|
176
|
+
- 対話モードでは、モジュール・機能・エージェントを現在の設定を初期値として選択し直せます。プリセット(後述「[`accel preset`](#accel-preset)」)が登録されている場合は、最初にプリセットを利用するかの選択肢が表示され、プリセットを選ぶと3項目の選択をスキップしてプリセットの内容に切り替わります(`--module` / `--feature` / `--agent` / `--preset` のいずれかを指定した場合は、この選択肢は表示されません)。
|
|
177
|
+
- `--preset` でプリセットを指定して切り替えることもできます(`--module` / `--feature` / `--agent` との同時指定はエラー)。対話モードでも 3 項目の選択はスキップされ、適用確認に直行します。
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
accel switch --preset server-side
|
|
181
|
+
```
|
|
172
182
|
|
|
173
183
|
#### 非対話モード
|
|
174
184
|
|
|
175
185
|
```bash
|
|
176
186
|
accel switch --non-interactive --feature jssp --agent claude-code
|
|
187
|
+
|
|
188
|
+
# プリセットを使う場合
|
|
189
|
+
accel switch --non-interactive --preset server-side
|
|
177
190
|
```
|
|
178
191
|
|
|
179
192
|
未指定の項目は現在の設定を維持します。
|
|
@@ -185,12 +198,69 @@ accel switch --non-interactive --feature jssp --agent claude-code
|
|
|
185
198
|
| `--module` | string | 使用モジュール。カタログの `artifactId`(カンマ区切り) | 現在の設定を維持 |
|
|
186
199
|
| `--feature` | string | 使用機能。カタログの機能ID(カンマ区切り) | 現在の設定を維持 |
|
|
187
200
|
| `--agent` | string | エージェント種別(`claude-code`, `codex`, `github-copilot`、カンマ区切り) | 現在の設定を維持 |
|
|
201
|
+
| `--preset` | string | 適用するプリセット名(後述「[`accel preset`](#accel-preset)」)。3項目をプリセットの内容に変更する。`--module` / `--feature` / `--agent` とは同時指定不可 | - |
|
|
188
202
|
| `--non-interactive` | boolean | 非対話モード | `false` |
|
|
189
203
|
| `--skip-install` | boolean | 依存関係変更時の install / build をスキップ | `false` |
|
|
190
204
|
|
|
191
205
|
- 切り替えられるのは上記の3項目のみです。iAPバージョンやロケールなど他の設定の変更は `accel update` で行います。
|
|
192
206
|
- `update` と同様、git ソースから配備されたプロジェクトでのみ利用できます。
|
|
193
207
|
|
|
208
|
+
### `accel preset`
|
|
209
|
+
|
|
210
|
+
モジュール・機能・エージェントの組み合わせを**構成プリセット**として登録・管理します。登録したプリセットは `accel update` / `accel switch` で利用できます。
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
cd my-project
|
|
214
|
+
accel preset create
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
実際の開発では、「画面開発用」「サーバサイド開発用」「workflow用」のように、開発対象ごとに使用する skills 等の構成が決まっているケースが多いはずです。プロジェクトでよく使う構成をプリセットとして登録しておくと、チームメンバー全員が同じ構成を名前ひとつで切り替えられるようになります。
|
|
218
|
+
|
|
219
|
+
- プリセットは `.accel/presets/<プリセット名>.json` に1プリセット1ファイルで保存されます。**git 管理対象**なので、コミットすればチームメンバーに共有されます。
|
|
220
|
+
- プリセットの内容は module / feature / agent の3項目(+表示名・説明)です。3項目すべてを保存します。
|
|
221
|
+
- `init` / `attach` 済みのプロジェクト内で実行してください(`.accel` が無い場合はエラー)。`accel detach` は `.accel/` ごと削除するため、プリセットも一緒に削除されます。
|
|
222
|
+
- プリセット名(ID)に使える文字は英数字と `-` `_` のみです。ファイル名や `--preset` での指定に使われます。
|
|
223
|
+
- 日本語などの名前を付けたい場合は**表示名**を設定してください。一覧や選択肢では「表示名 (プリセット名)」の形式で表示されます(表示名が未設定なら プリセット名のみ)。
|
|
224
|
+
- 適用時(`update` / `switch`)には、プリセットの内容が適用時点のiAPバージョン(`update` で `--accelplatform-version` を指定した場合は変更後のバージョン)のカタログに対して検証されます。バージョン変更などでプリセット内のモジュール・機能が存在しなくなった場合はエラーになります。
|
|
225
|
+
|
|
226
|
+
#### `accel preset create [name]`
|
|
227
|
+
|
|
228
|
+
プリセットを対話形式で作成します。名前(ID)・表示名・説明を入力し、モジュール・機能・エージェントを選択して保存します。保存後に続けて次のプリセットを作成できるため、プロジェクト作成直後に複数のプリセットをまとめて登録できます。
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# 非対話モード(3項目すべての指定が必須)
|
|
232
|
+
accel preset create server-side \
|
|
233
|
+
--non-interactive \
|
|
234
|
+
--module im_workflow \
|
|
235
|
+
--feature jssp \
|
|
236
|
+
--agent claude-code \
|
|
237
|
+
--label "サーバサイド開発用"
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
| オプション | 型 | 説明 | デフォルト |
|
|
241
|
+
|---|---|---|---|
|
|
242
|
+
| `[name]`(位置引数) | string | プリセット名(ID。英数字と `-` `_` のみ。**非対話モードでは必須**) | 対話で入力 |
|
|
243
|
+
| `--label` | string | 表示名。日本語なども使用可。`preset list` や選択肢に表示される | `""`(プリセット名を表示) |
|
|
244
|
+
| `--description` | string | プリセットの説明。`preset list` や選択肢に表示される | `""` |
|
|
245
|
+
| `--module` | string | 使用モジュール。カタログの `artifactId`(カンマ区切り。**非対話モードでは必須**) | 対話で選択 |
|
|
246
|
+
| `--feature` | string | 使用機能。カタログの機能ID(カンマ区切り。**非対話モードでは必須**。`""` で機能なし) | 対話で選択 |
|
|
247
|
+
| `--agent` | string | エージェント種別(`claude-code`, `codex`, `github-copilot`、カンマ区切り。**非対話モードでは必須**) | 対話で選択 |
|
|
248
|
+
| `--force` | boolean | 同名プリセットが存在する場合に確認なしで上書きする | `false`(対話で確認 / 非対話ではエラー) |
|
|
249
|
+
| `--locale` | string | ロケール(`ja`, `en`, `zh_CN`) | `settings.json` の記録値 |
|
|
250
|
+
| `--non-interactive` | boolean | 非対話モード | `false` |
|
|
251
|
+
|
|
252
|
+
#### `accel preset list`
|
|
253
|
+
|
|
254
|
+
登録済みプリセットの一覧(名前と説明)を表示します。
|
|
255
|
+
|
|
256
|
+
#### `accel preset show <name>`
|
|
257
|
+
|
|
258
|
+
指定したプリセットの内容(表示名・説明・モジュール・機能・エージェント)を表示します。名前(ID)で指定します。
|
|
259
|
+
|
|
260
|
+
#### `accel preset delete <name>`
|
|
261
|
+
|
|
262
|
+
指定したプリセットを削除します。名前(ID)で指定します。対話モードでは削除前に確認します。
|
|
263
|
+
|
|
194
264
|
### `accel cache`
|
|
195
265
|
|
|
196
266
|
資材キャッシュを管理します。
|
|
@@ -229,6 +299,7 @@ accel detach
|
|
|
229
299
|
|
|
230
300
|
- 配備時からハッシュが変わっていないファイルを削除
|
|
231
301
|
- ユーザーが編集したファイルはスキップ(警告表示)
|
|
302
|
+
- MCP 設定ファイル(`.mcp.json` 等)からは CLI が生成したエントリのみを除去(ファイル自体とユーザーが追加したエントリは残る。詳細は「[MCP 設定の自動生成](#mcp-設定の自動生成)」)
|
|
232
303
|
- `.accel/` ディレクトリを削除
|
|
233
304
|
|
|
234
305
|
### `accel login`
|
|
@@ -242,8 +313,8 @@ accel login
|
|
|
242
313
|
|
|
243
314
|
- `endpoint`(テキスト入力)と `apiKey`(マスク入力)を対話で入力します。
|
|
244
315
|
- 入力したトークンの有効性を iAP に問い合わせて確認します。検証に失敗(401 など)した場合や接続エラーの場合は、その場で再入力を促します。
|
|
245
|
-
- 検証に成功した時点で `.accel/credentials.json` に保存します。**API
|
|
246
|
-
- `.accel/credentials.json` の保存に成功すると、プロジェクト内の MCP
|
|
316
|
+
- 検証に成功した時点で `.accel/credentials.json` に保存します。**APIキーは機密情報のため、ファイルは自動的に `.gitignore` に追加されます**(コミット対象外)。
|
|
317
|
+
- `.accel/credentials.json` の保存に成功すると、プロジェクト内の MCP 設定ファイルを自動生成します(詳細は後述「[MCP 設定の自動生成](#mcp-設定の自動生成)」)。
|
|
247
318
|
|
|
248
319
|
#### 非対話モード
|
|
249
320
|
|
|
@@ -258,7 +329,7 @@ ACCEL_API_KEY=*** accel login \
|
|
|
258
329
|
- `endpoint` / `apiKey` は **フラグ > 環境変数 > `.accel/credentials.json`** の優先順位で解決します。
|
|
259
330
|
- `endpoint`: `--endpoint` / `ACCEL_ENDPOINT`
|
|
260
331
|
- `apiKey`: `--api-key` / `ACCEL_API_KEY`
|
|
261
|
-
- **API
|
|
332
|
+
- **APIキーは機密情報のため、CI では `ACCEL_API_KEY` 環境変数での指定を推奨します**(`--api-key` はプロセス一覧やCIログに漏れ得ます)。
|
|
262
333
|
- トークン検証は1回だけ実行します。**失敗時は再入力せず、エラーメッセージを表示して非0終了します**。
|
|
263
334
|
- 検証成功時に `.accel/credentials.json` へ保存します(対話モードと同様、`.gitignore` に自動追記)。
|
|
264
335
|
- `endpoint` / `apiKey` のいずれかが解決できない場合はエラー終了します。
|
|
@@ -282,9 +353,9 @@ accel deploy
|
|
|
282
353
|
|
|
283
354
|
- プロジェクトのルートで実行します。ビルド成果物は `./target/` 配下に出力されている前提です(`mvn package` で生成される `<artifactId>-<version>.zip`)。
|
|
284
355
|
- 初回実行時に iAP の接続情報(エンドポイントURL・APIキー)の入力を求めます。入力値は `.accel/credentials.json` に保存され、保存値で接続できる限り次回以降は再入力不要です。事前に `accel login`(前述)で設定しておくこともできます。
|
|
285
|
-
- **API
|
|
356
|
+
- **APIキーは機密情報のため、`.accel/credentials.json` は自動的に `.gitignore` に追加されます**(コミット対象外)。
|
|
286
357
|
- デプロイ実行前に、接続情報の有効性を iAP に問い合わせて確認します。保存済みのエンドポイント/APIキーが誤っていて**接続エラーや認証エラー(401 など)になった場合は、その場で再入力を促し、接続できるまでリトライします**。中断したい場合は ESC / Ctrl+C で抜けられます。
|
|
287
|
-
- `.accel/credentials.json` に値を保存/更新したタイミングで、プロジェクト内の MCP
|
|
358
|
+
- `.accel/credentials.json` に値を保存/更新したタイミングで、プロジェクト内の MCP 設定ファイルを自動生成します(詳細は後述「[MCP 設定の自動生成](#mcp-設定の自動生成)」)。非対話モードでは `credentials.json` を保存しないため MCP 設定の生成も行いません。
|
|
288
359
|
- 既存のステージング環境を一覧から選択します(ステージングは iAP 側で事前に作成しておく必要があります)。
|
|
289
360
|
- デプロイ対象の zip は、`.accel/settings.json` の `artifactId` と `projectVersion` から `<artifactId>-<projectVersion>.zip` を `./target/` 配下で特定し、見つかれば自動選択します。見つからない場合は `./target/` 配下の zip を一覧から選択します(単一なら自動選択)。
|
|
290
361
|
- ビルド成果物とは別に管理している共通の imm など、**追加のアーカイブファイル**(`.imm` / `.zip`)を `--additional-file` で複数指定できます。複数ファイルは送信順に展開され、同一パスのエントリは後勝ちで上書きされます。デフォルトの順番は「`--additional-file` の指定順 → ビルド成果物(最後)」で、`--additional-file` を指定した場合はデプロイ前に順番の確認・変更ができます。
|
|
@@ -331,7 +402,7 @@ ACCEL_API_KEY=*** accel deploy \
|
|
|
331
402
|
- `--additional-file` は任意です。指定した場合は各パスの存在・拡張子(`.imm` / `.zip`)・重複を検証し、違反があればエラー終了します。デプロイ順は「`--additional-file` の指定順 → ビルド成果物(最後)」で固定です(順番確認プロンプトは出しません)。
|
|
332
403
|
- `--description` は任意です。最終確認プロンプトは出さず、即デプロイします。
|
|
333
404
|
- **フラグ未指定時、テナント環境セットアップ/サンプルデータセットアップは実行しません**(対話が必要なため)。`--tenant-setup` / `--sample-setup` を指定した場合のみ、デプロイ成功後に対象のセットアップを一括実行します(両指定時はテナント環境セットアップ → サンプルデータセットアップの順。テナント側が失敗してもサンプル側は実行します)。セットアップが失敗した場合は、デプロイ自体は成功している旨を表示した上で非0終了します。自動ログイン付きURLはデプロイ結果に含めて表示します。
|
|
334
|
-
- フラグ/環境変数で渡した接続情報は **`.accel/credentials.json` に保存しません**(CI
|
|
405
|
+
- フラグ/環境変数で渡した接続情報は **`.accel/credentials.json` に保存しません**(CIランナーに機密情報を残さないため)。
|
|
335
406
|
|
|
336
407
|
#### オプション一覧
|
|
337
408
|
|
|
@@ -358,42 +429,38 @@ ACCEL_API_KEY=*** accel deploy \
|
|
|
358
429
|
|
|
359
430
|
`endpoint` には iAP のベースURL を指定します。
|
|
360
431
|
|
|
361
|
-
### MCP
|
|
362
|
-
|
|
363
|
-
`.accel/credentials.json` の保存に成功した直後、プロジェクト内のコーディングエージェント用 MCP 設定ファイルに対し iAP の API キーを `Authorization: Bearer <apiKey>` として自動反映します。
|
|
364
|
-
|
|
365
|
-
- 対象は `.accel/settings.json` の `agents` に含まれるエージェントのファイルだけです。
|
|
366
|
-
- **既存の MCP サーバーエントリのヘッダ値のみを更新**し、新規エントリの追加やファイル自体の新規作成は行いません(MCP 設定そのものは資材リポジトリ側で配備される前提)。
|
|
432
|
+
### MCP 設定の自動生成
|
|
367
433
|
|
|
368
|
-
|
|
369
|
-
|---|---|---|
|
|
370
|
-
| `claude-code` | `.mcp.json`(プロジェクトルート) | `mcpServers.<name>.headers.Authorization` |
|
|
371
|
-
| `codex` | `.codex/config.toml`(プロジェクトルート配下) | `[mcp_servers.<name>]` の `http_headers.Authorization`(`env_http_headers` 設定済みのエントリはスキップ) |
|
|
372
|
-
| `github-copilot` | `.vscode/mcp.json` | `servers.<name>.headers.Authorization` |
|
|
434
|
+
資材リポジトリが提供する MCP 設定テンプレート(断片)を `.accel/mcp/` に保持しておき、コーディングエージェント用の MCP 設定ファイルを自動生成します。iAP への接続先 URL と API キーは生成時にテンプレートへ埋め込まれるため、`.mcp.json` などを手動で設定する必要はありません。
|
|
373
435
|
|
|
374
|
-
|
|
436
|
+
- テンプレートは `init` / `attach` / `update` / `switch` の資材展開時に `.accel/mcp/` へ保持されます。選択したモジュールなどの構成に応じて、含まれる MCP サーバー定義が切り替わります。
|
|
437
|
+
- 生成される設定は選択したエージェントに応じて `.mcp.json`(claude-code)/ `.vscode/mcp.json`(github-copilot)/ `.codex/config.toml`(codex)です。
|
|
375
438
|
|
|
376
|
-
|
|
439
|
+
#### 生成タイミング
|
|
377
440
|
|
|
378
|
-
- `
|
|
379
|
-
- `
|
|
441
|
+
- `init` / `attach` / `update` / `switch`(資材展開の成功後)。ただし iAP の接続情報(URL・API キー)を必要とするエントリは、接続情報が未設定の間は生成されません(`accel login` を促す案内が表示されます)。接続情報が不要なエントリ(固定 URL の MCP サーバーなど)はこの時点で生成されます。
|
|
442
|
+
- `accel login`(対話・非対話の両方、検証成功時)。接続情報を必要とするエントリはここで生成されます。
|
|
443
|
+
- `accel deploy`(対話モードでの初回入力時/再入力ループの成功時)。**非対話モード**は `credentials.json` を保存しないため生成しません。
|
|
444
|
+
- `update` / `switch` 後の再生成により、モジュール構成の変更が MCP 設定にも反映されます。
|
|
380
445
|
|
|
381
|
-
|
|
446
|
+
#### 既存設定とのマージ
|
|
382
447
|
|
|
383
|
-
|
|
448
|
+
既に MCP 設定ファイルが存在する場合は、エントリ単位でマージします:
|
|
384
449
|
|
|
385
|
-
-
|
|
386
|
-
-
|
|
387
|
-
-
|
|
450
|
+
- CLI が生成した iAP のサーバーエントリ(管理エントリ)は、生成のたびに最新の内容で上書きされます(API キー・URL の更新を反映するため)。
|
|
451
|
+
- **ユーザーが追加した iAP 以外のサーバーエントリと、その他の設定内容には触れません。**
|
|
452
|
+
- 何度実行しても同じエントリが重複することはありません。構成変更で不要になった管理エントリは自動的に削除されます(前回の生成内容は `.accel/mcp-state.json`〔ローカル専用・`.gitignore` 対象〕に記録されます)。
|
|
453
|
+
- `accel detach` 実行時は、管理エントリのみが除去されます(ファイル自体とユーザー追加エントリは残ります)。
|
|
454
|
+
- 注意: `.codex/config.toml` はマージ時に再整形されるため、手書きのコメントは保持されません。
|
|
388
455
|
|
|
389
456
|
#### エラー・ログ方針
|
|
390
457
|
|
|
391
|
-
-
|
|
392
|
-
-
|
|
458
|
+
- 生成は best-effort で、いずれの段階で失敗してもコマンド自体の成否には影響しません。
|
|
459
|
+
- 生成・更新したファイルは情報メッセージで表示し、スキップ・失敗は警告として表示します。
|
|
393
460
|
|
|
394
461
|
### pre-commit フックの自動配置
|
|
395
462
|
|
|
396
|
-
MCP
|
|
463
|
+
生成された MCP 設定ファイルに埋め込まれた API キーを誤って git にコミット・pushしてしまう事故を防ぐため、接続情報の保存時(`login` / `deploy` 対話モード)に pre-commit フックをプロジェクトへ自動配置します。
|
|
397
464
|
|
|
398
465
|
- 配置されるファイル:
|
|
399
466
|
- `.githooks/pre-commit` — コミット前チェックスクリプト
|
|
@@ -429,7 +496,8 @@ accel init my-project --juggling-project /path/to/juggling-project
|
|
|
429
496
|
my-project/
|
|
430
497
|
├── .accel/
|
|
431
498
|
│ ├── settings.json # プロジェクト設定
|
|
432
|
-
│
|
|
499
|
+
│ ├── hashsum.txt # 配備資材のハッシュ
|
|
500
|
+
│ └── mcp/ # MCP 設定テンプレート(資材が提供する場合のみ)
|
|
433
501
|
├── .claude/ # agent=claude-code 時
|
|
434
502
|
│ ├── CLAUDE.md
|
|
435
503
|
│ └── skills/
|
|
@@ -443,10 +511,13 @@ my-project/
|
|
|
443
511
|
|
|
444
512
|
- `.accel/settings.json` — プロジェクト設定。git管理対象、手動編集可。資材リポジトリのURL・ref・配備時のコミットSHA(`assetSource`)を記録し、`accel update` / `accel switch` が参照
|
|
445
513
|
- `.accel/hashsum.txt` — 配備ファイルのハッシュ。`update` / `switch` / `detach` 時のユーザー編集検出に使用
|
|
514
|
+
- `.accel/mcp/` — MCP 設定テンプレート(断片)の保持先。資材リポジトリが提供する場合のみ作られる。接続情報を含まないため git 管理対象(詳細は「[MCP 設定の自動生成](#mcp-設定の自動生成)」)
|
|
446
515
|
- `.accel/credentials.json` — iAP接続情報(endpoint / APIキー)。`accel deploy` 初回実行時に生成。APIキーを含むため `.gitignore` 対象(git管理対象外)
|
|
516
|
+
- `.accel/mcp-state.json` — MCP 設定の生成記録(前回生成した管理エントリ名)。ローカル専用のため `.gitignore` 対象(git管理対象外)
|
|
517
|
+
- `.accel/presets/` — 構成プリセット(1プリセット1ファイル)。`accel preset create` で生成。チーム共有のため git 管理対象(詳細は「[`accel preset`](#accel-preset)」)
|
|
447
518
|
- `.githooks/` — APIキーの誤コミットを防ぐ pre-commit フック。`accel login` / `accel deploy` による接続情報の保存時に配置(詳細は「[pre-commit フックの自動配置](#pre-commit-フックの自動配置)」)
|
|
448
519
|
|
|
449
|
-
|
|
520
|
+
`.accel/mcp/` のテンプレートからは、エージェント別の MCP 設定ファイル(`.mcp.json` / `.codex/config.toml` / `.vscode/mcp.json`)が生成されます。iAP 接続用のエントリは `credentials.json` の保存(`accel login` / `accel deploy`)を待って生成されます。詳細は「[MCP 設定の自動生成](#mcp-設定の自動生成)」を参照してください。
|
|
450
521
|
|
|
451
522
|
このほか、資材リポジトリから取得したデータの資材キャッシュがユーザーのホームディレクトリ配下(`~/.accel/cache`。環境変数 `ACCEL_CACHE_DIR` で変更可能)に作られます。プロジェクトディレクトリ内には作られません。詳細は「[`accel cache`](#accel-cache)」を参照してください。
|
|
452
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
|
};
|