Skip to content

feat: add infrahubctl availability detection and warnings#72

Merged
minitriga merged 4 commits into
mainfrom
claude/issue-71
Feb 11, 2026
Merged

feat: add infrahubctl availability detection and warnings#72
minitriga merged 4 commits into
mainfrom
claude/issue-71

Conversation

@claude

@claude claude Bot commented Feb 11, 2026

Copy link
Copy Markdown

Closes #71

Changes

This PR implements comprehensive infrahubctl detection to warn users when the tool is missing from their Python environment, addressing the issue where users experience cryptic failures when infrahubctl is not installed.

Key Features

🔍 InfrahubctlChecker Utility Class

  • Detects infrahubctl availability in the current Python environment
  • Caches results for performance (30-second cache duration)
  • Supports custom path configuration via settings
  • Cross-platform compatibility with Windows .exe detection

⚠️ Status Bar Warning Indicator

  • Shows persistent warning icon when infrahubctl is missing
  • Clickable guidance with installation instructions
  • Configurable via infrahub-vscode.showInfrahubctlWarnings setting

🛡️ Pre-Command Validation

  • Validates infrahubctl before running affected commands
  • User-friendly modal dialogs with installation guidance
  • "Continue Anyway" option for advanced users
  • Direct links to Infrahub documentation

📋 Enhanced Commands with Validation

  • checkAllSchemaFiles() - Pre-flight infrahubctl check
  • loadAllSchemaFiles() - Pre-flight infrahubctl check
  • checkSchemaFile() - Pre-flight infrahubctl check
  • loadSchemaFile() - Pre-flight infrahubctl check
  • runTransformCommand() - Pre-flight infrahubctl check

🚨 Improved Error Handling

  • Differentiates "command not found" vs "command failed" errors
  • Contextual error messages with Python environment info
  • Actionable guidance for resolution steps
  • Links to installation documentation

⚙️ New Configuration Options

  • infrahub-vscode.showInfrahubctlWarnings (boolean, default: true) - Control warning visibility
  • infrahub-vscode.infrahubctlPath (string, optional) - Custom infrahubctl path override

User Experience Improvements

  • Clear Messaging: Replaces generic "Failed to run infrahubctl" with specific guidance
  • Environment Context: Shows which Python environment was checked for debugging
  • Non-Blocking: Other extension features continue to work normally
  • Graceful Degradation: Users can dismiss warnings and continue with limited functionality

Files Modified

  • src/common/infrahubctlChecker.ts - New utility class for detection logic
  • src/extension.ts - Extension state management and status bar integration
  • src/common/utilities.ts - Pre-command validation and enhanced error handling
  • src/common/commands.ts - Integration of infrahubctl checks in affected commands
  • package.json - New configuration options and command registration

Testing

✅ Compilation successful (npm run compile)
✅ Linting passes (npm run lint)
✅ Follows existing code patterns and architecture
✅ Proper disposal handling for status bar items
✅ Timeout handling for API calls included

Generated by Claude

Implemented from the detailed plan in issue #71 comments.

Implements comprehensive infrahubctl detection to warn users when the tool is missing from their Python environment.

Key features:
- InfrahubctlChecker utility class for environment detection
- Status bar warning indicator for missing infrahubctl
- Pre-command validation with user-friendly dialogs
- Enhanced error messages with installation guidance
- Configurable warning behavior via settings
- Graceful degradation allowing other extension features to work

Resolves: #71

Changes:
- Added src/common/infrahubctlChecker.ts for detection logic
- Extended extension.ts with state management and status bar
- Enhanced utilities.ts with pre-command validation
- Updated commands.ts to check infrahubctl before execution
- Added configuration options for warnings and custom paths
- Improved error handling with actionable guidance

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Feb 11, 2026

Copy link
Copy Markdown

Deploying infrahub-vscode with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4a0b4fa
Status:⚡️  Build in progress...

View logs

Adds the standard claude-code-action workflow that responds to @claude
mentions on PRs and issues. This enables requesting changes on PRs
created by the implement workflow.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@minitriga

Copy link
Copy Markdown
Collaborator

@claude can you update the PR to link to docs https://docs.infrahub.app/python-sdk/guides/installation

and also use the command to install only via uv like so uv add "infrahub-sdk[all]"

@claude

claude Bot commented Feb 11, 2026

Copy link
Copy Markdown
Author

Claude finished @minitriga's task in 1m 38s —— View job


Updates completed

Changes Made

Updated installation guidance across three files:

src/common/infrahubctlChecker.ts

  • Changed installation command from multiple options (pip, poetry) to recommended: uv add "infrahub-sdk[all]"
  • Updated documentation link from /getting-started/installation to /python-sdk/guides/installation

src/common/utilities.ts

src/extension.ts

Note

I've committed the changes locally (commit c84e8a9), but I don't have push permissions to the remote repository. The repository maintainers will need to push these changes or grant the necessary permissions to the GitHub Actions bot.

Local commit created:

docs: update installation guidance to use uv and new docs link

- Update installation command to use `uv add "infrahub-sdk[all]"`
- Update documentation links to https://docs.infrahub.app/python-sdk/guides/installation
- Simplify installation guidance to focus on recommended uv method

Co-authored-by: Alex Gittings <minitriga@users.noreply.github.com>

@minitriga minitriga merged commit d86f29a into main Feb 11, 2026
3 of 4 checks passed
@minitriga minitriga deleted the claude/issue-71 branch February 11, 2026 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

If infrahubctl is not installed in the current environment warn the user as it can effect some commands in the VSCode extension

1 participant