@allansantos-dev/smart-tool 0.9.7 → 0.9.8

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,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.8 - beta
4
+
5
+ - An update could keep running the previous code: npm dates every file in the package 1985-10-26, the installer kept
6
+ that date when copying, and Python reuses a compiled `.pyc` when the source's date and size match, so a file changed
7
+ without changing size (a version bump, a one-character fix) went on running the old bytecode. Reproduced on a real
8
+ reinstall: `version.py` said 0.9.6 and the daemon served 0.9.8. Copied and restored files now get the current time,
9
+ and the program's `__pycache__` folders are cleared after copying and after a rollback (two copies within the same
10
+ second keep the same date). The update to this version already clears any stale bytecode left by earlier ones.
11
+ Reported by the agent-launcher session, which had the same bug.
12
+
3
13
  ## 0.9.7 - beta
4
14
 
5
15
  The hook decides code searches with a fixed rule instead of the router model.
package/install.py CHANGED
@@ -197,6 +197,7 @@ def copy_files(target, files, backup, changed, removed):
197
197
  changed.append(rel)
198
198
  dest.parent.mkdir(parents=True, exist_ok=True)
199
199
  shutil.copy2(source, dest)
200
+ os.utime(dest)
200
201
  for rel in sorted(previous - set(files)):
201
202
  if (target / rel).is_file():
202
203
  (backup / rel).parent.mkdir(parents=True, exist_ok=True)
@@ -210,16 +211,31 @@ def copy_files(target, files, backup, changed, removed):
210
211
  indent=1), encoding="utf-8")
211
212
 
212
213
 
214
+ def clear_bytecode(target):
215
+ """Deletes the program's __pycache__ folders (the virtual environment's are left alone). npm writes the same
216
+ mtime (1985-10-26) into every tarball entry, and Python's bytecode check compares only the source's mtime and
217
+ size: a file changed without changing size kept running the old code after an update (reproduced on 2026-10-10:
218
+ version.py said 0.9.6, the daemon served 0.9.8)."""
219
+ for current, dirs, _files in os.walk(target):
220
+ dirs[:] = [d for d in dirs if d != ".venv"]
221
+ if "__pycache__" in dirs:
222
+ shutil.rmtree(Path(current) / "__pycache__", ignore_errors=True)
223
+ dirs.remove("__pycache__")
224
+
225
+
213
226
  def restore(target, backup, changed, removed):
214
227
  for rel in changed:
215
228
  if (backup / rel).is_file():
216
229
  shutil.copy2(backup / rel, target / rel)
230
+ os.utime(target / rel)
217
231
  else:
218
232
  (target / rel).unlink(missing_ok=True)
219
233
  for rel in removed:
220
234
  if (backup / rel).is_file():
221
235
  (target / rel).parent.mkdir(parents=True, exist_ok=True)
222
236
  shutil.move(backup / rel, target / rel)
237
+ os.utime(target / rel)
238
+ clear_bytecode(target)
223
239
  if (backup / MANIFEST).is_file():
224
240
  shutil.copy2(backup / MANIFEST, target / MANIFEST)
225
241
  else:
@@ -319,6 +335,7 @@ def main():
319
335
  changed, removed, frozen, deps_touched = [], [], None, False
320
336
  try:
321
337
  copy_files(target, files, backup, changed, removed)
338
+ clear_bytecode(target)
322
339
  print(f"Files changed: {len(changed)}; removed as obsolete: {len(removed)}")
323
340
  if not args.skip_deps:
324
341
  frozen = freeze(python)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allansantos-dev/smart-tool",
3
- "version": "0.9.7",
3
+ "version": "0.9.8",
4
4
  "description": "Local MCP server that gives coding agents (Claude Code, Codex) cheaper, sharper tools than their built-in search. Windows.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Allan Santos",
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.7"
4
+ VERSION = "0.9.8"
5
5
  _CONTACT_RE = re.compile(r"^(?:[^\s@()<>;]+@[^\s@()<>;]+\.[^\s@()<>;]+|https?://[^\s()<>;]+)$")
6
6
 
7
7