@allansantos-dev/smart-tool 0.9.69 → 0.9.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.70 - beta
4
+
5
+ - `project_manage list` no longer fails as a whole when a registered folder was deleted inside a Git repository (a removed
6
+ worktree): that project shows as `unavailable` with "The project folder no longer exists", and `status` on it says so.
7
+ - A search of a folder that holds other registered projects names each one (files indexed, `project_root` to search it),
8
+ because each keeps its own index and its files are not in the outer results. `project_manage status` with a path inside a
9
+ registered project answers for the deepest project that holds it and returns `resolved_from`.
10
+ Tests: `tests/test_nested_projects.py`, `tests/test_agent_efficiency.py`.
11
+
3
12
  ## 0.9.69 - beta
4
13
 
5
14
  - `smart_search` answers leaner by default: `detail=compact` cuts each excerpt to whole lines within 240 characters (was 500)
package/README.md CHANGED
@@ -17,7 +17,7 @@ registered as the `playwright` server where this machine lets a browser be drive
17
17
  An optional hook routes the agent's native Grep/Glob/Read/Bash/WebSearch/WebFetch calls to these tools when they
18
18
  are cheaper, or just tells the agent what Smart Tool would do.
19
19
 
20
- **Status:** 0.9.69 beta. Windows only. What changed in each version: [CHANGELOG.md](CHANGELOG.md).
20
+ **Status:** 0.9.70 beta. Windows only. What changed in each version: [CHANGELOG.md](CHANGELOG.md).
21
21
 
22
22
  ## How it works
23
23
 
@@ -83,7 +83,7 @@ gateway such as Ollama, nothing about your code leaves the machine.
83
83
  ## Install
84
84
 
85
85
  ```powershell
86
- npx @allansantos-dev/smart-tool@0.9.69 install
86
+ npx @allansantos-dev/smart-tool@0.9.70 install
87
87
  ```
88
88
 
89
89
  Updates install themselves, on by default: the tray checks npm when it starts (at logon) and every 24 h, and when there
package/index_views.py CHANGED
@@ -96,6 +96,8 @@ def _resolve(root, key):
96
96
  view = {'root': key, 'git': False, 'view_id': 'workspace', 'label': 'Folder without Git',
97
97
  'branch': None, 'commit': None}
98
98
  if _git_marker(root):
99
+ if not os.path.isdir(root):
100
+ raise FileNotFoundError(f'The project folder no longer exists: {root}. Relocate or remove the project.')
99
101
  if not shutil.which('git'):
100
102
  raise RuntimeError('This folder contains Git, but the git executable is not available.')
101
103
  paths = _run(root, 'rev-parse', '--path-format=absolute', '--show-toplevel', '--absolute-git-dir', '--git-common-dir').splitlines()
