Skip to content

fix: auto-detect SSH key instead of hardcoding id_rsa#4

Merged
machado144 merged 1 commit intomainfrom
fix/ssh-key-autodetect
Mar 8, 2026
Merged

fix: auto-detect SSH key instead of hardcoding id_rsa#4
machado144 merged 1 commit intomainfrom
fix/ssh-key-autodetect

Conversation

@murilopmachado
Copy link
Contributor

Summary

  • Auto-detect SSH keys in priority order: id_ed25519id_ecdsaid_rsa
  • Add --ssh-key flag for custom key paths on clone and generate commands
  • Add unit tests for key detection, override, fallback, and isSSH
  • Add expandable SSH key configuration section to README

What changed

  • services/cloner.gogetSSHKeyPath() now scans for available keys instead of hardcoding id_rsa
  • services/cloner_test.go — new test file with 7 test cases
  • flags.go — new --ssh-key flag
  • main.go — wire flag to clone and generate commands
  • actions/clone.go / actions/generate.go — read flag and pass to cloner
  • README.md — expandable SSH key docs

Test plan

  • All existing tests pass
  • New tests pass: go test ./services/ -run "TestGetSSHKeyPath|TestSetSSHKeyPath|TestIsSSH" -v

- Try id_ed25519, id_ecdsa, id_rsa in order
- Add --ssh-key flag to override with a custom path
- Add unit tests for detection, override, and isSSH
- Add SSH key docs section to README
@github-actions
Copy link

github-actions bot commented Mar 8, 2026

✅ StructLint Validation

Metric Count
Checks passed 65
Violations 0

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Core Changes

  • Introduced a new --ssh-key flag for clone and generate commands, allowing users to specify a custom SSH private key path.
  • Enhanced the GitCloner service to auto-detect SSH keys in a prioritized order: id_ed25519, id_ecdsa, then id_rsa within the ~/.ssh directory, falling back to the specified flag if provided.
  • Added comprehensive unit tests for the new SSH key detection and setting logic.

Concerns

There are no critical concerns regarding security, performance, or logic flaws.


Verdict

Approve: The changes are well-implemented, thoroughly tested, and address a valuable feature request without introducing any regressions or critical issues.


Code review performed by GEMINI - gemini-2.5-flash.

@machado144 machado144 merged commit 04ebad6 into main Mar 8, 2026
6 checks passed
@machado144 machado144 deleted the fix/ssh-key-autodetect branch March 8, 2026 16:46
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