@autter/cli 2.0.8 → 2.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/install.js +26 -9
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -79,14 +79,28 @@ async function fetchBuffer(url) {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
// Verify against the release's checksums.txt (`<sha256> <asset>` lines).
|
|
82
|
-
// Releases before v1.6.8
|
|
82
|
+
// Releases before v1.6.8 predate checksum publication and are the only
|
|
83
|
+
// releases for which verification may be skipped.
|
|
83
84
|
async function verifyChecksum(buf, asset, tag) {
|
|
85
|
+
const version = tag.replace(/^v/, '').split(/[+-]/, 1)[0];
|
|
86
|
+
const versionMatch = /^(\d+)\.(\d+)\.(\d+)/.exec(version);
|
|
87
|
+
if (!versionMatch) {
|
|
88
|
+
throw new Error(`invalid release tag ${tag}; refusing to determine checksum policy`);
|
|
89
|
+
}
|
|
90
|
+
const [, majorText, minorText, patchText] = versionMatch;
|
|
91
|
+
const major = Number(majorText);
|
|
92
|
+
const minor = Number(minorText);
|
|
93
|
+
const patch = Number(patchText);
|
|
94
|
+
const checksumsRequired = major > 1 || (major === 1 && (minor > 6 || (minor === 6 && patch >= 8)));
|
|
84
95
|
let checksums;
|
|
85
96
|
try {
|
|
86
97
|
checksums = (await fetchBuffer(downloadUrl(tag, 'checksums.txt'))).toString('utf8');
|
|
87
|
-
} catch {
|
|
88
|
-
|
|
89
|
-
|
|
98
|
+
} catch (err) {
|
|
99
|
+
if (!checksumsRequired) {
|
|
100
|
+
console.warn(`autter: release ${tag} predates checksum publishing; skipping checksum verification`);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
throw new Error(`could not fetch checksums.txt for release ${tag}; refusing to install an unverifiable binary (${err.message})`);
|
|
90
104
|
}
|
|
91
105
|
const entry = checksums
|
|
92
106
|
.split('\n')
|
|
@@ -245,8 +259,8 @@ async function ensureBinary() {
|
|
|
245
259
|
return { bin: dest, downloaded: true };
|
|
246
260
|
}
|
|
247
261
|
|
|
248
|
-
// postinstall entry point.
|
|
249
|
-
//
|
|
262
|
+
// postinstall entry point. Ordinary transient download/platform errors defer to
|
|
263
|
+
// bin/autter.js, but an integrity failure must fail installation closed.
|
|
250
264
|
async function main() {
|
|
251
265
|
if (process.env.AUTTER_NPM_SKIP_DOWNLOAD === '1') {
|
|
252
266
|
console.log('autter: AUTTER_NPM_SKIP_DOWNLOAD=1, skipping binary download');
|
|
@@ -265,6 +279,9 @@ async function main() {
|
|
|
265
279
|
try {
|
|
266
280
|
result = await ensureBinary();
|
|
267
281
|
} catch (err) {
|
|
282
|
+
if (/checksums\.txt|checksum mismatch|no checksum entry/.test(err.message)) {
|
|
283
|
+
throw err;
|
|
284
|
+
}
|
|
268
285
|
console.warn(`autter: could not install the native binary now (${err.message})`);
|
|
269
286
|
console.warn('autter: it will be downloaded on first run instead');
|
|
270
287
|
return;
|
|
@@ -281,11 +298,11 @@ async function main() {
|
|
|
281
298
|
console.log("Run 'autter onboard' to finish setup (consent for hooks, git config, and daemon).");
|
|
282
299
|
}
|
|
283
300
|
|
|
284
|
-
module.exports = { assetName, binaryDest, ensureBinary, releaseTag };
|
|
301
|
+
module.exports = { assetName, binaryDest, ensureBinary, releaseTag, verifyChecksum };
|
|
285
302
|
|
|
286
303
|
if (require.main === module) {
|
|
287
304
|
main().catch((err) => {
|
|
288
|
-
|
|
289
|
-
|
|
305
|
+
console.error(`autter: postinstall failed (${err.message})`);
|
|
306
|
+
process.exitCode = 1;
|
|
290
307
|
});
|
|
291
308
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autter/cli",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Git-native AI authorship tracking: records which lines were written by AI agents and links them to the agent, model, and prompt. This package is a thin bootstrapper that installs the native autter binary.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://autter.dev",
|