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();