mirror of
https://github.com/gnekt/My-Brain-Is-Full-Crew.git
synced 2026-08-26 10:05:37 +00:00
* Add orchestra: named scripts for permission-free agent operations
14 named scripts that wrap common Hey, tracker, and vault operations
into single commands. When added to the Bash permission allowlist,
they eliminate repeated permission prompts during email triage and
vault operations.
Scripts derive vault path from their own location (portable).
Installer and updater copy them to Meta/scripts/ in the vault.
Postman agent and email-triage skill updated to prefer scripts
over inline pipelines.
* Address Copilot review feedback on orchestra scripts
- Pass shell variables to Python via sys.argv instead of string
interpolation to prevent quoting/injection issues
- Validate --mailbox argument has a value before shifting
- Validate numeric arguments (hours, days) as integers
- Fix vault-stats folder list to use bash array (word splitting)
- Fix vault-inbox to handle missing 00-Inbox/ gracefully
- Remove unused import os from hey-check
- Narrow postman.md allowed commands from Meta/scripts/* wildcard
to explicitly named scripts
- Add .core-manifest tracking for scripts in launchme.sh/updateme.sh
with deprecation of removed scripts on update
- Fix contact-lookup description (matches senders only, not recipients)
* Fix orchestra scripts bugs, security allowlist, and docs consistency
- Replace deprecated datetime.utcnow() with datetime.now(timezone.utc)
in hey-check for Python 3.12+ compatibility
- Replace bare except: with except Exception: in all 6 tracker/lookup
scripts to avoid swallowing KeyboardInterrupt and SystemExit
- Fix postman.md Hey triage step numbering (5→7 gap, now 1-9 sequential)
- Add Meta/scripts/ commands to email-triage SKILL.md allowed Bash list
(procedure referenced them but security section blocked them)
- Update email-triage templates from hardcoded "Gmail" to {{source}}
placeholder for Hey/Gmail/MCP compatibility
- Add orchestra/ directory to README project structure tree and
Meta/scripts/ to installed vault structure diagram
* Address Copilot review: timestamp comparison, stale scripts, naming, JSON
- Fix tracker-recent timestamp comparison: truncate both cutoff and
active_at to YYYY-MM-DDTHH:MM:SS before comparing, avoiding
unreliable lexicographic comparison of Z vs +00:00 suffixes
- Fix contact-lookup dedup: skip entries with no topic_id to prevent
unrelated results collapsing into a single None key
- Rename hey-thread parameter from <topic_id> to <posting_id> to
align with Hey CLI terminology and hey-seen naming
- Fix orchestra README JSON snippet: wrap in valid settings.json
structure so users can copy/paste without syntax errors
- Add stale script cleanup to launchme.sh on reinstall, mirroring
the existing agent deprecation logic
- Separate removed-scripts counter from deprecated-files counter
in updateme.sh summary for accurate messaging
---------
Co-authored-by: gnekt <dima9610@gmail.com>
72 lines
1.9 KiB
Bash
Executable File
72 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Filter Hey tracker by mailbox
|
|
# Usage: tracker-mailbox <imbox|feedbox|trailbox> [days] [--json]
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
VAULT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
TRACKER="$VAULT_DIR/Meta/hey-tracker.jsonl"
|
|
|
|
if [[ ! -f "$TRACKER" ]]; then
|
|
echo "Tracker not found at $TRACKER" >&2
|
|
exit 1
|
|
fi
|
|
|
|
MAILBOX=""
|
|
DAYS=7
|
|
JSON=false
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--json) JSON=true; shift ;;
|
|
[0-9]*)
|
|
if ! [[ "$1" =~ ^[0-9]+$ ]]; then
|
|
echo "Error: days must be a positive integer" >&2
|
|
exit 1
|
|
fi
|
|
DAYS="$1"; shift ;;
|
|
*)
|
|
if [[ -z "$MAILBOX" ]]; then
|
|
MAILBOX="$1"
|
|
fi
|
|
shift ;;
|
|
esac
|
|
done
|
|
|
|
if [[ -z "$MAILBOX" ]]; then
|
|
echo "Usage: tracker-mailbox <imbox|feedbox|trailbox> [days] [--json]" >&2
|
|
exit 1
|
|
fi
|
|
|
|
AS_JSON=$([[ "$JSON" == "true" ]] && echo "1" || echo "0")
|
|
|
|
python3 - "$TRACKER" "$MAILBOX" "$DAYS" "$AS_JSON" <<'PYEOF'
|
|
import json, sys
|
|
from datetime import datetime, timedelta, timezone
|
|
|
|
tracker_path, mailbox, days, as_json_flag = sys.argv[1], sys.argv[2], int(sys.argv[3]), sys.argv[4] == "1"
|
|
cutoff = (datetime.now(timezone.utc) - timedelta(days=days)).strftime("%Y-%m-%d")
|
|
results = []
|
|
with open(tracker_path) as f:
|
|
for line in f:
|
|
try:
|
|
e = json.loads(line)
|
|
except Exception:
|
|
continue
|
|
if e.get("mailbox") != mailbox:
|
|
continue
|
|
if e.get("active_at", "")[:10] < cutoff:
|
|
continue
|
|
results.append(e)
|
|
|
|
if as_json_flag:
|
|
print(json.dumps(results, indent=2))
|
|
else:
|
|
for e in results:
|
|
date = e.get("active_at", "")[:10]
|
|
sender = e.get("sender_name", "")[:30]
|
|
subj = e.get("subject", "")[:60]
|
|
tid = e.get("topic_id", "")
|
|
print(f"{date} | {sender:30} | {subj} | {tid}")
|
|
PYEOF
|