azcodr 1.5.2 → 2.0.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.
Files changed (93) hide show
  1. package/.agents/hooks.json +42 -42
  2. package/.agents/hooks.json.example +42 -42
  3. package/.agents/mcp_config.json.example +29 -29
  4. package/.agents/scripts/safety_guard.sh +143 -34
  5. package/.agents/scripts/verify_completion.sh +90 -27
  6. package/.agents/skills/agentic-architect/SKILL.md +125 -125
  7. package/.agents/skills/agentic-architect/references/agents_md_template.md +62 -62
  8. package/.agents/skills/agentic-architect/references/refinement_workflow.md +32 -32
  9. package/.agents/skills/agentic-architect/references/skill_architecture_inquiry.md +63 -63
  10. package/.agents/skills/agentic-architect/references/skill_template.md +56 -56
  11. package/.agents/skills/agentic-architect/scripts/validate_agentic_configs.sh +402 -402
  12. package/.agents/skills/clean-code-refactor/SKILL.md +91 -91
  13. package/.agents/skills/clean-code-refactor/references/clean_code_smells.md +27 -27
  14. package/.agents/skills/clean-code-refactor/references/design_patterns_ts.md +65 -65
  15. package/.agents/skills/compliance-audit/SKILL.md +120 -120
  16. package/.agents/skills/compliance-audit/references/owasp_top10_controls.md +16 -16
  17. package/.agents/skills/compliance-audit/references/soc2_iso_controls.md +28 -28
  18. package/.agents/skills/lets-build/SKILL.md +173 -173
  19. package/.agents/skills/lets-build/references/architecture_interview_matrix.md +115 -115
  20. package/.agents/skills/lets-build/references/hexagonal_bootstrap_scaffolds.md +160 -160
  21. package/.agents/skills/lets-build/references/project_readme_template.md +79 -79
  22. package/.agents/skills/lets-build/scripts/bootstrap_workspace.sh +419 -255
  23. package/.agents/skills/product-analyst/SKILL.md +154 -154
  24. package/.agents/skills/product-analyst/references/backlog_ordering_techniques.md +107 -107
  25. package/.agents/skills/product-analyst/references/gherkin_patterns.md +46 -46
  26. package/.agents/skills/product-analyst/references/invest_checklist.md +38 -38
  27. package/.agents/skills/product-analyst/references/okr_alignment_guide.md +76 -76
  28. package/.agents/skills/product-analyst/references/smart_tasks.md +59 -59
  29. package/.agents/skills/relentless-questioner/SKILL.md +128 -128
  30. package/.agents/skills/relentless-questioner/references/adaptive_question_trees.md +102 -102
  31. package/.editorconfig +19 -19
  32. package/.github/workflows/ci.yml +167 -78
  33. package/.github/workflows/publish.yml +200 -0
  34. package/.gitignore +40 -25
  35. package/AGENTS.md +103 -102
  36. package/LICENSE +21 -21
  37. package/README.md +168 -165
  38. package/bin/azcodr.js +14 -228
  39. package/docs/knowledge/ubiquitous_language.md +31 -18
  40. package/docs/rules/agentic_configuration.md +259 -259
  41. package/docs/rules/api_architecture.md +179 -179
  42. package/docs/rules/authentication.md +76 -76
  43. package/docs/rules/authorization.md +75 -75
  44. package/docs/rules/caching.md +69 -69
  45. package/docs/rules/clean_code.md +62 -62
  46. package/docs/rules/cloud_native.md +41 -41
  47. package/docs/rules/cqrs.md +203 -203
  48. package/docs/rules/database_design.md +125 -125
  49. package/docs/rules/database_operations.md +69 -69
  50. package/docs/rules/design_patterns.md +98 -98
  51. package/docs/rules/devops_ci_cd.md +76 -76
  52. package/docs/rules/domain_driven_design.md +122 -122
  53. package/docs/rules/error_handling.md +54 -52
  54. package/docs/rules/feature_flags.md +59 -59
  55. package/docs/rules/frontend_architecture.md +157 -157
  56. package/docs/rules/multitenancy_architecture.md +98 -98
  57. package/docs/rules/product_ownership.md +127 -127
  58. package/docs/rules/project_management.md +49 -49
  59. package/docs/rules/relentless_questioning.md +52 -52
  60. package/docs/rules/requirements_engineering.md +98 -98
  61. package/docs/rules/security_compliance.md +53 -53
  62. package/docs/rules/server_driven_ui.md +88 -88
  63. package/docs/rules/test_driven_development.md +185 -185
  64. package/docs/rules/transactional_email.md +27 -27
  65. package/docs/rules/type_safety.md +65 -65
  66. package/docs/rules/ui_ux_architecture.md +150 -150
  67. package/docs/rules/workflow_state_machines.md +117 -117
  68. package/lib/cli-parse.js +51 -0
  69. package/lib/cli-target.js +109 -0
  70. package/lib/cli.js +180 -0
  71. package/lib/errors.js +28 -0
  72. package/lib/git.js +29 -0
  73. package/lib/guards.js +96 -0
  74. package/lib/index.d.ts +199 -134
  75. package/lib/index.js +5 -5
  76. package/lib/links.js +123 -0
  77. package/lib/permissions.js +44 -0
  78. package/lib/repo.js +90 -0
  79. package/lib/scaffold.js +238 -448
  80. package/memory.md +119 -36
  81. package/package.json +65 -62
  82. package/scripts/test_coverage.js +66 -38
  83. package/scripts/validate/adr.js +151 -0
  84. package/scripts/validate/io.js +84 -0
  85. package/scripts/validate/links.js +167 -0
  86. package/scripts/validate/parity.js +124 -0
  87. package/scripts/validate/root.js +184 -0
  88. package/scripts/validate/rules.js +44 -0
  89. package/scripts/validate/skills.js +96 -0
  90. package/scripts/validate/text.js +29 -0
  91. package/scripts/validate-cli.js +13 -0
  92. package/scripts/validate.js +140 -258
  93. package/.github/copilot-instructions.md +0 -1
