Skip to content
Closed
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
19 changes: 19 additions & 0 deletions .github/workflows/test-dev.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
"python.testing.pytestEnabled": true,
"pieces.cloudCapabilities": "Blended"
}
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
# 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!
AI Token Crusher – Full Journey (From Idea to Production)

## Quick Links
Expand Down
83 changes: 83 additions & 0 deletions setup-dev-branch.ps1
Original file line number Diff line number Diff line change
@@ -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
Loading