TaskLite icon indicating copy to clipboard operation
TaskLite copied to clipboard

[Questions] Plans and design

Open ngortheone opened this issue 5 years ago β€’ 34 comments

Hey @ad-si

I am excited to see this project. I was thinking myself of re-implementing taskwarrior in a more safe language (Rust was on my mind) so this project makes me very curious. I am particularly interested in some architectural/design decisions.

  • What is your plan for sync between different devices? Is it planned? How do you plan to perform merging and conflict-resolution? Is it going to be client-server or p2p?

  • What is your plan about mobile devices? An app like this would benefit greatly from being present not only on desktop/web but on android (and maybe even iOS :) This is my main dissatisfaction with taskwarrior - absence of a supported mobile client. (And also a story around provisoning certs for mobile - PITA).

My knowledge of Haskell is near-zero (sadly), how is it suitable for mobile development? If it is not very well suited I'd imagine that you will need to write a separate client in different language and probably port the data structures (things like protobuf come to mind)...

ngortheone avatar Sep 12 '19 03:09 ngortheone

Hi @ngortheone, glad to hear 😁.

Rust was on my mind

Rust as a gateway drug to Haskell πŸ˜‰

What is your plan for sync between different devices? Is it planned? How do you plan to perform merging and conflict-resolution? Is it going to be client-server or p2p?

At the moment I simply have the SQLite database in Dropbox, and so far it worked astonishingly well. πŸ˜…Mid term I plan to include a file mode (where each task is stored in a file) and git sync (git pull before and git push after changes). Or host it as a webapp (PureScript is a really good solution for it nowadays), which makes syncing unnecessary (but of course reduces it to online only). Long term I hope to be able to use something like https://github.com/canonical/dqlite.

What is your plan about mobile devices? An app like this would benefit greatly from being present not only on desktop/web but on android (and maybe even iOS :) This is my main dissatisfaction with taskwarrior - absence of a supported mobile client. (And also a story around provisoning certs for mobile - PITA).

