Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:17:39 +08:00
commit 1b8e4d76ac
13 changed files with 2026 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
# Project Creator Scripts
## validate_project.py
**RECOMMENDED**: Python validation script (cross-platform, no bash required)
Validates that a CCGG Business Operations project has all required mechanisms.
**Usage**:
```bash
py scripts/validate_project.py <project-name>
```
**What it checks**:
- Project folder exists
- CLAUDE.md exists with PARENT SYSTEM INTEGRATION section
- All 4 sub-sections present (Index Sync, Operations Logging, Strategic Alignment, Cross-Project Intelligence)
- README.md exists
- Active Projects Index entry exists
- operations_log.txt entry exists
- No template variables left unreplaced
**Exit codes**:
- 0: Validation passed (or passed with warnings)
- 1: Validation failed (errors found)
**Examples**:
```bash
py scripts/validate_project.py ccgg-offers-pricing
py scripts/validate_project.py magnetic-content-os
```
---
## validate_project.sh
**LEGACY**: Bash version of validation script (use validate_project.py instead)
Same functionality as validate_project.py, but requires bash shell (Git Bash or WSL on Windows).
**Usage**:
```bash
bash scripts/validate_project.sh <project-name>
```
**Note**: Python version (validate_project.py) is preferred for cross-platform compatibility.
---
## create_project.py (Planned - Not Yet Implemented)
Automated project structure creation script.
**Planned usage**:
```bash
py scripts/create_project.py <project-name> --complexity <simple|complex>
```
**Planned functionality**:
- Prompt for project details (title, purpose, scope, etc.)
- Assess project complexity (simple vs complex)
- Create project folder structure
- Copy appropriate template files
- Replace template variables with user input
- Create Active Projects Index entry
- Log to operations_log.txt
- Run validation
- Report project creation summary
**Status**: Not implemented yet. For now, use manual creation workflow in SKILL.md.
---
**Development Note**: Scripts are being migrated from bash to Python for cross-platform compatibility. Python scripts can run on Windows, macOS, and Linux without requiring bash shell.

View File

