Menu

#827 Add Feature: Import/Integrate Taskwarrior tasks

closed
nobody
2023-11-22
2017-02-08
Anonymous
No

Originally created by: phillc73

Taskwarrior is a task management tool mostly accessed from a terminal.

It'd be great if tasks could be integrated/imported from a Taskwarrior pending.data file. The import should not be a one off, one way import, but rather new tasks in Wekan should be synced back to the pending.data file and new files added to Taskwarrior from elsewhere should automatically appear in Wekan.

As a quick overview, it is possible to have a Taskserver which holds a master list of all tasks. Multiple remote machines can be used to view, add, edit tasks, and then synced back to the main server. As long as Taskwarrior was installed on the same server as Wekan, and syncing to a master server, there would be a Taskwarrior pending.data (pending tasks) file present.

There are very few viable UI tools for Taskwarrior. The only really useful one is inthe.am. While this is an open source tool, there are no installation instructions and the hosted version requires one to login with a Google account.

Perhaps this would form part of the long discussed Plugin system.

If this Feature was deemed viable, I'd be happy to work on requirements for mapping fields from a pending.data file to Wekan boards.

As an example of the format:

[description:"Important Birthday" due:"1480723100" entry:"1473174653" mask:"--" modified:"1484739219" priority:"H" project:"Personal.Family" recur:"yearly" status:"recurring" uuid:"2a3e26da-7964-44b5-b563-54c3d419654t"]

Also worth mentioning is Taskwarrior's JSON support, which might be an easier way forward.

