create-egregore 0.17.4 → 0.18.1

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 (106) hide show
  1. package/assets/egregore-launcher.js +1965 -0
  2. package/assets/egregore-launcher.sh +385 -0
  3. package/bin/cli.js +472 -81
  4. package/lib/api.js +2 -2
  5. package/lib/auth.js +255 -20
  6. package/lib/codex-runtime.js +268 -0
  7. package/lib/commands.js +31 -0
  8. package/lib/context.js +1 -1
  9. package/lib/local.js +616 -189
  10. package/lib/setup.js +822 -84
  11. package/lib/ui.js +780 -84
  12. package/package.json +12 -3
  13. package/runtime/codex/.codex/config.toml +15 -0
  14. package/runtime/codex/.codex/hooks/branch-guard.js +234 -0
  15. package/runtime/codex/.codex/hooks.json +17 -0
  16. package/runtime/codex/.codex/skills/activity/SKILL.md +70 -0
  17. package/runtime/codex/.codex/skills/add/SKILL.md +25 -0
  18. package/runtime/codex/.codex/skills/announce/SKILL.md +54 -0
  19. package/runtime/codex/.codex/skills/answer/SKILL.md +25 -0
  20. package/runtime/codex/.codex/skills/archive/SKILL.md +41 -0
  21. package/runtime/codex/.codex/skills/ask/SKILL.md +59 -0
  22. package/runtime/codex/.codex/skills/branch/SKILL.md +25 -0
  23. package/runtime/codex/.codex/skills/checkup/SKILL.md +41 -0
  24. package/runtime/codex/.codex/skills/commit/SKILL.md +25 -0
  25. package/runtime/codex/.codex/skills/contribute/SKILL.md +25 -0
  26. package/runtime/codex/.codex/skills/dark-mode/SKILL.md +25 -0
  27. package/runtime/codex/.codex/skills/dashboard/SKILL.md +59 -0
  28. package/runtime/codex/.codex/skills/deep-reflect/SKILL.md +70 -0
  29. package/runtime/codex/.codex/skills/delete-user/SKILL.md +25 -0
  30. package/runtime/codex/.codex/skills/egregore-voice/SKILL.md +25 -0
  31. package/runtime/codex/.codex/skills/emissary/SKILL.md +41 -0
  32. package/runtime/codex/.codex/skills/env/SKILL.md +25 -0
  33. package/runtime/codex/.codex/skills/handoff/SKILL.md +67 -0
  34. package/runtime/codex/.codex/skills/harvest/SKILL.md +107 -0
  35. package/runtime/codex/.codex/skills/infra/SKILL.md +41 -0
  36. package/runtime/codex/.codex/skills/ingest/SKILL.md +25 -0
  37. package/runtime/codex/.codex/skills/ingest-google/SKILL.md +25 -0
  38. package/runtime/codex/.codex/skills/ingest-user-interview/SKILL.md +41 -0
  39. package/runtime/codex/.codex/skills/invite/SKILL.md +40 -0
  40. package/runtime/codex/.codex/skills/issue/SKILL.md +41 -0
  41. package/runtime/codex/.codex/skills/me/SKILL.md +25 -0
  42. package/runtime/codex/.codex/skills/meeting/SKILL.md +41 -0
  43. package/runtime/codex/.codex/skills/note/SKILL.md +25 -0
  44. package/runtime/codex/.codex/skills/onboarding/SKILL.md +41 -0
  45. package/runtime/codex/.codex/skills/pr/SKILL.md +25 -0
  46. package/runtime/codex/.codex/skills/project/SKILL.md +41 -0
  47. package/runtime/codex/.codex/skills/pull/SKILL.md +25 -0
  48. package/runtime/codex/.codex/skills/push/SKILL.md +25 -0
  49. package/runtime/codex/.codex/skills/quest/SKILL.md +77 -0
  50. package/runtime/codex/.codex/skills/quest-suggest/SKILL.md +25 -0
  51. package/runtime/codex/.codex/skills/reflect/SKILL.md +41 -0
  52. package/runtime/codex/.codex/skills/review-pr/SKILL.md +41 -0
  53. package/runtime/codex/.codex/skills/save/SKILL.md +62 -0
  54. package/runtime/codex/.codex/skills/setup/SKILL.md +25 -0
  55. package/runtime/codex/.codex/skills/summon/SKILL.md +41 -0
  56. package/runtime/codex/.codex/skills/sync-repos/SKILL.md +25 -0
  57. package/runtime/codex/.codex/skills/telegram-connect/SKILL.md +25 -0
  58. package/runtime/codex/.codex/skills/telemetry/SKILL.md +25 -0
  59. package/runtime/codex/.codex/skills/test/SKILL.md +41 -0
  60. package/runtime/codex/.codex/skills/the-spiral/SKILL.md +84 -0
  61. package/runtime/codex/.codex/skills/todo/SKILL.md +41 -0
  62. package/runtime/codex/.codex/skills/tui-design/SKILL.md +41 -0
  63. package/runtime/codex/.codex/skills/tutorial/SKILL.md +41 -0
  64. package/runtime/codex/.codex/skills/update/SKILL.md +25 -0
  65. package/runtime/codex/.codex/skills/view/SKILL.md +41 -0
  66. package/runtime/codex/.codex/skills/visual-explain/SKILL.md +41 -0
  67. package/runtime/codex/.codex/skills/wrap/SKILL.md +55 -0
  68. package/runtime/codex/.codex/spec-manifest.json +108 -0
  69. package/runtime/codex/AGENTS.md +40 -0
  70. package/runtime/codex/bin/activity-data.sh +177 -0
  71. package/runtime/codex/bin/agent.sh +669 -0
  72. package/runtime/codex/bin/codex-install-skills.sh +78 -0
  73. package/runtime/codex/bin/codex-render-spec.mjs +308 -0
  74. package/runtime/codex/bin/codex-session-start.sh +238 -0
  75. package/runtime/codex/bin/codex-skill-render.mjs +315 -0
  76. package/runtime/codex/bin/codex-sync-skills.sh +223 -0
  77. package/runtime/codex/bin/dashboard-data.sh +174 -0
  78. package/runtime/codex/bin/graph-batch.sh +60 -0
  79. package/runtime/codex/bin/graph-op.sh +380 -0
  80. package/runtime/codex/bin/graph-wal.sh +228 -0
  81. package/runtime/codex/bin/graph.sh +141 -0
  82. package/runtime/codex/bin/handoff-pr-backfill.sh +86 -0
  83. package/runtime/codex/bin/handoff-run.sh +431 -0
  84. package/runtime/codex/bin/handoff-save-egregore.sh +131 -0
  85. package/runtime/codex/bin/index-handoff.sh +306 -0
  86. package/runtime/codex/bin/lib/artifact-id.sh +46 -0
  87. package/runtime/codex/bin/lib/config.sh +71 -0
  88. package/runtime/codex/bin/lib/context.sh +463 -0
  89. package/runtime/codex/bin/lib/dashboard-artifact.sh +142 -0
  90. package/runtime/codex/bin/lib/ensure-develop.sh +183 -0
  91. package/runtime/codex/bin/lib/git-sync.sh +262 -0
  92. package/runtime/codex/bin/lib/greeting.sh +414 -0
  93. package/runtime/codex/bin/lib/hash.sh +13 -0
  94. package/runtime/codex/bin/lib/identity.sh +164 -0
  95. package/runtime/codex/bin/lib/permissions.sh +106 -0
  96. package/runtime/codex/bin/lib/time.sh +56 -0
  97. package/runtime/codex/bin/lib/worktree-links.sh +54 -0
  98. package/runtime/codex/bin/notify.sh +207 -0
  99. package/runtime/codex/bin/publish-artifact.sh +173 -0
  100. package/runtime/codex/bin/publish-references.sh +144 -0
  101. package/runtime/codex/bin/repo-state.sh +99 -0
  102. package/runtime/codex/bin/telemetry.sh +350 -0
  103. package/runtime/codex/bin/worktree-create.sh +118 -0
  104. package/runtime/codex/bin/worktree-remove.sh +50 -0
  105. package/runtime/codex/bin/worktree.sh +198 -0
  106. package/runtime/codex/manifest.json +155 -0
