@inerrata-corporation/errata 2.0.0-alpha.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.ps1 ADDED
@@ -0,0 +1,90 @@
1
+ # errata Windows installer / patcher (Node-bundle distribution).
2
+ # Idempotent: re-running upgrades an existing install in place.
3
+ #
4
+ # Unlike the old SEA build (a 90 MB self-contained errata.exe), this ships the
5
+ # CLI as a single bundled errata.mjs run under the system Node — so Node 22+ must
6
+ # be on PATH. Everything else (tree-sitter WASM) rides along under resources/.
7
+
8
+ $ErrorActionPreference = "Stop"
9
+ $ScriptRoot = $PSScriptRoot
10
+ if (-not $ScriptRoot) { $ScriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path }
11
+
12
+ # errata runs on the system Node — fail loudly if it's missing rather than after install.
13
+ $node = Get-Command node -ErrorAction SilentlyContinue
14
+ if (-not $node) {
15
+ Write-Host "[X] Node.js not found on PATH. Install Node 22+ from https://nodejs.org and re-run."
16
+ exit 1
17
+ }
18
+ $nodeMajor = (& node -e "process.stdout.write(String(process.versions.node.split('.')[0]))")
19
+ if ([int]$nodeMajor -lt 22) {
20
+ Write-Host "[X] Node $nodeMajor found, but errata needs Node 22+. Upgrade and re-run."
21
+ exit 1
22
+ }
23
+
24
+ $Target = Join-Path $env:LOCALAPPDATA "errata"
25
+ $IsPatch = Test-Path (Join-Path $Target "errata.mjs")
26
+
27
+ if ($IsPatch) {
28
+ Write-Host "patching existing errata install at $Target"
29
+ } else {
30
+ Write-Host "installing errata to $Target (Node $nodeMajor)"
31
+ }
32
+
33
+ if (-not (Test-Path $Target)) {
34
+ New-Item -ItemType Directory -Path $Target | Out-Null
35
+ }
36
+ Copy-Item -Path (Join-Path $ScriptRoot "errata.mjs") -Destination $Target -Force
37
+ Copy-Item -Path (Join-Path $ScriptRoot "errata.cmd") -Destination $Target -Force
38
+ $ResSrc = Join-Path $ScriptRoot "resources"
39
+ $ResDst = Join-Path $Target "resources"
40
+ if (Test-Path $ResDst) { Remove-Item $ResDst -Recurse -Force }
41
+ Copy-Item -Path $ResSrc -Destination $Target -Recurse -Force
42
+
43
+ $UserPath = [Environment]::GetEnvironmentVariable("Path", "User")
44
+ $PathParts = if ($UserPath) { $UserPath.Split(";") } else { @() }
45
+ if ($PathParts -notcontains $Target) {
46
+ $NewPath = if ($UserPath) { "$UserPath;$Target" } else { $Target }
47
+ [Environment]::SetEnvironmentVariable("Path", $NewPath, "User")
48
+ Write-Host "added $Target to user PATH"
49
+ Write-Host " (open a new terminal for PATH changes to take effect)"
50
+ } else {
51
+ Write-Host "PATH already contains $Target"
52
+ }
53
+
54
+ # Auto-start the daemon at logon via a Scheduled Task. We launch through a hidden
55
+ # .vbs shim because node.exe is a console app — running it from the task directly
56
+ # flashes a window every logon; WScript's Run(..., 0, False) starts it windowless.
57
+ # Task name/path mirror uninstall.ps1 (\errata\ai.errata.daemon) so the two stay
58
+ # symmetric. Best-effort: a failure here must not fail the install.
59
+ $VbsTemplate = @'
60
+ ' errata daemon autostart launcher (written by install.ps1) - runs `errata dash` fully hidden.
61
+ Set sh = CreateObject("WScript.Shell")
62
+ sh.CurrentDirectory = "__CWD__"
63
+ sh.Run """__NODE__"" ""__MJS__"" dash", 0, False
64
+ '@
65
+ try {
66
+ $Launcher = Join-Path $Target "errata-autostart.vbs"
67
+ $Vbs = $VbsTemplate.Replace("__CWD__", $env:USERPROFILE).Replace("__NODE__", $node.Source).Replace("__MJS__", (Join-Path $Target "errata.mjs"))
68
+ Set-Content -Path $Launcher -Value $Vbs -Encoding ASCII
69
+
70
+ $action = New-ScheduledTaskAction -Execute "wscript.exe" -Argument ('"{0}"' -f $Launcher)
71
+ $trigger = New-ScheduledTaskTrigger -AtLogOn -User $env:USERNAME
72
+ $settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable -ExecutionTimeLimit (New-TimeSpan -Seconds 0) -RestartCount 3 -RestartInterval (New-TimeSpan -Minutes 1)
73
+ $principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -LogonType Interactive -RunLevel Limited
74
+ Register-ScheduledTask -TaskName "ai.errata.daemon" -TaskPath "\errata\" -Action $action -Trigger $trigger -Settings $settings -Principal $principal -Description "Auto-start the errata dash daemon at logon." -Force | Out-Null
75
+ Write-Host "registered autostart task \errata\ai.errata.daemon (starts at logon)"
76
+ } catch {
77
+ Write-Host "[!] could not register autostart task: $($_.Exception.Message)"
78
+ Write-Host " (install still succeeded - start the daemon manually with 'errata dash')"
79
+ }
80
+
81
+ Write-Host ""
82
+ if ($IsPatch) { Write-Host "[OK] errata patched." } else { Write-Host "[OK] errata installed." }
83
+ Write-Host ""
84
+ Write-Host "Next steps:"
85
+ Write-Host " 1. Open a new terminal so PATH refreshes."
86
+ Write-Host " 2. cd into the workspace you want to observe."
87
+ Write-Host " 3. errata init"
88
+ Write-Host " 4. errata start (or 'errata dash' to watch all projects)"
89
+ Write-Host ""
90
+ Write-Host "The daemon will also auto-start at every logon from now on."
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@inerrata-corporation/errata",
3
+ "version": "2.0.0-alpha.0",
4
+ "description": "errata - local-first observation engine for AI coding agents",
5
+ "type": "module",
6
+ "bin": {
7
+ "errata": "errata.mjs"
8
+ },
9
+ "files": [
10
+ "errata.mjs",
11
+ "pass-worker.mjs",
12
+ "consolidate-worker.mjs",
13
+ "resources",
14
+ "install.ps1",
15
+ "uninstall.ps1",
16
+ "README.txt"
17
+ ],
18
+ "engines": {
19
+ "node": ">=22"
20
+ },
21
+ "license": "UNLICENSED",
22
+ "publishConfig": {
23
+ "access": "public",
24
+ "registry": "https://registry.npmjs.org"
25
+ }
26
+ }