beads/cmd/bd/info_proxied_server.go
Harry Miller 39b9ee1d81
fix(info): honor doctor.suppress.git-hooks in bd info (#6027) (#6710)
Root cause: renderInfo called CheckGitHooks()/FormatHookWarnings()
unconditionally, so setting doctor.suppress.git-hooks=true silenced the
check in bd doctor but bd info kept printing "Git hooks not installed".

Fix: split the config-map half of the doctor suppress reader out as
doctor.SuppressedChecksFromConfig (the store-backed helper now delegates
to it, same semantics), and have both bd info paths (direct and
proxied-server) feed it the config map they already load. renderInfo
skips the hook warning when the git-hooks slug is suppressed. bd info
--json never carried the warning and is unchanged.

Agent-Signature: claude-code-opus-5-5-unknown-reasoning on behalf of Harry Miller

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 05:44:48 -07:00

62 lines
1.9 KiB
Go

package main
import (
"context"
"github.com/steveyegge/beads/cmd/bd/doctor"
"github.com/steveyegge/beads/internal/types"
"github.com/steveyegge/beads/internal/workapi"
)
func runInfoProxiedServer(ctx context.Context, schemaFlag bool) error {
uw, err := openProxiedListUOW(ctx)
if err != nil {
return HandleError("%v", err)
}
defer uw.Close(ctx)
absDBPath := absoluteDBPath()
info := map[string]interface{}{
"database_path": absDBPath,
"mode": "proxied-server",
}
suppressHookWarning := false
page, err := uw.IssueUseCase().SearchIssues(ctx, "", types.IssueFilter{})
var issues []*types.Issue
if err == nil {
issues = page.Items
info["issue_count"] = len(issues)
}
// THE SAME FILTER THE SETTINGS ROLE USES. `bd info --json` serves
// this map whole, and the beads MCP server's get_schema_info tool
// runs `bd info --schema --json` and returns the parsed dict —
// config included — so every memory key AND VALUE landed in the
// transcript of any agent that asked a SCHEMA question. `bd info`
// is also the diagnostic people paste into bug reports.
//
// Unlike `bd config show`, which an operator asks for by name to
// see provenance, nothing here says "show me my memories".
configMap, err := uw.ConfigUseCase().GetAllConfig(ctx)
if err == nil {
if filtered := workapi.FilterSettingsEnumeration(configMap); len(filtered) > 0 {
info["config"] = filtered
}
// GH#6027: honor the same doctor.suppress.git-hooks bd doctor does.
suppressHookWarning = doctor.SuppressedChecksFromConfig(configMap)[doctor.CheckNameToSlug("Git Hooks")]
}
if schemaFlag {
schemaVersion, err := uw.ConfigUseCase().GetLocalMetadata(ctx, "bd_version")
if err != nil {
schemaVersion = "unknown"
}
prefix, _ := uw.ConfigUseCase().GetConfig(ctx, "issue_prefix")
info["schema"] = buildInfoSchema(schemaVersion, prefix, issues)
}
return renderInfo(info, schemaFlag, absDBPath, suppressHookWarning)
}