···
echo "''${days[@]}" | tr ' ' '\n' | sort
# Interactive runner with gum
runner = pkgs.writeShellScriptBin "aoc" ''
···
"$(${gum}/bin/gum style --foreground 212 '🎄 Advent of Code 2025 🎄')"
+
action=$(${gum}/bin/gum choose "Run specific day" "Run all solutions" "Init new day" "Exit")
···
+
# Get all existing days
+
for dir in ts/* nix/* shared/*; do
+
if [[ "$day" =~ ^[0-9]+$ ]]; then
+
if [ ''${#all_days[@]} -gt 0 ]; then
+
max_day=$(printf '%s\n' "''${all_days[@]}" | sort -n | tail -1)
+
next_day=$(printf "%02d" $((10#$max_day + 1)))
+
# Show form with prefilled day
+
${gum}/bin/gum style --foreground 212 "Initializing new day"
+
day=$(${gum}/bin/gum input --placeholder "Day number" --value "$next_day" --prompt "Day: ")
+
# Validate day is a number
+
if ! [[ "$day" =~ ^[0-9]+$ ]]; then
+
${gum}/bin/gum style --foreground 196 "Invalid day number!"
+
# Format with leading zero
+
day=$(printf "%02d" $((10#$day)))
+
# Check if day already exists
+
if [ -d "ts/$day" ] || [ -d "nix/$day" ] || [ -d "shared/$day" ]; then
+
${gum}/bin/gum style --foreground 196 "Day $day already exists!"
+
# Fetch input from adventofcode.com
+
${gum}/bin/gum style --foreground 212 "Fetching input from adventofcode.com..."
+
# Check for session cookie
+
if [ -f ".aoc-session" ]; then
+
session_cookie=$(cat .aoc-session)
+
${gum}/bin/gum style --foreground 196 "No .aoc-session file found!"
+
${gum}/bin/gum style "Create .aoc-session with your session cookie from adventofcode.com"
+
${pkgs.curl}/bin/curl -s -b "session=$session_cookie" \
+
"https://adventofcode.com/2025/day/$day_num/input" \
+
-o "shared/$day/input.txt"
+
if [ $? -ne 0 ] || [ ! -s "shared/$day/input.txt" ]; then
+
${gum}/bin/gum style --foreground 196 "Failed to fetch input!"
+
rm -rf "ts/$day" "nix/$day" "shared/$day"
+
# Create TypeScript template
+
cat > "ts/$day/index.ts" << EOF
+
const file = await Bun.file("../../shared/$day/input.txt").text();
+
console.log("part 1:", 0);
+
console.log("part 2:", 0);
+
cat > "nix/$day/solution.nix" << EOF
+
input = builtins.readFile ../../shared/$day/input.txt;
+
lines = builtins.filter (s: builtins.isString s && s != "") (builtins.split "\n" input);
+
${gum}/bin/gum style --foreground 212 "✓ Day $day initialized!"
+
${gum}/bin/gum style " • ts/$day/index.ts"
+
${gum}/bin/gum style " • nix/$day/solution.nix"
+
${gum}/bin/gum style " • shared/$day/input.txt"