-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_script.sh
More file actions
461 lines (378 loc) Β· 12.5 KB
/
setup_script.sh
File metadata and controls
461 lines (378 loc) Β· 12.5 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
#!/bin/bash
echo "π» Setting up Phuzzy - Fuzzy Logic Virtual Bear Development Team"
echo "================================================================"
# Check if running on Raspberry Pi
if grep -q "Raspberry Pi" /proc/cpuinfo 2>/dev/null; then
echo "β
Raspberry Pi detected - Perfect bear habitat!"
PI_SETUP=true
else
echo "π» Running on standard system - Bear-compatible environment"
PI_SETUP=false
fi
# Check Python version
PYTHON_VERSION=$(python3 --version 2>&1 | grep -oE '[0-9]+\.[0-9]+')
if [[ $(echo "$PYTHON_VERSION >= 3.11" | bc -l) -eq 1 ]]; then
echo "β
Python $PYTHON_VERSION detected - Bears approve!"
else
echo "β οΈ Python 3.11+ recommended for optimal bear performance"
fi
# Create virtual environment for bears
echo "π Setting up Python bear environment"
python3 -m venv venv
source venv/bin/activate
# Install Python dependencies for bears
echo "π¦ Installing Python packages for bear intelligence"
cat > requirements.txt << 'EOF'
# Core bear dependencies
numpy>=1.21.0
scipy>=1.7.0
scikit-fuzzy>=0.4.2
matplotlib>=3.5.0
# Bear web interfaces
flask>=2.0.0
fastapi>=0.70.0
uvicorn>=0.15.0
# Bear data management
pyyaml>=6.0
python-dotenv>=0.19.0
requests>=2.25.0
# Bear system monitoring
psutil>=5.8.0
# Bear development tools
pytest>=6.2.0
black>=21.0.0
flake8>=4.0.0
mypy>=0.910
# Bear documentation
jupyter>=1.0.0
notebook>=6.4.0
# Bear communication
websockets>=10.0
EOF
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
# Create necessary directories for bear operations
echo "π Creating bear directory structure"
mkdir -p data/{training_data,memory_dumps,performance_logs,research_datasets}
mkdir -p docs/media/{architecture-diagrams,screenshots,videos,bear-photos}
mkdir -p chronicles/assets/{code-examples,diagrams,videos,bear-documentation}
mkdir -p src/{agents,fuzzy_logic,memory,communication,workflows,monitoring,utils}
mkdir -p tests/{test_agents,test_fuzzy_logic,test_memory,test_communication}
mkdir -p config examples hardware community research
# Create bear-specific subdirectories
mkdir -p data/bear_profiles
mkdir -p docs/media/phuzzy-bear-gallery
mkdir -p src/bear_utilities
# Initialize configuration files for bears
echo "βοΈ Setting up bear configuration"
# Create bear agent configuration
cat > config/bear_agent_config.yaml << 'EOF'
# Phuzzy Bear Agent Configuration
bear_agents:
alice:
type: "coordinator"
personality: "wise_leader"
energy_level: 0.9
specializations: ["project_management", "conflict_resolution", "team_coordination"]
bob:
type: "developer"
personality: "creative_problem_solver"
energy_level: 0.85
specializations: ["coding", "architecture", "optimization"]
charlie:
type: "tester"
personality: "detail_oriented"
energy_level: 0.8
specializations: ["quality_assurance", "validation", "bug_detection"]
bear_system:
max_energy_level: 1.0
energy_decay_rate: 0.05
rest_recovery_rate: 0.3
collaboration_bonus: 0.1
fuzzy_logic:
confidence_levels: ["very_low", "low", "medium", "high", "very_high"]
membership_function_type: "triangular"
defuzzification_method: "centroid"
memory:
working_memory_capacity: 7
episodic_memory_retention_days: 30
semantic_memory_consolidation_threshold: 0.7
EOF
# Create fuzzy logic configuration for bears
cat > config/fuzzy_bear_logic_config.yaml << 'EOF'
# Fuzzy Logic Configuration for Bear Reasoning
linguistic_variables:
bear_confidence:
range: [0, 10]
terms:
very_uncertain: [0, 0, 2]
uncertain: [1, 3, 5]
somewhat_confident: [3, 5, 7]
confident: [5, 7, 9]
very_confident: [7, 10, 10]
bear_evidence_quality:
range: [0, 10]
terms:
poor: [0, 0, 3]
fair: [2, 4, 6]
good: [4, 6, 8]
excellent: [6, 8, 10]
bear_urgency:
range: [0, 10]
terms:
low: [0, 0, 3]
medium: [2, 5, 8]
high: [6, 10, 10]
bear_rules:
- if: ["evidence_quality is poor", "urgency is low"]
then: "confidence is very_uncertain"
operator: "OR"
- if: ["evidence_quality is good", "urgency is medium"]
then: "confidence is confident"
operator: "AND"
- if: ["evidence_quality is excellent", "urgency is high"]
then: "confidence is very_confident"
operator: "AND"
EOF
# Create monitoring configuration for bear health
cat > config/bear_monitoring_config.yaml << 'EOF'
# Bear System Monitoring Configuration
monitoring:
update_interval_seconds: 5
log_level: "INFO"
metrics_retention_days: 7
performance_thresholds:
max_response_time_ms: 500
max_memory_usage_mb: 512
max_cpu_usage_percent: 80
min_bear_energy_level: 0.2
alerts:
low_bear_energy: 0.3
high_memory_usage: 400
slow_response_time: 1000
dashboard:
port: 8080
refresh_rate_seconds: 2
show_bear_moods: true
show_fuzzy_confidence_charts: true
EOF
# Set up monitoring dashboard for bears
if [ "$PI_SETUP" = true ]; then
echo "π§ Configuring Raspberry Pi specific settings for bears"
# Enable SSH for remote bear management
sudo systemctl enable ssh
# Optimize GPU memory split for bear AI
if ! grep -q "gpu_mem=16" /boot/config.txt; then
echo "gpu_mem=16" | sudo tee -a /boot/config.txt
fi
# Create bear systemd service for auto-start
cat > bear_agents.service << 'EOF'
[Unit]
Description=Phuzzy Bear Agents Service
After=network.target
[Service]
Type=simple
User=pi
WorkingDirectory=/home/pi/phuzzy-dev
Environment=PATH=/home/pi/phuzzy-dev/venv/bin
ExecStart=/home/pi/phuzzy-dev/venv/bin/python -m src.agents.alice_coordinator
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
echo "π Bear service file created - install with: sudo cp bear_agents.service /etc/systemd/system/"
fi
# Create initial bear documentation
echo "π Creating initial bear documentation"
cat > README_BEARS.md << 'EOF'
# π» Meet the Phuzzy Bear Team
## Our Bear Agents
### Alice Bear π»π (Coordinator)
- **Personality**: Wise Leader
- **Specialties**: Project management, team coordination, conflict resolution
- **Bear Wisdom**: "A good plan today is better than a perfect plan tomorrow"
### Bob Bear π»π» (Developer)
- **Personality**: Creative Problem Solver
- **Specialties**: Coding, system architecture, optimization
- **Bear Motto**: "There's always a more elegant solution hiding in the code"
### Charlie Bear π»π (Tester)
- **Personality**: Detail Oriented
- **Specialties**: Quality assurance, validation, bug detection
- **Bear Philosophy**: "A bug found early saves nine bugs later"
## Bear Care Instructions
1. **Monitor bear energy levels** - Bears need rest to perform optimally
2. **Check bear moods** - Happy bears make better decisions
3. **Provide clear tasks** - Bears work best with well-defined objectives
4. **Celebrate bear successes** - Positive reinforcement improves bear performance
5. **Learn from bear mistakes** - Bears grow wiser through experience
## Bear Communication Protocol
Bears communicate using fuzzy confidence levels:
- π»π° "Very uncertain bear" (0-2)
- π»π€ "Thoughtful bear" (3-5)
- π»π "Confident bear" (6-8)
- π»π "Very confident bear" (9-10)
Remember: Bears are naturally collaborative and will always try to help each other succeed!
EOF
# Create example bear interaction script
cat > examples/basic_bear_interaction.py << 'EOF'
#!/usr/bin/env python3
"""
Basic Bear Interaction Example
Demonstrates how to work with Phuzzy bear agents
"""
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from src.agents.hello_fuzzy_bear import HelloFuzzyBearAgent
import time
def main():
print("π» Phuzzy Bear Interaction Demo")
print("=" * 40)
# Create a bear agent
bear = HelloFuzzyBearAgent("DemoBear")
# Demonstrate bear reasoning on different topics
topics = [
"This new feature will improve user experience",
"The current code architecture is scalable",
"We should deploy this update on Friday",
"The test coverage is sufficient for release",
"Bears make excellent software developers"
]
print(f"\nπ€ {bear.name} will analyze each topic with fuzzy bear logic:\n")
for i, topic in enumerate(topics, 1):
print(f"Topic {i}: {topic}")
result = bear.think_aloud_like_bear(topic)
# Add bear commentary
if result['numeric'] > 7:
print(f" π {bear.name} is enthusiastic about this!")
elif result['numeric'] > 4:
print(f" π€ {bear.name} sees potential but wants more info")
else:
print(f" π° {bear.name} suggests caution")
print() # Add spacing
time.sleep(1)
print(f"β¨ Demo complete! {bear.name} has shared their fuzzy bear wisdom.")
print("π» Remember: The best decisions combine logic with intuition!")
if __name__ == "__main__":
main()
EOF
chmod +x examples/basic_bear_interaction.py
# Create bear testing script
cat > tests/test_bear_setup.py << 'EOF'
#!/usr/bin/env python3
"""
Test Bear Setup
Validates that all bear systems are working correctly
"""
import unittest
import sys
import os
# Add project root to path
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
class TestBearSetup(unittest.TestCase):
"""Test cases for bear system setup"""
def test_fuzzy_logic_import(self):
"""Test that fuzzy logic libraries are available for bears"""
try:
import skfuzzy as fuzz
import numpy as np
self.assertTrue(True, "π» Fuzzy logic libraries loaded successfully!")
except ImportError as e:
self.fail(f"π»β Failed to import fuzzy logic libraries: {e}")
def test_bear_agent_creation(self):
"""Test that bear agents can be created"""
try:
from src.agents.hello_fuzzy_bear import HelloFuzzyBearAgent
bear = HelloFuzzyBearAgent("TestBear")
self.assertIsNotNone(bear, "π» Bear agent created successfully!")
self.assertEqual(bear.name, "TestBear", "π» Bear has correct name!")
except Exception as e:
self.fail(f"π»β Failed to create bear agent: {e}")
def test_bear_reasoning(self):
"""Test that bear agents can perform fuzzy reasoning"""
try:
from src.agents.hello_fuzzy_bear import HelloFuzzyBearAgent
bear = HelloFuzzyBearAgent("ReasoningTestBear")
result = bear.assess_bear_confidence(7.5, 8.0)
self.assertIn('numeric', result, "π» Bear reasoning returns numeric confidence!")
self.assertIn('linguistic', result, "π» Bear reasoning returns linguistic description!")
self.assertIn('bear_mood', result, "π» Bear reasoning includes mood!")
except Exception as e:
self.fail(f"π»β Bear reasoning failed: {e}")
if __name__ == '__main__':
print("π» Running Phuzzy Bear Setup Tests")
print("=" * 40)
unittest.main(verbosity=2)
EOF
# Create .gitignore for bear project
cat > .gitignore << 'EOF'
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
# Virtual Environment (bear habitat)
venv/
env/
ENV/
# Bear Data
data/memory_dumps/*
data/performance_logs/*
!data/training_data/.gitkeep
!data/memory_dumps/.gitkeep
!data/performance_logs/.gitkeep
# Bear Logs
*.log
logs/
# IDE
.vscode/
.idea/
*.swp
*.swo
# OS
.DS_Store
Thumbs.db
# Bear Configuration (keep examples, ignore local configs)
config/*_local.yaml
config/secrets.yaml
# Bear Testing
.coverage
htmlcov/
.pytest_cache/
# Bear Documentation Build
docs/_build/
site/
EOF
# Create placeholder files to maintain directory structure
touch data/training_data/.gitkeep
touch data/memory_dumps/.gitkeep
touch data/performance_logs/.gitkeep
touch data/research_datasets/.gitkeep
echo "β¨ Phuzzy Bear setup complete!"
echo ""
echo "π Next steps for bear development:"
echo "1. π Activate bear environment: source venv/bin/activate"
echo "2. π§ͺ Test bear setup: python tests/test_bear_setup.py"
echo "3. π» Try bear interaction: python examples/basic_bear_interaction.py"
echo "4. π Read bear documentation: cat README_BEARS.md"
echo "5. π Start Lesson 1: chronicles/phase-1-foundation/lesson-01-hardware-setup.md"
echo ""
echo "π» Welcome to the Phuzzy Bear development team!"
echo " Remember: Sometimes the most logical thing is to embrace the fuzzy! π€"