@zebeqo/vendy 0.0.0 → 2.0.0-beta.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/LICENSE +21 -0
- package/dist/index.mjs +170 -0
- package/package.json +44 -8
- package/index.js +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Zebeqo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import process from "node:process";
|
|
5
|
+
import { constants } from "node:os";
|
|
6
|
+
//#region src/Target.ts
|
|
7
|
+
/**
|
|
8
|
+
* The platform executable, and the words for when there is none.
|
|
9
|
+
*
|
|
10
|
+
* This module is pure and has no dependencies on purpose. It runs on Node,
|
|
11
|
+
* inside the published bin — the one file every user reaches, whatever their
|
|
12
|
+
* machine — so everything it decides is a function of three environment fields.
|
|
13
|
+
* That keeps it testable with no executable to resolve and none to spawn.
|
|
14
|
+
*
|
|
15
|
+
* It holds no list of supported targets. The package manager already made that
|
|
16
|
+
* decision when it installed the one platform package whose `os` and `cpu`
|
|
17
|
+
* match, or installed none: resolution is the check, and a second list here
|
|
18
|
+
* could only disagree with it.
|
|
19
|
+
*/
|
|
20
|
+
/** Installs the vendy agent skill: the second human path, and the only one left when nothing resolves. */
|
|
21
|
+
const agentSkill = "npx skills add https://github.com/Zebeqo/vendy --skill vendy";
|
|
22
|
+
/** `platform-arch`: the pair that names a build, its npm package, and the failure. */
|
|
23
|
+
const name = (environment) => `${environment.platform}-${environment.arch}`;
|
|
24
|
+
/**
|
|
25
|
+
* The npm package carrying the executable for this environment.
|
|
26
|
+
*
|
|
27
|
+
* The family is scoped because npm refused two of the unscoped names —
|
|
28
|
+
* `vendy-win32-x64` and its arm64 sibling — as spam, `win32` being a string
|
|
29
|
+
* typosquatters abuse. One scope keeps one vocabulary, rather than a Windows
|
|
30
|
+
* exception in the middle of the six.
|
|
31
|
+
*/
|
|
32
|
+
const packageName = (environment) => `@zebeqo/vendy-${name(environment)}`;
|
|
33
|
+
/**
|
|
34
|
+
* The specifier the launcher resolves.
|
|
35
|
+
*
|
|
36
|
+
* A subpath rather than the package itself: a platform package holds one
|
|
37
|
+
* executable and no JavaScript, so there is no entry point to import and
|
|
38
|
+
* nothing an `exports` map would have to describe.
|
|
39
|
+
*/
|
|
40
|
+
const executable = (environment) => `${packageName(environment)}/bin/vendy${environment.platform === "win32" ? ".exe" : ""}`;
|
|
41
|
+
/**
|
|
42
|
+
* musl is a supported `platform-arch` pair with an unsupported C library, so
|
|
43
|
+
* this names the reason rather than the pair. The two Linux packages declare
|
|
44
|
+
* `libc: "glibc"` so that nothing installs here and the user reads this instead
|
|
45
|
+
* of a dynamic linker error from an executable that could never have run.
|
|
46
|
+
*
|
|
47
|
+
* It says nothing about what did or did not install, because an installer that
|
|
48
|
+
* ignores `libc` puts the same user in front of the same wall one step later.
|
|
49
|
+
*/
|
|
50
|
+
const wrongLibc = (environment) => `vendy has no executable for ${name(environment)} with musl. The published Linux executables link against glibc, and none of them runs here.
|
|
51
|
+
|
|
52
|
+
You can still let your coding agent run vendy for you:
|
|
53
|
+
${agentSkill}`;
|
|
54
|
+
/**
|
|
55
|
+
* Two causes, one message, because the launcher cannot tell them apart: a
|
|
56
|
+
* platform nobody built for, and an install that left optional dependencies
|
|
57
|
+
* out. Both leave the same hole, and both recoveries are one line.
|
|
58
|
+
*/
|
|
59
|
+
const missing = (environment) => `vendy has no executable to run. Its platform package ${packageName(environment)} did not install: either vendy publishes no build for ${name(environment)}, or this install left optional dependencies out.
|
|
60
|
+
|
|
61
|
+
Install vendy again with optional dependencies included, or let your coding agent run vendy for you:
|
|
62
|
+
${agentSkill}`;
|
|
63
|
+
/**
|
|
64
|
+
* Read when the platform package does not resolve.
|
|
65
|
+
*
|
|
66
|
+
* That is now the only way vendy fails to launch, so this text carries
|
|
67
|
+
* everything: what is missing, why it is missing, and what the user does next.
|
|
68
|
+
*/
|
|
69
|
+
const unavailable = (environment) => environment.libc === "musl" ? wrongLibc(environment) : missing(environment);
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/Launch.ts
|
|
72
|
+
/**
|
|
73
|
+
* The exit code to leave behind for a child that has finished.
|
|
74
|
+
*
|
|
75
|
+
* A child killed by a signal reports no status. Shells report those as
|
|
76
|
+
* `128 + signal` and vendy does the same, so a renderer that segfaults is
|
|
77
|
+
* never mistaken for a clean quit. A platform that does not name the signal
|
|
78
|
+
* still gets a failure code, never a zero.
|
|
79
|
+
*/
|
|
80
|
+
const exitCode = (completion) => {
|
|
81
|
+
if (completion.signal === null) return completion.status ?? 1;
|
|
82
|
+
const number = constants.signals[completion.signal];
|
|
83
|
+
return Number.isInteger(number) ? 128 + number : 1;
|
|
84
|
+
};
|
|
85
|
+
/** Reads the `code` Node puts on the errors both edges throw, without asserting a type over them. */
|
|
86
|
+
const hasCode = (error, code) => error instanceof Error && "code" in error && error.code === code;
|
|
87
|
+
/**
|
|
88
|
+
* Runs the executable for this machine and reports how that ended.
|
|
89
|
+
*
|
|
90
|
+
* Resolution is what decides whether vendy can run at all. It answers the
|
|
91
|
+
* question the package manager already answered on install — one platform
|
|
92
|
+
* package by `os` and `cpu`, or none — so the launcher never repeats that
|
|
93
|
+
* judgement and never disagrees with it.
|
|
94
|
+
*/
|
|
95
|
+
const run = (options) => {
|
|
96
|
+
let executable$1;
|
|
97
|
+
try {
|
|
98
|
+
executable$1 = options.resolve(executable(options.environment));
|
|
99
|
+
} catch (error) {
|
|
100
|
+
if (hasCode(error, "MODULE_NOT_FOUND")) return {
|
|
101
|
+
_tag: "Blocked",
|
|
102
|
+
message: unavailable(options.environment)
|
|
103
|
+
};
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
106
|
+
const completion = options.spawn(executable$1, options.args);
|
|
107
|
+
if (completion.error !== void 0) {
|
|
108
|
+
if (options.environment.libc === "musl" && hasCode(completion.error, "ENOENT")) return {
|
|
109
|
+
_tag: "Blocked",
|
|
110
|
+
message: unavailable(options.environment)
|
|
111
|
+
};
|
|
112
|
+
throw completion.error;
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
_tag: "Exited",
|
|
116
|
+
code: exitCode(completion)
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/index.ts
|
|
121
|
+
/**
|
|
122
|
+
* The published bin, and the only entry point: a trampoline to the executable
|
|
123
|
+
* for this machine.
|
|
124
|
+
*
|
|
125
|
+
* The app itself is compiled, with its runtime inside it, and lives in one of
|
|
126
|
+
* six platform packages. Nothing here loads it, and nothing here needs a
|
|
127
|
+
* capable runtime — this file runs on whatever `npx` or `bunx` starts it with,
|
|
128
|
+
* hands the terminal to a child, and reports how that child ended.
|
|
129
|
+
*/
|
|
130
|
+
/**
|
|
131
|
+
* Reports a launch failure: one message on stderr, nothing on stdout, and a
|
|
132
|
+
* non-zero exit.
|
|
133
|
+
*
|
|
134
|
+
* The code is set rather than forced. `process.exit` can truncate a pending
|
|
135
|
+
* write when stderr is a pipe, which is exactly how the message reaches a user
|
|
136
|
+
* who redirected it; setting the code lets Node flush and leave on its own.
|
|
137
|
+
*/
|
|
138
|
+
const fail = (message) => {
|
|
139
|
+
process.stderr.write(`${message}\n`);
|
|
140
|
+
process.exitCode = 1;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Which C library this machine links against.
|
|
144
|
+
*
|
|
145
|
+
* A glibc runtime version in the diagnostic report is what separates the two:
|
|
146
|
+
* musl leaves the field absent. The question is only asked on Linux, and a
|
|
147
|
+
* runtime that reports nothing leaves it unanswered rather than guessed —
|
|
148
|
+
* `undefined` costs the user a less specific message, a wrong answer costs them
|
|
149
|
+
* a wrong one.
|
|
150
|
+
*/
|
|
151
|
+
const libc = () => {
|
|
152
|
+
if (process.platform !== "linux" || typeof process.report?.getReport !== "function") return;
|
|
153
|
+
return process.report.getReport().header?.glibcVersionRuntime === void 0 ? "musl" : "glibc";
|
|
154
|
+
};
|
|
155
|
+
process.on("SIGINT", () => {});
|
|
156
|
+
const require = createRequire(import.meta.url);
|
|
157
|
+
const result = run({
|
|
158
|
+
args: process.argv.slice(2),
|
|
159
|
+
environment: {
|
|
160
|
+
arch: process.arch,
|
|
161
|
+
libc: libc(),
|
|
162
|
+
platform: process.platform
|
|
163
|
+
},
|
|
164
|
+
resolve: (specifier) => require.resolve(specifier),
|
|
165
|
+
spawn: (command, args) => spawnSync(command, [...args], { stdio: "inherit" })
|
|
166
|
+
});
|
|
167
|
+
if (result._tag === "Blocked") fail(result.message);
|
|
168
|
+
else process.exitCode = result.code;
|
|
169
|
+
//#endregion
|
|
170
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,14 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zebeqo/vendy",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
3
|
+
"version": "2.0.0-beta.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/Zebeqo/vendy.git",
|
|
7
|
+
"directory": "vendy"
|
|
8
|
+
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"vendy": "./dist/index.mjs"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"type": "module",
|
|
11
16
|
"publishConfig": {
|
|
12
17
|
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@effect/atom-react": "4.0.0-rc.112",
|
|
21
|
+
"@effect/platform-node": "4.0.0-rc.112",
|
|
22
|
+
"@effect/vitest": "4.0.0-rc.112",
|
|
23
|
+
"@opentui/core": "^0.5.4",
|
|
24
|
+
"@opentui/react": "^0.5.4",
|
|
25
|
+
"@tanstack/react-router": "1.170.16",
|
|
26
|
+
"@tanstack/router-cli": "^1.167.23",
|
|
27
|
+
"@tuiparts/react": "^0.0.6",
|
|
28
|
+
"@types/bun": "^1.4.0",
|
|
29
|
+
"@types/react": "^19.2.18",
|
|
30
|
+
"diff": "^9.0.0",
|
|
31
|
+
"effect": "4.0.0-rc.112",
|
|
32
|
+
"react": "^19.2.6",
|
|
33
|
+
"string-width": "^7.2.0"
|
|
34
|
+
},
|
|
35
|
+
"optionalDependencies": {
|
|
36
|
+
"@zebeqo/vendy-darwin-arm64": "2.0.0-beta.0",
|
|
37
|
+
"@zebeqo/vendy-darwin-x64": "2.0.0-beta.0",
|
|
38
|
+
"@zebeqo/vendy-linux-arm64": "2.0.0-beta.0",
|
|
39
|
+
"@zebeqo/vendy-win32-arm64": "2.0.0-beta.0",
|
|
40
|
+
"@zebeqo/vendy-win32-x64": "2.0.0-beta.0",
|
|
41
|
+
"@zebeqo/vendy-linux-x64": "2.0.0-beta.0"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"generate-routes": "tsr generate",
|
|
45
|
+
"watch-routes": "tsr watch",
|
|
46
|
+
"vendy": "node scripts/generate-skills.mts && tsr generate && bun run src/main.ts",
|
|
47
|
+
"build": "node scripts/generate-skills.mts && tsr generate && vp pack && node scripts/compile.mts --all",
|
|
48
|
+
"generate-skills": "node scripts/generate-skills.mts"
|
|
13
49
|
}
|
|
14
50
|
}
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// Placeholder
|