fix(workflows): normalize repo management coverage
This commit is contained in:
parent
5ba9518722
commit
e8d145a130
@ -11,7 +11,7 @@ Combines `/repo_backup-main-branch` and `/repo_push-repos` into a single sequent
|
||||
Creates timestamped backup branches with smart duplicate detection.
|
||||
|
||||
// turbo
|
||||
Run `bash scripts/backup-main.sh` from any repository root
|
||||
Run `bash /Users/sd9235/code/mygh/learning_ai_common_plat/scripts/backup-main.sh`
|
||||
|
||||
## Step 2: Push all repos to origin
|
||||
|
||||
@ -30,7 +30,7 @@ echo "✨ All repos pushed!"
|
||||
## What it does:
|
||||
|
||||
1. **Backup** — creates timestamped backup branches, cleans up old ones (7 days), skips duplicates
|
||||
2. **Push** — pushes `main` to `origin/main` for all 13 repos
|
||||
2. **Push** — pushes `main` to `origin/main` for all repositories listed in the canonical `repos.txt`
|
||||
|
||||
## Repositories:
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ description: Smart backup of main branches with duplicate detection
|
||||
Creates smart backups of main branches across all repositories.
|
||||
|
||||
// turbo
|
||||
Run `bash scripts/backup-main.sh` from any repository root
|
||||
Run `bash /Users/sd9235/code/mygh/learning_ai_common_plat/scripts/backup-main.sh`
|
||||
|
||||
The script reads `repos.txt` to determine which repositories to back up.
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ date: 2025-02-12
|
||||
Scans all repositories for pending changes and commits them in logical order with intelligent commit messages.
|
||||
|
||||
// turbo
|
||||
~/commit-workspace.sh
|
||||
bash /Users/sd9235/code/mygh/learning_ai_common_plat/scripts/commit-workspace.sh
|
||||
|
||||
## What it does:
|
||||
|
||||
@ -47,7 +47,7 @@ The script analyzes file types to generate appropriate messages:
|
||||
|
||||
```bash
|
||||
# Run from anywhere
|
||||
~/commit-workspace.sh
|
||||
bash /Users/sd9235/code/mygh/learning_ai_common_plat/scripts/commit-workspace.sh
|
||||
|
||||
# Or via Windsurf
|
||||
/commit-workspace
|
||||
@ -106,7 +106,8 @@ Found changes in 2 repo(s)
|
||||
|
||||
## Notes:
|
||||
|
||||
- Script location: `~/commit-workspace.sh`
|
||||
- Script location: `learning_ai_common_plat/scripts/commit-workspace.sh`
|
||||
- Reads repo names from `learning_ai_common_plat/.windsurf/workflows/repos.txt`
|
||||
- Requires git access to all repos
|
||||
- Works with any branch (but assumes main is primary)
|
||||
- Will skip repos with no changes
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
---
|
||||
description: Push local main branch to origin for all 13 workspace repos
|
||||
description: Push local main branch to origin for all managed workspace repos
|
||||
---
|
||||
|
||||
# Push Repos
|
||||
@ -18,7 +18,7 @@ done < ~/code/mygh/learning_ai_common_plat/.windsurf/workflows/repos.txt
|
||||
|
||||
## What it does:
|
||||
|
||||
1. Iterates over all 13 workspace repos
|
||||
1. Iterates over all repositories listed in the canonical `repos.txt`
|
||||
2. Runs `git push origin main` in each
|
||||
3. Fails fast if a repo has diverged from remote (resolve with rebase manually)
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
---
|
||||
description: Pull latest from origin main across all 13 workspace repos
|
||||
description: Pull latest from origin main across all managed workspace repos
|
||||
---
|
||||
|
||||
# Sync Repos
|
||||
@ -18,7 +18,7 @@ done < ~/code/mygh/learning_ai_common_plat/.windsurf/workflows/repos.txt
|
||||
|
||||
## What it does:
|
||||
|
||||
1. Iterates over all 13 workspace repos
|
||||
1. Iterates over all repositories listed in the canonical `repos.txt`
|
||||
2. Runs `git pull --ff-only origin main` in each
|
||||
3. Fails fast if there are local divergent commits (use `git pull --rebase` manually in that case)
|
||||
|
||||
|
||||
@ -8,16 +8,16 @@ Regenerates all 8 AI agent configuration files across all repos in the workspace
|
||||
|
||||
## Files Generated Per Repo
|
||||
|
||||
| File | Tool |
|
||||
|------|------|
|
||||
| `AGENTS.md` | Universal (OpenAI Codex, Claude, Copilot, etc.) |
|
||||
| `CLAUDE.md` | Claude Code |
|
||||
| `.cursorrules` | Cursor AI |
|
||||
| `.github/copilot-instructions.md` | GitHub Copilot |
|
||||
| `.windsurfrules` | Windsurf / Cascade |
|
||||
| `.clinerules` | Cline / Roo Code |
|
||||
| `.aider.conf.yml` | Aider |
|
||||
| `.editorconfig` | All editors |
|
||||
| File | Tool |
|
||||
| --------------------------------- | ----------------------------------------------- |
|
||||
| `AGENTS.md` | Universal (OpenAI Codex, Claude, Copilot, etc.) |
|
||||
| `CLAUDE.md` | Claude Code |
|
||||
| `.cursorrules` | Cursor AI |
|
||||
| `.github/copilot-instructions.md` | GitHub Copilot |
|
||||
| `.windsurfrules` | Windsurf / Cascade |
|
||||
| `.clinerules` | Cline / Roo Code |
|
||||
| `.aider.conf.yml` | Aider |
|
||||
| `.editorconfig` | All editors |
|
||||
|
||||
## Steps
|
||||
|
||||
@ -28,12 +28,15 @@ cd /Users/sd9235/code/mygh/learning_ai_common_plat
|
||||
./scripts/update-agent-docs.sh
|
||||
```
|
||||
|
||||
The script reads `learning_ai_common_plat/.windsurf/workflows/repos.txt` as the canonical list of managed workspace repositories.
|
||||
|
||||
2. Review changes per repo:
|
||||
|
||||
```bash
|
||||
cd /Users/sd9235/code/mygh/learning_voice_ai_agent && git diff --stat
|
||||
cd /Users/sd9235/code/mygh/learning_multimodal_memory_agents && git diff --stat
|
||||
# ... etc for all repos
|
||||
while IFS= read -r repo; do
|
||||
[[ -z "$repo" || "$repo" =~ ^# ]] && continue
|
||||
cd /Users/sd9235/code/mygh/$repo && git diff --stat
|
||||
done < /Users/sd9235/code/mygh/learning_ai_common_plat/.windsurf/workflows/repos.txt
|
||||
```
|
||||
|
||||
3. Commit changes (if any):
|
||||
|
||||
142
scripts/commit-workspace.sh
Normal file
142
scripts/commit-workspace.sh
Normal file
@ -0,0 +1,142 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m'
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
COMMON_PLAT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
||||
WORKSPACE_DIR="${WORKSPACE_DIR:-$(cd "${COMMON_PLAT_DIR}/.." && pwd)}"
|
||||
REPOS_TXT="${COMMON_PLAT_DIR}/.windsurf/workflows/repos.txt"
|
||||
|
||||
if [[ ! -f "$REPOS_TXT" ]]; then
|
||||
echo -e "${RED}❌ repos.txt not found at ${REPOS_TXT}${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
read_repos() {
|
||||
local repos=()
|
||||
while IFS= read -r line; do
|
||||
[[ "$line" =~ ^[[:space:]]*# ]] && continue
|
||||
[[ -z "${line// }" ]] && continue
|
||||
repos+=("$line")
|
||||
done < "$REPOS_TXT"
|
||||
printf '%s\n' "${repos[@]}"
|
||||
}
|
||||
|
||||
get_commit_message() {
|
||||
local repo="$1"
|
||||
local repo_path="${WORKSPACE_DIR}/${repo}"
|
||||
local files
|
||||
|
||||
files="$(git -C "$repo_path" diff --name-only 2>/dev/null || true)"
|
||||
files+=$'\n'"$(git -C "$repo_path" diff --cached --name-only 2>/dev/null || true)"
|
||||
files+=$'\n'"$(git -C "$repo_path" ls-files --others --exclude-standard 2>/dev/null || true)"
|
||||
|
||||
local has_auth has_ci has_docs has_docker has_package has_python has_tests has_config
|
||||
has_auth="$(echo "$files" | grep -E '(auth|middleware|jwt)' || true)"
|
||||
has_ci="$(echo "$files" | grep -E '\.github|workflow|ci' || true)"
|
||||
has_docs="$(echo "$files" | grep -E '\.md$' || true)"
|
||||
has_docker="$(echo "$files" | grep -E 'Dockerfile|docker' || true)"
|
||||
has_package="$(echo "$files" | grep -E 'package\.json|pnpm-lock|yarn\.lock' || true)"
|
||||
has_python="$(echo "$files" | grep -E '\.py$|requirements' || true)"
|
||||
has_tests="$(echo "$files" | grep -E 'test|spec' || true)"
|
||||
has_config="$(echo "$files" | grep -E '\.env|config|\.toml' || true)"
|
||||
|
||||
if [[ -n "$has_auth" ]]; then
|
||||
echo "feat(auth): update authentication and middleware"
|
||||
elif [[ -n "$has_ci" ]]; then
|
||||
echo "ci: update CI/CD configuration"
|
||||
elif [[ -n "$has_docker" ]]; then
|
||||
if [[ -n "$has_package" ]]; then
|
||||
echo "feat(devops): update docker and package configuration"
|
||||
else
|
||||
echo "feat(devops): update Docker configuration"
|
||||
fi
|
||||
elif [[ -n "$has_package" ]]; then
|
||||
echo "chore: update dependencies"
|
||||
elif [[ -n "$has_docs" ]]; then
|
||||
echo "docs: update documentation"
|
||||
elif [[ -n "$has_python" ]]; then
|
||||
if [[ -n "$has_tests" ]]; then
|
||||
echo "test(python): update test suite"
|
||||
else
|
||||
echo "feat(python): update Python modules"
|
||||
fi
|
||||
elif [[ -n "$has_tests" ]]; then
|
||||
echo "test: add/update tests"
|
||||
elif [[ -n "$has_config" ]]; then
|
||||
echo "chore: update configuration"
|
||||
else
|
||||
echo "chore: update project files"
|
||||
fi
|
||||
}
|
||||
|
||||
commit_repo() {
|
||||
local repo="$1"
|
||||
local repo_path="${WORKSPACE_DIR}/${repo}"
|
||||
|
||||
echo -e "${BLUE}📝 Committing ${repo}...${NC}"
|
||||
git -C "$repo_path" add -A
|
||||
local commit_msg
|
||||
commit_msg="$(get_commit_message "$repo")"
|
||||
echo -e " Message: ${YELLOW}${commit_msg}${NC}"
|
||||
git -C "$repo_path" commit -m "$commit_msg"
|
||||
echo -e " ${GREEN}✅ Committed${NC}"
|
||||
echo
|
||||
}
|
||||
|
||||
echo -e "${BLUE}📋 Scanning workspace for changes...${NC}"
|
||||
echo
|
||||
|
||||
mapfile -t REPOS < <(read_repos)
|
||||
REPOS_WITH_CHANGES=()
|
||||
|
||||
for repo in "${REPOS[@]}"; do
|
||||
repo_path="${WORKSPACE_DIR}/${repo}"
|
||||
if [[ ! -d "$repo_path/.git" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if ! git -C "$repo_path" diff --quiet || ! git -C "$repo_path" diff --cached --quiet || [[ -n "$(git -C "$repo_path" ls-files --others --exclude-standard)" ]]; then
|
||||
REPOS_WITH_CHANGES+=("$repo")
|
||||
|
||||
staged=$(git -C "$repo_path" diff --cached --name-only | wc -l | tr -d ' ')
|
||||
modified=$(git -C "$repo_path" diff --name-only | wc -l | tr -d ' ')
|
||||
untracked=$(git -C "$repo_path" ls-files --others --exclude-standard | wc -l | tr -d ' ')
|
||||
|
||||
echo -e "${YELLOW}📁 ${repo}${NC}:"
|
||||
[[ "$staged" -gt 0 ]] && echo " - ${staged} staged"
|
||||
[[ "$modified" -gt 0 ]] && echo " - ${modified} modified"
|
||||
[[ "$untracked" -gt 0 ]] && echo " - ${untracked} untracked"
|
||||
echo
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ${#REPOS_WITH_CHANGES[@]} -eq 0 ]]; then
|
||||
echo -e "${GREEN}✅ No changes to commit${NC}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -e "${BLUE}Found changes in ${#REPOS_WITH_CHANGES[@]} repo(s)${NC}"
|
||||
echo
|
||||
|
||||
echo -e "${BLUE}🚀 Committing in dependency order...${NC}"
|
||||
echo
|
||||
|
||||
if [[ " ${REPOS_WITH_CHANGES[*]} " =~ " learning_ai_common_plat " ]]; then
|
||||
commit_repo "learning_ai_common_plat"
|
||||
fi
|
||||
|
||||
for repo in "${REPOS_WITH_CHANGES[@]}"; do
|
||||
if [[ "$repo" != "learning_ai_common_plat" ]]; then
|
||||
commit_repo "$repo"
|
||||
fi
|
||||
done
|
||||
|
||||
echo -e "${GREEN}✨ All changes committed locally!${NC}"
|
||||
echo -e "${BLUE}💡 Use /repo_sync-repos or git push to push to remote${NC}"
|
||||
@ -7,27 +7,33 @@ set -eo pipefail
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
REPOS_ROOT="/Users/sd9235/code/mygh"
|
||||
COMMON_PLAT="$REPOS_ROOT/learning_ai_common_plat"
|
||||
REPOS_TXT="$COMMON_PLAT/.windsurf/workflows/repos.txt"
|
||||
|
||||
REPOS=(
|
||||
"learning_voice_ai_agent"
|
||||
"learning_multimodal_memory_agents"
|
||||
"learning_ai_clock"
|
||||
"learning_ai_peakpulse"
|
||||
"learning_ai_fastgap"
|
||||
"learning_ai_jarvis_jr"
|
||||
)
|
||||
if [ ! -f "$REPOS_TXT" ]; then
|
||||
echo "❌ Canonical repos.txt not found: $REPOS_TXT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
REPOS=()
|
||||
while IFS= read -r line; do
|
||||
[[ "$line" =~ ^[[:space:]]*# ]] && continue
|
||||
[[ -z "${line// }" ]] && continue
|
||||
[[ "$line" == "learning_ai_common_plat" ]] && continue
|
||||
REPOS+=("$line")
|
||||
done < "$REPOS_TXT"
|
||||
|
||||
WORKFLOWS_TO_SYNC=(
|
||||
"repo_backup-main-branch.md"
|
||||
"repo_backup-and-push.md"
|
||||
"repo_sync-repos.md"
|
||||
"repo_commit-workspace.md"
|
||||
"repo_push-repos.md"
|
||||
"repo_update-agent-docs.md"
|
||||
"refresh-chat-history.md"
|
||||
)
|
||||
|
||||
DRY_RUN=false
|
||||
if [ "$1" = "--dry-run" ]; then
|
||||
if [ "${1:-}" = "--dry-run" ]; then
|
||||
DRY_RUN=true
|
||||
fi
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user