From d568258d6f19707e9cc15c8a294018483e7689f3 Mon Sep 17 00:00:00 2001 From: totalbrain Date: Fri, 5 Dec 2025 09:53:34 +0330 Subject: [PATCH 1/3] setup: dev branch workflow, protected main, actions tests --- .github/workflows/test-dev.yml | 19 ++++++++ .gitignore | 30 ++++++++++++ pyproject.toml | 3 ++ setup-dev-branch.ps1 | 83 ++++++++++++++++++++++++++++++++++ 4 files changed, 135 insertions(+) create mode 100644 .github/workflows/test-dev.yml create mode 100644 .gitignore create mode 100644 pyproject.toml create mode 100644 setup-dev-branch.ps1 diff --git a/.github/workflows/test-dev.yml b/.github/workflows/test-dev.yml new file mode 100644 index 0000000..6e85026 --- /dev/null +++ b/.github/workflows/test-dev.yml @@ -0,0 +1,19 @@ +name: Test Dev Branch +on: + push: + branches: [dev] + pull_request: + branches: [dev] +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Install deps + run: pip install pytest tiktoken + - name: Run tests + run: pytest tests/ -v diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..388bd99 --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +# Windows +Thumbs.db +Desktop.ini +.BIN/ + +# macOS +.DS_Store + +# Python/Node +__pycache__/ +*.py[cod] +venv/ +env/ +.env +node_modules/ +dist/ +build/ + +# Editors +.vscode/ +.idea/ + +# Temp +_temp/ +_trash/ + +*.pyc + +*.egg-info/ +.pytest_cache/ \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..8cf3256 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" \ No newline at end of file diff --git a/setup-dev-branch.ps1 b/setup-dev-branch.ps1 new file mode 100644 index 0000000..5006658 --- /dev/null +++ b/setup-dev-branch.ps1 @@ -0,0 +1,83 @@ +# setup-dev-branch.ps1 - AI Token Crusher Dev Branch Setup + +$Token = "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" +$Owner = "totalbrain" +$Repo = "TokenOptimizer" + +$Headers = @{ + Authorization = "Bearer $Token" + Accept = "application/vnd.github+json" +} + +Write-Host "Creating dev branch setup..." -ForegroundColor Cyan + +# 1. Create dev branch from main +git checkout main +git pull origin main +git checkout -b dev +git push origin dev + +# 2. Set dev as default branch +Invoke-RestMethod -Method Patch -Uri "https://api.github.com/repos/$Owner/$Repo" -Headers $Headers -Body (@{ + default_branch = "dev" +} | ConvertTo-Json) + +# 3. Protect main branch (require PR, 1 approval) +$protect = @{ + required_pull_request_reviews = @{ + required_approving_review_count = 1 + } + enforce_admins = $true +} +Invoke-RestMethod -Method Put -Uri "https://api.github.com/repos/$Owner/$Repo/branches/main/protection" -Headers $Headers -Body ($protect | ConvertTo-Json -Depth 10) + +# 4. Update README with workflow +$readme_content = @" +## Workflow +- Fork the repo +- Create feature/issue-# branch from dev +- Work on the issue +- PR to dev +- After tests/approve, merge to dev +- For release: PR dev to main +"@ +$readme_base64 = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($readme_content)) +$existing_readme = Invoke-RestMethod "https://api.github.com/repos/$Owner/$Repo/contents/README.md" -Headers $Headers +Invoke-RestMethod -Method Put -Uri "https://api.github.com/repos/$Owner/$Repo/contents/README.md" -Headers $Headers -Body (@{ + message = "Update README with workflow" + content = $readme_base64 + sha = $existing_readme.sha +} | ConvertTo-Json) + +# 5. Create GitHub Actions for tests on dev +mkdir .github/workflows -ErrorAction SilentlyContinue +$actions_yaml = @" +name: Test Dev Branch +on: + push: + branches: [dev] + pull_request: + branches: [dev] +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Install deps + run: pip install pytest tiktoken + - name: Run tests + run: pytest tests/ -v +"@ +$actions_yaml | Out-File -FilePath ".github/workflows/test-dev.yml" -Encoding utf8 + +# 6. Commit and push +git add . +git commit -m "setup: dev branch workflow, protected main, actions tests" +git push origin dev + +Write-Host "All done! Dev branch is ready." -ForegroundColor Green +Write-Host "Contributors now PR to dev, merge after tests, then PR dev to main for release." -ForegroundColor Green \ No newline at end of file From c1e163c88815f86bebd5a3c8c9423d249a2c5490 Mon Sep 17 00:00:00 2001 From: totalbrain Date: Fri, 5 Dec 2025 10:21:43 +0330 Subject: [PATCH 2/3] Revert "Update README with workflow" This reverts commit f3121444a4f1b28ead53a573f0cd7801ee8db0ab. --- README.md | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 1af1e83..23157ef 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,23 @@ -## Workflow -- Fork the repo -- Create feature/issue-# branch from dev -- Work on the issue -- PR to dev -- After tests/approve, merge to dev -- For release: PR dev to main \ No newline at end of file +# AI Token Crusher + +**Cut up to 75% of tokens for Grok • GPT • Claude • Llama • Gemini** +100% offline • Open source • AI-safe token minifier + +![AI Token Crusher](assets/screenshot1.png) + +### Features +- 20+ aggressive yet safe optimizations +- Real-time savings counter +- Full control with checkboxes +- Copy to clipboard • One-click save +- 100% offline • No telemetry + +### Download +[Latest Windows .exe →](https://github.com/totalbrain/TokenOptimizer/releases/latest) + +### Roadmap +→ [View all planned features](https://github.com/users/totalbrain/projects/1) + +**Free forever • MIT License • Made for AI developers** + +⭐ Star if you saved tokens today! \ No newline at end of file From d2cbd72d50eab3d5aa8819727b606ce6b48e9730 Mon Sep 17 00:00:00 2001 From: totalbrain <194908229+totalbrain@users.noreply.github.com> Date: Sat, 20 Dec 2025 15:10:52 +0330 Subject: [PATCH 3/3] Update settings.json --- .vscode/settings.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 9b38853..9cb47d3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,5 +3,6 @@ "tests" ], "python.testing.unittestEnabled": false, - "python.testing.pytestEnabled": true + "python.testing.pytestEnabled": true, + "pieces.cloudCapabilities": "Blended" } \ No newline at end of file