tidyout-cli 0.1.0__tar.gz → 0.2.0__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.
Files changed (31) hide show
  1. tidyout_cli-0.2.0/.claude/settings.local.json +15 -0
  2. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/PKG-INFO +21 -18
  3. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/README.md +20 -17
  4. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/pyproject.toml +2 -2
  5. tidyout_cli-0.2.0/tests/test_cli.py +149 -0
  6. tidyout_cli-0.2.0/tidyout/__init__.py +1 -0
  7. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/tidyout/cli.py +2 -2
  8. tidyout_cli-0.2.0/tidyout/init_agent.py +34 -0
  9. tidyout_cli-0.1.0/tests/test_cli.py +0 -98
  10. tidyout_cli-0.1.0/tidyout/__init__.py +0 -1
  11. tidyout_cli-0.1.0/tidyout/init_agent.py +0 -28
  12. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/.github/workflows/publish.yml +0 -0
  13. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/.gitignore +0 -0
  14. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/CONTRIBUTING.md +0 -0
  15. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/docs/superpowers/specs/2026-05-12-tidyout-design.md +0 -0
  16. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/tests/test_stripper.py +0 -0
  17. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/tidyout/rules/cargo_build.yaml +0 -0
  18. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/tidyout/rules/docker_logs.yaml +0 -0
  19. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/tidyout/rules/docker_ps.yaml +0 -0
  20. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/tidyout/rules/find.yaml +0 -0
  21. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/tidyout/rules/git_log.yaml +0 -0
  22. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/tidyout/rules/git_status.yaml +0 -0
  23. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/tidyout/rules/jest.yaml +0 -0
  24. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/tidyout/rules/ls.yaml +0 -0
  25. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/tidyout/rules/make.yaml +0 -0
  26. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/tidyout/rules/npm_install.yaml +0 -0
  27. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/tidyout/rules/pip_install.yaml +0 -0
  28. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/tidyout/rules/pytest.yaml +0 -0
  29. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/tidyout/rules/tree.yaml +0 -0
  30. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/tidyout/runner.py +0 -0
  31. {tidyout_cli-0.1.0 → tidyout_cli-0.2.0}/tidyout/stripper.py +0 -0
@@ -0,0 +1,15 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(python3 -m pip show tidyout-cli)",
5
+ "Bash(python3 -m pip show -f tidyout-cli)",
6
+ "Read(//Users/sathishkumar/Library/Python/3.9/bin/**)",
7
+ "Bash(python3 -c \"import site; print\\(site.USER_BASE\\)\")",
8
+ "Bash(python3 -)",
9
+ "Bash(python3 -m pip uninstall -y tidyout-cli)",
10
+ "Bash(python3 -m pip install --user .)",
11
+ "Bash(python3 -m pytest -q)",
12
+ "Bash(python3 -m pip install --user -q pytest)"
13
+ ]
14
+ }
15
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tidyout-cli
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: CLI wrapper that compresses command output for AI agents, reducing token usage by 60-97%
5
5
  License: MIT
6
6
  Keywords: ai,cli,compression,developer-tools,tokens
@@ -23,7 +23,7 @@ Description-Content-Type: text/markdown
23
23
 
24
24
  # tidyout
25
25
 
26
- A CLI wrapper that sits between you (or your AI agent) and the terminal. Prefix any command with `tidy` and tidyout executes it, strips the noise, and returns a compressed version with a token savings summary.
26
+ A CLI wrapper that sits between you (or your AI agent) and the terminal. Prefix any command with `tidyout` and tidyout executes it, strips the noise, and returns a compressed version with a token savings summary.
27
27
 
28
28
  ```
29
29
  ✂️ tidyout: 312 lines → 18 lines | saved ~2376 tokens (94% reduction)
@@ -40,14 +40,14 @@ pip install tidyout-cli
40
40
  ## Usage
41
41
 
42
42
  ```bash
