langstage-cli 0.5.1__tar.gz → 0.5.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.
- {langstage_cli-0.5.1/langstage_cli.egg-info → langstage_cli-0.5.2}/PKG-INFO +1 -1
- {langstage_cli-0.5.1 → langstage_cli-0.5.2}/langstage_cli/cli.py +24 -13
- {langstage_cli-0.5.1 → langstage_cli-0.5.2/langstage_cli.egg-info}/PKG-INFO +1 -1
- {langstage_cli-0.5.1 → langstage_cli-0.5.2}/langstage_cli.egg-info/SOURCES.txt +2 -1
- {langstage_cli-0.5.1 → langstage_cli-0.5.2}/pyproject.toml +1 -1
- langstage_cli-0.5.2/tests/test_show_config.py +47 -0
- {langstage_cli-0.5.1 → langstage_cli-0.5.2}/LICENSE +0 -0
- {langstage_cli-0.5.1 → langstage_cli-0.5.2}/README.md +0 -0
- {langstage_cli-0.5.1 → langstage_cli-0.5.2}/deepagent_code/__init__.py +0 -0
- {langstage_cli-0.5.1 → langstage_cli-0.5.2}/langstage_cli/__init__.py +0 -0
- {langstage_cli-0.5.1 → langstage_cli-0.5.2}/langstage_cli/config.py +0 -0
- {langstage_cli-0.5.1 → langstage_cli-0.5.2}/langstage_cli.egg-info/dependency_links.txt +0 -0
- {langstage_cli-0.5.1 → langstage_cli-0.5.2}/langstage_cli.egg-info/entry_points.txt +0 -0
- {langstage_cli-0.5.1 → langstage_cli-0.5.2}/langstage_cli.egg-info/requires.txt +0 -0
- {langstage_cli-0.5.1 → langstage_cli-0.5.2}/langstage_cli.egg-info/top_level.txt +0 -0
- {langstage_cli-0.5.1 → langstage_cli-0.5.2}/setup.cfg +0 -0
- {langstage_cli-0.5.1 → langstage_cli-0.5.2}/tests/test_cli.py +0 -0
- {langstage_cli-0.5.1 → langstage_cli-0.5.2}/tests/test_codeconfig.py +0 -0
- {langstage_cli-0.5.1 → langstage_cli-0.5.2}/tests/test_config.py +0 -0
- {langstage_cli-0.5.1 → langstage_cli-0.5.2}/tests/test_rename_shim.py +0 -0
|
@@ -1401,10 +1401,6 @@ def main(
|
|
|
1401
1401
|
langstage-cli --demo "try it with no API key"
|
|
1402
1402
|
langstage-cli --show-config
|
|
1403
1403
|
"""
|
|
1404
|
-
if show_config:
|
|
1405
|
-
print(config_module.CodeConfig.resolve(toml_start=Path.cwd()).describe())
|
|
1406
|
-
return
|
|
1407
|
-
|
|
1408
1404
|
if demo:
|
|
1409
1405
|
if agent_spec:
|
|
1410
1406
|
print(f"{RED}⏺ Error: --demo and -a/--agent are mutually exclusive{RESET}")
|
|
@@ -1412,6 +1408,29 @@ def main(
|
|
|
1412
1408
|
# The keyless echo agent shipped with the shared core.
|
|
1413
1409
|
agent_spec = "langgraph_stream_parser.demo.stub:graph"
|
|
1414
1410
|
|
|
1411
|
+
# CLI flags are the highest-precedence config layer. Build the override dict
|
|
1412
|
+
# ONCE and use it for both --show-config and the real run, so the diagnostic
|
|
1413
|
+
# reflects exactly what a run resolves (CLI-set values then show as
|
|
1414
|
+
# `[override]`, not `[default]`). Resolving --show-config without these was
|
|
1415
|
+
# the bug in #20.
|
|
1416
|
+
cli_overrides = {
|
|
1417
|
+
"agent_spec": agent_spec,
|
|
1418
|
+
"graph_name": graph_name,
|
|
1419
|
+
"stream_mode": stream_mode,
|
|
1420
|
+
# bool flags only override when actually passed; otherwise fall back to
|
|
1421
|
+
# TOML/env/default.
|
|
1422
|
+
"async_mode": True if use_async else None,
|
|
1423
|
+
"verbose": True if verbose else None,
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
if show_config:
|
|
1427
|
+
print(
|
|
1428
|
+
config_module.CodeConfig.resolve(
|
|
1429
|
+
toml_start=Path.cwd(), overrides=cli_overrides
|
|
1430
|
+
).describe()
|
|
1431
|
+
)
|
|
1432
|
+
return
|
|
1433
|
+
|
|
1415
1434
|
try:
|
|
1416
1435
|
# Handle -f/--file option: read message from file
|
|
1417
1436
|
if prompt_file and message:
|
|
@@ -1441,15 +1460,7 @@ def main(
|
|
|
1441
1460
|
# (DEEPAGENT_AGENT_SPEC is canonical; DEEPAGENT_SPEC is a deprecated alias.)
|
|
1442
1461
|
cfg = config_module.CodeConfig.resolve(
|
|
1443
1462
|
toml_start=Path.cwd(),
|
|
1444
|
-
overrides=
|
|
1445
|
-
"agent_spec": agent_spec,
|
|
1446
|
-
"graph_name": graph_name,
|
|
1447
|
-
"stream_mode": stream_mode,
|
|
1448
|
-
# bool flags only override when actually passed; otherwise fall
|
|
1449
|
-
# back to TOML/env/default.
|
|
1450
|
-
"async_mode": True if use_async else None,
|
|
1451
|
-
"verbose": True if verbose else None,
|
|
1452
|
-
},
|
|
1463
|
+
overrides=cli_overrides,
|
|
1453
1464
|
)
|
|
1454
1465
|
final_spec = cfg.agent_spec
|
|
1455
1466
|
final_graph_name_default = cfg.graph_name
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "langstage-cli"
|
|
7
|
-
version = "0.5.
|
|
7
|
+
version = "0.5.2"
|
|
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,47 @@
|
|
|
1
|
+
"""Regression tests for #20: `--show-config` must reflect CLI flags.
|
|
2
|
+
|
|
3
|
+
Before the fix, the --show-config branch resolved config WITHOUT the CLI
|
|
4
|
+
overrides, so flags showed as `[default]` and the reported source could
|
|
5
|
+
contradict the real run.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import re
|
|
9
|
+
|
|
10
|
+
from click.testing import CliRunner
|
|
11
|
+
|
|
12
|
+
from langstage_cli.cli import main
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def test_show_config_reflects_cli_flags():
|
|
16
|
+
with CliRunner().isolated_filesystem(): # no stray toml
|
|
17
|
+
r = CliRunner().invoke(
|
|
18
|
+
main, ["-a", "fromcli.py:graph", "-v", "--stream-mode", "values", "--show-config"]
|
|
19
|
+
)
|
|
20
|
+
assert r.exit_code == 0, r.output
|
|
21
|
+
# CLI-set values appear with the [override] source, not [default].
|
|
22
|
+
assert re.search(r"agent_spec\s*=\s*fromcli\.py:graph\s*\[override\]", r.output), r.output
|
|
23
|
+
assert re.search(r"stream_mode\s*=\s*values\s*\[override\]", r.output), r.output
|
|
24
|
+
assert re.search(r"verbose\s*=\s*True\s*\[override\]", r.output), r.output
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_show_config_cli_flag_beats_env():
|
|
28
|
+
with CliRunner().isolated_filesystem():
|
|
29
|
+
r = CliRunner().invoke(
|
|
30
|
+
main,
|
|
31
|
+
["-a", "fromcli.py:graph", "--show-config"],
|
|
32
|
+
env={"LANGSTAGE_AGENT_SPEC": "fromenv.py:graph"},
|
|
33
|
+
)
|
|
34
|
+
assert r.exit_code == 0, r.output
|
|
35
|
+
# the CLI flag wins (matches what a real run does), not the env var
|
|
36
|
+
assert re.search(r"agent_spec\s*=\s*fromcli\.py:graph\s*\[override\]", r.output), r.output
|
|
37
|
+
assert "fromenv.py:graph" not in r.output.split("agent_spec")[1].split("\n")[0]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_show_config_without_flags_still_reports_env():
|
|
41
|
+
with CliRunner().isolated_filesystem():
|
|
42
|
+
r = CliRunner().invoke(
|
|
43
|
+
main, ["--show-config"], env={"LANGSTAGE_AGENT_SPEC": "fromenv.py:graph"}
|
|
44
|
+
)
|
|
45
|
+
assert r.exit_code == 0, r.output
|
|
46
|
+
# no flags → env is correctly the winning source (no regression)
|
|
47
|
+
assert re.search(r"agent_spec\s*=\s*fromenv\.py:graph\s*\[env:", r.output), r.output
|
|
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
|