margin-cli 0.1.1__tar.gz → 0.1.2__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.
@@ -4,6 +4,12 @@ All notable changes to this package are documented here. The format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
5
5
  [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [0.1.2] - 2026-11-02
8
+
9
+ ### Security
10
+ - Warnings, errors and progress messages can no longer carry control characters or Rich markup
11
+ from a repository or a data file, which could rewrite what a terminal shows.
12
+
7
13
  ## [0.1.1] - 2026-10-29
8
14
 
9
15
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: margin-cli
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: The `margin` command: list, inspect and run margin agents from the terminal.
5
5
  Project-URL: Homepage, https://github.com/Waddah0-0/margin
6
6
  Project-URL: Source, https://github.com/Waddah0-0/margin/tree/main/packages/cli
@@ -19,7 +19,7 @@ Classifier: Programming Language :: Python :: 3.11
19
19
  Classifier: Programming Language :: Python :: 3.12
20
20
  Classifier: Typing :: Typed
21
21
  Requires-Python: >=3.11
22
- Requires-Dist: margin-core<0.2,>=0.1.2
22
+ Requires-Dist: margin-core<0.2,>=0.1.3
23
23
  Requires-Dist: rich>=13.7.0
24
24
  Requires-Dist: typer>=0.12.0
25
25
  Description-Content-Type: text/markdown
@@ -76,7 +76,7 @@ Giving the main field both ways, positionally and with `--set`, is an error.
76
76
  | `--strict` | Treat a partial result as a failure (exit code 4). |
77
77
 
78
78
  The model comes from your settings (environment variables, settings saved in the web UI, or
79
- `.env`), but nothing talks to a model unless the agent needs one. Agents that don't use a
79
+ the file named by `MARGIN_ENV_FILE`), but nothing talks to a model unless the agent needs one. Agents that don't use a
80
80
  model work even with no model server running. If you pass `--provider` or `--model`, that
81
81
  choice is checked before the run starts.
82
82
 
@@ -50,7 +50,7 @@ Giving the main field both ways, positionally and with `--set`, is an error.
50
50
  | `--strict` | Treat a partial result as a failure (exit code 4). |
51
51
 
52
52
  The model comes from your settings (environment variables, settings saved in the web UI, or
53
- `.env`), but nothing talks to a model unless the agent needs one. Agents that don't use a
53
+ the file named by `MARGIN_ENV_FILE`), but nothing talks to a model unless the agent needs one. Agents that don't use a
54
54
  model work even with no model server running. If you pass `--provider` or `--model`, that
55
55
  choice is checked before the run starts.
56
56
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "margin-cli"
3
- version = "0.1.1"
3
+ version = "0.1.2"
4
4
  description = "The `margin` command: list, inspect and run margin agents from the terminal."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -19,7 +19,7 @@ classifiers = [
19
19
  "Environment :: Console",
20
20
  ]
21
21
  dependencies = [
22
- "margin-core>=0.1.2,<0.2", # 0.1.2: questions (ctx.ask)
22
+ "margin-core>=0.1.3,<0.2", # 0.1.3: security fixes
23
23
  "typer>=0.12.0",
24
24
  "rich>=13.7.0",
25
25
  ]
@@ -1,3 +1,3 @@
1
1
  """CLI application for margin."""
2
2
 
3
- __version__ = "0.1.1"
3
+ __version__ = "0.1.2"
@@ -21,14 +21,20 @@ from margin_core import (
21
21
  from margin_core.config import Settings
22
22
  from margin_core.errors import LLMError
23
23
  from margin_core.llm import LLMClient, create_llm
24
+ from margin_core.reporting import strip_control
24
25
  from pydantic import BaseModel
25
26
  from rich.console import Console
26
- from rich.markup import escape
27
+ from rich.markup import escape as escape_markup
27
28
 
28
29
  CANCEL_GRACE_S = 5.0
29
30
  """How long a cancelled agent gets to stop on its own before its task is cancelled."""
30
31
 
31
32
 
33
+ def escape(text: str) -> str:
34
+ """Text from a run, safe to print: agents quote file names, commit messages and cells."""
35
+ return escape_markup(strip_control(text))
36
+
37
+
32
38
  class ExplicitLLMError(Exception):
33
39
  """The user asked for a specific provider or model, and it cannot be set up."""
34
40
 
@@ -98,7 +104,7 @@ class ProgressDisplay:
98
104
  def update(self, event: ProgressEvent) -> None:
99
105
  text = f"{self._agent_name}: {event.stage}"
100
106
  if event.message:
101
- text += f" - {event.message}"
107
+ text += f" - {escape(event.message)}"
102
108
  if event.fraction is not None:
103
109
  text += f" ({event.fraction:.0%})"
104
110
  if self._status is not None:
@@ -49,6 +49,7 @@ from margin_cli.execution import (
49
49
  ExplicitLLMError,
50
50
  ProgressDisplay,
51
51
  TerminalQuestions,
52
+ escape,
52
53
  execute_cancellable,
53
54
  make_llm,
54
55
  )
@@ -279,9 +280,9 @@ def run_agent(
279
280
  else:
280
281
  typer.echo(report, nl=False)
281
282
  for warning in result.warnings:
282
- stderr.print(f"[yellow]Warning:[/] {warning}", highlight=False)
283
+ stderr.print(f"[yellow]Warning:[/] {escape(warning)}", highlight=False)
283
284
  if result.status == "error":
284
- stderr.print(f"[bold red]Run failed:[/] {result.error}", highlight=False)
285
+ stderr.print(f"[bold red]Run failed:[/] {escape(result.error or '')}", highlight=False)
285
286
  else:
286
287
  stderr.print("[yellow]Cancelled.[/]")
287
288
  raise typer.Exit(int(_exit_code(result, cancelled, strict)))
File without changes
File without changes
File without changes