GithubHelp home page GithubHelp logo

oriole's Introduction

oriole

Make time fly ๐Ÿฆ

A CLI app that automatically creates a Harvest time entry out of your git commits. Made using Ink and Pastel.

Install

$ npm install -g oriole

Commands

oriole setup

Set up your Harvest account info on your local machine so that the other oriole commands can function properly.

This will ask you for your Harvest Personal Access Token and account ID (which you can find or create here), and save it to an encrypted JSON file using conf. Please refer to conf's README to find the default location of this file (it depends on your OS). If you're using macOS, it should be:

~/Library/Preferences/oriole-nodejs/orioleStore.json

If you're done using oriole, feel free to delete this file at any time. You'll just need to re-run oriole setup the next time you run a command.

oriole init

Initialize the current repo with a Harvest project ID and task ID. These IDs will then be used when running oriole push to create a Harvest timesheet entry.

If your current working directory is a valid git repository, this command will make a GET request to your Harvest account (using the token and account ID you provided in oriole setup) and show you a list of your available Harvest projects and their corresponding tasks.

Once you've selected a project and task, it will save those IDs to your encrypted conf store, and will be used when running oriole push. Essentially, this command links your current local git repo with a Harvest project/task.

oriole push

Additional arguments:

--hours, -h  Set the hours spent on this Harvest entry.    [number] [required]
--date, -d   Get the commits made on the specified date.              [string]

This is the main command for oriole. Using oriole push, you can create a timesheet entry out of the most recent git commit messages in your current repo (made either on the current day or on the specified date using --date). After confirmation, oriole will create a Harvest time entry using the previously-specified Harvest project/task, and POST it to your account.

In the event that the same project/task entry is already in your Harvest account on the day you specified (if, for example, you added it manually), oriole will ask whether you would like to replace that existing entry or create a new one. If there are multiple entries, choosing to replace will only replace the most recent entry.

oriole pto

Additional arguments:

--year, -y  The year for which you'd like to see the total number of PTO hours spent.	[number]

Run this command to have oriole calculate the total number of PTO hours spent in the current calendar year. It will only calculate the PTO hours spent for the Tivix internal Harvest project and task.

Optionally pass in a different year to get the total PTO hours for that year instead.

oriole --help

Shows the help text and the available commands.

Development

If you'd like to run the project locally, simply clone (or fork and clone) the repo and run npm install.

There are 2 available commands:

  • npm run dev - Start development mode and recompile on change
  • npm run build - Build a final distributable for npm

oriole's People

Contributors

attilathehen avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

brleinad

oriole's Issues

Strange bug when deleting key

When deleting the key generated by oriole setup from your OS's keychain, and also deleting the orioleStore.json file, there's an issue where running oriole setup immediately afterwards fails. Running oriole setup a second time works properly, but the first time after deleting both the store JSON and the secret key always fails.

Investigate ๐Ÿ”

Add "oriole save . --time" command

This is the big 'un. When this command is run, several things need to happen:

  • By specifying the path (.), oriole save should be able to read the git log output of that current directory, or else throw an error if the current directory is not a git repository.
    • The user should also be able to, therefore, enter a different directory, and not just the current one.
  • The --time parameter should indicate how far back oriole should look in the git log output. If, for instance, the time value was given as --8, oriole should only grab the commits within the past 8 hours.
    • Might be nice for this to have a default - maybe 8/10 hours?
  • oriole save should also format the git log output in a nice way:
    • Remove semantic commit type prefixes such as "fix:", just because I feel like they would clutter up the Harvest log
    • If it's a multiline commit message, format it accordingly with nice indents
    • If any sort of ticket information is given, like "[ch####]", use that to create a nice heading for the entry up top, like "Ticket #####:"
      • However, if there are already time entries in Harvest that have the same heading, simply add the relevant commits to it rather than creating a new one (related to the next bullet point). Therefore, we'll have to first read/GET the current Harvest entries before POSTing?
  • Make sure it's idempotent (obviously)
  • Show the output/nicely-formatted entry either before or upon POSTing - maybe allow the user to edit it beforehand?
  • This somehow needs to work together, in a streamlined way, with #2 and #3. Several different ways to go about it - either add them as params, which would make the command quite long (oriole save . --time --project --task), or have a couple prompts after inputting oriole save . --time that specifies then and there. Or...some other way? Is there anything about the directory that the CLI can get info from? Or maybe the user does it once, and then it saves?

Add confirmation option for oriole push

PRIORITY: add some sort of confirmation option for oriole push when it finds the same project/task entry - something like "We've found a timesheet entry with the same project and task. Would you like to overwrite and update this one, or create a new one?"

That might be nicer UX than immediately overwriting, like it is now?

Without something like this, the user could potentially overwrite their entire other entry that they wrote by hand - that's not ideal. Some sort of "merge" option could also be introduced, but that would definitely need more thought and work. For now, allow the user to simply push a new entry separately.

Add a dev mode to disable store encryption

It would make it a lot easier to see the changes happening in the store. And also add scripts to create/delete the store?

Also, if dev mode is enabled, use saved JSON files so I'm not spamming the Harvest API.

oriole init fails with unexpected token i in JSON

I did a oriole setup added my personal access token and account ID and then when running oriole init inside a repo I got the following:

> oriole init
๐Ÿ•  Loading...
/Users/danielrb/open/oriole/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

SyntaxError: Unexpected token i in JSON at position 8
    at JSON.parse (<anonymous>)
    at /Users/danielrb/open/oriole/build/commands/init.js:857:25

I will continue to investigate but any help would be useful.

Add "oriole init" command

Take a user's Harvest token and Harvest User ID value and save it to use when making requests.

  • Also, save it so that they don't have to keep entering it over and over again.
  • Also, think about security, and how to go about safely storing these values?

Add "oriole show all projects" command

Let a user select from the list? Or just show? Then copy project ID?

UPDATE: This needs be something more like oriole set or oriole set ., where oriole will make a link between the current directory and a Harvest project belonging to the user.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.