43
- tidy pytest tests/
44
- tidy git status
45
- tidy git log
46
- tidy ls -la
47
- tidy find . -name "*.py"
48
- tidy docker logs mycontainer
49
- tidy npm install
50
- tidy cargo build
43
+ tidyout pytest tests/
44
+ tidyout git status
45
+ tidyout git log
46
+ tidyout ls -la
47
+ tidyout find . -name "*.py"
48
+ tidyout docker logs mycontainer
49
+ tidyout npm install
50
+ tidyout cargo build
51
51
  ```
52
52
 
53
53
  Every run ends with a summary line:
@@ -76,25 +76,28 @@ Commands without a matching rule pass through unchanged and still show the summa
76
76
  | `make` | Entering/Leaving directory noise | ~40% |
77
77
  | `cargo build` | dependency Compiling lines, Downloading | ~75% |
78
78
 
79
- ## `tidy init` — inject rules into your AI agent config
79
+ ## `tidyout init` — inject rules into your AI agent config
80
80
 
81
- Running `tidy init` in your project directory automatically tells your AI agent to always use `tidy`:
81
+ Running `tidyout init` in your project directory automatically tells your AI agent to always use `tidyout`:
82
82
 
83
83
  ```bash
84
- tidy init
84
+ tidyout init
85
85
  ```
86
86
 
87
- It detects which config file to update:
87
+ It writes to **all** major AI agent config files at once — creating missing ones and appending to existing ones:
88
88
 
89
- - `CLAUDE.md` exists appends tidyout usage rules
90
- - `.cursorrules` exists → appends tidyout usage rules
91
- - Neither exists → creates `CLAUDE.md` with the rules
89
+ | File | AI tool |
90
+ |---|---|
91
+ | `CLAUDE.md` | Claude Code |
92
+ | `.cursorrules` | Cursor |
93
+ | `.windsurfrules` | Windsurf |
94
+ | `.github/copilot-instructions.md` | GitHub Copilot |
92
95
 
93
96
  Injected block:
94
97
 
95
98
  ```markdown
96
99
  ## Token Optimization with tidyout
97
- Always prefix the following commands with `tidy` when running in terminal:
100
+ Always prefix the following commands with `tidyout` when running in terminal:
98
101
  pytest, npm test, jest, rspec, git status, git log, ls, find, tree,
99
102
  pip install, npm install, docker logs, docker ps, make, cargo build
100
103
  This reduces token usage by 60-97% on command outputs.
@@ -1,6 +1,6 @@
1
1
  # tidyout
2
2
 
3
- A CLI wrapper that sits between you (or your AI agent) and the terminal. Prefix any command with `tidy` and tidyout executes it, strips the noise, and returns a compressed version with a token savings summary.
3
+ A CLI wrapper that sits between you (or your AI agent) and the terminal. Prefix any command with `tidyout` and tidyout executes it, strips the noise, and returns a compressed version with a token savings summary.
4
4
 
5
5
  ```
6
6
  ✂️ tidyout: 312 lines → 18 lines | saved ~2376 tokens (94% reduction)
@@ -17,14 +17,14 @@ pip install tidyout-cli
17
17
  ## Usage
18
18
 
19
19
  ```bash
20
- tidy pytest tests/
21
- tidy git status
22
- tidy git log
23
- tidy ls -la
24
- tidy find . -name "*.py"
25
- tidy docker logs mycontainer
26
- tidy npm install
27
- tidy cargo build
20
+ tidyout pytest tests/
21
+ tidyout git status
22
+ tidyout git log
23
+ tidyout ls -la
24
+ tidyout find . -name "*.py"
25
+ tidyout docker logs mycontainer
26
+ tidyout npm install
27
+ tidyout cargo build
28
28
  ```
29
29
 
30
30
  Every run ends with a summary line:
@@ -53,25 +53,28 @@ Commands without a matching rule pass through unchanged and still show the summa
53
53
  | `make` | Entering/Leaving directory noise | ~40% |
54
54
  | `cargo build` | dependency Compiling lines, Downloading | ~75% |
55
55
 
56
- ## `tidy init` — inject rules into your AI agent config
56
+ ## `tidyout init` — inject rules into your AI agent config
57
57
 
58
- Running `tidy init` in your project directory automatically tells your AI agent to always use `tidy`:
58
+ Running `tidyout init` in your project directory automatically tells your AI agent to always use `tidyout`:
59
59
 
60
60
  ```bash
61
- tidy init
61
+ tidyout init
62
62
  ```
63
63
 
64
- It detects which config file to update:
64
+ It writes to **all** major AI agent config files at once — creating missing ones and appending to existing ones:
65
65
 
66
- - `CLAUDE.md` exists appends tidyout usage rules
67
- - `.cursorrules` exists → appends tidyout usage rules
68
- - Neither exists → creates `CLAUDE.md` with the rules
66
+ | File | AI tool |
67
+ |---|---|
68
+ | `CLAUDE.md` | Claude Code |
69
+ | `.cursorrules` | Cursor |
70
+ | `.windsurfrules` | Windsurf |
71
+ | `.github/copilot-instructions.md` | GitHub Copilot |
69
72
 
70
73
  Injected block:
71
74
 
72
75
  ```markdown
