archgraph-argo 0.10.24 → 0.10.26

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 (2) hide show
  1. package/install-argo.ps1 +38 -6
  2. package/package.json +1 -1
package/install-argo.ps1 CHANGED
@@ -22,6 +22,7 @@ param(
22
22
  [string]$DshWorkspaces = '',
23
23
  [string]$OpenClawHome = "$env:USERPROFILE\.openclaw",
24
24
  [string]$OpenClawWorkspace = "$env:USERPROFILE\.openclaw\workspace",
25
+ [string]$OpenClawRepoRoot = '',
25
26
  [switch]$SkipOpenClaw,
26
27
  [string]$McpPath
27
28
  )
@@ -335,8 +336,13 @@ function Write-OpenClawMcpConfig {
335
336
  # ~/.openclaw/openclaw.json. OpenClaw is a fixed-workspace host: its
336
337
  # embedded MCP client does not advertise MCP roots, so the workspace is
337
338
  # pinned explicitly via env.ARGO_REPO_ROOT to the repository root this
338
- # installer runs from. Existing config keys are preserved; a JSON5 (non
339
- # strict JSON) config is left untouched with a manual-registration hint.
339
+ # installer runs from. Only a real ArchGraph workspace (one that contains
340
+ # design/KG/SystemArchitecture.json) is pinned; when the installer runs
341
+ # from a non-workspace location (e.g. the npm-global archgraph-argo package
342
+ # dir via `argo-deploy`), an existing ARGO_REPO_ROOT is preserved instead
343
+ # of being clobbered, and a missing one is left unpinned with a hint.
344
+ # Existing config keys are preserved; a JSON5 (non strict JSON) config is
345
+ # left untouched with a manual-registration hint.
340
346
  param(
341
347
  [string]$OpenClawHome,
342
348
  [string]$RepoRoot,
@@ -344,18 +350,37 @@ function Write-OpenClawMcpConfig {
344
350
  )
345
351
  $configPath = Join-Path $OpenClawHome 'openclaw.json'
346
352
  $root = [ordered]@{}
353
+ $existingArgoRoot = ''
347
354
  if (Test-Path $configPath) {
348
355
  try {
349
356
  $existing = Get-Content $configPath -Raw | ConvertFrom-Json
350
357
  foreach ($p in $existing.PSObject.Properties) {
351
358
  $root[$p.Name] = $p.Value
352
359
  }
360
+ # Capture any previously pinned ARGO_REPO_ROOT so a non-workspace
361
+ # refresh (e.g. npm-global argo-deploy) cannot clobber a correct pin.
362
+ if ($null -ne $existing.mcp -and $null -ne $existing.mcp.servers `
363
+ -and $null -ne $existing.mcp.servers.argo -and $null -ne $existing.mcp.servers.argo.env `
364
+ -and $null -ne $existing.mcp.servers.argo.env.ARGO_REPO_ROOT) {
365
+ $existingArgoRoot = [string]$existing.mcp.servers.argo.env.ARGO_REPO_ROOT
366
+ }
353
367
  } catch {
354
368
  Write-Warning " $configPath is not strict JSON (JSON5 with comments?); skipping argo MCP registration."
355
369
  Write-Warning " Register manually: openclaw mcp add argo --command node --arg `"$ArgoServer`" --env ARGO_REPO_ROOT=$RepoRoot"
356
370
  return
357
371
  }
358
372
  }
373
+ $repoIsWorkspace = Test-Path (Join-Path $RepoRoot 'design\KG\SystemArchitecture.json')
374
+ $envBlock = [ordered]@{}
375
+ if ($repoIsWorkspace) {
376
+ $envBlock.ARGO_REPO_ROOT = $RepoRoot
377
+ } elseif ($existingArgoRoot) {
378
+ $envBlock.ARGO_REPO_ROOT = $existingArgoRoot
379
+ Write-Host " $RepoRoot is not an ArchGraph workspace; preserving existing ARGO_REPO_ROOT=$existingArgoRoot"
380
+ } else {
381
+ Write-Warning " $RepoRoot is not an ArchGraph workspace; not pinning ARGO_REPO_ROOT for OpenClaw."
382
+ Write-Warning " Run install-argo.ps1 from the repository you want OpenClaw to serve, or set mcp.servers.argo.env.ARGO_REPO_ROOT manually."
383
+ }
359
384
  $mcp = [ordered]@{}
360
385
  if ($root.Contains('mcp') -and $null -ne $root['mcp']) {
361
386
  foreach ($p in $root['mcp'].PSObject.Properties) { $mcp[$p.Name] = $p.Value }
@@ -364,11 +389,14 @@ function Write-OpenClawMcpConfig {
364
389
  if ($mcp.Contains('servers') -and $null -ne $mcp['servers']) {
365
390
  foreach ($p in $mcp['servers'].PSObject.Properties) { $servers[$p.Name] = $p.Value }
366
391
  }
367
- $servers['argo'] = [ordered]@{
392
+ $argoServerObj = [ordered]@{
368
393
  command = 'node'
369
394
  args = @($ArgoServer)
370
- env = [ordered]@{ ARGO_REPO_ROOT = $RepoRoot }
371
395
  }
396
+ if ($envBlock.Count -gt 0) {
397
+ $argoServerObj.env = $envBlock
398
+ }
399
+ $servers['argo'] = $argoServerObj
372
400
  $mcp['servers'] = $servers
373
401
  $root['mcp'] = $mcp
374
402
  New-Item -ItemType Directory -Force -Path $OpenClawHome | Out-Null
@@ -794,7 +822,7 @@ if ($SkipDsh) {
794
822
  Write-DshManagedBlock -Path $patchPath -Block $block -MarkerStart '# BEGIN ArchGraph ARGO deployment' -MarkerEnd '# END ArchGraph ARGO deployment'
795
823
  }
796
824
 
797
- Write-Host "[19/22] argo\agents11 -> $DshHome\.agent-presets\<id> (DeepSeek Harness agent presets)"
825
+ Write-Host "[19/22] argo\agents -> $DshHome\.agent-presets\<id> (DeepSeek Harness agent presets)"
798
826
  New-DshAgentPresets -DshHome $DshHome -AgentsSrc (Join-Path $argoDir 'agents')
799
827
 
800
828
  Write-Host ' Restart `dsh web` to activate the MCP bridge and the wakeup plugin;'
@@ -944,8 +972,12 @@ if ($SkipMcp) {
944
972
  Write-Host "argo MCP config written -> $OpenCodeConfigPath"
945
973
 
946
974
  if (-not $SkipOpenClaw) {
975
+ # The repo root to pin for OpenClaw defaults to the installer's own
976
+ # location; -OpenClawRepoRoot overrides it (e.g. for tests or when the
977
+ # installer runs from a non-workspace npm-global package dir).
978
+ $openClawRepoRoot = if ($OpenClawRepoRoot) { $OpenClawRepoRoot } else { $repoRoot }
947
979
  Write-Host "[22/22] argo MCP server -> $(Join-Path $OpenClawHome 'openclaw.json') (OpenClaw mcp.servers.argo, env.ARGO_REPO_ROOT pinned)"
948
- Write-OpenClawMcpConfig -OpenClawHome $OpenClawHome -RepoRoot $repoRoot -ArgoServer $argoServer
980
+ Write-OpenClawMcpConfig -OpenClawHome $OpenClawHome -RepoRoot $openClawRepoRoot -ArgoServer $argoServer
949
981
  }
950
982
  }
951
983
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "archgraph-argo",
3
- "version": "0.10.24",
3
+ "version": "0.10.26",
4
4
  "description": "Deploy the ArchGraph ARGO toolchain, skills, and rules (schema, scripts, argo-init skill, global rule) with one command.",
5
5
  "license": "MIT",
6
6
  "bin": {