# Check a *.stories.tsx file follows CSF3 shape: default meta with title +
# component, the tags: ['autodocs'] convention, and at least one named Story
# export using the object form (not the deprecated CSF2 function-template
# Usage: check_csf3.sh <Component.stories.tsx>
if [[ -z "$STORY" || ! -f "$STORY" ]]; then
echo "Usage: $0 <Component.stories.tsx>" >&2
if grep -qE "$2" "$STORY"; then
check "has a default meta export" 'export default'
check "meta declares a title" 'title:'
check "meta declares a component" 'component:'
check "declares tags: ['autodocs']" "tags:\s*\[[^]]*['\"]autodocs['\"]"
check "has at least one named Story object export" 'export const [A-Za-z0-9_]+: Story'
if grep -qE '\.bind\(\{\}\)|Template\.bind' "$STORY"; then
echo "❌ found CSF2 Template.bind({}) pattern — migrate to CSF3 object stories"
echo "✅ no deprecated CSF2 Template.bind pattern"