guardian-framework 0.1.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/LICENSE +21 -0
- package/README.md +463 -0
- package/dist/cli.js +12958 -0
- package/dist/exports.js +12765 -0
- package/package.json +61 -0
- package/templates/languages/go-patterns.md +411 -0
- package/templates/languages/java-patterns.md +545 -0
- package/templates/languages/python-patterns.md +312 -0
- package/templates/languages/rust-patterns.md +232 -0
- package/templates/languages/typescript-patterns.md +313 -0
- package/templates/pi/INDEX.md +437 -0
- package/templates/pi/agent/AGENTS.md +166 -0
- package/templates/pi/agents/architecture-coordinator.md +40 -0
- package/templates/pi/agents/architecture-validator.md +36 -0
- package/templates/pi/agents/bootstrap-implementer.md +37 -0
- package/templates/pi/agents/issue-factory.md +31 -0
- package/templates/pi/agents/operations-validator.md +32 -0
- package/templates/pi/agents/security-validator.md +33 -0
- package/templates/pi/architecture/CHANGELOG.md +78 -0
- package/templates/pi/architecture/decisions/ADR-template.md +76 -0
- package/templates/pi/architecture/diagrams/system-overview.md +159 -0
- package/templates/pi/architecture/modules/module-template.md +152 -0
- package/templates/pi/context/checklists.md +91 -0
- package/templates/pi/context/domain-workflow.md +180 -0
- package/templates/pi/context/output-formats.md +135 -0
- package/templates/pi/context/patterns-base.md +47 -0
- package/templates/pi/context/patterns.md +38 -0
- package/templates/pi/context/project.md +88 -0
- package/templates/pi/domain/exploration.md +93 -0
- package/templates/pi/domain/ubiquitous-language.md +24 -0
- package/templates/pi/extensions/architect-lib/generators.ts +528 -0
- package/templates/pi/extensions/architect-lib/helpers.ts +344 -0
- package/templates/pi/extensions/architect-lib/types.ts +117 -0
- package/templates/pi/extensions/architect.ts +1425 -0
- package/templates/pi/extensions/ask-user-question.ts +579 -0
- package/templates/pi/extensions/bash-guard.ts +556 -0
- package/templates/pi/extensions/config-reload.ts +115 -0
- package/templates/pi/extensions/coordinator.ts +304 -0
- package/templates/pi/extensions/curator.ts +543 -0
- package/templates/pi/extensions/domain-explorer.ts +990 -0
- package/templates/pi/extensions/filechanges.ts +656 -0
- package/templates/pi/extensions/goal-loop.ts +717 -0
- package/templates/pi/extensions/hooks.ts +452 -0
- package/templates/pi/extensions/kanban.ts +547 -0
- package/templates/pi/extensions/pipeline.ts +1246 -0
- package/templates/pi/extensions/plan-mode.ts +209 -0
- package/templates/pi/extensions/project-scaffolder.ts +284 -0
- package/templates/pi/extensions/read-only-mode.ts +192 -0
- package/templates/pi/extensions/redaction.ts +128 -0
- package/templates/pi/extensions/session-persistence.ts +174 -0
- package/templates/pi/extensions/slash-commands.ts +229 -0
- package/templates/pi/extensions/snippets.ts +201 -0
- package/templates/pi/extensions/validation-runner.ts +100 -0
- package/templates/pi/github/agents/architecture-coordinator.agent.md +27 -0
- package/templates/pi/github/agents/architecture-validator.agent.md +20 -0
- package/templates/pi/github/agents/bootstrap-implementer.agent.md +20 -0
- package/templates/pi/github/agents/epic-planner.agent.md +70 -0
- package/templates/pi/github/agents/issue-factory.agent.md +20 -0
- package/templates/pi/github/agents/operations-validator.agent.md +20 -0
- package/templates/pi/github/agents/security-validator.agent.md +20 -0
- package/templates/pi/github/copilot/settings.json +16 -0
- package/templates/pi/github/copilot-instructions.md +155 -0
- package/templates/pi/github/instructions/architecture.instructions.md +71 -0
- package/templates/pi/github/instructions/validation.instructions.md +69 -0
- package/templates/pi/github/workflows/01-planning-workflow.md +75 -0
- package/templates/pi/github/workflows/02-issue-generation-workflow.md +69 -0
- package/templates/pi/github/workflows/03-implementation-workflow.md +80 -0
- package/templates/pi/github/workflows/04-validation-workflow.md +68 -0
- package/templates/pi/preflight_report.json +99 -0
- package/templates/pi/prompts/blueprint-update.md +262 -0
- package/templates/pi/prompts/blueprint-validate.md +218 -0
- package/templates/pi/prompts/bug-fix.md +50 -0
- package/templates/pi/prompts/ci-blueprint.md +131 -0
- package/templates/pi/prompts/context-refresh.md +258 -0
- package/templates/pi/prompts/epic-plan.md +356 -0
- package/templates/pi/prompts/epic-template.md +186 -0
- package/templates/pi/prompts/feature-development.md +131 -0
- package/templates/pi/prompts/git-issues.md +243 -0
- package/templates/pi/prompts/hotfix.md +71 -0
- package/templates/pi/prompts/issue-closeout.md +342 -0
- package/templates/pi/prompts/issue-draft.md +218 -0
- package/templates/pi/prompts/issue-implementation-series.md +173 -0
- package/templates/pi/prompts/issue-merge.md +372 -0
- package/templates/pi/prompts/issue-template-set.md +392 -0
- package/templates/pi/prompts/issue-template.md +207 -0
- package/templates/pi/prompts/pattern-extract.md +269 -0
- package/templates/pi/prompts/plan-to-issues.md +430 -0
- package/templates/pi/prompts/refactoring.md +82 -0
- package/templates/pi/prompts/scope-analyzer.md +254 -0
- package/templates/pi/prompts/sync-check.md +230 -0
- package/templates/pi/scripts/categorize-issues.sh +171 -0
- package/templates/pi/scripts/ci/check_architecture_conformance.sh +748 -0
- package/templates/pi/scripts/ci/check_planning_packet.py +228 -0
- package/templates/pi/scripts/ci/run_hardening_stages.sh +264 -0
- package/templates/pi/scripts/ci/run_preflight.sh +649 -0
- package/templates/pi/scripts/ci/run_stage.sh +193 -0
- package/templates/pi/scripts/ci/stage_docs_policy.sh +82 -0
- package/templates/pi/scripts/ci/stage_integration.sh +3 -0
- package/templates/pi/scripts/ci/stage_lint.sh +130 -0
- package/templates/pi/scripts/ci/stage_migration_verify.sh +3 -0
- package/templates/pi/scripts/ci/stage_package_build.sh +3 -0
- package/templates/pi/scripts/ci/stage_release_readiness.sh +3 -0
- package/templates/pi/scripts/ci/stage_remaining.sh +242 -0
- package/templates/pi/scripts/ci/stage_security.sh +3 -0
- package/templates/pi/scripts/ci/stage_static_analysis.sh +114 -0
- package/templates/pi/scripts/ci/stage_unit.sh +119 -0
- package/templates/pi/scripts/ci/validate_agent_output.py +181 -0
- package/templates/pi/scripts/ci/validate_agent_output.sh +243 -0
- package/templates/pi/scripts/create-feature-branch.sh +136 -0
- package/templates/pi/scripts/create-mr.sh +117 -0
- package/templates/pi/scripts/fetch-issues.sh +131 -0
- package/templates/pi/scripts/generate-architecture.sh +161 -0
- package/templates/pi/scripts/git/close-epic.sh +69 -0
- package/templates/pi/scripts/git/close-issue.sh +35 -0
- package/templates/pi/scripts/git/create-tracking-issue.sh +174 -0
- package/templates/pi/scripts/git/link-issue-to-epic.sh +51 -0
- package/templates/pi/scripts/git/update-tracking-issue.sh +66 -0
- package/templates/pi/scripts/languages/go/validate-architecture.sh +139 -0
- package/templates/pi/scripts/languages/go/validate-canonical.sh +129 -0
- package/templates/pi/scripts/languages/go/validate-ci.sh +132 -0
- package/templates/pi/scripts/languages/go/validate-integration.sh +156 -0
- package/templates/pi/scripts/languages/go/validate-operations.sh +146 -0
- package/templates/pi/scripts/languages/go/validate-security.sh +135 -0
- package/templates/pi/scripts/languages/go/validate-tests.sh +125 -0
- package/templates/pi/scripts/languages/java/validate-annotations.sh +185 -0
- package/templates/pi/scripts/languages/java/validate-architecture.sh +159 -0
- package/templates/pi/scripts/languages/java/validate-canonical.sh +114 -0
- package/templates/pi/scripts/languages/java/validate-ci.sh +269 -0
- package/templates/pi/scripts/languages/java/validate-integration.sh +149 -0
- package/templates/pi/scripts/languages/java/validate-operations.sh +142 -0
- package/templates/pi/scripts/languages/java/validate-security.sh +174 -0
- package/templates/pi/scripts/languages/java/validate-spring-architecture.sh +227 -0
- package/templates/pi/scripts/languages/java/validate-tests.sh +159 -0
- package/templates/pi/scripts/languages/python/validate-architecture.sh +99 -0
- package/templates/pi/scripts/languages/python/validate-canonical.sh +124 -0
- package/templates/pi/scripts/languages/python/validate-ci.sh +130 -0
- package/templates/pi/scripts/languages/python/validate-integration.sh +119 -0
- package/templates/pi/scripts/languages/python/validate-operations.sh +107 -0
- package/templates/pi/scripts/languages/python/validate-security.sh +68 -0
- package/templates/pi/scripts/languages/python/validate-tests.sh +102 -0
- package/templates/pi/scripts/languages/rust/validate-architecture.sh +188 -0
- package/templates/pi/scripts/languages/rust/validate-canonical.sh +146 -0
- package/templates/pi/scripts/languages/rust/validate-ci.sh +147 -0
- package/templates/pi/scripts/languages/rust/validate-integration.sh +149 -0
- package/templates/pi/scripts/languages/rust/validate-operations.sh +154 -0
- package/templates/pi/scripts/languages/rust/validate-security.sh +153 -0
- package/templates/pi/scripts/languages/rust/validate-tests.sh +150 -0
- package/templates/pi/scripts/languages/typescript/validate-architecture.sh +157 -0
- package/templates/pi/scripts/languages/typescript/validate-canonical.sh +135 -0
- package/templates/pi/scripts/languages/typescript/validate-ci.sh +244 -0
- package/templates/pi/scripts/languages/typescript/validate-integration.sh +166 -0
- package/templates/pi/scripts/languages/typescript/validate-operations.sh +162 -0
- package/templates/pi/scripts/languages/typescript/validate-security.sh +169 -0
- package/templates/pi/scripts/languages/typescript/validate-tests.sh +158 -0
- package/templates/pi/scripts/merge-mr.sh +95 -0
- package/templates/pi/scripts/mr-validation.sh +228 -0
- package/templates/pi/scripts/validate-architecture-readiness.sh +153 -0
- package/templates/pi/scripts/validate-architecture.sh +22 -0
- package/templates/pi/scripts/validate-canonical.sh +22 -0
- package/templates/pi/scripts/validate-ci.sh +37 -0
- package/templates/pi/scripts/validate-integration.sh +22 -0
- package/templates/pi/scripts/validate-operations.sh +22 -0
- package/templates/pi/scripts/validate-security.sh +22 -0
- package/templates/pi/scripts/validate-tests.sh +22 -0
- package/templates/pi/scripts/validate-ubiquitous-language.sh +291 -0
- package/templates/pi/scripts/validation-cache.sh +139 -0
- package/templates/pi/skills/agents/architecture-coordinator.md +178 -0
- package/templates/pi/skills/agents/architecture-generator.md +79 -0
- package/templates/pi/skills/agents/architecture-validator.md +74 -0
- package/templates/pi/skills/agents/ci-mr-validator.md +46 -0
- package/templates/pi/skills/agents/code-developer.md +76 -0
- package/templates/pi/skills/agents/commit.md +46 -0
- package/templates/pi/skills/agents/curator.md +71 -0
- package/templates/pi/skills/agents/debug.md +59 -0
- package/templates/pi/skills/agents/documentation-maintainer.md +36 -0
- package/templates/pi/skills/agents/goal-loop.md +125 -0
- package/templates/pi/skills/agents/hooks.md +122 -0
- package/templates/pi/skills/agents/integration-validator.md +35 -0
- package/templates/pi/skills/agents/issue-creator.md +75 -0
- package/templates/pi/skills/agents/issue-factory.md +143 -0
- package/templates/pi/skills/agents/kanban.md +85 -0
- package/templates/pi/skills/agents/land.md +59 -0
- package/templates/pi/skills/agents/operations-validator.md +43 -0
- package/templates/pi/skills/agents/pipeline.md +113 -0
- package/templates/pi/skills/agents/plan-mode.md +77 -0
- package/templates/pi/skills/agents/pull.md +40 -0
- package/templates/pi/skills/agents/push.md +41 -0
- package/templates/pi/skills/agents/security-validator.md +85 -0
- package/templates/pi/skills/agents/session-persistence.md +119 -0
- package/templates/pi/skills/agents/slash-commands.md +117 -0
- package/templates/pi/skills/agents/snippets.md +99 -0
- package/templates/pi/skills/agents/subagent-registry.md +78 -0
- package/templates/pi/skills/agents/test-validator.md +42 -0
- package/templates/pi/skills/validators/architecture-validator.md +43 -0
- package/templates/pi/skills/validators/ci-validator.md +27 -0
- package/templates/pi/skills/validators/context-compaction.md +73 -0
- package/templates/pi/skills/validators/integration-validator.md +38 -0
- package/templates/pi/skills/validators/model-registry.md +96 -0
- package/templates/pi/skills/validators/operations-validator.md +34 -0
- package/templates/pi/skills/validators/security-guards.md +72 -0
- package/templates/pi/skills/validators/security-validator.md +41 -0
- package/templates/pi/skills/validators/system-prompt-tiers.md +69 -0
- package/templates/pi/skills/validators/test-validator.md +33 -0
- package/templates/pi/types.ts +62 -0
- package/templates/pi/validators/README.md +93 -0
- package/templates/pi/validators/default.toml +209 -0
- package/templates/pi/validators/spring.toml +142 -0
- package/templates/pi/workpad.md +53 -0
- package/templates/project/java/Dockerfile +14 -0
- package/templates/project/java/README.md +40 -0
- package/templates/project/java/pom.xml +132 -0
- package/templates/project/typescript/Dockerfile +15 -0
- package/templates/project/typescript/README.md +29 -0
- package/templates/project/typescript/package.json +23 -0
- package/templates/project/typescript/tsconfig.json +21 -0
- package/templates/workflow.md +123 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# Domain-Driven Design Workflow (End-to-End)
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The full workflow from business idea to implemented architecture using Guardian's domain tools.
|
|
6
|
+
Every step produces artifacts the next step consumes.
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
/domain --explore "business intent"
|
|
10
|
+
↓ (agent fills exploration.md + ubiquitous-language.md automatically)
|
|
11
|
+
/domain --architect-scaffold <session-id>
|
|
12
|
+
↓ (generates modules, ADR-001, system-context.md)
|
|
13
|
+
guardian project create --lang <lang> (Epic 0 — greenfield only)
|
|
14
|
+
↓
|
|
15
|
+
/epic-plan --module <module-name> (per-module planning)
|
|
16
|
+
↓
|
|
17
|
+
/implement-series
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Step 1: Explore the Domain
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
/domain --explore "Describe your business domain here..."
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**What happens:**
|
|
29
|
+
- Creates a session ID and session file in `.pi/domain/exploration/<session-id>.md`
|
|
30
|
+
- Writes `.pi/domain/exploration.md` with business context and empty table sections
|
|
31
|
+
- Writes `.pi/domain/ubiquitous-language.md` (initial glossary)
|
|
32
|
+
- **Injects the DDD analysis prompt as a new conversation turn** via `pi.sendMessage()` with `triggerTurn=true`
|
|
33
|
+
|
|
34
|
+
**The agent automatically:**
|
|
35
|
+
- Analyzes the business context using DDD
|
|
36
|
+
- Identifies actors, roles, functional/non-functional requirements, assumptions
|
|
37
|
+
- Maps bounded contexts with entities, value objects, and aggregate roots
|
|
38
|
+
- Defines domain events and their triggers
|
|
39
|
+
- Builds the ubiquitous language glossary
|
|
40
|
+
- **Fills in all empty tables** in `.pi/domain/exploration.md`
|
|
41
|
+
- **Updates** `.pi/domain/ubiquitous-language.md` with glossary terms
|
|
42
|
+
|
|
43
|
+
**Output files:**
|
|
44
|
+
| File | Contents |
|
|
45
|
+
|------|----------|
|
|
46
|
+
| `.pi/domain/exploration.md` | Full analysis with all sections populated |
|
|
47
|
+
| `.pi/domain/ubiquitous-language.md` | Canonical glossary with terms |
|
|
48
|
+
| `.pi/domain/exploration/<session-id>.md` | Session record with synced analysis |
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Step 2: Scaffold Architecture
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
/domain --architect-scaffold <session-id>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**What happens:**
|
|
59
|
+
- Reads the agent-filled `exploration.md` and syncs analysis into the session file
|
|
60
|
+
- Calls `guardian-framework domain scaffold` to generate one module doc per bounded context
|
|
61
|
+
- Generates ADR-001 (architecture pattern decision) with the bounded context list
|
|
62
|
+
- Generates `system-context.md` with a mermaid diagram of bounded context flow
|
|
63
|
+
- **Sends results as a follow-up message** so the agent sees what was generated
|
|
64
|
+
|
|
65
|
+
**Agent responsibilities after scaffold:**
|
|
66
|
+
- Generate additional ADRs — only `ADR-001` is created; the agent must create the rest
|
|
67
|
+
- Fill in `## ADRs` sections in each module doc (initially `None yet`)
|
|
68
|
+
- Fill in `## Key Files` sections in each module doc (initially `None yet`)
|
|
69
|
+
- Update the CHANGELOG (initially a placeholder)
|
|
70
|
+
|
|
71
|
+
**Output files:**
|
|
72
|
+
| Path | Contents |
|
|
73
|
+
|------|----------|
|
|
74
|
+
| `.pi/architecture/modules/<context>.md` | One module doc per bounded context |
|
|
75
|
+
| `.pi/architecture/decisions/ADR-001.md` | Architecture pattern decision |
|
|
76
|
+
| `.pi/architecture/diagrams/system-context.md` | Mermaid bounded context flow |
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Step 3: Review & Validate (Optional)
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
/domain --validate <session-id>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Checks session file structure: bounded contexts, entities, ubiquitous language sections.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Step 4: Plan Implementation
|
|
91
|
+
|
|
92
|
+
Two approaches:
|
|
93
|
+
|
|
94
|
+
**A) Project-wide overview:**
|
|
95
|
+
```bash
|
|
96
|
+
/epic-plan --overview
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**B) Per-module planning (after Epic 0 scaffold):**
|
|
100
|
+
```bash
|
|
101
|
+
/epic-plan --module <module-name>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Epic structure (4 layers):**
|
|
105
|
+
1. **Contract Freeze** — define interfaces before implementation
|
|
106
|
+
2. **Implementation Issues** — one per component
|
|
107
|
+
3. **Proofing** — deterministic validation scripts + CI integration
|
|
108
|
+
4. **Architecture Readiness** — runbook, DR, docs, observability, CI enforcement
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Step 5: Scaffold Project (Epic 0 — Greenfield Only)
|
|
113
|
+
|
|
114
|
+
For a new project AFTER architecture is defined:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
guardian project create --lang <language> --buildTool <maven|gradle>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Reads architecture modules and generates:
|
|
121
|
+
- Source directories per module + Clean Architecture layers (domain/application/infrastructure/interfaces)
|
|
122
|
+
- Build configuration (pom.xml / build.gradle / package.json)
|
|
123
|
+
- CI pipeline (GitHub Actions or GitLab CI)
|
|
124
|
+
- Stage scripts for the hardening pipeline
|
|
125
|
+
|
|
126
|
+
Existing projects skip this step (detects existing `src/`).
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Step 6: Implement
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
/implement-series
|
|
134
|
+
# or follow the pipeline generated by /architect
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Each issue follows the contract freeze → implementation → proofing → readiness sequence.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Agent Definitions
|
|
142
|
+
|
|
143
|
+
Canonical agent definitions in `.pi/agents/` using 6-section format (Purpose, Authority, Inputs, Outputs, DoD, Escalation):
|
|
144
|
+
|
|
145
|
+
| Agent | Role | Phase |
|
|
146
|
+
|-------|------|-------|
|
|
147
|
+
| Architecture Coordinator | Coordinator | A — Planning |
|
|
148
|
+
| Issue Factory | Coordinator | B — Issue Generation |
|
|
149
|
+
| Bootstrap Implementer | Builder | C — Implementation |
|
|
150
|
+
| Architecture Validator | Validator | D — Validation |
|
|
151
|
+
| Security Validator | Validator | D — Validation |
|
|
152
|
+
| Operations Validator | Validator | D — Validation |
|
|
153
|
+
|
|
154
|
+
## 4-Phase Delivery Pipeline
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
Phase A: Planning → .pi/agents/architecture-coordinator.md
|
|
158
|
+
Phase B: Issue Gen → .pi/agents/issue-factory.md
|
|
159
|
+
Phase C: Implement → .pi/agents/bootstrap-implementer.md
|
|
160
|
+
Phase D: Validation → .pi/agents/architecture-validator.md + security + operations
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Each phase produces a validated artifact before the next begins.
|
|
164
|
+
|
|
165
|
+
## Deterministic Validation Scripts
|
|
166
|
+
|
|
167
|
+
| Script | Purpose |
|
|
168
|
+
|--------|---------|
|
|
169
|
+
| `scripts/ci/check_planning_packet.py` | Validates planning packet before issue generation |
|
|
170
|
+
| `scripts/ci/validate_agent_output.py` | Validates agent output schema per role |
|
|
171
|
+
| `scripts/ci/run_preflight.sh` | Orchestrates local CI checks |
|
|
172
|
+
|
|
173
|
+
## How It Works: sendMessage Pattern
|
|
174
|
+
|
|
175
|
+
All commands that need the agent to continue working use `pi.sendMessage()` with `triggerTurn=true` instead of returning text. This injects the message as a new user conversation turn, which the agent processes naturally — writing files, calling tools, and continuing the workflow.
|
|
176
|
+
|
|
177
|
+
Commands using this pattern:
|
|
178
|
+
- `/domain --explore` — sends DDD analysis prompt
|
|
179
|
+
- `/domain --architect-scaffold` — sends scaffold results
|
|
180
|
+
- `/domain --validate` — sends validation results
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Output Formats
|
|
2
|
+
|
|
3
|
+
> **Purpose:** Standardized report templates. All validators use these. Referenced, not duplicated.
|
|
4
|
+
> **Generic:** Adjust severity levels and fields to your project.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Validation Report (All Validators)
|
|
9
|
+
|
|
10
|
+
```markdown
|
|
11
|
+
## [Validator Name] Report
|
|
12
|
+
|
|
13
|
+
**Task:** [task-id or description]
|
|
14
|
+
**Scope:** [Simple/Moderate/Complex/Critical]
|
|
15
|
+
**Files Reviewed:** [list]
|
|
16
|
+
|
|
17
|
+
### Results
|
|
18
|
+
|
|
19
|
+
| Check | Status | Notes |
|
|
20
|
+
|-------|--------|-------|
|
|
21
|
+
| [Check 1] | ✅/❌ | [notes] |
|
|
22
|
+
| [Check 2] | ✅/❌ | [notes] |
|
|
23
|
+
|
|
24
|
+
### Issues
|
|
25
|
+
|
|
26
|
+
| Severity | File:Line | Description | Fix |
|
|
27
|
+
|----------|-----------|-------------|-----|
|
|
28
|
+
| [Critical/High/Medium/Low] | [file:line] | [description] | [fix] |
|
|
29
|
+
|
|
30
|
+
### Verdict
|
|
31
|
+
|
|
32
|
+
- [ ] APPROVED
|
|
33
|
+
- [ ] APPROVED WITH CONDITIONS
|
|
34
|
+
- [ ] REQUIRES CHANGES
|
|
35
|
+
- [ ] REJECTED
|
|
36
|
+
|
|
37
|
+
### Conditions (if any)
|
|
38
|
+
- [condition 1]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Design Proposal
|
|
42
|
+
|
|
43
|
+
```markdown
|
|
44
|
+
## Design Proposal: [Name]
|
|
45
|
+
|
|
46
|
+
### Summary
|
|
47
|
+
[1-2 paragraphs]
|
|
48
|
+
|
|
49
|
+
### Approach
|
|
50
|
+
[Detailed approach]
|
|
51
|
+
|
|
52
|
+
### Affected Components
|
|
53
|
+
- [Component]: [Changes]
|
|
54
|
+
|
|
55
|
+
### Tradeoffs
|
|
56
|
+
| Option | Pros | Cons | Decision |
|
|
57
|
+
|--------|------|------|----------|
|
|
58
|
+
| A | ... | ... | Chosen |
|
|
59
|
+
| B | ... | ... | Rejected |
|
|
60
|
+
|
|
61
|
+
### Risks
|
|
62
|
+
| Risk | Likelihood | Impact | Mitigation |
|
|
63
|
+
|------|-----------|--------|------------|
|
|
64
|
+
| [Risk] | [H/M/L] | [H/M/L] | [Mitigation] |
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Implementation Plan
|
|
68
|
+
|
|
69
|
+
```markdown
|
|
70
|
+
## Implementation Plan: [Name]
|
|
71
|
+
|
|
72
|
+
### Scope
|
|
73
|
+
- **Files:** [count]
|
|
74
|
+
- **Estimated lines:** [count]
|
|
75
|
+
- **Complexity:** [Simple/Moderate/Complex/Critical]
|
|
76
|
+
|
|
77
|
+
### Steps
|
|
78
|
+
1. [Step 1] — [file(s)]
|
|
79
|
+
2. [Step 2] — [file(s)]
|
|
80
|
+
3. [Step 3] — [file(s)]
|
|
81
|
+
|
|
82
|
+
### Dependencies
|
|
83
|
+
- [Dependency 1]
|
|
84
|
+
- [Dependency 2]
|
|
85
|
+
|
|
86
|
+
### Validation Contract
|
|
87
|
+
> Items pre-validated at plan time. Post-code review checks ONLY wiring + build.
|
|
88
|
+
- [ ] Architecture: [approved]
|
|
89
|
+
- [ ] Security: [approved]
|
|
90
|
+
- [ ] Operations: [approved]
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Epic Draft
|
|
94
|
+
|
|
95
|
+
```markdown
|
|
96
|
+
## Epic: [Name]
|
|
97
|
+
|
|
98
|
+
### Goal
|
|
99
|
+
[One sentence]
|
|
100
|
+
|
|
101
|
+
### Issues
|
|
102
|
+
- [ ] #[issue] — [title]
|
|
103
|
+
- [ ] #[issue] — [title]
|
|
104
|
+
|
|
105
|
+
### Acceptance Criteria
|
|
106
|
+
- [ ] [Criterion 1]
|
|
107
|
+
- [ ] [Criterion 2]
|
|
108
|
+
|
|
109
|
+
### Validation
|
|
110
|
+
- [ ] All issues merged
|
|
111
|
+
- [ ] All CI green
|
|
112
|
+
- [ ] Post-merge validation passed
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## CI/MR Report
|
|
116
|
+
|
|
117
|
+
```markdown
|
|
118
|
+
## CI/MR Validation
|
|
119
|
+
|
|
120
|
+
**PR:** #[number]
|
|
121
|
+
**Branch:** [branch-name]
|
|
122
|
+
|
|
123
|
+
### CI Status
|
|
124
|
+
| Check | Status | Duration |
|
|
125
|
+
|-------|--------|----------|
|
|
126
|
+
| Build | ✅/❌ | [time] |
|
|
127
|
+
| Test | ✅/❌ | [time] |
|
|
128
|
+
| Lint | ✅/❌ | [time] |
|
|
129
|
+
| Security | ✅/❌ | [time] |
|
|
130
|
+
|
|
131
|
+
### Verdict
|
|
132
|
+
- [ ] READY TO MERGE
|
|
133
|
+
- [ ] NEEDS CHANGES
|
|
134
|
+
- [ ] BLOCKED
|
|
135
|
+
```
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Code Patterns
|
|
2
|
+
|
|
3
|
+
> **Purpose:** Reusable code templates and patterns. Referenced by agents, not duplicated.
|
|
4
|
+
> **Generic:** Replace with your language/framework patterns.
|
|
5
|
+
|
|
6
|
+
## Error Handling
|
|
7
|
+
|
|
8
|
+
```[language]
|
|
9
|
+
// [Pattern description]
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Tracing / Logging
|
|
13
|
+
|
|
14
|
+
```[language]
|
|
15
|
+
// [Pattern description]
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Cancellation / Cleanup
|
|
19
|
+
|
|
20
|
+
```[language]
|
|
21
|
+
// [Pattern description]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Atomic Writes
|
|
25
|
+
|
|
26
|
+
```[language]
|
|
27
|
+
// [Pattern description]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Data Structures
|
|
31
|
+
|
|
32
|
+
```[language]
|
|
33
|
+
// [Pattern description]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Testing
|
|
37
|
+
|
|
38
|
+
```[language]
|
|
39
|
+
// [Pattern description]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Anti-Patterns (NEVER DO)
|
|
43
|
+
|
|
44
|
+
```[language]
|
|
45
|
+
// ❌ [Bad pattern]
|
|
46
|
+
// ✅ [Good pattern]
|
|
47
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Code Patterns
|
|
2
|
+
|
|
3
|
+
> Code templates for reference. Agents read this to match patterns.
|
|
4
|
+
> **Language-specific patterns** are in `.pi/languages/{{LANGUAGE}}-patterns.md`.
|
|
5
|
+
|
|
6
|
+
## Error Handling
|
|
7
|
+
|
|
8
|
+
{{ERROR_HANDLING_SECTION}}
|
|
9
|
+
|
|
10
|
+
**Rule:** {{ERROR_HANDLING_RULE}}
|
|
11
|
+
|
|
12
|
+
## Tracing
|
|
13
|
+
|
|
14
|
+
{{TRACING_SECTION}}
|
|
15
|
+
|
|
16
|
+
**Rule:** {{TRACING_RULE}}
|
|
17
|
+
|
|
18
|
+
## Cancellation
|
|
19
|
+
|
|
20
|
+
{{CANCELLATION_SECTION}}
|
|
21
|
+
|
|
22
|
+
**Rule:** {{CANCELLATION_RULE}}
|
|
23
|
+
|
|
24
|
+
## Atomic Writes
|
|
25
|
+
|
|
26
|
+
{{ATOMIC_WRITE_SECTION}}
|
|
27
|
+
|
|
28
|
+
**Rule:** {{ATOMIC_WRITE_RULE}}
|
|
29
|
+
|
|
30
|
+
## Retry Logic
|
|
31
|
+
|
|
32
|
+
```{{LANGUAGE}}
|
|
33
|
+
// Exponential backoff: base_delay * 2^retry
|
|
34
|
+
// Jitter: ±25% to prevent thundering herd
|
|
35
|
+
// Max retries: 3
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Rule:** Max 3 retries. Exponential backoff with jitter.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Project Context
|
|
2
|
+
|
|
3
|
+
> Single source of truth for project-specific knowledge. All agents load this ONCE.
|
|
4
|
+
> **This is a template** — replace placeholders with actual values during `guardian init`.
|
|
5
|
+
|
|
6
|
+
## Project Overview
|
|
7
|
+
|
|
8
|
+
- **Name:** {{PROJECT_NAME}}
|
|
9
|
+
- **Version:** {{PROJECT_VERSION}}
|
|
10
|
+
- **Language:** {{LANGUAGE}}
|
|
11
|
+
- **Type:** {{PROJECT_TYPE}}
|
|
12
|
+
- **Repository:** {{REPOSITORY}}
|
|
13
|
+
|
|
14
|
+
## Core Principles
|
|
15
|
+
|
|
16
|
+
1. **Template-driven** - Workflows in templates, not dynamic generation
|
|
17
|
+
2. **DAG-based** - Task nodes with dependencies, topological execution
|
|
18
|
+
3. **Minimal LLM** - LLM = planning tool only
|
|
19
|
+
4. **Bounded autonomy** - Hard caps on dynamic behavior
|
|
20
|
+
5. **Bounded retries** - Max 3 retries with exponential backoff + jitter (±25%)
|
|
21
|
+
6. **Risk-gated** - Safe=auto, Medium=confirm, Dangerous=dry-run
|
|
22
|
+
7. **Pre-validated** - Validator catches errors BEFORE execution
|
|
23
|
+
8. **Auditable** - Planning decisions tracked and diffable
|
|
24
|
+
|
|
25
|
+
## Architecture
|
|
26
|
+
|
|
27
|
+
### Structure
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
{{PROJECT_NAME}}/
|
|
31
|
+
├── src/ # Source code
|
|
32
|
+
├── tests/ # Test files
|
|
33
|
+
├── docs/ # Documentation
|
|
34
|
+
└── .pi/ # Agent framework
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Key Patterns
|
|
38
|
+
|
|
39
|
+
- **Error handling:** {{ERROR_HANDLING_PATTERN}}
|
|
40
|
+
- **Tracing:** {{TRACING_PATTERN}}
|
|
41
|
+
- **Cancellation:** {{CANCELLATION_PATTERN}}
|
|
42
|
+
- **Atomic writes:** {{ATOMIC_WRITE_PATTERN}}
|
|
43
|
+
|
|
44
|
+
## Quality Gates
|
|
45
|
+
|
|
46
|
+
### Before Commit
|
|
47
|
+
```bash
|
|
48
|
+
{{BUILD_COMMAND}} && {{FORMAT_COMMAND}}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Before Push
|
|
52
|
+
```bash
|
|
53
|
+
{{TEST_COMMAND}} && {{LINT_COMMAND}}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Before Merge
|
|
57
|
+
```bash
|
|
58
|
+
{{TEST_COMMAND}}
|
|
59
|
+
{{LINT_COMMAND}}
|
|
60
|
+
{{FORMAT_CHECK_COMMAND}}
|
|
61
|
+
{{SECURITY_AUDIT_COMMAND}}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Scope Classification
|
|
65
|
+
|
|
66
|
+
| Scope | Files | Lines | Required Validators |
|
|
67
|
+
|-------|-------|-------|---------------------|
|
|
68
|
+
| Simple | 1 | < 50 | ci-mr (automated) |
|
|
69
|
+
| Moderate | 2-5 | 50-200 | architecture-validator |
|
|
70
|
+
| Complex | 5-15 | 200-500 | architecture + security |
|
|
71
|
+
| Critical | 15+ or core | 500+ | All validators + human |
|
|
72
|
+
|
|
73
|
+
## Key Files
|
|
74
|
+
|
|
75
|
+
| File | Purpose |
|
|
76
|
+
|------|---------|
|
|
77
|
+
| docs/ARCHITECTURE.md | Architecture specification |
|
|
78
|
+
| {{KEY_FILE_1}} | {{KEY_FILE_1_PURPOSE}} |
|
|
79
|
+
| {{KEY_FILE_2}} | {{KEY_FILE_2_PURPOSE}} |
|
|
80
|
+
|
|
81
|
+
## Commands
|
|
82
|
+
|
|
83
|
+
| Command | Purpose |
|
|
84
|
+
|---------|---------|
|
|
85
|
+
| `{{BUILD_COMMAND}}` | Build project |
|
|
86
|
+
| `{{TEST_COMMAND}}` | Run tests |
|
|
87
|
+
| `{{LINT_COMMAND}}` | Lint check |
|
|
88
|
+
| `{{SECURITY_AUDIT_COMMAND}}` | Security audit |
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
session_id: {{SESSION_ID}}
|
|
3
|
+
created: {{CREATED_DATE}}
|
|
4
|
+
business_context: "{{BUSINESS_CONTEXT}}"
|
|
5
|
+
status: {{STATUS}}
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Domain Exploration: {{SESSION_ID}}
|
|
9
|
+
|
|
10
|
+
> Automatically generated by `guardian domain explore`.
|
|
11
|
+
> Status: **{{STATUS}}** — *draft* = AI-suggested, *validated* = human-reviewed.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Business Context
|
|
16
|
+
|
|
17
|
+
{{BUSINESS_CONTEXT}}
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Actors & Roles
|
|
22
|
+
|
|
23
|
+
| Actor | Description | Interactions |
|
|
24
|
+
|-------|-------------|-------------|
|
|
25
|
+
{{ACTORS_TABLE}}
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Functional Requirements
|
|
30
|
+
|
|
31
|
+
| ID | Requirement | Priority | Bounded Context |
|
|
32
|
+
|----|-------------|----------|----------------|
|
|
33
|
+
{{FUNCTIONAL_REQUIREMENTS_TABLE}}
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Non-Functional Requirements
|
|
38
|
+
|
|
39
|
+
| ID | Requirement | Category | Target |
|
|
40
|
+
|----|-------------|----------|--------|
|
|
41
|
+
{{NON_FUNCTIONAL_REQUIREMENTS_TABLE}}
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Assumptions
|
|
46
|
+
|
|
47
|
+
| Assumption | Impact if Wrong | Mitigation |
|
|
48
|
+
|------------|----------------|-----------|
|
|
49
|
+
{{ASSUMPTIONS_TABLE}}
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Bounded Contexts
|
|
54
|
+
|
|
55
|
+
| Context | Description | Entities |
|
|
56
|
+
|---------|-------------|----------|
|
|
57
|
+
{{BOUNDED_CONTEXTS_TABLE}}
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Entities
|
|
62
|
+
|
|
63
|
+
| Entity | Context | Type | Description |
|
|
64
|
+
|--------|---------|------|-------------|
|
|
65
|
+
{{ENTITIES_TABLE}}
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Domain Events
|
|
70
|
+
|
|
71
|
+
| Event | Context | Description | Triggered By |
|
|
72
|
+
|-------|---------|-------------|-------------|
|
|
73
|
+
{{DOMAIN_EVENTS_TABLE}}
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Ubiquitous Language
|
|
78
|
+
|
|
79
|
+
| Term | Definition | Bounded Context | Aliases/Synonyms |
|
|
80
|
+
|------|-----------|----------------|-----------------|
|
|
81
|
+
{{UBIQUITOUS_LANGUAGE_TABLE}}
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Open Questions
|
|
86
|
+
|
|
87
|
+
{{OPEN_QUESTIONS}}
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Aggregate Roots
|
|
92
|
+
|
|
93
|
+
{{AGGREGATE_ROOTS}}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Ubiquitous Language
|
|
2
|
+
|
|
3
|
+
> Canonical glossary for **[Project Name]**.
|
|
4
|
+
> All code MUST use these terms. Aliases/synonyms listed below are **prohibited** in source identifiers.
|
|
5
|
+
> Drift is detected by `.pi/scripts/validate-ubiquitous-language.sh`.
|
|
6
|
+
|
|
7
|
+
## Glossary
|
|
8
|
+
|
|
9
|
+
| Term | Definition | Bounded Context | Aliases/Synonyms | Examples |
|
|
10
|
+
|------|-----------|----------------|-----------------|---------|
|
|
11
|
+
| <!-- Add your terms here --> | | | | |
|
|
12
|
+
| <!-- Format: | TermName | What it means | ModuleName | Alias1, Alias2 | `code example` | --> |
|
|
13
|
+
|
|
14
|
+
## Adding New Terms
|
|
15
|
+
|
|
16
|
+
1. Identify the term used in conversation and code
|
|
17
|
+
2. Add a row to the Glossary table
|
|
18
|
+
3. Define the term's **bounded context** (which module it lives in)
|
|
19
|
+
4. List any **aliases/synonyms** that agents might mistakenly use
|
|
20
|
+
5. Provide **code examples** showing correct usage
|
|
21
|
+
6. Run `.pi/scripts/validate-ubiquitous-language.sh` to detect drift
|
|
22
|
+
|
|
23
|
+
> **Rule of thumb:** If two agents use different names for the same concept, add an entry.
|
|
24
|
+
> The canonical term is the one used in the architecture module documents.
|