archgraph-argo 0.10.23 → 0.10.25

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 +169 -45
  2. package/package.json +1 -1
package/install-argo.ps1 CHANGED
@@ -20,6 +20,10 @@ param(
20
20
  [string]$DshHome = "$env:USERPROFILE\.dsh",
21
21
  [string]$DshCwd = '',
22
22
  [string]$DshWorkspaces = '',
23
+ [string]$OpenClawHome = "$env:USERPROFILE\.openclaw",
24
+ [string]$OpenClawWorkspace = "$env:USERPROFILE\.openclaw\workspace",
25
+ [string]$OpenClawRepoRoot = '',
26
+ [switch]$SkipOpenClaw,
23
27
  [string]$McpPath
24
28
  )
25
29
 
@@ -265,47 +269,139 @@ function Get-WakeupGuideline {
265
269
  return $m.Groups[1].Value.Trim()
266
270
  }
267
271
 
268
- function Write-DshAgentRule {
269
- # Merge the frontmatter-stripped ArchGraph rule into ~/.dsh/AGENTS.md,
270
- # replacing the previous ArchGraph block while preserving surrounding user
271
- # content. The rule body is injected verbatim - no adapter prose, so the
272
- # working prompt stays identical to the Copilot / Cursor / OpenCode rules.
272
+ function Write-ArchGraphRuleBlock {
273
+ # Merge the frontmatter-stripped ArchGraph rule into a target AGENTS.md
274
+ # file (DSH home or OpenClaw workspace), replacing the previous ArchGraph
275
+ # block while preserving surrounding user content. The rule body is
276
+ # injected verbatim - no adapter prose - so the working prompt stays
277
+ # identical to the Copilot / Cursor / OpenCode rules.
273
278
  param(
274
- [string]$DshHome,
275
- [string]$RuleText
279
+ [string]$DestPath,
280
+ [string]$RuleText,
281
+ [string]$Label
276
282
  )
277
283
  $ruleContent = Get-MarkdownBody -Content $RuleText
278
- $dest = Join-Path $DshHome 'AGENTS.md'
279
284
  $marker = '<WakeupGuideline>'
280
- New-Item -ItemType Directory -Force -Path $DshHome | Out-Null
281
- if (Test-Path $dest) {
282
- $existing = Get-Content $dest -Raw -Encoding UTF8
285
+ New-Item -ItemType Directory -Force -Path (Split-Path $DestPath) | Out-Null
286
+ if (Test-Path $DestPath) {
287
+ $existing = Get-Content $DestPath -Raw -Encoding UTF8
283
288
  if ($existing -like "*$marker*") {
284
289
  $endTag = '</ToolsGuideline>'
285
290
  $startIdx = $existing.IndexOf($marker)
286
291
  if ($startIdx -lt 0) { $startIdx = 0 }
287
292
  $endIdx = $existing.IndexOf($endTag, $startIdx)
288
293
  $before = $existing.Substring(0, $startIdx).TrimEnd()
289
- if ($endIdx -lt 0) {
290
- $combined = $before
291
- if ($combined.Length -gt 0) { $combined += "`n`n" }
292
- $combined += $ruleContent
293
- } else {
294
- $after = $existing.Substring($endIdx + $endTag.Length)
295
- $combined = $before
296
- if ($combined.Length -gt 0) { $combined += "`n`n" }
297
- $combined += $ruleContent
298
- if ($after.Length -gt 0) { $combined += $after }
299
- }
300
- [System.IO.File]::WriteAllText($dest, $combined, (New-Object System.Text.UTF8Encoding $false))
294
+ $after = ''
295
+ if ($endIdx -ge 0) { $after = $existing.Substring($endIdx + $endTag.Length).TrimStart() }
296
+ $combined = $before
297
+ if ($combined.Length -gt 0) { $combined += "`n`n" }
298
+ $combined += $ruleContent
299
+ if ($after.Length -gt 0) { $combined += "`n`n" + $after }
300
+ [System.IO.File]::WriteAllText($DestPath, $combined, (New-Object System.Text.UTF8Encoding $false))
301
301
  } else {
302
302
  $combined = $existing.TrimEnd() + "`n`n" + $ruleContent
303
- [System.IO.File]::WriteAllText($dest, $combined, (New-Object System.Text.UTF8Encoding $false))
303
+ [System.IO.File]::WriteAllText($DestPath, $combined, (New-Object System.Text.UTF8Encoding $false))
304
304
  }
305
305
  } else {
306
- [System.IO.File]::WriteAllText($dest, $ruleContent, (New-Object System.Text.UTF8Encoding $false))
306
+ [System.IO.File]::WriteAllText($DestPath, $ruleContent, (New-Object System.Text.UTF8Encoding $false))
307
307
  }
308
- Write-Host " DSH rule installed -> $dest"
308
+ Write-Host " $Label installed -> $DestPath"
309
+ }
310
+
311
+ function Write-DshAgentRule {
312
+ # Merge the frontmatter-stripped ArchGraph rule into ~/.dsh/AGENTS.md
313
+ # (DeepSeek Harness user-global rule), replacing the previous ArchGraph
314
+ # block while preserving surrounding user content.
315
+ param(
316
+ [string]$DshHome,
317
+ [string]$RuleText
318
+ )
319
+ Write-ArchGraphRuleBlock -DestPath (Join-Path $DshHome 'AGENTS.md') -RuleText $RuleText -Label 'DSH rule'
320
+ }
321
+
322
+ function Write-OpenClawAgentRule {
323
+ # Deploy the ArchGraph rules into the OpenClaw agent workspace AGENTS.md.
324
+ # OpenClaw injects AGENTS.md into Project Context on every session (the
325
+ # same mechanism as the DSH / OpenCode AGENTS.md rules), so the
326
+ # UNCONDITIONAL STARTUP GATE is always active for OpenClaw agents.
327
+ param(
328
+ [string]$OpenClawWorkspace,
329
+ [string]$RuleText
330
+ )
331
+ Write-ArchGraphRuleBlock -DestPath (Join-Path $OpenClawWorkspace 'AGENTS.md') -RuleText $RuleText -Label 'OpenClaw rule'
332
+ }
333
+
334
+ function Write-OpenClawMcpConfig {
335
+ # Register the argo MCP server under mcp.servers.argo in
336
+ # ~/.openclaw/openclaw.json. OpenClaw is a fixed-workspace host: its
337
+ # embedded MCP client does not advertise MCP roots, so the workspace is
338
+ # pinned explicitly via env.ARGO_REPO_ROOT to the repository root this
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.
346
+ param(
347
+ [string]$OpenClawHome,
348
+ [string]$RepoRoot,
349
+ [string]$ArgoServer
350
+ )
351
+ $configPath = Join-Path $OpenClawHome 'openclaw.json'
352
+ $root = [ordered]@{}
353
+ $existingArgoRoot = ''
354
+ if (Test-Path $configPath) {
355
+ try {
356
+ $existing = Get-Content $configPath -Raw | ConvertFrom-Json
357
+ foreach ($p in $existing.PSObject.Properties) {
358
+ $root[$p.Name] = $p.Value
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
+ }
367
+ } catch {
368
+ Write-Warning " $configPath is not strict JSON (JSON5 with comments?); skipping argo MCP registration."
369
+ Write-Warning " Register manually: openclaw mcp add argo --command node --arg `"$ArgoServer`" --env ARGO_REPO_ROOT=$RepoRoot"
370
+ return
371
+ }
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
+ }
384
+ $mcp = [ordered]@{}
385
+ if ($root.Contains('mcp') -and $null -ne $root['mcp']) {
386
+ foreach ($p in $root['mcp'].PSObject.Properties) { $mcp[$p.Name] = $p.Value }
387
+ }
388
+ $servers = [ordered]@{}
389
+ if ($mcp.Contains('servers') -and $null -ne $mcp['servers']) {
390
+ foreach ($p in $mcp['servers'].PSObject.Properties) { $servers[$p.Name] = $p.Value }
391
+ }
392
+ $argoServerObj = [ordered]@{
393
+ command = 'node'
394
+ args = @($ArgoServer)
395
+ }
396
+ if ($envBlock.Count -gt 0) {
397
+ $argoServerObj.env = $envBlock
398
+ }
399
+ $servers['argo'] = $argoServerObj
400
+ $mcp['servers'] = $servers
401
+ $root['mcp'] = $mcp
402
+ New-Item -ItemType Directory -Force -Path $OpenClawHome | Out-Null
403
+ $json = $root | ConvertTo-Json -Depth 12
404
+ [System.IO.File]::WriteAllText($configPath, $json, (New-Object System.Text.UTF8Encoding $false))
309
405
  }
310
406
 
311
407
  function Write-DshManagedBlock {
@@ -618,63 +714,63 @@ Write-Host '==> Deploying Argo toolchain'
618
714
 
619
715
  $schemaSrc = Join-Path $argoDir 'schema'
620
716
  $schemaDest = Join-Path $ArgoRoot 'schema'
621
- Write-Host "[1/19] argo\schema -> $schemaDest"
717
+ Write-Host "[1/22] argo\schema -> $schemaDest"
622
718
  Copy-Tree -Source $schemaSrc -Destination $schemaDest
623
719
 
624
720
  $scriptsSrc = Join-Path $argoDir 'scripts'
625
721
  $scriptsDest = Join-Path $ArgoRoot 'scripts'
626
- Write-Host "[2/19] argo\scripts -> $scriptsDest"
722
+ Write-Host "[2/22] argo\scripts -> $scriptsDest"
627
723
  Copy-Tree -Source $scriptsSrc -Destination $scriptsDest
628
724
 
629
725
  $defaultsSrc = Join-Path $argoDir 'defaults'
630
726
  $defaultsDest = Join-Path $ArgoRoot 'defaults'
631
- Write-Host "[3/19] argo\defaults -> $defaultsDest"
727
+ Write-Host "[3/22] argo\defaults -> $defaultsDest"
632
728
  Copy-Tree -Source $defaultsSrc -Destination $defaultsDest
633
729
 
634
730
  $skillSrc = Join-Path (Join-Path $argoDir 'skills') 'argo-init'
635
731
  $skillDest = Join-Path $SkillsRoot 'argo-init'
636
- Write-Host "[4/19] argo\skills\argo-init -> $skillDest"
732
+ Write-Host "[4/22] argo\skills\argo-init -> $skillDest"
637
733
  Copy-Tree -Source $skillSrc -Destination $skillDest
638
734
 
639
735
  $ruleSrc = Join-Path (Join-Path $argoDir 'rules') 'archgraph.instructions.md'
640
736
  $ruleDest = Join-Path $PromptsRoot 'archgraph.instructions.md'
641
- Write-Host "[5/19] argo\rules\archgraph.instructions.md -> $ruleDest"
737
+ Write-Host "[5/22] argo\rules\archgraph.instructions.md -> $ruleDest"
642
738
  New-Item -ItemType Directory -Force -Path $PromptsRoot | Out-Null
643
739
  Copy-Item -Force -Path $ruleSrc -Destination $ruleDest
644
740
 
645
741
  $depsSrc = Join-Path $argoDir 'package.json'
646
742
  $depsDest = Join-Path $ArgoRoot 'package.json'
647
- Write-Host "[6/19] argo\package.json -> $depsDest"
743
+ Write-Host "[6/22] argo\package.json -> $depsDest"
648
744
  Copy-Item -Force -Path $depsSrc -Destination $depsDest
649
745
 
650
746
  $cursorSkillDest = Join-Path $CursorSkillsRoot 'argo-init'
651
- Write-Host "[7/19] argo\skills\argo-init -> $cursorSkillDest (Cursor)"
747
+ Write-Host "[7/22] argo\skills\argo-init -> $cursorSkillDest (Cursor)"
652
748
  Copy-Tree -Source $skillSrc -Destination $cursorSkillDest
653
749
 
654
750
  $openCodeSkillDest = Join-Path $OpenCodeSkillsRoot 'argo-init'
655
- Write-Host "[8/19] argo\skills\argo-init -> $openCodeSkillDest (OpenCode)"
751
+ Write-Host "[8/22] argo\skills\argo-init -> $openCodeSkillDest (OpenCode)"
656
752
  Copy-Tree -Source $skillSrc -Destination $openCodeSkillDest
657
753
 
658
- Write-Host "[9/19] argo\rules\archgraph.instructions.md -> $OpenCodeAgentsPath (OpenCode global AGENTS.md)"
754
+ Write-Host "[9/22] argo\rules\archgraph.instructions.md -> $OpenCodeAgentsPath (OpenCode global AGENTS.md)"
659
755
  Add-AgentsRule -AgentsPath $OpenCodeAgentsPath -RulePath $ruleSrc
660
756
 
661
757
  $agentsSrc = Join-Path $argoDir 'agents'
662
- Write-Host "[10/19] argo\agents -> $CopilotAgentsRoot (Copilot user-level)"
758
+ Write-Host "[10/22] argo\agents -> $CopilotAgentsRoot (Copilot user-level)"
663
759
  Copy-Agents -Source $agentsSrc -Destination $CopilotAgentsRoot
664
760
 
665
- Write-Host "[11/19] argo\agents -> $CursorAgentsRoot (Cursor user-level, converted to .md)"
761
+ Write-Host "[11/22] argo\agents -> $CursorAgentsRoot (Cursor user-level, converted to .md)"
666
762
  Copy-Agents -Source $agentsSrc -Destination $CursorAgentsRoot -Target cursor
667
763
 
668
- Write-Host "[12/19] argo\agents -> $OpenCodeAgentsRoot (OpenCode user-level, converted to .md)"
764
+ Write-Host "[12/22] argo\agents -> $OpenCodeAgentsRoot (OpenCode user-level, converted to .md)"
669
765
  Copy-Agents -Source $agentsSrc -Destination $OpenCodeAgentsRoot -Target opencode
670
766
 
671
767
  $pluginsSrc = Join-Path $argoDir 'plugins'
672
- Write-Host "[13/19] argo\plugins -> $PluginsRoot (Argo opencode plugins)"
768
+ Write-Host "[13/22] argo\plugins -> $PluginsRoot (Argo opencode plugins)"
673
769
  Copy-Tree -Source $pluginsSrc -Destination $PluginsRoot
674
770
 
675
771
  $cursorRuleSrc = Join-Path (Join-Path $argoDir 'rules') 'archgraph.instructions.md'
676
772
  $cursorRuleDest = Join-Path $CursorRulesRoot 'archgraph.mdc'
677
- Write-Host "[14/19] argo\rules\archgraph.instructions.md -> $cursorRuleDest (Cursor global rule, alwaysApply)"
773
+ Write-Host "[14/22] argo\rules\archgraph.instructions.md -> $cursorRuleDest (Cursor global rule, alwaysApply)"
678
774
  New-Item -ItemType Directory -Force -Path $CursorRulesRoot | Out-Null
679
775
  Convert-RuleFile -SourceFile $cursorRuleSrc -DestinationFile $cursorRuleDest
680
776
 
@@ -686,16 +782,16 @@ if ($SkipDsh) {
686
782
  $patchPath = Join-Path $DshHome 'cordis.patch.yml'
687
783
  $argoServer = (Join-Path $ArgoRoot 'scripts\argo-mcp-server.js').Replace('\', '/')
688
784
 
689
- Write-Host "[15/19] argo\rules\archgraph.instructions.md -> $DshHome\AGENTS.md (DeepSeek Harness user-global rule, frontmatter stripped)"
785
+ Write-Host "[15/22] argo\rules\archgraph.instructions.md -> $DshHome\AGENTS.md (DeepSeek Harness user-global rule, frontmatter stripped)"
690
786
  Write-DshAgentRule -DshHome $DshHome -RuleText $ruleSrcContent
691
787
 
692
- Write-Host "[16/19] argo\skills\argo-init -> $dshSkillDest (DeepSeek Harness skill)"
788
+ Write-Host "[16/22] argo\skills\argo-init -> $dshSkillDest (DeepSeek Harness skill)"
693
789
  Copy-Tree -Source (Join-Path $argoDir 'skills\argo-init') -Destination $dshSkillDest
694
790
 
695
- Write-Host "[17/19] argo\rules\<WakeupGuideline> -> $DshHome\plugins\dsh-argo-wakeup\index.js (DeepSeek Harness wakeup plugin)"
791
+ Write-Host "[17/22] argo\rules\<WakeupGuideline> -> $DshHome\plugins\dsh-argo-wakeup\index.js (DeepSeek Harness wakeup plugin)"
696
792
  $wakeupDshPath = New-DshWakeupPlugin -DshHome $DshHome -RuleText $ruleSrcContent
697
793
 
698
- Write-Host "[18/19] argo-workspace + argo-wakeup rows -> $patchPath (DeepSeek Harness MCP bridge + wakeup plugin)"
794
+ Write-Host "[18/22] argo-workspace + argo-wakeup rows -> $patchPath (DeepSeek Harness MCP bridge + wakeup plugin)"
699
795
  # The generated dsh-argo-workspace bridge connects directly to the argo
700
796
  # server (no dsh-mcp-client row), registers every tool as mcp__argo__* and
701
797
  # injects the current session's workspace (SessionHeader.cwd) as the
@@ -726,7 +822,7 @@ if ($SkipDsh) {
726
822
  Write-DshManagedBlock -Path $patchPath -Block $block -MarkerStart '# BEGIN ArchGraph ARGO deployment' -MarkerEnd '# END ArchGraph ARGO deployment'
727
823
  }
728
824
 
729
- Write-Host "[19/19] 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)"
730
826
  New-DshAgentPresets -DshHome $DshHome -AgentsSrc (Join-Path $argoDir 'agents')
731
827
 
732
828
  Write-Host ' Restart `dsh web` to activate the MCP bridge and the wakeup plugin;'
@@ -736,6 +832,25 @@ if ($SkipDsh) {
736
832
  Write-Host ' the injected workspaceRoot unconditionally).'
737
833
  }
738
834
 
835
+ if ($SkipOpenClaw) {
836
+ Write-Host 'Skipped OpenClaw integration (-SkipOpenClaw).'
837
+ } else {
838
+ $ruleSrcContent = Get-Content $ruleSrc -Raw -Encoding UTF8
839
+ $openClawSkillDest = Join-Path $OpenClawHome 'skills\argo-init'
840
+ $openClawAgentsDest = Join-Path $OpenClawWorkspace 'AGENTS.md'
841
+
842
+ Write-Host '==> Deploying OpenClaw integration'
843
+ Write-Host "[20/22] argo\rules\archgraph.instructions.md -> $openClawAgentsDest (OpenClaw workspace AGENTS.md, frontmatter stripped)"
844
+ Write-OpenClawAgentRule -OpenClawWorkspace $OpenClawWorkspace -RuleText $ruleSrcContent
845
+
846
+ Write-Host "[21/22] argo\skills\argo-init -> $openClawSkillDest (OpenClaw managed skill, all agents)"
847
+ Copy-Tree -Source (Join-Path $argoDir 'skills\argo-init') -Destination $openClawSkillDest
848
+
849
+ Write-Host ' OpenClaw injects AGENTS.md into Project Context on every session, so the wakeup'
850
+ Write-Host ' gate (UNCONDITIONAL STARTUP GATE) is active on the next OpenClaw session; restart'
851
+ Write-Host ' the OpenClaw gateway (openclaw gateway restart) if it is already running.'
852
+ }
853
+
739
854
  if ($SkipDeps) {
740
855
  Write-Host 'Skipped dependency install (-SkipDeps).'
741
856
  } elseif (Get-Command npm -ErrorAction SilentlyContinue) {
@@ -855,6 +970,15 @@ if ($SkipMcp) {
855
970
  enabled = $true
856
971
  })
857
972
  Write-Host "argo MCP config written -> $OpenCodeConfigPath"
973
+
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 }
979
+ Write-Host "[22/22] argo MCP server -> $(Join-Path $OpenClawHome 'openclaw.json') (OpenClaw mcp.servers.argo, env.ARGO_REPO_ROOT pinned)"
980
+ Write-OpenClawMcpConfig -OpenClawHome $OpenClawHome -RepoRoot $openClawRepoRoot -ArgoServer $argoServer
981
+ }
858
982
  }
859
983
 
860
984
  $wakeupPluginPath = Join-Path $PluginsRoot 'argo-wakeup.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "archgraph-argo",
3
- "version": "0.10.23",
3
+ "version": "0.10.25",
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": {