@webpieces/pr-gate 0.4.1005 → 0.4.1007
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/package.json +6 -6
- package/src/scripts/commands/finish-upsert-pr-command.js +3 -1
- package/src/scripts/commands/finish-upsert-pr-command.js.map +1 -1
- package/src/scripts/commands/land-pr-command.d.ts +12 -1
- package/src/scripts/commands/land-pr-command.js +37 -6
- package/src/scripts/commands/land-pr-command.js.map +1 -1
- package/src/scripts/workflow/finish-banner.d.ts +10 -1
- package/src/scripts/workflow/finish-banner.js +21 -3
- package/src/scripts/workflow/finish-banner.js.map +1 -1
- package/src/scripts/workflow/landed-ticket-resolver.d.ts +34 -0
- package/src/scripts/workflow/landed-ticket-resolver.js +100 -0
- package/src/scripts/workflow/landed-ticket-resolver.js.map +1 -0
- package/src/scripts/workflow/ticket-reminder.d.ts +48 -0
- package/src/scripts/workflow/ticket-reminder.js +101 -0
- package/src/scripts/workflow/ticket-reminder.js.map +1 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** The tickets came from summary.json's `addressesIssues` (still on disk at land time). */
|
|
2
|
+
export declare const TICKET_SOURCE_SUMMARY = "summary.json addressesIssues";
|
|
3
|
+
/** The tickets came from the PR body's rendered `Fixes <url>` / `Part of <url>` lines. */
|
|
4
|
+
export declare const TICKET_SOURCE_PR_BODY = "the PR body's \"Fixes <url>\" / \"Part of <url>\" lines";
|
|
5
|
+
/** No ticket URL could be recovered from either place. */
|
|
6
|
+
export declare const TICKET_SOURCE_NONE = "none";
|
|
7
|
+
/**
|
|
8
|
+
* Data-only: one ticket a PR addresses, and whether that PR finishes it. `closesIssue` is true for a
|
|
9
|
+
* `Fixes <url>` (this PR completes the ticket) and false for a `Part of <url>` (more PRs are owed).
|
|
10
|
+
*/
|
|
11
|
+
export declare class TicketLink {
|
|
12
|
+
url: string;
|
|
13
|
+
closesIssue: boolean;
|
|
14
|
+
constructor(url: string, closesIssue: boolean);
|
|
15
|
+
}
|
|
16
|
+
/** Data-only: the tickets a LANDED PR addresses, and where they were read from (a TICKET_SOURCE_*). */
|
|
17
|
+
export declare class LandedTickets {
|
|
18
|
+
links: TicketLink[];
|
|
19
|
+
source: string;
|
|
20
|
+
constructor(links: TicketLink[], source: string);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* THE one wording of the "link this PR FROM its ticket" next action — printed by `wp-finish-upsert-pr`
|
|
24
|
+
* after it posts or updates a PR (issue #1453) and again by `wp-land-pr` after it lands one (issue #1456).
|
|
25
|
+
*
|
|
26
|
+
* The PR body's `Fixes <url>` / `Part of <url>` line links the PR TO its ticket; nothing links the ticket
|
|
27
|
+
* back to the PR, and on a tracker outside GitHub (Linear, Jira) nothing ever will unless the caller does
|
|
28
|
+
* it. One ticket often spans several PRs, so the reminder says to ADD the link, keeping the earlier ones —
|
|
29
|
+
* and it says plainly that webpieces updated no ticket, because it contacts no tracker.
|
|
30
|
+
*
|
|
31
|
+
* Landing repeats it because the stage-③ reminder is printed many turns before the PR reaches main, and
|
|
32
|
+
* by then it has usually been forgotten. Landing is also the moment a Linear or Jira ticket should move
|
|
33
|
+
* to Done, which a reminder printed while the PR is still open cannot say.
|
|
34
|
+
*
|
|
35
|
+
* Both entry points print nothing for a PR URL of '' — better no reminder than a link that is not real.
|
|
36
|
+
*/
|
|
37
|
+
export declare class TicketReminder {
|
|
38
|
+
/**
|
|
39
|
+
* The stage-③ form. `done` is FinishBanner.isDone of the merge outcome: when false the PR exists but
|
|
40
|
+
* is not merged, so the reminder says so instead of implying a finished run.
|
|
41
|
+
*/
|
|
42
|
+
forPostedPr(prUrl: string, done: boolean, ticketUrls: string[]): string;
|
|
43
|
+
/** The `wp-land-pr` form: the PR is merged, so the wording is LANDED and covers moving to Done. */
|
|
44
|
+
forLandedPr(prUrl: string, tickets: LandedTickets): string;
|
|
45
|
+
private heading;
|
|
46
|
+
private obligations;
|
|
47
|
+
private landedList;
|
|
48
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TicketReminder = exports.LandedTickets = exports.TicketLink = exports.TICKET_SOURCE_NONE = exports.TICKET_SOURCE_PR_BODY = exports.TICKET_SOURCE_SUMMARY = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const inversify_1 = require("inversify");
|
|
6
|
+
const SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n';
|
|
7
|
+
/** The tickets came from summary.json's `addressesIssues` (still on disk at land time). */
|
|
8
|
+
exports.TICKET_SOURCE_SUMMARY = 'summary.json addressesIssues';
|
|
9
|
+
/** The tickets came from the PR body's rendered `Fixes <url>` / `Part of <url>` lines. */
|
|
10
|
+
exports.TICKET_SOURCE_PR_BODY = 'the PR body\'s "Fixes <url>" / "Part of <url>" lines';
|
|
11
|
+
/** No ticket URL could be recovered from either place. */
|
|
12
|
+
exports.TICKET_SOURCE_NONE = 'none';
|
|
13
|
+
/**
|
|
14
|
+
* Data-only: one ticket a PR addresses, and whether that PR finishes it. `closesIssue` is true for a
|
|
15
|
+
* `Fixes <url>` (this PR completes the ticket) and false for a `Part of <url>` (more PRs are owed).
|
|
16
|
+
*/
|
|
17
|
+
class TicketLink {
|
|
18
|
+
url;
|
|
19
|
+
closesIssue;
|
|
20
|
+
constructor(url, closesIssue) {
|
|
21
|
+
this.url = url;
|
|
22
|
+
this.closesIssue = closesIssue;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.TicketLink = TicketLink;
|
|
26
|
+
/** Data-only: the tickets a LANDED PR addresses, and where they were read from (a TICKET_SOURCE_*). */
|
|
27
|
+
class LandedTickets {
|
|
28
|
+
links;
|
|
29
|
+
source;
|
|
30
|
+
constructor(links, source) {
|
|
31
|
+
this.links = links;
|
|
32
|
+
this.source = source;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.LandedTickets = LandedTickets;
|
|
36
|
+
/**
|
|
37
|
+
* THE one wording of the "link this PR FROM its ticket" next action — printed by `wp-finish-upsert-pr`
|
|
38
|
+
* after it posts or updates a PR (issue #1453) and again by `wp-land-pr` after it lands one (issue #1456).
|
|
39
|
+
*
|
|
40
|
+
* The PR body's `Fixes <url>` / `Part of <url>` line links the PR TO its ticket; nothing links the ticket
|
|
41
|
+
* back to the PR, and on a tracker outside GitHub (Linear, Jira) nothing ever will unless the caller does
|
|
42
|
+
* it. One ticket often spans several PRs, so the reminder says to ADD the link, keeping the earlier ones —
|
|
43
|
+
* and it says plainly that webpieces updated no ticket, because it contacts no tracker.
|
|
44
|
+
*
|
|
45
|
+
* Landing repeats it because the stage-③ reminder is printed many turns before the PR reaches main, and
|
|
46
|
+
* by then it has usually been forgotten. Landing is also the moment a Linear or Jira ticket should move
|
|
47
|
+
* to Done, which a reminder printed while the PR is still open cannot say.
|
|
48
|
+
*
|
|
49
|
+
* Both entry points print nothing for a PR URL of '' — better no reminder than a link that is not real.
|
|
50
|
+
*/
|
|
51
|
+
let TicketReminder = class TicketReminder {
|
|
52
|
+
/**
|
|
53
|
+
* The stage-③ form. `done` is FinishBanner.isDone of the merge outcome: when false the PR exists but
|
|
54
|
+
* is not merged, so the reminder says so instead of implying a finished run.
|
|
55
|
+
*/
|
|
56
|
+
forPostedPr(prUrl, done, ticketUrls) {
|
|
57
|
+
if (prUrl === '')
|
|
58
|
+
return '';
|
|
59
|
+
const state = done
|
|
60
|
+
? ''
|
|
61
|
+
: ' (The PR is open but NOT merged — see step 4. The link is still correct to add now.)\n';
|
|
62
|
+
const list = ticketUrls.length === 0
|
|
63
|
+
? ' summary.json names no addressesIssues ticket — use the ticket in your tracker this work belongs to.\n'
|
|
64
|
+
: ` Ticket(s) this PR addresses (${exports.TICKET_SOURCE_SUMMARY}):\n` +
|
|
65
|
+
ticketUrls.map((url) => ` ${url}\n`).join('');
|
|
66
|
+
return this.heading(`to this PR: ${prUrl}\n`) + state + this.obligations() + list;
|
|
67
|
+
}
|
|
68
|
+
/** The `wp-land-pr` form: the PR is merged, so the wording is LANDED and covers moving to Done. */
|
|
69
|
+
forLandedPr(prUrl, tickets) {
|
|
70
|
+
if (prUrl === '')
|
|
71
|
+
return '';
|
|
72
|
+
const done = ' It is merged into main. When this PR completes a ticket\'s work, this is also the moment to\n' +
|
|
73
|
+
' move a Linear or Jira ticket to Done (a GitHub issue named by a "Fixes" line closes itself).\n';
|
|
74
|
+
return this.heading(`to this LANDED (merged) PR: ${prUrl}\n`) + done + this.obligations() +
|
|
75
|
+
this.landedList(tickets);
|
|
76
|
+
}
|
|
77
|
+
heading(target) {
|
|
78
|
+
return '\n' + SEP +
|
|
79
|
+
'📌 NEXT ACTION — UPDATE YOUR TICKET (Linear, Jira, GitHub issue, or another tracker) with a link\n' +
|
|
80
|
+
` ${target}`;
|
|
81
|
+
}
|
|
82
|
+
obligations() {
|
|
83
|
+
return ' Keep the links to earlier PRs so the ticket lists every PR associated with the work.\n' +
|
|
84
|
+
' webpieces did NOT update any ticket — it contacts no tracker. Adding the link is yours to do.\n';
|
|
85
|
+
}
|
|
86
|
+
landedList(tickets) {
|
|
87
|
+
if (tickets.links.length === 0) {
|
|
88
|
+
return ` No ticket URL found in ${exports.TICKET_SOURCE_SUMMARY} or in the PR body — use the ticket in your\n` +
|
|
89
|
+
' tracker this work belongs to.\n';
|
|
90
|
+
}
|
|
91
|
+
return ` Ticket(s) this PR addresses (${tickets.source}):\n` +
|
|
92
|
+
tickets.links.map((link) => link.closesIssue
|
|
93
|
+
? ` ${link.url} (Fixes — this PR completes it)\n`
|
|
94
|
+
: ` ${link.url} (Part of — more PRs are owed; leave it open)\n`).join('');
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
exports.TicketReminder = TicketReminder;
|
|
98
|
+
exports.TicketReminder = TicketReminder = tslib_1.__decorate([
|
|
99
|
+
(0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton)
|
|
100
|
+
], TicketReminder);
|
|
101
|
+
//# sourceMappingURL=ticket-reminder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ticket-reminder.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/ticket-reminder.ts"],"names":[],"mappings":";;;;AAAA,yCAA2D;AAE3D,MAAM,GAAG,GAAG,0DAA0D,CAAC;AAEvE,2FAA2F;AAC9E,QAAA,qBAAqB,GAAG,8BAA8B,CAAC;AACpE,0FAA0F;AAC7E,QAAA,qBAAqB,GAAG,sDAAsD,CAAC;AAC5F,0DAA0D;AAC7C,QAAA,kBAAkB,GAAG,MAAM,CAAC;AAEzC;;;GAGG;AACH,MAAa,UAAU;IACnB,GAAG,CAAS;IACZ,WAAW,CAAU;IAErB,YAAY,GAAW,EAAE,WAAoB;QACzC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;CACJ;AARD,gCAQC;AAED,uGAAuG;AACvG,MAAa,aAAa;IACtB,KAAK,CAAe;IACpB,MAAM,CAAS;IAEf,YAAY,KAAmB,EAAE,MAAc;QAC3C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;CACJ;AARD,sCAQC;AAED;;;;;;;;;;;;;;GAcG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAc;IACvB;;;OAGG;IACH,WAAW,CAAC,KAAa,EAAE,IAAa,EAAE,UAAoB;QAC1D,IAAI,KAAK,KAAK,EAAE;YAAE,OAAO,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAG,IAAI;YACd,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,0FAA0F,CAAC;QACjG,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,KAAK,CAAC;YAChC,CAAC,CAAC,0GAA0G;YAC5G,CAAC,CAAC,mCAA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AC;CACJ,CAAA;AAhDY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;GAC5B,cAAc,CAgD1B","sourcesContent":["import { injectable, bindingScopeValues } from 'inversify';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\n\n/** The tickets came from summary.json's `addressesIssues` (still on disk at land time). */\nexport const TICKET_SOURCE_SUMMARY = 'summary.json addressesIssues';\n/** The tickets came from the PR body's rendered `Fixes <url>` / `Part of <url>` lines. */\nexport const TICKET_SOURCE_PR_BODY = 'the PR body\\'s \"Fixes <url>\" / \"Part of <url>\" lines';\n/** No ticket URL could be recovered from either place. */\nexport const TICKET_SOURCE_NONE = 'none';\n\n/**\n * Data-only: one ticket a PR addresses, and whether that PR finishes it. `closesIssue` is true for a\n * `Fixes <url>` (this PR completes the ticket) and false for a `Part of <url>` (more PRs are owed).\n */\nexport class TicketLink {\n url: string;\n closesIssue: boolean;\n\n constructor(url: string, closesIssue: boolean) {\n this.url = url;\n this.closesIssue = closesIssue;\n }\n}\n\n/** Data-only: the tickets a LANDED PR addresses, and where they were read from (a TICKET_SOURCE_*). */\nexport class LandedTickets {\n links: TicketLink[];\n source: string;\n\n constructor(links: TicketLink[], source: string) {\n this.links = links;\n this.source = source;\n }\n}\n\n/**\n * THE one wording of the \"link this PR FROM its ticket\" next action — printed by `wp-finish-upsert-pr`\n * after it posts or updates a PR (issue #1453) and again by `wp-land-pr` after it lands one (issue #1456).\n *\n * The PR body's `Fixes <url>` / `Part of <url>` line links the PR TO its ticket; nothing links the ticket\n * back to the PR, and on a tracker outside GitHub (Linear, Jira) nothing ever will unless the caller does\n * it. One ticket often spans several PRs, so the reminder says to ADD the link, keeping the earlier ones —\n * and it says plainly that webpieces updated no ticket, because it contacts no tracker.\n *\n * Landing repeats it because the stage-③ reminder is printed many turns before the PR reaches main, and\n * by then it has usually been forgotten. Landing is also the moment a Linear or Jira ticket should move\n * to Done, which a reminder printed while the PR is still open cannot say.\n *\n * Both entry points print nothing for a PR URL of '' — better no reminder than a link that is not real.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class TicketReminder {\n /**\n * The stage-③ form. `done` is FinishBanner.isDone of the merge outcome: when false the PR exists but\n * is not merged, so the reminder says so instead of implying a finished run.\n */\n forPostedPr(prUrl: string, done: boolean, ticketUrls: string[]): string {\n if (prUrl === '') return '';\n const state = done\n ? ''\n : ' (The PR is open but NOT merged — see step 4. The link is still correct to add now.)\\n';\n const list = ticketUrls.length === 0\n ? ' summary.json names no addressesIssues ticket — use the ticket in your tracker this work belongs to.\\n'\n : ` Ticket(s) this PR addresses (${TICKET_SOURCE_SUMMARY}):\\n` +\n ticketUrls.map((url: string): string => ` ${url}\\n`).join('');\n return this.heading(`to this PR: ${prUrl}\\n`) + state + this.obligations() + list;\n }\n\n /** The `wp-land-pr` form: the PR is merged, so the wording is LANDED and covers moving to Done. */\n forLandedPr(prUrl: string, tickets: LandedTickets): string {\n if (prUrl === '') return '';\n const done =\n ' It is merged into main. When this PR completes a ticket\\'s work, this is also the moment to\\n' +\n ' move a Linear or Jira ticket to Done (a GitHub issue named by a \"Fixes\" line closes itself).\\n';\n return this.heading(`to this LANDED (merged) PR: ${prUrl}\\n`) + done + this.obligations() +\n this.landedList(tickets);\n }\n\n private heading(target: string): string {\n return '\\n' + SEP +\n '📌 NEXT ACTION — UPDATE YOUR TICKET (Linear, Jira, GitHub issue, or another tracker) with a link\\n' +\n ` ${target}`;\n }\n\n private obligations(): string {\n return ' Keep the links to earlier PRs so the ticket lists every PR associated with the work.\\n' +\n ' webpieces did NOT update any ticket — it contacts no tracker. Adding the link is yours to do.\\n';\n }\n\n private landedList(tickets: LandedTickets): string {\n if (tickets.links.length === 0) {\n return ` No ticket URL found in ${TICKET_SOURCE_SUMMARY} or in the PR body — use the ticket in your\\n` +\n ' tracker this work belongs to.\\n';\n }\n return ` Ticket(s) this PR addresses (${tickets.source}):\\n` +\n tickets.links.map((link: TicketLink): string => link.closesIssue\n ? ` ${link.url} (Fixes — this PR completes it)\\n`\n : ` ${link.url} (Part of — more PRs are owed; leave it open)\\n`).join('');\n }\n}\n"]}
|