Skip to content

Commit de75d2f

Browse files
committed
code hardening
1 parent 1dd6ab0 commit de75d2f

File tree

33 files changed

+478
-78
lines changed

33 files changed

+478
-78
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
memoryId: 32c7d988d7beb603
3+
type: decision
4+
title: Read deny rules replaced by PID-file-gated shell hooks (intentional)
5+
tags: [init, hooks, read-deny, claude-code, intentional-change]
6+
confidence: 0.95
7+
symbols: []
8+
files: [src/cli/commands/init.ts]
9+
createdAt: 2026-03-22T00:56:22.813Z
10+
deleted: false
11+
---
12+
In commit 4e42886, static `Read(**.<ext>)` deny rules were removed from the generated `.claude/settings.json` in favor of PID-file-gated shell hooks (`.claude/hooks/force-sdl-mcp.sh`). This is intentional: when the SDL-MCP server is not running (no PID file), native Read/Bash tools are allowed so Claude Code works normally. When the server IS running, the hook enforces SDL-MCP usage. This is a behavioral improvement over the previous approach where Read was hard-denied even when the server was unavailable, breaking the development experience. The `deny` array in `buildClaudeSettings()` now only contains `["Task(Explore)"]`.

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.9.2] - 2026-03-21
9+
10+
### Changed
11+
12+
- Version bump for QA testing
13+
814
## [0.9.1] - 2026-03-20
915

1016
### Added

native/npm/darwin-arm64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sdl-mcp-native-darwin-arm64",
3-
"version": "0.9.1",
3+
"version": "0.9.2",
44
"description": "Native Rust indexer for SDL-MCP - macOS ARM64",
55
"license": "SEE LICENSE IN LICENSE",
66
"os": [

native/npm/darwin-x64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sdl-mcp-native-darwin-x64",
3-
"version": "0.9.1",
3+
"version": "0.9.2",
44
"description": "Native Rust indexer for SDL-MCP - macOS x64",
55
"license": "SEE LICENSE IN LICENSE",
66
"os": [

native/npm/linux-arm64-gnu/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sdl-mcp-native-linux-arm64-gnu",
3-
"version": "0.9.1",
3+
"version": "0.9.2",
44
"description": "Native Rust indexer for SDL-MCP - Linux ARM64 (glibc)",
55
"license": "SEE LICENSE IN LICENSE",
66
"os": [

native/npm/linux-x64-gnu/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sdl-mcp-native-linux-x64-gnu",
3-
"version": "0.9.1",
3+
"version": "0.9.2",
44
"description": "Native Rust indexer for SDL-MCP - Linux x64 (glibc)",
55
"license": "SEE LICENSE IN LICENSE",
66
"os": [

native/npm/linux-x64-musl/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sdl-mcp-native-linux-x64-musl",
3-
"version": "0.9.1",
3+
"version": "0.9.2",
44
"description": "Native Rust indexer for SDL-MCP - Linux x64 (musl)",
55
"license": "SEE LICENSE IN LICENSE",
66
"os": [

native/npm/win32-x64-msvc/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sdl-mcp-native-win32-x64-msvc",
3-
"version": "0.9.1",
3+
"version": "0.9.2",
44
"description": "Native Rust indexer for SDL-MCP - Windows x64",
55
"license": "SEE LICENSE IN LICENSE",
66
"os": [

native/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sdl-mcp-native",
3-
"version": "0.9.1",
3+
"version": "0.9.2",
44
"description": "Native Rust indexer for SDL-MCP with tree-sitter parsing and Rayon parallelism",
55
"license": "SEE LICENSE IN LICENSE",
66
"main": "index.js",
@@ -29,12 +29,12 @@
2929
"version": "napi version"
3030
},
3131
"optionalDependencies": {
32-
"sdl-mcp-native-win32-x64-msvc": "0.9.1",
33-
"sdl-mcp-native-darwin-x64": "0.9.1",
34-
"sdl-mcp-native-darwin-arm64": "0.9.1",
35-
"sdl-mcp-native-linux-x64-gnu": "0.9.1",
36-
"sdl-mcp-native-linux-x64-musl": "0.9.1",
37-
"sdl-mcp-native-linux-arm64-gnu": "0.9.1"
32+
"sdl-mcp-native-win32-x64-msvc": "0.9.2",
33+
"sdl-mcp-native-darwin-x64": "0.9.2",
34+
"sdl-mcp-native-darwin-arm64": "0.9.2",
35+
"sdl-mcp-native-linux-x64-gnu": "0.9.2",
36+
"sdl-mcp-native-linux-x64-musl": "0.9.2",
37+
"sdl-mcp-native-linux-arm64-gnu": "0.9.2"
3838
},
3939
"repository": {
4040
"type": "git",

native/src/extract/symbols/typescript.rs

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ fn traverse_ast(
2222
rel_path: &str,
2323
symbols: &mut Vec<NativeParsedSymbol>,
2424
) {
25-
let mut stack = vec![root];
25+
let mut stack: Vec<(Node, u32)> = vec![(root, 0)];
2626

27-
while let Some(node) = stack.pop() {
27+
while let Some((node, scope_depth)) = stack.pop() {
2828
match node.kind() {
2929
"function_declaration" | "generator_function_declaration" => {
3030
if let Some(sym) = process_function_declaration(node, source, repo_id, rel_path) {
@@ -52,12 +52,14 @@ fn traverse_ast(
5252
}
5353
}
5454
"lexical_declaration" | "variable_declaration" => {
55-
let mut cursor = node.walk();
56-
for child in node.children(&mut cursor) {
57-
if child.kind() == "variable_declarator" {
58-
let var_symbols =
59-
process_variable_declaration(child, source, repo_id, rel_path, node);
60-
symbols.extend(var_symbols);
55+
if scope_depth == 0 {
56+
let mut cursor = node.walk();
57+
for child in node.children(&mut cursor) {
58+
if child.kind() == "variable_declarator" {
59+
let var_symbols =
60+
process_variable_declaration(child, source, repo_id, rel_path, node);
61+
symbols.extend(var_symbols);
62+
}
6163
}
6264
}
6365
}
@@ -72,10 +74,26 @@ fn traverse_ast(
7274
_ => {}
7375
}
7476

77+
// Increment scope depth when entering function/method/arrow bodies
78+
let enters_function_scope = matches!(
79+
node.kind(),
80+
"function_declaration"
81+
| "generator_function_declaration"
82+
| "method_definition"
83+
| "arrow_function"
84+
| "function"
85+
| "static_block"
86+
);
87+
let child_scope_depth = if enters_function_scope {
88+
scope_depth + 1
89+
} else {
90+
scope_depth
91+
};
92+
7593
let child_count = node.child_count();
7694
for i in (0..child_count).rev() {
7795
if let Some(child) = node.child(i) {
78-
stack.push(child);
96+
stack.push((child, child_scope_depth));
7997
}
8098
}
8199
}

0 commit comments

Comments
 (0)