Module: Browserctl::Commands::DeprecationNotice

Defined in:
lib/browserctl/commands/deprecation_notice.rb

Overview

One-shot deprecation warning emitter for v0.15 alias verbs.

Per ADR-0021: when a CLI invocation uses ‘cookie *` or `storage *`, we emit exactly one line to stderr — never under `–output json`, so JSON consumers (AI agents, scripts) keep a clean parser input. The warning is memoised process-wide so a single CLI invocation only ever prints it once even if a wrapper calls the dispatcher multiple times.

Constant Summary collapse

REMOVAL =
"Removed at 1.0."

Class Method Summary collapse

Class Method Details

.emit(old_verb, replacement, io: $stderr) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/browserctl/commands/deprecation_notice.rb', line 19

def emit(old_verb, replacement, io: $stderr)
  return if @emitted
  return if OutputFormat.current.json?

  @emitted = true
  io.puts "warning: '#{old_verb}' is deprecated; use '#{replacement}'. #{REMOVAL}"
end

.reset!Object

Test-only — reset memoisation between examples.



28
29
30
# File 'lib/browserctl/commands/deprecation_notice.rb', line 28

def reset!
  @emitted = false
end