frontend-guardian 0.1.18 → 0.1.20
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/README.md +17 -6
- package/dist/cli.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
# frontend-guardian (CLI)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Scan engine for **Frontend Guardian**.
|
|
4
|
+
|
|
5
|
+
**What is Frontend Guardian?** It helps frontend teams keep UIs consistent. After you ship, spacing, borders, colors, and components often drift. This tool scans your code (Tailwind, JSX/TSX) and flags inconsistent spacing, arbitrary colors, mixed border-radius, duplicate components, and similar issues so you can fix them before they pile up.
|
|
4
6
|
|
|
5
7
|
Use this package only if you want to run the scanner from your own Node code (programmatic use).
|
|
6
8
|
|
|
7
|
-
Most users
|
|
9
|
+
**Most users:** run the CLI instead (no install):
|
|
8
10
|
|
|
11
|
+
```bash
|
|
12
|
+
# Scan current folder for Tailwind/component consistency
|
|
9
13
|
npx frontend-guardian .
|
|
10
|
-
npx frontend-guardian init # add GitHub Actions workflow to your repo
|
|
11
|
-
npx frontend-guardian . --suggest # AI fix suggestions (hosted API or GEMINI_API_KEY)
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
# Add GitHub Actions workflow to run the check on push/PR
|
|
16
|
+
npx frontend-guardian init
|
|
17
|
+
|
|
18
|
+
# Same scan + AI fix suggestions
|
|
19
|
+
npx frontend-guardian . --suggest
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Install (optional)** — only if you're embedding the scanner in your app:
|
|
14
23
|
|
|
24
|
+
```bash
|
|
15
25
|
npm i @justinmoto/frontend-guardian-core
|
|
26
|
+
```
|
package/dist/cli.js
CHANGED
|
@@ -352,8 +352,9 @@ async function getGeminiSuggestion(apiKey, issueTitle, detected) {
|
|
|
352
352
|
const ai = new GoogleGenAI({ apiKey });
|
|
353
353
|
const prompt = `Frontend Guardian found this issue: "${issueTitle}". Detected: ${detected.slice(0, 500)}. Give a brief concrete fix suggestion in 1-2 sentences. No preamble.`;
|
|
354
354
|
const res = await ai.models.generateContent({ model: "gemini-1.5-flash", contents: prompt });
|
|
355
|
-
const
|
|
356
|
-
|
|
355
|
+
const r = res;
|
|
356
|
+
const text = typeof r?.text === "string" ? r.text : r?.candidates?.[0]?.content?.parts?.find((p) => typeof p?.text === "string")?.text ?? "";
|
|
357
|
+
return text.trim();
|
|
357
358
|
}
|
|
358
359
|
async function getSuggestFromBackend(issueTitle, detected) {
|
|
359
360
|
const url = process.env.FRONTEND_GUARDIAN_SUGGEST_URL || DEFAULT_SUGGEST_API;
|