package/package.json CHANGED
@@ -1,35 +1,35 @@
1
- {
2
- "name": "@allansantos-dev/smart-tool",
3
- "version": "0.9.69",
4
- "description": "Local MCP server that gives coding agents (Claude Code, Codex) cheaper, sharper tools than their built-in search. Windows.",
5
- "license": "Apache-2.0",
6
- "author": "Smart Tool contributors",
7
- "homepage": "https://allansantos-dv.github.io/smart-tool/",
8
- "repository": {
9
- "type": "git",
10
- "url": "git+https://github.com/AllanSantos-DV/smart-tool-dist.git"
11
- },
12
- "keywords": [
13
- "mcp",
14
- "claude-code",
15
- "codex",
16
- "semantic-search",
17
- "web-search",
18
- "coding-agent"
19
- ],
20
- "bin": {
21
- "smart-tool": "bin/smart-tool.mjs"
22
- },
23
- "os": [
24
- "win32"
25
- ],
26
- "cpu": [
27
- "x64"
28
- ],
29
- "engines": {
30
- "node": ">=18"
31
- },
32
- "publishConfig": {
33
- "access": "public"
34
- }
35
- }
1
+ {
2
+ "name": "@allansantos-dev/smart-tool",
3
+ "version": "0.9.70",
4
+ "description": "Local MCP server that gives coding agents (Claude Code, Codex) cheaper, sharper tools than their built-in search. Windows.",
5
+ "license": "Apache-2.0",
6
+ "author": "Smart Tool contributors",
7
+ "homepage": "https://allansantos-dv.github.io/smart-tool/",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/AllanSantos-DV/smart-tool-dist.git"
11
+ },
12
+ "keywords": [
13
+ "mcp",
14
+ "claude-code",
15
+ "codex",
16
+ "semantic-search",
17
+ "web-search",
18
+ "coding-agent"
19
+ ],
20
+ "bin": {
21
+ "smart-tool": "bin/smart-tool.mjs"
22
+ },
23
+ "os": [
24
+ "win32"
25
+ ],
26
+ "cpu": [
27
+ "x64"
28
+ ],
29
+ "engines": {
30
+ "node": ">=18"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ }
35
+ }
@@ -369,7 +369,7 @@ SERVER_INSTRUCTIONS = (
369
369
  TOOLS = [
370
370
  {
371
371
  "name": "project_manage",
372
- "description": "Manages folders and indexing. Every action takes project_root (the folder) or project_id. list gives a short line per project; status shows storage, scope and jobs. graph with symbol (function, Class.method, class name, or path::name when the name repeats) answers what an edit touches: definition, callers with line, calls, tests that reach it through static calls (depth hops, default 3) and files importing it; use it before changing a function to know what to update. affected_tests answers which tests to run after editing: every test file importing a changed file (git diff against base, default HEAD, untracked included) plus changed tests, likeliest failures first, with the command to run them and run_all when config or unanalyzed code changed. pr_impact (base, default HEAD; main or origin/main for a branch) returns a Markdown report of the change for a pull request: the functions the diff touches with their callers, the documentation entries it leaves out of date and the tests to run with their command; it publishes nothing. graph without symbol reads the indexed view: coverage, references and static calls in Java, Angular, Python, Go and JS/TS/JSX/TSX; includes HTML/CSS/Markdown references and TXT/DOCX coverage; with file_path, narrows to that file's symbols, imports and calls (lists capped by limit). inspect lists the files of a view_id; with file_path, returns only that file's chunks. usage shows consumption and reuse; docs lists public functions without a docstring (Python docstring, JSDoc, Javadoc, Go doc comment starting with the name; private, nested and override functions excluded) with coverage percent, excluding tests unless include_tests=true, for documenting a project that started without it; docs generate=true writes the documentation scope to docs/scope in the project in three levels tied to the code: technical pages by folder (an entry per public function anchored on path::name with signature, first doc line, layer, callers, calls and tests, plus a Mermaid flow by layer), functional.md (each entry point and the functions its flow reaches, by layer) and simple.md; the prose between the prose markers is kept by regeneration; docs write_prose=true writes the empty prose blocks with the Docs model of the setup (each paragraph checked against the code first) within about 40 s and says how many are left, call it again until none is; docs check=true reports anchors whose function changed signature or is gone and broken links; docs validate=true checks every claim of docs/scope against the code (anchors, links, line numbers, callers and tests, coverage, entry points, command-line options, prose names, counts, glossary, navigation, versions) and writes docs/scope/validation.md with pass/fail per check, the evidence, a score and the verdict (generate runs it too); docs with symbol lists where that function is documented; layers declares the project's layers (ordered highest first, each with path globs and annotations): without layers it returns the saved rule or a suggestion read from folder names and annotations, with files, symbols and calls between layers (direction down or up); pass layers to preview a rule and the same layers with confirm=true to save it in the project (.smart-tool/layers.json); duplicates lists duplicated functions (identical, near-identical and semantic bodies, min_similarity default 0.90; below that most pairs measured were false positives), excluding tests unless include_tests=true; fix real duplicates; only dismiss with duplicates_dismiss (finding_id, reason=false_positive|intentional, note) what is not a duplicate or is a copy kept on purpose: the finding stays hidden until the code changes, and duplicates_restore reopens it; integration shows the MCP client, hook and tool usage metrics; install_hook_preview shows the change that would install the hook redirecting Grep/Read to smart_search and WebSearch/WebFetch to web_search/web_fetch in this session's client and returns a plan_id; install_hook writes it with that plan_id and confirm=true, with a backup, only after the user approves the change; search_limits saves the project's default top_k per block ({code, test, doc}, each 1-20, total at most 20); storage shows disk usage and views; pin_view protects a view; cleanup_preview and cleanup_commit remove selected views after confirmation; compare compares two stored views, without checkout or embeddings. register adds a folder; preview checks the scope; index/rebuild update; pause/cancel keep checkpoints; resume continues; policy picks on_search/eager; scope adjusts the scope; remove deletes only the local index. setup_audit (project_root) reports what Claude Code and Codex actually load for that folder (settings layers, plugins, hooks, MCP servers, skills, CLAUDE.md/AGENTS.md) and where they collide: hooks deciding on the same tool in parallel, missing hook scripts, silenced hooks, MCP servers down or offering duplicate tools, skill name and budget problems, AGENTS.md that only Codex reads, broken @imports; what could not be checked is listed as not verified; each finding carries its fix (the file to edit or the command to run), applied by the agent when the user agrees, never by Smart Tool; mode=last returns the stored report instead of auditing again. redirect_proposals (no project_root) lists the redirect patterns proposed from allowed searches, most matched first, with a guide; redirect_decide decides them by ids: accept, instruct (tip without blocking), reject, or remove an accepted one. Jobs via smart_search_result.",
372
+ "description": "Manages folders and indexing. Every action takes project_root (the folder) or project_id. list gives a short line per project (a project whose folder is gone shows as unavailable with the reason); status shows storage, scope and jobs, and with a path inside a registered project answers for the deepest one that holds it (resolved_from). graph with symbol (function, Class.method, class name, or path::name when the name repeats) answers what an edit touches: definition, callers with line, calls, tests that reach it through static calls (depth hops, default 3) and files importing it; use it before changing a function to know what to update. affected_tests answers which tests to run after editing: every test file importing a changed file (git diff against base, default HEAD, untracked included) plus changed tests, likeliest failures first, with the command to run them and run_all when config or unanalyzed code changed. pr_impact (base, default HEAD; main or origin/main for a branch) returns a Markdown report of the change for a pull request: the functions the diff touches with their callers, the documentation entries it leaves out of date and the tests to run with their command; it publishes nothing. graph without symbol reads the indexed view: coverage, references and static calls in Java, Angular, Python, Go and JS/TS/JSX/TSX; includes HTML/CSS/Markdown references and TXT/DOCX coverage; with file_path, narrows to that file's symbols, imports and calls (lists capped by limit). inspect lists the files of a view_id; with file_path, returns only that file's chunks. usage shows consumption and reuse; docs lists public functions without a docstring (Python docstring, JSDoc, Javadoc, Go doc comment starting with the name; private, nested and override functions excluded) with coverage percent, excluding tests unless include_tests=true, for documenting a project that started without it; docs generate=true writes the documentation scope to docs/scope in the project in three levels tied to the code: technical pages by folder (an entry per public function anchored on path::name with signature, first doc line, layer, callers, calls and tests, plus a Mermaid flow by layer), functional.md (each entry point and the functions its flow reaches, by layer) and simple.md; the prose between the prose markers is kept by regeneration; docs write_prose=true writes the empty prose blocks with the Docs model of the setup (each paragraph checked against the code first) within about 40 s and says how many are left, call it again until none is; docs check=true reports anchors whose function changed signature or is gone and broken links; docs validate=true checks every claim of docs/scope against the code (anchors, links, line numbers, callers and tests, coverage, entry points, command-line options, prose names, counts, glossary, navigation, versions) and writes docs/scope/validation.md with pass/fail per check, the evidence, a score and the verdict (generate runs it too); docs with symbol lists where that function is documented; layers declares the project's layers (ordered highest first, each with path globs and annotations): without layers it returns the saved rule or a suggestion read from folder names and annotations, with files, symbols and calls between layers (direction down or up); pass layers to preview a rule and the same layers with confirm=true to save it in the project (.smart-tool/layers.json); duplicates lists duplicated functions (identical, near-identical and semantic bodies, min_similarity default 0.90; below that most pairs measured were false positives), excluding tests unless include_tests=true; fix real duplicates; only dismiss with duplicates_dismiss (finding_id, reason=false_positive|intentional, note) what is not a duplicate or is a copy kept on purpose: the finding stays hidden until the code changes, and duplicates_restore reopens it; integration shows the MCP client, hook and tool usage metrics; install_hook_preview shows the change that would install the hook redirecting Grep/Read to smart_search and WebSearch/WebFetch to web_search/web_fetch in this session's client and returns a plan_id; install_hook writes it with that plan_id and confirm=true, with a backup, only after the user approves the change; search_limits saves the project's default top_k per block ({code, test, doc}, each 1-20, total at most 20); storage shows disk usage and views; pin_view protects a view; cleanup_preview and cleanup_commit remove selected views after confirmation; compare compares two stored views, without checkout or embeddings. register adds a folder; preview checks the scope; index/rebuild update; pause/cancel keep checkpoints; resume continues; policy picks on_search/eager; scope adjusts the scope; remove deletes only the local index. setup_audit (project_root) reports what Claude Code and Codex actually load for that folder (settings layers, plugins, hooks, MCP servers, skills, CLAUDE.md/AGENTS.md) and where they collide: hooks deciding on the same tool in parallel, missing hook scripts, silenced hooks, MCP servers down or offering duplicate tools, skill name and budget problems, AGENTS.md that only Codex reads, broken @imports; what could not be checked is listed as not verified; each finding carries its fix (the file to edit or the command to run), applied by the agent when the user agrees, never by Smart Tool; mode=last returns the stored report instead of auditing again. redirect_proposals (no project_root) lists the redirect patterns proposed from allowed searches, most matched first, with a guide; redirect_decide decides them by ids: accept, instruct (tip without blocking), reject, or remove an accepted one. Jobs via smart_search_result.",
373
373
  "inputSchema": {
374
374
  "type": "object", "properties": {
375
375
  "action": {"type": "string", "enum": ["list", "status", "register", "preview", "index", "rebuild", "pause", "cancel", "resume", "watch", "scope", "remove", "relocate", "probe", "policy", "inspect", "graph", "usage", "storage", "pin_view", "cleanup_preview", "cleanup_commit", "compare", "search_limits", "integration", "install_hook_preview", "install_hook", "duplicates", "duplicates_dismiss", "duplicates_restore", "docs", "layers", "affected_tests", "pr_impact", "setup_audit", "redirect_proposals", "redirect_decide"]},
@@ -1223,6 +1223,24 @@ def _perform_smart_search(arguments, job_id):
1223
1223
  return contextvars.copy_context().run(_perform_smart_search_isolated, arguments, job_id)
1224
1224
 
1225
1225
 
1226
+ def _nested_projects_note(root):
1227
+ """Names the registered projects inside `root`: each keeps its own index, so a search of `root` does not cover
1228
+ their files. Returns None when there are none."""
1229
+ inner = project_store.nested_projects(root)
1230
+ if not inner:
1231
+ return None
1232
+ base = project_identity.display_root(root)
1233
+ parts = []
1234
+ for rel in inner[:8]:
1235
+ path = os.path.join(base, *rel.split("/"))
1236
+ files = indexer.info(path).get("files")
1237
+ parts.append(f"{rel} ({files} files): project_root=\"{path}\"" if files is not None else
1238
+ f"{rel} (not indexed yet): project_root=\"{path}\"")
1239
+ more = f" and {len(inner) - 8} more" if len(inner) > 8 else ""
1240
+ return (f"{len(inner)} registered project(s) inside this folder keep their own index and are not in these "
1241
+ f"results; search them with smart_search on their folder: {'; '.join(parts)}{more}.")
1242
+
1243
+
1226
1244
  def _perform_smart_search_isolated(arguments, job_id):
1227
1245
  _update_job(job_id, phase="auth")
1228
1246
  problem = _gateway_problem()
@@ -1367,12 +1385,15 @@ def _perform_smart_search_isolated(arguments, job_id):
1367
1385
  _job_checkpoint(job_id)
1368
1386
  if not any(blocks.values()):
1369
1387
  notes.append(EMPTY_RESULT_NOTICE)
1388
+ nested = _nested_projects_note(root)
1389
+ if nested:
1390
+ notes.append(nested)
1370
1391
  warning = " ".join(warnings)
1371
1392
  if warning:
1372
1393
  _update_job(job_id, warning=warning)
1373
1394
  if arguments.get("_structured"):
1374
1395
  return {"source": source if source == "cold" or vectors else "lexical index", "blocks": blocks,
1375
- "warnings": warnings}
1396
+ "warnings": warnings + ([nested] if nested else [])}
1376
1397
  return _grouped_yaml(index_profile.public(profile), blocks, " ".join(warnings + notes))
1377
1398
 
1378
1399
 
@@ -2119,13 +2140,23 @@ def _with_project_id(arguments):
2119
2140
  return arguments
2120
2141
  wanted = project_identity.canonical_root(root)
2121
2142
  match = next((p for p in project_store.all_projects() if project_identity.canonical_root(p["root"]) == wanted), None)
2122
- if not match:
2143
+ if match:
2144
+ return {**arguments, "project_id": match["id"]}
2145
+ inner = project_store.containing(root) if arguments.get("action") == "status" else None
2146
+ if not inner:
2123
2147
  raise ValueError(f"No registered project at {root}; register it first (action=register).")
2124
- return {**arguments, "project_id": match["id"]}
2148
+ return {**arguments, "project_id": inner["id"], "resolved_from": root}
2125
2149
 
2126
2150
 
2127
2151
  def _project_summary(project):
2128
- data = _project_payload(project)
2152
+ """One line of `list`. A project whose payload cannot be read (its folder was deleted, Git refuses it) is listed as
2153
+ unavailable with the reason, so one broken entry does not hide the others."""
2154
+ try:
2155
+ data = _project_payload(project)
2156
+ except Exception as exc:
2157
+ return {"project_id": project["id"], "name": project.get("name"), "root": project["root"],
2158
+ "status": "unavailable", "enabled": project.get("enabled"), "paused": project.get("paused"),
2159
+ "last_error": _project_error(exc)[:200]}
2129
2160
  index = data.get("index") or {}
2130
2161
  jobs = data.get("jobs") or []
2131
2162
  return {"project_id": data["id"], "name": data.get("name"), "root": data["root"], "status": data.get("status"),
@@ -2325,6 +2356,9 @@ def _project_action_locked(arguments):
2325
2356
  if not project:
2326
2357
  raise ValueError("Project not registered.")
2327
2358
  if action == "status":
2359
+ if arguments.get("resolved_from"):
2360
+ return {"project": _project_payload(project), "resolved_from": arguments["resolved_from"],
2361
+ "detail": "project_root is inside this registered project (the deepest one that holds it)."}
2328
2362
  return {"project": _project_payload(project)}
2329
2363
  if action == "search_limits":
2330
2364
  if not isinstance(arguments.get("top_k"), dict):
package/version.py CHANGED
@@ -1,7 +1,7 @@
1
1
  """Single source of the Smart Tool version and of the User-Agent sent to public APIs."""
2
2
  import re
3
3
 
4
- VERSION = "0.9.69"
4
+ VERSION = "0.9.70"
5
5
  _CONTACT_RE = re.compile(r"^(?:[^\s@()<>;]+@[^\s@()<>;]+\.[^\s@()<>;]+|https?://[^\s()<>;]+)$")
6
6
 
7
7