hrvst-cli

website·Indexed 30 days ago

https://kgajera.github.io/hrvst-cli

A command-line interface for Harvest that allows users to manage projects, tasks, time entries, expenses, and invoices. The CLI provides functionality for tracking time, managing user billable and cost rates, handling estimates, and generating reports, all while integrating with Harvest's REST API via OAuth2 authentication.

Tokens
13.3K
Snippets
149
Records
151
Agent score
75%

What's inside hrvst-cli

  1. Install hrvst-cli via npm

    Install the Harvest command-line interface (CLI) globally using the npm package manager to access Harvest REST API V2 features and time tracking utilities.
    npm install -g hrvst-cli
  2. Authenticate hrvst-cli with a Harvest account

    The Harvest CLI uses client-side OAuth2 for authentication. To link your account, run the login command and follow the browser prompts to grant the CLI access to your Harvest account.
    hrvst login
  3. Configure hrvst expense report options

    All hrvst reports expense-reports commands share the following configuration options:

    • --from (Required): Start date for expenses (spent_date on or after this date).
    • --to (Required): End date for expenses (spent_date on or before this date).
    • --page (Optional): The page number for pagination. Use all to retrieve all pages.
    • --per_page (Optional): Number of records per page (1 to 2000).
    • --fields (Optional): Comma-separated list of specific fields to display.
    • --output (Optional): Output format, either json or table.
  4. Configure options for hrvst time reports

    The following options are available for all hrvst reports time-reports commands. Note that the timeframe defined by --from and --to must not exceed 1 year (365 days).
    --from       (Required) Start date for the report (spent_date on or after).
    --to         (Required) End date for the report (spent_date on or before).
    --page       (Optional) Page number for pagination. Use 'all' to retrieve all pages.
    --per_page   (Optional) Number of records per page (1 to 2000).
    --fields     (Optional) Comma separated list of fields to display.
    --output     (Optional) Output format: 'json' or 'table'.
  5. Update an estimate using hrvst-cli

    Update an existing estimate by providing the required --estimate_id and any optional fields you wish to modify. Tax and discount values should be provided as percentages (e.g., 10.0 for 10%). If --number is omitted, the estimate number is automatically generated.
    hrvst estimates update \
      --estimate_id <ID> \
      --client_id <ID> \
      --number <NUMBER> \
      --purchase_order <PO_NUMBER> \
      --tax 10.0 \
      --tax2 5.0 \
      --discount 10.0 \
      --subject "Project Estimate" \
      --notes "Additional details" \
      --currency USD \
      --issue_date YYYY-MM-DD \
      --fields "id,number,subject" \
      --output json
  6. Retrieve a specific task by ID

    Fetch details for a single task using its unique identifier. Admin permissions are required.
    hrvst tasks get \
      --task_id <id> \
      --fields <comma_separated_list> \
      --output <json|table>
  7. List active project assignments for a specific user

    Retrieve a list of active project assignments for a user identified by their USER_ID. Results are sorted by creation date (most recent first). Admin permissions are required to list assignments for users other than the currently authenticated user. The response includes a project_assignments array and pagination properties.
    hrvst users project-assignments list-by-user --user_id <USER_ID>
  8. Update an estimate line item using hrvst CLI

    Use the hrvst estimates line-items update command to modify an existing line item on an estimate. A successful request returns a 200 OK response code.
    hrvst estimates line-items update \
      --estimate_id "YOUR_ESTIMATE_ID" \
      --line_items[0]id "LINE_ITEM_ID" \
      --line_items[0]description "Updated description"
  9. List user assignments for a specific project

    Retrieve user assignments associated with a specific project ID. Results are sorted by creation date (most recent first) and are paginated.
    hrvst projects user-assignments list-by-project \
      --project_id <ID> \
      --user_id <ID> \
      --is_active <true|false> \
      --updated_since <datetime> \
      --page <number|all> \
      --per_page <1-2000> \
      --fields <comma_separated_list> \
      --output <json|table>
  10. Retrieve a specific invoice using hrvst CLI

    Retrieve a single invoice object by its unique identifier. Admin or project manager permissions are required.
    hrvst invoices get \
      --invoice_id <required_id> \
      --fields <comma_separated_list> \
      --output <json|table>
  11. Retrieve a specific expense using hrvst CLI

    Fetch a single expense object by its unique identifier. Returns a 200 OK response if the ID is valid.
    hrvst expenses get \
      --expense_id <required_id> \
      --fields <comma_separated_list> \
      --output <json|table>