agentscm 0.1.0-alpha.4 → 0.1.0-alpha.8
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 +6 -1
- package/SHA256SUMS +5 -5
- package/THIRD_PARTY_NOTICES.md +2890 -428
- package/lib/install.js +21 -9
- package/package.json +1 -1
package/lib/install.js
CHANGED
|
@@ -143,9 +143,23 @@ function checkProvenance(file, version, gap = provenanceGap(), run = spawnSync)
|
|
|
143
143
|
return true;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
// The notice and the provenance line belong to installing: shown when this version is first
|
|
147
|
+
// fetched (never before help text), and on every run only with AGENTSCM_INSTALL_VERBOSE=1.
|
|
148
|
+
const announces = (args, installing, verbose) =>
|
|
149
|
+
verbose || (installing && !['--help', '-h'].includes(args[0]));
|
|
150
|
+
|
|
151
|
+
// The one-line report of what was actually checked.
|
|
152
|
+
const provenanceLine = (gap) => gap
|
|
153
|
+
? `Checked the SHA-256 checksum (provenance not checked: ${gap}).`
|
|
154
|
+
: 'Verified provenance with GitHub attestations. Set AGENTSCM_INSTALL_VERBOSE=1 for details.';
|
|
155
|
+
|
|
146
156
|
async function main(args) {
|
|
147
157
|
const version = require('../package.json').version;
|
|
148
|
-
|
|
158
|
+
// The package installs exactly its own version, so this matches the binary without a download.
|
|
159
|
+
if (args[0] === '--version' || args[0] === '-V') {
|
|
160
|
+
console.log(`agentscm ${version}`);
|
|
161
|
+
return 0;
|
|
162
|
+
}
|
|
149
163
|
const target = targetFor(process.platform, process.arch);
|
|
150
164
|
if (!target) {
|
|
151
165
|
console.error(`agentscm: ${unsupported(version)}`);
|
|
@@ -153,6 +167,10 @@ async function main(args) {
|
|
|
153
167
|
}
|
|
154
168
|
const asset = assetNameFor(target);
|
|
155
169
|
const names = installNames(version, process.platform);
|
|
170
|
+
const dir = path.join(os.homedir(), '.agentscm', 'bin');
|
|
171
|
+
const binary = path.join(dir, names.versioned);
|
|
172
|
+
const announce = announces(args, !fs.existsSync(binary), verboseInstall());
|
|
173
|
+
if (announce) console.log(`${NOTICE_TEXT}\n`);
|
|
156
174
|
const signal = AbortSignal.timeout(BUDGET_MS);
|
|
157
175
|
const gap = provenanceGap(); // checked once: `gh auth status` goes over the network
|
|
158
176
|
if (gap && process.env.AGENTSCM_REQUIRE_PROVENANCE === '1') throw new Error(`AGENTSCM_REQUIRE_PROVENANCE=1 but ${gap}`);
|
|
@@ -168,7 +186,6 @@ async function main(args) {
|
|
|
168
186
|
}
|
|
169
187
|
const expected = parseSums(sums, target);
|
|
170
188
|
|
|
171
|
-
const dir = path.join(os.homedir(), '.agentscm', 'bin');
|
|
172
189
|
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
173
190
|
fs.chmodSync(dir, 0o700);
|
|
174
191
|
const link = path.join(dir, names.latest);
|
|
@@ -176,7 +193,6 @@ async function main(args) {
|
|
|
176
193
|
if (names.symlink && lst && !lst.isSymbolicLink()) throw new Error(`${link} exists and is not a symlink; remove it`);
|
|
177
194
|
|
|
178
195
|
// Order: checksum, provenance, chmod, rename, link, exec. Nothing is installed or linked before both checks pass.
|
|
179
|
-
const binary = path.join(dir, names.versioned);
|
|
180
196
|
const rand = crypto.randomBytes(6).toString('hex');
|
|
181
197
|
if (fs.existsSync(binary)) {
|
|
182
198
|
if (!matches(binary, expected)) throw new Error(`${binary} does not match the release checksum; delete it and retry`);
|
|
@@ -217,11 +233,7 @@ async function main(args) {
|
|
|
217
233
|
}
|
|
218
234
|
}
|
|
219
235
|
|
|
220
|
-
if (gap)
|
|
221
|
-
console.log(`Verified checksum; provenance was not checked (${gap}).`);
|
|
222
|
-
} else {
|
|
223
|
-
console.log('Verified checksum and build provenance. Set AGENTSCM_INSTALL_VERBOSE=1 for details.');
|
|
224
|
-
}
|
|
236
|
+
if (announce) console.log(provenanceLine(gap));
|
|
225
237
|
|
|
226
238
|
// This process-only assertion comes from the verified installer. The binary records an
|
|
227
239
|
// installation only after its disclosure/choice gates are effective; HTTP stays detached.
|
|
@@ -231,4 +243,4 @@ async function main(args) {
|
|
|
231
243
|
return r.status ?? 128 + (os.constants.signals[r.signal] ?? 0);
|
|
232
244
|
}
|
|
233
245
|
|
|
234
|
-
module.exports = { NOTICE_TEXT, targetFor, assetNameFor, installNames, urlFor, launchArgs, verifiedInstallEnv, parseSums, sha256File, matches, localSums, ghVerifyArgs, provenanceGap, checkProvenance, main };
|
|
246
|
+
module.exports = { NOTICE_TEXT, announces, targetFor, assetNameFor, installNames, urlFor, launchArgs, verifiedInstallEnv, parseSums, sha256File, matches, localSums, ghVerifyArgs, provenanceGap, checkProvenance, provenanceLine, main };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentscm",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.8",
|
|
4
4
|
"description": "Downloads, verifies and starts the AgentSCM release binary.",
|
|
5
5
|
"license": "FSL-1.1-ALv2",
|
|
6
6
|
"repository": {"type": "git", "url": "git+https://github.com/counterbranch/agentscm.git"},
|