19 Commits

Author SHA1 Message Date
Eric
cd6e85cac0 feat: bun_script
Some checks failed
CI / test (ubuntu-latest, linux-x64) (push) Failing after 38s
CI / test (macos-14, darwin-arm64) (push) Has been cancelled
CI / test (windows-latest, windows) (push) Has been cancelled
2026-03-06 19:56:17 +01:00
Eric
ff90522c3c feat: bun_script 2026-03-06 19:51:52 +01:00
Eric
a1a6568227 chore: script 2026-03-04 20:32:02 +01:00
Eric
6cf1e57409 chore(release): v0.0.8 2026-03-04 20:32:02 +01:00
Eric
e40127378d fix: .env is located next to package.json 2026-03-04 20:32:01 +01:00
Eric
af377eac9d chore(release): v0.0.7 2026-03-04 20:32:01 +01:00
Eric
d10365e9fe feat: add docs 2026-03-04 20:32:01 +01:00
Eric
ab8e5e0061 feat: add option for process cwd (.env support) 2026-03-04 20:32:01 +01:00
Eric
44a28bc262 chore(release): v0.0.6 2026-03-04 20:32:01 +01:00
Eric
ff029adbc9 feat: bun dev target support 2026-03-04 20:32:01 +01:00
Eric
4144633204 chore(release): v0.0.5 2026-03-04 20:32:01 +01:00
Eric
29c39822d5 docs: update readme on release 2026-03-04 20:32:01 +01:00
Eric
87882c9d9f chore(release): v0.0.4 2026-03-04 20:32:00 +01:00
Eric
a38cae0265 docs: readme instructions 2026-03-04 20:32:00 +01:00
Eric
b614afd435 chore(release): v0.0.3 2026-03-04 20:32:00 +01:00
Eric
255958b3dd feat: release script 2026-03-04 20:32:00 +01:00
Eric
01fe0a790d test: add bun workspace tests 2026-03-04 20:32:00 +01:00
Eric
70aa7c4655 test: add workspace monorepo bun install test 2026-03-04 20:32:00 +01:00
Eric
722d503edb Initial plan 2026-03-04 20:32:00 +01:00

138
prank.py Executable file
View File

@@ -0,0 +1,138 @@
#!/usr/bin/env python3
"""
git-claim-authorship.py
Rewrites git history so that all commits list you as the author.
Usage:
python git-claim-authorship.py --name "Your Name" --email "you@example.com"
Run from inside the repository you want to rewrite.
WARNING: This rewrites history. Force-push required afterwards.
"""
import subprocess
import argparse
import shlex
import sys
def run(cmd, capture=True, check=True):
result = subprocess.run(
cmd, shell=True, capture_output=capture, text=True, check=check
)
return result.stdout.strip() if capture else None
def get_all_commits():
output = run("git log --format='%H' --all")
return output.splitlines() if output else []
def get_original_refs():
output = run("git for-each-ref --format='%(refname)' refs/original", check=False)
return output.splitlines() if output else []
def shell_quote(value):
return shlex.quote(value)
def main():
parser = argparse.ArgumentParser(
description="Rewrite history so all commits use the provided author."
)
parser.add_argument("--name", required=True, help="Your full name (as in git)")
parser.add_argument("--email", required=True, help="Your email (as in git)")
parser.add_argument(
"--dry-run",
action="store_true",
help="Show what would change without modifying anything",
)
parser.add_argument(
"--keep-original-refs",
action="store_true",
help="Keep git filter-branch backup refs instead of deleting them after rewrite",
)
args = parser.parse_args()
# Make sure we're in a git repo
try:
run("git rev-parse --is-inside-work-tree")
except subprocess.CalledProcessError:
print("Error: not inside a git repository.", file=sys.stderr)
sys.exit(1)
print(f"Scanning commits to rewrite author to: {args.name} <{args.email}>")
commits = get_all_commits()
print(f"Total commits found: {len(commits)}")
if not commits:
print("No commits found. Nothing to do.")
return
print(f"\nFound {len(commits)} commit(s) to rewrite.\n")
if args.dry_run:
print("\n[Dry run] No changes made.")
return
confirm = input(
"\n⚠️ This will rewrite history. Proceed? (yes/no): "
).strip().lower()
if confirm != "yes":
print("Aborted.")
return
# Build a filter-branch env filter script
env_filter = f"""
export GIT_AUTHOR_NAME={shell_quote(args.name)}
export GIT_AUTHOR_EMAIL={shell_quote(args.email)}
export GIT_COMMITTER_NAME={shell_quote(args.name)}
export GIT_COMMITTER_EMAIL={shell_quote(args.email)}
"""
print("\nRewriting history with git filter-branch...")
try:
result = subprocess.run(
[
"git", "filter-branch", "-f",
"--env-filter", env_filter,
"--tag-name-filter", "cat",
"--", "--all"
],
capture_output=False,
text=True,
)
if result.returncode != 0:
print("filter-branch failed.", file=sys.stderr)
sys.exit(1)
except Exception as e:
print(f"Error: {e}", file=sys.stderr)
sys.exit(1)
if args.keep_original_refs:
print("\nKept git filter-branch backup refs under refs/original.")
else:
original_refs = get_original_refs()
if original_refs:
print("\nRemoving git filter-branch backup refs...")
for ref in original_refs:
subprocess.run(["git", "update-ref", "-d", ref], check=True)
print("Expiring reflogs and pruning unreachable objects...")
subprocess.run(
["git", "reflog", "expire", "--expire=now", "--all"],
check=True,
)
subprocess.run(["git", "gc", "--prune=now"], check=True)
print("\n✅ Done! History rewritten.")
print("\nTo publish the changes, force-push all branches:")
print(" git push --force --all")
print(" git push --force --tags")
print("\nNote: Anyone else with a clone of this repo will need to re-clone or rebase.")
if __name__ == "__main__":
main()