@intra-mart/accel 0.3.0-next.202605250439 → 0.3.0

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.
Files changed (68) hide show
  1. package/README.md +157 -41
  2. package/dist/asset/deployer.js +8 -17
  3. package/dist/asset/foreach-replacement.d.ts +2 -0
  4. package/dist/asset/foreach-replacement.js +20 -0
  5. package/dist/asset/github-provider.d.ts +2 -0
  6. package/dist/asset/github-provider.js +37 -0
  7. package/dist/asset/local-provider.js +1 -22
  8. package/dist/asset/walker.js +4 -15
  9. package/dist/commands/attach.d.ts +13 -1
  10. package/dist/commands/attach.js +33 -12
  11. package/dist/commands/deploy.d.ts +42 -3
  12. package/dist/commands/deploy.js +274 -40
  13. package/dist/commands/init.d.ts +13 -1
  14. package/dist/commands/init.js +33 -12
  15. package/dist/commands/login.d.ts +31 -0
  16. package/dist/commands/login.js +76 -0
  17. package/dist/core/catalog.d.ts +11 -0
  18. package/dist/core/catalog.js +40 -0
  19. package/dist/core/condition-evaluator.js +6 -3
  20. package/dist/core/constants.d.ts +3 -3
  21. package/dist/core/constants.js +6 -11
  22. package/dist/core/eval-context.d.ts +3 -0
  23. package/dist/core/eval-context.js +45 -0
  24. package/dist/core/types.d.ts +61 -12
  25. package/dist/core/types.js +2 -1
  26. package/dist/core/validators.d.ts +7 -2
  27. package/dist/core/validators.js +25 -12
  28. package/dist/core/variable-interpolator.d.ts +1 -1
  29. package/dist/core/variable-interpolator.js +19 -19
  30. package/dist/deploy/api-client.d.ts +5 -2
  31. package/dist/deploy/api-client.js +47 -1
  32. package/dist/deploy/target-selector.d.ts +11 -0
  33. package/dist/deploy/target-selector.js +16 -0
  34. package/dist/i18n/en.js +38 -5
  35. package/dist/i18n/ja.js +38 -5
  36. package/dist/i18n/zh_CN.js +38 -5
  37. package/dist/index.js +2 -0
  38. package/dist/interactive/agent-detect.js +1 -0
  39. package/dist/interactive/credential-auth.d.ts +15 -0
  40. package/dist/interactive/credential-auth.js +61 -0
  41. package/dist/interactive/credentials-prompts.d.ts +3 -1
  42. package/dist/interactive/credentials-prompts.js +50 -7
  43. package/dist/interactive/next-steps.js +3 -0
  44. package/dist/interactive/prompts.d.ts +3 -0
  45. package/dist/interactive/prompts.js +112 -52
  46. package/dist/interactive/summary.js +5 -1
  47. package/dist/juggling/extractor.d.ts +3 -2
  48. package/dist/juggling/extractor.js +9 -9
  49. package/dist/utils/args.d.ts +1 -0
  50. package/dist/utils/args.js +4 -0
  51. package/dist/utils/credentials.d.ts +7 -0
  52. package/dist/utils/credentials.js +21 -0
  53. package/dist/utils/date-formatter.d.ts +1 -0
  54. package/dist/utils/date-formatter.js +23 -0
  55. package/dist/utils/https.d.ts +2 -0
  56. package/dist/utils/https.js +44 -0
  57. package/dist/utils/mcp-sync.d.ts +4 -0
  58. package/dist/utils/mcp-sync.js +97 -0
  59. package/dist/utils/settings-io.d.ts +1 -0
  60. package/dist/utils/settings-io.js +8 -0
  61. package/package.json +6 -5
  62. package/assets/assets.tar.gz +0 -0
  63. package/dist/asset/default-source.d.ts +0 -1
  64. package/dist/asset/default-source.js +0 -6
  65. package/dist/core/module-map.d.ts +0 -3
  66. package/dist/core/module-map.js +0 -7
  67. package/dist/core/version-map.d.ts +0 -7
  68. package/dist/core/version-map.js +0 -45
package/README.md CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  intra-mart Accel Platform (iAP) 開発プロジェクトの作成・管理を行うCLIツール。
4
4
 
5
- コーディングエージェント(Claude Code、GitHub Copilot)向けのスキルファイルやインストラクションなどの資材を、資材リポジトリから取得しプロジェクトに配備します。
5
+ コーディングエージェント(Claude Code、Codex、GitHub Copilot)向けのスキルファイルやインストラクションなどの資材を、資材リポジトリから取得しプロジェクトに配備します。
6
6
 
7
7
  ## 必要環境
8
8
 
9
9
  - 以下のいずれかのパッケージマネージャ(`--package-manager` で選択、デフォルト: Bun)
