Skip to content

Comments

feat: add --generate-intellij-config flag to app ssh command#1346

Merged
martin-helmich merged 11 commits intomasterfrom
feat/intellij-ssh-config
Sep 9, 2025
Merged

feat: add --generate-intellij-config flag to app ssh command#1346
martin-helmich merged 11 commits intomasterfrom
feat/intellij-ssh-config

Conversation

@martin-helmich
Copy link
Member

Summary

Adds --generate-intellij-config flag to the app ssh command to automatically generate IntelliJ IDEA SSH and deployment configuration files.

Problem Solved

Currently, developers need to manually configure IntelliJ IDEA for SSH connectivity and file deployment to mittwald app installations. This involves:

  • Manually setting up SSH configurations with complex usernames like [email protected]@app-id
  • Configuring SFTP connections with proper authentication
  • Setting up deployment mappings between local and remote directories

This manual process is error-prone and time-consuming, especially when working with multiple app installations.

Solution

This PR introduces a --generate-intellij-config flag that automatically creates the necessary IntelliJ configuration files:

  • .idea/sshConfigs.xml - SSH connection settings with proper authentication
  • .idea/webServers.xml - SFTP server configuration for file transfer
  • .idea/deployment.xml - Directory mappings for seamless deployment

Usage

# Generate IntelliJ config files for an app installation
mw app ssh <app-installation-id> --generate-intellij-config

After running this command, developers can immediately use IntelliJ IDEA's SSH and deployment features without any manual configuration.

Benefits

  • Zero manual setup - One command generates all necessary configuration files
  • Correct credentials - Automatically uses the proper SSH username format and connection details
  • Smart merging - Extends existing configurations without overwriting other entries
  • Error prevention - Eliminates common mistakes in manual SSH/SFTP setup

🤖 Generated with Claude Code

martin-helmich and others added 9 commits September 5, 2025 15:55
- Add --generate-intellij-config flag to generate IntelliJ IDEA SSH and deployment configuration files
- Generate .idea/sshConfigs.xml, .idea/webServers.xml, and .idea/deployment.xml files
- Use proper XML parsing with fast-xml-parser library for robust XML handling
- Support extending existing XML configuration files without overwriting
- Prevent duplicate entries by checking existing configurations
- Include comprehensive test suite with 15+ test cases covering XML generation, parsing, error handling, and edge cases
- Extract app short ID from SSH connection data for configuration naming

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
… parsing

- Extract common XML parser/builder configuration constants
- Create reusable XML file manipulation utilities with type-safe configuration
- Consolidate duplicate XML handling logic across SSH, web server, and deployment configs
- Fix SSH username parsing to preserve complete user string (e.g., "[email protected]@app-id")
- Remove redundant parseUserHost function that was incorrectly splitting usernames
- Enhance tests to verify correct username handling in both SSH and web server configs
- Reduce code from ~340 lines to ~270 lines while maintaining full functionality

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Reorder import statements alphabetically
- Improve multiline formatting for better readability
- Remove unused function parameter in addItemToArrayField
- Simplify error handling logic in loadExistingXmlDocument
- Apply consistent code style formatting

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add comprehensive XML document type definitions for IntelliJ config files
- Replace Record<string, unknown> with specific XmlDocument, XmlSshConfig, XmlWebServer, XmlPath interfaces
- Create type-safe helper functions: addSshConfig, addWebServer, addDeploymentPath
- Remove all 'as any' type assertions for full type safety
- Update error handling test to expect thrown errors for malformed XML instead of silently recovering
- Improve compile-time validation and IDE support with proper typing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Create config_xml_types.ts with all XML interface definitions (9 interfaces, 80 lines)
- Extract XmlDocument, XmlProject, XmlComponent and all related types from config.ts
- Add proper imports for XML types in main config file
- Improve code organization with separation of concerns between types and logic
- Maintain full functionality while reducing main config file size by ~80 lines

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
When an SSH config already exists for a host, reuse its ID in web server
configurations to maintain proper references between configuration files.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a --generate-intellij-config flag to the app ssh command that automatically generates IntelliJ IDEA configuration files for SSH connections and file deployment. This eliminates the need for manual SSH/SFTP setup in IntelliJ when working with mittwald app installations.

Key Changes:

  • Extended SSH connection data to include appShortId for configuration naming
  • Added comprehensive IntelliJ XML configuration generation with smart merging capabilities
  • Integrated new flag into the existing app ssh command with early return when used

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/lib/resources/ssh/appinstall.ts Extended return type to include appShortId for IntelliJ config naming
src/lib/intellij/config_xml_types.ts Type definitions for IntelliJ XML configuration file structures
src/lib/intellij/config.ts Core logic for generating and merging IntelliJ SSH, web server, and deployment configs
src/lib/intellij/config.test.ts Comprehensive test suite covering XML generation, merging, and error handling
src/commands/app/ssh.ts Integration of the new flag with early return when generating configs
package.json Added fast-xml-parser dependency for XML manipulation
docs/app.md Updated command documentation to include the new flag
CLAUDE.local.md Local development note

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

martin-helmich and others added 2 commits September 8, 2025 23:00
…te checks

Replace captured variables (data.host, data.appShortId) with function
parameters (newItem properties) in XML duplicate checking logic to improve
function reusability and prevent potential bugs from closure capture.

Addresses Copilot feedback on PR #1346.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@martin-helmich martin-helmich merged commit 360983c into master Sep 9, 2025
11 checks passed
@martin-helmich martin-helmich deleted the feat/intellij-ssh-config branch September 9, 2025 11:23
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.

1 participant