agent-efficiency 1.4.2__tar.gz → 1.4.3__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.
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/.claude-plugin/plugin.json +1 -1
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/CHANGELOG.md +6 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/PKG-INFO +11 -8
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/README.md +10 -7
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/agent_efficiency/__init__.py +1 -1
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/mcp/server.py +1 -1
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/pyproject.toml +1 -1
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/scripts/ae_cli.py +1 -1
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/references/cli-reference.md +1 -1
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/idx_db.py +2 -1
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/idx_ignore.py +48 -4
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/idx_indexer.py +18 -4
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/idx_parsers.py +141 -15
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/idx_search.py +5 -2
- agent_efficiency-1.4.3/tests/test_large_repo_indexing.py +184 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/tests/test_schlager_upgrades.py +1 -1
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/.claude-plugin/marketplace.json +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/.github/workflows/ci.yml +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/.github/workflows/release.yml +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/.gitignore +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/LICENSE +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/SECURITY.md +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/agent_efficiency/cli.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/agent_efficiency/mcp_entry.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/benchmarks/benchmark_efficiency.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/benchmarks/eval_llm_ab.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/docs/assets/audit-doctor-card.svg +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/docs/assets/before-after-run.svg +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/requirements.txt +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/rules/AGENT_RULES.md +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/scripts/ae_init.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/scripts/ae_manage.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/scripts/install.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/scripts/pretool_hook.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/scripts/render_demo_svg.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/scripts/setup_hooks.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/scripts/sync_shared.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/scripts/validate_skills.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/shared/_ae_core/__init__.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/shared/_ae_core/io_lock.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/shared/_ae_core/savings.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/shared/_ae_core/security.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/shared/_ae_core/usage.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/adaptive-orchestration-handoff/SKILL.md +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/adaptive-orchestration-handoff/config/models.json +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/adaptive-orchestration-handoff/examples/workflow.md +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/adaptive-orchestration-handoff/references/routing-and-escalation.md +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/adaptive-orchestration-handoff/references/state-and-handoff.md +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/adaptive-orchestration-handoff/scripts/_ae_core/__init__.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/adaptive-orchestration-handoff/scripts/_ae_core/io_lock.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/adaptive-orchestration-handoff/scripts/_ae_core/savings.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/adaptive-orchestration-handoff/scripts/_ae_core/security.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/adaptive-orchestration-handoff/scripts/_ae_core/usage.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/adaptive-orchestration-handoff/scripts/agent_state.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/adaptive-orchestration-handoff/scripts/context_doctor.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/adaptive-orchestration-handoff/scripts/llm_adapter.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/adaptive-orchestration-handoff/scripts/route_task.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/adaptive-orchestration-handoff/scripts/state_ops.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/adaptive-orchestration-handoff/scripts/state_render.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/adaptive-orchestration-handoff/scripts/state_store.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/adaptive-orchestration-handoff/scripts/transcript_audit.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/SKILL.md +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/_ae_core/__init__.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/_ae_core/io_lock.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/_ae_core/savings.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/_ae_core/security.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/_ae_core/usage.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/compact_run.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/context_index.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/idx_lsp.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/idx_slice.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/idx_trace.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/idx_workspace.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/prompt-cache-manager/SKILL.md +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/prompt-cache-manager/references/provider-caching.md +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/prompt-cache-manager/scripts/_ae_core/__init__.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/prompt-cache-manager/scripts/_ae_core/io_lock.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/prompt-cache-manager/scripts/_ae_core/savings.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/prompt-cache-manager/scripts/_ae_core/security.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/prompt-cache-manager/scripts/_ae_core/usage.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/prompt-cache-manager/scripts/cache_payload.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/prompt-cache-manager/scripts/prompt_cache.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/tests/test_audit_regressions.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/tests/test_automation_mcp.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/tests/test_context_index.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/tests/test_ide_power_features.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/tests/test_orchestration_handoff.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/tests/test_production_readiness.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/tests/test_prompt_cache.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/tests/test_risk_hardening.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/tests/test_skills_validation.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/tests/test_smoke.py +0 -0
- {agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/tests/test_top5_upgrades.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-efficiency",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"description": "Cut AI coding-agent token waste by 60–95%: local SQLite FTS5 symbol index & multi-slice, 80–95% test/build log compression with auto-sliced stacktraces, session checkpoints, context doctor, and IDE transcript waste audit.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jeager070"
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to **AgentEfficiency Skills (`ae`)** are documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.4.3] - 2026-11-27
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **Shaders, Native C++/CUDA/ObjC & CMake indexing (`local-context-index`):** Added `.glsl`, `.vert`, `.frag`, `.comp`, `.geom`, `.tesc`, `.tese`, `.hlsl`, `.hlsli`, `.wgsl`, `.metal`, `.cxx`, `.hxx`, `.inl`, `.ipp`, `.ixx`, `.cppm`, `.m`, `.mm`, `.cu`, `.cuh`, and `.cmake` support, plus multi-line C++ / `noexcept` / `Class::method` / GLSL / WGSL / CMake symbol extraction and expanded `_brace_end` scanning (2,000 lines).
|
|
9
|
+
- **Large-repo speed & noise pruning:** Raised default `max_file_bytes` from 1.5 MB to 4 MB (with automatic minified single-line bundle skipping >250 KB, `skipped_large` reporting, `max_tokens=2000` identifier-token splitting, multi-term symbol hit ranking in `ae search`, and seamless upgrade of legacy 1.5 MB `config.json` defaults). Pruned nested `third_party` / `3rdparty` / `3rd_party` / `submodules` / `cmake-build-*` directories by default unless explicitly opted in via `include`.
|
|
10
|
+
|
|
5
11
|
## [1.4.2] - 2026-11-27
|
|
6
12
|
|
|
7
13
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: agent-efficiency
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.3
|
|
4
4
|
Summary: Zero-dependency local context index, log compression, session memory, context doctor, and lean MCP server for AI coding agents.
|
|
5
5
|
Project-URL: Homepage, https://github.com/Jeager070/agent-efficiency-skills
|
|
6
6
|
Project-URL: Repository, https://github.com/Jeager070/agent-efficiency-skills
|
|
@@ -54,12 +54,13 @@ Works with **Claude Code**, **Cursor**, **Codex**, **Gemini CLI**, **Antigravity
|
|
|
54
54
|
See what your coding agents actually burned last week — and how many always-on tokens your rules, skills, and MCP servers tax every single turn:
|
|
55
55
|
|
|
56
56
|
```bash
|
|
57
|
-
# Run directly from
|
|
58
|
-
uvx
|
|
59
|
-
uvx
|
|
60
|
-
```
|
|
57
|
+
# Run directly from PyPI via uvx (zero install, strictly read-only):
|
|
58
|
+
uvx agent-efficiency audit
|
|
59
|
+
uvx agent-efficiency doctor
|
|
61
60
|
|
|
62
|
-
|
|
61
|
+
# Or install/run directly from GitHub main:
|
|
62
|
+
# uvx --from git+https://github.com/Jeager070/agent-efficiency-skills.git ae audit
|
|
63
|
+
```
|
|
63
64
|
|
|
64
65
|

|
|
65
66
|
|
|
@@ -69,9 +70,11 @@ uvx --from git+https://github.com/Jeager070/agent-efficiency-skills.git ae docto
|
|
|
69
70
|
|
|
70
71
|
### Option A — Install via `pipx` / `pip` + `ae init` (Recommended)
|
|
71
72
|
```bash
|
|
72
|
-
pipx install
|
|
73
|
+
pipx install agent-efficiency
|
|
73
74
|
# Optional native tree-sitter AST upgrade for JS/TS/Go/Rust/Java:
|
|
74
|
-
# pipx install "agent-efficiency[ast]
|
|
75
|
+
# pipx install "agent-efficiency[ast]"
|
|
76
|
+
# Or install directly from GitHub main:
|
|
77
|
+
# pipx install git+https://github.com/Jeager070/agent-efficiency-skills.git
|
|
75
78
|
|
|
76
79
|
# Auto-detects Claude Code, Cursor, Codex, Gemini, OpenCode, Windsurf & Copilot:
|
|
77
80
|
ae init # Skills (--profile ide) + ae CLI + 6-line rules + repo index
|
|
@@ -20,12 +20,13 @@ Works with **Claude Code**, **Cursor**, **Codex**, **Gemini CLI**, **Antigravity
|
|
|
20
20
|
See what your coding agents actually burned last week — and how many always-on tokens your rules, skills, and MCP servers tax every single turn:
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
# Run directly from
|
|
24
|
-
uvx
|
|
25
|
-
uvx
|
|
26
|
-
```
|
|
23
|
+
# Run directly from PyPI via uvx (zero install, strictly read-only):
|
|
24
|
+
uvx agent-efficiency audit
|
|
25
|
+
uvx agent-efficiency doctor
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
# Or install/run directly from GitHub main:
|
|
28
|
+
# uvx --from git+https://github.com/Jeager070/agent-efficiency-skills.git ae audit
|
|
29
|
+
```
|
|
29
30
|
|
|
30
31
|

