create-egregore 0.19.21 → 0.19.23
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/assets/egregore-launcher.js +29 -3
- package/bin/cli.js +3 -4
- package/lib/auth.js +3 -4
- package/lib/path-lookup.js +59 -0
- package/lib/setup.js +52 -6
- package/package.json +2 -2
- package/runtime/codex/.claude/context/notification-consent.md +66 -0
- package/runtime/codex/.codex/hooks/branch-guard.js +14 -3
- package/runtime/codex/.codex/skills/add/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/announce/SKILL.md +21 -8
- package/runtime/codex/.codex/skills/answer/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/archive/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/ask/SKILL.md +14 -6
- package/runtime/codex/.codex/skills/audit/SKILL.md +29 -0
- package/runtime/codex/.codex/skills/autosave/SKILL.md +29 -0
- package/runtime/codex/.codex/skills/branch/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/checkup/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/commit/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/contribute/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/dark-mode/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/delete-user/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/demo-mode/SKILL.md +29 -0
- package/runtime/codex/.codex/skills/deploy-bridge/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/design/SKILL.md +29 -0
- package/runtime/codex/.codex/skills/egregore-voice/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/emissary/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/env/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/handoff/SKILL.md +81 -10
- package/runtime/codex/.codex/skills/harvest/QUESTION_PALETTE.md +76 -0
- package/runtime/codex/.codex/skills/harvest/SKILL.md +30 -6
- package/runtime/codex/.codex/skills/ingest/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/ingest-google/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/ingest-user-interview/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/invite/SKILL.md +6 -2
- package/runtime/codex/.codex/skills/issue/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/me/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/meeting/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/minion/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/mock/SKILL.md +29 -0
- package/runtime/codex/.codex/skills/note/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/onboarding/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/pr/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/product-voice/SKILL.md +29 -0
- package/runtime/codex/.codex/skills/project/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/pull/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/push/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/quest/SKILL.md +6 -3
- package/runtime/codex/.codex/skills/quest-suggest/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/reflect/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/review-pr/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/save/SKILL.md +6 -4
- package/runtime/codex/.codex/skills/scroll/SKILL.md +92 -23
- package/runtime/codex/.codex/skills/scroll/assets/shell.html +381 -52
- package/runtime/codex/.codex/skills/session-view/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/setup/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/summon/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/sync-repos/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/task/SKILL.md +9 -5
- package/runtime/codex/.codex/skills/teams-connect/SKILL.md +29 -0
- package/runtime/codex/.codex/skills/telegram-connect/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/telemetry/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/test/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/thread/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/todo/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/tui-design/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/tutorial/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/update/SKILL.md +8 -4
- package/runtime/codex/.codex/skills/visual-explain/SKILL.md +8 -4
- package/runtime/codex/.codex/spec-manifest.json +4 -4
- package/runtime/codex/AGENTS.md +36 -14
- package/runtime/codex/bin/activity-data.sh +1 -1
- package/runtime/codex/bin/agent.sh +38 -19
- package/runtime/codex/bin/attendant.sh +8 -2
- package/runtime/codex/bin/autosave.sh +1 -1
- package/runtime/codex/bin/capture-reconcile.sh +8 -6
- package/runtime/codex/bin/capture-run.sh +1 -1
- package/runtime/codex/bin/codex-install-skills.sh +1 -1
- package/runtime/codex/bin/codex-render-spec.mjs +12 -5
- package/runtime/codex/bin/codex-session-start.sh +1 -1
- package/runtime/codex/bin/codex-skill-render.mjs +5 -0
- package/runtime/codex/bin/codex-sync-skills.sh +9 -5
- package/runtime/codex/bin/dashboard-data.sh +1 -1
- package/runtime/codex/bin/graph-batch.sh +1 -1
- package/runtime/codex/bin/graph-op.sh +1 -1
- package/runtime/codex/bin/graph-wal.sh +1 -1
- package/runtime/codex/bin/graph.sh +1 -1
- package/runtime/codex/bin/handoff-pr-backfill.sh +1 -1
- package/runtime/codex/bin/handoff-run.sh +117 -119
- package/runtime/codex/bin/handoff-save-egregore.sh +62 -32
- package/runtime/codex/bin/index-handoff.sh +3 -2
- package/runtime/codex/bin/ingest-graph.sh +1 -1
- package/runtime/codex/bin/ingest.sh +1 -1
- package/runtime/codex/bin/lib/artifact-id.sh +1 -1
- package/runtime/codex/bin/lib/config.sh +56 -20
- package/runtime/codex/bin/lib/context.sh +7 -1
- package/runtime/codex/bin/lib/ensure-develop.sh +1 -1
- package/runtime/codex/bin/lib/git-sync.sh +145 -59
- package/runtime/codex/bin/lib/greeting.sh +14 -0
- package/runtime/codex/bin/lib/hash.sh +1 -1
- package/runtime/codex/bin/lib/noncode.sh +1 -1
- package/runtime/codex/bin/lib/time.sh +1 -1
- package/runtime/codex/bin/notify.sh +492 -153
- package/runtime/codex/bin/person.sh +1 -1
- package/runtime/codex/bin/publish-artifact.sh +64 -8
- package/runtime/codex/bin/publish-references.sh +1 -1
- package/runtime/codex/bin/repo-state.sh +7 -10
- package/runtime/codex/bin/search.sh +1 -1
- package/runtime/codex/bin/session-autosave.sh +1 -1
- package/runtime/codex/bin/session-log.sh +1 -1
- package/runtime/codex/bin/settings.sh +32 -2
- package/runtime/codex/bin/telemetry.sh +1 -1
- package/runtime/codex/bin/worktree-create.sh +14 -4
- package/runtime/codex/bin/worktree-remove.sh +1 -1
- package/runtime/codex/bin/worktree.sh +1 -1
- package/runtime/codex/manifest.json +18 -1
- package/runtime/pi/.claude/context/notification-consent.md +66 -0
- package/runtime/pi/.codex/hooks/branch-guard.js +14 -3
- package/runtime/pi/.codex/skills/add/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/announce/SKILL.md +21 -8
- package/runtime/pi/.codex/skills/answer/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/archive/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/ask/SKILL.md +14 -6
- package/runtime/pi/.codex/skills/audit/SKILL.md +29 -0
- package/runtime/pi/.codex/skills/autosave/SKILL.md +29 -0
- package/runtime/pi/.codex/skills/branch/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/checkup/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/commit/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/contribute/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/dark-mode/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/delete-user/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/demo-mode/SKILL.md +29 -0
- package/runtime/pi/.codex/skills/deploy-bridge/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/design/SKILL.md +29 -0
- package/runtime/pi/.codex/skills/egregore-voice/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/emissary/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/env/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/handoff/SKILL.md +81 -10
- package/runtime/pi/.codex/skills/harvest/QUESTION_PALETTE.md +76 -0
- package/runtime/pi/.codex/skills/harvest/SKILL.md +30 -6
- package/runtime/pi/.codex/skills/ingest/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/ingest-google/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/ingest-user-interview/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/invite/SKILL.md +6 -2
- package/runtime/pi/.codex/skills/issue/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/me/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/meeting/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/minion/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/mock/SKILL.md +29 -0
- package/runtime/pi/.codex/skills/note/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/onboarding/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/pr/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/product-voice/SKILL.md +29 -0
- package/runtime/pi/.codex/skills/project/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/pull/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/push/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/quest/SKILL.md +6 -3
- package/runtime/pi/.codex/skills/quest-suggest/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/reflect/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/review-pr/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/save/SKILL.md +6 -4
- package/runtime/pi/.codex/skills/scroll/SKILL.md +92 -23
- package/runtime/pi/.codex/skills/scroll/assets/shell.html +381 -52
- package/runtime/pi/.codex/skills/session-view/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/setup/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/summon/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/sync-repos/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/task/SKILL.md +9 -5
- package/runtime/pi/.codex/skills/teams-connect/SKILL.md +29 -0
- package/runtime/pi/.codex/skills/telegram-connect/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/telemetry/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/test/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/thread/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/todo/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/tui-design/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/tutorial/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/update/SKILL.md +8 -4
- package/runtime/pi/.codex/skills/visual-explain/SKILL.md +8 -4
- package/runtime/pi/.codex/spec-manifest.json +4 -4
- package/runtime/pi/.pi/APPEND_SYSTEM.md +34 -12
- package/runtime/pi/.pi/extensions/egregore.ts +8 -1
- package/runtime/pi/.pi/spec-manifest.json +2 -2
- package/runtime/pi/AGENTS.md +36 -14
- package/runtime/pi/bin/activity-data.sh +1 -1
- package/runtime/pi/bin/agent.sh +38 -19
- package/runtime/pi/bin/attendant.sh +8 -2
- package/runtime/pi/bin/autosave.sh +1 -1
- package/runtime/pi/bin/capture-reconcile.sh +8 -6
- package/runtime/pi/bin/capture-run.sh +1 -1
- package/runtime/pi/bin/codex-install-skills.sh +1 -1
- package/runtime/pi/bin/codex-render-spec.mjs +12 -5
- package/runtime/pi/bin/codex-session-start.sh +1 -1
- package/runtime/pi/bin/codex-skill-render.mjs +5 -0
- package/runtime/pi/bin/codex-sync-skills.sh +9 -5
- package/runtime/pi/bin/dashboard-data.sh +1 -1
- package/runtime/pi/bin/graph-batch.sh +1 -1
- package/runtime/pi/bin/graph-op.sh +1 -1
- package/runtime/pi/bin/graph-wal.sh +1 -1
- package/runtime/pi/bin/graph.sh +1 -1
- package/runtime/pi/bin/handoff-pr-backfill.sh +1 -1
- package/runtime/pi/bin/handoff-run.sh +117 -119
- package/runtime/pi/bin/handoff-save-egregore.sh +62 -32
- package/runtime/pi/bin/index-handoff.sh +3 -2
- package/runtime/pi/bin/ingest-graph.sh +1 -1
- package/runtime/pi/bin/ingest.sh +1 -1
- package/runtime/pi/bin/lib/artifact-id.sh +1 -1
- package/runtime/pi/bin/lib/config.sh +56 -20
- package/runtime/pi/bin/lib/context.sh +7 -1
- package/runtime/pi/bin/lib/ensure-develop.sh +1 -1
- package/runtime/pi/bin/lib/git-sync.sh +145 -59
- package/runtime/pi/bin/lib/greeting.sh +14 -0
- package/runtime/pi/bin/lib/hash.sh +1 -1
- package/runtime/pi/bin/lib/noncode.sh +1 -1
- package/runtime/pi/bin/lib/time.sh +1 -1
- package/runtime/pi/bin/notify.sh +492 -153
- package/runtime/pi/bin/person.sh +1 -1
- package/runtime/pi/bin/pi-product-workflows.mjs +14 -5
- package/runtime/pi/bin/pi-session-start.sh +1 -1
- package/runtime/pi/bin/publish-artifact.sh +64 -8
- package/runtime/pi/bin/publish-references.sh +1 -1
- package/runtime/pi/bin/repo-state.sh +7 -10
- package/runtime/pi/bin/search.sh +1 -1
- package/runtime/pi/bin/session-autosave.sh +1 -1
- package/runtime/pi/bin/session-log.sh +1 -1
- package/runtime/pi/bin/settings.sh +32 -2
- package/runtime/pi/bin/telemetry.sh +1 -1
- package/runtime/pi/bin/worktree-create.sh +14 -4
- package/runtime/pi/bin/worktree-remove.sh +1 -1
- package/runtime/pi/bin/worktree.sh +1 -1
- package/runtime/pi/manifest.json +18 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
#!/bin/bash
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
2
|
# handoff-save-egregore.sh — background save+auto-merge for the core repo after a handoff.
|
|
3
3
|
#
|
|
4
4
|
# /handoff renders its card first, then fires this detached. The user never waits on git.
|
|
5
5
|
#
|
|
6
6
|
# Behavior:
|
|
7
7
|
# - If nothing to save (clean working tree + up-to-date with origin) → exit silently.
|
|
8
|
-
# - If on
|
|
9
|
-
#
|
|
10
|
-
# -
|
|
8
|
+
# - If on the configured base (or another protected branch) → create a
|
|
9
|
+
# dev/{author}/handoff-{YYYY-MM-DD} branch from origin/{base}.
|
|
10
|
+
# - Commit all changes, rebase onto origin/{base}, push.
|
|
11
|
+
# - If push succeeds: create a PR to the configured base (or reuse existing), then:
|
|
11
12
|
# - Markdown-only diff → `gh pr merge --auto --merge` (auto-merges when checks pass).
|
|
12
13
|
# - Code/config present → leave PR open for review (no auto-merge).
|
|
13
14
|
#
|
|
@@ -45,9 +46,19 @@ while [ $# -gt 0 ]; do
|
|
|
45
46
|
done
|
|
46
47
|
|
|
47
48
|
case "$KIND" in
|
|
48
|
-
autosave)
|
|
49
|
-
|
|
49
|
+
autosave)
|
|
50
|
+
MSG_PREFIX="Auto-save"
|
|
51
|
+
PR_WHAT="Save session content captured by the opted-in autosave workflow."
|
|
52
|
+
PR_WHY="This preserves unattended non-coding work without requiring an explicit /save."
|
|
53
|
+
;;
|
|
54
|
+
*)
|
|
55
|
+
MSG_PREFIX="Handoff"
|
|
56
|
+
PR_WHAT="Save core-repository session work captured when the handoff was created."
|
|
57
|
+
PR_WHY="The handoff records shared context immediately; this companion PR keeps the originating checkout's work from remaining only local."
|
|
58
|
+
;;
|
|
50
59
|
esac
|
|
60
|
+
PR_BODY=$(printf '## What\n\n- %s\n\n## Why\n\n%s Topic: `%s`.\n\n## Verification\n\nNot verified — background %s save; review code or configuration changes before merging.\n\n🤖 Saved via `bin/handoff-save-egregore.sh`\n' \
|
|
61
|
+
"$PR_WHAT" "$PR_WHY" "$TOPIC" "$KIND")
|
|
51
62
|
|
|
52
63
|
[ -n "$AUTHOR" ] || { echo "handoff-save-egregore: missing author" >&2; exit 1; }
|
|
53
64
|
|
|
@@ -56,6 +67,22 @@ SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
|
56
67
|
[ -z "$REPO_DIR" ] && REPO_DIR="$SCRIPT_DIR"
|
|
57
68
|
cd "$REPO_DIR" || exit 1
|
|
58
69
|
|
|
70
|
+
# Resolve the target checkout's configured integration branch. SCRIPT_DIR points
|
|
71
|
+
# at the framework that owns this helper, while CONFIG must follow --repo-dir so
|
|
72
|
+
# sandboxed and installed instances read their own egregore.json.
|
|
73
|
+
CONFIG="$REPO_DIR/egregore.json"
|
|
74
|
+
[ -f "$SCRIPT_DIR/bin/lib/config.sh" ] || {
|
|
75
|
+
echo "handoff-save-egregore: base-branch resolver is unavailable" >&2
|
|
76
|
+
exit 1
|
|
77
|
+
}
|
|
78
|
+
# shellcheck source=bin/lib/config.sh
|
|
79
|
+
. "$SCRIPT_DIR/bin/lib/config.sh" 2>/dev/null || exit 1
|
|
80
|
+
if ! BASE_BRANCH=$(_get_base_branch); then
|
|
81
|
+
echo "handoff-save-egregore: could not resolve the configured base branch" >&2
|
|
82
|
+
exit 1
|
|
83
|
+
fi
|
|
84
|
+
BASE_REF="origin/$BASE_BRANCH"
|
|
85
|
+
|
|
59
86
|
# Shared safe-staging guard — never auto-commit stray sibling-repo gitlinks.
|
|
60
87
|
# shellcheck source=bin/lib/git-safe.sh
|
|
61
88
|
. "$SCRIPT_DIR/bin/lib/git-safe.sh" 2>/dev/null || true
|
|
@@ -65,7 +92,7 @@ type git_add_guarded >/dev/null 2>&1 || git_add_guarded() { git add -A 2>/dev/nu
|
|
|
65
92
|
# shellcheck source=bin/lib/noncode.sh
|
|
66
93
|
. "$SCRIPT_DIR/bin/lib/noncode.sh" 2>/dev/null || true
|
|
67
94
|
type noncode_blockers >/dev/null 2>&1 || noncode_blockers() {
|
|
68
|
-
git -C "${2:-.}" diff "${1
|
|
95
|
+
git -C "${2:-.}" diff "${1:-$BASE_REF}...HEAD" --name-only 2>/dev/null | grep -v '\.md$' | head -1 || true
|
|
69
96
|
}
|
|
70
97
|
|
|
71
98
|
# --- Early exit if nothing to do -----------------------------------------
|
|
@@ -75,9 +102,12 @@ DIRTY=0
|
|
|
75
102
|
CURRENT_BRANCH=$(git branch --show-current 2>/dev/null || echo "")
|
|
76
103
|
AHEAD=0
|
|
77
104
|
if [ -n "$CURRENT_BRANCH" ]; then
|
|
78
|
-
#
|
|
79
|
-
#
|
|
80
|
-
|
|
105
|
+
# A missing remote base is not evidence that there is nothing to save. The
|
|
106
|
+
# former `|| echo 0` made a main-only instance silently discard clean,
|
|
107
|
+
# committed topic work because origin/develop did not exist.
|
|
108
|
+
if ! AHEAD=$(git rev-list --count "$BASE_REF..HEAD" 2>/dev/null); then
|
|
109
|
+
AHEAD=1
|
|
110
|
+
fi
|
|
81
111
|
fi
|
|
82
112
|
|
|
83
113
|
if [ "$DIRTY" = "0" ] && [ "$AHEAD" = "0" ]; then
|
|
@@ -85,18 +115,18 @@ if [ "$DIRTY" = "0" ] && [ "$AHEAD" = "0" ]; then
|
|
|
85
115
|
fi
|
|
86
116
|
|
|
87
117
|
# --- Protect the protected branches: create a working branch if needed --
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
118
|
+
if [ -z "$CURRENT_BRANCH" ] || [ "$CURRENT_BRANCH" = "$BASE_BRANCH" ] \
|
|
119
|
+
|| [ "$CURRENT_BRANCH" = "develop" ] || [ "$CURRENT_BRANCH" = "main" ] \
|
|
120
|
+
|| [ "$CURRENT_BRANCH" = "master" ]; then
|
|
121
|
+
SLUG_DATE=$(date +%Y-%m-%d)
|
|
122
|
+
# --branch-suffix keeps concurrent rescues distinct (e.g. per-checkout
|
|
123
|
+
# hash from the autosave sweep) — same-name pushes wedge on non-FF.
|
|
124
|
+
NEW_BRANCH="dev/${AUTHOR}/${KIND}-${SLUG_DATE}${BRANCH_SUFFIX:+-$BRANCH_SUFFIX}"
|
|
125
|
+
git fetch origin "$BASE_BRANCH" --quiet 2>/dev/null || true
|
|
126
|
+
git checkout -b "$NEW_BRANCH" "$BASE_REF" --quiet 2>/dev/null || \
|
|
127
|
+
git checkout "$NEW_BRANCH" --quiet 2>/dev/null || exit 0
|
|
128
|
+
CURRENT_BRANCH="$NEW_BRANCH"
|
|
129
|
+
fi
|
|
100
130
|
|
|
101
131
|
# --- Commit whatever is uncommitted --------------------------------------
|
|
102
132
|
if [ -n "$(git status --porcelain 2>/dev/null)" ]; then
|
|
@@ -104,11 +134,11 @@ if [ -n "$(git status --porcelain 2>/dev/null)" ]; then
|
|
|
104
134
|
git commit -m "${MSG_PREFIX}: ${TOPIC}" --quiet 2>/dev/null || true
|
|
105
135
|
fi
|
|
106
136
|
|
|
107
|
-
# --- Rebase onto
|
|
108
|
-
git fetch origin
|
|
109
|
-
if ! git rebase
|
|
137
|
+
# --- Rebase onto the configured base, fall back to merge on conflicts ----
|
|
138
|
+
git fetch origin "$BASE_BRANCH" --quiet 2>/dev/null || true
|
|
139
|
+
if ! git rebase "$BASE_REF" --quiet 2>/dev/null; then
|
|
110
140
|
git rebase --abort 2>/dev/null || true
|
|
111
|
-
if ! git merge
|
|
141
|
+
if ! git merge "$BASE_REF" --quiet -m "Sync with $BASE_BRANCH" 2>/dev/null; then
|
|
112
142
|
# Conflicts we can't auto-resolve. Leave the branch as-is; the user will see it
|
|
113
143
|
# next session or when they run /save explicitly.
|
|
114
144
|
git merge --abort 2>/dev/null || true
|
|
@@ -128,7 +158,7 @@ fi
|
|
|
128
158
|
LEDGER="${EGREGORE_AUTOSAVE_LOG:-$HOME/.egregore/autosave.log}"
|
|
129
159
|
ledger_write() { # pr outcome
|
|
130
160
|
local n_files
|
|
131
|
-
n_files=$(git diff
|
|
161
|
+
n_files=$(git diff "$BASE_REF...HEAD" --name-only 2>/dev/null | grep -c . || echo 0)
|
|
132
162
|
mkdir -p "$(dirname "$LEDGER")" 2>/dev/null || true
|
|
133
163
|
printf '%s|%s|%s|%s|%s|%s|%s\n' \
|
|
134
164
|
"$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$KIND" "$REPO_DIR" "$CURRENT_BRANCH" \
|
|
@@ -145,15 +175,15 @@ EXISTING_BASE=$(echo "$EXISTING" | jq -r '.baseRefName // empty' 2>/dev/null)
|
|
|
145
175
|
|
|
146
176
|
if [ -n "$EXISTING_NUMBER" ]; then
|
|
147
177
|
PR_NUMBER="$EXISTING_NUMBER"
|
|
148
|
-
if [ "$EXISTING_BASE" != "
|
|
149
|
-
gh pr edit "$PR_NUMBER" --base
|
|
178
|
+
if [ "$EXISTING_BASE" != "$BASE_BRANCH" ]; then
|
|
179
|
+
gh pr edit "$PR_NUMBER" --base "$BASE_BRANCH" >/dev/null 2>&1 || true
|
|
150
180
|
fi
|
|
151
181
|
else
|
|
152
182
|
PR_URL=$(gh pr create \
|
|
153
|
-
--base
|
|
183
|
+
--base "$BASE_BRANCH" \
|
|
154
184
|
--head "$CURRENT_BRANCH" \
|
|
155
185
|
--title "${MSG_PREFIX}: ${TOPIC}" \
|
|
156
|
-
--body "$
|
|
186
|
+
--body "$PR_BODY" \
|
|
157
187
|
2>/dev/null || echo "")
|
|
158
188
|
PR_NUMBER=$(echo "$PR_URL" | grep -oE '[0-9]+$' || echo "")
|
|
159
189
|
fi
|
|
@@ -167,7 +197,7 @@ fi
|
|
|
167
197
|
# pending; on a repo with no branch protection it always errors. Fall back to
|
|
168
198
|
# an immediate merge so non-coding PRs never sit open.
|
|
169
199
|
OUTCOME="open"
|
|
170
|
-
NON_CODE_BLOCKER=$(noncode_blockers
|
|
200
|
+
NON_CODE_BLOCKER=$(noncode_blockers "$BASE_REF" .)
|
|
171
201
|
if [ -z "$NON_CODE_BLOCKER" ]; then
|
|
172
202
|
if [ "$PUBLISH" = "gate" ]; then
|
|
173
203
|
OUTCOME="staged"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/bin/bash
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
4
|
# Index a single handoff file into the Neo4j graph.
|
|
@@ -119,11 +119,12 @@ AUTHOR="$(md_field 'Author')"
|
|
|
119
119
|
AUTHOR_HANDLE="$(echo "$AUTHOR" | sed 's/[[:space:]]*→.*//' | awk '{print tolower($1)}')"
|
|
120
120
|
[ -z "$AUTHOR_HANDLE" ] && AUTHOR_HANDLE="unknown"
|
|
121
121
|
|
|
122
|
-
# Recipients: try markdown header
|
|
122
|
+
# Recipients: try markdown header, then canonical/legacy YAML names.
|
|
123
123
|
RECIPIENTS_RAW="$(md_field 'To')"
|
|
124
124
|
[ -z "$RECIPIENTS_RAW" ] && RECIPIENTS_RAW="$(md_field 'For')"
|
|
125
125
|
[ -z "$RECIPIENTS_RAW" ] && RECIPIENTS_RAW="$(yaml_extract 'to')"
|
|
126
126
|
[ -z "$RECIPIENTS_RAW" ] && RECIPIENTS_RAW="$(yaml_extract 'for')"
|
|
127
|
+
[ -z "$RECIPIENTS_RAW" ] && RECIPIENTS_RAW="$(yaml_extract 'addressed_to')"
|
|
127
128
|
# Also extract from "From: author → recipient" pattern
|
|
128
129
|
if [ -z "$RECIPIENTS_RAW" ] && echo "$AUTHOR" | grep -q '→' 2>/dev/null; then
|
|
129
130
|
RECIPIENTS_RAW="$(echo "$AUTHOR" | sed 's/.*→[[:space:]]*//')"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/bin/bash
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
2
|
# Shared config helpers — sourced by session-start.sh and other scripts.
|
|
3
3
|
# Expects SCRIPT_DIR to be set by the caller.
|
|
4
4
|
|
|
@@ -25,35 +25,71 @@ _config_val() {
|
|
|
25
25
|
fi
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
# Get base branch for a repo. Reads base_branch from egregore.json
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
#
|
|
28
|
+
# Get base branch for a repo. Reads base_branch from egregore.json — top-level
|
|
29
|
+
# for the core egregore repo, per-entry under repos[] for managed repos.
|
|
30
|
+
# Defaults to "develop" for backwards compatibility only when a valid config
|
|
31
|
+
# omits the setting. Missing, unreadable, malformed, or invalid config fails:
|
|
32
|
+
# callers must never turn a config read failure into a remote branch mutation.
|
|
33
|
+
#
|
|
34
|
+
# Setting a top-level "base_branch": "main" is single-branch mode: the whole
|
|
35
|
+
# develop layer disappears and everything (session start, sync, the branch
|
|
36
|
+
# guard, PR bases) targets main instead. Solo operators who never wanted the
|
|
37
|
+
# develop/main split had no way to say so — the core repo used to be hardcoded
|
|
38
|
+
# even though managed repos were already configurable.
|
|
39
|
+
#
|
|
32
40
|
# Usage: _get_base_branch "repo-name" (omit for core repo)
|
|
33
41
|
_get_base_branch() {
|
|
34
42
|
local repo_name="${1:-}"
|
|
35
43
|
local config="${CONFIG:-$SCRIPT_DIR/egregore.json}"
|
|
44
|
+
local base=""
|
|
36
45
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
if [ ! -r "$config" ]; then
|
|
47
|
+
echo "config: cannot read $config" >&2
|
|
48
|
+
return 1
|
|
49
|
+
fi
|
|
50
|
+
if ! jq -e 'type == "object"' "$config" >/dev/null 2>&1; then
|
|
51
|
+
echo "config: invalid JSON object in $config" >&2
|
|
52
|
+
return 1
|
|
41
53
|
fi
|
|
42
54
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
if [ -z "$repo_name" ]; then
|
|
56
|
+
# Core egregore repo — top-level base_branch. An absent value preserves
|
|
57
|
+
# the historical develop default; an explicitly invalid value is an error.
|
|
58
|
+
if jq -e 'has("base_branch")' "$config" >/dev/null 2>&1; then
|
|
59
|
+
if ! base=$(jq -er '.base_branch | select(type == "string")' "$config" 2>/dev/null); then
|
|
60
|
+
echo "config: base_branch must be a valid branch name" >&2
|
|
61
|
+
return 1
|
|
62
|
+
fi
|
|
63
|
+
else
|
|
64
|
+
base="develop"
|
|
65
|
+
fi
|
|
66
|
+
else
|
|
67
|
+
# Managed repo — its own entry under repos[]. Unknown/string-form entries
|
|
68
|
+
# retain the historical develop default.
|
|
69
|
+
local repo_json
|
|
70
|
+
repo_json=$(jq -c --arg name "$repo_name" \
|
|
71
|
+
'first(.repos[]? | select((if type == "object" then .name else . end) == $name)) // null' \
|
|
72
|
+
"$config" 2>/dev/null) || {
|
|
73
|
+
echo "config: cannot resolve managed repo $repo_name" >&2
|
|
74
|
+
return 1
|
|
75
|
+
}
|
|
76
|
+
if [ "$repo_json" != "null" ] \
|
|
77
|
+
&& [ "$(printf '%s' "$repo_json" | jq -r 'type')" = "object" ] \
|
|
78
|
+
&& printf '%s' "$repo_json" | jq -e 'has("base_branch")' >/dev/null 2>&1; then
|
|
79
|
+
if ! base=$(printf '%s' "$repo_json" | jq -er '.base_branch | select(type == "string")' 2>/dev/null); then
|
|
80
|
+
echo "config: base_branch for $repo_name must be a valid branch name" >&2
|
|
81
|
+
return 1
|
|
82
|
+
fi
|
|
83
|
+
else
|
|
84
|
+
base="develop"
|
|
52
85
|
fi
|
|
53
86
|
fi
|
|
54
87
|
|
|
55
|
-
|
|
56
|
-
|
|
88
|
+
if [ -z "$base" ] || ! git check-ref-format --branch "$base" >/dev/null 2>&1; then
|
|
89
|
+
echo "config: base_branch must be a valid branch name" >&2
|
|
90
|
+
return 1
|
|
91
|
+
fi
|
|
92
|
+
echo "$base"
|
|
57
93
|
}
|
|
58
94
|
|
|
59
95
|
# Detect local vs connected mode
|
|
@@ -449,10 +449,16 @@ fi
|
|
|
449
449
|
) > "$CTX_DIR/graph_health" 2>/dev/null &
|
|
450
450
|
|
|
451
451
|
# 8. Telegram health (background)
|
|
452
|
+
# notify.sh test emits JSON, not prose: {"status":"ok"} connected,
|
|
453
|
+
# {"status":"configured"} local, {"status":"offline"} otherwise. Match the
|
|
454
|
+
# status field — an earlier grep for the word "connected" read a human sentence
|
|
455
|
+
# that the consent rewrite removed, so the footer showed telegram ✗ while the
|
|
456
|
+
# bot was answering.
|
|
452
457
|
(
|
|
453
458
|
if [ "$LOCAL_MODE" = "true" ]; then
|
|
454
459
|
echo "skip"
|
|
455
|
-
elif bash "$SCRIPT_DIR/bin/notify.sh" test 2>/dev/null
|
|
460
|
+
elif bash "$SCRIPT_DIR/bin/notify.sh" test 2>/dev/null \
|
|
461
|
+
| jq -e '.status == "ok" or .status == "configured"' >/dev/null 2>&1; then
|
|
456
462
|
echo "ok"
|
|
457
463
|
else
|
|
458
464
|
echo "fail"
|