@katlux/mcp-workflow 0.0.0-stage → 0.1.0-alpha.26
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/LICENSE +18 -0
- package/README.md +17 -2
- package/bin/katlux-mcp-workflow.mjs +18 -0
- package/dist/index.cjs +1826 -0
- package/dist/index.d.cts +217 -0
- package/dist/index.d.mts +215 -0
- package/dist/index.d.ts +217 -0
- package/dist/index.mjs +1799 -0
- package/package.json +39 -5
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { IMcpToolResult, IMcpHostContext, IMcpPluginTool, IMcpPlugin } from '@katlux/mcp-core';
|
|
2
|
+
|
|
3
|
+
declare const CANONICAL_TASK_STATUSES: readonly ["[ ] TODO", "[~] IN PROGRESS", "PAUSED (Feature Freeze)", "[x] CLOSED"];
|
|
4
|
+
type TCanonicalTaskStatus = (typeof CANONICAL_TASK_STATUSES)[number];
|
|
5
|
+
declare const TASK_PRIORITIES: readonly ["Critical", "High", "Medium", "Low"];
|
|
6
|
+
type TTaskPriority = (typeof TASK_PRIORITIES)[number];
|
|
7
|
+
declare const TASK_PREFIXES: readonly ["TASK", "BUG", "DEBT", "RFC"];
|
|
8
|
+
type TTaskPrefix = (typeof TASK_PREFIXES)[number];
|
|
9
|
+
interface ITaskCriterion {
|
|
10
|
+
index: number;
|
|
11
|
+
checked: boolean;
|
|
12
|
+
text: string;
|
|
13
|
+
}
|
|
14
|
+
interface ITaskExtraSection {
|
|
15
|
+
heading: string;
|
|
16
|
+
body: string;
|
|
17
|
+
}
|
|
18
|
+
interface IParsedTask {
|
|
19
|
+
id: string;
|
|
20
|
+
prefix: string;
|
|
21
|
+
numericId: number;
|
|
22
|
+
title: string;
|
|
23
|
+
filePath: string;
|
|
24
|
+
relPath: string;
|
|
25
|
+
priority: string;
|
|
26
|
+
type?: string;
|
|
27
|
+
created: string;
|
|
28
|
+
createdAt?: string;
|
|
29
|
+
updated?: string;
|
|
30
|
+
closedAt?: string;
|
|
31
|
+
tokensSpent?: number;
|
|
32
|
+
status: TCanonicalTaskStatus | string;
|
|
33
|
+
statusIsCanonical: boolean;
|
|
34
|
+
dependencies?: string;
|
|
35
|
+
milestone?: string;
|
|
36
|
+
component?: string;
|
|
37
|
+
assignee?: string;
|
|
38
|
+
problem: string;
|
|
39
|
+
scope: string;
|
|
40
|
+
acceptanceCriteria: ITaskCriterion[];
|
|
41
|
+
extraSections: ITaskExtraSection[];
|
|
42
|
+
legacyFormat: boolean;
|
|
43
|
+
formatIssues: string[];
|
|
44
|
+
backtickPaths: string[];
|
|
45
|
+
}
|
|
46
|
+
interface IIndexRow {
|
|
47
|
+
id: string;
|
|
48
|
+
linkPath: string;
|
|
49
|
+
title: string;
|
|
50
|
+
priority: string;
|
|
51
|
+
status: string;
|
|
52
|
+
rawLine: number;
|
|
53
|
+
}
|
|
54
|
+
interface IArchiveEntry {
|
|
55
|
+
id: string;
|
|
56
|
+
title: string;
|
|
57
|
+
status: string;
|
|
58
|
+
priority?: string;
|
|
59
|
+
milestone: string;
|
|
60
|
+
relPath: string;
|
|
61
|
+
legacyFormat: boolean;
|
|
62
|
+
formatIssues: string[];
|
|
63
|
+
checkedCount: number;
|
|
64
|
+
totalCount: number;
|
|
65
|
+
}
|
|
66
|
+
interface IDoctorIssue {
|
|
67
|
+
severity: 'error' | 'warning';
|
|
68
|
+
code: 'LEGACY_HEADER' | 'INVALID_STATUS' | 'MISSING_SECTION' | 'INDEX_MISSING_TASK' | 'INDEX_STALE_PATH' | 'INDEX_METADATA_MISMATCH' | 'DUPLICATE_ID' | 'STALE_FILE_REF' | 'UNMATCHED_BDD_STEP' | 'UNTESTED_TASK_FILE';
|
|
69
|
+
taskId?: string;
|
|
70
|
+
file: string;
|
|
71
|
+
message: string;
|
|
72
|
+
repaired?: boolean;
|
|
73
|
+
}
|
|
74
|
+
interface IDoctorReport {
|
|
75
|
+
healthy: boolean;
|
|
76
|
+
checkedActiveTasks: number;
|
|
77
|
+
checkedArchiveFiles: number;
|
|
78
|
+
issues: IDoctorIssue[];
|
|
79
|
+
repairedCount: number;
|
|
80
|
+
}
|
|
81
|
+
interface IWorkflowInitArgs {
|
|
82
|
+
cwd?: string;
|
|
83
|
+
projectName?: string;
|
|
84
|
+
}
|
|
85
|
+
interface IWorkflowTaskCriterionInput {
|
|
86
|
+
text: string;
|
|
87
|
+
checked?: boolean;
|
|
88
|
+
}
|
|
89
|
+
interface IWorkflowCriterionUpdate {
|
|
90
|
+
index?: number;
|
|
91
|
+
match?: string;
|
|
92
|
+
checked: boolean;
|
|
93
|
+
}
|
|
94
|
+
interface IWorkflowTaskArgs {
|
|
95
|
+
cwd?: string;
|
|
96
|
+
action: 'create' | 'update' | 'transition' | 'archive';
|
|
97
|
+
id?: string;
|
|
98
|
+
parentId?: string;
|
|
99
|
+
prefix?: TTaskPrefix;
|
|
100
|
+
title?: string;
|
|
101
|
+
priority?: TTaskPriority | string;
|
|
102
|
+
type?: string;
|
|
103
|
+
dependencies?: string;
|
|
104
|
+
problem?: string;
|
|
105
|
+
scope?: string | string[];
|
|
106
|
+
notes?: string;
|
|
107
|
+
acceptanceCriteria?: Array<string | IWorkflowTaskCriterionInput>;
|
|
108
|
+
addCriteria?: Array<string | IWorkflowTaskCriterionInput>;
|
|
109
|
+
criteriaUpdates?: IWorkflowCriterionUpdate[];
|
|
110
|
+
status?: TCanonicalTaskStatus | string;
|
|
111
|
+
milestone?: string;
|
|
112
|
+
component?: string;
|
|
113
|
+
force?: boolean;
|
|
114
|
+
runCheck?: boolean;
|
|
115
|
+
runTest?: boolean;
|
|
116
|
+
tokensSpent?: number;
|
|
117
|
+
}
|
|
118
|
+
interface IWorkflowInspectArgs {
|
|
119
|
+
cwd?: string;
|
|
120
|
+
action: 'list' | 'get' | 'archive' | 'doctor';
|
|
121
|
+
id?: string;
|
|
122
|
+
status?: string;
|
|
123
|
+
priority?: string;
|
|
124
|
+
type?: string;
|
|
125
|
+
milestone?: string;
|
|
126
|
+
relatedTask?: string;
|
|
127
|
+
component?: string;
|
|
128
|
+
createdAfter?: string;
|
|
129
|
+
createdBefore?: string;
|
|
130
|
+
closedAfter?: string;
|
|
131
|
+
closedBefore?: string;
|
|
132
|
+
minTokens?: number;
|
|
133
|
+
maxTokens?: number;
|
|
134
|
+
sortBy?: 'id' | 'priority' | 'status' | 'milestone';
|
|
135
|
+
limit?: number;
|
|
136
|
+
repair?: boolean;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Maps legacy or free-form task status strings onto the 4 canonical enum values.
|
|
141
|
+
* Returns `null` when a status cannot be mapped cleanly.
|
|
142
|
+
*/
|
|
143
|
+
declare function normalizeTaskStatus(raw?: string | null): TCanonicalTaskStatus | null;
|
|
144
|
+
/**
|
|
145
|
+
* Normalizes priority values into canonical Katlux tier format (e.g. `P2 (Medium)`).
|
|
146
|
+
*/
|
|
147
|
+
declare function formatCanonicalPriority(raw?: string | null): string;
|
|
148
|
+
/**
|
|
149
|
+
* Generates a URL/filename-safe kebab-case slug from a task title.
|
|
150
|
+
*/
|
|
151
|
+
declare function slugifyTitle(title: string): string;
|
|
152
|
+
declare function extractIdParts(rawId: string, fallbackFile?: string): {
|
|
153
|
+
id: string;
|
|
154
|
+
prefix: string;
|
|
155
|
+
numericId: number;
|
|
156
|
+
subNumericId?: number;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Parses a task markdown file (canonical or legacy format) into a structured object
|
|
160
|
+
* and records any schema/format violations for `doctor` and `archive` reporting.
|
|
161
|
+
*/
|
|
162
|
+
declare function parseTaskMarkdown(rawContent: string, filePath: string, relPath: string): IParsedTask;
|
|
163
|
+
/**
|
|
164
|
+
* Serializes a parsed or newly created task strictly into canonical Katlux Workflow Markdown.
|
|
165
|
+
*/
|
|
166
|
+
declare function serializeCanonicalTask(task: IParsedTask): string;
|
|
167
|
+
|
|
168
|
+
declare function getTodoPaths(root: string): {
|
|
169
|
+
todoDir: string;
|
|
170
|
+
tasksDir: string;
|
|
171
|
+
archiveDir: string;
|
|
172
|
+
indexPath: string;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Loads all active tasks inside `<root>/todo/tasks/`.
|
|
176
|
+
*/
|
|
177
|
+
declare function loadActiveTasks(root: string): IParsedTask[];
|
|
178
|
+
/**
|
|
179
|
+
* Indexes all historical tasks inside `<root>/todo/archive/**`, tagging legacy/malformed files cleanly.
|
|
180
|
+
*/
|
|
181
|
+
declare function loadArchiveEntries(root: string): Array<IArchiveEntry & {
|
|
182
|
+
numericId: number;
|
|
183
|
+
}>;
|
|
184
|
+
/**
|
|
185
|
+
* Computes the next unused numeric ID across both active `todo/tasks/` and `todo/archive/**`.
|
|
186
|
+
*/
|
|
187
|
+
declare function allocateNextTaskId(root: string, prefix?: TTaskPrefix, parentId?: string): string;
|
|
188
|
+
/**
|
|
189
|
+
* Parses markdown table rows from `todo/INDEX.md`.
|
|
190
|
+
*/
|
|
191
|
+
declare function parseTodoIndexRows(indexContent: string): IIndexRow[];
|
|
192
|
+
/**
|
|
193
|
+
* Rebuilds the active task table inside `todo/INDEX.md` from actual files on disk,
|
|
194
|
+
* preserving surrounding documentation sections such as rules and archive history.
|
|
195
|
+
*/
|
|
196
|
+
declare function syncTodoIndex(root: string, activeTasks?: IParsedTask[]): void;
|
|
197
|
+
/**
|
|
198
|
+
* Appends or updates the milestone index inside `todo/archive/<milestone>/INDEX.md`.
|
|
199
|
+
*/
|
|
200
|
+
declare function syncArchiveMilestoneIndex(root: string, milestone: string): void;
|
|
201
|
+
|
|
202
|
+
declare function handleWorkflowInit(args?: IWorkflowInitArgs, defaultCwd?: string): IMcpToolResult;
|
|
203
|
+
|
|
204
|
+
declare function handleWorkflowTask(rawArgs: IWorkflowTaskArgs, defaultCwd?: string): IMcpToolResult;
|
|
205
|
+
|
|
206
|
+
declare function handleWorkflowInspect(rawArgs: IWorkflowInspectArgs, defaultCwd?: string, _hostCtx?: IMcpHostContext): Promise<IMcpToolResult>;
|
|
207
|
+
|
|
208
|
+
declare const WORKFLOW_PLUGIN_TOOLS: IMcpPluginTool[];
|
|
209
|
+
|
|
210
|
+
declare function dispatchWorkflowTool(name: string, args: Record<string, unknown>, ctx?: IMcpHostContext): Promise<IMcpToolResult | null>;
|
|
211
|
+
declare function createKatluxWorkflowPlugin(): IMcpPlugin;
|
|
212
|
+
declare const createPlugin: typeof createKatluxWorkflowPlugin;
|
|
213
|
+
|
|
214
|
+
// @ts-ignore
|
|
215
|
+
export = createKatluxWorkflowPlugin;
|
|
216
|
+
export { CANONICAL_TASK_STATUSES, TASK_PREFIXES, TASK_PRIORITIES, WORKFLOW_PLUGIN_TOOLS, allocateNextTaskId, createKatluxWorkflowPlugin, createPlugin, dispatchWorkflowTool, extractIdParts, formatCanonicalPriority, getTodoPaths, handleWorkflowInit, handleWorkflowInspect, handleWorkflowTask, loadActiveTasks, loadArchiveEntries, normalizeTaskStatus, parseTaskMarkdown, parseTodoIndexRows, serializeCanonicalTask, slugifyTitle, syncArchiveMilestoneIndex, syncTodoIndex };
|
|
217
|
+
export type { IArchiveEntry, IDoctorIssue, IDoctorReport, IIndexRow, IParsedTask, ITaskCriterion, ITaskExtraSection, IWorkflowCriterionUpdate, IWorkflowInitArgs, IWorkflowInspectArgs, IWorkflowTaskArgs, IWorkflowTaskCriterionInput, TCanonicalTaskStatus, TTaskPrefix, TTaskPriority };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { IMcpToolResult, IMcpHostContext, IMcpPluginTool, IMcpPlugin } from '@katlux/mcp-core';
|
|
2
|
+
|
|
3
|
+
declare const CANONICAL_TASK_STATUSES: readonly ["[ ] TODO", "[~] IN PROGRESS", "PAUSED (Feature Freeze)", "[x] CLOSED"];
|
|
4
|
+
type TCanonicalTaskStatus = (typeof CANONICAL_TASK_STATUSES)[number];
|
|
5
|
+
declare const TASK_PRIORITIES: readonly ["Critical", "High", "Medium", "Low"];
|
|
6
|
+
type TTaskPriority = (typeof TASK_PRIORITIES)[number];
|
|
7
|
+
declare const TASK_PREFIXES: readonly ["TASK", "BUG", "DEBT", "RFC"];
|
|
8
|
+
type TTaskPrefix = (typeof TASK_PREFIXES)[number];
|
|
9
|
+
interface ITaskCriterion {
|
|
10
|
+
index: number;
|
|
11
|
+
checked: boolean;
|
|
12
|
+
text: string;
|
|
13
|
+
}
|
|
14
|
+
interface ITaskExtraSection {
|
|
15
|
+
heading: string;
|
|
16
|
+
body: string;
|
|
17
|
+
}
|
|
18
|
+
interface IParsedTask {
|
|
19
|
+
id: string;
|
|
20
|
+
prefix: string;
|
|
21
|
+
numericId: number;
|
|
22
|
+
title: string;
|
|
23
|
+
filePath: string;
|
|
24
|
+
relPath: string;
|
|
25
|
+
priority: string;
|
|
26
|
+
type?: string;
|
|
27
|
+
created: string;
|
|
28
|
+
createdAt?: string;
|
|
29
|
+
updated?: string;
|
|
30
|
+
closedAt?: string;
|
|
31
|
+
tokensSpent?: number;
|
|
32
|
+
status: TCanonicalTaskStatus | string;
|
|
33
|
+
statusIsCanonical: boolean;
|
|
34
|
+
dependencies?: string;
|
|
35
|
+
milestone?: string;
|
|
36
|
+
component?: string;
|
|
37
|
+
assignee?: string;
|
|
38
|
+
problem: string;
|
|
39
|
+
scope: string;
|
|
40
|
+
acceptanceCriteria: ITaskCriterion[];
|
|
41
|
+
extraSections: ITaskExtraSection[];
|
|
42
|
+
legacyFormat: boolean;
|
|
43
|
+
formatIssues: string[];
|
|
44
|
+
backtickPaths: string[];
|
|
45
|
+
}
|
|
46
|
+
interface IIndexRow {
|
|
47
|
+
id: string;
|
|
48
|
+
linkPath: string;
|
|
49
|
+
title: string;
|
|
50
|
+
priority: string;
|
|
51
|
+
status: string;
|
|
52
|
+
rawLine: number;
|
|
53
|
+
}
|
|
54
|
+
interface IArchiveEntry {
|
|
55
|
+
id: string;
|
|
56
|
+
title: string;
|
|
57
|
+
status: string;
|
|
58
|
+
priority?: string;
|
|
59
|
+
milestone: string;
|
|
60
|
+
relPath: string;
|
|
61
|
+
legacyFormat: boolean;
|
|
62
|
+
formatIssues: string[];
|
|
63
|
+
checkedCount: number;
|
|
64
|
+
totalCount: number;
|
|
65
|
+
}
|
|
66
|
+
interface IDoctorIssue {
|
|
67
|
+
severity: 'error' | 'warning';
|
|
68
|
+
code: 'LEGACY_HEADER' | 'INVALID_STATUS' | 'MISSING_SECTION' | 'INDEX_MISSING_TASK' | 'INDEX_STALE_PATH' | 'INDEX_METADATA_MISMATCH' | 'DUPLICATE_ID' | 'STALE_FILE_REF' | 'UNMATCHED_BDD_STEP' | 'UNTESTED_TASK_FILE';
|
|
69
|
+
taskId?: string;
|
|
70
|
+
file: string;
|
|
71
|
+
message: string;
|
|
72
|
+
repaired?: boolean;
|
|
73
|
+
}
|
|
74
|
+
interface IDoctorReport {
|
|
75
|
+
healthy: boolean;
|
|
76
|
+
checkedActiveTasks: number;
|
|
77
|
+
checkedArchiveFiles: number;
|
|
78
|
+
issues: IDoctorIssue[];
|
|
79
|
+
repairedCount: number;
|
|
80
|
+
}
|
|
81
|
+
interface IWorkflowInitArgs {
|
|
82
|
+
cwd?: string;
|
|
83
|
+
projectName?: string;
|
|
84
|
+
}
|
|
85
|
+
interface IWorkflowTaskCriterionInput {
|
|
86
|
+
text: string;
|
|
87
|
+
checked?: boolean;
|
|
88
|
+
}
|
|
89
|
+
interface IWorkflowCriterionUpdate {
|
|
90
|
+
index?: number;
|
|
91
|
+
match?: string;
|
|
92
|
+
checked: boolean;
|
|
93
|
+
}
|
|
94
|
+
interface IWorkflowTaskArgs {
|
|
95
|
+
cwd?: string;
|
|
96
|
+
action: 'create' | 'update' | 'transition' | 'archive';
|
|
97
|
+
id?: string;
|
|
98
|
+
parentId?: string;
|
|
99
|
+
prefix?: TTaskPrefix;
|
|
100
|
+
title?: string;
|
|
101
|
+
priority?: TTaskPriority | string;
|
|
102
|
+
type?: string;
|
|
103
|
+
dependencies?: string;
|
|
104
|
+
problem?: string;
|
|
105
|
+
scope?: string | string[];
|
|
106
|
+
notes?: string;
|
|
107
|
+
acceptanceCriteria?: Array<string | IWorkflowTaskCriterionInput>;
|
|
108
|
+
addCriteria?: Array<string | IWorkflowTaskCriterionInput>;
|
|
109
|
+
criteriaUpdates?: IWorkflowCriterionUpdate[];
|
|
110
|
+
status?: TCanonicalTaskStatus | string;
|
|
111
|
+
milestone?: string;
|
|
112
|
+
component?: string;
|
|
113
|
+
force?: boolean;
|
|
114
|
+
runCheck?: boolean;
|
|
115
|
+
runTest?: boolean;
|
|
116
|
+
tokensSpent?: number;
|
|
117
|
+
}
|
|
118
|
+
interface IWorkflowInspectArgs {
|
|
119
|
+
cwd?: string;
|
|
120
|
+
action: 'list' | 'get' | 'archive' | 'doctor';
|
|
121
|
+
id?: string;
|
|
122
|
+
status?: string;
|
|
123
|
+
priority?: string;
|
|
124
|
+
type?: string;
|
|
125
|
+
milestone?: string;
|
|
126
|
+
relatedTask?: string;
|
|
127
|
+
component?: string;
|
|
128
|
+
createdAfter?: string;
|
|
129
|
+
createdBefore?: string;
|
|
130
|
+
closedAfter?: string;
|
|
131
|
+
closedBefore?: string;
|
|
132
|
+
minTokens?: number;
|
|
133
|
+
maxTokens?: number;
|
|
134
|
+
sortBy?: 'id' | 'priority' | 'status' | 'milestone';
|
|
135
|
+
limit?: number;
|
|
136
|
+
repair?: boolean;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Maps legacy or free-form task status strings onto the 4 canonical enum values.
|
|
141
|
+
* Returns `null` when a status cannot be mapped cleanly.
|
|
142
|
+
*/
|
|
143
|
+
declare function normalizeTaskStatus(raw?: string | null): TCanonicalTaskStatus | null;
|
|
144
|
+
/**
|
|
145
|
+
* Normalizes priority values into canonical Katlux tier format (e.g. `P2 (Medium)`).
|
|
146
|
+
*/
|
|
147
|
+
declare function formatCanonicalPriority(raw?: string | null): string;
|
|
148
|
+
/**
|
|
149
|
+
* Generates a URL/filename-safe kebab-case slug from a task title.
|
|
150
|
+
*/
|
|
151
|
+
declare function slugifyTitle(title: string): string;
|
|
152
|
+
declare function extractIdParts(rawId: string, fallbackFile?: string): {
|
|
153
|
+
id: string;
|
|
154
|
+
prefix: string;
|
|
155
|
+
numericId: number;
|
|
156
|
+
subNumericId?: number;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Parses a task markdown file (canonical or legacy format) into a structured object
|
|
160
|
+
* and records any schema/format violations for `doctor` and `archive` reporting.
|
|
161
|
+
*/
|
|
162
|
+
declare function parseTaskMarkdown(rawContent: string, filePath: string, relPath: string): IParsedTask;
|
|
163
|
+
/**
|
|
164
|
+
* Serializes a parsed or newly created task strictly into canonical Katlux Workflow Markdown.
|
|
165
|
+
*/
|
|
166
|
+
declare function serializeCanonicalTask(task: IParsedTask): string;
|
|
167
|
+
|
|
168
|
+
declare function getTodoPaths(root: string): {
|
|
169
|
+
todoDir: string;
|
|
170
|
+
tasksDir: string;
|
|
171
|
+
archiveDir: string;
|
|
172
|
+
indexPath: string;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Loads all active tasks inside `<root>/todo/tasks/`.
|
|
176
|
+
*/
|
|
177
|
+
declare function loadActiveTasks(root: string): IParsedTask[];
|
|
178
|
+
/**
|
|
179
|
+
* Indexes all historical tasks inside `<root>/todo/archive/**`, tagging legacy/malformed files cleanly.
|
|
180
|
+
*/
|
|
181
|
+
declare function loadArchiveEntries(root: string): Array<IArchiveEntry & {
|
|
182
|
+
numericId: number;
|
|
183
|
+
}>;
|
|
184
|
+
/**
|
|
185
|
+
* Computes the next unused numeric ID across both active `todo/tasks/` and `todo/archive/**`.
|
|
186
|
+
*/
|
|
187
|
+
declare function allocateNextTaskId(root: string, prefix?: TTaskPrefix, parentId?: string): string;
|
|
188
|
+
/**
|
|
189
|
+
* Parses markdown table rows from `todo/INDEX.md`.
|
|
190
|
+
*/
|
|
191
|
+
declare function parseTodoIndexRows(indexContent: string): IIndexRow[];
|
|
192
|
+
/**
|
|
193
|
+
* Rebuilds the active task table inside `todo/INDEX.md` from actual files on disk,
|
|
194
|
+
* preserving surrounding documentation sections such as rules and archive history.
|
|
195
|
+
*/
|
|
196
|
+
declare function syncTodoIndex(root: string, activeTasks?: IParsedTask[]): void;
|
|
197
|
+
/**
|
|
198
|
+
* Appends or updates the milestone index inside `todo/archive/<milestone>/INDEX.md`.
|
|
199
|
+
*/
|
|
200
|
+
declare function syncArchiveMilestoneIndex(root: string, milestone: string): void;
|
|
201
|
+
|
|
202
|
+
declare function handleWorkflowInit(args?: IWorkflowInitArgs, defaultCwd?: string): IMcpToolResult;
|
|
203
|
+
|
|
204
|
+
declare function handleWorkflowTask(rawArgs: IWorkflowTaskArgs, defaultCwd?: string): IMcpToolResult;
|
|
205
|
+
|
|
206
|
+
declare function handleWorkflowInspect(rawArgs: IWorkflowInspectArgs, defaultCwd?: string, _hostCtx?: IMcpHostContext): Promise<IMcpToolResult>;
|
|
207
|
+
|
|
208
|
+
declare const WORKFLOW_PLUGIN_TOOLS: IMcpPluginTool[];
|
|
209
|
+
|
|
210
|
+
declare function dispatchWorkflowTool(name: string, args: Record<string, unknown>, ctx?: IMcpHostContext): Promise<IMcpToolResult | null>;
|
|
211
|
+
declare function createKatluxWorkflowPlugin(): IMcpPlugin;
|
|
212
|
+
declare const createPlugin: typeof createKatluxWorkflowPlugin;
|
|
213
|
+
|
|
214
|
+
export { CANONICAL_TASK_STATUSES, TASK_PREFIXES, TASK_PRIORITIES, WORKFLOW_PLUGIN_TOOLS, allocateNextTaskId, createKatluxWorkflowPlugin, createPlugin, createKatluxWorkflowPlugin as default, dispatchWorkflowTool, extractIdParts, formatCanonicalPriority, getTodoPaths, handleWorkflowInit, handleWorkflowInspect, handleWorkflowTask, loadActiveTasks, loadArchiveEntries, normalizeTaskStatus, parseTaskMarkdown, parseTodoIndexRows, serializeCanonicalTask, slugifyTitle, syncArchiveMilestoneIndex, syncTodoIndex };
|
|
215
|
+
export type { IArchiveEntry, IDoctorIssue, IDoctorReport, IIndexRow, IParsedTask, ITaskCriterion, ITaskExtraSection, IWorkflowCriterionUpdate, IWorkflowInitArgs, IWorkflowInspectArgs, IWorkflowTaskArgs, IWorkflowTaskCriterionInput, TCanonicalTaskStatus, TTaskPrefix, TTaskPriority };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { IMcpToolResult, IMcpHostContext, IMcpPluginTool, IMcpPlugin } from '@katlux/mcp-core';
|
|
2
|
+
|
|
3
|
+
declare const CANONICAL_TASK_STATUSES: readonly ["[ ] TODO", "[~] IN PROGRESS", "PAUSED (Feature Freeze)", "[x] CLOSED"];
|
|
4
|
+
type TCanonicalTaskStatus = (typeof CANONICAL_TASK_STATUSES)[number];
|
|
5
|
+
declare const TASK_PRIORITIES: readonly ["Critical", "High", "Medium", "Low"];
|
|
6
|
+
type TTaskPriority = (typeof TASK_PRIORITIES)[number];
|
|
7
|
+
declare const TASK_PREFIXES: readonly ["TASK", "BUG", "DEBT", "RFC"];
|
|
8
|
+
type TTaskPrefix = (typeof TASK_PREFIXES)[number];
|
|
9
|
+
interface ITaskCriterion {
|
|
10
|
+
index: number;
|
|
11
|
+
checked: boolean;
|
|
12
|
+
text: string;
|
|
13
|
+
}
|
|
14
|
+
interface ITaskExtraSection {
|
|
15
|
+
heading: string;
|
|
16
|
+
body: string;
|
|
17
|
+
}
|
|
18
|
+
interface IParsedTask {
|
|
19
|
+
id: string;
|
|
20
|
+
prefix: string;
|
|
21
|
+
numericId: number;
|
|
22
|
+
title: string;
|
|
23
|
+
filePath: string;
|
|
24
|
+
relPath: string;
|
|
25
|
+
priority: string;
|
|
26
|
+
type?: string;
|
|
27
|
+
created: string;
|
|
28
|
+
createdAt?: string;
|
|
29
|
+
updated?: string;
|
|
30
|
+
closedAt?: string;
|
|
31
|
+
tokensSpent?: number;
|
|
32
|
+
status: TCanonicalTaskStatus | string;
|
|
33
|
+
statusIsCanonical: boolean;
|
|
34
|
+
dependencies?: string;
|
|
35
|
+
milestone?: string;
|
|
36
|
+
component?: string;
|
|
37
|
+
assignee?: string;
|
|
38
|
+
problem: string;
|
|
39
|
+
scope: string;
|
|
40
|
+
acceptanceCriteria: ITaskCriterion[];
|
|
41
|
+
extraSections: ITaskExtraSection[];
|
|
42
|
+
legacyFormat: boolean;
|
|
43
|
+
formatIssues: string[];
|
|
44
|
+
backtickPaths: string[];
|
|
45
|
+
}
|
|
46
|
+
interface IIndexRow {
|
|
47
|
+
id: string;
|
|
48
|
+
linkPath: string;
|
|
49
|
+
title: string;
|
|
50
|
+
priority: string;
|
|
51
|
+
status: string;
|
|
52
|
+
rawLine: number;
|
|
53
|
+
}
|
|
54
|
+
interface IArchiveEntry {
|
|
55
|
+
id: string;
|
|
56
|
+
title: string;
|
|
57
|
+
status: string;
|
|
58
|
+
priority?: string;
|
|
59
|
+
milestone: string;
|
|
60
|
+
relPath: string;
|
|
61
|
+
legacyFormat: boolean;
|
|
62
|
+
formatIssues: string[];
|
|
63
|
+
checkedCount: number;
|
|
64
|
+
totalCount: number;
|
|
65
|
+
}
|
|
66
|
+
interface IDoctorIssue {
|
|
67
|
+
severity: 'error' | 'warning';
|
|
68
|
+
code: 'LEGACY_HEADER' | 'INVALID_STATUS' | 'MISSING_SECTION' | 'INDEX_MISSING_TASK' | 'INDEX_STALE_PATH' | 'INDEX_METADATA_MISMATCH' | 'DUPLICATE_ID' | 'STALE_FILE_REF' | 'UNMATCHED_BDD_STEP' | 'UNTESTED_TASK_FILE';
|
|
69
|
+
taskId?: string;
|
|
70
|
+
file: string;
|
|
71
|
+
message: string;
|
|
72
|
+
repaired?: boolean;
|
|
73
|
+
}
|
|
74
|
+
interface IDoctorReport {
|
|
75
|
+
healthy: boolean;
|
|
76
|
+
checkedActiveTasks: number;
|
|
77
|
+
checkedArchiveFiles: number;
|
|
78
|
+
issues: IDoctorIssue[];
|
|
79
|
+
repairedCount: number;
|
|
80
|
+
}
|
|
81
|
+
interface IWorkflowInitArgs {
|
|
82
|
+
cwd?: string;
|
|
83
|
+
projectName?: string;
|
|
84
|
+
}
|
|
85
|
+
interface IWorkflowTaskCriterionInput {
|
|
86
|
+
text: string;
|
|
87
|
+
checked?: boolean;
|
|
88
|
+
}
|
|
89
|
+
interface IWorkflowCriterionUpdate {
|
|
90
|
+
index?: number;
|
|
91
|
+
match?: string;
|
|
92
|
+
checked: boolean;
|
|
93
|
+
}
|
|
94
|
+
interface IWorkflowTaskArgs {
|
|
95
|
+
cwd?: string;
|
|
96
|
+
action: 'create' | 'update' | 'transition' | 'archive';
|
|
97
|
+
id?: string;
|
|
98
|
+
parentId?: string;
|
|
99
|
+
prefix?: TTaskPrefix;
|
|
100
|
+
title?: string;
|
|
101
|
+
priority?: TTaskPriority | string;
|
|
102
|
+
type?: string;
|
|
103
|
+
dependencies?: string;
|
|
104
|
+
problem?: string;
|
|
105
|
+
scope?: string | string[];
|
|
106
|
+
notes?: string;
|
|
107
|
+
acceptanceCriteria?: Array<string | IWorkflowTaskCriterionInput>;
|
|
108
|
+
addCriteria?: Array<string | IWorkflowTaskCriterionInput>;
|
|
109
|
+
criteriaUpdates?: IWorkflowCriterionUpdate[];
|
|
110
|
+
status?: TCanonicalTaskStatus | string;
|
|
111
|
+
milestone?: string;
|
|
112
|
+
component?: string;
|
|
113
|
+
force?: boolean;
|
|
114
|
+
runCheck?: boolean;
|
|
115
|
+
runTest?: boolean;
|
|
116
|
+
tokensSpent?: number;
|
|
117
|
+
}
|
|
118
|
+
interface IWorkflowInspectArgs {
|
|
119
|
+
cwd?: string;
|
|
120
|
+
action: 'list' | 'get' | 'archive' | 'doctor';
|
|
121
|
+
id?: string;
|
|
122
|
+
status?: string;
|
|
123
|
+
priority?: string;
|
|
124
|
+
type?: string;
|
|
125
|
+
milestone?: string;
|
|
126
|
+
relatedTask?: string;
|
|
127
|
+
component?: string;
|
|
128
|
+
createdAfter?: string;
|
|
129
|
+
createdBefore?: string;
|
|
130
|
+
closedAfter?: string;
|
|
131
|
+
closedBefore?: string;
|
|
132
|
+
minTokens?: number;
|
|
133
|
+
maxTokens?: number;
|
|
134
|
+
sortBy?: 'id' | 'priority' | 'status' | 'milestone';
|
|
135
|
+
limit?: number;
|
|
136
|
+
repair?: boolean;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Maps legacy or free-form task status strings onto the 4 canonical enum values.
|
|
141
|
+
* Returns `null` when a status cannot be mapped cleanly.
|
|
142
|
+
*/
|
|
143
|
+
declare function normalizeTaskStatus(raw?: string | null): TCanonicalTaskStatus | null;
|
|
144
|
+
/**
|
|
145
|
+
* Normalizes priority values into canonical Katlux tier format (e.g. `P2 (Medium)`).
|
|
146
|
+
*/
|
|
147
|
+
declare function formatCanonicalPriority(raw?: string | null): string;
|
|
148
|
+
/**
|
|
149
|
+
* Generates a URL/filename-safe kebab-case slug from a task title.
|
|
150
|
+
*/
|
|
151
|
+
declare function slugifyTitle(title: string): string;
|
|
152
|
+
declare function extractIdParts(rawId: string, fallbackFile?: string): {
|
|
153
|
+
id: string;
|
|
154
|
+
prefix: string;
|
|
155
|
+
numericId: number;
|
|
156
|
+
subNumericId?: number;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Parses a task markdown file (canonical or legacy format) into a structured object
|
|
160
|
+
* and records any schema/format violations for `doctor` and `archive` reporting.
|
|
161
|
+
*/
|
|
162
|
+
declare function parseTaskMarkdown(rawContent: string, filePath: string, relPath: string): IParsedTask;
|
|
163
|
+
/**
|
|
164
|
+
* Serializes a parsed or newly created task strictly into canonical Katlux Workflow Markdown.
|
|
165
|
+
*/
|
|
166
|
+
declare function serializeCanonicalTask(task: IParsedTask): string;
|
|
167
|
+
|
|
168
|
+
declare function getTodoPaths(root: string): {
|
|
169
|
+
todoDir: string;
|
|
170
|
+
tasksDir: string;
|
|
171
|
+
archiveDir: string;
|
|
172
|
+
indexPath: string;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Loads all active tasks inside `<root>/todo/tasks/`.
|
|
176
|
+
*/
|
|
177
|
+
declare function loadActiveTasks(root: string): IParsedTask[];
|
|
178
|
+
/**
|
|
179
|
+
* Indexes all historical tasks inside `<root>/todo/archive/**`, tagging legacy/malformed files cleanly.
|
|
180
|
+
*/
|
|
181
|
+
declare function loadArchiveEntries(root: string): Array<IArchiveEntry & {
|
|
182
|
+
numericId: number;
|
|
183
|
+
}>;
|
|
184
|
+
/**
|
|
185
|
+
* Computes the next unused numeric ID across both active `todo/tasks/` and `todo/archive/**`.
|
|
186
|
+
*/
|
|
187
|
+
declare function allocateNextTaskId(root: string, prefix?: TTaskPrefix, parentId?: string): string;
|
|
188
|
+
/**
|
|
189
|
+
* Parses markdown table rows from `todo/INDEX.md`.
|
|
190
|
+
*/
|
|
191
|
+
declare function parseTodoIndexRows(indexContent: string): IIndexRow[];
|
|
192
|
+
/**
|
|
193
|
+
* Rebuilds the active task table inside `todo/INDEX.md` from actual files on disk,
|
|
194
|
+
* preserving surrounding documentation sections such as rules and archive history.
|
|
195
|
+
*/
|
|
196
|
+
declare function syncTodoIndex(root: string, activeTasks?: IParsedTask[]): void;
|
|
197
|
+
/**
|
|
198
|
+
* Appends or updates the milestone index inside `todo/archive/<milestone>/INDEX.md`.
|
|
199
|
+
*/
|
|
200
|
+
declare function syncArchiveMilestoneIndex(root: string, milestone: string): void;
|
|
201
|
+
|
|
202
|
+
declare function handleWorkflowInit(args?: IWorkflowInitArgs, defaultCwd?: string): IMcpToolResult;
|
|
203
|
+
|
|
204
|
+
declare function handleWorkflowTask(rawArgs: IWorkflowTaskArgs, defaultCwd?: string): IMcpToolResult;
|
|
205
|
+
|
|
206
|
+
declare function handleWorkflowInspect(rawArgs: IWorkflowInspectArgs, defaultCwd?: string, _hostCtx?: IMcpHostContext): Promise<IMcpToolResult>;
|
|
207
|
+
|
|
208
|
+
declare const WORKFLOW_PLUGIN_TOOLS: IMcpPluginTool[];
|
|
209
|
+
|
|
210
|
+
declare function dispatchWorkflowTool(name: string, args: Record<string, unknown>, ctx?: IMcpHostContext): Promise<IMcpToolResult | null>;
|
|
211
|
+
declare function createKatluxWorkflowPlugin(): IMcpPlugin;
|
|
212
|
+
declare const createPlugin: typeof createKatluxWorkflowPlugin;
|
|
213
|
+
|
|
214
|
+
// @ts-ignore
|
|
215
|
+
export = createKatluxWorkflowPlugin;
|
|
216
|
+
export { CANONICAL_TASK_STATUSES, TASK_PREFIXES, TASK_PRIORITIES, WORKFLOW_PLUGIN_TOOLS, allocateNextTaskId, createKatluxWorkflowPlugin, createPlugin, dispatchWorkflowTool, extractIdParts, formatCanonicalPriority, getTodoPaths, handleWorkflowInit, handleWorkflowInspect, handleWorkflowTask, loadActiveTasks, loadArchiveEntries, normalizeTaskStatus, parseTaskMarkdown, parseTodoIndexRows, serializeCanonicalTask, slugifyTitle, syncArchiveMilestoneIndex, syncTodoIndex };
|
|
217
|
+
export type { IArchiveEntry, IDoctorIssue, IDoctorReport, IIndexRow, IParsedTask, ITaskCriterion, ITaskExtraSection, IWorkflowCriterionUpdate, IWorkflowInitArgs, IWorkflowInspectArgs, IWorkflowTaskArgs, IWorkflowTaskCriterionInput, TCanonicalTaskStatus, TTaskPrefix, TTaskPriority };
|