landingboost 0.1.0 → 0.1.1
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/bin/landingboost.mjs +33 -6
- package/package.json +1 -1
package/bin/landingboost.mjs
CHANGED
|
@@ -131,6 +131,14 @@ function firstText(...values) {
|
|
|
131
131
|
return "";
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
function compactList(values, limit = 2) {
|
|
135
|
+
if (!Array.isArray(values)) return [];
|
|
136
|
+
return values
|
|
137
|
+
.map((value) => (typeof value === "string" ? value.trim() : ""))
|
|
138
|
+
.filter(Boolean)
|
|
139
|
+
.slice(0, limit);
|
|
140
|
+
}
|
|
141
|
+
|
|
134
142
|
function scoreLine(label, value) {
|
|
135
143
|
return `${label.padEnd(9)} ${String(value ?? "n/a").padStart(3)}`;
|
|
136
144
|
}
|
|
@@ -144,6 +152,10 @@ function formatText(result) {
|
|
|
144
152
|
const title = firstText(edit.title, edit.headline, "Next edit");
|
|
145
153
|
const instruction = firstText(edit.instruction, edit.change_this, edit.summary);
|
|
146
154
|
const where = firstText(edit.where, edit.location);
|
|
155
|
+
const reason = firstText(edit.reason, edit.why_this_edit);
|
|
156
|
+
const before = firstText(edit.patch?.before);
|
|
157
|
+
const after = firstText(edit.patch?.after);
|
|
158
|
+
const profileLabel = firstText(result.benchmark_summary?.profile?.label);
|
|
147
159
|
|
|
148
160
|
const lines = [];
|
|
149
161
|
lines.push("LandingBoost scan");
|
|
@@ -152,10 +164,17 @@ function formatText(result) {
|
|
|
152
164
|
lines.push(`Score: ${scores.overall_100 ?? "n/a"}/100`);
|
|
153
165
|
if (result.weakest_axis) lines.push(`Bottleneck: ${result.weakest_axis}`);
|
|
154
166
|
lines.push("");
|
|
155
|
-
lines.push("
|
|
167
|
+
lines.push("First Edit");
|
|
156
168
|
lines.push(` ${title}`);
|
|
157
169
|
if (instruction) lines.push(` ${instruction}`);
|
|
158
170
|
if (where) lines.push(` Where: ${where}`);
|
|
171
|
+
if (reason) lines.push(` Why: ${reason}`);
|
|
172
|
+
if (before || after) {
|
|
173
|
+
lines.push("");
|
|
174
|
+
lines.push("Suggested Change");
|
|
175
|
+
if (before) lines.push(` Before: ${before}`);
|
|
176
|
+
if (after) lines.push(` After: ${after}`);
|
|
177
|
+
}
|
|
159
178
|
lines.push("");
|
|
160
179
|
lines.push("Scores");
|
|
161
180
|
lines.push(` ${scoreLine("Clarity", scores.clarity_100)}`);
|
|
@@ -163,10 +182,18 @@ function formatText(result) {
|
|
|
163
182
|
lines.push(` ${scoreLine("Trust", scores.trust_100)}`);
|
|
164
183
|
lines.push(` ${scoreLine("Action", scores.action_100)}`);
|
|
165
184
|
|
|
166
|
-
|
|
167
|
-
if (referenceNames.length) {
|
|
185
|
+
if (refs.length) {
|
|
168
186
|
lines.push("");
|
|
169
|
-
lines.push(
|
|
187
|
+
lines.push("Matched References");
|
|
188
|
+
if (profileLabel) lines.push(` Profile: ${profileLabel}`);
|
|
189
|
+
for (const ref of refs.slice(0, 3)) {
|
|
190
|
+
if (!ref?.name) continue;
|
|
191
|
+
const suffix = ref.match_confidence ? ` (${ref.match_confidence})` : "";
|
|
192
|
+
lines.push(` - ${ref.name}${suffix}`);
|
|
193
|
+
for (const why of compactList(ref.why_match, 2)) {
|
|
194
|
+
lines.push(` ${why}`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
170
197
|
}
|
|
171
198
|
|
|
172
199
|
if (typeof usage.api_calls_used === "number" || typeof usage.api_calls_remaining === "number") {
|
|
@@ -178,7 +205,7 @@ function formatText(result) {
|
|
|
178
205
|
|
|
179
206
|
if (scanUrl) {
|
|
180
207
|
lines.push("");
|
|
181
|
-
lines.push(`Open: ${scanUrl}`);
|
|
208
|
+
lines.push(`Open full report: ${scanUrl}`);
|
|
182
209
|
}
|
|
183
210
|
|
|
184
211
|
return lines.join("\n");
|
|
@@ -197,7 +224,7 @@ async function commandLogin(args) {
|
|
|
197
224
|
|
|
198
225
|
console.log(`Saved LandingBoost API key: ${maskKey(apiKey)}`);
|
|
199
226
|
console.log(`Config: ${CONFIG_FILE}`);
|
|
200
|
-
console.log("
|
|
227
|
+
console.log("Next: landingboost scan <your-url>");
|
|
201
228
|
}
|
|
202
229
|
|
|
203
230
|
async function commandStatus() {
|