@aware-aeco/cli 0.7.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/README.md +46 -0
- package/package.json +31 -0
- package/scripts/bin/aware.js +9 -0
- package/scripts/postinstall.js +92 -0
- package/scripts/uninstall.js +8 -0
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# @aware-aeco/cli
|
|
2
|
+
|
|
3
|
+
The AWARE CLI as an npm package. Wraps the underlying Rust + C# binaries.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Pick your package manager — all four work with the same package:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @aware-aeco/cli
|
|
11
|
+
pnpm add -g @aware-aeco/cli
|
|
12
|
+
yarn global add @aware-aeco/cli
|
|
13
|
+
bun install -g @aware-aeco/cli
|
|
14
|
+
|
|
15
|
+
aware --version
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
On install, `postinstall` downloads the right binary for your platform (Windows x64, Linux x64, or macOS arm64) from the [GitHub Releases](https://github.com/aware-aeco/aware/releases) for the matching version. The package itself contains no platform-specific code, only Node built-ins, so any manager that runs `postinstall` and supports the npm registry works.
|
|
19
|
+
|
|
20
|
+
For other platforms, build from source: https://github.com/aware-aeco/aware
|
|
21
|
+
|
|
22
|
+
## Docs
|
|
23
|
+
|
|
24
|
+
See the main repo: https://github.com/aware-aeco/aware
|
|
25
|
+
|
|
26
|
+
## License
|
|
27
|
+
|
|
28
|
+
Apache-2.0 — same as the upstream project.
|
|
29
|
+
|
|
30
|
+
## Behind the curtain
|
|
31
|
+
|
|
32
|
+
This package is a thin shim. The actual implementation is:
|
|
33
|
+
|
|
34
|
+
- The Rust CLI binary (`aware`) — open source at [aware-aeco/aware](https://github.com/aware-aeco/aware), under `cli/`
|
|
35
|
+
- The C# NativeAOT sidecar (`aware-sidecar`) — same repo, under `cli-sidecar/`
|
|
36
|
+
|
|
37
|
+
The package's `postinstall` hook fetches both binaries from the GitHub Release matching the package version. The npm tarball itself is ~10 KB.
|
|
38
|
+
|
|
39
|
+
To skip the download (corp networks, etc.):
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
AWARE_NPM_SKIP_DOWNLOAD=1 npm install -g @aware-aeco/cli
|
|
43
|
+
# (or pnpm / yarn / bun — same env var)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Then install the binaries manually from the GitHub Release.
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aware-aeco/cli",
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "AWARE CLI — open-source agentic substrate for AECO",
|
|
5
|
+
"homepage": "https://github.com/aware-aeco/aware",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/aware-aeco/aware.git",
|
|
9
|
+
"directory": "cli-npm"
|
|
10
|
+
},
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"bin": {
|
|
13
|
+
"aware": "scripts/bin/aware.js"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"postinstall": "node scripts/postinstall.js",
|
|
17
|
+
"uninstall": "node scripts/uninstall.js"
|
|
18
|
+
},
|
|
19
|
+
"os": [
|
|
20
|
+
"win32",
|
|
21
|
+
"linux",
|
|
22
|
+
"darwin"
|
|
23
|
+
],
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=18"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"scripts",
|
|
29
|
+
"README.md"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { spawnSync } = require('child_process');
|
|
4
|
+
|
|
5
|
+
const binaryName = process.platform === 'win32' ? 'aware.exe' : 'aware';
|
|
6
|
+
const binary = path.join(__dirname, '..', '..', 'binaries', binaryName);
|
|
7
|
+
|
|
8
|
+
const result = spawnSync(binary, process.argv.slice(2), { stdio: 'inherit' });
|
|
9
|
+
process.exit(result.status ?? 1);
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const https = require('https');
|
|
5
|
+
const { execSync } = require('child_process');
|
|
6
|
+
|
|
7
|
+
const PKG_VERSION = require('../package.json').version;
|
|
8
|
+
const REPO = 'aware-aeco/aware';
|
|
9
|
+
|
|
10
|
+
const RID_MAP = {
|
|
11
|
+
'win32/x64': { rid: 'win-x64', ext: '.exe', archive: 'zip' },
|
|
12
|
+
'linux/x64': { rid: 'linux-x64', ext: '', archive: 'tar.gz' },
|
|
13
|
+
'darwin/arm64': { rid: 'osx-arm64', ext: '', archive: 'tar.gz' },
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// Skip-download escape hatch — for environments without network (corp networks, CI sandboxes)
|
|
17
|
+
if (process.env.AWARE_NPM_SKIP_DOWNLOAD === '1') {
|
|
18
|
+
console.log('[aware-npm] AWARE_NPM_SKIP_DOWNLOAD=1 — skipping binary download.');
|
|
19
|
+
process.exit(0);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const key = `${process.platform}/${process.arch}`;
|
|
23
|
+
const target = RID_MAP[key];
|
|
24
|
+
if (!target) {
|
|
25
|
+
console.error(`[aware-npm] unsupported platform: ${key}`);
|
|
26
|
+
console.error(`Supported: ${Object.keys(RID_MAP).join(', ')}`);
|
|
27
|
+
console.error(`Manual install: https://github.com/${REPO}/releases`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const archiveName = `aware-${PKG_VERSION}-${target.rid}.${target.archive}`;
|
|
32
|
+
const url = `https://github.com/${REPO}/releases/download/v${PKG_VERSION}/${archiveName}`;
|
|
33
|
+
const binariesDir = path.join(__dirname, '..', 'binaries');
|
|
34
|
+
const tmpFile = path.join(binariesDir, archiveName);
|
|
35
|
+
|
|
36
|
+
console.log(`[aware-npm] installing ${PKG_VERSION} for ${target.rid}`);
|
|
37
|
+
console.log(` source: ${url}`);
|
|
38
|
+
|
|
39
|
+
fs.mkdirSync(binariesDir, { recursive: true });
|
|
40
|
+
|
|
41
|
+
function download(srcUrl, dest, depth = 0) {
|
|
42
|
+
return new Promise((resolve, reject) => {
|
|
43
|
+
if (depth > 5) return reject(new Error('too many redirects'));
|
|
44
|
+
https.get(srcUrl, { headers: { 'User-Agent': 'aware-npm-installer' } }, (res) => {
|
|
45
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
46
|
+
return resolve(download(res.headers.location, dest, depth + 1));
|
|
47
|
+
}
|
|
48
|
+
if (res.statusCode !== 200) {
|
|
49
|
+
return reject(new Error(`HTTP ${res.statusCode}: ${srcUrl}`));
|
|
50
|
+
}
|
|
51
|
+
const file = fs.createWriteStream(dest);
|
|
52
|
+
res.pipe(file);
|
|
53
|
+
file.on('finish', () => file.close(() => resolve()));
|
|
54
|
+
file.on('error', reject);
|
|
55
|
+
}).on('error', reject);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
(async () => {
|
|
60
|
+
try {
|
|
61
|
+
await download(url, tmpFile);
|
|
62
|
+
|
|
63
|
+
console.log('[aware-npm] extracting...');
|
|
64
|
+
if (target.archive === 'zip') {
|
|
65
|
+
execSync(`powershell -NoProfile -Command "Expand-Archive -Path '${tmpFile}' -DestinationPath '${binariesDir}' -Force"`, { stdio: 'inherit' });
|
|
66
|
+
} else {
|
|
67
|
+
execSync(`tar -xzf "${tmpFile}" -C "${binariesDir}"`, { stdio: 'inherit' });
|
|
68
|
+
}
|
|
69
|
+
fs.unlinkSync(tmpFile);
|
|
70
|
+
|
|
71
|
+
// Promote binaries from <binariesDir>/aware-<version>-<rid>/ to <binariesDir>/
|
|
72
|
+
const extractedDir = path.join(binariesDir, `aware-${PKG_VERSION}-${target.rid}`);
|
|
73
|
+
if (fs.existsSync(extractedDir)) {
|
|
74
|
+
for (const file of fs.readdirSync(extractedDir)) {
|
|
75
|
+
fs.renameSync(path.join(extractedDir, file), path.join(binariesDir, file));
|
|
76
|
+
}
|
|
77
|
+
fs.rmdirSync(extractedDir);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (process.platform !== 'win32') {
|
|
81
|
+
fs.chmodSync(path.join(binariesDir, `aware${target.ext}`), 0o755);
|
|
82
|
+
fs.chmodSync(path.join(binariesDir, `aware-sidecar${target.ext}`), 0o755);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
console.log(`[aware-npm] installed to ${binariesDir}`);
|
|
86
|
+
} catch (err) {
|
|
87
|
+
console.error(`[aware-npm] install failed: ${err.message}`);
|
|
88
|
+
console.error(`Set AWARE_NPM_SKIP_DOWNLOAD=1 to skip download and install binaries manually.`);
|
|
89
|
+
console.error(`Manual install: https://github.com/${REPO}/releases`);
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
})();
|