-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-collaborative-ctx.sh
More file actions
executable file
Β·171 lines (135 loc) Β· 4.69 KB
/
setup-collaborative-ctx.sh
File metadata and controls
executable file
Β·171 lines (135 loc) Β· 4.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#!/bin/bash
# Collaborative CTX Setup Script
# Sets up your environment for team-based ctx workflows
echo "π Setting up collaborative CTX environment..."
echo ""
# Check if ctx is installed and working
if ! command -v ctx &> /dev/null; then
echo "β ctx command not found. Please install ctx-tools first."
exit 1
fi
echo "β
ctx-tools found: $(ctx --version 2>/dev/null || echo 'installed')"
# Create templates directory if it doesn't exist
mkdir -p ~/projects/active/ctx-tools/templates
echo "β
Templates directory ready"
# Make all template scripts executable
chmod +x ~/projects/active/ctx-tools/templates/*.sh 2>/dev/null
echo "β
Template scripts are executable"
# Create team aliases for quick access
echo "Creating team collaboration aliases..."
# Add aliases to shell profile (check which shell)
SHELL_PROFILE=""
if [[ "$SHELL" == *"zsh"* ]]; then
SHELL_PROFILE="$HOME/.zshrc"
elif [[ "$SHELL" == *"bash"* ]]; then
SHELL_PROFILE="$HOME/.bashrc"
fi
if [[ -n "$SHELL_PROFILE" ]]; then
# Add ctx collaboration aliases
cat >> "$SHELL_PROFILE" << 'EOF'
# CTX Collaborative Workflow Aliases
alias ctx-hotfix='~/projects/active/ctx-tools/templates/payment-hotfix-template.sh'
alias ctx-handoff='ctx set-state in-review && ctx note "HANDOFF: Ready for next phase"'
alias ctx-block='ctx set-state blocked && ctx note "BLOCKED: $(read -p "Reason: " reason; echo $reason)"'
alias ctx-done='ctx set-state completed && ctx note "COMPLETED: $(date)"'
alias ctx-team='ctx list --format=table | grep -v completed'
alias ctx-mine='ctx list --format=table | grep $(whoami)'
# Enhanced ctx status with team info
ctx-status() {
echo "=== Current Context ==="
ctx status
echo ""
echo "=== Team Contexts ==="
ctx list --format=table | head -10
}
# Quick context switching with tab completion
ctx-switch() {
if [[ $# -eq 0 ]]; then
echo "Available contexts:"
ctx list --format=simple
return
fi
ctx switch "$1"
}
EOF
echo "β
Added collaboration aliases to $SHELL_PROFILE"
echo " Run 'source $SHELL_PROFILE' to activate aliases"
else
echo "β οΈ Could not determine shell profile. Add aliases manually."
fi
# Create quick start guide
cat > ~/projects/active/ctx-tools/COLLABORATION_QUICK_START.md << 'EOF'
# CTX Collaborative Quick Start Guide
## π Quick Commands
### Start New Work
```bash
# For payment hotfixes
ctx-hotfix PAYMENT-1234 "Fix CyberSource validation"
# For general development
ctx create feature-name --description "Description"
ctx set-state in-progress
```
### Team Handoffs
```bash
# Mark ready for review
ctx-handoff
# Block on dependency
ctx-block
# Complete work
ctx-done
```
### Team Visibility
```bash
# See all active team work
ctx-team
# Check current status
ctx-status
# Switch between contexts
ctx-switch context-name
```
## π Templates Available
- `payment-hotfix-template.sh` - Structured payment hotfix workflow
- `handoff-checklist.md` - Team handoff requirements
## π Workflow States
- π `pending` - Not started
- π» `in-progress` - Active development
- π `in-review` - Ready for handoff/review
- π« `blocked` - Waiting on dependency
- β
`completed` - Work finished
## π€ Collaboration Best Practices
1. **Use structured notes**: `TYPE: description | METADATA: details`
2. **Clear handoffs**: Include branch, PR, and test instructions
3. **Update states**: Keep team informed of progress
4. **Document decisions**: Add rationale for technical choices
5. **Tag stakeholders**: Use @mentions in notes for visibility
## π§ Memory Integration
Your ctx contexts are connected to memory for knowledge retention:
- Technical patterns are captured automatically
- Previous solutions are searchable
- Team knowledge builds over time
EOF
echo "β
Created quick start guide: ~/projects/active/ctx-tools/COLLABORATION_QUICK_START.md"
echo ""
# Test the setup
echo "π§ͺ Testing collaborative setup..."
# Test context creation
TEST_CONTEXT="collab-setup-test"
ctx create "$TEST_CONTEXT" --description "Testing collaborative setup" >/dev/null 2>&1
if ctx switch "$TEST_CONTEXT" >/dev/null 2>&1; then
ctx note "SETUP: Collaborative environment configured successfully"
ctx set-state completed >/dev/null 2>&1
echo "β
Context management working"
else
echo "β Context creation test failed"
fi
echo ""
echo "π Collaborative CTX setup complete!"
echo ""
echo "Next steps:"
echo " 1. source $SHELL_PROFILE # Activate new aliases"
echo " 2. ctx-status # Check current setup"
echo " 3. Read: ~/projects/active/ctx-tools/COLLABORATION_QUICK_START.md"
echo " 4. Try: ctx-hotfix DEMO-123 'Test collaborative workflow'"
echo ""
echo "Available templates:"
ls -la ~/projects/active/ctx-tools/templates/