story-kit: merge 156_bug_onboarding_welcome_screen_triggers_on_already_configured_projects

This commit is contained in:
Dave
2026-02-24 16:13:39 +00:00
parent 125b77a592
commit b621727f48
2 changed files with 42 additions and 18 deletions

View File

@@ -230,7 +230,8 @@ This folder contains the "Living Specification" for the project. It serves as th
3. If a Story changes behavior, update the spec *first*, get approval, then write code. 3. If a Story changes behavior, update the spec *first*, get approval, then write code.
"#; "#;
const STORY_KIT_CONTEXT: &str = r#"# Project Context const STORY_KIT_CONTEXT: &str = r#"<!-- story-kit:scaffold-template -->
# Project Context
## High-Level Goal ## High-Level Goal
To build a standalone **Agentic AI Code Assistant** application as a single Rust binary that serves a Vite/React web UI and exposes a WebSocket API. The assistant will facilitate a "Story-Driven Spec Workflow" (SDSW) for software development. Unlike a passive chat interface, this assistant acts as an **Agent**, capable of using tools to read the filesystem, execute shell commands, manage git repositories, and modify code directly to implement features. To build a standalone **Agentic AI Code Assistant** application as a single Rust binary that serves a Vite/React web UI and exposes a WebSocket API. The assistant will facilitate a "Story-Driven Spec Workflow" (SDSW) for software development. Unlike a passive chat interface, this assistant acts as an **Agent**, capable of using tools to read the filesystem, execute shell commands, manage git repositories, and modify code directly to implement features.
@@ -265,7 +266,8 @@ To build a standalone **Agentic AI Code Assistant** application as a single Rust
* **Tool Call:** A structured request from the LLM to execute a specific native function. * **Tool Call:** A structured request from the LLM to execute a specific native function.
"#; "#;
const STORY_KIT_STACK: &str = r#"# Tech Stack & Constraints const STORY_KIT_STACK: &str = r#"<!-- story-kit:scaffold-template -->
# Tech Stack & Constraints
## Overview ## Overview
This project is a standalone Rust **web server binary** that serves a Vite/React frontend and exposes a **WebSocket API**. The built frontend assets are packaged with the binary (in a `frontend` directory) and served as static files. It functions as an **Agentic Code Assistant** capable of safely executing tools on the host system. This project is a standalone Rust **web server binary** that serves a Vite/React frontend and exposes a **WebSocket API**. The built frontend assets are packaged with the binary (in a `frontend` directory) and served as static files. It functions as an **Agentic Code Assistant** capable of safely executing tools on the host system.

View File

