1
2
3
4
5
| ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
β Pre-Generation β β β File Generation β β β Post-Generation β
β - Validate input β β - Create files β β - Add hooks β
β - Check context β β - Apply template β β - Configure CI β
ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
|
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
| # hooks/post_gen.py
import os
import json
def inject_sea_hooks():
"""Add SEAβ’ validation to generated project."""
if not os.environ.get('include_sea_governance', 'true') == 'true':
return
# 1. Add pre-commit configuration
add_precommit_config()
# 2. Add SEAβ’ configuration
add_sea_config()
# 3. Add CI validation step
add_ci_validation()
def add_sea_config():
"""Create sea.config.json."""
config = {
"boundedContext": os.environ.get('sea_bounded_context', 'developer-tooling'),
"validation": {
"enabled": True,
"strict": True
},
"ifl": {
"enabled": os.environ.get('include_ifl_identity', 'true') == 'true',
"mintOnGenerate": True
}
}
with open('sea.config.json', 'w') as f:
json.dump(config, f, indent=2)
def add_ci_validation():
"""Add SEAβ’ validation to GitHub Actions."""
ci_step = """
- name: SEAβ’ Validation
run: |
sea validate models/
calm validate
node scripts/spec-cross-check.js --mode production
"""
# Append to workflow file...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| {
"boundedContext": "cognitive-extension",
"validation": {
"enabled": true,
"strict": true,
"rules": ["no-orphan-specs", "trace-to-prd"]
},
"ifl": {
"enabled": true,
"mintOnGenerate": true,
"algorithm": "sha256"
},
"calm": {
"enabled": true,
"architectureFile": "architecture.calm.json"
}
}
|