From 423eb78fefb8163e199ea22cf0830917c8ece46a Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Thu, 23 Jul 2026 19:12:12 +1000 Subject: [PATCH] feat: add CreateIssue to Forge interface with Gitea implementation --- .beads/config.yaml | 70 +---------------------------- .gitignore | 5 --- internal/daemon/daemon_test.go | 1 + internal/forge/forge.go | 3 ++ internal/forge/gitea.go | 9 ++++ internal/forge/github.go | 7 ++- internal/workflow/implement_test.go | 1 + 7 files changed, 22 insertions(+), 74 deletions(-) diff --git a/.beads/config.yaml b/.beads/config.yaml index 11180feec..d58845e77 100644 --- a/.beads/config.yaml +++ b/.beads/config.yaml @@ -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 diff --git a/.gitignore b/.gitignore index 932097749..2bd7074e0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,3 @@ *.db .references/ .claude/ - -# Beads / Dolt files (added by bd init) -.dolt/ -.beads-credential-key -.beads/proxieddb/ diff --git a/internal/daemon/daemon_test.go b/internal/daemon/daemon_test.go index 6acca5900..3649e88dd 100644 --- a/internal/daemon/daemon_test.go +++ b/internal/daemon/daemon_test.go @@ -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 } diff --git a/internal/forge/forge.go b/internal/forge/forge.go index 5b129fc58..1a23145eb 100644 --- a/internal/forge/forge.go +++ b/internal/forge/forge.go @@ -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 diff --git a/internal/forge/gitea.go b/internal/forge/gitea.go index d7f2bcf0b..14eda9838 100644 --- a/internal/forge/gitea.go +++ b/internal/forge/gitea.go @@ -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) diff --git a/internal/forge/github.go b/internal/forge/github.go index 2498aff5c..51703c4f6 100644 --- a/internal/forge/github.go +++ b/internal/forge/github.go @@ -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 diff --git a/internal/workflow/implement_test.go b/internal/workflow/implement_test.go index c5e6296f8..7ae128fb6 100644 --- a/internal/workflow/implement_test.go +++ b/internal/workflow/implement_test.go @@ -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 }