@holmes-lab/holmes-kit 0.19.2 → 0.19.4

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 (47) hide show
  1. package/CHANGELOG.md +177 -0
  2. package/README.md +22 -4
  3. package/dist/.build-id +1 -1
  4. package/dist/holmes/cli/agents.d.ts +8 -0
  5. package/dist/holmes/cli/agents.js +26 -2
  6. package/dist/holmes/cli/codex-toml.d.ts +10 -0
  7. package/dist/holmes/cli/codex-toml.js +76 -12
  8. package/dist/holmes/cli/doctor.d.ts +34 -0
  9. package/dist/holmes/cli/doctor.js +139 -46
  10. package/dist/holmes/cli/index.js +13 -0
  11. package/dist/holmes/cli/init.js +10 -3
  12. package/dist/holmes/cli/native-deps.js +4 -1
  13. package/dist/holmes/cli/playbook-skills.js +6 -4
  14. package/dist/holmes/cli/probe-process.d.ts +8 -0
  15. package/dist/holmes/cli/probe-process.js +73 -0
  16. package/dist/holmes/cli/spawn-spec.js +3 -1
  17. package/dist/holmes/cli/test-platform.d.ts +37 -0
  18. package/dist/holmes/cli/test-platform.js +126 -1
  19. package/dist/holmes/governance/approval-grants.js +26 -3
  20. package/dist/holmes/governance/autonomy.d.ts +17 -1
  21. package/dist/holmes/governance/autonomy.js +37 -5
  22. package/dist/holmes/mcp/handlers.d.ts +30 -5
  23. package/dist/holmes/mcp/handlers.js +111 -13
  24. package/dist/holmes/mcp/spec-id-guard.d.ts +1 -1
  25. package/dist/holmes/mcp/spec-id-guard.js +9 -13
  26. package/dist/holmes/mcp/tool-schemas.js +13 -0
  27. package/dist/holmes/project/install-scripts-policy.d.ts +16 -2
  28. package/dist/holmes/project/install-scripts-policy.js +16 -2
  29. package/dist/holmes/review/point-in-time-replay.js +43 -3
  30. package/dist/holmes/rtm/graph-store.d.ts +2 -0
  31. package/dist/holmes/rtm/graph-store.js +14 -0
  32. package/dist/holmes/rtm/rtm-graph.js +42 -30
  33. package/dist/holmes/semantic/credentials.js +86 -9
  34. package/dist/holmes/semantic/embedder.js +6 -39
  35. package/dist/holmes/semantic/local-model.d.ts +30 -0
  36. package/dist/holmes/semantic/local-model.js +92 -0
  37. package/dist/holmes/semantic/model-cache.d.ts +8 -0
  38. package/dist/holmes/semantic/model-cache.js +67 -0
  39. package/dist/holmes/semantic/tier.d.ts +7 -0
  40. package/dist/holmes/semantic/tier.js +9 -3
  41. package/dist/holmes/spec/renumber.d.ts +72 -0
  42. package/dist/holmes/spec/renumber.js +341 -0
  43. package/dist/holmes/spec/spec-id.d.ts +9 -0
  44. package/dist/holmes/spec/spec-id.js +23 -0
  45. package/docs/install-guide.md +90 -2
  46. package/package.json +6 -3
  47. package/scripts/install.ps1 +30 -27
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "//": "@implements A-SPEC-209",
3
3
  "name": "@holmes-lab/holmes-kit",
4
- "version": "0.19.2",
4
+ "version": "0.19.4",
5
5
  "description": "Holmes-Kit — deterministic Agentic Software Engineering (ASE) harness with causal traceability (spec chain + D-CPG + RTM + phase guardrail)",
6
6
  "main": "dist/holmes/mcp/server.js",
7
7
  "types": "dist/holmes/mcp/server.d.ts",
@@ -22,6 +22,7 @@
22
22
  "node": ">=20"
23
23
  },
