@ekkos/cli 1.0.33 → 1.0.35
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/dist/capture/jsonl-rewriter.js +72 -7
- package/dist/commands/dashboard.js +186 -557
- package/dist/commands/init.js +3 -15
- package/dist/commands/run.js +221 -259
- package/dist/commands/setup.js +0 -47
- package/dist/commands/swarm-dashboard.js +4 -13
- package/dist/deploy/instructions.d.ts +2 -5
- package/dist/deploy/instructions.js +8 -11
- package/dist/deploy/settings.js +21 -15
- package/dist/deploy/skills.d.ts +0 -8
- package/dist/deploy/skills.js +0 -26
- package/dist/index.js +2 -2
- package/dist/lib/usage-parser.js +1 -2
- package/dist/utils/platform.d.ts +0 -3
- package/dist/utils/platform.js +1 -4
- package/dist/utils/session-binding.d.ts +1 -1
- package/dist/utils/session-binding.js +2 -3
- package/package.json +4 -2
- package/templates/CLAUDE.md +23 -135
- package/templates/agents/README.md +182 -0
- package/templates/agents/code-reviewer.md +166 -0
- package/templates/agents/debug-detective.md +169 -0
- package/templates/agents/ekkOS_Vercel.md +99 -0
- package/templates/agents/extension-manager.md +229 -0
- package/templates/agents/git-companion.md +185 -0
- package/templates/agents/github-test-agent.md +321 -0
- package/templates/agents/railway-manager.md +179 -0
- package/templates/ekkos-manifest.json +8 -8
- package/templates/hooks/assistant-response.ps1 +160 -256
- package/templates/hooks/assistant-response.sh +66 -130
- package/templates/hooks/hooks.json +0 -6
- package/templates/hooks/lib/contract.sh +31 -43
- package/templates/hooks/lib/count-tokens.cjs +0 -0
- package/templates/hooks/lib/ekkos-reminders.sh +0 -0
- package/templates/hooks/lib/state.sh +1 -53
- package/templates/hooks/session-start.ps1 +391 -91
- package/templates/hooks/session-start.sh +166 -201
- package/templates/hooks/stop.ps1 +341 -202
- package/templates/hooks/stop.sh +948 -275
- package/templates/hooks/user-prompt-submit.ps1 +548 -224
- package/templates/hooks/user-prompt-submit.sh +456 -382
- package/templates/plan-template.md +0 -0
- package/templates/spec-template.md +0 -0
- package/templates/windsurf-hooks/before-submit-prompt.sh +238 -0
- package/templates/windsurf-hooks/hooks.json +2 -9
- package/templates/windsurf-hooks/install.sh +0 -0
- package/templates/windsurf-hooks/lib/contract.sh +0 -2
- package/templates/windsurf-hooks/post-cascade-response.sh +0 -0
- package/templates/windsurf-hooks/pre-user-prompt.sh +0 -0
- package/templates/windsurf-skills/ekkos-memory/SKILL.md +219 -0
- package/README.md +0 -57
|
@@ -1,256 +1,160 @@
|
|
|
1
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
2
|
-
# ekkOS_ Hook: AssistantResponse -
|
|
3
|
-
# MANAGED BY ekkos-connect - DO NOT EDIT DIRECTLY
|
|
4
|
-
# EKKOS_MANAGED=1
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
$
|
|
14
|
-
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (-not
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
$
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
$script:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (-not $script:
|
|
105
|
-
return "unknown-session"
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
$
|
|
109
|
-
$
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
$
|
|
123
|
-
|
|
124
|
-
$
|
|
125
|
-
|
|
126
|
-
return "
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
#
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
#
|
|
145
|
-
$
|
|
146
|
-
|
|
147
|
-
if (-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
} catch {}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
$sessionName = Convert-UuidToWords $rawSessionId
|
|
166
|
-
|
|
167
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
168
|
-
# READ TURN STATE
|
|
169
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
170
|
-
$stateFile = Join-Path $env:USERPROFILE ".claude\state\hook-state.json"
|
|
171
|
-
$turn = 0
|
|
172
|
-
|
|
173
|
-
if (Test-Path $stateFile) {
|
|
174
|
-
try {
|
|
175
|
-
$hookState = Get-Content $stateFile -Raw | ConvertFrom-Json
|
|
176
|
-
$turn = [int]$hookState.turn
|
|
177
|
-
} catch {
|
|
178
|
-
$turn = 0
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
183
|
-
# PATTERN TRACKING (detect [ekkOS_SELECT] blocks)
|
|
184
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
185
|
-
$patternIds = @()
|
|
186
|
-
if ($assistantResponse -match '\[ekkOS_SELECT\]') {
|
|
187
|
-
# Extract pattern IDs from SELECT blocks
|
|
188
|
-
$selectMatches = [regex]::Matches($assistantResponse, 'id:\s*([a-zA-Z0-9\-_]+)')
|
|
189
|
-
foreach ($match in $selectMatches) {
|
|
190
|
-
$patternIds += $match.Groups[1].Value
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
195
|
-
# LOCAL CACHE: Tier 0 capture (async, non-blocking)
|
|
196
|
-
# Per v1.2 ADDENDUM: Pass instanceId for namespacing
|
|
197
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
198
|
-
$captureCmd = Get-Command "ekkos-capture" -ErrorAction SilentlyContinue
|
|
199
|
-
if ($captureCmd -and $rawSessionId -ne "unknown") {
|
|
200
|
-
try {
|
|
201
|
-
# NEW format: ekkos-capture response <instance_id> <session_id> <turn_id> <response> [tools] [files]
|
|
202
|
-
$responseBase64 = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($assistantResponse))
|
|
203
|
-
$toolsJson = "[]"
|
|
204
|
-
$filesJson = "[]"
|
|
205
|
-
|
|
206
|
-
# Extract tools used from response
|
|
207
|
-
$toolMatches = [regex]::Matches($assistantResponse, '\[TOOL:\s*([^\]]+)\]')
|
|
208
|
-
if ($toolMatches.Count -gt 0) {
|
|
209
|
-
$tools = $toolMatches | ForEach-Object { $_.Groups[1].Value } | Select-Object -Unique
|
|
210
|
-
$toolsJson = $tools | ConvertTo-Json -Depth 10 -Compress
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
Start-Job -ScriptBlock {
|
|
214
|
-
param($instanceId, $sessionId, $turnNum, $responseB64, $tools, $files)
|
|
215
|
-
try {
|
|
216
|
-
$decoded = [System.Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($responseB64))
|
|
217
|
-
& ekkos-capture response $instanceId $sessionId $turnNum $decoded $tools $files 2>&1 | Out-Null
|
|
218
|
-
} catch {}
|
|
219
|
-
} -ArgumentList $EkkosInstanceId, $rawSessionId, $turn, $responseBase64, $toolsJson, $filesJson | Out-Null
|
|
220
|
-
} catch {}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
224
|
-
# WORKING MEMORY: Fast capture to API (async, non-blocking)
|
|
225
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
226
|
-
$configFile = Join-Path $EkkosConfigDir "config.json"
|
|
227
|
-
if (Test-Path $configFile) {
|
|
228
|
-
try {
|
|
229
|
-
$config = Get-Content $configFile -Raw | ConvertFrom-Json
|
|
230
|
-
$captureToken = $config.hookApiKey
|
|
231
|
-
if (-not $captureToken) { $captureToken = $config.apiKey }
|
|
232
|
-
|
|
233
|
-
if ($captureToken) {
|
|
234
|
-
Start-Job -ScriptBlock {
|
|
235
|
-
param($token, $instanceId, $sessionId, $sessionName, $turnNum, $response, $patterns)
|
|
236
|
-
$body = @{
|
|
237
|
-
session_id = $sessionId
|
|
238
|
-
session_name = $sessionName
|
|
239
|
-
instance_id = $instanceId
|
|
240
|
-
turn = $turnNum
|
|
241
|
-
response = $response.Substring(0, [Math]::Min(5000, $response.Length))
|
|
242
|
-
pattern_ids = $patterns
|
|
243
|
-
} | ConvertTo-Json -Depth 10
|
|
244
|
-
|
|
245
|
-
Invoke-RestMethod -Uri "https://mcp.ekkos.dev/api/v1/working/turn" `
|
|
246
|
-
-Method POST `
|
|
247
|
-
-Headers @{ Authorization = "Bearer $token" } `
|
|
248
|
-
-ContentType "application/json" `
|
|
249
|
-
-Body ([System.Text.Encoding]::UTF8.GetBytes($body)) -ErrorAction SilentlyContinue
|
|
250
|
-
} -ArgumentList $captureToken, $EkkosInstanceId, $rawSessionId, $sessionName, $turn, $assistantResponse, $patternIds | Out-Null
|
|
251
|
-
}
|
|
252
|
-
} catch {}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
# Silent exit - assistant-response hook should not produce output
|
|
256
|
-
exit 0
|
|
1
|
+
# ═══════════════════════════════════════════════════════════════════════════
|
|
2
|
+
# ekkOS_ Hook: AssistantResponse - Validates and enforces footer format
|
|
3
|
+
# MANAGED BY ekkos-connect - DO NOT EDIT DIRECTLY
|
|
4
|
+
# EKKOS_MANAGED=1
|
|
5
|
+
# ═══════════════════════════════════════════════════════════════════════════
|
|
6
|
+
# Runs AFTER assistant response, checks footer compliance
|
|
7
|
+
# Per spec v1.2 Addendum: NO jq, NO hardcoded arrays
|
|
8
|
+
# ═══════════════════════════════════════════════════════════════════════════
|
|
9
|
+
|
|
10
|
+
$ErrorActionPreference = "SilentlyContinue"
|
|
11
|
+
|
|
12
|
+
$RESPONSE_FILE = $args[0]
|
|
13
|
+
$HOOK_ENV = $args[1]
|
|
14
|
+
|
|
15
|
+
# Exit if no response file
|
|
16
|
+
if (-not $RESPONSE_FILE -or -not (Test-Path $RESPONSE_FILE)) {
|
|
17
|
+
exit 0
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
# ═══════════════════════════════════════════════════════════════════════════
|
|
21
|
+
# CONFIG PATHS - No hardcoded word arrays per spec v1.2 Addendum
|
|
22
|
+
# ═══════════════════════════════════════════════════════════════════════════
|
|
23
|
+
$EkkosConfigDir = if ($env:EKKOS_CONFIG_DIR) { $env:EKKOS_CONFIG_DIR } else { Join-Path $env:USERPROFILE ".ekkos" }
|
|
24
|
+
$SessionWordsJson = Join-Path $EkkosConfigDir "session-words.json"
|
|
25
|
+
$SessionWordsDefault = Join-Path $EkkosConfigDir ".defaults\session-words.json"
|
|
26
|
+
$JsonParseHelper = Join-Path $EkkosConfigDir ".helpers\json-parse.cjs"
|
|
27
|
+
|
|
28
|
+
# ═══════════════════════════════════════════════════════════════════════════
|
|
29
|
+
# Parse metadata from hook environment using Node (no jq)
|
|
30
|
+
# ═══════════════════════════════════════════════════════════════════════════
|
|
31
|
+
function Parse-HookEnv {
|
|
32
|
+
param(
|
|
33
|
+
[string]$Json,
|
|
34
|
+
[string]$Path
|
|
35
|
+
)
|
|
36
|
+
if (-not $Json) { return "" }
|
|
37
|
+
try {
|
|
38
|
+
$result = $Json | node -e "
|
|
39
|
+
const data = JSON.parse(require('fs').readFileSync('/dev/stdin', 'utf8') || '{}');
|
|
40
|
+
const path = '$Path'.replace(/^\./,'').split('.').filter(Boolean);
|
|
41
|
+
let result = data;
|
|
42
|
+
for (const p of path) {
|
|
43
|
+
if (result === undefined || result === null) { result = undefined; break; }
|
|
44
|
+
result = result[p];
|
|
45
|
+
}
|
|
46
|
+
if (result !== undefined && result !== null) console.log(result);
|
|
47
|
+
" 2>$null
|
|
48
|
+
if ($result) { return $result.Trim() } else { return "" }
|
|
49
|
+
} catch {
|
|
50
|
+
return ""
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
$SESSION_ID = Parse-HookEnv $HOOK_ENV ".sessionId"
|
|
55
|
+
if (-not $SESSION_ID) { $SESSION_ID = "unknown" }
|
|
56
|
+
|
|
57
|
+
$MODEL = Parse-HookEnv $HOOK_ENV ".model"
|
|
58
|
+
if (-not $MODEL) { $MODEL = "Claude Code (Opus 4.5)" }
|
|
59
|
+
|
|
60
|
+
# ═══════════════════════════════════════════════════════════════════════════
|
|
61
|
+
# Session name conversion - Uses external session-words.json (NO hardcoded arrays)
|
|
62
|
+
# ═══════════════════════════════════════════════════════════════════════════
|
|
63
|
+
$script:ADJECTIVES = @()
|
|
64
|
+
$script:NOUNS = @()
|
|
65
|
+
$script:VERBS = @()
|
|
66
|
+
$script:SESSION_WORDS_LOADED = $false
|
|
67
|
+
|
|
68
|
+
function Load-SessionWords {
|
|
69
|
+
if ($script:SESSION_WORDS_LOADED) { return }
|
|
70
|
+
|
|
71
|
+
$wordsFile = $SessionWordsJson
|
|
72
|
+
if (-not (Test-Path $wordsFile)) {
|
|
73
|
+
$wordsFile = $SessionWordsDefault
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if ((-not (Test-Path $wordsFile)) -or (-not (Test-Path $JsonParseHelper))) {
|
|
77
|
+
return
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
$adjRaw = & node $JsonParseHelper $wordsFile ".adjectives" 2>$null
|
|
82
|
+
$nounRaw = & node $JsonParseHelper $wordsFile ".nouns" 2>$null
|
|
83
|
+
$verbRaw = & node $JsonParseHelper $wordsFile ".verbs" 2>$null
|
|
84
|
+
|
|
85
|
+
$script:ADJECTIVES = @()
|
|
86
|
+
$script:NOUNS = @()
|
|
87
|
+
$script:VERBS = @()
|
|
88
|
+
|
|
89
|
+
if ($adjRaw) { $script:ADJECTIVES = @($adjRaw -split "`n" | Where-Object { $_ }) }
|
|
90
|
+
if ($nounRaw) { $script:NOUNS = @($nounRaw -split "`n" | Where-Object { $_ }) }
|
|
91
|
+
if ($verbRaw) { $script:VERBS = @($verbRaw -split "`n" | Where-Object { $_ }) }
|
|
92
|
+
|
|
93
|
+
if ($script:ADJECTIVES.Count -gt 0 -and $script:NOUNS.Count -gt 0 -and $script:VERBS.Count -gt 0) {
|
|
94
|
+
$script:SESSION_WORDS_LOADED = $true
|
|
95
|
+
}
|
|
96
|
+
} catch {}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function Convert-UuidToName {
|
|
100
|
+
param([string]$uuid)
|
|
101
|
+
|
|
102
|
+
Load-SessionWords
|
|
103
|
+
|
|
104
|
+
if (-not $script:SESSION_WORDS_LOADED) {
|
|
105
|
+
return "unknown-session"
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
$hex = $uuid -replace "-", ""
|
|
109
|
+
$hex = $hex.Substring(0, [Math]::Min(12, $hex.Length))
|
|
110
|
+
|
|
111
|
+
if ($hex -notmatch '^[0-9a-fA-F]+$') {
|
|
112
|
+
return "unknown-session"
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
try {
|
|
116
|
+
$adjSeed = [Convert]::ToInt32($hex.Substring(0, 4), 16)
|
|
117
|
+
$nounSeed = [Convert]::ToInt32($hex.Substring(4, 4), 16)
|
|
118
|
+
$verbSeed = [Convert]::ToInt32($hex.Substring(8, 4), 16)
|
|
119
|
+
|
|
120
|
+
$adjIdx = $adjSeed % $script:ADJECTIVES.Count
|
|
121
|
+
$nounIdx = $nounSeed % $script:NOUNS.Count
|
|
122
|
+
$verbIdx = $verbSeed % $script:VERBS.Count
|
|
123
|
+
|
|
124
|
+
return "$($script:ADJECTIVES[$adjIdx])-$($script:NOUNS[$nounIdx])-$($script:VERBS[$verbIdx])"
|
|
125
|
+
} catch {
|
|
126
|
+
return "unknown-session"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
$SESSION_NAME = Convert-UuidToName $SESSION_ID
|
|
131
|
+
$TIMESTAMP = Get-Date -Format "yyyy-MM-dd hh:mm:ss tt K"
|
|
132
|
+
|
|
133
|
+
# Required footer format
|
|
134
|
+
$REQUIRED_FOOTER = "---`n$MODEL · ekkOS_ · $SESSION_NAME · $TIMESTAMP"
|
|
135
|
+
|
|
136
|
+
# Check if response has correct footer
|
|
137
|
+
$RESPONSE_CONTENT = Get-Content $RESPONSE_FILE -Raw
|
|
138
|
+
$lines = $RESPONSE_CONTENT -split "`n"
|
|
139
|
+
$LAST_LINE = ""
|
|
140
|
+
if ($lines.Count -gt 0) {
|
|
141
|
+
$LAST_LINE = $lines[$lines.Count - 1].Trim()
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
# Check if footer exists and is correct
|
|
145
|
+
if ($LAST_LINE -match "ekkOS" -and $LAST_LINE -match [regex]::Escape($SESSION_NAME)) {
|
|
146
|
+
# Footer exists - validate format
|
|
147
|
+
if ($LAST_LINE -match [regex]::Escape($SESSION_NAME) -and $LAST_LINE -match "📅") {
|
|
148
|
+
# Footer is correct
|
|
149
|
+
exit 0
|
|
150
|
+
} else {
|
|
151
|
+
# Footer exists but is malformed - replace it
|
|
152
|
+
$withoutFooter = ($lines | Select-Object -SkipLast 2) -join "`n"
|
|
153
|
+
Set-Content -Path $RESPONSE_FILE -Value "$withoutFooter`n`n$REQUIRED_FOOTER" -NoNewline -Force
|
|
154
|
+
}
|
|
155
|
+
} else {
|
|
156
|
+
# Footer missing - append it
|
|
157
|
+
Add-Content -Path $RESPONSE_FILE -Value "`n`n$REQUIRED_FOOTER"
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
exit 0
|