Files
Krow-workspace/scripts/export_issues.sh
bwnyasse 6540d01175 feat: add SR&ED tracking and project management tools
This commit introduces several new files and updates to support
SR&ED tracking and project management:

- Adds a template for SR&ED tasks to standardize issue creation.
- Adds a Makefile command to set up GitHub labels from a YAML file.
- Adds a Makefile command to export SR&ED-eligible issues to a
 Markdown file.
- Adds a Makefile command to create issues from a file.
- Adds documentation for SR&ED tracking and development
 conventions.
- Adds a YAML file to define GitHub labels.
- Adds scripts to set up GitHub labels, export issues, and create
 issues from a file.
- Updates the project plan to include SR&ED considerations.

These changes aim to improve project organization, facilitate
SR&ED claims, and streamline development workflows.
2025-11-13 11:33:52 -05:00

64 lines
2.8 KiB
Bash
Executable File

#!/bin/bash
# ====================================================================================
# SCRIPT TO EXPORT SR&ED-ELIGIBLE GITHUB ISSUES TO A MARKDOWN FILE
# ====================================================================================
set -e # Exit script if a command fails
# --- Configuration ---
OUTPUT_FILE="sred-issues-export.md"
# This is the label we will use to identify SR&ED-eligible tasks
SRED_LABEL="sred-eligible"
ISSUE_LIMIT=1000
echo "🚀 Starting export of SR&ED-eligible issues to '${OUTPUT_FILE}'..."
# --- Step 1: Dependency Check ---
echo "1. Checking for 'gh' CLI dependency..."
if ! command -v gh &> /dev/null; then
echo "❌ ERROR: GitHub CLI ('gh') is not installed. Please install it to continue."
exit 1
fi
echo "✅ 'gh' CLI found."
# --- Step 2: Initialize Output File ---
echo "# Export of SR&ED-Eligible Issues" > "$OUTPUT_FILE"
echo "" >> "$OUTPUT_FILE"
echo "*This document lists the systematic investigations and experimental development tasks undertaken during this period. Export generated on $(date)*." >> "$OUTPUT_FILE"
echo "" >> "$OUTPUT_FILE"
# --- Step 3: Fetch SR&ED-Eligible Issues ---
echo "2. Fetching open issues with the '${SRED_LABEL}' label..."
# We use 'gh issue list' with a JSON output and parse it with 'jq' for robustness.
# This is more reliable than parsing text output.
issue_numbers=$(gh issue list --state open --label "${SRED_LABEL}" --limit $ISSUE_LIMIT --json number | jq -r '.[].number')
if [ -z "$issue_numbers" ]; then
echo "⚠️ No open issues found with the label '${SRED_LABEL}'. The export file will be minimal."
echo "" >> "$OUTPUT_FILE"
echo "**No SR&ED-eligible issues found for this period.**" >> "$OUTPUT_FILE"
exit 0
fi
total_issues=$(echo "$issue_numbers" | wc -l | xargs)
echo "✅ Found ${total_issues} SR&ED-eligible issue(s)."
# --- Step 4: Loop Through Each Issue and Format the Output ---
echo "3. Formatting details for each issue..."
current_issue=0
for number in $issue_numbers; do
current_issue=$((current_issue + 1))
echo " -> Processing issue #${number} (${current_issue}/${total_issues})"
# Use 'gh issue view' with a template to format the output for each issue
# and append it to the output file.
gh issue view "$number" --json number,title,body,author,createdAt --template \
'\n### Task: [#{{.number}}] {{.title}}\n\n**Hypothesis/Goal:** \n> *(Briefly describe the technological uncertainty this task addresses. What was the technical challenge or question?)*\n\n**Systematic Investigation:**\n{{if .body}}\n{{.body}}\n{{else}}\n*No detailed description provided in the issue.*\n{{end}}\n\n**Team:** {{.author.login}} | **Date Initiated:** {{timefmt "2006-01-02" .createdAt}}\n***\n' >> "$OUTPUT_FILE"
done
echo ""
echo "🎉 Export complete!"
echo "Your SR&ED-ready markdown file is ready: ${OUTPUT_FILE}"