scenarios:
  - id: lint-hook
    title: "Build a Lint Hook"
    difficulty: beginner
    xp: 25
    setup: []
    files:
      - name: scripts/lint-hook.sh
        content: |
          #!/bin/bash
          # TODO: Implement PostToolUse hook that checks for leftover TODO comments
          exit 0
        language: bash
        readonly: false
    task: "Write a PostToolUse hook that runs after Edit or Write and checks the modified file for leftover TODO comments. If any are found, append the file path and line numbers to .local/todo-report.txt. Configure the hook in .claude/settings.json with a 5000ms timeout."
    validations:
      - label: "Hook script exists and is executable"
        check: output-contains
        pattern: "lint-hook|todo-report|TODO"
      - label: "Hook configured in settings"
        check: output-contains
        pattern: "PostToolUse|hooks|settings.json"
      - label: "TODO detection implemented"
        check: output-contains
        pattern: "grep|TODO|todo"
    hints:
      - "Parse TOOL_INPUT with jq to get file_path. Only run when TOOL_NAME is Edit or Write."
      - "Use grep -n 'TODO' to find lines. Append results to .local/todo-report.txt."
      - "Ensure the script handles missing files and exits 0 to avoid breaking the session."
    agent_prompts:
      on_start: "What's the difference between a hook that runs on every tool and one that only runs on Edit/Write? Why might you want to filter?"
      on_complete: "How would you extend this hook to also check for FIXME or XXX comments? What about excluding comments in test files?"

  - id: session-tracker
    title: "Build a Session Tracker"
    difficulty: beginner
    xp: 20
    setup: []
    files:
      - name: scripts/session-tracker.sh
        content: |
          #!/bin/bash
          # TODO: Implement Stop hook that logs session duration
          exit 0
        language: bash
        readonly: false
    task: "Write a Stop hook that logs the session end time and token usage to .local/session-log.json. Each entry should include: timestamp, STOP_REASON, and parsed input/output token counts from TOKEN_USAGE. Configure it in .claude/settings.json."
    validations:
      - label: "Stop hook script exists"
        check: output-contains
        pattern: "session-tracker|session-log|STOP_REASON|TOKEN_USAGE"
      - label: "Hook configured for Stop event"
        check: output-contains
        pattern: "Stop|hooks"
      - label: "JSON logging implemented"
        check: output-contains
        pattern: "jq|json|timestamp"
    hints:
      - "STOP_REASON and TOKEN_USAGE are in the environment. TOKEN_USAGE is JSON."
      - "Use jq to parse TOKEN_USAGE and build a log entry. Append to .local/session-log.json as a new line (JSONL format)."
      - "For timestamp: date -Iseconds or date +%Y-%m-%dT%H:%M:%S"
    agent_prompts:
      on_start: "Why does a session tracker belong in a Stop hook rather than PostToolUse? What would happen if you used PostToolUse?"
      on_complete: "How could you extend this to also record session duration? What would you need to capture at the start of a session?"
