8000 Enhance `git hours` to default to first and latest commit dates · Issue #2 · dominikake/git-hours · GitHub
[go: up one dir, main page]

Skip to content

Enhance git hours to default to first and latest commit dates #2

Open

Description

@dominikake

the git hours syntax needs to manually supply the before string and the since string. i know there are git commands that can get the date and time of the latest commit and the very first commit of a code base. can we work towards this feature where we just need to type git hours and by default it gets the date and time of the first commit and the latest.

Agent Context [ "Locate argument parsing: Identify where `program.option` is used to define the `since` and `until` arguments in `src/index.js`. This will help understand how arguments are currently processed.", "Implement `getFirstCommitDate` and `getLatestCommitDate` functions: Create two new asynchronous functions in `src/index.js` that use `nodegit` to retrieve the date of the very first commit and the latest commit, respectively. These functions will take the `repo` object as an argument.", "Modify argument processing logic: In `src/index.js`, update the argument parsing logic to check if `since` or `until` options were provided by the user. If not, call the newly created `getFirstCommitDate` and `getLatestCommitDate` functions to set the default values for `config.since` and `config.until`. This will likely involve modifying the `parseArgs` function or the section where `config.since` and `config.until` are set after argument parsing.", "Integrate date retrieval into `main`: Ensure that the `getFirstCommitDate` and `getLatestCommitDate` functions are called *before* `getCommits` if the `since` or `until` options are not explicitly provided by the user. This will involve opening the repository to get the commit dates." ]

Activity

  1. robin-agent commented on Aug 7, 2025

    @robin-agent

    🟠 Plan Ready for Approval 🟠

    I've generated a plan for this issue and it's ready for your review.

    Plan: Enhance git hours to default to first and latest commit dates

    • Task 1:
    Locate argument parsing: Identify where `program.option` is used to define the `since` and `until` arguments in `src/index.js`. This will help understand how arguments are currently processed.
    
    • Task 2:
    Implement `getFirstCommitDate` and `getLatestCommitDate` functions: Create two new asynchronous functions in `src/index.js` that use `nodegit` to retrieve the date of the very first commit and the latest commit, respectively. These functions will take the `repo` object as an argument.
    
    • Task 3:
    Modify argument processing logic: In `src/index.js`, update the argument parsing logic to check if `since` or `until` options were provided by the user. If not, call the newly created `getFirstCommitDate` and `getLatestCommitDate` functions to set the default values for `config.since` and `config.until`. This will likely involve modifying the `parseArgs` function or the section where `config.since` and `config.until` are set after argument parsing.
    
    • Task 4:
    Integrate date retrieval into `main`: Ensure that the `getFirstCommitDate` and `getLatestCommitDate` functions are called *before* `getCommits` if the `since` or `until` options are not explicitly provided by the user. This will involve opening the repository to get the commit dates.
    

    Please review the plan and let me know if you'd like me to proceed, make changes, or if you have any feedback.

    🟠 Plan Ready for Approval 🟠

    I've generated a plan for this issue and it's ready for your review.

    Plan: Enhance git hours to default to first and latest commit dates

    • Task 1:
    Locate argument parsing: Identify where `program.option` is used to define the `since` and `until` arguments in `src/index.js`. This will help understand how arguments are currently processed.
    
    • Task 2:
    Implement `getFirstCommitDate` and `getLatestCommitDate` functions: Create two new asynchronous functions in `src/index.js` that use `nodegit` to retrieve the date of the very first commit and the latest commit, respectively. These functions will take the `repo` object as an argument.
    
    • Task 3:
    Modify argument processing logic: In `src/index.js`, update the argument parsing logic to check if `since` or `until` options were provided by the user. If not, call the newly created `getFirstCommitDate` and `getLatestCommitDate` functions to set the default values for `config.since` and `config.until`. This will likely involve modifying the `parseArgs` function or the section where `config.since` and `config.until` are set after argument parsing.
    
    • Task 4:
    Integrate date retrieval into `main`: Ensure that the `getFirstCommitDate` and `getLatestCommitDate` functions are called *before* `getCommits` if the `since` or `until` options are not explicitly provided by the user. This will involve opening the repository to get the commit dates.
    

    Please review the plan and let me know if you'd like me to proceed, make changes, or if you have any feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0