@@ -1,115 +1,115 @@
1
- # Problem-First Architecture Interview Matrix
2
-
3
- > **Core Philosophy:** Software architecture must be derived from problem constraints, domain invariants, and execution targets—never from preemptive tool selection. Tools, runtimes, and databases are emergent outputs of the Problem Space.
4
-
5
- ---
6
-
7
- ## Tier 1: Problem Space Definition & System Topology
8
-
9
- ### Dimension 1: The Core Problem & Domain Essence
10
- - **Problem Statement:** What real-world problem or capability does this system address? What data moves, and what transformations occur?
11
- - **Domain Invariants:** What core business, legal, mathematical, or physical rules must never be violated?
12
- - **Domain Subdivisions:** Identify subdomains:
13
- - *Core Subdomain:* The unique differentiator (e.g. proprietary physics simulation, smart filter inversion, bidding algorithm).
14
- - *Supporting Subdomain:* Necessary domain-specific capabilities (e.g. user preferences, level editor).
15
- - *Generic Subdomain:* Solved industry utilities (e.g. authentication, logging).
16
-
17
- ### Dimension 2: System Topology Classification
18
- Classify the system into its primary operational topology:
19
- 1. **Topology A — Web SaaS / Cloud Applications:** Network-facing systems with multi-tenant data persistence, ranging from Fullstack Web Applications (API Backend + Web Frontend) to Headless Microservices (API-only).
20
- 2. **Topology B — Browser Extension:** Client-side sandboxed extension (Chrome/Firefox MV3) orchestrating content scripts, background service workers, and popup UI.
21
- 3. **Topology C — Game Engine / High-Performance Simulator:** Low-level, frame-budgeted application directly interfacing with GPU APIs (Vulkan, DirectX, Metal) and system memory.
22
- 4. **Topology D — Browser / Canvas Game:** Sandboxed web game running inside the browser DOM/Canvas via Canvas2D, WebGL, or WebGPU.
23
- 5. **Topology E — Desktop Application / CLI Utility:** Standalone OS binary (POSIX/Windows) executed locally via terminal arguments or native desktop UI.
24
- 6. **Topology F — Systems / Embedded / Cryptographic Library:** Headless shared library or crate compiled for specific hardware targets or WASM runtimes.
25
-
26
- ---
27
-
28
- ## Tier 2: Physical & Operational Constraints
29
-
30
- ### Dimension 3: Latency & Time Budgets
31
- - **Hard Real-Time:** Frame budget enforced (e.g. 16.6ms for 60 FPS, 6.94ms for 144 FPS). Any jitter causes dropped frames.
32
- - **Interactive Low-Latency:** Sub-10ms response for user inputs (e.g. keystrokes in a code editor, real-time audio DSP).
33
- - **Service Request-Response:** Soft latency (e.g. p99 < 200ms for web APIs; p95 < 50ms for internal RPC).
34
- - **Asynchronous / Batch:** Throughput-optimized batch or event stream processing (seconds to minutes).
35
-
36
- ### Dimension 4: Memory Management & Garbage Collection Tolerance
37
- - **Zero GC Pause Tolerance:** Latency spikes or unpredictable GC pauses are unacceptable. Demands deterministic, manual, or compile-time memory management (C, C++, Rust, Zig).
38
- - **High-Throughput Managed GC:** GC pauses (< 10ms) are completely imperceptible within network I/O latency. Managed runtimes maximize developer velocity (Go, Java 21+ with Loom, C# .NET 9).
39
- - **Single-Threaded Event Loop:** JavaScript / TypeScript runtime in browser sandbox or Node/Bun.
40
-
41
- ### Dimension 5: Concurrency & Execution Topology
42
- - **Single-Threaded Cooperative:** Event loop with non-blocking async I/O (browser JS, Node.js).
43
- - **Multi-Threaded Work-Stealing:** Parallel pipelines across CPU cores (physics, rendering, audio) requiring data-race safety.
44
- - **Data-Parallel / SIMD:** Vectorized computation over contiguous arrays or GPU compute shaders.
45
- - **Distributed Shared-Nothing:** Clustered actor nodes or horizontal stateless containers.
46
-
47
- ### Dimension 6: Persistence & Connectivity Demands
48
- - **Zero Persistence:** In-memory state only (e.g. real-time canvas game, transient CLI filter).
49
- - **Local Embedded / Flat Storage:** Local binary files, JSON configuration, or embedded SQLite.
50
- - **Client-Side Platform Storage:** Browser `chrome.storage.local` / `sync`, `localStorage`, or IndexedDB.
51
- - **Enterprise Relational / Document RDBMS:** PostgreSQL, MySQL, MongoDB, CockroachDB with ACID transactions.
52
- - **Network Interface:** Pure local IPC/pipes (zero network), WebSockets, UDP packets, or HTTP/REST/gRPC.
53
-
54
- ---
55
-
56
- ## Tier 3: Architectural Style Derivation (Topology Alignment)
57
-
58
- Match the architectural style strictly to the system topology:
59
-
60
- | Topology | Mandatory Architectural Style | Rationale | Anti-Pattern to Ban |
61
- |---|---|---|---|
62
- | **Web SaaS / Backend** | **Hexagonal (Ports & Adapters) / Clean** | Decouples business rules from databases, HTTP frameworks, and external APIs. | Fat controllers with inline SQL; leaky abstractions. |
63
- | **Browser Extension** | **Platform Scripting Architecture** | Direct, lean coordination of `background`, `content`, `popup`, and browser storage APIs. | Forcing Hexagonal ports, use-case classes, or `/healthz` probes. |
64
- | **Game Engine** | **Data-Oriented Design (DOD / ECS)** | Cache-friendly contiguous memory layout (dense component arrays) for SIMD vectorization. | Deep OOP inheritance hierarchies; GC-managed wrappers. |
65
- | **Canvas Game** | **Game Loop Architecture** | Structured `Input ➔ Update ➔ Render` loop driven by `requestAnimationFrame`. | Enterprise repository and layered CRUD ceremony. |
66
- | **Desktop CLI** | **Command Pipeline Architecture** | Streamlined `Arg Parser ➔ Command Handler ➔ Stream I/O`. | Embedding REST servers, microservices, or Docker containers. |
67
-
68
- ---
69
-
70
- ## Tier 4: Emergent Toolchain & Language Derivation
71
-
72
- Derive the programming language, runtime, and package manager strictly from the constraints established above:
73
-
74
- | Language Profile | Optimal Fit | Primary Trade-Off |
75
- |---|---|---|
76
- | **C (C99 / C11)** | Game engines, embedded systems, OS kernels. | Raw pointer control, instant compile times; manual memory management. |
77
- | **Rust** | Game engines, code editors, CLI tools, systems services. | Zero GC, compile-time memory safety, fearless concurrency; steeper learning curve, slower builds. |
78
- | **TypeScript / JS** | Browser extensions, canvas games, web frontends, fullstack apps. | Instant browser compatibility, rich UI ecosystem; single-threaded event loop, runtime typing. |
79
- | **Go** | Cloud microservices, CLI tools, network proxies. | Fast startup, simple concurrency (goroutines); basic GC, limited generics. |
80
- | **Java 21+ / C# (.NET 9)** | Enterprise transaction platforms, high-throughput microservices. | Massive enterprise ecosystem, virtual threads; higher memory footprint. |
81
- | **Python** | Data analysis, ML pipelines, quick automation scripts. | Expressive syntax, unmatched ML libraries; slower execution, GIL constraints. |
82
-
83
- ---
84
-
85
- ## Tier 5: Targeted Invariants (Strictly Topology-Scoped, 100% YAGNI)
86
-
87
- Inquire *only* into the dimensions relevant to the selected topology. **Never ask non-backend projects about databases, containers, or API versioning!**
88
-
89
- ### For Web SaaS & Enterprise Cloud Applications ONLY:
90
- - **Application Interface Scope:** Headless API service (no UI) vs Fullstack Web Application (API Backend + Web Frontend Client).
91
- - **Frontend UI Stack (If Fullstack Web Application):**
92
- - **Framework & Runtime:** React + Vite, Vue 3, Svelte 5, Next.js.
93
- - **Component Primitives & Styling:** Tailwind CSS + Accessible Headless Primitives (Radix UI / shadcn/ui) per [docs/rules/frontend_architecture.md](../../../../docs/rules/frontend_architecture.md).
94
- - **Client Structure:** Paired Client (`client/` + `src/` backend) vs Monorepo (`apps/web` + `apps/api`).
95
- - **Design Triage & App Shell:** Persistent App Shell (collapsible sidebar, global header) vs Dynamic Canvas per [docs/rules/ui_ux_architecture.md](../../../../docs/rules/ui_ux_architecture.md).
96
- - **API Protocols:** REST (OpenAPI 3.1) vs gRPC (Protobuf v3 via Buf) vs GraphQL.
97
- - **Database Migrations:** Declarative (Atlas) vs Versioned SQL (Flyway, Goose).
98
- - **Multi-Tenancy Isolation:** AST Query Interceptor vs Database RLS vs Schema-per-tenant.
99
- - **Authentication & AuthZ:** OIDC, OAuth 2.1, PASETO, OPA Rego, or OpenFGA ReBAC.
100
- - **Container Infrastructure:** Minimal Distroless/Scratch OCI containers and Docker Compose.
101
-
102
- ### For Browser Extensions ONLY:
103
- - **Manifest Version:** Chrome/Firefox Manifest V3.
104
- - **Script Isolation & Bundling:** Self-contained IIFE for content scripts (zero external ES module chunk imports).
105
- - **State Synchronization:** `chrome.storage.sync` with local fallback and unidirectional event application.
106
- - **Permissions:** Principle of least privilege for `manifest.json`.
107
-
108
- ### For Game Engines & High-Performance Simulators ONLY:
109
- - **Graphics Backend:** Native Vulkan, DirectX 12, Metal, or portable `wgpu`.
110
- - **Memory Allocation Strategy:** Linear allocators, frame allocators, arena allocators, or pool allocators.
111
- - **Entity Model:** Archetype ECS (e.g. `bevy_ecs`, `hecs`, `EnTT`) vs dense component arrays.
112
-
113
- ### For Desktop CLIs ONLY:
114
- - **CLI Framework:** Zero-dependency argument parser vs battle-tested CLI library (e.g. `clap` for Rust, `cobra` for Go).
115
- - **I/O Protocols:** Standard POSIX streams (`stdin`, `stdout`, `stderr`), exit codes (0 for success, non-zero for error), JSON output flags (`--json`).
1
+ # Problem-First Architecture Interview Matrix
2
+
3
+ > **Core Philosophy:** Software architecture must be derived from problem constraints, domain invariants, and execution targets—never from preemptive tool selection. Tools, runtimes, and databases are emergent outputs of the Problem Space.
4
+
5
+ ---
6
+
7
+ ## Tier 1: Problem Space Definition & System Topology
8
+
9
+ ### Dimension 1: The Core Problem & Domain Essence
10
+ - **Problem Statement:** What real-world problem or capability does this system address? What data moves, and what transformations occur?
11
+ - **Domain Invariants:** What core business, legal, mathematical, or physical rules must never be violated?
12
+ - **Domain Subdivisions:** Identify subdomains:
13
+ - *Core Subdomain:* The unique differentiator (e.g. proprietary physics simulation, smart filter inversion, bidding algorithm).
14
+ - *Supporting Subdomain:* Necessary domain-specific capabilities (e.g. user preferences, level editor).
15
+ - *Generic Subdomain:* Solved industry utilities (e.g. authentication, logging).
16
+
17
+ ### Dimension 2: System Topology Classification
18
+ Classify the system into its primary operational topology:
19
+ 1. **Topology A — Web SaaS / Cloud Applications:** Network-facing systems with multi-tenant data persistence, ranging from Fullstack Web Applications (API Backend + Web Frontend) to Headless Microservices (API-only).
20
+ 2. **Topology B — Browser Extension:** Client-side sandboxed extension (Chrome/Firefox MV3) orchestrating content scripts, background service workers, and popup UI.
21
+ 3. **Topology C — Game Engine / High-Performance Simulator:** Low-level, frame-budgeted application directly interfacing with GPU APIs (Vulkan, DirectX, Metal) and system memory.
22
+ 4. **Topology D — Browser / Canvas Game:** Sandboxed web game running inside the browser DOM/Canvas via Canvas2D, WebGL, or WebGPU.
23
+ 5. **Topology E — Desktop Application / CLI Utility:** Standalone OS binary (POSIX/Windows) executed locally via terminal arguments or native desktop UI.
24
+ 6. **Topology F — Systems / Embedded / Cryptographic Library:** Headless shared library or crate compiled for specific hardware targets or WASM runtimes.
25
+
26
+ ---
27
+
28
+ ## Tier 2: Physical & Operational Constraints
29
+
30
+ ### Dimension 3: Latency & Time Budgets
31
+ - **Hard Real-Time:** Frame budget enforced (e.g. 16.6ms for 60 FPS, 6.94ms for 144 FPS). Any jitter causes dropped frames.
32
+ - **Interactive Low-Latency:** Sub-10ms response for user inputs (e.g. keystrokes in a code editor, real-time audio DSP).
33
+ - **Service Request-Response:** Soft latency (e.g. p99 < 200ms for web APIs; p95 < 50ms for internal RPC).
34
+ - **Asynchronous / Batch:** Throughput-optimized batch or event stream processing (seconds to minutes).
35
+
36
+ ### Dimension 4: Memory Management & Garbage Collection Tolerance
37
+ - **Zero GC Pause Tolerance:** Latency spikes or unpredictable GC pauses are unacceptable. Demands deterministic, manual, or compile-time memory management (C, C++, Rust, Zig).
38
+ - **High-Throughput Managed GC:** GC pauses (< 10ms) are completely imperceptible within network I/O latency. Managed runtimes maximize developer velocity (Go, Java 21+ with Loom, C# .NET 9).
39
+ - **Single-Threaded Event Loop:** JavaScript / TypeScript runtime in browser sandbox or Node/Bun.
40
+
41
+ ### Dimension 5: Concurrency & Execution Topology
42
+ - **Single-Threaded Cooperative:** Event loop with non-blocking async I/O (browser JS, Node.js).
43
+ - **Multi-Threaded Work-Stealing:** Parallel pipelines across CPU cores (physics, rendering, audio) requiring data-race safety.
44
+ - **Data-Parallel / SIMD:** Vectorized computation over contiguous arrays or GPU compute shaders.
45
+ - **Distributed Shared-Nothing:** Clustered actor nodes or horizontal stateless containers.
46
+
47
+ ### Dimension 6: Persistence & Connectivity Demands
48
+ - **Zero Persistence:** In-memory state only (e.g. real-time canvas game, transient CLI filter).
49
+ - **Local Embedded / Flat Storage:** Local binary files, JSON configuration, or embedded SQLite.
50
+ - **Client-Side Platform Storage:** Browser `chrome.storage.local` / `sync`, `localStorage`, or IndexedDB.
51
+ - **Enterprise Relational / Document RDBMS:** PostgreSQL, MySQL, MongoDB, CockroachDB with ACID transactions.
52
+ - **Network Interface:** Pure local IPC/pipes (zero network), WebSockets, UDP packets, or HTTP/REST/gRPC.
53
+
54
+ ---
55
+
56
+ ## Tier 3: Architectural Style Derivation (Topology Alignment)
57
+
58
+ Match the architectural style strictly to the system topology:
59
+
60
+ | Topology | Mandatory Architectural Style | Rationale | Anti-Pattern to Ban |
61
+ |---|---|---|---|
62
+ | **Web SaaS / Backend** | **Hexagonal (Ports & Adapters) / Clean** | Decouples business rules from databases, HTTP frameworks, and external APIs. | Fat controllers with inline SQL; leaky abstractions. |
63
+ | **Browser Extension** | **Platform Scripting Architecture** | Direct, lean coordination of `background`, `content`, `popup`, and browser storage APIs. | Forcing Hexagonal ports, use-case classes, or `/healthz` probes. |
64
+ | **Game Engine** | **Data-Oriented Design (DOD / ECS)** | Cache-friendly contiguous memory layout (dense component arrays) for SIMD vectorization. | Deep OOP inheritance hierarchies; GC-managed wrappers. |
65
+ | **Canvas Game** | **Game Loop Architecture** | Structured `Input ➔ Update ➔ Render` loop driven by `requestAnimationFrame`. | Enterprise repository and layered CRUD ceremony. |
66
+ | **Desktop CLI** | **Command Pipeline Architecture** | Streamlined `Arg Parser ➔ Command Handler ➔ Stream I/O`. | Embedding REST servers, microservices, or Docker containers. |
67
+
68
+ ---
69
+
70
+ ## Tier 4: Emergent Toolchain & Language Derivation
71
+
72
+ Derive the programming language, runtime, and package manager strictly from the constraints established above:
73
+
74
+ | Language Profile | Optimal Fit | Primary Trade-Off |
75
+ |---|---|---|
76
+ | **C (C99 / C11)** | Game engines, embedded systems, OS kernels. | Raw pointer control, instant compile times; manual memory management. |
77
+ | **Rust** | Game engines, code editors, CLI tools, systems services. | Zero GC, compile-time memory safety, fearless concurrency; steeper learning curve, slower builds. |
78
+ | **TypeScript / JS** | Browser extensions, canvas games, web frontends, fullstack apps. | Instant browser compatibility, rich UI ecosystem; single-threaded event loop, runtime typing. |
79
+ | **Go** | Cloud microservices, CLI tools, network proxies. | Fast startup, simple concurrency (goroutines); basic GC, limited generics. |
80
+ | **Java 21+ / C# (.NET 9)** | Enterprise transaction platforms, high-throughput microservices. | Massive enterprise ecosystem, virtual threads; higher memory footprint. |
81
+ | **Python** | Data analysis, ML pipelines, quick automation scripts. | Expressive syntax, unmatched ML libraries; slower execution, GIL constraints. |
82
+
83
+ ---
84
+
85
+ ## Tier 5: Targeted Invariants (Strictly Topology-Scoped, 100% YAGNI)
86
+
87
+ Inquire *only* into the dimensions relevant to the selected topology. **Never ask non-backend projects about databases, containers, or API versioning!**
88
+
89
+ ### For Web SaaS & Enterprise Cloud Applications ONLY:
90
+ - **Application Interface Scope:** Headless API service (no UI) vs Fullstack Web Application (API Backend + Web Frontend Client).
91
+ - **Frontend UI Stack (If Fullstack Web Application):**
92
+ - **Framework & Runtime:** React + Vite, Vue 3, Svelte 5, Next.js.
93
+ - **Component Primitives & Styling:** Tailwind CSS + Accessible Headless Primitives (Radix UI / shadcn/ui) per [docs/rules/frontend_architecture.md](../../../../docs/rules/frontend_architecture.md).
94
+ - **Client Structure:** Paired Client (`client/` + `src/` backend) vs Monorepo (`apps/web` + `apps/api`).
95
+ - **Design Triage & App Shell:** Persistent App Shell (collapsible sidebar, global header) vs Dynamic Canvas per [docs/rules/ui_ux_architecture.md](../../../../docs/rules/ui_ux_architecture.md).
96
+ - **API Protocols:** REST (OpenAPI 3.1) vs gRPC (Protobuf v3 via Buf) vs GraphQL.
97
+ - **Database Migrations:** Declarative (Atlas) vs Versioned SQL (Flyway, Goose).
98
+ - **Multi-Tenancy Isolation:** AST Query Interceptor vs Database RLS vs Schema-per-tenant.
99
+ - **Authentication & AuthZ:** OIDC, OAuth 2.1, PASETO, OPA Rego, or OpenFGA ReBAC.
100
+ - **Container Infrastructure:** Minimal Distroless/Scratch OCI containers and Docker Compose.
101
+
102
+ ### For Browser Extensions ONLY:
103
+ - **Manifest Version:** Chrome/Firefox Manifest V3.
104
+ - **Script Isolation & Bundling:** Self-contained IIFE for content scripts (zero external ES module chunk imports).
105
+ - **State Synchronization:** `chrome.storage.sync` with local fallback and unidirectional event application.
106
+ - **Permissions:** Principle of least privilege for `manifest.json`.
107
+
108
+ ### For Game Engines & High-Performance Simulators ONLY:
109
+ - **Graphics Backend:** Native Vulkan, DirectX 12, Metal, or portable `wgpu`.
110
+ - **Memory Allocation Strategy:** Linear allocators, frame allocators, arena allocators, or pool allocators.
111
+ - **Entity Model:** Archetype ECS (e.g. `bevy_ecs`, `hecs`, `EnTT`) vs dense component arrays.
112
+
113
+ ### For Desktop CLIs ONLY:
114
+ - **CLI Framework:** Zero-dependency argument parser vs battle-tested CLI library (e.g. `clap` for Rust, `cobra` for Go).
115
+ - **I/O Protocols:** Standard POSIX streams (`stdin`, `stdout`, `stderr`), exit codes (0 for success, non-zero for error), JSON output flags (`--json`).
@@ -1,160 +1,160 @@
1
- # Hexagonal Bootstrap Scaffolds & Templates
2
-
3
- > **Core Purpose:** Standardized directory trees and foundational templates for bootstrapping projects across any language following the Hexagonal (Ports & Adapters) architecture.
4
-
5
- ---
6
-
7
- ## 1. Universal Directory Topology
8
-
9
- Depending on whether the project target is a **Fullstack Web SaaS** (Frontend + Backend) or a **Headless Service** (API only), projects follow these standard layouts:
10
-
11
- ### Fullstack Web SaaS Topology (Web Frontend + Hexagonal Backend)
12
- ```
13
- <project-root>/
14
- ├── .agents/skills/ # Specialized agentic workflows (carried from azcodr template)
15
- ├── docs/
16
- │ ├── knowledge/ # Domain knowledge & living ubiquitous language glossary
17
- │ └── rules/ # 28 cohesive single-responsibility domain rules
18
- ├── specs/ # Canonical contract specifications
19
- │ ├── openapi/ # OpenAPI 3.1 REST specifications (*.yaml)
20
- │ ├── schemas/ # Universal JSON Schema Draft 2020-12 (*.json)
21
- │ └── tokens/ # W3C DTCG Design Tokens (tokens.json)
22
- ├── client/ # Web Frontend Application (Vite + React / SPA)
23
- │ ├── src/
24
- │ │ ├── components/
25
- │ │ │ ├── layout/ # Persistent Shell (Sidebar, Header, Breadcrumbs)
26
- │ │ │ └── ui/ # Accessible Headless Primitives (Radix / shadcn)
27
- │ │ ├── pages/ # Dynamic Canvas Route Views
28
- │ │ ├── hooks/ # Server-State Cache & URL State Synchronization
29
- │ │ └── services/ # Inbound API Client Adapters
30
- │ └── public/ # Static web assets
31
- ├── src/ # Backend Application (Hexagonal Architecture)
32
- │ ├── domain/ # Core Invariant Domain (Entities, Value Objects, Invariants)
33
- │ ├── ports/ # Primary (driving) and Secondary (driven) Ports
34
- │ │ ├── primary/ # Inbound Use Cases, Commands, and Queries
35
- │ │ └── secondary/ # Outbound Repositories, Caches, Event Brokers
36
- │ └── adapters/ # Concrete Polyglot Implementations
37
- │ ├── primary/ # HTTP controllers, gRPC handlers, CLI commands
38
- │ └── secondary/ # SQL/NoSQL repositories, Redis caches, Kafka brokers
39
- ├── tests/
40
- │ ├── unit/ # Fast unit tests using test doubles
41
- │ ├── integration/ # Adapter integration tests with transactional rollback
42
- │ ├── contracts/ # Pact / OpenAPI contract verification
43
- │ ├── client/ # Frontend component and interaction tests
44
- │ └── acceptance/ # BDD Gherkin / Cucumber end-to-end features
45
- ├── deploy/ # Deployment & Infrastructure as Code
46
- │ ├── docker/ # Minimal OCI Distroless/Scratch Dockerfiles
47
- │ ├── compose/ # Docker Compose multi-service topologies
48
- │ └── k8s/ # Kubernetes manifests or OpenTofu / Crossplane
49
- ├── AGENTS.md # Authoritative lean root directives (< 120 lines)
50
- ├── CLAUDE.md -> AGENTS.md # Symlink for harness parity
51
- ├── agents.md -> AGENTS.md # Symlink for harness parity
52
- ├── memory.md # Master memory hub & Lightweight ADR ledger
53
- └── README.md # Project documentation
54
- ```
55
-
56
- ### Headless Service Topology (Backend API Only)
57
- ```
58
- <project-root>/
59
- ├── .agents/skills/ # Specialized agentic workflows
60
- ├── docs/ # Domain knowledge & 28 domain rules
61
- ├── specs/ # OpenAPI 3.1 & Schema contracts
62
- ├── src/ # Domain, Ports, Adapters
63
- ├── tests/ # Unit, Integration, Contracts, Acceptance
64
- ├── deploy/ # Docker, Compose
65
- ├── AGENTS.md
66
- └── memory.md
67
- ```
68
-
69
- ---
70
-
71
- ## 2. Language-Specific Source Layouts
72
-
73
- ### TypeScript Fullstack Scaffold (`client/` + `src/` via `package.json` / `pnpm`)
74
- ```
75
- client/ # Web Frontend (Vite + React / Vue / Svelte)
76
- ├── src/
77
- │ ├── components/
78
- │ │ ├── layout/ # Persistent App Shell (Header, Collapsible Sidebar)
79
- │ │ └── ui/ # Accessible Headless Primitives (Radix / shadcn)
80
- │ ├── pages/ # Dynamic Canvas Route Views
81
- │ ├── hooks/ # Server-State Cache & URL State Synchronization
82
- │ └── services/ # Inbound API Client Adapters
83
- └── public/
84
- src/ # Core Backend (Hexagonal Ports & Adapters)
85
- ├── domain/
86
- │ ├── entities/user.ts
87
- │ └── value-objects/tenant-id.ts
88
- ├── ports/
89
- │ ├── primary/create-user.usecase.ts
90
- │ └── secondary/user-repository.port.ts
91
- └── adapters/
92
- ├── primary/fastify-router.ts
93
- └── secondary/kysely-user-repository.ts
94
- ```
95
-
96
- ### Go Scaffold (`go.mod`)
97
- ```
98
- src/
99
- ├── domain/
100
- │ ├── entity/user.go
101
- │ └── valueobject/tenant_id.go
102
- ├── ports/
103
- │ ├── in/create_user_usecase.go
104
- │ └── out/user_repository_port.go
105
- └── adapters/
106
- ├── in/http/user_handler.go
107
- └── out/sql/pgx_user_repository.go
108
- ```
109
-
110
- ### Rust Scaffold (`Cargo.toml`)
111
- ```
112
- src/
113
- ├── domain/
114
- │ ├── entities/user.rs
115
- │ └── value_objects/tenant_id.rs
116
- ├── ports/
117
- │ ├── primary/create_user.rs
118
- │ └── secondary/user_repository.rs
119
- └── adapters/
120
- ├── primary/axum_handler.rs
121
- └── secondary/sqlx_repository.rs
122
- ```
123
-
124
- ### Python Scaffold (`pyproject.toml` / `uv`)
125
- ```
126
- src/
127
- ├── domain/
128
- │ ├── entities/user.py
129
- │ └── value_objects/tenant_id.py
130
- ├── ports/
131
- │ ├── primary/create_user_usecase.py
132
- │ └── secondary/user_repository_port.py
133
- └── adapters/
134
- ├── primary/fastapi_router.py
135
- └── secondary/asyncpg_repository.py
136
- ```
137
-
138
- ### TypeScript Backend-Only Scaffold (`package.json` / `pnpm`)
139
- ```
140
- src/
141
- ├── domain/
142
- │ ├── entities/user.ts
143
- │ └── value-objects/tenant-id.ts
144
- ├── ports/
145
- │ ├── primary/create-user.usecase.ts
146
- │ └── secondary/user-repository.port.ts
147
- └── adapters/
148
- ├── primary/fastify-router.ts
149
- └── secondary/kysely-user-repository.ts
150
- ```
151
-
152
- ---
153
-
154
- ## 3. Foundational Scaffold Invariants
155
-
156
- 1. **Domain Isolation**: Code in `src/domain/` must have **zero imports** from `src/adapters/`, `client/`, external web frameworks, or database drivers.
157
- 2. **Ports as Pure Contracts**: Code in `src/ports/` contains abstract interfaces, Command DTOs, Query DTOs, and Result containers.
158
- 3. **Adapters Depend on Ports**: `src/adapters/` implements ports defined in `src/ports/`. Adapters never depend directly on other adapters.
159
- 4. **Contract-First Synchronization**: Whenever an API or event interface changes, the canonical contract in `specs/` must be updated and validated before adapter code is generated or modified.
160
- 5. **Frontend Decoupling via Contract**: The frontend in `client/` consumes backend driving ports strictly via canonical OpenAPI contracts (`specs/openapi`) and W3C Design Tokens (`specs/tokens/tokens.json`). It follows the 7-Pillar Design Architecture Triage Gate ([docs/rules/ui_ux_architecture.md](../../../../docs/rules/ui_ux_architecture.md)) and accessible headless primitives ([docs/rules/frontend_architecture.md](../../../../docs/rules/frontend_architecture.md)).
1
+ # Hexagonal Bootstrap Scaffolds & Templates
2
+
3
+ > **Core Purpose:** Standardized directory trees and foundational templates for bootstrapping projects across any language following the Hexagonal (Ports & Adapters) architecture.
4
+
5
+ ---
6
+
7
+ ## 1. Universal Directory Topology
8
+
9
+ Depending on whether the project target is a **Fullstack Web SaaS** (Frontend + Backend) or a **Headless Service** (API only), projects follow these standard layouts:
10
+
11
+ ### Fullstack Web SaaS Topology (Web Frontend + Hexagonal Backend)
12
+ ```
13
+ <project-root>/
14
+ ├── .agents/skills/ # Specialized agentic workflows (carried from azcodr template)
15
+ ├── docs/
16
+ │ ├── knowledge/ # Domain knowledge & living ubiquitous language glossary
17
+ │ └── rules/ # 28 cohesive single-responsibility domain rules
18
+ ├── specs/ # Canonical contract specifications
19
+ │ ├── openapi/ # OpenAPI 3.1 REST specifications (*.yaml)
20
+ │ ├── schemas/ # Universal JSON Schema Draft 2020-12 (*.json)
21
+ │ └── tokens/ # W3C DTCG Design Tokens (tokens.json)
22
+ ├── client/ # Web Frontend Application (Vite + React / SPA)
23
+ │ ├── src/
24
+ │ │ ├── components/
25
+ │ │ │ ├── layout/ # Persistent Shell (Sidebar, Header, Breadcrumbs)
26
+ │ │ │ └── ui/ # Accessible Headless Primitives (Radix / shadcn)
27
+ │ │ ├── pages/ # Dynamic Canvas Route Views
28
+ │ │ ├── hooks/ # Server-State Cache & URL State Synchronization
29
+ │ │ └── services/ # Inbound API Client Adapters
30
+ │ └── public/ # Static web assets
31
+ ├── src/ # Backend Application (Hexagonal Architecture)
32
+ │ ├── domain/ # Core Invariant Domain (Entities, Value Objects, Invariants)
33
+ │ ├── ports/ # Primary (driving) and Secondary (driven) Ports
34
+ │ │ ├── primary/ # Inbound Use Cases, Commands, and Queries
35
+ │ │ └── secondary/ # Outbound Repositories, Caches, Event Brokers
36
+ │ └── adapters/ # Concrete Polyglot Implementations
37
+ │ ├── primary/ # HTTP controllers, gRPC handlers, CLI commands
38
+ │ └── secondary/ # SQL/NoSQL repositories, Redis caches, Kafka brokers
39
+ ├── tests/
40
+ │ ├── unit/ # Fast unit tests using test doubles
41
+ │ ├── integration/ # Adapter integration tests with transactional rollback
42
+ │ ├── contracts/ # Pact / OpenAPI contract verification
43
+ │ ├── client/ # Frontend component and interaction tests
44
+ │ └── acceptance/ # BDD Gherkin / Cucumber end-to-end features
45
+ ├── deploy/ # Deployment & Infrastructure as Code
46
+ │ ├── docker/ # Minimal OCI Distroless/Scratch Dockerfiles
47
+ │ ├── compose/ # Docker Compose multi-service topologies
48
+ │ └── k8s/ # Kubernetes manifests or OpenTofu / Crossplane
49
+ ├── AGENTS.md # Authoritative lean root directives (< 120 lines)
50
+ ├── CLAUDE.md -> AGENTS.md # Symlink for harness parity
51
+ ├── agents.md -> AGENTS.md # Symlink for harness parity
52
+ ├── memory.md # Master memory hub & Lightweight ADR ledger
53
+ └── README.md # Project documentation
54
+ ```
55
+
56
+ ### Headless Service Topology (Backend API Only)
57
+ ```
58
+ <project-root>/
59
+ ├── .agents/skills/ # Specialized agentic workflows
60
+ ├── docs/ # Domain knowledge & 28 domain rules
61
+ ├── specs/ # OpenAPI 3.1 & Schema contracts
62
+ ├── src/ # Domain, Ports, Adapters
63
+ ├── tests/ # Unit, Integration, Contracts, Acceptance
64
+ ├── deploy/ # Docker, Compose
65
+ ├── AGENTS.md
66
+ └── memory.md
67
+ ```
68
+
69
+ ---
70
+
71
+ ## 2. Language-Specific Source Layouts
72
+
73
+ ### TypeScript Fullstack Scaffold (`client/` + `src/` via `package.json` / `pnpm`)
74
+ ```
75
+ client/ # Web Frontend (Vite + React / Vue / Svelte)
76
+ ├── src/
77
+ │ ├── components/
78
+ │ │ ├── layout/ # Persistent App Shell (Header, Collapsible Sidebar)
79
+ │ │ └── ui/ # Accessible Headless Primitives (Radix / shadcn)
80
+ │ ├── pages/ # Dynamic Canvas Route Views
81
+ │ ├── hooks/ # Server-State Cache & URL State Synchronization
82
+ │ └── services/ # Inbound API Client Adapters
83
+ └── public/
84
+ src/ # Core Backend (Hexagonal Ports & Adapters)
85
+ ├── domain/
86
+ │ ├── entities/user.ts
87
+ │ └── value-objects/tenant-id.ts
88
+ ├── ports/
89
+ │ ├── primary/create-user.usecase.ts
90
+ │ └── secondary/user-repository.port.ts
91
+ └── adapters/
92
+ ├── primary/fastify-router.ts
93
+ └── secondary/kysely-user-repository.ts
94
+ ```
95
+
96
+ ### Go Scaffold (`go.mod`)
97
+ ```
98
+ src/
99
+ ├── domain/
100
+ │ ├── entity/user.go
101
+ │ └── valueobject/tenant_id.go
102
+ ├── ports/
103
+ │ ├── in/create_user_usecase.go
104
+ │ └── out/user_repository_port.go
105
+ └── adapters/
106
+ ├── in/http/user_handler.go
107
+ └── out/sql/pgx_user_repository.go
108
+ ```
109
+
110
+ ### Rust Scaffold (`Cargo.toml`)
111
+ ```
112
+ src/
113
+ ├── domain/
114
+ │ ├── entities/user.rs
115
+ │ └── value_objects/tenant_id.rs
116
+ ├── ports/
117
+ │ ├── primary/create_user.rs
118
+ │ └── secondary/user_repository.rs
119
+ └── adapters/
120
+ ├── primary/axum_handler.rs
121
+ └── secondary/sqlx_repository.rs
122
+ ```
123
+
124
+ ### Python Scaffold (`pyproject.toml` / `uv`)
125
+ ```
126
+ src/
127
+ ├── domain/
128
+ │ ├── entities/user.py
129
+ │ └── value_objects/tenant_id.py
130
+ ├── ports/
131
+ │ ├── primary/create_user_usecase.py
132
+ │ └── secondary/user_repository_port.py
133
+ └── adapters/
134
+ ├── primary/fastapi_router.py
135
+ └── secondary/asyncpg_repository.py
136
+ ```
137
+
138
+ ### TypeScript Backend-Only Scaffold (`package.json` / `pnpm`)
139
+ ```
140
+ src/
141
+ ├── domain/
142
+ │ ├── entities/user.ts
143
+ │ └── value-objects/tenant-id.ts
144
+ ├── ports/
145
+ │ ├── primary/create-user.usecase.ts
146
+ │ └── secondary/user-repository.port.ts
147
+ └── adapters/
148
+ ├── primary/fastify-router.ts
149
+ └── secondary/kysely-user-repository.ts
150
+ ```
151
+
152
+ ---
153
+
154
+ ## 3. Foundational Scaffold Invariants
155
+
156
+ 1. **Domain Isolation**: Code in `src/domain/` must have **zero imports** from `src/adapters/`, `client/`, external web frameworks, or database drivers.
157
+ 2. **Ports as Pure Contracts**: Code in `src/ports/` contains abstract interfaces, Command DTOs, Query DTOs, and Result containers.
158
+ 3. **Adapters Depend on Ports**: `src/adapters/` implements ports defined in `src/ports/`. Adapters never depend directly on other adapters.
159
+ 4. **Contract-First Synchronization**: Whenever an API or event interface changes, the canonical contract in `specs/` must be updated and validated before adapter code is generated or modified.
160
+ 5. **Frontend Decoupling via Contract**: The frontend in `client/` consumes backend driving ports strictly via canonical OpenAPI contracts (`specs/openapi`) and W3C Design Tokens (`specs/tokens/tokens.json`). It follows the 7-Pillar Design Architecture Triage Gate ([docs/rules/ui_ux_architecture.md](../../../../docs/rules/ui_ux_architecture.md)) and accessible headless primitives ([docs/rules/frontend_architecture.md](../../../../docs/rules/frontend_architecture.md)).