Skip to content

Commit 8e68fbc

Browse files
author
Your Name
committed
feat(docs): deep code analysis engine with 4 supporting modules
changes: - file: app.py area: cli added: [_truncate_long_strings_for_markdown] modified: [_build_results_markdown] - file: ticket_freshness.py area: core added: [_load_planfile_validator] modified: [validate_tickets_with_prefact] dependencies: flow: "app→planfile" - app.py -> planfile.py stats: lines: "+103/-13 (net +90)" files: 4 complexity: "Large structural change (normalized)"
1 parent 3abbe2d commit 8e68fbc

12 files changed

Lines changed: 121 additions & 21 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,16 @@
129129
- Update README.md with model tier configuration examples
130130
- Update examples/planfile/README.md with backend system documentation
131131

132+
## [0.1.74] - 2026-04-26
133+
134+
### Docs
135+
- Update README.md
136+
137+
### Other
138+
- Update llx/cli/app.py
139+
- Update llx/planfile/ticket_freshness.py
140+
- Update planfile.yaml
141+
132142
## [0.1.73] - 2026-04-26
133143

134144
### Docs

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
**Intelligent LLM model router driven by real code metrics.**
44

55
[![PyPI](https://img.shields.io/pypi/v/llx)](https://pypi.org/project/llx/)
6-
[![Version](https://img.shields.io/badge/version-0.1.73-blue)](https://pypi.org/project/llx/)
6+
[![Version](https://img.shields.io/badge/version-0.1.74-blue)](https://pypi.org/project/llx/)
77
[![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
88
[![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://python.org)
99

1010

1111
## AI Cost Tracking
1212

13-
![PyPI](https://img.shields.io/badge/pypi-costs-blue) ![Version](https://img.shields.io/badge/version-0.1.73-blue) ![Python](https://img.shields.io/badge/python-3.9+-blue) ![License](https://img.shields.io/badge/license-Apache--2.0-green)
13+
![PyPI](https://img.shields.io/badge/pypi-costs-blue) ![Version](https://img.shields.io/badge/version-0.1.74-blue) ![Python](https://img.shields.io/badge/python-3.9+-blue) ![License](https://img.shields.io/badge/license-Apache--2.0-green)
1414
![AI Cost](https://img.shields.io/badge/AI%20Cost-$7.50-orange) ![Human Time](https://img.shields.io/badge/Human%20Time-35.1h-blue) ![Model](https://img.shields.io/badge/Model-openrouter%2Fqwen%2Fqwen3--coder--next-lightgrey)
1515

16-
- 🤖 **LLM usage:** $7.5000 (97 commits)
17-
- 👤 **Human dev:** ~$3511 (35.1h @ $100/h, 30min dedup)
16+
- 🤖 **LLM usage:** $7.5000 (98 commits)
17+
- 👤 **Human dev:** ~$3513 (35.1h @ $100/h, 30min dedup)
1818

1919
Generated on 2026-04-26 using [openrouter/qwen/qwen3-coder-next](https://openrouter.ai/qwen/qwen3-coder-next)
2020

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.73
1+
0.1.74

llx/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
model = select_model(metrics)
1515
"""
1616

17-
__version__ = "0.1.73"
17+
__version__ = "0.1.74"
1818

1919
from llx.analysis.collector import ProjectMetrics, analyze_project
2020
from llx.llm import DEFAULT_MAX_TOKENS, LLM, LLMResponse, get_api_key, get_llm, get_llm_model

llx/cli/app.py

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,10 +405,72 @@ def _persist_failed_results(results, strategy: str) -> None:
405405
)
406406

407407

408+
# Field whitelist whose strings get aggressively trimmed when rendering the
409+
# YAML payload inside markdown output (full data is still emitted by
410+
# `--format yaml` and `--output-yaml`).
411+
_MARKDOWN_TRUNCATE_FIELDS: frozenset[str] = frozenset({
412+
"response",
413+
"message",
414+
"validation_message",
415+
"error",
416+
"stdout",
417+
"stderr",
418+
})
419+
420+
_MARKDOWN_TRUNCATE_LIMIT = 240
421+
422+
423+
def _truncate_long_strings_for_markdown(
424+
value: Any,
425+
*,
426+
limit: int = _MARKDOWN_TRUNCATE_LIMIT,
427+
parent_field: Optional[str] = None,
428+
) -> Any:
429+
"""Recursively shorten long string values for human-readable markdown output.
430+
431+
Only strings reached via a key in :data:`_MARKDOWN_TRUNCATE_FIELDS` are
432+
truncated; everything else is passed through unchanged. The mutation is
433+
done on a deep copy so the original payload (used for ``--format yaml``
434+
and ``--output-yaml``) is not affected.
435+
"""
436+
if isinstance(value, dict):
437+
return {
438+
key: _truncate_long_strings_for_markdown(
439+
item, limit=limit, parent_field=str(key)
440+
)
441+
for key, item in value.items()
442+
}
443+
if isinstance(value, list):
444+
return [
445+
_truncate_long_strings_for_markdown(item, limit=limit, parent_field=parent_field)
446+
for item in value
447+
]
448+
if isinstance(value, tuple):
449+
return tuple(
450+
_truncate_long_strings_for_markdown(item, limit=limit, parent_field=parent_field)
451+
for item in value
452+
)
453+
if (
454+
isinstance(value, str)
455+
and parent_field in _MARKDOWN_TRUNCATE_FIELDS
456+
and len(value) > limit
457+
):
458+
omitted = len(value) - limit
459+
suffix = f"… <truncated {omitted} chars; use --format yaml or --output-yaml for full output>"
460+
return value[:limit].rstrip() + suffix
461+
return value
462+
463+
408464
def _build_results_markdown(payload: dict[str, Any]) -> str:
409-
"""Build markdown output with YAML payload codeblock."""
465+
"""Build markdown output with a compact YAML payload codeblock.
466+
467+
Long fields like ``response`` are truncated to keep terminal output
468+
readable; the full payload is still emitted by ``--format yaml`` and
469+
``--output-yaml``.
470+
"""
410471
summary = payload.get("summary", {})
411-
yaml_payload = _yaml.safe_dump(payload, sort_keys=False, allow_unicode=True).rstrip()
472+
compact_payload = _truncate_long_strings_for_markdown(payload)
473+
yaml_payload = _yaml.safe_dump(compact_payload, sort_keys=False, allow_unicode=True).rstrip()
412474

413475
lines = [
414476
"## Execution Summary",

llx/orchestration/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@
3232
"LLMOrchestrator",
3333
]
3434

35-
__version__ = "0.1.73"
35+
__version__ = "0.1.74"

llx/planfile/ticket_freshness.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,40 @@
3333
)
3434

3535

36+
def _load_planfile_validator():
37+
"""Return ``validate_planfile_tickets`` from any compatible planfile release.
38+
39+
Tries (in order):
40+
1. Top-level ``planfile.validate_planfile_tickets`` (newer releases).
41+
2. Submodule ``planfile.ticket_validation.validate_planfile_tickets``.
42+
3. Submodule ``planfile.validation.validate_planfile_tickets`` (legacy alias).
43+
44+
Raises :class:`PrefactError` if none of the imports succeed; this lets the
45+
pre-flight in ``llx plan run`` degrade gracefully and continue without
46+
freshness checks instead of crashing the entire run.
47+
"""
48+
last_error: Exception | None = None
49+
candidates = (
50+
("planfile", "validate_planfile_tickets"),
51+
("planfile.ticket_validation", "validate_planfile_tickets"),
52+
("planfile.validation", "validate_planfile_tickets"),
53+
)
54+
for module_name, attr in candidates:
55+
try:
56+
module = __import__(module_name, fromlist=[attr])
57+
except Exception as exc: # pragma: no cover - defensive
58+
last_error = exc
59+
continue
60+
candidate = getattr(module, attr, None)
61+
if callable(candidate):
62+
return candidate
63+
raise PrefactError(
64+
"planfile.validate_planfile_tickets is not available in this environment "
65+
"(install/upgrade the 'planfile' package)."
66+
+ (f" Last import error: {last_error}" if last_error else "")
67+
)
68+
69+
3670
def _empty_scan_summary(reason: str) -> dict[str, Any]:
3771
return {
3872
"available": False,
@@ -83,7 +117,7 @@ def validate_tickets_with_prefact(
83117
Dict mirroring ``planfile.validate_planfile_tickets`` plus a ``scan``
84118
block describing the underlying prefact run.
85119
"""
86-
from planfile import validate_planfile_tickets
120+
validate_planfile_tickets = _load_planfile_validator()
87121

88122
project_root = Path(project_path).resolve()
89123
strategy_file = Path(strategy_path)

llx/prellm/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
print(result.content)
1212
"""
1313

14-
__version__ = "0.1.73"
14+
__version__ = "0.1.74"
1515

1616
# 1-function API — the primary interface (always uses v0.3 pipeline internally)
1717
from llx.prellm.core import preprocess_and_execute, preprocess_and_execute_sync

llx/pyqual_plugins/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
Each module provides a specific CI/CD or quality check functionality.
55
"""
66

7-
__version__ = "0.1.73"
7+
__version__ = "0.1.74"

llx/tools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919
"HealthChecker"
2020
]
2121

22-
__version__ = "0.1.73"
22+
__version__ = "0.1.74"

0 commit comments

Comments
 (0)