@patchstack/connect 0.5.9 → 0.5.11
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/AGENT-INSTALL.md +88 -3
- package/README.md +80 -39
- package/dist/cli.js +73 -47
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3082,7 +3082,7 @@ function ensureSourceMarker(cwd, shell, framework, checksum = null) {
|
|
|
3082
3082
|
}
|
|
3083
3083
|
|
|
3084
3084
|
// src/guide.ts
|
|
3085
|
-
import { existsSync as
|
|
3085
|
+
import { existsSync as existsSync12, readFileSync as readFileSync11, readdirSync as readdirSync5, statSync as statSync5 } from "fs";
|
|
3086
3086
|
import path12 from "path";
|
|
3087
3087
|
|
|
3088
3088
|
// src/architecture.ts
|
|
@@ -4311,7 +4311,7 @@ var nuxtAdapter = {
|
|
|
4311
4311
|
};
|
|
4312
4312
|
|
|
4313
4313
|
// src/protect/install/find-app.ts
|
|
4314
|
-
import { readFileSync as readFileSync8,
|
|
4314
|
+
import { readFileSync as readFileSync8, readdirSync as readdirSync3, lstatSync as lstatSync2 } from "fs";
|
|
4315
4315
|
import { join as join11, relative as relative3, dirname as dirname4 } from "path";
|
|
4316
4316
|
var SKIP_DIRS2 = /* @__PURE__ */ new Set([
|
|
4317
4317
|
"node_modules",
|
|
@@ -4333,7 +4333,6 @@ var SKIP_DIRS2 = /* @__PURE__ */ new Set([
|
|
|
4333
4333
|
]);
|
|
4334
4334
|
var MAX_DEPTH = 8;
|
|
4335
4335
|
function findAppInstance(cwd, re) {
|
|
4336
|
-
const root = existsSync7(join11(cwd, "src")) ? join11(cwd, "src") : cwd;
|
|
4337
4336
|
const found = [];
|
|
4338
4337
|
const walk2 = (dir, depth) => {
|
|
4339
4338
|
if (depth > MAX_DEPTH) return;
|
|
@@ -4372,7 +4371,7 @@ function findAppInstance(cwd, re) {
|
|
|
4372
4371
|
}
|
|
4373
4372
|
}
|
|
4374
4373
|
};
|
|
4375
|
-
walk2(
|
|
4374
|
+
walk2(cwd, 0);
|
|
4376
4375
|
if (found.length === 0) return null;
|
|
4377
4376
|
const declared = declaredEntries(cwd);
|
|
4378
4377
|
const chosen = found.slice().sort((a, b) => rankEntry({ ...a, declared: declared.has(a.relPath) }, { ...b, declared: declared.has(b.relPath) }))[0];
|
|
@@ -4430,16 +4429,16 @@ function importSpecifier(fromRel, toRel, preserveExtension = false) {
|
|
|
4430
4429
|
}
|
|
4431
4430
|
|
|
4432
4431
|
// src/protect/install/register.ts
|
|
4433
|
-
import { existsSync as
|
|
4432
|
+
import { existsSync as existsSync9 } from "fs";
|
|
4434
4433
|
import { join as join14, resolve as resolve3 } from "path";
|
|
4435
4434
|
|
|
4436
4435
|
// src/protect/install/generic.ts
|
|
4437
|
-
import { readFileSync as readFileSync9, existsSync as
|
|
4436
|
+
import { readFileSync as readFileSync9, existsSync as existsSync8, readdirSync as readdirSync4, lstatSync as lstatSync3 } from "fs";
|
|
4438
4437
|
import { join as join13, dirname as dirname6 } from "path";
|
|
4439
4438
|
|
|
4440
4439
|
// src/protect/install/source-scope.ts
|
|
4441
4440
|
import { execFileSync } from "child_process";
|
|
4442
|
-
import { existsSync as
|
|
4441
|
+
import { existsSync as existsSync7 } from "fs";
|
|
4443
4442
|
import { dirname as dirname5, join as join12, resolve as resolve2 } from "path";
|
|
4444
4443
|
|
|
4445
4444
|
// src/protect/install/node-flags.ts
|
|
@@ -4731,7 +4730,7 @@ function moduleKindOf(filePath, packageIsModule) {
|
|
|
4731
4730
|
function resolvesToGuardModule(specifier, query) {
|
|
4732
4731
|
const resolved = resolve2(dirname5(query.fromFile), specifier);
|
|
4733
4732
|
if (withoutModuleExtension(resolved) !== join12(query.guardDir, "guard")) return false;
|
|
4734
|
-
const existing = GUARD_FILENAMES.filter((name) =>
|
|
4733
|
+
const existing = GUARD_FILENAMES.filter((name) => existsSync7(join12(query.guardDir, name)));
|
|
4735
4734
|
if (existing.length === 0) return false;
|
|
4736
4735
|
const extension = /(\.[A-Za-z0-9]+)$/.exec(specifier)?.[1] ?? "";
|
|
4737
4736
|
if (!query.strictExtensions) return true;
|
|
@@ -4740,7 +4739,7 @@ function resolvesToGuardModule(specifier, query) {
|
|
|
4740
4739
|
if (query.kind === "cjs") return existing.includes("guard.js");
|
|
4741
4740
|
return true;
|
|
4742
4741
|
}
|
|
4743
|
-
if (
|
|
4742
|
+
if (existsSync7(resolved)) return true;
|
|
4744
4743
|
return query.kind === "ts" && extension === ".js" && existing.includes("guard.ts");
|
|
4745
4744
|
}
|
|
4746
4745
|
function withoutModuleExtension(filePath) {
|
|
@@ -4756,10 +4755,10 @@ function packageIsEsm(cwd) {
|
|
|
4756
4755
|
}
|
|
4757
4756
|
}
|
|
4758
4757
|
function genericDir(cwd) {
|
|
4759
|
-
return
|
|
4758
|
+
return existsSync8(join13(cwd, "src")) ? "src/patchstack" : "patchstack";
|
|
4760
4759
|
}
|
|
4761
4760
|
function hasTypeScript(cwd) {
|
|
4762
|
-
return
|
|
4761
|
+
return existsSync8(join13(cwd, "tsconfig.json")) || candidateEntries(cwd).some((entry) => /\.tsx?$/.test(entry));
|
|
4763
4762
|
}
|
|
4764
4763
|
function genericGuardTarget(cwd) {
|
|
4765
4764
|
if (hasTypeScript(cwd)) {
|
|
@@ -4773,7 +4772,7 @@ function genericGuardTarget(cwd) {
|
|
|
4773
4772
|
function genericScaffoldFiles(cwd) {
|
|
4774
4773
|
const dir = genericDir(cwd);
|
|
4775
4774
|
const candidates = ["guard.ts", "guard.js", "guard.cjs", "rules.json"];
|
|
4776
|
-
return candidates.map((file) => `${dir}/${file}`).filter((relative8) =>
|
|
4775
|
+
return candidates.map((file) => `${dir}/${file}`).filter((relative8) => existsSync8(join13(cwd, relative8)));
|
|
4777
4776
|
}
|
|
4778
4777
|
function scaffoldGeneric(cwd, opts, guardTemplate, guardFile) {
|
|
4779
4778
|
const target = genericGuardTarget(cwd);
|
|
@@ -4788,7 +4787,7 @@ function scaffoldGeneric(cwd, opts, guardTemplate, guardFile) {
|
|
|
4788
4787
|
const changed = [guardRel];
|
|
4789
4788
|
if (!opts.demo) bakeSiteUuid(cwd, guardRel);
|
|
4790
4789
|
const rulesDst = join13(dst, "rules.json");
|
|
4791
|
-
if (opts.demo || !
|
|
4790
|
+
if (opts.demo || !existsSync8(rulesDst)) {
|
|
4792
4791
|
copyProjectFileSync(cwd, join13(templates, opts.demo ? "demo-rules.json" : "rules.json"), rulesDst);
|
|
4793
4792
|
changed.push(`${dir}/rules.json`);
|
|
4794
4793
|
}
|
|
@@ -4810,10 +4809,10 @@ function candidateEntries(cwd) {
|
|
|
4810
4809
|
"app.ts",
|
|
4811
4810
|
"app.js"
|
|
4812
4811
|
];
|
|
4813
|
-
const hits = names.filter((n) =>
|
|
4812
|
+
const hits = names.filter((n) => existsSync8(join13(cwd, n)));
|
|
4814
4813
|
try {
|
|
4815
4814
|
const pkg = JSON.parse(read(join13(cwd, "package.json")));
|
|
4816
|
-
if (typeof pkg.main === "string" &&
|
|
4815
|
+
if (typeof pkg.main === "string" && existsSync8(join13(cwd, pkg.main))) hits.push(pkg.main);
|
|
4817
4816
|
} catch {
|
|
4818
4817
|
}
|
|
4819
4818
|
return [...new Set(hits)];
|
|
@@ -4924,7 +4923,7 @@ function escapeForRegExp(value) {
|
|
|
4924
4923
|
function genericVerify(cwd) {
|
|
4925
4924
|
const dir = genericDir(cwd);
|
|
4926
4925
|
const target = genericGuardTarget(cwd);
|
|
4927
|
-
const present2 = GUARD_FILENAMES.find((name) =>
|
|
4926
|
+
const present2 = GUARD_FILENAMES.find((name) => existsSync8(join13(cwd, dir, name)));
|
|
4928
4927
|
const scaffolded = present2 !== void 0;
|
|
4929
4928
|
const imported = scaffolded && guardIsImported(cwd, join13(cwd, dir, present2));
|
|
4930
4929
|
return {
|
|
@@ -4962,7 +4961,7 @@ var NON_RUNTIME_DIRS = /* @__PURE__ */ new Set([
|
|
|
4962
4961
|
function guardIsImported(cwd, guardPath) {
|
|
4963
4962
|
const guardDir = dirname6(guardPath);
|
|
4964
4963
|
const packageIsModule = packageIsEsm(cwd);
|
|
4965
|
-
const root =
|
|
4964
|
+
const root = existsSync8(join13(cwd, "src")) ? join13(cwd, "src") : cwd;
|
|
4966
4965
|
let found = false;
|
|
4967
4966
|
const walk2 = (d, depth) => {
|
|
4968
4967
|
if (found || depth > 8) return;
|
|
@@ -5166,10 +5165,10 @@ function serverIsGuarded(cwd, spec, server, guardDir) {
|
|
|
5166
5165
|
return !spec.callAfter || routesBefore(source, server.appVar, state.callIndex).length === 0;
|
|
5167
5166
|
}
|
|
5168
5167
|
function verifyRegister(cwd, spec) {
|
|
5169
|
-
const dir =
|
|
5168
|
+
const dir = existsSync9(join14(cwd, "src")) ? "src/patchstack" : "patchstack";
|
|
5170
5169
|
const entry = findAppInstance(cwd, spec.appRe);
|
|
5171
5170
|
const target = entry ? guardTarget(cwd, entry.relPath, spec) : null;
|
|
5172
|
-
const scaffolded = target ?
|
|
5171
|
+
const scaffolded = target ? existsSync9(join14(cwd, dir, target.file)) : false;
|
|
5173
5172
|
const entrySource = entry ? read(join14(cwd, entry.relPath)) : "";
|
|
5174
5173
|
const state = entry ? wiringState(entrySource, spec, entry.appVar, entry.relPath, { cwd, guardDir: dir }) : { importAtTopLevel: false, callInAppScope: false, ordered: false, callIndex: -1, appIndex: -1 };
|
|
5175
5174
|
const wired = state.importAtTopLevel && state.callInAppScope && state.ordered;
|
|
@@ -5260,7 +5259,7 @@ var expressAdapter = {
|
|
|
5260
5259
|
};
|
|
5261
5260
|
|
|
5262
5261
|
// src/protect/install/reporting.ts
|
|
5263
|
-
import { existsSync as
|
|
5262
|
+
import { existsSync as existsSync10 } from "fs";
|
|
5264
5263
|
import { join as join15 } from "path";
|
|
5265
5264
|
|
|
5266
5265
|
// src/protect/reporting-state.js
|
|
@@ -5321,7 +5320,7 @@ function explainReportingState(state) {
|
|
|
5321
5320
|
function siteIdentity(cwd, env) {
|
|
5322
5321
|
const rc = join15(cwd, ".patchstackrc.json");
|
|
5323
5322
|
let recorded;
|
|
5324
|
-
if (
|
|
5323
|
+
if (existsSync10(rc)) {
|
|
5325
5324
|
try {
|
|
5326
5325
|
recorded = JSON.parse(read(rc)).siteUuid;
|
|
5327
5326
|
} catch {
|
|
@@ -5470,7 +5469,7 @@ function runVerify(cwd) {
|
|
|
5470
5469
|
}
|
|
5471
5470
|
|
|
5472
5471
|
// src/widget.ts
|
|
5473
|
-
import { existsSync as
|
|
5472
|
+
import { existsSync as existsSync11, readFileSync as readFileSync10 } from "fs";
|
|
5474
5473
|
import path11 from "path";
|
|
5475
5474
|
var WIDGET_SCRIPT_URL = "https://cdn.patchstack.com/patchstack-widget.js";
|
|
5476
5475
|
var WIDGET_MARKER_ATTR = "data-patchstack-connect-widget";
|
|
@@ -5509,7 +5508,7 @@ ${indent}</body>`;
|
|
|
5509
5508
|
}
|
|
5510
5509
|
function findSourceShell(cwd) {
|
|
5511
5510
|
for (const candidate of SOURCE_SHELL_CANDIDATES) {
|
|
5512
|
-
if (
|
|
5511
|
+
if (existsSync11(path11.join(cwd, candidate))) {
|
|
5513
5512
|
return candidate;
|
|
5514
5513
|
}
|
|
5515
5514
|
}
|
|
@@ -5521,7 +5520,7 @@ function ensureSourceWidget(cwd, siteUuid, jsxShell = null) {
|
|
|
5521
5520
|
return { shell: null, action: "no-shell" };
|
|
5522
5521
|
}
|
|
5523
5522
|
const file = path11.join(cwd, shell);
|
|
5524
|
-
if (!
|
|
5523
|
+
if (!existsSync11(file)) {
|
|
5525
5524
|
return { shell: null, action: "no-shell" };
|
|
5526
5525
|
}
|
|
5527
5526
|
const before = readFileSync10(file, "utf8");
|
|
@@ -5606,7 +5605,7 @@ function detectPackageManager(cwd) {
|
|
|
5606
5605
|
return declared;
|
|
5607
5606
|
}
|
|
5608
5607
|
for (const { filename, pm } of PM_BY_LOCKFILE) {
|
|
5609
|
-
if (
|
|
5608
|
+
if (existsSync12(path12.join(cwd, filename))) {
|
|
5610
5609
|
return pm;
|
|
5611
5610
|
}
|
|
5612
5611
|
}
|
|
@@ -5703,7 +5702,7 @@ function resolveWidgetFileHint(cwd, framework) {
|
|
|
5703
5702
|
...GENERIC_WIDGET_FILES
|
|
5704
5703
|
];
|
|
5705
5704
|
for (const candidate of candidates) {
|
|
5706
|
-
if (
|
|
5705
|
+
if (existsSync12(path12.join(cwd, candidate))) {
|
|
5707
5706
|
return candidate;
|
|
5708
5707
|
}
|
|
5709
5708
|
}
|
|
@@ -5823,7 +5822,11 @@ function renderGuideChecklist(state, useColor) {
|
|
|
5823
5822
|
lines.push("");
|
|
5824
5823
|
if (!state.hasPackageJson) {
|
|
5825
5824
|
lines.push(todo("No package.json found in this directory."));
|
|
5826
|
-
lines.push(detail("
|
|
5825
|
+
lines.push(detail("For a JS/Node app, run the guide from its package directory; check that package.json is readable and valid."));
|
|
5826
|
+
lines.push(detail("For a standalone HTML/CSS/browser-JavaScript site, use the disclosure widget directly."));
|
|
5827
|
+
lines.push(detail("Do not create a Node project, build hooks, or a server just to install the widget."));
|
|
5828
|
+
lines.push(detail("Use the correct site UUID or widget snippet from the Patchstack dashboard; never invent one."));
|
|
5829
|
+
lines.push(detail('See "Plain HTML sites" in AGENT-INSTALL.md. Widget-only setup provides no dependency scan or runtime protection.'));
|
|
5827
5830
|
return lines.join("\n");
|
|
5828
5831
|
}
|
|
5829
5832
|
if (countRemainingSteps(state) > 0) {
|
|
@@ -5855,6 +5858,8 @@ function renderGuideChecklist(state, useColor) {
|
|
|
5855
5858
|
lines.push(detail("Run \u2192 npx @patchstack/connect scan"));
|
|
5856
5859
|
lines.push(detail("Reads the lockfile, registers the project, writes .patchstackrc.json,"));
|
|
5857
5860
|
lines.push(detail("and prints a dashboard link. The CLI prints the link but never opens it."));
|
|
5861
|
+
lines.push(detail("If your tool refuses to run this command, hand it to the person instead of working"));
|
|
5862
|
+
lines.push(detail('around it \u2014 see "When your tool will not run this CLI" in the reference guide.'));
|
|
5858
5863
|
}
|
|
5859
5864
|
if (state.installScanWired) {
|
|
5860
5865
|
lines.push(done("Dependency-install scan wired (postinstall)"));
|
|
@@ -5943,11 +5948,19 @@ function renderGuideChecklist(state, useColor) {
|
|
|
5943
5948
|
}
|
|
5944
5949
|
lines.push("");
|
|
5945
5950
|
if (state.claimUrl !== null) {
|
|
5946
|
-
lines.push(` ${paint(ANSI.cyan, "\u279C")} ${paint(ANSI.bold, "
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
+
lines.push(` ${paint(ANSI.cyan, "\u279C")} ${paint(ANSI.bold, "Connect this site to your Patchstack account:")}`);
|
|
5952
|
+
let route = 1;
|
|
5953
|
+
if (widgetTagInPlace(state)) {
|
|
5954
|
+
lines.push(` ${route++}. In the preview \u2014 while the site is unclaimed the widget shows a`);
|
|
5955
|
+
lines.push(' "Connect this website" panel. Signing in there attaches the site.');
|
|
5956
|
+
}
|
|
5957
|
+
lines.push(` ${route++}. In a browser \u2014 open the dashboard link (the CLI never opens it):`);
|
|
5958
|
+
lines.push(` ${paint(ANSI.cyan, state.claimUrl)}`);
|
|
5959
|
+
lines.push(` ${route}. From this terminal \u2192 npx @patchstack/connect claim`);
|
|
5960
|
+
lines.push(" (prints a link to sign in with, then attaches the site to that account)");
|
|
5961
|
+
lines.push(detail("Reports have no owner to reach until one of these completes. The site UUID ships"));
|
|
5962
|
+
lines.push(detail("in the page and claiming is first-come, so an unclaimed site stays claimable by"));
|
|
5963
|
+
lines.push(detail("anyone who loads it."));
|
|
5951
5964
|
if (state.endpointOverride !== null) {
|
|
5952
5965
|
lines.push(detail("(this URL inherits the endpoint override above)"));
|
|
5953
5966
|
}
|
|
@@ -5957,9 +5970,11 @@ function renderGuideChecklist(state, useColor) {
|
|
|
5957
5970
|
if (widgetTagInPlace(state)) {
|
|
5958
5971
|
lines.push("");
|
|
5959
5972
|
lines.push(` ${paint(ANSI.cyan, "\u279C")} ${paint(ANSI.bold, "Refresh the preview to see the widget:")}`);
|
|
5960
|
-
lines.push(
|
|
5961
|
-
lines.push("
|
|
5962
|
-
lines.push("
|
|
5973
|
+
lines.push(" The widget loads with the page, so a preview that was already open still shows");
|
|
5974
|
+
lines.push(" the HTML from before this change. Builders that hot reload refresh it themselves;");
|
|
5975
|
+
lines.push(" if nothing appears, refresh the preview once.");
|
|
5976
|
+
lines.push(' Unclaimed, the widget shows the "Connect this website" panel; the public');
|
|
5977
|
+
lines.push(' "Report a vulnerability" button takes its place once the site is claimed.');
|
|
5963
5978
|
}
|
|
5964
5979
|
if (state.siteUuid !== null) {
|
|
5965
5980
|
lines.push("");
|
|
@@ -6293,7 +6308,7 @@ async function claim2(config, onPrompt, deps = {}) {
|
|
|
6293
6308
|
import { relative as relative4 } from "path";
|
|
6294
6309
|
|
|
6295
6310
|
// src/protect/install/runtime/entry.ts
|
|
6296
|
-
import { existsSync as
|
|
6311
|
+
import { existsSync as existsSync13, readFileSync as readFileSync13, realpathSync as realpathSync4, statSync as statSync6 } from "fs";
|
|
6297
6312
|
import { join as join16, resolve as resolve4, sep as sep2 } from "path";
|
|
6298
6313
|
var CONVENTIONAL = [
|
|
6299
6314
|
"server.js",
|
|
@@ -6390,14 +6405,14 @@ function resolveEntry(cwd) {
|
|
|
6390
6405
|
}
|
|
6391
6406
|
return {
|
|
6392
6407
|
kind: "unavailable",
|
|
6393
|
-
reason:
|
|
6408
|
+
reason: existsSync13(join16(cwd, "package.json")) ? 'no directly loadable entry was found \u2014 declare one as a "start" script of the form `node <file>`, or run the check against a built output' : "there is no package.json here"
|
|
6394
6409
|
};
|
|
6395
6410
|
}
|
|
6396
6411
|
|
|
6397
6412
|
// src/protect/install/runtime/probe.ts
|
|
6398
6413
|
import { spawn } from "child_process";
|
|
6399
6414
|
import { createHash as createHash3, randomBytes } from "crypto";
|
|
6400
|
-
import { existsSync as
|
|
6415
|
+
import { existsSync as existsSync14 } from "fs";
|
|
6401
6416
|
import { request as httpRequest } from "http";
|
|
6402
6417
|
import { request as httpsRequest, Agent as HttpsAgent } from "https";
|
|
6403
6418
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
@@ -6425,7 +6440,7 @@ function preloadPath() {
|
|
|
6425
6440
|
];
|
|
6426
6441
|
for (const candidate of candidates) {
|
|
6427
6442
|
const path18 = fileURLToPath2(candidate);
|
|
6428
|
-
if (
|
|
6443
|
+
if (existsSync14(path18)) return path18;
|
|
6429
6444
|
}
|
|
6430
6445
|
return null;
|
|
6431
6446
|
}
|
|
@@ -9623,14 +9638,21 @@ async function runScan(args, options = {}) {
|
|
|
9623
9638
|
const linkUuid = response.uuid ?? config.siteUuid;
|
|
9624
9639
|
if (!connected && (provisioning || claimLines.length > 0) && linkUuid !== null && linkUuid !== void 0 && linkUuid.length > 0) {
|
|
9625
9640
|
console.log("");
|
|
9626
|
-
console.log("
|
|
9627
|
-
|
|
9641
|
+
console.log("Connect this site to your Patchstack account \u2014 any one of these:");
|
|
9642
|
+
if (config.widget) {
|
|
9643
|
+
console.log(' 1. In the preview \u2014 the widget shows a "Connect this website" panel while the');
|
|
9644
|
+
console.log(" site is unclaimed. Signing in there attaches it.");
|
|
9645
|
+
console.log(" 2. Open this dashboard link in a browser:");
|
|
9646
|
+
console.log(` ${buildClaimUrl(config.endpoint, linkUuid)}`);
|
|
9647
|
+
console.log(" 3. From this terminal: npx @patchstack/connect claim");
|
|
9648
|
+
} else {
|
|
9649
|
+
console.log(" 1. Open this dashboard link in a browser:");
|
|
9650
|
+
console.log(` ${buildClaimUrl(config.endpoint, linkUuid)}`);
|
|
9651
|
+
console.log(" 2. From this terminal: npx @patchstack/connect claim");
|
|
9652
|
+
}
|
|
9628
9653
|
if (config.endpoint !== DEFAULT_ENDPOINT) {
|
|
9629
9654
|
console.log(" (this URL inherits the endpoint override above)");
|
|
9630
9655
|
}
|
|
9631
|
-
console.log("");
|
|
9632
|
-
console.log("Or attach it to your account from this terminal:");
|
|
9633
|
-
console.log(" npx @patchstack/connect claim");
|
|
9634
9656
|
}
|
|
9635
9657
|
if (options.showRemainingSetup !== false) {
|
|
9636
9658
|
try {
|
|
@@ -9656,7 +9678,8 @@ function reportSourceWidget(siteUuid, framework) {
|
|
|
9656
9678
|
const result = ensureSourceWidget(process.cwd(), siteUuid, jsxShell);
|
|
9657
9679
|
switch (result.action) {
|
|
9658
9680
|
case "added":
|
|
9659
|
-
console.log(`Widget: added the
|
|
9681
|
+
console.log(`Widget: added the disclosure widget tag to ${result.shell}. Reload your preview to see it.`);
|
|
9682
|
+
console.log(' Unclaimed, it shows a "Connect this website" panel; the "Report a vulnerability" button replaces it once the site is claimed.');
|
|
9660
9683
|
break;
|
|
9661
9684
|
case "updated":
|
|
9662
9685
|
console.log(`Widget: updated the managed tag in ${result.shell} to site ${siteUuid}.`);
|
|
@@ -9888,6 +9911,7 @@ async function runSetup(args) {
|
|
|
9888
9911
|
const before = await collectGuideState(process.cwd());
|
|
9889
9912
|
if (!before.hasPackageJson) {
|
|
9890
9913
|
console.error("Error: no package.json found. Run setup from the project root.");
|
|
9914
|
+
console.error("For a standalone HTML site, use the widget-only instructions in AGENT-INSTALL.md; do not create a Node project just to run setup.");
|
|
9891
9915
|
return 1;
|
|
9892
9916
|
}
|
|
9893
9917
|
if (before.installed === null) {
|
|
@@ -9965,7 +9989,7 @@ function setupOutcome(state, protection, wired) {
|
|
|
9965
9989
|
if (protection.install.status === "not-applicable" && protection.install.leftovers.length > 0) {
|
|
9966
9990
|
warnings.push(`earlier guard scaffold does nothing here and can be deleted: ${protection.install.leftovers.join(", ")}`);
|
|
9967
9991
|
}
|
|
9968
|
-
if (state.claimUrl !== null) warnings.push(
|
|
9992
|
+
if (state.claimUrl !== null) warnings.push('the site is not attached to an account until someone signs in through the widget\'s "Connect this website" panel, the dashboard link is opened, or `npx @patchstack/connect claim` completes');
|
|
9969
9993
|
if (warnings.length > 0) lines.push(["Warnings", warnings.join("; ")]);
|
|
9970
9994
|
return lines;
|
|
9971
9995
|
}
|
|
@@ -9983,7 +10007,9 @@ async function runStatus(args) {
|
|
|
9983
10007
|
console.log(`Environment: ${config.environment}`);
|
|
9984
10008
|
if (config.siteUuid !== null) {
|
|
9985
10009
|
console.log(`Dashboard URL: ${buildClaimUrl(config.endpoint, config.siteUuid)}`);
|
|
9986
|
-
console.log(
|
|
10010
|
+
console.log(` Not attached to an account yet? Sign in through the widget's "Connect this`);
|
|
10011
|
+
console.log(' website" panel on the preview, open the link above, or run');
|
|
10012
|
+
console.log(" `npx @patchstack/connect claim`.");
|
|
9987
10013
|
switch (await fetchSiteStatus(config)) {
|
|
9988
10014
|
case "active":
|
|
9989
10015
|
console.log("Site status: active on Patchstack");
|