@jokerized/tesserae 0.6.1
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 +34 -0
- package/bin/tesserae.js +91 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# @jokerized/tesserae
|
|
2
|
+
|
|
3
|
+
A thin **Node convenience wrapper** for [Tesserae](https://github.com/ca1773130n/Tesserae) — a context engine that compiles agent-ready knowledge from your project. The engine itself is a Python package; this wrapper just lets Node-centric users invoke it without leaving their toolchain.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx @jokerized/tesserae --help
|
|
7
|
+
npx @jokerized/tesserae init --yes
|
|
8
|
+
npx @jokerized/tesserae compile
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
- **Python 3.10+** on your PATH. The wrapper runs the real Python CLI; it does not reimplement it.
|
|
14
|
+
|
|
15
|
+
## How it resolves the runner
|
|
16
|
+
|
|
17
|
+
On each invocation, first match wins:
|
|
18
|
+
|
|
19
|
+
1. `$TESSERAE_PYTHON -m tesserae` — explicit override (power users / CI).
|
|
20
|
+
2. `python3` / `python` on PATH that can `import tesserae` — uses the Tesserae you already installed.
|
|
21
|
+
3. `pipx run --spec tesserae==<this version> tesserae` — ephemeral, pinned to the matching Python release (first run installs it).
|
|
22
|
+
4. Otherwise it prints install guidance (`pipx install tesserae`) and exits non-zero.
|
|
23
|
+
|
|
24
|
+
Arguments, stdio, and the exit code are forwarded transparently, so `npx @jokerized/tesserae <anything>` behaves exactly like the real `tesserae` CLI.
|
|
25
|
+
|
|
26
|
+
## Why a wrapper instead of a native package?
|
|
27
|
+
|
|
28
|
+
Tesserae's engine (graph extraction, retrieval/PPR, the on-demand context compiler, MCP server) is Python. Reimplementing it in Node would fork the project; wrapping it keeps a single source of truth on [PyPI](https://pypi.org/project/tesserae/) and gives npm users a one-command entry point.
|
|
29
|
+
|
|
30
|
+
The npm version tracks the Python release it pins (`@jokerized/tesserae@X.Y.Z` → `tesserae==X.Y.Z`).
|
|
31
|
+
|
|
32
|
+
## License
|
|
33
|
+
|
|
34
|
+
MIT — see the [main repository](https://github.com/ca1773130n/Tesserae).
|
package/bin/tesserae.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Node convenience wrapper for Tesserae (a Python CLI).
|
|
6
|
+
*
|
|
7
|
+
* Resolution order for the runner, first match wins:
|
|
8
|
+
* 1. $TESSERAE_PYTHON -m tesserae (explicit override; power users / tests)
|
|
9
|
+
* 2. <python> -m tesserae for python3/python on PATH that can `import tesserae`
|
|
10
|
+
* (fast path — uses the Tesserae the user already installed)
|
|
11
|
+
* 3. pipx run --spec tesserae==<this version> tesserae
|
|
12
|
+
* (ephemeral, pinned to the matching Python release)
|
|
13
|
+
* 4. otherwise print install guidance and exit 1.
|
|
14
|
+
*
|
|
15
|
+
* Args, stdio, exit code, and SIGINT/SIGTERM are forwarded transparently so
|
|
16
|
+
* `npx @jokerized/tesserae <anything>` behaves exactly like the real CLI.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const { spawnSync } = require("child_process");
|
|
20
|
+
const path = require("path");
|
|
21
|
+
|
|
22
|
+
const PKG_VERSION = require(path.join(__dirname, "..", "package.json")).version;
|
|
23
|
+
const ARGS = process.argv.slice(2);
|
|
24
|
+
|
|
25
|
+
function canImportTesserae(python) {
|
|
26
|
+
const probe = spawnSync(python, ["-c", "import tesserae"], {
|
|
27
|
+
stdio: "ignore",
|
|
28
|
+
});
|
|
29
|
+
return probe.status === 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function run(cmd, cmdArgs) {
|
|
33
|
+
const res = spawnSync(cmd, cmdArgs, { stdio: "inherit" });
|
|
34
|
+
if (res.error) {
|
|
35
|
+
// ENOENT etc. — signal "runner unavailable" to the caller.
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
// Mirror signal-terminated children as the conventional 128+signal code.
|
|
39
|
+
if (res.signal) {
|
|
40
|
+
return 128;
|
|
41
|
+
}
|
|
42
|
+
return res.status === null ? 1 : res.status;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function resolveAndRun() {
|
|
46
|
+
// 1. Explicit override.
|
|
47
|
+
const override = process.env.TESSERAE_PYTHON;
|
|
48
|
+
if (override) {
|
|
49
|
+
const code = run(override, ["-m", "tesserae", ...ARGS]);
|
|
50
|
+
if (code !== null) return code;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// 2. An already-installed Tesserae on a discoverable Python.
|
|
54
|
+
for (const python of ["python3", "python"]) {
|
|
55
|
+
if (canImportTesserae(python)) {
|
|
56
|
+
const code = run(python, ["-m", "tesserae", ...ARGS]);
|
|
57
|
+
if (code !== null) return code;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// 3. Ephemeral, version-pinned, via pipx.
|
|
62
|
+
const pipxProbe = spawnSync("pipx", ["--version"], { stdio: "ignore" });
|
|
63
|
+
if (pipxProbe.status === 0) {
|
|
64
|
+
process.stderr.write(
|
|
65
|
+
`[tesserae] no local install found — running tesserae==${PKG_VERSION} via pipx (first run installs it)\n`
|
|
66
|
+
);
|
|
67
|
+
const code = run(
|
|
68
|
+
"pipx",
|
|
69
|
+
["run", "--spec", `tesserae==${PKG_VERSION}`, "tesserae", ...ARGS]
|
|
70
|
+
);
|
|
71
|
+
if (code !== null) return code;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// 4. Nothing worked — guide the user.
|
|
75
|
+
process.stderr.write(
|
|
76
|
+
[
|
|
77
|
+
"Tesserae requires Python 3.10+ and the `tesserae` package.",
|
|
78
|
+
"",
|
|
79
|
+
"Install it one of these ways, then re-run:",
|
|
80
|
+
" pipx install tesserae # recommended (isolated)",
|
|
81
|
+
" pip install tesserae # into the current environment",
|
|
82
|
+
"",
|
|
83
|
+
"Or set TESSERAE_PYTHON to a Python that already has it:",
|
|
84
|
+
" TESSERAE_PYTHON=/path/to/python npx @jokerized/tesserae ...",
|
|
85
|
+
"",
|
|
86
|
+
].join("\n")
|
|
87
|
+
);
|
|
88
|
+
return 1;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
process.exit(resolveAndRun());
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jokerized/tesserae",
|
|
3
|
+
"version": "0.6.1",
|
|
4
|
+
"description": "Node convenience wrapper for Tesserae — a context engine that compiles agent-ready knowledge from your project. Forwards to the Python CLI.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"tesserae",
|
|
7
|
+
"context-engine",
|
|
8
|
+
"knowledge-graph",
|
|
9
|
+
"llm",
|
|
10
|
+
"agents",
|
|
11
|
+
"cli",
|
|
12
|
+
"wrapper"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/ca1773130n/Tesserae#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/ca1773130n/Tesserae/issues"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/ca1773130n/Tesserae.git",
|
|
21
|
+
"directory": "npm"
|
|
22
|
+
},
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"author": "Tesserae Contributors",
|
|
25
|
+
"type": "commonjs",
|
|
26
|
+
"bin": {
|
|
27
|
+
"tesserae": "bin/tesserae.js"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"bin/tesserae.js",
|
|
31
|
+
"README.md"
|
|
32
|
+
],
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=16"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
}
|
|
39
|
+
}
|