@rockhopper-co/mcp-server 2.1.63-staging.0e18987 → 2.1.65
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/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +8 -1
- package/dist/prompts/index.js.map +1 -1
- package/dist/tools/get-reviews.d.ts.map +1 -1
- package/dist/tools/get-reviews.js +8 -3
- package/dist/tools/get-reviews.js.map +1 -1
- package/dist/user-display-name.d.ts +54 -0
- package/dist/user-display-name.d.ts.map +1 -0
- package/dist/user-display-name.js +56 -0
- package/dist/user-display-name.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAMlD,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,GAAG,IAAI,CA2OvE"}
|
package/dist/prompts/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { assertChangeHistoryComplete } from '../not-ready.js';
|
|
3
3
|
import { renderMentions } from '../mentions.js';
|
|
4
4
|
import { formatVersion } from '../version-format.js';
|
|
5
|
+
import { displayUserName } from '../user-display-name.js';
|
|
5
6
|
export function registerPrompts(server, api) {
|
|
6
7
|
server.registerPrompt('summarize-file-changes', {
|
|
7
8
|
title: 'Summarize Recent Changes',
|
|
@@ -64,8 +65,14 @@ export function registerPrompts(server, api) {
|
|
|
64
65
|
const reviewSummary = reviews.length
|
|
65
66
|
? reviews
|
|
66
67
|
.map((r) => `- "${r.subject}" (status: ${r.status}, id: ${r.id})` +
|
|
68
|
+
// ENG-4384 — the twin of the `get_reviews` expression, and
|
|
69
|
+
// the reason the helper is shared rather than copied. The
|
|
70
|
+
// segment is still OMITTED for a genuinely absent requester;
|
|
71
|
+
// a requester who exists but carries no name says `Unknown`,
|
|
72
|
+
// because dropping the segment there would state that nobody
|
|
73
|
+
// asked for the review — a different falsehood.
|
|
67
74
|
(r.requester
|
|
68
|
-
? ` — requested by ${r.requester
|
|
75
|
+
? ` — requested by ${displayUserName(r.requester) ?? 'Unknown'}`
|
|
69
76
|
: '') +
|
|
70
77
|
(r.description ? `\n Description: ${r.description}` : ''))
|
|
71
78
|
.join('\n')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,UAAU,eAAe,CAAC,MAAiB,EAAE,GAAc;IAC/D,MAAM,CAAC,cAAc,CACnB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IAAI,CAAC,UAAU,IAAI;4BACrC,0BAA0B,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,MAAM;4BACzE,gBAAgB,QAAQ,CAAC,MAAM,UAAU;4BACzC,CAAC,aAAa;gCACZ,CAAC,CAAC,WAAW,aAAa,CAAC,aAAa,CAAC,KAAK,aAAa,CAAC,SAAS,KAAK;gCAC1E,CAAC,CAAC,oBAAoB,CAAC;4BACzB,kBAAkB,QAAQ,CAAC,MAAM,WAAW,kBAAkB,CAAC,MAAM,eAAe;4BACpF,eAAe,OAAO,CAAC,MAAM,WAAW,cAAc,CAAC,MAAM,YAAY;4BACzE,4BAA4B,WAAW,CAAC,UAAU,MAAM;4BACxD,qEAAqE;qBACxE;iBACF;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-reviews.d.ts","sourceRoot":"","sources":["../../src/tools/get-reviews.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"get-reviews.d.ts","sourceRoot":"","sources":["../../src/tools/get-reviews.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,EACjB,GAAG,EAAE,SAAS,GACb,IAAI,CAoHN"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { displayUserName } from '../user-display-name.js';
|
|
2
3
|
export function registerGetReviewsTool(server, api) {
|
|
3
4
|
server.registerTool('get_reviews', {
|
|
4
5
|
title: 'Get Reviews',
|
|
@@ -65,9 +66,13 @@ export function registerGetReviewsTool(server, api) {
|
|
|
65
66
|
: await api.getReviewsForLatestVersion(fileMsId);
|
|
66
67
|
const summary = reviews
|
|
67
68
|
.map((r) => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
// ENG-4384 — one expression for both ways we can fail to name
|
|
70
|
+
// somebody. The ternary this replaces guarded the requester being
|
|
71
|
+
// ABSENT and nothing guarded it being NAMELESS, so a requester
|
|
72
|
+
// with null name parts rendered `null null` while a missing one
|
|
73
|
+
// rendered `Unknown`. Same question, two answers, one of them a
|
|
74
|
+
// string a model reads as a person's name.
|
|
75
|
+
const reviewer = displayUserName(r.requester) ?? 'Unknown';
|
|
71
76
|
return (`- **${r.subject}** (id: ${r.id}, status: ${r.status})` +
|
|
72
77
|
` — requested by ${reviewer} on ${r.createdAt}` +
|
|
73
78
|
(r.description ? ` — ${r.description}` : ''));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-reviews.js","sourceRoot":"","sources":["../../src/tools/get-reviews.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"get-reviews.js","sourceRoot":"","sources":["../../src/tools/get-reviews.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,UAAU,sBAAsB,CACpC,MAAiB,EACjB,GAAc;IAEd,MAAM,CAAC,YAAY,CACjB,aAAa,EACb;QACE,KAAK,EAAE,aAAa;QACpB,WAAW,EACT,4FAA4F;YAC5F,8EAA8E;YAC9E,iEAAiE;QACnE,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,SAAS,EAAE,CAAC;iBACT,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CACP,2DAA2D;gBACzD,+BAA+B,CAClC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gBAC3C,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC;gBAC3D,OAAO,CACL,OAAO,CAAC,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,MAAM,GAAG;oBACvD,mBAAmB,QAAQ,OAAO,CAAC,CAAC,SAAS,EAAE;oBAC/C,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAC7C,CAAC;YACJ,CAAC,CAAC;iBACD,IAAI,CAAC,IAAI,CAAC,CAAC;YAEd,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,OAAO,CAAC,MAAM;4BAClB,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,kBAAkB,OAAO,EAAE;4BAC9C,CAAC,CAAC,mBAAmB;qBACxB;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,0BAA0B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;qBACzF;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ENG-4384 — name a person from the name parts we actually hold.
|
|
3
|
+
*
|
|
4
|
+
* `UserSummary.firstName` and `lastName` are `string | null`, and both columns
|
|
5
|
+
* are `nullable: true` on the backend user row
|
|
6
|
+
* (`backend/src/resources/users/entities/user.entity.ts:146-150`). Two call
|
|
7
|
+
* sites interpolated them straight into a template literal, so a requester
|
|
8
|
+
* carrying neither rendered as the literal four-character word twice —
|
|
9
|
+
* `requested by null null` — and one carrying only a surname rendered
|
|
10
|
+
* `requested by null Whitfield`. A model reads that as the person's name and
|
|
11
|
+
* relays it.
|
|
12
|
+
*
|
|
13
|
+
* WHY IT WAS UNREACHABLE UNTIL NOW. A Microsoft or Google sign-in supplies the
|
|
14
|
+
* given and family name from the provider profile, so every legacy account has
|
|
15
|
+
* a `firstName`. An identity-service account, and any user invited but not yet
|
|
16
|
+
* through a profile step, has neither — the same reason ENG-4219, ENG-4220,
|
|
17
|
+
* ENG-4222 and ENG-4279 became reachable in this package.
|
|
18
|
+
*
|
|
19
|
+
* ITS OWN MODULE so it is a pure function two surfaces share rather than a
|
|
20
|
+
* shape copied into each — the twin at `prompts/index.ts` is exactly how the
|
|
21
|
+
* defect came to exist in two places at once. Same reasoning as
|
|
22
|
+
* `auth/remediation.ts`.
|
|
23
|
+
*
|
|
24
|
+
* DELIBERATELY NO EMAIL RUNG, and this is the one place to state it. The
|
|
25
|
+
* backend's `getFullUserNameOrEmail` (`backend/src/helpers/strings.ts:120-131`)
|
|
26
|
+
* falls through to `email` and then `username`, and both are the SAME value
|
|
27
|
+
* here — `username` is written with the email address
|
|
28
|
+
* (`backend/src/auth/auth.service.ts:405`,
|
|
29
|
+
* `backend/src/resources/users/users.service.ts:437`). ENG-4349 shipped in this
|
|
30
|
+
* package to stop a plain read handing the model a colleague's email address;
|
|
31
|
+
* adding one back on this path would trade one wrong answer for another.
|
|
32
|
+
* Whether a nameless person should be identified by email on a read is a
|
|
33
|
+
* product decision, not this function's to make — so it returns `null` and
|
|
34
|
+
* lets the caller say what it already says when it cannot name somebody.
|
|
35
|
+
*/
|
|
36
|
+
/** The name parts a person may carry, as any caller in this package holds them. */
|
|
37
|
+
export interface NameParts {
|
|
38
|
+
firstName?: string | null;
|
|
39
|
+
lastName?: string | null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The person's display name, or `null` when we hold no name for them.
|
|
43
|
+
*
|
|
44
|
+
* `null` for a nullish user too, so a caller does not need its own presence
|
|
45
|
+
* check before asking — `displayUserName(r.requester) ?? 'Unknown'` covers the
|
|
46
|
+
* absent user and the nameless one with one expression, which is the point:
|
|
47
|
+
* those two cases were answered differently, and only one of them was right.
|
|
48
|
+
*
|
|
49
|
+
* Whitespace-only is treated as absent. The backend trims on the same question
|
|
50
|
+
* (`getFullUserNameOrEmail`), and a name of `' '` renders as a blank where a
|
|
51
|
+
* reader sees nothing at all rather than "unknown".
|
|
52
|
+
*/
|
|
53
|
+
export declare function displayUserName(user: NameParts | null | undefined): string | null;
|
|
54
|
+
//# sourceMappingURL=user-display-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-display-name.d.ts","sourceRoot":"","sources":["../src/user-display-name.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,mFAAmF;AACnF,MAAM,WAAW,SAAS;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAMjF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ENG-4384 — name a person from the name parts we actually hold.
|
|
3
|
+
*
|
|
4
|
+
* `UserSummary.firstName` and `lastName` are `string | null`, and both columns
|
|
5
|
+
* are `nullable: true` on the backend user row
|
|
6
|
+
* (`backend/src/resources/users/entities/user.entity.ts:146-150`). Two call
|
|
7
|
+
* sites interpolated them straight into a template literal, so a requester
|
|
8
|
+
* carrying neither rendered as the literal four-character word twice —
|
|
9
|
+
* `requested by null null` — and one carrying only a surname rendered
|
|
10
|
+
* `requested by null Whitfield`. A model reads that as the person's name and
|
|
11
|
+
* relays it.
|
|
12
|
+
*
|
|
13
|
+
* WHY IT WAS UNREACHABLE UNTIL NOW. A Microsoft or Google sign-in supplies the
|
|
14
|
+
* given and family name from the provider profile, so every legacy account has
|
|
15
|
+
* a `firstName`. An identity-service account, and any user invited but not yet
|
|
16
|
+
* through a profile step, has neither — the same reason ENG-4219, ENG-4220,
|
|
17
|
+
* ENG-4222 and ENG-4279 became reachable in this package.
|
|
18
|
+
*
|
|
19
|
+
* ITS OWN MODULE so it is a pure function two surfaces share rather than a
|
|
20
|
+
* shape copied into each — the twin at `prompts/index.ts` is exactly how the
|
|
21
|
+
* defect came to exist in two places at once. Same reasoning as
|
|
22
|
+
* `auth/remediation.ts`.
|
|
23
|
+
*
|
|
24
|
+
* DELIBERATELY NO EMAIL RUNG, and this is the one place to state it. The
|
|
25
|
+
* backend's `getFullUserNameOrEmail` (`backend/src/helpers/strings.ts:120-131`)
|
|
26
|
+
* falls through to `email` and then `username`, and both are the SAME value
|
|
27
|
+
* here — `username` is written with the email address
|
|
28
|
+
* (`backend/src/auth/auth.service.ts:405`,
|
|
29
|
+
* `backend/src/resources/users/users.service.ts:437`). ENG-4349 shipped in this
|
|
30
|
+
* package to stop a plain read handing the model a colleague's email address;
|
|
31
|
+
* adding one back on this path would trade one wrong answer for another.
|
|
32
|
+
* Whether a nameless person should be identified by email on a read is a
|
|
33
|
+
* product decision, not this function's to make — so it returns `null` and
|
|
34
|
+
* lets the caller say what it already says when it cannot name somebody.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* The person's display name, or `null` when we hold no name for them.
|
|
38
|
+
*
|
|
39
|
+
* `null` for a nullish user too, so a caller does not need its own presence
|
|
40
|
+
* check before asking — `displayUserName(r.requester) ?? 'Unknown'` covers the
|
|
41
|
+
* absent user and the nameless one with one expression, which is the point:
|
|
42
|
+
* those two cases were answered differently, and only one of them was right.
|
|
43
|
+
*
|
|
44
|
+
* Whitespace-only is treated as absent. The backend trims on the same question
|
|
45
|
+
* (`getFullUserNameOrEmail`), and a name of `' '` renders as a blank where a
|
|
46
|
+
* reader sees nothing at all rather than "unknown".
|
|
47
|
+
*/
|
|
48
|
+
export function displayUserName(user) {
|
|
49
|
+
if (user == null)
|
|
50
|
+
return null;
|
|
51
|
+
const parts = [user.firstName, user.lastName]
|
|
52
|
+
.map((part) => part?.trim())
|
|
53
|
+
.filter((part) => !!part);
|
|
54
|
+
return parts.length > 0 ? parts.join(' ') : null;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=user-display-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-display-name.js","sourceRoot":"","sources":["../src/user-display-name.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAQH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAAC,IAAkC;IAChE,IAAI,IAAI,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IAC9B,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC;SAC1C,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;SAC3B,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC5C,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACnD,CAAC"}
|
package/package.json
CHANGED