@@ -0,0 +1,158 @@
#!/usr/bin/env python3
"""
Validates that a CCGG Business Operations project has all required mechanisms
Usage:
python validate_project.py <project-name>
Examples:
python validate_project.py ccgg-offers-pricing
python validate_project.py magnetic-content-os
"""
import sys
from pathlib import Path
def validate_project(project_name):
"""
Validate a CCGG Business Operations project has all required mechanisms.
Args:
project_name: Name of the project to validate
Returns:
(errors, warnings) tuple with counts
"""
project_path = Path("Active Projects/_Incubator") / project_name
index_path = Path("Project Memory/Active Projects Index") / f"{project_name}-index.md"
print(f"[VALIDATING] project: {project_name}")
print()
errors = 0
warnings = 0
# Check 1: Project folder exists
if not project_path.exists():
print(f"[ERROR] Project folder not found: {project_path}")
errors += 1
else:
print("[OK] Project folder exists")
# Check 2: CLAUDE.md exists
claude_md = project_path / "CLAUDE.md"
if not claude_md.exists():
print("[ERROR] CLAUDE.md not found")
errors += 1
else:
print("[OK] CLAUDE.md exists")
# Read CLAUDE.md content
content = claude_md.read_text(encoding='utf-8')
# Check 2a: PARENT SYSTEM INTEGRATION section
if "## PARENT SYSTEM INTEGRATION" not in content:
print("[ERROR] PARENT SYSTEM INTEGRATION section missing in CLAUDE.md")
errors += 1
else:
print("[OK] PARENT SYSTEM INTEGRATION section present")
# Check sub-sections
if "### Project Memory Index Sync" not in content:
print("[WARNING] Project Memory Index Sync sub-section missing")
warnings += 1
if "### Operations Logging" not in content:
print("[WARNING] Operations Logging sub-section missing")
warnings += 1
if "### Strategic Alignment Validation" not in content:
print("[WARNING] Strategic Alignment Validation sub-section missing")
warnings += 1
if "### Cross-Project Intelligence" not in content:
print("[WARNING] Cross-Project Intelligence sub-section missing")
warnings += 1
# Check 2b: Template variables replaced
if "{{" in content:
print("[WARNING] Template variables not replaced ({{ found)")
warnings += 1
# Check 3: README.md exists
readme = project_path / "README.md"
if not readme.exists():
print("[WARNING] README.md not found")
warnings += 1
else:
print("[OK] README.md exists")
# Check 4: Active Projects Index exists
if not index_path.exists():
print(f"[ERROR] Active Projects Index not found: {index_path}")
errors += 1
else:
print("[OK] Active Projects Index exists")
# Read index content
index_content = index_path.read_text(encoding='utf-8')
# Check YAML frontmatter
if not index_content.startswith("---"):
print("[WARNING] YAML frontmatter missing in index")
warnings += 1
if "strategic_alignment:" not in index_content:
print("[WARNING] strategic_alignment missing in index")
warnings += 1
# Check 5: Operations log entry
ops_log = Path("operations_log.txt")
if ops_log.exists():
ops_content = ops_log.read_text(encoding='utf-8')
if project_name not in ops_content:
print(f"[WARNING] No operations_log.txt entry found for {project_name}")
warnings += 1
else:
print("[OK] Operations log entry exists")
else:
print("[WARNING] operations_log.txt not found")
warnings += 1
# Summary
print()
print("=" * 40)
print("Validation Summary")
print("=" * 40)
print(f"Errors: {errors}")
print(f"Warnings: {warnings}")
print()
if errors == 0 and warnings == 0:
print("[OK] Project validation PASSED")
return 0
elif errors == 0:
print("[WARNING] Project validation passed with warnings")
return 0
else:
print("[ERROR] Project validation FAILED")
return 1
def main():
if len(sys.argv) != 2:
print("Usage: python validate_project.py <project-name>")
print()
print("Examples:")
print(" python validate_project.py ccgg-offers-pricing")
print(" python validate_project.py magnetic-content-os")
sys.exit(1)
project_name = sys.argv[1]
exit_code = validate_project(project_name)
sys.exit(exit_code)
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,123 @@
#!/bin/bash
# Validates that a CCGG Business Operations project has all required mechanisms
PROJECT_NAME="$1"
if [ -z "$PROJECT_NAME" ]; then
echo "Usage: bash validate_project.sh <project-name>"
exit 1
fi
PROJECT_PATH="Active Projects/_Incubator/$PROJECT_NAME"
INDEX_PATH="Project Memory/Active Projects Index/${PROJECT_NAME}-index.md"
echo "🔍 Validating project: $PROJECT_NAME"
echo ""
ERRORS=0
WARNINGS=0
# Check 1: Project folder exists
if [ ! -d "$PROJECT_PATH" ]; then
echo "❌ ERROR: Project folder not found: $PROJECT_PATH"
((ERRORS++))
else
echo "✅ Project folder exists"
fi
# Check 2: CLAUDE.md exists
if [ ! -f "$PROJECT_PATH/CLAUDE.md" ]; then
echo "❌ ERROR: CLAUDE.md not found"
((ERRORS++))
else
echo "✅ CLAUDE.md exists"
# Check 2a: PARENT SYSTEM INTEGRATION section
if ! grep -q "## PARENT SYSTEM INTEGRATION" "$PROJECT_PATH/CLAUDE.md"; then
echo "❌ ERROR: PARENT SYSTEM INTEGRATION section missing in CLAUDE.md"
((ERRORS++))
else
echo "✅ PARENT SYSTEM INTEGRATION section present"
# Check sub-sections
if ! grep -q "### Project Memory Index Sync" "$PROJECT_PATH/CLAUDE.md"; then
echo "⚠️ WARNING: Project Memory Index Sync sub-section missing"
((WARNINGS++))
fi
if ! grep -q "### Operations Logging" "$PROJECT_PATH/CLAUDE.md"; then
echo "⚠️ WARNING: Operations Logging sub-section missing"
((WARNINGS++))
fi
if ! grep -q "### Strategic Alignment Validation" "$PROJECT_PATH/CLAUDE.md"; then
echo "⚠️ WARNING: Strategic Alignment Validation sub-section missing"
((WARNINGS++))
fi
if ! grep -q "### Cross-Project Intelligence" "$PROJECT_PATH/CLAUDE.md"; then
echo "⚠️ WARNING: Cross-Project Intelligence sub-section missing"
((WARNINGS++))
fi
fi
# Check 2b: Template variables replaced
if grep -q "{{" "$PROJECT_PATH/CLAUDE.md"; then
echo "⚠️ WARNING: Template variables not replaced ({{ found)"
((WARNINGS++))
fi
fi
# Check 3: README.md exists
if [ ! -f "$PROJECT_PATH/README.md" ]; then
echo "⚠️ WARNING: README.md not found"
((WARNINGS++))
else
echo "✅ README.md exists"
fi
# Check 4: Active Projects Index exists
if [ ! -f "$INDEX_PATH" ]; then
echo "❌ ERROR: Active Projects Index not found: $INDEX_PATH"
((ERRORS++))
else
echo "✅ Active Projects Index exists"
# Check YAML frontmatter
if ! grep -q "^---$" "$INDEX_PATH"; then
echo "⚠️ WARNING: YAML frontmatter missing in index"
((WARNINGS++))
fi
if ! grep -q "strategic_alignment:" "$INDEX_PATH"; then
echo "⚠️ WARNING: strategic_alignment missing in index"
((WARNINGS++))
fi
fi
# Check 5: Operations log entry
if ! grep -q "$PROJECT_NAME" "operations_log.txt"; then
echo "⚠️ WARNING: No operations_log.txt entry found for $PROJECT_NAME"
((WARNINGS++))
else
echo "✅ Operations log entry exists"
fi
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Validation Summary"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Errors: $ERRORS"
echo "Warnings: $WARNINGS"
echo ""
if [ $ERRORS -eq 0 ] && [ $WARNINGS -eq 0 ]; then
echo "✅ Project validation PASSED"
exit 0
elif [ $ERRORS -eq 0 ]; then
echo "⚠️ Project validation passed with warnings"
exit 0
else
echo "❌ Project validation FAILED"
exit 1
fi