@matheusbbarni/atelier 0.1.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/README.md +16 -0
- package/bin/atelier.js +6 -0
- package/lib/launcher.cjs +134 -0
- package/lib/targets.cjs +108 -0
- package/package.json +34 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Matheus B. Barni
|
|
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/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# @matheusbbarni/atelier
|
|
2
|
+
|
|
3
|
+
Global npm distribution for the `atelier` CLI.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install -g @matheusbbarni/atelier
|
|
7
|
+
atelier --doctor
|
|
8
|
+
atelier
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This package contains a small JavaScript launcher. The native executable is
|
|
12
|
+
provided by a platform-specific optional dependency selected by npm for macOS,
|
|
13
|
+
glibc Linux, or Windows on arm64/x64.
|
|
14
|
+
|
|
15
|
+
Installation does not initialize configuration, probe credentials, or start the
|
|
16
|
+
TUI. Run `atelier --doctor` after installation to inspect runtime readiness.
|
package/bin/atelier.js
ADDED
package/lib/launcher.cjs
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { spawn } = require("node:child_process");
|
|
4
|
+
const os = require("node:os");
|
|
5
|
+
const {
|
|
6
|
+
TARGETS,
|
|
7
|
+
supportedTargetKeys,
|
|
8
|
+
targetForPlatform,
|
|
9
|
+
} = require("./targets.cjs");
|
|
10
|
+
|
|
11
|
+
function unsupportedPlatformMessage(platform, arch, libc) {
|
|
12
|
+
const libcSuffix = libc ? ` libc=${libc}` : "";
|
|
13
|
+
return [
|
|
14
|
+
`unsupported platform: platform=${platform} arch=${arch}${libcSuffix}`,
|
|
15
|
+
`supported targets: ${supportedTargetKeys().join(", ")}`,
|
|
16
|
+
"Download a native archive from GitHub Releases or build from source with Cargo.",
|
|
17
|
+
].join("\n");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function missingOptionalDependencyMessage(target) {
|
|
21
|
+
return [
|
|
22
|
+
`missing optional dependency for ${target.key}`,
|
|
23
|
+
`expected package: ${target.packageName}`,
|
|
24
|
+
"Optional dependencies may have been omitted by npm configuration.",
|
|
25
|
+
"Reinstall with: npm install -g @matheusbbarni/atelier --include=optional",
|
|
26
|
+
].join("\n");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function resolveBinary({
|
|
30
|
+
env = process.env,
|
|
31
|
+
platform = process.platform,
|
|
32
|
+
arch = process.arch,
|
|
33
|
+
libc,
|
|
34
|
+
requireResolve = require.resolve,
|
|
35
|
+
} = {}) {
|
|
36
|
+
if (env.ATELIER_BINARY_PATH && env.ATELIER_BINARY_PATH.trim() !== "") {
|
|
37
|
+
return {
|
|
38
|
+
binaryPath: env.ATELIER_BINARY_PATH,
|
|
39
|
+
target: null,
|
|
40
|
+
overridden: true,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const target = targetForPlatform(platform, arch, libc);
|
|
45
|
+
if (!target) {
|
|
46
|
+
throw new Error(unsupportedPlatformMessage(platform, arch, libc));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
return {
|
|
51
|
+
binaryPath: requireResolve(`${target.packageName}/${target.binPath}`),
|
|
52
|
+
target,
|
|
53
|
+
overridden: false,
|
|
54
|
+
};
|
|
55
|
+
} catch (error) {
|
|
56
|
+
if (error && error.code === "MODULE_NOT_FOUND") {
|
|
57
|
+
throw new Error(missingOptionalDependencyMessage(target));
|
|
58
|
+
}
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function exitCodeForSignal(signal) {
|
|
64
|
+
const signalNumber = os.constants.signals?.[signal];
|
|
65
|
+
return typeof signalNumber === "number" ? 128 + signalNumber : 1;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function spawnBinary({
|
|
69
|
+
binaryPath,
|
|
70
|
+
argv = process.argv.slice(2),
|
|
71
|
+
env = process.env,
|
|
72
|
+
cwd = process.cwd(),
|
|
73
|
+
spawnImpl = spawn,
|
|
74
|
+
exit = process.exit,
|
|
75
|
+
stderr = process.stderr,
|
|
76
|
+
}) {
|
|
77
|
+
const child = spawnImpl(binaryPath, argv, {
|
|
78
|
+
cwd,
|
|
79
|
+
env,
|
|
80
|
+
stdio: "inherit",
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
child.on("error", (error) => {
|
|
84
|
+
stderr.write(`atelier launcher failed to start native binary: ${error.message}\n`);
|
|
85
|
+
exit(1);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
child.on("exit", (code, signal) => {
|
|
89
|
+
exit(code ?? exitCodeForSignal(signal));
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
return child;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function main({
|
|
96
|
+
argv = process.argv.slice(2),
|
|
97
|
+
env = process.env,
|
|
98
|
+
cwd = process.cwd(),
|
|
99
|
+
platform = process.platform,
|
|
100
|
+
arch = process.arch,
|
|
101
|
+
libc,
|
|
102
|
+
requireResolve = require.resolve,
|
|
103
|
+
spawnImpl = spawn,
|
|
104
|
+
exit = process.exit,
|
|
105
|
+
stderr = process.stderr,
|
|
106
|
+
} = {}) {
|
|
107
|
+
let resolved;
|
|
108
|
+
try {
|
|
109
|
+
resolved = resolveBinary({ env, platform, arch, libc, requireResolve });
|
|
110
|
+
} catch (error) {
|
|
111
|
+
stderr.write(`atelier launcher error:\n${error.message}\n`);
|
|
112
|
+
exit(1);
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return spawnBinary({
|
|
117
|
+
binaryPath: resolved.binaryPath,
|
|
118
|
+
argv,
|
|
119
|
+
env,
|
|
120
|
+
cwd,
|
|
121
|
+
spawnImpl,
|
|
122
|
+
exit,
|
|
123
|
+
stderr,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
module.exports = {
|
|
128
|
+
TARGETS,
|
|
129
|
+
main,
|
|
130
|
+
missingOptionalDependencyMessage,
|
|
131
|
+
resolveBinary,
|
|
132
|
+
spawnBinary,
|
|
133
|
+
unsupportedPlatformMessage,
|
|
134
|
+
};
|
package/lib/targets.cjs
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const PACKAGE_SCOPE = "@matheusbbarni";
|
|
4
|
+
const TOP_LEVEL_PACKAGE = `${PACKAGE_SCOPE}/atelier`;
|
|
5
|
+
|
|
6
|
+
const TARGETS = Object.freeze({
|
|
7
|
+
"darwin-arm64": Object.freeze({
|
|
8
|
+
key: "darwin-arm64",
|
|
9
|
+
os: "darwin",
|
|
10
|
+
cpu: "arm64",
|
|
11
|
+
exe: "atelier",
|
|
12
|
+
archive: "tar.gz",
|
|
13
|
+
packageName: `${PACKAGE_SCOPE}/atelier-darwin-arm64`,
|
|
14
|
+
binPath: "bin/atelier",
|
|
15
|
+
}),
|
|
16
|
+
"darwin-x64": Object.freeze({
|
|
17
|
+
key: "darwin-x64",
|
|
18
|
+
os: "darwin",
|
|
19
|
+
cpu: "x64",
|
|
20
|
+
exe: "atelier",
|
|
21
|
+
archive: "tar.gz",
|
|
22
|
+
packageName: `${PACKAGE_SCOPE}/atelier-darwin-x64`,
|
|
23
|
+
binPath: "bin/atelier",
|
|
24
|
+
}),
|
|
25
|
+
"linux-arm64": Object.freeze({
|
|
26
|
+
key: "linux-arm64",
|
|
27
|
+
os: "linux",
|
|
28
|
+
cpu: "arm64",
|
|
29
|
+
libc: "glibc",
|
|
30
|
+
exe: "atelier",
|
|
31
|
+
archive: "tar.gz",
|
|
32
|
+
packageName: `${PACKAGE_SCOPE}/atelier-linux-arm64`,
|
|
33
|
+
binPath: "bin/atelier",
|
|
34
|
+
}),
|
|
35
|
+
"linux-x64": Object.freeze({
|
|
36
|
+
key: "linux-x64",
|
|
37
|
+
os: "linux",
|
|
38
|
+
cpu: "x64",
|
|
39
|
+
libc: "glibc",
|
|
40
|
+
exe: "atelier",
|
|
41
|
+
archive: "tar.gz",
|
|
42
|
+
packageName: `${PACKAGE_SCOPE}/atelier-linux-x64`,
|
|
43
|
+
binPath: "bin/atelier",
|
|
44
|
+
}),
|
|
45
|
+
"win32-arm64": Object.freeze({
|
|
46
|
+
key: "win32-arm64",
|
|
47
|
+
os: "win32",
|
|
48
|
+
cpu: "arm64",
|
|
49
|
+
exe: "atelier.exe",
|
|
50
|
+
archive: "zip",
|
|
51
|
+
packageName: `${PACKAGE_SCOPE}/atelier-win32-arm64`,
|
|
52
|
+
binPath: "bin/atelier.exe",
|
|
53
|
+
}),
|
|
54
|
+
"win32-x64": Object.freeze({
|
|
55
|
+
key: "win32-x64",
|
|
56
|
+
os: "win32",
|
|
57
|
+
cpu: "x64",
|
|
58
|
+
exe: "atelier.exe",
|
|
59
|
+
archive: "zip",
|
|
60
|
+
packageName: `${PACKAGE_SCOPE}/atelier-win32-x64`,
|
|
61
|
+
binPath: "bin/atelier.exe",
|
|
62
|
+
}),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
function supportedTargetKeys() {
|
|
66
|
+
return Object.keys(TARGETS);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function detectLibc(proc = process) {
|
|
70
|
+
if (proc.platform !== "linux") {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
const report = proc.report?.getReport?.();
|
|
74
|
+
const header = report?.header ?? {};
|
|
75
|
+
if (header.glibcVersionRuntime || header.glibcVersionCompiler) {
|
|
76
|
+
return "glibc";
|
|
77
|
+
}
|
|
78
|
+
return "unknown";
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function targetKeyFor(platform = process.platform, arch = process.arch, libc) {
|
|
82
|
+
const runtimeLibc = platform === "linux" ? libc ?? detectLibc() : undefined;
|
|
83
|
+
for (const target of Object.values(TARGETS)) {
|
|
84
|
+
if (target.os !== platform || target.cpu !== arch) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
if (target.libc && runtimeLibc !== target.libc) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
return target.key;
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function targetForPlatform(platform = process.platform, arch = process.arch, libc) {
|
|
96
|
+
const key = targetKeyFor(platform, arch, libc);
|
|
97
|
+
return key ? TARGETS[key] : null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
module.exports = {
|
|
101
|
+
PACKAGE_SCOPE,
|
|
102
|
+
TOP_LEVEL_PACKAGE,
|
|
103
|
+
TARGETS,
|
|
104
|
+
detectLibc,
|
|
105
|
+
supportedTargetKeys,
|
|
106
|
+
targetForPlatform,
|
|
107
|
+
targetKeyFor,
|
|
108
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@matheusbbarni/atelier",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Terminal-native agent orchestration harness",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"bin": {
|
|
7
|
+
"atelier": "bin/atelier.js"
|
|
8
|
+
},
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=20"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"bin/",
|
|
14
|
+
"lib/",
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/MatheusBBarni/atelier.git"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/MatheusBBarni/atelier#readme",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/MatheusBBarni/atelier/issues"
|
|
25
|
+
},
|
|
26
|
+
"optionalDependencies": {
|
|
27
|
+
"@matheusbbarni/atelier-darwin-arm64": "0.1.0",
|
|
28
|
+
"@matheusbbarni/atelier-darwin-x64": "0.1.0",
|
|
29
|
+
"@matheusbbarni/atelier-linux-arm64": "0.1.0",
|
|
30
|
+
"@matheusbbarni/atelier-linux-x64": "0.1.0",
|
|
31
|
+
"@matheusbbarni/atelier-win32-arm64": "0.1.0",
|
|
32
|
+
"@matheusbbarni/atelier-win32-x64": "0.1.0"
|
|
33
|
+
}
|
|
34
|
+
}
|