feat(uko): add analyzer plugin framework and initial domain analyzers #597

Merged
freemo merged 1 commit from feature/m6-uko-analyzers into master 2026-03-05 19:25:45 +00:00
Owner

Summary

Implements the UKO analyzer plugin framework and two initial domain analyzers per issue #551.

Changes

New Files (9 created, 1 modified)

Core framework (src/cleveragents/domain/models/acms/):

  • analyzers.py (219 lines) — UKOTriple (frozen Pydantic v2 model), AnalyzerProtocol (@runtime_checkable Protocol), AnalyzerRegistry (extension-to-analyzer mapping with register/lookup/list)
  • python_analyzer.py (365 lines) — AST-based Python source analyzer extracting modules, classes, functions, methods, imports, docstrings, base-class inheritance into UKO triples
  • markdown_analyzer.py (275 lines) — Line-by-line regex parser extracting document declarations, sections (heading hierarchy), fenced code blocks (with language), and links into UKO triples
  • __init__.py — Updated with new exports

Tests:

  • features/uko_analyzers.feature (193 lines) — 39 Behave scenarios covering UKOTriple model, AnalyzerRegistry, PythonAnalyzer, MarkdownAnalyzer
  • features/steps/uko_analyzers_steps.py (468 lines) — Step definitions
  • robot/uko_analyzers.robot (65 lines) — 7 Robot Framework integration tests
  • robot/helper_uko_analyzers.py (241 lines) — Robot helper script

Benchmarks:

  • benchmarks/uko_analyzers_bench.py (157 lines) — ASV benchmarks for triple construction, registry ops, analyzer performance

Verification

  • nox -s lint — All checks passed
  • nox -s format — 1076 files unchanged
  • nox -s typecheck — 0 errors, 0 warnings (Pyright strict mode)
  • nox -s unit_tests -- features/uko_analyzers.feature — 1 feature, 39 scenarios, 103 steps passed
  • Robot integration tests — 7/7 passed

Design Decisions

  • Properties over methods: supported_extensions and domain are @property on AnalyzerProtocol, matching the project's protocol patterns
  • First-registered-wins: AnalyzerRegistry keeps the first analyzer registered for each extension rather than overwriting
  • Graceful degradation: PythonAnalyzer returns empty list on SyntaxError instead of raising
  • No external deps: MarkdownAnalyzer uses line-by-line regex (no markdown library), PythonAnalyzer uses stdlib ast
  • URI scheme: Follows uko:// hierarchy — uko://code/module/, uko://code/class/, uko://docs/document/, uko://docs/section/

ISSUES CLOSED: #551