Discussion

  • Anonymous

    Anonymous - 2017-02-10

    Originally posted by: xet7

    @phillc73

    Can you convert that Taskwarrior JSON export file to be same format as Trello JSON export file, that Wekan can already import?

     
  • Anonymous

    Anonymous - 2017-02-10

    Originally posted by: phillc73

    @xet7 Good question and I don't know. It's worth investigating that for sure.

     
  • Anonymous

    Anonymous - 2017-02-10

    Originally posted by: xet7

    @phillc73

    Yes, please do:

    1. Create some board at Trello
    2. Export board to .json file
    3. Look at the structure, what it would take to convert it with some tool or code.

    I have not used Taskwarrior.

     
  • Anonymous

    Anonymous - 2017-02-11

    Originally posted by: xet7

    @phillc73

    I think it's better to only look at git history with GUI like gitk, and see how import from Trello was implemented. Then modify it to create Import from Taskwarrior menu option for Wekan, and import Taskwarrior file directly without modifications. This is because Trello import option is most likely hardcoded for Trello file format and API.

     
  • Anonymous

    Anonymous - 2017-02-13

    Originally posted by: phillc73

    Here's an example of a Taskwarrior task exported in JSON:

    {"id":32,"description":"Change from RCurl to httr. See Gitlab issue 1","due":"20170318T230000Z","entry":"20160916T135831Z","modified":"20170208T204202Z","priority":"M","project":"Dev.abettor","status":"pending","uuid":"7b78936e-dd3b-43d2-8685-6b7892d35349","urgency":8.12192}
    

    Items can be exported individually or as an array. Further details on the Taskwarrior Export page.

     
  • Anonymous

    Anonymous - 2017-02-13

    Originally posted by: xet7

    @jLouzado

    How this would work with Custom Fields feature you are developing currently?

     
  • Anonymous

    Anonymous - 2017-02-14

    Originally posted by: jLouzado

    @xet7 well either @phillc73 codes the sync plugin between Wekan and Taskwarrior to map the fields between the two. In addition it could also search the 'Custom Fields' new collection (once it's been implemented) for matching fields and put the information there.

     
  • Anonymous

    Anonymous - 2017-02-14

    Originally posted by: phillc73

    @jLouzado Unfortunately I'm not a Meteor developer, so wouldn't be able to code the sync plugin.

     
  • Anonymous

    Anonymous - 2017-02-14

    Originally posted by: phillc73

    Yes, it probably is quite niche as I don't guess many other potential Wekan users are currently using Taskwarrior.

    My use case is that while Taskwarrior is quite useful as a ToDo list manager, once the number of tasks/project starts to grow I'm finding it a bit overwhelming and would like a more visual approach.

    Having said that, Taskwarrior has its following and good UIs are few and far between. I like that Taskwarrior syncs between different devices very easily, and I can add/manage my tasks directly from a terminal.

    I've used both Trello, Kanboard and GitLab's Issue Board before, but do like the Wekan UI (I like the Trello UI too, but would prefer an open source self hosted tool).

    If I was to prioritise my enhancement requests something like [#826] or [#808] would be top, I'd probably be quite satisfied to take the time and manually copy across my Taskwarrior items into a Wekan instance. Having a quick "Today" or "Next" list based on Due Date is pretty useful for me, whereas the kanban flow works better when planning ahead.

    Therefore, if this import feature is no feasible right now, I'm happy enough to see it put on hold.

     
  • Anonymous

    Anonymous - 2017-02-14

    Originally posted by: xet7

    @jLouzado

    You can continue working on Custom Fields etc.

    I'll think what it would take to implement Taskwarrior import.

     
  • Anonymous

    Anonymous - 2021-03-05

    Originally posted by: ahillio

    @phillc73 are you still interested in connecting TaskWarrior to Wekan? Wekan has an API that would allow TaskWarrior hooks to utilize... no need to know Meteor or JS at all. I'm not sure what kind of 2-way communication would be possible, but it looks like 1-way from TaskWarrior to Wekan would be a standard use-case of the API (though I haven't yet tried this out myself so I can't say for sure).

     
  • Anonymous

    Anonymous - 2021-03-06

    Originally posted by: xet7

    @ahillio

    Here is example of adding card with Wekan API:
    https://github.com/wekan/wekan/blob/master/api.py

    What kind of hooks TaskWarrior has?

     
  • Anonymous

    Anonymous - 2021-03-06

    Originally posted by: ahillio

    Nice, thanks for the example!

    Taskwarrior has hooks triggered on 4 events... the on modify and on add hooks are the ones that are useful in this case. All that's required to utilize a hook is placing a properly named executable script in the ~/.task/hooks directory (similar to how a git hook gets "installed").

    Timewarrior was made by the same team that made Taskwarrior, intending them to be used together, and their integration is acheived via an on-modify script that looks like this:

    #!/usr/bin/python
    # file named:
    # on-modify.timewarrior
    import sys
    import json
    import os
    
    # Hook should extract all of the following for use as Timewarrior tags:
    #   UUID
    #   Project
    #   Tags
    #   Description
    #   UDAs
    
    # Make no changes to the task, simply observe.
    old = json.loads(sys.stdin.readline())
    new = json.loads(sys.stdin.readline())
    print(json.dumps(new))
    
    # Extract attributes for use as tags.
    tags = [new['description']]
    
    if 'project' in new:
        project = new['project']
        tags.append(project)
        if '.' in project:
            tags.extend([tag for tag in project.split('.')])
    
    if 'tags' in new:
        tags.extend(new['tags'])
    
    combined = ' '.join(['"%s"' % tag for tag in tags]).encode('utf-8').strip()
    
    # Started task.
    if 'start' in new and not 'start' in old:
        os.system('timew start ' + combined.decode() + ' :yes')
    
    # Stopped task.
    elif not 'start' in new and 'start' in old:
        os.system('timew stop ' + combined.decode() + ' :yes')
    
    # Any task that is active, with a non-pending status should not be tracked.
    elif 'start' in new and new['status'] != 'pending':
        os.system('timew stop ' + combined.decode() + ' :yes')
    

    Some documentation on Taskwarrior hooks is here:

     
  • Anonymous

    Anonymous - 2021-03-06

    Originally posted by: ahillio

    @xet7 wow, excited to see Wekan's webhooks... are there any examples of Wekan webhooks invoking a shell command? For example, if Wekan is installed on the same computer as Taskwarrior (if locally, or if remote then on same computer as TaskServer) it wouldn't need to send data to an external API as it could just issue a Unix(like) shell command. Is that possible? Or would it require some other mechanism, perhaps like https://github.com/adnanh/webhook?

     
  • Anonymous

    Anonymous - 2021-03-06

    Originally posted by: xet7

    @ahillio

    I would prefer Wekan itself would not execute shell commands, that sounds kind of dangerous. Also if Wekan is inside some container like Snap/Docker/SandstormGrain, then it can not access anything outside that sandbox, it can only write to directory where are database files, and it's subdirectories. I would recommend that webhook receiver code does some validation about what commands to execute.

    It would be better that some webhook receiver is at localhost port.

    You can use anything to receive webhook I think?

    See right menu Webhooks at https://github.com/wekan/wekan/wiki . There is also Global Webhooks at Admin Panel, limiting webhook data, etc.

    Wekan does send most board actions to webhooks. There are still some open issues that not everything is sent yet to webhook, like changes to card description, but anyone could add those missing webhooks, I did add some tips those webhook issues.

     
  • Anonymous

    Anonymous - 2021-03-06

    Originally posted by: xet7

    Usually inside container Wekan code itself is read-only, it's not possible to install plugins in-the-fly. Well, in theory, Wekan could write new Javascript code to writeable database directory and then eval it, but that could be dangerous.

     
  • Anonymous

    Anonymous - 2023-11-22
     
  • Anonymous

    Anonymous - 2023-11-22

    Ticket changed by: xet7

    • status: open --> closed
     

Log in to post a comment.