/// declare type config = { mainFolder?: string, indexFile?: string, taskFolder?: string, archiveFolder?: string, defaultBoard?: string, boards?: { exclude?: string[], order?: string[], [slug: string]: any } }; declare type board = { slug: string, path: string, name: string, description: string, main: boolean }; declare type boardSummary = board & { columns: number, tasks: number, completed: number, completedPercentage: number, modified: Date | null }; declare type columnContentEntry = { position: number, text: string, raw: string, block?: boolean }; declare type index = { name: string, description: string, options: Record, columns: Record, // Lines in a column that aren't task links. Preserved verbatim and ignored by everything else columnContent?: Record }; declare type missingTaskFile = { task: string, column: string }; declare type simpleTask = { column: string, position: number, text: string, raw: string }; declare type columnContentWarning = { board: string, column: string, type: 'non-task-line' | 'untracked-task-line' | 'malformed-task-link', text: string, message: string }; declare type subTask = { text: string, completed: boolean }; declare type relation = { task: string, type: string }; declare type comment = { text: string, author: string, date: Date }; declare type task = { id: string, name: string, description: string, metadata: Record, subTasks: subTask[], relations: relation[], comments: comment[], column?: string, workload?: number, progress?: number, remainingWorkload?: number, due?: Record }; declare type status = { tasks: number, columnTasks: Record, startedTasks?: number, completedTasks?: number }; declare type sprint = { start: Date, name: string, description?: string }; declare type contributor = { name: string, displayName: string, aliases: string[], email?: string, colour?: string }; declare type contributorSpelling = { value: string, assigned: number, comments: number, tasks: string[] }; declare type contributorUsage = { contributors: (contributor & { assigned: number, comments: number, tasks: number, spellings: contributorSpelling[] })[], unknown: contributorSpelling[] }; declare type contributorWarning = { task: string, type: 'unknown-contributor', value: string, message: string }; declare type actionRule = { name?: string, on: string, when?: Record, for?: { related?: string, direction?: 'incoming' | 'outgoing', where?: Record }, anyBoard?: boolean, then: Record[] }; declare type actionWarning = { type: 'conflicting-actions' | 'unresolvable-user', message: string }; export class Kanbn { constructor(root?: any, options?: { board?: string, caches?: any, actions?: boolean }); ROOT: string; CONFIG_YAML: string; CONFIG_JSON: string; configMemo: any; /** * The board this instance is scoped to, or null for the main board */ boardSlug: string | null; /** * Rules that were skipped during the last operation, for the caller to report */ lastActionWarnings: string[]; /** * Whether scripted actions run for operations on this instance */ actionsEnabled: boolean; /** * Get an instance that runs no actions */ withoutActions(): Kanbn; /** * Get the action rules that apply to this board */ getActionRules(index?: index | null): Promise; /** * Check whether actions should run at all */ actionsAllowed(): boolean; /** * Find things about this board's action rules that are legal but probably not what the author meant */ findActionWarnings(): Promise; /** * Get a copy of this instance scoped to another board, sharing this one's cached config * @param {?string} [slug=null] The board slug, or null/"main"/"default" for the main board */ board(slug?: string | null): Kanbn; /** * Alias for board() */ withBoard(slug?: string | null): Kanbn; /** * Check if a separate config file exists * @returns {Promise} True if a config file exists */ configExists(): Promise; /** * Save configuration data to a separate config file */ saveConfig(config: any): Promise; /** * Get configuration settings from the config file if it exists, otherwise return null * @return {Promise} Configuration settings or null if there is no separate config file */ getConfig(): Promise; /** * Clear cached config */ clearConfigCache(): void; /** * Get the name of the folder where the index and tasks are stored * @return {Promise} The kanbn folder name */ getFolderName(): Promise; /** * Get the index filename * @return {Promise} The index filename */ getIndexFileName(): Promise; /** * Get the name of the folder where tasks are stored * @return {Promise} The task folder name */ getTaskFolderName(): Promise; /** * Get the name of the archive folder * @return {Promise} The archive folder name */ getArchiveFolderName(): Promise; /** * Get the kanbn folder location for the current working directory * @return {Promise} The kanbn folder path */ getMainFolder(): Promise; /** * Get the main board's slug, i.e. the index file name without its extension * @return {Promise} The main board slug */ getMainBoardSlug(): Promise; /** * Resolve a board slug, mapping the reserved aliases and an absent slug onto the main board * @param {?string} [slug] The board slug, defaulting to this instance's board */ resolveBoardSlug(slug?: string | null): Promise; /** * Check if a slug refers to the main board */ isMainBoard(slug?: string | null): Promise; /** * Get the file path for a board */ getBoardPath(slug?: string | null): Promise; /** * Get the index path, i.e. the path of the board this instance is scoped to * @return {Promise} The kanbn index path */ getIndexPath(): Promise; /** * Get the task folder path * @return {Promise} The kanbn task folder path */ getTaskFolderPath(): Promise; /** * Get the archive folder path * @return {Promise} The kanbn archive folder path */ getArchiveFolderPath(): Promise; /** * Get the index as an object * @return {Promise} The index */ getIndex(): Promise; /** * Get a task as an object * @param {string} taskId The task id to get * @return {Promise} The task */ getTask(taskId: string): Promise; /** * Add additional index-based information to a task * @param {index} index The index object * @param {task} task The task object * @return {task} The hydrated task */ hydrateTask(index: any, task: any): any; /** * Return a filtered and sorted list of tasks * @param {index} index The index object * @param {task[]} tasks A list of task objects * @param {object} filters A list of task filters * @param {object[]} sorters A list of task sorters * @return {object[]} A filtered and sorted list of tasks */ filterAndSortTasks(index: any, tasks: task[], filters: object, sorters: object[]): object[]; /** * Overwrite the index file with the specified data * @param {object} indexData Index data to save */ saveIndex(indexData: object): Promise; /** * Get the workspace-scoped options, from the config file or the main board's front matter */ getWorkspaceOptions(): Promise>; /** * Load the workspace options along with where they came from */ loadWorkspaceOptions(): Promise<{ options: Record, fromConfig: boolean }>; /** * Normalise a contributors option into a consistent object form */ normaliseContributors(contributors: any): contributor[]; /** * Get the workspace's contributors, normalised to the object form */ getContributors(): Promise; /** * Find the contributor a value refers to, matching name, display name and aliases */ findContributor(value: string | null): Promise; /** * Work out who the current user is: KANBN_USER, then a contributor matched by git email or git * name, then the git username, then null */ currentUser(): Promise; /** * Collect every distinct `assigned` and comment `author` value used across the workspace's tasks */ collectContributorValues(): Promise }>>; /** * Report how contributors are used, and which names in use aren't known contributors */ getContributorUsage(): Promise; /** * Find tasks whose assigned user or comment author isn't a known contributor */ findContributorWarnings(): Promise; /** * Get the options a secondary board inherits from the workspace */ getInheritedBoardOptions(): Promise>; /** * Get the per-board options declared for a board under the `boards` key in the config file */ getBoardConfig(slug?: string | null): Promise>; /** * Layer a board's own front matter options over the workspace options */ resolveBoardOptions(resolvedSlug: string, ownOptions: Record): Promise>; /** * Work out which options belong in a secondary board's own front matter */ getOwnBoardOptions(resolvedSlug: string, indexData: object): Promise>; /** * Overwrite a board file with the specified data */ saveBoard(slug: string | null, indexData: object): Promise; /** * Load a board file and parse it to an object */ loadBoard(slug?: string | null): Promise; /** * Work out which board a command should target: --board, then KANBN_BOARD, then defaultBoard */ resolveTargetBoard(slug?: string | null): Promise; /** * Get a Kanbn instance scoped to the board a command's arguments point at */ boardFromArgs(args?: object): Promise; /** * Find all boards in the workspace */ listBoards(): Promise; /** * List boards with column and task counts, completion percentage and last modified date */ getBoardsSummary(): Promise; /** * Get every task that appears on more than one board, with the column it occupies on each */ getCrossBoardTasks(allTasks?: boolean): Promise<{ id: string, boards: Record }[]>; /** * Check if a board exists */ boardExists(slug: string): Promise; /** * Get the value to record in a history event's `board` key, or null for the main board */ historyBoard(): Promise; /** * Add an existing task to this board */ addTaskToBoard(taskId: string, columnName: string): Promise; /** * Check if a task file exists, regardless of whether any board references it */ taskFileExists(taskId: string): Promise; /** * Boards named in an archived task's metadata that no longer existed when it was restored */ lastRestoreWarnings: string[]; /** * Create a new board */ createBoard(slug: string, options?: object): Promise; /** * Create a secondary board, or update an existing one */ initialiseBoard(slug: string, options?: object): Promise; /** * Delete a board file, returning the ids of tasks that are no longer on any board */ deleteBoard(slug: string): Promise; /** * Find the tasks that would become untracked if a board were deleted */ findOrphanedTasks(slug: string): Promise; /** * Rename a board */ renameBoard(slug: string, newSlug: string, newName?: string | null): Promise; /** * Find every board that references a task, and the column it occupies on each */ findTaskBoards(taskId: string): Promise>; /** * Alias for findTaskBoards() */ getTaskBoardColumns(taskId: string): Promise>; /** * Get the slugs that can't be used for a board */ getReservedBoardSlugs(): Promise; /** * Check that a slug can be used for a new board, throwing if it can't */ validateBoardSlug(slug: string): Promise; /** * Get the boards config from the config file, i.e. the exclude list and display order */ getBoardsConfig(): Promise<{ exclude: string[], order: string[] }>; /** * Find tasks that no board references at all */ findWorkspaceUntrackedTasks(): Promise>; /** * Find tasks that other boards track but this one doesn't */ findTasksOnOtherBoards(): Promise>>; /** * Load the index file and parse it to an object * @return {Promise} The index object */ loadIndex(): Promise; /** * Overwrite a task file with the specified data * @param {string} path The task path * @param {object} taskData The task data */ saveTask(path: string, taskData: object): Promise; /** * Load a task file and parse it to an object * @param {string} taskId The task id * @return {Promise} The task object */ loadTask(taskId: string): Promise; /** * Load all tracked tasks and return an array of task objects. A task the index references but * which has no task file is skipped rather than throwing - see findMissingTaskFiles() * @param {object} index The index object * @param {?string} [columnName=null] The optional column name to filter tasks by * @return {Promise} All tracked tasks */ loadAllTrackedTasks(index: object, columnName?: string | null): Promise; /** * Find tasks that this board references but which have no task file * @param {?object} [index=null] The index object, or null to load it * @return {Promise} A list of the missing tasks and the columns they're in */ findMissingTaskFiles(index?: object | null): Promise; /** * Find lines in this board's columns that aren't task links * @param {?object} [index=null] The index object, or null to load it * @return {Promise} A list of warnings */ findColumnContentWarnings(index?: object | null): Promise; /** * Get this board's simple tasks - lines in a column that aren't task links. Real tasks always win, * so callers should resolve a task id first and only fall back to this when nothing matched * @param {?string} [input=null] A title to match, or null for every simple task on this board * @param {?object} [index=null] The index object, or null to load it * @return {Promise} The matching simple tasks */ findSimpleTasks(input?: string | null, index?: object | null): Promise; /** * Resolve a string to exactly one simple task on this board, or throw * @param {string} input The title to match * @param {?object} [index=null] The index object, or null to load it * @return {Promise} The matching simple task */ getSimpleTask(input: string, index?: object | null): Promise; /** * Move a simple task to another column on this board * @param {string} input The title to match * @param {string} columnName The column to move it to * @param {?number} [position=null] The position in the target column, or the end of it if null * @return {Promise} The simple task that was moved */ moveSimpleTask( input: string, columnName: string, position?: number | null ): Promise; /** * Move a simple task from this board onto another one * @param {string} input The title to match * @param {string} targetSlug The board to move it to * @param {?string} [columnName=null] The column on the target board, or its first column if null * @param {?number} [position=null] The position in the target column, or the end of it if null * @return {Promise} The simple task that moved */ moveSimpleTaskToBoard( input: string, targetSlug: string, columnName?: string | null, position?: number | null ): Promise; /** * Remove a simple task from this board * @param {string} input The title to match * @return {Promise} The simple task that was removed */ deleteSimpleTask(input: string): Promise; /** * Turn a simple task into a real task file * @param {string} input The title to match * @param {?string} [columnName=null] The column to create the task in, or its own column if null * @return {Promise} The id of the task that was created */ promoteSimpleTask(input: string, columnName?: string | null): Promise; /** * Load a task file from the archive and parse it to an object * @param {string} taskId The task id * @return {Promise} The task object */ loadArchivedTask(taskId: string): Promise; /** * Get the date format defined in the index, or the default date format * @param {object} index The index object * @return {string} The date format */ getDateFormat(index: object): string; /** * Get the task template for displaying tasks on the kanbn board from the index, or the default task template * @param {object} index The index object * @return {string} The task template */ getTaskTemplate(index: object): string; /** * Check if the current working directory has been initialised * @return {Promise} True if the current working directory has been initialised, otherwise false */ initialised(): Promise; /** * Check if the workspace has been initialised, regardless of which board this instance is scoped to * @return {Promise} True if the main board exists */ workspaceInitialised(): Promise; /** * Initialise a kanbn board in the current working directory * @param {object} [options={}] Initial columns and other config options */ initialise(options?: object): Promise; /** * Check if a task file exists and is in the index, otherwise throw an error * @param {string} taskId The task id to check */ taskExists(taskId: string): Promise; /** * Get the column that a task is in or throw an error if the task doesn't exist or isn't indexed * @param {string} taskId The task id to find * @return {Promise} The name of the column the task is in */ findTaskColumn(taskId: string): Promise; /** * Create a task file and add the task to the index * @param {object} taskData The task object * @param {string} columnName The name of the column to add the task to * @return {Promise} The id of the task that was created */ createTask(taskData: object, columnName: string): Promise; /** * Add an untracked task to the specified column in the index * @param {string} taskId The untracked task id * @param {string} columnName The column to add the task to * @return {Promise} The id of the task that was added */ addUntrackedTaskToIndex(taskId: string, columnName: string): Promise; /** * Get a list of tracked tasks (i.e. tasks that are listed in the index) * @param {?string} [columnName=null] The optional column name to filter tasks by * @return {Promise} A set of task ids */ findTrackedTasks(columnName?: string | null): Promise>; /** * Get a list of untracked tasks (i.e. markdown files in the tasks folder that aren't listed in the index) * @return {Promise} A set of untracked task ids */ findUntrackedTasks(): Promise>; /** * Update an existing task * @param {string} taskId The id of the task to update * @param {object} taskData The new task data * @param {?string} [columnName=null] The column name to move this task to, or null if not moving this task * @return {Promise} The id of the task that was updated */ updateTask(taskId: string, taskData: object, columnName?: string | null): Promise; /** * Change a task name, rename the task file and update the task id in the index * @param {string} taskId The id of the task to rename * @param {string} newTaskName The new task name * @return {Promise} The new id of the task that was renamed */ renameTask(taskId: string, newTaskName: string): Promise; /** * Move a task from one column to another column * @param {string} taskId The task id to move * @param {string} columnName The name of the column that the task will be moved to * @param {?number} [position=null] The position to move the task to within the target column * @param {boolean} [relative=false] Treat the position argument as relative instead of absolute * @return {Promise} The id of the task that was moved */ moveTask(taskId: string, columnName: string, position?: number | null, relative?: boolean, add?: boolean): Promise; /** * Remove a task from the index and optionally delete the task file as well * @param {string} taskId The id of the task to remove * @param {boolean} [removeFile=false] True if the task file should be removed * @return {Promise} The id of the task that was deleted */ deleteTask(taskId: string, removeFile?: boolean, allBoards?: boolean): Promise; /** * Search for indexed tasks * @param {object} [filters={}] The filters to apply * @param {boolean} [quiet=false] Only return task ids if true, otherwise return full task details * @return {Promise} A list of tasks that match the filters */ search(filters?: object, quiet?: boolean): Promise; /** * Output project status information * @param {boolean} [quiet=false] Output full or partial status information * @param {boolean} [untracked=false] Show a list of untracked tasks * @param {boolean} [due=false] Show information about overdue tasks and time remaining * @param {?string|?number} [sprint=null] The sprint name or number to show stats for, or null for current sprint * @param {?Date[]} [dates=null] The date(s) to show stats for, or null for no date filter * @return {Promise} Project status information as an object, or an array of untracked task filenames */ status(quiet?: boolean, untracked?: boolean, due?: boolean, sprint?: (string | (number | null)) | null, dates?: Date[] | null): Promise; /** * Validate the index and task files * @param {boolean} [save=false] Re-save all files * @return {Promise} True if everything validated, otherwise an array of parsing errors */ validate(save?: boolean): Promise; /** * Sort a column in the index * @param {string} columnName The column name to sort * @param {object[]} sorters A list of objects containing the field to sort by, filters and sort order * @param {boolean} [save=false] True if the settings should be saved in index */ sort(columnName: string, sorters: object[], save?: boolean): Promise; /** * Start a sprint * @param {string} name Sprint name * @param {string} description Sprint description * @param {Date} start Sprint start date * @return {Promise} The sprint object */ sprint(name: string, description: string, start: Date): Promise; /** * Output burndown chart data * @param {?string[]} [sprints=null] The sprint names or numbers to show a chart for, or null for * the current sprint * @param {?Date[]} [dates=null] The dates to show a chart for, or null for no date filter * @param {?string} [assigned=null] The assigned user to filter for, or null for no assigned filter * @param {?string[]} [columns=null] The columns to filter for, or null for no column filter * @param {?string} [normalise=null] The date normalisation mode * @return {Promise} Burndown chart data as an object */ burndown(sprints?: string[] | null, dates?: Date[] | null, assigned?: string | null, columns?: string[] | null, normalise?: string | null): Promise; /** * Add a comment to a task * @param {string} taskId The task id * @param {string} text The comment text * @param {string} author The comment author * @return {Promise} The task id */ comment(taskId: string, text: string, author?: string): Promise; /** * Return a list of archived tasks * @return {Promise} A list of archived task ids */ listArchivedTasks(): Promise; /** * Move a task to the archive * @param {string} taskId The task id * @return {Promise} The task id */ archiveTask(taskId: string): Promise; /** * Restore a task from the archive * @param {string} taskId The task id * @param {?string} [columnName=null] The column to restore the task to * @return {Promise} The task id */ restoreTask(taskId: string, columnName?: string | null, singleBoard?: boolean): Promise; /** * Nuke it from orbit, it's the only way to be sure */ removeAll(): Promise; }