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,528 @@
|
|
|
1
|
+
import type { ArchitectureSlice, ModuleComponent } from "./types.ts";
|
|
2
|
+
|
|
3
|
+
// ── Issue Generation ──
|
|
4
|
+
|
|
5
|
+
export function generateIssueMarkdown(
|
|
6
|
+
component: ModuleComponent,
|
|
7
|
+
slice: ArchitectureSlice,
|
|
8
|
+
issueIndex: number,
|
|
9
|
+
totalIssues: number,
|
|
10
|
+
): string {
|
|
11
|
+
const moduleId = slice.module.replace(/^module-/, "");
|
|
12
|
+
const componentName = component.name.toLowerCase().replace(/\s+/g, "-");
|
|
13
|
+
const issueId = `ISSUE-${moduleId.toUpperCase()}-${issueIndex + 1}`;
|
|
14
|
+
|
|
15
|
+
return `---
|
|
16
|
+
guardian_issue:
|
|
17
|
+
id: "${issueId}"
|
|
18
|
+
epic: "TBD"
|
|
19
|
+
component: "${component.name}"
|
|
20
|
+
module: "${slice.module}"
|
|
21
|
+
status: planned
|
|
22
|
+
priority: high
|
|
23
|
+
dependencies:
|
|
24
|
+
${component.dependencies.map((d) => ` - "${d}"`).join("\n")}
|
|
25
|
+
|
|
26
|
+
in_scope:
|
|
27
|
+
- Implement ${component.name} for the ${slice.module} module
|
|
28
|
+
- Write unit tests for all public interfaces
|
|
29
|
+
- Add integration tests with upstream/downstream components
|
|
30
|
+
- Create API documentation
|
|
31
|
+
|
|
32
|
+
out_of_scope:
|
|
33
|
+
- Changes to upstream components (${component.dependencies.join(", ")})
|
|
34
|
+
- UI/frontend changes
|
|
35
|
+
- Deployment pipeline configuration
|
|
36
|
+
|
|
37
|
+
affected_layers:
|
|
38
|
+
domain:
|
|
39
|
+
- New domain models for ${componentName}
|
|
40
|
+
application:
|
|
41
|
+
- New service/handler for ${componentName}
|
|
42
|
+
infrastructure:
|
|
43
|
+
- New database tables or external service connections
|
|
44
|
+
api:
|
|
45
|
+
- New endpoints or event handlers
|
|
46
|
+
|
|
47
|
+
canonical_references:
|
|
48
|
+
- module: ".pi/architecture/modules/${slice.module}.md#${componentName}"
|
|
49
|
+
|
|
50
|
+
acceptance_criteria:
|
|
51
|
+
- "CI pipeline passes (validate-ci.sh)"
|
|
52
|
+
- "All unit tests pass with ≥ 90% coverage"
|
|
53
|
+
- "Integration tests pass with upstream/downstream components"
|
|
54
|
+
- "validate-security.sh passes"
|
|
55
|
+
- "validate-architecture.sh passes"
|
|
56
|
+
- "validate-canonical.sh passes"
|
|
57
|
+
|
|
58
|
+
validators:
|
|
59
|
+
- ci
|
|
60
|
+
- tests
|
|
61
|
+
- security
|
|
62
|
+
- architecture
|
|
63
|
+
- canonical
|
|
64
|
+
|
|
65
|
+
implementation_notes: |
|
|
66
|
+
${component.description || "Implement this component according to the architecture module."}
|
|
67
|
+
|
|
68
|
+
file_changes:
|
|
69
|
+
- "create: src/${moduleId}/${componentName}/"
|
|
70
|
+
- "create: tests/unit/${moduleId}/${componentName}/"
|
|
71
|
+
- "create: tests/integration/${moduleId}/${componentName}/"
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
# ${issueId}: ${component.name}
|
|
75
|
+
|
|
76
|
+
## Intent
|
|
77
|
+
|
|
78
|
+
${component.description || `Implement ${component.name} for the ${slice.module} module.`}
|
|
79
|
+
|
|
80
|
+
## Architecture Context
|
|
81
|
+
|
|
82
|
+
- **Module:** ${slice.module}
|
|
83
|
+
- **Component:** ${component.name}
|
|
84
|
+
- **Status:** ${component.status}
|
|
85
|
+
- **Dependencies:** ${component.dependencies.length > 0 ? component.dependencies.join(", ") : "none"}
|
|
86
|
+
|
|
87
|
+
## Dependencies
|
|
88
|
+
|
|
89
|
+
\`\`\`
|
|
90
|
+
${component.dependencies.map((d) => ` └── ${d}`).join("\n") || " └── (root component — no dependencies)"}
|
|
91
|
+
\`\`\`
|
|
92
|
+
|
|
93
|
+
## In Scope
|
|
94
|
+
|
|
95
|
+
- Implement ${component.name} for the ${slice.module} module
|
|
96
|
+
- Write unit tests for all public interfaces
|
|
97
|
+
- Add integration tests with upstream/downstream components
|
|
98
|
+
- Create API documentation
|
|
99
|
+
|
|
100
|
+
## Out of Scope
|
|
101
|
+
|
|
102
|
+
- Changes to upstream components
|
|
103
|
+
- UI/frontend changes
|
|
104
|
+
- Deployment pipeline configuration
|
|
105
|
+
|
|
106
|
+
## Affected Layers
|
|
107
|
+
|
|
108
|
+
### Domain
|
|
109
|
+
- New domain models for ${componentName}
|
|
110
|
+
|
|
111
|
+
### Application
|
|
112
|
+
- New service/handler for ${componentName}
|
|
113
|
+
|
|
114
|
+
### Infrastructure
|
|
115
|
+
- New database tables or external service connections
|
|
116
|
+
|
|
117
|
+
### API
|
|
118
|
+
- New endpoints or event handlers
|
|
119
|
+
|
|
120
|
+
## Canonical References
|
|
121
|
+
|
|
122
|
+
- **Module:** \`.pi/architecture/modules/${slice.module}.md#${componentName}\`
|
|
123
|
+
|
|
124
|
+
## Acceptance Criteria
|
|
125
|
+
|
|
126
|
+
| # | Criterion | Validator |
|
|
127
|
+
|---|-----------|-----------|
|
|
128
|
+
| 1 | CI pipeline passes | \`validate-ci.sh\` |
|
|
129
|
+
| 2 | All unit tests pass with ≥ 90% coverage | \`validate-tests.sh\` |
|
|
130
|
+
| 3 | Integration tests pass | \`validate-integration.sh\` |
|
|
131
|
+
| 4 | Security checks pass | \`validate-security.sh\` |
|
|
132
|
+
| 5 | Architecture compliance | \`validate-architecture.sh\` |
|
|
133
|
+
| 6 | Canonical references valid | \`validate-canonical.sh\` |
|
|
134
|
+
|
|
135
|
+
## Implementation
|
|
136
|
+
|
|
137
|
+
> **Agent:** This is your complete session context. All information you need is above.
|
|
138
|
+
> Start by reading the canonical reference files, then implement following the layer structure.
|
|
139
|
+
|
|
140
|
+
### Steps
|
|
141
|
+
|
|
142
|
+
1. Read canonical architecture references
|
|
143
|
+
2. Create domain entities and interfaces
|
|
144
|
+
3. Implement application service/handler
|
|
145
|
+
4. Add infrastructure connections
|
|
146
|
+
5. Write unit tests (≥ 90% coverage)
|
|
147
|
+
6. Write integration tests
|
|
148
|
+
7. Run all validators
|
|
149
|
+
8. Create MR
|
|
150
|
+
`;
|
|
151
|
+
}
|
|
152
|
+
// ── Contract Freeze Generator ──
|
|
153
|
+
|
|
154
|
+
export function generateContractFreezeMarkdown(
|
|
155
|
+
slice: ArchitectureSlice,
|
|
156
|
+
epicName: string,
|
|
157
|
+
): string {
|
|
158
|
+
const moduleId = slice.module.replace(/^module-/, "");
|
|
159
|
+
|
|
160
|
+
return `---
|
|
161
|
+
guardian_issue:
|
|
162
|
+
id: "ISSUE-CONTRACT-FREEZE"
|
|
163
|
+
epic: "${epicName}"
|
|
164
|
+
component: "Contract Freeze"
|
|
165
|
+
module: "${slice.module}"
|
|
166
|
+
status: planned
|
|
167
|
+
priority: critical
|
|
168
|
+
dependencies: []
|
|
169
|
+
|
|
170
|
+
in_scope:
|
|
171
|
+
- Define public interfaces for all components in this epic
|
|
172
|
+
- Define DTOs, schemas, and API contracts
|
|
173
|
+
- Document event payloads and topics
|
|
174
|
+
- Create interface stubs with no implementation
|
|
175
|
+
- Freeze: no implementation changes without contract change
|
|
176
|
+
|
|
177
|
+
out_of_scope:
|
|
178
|
+
- Any implementation logic
|
|
179
|
+
- Database schema changes
|
|
180
|
+
- Infrastructure setup
|
|
181
|
+
|
|
182
|
+
affected_layers:
|
|
183
|
+
domain:
|
|
184
|
+
- Interface definitions for domain services
|
|
185
|
+
application:
|
|
186
|
+
- Input/output DTO definitions
|
|
187
|
+
api:
|
|
188
|
+
- REST/event contracts
|
|
189
|
+
|
|
190
|
+
canonical_references:
|
|
191
|
+
- module: ".pi/architecture/modules/${slice.module}.md"
|
|
192
|
+
|
|
193
|
+
acceptance_criteria:
|
|
194
|
+
- "All component interfaces defined as interfaces/types"
|
|
195
|
+
- "DTO schemas documented"
|
|
196
|
+
- "API contracts frozen and reviewed"
|
|
197
|
+
- "Implementation PRs reference these contracts"
|
|
198
|
+
|
|
199
|
+
validators:
|
|
200
|
+
- architecture
|
|
201
|
+
- canonical
|
|
202
|
+
|
|
203
|
+
implementation_notes: |
|
|
204
|
+
Define the contract before any implementation. Every implementation issue
|
|
205
|
+
depends on this contract being frozen first. The contract should include:
|
|
206
|
+
interfaces, types, DTOs, event schemas, API paths, error formats.
|
|
207
|
+
|
|
208
|
+
file_changes:
|
|
209
|
+
- "create: src/${moduleId}/contracts/"
|
|
210
|
+
- "create: src/${moduleId}/contracts/dtos/"
|
|
211
|
+
- "create: src/${moduleId}/contracts/events/"
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
# Contract Freeze: ${slice.module}
|
|
215
|
+
|
|
216
|
+
## Intent
|
|
217
|
+
|
|
218
|
+
Define and freeze all public interfaces, contracts, and schemas for the ${slice.module}
|
|
219
|
+
epic before any implementation begins. This prevents architecture drift — implementation
|
|
220
|
+
must satisfy contracts, not the other way around.
|
|
221
|
+
|
|
222
|
+
## Included Components
|
|
223
|
+
|
|
224
|
+
${slice.nextLogicalSlice.map((c: { name: string }) => `- ${c.name}`).join("\n")}
|
|
225
|
+
|
|
226
|
+
## What Must Be Frozen
|
|
227
|
+
|
|
228
|
+
### Interfaces
|
|
229
|
+
- Service interfaces for every component
|
|
230
|
+
- Repository/DAO interfaces
|
|
231
|
+
- Factory interfaces
|
|
232
|
+
|
|
233
|
+
### Contracts
|
|
234
|
+
- Input/output DTO schemas
|
|
235
|
+
- API endpoint contracts (method, path, request/response)
|
|
236
|
+
- Event payload schemas
|
|
237
|
+
- Error response formats
|
|
238
|
+
|
|
239
|
+
### Out of Bounds (no contracts needed)
|
|
240
|
+
- Internal implementation details
|
|
241
|
+
- Database column names (hidden behind repository)
|
|
242
|
+
- Framework-specific annotations
|
|
243
|
+
|
|
244
|
+
## Acceptance Criteria
|
|
245
|
+
|
|
246
|
+
| # | Criterion | How to Verify |
|
|
247
|
+
|---|-----------|---------------|
|
|
248
|
+
| 1 | All component interfaces defined | Check src/<group>/<module>/domain/ and application/ |
|
|
249
|
+
| 2 | Contracts reviewed and frozen | PR approval |
|
|
250
|
+
| 3 | DTO schemas documented | OpenAPI / TypeSpec / equivalent |
|
|
251
|
+
| 4 | Implementation depends on contracts | No implementation without interface |
|
|
252
|
+
|
|
253
|
+
## Implementation
|
|
254
|
+
|
|
255
|
+
> **Agent:** Create interface-only files. No implementation. Use Clean Architecture layers:
|
|
256
|
+
> 1. Read the architecture module to understand each component's role
|
|
257
|
+
> 2. Place domain interfaces in domain/, service interfaces in application/, API contracts in interfaces/http/
|
|
258
|
+
> 3. DTOs with proper validation decorators go in application/
|
|
259
|
+
> 4. Event schemas go in domain/event/
|
|
260
|
+
> 5. Repository interfaces go in infrastructure/repository/
|
|
261
|
+
>
|
|
262
|
+
> The goal is a reviewed, frozen contract that implementation issues can depend on.
|
|
263
|
+
`;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// ── Proofing Issue Generator ──
|
|
267
|
+
|
|
268
|
+
export function generateProofingMarkdown(
|
|
269
|
+
slice: ArchitectureSlice,
|
|
270
|
+
epicName: string,
|
|
271
|
+
): string {
|
|
272
|
+
const moduleId = slice.module.replace(/^module-/, "");
|
|
273
|
+
|
|
274
|
+
return `---
|
|
275
|
+
guardian_issue:
|
|
276
|
+
id: "ISSUE-PROOFING"
|
|
277
|
+
epic: "${epicName}"
|
|
278
|
+
component: "Proofing & CI Enforcement"
|
|
279
|
+
module: "${slice.module}"
|
|
280
|
+
status: planned
|
|
281
|
+
priority: critical
|
|
282
|
+
dependencies: []
|
|
283
|
+
|
|
284
|
+
in_scope:
|
|
285
|
+
- Create deterministic validation scripts for each contract
|
|
286
|
+
- Verify all interfaces have matching implementations
|
|
287
|
+
- Check test coverage meets thresholds
|
|
288
|
+
- Integrate proofing scripts into .pi/scripts/ci/
|
|
289
|
+
- Scripts must be self-contained shell scripts (zero token cost)
|
|
290
|
+
|
|
291
|
+
out_of_scope:
|
|
292
|
+
- Implementation changes
|
|
293
|
+
- New features
|
|
294
|
+
- Production deployment
|
|
295
|
+
|
|
296
|
+
affected_layers:
|
|
297
|
+
ci:
|
|
298
|
+
- New proofing scripts in .pi/scripts/ci/
|
|
299
|
+
- Updated CI stage configuration
|
|
300
|
+
|
|
301
|
+
canonical_references:
|
|
302
|
+
- module: ".pi/architecture/modules/${slice.module}.md"
|
|
303
|
+
|
|
304
|
+
acceptance_criteria:
|
|
305
|
+
- "All proofing scripts created and executable"
|
|
306
|
+
- "Each contract has at least one validation check"
|
|
307
|
+
- "Scripts pass on current implementation"
|
|
308
|
+
- "Scripts fail if implementation is removed"
|
|
309
|
+
- "Scripts integrated into CI pipeline (stage in run_hardening_stages.sh)"
|
|
310
|
+
|
|
311
|
+
validators:
|
|
312
|
+
- ci
|
|
313
|
+
- tests
|
|
314
|
+
- canonical
|
|
315
|
+
|
|
316
|
+
implementation_notes: |
|
|
317
|
+
Create deterministic shell scripts that validate: each defined interface has an
|
|
318
|
+
implementation, each implementation has tests, test coverage meets threshold,
|
|
319
|
+
contracts are not violated. These escape the LLM ad-hoc check trap — they run
|
|
320
|
+
every build for zero token cost.
|
|
321
|
+
|
|
322
|
+
file_changes:
|
|
323
|
+
- "create: .pi/scripts/ci/check_${moduleId}_contracts.sh"
|
|
324
|
+
- "create: .pi/scripts/ci/check_${moduleId}_coverage.sh"
|
|
325
|
+
- "modify: .pi/scripts/ci/run_hardening_stages.sh"
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
# Proofing & CI Enforcement: ${slice.module}
|
|
329
|
+
|
|
330
|
+
## Intent
|
|
331
|
+
|
|
332
|
+
Create deterministic, automated validation scripts that prove every contract from the
|
|
333
|
+
freeze phase is correctly implemented and tested. These scripts make compliance
|
|
334
|
+
automatic — no human review needed for routine checks.
|
|
335
|
+
|
|
336
|
+
## What Each Script Does
|
|
337
|
+
|
|
338
|
+
### Contract Implementation Check
|
|
339
|
+
- Reads each interface from the contract freeze
|
|
340
|
+
- Verifies a concrete implementation class exists
|
|
341
|
+
- Verifies all interface methods are implemented
|
|
342
|
+
- Reports violations with file:line references
|
|
343
|
+
|
|
344
|
+
### Coverage Threshold Check
|
|
345
|
+
- Runs the project's coverage tool
|
|
346
|
+
- Asserts each module meets minimum coverage (default 80%)
|
|
347
|
+
- Fails the build if coverage drops
|
|
348
|
+
|
|
349
|
+
### CI Integration
|
|
350
|
+
Each check becomes a CI stage in the hardening pipeline — it runs automatically
|
|
351
|
+
on every PR. No LLM cost. No human review. Just pass or fail.
|
|
352
|
+
|
|
353
|
+
## Scripts To Create
|
|
354
|
+
|
|
355
|
+
| Script | Purpose | Location |
|
|
356
|
+
|--------|---------|----------|
|
|
357
|
+
| check_${moduleId}_contracts.sh | Validate contract implementation | .pi/scripts/ci/ |
|
|
358
|
+
| check_${moduleId}_coverage.sh | Enforce coverage thresholds | .pi/scripts/ci/ |
|
|
359
|
+
| stage_${moduleId}_proofing.sh | CI stage wrapper | .pi/scripts/ci/ |
|
|
360
|
+
|
|
361
|
+
## CI Pipeline Update
|
|
362
|
+
|
|
363
|
+
Add the new stage to \`run_hardening_stages.sh\`:
|
|
364
|
+
|
|
365
|
+
\`\`\`bash
|
|
366
|
+
run_stage "11" "${moduleId}_proofing" \\
|
|
367
|
+
"\${SCRIPTS_DIR}/stage_${moduleId}_proofing.sh" \\
|
|
368
|
+
"always"
|
|
369
|
+
\`\`\`
|
|
370
|
+
|
|
371
|
+
## Acceptance Criteria
|
|
372
|
+
|
|
373
|
+
| # | Criterion | Script |
|
|
374
|
+
|---|-----------|--------|
|
|
375
|
+
| 1 | All interfaces have implementations | check_contracts.sh |
|
|
376
|
+
| 2 | Coverage ≥ 80% per module | check_coverage.sh |
|
|
377
|
+
| 3 | CI runs checks on every PR | run_hardening_stages.sh |
|
|
378
|
+
| 4 | All scripts exit 0 on pass, 1 on fail | self-validating |
|
|
379
|
+
|
|
380
|
+
## Implementation
|
|
381
|
+
|
|
382
|
+
> **Agent:** Create shell scripts. Keep them simple — grep, find, awk.
|
|
383
|
+
> No frameworks, no dependencies. Each script should be:
|
|
384
|
+
> 1. Runnable standalone (bash script.sh)
|
|
385
|
+
> 2. Runnable as a CI stage
|
|
386
|
+
> 3. Self-documenting with --help
|
|
387
|
+
> 4. Exit 0 for pass, 1 for fail
|
|
388
|
+
>
|
|
389
|
+
> End by running the full CI pipeline to verify integration:
|
|
390
|
+
> \`bash .pi/scripts/ci/run_hardening_stages.sh\`
|
|
391
|
+
`;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// ── Architecture Readiness Generator (expanded) ──
|
|
395
|
+
|
|
396
|
+
export function generateArchitectureReadinessMarkdown(
|
|
397
|
+
slice: ArchitectureSlice,
|
|
398
|
+
epicName: string,
|
|
399
|
+
): string {
|
|
400
|
+
const moduleId = slice.module.replace(/^module-/, "");
|
|
401
|
+
|
|
402
|
+
return `---
|
|
403
|
+
guardian_issue:
|
|
404
|
+
id: "ISSUE-READINESS"
|
|
405
|
+
epic: "${epicName}"
|
|
406
|
+
component: "Architecture Readiness"
|
|
407
|
+
module: "${slice.module}"
|
|
408
|
+
status: planned
|
|
409
|
+
priority: critical
|
|
410
|
+
dependencies: []
|
|
411
|
+
|
|
412
|
+
in_scope:
|
|
413
|
+
- Create runbook (startup, shutdown, recovery procedures)
|
|
414
|
+
- Create DR plan (backup, restore, failover)
|
|
415
|
+
- Add observability (metrics, tracing, structured logging)
|
|
416
|
+
- Add health check endpoints
|
|
417
|
+
- Update architecture documentation
|
|
418
|
+
- Sync canonical references
|
|
419
|
+
- Verify CI enforces all the above
|
|
420
|
+
|
|
421
|
+
out_of_scope:
|
|
422
|
+
- New feature work
|
|
423
|
+
- Implementation changes
|
|
424
|
+
|
|
425
|
+
affected_layers:
|
|
426
|
+
domain:
|
|
427
|
+
- Architecture documentation updates
|
|
428
|
+
application:
|
|
429
|
+
- Observability hooks
|
|
430
|
+
infrastructure:
|
|
431
|
+
- Health checks, monitoring config
|
|
432
|
+
ci:
|
|
433
|
+
- Verify proofing scripts + validators in CI
|
|
434
|
+
|
|
435
|
+
canonical_references:
|
|
436
|
+
- module: ".pi/architecture/modules/${slice.module}.md"
|
|
437
|
+
|
|
438
|
+
acceptance_criteria:
|
|
439
|
+
- "Runbook created and reviewed"
|
|
440
|
+
- "DR plan documented"
|
|
441
|
+
- "Observability patterns in place (tracing, metrics, logging)"
|
|
442
|
+
- "Health check endpoint responds"
|
|
443
|
+
- "Architecture docs synced with implementation"
|
|
444
|
+
- "Canonical references verified (validate-canonical.sh passes)"
|
|
445
|
+
- "Proofing scripts integrated in CI and passing"
|
|
446
|
+
- "All validators pass: ci, tests, security, architecture, canonical, operations"
|
|
447
|
+
|
|
448
|
+
validators:
|
|
449
|
+
- ci
|
|
450
|
+
- tests
|
|
451
|
+
- security
|
|
452
|
+
- architecture
|
|
453
|
+
- canonical
|
|
454
|
+
- operations
|
|
455
|
+
|
|
456
|
+
implementation_notes: |
|
|
457
|
+
The final issue in every epic. Production readiness means: the team can operate it
|
|
458
|
+
(runbook), recover from failure (DR plan), observe it (metrics/tracing/logging),
|
|
459
|
+
and CI will catch regressions (proofing scripts + validators).
|
|
460
|
+
|
|
461
|
+
file_changes:
|
|
462
|
+
- "create: docs/runbook-${moduleId}.md"
|
|
463
|
+
- "create: docs/dr-plan-${moduleId}.md"
|
|
464
|
+
- "modify: .pi/architecture/CHANGELOG.md"
|
|
465
|
+
- "modify: .pi/architecture/modules/${slice.module}.md"
|
|
466
|
+
---
|
|
467
|
+
|
|
468
|
+
# Architecture Readiness: ${slice.module}
|
|
469
|
+
|
|
470
|
+
## Intent
|
|
471
|
+
|
|
472
|
+
Make the ${slice.module} module production-ready. This is the final issue in every epic
|
|
473
|
+
— it closes the loop between implementation and operability.
|
|
474
|
+
|
|
475
|
+
## Deliverables
|
|
476
|
+
|
|
477
|
+
### Runbook
|
|
478
|
+
\`docs/runbook-${moduleId}.md\` covering:
|
|
479
|
+
- Startup sequence and dependencies
|
|
480
|
+
- Graceful shutdown procedure
|
|
481
|
+
- Common failure modes and recovery
|
|
482
|
+
- Configuration reference
|
|
483
|
+
|
|
484
|
+
### DR Plan
|
|
485
|
+
\`docs/dr-plan-${moduleId}.md\` covering:
|
|
486
|
+
- Backup strategy and schedule
|
|
487
|
+
- Restore procedure
|
|
488
|
+
- Failover plan
|
|
489
|
+
- RTO/RPO targets
|
|
490
|
+
|
|
491
|
+
### Observability
|
|
492
|
+
- Metrics: key business and technical metrics exposed
|
|
493
|
+
- Tracing: distributed tracing context propagated
|
|
494
|
+
- Logging: structured logging with correlation IDs
|
|
495
|
+
- Health: /health endpoint with dependency checks
|
|
496
|
+
|
|
497
|
+
### CI Enforcement
|
|
498
|
+
Verify that:
|
|
499
|
+
- Proofing scripts from the proofing issue are in CI
|
|
500
|
+
- All validators (ci, tests, security, architecture, canonical, operations) pass
|
|
501
|
+
- A CI pipeline run against this state succeeds
|
|
502
|
+
|
|
503
|
+
## Acceptance Criteria
|
|
504
|
+
|
|
505
|
+
| # | Criterion | Validator |
|
|
506
|
+
|---|-----------|-----------|
|
|
507
|
+
| 1 | Runbook exists | manual review |
|
|
508
|
+
| 2 | DR plan exists | manual review |
|
|
509
|
+
| 3 | Observability patterns present | validate-operations.sh |
|
|
510
|
+
| 4 | Canonical references synced | validate-canonical.sh |
|
|
511
|
+
| 5 | CI enforce validators | validate-ci.sh |
|
|
512
|
+
| 6 | All proofing scripts pass | run_hardening_stages.sh |
|
|
513
|
+
| 7 | Architecture docs updated | validate-architecture.sh |
|
|
514
|
+
|
|
515
|
+
## Implementation
|
|
516
|
+
|
|
517
|
+
> **Agent:** Close out the epic properly:
|
|
518
|
+
> 1. Write runbook and DR plan docs
|
|
519
|
+
> 2. Add observability instrumentation
|
|
520
|
+
> 3. Update architecture module docs with final implementation details
|
|
521
|
+
> 4. Sync CHANGE LOG
|
|
522
|
+
> 5. Verify proofing scripts from the proofing issue pass
|
|
523
|
+
> 6. Run full validation suite
|
|
524
|
+
> 7. Architecture readiness validator: bash .pi/scripts/validate-architecture-readiness.sh
|
|
525
|
+
> 8. Create final MR
|
|
526
|
+
`;
|
|
527
|
+
}
|
|
528
|
+
|