Fixes #18: Update README & AGENTS.md documentation
- README: Add Equipment System feature, Code Quality, Performance, Memory Management, Testing, Development Commands, and Tech Stack sections - AGENTS.md: Update source tree with CSS modules, equipment constants, renderUtils, settings consolidation; add development commands, performance optimizations, memory management notes, validator factory; update file reference table Based on PRs: #1 #3 #6 #8 #10 #12 #14 #17
This commit is contained in:
@@ -41,6 +41,7 @@ Moving on to developing the Marinara Engine frontend, the extension will now be
|
||||
- **🎭 Floating Thought Bubbles**: Optional thought bubbles positioned next to character avatars in chat
|
||||
- **🎲 Classic RPG Stats**: STR, DEX, CON, INT, WIS, CHA attributes with dice roll support
|
||||
- **📦 Advanced Inventory System**: Multi-location storage (On Person, Stored locations, Assets) with v2 format
|
||||
- **⚔️ Equipment System**: 19 equipment slots (Helmet, Necklace, Body Armor, Gloves, Pants, Shoes, 10 Rings, 3 Accessories) with slot-type validation, stat bonuses (+99 max), and automatic slot assignment
|
||||
- **🎯 Character Stats**: Track health, energy, or any custom stats for each present character with color interpolation
|
||||
- **📜 Immersive HTML**: Enhance the immersion by including creative HTML/CSS/JS elements in your roleplay
|
||||
- **➡️ Plot Progression**: Progress the plot with randomized events or natural progression with a click of a button
|
||||
@@ -226,6 +227,49 @@ Choose from 6 beautiful themes:
|
||||
|
||||
If you ever have an awesome idea to do your own SillyTavern extension, don't.
|
||||
|
||||
### Code Quality
|
||||
|
||||
- **index.js refactored**: 1567 lines → 456 lines (73% reduction) through modular extraction
|
||||
- **CSS modularized**: 28 logical modules in `src/styles/` with automated build script
|
||||
- **Settings consolidation**: `config.js` as single source of truth — state.js imports from it (~300 lines eliminated)
|
||||
- **Validator factory pattern**: `createStringValidator()` unifies `sanitizeLocationName`/`sanitizeItemName`
|
||||
- **Prompt builder refactored**: `getCharacterCardsInfo` extracted into focused helper functions
|
||||
- **Error visibility**: `jsonRepair.js` silent failures now log to `console.debug`
|
||||
|
||||
### Performance
|
||||
|
||||
- **Rendering**: `requestAnimationFrame` batching in `rerenderRpgState()`, `updateIfChanged()` cache in `renderUtils.js`, CSS `content-visibility: auto` on inventory/equipment containers
|
||||
- **Parser**: Regex pre-compilation (~64 patterns in `parser.js` + `jsonRepair.js` as module-level constants), format detection caching (`lastDetectedFormat` with 3-hit threshold), `clearFormatCache()` for invalidation
|
||||
- **CSS**: Minification support (`--minify` flag in build script), extended CSS custom properties, theme refactoring (379 → ~220 lines), `style.css` reduced from 305.4 KB → 293.9 KB (3.8%), minified build adds ~50%+ further reduction
|
||||
|
||||
### Memory Management
|
||||
|
||||
- **`clearDomCache()`**: Invalidates jQuery object cache on panel rebuild to prevent stale references
|
||||
- **Event tracking**: All `on()`/`once()` handlers tracked for cleanup via `unregisterAllEvents()`
|
||||
- **`clearDebugLogs()`**: Called on `CHAT_CHANGED` to prevent unbounded debug log growth
|
||||
|
||||
### Testing
|
||||
|
||||
- **78 tests passing** (up from 54) using Jest with Babel ESM support
|
||||
- ESM compatibility via `babel.config.json` + `jest.config.cjs` transform configuration
|
||||
- Security-focused test suite (`security.test.js`, 24 tests)
|
||||
|
||||
### Development Commands
|
||||
|
||||
```bash
|
||||
npm run build:css # Concatenate CSS modules
|
||||
npm run build:css:min # Minified production build
|
||||
npm test # Run Jest test suite
|
||||
npm run validate_locale # Watch mode translation validation
|
||||
npm run validate_locale_once
|
||||
```
|
||||
|
||||
### Tech Stack
|
||||
|
||||
- `"type": "module"` — ES modules throughout
|
||||
- Jest + Babel for testing with full ESM support
|
||||
- Modular CSS build pipeline with minification support
|
||||
|
||||
## 🐛 Troubleshooting
|
||||
|
||||
### Extension doesn't appear
|
||||
|
||||
Reference in New Issue
Block a user