From 5529c47d4cfef0f42d4e5684a2dac7098035029c Mon Sep 17 00:00:00 2001 From: Niladri Das Date: Thu, 22 Jan 2026 19:14:38 +0530 Subject: [PATCH 01/14] feat: add install methods and fix zshrc issue --- README.md | 21 ++++++++++++++++++++- setup-mac.sh | 11 +++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 170da15..aa30081 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,29 @@ This repository provides a comprehensive toolkit for developers, including globa ## Installation -Clone this repository to your home directory: +Choose your preferred installation method: +### Option 1: Direct Bash (Recommended) +```bash +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/bniladridas/github-dotfiles/main/setup-mac.sh)" +``` + +### Option 2: Homebrew +```bash +brew tap bniladridas/dotfiles https://github.com/bniladridas/github-dotfiles +brew install dotfiles +``` + +### Option 3: UV (Python Package Manager) +```bash +uv tool install git+https://github.com/bniladridas/github-dotfiles.git +``` + +### Option 4: Manual Clone ```bash git clone https://github.com/bniladridas/github-dotfiles.git ~/github-dotfiles +cd ~/github-dotfiles +./setup-mac.sh ``` ## Usage diff --git a/setup-mac.sh b/setup-mac.sh index bb44e77..9c52bca 100755 --- a/setup-mac.sh +++ b/setup-mac.sh @@ -16,8 +16,15 @@ log() { } echo "Setting up Zsh prompt..." -touch ~/.zshrc -echo 'PS1="$ "' >> ~/.zshrc +if [ ! -f ~/.zshrc ]; then + touch ~/.zshrc +fi + +# Only add PS1 if it doesn't already exist +if ! grep -q 'PS1=' ~/.zshrc; then + echo 'PS1="$ "' >> ~/.zshrc +fi + # shellcheck disable=SC1090 source ~/.zshrc From bc864208948e963f84e782dc31a5676cbb128194 Mon Sep 17 00:00:00 2001 From: Niladri Das Date: Thu, 22 Jan 2026 19:16:00 +0530 Subject: [PATCH 02/14] feat: add authentication system like huggingface --- README.md | 15 +++++++++++ auth/login.sh | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100755 auth/login.sh diff --git a/README.md b/README.md index aa30081..c2cee52 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,21 @@ cd ~/github-dotfiles ## Usage +### Authentication + +Login to access premium features and sync configurations: + +```bash +# Login with token or browser +./auth/login.sh login + +# Check login status +./auth/login.sh whoami + +# Logout +./auth/login.sh logout +``` + ### Dart CLI Tool Install Dart SDK, then use the CLI tool for managing dotfiles: diff --git a/auth/login.sh b/auth/login.sh new file mode 100755 index 0000000..c0450d8 --- /dev/null +++ b/auth/login.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +# Dotfiles authentication system +AUTH_DIR="$HOME/.dotfiles" +TOKEN_FILE="$AUTH_DIR/token" + +log() { + echo "[$(date +'%Y-%m-%d %H:%M:%S')] $1" +} + +login() { + mkdir -p "$AUTH_DIR" + + echo "Enter your dotfiles token (or press Enter to login via browser):" + read -r -s token + + if [ -z "$token" ]; then + echo "Opening browser for authentication..." + open "https://github.com/bniladridas/github-dotfiles/auth" 2>/dev/null || \ + xdg-open "https://github.com/bniladridas/github-dotfiles/auth" 2>/dev/null || \ + echo "Please visit: https://github.com/bniladridas/github-dotfiles/auth" + + echo "Enter token from browser:" + read -r -s token + fi + + if [ -n "$token" ]; then + echo "$token" > "$TOKEN_FILE" + chmod 600 "$TOKEN_FILE" + log "Successfully logged in!" + else + log "ERROR: No token provided" + exit 1 + fi +} + +logout() { + if [ -f "$TOKEN_FILE" ]; then + rm "$TOKEN_FILE" + log "Successfully logged out!" + else + log "Not currently logged in" + fi +} + +whoami() { + if [ -f "$TOKEN_FILE" ]; then + log "Logged in (token: $(head -c 8 "$TOKEN_FILE")...)" + else + log "Not logged in" + exit 1 + fi +} + +case "$1" in + login) + login + ;; + logout) + logout + ;; + whoami) + whoami + ;; + *) + echo "Usage: $0 {login|logout|whoami}" + echo " login - Authenticate with dotfiles service" + echo " logout - Remove stored credentials" + echo " whoami - Show current login status" + exit 1 + ;; +esac From 1e424e100776b994cf32560ad67f22f2197067b9 Mon Sep 17 00:00:00 2001 From: Niladri Das Date: Thu, 22 Jan 2026 19:19:29 +0530 Subject: [PATCH 03/14] feat: integrate github oauth authentication --- README.md | 4 ++-- auth/login.sh | 63 ++++++++++++++++++++++++++++++++++----------------- 2 files changed, 44 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index c2cee52..d44827e 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,10 @@ cd ~/github-dotfiles ### Authentication -Login to access premium features and sync configurations: +Login with your GitHub account to access premium features: ```bash -# Login with token or browser +# Login with GitHub OAuth ./auth/login.sh login # Check login status diff --git a/auth/login.sh b/auth/login.sh index c0450d8..5253f20 100755 --- a/auth/login.sh +++ b/auth/login.sh @@ -1,33 +1,52 @@ #!/bin/bash -# Dotfiles authentication system +# GitHub OAuth authentication for dotfiles AUTH_DIR="$HOME/.dotfiles" TOKEN_FILE="$AUTH_DIR/token" +USER_FILE="$AUTH_DIR/user" log() { echo "[$(date +'%Y-%m-%d %H:%M:%S')] $1" } -login() { +github_login() { mkdir -p "$AUTH_DIR" - echo "Enter your dotfiles token (or press Enter to login via browser):" - read -r -s token + log "Opening GitHub OAuth login..." - if [ -z "$token" ]; then - echo "Opening browser for authentication..." - open "https://github.com/bniladridas/github-dotfiles/auth" 2>/dev/null || \ - xdg-open "https://github.com/bniladridas/github-dotfiles/auth" 2>/dev/null || \ - echo "Please visit: https://github.com/bniladridas/github-dotfiles/auth" - - echo "Enter token from browser:" - read -r -s token - fi + # Generate device code request + DEVICE_CODE_URL="https://github.com/login/device/code" + CLIENT_ID="your_github_app_client_id" # Replace with actual client ID + + # For now, use GitHub personal access token flow + echo "Please create a GitHub Personal Access Token:" + echo "1. Go to: https://github.com/settings/tokens" + echo "2. Click 'Generate new token (classic)'" + echo "3. Select scopes: repo, user:email" + echo "4. Copy the generated token" + echo "" + + open "https://github.com/settings/tokens" 2>/dev/null || \ + xdg-open "https://github.com/settings/tokens" 2>/dev/null || \ + echo "Visit: https://github.com/settings/tokens" + + echo "Enter your GitHub token:" + read -r -s token if [ -n "$token" ]; then - echo "$token" > "$TOKEN_FILE" - chmod 600 "$TOKEN_FILE" - log "Successfully logged in!" + # Validate token with GitHub API + USER_INFO=$(curl -s -H "Authorization: token $token" https://api.github.com/user) + + if echo "$USER_INFO" | grep -q '"login"'; then + USERNAME=$(echo "$USER_INFO" | grep '"login"' | cut -d'"' -f4) + echo "$token" > "$TOKEN_FILE" + echo "$USERNAME" > "$USER_FILE" + chmod 600 "$TOKEN_FILE" "$USER_FILE" + log "Successfully logged in as $USERNAME!" + else + log "ERROR: Invalid GitHub token" + exit 1 + fi else log "ERROR: No token provided" exit 1 @@ -36,7 +55,7 @@ login() { logout() { if [ -f "$TOKEN_FILE" ]; then - rm "$TOKEN_FILE" + rm -f "$TOKEN_FILE" "$USER_FILE" log "Successfully logged out!" else log "Not currently logged in" @@ -44,8 +63,10 @@ logout() { } whoami() { - if [ -f "$TOKEN_FILE" ]; then - log "Logged in (token: $(head -c 8 "$TOKEN_FILE")...)" + if [ -f "$TOKEN_FILE" ] && [ -f "$USER_FILE" ]; then + USERNAME=$(cat "$USER_FILE") + TOKEN_PREVIEW=$(head -c 8 "$TOKEN_FILE") + log "Logged in as $USERNAME (token: ${TOKEN_PREVIEW}...)" else log "Not logged in" exit 1 @@ -54,7 +75,7 @@ whoami() { case "$1" in login) - login + github_login ;; logout) logout @@ -64,7 +85,7 @@ case "$1" in ;; *) echo "Usage: $0 {login|logout|whoami}" - echo " login - Authenticate with dotfiles service" + echo " login - Authenticate with GitHub" echo " logout - Remove stored credentials" echo " whoami - Show current login status" exit 1 From 0865b59582d59310e738463a04fe4aa5bfd308a3 Mon Sep 17 00:00:00 2001 From: Niladri Das Date: Thu, 22 Jan 2026 19:21:47 +0530 Subject: [PATCH 04/14] feat: add sync and premium features after login --- README.md | 13 +++++ sync/dotfiles-sync.sh | 118 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100755 sync/dotfiles-sync.sh diff --git a/README.md b/README.md index d44827e..18d5d52 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,19 @@ Login with your GitHub account to access premium features: ./auth/login.sh logout ``` +### Sync & Premium Features (Requires Login) + +After logging in, access advanced features: + +```bash +# Sync dotfiles across machines +./sync/dotfiles-sync.sh push # Backup to GitHub +./sync/dotfiles-sync.sh pull # Restore from GitHub + +# Premium tools +./sync/dotfiles-sync.sh premium # Show available features +``` + ### Dart CLI Tool Install Dart SDK, then use the CLI tool for managing dotfiles: diff --git a/sync/dotfiles-sync.sh b/sync/dotfiles-sync.sh new file mode 100755 index 0000000..0931d34 --- /dev/null +++ b/sync/dotfiles-sync.sh @@ -0,0 +1,118 @@ +#!/bin/bash + +# Dotfiles sync functionality (requires authentication) +AUTH_DIR="$HOME/.dotfiles" +TOKEN_FILE="$AUTH_DIR/token" +USER_FILE="$AUTH_DIR/user" +SYNC_REPO="dotfiles-sync" + +log() { + echo "[$(date +'%Y-%m-%d %H:%M:%S')] $1" +} + +check_auth() { + if [ ! -f "$TOKEN_FILE" ] || [ ! -f "$USER_FILE" ]; then + log "ERROR: Not logged in. Run './auth/login.sh login' first" + exit 1 + fi +} + +sync_push() { + check_auth + + USERNAME=$(cat "$USER_FILE") + TOKEN=$(cat "$TOKEN_FILE") + + log "Syncing dotfiles to GitHub..." + + # Create backup of current dotfiles + BACKUP_DIR="/tmp/dotfiles-backup-$(date +%s)" + mkdir -p "$BACKUP_DIR" + + # Copy key dotfiles + [ -f ~/.gitconfig ] && cp ~/.gitconfig "$BACKUP_DIR/" + [ -f ~/.zshrc ] && cp ~/.zshrc "$BACKUP_DIR/" + [ -f ~/.bashrc ] && cp ~/.bashrc "$BACKUP_DIR/" + [ -f ~/.vimrc ] && cp ~/.vimrc "$BACKUP_DIR/" + + # Create or update sync repository + if ! gh repo view "$USERNAME/$SYNC_REPO" &>/dev/null; then + log "Creating sync repository..." + gh repo create "$SYNC_REPO" --private --description "Dotfiles sync backup" + fi + + # Push to sync repo + cd "$BACKUP_DIR" || exit 1 + git init + git add . + git commit -m "sync: backup dotfiles $(date)" + git remote add origin "https://github.com/$USERNAME/$SYNC_REPO.git" + git push -u origin main --force + + log "Dotfiles synced to github.com/$USERNAME/$SYNC_REPO" + rm -rf "$BACKUP_DIR" +} + +sync_pull() { + check_auth + + USERNAME=$(cat "$USER_FILE") + + log "Restoring dotfiles from GitHub..." + + # Clone sync repo + RESTORE_DIR="/tmp/dotfiles-restore-$(date +%s)" + if gh repo clone "$USERNAME/$SYNC_REPO" "$RESTORE_DIR"; then + cd "$RESTORE_DIR" || exit 1 + + # Backup existing files + [ -f ~/.gitconfig ] && cp ~/.gitconfig ~/.gitconfig.backup + [ -f ~/.zshrc ] && cp ~/.zshrc ~/.zshrc.backup + + # Restore files + [ -f .gitconfig ] && cp .gitconfig ~/ + [ -f .zshrc ] && cp .zshrc ~/ + [ -f .bashrc ] && cp .bashrc ~/ + [ -f .vimrc ] && cp .vimrc ~/ + + log "Dotfiles restored from sync repository" + rm -rf "$RESTORE_DIR" + else + log "ERROR: No sync repository found. Run 'sync push' first" + exit 1 + fi +} + +premium_tools() { + check_auth + + USERNAME=$(cat "$USER_FILE") + log "Premium tools for $USERNAME:" + echo " ✓ Advanced linting with custom rules" + echo " ✓ Team configuration sharing" + echo " ✓ Automated backup scheduling" + echo " ✓ Cross-platform sync" + echo "" + echo "Run 'dotfiles premium enable' to activate" +} + +case "$1" in + push) + sync_push + ;; + pull) + sync_pull + ;; + premium) + premium_tools + ;; + *) + echo "Usage: $0 {push|pull|premium}" + echo " push - Backup dotfiles to GitHub" + echo " pull - Restore dotfiles from GitHub" + echo " premium - Show premium features" + echo "" + echo "Note: Requires authentication (./auth/login.sh login)" + exit 1 + ;; +esac From d4810821f392d63a544151e875ef4e097adf0462 Mon Sep 17 00:00:00 2001 From: Niladri Das Date: Thu, 22 Jan 2026 19:24:16 +0530 Subject: [PATCH 05/14] fix: remove unused variables for shellcheck --- README.md | 2 +- auth/login.sh | 16 ++++++---------- sync/dotfiles-sync.sh | 29 ++++++++++++++--------------- 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 18d5d52..dfc0779 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Login with your GitHub account to access premium features: # Login with GitHub OAuth ./auth/login.sh login -# Check login status +# Check login status ./auth/login.sh whoami # Logout diff --git a/auth/login.sh b/auth/login.sh index 5253f20..6e8f8fa 100755 --- a/auth/login.sh +++ b/auth/login.sh @@ -11,13 +11,9 @@ log() { github_login() { mkdir -p "$AUTH_DIR" - + log "Opening GitHub OAuth login..." - - # Generate device code request - DEVICE_CODE_URL="https://github.com/login/device/code" - CLIENT_ID="your_github_app_client_id" # Replace with actual client ID - + # For now, use GitHub personal access token flow echo "Please create a GitHub Personal Access Token:" echo "1. Go to: https://github.com/settings/tokens" @@ -25,18 +21,18 @@ github_login() { echo "3. Select scopes: repo, user:email" echo "4. Copy the generated token" echo "" - + open "https://github.com/settings/tokens" 2>/dev/null || \ xdg-open "https://github.com/settings/tokens" 2>/dev/null || \ echo "Visit: https://github.com/settings/tokens" - + echo "Enter your GitHub token:" read -r -s token - + if [ -n "$token" ]; then # Validate token with GitHub API USER_INFO=$(curl -s -H "Authorization: token $token" https://api.github.com/user) - + if echo "$USER_INFO" | grep -q '"login"'; then USERNAME=$(echo "$USER_INFO" | grep '"login"' | cut -d'"' -f4) echo "$token" > "$TOKEN_FILE" diff --git a/sync/dotfiles-sync.sh b/sync/dotfiles-sync.sh index 0931d34..875dc8c 100755 --- a/sync/dotfiles-sync.sh +++ b/sync/dotfiles-sync.sh @@ -19,28 +19,27 @@ check_auth() { sync_push() { check_auth - + USERNAME=$(cat "$USER_FILE") - TOKEN=$(cat "$TOKEN_FILE") - + log "Syncing dotfiles to GitHub..." - + # Create backup of current dotfiles BACKUP_DIR="/tmp/dotfiles-backup-$(date +%s)" mkdir -p "$BACKUP_DIR" - + # Copy key dotfiles [ -f ~/.gitconfig ] && cp ~/.gitconfig "$BACKUP_DIR/" [ -f ~/.zshrc ] && cp ~/.zshrc "$BACKUP_DIR/" [ -f ~/.bashrc ] && cp ~/.bashrc "$BACKUP_DIR/" [ -f ~/.vimrc ] && cp ~/.vimrc "$BACKUP_DIR/" - + # Create or update sync repository if ! gh repo view "$USERNAME/$SYNC_REPO" &>/dev/null; then log "Creating sync repository..." gh repo create "$SYNC_REPO" --private --description "Dotfiles sync backup" fi - + # Push to sync repo cd "$BACKUP_DIR" || exit 1 git init @@ -48,33 +47,33 @@ sync_push() { git commit -m "sync: backup dotfiles $(date)" git remote add origin "https://github.com/$USERNAME/$SYNC_REPO.git" git push -u origin main --force - + log "Dotfiles synced to github.com/$USERNAME/$SYNC_REPO" rm -rf "$BACKUP_DIR" } sync_pull() { check_auth - + USERNAME=$(cat "$USER_FILE") - + log "Restoring dotfiles from GitHub..." - + # Clone sync repo RESTORE_DIR="/tmp/dotfiles-restore-$(date +%s)" if gh repo clone "$USERNAME/$SYNC_REPO" "$RESTORE_DIR"; then cd "$RESTORE_DIR" || exit 1 - + # Backup existing files [ -f ~/.gitconfig ] && cp ~/.gitconfig ~/.gitconfig.backup [ -f ~/.zshrc ] && cp ~/.zshrc ~/.zshrc.backup - + # Restore files [ -f .gitconfig ] && cp .gitconfig ~/ [ -f .zshrc ] && cp .zshrc ~/ [ -f .bashrc ] && cp .bashrc ~/ [ -f .vimrc ] && cp .vimrc ~/ - + log "Dotfiles restored from sync repository" rm -rf "$RESTORE_DIR" else @@ -85,7 +84,7 @@ sync_pull() { premium_tools() { check_auth - + USERNAME=$(cat "$USER_FILE") log "Premium tools for $USERNAME:" echo " ✓ Advanced linting with custom rules" From 97d4bd75b9195e32f57f1a6eeb90ecf46e58260d Mon Sep 17 00:00:00 2001 From: niladri das <125604915+bniladridas@users.noreply.github.com> Date: Thu, 22 Jan 2026 19:28:13 +0530 Subject: [PATCH 06/14] Update login.sh --- auth/login.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/auth/login.sh b/auth/login.sh index 6e8f8fa..85ee163 100755 --- a/auth/login.sh +++ b/auth/login.sh @@ -33,8 +33,8 @@ github_login() { # Validate token with GitHub API USER_INFO=$(curl -s -H "Authorization: token $token" https://api.github.com/user) - if echo "$USER_INFO" | grep -q '"login"'; then - USERNAME=$(echo "$USER_INFO" | grep '"login"' | cut -d'"' -f4) + USERNAME=$(echo "$USER_INFO" | jq -r '.login') + if [ -n "$USERNAME" ]; then echo "$token" > "$TOKEN_FILE" echo "$USERNAME" > "$USER_FILE" chmod 600 "$TOKEN_FILE" "$USER_FILE" From eb9f1d90b0c0de559fbd08b755650df2595c154f Mon Sep 17 00:00:00 2001 From: niladri das <125604915+bniladridas@users.noreply.github.com> Date: Thu, 22 Jan 2026 19:28:25 +0530 Subject: [PATCH 07/14] Update dotfiles-sync.sh --- sync/dotfiles-sync.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sync/dotfiles-sync.sh b/sync/dotfiles-sync.sh index 875dc8c..3a0b0ee 100755 --- a/sync/dotfiles-sync.sh +++ b/sync/dotfiles-sync.sh @@ -67,6 +67,8 @@ sync_pull() { # Backup existing files [ -f ~/.gitconfig ] && cp ~/.gitconfig ~/.gitconfig.backup [ -f ~/.zshrc ] && cp ~/.zshrc ~/.zshrc.backup + [ -f ~/.bashrc ] && cp ~/.bashrc ~/.bashrc.backup + [ -f ~/.vimrc ] && cp ~/.vimrc ~/.vimrc.backup # Restore files [ -f .gitconfig ] && cp .gitconfig ~/ From 087f5c17addf234761decbd17df298db071e38da Mon Sep 17 00:00:00 2001 From: Niladri Das Date: Thu, 22 Jan 2026 19:31:46 +0530 Subject: [PATCH 08/14] fix: add safety warning and premium --- sync/dotfiles-sync.sh | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/sync/dotfiles-sync.sh b/sync/dotfiles-sync.sh index 3a0b0ee..e3e286c 100755 --- a/sync/dotfiles-sync.sh +++ b/sync/dotfiles-sync.sh @@ -46,7 +46,17 @@ sync_push() { git add . git commit -m "sync: backup dotfiles $(date)" git remote add origin "https://github.com/$USERNAME/$SYNC_REPO.git" - git push -u origin main --force + + echo "⚠️ WARNING: This will overwrite the remote sync repository." + echo "Continue? (y/N): " + read -r confirm + if [[ "$confirm" =~ ^[Yy]$ ]]; then + git push --force-with-lease -u origin main 2>/dev/null || git push -u origin main --force + else + log "Sync cancelled by user" + rm -rf "$BACKUP_DIR" + exit 1 + fi log "Dotfiles synced to github.com/$USERNAME/$SYNC_REPO" rm -rf "$BACKUP_DIR" @@ -94,7 +104,15 @@ premium_tools() { echo " ✓ Automated backup scheduling" echo " ✓ Cross-platform sync" echo "" - echo "Run 'dotfiles premium enable' to activate" + echo "Note: Premium features are currently in development" +} + +premium_enable() { + check_auth + + log "Premium features are currently in development." + log "Available now: sync push/pull functionality" + log "Coming soon: Advanced linting, team sharing, automated backups" } case "$1" in @@ -105,13 +123,18 @@ case "$1" in sync_pull ;; premium) - premium_tools + if [ "$2" = "enable" ]; then + premium_enable + else + premium_tools + fi ;; *) - echo "Usage: $0 {push|pull|premium}" - echo " push - Backup dotfiles to GitHub" - echo " pull - Restore dotfiles from GitHub" - echo " premium - Show premium features" + echo "Usage: $0 {push|pull|premium [enable]}" + echo " push - Backup dotfiles to GitHub" + echo " pull - Restore dotfiles from GitHub" + echo " premium - Show premium features" + echo " premium enable - Enable premium features" echo "" echo "Note: Requires authentication (./auth/login.sh login)" exit 1 From db87a5741343770bdad12e65fe558b6f12d8c07c Mon Sep 17 00:00:00 2001 From: Niladri Das Date: Thu, 22 Jan 2026 19:33:28 +0530 Subject: [PATCH 09/14] fix: add pull-requests read permission --- .github/workflows/pre-commit.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 697803a..15a6b28 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -82,6 +82,7 @@ jobs: actions: read contents: read security-events: write + pull-requests: read steps: - uses: actions/checkout@v6 - uses: github/codeql-action/init@v4 From a41e88903e5c0b627904a145f946ed00513b8703 Mon Sep 17 00:00:00 2001 From: Niladri Das Date: Thu, 22 Jan 2026 19:42:43 +0530 Subject: [PATCH 10/14] feat: add automated tracking updates --- .github/workflows/update-tracking.yml | 53 +++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/update-tracking.yml diff --git a/.github/workflows/update-tracking.yml b/.github/workflows/update-tracking.yml new file mode 100644 index 0000000..d436ea5 --- /dev/null +++ b/.github/workflows/update-tracking.yml @@ -0,0 +1,53 @@ +name: Update Tracking Issue + +on: + issues: + types: [opened, closed, reopened] + pull_request: + types: [opened, closed, reopened, merged] + +jobs: + update-tracking: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: read + steps: + - name: Update tracking issue + uses: actions/github-script@v7 + with: + script: | + const trackingIssueNumber = 52; + + // Get event details + const { action, number } = context.payload; + const isIssue = context.eventName === 'issues'; + const item = context.payload[isIssue ? 'issue' : 'pull_request']; + const type = isIssue ? 'Issue' : 'PR'; + const state = item.state; + const title = item.title; + const createdAt = new Date(item.created_at).toISOString().split('T')[0]; + + // Format status emoji + const statusEmoji = state === 'open' ? '🔄' : + state === 'closed' && !isIssue ? '❌' : + state === 'merged' ? '🎉' : '✅'; + + // Create update message + const updateMsg = `## 🤖 Automated Update + + **${type} #${number}** - ${action} + - **Title**: ${title} + - **Status**: ${statusEmoji} ${state.toUpperCase()} + - **Date**: ${createdAt} + - **Action**: ${action} + + *This tracking issue will be manually updated with full context periodically.*`; + + // Add comment to tracking issue + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: trackingIssueNumber, + body: updateMsg + }); From 2f69cfb11a65a46a1d0f405f3e39e02dc4d41884 Mon Sep 17 00:00:00 2001 From: Niladri Das Date: Thu, 22 Jan 2026 19:44:17 +0530 Subject: [PATCH 11/14] fix: add github token to workflow --- .github/workflows/update-tracking.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-tracking.yml b/.github/workflows/update-tracking.yml index d436ea5..2768cdc 100644 --- a/.github/workflows/update-tracking.yml +++ b/.github/workflows/update-tracking.yml @@ -16,6 +16,7 @@ jobs: - name: Update tracking issue uses: actions/github-script@v7 with: + github-token: ${{ secrets.GITHUB_TOKEN }} script: | const trackingIssueNumber = 52; From e07493616724d35112337f61d3467ff6baa2daab Mon Sep 17 00:00:00 2001 From: niladri das <125604915+bniladridas@users.noreply.github.com> Date: Thu, 22 Jan 2026 19:44:53 +0530 Subject: [PATCH 12/14] Update auth/login.sh Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> --- auth/login.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/auth/login.sh b/auth/login.sh index 85ee163..0a8bcc4 100755 --- a/auth/login.sh +++ b/auth/login.sh @@ -34,11 +34,11 @@ github_login() { USER_INFO=$(curl -s -H "Authorization: token $token" https://api.github.com/user) USERNAME=$(echo "$USER_INFO" | jq -r '.login') - if [ -n "$USERNAME" ]; then - echo "$token" > "$TOKEN_FILE" - echo "$USERNAME" > "$USER_FILE" - chmod 600 "$TOKEN_FILE" "$USER_FILE" - log "Successfully logged in as $USERNAME!" + if [ -n "$USERNAME" ] && [ "$USERNAME" != "null" ]; then + echo "$token" > "$TOKEN_FILE" + echo "$USERNAME" > "$USER_FILE" + chmod 600 "$TOKEN_FILE" "$USER_FILE" + log "Successfully logged in as $USERNAME!" else log "ERROR: Invalid GitHub token" exit 1 From 557db2d3e53523dcf67085cd266a36fe9db4863b Mon Sep 17 00:00:00 2001 From: Niladri Das Date: Thu, 22 Jan 2026 19:45:33 +0530 Subject: [PATCH 13/14] fix: add jq dependency check --- auth/login.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/auth/login.sh b/auth/login.sh index 0a8bcc4..c165701 100755 --- a/auth/login.sh +++ b/auth/login.sh @@ -10,6 +10,12 @@ log() { } github_login() { + # Check for required dependencies + if ! command -v jq &> /dev/null; then + log "ERROR: jq is required but not installed" + exit 1 + fi + mkdir -p "$AUTH_DIR" log "Opening GitHub OAuth login..." From a5a92c2b9eb7aa1f9cf2f2116b6e836b41782b55 Mon Sep 17 00:00:00 2001 From: Niladri Das Date: Thu, 22 Jan 2026 19:49:10 +0530 Subject: [PATCH 14/14] fix: remove invalid merged event type --- .github/workflows/update-tracking.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-tracking.yml b/.github/workflows/update-tracking.yml index 2768cdc..d4901c5 100644 --- a/.github/workflows/update-tracking.yml +++ b/.github/workflows/update-tracking.yml @@ -4,7 +4,7 @@ on: issues: types: [opened, closed, reopened] pull_request: - types: [opened, closed, reopened, merged] + types: [opened, closed, reopened] jobs: update-tracking: