oneie 3.6.24 → 3.6.25

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 (47) hide show
  1. package/.claude/agents/agent-backend.md +2 -2
  2. package/.claude/agents/agent-designer.md +1 -0
  3. package/.claude/agents/agent-director.md +71 -71
  4. package/.claude/agents/agent-onboard.md +1 -1
  5. package/.claude/agents/agent-ontology.md +2 -2
  6. package/.claude/agents/agent-ops.md +58 -38
  7. package/.claude/agents/agent-sales.md +3 -3
  8. package/.claude/commands/cascade.md +21 -21
  9. package/.claude/commands/create.md +19 -19
  10. package/.claude/commands/deploy.md +82 -104
  11. package/.claude/commands/mcp-on.md +191 -0
  12. package/.claude/commands/one.md +267 -92
  13. package/.claude/commands/plan.md +17 -17
  14. package/.claude/commands/release.md +65 -14
  15. package/.claude/hooks/PULL-BEFORE-PUSH-GUIDE.md +473 -0
  16. package/.claude/hooks/README-knowledge-hooks.md +451 -0
  17. package/.claude/hooks/README-root-cleanup.md +200 -0
  18. package/.claude/hooks/README.md +284 -0
  19. package/.claude/hooks/__pycache__/done.cpython-313.pyc +0 -0
  20. package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
  21. package/.claude/hooks/check-filenames.py +177 -0
  22. package/.claude/hooks/clean-post.py +468 -0
  23. package/.claude/hooks/clean-pre.py +393 -0
  24. package/.claude/hooks/clean-root-markdown.sh +73 -0
  25. package/.claude/hooks/commit-push.sh +95 -0
  26. package/.claude/hooks/done.py +236 -0
  27. package/.claude/hooks/format-hook.sh +163 -0
  28. package/.claude/hooks/hook-logger.sh +173 -0
  29. package/.claude/hooks/knowledge-post.py +355 -0
  30. package/.claude/hooks/knowledge-pre.py +245 -0
  31. package/.claude/hooks/mcp-on.sh +134 -0
  32. package/.claude/hooks/notification-hook.sh +279 -0
  33. package/.claude/hooks/push.sh +101 -0
  34. package/.claude/hooks/release-cli.sh +16 -8
  35. package/.claude/hooks/root-cleanup.py +217 -0
  36. package/.claude/hooks/security-hook.sh +397 -0
  37. package/.claude/hooks/tag-all-docs.py +464 -0
  38. package/.claude/hooks/test-validate-ontology.sh +170 -0
  39. package/.claude/hooks/todo.py +368 -0
  40. package/.claude/hooks/track-changes.sh +101 -0
  41. package/.claude/hooks/validate-ontology-structure-summary.md +243 -0
  42. package/.claude/hooks/validate-ontology-structure.py +518 -0
  43. package/.claude/skills/INDEX.md +1 -1
  44. package/.claude/skills/ontology/README.md +1 -1
  45. package/package.json +1 -1
  46. package/.claude/commands/mcp-toggle.md +0 -93
  47. package/.claude/commands/npx.md +0 -84
@@ -0,0 +1,393 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ ONE Platform - Clean Agent Pre-Cycle Hook
4
+ Validates cleanliness and 6-dimension ontology compliance before starting each cycle.
5
+
6
+ This hook runs before UserPromptSubmit to ensure:
7
+ - File structure is intact and ontology-aligned
8
+ - Root directory only contains approved markdown files
9
+ - All other docs are properly organized in /one/<dimension>/ directories
10
+ - No orphaned files exist
11
+ - Naming conventions are followed
12
+ - Documentation is up to date
13
+ - No uncommitted critical changes
14
+ - Metadata tags are present on all docs
15
+
16
+ 6-Dimension Ontology Structure:
17
+ 1. groups - Hierarchical containers (multi-tenant isolation)
18
+ 2. people - Authorization & governance (roles, permissions)
19
+ 3. things - All entities (users, agents, content, tokens)
20
+ 4. connections - Relationships between entities
21
+ 5. events - Actions and state changes over time
22
+ 6. knowledge - Labels, embeddings, semantic search
23
+ """
24
+ import json
25
+ import sys
26
+ import os
27
+ from pathlib import Path
28
+ from typing import Dict, Any, List, Tuple
29
+ import subprocess
30
+ import re
31
+
32
+ # 6-dimension ontology directories (MUST exist)
33
+ REQUIRED_DIRS = [
34
+ "one/connections",
35
+ "one/events",
36
+ "one/knowledge",
37
+ "one/things",
38
+ "one/people",
39
+ "one/groups",
40
+ ".claude/hooks",
41
+ ".claude/state",
42
+ ]
43
+
44
+ # Root directory: ONLY these markdown files are allowed
45
+ ALLOWED_ROOT_MARKDOWN = {
46
+ "README.md",
47
+ "LICENSE.md",
48
+ "SECURITY.md",
49
+ "CLAUDE.md",
50
+ "AGENTS.md",
51
+ }
52
+
53
+ # File naming conventions
54
+ NAMING_PATTERNS = {
55
+ ".md": r"^[a-z0-9\-]+\.md$", # kebab-case for markdown
56
+ ".ts": r"^[a-z0-9\-]+\.ts$", # kebab-case for TypeScript
57
+ ".tsx": r"^[A-Z][a-zA-Z0-9]+\.tsx$", # PascalCase for React components
58
+ }
59
+
60
+ # Files that should have metadata frontmatter
61
+ METADATA_REQUIRED_PATTERNS = [
62
+ "one/**/*.md",
63
+ "CLAUDE.md",
64
+ "AGENTS.md",
65
+ "README.md",
66
+ ]
67
+
68
+
69
+ class CleanlinessValidator:
70
+ def __init__(self, project_dir: str):
71
+ self.project_dir = Path(project_dir)
72
+ self.issues: List[Tuple[str, str]] = [] # (severity, message)
73
+ self.warnings: List[str] = []
74
+ self.metrics: Dict[str, Any] = {}
75
+
76
+ def add_issue(self, severity: str, message: str):
77
+ """Add a cleanliness issue"""
78
+ self.issues.append((severity, message))
79
+
80
+ def add_warning(self, message: str):
81
+ """Add a warning"""
82
+ self.warnings.append(message)
83
+
84
+ def validate_directory_structure(self):
85
+ """Check that all required 6-dimension ontology directories exist"""
86
+ for dir_path in REQUIRED_DIRS:
87
+ full_path = self.project_dir / dir_path
88
+ if not full_path.exists():
89
+ self.add_issue("error", f"Missing required ontology directory: {dir_path}")
90
+ elif not full_path.is_dir():
91
+ self.add_issue("error", f"Path exists but is not a directory: {dir_path}")
92
+
93
+ def validate_root_directory_compliance(self):
94
+ """Check that root directory only contains approved markdown files"""
95
+ violations = []
96
+
97
+ # Check all markdown files in root
98
+ for md_file in self.project_dir.glob("*.md"):
99
+ if md_file.name not in ALLOWED_ROOT_MARKDOWN:
100
+ violations.append(md_file.name)
101
+
102
+ if violations:
103
+ self.add_issue(
104
+ "error",
105
+ f"Root directory contains {len(violations)} unauthorized markdown files. "
106
+ f"Only {', '.join(sorted(ALLOWED_ROOT_MARKDOWN))} are allowed. "
107
+ f"Move these to /one/<dimension>/: {', '.join(sorted(violations))}"
108
+ )
109
+ self.metrics["root_violations"] = len(violations)
110
+ else:
111
+ self.metrics["root_violations"] = 0
112
+
113
+ def validate_ontology_dimensions(self):
114
+ """Check that /one/ directory properly contains all 6 dimensions"""
115
+ one_dir = self.project_dir / "one"
116
+ if not one_dir.exists():
117
+ self.add_issue("error", "Missing /one/ directory - ontology structure not found")
118
+ return
119
+
120
+ dimensions = ["groups", "people", "things", "connections", "events", "knowledge"]
121
+ missing_dimensions = []
122
+
123
+ for dimension in dimensions:
124
+ dim_path = one_dir / dimension
125
+ if not dim_path.exists():
126
+ missing_dimensions.append(dimension)
127
+
128
+ if missing_dimensions:
129
+ self.add_issue(
130
+ "error",
131
+ f"Missing ontology dimensions in /one/: {', '.join(missing_dimensions)}. "
132
+ f"The 6-dimension ontology requires all dimensions to be present."
133
+ )
134
+
135
+ # Check for unexpected top-level directories in /one/
136
+ expected_dirs = set(dimensions)
137
+ actual_dirs = {d.name for d in one_dir.iterdir() if d.is_dir() and not d.name.startswith(".")}
138
+ unexpected = actual_dirs - expected_dirs
139
+
140
+ if unexpected:
141
+ self.add_warning(
142
+ f"Unexpected directories in /one/: {', '.join(sorted(unexpected))}. "
143
+ f"Only the 6 dimensions are expected: {', '.join(sorted(dimensions))}"
144
+ )
145
+
146
+ def validate_file_naming(self):
147
+ """Check that files follow naming conventions"""
148
+ problematic_files = []
149
+
150
+ # Check markdown files in one/
151
+ if (self.project_dir / "one").exists():
152
+ for md_file in (self.project_dir / "one").rglob("*.md"):
153
+ if not re.match(NAMING_PATTERNS[".md"], md_file.name):
154
+ problematic_files.append(str(md_file.relative_to(self.project_dir)))
155
+
156
+ if problematic_files:
157
+ self.add_warning(f"Files not following kebab-case convention: {', '.join(problematic_files[:5])}")
158
+ if len(problematic_files) > 5:
159
+ self.add_warning(f"... and {len(problematic_files) - 5} more")
160
+
161
+ def find_orphaned_files(self):
162
+ """Find files that don't belong anywhere"""
163
+ orphans = []
164
+
165
+ # Check for common temporary/generated files
166
+ temp_patterns = ["*.tmp", "*.swp", "*.bak", "*.DS_Store", "*~"]
167
+ for pattern in temp_patterns:
168
+ for temp_file in self.project_dir.rglob(pattern):
169
+ # Skip node_modules and .git
170
+ if "node_modules" not in str(temp_file) and ".git" not in str(temp_file):
171
+ orphans.append(str(temp_file.relative_to(self.project_dir)))
172
+
173
+ if orphans:
174
+ self.add_warning(f"Found {len(orphans)} temporary/backup files that should be cleaned")
175
+ for orphan in orphans[:3]:
176
+ self.add_warning(f" - {orphan}")
177
+
178
+ def check_metadata_tags(self):
179
+ """Check that documentation files have metadata frontmatter"""
180
+ missing_metadata = []
181
+
182
+ # Check markdown files in one/
183
+ for md_file in (self.project_dir / "one").rglob("*.md"):
184
+ try:
185
+ content = md_file.read_text()
186
+ # Check for YAML frontmatter
187
+ if not content.startswith("---\n"):
188
+ missing_metadata.append(str(md_file.relative_to(self.project_dir)))
189
+ else:
190
+ # Validate frontmatter has required fields
191
+ frontmatter_end = content.find("\n---\n", 4)
192
+ if frontmatter_end == -1:
193
+ missing_metadata.append(str(md_file.relative_to(self.project_dir)))
194
+ except Exception:
195
+ pass # Skip files we can't read
196
+
197
+ self.metrics["files_without_metadata"] = len(missing_metadata)
198
+
199
+ if missing_metadata:
200
+ self.add_warning(f"{len(missing_metadata)} files missing metadata tags")
201
+
202
+ def check_git_status(self):
203
+ """Check for uncommitted changes in critical files"""
204
+ try:
205
+ # Only check if we're in a git repo
206
+ if not (self.project_dir / ".git").exists():
207
+ return
208
+
209
+ result = subprocess.run(
210
+ ["git", "status", "--porcelain"],
211
+ cwd=self.project_dir,
212
+ capture_output=True,
213
+ text=True,
214
+ timeout=5
215
+ )
216
+
217
+ if result.returncode == 0 and result.stdout:
218
+ lines = result.stdout.strip().split("\n")
219
+ critical_changes = [
220
+ line for line in lines
221
+ if any(pattern in line for pattern in ["CLAUDE.md", "AGENTS.md", "schema.ts"])
222
+ ]
223
+
224
+ if critical_changes:
225
+ self.add_warning(f"Uncommitted changes in {len(critical_changes)} critical files")
226
+
227
+ self.metrics["uncommitted_files"] = len(lines)
228
+ except Exception:
229
+ pass # Skip if git check fails
230
+
231
+ def calculate_cleanliness_score(self) -> int:
232
+ """Calculate overall cleanliness score (0-100)"""
233
+ score = 100
234
+
235
+ # Deduct points for issues
236
+ for severity, _ in self.issues:
237
+ if severity == "error":
238
+ score -= 10
239
+ elif severity == "warning":
240
+ score -= 5
241
+
242
+ # Deduct for warnings
243
+ score -= len(self.warnings) * 2
244
+
245
+ # Bonus for good metrics
246
+ if self.metrics.get("files_without_metadata", 0) == 0:
247
+ score += 5
248
+ if self.metrics.get("uncommitted_files", 0) == 0:
249
+ score += 5
250
+
251
+ return max(0, min(100, score))
252
+
253
+ def run_all_checks(self):
254
+ """Run all cleanliness and ontology validation checks"""
255
+ self.validate_directory_structure()
256
+ self.validate_root_directory_compliance()
257
+ self.validate_ontology_dimensions()
258
+ self.validate_file_naming()
259
+ self.find_orphaned_files()
260
+ self.check_metadata_tags()
261
+ self.check_git_status()
262
+
263
+
264
+ def generate_report(validator: CleanlinessValidator) -> str:
265
+ """Generate cleanliness report"""
266
+ score = validator.calculate_cleanliness_score()
267
+
268
+ # Determine status emoji
269
+ if score >= 90:
270
+ status = "✨ Excellent"
271
+ color = "🟢"
272
+ elif score >= 70:
273
+ status = "👍 Good"
274
+ color = "🟡"
275
+ elif score >= 50:
276
+ status = "⚠️ Needs Attention"
277
+ color = "🟠"
278
+ else:
279
+ status = "🔴 Critical Issues"
280
+ color = "🔴"
281
+
282
+ report = f"""
283
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
284
+ {color} ONTOLOGY COMPLIANCE & CLEANLINESS - {status} ({score}/100)
285
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
286
+ """
287
+
288
+ # Show errors
289
+ errors = [issue for issue in validator.issues if issue[0] == "error"]
290
+ if errors:
291
+ report += "\n🔴 ERRORS:\n"
292
+ for _, message in errors:
293
+ report += f" • {message}\n"
294
+
295
+ # Show warnings
296
+ if validator.warnings:
297
+ report += "\n⚠️ WARNINGS:\n"
298
+ for warning in validator.warnings[:5]: # Limit to 5
299
+ report += f" • {warning}\n"
300
+ if len(validator.warnings) > 5:
301
+ report += f" ... and {len(validator.warnings) - 5} more warnings\n"
302
+
303
+ # Show metrics
304
+ if validator.metrics:
305
+ report += "\n📊 METRICS:\n"
306
+ for key, value in validator.metrics.items():
307
+ formatted_key = key.replace("_", " ").title()
308
+ report += f" • {formatted_key}: {value}\n"
309
+
310
+ # Show clean status
311
+ if not errors and not validator.warnings:
312
+ report += "\n✅ Everything is clean! Ready to proceed.\n"
313
+
314
+ report += "\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n"
315
+
316
+ # Add recommendations
317
+ if score < 90:
318
+ report += "\n💡 RECOMMENDATIONS:\n"
319
+ if validator.metrics.get("root_violations", 0) > 0:
320
+ report += " • CRITICAL: Move unauthorized files from root to /one/<dimension>/\n"
321
+ report += " Root should ONLY contain: README.md, LICENSE.md, SECURITY.md, CLAUDE.md, AGENTS.md\n"
322
+ if validator.metrics.get("files_without_metadata", 0) > 0:
323
+ report += " • Run: Add metadata tags to documentation files\n"
324
+ if validator.metrics.get("uncommitted_files", 0) > 0:
325
+ report += " • Run: git add . && git commit -m 'chore: clean up'\n"
326
+ if any(issue[0] == "error" for issue in validator.issues):
327
+ report += " • Fix critical ontology violations before proceeding\n"
328
+ report += "\n📚 6-DIMENSION ONTOLOGY:\n"
329
+ report += " • groups - Hierarchical containers (multi-tenant isolation)\n"
330
+ report += " • people - Authorization & governance (roles, permissions)\n"
331
+ report += " • things - All entities (users, agents, content, tokens)\n"
332
+ report += " • connections - Relationships between entities\n"
333
+ report += " • events - Actions and state changes over time\n"
334
+ report += " • knowledge - Labels, embeddings, semantic search\n"
335
+ report += "\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n"
336
+
337
+ return report
338
+
339
+
340
+ def main():
341
+ try:
342
+ # Load hook input from stdin
343
+ input_data = json.load(sys.stdin)
344
+ prompt = input_data.get("prompt", "")
345
+
346
+ # Get project directory
347
+ project_dir = os.environ.get("CLAUDE_PROJECT_DIR", ".")
348
+
349
+ # Skip validation for workflow commands
350
+ if prompt.strip().startswith("/"):
351
+ sys.exit(0)
352
+
353
+ # Run validation
354
+ validator = CleanlinessValidator(project_dir)
355
+ validator.run_all_checks()
356
+
357
+ # Generate report
358
+ report = generate_report(validator)
359
+
360
+ # Determine if we should block
361
+ score = validator.calculate_cleanliness_score()
362
+ errors = [issue for issue in validator.issues if issue[0] == "error"]
363
+
364
+ # Only block if there are critical errors
365
+ if errors and score < 30:
366
+ output = {
367
+ "hookSpecificOutput": {
368
+ "hookEventName": "UserPromptSubmit",
369
+ "additionalContext": report,
370
+ "blocked": True,
371
+ "blockedMessage": "Critical cleanliness issues detected. Please fix errors before proceeding."
372
+ },
373
+ }
374
+ else:
375
+ # Just show report as context
376
+ output = {
377
+ "hookSpecificOutput": {
378
+ "hookEventName": "UserPromptSubmit",
379
+ "additionalContext": report,
380
+ },
381
+ }
382
+
383
+ print(json.dumps(output))
384
+ sys.exit(0)
385
+
386
+ except Exception as e:
387
+ # Don't block on hook errors
388
+ print(f"Error in clean-pre hook: {e}", file=sys.stderr)
389
+ sys.exit(0)
390
+
391
+
392
+ if __name__ == "__main__":
393
+ main()
@@ -0,0 +1,73 @@
1
+ #!/bin/bash
2
+
3
+ # Clean Markdown Hook - ONE Platform
4
+ # Moves unwanted markdown files to one/events/
5
+ # Root allowed: README.md, CLAUDE.md, AGENTS.md, LICENSE.md, SECURITY.md
6
+ # /web allowed: README.md, CLAUDE.md, AGENTS.md, LICENSE.md, SECURITY.md
7
+ # Everything else moves to one/events/ (6-dimension EVENTS dimension)
8
+
9
+ PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(git rev-parse --show-toplevel)}"
10
+ EVENTS_DIR="$PROJECT_DIR/one/events"
11
+
12
+ # Allowed files (same for both root and web)
13
+ ALLOWED_FILES=(
14
+ "README.md"
15
+ "CLAUDE.md"
16
+ "AGENTS.md"
17
+ "LICENSE.md"
18
+ "SECURITY.md"
19
+ )
20
+
21
+ # Create events directory if it doesn't exist
22
+ mkdir -p "$EVENTS_DIR"
23
+
24
+ # Function to clean markdown files in a directory
25
+ clean_directory() {
26
+ local dir="$1"
27
+ local dir_name=$(basename "$dir")
28
+
29
+ if [ ! -d "$dir" ]; then
30
+ return
31
+ fi
32
+
33
+ # Find all markdown files in this directory (max depth 1)
34
+ while IFS= read -r file; do
35
+ filename=$(basename "$file")
36
+
37
+ # Check if file is in allowed list
38
+ is_allowed=0
39
+ for allowed in "${ALLOWED_FILES[@]}"; do
40
+ if [ "$filename" = "$allowed" ]; then
41
+ is_allowed=1
42
+ break
43
+ fi
44
+ done
45
+
46
+ # If not allowed, move it to one/events/
47
+ if [ $is_allowed -eq 0 ]; then
48
+ # Add timestamp and source directory to avoid collisions
49
+ timestamp=$(date +%Y%m%d-%H%M%S)
50
+
51
+ # If root, just use filename; if /web, prefix with "web-"
52
+ if [ "$dir_name" = "web" ]; then
53
+ new_name="web-${filename%.md}-${timestamp}.md"
54
+ else
55
+ new_name="${filename%.md}-${timestamp}.md"
56
+ fi
57
+
58
+ echo "Moving $(basename "$file") → one/events/$new_name"
59
+ mv "$file" "$EVENTS_DIR/$new_name"
60
+
61
+ # Stage the changes for git
62
+ git add -A "$file" "$EVENTS_DIR/$new_name" 2>/dev/null || true
63
+ fi
64
+ done < <(find "$dir" -maxdepth 1 -name "*.md" -type f)
65
+ }
66
+
67
+ # Clean root directory
68
+ clean_directory "$PROJECT_DIR"
69
+
70
+ # Clean /web directory
71
+ clean_directory "$PROJECT_DIR/web"
72
+
73
+ exit 0
@@ -0,0 +1,95 @@
1
+ #!/bin/bash
2
+
3
+ # ============================================================
4
+ # Fast Commit + Pull + Push Script
5
+ # ============================================================
6
+ # Quickly stage, commit, pull, and push changes
7
+ # Usage: ./.claude/hooks/commit-push.sh "commit message"
8
+ #
9
+ # CRITICAL RULE: Always pulls before pushing to prevent divergence
10
+ # Workflow: stage → commit → pull → push
11
+ #
12
+ # Examples:
13
+ # ./.claude/hooks/commit-push.sh "quick fix"
14
+ # ./.claude/hooks/commit-push.sh "update docs"
15
+ # ============================================================
16
+
17
+ set -e
18
+
19
+ # Colors
20
+ GREEN='\033[0;32m'
21
+ BLUE='\033[0;34m'
22
+ YELLOW='\033[1;33m'
23
+ RED='\033[0;31m'
24
+ NC='\033[0m'
25
+
26
+ # Get commit message
27
+ COMMIT_MSG="${1:-chore: quick update}"
28
+
29
+ echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
30
+ echo -e "${BLUE} Fast Commit + Pull + Push${NC}"
31
+ echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
32
+ echo ""
33
+
34
+ # Step 1: Check for changes
35
+ echo -e "${BLUE}Step 1: Check for changes${NC}"
36
+ if [[ -z $(git status -s) ]]; then
37
+ echo -e "${YELLOW}⚠ No changes to commit${NC}"
38
+ exit 0
39
+ fi
40
+ CHANGE_COUNT=$(git status -s | wc -l)
41
+ echo -e "${GREEN}✓ Found ${CHANGE_COUNT} file(s) to commit${NC}"
42
+ echo ""
43
+
44
+ # Step 2: Stage changes
45
+ echo -e "${BLUE}Step 2: Stage all changes${NC}"
46
+ git add -A
47
+ echo -e "${GREEN}✓ Changes staged${NC}"
48
+ echo ""
49
+
50
+ # Step 3: Commit
51
+ echo -e "${BLUE}Step 3: Create commit${NC}"
52
+ git commit -m "$(cat <<EOF
53
+ ${COMMIT_MSG}
54
+
55
+ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
56
+
57
+ Co-Authored-By: Claude <noreply@anthropic.com>
58
+ EOF
59
+ )"
60
+ COMMIT_HASH=$(git log -1 --format="%h")
61
+ echo -e "${GREEN}✓ Committed: ${COMMIT_HASH}${NC}"
62
+ echo ""
63
+
64
+ # Step 4: Pull latest (CRITICAL - prevents divergence)
65
+ echo -e "${BLUE}Step 4: Pull latest from origin${NC}"
66
+ if git pull origin main --ff-only 2>/dev/null; then
67
+ echo -e "${GREEN}✓ Pulled latest changes (fast-forward)${NC}"
68
+ else
69
+ echo -e "${YELLOW}⚠️ Fast-forward failed, attempting merge pull${NC}"
70
+ if git pull origin main --no-rebase; then
71
+ echo -e "${GREEN}✓ Pulled with merge${NC}"
72
+ else
73
+ echo -e "${RED}✗ Pull failed - resolve conflicts and retry${NC}"
74
+ exit 1
75
+ fi
76
+ fi
77
+ echo ""
78
+
79
+ # Step 5: Push
80
+ echo -e "${BLUE}Step 5: Push to origin${NC}"
81
+ git push origin main
82
+ echo -e "${GREEN}✓ Pushed to origin/main${NC}"
83
+ echo ""
84
+
85
+ # Step 6: Summary
86
+ echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
87
+ echo -e "${GREEN}✅ Commit + Pull + Push Complete!${NC}"
88
+ echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
89
+ echo ""
90
+ echo -e "${BLUE}Summary:${NC}"
91
+ echo " 📝 Commit: ${COMMIT_HASH}"
92
+ echo " 📦 Files: ${CHANGE_COUNT}"
93
+ echo " 🔄 Pulled: Latest from origin/main"
94
+ echo " ✅ Status: Synced to origin/main (no divergence)"
95
+ echo ""