feat: add --dry-run flag to all 47 CLI tools
When --dry-run is passed, each CLI prints the HTTP request it would make (method, URL, headers, body) without actually calling fetch(). Auth credentials are masked as "***" in the output. Useful for verifying request shape and API endpoints without needing real API keys or making actual API calls. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,10 @@ async function api(method, path, body) {
|
||||
opts.headers['Content-Type'] = 'application/json'
|
||||
opts.body = JSON.stringify(body)
|
||||
}
|
||||
if (args['dry-run']) {
|
||||
const dryRunUrl = url.replace(TOKEN, '***')
|
||||
return { _dry_run: true, method, url: dryRunUrl, headers: opts.headers, body: body || undefined }
|
||||
}
|
||||
const res = await fetch(url, opts)
|
||||
const text = await res.text()
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user