Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .exp/pr-analysis-438.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# PR #438: Workflow Design Impact Analysis

## Affected Workflows
None of the defined workflows are affected by this PR.

**Justification:**
- The PR [#438](https://github.com/xai-org/grok-1/pull/438) titled \"ibraka_market\" adds a single new file named `ibraka`.
- This file is empty (contains only a newline character).
- None of the workflows in `.exp/workflows.json` list `ibraka` in their `relevant_files`.
- The workflow relevant files are core components like `run.py`, `runners.py`, `model.py`, `checkpoint.py`, and `tokenizer.model`, none of which are modified by the PR.
- The PR does not introduce new functionality or alter existing code paths related to model loading, initialization, forward pass, or inference/sampling.
- Commit evidence: Single commit `b2c0941 Create ibraka` with no code changes impacting workflows.
- Description links to external repo https://github.com/grok-xai/ibraka-market-pro, suggesting possible unrelated project reference, but no integration in this repo.

## Summary of PR Changes
The PR creates an empty file `ibraka`, which does not affect any existing workflow designs or implementations.

- **Specific aspects affected:** None.
- **Implementation:** Simple file creation with no content.
- **Potential benefits or implications:** Minimal to none; may serve as a placeholder or tag, but does not enhance or alter Grok-1 functionalities. Could be considered for removal if unrelated to project scope.

No Mermaid diagrams need updates, as there are no changes to workflow components, sequences, or flows.

No updates to design documents in `.exp/` are required.
196 changes: 196 additions & 0 deletions .exp/push_and_create_prs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
#!/bin/bash

# Script to push all local branches to a forked remote and create PRs
# Usage: ./push_and_create_prs.sh [fork_remote_name] [upstream_remote_name]
#
# Arguments:
# fork_remote_name - Name of the fork remote (default: "fork")
# upstream_remote_name - Name of the upstream remote for PR base (default: "origin")

set -e

# Configuration
FORK_REMOTE="${1:-fork}"
UPSTREAM_REMOTE="${2:-origin}"
DEFAULT_BASE_BRANCH="main" # Change to "master" if needed

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color

log_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}

log_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}

log_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}

log_error() {
echo -e "${RED}[ERROR]${NC} $1"
}

# Check if gh CLI is installed
if ! command -v gh &> /dev/null; then
log_error "GitHub CLI (gh) is not installed. Please install it first."
log_info "Install with: brew install gh"
exit 1
fi

# Check if gh is authenticated
if ! gh auth status &> /dev/null; then
log_error "GitHub CLI is not authenticated. Please run 'gh auth login' first."
exit 1
fi

# Check if remotes exist
if ! git remote | grep -q "^${FORK_REMOTE}$"; then
log_error "Remote '${FORK_REMOTE}' does not exist."
log_info "Available remotes:"
git remote -v
log_info ""
log_info "To add a fork remote, run:"
log_info " git remote add fork <your-fork-url>"
exit 1
fi

# Get the default branch from upstream (try to detect it)
detect_base_branch() {
if git remote | grep -q "^${UPSTREAM_REMOTE}$"; then
# Try to get the default branch from the upstream remote
local default_branch
default_branch=$(git remote show "${UPSTREAM_REMOTE}" 2>/dev/null | grep "HEAD branch" | awk '{print $NF}' || echo "")
if [[ -n "$default_branch" ]]; then
echo "$default_branch"
return
fi
fi
echo "$DEFAULT_BASE_BRANCH"
}

BASE_BRANCH=$(detect_base_branch)
log_info "Using base branch: ${BASE_BRANCH}"

# Get all local branches
LOCAL_BRANCHES=$(git branch --format='%(refname:short)')

# Track results
PUSHED_BRANCHES=()
CREATED_PRS=()
SKIPPED_BRANCHES=()
FAILED_BRANCHES=()

log_info "Starting push and PR creation process..."
log_info "Fork remote: ${FORK_REMOTE}"
log_info "Base branch for PRs: ${BASE_BRANCH}"
echo ""

for branch in $LOCAL_BRANCHES; do
log_info "Processing branch: ${branch}"

# Skip the base branch itself
if [[ "$branch" == "$BASE_BRANCH" || "$branch" == "main" || "$branch" == "master" ]]; then
log_warning "Skipping base branch: ${branch}"
SKIPPED_BRANCHES+=("$branch (base branch)")
echo ""
continue
fi

# Push the branch to fork
log_info "Pushing ${branch} to ${FORK_REMOTE}..."
if git push "${FORK_REMOTE}" "${branch}" 2>&1; then
log_success "Pushed ${branch}"
PUSHED_BRANCHES+=("$branch")
else
log_error "Failed to push ${branch}"
FAILED_BRANCHES+=("$branch (push failed)")
echo ""
continue
fi

# Check if PR already exists for this branch
existing_pr=$(gh pr list --head "${branch}" --state open --json number --jq '.[0].number' 2>/dev/null || echo "")

if [[ -n "$existing_pr" ]]; then
log_warning "PR #${existing_pr} already exists for branch ${branch}"
SKIPPED_BRANCHES+=("$branch (PR #${existing_pr} exists)")
echo ""
continue
fi

# Create PR
log_info "Creating PR for ${branch}..."

# Get the last commit message for the PR title
PR_TITLE=$(git log -1 --format='%s' "${branch}")

# Get the commit body for the PR description (if any)
PR_BODY=$(git log -1 --format='%b' "${branch}")

# If no commit body, use a default description
if [[ -z "$PR_BODY" ]]; then
PR_BODY="This PR was automatically created for branch \`${branch}\`."
fi

if gh pr create \
--head "${branch}" \
--base "${BASE_BRANCH}" \
--title "${PR_TITLE}" \
--body "${PR_BODY}" 2>&1; then
log_success "Created PR for ${branch}"
CREATED_PRS+=("$branch")
else
log_error "Failed to create PR for ${branch}"
FAILED_BRANCHES+=("$branch (PR creation failed)")
fi

echo ""
done

# Summary
echo ""
echo "========================================"
echo " SUMMARY "
echo "========================================"
echo ""

if [[ ${#PUSHED_BRANCHES[@]} -gt 0 ]]; then
echo -e "${GREEN}Pushed branches (${#PUSHED_BRANCHES[@]}):${NC}"
for branch in "${PUSHED_BRANCHES[@]}"; do
echo " - $branch"
done
echo ""
fi

if [[ ${#CREATED_PRS[@]} -gt 0 ]]; then
echo -e "${GREEN}Created PRs (${#CREATED_PRS[@]}):${NC}"
for branch in "${CREATED_PRS[@]}"; do
echo " - $branch"
done
echo ""
fi

if [[ ${#SKIPPED_BRANCHES[@]} -gt 0 ]]; then
echo -e "${YELLOW}Skipped branches (${#SKIPPED_BRANCHES[@]}):${NC}"
for branch in "${SKIPPED_BRANCHES[@]}"; do
echo " - $branch"
done
echo ""
fi

if [[ ${#FAILED_BRANCHES[@]} -gt 0 ]]; then
echo -e "${RED}Failed branches (${#FAILED_BRANCHES[@]}):${NC}"
for branch in "${FAILED_BRANCHES[@]}"; do
echo " - $branch"
done
echo ""
fi

log_info "Done!"