augent 0.5.1 → 0.6.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/README.md CHANGED
@@ -8,22 +8,17 @@ Augments AI coding platforms (such as Claude Code, OpenCode, Cursor) via bundles
8
8
 
9
9
  ## Setup
10
10
 
11
- You can install it from [PyPI](https://pypi.org/project/augent/):
11
+ You can install it from [PyPI](https://pypi.org/project/augent/) (recommended):
12
12
 
13
- pip install augent
13
+ pip install --user augent
14
14
 
15
- Or from [npm](https://www.npmjs.com/package/augent):
15
+ Or you can install it from [npm](https://www.npmjs.com/package/augent):
16
16
 
17
17
  npm install -g augent
18
18
 
19
- You can also run it without installing:
20
- - `uvx augent` if you have [uv](https://docs.astral.sh/uv/) installed
21
- - `pipx run augent` if you have [pipx](https://pipx.pypa.io/) installed
22
- - `bunx augent` if you have [bun](https://bun.sh/) installed
23
- - `npx augent` if you have Node.js/npm installed
24
-
25
- Alternatively, you can download a [GitHub Release](https://github.com/asyrjasalo/augent/releases) for your system and put the binary in your PATH.
26
-
19
+ If you have neither Python nor Node.js available, you can download a
20
+ [GitHub Release](https://github.com/asyrjasalo/augent/releases) for your system
21
+ and put the binary in your PATH.
27
22
 
28
23
  ## Quick Start
29
24
 
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "augent",
3
- "version": "0.5.1",
3
+ "version": "0.6.1",
4
4
  "description": "Lean package manager for various AI coding platforms",
5
5
  "author": "Anssi Syrjäsalo",
6
6
  "license": "AGPL-3.0",
@@ -8,40 +8,21 @@
8
8
  "type": "git",
9
9
  "url": "https://github.com/asyrjasalo/augent.git"
10
10
  },
11
- "homepage": "https://github.com/asyrjasalo/augent#readme",
12
- "bugs": {
13
- "url": "https://github.com/asyrjasalo/augent/issues"
14
- },
11
+ "homepage": "https://crates.io/crates/augent",
15
12
  "keywords": [
16
13
  "ai",
17
14
  "agents",
18
- "package-manager",
19
- "claude",
20
- "cursor",
21
- "opencode"
15
+ "package-manager"
22
16
  ],
23
17
  "bin": {
24
- "augent": "./bin/augent"
18
+ "augent": "./scripts/augent-wrapper.js"
25
19
  },
26
20
  "files": [
27
21
  "bin",
28
- "scripts",
29
- "README.md",
30
- "LICENSE"
22
+ "scripts"
31
23
  ],
32
- "scripts": {
33
- "postinstall": "node scripts/postinstall.js"
34
- },
35
24
  "engines": {
36
- "node": ">=14.0.0"
37
- },
38
- "os": [
39
- "darwin",
40
- "linux",
41
- "win32"
42
- ],
43
- "cpu": [
44
- "x64",
45
- "arm64"
46
- ]
25
+ "node": ">=14.0.0",
26
+ "bun": ">=1.0.0"
27
+ }
47
28
  }
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Platform-aware wrapper for augent binary
5
+ * This script detects the platform and executes the correct binary
6
+ * Works with both npm and bunx without requiring postinstall scripts
7
+ */
8
+
9
+ const fs = require("fs");
10
+ const path = require("path");
11
+ const os = require("os");
12
+ const { spawn, execFile } = require("child_process");
13
+
14
+ // Map Node.js platform/arch to binary directory name
15
+ function getBinaryPath() {
16
+ const platform = process.platform;
17
+ const arch = process.arch;
18
+
19
+ // Normalize architecture names
20
+ const normalizedArch =
21
+ arch === "arm64" || arch === "aarch64" ? "arm64" : arch;
22
+
23
+ let platformDir;
24
+ if (platform === "linux") {
25
+ platformDir = normalizedArch === "arm64" ? "linux-arm64" : "linux-x64";
26
+ } else if (platform === "darwin") {
27
+ platformDir = normalizedArch === "arm64" ? "darwin-arm64" : "darwin-x64";
28
+ } else if (platform === "win32") {
29
+ platformDir = normalizedArch === "arm64" ? "win32-arm64" : "win32-x64";
30
+ } else {
31
+ throw new Error(`Unsupported platform: ${platform} ${arch}`);
32
+ }
33
+
34
+ const binName = platform === "win32" ? "augent.exe" : "augent";
35
+ // Script is in scripts/, binaries are in bin/ (sibling directory)
36
+ const binPath = path.join(__dirname, "..", "bin", platformDir, binName);
37
+
38
+ if (!fs.existsSync(binPath)) {
39
+ throw new Error(
40
+ `Binary not found for ${platform} ${arch} at ${binPath}\n` +
41
+ `This package may not support your platform. Please check:\n` +
42
+ `https://github.com/asyrjasalo/augent/releases`,
43
+ );
44
+ }
45
+
46
+ return binPath;
47
+ }
48
+
49
+ // Execute the binary with all arguments
50
+ const binaryPath = getBinaryPath();
51
+ const args = process.argv.slice(2);
52
+
53
+ // Use execFile on Windows for better compatibility, spawn elsewhere
54
+ // execFile is specifically designed for executables and handles Windows better
55
+ const isWindows = process.platform === "win32";
56
+ const child = isWindows
57
+ ? execFile(binaryPath, args, { stdio: "inherit" })
58
+ : spawn(binaryPath, args, { stdio: "inherit", shell: false });
59
+
60
+ // Forward signals so Ctrl+C etc. reaches the child (Unix)
61
+ if (process.platform !== "win32") {
62
+ ["SIGINT", "SIGTERM"].forEach((sig) => {
63
+ process.on(sig, () => {
64
+ child.kill(sig);
65
+ });
66
+ });
67
+ }
68
+
69
+ child.on("error", (err) => {
70
+ console.error(`Failed to execute augent: ${err.message}`);
71
+ process.exit(1);
72
+ });
73
+
74
+ child.on("exit", (code, signal) => {
75
+ if (code !== null) {
76
+ process.exit(code);
77
+ }
78
+ if (signal && os.constants.signals && os.constants.signals[signal] != null) {
79
+ process.exit(128 + os.constants.signals[signal]);
80
+ }
81
+ process.exit(0);
82
+ });
@@ -1,199 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require('fs');
4
- const path = require('path');
5
- const https = require('https');
6
- const crypto = require('crypto');
7
- const { execSync } = require('child_process');
8
-
9
- const VERSION = require('../package.json').version;
10
- const BIN_DIR = path.join(__dirname, '..', 'bin');
11
- const BIN_PATH = path.join(BIN_DIR, process.platform === 'win32' ? 'augent.exe' : 'augent');
12
-
13
- // Map Node.js platform/arch to Rust target triple
14
- function getTarget() {
15
- const platform = process.platform;
16
- const arch = process.arch;
17
-
18
- if (platform === 'linux') {
19
- return arch === 'arm64' ? 'aarch64-unknown-linux-gnu' : 'x86_64-unknown-linux-gnu';
20
- } else if (platform === 'darwin') {
21
- return arch === 'arm64' ? 'aarch64-apple-darwin' : 'x86_64-apple-darwin';
22
- } else if (platform === 'win32') {
23
- return arch === 'arm64' ? 'aarch64-pc-windows-msvc' : 'x86_64-pc-windows-msvc';
24
- }
25
-
26
- throw new Error(`Unsupported platform: ${platform} ${arch}`);
27
- }
28
-
29
- function getArchiveExtension() {
30
- return process.platform === 'win32' ? 'zip' : 'tar.gz';
31
- }
32
-
33
- function downloadFile(url, dest) {
34
- return new Promise((resolve, reject) => {
35
- const file = fs.createWriteStream(dest);
36
- https.get(url, (response) => {
37
- if (response.statusCode === 302 || response.statusCode === 301) {
38
- // Follow redirect
39
- return downloadFile(response.headers.location, dest).then(resolve).catch(reject);
40
- }
41
- if (response.statusCode !== 200) {
42
- reject(new Error(`Failed to download: ${response.statusCode} ${response.statusMessage}`));
43
- return;
44
- }
45
- response.pipe(file);
46
- file.on('finish', () => {
47
- file.close();
48
- resolve();
49
- });
50
- }).on('error', (err) => {
51
- fs.unlink(dest, () => {});
52
- reject(err);
53
- });
54
- });
55
- }
56
-
57
- function downloadText(url) {
58
- return new Promise((resolve, reject) => {
59
- https.get(url, (response) => {
60
- if (response.statusCode === 302 || response.statusCode === 301) {
61
- return downloadText(response.headers.location).then(resolve).catch(reject);
62
- }
63
- if (response.statusCode !== 200) {
64
- reject(new Error(`Failed to download: ${response.statusCode} ${response.statusMessage}`));
65
- return;
66
- }
67
- let data = '';
68
- response.on('data', (chunk) => { data += chunk; });
69
- response.on('end', () => resolve(data));
70
- }).on('error', reject);
71
- });
72
- }
73
-
74
- function calculateSHA256(filePath) {
75
- const fileBuffer = fs.readFileSync(filePath);
76
- const hashSum = crypto.createHash('sha256');
77
- hashSum.update(fileBuffer);
78
- return hashSum.digest('hex');
79
- }
80
-
81
- function verifyChecksum(archivePath, expectedChecksum) {
82
- console.log('Verifying checksum...');
83
- const actualChecksum = calculateSHA256(archivePath);
84
- if (actualChecksum !== expectedChecksum) {
85
- throw new Error(
86
- `Checksum verification failed!\n` +
87
- `Expected: ${expectedChecksum}\n` +
88
- `Actual: ${actualChecksum}`
89
- );
90
- }
91
- console.log('✓ Checksum verified');
92
- }
93
-
94
- function extractArchive(archivePath, target) {
95
- const ext = getArchiveExtension();
96
- const binName = process.platform === 'win32' ? 'augent.exe' : 'augent';
97
-
98
- try {
99
- if (ext === 'tar.gz') {
100
- // Extract tar.gz
101
- execSync(`tar -xzf "${archivePath}" -C "${BIN_DIR}"`, { stdio: 'inherit' });
102
- } else {
103
- // Extract zip (Windows) using PowerShell
104
- const archivePathEscaped = archivePath.replace(/'/g, "''"); // Escape single quotes for PowerShell
105
- const binDirEscaped = BIN_DIR.replace(/'/g, "''");
106
- execSync(`powershell -Command "Expand-Archive -Path '${archivePathEscaped}' -DestinationPath '${binDirEscaped}' -Force"`, { stdio: 'inherit' });
107
- }
108
-
109
- // Move binary from extracted directory to bin directory
110
- const extractedDir = path.join(BIN_DIR, `augent-v${VERSION}-${target}`);
111
- const extractedBin = path.join(extractedDir, binName);
112
-
113
- if (fs.existsSync(extractedBin)) {
114
- fs.renameSync(extractedBin, BIN_PATH);
115
- fs.rmSync(extractedDir, { recursive: true, force: true });
116
- } else {
117
- throw new Error(`Binary not found in extracted archive: ${extractedBin}`);
118
- }
119
- } catch (error) {
120
- throw new Error(`Failed to extract archive: ${error.message}`);
121
- }
122
- }
123
-
124
- async function main() {
125
- // Skip if binary already exists
126
- if (fs.existsSync(BIN_PATH)) {
127
- console.log('augent binary already exists, skipping download');
128
- return;
129
- }
130
-
131
- const target = getTarget();
132
- const ext = getArchiveExtension();
133
- const archiveName = `augent-v${VERSION}-${target}.${ext}`;
134
- const archiveUrl = `https://github.com/asyrjasalo/augent/releases/download/v${VERSION}/${archiveName}`;
135
- const checksumsUrl = `https://github.com/asyrjasalo/augent/releases/download/v${VERSION}/checksums.txt`;
136
- const archivePath = path.join(BIN_DIR, archiveName);
137
- const checksumsPath = path.join(BIN_DIR, 'checksums.txt');
138
-
139
- console.log(`Downloading augent ${VERSION} for ${target}...`);
140
-
141
- try {
142
- // Ensure bin directory exists
143
- if (!fs.existsSync(BIN_DIR)) {
144
- fs.mkdirSync(BIN_DIR, { recursive: true });
145
- }
146
-
147
- // Download checksums file
148
- console.log('Downloading checksums...');
149
- const checksumsContent = await downloadText(checksumsUrl);
150
- fs.writeFileSync(checksumsPath, checksumsContent);
151
-
152
- // Parse checksums file to find expected checksum for our archive
153
- const checksumLine = checksumsContent
154
- .split('\n')
155
- .find(line => line.includes(archiveName));
156
-
157
- if (!checksumLine) {
158
- throw new Error(`Checksum not found for ${archiveName} in checksums.txt`);
159
- }
160
-
161
- // Extract checksum (format: "checksum filename" or "checksum *filename")
162
- const expectedChecksum = checksumLine.trim().split(/\s+/)[0];
163
- if (!expectedChecksum || expectedChecksum.length !== 64) {
164
- throw new Error(`Invalid checksum format in checksums.txt: ${checksumLine}`);
165
- }
166
-
167
- // Download archive
168
- await downloadFile(archiveUrl, archivePath);
169
-
170
- // Verify checksum before extracting
171
- verifyChecksum(archivePath, expectedChecksum);
172
-
173
- // Extract archive
174
- await extractArchive(archivePath, target);
175
-
176
- // Clean up archive and checksums
177
- fs.unlinkSync(archivePath);
178
- fs.unlinkSync(checksumsPath);
179
-
180
- // Make binary executable (Unix)
181
- if (process.platform !== 'win32') {
182
- fs.chmodSync(BIN_PATH, 0o755);
183
- }
184
-
185
- console.log('augent installed successfully');
186
- } catch (error) {
187
- console.error(`Failed to install augent: ${error.message}`);
188
- console.error(`\nYou can manually download from: ${archiveUrl}`);
189
- // Clean up on error
190
- if (fs.existsSync(archivePath)) fs.unlinkSync(archivePath);
191
- if (fs.existsSync(checksumsPath)) fs.unlinkSync(checksumsPath);
192
- process.exit(1);
193
- }
194
- }
195
-
196
- main().catch((error) => {
197
- console.error(error);
198
- process.exit(1);
199
- });