Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ Issues (2)
| `SKILLSPECTOR_OUTPUT_LANGUAGE` | Short, single-line language label (letters, numbers, spaces, `_`, or `-`; maximum 64 characters) for human-readable LLM finding text such as messages, explanations, and remediation. Rule IDs, severity values, paths, code, and other machine-readable values remain unchanged. Unset, blank, or invalid values preserve the default output language. | Optional |
| `SKILLSPECTOR_TEMPERATURE` | Optional sampling temperature from `0` to `1` for hosted providers. Unset or blank preserves the provider default. Lower values can reduce run-to-run variation but do not guarantee identical output. | Optional |
| `SKILLSPECTOR_SEED` | Optional integer sampling seed for OpenAI-compatible and Azure OpenAI providers. Other hosted providers and CLI providers do not receive it. Provider support remains model-dependent. | Optional |
| `SKILLSPECTOR_COMPACT_PROMPTS` | Opt-in compact line numbering in LLM prompts: numbered lines render as `L1:`, `L2:` instead of zero-padded `L01:`, `L02:`. Accepted truthy values are `1`, `true`, and `yes` (case-insensitive; surrounding whitespace is trimmed). Unset or any other value keeps the default zero-padded format. | Optional |
| `ANTHROPIC_API_KEY` | Credential for the Anthropic provider (`SKILLSPECTOR_PROVIDER=anthropic`). | Required for LLM analysis when `SKILLSPECTOR_PROVIDER=anthropic` |
| `ANTHROPIC_BASE_URL` | Override the native Anthropic endpoint (default: `https://api.anthropic.com`). | Optional |
| `ANTHROPIC_PROXY_ENDPOINT_URL` | Full endpoint URL for the Anthropic proxy provider (Vertex-style raw-predict). | Required when `SKILLSPECTOR_PROVIDER=anthropic_proxy` |
Expand Down
2 changes: 2 additions & 0 deletions src/skillspector/llm_analyzer_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,8 @@ def number_lines(content: str, start_line: int = 1) -> str:
lines = content.splitlines()
if not lines:
return ""
if os.environ.get("SKILLSPECTOR_COMPACT_PROMPTS", "").strip().lower() in {"1", "true", "yes"}:
return "\n".join(f"L{start_line + i}: {line}" for i, line in enumerate(lines))
end = start_line + len(lines) - 1
width = len(str(end))
return "\n".join(f"L{start_line + i:0>{width}}: {line}" for i, line in enumerate(lines))
Expand Down
30 changes: 30 additions & 0 deletions tests/nodes/test_llm_analyzer_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,36 @@ def test_zero_padding(self) -> None:
assert result.startswith("L01: line0")
assert "L11: line10" in result

def test_compact_prompts_disable_zero_padding(self, monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv("SKILLSPECTOR_COMPACT_PROMPTS", "true")
lines = "\n".join(f"line{i}" for i in range(11))
assert number_lines(lines).startswith("L1: line0")

@pytest.mark.parametrize("value", ["1", "true", "TRUE", "yes", "Yes", " true "])
def test_compact_prompts_normalized_truthy_values(
self, monkeypatch: pytest.MonkeyPatch, value: str
) -> None:
monkeypatch.setenv("SKILLSPECTOR_COMPACT_PROMPTS", value)
lines = "\n".join(f"line{i}" for i in range(11))
assert number_lines(lines).startswith("L1: line0")

@pytest.mark.parametrize("value", ["0", "false", "no", ""])
def test_compact_prompts_falsy_values_keep_default(
self, monkeypatch: pytest.MonkeyPatch, value: str
) -> None:
monkeypatch.setenv("SKILLSPECTOR_COMPACT_PROMPTS", value)
lines = "\n".join(f"line{i}" for i in range(11))
result = number_lines(lines)
assert result.startswith("L01: line0")
assert "L11: line10" in result

def test_compact_prompts_unset_keeps_default(self, monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.delenv("SKILLSPECTOR_COMPACT_PROMPTS", raising=False)
lines = "\n".join(f"line{i}" for i in range(11))
result = number_lines(lines)
assert result.startswith("L01: line0")
assert "L11: line10" in result


# ---------------------------------------------------------------------------
# LLMAnalyzerBase.build_prompt (default implementation)
Expand Down
Loading