📄 Copier Templates

Project scaffolding with Copier.


Overview

Copier is the template engine for creating new SEA-governed projects. Templates include governance hooks, IFL identity minting, and CALM validation.


Using Copier

Basic Usage

1
2
3
4
5
# Create new project from template
copier copy gh:GodSpeedAI/SEA-template ./my-project

# Update existing project
copier update ./my-project

SEAâ„¢ Template Questions

When creating a new project, you’ll be prompted:

Question Purpose
include_sea_governance Enable SEAâ„¢ DSL validation
include_ifl_identity Enable IFL identity minting
sea_bounded_context Assign to bounded context
data_classification Set data sensitivity level
runtime Choose Python or TypeScript
deployment Edge or cloud deployment

Template Configuration

copier.yml

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
# Identity
project_name:
  type: str
  help: Name of the project

owner:
  type: str
  help: Team or person responsible

# SEAâ„¢ Governance
include_sea_governance:
  type: bool
  help: |
    Enable SEAâ„¢ DSL validation in the generated project?

    This adds:
    - SEAâ„¢ DSL linting in pre-commit
    - CALM architecture validation
    - Spec traceability checks
  default: true

include_ifl_identity:
  type: bool
  help: |
    Enable IFL identity minting?

    This adds:
    - Deterministic identity tokens (ifl:hash)
    - Merkle proof generation
    - Provenance auditing
  default: true
  when: '{{ include_sea_governance }}'

sea_bounded_context:
  type: str
  help: |
    Which SEAâ„¢ bounded context?
    - semantic-core
    - cognitive-extension
    - architectural-governance
    - developer-tooling
  default: 'developer-tooling'
  when: '{{ include_sea_governance }}'

# Risk
criticality:
  type: str
  help: Service criticality level
  choices:
    - low
    - medium
    - high
    - critical
  default: medium

data_classification:
  type: str
  help: Data sensitivity
  choices:
    - public
    - internal
    - confidential
    - restricted
  default: internal

Post-Generation Hooks

hooks/post_gen.py

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
#!/usr/bin/env python3
"""Post-generation hook for SEAâ„¢ governance."""

import os
import subprocess

def inject_sea_validation():
    """Add SEAâ„¢ validation to pre-commit."""
    if os.environ.get('include_sea_governance', 'true') == 'true':
        # Add SEAâ„¢ linting hook
        with open('.pre-commit-config.yaml', 'a') as f:
            f.write('''
- repo: local
  hooks:
    - id: sea-validate
      name: SEAâ„¢ DSL Validation
      entry: sea validate
      language: system
      files: \\.sea$
''')

def inject_ifl_identity():
    """Configure IFL identity minting."""
    if os.environ.get('include_ifl_identity', 'true') == 'true':
        # Add IFL configuration
        with open('sea.config.json', 'w') as f:
            f.write('''{
  "ifl": {
    "enabled": true,
    "mintOnGenerate": true
  }
}''')

def inject_calm_validation():
    """Add CALM architecture validation."""
    # Add CALM validation to CI
    pass

if __name__ == '__main__':
    inject_sea_validation()
    inject_ifl_identity()
    inject_calm_validation()
    print("✅ SEA™ governance hooks injected")

Template Structure

1
2
3
4
5
6
7
8
9
10
11
12
13
14
template/
├── copier.yml           # Configuration
├── hooks/
│   ├── pre_gen.py       # Before generation
│   └── post_gen.py      # After generation
├── {{ project_name }}/
│   ├── src/
│   │   └── index.ts.jinja
│   ├── package.json.jinja
│   ├── tsconfig.json.jinja
│   └── {% if include_sea_governance %}
│       └── sea.config.json.jinja
│       {% endif %}
└── README.md.jinja

Jinja Syntax

Conditionals

1
2
3
4
{% if include_sea_governance %}
// SEAâ„¢ governance enabled
import { validateSea } from '@sea/validator';
{% endif %}

Variables

1
2
3
4
5
{
  "name": "{{ project_name }}",
  "version": "1.0.0",
  "author": "{{ owner }}"
}

Idempotence

Copier maintains a copier.lock file for reproducible builds:

1
2
3
4
# copier.lock
_src_path: gh:GodSpeedAI/SEA-template
_commit: abc123
_answers_file: .copier-answers.yml

Check Idempotence

1
2
3
# Verify reproducibility
copier copy --vcs-ref=abc123 gh:GodSpeedAI/SEA-template ./verify
diff -r ./my-project ./verify