diff --git a/README.md b/README.md index bdeca1b1..63ab2fc1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # githru-vscode-ext + Lightweight but robust Githru for VSCode Extension ## Getting Started diff --git a/packages/analysis-engine/src/parser.spec.ts b/packages/analysis-engine/src/parser.spec.ts index 50feb085..7308624b 100644 --- a/packages/analysis-engine/src/parser.spec.ts +++ b/packages/analysis-engine/src/parser.spec.ts @@ -1,5 +1,5 @@ import { getCommitMessageType } from "./commit.util"; -import getCommitRaws from "./parser"; +import getCommitRaws from "./parser"; import type { CommitRaw, DifferenceStatistic } from "./types"; describe("commit message type", () => { @@ -34,85 +34,79 @@ describe("commit message type", () => { }); }); -describe('getCommitRaws', () => { +describe("getCommitRaws", () => { const testCommitLines = [ "commit a b (HEAD)", "commit a b (HEAD -> main, origin/main, origin/HEAD)", "commit a b (HEAD, tag: v1.0.0)", "commit a b (HEAD -> main, origin/main, origin/HEAD, tag: v2.0.0)", - "commit a b (HEAD, tag: v2.0.0, tag: v1.4)" + "commit a b (HEAD, tag: v2.0.0, tag: v1.4)", ]; const expectedBranches = [ - ['HEAD'], - ['HEAD', 'main', 'origin/main', 'origin/HEAD'], - ['HEAD'], - ['HEAD', 'main', 'origin/main', 'origin/HEAD'], - ['HEAD'] + ["HEAD"], + ["HEAD", "main", "origin/main", "origin/HEAD"], + ["HEAD"], + ["HEAD", "main", "origin/main", "origin/HEAD"], + ["HEAD"], ]; - const expectedTags = [ - [], - [], - ['v1.0.0'], - ['v2.0.0'], - ['v2.0.0', 'v1.4'] - ]; + const expectedTags = [[], [], ["v1.0.0"], ["v2.0.0"], ["v2.0.0", "v1.4"]]; const testCommitFileChanges = [ "10\t0\ta.ts\n1\t0\tREADME.md", "3\t3\ta.ts", "4\t0\ta.ts", - "0\t6\ta.ts\n2\t0\tb.ts\n3\t3\tc.ts" + "0\t6\ta.ts\n2\t0\tb.ts\n3\t3\tc.ts", ]; - const expectedFileChanged:DifferenceStatistic[] = [ + const expectedFileChanged: DifferenceStatistic[] = [ { totalInsertionCount: 11, totalDeletionCount: 0, fileDictionary: { - 'a.ts': { insertionCount: 10, deletionCount: 0 }, - 'README.md': { insertionCount: 1, deletionCount: 0 }, - } + "a.ts": { insertionCount: 10, deletionCount: 0 }, + "README.md": { insertionCount: 1, deletionCount: 0 }, + }, }, { totalInsertionCount: 3, totalDeletionCount: 3, - fileDictionary: { 'a.ts': { insertionCount: 3, deletionCount: 3 } } + fileDictionary: { "a.ts": { insertionCount: 3, deletionCount: 3 } }, }, { totalInsertionCount: 4, totalDeletionCount: 0, - fileDictionary: { 'a.ts': { insertionCount: 4, deletionCount: 0 } } + fileDictionary: { "a.ts": { insertionCount: 4, deletionCount: 0 } }, }, { totalInsertionCount: 5, totalDeletionCount: 9, fileDictionary: { - 'a.ts': { insertionCount: 0, deletionCount: 6 }, - 'b.ts': { insertionCount: 2, deletionCount: 0 }, - 'c.ts': { insertionCount: 3, deletionCount: 3 }, - } - } + "a.ts": { insertionCount: 0, deletionCount: 6 }, + "b.ts": { insertionCount: 2, deletionCount: 0 }, + "c.ts": { insertionCount: 3, deletionCount: 3 }, + }, + }, ]; - const commonExpectatedResult: CommitRaw={ + const commonExpectatedResult: CommitRaw = { sequence: 0, - id: 'a', - parents: ['b'], - branches: ['HEAD'], + id: "a", + parents: ["b"], + branches: ["HEAD"], tags: [], - author: { name: 'John Park', email: 'mail@gmail.com' }, - authorDate: new Date('Sun Sep 4 20:17:59 2022 +0900'), - committer: { name: 'John Park', email: 'mail@gmail.com' }, - committerDate: new Date('Sun Sep 4 20:17:59 2022 +0900'), - message: 'commit message', + author: { name: "John Park", email: "mail@gmail.com" }, + authorDate: new Date("Sun Sep 4 20:17:59 2022 +0900"), + committer: { name: "John Park", email: "mail@gmail.com" }, + committerDate: new Date("Sun Sep 4 20:17:59 2022 +0900"), + message: "commit message", differenceStatistic: { totalInsertionCount: 0, totalDeletionCount: 0, fileDictionary: {}, }, - commitMessageType: "" + commitMessageType: "", }; testCommitLines.forEach((mockLog, index) => { @@ -125,8 +119,12 @@ CommitDate: Sun Sep 4 20:17:59 2022 +0900 \n\tcommit message `; const result = getCommitRaws(mock); - const expectedResult = { ...commonExpectatedResult, branches: expectedBranches[index], tags: expectedTags[index] }; - + const expectedResult = { + ...commonExpectatedResult, + branches: expectedBranches[index], + tags: expectedTags[index], + }; + expect(result).toEqual([expectedResult]); }); }); diff --git a/packages/analysis-engine/src/pluginOctokit.ts b/packages/analysis-engine/src/pluginOctokit.ts index 4e0e3e5d..89612641 100644 --- a/packages/analysis-engine/src/pluginOctokit.ts +++ b/packages/analysis-engine/src/pluginOctokit.ts @@ -55,13 +55,13 @@ export class PluginOctokit extends Octokit.plugin(throttling) { private _getPullRequest = async (pullNumber: number) => { const { owner, repo } = this; - const pullRequestDetail:PullsListResponseData = await this.rest.pulls.get({ + const pullRequestDetail: PullsListResponseData = await this.rest.pulls.get({ owner, repo, pull_number: pullNumber, }); - const pullRequestCommits:PullsListCommitsResponseData = await this.rest.pulls.listCommits({ + const pullRequestCommits: PullsListCommitsResponseData = await this.rest.pulls.listCommits({ owner, repo, pull_number: pullNumber, @@ -73,11 +73,12 @@ export class PluginOctokit extends Octokit.plugin(throttling) { }; }; - - public getPullRequests = async (): Promise<{ - detail: PullsListResponseData, - commitDetails: PullsListCommitsResponseData - }[]> => { + public getPullRequests = async (): Promise< + { + detail: PullsListResponseData; + commitDetails: PullsListCommitsResponseData; + }[] + > => { const { owner, repo } = this; const { data } = await this.rest.pulls.list({ diff --git a/packages/analysis-engine/src/summary.ts b/packages/analysis-engine/src/summary.ts index 2b91fe4f..d1898dee 100644 --- a/packages/analysis-engine/src/summary.ts +++ b/packages/analysis-engine/src/summary.ts @@ -1,10 +1,10 @@ import type { CommitRaw } from "./types"; -const apiKey = process.env.GEMENI_API_KEY || ''; +const apiKey = process.env.GEMENI_API_KEY || ""; const apiUrl = "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key="; export async function getSummary(csmNodes: CommitRaw[]) { - const commitMessages = csmNodes.map((csmNode) => csmNode.message.split('\n')[0]).join(', '); + const commitMessages = csmNodes.map((csmNode) => csmNode.message.split("\n")[0]).join(", "); try { const response = await fetch(apiUrl + apiKey, { @@ -13,7 +13,7 @@ export async function getSummary(csmNodes: CommitRaw[]) { "Content-Type": "application/json", }, body: JSON.stringify({ - contents: [{parts: [{text: `${prompt} \n${commitMessages}`}]}], + contents: [{ parts: [{ text: `${prompt} \n${commitMessages}` }] }], }), }); @@ -53,4 +53,4 @@ Output format: - {prefix (if any)}:{commit summary3} ‘’ -Commits:` +Commits:`; diff --git a/packages/view/src/components/VerticalClusterList/VerticalClusterList.util.test.ts b/packages/view/src/components/VerticalClusterList/VerticalClusterList.util.test.ts index ecbc4bbf..049f6f4c 100644 --- a/packages/view/src/components/VerticalClusterList/VerticalClusterList.util.test.ts +++ b/packages/view/src/components/VerticalClusterList/VerticalClusterList.util.test.ts @@ -1,15 +1,8 @@ -import { - fakeFirstClusterNode, - fakeSecondClusterNode, - fakePrev, -} from "../../../tests/fakeAsset"; +import { fakeFirstClusterNode, fakeSecondClusterNode, fakePrev } from "../../../tests/fakeAsset"; import { selectedDataUpdater } from "./VerticalClusterList.util"; -const EmptyArrayAddSelectedDataUpdater = selectedDataUpdater( - fakeFirstClusterNode, - 0, -); +const EmptyArrayAddSelectedDataUpdater = selectedDataUpdater(fakeFirstClusterNode, 0); const PrevAddSelectedDataUpdater = selectedDataUpdater(fakeFirstClusterNode, 5); const RemoveSelectedDataUpdater = selectedDataUpdater(fakeSecondClusterNode, 1); diff --git a/packages/vscode/README.md b/packages/vscode/README.md index b26206cf..105ecaa4 100644 --- a/packages/vscode/README.md +++ b/packages/vscode/README.md @@ -2,14 +2,16 @@ Githru-vscode-ext is an extension supporting visual analytics to understand the history of GitHub repositories. -The theoretical basis of the extension is `Githru: Visual Analytics for Understanding Software Development History Through Git Metadata Analysis`(https://ieeexplore.ieee.org/document/9222261). +The theoretical basis of the extension is `Githru: Visual Analytics for Understanding Software Development History Through Git Metadata Analysis`(https://ieeexplore.ieee.org/document/9222261). ## Visualization Features ### Summarized Graph -The straightened graph help users understand the complex GitHub commit graph. + +The straightened graph help users understand the complex GitHub commit graph. ### Visual Analytics Components + Visualization components represent statistics for users' interested area. ## Release Notes + ### 0.7.1 + - Theme Selector! - Optimized UI Rendering - Boost up second Loading ### 0.7.0 + - UI enhancement - Patches for UI bugs ### 0.6.1 + - subgraph - launch one panel only ### 0.6.0 + - branch selector - reset github auth - error handling for pr/auth - e2e test ### 0.5.0 + - login by github auth - fix minor ui issues - author avatar in details - error handling ### 0.4.0 + - app loading ui - improved internal architecture - theme color palette ### 0.3.0 + - temporal filter by brushing - refresh - put avatar in author bar chart - improved some UX. ### 0.2.0 + - New Logo! - GitHub User Avatar - GitHub Pull Request Association @@ -76,4 +87,4 @@ Calling out known issues can help limit users opening duplicate issues against y ### 0.1.0 -Initial release. \ No newline at end of file +Initial release. diff --git a/packages/vscode/src/setting-repository.ts b/packages/vscode/src/setting-repository.ts index a82726b4..968578fa 100644 --- a/packages/vscode/src/setting-repository.ts +++ b/packages/vscode/src/setting-repository.ts @@ -14,8 +14,8 @@ export const setGithubToken = async (secrets: vscode.SecretStorage, newGithubTok }; export const deleteGithubToken = async (secrets: vscode.SecretStorage) => { - return await secrets.delete(SETTING_PROPERTY_NAMES.GITHUB_TOKEN); -} + return await secrets.delete(SETTING_PROPERTY_NAMES.GITHUB_TOKEN); +}; export const setPrimaryColor = (color: string) => { const configuration = vscode.workspace.getConfiguration();