portable-agent-layer 0.117.0 → 0.117.1-canary.1

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.
@@ -54,24 +54,23 @@ $palSettings = Join-Path $env:USERPROFILE ".pal\settings.json"
54
54
  if (-not (Test-Path $palSettings)) { $palSettings = Join-Path $env:USERPROFILE ".pal\memory\pal-settings.json" }
55
55
 
56
56
  $OPEN_ISCS = 0
57
- $PROJECT_NAME = ""
58
57
  $projectsDir = Join-Path $env:USERPROFILE ".pal\work\projects"
59
58
  if (-not (Test-Path $projectsDir)) { $projectsDir = Join-Path $env:USERPROFILE ".pal\memory\projects" }
60
- if (Test-Path $projectsDir) {
59
+ $bindingsFile = Join-Path $env:USERPROFILE ".pal\bindings.json"
60
+ if ((Test-Path $projectsDir) -and (Test-Path $bindingsFile)) {
61
61
  try {
62
62
  $CWD_NORM = $CWD.Replace('/', '\').TrimEnd('\')
63
- foreach ($slug in Get-ChildItem $projectsDir -Directory | Select-Object -ExpandProperty Name) {
64
- $isa = Join-Path $projectsDir "$slug\ISA.md"
65
- if (-not (Test-Path $isa)) { continue }
66
- $content = Get-Content $isa -Raw -ErrorAction SilentlyContinue
67
- $pathMatch = [regex]::Match($content, 'path:\s*"?([^"\n\r]+)"?')
68
- if ($pathMatch.Success) {
69
- $projPath = $pathMatch.Groups[1].Value.Trim().Replace('/', '\').TrimEnd('\')
70
- if ($projPath -eq $CWD_NORM -or $CWD_NORM.StartsWith($projPath)) {
71
- $PROJECT_NAME = $slug
72
- $OPEN_ISCS = ([regex]::Matches($content, '- \[ \] ISC-')).Count
73
- break
74
- }
63
+ $bindings = Get-Content $bindingsFile -Raw | ConvertFrom-Json
64
+ $project = $bindings.PSObject.Properties |
65
+ ForEach-Object { [pscustomobject]@{ Slug = $_.Name; Path = ([string]$_.Value).Replace('/', '\').TrimEnd('\') } } |
66
+ Where-Object { $CWD_NORM -eq $_.Path -or $CWD_NORM.StartsWith($_.Path + '\', [StringComparison]::OrdinalIgnoreCase) } |
67
+ Sort-Object { $_.Path.Length } -Descending |
68
+ Select-Object -First 1
69
+ if ($project) {
70
+ $isa = Join-Path $projectsDir "$($project.Slug)\ISA.md"
71
+ if (Test-Path $isa) {
72
+ $content = Get-Content $isa -Raw -ErrorAction SilentlyContinue
73
+ $OPEN_ISCS = ([regex]::Matches($content, '- \[ \] ISC-')).Count
75
74
  }
76
75
  }
77
76
  } catch { $OPEN_ISCS = 0 }
@@ -85,17 +85,17 @@ PAL_SETTINGS="$HOME/.pal/settings.json"
85
85
  OPEN_ISCS=0
86
86
  PROJECTS_DIR="$HOME/.pal/work/projects"
87
87
  [ -d "$PROJECTS_DIR" ] || PROJECTS_DIR="$HOME/.pal/memory/projects"
88
- if [ -d "$PROJECTS_DIR" ]; then
88
+ BINDINGS="$HOME/.pal/bindings.json"
89
+ if [ -d "$PROJECTS_DIR" ] && [ -f "$BINDINGS" ]; then
89
90
  CWD_NORM="${CWD%/}"
90
- for ISA in "$PROJECTS_DIR"/*/ISA.md; do
91
- [ -f "$ISA" ] || continue
92
- PROJ_PATH=$(grep -m1 'path:' "$ISA" | sed 's/.*path:[[:space:]]*//' | tr -d '"' | tr -d "'" | xargs)
93
- PROJ_PATH="${PROJ_PATH%/}"
94
- if [ "$PROJ_PATH" = "$CWD_NORM" ] || [[ "$CWD_NORM" == "${PROJ_PATH}/"* ]]; then
95
- OPEN_ISCS=$(grep -c '- \[ \] ISC-' "$ISA" 2>/dev/null || echo 0)
96
- break
97
- fi
98
- done
91
+ PROJECT=$(jq -r --arg cwd "$CWD_NORM" '
92
+ to_entries
93
+ | map(select(.value as $p | ($p | rtrimstr("/")) as $p | $cwd == $p or ($cwd | startswith($p + "/"))))
94
+ | max_by(.value | length) | .key // empty' "$BINDINGS" 2>/dev/null)
95
+ ISA="$PROJECTS_DIR/$PROJECT/ISA.md"
96
+ if [ -n "$PROJECT" ] && [ -f "$ISA" ]; then
97
+ OPEN_ISCS=$(grep -c -- '- \[ \] ISC-' "$ISA" 2>/dev/null) || OPEN_ISCS=0
98
+ fi
99
99
  fi
100
100
 
101
101
  # Create context progress bar (20 chars wide)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "portable-agent-layer",
3
- "version": "0.117.0",
3
+ "version": "0.117.1-canary.1",
4
4
  "description": "PAL — Portable Agent Layer: persistent personal context for AI coding assistants",
5
5
  "type": "module",
6
6
  "bin": {
@@ -110,7 +110,7 @@ export function loginExpiryFindings(
110
110
  }
111
111
 
112
112
  const MOVES_EXPLAINED =
113
- "they move your data, so they run only when you start them: PAL must be idle, a verified backup is taken first, every file is hash-checked, and pal cli migrate --undo <id> puts it back. PAL reads the old folders until then. PAL 1.0 will not start until every one has run";
113
+ "they move your data, so they run only when you start them: PAL must be idle, a verified backup is taken first, every file is hash-checked, and pal cli migrate --undo <id> puts it back. PAL reads the old folders until then. PAL 1.0 needs every one of them";
114
114
 
115
115
  function ownerMovesFinding(pending: PendingMigration[]): Finding[] {
116
116
  const count = pending.filter((migration) => migration.ownerRun).length;