claude-ctx 0.5.0rc1__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.
- claude_ctx-0.5.0rc1/LICENSE +21 -0
- claude_ctx-0.5.0rc1/PKG-INFO +68 -0
- claude_ctx-0.5.0rc1/README.md +41 -0
- claude_ctx-0.5.0rc1/pyproject.toml +59 -0
- claude_ctx-0.5.0rc1/setup.cfg +4 -0
- claude_ctx-0.5.0rc1/src/claude_ctx.egg-info/PKG-INFO +68 -0
- claude_ctx-0.5.0rc1/src/claude_ctx.egg-info/SOURCES.txt +70 -0
- claude_ctx-0.5.0rc1/src/claude_ctx.egg-info/dependency_links.txt +1 -0
- claude_ctx-0.5.0rc1/src/claude_ctx.egg-info/entry_points.txt +5 -0
- claude_ctx-0.5.0rc1/src/claude_ctx.egg-info/requires.txt +14 -0
- claude_ctx-0.5.0rc1/src/claude_ctx.egg-info/top_level.txt +1 -0
- claude_ctx-0.5.0rc1/src/tests/__init__.py +0 -0
- claude_ctx-0.5.0rc1/src/tests/_wiki_helpers.py +117 -0
- claude_ctx-0.5.0rc1/src/tests/conftest.py +183 -0
- claude_ctx-0.5.0rc1/src/tests/test_backup_config.py +213 -0
- claude_ctx-0.5.0rc1/src/tests/test_backup_mirror.py +400 -0
- claude_ctx-0.5.0rc1/src/tests/test_backup_retention.py +317 -0
- claude_ctx-0.5.0rc1/src/tests/test_backup_watchdog.py +226 -0
- claude_ctx-0.5.0rc1/src/tests/test_batch_convert.py +501 -0
- claude_ctx-0.5.0rc1/src/tests/test_behavior_miner.py +389 -0
- claude_ctx-0.5.0rc1/src/tests/test_config.py +330 -0
- claude_ctx-0.5.0rc1/src/tests/test_context_monitor.py +357 -0
- claude_ctx-0.5.0rc1/src/tests/test_corpus_cache.py +333 -0
- claude_ctx-0.5.0rc1/src/tests/test_cosine_ranker.py +229 -0
- claude_ctx-0.5.0rc1/src/tests/test_council_runner.py +209 -0
- claude_ctx-0.5.0rc1/src/tests/test_ctx_lifecycle.py +618 -0
- claude_ctx-0.5.0rc1/src/tests/test_ctx_lifecycle_auto.py +217 -0
- claude_ctx-0.5.0rc1/src/tests/test_embedding_backend.py +341 -0
- claude_ctx-0.5.0rc1/src/tests/test_flatten_agents.py +107 -0
- claude_ctx-0.5.0rc1/src/tests/test_fs_utils.py +173 -0
- claude_ctx-0.5.0rc1/src/tests/test_graph_json_integrity.py +84 -0
- claude_ctx-0.5.0rc1/src/tests/test_inject_hooks_security.py +285 -0
- claude_ctx-0.5.0rc1/src/tests/test_intake_gate.py +429 -0
- claude_ctx-0.5.0rc1/src/tests/test_intake_pipeline.py +365 -0
- claude_ctx-0.5.0rc1/src/tests/test_intent_interview.py +453 -0
- claude_ctx-0.5.0rc1/src/tests/test_kpi_dashboard.py +550 -0
- claude_ctx-0.5.0rc1/src/tests/test_link_conversions.py +448 -0
- claude_ctx-0.5.0rc1/src/tests/test_lint.py +189 -0
- claude_ctx-0.5.0rc1/src/tests/test_memory_anchor.py +389 -0
- claude_ctx-0.5.0rc1/src/tests/test_orchestrator.py +152 -0
- claude_ctx-0.5.0rc1/src/tests/test_quality_hook.py +165 -0
- claude_ctx-0.5.0rc1/src/tests/test_query.py +106 -0
- claude_ctx-0.5.0rc1/src/tests/test_resolve_skills.py +347 -0
- claude_ctx-0.5.0rc1/src/tests/test_scan_repo.py +662 -0
- claude_ctx-0.5.0rc1/src/tests/test_security_hardening.py +148 -0
- claude_ctx-0.5.0rc1/src/tests/test_similarity_precision_recall.py +305 -0
- claude_ctx-0.5.0rc1/src/tests/test_skill_add.py +669 -0
- claude_ctx-0.5.0rc1/src/tests/test_skill_add_detector.py +127 -0
- claude_ctx-0.5.0rc1/src/tests/test_skill_add_detector_md_escape.py +51 -0
- claude_ctx-0.5.0rc1/src/tests/test_skill_add_yaml_escape.py +73 -0
- claude_ctx-0.5.0rc1/src/tests/test_skill_category.py +264 -0
- claude_ctx-0.5.0rc1/src/tests/test_skill_health.py +622 -0
- claude_ctx-0.5.0rc1/src/tests/test_skill_loader.py +99 -0
- claude_ctx-0.5.0rc1/src/tests/test_skill_loader_telemetry.py +116 -0
- claude_ctx-0.5.0rc1/src/tests/test_skill_quality.py +1068 -0
- claude_ctx-0.5.0rc1/src/tests/test_skill_quality_bench.py +125 -0
- claude_ctx-0.5.0rc1/src/tests/test_skill_quality_list.py +137 -0
- claude_ctx-0.5.0rc1/src/tests/test_skill_quality_nested_agents.py +127 -0
- claude_ctx-0.5.0rc1/src/tests/test_skill_telemetry.py +329 -0
- claude_ctx-0.5.0rc1/src/tests/test_skill_unload.py +108 -0
- claude_ctx-0.5.0rc1/src/tests/test_snapshot_if_changed.py +213 -0
- claude_ctx-0.5.0rc1/src/tests/test_toolbox_cli.py +159 -0
- claude_ctx-0.5.0rc1/src/tests/test_toolbox_config.py +194 -0
- claude_ctx-0.5.0rc1/src/tests/test_toolbox_hooks.py +438 -0
- claude_ctx-0.5.0rc1/src/tests/test_toolbox_verdict.py +436 -0
- claude_ctx-0.5.0rc1/src/tests/test_usage_tracker.py +339 -0
- claude_ctx-0.5.0rc1/src/tests/test_wiki.py +320 -0
- claude_ctx-0.5.0rc1/src/tests/test_wiki_graphify_bench.py +169 -0
- claude_ctx-0.5.0rc1/src/tests/test_wiki_graphify_quality.py +96 -0
- claude_ctx-0.5.0rc1/src/tests/test_wiki_orchestrator_security.py +177 -0
- claude_ctx-0.5.0rc1/src/tests/test_wiki_utils.py +486 -0
- claude_ctx-0.5.0rc1/src/tests/test_wiki_visualize.py +89 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Steve Solun
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: claude-ctx
|
|
3
|
+
Version: 0.5.0rc1
|
|
4
|
+
Summary: Skill and agent recommendation system for Claude Code — knowledge graph, wiki, and intake quality gates
|
|
5
|
+
Author: Steve Solun
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://stevesolun.github.io/ctx/
|
|
8
|
+
Project-URL: Repository, https://github.com/stevesolun/ctx
|
|
9
|
+
Project-URL: Documentation, https://stevesolun.github.io/ctx/
|
|
10
|
+
Project-URL: Changelog, https://github.com/stevesolun/ctx/blob/main/CHANGELOG.md
|
|
11
|
+
Requires-Python: >=3.11
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: networkx<4,>=3
|
|
15
|
+
Requires-Dist: numpy<3,>=1.24
|
|
16
|
+
Requires-Dist: plotly<7,>=5
|
|
17
|
+
Requires-Dist: pyyaml<7,>=6
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
20
|
+
Requires-Dist: pytest-cov>=5; extra == "dev"
|
|
21
|
+
Requires-Dist: mypy>=1.8; extra == "dev"
|
|
22
|
+
Requires-Dist: ruff>=0.4; extra == "dev"
|
|
23
|
+
Provides-Extra: embeddings
|
|
24
|
+
Requires-Dist: sentence-transformers<4,>=2; extra == "embeddings"
|
|
25
|
+
Requires-Dist: torch<3,>=2; extra == "embeddings"
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# ctx — Skill & Agent Recommendation for Claude Code
|
|
29
|
+
|
|
30
|
+
[](LICENSE)
|
|
31
|
+
[](https://python.org)
|
|
32
|
+
[](https://pypi.org/project/claude-ctx/)
|
|
33
|
+
[](#)
|
|
34
|
+
[](https://stevesolun.github.io/ctx/)
|
|
35
|
+
|
|
36
|
+
Watches what you develop, walks a knowledge graph of **1,768 skills and 443 agents**, and recommends the right ones on the fly — you decide what to load and unload. Powered by a Karpathy LLM wiki with persistent memory that gets smarter every session.
|
|
37
|
+
|
|
38
|
+
## Why it exists
|
|
39
|
+
|
|
40
|
+
- **Discovery** — with 1,700+ skills and 400+ agents, you can't possibly know which exist or which apply to your current repo.
|
|
41
|
+
- **Context budget** — loading everything wastes tokens and degrades quality. You need the right 10–15 per session.
|
|
42
|
+
- **Skill rot** — skills you installed months ago and never used are cluttering context. Stale ones should be flagged automatically.
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install claude-ctx
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
That's it. Optional extras: `pip install "claude-ctx[embeddings]"` for the semantic backend, `pip install "claude-ctx[dev]"` for the test toolchain.
|
|
51
|
+
|
|
52
|
+
## Use
|
|
53
|
+
|
|
54
|
+
After install, the `ctx` hooks integrate automatically with Claude Code's `PostToolUse` + `Stop` events. Typical flow:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
ctx-scan-repo # scan current repo, surface recommended skills/agents
|
|
58
|
+
ctx-skill-quality list # see the four-signal quality score for every skill
|
|
59
|
+
ctx-skill-quality explain python-patterns # drill into a single skill
|
|
60
|
+
ctx-skill-health dashboard # structural health + drift detection
|
|
61
|
+
ctx-toolbox run review # run a council of skills + agents on the current diff
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Full docs, architecture, and every module: **<https://stevesolun.github.io/ctx/>**
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
68
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# ctx — Skill & Agent Recommendation for Claude Code
|
|
2
|
+
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
[](https://python.org)
|
|
5
|
+
[](https://pypi.org/project/claude-ctx/)
|
|
6
|
+
[](#)
|
|
7
|
+
[](https://stevesolun.github.io/ctx/)
|
|
8
|
+
|
|
9
|
+
Watches what you develop, walks a knowledge graph of **1,768 skills and 443 agents**, and recommends the right ones on the fly — you decide what to load and unload. Powered by a Karpathy LLM wiki with persistent memory that gets smarter every session.
|
|
10
|
+
|
|
11
|
+
## Why it exists
|
|
12
|
+
|
|
13
|
+
- **Discovery** — with 1,700+ skills and 400+ agents, you can't possibly know which exist or which apply to your current repo.
|
|
14
|
+
- **Context budget** — loading everything wastes tokens and degrades quality. You need the right 10–15 per session.
|
|
15
|
+
- **Skill rot** — skills you installed months ago and never used are cluttering context. Stale ones should be flagged automatically.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install claude-ctx
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
That's it. Optional extras: `pip install "claude-ctx[embeddings]"` for the semantic backend, `pip install "claude-ctx[dev]"` for the test toolchain.
|
|
24
|
+
|
|
25
|
+
## Use
|
|
26
|
+
|
|
27
|
+
After install, the `ctx` hooks integrate automatically with Claude Code's `PostToolUse` + `Stop` events. Typical flow:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
ctx-scan-repo # scan current repo, surface recommended skills/agents
|
|
31
|
+
ctx-skill-quality list # see the four-signal quality score for every skill
|
|
32
|
+
ctx-skill-quality explain python-patterns # drill into a single skill
|
|
33
|
+
ctx-skill-health dashboard # structural health + drift detection
|
|
34
|
+
ctx-toolbox run review # run a council of skills + agents on the current diff
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Full docs, architecture, and every module: **<https://stevesolun.github.io/ctx/>**
|
|
38
|
+
|
|
39
|
+
## License
|
|
40
|
+
|
|
41
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=42"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "claude-ctx"
|
|
7
|
+
version = "0.5.0-rc1"
|
|
8
|
+
description = "Skill and agent recommendation system for Claude Code — knowledge graph, wiki, and intake quality gates"
|
|
9
|
+
authors = [{ name = "Steve Solun" }]
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
requires-python = ">=3.11"
|
|
13
|
+
|
|
14
|
+
dependencies = [
|
|
15
|
+
"networkx>=3,<4",
|
|
16
|
+
"numpy>=1.24,<3",
|
|
17
|
+
"plotly>=5,<7",
|
|
18
|
+
"pyyaml>=6,<7",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Homepage = "https://stevesolun.github.io/ctx/"
|
|
23
|
+
Repository = "https://github.com/stevesolun/ctx"
|
|
24
|
+
Documentation = "https://stevesolun.github.io/ctx/"
|
|
25
|
+
Changelog = "https://github.com/stevesolun/ctx/blob/main/CHANGELOG.md"
|
|
26
|
+
|
|
27
|
+
[project.scripts]
|
|
28
|
+
ctx-scan-repo = "scan_repo:main"
|
|
29
|
+
ctx-skill-quality = "skill_quality:main"
|
|
30
|
+
ctx-skill-health = "skill_health:main"
|
|
31
|
+
ctx-toolbox = "toolbox:main"
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
dev = [
|
|
35
|
+
"pytest>=8",
|
|
36
|
+
"pytest-cov>=5",
|
|
37
|
+
"mypy>=1.8",
|
|
38
|
+
"ruff>=0.4",
|
|
39
|
+
]
|
|
40
|
+
embeddings = [
|
|
41
|
+
"sentence-transformers>=2,<4",
|
|
42
|
+
"torch>=2,<3",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[tool.setuptools]
|
|
46
|
+
package-dir = {"" = "src"}
|
|
47
|
+
|
|
48
|
+
[tool.setuptools.packages.find]
|
|
49
|
+
where = ["src"]
|
|
50
|
+
|
|
51
|
+
[tool.pytest.ini_options]
|
|
52
|
+
testpaths = ["src/tests"]
|
|
53
|
+
markers = [
|
|
54
|
+
"integration: marks tests that require external models or network (deselect with -m 'not integration')",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
[tool.ruff]
|
|
58
|
+
line-length = 100
|
|
59
|
+
target-version = "py311"
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: claude-ctx
|
|
3
|
+
Version: 0.5.0rc1
|
|
4
|
+
Summary: Skill and agent recommendation system for Claude Code — knowledge graph, wiki, and intake quality gates
|
|
5
|
+
Author: Steve Solun
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://stevesolun.github.io/ctx/
|
|
8
|
+
Project-URL: Repository, https://github.com/stevesolun/ctx
|
|
9
|
+
Project-URL: Documentation, https://stevesolun.github.io/ctx/
|
|
10
|
+
Project-URL: Changelog, https://github.com/stevesolun/ctx/blob/main/CHANGELOG.md
|
|
11
|
+
Requires-Python: >=3.11
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: networkx<4,>=3
|
|
15
|
+
Requires-Dist: numpy<3,>=1.24
|
|
16
|
+
Requires-Dist: plotly<7,>=5
|
|
17
|
+
Requires-Dist: pyyaml<7,>=6
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
20
|
+
Requires-Dist: pytest-cov>=5; extra == "dev"
|
|
21
|
+
Requires-Dist: mypy>=1.8; extra == "dev"
|
|
22
|
+
Requires-Dist: ruff>=0.4; extra == "dev"
|
|
23
|
+
Provides-Extra: embeddings
|
|
24
|
+
Requires-Dist: sentence-transformers<4,>=2; extra == "embeddings"
|
|
25
|
+
Requires-Dist: torch<3,>=2; extra == "embeddings"
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# ctx — Skill & Agent Recommendation for Claude Code
|
|
29
|
+
|
|
30
|
+
[](LICENSE)
|
|
31
|
+
[](https://python.org)
|
|
32
|
+
[](https://pypi.org/project/claude-ctx/)
|
|
33
|
+
[](#)
|
|
34
|
+
[](https://stevesolun.github.io/ctx/)
|
|
35
|
+
|
|
36
|
+
Watches what you develop, walks a knowledge graph of **1,768 skills and 443 agents**, and recommends the right ones on the fly — you decide what to load and unload. Powered by a Karpathy LLM wiki with persistent memory that gets smarter every session.
|
|
37
|
+
|
|
38
|
+
## Why it exists
|
|
39
|
+
|
|
40
|
+
- **Discovery** — with 1,700+ skills and 400+ agents, you can't possibly know which exist or which apply to your current repo.
|
|
41
|
+
- **Context budget** — loading everything wastes tokens and degrades quality. You need the right 10–15 per session.
|
|
42
|
+
- **Skill rot** — skills you installed months ago and never used are cluttering context. Stale ones should be flagged automatically.
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install claude-ctx
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
That's it. Optional extras: `pip install "claude-ctx[embeddings]"` for the semantic backend, `pip install "claude-ctx[dev]"` for the test toolchain.
|
|
51
|
+
|
|
52
|
+
## Use
|
|
53
|
+
|
|
54
|
+
After install, the `ctx` hooks integrate automatically with Claude Code's `PostToolUse` + `Stop` events. Typical flow:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
ctx-scan-repo # scan current repo, surface recommended skills/agents
|
|
58
|
+
ctx-skill-quality list # see the four-signal quality score for every skill
|
|
59
|
+
ctx-skill-quality explain python-patterns # drill into a single skill
|
|
60
|
+
ctx-skill-health dashboard # structural health + drift detection
|
|
61
|
+
ctx-toolbox run review # run a council of skills + agents on the current diff
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Full docs, architecture, and every module: **<https://stevesolun.github.io/ctx/>**
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
68
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/claude_ctx.egg-info/PKG-INFO
|
|
5
|
+
src/claude_ctx.egg-info/SOURCES.txt
|
|
6
|
+
src/claude_ctx.egg-info/dependency_links.txt
|
|
7
|
+
src/claude_ctx.egg-info/entry_points.txt
|
|
8
|
+
src/claude_ctx.egg-info/requires.txt
|
|
9
|
+
src/claude_ctx.egg-info/top_level.txt
|
|
10
|
+
src/tests/__init__.py
|
|
11
|
+
src/tests/_wiki_helpers.py
|
|
12
|
+
src/tests/conftest.py
|
|
13
|
+
src/tests/test_backup_config.py
|
|
14
|
+
src/tests/test_backup_mirror.py
|
|
15
|
+
src/tests/test_backup_retention.py
|
|
16
|
+
src/tests/test_backup_watchdog.py
|
|
17
|
+
src/tests/test_batch_convert.py
|
|
18
|
+
src/tests/test_behavior_miner.py
|
|
19
|
+
src/tests/test_config.py
|
|
20
|
+
src/tests/test_context_monitor.py
|
|
21
|
+
src/tests/test_corpus_cache.py
|
|
22
|
+
src/tests/test_cosine_ranker.py
|
|
23
|
+
src/tests/test_council_runner.py
|
|
24
|
+
src/tests/test_ctx_lifecycle.py
|
|
25
|
+
src/tests/test_ctx_lifecycle_auto.py
|
|
26
|
+
src/tests/test_embedding_backend.py
|
|
27
|
+
src/tests/test_flatten_agents.py
|
|
28
|
+
src/tests/test_fs_utils.py
|
|
29
|
+
src/tests/test_graph_json_integrity.py
|
|
30
|
+
src/tests/test_inject_hooks_security.py
|
|
31
|
+
src/tests/test_intake_gate.py
|
|
32
|
+
src/tests/test_intake_pipeline.py
|
|
33
|
+
src/tests/test_intent_interview.py
|
|
34
|
+
src/tests/test_kpi_dashboard.py
|
|
35
|
+
src/tests/test_link_conversions.py
|
|
36
|
+
src/tests/test_lint.py
|
|
37
|
+
src/tests/test_memory_anchor.py
|
|
38
|
+
src/tests/test_orchestrator.py
|
|
39
|
+
src/tests/test_quality_hook.py
|
|
40
|
+
src/tests/test_query.py
|
|
41
|
+
src/tests/test_resolve_skills.py
|
|
42
|
+
src/tests/test_scan_repo.py
|
|
43
|
+
src/tests/test_security_hardening.py
|
|
44
|
+
src/tests/test_similarity_precision_recall.py
|
|
45
|
+
src/tests/test_skill_add.py
|
|
46
|
+
src/tests/test_skill_add_detector.py
|
|
47
|
+
src/tests/test_skill_add_detector_md_escape.py
|
|
48
|
+
src/tests/test_skill_add_yaml_escape.py
|
|
49
|
+
src/tests/test_skill_category.py
|
|
50
|
+
src/tests/test_skill_health.py
|
|
51
|
+
src/tests/test_skill_loader.py
|
|
52
|
+
src/tests/test_skill_loader_telemetry.py
|
|
53
|
+
src/tests/test_skill_quality.py
|
|
54
|
+
src/tests/test_skill_quality_bench.py
|
|
55
|
+
src/tests/test_skill_quality_list.py
|
|
56
|
+
src/tests/test_skill_quality_nested_agents.py
|
|
57
|
+
src/tests/test_skill_telemetry.py
|
|
58
|
+
src/tests/test_skill_unload.py
|
|
59
|
+
src/tests/test_snapshot_if_changed.py
|
|
60
|
+
src/tests/test_toolbox_cli.py
|
|
61
|
+
src/tests/test_toolbox_config.py
|
|
62
|
+
src/tests/test_toolbox_hooks.py
|
|
63
|
+
src/tests/test_toolbox_verdict.py
|
|
64
|
+
src/tests/test_usage_tracker.py
|
|
65
|
+
src/tests/test_wiki.py
|
|
66
|
+
src/tests/test_wiki_graphify_bench.py
|
|
67
|
+
src/tests/test_wiki_graphify_quality.py
|
|
68
|
+
src/tests/test_wiki_orchestrator_security.py
|
|
69
|
+
src/tests/test_wiki_utils.py
|
|
70
|
+
src/tests/test_wiki_visualize.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
tests
|
|
File without changes
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"""
|
|
2
|
+
_wiki_helpers.py -- Shared helpers for wiki_query, wiki_lint, and wiki_orchestrator tests.
|
|
3
|
+
|
|
4
|
+
Exports:
|
|
5
|
+
- Schema / date constants (_SCHEMA_TAGS, _MINIMAL_SCHEMA, _TODAY, _FRESH_DATE, _STALE_DATE)
|
|
6
|
+
- make_wiki(tmp_path): build the minimal wiki skeleton used by every test
|
|
7
|
+
- make_entity_page(...): write a properly-formatted entity page to the wiki
|
|
8
|
+
|
|
9
|
+
Kept out of conftest.py because these are builders, not pytest fixtures.
|
|
10
|
+
Leading-underscore module name signals "internal to the tests package".
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
from typing import Any
|
|
17
|
+
|
|
18
|
+
_SCHEMA_TAGS = (
|
|
19
|
+
"python", "fastapi", "docker", "testing", "architecture",
|
|
20
|
+
"patterns", "cli", "database", "async", "security",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
_MINIMAL_SCHEMA = """\
|
|
24
|
+
# Skill Wiki Schema
|
|
25
|
+
|
|
26
|
+
## Domain
|
|
27
|
+
Skills are reusable knowledge units.
|
|
28
|
+
|
|
29
|
+
## Conventions
|
|
30
|
+
Follow the naming convention: kebab-case slugs.
|
|
31
|
+
|
|
32
|
+
## Tag Taxonomy
|
|
33
|
+
- python: python, fastapi, testing, async
|
|
34
|
+
- infra: docker, kubernetes, ci-cd
|
|
35
|
+
- design: architecture, patterns, cli, database, security
|
|
36
|
+
|
|
37
|
+
## Page Thresholds
|
|
38
|
+
MAX_PAGE_LINES: 200
|
|
39
|
+
|
|
40
|
+
## Update Policy
|
|
41
|
+
Pages older than 90 days are considered stale.
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
_TODAY = "2026-04-09"
|
|
45
|
+
_FRESH_DATE = "2026-03-01" # ~39 days before TODAY -- not stale
|
|
46
|
+
_STALE_DATE = "2024-01-01" # >90 days before TODAY -- stale
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def make_wiki(tmp_path: Path) -> Path:
|
|
50
|
+
"""Create the minimal wiki skeleton (SCHEMA.md, index.md, log.md, entities/skills/)."""
|
|
51
|
+
wiki = tmp_path / "skill-wiki"
|
|
52
|
+
(wiki / "entities" / "skills").mkdir(parents=True)
|
|
53
|
+
(wiki / "SCHEMA.md").write_text(_MINIMAL_SCHEMA, encoding="utf-8")
|
|
54
|
+
(wiki / "index.md").write_text("# Index\n\n## Skills\n", encoding="utf-8")
|
|
55
|
+
(wiki / "log.md").write_text("# Log\n", encoding="utf-8")
|
|
56
|
+
return wiki
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def make_entity_page(
|
|
60
|
+
wiki_dir: Path,
|
|
61
|
+
name: str,
|
|
62
|
+
tags: list[str],
|
|
63
|
+
*,
|
|
64
|
+
body: str = "",
|
|
65
|
+
updated: str = _FRESH_DATE,
|
|
66
|
+
created: str = "2025-01-01",
|
|
67
|
+
status: str = "installed",
|
|
68
|
+
has_pipeline: bool = False,
|
|
69
|
+
wikilinks: list[str] | None = None,
|
|
70
|
+
extra_fm: dict[str, Any] | None = None,
|
|
71
|
+
) -> Path:
|
|
72
|
+
"""Write a properly-formatted entity page to wiki_dir/entities/skills/<name>.md.
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
wiki_dir: Root of the temporary wiki.
|
|
76
|
+
name: Slug (no extension) for the page file.
|
|
77
|
+
tags: Tag list to include in frontmatter.
|
|
78
|
+
body: Markdown body text appended after the frontmatter block.
|
|
79
|
+
updated: ISO date string for the ``updated`` frontmatter key.
|
|
80
|
+
created: ISO date string for the ``created`` frontmatter key.
|
|
81
|
+
status: ``status`` frontmatter value.
|
|
82
|
+
has_pipeline: Whether to write ``has_pipeline: true``.
|
|
83
|
+
wikilinks: Additional ``[[wikilink]]`` tokens injected into the body.
|
|
84
|
+
extra_fm: Extra key/value pairs merged into frontmatter.
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
Path to the written file.
|
|
88
|
+
"""
|
|
89
|
+
tags_str = "[" + ", ".join(tags) + "]"
|
|
90
|
+
fm_lines = [
|
|
91
|
+
"---",
|
|
92
|
+
f"title: {name}",
|
|
93
|
+
f"created: {created}",
|
|
94
|
+
f"updated: {updated}",
|
|
95
|
+
"type: skill",
|
|
96
|
+
f"tags: {tags_str}",
|
|
97
|
+
f"status: {status}",
|
|
98
|
+
]
|
|
99
|
+
if has_pipeline:
|
|
100
|
+
# wiki_query reads `has_transformed` to populate SkillPage.has_transformed;
|
|
101
|
+
# wiki_orchestrator reads `has_pipeline` for its frontmatter checks.
|
|
102
|
+
# Write both so both modules see the flag correctly.
|
|
103
|
+
fm_lines.append("has_pipeline: true")
|
|
104
|
+
fm_lines.append("has_transformed: true")
|
|
105
|
+
if extra_fm:
|
|
106
|
+
for k, v in extra_fm.items():
|
|
107
|
+
fm_lines.append(f"{k}: {v}")
|
|
108
|
+
fm_lines.append("---")
|
|
109
|
+
|
|
110
|
+
link_block = ""
|
|
111
|
+
if wikilinks:
|
|
112
|
+
link_block = "\n" + "\n".join(f"[[{lnk}]]" for lnk in wikilinks) + "\n"
|
|
113
|
+
|
|
114
|
+
content = "\n".join(fm_lines) + "\n\n" + body + link_block
|
|
115
|
+
dest = wiki_dir / "entities" / "skills" / f"{name}.md"
|
|
116
|
+
dest.write_text(content, encoding="utf-8")
|
|
117
|
+
return dest
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"""
|
|
2
|
+
conftest.py -- Shared pytest fixtures for the ctx test suite.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import sys
|
|
6
|
+
import textwrap
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
import pytest
|
|
10
|
+
|
|
11
|
+
# ---------------------------------------------------------------------------
|
|
12
|
+
# Ensure the project root is on sys.path so imports work from any working dir
|
|
13
|
+
# ---------------------------------------------------------------------------
|
|
14
|
+
_PROJECT_ROOT = Path(__file__).resolve().parent.parent
|
|
15
|
+
if str(_PROJECT_ROOT) not in sys.path:
|
|
16
|
+
sys.path.insert(0, str(_PROJECT_ROOT))
|
|
17
|
+
|
|
18
|
+
from wiki_sync import ensure_wiki # noqa: E402 (import after path manipulation)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# ---------------------------------------------------------------------------
|
|
22
|
+
# Markers
|
|
23
|
+
# ---------------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def pytest_configure(config: pytest.Config) -> None:
|
|
27
|
+
"""Register custom markers so pytest doesn't warn on unknown-mark usage.
|
|
28
|
+
|
|
29
|
+
``integration`` is used by tests that load real models (e.g. MiniLM for
|
|
30
|
+
the similarity precision/recall harness). Skip them in fast CI with
|
|
31
|
+
``-m 'not integration'``.
|
|
32
|
+
"""
|
|
33
|
+
config.addinivalue_line(
|
|
34
|
+
"markers",
|
|
35
|
+
"integration: tests that load real embedders or external services "
|
|
36
|
+
"(skip with -m 'not integration')",
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# ---------------------------------------------------------------------------
|
|
41
|
+
# Fixtures
|
|
42
|
+
# ---------------------------------------------------------------------------
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@pytest.fixture()
|
|
46
|
+
def project_root() -> Path:
|
|
47
|
+
"""Return the ctx project root directory as a Path."""
|
|
48
|
+
return _PROJECT_ROOT
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@pytest.fixture()
|
|
52
|
+
def tmp_wiki(tmp_path: Path) -> Path:
|
|
53
|
+
"""
|
|
54
|
+
Create a temporary wiki directory using wiki_sync.ensure_wiki.
|
|
55
|
+
|
|
56
|
+
The returned Path is the wiki root (tmp_path / "skill-wiki").
|
|
57
|
+
All required subdirectories and seed files are created by ensure_wiki.
|
|
58
|
+
"""
|
|
59
|
+
wiki_dir = tmp_path / "skill-wiki"
|
|
60
|
+
ensure_wiki(str(wiki_dir))
|
|
61
|
+
return wiki_dir
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@pytest.fixture()
|
|
65
|
+
def tmp_skills_dir(tmp_path: Path) -> Path:
|
|
66
|
+
"""
|
|
67
|
+
Create a temporary skills directory with three fake SKILL.md files:
|
|
68
|
+
|
|
69
|
+
- short-skill/SKILL.md (~50 lines)
|
|
70
|
+
- medium-skill/SKILL.md (~100 lines)
|
|
71
|
+
- long-skill/SKILL.md (~250 lines)
|
|
72
|
+
"""
|
|
73
|
+
skills_dir = tmp_path / "skills"
|
|
74
|
+
|
|
75
|
+
# ── Short skill (~50 lines) ───────────────────────────────────────────
|
|
76
|
+
short_dir = skills_dir / "short-skill"
|
|
77
|
+
short_dir.mkdir(parents=True)
|
|
78
|
+
short_lines = textwrap.dedent("""\
|
|
79
|
+
---
|
|
80
|
+
title: short-skill
|
|
81
|
+
tags: [python, testing]
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
# Short Skill
|
|
85
|
+
|
|
86
|
+
## Overview
|
|
87
|
+
A short demonstration skill used for testing.
|
|
88
|
+
|
|
89
|
+
## Usage
|
|
90
|
+
Import and call the helper function.
|
|
91
|
+
|
|
92
|
+
## Examples
|
|
93
|
+
```python
|
|
94
|
+
from short_skill import helper
|
|
95
|
+
helper()
|
|
96
|
+
```
|
|
97
|
+
""")
|
|
98
|
+
# Pad to ~50 lines
|
|
99
|
+
short_lines += "\n".join(f"# line {i}" for i in range(1, 35)) + "\n"
|
|
100
|
+
(short_dir / "SKILL.md").write_text(short_lines, encoding="utf-8")
|
|
101
|
+
|
|
102
|
+
# ── Medium skill (~100 lines) ─────────────────────────────────────────
|
|
103
|
+
medium_dir = skills_dir / "medium-skill"
|
|
104
|
+
medium_dir.mkdir(parents=True)
|
|
105
|
+
medium_lines = textwrap.dedent("""\
|
|
106
|
+
---
|
|
107
|
+
title: medium-skill
|
|
108
|
+
tags: [python, fastapi]
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
# Medium Skill
|
|
112
|
+
|
|
113
|
+
## Overview
|
|
114
|
+
A medium-length demonstration skill used for testing.
|
|
115
|
+
|
|
116
|
+
## Background
|
|
117
|
+
Provides patterns for FastAPI service construction.
|
|
118
|
+
|
|
119
|
+
## Usage
|
|
120
|
+
Configure the app factory and mount routers.
|
|
121
|
+
|
|
122
|
+
## Configuration
|
|
123
|
+
Set environment variables before startup.
|
|
124
|
+
|
|
125
|
+
## Examples
|
|
126
|
+
```python
|
|
127
|
+
from medium_skill import create_app
|
|
128
|
+
app = create_app()
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Notes
|
|
132
|
+
Remember to add lifespan handlers.
|
|
133
|
+
""")
|
|
134
|
+
# Pad to ~100 lines
|
|
135
|
+
medium_lines += "\n".join(f"# line {i}" for i in range(1, 73)) + "\n"
|
|
136
|
+
(medium_dir / "SKILL.md").write_text(medium_lines, encoding="utf-8")
|
|
137
|
+
|
|
138
|
+
# ── Long skill (~250 lines) ───────────────────────────────────────────
|
|
139
|
+
long_dir = skills_dir / "long-skill"
|
|
140
|
+
long_dir.mkdir(parents=True)
|
|
141
|
+
long_lines = textwrap.dedent("""\
|
|
142
|
+
---
|
|
143
|
+
title: long-skill
|
|
144
|
+
tags: [python, architecture, patterns]
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
# Long Skill
|
|
148
|
+
|
|
149
|
+
## Overview
|
|
150
|
+
A long demonstration skill used for testing the line_threshold logic.
|
|
151
|
+
|
|
152
|
+
## Stage 1: Discovery
|
|
153
|
+
Locate relevant files in the repository.
|
|
154
|
+
|
|
155
|
+
## Stage 2: Analysis
|
|
156
|
+
Parse and classify each file by type.
|
|
157
|
+
|
|
158
|
+
## Stage 3: Extraction
|
|
159
|
+
Pull out the key patterns and idioms.
|
|
160
|
+
|
|
161
|
+
## Stage 4: Synthesis
|
|
162
|
+
Combine findings into a coherent summary.
|
|
163
|
+
|
|
164
|
+
## Stage 5: Output
|
|
165
|
+
Write the final report to disk.
|
|
166
|
+
|
|
167
|
+
## Configuration Reference
|
|
168
|
+
All options are documented below.
|
|
169
|
+
|
|
170
|
+
## Advanced Usage
|
|
171
|
+
Chain multiple stages for batch processing.
|
|
172
|
+
|
|
173
|
+
## Troubleshooting
|
|
174
|
+
Common issues and their resolutions.
|
|
175
|
+
|
|
176
|
+
## See Also
|
|
177
|
+
Related skills and external references.
|
|
178
|
+
""")
|
|
179
|
+
# Pad to ~250 lines
|
|
180
|
+
long_lines += "\n".join(f"# line {i}" for i in range(1, 210)) + "\n"
|
|
181
|
+
(long_dir / "SKILL.md").write_text(long_lines, encoding="utf-8")
|
|
182
|
+
|
|
183
|
+
return skills_dir
|