Skip to content

feat(adr): add manage-adr MCP tool + CLI command backed by SQLite (closes #16)#143

Merged
Wolfvin merged 2 commits into
mainfrom
feat/issue-16-manage-adr
Jul 3, 2026
Merged

feat(adr): add manage-adr MCP tool + CLI command backed by SQLite (closes #16)#143
Wolfvin merged 2 commits into
mainfrom
feat/issue-16-manage-adr

Conversation

@Wolfvin

@Wolfvin Wolfvin commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Closes #16

Summary

Adds Architecture Decision Records (ADR) — persistent memory of why the codebase is structured the way it is, so AI agents don't propose refactors that violate intentional constraints.

What changed

New files:

  • scripts/adr_engine.py — SQLite-backed ADR manager with single-table schema (id, title, context, decision, status, superseded_by, created_at, updated_at). Statuses: proposed/accepted/deprecated/rejected. Single entry point manage_adr() dispatches all 6 actions (create/list/get/update/deprecate/delete).
  • scripts/commands/adr.py — CLI command codelens adr <action> auto-registered via commands/__init__.py. Thin argparse wrapper around manage_adr().
  • tests/test_adr.py — 50 tests covering CRUD, status validation, supersession integrity, missing-id soft-fails, CLI registration, MCP tool schema, file headers, and full lifecycle.

Modified:

  • scripts/mcp_server.py — added manage-adr to _TOOL_DEFINITIONS (static schema with action enum, status enum, superseded_by, status_filter).
  • README.md / SKILL.md / SKILL-QUICK.md / pyproject.toml / skill.json / scripts/graph_model.py — command count synced 69→70, MCP static 54→55 via sync_command_count.py --apply.

Design decisions

Test results

  • 50/50 new tests in tests/test_adr.py pass.
  • tests/test_command_count.py (4 tests) pass — counts are in sync.
  • tests/test_command_registry.py (2 tests) pass — adr command auto-registers correctly.
  • No regressions in safe-to-run test subset (489 passed, 1 pre-existing failure in test_codelensignore.py that is unchanged by this PR — see CONTEXT.md).
  • tree-sitter-dependent tests skipped in this sandbox (optional dependency, per CONTEXT.md note about CI/sandbox minimal environments).

Acceptance criteria from issue

  • manage_adr MCP tool backed by SQLite table
  • Actions: create, list, get, deprecate (with superseded_by), plus update and delete for completeness
  • Structured JSON output suitable for agent consumption
  • Persistent storage at .codelens/adrs.db (survives session resets)
  • Command and MCP tool counts synced via sync_command_count.py --apply

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Wolfvin added 2 commits July 3, 2026 09:07
…oses #16)

Architecture Decision Records give agents persistent memory of *why* the
codebase is structured the way it is, so they don't propose refactors that
violate intentional constraints.

New files:
- scripts/adr_engine.py — SQLite-backed ADR manager (create/list/get/update/
  deprecate/delete). Single-table schema: id, title, context, decision,
  status, superseded_by, created_at, updated_at. Statuses: proposed,
  accepted, deprecated, rejected. Supersession links ADRs and forbids
  self-reference. Missing-id operations return 'not_found' rather than
  raising. Dangling superseded_by refs are cleared on delete.
- scripts/commands/adr.py — CLI command registered as 'codelens adr
  <create|list|get|update|deprecate|delete>'. Thin argparse wrapper that
  delegates to adr_engine.manage_adr() (single entry point shared with MCP).
- tests/test_adr.py — 50 tests covering CRUD, status validation,
  supersession integrity, missing-id soft-fails, CLI registration, MCP tool
  schema, file headers, and end-to-end lifecycle.

Modified:
- scripts/mcp_server.py — add 'manage-adr' to _TOOL_DEFINITIONS (static
  schema with action enum, status enum, superseded_by, status_filter).
- README/SKILL/SKILL-QUICK/pyproject.toml/skill.json/graph_model.py —
  command count synced 69->70, MCP static 54->55 via
  sync_command_count.py --apply.

Test results: 50/50 new tests pass. Existing command_count + command_registry
tests pass (counts are in sync). No regressions in the safe-to-run test
subset; pre-existing failures (test_codelensignore, tree-sitter-dependent
tests) are unchanged and documented in CONTEXT.md.
@Wolfvin Wolfvin force-pushed the feat/issue-16-manage-adr branch from 107b513 to 2187a39 Compare July 3, 2026 02:10
@Wolfvin Wolfvin merged commit abc832f into main Jul 3, 2026
0 of 7 checks passed
@sonarqubecloud

sonarqubecloud Bot commented Jul 3, 2026

Copy link
Copy Markdown

@Wolfvin Wolfvin deleted the feat/issue-16-manage-adr branch July 3, 2026 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Architecture Decision Records (ADR) via manage_adr MCP tool

1 participant