Skip to content

Commit f38277c

Browse files
committed
Restore test suite and fix safety-checks to be configurable
- Restore all test files (README.md, VERIFICATION.md, test-framework.sh, unit tests) - Restore config-loader.sh script that was missing - Make safety-checks.sh configurable using UPSTREAM_ORG and YOUR_GITHUB_USER variables - Add backward compatibility aliases (block_upstream_*, check_upstream_repo) - Fix sync-upstream.sh to skip push prompt when branch is already up-to-date - All 19 tests now passing (13 config-loader + 6 safety-checks)
2 parents 3c58478 + 8a2ae07 commit f38277c

37 files changed

Lines changed: 1780 additions & 860 deletions

.env-template

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Configuration Template for embabel-learning scripts
2+
# Copy this file to .env and customize it for your environment
3+
#
4+
# Usage:
5+
# cp .env-template .env
6+
# # Edit .env with your actual values
7+
#
8+
# The .env file is ignored by git (contains in .gitignore)
9+
10+
# Your personal GitHub username. Used for forking, cloning, and identifying your contributions.
11+
# This is YOUR username (e.g., "alice", "bob", "your-username")
12+
# Your forks will be at: github.com/YOUR_GITHUB_USER/repo-name
13+
#
14+
# Note: This is your personal username, NOT your organization name.
15+
# If you have a personal org (e.g., "menkelabs"), that's separate from YOUR_GITHUB_USER.
16+
YOUR_GITHUB_USER=your-username
17+
18+
# The GitHub organization whose repositories you want to MONITOR and learn from.
19+
# This is for PRODUCTION use - the organization you want to monitor.
20+
# Examples: "embabel", "spring-projects", "apache", "kubernetes", etc.
21+
# The scripts will monitor this organization's repos, not YOUR organization's repos.
22+
UPSTREAM_ORG=embabel
23+
24+
# Optional: GitHub organization to use for TESTING only.
25+
# If set, test scripts will use this instead of UPSTREAM_ORG.
26+
# This is safer for testing since it uses your own organization.
27+
# Leave empty or unset to use UPSTREAM_ORG for tests as well.
28+
# Example: TEST_UPSTREAM_ORG=menkelabs
29+
TEST_UPSTREAM_ORG=
30+
31+
# The base directory where your GitHub repositories are cloned.
32+
# Default: $HOME/github/${YOUR_GITHUB_USER}
33+
BASE_DIR=$HOME/github/${YOUR_GITHUB_USER}
34+
35+
# A space-separated list of repository names to monitor daily.
36+
# These should be repos you have cloned under $BASE_DIR.
37+
# Example: MONITOR_REPOS="guide embabel-agent dice"
38+
MONITOR_REPOS=guide embabel-agent
39+
40+
# Workspace name for VS Code/Cursor workspace file
41+
WORKSPACE_NAME=${UPSTREAM_ORG}-workspace
42+
43+
# Maximum number of repos to auto-detect if MONITOR_REPOS is not set
44+
MAX_MONITOR_REPOS=10

.pre-commit-config.yaml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,31 @@
22
# See https://pre-commit.com for more information
33

44
repos:
5-
# GitGuardian - Secret scanning
5+
# GitGuardian - Secret scanning (runs on both commit and push)
66
- repo: https://github.com/GitGuardian/ggshield
77
rev: v1.25.0
88
hooks:
99
- id: ggshield
1010
language_version: python3
11+
stages: [pre-commit, pre-push] # Run on both commit and push for extra security
12+
13+
# Local safety checks - Prevent commits to upstream organization repos
14+
- repo: local
15+
hooks:
16+
- id: block-upstream-commit
17+
name: Block commits to upstream organization
18+
entry: bash -c 'REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null)" && if [ -z "$REPO_ROOT" ]; then exit 0; fi && SCRIPT_DIR="$REPO_ROOT/scripts" && LEARNING_DIR="$REPO_ROOT" && if [ -f "$SCRIPT_DIR/config-loader.sh" ]; then source "$SCRIPT_DIR/config-loader.sh" >/dev/null 2>&1; fi && if [ -f "$SCRIPT_DIR/safety-checks.sh" ]; then source "$SCRIPT_DIR/safety-checks.sh" >/dev/null 2>&1 && block_upstream_commit; else exit 0; fi'
19+
language: system
20+
pass_filenames: false
21+
always_run: true
22+
stages: [pre-commit]
23+
- id: block-upstream-push
24+
name: Block pushes to upstream organization
25+
entry: scripts/block-upstream-push-hook.sh
26+
language: system
27+
pass_filenames: false
28+
always_run: true
29+
stages: [pre-push]
1130

1231
# General file checks
1332
- repo: https://github.com/pre-commit/pre-commit-hooks

0 commit comments

Comments
 (0)