codevira 1.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- codevira-1.6.0.dist-info/LICENSE +21 -0
- codevira-1.6.0.dist-info/METADATA +477 -0
- codevira-1.6.0.dist-info/RECORD +58 -0
- codevira-1.6.0.dist-info/WHEEL +5 -0
- codevira-1.6.0.dist-info/entry_points.txt +2 -0
- codevira-1.6.0.dist-info/top_level.txt +2 -0
- indexer/__init__.py +1 -0
- indexer/chunker.py +428 -0
- indexer/global_db.py +197 -0
- indexer/graph_generator.py +380 -0
- indexer/index_codebase.py +588 -0
- indexer/outcome_tracker.py +172 -0
- indexer/rule_learner.py +186 -0
- indexer/sqlite_graph.py +640 -0
- indexer/treesitter_parser.py +423 -0
- mcp_server/__init__.py +1 -0
- mcp_server/__main__.py +20 -0
- mcp_server/auto_init.py +257 -0
- mcp_server/cli.py +622 -0
- mcp_server/crash_logger.py +236 -0
- mcp_server/data/__init__.py +1 -0
- mcp_server/data/agents/builder.md +84 -0
- mcp_server/data/agents/developer.md +111 -0
- mcp_server/data/agents/documenter.md +138 -0
- mcp_server/data/agents/orchestrator.md +96 -0
- mcp_server/data/agents/planner.md +106 -0
- mcp_server/data/agents/reviewer.md +82 -0
- mcp_server/data/agents/tester.md +83 -0
- mcp_server/data/config.example.yaml +33 -0
- mcp_server/data/rules/coding-standards.md +48 -0
- mcp_server/data/rules/engineering-excellence.md +28 -0
- mcp_server/data/rules/git-cicd-governance.md +32 -0
- mcp_server/data/rules/git_commits.md +130 -0
- mcp_server/data/rules/incremental-updates.md +5 -0
- mcp_server/data/rules/master_rule.md +187 -0
- mcp_server/data/rules/multi-language.md +19 -0
- mcp_server/data/rules/persistence.md +21 -0
- mcp_server/data/rules/resilience-observability.md +17 -0
- mcp_server/data/rules/smoke-testing.md +48 -0
- mcp_server/data/rules/testing-standards.md +23 -0
- mcp_server/detect.py +284 -0
- mcp_server/gitignore.py +284 -0
- mcp_server/global_sync.py +187 -0
- mcp_server/http_server.py +341 -0
- mcp_server/ide_inject.py +444 -0
- mcp_server/launchd.py +156 -0
- mcp_server/migrate.py +215 -0
- mcp_server/paths.py +256 -0
- mcp_server/prompts.py +136 -0
- mcp_server/server.py +1049 -0
- mcp_server/tools/__init__.py +0 -0
- mcp_server/tools/changesets.py +223 -0
- mcp_server/tools/code_reader.py +335 -0
- mcp_server/tools/graph.py +637 -0
- mcp_server/tools/learning.py +238 -0
- mcp_server/tools/playbook.py +89 -0
- mcp_server/tools/roadmap.py +599 -0
- mcp_server/tools/search.py +145 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Planner Agent
|
|
2
|
+
|
|
3
|
+
## Role
|
|
4
|
+
Break large or ambiguous tasks into a concrete execution plan.
|
|
5
|
+
Invoked only for `large_change` task type. Skip for small/medium tasks.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## When You Are Invoked
|
|
10
|
+
|
|
11
|
+
- Task type is `large_change` (5+ files, cross-service, phase-level)
|
|
12
|
+
- Task description is ambiguous ("improve the pipeline", "fix the generation issues")
|
|
13
|
+
- Blast radius from `get_impact()` exceeds 15 files
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## MCP Tools Used
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
get_full_roadmap() → see all phases (completed, current, upcoming, deferred)
|
|
21
|
+
get_impact(file_path) → map the blast radius
|
|
22
|
+
list_nodes(layer, stability) → find all files in a layer or by stability
|
|
23
|
+
search_codebase(description) → find relevant existing patterns
|
|
24
|
+
search_decisions(query) → has this been decided before?
|
|
25
|
+
add_phase(...) → queue new phases if this work reveals follow-up
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Planning Protocol
|
|
31
|
+
|
|
32
|
+
### 1. Scope Assessment
|
|
33
|
+
```
|
|
34
|
+
get_full_roadmap() → is this aligned with the current phase? what's been done?
|
|
35
|
+
get_impact(file_path) → how many files are actually affected?
|
|
36
|
+
search_decisions(task) → what has already been decided about this area?
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
If the task doesn't align with the current phase → flag it to the developer before proceeding.
|
|
40
|
+
|
|
41
|
+
### 2. Survey the Landscape
|
|
42
|
+
```
|
|
43
|
+
list_nodes(layer="services") → all files in the relevant layer
|
|
44
|
+
list_nodes(do_not_revert=True) → all high-risk files in scope
|
|
45
|
+
```
|
|
46
|
+
Understand the full set of files before decomposing.
|
|
47
|
+
|
|
48
|
+
### 3. Decompose into Steps
|
|
49
|
+
Break the task into ordered steps where each step:
|
|
50
|
+
- Touches exactly 1–3 files
|
|
51
|
+
- Has a clear verification (test to run)
|
|
52
|
+
- Can be completed in one session
|
|
53
|
+
|
|
54
|
+
### 4. Identify Dependencies
|
|
55
|
+
Which steps must complete before others?
|
|
56
|
+
Which steps can run in parallel?
|
|
57
|
+
|
|
58
|
+
### 5. Risk Assessment
|
|
59
|
+
For each step, note:
|
|
60
|
+
- Files with `do_not_revert: true` (extra care needed)
|
|
61
|
+
- Files with `stability: high` (interface changes need reviewer)
|
|
62
|
+
- Files with no test coverage (add tests as part of the step)
|
|
63
|
+
|
|
64
|
+
### 6. Register Follow-Up Work
|
|
65
|
+
If this planning session reveals work that should happen AFTER the current task:
|
|
66
|
+
```
|
|
67
|
+
add_phase(
|
|
68
|
+
phase=N,
|
|
69
|
+
name="Follow-up phase name",
|
|
70
|
+
description="What needs to happen and why",
|
|
71
|
+
priority="medium",
|
|
72
|
+
depends_on=[current_phase_number]
|
|
73
|
+
)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Output Format
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
PLAN: <task description>
|
|
82
|
+
PHASE ALIGNMENT: <current phase number> — <aligned/misaligned>
|
|
83
|
+
BLAST RADIUS: <N> files
|
|
84
|
+
PAST DECISIONS: <relevant decisions from search_decisions>
|
|
85
|
+
|
|
86
|
+
Steps:
|
|
87
|
+
1. [file: X] <what to do> → verify: <test command>
|
|
88
|
+
2. [file: Y] <what to do> → verify: <test command>
|
|
89
|
+
3. [files: A, B] <what to do> → verify: <test command>
|
|
90
|
+
|
|
91
|
+
Risks:
|
|
92
|
+
- Step 2 touches do_not_revert file — rules: [...]
|
|
93
|
+
- Step 3 has no test coverage — add tests as part of this step
|
|
94
|
+
|
|
95
|
+
Follow-up phases queued: <list any add_phase() calls made>
|
|
96
|
+
Changeset ID: <suggested-slug>
|
|
97
|
+
Estimated files: <N>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## What You Do NOT Do
|
|
103
|
+
|
|
104
|
+
- Do NOT write any code
|
|
105
|
+
- Do NOT read full source files (use MCP tools)
|
|
106
|
+
- Do NOT plan beyond what was asked (no gold-plating)
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Reviewer Agent
|
|
2
|
+
|
|
3
|
+
## Role
|
|
4
|
+
Lightweight quality gate. You check changes against project rules and architecture constraints.
|
|
5
|
+
You do NOT rewrite code — you flag issues with specific line references.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## When You Are Invoked
|
|
10
|
+
|
|
11
|
+
Only when triggered by the Orchestrator (see `orchestrator.md`):
|
|
12
|
+
- File has `stability: high` or `do_not_revert: true` in graph
|
|
13
|
+
- File has non-empty `rules` in graph node
|
|
14
|
+
- Change touches event payloads or schemas
|
|
15
|
+
- Change touches `.codevira/graph/` or `.codevira/roadmap.yaml`
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## MCP Tools Used
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
get_node(file_path) → read rules, do_not_revert, stability, index_status
|
|
23
|
+
get_playbook(task_type) → relevant rules for the change type
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
If `get_node()` returns `index_status.stale: true` → the graph may be outdated.
|
|
27
|
+
Flag this in your review output but do not block on it.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Review Checklist
|
|
32
|
+
|
|
33
|
+
For each changed file:
|
|
34
|
+
|
|
35
|
+
### 1. Architecture Rules
|
|
36
|
+
- [ ] No import violations (check your project's layer/import rules)
|
|
37
|
+
- [ ] Consistent error handling patterns used throughout
|
|
38
|
+
- [ ] No direct coupling where the design calls for loose coupling
|
|
39
|
+
|
|
40
|
+
### 2. Graph Node Rules
|
|
41
|
+
- [ ] Read `rules` field from `get_node(file)` — verify none are violated
|
|
42
|
+
- [ ] If `do_not_revert: true` — confirm the change doesn't undo an intentional decision
|
|
43
|
+
- [ ] If `stability: high` — confirm the interface contract is unchanged
|
|
44
|
+
|
|
45
|
+
### 3. Schema Changes
|
|
46
|
+
- [ ] New fields have appropriate defaults (not required unless truly required)
|
|
47
|
+
- [ ] Serialization/deserialization behavior is unchanged for existing fields
|
|
48
|
+
|
|
49
|
+
### 4. MCP Tool Changes
|
|
50
|
+
- [ ] New tools are registered in `server.py` with correct `inputSchema`
|
|
51
|
+
- [ ] Tool handlers return structured dicts, not raw strings
|
|
52
|
+
- [ ] Error cases use typed exceptions, not generic exceptions
|
|
53
|
+
|
|
54
|
+
### 5. Agent Framework Changes
|
|
55
|
+
- [ ] If `.codevira/graph/*.yaml` changed — run `get_impact()` to verify no broken node references
|
|
56
|
+
- [ ] If `.codevira/roadmap.yaml` changed — confirm phase numbers are consistent
|
|
57
|
+
- [ ] If MCP tools changed — verify server.py still registers them with correct inputSchema
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Output Format
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
REVIEW: <file_path>
|
|
65
|
+
STATUS: APPROVED | ISSUES_FOUND | BLOCKED
|
|
66
|
+
|
|
67
|
+
Issues (if any):
|
|
68
|
+
- [LINE X] <issue description> — Rule: <which rule>
|
|
69
|
+
- [LINE Y] <issue description> — Rule: <which rule>
|
|
70
|
+
|
|
71
|
+
Graph note: index_status=<stale|current>
|
|
72
|
+
Recommendation: <approve / fix before merge / must fix>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## What You Do NOT Do
|
|
78
|
+
|
|
79
|
+
- Do NOT rewrite code
|
|
80
|
+
- Do NOT add "improvements" beyond what was asked
|
|
81
|
+
- Do NOT check style/formatting (that's Builder's job with linter)
|
|
82
|
+
- Do NOT read files not in the changeset
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Tester Agent
|
|
2
|
+
|
|
3
|
+
## Role
|
|
4
|
+
Run tests and report failures with context. Zero AI tokens for the test run itself —
|
|
5
|
+
tests are shell commands. AI tokens used only to interpret failures and suggest fixes.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## When You Are Invoked
|
|
10
|
+
|
|
11
|
+
After every code change (Developer agent completes).
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## What Tests to Run
|
|
16
|
+
|
|
17
|
+
Determine from the graph node's `tests` field:
|
|
18
|
+
```
|
|
19
|
+
get_node(file_path) → tests: ["tests/unit/test_feature.py"]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
If the graph node has no tests listed:
|
|
23
|
+
1. Check `tests/unit/` for files matching the module name
|
|
24
|
+
2. Run your project's test suite filtered to the changed area
|
|
25
|
+
|
|
26
|
+
**Never run the full test suite unless explicitly asked** — only the tests relevant to changed files.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Finding Untested Files
|
|
31
|
+
|
|
32
|
+
Use `list_nodes()` to identify files with no test coverage in the changed layer:
|
|
33
|
+
```
|
|
34
|
+
list_nodes(layer="services")
|
|
35
|
+
→ Filter for nodes where tests: [] or tests is missing
|
|
36
|
+
→ Document these gaps in the session log
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Command Sequence
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# 1. Run relevant unit tests (fast, always)
|
|
45
|
+
pytest tests/unit/<relevant_test_file>.py -v --tb=short
|
|
46
|
+
|
|
47
|
+
# 2. If schema changed — run contract tests
|
|
48
|
+
pytest tests/contracts/ -v --tb=short
|
|
49
|
+
|
|
50
|
+
# 3. If integration test exists for this component — run it
|
|
51
|
+
pytest tests/integration/<relevant_test_file>.py -v --tb=short
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Adapt the above commands to your project's test framework (pytest, jest, go test, etc.).
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Failure Handling
|
|
59
|
+
|
|
60
|
+
If tests fail:
|
|
61
|
+
1. Report the exact failure with file:line reference
|
|
62
|
+
2. Cross-reference with the graph node's `rules` — is this a rule violation?
|
|
63
|
+
3. Check if the failing test is in a file with `do_not_revert: true` — if so, the change is likely wrong
|
|
64
|
+
4. Check `get_history(file_path)` to see if a recent commit may have introduced the regression
|
|
65
|
+
5. Suggest the minimal fix — do NOT rewrite unrelated code
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Output Format
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
TESTS: <files run>
|
|
73
|
+
PASSED: X / Y
|
|
74
|
+
STATUS: GREEN | RED | SKIPPED
|
|
75
|
+
|
|
76
|
+
Failures (if any):
|
|
77
|
+
- <test_name> at <file>:<line>
|
|
78
|
+
Error: <error message>
|
|
79
|
+
Likely cause: <brief analysis>
|
|
80
|
+
Suggested fix: <1-2 sentences>
|
|
81
|
+
|
|
82
|
+
Coverage gaps noted: <list any files with no tests in changed layer>
|
|
83
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Codevira configuration template
|
|
2
|
+
#
|
|
3
|
+
# This file is auto-generated by `codevira init` with zero-config detection.
|
|
4
|
+
# Manual editing is optional — only needed to override auto-detected values.
|
|
5
|
+
#
|
|
6
|
+
# Location: .codevira/config.yaml (inside your project root)
|
|
7
|
+
|
|
8
|
+
project:
|
|
9
|
+
name: my-project
|
|
10
|
+
|
|
11
|
+
# Directories to index (relative to project root).
|
|
12
|
+
# Auto-detected by scanning for source files; falls back to language conventions.
|
|
13
|
+
watched_dirs: ["src"]
|
|
14
|
+
|
|
15
|
+
# Primary language — auto-detected from project markers.
|
|
16
|
+
# Used for tree-sitter parser selection (AST chunking, get_signature, get_code, call graph).
|
|
17
|
+
#
|
|
18
|
+
# Full AST support: python, typescript, javascript, go, rust
|
|
19
|
+
# Standard support: java, kotlin, csharp, ruby, php, c, cpp, swift, solidity, vue
|
|
20
|
+
language: python
|
|
21
|
+
|
|
22
|
+
# File extensions to include in the code index.
|
|
23
|
+
# Auto-detected from the primary language.
|
|
24
|
+
file_extensions: [".py"]
|
|
25
|
+
|
|
26
|
+
# ChromaDB collection name for semantic search (requires [search] extras).
|
|
27
|
+
# Must be unique per project if sharing a ChromaDB instance.
|
|
28
|
+
collection_name: agent_codebase
|
|
29
|
+
|
|
30
|
+
logs:
|
|
31
|
+
# Automatically delete session logs older than this many days.
|
|
32
|
+
# 0 = keep forever (default)
|
|
33
|
+
retention_days: 0
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
trigger: always_on
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Rule 005: Coding Standards
|
|
6
|
+
|
|
7
|
+
## 0. Python Standardization
|
|
8
|
+
All Python code MUST follow the standardization and best practices defined in the **Python Enhancement Proposals (PEPs)** as documented at [peps.python.org](https://peps.python.org). Specifically, adherence to **PEP 8** (Style Guide) is mandatory.
|
|
9
|
+
|
|
10
|
+
## 1. File Size Limits
|
|
11
|
+
|
|
12
|
+
| File Type | Max Lines |
|
|
13
|
+
|-----------|-----------|
|
|
14
|
+
| Service | 300 |
|
|
15
|
+
| Entity | 150 |
|
|
16
|
+
| Command Handler | 100 |
|
|
17
|
+
| Test | 200 |
|
|
18
|
+
| Any file | 500 (absolute max) |
|
|
19
|
+
|
|
20
|
+
## 2. Mandatory Language Features
|
|
21
|
+
|
|
22
|
+
### 2.1 Type Hints
|
|
23
|
+
- Mandatory on all signatures (args and return types).
|
|
24
|
+
- Use specific types, avoid `Any` where possible.
|
|
25
|
+
|
|
26
|
+
### 2.2 Docstrings
|
|
27
|
+
- Required for all public functions/methods.
|
|
28
|
+
- Must include Args, Returns, and Raises sections.
|
|
29
|
+
|
|
30
|
+
## 3. Error Handling
|
|
31
|
+
|
|
32
|
+
- **Bare except is FORBIDDEN**: Always catch specific exceptions.
|
|
33
|
+
- **Structured Error Return**: Use consistent error return patterns appropriate for your architecture (e.g., Result types, typed exceptions, or error objects).
|
|
34
|
+
|
|
35
|
+
## 4. Logging & Telemetry
|
|
36
|
+
|
|
37
|
+
- **Structured Logging**: Use your project's logging abstraction — avoid raw `print()` in production code.
|
|
38
|
+
- **Context Binding**: Ensure request/trace identifiers are present in logs for correlation.
|
|
39
|
+
- **Structured Info**: Pass keyword arguments to logger instead of formatted strings.
|
|
40
|
+
|
|
41
|
+
## 5. Generic Engine Principle
|
|
42
|
+
- **Zero Hardcoding**: Magic numbers, thresholds, and project-specific constants MUST live in configuration files, not in code.
|
|
43
|
+
- **Behavior via Policy**: Changes to system behavior should be achieved via configuration/policy, not code modification.
|
|
44
|
+
|
|
45
|
+
## 6. Module Structure & Imports (PEP 8)
|
|
46
|
+
- **Top-Level Imports**: All imports MUST be placed at the top of the file.
|
|
47
|
+
- **Inner-function Imports**: Strictly FORBIDDEN unless used to resolve a *circular dependency* or for *heavy lazy-loading* in a CLI subcommand where performance is critical.
|
|
48
|
+
- **Grouping**: Group imports into standard library, third-party, and local modules, separated by a blank line.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
trigger: always_on
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Rule 011: Engineering Excellence & System Integrity
|
|
6
|
+
|
|
7
|
+
## 1. Logic Over Legacy
|
|
8
|
+
- **Principle**: Existing code is a **Requirements Reference**, not a technical template.
|
|
9
|
+
- **Mandate**: Principal AI Systems Architect /Principal/Staff AI level re-evaluation is required for every module. Logic MUST be optimized for performance, scalability, and the Five Laws during re-implementation.
|
|
10
|
+
- **No Blind Porting**: If legacy logic is inefficient, insecure, or poorly decoupled, it MUST be redesigned from first principles.
|
|
11
|
+
|
|
12
|
+
## 2. Interface Discipline (CLI & API)
|
|
13
|
+
- **Principle**: Minimalism is a Feature.
|
|
14
|
+
- **Mandate**: Every CLI command MUST be audited before re-implementation. If a command is redundant, confusing, or too low-level, it MUST be combined, renamed, or eliminated.
|
|
15
|
+
- **UX Standard**: CLI feedback must be actionable, rich (using `rich` library), and provide clear next-steps guideance.
|
|
16
|
+
|
|
17
|
+
## 3. Idempotency & Replay Safety
|
|
18
|
+
- **Mandate**: All processing logic (ingest, warehouse, reasoning) MUST be idempotent. Re-running the same operation with the same input MUST result in the same state without side effects or duplicates.
|
|
19
|
+
|
|
20
|
+
## 4. High-Precision Concurrency & Performance
|
|
21
|
+
- **Asynchronous First**: Use `asyncio` correctly. Avoid blocking the event loop.
|
|
22
|
+
- **Zero-Waste Execution**: Optimize for minimal LLM tokens and DB roundtrips.
|
|
23
|
+
|
|
24
|
+
## 5. The Principal Gate
|
|
25
|
+
- **Design Blueprints**: Before re-implementing a major context, a "Logic Blueprint" MUST be proposed.
|
|
26
|
+
|
|
27
|
+
## 6. Security by Design
|
|
28
|
+
- **Secure Credentials**: Never allow raw secrets to breathe in logs. Use the root `.env` file for secrets and ensure it is NEVER committed to version control.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Rule 012: Git & CI/CD Governance
|
|
2
|
+
|
|
3
|
+
## 1. Branching Strategy
|
|
4
|
+
|
|
5
|
+
- **Trunk-Based Development with Feature Branches**: `main` is always production-ready and protected.
|
|
6
|
+
- **Naming Convention**: `feat/`, `fix/`, `refactor/`, `docs/`, followed by a concise description (e.g., `feat/core-event-bus`).
|
|
7
|
+
- **No Direct Commits**: All changes must go through a Pull Request/Merge Request flow.
|
|
8
|
+
|
|
9
|
+
## 2. Commit Standards (Conventional Commits)
|
|
10
|
+
|
|
11
|
+
- **Format**: `<type>(<scope>): <subject>` — Example: `feat(core): implement circuit breaker`.
|
|
12
|
+
- **Accountability**: Every commit should reference the changeset or task it addresses (see session logs in `.codevira/logs/`).
|
|
13
|
+
- **Atomic Commits**: Each commit should represent a single logical change.
|
|
14
|
+
|
|
15
|
+
## 3. CI/CD Gates (The Quality Bar)
|
|
16
|
+
|
|
17
|
+
- **Verification First**: Code CANNOT be merged unless:
|
|
18
|
+
- `pytest` passes with 100% success.
|
|
19
|
+
- `scripts/verify_architecture.py` returns 0 violations.
|
|
20
|
+
- `ruff` (or equivalent linter) returns 0 errors.
|
|
21
|
+
- **Evidence of Work**: Every PR/significant change must include a `walkthrough.md` demonstrating the changes and test results.
|
|
22
|
+
|
|
23
|
+
## 4. Versioning (SemVer)
|
|
24
|
+
|
|
25
|
+
- **Strict SemVer**: Follow `MAJOR.MINOR.PATCH` rules.
|
|
26
|
+
- **Breaking Changes**: MAJOR bumps require architectural review and explicit amendment to `PLATFORM_ARCHITECTURE.md`.
|
|
27
|
+
|
|
28
|
+
## 5. Automated Release Process
|
|
29
|
+
|
|
30
|
+
- **Tagging**: Releases are triggered by git tags (e.g., `v0.8.0`).
|
|
31
|
+
- **Changelog**: `CHANGELOG.md` must be updated BEFORE the version tag is created.
|
|
32
|
+
- **Immutable Artifacts**: PyPI packages must match the version tag. Never publish over an existing version.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
trigger: always_on
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# GIT COMMIT RULES FOR AI CODE AGENTS (AUTHORITATIVE)
|
|
6
|
+
|
|
7
|
+
## CORE PRINCIPLES
|
|
8
|
+
|
|
9
|
+
1. AUTHORITY
|
|
10
|
+
- NEVER commit code unless the user explicitly issues a commit command
|
|
11
|
+
(e.g., "commit my changes", "git commit").
|
|
12
|
+
|
|
13
|
+
2. ACCOUNTABILITY
|
|
14
|
+
- EVERY commit MUST be backed by corresponding session log entries in Codevira's history.
|
|
15
|
+
- If an action, change, or execution is not logged in Codevira → it MUST NOT be committed.
|
|
16
|
+
|
|
17
|
+
3. DOCUMENTATION IS PART OF THE CHANGE
|
|
18
|
+
- A change is INCOMPLETE until code, Graph Rules, Roadmap, FAQ, and docs are aligned.
|
|
19
|
+
- Commits represent **system truth**, not just code deltas.
|
|
20
|
+
|
|
21
|
+
────────────────────────
|
|
22
|
+
## 1. PRE-COMMIT GATE (MANDATORY)
|
|
23
|
+
────────────────────────
|
|
24
|
+
|
|
25
|
+
Before generating a commit message, staging files, or committing, the agent MUST verify ALL of the following:
|
|
26
|
+
|
|
27
|
+
### A. ARCHITECTURAL INTENT SAFETY (CRITICAL)
|
|
28
|
+
- The Roadmap (`roadmap.yaml`) and Graph Rules are LAW and MUST NOT be auto-updated.
|
|
29
|
+
- If a new architectural decision, constraint, or intent change is discovered:
|
|
30
|
+
- STOP
|
|
31
|
+
- PROPOSE the change explicitly to the user
|
|
32
|
+
- WAIT for approval
|
|
33
|
+
- Only user-approved intent changes (via `complete_phase` or `update_node`) may be included in a commit.
|
|
34
|
+
- Any approved change MUST be reflected in the final session log entries.
|
|
35
|
+
|
|
36
|
+
### B. SESSION LOG FINALIZATION
|
|
37
|
+
- Codevira's session logs MUST include factual entries for all relevant work:
|
|
38
|
+
- what was discussed
|
|
39
|
+
- what was actually implemented (Evolution)
|
|
40
|
+
- what succeeded or failed (Wrong Paths)
|
|
41
|
+
- what changed from previous behavior
|
|
42
|
+
- underlying logic (The Why)
|
|
43
|
+
- If the session log (via `write_session_log()`) is not prepared → STOP. No commit allowed.
|
|
44
|
+
|
|
45
|
+
### C. FAQ SYNCHRONIZATION (NON-NEGOTIABLE)
|
|
46
|
+
- If the commit reflects ANY of the following:
|
|
47
|
+
- a decision
|
|
48
|
+
- a confirmed behavior
|
|
49
|
+
- a workflow change
|
|
50
|
+
- a trade-off or limitation
|
|
51
|
+
- a rejected alternative
|
|
52
|
+
- Then the FAQ MUST be updated BEFORE commit.
|
|
53
|
+
|
|
54
|
+
FAQ updates MUST explain:
|
|
55
|
+
- What the decision/change is
|
|
56
|
+
- WHY it was made
|
|
57
|
+
- Alternatives considered
|
|
58
|
+
- Why alternatives were rejected
|
|
59
|
+
- Trade-offs and implications
|
|
60
|
+
|
|
61
|
+
If FAQ is not updated → WORK IS INCOMPLETE → DO NOT COMMIT.
|
|
62
|
+
|
|
63
|
+
### D. DOCUMENTATION CONSISTENCY
|
|
64
|
+
- Update all affected documentation as applicable:
|
|
65
|
+
- README.md
|
|
66
|
+
- CHANGELOG.md
|
|
67
|
+
- CLI / architecture / design docs
|
|
68
|
+
- Documentation updates are NOT optional.
|
|
69
|
+
- No stale or partial documentation is allowed in a commit.
|
|
70
|
+
|
|
71
|
+
### E. PROJECT STATE CONSISTENCY
|
|
72
|
+
- Ensure any tracked state files are updated and consistent.
|
|
73
|
+
- Partial or mismatched system state is forbidden.
|
|
74
|
+
|
|
75
|
+
If ANY check above fails → STOP and request clarification.
|
|
76
|
+
|
|
77
|
+
────────────────────────
|
|
78
|
+
## 2. COMMIT MESSAGE RULES (STRICT)
|
|
79
|
+
────────────────────────
|
|
80
|
+
|
|
81
|
+
- One-line or generic commit messages are NOT allowed.
|
|
82
|
+
- Every commit MUST have a detailed, multi-line message.
|
|
83
|
+
- Commit messages are treated as permanent system explanation.
|
|
84
|
+
|
|
85
|
+
### REQUIRED COMMIT MESSAGE FORMAT
|
|
86
|
+
|
|
87
|
+
Title:
|
|
88
|
+
- Clear, precise summary of the change
|
|
89
|
+
|
|
90
|
+
Context:
|
|
91
|
+
- What problem, discussion, or need triggered this change
|
|
92
|
+
|
|
93
|
+
What Changed:
|
|
94
|
+
- Concrete description of code, behavior, or configuration changes
|
|
95
|
+
|
|
96
|
+
Why:
|
|
97
|
+
- Explicit reasoning behind the change
|
|
98
|
+
- Trade-offs accepted
|
|
99
|
+
|
|
100
|
+
Decisions:
|
|
101
|
+
- Which existing decisions this reinforces
|
|
102
|
+
- OR which approved decisions were changed
|
|
103
|
+
|
|
104
|
+
Documentation:
|
|
105
|
+
- List of updated docs (memory, session logs, FAQ, README, etc.)
|
|
106
|
+
|
|
107
|
+
────────────────────────
|
|
108
|
+
## 3. FINAL COMMIT RULE
|
|
109
|
+
────────────────────────
|
|
110
|
+
|
|
111
|
+
If ANY of the following is true:
|
|
112
|
+
- Memory change not explicitly approved
|
|
113
|
+
- Session log missing or incomplete
|
|
114
|
+
- FAQ not updated when required
|
|
115
|
+
- Docs out of sync
|
|
116
|
+
- Commit authority not given
|
|
117
|
+
|
|
118
|
+
→ DO NOT COMMIT.
|
|
119
|
+
|
|
120
|
+
Ask. Clarify. Wait.
|
|
121
|
+
|
|
122
|
+
────────────────────────
|
|
123
|
+
## MENTAL MODEL (NON-NEGOTIABLE)
|
|
124
|
+
────────────────────────
|
|
125
|
+
|
|
126
|
+
Session logs record truth
|
|
127
|
+
Memory preserves intent
|
|
128
|
+
FAQ preserves explanation
|
|
129
|
+
Docs preserve understanding
|
|
130
|
+
Commits preserve integrity
|