24
24
  "scripts": {
25
+ "postinstall": "node -e \"const p='./dist/holmes/semantic/local-model.js';if(require('fs').existsSync(p)){process.exitCode=require(p).runModelSetup({automatic:true})}else{console.error('BGE-M3 setup pending: build this source checkout, then run holmes-kit semantic-setup.')}\"",
25
26
  "build": "tsc && node -e \"const{execSync}=require('child_process'),fs=require('fs');const id=(()=>{try{return execSync('git rev-parse --short HEAD').toString().trim()}catch{return 'nogit'}})();fs.writeFileSync('dist/.build-id',id+'-'+Date.now().toString(36))\"",
26
27
  "test": "npm run typecheck && jest",
27
28
  "mcp": "node bin/holmes-mcp.js",
@@ -73,7 +74,8 @@
73
74
  "tree-sitter-rust": "^0.21.0",
74
75
  "tree-sitter-typescript": "^0.21.2",
75
76
  "typescript": "^5.0.0",
76
- "web-tree-sitter": "0.27.0"
77
+ "web-tree-sitter": "0.27.0",
78
+ "@xenova/transformers": "^2.17.2"
77
79
  },
78
80
  "repository": {
79
81
  "type": "git",
@@ -87,6 +89,7 @@
87
89
  "access": "public"
88
90
  },
89
91
  "allowScripts": {
90
- "better-sqlite3@12.11.1": true
92
+ "better-sqlite3@12.11.1": true,
93
+ "sharp@0.32.6": true
91
94
  }
92
95
  }
@@ -1,13 +1,10 @@
1
+ # @implements A-SPEC-593
1
2
  <#
2
3
  .SYNOPSIS
3
4
  Holmes-Kit bootstrap installer for Windows. @implements A-SPEC-253
4
5
  .DESCRIPTION
5
- Runs BEFORE npm to fix what npm cannot: a protected CWD (an elevated PowerShell opens in
6
- C:\WINDOWS\System32 and `npm install` dies there with EPERM), an unwritable global prefix
7
- (C:\Program Files\nodejs), a too-old Node.js, and native-build failures that print compiler
8
- noise instead of the one command that installs the toolchain. Then it runs
9
- `npm install -g @holmes-lab/holmes-kit`. Windows PowerShell 5.1 only; no prompts; nothing
10
- persistent is changed.
6
+ Checks the working directory, npm prefix, Node version, and native install failures.
7
+ Installs Holmes-Kit and prepares BGE-M3 through the shared CLI. PowerShell 5.1; no prompts.
11
8
  .PARAMETER DryRun Run every check, print the npm command that WOULD run, exit 0 without running it.
12
9
  .PARAMETER Version Package version to install (default: latest).
13
10
  .PARAMETER Prefix Optional npm --prefix for the global install.
@@ -16,8 +13,7 @@
16
13
  .NOTES
17
14
  Exit codes: 0 ok / already installed, 2 argument error, 3 Node too old, 4 npm failed, 5 not on PATH.
18
15
  #>
19
- # Non-positional on purpose: otherwise `install.ps1 foo` binds `foo` to -Version and runs a REAL
20
- # `npm install -g @holmes-lab/holmes-kit@foo` from a typo. Stray tokens land in $Rest -> exit 2.
16
+ # Stray positional tokens land in $Rest and exit 2 before installation.
21
17
  [CmdletBinding(PositionalBinding = $false)]
