patchwork-os 0.2.0-beta.3 → 0.2.0-beta.5
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/README.md +95 -25
- package/dist/activityLog.js +2 -1
- package/dist/activityLog.js.map +1 -1
- package/dist/approvalHttp.js +25 -8
- package/dist/approvalHttp.js.map +1 -1
- package/dist/approvalQueue.d.ts +44 -1
- package/dist/approvalQueue.js +117 -0
- package/dist/approvalQueue.js.map +1 -1
- package/dist/automation.d.ts +3 -3
- package/dist/automation.js +12 -5
- package/dist/automation.js.map +1 -1
- package/dist/bridge.js +29 -1
- package/dist/bridge.js.map +1 -1
- package/dist/bridgeLockDiscovery.js +2 -1
- package/dist/bridgeLockDiscovery.js.map +1 -1
- package/dist/claudeOrchestrator.js +27 -10
- package/dist/claudeOrchestrator.js.map +1 -1
- package/dist/commands/dashboard.js +8 -1
- package/dist/commands/dashboard.js.map +1 -1
- package/dist/commands/install.js +3 -0
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/patchworkInit.js +4 -1
- package/dist/commands/patchworkInit.js.map +1 -1
- package/dist/commitIssueLinkLog.d.ts +16 -0
- package/dist/commitIssueLinkLog.js +87 -4
- package/dist/commitIssueLinkLog.js.map +1 -1
- package/dist/config.d.ts +20 -1
- package/dist/config.js +42 -4
- package/dist/config.js.map +1 -1
- package/dist/connectorRoutes.js +1 -1
- package/dist/connectorRoutes.js.map +1 -1
- package/dist/connectors/asana.js +4 -3
- package/dist/connectors/asana.js.map +1 -1
- package/dist/connectors/confluence.js +35 -0
- package/dist/connectors/confluence.js.map +1 -1
- package/dist/connectors/datadog.js +33 -4
- package/dist/connectors/datadog.js.map +1 -1
- package/dist/connectors/discord.js +5 -4
- package/dist/connectors/discord.js.map +1 -1
- package/dist/connectors/gitlab.js +7 -1
- package/dist/connectors/gitlab.js.map +1 -1
- package/dist/connectors/mcpOAuth.js +71 -6
- package/dist/connectors/mcpOAuth.js.map +1 -1
- package/dist/connectors/slack.d.ts +1 -1
- package/dist/connectors/slack.js +56 -4
- package/dist/connectors/slack.js.map +1 -1
- package/dist/connectors/tokenStorage.js +10 -4
- package/dist/connectors/tokenStorage.js.map +1 -1
- package/dist/decisionTraceLog.d.ts +28 -0
- package/dist/decisionTraceLog.js +115 -7
- package/dist/decisionTraceLog.js.map +1 -1
- package/dist/drivers/claude/subprocess.js +22 -3
- package/dist/drivers/claude/subprocess.js.map +1 -1
- package/dist/drivers/gemini/index.js +19 -3
- package/dist/drivers/gemini/index.js.map +1 -1
- package/dist/extensionClient.d.ts +29 -4
- package/dist/extensionClient.js +26 -11
- package/dist/extensionClient.js.map +1 -1
- package/dist/featureFlags.js +18 -32
- package/dist/featureFlags.js.map +1 -1
- package/dist/fileLockSync.d.ts +67 -0
- package/dist/fileLockSync.js +126 -0
- package/dist/fileLockSync.js.map +1 -0
- package/dist/fp/automationInterpreter.d.ts +6 -0
- package/dist/fp/automationInterpreter.js +15 -2
- package/dist/fp/automationInterpreter.js.map +1 -1
- package/dist/fp/automationState.d.ts +1 -1
- package/dist/fp/automationState.js +10 -0
- package/dist/fp/automationState.js.map +1 -1
- package/dist/fp/commandDescription.js +7 -1
- package/dist/fp/commandDescription.js.map +1 -1
- package/dist/fsWatchWithFallback.d.ts +36 -0
- package/dist/fsWatchWithFallback.js +127 -0
- package/dist/fsWatchWithFallback.js.map +1 -0
- package/dist/index.js +108 -48
- package/dist/index.js.map +1 -1
- package/dist/installGuard.js +6 -2
- package/dist/installGuard.js.map +1 -1
- package/dist/lockfile.js +27 -3
- package/dist/lockfile.js.map +1 -1
- package/dist/patchworkConfig.js +8 -3
- package/dist/patchworkConfig.js.map +1 -1
- package/dist/pluginLoader.js +10 -1
- package/dist/pluginLoader.js.map +1 -1
- package/dist/pluginWatcher.js +6 -13
- package/dist/pluginWatcher.js.map +1 -1
- package/dist/preToolUseHook.js +3 -2
- package/dist/preToolUseHook.js.map +1 -1
- package/dist/processTree.d.ts +34 -0
- package/dist/processTree.js +105 -0
- package/dist/processTree.js.map +1 -0
- package/dist/prompts.js +3 -3
- package/dist/prompts.js.map +1 -1
- package/dist/recipeOrchestration.js +58 -8
- package/dist/recipeOrchestration.js.map +1 -1
- package/dist/recipeRoutes.d.ts +1 -0
- package/dist/recipeRoutes.js +100 -15
- package/dist/recipeRoutes.js.map +1 -1
- package/dist/recipes/connectorPreflight.js +64 -0
- package/dist/recipes/connectorPreflight.js.map +1 -1
- package/dist/recipes/idempotencyKey.js +3 -4
- package/dist/recipes/idempotencyKey.js.map +1 -1
- package/dist/recipes/installer.js +48 -2
- package/dist/recipes/installer.js.map +1 -1
- package/dist/recipes/parser.js +82 -4
- package/dist/recipes/parser.js.map +1 -1
- package/dist/recipes/scheduler.d.ts +17 -0
- package/dist/recipes/scheduler.js +33 -1
- package/dist/recipes/scheduler.js.map +1 -1
- package/dist/recipes/yamlRunner.d.ts +4 -1
- package/dist/recipes/yamlRunner.js +18 -6
- package/dist/recipes/yamlRunner.js.map +1 -1
- package/dist/resources.js +21 -13
- package/dist/resources.js.map +1 -1
- package/dist/runLog.js +14 -3
- package/dist/runLog.js.map +1 -1
- package/dist/sanitizeParsedJson.d.ts +39 -0
- package/dist/sanitizeParsedJson.js +55 -0
- package/dist/sanitizeParsedJson.js.map +1 -0
- package/dist/server.d.ts +14 -0
- package/dist/server.js +105 -33
- package/dist/server.js.map +1 -1
- package/dist/sessionCheckpoint.d.ts +8 -0
- package/dist/sessionCheckpoint.js +18 -2
- package/dist/sessionCheckpoint.js.map +1 -1
- package/dist/tools/detectUnusedCode.js +9 -7
- package/dist/tools/detectUnusedCode.js.map +1 -1
- package/dist/tools/editText.js +2 -1
- package/dist/tools/editText.js.map +1 -1
- package/dist/tools/fileOperations.js +2 -1
- package/dist/tools/fileOperations.js.map +1 -1
- package/dist/tools/fileWatcher.js +8 -2
- package/dist/tools/fileWatcher.js.map +1 -1
- package/dist/tools/fixAllLintErrors.js +10 -5
- package/dist/tools/fixAllLintErrors.js.map +1 -1
- package/dist/tools/formatDocument.js +10 -5
- package/dist/tools/formatDocument.js.map +1 -1
- package/dist/tools/handoffNote.js +2 -1
- package/dist/tools/handoffNote.js.map +1 -1
- package/dist/tools/headless/lspClient.js +3 -0
- package/dist/tools/headless/lspClient.js.map +1 -1
- package/dist/tools/index.js +0 -6
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/lsp.js +17 -0
- package/dist/tools/lsp.js.map +1 -1
- package/dist/tools/openDiff.js +4 -1
- package/dist/tools/openDiff.js.map +1 -1
- package/dist/tools/openFile.js +4 -1
- package/dist/tools/openFile.js.map +1 -1
- package/dist/tools/organizeImports.js +5 -3
- package/dist/tools/organizeImports.js.map +1 -1
- package/dist/tools/previewEdit.js +7 -2
- package/dist/tools/previewEdit.js.map +1 -1
- package/dist/tools/refactorExtractFunction.js +4 -1
- package/dist/tools/refactorExtractFunction.js.map +1 -1
- package/dist/tools/refactorPreview.js +10 -2
- package/dist/tools/refactorPreview.js.map +1 -1
- package/dist/tools/replaceBlock.js +2 -1
- package/dist/tools/replaceBlock.js.map +1 -1
- package/dist/tools/searchAndReplace.js +2 -1
- package/dist/tools/searchAndReplace.js.map +1 -1
- package/dist/tools/spawnWorkspace.js +15 -7
- package/dist/tools/spawnWorkspace.js.map +1 -1
- package/dist/tools/transaction.js +4 -1
- package/dist/tools/transaction.js.map +1 -1
- package/dist/tools/utils.js +62 -5
- package/dist/tools/utils.js.map +1 -1
- package/dist/transport.d.ts +1 -1
- package/dist/transport.js +18 -4
- package/dist/transport.js.map +1 -1
- package/dist/winShim.d.ts +34 -0
- package/dist/winShim.js +94 -0
- package/dist/winShim.js.map +1 -0
- package/dist/writeFileAtomic.d.ts +23 -0
- package/dist/writeFileAtomic.js +94 -0
- package/dist/writeFileAtomic.js.map +1 -0
- package/package.json +1 -1
- package/scripts/postinstall.mjs +18 -5
- package/scripts/smoke/run-all.mjs +55 -4
- package/scripts/start-all.mjs +60 -1
- package/scripts/start-all.ps1 +209 -209
- package/scripts/start-orchestrator.ps1 +158 -158
- package/dist/tools/ccRoutines.d.ts +0 -221
- package/dist/tools/ccRoutines.js +0 -264
- package/dist/tools/ccRoutines.js.map +0 -1
|
@@ -1,158 +1,158 @@
|
|
|
1
|
-
#Requires -Version 5.1
|
|
2
|
-
<#
|
|
3
|
-
.SYNOPSIS
|
|
4
|
-
Windows orchestrator launcher — bridges multiple IDE windows simultaneously.
|
|
5
|
-
|
|
6
|
-
.DESCRIPTION
|
|
7
|
-
Starts the meta-bridge that coordinates multiple IDE windows. Each IDE window
|
|
8
|
-
must already have the claude-ide-bridge extension running — this script
|
|
9
|
-
connects to them all via the orchestrator mode.
|
|
10
|
-
|
|
11
|
-
Run via npm:
|
|
12
|
-
npm run start-orchestrator:win
|
|
13
|
-
|
|
14
|
-
Or directly:
|
|
15
|
-
pwsh -File scripts\start-orchestrator.ps1
|
|
16
|
-
pwsh -File scripts\start-orchestrator.ps1 -Port 4746 -Verbose
|
|
17
|
-
|
|
18
|
-
.PARAMETER Port
|
|
19
|
-
Orchestrator port (default: 4746).
|
|
20
|
-
|
|
21
|
-
.PARAMETER Notify
|
|
22
|
-
ntfy.sh topic for push notifications (optional).
|
|
23
|
-
|
|
24
|
-
.PARAMETER Verbose
|
|
25
|
-
Enable verbose orchestrator logging.
|
|
26
|
-
#>
|
|
27
|
-
[CmdletBinding()]
|
|
28
|
-
param(
|
|
29
|
-
[int] $Port = 4746,
|
|
30
|
-
[string]$Notify = "",
|
|
31
|
-
[switch]$VerboseLogging
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
Set-StrictMode -Version Latest
|
|
35
|
-
$ErrorActionPreference = "Stop"
|
|
36
|
-
|
|
37
|
-
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
38
|
-
$BridgeDir = Split-Path -Parent $ScriptDir
|
|
39
|
-
|
|
40
|
-
function Write-Status($msg) { Write-Host "[orchestrator] $msg" -ForegroundColor Cyan }
|
|
41
|
-
function Write-Ok($msg) { Write-Host "[ok] $msg" -ForegroundColor Green }
|
|
42
|
-
function Write-Warn($msg) { Write-Host "[warn] $msg" -ForegroundColor Yellow }
|
|
43
|
-
|
|
44
|
-
function Send-Notify($msg) {
|
|
45
|
-
if (-not $Notify) { return }
|
|
46
|
-
try {
|
|
47
|
-
Invoke-RestMethod -Uri "https://ntfy.sh/$Notify" -Method Post -Body $msg -TimeoutSec 5 | Out-Null
|
|
48
|
-
} catch { Write-Warn "ntfy notification failed: $_" }
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
$Jobs = [System.Collections.Generic.List[System.Diagnostics.Process]]::new()
|
|
52
|
-
|
|
53
|
-
function Stop-AllJobs {
|
|
54
|
-
foreach ($p in $Jobs) {
|
|
55
|
-
if (-not $p.HasExited) { try { $p.Kill($true) } catch { } }
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
$null = Register-EngineEvent -SourceIdentifier PowerShell.Exiting -Action { Stop-AllJobs }
|
|
60
|
-
|
|
61
|
-
# ── Dependency check ──────────────────────────────────────────────────────────
|
|
62
|
-
$claudeFound = $false
|
|
63
|
-
try {
|
|
64
|
-
$null = & where.exe claude 2>$null
|
|
65
|
-
$claudeFound = $true
|
|
66
|
-
} catch { }
|
|
67
|
-
|
|
68
|
-
if (-not $claudeFound) {
|
|
69
|
-
Write-Error "claude CLI not found on PATH. Install from https://docs.anthropic.com/en/docs/claude-code"
|
|
70
|
-
exit 1
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
# ── Build orchestrator args ───────────────────────────────────────────────────
|
|
74
|
-
$orchArgs = @("orchestrator", "--port", $Port)
|
|
75
|
-
if ($VerboseLogging) { $orchArgs += "--verbose" }
|
|
76
|
-
|
|
77
|
-
# Use dist/ (npm install) or fallback message
|
|
78
|
-
$distIndex = Join-Path $BridgeDir "dist\index.js"
|
|
79
|
-
if (-not (Test-Path $distIndex)) {
|
|
80
|
-
Write-Error "dist/index.js not found. Run 'npm run build' first."
|
|
81
|
-
exit 1
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
# ── Start orchestrator bridge ─────────────────────────────────────────────────
|
|
85
|
-
Write-Status "Starting orchestrator bridge on port $Port..."
|
|
86
|
-
|
|
87
|
-
$orchInfo = New-Object System.Diagnostics.ProcessStartInfo
|
|
88
|
-
$orchInfo.FileName = "cmd.exe"
|
|
89
|
-
$orchInfo.Arguments = "/c node `"$distIndex`" " + ($orchArgs -join " ")
|
|
90
|
-
$orchInfo.UseShellExecute = $false
|
|
91
|
-
$orchInfo.WorkingDirectory = $BridgeDir
|
|
92
|
-
$orchProc = [System.Diagnostics.Process]::Start($orchInfo)
|
|
93
|
-
$Jobs.Add($orchProc)
|
|
94
|
-
|
|
95
|
-
# ── Wait for lock file ────────────────────────────────────────────────────────
|
|
96
|
-
$ClaudeBase = if ($env:CLAUDE_CONFIG_DIR) { $env:CLAUDE_CONFIG_DIR } else { Join-Path $env:USERPROFILE ".claude" }
|
|
97
|
-
$IdeDir = Join-Path $ClaudeBase "ide"
|
|
98
|
-
$LockFile = Join-Path $IdeDir "$Port.lock"
|
|
99
|
-
$Deadline = (Get-Date).AddSeconds(20)
|
|
100
|
-
|
|
101
|
-
Write-Status "Waiting for orchestrator lock file..."
|
|
102
|
-
while ((Get-Date) -lt $Deadline -and -not (Test-Path $LockFile)) {
|
|
103
|
-
Start-Sleep -Milliseconds 200
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (-not (Test-Path $LockFile)) {
|
|
107
|
-
Write-Error "Orchestrator lock file not written after 20s. Bridge may have failed to start."
|
|
108
|
-
Stop-AllJobs
|
|
109
|
-
exit 1
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
try {
|
|
113
|
-
$lockContent = Get-Content $LockFile -Raw | ConvertFrom-Json
|
|
114
|
-
$token = $lockContent.authToken
|
|
115
|
-
} catch {
|
|
116
|
-
$token = "(unknown)"
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
Write-Ok "Orchestrator ready on port $Port"
|
|
120
|
-
Send-Notify "Orchestrator started on port $Port"
|
|
121
|
-
|
|
122
|
-
# ── Start Claude --ide ────────────────────────────────────────────────────────
|
|
123
|
-
Write-Status "Starting claude --ide (connects to orchestrator)..."
|
|
124
|
-
|
|
125
|
-
$claudeEnv = [System.Collections.Generic.Dictionary[string,string]]::new()
|
|
126
|
-
foreach ($entry in [System.Environment]::GetEnvironmentVariables().GetEnumerator()) {
|
|
127
|
-
$claudeEnv[$entry.Key] = $entry.Value
|
|
128
|
-
}
|
|
129
|
-
$claudeEnv["CLAUDE_CODE_IDE_SKIP_VALID_CHECK"] = "true"
|
|
130
|
-
|
|
131
|
-
$claudeInfo = New-Object System.Diagnostics.ProcessStartInfo
|
|
132
|
-
$claudeInfo.FileName = "cmd.exe"
|
|
133
|
-
$claudeInfo.Arguments = "/c claude --ide"
|
|
134
|
-
$claudeInfo.UseShellExecute = $false
|
|
135
|
-
foreach ($kv in $claudeEnv.GetEnumerator()) {
|
|
136
|
-
$claudeInfo.EnvironmentVariables[$kv.Key] = $kv.Value
|
|
137
|
-
}
|
|
138
|
-
$claudeProc = [System.Diagnostics.Process]::Start($claudeInfo)
|
|
139
|
-
$Jobs.Add($claudeProc)
|
|
140
|
-
|
|
141
|
-
# ── Summary ───────────────────────────────────────────────────────────────────
|
|
142
|
-
Write-Host ""
|
|
143
|
-
Write-Ok "Orchestrator running. Press Ctrl+C to stop all processes."
|
|
144
|
-
Write-Host " Orchestrator PID : $($orchProc.Id)"
|
|
145
|
-
Write-Host " Claude PID : $($claudeProc.Id)"
|
|
146
|
-
Write-Host " Port : $Port"
|
|
147
|
-
Write-Host " Token : $($token.Substring(0, [Math]::Min(8, $token.Length)))..."
|
|
148
|
-
Write-Host ""
|
|
149
|
-
Write-Host "Each IDE window with the bridge extension running will be discovered"
|
|
150
|
-
Write-Host "automatically. Type /ide in Claude Code to verify the connection."
|
|
151
|
-
Write-Host ""
|
|
152
|
-
|
|
153
|
-
try {
|
|
154
|
-
$orchProc.WaitForExit()
|
|
155
|
-
} finally {
|
|
156
|
-
Write-Status "Orchestrator exited — stopping all processes..."
|
|
157
|
-
Stop-AllJobs
|
|
158
|
-
}
|
|
1
|
+
#Requires -Version 5.1
|
|
2
|
+
<#
|
|
3
|
+
.SYNOPSIS
|
|
4
|
+
Windows orchestrator launcher — bridges multiple IDE windows simultaneously.
|
|
5
|
+
|
|
6
|
+
.DESCRIPTION
|
|
7
|
+
Starts the meta-bridge that coordinates multiple IDE windows. Each IDE window
|
|
8
|
+
must already have the claude-ide-bridge extension running — this script
|
|
9
|
+
connects to them all via the orchestrator mode.
|
|
10
|
+
|
|
11
|
+
Run via npm:
|
|
12
|
+
npm run start-orchestrator:win
|
|
13
|
+
|
|
14
|
+
Or directly:
|
|
15
|
+
pwsh -File scripts\start-orchestrator.ps1
|
|
16
|
+
pwsh -File scripts\start-orchestrator.ps1 -Port 4746 -Verbose
|
|
17
|
+
|
|
18
|
+
.PARAMETER Port
|
|
19
|
+
Orchestrator port (default: 4746).
|
|
20
|
+
|
|
21
|
+
.PARAMETER Notify
|
|
22
|
+
ntfy.sh topic for push notifications (optional).
|
|
23
|
+
|
|
24
|
+
.PARAMETER Verbose
|
|
25
|
+
Enable verbose orchestrator logging.
|
|
26
|
+
#>
|
|
27
|
+
[CmdletBinding()]
|
|
28
|
+
param(
|
|
29
|
+
[int] $Port = 4746,
|
|
30
|
+
[string]$Notify = "",
|
|
31
|
+
[switch]$VerboseLogging
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
Set-StrictMode -Version Latest
|
|
35
|
+
$ErrorActionPreference = "Stop"
|
|
36
|
+
|
|
37
|
+
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
38
|
+
$BridgeDir = Split-Path -Parent $ScriptDir
|
|
39
|
+
|
|
40
|
+
function Write-Status($msg) { Write-Host "[orchestrator] $msg" -ForegroundColor Cyan }
|
|
41
|
+
function Write-Ok($msg) { Write-Host "[ok] $msg" -ForegroundColor Green }
|
|
42
|
+
function Write-Warn($msg) { Write-Host "[warn] $msg" -ForegroundColor Yellow }
|
|
43
|
+
|
|
44
|
+
function Send-Notify($msg) {
|
|
45
|
+
if (-not $Notify) { return }
|
|
46
|
+
try {
|
|
47
|
+
Invoke-RestMethod -Uri "https://ntfy.sh/$Notify" -Method Post -Body $msg -TimeoutSec 5 | Out-Null
|
|
48
|
+
} catch { Write-Warn "ntfy notification failed: $_" }
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
$Jobs = [System.Collections.Generic.List[System.Diagnostics.Process]]::new()
|
|
52
|
+
|
|
53
|
+
function Stop-AllJobs {
|
|
54
|
+
foreach ($p in $Jobs) {
|
|
55
|
+
if (-not $p.HasExited) { try { $p.Kill($true) } catch { } }
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
$null = Register-EngineEvent -SourceIdentifier PowerShell.Exiting -Action { Stop-AllJobs }
|
|
60
|
+
|
|
61
|
+
# ── Dependency check ──────────────────────────────────────────────────────────
|
|
62
|
+
$claudeFound = $false
|
|
63
|
+
try {
|
|
64
|
+
$null = & where.exe claude 2>$null
|
|
65
|
+
$claudeFound = $true
|
|
66
|
+
} catch { }
|
|
67
|
+
|
|
68
|
+
if (-not $claudeFound) {
|
|
69
|
+
Write-Error "claude CLI not found on PATH. Install from https://docs.anthropic.com/en/docs/claude-code"
|
|
70
|
+
exit 1
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
# ── Build orchestrator args ───────────────────────────────────────────────────
|
|
74
|
+
$orchArgs = @("orchestrator", "--port", $Port)
|
|
75
|
+
if ($VerboseLogging) { $orchArgs += "--verbose" }
|
|
76
|
+
|
|
77
|
+
# Use dist/ (npm install) or fallback message
|
|
78
|
+
$distIndex = Join-Path $BridgeDir "dist\index.js"
|
|
79
|
+
if (-not (Test-Path $distIndex)) {
|
|
80
|
+
Write-Error "dist/index.js not found. Run 'npm run build' first."
|
|
81
|
+
exit 1
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
# ── Start orchestrator bridge ─────────────────────────────────────────────────
|
|
85
|
+
Write-Status "Starting orchestrator bridge on port $Port..."
|
|
86
|
+
|
|
87
|
+
$orchInfo = New-Object System.Diagnostics.ProcessStartInfo
|
|
88
|
+
$orchInfo.FileName = "cmd.exe"
|
|
89
|
+
$orchInfo.Arguments = "/c node `"$distIndex`" " + ($orchArgs -join " ")
|
|
90
|
+
$orchInfo.UseShellExecute = $false
|
|
91
|
+
$orchInfo.WorkingDirectory = $BridgeDir
|
|
92
|
+
$orchProc = [System.Diagnostics.Process]::Start($orchInfo)
|
|
93
|
+
$Jobs.Add($orchProc)
|
|
94
|
+
|
|
95
|
+
# ── Wait for lock file ────────────────────────────────────────────────────────
|
|
96
|
+
$ClaudeBase = if ($env:CLAUDE_CONFIG_DIR) { $env:CLAUDE_CONFIG_DIR } else { Join-Path $env:USERPROFILE ".claude" }
|
|
97
|
+
$IdeDir = Join-Path $ClaudeBase "ide"
|
|
98
|
+
$LockFile = Join-Path $IdeDir "$Port.lock"
|
|
99
|
+
$Deadline = (Get-Date).AddSeconds(20)
|
|
100
|
+
|
|
101
|
+
Write-Status "Waiting for orchestrator lock file..."
|
|
102
|
+
while ((Get-Date) -lt $Deadline -and -not (Test-Path $LockFile)) {
|
|
103
|
+
Start-Sleep -Milliseconds 200
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (-not (Test-Path $LockFile)) {
|
|
107
|
+
Write-Error "Orchestrator lock file not written after 20s. Bridge may have failed to start."
|
|
108
|
+
Stop-AllJobs
|
|
109
|
+
exit 1
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
try {
|
|
113
|
+
$lockContent = Get-Content $LockFile -Raw | ConvertFrom-Json
|
|
114
|
+
$token = $lockContent.authToken
|
|
115
|
+
} catch {
|
|
116
|
+
$token = "(unknown)"
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
Write-Ok "Orchestrator ready on port $Port"
|
|
120
|
+
Send-Notify "Orchestrator started on port $Port"
|
|
121
|
+
|
|
122
|
+
# ── Start Claude --ide ────────────────────────────────────────────────────────
|
|
123
|
+
Write-Status "Starting claude --ide (connects to orchestrator)..."
|
|
124
|
+
|
|
125
|
+
$claudeEnv = [System.Collections.Generic.Dictionary[string,string]]::new()
|
|
126
|
+
foreach ($entry in [System.Environment]::GetEnvironmentVariables().GetEnumerator()) {
|
|
127
|
+
$claudeEnv[$entry.Key] = $entry.Value
|
|
128
|
+
}
|
|
129
|
+
$claudeEnv["CLAUDE_CODE_IDE_SKIP_VALID_CHECK"] = "true"
|
|
130
|
+
|
|
131
|
+
$claudeInfo = New-Object System.Diagnostics.ProcessStartInfo
|
|
132
|
+
$claudeInfo.FileName = "cmd.exe"
|
|
133
|
+
$claudeInfo.Arguments = "/c claude --ide"
|
|
134
|
+
$claudeInfo.UseShellExecute = $false
|
|
135
|
+
foreach ($kv in $claudeEnv.GetEnumerator()) {
|
|
136
|
+
$claudeInfo.EnvironmentVariables[$kv.Key] = $kv.Value
|
|
137
|
+
}
|
|
138
|
+
$claudeProc = [System.Diagnostics.Process]::Start($claudeInfo)
|
|
139
|
+
$Jobs.Add($claudeProc)
|
|
140
|
+
|
|
141
|
+
# ── Summary ───────────────────────────────────────────────────────────────────
|
|
142
|
+
Write-Host ""
|
|
143
|
+
Write-Ok "Orchestrator running. Press Ctrl+C to stop all processes."
|
|
144
|
+
Write-Host " Orchestrator PID : $($orchProc.Id)"
|
|
145
|
+
Write-Host " Claude PID : $($claudeProc.Id)"
|
|
146
|
+
Write-Host " Port : $Port"
|
|
147
|
+
Write-Host " Token : $($token.Substring(0, [Math]::Min(8, $token.Length)))..."
|
|
148
|
+
Write-Host ""
|
|
149
|
+
Write-Host "Each IDE window with the bridge extension running will be discovered"
|
|
150
|
+
Write-Host "automatically. Type /ide in Claude Code to verify the connection."
|
|
151
|
+
Write-Host ""
|
|
152
|
+
|
|
153
|
+
try {
|
|
154
|
+
$orchProc.WaitForExit()
|
|
155
|
+
} finally {
|
|
156
|
+
Write-Status "Orchestrator exited — stopping all processes..."
|
|
157
|
+
Stop-AllJobs
|
|
158
|
+
}
|
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CC Routines Phase 3 — thin MCP tools for Claude Code Routines API.
|
|
3
|
-
*
|
|
4
|
-
* The `claude routines` subcommand is part of a research preview
|
|
5
|
-
* (API identifier: experimental-cc-routine-2026-04-01) gated on
|
|
6
|
-
* claude.ai accounts. These tools are registered unconditionally so
|
|
7
|
-
* they appear in the MCP handshake and fail gracefully when the API
|
|
8
|
-
* is not yet available on the host account.
|
|
9
|
-
*
|
|
10
|
-
* TODO: ungate when API exits research preview
|
|
11
|
-
*/
|
|
12
|
-
export type RoutinesExecutor = (binary: string, args: string[]) => Promise<{
|
|
13
|
-
stdout: string;
|
|
14
|
-
}>;
|
|
15
|
-
/** Default executor using node:child_process execFile. */
|
|
16
|
-
export declare const defaultExecutor: RoutinesExecutor;
|
|
17
|
-
export declare function createListRoutinesTool(claudeBinary?: string, executor?: RoutinesExecutor): {
|
|
18
|
-
schema: {
|
|
19
|
-
name: string;
|
|
20
|
-
description: string;
|
|
21
|
-
annotations: {
|
|
22
|
-
title: string;
|
|
23
|
-
readOnlyHint: boolean;
|
|
24
|
-
destructiveHint: boolean;
|
|
25
|
-
openWorldHint: boolean;
|
|
26
|
-
};
|
|
27
|
-
inputSchema: {
|
|
28
|
-
type: "object";
|
|
29
|
-
properties: {};
|
|
30
|
-
additionalProperties: false;
|
|
31
|
-
};
|
|
32
|
-
outputSchema: {
|
|
33
|
-
type: string;
|
|
34
|
-
properties: {
|
|
35
|
-
routines: {
|
|
36
|
-
type: string;
|
|
37
|
-
items: {
|
|
38
|
-
type: string;
|
|
39
|
-
properties: {
|
|
40
|
-
id: {
|
|
41
|
-
type: string;
|
|
42
|
-
};
|
|
43
|
-
name: {
|
|
44
|
-
type: string;
|
|
45
|
-
};
|
|
46
|
-
schedule: {
|
|
47
|
-
type: string;
|
|
48
|
-
};
|
|
49
|
-
lastRun: {
|
|
50
|
-
type: string;
|
|
51
|
-
};
|
|
52
|
-
status: {
|
|
53
|
-
type: string;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
required: string[];
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
error: {
|
|
60
|
-
type: string;
|
|
61
|
-
};
|
|
62
|
-
message: {
|
|
63
|
-
type: string;
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
handler: (_args: Record<string, unknown>) => Promise<{
|
|
69
|
-
content: Array<{
|
|
70
|
-
type: string;
|
|
71
|
-
text: string;
|
|
72
|
-
}>;
|
|
73
|
-
structuredContent: unknown;
|
|
74
|
-
isError?: undefined;
|
|
75
|
-
} | {
|
|
76
|
-
content: Array<{
|
|
77
|
-
type: string;
|
|
78
|
-
text: string;
|
|
79
|
-
}>;
|
|
80
|
-
isError: true;
|
|
81
|
-
} | {
|
|
82
|
-
content: {
|
|
83
|
-
type: "text";
|
|
84
|
-
text: string;
|
|
85
|
-
}[];
|
|
86
|
-
isError: boolean;
|
|
87
|
-
}>;
|
|
88
|
-
};
|
|
89
|
-
export declare function createRunRoutineTool(claudeBinary?: string, executor?: RoutinesExecutor): {
|
|
90
|
-
schema: {
|
|
91
|
-
name: string;
|
|
92
|
-
description: string;
|
|
93
|
-
annotations: {
|
|
94
|
-
title: string;
|
|
95
|
-
readOnlyHint: boolean;
|
|
96
|
-
destructiveHint: boolean;
|
|
97
|
-
openWorldHint: boolean;
|
|
98
|
-
};
|
|
99
|
-
inputSchema: {
|
|
100
|
-
type: "object";
|
|
101
|
-
properties: {
|
|
102
|
-
id: {
|
|
103
|
-
type: string;
|
|
104
|
-
description: string;
|
|
105
|
-
};
|
|
106
|
-
input: {
|
|
107
|
-
type: string;
|
|
108
|
-
description: string;
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
required: readonly ["id"];
|
|
112
|
-
additionalProperties: false;
|
|
113
|
-
};
|
|
114
|
-
outputSchema: {
|
|
115
|
-
type: string;
|
|
116
|
-
properties: {
|
|
117
|
-
taskId: {
|
|
118
|
-
type: string;
|
|
119
|
-
};
|
|
120
|
-
status: {
|
|
121
|
-
type: string;
|
|
122
|
-
};
|
|
123
|
-
error: {
|
|
124
|
-
type: string;
|
|
125
|
-
};
|
|
126
|
-
message: {
|
|
127
|
-
type: string;
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
handler: (args: Record<string, unknown>) => Promise<{
|
|
133
|
-
content: Array<{
|
|
134
|
-
type: string;
|
|
135
|
-
text: string;
|
|
136
|
-
}>;
|
|
137
|
-
structuredContent: unknown;
|
|
138
|
-
isError?: undefined;
|
|
139
|
-
} | {
|
|
140
|
-
content: Array<{
|
|
141
|
-
type: string;
|
|
142
|
-
text: string;
|
|
143
|
-
}>;
|
|
144
|
-
isError: true;
|
|
145
|
-
} | {
|
|
146
|
-
content: {
|
|
147
|
-
type: "text";
|
|
148
|
-
text: string;
|
|
149
|
-
}[];
|
|
150
|
-
isError: boolean;
|
|
151
|
-
}>;
|
|
152
|
-
};
|
|
153
|
-
export declare function createGetRoutineStatusTool(claudeBinary?: string, executor?: RoutinesExecutor): {
|
|
154
|
-
schema: {
|
|
155
|
-
name: string;
|
|
156
|
-
description: string;
|
|
157
|
-
annotations: {
|
|
158
|
-
title: string;
|
|
159
|
-
readOnlyHint: boolean;
|
|
160
|
-
destructiveHint: boolean;
|
|
161
|
-
openWorldHint: boolean;
|
|
162
|
-
};
|
|
163
|
-
inputSchema: {
|
|
164
|
-
type: "object";
|
|
165
|
-
properties: {
|
|
166
|
-
id: {
|
|
167
|
-
type: string;
|
|
168
|
-
description: string;
|
|
169
|
-
};
|
|
170
|
-
};
|
|
171
|
-
required: readonly ["id"];
|
|
172
|
-
additionalProperties: false;
|
|
173
|
-
};
|
|
174
|
-
outputSchema: {
|
|
175
|
-
type: string;
|
|
176
|
-
properties: {
|
|
177
|
-
id: {
|
|
178
|
-
type: string;
|
|
179
|
-
};
|
|
180
|
-
status: {
|
|
181
|
-
type: string;
|
|
182
|
-
};
|
|
183
|
-
lastRun: {
|
|
184
|
-
type: string;
|
|
185
|
-
};
|
|
186
|
-
nextRun: {
|
|
187
|
-
type: string;
|
|
188
|
-
};
|
|
189
|
-
output: {
|
|
190
|
-
type: string;
|
|
191
|
-
};
|
|
192
|
-
error: {
|
|
193
|
-
type: string;
|
|
194
|
-
};
|
|
195
|
-
message: {
|
|
196
|
-
type: string;
|
|
197
|
-
};
|
|
198
|
-
};
|
|
199
|
-
};
|
|
200
|
-
};
|
|
201
|
-
handler: (args: Record<string, unknown>) => Promise<{
|
|
202
|
-
content: Array<{
|
|
203
|
-
type: string;
|
|
204
|
-
text: string;
|
|
205
|
-
}>;
|
|
206
|
-
structuredContent: unknown;
|
|
207
|
-
isError?: undefined;
|
|
208
|
-
} | {
|
|
209
|
-
content: Array<{
|
|
210
|
-
type: string;
|
|
211
|
-
text: string;
|
|
212
|
-
}>;
|
|
213
|
-
isError: true;
|
|
214
|
-
} | {
|
|
215
|
-
content: {
|
|
216
|
-
type: "text";
|
|
217
|
-
text: string;
|
|
218
|
-
}[];
|
|
219
|
-
isError: boolean;
|
|
220
|
-
}>;
|
|
221
|
-
};
|