tokenzero 0.1.1__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tokenzero-0.1.1/tokenzero.egg-info → tokenzero-0.1.3}/PKG-INFO +1 -1
- {tokenzero-0.1.1 → tokenzero-0.1.3}/mcp_server.py +2 -5
- {tokenzero-0.1.1 → tokenzero-0.1.3}/pyproject.toml +1 -1
- {tokenzero-0.1.1 → tokenzero-0.1.3}/scanner.py +3 -3
- {tokenzero-0.1.1 → tokenzero-0.1.3}/squeeze.py +57 -65
- {tokenzero-0.1.1 → tokenzero-0.1.3}/tests/test_cli.py +1 -1
- {tokenzero-0.1.1 → tokenzero-0.1.3/tokenzero.egg-info}/PKG-INFO +1 -1
- {tokenzero-0.1.1 → tokenzero-0.1.3}/LICENSE +0 -0
- {tokenzero-0.1.1 → tokenzero-0.1.3}/README.md +0 -0
- {tokenzero-0.1.1 → tokenzero-0.1.3}/proxy.py +0 -0
- {tokenzero-0.1.1 → tokenzero-0.1.3}/setup.cfg +0 -0
- {tokenzero-0.1.1 → tokenzero-0.1.3}/tokenzero.egg-info/SOURCES.txt +0 -0
- {tokenzero-0.1.1 → tokenzero-0.1.3}/tokenzero.egg-info/dependency_links.txt +0 -0
- {tokenzero-0.1.1 → tokenzero-0.1.3}/tokenzero.egg-info/entry_points.txt +0 -0
- {tokenzero-0.1.1 → tokenzero-0.1.3}/tokenzero.egg-info/requires.txt +0 -0
- {tokenzero-0.1.1 → tokenzero-0.1.3}/tokenzero.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tokenzero
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: Zero Token Waste - AST Code Skeletonizer & Live AI Monitor for Coding Agents
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Keywords: tokenzero,tokens,ai-agents,ast,antigravity,claude,cursor,optimization,mcp
|
|
@@ -11,7 +11,7 @@ from scanner import scan_project, generate_markdown_map
|
|
|
11
11
|
|
|
12
12
|
INTERNAL_PATTERNS = (
|
|
13
13
|
".tokenzero",
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
"repo_map.md",
|
|
16
16
|
"audit.jsonl",
|
|
17
17
|
"hooks.json",
|
|
@@ -48,9 +48,6 @@ def get_repo_map_path(target_dir: Path) -> Path:
|
|
|
48
48
|
local_map = target_dir / ".tokenzero" / "REPO_MAP.md"
|
|
49
49
|
if local_map.exists():
|
|
50
50
|
return local_map
|
|
51
|
-
local_ts = target_dir / ".tokensqueeze" / "REPO_MAP.md"
|
|
52
|
-
if local_ts.exists():
|
|
53
|
-
return local_ts
|
|
54
51
|
return get_project_cache_dir(target_dir) / "REPO_MAP.md"
|
|
55
52
|
|
|
56
53
|
def record_activity(target_dir: Path, action: str, file: str, function: str, lines_used: int, total_lines: int):
|
|
@@ -222,7 +219,7 @@ def handle_get_stats(args: dict) -> str:
|
|
|
222
219
|
pass
|
|
223
220
|
|
|
224
221
|
# 2. Local fallback
|
|
225
|
-
for folder in (".tokenzero",
|
|
222
|
+
for folder in (".tokenzero",):
|
|
226
223
|
local_audit = target_dir / folder / "audit.jsonl"
|
|
227
224
|
if local_audit.exists():
|
|
228
225
|
for line in local_audit.read_text(encoding="utf-8").splitlines():
|
|
@@ -11,7 +11,7 @@ from typing import Dict, Any, List
|
|
|
11
11
|
|
|
12
12
|
IGNORE_DIRS = {
|
|
13
13
|
".git", ".venv", "venv", "__pycache__", "node_modules",
|
|
14
|
-
".pytest_cache", ".tokenzero", ".
|
|
14
|
+
".pytest_cache", ".tokenzero", ".tokenzero", "dist", "build", ".egg-info",
|
|
15
15
|
".next", ".turbo", "coverage", ".cache"
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -377,8 +377,8 @@ def scan_project(root_dir: Path) -> List[Dict[str, Any]]:
|
|
|
377
377
|
def generate_markdown_map(scan_data: List[Dict[str, Any]]) -> str:
|
|
378
378
|
"""Converts the parsed AST data into an ultra-clean, dense markdown map."""
|
|
379
379
|
md = [
|
|
380
|
-
"#
|
|
381
|
-
"> Auto-generated by **
|
|
380
|
+
"# Project Architecture & Symbol Map",
|
|
381
|
+
"> Auto-generated by **TokenZero**. Consult this map for line ranges before reading full files.",
|
|
382
382
|
""
|
|
383
383
|
]
|
|
384
384
|
|
|
@@ -26,9 +26,9 @@ AGENT_CONFIGS = [
|
|
|
26
26
|
"file": "GEMINI.md",
|
|
27
27
|
"name": "Google Antigravity",
|
|
28
28
|
"rule": """<!-- BEGIN_TOKENZERO_RULE -->
|
|
29
|
-
#
|
|
29
|
+
# TokenZero Optimization Guide (Active)
|
|
30
30
|
|
|
31
|
-
1. **Check the Map First**: Before reading full source files, consult `.tokenzero/REPO_MAP.md` (or `.
|
|
31
|
+
1. **Check the Map First**: Before reading full source files, consult `.tokenzero/REPO_MAP.md` (or `.tokenzero/REPO_MAP.md`) to see the project structure, function signatures, and exact line ranges.
|
|
32
32
|
2. **Partial File Reads**: Do NOT read whole files (>100 lines) if you only need one class or function. Always use line-range reading (`StartLine` and `EndLine`) based on the line numbers in `REPO_MAP.md`.
|
|
33
33
|
3. **Targeted Edits**: Only inspect the exact function or block being edited to preserve context window and reduce token consumption.
|
|
34
34
|
4. **Do NOT Edit audit.jsonl**: The TokenZero background hook manages audit logging automatically. Never propose edits to `audit.jsonl`.
|
|
@@ -40,7 +40,7 @@ AGENT_CONFIGS = [
|
|
|
40
40
|
"file": "CLAUDE.md",
|
|
41
41
|
"name": "Claude Code",
|
|
42
42
|
"rule": """<!-- BEGIN_TOKENZERO_RULE -->
|
|
43
|
-
#
|
|
43
|
+
# TokenZero Optimization Guide (Active)
|
|
44
44
|
|
|
45
45
|
1. **Check the Map First**: Before reading full source files, consult `.tokenzero/REPO_MAP.md` to see the project structure, function signatures, and exact line ranges.
|
|
46
46
|
2. **Partial File Reads**: Do NOT read whole files (>100 lines) if you only need one class or function. Always use line-range reading based on the line numbers in `REPO_MAP.md`.
|
|
@@ -52,7 +52,7 @@ AGENT_CONFIGS = [
|
|
|
52
52
|
"file": ".cursorrules",
|
|
53
53
|
"name": "Cursor IDE",
|
|
54
54
|
"rule": """<!-- BEGIN_TOKENZERO_RULE -->
|
|
55
|
-
#
|
|
55
|
+
# TokenZero Optimization Guide (Active)
|
|
56
56
|
|
|
57
57
|
1. **Check the Map First**: Before reading full source files, consult `.tokenzero/REPO_MAP.md` to see the project structure, function signatures, and exact line ranges.
|
|
58
58
|
2. **Partial File Reads**: Do NOT read whole files (>100 lines) if you only need one class or function. Always use line-range reading based on the line numbers in `REPO_MAP.md`.
|
|
@@ -63,7 +63,7 @@ AGENT_CONFIGS = [
|
|
|
63
63
|
"file": ".windsurfrules",
|
|
64
64
|
"name": "Windsurf IDE",
|
|
65
65
|
"rule": """<!-- BEGIN_TOKENZERO_RULE -->
|
|
66
|
-
#
|
|
66
|
+
# TokenZero Optimization Guide (Active)
|
|
67
67
|
|
|
68
68
|
1. **Check the Map First**: Before reading full source files, consult `.tokenzero/REPO_MAP.md` to see the project structure, function signatures, and exact line ranges.
|
|
69
69
|
2. **Partial File Reads**: Do NOT read whole files (>100 lines) if you only need one class or function. Always use line-range reading based on the line numbers in `REPO_MAP.md`.
|
|
@@ -74,7 +74,7 @@ AGENT_CONFIGS = [
|
|
|
74
74
|
"file": ".github/copilot-instructions.md",
|
|
75
75
|
"name": "GitHub Copilot",
|
|
76
76
|
"rule": """<!-- BEGIN_TOKENZERO_RULE -->
|
|
77
|
-
#
|
|
77
|
+
# TokenZero Optimization Guide (Active)
|
|
78
78
|
|
|
79
79
|
1. **Check the Map First**: Before reading full source files, consult `.tokenzero/REPO_MAP.md` to see the project structure, function signatures, and exact line ranges.
|
|
80
80
|
2. **Partial File Reads**: Do NOT read whole files (>100 lines) if you only need one class or function. Always use line-range reading based on the line numbers in `REPO_MAP.md`.
|
|
@@ -90,7 +90,7 @@ HOOK_CONFIG = {
|
|
|
90
90
|
"hooks": [
|
|
91
91
|
{
|
|
92
92
|
"type": "command",
|
|
93
|
-
"command": "PATH=\"$HOME/.local/bin:$PATH\" tokenzero hook",
|
|
93
|
+
"command": "PATH=\"$HOME/.local/bin:$PATH\" tokenzero hook || exit 0",
|
|
94
94
|
"timeout": 5
|
|
95
95
|
}
|
|
96
96
|
]
|
|
@@ -101,7 +101,7 @@ HOOK_CONFIG = {
|
|
|
101
101
|
|
|
102
102
|
INTERNAL_PATTERNS = (
|
|
103
103
|
".tokenzero",
|
|
104
|
-
".
|
|
104
|
+
".tokenzero",
|
|
105
105
|
"repo_map.md",
|
|
106
106
|
"audit.jsonl",
|
|
107
107
|
"hooks.json",
|
|
@@ -142,7 +142,7 @@ def get_repo_map_path(target_dir: Path) -> Path:
|
|
|
142
142
|
local_map = target_dir / ".tokenzero" / "REPO_MAP.md"
|
|
143
143
|
if local_map.exists():
|
|
144
144
|
return local_map
|
|
145
|
-
local_ts = target_dir / ".
|
|
145
|
+
local_ts = target_dir / ".tokenzero" / "REPO_MAP.md"
|
|
146
146
|
if local_ts.exists():
|
|
147
147
|
return local_ts
|
|
148
148
|
return get_project_cache_dir(target_dir) / "REPO_MAP.md"
|
|
@@ -150,7 +150,7 @@ def get_repo_map_path(target_dir: Path) -> Path:
|
|
|
150
150
|
def get_config_dir(target_dir: Path) -> Path:
|
|
151
151
|
"""Returns local .tokenzero dir if exists, else global cache."""
|
|
152
152
|
tz = target_dir / ".tokenzero"
|
|
153
|
-
ts = target_dir / ".
|
|
153
|
+
ts = target_dir / ".tokenzero"
|
|
154
154
|
if tz.exists():
|
|
155
155
|
return tz
|
|
156
156
|
if ts.exists():
|
|
@@ -283,7 +283,7 @@ def get_audit_entries(target_dir: Path):
|
|
|
283
283
|
pass
|
|
284
284
|
|
|
285
285
|
# 2. Local fallback if legacy audit exists
|
|
286
|
-
for folder in (".tokenzero", ".
|
|
286
|
+
for folder in (".tokenzero", ".tokenzero"):
|
|
287
287
|
local_audit = target_dir / folder / "audit.jsonl"
|
|
288
288
|
if local_audit.exists():
|
|
289
289
|
try:
|
|
@@ -338,7 +338,7 @@ def render_dashboard_layout(target_dir: Path, spinner_frame: str) -> Layout:
|
|
|
338
338
|
table.add_row(
|
|
339
339
|
datetime.now().strftime("%H:%M:%S"),
|
|
340
340
|
"[dim]WAIT[/dim]",
|
|
341
|
-
"[dim]
|
|
341
|
+
"[dim]Listening for AI agent tool calls...[/dim]",
|
|
342
342
|
"-",
|
|
343
343
|
"-"
|
|
344
344
|
)
|
|
@@ -388,15 +388,15 @@ def render_dashboard_layout(target_dir: Path, spinner_frame: str) -> Layout:
|
|
|
388
388
|
summary_table.add_column("C1", justify="center")
|
|
389
389
|
|
|
390
390
|
summary_table.add_row(
|
|
391
|
-
f"[dim]
|
|
392
|
-
f"
|
|
393
|
-
f"
|
|
391
|
+
f"[dim][telemetry][/dim] {len(entries)} events across {len(files_touched)} files | "
|
|
392
|
+
f"[dim]unoptimized:[/dim] {without_tokens:,} tokens (${dollars_without:.4f}) ➜ "
|
|
393
|
+
f"[dim]optimized:[/dim] [green]{total_tokens_used:,}[/green] tokens (${dollars_with:.4f})"
|
|
394
394
|
)
|
|
395
395
|
summary_table.add_row(
|
|
396
|
-
f"
|
|
396
|
+
f"[bold green][savings] net saved: +{total_tokens_saved:,} tokens ({pct_saved:.1f}% reduction) | cost saved: ${dollars_saved:.4f} USD[/bold green]"
|
|
397
397
|
)
|
|
398
398
|
|
|
399
|
-
layout["footer"].update(Panel(summary_table, title="
|
|
399
|
+
layout["footer"].update(Panel(summary_table, title="[dim]tokenzero metrics[/dim]", border_style="dim"))
|
|
400
400
|
|
|
401
401
|
return layout
|
|
402
402
|
|
|
@@ -405,7 +405,7 @@ def watch_dashboard(target_dir: Path):
|
|
|
405
405
|
setup_tokenzero(silent=True)
|
|
406
406
|
map_file = get_repo_map_path(target_dir)
|
|
407
407
|
if not map_file.exists():
|
|
408
|
-
console.print(f"[
|
|
408
|
+
console.print(f"[dim]TokenZero cache not found for {target_dir.name}. Initializing stealth mode...[/dim]")
|
|
409
409
|
init_tokenzero(target_dir, local=False)
|
|
410
410
|
|
|
411
411
|
console.clear()
|
|
@@ -419,19 +419,19 @@ def watch_dashboard(target_dir: Path):
|
|
|
419
419
|
idx = (idx + 1) % len(spinner_chars)
|
|
420
420
|
live.update(render_dashboard_layout(target_dir, spinner_chars[idx]))
|
|
421
421
|
except KeyboardInterrupt:
|
|
422
|
-
console.print("\n[
|
|
422
|
+
console.print("\n[dim]TokenZero live monitor stopped.[/dim]")
|
|
423
423
|
|
|
424
424
|
def show_stats_once(target_dir: Path):
|
|
425
425
|
"""Static one-time stats print."""
|
|
426
426
|
console.print(render_dashboard_layout(target_dir, "●"))
|
|
427
427
|
|
|
428
428
|
def init_tokenzero(target_dir: Path, local: bool = False):
|
|
429
|
-
|
|
429
|
+
|
|
430
430
|
|
|
431
431
|
# 1. Scan codebase (Python, JavaScript, TypeScript, Go)
|
|
432
432
|
scan_results = scan_project(target_dir)
|
|
433
433
|
if not scan_results:
|
|
434
|
-
console.print("[yellow]
|
|
434
|
+
console.print("[yellow]Warning: No supported source files (.py, .js, .ts, .jsx, .tsx, .go) found.[/yellow]")
|
|
435
435
|
return
|
|
436
436
|
|
|
437
437
|
map_content = generate_markdown_map(scan_results)
|
|
@@ -449,7 +449,7 @@ def init_tokenzero(target_dir: Path, local: bool = False):
|
|
|
449
449
|
with open(gitignore_path, "a", encoding="utf-8") as f:
|
|
450
450
|
if existing_gi and not existing_gi.endswith("\n"):
|
|
451
451
|
f.write("\n")
|
|
452
|
-
f.write("\n# TokenZero (Auto-ignored)\n.tokenzero/\n.
|
|
452
|
+
f.write("\n# TokenZero (Auto-ignored)\n.tokenzero/\n.tokenzero/\n")
|
|
453
453
|
|
|
454
454
|
# Inject Rules into supported agent files
|
|
455
455
|
for cfg in AGENT_CONFIGS:
|
|
@@ -503,20 +503,17 @@ def init_tokenzero(target_dir: Path, local: bool = False):
|
|
|
503
503
|
|
|
504
504
|
mode_label = "Local (Auto-.gitignore)" if local else "[bold green]Zero-File Stealth Mode (0 files in project)[/bold green]"
|
|
505
505
|
|
|
506
|
-
table = Table(title="⚡ [bold green]TokenZero Optimization Engine Activated[/bold green]", header_style="bold magenta")
|
|
507
|
-
table.add_column("Component", style="cyan")
|
|
508
|
-
table.add_column("Status / Impact", style="bold white")
|
|
509
|
-
|
|
510
|
-
table.add_row("Codebase Analysis", f"{total_files} files, {total_classes + total_funcs + total_methods} symbols indexed")
|
|
511
|
-
table.add_row("Project Directory", mode_label)
|
|
512
|
-
table.add_row("TokenZero Core Engine", "[bold green]Online & Synchronized[/bold green]")
|
|
513
|
-
table.add_row("Context Compression", f"[bold green]{pct:.1f}% reduction[/bold green]")
|
|
514
|
-
table.add_row("Multi-Agent Guard", "[bold green]Active (Antigravity, Claude, Cursor, Copilot, Windsurf)[/bold green]")
|
|
515
|
-
table.add_row("Real-Time Telemetry", "[bold green]Connected (~/.tokenzero/audit.jsonl)[/bold green]")
|
|
516
|
-
|
|
517
506
|
console.print()
|
|
518
|
-
console.print(
|
|
519
|
-
console.print("
|
|
507
|
+
console.print("[bold cyan]tokenzero[/bold cyan] [dim]v0.1.2[/dim]")
|
|
508
|
+
console.print(f"[bold cyan] init[/bold cyan] target [white]{target_dir.resolve()}[/white]")
|
|
509
|
+
console.print(f"[bold blue] scan[/bold blue] indexed [white]{total_files} files[/white] [dim]({total_classes + total_funcs + total_methods} symbols, {raw_lines:,} lines)[/dim]")
|
|
510
|
+
mode_text = "[green]zero-file stealth[/green] [dim](0 repository files touched)[/dim]" if not local else "[yellow]local repo rules[/yellow]"
|
|
511
|
+
console.print(f"[bold magenta] mode[/bold magenta] storage {mode_text}")
|
|
512
|
+
console.print(f"[bold green] sync[/bold green] agents [white]Antigravity, Cursor, Claude, Copilot[/white]")
|
|
513
|
+
cache_info = f"[dim]{cache_dir}[/dim]" if not local else f"[dim]{tokenzero_dir}[/dim]"
|
|
514
|
+
console.print(f"[dim] cache path {cache_info}[/dim]")
|
|
515
|
+
console.print()
|
|
516
|
+
console.print("[dim]ready: run[/dim] [cyan]tokenzero watch[/cyan] [dim]to stream live token consumption[/dim]\n")
|
|
520
517
|
|
|
521
518
|
def ensure_antigravity_plugin() -> tuple:
|
|
522
519
|
"""Installs or updates the global Antigravity plugin in ~/.gemini/config/plugins/tokenzero/"""
|
|
@@ -535,7 +532,7 @@ def ensure_antigravity_plugin() -> tuple:
|
|
|
535
532
|
rules_dir = plugin_dir / "rules"
|
|
536
533
|
rules_dir.mkdir(exist_ok=True)
|
|
537
534
|
(rules_dir / "AGENTS.md").write_text("""<!-- BEGIN_TOKENZERO_RULE -->
|
|
538
|
-
#
|
|
535
|
+
# TokenZero Optimization Guide (Active)
|
|
539
536
|
|
|
540
537
|
1. **Check the Map First**: Before reading full source files, consult TokenZero REPO_MAP to see the project structure, function signatures, and exact line ranges.
|
|
541
538
|
2. **Partial File Reads**: Do NOT read whole files (>100 lines) if you only need one class or function. Always use line-range reading (`StartLine` and `EndLine`).
|
|
@@ -553,7 +550,7 @@ def setup_tokenzero(silent: bool = False) -> list:
|
|
|
553
550
|
Configures Claude Desktop, Claude Code, Cursor IDE, etc.
|
|
554
551
|
"""
|
|
555
552
|
if not silent:
|
|
556
|
-
console.print("\n[bold
|
|
553
|
+
console.print("\n[bold]TokenZero Universal Integration[/bold]\n")
|
|
557
554
|
results = []
|
|
558
555
|
|
|
559
556
|
mcp_config_entry = {
|
|
@@ -617,27 +614,24 @@ def setup_tokenzero(silent: bool = False) -> list:
|
|
|
617
614
|
results.append(("Google Antigravity", "~/.gemini/config/plugins/", f"[yellow]Skipped ({path_or_err})[/yellow]"))
|
|
618
615
|
|
|
619
616
|
if not silent:
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
table.add_column("Status", style="bold white")
|
|
624
|
-
|
|
617
|
+
console.print()
|
|
618
|
+
console.print("[bold cyan]tokenzero[/bold cyan] [dim]v0.1.2[/dim]")
|
|
619
|
+
console.print("[bold cyan] setup[/bold cyan] configuring universal integrations...")
|
|
625
620
|
for agent, path, status in results:
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
console.print(
|
|
629
|
-
console.print("
|
|
630
|
-
console.print("[dim]Project repositories remain 100% clean with 0 files added.[/dim]\n")
|
|
621
|
+
status_text = "[green]connected[/green]" if "Configured" in status else "[dim]skipped[/dim]"
|
|
622
|
+
console.print(f"[bold green] ok[/bold green] {agent:<20} [dim]{path}[/dim] -> {status_text}")
|
|
623
|
+
console.print()
|
|
624
|
+
console.print("[dim]connected: all configured agents will route tool calls through tokenzero.[/dim]\n")
|
|
631
625
|
|
|
632
626
|
return results
|
|
633
627
|
|
|
634
628
|
def remove_tokenzero(target_dir: Path):
|
|
635
629
|
"""Completely removes TokenZero config, maps, rules, and hooks from a project."""
|
|
636
|
-
console.print(f"\n[bold
|
|
630
|
+
console.print(f"\n[bold]TokenZero:[/bold] Deactivating from {target_dir}")
|
|
637
631
|
removed_items = []
|
|
638
632
|
|
|
639
633
|
# 1. Remove directories
|
|
640
|
-
for d in (".tokenzero", ".
|
|
634
|
+
for d in (".tokenzero", ".tokenzero"):
|
|
641
635
|
folder = target_dir / d
|
|
642
636
|
if folder.exists():
|
|
643
637
|
shutil.rmtree(folder)
|
|
@@ -686,7 +680,7 @@ def remove_tokenzero(target_dir: Path):
|
|
|
686
680
|
try:
|
|
687
681
|
data = json.loads(hooks_file.read_text(encoding="utf-8"))
|
|
688
682
|
data.pop("tokenzero-live", None)
|
|
689
|
-
|
|
683
|
+
|
|
690
684
|
if data:
|
|
691
685
|
hooks_file.write_text(json.dumps(data, indent=2), encoding="utf-8")
|
|
692
686
|
removed_items.append(".agents/hooks.json")
|
|
@@ -704,7 +698,7 @@ def remove_tokenzero(target_dir: Path):
|
|
|
704
698
|
if gitignore_path.exists():
|
|
705
699
|
try:
|
|
706
700
|
gi_content = gitignore_path.read_text(encoding="utf-8")
|
|
707
|
-
cleaned_gi = re.sub(r"\n*# TokenZero \(Auto-ignored\)\n\.tokenzero/\n\.
|
|
701
|
+
cleaned_gi = re.sub(r"\n*# TokenZero \(Auto-ignored\)\n\.tokenzero/\n\.tokenzero/\n*", "\n", gi_content).strip()
|
|
708
702
|
if cleaned_gi != gi_content.strip():
|
|
709
703
|
if cleaned_gi:
|
|
710
704
|
gitignore_path.write_text(cleaned_gi + "\n", encoding="utf-8")
|
|
@@ -715,14 +709,14 @@ def remove_tokenzero(target_dir: Path):
|
|
|
715
709
|
pass
|
|
716
710
|
|
|
717
711
|
if removed_items:
|
|
718
|
-
console.print(f"\n[
|
|
712
|
+
console.print(f"\n[green]TokenZero optimizations deactivated successfully.[/green]")
|
|
719
713
|
console.print(f"[dim]Codebase restored to original state ({len(removed_items)} components cleaned).[/dim]\n")
|
|
720
714
|
else:
|
|
721
|
-
console.print(f"[
|
|
715
|
+
console.print(f"[dim]No TokenZero configurations found in {target_dir.name}.[/dim]\n")
|
|
722
716
|
|
|
723
717
|
def remove_global_configs() -> list:
|
|
724
718
|
"""Completely uninstalls TokenZero from all global AI editors, plugins, and cache."""
|
|
725
|
-
console.print("\n[bold
|
|
719
|
+
console.print("\n[bold]TokenZero Global Cleanup[/bold]\n")
|
|
726
720
|
cleaned = []
|
|
727
721
|
|
|
728
722
|
# 1. Remove Google Antigravity Global Plugin
|
|
@@ -786,21 +780,19 @@ def remove_global_configs() -> list:
|
|
|
786
780
|
except Exception as e:
|
|
787
781
|
cleaned.append(("Global Cache & Telemetry", str(GLOBAL_DIR), f"[yellow]Error ({e})[/yellow]"))
|
|
788
782
|
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
table.add_column("Result", style="bold white")
|
|
793
|
-
|
|
783
|
+
console.print()
|
|
784
|
+
console.print("[bold cyan]tokenzero[/bold cyan] [dim]v0.1.2[/dim]")
|
|
785
|
+
console.print("[bold yellow] clean[/bold yellow] removing global integrations and cache...")
|
|
794
786
|
for agent, path, status in cleaned:
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
console.print(
|
|
798
|
-
console.print("
|
|
787
|
+
tag = "[green]removed[/green]" if "Removed" in status or "Deleted" in status else "[dim]not found[/dim]"
|
|
788
|
+
console.print(f"[bold red] purge[/bold red] {agent:<22} [dim]{path}[/dim] -> {tag}")
|
|
789
|
+
console.print()
|
|
790
|
+
console.print("[dim]cleanup complete: all global integrations and caches removed.[/dim]\n")
|
|
799
791
|
return cleaned
|
|
800
792
|
|
|
801
793
|
def main():
|
|
802
794
|
import argparse
|
|
803
|
-
parser = argparse.ArgumentParser(description="
|
|
795
|
+
parser = argparse.ArgumentParser(description="TokenZero - AST Code Skeletonizer & Token Optimizer for AI Coding Agents")
|
|
804
796
|
subparsers = parser.add_subparsers(dest="command", help="Available commands")
|
|
805
797
|
|
|
806
798
|
# init command
|
|
@@ -865,7 +857,7 @@ def main():
|
|
|
865
857
|
elif args.command == "proxy":
|
|
866
858
|
import uvicorn
|
|
867
859
|
from proxy import app
|
|
868
|
-
console.print("
|
|
860
|
+
console.print("TokenZero Proxy listening on http://127.0.0.1:8080")
|
|
869
861
|
uvicorn.run(app, host="127.0.0.1", port=8080, log_level="warning")
|
|
870
862
|
elif args.command == "watch":
|
|
871
863
|
target_path = Path(getattr(args, "path", ".")).resolve()
|
|
@@ -107,7 +107,7 @@ class TestTokenZeroScanner(unittest.TestCase):
|
|
|
107
107
|
py_file.write_text("def helper(): pass\n")
|
|
108
108
|
results = scan_project(Path(self.test_dir))
|
|
109
109
|
md = generate_markdown_map(results)
|
|
110
|
-
self.assertIn("#
|
|
110
|
+
self.assertIn("# Project Architecture & Symbol Map", md)
|
|
111
111
|
self.assertIn("utils.py", md)
|
|
112
112
|
self.assertIn("helper", md)
|
|
113
113
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tokenzero
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: Zero Token Waste - AST Code Skeletonizer & Live AI Monitor for Coding Agents
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Keywords: tokenzero,tokens,ai-agents,ast,antigravity,claude,cursor,optimization,mcp
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|