kompactor 0.7.2__tar.gz → 0.7.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.
Files changed (42) hide show
  1. {kompactor-0.7.2 → kompactor-0.7.3}/PKG-INFO +4 -4
  2. {kompactor-0.7.2 → kompactor-0.7.3}/README.md +3 -3
  3. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/__init__.py +1 -1
  4. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/cli.py +1 -1
  5. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/installer.py +6 -49
  6. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/static/usage.html +1 -1
  7. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor.egg-info/PKG-INFO +4 -4
  8. {kompactor-0.7.2 → kompactor-0.7.3}/pyproject.toml +1 -1
  9. {kompactor-0.7.2 → kompactor-0.7.3}/tests/test_kompactor.py +8 -25
  10. {kompactor-0.7.2 → kompactor-0.7.3}/LICENSE +0 -0
  11. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/__main__.py +0 -0
  12. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/_launch.py +0 -0
  13. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/config.py +0 -0
  14. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/estimate.py +0 -0
  15. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/filters.py +0 -0
  16. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/graph.py +0 -0
  17. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/hooks.py +0 -0
  18. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/langs.py +0 -0
  19. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/outline.py +0 -0
  20. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/prove.py +0 -0
  21. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/rules.py +0 -0
  22. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/samples.py +0 -0
  23. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/server.py +0 -0
  24. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/shellwrap.py +0 -0
  25. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/static/fonts/OFL.txt +0 -0
  26. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/static/fonts/plex-mono-400.woff2 +0 -0
  27. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/static/fonts/plex-mono-500.woff2 +0 -0
  28. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/static/fonts/plex-sans-400.woff2 +0 -0
  29. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/static/fonts/plex-sans-500.woff2 +0 -0
  30. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/static/fonts/plex-sans-600.woff2 +0 -0
  31. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/static/logo-mark.svg +0 -0
  32. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/store.py +0 -0
  33. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/tokens.py +0 -0
  34. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor/ui.html +0 -0
  35. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor.egg-info/SOURCES.txt +0 -0
  36. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor.egg-info/dependency_links.txt +0 -0
  37. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor.egg-info/entry_points.txt +0 -0
  38. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor.egg-info/requires.txt +0 -0
  39. {kompactor-0.7.2 → kompactor-0.7.3}/kompactor.egg-info/top_level.txt +0 -0
  40. {kompactor-0.7.2 → kompactor-0.7.3}/setup.cfg +0 -0
  41. {kompactor-0.7.2 → kompactor-0.7.3}/tests/test_graph.py +0 -0
  42. {kompactor-0.7.2 → kompactor-0.7.3}/tests/test_shell.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kompactor
3
- Version: 0.7.2
3
+ Version: 0.7.3
4
4
  Summary: Cut the tokens Claude Code spends on noise: compacted command output (failing runs included), outline-first reads, a local code graph, and per-turn savings.
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://github.com/amarkum/kompactor
@@ -59,7 +59,7 @@ pipx install kompactor # or: pip install kompactor · uv tool install kom
59
59
  kompactor setup
60
60
  ```
61
61
 
62
- **VS Code.** Download `kompactor-0.7.2.vsix` from [Releases](https://github.com/amarkum/kompactor/releases), install it (Extensions › `⋯` › *Install from VSIX…*), and click **Enable** when Kompactor asks.
62
+ **VS Code.** Download `kompactor-0.7.3.vsix` from [Releases](https://github.com/amarkum/kompactor/releases), install it (Extensions › `⋯` › *Install from VSIX…*), and click **Enable** when Kompactor asks.
63
63
 
64
64
  ## After you install
65
65
 
@@ -67,7 +67,7 @@ kompactor setup
67
67
  2. **Work as usual.** You don't call Kompactor; it acts on Claude's tool calls by itself. After each reply you'll see a line such as `Kompactor: −8.2k tokens this turn`, and the status line shows the running total.
68
68
  3. **Check it's on:** run `kompactor` in a terminal (or `/kompactor` in Claude Code). It shows whether it's on, your level, savings so far and how to change things:
69
69
  ```
