Files
storybook/.serena/memories/tree-sitter-commands.md
Sienna Meridian Satterwhite 16deb5d237 release: Storybook v0.2.0 - Major syntax and features update
BREAKING CHANGES:
- Relationship syntax now requires blocks for all participants
- Removed self/other perspective blocks from relationships
- Replaced 'guard' keyword with 'if' for behavior tree decorators

Language Features:
- Add tree-sitter grammar with improved if/condition disambiguation
- Add comprehensive tutorial and reference documentation
- Add SBIR v0.2.0 binary format specification
- Add resource linking system for behaviors and schedules
- Add year-long schedule patterns (day, season, recurrence)
- Add behavior tree enhancements (named nodes, decorators)

Documentation:
- Complete tutorial series (9 chapters) with baker family examples
- Complete reference documentation for all language features
- SBIR v0.2.0 specification with binary format details
- Added locations and institutions documentation

Examples:
- Convert all examples to baker family scenario
- Add comprehensive working examples

Tooling:
- Zed extension with LSP integration
- Tree-sitter grammar for syntax highlighting
- Build scripts and development tools

Version Updates:
- Main package: 0.1.0 → 0.2.0
- Tree-sitter grammar: 0.1.0 → 0.2.0
- Zed extension: 0.1.0 → 0.2.0
- Storybook editor: 0.1.0 → 0.2.0
2026-02-13 21:52:03 +00:00

89 lines
2.1 KiB
Markdown

# Tree-sitter Grammar Commands
## Location
Tree-sitter grammar is at: `/Users/sienna/Development/storybook/tree-sitter-storybook/`
## Running Tests
**Use Serena's execute_shell_command when Bash tool fails:**
```bash
cd /Users/sienna/Development/storybook/tree-sitter-storybook && npm run test
```
This runs the tree-sitter test suite against all corpus files in `test/corpus/`.
## Test Corpus Structure
Test files are in `test/corpus/*.txt` format:
```
==================
Test Name
==================
[input code]
---
[expected parse tree]
```
### Key Parse Tree Patterns for Behaviors:
1. **All declarations wrap in `(declaration ...)`**
2. **Behavior nodes wrap children in `(behavior_node ...)`**
3. **Paths have internal structure:**
```
(path
(path_segments
(identifier)
(identifier)))
```
Not just `(path)`
### Example Behavior Test Structure:
```
behavior SimpleBehavior {
walk_around
}
---
(source_file
(declaration
(behavior
name: (identifier)
root: (behavior_node
(action_node (identifier))))))
```
## Regenerating Parser
If grammar.js changes:
```bash
cd /Users/sienna/Development/storybook/tree-sitter-storybook && npm run build
```
This runs `tree-sitter generate` and compiles the parser.
## Test Results (as of 2026-02-09)
✅ All 27 tests passing:
- 17 declaration tests
- 7 behavior tree tests (selector, sequence, repeat, nested, subtree, etc.)
- 3 basic tests
## Behavior Tree Node Types Tested
- `action_node` - Simple action identifiers
- `selector_node` - `? { ... }` - Try options in order
- `sequence_node` - `> { ... }` - Execute in sequence
- `repeat_node` - `* { ... }` - Repeat forever
- `subtree_node` - `@path::to::tree` - Reference external behavior
## Common Issues
1. **Bash tool failing with exit code 1** - Use Serena's execute_shell_command instead
2. **Path structure mismatch** - Remember paths include path_segments wrapper
3. **Missing declaration wrapper** - All top-level items wrap in `(declaration ...)`
4. **Missing behavior_node wrapper** - Behavior children wrap in `(behavior_node ...)`