Skip to content

Releases: calionauta/starhtml-skill

v0.2.2 - Detect Signal as Boolean (W031)

Choose a tag to compare

@calionauta calionauta released this 07 Mar 11:36

🆕 New Warning: W031

Detects: Signal Used as Python Boolean

Problem: Signals are always truthy in Python, breaking conditional logic at runtime.

Common Mistake:

(is_saving := Signal('is_saving', False))

# ❌ WRONG - Always shows 'Saving...' because Signal objects are truthy
Button('Save' if not is_saving else 'Saving...')

if is_saving:
    return 'Loading...'

Correct Fix:

# ✅ RIGHT - Use reactive attributes
Button(
    'Save this thought',
    data_text=is_saving.if_('Saving...', 'Save this thought')
)

Div(data_show=is_saving)  # Show/hide based on signal

📋 Detection Patterns

W031 flags these patterns:

  • if is_saving: ...
  • if not is_saving: ...
  • 'Save' if not is_saving else 'Saving...' (ternary)
  • while is_running: ...
  • if is_saving and is_valid: ...

🐛 Bug Fixed

This addresses a common runtime bug where button text or UI elements don't update correctly because the Signal object itself is being evaluated in Python, not its reactive value.

Before (broken):

Button('Save' if not is_saving else 'Saving...')  # Always 'Saving...'

After (working):

Button(data_text=is_saving.if_('Saving...', 'Save'))  # Reactive! ✅

📦 Installation

# Update existing install
starhtml-check --update

# Or fresh install
curl -L https://raw.githubusercontent.com/renatocaliari/starhtml-skill/main/starhtml_check.py \
  -o /usr/local/bin/starhtml-check && chmod +x /usr/local/bin/starhtml-check

Full changelog: v0.2.1...v0.2.2

v0.2.1 - Fix False Positives (W015, W017)

Choose a tag to compare

@calionauta calionauta released this 06 Mar 19:32

🐛 Bug Fixes

W017 (Computed Signal) — Eliminate False Positives

Problem: Checker was flagging variable references as 'computed signals'

Before (❌ false positives):

Signal('x', todo['id'])    # ❌ W017 (not computed, just dict lookup)
Signal('y', count)         # ❌ W017 (not computed, just variable)
Signal('z', user.name)     # ❌ W017 (not computed, just attribute)

After (✅ only real computed expressions):

Signal('x', todo['id'])    # ✅ OK (Subscript)
Signal('y', count)         # ✅ OK (Name)
Signal('total', a * b)     # ⚠️ W017 (BinOp - real computed!)
Signal('valid', all(a,b))  # ⚠️ W017 (Call - real computed!)
Signal('not', ~visible)    # ⚠️ W017 (UnaryOp - real computed!)

W015 (delete confirmation) — Pattern Matching

Problem: Checker flagged delete() even inside confirmation dialogs

Now skips warning when line contains:

  • AlertDialog or alert_dialog
  • confirm

Examples:

AlertDialogAction('Delete', action=delete('/x'))  # ✅ OK (has AlertDialog)
confirm('Sure?').then(delete('/y'))               # ✅ OK (has confirm)
Button('Delete', data_on_click=delete('/z'))      # ⚠️ W015 (no confirmation)

Message improved:

Before: 'ensure user confirmation UX exists'
After: 'verify confirmation UX exists (AlertDialog, confirm dialog, etc.)'

📊 Impact

Warning Before After
W017 false positives 4 in typical todo app 0
W015 false positives 2 in typical todo app 0
Real detections ✅ Detects computed ✅ Still detects
Real detections ✅ Detects unsafe delete ✅ Still detects

📦 Installation

# Update existing install
starhtml-check --update

# Or fresh install
curl -L https://raw.githubusercontent.com/renatocaliari/starhtml-skill/main/starhtml_check.py \
  -o /usr/local/bin/starhtml-check && chmod +x /usr/local/bin/starhtml-check

Full changelog: v0.2.0...v0.2.1

v0.2.0 - Auto-update from GitHub

Choose a tag to compare

@calionauta calionauta released this 06 Mar 13:11

✨ New Features

--update Flag

Check for updates and auto-update from GitHub with a single command!

starhtml-check --update

Features:

  • Compares SHA256 hash to detect changes
  • Creates automatic backup (.bak file) before updating
  • Fetches latest version from raw.githubusercontent.com
  • Works from any global install location

🔧 Technical Changes

  • Dynamic versioning with hatch-vcs (version from git tags)
  • Added hashlib, shutil imports for update functionality
  • Updated README.md and SKILL.md with --update documentation
  • All recent error code checks (E017, E018, E019) included
  • Removed --fix flag (only fixed walrus operator, not worth code weight)
  • Removed --help-llm flag (redundant - docs already in SKILL.md)
  • Removed starhtml_check alias (kebab-case only: starhtml-check)

📋 Installation

# Global install (macOS/Linux)
curl -L https://raw.githubusercontent.com/renatocaliari/starhtml-skill/main/starhtml_check.py \
  -o /usr/local/bin/starhtml-check && chmod +x /usr/local/bin/starhtml-check

# Or user-local (no sudo)
curl -L https://raw.githubusercontent.com/renatocaliari/starhtml-skill/main/starhtml_check.py \
  -o ~/.local/bin/starhtml-check && chmod +x ~/.local/bin/starhtml-check

🔄 Updating

starhtml-check --update  # Check and update to latest version

📋 Commands

starhtml-check component.py      # Full analysis
starhtml-check --summary f.py    # Compact output (fewer tokens)
starhtml-check --code "..."      # Analyze inline snippet
starhtml-check --update          # Update from GitHub