@resultant-dev/setup 1.13.2 → 1.14.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 +7 -0
- package/package.json +4 -1
- package/setup.mjs +58 -5
package/README.md
CHANGED
|
@@ -8,6 +8,13 @@ This launcher runs the matching `resultant-mcp` version from PyPI. It needs
|
|
|
8
8
|
uv or Python 3.10 or later and your installed coding agent. The configured
|
|
9
9
|
MCP server runs on hosted Resultant.
|
|
10
10
|
|
|
11
|
+
Run `npx @resultant-dev/setup doctor` to check the connection afterwards. It
|
|
12
|
+
reads the address and project from your agent's saved Resultant entry and
|
|
13
|
+
changes nothing. `npx @resultant-dev/setup login` signs this machine in again.
|
|
14
|
+
Add `--quiet` to print only what needs your action and one result line.
|
|
15
|
+
Output is plain text when `NO_COLOR` or `CI` is set or the output is not a
|
|
16
|
+
terminal. Setup sends no usage data.
|
|
17
|
+
|
|
11
18
|
For projects ready for governed builds, Codex setup offers to remember approval
|
|
12
19
|
for routine stage work and test evidence submissions. You can choose to keep
|
|
13
20
|
Codex's prompts. Accepting requirements and confirming scope changes still
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@resultant-dev/setup",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "Connect Codex or Claude Code to hosted Resultant",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
8
|
"resultant-setup": "./setup.mjs"
|
|
9
9
|
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "node --test"
|
|
12
|
+
},
|
|
10
13
|
"files": [
|
|
11
14
|
"setup.mjs",
|
|
12
15
|
"README.md"
|
package/setup.mjs
CHANGED
|
@@ -6,9 +6,52 @@ import { join } from "node:path";
|
|
|
6
6
|
|
|
7
7
|
const { version } = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8"));
|
|
8
8
|
const distribution = "resultant-mcp==" + version;
|
|
9
|
-
const
|
|
9
|
+
const LAUNCHER = "npx @resultant-dev/setup";
|
|
10
|
+
const given = process.argv.slice(2);
|
|
11
|
+
// `doctor` and `login` run those commands of the pinned connector; everything else is connect's.
|
|
12
|
+
const [first, ...rest] = given;
|
|
13
|
+
const tool =
|
|
14
|
+
first === "doctor" ? { script: "resultant-doctor", module: ["-m", "resultant_mcp.doctor"], args: rest }
|
|
15
|
+
: first === "login" ? { script: "resultant-mcp", module: ["-m", "resultant_mcp"], args: ["login", ...rest] }
|
|
16
|
+
: { script: "resultant-mcp", module: ["-m", "resultant_mcp"], args: ["connect", ...given] };
|
|
17
|
+
// The connector prints commands for the developer to run next; this makes them name this launcher.
|
|
18
|
+
const env = { ...process.env, RESULTANT_SETUP_LAUNCHER: LAUNCHER };
|
|
10
19
|
|
|
11
|
-
const run = (command, argv, stdio = "inherit") => spawnSync(command, argv, { stdio });
|
|
20
|
+
const run = (command, argv, stdio = "inherit") => spawnSync(command, argv, { stdio, env });
|
|
21
|
+
|
|
22
|
+
// The connector's terminal rules (installer-experience.html, section 6): plain output with ASCII tags
|
|
23
|
+
// for NO_COLOR, a pipe, CI or TERM=dumb; the Unicode set only where the terminal shows it.
|
|
24
|
+
function mode(stream) {
|
|
25
|
+
const term = String(process.env.TERM ?? "").toLowerCase();
|
|
26
|
+
const ci = !["", "0", "false"].includes(String(process.env.CI ?? "").trim().toLowerCase());
|
|
27
|
+
const plain = Boolean(process.env.NO_COLOR) || !stream.isTTY || ci || term === "dumb";
|
|
28
|
+
const unicode = !plain && term !== "linux"
|
|
29
|
+
&& (process.platform !== "win32" || Boolean(process.env.WT_SESSION) || process.env.TERM_PROGRAM === "vscode");
|
|
30
|
+
return { plain, unicode, indent: plain ? "" : " " };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const MARKS = { info: ["·", "[wait]", "2"], fail: ["✗", "[fail]", "31"], next: ["→", "->", "1"] };
|
|
34
|
+
|
|
35
|
+
function mark(stream, role) {
|
|
36
|
+
const { plain, unicode } = mode(stream);
|
|
37
|
+
const [glyph, tag, tone] = MARKS[role];
|
|
38
|
+
const shown = unicode ? glyph : tag;
|
|
39
|
+
return (plain ? shown : `\x1b[${tone}m${shown}\x1b[0m`) + (unicode ? " " : " ".repeat(7 - tag.length));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// What happened, what did not change, and the command to run, as the connector prints its failures.
|
|
43
|
+
function failure(headline, lines, steps) {
|
|
44
|
+
const stream = process.stderr;
|
|
45
|
+
const { plain, unicode, indent } = mode(stream);
|
|
46
|
+
const more = indent + " ".repeat(unicode ? 2 : 7);
|
|
47
|
+
const out = plain ? [] : [""];
|
|
48
|
+
out.push(indent + mark(stream, "fail") + headline, ...lines.map((text) => more + text));
|
|
49
|
+
steps.forEach(([kind, text], index) => {
|
|
50
|
+
if (index === 0) out.push("", indent + mark(stream, "next") + text);
|
|
51
|
+
else out.push(more + (kind === "cmd" ? " " : "") + text);
|
|
52
|
+
});
|
|
53
|
+
stream.write(out.join("\n") + "\n");
|
|
54
|
+
}
|
|
12
55
|
|
|
13
56
|
function status(result) {
|
|
14
57
|
if (result.error) console.error("Could not run Resultant setup. " + result.error.message);
|
|
@@ -16,7 +59,8 @@ function status(result) {
|
|
|
16
59
|
}
|
|
17
60
|
|
|
18
61
|
function main() {
|
|
19
|
-
|
|
62
|
+
// --quiet keeps uv's own download lines out of the setup output.
|
|
63
|
+
const uv = run("uvx", ["--quiet", "--from", distribution, tool.script, ...tool.args]);
|
|
20
64
|
if (uv.error?.code !== "ENOENT") return status(uv);
|
|
21
65
|
|
|
22
66
|
const windows = process.platform === "win32";
|
|
@@ -25,10 +69,19 @@ function main() {
|
|
|
25
69
|
run(command, [...flags, "-c", "import sys; sys.exit(sys.version_info < (3, 10))"], "ignore").status === 0
|
|
26
70
|
);
|
|
27
71
|
if (!python) {
|
|
28
|
-
|
|
72
|
+
failure("Resultant setup needs uv or Python 3.10 or later", ["Nothing was changed."], [
|
|
73
|
+
["say", "Install uv or Python 3.10 or later, open a new terminal, and run:"],
|
|
74
|
+
["cmd", [LAUNCHER, ...given].join(" ")],
|
|
75
|
+
["say", "Or copy the connection command from your project's Coding agent"],
|
|
76
|
+
["say", "page in Resultant."],
|
|
77
|
+
]);
|
|
29
78
|
return 1;
|
|
30
79
|
}
|
|
31
80
|
|
|
81
|
+
// One status line for the wait while pip installs the connector into a temporary environment.
|
|
82
|
+
const { indent, unicode } = mode(process.stdout);
|
|
83
|
+
process.stdout.write(`${indent}${mark(process.stdout, "info")}Installing resultant-mcp ${version} in a temporary `
|
|
84
|
+
+ `environment (no uv)${unicode ? "…" : "..."}\n`);
|
|
32
85
|
const [command, ...flags] = python;
|
|
33
86
|
const scratch = mkdtempSync(join(tmpdir(), "resultant-setup-"));
|
|
34
87
|
try {
|
|
@@ -37,7 +90,7 @@ function main() {
|
|
|
37
90
|
const interpreter = windows ? join(scratch, "Scripts", "python.exe") : join(scratch, "bin", "python");
|
|
38
91
|
const install = run(interpreter, ["-m", "pip", "--disable-pip-version-check", "install", "--quiet", distribution]);
|
|
39
92
|
if (install.status !== 0) return status(install);
|
|
40
|
-
return status(run(interpreter, [
|
|
93
|
+
return status(run(interpreter, [...tool.module, ...tool.args]));
|
|
41
94
|
} finally {
|
|
42
95
|
rmSync(scratch, { recursive: true, force: true });
|
|
43
96
|
}
|