Skip to content

Docs/agents and flags#5

Merged
JerryAgbesi merged 4 commits intomainfrom
docs/agents-and-flags
Apr 18, 2026
Merged

Docs/agents and flags#5
JerryAgbesi merged 4 commits intomainfrom
docs/agents-and-flags

Conversation

@JerryAgbesi
Copy link
Copy Markdown
Owner

@JerryAgbesi JerryAgbesi commented Apr 18, 2026

Summary

Introduces developer tooling and documentation for contributors, plus CI lint enforcement:

  • Docs: new AGENTS.md distilling contribution best practices; clarified -a, --add flag signature in README.
  • Lint config: added .golangci.yml
  • Pre-commit hook: .githooks/pre-commit runs make lint; contributors opt in with make hooks (sets core.hooksPath).
  • CI: added a lint job that runs on feat/**, fix/**, docs/** branches and gates test-and-build. Bumped golangci-lint-action to @v8
  • Code cleanup: resolved all findings surfaced by the new ruleset — wrapped errors with errors.As/%w, switched WriteString(fmt.Sprintf(...)) to
    fmt.Fprintf, collapsed an if/else if/else into a switch, outdented an else-after-return, removed dead subprocess-based test helper, and applied gofumpt
    formatting.

Related issue

n/a

Checklist

  • Tests added or updated (if behavior changed) — no behavior changes; existing tests updated only to satisfy lint/formatting
  • make lint passes — 0 issues.
  • go test ./... passes
  • README updated (if user-facing changes) — -a, --add flag description clarified

Summary by CodeRabbit

  • Documentation

    • Added comprehensive contributor guide with development prerequisites, build instructions, and contribution workflow requirements
    • Clarified command-line flag usage in README
  • Chores

    • Configured Git pre-commit hooks to enforce code quality checks before commits
    • Integrated automated linting into CI/CD pipeline
  • Refactor

    • Improved error handling for better edge case coverage
    • Simplified internal implementation and test infrastructure

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 18, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR introduces linting infrastructure via golangci-lint configuration and pre-commit hooks, updates CI workflows to include lint checks, adds contributor guidelines for AI agents, and refactors code for consistency and improved error handling in SSH config parsing and command execution.

Changes

Cohort / File(s) Summary
Linting & CI Infrastructure
.githooks/pre-commit, .golangci.yml, .github/workflows/build.yml, Makefile
Adds pre-commit hook script that enforces lint checks, configures golangci-lint with version 2 and curated linter set, updates CI workflow to run lint job before test-and-build on push to main and feature/fix/docs branches, and adds hooks make target to configure Git hooks path.
Documentation
AGENTS.md, README.md
Introduces new contributor guide for AI agents with setup, testing, and submission requirements; corrects --add flag argument format documentation in README.
Command-Line Interface
cmd/root.go
Groups package-level flag variables into single block declaration and updates --add flag help text to show alias placeholder.
SSH Connection Handling
internal/connect/connect.go, internal/connect/connect_test.go, internal/connect/target.go, internal/connect/target_test.go
Refactors target-selection logic from if/else chain to switch statement, simplifies test infrastructure by removing command-stubbing machinery in favor of inline fake commanders, replaces direct type assertion with errors.As for wrapped net.AddrError detection, and adds trailing newline to test file.
SSH Config Parsing & Writing
internal/sshconfig/parser.go, internal/sshconfig/parser_test.go, internal/sshconfig/writer.go
Streamlines DefaultConfigPath() with early error return, clarifies host-pattern iteration comment, removes extra blank lines, updates deferred close-error wrapping to use %w format, refactors formatHostEntry to use fmt.Fprintf with strings.Builder, and removes trailing blank lines in tests.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • JerryAgbesi/skipper#1: Overlaps with changes to internal/connect/target.go and internal/sshconfig/writer.go, particularly around error handling and SSH config writing refactoring.

Poem

🐰 Hops through the lint rules with glee,
Pre-commit hooks dance wild and free,
Errors now wrapped in proper chains,
Config flows smooth through refactored veins,
Agents rejoice—guidelines abound!

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title "Docs/agents and flags" is vague and doesn't clearly convey the primary changes: it mentions only documentation and flags but omits the major additions of linting infrastructure (CI workflow, lint config, pre-commit hook) and code cleanup that constitute most of the changeset. Consider a more descriptive title like "Add linting infrastructure, contributor docs, and code cleanup" or "Add AGENTS.md, golangci-lint config, and CI lint enforcement" to better reflect the full scope of changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/agents-and-flags

Comment @coderabbitai help to get the list of available commands and usage tips.

@JerryAgbesi JerryAgbesi merged commit da0aecc into main Apr 18, 2026
5 of 6 checks passed
@JerryAgbesi JerryAgbesi deleted the docs/agents-and-flags branch April 18, 2026 22:26
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