gator-command 1.0.0__py3-none-any.whl
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.
- gator_command/__init__.py +2 -0
- gator_command/cli.py +137 -0
- gator_command/scripts/crawler.py +633 -0
- gator_command/scripts/dashboard/dashboard.css +982 -0
- gator_command/scripts/dashboard/dashboard.html +84 -0
- gator_command/scripts/dashboard/dashboard.js +419 -0
- gator_command/scripts/dashboard/views/audit.js +270 -0
- gator_command/scripts/dashboard/views/fleet.js +307 -0
- gator_command/scripts/dashboard/views/repo.js +599 -0
- gator_command/scripts/dashboard/views/settings.js +173 -0
- gator_command/scripts/dashboard/views/updates.js +308 -0
- gator_command/scripts/enforcer-prompt.md +22 -0
- gator_command/scripts/extract-claude-sessions.py +489 -0
- gator_command/scripts/extract-codex-sessions.py +477 -0
- gator_command/scripts/extract-gemini-sessions.py +410 -0
- gator_command/scripts/gator-audit.py +956 -0
- gator_command/scripts/gator-charter-draft.py +919 -0
- gator_command/scripts/gator-charter-lint.py +427 -0
- gator_command/scripts/gator-charter-verify.py +606 -0
- gator_command/scripts/gator-dashboard.py +1271 -0
- gator_command/scripts/gator-deploy.py +916 -0
- gator_command/scripts/gator-drift.py +569 -0
- gator_command/scripts/gator-enforce.py +82 -0
- gator_command/scripts/gator-fleet-intel.py +460 -0
- gator_command/scripts/gator-fleet-report.py +615 -0
- gator_command/scripts/gator-init-command-post.py +315 -0
- gator_command/scripts/gator-init.py +434 -0
- gator_command/scripts/gator-machine-id.py +153 -0
- gator_command/scripts/gator-policy-status.py +631 -0
- gator_command/scripts/gator-pulse.py +459 -0
- gator_command/scripts/gator-repo-status.py +649 -0
- gator_command/scripts/gator-session-common.py +372 -0
- gator_command/scripts/gator-session-sink.py +831 -0
- gator_command/scripts/gator-sessions.py +1244 -0
- gator_command/scripts/gator-update.py +615 -0
- gator_command/scripts/gator-version.py +38 -0
- gator_command/scripts/gator_core.py +489 -0
- gator_command/scripts/gator_remote.py +381 -0
- gator_command/scripts/gator_runtime.py +142 -0
- gator_command/scripts/gatorize-actions.sh +989 -0
- gator_command/scripts/gatorize-lib.sh +166 -0
- gator_command/scripts/gatorize-post.sh +394 -0
- gator_command/scripts/gatorize.py +1163 -0
- gator_command/scripts/gatorize.sh +185 -0
- gator_command/scripts/generate_markdown.py +212 -0
- gator_command/scripts/generate_wiki.py +424 -0
- gator_command/scripts/graph_health.py +780 -0
- gator_command/scripts/memex-lint.py +286 -0
- gator_command/scripts/memex-lint.sh +205 -0
- gator_command/scripts/memex.py +1472 -0
- gator_command/scripts/memex_formatters.py +191 -0
- gator_command/scripts/memex_state.py +236 -0
- gator_command/scripts/spawn.py +650 -0
- gator_command/templates/gator-starter/blueprints/README.md +32 -0
- gator_command/templates/gator-starter/charterignore +53 -0
- gator_command/templates/gator-starter/charters/README.md +178 -0
- gator_command/templates/gator-starter/charters/_template.md +31 -0
- gator_command/templates/gator-starter/commands/commit.md +33 -0
- gator_command/templates/gator-starter/commands/init.md +11 -0
- gator_command/templates/gator-starter/commands/update.md +5 -0
- gator_command/templates/gator-starter/constitution.md +165 -0
- gator_command/templates/gator-starter/field-guides/README.md +25 -0
- gator_command/templates/gator-starter/gator-start-up.md +119 -0
- gator_command/templates/gator-starter/procedures/charter-alignment.md +83 -0
- gator_command/templates/gator-starter/procedures/enforcer-review.md +317 -0
- gator_command/templates/gator-starter/procedures/field-guide-generation.md +176 -0
- gator_command/templates/gator-starter/procedures/knowledge-capture.md +57 -0
- gator_command/templates/gator-starter/procedures/significance-check.md +69 -0
- gator_command/templates/gator-starter/reference-notes/concierge-responses.md +535 -0
- gator_command/templates/gator-starter/reference-notes/dangerous-patterns.md +91 -0
- gator_command/templates/gator-starter/reference-notes/dashboard-operations.md +22 -0
- gator_command/templates/gator-starter/reference-notes/enforcer-configuration.md +232 -0
- gator_command/templates/gator-starter/reference-notes/example-project.md +289 -0
- gator_command/templates/gator-starter/reference-notes/failure-modes-and-self-correction.md +72 -0
- gator_command/templates/gator-starter/reference-notes/git-workflow.md +60 -0
- gator_command/templates/gator-starter/reference-notes/identity-and-ownership.md +37 -0
- gator_command/templates/gator-starter/reference-notes/refactor-approach.md +155 -0
- gator_command/templates/gator-starter/reference-notes/what-gator-requires-from-a-model.md +108 -0
- gator_command/templates/gator-starter/reference-notes/why-navigation-coding-feels-different.md +99 -0
- gator_command/templates/gator-starter/reference-notes/workflow-profiles.md +155 -0
- gator_command/templates/gator-starter/scripts/__pycache__/enforcer-review.cpython-313.pyc +0 -0
- gator_command/templates/gator-starter/scripts/__pycache__/gator-approve.cpython-313.pyc +0 -0
- gator_command/templates/gator-starter/scripts/__pycache__/gator-init.cpython-313.pyc +0 -0
- gator_command/templates/gator-starter/scripts/__pycache__/gator-pre-commit.cpython-313.pyc +0 -0
- gator_command/templates/gator-starter/scripts/__pycache__/gator-update.cpython-313.pyc +0 -0
- gator_command/templates/gator-starter/scripts/enforcer-prompt.md +55 -0
- gator_command/templates/gator-starter/scripts/enforcer-review.py +1551 -0
- gator_command/templates/gator-starter/scripts/gator-approve.py +139 -0
- gator_command/templates/gator-starter/scripts/gator-enforce.py +82 -0
- gator_command/templates/gator-starter/scripts/gator-init.py +434 -0
- gator_command/templates/gator-starter/scripts/gator-pre-commit.py +2670 -0
- gator_command/templates/gator-starter/scripts/gator-pulse.py +459 -0
- gator_command/templates/gator-starter/scripts/gator-update.py +615 -0
- gator_command/templates/gator-starter/scripts/gator-version.py +38 -0
- gator_command/templates/gator-starter/scripts/gator_core.py +487 -0
- gator_command/templates/gator-starter/scripts/hooks/__pycache__/commit-msgcpython-313.pyc +0 -0
- gator_command/templates/gator-starter/scripts/hooks/__pycache__/post-commitcpython-313.pyc +0 -0
- gator_command/templates/gator-starter/scripts/hooks/__pycache__/pre-commitcpython-313.pyc +0 -0
- gator_command/templates/gator-starter/scripts/hooks/commit-msg +5 -0
- gator_command/templates/gator-starter/scripts/hooks/post-commit +7 -0
- gator_command/templates/gator-starter/scripts/hooks/pre-commit +5 -0
- gator_command/templates/gator-starter/sessions/.gitignore +7 -0
- gator_command/templates/gator-starter/vault/.gitkeep +0 -0
- gator_command/templates/gator-starter/whiteboard.md +5 -0
- gator_command-1.0.0.dist-info/METADATA +122 -0
- gator_command-1.0.0.dist-info/RECORD +110 -0
- gator_command-1.0.0.dist-info/WHEEL +5 -0
- gator_command-1.0.0.dist-info/entry_points.txt +2 -0
- gator_command-1.0.0.dist-info/licenses/LICENSE +21 -0
- gator_command-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# gatorize-lib.sh — Utility and detection functions for gatorize.sh
|
|
3
|
+
#
|
|
4
|
+
# Sourced by gatorize.sh. Not a standalone script.
|
|
5
|
+
#
|
|
6
|
+
# Contains: logging, confirmation, content detection, scenario detection,
|
|
7
|
+
# generation detection, version writing, knowledge detection.
|
|
8
|
+
|
|
9
|
+
# =============================================================================
|
|
10
|
+
# Utility Functions
|
|
11
|
+
# =============================================================================
|
|
12
|
+
|
|
13
|
+
log_step() { echo " $1"; }
|
|
14
|
+
log_blank() { echo ""; }
|
|
15
|
+
|
|
16
|
+
confirm() {
|
|
17
|
+
# confirm "prompt" "default" → returns 0 for yes, 1 for no
|
|
18
|
+
# default: "Y" means yes-default, "N" means no-default
|
|
19
|
+
local prompt="$1" default="${2:-Y}"
|
|
20
|
+
local suffix
|
|
21
|
+
if [ "$default" = "Y" ]; then suffix="[Y/n]"; else suffix="[y/N]"; fi
|
|
22
|
+
read -rp " $prompt $suffix: " answer
|
|
23
|
+
case "$answer" in
|
|
24
|
+
[Yy]*) return 0 ;;
|
|
25
|
+
[Nn]*) return 1 ;;
|
|
26
|
+
"")
|
|
27
|
+
if [ "$default" = "Y" ]; then return 0; else return 1; fi
|
|
28
|
+
;;
|
|
29
|
+
*) if [ "$default" = "Y" ]; then return 0; else return 1; fi ;;
|
|
30
|
+
esac
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
has_content() {
|
|
34
|
+
# Returns 0 if file has meaningful content (non-blank, non-heading,
|
|
35
|
+
# non-bracket-placeholder, non-YAML-frontmatter-structure).
|
|
36
|
+
# Ignores: blank lines, headings, [placeholders], YAML delimiters (---),
|
|
37
|
+
# and YAML key-value lines with empty/placeholder values (e.g., "message: """,
|
|
38
|
+
# "decision-tags: []", "significance:").
|
|
39
|
+
local file="$1"
|
|
40
|
+
[ -f "$file" ] || return 1
|
|
41
|
+
local lines
|
|
42
|
+
lines=$(grep -cvE '^\s*$|^#|^\[|^---|^[a-z-]+:\s*(""|$|\[\])' "$file" 2>/dev/null || true)
|
|
43
|
+
[ "$lines" -gt 0 ]
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
file_count() {
|
|
47
|
+
# Count .md files in a directory (excluding templates)
|
|
48
|
+
local dir="$1"
|
|
49
|
+
[ -d "$dir" ] || { echo "0"; return; }
|
|
50
|
+
find "$dir" -name "*.md" ! -name "_template.md" ! -name "README.md" \
|
|
51
|
+
! -name ".gitkeep" 2>/dev/null | wc -l | tr -d ' '
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
# =============================================================================
|
|
55
|
+
# Detection Functions
|
|
56
|
+
# =============================================================================
|
|
57
|
+
|
|
58
|
+
detect_scenario() {
|
|
59
|
+
local target="$1"
|
|
60
|
+
local has_git=false has_gator=false has_memex=false
|
|
61
|
+
|
|
62
|
+
[ -d "$target/.git" ] && has_git=true
|
|
63
|
+
[ -d "$target/.gator" ] && has_gator=true
|
|
64
|
+
[ -d "$target/memex" ] || [ -d "$target/.memex" ] && has_memex=true
|
|
65
|
+
|
|
66
|
+
if ! $has_git && ! $has_memex && ! $has_gator; then echo 1; return; fi
|
|
67
|
+
if $has_git && ! $has_memex && ! $has_gator; then echo 2; return; fi
|
|
68
|
+
if $has_git && ! $has_memex && $has_gator; then echo 3; return; fi
|
|
69
|
+
if $has_git && $has_memex && ! $has_gator; then echo 4; return; fi
|
|
70
|
+
if $has_git && $has_memex && $has_gator; then echo 5; return; fi
|
|
71
|
+
|
|
72
|
+
# Edge case: memex but no git
|
|
73
|
+
if ! $has_git && $has_memex; then
|
|
74
|
+
echo ""
|
|
75
|
+
echo " Error: Found memex structure but no git repository in $target."
|
|
76
|
+
echo " Initialize git first, then re-run gatorize.sh."
|
|
77
|
+
exit 1
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
echo 2 # fallback
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
detect_legacy_memex() {
|
|
84
|
+
# Sets globals describing what legacy structure exists
|
|
85
|
+
local target="$1"
|
|
86
|
+
HAS_MEMEX_DIR=false
|
|
87
|
+
HAS_DOT_MEMEX_DIR=false
|
|
88
|
+
HAS_ROOT_CONSTITUTION=false
|
|
89
|
+
HAS_ROOT_CONSTITUTION_CORE=false
|
|
90
|
+
|
|
91
|
+
[ -d "$target/memex" ] && HAS_MEMEX_DIR=true
|
|
92
|
+
[ -d "$target/.memex" ] && HAS_DOT_MEMEX_DIR=true
|
|
93
|
+
[ -f "$target/constitution.md" ] && HAS_ROOT_CONSTITUTION=true
|
|
94
|
+
[ -f "$target/constitution-core.md" ] && HAS_ROOT_CONSTITUTION_CORE=true
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
detect_gator_generation() {
|
|
98
|
+
# Returns the generation of an existing .gator/ install.
|
|
99
|
+
# Gen 0: pre-gatorize.sh (no command-post.md, no .gator-version)
|
|
100
|
+
# Gen 1: early gatorize.sh (has command-post.md, no .gator-version)
|
|
101
|
+
# Gen 2+: current (has .gator-version with generation field)
|
|
102
|
+
local target="$1"
|
|
103
|
+
|
|
104
|
+
if [ -f "$target/.gator/.gator-version" ]; then
|
|
105
|
+
local gen
|
|
106
|
+
gen=$(grep '^generation:' "$target/.gator/.gator-version" 2>/dev/null | \
|
|
107
|
+
sed 's/generation: *//' | tr -d ' ')
|
|
108
|
+
echo "${gen:-2}"
|
|
109
|
+
elif [ -f "$target/.gator/command-post.md" ]; then
|
|
110
|
+
echo 1
|
|
111
|
+
else
|
|
112
|
+
echo 0
|
|
113
|
+
fi
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
write_gator_version() {
|
|
117
|
+
# Writes .gator/.gator-version with current generation and timestamps
|
|
118
|
+
local target="$1"
|
|
119
|
+
local action="${2:-install}" # install, upgrade, or morph
|
|
120
|
+
|
|
121
|
+
# Preserve original install date if upgrading
|
|
122
|
+
local installed="$TODAY"
|
|
123
|
+
if [ -f "$target/.gator/.gator-version" ]; then
|
|
124
|
+
local prev_installed
|
|
125
|
+
prev_installed=$(grep '^installed:' "$target/.gator/.gator-version" 2>/dev/null | \
|
|
126
|
+
sed 's/installed: *//')
|
|
127
|
+
[ -n "$prev_installed" ] && installed="$prev_installed"
|
|
128
|
+
fi
|
|
129
|
+
|
|
130
|
+
local now
|
|
131
|
+
now="$(date +%Y-%m-%dT%H:%M:%S)"
|
|
132
|
+
|
|
133
|
+
cat > "$target/.gator/.gator-version" << EOF
|
|
134
|
+
generation: $GATOR_GEN
|
|
135
|
+
installed: $installed
|
|
136
|
+
updated: $now
|
|
137
|
+
action: $action
|
|
138
|
+
installer: gatorize.sh
|
|
139
|
+
EOF
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
has_gator_knowledge() {
|
|
143
|
+
# Returns 0 if .gator/ has user-created content worth preserving
|
|
144
|
+
local target="$1"
|
|
145
|
+
|
|
146
|
+
# Check for non-template charters
|
|
147
|
+
local charters
|
|
148
|
+
charters=$(file_count "$target/.gator/charters")
|
|
149
|
+
# Subtract INDEX.md if present
|
|
150
|
+
[ -f "$target/.gator/charters/INDEX.md" ] && charters=$((charters - 1))
|
|
151
|
+
[ "$charters" -gt 0 ] && return 0
|
|
152
|
+
|
|
153
|
+
# Check for populated content files
|
|
154
|
+
for f in mission.md roadmap.md inbox.md commit_draft.md identity.md issues.md; do
|
|
155
|
+
has_content "$target/.gator/$f" && return 0
|
|
156
|
+
done
|
|
157
|
+
|
|
158
|
+
# Check for threads or artifacts
|
|
159
|
+
local threads artifacts
|
|
160
|
+
threads=$(find "$target/.gator/threads" -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
|
|
161
|
+
[ "$threads" -gt 0 ] && return 0
|
|
162
|
+
artifacts=$(find "$target/.gator/artifacts" -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
|
|
163
|
+
[ "$artifacts" -gt 0 ] && return 0
|
|
164
|
+
|
|
165
|
+
return 1
|
|
166
|
+
}
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# gatorize-post.sh — Post-action functions for gatorize.sh
|
|
3
|
+
#
|
|
4
|
+
# Sourced by gatorize.sh. Not a standalone script.
|
|
5
|
+
# Requires: gatorize-lib.sh (for log_step, confirm, has_content, detect_gator_generation)
|
|
6
|
+
# Requires: COMMAND_POST, GATOR_BRANCH, TODAY, GATOR_MARKER, COMMAND_POST_MARKER
|
|
7
|
+
#
|
|
8
|
+
# Contains: thin link installation, outbox creation, entry point installation,
|
|
9
|
+
# registry registration, and summary output.
|
|
10
|
+
|
|
11
|
+
# =============================================================================
|
|
12
|
+
# Action: Install thin link
|
|
13
|
+
# =============================================================================
|
|
14
|
+
|
|
15
|
+
action_install_thin_link() {
|
|
16
|
+
local target="$1"
|
|
17
|
+
local repo_name
|
|
18
|
+
repo_name="$(basename "$target")"
|
|
19
|
+
|
|
20
|
+
# Compute relative path from target to command post
|
|
21
|
+
local relative_path link_path path_note
|
|
22
|
+
relative_path=$(python3 -c "import os.path; print(os.path.relpath('$COMMAND_POST', '$target'))" 2>/dev/null || echo "")
|
|
23
|
+
|
|
24
|
+
if [ -n "$relative_path" ]; then
|
|
25
|
+
link_path="$relative_path"
|
|
26
|
+
path_note="Relative path (portable across machines with the same directory layout)."
|
|
27
|
+
else
|
|
28
|
+
link_path="$COMMAND_POST"
|
|
29
|
+
path_note="Absolute path (works on this machine only). For team use, update to a relative path or use an environment variable."
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
cat > "$target/.gator/command-post.md" << EOF
|
|
33
|
+
---
|
|
34
|
+
command-post: $link_path
|
|
35
|
+
command-post-absolute: $COMMAND_POST # machine-local, not portable — gitignore or override per-machine
|
|
36
|
+
remote: # optional — add remote URL for team sync
|
|
37
|
+
version: $TODAY
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
# Gator Command Post
|
|
41
|
+
|
|
42
|
+
This repo is governed by [Gator Command]($link_path).
|
|
43
|
+
$path_note
|
|
44
|
+
|
|
45
|
+
The agent should read org standards from the command post at session open.
|
|
46
|
+
**Do not modify the command post from this repo.**
|
|
47
|
+
|
|
48
|
+
## What to read from the command post
|
|
49
|
+
|
|
50
|
+
- \`gator-command/org-policy.md\` — org-wide inherited policy (engineering standards, commit rules, agent behavioral rules). This is the primary file to read at session open.
|
|
51
|
+
- Additional procedures referenced from org-policy.md (branching-standard.md, coding-standard.md, etc.)
|
|
52
|
+
|
|
53
|
+
## What to do with cross-repo discoveries
|
|
54
|
+
|
|
55
|
+
Write to this repo's \`outbox.md\`. Do not create threads or edit files
|
|
56
|
+
in the command post. The PI reviews outbox items during gator-command sessions.
|
|
57
|
+
EOF
|
|
58
|
+
|
|
59
|
+
log_step "Installed thin link (.gator/command-post.md)"
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
# =============================================================================
|
|
63
|
+
# Action: Install outbox
|
|
64
|
+
# =============================================================================
|
|
65
|
+
|
|
66
|
+
action_install_outbox() {
|
|
67
|
+
local target="$1"
|
|
68
|
+
|
|
69
|
+
# Don't overwrite an outbox that has content
|
|
70
|
+
if [ -f "$target/outbox.md" ] && has_content "$target/outbox.md"; then
|
|
71
|
+
log_step "outbox.md already exists with content — preserved"
|
|
72
|
+
return
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
cat > "$target/outbox.md" << 'STUB'
|
|
76
|
+
# Outbox
|
|
77
|
+
|
|
78
|
+
Messages for Gator Command. The PI triages these during command post sessions.
|
|
79
|
+
Do not clear this file from the project repo — the command post session clears
|
|
80
|
+
entries after processing.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
STUB
|
|
85
|
+
log_step "Created outbox.md"
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
# =============================================================================
|
|
89
|
+
# Action: Install product source
|
|
90
|
+
# =============================================================================
|
|
91
|
+
|
|
92
|
+
action_install_product_source() {
|
|
93
|
+
local target="$1"
|
|
94
|
+
|
|
95
|
+
# Detect template directory relative to the gator clone root.
|
|
96
|
+
# Two layouts: gator-engine/templates/gator-starter (public clone)
|
|
97
|
+
# gator-command/templates/gator-starter (source repo)
|
|
98
|
+
local gator_root="$COMMAND_POST"
|
|
99
|
+
local template_dir=""
|
|
100
|
+
if [ -d "$gator_root/gator-engine/templates/gator-starter" ]; then
|
|
101
|
+
template_dir="gator-engine/templates/gator-starter"
|
|
102
|
+
elif [ -d "$gator_root/gator-command/templates/gator-starter" ]; then
|
|
103
|
+
template_dir="gator-command/templates/gator-starter"
|
|
104
|
+
fi
|
|
105
|
+
|
|
106
|
+
# Always write — this is machine-local state, updated on every gatorize
|
|
107
|
+
cat > "$target/.gator/product-source.json" << EOF
|
|
108
|
+
{
|
|
109
|
+
"gator_root": "$gator_root",
|
|
110
|
+
"template_dir": "$template_dir",
|
|
111
|
+
"installed": "$TODAY",
|
|
112
|
+
"updated": "$TODAY"
|
|
113
|
+
}
|
|
114
|
+
EOF
|
|
115
|
+
log_step "Wrote product-source.json (template source: $gator_root)"
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
# =============================================================================
|
|
119
|
+
# Action: Install entry points
|
|
120
|
+
# =============================================================================
|
|
121
|
+
|
|
122
|
+
action_install_entry_points() {
|
|
123
|
+
local target="$1"
|
|
124
|
+
local has_command_post="${2:-true}"
|
|
125
|
+
|
|
126
|
+
# Shared gator-init instruction (goes in all entry points)
|
|
127
|
+
local gator_init_block='**"gator init" means**: run \`python .gator/scripts/gator-init.py\` and display the output exactly as printed. It is NOT a repo bootstrap or git init — it is the standardized Gator boot sequence. Run the script, show the output, then proceed with session opening.
|
|
128
|
+
|
|
129
|
+
**"gator pulse"**: run \`python .gator/scripts/gator-pulse.py\` to generate \`.gator/pulse.md\` — a strategic operations brief with next steps, project assessment, roadmap check, priorities, and recent activity.
|
|
130
|
+
|
|
131
|
+
**Project assessment**: when the Architect asks for a project assessment, write a 2-paragraph expert evaluation to \`.gator/artifacts/YYYY-MM-DD-project-assessment.md\` with YAML frontmatter (\`date\`, \`type: project-assessment\`, \`model: <your model name>\`). Write as an expert consultant advising an engineering manager. The next \`gator pulse\` will include it automatically.'
|
|
132
|
+
|
|
133
|
+
# Command-post section — included only when a command post is linked
|
|
134
|
+
local cp_section=""
|
|
135
|
+
if [ "$has_command_post" = "true" ]; then
|
|
136
|
+
cp_section="
|
|
137
|
+
|
|
138
|
+
$COMMAND_POST_MARKER
|
|
139
|
+
This repo is governed by a Gator Command post. Read [\`.gator/command-post.md\`](.gator/command-post.md) for the command post location. Read org standards from there at session open. **Never write to the command post from this session.** Cross-repo discoveries go in [\`outbox.md\`](outbox.md)."
|
|
140
|
+
fi
|
|
141
|
+
|
|
142
|
+
# Entry point content for each model
|
|
143
|
+
local claude_entry agents_entry gemini_entry
|
|
144
|
+
|
|
145
|
+
claude_entry="$gator_init_block
|
|
146
|
+
|
|
147
|
+
Read [\`.gator/constitution.md\`](.gator/constitution.md) before your first response. It governs how you work here.
|
|
148
|
+
|
|
149
|
+
If this is a **fresh project** (charters/ is empty or contains only templates), follow the bootstrap procedure in [\`.gator/gator-start-up.md\`](.gator/gator-start-up.md).$cp_section"
|
|
150
|
+
|
|
151
|
+
agents_entry="$gator_init_block
|
|
152
|
+
|
|
153
|
+
Read [\`.gator/constitution.md\`](.gator/constitution.md) before your first response. It governs how you work here.
|
|
154
|
+
|
|
155
|
+
If this is a **fresh project** (\`charters/\` is empty or contains only templates), follow the bootstrap procedure in [\`.gator/gator-start-up.md\`](.gator/gator-start-up.md).
|
|
156
|
+
|
|
157
|
+
If the PI asks for an **enforcer review**, do not repurpose yourself as the enforcer. Use the dedicated enforcer prompt at [\`.gator/scripts/enforcer-prompt.md\`](.gator/scripts/enforcer-prompt.md).$cp_section"
|
|
158
|
+
|
|
159
|
+
gemini_entry="$gator_init_block
|
|
160
|
+
|
|
161
|
+
Read [\`.gator/constitution.md\`](.gator/constitution.md) before your first response. It governs how you work here.
|
|
162
|
+
|
|
163
|
+
If this is a **fresh project** (charters/ is empty or contains only templates), follow the bootstrap procedure in [\`.gator/gator-start-up.md\`](.gator/gator-start-up.md).$cp_section"
|
|
164
|
+
|
|
165
|
+
local entry_files=("CLAUDE.md" "AGENTS.md" "GEMINI.md")
|
|
166
|
+
local idx=0
|
|
167
|
+
|
|
168
|
+
while [ $idx -lt ${#entry_files[@]} ]; do
|
|
169
|
+
local entry_file="${entry_files[$idx]}"
|
|
170
|
+
local entry_content header rollback_file agent_name
|
|
171
|
+
|
|
172
|
+
case "$entry_file" in
|
|
173
|
+
CLAUDE.md)
|
|
174
|
+
entry_content="$claude_entry"
|
|
175
|
+
header="# Claude Code Entry Point"
|
|
176
|
+
rollback_file="CLAUDE_ROLLBACK.md"
|
|
177
|
+
agent_name="Claude Code"
|
|
178
|
+
;;
|
|
179
|
+
AGENTS.md)
|
|
180
|
+
entry_content="$agents_entry"
|
|
181
|
+
header="# Codex Entry Point"
|
|
182
|
+
rollback_file="AGENTS_ROLLBACK.md"
|
|
183
|
+
agent_name="Codex"
|
|
184
|
+
;;
|
|
185
|
+
GEMINI.md)
|
|
186
|
+
entry_content="$gemini_entry"
|
|
187
|
+
header="# Gemini Entry Point"
|
|
188
|
+
rollback_file="GEMINI_ROLLBACK.md"
|
|
189
|
+
agent_name="Gemini"
|
|
190
|
+
;;
|
|
191
|
+
esac
|
|
192
|
+
|
|
193
|
+
if [ -f "$target/$entry_file" ]; then
|
|
194
|
+
# Already gatorized?
|
|
195
|
+
if grep -q "$GATOR_MARKER\|$COMMAND_POST_MARKER" "$target/$entry_file" 2>/dev/null; then
|
|
196
|
+
log_step "$entry_file already has Gator entry point — skipped"
|
|
197
|
+
idx=$((idx + 1))
|
|
198
|
+
continue
|
|
199
|
+
fi
|
|
200
|
+
|
|
201
|
+
local line_count
|
|
202
|
+
line_count=$(wc -l < "$target/$entry_file" | tr -d ' ')
|
|
203
|
+
log_blank
|
|
204
|
+
echo " $entry_file already exists ($line_count lines)."
|
|
205
|
+
log_blank
|
|
206
|
+
echo " Options:"
|
|
207
|
+
log_blank
|
|
208
|
+
echo " [1] Backup & replace (recommended) — save your existing file as"
|
|
209
|
+
echo " $rollback_file, then create a new $entry_file that leads with"
|
|
210
|
+
echo " Gator governance and includes your original content by reference."
|
|
211
|
+
echo " Best for: files with skills, custom instructions, or complex setups."
|
|
212
|
+
echo " Your original content is preserved and the agent is told to read it."
|
|
213
|
+
log_blank
|
|
214
|
+
echo " [2] Append — add Gator lines to the end of the existing file."
|
|
215
|
+
echo " Your existing content stays. Gator instructions are appended below."
|
|
216
|
+
echo " Best for: short files, simple setups."
|
|
217
|
+
log_blank
|
|
218
|
+
echo " [3] Overwrite — replace $entry_file entirely with Gator's version."
|
|
219
|
+
echo " Your existing content is lost. Only use if the current file is disposable."
|
|
220
|
+
log_blank
|
|
221
|
+
if [ $idx -gt 0 ]; then
|
|
222
|
+
echo " [b] Go back — return to previous entry point."
|
|
223
|
+
fi
|
|
224
|
+
echo " [x] Cancel installation."
|
|
225
|
+
log_blank
|
|
226
|
+
read -rp " Choice [1/2/3$([ $idx -gt 0 ] && echo '/b')/x]: " choice
|
|
227
|
+
case "$choice" in
|
|
228
|
+
1)
|
|
229
|
+
cp "$target/$entry_file" "$target/$rollback_file"
|
|
230
|
+
log_step "Saved original as $rollback_file"
|
|
231
|
+
cat > "$target/$entry_file" << MERGED
|
|
232
|
+
$header
|
|
233
|
+
|
|
234
|
+
You are the primary agent for this project.
|
|
235
|
+
|
|
236
|
+
$entry_content
|
|
237
|
+
|
|
238
|
+
## Pre-Gator Instructions
|
|
239
|
+
|
|
240
|
+
This project had an existing $entry_file before Gator was installed.
|
|
241
|
+
Those instructions have been preserved in [\`$rollback_file\`]($rollback_file).
|
|
242
|
+
**Read that file now** — it may contain skills, custom instructions, personas,
|
|
243
|
+
or project-specific rules that should still be followed alongside the
|
|
244
|
+
Gator constitution.
|
|
245
|
+
|
|
246
|
+
If any instructions in $rollback_file conflict with the Gator constitution,
|
|
247
|
+
the constitution takes precedence for code governance (charters, commit loop,
|
|
248
|
+
enforcer rules). For everything else (skills, personas, custom workflows),
|
|
249
|
+
follow $rollback_file.
|
|
250
|
+
MERGED
|
|
251
|
+
log_step "Created new $entry_file with Gator governance + reference to $rollback_file"
|
|
252
|
+
;;
|
|
253
|
+
2)
|
|
254
|
+
echo "" >> "$target/$entry_file"
|
|
255
|
+
echo "$GATOR_MARKER" >> "$target/$entry_file"
|
|
256
|
+
echo "" >> "$target/$entry_file"
|
|
257
|
+
echo "$entry_content" >> "$target/$entry_file"
|
|
258
|
+
log_step "Appended Gator entry point to $entry_file"
|
|
259
|
+
;;
|
|
260
|
+
3)
|
|
261
|
+
printf "%s\n\nYou are the primary agent for this project.\n\n%s\n" \
|
|
262
|
+
"$header" "$entry_content" > "$target/$entry_file"
|
|
263
|
+
log_step "Replaced $entry_file (original content lost)"
|
|
264
|
+
;;
|
|
265
|
+
[bB])
|
|
266
|
+
if [ $idx -gt 0 ]; then
|
|
267
|
+
idx=$((idx - 1))
|
|
268
|
+
continue
|
|
269
|
+
fi
|
|
270
|
+
;;
|
|
271
|
+
[xX])
|
|
272
|
+
echo ""
|
|
273
|
+
echo " Installation cancelled."
|
|
274
|
+
echo " To clean up: git checkout dev && git branch -D gator-install"
|
|
275
|
+
exit 0
|
|
276
|
+
;;
|
|
277
|
+
esac
|
|
278
|
+
else
|
|
279
|
+
printf "%s\n\nYou are the primary agent for this project.\n\n%s\n" \
|
|
280
|
+
"$header" "$entry_content" > "$target/$entry_file"
|
|
281
|
+
log_step "Created $entry_file"
|
|
282
|
+
fi
|
|
283
|
+
idx=$((idx + 1))
|
|
284
|
+
done
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
# =============================================================================
|
|
288
|
+
# Action: Register in command post registry
|
|
289
|
+
# =============================================================================
|
|
290
|
+
|
|
291
|
+
action_register() {
|
|
292
|
+
local target="$1"
|
|
293
|
+
local repo_name
|
|
294
|
+
repo_name="$(basename "$target")"
|
|
295
|
+
|
|
296
|
+
local registry="$COMMAND_POST/gator-command/registry.md"
|
|
297
|
+
|
|
298
|
+
if [ ! -f "$registry" ]; then
|
|
299
|
+
cat > "$registry" << 'STUB'
|
|
300
|
+
# Registry
|
|
301
|
+
|
|
302
|
+
Repos governed by this Gator Command post. Updated by `gatorize.sh` and maintained by the PI.
|
|
303
|
+
|
|
304
|
+
**Note**: Local paths are machine-specific. In team use, the Remote column is the portable identifier. Local paths may differ per workstation.
|
|
305
|
+
|
|
306
|
+
| Repo | Local path | Remote | Registered | Status |
|
|
307
|
+
|------|-----------|--------|------------|--------|
|
|
308
|
+
STUB
|
|
309
|
+
fi
|
|
310
|
+
|
|
311
|
+
if grep -q "$target" "$registry" 2>/dev/null; then
|
|
312
|
+
log_blank
|
|
313
|
+
log_step "$repo_name already registered in command post registry."
|
|
314
|
+
else
|
|
315
|
+
local remote_url
|
|
316
|
+
remote_url=$(cd "$target" && git remote get-url origin 2>/dev/null || echo "—")
|
|
317
|
+
echo "| $repo_name | $target | $remote_url | $TODAY | current |" >> "$registry"
|
|
318
|
+
log_blank
|
|
319
|
+
log_step "Registered $repo_name in command post registry."
|
|
320
|
+
fi
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
# =============================================================================
|
|
324
|
+
# Summary
|
|
325
|
+
# =============================================================================
|
|
326
|
+
|
|
327
|
+
print_summary() {
|
|
328
|
+
local target="$1"
|
|
329
|
+
local scenario="$2"
|
|
330
|
+
local has_command_post="${3:-true}"
|
|
331
|
+
local repo_name
|
|
332
|
+
repo_name="$(basename "$target")"
|
|
333
|
+
|
|
334
|
+
log_blank
|
|
335
|
+
echo " ================================================================"
|
|
336
|
+
echo " ✓ Gatorized: $repo_name"
|
|
337
|
+
echo " ================================================================"
|
|
338
|
+
log_blank
|
|
339
|
+
|
|
340
|
+
case "$scenario" in
|
|
341
|
+
1) echo " Type: Fresh install (git initialized)" ;;
|
|
342
|
+
2) echo " Type: Fresh install" ;;
|
|
343
|
+
3)
|
|
344
|
+
local final_gen
|
|
345
|
+
final_gen=$(detect_gator_generation "$target")
|
|
346
|
+
echo " Type: Upgrade (generation $final_gen, templates refreshed, content preserved)"
|
|
347
|
+
;;
|
|
348
|
+
4) echo " Type: Morph (memex → gator)" ;;
|
|
349
|
+
5) echo " Type: Dual structure (PI-directed)" ;;
|
|
350
|
+
esac
|
|
351
|
+
|
|
352
|
+
if [ "$scenario" = "4" ]; then
|
|
353
|
+
log_blank
|
|
354
|
+
echo " Preserved for review:"
|
|
355
|
+
[ -d "$target/memex.pre-gator" ] && echo " memex.pre-gator/ — original content layer"
|
|
356
|
+
[ -d "$target/.memex.pre-gator" ] && echo " .memex.pre-gator/ — original system layer"
|
|
357
|
+
[ -f "$target/.gator/legacy-constitution.md" ] && echo " .gator/legacy-constitution.md"
|
|
358
|
+
[ -f "$target/.gator/legacy-constitution-core.md" ] && echo " .gator/legacy-constitution-core.md"
|
|
359
|
+
fi
|
|
360
|
+
|
|
361
|
+
# Git instructions
|
|
362
|
+
local final_branch
|
|
363
|
+
final_branch=$(cd "$target" && git branch --show-current 2>/dev/null)
|
|
364
|
+
if [ "$final_branch" = "$GATOR_BRANCH" ]; then
|
|
365
|
+
log_blank
|
|
366
|
+
echo " You are on the '$GATOR_BRANCH' branch. To finalize:"
|
|
367
|
+
echo ""
|
|
368
|
+
echo " cd $target"
|
|
369
|
+
echo " git add -A && git commit -m 'Gatorize: install .gator/ governance layer'"
|
|
370
|
+
echo " git checkout dev && git merge $GATOR_BRANCH"
|
|
371
|
+
echo " git branch -d $GATOR_BRANCH"
|
|
372
|
+
fi
|
|
373
|
+
|
|
374
|
+
log_blank
|
|
375
|
+
echo " ================================================================"
|
|
376
|
+
echo " SUCCESS"
|
|
377
|
+
echo " ================================================================"
|
|
378
|
+
log_blank
|
|
379
|
+
echo " What to do now:"
|
|
380
|
+
log_blank
|
|
381
|
+
echo " 1. cd $target"
|
|
382
|
+
echo " 2. Launch your AI coding tool (Claude Code, Codex, Gemini, etc.)"
|
|
383
|
+
echo " 3. Type: gator init"
|
|
384
|
+
echo " 4. The agent will read the constitution and orient to the project."
|
|
385
|
+
echo " Your first git commit fires the governance hooks."
|
|
386
|
+
log_blank
|
|
387
|
+
echo " Enforcement: strict (commit gate active)"
|
|
388
|
+
if [ "$has_command_post" = "true" ]; then
|
|
389
|
+
echo " Command post: linked"
|
|
390
|
+
else
|
|
391
|
+
echo " Command post: standalone"
|
|
392
|
+
fi
|
|
393
|
+
log_blank
|
|
394
|
+
}
|