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

+2 -68
View File
@@ -1,70 +1,4 @@
# Beads Configuration File
# This file configures default behavior for all bd commands in this repository
# All settings can also be set via environment variables (BD_* prefix)
# or overridden with command-line flags
# Issue prefix for this repository (used by bd init)
# If not set, bd init will auto-detect from directory name
# Example: issue-prefix: "myproject" creates issues like "myproject-1", "myproject-2", etc.
# issue-prefix: ""
# Use no-db mode: JSONL-only, no Dolt database
# When true, .beads/issues.jsonl is the only local store
# no-db: false
# Enable JSON output by default
# json: false
# Feedback title formatting for mutating commands (create/update/close/dep/edit)
# 0 = hide titles, N > 0 = truncate to N characters
# output:
# title-length: 255
# Default actor for audit trails (overridden by BEADS_ACTOR or --actor)
# actor: ""
# Export events (audit trail) to .beads/events.jsonl on each flush/sync
# When enabled, new events are appended incrementally using a high-water mark.
# Use 'bd export --events' to trigger manually regardless of this setting.
# events-export: false
# Multi-repo configuration (experimental - bd-307)
# Allows hydrating from multiple repositories and routing writes to the correct database
# repos:
# primary: "." # Primary repo (where this database lives)
# additional: # Additional repos to hydrate from (read-only)
# - ~/beads-planning # Personal planning repo
# - ~/work-planning # Work planning repo
# Dolt-native backup (periodic backup for off-machine recovery)
# This is full database backup only. Cross-machine sync uses Dolt remotes.
# backup:
# enabled: false # Disable auto-backup entirely
# interval: 15m # Minimum time between auto-backups
# git-push: false # Disable git push (backup locally only)
# git-repo: "" # Separate git repo for backups (default: project repo)
# Optional JSONL auto-export for viewers, interchange, and issue-level migration.
# Disabled by default; enable only when an integration needs fresh .beads/issues.jsonl.
# Use relative paths under .beads/ for JSONL import/export filenames.
# export:
# auto: false
# path: issues.jsonl
# interval: 60s
# git-add: false
# import:
# path: issues.jsonl
# Integration settings (access with 'bd config get/set')
# Non-secret keys (stored in the database):
# - jira.url, jira.project
# - linear.team_id
# - github.org, github.repo
#
# Secret keys (stored in this file but prefer env vars to avoid git exposure):
# - linear.api_key → use LINEAR_API_KEY env var instead
# - github.token → use GITHUB_TOKEN env var instead
sync.remote: "git+https://git.catlow.cloud/sam/archie-core.git"
export:
auto: true
no-git-ops: true
sync.remote: git+https://git.catlow.cloud/sam/archie-core.git
-5
View File
@@ -2,8 +2,3 @@
*.db
.references/
.claude/
# Beads / Dolt files (added by bd init)
.dolt/
.beads-credential-key
.beads/proxieddb/
+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 }