@@ -1,12 +1,10 @@
use std::path::Path; use std::path::Path;
/// Unique marker found in the scaffold template for `00_CONTEXT.md`. /// Sentinel comment injected as the first line of scaffold templates.
/// If the project's context file contains this phrase, it is still the /// Only untouched templates contain this marker — real project content
/// default scaffold content and needs to be replaced. /// will never include it, so it avoids false positives when the project
const TEMPLATE_MARKER_CONTEXT: &str = "Agentic AI Code Assistant"; /// itself is an "Agentic AI Code Assistant".
const TEMPLATE_SENTINEL: &str = "<!-- story-kit:scaffold-template -->";
/// Unique marker found in the scaffold template for `STACK.md`.
const TEMPLATE_MARKER_STACK: &str = "Agentic Code Assistant";
/// Marker found in the default `script/test` scaffold output. /// Marker found in the default `script/test` scaffold output.
const TEMPLATE_MARKER_SCRIPT: &str = "No tests configured"; const TEMPLATE_MARKER_SCRIPT: &str = "No tests configured";
@@ -40,11 +38,11 @@ pub fn check_onboarding_status(project_root: &Path) -> OnboardingStatus {
OnboardingStatus { OnboardingStatus {
needs_context: is_template_or_missing( needs_context: is_template_or_missing(
&story_kit.join("specs").join("00_CONTEXT.md"), &story_kit.join("specs").join("00_CONTEXT.md"),
TEMPLATE_MARKER_CONTEXT, TEMPLATE_SENTINEL,
), ),
needs_stack: is_template_or_missing( needs_stack: is_template_or_missing(
&story_kit.join("specs").join("tech").join("STACK.md"), &story_kit.join("specs").join("tech").join("STACK.md"),
TEMPLATE_MARKER_STACK, TEMPLATE_SENTINEL,
), ),
needs_test_script: is_template_or_missing( needs_test_script: is_template_or_missing(
&project_root.join("script").join("test"), &project_root.join("script").join("test"),
@@ -102,19 +100,19 @@ mod tests {
} }
#[test] #[test]
fn needs_onboarding_true_when_specs_contain_scaffold_markers() { fn needs_onboarding_true_when_specs_contain_scaffold_sentinel() {
let dir = TempDir::new().unwrap(); let dir = TempDir::new().unwrap();
let root = setup_project(&dir); let root = setup_project(&dir);
// Write scaffold template content // Write content that includes the scaffold sentinel
fs::write( fs::write(
root.join(".story_kit/specs/00_CONTEXT.md"), root.join(".story_kit/specs/00_CONTEXT.md"),
"# Project Context\nTo build a standalone Agentic AI Code Assistant...", "<!-- story-kit:scaffold-template -->\n# Project Context\nPlaceholder...",
) )
.unwrap(); .unwrap();
fs::write( fs::write(
root.join(".story_kit/specs/tech/STACK.md"), root.join(".story_kit/specs/tech/STACK.md"),
"# Tech Stack\nThis is an Agentic Code Assistant binary...", "<!-- story-kit:scaffold-template -->\n# Tech Stack\nPlaceholder...",
) )
.unwrap(); .unwrap();
@@ -124,6 +122,30 @@ mod tests {
assert!(status.needs_onboarding()); assert!(status.needs_onboarding());
} }
#[test]
fn needs_onboarding_false_when_content_mentions_agentic_but_no_sentinel() {
let dir = TempDir::new().unwrap();
let root = setup_project(&dir);
// Real project content that happens to mention "Agentic AI Code Assistant"
// but does NOT contain the scaffold sentinel — should NOT trigger onboarding.
fs::write(
root.join(".story_kit/specs/00_CONTEXT.md"),
"# Project Context\nTo build a standalone Agentic AI Code Assistant application.",
)
.unwrap();
fs::write(
root.join(".story_kit/specs/tech/STACK.md"),
"# Tech Stack\nThis is an Agentic Code Assistant binary.",
)
.unwrap();
let status = check_onboarding_status(&root);
assert!(!status.needs_context);
assert!(!status.needs_stack);
assert!(!status.needs_onboarding());
}
#[test] #[test]
fn needs_onboarding_false_when_specs_have_custom_content() { fn needs_onboarding_false_when_specs_have_custom_content() {
let dir = TempDir::new().unwrap(); let dir = TempDir::new().unwrap();
@@ -239,13 +261,13 @@ mod tests {
let dir = TempDir::new().unwrap(); let dir = TempDir::new().unwrap();
let root = setup_project(&dir); let root = setup_project(&dir);
// Context is still template // Context still has sentinel
fs::write( fs::write(
root.join(".story_kit/specs/00_CONTEXT.md"), root.join(".story_kit/specs/00_CONTEXT.md"),
"Agentic AI Code Assistant placeholder", "<!-- story-kit:scaffold-template -->\n# Project Context\nPlaceholder...",
) )
.unwrap(); .unwrap();
// Stack is customised // Stack is customised (no sentinel)
fs::write( fs::write(
root.join(".story_kit/specs/tech/STACK.md"), root.join(".story_kit/specs/tech/STACK.md"),
"# My Stack\nRuby on Rails + PostgreSQL", "# My Stack\nRuby on Rails + PostgreSQL",