10
- - [Bun](https://bun.sh/) v1.0+
10
+ - [Bun](https://bun.sh/)
11
11
  - [npm](https://www.npmjs.com/)
12
12
  - [Yarn](https://classic.yarnpkg.com/) (classic v1)
13
13
  - [pnpm](https://pnpm.io/)
@@ -44,8 +44,7 @@ accel init my-project
44
44
  ```bash
45
45
  accel init my-project \
46
46
  --non-interactive \
47
- --accelplatform-version 2026-Spring \
48
- --module workflow \
47
+ --accelplatform-version 2026-spring \
49
48
  --agent claude-code \
50
49
  --locale ja
51
50
  ```
@@ -55,9 +54,10 @@ accel init my-project \
55
54
  | オプション | 型 | 説明 | デフォルト |
56
55
  |---|---|---|---|
57
56
  | `[project-name]` (位置引数) | string | プロジェクト名(ディレクトリ名と一致) | `my-accel-project`(対話で変更可) |
58
- | `--accelplatform-version` | string | iAPバージョン(例: `2026-Spring`) | 対話で選択 |
59
- | `--module` | string | 使用モジュール(カンマ区切り) | 対話で選択 |
60
- | `--agent` | string | エージェント種別(`claude-code`, `github-copilot`、カンマ区切り) | 自動検出 |
57
+ | `--accelplatform-version` | string | iAPバージョン。カタログのリリースID形式(例: `2026-spring`) | 対話で選択 |
58
+ | `--module` | string | 使用モジュール。カタログの `artifactId`(カンマ区切り。例: `im_workflow,im_activiti`) | 選択リリースの全モジュール(`--juggling-project` 指定時は Juggling から抽出したモジュール) |
59
+ | `--feature` | string | 使用機能。カタログの機能ID(カンマ区切り。例: `jssp,e2e`) | 選択リリースの全機能 |
60
+ | `--agent` | string | エージェント種別(`claude-code`, `codex`, `github-copilot`、カンマ区切り) | 自動検出 |
61
61
  | `--locale` | string | ロケール(`ja`, `en`, `zh_CN`) | OS設定から自動検出 |
62
62
  | `--artifact-id` | string | アーティファクトID(pomの `artifactId` に相当) | プロジェクト名と同値 |
63
63
  | `--group` | string | グループ名(pomの `groupId` に相当) | `com.example` |
@@ -70,8 +70,8 @@ accel init my-project \
70
70
  | `--non-interactive` | boolean | 非対話モード(このモードでは `project-name` が必須) | `false` |
71
71
  | `--no-git-init` | boolean | git initをスキップ | `false`(git initする) |
72
72
  | `--skip-install` | boolean | 依存インストールをスキップ | `false` |
73
- | `--asset-source` | string | ローカル資材のパス(tarアーカイブまたは展開済みディレクトリ) | パッケージ同梱の `assets/assets.tar.gz` |
74
- | `--asset-server-url` | string | 資材サーバーURL。明示指定時は `--asset-source` より優先される | - |
73
+ | `--asset-server-url` | string | 資材を取得するGitHubリポジトリのURL(デフォルトProviderの取得先を上書き) | `https://github.com/accelplatform/skills` |
74
+ | `--asset-ref` | string | GitHubから取得するブランチ/タグ/コミット | `2026-07-01-release` |
75
75
 
76
76
  ### `accel attach`
77
77
 
@@ -79,7 +79,7 @@ accel init my-project \
79
79
 
80
80
  ```bash
81
81
  cd my-existing-project
82
- accel attach --non-interactive --accelplatform-version 2026-Spring --module workflow
82
+ accel attach --non-interactive --accelplatform-version 2026-spring
83
83
  ```
84
84
 
85
85
  `init` との違い:
@@ -87,17 +87,18 @@ accel attach --non-interactive --accelplatform-version 2026-Spring --module work
87
87
  - git initは行わない
88
88
  - プロジェクト名のデフォルトはカレントディレクトリ名
89
89
  - **既存ファイルがある配備先はファイル単位で上書き確認**を行う。対話モードでは1ファイルごとに「Yes / No / All (以降全て上書き) / Skip-all (以降全てスキップ)」を選択。`--overwrite` 指定時は確認なしで全て上書き。非対話モードかつ `--overwrite` 未指定の場合は全てスキップ
90
- - 上書きされたファイルは `hashsum.txt` および `deployedAssets` に記録される(`detach` の対象になる)
91
- - スキップされたファイルは記録されない(`detach` の対象外)
90
+ - 上書きされたファイルは配備記録に追加され、`detach` の対象になる
91
+ - スキップされたファイルは配備記録に追加されず、`detach` の対象外
92
92
 
93
93
  #### オプション一覧
94
94
 
95
95
  | オプション | 型 | 説明 | デフォルト |
96
96
  |---|---|---|---|
97
97
  | `--name` | string | プロジェクト名 | カレントディレクトリ名 |
98
- | `--accelplatform-version` | string | iAPバージョン(例: `2026-Spring`) | 対話で選択 |
99
- | `--module` | string | 使用モジュール(カンマ区切り) | 対話で選択 |
100
- | `--agent` | string | エージェント種別(`claude-code`, `github-copilot`、カンマ区切り) | 自動検出 |
98
+ | `--accelplatform-version` | string | iAPバージョン。カタログのリリースID形式(例: `2026-spring`) | 対話で選択 |
99
+ | `--module` | string | 使用モジュール。カタログの `artifactId`(カンマ区切り。例: `im_workflow,im_activiti`) | 選択リリースの全モジュール(`--juggling-project` 指定時は Juggling から抽出したモジュール) |
100
+ | `--feature` | string | 使用機能。カタログの機能ID(カンマ区切り。例: `jssp,e2e`) | 選択リリースの全機能 |
101
+ | `--agent` | string | エージェント種別(`claude-code`, `codex`, `github-copilot`、カンマ区切り) | 自動検出 |
101
102
  | `--locale` | string | ロケール(`ja`, `en`, `zh_CN`) | OS設定から自動検出 |
102
103
  | `--artifact-id` | string | アーティファクトID(pomの `artifactId` に相当) | プロジェクト名と同値 |
103
104
  | `--group` | string | グループ名(pomの `groupId` に相当) | `com.example` |
@@ -110,8 +111,8 @@ accel attach --non-interactive --accelplatform-version 2026-Spring --module work
110
111
  | `--overwrite` | boolean | 既存ファイルの上書き確認を行わず、全て上書きする | `false`(対話で確認 / 非対話ではスキップ) |
111
112
  | `--non-interactive` | boolean | 非対話モード | `false` |
112
113
  | `--skip-install` | boolean | 依存インストールをスキップ | `false` |
113
- | `--asset-source` | string | ローカル資材のパス(tarアーカイブまたは展開済みディレクトリ) | パッケージ同梱の `assets/assets.tar.gz` |
114
- | `--asset-server-url` | string | 資材サーバーURL。明示指定時は `--asset-source` より優先される | - |
114
+ | `--asset-server-url` | string | 資材を取得するGitHubリポジトリのURL(デフォルトProviderの取得先を上書き) | `https://github.com/accelplatform/skills` |
115
+ | `--asset-ref` | string | GitHubから取得するブランチ/タグ/コミット | `2026-07-01-release` |
115
116
 
116
117
  ### `accel detach`
117
118
 
@@ -126,9 +127,49 @@ accel detach
126
127
  - ユーザーが編集したファイルはスキップ(警告表示)
127
128
  - `.accel/` ディレクトリを削除
128
129
 
130
+ ### `accel login`
131
+
132
+ iAP の接続情報(エンドポイントURL・APIキー)を入力し、`.accel/credentials.json` に保存します。`accel deploy` を実行する前に、コマンドラインから直接接続情報を設定しておけます。
133
+
134
+ ```bash
135
+ cd my-project
136
+ accel login
137
+ ```
138
+
139
+ - `endpoint`(テキスト入力)と `apiKey`(マスク入力)を対話で入力します。
140
+ - 入力したトークンの有効性を iAP に問い合わせて確認します。検証に失敗(401 など)した場合や接続エラーの場合は、その場で再入力を促します。
141
+ - 検証に成功した時点で `.accel/credentials.json` に保存します。**APIキーはシークレットのため、ファイルは自動的に `.gitignore` に追加されます**(コミット対象外)。
142
+ - `.accel/credentials.json` の保存に成功すると、プロジェクト内の MCP 設定ファイルに対しても API キーを自動反映します(詳細は後述「[MCP 設定の自動同期](#mcp-設定の自動同期)」)。
143
+
144
+ #### 非対話モード
145
+
146
+ CIでの利用を想定し、プロンプトを出さずに接続情報を検証・保存するモードです。
147
+
148
+ ```bash
149
+ ACCEL_API_KEY=*** accel login \
150
+ --non-interactive \
151
+ --endpoint https://example.com/imart
152
+ ```
153
+
154
+ - `endpoint` / `apiKey` は **フラグ > 環境変数 > `.accel/credentials.json`** の優先順位で解決します。
155
+ - `endpoint`: `--endpoint` / `ACCEL_ENDPOINT`
156
+ - `apiKey`: `--api-key` / `ACCEL_API_KEY`
157
+ - **APIキーはシークレット情報のため、CI では `ACCEL_API_KEY` 環境変数での指定を推奨します**(`--api-key` はプロセス一覧やCIログに漏れ得ます)。
158
+ - トークン検証は1回だけ実行します。**失敗時は再入力せず、エラーメッセージを表示して非0終了します**。
159
+ - 検証成功時に `.accel/credentials.json` へ保存します(対話モードと同様、`.gitignore` に自動追記)。
160
+ - `endpoint` / `apiKey` のいずれかが解決できない場合はエラー終了します。
161
+
162
+ #### オプション一覧
163
+
164
+ | オプション | 型 | 説明 | デフォルト |
165
+ |---|---|---|---|
166
+ | `--endpoint` | string | iAPのベースURL(環境変数 `ACCEL_ENDPOINT` でも指定可) | 保存値 / 対話で入力 |
167
+ | `--api-key` | string | OAuth Bearerトークン(**環境変数 `ACCEL_API_KEY` 推奨**) | 保存値 / 対話で入力 |
168
+ | `--non-interactive` | boolean | 非対話モード(プロンプトを出さず、検証失敗時は非0終了) | `false` |
169
+
129
170
  ### `accel deploy`
130
171
 
131
- ビルド成果物(`./target/` 配下の zip)を iAP のステージング環境へデプロイします。**対話モードのみ**対応です。
172
+ ビルド成果物(`./target/` 配下の zip)を iAP のステージング環境へデプロイします。対話モードに加え、CIでの利用を想定した非対話モード(`--non-interactive`)に対応します。
132
173
 
133
174
  ```bash
134
175
  cd my-project
@@ -136,11 +177,57 @@ accel deploy
136
177
  ```
137
178
 
138
179
  - プロジェクトのルートで実行します。ビルド成果物は `./target/` 配下に出力されている前提です(`mvn package` で生成される `<artifactId>-<version>.zip`)。
139
- - 初回実行時に iAP の接続情報(エンドポイントURL・APIキー)の入力を求めます。入力値は `.accel/credentials.json` に保存され、次回以降は再入力不要です。
140
- - **APIキーは秘匿情報のため、`.accel/credentials.json` は自動的に `.gitignore` に追加されます**(コミット対象外)。
180
+ - 初回実行時に iAP の接続情報(エンドポイントURL・APIキー)の入力を求めます。入力値は `.accel/credentials.json` に保存され、保存値で接続できる限り次回以降は再入力不要です。事前に `accel login`(前述)で設定しておくこともできます。
181
+ - **APIキーはシークレット情報のため、`.accel/credentials.json` は自動的に `.gitignore` に追加されます**(コミット対象外)。
182
+ - デプロイ実行前に、接続情報の有効性を iAP に問い合わせて確認します。保存済みのエンドポイント/APIキーが誤っていて**接続エラーや認証エラー(401 など)になった場合は、その場で再入力を促し、接続できるまでリトライします**。中断したい場合は ESC / Ctrl+C で抜けられます。
183
+ - `.accel/credentials.json` に値を保存/更新したタイミングで、プロジェクト内の MCP 設定ファイルにも API キーを自動反映します(詳細は後述「[MCP 設定の自動同期](#mcp-設定の自動同期)」)。非対話モードでは `credentials.json` を保存しないため MCP 同期も発生しません。
141
184
  - 既存のステージング環境を一覧から選択します(ステージングは iAP 側で事前に作成しておく必要があります)。
142
- - `./target/` 配下の zip が複数ある場合は選択し、単一の場合は自動選択します。いずれの場合もデプロイ実行前に最終確認を行います。
143
- - 送信時、zip は imm 形式としてアップロードされます(送信時のファイル名のみ `.imm` に変更され、ディスク上のファイルはそのままです)。
185
+ - デプロイ対象の zip は、`.accel/settings.json` の `artifactId` と `projectVersion` から `<artifactId>-<projectVersion>.zip` を `./target/` 配下で特定し、見つかれば自動選択します。見つからない場合は `./target/` 配下の zip を一覧から選択します(単一なら自動選択)。
186
+ - いずれの場合もデプロイ実行前に最終確認を行います。
187
+ - デプロイ成功後、ステージング詳細画面への自動ログイン付きURL(有効期限60分)が iAP から返ってきた場合は、結果と共に表示します。
188
+ - デプロイ成功後、iAP からテナント環境セットアップ設定が返ってきた場合は、対話的にテナント環境セットアップの実行を提案します:
189
+ 1. セットアップ設定の情報を表示
190
+ 2. 「テナント環境セットアップを実行しますか?」を確認(No → スキップ)
191
+ 3. 「全て実行しますか?」を確認
192
+ - Yes → 全設定ファイルを一括実行
193
+ - No → 実行する設定ファイルを複数選択し、順次実行
194
+ 4. 実行結果を一覧表示
195
+ - **注意**: セットアップの実行はステージング分離されず、実テナントのデータベースに反映されます
196
+ - セットアップの成否はデプロイの終了コードに影響しません(デプロイ成功 = 正常終了)
197
+
198
+ #### 非対話モード
199
+
200
+ CIでの利用を想定し、プロンプトを一切出さずにデプロイを実行するモードです。
201
+
202
+ ```bash
203
+ ACCEL_API_KEY=*** accel deploy \
204
+ --non-interactive \
205
+ --endpoint https://example.com/imart \
206
+ --staging-id my-staging \
207
+ --file ./target/my-app-1.0.0.zip \
208
+ --description "CI deploy"
209
+ ```
210
+
211
+ - **接続情報**は login と同じく **フラグ > 環境変数(`ACCEL_ENDPOINT` / `ACCEL_API_KEY`)> `.accel/credentials.json`** の優先順位で解決します(APIキーは `ACCEL_API_KEY` 環境変数での指定を推奨)。
212
+ - デプロイ前にトークン検証を1回だけ実行します。**失敗時は再入力せず、エラーメッセージを表示して非0終了します**。
213
+ - `--staging-id` は**必須**です(一覧選択は行いません。未指定はエラー終了。存在しないステージングはデプロイ時の 404 として表面化します)。
214
+ - デプロイ対象 zip:
215
+ - `--file` を指定した場合はそのパス(`./target/` 配下に限定しません)を使います。ファイルが存在しなければエラー終了します。
216
+ - `--file` 未指定の場合は対話モードと同じ自動特定(`<artifactId>-<projectVersion>.zip` 完全一致)を試みます。**自動特定できない場合**(settings 無し/完全一致無し/複数候補)は `--file` 指定が必要な旨を表示してエラー終了します。`./target/` に zip が 1 件も無い場合は、ビルド未実行の旨(`mvn package` 等の実行を促す)を表示してエラー終了します。
217
+ - `--description` は任意です。最終確認プロンプトは出さず、即デプロイします。
218
+ - **テナント環境セットアップは実行しません**(対話が必要なため)。自動ログイン付きURLはデプロイ結果に含めて表示します。
219
+ - フラグ/環境変数で渡した接続情報は **`.accel/credentials.json` に保存しません**(CIランナーにシークレット情報を残さないため)。
220
+
221
+ #### オプション一覧
222
+
223
+ | オプション | 型 | 説明 | デフォルト |
224
+ |---|---|---|---|
225
+ | `--endpoint` | string | iAPのベースURL(環境変数 `ACCEL_ENDPOINT` でも指定可) | 保存値 / 対話で入力 |
226
+ | `--api-key` | string | OAuth Bearerトークン(**環境変数 `ACCEL_API_KEY` 推奨**) | 保存値 / 対話で入力 |
227
+ | `--staging-id` | string | デプロイ先ステージングID(**非対話モードでは必須**) | 対話で一覧選択 |
228
+ | `--file` | string | デプロイする zip のパス(`./target/` 配下に限定しない) | 自動特定 / 対話で選択 |
229
+ | `--description` | string | デプロイメントの説明 | `""` |
230
+ | `--non-interactive` | boolean | 非対話モード(プロンプトを出さず、失敗時は非0終了) | `false` |
144
231
 
145
232
  #### 接続情報ファイル `.accel/credentials.json`
146
233
 
@@ -151,7 +238,40 @@ accel deploy
151
238
  }
152
239
  ```
153
240
 
154
- `endpoint` には iAP のベースURL を指定します。API パス(`/api/bearer/development/...`)は CLI が組み立てます。
241
+ `endpoint` には iAP のベースURL を指定します。
242
+
243
+ ### MCP 設定の自動同期
244
+
245
+ `.accel/credentials.json` の保存に成功した直後、プロジェクト内のコーディングエージェント用 MCP 設定ファイルに対し iAP の API キーを `Authorization: Bearer <apiKey>` として自動反映します。
246
+
247
+ - 対象は `.accel/settings.json` の `agents` に含まれるエージェントのファイルだけです。
248
+ - **既存の MCP サーバーエントリのヘッダ値のみを更新**し、新規エントリの追加やファイル自体の新規作成は行いません(MCP 設定そのものは資材リポジトリ側で配備される前提)。
249
+
250
+ | エージェント | 対象ファイル | 更新箇所 |
251
+ |---|---|---|
252
+ | `claude-code` | `.mcp.json`(プロジェクトルート) | `mcpServers.<name>.headers.Authorization` |
253
+ | `codex` | `.codex/config.toml`(プロジェクトルート配下) | `[mcp_servers.<name>]` の `http_headers.Authorization`(`env_http_headers` 設定済みのエントリはスキップ) |
254
+ | `github-copilot` | `.vscode/mcp.json` | `servers.<name>.headers.Authorization` |
255
+
256
+ #### マッチング規則
257
+
258
+ 各設定ファイル内で以下を全て満たす MCP サーバーエントリだけが更新対象になります:
259
+
260
+ - `type` が `"http"` である(Codex は TOML 形式上 `type` を持たないため、`url` キーが http(s) で始まることで判定)
261
+ - `url` が `credentials.json` の `endpoint` を**前方一致**で含む(例: `endpoint=https://example.com/imart` → `url=https://example.com/imart/im_logic` など)
262
+
263
+ 該当エントリの `Authorization` キーのみが上書きされます。同じヘッダテーブル内の他のキーは保持されます。
264
+
265
+ #### 発動タイミング
266
+
267
+ - `accel login`(対話・非対話の両方、検証成功時)
268
+ - `accel deploy`(対話モードでの初回入力時/再入力ループの成功時)
269
+ - `accel deploy`(**非対話モード**)は `credentials.json` を保存しないため、MCP 同期も発生しません
270
+
271
+ #### エラー・ログ方針
272
+
273
+ - MCP 同期は best-effort で、いずれの段階で失敗してもコマンド自体の成否には影響しません。
274
+ - 対象ファイル/対象エントリが無い場合や処理に失敗した場合も**ログは表示しません**。
155
275
 
156
276
  ## IM-Juggling連携
157
277
 
@@ -161,6 +281,12 @@ accel deploy
161
281
  accel init my-project --juggling-project /path/to/juggling-project
162
282
  ```
163
283
 
284
+ - iAPバージョンは `juggling.im` のベースバージョンを `@intra-mart/catalog` のリリースと突合して解決します
285
+ - モジュールは選択済みモジュールのIDをカタログのモジュールID(`jp.co.intra_mart.im_workflow` 等)と突合し、一致したものを `artifactId`(`im_workflow` 等)として採用します
286
+ - モジュール自体のバージョンは突合しません(パッチ適用により `8.0.39-PATCH_001` のようにずれることがあるため)
287
+ - カタログに存在しないモジュールは無視されます
288
+ - 機能(`--feature`)は `juggling.im` から検出できないため自動設定されません
289
+
164
290
  ## プロジェクト構造
165
291
 
166
292
  `accel init` 実行後に生成されるディレクトリ構造:
@@ -169,10 +295,12 @@ accel init my-project --juggling-project /path/to/juggling-project
169
295
  my-project/
170
296
  ├── .accel/
171
297
  │ ├── settings.json # プロジェクト設定
172
- │ └── hashsum.txt # 配備資材のSHA-1ハッシュ
298
+ │ └── hashsum.txt # 配備資材のハッシュ
173
299
  ├── .claude/ # agent=claude-code 時
174
300
  │ ├── CLAUDE.md
175
301
  │ └── skills/
302
+ ├── .codex/ # agent=codex 時
303
+ │ └── AGENTS.md
176
304
  ├── .github/ # agent=github-copilot 時
177
305
  │ ├── copilot-instructions.md
178
306
  │ └── AGENTS.md
@@ -180,25 +308,13 @@ my-project/
180
308
  ```
181
309
 
182
310
  - `.accel/settings.json` — プロジェクト設定。git管理対象、手動編集可
183
- - `.accel/hashsum.txt` — 配備ファイルのSHA-1。`detach` 時の変更検出に使用
311
+ - `.accel/hashsum.txt` — 配備ファイルのハッシュ。`detach` 時の変更検出に使用
184
312
  - `.accel/credentials.json` — iAP接続情報(endpoint / APIキー)。`accel deploy` 初回実行時に生成。APIキーを含むため `.gitignore` 対象(git管理対象外)
185
313
 
186
- ## 対応iAPバージョン
187
-
188
- 2024-Spring (8.0.35) 以降の iAP バージョンを選択可能です。
314
+ `credentials.json` の保存/更新時には、エージェント別の MCP 設定ファイル(`.mcp.json` / `.codex/config.toml` / `.vscode/mcp.json` のうち、存在し、かつ `agents` に含まれるエージェントのもの)に対しても API キーが反映されます。詳細は「[MCP 設定の自動同期](#mcp-設定の自動同期)」を参照してください。
189
315
 
190
- ## 入力値のバリデーション
316
+ ## 対応iAPバージョン
191
317
 
192
- CLIに渡された値および対話で入力された値は、以下のルールでバリデーションされます。違反する値は対話モードでは再入力を促し、非対話モードではエラーメッセージを表示して終了します。
318
+ 選択可能なiAPバージョン・モジュール・機能は、同梱のマスタデータパッケージ `@intra-mart/catalog` のカタログに基づきます(2025 Spring / 8.0.37 以降)。バージョンは `2026-spring` のようなリリースID形式で指定します。新しいリリースへの対応はカタログの更新によって行われます。
193
319
 
194
- | オプション | ルール |
195
- |-----------|------|
196
- | `[project-name]` / `--name` | 空文字不可。ディレクトリ名として不正な文字を含まない(`/ \ : * ? " < > \|`、制御文字、先頭末尾の空白/ドット) |
197
- | `--artifact-id` | Maven artifactId 規約: `^[A-Za-z0-9][A-Za-z0-9._-]*$` |
198
- | `--group` | Maven groupId 規約: ドット区切りの識別子 `^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*)*$` |
199
- | `--project-version` | Maven version 規約: `^[A-Za-z0-9][A-Za-z0-9._-]*$` |
200
- | `--accelplatform-version` | 対応iAPバージョン一覧(`2024-Spring` 以降)に含まれる値 |
201
- | `--module` | `workflow`, `bpm`, `copilot`, `imbox`, `pdfd`, `kaiden` のいずれか(各要素) |
202
- | `--database` | `postgresql`, `oracle`, `sqlserver` のいずれか |
203
- | `--agent` | `claude-code`, `github-copilot` のいずれか(各要素) |
204
- | `--package-manager` | `bun`, `npm`, `yarn`, `pnpm` のいずれか |
320
+ CLIに渡された値および対話で入力された値はバリデーションされます。違反する値は対話モードでは再入力を促し、非対話モードではエラーメッセージを表示して終了します。`--artifact-id` / `--group` / `--project-version` は Maven の命名規約に従う必要があります。
@@ -1,9 +1,10 @@
1
1
  import { readFile, writeFile, mkdir, stat } from "node:fs/promises";
2
2
  import { join, dirname, resolve, sep } from "node:path";
3
- import { labelToSemver } from "../core/version-map.js";
3
+ import { buildEvalContext } from "../core/eval-context.js";
4
4
  import { walkAssetRepo } from "./walker.js";
5
5
  import { processMarkdown } from "../markdown/processor.js";
6
6
  import { applyRegexReplacements } from "./regex-replacement.js";
7
+ import { applyForeachReplacements } from "./foreach-replacement.js";
7
8
  import { computeSha1 } from "../utils/hash.js";
8
9
  import { writeSettings, writeHashsum } from "../utils/settings-io.js";
9
10
  import { execSync } from "node:child_process";
@@ -57,22 +58,8 @@ export const deployAssets = async (options) => {
57
58
  try {
58
59
  progress?.onFetchStart?.();
59
60
  const repoDir = await provider.fetch();
60
- const semver = labelToSemver(settings.accelplatformVersion);
61
- const context = {
62
- version: semver,
63
- modules: settings.modules,
64
- locale: settings.locale,
65
- agents: settings.agents,
66
- name: settings.name,
67
- artifactId: settings.artifactId,
68
- group: settings.group,
69
- description: settings.description,
70
- accelplatformVersion: settings.accelplatformVersion,
71
- database: settings.database,
72
- projectVersion: settings.projectVersion,
73
- packageManager: settings.packageManager,
74
- javascript: settings.javascript,
75
- };
61
+ const semver = settings.accelplatformVersion.semver;
62
+ const context = buildEvalContext(settings);
76
63
  const entries = await walkAssetRepo(repoDir, semver, context);
77
64
  const deployedFiles = [];
78
65
  const hashEntries = [];
@@ -119,6 +106,10 @@ export const deployAssets = async (options) => {
119
106
  let content = await readFile(entry.sourcePath, "utf-8");
120
107
  const replacements = collectReplacements(entry);
121
108
  if (replacements.length > 0) {
109
+ const foreachReplacements = replacements.filter((r) => r.type === "foreach");
110
+ if (foreachReplacements.length > 0) {
111
+ content = applyForeachReplacements(content, foreachReplacements, context);
112
+ }
122
113
  if (targetPath.endsWith(".md")) {
123
114
  content = processMarkdown(content, replacements, context);
124
115
  }
@@ -0,0 +1,2 @@
1
+ import type { EvalContext, ForeachReplacement } from "../core/types.js";
2
+ export declare const applyForeachReplacements: (content: string, replacements: ForeachReplacement[], context: EvalContext) => string;
@@ -0,0 +1,20 @@
1
+ import { evaluateCondition } from "../core/condition-evaluator.js";
2
+ import { interpolateVariables } from "../core/variable-interpolator.js";
3
+ const DEFAULT_SEPARATOR = "\n";
4
+ const itemVariables = (item) => new Map(Object.entries(item).map(([key, value]) => [`item.${key}`, value]));
5
+ export const applyForeachReplacements = (content, replacements, context) => {
6
+ let result = content;
7
+ for (const replacement of replacements) {
8
+ if (!evaluateCondition(replacement.condition, context)) {
9
+ continue;
10
+ }
11
+ const items = replacement.items === "modules"
12
+ ? context.moduleItems
13
+ : context.featureItems;
14
+ const expanded = items
15
+ .map((item) => interpolateVariables(replacement.template, context, itemVariables(item)))
16
+ .join(replacement.separator ?? DEFAULT_SEPARATOR);
17
+ result = result.split(replacement.target).join(expanded);
18
+ }
19
+ return result;
20
+ };
@@ -0,0 +1,2 @@
1
+ import type { AssetProvider } from "../core/types.js";
2
+ export declare const createGitHubAssetProvider: (repoUrl: string, ref: string) => AssetProvider;
@@ -0,0 +1,37 @@
1
+ import { join } from "node:path";
2
+ import { mkdir, rm, readdir } from "node:fs/promises";
3
+ import { extractTarGz, createTempDir } from "../utils/archive.js";
4
+ import { downloadFile } from "../utils/https.js";
5
+ export const createGitHubAssetProvider = (repoUrl, ref) => {
6
+ let tmpDir = null;
7
+ return {
8
+ fetch: async () => {
9
+ tmpDir = await createTempDir("accel-assets-");
10
+ const archivePath = join(tmpDir, "assets.tar.gz");
11
+ const extractDir = join(tmpDir, "repo");
12
+ await mkdir(extractDir, { recursive: true });
13
+ const base = repoUrl.replace(/\/+$/, "");
14
+ const archiveUrl = `${base}/archive/${ref}.tar.gz`;
15
+ try {
16
+ await downloadFile(archiveUrl, archivePath);
17
+ }
18
+ catch (err) {
19
+ const reason = err instanceof Error ? err.message : String(err);
20
+ throw new Error(`Failed to fetch the asset repository from ${archiveUrl}. Check the URL and ref: ${reason}`);
21
+ }
22
+ await extractTarGz(archivePath, extractDir);
23
+ const entries = await readdir(extractDir, { withFileTypes: true });
24
+ const dirs = entries.filter((e) => e.isDirectory());
25
+ if (dirs.length !== 1) {
26
+ throw new Error(`Unexpected tarball structure (top-level directory count: ${dirs.length}).`);
27
+ }
28
+ return join(extractDir, dirs[0].name);
29
+ },
30
+ cleanup: async () => {
31
+ if (tmpDir) {
32
+ await rm(tmpDir, { recursive: true, force: true }).catch(() => { });
33
+ tmpDir = null;
34
+ }
35
+ },
36
+ };
37
+ };
@@ -1,28 +1,7 @@
1
- import { get } from "node:http";
2
- import { createWriteStream } from "node:fs";
3
1
  import { join } from "node:path";
4
2
  import { mkdir, rm } from "node:fs/promises";
5
3
  import { extractTarGz, createTempDir } from "../utils/archive.js";
6
- const downloadFile = (url, destPath) => {
7
- return new Promise((resolve, reject) => {
8
- const file = createWriteStream(destPath);
9
- get(url, (response) => {
10
- if (response.statusCode !== 200) {
11
- file.close();
12
- reject(new Error(`HTTP ${response.statusCode} when downloading from ${url}`));
13
- return;
14
- }
15
- response.pipe(file);
16
- file.on("finish", () => {
17
- file.close();
18
- resolve();
19
- });
20
- }).on("error", (err) => {
21
- file.close();
22
- reject(err);
23
- });
24
- });
25
- };
4
+ import { downloadFile } from "../utils/https.js";
26
5
  export const createLocalAssetProvider = (serverUrl) => {
27
6
  let tmpDir = null;
28
7
  return {
@@ -1,6 +1,7 @@
1
1
  import { readdir, readFile } from "node:fs/promises";
2
2
  import { join, relative, dirname, sep } from "node:path";
3
3
  import { evaluateCondition } from "../core/condition-evaluator.js";
4
+ import { emptyEvalContext } from "../core/eval-context.js";
4
5
  const toPosixPath = (p) => sep === "/" ? p : p.split(sep).join("/");
5
6
  const META_FILE = "_meta.json";
6
7
  const readMetaJson = async (dir) => {
@@ -41,21 +42,9 @@ const findMatchingVersionDirs = async (repoDir, targetSemver) => {
41
42
  continue;
42
43
  }
43
44
  if (meta.conditions) {
44
- const context = {
45
- version: targetSemver,
46
- modules: [],
47
- locale: "",
48
- agents: [],
49
- name: "",
50
- artifactId: "",
51
- group: "",
52
- description: "",
53
- accelplatformVersion: "",
54
- database: "",
55
- projectVersion: "",
56
- packageManager: "",
57
- javascript: false,
58
- };
45
+ const context = emptyEvalContext({
46
+ accelplatformVersion: { label: "", semver: targetSemver },
47
+ });
59
48
  if (evaluateCondition(meta.conditions, context)) {
60
49
  matched.push(dirPath);
61
50
  }
@@ -11,6 +11,10 @@ export declare const attachCommand: import("citty").CommandDef<{
11
11
  type: "string";
12
12
  description: string;
13
13
  };
14
+ feature: {
15
+ type: "string";
16
+ description: string;
17
+ };
14
18
  name: {
15
19
  type: "string";
16
20
  description: string;
@@ -66,11 +70,19 @@ export declare const attachCommand: import("citty").CommandDef<{
66
70
  description: string;
67
71
  default: false;
68
72
  };
73
+ "asset-server-url": {
74
+ type: "string";
75
+ description: string;
76
+ };
77
+ "asset-ref": {
78
+ type: "string";
79
+ description: string;
80
+ };
69
81
  "asset-source": {
70
82
  type: "string";
71
83
  description: string;
72
84
  };
73
- "asset-server-url": {
85
+ "debug-server-url": {
74
86
  type: "string";
75
87
  description: string;
76
88
  };
@@ -2,12 +2,12 @@ import { defineCommand } from "citty";
2
2
  import * as p from "@clack/prompts";
3
3
  import { stat } from "node:fs/promises";
4
4
  import { basename, join } from "node:path";
5
- import { CLI_VERSION } from "../core/constants.js";
5
+ import { CLI_VERSION, DEFAULT_ASSET_REPO_URL, DEFAULT_ASSET_REF, } from "../core/constants.js";
6
6
  import { runPrompts } from "../interactive/prompts.js";
7
7
  import { deployAssets, } from "../asset/deployer.js";
8
8
  import { createLocalAssetProvider } from "../asset/local-provider.js";
9
9
  import { createFileAssetProvider } from "../asset/file-provider.js";
10
- import { defaultAssetSourcePath } from "../asset/default-source.js";
10
+ import { createGitHubAssetProvider } from "../asset/github-provider.js";
11
11
  import { getMessage } from "../i18n/index.js";
12
12
  import { detectLocale } from "../utils/locale-detect.js";
13
13
  import { printSummary } from "../interactive/summary.js";
@@ -25,11 +25,15 @@ export const attachCommand = defineCommand({
25
25
  },
26
26
  "accelplatform-version": {
27
27
  type: "string",
28
- description: "iAP version (e.g., 2026-Spring)",
28
+ description: "iAP version (e.g., 2026-spring)",
29
29
  },
30
30
  module: {
31
31
  type: "string",
32
- description: "Modules to use (comma-separated)",
32
+ description: "Modules to use (comma-separated artifactIds, e.g., im_workflow)",
33
+ },
34
+ feature: {
35
+ type: "string",
36
+ description: "Features to use (comma-separated function ids, e.g., jssp)",
33
37
  },
34
38
  name: {
35
39
  type: "string",
@@ -86,13 +90,21 @@ export const attachCommand = defineCommand({
86
90
  description: "Non-interactive mode",
87
91
  default: false,
88
92
  },
93
+ "asset-server-url": {
94
+ type: "string",
95
+ description: "GitHub repository URL to fetch assets from (overrides the default repository)",
96
+ },
97
+ "asset-ref": {
98
+ type: "string",
99
+ description: "Git ref (branch/tag/commit) to fetch from the GitHub asset repository. Default: master",
100
+ },
89
101
  "asset-source": {
90
102
  type: "string",
91
- description: "Local asset source path (tar archive or extracted directory). Defaults to the bundled assets/assets.tar.gz.",
103
+ description: "(debug) Local asset source path (tar archive or extracted directory)",
92
104
  },
93
- "asset-server-url": {
105
+ "debug-server-url": {
94
106
  type: "string",
95
- description: "Asset server URL (takes precedence over --asset-source when explicitly set)",
107
+ description: "(debug) Local asset server URL serving GET /archive",
96
108
  },
97
109
  },
98
110
  run: async ({ args }) => {
@@ -109,6 +121,10 @@ export const attachCommand = defineCommand({
109
121
  const modules = moduleArg
110
122
  ? moduleArg.split(",").map((m) => m.trim())
111
123
  : undefined;
124
+ const featureArg = args.feature;
125
+ const features = featureArg
126
+ ? featureArg.split(",").map((f) => f.trim())
127
+ : undefined;
112
128
  const agentArg = args.agent;
113
129
  const promptOpts = {
114
130
  name: args.name ?? basename(projectDir),
@@ -116,6 +132,7 @@ export const attachCommand = defineCommand({
116
132
  jugglingProject: args["juggling-project"],
117
133
  accelplatformVersion: args["accelplatform-version"],
118
134
  module: modules,
135
+ feature: features,
119
136
  group: args.group,
120
137
  projectVersion: args["project-version"],
121
138
  description: args.description,
@@ -147,6 +164,7 @@ export const attachCommand = defineCommand({
147
164
  description: resolved.description,
148
165
  accelplatformVersion: resolved.accelplatformVersion,
149
166
  modules: resolved.modules,
167
+ features: resolved.features,
150
168
  database: resolved.database,
151
169
  agents: resolved.agents,
152
170
  javascript: resolved.javascript,
@@ -155,11 +173,14 @@ export const attachCommand = defineCommand({
155
173
  jugglingProject: resolved.jugglingProject,
156
174
  deployedAssets: {},
157
175
  };
158
- const serverUrl = args["asset-server-url"];
159
- const assetSource = args["asset-source"] ?? defaultAssetSourcePath();
160
- const provider = serverUrl
161
- ? createLocalAssetProvider(serverUrl)
162
- : createFileAssetProvider(assetSource);
176
+ const assetSource = args["asset-source"];
177
+ const debugServerUrl = args["debug-server-url"];
178
+ const provider = assetSource
179
+ ? createFileAssetProvider(assetSource)
180
+ : debugServerUrl
181
+ ? createLocalAssetProvider(debugServerUrl)
182
+ : createGitHubAssetProvider(args["asset-server-url"] ??
183
+ DEFAULT_ASSET_REPO_URL, args["asset-ref"] ?? DEFAULT_ASSET_REF);
163
184
  const isInteractive = !args["non-interactive"];
164
185
  const overwriteFlag = args.overwrite;
165
186
  if (isInteractive) {