Skip to content

Business operating system for Claude Code — 57 skills, 21 agents, smart daemon. Unified inbox (WhatsApp/Email/Slack/Telegram), autonomous PR merge, full-AWS monitoring, revenue (Stripe+RevenueCat), e-commerce (Shopify), marketing (Klaviyo/Meta/GA4), voice (Bland/ElevenLabs), APM (Datadog/NewRelic/OTEL), YOLO mode.

Fix external registry classification and dashboard counts (#958)

Aurora Capital04f7db9e6ce0
diff --git a/claude-ops/bin/ops-dash b/claude-ops/bin/ops-dash
index a08f75d6..948f04e3 100755
--- a/claude-ops/bin/ops-dash
+++ b/claude-ops/bin/ops-dash
@@ -861,8 +861,8 @@ render_section_portfolio() {
expanded="${path/#\~/$HOME}"
if [[ -d "$expanded/.git" ]]; then
- dirty=$(git -C "$expanded" status --porcelain 2>/dev/null | wc -l | tr -d ' ' || echo "0")
- ahead=$(git -C "$expanded" rev-list --count "@{upstream}..HEAD" 2>/dev/null || echo "0")
+ dirty=$(git -C "$expanded" status --porcelain 2>/dev/null | wc -l | tr -d ' ') || dirty=0
+ ahead=$(git -C "$expanded" rev-list --count "@{upstream}..HEAD" 2>/dev/null) || ahead=0
last_commit_epoch=$(git -C "$expanded" log -1 --format="%ct" 2>/dev/null || echo "$NOW_EPOCH")
age=$(age_human $((NOW_EPOCH - last_commit_epoch)))
diff --git a/claude-ops/bin/ops-external b/claude-ops/bin/ops-external
index 999333db..a6dcb73c 100755
--- a/claude-ops/bin/ops-external
+++ b/claude-ops/bin/ops-external
@@ -175,13 +175,21 @@ fi
# --- 5. registry.json: legacy external entries (Linear teams, Slack, custom endpoints) ---
if [ -f "$REGISTRY" ]; then
- EXTERNAL=$(jq -c '[.projects[]? | select(.type == "external" or (.source != null and .source != "git"))]' "$REGISTRY" 2>/dev/null || echo '[]')
+ # `source` records the discovery root for normal local projects (for example
+ # "Developer", ".grok", or ".pnpm-store"). It is not a git/external flag.
+ # Keep compatibility with legacy external rows that predate type=external,
+ # but only for source kinds this collector actually knows how to probe.
+ EXTERNAL=$(jq -c '[.projects[]? | select(
+ .type == "external" or
+ .source == "shopify" or .source == "linear" or .source == "slack" or
+ .source == "notion" or .source == "custom"
+ )]' "$REGISTRY" 2>/dev/null || echo '[]')
COUNT=$(echo "$EXTERNAL" | jq 'length')
# BSD `seq 0 -1` counts down (prints 0\n-1) — guard explicitly when COUNT==0.
if [ "$COUNT" -gt 0 ]; then
for i in $(seq 0 $((COUNT - 1))); do
PROJECT=$(echo "$EXTERNAL" | jq -c ".[$i]")
- ALIAS=$(echo "$PROJECT" | jq -r '.alias')
+ ALIAS=$(echo "$PROJECT" | jq -r '.alias // .name // .source // "external"')
SOURCE=$(echo "$PROJECT" | jq -r '.source // "unknown"')
# Skip Shopify duplicates already covered by preferences.
diff --git a/claude-ops/tests/run-all.sh b/claude-ops/tests/run-all.sh
index e2744af3..3ff33ee4 100755
--- a/claude-ops/tests/run-all.sh
+++ b/claude-ops/tests/run-all.sh
@@ -80,9 +80,11 @@ run_suite "$TESTS_DIR/test-deploy-fix-fleet.sh"
run_suite "$TESTS_DIR/test-cloudflare-dns-lib.sh"
run_suite "$TESTS_DIR/test-ops-dns-provision.sh"
run_suite "$TESTS_DIR/test-ops-marketing-dash-brand-isolation.sh"
+run_suite "$TESTS_DIR/test-ops-dash-portfolio-counts.sh"
run_suite "$TESTS_DIR/test-ops-release-changelog-heading.sh"
run_suite "$TESTS_DIR/../templates/statusline/tests/run-tests.sh"
run_suite "$TESTS_DIR/test-registry-schema-skills.sh"
+run_suite "$TESTS_DIR/test-ops-external-registry-classification.sh"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "SUMMARY"
diff --git a/claude-ops/tests/test-ops-dash-portfolio-counts.sh b/claude-ops/tests/test-ops-dash-portfolio-counts.sh
new file mode 100755
index 00000000..182c4409
--- /dev/null
+++ b/claude-ops/tests/test-ops-dash-portfolio-counts.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+# Regression: failed git probes must not leave duplicate numeric output (for example 0\n0).
+set -euo pipefail
+
+PLUGIN_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
+DASH="$PLUGIN_ROOT/bin/ops-dash"
+
+fail=0
+if grep -Eq 'dirty=\$\(.*\|\| echo "?0"?' "$DASH"; then
+ echo "FAIL: dirty probe appends a fallback to partial pipeline output"
+ fail=1
+fi
+if grep -Eq 'ahead=\$\(.*\|\| echo "?0"?' "$DASH"; then
+ echo "FAIL: ahead probe appends a fallback to partial git output"
+ fail=1
+fi
+
+grep -Fq 'dirty=0' "$DASH"
+grep -Fq 'ahead=0' "$DASH"
+
+[ "$fail" -eq 0 ]
+echo "PASS: ops-dash portfolio git counts use assignment fallbacks"
diff --git a/claude-ops/tests/test-ops-external-registry-classification.sh b/claude-ops/tests/test-ops-external-registry-classification.sh
new file mode 100755
index 00000000..3ab5a333
--- /dev/null
+++ b/claude-ops/tests/test-ops-external-registry-classification.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+# Regression: registry `source` is a discovery root, not a git/external flag.
+set -euo pipefail
+
+PLUGIN_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
+TMP="$(mktemp -d)"
+trap 'rm -rf "$TMP"' EXIT
+mkdir -p "$TMP/data"
+printf '{}\n' > "$TMP/data/preferences.json"
+cat > "$TMP/data/registry.json" <<'JSON'
+{
+ "projects": [
+ {"name":"local-app","source":"Developer","path":"/work/local-app"},
+ {"name":"cache-copy","source":".grok","path":"/cache/copy"},
+ {"alias":"docs","source":"notion","type":"external","notion":{"workspace":"acme"}},
+ {"alias":"chat","source":"slack","slack":{"workspace":"acme"}},
+ {"name":"named-custom","source":"custom","type":"external","custom":{}}
+ ]
+}
+JSON
+
+OUT=$(CLAUDE_PLUGIN_DATA_DIR="$TMP/data" "$PLUGIN_ROOT/bin/ops-external")
+[ "$(echo "$OUT" | jq 'length')" -eq 3 ]
+[ "$(echo "$OUT" | jq '[.[].alias] | sort == ["chat","docs","named-custom"]')" = true ]
+[ "$(echo "$OUT" | jq '[.[] | select(.alias == null or .alias == "null")] | length')" -eq 0 ]
+[ "$(echo "$OUT" | jq '[.[] | select(.source == "Developer" or .source == ".grok")] | length')" -eq 0 ]
+[ "$(echo "$OUT" | jq '[.[] | select(.status == "unknown_source")] | length')" -eq 0 ]
+
+echo "PASS: ops-external only selects actual external registry rows"