kanbo-cli 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/LICENSE +21 -0
- package/README.md +79 -0
- package/dist/better-sqlite3-fU3G4xnX.cjs +2254 -0
- package/dist/better-sqlite3-fU3G4xnX.cjs.map +1 -0
- package/dist/cli.cjs +42949 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/dist-Cd6wg8pp.cjs +942 -0
- package/dist/dist-Cd6wg8pp.cjs.map +1 -0
- package/dist/drizzle-postgres/0000_board.sql +135 -0
- package/dist/drizzle-postgres/0001_history_order.sql +2 -0
- package/dist/drizzle-postgres/0002_issue_pull_requests.sql +16 -0
- package/dist/drizzle-postgres/0003_milestone_start_date.sql +1 -0
- package/dist/drizzle-postgres/0004_status_entry_rules.sql +1 -0
- package/dist/drizzle-postgres/0005_run_external_session_ref.sql +1 -0
- package/dist/drizzle-postgres/README.md +61 -0
- package/dist/drizzle-postgres/meta/0000_snapshot.json +1078 -0
- package/dist/drizzle-postgres/meta/0001_snapshot.json +1090 -0
- package/dist/drizzle-postgres/meta/0002_snapshot.json +1239 -0
- package/dist/drizzle-postgres/meta/0003_snapshot.json +1245 -0
- package/dist/drizzle-postgres/meta/0004_snapshot.json +1251 -0
- package/dist/drizzle-postgres/meta/0005_snapshot.json +1257 -0
- package/dist/drizzle-postgres/meta/_journal.json +48 -0
- package/dist/drizzle-sqlite/0000_board.sql +133 -0
- package/dist/drizzle-sqlite/0001_issue_pull_requests.sql +15 -0
- package/dist/drizzle-sqlite/0002_milestone_start_date.sql +1 -0
- package/dist/drizzle-sqlite/0003_status_entry_rules.sql +1 -0
- package/dist/drizzle-sqlite/0004_run_external_session_ref.sql +1 -0
- package/dist/drizzle-sqlite/README.md +67 -0
- package/dist/drizzle-sqlite/meta/0000_snapshot.json +946 -0
- package/dist/drizzle-sqlite/meta/0001_snapshot.json +1054 -0
- package/dist/drizzle-sqlite/meta/0002_snapshot.json +1061 -0
- package/dist/drizzle-sqlite/meta/0003_snapshot.json +1068 -0
- package/dist/drizzle-sqlite/meta/0004_snapshot.json +1075 -0
- package/dist/drizzle-sqlite/meta/_journal.json +41 -0
- package/dist/lib/board-store-B16YarvX.d.mts +281 -0
- package/dist/lib/board-store-BHHo_ZlR.d.cts +281 -0
- package/dist/lib/index.cjs +340 -0
- package/dist/lib/index.cjs.map +1 -0
- package/dist/lib/index.d.cts +1608 -0
- package/dist/lib/index.d.mts +1608 -0
- package/dist/lib/index.mjs +284 -0
- package/dist/lib/index.mjs.map +1 -0
- package/dist/lib/manifest-C0EcwwgO.mjs +7866 -0
- package/dist/lib/manifest-C0EcwwgO.mjs.map +1 -0
- package/dist/lib/manifest-CpZOcB_6.cjs +8272 -0
- package/dist/lib/manifest-CpZOcB_6.cjs.map +1 -0
- package/dist/lib/mcp/index.cjs +184 -0
- package/dist/lib/mcp/index.cjs.map +1 -0
- package/dist/lib/mcp/index.d.cts +346 -0
- package/dist/lib/mcp/index.d.mts +346 -0
- package/dist/lib/mcp/index.mjs +173 -0
- package/dist/lib/mcp/index.mjs.map +1 -0
- package/dist/lib/migrate-BhYi9cXw.mjs +656 -0
- package/dist/lib/migrate-BhYi9cXw.mjs.map +1 -0
- package/dist/lib/migrate-DnMjTCvu.cjs +709 -0
- package/dist/lib/migrate-DnMjTCvu.cjs.map +1 -0
- package/dist/lib/migrations-path-CZxVOgeD.cjs +109 -0
- package/dist/lib/migrations-path-CZxVOgeD.cjs.map +1 -0
- package/dist/lib/migrations-path-Ciwan537.mjs +80 -0
- package/dist/lib/migrations-path-Ciwan537.mjs.map +1 -0
- package/dist/lib/postgres/index.cjs +56 -0
- package/dist/lib/postgres/index.cjs.map +1 -0
- package/dist/lib/postgres/index.d.cts +3403 -0
- package/dist/lib/postgres/index.d.mts +3403 -0
- package/dist/lib/postgres/index.mjs +35 -0
- package/dist/lib/postgres/index.mjs.map +1 -0
- package/dist/lib/roles.sql-B9rt-x4o.cjs +1033 -0
- package/dist/lib/roles.sql-B9rt-x4o.cjs.map +1 -0
- package/dist/lib/roles.sql-CvyCGt38.mjs +920 -0
- package/dist/lib/roles.sql-CvyCGt38.mjs.map +1 -0
- package/dist/lib/schema-epoch-ZyumVL_A.d.cts +16 -0
- package/dist/lib/schema-epoch-ZyumVL_A.d.mts +16 -0
- package/dist/lib/schema-fsHqNAip.d.cts +3612 -0
- package/dist/lib/schema-fsHqNAip.d.mts +3612 -0
- package/dist/lib/sqlite/index.cjs +23 -0
- package/dist/lib/sqlite/index.d.cts +175 -0
- package/dist/lib/sqlite/index.d.mts +175 -0
- package/dist/lib/sqlite/index.mjs +4 -0
- package/dist/lib/sqlite/schema.cjs +266 -0
- package/dist/lib/sqlite/schema.cjs.map +1 -0
- package/dist/lib/sqlite/schema.d.cts +2 -0
- package/dist/lib/sqlite/schema.d.mts +2 -0
- package/dist/lib/sqlite/schema.mjs +256 -0
- package/dist/lib/sqlite/schema.mjs.map +1 -0
- package/dist/lib/tool-names-9cmCn0gP.d.cts +112 -0
- package/dist/lib/tool-names-Dxg1UTUl.d.mts +112 -0
- package/dist/page/board.css +477 -0
- package/dist/page/board.js +2 -0
- package/drizzle-postgres/0000_board.sql +135 -0
- package/drizzle-postgres/0001_history_order.sql +2 -0
- package/drizzle-postgres/0002_issue_pull_requests.sql +16 -0
- package/drizzle-postgres/0003_milestone_start_date.sql +1 -0
- package/drizzle-postgres/0004_status_entry_rules.sql +1 -0
- package/drizzle-postgres/0005_run_external_session_ref.sql +1 -0
- package/drizzle-postgres/README.md +61 -0
- package/drizzle-postgres/meta/0000_snapshot.json +1078 -0
- package/drizzle-postgres/meta/0001_snapshot.json +1090 -0
- package/drizzle-postgres/meta/0002_snapshot.json +1239 -0
- package/drizzle-postgres/meta/0003_snapshot.json +1245 -0
- package/drizzle-postgres/meta/0004_snapshot.json +1251 -0
- package/drizzle-postgres/meta/0005_snapshot.json +1257 -0
- package/drizzle-postgres/meta/_journal.json +48 -0
- package/drizzle-sqlite/0000_board.sql +133 -0
- package/drizzle-sqlite/0001_issue_pull_requests.sql +15 -0
- package/drizzle-sqlite/0002_milestone_start_date.sql +1 -0
- package/drizzle-sqlite/0003_status_entry_rules.sql +1 -0
- package/drizzle-sqlite/0004_run_external_session_ref.sql +1 -0
- package/drizzle-sqlite/README.md +67 -0
- package/drizzle-sqlite/meta/0000_snapshot.json +946 -0
- package/drizzle-sqlite/meta/0001_snapshot.json +1054 -0
- package/drizzle-sqlite/meta/0002_snapshot.json +1061 -0
- package/drizzle-sqlite/meta/0003_snapshot.json +1068 -0
- package/drizzle-sqlite/meta/0004_snapshot.json +1075 -0
- package/drizzle-sqlite/meta/_journal.json +41 -0
- package/package.json +147 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { $ as formatPlainActivityValue, A as formatExternalSessionRef, B as readChangeSeq, C as ignoreBoardFile, D as maskDatabaseUrl, E as writeBinding, F as UNMET_ENTRY_RULE_REASONS, G as diffFieldChanges, H as DEFAULT_STATUSES, I as evaluateEntryRules, J as activityKindOrder, K as BOARD_ACTOR, L as readChecklist, M as pullRequestFactKeys, N as ENTRY_RULES, O as maskDatabaseUrls, P as ENTRY_RULE_DESCRIPTIONS, Q as formatActivityIssueReference, R as readEntryRules, S as BINDING_FILE_PATH, T as readProjectBinding, U as normalizeStatusName, V as runBoardWrite, W as TRACKED_FIELDS, X as activityToken, Y as activityText, Z as commentAuthorReference, a as BOARD_ERROR_RESPONSES, at as toIssueView, b as DEFAULT_BOARD_FILE_PATH, ct as nextIssueNumber, et as isEmptyActivityValue, i as KANBO_TOOL_NAMES, it as normalizeCommentAuthorKind, j as parseExternalSessionRef, k as createBoardOps, lt as nextIssueOrder, n as buildCapabilitiesManifest, nt as readSystemCommentKind, ot as formatIssueId, q as currentUnixSeconds, r as KANBO_TOOL_CLI_EQUIVALENTS, rt as isOutsideWriter, st as nextIssueIdentity, t as CAPABILITIES_MANIFEST_VERSION, tt as parseActivityStringArray, ut as readIssuePrefix, w as readBinding, x as renderCapabilitiesMarkdown, z as serializeEntryRules } from "./manifest-C0EcwwgO.mjs";
|
|
2
|
+
import { a as BoardError } from "./migrations-path-Ciwan537.mjs";
|
|
3
|
+
//#region src/domain/card-display-title.ts
|
|
4
|
+
/**
|
|
5
|
+
* What a card is called wherever a person or an agent reads it by name.
|
|
6
|
+
*
|
|
7
|
+
* A card written as a description alone is titled with its own key (every
|
|
8
|
+
* writer does that). Named by its key, such a card says nothing — so its name
|
|
9
|
+
* is the first line of its description instead. A browser bundle that does not
|
|
10
|
+
* load this package keeps the same rule on its own, tested with the same
|
|
11
|
+
* examples.
|
|
12
|
+
*/
|
|
13
|
+
/** How long a description line may run before it is cut with an ellipsis. */
|
|
14
|
+
const DESCRIPTION_LINE_LIMIT = 120;
|
|
15
|
+
function cardDisplayTitle(card) {
|
|
16
|
+
if (card.title !== card.id) return card.title;
|
|
17
|
+
return descriptionFirstLine(card.description) ?? card.title;
|
|
18
|
+
}
|
|
19
|
+
function descriptionFirstLine(description) {
|
|
20
|
+
for (const rawLine of (description ?? "").split("\n")) {
|
|
21
|
+
const line = stripMarkdown(rawLine);
|
|
22
|
+
if (line) return line.length > DESCRIPTION_LINE_LIMIT ? `${line.slice(0, 119).trimEnd()}…` : line;
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
function stripMarkdown(line) {
|
|
27
|
+
return line.replace(/^\s*(?:>\s*)+/, "").replace(/^\s*#{1,6}\s+/, "").replace(/^\s*(?:[-*+]|\d+[.)])\s+(?:\[[ x]\]\s+)?/i, "").replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/<[^>]+>/g, "").replace(/[*_~`]/g, "").replace(/\s+/g, " ").trim();
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/ops/board-copy.ts
|
|
31
|
+
/** Nothing copied — what a move that had nothing to move reports. */
|
|
32
|
+
function emptyCopyCounts() {
|
|
33
|
+
return {
|
|
34
|
+
statuses: 0,
|
|
35
|
+
milestones: 0,
|
|
36
|
+
issues: 0,
|
|
37
|
+
comments: 0,
|
|
38
|
+
runs: 0,
|
|
39
|
+
relations: 0,
|
|
40
|
+
fieldChanges: 0,
|
|
41
|
+
contextRefs: 0,
|
|
42
|
+
pullRequests: 0
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Everything the workspace has on this board, read in one pass before a single
|
|
47
|
+
* row is written anywhere.
|
|
48
|
+
*
|
|
49
|
+
* Links are collected by id because an edge is listed by both of the cards it
|
|
50
|
+
* touches, and one reaching a card outside this workspace is left behind rather
|
|
51
|
+
* than copied: the target holds this workspace's board and nothing else, so the
|
|
52
|
+
* far end of that edge is not there to point at.
|
|
53
|
+
*/
|
|
54
|
+
async function readBoardSlice(from, workspaceId) {
|
|
55
|
+
const warnings = [];
|
|
56
|
+
const statuses = await from.statuses.listByWorkspace(workspaceId);
|
|
57
|
+
const milestones = await from.milestones.listByWorkspace(workspaceId);
|
|
58
|
+
const issues = orderParentsFirst(await from.issues.listByWorkspace(workspaceId));
|
|
59
|
+
const issueIds = new Set(issues.map((issue) => issue.id));
|
|
60
|
+
const comments = [];
|
|
61
|
+
const runs = [];
|
|
62
|
+
const relations = /* @__PURE__ */ new Map();
|
|
63
|
+
const fieldChanges = [];
|
|
64
|
+
const pullRequests = [];
|
|
65
|
+
const skippedRelations = /* @__PURE__ */ new Set();
|
|
66
|
+
for (const issue of issues) {
|
|
67
|
+
comments.push(...await from.comments.listByIssue(issue.id));
|
|
68
|
+
runs.push(...await from.runs.listByIssue(issue.id));
|
|
69
|
+
for (const relation of await from.relations.listByIssue(issue.id)) {
|
|
70
|
+
if (issueIds.has(relation.sourceIssueId) && issueIds.has(relation.targetIssueId)) {
|
|
71
|
+
relations.set(relation.id, relation);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
skippedRelations.add(relation.id);
|
|
75
|
+
}
|
|
76
|
+
fieldChanges.push(...await from.fieldChanges.listByIssue(issue.id));
|
|
77
|
+
pullRequests.push(...await from.pullRequests.listByIssue(issue.id));
|
|
78
|
+
}
|
|
79
|
+
if (skippedRelations.size > 0) warnings.push(`${skippedRelations.size} links to cards in other workspaces were not moved`);
|
|
80
|
+
return {
|
|
81
|
+
statuses,
|
|
82
|
+
milestones,
|
|
83
|
+
issues,
|
|
84
|
+
comments,
|
|
85
|
+
runs,
|
|
86
|
+
relations: [...relations.values()],
|
|
87
|
+
fieldChanges,
|
|
88
|
+
pullRequests,
|
|
89
|
+
warnings
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Write a slice into the target board, in one transaction, and say what was
|
|
94
|
+
* written and what a person should know about it — the slice's own warnings
|
|
95
|
+
* first.
|
|
96
|
+
*
|
|
97
|
+
* It is idempotent by id. A row the target already has is left exactly as it
|
|
98
|
+
* is and counted as already present, so a copy interrupted half-way is finished
|
|
99
|
+
* by running it again, and a second run of a finished one copies nothing. A
|
|
100
|
+
* clash that is not the same row — a column name or a card number the target
|
|
101
|
+
* holds under another id — refuses the whole copy before its first insert
|
|
102
|
+
* (`board_copy_conflict`, ruling 3-55).
|
|
103
|
+
*/
|
|
104
|
+
async function writeBoardSlice(to, slice, workspaceId) {
|
|
105
|
+
const warnings = [...slice.warnings];
|
|
106
|
+
const copied = emptyCopyCounts();
|
|
107
|
+
let alreadyPresent = 0;
|
|
108
|
+
await to.transaction(async (tx) => {
|
|
109
|
+
await assertTheCopyFits(tx, slice, workspaceId);
|
|
110
|
+
for (const status of slice.statuses) {
|
|
111
|
+
if (await tx.statuses.findById(status.id)) {
|
|
112
|
+
alreadyPresent += 1;
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
await tx.statuses.create(status);
|
|
116
|
+
copied.statuses += 1;
|
|
117
|
+
}
|
|
118
|
+
for (const milestone of slice.milestones) {
|
|
119
|
+
if (await tx.milestones.findById(milestone.id)) {
|
|
120
|
+
alreadyPresent += 1;
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
await tx.milestones.create(milestone);
|
|
124
|
+
copied.milestones += 1;
|
|
125
|
+
}
|
|
126
|
+
const movingIssueIds = new Set(slice.issues.map((issue) => issue.id));
|
|
127
|
+
for (const issue of slice.issues) {
|
|
128
|
+
if (await tx.issues.findById(issue.id)) {
|
|
129
|
+
alreadyPresent += 1;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
const parentIsReachable = issue.parentIssueId === null || movingIssueIds.has(issue.parentIssueId) || await tx.issues.findById(issue.parentIssueId) !== null;
|
|
133
|
+
if (!parentIsReachable) warnings.push(`${issue.id} lost its parent card, which is not on this board`);
|
|
134
|
+
const { contextRefs, ...row } = issue;
|
|
135
|
+
await tx.issues.create({
|
|
136
|
+
...row,
|
|
137
|
+
parentIssueId: parentIsReachable ? issue.parentIssueId : null
|
|
138
|
+
});
|
|
139
|
+
copied.issues += 1;
|
|
140
|
+
if (contextRefs !== "[]") {
|
|
141
|
+
await tx.contextRefs.replace(issue.id, contextRefs, issue.updatedAt);
|
|
142
|
+
copied.contextRefs += 1;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
for (const comment of slice.comments) {
|
|
146
|
+
if (await tx.comments.findById(comment.id)) {
|
|
147
|
+
alreadyPresent += 1;
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
await tx.comments.create(comment);
|
|
151
|
+
copied.comments += 1;
|
|
152
|
+
}
|
|
153
|
+
for (const run of slice.runs) {
|
|
154
|
+
if (await tx.runs.findById(run.id)) {
|
|
155
|
+
alreadyPresent += 1;
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
await tx.runs.create(run);
|
|
159
|
+
copied.runs += 1;
|
|
160
|
+
}
|
|
161
|
+
for (const relation of slice.relations) {
|
|
162
|
+
if (await tx.relations.findById(relation.id)) {
|
|
163
|
+
alreadyPresent += 1;
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
await tx.relations.create(relation);
|
|
167
|
+
copied.relations += 1;
|
|
168
|
+
}
|
|
169
|
+
const changesByIssue = /* @__PURE__ */ new Map();
|
|
170
|
+
for (const change of slice.fieldChanges) changesByIssue.set(change.issueId, [...changesByIssue.get(change.issueId) ?? [], change]);
|
|
171
|
+
for (const [issueId, changes] of changesByIssue) {
|
|
172
|
+
const present = new Set((await tx.fieldChanges.listByIssue(issueId)).map((change) => change.id));
|
|
173
|
+
for (const change of changes) {
|
|
174
|
+
if (present.has(change.id)) {
|
|
175
|
+
alreadyPresent += 1;
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
await tx.fieldChanges.create(change);
|
|
179
|
+
copied.fieldChanges += 1;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
const linksByIssue = /* @__PURE__ */ new Map();
|
|
183
|
+
for (const link of slice.pullRequests) linksByIssue.set(link.issueId, [...linksByIssue.get(link.issueId) ?? [], link]);
|
|
184
|
+
for (const [issueId, links] of linksByIssue) {
|
|
185
|
+
const present = new Set((await tx.pullRequests.listByIssue(issueId)).map((link) => link.id));
|
|
186
|
+
for (const link of links) {
|
|
187
|
+
if (present.has(link.id) || (await tx.pullRequests.link(link)).id !== link.id) {
|
|
188
|
+
alreadyPresent += 1;
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
copied.pullRequests += 1;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
await tx.meta.bumpRevision("board", currentUnixSeconds());
|
|
195
|
+
});
|
|
196
|
+
if (alreadyPresent > 0) warnings.push(`${alreadyPresent} rows were already present on the target board and were left as they are`);
|
|
197
|
+
return {
|
|
198
|
+
copied,
|
|
199
|
+
warnings
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Empty the slice off the board it was read from, in a transaction of its own.
|
|
204
|
+
*
|
|
205
|
+
* Only the cards, the columns and the milestones are named: comments, runs,
|
|
206
|
+
* links, pull request links and the field-change history hang off a card by a
|
|
207
|
+
* foreign key that cascades on both engines, so deleting the card takes them
|
|
208
|
+
* with it.
|
|
209
|
+
*/
|
|
210
|
+
async function deleteBoardSlice(from, slice) {
|
|
211
|
+
await from.transaction(async (tx) => {
|
|
212
|
+
for (const issue of slice.issues) await tx.issues.delete(issue.id);
|
|
213
|
+
for (const milestone of slice.milestones) await tx.milestones.delete(milestone.id);
|
|
214
|
+
for (const status of slice.statuses) await tx.statuses.delete(status.id);
|
|
215
|
+
await tx.meta.bumpRevision("board", currentUnixSeconds());
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* What a copy would collide with on the target, said before a row is written.
|
|
220
|
+
*
|
|
221
|
+
* The board carries two uniqueness rules that a *second* board of the same
|
|
222
|
+
* workspace can break: a column's name within its workspace, and a card's
|
|
223
|
+
* number within it. In practice it is the columns that collide: a standard set
|
|
224
|
+
* created a second time carries the same names under new ids, while a card's id
|
|
225
|
+
* is its key (`BST-001`), so two generations of card *number* 1 are two rows
|
|
226
|
+
* with one id — which the copy treats as already present rather than as a
|
|
227
|
+
* clash. The number check covers the case where they are not: a workspace whose
|
|
228
|
+
* identifier changed between the two generations numbers from 1 again under
|
|
229
|
+
* different ids.
|
|
230
|
+
*
|
|
231
|
+
* A row the target already has *by id* is not a collision — it is the
|
|
232
|
+
* idempotent half of the copy, which is why the holder's id is compared rather
|
|
233
|
+
* than merely counted. Milestones need no check: neither engine makes their
|
|
234
|
+
* titles unique.
|
|
235
|
+
*/
|
|
236
|
+
async function assertTheCopyFits(tx, slice, workspaceId) {
|
|
237
|
+
const conflicts = [];
|
|
238
|
+
const numbers = new Map((await tx.issues.listByWorkspace(workspaceId)).map((issue) => [issue.number, issue.id]));
|
|
239
|
+
for (const issue of slice.issues) {
|
|
240
|
+
const holder = numbers.get(issue.number);
|
|
241
|
+
if (holder !== void 0 && holder !== issue.id) conflicts.push({
|
|
242
|
+
kind: "card",
|
|
243
|
+
value: issue.number,
|
|
244
|
+
heldBy: holder
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
const names = new Map((await tx.statuses.listByWorkspace(workspaceId)).map((status) => [status.name, status.id]));
|
|
248
|
+
for (const status of slice.statuses) {
|
|
249
|
+
const holder = names.get(status.name);
|
|
250
|
+
if (holder !== void 0 && holder !== status.id) conflicts.push({
|
|
251
|
+
kind: "column",
|
|
252
|
+
value: status.name,
|
|
253
|
+
heldBy: holder
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
if (conflicts.length > 0) throw new BoardError("board_copy_conflict", {
|
|
257
|
+
workspaceId,
|
|
258
|
+
conflicts
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* The same cards, ordered so that a parent is always written before its
|
|
263
|
+
* children. The column is a foreign key onto the same table, so any other order
|
|
264
|
+
* writes a card pointing at one that is not there yet.
|
|
265
|
+
*/
|
|
266
|
+
function orderParentsFirst(issues) {
|
|
267
|
+
const byId = new Map(issues.map((issue) => [issue.id, issue]));
|
|
268
|
+
const ordered = [];
|
|
269
|
+
const placed = /* @__PURE__ */ new Set();
|
|
270
|
+
function place(issue, ancestors) {
|
|
271
|
+
if (placed.has(issue.id) || ancestors.has(issue.id)) return;
|
|
272
|
+
ancestors.add(issue.id);
|
|
273
|
+
const parent = issue.parentIssueId === null ? void 0 : byId.get(issue.parentIssueId);
|
|
274
|
+
if (parent) place(parent, ancestors);
|
|
275
|
+
placed.add(issue.id);
|
|
276
|
+
ordered.push(issue);
|
|
277
|
+
}
|
|
278
|
+
for (const issue of issues) place(issue, /* @__PURE__ */ new Set());
|
|
279
|
+
return ordered;
|
|
280
|
+
}
|
|
281
|
+
//#endregion
|
|
282
|
+
export { BINDING_FILE_PATH, BOARD_ACTOR, BOARD_ERROR_RESPONSES, BoardError, CAPABILITIES_MANIFEST_VERSION, DEFAULT_BOARD_FILE_PATH, DEFAULT_STATUSES, ENTRY_RULES, ENTRY_RULE_DESCRIPTIONS, KANBO_TOOL_CLI_EQUIVALENTS, KANBO_TOOL_NAMES, TRACKED_FIELDS, UNMET_ENTRY_RULE_REASONS, activityKindOrder, activityText, activityToken, buildCapabilitiesManifest, cardDisplayTitle, commentAuthorReference, createBoardOps, currentUnixSeconds, deleteBoardSlice, diffFieldChanges, emptyCopyCounts, evaluateEntryRules, formatActivityIssueReference, formatExternalSessionRef, formatIssueId, formatPlainActivityValue, ignoreBoardFile, isEmptyActivityValue, isOutsideWriter, maskDatabaseUrl, maskDatabaseUrls, nextIssueIdentity, nextIssueNumber, nextIssueOrder, normalizeCommentAuthorKind, normalizeStatusName, parseActivityStringArray, parseExternalSessionRef, pullRequestFactKeys, readBinding, readBoardSlice, readChangeSeq, readChecklist, readEntryRules, readIssuePrefix, readProjectBinding, readSystemCommentKind, renderCapabilitiesMarkdown, runBoardWrite, serializeEntryRules, toIssueView, writeBinding, writeBoardSlice };
|
|
283
|
+
|
|
284
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/domain/card-display-title.ts","../../src/ops/board-copy.ts"],"sourcesContent":["/**\n * What a card is called wherever a person or an agent reads it by name.\n *\n * A card written as a description alone is titled with its own key (every\n * writer does that). Named by its key, such a card says nothing — so its name\n * is the first line of its description instead. A browser bundle that does not\n * load this package keeps the same rule on its own, tested with the same\n * examples.\n */\n\n/** How long a description line may run before it is cut with an ellipsis. */\nconst DESCRIPTION_LINE_LIMIT = 120\n\nexport function cardDisplayTitle(card: { id: string, title: string, description?: string | null }): string {\n if (card.title !== card.id) {\n return card.title\n }\n return descriptionFirstLine(card.description) ?? card.title\n}\n\nfunction descriptionFirstLine(description: string | null | undefined): string | null {\n for (const rawLine of (description ?? '').split('\\n')) {\n const line = stripMarkdown(rawLine)\n if (line) {\n return line.length > DESCRIPTION_LINE_LIMIT ? `${line.slice(0, DESCRIPTION_LINE_LIMIT - 1).trimEnd()}…` : line\n }\n }\n return null\n}\n\nfunction stripMarkdown(line: string): string {\n return line\n .replace(/^\\s*(?:>\\s*)+/, '')\n .replace(/^\\s*#{1,6}\\s+/, '')\n .replace(/^\\s*(?:[-*+]|\\d+[.)])\\s+(?:\\[[ x]\\]\\s+)?/i, '')\n .replace(/!\\[([^\\]]*)\\]\\([^)]*\\)/g, '$1')\n .replace(/\\[([^\\]]*)\\]\\([^)]*\\)/g, '$1')\n .replace(/<[^>]+>/g, '')\n .replace(/[*_~`]/g, '')\n .replace(/\\s+/g, ' ')\n .trim()\n}\n","import type { BoardStore } from '../board-store'\nimport { BoardError } from '../domain/errors'\nimport { currentUnixSeconds } from '../domain/time'\nimport type {\n Issue,\n IssueComment,\n IssueFieldChange,\n IssueMilestone,\n IssuePullRequest,\n IssueRelation,\n IssueRun,\n IssueStatus,\n} from '../sqlite/schema'\n\n/** How many rows of each kind a copy wrote into the target board. */\nexport interface BoardCopyCounts {\n statuses: number\n milestones: number\n issues: number\n comments: number\n runs: number\n relations: number\n fieldChanges: number\n /** Cards that carried refs, not rows: context refs are a column on the card. */\n contextRefs: number\n pullRequests: number\n}\n\n/** Everything one workspace has on a board, read before anything is written. */\nexport interface BoardSlice {\n statuses: IssueStatus[]\n milestones: IssueMilestone[]\n /** In an order where a card's parent always comes before it. */\n issues: Issue[]\n comments: IssueComment[]\n runs: IssueRun[]\n relations: IssueRelation[]\n fieldChanges: IssueFieldChange[]\n pullRequests: IssuePullRequest[]\n /** What reading it had to leave behind, said to a person. */\n warnings: string[]\n}\n\n/** Nothing copied — what a move that had nothing to move reports. */\nexport function emptyCopyCounts(): BoardCopyCounts {\n return { statuses: 0, milestones: 0, issues: 0, comments: 0, runs: 0, relations: 0, fieldChanges: 0, contextRefs: 0, pullRequests: 0 }\n}\n\n/**\n * Everything the workspace has on this board, read in one pass before a single\n * row is written anywhere.\n *\n * Links are collected by id because an edge is listed by both of the cards it\n * touches, and one reaching a card outside this workspace is left behind rather\n * than copied: the target holds this workspace's board and nothing else, so the\n * far end of that edge is not there to point at.\n */\nexport async function readBoardSlice(from: BoardStore, workspaceId: string): Promise<BoardSlice> {\n const warnings: string[] = []\n const statuses = await from.statuses.listByWorkspace(workspaceId)\n const milestones = await from.milestones.listByWorkspace(workspaceId)\n const issues = orderParentsFirst(await from.issues.listByWorkspace(workspaceId))\n const issueIds = new Set(issues.map(issue => issue.id))\n\n const comments: IssueComment[] = []\n const runs: IssueRun[] = []\n const relations = new Map<string, IssueRelation>()\n const fieldChanges: IssueFieldChange[] = []\n const pullRequests: IssuePullRequest[] = []\n const skippedRelations = new Set<string>()\n for (const issue of issues) {\n // The store's own order — insertion order on either engine, for runs, for\n // comments and for field changes alike — is the order they are written back\n // in. That is what keeps an attempt number, and the last word on a card,\n // reading the same after the move as before it.\n comments.push(...await from.comments.listByIssue(issue.id))\n runs.push(...await from.runs.listByIssue(issue.id))\n for (const relation of await from.relations.listByIssue(issue.id)) {\n if (issueIds.has(relation.sourceIssueId) && issueIds.has(relation.targetIssueId)) {\n relations.set(relation.id, relation)\n continue\n }\n skippedRelations.add(relation.id)\n }\n fieldChanges.push(...await from.fieldChanges.listByIssue(issue.id))\n pullRequests.push(...await from.pullRequests.listByIssue(issue.id))\n }\n if (skippedRelations.size > 0) {\n warnings.push(`${skippedRelations.size} links to cards in other workspaces were not moved`)\n }\n\n return { statuses, milestones, issues, comments, runs, relations: [...relations.values()], fieldChanges, pullRequests, warnings }\n}\n\n/**\n * Write a slice into the target board, in one transaction, and say what was\n * written and what a person should know about it — the slice's own warnings\n * first.\n *\n * It is idempotent by id. A row the target already has is left exactly as it\n * is and counted as already present, so a copy interrupted half-way is finished\n * by running it again, and a second run of a finished one copies nothing. A\n * clash that is not the same row — a column name or a card number the target\n * holds under another id — refuses the whole copy before its first insert\n * (`board_copy_conflict`, ruling 3-55).\n */\nexport async function writeBoardSlice(\n to: BoardStore,\n slice: BoardSlice,\n workspaceId: string,\n): Promise<{ copied: BoardCopyCounts, warnings: string[] }> {\n const warnings = [...slice.warnings]\n const copied = emptyCopyCounts()\n let alreadyPresent = 0\n\n await to.transaction(async (tx) => {\n await assertTheCopyFits(tx, slice, workspaceId)\n\n for (const status of slice.statuses) {\n if (await tx.statuses.findById(status.id)) {\n alreadyPresent += 1\n continue\n }\n await tx.statuses.create(status)\n copied.statuses += 1\n }\n\n for (const milestone of slice.milestones) {\n if (await tx.milestones.findById(milestone.id)) {\n alreadyPresent += 1\n continue\n }\n await tx.milestones.create(milestone)\n copied.milestones += 1\n }\n\n const movingIssueIds = new Set(slice.issues.map(issue => issue.id))\n for (const issue of slice.issues) {\n if (await tx.issues.findById(issue.id)) {\n alreadyPresent += 1\n continue\n }\n // A card whose parent is neither moving with it nor already on the target\n // would point at a row that is not there. The board's own rule is that a\n // parent which goes away leaves its children parentless, so that is what\n // happens here too — said out loud, because a person is losing a link.\n const parentIsReachable = issue.parentIssueId === null\n || movingIssueIds.has(issue.parentIssueId)\n || (await tx.issues.findById(issue.parentIssueId)) !== null\n if (!parentIsReachable) {\n warnings.push(`${issue.id} lost its parent card, which is not on this board`)\n }\n const { contextRefs, ...row } = issue\n await tx.issues.create({ ...row, parentIssueId: parentIsReachable ? issue.parentIssueId : null })\n copied.issues += 1\n if (contextRefs !== '[]') {\n await tx.contextRefs.replace(issue.id, contextRefs, issue.updatedAt)\n copied.contextRefs += 1\n }\n }\n\n for (const comment of slice.comments) {\n if (await tx.comments.findById(comment.id)) {\n alreadyPresent += 1\n continue\n }\n await tx.comments.create(comment)\n copied.comments += 1\n }\n\n for (const run of slice.runs) {\n if (await tx.runs.findById(run.id)) {\n alreadyPresent += 1\n continue\n }\n await tx.runs.create(run)\n copied.runs += 1\n }\n\n for (const relation of slice.relations) {\n if (await tx.relations.findById(relation.id)) {\n alreadyPresent += 1\n continue\n }\n await tx.relations.create(relation)\n copied.relations += 1\n }\n\n // Field changes carry no lookup by id of their own — they are read a card\n // at a time — so what the target already has is read a card at a time too.\n const changesByIssue = new Map<string, IssueFieldChange[]>()\n for (const change of slice.fieldChanges) {\n changesByIssue.set(change.issueId, [...(changesByIssue.get(change.issueId) ?? []), change])\n }\n for (const [issueId, changes] of changesByIssue) {\n const present = new Set((await tx.fieldChanges.listByIssue(issueId)).map(change => change.id))\n for (const change of changes) {\n if (present.has(change.id)) {\n alreadyPresent += 1\n continue\n }\n await tx.fieldChanges.create(change)\n copied.fieldChanges += 1\n }\n }\n\n // Pull request links, like field changes, are read a card at a time. One\n // the target holds under another id names the same pull request — `link`\n // hands back that standing row — so it is already present too.\n const linksByIssue = new Map<string, IssuePullRequest[]>()\n for (const link of slice.pullRequests) {\n linksByIssue.set(link.issueId, [...(linksByIssue.get(link.issueId) ?? []), link])\n }\n for (const [issueId, links] of linksByIssue) {\n const present = new Set((await tx.pullRequests.listByIssue(issueId)).map(link => link.id))\n for (const link of links) {\n if (present.has(link.id) || (await tx.pullRequests.link(link)).id !== link.id) {\n alreadyPresent += 1\n continue\n }\n copied.pullRequests += 1\n }\n }\n\n // One bump for the whole copy: a reader watching the target refetches once,\n // not once per card.\n await tx.meta.bumpRevision('board', currentUnixSeconds())\n })\n\n if (alreadyPresent > 0) {\n warnings.push(`${alreadyPresent} rows were already present on the target board and were left as they are`)\n }\n return { copied, warnings }\n}\n\n/**\n * Empty the slice off the board it was read from, in a transaction of its own.\n *\n * Only the cards, the columns and the milestones are named: comments, runs,\n * links, pull request links and the field-change history hang off a card by a\n * foreign key that cascades on both engines, so deleting the card takes them\n * with it.\n */\nexport async function deleteBoardSlice(from: BoardStore, slice: BoardSlice): Promise<void> {\n await from.transaction(async (tx) => {\n for (const issue of slice.issues) {\n await tx.issues.delete(issue.id)\n }\n for (const milestone of slice.milestones) {\n await tx.milestones.delete(milestone.id)\n }\n for (const status of slice.statuses) {\n await tx.statuses.delete(status.id)\n }\n await tx.meta.bumpRevision('board', currentUnixSeconds())\n })\n}\n\n/**\n * What a copy would collide with on the target, said before a row is written.\n *\n * The board carries two uniqueness rules that a *second* board of the same\n * workspace can break: a column's name within its workspace, and a card's\n * number within it. In practice it is the columns that collide: a standard set\n * created a second time carries the same names under new ids, while a card's id\n * is its key (`BST-001`), so two generations of card *number* 1 are two rows\n * with one id — which the copy treats as already present rather than as a\n * clash. The number check covers the case where they are not: a workspace whose\n * identifier changed between the two generations numbers from 1 again under\n * different ids.\n *\n * A row the target already has *by id* is not a collision — it is the\n * idempotent half of the copy, which is why the holder's id is compared rather\n * than merely counted. Milestones need no check: neither engine makes their\n * titles unique.\n */\nasync function assertTheCopyFits(tx: BoardStore, slice: BoardSlice, workspaceId: string): Promise<void> {\n const conflicts: { kind: 'card' | 'column', value: string | number, heldBy: string }[] = []\n\n const numbers = new Map((await tx.issues.listByWorkspace(workspaceId)).map(issue => [issue.number, issue.id]))\n for (const issue of slice.issues) {\n const holder = numbers.get(issue.number)\n if (holder !== undefined && holder !== issue.id) {\n conflicts.push({ kind: 'card', value: issue.number, heldBy: holder })\n }\n }\n\n const names = new Map((await tx.statuses.listByWorkspace(workspaceId)).map(status => [status.name, status.id]))\n for (const status of slice.statuses) {\n const holder = names.get(status.name)\n if (holder !== undefined && holder !== status.id) {\n conflicts.push({ kind: 'column', value: status.name, heldBy: holder })\n }\n }\n\n if (conflicts.length > 0) {\n throw new BoardError('board_copy_conflict', { workspaceId, conflicts })\n }\n}\n\n/**\n * The same cards, ordered so that a parent is always written before its\n * children. The column is a foreign key onto the same table, so any other order\n * writes a card pointing at one that is not there yet.\n */\nfunction orderParentsFirst(issues: Issue[]): Issue[] {\n const byId = new Map(issues.map(issue => [issue.id, issue]))\n const ordered: Issue[] = []\n const placed = new Set<string>()\n\n function place(issue: Issue, ancestors: Set<string>): void {\n if (placed.has(issue.id) || ancestors.has(issue.id)) {\n return\n }\n ancestors.add(issue.id)\n const parent = issue.parentIssueId === null ? undefined : byId.get(issue.parentIssueId)\n if (parent) {\n place(parent, ancestors)\n }\n placed.add(issue.id)\n ordered.push(issue)\n }\n\n for (const issue of issues) {\n place(issue, new Set())\n }\n return ordered\n}\n"],"mappings":";;;;;;;;;;;;;AAWA,MAAM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