@ariestools/toolchain 10.1.2 → 10.1.3
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/dist/actions/work/github.d.ts +9 -0
- package/dist/actions/work/github.d.ts.map +1 -1
- package/dist/actions/work/lifecycle.d.ts +3 -0
- package/dist/actions/work/lifecycle.d.ts.map +1 -1
- package/dist/actions/work/lint.d.ts.map +1 -1
- package/dist/actions/work/priority.d.ts +5 -1
- package/dist/actions/work/priority.d.ts.map +1 -1
- package/dist/actions/work/sync.d.ts +5 -1
- package/dist/actions/work/sync.d.ts.map +1 -1
- package/dist/bin/xy.mjs +108 -40
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/bin/xyex.mjs +108 -40
- package/dist/bin/xyex.mjs.map +1 -1
- package/dist/xy/common/work/updateCommand.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/bin/xyex.mjs
CHANGED
|
@@ -7149,7 +7149,7 @@ var require_semver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7149
7149
|
//#region src/lib/toolchainVersion.ts
|
|
7150
7150
|
createRequire(import.meta.url);
|
|
7151
7151
|
function bundledToolchainVersion() {
|
|
7152
|
-
return "10.1.
|
|
7152
|
+
return "10.1.3";
|
|
7153
7153
|
}
|
|
7154
7154
|
function bundledToolchainRange() {
|
|
7155
7155
|
return `^${bundledToolchainVersion()}`;
|
|
@@ -57827,6 +57827,22 @@ const formatGithubWorkIssueBody = (item) => {
|
|
|
57827
57827
|
].join("\n"));
|
|
57828
57828
|
return sections.join("\n\n");
|
|
57829
57829
|
};
|
|
57830
|
+
const normalizeGithubIssueBody = (body) => body.replaceAll("\r\n", "\n").trim();
|
|
57831
|
+
/**
|
|
57832
|
+
Compare issue bodies, ignoring the CRLF line endings and surrounding whitespace GitHub can add.
|
|
57833
|
+
*/
|
|
57834
|
+
const githubIssueBodiesMatch = (a, b) => {
|
|
57835
|
+
return normalizeGithubIssueBody(a) === normalizeGithubIssueBody(b);
|
|
57836
|
+
};
|
|
57837
|
+
const XY_WORK_GENERATED_SECTION_PATTERN = /(?:^|\n)(?:## xy work metadata\b|(?:---[ \t]*\r?\n)?[ \t]*<!--\s*xy-work:)/i;
|
|
57838
|
+
/**
|
|
57839
|
+
Drop the sections `formatGithubWorkIssueBody` generates (metadata, marker, footer) so an imported
|
|
57840
|
+
xy-work issue body can be rendered again without repeating them.
|
|
57841
|
+
*/
|
|
57842
|
+
const stripXyWorkGeneratedBody = (body) => {
|
|
57843
|
+
const match = XY_WORK_GENERATED_SECTION_PATTERN.exec(body);
|
|
57844
|
+
return (match === null ? body : body.slice(0, match.index)).trim();
|
|
57845
|
+
};
|
|
57830
57846
|
const TYPE_LABEL_MAP = [
|
|
57831
57847
|
["bug", "bug"],
|
|
57832
57848
|
["type:bug", "bug"],
|
|
@@ -58017,6 +58033,20 @@ const isTerminalWorkStatus = (status) => {
|
|
|
58017
58033
|
return status === "done" || status === "wontfix";
|
|
58018
58034
|
};
|
|
58019
58035
|
/**
|
|
58036
|
+
Sync may edit a linked issue only when its body marker names this item and the stored URL matches.
|
|
58037
|
+
*/
|
|
58038
|
+
const githubIssueBelongsToItem = (item, issue) => {
|
|
58039
|
+
const storedUrl = readGithubStoreUrl(item.stores);
|
|
58040
|
+
return parseXyWorkIdFromGithubBody(issue.body) === item.id && (storedUrl === void 0 || storedUrl === issue.url);
|
|
58041
|
+
};
|
|
58042
|
+
/**
|
|
58043
|
+
The body of an issue xy work owns is rendered from the local item and cannot be imported back,
|
|
58044
|
+
so any difference counts as drift and sync pushes the local rendering.
|
|
58045
|
+
*/
|
|
58046
|
+
const githubBodyDrifted = (item, issue) => {
|
|
58047
|
+
return githubIssueBelongsToItem(item, issue) && !githubIssueBodiesMatch(formatGithubWorkIssueBody(item), issue.body);
|
|
58048
|
+
};
|
|
58049
|
+
/**
|
|
58020
58050
|
* Normalize open GitHub issues that were not created by `xy work` into WorkItem shape.
|
|
58021
58051
|
* Issues already linked from local items (or marked with the xy-work label/marker) are skipped.
|
|
58022
58052
|
*/
|
|
@@ -58054,6 +58084,7 @@ const importGithubIssueLocally = (cwd, issue, now, preferredId) => {
|
|
|
58054
58084
|
const item = {
|
|
58055
58085
|
...base,
|
|
58056
58086
|
completedAt: open ? void 0 : base.updatedAt || nowIso(now),
|
|
58087
|
+
description: createdByXyWork ? stripXyWorkGeneratedBody(base.description) : base.description,
|
|
58057
58088
|
id,
|
|
58058
58089
|
status: open ? "open" : "done",
|
|
58059
58090
|
stores: { github: {
|
|
@@ -58130,26 +58161,33 @@ const attachOrImportGithubIssues = (cwd, issuesByNumber, summary, now) => {
|
|
|
58130
58161
|
}
|
|
58131
58162
|
}
|
|
58132
58163
|
};
|
|
58133
|
-
|
|
58134
|
-
|
|
58164
|
+
/**
|
|
58165
|
+
Title: newer side wins. Body: the local rendering always wins on issues the item owns.
|
|
58166
|
+
*/
|
|
58167
|
+
const reconcileContentDrift = (cwd, github, item, issue, number, summary, canMutateGithub = true, now) => {
|
|
58168
|
+
const titleDrifted = item.title !== issue.title;
|
|
58169
|
+
const bodyDrifted = githubBodyDrifted(item, issue);
|
|
58170
|
+
if (!titleDrifted && !bodyDrifted) return {
|
|
58171
|
+
localChanged: false,
|
|
58172
|
+
next: item
|
|
58173
|
+
};
|
|
58174
|
+
const localIsNewer = item.updatedAt.localeCompare(issue.updatedAt) >= 0;
|
|
58175
|
+
const pushTitle = titleDrifted && localIsNewer && canMutateGithub;
|
|
58176
|
+
if (pushTitle || bodyDrifted) {
|
|
58177
|
+
const body = formatGithubWorkIssueBody(item);
|
|
58178
|
+
github.updateIssue(cwd, number, pushTitle ? {
|
|
58179
|
+
body,
|
|
58180
|
+
title: item.title
|
|
58181
|
+
} : { body });
|
|
58182
|
+
summary.updatedGithub.push(`${item.id}→#${String(number)}`);
|
|
58183
|
+
issue.body = body;
|
|
58184
|
+
if (pushTitle) issue.title = item.title;
|
|
58185
|
+
issue.updatedAt = nowIso(now);
|
|
58186
|
+
}
|
|
58187
|
+
if (!titleDrifted || localIsNewer) return {
|
|
58135
58188
|
localChanged: false,
|
|
58136
58189
|
next: item
|
|
58137
58190
|
};
|
|
58138
|
-
if (item.updatedAt.localeCompare(issue.updatedAt) >= 0) {
|
|
58139
|
-
if (canMutateGithub) {
|
|
58140
|
-
github.updateIssue(cwd, number, {
|
|
58141
|
-
body: formatGithubWorkIssueBody(item),
|
|
58142
|
-
title: item.title
|
|
58143
|
-
});
|
|
58144
|
-
summary.updatedGithub.push(`${item.id}→#${String(number)}`);
|
|
58145
|
-
issue.title = item.title;
|
|
58146
|
-
issue.updatedAt = nowIso(now);
|
|
58147
|
-
}
|
|
58148
|
-
return {
|
|
58149
|
-
localChanged: false,
|
|
58150
|
-
next: item
|
|
58151
|
-
};
|
|
58152
|
-
}
|
|
58153
58191
|
return {
|
|
58154
58192
|
localChanged: true,
|
|
58155
58193
|
next: {
|
|
@@ -58177,15 +58215,16 @@ const reconcileLinkedItem = (cwd, github, item, issue, number, summary, now) =>
|
|
|
58177
58215
|
let localChanged = false;
|
|
58178
58216
|
const issueOpen = githubIssueIsOpen(issue);
|
|
58179
58217
|
const localTerminal = isTerminalWorkStatus(item.status);
|
|
58180
|
-
const
|
|
58181
|
-
const storedUrl = readGithubStoreUrl(item.stores);
|
|
58182
|
-
const canMutateGithub = markerId === item.id && (storedUrl === void 0 || storedUrl === issue.url);
|
|
58218
|
+
const canMutateGithub = githubIssueBelongsToItem(item, issue);
|
|
58183
58219
|
if (localTerminal && issueOpen) {
|
|
58184
58220
|
if (canMutateGithub) {
|
|
58185
58221
|
github.updateIssue(cwd, number, { state: "closed" });
|
|
58186
58222
|
summary.closedGithub.push(`${item.id}→#${String(number)}`);
|
|
58187
58223
|
issue.state = "CLOSED";
|
|
58188
|
-
} else
|
|
58224
|
+
} else {
|
|
58225
|
+
const markerId = parseXyWorkIdFromGithubBody(issue.body);
|
|
58226
|
+
xyLog(`Sync reconcile skipped closing GitHub #${String(number)}: body marker (${markerId ?? "none"}) does not match ${item.id} or URL mismatch`);
|
|
58227
|
+
}
|
|
58189
58228
|
} else if (!localTerminal && !issueOpen) {
|
|
58190
58229
|
next = {
|
|
58191
58230
|
...next,
|
|
@@ -58196,9 +58235,9 @@ const reconcileLinkedItem = (cwd, github, item, issue, number, summary, now) =>
|
|
|
58196
58235
|
};
|
|
58197
58236
|
localChanged = true;
|
|
58198
58237
|
} else if (!localTerminal && issueOpen) {
|
|
58199
|
-
const
|
|
58200
|
-
next =
|
|
58201
|
-
localChanged ||=
|
|
58238
|
+
const contentResult = reconcileContentDrift(cwd, github, next, issue, number, summary, canMutateGithub, now);
|
|
58239
|
+
next = contentResult.next;
|
|
58240
|
+
localChanged ||= contentResult.localChanged;
|
|
58202
58241
|
}
|
|
58203
58242
|
const urlResult = ensureGithubStoreUrl(next, issue, number);
|
|
58204
58243
|
next = urlResult.next;
|
|
@@ -58236,13 +58275,14 @@ const logSyncSummary = (summary) => {
|
|
|
58236
58275
|
].join("\n"));
|
|
58237
58276
|
};
|
|
58238
58277
|
const emptyWorkSyncDrift = () => ({
|
|
58278
|
+
bodyMismatch: [],
|
|
58239
58279
|
githubMissingLocal: [],
|
|
58240
58280
|
localMissingGithub: [],
|
|
58241
58281
|
statusMismatch: [],
|
|
58242
58282
|
titleMismatch: []
|
|
58243
58283
|
});
|
|
58244
58284
|
const workSyncDriftIsClean = (drift) => {
|
|
58245
|
-
return drift.githubMissingLocal.length === 0 && drift.localMissingGithub.length === 0 && drift.statusMismatch.length === 0 && drift.titleMismatch.length === 0;
|
|
58285
|
+
return drift.bodyMismatch.length === 0 && drift.githubMissingLocal.length === 0 && drift.localMissingGithub.length === 0 && drift.statusMismatch.length === 0 && drift.titleMismatch.length === 0;
|
|
58246
58286
|
};
|
|
58247
58287
|
const recordLocalMissingGithub = (localItems, drift) => {
|
|
58248
58288
|
for (const item of localItems) {
|
|
@@ -58258,7 +58298,11 @@ const recordLinkedPairDrift = (issue, linked, drift) => {
|
|
|
58258
58298
|
drift.statusMismatch.push(`${linked.id} done/wontfix but GitHub #${String(issue.number)} open`);
|
|
58259
58299
|
return;
|
|
58260
58300
|
}
|
|
58261
|
-
if (!localTerminal && !issueOpen)
|
|
58301
|
+
if (!localTerminal && !issueOpen) {
|
|
58302
|
+
drift.statusMismatch.push(`${linked.id} open locally but GitHub #${String(issue.number)} closed`);
|
|
58303
|
+
return;
|
|
58304
|
+
}
|
|
58305
|
+
if (!localTerminal && githubBodyDrifted(linked, issue)) drift.bodyMismatch.push(`${linked.id}/#${String(issue.number)}`);
|
|
58262
58306
|
};
|
|
58263
58307
|
const recordUnlinkedXyWorkDrift = (issue, localById, drift) => {
|
|
58264
58308
|
if (!isXyWorkGithubIssue(issue)) return;
|
|
@@ -58303,7 +58347,7 @@ const computeWorkSyncDrift = (cwd, options = {}) => {
|
|
|
58303
58347
|
*
|
|
58304
58348
|
* - Local active items without a GitHub link → create a marked GitHub issue
|
|
58305
58349
|
* - Open/closed GitHub issues not present locally → import as local items
|
|
58306
|
-
* - Linked pairs: reconcile title (newer wins) and status (done/wontfix ↔ closed)
|
|
58350
|
+
* - Linked pairs: reconcile title (newer wins), body of xy-work issues (local wins), and status (done/wontfix ↔ closed)
|
|
58307
58351
|
*/
|
|
58308
58352
|
const workSync = (options = {}) => {
|
|
58309
58353
|
const cwd = options.cwd ?? process.cwd();
|
|
@@ -58350,14 +58394,18 @@ const compareWorkItemsByPriority = (a, b, formula = DEFAULT_PRIORITY_FORMULA) =>
|
|
|
58350
58394
|
if (aScore !== void 0 && bScore === void 0) return -1;
|
|
58351
58395
|
return aScore === void 0 && bScore !== void 0 ? 1 : a.createdAt.localeCompare(b.createdAt) || a.id.localeCompare(b.id);
|
|
58352
58396
|
};
|
|
58353
|
-
|
|
58397
|
+
/**
|
|
58398
|
+
Build a priority from the fields given. Fields left out keep their value from `base` (the stored
|
|
58399
|
+
priority on update), or default to 3 when there is no base.
|
|
58400
|
+
*/
|
|
58401
|
+
const priorityFromPartial = (partial, base) => {
|
|
58354
58402
|
if (Object.values(partial).every((value) => value === void 0)) return void 0;
|
|
58355
58403
|
return {
|
|
58356
|
-
confidence: partial.confidence ?? 3,
|
|
58357
|
-
effort: partial.effort ?? 3,
|
|
58358
|
-
impact: partial.impact ?? 3,
|
|
58359
|
-
risk: partial.risk ?? 3,
|
|
58360
|
-
urgency: partial.urgency ?? 3
|
|
58404
|
+
confidence: partial.confidence ?? base?.confidence ?? 3,
|
|
58405
|
+
effort: partial.effort ?? base?.effort ?? 3,
|
|
58406
|
+
impact: partial.impact ?? base?.impact ?? 3,
|
|
58407
|
+
risk: partial.risk ?? base?.risk ?? 3,
|
|
58408
|
+
urgency: partial.urgency ?? base?.urgency ?? 3
|
|
58361
58409
|
};
|
|
58362
58410
|
};
|
|
58363
58411
|
//#endregion
|
|
@@ -58574,6 +58622,7 @@ const buildRepoContext = (repo, github) => {
|
|
|
58574
58622
|
for (const id of drift.localMissingGithub) driftMessages.push(`${id} — active local item missing GitHub link`);
|
|
58575
58623
|
for (const entry of drift.githubMissingLocal) driftMessages.push(`${entry} — GitHub issue missing local item`);
|
|
58576
58624
|
for (const entry of drift.titleMismatch) driftMessages.push(`${entry} — title mismatch`);
|
|
58625
|
+
for (const entry of drift.bodyMismatch) driftMessages.push(`${entry} — body mismatch`);
|
|
58577
58626
|
for (const entry of drift.statusMismatch) driftMessages.push(entry);
|
|
58578
58627
|
}
|
|
58579
58628
|
} catch (error) {
|
|
@@ -59580,6 +59629,10 @@ const workDone = (options) => {
|
|
|
59580
59629
|
repo: scoped.repo
|
|
59581
59630
|
});
|
|
59582
59631
|
};
|
|
59632
|
+
const updatedBlockedReason = (next, current) => {
|
|
59633
|
+
if (next === void 0) return current;
|
|
59634
|
+
return next.trim().length === 0 ? void 0 : next;
|
|
59635
|
+
};
|
|
59583
59636
|
const workUpdate = (options) => {
|
|
59584
59637
|
const scoped = resolveScopedWorkItem(options.id, scopeFrom(options));
|
|
59585
59638
|
const item = stripScope(scoped);
|
|
@@ -59589,13 +59642,13 @@ const workUpdate = (options) => {
|
|
|
59589
59642
|
impact: options.impact,
|
|
59590
59643
|
risk: options.risk,
|
|
59591
59644
|
urgency: options.urgency
|
|
59592
|
-
});
|
|
59645
|
+
}, item.priority);
|
|
59593
59646
|
const updatedAt = nowIso(options.now);
|
|
59594
59647
|
const updated = {
|
|
59595
59648
|
...item,
|
|
59596
59649
|
acceptanceCriteria: options.acceptanceCriteria === void 0 ? item.acceptanceCriteria : normalizeTextList(options.acceptanceCriteria),
|
|
59597
59650
|
area: options.area ?? item.area,
|
|
59598
|
-
blockedReason: options.blockedReason
|
|
59651
|
+
blockedReason: updatedBlockedReason(options.blockedReason, item.blockedReason),
|
|
59599
59652
|
description: options.description ?? item.description,
|
|
59600
59653
|
priority: priority === void 0 ? item.priority : validateWorkPriority(priority),
|
|
59601
59654
|
status: options.status ?? item.status,
|
|
@@ -61787,7 +61840,7 @@ const updateCommand = {
|
|
|
61787
61840
|
describe: "Replace status",
|
|
61788
61841
|
type: "string"
|
|
61789
61842
|
}).option("blocked-reason", {
|
|
61790
|
-
describe: "Blocked status explanation",
|
|
61843
|
+
describe: "Blocked status explanation; pass an empty value (--blocked-reason \"\") to remove it",
|
|
61791
61844
|
type: "string"
|
|
61792
61845
|
}).option("tag", {
|
|
61793
61846
|
array: true,
|
|
@@ -61801,17 +61854,32 @@ const updateCommand = {
|
|
|
61801
61854
|
array: true,
|
|
61802
61855
|
describe: "Replace verification entries; repeatable",
|
|
61803
61856
|
type: "string"
|
|
61804
|
-
}).option("impact", {
|
|
61857
|
+
}).option("impact", {
|
|
61858
|
+
describe: "Set priority impact (1-5)",
|
|
61859
|
+
type: "number"
|
|
61860
|
+
}).option("urgency", {
|
|
61861
|
+
describe: "Set priority urgency (1-5)",
|
|
61862
|
+
type: "number"
|
|
61863
|
+
}).option("effort", {
|
|
61864
|
+
describe: "Set priority effort (1-5)",
|
|
61865
|
+
type: "number"
|
|
61866
|
+
}).option("risk", {
|
|
61867
|
+
describe: "Set priority risk (1-5)",
|
|
61868
|
+
type: "number"
|
|
61869
|
+
}).option("confidence", {
|
|
61870
|
+
describe: "Set priority confidence (1-5)",
|
|
61871
|
+
type: "number"
|
|
61872
|
+
}).epilogue(["Only the fields you pass change. Priority fields you leave out keep their stored values (or default to 3 when the item has no priority yet).", "Updates are written to the local store only. Run `xy work sync` afterwards to push the title and issue body to a linked GitHub issue; `xy work lint` reports linked issues whose body has drifted (work.github-synced)."].join("\n\n")));
|
|
61805
61873
|
},
|
|
61806
61874
|
command: "update <id>",
|
|
61807
|
-
describe: "Update
|
|
61875
|
+
describe: "Update fields on a work item (local only; run `xy work sync` to push to GitHub)",
|
|
61808
61876
|
handler: async (argv) => {
|
|
61809
61877
|
const scope = scopeFromArgv(argv);
|
|
61810
61878
|
await withEnvelope("work update", () => workUpdate({
|
|
61811
61879
|
...scope,
|
|
61812
61880
|
acceptanceCriteria: optionalStringArray(argv.acceptance),
|
|
61813
61881
|
area: optionalString(argv.area),
|
|
61814
|
-
blockedReason:
|
|
61882
|
+
blockedReason: typeof argv["blocked-reason"] === "string" ? argv["blocked-reason"] : void 0,
|
|
61815
61883
|
confidence: optionalNumber(argv.confidence),
|
|
61816
61884
|
description: optionalString(argv.description),
|
|
61817
61885
|
effort: optionalNumber(argv.effort),
|