arkaos 4.3.2 → 4.3.4

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/VERSION CHANGED
@@ -1 +1 @@
1
- 4.3.2
1
+ 4.3.4
package/bin/arka ADDED
@@ -0,0 +1,225 @@
1
+ #!/usr/bin/env bash
2
+ # ============================================================================
3
+ # ARKA OS — CLI Wrapper
4
+ # Usage: arka [command] [args...]
5
+ # ============================================================================
6
+ set -e
7
+
8
+ command -v claude &>/dev/null || { echo "Error: Claude Code CLI not found."; exit 1; }
9
+
10
+ ARKA_OS="${ARKA_OS:-$HOME/.claude/skills/arka}"
11
+ [ -d "$ARKA_OS" ] || { echo "Error: ARKA OS not installed. Run: bash install.sh"; exit 1; }
12
+
13
+ # Run version check (silent on errors)
14
+ bash "$ARKA_OS/version-check.sh" 2>/dev/null || true
15
+
16
+ # Generate dynamic system prompt from user profile
17
+ SYSTEM_PROMPT=$(bash "$ARKA_OS/system-prompt.sh" 2>/dev/null || echo "")
18
+
19
+ # ─── ARKA OS Banner ─────────────────────────────────────────────────────────
20
+ show_banner() {
21
+ local C='\033[0;36m' # cyan
22
+ local G='\033[0;32m' # green
23
+ local Y='\033[1;33m' # yellow
24
+ local N='\033[0m' # reset
25
+ local VERSION
26
+ VERSION=$(cat "$ARKA_OS/VERSION" 2>/dev/null || echo "?")
27
+
28
+ # Read user name from profile
29
+ local USER_NAME=""
30
+ if [ -f "$HOME/.arka-os/profile.json" ] && command -v jq &>/dev/null; then
31
+ USER_NAME=$(jq -r '.user_name // ""' "$HOME/.arka-os/profile.json" 2>/dev/null)
32
+ fi
33
+
34
+ echo ""
35
+ echo -e "${C} ╔══════════════════════════════════════════════════════════╗${N}"
36
+ echo -e "${C} ║${N} ${C}║${N}"
37
+ echo -e "${C} ║${N} ${G} █████╗ ██████╗ ██╗ ██╗ █████╗ ██████╗ ███████╗${N} ${C}║${N}"
38
+ echo -e "${C} ║${N} ${G}██╔══██╗██╔══██╗██║ ██╔╝██╔══██╗██╔═══██╗██╔════╝${N} ${C}║${N}"
39
+ echo -e "${C} ║${N} ${G}███████║██████╔╝█████╔╝ ███████║██║ ██║███████╗${N} ${C}║${N}"
40
+ echo -e "${C} ║${N} ${G}██╔══██║██╔══██╗██╔═██╗ ██╔══██║██║ ██║╚════██║${N} ${C}║${N}"
41
+ echo -e "${C} ║${N} ${G}██║ ██║██║ ██║██║ ██╗██║ ██║╚██████╔╝███████║${N} ${C}║${N}"
42
+ echo -e "${C} ║${N} ${G}╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝${N} ${C}║${N}"
43
+ echo -e "${C} ║${N} ${C}║${N}"
44
+ echo -e "${C} ║${N} ${Y}WizardingCode Company OS${N} v${VERSION} ${C}║${N}"
45
+ if [ -n "$USER_NAME" ]; then
46
+ echo -e "${C} ║${N} Welcome back, ${G}${USER_NAME}${N}! ${C}║${N}"
47
+ fi
48
+ echo -e "${C} ║${N} ${C}║${N}"
49
+ echo -e "${C} ╚══════════════════════════════════════════════════════════╝${N}"
50
+ echo ""
51
+ }
52
+
53
+ case "${1:-}" in
54
+ skill)
55
+ shift
56
+ bash "$HOME/.local/bin/arka-skill" "$@"
57
+ exit $?
58
+ ;;
59
+ update)
60
+ cd "$(cat "$ARKA_OS/.repo-path")" && git pull && bash install.sh
61
+ exit $?
62
+ ;;
63
+ --version|-v)
64
+ cat "$ARKA_OS/VERSION"
65
+ exit 0
66
+ ;;
67
+ doctor)
68
+ shift
69
+ bash "$HOME/.local/bin/arka-doctor" "$@"
70
+ exit $?
71
+ ;;
72
+ gotchas)
73
+ shift
74
+ GOTCHAS_FILE="$HOME/.arka-os/gotchas.json"
75
+ case "${1:-}" in
76
+ clear)
77
+ echo '[]' > "$GOTCHAS_FILE"
78
+ echo "Gotchas cleared."
79
+ ;;
80
+ --json)
81
+ if [ -f "$GOTCHAS_FILE" ]; then
82
+ cat "$GOTCHAS_FILE"
83
+ else
84
+ echo '[]'
85
+ fi
86
+ ;;
87
+ *)
88
+ if [ ! -f "$GOTCHAS_FILE" ] || [ "$(jq 'length' "$GOTCHAS_FILE" 2>/dev/null)" = "0" ]; then
89
+ echo "No gotchas recorded yet."
90
+ exit 0
91
+ fi
92
+ echo ""
93
+ echo -e "\033[0;36m╔══════════════════════════════════════════════════╗\033[0m"
94
+ echo -e "\033[0;36m║\033[0m \033[1mARKA OS Gotchas\033[0m — Recurring Error Patterns \033[0;36m║\033[0m"
95
+ echo -e "\033[0;36m╚══════════════════════════════════════════════════╝\033[0m"
96
+ echo ""
97
+ jq -r '.[:10] | to_entries[] | " \(.key + 1). [\(.value.category)] (×\(.value.count)) \(.value.pattern)\n First: \(.value.first_seen) | Last: \(.value.last_seen)\n Projects: \(.value.projects | join(", "))\n"' "$GOTCHAS_FILE" 2>/dev/null
98
+ TOTAL=$(jq 'length' "$GOTCHAS_FILE" 2>/dev/null || echo "0")
99
+ echo " Total: $TOTAL gotcha(s) tracked"
100
+ echo ""
101
+ ;;
102
+ esac
103
+ exit 0
104
+ ;;
105
+ metrics)
106
+ METRICS_FILE="$HOME/.arka-os/hook-metrics.json"
107
+ if [ ! -f "$METRICS_FILE" ] || [ "$(jq 'length' "$METRICS_FILE" 2>/dev/null)" = "0" ]; then
108
+ echo "No hook metrics recorded yet."
109
+ exit 0
110
+ fi
111
+ echo ""
112
+ echo -e "\033[0;36m╔══════════════════════════════════════════════════╗\033[0m"
113
+ echo -e "\033[0;36m║\033[0m \033[1mARKA OS Hook Metrics\033[0m — Last 24h \033[0;36m║\033[0m"
114
+ echo -e "\033[0;36m╚══════════════════════════════════════════════════╝\033[0m"
115
+ echo ""
116
+ CUTOFF=$(date -u -v-24H +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || date -u -d '24 hours ago' +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || echo "1970-01-01T00:00:00Z")
117
+ jq -r --arg cutoff "$CUTOFF" '
118
+ [.[] | select(.timestamp >= $cutoff)] | group_by(.hook) | .[] |
119
+ {
120
+ hook: .[0].hook,
121
+ count: length,
122
+ avg: ([.[].duration_ms] | add / length | floor),
123
+ p95: ([.[].duration_ms] | sort | .[length * 95 / 100 | floor] // 0),
124
+ max: ([.[].duration_ms] | max)
125
+ } |
126
+ " \(.hook)\n Count: \(.count) Avg: \(.avg)ms P95: \(.p95)ms Max: \(.max)ms"
127
+ ' "$METRICS_FILE" 2>/dev/null
128
+ echo ""
129
+ TOTAL=$(jq 'length' "$METRICS_FILE" 2>/dev/null || echo "0")
130
+ echo " Total entries: $TOTAL (keeps last 500)"
131
+ echo ""
132
+ exit 0
133
+ ;;
134
+ commands|registry)
135
+ shift
136
+ REPO_DIR="$(cat "$ARKA_OS/.repo-path" 2>/dev/null)"
137
+ REGISTRY="$REPO_DIR/knowledge/commands-registry.json"
138
+ case "${1:-}" in
139
+ rebuild)
140
+ bash "$REPO_DIR/bin/arka-registry-gen"
141
+ echo "Registry rebuilt: $(jq '._meta.total_commands' "$REGISTRY") commands."
142
+ ;;
143
+ --json)
144
+ [ -f "$REGISTRY" ] && cat "$REGISTRY" || echo '{"commands":[]}'
145
+ ;;
146
+ *)
147
+ if [ ! -f "$REGISTRY" ]; then
148
+ echo "Registry not found. Run: arka commands rebuild"
149
+ exit 1
150
+ fi
151
+ echo ""
152
+ echo -e "\033[0;36m═══ ARKA OS — Available Commands ═══\033[0m"
153
+ echo ""
154
+ jq -r '.commands | group_by(.department) | .[] |
155
+ " \u001b[1;33m\(.[0].department | ascii_upcase)\u001b[0m\n" +
156
+ ([.[] | " \(.command)\t\(.description)"] | join("\n")) + "\n"
157
+ ' "$REGISTRY" 2>/dev/null
158
+ TOTAL=$(jq '._meta.total_commands' "$REGISTRY" 2>/dev/null || echo "?")
159
+ echo -e " Total: $TOTAL commands"
160
+ echo -e " Tip: Just describe what you need — no need to memorize commands!"
161
+ echo ""
162
+ ;;
163
+ esac
164
+ exit 0
165
+ ;;
166
+ providers)
167
+ shift
168
+ REPO_DIR="$(cat "$ARKA_OS/.repo-path" 2>/dev/null)"
169
+ bash "$REPO_DIR/bin/arka-providers" "$@"
170
+ exit $?
171
+ ;;
172
+ team-balance)
173
+ REPO_DIR="$(cat "$ARKA_OS/.repo-path" 2>/dev/null)"
174
+ bash "$REPO_DIR/config/disc-team-validator.sh"
175
+ exit $?
176
+ ;;
177
+ test)
178
+ shift
179
+ if command -v bats &>/dev/null; then
180
+ REPO_DIR="$(cat "$ARKA_OS/.repo-path" 2>/dev/null)"
181
+ bats "$REPO_DIR/tests/" "$@"
182
+ else
183
+ echo "Error: bats-core not installed. Install: brew install bats-core"
184
+ exit 1
185
+ fi
186
+ exit $?
187
+ ;;
188
+ kb)
189
+ shift
190
+ SCRIPTS_DIR="$HOME/.claude/skills/arka-knowledge/scripts"
191
+ # Fallback to repo scripts location
192
+ if [ ! -d "$SCRIPTS_DIR" ]; then
193
+ REPO_DIR="$(cat "$ARKA_OS/.repo-path" 2>/dev/null)"
194
+ SCRIPTS_DIR="$REPO_DIR/departments/kb/scripts"
195
+ fi
196
+ case "${1:-}" in
197
+ queue) bash "$SCRIPTS_DIR/kb-status.sh" "${@:2}" ;;
198
+ status) bash "$SCRIPTS_DIR/kb-status.sh" "${@:2}" ;;
199
+ capabilities) bash "$SCRIPTS_DIR/kb-check-capabilities.sh" ;;
200
+ cleanup) bash "$SCRIPTS_DIR/kb-cleanup.sh" "${@:2}" ;;
201
+ *) claude "/kb $*" ;;
202
+ esac
203
+ exit $?
204
+ ;;
205
+ *)
206
+ # Show branded banner for interactive sessions (no arguments)
207
+ if [ $# -eq 0 ]; then
208
+ show_banner
209
+ fi
210
+
211
+ if [ -n "$SYSTEM_PROMPT" ]; then
212
+ if [ $# -gt 0 ]; then
213
+ claude --append-system-prompt "$SYSTEM_PROMPT" "$*"
214
+ else
215
+ claude --append-system-prompt "$SYSTEM_PROMPT"
216
+ fi
217
+ else
218
+ if [ $# -gt 0 ]; then
219
+ claude "$*"
220
+ else
221
+ claude
222
+ fi
223
+ fi
224
+ ;;
225
+ esac
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env bash
2
+ # ============================================================================
3
+ # ArkaOS — Claude Code Wrapper
4
+ # Displays branded greeting BEFORE Claude starts (deterministic, no LLM)
5
+ # Usage: arka-claude [any claude args...]
6
+ # ============================================================================
7
+
8
+ # ─── Colors ────────────────────────────────────────────────────────────
9
+ GREEN='\033[0;32m'
10
+ WHITE='\033[1;37m'
11
+ DIM='\033[2m'
12
+ CYAN='\033[0;36m'
13
+ YELLOW='\033[1;33m'
14
+ RESET='\033[0m'
15
+
16
+ # ─── Profile ───────────────────────────────────────────────────────────
17
+ NAME="founder"
18
+ COMPANY="WizardingCode"
19
+ VERSION="2.x"
20
+
21
+ if [ -f "$HOME/.arkaos/profile.json" ] && command -v python3 &>/dev/null; then
22
+ NAME=$(python3 -c "import json; p=json.load(open('$HOME/.arkaos/profile.json')); print(p.get('name', p.get('role', 'founder')))" 2>/dev/null || echo "founder")
23
+ COMPANY=$(python3 -c "import json; print(json.load(open('$HOME/.arkaos/profile.json')).get('company', 'WizardingCode'))" 2>/dev/null || echo "WizardingCode")
24
+ fi
25
+
26
+ if [ -f "$HOME/.arkaos/.repo-path" ]; then
27
+ REPO=$(cat "$HOME/.arkaos/.repo-path")
28
+ [ -f "$REPO/VERSION" ] && VERSION=$(cat "$REPO/VERSION" | tr -d '[:space:]')
29
+ fi
30
+
31
+ # ─── Time greeting ─────────────────────────────────────────────────────
32
+ HOUR=$(date +%H)
33
+ if [ "$HOUR" -ge 5 ] && [ "$HOUR" -lt 12 ]; then GREETING="Bom dia"
34
+ elif [ "$HOUR" -ge 12 ] && [ "$HOUR" -lt 19 ]; then GREETING="Boa tarde"
35
+ else GREETING="Boa noite"; fi
36
+
37
+ # ─── Version drift ─────────────────────────────────────────────────────
38
+ DRIFT_MSG=""
39
+ SYNC_STATE="$HOME/.arkaos/sync-state.json"
40
+ if [ -f "$SYNC_STATE" ]; then
41
+ SYNCED=$(python3 -c "import json; print(json.load(open('$SYNC_STATE'))['version'])" 2>/dev/null || echo "none")
42
+ if [ "$SYNCED" != "$VERSION" ]; then
43
+ DRIFT_MSG="\n ${YELLOW}⚠ Update available: run /arka update to sync${RESET}"
44
+ fi
45
+ fi
46
+
47
+ # ─── Display ───────────────────────────────────────────────────────────
48
+ echo ""
49
+ echo -e " ${GREEN}╔══════════════════════════════════════════════╗${RESET}"
50
+ echo -e " ${GREEN}║${RESET} ${GREEN}║${RESET}"
51
+ echo -e " ${GREEN}║${RESET} ${WHITE}A R K A O S${RESET} ${GREEN}║${RESET}"
52
+ echo -e " ${GREEN}║${RESET} ${GREEN}║${RESET}"
53
+ echo -e " ${GREEN}║${RESET} ${DIM}The Operating System for AI Teams${RESET} ${GREEN}║${RESET}"
54
+ echo -e " ${GREEN}║${RESET} ${DIM}by WizardingCode${RESET} ${GREEN}║${RESET}"
55
+ echo -e " ${GREEN}║${RESET} ${GREEN}║${RESET}"
56
+ echo -e " ${GREEN}╚══════════════════════════════════════════════╝${RESET}"
57
+ echo ""
58
+ echo -e " ${CYAN}${GREETING}, ${NAME}${RESET} ${DIM}(${COMPANY})${RESET}"
59
+ echo -e " ${DIM}ArkaOS v${VERSION} │ 65 agents │ 17 departments │ 244+ skills${RESET}"
60
+ echo -e "${DRIFT_MSG}"
61
+ echo ""
62
+
63
+ # ─── Launch Claude ─────────────────────────────────────────────────────
64
+ exec claude "$@"
@@ -0,0 +1,11 @@
1
+ @echo off
2
+ REM ==========================================================================
3
+ REM ArkaOS - Claude Code Wrapper (cmd shim)
4
+ REM
5
+ REM Dispatches to bin\arka-claude.ps1, forwarding all arguments. Using a
6
+ REM .cmd shim means `arka-claude ...` works from cmd.exe, PowerShell, and
7
+ REM Windows Terminal alike, without the caller having to remember the
8
+ REM `powershell -File ...` invocation.
9
+ REM ==========================================================================
10
+ powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "%~dp0arka-claude.ps1" %*
11
+ exit /b %ERRORLEVEL%
@@ -0,0 +1,126 @@
1
+ # ============================================================================
2
+ # ArkaOS - Claude Code Wrapper (Windows / PowerShell 5.1+)
3
+ #
4
+ # Port of bin/arka-claude. Displays the branded greeting deterministically
5
+ # (no LLM involved) and then hands control to `claude` with any forwarded
6
+ # arguments.
7
+ #
8
+ # Usage: arka-claude [any claude args...]
9
+ #
10
+ # This script is normally invoked through its .cmd shim (bin/arka-claude.cmd)
11
+ # so it works from cmd.exe, PowerShell, and Windows Terminal without the
12
+ # caller having to remember the `powershell -File ...` invocation.
13
+ #
14
+ # Pure ASCII on purpose: PS 5.1 reads source files as ANSI by default.
15
+ # Box-drawing characters are built at runtime from [char] codes.
16
+ # ============================================================================
17
+
18
+ $ErrorActionPreference = 'Stop'
19
+ [Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false)
20
+
21
+ $arkaosHome = Join-Path $env:USERPROFILE '.arkaos'
22
+
23
+ # --- Profile ---------------------------------------------------------------
24
+ $name = 'founder'
25
+ $company = 'WizardingCode'
26
+ $version = '2.x'
27
+
28
+ $profilePath = Join-Path $arkaosHome 'profile.json'
29
+ if (Test-Path -LiteralPath $profilePath) {
30
+ try {
31
+ $arkaosProfile = Get-Content -Raw -LiteralPath $profilePath -Encoding UTF8 | ConvertFrom-Json
32
+ if ($arkaosProfile.name) { $name = [string]$arkaosProfile.name }
33
+ elseif ($arkaosProfile.role) { $name = [string]$arkaosProfile.role }
34
+ if ($arkaosProfile.company) { $company = [string]$arkaosProfile.company }
35
+ } catch { }
36
+ }
37
+
38
+ $repoPathFile = Join-Path $arkaosHome '.repo-path'
39
+ if (Test-Path -LiteralPath $repoPathFile) {
40
+ try {
41
+ $repo = (Get-Content -Raw -LiteralPath $repoPathFile -Encoding UTF8).Trim()
42
+ if ($repo) {
43
+ $versionFile = Join-Path $repo 'VERSION'
44
+ if (Test-Path -LiteralPath $versionFile) {
45
+ $version = (Get-Content -Raw -LiteralPath $versionFile -Encoding UTF8).Trim()
46
+ }
47
+ }
48
+ } catch { }
49
+ }
50
+
51
+ # --- Time greeting ---------------------------------------------------------
52
+ $hour = [int](Get-Date -Format 'HH')
53
+ if ($hour -ge 5 -and $hour -lt 12) { $greeting = 'Bom dia' }
54
+ elseif ($hour -ge 12 -and $hour -lt 19) { $greeting = 'Boa tarde' }
55
+ else { $greeting = 'Boa noite' }
56
+
57
+ # --- Version drift ---------------------------------------------------------
58
+ $driftMsg = ''
59
+ $syncStatePath = Join-Path $arkaosHome 'sync-state.json'
60
+ if (Test-Path -LiteralPath $syncStatePath) {
61
+ try {
62
+ $ss = Get-Content -Raw -LiteralPath $syncStatePath -Encoding UTF8 | ConvertFrom-Json
63
+ $synced = if ($null -ne $ss.version) { [string]$ss.version } else { 'none' }
64
+ if ($synced -ne $version) {
65
+ $driftMsg = 'Update available: run /arka update to sync'
66
+ }
67
+ } catch { }
68
+ }
69
+
70
+ # --- Build ASCII header ----------------------------------------------------
71
+ # Box drawing chars as runtime literals (not embedded in source).
72
+ $tl = [char]0x2554; $tr = [char]0x2557
73
+ $bl = [char]0x255A; $br = [char]0x255D
74
+ $h = [char]0x2550; $v = [char]0x2551
75
+ $sep = [char]0x2502 # light vertical bar used in the stat line
76
+ $innerWidth = 46
77
+ $barLine = ([string]$h * $innerWidth)
78
+ $emptyBox = "$v" + (' ' * $innerWidth) + "$v"
79
+
80
+ function Pad-Centered([string]$text, [int]$width) {
81
+ $padLeft = [int](($width - $text.Length) / 2)
82
+ $padRight = $width - $text.Length - $padLeft
83
+ return (' ' * $padLeft) + $text + (' ' * $padRight)
84
+ }
85
+
86
+ # --- Display ---------------------------------------------------------------
87
+ Write-Host ''
88
+ Write-Host (" $tl$barLine$tr") -ForegroundColor Green
89
+ Write-Host (" $v" + (' ' * $innerWidth) + "$v") -ForegroundColor Green
90
+ Write-Host (" $v") -NoNewline -ForegroundColor Green
91
+ Write-Host (Pad-Centered 'A R K A O S' $innerWidth) -NoNewline -ForegroundColor White
92
+ Write-Host ("$v") -ForegroundColor Green
93
+ Write-Host (" $v" + (' ' * $innerWidth) + "$v") -ForegroundColor Green
94
+ Write-Host (" $v") -NoNewline -ForegroundColor Green
95
+ Write-Host (Pad-Centered 'The Operating System for AI Teams' $innerWidth) -NoNewline -ForegroundColor DarkGray
96
+ Write-Host ("$v") -ForegroundColor Green
97
+ Write-Host (" $v") -NoNewline -ForegroundColor Green
98
+ Write-Host (Pad-Centered 'by WizardingCode' $innerWidth) -NoNewline -ForegroundColor DarkGray
99
+ Write-Host ("$v") -ForegroundColor Green
100
+ Write-Host (" $v" + (' ' * $innerWidth) + "$v") -ForegroundColor Green
101
+ Write-Host (" $bl$barLine$br") -ForegroundColor Green
102
+ Write-Host ''
103
+
104
+ Write-Host " $greeting, $name " -NoNewline -ForegroundColor Cyan
105
+ Write-Host "($company)" -ForegroundColor DarkGray
106
+ Write-Host (" ArkaOS v$version $sep 65 agents $sep 17 departments $sep 244+ skills") -ForegroundColor DarkGray
107
+ if ($driftMsg) {
108
+ Write-Host ''
109
+ Write-Host " ! $driftMsg" -ForegroundColor Yellow
110
+ }
111
+ Write-Host ''
112
+
113
+ # --- Launch Claude ---------------------------------------------------------
114
+ # The bash wrapper uses `exec claude "$@"` which replaces the shell.
115
+ # PowerShell has no exec equivalent; `& claude @args` spawns a child and
116
+ # blocks until it exits. The net effect for the user is the same.
117
+ $claude = Get-Command claude -ErrorAction SilentlyContinue
118
+ if (-not $claude) {
119
+ Write-Host ''
120
+ Write-Host ' Error: `claude` not found on PATH.' -ForegroundColor Red
121
+ Write-Host ' Install Claude Code for Windows and re-run arka-claude.' -ForegroundColor DarkGray
122
+ exit 127
123
+ }
124
+
125
+ & claude @args
126
+ exit $LASTEXITCODE