For mobile my short term plan is to use a Telegram bot, an iOS shortcuts app (https://support.apple.com/guide/shortcuts), or a webapp. I'm still trying out what works best. Mid term a Flutter app might maybe be a good solution. Long term some companies are nowadays even writing mobile apps with Haskell (http://keera.co.uk/blog/2017/06/01/haskell-android-ios/), so this would of course be awesome 😁.

My knowledge of Haskell is near-zero

Learning Haskell was one of my most satisfying developer experiences. You should give it a try. πŸ˜‰. Let me know if you need any help!

ad-si avatar Sep 24 '19 22:09 ad-si

What about support for complex priorities (combination of priorities for the task and tags) or urgency similar to TaskWarrior?

dbogdanov avatar Oct 06 '19 01:10 dbogdanov

Also, is there plans for support for notes?

dbogdanov avatar Oct 06 '19 02:10 dbogdanov

What about support for complex priorities (combination of priorities for the task and tags) or urgency similar to TaskWarrior?

Is already implemented to a large part: https://tasklite.org/concepts.html#priority 😁

Also, is there plans for support for notes?

Already supported! => https://tasklite.org/concepts.html#notes 😁

ad-si avatar Oct 06 '19 13:10 ad-si

Great! I am considering a use-case, where I can specify priority boost value for different tags. And then have a possibility to define a custom final task priority formula via configuration.

By notes I am referring to functionality similar to taskopen, being able to edit the attached notes in any text editor, etc.

dbogdanov avatar Oct 06 '19 20:10 dbogdanov

Where I can specify priority boost value for different tags. And then have a possibility to define a custom final task priority formula via configuration.

Well, that's not easily available yet. However, the code for priority calculation is embedded in the SQLite database as SQL. Therefore you can change it via the sqlite CLI or a GUI like https://sqlitebrowser.org. I'd recommend that you try out my priority algorithm, maybe it's good enough, and if you find any really bad values, I'd be happy to improve it with you. If certain tags are much more important, how about you filter for them to have a focused view on your crucial tasks?

By notes I am referring to functionality similar to taskopen, being able to edit the attached notes in any text editor, etc.

  • Opening a task or a note in your default editor is already planed, but not yet available
  • Opening a link / file mentioned in the task note should already be a feature of your Terminal. E.g. called Actions in iTerm (https://www.iterm2.com/documentation-smart-selection.html)

ad-si avatar Oct 06 '19 20:10 ad-si

Are you planning on adding some kind of time tracking?

LeonB avatar Oct 21 '19 12:10 LeonB

@LeonB It already includes rudimentary time tracking support:

start                    Add a note that work on task was started
stop                     Add a note that work on task was stopped

But there isn't any integrated way to analyze the data yet πŸ˜…

ad-si avatar Oct 21 '19 13:10 ad-si

@ad-si aweseome! I'm looking for some kind of timesheet reporting for my boss. To show how much time was spent on certain tasks.

LeonB avatar Oct 21 '19 14:10 LeonB

Well it definitely works already:

$ tl start mn1
πŸ—’  Added a note to task "buy milk" with id "01dqqc19m7kyv8z4fd6g116mn1"
$ tl stop mn1
πŸ—’  Added a note to task "buy milk" with id "01dqqc19m7kyv8z4fd6g116mn1"
$ tl info mn1
awake_utc: null
review_utc: null
state: null
repetition_duration: null
recurrence_duration: null
body: buy milk
user: adrian
ulid: 01dqqc19m7kyv8z4fd6g116mn1
modified_utc: 2019-10-21 14:38:11
group_ulid: null
closed_utc: null
priority_adjustment: null
metadata: null
waiting_utc: null
ready_utc: null
due_utc: null
priority: 1.0
tags:

notes:
  - note: start
    ulid: 01dqqc1gd88fef71cwttbrv3bz

  - note: stop
    ulid: 01dqqc22bgktwy6c5ek07pd2s4

So feel free to use it 😁. For better reporting you can either submit a PR with an implementation (πŸ˜‰), convince me that it's really high prio and I should implement it ASAP (πŸ˜›), hack together a small SQL query to analyze it (run with tl runsql), or hack together some bash script or similar to analyze the CSV or JSON output of TaskLite. (There is also the tl ulid2utc command to convert ULIDs to their timestamp)

ad-si avatar Oct 21 '19 14:10 ad-si

Are there any plans to add hooks? I use them pretty extensively to extend Taskwarrior's functionality and sync with other services.

robwhitaker avatar Jan 12 '20 15:01 robwhitaker

@robwhitaker Definitely! I might implement details a little different than Taskwarrior (e.g. post- and pre- prefixes instead on on-), but overall it should be pretty similar.

What kind of scripts do you currently use? Would be cool to have a list of good ones to keep in mind while implementing it!

ad-si avatar Jan 12 '20 17:01 ad-si

@ad-si I actually have all my hooks in my dotfiles repo if you want to check them out, but in short, I use hooks for the following:

  • Sync my ~/.task folder with git on launch (pull from remote) and on exit (push to remote)
  • A couple hooks needed by my taskwarrior-habitica-bridge project to copy/sync tasks between Taskwarrior and Habitica
  • Refresh some custom displays whenever I run a task command
  • Show messages from a little message server I have running after each task command (used for messages indirectly generated by interacting with my tasks, e.g. as a result of a Habitica web hook)

robwhitaker avatar Jan 12 '20 18:01 robwhitaker

@ad-si I actually have all my hooks in my dotfiles repo if you want to check them out

Great! Definitely will have them as reference during implementation.

  • Sync my ~/.task folder with git on launch (pull from remote) and on exit (push to remote)

I actually want to provide first class support for this since it's such a common use case. But a implementation with hooks could probably be a good stepping stone (or maybe even the better solution, since it allows it to be more customizable by the user πŸ€”). Hooks has a higher priority so we can try it out then how it works...

  • A couple hooks needed by my taskwarrior-habitica-bridge project to copy/sync tasks between Taskwarrior and Habitica
  • Refresh some custom displays whenever I run a task command
  • Show messages from a little message server I have running after each task command (used for messages indirectly generated by interacting with my tasks, e.g. as a result of a Habitica web hook)

Nice stuff! I haven't gotten much into hooks with Taskwarrior, but definitely looks like I should when its implemented with TaskLite 😁

One thing I'm still contemplating is whether I should add support for hooks to be stored in the database in a scripting language which are then executed by Taskwarrior. They could e.g. be written in Lua (https://hackage.haskell.org/package/hslua) or Dhall (https://dhall-lang.org/). I always disliked the system for git hooks, in which they are not part of the project and everybody had to install them themselves.

ad-si avatar Jan 12 '20 19:01 ad-si

The more I think about it the better I like the idea of storing them in the database and using Dhall as hook language. It can even be extended with custom functions: https://docs.dhall-lang.org/howtos/How-to-add-a-new-built-in-function.html. This could lead to a collection of useful Dhall hook scripts that anyone can use, since they are executed by TaskLite and have no additional requirements for the system setup like installed interpreters and so on.

ad-si avatar Jan 12 '20 20:01 ad-si

@ad-si Dhall is very cool as a configuration language, but I can't say I like the idea of trying to use it for general purpose scripting. Maybe it's just inexperience talking, but from the bit I've used Dhall, it feels like things that would be very basic in a general purpose language become very hard to do in Dhall because it's not designed for that purpose. I think Lua would be the better option, if you want to go with only having hooks in one language.

Incidentally, I've been toying with the idea of using Nix as the basis for a Taskwarrior plugin manager. That approach would allow writing hooks and other Taskwarrior scripts in any language with whatever dependencies they require. As long as each plugin defines a default.nix for itself that describes how to build/run it, it doesn't matter what the end-user has installed on their system. As long as they have Nix, it could handle the interpreters/compilers/environment around the plugin automatically.

robwhitaker avatar Jan 13 '20 00:01 robwhitaker

it feels like things that would be very basic in a general purpose language become very hard to do in Dhall because it's not designed for that purpose

Dhall has become quite powerful by now, but yeah, there will definitely a few custom functions be needed to make it complete. But as far as I can tell there is no fundamental limit!

As long as they have Nix, it could handle the interpreters/compilers/environment around the plugin automatically.

Also there is always the option to distribute Docker images…

So yeah, going with an external hook system, is probably the better solution for the beginning. If we find a way to integrate Dhall or Lua natively later, also cool, but at least we don't unnecessarily postpone the feature right now…

Expect a first implementation soon! πŸ˜Šβ€¦or if you've got some time I'd of course also be happy about a merge request πŸ˜‰

ad-si avatar Jan 13 '20 21:01 ad-si

Dhall has become quite powerful by now, but yeah, there will definitely a few custom functions be needed to make it complete. But as far as I can tell there is no fundamental limit!

I don't know too much about extending Dhall. I'd like to look into that when I get some time. But even so, the other issue I see with (exclusively) using a language like Dhall is potentially alienating would-be hook developers (I suspect a lot of people would find Dhall intimidating) and accidentally decreasing the number of shared hook scripts instead of building up a nice collection.

Also there is always the option to distribute Docker images…

True! Docker is another option and certainly one more people would be familiar with. Maybe, with some cleverness, TaskLite could even use Docker under the hood to handle different hook script dependencies.

Expect a first implementation soon! :blush:…or if you've got some time I'd of course also be happy about a merge request :wink:

Looking forward to it! I'd actually love to contribute to TaskLite at some point, but I think you'll probably beat me to this feature :laughing:

robwhitaker avatar Jan 14 '20 22:01 robwhitaker

First off, this project looks great; thank you for putting it together. I'll throw in a few questions of my own (/feature requests, I suppose) that pertain to my workflow.

Do you have any plans to add something akin to Taskwarrior's user defined attributes?

I use a Pomodoro-style workflow in which I track the number of pomodoros it takes to finish a given task. With Taskwarrior I define a numeric UDA to capture this. I suppose I could use a number of tags: 1pomo, 2pomo, 3pomo, ... but that is quite inelegant and would quickly get out of hand for other relevant attributes: estimated pomodoro count, distraction count, etc.

Learning Haskell was one of my most satisfying developer experiences. You should give it a try. wink. Let me know if you need any help!

You've inspired me. I've always written CLI apps in Python but was considering something else for my next side-project. Is Learn You A Haskell for Great Good still the best learning resource?

distefam avatar Feb 08 '20 02:02 distefam

Thank you for the kind words @distefam 😊.

It is already supported in the form of a metadata field! I just added some documentation for it to the website: https://tasklite.org/usage/cli.html#metadata

The tooling around it is still a little lacking, but with a few bash aliases I think you can hack up a good solution in no time.

You've inspired me. I've always written CLI apps in Python but was considering something else for my next side-project. Is Learn You A Haskell for Great Good still the best learning resource?

That's great! 😁Haskell is a real pleasure to work with, you won't regret it. On how to best start: Lets say the opinions differ πŸ˜…. I really enjoyed "Learn You A Haskell for Great Good", but I already had some exposure to Haskell, because a friend of mine was pitching it to me constantly πŸ˜‚. If you're completely new to purely functional programming (the purely is important), then I actually feel like the best way to get started is to learn Elm first (https://elm-lang.org/). It is basically a subset of Haskell without any of the archaic trip ups, with the best error messages of any programming language, an awesome online getting started guide (https://guide.elm-lang.org/), and a gread online IDE (https://ellie-app.com/), which means you can get started without having to install anything. Once you've learned this it's much easier to make the jump to Haskell. (And on the way you've learned - what is in my opinion - the best way to build webapps currently). Have fun! 😁(and feel free to come back to me if you need help with anything!)

ad-si avatar Feb 08 '20 21:02 ad-si

That's great, thank you for letting me know and updating the docs to explain it better. I've looked into it and I am considering writing a tool dedicated to using an existing task database with the Pomodoro method.

I think that decoupling these two tools makes a lot of sense, not only from a Unix-philosophy standpoint, but also because it will work better. What I have in mind is that TaskLite would be the task management tool and read/write from the database of tasks while a separate pomodoro tool would write to another table in the same database with an entry for each pomodoro completed and a relationship to a task in the Tasklite table. This would nicely decouple things and also allow for more robust reporting. I have to think of this a bit more before I commit to it but that's where my thoughts are leading me at the moment.

Thank you for the feedback regarding Haskell, Elm, and purely functional programming. I'll dive in when I get the chance!

On Sat, Feb 8, 2020, at 1:16 PM, Adrian Sieber wrote:

Thanks you for the kind words @distefam https://github.com/distefam 😊.

It is already supported in the form of a metadata field! I just added some documentation for it to the website: https://tasklite.org/usage/cli.html#metadata

The tooling around it is still a little lacking, but with a few bash aliases I think you can hack up a good solution in no time.

You've inspired me. I've always written CLI apps in Python but was considering something else for my next side-project. Is Learn You A Haskell for Great Good still the best learning resource?

That's great! 😁Haskell is a real pleasure to work with, you won't regret it. On how to best start: Lets say the opinions differ πŸ˜…. I really enjoyed "Learn You A Haskell for Great Good", but I already had some exposure to Haskell, because a friend of mine was pitching it to me constantly πŸ˜‚. If you're completely new to purely functional programming (the purely is important), then I actually feel like the best way to get started is to learn Elm first (https://elm-lang.org/). It is basically a subset of Haskell without any of the archaic trip ups, with the best error messages of any programming language, an awesome online getting started guide (https://guide.elm-lang.org/), and a gread online IDE (https://ellie-app.com/), which means you can get started without having to install anything. Once you've learned this it's much easier to make the jump to Haskell. (And on the way you've learned - what is in my opinion - the best way to build webapps currently). Have fun! 😁(and feel free to come back to me if you need help with anything!)

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ad-si/TaskLite/issues/2?email_source=notifications&email_token=AAAQAI33LNGHJNSEYYMJUWDRB4OMBA5CNFSM4IV56KJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELF33CI#issuecomment-583777673, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQAI7MCSQQL6OCNK3Z73LRB4OMBANCNFSM4IV56KJQ.

distefam avatar Feb 10 '20 18:02 distefam

Sounds like a great idea @distefam . This is exactly the kind of extensions I was hoping to foster with the modular and extendable architecture of TaskLite 😁. I also want to allow first class subcommands like git does:

$ cat /usr/local/bin/git-grin
#! /usr/bin/env bash

echo '😁'

$ git grin
😁

Created an issue for it: https://github.com/ad-si/TaskLite/issues/9

ad-si avatar Feb 12 '20 14:02 ad-si

This is exactly the kind of extensions I was hoping to foster with the modular and extendable architecture of TaskLite

Do you have any way you'd prefer extensions to be architected? I only see the "Haskell API" bit on the docs page, which is a bit sparse. Quick and dirty would be to just build a CLI tool in Python (I'm already familiar with writing CLI tools with Python-click) that would access the existing database and write to a separate table but I don't think this is what you had in mind with "modular and extendable architecture of Tasklite". Happy to follow your lead, even (especially?) if it means an opportunity to learn a new language :grin:.

distefam avatar Feb 12 '20 20:02 distefam

Do you have any way you'd prefer extensions to be architected? I only see the "Haskell API" bit on the docs page, which is a bit sparse. Quick and dirty would be to just build a CLI tool in Python (I'm already familiar with writing CLI tools with Python-click) that would access the existing database and write to a separate table but I don't think this is what you had in mind with "modular and extendable architecture of Tasklite".

