From b558c49726516d3a8a1de7d82b0d04a87e847dc4 Mon Sep 17 00:00:00 2001 From: Amp Date: Mon, 23 Nov 2026 15:06:22 +0000 Subject: [PATCH] Say what connecting protects in the setup summary The connect step now names what protection covers in the live app (common attacks, secret leaks and future vulnerabilities) and ties saying done to getting the live app protected. Apps with no server keep their wording. Amp-Thread-ID: https://ampcode.com/threads/T-3683de3b-6bda-4144-9052-100e040b0842 Co-authored-by: Elliot Taylor --- AGENT-INSTALL.md | 6 +++--- src/report.ts | 9 +++++++-- tests/report.test.ts | 8 ++++++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/AGENT-INSTALL.md b/AGENT-INSTALL.md index 560562a..8ae046d 100644 --- a/AGENT-INSTALL.md +++ b/AGENT-INSTALL.md @@ -157,11 +157,11 @@ When setup is finished, the person reads one short message, not a transcript of ### ๐Ÿ›ก๏ธ Checked 69 packages: 5 vulnerabilities in 3 packages (highest severity: high) -#### ๐Ÿ‘‰ Connect your Patchstack account to see the details and turn on protection +#### ๐Ÿ‘‰ Connect your Patchstack account to see the details and protect your live app from common attacks, secret leaks and future vulnerabilities https://api.patchstack.com/monitor/claim?site=โ€ฆ -When you've connected, say **done**. +When you've connected, say **done**, and we'll get your live app protected. #### What Patchstack found ๐Ÿ”ด High **1** ยท ๐ŸŸ  Medium **3** ยท ๐Ÿ”ต Low **1** ยท 12 packages outdated ยท 12 protection rules available @@ -175,7 +175,7 @@ The parts always come in that order. Fill each from the output, and leave out a 1. **Mark.** The two-line Patchstack mark in a code block, as in the layout above. 2. **Headline.** What was checked and found, as the heading. When the output gives no counts, write "Patchstack is now watching your app." Never estimate a count the output did not print. -3. **What to do now.** The next step from the `Next:` line, as the heading, with its link or command written out in full on its own line. Only that step: the items under `To do` are yours to finish, not the person's. Then: "When you've connected, say **done**." (or "When that's done, say **done**." for any other step). +3. **What to do now.** The next step from the `Next:` line, as the heading, with its link or command written out in full on its own line. Only that step: the items under `To do` are yours to finish, not the person's. Then: "When you've connected, say **done**, and we'll get your live app protected." ("When you've connected, say **done**." when setup found no server; "When that's done, say **done**." for any other step). 4. **What Patchstack found.** The severity counts, outdated packages and protection rules exactly as the output lists them. Leave it out when nothing was found: the headline already says so. 5. **Notes.** "**Reload your app's preview page.** The Patchstack widget appears in a bottom corner of the page." when setup added the widget; any line the output marks `โ„น`, except the one about no server. 6. **What changed.** One line in italics: that Patchstack is now part of the install and build, and where the API key is (git ignores it; never share it). diff --git a/src/report.ts b/src/report.ts index 362764d..8e32128 100644 --- a/src/report.ts +++ b/src/report.ts @@ -344,13 +344,15 @@ export function renderSummary(report: StatusReport, progress: Progress, context: if (next !== null) { const vulnerable = (findings?.vulnerable ?? 0) > 0; const rest = - next !== 'connected' ? '' : !canProtect ? ' to see the details' : vulnerable ? ' to see the details and turn on protection' : ' to turn on protection'; + next !== 'connected' ? '' : !canProtect ? ' to see the details' : vulnerable ? ` to see the details and ${PROTECTS}` : ` to ${PROTECTS}`; const lead = next === 'connected' ? 'Connect your Patchstack account' : capitalise(plainNextStepTitle(next, context)); const [first] = plainNextStepLines(next, context); const action = first?.startsWith('Open ') === true ? first.slice('Open '.length) : first; // The link goes in a paragraph of its own, so it renders on its own line. lines.push(`#### ๐Ÿ‘‰ ${lead}${rest}`, '', ...(action !== undefined ? [action, ''] : [])); - lines.push(next === 'connected' ? `When you've connected, say **${NEXT_REPLY}**.` : `When that's done, say **${NEXT_REPLY}**.`, ''); + // Protection runs where the app is deployed, so connecting leads on to going live; with no server there is nothing to protect. + const connected = canProtect ? `When you've connected, say **${NEXT_REPLY}**, and we'll get your live app protected.` : `When you've connected, say **${NEXT_REPLY}**.`; + lines.push(next === 'connected' ? connected : `When that's done, say **${NEXT_REPLY}**.`, ''); } if (canProtect && report.confirmed?.length) { @@ -399,6 +401,9 @@ export function renderSummary(report: StatusReport, progress: Progress, context: return lines; } +/** What connecting turns on, in the summary's next step: the guard's hardening, secret-exposure and live vulnerability rules. */ +const PROTECTS = 'protect your live app from common attacks, secret leaks and future vulnerabilities'; + /** What the person can ask, in a later conversation, to see this summary again. AGENT-INSTALL.md lists it. */ export const SUMMARY_AGAIN = 'Show my Patchstack summary'; diff --git a/tests/report.test.ts b/tests/report.test.ts index c194f9b..7c13356 100644 --- a/tests/report.test.ts +++ b/tests/report.test.ts @@ -192,17 +192,21 @@ describe('renderSummary', () => { ...LOGO, '### ๐Ÿ›ก๏ธ Checked 89 packages: 5 vulnerabilities in 3 packages (highest severity: high)', '', - '#### ๐Ÿ‘‰ Connect your Patchstack account to see the details and turn on protection', + '#### ๐Ÿ‘‰ Connect your Patchstack account to see the details and protect your live app from common attacks, secret leaks and future vulnerabilities', '', context.claimUrl, '', - `When you've connected, say **done**.`, + `When you've connected, say **done**, and we'll get your live app protected.`, '', '#### What Patchstack found', '๐Ÿ”ด High **1** ยท ๐ŸŸ  Medium **3** ยท ๐Ÿ”ต Low **1** ยท 12 packages outdated ยท 12 protection rules available', '', "**Reload your app's preview page.** The Patchstack widget appears in a bottom corner of the page.", ]); + const clean = summary({ vulnerable: 0, outdated: 0, severity: { high: 0, medium: 0, low: 0, unknown: 0 } }); + expect(renderSummary(report({ findings: clean }), notConnected, context, { widgetOnPage: false, dashboardUrl: null })).toContain( + '#### ๐Ÿ‘‰ Connect your Patchstack account to protect your live app from common attacks, secret leaks and future vulnerabilities', + ); }); it('gives a browser-only app with nothing found one path: the link, then the word to say', () => {