freecode-sh 0.1.0-alpha.36 → 0.1.0-alpha.38

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/install.ps1 +15 -0
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -26,7 +26,7 @@ freecode
26
26
  For a reproducible clean install of this immutable release:
27
27
 
28
28
  ```bash
29
- npm install -g freecode-sh@0.1.0-alpha.36
29
+ npm install -g freecode-sh@0.1.0-alpha.38
30
30
  freecode --version
31
31
  ```
32
32
 
package/install.ps1 CHANGED
@@ -20,6 +20,9 @@ param(
20
20
  [string]$ArchivePath,
21
21
  [string]$ChecksumPath,
22
22
  [string]$ManifestPath,
23
+ [string]$ExpectedCurrentVersion,
24
+ [string]$ExpectedArchiveSha256,
25
+ [long]$ExpectedArchiveSize,
23
26
  [Alias('InstallRoot')]
24
27
  [string]$InstallDir,
25
28
  [switch]$AllowUnsigned,
@@ -583,6 +586,12 @@ try {
583
586
  Assert-PayloadContract $manifest "release $Version"
584
587
  Assert-WindowsAssetSecurity $asset "release $Version"
585
588
  if ($asset.archive -ne $AssetName) { Fail "release manifest names unexpected asset $($asset.archive)" }
589
+ if ($ExpectedArchiveSha256 -and [string]$asset.sha256 -ne $ExpectedArchiveSha256) {
590
+ Fail 'release archive checksum does not match the signed update channel'
591
+ }
592
+ if ($ExpectedArchiveSize -and ([long]$asset.size -ne $ExpectedArchiveSize -or (Get-Item -LiteralPath $downloadedArchivePath).Length -ne $ExpectedArchiveSize)) {
593
+ Fail 'release archive size does not match the signed update channel'
594
+ }
586
595
 
587
596
  $checksumLine = (Get-Content -LiteralPath $downloadedChecksumPath | Select-Object -First 1)
588
597
  if ($checksumLine -notmatch '^([a-fA-F0-9]{64})\s{1,2}(\*?)([^\s]+)$') {
@@ -595,6 +604,12 @@ try {
595
604
  if ($actualChecksum -ne $expectedChecksum) { Fail "checksum verification failed for $AssetName" }
596
605
 
597
606
  $InstallMutex = Enter-InstallLock
607
+ if ($ExpectedCurrentVersion) {
608
+ $activeVersion = if (Test-Path -LiteralPath $CurrentVersionPath) { (Get-Content -LiteralPath $CurrentVersionPath -Raw).Trim() } else { '' }
609
+ if ($activeVersion -ne $ExpectedCurrentVersion -and $activeVersion -ne $Version) {
610
+ Fail 'the active installation changed during the update; retry with the current version'
611
+ }
612
+ }
598
613
  New-Item -ItemType Directory -Path $VersionsDir -Force | Out-Null
599
614
  $versionRoot = Join-Path $VersionsDir $Version
600
615
  $newInstall = -not (Test-Path -LiteralPath $versionRoot)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "freecode-sh",
3
- "version": "0.1.0-alpha.36",
3
+ "version": "0.1.0-alpha.38",
4
4
  "description": "A free coding agent for your terminal.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "freecode",
@@ -47,6 +47,6 @@
47
47
  },
48
48
  "freecodeRelease": {
49
49
  "channel": "alpha",
50
- "nativeVersion": "0.1.0-alpha.36"
50
+ "nativeVersion": "0.1.0-alpha.38"
51
51
  }
52
52
  }