Well, originally my idea was to implement all core features in SQLite and build the Haskell CLI only has a wrapper to make using it easier. However, I wasn't aware how limited SQLite is, so by now a few core algorithms are implemented in Haskell. Yet, I still consider the database schema etc. part of the public API of TaskLite. So building a CLI tool in Python accessing the existing database is actually a way of doing it I'd like to support. Your script might then also be coupled via hooks: https://github.com/ad-si/TaskLite/issues/10

Happy to follow your lead, even (especially?) if it means an opportunity to learn a new language 😁.

Implementing the hook system would be the most important next step for enabling extensions! Any PRs for this are very welcome 😁

ad-si avatar Feb 15 '20 12:02 ad-si

So building a CLI tool in Python accessing the existing database is actually a way of doing it I'd like to support.

@ad-si @distefam I think it makes sense for extensions to use the same database, but as far as creating new tables goes, there should probably be a standard naming scheme so different extensions don't accidentally become incompatible by using the same tables (e.g. two different extensions both try to create a "Comments" table).

robwhitaker avatar Feb 15 '20 23:02 robwhitaker

Good point. Changing or extending the schema should be governed by some rules. Most obvious being: existing fields must not be changed. New tables and fields must be namespaced with the name of the extension

ad-si avatar Feb 16 '20 09:02 ad-si

