langstage-cli 0.6.57__tar.gz → 0.6.58__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.
- {langstage_cli-0.6.57/langstage_cli.egg-info → langstage_cli-0.6.58}/PKG-INFO +1 -1
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/langstage_cli/cli.py +32 -2
- {langstage_cli-0.6.57 → langstage_cli-0.6.58/langstage_cli.egg-info}/PKG-INFO +1 -1
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/langstage_cli.egg-info/SOURCES.txt +1 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/pyproject.toml +1 -1
- langstage_cli-0.6.58/tests/test_show_config_bare_spec_213.py +82 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/LICENSE +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/README.md +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/deepagent_code/__init__.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/langstage_cli/__init__.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/langstage_cli/agui_stream.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/langstage_cli/config.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/langstage_cli/exit_codes.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/langstage_cli/sessions.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/langstage_cli.egg-info/dependency_links.txt +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/langstage_cli.egg-info/entry_points.txt +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/langstage_cli.egg-info/requires.txt +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/langstage_cli.egg-info/top_level.txt +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/setup.cfg +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_advertised_wave4.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_agui_stream.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_approval_menu_abort.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_approval_menu_keys_211.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_async_mode.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_checkpointer.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_cli.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_cli_help.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_codeconfig.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_config.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_config_command.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_configurable.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_ctrl_c_sync_tool.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_custom_decision_195.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_decision_shapes_209.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_deferred_pass.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_dumb_term.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_exit_codes.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_generic_interrupt.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_help_render.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_hidden_option_suggestions.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_history_persist.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_hitl_approval_preview.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_hitl_resume_warning.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_init.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_interrupt_answer_text_206.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_interrupt_non_tty.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_legacy_config_home.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_load_error.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_menu_allowed_197.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_message_boundaries.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_no_color.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_no_interactive_approve.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_no_persist_resume.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_paused_session_message.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_persist_env.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_quiet_output.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_quiet_tool_result_204.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_reasoning_render.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_rename_shim.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_render_markdown.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_routine_1024.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_session_lifecycle.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_sessions.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_show_config.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_show_config_malformed.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_spec_loading_core.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_spec_resolution.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_spinner_reply_survives.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_stdin_interactive.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_stdin_single_shot.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_stream_mode.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_streaming_marker.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_terminal_width.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_toml_relative_paths.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_tool_card_args.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_tool_output_escape.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_turn_error_verbose.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_turn_exit_and_render.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_unicode_console.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_usage_hint_186.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_verbose_command.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_verify_flag.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_workspace.py +0 -0
- {langstage_cli-0.6.57 → langstage_cli-0.6.58}/tests/test_wrong_type_graph.py +0 -0
|
@@ -1105,9 +1105,39 @@ def _reconcile_graph_name(report: str, cfg: Any) -> str:
|
|
|
1105
1105
|
return re.sub(r"(?m)^ graph_name\s+=.*$", lambda _m: line, report, count=1)
|
|
1106
1106
|
|
|
1107
1107
|
|
|
1108
|
+
def _with_shown_bare_spec(cfg: Any) -> Any:
|
|
1109
|
+
"""``cfg`` with a bare ``file.py`` spec shown the way the run resolves it (gh #213).
|
|
1110
|
+
|
|
1111
|
+
Core rebases a ``file.py:attr`` spec from a toml onto the toml's directory and
|
|
1112
|
+
expands ``~``, but its spec parser needs the ``:attr``, so the CLI's colon-less
|
|
1113
|
+
``file.py`` form came through untouched. The run makes up for it (the toml dir is
|
|
1114
|
+
the load's base), but ``--show-config`` and ``/config`` printed the raw value: a
|
|
1115
|
+
path that doesn't exist from a subdirectory. This applies core's rule to the bare
|
|
1116
|
+
form, on a copy, so the diagnostic names the file that actually loads.
|
|
1117
|
+
"""
|
|
1118
|
+
spec = getattr(cfg, "agent_spec", None)
|
|
1119
|
+
split = _split_py_file_spec(spec.strip()) if isinstance(spec, str) else None
|
|
1120
|
+
if split is None or split[1]:
|
|
1121
|
+
return cfg # not a bare .py path: core already shows it resolved
|
|
1122
|
+
raw = split[0]
|
|
1123
|
+
file_path = Path(raw).expanduser()
|
|
1124
|
+
toml_dir = cfg.toml_dir_for("agent_spec") if hasattr(cfg, "toml_dir_for") else None
|
|
1125
|
+
if toml_dir is not None and not file_path.anchor:
|
|
1126
|
+
file_path = Path(toml_dir) / file_path
|
|
1127
|
+
elif file_path == Path(raw):
|
|
1128
|
+
return cfg # nothing to resolve: keep the user's exact spelling
|
|
1129
|
+
shown = copy.copy(cfg)
|
|
1130
|
+
if hasattr(cfg, "_sources"):
|
|
1131
|
+
shown._sources = dict(cfg._sources)
|
|
1132
|
+
shown.agent_spec = str(file_path)
|
|
1133
|
+
return shown
|
|
1134
|
+
|
|
1135
|
+
|
|
1108
1136
|
def _describe(cfg: Any, **kwargs: Any) -> str:
|
|
1109
|
-
"""``cfg.describe(**kwargs)`` showing the graph that actually runs (gh #129)
|
|
1110
|
-
|
|
1137
|
+
"""``cfg.describe(**kwargs)`` showing the graph that actually runs (gh #129)
|
|
1138
|
+
and the agent file it loads (gh #213)."""
|
|
1139
|
+
shown = _with_shown_bare_spec(cfg)
|
|
1140
|
+
return _reconcile_graph_name(shown.describe(**kwargs), shown)
|
|
1111
1141
|
|
|
1112
1142
|
|
|
1113
1143
|
def _split_py_file_spec(spec: str) -> Optional[Tuple[str, str]]:
|
|
@@ -59,6 +59,7 @@ tests/test_routine_1024.py
|
|
|
59
59
|
tests/test_session_lifecycle.py
|
|
60
60
|
tests/test_sessions.py
|
|
61
61
|
tests/test_show_config.py
|
|
62
|
+
tests/test_show_config_bare_spec_213.py
|
|
62
63
|
tests/test_show_config_malformed.py
|
|
63
64
|
tests/test_spec_loading_core.py
|
|
64
65
|
tests/test_spec_resolution.py
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "langstage-cli"
|
|
7
|
-
version = "0.6.
|
|
7
|
+
version = "0.6.58"
|
|
8
8
|
description = "The terminal stage for your LangGraph agent — Claude Code-style CLI for any CompiledGraph"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"""`--show-config` / `/config` show a bare toml `spec = "file.py"` resolved (gh #213).
|
|
2
|
+
|
|
3
|
+
The run loads a colon-less spec from a project `langstage.toml` relative to that
|
|
4
|
+
toml's directory (gh #116), but the diagnostics printed it raw, so from a
|
|
5
|
+
subdirectory they named a file that isn't there. The `file.py:graph` form was
|
|
6
|
+
already shown resolved, because core rebases it.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import re
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
|
|
14
|
+
import pytest
|
|
15
|
+
from click.testing import CliRunner
|
|
16
|
+
|
|
17
|
+
from langstage_cli import cli
|
|
18
|
+
from langstage_cli.cli import main
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _spec_line(output: str) -> str:
|
|
22
|
+
return next(line for line in output.splitlines() if re.match(r"\s*agent_spec\s*=", line))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@pytest.fixture
|
|
26
|
+
def project(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:
|
|
27
|
+
for var in ("LANGSTAGE_AGENT_SPEC", "DEEPAGENT_AGENT_SPEC"):
|
|
28
|
+
monkeypatch.delenv(var, raising=False)
|
|
29
|
+
proj = tmp_path / "proj"
|
|
30
|
+
(proj / "sub").mkdir(parents=True)
|
|
31
|
+
(proj / "my_agent.py").write_text("graph = None\n", encoding="utf-8")
|
|
32
|
+
monkeypatch.chdir(proj / "sub")
|
|
33
|
+
return proj
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _write_toml(proj: Path, spec: str) -> None:
|
|
37
|
+
(proj / "langstage.toml").write_text(f'[agent]\nspec = "{spec}"\n', encoding="utf-8")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@pytest.mark.parametrize("spec", ["my_agent.py", "my_agent.py:graph"])
|
|
41
|
+
def test_show_config_resolves_against_the_toml_dir(project: Path, spec: str) -> None:
|
|
42
|
+
_write_toml(project, spec)
|
|
43
|
+
res = CliRunner().invoke(main, ["--show-config"])
|
|
44
|
+
assert res.exit_code == 0, res.output
|
|
45
|
+
line = _spec_line(res.output)
|
|
46
|
+
assert str(project / "my_agent.py") in line, line
|
|
47
|
+
assert "[toml" in line # provenance is kept
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def test_bare_tilde_spec_is_expanded(
|
|
51
|
+
project: Path, monkeypatch: pytest.MonkeyPatch, tmp_path: Path
|
|
52
|
+
) -> None:
|
|
53
|
+
home = tmp_path / "home"
|
|
54
|
+
home.mkdir()
|
|
55
|
+
monkeypatch.setenv("HOME", str(home))
|
|
56
|
+
monkeypatch.setenv("USERPROFILE", str(home))
|
|
57
|
+
_write_toml(project, "~/agent.py")
|
|
58
|
+
res = CliRunner().invoke(main, ["--show-config"])
|
|
59
|
+
assert res.exit_code == 0, res.output
|
|
60
|
+
line = _spec_line(res.output)
|
|
61
|
+
assert "~" not in line.split("[")[0], line
|
|
62
|
+
assert str(home / "agent.py") in line, line
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def test_env_bare_spec_keeps_its_spelling(project: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
66
|
+
# A spec from the environment stays cwd-relative (gh #30) and is shown as typed.
|
|
67
|
+
monkeypatch.setenv("LANGSTAGE_AGENT_SPEC", "my_agent.py")
|
|
68
|
+
res = CliRunner().invoke(main, ["--show-config"])
|
|
69
|
+
assert res.exit_code == 0, res.output
|
|
70
|
+
assert re.search(r"agent_spec\s*=\s*my_agent\.py\s", _spec_line(res.output) + " ")
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def test_describe_does_not_mutate_the_config(project: Path) -> None:
|
|
74
|
+
from langstage_cli.config import CodeConfig
|
|
75
|
+
|
|
76
|
+
_write_toml(project, "my_agent.py")
|
|
77
|
+
cfg = CodeConfig.resolve(toml_start=Path.cwd())
|
|
78
|
+
report = cli._describe(cfg)
|
|
79
|
+
assert str(project / "my_agent.py") in _spec_line(report)
|
|
80
|
+
assert (
|
|
81
|
+
cfg.agent_spec == "my_agent.py"
|
|
82
|
+
) # the run's own base-dir handling still sees the raw value
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|