feat: refactor work item file retrieval to use Python script for improved error handling and readability

This commit is contained in:
2026-05-04 09:45:28 -06:00
parent 541c9b43de
commit ff4ed6a759
12 changed files with 195 additions and 143 deletions

View File

@@ -4,18 +4,24 @@ description: Draft a standup from the latest Fidelity workspace context
Generate a standup update using the latest workspace state.
First, refresh Mattermost context before drafting:
First, refresh previous-workday Mattermost context before drafting:
!`python3 - <<'PY'
import os
import subprocess
from pathlib import Path
from datetime import date
cmd = os.environ.get("AIW_MATTERMOST_SYNC_CMD") or os.environ.get("FIDELITY_MATTERMOST_SYNC_CMD")
if cmd:
today = date.today().isoformat()
if Path("scripts/mattermost/sync.sh").is_file():
result = subprocess.run(
["bash", "scripts/mattermost/sync.sh", "--previous-workday", "--today", today],
capture_output=True,
text=True,
)
elif cmd:
result = subprocess.run(["bash", "-lc", cmd], capture_output=True, text=True)
elif Path("scripts/mattermost/sync.sh").is_file():
result = subprocess.run(["bash", "scripts/mattermost/sync.sh"], capture_output=True, text=True)
else:
print("No Mattermost sync command configured.")
raise SystemExit(0)
@@ -34,28 +40,17 @@ PY`
Read:
@prompts/standup.md
@project-knowledge/00-start/start-here.md
@project-knowledge/01-current/current-work.md
@project-knowledge/01-current/work-items.md
@project-knowledge/03-context/project.md
@project-knowledge/03-context/workstreams/index.md
@project-knowledge/03-context/workstreams/flow-page-references.md
@project-knowledge/03-context/process/communication.md
@project-knowledge/03-context/process/jira-story-rules.md
@project-knowledge/04-people/manager.md
Previous workday Mattermost context, if present:
!`bash scripts/mattermost/sync.sh --previous-workday --today "$(date +%F)"`
Today's log, if present:
!`if [ -f project-knowledge/06-daily/$(date +%F).md ]; then cat project-knowledge/06-daily/$(date +%F).md; else echo "No daily note exists for today yet."; fi`
Latest Mattermost context, preferring inbox and falling back to generated JSONL:
!`if [ -s ai/inbox/mattermost-latest.md ]; then cat ai/inbox/mattermost-latest.md; elif [ -s scripts/mattermost/generated/mattermost_context.jsonl ]; then cat scripts/mattermost/generated/mattermost_context.jsonl; else echo "No Mattermost context available."; fi`
Detailed active work item files, if available:
!`python3 - <<'PY'