feat(admin tenants): add --allowed-origins flag (closes #115)#116
Conversation
…ol (#115) GeonicDB 本体 #1069 で導入された `Tenant.settings.allowedOrigins` を `admin tenants create` / `update` の専用フラグから設定可能にする。 api-keys の --origins と同じカンマ区切り命名規則を踏襲し、空文字列を [] (deny all) として扱う。wildcard / max-50 のバリデーションは本体側 zod に委譲。
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughテナント管理コマンドに Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 3/5 reviews remaining, refill in 17 minutes and 33 seconds. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/commands/admin/tenants.ts`:
- Around line 113-119: The code currently returns {} when json is omitted and
opts.allowedOrigins is provided, which bypasses stdin/TTY parsing; instead, when
json is not provided call parseJsonInput() to populate body (as done elsewhere),
then after obtaining body merge or set the allowedOrigins value from
opts.allowedOrigins into that body object (e.g., body.allowedOrigins =
opts.allowedOrigins or Object.assign), applying the same change for the other
occurrence; reference the body variable, parseJsonInput(), and
opts.allowedOrigins when making this change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d9e07ef7-70b8-4867-9c0a-61c352c1b656
📒 Files selected for processing (4)
CHANGELOG.mdREADME.mdsrc/commands/admin/tenants.tstests/admin-tenants.test.ts
Address CodeRabbit feedback: dropping `body = {}` for the flag-only path
preserves stdin pipe and TTY interactive input. The flag now merges into
whatever body parseJsonInput() returns (inline JSON, @file, stdin, or
interactive prompt).
* release: v0.15.0 * docs(changelog): add #116 reference for v0.15.0 entry
Summary
admin tenants create/admin tenants updateに--allowed-origins <origins>フラグを追加し、テナント単位の CORS origin 制御 (settings.allowedOrigins, geolonia/geonicdb#1069 対応) を専用フラグから設定可能にしたapi-keysの--originsと同じカンマ区切り命名規則を踏襲。空文字列""を[](deny all)として扱う点が api-keys との差分。wildcard / max-50 件のバリデーションは本体側 zod に委譲settings.*他キーは保持してマージ。フラグ単独でも JSON 入力なしで動作Closes #115
CLI surface
""[]— 全 deny"*""https://a,https://b"Changes
src/commands/admin/tenants.ts—applyAllowedOriginsFlag()ヘルパーでbody.settings.allowedOriginsにマージ。create / update に--allowed-originsオプションとaddNotes/addExamplesを追加tests/admin-tenants.test.ts— 7 ケース追加(フラグマージ、wildcard、空文字列、空白 trim、既存 settings 保持、上書き、未指定時の regression guard 等)README.md—admin tenantsセクションに値別挙動表と実用例を追加CHANGELOG.md—[Unreleased]に Feat エントリを追加Test plan
npm run lintnpm run typechecknpm test(733 tests passed, +7 from main)npm run buildSummary by CodeRabbit
新機能
admin tenants create/admin tenants updateに--allowed-originsフラグを追加。テナント単位のCORS許可オリジンをカンマ区切りで指定可能。""で全拒否、"*"で全許可(S2S含む)、カンマ区切りは厳密一致。フラグ未指定時は既存の動作(全オリジン)を維持。JSON入力と併用すると既存のsettingsを保持してallowedOriginsのみ上書き/追加します。ドキュメント