73
76
  ## Token Optimization with tidyout
74
- Always prefix the following commands with `tidy` when running in terminal:
77
+ Always prefix the following commands with `tidyout` when running in terminal:
75
78
  pytest, npm test, jest, rspec, git status, git log, ls, find, tree,
76
79
  pip install, npm install, docker logs, docker ps, make, cargo build
77
80
  This reduces token usage by 60-97% on command outputs.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "tidyout-cli"
7
- version = "0.1.0"
7
+ version = "0.2.0"
8
8
  description = "CLI wrapper that compresses command output for AI agents, reducing token usage by 60-97%"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -28,7 +28,7 @@ dependencies = [
28
28
  ]
29
29
 
30
30
  [project.scripts]
31
- tidy = "tidyout.cli:main"
31
+ tidyout = "tidyout.cli:main"
32
32
 
33
33
  [project.optional-dependencies]
34
34
  dev = [
@@ -0,0 +1,149 @@
1
+ import os
2
+ import pytest
3
+ from pathlib import Path
4
+
5
+ from tidyout.init_agent import run_init, TIDYOUT_BLOCK, AI_CONFIG_FILES
6
+
7
+
8
+ def _chdir(tmp_path):
9
+ orig = os.getcwd()
10
+ os.chdir(tmp_path)
11
+ return orig
12
+
13
+
14
+ # ---------------------------------------------------------------------------
15
+ # All files created when none exist
16
+ # ---------------------------------------------------------------------------
17
+
18
+ def test_init_creates_all_config_files_when_none_exist(tmp_path):
19
+ orig = _chdir(tmp_path)
20
+ try:
21
+ run_init()
22
+ for rel in AI_CONFIG_FILES:
23
+ path = tmp_path / rel
24
+ assert path.exists(), f"{rel} was not created"
25
+ assert "tidyout" in path.read_text()
26
+ finally:
27
+ os.chdir(orig)
28
+
29
+
30
+ def test_init_all_files_contain_key_commands(tmp_path):
31
+ orig = _chdir(tmp_path)
32
+ try:
33
+ run_init()
34
+ for rel in AI_CONFIG_FILES:
35
+ content = (tmp_path / rel).read_text()
36
+ for cmd in ["pytest", "git status", "git log", "docker logs", "npm install"]:
37
+ assert cmd in content, f"{cmd} missing from {rel}"
38
+ finally:
39
+ os.chdir(orig)
40
+
41
+
42
+ # ---------------------------------------------------------------------------
43
+ # Append to existing files, create missing ones
44
+ # ---------------------------------------------------------------------------
45
+
46
+ def test_init_appends_to_existing_claude_md(tmp_path):
47
+ orig = _chdir(tmp_path)
48
+ try:
49
+ claude_md = tmp_path / "CLAUDE.md"
50
+ claude_md.write_text("# Existing content\n")
51
+ run_init()
52
+ content = claude_md.read_text()
53
+ assert "# Existing content" in content
54
+ assert "tidyout" in content
55
+ finally:
56
+ os.chdir(orig)
57
+
58
+
59
+ def test_init_appends_to_existing_cursorrules(tmp_path):
60
+ orig = _chdir(tmp_path)
61
+ try:
62
+ cursorrules = tmp_path / ".cursorrules"
63
+ cursorrules.write_text("# Existing cursor rules\n")
64
+ run_init()
65
+ content = cursorrules.read_text()
66
+ assert "# Existing cursor rules" in content
67
+ assert "tidyout" in content
68
+ finally:
69
+ os.chdir(orig)
70
+
71
+
72
+ def test_init_appends_to_existing_windsurfrules(tmp_path):
73
+ orig = _chdir(tmp_path)
74
+ try:
75
+ windsurfrules = tmp_path / ".windsurfrules"
76
+ windsurfrules.write_text("# Windsurf config\n")
77
+ run_init()
78
+ content = windsurfrules.read_text()
79
+ assert "# Windsurf config" in content
80
+ assert "tidyout" in content
81
+ finally:
82
+ os.chdir(orig)
83
+
84
+
85
+ def test_init_appends_to_existing_copilot_instructions(tmp_path):
86
+ orig = _chdir(tmp_path)
87
+ try:
88
+ copilot = tmp_path / ".github" / "copilot-instructions.md"
89
+ copilot.parent.mkdir()
90
+ copilot.write_text("# Copilot instructions\n")
91
+ run_init()
92
+ content = copilot.read_text()
93
+ assert "# Copilot instructions" in content
94
+ assert "tidyout" in content
95
+ finally:
96
+ os.chdir(orig)
97
+
98
+
99
+ def test_init_creates_github_dir_for_copilot(tmp_path):
100
+ orig = _chdir(tmp_path)
101
+ try:
102
+ run_init()
103
+ copilot = tmp_path / ".github" / "copilot-instructions.md"
104
+ assert copilot.exists()
105
+ finally:
106
+ os.chdir(orig)
107
+
108
+
109
+ # ---------------------------------------------------------------------------
110
+ # Mixed: some files exist, some don't
111
+ # ---------------------------------------------------------------------------
112
+
113
+ def test_init_writes_to_all_files_regardless_of_which_exist(tmp_path):
114
+ orig = _chdir(tmp_path)
115
+ try:
116
+ # Pre-create only CLAUDE.md
117
+ (tmp_path / "CLAUDE.md").write_text("# Claude\n")
118
+ run_init()
119
+ for rel in AI_CONFIG_FILES:
120
+ path = tmp_path / rel
121
+ assert path.exists(), f"{rel} should exist after init"
122
+ assert "tidyout" in path.read_text()
123
+ finally:
124
+ os.chdir(orig)
125
+
126
+
127
+ # ---------------------------------------------------------------------------
128
+ # Output messages
129
+ # ---------------------------------------------------------------------------
130
+
131
+ def test_init_prints_created_for_new_files(tmp_path, capsys):
132
+ orig = _chdir(tmp_path)
133
+ try:
134
+ run_init()
135
+ out = capsys.readouterr().out
136
+ assert "created" in out
137
+ finally:
138
+ os.chdir(orig)
139
+
140
+
141
+ def test_init_prints_appended_for_existing_files(tmp_path, capsys):
142
+ orig = _chdir(tmp_path)
143
+ try:
144
+ (tmp_path / "CLAUDE.md").write_text("# Existing\n")
145
+ run_init()
146
+ out = capsys.readouterr().out
147
+ assert "appended" in out
148
+ finally:
149
+ os.chdir(orig)
@@ -0,0 +1 @@
1
+ __version__ = "0.1.1"
@@ -9,8 +9,8 @@ def main():
9
9
  args = sys.argv[1:]
10
10
 
11
11
  if not args:
12
- print("Usage: tidy <command> [args...]")
13
- print(" tidy init")
12
+ print("Usage: tidyout <command> [args...]")
13
+ print(" tidyout init")
14
14
  sys.exit(1)
15
15
 
16
16
  if args[0] == "init":
@@ -0,0 +1,34 @@
1
+ from pathlib import Path
2
+
3
+ TIDYOUT_BLOCK = """
4
+ ## Token Optimization with tidyout
5
+ Always prefix the following commands with `tidyout` when running in terminal:
6
+ pytest, npm test, jest, rspec, git status, git log, ls, find, tree,
7
+ pip install, npm install, docker logs, docker ps, make, cargo build
8
+ This reduces token usage by 60-97% on command outputs.
9
+ """
10
+
11
+ # All major AI IDE / agent config files
12
+ AI_CONFIG_FILES = [
13
+ "CLAUDE.md", # Claude Code
14
+ ".cursorrules", # Cursor
15
+ ".windsurfrules", # Windsurf
16
+ ".github/copilot-instructions.md", # GitHub Copilot
17
+ ]
18
+
19
+
20
+ def run_init():
21
+ cwd = Path.cwd()
22
+
23
+ for rel_path in AI_CONFIG_FILES:
24
+ target = cwd / rel_path
25
+ target.parent.mkdir(parents=True, exist_ok=True)
26
+
27
+ if target.exists():
28
+ with open(target, "a") as f:
29
+ f.write(TIDYOUT_BLOCK)
30
+ print(f" appended → {rel_path}")
31
+ else:
32
+ with open(target, "w") as f:
33
+ f.write(TIDYOUT_BLOCK.lstrip())
34
+ print(f" created → {rel_path}")
@@ -1,98 +0,0 @@
1
- import os
2
- import pytest
3
- from pathlib import Path
4
-
5
- from tidyout.init_agent import run_init, TIDYOUT_BLOCK
6
-
7
-
8
- def test_init_creates_claude_md_when_neither_exists(tmp_path):
9
- orig = os.getcwd()
10
- os.chdir(tmp_path)
11
- try:
12
- run_init()
13
- claude_md = tmp_path / "CLAUDE.md"
14
- assert claude_md.exists()
15
- content = claude_md.read_text()
16
- assert "tidyout" in content
17
- assert "tidy" in content
18
- finally:
19
- os.chdir(orig)
20
-
21
-
22
- def test_init_appends_to_existing_claude_md(tmp_path):
23
- orig = os.getcwd()
24
- os.chdir(tmp_path)
25
- try:
26
- claude_md = tmp_path / "CLAUDE.md"
27
- claude_md.write_text("# Existing content\n")
28
- run_init()
29
- content = claude_md.read_text()
30
- assert "# Existing content" in content
31
- assert "tidyout" in content
32
- finally:
33
- os.chdir(orig)
34
-
35
-
36
- def test_init_does_not_create_new_claude_md_when_cursorrules_exists(tmp_path):
37
- orig = os.getcwd()
38
- os.chdir(tmp_path)
39
- try:
40
- cursorrules = tmp_path / ".cursorrules"
41
- cursorrules.write_text("# Cursor rules\n")
42
- run_init()
43
- assert not (tmp_path / "CLAUDE.md").exists()
44
- assert "tidyout" in cursorrules.read_text()
45
- finally:
46
- os.chdir(orig)
47
-
48
-
49
- def test_init_appends_to_cursorrules(tmp_path):
50
- orig = os.getcwd()
51
- os.chdir(tmp_path)
52
- try:
53
- cursorrules = tmp_path / ".cursorrules"
54
- cursorrules.write_text("# Cursor rules\n")
55
- run_init()
56
- content = cursorrules.read_text()
57
- assert "# Cursor rules" in content
58
- assert "tidyout" in content
59
- finally:
60
- os.chdir(orig)
61
-
62
-
63
- def test_init_prefers_claude_md_over_cursorrules(tmp_path):
64
- orig = os.getcwd()
65
- os.chdir(tmp_path)
66
- try:
67
- claude_md = tmp_path / "CLAUDE.md"
68
- cursorrules = tmp_path / ".cursorrules"
69
- claude_md.write_text("# Claude\n")
70
- cursorrules.write_text("# Cursor\n")
71
- run_init()
72
- assert "tidyout" in claude_md.read_text()
73
- assert "tidyout" not in cursorrules.read_text()
74
- finally:
75
- os.chdir(orig)
76
-
77
-
78
- def test_init_block_contains_key_commands(tmp_path):
79
- orig = os.getcwd()
80
- os.chdir(tmp_path)
81
- try:
82
- run_init()
83
- content = (tmp_path / "CLAUDE.md").read_text()
84
- for cmd in ["pytest", "git status", "git log", "docker logs", "npm install"]:
85
- assert cmd in content
86
- finally:
87
- os.chdir(orig)
88
-
89
-
90
- def test_init_prints_action(tmp_path, capsys):
91
- orig = os.getcwd()
92
- os.chdir(tmp_path)
93
- try:
94
- run_init()
95
- out = capsys.readouterr().out
96
- assert "CLAUDE.md" in out
97
- finally:
98
- os.chdir(orig)
@@ -1 +0,0 @@
1
- __version__ = "0.1.0"
@@ -1,28 +0,0 @@
1
- from pathlib import Path
2
-
3
- TIDYOUT_BLOCK = """
4
- ## Token Optimization with tidyout
5
- Always prefix the following commands with `tidy` when running in terminal:
6
- pytest, npm test, jest, rspec, git status, git log, ls, find, tree,
7
- pip install, npm install, docker logs, docker ps, make, cargo build
8
- This reduces token usage by 60-97% on command outputs.
9
- """
10
-
11
-
12
- def run_init():
13
- cwd = Path.cwd()
14
- claude_md = cwd / "CLAUDE.md"
15
- cursorrules = cwd / ".cursorrules"
16
-
17
- if claude_md.exists():
18
- with open(claude_md, "a") as f:
19
- f.write(TIDYOUT_BLOCK)
20
- print(f"Appended tidyout rules to {claude_md}")
21
- elif cursorrules.exists():
22
- with open(cursorrules, "a") as f:
23
- f.write(TIDYOUT_BLOCK)
24
- print(f"Appended tidyout rules to {cursorrules}")
25
- else:
26
- with open(claude_md, "w") as f:
27
- f.write(TIDYOUT_BLOCK.lstrip())
28
- print(f"Created {claude_md} with tidyout rules")
File without changes
File without changes