Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as opaque submodule gitlinks on GitHub) into fully-tracked first-party content. AITM now merges its 7 vendored repos as first-party engines: - memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts - git: vendored C git (bundled binary) + gitnexus (in-process code intelligence) - agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess) Includes the full session's product build: Gitgram web/mobile/backend features, AITM website/CLI/MCP, the unified memory layer, engine build tooling (scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md), and extensive test suites. Build artifacts, node_modules, external/, and gemini-cli are gitignored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
77 lines
2.3 KiB
Go
77 lines
2.3 KiB
Go
package dolt
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
"fmt"
|
|
|
|
"github.com/steveyegge/beads/internal/storage/issueops"
|
|
"github.com/steveyegge/beads/internal/types"
|
|
)
|
|
|
|
// AddLabel adds a label to an issue
|
|
func (s *DoltStore) AddLabel(ctx context.Context, issueID, label, actor string) error {
|
|
isWisp := s.isActiveWisp(ctx, issueID)
|
|
if err := s.withRetryTx(ctx, func(tx *sql.Tx) error {
|
|
return issueops.AddLabelInTx(ctx, tx, "", "", issueID, label, actor)
|
|
}); err != nil {
|
|
return err
|
|
}
|
|
if isWisp {
|
|
return nil
|
|
}
|
|
return s.doltAddAndCommit(ctx, []string{"events", "labels"}, fmt.Sprintf("bd: label add %s", issueID))
|
|
}
|
|
|
|
// RemoveLabel removes a label from an issue.
|
|
// Delegates SQL work to issueops.RemoveLabelInTx which handles wisp routing.
|
|
func (s *DoltStore) RemoveLabel(ctx context.Context, issueID, label, actor string) error {
|
|
isWisp := s.isActiveWisp(ctx, issueID)
|
|
if err := s.withRetryTx(ctx, func(tx *sql.Tx) error {
|
|
return issueops.RemoveLabelInTx(ctx, tx, "", "", issueID, label, actor)
|
|
}); err != nil {
|
|
return err
|
|
}
|
|
if isWisp {
|
|
return nil
|
|
}
|
|
return s.doltAddAndCommit(ctx, []string{"events", "labels"}, fmt.Sprintf("bd: label remove %s", issueID))
|
|
}
|
|
|
|
// GetLabels retrieves all labels for an issue
|
|
func (s *DoltStore) GetLabels(ctx context.Context, issueID string) ([]string, error) {
|
|
var labels []string
|
|
err := s.withReadTx(ctx, func(tx *sql.Tx) error {
|
|
var err error
|
|
labels, err = issueops.GetLabelsInTx(ctx, tx, "", issueID)
|
|
return err
|
|
})
|
|
return labels, err
|
|
}
|
|
|
|
// GetLabelsForIssues retrieves labels for multiple issues.
|
|
// Delegates to issueops.GetLabelsForIssuesInTx for shared query logic.
|
|
func (s *DoltStore) GetLabelsForIssues(ctx context.Context, issueIDs []string) (map[string][]string, error) {
|
|
var result map[string][]string
|
|
err := s.withReadTx(ctx, func(tx *sql.Tx) error {
|
|
var err error
|
|
result, err = issueops.GetLabelsForIssuesInTx(ctx, tx, issueIDs)
|
|
return err
|
|
})
|
|
return result, err
|
|
}
|
|
|
|
// GetIssuesByLabel retrieves all issues with a specific label
|
|
func (s *DoltStore) GetIssuesByLabel(ctx context.Context, label string) ([]*types.Issue, error) {
|
|
var ids []string
|
|
err := s.withReadTx(ctx, func(tx *sql.Tx) error {
|
|
var err error
|
|
ids, err = issueops.GetIssuesByLabelInTx(ctx, tx, label)
|
|
return err
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return s.GetIssuesByIDs(ctx, ids)
|
|
}
|