feat(doctor): surface memory feature state in --json output (#489)

Operators ask "is memory on?" and "where does it live?" without
wanting to boot the TUI. Adds a \`memory\` block to the JSON doctor
report:

\`\`\`json
"memory": {
  "enabled": false,                                  // honours DEEPSEEK_MEMORY env
  "path": "/Users/you/.deepseek/memory.md",          // expanded path
  "file_present": false                              // does the file exist on disk?
}
\`\`\`

The \`enabled\` field reads \`DEEPSEEK_MEMORY\` directly so it stays
correct on this stabilization branch even though the dedicated
\`Config::memory_enabled()\` accessor lives on the memory-MVP branch
(#518). When both PRs land, the duplicated env-parse can collapse to
a single method call — TODO comment marks the spot.

Verified:
- \`deepseek doctor --json\` shows \`enabled: false\` by default
- \`DEEPSEEK_MEMORY=on deepseek doctor --json\` shows \`enabled: true\`
- All gates green (1856 main + supporting)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hunter Bown
2026-05-03 04:16:01 -05:00
parent 8071bce319
commit 1b7939e680
+27
View File
@@ -1824,6 +1824,32 @@ fn run_doctor_json(
let tools_dir = default_tools_dir();
let plugins_dir = default_plugins_dir();
// Memory feature state (#489). Operators ask "is memory on?" and
// "where does it live?" — surface both here so the question can be
// answered without booting the TUI. Both inputs are checked: the
// config flag and the env-var override that the runtime would
// honour. (The dedicated `Config::memory_enabled()` accessor lives
// on the memory-MVP branch (#518); this duplicates the same logic
// until the two PRs land and it can be replaced with a single
// method call.)
let memory_path = config.memory_path();
let memory_enabled_env = std::env::var("DEEPSEEK_MEMORY")
.ok()
.map(|raw| {
matches!(
raw.trim().to_ascii_lowercase().as_str(),
"1" | "on" | "true" | "yes" | "y" | "enabled"
)
})
.unwrap_or(false);
let memory_summary = json!({
// The MVP feature is opt-in by default; this defaults to false
// on branches without the [memory] section in `Config`.
"enabled": memory_enabled_env,
"path": memory_path.display().to_string(),
"file_present": memory_path.exists(),
});
let report = json!({
"version": env!("CARGO_PKG_VERSION"),
"config_path": config_path.display().to_string(),
@@ -1840,6 +1866,7 @@ fn run_doctor_json(
.default_text_model
.clone()
.unwrap_or_else(|| DEFAULT_TEXT_MODEL.to_string()),
"memory": memory_summary,
"mcp": mcp_summary,
"skills": {
"selected": selected_skills_dir.display().to_string(),