Class: Fp::Commands::Setup
Overview
fp setup Interactive guided setup for new users. Validates the API key, checks connectivity, and saves a profile.
Constant Summary collapse
- KNOWN_FLAGS =
{ api_key: :string, profile: :string, api_url: :string, non_interactive: :boolean }.freeze
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Fp::Commands::Base
Instance Method Details
#run(args) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/fp/commands/setup.rb', line 16 def run(args) opts, _positional = parse_flags(args, KNOWN_FLAGS) puts "🔧 FeatureParity CLI Setup" puts "=" * 40 puts api_key = resolve_api_key(opts) profile_name = resolve_profile_name(opts) api_url = opts[:api_url] || Config.get_setting('api_url') puts "Validating API key..." validate_key!(api_key, api_url) save_profile!(profile_name, api_key, api_url) effective_url = api_url || Config::DEFAULT_API_URL domain = URI.parse(effective_url).host.sub(/^api\./, '') rescue 'featureparity.dev' puts puts "✅ Setup complete!" puts puts "Your profile '#{profile_name}' is ready. Usage:" puts puts " fp --profile #{profile_name} projects" puts " FP_PROFILE=#{profile_name} fp projects" puts puts "Or set FP_API_KEY to skip profiles:" puts " export FP_API_KEY=#{api_key[0..6]}..." end |