@basementuniverse/kanbn 0.9.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/commands/burndown.txt +7 -1
- package/docs/commands/gantt.txt +36 -0
- package/docs/commands/help.txt +1 -0
- package/docs/index-structure.md +20 -1
- package/docs/quick-start.md +1 -1
- package/docs/task-structure.md +47 -0
- package/example/.kanbn/index.md +63 -0
- package/example/.kanbn/tasks/add-basic-activity-feed.md +53 -0
- package/example/.kanbn/tasks/add-passwordless-login-option.md +34 -0
- package/example/.kanbn/tasks/add-usage-alert-email-thresholds.md +35 -0
- package/example/.kanbn/tasks/build-email-template-system.md +30 -0
- package/example/.kanbn/tasks/build-invoice-download-endpoint.md +43 -0
- package/example/.kanbn/tasks/build-tenant-settings-page.md +48 -0
- package/example/.kanbn/tasks/create-organization-switcher.md +53 -0
- package/example/.kanbn/tasks/create-sandbox-environment-provisioner.md +36 -0
- package/example/.kanbn/tasks/create-self-serve-cancellation-flow.md +38 -0
- package/example/.kanbn/tasks/define-product-pricing-strategy.md +37 -0
- package/example/.kanbn/tasks/design-onboarding-checklist.md +30 -0
- package/example/.kanbn/tasks/design-team-invite-expiry-flow.md +33 -0
- package/example/.kanbn/tasks/implement-data-retention-policy-jobs.md +30 -0
- package/example/.kanbn/tasks/implement-feature-flags-foundation.md +36 -0
- package/example/.kanbn/tasks/implement-project-creation-wizard.md +44 -0
- package/example/.kanbn/tasks/implement-stripe-webhook-signature-check.md +54 -0
- package/example/.kanbn/tasks/implement-team-permissions-ui.md +57 -0
- package/example/.kanbn/tasks/implement-user-signup-and-login.md +62 -0
- package/example/.kanbn/tasks/integrate-crm-lead-sync.md +35 -0
- package/example/.kanbn/tasks/legal-review-terms-and-privacy.md +30 -0
- package/example/.kanbn/tasks/migrate-legacy-events-to-new-schema.md +48 -0
- package/example/.kanbn/tasks/optimize-dashboard-first-load.md +52 -0
- package/example/.kanbn/tasks/prototype-report-export-scheduler.md +34 -0
- package/example/.kanbn/tasks/publish-internal-qa-checklist.md +53 -0
- package/example/.kanbn/tasks/setup-ci-pipeline.md +53 -0
- package/package.json +3 -2
- package/routes/gantt.json +27 -0
- package/skills/kanbn-plan/SKILL.md +0 -0
- package/src/board.js +21 -2
- package/src/controller/add.js +33 -1
- package/src/controller/burndown.js +72 -5
- package/src/controller/edit.js +68 -1
- package/src/controller/find.js +5 -0
- package/src/controller/gantt.js +375 -0
- package/src/controller/init.js +2 -1
- package/src/controller/sort.js +8 -0
- package/src/main.d.ts +295 -340
- package/src/main.js +2591 -2050
- package/src/parse-task.js +211 -3
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "View Gantt Chart",
|
|
3
|
+
"commands": [
|
|
4
|
+
"gantt",
|
|
5
|
+
"gt"
|
|
6
|
+
],
|
|
7
|
+
"args": {
|
|
8
|
+
"boolean": [
|
|
9
|
+
"json"
|
|
10
|
+
],
|
|
11
|
+
"string": [
|
|
12
|
+
"assigned",
|
|
13
|
+
"column",
|
|
14
|
+
"date",
|
|
15
|
+
"now"
|
|
16
|
+
],
|
|
17
|
+
"alias": {
|
|
18
|
+
"json": ["j"],
|
|
19
|
+
"assigned": ["a"],
|
|
20
|
+
"column": ["c"],
|
|
21
|
+
"date": ["d"],
|
|
22
|
+
"now": ["n"]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"controller": "./src/controller/gantt",
|
|
26
|
+
"help": "./docs/commands/gantt.txt"
|
|
27
|
+
}
|
|
File without changes
|
package/src/board.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const kanbn = require('./main');
|
|
2
2
|
const term = require('terminal-kit').terminal;
|
|
3
3
|
const formatDate = require('dateformat');
|
|
4
|
+
const utility = require('./utility');
|
|
4
5
|
|
|
5
6
|
module.exports = (() => {
|
|
6
7
|
const TASK_SEPARATOR = '\n\n';
|
|
@@ -14,6 +15,18 @@ module.exports = (() => {
|
|
|
14
15
|
function getTaskString(index, task) {
|
|
15
16
|
const taskTemplate = kanbn.getTaskTemplate(index);
|
|
16
17
|
const dateFormat = kanbn.getDateFormat(index);
|
|
18
|
+
|
|
19
|
+
// Get an object containing custom fields from the task
|
|
20
|
+
let customFields = {};
|
|
21
|
+
if ('customFields' in index.options) {
|
|
22
|
+
const customFieldNames = index.options.customFields.map(customField => customField.name);
|
|
23
|
+
customFields = Object.fromEntries(utility.zip(
|
|
24
|
+
customFieldNames,
|
|
25
|
+
customFieldNames.map(customFieldName => task.metadata[customFieldName] || '')
|
|
26
|
+
));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Prepare task data for interpolation
|
|
17
30
|
const taskData = {
|
|
18
31
|
name: task.name,
|
|
19
32
|
description: task.name,
|
|
@@ -30,9 +43,15 @@ module.exports = (() => {
|
|
|
30
43
|
dueMessage: 'dueData' in task && 'dueMessage' in task.dueData ? task.dueData.dueMessage : '',
|
|
31
44
|
column: task.column,
|
|
32
45
|
workload: task.workload,
|
|
33
|
-
progress: task.progress
|
|
46
|
+
progress: task.progress,
|
|
47
|
+
...customFields
|
|
34
48
|
};
|
|
35
|
-
|
|
49
|
+
try {
|
|
50
|
+
return new Function(...Object.keys(taskData), 'return `^:' + taskTemplate + '`;')(...Object.values(taskData));
|
|
51
|
+
} catch (e) {
|
|
52
|
+
utility.error(`Unable to build task template: ${e.message}`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
36
55
|
}
|
|
37
56
|
|
|
38
57
|
/**
|
package/src/controller/add.js
CHANGED
|
@@ -23,6 +23,11 @@ async function interactiveCreateTask(taskData, taskIds, columnName, columnNames)
|
|
|
23
23
|
'due' in taskData.metadata &&
|
|
24
24
|
taskData.metadata.due != null
|
|
25
25
|
);
|
|
26
|
+
const postponedDateExists = (
|
|
27
|
+
'metadata' in taskData &&
|
|
28
|
+
'postponed' in taskData.metadata &&
|
|
29
|
+
taskData.metadata.postponed != null
|
|
30
|
+
);
|
|
26
31
|
const assignedExists = (
|
|
27
32
|
'metadata' in taskData &&
|
|
28
33
|
'assigned' in taskData.metadata &&
|
|
@@ -76,6 +81,21 @@ async function interactiveCreateTask(taskData, taskIds, columnName, columnNames)
|
|
|
76
81
|
format: ['Y', '/', 'MM', '/', 'DD'],
|
|
77
82
|
when: answers => answers.setDue,
|
|
78
83
|
},
|
|
84
|
+
{
|
|
85
|
+
type: 'confirm',
|
|
86
|
+
name: 'setPostponed',
|
|
87
|
+
message: 'Set a postponed date?',
|
|
88
|
+
default: false,
|
|
89
|
+
when: answers => !postponedDateExists
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
type: 'datepicker',
|
|
93
|
+
name: 'postponed',
|
|
94
|
+
message: 'Postponed date:',
|
|
95
|
+
default: postponedDateExists ? taskData.metadata.postponed : new Date(),
|
|
96
|
+
format: ['Y', '/', 'MM', '/', 'DD'],
|
|
97
|
+
when: answers => answers.setPostponed,
|
|
98
|
+
},
|
|
79
99
|
{
|
|
80
100
|
type: 'confirm',
|
|
81
101
|
name: 'setAssigned',
|
|
@@ -323,6 +343,15 @@ module.exports = async args => {
|
|
|
323
343
|
}
|
|
324
344
|
}
|
|
325
345
|
|
|
346
|
+
// Postponed date
|
|
347
|
+
if (args.postponed) {
|
|
348
|
+
taskData.metadata.postponed = chrono.parseDate(utility.strArg(args.postponed));
|
|
349
|
+
if (taskData.metadata.postponed === null) {
|
|
350
|
+
utility.error('Unable to parse postponed date');
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
326
355
|
// Progress
|
|
327
356
|
if (args.progress) {
|
|
328
357
|
const progressValue = parseFloat(utility.strArg(args.progress));
|
|
@@ -450,7 +479,10 @@ module.exports = async args => {
|
|
|
450
479
|
taskData.description = answers.description;
|
|
451
480
|
}
|
|
452
481
|
if ('due' in answers) {
|
|
453
|
-
taskData.metadata.due = answers.due
|
|
482
|
+
taskData.metadata.due = answers.due;
|
|
483
|
+
}
|
|
484
|
+
if ('postponed' in answers) {
|
|
485
|
+
taskData.metadata.postponed = answers.postponed;
|
|
454
486
|
}
|
|
455
487
|
if ('assigned' in answers) {
|
|
456
488
|
taskData.metadata.assigned = answers.assigned;
|
|
@@ -5,6 +5,61 @@ const term = require('terminal-kit').terminal;
|
|
|
5
5
|
const chrono = require('chrono-node');
|
|
6
6
|
const formatDate = require('dateformat');
|
|
7
7
|
|
|
8
|
+
const getLabelPlacements = (from, to, width, dateFormat, maxLabels) => {
|
|
9
|
+
for (let count = maxLabels; count >= 1; count--) {
|
|
10
|
+
const placements = [];
|
|
11
|
+
let previousEnd = -1;
|
|
12
|
+
|
|
13
|
+
for (let i = 0; i < count; i++) {
|
|
14
|
+
const ratio = count === 1 ? 0 : i / (count - 1);
|
|
15
|
+
const position = Math.round(ratio * (width - 1));
|
|
16
|
+
const value = new Date(from.getTime() + Math.round((to.getTime() - from.getTime()) * ratio));
|
|
17
|
+
const label = formatDate(value, dateFormat);
|
|
18
|
+
|
|
19
|
+
let start = position - Math.floor(label.length / 2);
|
|
20
|
+
if (start < 0) {
|
|
21
|
+
start = 0;
|
|
22
|
+
}
|
|
23
|
+
if (start + label.length > width) {
|
|
24
|
+
start = Math.max(0, width - label.length);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const end = start + label.length - 1;
|
|
28
|
+
if (i > 0 && start <= previousEnd + 1) {
|
|
29
|
+
placements.length = 0;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
placements.push({ position, start, label, end });
|
|
34
|
+
previousEnd = end;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (placements.length) {
|
|
38
|
+
return placements;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return [];
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const renderXAxisLabels = (from, to, width, dateFormat, leftPadding) => {
|
|
46
|
+
const sampleLabel = formatDate(from, dateFormat);
|
|
47
|
+
const maxLabels = Math.max(1, Math.floor((width + 2) / (sampleLabel.length + 2)));
|
|
48
|
+
const placements = getLabelPlacements(from, to, width, dateFormat, maxLabels);
|
|
49
|
+
|
|
50
|
+
const ticks = Array(width).fill(' ');
|
|
51
|
+
const labels = Array(width).fill(' ');
|
|
52
|
+
|
|
53
|
+
for (const placement of placements) {
|
|
54
|
+
ticks[placement.position] = '|';
|
|
55
|
+
for (let i = 0; i < placement.label.length; i++) {
|
|
56
|
+
labels[placement.start + i] = placement.label[i];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return `${leftPadding}${ticks.join('')}\n${leftPadding}${labels.join('')}`;
|
|
61
|
+
};
|
|
62
|
+
|
|
8
63
|
module.exports = async args => {
|
|
9
64
|
|
|
10
65
|
// Make sure kanbn has been initialised
|
|
@@ -72,18 +127,23 @@ module.exports = async args => {
|
|
|
72
127
|
|
|
73
128
|
// Render chart
|
|
74
129
|
const PADDING = ' ';
|
|
75
|
-
const width = term.width - (PADDING.length + 1);
|
|
130
|
+
const width = Math.max(1, term.width - (PADDING.length + 1));
|
|
76
131
|
|
|
77
132
|
const plots = [];
|
|
78
|
-
for (s of data.series) {
|
|
79
|
-
const plot = []
|
|
133
|
+
for (const s of data.series) {
|
|
134
|
+
const plot = [];
|
|
135
|
+
const span = Math.max(1, s.to.getTime() - s.from.getTime());
|
|
136
|
+
const delta = width > 1 ? span / (width - 1) : 0;
|
|
80
137
|
for (let i = 0; i < width; i++) {
|
|
81
|
-
|
|
138
|
+
const x = new Date(s.from.getTime() + Math.round(i * delta));
|
|
139
|
+
plot.push((s.dataPoints.find(d => d.x >= x) || s.dataPoints[0]).y);
|
|
82
140
|
}
|
|
83
141
|
plots.push(plot);
|
|
84
142
|
}
|
|
143
|
+
|
|
144
|
+
const referenceSeries = data.series[0];
|
|
85
145
|
const dateFormat = kanbn.getDateFormat(index);
|
|
86
|
-
console.log(`${formatDate(
|
|
146
|
+
console.log(`${formatDate(referenceSeries.from, dateFormat)} to ${formatDate(referenceSeries.to, dateFormat)}:`);
|
|
87
147
|
console.log(asciichart.plot(
|
|
88
148
|
plots,
|
|
89
149
|
{
|
|
@@ -99,6 +159,13 @@ module.exports = async args => {
|
|
|
99
159
|
]
|
|
100
160
|
}
|
|
101
161
|
));
|
|
162
|
+
console.log(renderXAxisLabels(
|
|
163
|
+
referenceSeries.from,
|
|
164
|
+
referenceSeries.to,
|
|
165
|
+
width,
|
|
166
|
+
dateFormat,
|
|
167
|
+
' '.repeat(PADDING.length + 1)
|
|
168
|
+
));
|
|
102
169
|
}
|
|
103
170
|
})
|
|
104
171
|
.catch(error => {
|
package/src/controller/edit.js
CHANGED
|
@@ -23,6 +23,11 @@ async function interactive(taskData, taskIds, columnName, columnNames) {
|
|
|
23
23
|
'due' in taskData.metadata &&
|
|
24
24
|
taskData.metadata.due != null
|
|
25
25
|
);
|
|
26
|
+
const postponedDateExists = (
|
|
27
|
+
'metadata' in taskData &&
|
|
28
|
+
'postponed' in taskData.metadata &&
|
|
29
|
+
taskData.metadata.postponed != null
|
|
30
|
+
);
|
|
26
31
|
const assignedExists = (
|
|
27
32
|
'metadata' in taskData &&
|
|
28
33
|
'assigned' in taskData.metadata &&
|
|
@@ -101,6 +106,46 @@ async function interactive(taskData, taskIds, columnName, columnNames) {
|
|
|
101
106
|
format: ['Y', '/', 'MM', '/', 'DD'],
|
|
102
107
|
when: answers => answers.setDue || answers.editDue === 'edit'
|
|
103
108
|
},
|
|
109
|
+
{
|
|
110
|
+
type: 'expand',
|
|
111
|
+
name: 'editPostponed',
|
|
112
|
+
message: 'Edit or remove postponed date?',
|
|
113
|
+
default: 'none',
|
|
114
|
+
when: answers => postponedDateExists,
|
|
115
|
+
choices: [
|
|
116
|
+
{
|
|
117
|
+
key: 'e',
|
|
118
|
+
name: 'Edit',
|
|
119
|
+
value: 'edit'
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
key: 'r',
|
|
123
|
+
name: 'Remove',
|
|
124
|
+
value: 'remove'
|
|
125
|
+
},
|
|
126
|
+
new inquirer.Separator(),
|
|
127
|
+
{
|
|
128
|
+
key: 'n',
|
|
129
|
+
name: 'Do nothing',
|
|
130
|
+
value: 'none'
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
type: 'confirm',
|
|
136
|
+
name: 'setPostponed',
|
|
137
|
+
message: 'Set a postponed date?',
|
|
138
|
+
default: false,
|
|
139
|
+
when: answers => !postponedDateExists
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
type: 'datepicker',
|
|
143
|
+
name: 'postponed',
|
|
144
|
+
message: 'Postponed date:',
|
|
145
|
+
default: postponedDateExists ? taskData.metadata.postponed : new Date(),
|
|
146
|
+
format: ['Y', '/', 'MM', '/', 'DD'],
|
|
147
|
+
when: answers => answers.setPostponed || answers.editPostponed === 'edit'
|
|
148
|
+
},
|
|
104
149
|
{
|
|
105
150
|
type: 'expand',
|
|
106
151
|
name: 'editAssigned',
|
|
@@ -430,6 +475,18 @@ module.exports = async args => {
|
|
|
430
475
|
}
|
|
431
476
|
}
|
|
432
477
|
|
|
478
|
+
// Postponed date
|
|
479
|
+
if (args.postponed) {
|
|
480
|
+
if (!('metadata' in taskData)) {
|
|
481
|
+
taskData.metadata = {};
|
|
482
|
+
}
|
|
483
|
+
taskData.metadata.postponed = chrono.parseDate(utility.strArg(args.postponed));
|
|
484
|
+
if (taskData.metadata.postponed === null) {
|
|
485
|
+
utility.error('Unable to parse postponed date');
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
433
490
|
// Progress
|
|
434
491
|
if (args.progress) {
|
|
435
492
|
if (!('metadata' in taskData)) {
|
|
@@ -660,7 +717,17 @@ module.exports = async args => {
|
|
|
660
717
|
|
|
661
718
|
// Due date
|
|
662
719
|
if ('due' in answers) {
|
|
663
|
-
taskData.metadata.due = answers.due
|
|
720
|
+
taskData.metadata.due = answers.due;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
// Remove postponed date
|
|
724
|
+
if ('editPostponed' in answers && answers.editPostponed === 'remove') {
|
|
725
|
+
delete taskData.metadata.postponed;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
// Postponed date
|
|
729
|
+
if ('postponed' in answers) {
|
|
730
|
+
taskData.metadata.postponed = answers.postponed;
|
|
664
731
|
}
|
|
665
732
|
|
|
666
733
|
// Remove assigned
|