wizards 0.5.2 → 0.5.4
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 +2 -0
- package/apps/runtime/dist/docs/user/install.md +13 -4
- package/apps/web/dist/assets/{AboutDialog-hRgrS60N.js → AboutDialog-bhhy9HRO.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-BUSpLhC6.js → ChangelogDialog-D9ah1ci5.js} +1 -1
- package/apps/web/dist/assets/{ChatView-DO7P5Vv_.js → ChatView-CuljhZnF.js} +1 -1
- package/apps/web/dist/assets/EditorPage-CVgg8SLx.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-CKrwLPN0.js → FlowPreview-B4-ipMdE.js} +1 -1
- package/apps/web/dist/assets/{Harness-o8IIQXZp.js → Harness-BV8gMiPK.js} +1 -1
- package/apps/web/dist/assets/{NewWizardChannels-DqU79Myj.js → NewWizardChannels-BhkJL7eU.js} +1 -1
- package/apps/web/dist/assets/{NewWizardPage-D1UCvmDp.js → NewWizardPage-BlupHqfu.js} +1 -1
- package/apps/web/dist/assets/{OnboardingPage-C70bqPnq.js → OnboardingPage-DNNJERrP.js} +1 -1
- package/apps/web/dist/assets/{ProjectPage-BOLvmQWZ.js → ProjectPage-BHFA5VOD.js} +1 -1
- package/apps/web/dist/assets/{PublicRunner-B0PGyHI9.js → PublicRunner-D0hNBFLr.js} +1 -1
- package/apps/web/dist/assets/{ReadOnly-B0mJBD1q.js → ReadOnly-_E2WzuVY.js} +1 -1
- package/apps/web/dist/assets/{RunDrawer-BsnsIJ0Y.js → RunDrawer-CKj33nE9.js} +1 -1
- package/apps/web/dist/assets/{RunnerView-B56i3nKO.js → RunnerView-Cu8eYdjN.js} +1 -1
- package/apps/web/dist/assets/{SettingsPage-BvfRUqb2.js → SettingsPage-D-1qYnoA.js} +1 -1
- package/apps/web/dist/assets/{SetupPage-BvAFPu1J.js → SetupPage-Dt-XGTc9.js} +1 -1
- package/apps/web/dist/assets/{SharePage-hV5pYrO2.js → SharePage-DIvPwK8x.js} +1 -1
- package/apps/web/dist/assets/changelog-BQtOjFPy.js +1 -0
- package/apps/web/dist/assets/{esm-DfapVSy6.js → esm-J06O1nN_.js} +1 -1
- package/apps/web/dist/assets/index-CZFfDGHy.css +1 -0
- package/apps/web/dist/assets/{index-BuFrRzvG.js → index-DdHpJXbv.js} +7 -7
- package/apps/web/dist/assets/{lock-B-tJwE4p.js → lock-ChDlFFHO.js} +1 -1
- package/apps/web/dist/assets/{phone-DRHxY0l_.js → phone-Cr7jz_kf.js} +1 -1
- package/apps/web/dist/assets/{settings-menu-OPrJTW8a.js → settings-menu-BAwHMXCR.js} +1 -1
- package/apps/web/dist/assets/{ui-DftgEA2k.js → ui-C5_NcAmG.js} +1 -1
- package/apps/web/dist/assets/{upload-B73coFNw.js → upload-DcAIMe8d.js} +1 -1
- package/apps/web/dist/index.html +3 -3
- package/apps/web/dist/mcp/flow.html +3 -3
- package/bin/wizards.mjs +182 -3
- package/package.json +4 -2
- package/apps/web/dist/assets/EditorPage-BabV35Bj.js +0 -3
- package/apps/web/dist/assets/changelog-BftXQzUA.js +0 -1
- package/apps/web/dist/assets/index-DSbQiZY8.css +0 -1
package/bin/wizards.mjs
CHANGED
|
@@ -1,8 +1,187 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// The `wizards` command. Kept to what every Node understands, so that an old one gets
|
|
3
|
-
//
|
|
2
|
+
// The `wizards` command. Kept to what every Node understands, so that an old one gets a new
|
|
3
|
+
// one installed instead of a syntax error.
|
|
4
|
+
//
|
|
5
|
+
// A copy from npm (`npx wizards`, `npm install -g wizards`) is the way to the install, not the
|
|
6
|
+
// install itself. On macOS and Linux it installs engenty wizards into ~/.engenty/wizards with the
|
|
7
|
+
// installer it carries (apps/web/dist/install.sh: its own Node, the runtime, the `wizards`
|
|
8
|
+
// command), brings an older install there up to its own version, and hands the command to it.
|
|
9
|
+
// What needs no install (--version, --help, validate, mcp) runs here, as long as this Node can.
|
|
10
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
11
|
+
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
12
|
+
import { homedir } from "node:os";
|
|
13
|
+
import { delimiter, dirname, join, resolve, sep } from "node:path";
|
|
14
|
+
import { fileURLToPath } from "node:url";
|
|
15
|
+
|
|
4
16
|
const [major, minor] = process.versions.node.split(".").map(Number);
|
|
5
|
-
|
|
17
|
+
const currentNode = major > 24 || (major === 24 && minor >= 11);
|
|
18
|
+
|
|
19
|
+
const args = process.argv.slice(2);
|
|
20
|
+
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
21
|
+
const home = join(
|
|
22
|
+
resolve((process.env.ENGENTY_HOME || "").trim() || join(homedir(), ".engenty")),
|
|
23
|
+
"wizards",
|
|
24
|
+
);
|
|
25
|
+
const runtime = join(home, "runtime");
|
|
26
|
+
const wrapper = join(home, "bin", "wizards");
|
|
27
|
+
const RUN_HERE = ["help", "validate", "mcp"];
|
|
28
|
+
const tilde = (path) =>
|
|
29
|
+
path.startsWith(homedir() + sep) ? `~${path.slice(homedir().length)}` : path;
|
|
30
|
+
|
|
31
|
+
function versionOf(dir) {
|
|
32
|
+
try {
|
|
33
|
+
return JSON.parse(readFileSync(join(dir, "package.json"), "utf8")).version || null;
|
|
34
|
+
} catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Whether version a is older than b, by major, minor and patch. */
|
|
40
|
+
function older(a, b) {
|
|
41
|
+
const pa = a.split(/[.+-]/).map(Number);
|
|
42
|
+
const pb = b.split(/[.+-]/).map(Number);
|
|
43
|
+
for (let i = 0; i < 3; i++) {
|
|
44
|
+
if ((pa[i] || 0) !== (pb[i] || 0)) {
|
|
45
|
+
return (pa[i] || 0) < (pb[i] || 0);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** The command as cli/main.ts reads it: "" for the menu. */
|
|
52
|
+
function commandOf(argv) {
|
|
53
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
54
|
+
return "help";
|
|
55
|
+
}
|
|
56
|
+
if (argv.includes("--version") || argv.includes("-v")) {
|
|
57
|
+
return "version";
|
|
58
|
+
}
|
|
59
|
+
for (let i = 0; i < argv.length; i++) {
|
|
60
|
+
if (argv[i] === "--client") {
|
|
61
|
+
i++;
|
|
62
|
+
} else if (!argv[i].startsWith("-")) {
|
|
63
|
+
return argv[i];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return "";
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** This copy is the one install.sh put into the home folder (Node names this file by its real path). */
|
|
70
|
+
function isInstall() {
|
|
71
|
+
try {
|
|
72
|
+
return root.startsWith(realpathSync(runtime) + sep);
|
|
73
|
+
} catch {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** The terminal's environment without what npm put in for running this command. */
|
|
79
|
+
function terminalEnv() {
|
|
80
|
+
const env = {};
|
|
81
|
+
for (const [key, value] of Object.entries(process.env)) {
|
|
82
|
+
if (!key.startsWith("npm_") && !["INIT_CWD", "NODE", "COLOR"].includes(key)) {
|
|
83
|
+
env[key] = value;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
env.PATH = (process.env.PATH || "")
|
|
87
|
+
.split(delimiter)
|
|
88
|
+
.filter((dir) => !/[\\/](node_modules[\\/]\.bin|node-gyp-bin)$/.test(dir))
|
|
89
|
+
.join(delimiter);
|
|
90
|
+
return env;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** The installer this copy carries, for its own version; true when it ran to its end. */
|
|
94
|
+
function install(version, quiet) {
|
|
95
|
+
const result = spawnSync(
|
|
96
|
+
"bash",
|
|
97
|
+
[join(root, "apps", "web", "dist", "install.sh"), "--no-setup"],
|
|
98
|
+
{
|
|
99
|
+
// A command whose output is read (validate --json, mcp) keeps its stdout to itself.
|
|
100
|
+
stdio: ["ignore", quiet ? 2 : "inherit", "inherit"],
|
|
101
|
+
env: {
|
|
102
|
+
...terminalEnv(),
|
|
103
|
+
// The same package npm just ran; ENGENTY_WIZARDS_PACKAGE stays an override for tests.
|
|
104
|
+
ENGENTY_WIZARDS_PACKAGE: process.env.ENGENTY_WIZARDS_PACKAGE || `wizards@${version}`,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
);
|
|
108
|
+
return result.status === 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Whether a runtime of the install runs: the note it keeps in its data folder (running.ts). */
|
|
112
|
+
function runs() {
|
|
113
|
+
let dataDir = (process.env.DATA_DIR || "").trim();
|
|
114
|
+
try {
|
|
115
|
+
const line = readFileSync(join(home, ".env"), "utf8").match(/^\s*DATA_DIR\s*=\s*(.*?)\s*$/m);
|
|
116
|
+
dataDir = dataDir || (line ? line[1].replace(/^(['"])(.*)\1$/, "$2") : "");
|
|
117
|
+
} catch {
|
|
118
|
+
// no .env: the data folder is where it always is
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
const { pid } = JSON.parse(
|
|
122
|
+
readFileSync(join(resolve(home, dataDir || "data"), "running.json"), "utf8"),
|
|
123
|
+
);
|
|
124
|
+
process.kill(pid, 0);
|
|
125
|
+
return true;
|
|
126
|
+
} catch (error) {
|
|
127
|
+
// EPERM: it runs, as somebody else.
|
|
128
|
+
return error.code === "EPERM";
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Runs the installed command with these arguments; its exit code. */
|
|
133
|
+
function handOver() {
|
|
134
|
+
return new Promise((done) => {
|
|
135
|
+
const child = spawn(wrapper, args, { stdio: "inherit", env: terminalEnv() });
|
|
136
|
+
// Ctrl-C reaches the installed command as well (same terminal); this one waits for it.
|
|
137
|
+
process.on("SIGINT", () => undefined);
|
|
138
|
+
process.on("SIGTERM", () => child.kill("SIGTERM"));
|
|
139
|
+
child.on("error", (error) => {
|
|
140
|
+
console.error(`${wrapper} did not start: ${error.message}`);
|
|
141
|
+
done(127);
|
|
142
|
+
});
|
|
143
|
+
child.on("exit", (code) => done(code ?? 1));
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const command = commandOf(args);
|
|
148
|
+
if (command === "version") {
|
|
149
|
+
console.log(versionOf(root));
|
|
150
|
+
process.exit(0);
|
|
151
|
+
}
|
|
152
|
+
const fromNpm =
|
|
153
|
+
process.platform !== "win32" && !existsSync(join(root, "pnpm-workspace.yaml")) && !isInstall();
|
|
154
|
+
if (fromNpm && (!currentNode || !RUN_HERE.includes(command))) {
|
|
155
|
+
const own = versionOf(root) || "0.0.0";
|
|
156
|
+
const installed = existsSync(wrapper)
|
|
157
|
+
? versionOf(join(runtime, "node_modules", "wizards"))
|
|
158
|
+
: null;
|
|
159
|
+
if (!installed || older(installed, own)) {
|
|
160
|
+
const quiet = RUN_HERE.includes(command);
|
|
161
|
+
const running = installed && runs();
|
|
162
|
+
if (install(own, quiet)) {
|
|
163
|
+
// What runs is still the old version: it starts again as the new one.
|
|
164
|
+
if (running) {
|
|
165
|
+
spawnSync(wrapper, ["restart"], {
|
|
166
|
+
stdio: ["ignore", quiet ? 2 : "inherit", "inherit"],
|
|
167
|
+
env: terminalEnv(),
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
} else if (currentNode && !installed) {
|
|
171
|
+
console.error(
|
|
172
|
+
`The install into ${tilde(home)} failed; this time engenty wizards runs from npm.\n`,
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
} else if (older(own, installed)) {
|
|
176
|
+
console.error(
|
|
177
|
+
`${tilde(home)} has engenty wizards ${installed}, newer than ${own}; that one runs.`,
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
if (existsSync(wrapper) && versionOf(join(runtime, "node_modules", "wizards"))) {
|
|
181
|
+
process.exit(await handOver());
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (!currentNode) {
|
|
6
185
|
console.error(
|
|
7
186
|
`engenty wizards needs Node.js 24.11 or newer. This is ${process.version}.\n` +
|
|
8
187
|
"The installer brings its own and leaves yours alone:\n\n" +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wizards",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "Make a wish. Get your wizard. It guides you step by step. Let AI do the work. Runs on your machine, on the AI subscription you already have.",
|
|
5
5
|
"license": "FSL-1.1-MIT",
|
|
6
6
|
"homepage": "https://engenty.ai",
|
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
"mammoth": "1.13.0",
|
|
58
58
|
"marked": "18.0.14",
|
|
59
59
|
"nanoid": "5.1.16",
|
|
60
|
-
"node-pty": "1.1.0",
|
|
61
60
|
"pdf-parse": "2.4.5",
|
|
62
61
|
"playwright-core": "1.63.0",
|
|
63
62
|
"postal-mime": "4.0.2",
|
|
@@ -66,6 +65,9 @@
|
|
|
66
65
|
"undici": "7.30.0",
|
|
67
66
|
"zod": "4.6.5"
|
|
68
67
|
},
|
|
68
|
+
"optionalDependencies": {
|
|
69
|
+
"node-pty": "1.1.0"
|
|
70
|
+
},
|
|
69
71
|
"bundleDependencies": [
|
|
70
72
|
"@engenty-wizards/plugin-sdk",
|
|
71
73
|
"@engenty-wizards/shared"
|