kushi-agents 5.4.5 → 5.4.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kushi-agents",
3
- "version": "5.4.5",
3
+ "version": "5.4.6",
4
4
  "description": "Install Kushi — multi-source project evidence agent with Comprehensive Structured Capture (CSC) into weekly-only files across Email, Teams, OneNote, Loop, SharePoint, Meetings, CRM, ADO. Meetings retain a sibling verbatim/ audit folder. WorkIQ-only for M365 sources (Graph / m365_* FORBIDDEN as fallbacks; user-paste is first-class). Host-agnostic.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,7 +25,7 @@ pwsh plugin/skills/doctor/doctor.ps1 -Json
25
25
  #>
26
26
  [CmdletBinding()]
27
27
  param(
28
- [string]$Repo = (Resolve-Path (Join-Path $PSScriptRoot "..\..\..")).Path,
28
+ [string]$Repo,
29
29
  [switch]$Json,
30
30
  [switch]$Strict,
31
31
  [ValidateSet('auto','source','install')] [string]$LayoutMode = 'auto'
@@ -34,16 +34,27 @@ param(
34
34
  $ErrorActionPreference = 'Continue'
35
35
  $sections = New-Object System.Collections.Generic.List[object]
36
36
 
37
- # === v5.4.5: layout-portable doctor ===
38
- function Resolve-KushiLayout([string]$RootPath) {
39
- if (Test-Path (Join-Path $RootPath 'plugin')) {
40
- return @{ Mode='source'; Plugin=(Join-Path $RootPath 'plugin'); Repo=$RootPath; HasPluginJson=$true }
37
+ # === v5.4.5+: layout-portable, script-location-based ===
38
+ # This script always sits at <plugin-root>/skills/doctor/doctor.ps1, where
39
+ # <plugin-root> = <repo>/plugin/ (source) or <host>/skills/kushi/ (install).
40
+ # Derive layout from $PSScriptRoot never walk repo dirs.
41
+ function Resolve-KushiLayout {
42
+ param([string]$Override)
43
+ if ($Override) {
44
+ if (Test-Path (Join-Path $Override 'plugin')) {
45
+ return @{ Mode='source'; Plugin=(Join-Path $Override 'plugin'); Repo=$Override; HasPluginJson=$true }
46
+ }
47
+ if (Test-Path (Join-Path $Override 'skills')) {
48
+ return @{ Mode='install'; Plugin=$Override; Repo=$Override; HasPluginJson=(Test-Path (Join-Path $Override 'kushi-install.json')) }
49
+ }
50
+ throw "Not a kushi layout: $Override (need either plugin/ or skills/)."
41
51
  }
42
- if (Test-Path (Join-Path $RootPath 'skills')) {
43
- $pj = Join-Path $RootPath 'kushi-install.json'
44
- return @{ Mode='install'; Plugin=$RootPath; Repo=$RootPath; HasPluginJson=(Test-Path $pj) }
52
+ $pluginRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).Path
53
+ if (Test-Path (Join-Path $pluginRoot 'kushi-install.json')) {
54
+ return @{ Mode='install'; Plugin=$pluginRoot; Repo=$pluginRoot; HasPluginJson=$false }
45
55
  }
46
- throw "Not a kushi layout: $RootPath (need either plugin/ or skills/)."
56
+ $maybeRepo = (Resolve-Path (Join-Path $pluginRoot '..')).Path
57
+ return @{ Mode='source'; Plugin=$pluginRoot; Repo=$maybeRepo; HasPluginJson=(Test-Path (Join-Path $pluginRoot 'plugin.json')) }
47
58
  }
48
59
 
49
60
  function Get-KushiInstallHost([string]$InstallRoot) {
@@ -55,14 +66,9 @@ function Get-KushiInstallHost([string]$InstallRoot) {
55
66
 
56
67
  $Layout = Resolve-KushiLayout $Repo
57
68
  if ($LayoutMode -ne 'auto' -and $Layout.Mode -ne $LayoutMode) {
58
- if ($LayoutMode -eq 'source') {
59
- if (-not (Test-Path (Join-Path $Repo 'plugin'))) { Write-Error "LayoutMode=source requested but no plugin/ under $Repo."; exit 2 }
60
- $Layout = @{ Mode='source'; Plugin=(Join-Path $Repo 'plugin'); Repo=$Repo; HasPluginJson=$true }
61
- } else {
62
- if (-not (Test-Path (Join-Path $Repo 'skills'))) { Write-Error "LayoutMode=install requested but no skills/ under $Repo."; exit 2 }
63
- $Layout = @{ Mode='install'; Plugin=$Repo; Repo=$Repo; HasPluginJson=(Test-Path (Join-Path $Repo 'kushi-install.json')) }
64
- }
69
+ Write-Error "LayoutMode=$LayoutMode requested but detected $($Layout.Mode) at $($Layout.Plugin)."; exit 2
65
70
  }
71
+ if (-not $Repo) { $Repo = $Layout.Repo }
66
72
 
67
73
  if (-not $Json) {
68
74
  if ($Layout.Mode -eq 'install') {
@@ -26,7 +26,7 @@ pwsh plugin/skills/self-check/run.ps1 -Deep -Json | ConvertFrom-Json
26
26
  #>
27
27
  [CmdletBinding()]
28
28
  param(
29
- [string]$Root = (Resolve-Path (Join-Path $PSScriptRoot "..\..\..")).Path,
29
+ [string]$Root,
30
30
  [switch]$Deep,
31
31
  [switch]$Json,
32
32
  [switch]$StrictExit,
@@ -37,48 +37,43 @@ param(
37
37
  $ErrorActionPreference = "Stop"
38
38
  $findings = New-Object System.Collections.Generic.List[object]
39
39
 
40
- # === v5.4.5: layout-portable diagnostics ===
41
- # Kushi diagnostics may run from either:
42
- # - source tree : <repo>/plugin/{skills,prompts,instructions,agents,plugin.json}
43
- # - installed tree: <host>/skills/kushi/{skills,prompts,instructions,agents,kushi-install.json}
44
- # Resolve-KushiLayout returns a normalized handle so probes can derive paths
45
- # from $Layout.Plugin instead of hardcoding 'plugin\...'.
46
- function Resolve-KushiLayout([string]$RootPath) {
47
- if (Test-Path (Join-Path $RootPath 'plugin')) {
48
- return @{ Mode='source'; Plugin=(Join-Path $RootPath 'plugin'); Repo=$RootPath; HasPluginJson=$true }
49
- }
50
- if (Test-Path (Join-Path $RootPath 'skills')) {
51
- $pj = Join-Path $RootPath 'kushi-install.json'
52
- return @{ Mode='install'; Plugin=$RootPath; Repo=$RootPath; HasPluginJson=(Test-Path $pj) }
53
- }
54
- throw "Not a kushi layout: $RootPath (need either plugin/ or skills/)."
40
+ # === v5.4.5+: layout-portable, script-location-based ===
41
+ # This script always sits at <plugin-root>/skills/self-check/run.ps1, where
42
+ # <plugin-root> = <repo>/plugin/ (source) or <host>/skills/kushi/ (install).
43
+ # Derive layout from $PSScriptRoot — never walk repo dirs.
44
+ function Resolve-KushiLayout {
45
+ param([string]$Override)
46
+ if ($Override) {
47
+ if (Test-Path (Join-Path $Override 'plugin')) {
48
+ return @{ Mode='source'; Plugin=(Join-Path $Override 'plugin'); Repo=$Override; HasPluginJson=$true }
49
+ }
50
+ if (Test-Path (Join-Path $Override 'skills')) {
51
+ return @{ Mode='install'; Plugin=$Override; Repo=$Override; HasPluginJson=(Test-Path (Join-Path $Override 'kushi-install.json')) }
52
+ }
53
+ throw "Not a kushi layout: $Override (need either plugin/ or skills/)."
54
+ }
55
+ $pluginRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).Path
56
+ if (Test-Path (Join-Path $pluginRoot 'kushi-install.json')) {
57
+ return @{ Mode='install'; Plugin=$pluginRoot; Repo=$pluginRoot; HasPluginJson=$false }
58
+ }
59
+ $maybeRepo = (Resolve-Path (Join-Path $pluginRoot '..')).Path
60
+ return @{ Mode='source'; Plugin=$pluginRoot; Repo=$maybeRepo; HasPluginJson=(Test-Path (Join-Path $pluginRoot 'plugin.json')) }
55
61
  }
56
62
 
57
63
  function Get-KushiInstallHost([string]$InstallRoot) {
58
- # Best-effort: detect whether the install lives under ~/.copilot or ~/.vscode.
59
64
  $norm = ($InstallRoot -replace '\\','/').ToLower()
60
- if ($norm -match '/\.copilot/') { return 'clawpilot' }
61
- if ($norm -match '/\.vscode/') { return 'vscode' }
65
+ if ($norm -match '/\.copilot/') { return 'clawpilot' }
66
+ if ($norm -match '/\.vscode/') { return 'vscode' }
62
67
  return 'unknown'
63
68
  }
64
69
 
65
70
  $Layout = Resolve-KushiLayout $Root
66
71
  if ($LayoutMode -ne 'auto' -and $Layout.Mode -ne $LayoutMode) {
67
- # User forced a mode. Re-shape the handle accordingly.
68
- if ($LayoutMode -eq 'source') {
69
- if (-not (Test-Path (Join-Path $Root 'plugin'))) {
70
- Write-Error "LayoutMode=source requested but no plugin/ under $Root."
71
- exit 2
72
- }
73
- $Layout = @{ Mode='source'; Plugin=(Join-Path $Root 'plugin'); Repo=$Root; HasPluginJson=$true }
74
- } else {
75
- if (-not (Test-Path (Join-Path $Root 'skills'))) {
76
- Write-Error "LayoutMode=install requested but no skills/ under $Root."
77
- exit 2
78
- }
79
- $Layout = @{ Mode='install'; Plugin=$Root; Repo=$Root; HasPluginJson=(Test-Path (Join-Path $Root 'kushi-install.json')) }
80
- }
72
+ Write-Error "LayoutMode=$LayoutMode requested but detected $($Layout.Mode) at $($Layout.Plugin)."
73
+ exit 2
81
74
  }
75
+ # Backfill $Root for legacy probes that derive paths from $Root (source-mode only).
76
+ if (-not $Root) { $Root = $Layout.Repo }
82
77
 
83
78
  if (-not $Json) {
84
79
  if ($Layout.Mode -eq 'install') {