22
18
  param(
23
19
  [Parameter(Mandatory = $false)][switch]$DryRun,
@@ -34,17 +30,10 @@ $script:NodeMajorFloor = 20
34
30
  $script:PackageName = '@holmes-lab/holmes-kit'
35
31
  $script:BinName = 'holmes-kit'
36
32
 
37
- # Failure classifier. Pure: npm's combined output in, one token out. Precedence is fixed so the
38
- # most ACTIONABLE cause wins when several signatures appear in the same transcript - an EPERM in a
39
- # protected directory also drags node-gyp down with it, and telling the user to install MSVC
40
- # would send them the wrong way.
33
+ # Classify npm failures with directory errors taking precedence over downstream build noise.
41
34
  function Get-InstallFailureKind([string]$NpmOutput) {
42
35
  if ($null -eq $NpmOutput) { $NpmOutput = '' }
43
- # Two EPERMs, one code. CWD (System32): relocating fixes it. GLOBAL PREFIX (C:\Program Files\
44
- # nodejs, the Node installer's default): only --prefix fixes it. Measured 2026-08-23: after the
45
- # relocation the install still died on `mkdir 'C:\Program Files\nodejs\node_modules\@holmes-lab'`.
46
- # Keyed on the FAILING PATH line, not any mention of that directory: every npm stack trace names
47
- # npm's own home under Program Files\nodejs\node_modules\npm, which is not the error.
36
+ # Match the failing prefix path, not npm's own installation mentioned in every stack trace.
48
37
  if ($NpmOutput -match 'EPERM' -and $NpmOutput -match "(?m)^npm error path .*Program Files[\\/]+nodejs[\\/]+node_modules[\\/]+(?!npm[\\/])") { return 'eperm-prefix' }
49
38
  if ($NpmOutput -match 'EPERM' -and ($NpmOutput -match 'mkdir' -or $NpmOutput -match 'System32' -or $NpmOutput -match 'Program Files')) { return 'eperm' }
50
39
  if ($NpmOutput -match 'MSB\d{4}' -or $NpmOutput -match 'MSBuild' -or $NpmOutput -match 'Visual Studio' -or $NpmOutput -match 'vcvarsall') { return 'msbuild' }
@@ -97,10 +86,27 @@ npm exited with an error this installer does not recognise. The last lines of i
97
86
  '@
98
87
  }
99
88
 
100
- # Stage helpers
101
89
  function Write-Stage([string]$Text) { Write-Host $Text }
102
90
  function Write-Problem([string]$Text) { [Console]::Error.WriteLine($Text) }
103
91
 
92
+ function Initialize-LocalModel {
93
+ if ($DryRun) { return }
94
+ # A-SPEC-594: semantic-setup always downloads, so the opt-in gate lives HERE or Windows keeps fetching while macOS/Linux no longer do. Skip outranks opt-in.
95
+ if ($env:HOLMES_SKIP_MODEL_INSTALL -eq '1' -or $env:HOLMES_AUTO_MODEL_INSTALL -ne '1') {
96
+ if ($env:HOLMES_SKIP_MODEL_INSTALL -eq '1') { Write-Stage 'BGE-M3 preparation skipped (HOLMES_SKIP_MODEL_INSTALL=1). Run holmes-kit semantic-setup when ready.' }
97
+ else { Write-Stage 'BGE-M3 is not prepared automatically. Run holmes-kit semantic-setup to download the public model once, or set HOLMES_AUTO_MODEL_INSTALL=1 before installing. Graph features work without it.' }
98
+ return
99
+ }
100
+ Write-Stage 'Preparing and verifying BGE-M3 through holmes-kit semantic-setup...'
101
+ $modelCode = 1; $prev = $ErrorActionPreference; $ErrorActionPreference = 'Continue'
102
+ try {
103
+ & $script:BinName semantic-setup 2>&1 | ForEach-Object { Write-Stage "$_" }
104
+ $modelCode = $LASTEXITCODE
105
+ } catch { $modelCode = 1 } finally { $ErrorActionPreference = $prev }
106
+ if ($modelCode -eq 0) { Write-Stage 'BGE-M3 ready: local inference verified.' }
107
+ else { Write-Problem 'BGE-M3 unavailable. Holmes-Kit graph features remain installed. Run holmes-kit semantic-setup, then holmes-kit semantic-check to verify readiness.' }
108
+ }
109
+
104
110
  function Get-NormalizedPath([string]$P) {
105
111
  if ([string]::IsNullOrWhiteSpace($P)) { return $null }
106
112
  $t = $P.TrimEnd('\', '/')
@@ -118,8 +124,7 @@ function Test-UnderRoot([string]$Candidate, [string]$Root) {
118
124
 
119
125
  function Test-ProtectedDirectory([string]$Dir) {
120
126
  $here = Get-NormalizedPath $Dir
121
- # The drive root is protected only when $PWD IS the root (C:\) - everything on the drive is
122
- # under it, so treating it like the other roots would relocate every project on the machine.
127
+ # Protect the drive root itself, not every project beneath it.
123
128
  $driveRoot = Get-NormalizedPath ([IO.Path]::GetPathRoot($Dir))
124
129
  if ($null -ne $driveRoot -and $here -eq $driveRoot) { return $true }
125
130
  $roots = @($env:SystemRoot, $env:ProgramFiles, ${env:ProgramFiles(x86)}, $env:ProgramData)
@@ -165,7 +170,7 @@ function Get-InstalledVersion {
165
170
  }
166
171
 
167
172
  function Get-NpmPrefix {
168
- # Skipped in -DryRun only when npm is absent; otherwise it is a local config read, no network.
173
+ # A local configuration read, without network access.
169
174
  $r = Invoke-Npm @('config', 'get', 'prefix')
170
175
  if ($r.Code -ne 0) { return $null }
171
176
  $v = $r.Output.Trim()
@@ -174,8 +179,7 @@ function Get-NpmPrefix {
174
179
  }
175
180
 
176
181
  function Invoke-Npm([string[]]$Arguments) {
177
- # Array arguments, never one interpolated string; npm is npm.cmd on Windows and needs the
178
- # .cmd resolution that `&` performs. Both streams are merged so the classifier sees everything.
182
+ # Array arguments preserve Windows .cmd resolution; merge streams for failure classification.
179
183
  $npm = Get-Command npm.cmd -ErrorAction SilentlyContinue
180
184
  if ($null -eq $npm) { $npm = Get-Command npm -ErrorAction SilentlyContinue }
181
185
  if ($null -eq $npm) { return @{ Code = 127; Output = 'npm was not found on PATH' } }
@@ -190,7 +194,6 @@ function Invoke-Npm([string[]]$Arguments) {
190
194
  return @{ Code = $code; Output = ($lines -join "`n") }
191
195
  }
192
196
 
193
- # Pipeline
194
197
  function Invoke-Main {
195
198
  # Stage 0 - arguments
196
199
  if ($null -ne $Rest -and $Rest.Count -gt 0) {
@@ -238,14 +241,13 @@ function Invoke-Main {
238
241
  }
239
242
  if ($want -ne 'latest' -and $installed -eq $want) {
240
243
  Write-Stage ("already installed ({0})" -f $installed)
244
+ Initialize-LocalModel
241
245
  return 0
242
246
  }
243
247
  Write-Stage ("holmes-kit {0} is installed; will install {1}" -f $installed, $Version)
244
248
  }
245
249
 
246
- # Stage 4b - prefix guard. A non-elevated shell cannot write the Node installer's default
247
- # prefix (C:\Program Files\nodejs) and Stage 1 does not help. Per-user prefix for THIS call
248
- # only; the user's npm config is never modified (REQ-253 Constraint 2).
250
+ # Stage 4b - use a writable per-user prefix for this call; never modify npm configuration.
249
251
  if ([string]::IsNullOrWhiteSpace($Prefix) -and -not (Test-Elevated)) {
250
252
  $cur = Get-NpmPrefix
251
253
  if ($null -ne $cur -and (Test-ProtectedDirectory $cur)) {
@@ -287,6 +289,7 @@ function Invoke-Main {
287
289
  }
288
290
  $v = Get-InstalledVersion
289
291
  Write-Stage ("holmes-kit {0} installed" -f $v)
292
+ Initialize-LocalModel
290
293
  return 0
291
294
  }
292
295