fixmyslop 0.3.0 → 0.3.2
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/bin/fixmyslop.js +30 -17
- package/package.json +1 -1
package/bin/fixmyslop.js
CHANGED
|
@@ -1,33 +1,46 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Thin launcher: runs the FixMySlop Python CLI of the
|
|
3
|
-
//
|
|
2
|
+
// Thin launcher: runs the FixMySlop Python CLI of the SAME version as this npm package —
|
|
3
|
+
// a matching local install if there is one, otherwise via uvx or pipx.
|
|
4
4
|
"use strict";
|
|
5
5
|
const { spawnSync } = require("node:child_process");
|
|
6
6
|
const { version } = require("../package.json");
|
|
7
7
|
|
|
8
8
|
const args = process.argv.slice(2);
|
|
9
|
+
const VERSION_PROBE =
|
|
10
|
+
"import importlib.metadata as m, sys; print(m.version('fixmyslop'))";
|
|
9
11
|
|
|
10
|
-
function
|
|
11
|
-
const r = spawnSync(cmd, probe, {
|
|
12
|
-
return r.status === 0;
|
|
12
|
+
function ok(cmd, probe) {
|
|
13
|
+
const r = spawnSync(cmd, probe, { encoding: "utf8" });
|
|
14
|
+
return r.status === 0 ? (r.stdout || "").trim() || "ok" : null;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
function run(cmd, cmdArgs) {
|
|
16
18
|
const r = spawnSync(cmd, cmdArgs, { stdio: "inherit" });
|
|
17
|
-
if (r.error) return
|
|
19
|
+
if (r.error) return;
|
|
18
20
|
process.exit(r.status ?? 1);
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (
|
|
25
|
-
if (
|
|
23
|
+
let outdated = null;
|
|
24
|
+
for (const python of ["python3", "python", "py"]) {
|
|
25
|
+
const installed = ok(python, ["-c", VERSION_PROBE]);
|
|
26
|
+
if (installed === version) run(python, ["-m", "fixmyslop", ...args]);
|
|
27
|
+
if (installed && !outdated) outdated = { python, installed };
|
|
28
|
+
}
|
|
29
|
+
if (ok("uvx", ["--version"])) run("uvx", [`fixmyslop@${version}`, ...args]);
|
|
30
|
+
if (ok("pipx", ["--version"])) run("pipx", ["run", "--spec", `fixmyslop==${version}`, "fixmyslop", ...args]);
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
);
|
|
32
|
+
if (outdated) {
|
|
33
|
+
console.error(
|
|
34
|
+
`Found fixmyslop ${outdated.installed}, but this launcher runs ${version}. Upgrade with:\n` +
|
|
35
|
+
` ${outdated.python} -m pip install -U "fixmyslop==${version}"\n` +
|
|
36
|
+
"or install uv (https://docs.astral.sh/uv/) so npx can fetch the right version automatically."
|
|
37
|
+
);
|
|
38
|
+
} else {
|
|
39
|
+
console.error(
|
|
40
|
+
"FixMySlop needs Python 3.10+ and one of these:\n" +
|
|
41
|
+
" uv https://docs.astral.sh/uv/ (then `npx fixmyslop` just works)\n" +
|
|
42
|
+
" pipx https://pipx.pypa.io/\n" +
|
|
43
|
+
` or: pip install "fixmyslop==${version}"`
|
|
44
|
+
);
|
|
45
|
+
}
|
|
33
46
|
process.exit(127);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fixmyslop",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "The slop linter for the AI-agent era: catch AI slop in UI and code in milliseconds, then let your agent fix it.",
|
|
5
5
|
"bin": { "fixmyslop": "bin/fixmyslop.js" },
|
|
6
6
|
"files": ["bin/", "README.md"],
|