fix(daemon): silence deprecation warnings in --json mode
Follow-up fixes to PR #1006: - Silence deprecation warnings when --json flag is set (agent ergonomics) - Remove unused outputStatusJSON() function - Remove unused encoding/json import from daemon_status.go Agents parsing JSON output dont need deprecation warnings cluttering stderr. The subcommand syntax (bd daemon start) remains the documented path forward. See bd-ntl3b for deduplication work, bd-kpa7c for type consolidation. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+3
-1
@@ -67,7 +67,8 @@ Run 'bd daemon --help' to see all subcommands.`,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show deprecation warnings for flag-based actions
|
// Show deprecation warnings for flag-based actions (skip in JSON mode for agent ergonomics)
|
||||||
|
if !jsonOutput {
|
||||||
if start {
|
if start {
|
||||||
fmt.Fprintf(os.Stderr, "Warning: --start is deprecated, use 'bd daemon start' instead\n")
|
fmt.Fprintf(os.Stderr, "Warning: --start is deprecated, use 'bd daemon start' instead\n")
|
||||||
}
|
}
|
||||||
@@ -83,6 +84,7 @@ Run 'bd daemon --help' to see all subcommands.`,
|
|||||||
if health {
|
if health {
|
||||||
fmt.Fprintf(os.Stderr, "Warning: --health is deprecated, use 'bd daemon status --all' instead\n")
|
fmt.Fprintf(os.Stderr, "Warning: --health is deprecated, use 'bd daemon status --all' instead\n")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If auto-commit/auto-push flags weren't explicitly provided, read from config
|
// If auto-commit/auto-push flags weren't explicitly provided, read from config
|
||||||
// GH#871: Read from config.yaml first (team-shared), then fall back to SQLite (legacy)
|
// GH#871: Read from config.yaml first (team-shared), then fall back to SQLite (legacy)
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -443,9 +442,3 @@ func showAllDaemonsStatus(cmd *cobra.Command) {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// outputStatusJSON outputs the status as JSON (helper to avoid duplicating json.Marshal)
|
|
||||||
func outputStatusJSON(v interface{}) {
|
|
||||||
data, _ := json.MarshalIndent(v, "", " ")
|
|
||||||
fmt.Println(string(data))
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user