gitfamiliar 0.4.0 → 0.7.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.
@@ -341,30 +341,17 @@ async function getLastCommitDate(gitClient, user, filePath) {
341
341
  }
342
342
 
343
343
  // src/scoring/binary.ts
344
- function scoreBinary(tree, writtenFiles, reviewedFiles, filterMode, expiredFiles) {
344
+ function scoreBinary(tree, writtenFiles, expiredFiles) {
345
345
  walkFiles(tree, (file) => {
346
346
  const isWritten = writtenFiles.has(file.path);
347
- const isReviewed = reviewedFiles.has(file.path) && !writtenFiles.has(file.path);
348
347
  const isExpired2 = expiredFiles?.has(file.path) ?? false;
349
348
  file.isWritten = isWritten;
350
- file.isReviewed = isReviewed;
351
349
  file.isExpired = isExpired2;
352
350
  if (isExpired2) {
353
351
  file.score = 0;
354
352
  return;
355
353
  }
356
- switch (filterMode) {
357
- case "written":
358
- file.score = isWritten ? 1 : 0;
359
- break;
360
- case "reviewed":
361
- file.score = isReviewed ? 1 : 0;
362
- break;
363
- case "all":
364
- default:
365
- file.score = isWritten || isReviewed ? 1 : 0;
366
- break;
367
- }
354
+ file.score = isWritten ? 1 : 0;
368
355
  });
369
356
  recomputeFolderScores(tree, "binary");
370
357
  }
@@ -447,15 +434,6 @@ async function scoreAuthorship(tree, gitClient, user) {
447
434
  recomputeFolderScores(tree, "continuous");
448
435
  }
449
436
 
450
- // src/scoring/review-coverage.ts
451
- function scoreReviewCoverage(tree, reviewedFiles) {
452
- walkFiles(tree, (file) => {
453
- file.isReviewed = reviewedFiles.has(file.path);
454
- file.score = file.isReviewed ? 1 : 0;
455
- });
456
- recomputeFolderScores(tree, "binary");
457
- }
458
-
459
437
  // src/utils/math.ts
460
438
  function sigmoid(x, k = 0.3) {
461
439
  if (x <= 0) return 0;
@@ -466,10 +444,6 @@ function recencyDecay(days, halfLife = 180) {
466
444
  const lambda = Math.LN2 / halfLife;
467
445
  return Math.exp(-lambda * days);
468
446
  }
469
- function scopeFactor(filesInPR, attentionThreshold = 20) {
470
- if (filesInPR <= 0) return 1;
471
- return Math.min(1, attentionThreshold / filesInPR);
472
- }
473
447
  function normalizedDiff(added, deleted, fileSize) {
474
448
  if (fileSize <= 0) return 0;
475
449
  return (added + 0.5 * deleted) / fileSize;
@@ -480,11 +454,6 @@ function daysBetween(a, b) {
480
454
  }
481
455
 
482
456
  // src/scoring/weighted.ts
483
- var REVIEW_BASE_WEIGHTS = {
484
- approved: 0.3,
485
- commented: 0.15,
486
- changes_requested: 0.35
487
- };
488
457
  function calculateCommitScore(commits, now) {
489
458
  let raw = 0;
490
459
  for (const c of commits) {
@@ -493,25 +462,15 @@ function calculateCommitScore(commits, now) {
493
462
  }
494
463
  return Math.min(1, raw);
495
464
  }
496
- function calculateReviewScore(reviews, now) {
497
- if (!reviews) return 0;
498
- let raw = 0;
499
- for (const r of reviews) {
500
- const baseWeight = REVIEW_BASE_WEIGHTS[r.type] || 0.15;
501
- raw += baseWeight * scopeFactor(r.filesInPR) * recencyDecay(daysBetween(now, r.date));
502
- }
503
- return Math.min(1, raw);
504
- }
505
- async function scoreWeighted(tree, gitClient, user, weights, reviewData, now) {
465
+ async function scoreWeighted(tree, gitClient, user, weights, now) {
506
466
  const currentDate = now || /* @__PURE__ */ new Date();
507
467
  const files = [];
508
468
  walkFiles(tree, (file) => {
509
469
  files.push({
510
470
  path: file.path,
511
- setScores: (b, c, r, total) => {
471
+ setScores: (b, c, total) => {
512
472
  file.blameScore = b;
513
473
  file.commitScore = c;
514
- file.reviewScore = r;
515
474
  file.score = total;
516
475
  }
517
476
  });
@@ -527,12 +486,8 @@ async function scoreWeighted(tree, gitClient, user, weights, reviewData, now) {
527
486
  await getDetailedCommits(gitClient, user, path),
528
487
  currentDate
529
488
  );
530
- const reviewScore = calculateReviewScore(
531
- reviewData?.get(path),
532
- currentDate
533
- );
534
- const total = weights.blame * blameScore + weights.commit * commitScore + weights.review * reviewScore;
535
- setScores(blameScore, commitScore, reviewScore, total);
489
+ const total = weights.blame * blameScore + weights.commit * commitScore;
490
+ setScores(blameScore, commitScore, total);
536
491
  });
537
492
  recomputeFolderScores(tree, "continuous");
538
493
  }
@@ -645,193 +600,6 @@ async function getExpiredFiles(gitClient, files, user, config) {
645
600
  return expiredSet;
646
601
  }
647
602
 
648
- // src/github/client.ts
649
- var GitHubClient = class {
650
- token;
651
- baseUrl;
652
- constructor(token, apiBaseUrl = "https://api.github.com") {
653
- this.token = token;
654
- this.baseUrl = apiBaseUrl.replace(/\/+$/, "");
655
- }
656
- async fetch(path) {
657
- const url = `${this.baseUrl}${path}`;
658
- const response = await fetch(url, {
659
- headers: {
660
- Authorization: `Bearer ${this.token}`,
661
- Accept: "application/vnd.github.v3+json",
662
- "User-Agent": "gitfamiliar"
663
- }
664
- });
665
- if (!response.ok) {
666
- if (response.status === 403) {
667
- throw new Error(
668
- "GitHub API rate limit exceeded. Please wait or use a token with higher limits."
669
- );
670
- }
671
- throw new Error(
672
- `GitHub API error: ${response.status} ${response.statusText}`
673
- );
674
- }
675
- return response.json();
676
- }
677
- /**
678
- * Verify API connectivity by fetching the authenticated user.
679
- */
680
- async verifyConnection() {
681
- const user = await this.fetch("/user");
682
- return { login: user.login, name: user.name };
683
- }
684
- /**
685
- * Parse owner/repo/hostname from a git remote URL.
686
- * Supports github.com and GitHub Enterprise hosts.
687
- */
688
- static parseRemoteUrl(url, overrideHostname) {
689
- let hostname;
690
- let owner;
691
- let repo;
692
- let match = url.match(/git@([^:]+):([^/]+)\/([^/.]+)(\.git)?$/);
693
- if (match) {
694
- hostname = match[1];
695
- owner = match[2];
696
- repo = match[3];
697
- } else if (
698
- // SSH URL format: ssh://git@hostname(:port)?/owner/repo.git
699
- match = url.match(
700
- /ssh:\/\/[^@]+@([^:/]+)(?::\d+)?\/([^/]+)\/([^/.]+?)(\.git)?$/
701
- )
702
- ) {
703
- hostname = match[1];
704
- owner = match[2];
705
- repo = match[3];
706
- } else if (
707
- // HTTPS format: https://hostname(:port)?/owner/repo.git
708
- match = url.match(
709
- /https?:\/\/([^/:]+)(?::\d+)?\/([^/]+)\/([^/.]+?)(\.git)?$/
710
- )
711
- ) {
712
- hostname = match[1];
713
- owner = match[2];
714
- repo = match[3];
715
- } else {
716
- return null;
717
- }
718
- if (overrideHostname) {
719
- hostname = overrideHostname;
720
- }
721
- const apiBaseUrl = hostname === "github.com" ? "https://api.github.com" : `https://${hostname}/api/v3`;
722
- return { hostname, owner, repo, apiBaseUrl };
723
- }
724
- /**
725
- * Get all files reviewed by a user across all PRs they reviewed.
726
- */
727
- async getReviewedFiles(owner, repo, username) {
728
- const reviewedFiles = /* @__PURE__ */ new Map();
729
- let page = 1;
730
- const perPage = 100;
731
- while (true) {
732
- const searchResult = await this.fetch(
733
- `/search/issues?q=type:pr+repo:${owner}/${repo}+reviewed-by:${username}&per_page=${perPage}&page=${page}`
734
- );
735
- if (!searchResult.items || searchResult.items.length === 0) break;
736
- for (const item of searchResult.items) {
737
- const prNumber = item.number;
738
- const reviews = await this.fetch(
739
- `/repos/${owner}/${repo}/pulls/${prNumber}/reviews`
740
- );
741
- const userReviews = reviews.filter(
742
- (r) => r.user?.login?.toLowerCase() === username.toLowerCase()
743
- );
744
- if (userReviews.length === 0) continue;
745
- const prFiles = await this.fetch(
746
- `/repos/${owner}/${repo}/pulls/${prNumber}/files?per_page=100`
747
- );
748
- const fileCount = prFiles.length;
749
- for (const review of userReviews) {
750
- const reviewType = mapReviewState(review.state);
751
- const reviewDate = new Date(review.submitted_at);
752
- for (const prFile of prFiles) {
753
- const filePath = prFile.filename;
754
- const info = {
755
- date: reviewDate,
756
- type: reviewType,
757
- filesInPR: fileCount
758
- };
759
- if (reviewedFiles.has(filePath)) {
760
- reviewedFiles.get(filePath).push(info);
761
- } else {
762
- reviewedFiles.set(filePath, [info]);
763
- }
764
- }
765
- }
766
- }
767
- if (searchResult.items.length < perPage) break;
768
- page++;
769
- }
770
- return reviewedFiles;
771
- }
772
- };
773
- function mapReviewState(state) {
774
- switch (state.toUpperCase()) {
775
- case "APPROVED":
776
- return "approved";
777
- case "CHANGES_REQUESTED":
778
- return "changes_requested";
779
- default:
780
- return "commented";
781
- }
782
- }
783
-
784
- // src/github/auth.ts
785
- import { execSync } from "child_process";
786
- function resolveGitHubToken(hostname) {
787
- if (process.env.GITHUB_TOKEN) return process.env.GITHUB_TOKEN;
788
- if (process.env.GH_TOKEN) return process.env.GH_TOKEN;
789
- try {
790
- const host = hostname || "github.com";
791
- const token = execSync(`gh auth token --hostname ${host}`, {
792
- encoding: "utf-8",
793
- stdio: ["pipe", "pipe", "pipe"]
794
- }).trim();
795
- if (token) return token;
796
- } catch {
797
- }
798
- if (hostname && hostname !== "github.com") {
799
- try {
800
- const token = execSync("gh auth token", {
801
- encoding: "utf-8",
802
- stdio: ["pipe", "pipe", "pipe"]
803
- }).trim();
804
- if (token) return token;
805
- } catch {
806
- }
807
- }
808
- return null;
809
- }
810
-
811
- // src/github/reviews.ts
812
- async function fetchReviewData(gitClient, username, githubUrl) {
813
- const remoteUrl = await gitClient.getRemoteUrl();
814
- if (!remoteUrl) return null;
815
- const parsed = GitHubClient.parseRemoteUrl(remoteUrl, githubUrl);
816
- if (!parsed) return null;
817
- const token = resolveGitHubToken(parsed.hostname);
818
- if (!token) return null;
819
- if (!username) return null;
820
- const ghUsername = username;
821
- try {
822
- const githubClient = new GitHubClient(token, parsed.apiBaseUrl);
823
- const reviewedFiles = await githubClient.getReviewedFiles(
824
- parsed.owner,
825
- parsed.repo,
826
- ghUsername
827
- );
828
- const reviewedFileSet = new Set(reviewedFiles.keys());
829
- return { reviewedFiles, reviewedFileSet };
830
- } catch {
831
- return null;
832
- }
833
- }
834
-
835
603
  // src/core/familiarity.ts
836
604
  async function computeFamiliarity(options) {
837
605
  const gitClient = new GitClient(options.repoPath);
@@ -845,19 +613,6 @@ async function computeFamiliarity(options) {
845
613
  const filter = createFilter(repoRoot);
846
614
  const tree = await buildFileTree(gitClient, filter);
847
615
  const writtenFiles = await getFilesCommittedByUser(gitClient, user);
848
- let reviewData;
849
- let reviewedFileSet = /* @__PURE__ */ new Set();
850
- if (options.mode !== "authorship") {
851
- const reviewResult = await fetchReviewData(
852
- gitClient,
853
- userFlag,
854
- options.githubUrl
855
- );
856
- if (reviewResult) {
857
- reviewData = reviewResult.reviewedFiles;
858
- reviewedFileSet = reviewResult.reviewedFileSet;
859
- }
860
- }
861
616
  let expiredFiles;
862
617
  if (options.expiration.policy !== "never") {
863
618
  const allFiles = [];
@@ -871,27 +626,13 @@ async function computeFamiliarity(options) {
871
626
  }
872
627
  switch (options.mode) {
873
628
  case "binary":
874
- scoreBinary(
875
- tree,
876
- writtenFiles,
877
- reviewedFileSet,
878
- options.filter,
879
- expiredFiles
880
- );
629
+ scoreBinary(tree, writtenFiles, expiredFiles);
881
630
  break;
882
631
  case "authorship":
883
632
  await scoreAuthorship(tree, gitClient, user);
884
633
  break;
885
- case "review-coverage":
886
- if (reviewedFileSet.size === 0) {
887
- console.error(
888
- "Warning: No review data available. Set GITHUB_TOKEN or use --user with your GitHub username."
889
- );
890
- }
891
- scoreReviewCoverage(tree, reviewedFileSet);
892
- break;
893
634
  case "weighted":
894
- await scoreWeighted(tree, gitClient, user, options.weights, reviewData);
635
+ await scoreWeighted(tree, gitClient, user, options.weights);
895
636
  break;
896
637
  }
897
638
  return {
@@ -899,26 +640,16 @@ async function computeFamiliarity(options) {
899
640
  repoName,
900
641
  userName: user.name || user.email,
901
642
  mode: options.mode,
902
- ...computeSummary(tree, writtenFiles, reviewedFileSet),
643
+ writtenCount: countWritten(tree, writtenFiles),
903
644
  totalFiles: tree.fileCount
904
645
  };
905
646
  }
906
- function computeSummary(tree, writtenFiles, reviewedFileSet) {
907
- let writtenOnly = 0;
908
- let reviewedOnly = 0;
909
- let both = 0;
647
+ function countWritten(tree, writtenFiles) {
648
+ let count = 0;
910
649
  walkFiles(tree, (file) => {
911
- const w = writtenFiles.has(file.path);
912
- const r = reviewedFileSet.has(file.path);
913
- if (w && r) both++;
914
- else if (w) writtenOnly++;
915
- else if (r) reviewedOnly++;
650
+ if (writtenFiles.has(file.path)) count++;
916
651
  });
917
- return {
918
- writtenCount: writtenOnly + both,
919
- reviewedCount: reviewedOnly + both,
920
- bothCount: both
921
- };
652
+ return count;
922
653
  }
923
654
 
924
655
  export {
@@ -929,8 +660,6 @@ export {
929
660
  walkFiles,
930
661
  processBatch,
931
662
  parseExpirationConfig,
932
- GitHubClient,
933
- resolveGitHubToken,
934
663
  computeFamiliarity
935
664
  };
936
- //# sourceMappingURL=chunk-V27FX6R6.js.map
665
+ //# sourceMappingURL=chunk-BQCHOSLA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/git/client.ts","../src/git/identity.ts","../src/filter/ignore.ts","../src/filter/defaults.ts","../src/utils/line-count.ts","../src/core/file-tree.ts","../src/git/log.ts","../src/scoring/binary.ts","../src/git/blame.ts","../src/utils/batch.ts","../src/scoring/authorship.ts","../src/utils/math.ts","../src/scoring/weighted.ts","../src/git/diff.ts","../src/scoring/expiration.ts","../src/core/familiarity.ts"],"sourcesContent":["import simpleGit, { type SimpleGit } from 'simple-git';\n\nexport class GitClient {\n private git: SimpleGit;\n readonly repoPath: string;\n\n constructor(repoPath: string) {\n this.repoPath = repoPath;\n this.git = simpleGit(repoPath);\n }\n\n async isRepo(): Promise<boolean> {\n return this.git.checkIsRepo();\n }\n\n async getRepoRoot(): Promise<string> {\n return (await this.git.revparse(['--show-toplevel'])).trim();\n }\n\n async getRepoName(): Promise<string> {\n const root = await this.getRepoRoot();\n return root.split('/').pop() || 'unknown';\n }\n\n async listFiles(): Promise<string[]> {\n const result = await this.git.raw(['ls-files']);\n return result.trim().split('\\n').filter(Boolean);\n }\n\n async getUserName(): Promise<string> {\n return (await this.git.raw(['config', 'user.name'])).trim();\n }\n\n async getUserEmail(): Promise<string> {\n return (await this.git.raw(['config', 'user.email'])).trim();\n }\n\n async getLog(args: string[]): Promise<string> {\n return this.git.raw(['log', ...args]);\n }\n\n async blame(filePath: string, options: string[] = []): Promise<string> {\n return this.git.raw(['blame', ...options, '--', filePath]);\n }\n\n async diff(args: string[]): Promise<string> {\n return this.git.raw(['diff', ...args]);\n }\n\n async show(args: string[]): Promise<string> {\n return this.git.raw(['show', ...args]);\n }\n\n async raw(args: string[]): Promise<string> {\n return this.git.raw(args);\n }\n\n async getRemoteUrl(): Promise<string | null> {\n try {\n const result = await this.git.raw(['remote', 'get-url', 'origin']);\n return result.trim();\n } catch {\n return null;\n }\n }\n}\n","import type { GitClient } from \"./client.js\";\nimport type { UserIdentity } from \"../core/types.js\";\n\nexport async function resolveUser(\n gitClient: GitClient,\n userFlag?: string,\n): Promise<UserIdentity> {\n if (userFlag) {\n // If it looks like an email, use it as email; otherwise as name\n if (userFlag.includes(\"@\")) {\n return { name: userFlag, email: userFlag };\n }\n return { name: userFlag, email: userFlag };\n }\n\n const name = await gitClient.getUserName();\n const email = await gitClient.getUserEmail();\n\n if (!name && !email) {\n throw new Error(\n \"Could not determine git user. Set git config user.name/user.email or use --user flag.\",\n );\n }\n\n return { name, email };\n}\n\n/**\n * Build git --author args for a user identity.\n */\nexport function getAuthorArgs(user: UserIdentity): string[] {\n return [\"--author\", user.email || user.name];\n}\n\nexport function matchesUser(\n authorName: string,\n authorEmail: string,\n user: UserIdentity,\n): boolean {\n // Match by email (primary) or name (fallback)\n if (user.email && authorEmail) {\n if (authorEmail.toLowerCase() === user.email.toLowerCase()) return true;\n }\n if (user.name && authorName) {\n if (authorName.toLowerCase() === user.name.toLowerCase()) return true;\n }\n return false;\n}\n","import ignore from 'ignore';\nimport { readFileSync, existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { DEFAULT_IGNORE_PATTERNS } from './defaults.js';\n\nexport type FileFilter = (filePath: string) => boolean;\n\n/**\n * Create a file filter based on .gitfamiliarignore patterns.\n * Returns a function that returns true if the file should be INCLUDED.\n */\nexport function createFilter(repoRoot: string): FileFilter {\n const ig = ignore();\n\n const ignorePath = join(repoRoot, '.gitfamiliarignore');\n\n if (existsSync(ignorePath)) {\n const content = readFileSync(ignorePath, 'utf-8');\n ig.add(content);\n } else {\n ig.add(DEFAULT_IGNORE_PATTERNS);\n }\n\n return (filePath: string) => !ig.ignores(filePath);\n}\n","export const DEFAULT_IGNORE_PATTERNS = `# Lock files\npackage-lock.json\nyarn.lock\npnpm-lock.yaml\nGemfile.lock\npoetry.lock\nCargo.lock\ncomposer.lock\n\n# Auto-generated\n*.generated.*\n*.min.js\n*.min.css\n*.map\n\n# Build outputs (if git-tracked)\ndist/\nbuild/\n.next/\n\n# Config that rarely needs understanding\n.eslintrc*\n.prettierrc*\ntsconfig.json\n`;\n","import { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\n/**\n * Count lines in a file. Returns 0 for binary or unreadable files.\n */\nexport function countLines(repoRoot: string, filePath: string): number {\n try {\n const fullPath = join(repoRoot, filePath);\n const content = readFileSync(fullPath, 'utf-8');\n if (content.length === 0) return 0;\n return content.split('\\n').length;\n } catch {\n return 0;\n }\n}\n","import type { GitClient } from '../git/client.js';\nimport type { FileFilter } from '../filter/ignore.js';\nimport type { FolderScore, FileScore, TreeNode } from './types.js';\nimport { countLines } from '../utils/line-count.js';\n\n/**\n * Build a hierarchical file tree from git-tracked files.\n */\nexport async function buildFileTree(\n gitClient: GitClient,\n filter: FileFilter,\n): Promise<FolderScore> {\n const repoRoot = await gitClient.getRepoRoot();\n const allFiles = await gitClient.listFiles();\n const filteredFiles = allFiles.filter(filter);\n\n // Build flat file scores\n const fileScores: FileScore[] = filteredFiles.map((filePath) => ({\n type: 'file' as const,\n path: filePath,\n lines: countLines(repoRoot, filePath),\n score: 0,\n }));\n\n // Build tree structure\n return buildTreeFromFiles(fileScores);\n}\n\nfunction buildTreeFromFiles(files: FileScore[]): FolderScore {\n const root: FolderScore = {\n type: 'folder',\n path: '',\n lines: 0,\n score: 0,\n fileCount: 0,\n children: [],\n };\n\n // Group files by directory path\n const folderMap = new Map<string, FolderScore>();\n folderMap.set('', root);\n\n for (const file of files) {\n const parts = file.path.split('/');\n let currentPath = '';\n\n // Ensure all ancestor folders exist\n for (let i = 0; i < parts.length - 1; i++) {\n const parentPath = currentPath;\n currentPath = currentPath ? `${currentPath}/${parts[i]}` : parts[i];\n\n if (!folderMap.has(currentPath)) {\n const folder: FolderScore = {\n type: 'folder',\n path: currentPath,\n lines: 0,\n score: 0,\n fileCount: 0,\n children: [],\n };\n folderMap.set(currentPath, folder);\n\n // Add to parent\n const parent = folderMap.get(parentPath)!;\n parent.children.push(folder);\n }\n }\n\n // Add file to its parent folder\n const parentPath = parts.length > 1 ? parts.slice(0, -1).join('/') : '';\n const parent = folderMap.get(parentPath)!;\n parent.children.push(file);\n }\n\n // Calculate aggregate line counts and file counts\n computeAggregates(root);\n\n return root;\n}\n\nfunction computeAggregates(node: FolderScore): void {\n let totalLines = 0;\n let totalFiles = 0;\n\n for (const child of node.children) {\n if (child.type === 'file') {\n totalLines += child.lines;\n totalFiles += 1;\n } else {\n computeAggregates(child);\n totalLines += child.lines;\n totalFiles += child.fileCount;\n }\n }\n\n node.lines = totalLines;\n node.fileCount = totalFiles;\n}\n\n/**\n * Walk all files in a tree, calling the visitor on each FileScore.\n */\nexport function walkFiles(\n node: TreeNode,\n visitor: (file: FileScore) => void,\n): void {\n if (node.type === 'file') {\n visitor(node);\n } else {\n for (const child of node.children) {\n walkFiles(child, visitor);\n }\n }\n}\n\n/**\n * Recompute folder scores after file scores have been updated.\n * For binary mode: score = readCount / fileCount\n * For other modes: score = weighted average by line count\n */\nexport function recomputeFolderScores(\n node: FolderScore,\n mode: 'binary' | 'continuous',\n): void {\n let readCount = 0;\n let totalFiles = 0;\n let weightedScore = 0;\n let totalLines = 0;\n\n for (const child of node.children) {\n if (child.type === 'file') {\n totalFiles += 1;\n totalLines += child.lines;\n weightedScore += child.score * child.lines;\n if (child.score > 0) readCount += 1;\n } else {\n recomputeFolderScores(child, mode);\n totalFiles += child.fileCount;\n totalLines += child.lines;\n weightedScore += child.score * child.lines;\n readCount += child.readCount || 0;\n }\n }\n\n node.fileCount = totalFiles;\n node.readCount = readCount;\n\n if (mode === 'binary') {\n node.score = totalFiles > 0 ? readCount / totalFiles : 0;\n } else {\n node.score = totalLines > 0 ? weightedScore / totalLines : 0;\n }\n}\n","import type { GitClient } from \"./client.js\";\nimport type { UserIdentity, CommitInfo } from \"../core/types.js\";\nimport { getAuthorArgs } from \"./identity.js\";\n\n/**\n * Get the set of files that a user has committed to (any commit, any time).\n * Used for Binary mode.\n */\nexport async function getFilesCommittedByUser(\n gitClient: GitClient,\n user: UserIdentity,\n): Promise<Set<string>> {\n const files = new Set<string>();\n\n // Query by both email and name to catch alias mismatches\n const queries: string[][] = [];\n if (user.email) {\n queries.push([\"--author\", user.email]);\n }\n if (user.name && user.name !== user.email) {\n queries.push([\"--author\", user.name]);\n }\n\n for (const authorArgs of queries) {\n try {\n const output = await gitClient.getLog([\n ...authorArgs,\n \"--name-only\",\n \"--pretty=format:\",\n \"--all\",\n ]);\n for (const line of output.split(\"\\n\")) {\n const trimmed = line.trim();\n if (trimmed) {\n files.add(trimmed);\n }\n }\n } catch {\n // Skip if no commits found\n }\n }\n\n return files;\n}\n\n/**\n * Get detailed commit information for a specific file by a specific user.\n * Used for Weighted mode's commit_score.\n */\nexport async function getDetailedCommits(\n gitClient: GitClient,\n user: UserIdentity,\n filePath: string,\n): Promise<CommitInfo[]> {\n const commits: CommitInfo[] = [];\n\n try {\n const output = await gitClient.getLog([\n ...getAuthorArgs(user),\n \"--numstat\",\n \"--pretty=format:%H|%aI\",\n \"--\",\n filePath,\n ]);\n\n const lines = output.trim().split(\"\\n\");\n let currentHash = \"\";\n let currentDate = new Date();\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed) continue;\n\n if (trimmed.includes(\"|\")) {\n const parts = trimmed.split(\"|\");\n currentHash = parts[0];\n currentDate = new Date(parts[1]);\n } else {\n const statMatch = trimmed.match(/^(\\d+|-)\\t(\\d+|-)\\t(.+)$/);\n if (statMatch && statMatch[3] === filePath) {\n const added = statMatch[1] === \"-\" ? 0 : parseInt(statMatch[1], 10);\n const deleted = statMatch[2] === \"-\" ? 0 : parseInt(statMatch[2], 10);\n\n // Get file size at that commit\n let fileSizeAtCommit = 1;\n try {\n const content = await gitClient.show([\n `${currentHash}:${filePath}`,\n ]);\n fileSizeAtCommit = Math.max(1, content.split(\"\\n\").length);\n } catch {\n fileSizeAtCommit = Math.max(1, added);\n }\n\n commits.push({\n hash: currentHash,\n date: currentDate,\n addedLines: added,\n deletedLines: deleted,\n fileSizeAtCommit,\n });\n }\n }\n }\n } catch {\n // No commits found\n }\n\n return commits;\n}\n\n/**\n * Get the last date a user touched a specific file (commit).\n */\nexport async function getLastCommitDate(\n gitClient: GitClient,\n user: UserIdentity,\n filePath: string,\n): Promise<Date | null> {\n try {\n const output = await gitClient.getLog([\n ...getAuthorArgs(user),\n \"-1\",\n \"--pretty=format:%aI\",\n \"--\",\n filePath,\n ]);\n const trimmed = output.trim();\n if (trimmed) {\n return new Date(trimmed);\n }\n } catch {\n // No commits found\n }\n return null;\n}\n","import type { FolderScore } from \"../core/types.js\";\nimport { walkFiles, recomputeFolderScores } from \"../core/file-tree.js\";\n\n/**\n * Score files in binary mode (written / not written).\n */\nexport function scoreBinary(\n tree: FolderScore,\n writtenFiles: Set<string>,\n expiredFiles?: Set<string>,\n): void {\n walkFiles(tree, (file) => {\n const isWritten = writtenFiles.has(file.path);\n const isExpired = expiredFiles?.has(file.path) ?? false;\n\n file.isWritten = isWritten;\n file.isExpired = isExpired;\n\n if (isExpired) {\n file.score = 0;\n return;\n }\n\n file.score = isWritten ? 1 : 0;\n });\n\n recomputeFolderScores(tree, \"binary\");\n}\n","import type { GitClient } from \"./client.js\";\nimport type { UserIdentity } from \"../core/types.js\";\nimport { matchesUser } from \"./identity.js\";\n\nexport interface BlameEntry {\n email: string;\n name: string;\n lines: number;\n}\n\nexport interface BlameResult {\n entries: BlameEntry[];\n totalLines: number;\n}\n\n/**\n * Run git blame on a file and return per-author line counts.\n * Uses -w to ignore whitespace changes.\n */\nexport async function getBlameData(\n gitClient: GitClient,\n filePath: string,\n): Promise<BlameResult> {\n const authorMap = new Map<string, BlameEntry>();\n let totalLines = 0;\n\n try {\n const output = await gitClient.blame(filePath, [\"-w\", \"--porcelain\"]);\n const lines = output.split(\"\\n\");\n\n let currentName = \"\";\n let currentEmail = \"\";\n\n for (const line of lines) {\n if (line.startsWith(\"author \")) {\n currentName = line.slice(\"author \".length).trim();\n } else if (line.startsWith(\"author-mail \")) {\n currentEmail = line\n .slice(\"author-mail \".length)\n .replace(/[<>]/g, \"\")\n .trim();\n } else if (line.startsWith(\"\\t\")) {\n // Content line - count for current author\n if (currentEmail || currentName) {\n totalLines++;\n const key = `${currentEmail}|${currentName}`;\n const existing = authorMap.get(key);\n if (existing) {\n existing.lines++;\n } else {\n authorMap.set(key, {\n email: currentEmail,\n name: currentName,\n lines: 1,\n });\n }\n }\n }\n }\n } catch {\n // Binary file or other error - return empty\n }\n\n return { entries: Array.from(authorMap.values()), totalLines };\n}\n\n/**\n * Get the number of lines authored by a specific user in a file.\n */\nexport async function getUserBlameLines(\n gitClient: GitClient,\n filePath: string,\n user: UserIdentity,\n): Promise<{ userLines: number; totalLines: number }> {\n const { entries, totalLines } = await getBlameData(gitClient, filePath);\n\n let userLines = 0;\n for (const entry of entries) {\n if (matchesUser(entry.name, entry.email, user)) {\n userLines += entry.lines;\n }\n }\n\n return { userLines, totalLines };\n}\n","const DEFAULT_BATCH_SIZE = 10;\n\n/**\n * Process items in batches with concurrent execution within each batch.\n */\nexport async function processBatch<T>(\n items: T[],\n fn: (item: T) => Promise<void>,\n batchSize: number = DEFAULT_BATCH_SIZE,\n): Promise<void> {\n for (let i = 0; i < items.length; i += batchSize) {\n const batch = items.slice(i, i + batchSize);\n await Promise.all(batch.map(fn));\n }\n}\n","import type { FolderScore, UserIdentity } from \"../core/types.js\";\nimport type { GitClient } from \"../git/client.js\";\nimport { getUserBlameLines } from \"../git/blame.js\";\nimport { walkFiles, recomputeFolderScores } from \"../core/file-tree.js\";\nimport { processBatch } from \"../utils/batch.js\";\n\n/**\n * Score files by authorship (git blame-based).\n * score(file) = blame_lines(user) / total_lines(file)\n */\nexport async function scoreAuthorship(\n tree: FolderScore,\n gitClient: GitClient,\n user: UserIdentity,\n): Promise<void> {\n const files: Array<{ path: string; setScore: (s: number) => void }> = [];\n\n walkFiles(tree, (file) => {\n files.push({\n path: file.path,\n setScore: (s) => {\n file.score = s;\n file.blameScore = s;\n },\n });\n });\n\n await processBatch(files, async ({ path, setScore }) => {\n const { userLines, totalLines } = await getUserBlameLines(\n gitClient,\n path,\n user,\n );\n setScore(totalLines > 0 ? userLines / totalLines : 0);\n });\n\n recomputeFolderScores(tree, \"continuous\");\n}\n","/**\n * Sigmoid function: x / (x + k)\n * Saturates contribution of a single commit to 0-1 range.\n */\nexport function sigmoid(x: number, k: number = 0.3): number {\n if (x <= 0) return 0;\n return x / (x + k);\n}\n\n/**\n * Recency decay: e^(-lambda * t)\n * Models memory decay over time.\n * @param days - days since the event\n * @param halfLife - number of days for score to halve (default 180)\n */\nexport function recencyDecay(days: number, halfLife: number = 180): number {\n if (days <= 0) return 1;\n const lambda = Math.LN2 / halfLife;\n return Math.exp(-lambda * days);\n}\n\n/**\n * Scope factor: min(1, attentionThreshold / filesInPR)\n * Models attention dilution in large PRs.\n */\nexport function scopeFactor(\n filesInPR: number,\n attentionThreshold: number = 20,\n): number {\n if (filesInPR <= 0) return 1;\n return Math.min(1, attentionThreshold / filesInPR);\n}\n\n/**\n * Normalized diff: (added + 0.5 * deleted) / fileSize\n */\nexport function normalizedDiff(\n added: number,\n deleted: number,\n fileSize: number,\n): number {\n if (fileSize <= 0) return 0;\n return (added + 0.5 * deleted) / fileSize;\n}\n\n/**\n * Calculate the number of days between two dates.\n */\nexport function daysBetween(a: Date, b: Date): number {\n const ms = Math.abs(b.getTime() - a.getTime());\n return ms / (1000 * 60 * 60 * 24);\n}\n","import type {\n FolderScore,\n UserIdentity,\n WeightConfig,\n CommitInfo,\n} from \"../core/types.js\";\nimport type { GitClient } from \"../git/client.js\";\nimport { getUserBlameLines } from \"../git/blame.js\";\nimport { getDetailedCommits } from \"../git/log.js\";\nimport { walkFiles, recomputeFolderScores } from \"../core/file-tree.js\";\nimport { processBatch } from \"../utils/batch.js\";\nimport {\n sigmoid,\n recencyDecay,\n normalizedDiff,\n daysBetween,\n} from \"../utils/math.js\";\n\nfunction calculateCommitScore(commits: CommitInfo[], now: Date): number {\n let raw = 0;\n for (const c of commits) {\n const nd = normalizedDiff(c.addedLines, c.deletedLines, c.fileSizeAtCommit);\n raw += sigmoid(nd) * recencyDecay(daysBetween(now, c.date));\n }\n return Math.min(1, raw);\n}\n\n/**\n * Score files using the weighted mode (blame + commit signals).\n */\nexport async function scoreWeighted(\n tree: FolderScore,\n gitClient: GitClient,\n user: UserIdentity,\n weights: WeightConfig,\n now?: Date,\n): Promise<void> {\n const currentDate = now || new Date();\n const files: Array<{\n path: string;\n setScores: (b: number, c: number, total: number) => void;\n }> = [];\n\n walkFiles(tree, (file) => {\n files.push({\n path: file.path,\n setScores: (b, c, total) => {\n file.blameScore = b;\n file.commitScore = c;\n file.score = total;\n },\n });\n });\n\n await processBatch(files, async ({ path, setScores }) => {\n const { userLines, totalLines } = await getUserBlameLines(\n gitClient,\n path,\n user,\n );\n const blameScore = totalLines > 0 ? userLines / totalLines : 0;\n const commitScore = calculateCommitScore(\n await getDetailedCommits(gitClient, user, path),\n currentDate,\n );\n\n const total = weights.blame * blameScore + weights.commit * commitScore;\n\n setScores(blameScore, commitScore, total);\n });\n\n recomputeFolderScores(tree, \"continuous\");\n}\n","import type { GitClient } from './client.js';\n\n/**\n * Calculate how much a file has changed since a given commit.\n * Returns the ratio of changed lines to current total lines.\n * Used for change-based expiration policy.\n */\nexport async function getChangeRatio(\n gitClient: GitClient,\n filePath: string,\n sinceCommit: string,\n): Promise<number> {\n try {\n const output = await gitClient.diff([\n '--numstat',\n `${sinceCommit}..HEAD`,\n '--',\n filePath,\n ]);\n\n const trimmed = output.trim();\n if (!trimmed) return 0;\n\n const match = trimmed.match(/^(\\d+|-)\\t(\\d+|-)\\t/);\n if (!match) return 0;\n\n const added = match[1] === '-' ? 0 : parseInt(match[1], 10);\n const deleted = match[2] === '-' ? 0 : parseInt(match[2], 10);\n const changedLines = added + deleted;\n\n // Get current file line count\n const currentContent = await gitClient.show([`HEAD:${filePath}`]);\n const currentLines = Math.max(1, currentContent.split('\\n').length);\n\n return changedLines / currentLines;\n } catch {\n return 0;\n }\n}\n\n/**\n * Get the commit hash for the last time a user touched a file.\n */\nexport async function getLastTouchCommit(\n gitClient: GitClient,\n filePath: string,\n userEmail: string,\n): Promise<string | null> {\n try {\n const output = await gitClient.getLog([\n '--author', userEmail,\n '-1',\n '--pretty=format:%H',\n '--',\n filePath,\n ]);\n const hash = output.trim();\n return hash || null;\n } catch {\n return null;\n }\n}\n","import type { ExpirationConfig, UserIdentity } from \"../core/types.js\";\nimport type { GitClient } from \"../git/client.js\";\nimport { getLastCommitDate } from \"../git/log.js\";\nimport { getLastTouchCommit, getChangeRatio } from \"../git/diff.js\";\nimport { processBatch } from \"../utils/batch.js\";\n\n/**\n * Parse an expiration string from CLI into ExpirationConfig.\n * Formats: \"never\", \"time:180d\", \"change:50%\", \"combined:365d:50%\"\n */\nexport function parseExpirationConfig(input: string): ExpirationConfig {\n if (!input || input === \"never\") {\n return { policy: \"never\" };\n }\n\n if (input.startsWith(\"time:\")) {\n const duration = parseDays(input.slice(\"time:\".length));\n return { policy: \"time\", duration };\n }\n\n if (input.startsWith(\"change:\")) {\n const threshold = parsePercentage(input.slice(\"change:\".length));\n return { policy: \"change\", threshold };\n }\n\n if (input.startsWith(\"combined:\")) {\n const parts = input.slice(\"combined:\".length).split(\":\");\n const duration = parseDays(parts[0]);\n const threshold = parts[1] ? parsePercentage(parts[1]) : 0.5;\n return { policy: \"combined\", duration, threshold };\n }\n\n return { policy: \"never\" };\n}\n\nfunction parseDays(s: string): number {\n const match = s.match(/^(\\d+)d$/);\n if (!match)\n throw new Error(\n `Invalid duration format: \"${s}\". Expected format like \"180d\".`,\n );\n return parseInt(match[1], 10);\n}\n\nfunction parsePercentage(s: string): number {\n const match = s.match(/^(\\d+)%$/);\n if (!match)\n throw new Error(\n `Invalid percentage format: \"${s}\". Expected format like \"50%\".`,\n );\n return parseInt(match[1], 10) / 100;\n}\n\n/**\n * Check if a file's familiarity has expired according to the given policy.\n */\nexport async function isExpired(\n gitClient: GitClient,\n filePath: string,\n user: UserIdentity,\n config: ExpirationConfig,\n now?: Date,\n): Promise<boolean> {\n if (config.policy === \"never\") return false;\n\n const currentDate = now || new Date();\n const email = user.email || user.name;\n\n if (config.policy === \"time\" || config.policy === \"combined\") {\n const lastTouch = await getLastCommitDate(gitClient, user, filePath);\n if (lastTouch && config.duration) {\n const daysSince =\n (currentDate.getTime() - lastTouch.getTime()) / (1000 * 60 * 60 * 24);\n if (daysSince > config.duration) return true;\n }\n }\n\n if (config.policy === \"change\" || config.policy === \"combined\") {\n const lastCommit = await getLastTouchCommit(gitClient, filePath, email);\n if (lastCommit && config.threshold) {\n const ratio = await getChangeRatio(gitClient, filePath, lastCommit);\n if (ratio > config.threshold) return true;\n }\n }\n\n return false;\n}\n\n/**\n * Get the set of expired files for a given user and config.\n */\nexport async function getExpiredFiles(\n gitClient: GitClient,\n files: string[],\n user: UserIdentity,\n config: ExpirationConfig,\n): Promise<Set<string>> {\n if (config.policy === \"never\") return new Set();\n\n const expiredSet = new Set<string>();\n\n await processBatch(files, async (filePath) => {\n if (await isExpired(gitClient, filePath, user, config)) {\n expiredSet.add(filePath);\n }\n });\n\n return expiredSet;\n}\n","import type { CliOptions, FolderScore } from \"./types.js\";\nimport { GitClient } from \"../git/client.js\";\nimport { resolveUser } from \"../git/identity.js\";\nimport { createFilter } from \"../filter/ignore.js\";\nimport { buildFileTree, walkFiles } from \"./file-tree.js\";\nimport { getFilesCommittedByUser } from \"../git/log.js\";\nimport { scoreBinary } from \"../scoring/binary.js\";\nimport { scoreAuthorship } from \"../scoring/authorship.js\";\nimport { scoreWeighted } from \"../scoring/weighted.js\";\nimport { getExpiredFiles } from \"../scoring/expiration.js\";\n\nexport interface FamiliarityResult {\n tree: FolderScore;\n repoName: string;\n userName: string;\n mode: string;\n writtenCount: number;\n totalFiles: number;\n}\n\nexport async function computeFamiliarity(\n options: CliOptions,\n): Promise<FamiliarityResult> {\n const gitClient = new GitClient(options.repoPath);\n\n if (!(await gitClient.isRepo())) {\n throw new Error(`\"${options.repoPath}\" is not a git repository.`);\n }\n\n const repoRoot = await gitClient.getRepoRoot();\n const repoName = await gitClient.getRepoName();\n const userFlag = Array.isArray(options.user) ? options.user[0] : options.user;\n const user = await resolveUser(gitClient, userFlag);\n const filter = createFilter(repoRoot);\n const tree = await buildFileTree(gitClient, filter);\n\n // Get written files (used by binary, weighted)\n const writtenFiles = await getFilesCommittedByUser(gitClient, user);\n\n // Get expired files\n let expiredFiles: Set<string> | undefined;\n if (options.expiration.policy !== \"never\") {\n const allFiles: string[] = [];\n walkFiles(tree, (f) => allFiles.push(f.path));\n expiredFiles = await getExpiredFiles(\n gitClient,\n allFiles,\n user,\n options.expiration,\n );\n }\n\n // Score based on mode\n switch (options.mode) {\n case \"binary\":\n scoreBinary(tree, writtenFiles, expiredFiles);\n break;\n\n case \"authorship\":\n await scoreAuthorship(tree, gitClient, user);\n break;\n\n case \"weighted\":\n await scoreWeighted(tree, gitClient, user, options.weights);\n break;\n }\n\n return {\n tree,\n repoName,\n userName: user.name || user.email,\n mode: options.mode,\n writtenCount: countWritten(tree, writtenFiles),\n totalFiles: tree.fileCount,\n };\n}\n\nfunction countWritten(tree: FolderScore, writtenFiles: Set<string>): number {\n let count = 0;\n walkFiles(tree, (file) => {\n if (writtenFiles.has(file.path)) count++;\n });\n return count;\n}\n"],"mappings":";AAAA,OAAO,eAAmC;AAEnC,IAAM,YAAN,MAAgB;AAAA,EACb;AAAA,EACC;AAAA,EA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D,QAAM,eAAe,MAAM,wBAAwB,WAAW,IAAI;AAGlE,MAAI;AACJ,MAAI,QAAQ,WAAW,WAAW,SAAS;AACzC,UAAM,WAAqB,CAAC;AAC5B,cAAU,MAAM,CAAC,MAAM,SAAS,KAAK,EAAE,IAAI,CAAC;AAC5C,mBAAe,MAAM;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,IACV;AAAA,EACF;AAGA,UAAQ,QAAQ,MAAM;AAAA,IACpB,KAAK;AACH,kBAAY,MAAM,cAAc,YAAY;AAC5C;AAAA,IAEF,KAAK;AACH,YAAM,gBAAgB,MAAM,WAAW,IAAI;AAC3C;AAAA,IAEF,KAAK;AACH,YAAM,cAAc,MAAM,WAAW,MAAM,QAAQ,OAAO;AAC1D;AAAA,EACJ;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,UAAU,KAAK,QAAQ,KAAK;AAAA,IAC5B,MAAM,QAAQ;AAAA,IACd,cAAc,aAAa,MAAM,YAAY;AAAA,IAC7C,YAAY,KAAK;AAAA,EACnB;AACF;AAEA,SAAS,aAAa,MAAmB,cAAmC;AAC1E,MAAI,QAAQ;AACZ,YAAU,MAAM,CAAC,SAAS;AACxB,QAAI,aAAa,IAAI,KAAK,IAAI,EAAG;AAAA,EACnC,CAAC;AACD,SAAO;AACT;","names":["readFileSync","join","parentPath","parent","isExpired"]}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- type ScoringMode = "binary" | "authorship" | "review-coverage" | "weighted";
2
- type FilterMode = "all" | "written" | "reviewed";
1
+ type ScoringMode = "binary" | "authorship" | "weighted";
3
2
  type ExpirationPolicyType = "never" | "time" | "change" | "combined";
4
3
  interface ExpirationConfig {
5
4
  policy: ExpirationPolicyType;
@@ -9,13 +8,11 @@ interface ExpirationConfig {
9
8
  interface WeightConfig {
10
9
  blame: number;
11
10
  commit: number;
12
- review: number;
13
11
  }
14
12
  type HotspotMode = "personal" | "team";
15
13
  interface CliOptions {
16
14
  mode: ScoringMode;
17
15
  user?: string | string[];
18
- filter: FilterMode;
19
16
  expiration: ExpirationConfig;
20
17
  html: boolean;
21
18
  weights: WeightConfig;
@@ -24,8 +21,6 @@ interface CliOptions {
24
21
  teamCoverage?: boolean;
25
22
  hotspot?: HotspotMode;
26
23
  window?: number;
27
- githubUrl?: string;
28
- checkGithub?: boolean;
29
24
  }
30
25
  interface FileScore {
31
26
  type: "file";
@@ -33,10 +28,8 @@ interface FileScore {
33
28
  lines: number;
34
29
  score: number;
35
30
  isWritten?: boolean;
36
- isReviewed?: boolean;
37
31
  blameScore?: number;
38
32
  commitScore?: number;
39
- reviewScore?: number;
40
33
  isExpired?: boolean;
41
34
  lastTouchDate?: Date;
42
35
  }
@@ -57,10 +50,8 @@ interface FamiliarityResult {
57
50
  userName: string;
58
51
  mode: string;
59
52
  writtenCount: number;
60
- reviewedCount: number;
61
- bothCount: number;
62
53
  totalFiles: number;
63
54
  }
64
55
  declare function computeFamiliarity(options: CliOptions): Promise<FamiliarityResult>;
65
56
 
66
- export { type CliOptions, type ExpirationConfig, type FamiliarityResult, type FileScore, type FilterMode, type FolderScore, type ScoringMode, type TreeNode, type WeightConfig, computeFamiliarity };
57
+ export { type CliOptions, type ExpirationConfig, type FamiliarityResult, type FileScore, type FolderScore, type ScoringMode, type TreeNode, type WeightConfig, computeFamiliarity };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  computeFamiliarity
3
- } from "./chunk-V27FX6R6.js";
3
+ } from "./chunk-BQCHOSLA.js";
4
4
  export {
5
5
  computeFamiliarity
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitfamiliar",
3
- "version": "0.4.0",
3
+ "version": "0.7.0",
4
4
  "description": "Visualize your code familiarity from Git history",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",