70
- Kompactor 0.7.2: ON
70
+ Kompactor 0.7.3: ON
71
71
  Connected via the Claude Code plugin. New Claude Code sessions are compacted.
72
72
  Level: Balanced (level 3 of 5). Change it: `kompactor config preset 1-5`, the dashboard, or /kompactor balanced
73
73
  Saved so far: 41.3k tokens (−38%) over 52 tool calls. Details: `kompactor gain`
@@ -239,7 +239,7 @@ kompactor ui the dashboard, in the foreground
239
239
  ## Development
240
240
 
241
241
  ```bash
242
- python -m unittest discover tests # 82 tests, including the real shell prefix run as Claude Code runs it
242
+ python -m unittest discover tests # 81 tests, including the real shell prefix run as Claude Code runs it
243
243
  node vscode/test/smoke.js # VS Code extension against a mock API
244
244
  ./scripts/build-vsix.sh # › dist/kompactor-<version>.vsix
245
245
  python scripts/bump_version.py X.Y.Z # bump every version; pushing to main publishes to PyPI
@@ -37,7 +37,7 @@ pipx install kompactor # or: pip install kompactor · uv tool install kom
37
37
  kompactor setup
38
38
  ```
39
39
 
40
- **VS Code.** Download `kompactor-0.7.2.vsix` from [Releases](https://github.com/amarkum/kompactor/releases), install it (Extensions › `⋯` › *Install from VSIX…*), and click **Enable** when Kompactor asks.
40
+ **VS Code.** Download `kompactor-0.7.3.vsix` from [Releases](https://github.com/amarkum/kompactor/releases), install it (Extensions › `⋯` › *Install from VSIX…*), and click **Enable** when Kompactor asks.
41
41
 
42
42
  ## After you install
43
43
 
@@ -45,7 +45,7 @@ kompactor setup
45
45
  2. **Work as usual.** You don't call Kompactor; it acts on Claude's tool calls by itself. After each reply you'll see a line such as `Kompactor: −8.2k tokens this turn`, and the status line shows the running total.
46
46
  3. **Check it's on:** run `kompactor` in a terminal (or `/kompactor` in Claude Code). It shows whether it's on, your level, savings so far and how to change things:
47
47
  ```
48
- Kompactor 0.7.2: ON
48
+ Kompactor 0.7.3: ON
49
49
  Connected via the Claude Code plugin. New Claude Code sessions are compacted.
50
50
  Level: Balanced (level 3 of 5). Change it: `kompactor config preset 1-5`, the dashboard, or /kompactor balanced
51
51
  Saved so far: 41.3k tokens (−38%) over 52 tool calls. Details: `kompactor gain`
@@ -217,7 +217,7 @@ kompactor ui the dashboard, in the foreground
217
217
  ## Development
218
218
 
219
219
  ```bash
220
- python -m unittest discover tests # 82 tests, including the real shell prefix run as Claude Code runs it
220
+ python -m unittest discover tests # 81 tests, including the real shell prefix run as Claude Code runs it
221
221
  node vscode/test/smoke.js # VS Code extension against a mock API
222
222
  ./scripts/build-vsix.sh # › dist/kompactor-<version>.vsix
223
223
  python scripts/bump_version.py X.Y.Z # bump every version; pushing to main publishes to PyPI
@@ -1,3 +1,3 @@
1
1
  """Kompactor: cut the tokens Claude Code spends on noise."""
2
2
 
3
- __version__ = "0.7.2"
3
+ __version__ = "0.7.3"
@@ -459,7 +459,7 @@ def cmd_presets(a):
459
459
 
460
460
  def cmd_doctor(a):
461
461
  print(f"kompactor {__version__} python {sys.version.split()[0]} home {store.home()}")
462
- print(f"tokenizer: {'tiktoken' if tokens._ENC else 'heuristic (pip install tiktoken for exact counts)'}")
462
+ print(f"tokenizer: {'tiktoken' if tokens._ENC else 'heuristic (for exact counts, add the optional tiktoken package)'}")
463
463
  with store.connect() as db:
464
464
  print(f"sqlite fts5: {'yes' if db.fts else 'no (search falls back to LIKE)'}")
465
465
  st = installer.status()
@@ -104,7 +104,7 @@ def cli_name() -> str:
104
104
  return launcher()
105
105
 
106
106
 
107
- SOURCE_FILE = ".kompactor-source" # written by install.sh / install.ps1: the repo this copy came from
107
+ DEFAULT_REPO = "https://github.com/amarkum/kompactor"
108
108
 
109
109
 
110
110
  def parse_source(url: str) -> dict:
@@ -123,57 +123,14 @@ def parse_source(url: str) -> dict:
123
123
 
124
124
 
125
125
  def source() -> dict:
126
- """Where this copy of Kompactor came from (your team's repo), so setup instructions can name it.
127
- Read from the file the installers leave, the git remote of a clone, the marketplace of a plugin
128
- install, or the URL pip, pipx and uv record for an install from git."""
129
- import subprocess
130
- root = Path(__file__).resolve().parent.parent
131
- try:
132
- if (root / SOURCE_FILE).exists():
133
- url = (root / SOURCE_FILE).read_text().strip()
134
- else:
135
- url = _git_remote(root) or _plugin_source(root) or _pip_source(root)
136
- except (OSError, subprocess.SubprocessError):
137
- url = ""
126
+ """The repo the dashboard's setup instructions name: Kompactor's public repo, or a team's fork set
127
+ with KOMPACTOR_REPO (owner/repo or a git URL). Nothing is read from git or install records."""
128
+ url = os.environ.get("KOMPACTOR_REPO", "").strip() or DEFAULT_REPO
129
+ if re.fullmatch(r"[\w.-]+/[\w.-]+", url):
130
+ url = f"https://github.com/{url}"
138
131
  return parse_source(url)
139
132
 
140
133
 
141
- def _git_remote(path: Path) -> str:
142
- import subprocess
143
- if not (path / ".git").exists(): # not a parent repo's remote (a venv inside a project)
144
- return ""
145
- return subprocess.run(["git", "-C", str(path), "remote", "get-url", "origin"], capture_output=True,
146
- text=True, timeout=3).stdout.strip()
147
-
148
-
149
- def _plugin_source(root: Path) -> str:
150
- """Claude Code copies a plugin to plugins/cache/<marketplace>/<plugin>/<version>, without .git;
151
- the marketplace's source is in plugins/known_marketplaces.json."""
152
- if len(root.parents) < 4 or root.parents[2].name != "cache":
153
- return ""
154
- entry = _read(root.parents[3] / "known_marketplaces.json").get(root.parents[1].name) or {}
155
- src = entry.get("source") or {}
156
- kind = src.get("source")
157
- if kind == "github" and src.get("repo"):
158
- return f"https://github.com/{src['repo']}"
159
- if kind == "git":
160
- return src.get("url", "")
161
- return _git_remote(Path(src["path"])) if kind == "directory" and src.get("path") else ""
162
-
163
-
164
- def _pip_source(root: Path) -> str:
165
- """The URL of `pip/pipx/uv install git+…` (PEP 610 direct_url.json), if this copy is that install."""
166
- from importlib import metadata
167
- try:
168
- dist = metadata.distribution("kompactor")
169
- if Path(str(dist.locate_file(""))).resolve() != root:
170
- return ""
171
- info = json.loads(dist.read_text("direct_url.json") or "{}")
172
- except (metadata.PackageNotFoundError, OSError, ValueError):
173
- return ""
174
- return info.get("url", "") if "vcs_info" in info else ""
175
-
176
-
177
134
  def _read(p: Path) -> dict:
178
135
  try:
179
136
  return json.loads(p.read_text())
@@ -139,7 +139,7 @@ svg.chev { width: 11px; height: 11px; stroke: var(--ink-3); fill: none; stroke-w
139
139
  <pre><code>pipx install kompactor
140
140
  kompactor setup</code></pre></div>
141
141
  <div class="card"><b>VS Code</b><span class="muted">Download the extension file from the repo's Releases page, then click <b>Enable</b> when Kompactor asks.</span>
142
- <pre><code>code --install-extension kompactor-0.7.2.vsix</code></pre></div>
142
+ <pre><code>code --install-extension kompactor-0.7.3.vsix</code></pre></div>
143
143
  </div>
144
144
  <p class="muted">Windows: run <code>.\kompactor\install.ps1</code> from a clone, or use the VS Code extension. The CLI and the VS Code extension read the same <code>~/.claude/settings.json</code>, so one install covers both. A backup of that file is kept as <code>settings.json.kompactor-backup</code>.</p>
145
145
  <p class="muted">Setup adds hooks, a status line (if you don't have one) and, on macOS and Linux, Claude Code's <code>CLAUDE_CODE_SHELL_PREFIX</code> setting pointing at <code>~/.kompactor/bin/kompactor-shell</code>, which is what lets Kompactor compact failing commands. It never replaces a status line or shell prefix you already have. Restart open Claude Code sessions after setup.</p>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kompactor
3
- Version: 0.7.2
3
+ Version: 0.7.3
4
4
  Summary: Cut the tokens Claude Code spends on noise: compacted command output (failing runs included), outline-first reads, a local code graph, and per-turn savings.
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://github.com/amarkum/kompactor
@@ -59,7 +59,7 @@ pipx install kompactor # or: pip install kompactor · uv tool install kom
59
59
  kompactor setup
60
60
  ```
61
61
 
62
- **VS Code.** Download `kompactor-0.7.2.vsix` from [Releases](https://github.com/amarkum/kompactor/releases), install it (Extensions › `⋯` › *Install from VSIX…*), and click **Enable** when Kompactor asks.
62
+ **VS Code.** Download `kompactor-0.7.3.vsix` from [Releases](https://github.com/amarkum/kompactor/releases), install it (Extensions › `⋯` › *Install from VSIX…*), and click **Enable** when Kompactor asks.
63
63
 
64
64
  ## After you install
65
65
 
@@ -67,7 +67,7 @@ kompactor setup
67
67
  2. **Work as usual.** You don't call Kompactor; it acts on Claude's tool calls by itself. After each reply you'll see a line such as `Kompactor: −8.2k tokens this turn`, and the status line shows the running total.
68
68
  3. **Check it's on:** run `kompactor` in a terminal (or `/kompactor` in Claude Code). It shows whether it's on, your level, savings so far and how to change things:
69
69
  ```
70
- Kompactor 0.7.2: ON
70
+ Kompactor 0.7.3: ON
71
71
  Connected via the Claude Code plugin. New Claude Code sessions are compacted.
72
72
  Level: Balanced (level 3 of 5). Change it: `kompactor config preset 1-5`, the dashboard, or /kompactor balanced
73
73
  Saved so far: 41.3k tokens (−38%) over 52 tool calls. Details: `kompactor gain`
@@ -239,7 +239,7 @@ kompactor ui the dashboard, in the foreground
239
239
  ## Development
240
240
 
241
241
  ```bash
242
- python -m unittest discover tests # 82 tests, including the real shell prefix run as Claude Code runs it
242
+ python -m unittest discover tests # 81 tests, including the real shell prefix run as Claude Code runs it
243
243
  node vscode/test/smoke.js # VS Code extension against a mock API
244
244
  ./scripts/build-vsix.sh # › dist/kompactor-<version>.vsix
245
245
  python scripts/bump_version.py X.Y.Z # bump every version; pushing to main publishes to PyPI
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "kompactor"
7
- version = "0.7.2"
7
+ version = "0.7.3"
8
8
  description = "Cut the tokens Claude Code spends on noise: compacted command output (failing runs included), outline-first reads, a local code graph, and per-turn savings."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -555,7 +555,7 @@ class TurnAndSetupTests(unittest.TestCase):
555
555
 
556
556
 
557
557
  class SourceTests(unittest.TestCase):
558
- """Each install names the repo it came from, so the dashboard can show teammates the right commands."""
558
+ """The dashboard shows teammates install commands for the public repo, or a fork named by KOMPACTOR_REPO."""
559
559
 
560
560
  def test_parse_source(self):
561
561
  self.assertEqual(installer.parse_source("https://ghp_secret@github.com/acme/kompactor.git"),
@@ -566,31 +566,14 @@ class SourceTests(unittest.TestCase):
566
566
  self.assertEqual(installer.parse_source(ssh)["clone"], ssh)
567
567
  self.assertEqual(installer.parse_source(""), {})
568
568
 
569
- def test_plugin_install_reads_its_marketplace(self):
570
- plugins = Path(tempfile.mkdtemp(), "plugins")
571
- root = plugins / "cache" / "acme-tools" / "kompactor" / "0.4.0"
572
- root.mkdir(parents=True)
573
- known = plugins / "known_marketplaces.json"
574
- for src, want in (({"source": "github", "repo": "acme/kompactor"}, "https://github.com/acme/kompactor"),
575
- ({"source": "git", "url": "https://git.acme.dev/kompactor.git"},
576
- "https://git.acme.dev/kompactor.git"),
577
- ({"source": "directory", "path": str(plugins)}, "")): # a folder that isn't a clone
578
- known.write_text(json.dumps({"acme-tools": {"source": src}}))
579
- self.assertEqual(installer._plugin_source(root), want)
580
- self.assertEqual(installer._plugin_source(plugins / "elsewhere" / "a" / "b" / "c"), "")
581
-
582
- def test_pip_install_from_git(self):
569
+ def test_source_defaults_to_the_public_repo(self):
583
570
  from unittest import mock
584
- root = Path(tempfile.mkdtemp()).resolve()
585
- dist = mock.Mock()
586
- dist.locate_file.return_value = root
587
- with mock.patch("importlib.metadata.distribution", return_value=dist):
588
- dist.read_text.return_value = json.dumps({"url": "https://github.com/acme/kompactor.git",
589
- "vcs_info": {"vcs": "git", "commit_id": "955ccd6"}})
590
- self.assertEqual(installer._pip_source(root), "https://github.com/acme/kompactor.git")
591
- self.assertEqual(installer._pip_source(root / "other"), "") # a different copy
592
- dist.read_text.return_value = json.dumps({"url": f"file://{root}", "dir_info": {"editable": True}})
593
- self.assertEqual(installer._pip_source(root), "")
571
+ with mock.patch.dict(os.environ, {"KOMPACTOR_REPO": ""}):
572
+ self.assertEqual(installer.source()["marketplace"], "amarkum/kompactor")
573
+ with mock.patch.dict(os.environ, {"KOMPACTOR_REPO": "acme/kompactor"}): # a team's fork
574
+ self.assertEqual(installer.source()["clone"], "https://github.com/acme/kompactor.git")
575
+ with mock.patch.dict(os.environ, {"KOMPACTOR_REPO": "https://ghp_x@git.acme.dev/tools/kompactor.git"}):
576
+ self.assertNotIn("ghp_x", json.dumps(installer.source()))
594
577
 
595
578
 
596
579
  if __name__ == "__main__":
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
File without changes
File without changes
File without changes
File without changes
File without changes