@backlog-md/core 0.1.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/README.md +114 -0
- package/dist/abstractions/GitAdapter.d.ts +83 -0
- package/dist/abstractions/GitAdapter.d.ts.map +1 -0
- package/dist/abstractions/GitAdapter.js +12 -0
- package/dist/abstractions/GitAdapter.js.map +1 -0
- package/dist/abstractions/index.d.ts +9 -0
- package/dist/abstractions/index.d.ts.map +1 -0
- package/dist/abstractions/index.js +8 -0
- package/dist/abstractions/index.js.map +1 -0
- package/dist/core/Core.d.ts +91 -0
- package/dist/core/Core.d.ts.map +1 -0
- package/dist/core/Core.js +170 -0
- package/dist/core/Core.js.map +1 -0
- package/dist/core/config-parser.d.ts +16 -0
- package/dist/core/config-parser.d.ts.map +1 -0
- package/dist/core/config-parser.js +166 -0
- package/dist/core/config-parser.js.map +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/markdown/index.d.ts +40 -0
- package/dist/markdown/index.d.ts.map +1 -0
- package/dist/markdown/index.js +230 -0
- package/dist/markdown/index.js.map +1 -0
- package/dist/test-adapters/MockGitAdapter.d.ts +73 -0
- package/dist/test-adapters/MockGitAdapter.d.ts.map +1 -0
- package/dist/test-adapters/MockGitAdapter.js +197 -0
- package/dist/test-adapters/MockGitAdapter.js.map +1 -0
- package/dist/test-adapters/index.d.ts +17 -0
- package/dist/test-adapters/index.d.ts.map +1 -0
- package/dist/test-adapters/index.js +21 -0
- package/dist/test-adapters/index.js.map +1 -0
- package/dist/types/index.d.ts +209 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +11 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +5 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/sorting.d.ts +21 -0
- package/dist/utils/sorting.d.ts.map +1 -0
- package/dist/utils/sorting.js +66 -0
- package/dist/utils/sorting.js.map +1 -0
- package/package.json +99 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mock Git adapter for testing
|
|
3
|
+
*
|
|
4
|
+
* Provides a configurable mock implementation of GitAdapter
|
|
5
|
+
* that records command history and allows setting up responses.
|
|
6
|
+
*/
|
|
7
|
+
export class MockGitAdapter {
|
|
8
|
+
projectRoot;
|
|
9
|
+
config = {
|
|
10
|
+
currentBranch: "main",
|
|
11
|
+
isClean: true,
|
|
12
|
+
isRepository: true,
|
|
13
|
+
branches: ["main"],
|
|
14
|
+
remoteBranches: [],
|
|
15
|
+
remotes: ["origin"],
|
|
16
|
+
trees: new Map(),
|
|
17
|
+
};
|
|
18
|
+
commandHistory = [];
|
|
19
|
+
mockResponses = new Map();
|
|
20
|
+
constructor(projectRoot = "/mock/project") {
|
|
21
|
+
this.projectRoot = projectRoot;
|
|
22
|
+
}
|
|
23
|
+
// --- GitAdapter implementation ---
|
|
24
|
+
async exec(args, options) {
|
|
25
|
+
this.commandHistory.push({
|
|
26
|
+
args,
|
|
27
|
+
options,
|
|
28
|
+
timestamp: new Date(),
|
|
29
|
+
});
|
|
30
|
+
// Check for mock response
|
|
31
|
+
const key = args.join(" ");
|
|
32
|
+
const mockResponse = this.mockResponses.get(key);
|
|
33
|
+
if (mockResponse) {
|
|
34
|
+
if (mockResponse instanceof Error) {
|
|
35
|
+
throw mockResponse;
|
|
36
|
+
}
|
|
37
|
+
return mockResponse;
|
|
38
|
+
}
|
|
39
|
+
// Default behavior based on command
|
|
40
|
+
return this.handleCommand(args);
|
|
41
|
+
}
|
|
42
|
+
async isGitRepository(_path) {
|
|
43
|
+
return this.config.isRepository;
|
|
44
|
+
}
|
|
45
|
+
async initRepository(_path) {
|
|
46
|
+
this.config.isRepository = true;
|
|
47
|
+
this.config.branches = ["main"];
|
|
48
|
+
this.config.currentBranch = "main";
|
|
49
|
+
}
|
|
50
|
+
// --- Test configuration methods ---
|
|
51
|
+
/**
|
|
52
|
+
* Set the current branch
|
|
53
|
+
*/
|
|
54
|
+
mockBranch(name) {
|
|
55
|
+
this.config.currentBranch = name;
|
|
56
|
+
if (!this.config.branches.includes(name)) {
|
|
57
|
+
this.config.branches.push(name);
|
|
58
|
+
}
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Set available branches
|
|
63
|
+
*/
|
|
64
|
+
mockBranches(local, remote = []) {
|
|
65
|
+
this.config.branches = local;
|
|
66
|
+
this.config.remoteBranches = remote;
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Set available remotes
|
|
71
|
+
*/
|
|
72
|
+
mockRemotes(remotes) {
|
|
73
|
+
this.config.remotes = remotes;
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Set whether the repository is clean
|
|
78
|
+
*/
|
|
79
|
+
mockClean(isClean) {
|
|
80
|
+
this.config.isClean = isClean;
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Set whether the path is a git repository
|
|
85
|
+
*/
|
|
86
|
+
mockIsRepository(isRepo) {
|
|
87
|
+
this.config.isRepository = isRepo;
|
|
88
|
+
return this;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Mock file tree for a specific ref
|
|
92
|
+
*/
|
|
93
|
+
mockTree(ref, files) {
|
|
94
|
+
this.config.trees.set(ref, new Map(Object.entries(files)));
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Set a mock response for a specific command
|
|
99
|
+
*/
|
|
100
|
+
mockResponse(args, response) {
|
|
101
|
+
this.mockResponses.set(args.join(" "), response);
|
|
102
|
+
return this;
|
|
103
|
+
}
|
|
104
|
+
// --- Assertion helpers ---
|
|
105
|
+
/**
|
|
106
|
+
* Get command history
|
|
107
|
+
*/
|
|
108
|
+
getCommandHistory() {
|
|
109
|
+
return [...this.commandHistory];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Assert a command was called
|
|
113
|
+
*/
|
|
114
|
+
assertCommandCalled(args) {
|
|
115
|
+
const key = args.join(" ");
|
|
116
|
+
const found = this.commandHistory.some((entry) => entry.args.join(" ") === key);
|
|
117
|
+
if (!found) {
|
|
118
|
+
throw new Error(`Expected command "${key}" to be called, but it was not.\n` +
|
|
119
|
+
`Commands called: ${this.commandHistory.map((e) => e.args.join(" ")).join(", ")}`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Assert a command was called a specific number of times
|
|
124
|
+
*/
|
|
125
|
+
assertCommandCalledTimes(args, times) {
|
|
126
|
+
const key = args.join(" ");
|
|
127
|
+
const count = this.commandHistory.filter((entry) => entry.args.join(" ") === key).length;
|
|
128
|
+
if (count !== times) {
|
|
129
|
+
throw new Error(`Expected command "${key}" to be called ${times} times, but it was called ${count} times.`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Clear command history
|
|
134
|
+
*/
|
|
135
|
+
clearHistory() {
|
|
136
|
+
this.commandHistory = [];
|
|
137
|
+
return this;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Reset all mock state
|
|
141
|
+
*/
|
|
142
|
+
reset() {
|
|
143
|
+
this.config = {
|
|
144
|
+
currentBranch: "main",
|
|
145
|
+
isClean: true,
|
|
146
|
+
isRepository: true,
|
|
147
|
+
branches: ["main"],
|
|
148
|
+
remoteBranches: [],
|
|
149
|
+
remotes: ["origin"],
|
|
150
|
+
trees: new Map(),
|
|
151
|
+
};
|
|
152
|
+
this.commandHistory = [];
|
|
153
|
+
this.mockResponses.clear();
|
|
154
|
+
return this;
|
|
155
|
+
}
|
|
156
|
+
// --- Private helpers ---
|
|
157
|
+
handleCommand(args) {
|
|
158
|
+
const [command, ...rest] = args;
|
|
159
|
+
switch (command) {
|
|
160
|
+
case "status":
|
|
161
|
+
return {
|
|
162
|
+
stdout: this.config.isClean ? "" : "M some-file.md\n",
|
|
163
|
+
stderr: "",
|
|
164
|
+
exitCode: 0,
|
|
165
|
+
};
|
|
166
|
+
case "branch":
|
|
167
|
+
if (rest.includes("--show-current")) {
|
|
168
|
+
return { stdout: this.config.currentBranch, stderr: "", exitCode: 0 };
|
|
169
|
+
}
|
|
170
|
+
if (rest.includes("-r")) {
|
|
171
|
+
return { stdout: this.config.remoteBranches.join("\n"), stderr: "", exitCode: 0 };
|
|
172
|
+
}
|
|
173
|
+
if (rest.includes("-a")) {
|
|
174
|
+
return {
|
|
175
|
+
stdout: [...this.config.branches, ...this.config.remoteBranches].join("\n"),
|
|
176
|
+
stderr: "",
|
|
177
|
+
exitCode: 0,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
return { stdout: this.config.branches.join("\n"), stderr: "", exitCode: 0 };
|
|
181
|
+
case "remote":
|
|
182
|
+
return { stdout: this.config.remotes.join("\n"), stderr: "", exitCode: 0 };
|
|
183
|
+
case "rev-parse":
|
|
184
|
+
if (rest.includes("--is-inside-work-tree")) {
|
|
185
|
+
return {
|
|
186
|
+
stdout: this.config.isRepository ? "true" : "",
|
|
187
|
+
stderr: this.config.isRepository ? "" : "fatal: not a git repository",
|
|
188
|
+
exitCode: this.config.isRepository ? 0 : 128,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
return { stdout: "", stderr: "", exitCode: 0 };
|
|
192
|
+
default:
|
|
193
|
+
return { stdout: "", stderr: "", exitCode: 0 };
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=MockGitAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockGitAdapter.js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AAE,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;YAEjD;gBACE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;QACnD,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test adapters for @backlog-md/core
|
|
3
|
+
*
|
|
4
|
+
* Provides in-memory and mock implementations of adapters for testing.
|
|
5
|
+
*/
|
|
6
|
+
export { InMemoryFileSystemAdapter } from "@principal-ai/repository-abstraction";
|
|
7
|
+
export { MockGitAdapter } from "./MockGitAdapter";
|
|
8
|
+
export type { FileSystemAdapter, GlobAdapter, GlobOptions, } from "@principal-ai/repository-abstraction";
|
|
9
|
+
export type { GitAdapter, GitExecResult } from "../abstractions";
|
|
10
|
+
/**
|
|
11
|
+
* Create a complete set of test adapters
|
|
12
|
+
*/
|
|
13
|
+
export declare function createTestAdapters(): {
|
|
14
|
+
fs: any;
|
|
15
|
+
git: any;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test-adapters/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAGjF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,YAAY,EACV,iBAAiB,EACjB,WAAW,EACX,WAAW,GACZ,MAAM,sCAAsC,CAAC;AAE9C,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEjE;;GAEG;AACH,wBAAgB,kBAAkB;;;EAQjC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test adapters for @backlog-md/core
|
|
3
|
+
*
|
|
4
|
+
* Provides in-memory and mock implementations of adapters for testing.
|
|
5
|
+
*/
|
|
6
|
+
// Re-export InMemoryFileSystemAdapter from repository-abstraction
|
|
7
|
+
export { InMemoryFileSystemAdapter } from "@principal-ai/repository-abstraction";
|
|
8
|
+
// Backlog-specific mock adapters
|
|
9
|
+
export { MockGitAdapter } from "./MockGitAdapter";
|
|
10
|
+
/**
|
|
11
|
+
* Create a complete set of test adapters
|
|
12
|
+
*/
|
|
13
|
+
export function createTestAdapters() {
|
|
14
|
+
const { InMemoryFileSystemAdapter } = require("@principal-ai/repository-abstraction");
|
|
15
|
+
const { MockGitAdapter } = require("./MockGitAdapter");
|
|
16
|
+
return {
|
|
17
|
+
fs: new InMemoryFileSystemAdapter(),
|
|
18
|
+
git: new MockGitAdapter(),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/test-adapters/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,kEAAkE;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,iCAAiC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAWlD;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,EAAE,yBAAyB,EAAE,GAAG,OAAO,CAAC,sCAAsC,CAAC,CAAC;IACtF,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAEvD,OAAO;QACL,EAAE,EAAE,IAAI,yBAAyB,EAAE;QACnC,GAAG,EAAE,IAAI,cAAc,EAAE;KAC1B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for @backlog-md/core
|
|
3
|
+
* These types match the Backlog.md codebase exactly for compatibility
|
|
4
|
+
*/
|
|
5
|
+
export type TaskStatus = string;
|
|
6
|
+
export interface AcceptanceCriterion {
|
|
7
|
+
index: number;
|
|
8
|
+
text: string;
|
|
9
|
+
checked: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface AcceptanceCriterionInput {
|
|
12
|
+
text: string;
|
|
13
|
+
checked?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface Task {
|
|
16
|
+
id: string;
|
|
17
|
+
title: string;
|
|
18
|
+
status: TaskStatus;
|
|
19
|
+
assignee: string[];
|
|
20
|
+
reporter?: string;
|
|
21
|
+
createdDate: string;
|
|
22
|
+
updatedDate?: string;
|
|
23
|
+
labels: string[];
|
|
24
|
+
milestone?: string;
|
|
25
|
+
dependencies: string[];
|
|
26
|
+
readonly rawContent?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
implementationPlan?: string;
|
|
29
|
+
implementationNotes?: string;
|
|
30
|
+
/** Structured acceptance criteria parsed from body (checked state + text + index) */
|
|
31
|
+
acceptanceCriteriaItems?: AcceptanceCriterion[];
|
|
32
|
+
parentTaskId?: string;
|
|
33
|
+
subtasks?: string[];
|
|
34
|
+
priority?: "high" | "medium" | "low";
|
|
35
|
+
branch?: string;
|
|
36
|
+
ordinal?: number;
|
|
37
|
+
filePath?: string;
|
|
38
|
+
lastModified?: Date;
|
|
39
|
+
source?: "local" | "remote" | "completed" | "local-branch";
|
|
40
|
+
/** Optional per-task callback command to run on status change (overrides global config) */
|
|
41
|
+
onStatusChange?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Check if a task is locally editable (not from a remote or other local branch)
|
|
45
|
+
*/
|
|
46
|
+
export declare function isLocalEditableTask(task: Task): boolean;
|
|
47
|
+
export interface TaskCreateInput {
|
|
48
|
+
title: string;
|
|
49
|
+
description?: string;
|
|
50
|
+
status?: TaskStatus;
|
|
51
|
+
priority?: "high" | "medium" | "low";
|
|
52
|
+
labels?: string[];
|
|
53
|
+
assignee?: string[];
|
|
54
|
+
dependencies?: string[];
|
|
55
|
+
parentTaskId?: string;
|
|
56
|
+
implementationPlan?: string;
|
|
57
|
+
implementationNotes?: string;
|
|
58
|
+
acceptanceCriteria?: AcceptanceCriterionInput[];
|
|
59
|
+
rawContent?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface TaskUpdateInput {
|
|
62
|
+
title?: string;
|
|
63
|
+
description?: string;
|
|
64
|
+
status?: TaskStatus;
|
|
65
|
+
priority?: "high" | "medium" | "low";
|
|
66
|
+
labels?: string[];
|
|
67
|
+
addLabels?: string[];
|
|
68
|
+
removeLabels?: string[];
|
|
69
|
+
assignee?: string[];
|
|
70
|
+
ordinal?: number;
|
|
71
|
+
dependencies?: string[];
|
|
72
|
+
addDependencies?: string[];
|
|
73
|
+
removeDependencies?: string[];
|
|
74
|
+
implementationPlan?: string;
|
|
75
|
+
appendImplementationPlan?: string[];
|
|
76
|
+
clearImplementationPlan?: boolean;
|
|
77
|
+
implementationNotes?: string;
|
|
78
|
+
appendImplementationNotes?: string[];
|
|
79
|
+
clearImplementationNotes?: boolean;
|
|
80
|
+
acceptanceCriteria?: AcceptanceCriterionInput[];
|
|
81
|
+
addAcceptanceCriteria?: Array<AcceptanceCriterionInput | string>;
|
|
82
|
+
removeAcceptanceCriteria?: number[];
|
|
83
|
+
checkAcceptanceCriteria?: number[];
|
|
84
|
+
uncheckAcceptanceCriteria?: number[];
|
|
85
|
+
rawContent?: string;
|
|
86
|
+
}
|
|
87
|
+
export interface TaskListFilter {
|
|
88
|
+
status?: string;
|
|
89
|
+
assignee?: string;
|
|
90
|
+
priority?: "high" | "medium" | "low";
|
|
91
|
+
parentTaskId?: string;
|
|
92
|
+
labels?: string[];
|
|
93
|
+
}
|
|
94
|
+
export interface Decision {
|
|
95
|
+
id: string;
|
|
96
|
+
title: string;
|
|
97
|
+
date: string;
|
|
98
|
+
status: "proposed" | "accepted" | "rejected" | "superseded";
|
|
99
|
+
context: string;
|
|
100
|
+
decision: string;
|
|
101
|
+
consequences: string;
|
|
102
|
+
alternatives?: string;
|
|
103
|
+
readonly rawContent: string;
|
|
104
|
+
}
|
|
105
|
+
export interface Document {
|
|
106
|
+
id: string;
|
|
107
|
+
title: string;
|
|
108
|
+
type: "readme" | "guide" | "specification" | "other";
|
|
109
|
+
createdDate: string;
|
|
110
|
+
updatedDate?: string;
|
|
111
|
+
rawContent: string;
|
|
112
|
+
tags?: string[];
|
|
113
|
+
name?: string;
|
|
114
|
+
path?: string;
|
|
115
|
+
lastModified?: string;
|
|
116
|
+
}
|
|
117
|
+
export type SearchResultType = "task" | "document" | "decision";
|
|
118
|
+
export type SearchPriorityFilter = "high" | "medium" | "low";
|
|
119
|
+
export interface SearchMatch {
|
|
120
|
+
key?: string;
|
|
121
|
+
indices: Array<[number, number]>;
|
|
122
|
+
value?: unknown;
|
|
123
|
+
}
|
|
124
|
+
export interface SearchFilters {
|
|
125
|
+
status?: string | string[];
|
|
126
|
+
priority?: SearchPriorityFilter | SearchPriorityFilter[];
|
|
127
|
+
assignee?: string | string[];
|
|
128
|
+
labels?: string | string[];
|
|
129
|
+
}
|
|
130
|
+
export interface SearchOptions {
|
|
131
|
+
query?: string;
|
|
132
|
+
limit?: number;
|
|
133
|
+
types?: SearchResultType[];
|
|
134
|
+
filters?: SearchFilters;
|
|
135
|
+
}
|
|
136
|
+
export interface TaskSearchResult {
|
|
137
|
+
type: "task";
|
|
138
|
+
score: number | null;
|
|
139
|
+
task: Task;
|
|
140
|
+
matches?: SearchMatch[];
|
|
141
|
+
}
|
|
142
|
+
export interface DocumentSearchResult {
|
|
143
|
+
type: "document";
|
|
144
|
+
score: number | null;
|
|
145
|
+
document: Document;
|
|
146
|
+
matches?: SearchMatch[];
|
|
147
|
+
}
|
|
148
|
+
export interface DecisionSearchResult {
|
|
149
|
+
type: "decision";
|
|
150
|
+
score: number | null;
|
|
151
|
+
decision: Decision;
|
|
152
|
+
matches?: SearchMatch[];
|
|
153
|
+
}
|
|
154
|
+
export type SearchResult = TaskSearchResult | DocumentSearchResult | DecisionSearchResult;
|
|
155
|
+
export interface Sequence {
|
|
156
|
+
/** 1-based sequence index */
|
|
157
|
+
index: number;
|
|
158
|
+
/** Tasks that can be executed in parallel within this sequence */
|
|
159
|
+
tasks: Task[];
|
|
160
|
+
}
|
|
161
|
+
export interface BacklogConfig {
|
|
162
|
+
projectName: string;
|
|
163
|
+
defaultAssignee?: string;
|
|
164
|
+
defaultReporter?: string;
|
|
165
|
+
statuses: string[];
|
|
166
|
+
labels: string[];
|
|
167
|
+
milestones: string[];
|
|
168
|
+
defaultStatus?: string;
|
|
169
|
+
dateFormat: string;
|
|
170
|
+
maxColumnWidth?: number;
|
|
171
|
+
taskResolutionStrategy?: "most_recent" | "most_progressed";
|
|
172
|
+
defaultEditor?: string;
|
|
173
|
+
autoOpenBrowser?: boolean;
|
|
174
|
+
defaultPort?: number;
|
|
175
|
+
remoteOperations?: boolean;
|
|
176
|
+
autoCommit?: boolean;
|
|
177
|
+
zeroPaddedIds?: number;
|
|
178
|
+
timezonePreference?: string;
|
|
179
|
+
includeDateTimeInDates?: boolean;
|
|
180
|
+
bypassGitHooks?: boolean;
|
|
181
|
+
checkActiveBranches?: boolean;
|
|
182
|
+
activeBranchDays?: number;
|
|
183
|
+
/** Global callback command to run on any task status change. Supports $TASK_ID, $OLD_STATUS, $NEW_STATUS, $TASK_TITLE variables. */
|
|
184
|
+
onStatusChange?: string;
|
|
185
|
+
mcp?: {
|
|
186
|
+
http?: {
|
|
187
|
+
host?: string;
|
|
188
|
+
port?: number;
|
|
189
|
+
auth?: {
|
|
190
|
+
type?: "bearer" | "basic" | "none";
|
|
191
|
+
token?: string;
|
|
192
|
+
username?: string;
|
|
193
|
+
password?: string;
|
|
194
|
+
};
|
|
195
|
+
cors?: {
|
|
196
|
+
origin?: string | string[];
|
|
197
|
+
credentials?: boolean;
|
|
198
|
+
};
|
|
199
|
+
enableDnsRebindingProtection?: boolean;
|
|
200
|
+
allowedHosts?: string[];
|
|
201
|
+
allowedOrigins?: string[];
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
export interface ParsedMarkdown {
|
|
206
|
+
frontmatter: Record<string, unknown>;
|
|
207
|
+
content: string;
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAGhC,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,qFAAqF;IACrF,uBAAuB,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAChD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,G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
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Check if a task is locally editable (not from a remote or other local branch)
|
|
7
|
+
*/
|
|
8
|
+
export function isLocalEditableTask(task) {
|
|
9
|
+
return task.source === undefined || task.source === "local" || task.source === "completed";
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA8CH;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAU;IAC5C,OAAO,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,IAAI,IAAI,CAAC,MAAM,KAAK,WAAW,CAAC;AAC7F,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task sorting utilities
|
|
3
|
+
*/
|
|
4
|
+
import type { Task } from "../types";
|
|
5
|
+
/**
|
|
6
|
+
* Sort tasks by: ordinal → priority → createdDate
|
|
7
|
+
*
|
|
8
|
+
* - Tasks with ordinal are sorted first by ordinal
|
|
9
|
+
* - Then by priority (high → medium → low)
|
|
10
|
+
* - Finally by createdDate (newest first)
|
|
11
|
+
*/
|
|
12
|
+
export declare function sortTasks(tasks: Task[]): Task[];
|
|
13
|
+
/**
|
|
14
|
+
* Group tasks by status
|
|
15
|
+
*
|
|
16
|
+
* @param tasks - Tasks to group
|
|
17
|
+
* @param statuses - Ordered list of statuses (for column ordering)
|
|
18
|
+
* @returns Map with status as key and sorted tasks as value
|
|
19
|
+
*/
|
|
20
|
+
export declare function groupTasksByStatus(tasks: Task[], statuses: string[]): Map<string, Task[]>;
|
|
21
|
+
//# sourceMappingURL=sorting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sorting.d.ts","sourceRoot":"","sources":["../../src/utils/sorting.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAQrC;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,CAkB/C;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,IAAI,EAAE,EACb,QAAQ,EAAE,MAAM,EAAE,GACjB,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAyBrB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task sorting utilities
|
|
3
|
+
*/
|
|
4
|
+
const PRIORITY_ORDER = {
|
|
5
|
+
high: 0,
|
|
6
|
+
medium: 1,
|
|
7
|
+
low: 2,
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Sort tasks by: ordinal → priority → createdDate
|
|
11
|
+
*
|
|
12
|
+
* - Tasks with ordinal are sorted first by ordinal
|
|
13
|
+
* - Then by priority (high → medium → low)
|
|
14
|
+
* - Finally by createdDate (newest first)
|
|
15
|
+
*/
|
|
16
|
+
export function sortTasks(tasks) {
|
|
17
|
+
return [...tasks].sort((a, b) => {
|
|
18
|
+
// 1. Ordinal (if both have it)
|
|
19
|
+
if (a.ordinal !== undefined && b.ordinal !== undefined) {
|
|
20
|
+
return a.ordinal - b.ordinal;
|
|
21
|
+
}
|
|
22
|
+
// Tasks with ordinal come before tasks without
|
|
23
|
+
if (a.ordinal !== undefined)
|
|
24
|
+
return -1;
|
|
25
|
+
if (b.ordinal !== undefined)
|
|
26
|
+
return 1;
|
|
27
|
+
// 2. Priority (high → medium → low → undefined)
|
|
28
|
+
const aPri = a.priority ? PRIORITY_ORDER[a.priority] : 3;
|
|
29
|
+
const bPri = b.priority ? PRIORITY_ORDER[b.priority] : 3;
|
|
30
|
+
if (aPri !== bPri)
|
|
31
|
+
return aPri - bPri;
|
|
32
|
+
// 3. Created date (newest first)
|
|
33
|
+
return b.createdDate.localeCompare(a.createdDate);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Group tasks by status
|
|
38
|
+
*
|
|
39
|
+
* @param tasks - Tasks to group
|
|
40
|
+
* @param statuses - Ordered list of statuses (for column ordering)
|
|
41
|
+
* @returns Map with status as key and sorted tasks as value
|
|
42
|
+
*/
|
|
43
|
+
export function groupTasksByStatus(tasks, statuses) {
|
|
44
|
+
const grouped = new Map();
|
|
45
|
+
// Initialize with all configured statuses (preserves column order)
|
|
46
|
+
for (const status of statuses) {
|
|
47
|
+
grouped.set(status, []);
|
|
48
|
+
}
|
|
49
|
+
// Group tasks
|
|
50
|
+
for (const task of tasks) {
|
|
51
|
+
const list = grouped.get(task.status);
|
|
52
|
+
if (list) {
|
|
53
|
+
list.push(task);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
// Task has a status not in the config - add it anyway
|
|
57
|
+
grouped.set(task.status, [task]);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// Sort tasks within each status
|
|
61
|
+
for (const [status, statusTasks] of grouped) {
|
|
62
|
+
grouped.set(status, sortTasks(statusTasks));
|
|
63
|
+
}
|
|
64
|
+
return grouped;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=sorting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sorting.js","sourceRoot":"","sources":["../../src/ut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