azcodr 1.3.0 → 1.5.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/.agents/hooks.json.example +42 -0
- package/.agents/mcp_config.json.example +24 -0
- package/.agents/scripts/safety_guard.sh +16 -0
- package/.agents/scripts/verify_completion.sh +13 -0
- package/.agents/skills/agentic-architect/SKILL.md +15 -8
- package/.agents/skills/agentic-architect/references/agents_md_template.md +6 -3
- package/.agents/skills/agentic-architect/references/skill_architecture_inquiry.md +1 -1
- package/.agents/skills/agentic-architect/references/skill_template.md +2 -1
- package/.agents/skills/agentic-architect/scripts/validate_agentic_configs.sh +189 -6
- package/.agents/skills/clean-code-refactor/SKILL.md +6 -6
- package/.agents/skills/compliance-audit/SKILL.md +1 -1
- package/.agents/skills/lets-build/SKILL.md +22 -7
- package/.agents/skills/lets-build/references/architecture_interview_matrix.md +8 -2
- package/.agents/skills/lets-build/references/hexagonal_bootstrap_scaffolds.md +53 -6
- package/.agents/skills/lets-build/references/project_readme_template.md +4 -4
- package/.agents/skills/lets-build/scripts/bootstrap_workspace.sh +181 -36
- package/.agents/skills/product-analyst/SKILL.md +13 -2
- package/.agents/skills/relentless-questioner/SKILL.md +13 -5
- package/.agents/skills/relentless-questioner/references/adaptive_question_trees.md +18 -0
- package/.gitignore +2 -0
- package/AGENTS.md +25 -40
- package/README.md +27 -40
- package/bin/azcodr.js +9 -4
- package/docs/rules/agentic_configuration.md +123 -32
- package/docs/rules/api_architecture.md +179 -0
- package/docs/rules/caching.md +30 -13
- package/docs/rules/cloud_native.md +10 -12
- package/docs/rules/cqrs.md +203 -0
- package/docs/rules/database_design.md +125 -0
- package/docs/rules/database_operations.md +56 -14
- package/docs/rules/design_patterns.md +18 -11
- package/docs/rules/devops_ci_cd.md +76 -0
- package/docs/rules/domain_driven_design.md +17 -13
- package/docs/rules/feature_flags.md +21 -4
- package/docs/rules/frontend_architecture.md +157 -0
- package/docs/rules/multitenancy_architecture.md +98 -0
- package/docs/rules/product_ownership.md +22 -27
- package/docs/rules/relentless_questioning.md +4 -0
- package/docs/rules/requirements_engineering.md +16 -14
- package/docs/rules/security_compliance.md +53 -0
- package/docs/rules/server_driven_ui.md +20 -3
- package/docs/rules/test_driven_development.md +119 -62
- package/docs/rules/type_safety.md +65 -0
- package/docs/rules/ui_ux_architecture.md +33 -30
- package/docs/rules/workflow_state_machines.md +20 -3
- package/lib/scaffold.js +117 -5
- package/memory.md +12 -131
- package/package.json +2 -2
- package/docs/rules/accessibility.md +0 -31
- package/docs/rules/advanced_api_patterns.md +0 -104
- package/docs/rules/api_versioning.md +0 -113
- package/docs/rules/application_security.md +0 -23
- package/docs/rules/architecture_decision_records.md +0 -42
- package/docs/rules/compliance.md +0 -25
- package/docs/rules/container_infrastructure.md +0 -32
- package/docs/rules/continuous_deployment.md +0 -24
- package/docs/rules/continuous_integration.md +0 -20
- package/docs/rules/continuous_learning.md +0 -29
- package/docs/rules/database_integrity.md +0 -80
- package/docs/rules/database_migrations.md +0 -41
- package/docs/rules/database_performance.md +0 -44
- package/docs/rules/database_transactions.md +0 -81
- package/docs/rules/devsecops.md +0 -33
- package/docs/rules/multitenancy_isolation.md +0 -88
- package/docs/rules/react.md +0 -78
- package/docs/rules/rest_api_conventions.md +0 -46
- package/docs/rules/tenant_dynamic_schemas.md +0 -88
- package/docs/rules/tenant_pluggable_logic.md +0 -59
- package/docs/rules/test_isolation.md +0 -26
- package/docs/rules/typescript.md +0 -55
- package/docs/rules/ui_navigation.md +0 -20
- package/docs/rules/workspace_isolation.md +0 -25
package/memory.md
CHANGED
|
@@ -17,139 +17,20 @@
|
|
|
17
17
|
|
|
18
18
|
| ID | Title | Date | Status | Governing Rule / Skill |
|
|
19
19
|
|---|---|---|---|---|
|
|
20
|
-
|
|
|
21
|
-
| **ADR-002** | Progressive Disclosure Architecture for Agentic Context | 2026-09-16 | ACCEPTED | [`agentic_configuration.md`](./docs/rules/agentic_configuration.md), [`agentic-architect`](./.agents/skills/agentic-architect/SKILL.md) |
|
|
22
|
-
| **ADR-003** | Dual-Layer Multi-Tenancy Isolation with PostgreSQL RLS | 2026-09-16 | ACCEPTED | [`multitenancy_isolation.md`](./docs/rules/multitenancy_isolation.md) |
|
|
23
|
-
| **ADR-004** | Systemic Atomicity & Pure Single-Responsibility Rule Decomposition | 2026-09-16 | ACCEPTED | [`agentic_configuration.md`](./docs/rules/agentic_configuration.md) |
|
|
24
|
-
| **ADR-005** | Universal Technology, Language, and Stack Agnosticism | 2026-09-18 | ACCEPTED | [`clean_code.md`](./docs/rules/clean_code.md), [`lets-build`](./.agents/skills/lets-build/SKILL.md) |
|
|
25
|
-
| **ADR-006** | Mandatory Full Lifecycle CRUD & Relational FK Selector Pattern | 2026-09-18 | ACCEPTED | [`database_integrity.md`](./docs/rules/database_integrity.md), [`rest_api_conventions.md`](./docs/rules/rest_api_conventions.md), [`ui_ux_architecture.md`](./docs/rules/ui_ux_architecture.md) |
|
|
26
|
-
| **ADR-007** | Decoupling Project Bootstrapping from Domain Analysis | 2026-09-18 | ACCEPTED | [`lets-build`](./.agents/skills/lets-build/SKILL.md), [`product-analyst`](./.agents/skills/product-analyst/SKILL.md) |
|
|
27
|
-
| **ADR-008** | Non-Negotiable 5-Phase Agile Domain Lifecycle & Outside-In TDD | 2026-09-18 | ACCEPTED | [`test_driven_development.md`](./docs/rules/test_driven_development.md), [`test_isolation.md`](./docs/rules/test_isolation.md) |
|
|
28
|
-
| **ADR-009** | Many-to-Many Skill Composability & Orthogonal Pipelines | 2026-09-18 | ACCEPTED | [`agentic_configuration.md`](./docs/rules/agentic_configuration.md), [`agentic-architect`](./.agents/skills/agentic-architect/SKILL.md) |
|
|
29
|
-
| **ADR-011** | Canonical 6 Total Audit Fields Architecture & Modern React Stack | 2026-09-19 | ACCEPTED | [`database_integrity.md`](./docs/rules/database_integrity.md), [`react.md`](./docs/rules/react.md) |
|
|
30
|
-
| **ADR-012** | State Machine Lifecycle Configurability & Ubiquitous Language Contract | 2026-09-19 | ACCEPTED | [`workflow_state_machines.md`](./docs/rules/workflow_state_machines.md), [`domain_driven_design.md`](./docs/rules/domain_driven_design.md) |
|
|
31
|
-
| **ADR-013** | Design Architecture Triage, Persistent Shell & Dev Persona Isolation | 2026-09-20 | ACCEPTED | [`ui_ux_architecture.md`](./docs/rules/ui_ux_architecture.md), [`authentication.md`](./docs/rules/authentication.md) |
|
|
32
|
-
| **ADR-014** | Product Ownership, Prioritization Models, SMART Tasks & INVEST Slicing | 2026-09-21 | ACCEPTED | [`product_ownership.md`](./docs/rules/product_ownership.md), [`requirements_engineering.md`](./docs/rules/requirements_engineering.md), [`project_management.md`](./docs/rules/project_management.md) |
|
|
33
|
-
| **ADR-015** | Problem-First Architecture, Topology Scaffolding, Tipping Points & Nano-TDD | 2026-09-25 | ACCEPTED | [`clean_code.md`](./docs/rules/clean_code.md), [`domain_driven_design.md`](./docs/rules/domain_driven_design.md), [`test_driven_development.md`](./docs/rules/test_driven_development.md), [`lets-build`](./.agents/skills/lets-build/SKILL.md) |
|
|
34
|
-
| **ADR-016** | Elimination of Static Markdown Knowledge Graph | 2026-09-25 | ACCEPTED | [`clean_code.md`](./docs/rules/clean_code.md), [`continuous_learning.md`](./docs/rules/continuous_learning.md) |
|
|
35
|
-
| **ADR-017** | Progressive Rules Consolidation (DDD & GoF Patterns) | 2026-09-25 | ACCEPTED | [`domain_driven_design.md`](./docs/rules/domain_driven_design.md), [`design_patterns.md`](./docs/rules/design_patterns.md) |
|
|
36
|
-
| **ADR-018** | Elimination of Upstream Changes Ledger and Sync Tooling | 2026-09-25 | ACCEPTED | [`clean_code.md`](./docs/rules/clean_code.md), [`workspace_isolation.md`](./docs/rules/workspace_isolation.md) |
|
|
37
|
-
|
|
20
|
+
| *(No decisions recorded yet)* | *Record initial architecture decisions during Phase 3 of /lets-build.* | *YYYY-MM-DD* | *ACCEPTED* | *e.g. [`clean_code.md`](./docs/rules/clean_code.md)* |
|
|
38
21
|
|
|
39
22
|
---
|
|
40
23
|
|
|
41
24
|
### Lightweight Decision Summaries
|
|
42
25
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
- **
|
|
51
|
-
- **
|
|
52
|
-
- **
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
#### ADR-003: Dual-Layer Multi-Tenancy Isolation with PostgreSQL RLS
|
|
56
|
-
- **Date:** 2026-09-16 | **Status:** ACCEPTED
|
|
57
|
-
- **Context:** Application-level `where: { tenantId }` filtering is prone to human error, risking catastrophic cross-tenant data leaks.
|
|
58
|
-
- **Decision:** Combine application middleware context resolution with database-level PostgreSQL Row-Level Security (RLS) policies as an immutable backstop.
|
|
59
|
-
- **Enforced In:** [`multitenancy_isolation.md`](./docs/rules/multitenancy_isolation.md).
|
|
60
|
-
|
|
61
|
-
#### ADR-004: Systemic Atomicity & Pure Single-Responsibility Rule Decomposition
|
|
62
|
-
- **Date:** 2026-09-16 | **Status:** ACCEPTED
|
|
63
|
-
- **Context:** Composite rules with conjunction names (`this_and_that.md`) mix disparate technical concerns, creating documentation bloat and ambiguity.
|
|
64
|
-
- **Decision:** Decompose all rules into strictly atomic, single-topic rule files with zero conjunction names, enforcing Single Responsibility Principle across skills, rules, and database operations.
|
|
65
|
-
- **Enforced In:** Root [`AGENTS.md`](./AGENTS.md), [`agentic_configuration.md`](./docs/rules/agentic_configuration.md).
|
|
66
|
-
|
|
67
|
-
#### ADR-005: Universal Technology, Language, and Stack Agnosticism
|
|
68
|
-
- **Date:** 2026-09-18 | **Status:** ACCEPTED
|
|
69
|
-
- **Context:** Coupling architecture rules to a single programming language or database creates technical lock-in and prevents polyglot implementation.
|
|
70
|
-
- **Decision:** Adopt a Two-Tier Hexagonal / Ports-and-Adapters model across the entire system: Tier 1 mandates 100% technology-, language-, and stack-agnostic invariant domain capabilities and open standard specifications; Tier 2 encapsulates interchangeable polyglot adapters.
|
|
71
|
-
- **Enforced In:** Root [`AGENTS.md`](./AGENTS.md), [`clean_code.md`](./docs/rules/clean_code.md), [`lets-build`](./.agents/skills/lets-build/SKILL.md).
|
|
72
|
-
|
|
73
|
-
#### ADR-006: Mandatory Full Lifecycle CRUD & Relational Foreign Key Selector Pattern
|
|
74
|
-
- **Date:** 2026-09-18 | **Status:** ACCEPTED
|
|
75
|
-
- **Context:** Prototypes often provide partial CRUD, leaving entities un-editable or undeletable. Exposing foreign keys as raw text inputs causes severe relational errors.
|
|
76
|
-
- **Decision:** Every feature must implement complete lifecycle CRUD (Create, Read/Detail, Update/Transition, Delete/Archive) with 100.00% test coverage. Foreign keys must never be exposed as raw string inputs; they must be resolved via accessible relational dropdown selectors displaying contextual business metadata.
|
|
77
|
-
- **Enforced In:** [`database_integrity.md`](./docs/rules/database_integrity.md), [`rest_api_conventions.md`](./docs/rules/rest_api_conventions.md), [`ui_ux_architecture.md`](./docs/rules/ui_ux_architecture.md).
|
|
78
|
-
|
|
79
|
-
#### ADR-007: Strict Decoupling of Project Bootstrapping from Domain Analysis
|
|
80
|
-
- **Date:** 2026-09-18 | **Status:** ACCEPTED
|
|
81
|
-
- **Context:** Agents running `/lets-build` frequently fabricate domain entities on sheer assumptions during technical bootstrapping, skipping requirements discovery.
|
|
82
|
-
- **Decision:** Project bootstrapping terminates strictly after technical skeleton creation and health probe verification (`Phase 5`). A mandatory Handover Gate halts coding and directs the agent to initiate Domain Analysis via `product-analyst` and `relentless-questioner` before domain models or schemas are authored.
|
|
83
|
-
- **Enforced In:** [`lets-build`](./.agents/skills/lets-build/SKILL.md), [`product-analyst`](./.agents/skills/product-analyst/SKILL.md), [`requirements_engineering.md`](./docs/rules/requirements_engineering.md), [`domain_driven_design.md`](./docs/rules/domain_driven_design.md).
|
|
84
|
-
|
|
85
|
-
#### ADR-008: Non-Negotiable 5-Phase Agile Domain Lifecycle & Outside-In TDD Invariant
|
|
86
|
-
- **Date:** 2026-09-18 | **Status:** ACCEPTED
|
|
87
|
-
- **Context:** Writing production code before tests or domain understanding leads to brittle code, regressions, and "toy prototypes."
|
|
88
|
-
- **Decision:** Enforce an immutable 5-Phase Agile Domain Lifecycle across all tasks (Requirements ➔ Domain Analysis ➔ Outer Acceptance RED ➔ Inner Unit TDD RED-GREEN-REFACTOR ➔ Outer GREEN & DoD). Writing production code without a failing test is strictly prohibited.
|
|
89
|
-
- **Enforced In:** Root [`AGENTS.md`](./AGENTS.md), [`test_driven_development.md`](./docs/rules/test_driven_development.md), [`test_isolation.md`](./docs/rules/test_isolation.md).
|
|
90
|
-
|
|
91
|
-
#### ADR-009: Many-to-Many Skill Composability & Orthogonal Pipeline Architecture
|
|
92
|
-
- **Date:** 2026-09-18 | **Status:** ACCEPTED
|
|
93
|
-
- **Context:** Complex engineering tasks require multiple orthogonal skills; coupling skills into monolithic bundles causes context bloat and cross-contamination.
|
|
94
|
-
- **Decision:** Codify Many-to-Many skill composability via three formal patterns: Sequential Pipeline Chaining, Dynamic Skill Stacking, and Multi-Agent Subagent Delegation, with standardized output contracts, pure function semantics, and zero cross-contamination.
|
|
95
|
-
- **Enforced In:** [`agentic_configuration.md`](./docs/rules/agentic_configuration.md), [`agentic-architect`](./.agents/skills/agentic-architect/SKILL.md).
|
|
96
|
-
|
|
97
|
-
#### ADR-011: The Canonical 6 Total Audit Fields Architecture & Modern React Stack
|
|
98
|
-
- **Date:** 2026-09-19 | **Status:** ACCEPTED
|
|
99
|
-
- **Context:** Inconsistent audit tracking risks SOC 2 / ISO 27001 non-compliance. Frontend `useEffect` fetch loops cause stale states and race conditions.
|
|
100
|
-
- **Decision:** Every mutable stateful table must implement the Canonical 6 Total Audit Fields (`createdAt`, `createdBy`, `updatedAt`, `updatedBy`, `deletedAt`, `deletedBy`), with append-only ledgers omitting update/delete fields. Standardize frontend on TanStack Query, React Hook Form + Zod, and headless Radix primitives.
|
|
101
|
-
- **Enforced In:** [`database_integrity.md`](./docs/rules/database_integrity.md), [`react.md`](./docs/rules/react.md).
|
|
102
|
-
|
|
103
|
-
#### ADR-012: State Machine Lifecycle Configurability & Living Ubiquitous Language Contract
|
|
104
|
-
- **Date:** 2026-09-19 | **Status:** ACCEPTED
|
|
105
|
-
- **Context:** Unconstrained state configurability causes the "Inner Platform Effect." Linguistic drift between business terms and code identifiers breaks domain models.
|
|
106
|
-
- **Decision:** Bifurcate state into Core Invariant States (Hard FSM in compiled aggregate roots) and Operational Workflow Stages (Soft FSM in declarative JSON state transition matrices evaluated via CEL/Temporal). Maintain a living, single-name Ubiquitous Language Glossary contract.
|
|
107
|
-
- **Enforced In:** [`workflow_state_machines.md`](./docs/rules/workflow_state_machines.md), [`domain_driven_design.md`](./docs/rules/domain_driven_design.md), [`ubiquitous_language.md`](./docs/knowledge/ubiquitous_language.md).
|
|
108
|
-
|
|
109
|
-
#### ADR-013: Design Architecture Triage Framework, Persistent Shell & Dev Persona Isolation
|
|
110
|
-
- **Date:** 2026-09-20 | **Status:** ACCEPTED
|
|
111
|
-
- **Context:** Conflating developer demo personas with production auth creates toy-like prototypes. Untriaged UI produces layout shifts and broken navigation.
|
|
112
|
-
- **Decision:** Mandate the 7-Pillar Design Architecture Triage Gate before writing UI code; separate Enterprise Operator Workspace (`/`) from Consumer Portal (`/portal`); standardize on a persistent shell with 64px collapsible icon rail and bidirectional URL state sync; strictly isolate developer demo personas into a dev-only floating toolbar (`import.meta.env.DEV`).
|
|
113
|
-
- **Enforced In:** [`ui_ux_architecture.md`](./docs/rules/ui_ux_architecture.md), [`authentication.md`](./docs/rules/authentication.md), [`ui_navigation.md`](./docs/rules/ui_navigation.md).
|
|
114
|
-
|
|
115
|
-
#### ADR-014: Product Ownership, Backlog Prioritization Models, SMART Developer Tasks & INVEST Slicing
|
|
116
|
-
- **Date:** 2026-09-21 | **Status:** ACCEPTED
|
|
117
|
-
- **Context:** Teams frequently measure output (lines of code, story points) rather than outcome (customer value), leading to the "Feature Factory" anti-pattern.
|
|
118
|
-
- **Decision:** Ground backlog ordering in quantitative prioritization (Kano, MoSCoW, RICE) aligned with OKRs; decompose epics into vertically sliced INVEST user stories; decompose user stories into bounded SMART developer tasks (2–4 hours).
|
|
119
|
-
- **Enforced In:** [`product_ownership.md`](./docs/rules/product_ownership.md), [`requirements_engineering.md`](./docs/rules/requirements_engineering.md), [`project_management.md`](./docs/rules/project_management.md), [`product-analyst`](./.agents/skills/product-analyst/SKILL.md).
|
|
120
|
-
|
|
121
|
-
#### ADR-015: Problem-First Architecture, Topology Scaffolding, Evolutionary Tipping Points & Incremental Nano-Cycle TDD
|
|
122
|
-
- **Date:** 2026-09-25 | **Status:** ACCEPTED
|
|
123
|
-
- **Context:** Tool-first planning (asking for languages, databases, and microservices upfront) creates accidental complexity and forces non-backend projects (such as Chrome extensions, game engines, or CLIs) into heavy enterprise templates (as observed in `force-dark-light`). Furthermore, AI assistants naturally accelerate architectural drift by appending code without structural evolution, and fake TDD by batch-generating 15 tests and implementations at once.
|
|
124
|
-
- **Decision:**
|
|
125
|
-
1. Enforce **Problem-First Architecture**: Strictly separate Problem Space from Solution Space (Evans, Vernon, Brooks). Derive tools and runtimes from problem constraints (latency budget, GC tolerance, memory, execution target).
|
|
126
|
-
2. Implement **Topology-Aware Scaffolding**: Eliminate universal templates. Match architectural styles to system topologies (Platform Scripting for extensions, Data-Oriented Design for game engines, Command Pipeline for CLIs, Hexagonal for enterprise backends).
|
|
127
|
-
3. Codify **Evolutionary Architecture & Architectural Tipping Points**: Enforce Kent Beck's "Refactor-Before-Add" protocol and 5 explicit tipping points to halt AI-generated code rot.
|
|
128
|
-
4. Mandate **True Incremental TDD & Nano-Cycles**: Prohibit batch-test dumps ("Test-First Waterfall"); enforce Uncle Bob's Three Laws (especially Law #2) and Ping-Pong pair programming with verified RED failure proofs.
|
|
129
|
-
- **Enforced In:** [`AGENTS.md`](./AGENTS.md), [`clean_code.md`](./docs/rules/clean_code.md), [`domain_driven_design.md`](./docs/rules/domain_driven_design.md), [`test_driven_development.md`](./docs/rules/test_driven_development.md), [`lets-build`](./.agents/skills/lets-build/SKILL.md), [`architecture_interview_matrix.md`](./.agents/skills/lets-build/references/architecture_interview_matrix.md).
|
|
130
|
-
|
|
131
|
-
#### ADR-016: Elimination of Static Markdown Knowledge Graph in Favor of Code-as-Truth & Living Glossary
|
|
132
|
-
- **Date:** 2026-09-25 | **Status:** ACCEPTED
|
|
133
|
-
- **Context:** Template repositories often maintain static markdown files containing Mermaid diagrams, ERDs, and component topologies (`docs/knowledge/knowledge_graph.md`). In practice, these static artifacts suffer from rapid maintenance drift, violate the Problem-First mandate by pre-fabricating multi-tenant web backend models before the user defines their project, duplicate existing domain rules and memory records, and become stale tokens consumed on every context load.
|
|
134
|
-
- **Decision:** Permanently delete `docs/knowledge/knowledge_graph.md`. Treat executable code, strict type definitions, and versioned database migrations as the sole source of truth for architectural topologies. Retain `docs/knowledge/ubiquitous_language.md` as the lightweight, living domain vocabulary contract.
|
|
135
|
-
- **Enforced In:** [`AGENTS.md`](./AGENTS.md), [`clean_code.md`](./docs/rules/clean_code.md), [`continuous_learning.md`](./docs/rules/continuous_learning.md), [`memory.md`](./memory.md).
|
|
136
|
-
|
|
137
|
-
#### ADR-017: Progressive Rules Consolidation (DDD & GoF Design Patterns)
|
|
138
|
-
- **Date:** 2026-09-25 | **Status:** ACCEPTED
|
|
139
|
-
- **Context:** Multiple domain rules exhibited redundant overlaps: `domain_expertise.md` duplicated strategic capability mapping and tactical aggregate invariants already governed by `domain_driven_design.md`, while `gof_design_patterns_reference.md` artificially fragmented design patterns into a separate satellite file from `design_patterns.md`. This fragmentation caused token bloat in `AGENTS.md` and scattered domain invariants.
|
|
140
|
-
- **Decision:**
|
|
141
|
-
1. Merge business capability tiering (Core/Supporting/Generic) and the Aggregate Root Gatekeeper invariant example into [`domain_driven_design.md`](./docs/rules/domain_driven_design.md). Delete redundant `domain_expertise.md`.
|
|
142
|
-
2. Consolidate the 23 Gang of Four patterns catalog directly into [`design_patterns.md`](./docs/rules/design_patterns.md). Delete redundant `gof_design_patterns_reference.md`.
|
|
143
|
-
3. Streamline rule catalog across `AGENTS.md` and `README.md` to 45 lean, single-responsibility, non-overlapping rules.
|
|
144
|
-
- **Enforced In:** [`AGENTS.md`](./AGENTS.md), [`README.md`](./README.md), [`domain_driven_design.md`](./docs/rules/domain_driven_design.md), [`design_patterns.md`](./docs/rules/design_patterns.md).
|
|
145
|
-
|
|
146
|
-
#### ADR-018: Elimination of Upstream Changes Ledger and Upstream Sync Tooling
|
|
147
|
-
- **Date:** 2026-09-25 | **Status:** ACCEPTED
|
|
148
|
-
- **Context:** Maintaining a manual `changes.md` ledger duplicated state already captured across Git commit history and formal ADR records in `memory.md`. Furthermore, scaffolding `changes.md` into downstream derived projects contaminated them with meta-tooling baggage about the upstream template, violating Problem-First Architecture and Workspace Sovereignty. Accompanying CLI subcommands (`npx azcodr change`) and rule files (`upstream_synchronization.md`) added over 200 lines of accidental maintenance complexity.
|
|
149
|
-
- **Decision:**
|
|
150
|
-
1. Permanently delete `changes.md` and retire `docs/rules/upstream_synchronization.md`.
|
|
151
|
-
2. Remove `changes.md` from scaffolded `TEMPLATE_ITEMS` and package manifests.
|
|
152
|
-
3. Purge `logChange` functions, types, and CLI subcommands, restoring `azcodr` CLI as a clean, single-purpose project bootstrapper.
|
|
153
|
-
4. Standardize exclusively on Git commits for historical revision logs and `memory.md` for architectural decision records.
|
|
154
|
-
- **Enforced In:** [`AGENTS.md`](./AGENTS.md), [`README.md`](./README.md), [`lib/scaffold.js`](./lib/scaffold.js), [`bin/azcodr.js`](./bin/azcodr.js), [`memory.md`](./memory.md).
|
|
155
|
-
|
|
26
|
+
<!--
|
|
27
|
+
Record project Architectural Decision Records (ADRs) below as decisions are finalized.
|
|
28
|
+
Format:
|
|
29
|
+
|
|
30
|
+
#### ADR-001: [Imperative Title]
|
|
31
|
+
- **Date:** YYYY-MM-DD | **Status:** ACCEPTED
|
|
32
|
+
- **Context:** Problem space, constraints, and operational context requiring a decision.
|
|
33
|
+
- **Decision:** Chosen architecture, invariants, and implementation patterns.
|
|
34
|
+
- **Consequences:** Positive benefits and deliberate trade-offs accepted.
|
|
35
|
+
- **Enforced In:** Relevant rule files in docs/rules/ or code paths.
|
|
36
|
+
-->
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azcodr",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Enterprise Architecture & Agentic Engineering Starter Template",
|
|
5
5
|
"bin": {
|
|
6
6
|
"azcodr": "bin/azcodr.js"
|
|
@@ -54,6 +54,6 @@
|
|
|
54
54
|
"test:coverage": "node scripts/test_coverage.js",
|
|
55
55
|
"lint": "node --check bin/azcodr.js lib/index.js lib/scaffold.js tests/cli.test.js tests/scaffold.test.js scripts/test_coverage.js",
|
|
56
56
|
"validate": "bash .agents/skills/agentic-architect/scripts/validate_agentic_configs.sh",
|
|
57
|
-
"prepublishOnly": "npm run test:coverage && npm run validate"
|
|
57
|
+
"prepublishOnly": "npm run lint && npm run test:coverage && npm run validate"
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# Accessibility (A11y) & WCAG 2.2 Standards
|
|
2
|
-
|
|
3
|
-
> **Core Mandate:** Enforce WCAG 2.2 Level AA compliance, accessible Radix UI primitives, keyboard focus management, visible focus rings, and ARIA live regions across all user interfaces.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. Accessible UI Primitives & Radix UI
|
|
8
|
-
|
|
9
|
-
- **Prohibited Native Alerts**: Strictly prohibit browser-native `window.confirm()` or `window.alert()`. Use accessible Radix UI dialogs (`@radix-ui/react-dialog`, `@radix-ui/react-alert-dialog`).
|
|
10
|
-
- **Focus Management & Trapping**:
|
|
11
|
-
- Modal dialogs must trap keyboard focus within the dialog container while open.
|
|
12
|
-
- Closing a dialog must return keyboard focus deterministically to the triggering element.
|
|
13
|
-
- **Visible Focus Indicators**: Never remove default outline rings (`outline: none`) without providing an explicit, high-contrast replacement (`focus-visible:ring-2 focus-visible:ring-offset-2`).
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## 2. Form & Feedback Accessibility
|
|
18
|
-
|
|
19
|
-
- **Form Input Wiring**:
|
|
20
|
-
- Every form input must have an associated `<label>` using `htmlFor` or nested wrapping.
|
|
21
|
-
- Validation errors must be programmatically linked to their inputs via `aria-invalid="true"` and `aria-describedby="<error-message-id>"`.
|
|
22
|
-
- **Dynamic Content & Status Feedback (ARIA Live Regions)**:
|
|
23
|
-
- Asynchronous notifications, toast alerts, and status updates must use `role="status"` or `aria-live="polite"` so screen readers announce changes without interrupting the user.
|
|
24
|
-
- Critical error alerts must use `role="alert"` or `aria-live="assertive"`.
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## 3. Visual & Contrast Baselines
|
|
29
|
-
|
|
30
|
-
- **Color Contrast**: Maintain a minimum contrast ratio of 4.5:1 for normal text and 3:1 for large text / UI controls against their background.
|
|
31
|
-
- **Semantic Landmark Markup**: Use semantic landmark elements (`<main>`, `<nav>`, `<aside>`, `<header>`, `<footer>`, `<section>`) rather than unsemantic `<div>` structures.
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
# Advanced REST API Patterns & Capability Architecture
|
|
2
|
-
|
|
3
|
-
> **Core Mandate:** Enrich API responses with capability metadata (Allowed Actions), ensure safe mutations via idempotency keys, enforce cursor pagination, and prevent race conditions with optimistic concurrency.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. Allowed Actions & Capability Metadata (HATEOAS-Lite)
|
|
8
|
-
|
|
9
|
-
Clients must not duplicate server-side business and authorization rules to decide whether an action (edit, delete, approve, cancel) is permitted. **The server is the authoritative source of truth.**
|
|
10
|
-
|
|
11
|
-
### Pattern: `_actions` and `_links` Envelope
|
|
12
|
-
Every resource response must embed an `_actions` boolean map and optional `_links` hypermedia block indicating what the requesting caller is permitted to do based on their role, tenant boundaries, and the entity's current state:
|
|
13
|
-
|
|
14
|
-
```json
|
|
15
|
-
{
|
|
16
|
-
"id": "ord_9876",
|
|
17
|
-
"status": "SHIPPED",
|
|
18
|
-
"totalAmount": 149.99,
|
|
19
|
-
"currency": "USD",
|
|
20
|
-
"_actions": {
|
|
21
|
-
"canEdit": false,
|
|
22
|
-
"canCancel": false,
|
|
23
|
-
"canTrack": true,
|
|
24
|
-
"canRequestRefund": true
|
|
25
|
-
},
|
|
26
|
-
"_links": {
|
|
27
|
-
"self": { "href": "/api/v1/orders/ord_9876", "method": "GET" },
|
|
28
|
-
"track": { "href": "/api/v1/orders/ord_9876/tracking", "method": "GET" },
|
|
29
|
-
"refund": { "href": "/api/v1/orders/ord_9876/refunds", "method": "POST" }
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### UI Benefits
|
|
35
|
-
- Frontend buttons and menus simply bind to `resource._actions.canDelete`.
|
|
36
|
-
- When business logic evolves (e.g. orders over $1,000 require manager approval), only the backend logic changes—zero frontend redeployment required.
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
## 2. Safe Mutations via Idempotency Keys (IETF Draft)
|
|
41
|
-
|
|
42
|
-
To prevent duplicate processing (double charging, duplicate resource creation) caused by network retries:
|
|
43
|
-
|
|
44
|
-
### Protocol
|
|
45
|
-
- Clients generating mutating requests (`POST`, `PATCH`) must supply a unique `Idempotency-Key: <uuid-v4>` header.
|
|
46
|
-
- **Server Lifecycle**:
|
|
47
|
-
1. Check distributed idempotency store for key `idemp:<tenantId>:<idempotencyKey>`.
|
|
48
|
-
2. If found with status `IN_FLIGHT`: return `409 Conflict` (`IDEMPOTENT_OPERATION_IN_PROGRESS`).
|
|
49
|
-
3. If found with status `COMPLETED`: return the cached status code, headers, and response payload without re-executing.
|
|
50
|
-
4. If not found: Acquire distributed lock, process mutation atomically, cache response with a 24-hour TTL, and release lock.
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
## 3. High-Scale Keyset / Cursor-Based Pagination
|
|
55
|
-
|
|
56
|
-
Never use offset pagination (`OFFSET 10000 LIMIT 20`) on large tables. Offsets degrade linearly (`O(N)`) and suffer from page-drift anomalies.
|
|
57
|
-
|
|
58
|
-
### Specification
|
|
59
|
-
- Query Parameters: `?cursor=<opaque_base64>&limit=20` (default limit 20, max 100).
|
|
60
|
-
- Response Envelope:
|
|
61
|
-
```json
|
|
62
|
-
{
|
|
63
|
-
"data": [...],
|
|
64
|
-
"pagination": {
|
|
65
|
-
"nextCursor": "ZXlKaWRI...==",
|
|
66
|
-
"hasMore": true,
|
|
67
|
-
"limit": 20
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
- **Agnostic Keyset Query Pattern**:
|
|
72
|
-
```sql
|
|
73
|
-
SELECT * FROM orders
|
|
74
|
-
WHERE tenant_id = :tenantId
|
|
75
|
-
AND (created_at, id) < (:cursorCreatedAt, :cursorId)
|
|
76
|
-
ORDER BY created_at DESC, id DESC
|
|
77
|
-
LIMIT :limit + 1;
|
|
78
|
-
```
|
|
79
|
-
If `results.length > limit`, slice the extra item and encode its cursor token for `nextCursor`.
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## 4. Optimistic Concurrency Control (OCC)
|
|
84
|
-
|
|
85
|
-
Prevent lost-update anomalies during concurrent edits without pessimistic database row locking:
|
|
86
|
-
|
|
87
|
-
### Protocol
|
|
88
|
-
- Every mutable entity contains an incrementing integer `version` column.
|
|
89
|
-
- Server returns the current version in the `ETag` response header: `ETag: W/"v4"`.
|
|
90
|
-
- Clients submitting updates (`PUT`, `PATCH`) must include `If-Match: W/"v4"`.
|
|
91
|
-
- **Conflict Handling**:
|
|
92
|
-
- Atomic update: `UPDATE table SET ..., version = version + 1 WHERE id = :id AND version = :expectedVersion`.
|
|
93
|
-
- If 0 rows updated: Return **`409 Conflict`** with error code `CONCURRENCY_CONFLICT` and the latest entity representation.
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
## 5. Asynchronous Processing (`202 Accepted`)
|
|
98
|
-
|
|
99
|
-
For tasks taking > 1.5 seconds (video rendering, large PDF export, batch imports):
|
|
100
|
-
- Do NOT block synchronous client requests.
|
|
101
|
-
- Dispatch task to an asynchronous worker queue or workflow engine.
|
|
102
|
-
- Return **`202 Accepted`** immediately with:
|
|
103
|
-
- Header: `Location: /api/v1/tasks/:taskId`
|
|
104
|
-
- Body: `{ "taskId": "tsk_123", "status": "QUEUED", "pollIntervalMs": 2000 }`
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
# API Versioning, SemVer Lifecycle & Swagger Multi-Version Architecture
|
|
2
|
-
|
|
3
|
-
> **Core Mandate:** Enforce URI path major versioning (`/api/v1/`), SemVer 2.0.0 contract specifications, RFC 8594 Sunset/Deprecation headers, a 90-day retirement window, and multi-version Swagger UI exploration.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. Semantic Versioning (SemVer 2.0.0) in Web APIs
|
|
8
|
-
|
|
9
|
-
Semantic Versioning maps to Web APIs according to contract stability and backward compatibility:
|
|
10
|
-
|
|
11
|
-
$$\text{Version Format: } \mathbf{MAJOR.MINOR.PATCH}$$
|
|
12
|
-
|
|
13
|
-
| SemVer Component | Scope & Impact | Exposure Channel | Example |
|
|
14
|
-
|---|---|---|---|
|
|
15
|
-
| **MAJOR** | Breaking, backwards-incompatible contract modifications. Requires client code/URL changes. | URI Path (`/api/v1/`, `/api/v2/`) & OpenAPI `info.version` | `2.0.0` |
|
|
16
|
-
| **MINOR** | Backwards-compatible additive functionality, new endpoints, or optional attributes. | OpenAPI `info.version`, `API-Version` response header | `1.1.0` |
|
|
17
|
-
| **PATCH** | Backwards-compatible bug fixes, performance optimizations, and documentation fixes. | OpenAPI `info.version`, release tags, telemetry metadata | `1.0.1` |
|
|
18
|
-
|
|
19
|
-
> [!IMPORTANT]
|
|
20
|
-
> **Why URI Path Exposes MAJOR Only:**
|
|
21
|
-
> Exposing minor or patch versions in the URL path (e.g. `/api/v1.2.3/`) is a severe anti-pattern. Minor additions and bug fixes must not break client routing. Clients bind to the stable major version (`/api/v1/`) while consuming backward-compatible updates transparently.
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## 2. SemVer Trigger Matrix: What Triggers a Version Update?
|
|
26
|
-
|
|
27
|
-
### A. MAJOR Bump (`1.x.x` ➔ `2.0.0`) — Breaking Changes
|
|
28
|
-
A MAJOR version bump and a new URI prefix (`/api/v2/`) are triggered whenever existing clients would fail without code modifications:
|
|
29
|
-
|
|
30
|
-
1. **Endpoint Alterations:**
|
|
31
|
-
- Deleting an existing endpoint or HTTP method.
|
|
32
|
-
- Renaming an existing URL path or subresource route.
|
|
33
|
-
2. **Request Contract Breaking Changes:**
|
|
34
|
-
- Removing an existing request parameter (header, query, or body field).
|
|
35
|
-
- Renaming a request field.
|
|
36
|
-
- Changing the data type or format of a request field (e.g., string integer to number, date format change).
|
|
37
|
-
- Adding a new **mandatory / required** field to an existing request payload without a default value.
|
|
38
|
-
- Tightening input validation constraints (e.g., reducing max string length, narrowing allowed enum values).
|
|
39
|
-
3. **Response Contract Breaking Changes:**
|
|
40
|
-
- Removing an existing field from a response payload.
|
|
41
|
-
- Changing the data type or structure of a response field (e.g., object converted to array, integer cents converted to float string).
|
|
42
|
-
- Changing the semantic business meaning of a field.
|
|
43
|
-
4. **Behavioral & Protocol Breaking Changes:**
|
|
44
|
-
- Altering the standard HTTP status code for successful execution (e.g., changing `200 OK` to `204 No Content` or `201 Created`).
|
|
45
|
-
- Changing the error envelope schema away from RFC 7807 problem details.
|
|
46
|
-
- Changing authentication or authorization requirements (e.g. requiring a new OAuth scope or mTLS).
|
|
47
|
-
|
|
48
|
-
### B. MINOR Bump (`1.0.x` ➔ `1.1.0`) — Additive, Backward-Compatible
|
|
49
|
-
A MINOR version bump preserves the `/api/v1/` URI path and updates the contract specification:
|
|
50
|
-
|
|
51
|
-
1. Adding completely new endpoints or resources (e.g., adding `POST /api/v1/documents/:id/signatures`).
|
|
52
|
-
2. Adding new optional query parameters, headers, or request body fields.
|
|
53
|
-
3. Adding new fields to response payloads (clients must follow Postel's Law / Tolerant Reader pattern).
|
|
54
|
-
4. Adding new enum values to input requests if the service handles them gracefully without breaking old clients.
|
|
55
|
-
5. Relaxing validation constraints (e.g., increasing maximum allowed file upload size or string length).
|
|
56
|
-
6. Introducing deprecation notices on endpoints (via RFC 8594 headers) while maintaining functionality.
|
|
57
|
-
|
|
58
|
-
### C. PATCH Bump (`1.0.0` ➔ `1.0.1`) — Bug Fixes & Non-Contractual Changes
|
|
59
|
-
A PATCH version bump preserves contract schemas and updates release metadata:
|
|
60
|
-
|
|
61
|
-
1. Internal bug fixes in domain logic that do not alter the contractual request/response schema or status codes.
|
|
62
|
-
2. Performance enhancements, caching optimization, and database indexing.
|
|
63
|
-
3. Security patches in dependencies and runtime frameworks.
|
|
64
|
-
4. Clarifications, typo corrections, and formatting updates in OpenAPI descriptions.
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
## 3. RFC 8594 Sunset & Deprecation Lifecycle
|
|
69
|
-
|
|
70
|
-
When an older major version or endpoint is scheduled for retirement, inject standardized RFC 8594 headers:
|
|
71
|
-
|
|
72
|
-
```http
|
|
73
|
-
Deprecation: @1773619200
|
|
74
|
-
Sunset: Wed, 16 Sep 2026 23:59:59 GMT
|
|
75
|
-
Link: <https://api.domain.com/docs/migration/v2>; rel="sunset"
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
- **Mandatory 90-Day Migration Window:** Retain deprecated API versions for a minimum of 90 days following formal deprecation notification before decommissioning.
|
|
79
|
-
- **Access Telemetry:** Track consumer traffic on deprecated routes via OpenTelemetry attributes (`api.deprecated=true`, `http.route`) to coordinate client migration.
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## 4. Swagger UI Multi-Version Selector Architecture
|
|
84
|
-
|
|
85
|
-
Swagger UI must provide an interactive version dropdown selector enabling consumers and developers to inspect both active and upcoming API specifications.
|
|
86
|
-
|
|
87
|
-
### Multi-Spec Configuration in Express / Swagger UI:
|
|
88
|
-
```ts
|
|
89
|
-
app.use(
|
|
90
|
-
'/docs',
|
|
91
|
-
swaggerUi.serve,
|
|
92
|
-
swaggerUi.setup(undefined, {
|
|
93
|
-
swaggerOptions: {
|
|
94
|
-
urls: [
|
|
95
|
-
{ url: '/specs/v1/openapi.yaml', name: 'v1.0.0 (Current Stable)' },
|
|
96
|
-
{ url: '/specs/v2/openapi.yaml', name: 'v2.0.0-draft (Next Major Preview)' }
|
|
97
|
-
],
|
|
98
|
-
'urls.primaryName': 'v1.0.0 (Current Stable)'
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
);
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### Filesystem Specification Hierarchy:
|
|
105
|
-
```
|
|
106
|
-
specs/
|
|
107
|
-
├── openapi/
|
|
108
|
-
│ ├── v1/
|
|
109
|
-
│ │ └── openapi.yaml
|
|
110
|
-
│ └── v2/
|
|
111
|
-
│ └── openapi.yaml
|
|
112
|
-
```
|
|
113
|
-
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# Application Security & OWASP Top 10 Defenses
|
|
2
|
-
|
|
3
|
-
> **Core Mandate:** Enforce proactive defenses against the OWASP Top 10 vulnerabilities, cryptographic rigor, and token-bucket rate limiting across all layers.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. OWASP Top 10 Defenses
|
|
8
|
-
|
|
9
|
-
- **A01: Broken Access Control**: Verify permissions server-side on every request using Policy Enforcement Points (PEPs). Enforce immutable multi-tenancy data isolation (AST interceptors, database RLS, or schema namespaces).
|
|
10
|
-
- **A02: Cryptographic Failures**: Passwords must be hashed using **Argon2id** with memory-hard parameters. Encrypt sensitive data at rest using authenticated ciphers (**AES-256-GCM** or **ChaCha20-Poly1305**).
|
|
11
|
-
- **A03: Injection (SQL / NoSQL / Command)**: Strictly prohibit raw query string interpolation or dynamic execution. All database interactions must use parameterized prepared statements.
|
|
12
|
-
- **A07: Identification and Authentication Failures**: Enforce rate limiting on auth endpoints, FIDO2/WebAuthn passkeys, and Refresh Token Rotation (RTR) with family invalidation on replay detection.
|
|
13
|
-
- **A10: Server-Side Request Forgery (SSRF)**: Validate and restrict outbound network requests to an explicit allowlist of domains. Block requests targeting RFC 1918 private IP ranges, loopback addresses (`127.0.0.1`), and cloud metadata endpoints (`169.254.169.254`).
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## 2. Distributed API Rate Limiting
|
|
18
|
-
|
|
19
|
-
- Utilize token-bucket or sliding-window rate limiters backed by a distributed in-memory cache port.
|
|
20
|
-
- Enforce tiered rate limits:
|
|
21
|
-
- Authentication routes: Max 5 requests / minute per IP.
|
|
22
|
-
- Standard API routes: Max 100 requests / minute per tenant/user.
|
|
23
|
-
- Return **`429 Too Many Requests`** with standard `Retry-After` and `RateLimit-*` IETF headers when limits are exceeded.
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# Architecture Decision Records (ADR)
|
|
2
|
-
|
|
3
|
-
> **Core Mandate:** Log all technical, architectural, and operational trade-offs in `memory.md` using the standardized Lightweight ADR format.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. When to Author an ADR
|
|
8
|
-
|
|
9
|
-
An Architectural Decision Record must be authored whenever a team member or agent:
|
|
10
|
-
- Introduces or removes an external dependency or library.
|
|
11
|
-
- Modifies database schema architecture, transaction boundaries, or migration strategies.
|
|
12
|
-
- Selects an architectural pattern (e.g. Server-Driven UI, Event-Driven Outbox, OpenFeature).
|
|
13
|
-
- Defines security boundaries, cryptographic standards, or compliance exceptions.
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## 2. Lightweight ADR Format
|
|
18
|
-
|
|
19
|
-
Log decisions in `memory.md` adhering to this structure:
|
|
20
|
-
|
|
21
|
-
```markdown
|
|
22
|
-
### ADR-[Number]: [Concise Title]
|
|
23
|
-
|
|
24
|
-
- **Date:** [YYYY-MM-DD]
|
|
25
|
-
- **Status:** [PROPOSED | ACCEPTED | SUPERSEDED]
|
|
26
|
-
|
|
27
|
-
#### 1. Context & Problem Statement
|
|
28
|
-
What business requirement, technical bottleneck, or security mandate necessitated this architectural decision?
|
|
29
|
-
|
|
30
|
-
#### 2. Decision Drivers
|
|
31
|
-
- [Driver 1: e.g. Zero-downtime database deployment]
|
|
32
|
-
- [Driver 2: e.g. SOC 2 Type II tamper-evident logging compliance]
|
|
33
|
-
|
|
34
|
-
#### 3. Considered Options
|
|
35
|
-
- **Option A:** [Description and evaluation]
|
|
36
|
-
- **Option B:** [Description and evaluation]
|
|
37
|
-
|
|
38
|
-
#### 4. Decision Outcome & Consequences
|
|
39
|
-
- **Chosen Option:** [Selected approach and core rationale]
|
|
40
|
-
- **Positive Consequences:** [What improves]
|
|
41
|
-
- **Negative Consequences / Trade-offs:** [What operational or code overhead is accepted]
|
|
42
|
-
```
|
package/docs/rules/compliance.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# Regulatory Compliance: SOC 2, ISO 27001 & GDPR
|
|
2
|
-
|
|
3
|
-
> **Core Mandate:** Enforce SOC 2 Type II Trust Services Criteria, ISO/IEC 27001 ISMS technical controls, and GDPR data subject privacy rights using open-source architectures.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. SOC 2 Type II Trust Services Criteria
|
|
8
|
-
|
|
9
|
-
- **Access Controls (CC6.1)**: Enforce least-privilege RBAC/ABAC on all API endpoints. System-defined roles must be protected from unauthorized mutation.
|
|
10
|
-
- **Tamper-Evident Audit Trails (CC7.2)**:
|
|
11
|
-
- All state mutations must create write-only, immutable audit log records:
|
|
12
|
-
`{ timestamp, actorId, tenantId, action, entityType, entityId, ipAddress, userAgent, changes: { before, after } }`.
|
|
13
|
-
- Audit logs must be retained for at least 365 days in append-only storage.
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## 2. ISO/IEC 27001 ISMS Technical Controls
|
|
18
|
-
|
|
19
|
-
- **Annex A Cryptographic Controls (A.10.1)**: Enforce TLS 1.3 for data in transit and AES-256-GCM for sensitive data at rest. Passwords must be hashed using Argon2id or bcrypt.
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## 3. GDPR Data Subject Rights
|
|
24
|
-
|
|
25
|
-
- **Right to Erasure (Article 17)**: Deleting a tenant or user must cascade delete or pseudonymize all associated personal identifiable information (PII) across active databases and backups.
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# Container Infrastructure & Local Parity
|
|
2
|
-
|
|
3
|
-
> **Core Mandate:** Enforce production parity through containerized reverse proxy routing, explicit OCI service healthchecks, non-root security boundaries, and minimal distroless base images.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. Gateway Routing & Local Parity
|
|
8
|
-
|
|
9
|
-
- **Unified Gateway Routing**: Route all local development and production services through an edge reverse proxy gateway (such as **Envoy** or **Nginx**) on standard HTTP ports to eliminate CORS discrepancies and simulate production multi-service topologies uniformly.
|
|
10
|
-
- **Internal Network Isolation**: Isolate internal services and datastores on a private bridge or overlay network, exposing only the hardened gateway entrypoint to public interfaces.
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## 2. OCI Healthchecks & Deterministic Dependency Ordering
|
|
15
|
-
|
|
16
|
-
- **Explicit Service Healthchecks**: Every database, cache, message broker, and application service in container configurations (`docker-compose.yml` or Kubernetes manifests) must define an explicit healthcheck command and interval.
|
|
17
|
-
- **Strict Dependency Ordering**: Dependent application services must wait for upstream database and cache readiness, never launching before health verification:
|
|
18
|
-
```yaml
|
|
19
|
-
depends_on:
|
|
20
|
-
database:
|
|
21
|
-
condition: service_healthy
|
|
22
|
-
cache:
|
|
23
|
-
condition: service_healthy
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## 3. Container Security & Build Performance
|
|
29
|
-
|
|
30
|
-
- **Non-Root Execution**: Run all application containers strictly as unprivileged users (UID >= 10001) with read-only root filesystems and dropped Linux capabilities (`cap_drop: ALL`).
|
|
31
|
-
- **Minimal OCI Base Images**: Standardize on **Distroless** (Google Container Tools) or **Scratch** base images across all polyglot microservices, eliminating package managers, debug shells, and OS vulnerabilities.
|
|
32
|
-
- **Multi-Stage Build Optimization**: Utilize multi-stage OCI builds with cache mounts across dependency steps to minimize image sizes and maximize layer cache reuse.
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Continuous Deployment (CD) & Release Engineering
|
|
2
|
-
|
|
3
|
-
> **Core Mandate:** Enforce zero-downtime deployment rollouts, cryptographic container signing with Cosign, and minimal attack surface container baselines.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. Zero-Downtime Deployment Strategies
|
|
8
|
-
|
|
9
|
-
- **Blue-Green / Rolling Deployments**: Deploy new application versions alongside active instances, verify readiness healthchecks, and shift traffic seamlessly without dropping connections.
|
|
10
|
-
- **Rollback Automation**: If error rates or latency spike beyond thresholds immediately post-deployment, automate an instant rollback to the previous stable release.
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## 2. Container Signing & Provenance (Cosign)
|
|
15
|
-
|
|
16
|
-
- Utilize open-source **Cosign** (Sigstore) to cryptographically sign all release container images in the deployment pipeline.
|
|
17
|
-
- Production Kubernetes / Docker hosts must verify Cosign image signatures and provenance attestations before pulling and launching containers.
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## 3. Container Minimization
|
|
22
|
-
|
|
23
|
-
- Standardize on minimal container base images (`node:24-alpine` or distroless images).
|
|
24
|
-
- Purge all devDependencies, compilers, and package managers from the final production container layer.
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# Continuous Integration (CI) & Quality Gates
|
|
2
|
-
|
|
3
|
-
> **Core Mandate:** Enforce shift-left automated quality gates, trunk-based development with short-lived branches, and mandatory green pipeline verification before merge.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. Shift-Left Automated Quality Gates
|
|
8
|
-
|
|
9
|
-
Every pull request pipeline must execute automated checks in strict dependency stages:
|
|
10
|
-
1. **Security & Secrets**: Open-source secret scanning (`secretlint`) and SAST analysis (`semgrep`).
|
|
11
|
-
2. **Static Analysis**: ESLint (`npm run lint`) and TypeScript typecheck (`npm run typecheck`).
|
|
12
|
-
3. **Full-Stack Test Coverage**: Unit and acceptance tests verifying **100.00%** coverage (`npm run coverage`).
|
|
13
|
-
4. **Supply Chain Audit**: Vulnerability scan of dependencies and SBOM generation (`syft` + `grype`).
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## 2. Trunk-Based Development
|
|
18
|
-
|
|
19
|
-
- **Short-Lived Branches**: Feature branches must live less than 24–48 hours before merging to the main trunk.
|
|
20
|
-
- **Fast Build Times**: Docker build layers and npm packages must be cached in CI runners to maintain pipeline execution times under 5 minutes.
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# Continuous Learning & Automated Rule Ingestion
|
|
2
|
-
|
|
3
|
-
> **Core Mandate:** Automatically capture development defects, analyze root causes, and directly update domain rules or skills to permanently prevent recurrence without intermediate bloat.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. The Direct Rule Ingestion Loop
|
|
8
|
-
|
|
9
|
-
Whenever an error, test failure, build friction, or architectural anti-pattern occurs during development, immediately execute the 4-step loop:
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
1. Capture Defect ──► 2. Root Cause Analysis ──► 3. Synthesize Invariant ──► 4. Update Rule / Skill
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
1. **Capture Defect**: Record the failure symptoms, stack trace, and failing test case.
|
|
16
|
-
2. **Root Cause Analysis**: Identify the fundamental architectural or operational gap (not just the surface symptom).
|
|
17
|
-
3. **Synthesize Invariant**: Formulate a concrete, positive architectural invariant and code example showing the correct implementation.
|
|
18
|
-
4. **Update Rule / Skill**:
|
|
19
|
-
- Update the governing domain rule in `docs/rules/<domain>.md` or specialized skill in `.agents/skills/` directly.
|
|
20
|
-
- If the lesson introduces an architectural trade-off or paradigm shift, record a lightweight ADR in [`memory.md`](../../memory.md).
|
|
21
|
-
- If it unlocks a new domain, author a new atomic rule file and index it in [`AGENTS.md`](../../AGENTS.md).
|
|
22
|
-
- Run verification (`npm test && npm run validate`) to ensure 100% integrity.
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## 2. Institutional Memory Maintenance
|
|
27
|
-
|
|
28
|
-
- **Lightweight ADR Ledger**: Major technical decisions and invariant shifts are logged in [`memory.md`](../../memory.md) linking directly to the governing rule or skill.
|
|
29
|
-
- **Living Glossary**: Keep [`docs/knowledge/ubiquitous_language.md`](../knowledge/ubiquitous_language.md) updated with canonical domain terminology and forbidden synonyms.
|