Giter Club home page Giter Club logo

habitrpg-todo-sync's Introduction

HabitRPG Todo Synchronization

Like my stuff and want to see more of it? Pledge me a quarter on Gittip :) https://www.gittip.com/wizonesolutions

This is a quick-and-dirty tool (currently planned to be a command line-only tool) to get Remember the Milk tasks into HabitRPG and track updates to both each time it's run. It isn't intended to be feature-complete, useful for everyone, or robust. But it is intended to work.

So what does it actually do?

  1. Grabs all your HabitRPG tasks for comparison purposes.
  2. Grabs all your Remember the Milk tasks (taking into account last time it synchronized and if you have passed --full-sync or not).
  3. Now everything happens asynchronously:
  4. Adds new, incomplete tasks from Remember the Milk. The first time you sync, it only grabs the past week, and it only grabs incomplete tasks. Use --full-sync in the environment variables to do a full synchronization.
  5. Deletes any tasks that have been deleted on the Remember the Milk side, but it doesn't do the same for tasks only deleted on the HabitRPG side.
  6. Completes tasks on the Remember the Milk side if they have been completed since last synchronization on the HabitRPG side.

So it's not a true two-way synchronization yet, but it does the job and lets your tasks live in HabitRPG. I recommend deleting them from Remember the Milk and doing a synchronization if you want to delete one. If you want to track one in RTM only, then just delete it from HabitRPG. It might get synchronized again when you change it or complete recurring tasks, etc. in Remember the Milk.

Installation

Easiest: npm install -g habitrpg-todo-sync

For development: Clone the repo and run npm install && npm link

Usage

habitsync (habitrpg-todo-sync also works now)

The first time you run, the app will help you get authenticated with both services. You need accounts on both, of course.

For development, [auth-dev] is used if in .habitrpgrc, but [auth-beta] is not supported because the beta server uses the same DB as the live one.

Command-line Options (courtesy of the Node.js module optimist!)

These generally override anything else the app would try to find out.

In development, you might do something like:

habitsync --dev -v (that's what I usually do)

Options:

  • --filter: This works exactly like Remember the Milk's search box. Have tasks you don't want to import into HabitRPG? Use --filter='Your criteria'. For example, import only from a specific list or smart list with --filter='list:"List Name"'. See their documentation at https://www.rememberthemilk.com/help/?ctx=basics.search.advanced. Note the following: Even when you specify a filter, any task you delete in Remember the Milk will be deleted in HabitRPG if it exists. We have to ask RTM for changes without the filter to be able to do that at all.
  • -q, --silence, --SILENCE: Run silently, except for errors. Intended for use with cron so that it doesn't mail you every time (unless you want it to). For extra fun, use habitsync --force --SILENCE. Fun to type, but useless since -q implies -f.
  • -f, --force: Run non-interactively. Try to avoid doing this. The prompts are in there for a good reason.
  • --beta: Use https://beta.habitrpg.com instead of https://habitrpg.com. Note that --dev is stronger than this.
  • -n, --dry-run: Don't do any mutative (is that a word?) API operations. Still performs read-only operations. Note that dry run mode still goes through the authentication sequence for Remember the Milk and writes your credentials to a file. It would be fairly useless if it didn't do this. It does not write the marker file for last sync, since this would actually change behavior on the next run.
  • -v, --debug, --verbose: Show more verbose output. Also currently works with the node-habit and rtmnode modules bundled in node_modules, though I might take it out when I release them separately. - good for development
  • --dev: Use http://localhost:3000 instead of https://habitrpg.com
  • -a, --full-sync: Sync all Remember the Milk tasks instead of just those added within the last week. Use --filter to restrict the scope of this. This takes slightly longer, but it's actually not too bad.
  • -u, --user-id: Set the x-api-user instead of getting it from .habitrpgrcgood for development
  • -p, --api-key: Set the x-api-key instead of getting it from .habitrpgrcgood for development
  • --frob: ...internal use only, implementation detail etc. etc.. Basically, if the app gives you an auth URL and you exit out of the app before it authenticates you, but you authorize it on the RTM side, you can copy the frob from the query string and provide it on the command line. This will skip getting a new one from the API.

Roadmap

Originally, my next goals were:

  • Ignore recurring tasks.
  • Complete tasks in Habit when they have been completed on the remote end.

...but actually these don't bother me much, so the roadmap is going to be more organic.

I hope this kind of functionality makes it into HabitRPG itself. This is intended as a stopgap, but if people like it, maybe I'll work on it more. Maybe. Civilized requests will get infinitely more attention than entitled flaming.

Complaining about the license is fine. Since it's free, I figured it ought to stay that way even if worked on by others. Give me some compelling reasons, and I'll consider relicensing.

Legal

Remember the Milk wants me to tell you that: "This product uses the Remember The Milk API but is not endorsed or certified by Remember The Milk." So take heed.

Original idea: Read the plan at: https://trello.com/card/remember-the-milk/50e5d3684fe3a7266b0036d6/21.

habitrpg-todo-sync's People

Contributors

kronn avatar wizonesolutions avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

habitrpg-todo-sync's Issues

API-Version 2

While poking around in the code, I noticed that HabitRPG has updated it's API-version and deprecated version 1. Your tool is built for V1.

Adding a task still works, but the extra fields you use for identifying already added tasks are no longer present.

Do you have any idea on how to match existing/already synced tasks against a running sync?

I would be glad to help/revive this project at least to the point where it's working for me.

Installation Issue

I'm trying to install this, and not getting anywhere - it appears to work, but when I go to use it I just get an error.

Screenshot of what I'm getting:
Imgur

Actual todo synchronization

Now I've got authentication working for both APIs and can pull tasks from Habit.

Copy-pasting the plan I typed to myself on IRC:

[16:44:45] <wizonesolutions> RTM AUTHENTICATION WORKING wooooooo
[16:45:05] <wizonesolutions> now some client work, then hopefully I can get a really basic sync working
[16:45:31] <wizonesolutions> goal 1 is just to add all tasks to Habit that don't already exist and don't even parse the Habit todos yet.
[16:45:48] <wizonesolutions> then add in some logic to not double-add
[16:46:05] <wizonesolutions> then logic to delete ones deleted on the RTM side
[16:46:42] <wizonesolutions> and finally to complete ones completed in Habit on the RTM side. but probably all based on the RTM states. e.g. I will simply see that in Habit it's done but it isn't done in RTM and assume that I should mark it complete in RTM
[16:46:48] <wizonesolutions> that way I don't have to cache the state of Habit todos

Elaborating on this, I think goal 1 is actually just to add all tasks to Habit wholesale. Don't even compare. Goal 2 is to compare and not double-add, and so on. So all_goals++;

I am psyched.

Only update Habit tasks after successful RTM updates

If RTM errors out, then we don't want to update our hts_last_known_state property on Habit tasks because then they won't get completed on the RTM side. Not a super-big deal — can just complete the tasks in RTM some time — but just one of those things.

Add Evernote support

I've switched to The Secret Weapon, which is Evernote-based, and so it'd be nice to have support for Evernote in the tool. This would require additional configuration — the active tasks notebook and the completed task notebook, in particular. I would also need to cache the titles of the tasks somewhere. But an SQLite database (or even nconf) would probably work fine in this case.

Trying to install and a bit over my head

I should say "again", as I commented before on the HabitRPG blog. ;-) So, I installed the node, and I downloaded the "master" sync file, I typed the install command bit into my terminal, and after the first two lines, I got lots or red errors. :-) Little help?

I'm a big fan of the things programming can do for me, just not so good at actually doing it. I was really hoping to finally get this going-- It's really hard to keep track on my todos during a busy day on the HabitRPG site at the pace it's been responding as of late. Cheers, and thanks for the effort!

Add PATH-friendly binary

Calling it habitsync for now. Don't think I'll clash with anyone, and it's in line with making sure RTM isn't hardcoded too hard even though it's the only thing supported at the moment.

Abstract task-syncing interface (or: refactor the things)

Before integrating more task managers, I need to abstract out the task-syncing logic a bit. Unless someone helps me, I'm not going to go as far as to try and be cool and make a plugin interface or something.

More like just putting the RTM stuff in its own class and maybe having a superclass with some common functions (probably not in v1).

Probably need a config file that sets the default todo-syncing service as well. And a more unified file that tracks state per service (rather than the current set of scattered files).

Implement last_sync parameter

rtm.tasks.getList has a neat little parameter it takes called last_sync. This ensures you only get new tasks, modified tasks, and deleted tasks since the last time you pulled data.

This is quite neat and means we'll be able to operate incrementally on todos. It means we won't have to do manual comparisons for RTM-side updates; RTM will simply tell us what changed! Then we just funnel it in on our side.

So this is something to do soon.

Web version

