From fc160b5c5fc1825571b1bd55faf6306e057bc744 Mon Sep 17 00:00:00 2001 From: dave Date: Sat, 28 Mar 2026 15:17:42 +0000 Subject: [PATCH] feat: wizard detects bare projects and prompts user interview for context/stack wizard_generate now checks if the project has no source code. On bare projects, the generation hints tell the LLM to ask the user what they want to build and what tech stack they plan to use, rather than trying to read a nonexistent codebase. Co-Authored-By: Claude Opus 4.6 (1M context) --- server/src/http/mcp/wizard_tools.rs | 65 ++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 10 deletions(-) diff --git a/server/src/http/mcp/wizard_tools.rs b/server/src/http/mcp/wizard_tools.rs index 183249b2..da5319c0 100644 --- a/server/src/http/mcp/wizard_tools.rs +++ b/server/src/http/mcp/wizard_tools.rs @@ -152,22 +152,67 @@ pub(super) fn tool_wizard_generate(args: &Value, ctx: &AppContext) -> Result bool { + let dominated_by_storkit = std::fs::read_dir(project_root) + .ok() + .map(|entries| { + let names: Vec = entries + .filter_map(|e| e.ok()) + .map(|e| e.file_name().to_string_lossy().to_string()) + .collect(); + // A bare project only has storkit scaffolding and no real code + names.iter().all(|n| { + n.starts_with('.') + || n == "CLAUDE.md" + || n == "LICENSE" + || n == "README.md" + || n == "script" + || n == "store.json" + }) + }) + .unwrap_or(true); + dominated_by_storkit +} + /// Return a generation hint for a step based on the project root. fn generation_hint(step: WizardStep, project_root: &Path) -> String { + let bare = is_bare_project(project_root); + match step { WizardStep::Context => { - "Read the project source tree and generate a `.storkit/specs/00_CONTEXT.md` describing:\n\ - - High-level goal of the project\n\ - - Core features\n\ - - Domain concepts and entities\n\ - - Glossary of abbreviations and technical terms".to_string() + if bare { + "This is a bare project with no existing code. Ask the user what they want \ + to build — the project's purpose, goals, target users, and key features. \ + Then generate `.storkit/specs/00_CONTEXT.md` from their answers covering:\n\ + - High-level goal of the project\n\ + - Core features\n\ + - Domain concepts and entities\n\ + - Glossary of abbreviations and technical terms".to_string() + } else { + "Read the project source tree and generate a `.storkit/specs/00_CONTEXT.md` describing:\n\ + - High-level goal of the project\n\ + - Core features\n\ + - Domain concepts and entities\n\ + - Glossary of abbreviations and technical terms".to_string() + } } WizardStep::Stack => { - "Read the project source tree and generate a `.storkit/specs/tech/STACK.md` describing:\n\ - - Language, frameworks, and runtimes\n\ - - Coding standards and linting rules\n\ - - Quality gates (commands that must pass before merging)\n\ - - Approved libraries and their purpose".to_string() + if bare { + "This is a bare project with no existing code. Ask the user what language, \ + frameworks, and tools they plan to use. Then generate `.storkit/specs/tech/STACK.md` \ + from their answers covering:\n\ + - Language, frameworks, and runtimes\n\ + - Coding standards and linting rules\n\ + - Quality gates (commands that must pass before merging)\n\ + - Approved libraries and their purpose".to_string() + } else { + "Read the project source tree and generate a `.storkit/specs/tech/STACK.md` describing:\n\ + - Language, frameworks, and runtimes\n\ + - Coding standards and linting rules\n\ + - Quality gates (commands that must pass before merging)\n\ + - Approved libraries and their purpose".to_string() + } } WizardStep::TestScript => { let has_cargo = project_root.join("Cargo.toml").exists();