feat: add CreateIssue to Forge interface with Gitea implementation

This commit is contained in:
sam committed 2026-07-23 19:12:12 +10:00
1 parent 1bf4f7668f
commit 423eb78fef
7 files changed
+22 -74

No files matched your search

+1
View File
@@ -69,6 +69,7 @@ func (f *testForge) CreatePR(context.Context, string, string, string, string, st
}
func (f *testForge) PRState(context.Context, string, string, int) (string, error) { panic("unexpected call") }
func (f *testForge) CloseIssue(context.Context, string, string, int, string) error { panic("unexpected call") }
func (f *testForge) CreateIssue(context.Context, string, string, string, string, []string) (int, error) { return 0, nil }
func (f *testForge) React(context.Context, string, string, int, string) error { return nil }
func (f *testForge) VerifyPush(context.Context, string, string) error { return nil }
+3
View File
@@ -58,6 +58,9 @@ type Forge interface {
// CloseIssue closes an issue with an optional final comment.
CloseIssue(ctx context.Context, owner, repo string, number int, comment string) error
// CreateIssue opens a new issue and returns its number.
CreateIssue(ctx context.Context, owner, repo, title, body string, labels []string) (int, error)
// React adds an emoji reaction to an issue.
React(ctx context.Context, owner, repo string, number int, reaction string) error
+9
View File
@@ -171,6 +171,15 @@ func (c *GiteaClient) CloseIssue(ctx context.Context, owner, repo string, number
return err
}
// CreateIssue opens a new issue and returns its number.
func (c *GiteaClient) CreateIssue(ctx context.Context, owner, repo, title, body string, labels []string) (int, error) {
iss, _, err := c.cli.CreateIssue(owner, repo, gitea.CreateIssueOption{Title: title, Body: body})
if err != nil {
return 0, err
}
return int(iss.Index), nil
}
// React adds an emoji reaction to an issue.
func (c *GiteaClient) React(ctx context.Context, owner, repo string, number int, reaction string) error {
_, _, err := c.cli.PostIssueReaction(owner, repo, int64(number), reaction)
+6 -1
View File
@@ -200,10 +200,15 @@ func (c *GitHubClient) CloseIssue(ctx context.Context, owner, repo string, numbe
}
}
_, _, err := c.gh.Issues.Edit(ctx, owner, repo, number,
&github.IssueRequest{State: new("closed")})
&github.IssueRequest{State: github.String("closed")})
return err
}
// CreateIssue opens a new issue and returns its number (stub — Gitea is primary).
func (c *GitHubClient) CreateIssue(ctx context.Context, owner, repo, title, body string, labels []string) (int, error) {
return 0, fmt.Errorf("GitHub CreateIssue not yet implemented")
}
// State labels mirror the task lifecycle onto the forge so archie's
// status is visible at a glance. SQLite remains the source of truth;
// labels are the human-facing projection — and removing the parked
+1
View File
@@ -21,6 +21,7 @@ func (f *fakeForge) Comment(ctx context.Context, owner, repo string, number int,
return 0, nil
}
// Remaining forge.Forge stubs — only CloseIssue and Comment are used by StageCommitPush.
func (f *fakeForge) CreateIssue(ctx context.Context, owner, repo, title, body string, labels []string) (int, error) { return 0, nil }
func (f *fakeForge) Name() string { return "fake" }
func (f *fakeForge) AcceptInvitations(ctx context.Context) error { return nil }
func (f *fakeForge) AssignedIssues(ctx context.Context, owner, repo, user string) ([]forge.Issue, error) { return nil, nil }