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>
109 lines
2.9 KiB
Go
109 lines
2.9 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
"github.com/steveyegge/beads/internal/storage"
|
|
"github.com/steveyegge/beads/internal/types"
|
|
"github.com/steveyegge/beads/internal/ui"
|
|
)
|
|
|
|
var reopenCmd = &cobra.Command{
|
|
Use: "reopen [id...]",
|
|
GroupID: "issues",
|
|
Short: "Reopen one or more closed issues",
|
|
Long: `Reopen closed issues by setting status to 'open' and clearing the closed_at timestamp.
|
|
This is more explicit than 'bd update --status open' and emits a Reopened event.`,
|
|
Args: cobra.MinimumNArgs(1),
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
CheckReadonly("reopen")
|
|
|
|
if usesProxiedServer() {
|
|
runReopenProxiedServer(cmd, rootCtx, args)
|
|
return
|
|
}
|
|
|
|
reason, _ := cmd.Flags().GetString("reason")
|
|
ctx := rootCtx
|
|
|
|
reopenedIssues := []*types.Issue{}
|
|
hasError := false
|
|
mutatedStores := map[storage.DoltStorage][]string{}
|
|
pendingCloseResults := []*RoutedResult{}
|
|
if store == nil {
|
|
FatalErrorWithHint("database not initialized",
|
|
diagHint())
|
|
}
|
|
for _, id := range args {
|
|
// Resolve with prefix routing (supports cross-rig reopens like `bd reopen xe-5ls`)
|
|
result, err := resolveAndGetIssueForMutation(ctx, store, id)
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "Error resolving %s: %v\n", id, err)
|
|
hasError = true
|
|
continue
|
|
}
|
|
fullID := result.ResolvedID
|
|
issueStore := result.Store
|
|
issue := result.Issue
|
|
|
|
// Skip if already open — avoid false "Reopened" message
|
|
if issue.Status == types.StatusOpen {
|
|
fmt.Fprintf(os.Stderr, "%s is already open\n", fullID)
|
|
result.Close()
|
|
continue
|
|
}
|
|
if err := issueStore.ReopenIssue(ctx, fullID, reason, actor); err != nil {
|
|
fmt.Fprintf(os.Stderr, "Error reopening %s: %v\n", fullID, err)
|
|
hasError = true
|
|
result.Close()
|
|
continue
|
|
}
|
|
mutatedStores[issueStore] = append(mutatedStores[issueStore], fullID)
|
|
pendingCloseResults = append(pendingCloseResults, result)
|
|
if jsonOutput {
|
|
updated, _ := issueStore.GetIssue(ctx, fullID)
|
|
if updated != nil {
|
|
reopenedIssues = append(reopenedIssues, updated)
|
|
}
|
|
} else {
|
|
reasonMsg := ""
|
|
if reason != "" {
|
|
reasonMsg = ": " + reason
|
|
}
|
|
fmt.Printf("%s Reopened %s%s\n", ui.RenderAccent("↻"), fullID, reasonMsg)
|
|
}
|
|
}
|
|
|
|
for s, ids := range mutatedStores {
|
|
if err := commitPendingIfEmbedded(ctx, s, actor, doltAutoCommitParams{
|
|
Command: "reopen",
|
|
IssueIDs: ids,
|
|
}); err != nil {
|
|
for _, result := range pendingCloseResults {
|
|
result.Close()
|
|
}
|
|
FatalErrorRespectJSON("failed to commit: %v", err)
|
|
}
|
|
}
|
|
for _, result := range pendingCloseResults {
|
|
result.Close()
|
|
}
|
|
|
|
if jsonOutput && len(reopenedIssues) > 0 {
|
|
outputJSON(reopenedIssues)
|
|
}
|
|
|
|
if hasError {
|
|
os.Exit(1)
|
|
}
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
reopenCmd.Flags().StringP("reason", "r", "", "Reason for reopening")
|
|
reopenCmd.ValidArgsFunction = issueIDCompletion
|
|
rootCmd.AddCommand(reopenCmd)
|
|
}
|