autowonder 0.1.0 → 0.1.1
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/bin/cli.js +21 -8
- package/package.json +3 -2
- package/scripts/build-and-publish.sh +85 -0
- package/vendor/autowonder-daemon-darwin-amd64 +0 -0
- package/vendor/autowonder-daemon-darwin-arm64 +0 -0
- package/vendor/autowonder-daemon-linux-amd64 +0 -0
- package/vendor/autowonder-daemon-linux-arm64 +0 -0
package/bin/cli.js
CHANGED
|
@@ -16,8 +16,9 @@ const CONFIG_PATH = path.join(AUTOWONDER_HOME, "config.json");
|
|
|
16
16
|
const PID_PATH = path.join(AUTOWONDER_HOME, "daemon.pid");
|
|
17
17
|
const LOG_PATH = path.join(AUTOWONDER_HOME, "daemon.log");
|
|
18
18
|
|
|
19
|
-
const BINARY_BASE_URL = process.env.AUTOWONDER_BINARY_URL || "
|
|
20
|
-
const SOURCE_REPO = "
|
|
19
|
+
const BINARY_BASE_URL = process.env.AUTOWONDER_BINARY_URL || "";
|
|
20
|
+
const SOURCE_REPO = process.env.AUTOWONDER_SOURCE_REPO || "http://gitlab.alibaba-inc.com/sdlc-autopilot/auto-wonder-client-runtime.git";
|
|
21
|
+
const BUNDLED_BIN_DIR = path.join(__dirname, "..", "vendor");
|
|
21
22
|
|
|
22
23
|
const DEFAULT_API_ADDR = "127.0.0.1:34989";
|
|
23
24
|
|
|
@@ -89,17 +90,29 @@ async function installBinary(options = {}) {
|
|
|
89
90
|
|
|
90
91
|
const platform = binaryPlatformKey();
|
|
91
92
|
log(`Installing autowonder-daemon for ${platform}...`);
|
|
93
|
+
ensureDir(BIN_DIR);
|
|
92
94
|
|
|
93
|
-
//
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
// Priority 1: bundled binary in npm package (vendor/)
|
|
96
|
+
const bundledPath = path.join(BUNDLED_BIN_DIR, `autowonder-daemon-${platform}`);
|
|
97
|
+
if (fs.existsSync(bundledPath)) {
|
|
98
|
+
fs.copyFileSync(bundledPath, DAEMON_BIN);
|
|
97
99
|
fs.chmodSync(DAEMON_BIN, 0o755);
|
|
98
|
-
log(`Installed
|
|
100
|
+
log(`Installed from bundled binary: ${DAEMON_BIN}`);
|
|
99
101
|
return true;
|
|
100
102
|
}
|
|
101
103
|
|
|
102
|
-
//
|
|
104
|
+
// Priority 2: download from URL (OSS or CDN)
|
|
105
|
+
if (BINARY_BASE_URL) {
|
|
106
|
+
const url = `${BINARY_BASE_URL}/v${VERSION}/autowonder-daemon-${platform}`;
|
|
107
|
+
const downloaded = await tryDownload(url, DAEMON_BIN);
|
|
108
|
+
if (downloaded) {
|
|
109
|
+
fs.chmodSync(DAEMON_BIN, 0o755);
|
|
110
|
+
log(`Downloaded daemon binary: ${DAEMON_BIN}`);
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Priority 3: build from source
|
|
103
116
|
log("Pre-built binary not available. Building from source...");
|
|
104
117
|
return buildFromSource();
|
|
105
118
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autowonder",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "AutoWonder local runtime — execute AI agent dispatch packages on your machine",
|
|
5
5
|
"bin": {
|
|
6
6
|
"autowonder": "bin/cli.js"
|
|
7
7
|
},
|
|
8
8
|
"files": [
|
|
9
9
|
"bin/",
|
|
10
|
-
"scripts/"
|
|
10
|
+
"scripts/",
|
|
11
|
+
"vendor/"
|
|
11
12
|
],
|
|
12
13
|
"keywords": [
|
|
13
14
|
"autowonder",
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# Build autowonder-daemon binaries and publish npm package.
|
|
5
|
+
# Run from the autowonder-npm directory.
|
|
6
|
+
#
|
|
7
|
+
# Prerequisites:
|
|
8
|
+
# - Go 1.22+
|
|
9
|
+
# - Access to gitlab.alibaba-inc.com
|
|
10
|
+
# - NPM_TOKEN env var set
|
|
11
|
+
#
|
|
12
|
+
# Usage:
|
|
13
|
+
# ./scripts/build-and-publish.sh # build + publish
|
|
14
|
+
# ./scripts/build-and-publish.sh --build # build only (no publish)
|
|
15
|
+
|
|
16
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
17
|
+
PKG_DIR="$(dirname "$SCRIPT_DIR")"
|
|
18
|
+
VENDOR_DIR="$PKG_DIR/vendor"
|
|
19
|
+
SOURCE_DIR="${AUTOWONDER_SOURCE_DIR:-}"
|
|
20
|
+
SOURCE_REPO="${AUTOWONDER_SOURCE_REPO:-http://gitlab.alibaba-inc.com/sdlc-autopilot/auto-wonder-client-runtime.git}"
|
|
21
|
+
|
|
22
|
+
BUILD_ONLY=false
|
|
23
|
+
if [[ "${1:-}" == "--build" ]]; then
|
|
24
|
+
BUILD_ONLY=true
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
echo "━━━ autowonder npm build ━━━"
|
|
28
|
+
|
|
29
|
+
# Get source code
|
|
30
|
+
if [[ -n "$SOURCE_DIR" && -d "$SOURCE_DIR" ]]; then
|
|
31
|
+
echo "Using local source: $SOURCE_DIR"
|
|
32
|
+
else
|
|
33
|
+
SOURCE_DIR=$(mktemp -d)
|
|
34
|
+
trap "rm -rf $SOURCE_DIR" EXIT
|
|
35
|
+
echo "Cloning from $SOURCE_REPO..."
|
|
36
|
+
git clone --depth 1 "$SOURCE_REPO" "$SOURCE_DIR"
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
# Build for all platforms
|
|
40
|
+
rm -rf "$VENDOR_DIR"
|
|
41
|
+
mkdir -p "$VENDOR_DIR"
|
|
42
|
+
|
|
43
|
+
platforms=("darwin-arm64" "darwin-amd64" "linux-amd64" "linux-arm64")
|
|
44
|
+
goarch_map=("arm64" "amd64" "amd64" "arm64")
|
|
45
|
+
goos_map=("darwin" "darwin" "linux" "linux")
|
|
46
|
+
|
|
47
|
+
for i in "${!platforms[@]}"; do
|
|
48
|
+
platform="${platforms[$i]}"
|
|
49
|
+
goos="${goos_map[$i]}"
|
|
50
|
+
goarch="${goarch_map[$i]}"
|
|
51
|
+
output="$VENDOR_DIR/autowonder-daemon-${goos}-${goarch}"
|
|
52
|
+
|
|
53
|
+
echo "Building $platform..."
|
|
54
|
+
(cd "$SOURCE_DIR" && GOOS="$goos" GOARCH="$goarch" go build -o "$output" -ldflags="-s -w" ./cmd/autowonder-daemon)
|
|
55
|
+
chmod +x "$output"
|
|
56
|
+
echo " -> $output ($(du -h "$output" | cut -f1))"
|
|
57
|
+
done
|
|
58
|
+
|
|
59
|
+
echo ""
|
|
60
|
+
echo "Binaries ready in $VENDOR_DIR:"
|
|
61
|
+
ls -lh "$VENDOR_DIR/"
|
|
62
|
+
|
|
63
|
+
if [[ "$BUILD_ONLY" == "true" ]]; then
|
|
64
|
+
echo ""
|
|
65
|
+
echo "Build complete. Skipping publish (--build flag)."
|
|
66
|
+
exit 0
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
# Publish
|
|
70
|
+
echo ""
|
|
71
|
+
echo "━━━ Publishing to npm ━━━"
|
|
72
|
+
cd "$PKG_DIR"
|
|
73
|
+
|
|
74
|
+
if [[ -z "${NPM_TOKEN:-}" ]]; then
|
|
75
|
+
echo "Error: NPM_TOKEN is not set"
|
|
76
|
+
exit 1
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
|
|
80
|
+
npm version patch --no-git-tag-version
|
|
81
|
+
npm publish --access public
|
|
82
|
+
rm -f .npmrc
|
|
83
|
+
|
|
84
|
+
echo ""
|
|
85
|
+
echo "Published $(node -p "require('./package.json').name + '@' + require('./package.json').version")"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|