Sync timesheets between Harvest and Targetprocess
twotime requires Node.js 24.22.1 or a later 24.x, or Node.js 26.12.1 or later, and is installed with pnpm.
Note that the old, public package (v2.0.0) is deprecated and will be removed at some point. Do not use this version.
Every release has the package attached to it as a tarball, and pnpm can install straight from its URL:
pnpm add -g https://github.com/NewOrbit/twotime/releases/download/v<version>/neworbit-twotime-<version>.tgzRather than filling in the version yourself, copy the exact command from the Install or upgrade section of the latest release. This is the simplest route: it needs no access to the NewOrbit feed and no .npmrc.
To upgrade, run the same command again with the URL of the newer version. It replaces the version you have installed.
twotime is also published to the NewOrbit Azure Artifacts feed, so you can install it by package name instead. This needs access to that feed and an .npmrc that points @neworbit at it.
If necessary, set up access to the NewOrbit DevOps artefacts by following the Connect to a feed procedure in Get started with npm packages in Azure Artifacts. A few things in addition to that page:
-
Install the package
vsts-npm-authfirst, by usingpnpm add -g vsts-npm-auth. -
Your
.npmrcfile needs to have these entries. pnpm reads registry and authentication settings from.npmrc, the same as npm does:registry=https://registry.npmjs.org/ @neworbit:registry=https://pkgs.dev.azure.com/neworbit/_packaging/NewOrbit/npm/registry/
-
If
vsts-npm-auth -config .npmrcdoesn't work, trypnpm dlx vsts-npm-auth -config .npmrc. -
If that command fails with a "Couldn't get an authentication token" message, try adding
-Fto the end of the command to force it.- This can also happen if you already have an expired auth token in
.npmrc. Clear the contents of the file down to just the two lines above, then run thevsts-npm-authcommand again.
- This can also happen if you already have an expired auth token in
With that in place, install with:
pnpm add -g @neworbit/twotimeUpgrade later with pnpm update -g @neworbit/twotime.
Versions before 4.0.0 were installed with npm, and pnpm cannot remove those. Run npm uninstall -g @neworbit/twotime (v3) or npm uninstall -g twotime (v2) before you install, or you will end up with two twotime commands on your PATH.
Coming from v2, finish any timers started with it first: newer versions cannot finish timers from previous days that v2 started, and you would have to fix them up by hand in Harvest and Targetprocess.
Once installed, you need to authenticate against Harvest and Targetprocess.
twotime authYou will need:
- Harvest personal access token and account ID
- Targetprocess personal access token
If you're using Windows and WSL, you may wish to be able to use twotime in either environment. To avoid having two separate authentication configurations you can symlink the configuration files.
Windows and WSL example
Assuming you've already installed and authenticated your Windows installation of twotime, then head to WSL:
-
Install
twotimein WSL, with the same command you used on Windows. Copy it from theInstall or upgradesection of the latest release. -
symlink the configs, substituting
USER_NAMEwith the value from%USERNAME%in your Windows environment$ mkdir -p ~/.config/configstore $ ln -s /mnt/c/Users/USER_NAME/.config/configstore/twotime.json ~/.config/configstore/twotime.json $ twotime list [INFO] Getting config from /home/JohnDoe/.config/configstore/twotime.json ╔═══════════════╤══════════════════════════╤═════════════╤════════╗ ║ Entity Type │ Title │ Hours │ Status ║
Please ensure you've authenticated (see Setup) before using twotime.
- Use
twotime startto start a timer - Use
twotime finishto finish a timer - Use
twotime pauseto pause the currently running timer - Use
twotime resumeto resume a paused timer
Use twotime list to see a summary of a day's timesheet.
Most commands can be used with past timesheets. You can provide a --date option (or -d for short):
twotime start --date 2018-10-20Also you can use an offset with --offset (or -o for short) for the number of days in the past. For example an offset of 1 is yesterday:
twotime start -o 1Provide the --all option to finish all of a day's timers at once.
Use the --tp option to start a timer without prompting for a Targetprocess ID:
twotime start --tp 12345When a time entry for a TargetProcess Issue is finished, time is booked on the relevant TargetProcess entity based on the value of custom field IssueTime to on the TargetProcess project. Values for this custom field can be as below:
User story- Issue time is booked on the user story. If the issue is not attached to a user story, no time is booked on TargetProcess.Issue- Issue time is booked to the issue.none- No issue time is booked on TargetProcess.
When a time entry for a TargetProcess Task is finished, if the time remaining on the task is 0, then it is moved to Done state.
(Original public package: Made with 💖 by NewOrbit in Oxfordshire, and licensed under the MIT Licence)