|
|
31
32
|
|
|
@@ -35,9 +36,11 @@ uvx --from git+https://github.com/Jeager070/agent-efficiency-skills.git ae docto
|
|
|
35
36
|
|
|
36
37
|
### Option A — Install via `pipx` / `pip` + `ae init` (Recommended)
|
|
37
38
|
```bash
|
|
38
|
-
pipx install
|
|
39
|
+
pipx install agent-efficiency
|
|
39
40
|
# Optional native tree-sitter AST upgrade for JS/TS/Go/Rust/Java:
|
|
40
|
-
# pipx install "agent-efficiency[ast]
|
|
41
|
+
# pipx install "agent-efficiency[ast]"
|
|
42
|
+
# Or install directly from GitHub main:
|
|
43
|
+
# pipx install git+https://github.com/Jeager070/agent-efficiency-skills.git
|
|
41
44
|
|
|
42
45
|
# Auto-detects Claude Code, Cursor, Codex, Gemini, OpenCode, Windsurf & Copilot:
|
|
43
46
|
ae init # Skills (--profile ide) + ae CLI + 6-line rules + repo index
|
|
@@ -35,7 +35,7 @@ import prompt_cache # noqa: E402
|
|
|
35
35
|
import route_task # noqa: E402
|
|
36
36
|
|
|
37
37
|
SERVER_NAME = "agent-efficiency"
|
|
38
|
-
SERVER_VERSION = "1.4.
|
|
38
|
+
SERVER_VERSION = "1.4.3"
|
|
39
39
|
DEFAULT_PROTOCOL_VERSION = "2024-11-05"
|
|
40
40
|
SUPPORTED_PROTOCOL_VERSIONS = ("2024-11-05", "2025-03-26", "2025-06-18")
|
|
41
41
|
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "agent-efficiency"
|
|
7
|
-
version = "1.4.
|
|
7
|
+
version = "1.4.3"
|
|
8
8
|
description = "Zero-dependency local context index, log compression, session memory, context doctor, and lean MCP server for AI coding agents."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
{agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/idx_db.py
RENAMED
|
@@ -23,6 +23,7 @@ from idx_ignore import (
|
|
|
23
23
|
load_dir_gitignore,
|
|
24
24
|
load_gitignore_rules,
|
|
25
25
|
load_repo_config,
|
|
26
|
+
should_traverse_dir,
|
|
26
27
|
)
|
|
27
28
|
|
|
28
29
|
SCHEMA_VERSION = 5
|
|
@@ -346,7 +347,7 @@ def status(repo: Path, check_stale: bool = False) -> Dict[str, Any]:
|
|
|
346
347
|
gi_rules.extend(load_dir_gitignore(dp, rel_dir))
|
|
347
348
|
dirnames[:] = [
|
|
348
349
|
d for d in sorted(dirnames)
|
|
349
|
-
if
|
|
350
|
+
if should_traverse_dir(f"{rel_dir}/{d}" if rel_dir else d, d, extra_excludes, gi_rules, extra_includes)
|
|
350
351
|
]
|
|
351
352
|
for fname in sorted(filenames):
|
|
352
353
|
rel = f"{rel_dir}/{fname}" if rel_dir else fname
|
{agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/idx_ignore.py
RENAMED
|
@@ -8,7 +8,7 @@ from typing import Any, Dict, List, Sequence, Set, Tuple
|
|
|
8
8
|
|
|
9
9
|
from _ae_core import HARD_SECRET_PATH_RE, is_secret_path, is_within, normalize_rel_path
|
|
10
10
|
|
|
11
|
-
MAX_BYTES_DEFAULT =
|
|
11
|
+
MAX_BYTES_DEFAULT = 4_000_000
|
|
12
12
|
DEFAULT_MAP_BUDGET_TOKENS = 1_500
|
|
13
13
|
|
|
14
14
|
# Directories excluded at any depth
|
|
@@ -16,18 +16,23 @@ EXCLUDED_DIRS: Set[str] = {
|
|
|
16
16
|
".git", ".hg", ".svn", ".venv", "venv", ".tox", ".mypy_cache", ".ruff_cache",
|
|
17
17
|
".pytest_cache", "__pycache__", "node_modules", ".next", ".nuxt", ".svelte-kit",
|
|
18
18
|
".turbo", ".cache", "coverage", ".idea", ".vscode", ".agent-index", ".agent-state",
|
|
19
|
-
"Pods", ".gradle", ".aws", ".kube", ".docker",
|
|
19
|
+
"Pods", ".gradle", ".aws", ".kube", ".docker", "CMakeFiles",
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
# Build/output/env directories excluded by default only at repo root (not inside `src/env/`, `src/build/`, `src/out/`)
|
|
23
23
|
ROOT_EXCLUDED_DIRS: Set[str] = {"env", "dist", "build", "out", "target", "vendor"}
|
|
24
24
|
|
|
25
|
+
# Nested vendored dependency / CMake build trees excluded unless explicitly matched by config `include`
|
|
26
|
+
VENDOR_EXCLUDED_DIRS: Set[str] = {"third_party", "3rdparty", "3rd_party", "submodules"}
|
|
27
|
+
|
|
25
28
|
SUPPORTED_EXTS: Set[str] = {
|
|
26
29
|
".py", ".pyi", ".js", ".jsx", ".mjs", ".cjs", ".ts", ".tsx", ".mts", ".cts",
|
|
27
30
|
".java", ".kt", ".kts", ".go", ".rs", ".c", ".h", ".cpp", ".hpp", ".cc", ".hh",
|
|
31
|
+
".cxx", ".hxx", ".inl", ".ipp", ".ixx", ".cppm", ".m", ".mm", ".cu", ".cuh",
|
|
32
|
+
".glsl", ".vert", ".frag", ".comp", ".geom", ".tesc", ".tese", ".hlsl", ".hlsli", ".wgsl", ".metal",
|
|
28
33
|
".cs", ".php", ".rb", ".swift", ".scala", ".sh", ".bash", ".zsh", ".ps1", ".sql",
|
|
29
34
|
".html", ".htm", ".css", ".scss", ".sass", ".less", ".json", ".yaml", ".yml",
|
|
30
|
-
".toml", ".ini", ".cfg", ".md", ".mdx", ".rst", ".txt", ".xml", ".graphql",
|
|
35
|
+
".toml", ".ini", ".cfg", ".cmake", ".md", ".mdx", ".rst", ".txt", ".xml", ".graphql",
|
|
31
36
|
".gql", ".proto", ".tf", ".hcl", ".dockerfile",
|
|
32
37
|
".vue", ".svelte", ".astro", ".dart", ".zig", ".lua", ".ex", ".exs", ".sol",
|
|
33
38
|
".prisma", ".nix", ".groovy",
|
|
@@ -135,6 +140,16 @@ def load_repo_config(repo: Path) -> Dict[str, Any]:
|
|
|
135
140
|
try:
|
|
136
141
|
loaded = json.loads(cfg_path.read_text(encoding="utf-8"))
|
|
137
142
|
if isinstance(loaded, dict):
|
|
143
|
+
# Upgrade untouched 1.4.0–1.4.2 legacy auto-written 1.5 MB default seamlessly
|
|
144
|
+
if (
|
|
145
|
+
loaded.get("max_file_bytes") == 1_500_000
|
|
146
|
+
and not loaded.get("exclude")
|
|
147
|
+
and not loaded.get("include")
|
|
148
|
+
and loaded.get("map_budget_tokens", 1500) == 1500
|
|
149
|
+
and loaded.get("use_gitignore", True) is True
|
|
150
|
+
):
|
|
151
|
+
loaded = dict(loaded)
|
|
152
|
+
loaded["max_file_bytes"] = MAX_BYTES_DEFAULT
|
|
138
153
|
cfg.update(loaded)
|
|
139
154
|
except Exception:
|
|
140
155
|
pass
|
|
@@ -156,12 +171,14 @@ def is_ignored(
|
|
|
156
171
|
# Hard secrets (.env, .pem, .key, .tfstate, service-account JSON) can NEVER be included
|
|
157
172
|
if HARD_SECRET_PATH_RE.search(norm):
|
|
158
173
|
return True
|
|
159
|
-
# Explicit config allowlist overrides soft secret names, root build dirs, and gitignore
|
|
174
|
+
# Explicit config allowlist overrides soft secret names, root build/vendor dirs, and gitignore
|
|
160
175
|
explicitly_allowed = any(_matches_gitignore(norm, "", pat) for pat in extra_includes)
|
|
161
176
|
if explicitly_allowed:
|
|
162
177
|
return False
|
|
163
178
|
if parts[0] in ROOT_EXCLUDED_DIRS:
|
|
164
179
|
return True
|
|
180
|
+
if any(p.lower() in VENDOR_EXCLUDED_DIRS or p.lower().startswith("cmake-build-") for p in parts):
|
|
181
|
+
return True
|
|
165
182
|
if is_secret_path(norm):
|
|
166
183
|
return True
|
|
167
184
|
for pat in extra_excludes:
|
|
@@ -180,5 +197,32 @@ def is_ignored(
|
|
|
180
197
|
return ignored
|
|
181
198
|
|
|
182
199
|
|
|
200
|
+
def should_traverse_dir(
|
|
201
|
+
sub_rel: str,
|
|
202
|
+
dirname: str,
|
|
203
|
+
extra_excludes: Sequence[str] = (),
|
|
204
|
+
gitignore_rules: Sequence[Any] = (),
|
|
205
|
+
extra_includes: Sequence[str] = (),
|
|
206
|
+
) -> bool:
|
|
207
|
+
"""Return True if `os.walk` should descend into `sub_rel`, respecting nested `extra_includes`."""
|
|
208
|
+
if dirname == ".." or dirname in EXCLUDED_DIRS:
|
|
209
|
+
return False
|
|
210
|
+
norm = normalize_rel_path(sub_rel)
|
|
211
|
+
for pat in extra_includes:
|
|
212
|
+
p = pat.lstrip("/")
|
|
213
|
+
if _matches_gitignore(norm, "", pat) or p.startswith(norm + "/"):
|
|
214
|
+
return True
|
|
215
|
+
return not is_ignored(norm, extra_excludes, gitignore_rules, extra_includes)
|
|
216
|
+
|
|
217
|
+
|
|
183
218
|
def is_binary_bytes(raw: bytes) -> bool:
|
|
184
219
|
return b"\x00" in raw[:8192]
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def is_minified_blob(raw: bytes, *, min_bytes: int = 250_000, max_avg_line_bytes: int = 500) -> bool:
|
|
223
|
+
"""Detect huge minified/single-line assets so 30k-line handwritten code indexes cleanly without bundle bloat."""
|
|
224
|
+
if len(raw) < min_bytes:
|
|
225
|
+
return False
|
|
226
|
+
sample = raw[:16384]
|
|
227
|
+
newlines = sample.count(b"\n")
|
|
228
|
+
return (len(sample) / max(1, newlines)) > max_avg_line_bytes
|
{agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/idx_indexer.py
RENAMED
|
@@ -23,9 +23,11 @@ from idx_ignore import (
|
|
|
23
23
|
GitIgnoreRule,
|
|
24
24
|
is_binary_bytes,
|
|
25
25
|
is_ignored,
|
|
26
|
+
is_minified_blob,
|
|
26
27
|
load_dir_gitignore,
|
|
27
28
|
load_gitignore_rules,
|
|
28
29
|
load_repo_config,
|
|
30
|
+
should_traverse_dir,
|
|
29
31
|
)
|
|
30
32
|
from idx_parsers import CODE_EXTS, extract_calls, extract_file_metadata, resolve_import_edge
|
|
31
33
|
from idx_workspace import load_workspace_aliases
|
|
@@ -109,6 +111,7 @@ def index(
|
|
|
109
111
|
|
|
110
112
|
seen: Set[str] = set()
|
|
111
113
|
changed_paths: Set[str] = set()
|
|
114
|
+
skipped_large: List[Dict[str, Any]] = []
|
|
112
115
|
changed = unchanged = skipped = 0
|
|
113
116
|
|
|
114
117
|
for dirpath, dirnames, filenames in os.walk(repo, topdown=True, followlinks=False):
|
|
@@ -118,7 +121,7 @@ def index(
|
|
|
118
121
|
gi_rules.extend(load_dir_gitignore(dp, rel_dir))
|
|
119
122
|
dirnames[:] = [
|
|
120
123
|
d for d in sorted(dirnames)
|
|
121
|
-
if
|
|
124
|
+
if should_traverse_dir(f"{rel_dir}/{d}" if rel_dir else d, d, extra_excludes, gi_rules, extra_includes)
|
|
122
125
|
]
|
|
123
126
|
|
|
124
127
|
for fname in sorted(filenames):
|
|
@@ -141,9 +144,13 @@ def index(
|
|
|
141
144
|
continue
|
|
142
145
|
try:
|
|
143
146
|
st = full.stat()
|
|
144
|
-
if not stat.S_ISREG(st.st_mode)
|
|
147
|
+
if not stat.S_ISREG(st.st_mode):
|
|
145
148
|
skipped += 1
|
|
146
149
|
continue
|
|
150
|
+
if st.st_size > max_bytes:
|
|
151
|
+
skipped += 1
|
|
152
|
+
skipped_large.append({"path": rel, "bytes": st.st_size, "reason": "exceeds_max_file_bytes"})
|
|
153
|
+
continue
|
|
147
154
|
raw = full.read_bytes()
|
|
148
155
|
except OSError:
|
|
149
156
|
skipped += 1
|
|
@@ -151,6 +158,10 @@ def index(
|
|
|
151
158
|
if is_binary_bytes(raw):
|
|
152
159
|
skipped += 1
|
|
153
160
|
continue
|
|
161
|
+
if is_minified_blob(raw):
|
|
162
|
+
skipped += 1
|
|
163
|
+
skipped_large.append({"path": rel, "bytes": len(raw), "reason": "minified_blob"})
|
|
164
|
+
continue
|
|
154
165
|
|
|
155
166
|
digest = hashlib.sha256(raw).hexdigest()
|
|
156
167
|
seen.add(rel)
|
|
@@ -183,7 +194,7 @@ def index(
|
|
|
183
194
|
db.execute("DELETE FROM files_fts WHERE path=?", (rel,))
|
|
184
195
|
db.execute("DELETE FROM symbols_fts WHERE path=?", (rel,))
|
|
185
196
|
sym_text = " ".join(f"{s[0]} {s[1]} {s[5]}" for s in syms)
|
|
186
|
-
file_ident = split_identifier_tokens(f"{rel} {sym_text} {content}", max_tokens=
|
|
197
|
+
file_ident = split_identifier_tokens(f"{rel} {sym_text} {content}", max_tokens=2000)
|
|
187
198
|
db.execute("INSERT INTO files_fts(path, summary, symbols_text, content, ident_tokens) VALUES(?,?,?,?,?)", (rel, summary, sym_text, content, file_ident))
|
|
188
199
|
if syms:
|
|
189
200
|
db.executemany(
|
|
@@ -255,7 +266,8 @@ def index(
|
|
|
255
266
|
map_updated = True
|
|
256
267
|
|
|
257
268
|
if not cfg_path.exists() and not cfg_path.is_symlink():
|
|
258
|
-
|
|
269
|
+
init_cfg = {k: v for k, v in cfg.items() if k != "max_file_bytes"}
|
|
270
|
+
atomic_write_text(cfg_path, json.dumps(init_cfg, indent=2) + "\n")
|
|
259
271
|
finally:
|
|
260
272
|
db.close()
|
|
261
273
|
|
|
@@ -263,6 +275,8 @@ def index(
|
|
|
263
275
|
"indexed": total_files, "symbols": total_symbols, "resolved_edges": total_edges,
|
|
264
276
|
"resolved_calls": total_calls, "total_tokens_est": total_tokens, "changed": changed,
|
|
265
277
|
"unchanged": unchanged, "removed": len(removed), "skipped": skipped,
|
|
278
|
+
"skipped_large_count": len(skipped_large),
|
|
279
|
+
"skipped_large": skipped_large[:10],
|
|
266
280
|
"fts5_enabled": has_fts, "git_excluded": git_excluded,
|
|
267
281
|
"map_updated": map_updated, "map_path": str(map_path),
|
|
268
282
|
}
|
{agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/idx_parsers.py
RENAMED
|
@@ -338,10 +338,18 @@ def extract_calls(text: str, lang: str, syms: Sequence[SymbolRow]) -> List[CallR
|
|
|
338
338
|
CODE_EXTS: Set[str] = {
|
|
339
339
|
".py", ".pyi", ".js", ".jsx", ".mjs", ".cjs", ".ts", ".tsx", ".mts", ".cts",
|
|
340
340
|
".java", ".kt", ".kts", ".go", ".rs", ".c", ".h", ".cpp", ".hpp", ".cc", ".hh",
|
|
341
|
+
".cxx", ".hxx", ".inl", ".ipp", ".ixx", ".cppm", ".m", ".mm", ".cu", ".cuh",
|
|
342
|
+
".glsl", ".vert", ".frag", ".comp", ".geom", ".tesc", ".tese", ".hlsl", ".hlsli", ".wgsl", ".metal",
|
|
341
343
|
".cs", ".php", ".rb", ".swift", ".scala",
|
|
342
344
|
".vue", ".svelte", ".astro", ".dart", ".zig", ".lua", ".ex", ".exs", ".sol", ".groovy",
|
|
343
345
|
}
|
|
344
346
|
|
|
347
|
+
_C_LIKE_LANGS: Set[str] = {
|
|
348
|
+
"java", "kt", "kts", "cs", "swift", "cpp", "cxx", "cc", "c", "h", "hpp", "hxx", "hh",
|
|
349
|
+
"inl", "ipp", "ixx", "cppm", "m", "mm", "cu", "cuh", "php", "scala", "dart", "sol", "groovy",
|
|
350
|
+
"glsl", "vert", "frag", "comp", "geom", "tesc", "tese", "hlsl", "hlsli", "wgsl", "metal",
|
|
351
|
+
}
|
|
352
|
+
|
|
345
353
|
_JS_TS_SYM: Tuple[Tuple[str, re.Pattern[str]], ...] = (
|
|
346
354
|
("class", re.compile(r"^\s*(?:export\s+(?:default\s+)?)?(?:abstract\s+)?class\s+([A-Za-z_$][\w$]*)")),
|
|
347
355
|
("interface", re.compile(r"^\s*(?:export\s+)?interface\s+([A-Za-z_$][\w$]*)")),
|
|
@@ -373,7 +381,13 @@ _C_LIKE_SYM = (
|
|
|
373
381
|
("class", re.compile(r"^\s*(?:public|private|protected|internal|final|abstract|sealed|data|open|static|\s)*(?:class|interface|struct|enum|protocol|record|actor)\s+([A-Za-z_]\w*)")),
|
|
374
382
|
("function", re.compile(r"^\s*(?:(?:public|private|protected|internal|static|final|override|virtual|inline|extern|async|suspend|fun|func|def|fn)\s+)*[A-Za-z_][\w<>,\[\]*&?:]*\s+([A-Za-z_]\w*)\s*\([^;]*\)\s*(?:->\s*[^\{]+)?\s*\{")),
|
|
375
383
|
)
|
|
384
|
+
_C_LIKE_TYPE_RE = _C_LIKE_SYM[0][1]
|
|
385
|
+
_C_FUNC_HEAD_RE = re.compile(
|
|
386
|
+
r"^\s*(?:[^=;\n{}()]+?\s+)?([A-Za-z_~]\w*(?:::[A-Za-z_~]\w*)*)\s*\("
|
|
387
|
+
)
|
|
376
388
|
_CTRL_KW = {"if", "for", "foreach", "while", "switch", "catch", "return", "else", "synchronized", "using", "lock", "try", "do", "new", "throw", "case"}
|
|
389
|
+
_C_NON_FUNC_KW = _CTRL_KW | {"static_assert", "decltype", "sizeof", "alignof", "typeof", "defined", "layout"}
|
|
390
|
+
_CMAKE_SYM_RE = re.compile(r"^\s*(function|macro)\s*\(\s*([A-Za-z_][\w-]*)", re.IGNORECASE)
|
|
377
391
|
_MD_RE = re.compile(r"^(#{1,4})\s+(.+?)\s*#*$")
|
|
378
392
|
_FENCE_RE = re.compile(r"^\s*(`{3,}|~{3,})")
|
|
379
393
|
_JSON_RE, _YAML_RE, _TOML_RE = re.compile(r'^ "([^"]+)":'), re.compile(r"^([A-Za-z0-9_.-]+)\s*:"), re.compile(r"^\[([^\]]+)\]")
|
|
@@ -451,7 +465,7 @@ def _brace_end(lines: List[str], start_idx: int) -> int:
|
|
|
451
465
|
in_block_comment = False
|
|
452
466
|
quote: Optional[str] = None
|
|
453
467
|
|
|
454
|
-
for idx in range(start_idx, min(len(lines), start_idx +
|
|
468
|
+
for idx in range(start_idx, min(len(lines), start_idx + 2000)):
|
|
455
469
|
line = lines[idx]
|
|
456
470
|
i = 0
|
|
457
471
|
n = len(line)
|
|
@@ -508,7 +522,7 @@ def _brace_end(lines: List[str], start_idx: int) -> int:
|
|
|
508
522
|
|
|
509
523
|
def _ruby_end(lines: List[str], start_idx: int) -> int:
|
|
510
524
|
depth = 0
|
|
511
|
-
for idx in range(start_idx, min(len(lines), start_idx +
|
|
525
|
+
for idx in range(start_idx, min(len(lines), start_idx + 2000)):
|
|
512
526
|
stripped = lines[idx].strip()
|
|
513
527
|
if not stripped or stripped.startswith("#"):
|
|
514
528
|
continue
|
|
@@ -619,6 +633,113 @@ def _extract_rust(lines: List[str]) -> Tuple[List[SymbolRow], List[Tuple[str, st
|
|
|
619
633
|
return syms, imports
|
|
620
634
|
|
|
621
635
|
|
|
636
|
+
def _find_c_func_body(lines: Sequence[str], start_idx: int, paren_col: int) -> Optional[Tuple[int, int]]:
|
|
637
|
+
"""Scan up to 8 header lines from `(` to find matching `)` followed by `{` (rejecting `;` declarations/calls)."""
|
|
638
|
+
p_depth = 0
|
|
639
|
+
seen_close = False
|
|
640
|
+
limit = min(len(lines), start_idx + 8)
|
|
641
|
+
for lidx in range(start_idx, limit):
|
|
642
|
+
ln = lines[lidx]
|
|
643
|
+
if lidx > start_idx and ln.lstrip().startswith("#"):
|
|
644
|
+
return None
|
|
645
|
+
col0 = paren_col if lidx == start_idx else 0
|
|
646
|
+
sub = ln[col0:]
|
|
647
|
+
if not seen_close:
|
|
648
|
+
for j, ch in enumerate(sub):
|
|
649
|
+
if ch == "/" and j + 1 < len(sub) and sub[j + 1] == "/":
|
|
650
|
+
break
|
|
651
|
+
if ch == "(":
|
|
652
|
+
p_depth += 1
|
|
653
|
+
elif ch == ")":
|
|
654
|
+
p_depth -= 1
|
|
655
|
+
if p_depth == 0:
|
|
656
|
+
seen_close = True
|
|
657
|
+
tail = sub[j + 1 :].split("//", 1)[0]
|
|
658
|
+
if ";" in tail and ("{" not in tail or tail.index(";") < tail.index("{")):
|
|
659
|
+
return None
|
|
660
|
+
if "{" in tail:
|
|
661
|
+
return lidx, lidx
|
|
662
|
+
break
|
|
663
|
+
else:
|
|
664
|
+
code = sub.split("//", 1)[0]
|
|
665
|
+
if ";" in code and ("{" not in code or code.index(";") < code.index("{")):
|
|
666
|
+
return None
|
|
667
|
+
if "{" in code:
|
|
668
|
+
return lidx, lidx
|
|
669
|
+
return None
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
def _extract_c_like(lines: List[str]) -> Tuple[List[SymbolRow], List[Tuple[str, str]]]:
|
|
673
|
+
"""Extract classes/structs/methods/functions (single- and multi-line) + `#include`/`import`/`using` edges."""
|
|
674
|
+
syms: List[SymbolRow] = []
|
|
675
|
+
imports: List[Tuple[str, str]] = []
|
|
676
|
+
in_blk_comment = False
|
|
677
|
+
skip_until = -1
|
|
678
|
+
|
|
679
|
+
for idx, line in enumerate(lines):
|
|
680
|
+
stripped = line.strip()
|
|
681
|
+
if in_blk_comment:
|
|
682
|
+
if "*/" in stripped:
|
|
683
|
+
in_blk_comment = False
|
|
684
|
+
continue
|
|
685
|
+
if stripped.startswith("/*"):
|
|
686
|
+
if "*/" not in stripped[2:]:
|
|
687
|
+
in_blk_comment = True
|
|
688
|
+
continue
|
|
689
|
+
if not stripped or stripped.startswith("//"):
|
|
690
|
+
continue
|
|
691
|
+
if stripped.startswith("#include") or stripped.startswith("import ") or stripped.startswith("using "):
|
|
692
|
+
mi = re.match(r'^\s*(?:import|using|#include)\s+[<"]?([A-Za-z0-9_./:-]+)[>"]?', line)
|
|
693
|
+
if mi:
|
|
694
|
+
imports.append((mi.group(1), "import"))
|
|
695
|
+
continue
|
|
696
|
+
if stripped.startswith("#") or idx <= skip_until:
|
|
697
|
+
continue
|
|
698
|
+
|
|
699
|
+
mc = _C_LIKE_TYPE_RE.match(line)
|
|
700
|
+
if mc and mc.group(1) not in _CTRL_KW:
|
|
701
|
+
code_part = line.split("//", 1)[0]
|
|
702
|
+
# Skip forward declarations like `struct Foo;` unless opening `{` follows on this or next line
|
|
703
|
+
if ";" in code_part and "{" not in code_part:
|
|
704
|
+
continue
|
|
705
|
+
has_open = "{" in code_part or (idx + 1 < len(lines) and "{" in lines[idx + 1].split("//", 1)[0])
|
|
706
|
+
if has_open:
|
|
707
|
+
brace_ln = idx if "{" in code_part else idx + 1
|
|
708
|
+
end_ln = _brace_end(lines, brace_ln)
|
|
709
|
+
syms.append((mc.group(1), mc.group(1), "class", idx + 1, end_ln, redact_secrets(sanitize_inline(line))[:240], ""))
|
|
710
|
+
continue
|
|
711
|
+
|
|
712
|
+
mf = _C_FUNC_HEAD_RE.match(line)
|
|
713
|
+
if not mf:
|
|
714
|
+
continue
|
|
715
|
+
raw_name = mf.group(1)
|
|
716
|
+
leaf = raw_name.rsplit("::", 1)[-1]
|
|
717
|
+
if leaf in _C_NON_FUNC_KW:
|
|
718
|
+
continue
|
|
719
|
+
prefix = line[: mf.start(1)].strip()
|
|
720
|
+
if any(tok in prefix for tok in (".", "->", "<<", ">>", "?", "return", "throw", "new ", "delete ")):
|
|
721
|
+
continue
|
|
722
|
+
sig_line = line
|
|
723
|
+
if not prefix and "::" not in raw_name:
|
|
724
|
+
if idx == 0:
|
|
725
|
+
continue
|
|
726
|
+
prev = lines[idx - 1].strip()
|
|
727
|
+
if not prev or prev.startswith(("//", "/*", "*", "#")) or prev.endswith((";", "{", "}", ":")):
|
|
728
|
+
continue
|
|
729
|
+
sig_line = f"{prev} {stripped}"
|
|
730
|
+
|
|
731
|
+
found = _find_c_func_body(lines, idx, mf.end() - 1)
|
|
732
|
+
if found is None:
|
|
733
|
+
continue
|
|
734
|
+
hdr_end_idx, brace_idx = found
|
|
735
|
+
end_ln = _brace_end(lines, brace_idx)
|
|
736
|
+
qual = raw_name.replace("::", ".")
|
|
737
|
+
syms.append((leaf, qual, "function", idx + 1, end_ln, redact_secrets(sanitize_inline(sig_line))[:240], ""))
|
|
738
|
+
skip_until = hdr_end_idx
|
|
739
|
+
|
|
740
|
+
return syms, imports
|
|
741
|
+
|
|
742
|
+
|
|
622
743
|
def _extract_non_python(text: str, lang: str) -> Tuple[List[SymbolRow], List[Tuple[str, str]]]:
|
|
623
744
|
lines, syms, imports = text.splitlines(), [], []
|
|
624
745
|
if lang in ("md", "mdx", "rst"):
|
|
@@ -671,20 +792,25 @@ def _extract_non_python(text: str, lang: str) -> Tuple[List[SymbolRow], List[Tup
|
|
|
671
792
|
break
|
|
672
793
|
return syms, imports
|
|
673
794
|
|
|
674
|
-
if lang in
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
795
|
+
if lang in _C_LIKE_LANGS:
|
|
796
|
+
return _extract_c_like(lines)
|
|
797
|
+
if lang in ("cmake", "cmakelists.txt"):
|
|
798
|
+
for idx, line in enumerate(lines):
|
|
799
|
+
mc = _CMAKE_SYM_RE.match(line)
|
|
800
|
+
if mc:
|
|
801
|
+
kind = "function" if mc.group(1).lower() == "function" else "macro"
|
|
802
|
+
end_kw = f"end{kind}"
|
|
803
|
+
end_ln = next((j + 1 for j in range(idx + 1, min(len(lines), idx + 300)) if lines[j].lstrip().lower().startswith(end_kw)), idx + 1)
|
|
804
|
+
syms.append((mc.group(2), mc.group(2), kind, idx + 1, end_ln, redact_secrets(sanitize_inline(line))[:240], ""))
|
|
680
805
|
return syms, imports
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
for
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
806
|
+
if lang in ("sh", "bash", "zsh"):
|
|
807
|
+
patterns = (("function", re.compile(r"^\s*(?:function\s+)?([A-Za-z_]\w*)\s*\(\)\s*\{")),)
|
|
808
|
+
for idx, line in enumerate(lines):
|
|
809
|
+
for kind, pat in patterns:
|
|
810
|
+
m = pat.match(line)
|
|
811
|
+
if m and m.group(1) not in _CTRL_KW:
|
|
812
|
+
syms.append((m.group(1), m.group(1), kind, idx + 1, _brace_end(lines, idx), redact_secrets(sanitize_inline(line))[:240], ""))
|
|
813
|
+
break
|
|
688
814
|
return syms, imports
|
|
689
815
|
|
|
690
816
|
|
{agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/idx_search.py
RENAMED
|
@@ -142,13 +142,16 @@ def search(repo: Path, query: str, limit: int = 8, lang: Optional[str] = None, p
|
|
|
142
142
|
if not row:
|
|
143
143
|
continue
|
|
144
144
|
all_s = db.execute("SELECT name, kind, line, end_line, signature FROM symbols WHERE path=? ORDER BY line", (p,)).fetchall()
|
|
145
|
-
matched =
|
|
145
|
+
matched = sorted(
|
|
146
|
+
[s for s in all_s if any(t in s[0].lower() or t in s[4].lower() for t in terms)],
|
|
147
|
+
key=lambda s: (-sum(1 for t in terms if t in s[0].lower() or t in s[4].lower()), s[2]),
|
|
148
|
+
)
|
|
146
149
|
chosen = (matched + [s for s in all_s if s not in matched])[:8]
|
|
147
150
|
entry = {
|
|
148
151
|
"score": round(sc, 2), "path": p, "language": row[0], "lines": row[1],
|
|
149
152
|
"file_tokens_est": row[2], "summary": row[3],
|
|
150
153
|
"symbols": [{"name": s[0], "kind": s[1], "line": s[2], "end_line": s[3], "signature": s[4]} for s in chosen],
|
|
151
|
-
"snippets": _extract_snippets(row[4], terms),
|
|
154
|
+
"snippets": _extract_snippets(row[4], terms, max_snippets=3 if int(row[1] or 0) > 400 else 2),
|
|
152
155
|
}
|
|
153
156
|
etok = estimate_tokens(json.dumps(entry, ensure_ascii=False))
|
|
154
157
|
if max_tokens is not None and results and (used_tok + etok) > max_tokens:
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"""Regression tests for large-repo, C++/Vulkan, shader, and third_party indexing improvements."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import json
|
|
5
|
+
import sys
|
|
6
|
+
import tempfile
|
|
7
|
+
import unittest
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
ROOT = Path(__file__).resolve().parents[1]
|
|
11
|
+
IDX_SCRIPTS = str(ROOT / "skills" / "local-context-index" / "scripts")
|
|
12
|
+
if IDX_SCRIPTS not in sys.path:
|
|
13
|
+
sys.path.insert(0, IDX_SCRIPTS)
|
|
14
|
+
|
|
15
|
+
import idx_ignore # noqa: E402
|
|
16
|
+
import idx_indexer # noqa: E402
|
|
17
|
+
import idx_parsers # noqa: E402
|
|
18
|
+
import idx_search # noqa: E402
|
|
19
|
+
import idx_slice # noqa: E402
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class TestLargeRepoIndexing(unittest.TestCase):
|
|
23
|
+
def test_1_shader_extensions_and_glsl_wgsl_cmake_symbols(self):
|
|
24
|
+
with tempfile.TemporaryDirectory() as td:
|
|
25
|
+
repo = Path(td)
|
|
26
|
+
sh = repo / "engine" / "shaders"
|
|
27
|
+
sh.mkdir(parents=True)
|
|
28
|
+
(sh / "mgs_surface_effects.glsl").write_text(
|
|
29
|
+
"float mgs_segment_distance(vec2 p, vec2 a, vec2 b) {\n"
|
|
30
|
+
" vec2 ab = b - a;\n"
|
|
31
|
+
" return length(p - a - ab * clamp(dot(p - a, ab), 0.0, 1.0));\n"
|
|
32
|
+
"}\n\n"
|
|
33
|
+
"float mgs_particle_intersection(int kind, vec2 p, float sceneDepth) {\n"
|
|
34
|
+
" if (kind == 4) {\n"
|
|
35
|
+
" return sceneDepth * 0.5;\n"
|
|
36
|
+
" }\n"
|
|
37
|
+
" return 0.0;\n"
|
|
38
|
+
"}\n",
|
|
39
|
+
encoding="utf-8",
|
|
40
|
+
)
|
|
41
|
+
(sh / "replay_semi_textured.frag").write_text(
|
|
42
|
+
"#version 450\n"
|
|
43
|
+
"vec4 apply_tanker_fog(vec3 color, float depth) {\n"
|
|
44
|
+
" return vec4(color * depth, 1.0);\n"
|
|
45
|
+
"}\n",
|
|
46
|
+
encoding="utf-8",
|
|
47
|
+
)
|
|
48
|
+
(sh / "post.wgsl").write_text(
|
|
49
|
+
"fn fragment_main(uv: vec2<f32>) -> vec4<f32> {\n"
|
|
50
|
+
" return vec4<f32>(uv, 0.0, 1.0);\n"
|
|
51
|
+
"}\n",
|
|
52
|
+
encoding="utf-8",
|
|
53
|
+
)
|
|
54
|
+
(repo / "cmake").mkdir()
|
|
55
|
+
(repo / "cmake" / "shaders.cmake").write_text(
|
|
56
|
+
"function(compile_spv_shader TARGET_NAME)\n"
|
|
57
|
+
" message(STATUS \"compiling ${TARGET_NAME}\")\n"
|
|
58
|
+
"endfunction()\n",
|
|
59
|
+
encoding="utf-8",
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
res = idx_indexer.index(repo, force=True)
|
|
63
|
+
self.assertEqual(res["indexed"], 4)
|
|
64
|
+
|
|
65
|
+
hits = idx_search.search(repo, "mgs_particle_intersection", limit=5)
|
|
66
|
+
self.assertEqual(hits[0]["path"], "engine/shaders/mgs_surface_effects.glsl")
|
|
67
|
+
self.assertIn("mgs_particle_intersection", [s["name"] for s in hits[0]["symbols"]])
|
|
68
|
+
|
|
69
|
+
frag_hits = idx_search.search(repo, "apply_tanker_fog", limit=5)
|
|
70
|
+
self.assertEqual(frag_hits[0]["path"], "engine/shaders/replay_semi_textured.frag")
|
|
71
|
+
|
|
72
|
+
sl = idx_slice.slice_file(repo, "engine/shaders/mgs_surface_effects.glsl", symbol="mgs_particle_intersection")
|
|
73
|
+
self.assertIn("if (kind == 4)", sl["text"])
|
|
74
|
+
|
|
75
|
+
cmake_syms = idx_search.list_symbols(repo, pattern="compile_spv_shader")
|
|
76
|
+
self.assertEqual(len(cmake_syms), 1)
|
|
77
|
+
self.assertEqual(cmake_syms[0]["line"], 1)
|
|
78
|
+
|
|
79
|
+
def test_2_multiline_cpp_noexcept_and_files_over_1_5mb_with_legacy_config_upgrade(self):
|
|
80
|
+
with tempfile.TemporaryDirectory() as td:
|
|
81
|
+
repo = Path(td)
|
|
82
|
+
src = repo / "engine" / "gpu"
|
|
83
|
+
src.mkdir(parents=True)
|
|
84
|
+
(repo / ".agent-index").mkdir()
|
|
85
|
+
# Simulate an untouched 1.4.1 legacy config.json with max_file_bytes=1500000
|
|
86
|
+
(repo / ".agent-index" / "config.json").write_text(
|
|
87
|
+
json.dumps({
|
|
88
|
+
"exclude": [],
|
|
89
|
+
"include": [],
|
|
90
|
+
"max_file_bytes": 1500000,
|
|
91
|
+
"map_budget_tokens": 1500,
|
|
92
|
+
"use_gitignore": True,
|
|
93
|
+
"auto_git_exclude": True,
|
|
94
|
+
}),
|
|
95
|
+
encoding="utf-8",
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
filler = "// padding line for large handwritten Vulkan renderer simulation 0123456789\n" * 21500
|
|
99
|
+
cpp_body = (
|
|
100
|
+
'#include "renderer_vulkan.h"\n\n'
|
|
101
|
+
+ filler
|
|
102
|
+
+ "\nbool validDisplayScanoutPlan(const DisplayScanoutPlan &plan) noexcept {\n"
|
|
103
|
+
" return plan.width > 0;\n"
|
|
104
|
+
"}\n\n"
|
|
105
|
+
"uint64_t hashCrash3PresentationDrawState(\n"
|
|
106
|
+
" uint64_t state,\n"
|
|
107
|
+
" bool first,\n"
|
|
108
|
+
" bool second) noexcept {\n"
|
|
109
|
+
" if (first && second) {\n"
|
|
110
|
+
" return state ^ 1;\n"
|
|
111
|
+
" }\n"
|
|
112
|
+
" return state;\n"
|
|
113
|
+
"}\n\n"
|
|
114
|
+
"std::vector<VkImage>\n"
|
|
115
|
+
"diagnosticApertureForScanout(const DisplayScanoutPlan &plan) noexcept {\n"
|
|
116
|
+
" return {};\n"
|
|
117
|
+
"}\n\n"
|
|
118
|
+
"DisplayRenderer::DisplayRenderer(VkDevice dev) : device_(dev) {\n"
|
|
119
|
+
" init();\n"
|
|
120
|
+
"}\n"
|
|
121
|
+
)
|
|
122
|
+
vk_path = src / "renderer_vulkan.cpp"
|
|
123
|
+
vk_path.write_text(cpp_body, encoding="utf-8")
|
|
124
|
+
self.assertGreater(vk_path.stat().st_size, 1_510_000)
|
|
125
|
+
|
|
126
|
+
res = idx_indexer.index(repo, force=True)
|
|
127
|
+
self.assertEqual(res["indexed"], 1)
|
|
128
|
+
self.assertEqual(res["skipped_large_count"], 0)
|
|
129
|
+
|
|
130
|
+
sym_names = {s["qualified_name"] for s in idx_search.list_symbols(repo, limit=20)}
|
|
131
|
+
self.assertIn("validDisplayScanoutPlan", sym_names)
|
|
132
|
+
self.assertIn("hashCrash3PresentationDrawState", sym_names)
|
|
133
|
+
self.assertIn("diagnosticApertureForScanout", sym_names)
|
|
134
|
+
self.assertIn("DisplayRenderer.DisplayRenderer", sym_names)
|
|
135
|
+
|
|
136
|
+
sl = idx_slice.slice_file(repo, "engine/gpu/renderer_vulkan.cpp", symbol="hashCrash3PresentationDrawState")
|
|
137
|
+
self.assertIn("return state ^ 1;", sl["text"])
|
|
138
|
+
|
|
139
|
+
def test_3_nested_third_party_pruned_minified_skipped_and_include_override(self):
|
|
140
|
+
with tempfile.TemporaryDirectory() as td:
|
|
141
|
+
repo = Path(td)
|
|
142
|
+
(repo / "src").mkdir()
|
|
143
|
+
(repo / "src" / "main.cpp").write_text("int main() { return 0; }\n", encoding="utf-8")
|
|
144
|
+
(repo / "src" / "vendor_bundle.min.js").write_text("var x=1;" * 40000, encoding="utf-8")
|
|
145
|
+
(repo / "engine" / "third_party" / "SDL").mkdir(parents=True)
|
|
146
|
+
(repo / "engine" / "third_party" / "SDL" / "sdl.c").write_text("void SDL_Init() {}\n", encoding="utf-8")
|
|
147
|
+
(repo / "engine" / "third_party" / "custom").mkdir(parents=True)
|
|
148
|
+
(repo / "engine" / "third_party" / "custom" / "patch.cpp").write_text("void mgsPatch() {}\n", encoding="utf-8")
|
|
149
|
+
(repo / "cmake-build-debug").mkdir()
|
|
150
|
+
(repo / "cmake-build-debug" / "gen.cpp").write_text("void generated() {}\n", encoding="utf-8")
|
|
151
|
+
|
|
152
|
+
res = idx_indexer.index(repo, force=True)
|
|
153
|
+
self.assertEqual(res["indexed"], 1)
|
|
154
|
+
self.assertEqual(res["skipped_large_count"], 1)
|
|
155
|
+
self.assertEqual(res["skipped_large"][0]["path"], "src/vendor_bundle.min.js")
|
|
156
|
+
self.assertEqual(res["skipped_large"][0]["reason"], "minified_blob")
|
|
157
|
+
|
|
158
|
+
# Explicit config include overrides nested third_party exclusion
|
|
159
|
+
(repo / ".agent-index" / "config.json").write_text(
|
|
160
|
+
json.dumps({"include": ["engine/third_party/custom/**"]}),
|
|
161
|
+
encoding="utf-8",
|
|
162
|
+
)
|
|
163
|
+
res2 = idx_indexer.index(repo, force=True)
|
|
164
|
+
self.assertEqual(res2["indexed"], 2)
|
|
165
|
+
self.assertEqual(len(idx_search.list_symbols(repo, pattern="mgsPatch")), 1)
|
|
166
|
+
self.assertEqual(len(idx_search.list_symbols(repo, pattern="SDL_Init")), 0)
|
|
167
|
+
|
|
168
|
+
def test_4_search_ranks_multi_term_symbols_first_on_large_files(self):
|
|
169
|
+
with tempfile.TemporaryDirectory() as td:
|
|
170
|
+
repo = Path(td)
|
|
171
|
+
lines = ["#header\n"]
|
|
172
|
+
for idx in range(12):
|
|
173
|
+
lines.append(f"void helperTanker_{idx}() {{\n int a = {idx};\n}}\n")
|
|
174
|
+
lines.append("void fixTankerGlitchPass() {\n int ok = 1;\n}\n")
|
|
175
|
+
lines.extend(["// filler line\n" * 420])
|
|
176
|
+
(repo / "pass.cpp").write_text("".join(lines), encoding="utf-8")
|
|
177
|
+
|
|
178
|
+
idx_indexer.index(repo, force=True)
|
|
179
|
+
hits = idx_search.search(repo, "tanker glitch", limit=3)
|
|
180
|
+
self.assertEqual(hits[0]["symbols"][0]["name"], "fixTankerGlitchPass")
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
if __name__ == "__main__":
|
|
184
|
+
unittest.main()
|
|
@@ -351,7 +351,7 @@ class TestSchlagerUpgrades(unittest.TestCase):
|
|
|
351
351
|
|
|
352
352
|
# Python package entrypoint (`python3 -m agent_efficiency.cli --version`)
|
|
353
353
|
r_pkg = subprocess.run([sys.executable, "-m", "agent_efficiency.cli", "--version"], cwd=ROOT, capture_output=True, text=True, check=True)
|
|
354
|
-
self.assertIn("ae 1.4.
|
|
354
|
+
self.assertIn("ae 1.4.3", r_pkg.stdout)
|
|
355
355
|
|
|
356
356
|
# Real-repo benchmark fidelity checks pass on this repo
|
|
357
357
|
rb = benchmark_efficiency.run_real_repo_benchmark(ROOT)
|
|
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
|
{agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/adaptive-orchestration-handoff/SKILL.md
RENAMED
|
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
|
{agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/compact_run.py
RENAMED
|
File without changes
|
|
File without changes
|
{agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/idx_lsp.py
RENAMED
|
File without changes
|
{agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/idx_slice.py
RENAMED
|
File without changes
|
{agent_efficiency-1.4.2 → agent_efficiency-1.4.3}/skills/local-context-index/scripts/idx_trace.py
RENAMED
|
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
|