@urmzd/github-insights 2.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/.gitattributes +28 -0
- package/.github/dependabot.yml +6 -0
- package/.github/pull_request_template.md +14 -0
- package/.github/workflows/ci.yml +93 -0
- package/.github/workflows/release.yml +59 -0
- package/.nvmrc +1 -0
- package/.pre-commit-config.yaml +5 -0
- package/AGENTS.md +69 -0
- package/CHANGELOG.md +260 -0
- package/CONTRIBUTING.md +87 -0
- package/LICENSE +190 -0
- package/README.md +188 -0
- package/action.yml +45 -0
- package/biome.json +40 -0
- package/examples/classic/README.md +9 -0
- package/examples/classic/index.svg +14 -0
- package/examples/classic/metrics-calendar.svg +14 -0
- package/examples/classic/metrics-complexity.svg +14 -0
- package/examples/classic/metrics-contributions.svg +14 -0
- package/examples/classic/metrics-expertise.svg +14 -0
- package/examples/classic/metrics-languages.svg +14 -0
- package/examples/classic/metrics-pulse.svg +14 -0
- package/examples/ecosystem/README.md +59 -0
- package/examples/ecosystem/index.svg +14 -0
- package/examples/ecosystem/metrics-calendar.svg +14 -0
- package/examples/ecosystem/metrics-complexity.svg +14 -0
- package/examples/ecosystem/metrics-contributions.svg +14 -0
- package/examples/ecosystem/metrics-expertise.svg +14 -0
- package/examples/ecosystem/metrics-languages.svg +14 -0
- package/examples/ecosystem/metrics-pulse.svg +14 -0
- package/examples/minimal/README.md +9 -0
- package/examples/minimal/index.svg +14 -0
- package/examples/minimal/metrics-calendar.svg +14 -0
- package/examples/minimal/metrics-complexity.svg +14 -0
- package/examples/minimal/metrics-contributions.svg +14 -0
- package/examples/minimal/metrics-expertise.svg +14 -0
- package/examples/minimal/metrics-languages.svg +14 -0
- package/examples/minimal/metrics-pulse.svg +14 -0
- package/examples/modern/README.md +111 -0
- package/examples/modern/index.svg +14 -0
- package/examples/modern/metrics-calendar.svg +14 -0
- package/examples/modern/metrics-complexity.svg +14 -0
- package/examples/modern/metrics-contributions.svg +14 -0
- package/examples/modern/metrics-expertise.svg +14 -0
- package/examples/modern/metrics-languages.svg +14 -0
- package/examples/modern/metrics-pulse.svg +14 -0
- package/llms.txt +24 -0
- package/metrics/index.svg +14 -0
- package/metrics/metrics-calendar.svg +14 -0
- package/metrics/metrics-complexity.svg +14 -0
- package/metrics/metrics-contributions.svg +14 -0
- package/metrics/metrics-domains.svg +14 -0
- package/metrics/metrics-expertise.svg +14 -0
- package/metrics/metrics-languages.svg +14 -0
- package/metrics/metrics-pulse.svg +14 -0
- package/metrics/metrics-tech-stack.svg +14 -0
- package/package.json +35 -0
- package/skills/github-insights/SKILL.md +237 -0
- package/sr.yaml +16 -0
- package/src/__fixtures__/repos.ts +84 -0
- package/src/api.ts +729 -0
- package/src/components/bar-chart.test.tsx +38 -0
- package/src/components/bar-chart.tsx +54 -0
- package/src/components/contribution-calendar.test.tsx +44 -0
- package/src/components/contribution-calendar.tsx +94 -0
- package/src/components/contribution-cards.test.tsx +36 -0
- package/src/components/contribution-cards.tsx +58 -0
- package/src/components/donut-chart.test.tsx +36 -0
- package/src/components/donut-chart.tsx +102 -0
- package/src/components/full-svg.test.tsx +54 -0
- package/src/components/full-svg.tsx +59 -0
- package/src/components/project-cards.test.tsx +46 -0
- package/src/components/project-cards.tsx +66 -0
- package/src/components/section.test.tsx +69 -0
- package/src/components/section.tsx +79 -0
- package/src/components/stat-cards.test.tsx +32 -0
- package/src/components/stat-cards.tsx +57 -0
- package/src/components/style-defs.test.tsx +26 -0
- package/src/components/style-defs.tsx +27 -0
- package/src/components/tech-highlights.test.tsx +63 -0
- package/src/components/tech-highlights.tsx +109 -0
- package/src/config.test.ts +127 -0
- package/src/config.ts +103 -0
- package/src/index.ts +363 -0
- package/src/jsx-factory.test.tsx +86 -0
- package/src/jsx-factory.ts +46 -0
- package/src/jsx.d.ts +6 -0
- package/src/metrics.test.ts +669 -0
- package/src/metrics.ts +365 -0
- package/src/parsers.test.ts +247 -0
- package/src/parsers.ts +146 -0
- package/src/readme.test.ts +189 -0
- package/src/readme.ts +70 -0
- package/src/svg-utils.test.ts +66 -0
- package/src/svg-utils.ts +33 -0
- package/src/templates.test.ts +412 -0
- package/src/templates.ts +296 -0
- package/src/theme.ts +33 -0
- package/src/types.ts +235 -0
- package/teasr.toml +14 -0
- package/tsconfig.json +21 -0
- package/vitest.config.ts +12 -0
package/src/theme.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const THEME = {
|
|
2
|
+
bg: "#0d1117",
|
|
3
|
+
cardBg: "#161b22",
|
|
4
|
+
border: "#30363d",
|
|
5
|
+
link: "#58a6ff",
|
|
6
|
+
text: "#c9d1d9",
|
|
7
|
+
secondary: "#8b949e",
|
|
8
|
+
muted: "#6e7681",
|
|
9
|
+
} as const;
|
|
10
|
+
|
|
11
|
+
export const FONT =
|
|
12
|
+
"-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif";
|
|
13
|
+
|
|
14
|
+
export const LAYOUT = {
|
|
15
|
+
width: 808,
|
|
16
|
+
padX: 24,
|
|
17
|
+
padY: 24,
|
|
18
|
+
sectionGap: 30,
|
|
19
|
+
barHeight: 18,
|
|
20
|
+
barRowHeight: 48,
|
|
21
|
+
barMaxWidth: 700,
|
|
22
|
+
} as const;
|
|
23
|
+
|
|
24
|
+
export const BAR_COLORS = [
|
|
25
|
+
"#58a6ff",
|
|
26
|
+
"#3fb950",
|
|
27
|
+
"#d29922",
|
|
28
|
+
"#f85149",
|
|
29
|
+
"#bc8cff",
|
|
30
|
+
"#39d2c0",
|
|
31
|
+
"#db61a2",
|
|
32
|
+
"#79c0ff",
|
|
33
|
+
] as const;
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
// ── Render result ───────────────────────────────────────────────────────────
|
|
2
|
+
|
|
3
|
+
export interface RenderResult {
|
|
4
|
+
svg: string;
|
|
5
|
+
height: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// ── Language / Tech items ───────────────────────────────────────────────────
|
|
9
|
+
|
|
10
|
+
export interface LanguageItem {
|
|
11
|
+
name: string;
|
|
12
|
+
value: number;
|
|
13
|
+
percent: string;
|
|
14
|
+
color: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface TechItem {
|
|
18
|
+
name: string;
|
|
19
|
+
value: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface ProjectItem {
|
|
23
|
+
name: string;
|
|
24
|
+
url: string;
|
|
25
|
+
description: string;
|
|
26
|
+
stars: number;
|
|
27
|
+
languageCount?: number;
|
|
28
|
+
codeSize?: number;
|
|
29
|
+
languages?: string[];
|
|
30
|
+
summary?: string;
|
|
31
|
+
category?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ── Bar chart generics ──────────────────────────────────────────────────────
|
|
35
|
+
|
|
36
|
+
export interface BarItem {
|
|
37
|
+
name: string;
|
|
38
|
+
value: number;
|
|
39
|
+
percent?: string;
|
|
40
|
+
color?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// ── Stat cards ──────────────────────────────────────────────────────────────
|
|
44
|
+
|
|
45
|
+
export interface StatItem {
|
|
46
|
+
label: string;
|
|
47
|
+
value: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// ── Contribution cards ──────────────────────────────────────────────────────
|
|
51
|
+
|
|
52
|
+
export interface ContributionHighlight {
|
|
53
|
+
project: string;
|
|
54
|
+
detail: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ── Section definition ──────────────────────────────────────────────────────
|
|
58
|
+
|
|
59
|
+
export interface SectionDef {
|
|
60
|
+
filename: string;
|
|
61
|
+
title: string;
|
|
62
|
+
subtitle: string;
|
|
63
|
+
renderBody?: (y: number) => RenderResult;
|
|
64
|
+
items?: BarItem[];
|
|
65
|
+
options?: Record<string, unknown>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// ── GitHub API types ────────────────────────────────────────────────────────
|
|
69
|
+
|
|
70
|
+
export interface RepoLanguageEdge {
|
|
71
|
+
size: number;
|
|
72
|
+
node: { name: string; color: string };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface RepoNode {
|
|
76
|
+
name: string;
|
|
77
|
+
description: string | null;
|
|
78
|
+
url: string;
|
|
79
|
+
stargazerCount: number;
|
|
80
|
+
diskUsage: number;
|
|
81
|
+
primaryLanguage: { name: string; color: string } | null;
|
|
82
|
+
isArchived: boolean;
|
|
83
|
+
isFork: boolean;
|
|
84
|
+
createdAt: string;
|
|
85
|
+
pushedAt: string;
|
|
86
|
+
repositoryTopics: { nodes: { topic: { name: string } }[] };
|
|
87
|
+
languages: {
|
|
88
|
+
totalSize: number;
|
|
89
|
+
edges: RepoLanguageEdge[];
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface ContributionsCollection {
|
|
94
|
+
totalCommitContributions: number;
|
|
95
|
+
totalPullRequestContributions: number;
|
|
96
|
+
totalPullRequestReviewContributions: number;
|
|
97
|
+
totalRepositoriesWithContributedCommits: number;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface ExternalRepo {
|
|
101
|
+
nameWithOwner: string;
|
|
102
|
+
url: string;
|
|
103
|
+
stargazerCount: number;
|
|
104
|
+
description: string | null;
|
|
105
|
+
primaryLanguage: { name: string } | null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ── Commit contributions by repository ────────────────────────────────────
|
|
109
|
+
|
|
110
|
+
export interface RepoCommitContribution {
|
|
111
|
+
repository: { name: string; nameWithOwner: string };
|
|
112
|
+
contributions: { totalCount: number };
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// ── Contribution calendar ──────────────────────────────────────────────────
|
|
116
|
+
|
|
117
|
+
export interface ContributionDay {
|
|
118
|
+
contributionCount: number;
|
|
119
|
+
date: string;
|
|
120
|
+
color: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface ContributionWeek {
|
|
124
|
+
contributionDays: ContributionDay[];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface ContributionCalendar {
|
|
128
|
+
totalContributions: number;
|
|
129
|
+
weeks: ContributionWeek[];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface ContributionData {
|
|
133
|
+
contributions: ContributionsCollection;
|
|
134
|
+
externalRepos: { totalCount: number; nodes: ExternalRepo[] };
|
|
135
|
+
contributionCalendar?: ContributionCalendar;
|
|
136
|
+
commitContributionsByRepository?: RepoCommitContribution[];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// ── Manifest types ──────────────────────────────────────────────────────────
|
|
140
|
+
|
|
141
|
+
export type ManifestMap = Map<string, Record<string, string>>;
|
|
142
|
+
export type ReadmeMap = Map<string, string>;
|
|
143
|
+
|
|
144
|
+
// ── Package parser ─────────────────────────────────────────────────────────
|
|
145
|
+
|
|
146
|
+
export interface PackageParser {
|
|
147
|
+
/** Filenames this parser handles (e.g. ["package.json"]) */
|
|
148
|
+
filenames: string[];
|
|
149
|
+
/** Extract dependency names from file content */
|
|
150
|
+
parseDependencies(text: string): string[];
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface TechHighlight {
|
|
154
|
+
category: string;
|
|
155
|
+
items: string[];
|
|
156
|
+
score: number; // 0-100 proficiency level
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface UserConfig {
|
|
160
|
+
title?: string;
|
|
161
|
+
desired_title?: string;
|
|
162
|
+
name?: string;
|
|
163
|
+
pronunciation?: string;
|
|
164
|
+
bio?: string;
|
|
165
|
+
preamble?: string;
|
|
166
|
+
template?: TemplateName;
|
|
167
|
+
sections?: string[];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface UserProfile {
|
|
171
|
+
name: string | null;
|
|
172
|
+
bio: string | null;
|
|
173
|
+
company: string | null;
|
|
174
|
+
location: string | null;
|
|
175
|
+
websiteUrl: string | null;
|
|
176
|
+
twitterUsername: string | null;
|
|
177
|
+
socialAccounts: { provider: string; url: string }[];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// ── SVG embed ─────────────────────────────────────────────────────────────
|
|
181
|
+
|
|
182
|
+
export interface SvgEmbed {
|
|
183
|
+
label: string;
|
|
184
|
+
path: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// ── Template types ────────────────────────────────────────────────────────
|
|
188
|
+
|
|
189
|
+
export type TemplateName = "classic" | "modern" | "minimal" | "ecosystem";
|
|
190
|
+
|
|
191
|
+
export type ProjectStatus = "active" | "maintained" | "inactive";
|
|
192
|
+
|
|
193
|
+
export interface RepoClassificationInput {
|
|
194
|
+
name: string;
|
|
195
|
+
description: string;
|
|
196
|
+
stars: number;
|
|
197
|
+
diskUsageKb: number;
|
|
198
|
+
languages: string[];
|
|
199
|
+
commitsLastYear: number;
|
|
200
|
+
createdAt?: string;
|
|
201
|
+
pushedAt: string;
|
|
202
|
+
topicCount: number;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface RepoClassificationOutput {
|
|
206
|
+
name: string;
|
|
207
|
+
status: ProjectStatus;
|
|
208
|
+
summary: string;
|
|
209
|
+
category?: string;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export interface TemplateContext {
|
|
213
|
+
username: string;
|
|
214
|
+
name: string;
|
|
215
|
+
firstName: string;
|
|
216
|
+
pronunciation?: string;
|
|
217
|
+
title?: string;
|
|
218
|
+
bio?: string;
|
|
219
|
+
preamble?: string;
|
|
220
|
+
svgs: SvgEmbed[];
|
|
221
|
+
sectionSvgs: Record<string, string>;
|
|
222
|
+
profile: UserProfile;
|
|
223
|
+
activeProjects: ProjectItem[];
|
|
224
|
+
maintainedProjects: ProjectItem[];
|
|
225
|
+
inactiveProjects: ProjectItem[];
|
|
226
|
+
allProjects: ProjectItem[];
|
|
227
|
+
categorizedProjects: Record<string, ProjectItem[]>;
|
|
228
|
+
languages: LanguageItem[];
|
|
229
|
+
techHighlights: TechHighlight[];
|
|
230
|
+
contributionData: ContributionData;
|
|
231
|
+
socialBadges: string;
|
|
232
|
+
svgDir: string;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export type TemplateFunction = (context: TemplateContext) => string;
|
package/teasr.toml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[server]
|
|
2
|
+
command = "npx serve metrics --listen 3123"
|
|
3
|
+
url = "http://localhost:3123"
|
|
4
|
+
timeout = 10000
|
|
5
|
+
|
|
6
|
+
[output]
|
|
7
|
+
dir = "./showcase"
|
|
8
|
+
formats = ["png"]
|
|
9
|
+
|
|
10
|
+
[[scenes]]
|
|
11
|
+
type = "web"
|
|
12
|
+
url = "/index.svg"
|
|
13
|
+
name = "metrics-svg"
|
|
14
|
+
viewport = { width = 1200, height = 900 }
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ES2022",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"jsx": "react",
|
|
7
|
+
"jsxFactory": "h",
|
|
8
|
+
"jsxFragmentFactory": "Fragment",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"outDir": "build",
|
|
14
|
+
"rootDir": "src",
|
|
15
|
+
"declaration": true,
|
|
16
|
+
"sourceMap": true,
|
|
17
|
+
"resolveJsonModule": true
|
|
18
|
+
},
|
|
19
|
+
"include": ["src/**/*"],
|
|
20
|
+
"exclude": ["node_modules", "dist", "build"]
|
|
21
|
+
}
|
package/vitest.config.ts
ADDED