feat(cli): add allowlisted raw API command - #296
Merged
Conversation
Add a fail-closed tq api command with strict route validation, repeatable query and header options, request body input, raw response forwarding, and status-based exit codes. Include CLI tests and synchronized English and Japanese API and command references.
Assert the complete method and route-template allowlist, and add CLI coverage for empty 204 responses, request timeouts, and connection failures.
Keep the production timeout at ten seconds while allowing CLI transport tests to inject a shorter timeout without mutating the client after construction.
Keep the production HTTP client timeout fixed at ten seconds and exercise shorter request deadlines through the command context instead of a mutable package global.
Separate API design responsibilities from CLI reference details, fill missing commands and states, reduce duplication and inconsistencies, and synchronize the English and Japanese documentation with more natural Japanese wording.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
allowlist 制約付きの tq api コマンドを追加
Summary
issue-tracker の型付き CLI コマンドで公開されていない操作を、明示的な許可リストの範囲内で呼び出せる
tq apiコマンドを追加します。主な変更点:
やったこと
tq api <method> <path>の引数解析と HTTP 転送を実装POST /api/v1/attachmentsを一時的に allowlist から除外docs/references/tq(.ja).mdとdocs/design/api(.ja).mdを更新動作確認
go test -race -count=1 ./internal/cli/tqgo test ./...git diff --check origin/main...HEADレビュー & 動作確認 チェックリスト
推奨テスト計画:
tq api GET /api/v1/issues --query states=readyで一覧を取得するPOST /api/v1/attachmentsが終了コード 2 で拒否されることを確認するその他気になることや相談ごと
POST /api/v1/attachmentsは multipart 対応を追加するまで一時的に対象外です。破壊的な API に対する確認プロンプトは表示しません。