@nebutra/next-unicorn-skill 1.0.0
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/CHANGELOG.md +57 -0
- package/LICENSE +21 -0
- package/README.md +316 -0
- package/SKILL.md +318 -0
- package/dist/analyzer/pattern-catalog.d.ts +35 -0
- package/dist/analyzer/pattern-catalog.d.ts.map +1 -0
- package/dist/analyzer/pattern-catalog.js +342 -0
- package/dist/analyzer/pattern-catalog.js.map +1 -0
- package/dist/analyzer/scanner.d.ts +33 -0
- package/dist/analyzer/scanner.d.ts.map +1 -0
- package/dist/analyzer/scanner.js +302 -0
- package/dist/analyzer/scanner.js.map +1 -0
- package/dist/auditor/ux-auditor.d.ts +26 -0
- package/dist/auditor/ux-auditor.d.ts.map +1 -0
- package/dist/auditor/ux-auditor.js +272 -0
- package/dist/auditor/ux-auditor.js.map +1 -0
- package/dist/checker/peer-dependency-checker.d.ts +62 -0
- package/dist/checker/peer-dependency-checker.d.ts.map +1 -0
- package/dist/checker/peer-dependency-checker.js +94 -0
- package/dist/checker/peer-dependency-checker.js.map +1 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +325 -0
- package/dist/index.js.map +1 -0
- package/dist/planner/migration-planner.d.ts +47 -0
- package/dist/planner/migration-planner.d.ts.map +1 -0
- package/dist/planner/migration-planner.js +144 -0
- package/dist/planner/migration-planner.js.map +1 -0
- package/dist/pr-creator/git-operations.d.ts +29 -0
- package/dist/pr-creator/git-operations.d.ts.map +1 -0
- package/dist/pr-creator/git-operations.js +10 -0
- package/dist/pr-creator/git-operations.js.map +1 -0
- package/dist/pr-creator/platform-client.d.ts +47 -0
- package/dist/pr-creator/platform-client.d.ts.map +1 -0
- package/dist/pr-creator/platform-client.js +9 -0
- package/dist/pr-creator/platform-client.js.map +1 -0
- package/dist/pr-creator/pr-description-builder.d.ts +23 -0
- package/dist/pr-creator/pr-description-builder.d.ts.map +1 -0
- package/dist/pr-creator/pr-description-builder.js +187 -0
- package/dist/pr-creator/pr-description-builder.js.map +1 -0
- package/dist/pr-creator/pr-executor.d.ts +30 -0
- package/dist/pr-creator/pr-executor.d.ts.map +1 -0
- package/dist/pr-creator/pr-executor.js +109 -0
- package/dist/pr-creator/pr-executor.js.map +1 -0
- package/dist/pr-creator/pr-strategy.d.ts +56 -0
- package/dist/pr-creator/pr-strategy.d.ts.map +1 -0
- package/dist/pr-creator/pr-strategy.js +125 -0
- package/dist/pr-creator/pr-strategy.js.map +1 -0
- package/dist/schemas/input.schema.d.ts +231 -0
- package/dist/schemas/input.schema.d.ts.map +1 -0
- package/dist/schemas/input.schema.js +159 -0
- package/dist/schemas/input.schema.js.map +1 -0
- package/dist/schemas/output.schema.d.ts +2543 -0
- package/dist/schemas/output.schema.d.ts.map +1 -0
- package/dist/schemas/output.schema.js +199 -0
- package/dist/schemas/output.schema.js.map +1 -0
- package/dist/scorer/impact-scorer.d.ts +45 -0
- package/dist/scorer/impact-scorer.d.ts.map +1 -0
- package/dist/scorer/impact-scorer.js +243 -0
- package/dist/scorer/impact-scorer.js.map +1 -0
- package/dist/security/osv-client.d.ts +72 -0
- package/dist/security/osv-client.d.ts.map +1 -0
- package/dist/security/osv-client.js +36 -0
- package/dist/security/osv-client.js.map +1 -0
- package/dist/security/vuln-report-builder.d.ts +18 -0
- package/dist/security/vuln-report-builder.d.ts.map +1 -0
- package/dist/security/vuln-report-builder.js +141 -0
- package/dist/security/vuln-report-builder.js.map +1 -0
- package/dist/security/vulnerability-scanner.d.ts +65 -0
- package/dist/security/vulnerability-scanner.d.ts.map +1 -0
- package/dist/security/vulnerability-scanner.js +140 -0
- package/dist/security/vulnerability-scanner.js.map +1 -0
- package/dist/updater/changelog-verifier.d.ts +29 -0
- package/dist/updater/changelog-verifier.d.ts.map +1 -0
- package/dist/updater/changelog-verifier.js +80 -0
- package/dist/updater/changelog-verifier.js.map +1 -0
- package/dist/updater/registry-client.d.ts +49 -0
- package/dist/updater/registry-client.d.ts.map +1 -0
- package/dist/updater/registry-client.js +10 -0
- package/dist/updater/registry-client.js.map +1 -0
- package/dist/updater/update-plan-builder.d.ts +23 -0
- package/dist/updater/update-plan-builder.d.ts.map +1 -0
- package/dist/updater/update-plan-builder.js +93 -0
- package/dist/updater/update-plan-builder.js.map +1 -0
- package/dist/updater/update-policy.d.ts +50 -0
- package/dist/updater/update-policy.d.ts.map +1 -0
- package/dist/updater/update-policy.js +118 -0
- package/dist/updater/update-policy.js.map +1 -0
- package/dist/updater/update-scorer.d.ts +51 -0
- package/dist/updater/update-scorer.d.ts.map +1 -0
- package/dist/updater/update-scorer.js +166 -0
- package/dist/updater/update-scorer.js.map +1 -0
- package/dist/utils/constraint-filter.d.ts +44 -0
- package/dist/utils/constraint-filter.d.ts.map +1 -0
- package/dist/utils/constraint-filter.js +69 -0
- package/dist/utils/constraint-filter.js.map +1 -0
- package/dist/utils/serializer.d.ts +17 -0
- package/dist/utils/serializer.d.ts.map +1 -0
- package/dist/utils/serializer.js +24 -0
- package/dist/utils/serializer.js.map +1 -0
- package/dist/utils/skill-parser.d.ts +29 -0
- package/dist/utils/skill-parser.d.ts.map +1 -0
- package/dist/utils/skill-parser.js +175 -0
- package/dist/utils/skill-parser.js.map +1 -0
- package/dist/verifier/context7.d.ts +48 -0
- package/dist/verifier/context7.d.ts.map +1 -0
- package/dist/verifier/context7.js +97 -0
- package/dist/verifier/context7.js.map +1 -0
- package/examples/backend-node/input.json +28 -0
- package/examples/backend-node/output.json +343 -0
- package/examples/frontend-nextjs/input.json +37 -0
- package/examples/frontend-nextjs/output.json +302 -0
- package/package.json +79 -0
- package/templates/deletion-checklist.md +42 -0
- package/templates/migration-plan.md +61 -0
- package/templates/prd-template.md +123 -0
- package/templates/summary-table.md +28 -0
- package/templates/update-plan.md +61 -0
- package/templates/vuln-report.md +50 -0
package/SKILL.md
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: analyze-and-recommend-third-party-optimizations
|
|
3
|
+
description: Scans any codebase and identifies where hand-rolled implementations should be replaced by battle-tested third-party libraries, producing structured migration plans with Context7-verified recommendations
|
|
4
|
+
version: 2.0.0
|
|
5
|
+
author: TsekaLuk
|
|
6
|
+
tags:
|
|
7
|
+
- code-analysis
|
|
8
|
+
- third-party-libraries
|
|
9
|
+
- migration-planning
|
|
10
|
+
- dependency-optimization
|
|
11
|
+
- context7-verification
|
|
12
|
+
- ux-audit
|
|
13
|
+
- impact-scoring
|
|
14
|
+
- vulnerability-scanning
|
|
15
|
+
- auto-update
|
|
16
|
+
- pr-automation
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# Analyze and Recommend Third-Party Optimizations
|
|
20
|
+
|
|
21
|
+
## Purpose
|
|
22
|
+
|
|
23
|
+
This SKILL scans a codebase to identify hand-rolled implementations that should be replaced by mature, battle-tested third-party libraries. It produces structured, actionable artifacts: comparison tables, 7-dimension impact scores, phased migration plans, deletion checklists, and UX completeness audits — all verified against real documentation via Context7 MCP.
|
|
24
|
+
|
|
25
|
+
## Prerequisites
|
|
26
|
+
|
|
27
|
+
- Node.js 18+ runtime
|
|
28
|
+
- Access to Context7 MCP service (for library verification)
|
|
29
|
+
- A valid `InputSchema` JSON describing the target project
|
|
30
|
+
|
|
31
|
+
## Standard Operating Procedure
|
|
32
|
+
|
|
33
|
+
### Step 1: Validate Input
|
|
34
|
+
|
|
35
|
+
Parse and validate the incoming `InputSchema` JSON using Zod schema validation. The input must include:
|
|
36
|
+
|
|
37
|
+
- **Project metadata**: repository path, languages, package managers, current libraries map
|
|
38
|
+
- **Optimization goals**: array of goals describing what the project wants to improve
|
|
39
|
+
- **Constraints**: license allowlist, excluded libraries, max dependency count
|
|
40
|
+
- **Priority focus areas**: Vibe Coding Domains to prioritize (i18n, seo, growth-hacking, ai-model-serving, agent-architecture, content-marketing, cross-border-ecommerce, observability, auth-security, ux-completeness)
|
|
41
|
+
- **Impact weights** (optional): custom weights for the 7 scoring dimensions
|
|
42
|
+
|
|
43
|
+
If validation fails, return a structured error response with field-level messages. Do not proceed.
|
|
44
|
+
|
|
45
|
+
### Step 2: Scan Codebase
|
|
46
|
+
|
|
47
|
+
Walk the project file tree and match source files against the pattern catalog. The scanner:
|
|
48
|
+
|
|
49
|
+
1. Detects workspace roots for monorepo support (package.json, pyproject.toml, etc.)
|
|
50
|
+
2. Scans each workspace independently
|
|
51
|
+
3. Matches code patterns against a catalog covering 10 Vibe Coding Domains
|
|
52
|
+
4. Records each detection with: file path, line range, pattern category, confidence score, suggested library, and domain tag
|
|
53
|
+
5. Skips unreadable files (binary, permissions) gracefully
|
|
54
|
+
|
|
55
|
+
### Step 3: Verify with Context7 MCP
|
|
56
|
+
|
|
57
|
+
For each detected recommendation, verify the suggested library against real, version-correct documentation:
|
|
58
|
+
|
|
59
|
+
1. Call `resolve-library-id` with the library name to obtain the canonical Context7 identifier
|
|
60
|
+
2. Call `get-library-docs` to retrieve version-specific documentation and confirm the use case
|
|
61
|
+
3. Set verification status:
|
|
62
|
+
- **verified** — Context7 confirmed the library and use case
|
|
63
|
+
- **unverified** — Context7 could not resolve the library identifier
|
|
64
|
+
- **unavailable** — Context7 service was unreachable (after one retry)
|
|
65
|
+
|
|
66
|
+
### Step 4: Score Impact
|
|
67
|
+
|
|
68
|
+
Compute a 7-dimension impact score for each recommendation:
|
|
69
|
+
|
|
70
|
+
| Dimension | Range |
|
|
71
|
+
|-----------|-------|
|
|
72
|
+
| Scalability | 1–10 |
|
|
73
|
+
| Performance | 1–10 |
|
|
74
|
+
| Security | 1–10 |
|
|
75
|
+
| Maintainability | 1–10 |
|
|
76
|
+
| Feature Richness | 1–10 |
|
|
77
|
+
| UX | 1–10 |
|
|
78
|
+
| UI Aesthetics | 1–10 |
|
|
79
|
+
|
|
80
|
+
- Compute a **composite score** as the weighted average of all dimensions
|
|
81
|
+
- Apply a **1.2× priority boost** (capped at 10) for recommendations in priority focus areas
|
|
82
|
+
- Assign **migration risk** (low / medium / high) and **estimated effort** in developer-hours
|
|
83
|
+
|
|
84
|
+
### Step 5: Build Migration Plan
|
|
85
|
+
|
|
86
|
+
Group recommendations into ordered phases based on risk:
|
|
87
|
+
|
|
88
|
+
1. **Phase 1** — Low-risk changes (quick wins)
|
|
89
|
+
2. **Phase 2** — Medium-risk changes (moderate refactoring)
|
|
90
|
+
3. **Phase 3** — High-risk changes (require adapter strategies)
|
|
91
|
+
|
|
92
|
+
For high-risk items, generate an **Adapter Strategy** specifying:
|
|
93
|
+
- Wrapper interface
|
|
94
|
+
- Legacy code being wrapped
|
|
95
|
+
- Target library to transition to
|
|
96
|
+
|
|
97
|
+
Build a **deletion checklist** listing every file and code range to remove after migration, with estimated lines saved.
|
|
98
|
+
|
|
99
|
+
### Step 6: Audit UX Completeness
|
|
100
|
+
|
|
101
|
+
Evaluate the frontend codebase across 8 UX categories:
|
|
102
|
+
|
|
103
|
+
1. **Accessibility (A11y)** — ARIA attributes, semantic HTML, keyboard navigation
|
|
104
|
+
2. **Error states** — Error boundaries, error messages, fallback UI
|
|
105
|
+
3. **Empty states** — Empty data placeholders, zero-state illustrations
|
|
106
|
+
4. **Loading states** — Skeletons, spinners, suspense boundaries
|
|
107
|
+
5. **Form validation** — Client-side validation, error messages, field states
|
|
108
|
+
6. **Performance feel** — Optimistic updates, transitions, lazy loading
|
|
109
|
+
7. **Copy consistency** — i18n usage, consistent terminology
|
|
110
|
+
8. **Design system alignment** — Component library usage, token adherence
|
|
111
|
+
|
|
112
|
+
For each gap found, map it to a recommended library with a rationale.
|
|
113
|
+
|
|
114
|
+
### Step 7: Apply Constraints and Serialize
|
|
115
|
+
|
|
116
|
+
1. **Dependency conflict detection** — Flag conflicts with existing libraries, set migration risk to high
|
|
117
|
+
2. **License filtering** — Exclude recommendations whose library license is not in the allowlist
|
|
118
|
+
3. **Serialize** the final `OutputSchema` to pretty-printed JSON (2-space indent) with round-trip guarantee
|
|
119
|
+
|
|
120
|
+
### Step 8: Vulnerability Scanning (Optional)
|
|
121
|
+
|
|
122
|
+
Scan both current and recommended dependencies for known security vulnerabilities:
|
|
123
|
+
|
|
124
|
+
1. Query the **OSV** (Open Source Vulnerabilities) database via injected `VulnerabilityClient`
|
|
125
|
+
2. Scan **current dependencies** for known CVEs and advisories
|
|
126
|
+
3. Scan **recommended replacement libraries** to prevent "upgrade into a vulnerability" scenarios
|
|
127
|
+
4. Filter findings by `minimumSeverity` threshold (critical > high > medium > low)
|
|
128
|
+
5. Compute summary: total scanned, count by severity, fixable vs unfixable
|
|
129
|
+
6. Generate SARIF output for CI/CD integration (GitHub Code Scanning)
|
|
130
|
+
|
|
131
|
+
If the OSV service is unavailable, set `serviceUnavailable: true` and continue the pipeline.
|
|
132
|
+
|
|
133
|
+
### Step 9: Auto-Update Existing Dependencies (Optional)
|
|
134
|
+
|
|
135
|
+
Analyze all existing dependencies and recommend version upgrades:
|
|
136
|
+
|
|
137
|
+
1. Query package registries (npm, PyPI, crates.io, Go) via injected `RegistryClient`
|
|
138
|
+
2. Apply configurable **update policy**: patch/minor/major strategy, pinned packages, min-age window
|
|
139
|
+
3. Verify changelogs via **Context7 MCP** to detect breaking changes, new features, deprecations
|
|
140
|
+
4. Score each update using the same **7-dimension impact model**
|
|
141
|
+
5. Classify urgency: critical (fixes CVE), urgent (deprecated), recommended (new features), routine
|
|
142
|
+
6. Group related packages (e.g. all `@babel/*` together)
|
|
143
|
+
7. Build structured update plan with summary statistics
|
|
144
|
+
|
|
145
|
+
If the registry is unavailable, skip the update plan silently.
|
|
146
|
+
|
|
147
|
+
### Step 10: PR Auto-Creation (Optional)
|
|
148
|
+
|
|
149
|
+
Automatically create GitHub/GitLab pull requests for updates and migrations:
|
|
150
|
+
|
|
151
|
+
1. **Plan PRs** — Security fixes as separate PRs, grouped updates, migration PRs by phase
|
|
152
|
+
2. **Generate code changes** — Update version in manifest files, scaffold adapter code for migrations
|
|
153
|
+
3. **Build PR descriptions** — Rich markdown with impact tables, vulnerability details, reviewer checklist
|
|
154
|
+
4. **Create branches and PRs** — Via injected `PlatformClient` and `GitOperations`
|
|
155
|
+
5. **Deduplicate** — Update existing PRs instead of creating duplicates
|
|
156
|
+
6. **Enforce limits** — Respect `maxOpenPRs`, prioritize security fixes first
|
|
157
|
+
|
|
158
|
+
PR titles follow conventional commit format: `fix(deps):`, `chore(deps):`, `refactor(domain):`.
|
|
159
|
+
|
|
160
|
+
## Output Artifacts
|
|
161
|
+
|
|
162
|
+
The SKILL produces a single `OutputSchema` JSON containing:
|
|
163
|
+
|
|
164
|
+
- `recommendedChanges` — Array of recommendations with impact scores, verification status, and adapter strategies
|
|
165
|
+
- `filesToDelete` — Array of file paths to remove after migration
|
|
166
|
+
- `linesSavedEstimate` — Total lines of code saved
|
|
167
|
+
- `uxAudit` — Structured UX completeness checklist
|
|
168
|
+
- `migrationPlan` — Phased plan with deletion checklist
|
|
169
|
+
- `vulnerabilityReport` (optional) — Vulnerability findings, summary, SARIF output
|
|
170
|
+
- `updatePlan` (optional) — Scored dependency updates with groups and summary
|
|
171
|
+
- `pullRequests` (optional) — Created/updated PR results with status summary
|
|
172
|
+
|
|
173
|
+
## Usage
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# Run the analysis
|
|
177
|
+
npx tsx src/index.ts < input.json > output.json
|
|
178
|
+
|
|
179
|
+
# Or import programmatically
|
|
180
|
+
import { analyze } from './src/index.js';
|
|
181
|
+
|
|
182
|
+
const result = await analyze({
|
|
183
|
+
input: inputJson,
|
|
184
|
+
context7Client: myContext7Client,
|
|
185
|
+
// Phase 2 optional clients:
|
|
186
|
+
vulnClient: myOsvClient, // enables vulnerability scanning
|
|
187
|
+
registryClient: myRegistryClient, // enables auto-update
|
|
188
|
+
platformClient: myGitHubClient, // enables PR creation
|
|
189
|
+
gitOps: myGitOperations, // enables PR creation
|
|
190
|
+
});
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Vibe Coding Domain Coverage (68 domains, ISO 25010-aligned)
|
|
194
|
+
|
|
195
|
+
Domains are NOT "tech stack" labels — they are problem areas most likely to be hand-rolled where mature libraries should be preferred. Organized by ISO 25010 quality characteristics.
|
|
196
|
+
|
|
197
|
+
### A. UX Completeness & Design System (Usability / UI quality)
|
|
198
|
+
|
|
199
|
+
| Domain | Examples |
|
|
200
|
+
|--------|----------|
|
|
201
|
+
| ux-completeness | radix-ui, react-aria, framer-motion |
|
|
202
|
+
| ui-aesthetics | tailwindcss, class-variance-authority |
|
|
203
|
+
| design-system | @radix-ui/themes, @chakra-ui/react |
|
|
204
|
+
| theming-dark-mode | next-themes, tailwindcss dark mode |
|
|
205
|
+
| a11y-accessibility | react-aria, axe-core, eslint-plugin-jsx-a11y |
|
|
206
|
+
| responsive-mobile-ux | tailwindcss, react-responsive |
|
|
207
|
+
| empty-loading-error-states | react-loading-skeleton, react-error-boundary |
|
|
208
|
+
| forms-ux | react-hook-form, formik |
|
|
209
|
+
| validation-feedback | zod, yup, vest |
|
|
210
|
+
| navigation-information-architecture | next/navigation, react-router |
|
|
211
|
+
| notifications-inapp | sonner, react-hot-toast |
|
|
212
|
+
| tables-data-grid-ux | @tanstack/react-table, ag-grid |
|
|
213
|
+
| filters-sort-search-ux | @tanstack/react-table, fuse.js |
|
|
214
|
+
| onboarding-guided-tour | react-joyride, shepherd.js |
|
|
215
|
+
|
|
216
|
+
### B. SEO / i18n / Content (Discoverability / Global-ready)
|
|
217
|
+
|
|
218
|
+
| Domain | Examples |
|
|
219
|
+
|--------|----------|
|
|
220
|
+
| seo | next-seo, schema-dts, next-sitemap |
|
|
221
|
+
| i18n | next-intl, react-i18next, FormatJS |
|
|
222
|
+
| localization-ux | @formatjs/intl, date-fns/locale |
|
|
223
|
+
| content-marketing | contentlayer, next-mdx-remote, sanity |
|
|
224
|
+
| landing-page-conversion | next-seo, posthog, ab-testing libs |
|
|
225
|
+
|
|
226
|
+
### C. Growth & Data (Experimentation / Analytics)
|
|
227
|
+
|
|
228
|
+
| Domain | Examples |
|
|
229
|
+
|--------|----------|
|
|
230
|
+
| growth-hacking | posthog, launchdarkly, mixpanel |
|
|
231
|
+
| analytics-tracking | posthog-js, segment, plausible |
|
|
232
|
+
| attribution-measurement | segment, mixpanel |
|
|
233
|
+
| ab-testing-experimentation | posthog, growthbook, statsig |
|
|
234
|
+
| product-led-growth | posthog, canny, intercom |
|
|
235
|
+
| retention-lifecycle-crm | customer.io, braze |
|
|
236
|
+
| referrals-virality | referral-saasquatch |
|
|
237
|
+
|
|
238
|
+
### D. App / Frontend Architecture (Maintainability / Modularity)
|
|
239
|
+
|
|
240
|
+
| Domain | Examples |
|
|
241
|
+
|--------|----------|
|
|
242
|
+
| agent-architecture | @modelcontextprotocol/sdk, ai (Vercel AI SDK) |
|
|
243
|
+
| frontend-architecture | next.js, remix, vite |
|
|
244
|
+
| state-management | zustand, jotai, @tanstack/react-query |
|
|
245
|
+
| data-fetching-caching | @tanstack/react-query, swr, apollo-client |
|
|
246
|
+
| error-handling-resilience | react-error-boundary, neverthrow |
|
|
247
|
+
| realtime-collaboration | yjs, liveblocks, socket.io |
|
|
248
|
+
| file-upload-media | uploadthing, tus-js-client |
|
|
249
|
+
| search-discovery | meilisearch, typesense, algolia |
|
|
250
|
+
|
|
251
|
+
### E. Backend / Platform (Scalability / Reliability / Compatibility)
|
|
252
|
+
|
|
253
|
+
| Domain | Examples |
|
|
254
|
+
|--------|----------|
|
|
255
|
+
| api-design-contracts | openapi, trpc, graphql-codegen |
|
|
256
|
+
| backend-architecture | fastify, hono, nestjs |
|
|
257
|
+
| database-orm-migrations | prisma, drizzle, knex |
|
|
258
|
+
| caching-rate-limit | rate-limiter-flexible, ioredis |
|
|
259
|
+
| jobs-queue-scheduler | bullmq, temporal, inngest |
|
|
260
|
+
| webhooks-integrations | svix, hookdeck |
|
|
261
|
+
| feature-flags-config | unleash, launchdarkly, growthbook |
|
|
262
|
+
| multi-tenancy-saas | @clerk/nextjs, auth0 |
|
|
263
|
+
|
|
264
|
+
### F. Security / Compliance (Security)
|
|
265
|
+
|
|
266
|
+
| Domain | Examples |
|
|
267
|
+
|--------|----------|
|
|
268
|
+
| auth-security | next-auth, passport, jose |
|
|
269
|
+
| permissions-rbac-ux | casl, casbin |
|
|
270
|
+
| security-hardening | helmet, csp-header |
|
|
271
|
+
| privacy-compliance | consent-manager, cookie-consent |
|
|
272
|
+
| fraud-abuse-prevention | arcjet, cloudflare turnstile |
|
|
273
|
+
|
|
274
|
+
### G. Observability / Ops (Reliability / Operability)
|
|
275
|
+
|
|
276
|
+
| Domain | Examples |
|
|
277
|
+
|--------|----------|
|
|
278
|
+
| observability | pino, opentelemetry, sentry |
|
|
279
|
+
| logging-tracing-metrics | pino, @opentelemetry/sdk-node |
|
|
280
|
+
| error-monitoring | @sentry/node, bugsnag |
|
|
281
|
+
| alerting-incident-response | pagerduty, opsgenie |
|
|
282
|
+
|
|
283
|
+
### H. Delivery / Quality / DevEx (Maintainability / DevEx)
|
|
284
|
+
|
|
285
|
+
| Domain | Examples |
|
|
286
|
+
|--------|----------|
|
|
287
|
+
| testing-strategy | vitest, playwright, fast-check |
|
|
288
|
+
| ci-cd-release | changesets, semantic-release |
|
|
289
|
+
| devex-tooling | turborepo, nx, biome |
|
|
290
|
+
| documentation-sop | typedoc, storybook, mintlify |
|
|
291
|
+
| code-quality-linting | eslint, biome, prettier |
|
|
292
|
+
| dependency-management | renovate, depcheck |
|
|
293
|
+
|
|
294
|
+
### I. Performance / Cost (Performance efficiency)
|
|
295
|
+
|
|
296
|
+
| Domain | Examples |
|
|
297
|
+
|--------|----------|
|
|
298
|
+
| performance-web-vitals | @next/bundle-analyzer, lighthouse |
|
|
299
|
+
| backend-performance | autocannon, clinic.js |
|
|
300
|
+
| cost-optimization | aws-cost-explorer, infracost |
|
|
301
|
+
|
|
302
|
+
### J. AI Engineering
|
|
303
|
+
|
|
304
|
+
| Domain | Examples |
|
|
305
|
+
|--------|----------|
|
|
306
|
+
| ai-model-serving | transformers.js, onnxruntime, langchain |
|
|
307
|
+
| ai-evaluation-observability | langfuse, promptfoo |
|
|
308
|
+
| rag-vector-search | @pinecone-database/pinecone, chromadb |
|
|
309
|
+
|
|
310
|
+
### K. Business Domains (optional)
|
|
311
|
+
|
|
312
|
+
| Domain | Examples |
|
|
313
|
+
|--------|----------|
|
|
314
|
+
| cross-border-ecommerce | stripe, shopify-api, taxjar |
|
|
315
|
+
| payments-billing | stripe, lemon-squeezy |
|
|
316
|
+
| marketplace-platform | medusa, saleor |
|
|
317
|
+
|
|
318
|
+
> **Extensibility:** The enum covers official domains. Use `customDomains?: string[]` in the input schema for community/project-specific domains without breaking the type system.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { VibeCodingDomain } from '../schemas/input.schema.js';
|
|
2
|
+
/**
|
|
3
|
+
* Defines a pattern that identifies hand-rolled code which could be
|
|
4
|
+
* replaced by a battle-tested third-party library.
|
|
5
|
+
*/
|
|
6
|
+
export interface PatternDefinition {
|
|
7
|
+
/** Unique identifier for this pattern (e.g., "i18n-manual-pluralization") */
|
|
8
|
+
id: string;
|
|
9
|
+
/** The Vibe Coding domain this pattern belongs to */
|
|
10
|
+
domain: VibeCodingDomain;
|
|
11
|
+
/** Human-readable description of what this pattern detects */
|
|
12
|
+
description: string;
|
|
13
|
+
/** Glob patterns for files to scan */
|
|
14
|
+
filePatterns: string[];
|
|
15
|
+
/** Regex patterns to match hand-rolled code */
|
|
16
|
+
codePatterns: RegExp[];
|
|
17
|
+
/** The library recommended to replace the hand-rolled code */
|
|
18
|
+
suggestedLibrary: string;
|
|
19
|
+
/** Recommended version of the suggested library */
|
|
20
|
+
suggestedVersion: string;
|
|
21
|
+
/** SPDX license identifier of the suggested library */
|
|
22
|
+
license: string;
|
|
23
|
+
/** Base confidence score for this pattern (0–1) */
|
|
24
|
+
confidenceBase: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Returns the full pattern catalog covering all Vibe Coding domains.
|
|
28
|
+
* Each domain has at least 1–2 patterns.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getPatternCatalog(): PatternDefinition[];
|
|
31
|
+
/**
|
|
32
|
+
* Returns patterns filtered to a specific Vibe Coding domain.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getPatternsForDomain(domain: string): PatternDefinition[];
|
|
35
|
+
//# sourceMappingURL=pattern-catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pattern-catalog.d.ts","sourceRoot":"","sources":["../../src/analyzer/pattern-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,6EAA6E;IAC7E,EAAE,EAAE,MAAM,CAAC;IACX,qDAAqD;IACrD,MAAM,EAAE,gBAAgB,CAAC;IACzB,8DAA8D;IAC9D,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,+CAA+C;IAC/C,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,8DAA8D;IAC9D,gBAAgB,EAAE,MAAM,CAAC;IACzB,mDAAmD;IACnD,gBAAgB,EAAE,MAAM,CAAC;IACzB,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,iBAAiB,EAAE,CAmVvD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAExE"}
|