Skip to content

Add non-interactive mode to profiles create command#61

Merged
shihanpan merged 5 commits intomainfrom
61-profiles-create-non-interactive
Feb 5, 2026
Merged

Add non-interactive mode to profiles create command#61
shihanpan merged 5 commits intomainfrom
61-profiles-create-non-interactive

Conversation

@shihanpan
Copy link
Contributor

Added --non-interactive flag with --region, --api-token, and --api-url options to allow programmatic profile creation. This enables the VSCode extension and other tools to create profiles without user interaction.

Changes:

  • Added create_profile_non_interactive method to ProfileManager
  • Added CLI options: --region, --api-token, --api-url, --non-interactive, --output-mode
  • Added JSON output mode for machine-readable responses
  • Validates credentials and region before creating profile

@github-actions
Copy link

github-actions bot commented Feb 4, 2026

Coverage

Coverage Report
FileStmtsMissCoverMissing
__init__.py68494%10–11, 69–70
cli
   __init__.py52394%49, 51, 60
   containers.py270100% 
cli/commands
   __init__.py00100% 
   api_clients.py291996%27, 302, 448–449, 483, 493, 584, 615, 623
   api_collections.py257398%28, 183, 347
   assets.py47295%57–58
   connections.py526599%596, 598, 604, 642, 993
   data_tables.py165596%31, 253, 267, 321–322
   guide.py166199%106
   init.py1070100% 
   profiles.py2701395%382–383, 385–386, 388–389, 393, 397–398, 408–410, 463
   properties.py97198%21
   pull.py172298%193–194
   workspace.py39294%61, 71
cli/commands/connectors
   __init__.py00100% 
   command.py103298%131, 180
   connector_manager.py203498%176, 292, 300–301
cli/commands/projects
   __init__.py00100% 
   command.py2721096%359–362, 373, 439–441, 491, 495
   project_manager.py166795%48, 66, 263–264, 276, 317, 325
cli/commands/push
   __init__.py00100% 
   command.py133496%109, 112, 230, 308
cli/commands/recipes
   __init__.py00100% 
   command.py427997%117, 133–134, 272–275, 403, 709
   validator.py7062097%174, 883, 1136, 1223, 1246, 1279, 1281–1282, 1359–1361, 1457–1458, 1517–1518, 1707–1708, 1736–1738
cli/utils
   __init__.py40100% 
   exception_handler.py3453390%134–135, 140–141, 143–144, 174–175, 181, 184–185, 270, 300, 333–337, 371, 398, 425, 482, 517, 576, 578–579, 584–585, 587–591
   gitignore.py140100% 
   ignore_patterns.py230100% 
   spinner.py430100% 
   token_input.py451762%70, 98, 100, 102–104, 107, 124, 127–128, 132–133, 136, 139–140, 142, 144
   version_checker.py135695%24, 26, 33–34, 72, 102
cli/utils/config
   __init__.py50100% 
   manager.py5313393%127, 138, 149, 157–159, 162, 165, 177, 227–228, 399, 417, 421, 424–427, 443, 464, 478, 491, 533, 623–624, 661, 875, 1018–1019, 1033–1034, 1090, 1149
   models.py330100% 
   profiles.py3341595%99, 195–196, 199, 234–236, 261–263, 522, 530, 541–542, 546
   workspace.py680100% 
TOTAL587421096% 

@shihanpan shihanpan force-pushed the 61-profiles-create-non-interactive branch 3 times, most recently from f50a002 to 354f651 Compare February 4, 2026 23:00
…l options to allow programmatic profile creation. This enables the VSCode extension and other tools to create profiles without user interaction.

Changes:

Added create_profile_non_interactive method to ProfileManager
Added CLI options: --region, --api-token, --api-url, --non-interactive, --output-mode
Added JSON output mode for machine-readable responses
Validates credentials and region before creating profile
@shihanpan shihanpan force-pushed the 61-profiles-create-non-interactive branch from 354f651 to 5e6296e Compare February 4, 2026 23:22
@shihanpan shihanpan requested a review from hovu96 February 5, 2026 04:09
- Add type annotation for region_info to ensure it's typed as RegionInfo
- Use temporary variable for dict.get() result to narrow type properly
- Add validation for required parameters before calling non-interactive helper
- Fix line length lint error by splitting RegionInfo construction

Fixes type errors:
- Incompatible types in assignment for region_info
- Incompatible arg types for _create_profile_non_interactive
Copy link
Contributor

@hovu96 hovu96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also think about if we should cover this in unit tests

shihanpan and others added 2 commits February 5, 2026 10:48
The validation for region and api_token is now done at the call site
in create() to satisfy mypy type checking. Removed the redundant checks
from inside _create_profile_non_interactive() to avoid duplication.

Kept the api_url validation since it's specific to the custom region case.
- Change all error returns to raise SystemExit(1) in profiles create command
- This ensures the CLI exits with proper error codes when:
  - Profile already exists
  - Authentication fails
  - Keyring storage fails
  - User cancels interactive setup
- Update tests to expect SystemExit(1) on error cases

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@shihanpan shihanpan force-pushed the 61-profiles-create-non-interactive branch 2 times, most recently from 960c1f7 to 8a94562 Compare February 5, 2026 20:34
- Add 'from None' to SystemExit in ClickException handler
- Add 'from e' to SystemExit in ValueError handler
- Properly chains exception context per ruff B904 rule
@shihanpan shihanpan force-pushed the 61-profiles-create-non-interactive branch from 8a94562 to 32d4688 Compare February 5, 2026 20:52
@shihanpan
Copy link
Contributor Author

Also think about if we should cover this in unit tests

added unit tests

@shihanpan shihanpan requested a review from hovu96 February 5, 2026 21:11
@shihanpan shihanpan merged commit 4731fef into main Feb 5, 2026
9 checks passed
@shihanpan shihanpan deleted the 61-profiles-create-non-interactive branch February 5, 2026 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants