@basementuniverse/kanbn 2.1.0 → 2.5.1
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/README.md +1 -0
- package/coverage/tmp/coverage-916017-1788028598821-0.json +1 -0
- package/coverage/tmp/{coverage-214293-1787777184569-0.json → coverage-916018-1788028597179-0.json} +1 -1
- package/coverage/tmp/coverage-916036-1788028598796-0.json +1 -0
- package/docs/actions.md +337 -0
- package/docs/advanced-configuration.md +32 -0
- package/docs/commands/add.txt +8 -1
- package/docs/commands/archive.txt +6 -0
- package/docs/commands/board.txt +4 -0
- package/docs/commands/burndown.txt +1 -0
- package/docs/commands/comment.txt +8 -1
- package/docs/commands/contributors.txt +58 -0
- package/docs/commands/edit.txt +13 -1
- package/docs/commands/find.txt +28 -1
- package/docs/commands/gantt.txt +1 -0
- package/docs/commands/help.txt +1 -0
- package/docs/commands/history.txt +1 -0
- package/docs/commands/move.txt +17 -0
- package/docs/commands/remove.txt +10 -0
- package/docs/commands/restore.txt +6 -0
- package/docs/commands/sort.txt +18 -0
- package/docs/commands/task.txt +4 -0
- package/docs/commands/validate.txt +14 -1
- package/docs/contributors.md +145 -0
- package/docs/filtering-and-sorting.md +60 -3
- package/docs/index-structure.md +120 -12
- package/docs/index.md +4 -1
- package/docs/multiple-boards.md +1 -0
- package/docs/sprints.md +175 -0
- package/docs/task-structure.md +9 -2
- package/example/advanced/kanbn.yml +65 -0
- package/package.json +1 -1
- package/routes/add.json +5 -1
- package/routes/archive.json +6 -2
- package/routes/comment.json +5 -1
- package/routes/contributors.json +18 -0
- package/routes/edit.json +5 -1
- package/routes/move.json +4 -2
- package/routes/remove.json +6 -2
- package/routes/restore.json +6 -0
- package/routes/sort.json +5 -0
- package/src/actions.js +904 -0
- package/src/board.js +24 -1
- package/src/controller/add.js +21 -10
- package/src/controller/archive.js +1 -0
- package/src/controller/board.js +13 -4
- package/src/controller/burndown.js +5 -2
- package/src/controller/comment.js +5 -2
- package/src/controller/contributors.js +166 -0
- package/src/controller/edit.js +40 -14
- package/src/controller/find.js +75 -4
- package/src/controller/gantt.js +5 -2
- package/src/controller/history.js +5 -2
- package/src/controller/move.js +84 -10
- package/src/controller/remove.js +39 -2
- package/src/controller/restore.js +1 -0
- package/src/controller/sort.js +40 -0
- package/src/controller/task.js +12 -1
- package/src/controller/validate.js +141 -4
- package/src/git-user-name.js +5 -15
- package/src/git-user.js +55 -0
- package/src/main.d.ts +204 -4
- package/src/main.js +1413 -39
- package/src/parse-index.js +205 -17
- package/src/utility.js +135 -1
- package/coverage/tmp/coverage-214292-1787777191526-0.json +0 -1
package/src/main.d.ts
CHANGED
|
@@ -29,11 +29,41 @@ declare type boardSummary = board & {
|
|
|
29
29
|
modified: Date | null
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
+
declare type columnContentEntry = {
|
|
33
|
+
position: number,
|
|
34
|
+
text: string,
|
|
35
|
+
raw: string,
|
|
36
|
+
block?: boolean
|
|
37
|
+
};
|
|
38
|
+
|
|
32
39
|
declare type index = {
|
|
33
40
|
name: string,
|
|
34
41
|
description: string,
|
|
35
42
|
options: Record<string, any>,
|
|
36
|
-
columns: Record<string, string[]
|
|
43
|
+
columns: Record<string, string[]>,
|
|
44
|
+
|
|
45
|
+
// Lines in a column that aren't task links. Preserved verbatim and ignored by everything else
|
|
46
|
+
columnContent?: Record<string, columnContentEntry[]>
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
declare type missingTaskFile = {
|
|
50
|
+
task: string,
|
|
51
|
+
column: string
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
declare type simpleTask = {
|
|
55
|
+
column: string,
|
|
56
|
+
position: number,
|
|
57
|
+
text: string,
|
|
58
|
+
raw: string
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
declare type columnContentWarning = {
|
|
62
|
+
board: string,
|
|
63
|
+
column: string,
|
|
64
|
+
type: 'non-task-line' | 'untracked-task-line' | 'malformed-task-link',
|
|
65
|
+
text: string,
|
|
66
|
+
message: string
|
|
37
67
|
};
|
|
38
68
|
|
|
39
69
|
declare type subTask = {
|
|
@@ -80,8 +110,58 @@ declare type sprint = {
|
|
|
80
110
|
description?: string
|
|
81
111
|
};
|
|
82
112
|
|
|
113
|
+
declare type contributor = {
|
|
114
|
+
name: string,
|
|
115
|
+
displayName: string,
|
|
116
|
+
aliases: string[],
|
|
117
|
+
email?: string,
|
|
118
|
+
colour?: string
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
declare type contributorSpelling = {
|
|
122
|
+
value: string,
|
|
123
|
+
assigned: number,
|
|
124
|
+
comments: number,
|
|
125
|
+
tasks: string[]
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
declare type contributorUsage = {
|
|
129
|
+
contributors: (contributor & {
|
|
130
|
+
assigned: number,
|
|
131
|
+
comments: number,
|
|
132
|
+
tasks: number,
|
|
133
|
+
spellings: contributorSpelling[]
|
|
134
|
+
})[],
|
|
135
|
+
unknown: contributorSpelling[]
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
declare type contributorWarning = {
|
|
139
|
+
task: string,
|
|
140
|
+
type: 'unknown-contributor',
|
|
141
|
+
value: string,
|
|
142
|
+
message: string
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
declare type actionRule = {
|
|
146
|
+
name?: string,
|
|
147
|
+
on: string,
|
|
148
|
+
when?: Record<string, any>,
|
|
149
|
+
for?: {
|
|
150
|
+
related?: string,
|
|
151
|
+
direction?: 'incoming' | 'outgoing',
|
|
152
|
+
where?: Record<string, any>
|
|
153
|
+
},
|
|
154
|
+
anyBoard?: boolean,
|
|
155
|
+
then: Record<string, any>[]
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
declare type actionWarning = {
|
|
159
|
+
type: 'conflicting-actions' | 'unresolvable-user',
|
|
160
|
+
message: string
|
|
161
|
+
};
|
|
162
|
+
|
|
83
163
|
export class Kanbn {
|
|
84
|
-
constructor(root?: any, options?: { board?: string, caches?: any });
|
|
164
|
+
constructor(root?: any, options?: { board?: string, caches?: any, actions?: boolean });
|
|
85
165
|
ROOT: string;
|
|
86
166
|
CONFIG_YAML: string;
|
|
87
167
|
CONFIG_JSON: string;
|
|
@@ -90,6 +170,30 @@ export class Kanbn {
|
|
|
90
170
|
* The board this instance is scoped to, or null for the main board
|
|
91
171
|
*/
|
|
92
172
|
boardSlug: string | null;
|
|
173
|
+
/**
|
|
174
|
+
* Rules that were skipped during the last operation, for the caller to report
|
|
175
|
+
*/
|
|
176
|
+
lastActionWarnings: string[];
|
|
177
|
+
/**
|
|
178
|
+
* Whether scripted actions run for operations on this instance
|
|
179
|
+
*/
|
|
180
|
+
actionsEnabled: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Get an instance that runs no actions
|
|
183
|
+
*/
|
|
184
|
+
withoutActions(): Kanbn;
|
|
185
|
+
/**
|
|
186
|
+
* Get the action rules that apply to this board
|
|
187
|
+
*/
|
|
188
|
+
getActionRules(index?: index | null): Promise<actionRule[]>;
|
|
189
|
+
/**
|
|
190
|
+
* Check whether actions should run at all
|
|
191
|
+
*/
|
|
192
|
+
actionsAllowed(): boolean;
|
|
193
|
+
/**
|
|
194
|
+
* Find things about this board's action rules that are legal but probably not what the author meant
|
|
195
|
+
*/
|
|
196
|
+
findActionWarnings(): Promise<actionWarning[]>;
|
|
93
197
|
/**
|
|
94
198
|
* Get a copy of this instance scoped to another board, sharing this one's cached config
|
|
95
199
|
* @param {?string} [slug=null] The board slug, or null/"main"/"default" for the main board
|
|
@@ -215,6 +319,35 @@ export class Kanbn {
|
|
|
215
319
|
* Load the workspace options along with where they came from
|
|
216
320
|
*/
|
|
217
321
|
loadWorkspaceOptions(): Promise<{ options: Record<string, any>, fromConfig: boolean }>;
|
|
322
|
+
/**
|
|
323
|
+
* Normalise a contributors option into a consistent object form
|
|
324
|
+
*/
|
|
325
|
+
normaliseContributors(contributors: any): contributor[];
|
|
326
|
+
/**
|
|
327
|
+
* Get the workspace's contributors, normalised to the object form
|
|
328
|
+
*/
|
|
329
|
+
getContributors(): Promise<contributor[]>;
|
|
330
|
+
/**
|
|
331
|
+
* Find the contributor a value refers to, matching name, display name and aliases
|
|
332
|
+
*/
|
|
333
|
+
findContributor(value: string | null): Promise<contributor | null>;
|
|
334
|
+
/**
|
|
335
|
+
* Work out who the current user is: KANBN_USER, then a contributor matched by git email or git
|
|
336
|
+
* name, then the git username, then null
|
|
337
|
+
*/
|
|
338
|
+
currentUser(): Promise<string | null>;
|
|
339
|
+
/**
|
|
340
|
+
* Collect every distinct `assigned` and comment `author` value used across the workspace's tasks
|
|
341
|
+
*/
|
|
342
|
+
collectContributorValues(): Promise<Map<string, { value: string, assigned: number, comments: number, tasks: Set<string> }>>;
|
|
343
|
+
/**
|
|
344
|
+
* Report how contributors are used, and which names in use aren't known contributors
|
|
345
|
+
*/
|
|
346
|
+
getContributorUsage(): Promise<contributorUsage>;
|
|
347
|
+
/**
|
|
348
|
+
* Find tasks whose assigned user or comment author isn't a known contributor
|
|
349
|
+
*/
|
|
350
|
+
findContributorWarnings(): Promise<contributorWarning[]>;
|
|
218
351
|
/**
|
|
219
352
|
* Get the options a secondary board inherits from the workspace
|
|
220
353
|
*/
|
|
@@ -345,12 +478,79 @@ export class Kanbn {
|
|
|
345
478
|
*/
|
|
346
479
|
loadTask(taskId: string): Promise<object>;
|
|
347
480
|
/**
|
|
348
|
-
* Load all tracked tasks and return an array of task objects
|
|
481
|
+
* Load all tracked tasks and return an array of task objects. A task the index references but
|
|
482
|
+
* which has no task file is skipped rather than throwing - see findMissingTaskFiles()
|
|
349
483
|
* @param {object} index The index object
|
|
350
484
|
* @param {?string} [columnName=null] The optional column name to filter tasks by
|
|
351
485
|
* @return {Promise<object[]>} All tracked tasks
|
|
352
486
|
*/
|
|
353
487
|
loadAllTrackedTasks(index: object, columnName?: string | null): Promise<object[]>;
|
|
488
|
+
/**
|
|
489
|
+
* Find tasks that this board references but which have no task file
|
|
490
|
+
* @param {?object} [index=null] The index object, or null to load it
|
|
491
|
+
* @return {Promise<missingTaskFile[]>} A list of the missing tasks and the columns they're in
|
|
492
|
+
*/
|
|
493
|
+
findMissingTaskFiles(index?: object | null): Promise<missingTaskFile[]>;
|
|
494
|
+
/**
|
|
495
|
+
* Find lines in this board's columns that aren't task links
|
|
496
|
+
* @param {?object} [index=null] The index object, or null to load it
|
|
497
|
+
* @return {Promise<columnContentWarning[]>} A list of warnings
|
|
498
|
+
*/
|
|
499
|
+
findColumnContentWarnings(index?: object | null): Promise<columnContentWarning[]>;
|
|
500
|
+
/**
|
|
501
|
+
* Get this board's simple tasks - lines in a column that aren't task links. Real tasks always win,
|
|
502
|
+
* so callers should resolve a task id first and only fall back to this when nothing matched
|
|
503
|
+
* @param {?string} [input=null] A title to match, or null for every simple task on this board
|
|
504
|
+
* @param {?object} [index=null] The index object, or null to load it
|
|
505
|
+
* @return {Promise<simpleTask[]>} The matching simple tasks
|
|
506
|
+
*/
|
|
507
|
+
findSimpleTasks(input?: string | null, index?: object | null): Promise<simpleTask[]>;
|
|
508
|
+
/**
|
|
509
|
+
* Resolve a string to exactly one simple task on this board, or throw
|
|
510
|
+
* @param {string} input The title to match
|
|
511
|
+
* @param {?object} [index=null] The index object, or null to load it
|
|
512
|
+
* @return {Promise<simpleTask>} The matching simple task
|
|
513
|
+
*/
|
|
514
|
+
getSimpleTask(input: string, index?: object | null): Promise<simpleTask>;
|
|
515
|
+
/**
|
|
516
|
+
* Move a simple task to another column on this board
|
|
517
|
+
* @param {string} input The title to match
|
|
518
|
+
* @param {string} columnName The column to move it to
|
|
519
|
+
* @param {?number} [position=null] The position in the target column, or the end of it if null
|
|
520
|
+
* @return {Promise<simpleTask & { toColumn: string }>} The simple task that was moved
|
|
521
|
+
*/
|
|
522
|
+
moveSimpleTask(
|
|
523
|
+
input: string,
|
|
524
|
+
columnName: string,
|
|
525
|
+
position?: number | null
|
|
526
|
+
): Promise<simpleTask & { toColumn: string }>;
|
|
527
|
+
/**
|
|
528
|
+
* Move a simple task from this board onto another one
|
|
529
|
+
* @param {string} input The title to match
|
|
530
|
+
* @param {string} targetSlug The board to move it to
|
|
531
|
+
* @param {?string} [columnName=null] The column on the target board, or its first column if null
|
|
532
|
+
* @param {?number} [position=null] The position in the target column, or the end of it if null
|
|
533
|
+
* @return {Promise<simpleTask & { toBoard: string, toColumn: string }>} The simple task that moved
|
|
534
|
+
*/
|
|
535
|
+
moveSimpleTaskToBoard(
|
|
536
|
+
input: string,
|
|
537
|
+
targetSlug: string,
|
|
538
|
+
columnName?: string | null,
|
|
539
|
+
position?: number | null
|
|
540
|
+
): Promise<simpleTask & { toBoard: string, toColumn: string }>;
|
|
541
|
+
/**
|
|
542
|
+
* Remove a simple task from this board
|
|
543
|
+
* @param {string} input The title to match
|
|
544
|
+
* @return {Promise<simpleTask>} The simple task that was removed
|
|
545
|
+
*/
|
|
546
|
+
deleteSimpleTask(input: string): Promise<simpleTask>;
|
|
547
|
+
/**
|
|
548
|
+
* Turn a simple task into a real task file
|
|
549
|
+
* @param {string} input The title to match
|
|
550
|
+
* @param {?string} [columnName=null] The column to create the task in, or its own column if null
|
|
551
|
+
* @return {Promise<string>} The id of the task that was created
|
|
552
|
+
*/
|
|
553
|
+
promoteSimpleTask(input: string, columnName?: string | null): Promise<string>;
|
|
354
554
|
/**
|
|
355
555
|
* Load a task file from the archive and parse it to an object
|
|
356
556
|
* @param {string} taskId The task id
|
|
@@ -507,7 +707,7 @@ export class Kanbn {
|
|
|
507
707
|
* @param {string} author The comment author
|
|
508
708
|
* @return {Promise<string>} The task id
|
|
509
709
|
*/
|
|
510
|
-
comment(taskId: string, text: string, author
|
|
710
|
+
comment(taskId: string, text: string, author?: string): Promise<string>;
|
|
511
711
|
/**
|
|
512
712
|
* Return a list of archived tasks
|
|
513
713
|
* @return {Promise<string[]>} A list of archived task ids
|