Hi! First of all, thank you very much for your amazing work! I really need to have hRPG and RTM synchronized, and your work is a wonderful tool to do so!
However, I can't always use my computer, and it would be really nice if there were a way to use this code from a tablet or a phone. It seems that one "simple" way to achieve it would be to be able to turn it into a web app. But I'm not much of a Node.js developer, so, after various unsuccessful attempts, I'm turning to you, to seek your help.

Figure out how to handle recurring tasks

OK, so let's think about recurring tasks again now that I'm a bit fresher.

In my experience, recurring tasks usually fall into one of these classifications (not accounting for outside-of-the-box thinking):

  • Task needs to be done every so often, and it must be done (true-recurring type)
  • Task should be done every so often (could-be-in-calendar-app-instead type)
  • Task is a periodic habit (habit-type). Extra points if they lie uncompleted and the recurrence piles up.

1 and 2 don't really belong in Habit. Todos have a due date, but they don't have any other concept of time per se. I'm not going to support the first two use cases in v1. Actually, I'm not going to support any of them, but I will support use case 3 first, probably via a tag where the user indicates they want to do with it. If it recurs anything-up-to-weekly, it will create a daily with the same recurrence.

Otherwise, I have two options:

  • Add them as {type: habit} and leave the user to their own devices. Maybe try to complete/postpone the remote tasks when the user does something. I'm not too confident about that, though.
  • Add all the occurrences as {type: todo}. This is probably what I'm going to do. I don't want to deal with recurrence. Let RTM do that. I think taskseries records actually contain all the recurring tasks within them, so that might make my life easier.

Anyone have any actual thoughts?

Test and document adding to cron

Could run like every half hour or so. Considering doing this myself. The invocation would be something like FORCE=1 /path/to/habitsync because it has to run non-interactively. I believe the authentication part simply bails if there's anything wrong, so it should exit gracefully in any case.

Support Google Tasks

Word on the street says that Any.do can synchronize with Google Tasks. I use Any.do, and I rather like it. I also need a good alternative task manager for when I develop my Big Idea, so this is in my interest. I would want those tasks to get synced with HabitRPG also.

Punch list for this:

  1. Investigate if Any.do really syncs with GTasks.
  2. Test it manually; what happens when I check off a GTask task? Does Any.do pick it up? Add and delete also.
  3. If all checks out, we continue. If not, might do it anyway. GTasks has a decent Android app, and I could live with it.
  4. Implement the standard functionality that RTM already has — add new, delete deleted, complete on GTasks when completed in Habit. Use the hts_gtasks key for custom metadata. hts_external_id and hts_external_source should reflect GTasks also. I didn't put them in there for nothing.
  5. Add logic to add a note saying where the task came from, or maybe prefix the task with the service abbreviation. This is because I might import some of my RTM tasks to GTasks, and I want to be able to distinguish them at a glance.

If you beat me to this, send me a pull request! Any.do is popular right? :)

Publish npm package

I've heard of this repository thing for Node.js modules, and there are even some scripts/binaries on there! I should get habitrpg-todo-sync up there! Also, it'd let me stop running it with an absolute path...

Anyone who has a good npm publish primer, sound off. I'll dig into it eventually.

Update tasks when we see changes from RTM

I'm expecting to improve the metadata we store for tasks, support due date, etc., but for tasks I've already imported this won't work. So I need a REFRESH environment variable. This will pull in the due date information (and whatever other stuff I might add later) for older tasks.

It will imply FULL_SYNC, but it will PUT tasks with appropriate updated values (if they differ) instead of skipping existing ones.

Handle undefined API responses properly

Sometimes I get undefined responses back from getTasks and completeTask. It might be the RTM API throttling itself, but it's confusing in any case. I need to handle the responses properly. Super Agent normally returns false for res.ok in these cases, but maybe we are getting 200 responses? I need to check for undefined responses in any case and act accordingly. Also for undefined task_ids. For some reason we're calling completeTask with undefined task_id fields sometimes.

Add web app

This is obviously a bad place for this since it'd have to be a new repo and stuff, but I'm starting to feel the need for this, and it'd be a nice place to play with my Angular skills.

I think v1 is just to put up an app that takes a user ID and API key (for Habit) and gets an auth token from RTM (for RTM). Then it calls habitsync in the background and just captures output and outputs it on the web view.

User input would be sanitized and I'd probably use some library designed for shelling out safely.

v2 would be to abstract out the common functionality into a library or something, make it all smarter.

would LOVE to try this, need help installing

Unlike the previous asker, I am in WAY over my head. If you have time to explain the installation procedure using very small words (for a n00b using Windows), I would very much appreciate it! Many many many thanks!

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.