## Summary Implements the UKO analyzer plugin framework and two initial domain analyzers per issue #551. ## Changes ### New Files (9 created, 1 modified) **Core framework** (`src/cleveragents/domain/models/acms/`): - `analyzers.py` (219 lines) — `UKOTriple` (frozen Pydantic v2 model), `AnalyzerProtocol` (`@runtime_checkable` Protocol), `AnalyzerRegistry` (extension-to-analyzer mapping with register/lookup/list) - `python_analyzer.py` (365 lines) — AST-based Python source analyzer extracting modules, classes, functions, methods, imports, docstrings, base-class inheritance into UKO triples - `markdown_analyzer.py` (275 lines) — Line-by-line regex parser extracting document declarations, sections (heading hierarchy), fenced code blocks (with language), and links into UKO triples - `__init__.py` — Updated with new exports **Tests**: - `features/uko_analyzers.feature` (193 lines) — 39 Behave scenarios covering UKOTriple model, AnalyzerRegistry, PythonAnalyzer, MarkdownAnalyzer - `features/steps/uko_analyzers_steps.py` (468 lines) — Step definitions - `robot/uko_analyzers.robot` (65 lines) — 7 Robot Framework integration tests - `robot/helper_uko_analyzers.py` (241 lines) — Robot helper script **Benchmarks**: - `benchmarks/uko_analyzers_bench.py` (157 lines) — ASV benchmarks for triple construction, registry ops, analyzer performance ## Verification - `nox -s lint` — All checks passed - `nox -s format` — 1076 files unchanged - `nox -s typecheck` — 0 errors, 0 warnings (Pyright strict mode) - `nox -s unit_tests -- features/uko_analyzers.feature` — 1 feature, 39 scenarios, 103 steps passed - Robot integration tests — 7/7 passed ## Design Decisions - **Properties over methods**: `supported_extensions` and `domain` are `@property` on `AnalyzerProtocol`, matching the project's protocol patterns - **First-registered-wins**: `AnalyzerRegistry` keeps the first analyzer registered for each extension rather than overwriting - **Graceful degradation**: `PythonAnalyzer` returns empty list on `SyntaxError` instead of raising - **No external deps**: `MarkdownAnalyzer` uses line-by-line regex (no markdown library), `PythonAnalyzer` uses stdlib `ast` - **URI scheme**: Follows `uko://` hierarchy — `uko://code/module/`, `uko://code/class/`, `uko://docs/document/`, `uko://docs/section/` ISSUES CLOSED: #551
freemo force-pushed feature/m6-uko-analyzers from 4039162cac
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 17s
CI / quality (pull_request) Successful in 18s
CI / security (pull_request) Successful in 32s
CI / typecheck (pull_request) Successful in 51s
CI / unit_tests (pull_request) Successful in 2m6s
CI / docker (pull_request) Successful in 51s
CI / integration_tests (pull_request) Successful in 3m0s
CI / coverage (pull_request) Failing after 6m24s
CI / benchmark-regression (pull_request) Successful in 27m39s
to 7f02e571d4
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / quality (pull_request) Successful in 17s
CI / build (pull_request) Successful in 17s
CI / typecheck (pull_request) Successful in 34s
CI / security (pull_request) Successful in 35s
CI / unit_tests (pull_request) Failing after 2m4s
CI / docker (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 3m15s
CI / coverage (pull_request) Successful in 4m23s
CI / benchmark-regression (pull_request) Has been cancelled
2026-03-05 16:13:43 +00:00
Compare
freemo force-pushed feature/m6-uko-analyzers from 7f02e571d4
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / quality (pull_request) Successful in 17s
CI / build (pull_request) Successful in 17s
CI / typecheck (pull_request) Successful in 34s
CI / security (pull_request) Successful in 35s
CI / unit_tests (pull_request) Failing after 2m4s
CI / docker (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 3m15s
CI / coverage (pull_request) Successful in 4m23s
CI / benchmark-regression (pull_request) Has been cancelled
to 39aa737a82
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 14s
CI / build (pull_request) Successful in 18s
CI / security (pull_request) Successful in 32s
CI / quality (pull_request) Successful in 39s
CI / typecheck (pull_request) Successful in 49s
CI / unit_tests (pull_request) Successful in 2m47s
CI / integration_tests (pull_request) Successful in 3m4s
CI / docker (pull_request) Successful in 39s
CI / coverage (pull_request) Successful in 4m22s
CI / benchmark-regression (pull_request) Successful in 27m40s
2026-03-05 16:19:28 +00:00
Compare
freemo force-pushed feature/m6-uko-analyzers from 39aa737a82
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 14s
CI / build (pull_request) Successful in 18s
CI / security (pull_request) Successful in 32s
CI / quality (pull_request) Successful in 39s
CI / typecheck (pull_request) Successful in 49s
CI / unit_tests (pull_request) Successful in 2m47s
CI / integration_tests (pull_request) Successful in 3m4s
CI / docker (pull_request) Successful in 39s
CI / coverage (pull_request) Successful in 4m22s
CI / benchmark-regression (pull_request) Successful in 27m40s
to d990fc1b41
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 19s
CI / typecheck (pull_request) Successful in 37s
CI / security (pull_request) Successful in 37s
CI / unit_tests (pull_request) Successful in 2m30s
CI / integration_tests (pull_request) Successful in 2m57s
CI / docker (pull_request) Successful in 38s
CI / coverage (pull_request) Successful in 4m22s
CI / lint (push) Successful in 12s
CI / build (push) Successful in 15s
CI / quality (push) Successful in 16s
CI / security (push) Successful in 33s
CI / typecheck (push) Successful in 33s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Successful in 2m8s
CI / docker (push) Successful in 39s
CI / integration_tests (push) Successful in 3m9s
CI / coverage (push) Successful in 4m35s
CI / benchmark-publish (push) Successful in 15m41s
CI / benchmark-regression (pull_request) Successful in 28m58s
2026-03-05 19:20:41 +00:00
Compare
freemo scheduled this pull request to auto merge when all checks succeed 2026-03-05 19:20:50 +00:00
freemo merged commit d990fc1b41 into master 2026-03-05 19:25:45 +00:00
freemo deleted branch feature/m6-uko-analyzers 2026-03-05 19:25:46 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core!597
No description provided.