gitgram/aitimemachine/beads/cmd/bd/recompute_blocked.go
caelum0x 49b183818c Unify gitgram + aitimemachine into the monorepo (de-submodule) and merge vendored engines
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>
2026-06-23 14:14:09 +03:00

59 lines
1.9 KiB
Go

package main
import (
"fmt"
"github.com/spf13/cobra"
"github.com/steveyegge/beads/internal/storage"
)
var recomputeBlockedCmd = &cobra.Command{
Use: "recompute-blocked",
GroupID: "maint",
Short: "Recompute is_blocked for all issues (repairs stale flags after a pull)",
Long: `Recompute the denormalized is_blocked flag for every issue and wisp.
is_blocked is derived from the dependency graph and maintained automatically by
local writes and by a post-pull recompute scoped to what the merge changed. If
that scoped recompute is skipped — a recompute that failed after its merge
committed, or a conflicted pull resolved by hand — the flag can go stale, and a
later pull that merges nothing will not refresh it (bd-6dnrw.37). 'bd ready'
trusts the flag, so stale values silently hide ready work or surface blocked
work.
This command runs the full recompute unconditionally and commits the result.
It is idempotent: on a consistent database it changes nothing. Works in both
embedded and server mode (unlike 'bd doctor', which is server-mode only).
Examples:
bd recompute-blocked # Repair stale is_blocked flags
bd recompute-blocked --json # Machine-parseable {"rows_corrected": N}`,
Run: func(_ *cobra.Command, _ []string) {
CheckReadonly("recompute-blocked")
ctx := rootCtx
recomputer, ok := storage.UnwrapStore(store).(storage.BlockedRecomputer)
if !ok {
FatalError("storage backend does not support is_blocked recompute")
}
changed, err := recomputer.RecomputeAllBlocked(ctx)
if err != nil {
FatalError("recompute is_blocked: %v", err)
}
if jsonOutput {
outputJSON(map[string]interface{}{"rows_corrected": changed})
return
}
if changed == 0 {
fmt.Println("is_blocked already consistent — nothing to recompute.")
return
}
fmt.Printf("Recomputed is_blocked: %d row(s) corrected.\n", changed)
},
}
func init() {
rootCmd.AddCommand(recomputeBlockedCmd)
}