Skip to content

HassData/flare-sort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

📦 FlareSort

A small Python script to organize Datadog agent flare ZIPs:

  • Prompts for a Zendesk ticket number
  • Moves the latest .zip file from Downloads/ into a folder like Ticket_<number>/
  • Unzips each flare into an auto-numbered subfolder (unzipped_1/, unzipped_2/, …)

Perfect for Datadog TSEs managing multiple flare submissions.


✨ Features

  • ✅ Native macOS prompt (via GUI)
  • ✅ Auto-handles duplicate ZIPs and folders
  • ✅ Works as a one-liner via Terminal alias
  • ✅ Or as a quick-trigger script in Raycast

🚀 Option 1: Run via Terminal Alias

1. 📥 Save the Script

Save the script as flaresort.py somewhere permanent, e.g.:

/Users/yourname/scripts/flaresort.py

Make sure it's executable with the correct Python path:

chmod +x /Users/yourname/scripts/flaresort.py

2. 🧭 Find Your Python Path

Use which python or pyenv which python to get your full Python path. Example:

/Users/yourname/.pyenv/versions/3.11.9/bin/python

3. 🪄 Add an Alias to Your Shell

Open your shell config:

nano ~/.zshrc

Add this line:

alias flaresort='/Users/yourname/.pyenv/versions/3.11.9/bin/python /Users/yourname/scripts/flaresort.py'

Then reload your shell:

source ~/.zshrc

4. ✅ Use It!

Whenever you get a new agent flare ZIP in ~/Downloads, just run:

flaresort

🚀 Option 2: Run via Raycast

1. ✅ Prerequisites

  • Make sure the Python script is saved and tested
  • Know your full Python + script path

2. 📜 Create Script Command in Raycast

In Raycast:

  1. Search for Create Script Command
  2. Choose: "Full Script"
  3. Fill out the fields:
Field Value
Name Organize Flare
Language Bash
Output Mode Full Output
Command (see below)

Paste this into the Command field:

#!/bin/bash

# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Organize Flare
# @raycast.mode fullOutput

# Optional parameters:
# @raycast.icon 📦
# @raycast.packageName Flare Tools

# Documentation:
# @raycast.description Move and unzip the latest flare into a ticket folder
# @raycast.author Your Name
# @raycast.authorURL https://www.datadoghq.com

PYTHON="/Users/yourname/.pyenv/versions/3.11.9/bin/python"
SCRIPT="/Users/yourname/scripts/flaresort.py"

TICKET_FOLDER=$($PYTHON "$SCRIPT" | tee /dev/tty | tail -n 1)

if [[ -d "$TICKET_FOLDER" ]]; then
  open "$TICKET_FOLDER"
else
  echo "⚠️ Ticket folder not found."
fi

Be sure to replace PYTHON and SCRIPT paths with your real ones.

3. ✅ Use in Raycast

Open Raycast (Cmd + Space) → search for Organize Flare → hit Enter.

  • You’ll get a prompt to enter the ticket number
  • The ZIP will be moved & extracted
  • The folder will open in Finder automatically

🧪 Folder Structure Example

~/Downloads/Agent_Flares/
└── Ticket_SV015767v/
    ├── datadog-agent-2025-08-debug.zip
    ├── unzipped_1/
    ├── unzipped_2/

✅ Requirements

  • macOS (for AppleScript prompt)
  • Python 3.6+
  • zipfile, shutil, pathlib (standard library)

Let me know if you’d like me to generate a flaresort.command file or a ready-to-install Raycast .sh script!

About

script to sort flares into folders

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages