@agent-journal/cli 0.1.1 → 0.1.3
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 +4 -2
- package/bin/agent-journal +34 -0
- package/lib/runtime-shim.js +52 -0
- package/package.json +2 -2
- package/scripts/postinstall.js +6 -1
- package/vendor/darwin-arm64/agent-journal +0 -0
- package/vendor/darwin-x64/agent-journal +0 -0
- package/vendor/linux-x64/agent-journal +0 -0
- package/vendor/win32-x64/agent-journal.exe +0 -0
package/README.md
CHANGED
|
@@ -79,8 +79,10 @@ The npm package is only the first-install bootstrap. After CI registers a
|
|
|
79
79
|
release, use Admin Release Center to publish it to `dev`, `beta`, or `stable`
|
|
80
80
|
and control rollout percentage, auto apply, forced update, pause, and rollback.
|
|
81
81
|
|
|
82
|
-
Release versions are immutable after publication. If
|
|
83
|
-
|
|
82
|
+
Release versions are immutable after publication. If npm publish or GitHub
|
|
83
|
+
Release upload has already succeeded for the same version, rerun the workflow
|
|
84
|
+
with `publish_to_npm=false`; it will reuse the existing GitHub Release manifest
|
|
85
|
+
for service registration. For any artifact/content change, bump
|
|
84
86
|
`packages/agent-journal/package.json` before running the workflow again.
|
|
85
87
|
|
|
86
88
|
Local commands are for dry-run checks only:
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const fs = require("node:fs");
|
|
5
|
+
const path = require("node:path");
|
|
6
|
+
const { spawnSync } = require("node:child_process");
|
|
7
|
+
const { targetFor } = require("../lib/platform");
|
|
8
|
+
|
|
9
|
+
function binaryPath() {
|
|
10
|
+
const target = targetFor();
|
|
11
|
+
return path.join(__dirname, "..", "vendor", target.dir, target.exe);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const bin = binaryPath();
|
|
15
|
+
if (!fs.existsSync(bin)) {
|
|
16
|
+
console.error(`agent-journal binary is missing for ${process.platform}/${process.arch}: ${bin}`);
|
|
17
|
+
console.error("Reinstall the npm package, or run `npm run build:binaries` before packing/publishing.");
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const result = spawnSync(bin, process.argv.slice(2), {
|
|
22
|
+
stdio: "inherit",
|
|
23
|
+
env: process.env,
|
|
24
|
+
windowsHide: false
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
if (result.error) {
|
|
28
|
+
console.error(result.error.message);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
if (result.signal) {
|
|
32
|
+
process.kill(process.pid, result.signal);
|
|
33
|
+
}
|
|
34
|
+
process.exit(result.status ?? 1);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const fs = require("node:fs");
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
|
|
6
|
+
function unixRuntimeShim(target) {
|
|
7
|
+
return `#!/bin/sh
|
|
8
|
+
set -eu
|
|
9
|
+
|
|
10
|
+
script=$0
|
|
11
|
+
while [ -h "$script" ]; do
|
|
12
|
+
script_dir=$(CDPATH= cd -- "$(dirname -- "$script")" && pwd)
|
|
13
|
+
link=$(readlink "$script")
|
|
14
|
+
case "$link" in
|
|
15
|
+
/*) script=$link ;;
|
|
16
|
+
*) script=$script_dir/$link ;;
|
|
17
|
+
esac
|
|
18
|
+
done
|
|
19
|
+
|
|
20
|
+
script_dir=$(CDPATH= cd -- "$(dirname -- "$script")" && pwd)
|
|
21
|
+
bin="$script_dir/../vendor/${target.dir}/${target.exe}"
|
|
22
|
+
|
|
23
|
+
if [ ! -x "$bin" ]; then
|
|
24
|
+
echo "agent-journal binary is missing or not executable: $bin" >&2
|
|
25
|
+
echo "Reinstall the npm package, or run npm run build:binaries before packing/publishing." >&2
|
|
26
|
+
exit 1
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
exec "$bin" "$@"
|
|
30
|
+
`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function isInstalledPackage(packageRoot) {
|
|
34
|
+
return packageRoot.split(path.sep).includes("node_modules");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function shouldInstallUnixRuntimeShim(packageRoot, platform = process.platform) {
|
|
38
|
+
return platform !== "win32" && isInstalledPackage(packageRoot);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function installUnixRuntimeShim(packageRoot, target) {
|
|
42
|
+
const entrypoint = path.join(packageRoot, "bin", "agent-journal");
|
|
43
|
+
fs.writeFileSync(entrypoint, unixRuntimeShim(target), { mode: 0o755 });
|
|
44
|
+
fs.chmodSync(entrypoint, 0o755);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
module.exports = {
|
|
48
|
+
installUnixRuntimeShim,
|
|
49
|
+
isInstalledPackage,
|
|
50
|
+
shouldInstallUnixRuntimeShim,
|
|
51
|
+
unixRuntimeShim
|
|
52
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-journal/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Agent Journal member CLI",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"directory": "packages/agent-journal"
|
|
10
10
|
},
|
|
11
11
|
"bin": {
|
|
12
|
-
"agent-journal": "bin/agent-journal
|
|
12
|
+
"agent-journal": "bin/agent-journal"
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"bin/",
|
package/scripts/postinstall.js
CHANGED
|
@@ -5,9 +5,11 @@ const fs = require("node:fs");
|
|
|
5
5
|
const os = require("node:os");
|
|
6
6
|
const path = require("node:path");
|
|
7
7
|
const { targetFor } = require("../lib/platform");
|
|
8
|
+
const { installUnixRuntimeShim, shouldInstallUnixRuntimeShim } = require("../lib/runtime-shim");
|
|
8
9
|
|
|
10
|
+
const packageRoot = path.join(__dirname, "..");
|
|
9
11
|
const target = targetFor();
|
|
10
|
-
const bin = path.join(
|
|
12
|
+
const bin = path.join(packageRoot, "vendor", target.dir, target.exe);
|
|
11
13
|
|
|
12
14
|
if (!fs.existsSync(bin)) {
|
|
13
15
|
console.error(`Missing agent-journal binary for ${process.platform}/${process.arch}.`);
|
|
@@ -18,6 +20,9 @@ if (!fs.existsSync(bin)) {
|
|
|
18
20
|
|
|
19
21
|
if (process.platform !== "win32") {
|
|
20
22
|
fs.chmodSync(bin, 0o755);
|
|
23
|
+
if (shouldInstallUnixRuntimeShim(packageRoot)) {
|
|
24
|
+
installUnixRuntimeShim(packageRoot, target);
|
|
25
|
+
}
|
|
21
26
|
}
|
|
22
27
|
|
|
23
28
|
const home = os.homedir();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|