Story 18: Token-by-token streaming responses
- Backend: Added OllamaProvider::chat_stream() with newline-delimited JSON parsing - Backend: Emit chat:token events for each token received from Ollama - Backend: Added futures dependency and stream feature for reqwest - Frontend: Added streamingContent state and chat:token event listener - Frontend: Real-time token display with auto-scroll - Frontend: Markdown and syntax highlighting support for streaming content - Fixed all TypeScript errors (tsc --noEmit) - Fixed all Biome warnings and errors - Fixed all Clippy warnings - Added comprehensive code quality documentation - Added tsc --noEmit to verification checklist Tested and verified: - Tokens stream in real-time - Auto-scroll works during streaming - Tool calls interrupt streaming correctly - Multi-turn conversations work - Smooth performance with no lag
This commit is contained in:
@@ -100,3 +100,63 @@ If a user hands you this document and says "Apply this process to my project":
|
||||
4. **Draft Context:** Write `specs/00_CONTEXT.md` based on the user's answer.
|
||||
5. **Draft Stack:** Write `specs/tech/STACK.md` based on best practices for that language.
|
||||
6. **Wait:** Ask the user for "Story #1".
|
||||
|
||||
---
|
||||
|
||||
## 6. Code Quality Tools
|
||||
|
||||
**MANDATORY:** Before completing Step 4 (Verification) of any story, you MUST run all applicable linters and fix ALL errors and warnings. Zero tolerance for warnings or errors.
|
||||
|
||||
### TypeScript/JavaScript: Biome
|
||||
|
||||
* **Tool:** [Biome](https://biomejs.dev/) - Fast formatter and linter
|
||||
* **Check Command:** `npx @biomejs/biome check src/`
|
||||
* **Fix Command:** `npx @biomejs/biome check --write src/`
|
||||
* **Unsafe Fixes:** `npx @biomejs/biome check --write --unsafe src/`
|
||||
* **Configuration:** `biome.json` in project root
|
||||
* **When to Run:**
|
||||
* After every code change to TypeScript/React files
|
||||
* Before committing any frontend changes
|
||||
* During Step 4 (Verification) - must show 0 errors, 0 warnings
|
||||
|
||||
**Biome Rules to Follow:**
|
||||
* No `any` types (use proper TypeScript types or `unknown`)
|
||||
* No array index as `key` in React (use stable IDs)
|
||||
* No assignments in expressions (extract to separate statements)
|
||||
* All buttons must have explicit `type` prop (`button`, `submit`, or `reset`)
|
||||
* Mouse events must be accompanied by keyboard events for accessibility
|
||||
* Use template literals instead of string concatenation
|
||||
* Import types with `import type { }` syntax
|
||||
* Organize imports automatically
|
||||
|
||||
### Rust: Clippy
|
||||
|
||||
* **Tool:** [Clippy](https://github.com/rust-lang/rust-clippy) - Rust linter
|
||||
* **Check Command:** `cargo clippy --all-targets --all-features`
|
||||
* **Fix Command:** `cargo clippy --fix --allow-dirty --allow-staged`
|
||||
* **When to Run:**
|
||||
* After every code change to Rust files
|
||||
* Before committing any backend changes
|
||||
* During Step 4 (Verification) - must show 0 errors, 0 warnings
|
||||
|
||||
**Clippy Rules to Follow:**
|
||||
* No unused variables (prefix with `_` if intentionally unused)
|
||||
* No dead code (remove or mark with `#[allow(dead_code)]` if used conditionally)
|
||||
* Use `?` operator instead of explicit error handling where possible
|
||||
* Prefer `if let` over `match` for single-pattern matches
|
||||
* Use meaningful variable names
|
||||
* Follow Rust idioms and best practices
|
||||
|
||||
### Build Verification Checklist
|
||||
|
||||
Before asking for user acceptance in Step 4:
|
||||
|
||||
- [ ] Run `cargo clippy` (Rust) - 0 errors, 0 warnings
|
||||
- [ ] Run `cargo check` (Rust) - successful compilation
|
||||
- [ ] Run `cargo test` (Rust) - all tests pass
|
||||
- [ ] Run `npx @biomejs/biome check src/` (TypeScript) - 0 errors, 0 warnings
|
||||
- [ ] Run `npm run build` (TypeScript) - successful build
|
||||
- [ ] Manually test the feature works as expected
|
||||
- [ ] All acceptance criteria verified
|
||||
|
||||
**Failure to meet these criteria means the story is NOT ready for acceptance.**
|
||||
|
||||
Reference in New Issue
Block a user