Skip to content

Commit

Permalink
Merge pull request #328 from imdone/1.33.0/import-tasks
Browse files Browse the repository at this point in the history
1.33.0/import tasks
  • Loading branch information
piascikj committed Sep 11, 2023
2 parents 0753e4b + 9de3a93 commit e17c7cd
Show file tree
Hide file tree
Showing 23 changed files with 782 additions and 217 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ tmp
.env
.DS_Store
debug.md

backlog/.imdone
backlog/stories
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![Downloads](https://img.shields.io/npm/dm/imdone-core.svg)](https://npmjs.org/package/imdone-core)
[![Build Status](https://github.com/imdone/imdone-core/actions/workflows/ci.yml/badge.svg)

Imdone is text based kanban processor with a simple syntax that uses [comment tags like TODO and FIXME](https://en.wikipedia.org/wiki/Comment_%28computer_programming%29#Tags) and [todo.txt format](https://github.com/todotxt/todo.txt#todotxt-format). This model allows the user to create and modify tasks using the keyboard and automatically establishes a link between their tasks and work. Get [imdone](https://imdone.io) to see your projects board and this library in action.
Imdone is text based kanban processor with a simple syntax that uses [comment tags like TODO and FIXME](https://en.wikipedia.org/wiki/Comment_%28computer_programming%29#Tags) and [todo.txt format](https://github.com/todotxt/todo.txt#todotxt-format). This model allows the user to create and modify tasks using the keyboard and automatically establishes a link between their tasks and work. Get [imdone](https://imdone.io) or use the cli to see your projects board and this library in action.

![imdone-screenshot.png (5120×2838)](https://imdone.io/docs/images/card-anatomy.png)

Expand Down
58 changes: 0 additions & 58 deletions backlog/.imdone/config.yml

This file was deleted.

17 changes: 0 additions & 17 deletions backlog/.imdone/properties/card.js

This file was deleted.

139 changes: 139 additions & 0 deletions backlog/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
imdone backlog
====

This directory contains folders for each backlog item.

## Work on a story
### After collaborative design, import a story and story tasks from markdown
```bash
npx imdone import <<EOF ─╯
# story-id
This is the story description.
## Tasks
- [ ] An unfinished task
### Phase one (Interfaces)
- [x] A task in phase one
- [ ] Another task in phase one
- [ ] A sub task in phase one
Some more data about the task
### Phase two (Implementation)
- [ ] A task in phase two
EOF
```
- [x] `./backlog` is the default project folder
- [x] Initialize imdone in the backlog folder
- [x] `<story-id>` should be the markdown title
- [x] On import always remove the contents of the `backlog/story/<story-id>`
- [x] Shold handle a file with the following format
- [x] Make sure checked items are put in DONE list
```markdown
# <story-id>

This is the story summary

## Tasks
- [ ] An ungrouped task

### <group>
- [ ] A task in a group

### <group>
- [ ] A task in a group
```
- [x] use `markdown-it.parse` to create AST
- [x] Save story-id project path so it's available for starting a task

### Day to day work after collaborative story design

#### Start a task
```bash
npx imdone start <task-id>
```
- [ ] This should find the task and create a branch named `story/<sid>/<group>/<task id>/<task filname>`
- [ ] Move the task to the `DOING` list
- [ ] If the branch exists, check it out
- [ ] Set the task id in session so we know what to close
- [ ] Save the branch name in session so we can check it out again

#### Add breadcrumbs for the next developer or ensemble
1. Open the file with the same name as the branch under backlog and add content!!!
2. commit and push the branch or run `mob done`

#### Complete a task
```bash
npx imdone done
```

#### List tasks in a story
```bash
npx imdone ls -p backlog -s <story-id>
```
- [ ] `./backlog` is the default project folder
- [ ] If the current branch starts with `story/`, parse the story id from the branch name
- [ ] If story from branch name isn't found and If the storyId is in the session use it
- [ ] Can also pass in the story id with the `-s <story-id> option
- [ ] Can also use the filter option

#### List tasks in a story and group
```bash
npx imdone ls -p backlog -s <story-id> -g <group>
```
- [ ] `./backlog` is the default project folder
- [ ] If the current branch starts with `story/`, parse the story id and group from the branch name
- [ ] Can also use the filter option

#### Update task

##### With the CLI
```bash
npx imdone update task -p backlog -g <new group> <task-id> <new text>
```
- [ ] This should move a task to a different group and/or change it's text

## Adding tasks without import

### Initializing a backlog
```bash
npx imdone init -p backlog
```
- [ ] `./backlog` is the default project folder
- [ ] Make `devops/imdone` the defaults for init

### Add a story
Run this from the root of the project to add a story
```bash
npx imdone add story -p backlog -s <story id> -l BACKLOG "Add a story from the command line"
```
- [ ] `./backlog` is the default project folder
- [ ] This should initialize a new imdone project in `backlog/<story-id>`
- [ ] Create a task for the story and return the meta sid
- [ ] The task should be in `backlog/story/<story-id>/README.md`
- [ ] The task should have `task-id:<random 5 char string>` meta and `story` tag

### Add a story task
```bash
npx imdone add task -p backlog -s <story-id> -l TODO "Add a story task from the command line"
```
- [ ] `./backlog` is the default project folder
- [ ] This should initialize a new imdone project in `backlog/story/<story-id>/ungrouped`, containing a task with `task-id:<random 5 char string>` and `story-id:<story-id>` meta and return the <task-id>
- [ ] use default list if no list is present

### List task groups for a story
Use ls to list the directories in `backlog/story/<story-id>`

### Add a story task to a group
```bash
npx imdone add task -p backlog -s <story sid> -g "<task group>" -l TODO "Add a story task with group from the command line"
```
- [ ] `./backlog` is the default project folder
- [ ] This should initialize a new imdone project in `backlog/story/<story sid>/<task group>`, containing a task with `story-id:<story-id>`, `group:<task group>` and `task-id:<random 5 char string>` meta and return the <task-id>
- [ ] use default list if no list is present

#### With the UI
- Open the story folder as a project in imdone
- Under board actions select the **Create task in <group>** from the menu

66 changes: 55 additions & 11 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,87 @@
#!/usr/bin/env node

const { program } = require('commander');
const { imdoneInit, addTask, listTasks } = require('./lib/controlers/CliControler')
const {
DEFAULT_CONFIG_PATH,
imdoneInit,
importMarkdown,
startTask,
addTask,
listTasks
} = require('./lib/cli/CliControler')
const package = require('./package.json')
const path = require('path')

const { log, info, warn, logQueue } = hideLogs()
const PROJECT_OPTION = '-p, --project-path <path>'
const PROJECT_OPTION_DESCRIPTION = 'The path to the imdone project'
const CONFIG_OPTION = '-c, --config-path <path>'
const CONFIG_OPTION_DESCRIPTION = 'The path to the imdone config file'

// TODO ## Add an option to add properties/card.js
program
.version(package.version, '-v, --version', 'output the current version')
.command('init')
.description('initialize imdone project')
.option('-p, --project-path <path>', 'The path to the imdone project')
.option('-c, --config-path <path>', 'The path to the imdone config file')
.option(PROJECT_OPTION, PROJECT_OPTION_DESCRIPTION)
.option(CONFIG_OPTION, CONFIG_OPTION_DESCRIPTION, DEFAULT_CONFIG_PATH)
.action(async function () {
let { projectPath = process.env.PWD, configPath } = this.opts()
await imdoneInit(projectPath, configPath)
let { projectPath, configPath } = this.opts()
await imdoneInit({projectPath, configPath})
})

program
.command('import')
.description('import markdown from STDIN')
.option(PROJECT_OPTION, PROJECT_OPTION_DESCRIPTION)
.action(async function () {
let { projectPath } = this.opts()
const isTTY = process.stdin.isTTY;
const stdin = process.stdin;
if (isTTY) return console.error('Markdown must be provided as stdin')

var markdown = '';

stdin.on('readable', function() {
var chunk = stdin.read();
if(chunk !== null){
markdown += chunk;
}
});
stdin.on('end', async function() {
await importMarkdown(projectPath, markdown, log)
});
})

program
.command('start <task-id>')
.description('start a task by id')
.option(PROJECT_OPTION, PROJECT_OPTION_DESCRIPTION)
.action(async function () {
const taskId = this.args[0]
let { projectPath } = this.opts()
await startTask(projectPath, taskId, log)
})

program
.command('add <task>')
.description('add a task')
.option('-p, --project-path <path>', 'The path to the imdone project')
.option(PROJECT_OPTION, PROJECT_OPTION_DESCRIPTION)
.option('-l, --list <list>', 'The task list to use')
.option('-t, --tags <tags...>', 'The tags to use')
.option('-c, --contexts <contexts...>', 'The contexts to use')
.action(async function () {
let { projectPath = process.env.PWD, list, tags, contexts } = this.opts()
await addTask(this.args[0], projectPath, list, tags, contexts)
let { projectPath, list, tags, contexts } = this.opts()
await addTask({task: this.args[0], projectPath, list, tags, contexts, log})
})

program
.command('ls')
.description('list tasks')
.option('-p, --project-path <path>', 'The path to the imdone project')
.option(PROJECT_OPTION, PROJECT_OPTION_DESCRIPTION)
.option('-f, --filter <filter>', 'The filter to use')
.option('-j, --json', 'Output as json')
.action(async function () {
let { projectPath = process.env.PWD, filter, json } = this.opts()
let { projectPath, filter, json } = this.opts()
await listTasks(projectPath, filter, json, log)
})
program.parse();
Expand Down
19 changes: 19 additions & 0 deletions devops/imdone/actions/board.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = function (task) {
const project = this.project
const groups = [...new Set(
project.getCards('meta.group = *').map((card) => card.meta.group && card.meta.group[0])
)].map(group => {
const name = group
const value = `"${group}"`
return { name, value}
})
return [{name: 'All tasks', value: '*'}, ...groups].map((group) => {
const filterValue = encodeURIComponent(`meta.group = ${group.value} or tags = story`)
return {
title: group.name,
action: function () {
project.openUrl(`imdone://active.repo?filter=${filterValue}`)
}
}
})
}
4 changes: 4 additions & 0 deletions devops/imdone/actions/card.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = function (task) {
const project = this.project
return []
}
Loading

0 comments on commit e17c7cd

Please sign in to comment.