Having been playing with TaskLite a bit recently, I think it would be nice if notes could be read from stdin if no text is provided. It would allow for stuff like:

$ tasklite note a18 <<< cat << EOM
> This is line one of a longer, multiline note.
>
> And here's line 3!
> EOM

The same is possible currently but it's a lot less pretty and a lot easier to mess up:

$ tasklite note "$(cat << EOM
> This is line one of a longer, multiline note.
>
> And here's line 3!
> EOM
> )" a18

robwhitaker avatar Feb 16 '20 16:02 robwhitaker

So, I also went on a quest once I had tried and lost trust in taskwarrior: https://github.com/xerus2000/howtodo

But now that I finally started using tasklite I see problems similar to my issues with taskwarrior:

  • No first-class customization (instead predefined commands like watch and read that should really be defined in an internal alias system similar to #9 or even like aliases in a git config)
  • More verbose CLI: To add a recurring/repeating task, you need two commands
  • No typesafe, first-class support for custom attributes

xeruf avatar Sep 04 '20 23:09 xeruf

Thanks for your feedback @xerus2000! My thoughts on it:

  • Not a fan of that issue anymore actually. I think we should simply use shell aliases for this. There is a short example in the documentation: https://tasklite.org/usage/cli.html#context--views. How would TaskLite aliases be better? So maybe the shortcuts should be removed completely?
  • This will be added to the shortcut syntax. So you can execute tl add Pay rent due:2020-10-03 recur:p1m
  • Yeah agree, type safety would be cool! Created an issue for it: https://github.com/ad-si/TaskLite/issues/25

ad-si avatar Sep 05 '20 20:09 ad-si

I already have far too many shell aliases. I think that quickly gets cluttered.

Also, native support enables tighter integration. I am still trying to flesh out the details, but here's the gist of what I'm thinking of: https://github.com/xerus2000/howtodo/blob/master/plans.md#commands

xeruf avatar Sep 05 '20 21:09 xeruf