Skip to content

Commit 430ae16

Browse files
committed
chore(commands): remove deprecated validate command, update count to 63 (closes #100)
1 parent 0801cac commit 430ae16

12 files changed

Lines changed: 27 additions & 135 deletions

File tree

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
> **Before an AI writes a new class/id/function, CodeLens must be checked. This is not optional.**
44
5-
CodeLens is an AI-native code intelligence platform that gives AI agents **full visibility** into a codebase before they write any code. It prevents collision, overwrite of existing logic, security vulnerabilities, and dead code through 64 CLI commands, an MCP server with 62 tools (51 static + 11 dynamic), AST-based taint analysis, live CVE/OSV scanning, a plugin system with OWASP Top 10 + Compliance rule packs, a true graph data model (nodes + edges) for structural code queries, and token-efficient `--format compact` output for high-volume agent workflows (issue #17).
5+
CodeLens is an AI-native code intelligence platform that gives AI agents **full visibility** into a codebase before they write any code. It prevents collision, overwrite of existing logic, security vulnerabilities, and dead code through 63 CLI commands, an MCP server with 61 tools (50 static + 11 dynamic), AST-based taint analysis, live CVE/OSV scanning, a plugin system with OWASP Top 10 + Compliance rule packs, a true graph data model (nodes + edges) for structural code queries, and token-efficient `--format compact` output for high-volume agent workflows (issue #17).
66

77
## Features
88

9-
- **64 CLI Commands** — From basic scan/query to AST taint analysis, CVE scanning, plugin management, auto-fix, dashboards, CI/CD quality gates, and `graph-schema` for cheap graph-shape introspection
10-
- **MCP Server (62 Tools)** — Native AI agent integration via Model Context Protocol (JSON-RPC over stdio), 51 statically-defined tools + 11 dynamically discovered, every tool accepts a `format` parameter (`json`/`markdown`/`ai`/`sarif`/`compact`)
9+
- **63 CLI Commands** — From basic scan/query to AST taint analysis, CVE scanning, plugin management, auto-fix, dashboards, CI/CD quality gates, and `graph-schema` for cheap graph-shape introspection
10+
- **MCP Server (61 Tools)** — Native AI agent integration via Model Context Protocol (JSON-RPC over stdio), 50 statically-defined tools + 11 dynamically discovered, every tool accepts a `format` parameter (`json`/`markdown`/`ai`/`sarif`/`compact`)
1111
- **Token-Efficient Compact Output (v8.2, issue #17)**`--format compact` produces single-char-key JSON with abbreviated types, omitted null fields, and relative paths — ~50% smaller than `json` on real trace output. Combined with `--limit`/`--offset` pagination, 5 structural queries now cost <5k tokens (down from 30-80k)
1212
- **AST Taint Engine** — Tree-sitter based taint analysis with return-value propagation, scope hierarchy, and branch condition refinement
1313
- **Live CVE/OSV Scanning** — Real-time vulnerability data from OSV.dev API with SQLite cache, 9 ecosystems (PyPI, npm, crates.io, Go, Maven, NuGet, RubyGems, Pub, Hex)
@@ -82,7 +82,7 @@ python3 scripts/codelens.py query "myFunction" --lite
8282
|---------|-------------|
8383
| `init [workspace]` | Initialize `.codelens` config with auto-detected frameworks |
8484
| `scan [workspace] [--incremental] [--full] [--max-files N]` | Scan workspace and build registry |
85-
| `validate [workspace]` | Validate registry vs file system |
85+
| `registry-validate [workspace]` | Validate registry vs file system |
8686
| `detect [workspace]` | Detect frameworks and show recommended config |
8787
| `watch [workspace] [--git-mode] [--interval SECS]` | Start file watcher (default: watchdog; `--git-mode` polls `git diff --name-only`) |
8888
| `git-status [workspace]` | Show git-aware scan state: HEAD SHA, last-indexed SHA, changed files, re-scan recommendation |
@@ -225,8 +225,8 @@ codelens/
225225
│ ├── changelog.md # Older changelog (per-version highlights)
226226
│ └── agent-integration.md # AI agent integration guide
227227
├── scripts/
228-
│ ├── codelens.py # CLI entry point (64 commands registered)
229-
│ ├── mcp_server.py # MCP JSON-RPC server (62 tools)
228+
│ ├── codelens.py # CLI entry point (63 commands registered)
229+
│ ├── mcp_server.py # MCP JSON-RPC server (61 tools)
230230
│ ├── registry.py # Registry read/write/build
231231
│ ├── persistent_registry.py # SQLite persistent storage (WAL mode)
232232
│ ├── base_parser.py # Base tree-sitter parser

SKILL-QUICK.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ $CLI list --limit 5 --offset 10 --format compact # → paginated + co
114114
| "Cross-file taint" | `dataflow` | `taint` (taint is single-file, AST-deep) |
115115
| "Auto-fix issues" | `fix` | `check` (check just gates, doesn't fix) |
116116

117-
## All 64 Commands
117+
## All 63 Commands
118118

119119
### Setup & Lifecycle (8+)
120-
`init` · `scan [--incremental] [--max-files N] [--full]` · `validate` · `detect` · `watch [--debounce SECS] [--git-mode] [--interval SECS]` · `git-status` · `migrate` · `serve` · `lsp-status` (issue #33: `codelens --lsp-status` top-level flag is an alias of `codelens lsp-status` — both delegate to `hybrid_engine.get_lsp_status()` and return the identical payload)
120+
`init` · `scan [--incremental] [--max-files N] [--full]` · `registry-validate` · `detect` · `watch [--debounce SECS] [--git-mode] [--interval SECS]` · `git-status` · `migrate` · `serve` · `lsp-status` (issue #33: `codelens --lsp-status` top-level flag is an alias of `codelens lsp-status` — both delegate to `hybrid_engine.get_lsp_status()` and return the identical payload)
121121

122122
### Pre-Write Safety (5)
123123
`query "name" [--domain ...] [--fuzzy]` · `impact "name" [--action modify|delete]` · `refactor-safe "name" [--action rename|move]` · `guard (--pre|--post) --file PATH` · `check [--severity ...] [--max-findings N]`
@@ -146,18 +146,18 @@ $CLI list --limit 5 --offset 10 --format compact # → paginated + co
146146
### Tooling (1)
147147
`plugin <install|list|search|update|info|validate>`
148148

149-
**Total: 64 commands** (auto-registered via `commands/__init__.py`; rerun `python3 scripts/sync_command_count.py --apply` after adding/removing a command)
149+
**Total: 63 commands** (auto-registered via `commands/__init__.py`; rerun `python3 scripts/sync_command_count.py --apply` after adding/removing a command)
150150

151-
## MCP Server (62 Tools)
151+
## MCP Server (61 Tools)
152152

153153
Start the MCP server for AI agent integration:
154154

155155
```bash
156156
python3 scripts/codelens.py serve
157157
```
158158

159-
Exposes 62 tools as `codelens_<command>` (e.g., `codelens_query`, `codelens_taint`, `codelens_graph_schema`, `codelens_architecture`, `codelens_resolve_types`, `codelens_git_status`):
160-
- 51 statically-defined tools (full JSON schemas in `mcp_server.py`)
159+
Exposes 61 tools as `codelens_<command>` (e.g., `codelens_query`, `codelens_taint`, `codelens_graph_schema`, `codelens_architecture`, `codelens_resolve_types`, `codelens_git_status`):
160+
- 50 statically-defined tools (full JSON schemas in `mcp_server.py`)
161161
- 11 dynamically-discovered tools (auto-discovered from `COMMAND_REGISTRY`; long-running `watch` and `serve` are excluded)
162162
- Every tool accepts a `format` parameter (`json`/`markdown`/`ai`/`sarif`/`compact`). Use `format: "compact"` for token-efficient responses (~50% smaller than `json`).
163163
- `watch` and `serve` itself are excluded (long-running)

SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
name: codelens
33
description: >
4-
CodeLens — AI-Native Code Intelligence. 64 commands for AI-powered code analysis,
4+
CodeLens — AI-Native Code Intelligence. 63 commands for AI-powered code analysis,
55
security auditing, quality scoring, AST-based taint analysis, live CVE scanning,
66
and pre-write safety checks. Supports 28+ languages with tree-sitter + regex
7-
fallback parsing. MCP server exposes 62 tools for AI agent integration.
7+
fallback parsing. MCP server exposes 61 tools for AI agent integration.
88
For quick command reference with validated output schemas, see SKILL-QUICK.md.
99
For version history, see CHANGELOG.md.
1010
---

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
55
[project]
66
name = "codelens"
77
version = "8.2.0"
8-
description = "Live Codebase Reference Intelligence — 64 commands for AI-powered code analysis, security auditing, and quality scoring"
8+
description = "Live Codebase Reference Intelligence — 63 commands for AI-powered code analysis, security auditing, and quality scoring"
99
readme = "README.md"
1010
license = {text = "MIT"}
1111
requires-python = ">=3.8"

scripts/codelens.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
python3 codelens.py circular <workspace> # Detect circular dependencies
1919
python3 codelens.py context <name> <workspace> # Get rich symbol context
2020
python3 codelens.py dependents <file> <workspace> # Module-level import tracking
21-
python3 codelens.py validate <workspace> # Validate registry vs file system
21+
python3 codelens.py registry-validate <workspace> # Validate registry vs file system
2222
python3 codelens.py dataflow <workspace> # Trace data flow source→sink
2323
python3 codelens.py smell <workspace> # Detect code smells
2424
python3 codelens.py side-effect <workspace> [--name func] # Analyze function side effects
@@ -1038,7 +1038,7 @@ def main():
10381038
"secrets", "dataflow", "vuln-scan", "env-check", "entrypoints",
10391039
"api-map", "state-map", "handbook", "analyze", "test-map",
10401040
"stack-trace", "config-drift", "type-infer", "ownership",
1041-
"regex-audit", "a11y", "css-deep", "diff", "ask", "validate",
1041+
"regex-audit", "a11y", "css-deep", "diff", "ask",
10421042
"taint", "dashboard", "history",
10431043
}
10441044

scripts/commands/registry_validate.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""registry-validate command — Validate registry against file system.
22
33
Renamed from `validate` in v8.x to make room for `rule-validate` (rule YAML
4-
validation). The old `validate` command name still works as a deprecated alias
5-
(see ``scripts/commands/validate.py``) but prints a one-line stderr warning
6-
and will be removed in a future release.
4+
validation). The deprecated `validate` alias was removed in issue #100 —
5+
use `registry-validate` for registry checks, or `rule-validate` for rule
6+
YAML validation.
77
"""
88

99
import sys
@@ -38,7 +38,7 @@ def execute(args, workspace):
3838

3939
register_command(
4040
"registry-validate",
41-
"Validate registry against file system (renamed from `validate`)",
41+
"Validate registry against file system",
4242
add_args,
4343
execute,
4444
)

scripts/commands/validate.py

Lines changed: 0 additions & 59 deletions
This file was deleted.

scripts/formatters/markdown.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ def to_markdown(data: Any, command: str = "") -> str:
8888
_md_diff(data, lines)
8989
elif command == "dependents":
9090
_md_dependents(data, lines)
91-
elif command == "validate":
92-
_md_validate(data, lines)
9391
elif command == "dataflow":
9492
_md_dataflow(data, lines)
9593
elif command == "test-map":
@@ -1217,40 +1215,6 @@ def _md_dependents(data: Dict, lines: list) -> None:
12171215
lines.append("")
12181216

12191217

1220-
def _md_validate(data: Dict, lines: list) -> None:
1221-
"""Markdown for validate command."""
1222-
total = data.get("total_issues", 0)
1223-
summary = data.get("summary", {})
1224-
rec = data.get("recommendation", "")
1225-
lines.append("## Registry Validation")
1226-
lines.append("")
1227-
icon = "PASS" if total == 0 else "FAIL"
1228-
lines.append(f"**Status:** {icon} ({total} issues)")
1229-
lines.append("")
1230-
lines.append(f"- Missing files: {summary.get('missing_files', 0)}")
1231-
lines.append(f"- Unregistered files: {summary.get('unregistered_files', 0)}")
1232-
lines.append(f"- Stale references: {summary.get('stale_references', 0)}")
1233-
lines.append(f"- Orphan entries: {summary.get('orphan_entries', 0)}")
1234-
lines.append("")
1235-
issues = data.get("issues", {})
1236-
if issues:
1237-
for cat in ["missing_files", "unregistered_files", "stale_references", "orphan_entries"]:
1238-
items = issues.get(cat, [])
1239-
if items:
1240-
lines.append(f"### {cat.replace('_', ' ').title()}")
1241-
for item in items[:10]:
1242-
if isinstance(item, dict):
1243-
lines.append(f"- `{item.get('file', item.get('path', ''))}` — {item.get('reason', '')}")
1244-
else:
1245-
lines.append(f"- `{item}`")
1246-
if len(items) > 10:
1247-
lines.append(f"- ... and {len(items) - 10} more")
1248-
lines.append("")
1249-
if rec:
1250-
lines.append(f"**Recommendation:** {rec}")
1251-
lines.append("")
1252-
1253-
12541218
def _md_dataflow(data: Dict, lines: list) -> None:
12551219
"""Markdown for dataflow command."""
12561220
stats = data.get("stats", {})

scripts/graph_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
- New tables `graph_nodes` and `graph_edges` are additive (prefixed `graph_`
1414
to avoid colliding with any existing table name).
1515
- The flat registry tables and JSON files are untouched.
16-
- All 64 existing CLI commands continue to work unchanged.
16+
- All 63 existing CLI commands continue to work unchanged.
1717
1818
Schema:
1919
graph_nodes(

scripts/mcp_server.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
Implements the MCP specification (2025-03-26) over stdio (JSON-RPC 2.0).
66
Provides persistent server mode with in-memory registry caching, sub-millisecond
7-
query latency after initial scan, and automatic tool discovery for all 64 CodeLens commands.
7+
query latency after initial scan, and automatic tool discovery for all 63 CodeLens commands.
88
99
Usage:
1010
python3 codelens.py serve # Start MCP server (stdio transport)
@@ -664,19 +664,6 @@
664664
"required": ["workspace"]
665665
}
666666
},
667-
"validate": {
668-
"description": "Validate registry against file system. Detect stale registry entries.",
669-
"parameters": {
670-
"type": "object",
671-
"properties": {
672-
"workspace": {
673-
"type": "string",
674-
"description": "Path to workspace root directory"
675-
}
676-
},
677-
"required": ["workspace"]
678-
}
679-
},
680667
"detect": {
681668
"description": "Detect frameworks and technologies used in the project.",
682669
"parameters": {

0 commit comments

Comments
 (0)