codigest 0.4.0__tar.gz → 0.4.1__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.
- {codigest-0.4.0 → codigest-0.4.1}/CITATION.cff +1 -1
- {codigest-0.4.0 → codigest-0.4.1}/PKG-INFO +1 -1
- {codigest-0.4.0 → codigest-0.4.1}/pyproject.toml +1 -1
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/commands/mcp.py +0 -1
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/commands/term.py +30 -7
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/main.py +8 -8
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/shell/hook.ps1 +5 -1
- {codigest-0.4.0 → codigest-0.4.1}/uv.lock +1 -1
- {codigest-0.4.0 → codigest-0.4.1}/.github/workflows/publish.yml +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/.gitignore +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/.python-version +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/LICENSE +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/README.md +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/__init__.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/__main__.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/commands/cap.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/commands/clean.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/commands/diff.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/commands/digest.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/commands/init.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/commands/scan.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/commands/semdiff.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/commands/status.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/commands/tree.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/config.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/core/cache.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/core/common.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/core/git_ops.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/core/output.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/core/processor.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/core/prompts.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/core/redact.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/core/resolver.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/core/runner.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/core/scanner.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/core/semdiff.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/core/shadow.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/core/shellhist.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/core/structure.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/core/tags.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/core/termstore.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/core/tokenizer.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/src/codigest/options.py +0 -0
- {codigest-0.4.0 → codigest-0.4.1}/tests/test_termstore.py +0 -0
|
@@ -97,7 +97,6 @@ def _cli(command: str, args: JSON) -> str:
|
|
|
97
97
|
argv.append("-r")
|
|
98
98
|
if message := args.get("message"):
|
|
99
99
|
argv += ["-m", message]
|
|
100
|
-
# Options before positionals: Typer group callbacks require that order.
|
|
101
100
|
match command:
|
|
102
101
|
case "scan":
|
|
103
102
|
argv += [str(t) for t in args.get("targets") or []] or ([args["path"]] if "path" in args else [])
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"""
|
|
2
2
|
`cdg term` -- recall recent terminal commands (and their output) as LLM context.
|
|
3
3
|
"""
|
|
4
|
+
import os
|
|
4
5
|
import sys
|
|
6
|
+
import traceback
|
|
5
7
|
from pathlib import Path
|
|
6
8
|
from typing import Annotated
|
|
7
9
|
|
|
@@ -99,13 +101,10 @@ def handle(
|
|
|
99
101
|
f"[yellow][Warning][/yellow] No Codigest captures found; "
|
|
100
102
|
f"falling back to {shell} history [dim](commands only, no output)[/dim]"
|
|
101
103
|
)
|
|
102
|
-
log
|
|
103
|
-
"[dim]Capture output with `cdg term install` (PowerShell) "
|
|
104
|
-
"or `cdg cap -- <command>`.[/dim]"
|
|
105
|
-
)
|
|
104
|
+
_diagnose(log)
|
|
106
105
|
else:
|
|
107
106
|
log.print("[yellow]No terminal history available.[/yellow]")
|
|
108
|
-
log
|
|
107
|
+
_diagnose(log)
|
|
109
108
|
raise typer.Exit(code=1)
|
|
110
109
|
|
|
111
110
|
if failed:
|
|
@@ -138,6 +137,7 @@ def clear() -> None:
|
|
|
138
137
|
"""Delete all stored terminal captures."""
|
|
139
138
|
console = Console()
|
|
140
139
|
removed = termstore.clear()
|
|
140
|
+
(termstore.get_term_dir() / "ingest-errors.log").unlink(missing_ok=True)
|
|
141
141
|
console.print(f"[green]Cleared[/green] {removed} captured entries.")
|
|
142
142
|
|
|
143
143
|
|
|
@@ -151,8 +151,31 @@ def path() -> None:
|
|
|
151
151
|
@app.command("ingest", hidden=True)
|
|
152
152
|
def ingest() -> None:
|
|
153
153
|
"""Store one JSON entry from stdin (called by the shell hook)."""
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
try:
|
|
155
|
+
data = json.loads(sys.stdin.buffer.read().decode("utf-8-sig"))
|
|
156
|
+
termstore.append_entry(termstore.Entry.from_dict(data))
|
|
157
|
+
except Exception:
|
|
158
|
+
# The hook discards our stderr; leave a trail `cdg term` can surface.
|
|
159
|
+
with _ingest_log().open("a", encoding="utf-8") as f:
|
|
160
|
+
f.write(f"--- {termstore.now_iso()}\n{traceback.format_exc()}")
|
|
161
|
+
raise typer.Exit(code=1)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def _ingest_log() -> Path:
|
|
165
|
+
termstore.get_term_dir().mkdir(parents=True, exist_ok=True)
|
|
166
|
+
return termstore.get_term_dir() / "ingest-errors.log"
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def _diagnose(log) -> None:
|
|
170
|
+
"""Explains why nothing was captured instead of failing silently."""
|
|
171
|
+
if not os.environ.get("CODIGEST_HOOK"):
|
|
172
|
+
log.print(
|
|
173
|
+
"[dim]Capture hook is not active in this shell. Run `cdg term install` "
|
|
174
|
+
"and open a new window, or enable it now with:[/dim]"
|
|
175
|
+
)
|
|
176
|
+
log.print(f"[dim] . '{HOOK_PATH}'[/dim]", highlight=False)
|
|
177
|
+
if (errors := termstore.get_term_dir() / "ingest-errors.log").exists():
|
|
178
|
+
log.print(f"[red]Capture errors were logged:[/red] {errors}", highlight=False)
|
|
156
179
|
|
|
157
180
|
|
|
158
181
|
# --------------------------------------------------------------------------
|
|
@@ -19,14 +19,14 @@ app = typer.Typer(
|
|
|
19
19
|
no_args_is_help=True
|
|
20
20
|
)
|
|
21
21
|
|
|
22
|
-
app.
|
|
23
|
-
app.
|
|
24
|
-
app.
|
|
25
|
-
app.
|
|
26
|
-
app.
|
|
27
|
-
app.
|
|
28
|
-
app.
|
|
29
|
-
app.
|
|
22
|
+
app.command(name="init")(init.handle)
|
|
23
|
+
app.command(name="status")(status.handle)
|
|
24
|
+
app.command(name="clean")(clean.handle)
|
|
25
|
+
app.command(name="scan")(scan.handle)
|
|
26
|
+
app.command(name="tree")(tree.handle)
|
|
27
|
+
app.command(name="digest")(digest.handle)
|
|
28
|
+
app.command(name="diff")(diff.handle)
|
|
29
|
+
app.command(name="semdiff")(semdiff.handle)
|
|
30
30
|
app.add_typer(term.app, name="term")
|
|
31
31
|
|
|
32
32
|
# `cap` is a plain command, not a group: its first argument is the wrapped
|
|
@@ -76,7 +76,8 @@ if (-not (Get-Module PSReadLine)) { return }
|
|
|
76
76
|
|
|
77
77
|
# ponytail: denylist heuristic for programs that need a real TTY (editors, pagers,
|
|
78
78
|
# REPLs, ssh). Extend with $env:CODIGEST_CAP_SKIP (a regex) when one slips through.
|
|
79
|
-
$global:__cdgSkip = '^\s*(vim?|nvim|nano|emacs|less|more|ssh|htop|btop|top|fzf|lazygit|claude|codex|wsl|
|
|
79
|
+
$global:__cdgSkip = '^\s*(vim?|nvim|nano|emacs|less|more|ssh|htop|btop|top|fzf|lazygit|claude|codex|wsl|exit)(\.exe)?\b' +
|
|
80
|
+
'|^\s*(cdg|codigest)(\.exe)?\s+(term|mcp)\b' +
|
|
80
81
|
'|^\s*(python3?|py|ipython|node|pwsh|powershell|bash|cmd)(\.exe)?\s*$' +
|
|
81
82
|
'|^\s*git\s+(commit(?!.*\s-\w*[mF])|rebase\s+-i|add\s+-[pi]|mergetool)'
|
|
82
83
|
|
|
@@ -114,3 +115,6 @@ Set-PSReadLineOption -AddToHistoryHandler {
|
|
|
114
115
|
if ($global:__cdgPrevHistHandler) { return $global:__cdgPrevHistHandler.Invoke($l) }
|
|
115
116
|
return $true
|
|
116
117
|
}
|
|
118
|
+
|
|
119
|
+
# Lets `cdg term` tell whether this shell is hooked.
|
|
120
|
+
$env:CODIGEST_HOOK = '1'
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|