Skip to content

Commit 263fac5

Browse files
authored
Merge pull request #2525 from generalaction/feat-migrate-git-stack
feat: migrate git stack
2 parents bc73c37 + 58655e7 commit 263fac5

221 files changed

Lines changed: 7313 additions & 5616 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/emdash-desktop/src/main/core/forgejo/forgejo-connection-service.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { userGetCurrent } from '@llamaduck/forgejo-ts';
22
import { createClient, type Client } from '@llamaduck/forgejo-ts/client';
33
import { AxiosError } from 'axios';
4-
import { resolvePreferredRemote } from '@main/core/issues/git-remote-resolver';
4+
import { resolveRepositoryRemote } from '@main/core/issues/git-remote-resolver';
55
import {
66
assertRemoteHostMatchesInstance,
77
hasKnownNetworkErrorCode,
@@ -177,11 +177,10 @@ export class ForgejoConnectionService {
177177
}
178178

179179
async resolveRepo(
180-
projectPath: string,
181-
remoteName?: string
180+
repositoryUrl: string | undefined
182181
): Promise<{ client: Client; owner: string; repo: string; repoName: string }> {
183182
const { instanceUrl, client } = await this.requireAuth();
184-
const remote = await resolvePreferredRemote(projectPath, remoteName);
183+
const remote = resolveRepositoryRemote(repositoryUrl);
185184

186185
assertRemoteHostMatchesInstance(remote.host, instanceUrl, 'Forgejo');
187186

apps/emdash-desktop/src/main/core/forgejo/forgejo-issue-provider.ts

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { issueListIssues, type Issue as ForgejoIssue } from '@llamaduck/forgejo-
22
import {
33
clampIssueLimit,
44
normalizeSearchTerm,
5-
requireProjectPath,
5+
requireRepositoryUrl,
66
} from '@main/core/issues/helpers/provider-inputs';
77
import type { IssueProvider } from '@main/core/issues/issue-provider';
88
import type { LinkedIssue } from '@shared/core/linked-issue';
@@ -28,18 +28,12 @@ function toIssue(issue: ForgejoIssue, repoName: string): LinkedIssue {
2828
};
2929
}
3030

31-
async function listIssues(
32-
projectPath: string,
33-
remoteName: string | undefined,
34-
limit: number
35-
): Promise<IssueListResult> {
31+
async function listIssues(repositoryUrl: string, limit: number): Promise<IssueListResult> {
3632
const perPage = clampIssueLimit(limit, 50, 100);
3733

3834
try {
39-
const { client, owner, repo, repoName } = await forgejoConnectionService.resolveRepo(
40-
projectPath,
41-
remoteName
42-
);
35+
const { client, owner, repo, repoName } =
36+
await forgejoConnectionService.resolveRepo(repositoryUrl);
4337

4438
const { data: issues } = await issueListIssues({
4539
client,
@@ -61,8 +55,7 @@ async function listIssues(
6155
}
6256

6357
async function searchIssues(
64-
projectPath: string,
65-
remoteName: string | undefined,
58+
repositoryUrl: string,
6659
searchTerm: string,
6760
limit: number
6861
): Promise<IssueListResult> {
@@ -74,10 +67,8 @@ async function searchIssues(
7467
const perPage = clampIssueLimit(limit, 20, 100);
7568

7669
try {
77-
const { client, owner, repo, repoName } = await forgejoConnectionService.resolveRepo(
78-
projectPath,
79-
remoteName
80-
);
70+
const { client, owner, repo, repoName } =
71+
await forgejoConnectionService.resolveRepo(repositoryUrl);
8172

8273
const { data: issues } = await issueListIssues({
8374
client,
@@ -113,20 +104,20 @@ export const forgejoIssueProvider: IssueProvider = {
113104
checkConnection: () => forgejoConnectionService.checkConnection(),
114105

115106
listIssues: async (opts) => {
116-
const projectPath = requireProjectPath(opts.projectPath);
117-
if (!projectPath) {
118-
return { success: false, error: 'Project path is required.' };
107+
const repositoryUrl = requireRepositoryUrl(opts.repositoryUrl);
108+
if (!repositoryUrl) {
109+
return { success: false, error: 'Repository URL is required.' };
119110
}
120111

121-
return listIssues(projectPath, opts.remote, opts.limit ?? 50);
112+
return listIssues(repositoryUrl, opts.limit ?? 50);
122113
},
123114

124115
searchIssues: async (opts) => {
125-
const projectPath = requireProjectPath(opts.projectPath);
126-
if (!projectPath) {
127-
return { success: false, error: 'Project path is required.' };
116+
const repositoryUrl = requireRepositoryUrl(opts.repositoryUrl);
117+
if (!repositoryUrl) {
118+
return { success: false, error: 'Repository URL is required.' };
128119
}
129120

130-
return searchIssues(projectPath, opts.remote, opts.searchTerm, opts.limit ?? 20);
121+
return searchIssues(repositoryUrl, opts.searchTerm, opts.limit ?? 20);
131122
},
132123
};

0 commit comments

Comments
 (0)