Skip to content

Conversation

@rohansen856
Copy link
Owner

This pull request introduces a new "documentation mode" to the project, allowing users to quickly access comprehensive technical documentation both online and directly from the command line. It adds a new --docs CLI flag, integrates documentation generation and browser opening into the main workflow, and sets up automated deployment of documentation to GitHub Pages. Several tests and supporting code changes are included to ensure robust handling of this new feature.

Documentation Access & Generation

  • Added a --docs command-line flag to Args in src/args.rs, enabling users to open comprehensive documentation in their browser.
  • Implemented the execute_docs_operation function in the new src/docs.rs module, which generates the documentation HTML and opens it in the default browser, handling edge cases and environment variables.
  • Updated main application logic in src/main.rs to support the new documentation mode, including operation mode detection and invocation of the docs operation. [1] [2] [3]

Continuous Deployment & Online Documentation

  • Added a GitHub Actions workflow in .github/workflows/github-pages.yml to build, generate, and deploy documentation to GitHub Pages automatically on pushes and workflow dispatches.
  • Updated README.md to advertise the new online documentation and the --docs flag for quick access, including a detailed list of documentation features.

Testing & Validation

  • Added and updated tests in src/args.rs and other modules to cover the new docs flag, ensuring correct behavior and validation skipping in documentation mode. [1] [2]
  • Ensured all test instances of Args across the codebase include the new docs field for consistency. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]

Dependencies

  • Added the open crate to Cargo.toml to support opening files in the default browser.

Signed-off-by: rohansen856 <rohansen856@gmail.com>
Signed-off-by: rohansen856 <rohansen856@gmail.com>
Signed-off-by: rohansen856 <rohansen856@gmail.com>
Signed-off-by: rohansen856 <rohansen856@gmail.com>
Signed-off-by: rohansen856 <rohansen856@gmail.com>
@rohansen856 rohansen856 requested a review from Copilot September 28, 2025 16:25
@rohansen856 rohansen856 self-assigned this Sep 28, 2025
Copy link

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 pull request introduces a comprehensive documentation system for the Git Editor tool. The main feature is a new --docs command-line flag that generates and opens detailed technical documentation in the user's browser, along with automated GitHub Pages deployment for online access.

Key changes include:

  • Added --docs flag for local documentation generation and browser opening
  • Implemented comprehensive HTML documentation with interactive features
  • Set up GitHub Actions workflow for automated documentation deployment

Reviewed Changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/args.rs Added docs field to Args struct and updated validation logic
src/main.rs Added docs operation mode and execution handling
src/docs.rs New module for documentation generation and browser opening
src/utils/validator.rs Updated validation to skip all checks in docs mode
docs/template.html Comprehensive HTML documentation template
tests/integration_tests.rs Added extensive tests for docs mode functionality
.github/workflows/github-pages.yml GitHub Actions workflow for automated docs deployment
Cargo.toml Added open crate dependency for browser launching
README.md Updated with documentation links and usage information

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


// Skip validation for email, name, start, end if using show_history, pick_specific_commits, range, or simulate
if args.show_history || args.pick_specific_commits || args.range || args.simulate {
// Skip validation for email, name, start, end if using show_history, pick_specific_commits, range, simulate, or docs
Copy link

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

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

The comment on line 33 is outdated and inconsistent with the early return for docs mode on lines 7-10. Since docs mode now has its own early return that skips ALL validation, this comment should be updated to reflect that docs mode is handled separately above.

Suggested change
// Skip validation for email, name, start, end if using show_history, pick_specific_commits, range, simulate, or docs
// Skip validation for email, name, start, end if using show_history, pick_specific_commits, range, or simulate

Copilot uses AI. Check for mistakes.
Comment on lines +725 to +730
// Build the absolute path to the binary
let project_root = std::env::current_dir().expect("Failed to get current dir");
let binary_path = project_root.join("target/debug/git-editor");

let output = std::process::Command::new(binary_path)
.args(["--docs"])
Copy link

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

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

The hardcoded path 'target/debug/git-editor' assumes a debug build exists, but the test doesn't ensure the binary is built first. This could lead to test failures if the binary hasn't been compiled. Consider using cargo run instead like other tests, or add a step to ensure the binary exists.

Suggested change
// Build the absolute path to the binary
let project_root = std::env::current_dir().expect("Failed to get current dir");
let binary_path = project_root.join("target/debug/git-editor");
let output = std::process::Command::new(binary_path)
.args(["--docs"])
// Use cargo run to ensure the binary is built and executed
let output = std::process::Command::new("cargo")
.args(["run", "--", "--docs"])

Copilot uses AI. Check for mistakes.
fn open_in_browser(file_path: &std::path::Path) -> Result<()> {
// Skip browser opening if NO_BROWSER environment variable is set or if running in test context
if std::env::var("NO_BROWSER").is_ok()
|| std::env::var("GIT_EDITOR_NO_BROWSER").is_ok()
Copy link

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

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

[nitpick] The function checks for both NO_BROWSER and GIT_EDITOR_NO_BROWSER environment variables, but this duplication could lead to confusion. Consider standardizing on one variable name or documenting why both are needed.

Suggested change
|| std::env::var("GIT_EDITOR_NO_BROWSER").is_ok()

Copilot uses AI. Check for mistakes.
Comment on lines +60 to +61
# Copy the generated HTML to docs-site directory
cp /tmp/git-editor-docs.html docs-site/index.html
Copy link

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

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

The hardcoded path /tmp/git-editor-docs.html creates a tight coupling between the documentation generation logic and the GitHub Actions workflow. If the temp file location changes in the future, this workflow will break. Consider making the temp file location configurable or using a more predictable location.

Copilot uses AI. Check for mistakes.
@rohansen856 rohansen856 merged commit 2987c0a into master Sep 28, 2025
20 checks passed
@rohansen856 rohansen856 deleted the feat/inbuilt-docs branch September 28, 2025 18:55
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