Skip to content

Commit 9023ed7

Browse files
CosmoHacclaude
andcommitted
feat: v11.2 — AST clone detection + debug artifact rules (140 commands, 102 MCP tools)
New `roam clones` command detects Type-2 structural clones via tree-sitter AST subtree hashing with Jaccard similarity scoring and Union-Find clustering. 9 debug artifact rules (COR-560–568) catch leftover print/breakpoint/debugger statements in Python, JS, TS, and Java. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3bda2bf commit 9023ed7

18 files changed

Lines changed: 1262 additions & 17 deletions

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
**The architectural intelligence layer for AI coding agents. Structural graph, architecture governance, multi-agent orchestration, vulnerability mapping, runtime analysis -- one CLI, zero API keys.**
66

7-
*139 commands · 101 MCP tools · 27 languages · 100% local*
7+
*140 commands · 102 MCP tools · 27 languages · 100% local*
88

99
[![PyPI version](https://img.shields.io/pypi/v/roam-code?style=flat-square&color=blue)](https://pypi.org/project/roam-code/)
1010
[![GitHub stars](https://img.shields.io/github/stars/Cranot/roam-code?style=flat-square)](https://github.com/Cranot/roam-code/stargazers)
@@ -64,14 +64,19 @@ $ roam diff # blast radius of uncommitted changes
6464

6565
## What's New in v11
6666

67+
### v11.2 -- AST Clone Detection + Debug Artifact Rules
68+
- **`roam clones`**: New AST structural clone detection via subtree hashing. Finds Type-2 clones (identical control flow, different identifiers/literals) with Jaccard similarity scoring, Union-Find clustering, and automated refactoring suggestions. More precise than the metric-based `duplicates` command.
69+
- **9 debug artifact rules** (COR-560 through COR-568): Detect leftover `print()`, `breakpoint()`, `pdb.set_trace()`, `console.log()`, `debugger`, and `System.out.println()` in Python, JavaScript, TypeScript, and Java code. All use `ast_match` type with test file exemptions.
70+
- **140 commands, 102 MCP tools**.
71+
6772
### v11.1.2 -- SQL + Scala Tier 1, 27 Languages
6873
- **SQL DDL promoted to Tier 1** with dedicated `SqlExtractor` -- tables, columns, views, functions, triggers, schemas, types (enums), sequences, ALTER TABLE ADD COLUMN. Foreign keys produce graph edges; views and triggers reference source tables. Database-schema projects now work with `roam health`, `roam layers`, `roam impact`, `roam coupling` and all graph commands.
6974
- **Scala promoted to Tier 1** with dedicated `ScalaExtractor` -- classes, traits, objects, case classes, sealed hierarchies, val/var properties, type aliases, imports, and inheritance. Full `extends` + `with` trait mixin resolution.
7075
- **27 languages** with 16 dedicated Tier 1 extractors.
7176
- `server.json` for official MCP Registry submission.
7277

7378
### v11.1.1 -- Command Quality Audit
74-
- **Full command audit**: all 139 commands reviewed for usefulness, duplicates, and test coverage. ~20 bugs fixed, 21 new test files (700+ tests), every command docstring updated with cross-references to related commands.
79+
- **Full command audit**: all 140 commands reviewed for usefulness, duplicates, and test coverage. ~20 bugs fixed, 21 new test files (700+ tests), every command docstring updated with cross-references to related commands.
7580
- **Kotlin promoted to Tier 1** via new YAML-based declarative extractor architecture. Classes, interfaces, enums, objects, functions, methods, properties, and inheritance fully extracted.
7681
- **7 new commands**: `roam congestion`, `roam adrs`, `roam flag-dead`, `roam test-scaffold`, `roam sbom`, `roam triage`, `roam ci-setup`.
7782
- **CI templates**: `roam ci-setup` generates pipelines for GitHub Actions, GitLab CI, Azure Pipelines, Jenkins, and Bitbucket.
@@ -226,7 +231,7 @@ roam health
226231

227232
## Commands
228233

229-
The [5 core commands](#core-commands) shown above cover ~80% of agent workflows. All 139 commands are organized into 7 categories.
234+
The [5 core commands](#core-commands) shown above cover ~80% of agent workflows. All 140 commands are organized into 7 categories.
230235

231236
<details>
232237
<summary><strong>Full command reference</strong></summary>
@@ -484,6 +489,7 @@ The sentinel pair `<!-- roam:minimap -->` / `<!-- /roam:minimap -->` is replaced
484489
| `roam safe-zones` | Graph-based containment boundaries |
485490
| `roam coverage-gaps` | Unprotected entry points with no path to gate symbols |
486491
| `roam duplicates [--threshold T] [--min-lines N]` | Semantic duplicate detector: functionally equivalent code clusters with divergent edge-case handling |
492+
| `roam clones [--threshold T] [--min-lines N] [--scope P]` | AST structural clone detection: Type-2 clones via subtree hashing (more precise than `duplicates`) |
487493

488494
### Exploration
489495

@@ -822,7 +828,7 @@ pip install "roam-code[mcp]"
822828
roam mcp
823829
```
824830

825-
101 tools, 10 resources, and 5 prompts are available in the full preset. Most tools are read-only index queries; side-effect tools are explicitly annotated.
831+
102 tools, 10 resources, and 5 prompts are available in the full preset. Most tools are read-only index queries; side-effect tools are explicitly annotated.
826832

827833
**MCP v2 highlights (v11):**
828834
- In-process MCP execution (no subprocess shell-out per call)
@@ -889,6 +895,7 @@ Core preset tools: `roam_affected_tests`, `roam_batch_get`, `roam_batch_search`,
889895
| `roam_bisect_blame` | Architectural git bisect |
890896
| `roam_doc_intent` | Doc-to-code linking |
891897
| `roam_cut_analysis` | Minimum graph cut analysis |
898+
| `roam_clones` | AST structural clone detection (Type-2 clones) |
892899
| `roam_annotate_symbol` | Attach persistent notes to symbols |
893900
| `roam_get_annotations` | View stored annotations |
894901
| `roam_relate` | Show relationship between two symbols |
@@ -1465,8 +1472,8 @@ roam-code/
14651472
├── action.yml # Reusable GitHub Action
14661473
├── src/roam/
14671474
│ ├── __init__.py # Version (from pyproject.toml)
1468-
│ ├── cli.py # Click CLI (139 commands)
1469-
│ ├── mcp_server.py # MCP server (101 tools, 10 resources, 5 prompts)
1475+
│ ├── cli.py # Click CLI (140 commands)
1476+
│ ├── mcp_server.py # MCP server (102 tools, 10 resources, 5 prompts)
14701477
│ ├── db/
14711478
│ │ ├── connection.py # SQLite (WAL, pragmas, batched IN)
14721479
│ │ ├── schema.py # Tables, indexes, migrations
@@ -1560,7 +1567,7 @@ Optional: Local semantic ONNX stack (`numpy`, `onnxruntime`, `tokenizers`) via `
15601567
### Shipped
15611568

15621569
- [x] MCP v2 agent surface: in-process execution, compound operations, presets, schemas, annotations, and compatibility profiles.
1563-
- [x] Full command and MCP inventory parity in docs: 139 CLI commands and 101 MCP tools.
1570+
- [x] Full command and MCP inventory parity in docs: 140 CLI commands and 102 MCP tools.
15641571
- [x] CI hardening: composite action, changed-only mode, trend-aware gates, sticky PR updater, and SARIF guardrails.
15651572
- [x] Performance foundation: FTS5/BM25 search, O(changed) incremental indexing, DB/index optimizations.
15661573
- [x] Agent governance suite: `vibe-check`, `ai-readiness`, `verify`, `ai-ratio`, `duplicates`, advanced `algo` scoring/SARIF.

llms-install.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Installing roam-code
22

33
roam-code provides instant codebase comprehension for AI coding agents.
4-
139 commands, 101 MCP tools, 27 languages, 100% local, zero API keys.
4+
140 commands, 102 MCP tools, 27 languages, 100% local, zero API keys.
55

66
## Documentation Hub
77

@@ -78,4 +78,4 @@ Add to your MCP config:
7878
| `roam context <symbol>` | Files and line ranges to read |
7979
| `roam diff` | Blast radius of uncommitted changes |
8080

81-
Run `roam --help` for all 139 commands (+3 alias pairs: 142 total entries).
81+
Run `roam --help` for all 140 commands (+3 alias pairs: 143 total entries).

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "roam-code"
7-
version = "11.1.3"
7+
version = "11.2.0"
88
description = "Instant codebase comprehension for AI coding agents"
99
readme = "README.md"
1010
requires-python = ">=3.9"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: py-debug-print
2+
description: "Leftover debug print() statement (print with DEBUG/TODO/HACK/FIXME prefix)."
3+
severity: warning
4+
type: ast_match
5+
match:
6+
ast: "print($EXPR)"
7+
language: python
8+
file_glob: "**/*.py"
9+
exempt:
10+
files: ["**/tests/**", "**/test_**"]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: py-breakpoint
2+
description: "Leftover breakpoint() call — debugger entry point in production code."
3+
severity: error
4+
type: ast_match
5+
match:
6+
ast: "breakpoint()"
7+
language: python
8+
file_glob: "**/*.py"
9+
exempt:
10+
files: ["**/tests/**", "**/test_**"]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: py-pdb-import
2+
description: "Leftover pdb/ipdb import — debugger module in production code."
3+
severity: error
4+
type: ast_match
5+
match:
6+
ast: "import pdb"
7+
language: python
8+
file_glob: "**/*.py"
9+
exempt:
10+
files: ["**/tests/**", "**/test_**"]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: py-set-trace
2+
description: "Leftover pdb.set_trace() call — debugger in production code."
3+
severity: error
4+
type: ast_match
5+
match:
6+
ast: "pdb.set_trace()"
7+
language: python
8+
file_glob: "**/*.py"
9+
exempt:
10+
files: ["**/tests/**", "**/test_**"]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: js-console-log
2+
description: "Leftover console.log() call — debug output in production code."
3+
severity: warning
4+
type: ast_match
5+
match:
6+
ast: "console.log($EXPR)"
7+
language: javascript
8+
file_glob: "**/*.{js,jsx,mjs,cjs}"
9+
exempt:
10+
files: ["**/tests/**", "**/test/**", "**/__tests__/**", "**/*.test.*", "**/*.spec.*"]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: ts-console-log
2+
description: "Leftover console.log() call — debug output in production code."
3+
severity: warning
4+
type: ast_match
5+
match:
6+
ast: "console.log($EXPR)"
7+
language: typescript
8+
file_glob: "**/*.{ts,tsx,mts,cts}"
9+
exempt:
10+
files: ["**/tests/**", "**/test/**", "**/__tests__/**", "**/*.test.*", "**/*.spec.*"]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: js-debugger
2+
description: "Leftover debugger statement — pauses execution in browser devtools."
3+
severity: error
4+
type: ast_match
5+
match:
6+
ast: "debugger"
7+
language: javascript
8+
file_glob: "**/*.{js,jsx,mjs,cjs}"
9+
exempt:
10+
files: ["**/tests/**", "**/test/**", "**/__tests__/**"]

0 commit comments

Comments
 (0)