@nebutra/next-unicorn-skill 2.0.0 → 2.1.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 +113 -0
- package/README.md +210 -46
- package/README.zh-CN.md +480 -0
- package/SKILL.md +132 -261
- package/dist/analyzer/code-organization-analyzer.d.ts +20 -0
- package/dist/analyzer/code-organization-analyzer.d.ts.map +1 -0
- package/dist/analyzer/code-organization-analyzer.js +389 -0
- package/dist/analyzer/code-organization-analyzer.js.map +1 -0
- package/dist/analyzer/pattern-catalog.d.ts +14 -8
- package/dist/analyzer/pattern-catalog.d.ts.map +1 -1
- package/dist/analyzer/pattern-catalog.js +515 -172
- package/dist/analyzer/pattern-catalog.js.map +1 -1
- package/dist/analyzer/scanner.d.ts +2 -21
- package/dist/analyzer/scanner.d.ts.map +1 -1
- package/dist/analyzer/scanner.js +98 -62
- package/dist/analyzer/scanner.js.map +1 -1
- package/dist/analyzer/structure-analyzer.d.ts +16 -0
- package/dist/analyzer/structure-analyzer.d.ts.map +1 -0
- package/dist/analyzer/structure-analyzer.js +228 -0
- package/dist/analyzer/structure-analyzer.js.map +1 -0
- package/dist/analyzer/types.d.ts +80 -0
- package/dist/analyzer/types.d.ts.map +1 -0
- package/dist/analyzer/types.js +11 -0
- package/dist/analyzer/types.js.map +1 -0
- package/dist/index.d.ts +14 -68
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -314
- package/dist/index.js.map +1 -1
- package/dist/orchestrator.d.ts +94 -0
- package/dist/orchestrator.d.ts.map +1 -0
- package/dist/orchestrator.js +351 -0
- package/dist/orchestrator.js.map +1 -0
- package/dist/pr-creator/pr-executor.d.ts +2 -0
- package/dist/pr-creator/pr-executor.d.ts.map +1 -1
- package/dist/pr-creator/pr-executor.js +26 -1
- package/dist/pr-creator/pr-executor.js.map +1 -1
- package/dist/schemas/input.schema.d.ts +4 -4
- package/dist/schemas/input.schema.d.ts.map +1 -1
- package/dist/schemas/input.schema.js +1 -0
- package/dist/schemas/input.schema.js.map +1 -1
- package/dist/schemas/output.schema.d.ts +557 -104
- package/dist/schemas/output.schema.d.ts.map +1 -1
- package/dist/schemas/output.schema.js +49 -3
- package/dist/schemas/output.schema.js.map +1 -1
- package/dist/verifier/context7.d.ts +39 -14
- package/dist/verifier/context7.d.ts.map +1 -1
- package/dist/verifier/context7.js +72 -40
- package/dist/verifier/context7.js.map +1 -1
- package/examples/backend-node/output.json +6 -6
- package/examples/frontend-nextjs/output.json +5 -5
- package/package.json +5 -6
- package/templates/prd-template.md +3 -3
- package/templates/summary-table.md +34 -2
- package/templates/update-plan.md +3 -3
- package/dist/auditor/ux-auditor.d.ts +0 -26
- package/dist/auditor/ux-auditor.d.ts.map +0 -1
- package/dist/auditor/ux-auditor.js +0 -272
- package/dist/auditor/ux-auditor.js.map +0 -1
- package/dist/planner/migration-planner.d.ts +0 -47
- package/dist/planner/migration-planner.d.ts.map +0 -1
- package/dist/planner/migration-planner.js +0 -144
- package/dist/planner/migration-planner.js.map +0 -1
- package/dist/pr-creator/pr-description-builder.d.ts +0 -23
- package/dist/pr-creator/pr-description-builder.d.ts.map +0 -1
- package/dist/pr-creator/pr-description-builder.js +0 -187
- package/dist/pr-creator/pr-description-builder.js.map +0 -1
- package/dist/scorer/impact-scorer.d.ts +0 -45
- package/dist/scorer/impact-scorer.d.ts.map +0 -1
- package/dist/scorer/impact-scorer.js +0 -243
- package/dist/scorer/impact-scorer.js.map +0 -1
- package/dist/security/vuln-report-builder.d.ts +0 -18
- package/dist/security/vuln-report-builder.d.ts.map +0 -1
- package/dist/security/vuln-report-builder.js +0 -141
- package/dist/security/vuln-report-builder.js.map +0 -1
- package/dist/updater/changelog-verifier.d.ts +0 -29
- package/dist/updater/changelog-verifier.d.ts.map +0 -1
- package/dist/updater/changelog-verifier.js +0 -80
- package/dist/updater/changelog-verifier.js.map +0 -1
- package/dist/updater/update-plan-builder.d.ts +0 -23
- package/dist/updater/update-plan-builder.d.ts.map +0 -1
- package/dist/updater/update-plan-builder.js +0 -93
- package/dist/updater/update-plan-builder.js.map +0 -1
- package/dist/updater/update-scorer.d.ts +0 -51
- package/dist/updater/update-scorer.d.ts.map +0 -1
- package/dist/updater/update-scorer.js +0 -166
- package/dist/updater/update-scorer.js.map +0 -1
- package/dist/utils/constraint-filter.d.ts +0 -44
- package/dist/utils/constraint-filter.d.ts.map +0 -1
- package/dist/utils/constraint-filter.js +0 -69
- package/dist/utils/constraint-filter.js.map +0 -1
- package/dist/utils/serializer.d.ts +0 -17
- package/dist/utils/serializer.d.ts.map +0 -1
- package/dist/utils/serializer.js +0 -24
- package/dist/utils/serializer.js.map +0 -1
- package/dist/utils/skill-parser.d.ts +0 -29
- package/dist/utils/skill-parser.d.ts.map +0 -1
- package/dist/utils/skill-parser.js +0 -175
- package/dist/utils/skill-parser.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,119 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.1.0] - 2026-02-09
|
|
9
|
+
|
|
10
|
+
### Breaking Changes
|
|
11
|
+
|
|
12
|
+
- **`estimatedEffort` → `affectedFiles`** — replaced "developer-hours" estimation with concrete file count across all schemas, templates, and examples. AI programming has no concept of "effort hours". The field type changed from `number` (positive float) to `number` (non-negative integer).
|
|
13
|
+
- **`estimatedTotalEffort` → `totalAffectedFiles`** — same change in `UpdatePlan.summary`.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **`src/analyzer/types.ts`** — shared type definitions extracted to break circular dependencies (scanner ↔ structure-analyzer ↔ code-organization-analyzer). Zero circular deps confirmed via `madge --circular`.
|
|
18
|
+
- **`src/orchestrator.ts`** — analysis pipeline extracted from index.ts. Entry point reduced from 517 lines to 65 lines (pure re-exports).
|
|
19
|
+
- **CI circular dependency check** — `npx madge --circular` added to CI pipeline (zero new devDependencies).
|
|
20
|
+
- **Language constraint** — SKILL.md output language now matches user's input language.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- `index.ts` is now a pure re-export surface — all orchestration logic lives in `orchestrator.ts`
|
|
25
|
+
- All templates updated: "Effort (hrs)" columns → "Files" columns
|
|
26
|
+
- All example outputs updated to use `affectedFiles` field name
|
|
27
|
+
- `RecommendedChange.affectedFiles` is now `z.number().int().nonnegative()` (was `z.number().positive()`)
|
|
28
|
+
- `UpdateItem.affectedFiles` same type change
|
|
29
|
+
|
|
30
|
+
## [1.0.8] - 2026-02-09
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- **Human-in-the-loop Gate Protocol** — 4 explicit decision gates at irreversible, preference-driven, or costly decision points:
|
|
35
|
+
- Gate 1: Triage detections before Context7 verification (saves quota)
|
|
36
|
+
- Gate 2: Code organization preferences with SWOT analysis (team preferences)
|
|
37
|
+
- Gate 3: Accept/reject/defer recommendations (migration cost decisions)
|
|
38
|
+
- Gate 4: Confirm before PR creation and file migration (irreversible actions)
|
|
39
|
+
- New `references/code-organization-workflow.md` — progressive disclosure reference with Gate examples, Phase A/B decision tree, and worked examples
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- SKILL.md refactored from 400 to 188 lines — verbose Gate/code-org examples extracted to references/ per progressive disclosure spec
|
|
44
|
+
- Removed stale `org-mixed-export-style` reference from Phase A (pattern was moved to structural analyzer)
|
|
45
|
+
- Gate Protocol compressed from 35 lines to 8 lines (meta-info)
|
|
46
|
+
- All instructions converted to imperative voice per skill spec
|
|
47
|
+
|
|
48
|
+
## [1.0.7] - 2026-02-09
|
|
49
|
+
|
|
50
|
+
### Added
|
|
51
|
+
|
|
52
|
+
- **Code Organization Analysis** — new deterministic module that detects structural code organization issues via filesystem traversal. Claude cannot infer these from knowledge alone.
|
|
53
|
+
- `god-directory` — directory with >15 source files (should split by feature/domain)
|
|
54
|
+
- `mixed-naming-convention` — files in same directory using different naming styles
|
|
55
|
+
- `deep-nesting` — directory tree exceeding 5 levels from `src/`
|
|
56
|
+
- `barrel-bloat` — index file with >10 re-exports
|
|
57
|
+
- `catch-all-directory` — `utils/helpers/shared/common/lib` with >10 files
|
|
58
|
+
- `circular-dependency` — import cycles detected via DFS graph traversal
|
|
59
|
+
- `mixed-export-style` — files mixing default export with 3+ named exports
|
|
60
|
+
- 3 new scanner patterns in `code-organization` domain:
|
|
61
|
+
- `org-deep-relative-import` — imports traversing 3+ parent directories
|
|
62
|
+
- `org-barrel-reexport-wildcard` — `export * from` in index files
|
|
63
|
+
- `org-catch-all-utils-import` — imports from catch-all utils/helpers directories
|
|
64
|
+
- New `code-organization` domain in `VibeCodingDomain` enum (69 total domains)
|
|
65
|
+
- New `codeOrganizationStats` field in `ScanResult` (file counts, naming conventions, circular dep count)
|
|
66
|
+
- New `analyzeCodeOrganization()` standalone export for programmatic use
|
|
67
|
+
- SKILL.md Step 2.7 with Phase A (deterministic) / Phase B (generative) dual-phase design, MUST/MUST NOT decision table, 3 concrete examples, and skip rules
|
|
68
|
+
- 29 new tests (176 total) covering all scanner patterns and structural analysis rules
|
|
69
|
+
|
|
70
|
+
### Changed
|
|
71
|
+
|
|
72
|
+
- `StructuralFinding.type` extended with 6 new code organization types + optional `metadata` field
|
|
73
|
+
- Code organization analysis runs for ALL projects (not just monorepos, unlike design system analysis)
|
|
74
|
+
- Architecture diagram in SKILL.md updated to reflect two-track scanner (regex + filesystem)
|
|
75
|
+
- Scanner step description expanded to list all `ScanResult` fields explicitly
|
|
76
|
+
|
|
77
|
+
## [1.0.3] - 2026-02-09
|
|
78
|
+
|
|
79
|
+
### Added
|
|
80
|
+
|
|
81
|
+
- **Gap Analysis** — AI agent can now identify capabilities the project is MISSING entirely, not just hand-rolled code to replace. New `GapRecommendation` type with `domain`, `description`, `recommendedLibrary`, and `priority` (critical/recommended/nice-to-have).
|
|
82
|
+
- New `gaps` option in `AnalyzeOptions` — AI agent provides gap recommendations alongside scanner-based detections.
|
|
83
|
+
- New `gapAnalysis` field in `OutputSchema` — gap recommendations appear in the output alongside `recommendedChanges`.
|
|
84
|
+
- New `GapRecommendationSchema` Zod schema with full validation.
|
|
85
|
+
- SKILL.md Step 2.5: Gap Analysis guidance for AI agents.
|
|
86
|
+
- 3 new gap analysis tests (202 total).
|
|
87
|
+
|
|
88
|
+
### Changed
|
|
89
|
+
|
|
90
|
+
- `LibraryRecommendation` enriched with optional `rationale`, `ecosystem`, `antiPatterns`, `alternatives` fields — AI agent can express ecosystem-level solutions (e.g., Lingui + TMS + compile-time extraction).
|
|
91
|
+
- `RecommendedChange.recommendedLibrary` output schema widened to match enriched `LibraryRecommendation`.
|
|
92
|
+
- SKILL.md Step 3 renamed "Recommend Solutions" — guides AI agent to think at ecosystem level.
|
|
93
|
+
- Summary table template updated to render rationale, ecosystem, anti-patterns, and alternatives.
|
|
94
|
+
- README updated with gap analysis, ecosystem recommendations features and API docs.
|
|
95
|
+
|
|
96
|
+
## [1.0.1] - 2026-02-09
|
|
97
|
+
|
|
98
|
+
### Changed
|
|
99
|
+
|
|
100
|
+
- **Architecture: Decouple detection from recommendation** — The pattern catalog no longer contains hardcoded library names, versions, licenses, best practices, or alternatives. Library recommendations are now provided dynamically by the caller via the `Recommender` callback, enabling AI agents to leverage their generalization ability and Context7 MCP for real-time, context-aware recommendations.
|
|
101
|
+
- **New `Recommender` type** — `analyze()` now requires a `recommender: (detection) => LibraryRecommendation | null` callback. Return `null` to skip false positives.
|
|
102
|
+
- **New `scanCodebase()` export** — Standalone scanner for AI agents to inspect detections before providing recommendations.
|
|
103
|
+
- **UX Auditor decoupled** — `recommendedLibrary` is no longer hardcoded per category; the auditor reports status (present/partial/missing) with factual rationale, leaving library choice to the AI agent.
|
|
104
|
+
- **Impact Scorer decoupled** — Removed 200+ line `DOMAIN_DIMENSION_AFFINITY` mapping and `DOMAIN_BASE_EFFORT` table. Scoring uses confidence-based defaults with optional `dimensionHints` and `baseEffortHours` overrides from the AI agent.
|
|
105
|
+
- **Migration Planner decoupled** — Removed `DOMAIN_MIGRATION_PRIORITY` mapping. Sorting within each risk phase uses file co-location + composite score. AI agents can influence ordering via scoring.
|
|
106
|
+
- **`Detection` type simplified** — Removed `suggestedLibrary` field. Detections now contain only what was detected (file, line range, pattern, confidence, domain).
|
|
107
|
+
- **`VerificationItem` type added** — `verifyAllRecommendations()` now accepts `Array<VerificationItem | null>` instead of `Detection[]`, decoupling verification from scanner output.
|
|
108
|
+
- **`AnalyzeResult` includes `scanResult`** — Success results now include raw `ScanResult` for AI agent further analysis.
|
|
109
|
+
- Pattern catalog reduced from 880 to 370 lines (detection-only, no recommendation data)
|
|
110
|
+
- SKILL.md rewritten to 150 lines following Anthropic SKILL spec principles (concise, high freedom for recommendations)
|
|
111
|
+
- Test count increased from 191 to 198
|
|
112
|
+
|
|
113
|
+
### Removed
|
|
114
|
+
|
|
115
|
+
- All hardcoded library recommendations from `PatternDefinition` (`suggestedLibrary`, `suggestedVersion`, `license`, `bestPractice`, `alternatives`)
|
|
116
|
+
- All hardcoded UX audit library recommendations and rationale strings
|
|
117
|
+
- `DOMAIN_DIMENSION_AFFINITY` (68-domain × 7-dimension static mapping)
|
|
118
|
+
- `DOMAIN_BASE_EFFORT` (25-domain effort estimate table)
|
|
119
|
+
- `DOMAIN_MIGRATION_PRIORITY` (domain tier ordering)
|
|
120
|
+
|
|
8
121
|
## [2.0.0] - 2026-02-08
|
|
9
122
|
|
|
10
123
|
### Added
|
package/README.md
CHANGED
|
@@ -7,14 +7,21 @@
|
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
|
-
<a href="https://
|
|
10
|
+
<a href="https://smithery.ai/skills/nebutra/next-unicorn-skill"><img src="https://img.shields.io/badge/Smithery-Next--Unicorn-orange.svg" alt="Smithery" /></a>
|
|
11
|
+
<a href="https://github.com/Nebutra/Next-Unicorn-Skill/actions/workflows/ci.yml"><img src="https://github.com/Nebutra/Next-Unicorn-Skill/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
|
|
11
12
|
<a href="https://www.npmjs.com/package/@nebutra/next-unicorn-skill"><img src="https://img.shields.io/npm/v/@nebutra/next-unicorn-skill.svg?color=blue" alt="npm version" /></a>
|
|
13
|
+
<a href="https://www.npmjs.com/package/@nebutra/next-unicorn-skill"><img src="https://img.shields.io/npm/dm/@nebutra/next-unicorn-skill.svg?color=green" alt="npm downloads" /></a>
|
|
14
|
+
<a href="https://github.com/Nebutra/Next-Unicorn-Skill/stargazers"><img src="https://img.shields.io/github/stars/Nebutra/Next-Unicorn-Skill.svg?style=social" alt="GitHub Stars" /></a>
|
|
12
15
|
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License" /></a>
|
|
13
16
|
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-strict-blue.svg" alt="TypeScript" /></a>
|
|
14
|
-
<a href="./tests/"><img src="https://img.shields.io/badge/tests-
|
|
17
|
+
<a href="./tests/"><img src="https://img.shields.io/badge/tests-176%20passed-brightgreen.svg" alt="Tests" /></a>
|
|
15
18
|
<a href="./tests/"><img src="https://img.shields.io/badge/properties-29%20verified-purple.svg" alt="Property Tests" /></a>
|
|
16
19
|
</p>
|
|
17
20
|
|
|
21
|
+
<p align="center">
|
|
22
|
+
<b>English</b> | <a href="./README.zh-CN.md">简体中文</a>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
18
25
|
<p align="center">
|
|
19
26
|
<a href="#quick-start">Quick Start</a> •
|
|
20
27
|
<a href="#features">Features</a> •
|
|
@@ -31,25 +38,72 @@
|
|
|
31
38
|
|
|
32
39
|
Every codebase accumulates hand-rolled implementations that should be mature libraries. Custom date formatters, DIY loggers, bespoke state machines, ad-hoc i18n — **Vibe Coding debt**.
|
|
33
40
|
|
|
34
|
-
Snyk, Dependabot, and Renovate manage your *existing* dependencies. They can't find code you wrote that *should become* a dependency
|
|
41
|
+
Snyk, Dependabot, and Renovate manage your *existing* dependencies. They can't find code you wrote that *should become* a dependency — or capabilities your project is *missing entirely*.
|
|
35
42
|
|
|
36
|
-
**Next-Unicorn does
|
|
43
|
+
**Next-Unicorn does all three** — replacement, gap analysis, and dependency management — verified against real documentation via [Context7 MCP](https://context7.com).
|
|
37
44
|
|
|
38
45
|
## Quick Start
|
|
39
46
|
|
|
47
|
+
### From Smithery (recommended)
|
|
48
|
+
|
|
49
|
+
Browse and install directly from the Smithery skill registry:
|
|
50
|
+
|
|
51
|
+
> **[Next-Unicorn on Smithery](https://smithery.ai/skills/nebutra/next-unicorn-skill)**
|
|
52
|
+
|
|
53
|
+
### From npmjs.org
|
|
54
|
+
|
|
40
55
|
```bash
|
|
41
|
-
# npm
|
|
42
56
|
npm install @nebutra/next-unicorn-skill
|
|
43
|
-
|
|
44
|
-
# pnpm
|
|
57
|
+
# or
|
|
45
58
|
pnpm add @nebutra/next-unicorn-skill
|
|
59
|
+
```
|
|
46
60
|
|
|
47
|
-
|
|
48
|
-
|
|
61
|
+
### From GitHub Packages
|
|
62
|
+
|
|
63
|
+
Configure your `.npmrc` first:
|
|
64
|
+
|
|
65
|
+
```shell
|
|
66
|
+
echo "@nebutra:registry=https://npm.pkg.github.com" >> .npmrc
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Then install:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npm install @nebutra/next-unicorn-skill
|
|
49
73
|
```
|
|
50
74
|
|
|
51
75
|
```typescript
|
|
52
|
-
import { analyze } from '@nebutra/next-unicorn-skill';
|
|
76
|
+
import { analyze, scanCodebase } from '@nebutra/next-unicorn-skill';
|
|
77
|
+
import type { Recommender, GapRecommendation } from '@nebutra/next-unicorn-skill';
|
|
78
|
+
|
|
79
|
+
// The recommender: AI agent decides which library fits each detection
|
|
80
|
+
const recommender: Recommender = (detection) => ({
|
|
81
|
+
library: '@lingui/core',
|
|
82
|
+
version: '^4.0.0',
|
|
83
|
+
license: 'MIT',
|
|
84
|
+
rationale: 'Compile-time i18n with near-zero runtime overhead',
|
|
85
|
+
ecosystem: [
|
|
86
|
+
{ library: '@lingui/macro', version: '^4.0.0', role: 'Tagged templates' },
|
|
87
|
+
{ library: '@lingui/cli', version: '^4.0.0', role: 'CI message extraction' },
|
|
88
|
+
],
|
|
89
|
+
antiPatterns: ['Avoid i18next if bundle size matters — Lingui compiles away'],
|
|
90
|
+
alternatives: [
|
|
91
|
+
{ library: 'next-intl', when: 'Next.js App Router with server components' },
|
|
92
|
+
],
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Gap analysis: capabilities the project should have but doesn't
|
|
96
|
+
const gaps: GapRecommendation[] = [
|
|
97
|
+
{
|
|
98
|
+
domain: 'observability',
|
|
99
|
+
description: 'No structured logging detected',
|
|
100
|
+
recommendedLibrary: {
|
|
101
|
+
name: 'pino', version: '^9.0.0', license: 'MIT',
|
|
102
|
+
rationale: 'Fastest Node.js JSON logger with redaction and child loggers',
|
|
103
|
+
},
|
|
104
|
+
priority: 'critical',
|
|
105
|
+
},
|
|
106
|
+
];
|
|
53
107
|
|
|
54
108
|
const result = await analyze({
|
|
55
109
|
input: {
|
|
@@ -60,25 +114,22 @@ const result = await analyze({
|
|
|
60
114
|
currentLibraries: { react: '18.2.0', next: '14.1.0' },
|
|
61
115
|
},
|
|
62
116
|
optimizationGoals: ['reduce custom code', 'improve maintainability'],
|
|
63
|
-
constraints: {
|
|
64
|
-
licenseAllowlist: ['MIT', 'Apache-2.0', 'ISC'],
|
|
65
|
-
},
|
|
117
|
+
constraints: { licenseAllowlist: ['MIT', 'Apache-2.0', 'ISC'] },
|
|
66
118
|
priorityFocusAreas: ['i18n', 'observability', 'auth-security'],
|
|
67
119
|
},
|
|
68
120
|
context7Client: myContext7Client,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
registryClient: myRegistryClient, // auto-update
|
|
72
|
-
platformClient: myGitHubClient, // PR creation
|
|
73
|
-
gitOps: myGitOperations, // PR creation
|
|
121
|
+
recommender,
|
|
122
|
+
gaps,
|
|
74
123
|
});
|
|
75
124
|
|
|
76
125
|
if (result.success) {
|
|
77
126
|
console.log(result.prettyJson);
|
|
127
|
+
// result.scanResult — raw detections + structural findings for AI analysis
|
|
128
|
+
// result.output.gapAnalysis — Context7-verified gap recommendations
|
|
78
129
|
}
|
|
79
130
|
```
|
|
80
131
|
|
|
81
|
-
Or use as an **MCP SKILL** — provide [`SKILL.md`](./SKILL.md) to your AI agent (Claude Code, Kiro, etc.).
|
|
132
|
+
Or use as an **MCP SKILL** — provide [`SKILL.md`](./SKILL.md) to your AI agent (Claude Code, Kiro, Cursor, etc.).
|
|
82
133
|
|
|
83
134
|
## Features
|
|
84
135
|
|
|
@@ -86,15 +137,21 @@ Or use as an **MCP SKILL** — provide [`SKILL.md`](./SKILL.md) to your AI agent
|
|
|
86
137
|
|
|
87
138
|
| Feature | Description |
|
|
88
139
|
|---------|-------------|
|
|
89
|
-
| **Pattern-based scanning** | Detects hand-rolled code across
|
|
90
|
-
| **
|
|
140
|
+
| **Pattern-based scanning** | Detects hand-rolled code across 31 domains with 52 regex patterns (design-system, auth, state-management, code-organization, etc.) |
|
|
141
|
+
| **Structural analysis** | Detects monorepo architecture gaps: missing token layers, dependency flow violations, hardcoded config values |
|
|
142
|
+
| **Gap analysis** | AI agent identifies missing capabilities — not just hand-rolled code, but things you should have but don't |
|
|
143
|
+
| **Ecosystem-level recommendations** | Solutions include rationale, companion packages, anti-patterns, and alternatives |
|
|
144
|
+
| **Context7 verification** | Every recommendation (replacements AND gaps) verified with exponential backoff retry |
|
|
91
145
|
| **7-dimension impact scoring** | Scalability, performance, security, maintainability, feature richness, UX, UI aesthetics |
|
|
92
146
|
| **Phased migration plans** | Low / medium / high risk phases with adapter strategies |
|
|
93
147
|
| **Deletion checklists** | Every file and line range to remove, with estimated lines saved |
|
|
94
148
|
| **UX completeness audit** | A11y, error/empty/loading states, form validation, design system alignment |
|
|
149
|
+
| **Design system support** | Two paths: scaffold from reference repos (Primer, Polaris, Supabase, Dub) or extract from existing code |
|
|
150
|
+
| **Code organization analysis** | Detects god directories, mixed naming conventions, deep nesting, barrel bloat, catch-all directories, and circular dependencies via import graph traversal |
|
|
151
|
+
| **Human-in-the-loop gates** | 4 structured decision gates at irreversible/preference-driven points — triage, preferences (SWOT), accept/reject, execution confirmation |
|
|
95
152
|
| **Monorepo support** | Detects npm, pip, cargo, go workspaces independently |
|
|
96
153
|
|
|
97
|
-
### Dependency Management
|
|
154
|
+
### Dependency Management
|
|
98
155
|
|
|
99
156
|
| Feature | Description |
|
|
100
157
|
|---------|-------------|
|
|
@@ -105,12 +162,62 @@ Or use as an **MCP SKILL** — provide [`SKILL.md`](./SKILL.md) to your AI agent
|
|
|
105
162
|
|
|
106
163
|
## How It Works
|
|
107
164
|
|
|
165
|
+
### Architecture Diagram
|
|
166
|
+
|
|
167
|
+
```mermaid
|
|
168
|
+
flowchart TB
|
|
169
|
+
subgraph input [Input]
|
|
170
|
+
I[InputSchema JSON]
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
subgraph deterministic [Deterministic Layer — TypeScript]
|
|
174
|
+
V[Zod Validator]
|
|
175
|
+
S[Scanner — 52 regex patterns across 31 domains]
|
|
176
|
+
SA[Structure Analyzer — monorepo architecture, dependency flow, token layers]
|
|
177
|
+
C7[Context7 Verifier — exponential backoff, query ranking]
|
|
178
|
+
VS[Vuln Scanner — OSV database]
|
|
179
|
+
PC[Peer Checker — semver range validation]
|
|
180
|
+
PR[PR Strategy + Executor]
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
subgraph agent [AI Agent Layer — Claude generalization]
|
|
184
|
+
GA[Gap Analysis — single library / ecosystem / architecture gaps]
|
|
185
|
+
REC[Recommender — ecosystem-level solutions with rationale]
|
|
186
|
+
UX[UX Audit — 8 categories]
|
|
187
|
+
DS{Design System?}
|
|
188
|
+
DSE[Extract from existing code]
|
|
189
|
+
DSS[Scaffold from reference repos]
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
subgraph output [Output]
|
|
193
|
+
O[OutputSchema JSON]
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
I --> V --> S
|
|
197
|
+
S --> SA
|
|
198
|
+
S --> REC
|
|
199
|
+
SA --> GA
|
|
200
|
+
GA --> DS
|
|
201
|
+
DS -->|Existing frontend| DSE
|
|
202
|
+
DS -->|No frontend| DSS
|
|
203
|
+
GA --> O
|
|
204
|
+
REC --> C7 --> O
|
|
205
|
+
S --> PC --> O
|
|
206
|
+
S --> VS --> O
|
|
207
|
+
UX --> O
|
|
208
|
+
O --> PR
|
|
108
209
|
```
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
210
|
+
|
|
211
|
+
### Design Principles
|
|
212
|
+
|
|
213
|
+
| Principle | Implementation |
|
|
214
|
+
|-----------|---------------|
|
|
215
|
+
| **Occam's Razor** | Only 17 TS modules remain — each does something Claude cannot (regex, semver, file I/O, API calls, import graph traversal). Scoring, planning, UX audit, PR descriptions are AI-agent-driven. |
|
|
216
|
+
| **No hardcoded recommendations** | Pattern catalog contains zero library names. The `Recommender` callback and `GapRecommendation` are filled by the AI agent at runtime. |
|
|
217
|
+
| **Context7 best practices** | Exponential backoff (3 retries), query parameter for ranking, per-library isolation. Both replacements and gaps are verified. |
|
|
218
|
+
| **Progressive disclosure** | SKILL.md is 111 lines. `references/` files load only when design system gaps are detected. |
|
|
219
|
+
| **Two analysis modes** | **Replacement**: scanner finds hand-rolled code → agent recommends library. **Gap**: agent identifies missing capabilities → verified via Context7. |
|
|
220
|
+
| **Design system support** | Structure analyzer detects missing layers. Two paths: scaffold from 25+ reference repos, or extract spec from existing code (6 principles, 5 phases). |
|
|
114
221
|
|
|
115
222
|
Each stage is a pure function with structured I/O. All external dependencies (Context7, OSV, npm registry, GitHub API) are **injected via interfaces** for testability.
|
|
116
223
|
|
|
@@ -137,14 +244,14 @@ function t(key, locale) {
|
|
|
137
244
|
<td>
|
|
138
245
|
|
|
139
246
|
```tsx
|
|
140
|
-
//
|
|
141
|
-
//
|
|
142
|
-
//
|
|
143
|
-
import {
|
|
247
|
+
// @lingui/core — Context7 verified, MIT
|
|
248
|
+
// Ecosystem: @lingui/macro + @lingui/cli
|
|
249
|
+
// Impact: 9.2/10 | Risk: low | Effort: 8h
|
|
250
|
+
import { useLingui } from '@lingui/react';
|
|
144
251
|
|
|
145
252
|
export default function Page() {
|
|
146
|
-
const t =
|
|
147
|
-
return <h1>{t
|
|
253
|
+
const { t } = useLingui();
|
|
254
|
+
return <h1>{t`greeting`}</h1>;
|
|
148
255
|
}
|
|
149
256
|
```
|
|
150
257
|
|
|
@@ -170,8 +277,8 @@ function logRequest(req) {
|
|
|
170
277
|
|
|
171
278
|
```typescript
|
|
172
279
|
// pino — Context7 verified, MIT
|
|
173
|
-
//
|
|
174
|
-
//
|
|
280
|
+
// Gap analysis: "No structured logging detected"
|
|
281
|
+
// Priority: critical
|
|
175
282
|
import pino from 'pino';
|
|
176
283
|
const logger = pino({
|
|
177
284
|
level: 'info',
|
|
@@ -188,11 +295,17 @@ const logger = pino({
|
|
|
188
295
|
| Feature | Next-Unicorn | Snyk | Dependabot | Renovate |
|
|
189
296
|
|---------|:---:|:---:|:---:|:---:|
|
|
190
297
|
| Finds hand-rolled code to replace | **Yes** | | | |
|
|
298
|
+
| Identifies missing capabilities (gaps) | **Yes** | | | |
|
|
299
|
+
| Structural architecture analysis | **Yes** | | | |
|
|
191
300
|
| Recommends new libraries | **Yes** | | | |
|
|
301
|
+
| Ecosystem-level solutions | **Yes** | | | |
|
|
192
302
|
| 7-dimension impact scoring | **Yes** | | | |
|
|
193
303
|
| Context7 doc verification | **Yes** | | | |
|
|
194
304
|
| Phased migration plans | **Yes** | | | |
|
|
195
305
|
| UX completeness audit | **Yes** | | | |
|
|
306
|
+
| Design system scaffold/extraction | **Yes** | | | |
|
|
307
|
+
| Code organization analysis | **Yes** | | | |
|
|
308
|
+
| Human-in-the-loop gates | **Yes** | | | |
|
|
196
309
|
| Deletion checklists | **Yes** | | | |
|
|
197
310
|
| Vulnerability scanning | **Yes** | Yes | Yes | |
|
|
198
311
|
| Scans *recommended* libs for vulns | **Yes** | | | |
|
|
@@ -211,16 +324,27 @@ const logger = pino({
|
|
|
211
324
|
|--------|------|:--------:|-------------|
|
|
212
325
|
| `input` | `InputSchema` | Yes | Project metadata, goals, constraints, focus areas |
|
|
213
326
|
| `context7Client` | `Context7Client` | Yes | Context7 MCP client for doc verification |
|
|
327
|
+
| `recommender` | `Recommender` | Yes | Maps each detection → library recommendation (AI agent provides this) |
|
|
328
|
+
| `gaps` | `GapRecommendation[]` | No | Missing capabilities the project should have (AI agent identifies these) |
|
|
214
329
|
| `vulnClient` | `VulnerabilityClient` | No | OSV client for vulnerability scanning |
|
|
215
330
|
| `registryClient` | `RegistryClient` | No | Package registry client for auto-update |
|
|
216
331
|
| `platformClient` | `PlatformClient` | No | GitHub/GitLab client for PR creation |
|
|
217
332
|
| `gitOps` | `GitOperations` | No | Git CLI operations for PR creation |
|
|
218
333
|
|
|
334
|
+
### `scanCodebase(input): Promise<ScanResult>`
|
|
335
|
+
|
|
336
|
+
Standalone scanner — returns detections, workspace info, and structural findings (design system layer analysis, dependency flow violations). AI agents can call this first, then provide recommendations via the `Recommender` callback.
|
|
337
|
+
|
|
338
|
+
### `analyzeStructure(repoPath, workspaces): StructuralAnalysis`
|
|
339
|
+
|
|
340
|
+
Standalone structure analyzer — detects missing design system layers, dependency flow violations, hardcoded config values, and missing shared presets in monorepos.
|
|
341
|
+
|
|
219
342
|
### Output Structure
|
|
220
343
|
|
|
221
344
|
```jsonc
|
|
222
345
|
{
|
|
223
|
-
"recommendedChanges": [...], //
|
|
346
|
+
"recommendedChanges": [...], // Replacement recommendations with impact scores
|
|
347
|
+
"gapAnalysis": [...], // (optional) Context7-verified gap recommendations
|
|
224
348
|
"filesToDelete": [...], // Files to remove after migration
|
|
225
349
|
"linesSavedEstimate": 1250, // Total lines saved
|
|
226
350
|
"uxAudit": [...], // UX completeness (8 categories)
|
|
@@ -236,17 +360,18 @@ const logger = pino({
|
|
|
236
360
|
|
|
237
361
|
## Vibe Coding Domains
|
|
238
362
|
|
|
239
|
-
|
|
363
|
+
69 domains across 12 categories, aligned with ISO/IEC 25010. 31 domains have scanner patterns; the rest are covered by AI agent gap analysis.
|
|
240
364
|
|
|
241
365
|
| Category | Count | Examples |
|
|
242
366
|
|----------|:-----:|---------|
|
|
243
|
-
| UX / Design | 14 | `
|
|
367
|
+
| UX / Design | 14 | `design-system`, `a11y-accessibility`, `forms-ux`, `empty-loading-error-states` |
|
|
244
368
|
| SEO / i18n | 5 | `seo`, `i18n`, `content-marketing` |
|
|
245
369
|
| Growth / Data | 7 | `analytics-tracking`, `ab-testing-experimentation` |
|
|
246
|
-
| Frontend Arch | 8 | `state-management`, `data-fetching-caching`, `
|
|
247
|
-
| Backend / Platform | 8 | `database-orm-migrations`, `
|
|
248
|
-
| Security | 5 | `auth-security`, `
|
|
370
|
+
| Frontend Arch | 8 | `state-management`, `data-fetching-caching`, `realtime-collaboration` |
|
|
371
|
+
| Backend / Platform | 8 | `database-orm-migrations`, `caching-rate-limit`, `feature-flags-config` |
|
|
372
|
+
| Security | 5 | `auth-security`, `security-hardening`, `fraud-abuse-prevention` |
|
|
249
373
|
| Observability | 4 | `logging-tracing-metrics`, `error-monitoring` |
|
|
374
|
+
| Code Organization | 1 | `code-organization` (god-dirs, naming, circular deps, barrel bloat, nesting, catch-all) |
|
|
250
375
|
| Delivery / DevEx | 6 | `testing-strategy`, `ci-cd-release`, `dependency-management` |
|
|
251
376
|
| Performance | 3 | `performance-web-vitals`, `cost-optimization` |
|
|
252
377
|
| AI Engineering | 3 | `ai-model-serving`, `rag-vector-search` |
|
|
@@ -257,7 +382,7 @@ const logger = pino({
|
|
|
257
382
|
## Testing
|
|
258
383
|
|
|
259
384
|
```bash
|
|
260
|
-
pnpm test #
|
|
385
|
+
pnpm test # 176 tests (vitest + fast-check)
|
|
261
386
|
pnpm typecheck # TypeScript strict mode
|
|
262
387
|
pnpm build # Compile to dist/
|
|
263
388
|
```
|
|
@@ -294,23 +419,62 @@ pnpm build # Compile to dist/
|
|
|
294
419
|
| [`update-plan.md`](./templates/update-plan.md) | Dependency update plan |
|
|
295
420
|
| [`prd-template.md`](./templates/prd-template.md) | PRD for stakeholder presentation |
|
|
296
421
|
|
|
422
|
+
## References
|
|
423
|
+
|
|
424
|
+
| Reference | Purpose |
|
|
425
|
+
|-----------|---------|
|
|
426
|
+
| [`design-system-sources.md`](./references/design-system-sources.md) | 25+ curated design system repos for scaffolding (Primer, Polaris, Dub, Supabase, etc.) |
|
|
427
|
+
| [`design-system-extraction.md`](./references/design-system-extraction.md) | Workflow for extracting a design system from existing code (6 principles, 5 phases) |
|
|
428
|
+
| [`code-organization-workflow.md`](./references/code-organization-workflow.md) | Code organization decision tree, Gate examples (SWOT), Phase A/B workflow with worked examples |
|
|
429
|
+
|
|
430
|
+
<!-- TODO: P1 — 项目 Logo: 设计一个 Logo 放在 README 顶部,同时用作 GitHub Social Preview -->
|
|
431
|
+
<!-- TODO: P1 — Social Preview / OG Image: 到 GitHub repo Settings → Social preview 上传卡片图 -->
|
|
432
|
+
<!-- TODO: P1 — Demo GIF: 录制 30 秒终端演示动图,放在 Quick Start 上方 -->
|
|
433
|
+
<!-- TODO: P0 — GitHub Topics: 到 GitHub repo Settings → Topics 添加: mcp, ai-agent, claude-code, codebase-analysis, dependency-management, vulnerability-scanning, migration, context7, vibe-coding, skill -->
|
|
434
|
+
<!-- TODO: P2 — Coverage 徽章: 配置 Codecov 或 Coveralls,在 CI 中上传覆盖率报告 -->
|
|
435
|
+
<!-- TODO: P2 — Twitter/X: 创建项目 Twitter 账号或用个人账号发布公告,在 README 添加链接 -->
|
|
436
|
+
<!-- TODO: P2 — Discord: 创建 Discord 服务器,在 README 添加邀请链接徽章 -->
|
|
437
|
+
<!-- TODO: P3 — Awesome Lists: 提交 PR 到 awesome-mcp、awesome-claude-code、awesome-ai-tools 等列表 -->
|
|
438
|
+
<!-- TODO: P3 — Product Hunt: 在 producthunt.com 发布项目 -->
|
|
439
|
+
<!-- TODO: P3 — Hacker News: 发布 Show HN 帖子 -->
|
|
440
|
+
<!-- TODO: P3 — GitHub Discussions: 到 GitHub repo Settings → Features → Discussions 开启 -->
|
|
441
|
+
<!-- TODO: P3 — "Who's Using" 展示区: 有用户后在 README 加 logo 墙 -->
|
|
442
|
+
|
|
443
|
+
## Star History
|
|
444
|
+
|
|
445
|
+
<a href="https://star-history.com/#Nebutra/Next-Unicorn-Skill&Date">
|
|
446
|
+
<picture>
|
|
447
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=Nebutra/Next-Unicorn-Skill&type=Date&theme=dark" />
|
|
448
|
+
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=Nebutra/Next-Unicorn-Skill&type=Date" />
|
|
449
|
+
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Nebutra/Next-Unicorn-Skill&type=Date" />
|
|
450
|
+
</picture>
|
|
451
|
+
</a>
|
|
452
|
+
|
|
297
453
|
## Contributing
|
|
298
454
|
|
|
299
455
|
See [CONTRIBUTING.md](./CONTRIBUTING.md) for development setup, architecture overview, and contribution guidelines.
|
|
300
456
|
|
|
457
|
+
## Security
|
|
458
|
+
|
|
459
|
+
See [SECURITY.md](./SECURITY.md) for our security policy and how to report vulnerabilities.
|
|
460
|
+
|
|
301
461
|
## Releasing
|
|
302
462
|
|
|
303
463
|
Releases are automated via GitHub Actions:
|
|
304
464
|
|
|
305
465
|
```bash
|
|
306
466
|
# Tag a new version
|
|
307
|
-
git tag
|
|
308
|
-
git push origin
|
|
309
|
-
# → CI runs tests → creates GitHub Release → publishes to
|
|
467
|
+
git tag v1.0.5
|
|
468
|
+
git push origin v1.0.5
|
|
469
|
+
# → CI runs tests → creates GitHub Release → publishes to npmjs + GitHub Packages
|
|
310
470
|
```
|
|
311
471
|
|
|
472
|
+
Packages are also published automatically on every push to `main` via the CI workflow.
|
|
473
|
+
|
|
474
|
+
> **Required Secrets**: `NPM_TOKEN` (npmjs.org publish token). `GITHUB_TOKEN` is provided automatically.
|
|
475
|
+
|
|
312
476
|
See [CHANGELOG.md](./CHANGELOG.md) for version history.
|
|
313
477
|
|
|
314
478
|
## License
|
|
315
479
|
|
|
316
|
-
[MIT](./LICENSE) © [
|
|
480
|
+
[MIT](./LICENSE) © [Nebutra](https://github.com/Nebutra)
|