@@ -0,0 +1,177 @@
1
+ #!/bin/bash
2
+ # Fetches all activity dashboard data: single API call + parallel git/disk ops.
3
+ # Usage: bash bin/activity-data.sh [username]
4
+ # Returns a single JSON object with all query results.
5
+
6
+ SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
7
+ TMPDIR=$(mktemp -d)
8
+ trap "rm -rf $TMPDIR" EXIT
9
+
10
+ # --- Read config ---
11
+ API_URL=$(jq -r '.api_url // empty' "$SCRIPT_DIR/egregore.json" 2>/dev/null)
12
+ API_KEY=$(grep '^EGREGORE_API_KEY=' "$SCRIPT_DIR/.env" 2>/dev/null | cut -d'=' -f2-)
13
+ ORG=$(jq -r '.org_name // "Egregore"' "$SCRIPT_DIR/egregore.json" 2>/dev/null || echo "Egregore")
14
+ DATE=$(date '+%b %d')
15
+
16
+ # --- Detect user ---
17
+ GH_USER="${1:-}"
18
+ if [ -z "$GH_USER" ]; then
19
+ STATE_FILE="$SCRIPT_DIR/.egregore-state.json"
20
+ if [ -f "$STATE_FILE" ]; then
21
+ GH_USER=$(jq -r '.github_username // empty' "$STATE_FILE" 2>/dev/null)
22
+ fi
23
+ if [ -z "$GH_USER" ]; then
24
+ GH_USER=$(git -C "$SCRIPT_DIR" config user.name 2>/dev/null || echo "unknown")
25
+ fi
26
+ fi
27
+
28
+ EMPTY='{"fields":[],"values":[]}'
29
+
30
+ # --- Fire API call + git/disk ops in parallel ---
31
+
32
+ # Graph data: single API call (all queries run server-side)
33
+ (
34
+ GRAPH_STATUS="offline"
35
+ GRAPH_REASON=""
36
+ if [ -z "$API_URL" ] || [ -z "$API_KEY" ]; then
37
+ GRAPH_REASON="missing_config"
38
+ else
39
+ # Store HTTP status code alongside response body
40
+ HTTP_CODE=$(curl -s -o "$TMPDIR/activity_raw.json" -w "%{http_code}" \
41
+ "${API_URL}/api/activity/dashboard?github_username=$(printf '%s' "$GH_USER" | jq -sRr @uri)" \
42
+ -H "Authorization: Bearer $API_KEY" \
43
+ --connect-timeout 5 --max-time 15 2>/dev/null || echo "000")
44
+
45
+ if [ "$HTTP_CODE" = "000" ]; then
46
+ GRAPH_REASON="unreachable"
47
+ elif [ "$HTTP_CODE" = "401" ] || [ "$HTTP_CODE" = "403" ]; then
48
+ GRAPH_REASON="auth_error"
49
+ elif [ "$HTTP_CODE" -ge 500 ] 2>/dev/null; then
50
+ GRAPH_REASON="server_error"
51
+ elif [ -s "$TMPDIR/activity_raw.json" ] && jq -e '.me' "$TMPDIR/activity_raw.json" >/dev/null 2>&1; then
52
+ cp "$TMPDIR/activity_raw.json" "$TMPDIR/activity.json"
53
+ GRAPH_STATUS="connected"
54
+ else
55
+ GRAPH_REASON="invalid_response"
56
+ fi
57
+ fi
58
+
59
+ # If not connected, write status-only response
60
+ if [ "$GRAPH_STATUS" != "connected" ]; then
61
+ jq -n --arg status "$GRAPH_STATUS" --arg reason "$GRAPH_REASON" \
62
+ '{graph_status: $status, graph_reason: $reason}' > "$TMPDIR/activity.json"
63
+ else
64
+ # Inject graph_status into successful response
65
+ jq --arg status "$GRAPH_STATUS" '. + {graph_status: $status}' \
66
+ "$TMPDIR/activity.json" > "$TMPDIR/activity_merged.json" \
67
+ && mv "$TMPDIR/activity_merged.json" "$TMPDIR/activity.json"
68
+ fi
69
+ ) &
70
+ API_PID=$!
71
+
72
+ # Git/disk: runs in parallel (stays client-side)
73
+ (
74
+ # Sync
75
+ git -C "$SCRIPT_DIR" fetch origin --quiet 2>/dev/null || true
76
+ CURRENT=$(git -C "$SCRIPT_DIR" branch --show-current 2>/dev/null || echo "unknown")
77
+ if [ "$CURRENT" != "develop" ]; then
78
+ git -C "$SCRIPT_DIR" fetch origin develop:develop --quiet 2>/dev/null || true
79
+ fi
80
+ if [[ "$CURRENT" == dev/* ]]; then
81
+ git -C "$SCRIPT_DIR" rebase develop --quiet >/dev/null 2>&1 || git -C "$SCRIPT_DIR" rebase --abort >/dev/null 2>&1 || true
82
+ fi
83
+
84
+ # Memory sync
85
+ if [ -d "$SCRIPT_DIR/memory/.git" ] || [ -L "$SCRIPT_DIR/memory" ]; then
86
+ git -C "$SCRIPT_DIR/memory" fetch origin main --quiet 2>/dev/null || true
87
+ LOCAL=$(git -C "$SCRIPT_DIR/memory" rev-parse HEAD 2>/dev/null || echo "")
88
+ REMOTE=$(git -C "$SCRIPT_DIR/memory" rev-parse origin/main 2>/dev/null || echo "")
89
+ if [ -n "$LOCAL" ] && [ -n "$REMOTE" ] && [ "$LOCAL" != "$REMOTE" ]; then
90
+ git -C "$SCRIPT_DIR/memory" pull origin main --quiet 2>/dev/null || true
91
+ fi
92
+ fi
93
+
94
+ # PRs
95
+ PRS=$(cd "$SCRIPT_DIR" && gh pr list --base develop --state open --json number,title,author 2>/dev/null || echo "[]")
96
+ echo "$PRS" > "$TMPDIR/prs.json"
97
+
98
+ # Disk cross-reference
99
+ MONTH=$(date +%Y-%m)
100
+ TODAY=$(date +%d)
101
+ YESTERDAY=$(date -v-1d +%d 2>/dev/null || date -d 'yesterday' +%d 2>/dev/null || echo "00")
102
+ HANDOFFS=$(ls -1 "$SCRIPT_DIR/memory/handoffs/$MONTH/" 2>/dev/null | grep "^${TODAY}-\|^${YESTERDAY}-" 2>/dev/null | head -10 || echo "")
103
+ echo "$HANDOFFS" > "$TMPDIR/disk_handoffs.txt"
104
+
105
+ DECISIONS=$(ls -1t "$SCRIPT_DIR/memory/knowledge/decisions/" 2>/dev/null | head -5 || echo "")
106
+ echo "$DECISIONS" > "$TMPDIR/disk_decisions.txt"
107
+ ) &
108
+ GIT_PID=$!
109
+
110
+ # Local sessions: parse memory files when graph is offline (parallel)
111
+ (
112
+ GH_LC=$(echo "$GH_USER" | tr '[:upper:]' '[:lower:]')
113
+ DISPLAY_LC=""
114
+ if [ -f "$SCRIPT_DIR/.egregore-state.json" ]; then
115
+ DISPLAY_LC=$(jq -r '.display_name // empty' "$SCRIPT_DIR/.egregore-state.json" 2>/dev/null | tr '[:upper:]' '[:lower:]')
116
+ fi
117
+
118
+ CUTOFF=$(date -v-14d +%Y-%m-%d 2>/dev/null || date -d '14 days ago' +%Y-%m-%d 2>/dev/null || echo "2000-01-01")
119
+ MY="[]"
120
+ TEAM="[]"
121
+
122
+ # Scan sessions, wraps, and handoffs
123
+ ALL_ENTRIES=""
124
+ for DIR in "$SCRIPT_DIR/memory/sessions" "$SCRIPT_DIR/memory/wraps" "$SCRIPT_DIR/memory/handoffs"; do
125
+ [ -d "$DIR" ] || continue
126
+ TYPE=$(basename "$DIR")
127
+ find -L "$DIR" -name '*.md' -not -name 'index*' -type f 2>/dev/null | xargs ls -t 2>/dev/null | head -20 | while read -r MFILE; do
128
+ [ -z "$MFILE" ] && continue
129
+ M_AUTH=$(head -10 "$MFILE" 2>/dev/null | grep -m1 '^\*\*Author\*\*:' | sed 's/^\*\*Author\*\*:[[:space:]]*//')
130
+ M_DATE=$(head -10 "$MFILE" 2>/dev/null | grep -m1 '^\*\*Date\*\*:' | sed 's/^\*\*Date\*\*:[[:space:]]*//')
131
+ M_BRANCH=$(head -10 "$MFILE" 2>/dev/null | grep -m1 '^\*\*Branch\*\*:' | sed 's/^\*\*Branch\*\*:[[:space:]]*//')
132
+ M_DURATION=$(head -10 "$MFILE" 2>/dev/null | grep -m1 '^\*\*Duration\*\*:' | sed 's/^\*\*Duration\*\*:[[:space:]]*//')
133
+ M_TOPIC=$(head -3 "$MFILE" 2>/dev/null | grep -m1 '^# ' | sed 's/^# [^:]*:[[:space:]]*//')
134
+ [ -z "$M_AUTH" ] && continue
135
+ # Date filter
136
+ M_DAY="${M_DATE%%T*}"
137
+ [ -n "$M_DAY" ] && [ "$M_DAY" \< "$CUTOFF" ] && continue
138
+ echo "${M_AUTH}|${M_DATE}|${M_BRANCH}|${M_TOPIC}|${M_DURATION}|${TYPE}"
139
+ done
140
+ done | jq -Rn --arg gh "$GH_LC" --arg dn "$DISPLAY_LC" '
141
+ [inputs | split("|") |
142
+ {author: .[0], date: .[1], branch: .[2], topic: .[3], duration: .[4], type: .[5]}
143
+ ] | {
144
+ my_sessions: [.[] | select((.author | ascii_downcase) == $gh or (.author | ascii_downcase) == $dn) | select($dn != "" or (.author | ascii_downcase) == $gh)],
145
+ team_sessions: [.[] | select((.author | ascii_downcase) != $gh and (if $dn != "" then (.author | ascii_downcase) != $dn else true end))]
146
+ }
147
+ ' 2>/dev/null > "$TMPDIR/local_sessions.json" || echo '{"my_sessions":[],"team_sessions":[]}' > "$TMPDIR/local_sessions.json"
148
+ ) &
149
+ LOCAL_PID=$!
150
+
151
+ # --- Wait for all ---
152
+ wait $API_PID $GIT_PID $LOCAL_PID 2>/dev/null || true
153
+
154
+ # --- Read results ---
155
+ PRS=$(cat "$TMPDIR/prs.json" 2>/dev/null || echo "[]")
156
+ echo "$PRS" | jq . >/dev/null 2>&1 || PRS="[]"
157
+ DISK_HANDOFFS=$(cat "$TMPDIR/disk_handoffs.txt" 2>/dev/null || echo "")
158
+ DISK_DECISIONS=$(cat "$TMPDIR/disk_decisions.txt" 2>/dev/null || echo "")
159
+ LOCAL_SESSIONS=$(cat "$TMPDIR/local_sessions.json" 2>/dev/null || echo '{"my_sessions":[],"team_sessions":[]}')
160
+ echo "$LOCAL_SESSIONS" | jq . >/dev/null 2>&1 || LOCAL_SESSIONS='{"my_sessions":[],"team_sessions":[]}'
161
+
162
+ # --- Merge server response + local git/disk data ---
163
+ jq -n \
164
+ --arg org "$ORG" \
165
+ --arg date "$DATE" \
166
+ --slurpfile activity "$TMPDIR/activity.json" \
167
+ --argjson prs "$PRS" \
168
+ --arg disk_handoffs "$DISK_HANDOFFS" \
169
+ --arg disk_decisions "$DISK_DECISIONS" \
170
+ --argjson local_sessions "$LOCAL_SESSIONS" \
171
+ '$activity[0] + {
172
+ org: $org,
173
+ date: $date,
174
+ prs: $prs,
175
+ disk: {handoffs: $disk_handoffs, decisions: $disk_decisions},
176
+ local_sessions: $local_sessions
177
+ }'