threadlens 1.0.0

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/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # threadlens (npm)
2
+
3
+ Local cross-harness search for coding-agent sessions.
4
+
5
+ ```bash
6
+ npm install -g threadlens
7
+ threadlens start
8
+ threadlens search "plunk otp"
9
+ ```
10
+
11
+ Or run it once without installing:
12
+
13
+ ```bash
14
+ npx threadlens search "plunk otp"
15
+ ```
16
+
17
+ ## Requirements
18
+
19
+ threadlens is a pure-Python CLI (stdlib only). This npm package is a thin
20
+ launcher that runs the bundled source with **your** Python, so it needs:
21
+
22
+ - **Python 3.10+** on your `PATH`
23
+
24
+ macOS and most Linux distros already ship `python3`. If yours doesn't, install
25
+ Python, or use the Python-native distribution which can fetch Python for you:
26
+
27
+ ```bash
28
+ uv tool install threadlens # then run `threadlens`
29
+ uvx threadlens search "..." # run without installing
30
+ ```
31
+
32
+ Use a specific interpreter with `THREADLENS_PYTHON=/path/to/python`.
33
+
34
+ See the [project README](https://github.com/moinulmoin/threadlens#readme) for
35
+ full usage.
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ // Thin launcher for the threadlens Python CLI.
5
+ //
6
+ // The real tool is pure-Python (stdlib only). This npm package vendors that
7
+ // source under ./vendor and runs it with the user's own Python interpreter, so
8
+ // `threadlens skill` keeps returning a real, copyable on-disk path (a zipapp
9
+ // would hide those files inside an archive).
10
+
11
+ const { spawnSync } = require("node:child_process");
12
+ const path = require("node:path");
13
+
14
+ // vendor/ contains the importable `threadlens` package directory.
15
+ const vendorDir = path.join(__dirname, "..", "vendor");
16
+
17
+ function isPython310(cmd) {
18
+ const probe =
19
+ "import sys; raise SystemExit(0 if sys.version_info[:2] >= (3, 10) else 1)";
20
+ const res = spawnSync(cmd, ["-c", probe], { stdio: "ignore" });
21
+ return res.status === 0;
22
+ }
23
+
24
+ function pickPython() {
25
+ const override = process.env.THREADLENS_PYTHON;
26
+ const candidates = override ? [override] : ["python3", "python"];
27
+ for (const cmd of candidates) {
28
+ try {
29
+ if (isPython310(cmd)) return cmd;
30
+ } catch (_) {
31
+ // not found / not executable; try the next candidate
32
+ }
33
+ }
34
+ return null;
35
+ }
36
+
37
+ const python = pickPython();
38
+
39
+ if (!python) {
40
+ process.stderr.write(
41
+ [
42
+ "threadlens: could not find Python 3.10+ on your PATH.",
43
+ "",
44
+ "threadlens is a Python CLI; this npm package is a thin launcher.",
45
+ "Fix it with either:",
46
+ "",
47
+ " • Install Python 3.10+ (https://www.python.org/downloads or `brew install python`)",
48
+ " • Or install the native build with uv (it can fetch Python for you):",
49
+ " uv tool install threadlens # then run `threadlens`",
50
+ ' uvx threadlens search "..." # run without installing',
51
+ "",
52
+ "Already have a specific interpreter? Point at it:",
53
+ " THREADLENS_PYTHON=/path/to/python threadlens ...",
54
+ "",
55
+ ].join("\n")
56
+ );
57
+ process.exit(127);
58
+ }
59
+
60
+ const env = { ...process.env, PYTHONDONTWRITEBYTECODE: "1" };
61
+ env.PYTHONPATH = env.PYTHONPATH
62
+ ? vendorDir + path.delimiter + env.PYTHONPATH
63
+ : vendorDir;
64
+
65
+ const res = spawnSync(python, ["-m", "threadlens", ...process.argv.slice(2)], {
66
+ stdio: "inherit",
67
+ env,
68
+ });
69
+
70
+ if (res.error) {
71
+ process.stderr.write(`threadlens: failed to launch Python: ${res.error.message}\n`);
72
+ process.exit(1);
73
+ }
74
+
75
+ process.exit(res.status === null ? 1 : res.status);
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "threadlens",
3
+ "version": "1.0.0",
4
+ "description": "Local cross-harness search for agent threads",
5
+ "bin": {
6
+ "threadlens": "bin/threadlens.js"
7
+ },
8
+ "files": [
9
+ "bin/",
10
+ "vendor/"
11
+ ],
12
+ "engines": {
13
+ "node": ">=16"
14
+ },
15
+ "scripts": {
16
+ "prepack": "node scripts/sync.mjs"
17
+ },
18
+ "keywords": [
19
+ "agents",
20
+ "cli",
21
+ "search",
22
+ "sqlite",
23
+ "raycast",
24
+ "codex",
25
+ "claude-code",
26
+ "cursor"
27
+ ],
28
+ "license": "MIT",
29
+ "os": [
30
+ "darwin",
31
+ "linux",
32
+ "win32"
33
+ ],
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/moinulmoin/threadlens.git"
37
+ },
38
+ "homepage": "https://github.com/moinulmoin/threadlens#readme",
39
+ "bugs": {
40
+ "url": "https://github.com/moinulmoin/threadlens/issues"
41
+ }
42
+ }
@@ -0,0 +1,4 @@
1
+ """Local cross-harness search for agent threads."""
2
+
3
+ __version__ = "1.0.0"
4
+
@@ -0,0 +1,6 @@
1
+ from .cli import main
2
+
3
+
4
+ if __name__ == "__main__":
5
+ raise SystemExit(main())
6
+