omegon 0.6.0
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.
- package/.gitattributes +3 -0
- package/AGENTS.md +16 -0
- package/LICENSE +15 -0
- package/README.md +289 -0
- package/bin/pi.mjs +30 -0
- package/extensions/00-secrets/index.ts +1126 -0
- package/extensions/01-auth/auth.ts +401 -0
- package/extensions/01-auth/index.ts +289 -0
- package/extensions/auto-compact.ts +42 -0
- package/extensions/bootstrap/deps.ts +291 -0
- package/extensions/bootstrap/index.ts +811 -0
- package/extensions/chronos/chronos.sh +487 -0
- package/extensions/chronos/index.ts +148 -0
- package/extensions/cleave/assessment.ts +754 -0
- package/extensions/cleave/bridge.ts +31 -0
- package/extensions/cleave/conflicts.ts +250 -0
- package/extensions/cleave/dispatcher.ts +808 -0
- package/extensions/cleave/guardrails.ts +426 -0
- package/extensions/cleave/index.ts +3121 -0
- package/extensions/cleave/lifecycle-emitter.ts +20 -0
- package/extensions/cleave/openspec.ts +811 -0
- package/extensions/cleave/planner.ts +260 -0
- package/extensions/cleave/review.ts +579 -0
- package/extensions/cleave/skills.ts +355 -0
- package/extensions/cleave/types.ts +261 -0
- package/extensions/cleave/workspace.ts +861 -0
- package/extensions/cleave/worktree.ts +243 -0
- package/extensions/core-renderers.ts +253 -0
- package/extensions/dashboard/context-gauge.ts +58 -0
- package/extensions/dashboard/file-watch.ts +14 -0
- package/extensions/dashboard/footer.ts +1145 -0
- package/extensions/dashboard/git.ts +185 -0
- package/extensions/dashboard/index.ts +478 -0
- package/extensions/dashboard/memory-audit.ts +34 -0
- package/extensions/dashboard/overlay-data.ts +705 -0
- package/extensions/dashboard/overlay.ts +365 -0
- package/extensions/dashboard/render-utils.ts +54 -0
- package/extensions/dashboard/types.ts +191 -0
- package/extensions/dashboard/uri-helper.ts +45 -0
- package/extensions/debug.ts +69 -0
- package/extensions/defaults.ts +282 -0
- package/extensions/design-tree/dashboard-state.ts +161 -0
- package/extensions/design-tree/design-card.ts +362 -0
- package/extensions/design-tree/index.ts +2130 -0
- package/extensions/design-tree/lifecycle-emitter.ts +41 -0
- package/extensions/design-tree/tree.ts +1607 -0
- package/extensions/design-tree/types.ts +163 -0
- package/extensions/distill.ts +127 -0
- package/extensions/effort/index.ts +395 -0
- package/extensions/effort/tiers.ts +146 -0
- package/extensions/effort/types.ts +105 -0
- package/extensions/lib/git-state.ts +227 -0
- package/extensions/lib/local-models.ts +157 -0
- package/extensions/lib/model-preferences.ts +51 -0
- package/extensions/lib/model-routing.ts +720 -0
- package/extensions/lib/operator-fallback.ts +205 -0
- package/extensions/lib/operator-profile.ts +360 -0
- package/extensions/lib/slash-command-bridge.ts +253 -0
- package/extensions/lib/typebox-helpers.ts +16 -0
- package/extensions/local-inference/index.ts +727 -0
- package/extensions/mcp-bridge/README.md +220 -0
- package/extensions/mcp-bridge/index.ts +951 -0
- package/extensions/mcp-bridge/lib.ts +365 -0
- package/extensions/mcp-bridge/mcp.json +3 -0
- package/extensions/mcp-bridge/package.json +11 -0
- package/extensions/model-budget.ts +752 -0
- package/extensions/offline-driver.ts +403 -0
- package/extensions/openspec/archive-gate.ts +164 -0
- package/extensions/openspec/branch-cleanup.ts +64 -0
- package/extensions/openspec/dashboard-state.ts +50 -0
- package/extensions/openspec/index.ts +1917 -0
- package/extensions/openspec/lifecycle-emitter.ts +65 -0
- package/extensions/openspec/lifecycle-files.ts +70 -0
- package/extensions/openspec/lifecycle.ts +50 -0
- package/extensions/openspec/reconcile.ts +187 -0
- package/extensions/openspec/spec.ts +1385 -0
- package/extensions/openspec/types.ts +98 -0
- package/extensions/project-memory/DESIGN-global-mind.md +198 -0
- package/extensions/project-memory/README.md +202 -0
- package/extensions/project-memory/api-types.ts +382 -0
- package/extensions/project-memory/compaction-policy.ts +29 -0
- package/extensions/project-memory/core.ts +164 -0
- package/extensions/project-memory/embeddings.ts +230 -0
- package/extensions/project-memory/extraction-v2.ts +861 -0
- package/extensions/project-memory/factstore.ts +2177 -0
- package/extensions/project-memory/index.ts +3459 -0
- package/extensions/project-memory/injection-metrics.ts +91 -0
- package/extensions/project-memory/jsonl-io.ts +12 -0
- package/extensions/project-memory/lifecycle.ts +331 -0
- package/extensions/project-memory/migration.ts +293 -0
- package/extensions/project-memory/package.json +9 -0
- package/extensions/project-memory/sci-renderers.ts +7 -0
- package/extensions/project-memory/template.ts +103 -0
- package/extensions/project-memory/triggers.ts +52 -0
- package/extensions/project-memory/types.ts +102 -0
- package/extensions/render/composition/fonts/Inter-Bold.ttf +0 -0
- package/extensions/render/composition/fonts/Inter-Regular.ttf +0 -0
- package/extensions/render/composition/fonts/Tomorrow-Bold.ttf +0 -0
- package/extensions/render/composition/fonts/Tomorrow-Regular.ttf +0 -0
- package/extensions/render/composition/package-lock.json +534 -0
- package/extensions/render/composition/package.json +22 -0
- package/extensions/render/composition/render.mjs +246 -0
- package/extensions/render/composition/test-comp.tsx +87 -0
- package/extensions/render/composition/types.ts +24 -0
- package/extensions/render/excalidraw/UPSTREAM.md +81 -0
- package/extensions/render/excalidraw/elements.ts +764 -0
- package/extensions/render/excalidraw/index.ts +66 -0
- package/extensions/render/excalidraw/types.ts +223 -0
- package/extensions/render/excalidraw-renderer/pyproject.toml +8 -0
- package/extensions/render/excalidraw-renderer/render_excalidraw.py +182 -0
- package/extensions/render/excalidraw-renderer/render_template.html +59 -0
- package/extensions/render/index.ts +830 -0
- package/extensions/render/native-diagrams/index.ts +57 -0
- package/extensions/render/native-diagrams/motifs.ts +542 -0
- package/extensions/render/native-diagrams/raster.ts +8 -0
- package/extensions/render/native-diagrams/scene.ts +75 -0
- package/extensions/render/native-diagrams/spec.ts +204 -0
- package/extensions/render/native-diagrams/svg.ts +116 -0
- package/extensions/sci-ui.ts +304 -0
- package/extensions/session-log.ts +174 -0
- package/extensions/shared-state.ts +146 -0
- package/extensions/spinner-verbs.ts +91 -0
- package/extensions/style.ts +281 -0
- package/extensions/terminal-title.ts +191 -0
- package/extensions/tool-profile/index.ts +291 -0
- package/extensions/tool-profile/profiles.ts +290 -0
- package/extensions/types.d.ts +9 -0
- package/extensions/vault/index.ts +185 -0
- package/extensions/version-check.ts +90 -0
- package/extensions/view/index.ts +859 -0
- package/extensions/view/uri-resolver.ts +148 -0
- package/extensions/web-search/index.ts +182 -0
- package/extensions/web-search/providers.ts +121 -0
- package/extensions/web-ui/index.ts +110 -0
- package/extensions/web-ui/server.ts +265 -0
- package/extensions/web-ui/state.ts +462 -0
- package/extensions/web-ui/static/index.html +145 -0
- package/extensions/web-ui/types.ts +284 -0
- package/package.json +76 -0
- package/prompts/init.md +75 -0
- package/prompts/new-repo.md +54 -0
- package/prompts/oci-login.md +56 -0
- package/prompts/status.md +50 -0
- package/settings.json +4 -0
- package/skills/cleave/SKILL.md +218 -0
- package/skills/git/SKILL.md +209 -0
- package/skills/git/_reference/ci-validation.md +204 -0
- package/skills/oci/SKILL.md +338 -0
- package/skills/openspec/SKILL.md +346 -0
- package/skills/pi-extensions/SKILL.md +191 -0
- package/skills/pi-tui/SKILL.md +517 -0
- package/skills/python/SKILL.md +189 -0
- package/skills/rust/SKILL.md +268 -0
- package/skills/security/SKILL.md +206 -0
- package/skills/style/SKILL.md +264 -0
- package/skills/typescript/SKILL.md +225 -0
- package/skills/vault/SKILL.md +102 -0
- package/themes/alpharius-legacy.json +85 -0
- package/themes/alpharius.conf +59 -0
- package/themes/alpharius.json +88 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cleave
|
|
3
|
+
description: Task decomposition, code assessment, and OpenSpec integration. Use /cleave for parallel execution, /assess for code review (cleave, diff, spec subcommands), cleave_assess tool for complexity checks.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Cleave
|
|
7
|
+
|
|
8
|
+
Task decomposition is provided by the **cleave extension** (`extensions/cleave/`).
|
|
9
|
+
|
|
10
|
+
## Tools & Commands
|
|
11
|
+
|
|
12
|
+
| Surface | Purpose |
|
|
13
|
+
|---------|---------|
|
|
14
|
+
| `cleave_assess` tool | Assess directive complexity → execute / cleave / needs_assessment |
|
|
15
|
+
| `cleave_run` tool | Execute a split plan with git worktree isolation |
|
|
16
|
+
| `/cleave <directive>` | Full interactive workflow: assess → plan → confirm → execute → report |
|
|
17
|
+
| `/assess cleave` | Adversarial review of last 3 commits → auto-fix all C/W issues |
|
|
18
|
+
| `/assess diff [ref]` | Review changes since ref (default: HEAD~1) — analysis only |
|
|
19
|
+
| `/assess spec [change]` | Validate implementation against OpenSpec Given/When/Then scenarios |
|
|
20
|
+
| `/assess complexity <directive>` | Check if a task needs decomposition |
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
/cleave "Implement JWT authentication with refresh tokens"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The directive is assessed for complexity. If it exceeds the threshold (default 2.0),
|
|
29
|
+
it's decomposed into 2–4 child tasks executed in parallel via git worktrees.
|
|
30
|
+
|
|
31
|
+
## OpenSpec Integration
|
|
32
|
+
|
|
33
|
+
When `openspec/changes/*/tasks.md` exists in the repo, `/cleave` uses it as the
|
|
34
|
+
split plan instead of invoking the LLM planner:
|
|
35
|
+
|
|
36
|
+
1. Detects `openspec/` directory in the working tree
|
|
37
|
+
2. Finds changes with `tasks.md` files
|
|
38
|
+
3. Matches the directive to a change by name (slug matching)
|
|
39
|
+
4. Parses task groups → `ChildPlan[]` (skips all-done groups, caps at 4)
|
|
40
|
+
5. Infers dependencies from "after X" / "requires X" / "depends on X" markers
|
|
41
|
+
6. Falls back to LLM planner if no matching change is found
|
|
42
|
+
|
|
43
|
+
This makes OpenSpec the upstream planning layer and cleave the downstream
|
|
44
|
+
execution engine. OpenSpec is optional — cleave works standalone.
|
|
45
|
+
|
|
46
|
+
### Spec-Domain Annotations
|
|
47
|
+
|
|
48
|
+
Task groups in `tasks.md` can declare which spec files they own via HTML comments:
|
|
49
|
+
|
|
50
|
+
```markdown
|
|
51
|
+
## 2. RBAC Enforcement
|
|
52
|
+
<!-- specs: relay/rbac -->
|
|
53
|
+
- [ ] Wire has_capability() into create_session()
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Cleave uses these annotations for deterministic scenario-to-child matching (3-tier priority):
|
|
57
|
+
|
|
58
|
+
1. **Annotation match** — child's `specDomains` includes the scenario's domain
|
|
59
|
+
2. **Scope match** — child's file scope includes files referenced in the scenario
|
|
60
|
+
3. **Word-overlap fallback** — shared words between child description and scenario text
|
|
61
|
+
|
|
62
|
+
### Orphan Scenario Safety Net
|
|
63
|
+
|
|
64
|
+
Any spec scenario matching zero children is auto-injected into the closest child
|
|
65
|
+
with a `⚠️ CROSS-CUTTING` marker. This prevents enforcement scenarios from falling
|
|
66
|
+
between children when task groups are split by layer instead of by spec domain.
|
|
67
|
+
The markers provide observability — if many orphans appear, task grouping needs improvement.
|
|
68
|
+
|
|
69
|
+
### Full Lifecycle
|
|
70
|
+
|
|
71
|
+
When OpenSpec is present, the complete lifecycle is:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
/opsx:propose → /opsx:ff → /cleave → /assess spec → /opsx:verify → /opsx:archive
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
After `/cleave` completes with an OpenSpec change:
|
|
78
|
+
- Tasks are automatically reconciled in `tasks.md`
|
|
79
|
+
- If completed work cannot be mapped back to task groups, treat that as a lifecycle reconciliation warning and fix the OpenSpec plan before archive
|
|
80
|
+
- The report includes Next Steps guidance
|
|
81
|
+
- If all tasks complete: `/assess spec` → `/opsx:verify` → `/opsx:archive`
|
|
82
|
+
- If partial: `/opsx:apply` or `/cleave` again
|
|
83
|
+
- After `/assess spec` or `/assess cleave`, run post-assess reconciliation so failed/partial review can reopen implementation state and append design-tree implementation-note deltas
|
|
84
|
+
- Before archive, ensure the bound design-tree node and OpenSpec task state both reflect reality
|
|
85
|
+
|
|
86
|
+
### Session Start
|
|
87
|
+
|
|
88
|
+
On session start, active OpenSpec changes are surfaced with task progress.
|
|
89
|
+
This status is injected into the agent context (not just displayed).
|
|
90
|
+
|
|
91
|
+
## Complexity Formula
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
complexity = (1 + systems) × (1 + 0.5 × modifiers)
|
|
95
|
+
effective = complexity + 1 (when validation enabled)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Patterns (9)
|
|
99
|
+
|
|
100
|
+
Full-Stack CRUD, Authentication System, External Service Integration,
|
|
101
|
+
Database Migration, Performance Optimization, Breaking API Change,
|
|
102
|
+
Simple Refactor, Bug Fix, Refactor.
|
|
103
|
+
|
|
104
|
+
## Adversarial Review Loop
|
|
105
|
+
|
|
106
|
+
When `review: true` is passed to `cleave_run`, each child's work is reviewed
|
|
107
|
+
after execution using a tiered loop:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
Execute (cheap) → Review (opus) → [pass? done : Fix (cheap) → Review (opus)]
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Severity Gating
|
|
114
|
+
|
|
115
|
+
| Severity | Action | Max Fix Iterations |
|
|
116
|
+
|----------|--------|--------------------|
|
|
117
|
+
| Nits only | Accept | 0 |
|
|
118
|
+
| Warnings | Fix then accept | 1 (configurable) |
|
|
119
|
+
| Critical | Fix then escalate if unresolved | 2 (configurable) |
|
|
120
|
+
| Critical + security | Immediate escalate | 0 |
|
|
121
|
+
|
|
122
|
+
### Churn Detection
|
|
123
|
+
|
|
124
|
+
Between review rounds, issue descriptions are normalized and compared.
|
|
125
|
+
If >50% of current issues appeared in the previous round (configurable
|
|
126
|
+
threshold), the loop bails — the fix agent is going in circles.
|
|
127
|
+
|
|
128
|
+
### Review Configuration
|
|
129
|
+
|
|
130
|
+
Pass to `cleave_run`:
|
|
131
|
+
- `review: true` — enable the review loop
|
|
132
|
+
- `review_max_warning_fixes: 1` — max fix iterations for warnings
|
|
133
|
+
- `review_max_critical_fixes: 2` — max fix iterations for criticals
|
|
134
|
+
- `review_churn_threshold: 0.5` — reappearance fraction to trigger bail
|
|
135
|
+
|
|
136
|
+
### Review State
|
|
137
|
+
|
|
138
|
+
After execution, each child's state includes:
|
|
139
|
+
- `reviewIterations` — number of review rounds completed
|
|
140
|
+
- `reviewHistory` — verdict + issue count per round
|
|
141
|
+
- `reviewDecision` — `accepted`, `escalated`, or `no_review`
|
|
142
|
+
- `reviewEscalationReason` — why the review loop gave up (if escalated)
|
|
143
|
+
|
|
144
|
+
## Skill-Aware Dispatch
|
|
145
|
+
|
|
146
|
+
Children automatically receive skill directives based on their file scope.
|
|
147
|
+
Skills are matched via file pattern → skill mapping (e.g., `*.py` → python,
|
|
148
|
+
`Containerfile` → oci) and can be overridden with task annotations.
|
|
149
|
+
|
|
150
|
+
### Skill Annotations
|
|
151
|
+
|
|
152
|
+
Task groups in `tasks.md` can declare skills via HTML comments:
|
|
153
|
+
|
|
154
|
+
```markdown
|
|
155
|
+
## 2. Container Build
|
|
156
|
+
<!-- skills: oci, python -->
|
|
157
|
+
- [ ] Write Containerfile
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Annotations override auto-matching for that child.
|
|
161
|
+
|
|
162
|
+
### Model Tier Routing
|
|
163
|
+
|
|
164
|
+
Skills can hint at the model complexity needed. The resolution order is:
|
|
165
|
+
1. Explicit annotation on the child plan (always respected)
|
|
166
|
+
2. Local override (if `prefer_local: true` and Ollama available)
|
|
167
|
+
3. Skill-based tier hint (highest `preferredTier` wins)
|
|
168
|
+
4. Default: sonnet
|
|
169
|
+
|
|
170
|
+
## Architecture
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
extensions/cleave/
|
|
174
|
+
index.ts — Extension entry: registers tools + /cleave command
|
|
175
|
+
assessment.ts — Pattern library, complexity formula, fast-path triage
|
|
176
|
+
planner.ts — LLM prompt builder, JSON plan parser, wave computation
|
|
177
|
+
openspec.ts — OpenSpec tasks.md parser → ChildPlan[] conversion
|
|
178
|
+
dispatcher.ts — Child process dispatch, AsyncSemaphore, wave execution
|
|
179
|
+
review.ts — Adversarial review loop, severity gating, churn detection
|
|
180
|
+
skills.ts — Skill matching, resolution, model tier hints
|
|
181
|
+
conflicts.ts — 4-step conflict detection (file overlap, decision
|
|
182
|
+
contradiction, interface mismatch, assumption violation)
|
|
183
|
+
workspace.ts — Workspace management under ~/.pi/cleave/
|
|
184
|
+
worktree.ts — Git worktree create/merge/cleanup under ~/.pi/cleave/wt/
|
|
185
|
+
types.ts — Shared type definitions
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Workspace Layout
|
|
189
|
+
|
|
190
|
+
Workspaces and worktrees live outside the target repo:
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
~/.pi/cleave/
|
|
194
|
+
<slug>/ — Workspace per run
|
|
195
|
+
state.json — Serialized CleaveState
|
|
196
|
+
0-task.md — Child task files
|
|
197
|
+
1-task.md
|
|
198
|
+
wt/ — Git worktrees
|
|
199
|
+
0-api-layer/ — Isolated working copy per child
|
|
200
|
+
1-db-layer/
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Execution Flow
|
|
204
|
+
|
|
205
|
+
The `/cleave` command handles assessment and planning inline (or via LLM delegation).
|
|
206
|
+
`CleaveState` tracks execution from dispatch onward:
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
/cleave command: assess → [openspec | llm plan] → user confirm
|
|
210
|
+
cleave_run tool: DISPATCH → HARVEST → REUNIFY → COMPLETE | FAILED
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
The `assess`, `plan`, `confirm`, and `report` phases exist in `CleavePhase`
|
|
214
|
+
but are not currently used in state transitions — they're reserved for
|
|
215
|
+
future resume capability.
|
|
216
|
+
|
|
217
|
+
On merge failure, branches are preserved for manual resolution.
|
|
218
|
+
On success, worktrees and branches are cleaned up automatically.
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: git
|
|
3
|
+
description: Git conventions — conventional commits, semantic versioning, branch naming, tagging, changelogs, and release workflow. Use when committing, branching, tagging, or managing releases.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Git Skill
|
|
7
|
+
|
|
8
|
+
Conventions for git operations. Covers commit messages, versioning, branching, tagging, and changelogs.
|
|
9
|
+
|
|
10
|
+
## Conventional Commits
|
|
11
|
+
|
|
12
|
+
Use [Conventional Commits](https://www.conventionalcommits.org/) for all commit messages.
|
|
13
|
+
|
|
14
|
+
### Format
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
<type>(<scope>): <description>
|
|
18
|
+
|
|
19
|
+
[optional body]
|
|
20
|
+
|
|
21
|
+
[optional footer(s)]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Types
|
|
25
|
+
|
|
26
|
+
| Type | When | Semver Impact |
|
|
27
|
+
|------|------|---------------|
|
|
28
|
+
| `feat` | New feature or capability | MINOR bump |
|
|
29
|
+
| `fix` | Bug fix | PATCH bump |
|
|
30
|
+
| `docs` | Documentation only | none |
|
|
31
|
+
| `style` | Formatting, whitespace (no logic change) | none |
|
|
32
|
+
| `refactor` | Code change that neither fixes nor adds | none |
|
|
33
|
+
| `perf` | Performance improvement | none |
|
|
34
|
+
| `test` | Adding or correcting tests | none |
|
|
35
|
+
| `chore` | Build process, deps, tooling, version bumps | none |
|
|
36
|
+
| `ci` | CI/CD configuration changes | none |
|
|
37
|
+
| `revert` | Reverts a previous commit | varies |
|
|
38
|
+
|
|
39
|
+
### Scope (optional)
|
|
40
|
+
|
|
41
|
+
Parenthetical hint narrowing what changed. Free-form but consistent within a repo:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
feat(auth): add OAuth2 PKCE flow
|
|
45
|
+
fix(db): handle connection pool exhaustion
|
|
46
|
+
test(api): add rate limit validation tests
|
|
47
|
+
chore(deps): bump serde to 1.0.200
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Breaking Changes
|
|
51
|
+
|
|
52
|
+
Mark with `!` after the type/scope, and explain in the footer:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
feat(api)!: change response envelope format
|
|
56
|
+
|
|
57
|
+
BREAKING CHANGE: Response wrapper changed from { data } to { result }.
|
|
58
|
+
Clients must update to SDK >= 2.0.0.
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Commit Message Quality
|
|
62
|
+
|
|
63
|
+
**Good** — explains the *why*, not just the *what*:
|
|
64
|
+
```
|
|
65
|
+
fix: normalize truncated hashes in message routing
|
|
66
|
+
|
|
67
|
+
Short hashes from legacy clients caused lookup failures in the store.
|
|
68
|
+
Now pads to full length before resolution.
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Bad** — restates the diff:
|
|
72
|
+
```
|
|
73
|
+
fix: change hash lookup code
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Validation Regex
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
^(feat|fix|docs|style|refactor|perf|test|chore|ci|revert)(\(.+\))?(!)?: .+
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Semantic Versioning
|
|
83
|
+
|
|
84
|
+
Follow [SemVer 2.0.0](https://semver.org/):
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
vMAJOR.MINOR.PATCH
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
| Component | Increment When |
|
|
91
|
+
|-----------|---------------|
|
|
92
|
+
| **MAJOR** | Breaking API/protocol change |
|
|
93
|
+
| **MINOR** | New feature, backward-compatible |
|
|
94
|
+
| **PATCH** | Bug fix, backward-compatible |
|
|
95
|
+
|
|
96
|
+
### Pre-1.0 Convention
|
|
97
|
+
|
|
98
|
+
During `0.x.y` development:
|
|
99
|
+
- MINOR bumps may include breaking changes
|
|
100
|
+
- PATCH bumps are bug fixes
|
|
101
|
+
- API stability is not guaranteed until `1.0.0`
|
|
102
|
+
|
|
103
|
+
### Version Bump Commits
|
|
104
|
+
|
|
105
|
+
Use `chore` type:
|
|
106
|
+
```
|
|
107
|
+
chore: bump version to 0.4.0
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Branch Naming
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
<type>/<short-description>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
| Type | Purpose |
|
|
117
|
+
|------|---------|
|
|
118
|
+
| `feature/` | New functionality |
|
|
119
|
+
| `fix/` | Bug fix |
|
|
120
|
+
| `patch/` | Small targeted fix |
|
|
121
|
+
| `chore/` | Tooling, deps, config |
|
|
122
|
+
| `refactor/` | Code restructuring |
|
|
123
|
+
| `perf/` | Performance work |
|
|
124
|
+
| `breaking/` | Known breaking change |
|
|
125
|
+
| `hotfix/` | Urgent production fix |
|
|
126
|
+
|
|
127
|
+
**Examples:**
|
|
128
|
+
```
|
|
129
|
+
feature/oauth-integration
|
|
130
|
+
fix/connection-pool-leak
|
|
131
|
+
chore/bump-dependencies
|
|
132
|
+
refactor/split-service-layer
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Main branch**: `main`. Tags and releases are cut from main only.
|
|
136
|
+
|
|
137
|
+
## Tagging
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
git tag v0.4.0
|
|
141
|
+
git push origin v0.4.0
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
- Always prefix with `v`: `v0.4.0`, not `0.4.0`
|
|
145
|
+
- Tags should be on the `main` branch
|
|
146
|
+
- Format: `vMAJOR.MINOR.PATCH`
|
|
147
|
+
- Tag triggers release CI (build, publish, GitHub Release)
|
|
148
|
+
|
|
149
|
+
### Release Flow
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
1. Complete work on feature/fix branch
|
|
153
|
+
2. Merge to main via PR
|
|
154
|
+
3. Update version in source files
|
|
155
|
+
4. Commit: chore: bump version to X.Y.Z
|
|
156
|
+
5. Update CHANGELOG.md
|
|
157
|
+
6. Tag: git tag vX.Y.Z
|
|
158
|
+
7. Push: git push origin main --tags
|
|
159
|
+
8. CI builds and publishes
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Changelog
|
|
163
|
+
|
|
164
|
+
Maintain `CHANGELOG.md` using [Keep a Changelog](https://keepachangelog.com/) format:
|
|
165
|
+
|
|
166
|
+
```markdown
|
|
167
|
+
# Changelog
|
|
168
|
+
|
|
169
|
+
## [Unreleased]
|
|
170
|
+
|
|
171
|
+
## [0.4.0] - 2026-02-03
|
|
172
|
+
|
|
173
|
+
### Added
|
|
174
|
+
- New feature description
|
|
175
|
+
|
|
176
|
+
### Changed
|
|
177
|
+
- Modified behavior description
|
|
178
|
+
|
|
179
|
+
### Fixed
|
|
180
|
+
- Bug fix description
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Section Order
|
|
184
|
+
|
|
185
|
+
`Added` → `Changed` → `Deprecated` → `Removed` → `Fixed` → `Security`
|
|
186
|
+
|
|
187
|
+
Only include sections that have entries. `[Unreleased]` collects changes since the last tag.
|
|
188
|
+
|
|
189
|
+
## Quick Reference
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
# Feature branch
|
|
193
|
+
git checkout -b feature/my-feature main
|
|
194
|
+
git commit -m "feat(scope): add new capability"
|
|
195
|
+
git push -u origin feature/my-feature
|
|
196
|
+
|
|
197
|
+
# Fix branch
|
|
198
|
+
git checkout -b fix/the-bug main
|
|
199
|
+
git commit -m "fix: resolve crash on empty input"
|
|
200
|
+
|
|
201
|
+
# Release (from main)
|
|
202
|
+
git checkout main && git pull
|
|
203
|
+
# bump version, update CHANGELOG
|
|
204
|
+
git commit -m "chore: bump version to 0.5.0"
|
|
205
|
+
git tag v0.5.0
|
|
206
|
+
git push origin main --tags
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
See `_reference/ci-validation.md` for CI workflow templates that enforce these conventions.
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Git CI Validation Templates
|
|
2
|
+
|
|
3
|
+
Workflow templates for enforcing git conventions in CI. Based on patterns from cleave.
|
|
4
|
+
|
|
5
|
+
## Branch Name Validation
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
validate-branch:
|
|
9
|
+
name: Validate Branch Name
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
if: github.event_name == 'pull_request'
|
|
12
|
+
steps:
|
|
13
|
+
- name: Check branch naming convention
|
|
14
|
+
run: |
|
|
15
|
+
BRANCH="${{ github.head_ref }}"
|
|
16
|
+
if [[ ! "$BRANCH" =~ ^(feature|fix|patch|chore|refactor|perf|breaking|hotfix)/.+ ]]; then
|
|
17
|
+
echo "ERROR: Branch name must follow convention: <type>/<description>"
|
|
18
|
+
echo " Valid types: feature, fix, patch, chore, refactor, perf, breaking, hotfix"
|
|
19
|
+
echo " Your branch: $BRANCH"
|
|
20
|
+
exit 1
|
|
21
|
+
fi
|
|
22
|
+
echo "Branch name follows convention: $BRANCH"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Conventional Commit Validation
|
|
26
|
+
|
|
27
|
+
```yaml
|
|
28
|
+
validate-commits:
|
|
29
|
+
name: Validate Commit Messages
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
if: github.event_name == 'pull_request'
|
|
32
|
+
steps:
|
|
33
|
+
- name: Checkout code
|
|
34
|
+
uses: actions/checkout@v4
|
|
35
|
+
with:
|
|
36
|
+
fetch-depth: 0
|
|
37
|
+
|
|
38
|
+
- name: Validate conventional commits
|
|
39
|
+
run: |
|
|
40
|
+
COMMITS=$(git log --format=%s origin/main..HEAD)
|
|
41
|
+
|
|
42
|
+
PATTERN="^(feat|fix|docs|style|refactor|perf|test|chore|ci|revert)(\(.+\))?(!)?: .+"
|
|
43
|
+
|
|
44
|
+
FAILED=0
|
|
45
|
+
while IFS= read -r commit; do
|
|
46
|
+
if [[ ! "$commit" =~ $PATTERN ]]; then
|
|
47
|
+
echo "FAIL: $commit"
|
|
48
|
+
FAILED=1
|
|
49
|
+
else
|
|
50
|
+
echo "OK: $commit"
|
|
51
|
+
fi
|
|
52
|
+
done <<< "$COMMITS"
|
|
53
|
+
|
|
54
|
+
if [ $FAILED -eq 1 ]; then
|
|
55
|
+
echo ""
|
|
56
|
+
echo "Commit messages must follow Conventional Commits:"
|
|
57
|
+
echo " <type>(<scope>): <description>"
|
|
58
|
+
echo ""
|
|
59
|
+
echo "Types: feat, fix, docs, style, refactor, perf, test, chore, ci, revert"
|
|
60
|
+
exit 1
|
|
61
|
+
fi
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Tag Validation (Release Workflow)
|
|
65
|
+
|
|
66
|
+
```yaml
|
|
67
|
+
name: Release
|
|
68
|
+
on:
|
|
69
|
+
push:
|
|
70
|
+
tags:
|
|
71
|
+
- 'v*.*.*'
|
|
72
|
+
|
|
73
|
+
jobs:
|
|
74
|
+
validate-tag:
|
|
75
|
+
name: Validate Tag
|
|
76
|
+
runs-on: ubuntu-latest
|
|
77
|
+
steps:
|
|
78
|
+
- name: Checkout code
|
|
79
|
+
uses: actions/checkout@v4
|
|
80
|
+
with:
|
|
81
|
+
fetch-depth: 0
|
|
82
|
+
|
|
83
|
+
- name: Verify tag is on main branch
|
|
84
|
+
run: |
|
|
85
|
+
TAG_COMMIT=$(git rev-list -n 1 ${{ github.ref }})
|
|
86
|
+
MAIN_COMMITS=$(git rev-list origin/main)
|
|
87
|
+
|
|
88
|
+
if ! echo "$MAIN_COMMITS" | grep -q "$TAG_COMMIT"; then
|
|
89
|
+
echo "ERROR: Tag ${{ github.ref_name }} is not on main branch"
|
|
90
|
+
echo " Tags must only be created from main branch"
|
|
91
|
+
exit 1
|
|
92
|
+
fi
|
|
93
|
+
echo "Tag ${{ github.ref_name }} is on main branch"
|
|
94
|
+
|
|
95
|
+
- name: Validate semantic version format
|
|
96
|
+
run: |
|
|
97
|
+
if [[ ! "${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
98
|
+
echo "ERROR: Tag must follow semantic versioning: vMAJOR.MINOR.PATCH"
|
|
99
|
+
echo " Got: ${{ github.ref_name }}"
|
|
100
|
+
exit 1
|
|
101
|
+
fi
|
|
102
|
+
echo "Valid semantic version: ${{ github.ref_name }}"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Push Triggers with Branch Naming
|
|
106
|
+
|
|
107
|
+
Use branch patterns in push triggers to only run CI on convention-following branches:
|
|
108
|
+
|
|
109
|
+
```yaml
|
|
110
|
+
on:
|
|
111
|
+
push:
|
|
112
|
+
branches:
|
|
113
|
+
- main
|
|
114
|
+
- 'feature/**'
|
|
115
|
+
- 'fix/**'
|
|
116
|
+
- 'patch/**'
|
|
117
|
+
- 'chore/**'
|
|
118
|
+
- 'refactor/**'
|
|
119
|
+
- 'perf/**'
|
|
120
|
+
- 'breaking/**'
|
|
121
|
+
pull_request:
|
|
122
|
+
branches:
|
|
123
|
+
- main
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Combined CI Template
|
|
127
|
+
|
|
128
|
+
Full CI workflow with branch, commit, lint, and test validation:
|
|
129
|
+
|
|
130
|
+
```yaml
|
|
131
|
+
name: CI
|
|
132
|
+
on:
|
|
133
|
+
push:
|
|
134
|
+
branches:
|
|
135
|
+
- main
|
|
136
|
+
- 'feature/**'
|
|
137
|
+
- 'fix/**'
|
|
138
|
+
- 'chore/**'
|
|
139
|
+
pull_request:
|
|
140
|
+
branches:
|
|
141
|
+
- main
|
|
142
|
+
|
|
143
|
+
jobs:
|
|
144
|
+
validate-branch:
|
|
145
|
+
name: Validate Branch Name
|
|
146
|
+
runs-on: ubuntu-latest
|
|
147
|
+
if: github.event_name == 'pull_request'
|
|
148
|
+
steps:
|
|
149
|
+
- name: Check branch naming convention
|
|
150
|
+
run: |
|
|
151
|
+
BRANCH="${{ github.head_ref }}"
|
|
152
|
+
if [[ ! "$BRANCH" =~ ^(feature|fix|patch|chore|refactor|perf|breaking|hotfix)/.+ ]]; then
|
|
153
|
+
echo "ERROR: Branch name must follow convention: <type>/<description>"
|
|
154
|
+
exit 1
|
|
155
|
+
fi
|
|
156
|
+
|
|
157
|
+
validate-commits:
|
|
158
|
+
name: Validate Commit Messages
|
|
159
|
+
runs-on: ubuntu-latest
|
|
160
|
+
if: github.event_name == 'pull_request'
|
|
161
|
+
steps:
|
|
162
|
+
- uses: actions/checkout@v4
|
|
163
|
+
with:
|
|
164
|
+
fetch-depth: 0
|
|
165
|
+
- name: Validate conventional commits
|
|
166
|
+
run: |
|
|
167
|
+
PATTERN="^(feat|fix|docs|style|refactor|perf|test|chore|ci|revert)(\(.+\))?(!)?: .+"
|
|
168
|
+
FAILED=0
|
|
169
|
+
while IFS= read -r commit; do
|
|
170
|
+
[[ "$commit" =~ $PATTERN ]] || { echo "FAIL: $commit"; FAILED=1; }
|
|
171
|
+
done < <(git log --format=%s origin/main..HEAD)
|
|
172
|
+
[ $FAILED -eq 0 ] || exit 1
|
|
173
|
+
|
|
174
|
+
test:
|
|
175
|
+
name: Test
|
|
176
|
+
runs-on: ubuntu-latest
|
|
177
|
+
needs: [validate-branch, validate-commits]
|
|
178
|
+
if: always() && !failure()
|
|
179
|
+
steps:
|
|
180
|
+
- uses: actions/checkout@v4
|
|
181
|
+
# ... language-specific test steps
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Pre-commit Hook (Local Enforcement)
|
|
185
|
+
|
|
186
|
+
Optional local validation via git hooks. Add to `.git/hooks/commit-msg`:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
#!/usr/bin/env bash
|
|
190
|
+
# Validate conventional commit format
|
|
191
|
+
PATTERN="^(feat|fix|docs|style|refactor|perf|test|chore|ci|revert)(\(.+\))?(!)?: .+"
|
|
192
|
+
MSG=$(head -1 "$1")
|
|
193
|
+
|
|
194
|
+
if [[ ! "$MSG" =~ $PATTERN ]]; then
|
|
195
|
+
echo "ERROR: Commit message does not follow Conventional Commits"
|
|
196
|
+
echo " Expected: <type>(<scope>): <description>"
|
|
197
|
+
echo " Got: $MSG"
|
|
198
|
+
echo ""
|
|
199
|
+
echo " Types: feat, fix, docs, style, refactor, perf, test, chore, ci, revert"
|
|
200
|
+
exit 1
|
|
201
|
+
fi
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Make executable: `chmod +x .git/hooks/commit-msg`
|