@allansantos-dev/smart-tool 0.9.50 → 0.9.51
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 +8 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/update_check.py +8 -3
- package/update_splash.py +10 -7
- package/version.py +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.51 - beta
|
|
4
|
+
|
|
5
|
+
- The automatic update installs the version the tray announced (`npx --yes @allansantos-dev/smart-tool@<version>
|
|
6
|
+
install`) instead of `@latest`. With `@latest`, npx could reuse an older package left in its cache and install that,
|
|
7
|
+
moving the install back a version. The update notices given to the user and to agent sessions ("To update now,
|
|
8
|
+
run: ...") name the same pinned command, and the update screen refuses to start without the version to install
|
|
9
|
+
instead of falling back to `@latest` (`tests/test_update_splash.py`, `tests/test_update_check.py`).
|
|
10
|
+
|
|
3
11
|
## 0.9.50 - beta
|
|
4
12
|
|
|
5
13
|
- Windows refused the setup-audit toast of a project whose path made the toast tag longer than 64 characters
|
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.
|
|
20
|
+
**Status:** 0.9.51 beta. Windows only. What changed in each version: [CHANGELOG.md](CHANGELOG.md).
|
|
21
21
|
|
|
22
22
|
## How it works
|
|
23
23
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allansantos-dev/smart-tool",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.51",
|
|
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/update_check.py
CHANGED
|
@@ -20,7 +20,6 @@ import version
|
|
|
20
20
|
|
|
21
21
|
PACKAGE = "@allansantos-dev/smart-tool"
|
|
22
22
|
REGISTRY_URL = "https://registry.npmjs.org/@allansantos-dev%2Fsmart-tool/latest"
|
|
23
|
-
UPDATE_COMMAND = f"npx --yes {PACKAGE}@latest install"
|
|
24
23
|
SITE_URL = "https://allansantos-dv.github.io/smart-tool/"
|
|
25
24
|
STATE_PATH = os.path.join(paths.DATA_DIR, "update-state.json")
|
|
26
25
|
UPDATE_LOG = os.path.join(paths.DATA_DIR, "update.log")
|
|
@@ -42,6 +41,12 @@ def newer_version(timeout=10):
|
|
|
42
41
|
return latest if _parts(latest) > _parts(version.VERSION) else None
|
|
43
42
|
|
|
44
43
|
|
|
44
|
+
def update_command(target):
|
|
45
|
+
"""The npx command that installs version target, as told to the user and to agent sessions. Pinned rather than
|
|
46
|
+
`@latest`, which lets npx reuse an older package from its cache."""
|
|
47
|
+
return f"npx --yes {PACKAGE}@{target} install"
|
|
48
|
+
|
|
49
|
+
|
|
45
50
|
def env_opted_out():
|
|
46
51
|
"""SMART_TOOL_AUTO_UPDATE set to off, 0, false or no."""
|
|
47
52
|
return os.environ.get(ENV_OPT_OUT, "").strip().lower() in ("off", "0", "false", "no")
|
|
@@ -144,10 +149,10 @@ def notices(now=None):
|
|
|
144
149
|
else "automatic updates are now off")
|
|
145
150
|
found.append((f"failed:{failed}",
|
|
146
151
|
f"The automatic update of Smart Tool to {failed} failed; {version.VERSION} is still installed "
|
|
147
|
-
f"and {retry}. To update now, run: {
|
|
152
|
+
f"and {retry}. To update now, run: {update_command(failed)}"))
|
|
148
153
|
elif latest and _parts(latest) > _parts(version.VERSION):
|
|
149
154
|
how = ("the tray installs it automatically" if automatic_enabled()
|
|
150
|
-
else f"automatic updates are off (tray switch or {ENV_OPT_OUT}=off); to update, run: {
|
|
155
|
+
else f"automatic updates are off (tray switch or {ENV_OPT_OUT}=off); to update, run: {update_command(latest)}")
|
|
151
156
|
found.append((f"available:{latest}",
|
|
152
157
|
f"Smart Tool {latest} is available on npm (installed: {version.VERSION}); {how}."))
|
|
153
158
|
return found
|
package/update_splash.py
CHANGED
|
@@ -47,18 +47,19 @@ def step_for(line):
|
|
|
47
47
|
return None
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
def install_command():
|
|
51
|
-
"""argv of the update: the
|
|
50
|
+
def install_command(target):
|
|
51
|
+
"""argv of the update: the npx command a user types, through cmd.exe because npx is a .cmd script, for the version
|
|
52
|
+
the tray announced. `@latest` would let npx reuse an older package from its cache and install that instead."""
|
|
52
53
|
npx = node_locator.which("npx.cmd")
|
|
53
54
|
if not npx:
|
|
54
55
|
raise RuntimeError(i18n.t("Node.js (npx) was not found; install Node.js and try again."))
|
|
55
|
-
return ["cmd.exe", "/d", "/c", npx, "--yes", f"{update_check.PACKAGE}@
|
|
56
|
+
return ["cmd.exe", "/d", "/c", npx, "--yes", f"{update_check.PACKAGE}@{target}", "install"], npx
|
|
56
57
|
|
|
57
58
|
|
|
58
|
-
def run_install(lines):
|
|
59
|
+
def run_install(lines, target):
|
|
59
60
|
"""Runs the install command hidden, puts each output line on `lines`, writes them to update_check.UPDATE_LOG and returns
|
|
60
61
|
(exit code, last non-empty line). Kills the whole process tree after TIMEOUT_S."""
|
|
61
|
-
command, npx = install_command()
|
|
62
|
+
command, npx = install_command(target)
|
|
62
63
|
os.makedirs(os.path.dirname(update_check.UPDATE_LOG), exist_ok=True)
|
|
63
64
|
last = ""
|
|
64
65
|
with open(update_check.UPDATE_LOG, "w", encoding="utf-8") as log:
|
|
@@ -150,7 +151,9 @@ class Splash:
|
|
|
150
151
|
|
|
151
152
|
def main(argv):
|
|
152
153
|
"""Shows the screen, runs the update and reports the outcome; returns the installer's exit code."""
|
|
153
|
-
|
|
154
|
+
if len(argv) < 2:
|
|
155
|
+
raise SystemExit("usage: update_splash.py <version>: the version to install, as announced by the tray")
|
|
156
|
+
target = argv[1]
|
|
154
157
|
if not _single_instance():
|
|
155
158
|
return 0
|
|
156
159
|
splash = Splash(target)
|
|
@@ -158,7 +161,7 @@ def main(argv):
|
|
|
158
161
|
|
|
159
162
|
def work():
|
|
160
163
|
try:
|
|
161
|
-
outcome["code"], outcome["last"] = run_install(lines)
|
|
164
|
+
outcome["code"], outcome["last"] = run_install(lines, target)
|
|
162
165
|
except Exception as exc:
|
|
163
166
|
outcome["code"], outcome["last"] = 1, f"{type(exc).__name__}: {exc}"
|
|
164
167
|
|
package/version.py
CHANGED