opensource-showcase 0.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.
Files changed (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +133 -0
  3. package/dist/auth/github-auth.d.ts +30 -0
  4. package/dist/auth/github-auth.d.ts.map +1 -0
  5. package/dist/auth/github-auth.js +113 -0
  6. package/dist/auth/github-auth.js.map +1 -0
  7. package/dist/cli.d.ts +6 -0
  8. package/dist/cli.d.ts.map +1 -0
  9. package/dist/cli.js +141 -0
  10. package/dist/cli.js.map +1 -0
  11. package/dist/commands/config.d.ts +9 -0
  12. package/dist/commands/config.d.ts.map +1 -0
  13. package/dist/commands/config.js +67 -0
  14. package/dist/commands/config.js.map +1 -0
  15. package/dist/commands/logout.d.ts +5 -0
  16. package/dist/commands/logout.d.ts.map +1 -0
  17. package/dist/commands/logout.js +35 -0
  18. package/dist/commands/logout.js.map +1 -0
  19. package/dist/commands/main.d.ts +6 -0
  20. package/dist/commands/main.d.ts.map +1 -0
  21. package/dist/commands/main.js +104 -0
  22. package/dist/commands/main.js.map +1 -0
  23. package/dist/commands/status.d.ts +5 -0
  24. package/dist/commands/status.d.ts.map +1 -0
  25. package/dist/commands/status.js +96 -0
  26. package/dist/commands/status.js.map +1 -0
  27. package/dist/commands/validate.d.ts +5 -0
  28. package/dist/commands/validate.d.ts.map +1 -0
  29. package/dist/commands/validate.js +82 -0
  30. package/dist/commands/validate.js.map +1 -0
  31. package/dist/constants.d.ts +22 -0
  32. package/dist/constants.d.ts.map +1 -0
  33. package/dist/constants.js +84 -0
  34. package/dist/constants.js.map +1 -0
  35. package/dist/filter/filter-prs.d.ts +31 -0
  36. package/dist/filter/filter-prs.d.ts.map +1 -0
  37. package/dist/filter/filter-prs.js +124 -0
  38. package/dist/filter/filter-prs.js.map +1 -0
  39. package/dist/github/fetch-prs.d.ts +30 -0
  40. package/dist/github/fetch-prs.d.ts.map +1 -0
  41. package/dist/github/fetch-prs.js +174 -0
  42. package/dist/github/fetch-prs.js.map +1 -0
  43. package/dist/repo/generate-readme.d.ts +13 -0
  44. package/dist/repo/generate-readme.d.ts.map +1 -0
  45. package/dist/repo/generate-readme.js +197 -0
  46. package/dist/repo/generate-readme.js.map +1 -0
  47. package/dist/repo/manage-repo.d.ts +26 -0
  48. package/dist/repo/manage-repo.d.ts.map +1 -0
  49. package/dist/repo/manage-repo.js +235 -0
  50. package/dist/repo/manage-repo.js.map +1 -0
  51. package/dist/types/index.d.ts +148 -0
  52. package/dist/types/index.d.ts.map +1 -0
  53. package/dist/types/index.js +5 -0
  54. package/dist/types/index.js.map +1 -0
  55. package/dist/ui/interactive.d.ts +17 -0
  56. package/dist/ui/interactive.d.ts.map +1 -0
  57. package/dist/ui/interactive.js +141 -0
  58. package/dist/ui/interactive.js.map +1 -0
  59. package/dist/utils/config.d.ts +72 -0
  60. package/dist/utils/config.d.ts.map +1 -0
  61. package/dist/utils/config.js +164 -0
  62. package/dist/utils/config.js.map +1 -0
  63. package/dist/utils/errors.d.ts +33 -0
  64. package/dist/utils/errors.d.ts.map +1 -0
  65. package/dist/utils/errors.js +75 -0
  66. package/dist/utils/errors.js.map +1 -0
  67. package/dist/utils/logger.d.ts +23 -0
  68. package/dist/utils/logger.d.ts.map +1 -0
  69. package/dist/utils/logger.js +51 -0
  70. package/dist/utils/logger.js.map +1 -0
  71. package/package.json +72 -0
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Main command flow: authenticate → fetch → filter → curate → save
3
+ */
4
+ import { logger } from '../utils/logger.js';
5
+ import { getUserConfig } from '../utils/config.js';
6
+ import { authenticateWithGitHub, getAuthenticatedClient, isAuthenticated, } from '../auth/github-auth.js';
7
+ import { fetchMergedPRs, enrichPRsWithMetadata, } from '../github/fetch-prs.js';
8
+ import { applyFilters, sortContributions } from '../filter/filter-prs.js';
9
+ import { selectContributions, confirmSave, showSummary, } from '../ui/interactive.js';
10
+ import { getExistingContributions, saveContributions, } from '../repo/manage-repo.js';
11
+ export async function mainFlow(options) {
12
+ logger.title('🚀 Starting Contribution Curation');
13
+ logger.newline();
14
+ // Step 1: Authentication
15
+ logger.subtitle('Step 1: Authentication');
16
+ let authContext;
17
+ if (options.token) {
18
+ logger.info('Using provided token...');
19
+ authContext = await getAuthenticatedClient(options.token);
20
+ }
21
+ else if (isAuthenticated()) {
22
+ logger.info('Using stored credentials...');
23
+ try {
24
+ authContext = await getAuthenticatedClient();
25
+ }
26
+ catch {
27
+ logger.warning('Stored token expired, re-authenticating...');
28
+ authContext = await authenticateWithGitHub();
29
+ }
30
+ }
31
+ else {
32
+ authContext = await authenticateWithGitHub();
33
+ }
34
+ const { octokit, username, user } = authContext;
35
+ // Step 2: Load configuration
36
+ logger.newline();
37
+ logger.subtitle('Step 2: Loading Configuration');
38
+ const config = await getUserConfig();
39
+ // Override min stars if provided
40
+ if (options.minStars !== undefined) {
41
+ config.minStars = options.minStars;
42
+ logger.info(`Overriding min stars filter: ${options.minStars}`);
43
+ }
44
+ logger.info(`Config loaded (min stars: ${config.minStars})`);
45
+ // Step 3: Fetch existing contributions
46
+ logger.newline();
47
+ logger.subtitle('Step 3: Checking Existing Contributions');
48
+ const existing = await getExistingContributions(octokit, username);
49
+ if (existing) {
50
+ logger.success(`Found ${existing.contributions.length} existing contributions`);
51
+ }
52
+ else {
53
+ logger.info('No existing contributions found');
54
+ }
55
+ // Step 4: Fetch PRs
56
+ logger.newline();
57
+ logger.subtitle('Step 4: Fetching Pull Requests');
58
+ const prs = await fetchMergedPRs(octokit, {
59
+ username,
60
+ since: options.since,
61
+ onProgress: (current, total, message) => {
62
+ logger.debug(`${message} (${current}/${total})`);
63
+ },
64
+ });
65
+ if (prs.length === 0) {
66
+ logger.warning('No merged Pull Requests found');
67
+ logger.newline();
68
+ logger.plain('Make sure you have merged PRs to public repositories on GitHub');
69
+ return;
70
+ }
71
+ // Step 5: Enrich with metadata
72
+ logger.newline();
73
+ logger.subtitle('Step 5: Enriching with Repository Data');
74
+ const enriched = await enrichPRsWithMetadata(octokit, prs);
75
+ // Step 6: Apply filters
76
+ logger.newline();
77
+ logger.subtitle('Step 6: Applying Filters');
78
+ const filtered = applyFilters(enriched, config, username, options.all ?? false);
79
+ logger.info(`Applied filters: ${filtered.filter((c) => !c.filtered).length} PRs shown`);
80
+ // Step 7: Sort by importance
81
+ const sorted = sortContributions(filtered);
82
+ // Step 8: Interactive selection
83
+ logger.newline();
84
+ logger.subtitle('Step 7: Interactive Selection');
85
+ const selected = await selectContributions(sorted, existing?.contributions ?? []);
86
+ if (selected.length === 0) {
87
+ logger.warning('No contributions selected');
88
+ return;
89
+ }
90
+ // Step 9: Confirm save
91
+ logger.newline();
92
+ const confirmed = await confirmSave();
93
+ if (!confirmed) {
94
+ logger.info('Cancelled. No changes made.');
95
+ return;
96
+ }
97
+ // Step 10: Save to repository
98
+ logger.newline();
99
+ logger.subtitle('Step 8: Saving Contributions');
100
+ const repoUrl = await saveContributions(octokit, username, user, selected);
101
+ // Show summary
102
+ showSummary(username, selected.length, repoUrl);
103
+ }
104
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/commands/main.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,cAAc,EACd,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAGhC,MA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AAM,EAAE,OAAO,CAAC,CAAC;AAClD,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Status command: show current contributions
3
+ */
4
+ export declare function statusCommand(): Promise<void>;
5
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAyGnD"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Status command: show current contributions
3
+ */
4
+ import chalk from 'chalk';
5
+ import { logger } from '../utils/logger.js';
6
+ import { getAuthenticatedClient, isAuthenticated } from '../auth/github-auth.js';
7
+ import { getExistingContributions } from '../repo/manage-repo.js';
8
+ import { AuthenticationError } from '../utils/errors.js';
9
+ import { OPENSOURCE_REPO_NAME } from '../constants.js';
10
+ export async function statusCommand() {
11
+ if (!isAuthenticated()) {
12
+ throw new AuthenticationError('Not authenticated. Please run the main command first.');
13
+ }
14
+ const { octokit, username } = await getAuthenticatedClient();
15
+ logger.title('📊 Current Contribution Status');
16
+ logger.newline();
17
+ const existing = await getExistingContributions(octokit, username);
18
+ if (!existing) {
19
+ logger.warning('No contributions found');
20
+ logger.newline();
21
+ logger.plain('Run the main command to curate your contributions:');
22
+ logger.plain(chalk.cyan(' npx opensource-showcase'));
23
+ logger.newline();
24
+ return;
25
+ }
26
+ logger.success(`Found ${existing.contributions.length} showcased contributions`);
27
+ logger.newline();
28
+ // Show contributor info
29
+ logger.subtitle('Contributor');
30
+ logger.keyValue('Username', existing.contributor.username);
31
+ if (existing.contributor.name) {
32
+ logger.keyValue('Name', existing.contributor.name);
33
+ }
34
+ if (existing.contributor.website) {
35
+ logger.keyValue('Website', existing.contributor.website);
36
+ }
37
+ logger.keyValue('Profile', existing.contributor.profile_url);
38
+ // Show stats
39
+ logger.newline();
40
+ logger.subtitle('Statistics');
41
+ const languages = new Map();
42
+ const repos = new Map();
43
+ existing.contributions.forEach((c) => {
44
+ if (c.language) {
45
+ languages.set(c.language, (languages.get(c.language) ?? 0) + 1);
46
+ }
47
+ repos.set(c.repo, (repos.get(c.repo) ?? 0) + 1);
48
+ });
49
+ logger.keyValue('Total contributions', existing.contributions.length.toString());
50
+ logger.keyValue('Unique repositories', repos.size.toString());
51
+ logger.keyValue('Languages', languages.size.toString());
52
+ logger.keyValue('Last updated', new Date(existing.updated_at).toLocaleString());
53
+ // Show top languages
54
+ if (languages.size > 0) {
55
+ logger.newline();
56
+ logger.subtitle('Top Languages');
57
+ const sortedLangs = [...languages.entries()]
58
+ .sort((a, b) => b[1] - a[1])
59
+ .slice(0, 5);
60
+ sortedLangs.forEach(([lang, count]) => {
61
+ logger.listItem(`${lang}: ${count} contributions`);
62
+ });
63
+ }
64
+ // Show top repos
65
+ if (repos.size > 0) {
66
+ logger.newline();
67
+ logger.subtitle('Top Repositories');
68
+ const sortedRepos = [...repos.entries()]
69
+ .sort((a, b) => b[1] - a[1])
70
+ .slice(0, 5);
71
+ sortedRepos.forEach(([repo, count]) => {
72
+ const contribution = existing.contributions.find((c) => c.repo === repo);
73
+ const stars = contribution ? `⭐ ${contribution.repo_stars.toLocaleString()}` : '';
74
+ logger.listItem(`${repo} ${chalk.yellow(stars)} (${count} PRs)`);
75
+ });
76
+ }
77
+ // Show recent contributions
78
+ logger.newline();
79
+ logger.subtitle('Recent Contributions');
80
+ const recent = existing.contributions
81
+ .sort((a, b) => new Date(b.merged_at).getTime() - new Date(a.merged_at).getTime())
82
+ .slice(0, 5);
83
+ recent.forEach((c) => {
84
+ const date = new Date(c.merged_at).toLocaleDateString();
85
+ logger.plain(` ${chalk.gray(date)} ${chalk.bold(c.repo)}`);
86
+ logger.plain(` ${c.pr_title}`);
87
+ logger.plain(` ${chalk.blue(c.pr_url)}`);
88
+ logger.newline();
89
+ });
90
+ // Show repository link
91
+ logger.subtitle('Repository');
92
+ const repoUrl = `https://github.com/${username}/${OPENSOURCE_REPO_NAME}`;
93
+ logger.plain(chalk.cyan(repoUrl));
94
+ logger.newline();
95
+ }
96
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC;QACvB,MAAM,IAAI,mBAAmB,CAAC,uDAAuD,CAAC,CAAC;IACzF,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,sBAAsB,EAAE,CAAC;IAE7D,MAAM,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAC/C,MAAM,CAAC,OAAO,EAAE,CAAC;IAEjB,MAAM,QAAQ,GAAG,MAAM,wBAAwB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAEnE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;QACzC,MAAM,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;QACnE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC,CAAC;QACtD,MAAM,CAAC,OAAO,EAAE,CAAC;QACjB,OAAO;IACT,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,SAAS,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D,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5D,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QAClC,MAAM,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC5C,MAAM,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,uBAAuB;IACvB,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC9B,MAAM,OAAO,GAAG,sBAAsB,QAAQ,IAAI,oBAAoB,EAAE,CAAC;IACzE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAClC,MAAM,CAAC,OAAO,EAAE,CAAC;AACnB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Validate command: validate contributions.json schema
3
+ */
4
+ export declare function validateCommand(filePath: string): Promise<void>;
5
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyFrE"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Validate command: validate contributions.json schema
3
+ */
4
+ import { readFile } from 'fs/promises';
5
+ import chalk from 'chalk';
6
+ import { logger } from '../utils/logger.js';
7
+ import { validateContributionsSchema } from '../repo/manage-repo.js';
8
+ import { ValidationError } from '../utils/errors.js';
9
+ import { SPEC_VERSION } from '../constants.js';
10
+ export async function validateCommand(filePath) {
11
+ logger.title('✓ Validating contributions.json');
12
+ logger.newline();
13
+ logger.info(`Reading file: ${filePath}`);
14
+ try {
15
+ const content = await readFile(filePath, 'utf-8');
16
+ const data = JSON.parse(content);
17
+ // Validate schema
18
+ validateContributionsSchema(data);
19
+ // Now we can safely assert the type
20
+ const validData = data;
21
+ logger.success('Schema validation passed');
22
+ logger.newline();
23
+ // Show details
24
+ logger.subtitle('File Details');
25
+ logger.keyValue('Version', validData.version);
26
+ logger.keyValue('Contributor', validData.contributor.username);
27
+ logger.keyValue('Contributions', validData.contributions.length.toString());
28
+ logger.keyValue('Last Updated', new Date(validData.updated_at).toLocaleString());
29
+ // Check version compatibility
30
+ if (validData.version !== SPEC_VERSION) {
31
+ logger.newline();
32
+ logger.warning(`Version mismatch: Expected ${SPEC_VERSION}, found ${validData.version}`);
33
+ logger.info('This file may use an older or newer specification version');
34
+ }
35
+ // Validate each contribution
36
+ logger.newline();
37
+ logger.subtitle('Contribution Validation');
38
+ const issues = [];
39
+ validData.contributions.forEach((c, index) => {
40
+ // Check required fields
41
+ if (!c.repo || !c.pr_number || !c.pr_title || !c.pr_url || !c.merged_at) {
42
+ issues.push(`Contribution ${index + 1}: Missing required field(s)`);
43
+ }
44
+ // Check repo format
45
+ if (c.repo && !c.repo.includes('/')) {
46
+ issues.push(`Contribution ${index + 1}: Invalid repo format (should be owner/repo)`);
47
+ }
48
+ // Check URL format
49
+ if (c.pr_url && !c.pr_url.startsWith('https://github.com/')) {
50
+ issues.push(`Contribution ${index + 1}: Invalid PR URL format`);
51
+ }
52
+ // Check date format
53
+ if (c.merged_at && isNaN(Date.parse(c.merged_at))) {
54
+ issues.push(`Contribution ${index + 1}: Invalid date format`);
55
+ }
56
+ });
57
+ if (issues.length === 0) {
58
+ logger.success('All contributions are valid');
59
+ }
60
+ else {
61
+ logger.warning(`Found ${issues.length} issue(s):`);
62
+ logger.newline();
63
+ issues.forEach((issue) => {
64
+ logger.listItem(chalk.yellow(issue));
65
+ });
66
+ }
67
+ logger.newline();
68
+ }
69
+ catch (error) {
70
+ if (error instanceof SyntaxError) {
71
+ throw new ValidationError('Invalid JSON syntax');
72
+ }
73
+ if (error instanceof ValidationError) {
74
+ throw error;
75
+ }
76
+ if (error.code === 'ENOENT') {
77
+ throw new ValidationError(`File not found: ${filePath}`);
78
+ }
79
+ throw new ValidationError(`Validation failed: ${error.message}`);
80
+ }
81
+ }
82
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,QAAgB;IACpD,MAAM,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAChD,MAAM,CAAC,OAAO,EAAE,CAAC;IAEjB,MAAM,CAAC,IAAI,CAAC,iBAAiB,QAAQ,EAAE,CAAC,CAAC;IAEzC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAClD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAY,CAAC;QAE5C,kBAAkB;QAClB,2BAA2B,CAAC,IAAI,CAAC,CAAC;QAElC,oCAAoC;QACpC,MAAM,SAAS,GAAG,IAAyB,CAAC;QAE5C,MAAM,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC;QAC3C,MAAM,CAAC,OAAO,EAAE,CAAC;QAEjB,eAAe;QACf,MAAM,CAAC,QAAQ,CAAC,cAA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AC;QAED,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACvD,MAAM,IAAI,eAAe,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAC;QAC3D,CAAC;QAED,MAAM,IAAI,eAAe,CAAC,sBAAuB,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Application-wide constants
3
+ */
4
+ import type { UserConfig } from './types/index.js';
5
+ export declare const APP_NAME = "opensource-showcase";
6
+ export declare const CONFIG_FILE_NAME = ".opensourcerc";
7
+ export declare const OPENSOURCE_REPO_NAME = ".opensource";
8
+ export declare const CONTRIBUTIONS_FILE = "contributions.json";
9
+ export declare const BACKUP_FILE = "contributions.backup.json";
10
+ export declare const README_FILE = "README.md";
11
+ export declare const GITHUB_SCOPES: readonly ["public_repo", "read:user"];
12
+ export declare const DEFAULT_CONFIG: UserConfig;
13
+ export declare const SPEC_VERSION = "1.0";
14
+ export declare const BOT_AUTHORS: readonly ["dependabot[bot]", "renovate[bot]", "dependabot-preview[bot]", "snyk-bot", "greenkeeper[bot]"];
15
+ export declare const FILTER_REASONS: {
16
+ readonly LOW_STARS: "low_stars";
17
+ readonly JUNK_TITLE: "junk_title";
18
+ readonly BOT_PR: "bot_pr";
19
+ readonly OWN_REPO: "own_repo";
20
+ };
21
+ export declare const README_TEMPLATE = "# .opensource\n\n> \uD83D\uDCE6 My curated open source contributions\n\nThis repository follows the [`.opensource` specification](https://github.com/opensource-showcase/spec) - a standardized format for showcasing open source contributions.\n\n---\n\n## \uD83D\uDCCA Statistics\n\n<!--STATS_START-->\n- **Total Contributions:** 0\n- **Languages:** 0\n- **Repositories:** 0\n<!--STATS_END-->\n\n---\n\n## \uD83C\uDF1F Featured Contributions\n\n<!--CONTRIBUTIONS_START-->\n### No contributions yet\n\nRun `opensource-showcase` to add your contributions!\n<!--CONTRIBUTIONS_END-->\n\n---\n\n## \uD83D\uDCC1 File Structure\n\n- `contributions.json` - Machine-readable contribution data\n- `README.md` - This file\n\n---\n\n## \uD83D\uDD17 Links\n\n- **Specification:** [.opensource spec](https://github.com/opensource-showcase/spec)\n- **CLI Tool:** [opensource-showcase](https://github.com/opensource-showcase/cli)\n\n---\n\n<div align=\"center\">\n <sub>Generated with \u2764\uFE0F by <a href=\"https://github.com/opensource-showcase/cli\">opensource-showcase CLI</a></sub>\n</div>\n";
22
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,eAAO,MAAM,QAAQ,wBAAwB,CAAC;AAC9C,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAChD,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAClD,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AACvD,eAAO,MAAM,WAAW,8BAA8B,CAAC;AACvD,eAAO,MAAM,WAAW,cAAc,CAAC;AAEvC,eAAO,MAAM,aAAa,uCAAwC,CAAC;AAEnE,eAAO,MAAM,cAAc,EAAE,UAY5B,CAAC;AAEF,eAAO,MAAM,YAAY,QAAQ,CAAC;AAElC,eAAO,MAAM,WAAW,0GAMd,CAAC;AAEX,eAAO,MAAM,cAAc;;;;;CAKjB,CAAC;AAEX,eAAO,MAAM,eAAe,+jCA6C3B,CAAC"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Application-wide constants
3
+ */
4
+ export const APP_NAME = 'opensource-showcase';
5
+ export const CONFIG_FILE_NAME = '.opensourcerc';
6
+ export const OPENSOURCE_REPO_NAME = '.opensource';
7
+ export const CONTRIBUTIONS_FILE = 'contributions.json';
8
+ export const BACKUP_FILE = 'contributions.backup.json';
9
+ export const README_FILE = 'README.md';
10
+ export const GITHUB_SCOPES = ['public_repo', 'read:user'];
11
+ export const DEFAULT_CONFIG = {
12
+ minStars: 5,
13
+ excludeTitlePatterns: [
14
+ 'fix typo',
15
+ 'update dependencies',
16
+ 'bump',
17
+ 'chore:',
18
+ 'minor fix',
19
+ 'update readme',
20
+ ],
21
+ excludeBotPRs: true,
22
+ excludeOwnRepos: true,
23
+ };
24
+ export const SPEC_VERSION = '1.0';
25
+ export const BOT_AUTHORS = [
26
+ 'dependabot[bot]',
27
+ 'renovate[bot]',
28
+ 'dependabot-preview[bot]',
29
+ 'snyk-bot',
30
+ 'greenkeeper[bot]',
31
+ ];
32
+ export const FILTER_REASONS = {
33
+ LOW_STARS: 'low_stars',
34
+ JUNK_TITLE: 'junk_title',
35
+ BOT_PR: 'bot_pr',
36
+ OWN_REPO: 'own_repo',
37
+ };
38
+ export const README_TEMPLATE = `# .opensource
39
+
40
+ > 📦 My curated open source contributions
41
+
42
+ This repository follows the [\`.opensource\` specification](https://github.com/opensource-showcase/spec) - a standardized format for showcasing open source contributions.
43
+
44
+ ---
45
+
46
+ ## 📊 Statistics
47
+
48
+ <!--STATS_START-->
49
+ - **Total Contributions:** 0
50
+ - **Languages:** 0
51
+ - **Repositories:** 0
52
+ <!--STATS_END-->
53
+
54
+ ---
55
+
56
+ ## 🌟 Featured Contributions
57
+
58
+ <!--CONTRIBUTIONS_START-->
59
+ ### No contributions yet
60
+
61
+ Run \`opensource-showcase\` to add your contributions!
62
+ <!--CONTRIBUTIONS_END-->
63
+
64
+ ---
65
+
66
+ ## 📁 File Structure
67
+
68
+ - \`contributions.json\` - Machine-readable contribution data
69
+ - \`README.md\` - This file
70
+
71
+ ---
72
+
73
+ ## 🔗 Links
74
+
75
+ - **Specification:** [.opensource spec](https://github.com/opensource-showcase/spec)
76
+ - **CLI Tool:** [opensource-showcase](https://github.com/opensource-showcase/cli)
77
+
78
+ ---
79
+
80
+ <div align="center">
81
+ <sub>Generated with ❤️ by <a href="https://github.com/opensource-showcase/cli">opensource-showcase CLI</a></sub>
82
+ </div>
83
+ `;
84
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,CAAC,MAAM,QAAQ,GAAG,qBAAqB,CAAC;AAC9C,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAChD,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAClD,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AACvD,MAAM,CAAC,MAAM,WAAW,GAAG,2BAA2B,CAAC;AACvD,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC;AAEvC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,aAAa,EAAE,WAAW,CAAU,CAAC;AAEnE,MAAM,CAAC,MAAM,cAAc,GAAe;IACxC,QAAQ,EAAE,CAAC;IACX,oBAAoB,EAAE;QACpB,UAAU;QACV,qBAAqB;QACrB,MAAM;QACN,QAAQ;QACR,WAAW;QACX,eAAe;KAChB;IACD,aAAa,EAAE,IAAI;IACnB,eAAe,EAAE,IAAI;CACtB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,iBAAiB;IACjB,eAAe;IACf,yBAAyB;IACzB,UAAU;IACV,kBAAkB;CACV,CAAC;AAEX,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;IACxB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;CACZ,CAAC;AAEX,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6C9B,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Smart filtering logic for contributions
3
+ */
4
+ import type { EnrichedContribution, ContributionWithFilter, FilterResult, UserConfig } from '../types/index.js';
5
+ /**
6
+ * Filter a single contribution based on config
7
+ */
8
+ export declare function filterContribution(contribution: EnrichedContribution, config: UserConfig, username: string): FilterResult;
9
+ /**
10
+ * Apply filters to all contributions
11
+ */
12
+ export declare function applyFilters(contributions: EnrichedContribution[], config: UserConfig, username: string, skipFilters?: boolean): ContributionWithFilter[];
13
+ /**
14
+ * Get filter reason as human-readable text
15
+ */
16
+ export declare function getFilterReasonText(reason?: string): string;
17
+ /**
18
+ * Get filter statistics
19
+ */
20
+ export declare function getFilterStats(contributions: ContributionWithFilter[]): {
21
+ total: number;
22
+ filtered: number;
23
+ shown: number;
24
+ byReason: Record<string, number>;
25
+ };
26
+ /**
27
+ * Sort contributions by importance
28
+ * Priority: repo stars desc, then merge date desc
29
+ */
30
+ export declare function sortContributions(contributions: EnrichedContribution[]): EnrichedContribution[];
31
+ //# sourceMappingURL=filter-prs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-prs.d.ts","sourceRoot":"","sources":["../../src/filter/filter-prs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,YAAY,EACZ,UAAU,EACX,MAAM,mBAAmB,CAAC;AAqB3B;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,oBAAoB,EAClC,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,MAAM,GACf,YAAY,CAqCd;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,aAAa,EAAE,oBAAoB,EAAE,EACrC,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,MAAM,EAChB,WAAW,UAAQ,GAClB,sBAAsB,EAAE,CAgB1B;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAa3D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,aAAa,EAAE,sBAAsB,EAAE,GAAG;IACvE,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC,CAeA;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,oBAAoB,EAAE,GACpC,oBAAoB,EAAE,CASxB"}
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Smart filtering logic for contributions
3
+ */
4
+ import { FILTER_REASONS } from '../constants.js';
5
+ /**
6
+ * Check if PR title matches junk patterns
7
+ */
8
+ function isJunkTitle(title, patterns) {
9
+ const lowerTitle = title.toLowerCase();
10
+ return patterns.some((pattern) => lowerTitle.includes(pattern.toLowerCase()));
11
+ }
12
+ /**
13
+ * Check if PR is from a bot
14
+ */
15
+ function isBotPR(contribution) {
16
+ // Check if any label indicates bot
17
+ const botLabels = ['dependencies', 'dependabot', 'renovate', 'automated'];
18
+ return contribution.labels.some((label) => botLabels.some((botLabel) => label.toLowerCase().includes(botLabel)));
19
+ }
20
+ /**
21
+ * Filter a single contribution based on config
22
+ */
23
+ export function filterContribution(contribution, config, username) {
24
+ // Check if it's user's own repo
25
+ if (config.excludeOwnRepos) {
26
+ const [owner] = contribution.repo.split('/');
27
+ if (owner?.toLowerCase() === username.toLowerCase()) {
28
+ return {
29
+ filtered: true,
30
+ reason: FILTER_REASONS.OWN_REPO,
31
+ };
32
+ }
33
+ }
34
+ // Check star count
35
+ if (contribution.repo_stars < config.minStars) {
36
+ return {
37
+ filtered: true,
38
+ reason: FILTER_REASONS.LOW_STARS,
39
+ };
40
+ }
41
+ // Check for junk titles
42
+ if (isJunkTitle(contribution.pr_title, config.excludeTitlePatterns)) {
43
+ return {
44
+ filtered: true,
45
+ reason: FILTER_REASONS.JUNK_TITLE,
46
+ };
47
+ }
48
+ // Check for bot PRs
49
+ if (config.excludeBotPRs && isBotPR(contribution)) {
50
+ return {
51
+ filtered: true,
52
+ reason: FILTER_REASONS.BOT_PR,
53
+ };
54
+ }
55
+ return { filtered: false };
56
+ }
57
+ /**
58
+ * Apply filters to all contributions
59
+ */
60
+ export function applyFilters(contributions, config, username, skipFilters = false) {
61
+ if (skipFilters) {
62
+ return contributions.map((c) => ({
63
+ ...c,
64
+ filtered: false,
65
+ }));
66
+ }
67
+ return contributions.map((contribution) => {
68
+ const filterResult = filterContribution(contribution, config, username);
69
+ return {
70
+ ...contribution,
71
+ filtered: filterResult.filtered,
72
+ filterReason: filterResult.reason,
73
+ };
74
+ });
75
+ }
76
+ /**
77
+ * Get filter reason as human-readable text
78
+ */
79
+ export function getFilterReasonText(reason) {
80
+ switch (reason) {
81
+ case FILTER_REASONS.LOW_STARS:
82
+ return 'Low stars';
83
+ case FILTER_REASONS.JUNK_TITLE:
84
+ return 'Trivial title';
85
+ case FILTER_REASONS.BOT_PR:
86
+ return 'Bot PR';
87
+ case FILTER_REASONS.OWN_REPO:
88
+ return 'Own repository';
89
+ default:
90
+ return 'Filtered';
91
+ }
92
+ }
93
+ /**
94
+ * Get filter statistics
95
+ */
96
+ export function getFilterStats(contributions) {
97
+ const filtered = contributions.filter((c) => c.filtered);
98
+ const byReason = {};
99
+ filtered.forEach((c) => {
100
+ const reason = c.filterReason ?? 'unknown';
101
+ byReason[reason] = (byReason[reason] ?? 0) + 1;
102
+ });
103
+ return {
104
+ total: contributions.length,
105
+ filtered: filtered.length,
106
+ shown: contributions.length - filtered.length,
107
+ byReason,
108
+ };
109
+ }
110
+ /**
111
+ * Sort contributions by importance
112
+ * Priority: repo stars desc, then merge date desc
113
+ */
114
+ export function sortContributions(contributions) {
115
+ return [...contributions].sort((a, b) => {
116
+ // First sort by stars (desc)
117
+ if (b.repo_stars !== a.repo_stars) {
118
+ return b.repo_stars - a.repo_stars;
119
+ }
120
+ // Then by merge date (desc)
121
+ return new Date(b.merged_at).getTime() - new Date(a.merged_at).getTime();
122
+ });
123
+ }
124
+ //# sourceMappingURL=filter-prs.js.map
@@ -0,0 +1 @@
1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AC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC;IAC3E,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Fetch merged Pull Requests from GitHub
3
+ */
4
+ import type { Octokit } from '@octokit/rest';
5
+ import type { PullRequest, Repository, EnrichedContribution, ProgressCallback } from '../types/index.js';
6
+ interface SearchPRsOptions {
7
+ username: string;
8
+ since?: string;
9
+ onProgress?: ProgressCallback;
10
+ }
11
+ /**
12
+ * Fetch all merged PRs for a user using GitHub Search API
13
+ */
14
+ export declare function fetchMergedPRs(octokit: Octokit, options: SearchPRsOptions): Promise<PullRequest[]>;
15
+ /**
16
+ * Fetch repository details for a given repo
17
+ */
18
+ export declare function fetchRepository(octokit: Octokit, owner: string, repo: string): Promise<Repository>;
19
+ /**
20
+ * Fetch PR details including additions, deletions, files changed, and body
21
+ */
22
+ export declare function fetchPRDetails(octokit: Octokit, owner: string, repo: string, prNumber: number): Promise<Pick<PullRequest, 'additions' | 'deletions' | 'changed_files' | 'labels'> & {
23
+ body: string | null;
24
+ }>;
25
+ /**
26
+ * Enrich PRs with repository metadata
27
+ */
28
+ export declare function enrichPRsWithMetadata(octokit: Octokit, prs: PullRequest[]): Promise<EnrichedContribution[]>;
29
+ export {};
30
+ //# sourceMappingURL=fetch-prs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-prs.d.ts","sourceRoot":"","sources":["../../src/github/fetch-prs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAI7C,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B,UAAU,gBAAgB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,WAAW,EAAE,CAAC,CAoExB;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,UAAU,CAAC,CA2BrB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,WAAW,GAAG,eAAe,GAAG,QAAQ,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CA2B9G;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,WAAW,EAAE,GACjB,OAAO,CAAC,oBAAoB,EAAE,CAAC,CA8DjC"}