azcodr 1.4.0 โ†’ 1.5.1

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 (75) hide show
  1. package/.agents/hooks.json +42 -0
  2. package/.agents/hooks.json.example +42 -42
  3. package/.agents/mcp_config.json.example +6 -1
  4. package/.agents/scripts/safety_guard.sh +34 -0
  5. package/.agents/scripts/verify_completion.sh +27 -0
  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 +401 -331
  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 -165
  19. package/.agents/skills/lets-build/references/architecture_interview_matrix.md +115 -109
  20. package/.agents/skills/lets-build/references/hexagonal_bootstrap_scaffolds.md +160 -113
  21. package/.agents/skills/lets-build/references/project_readme_template.md +79 -79
  22. package/.agents/skills/lets-build/scripts/bootstrap_workspace.sh +255 -136
  23. package/.agents/skills/product-analyst/SKILL.md +154 -143
  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 -125
  30. package/.agents/skills/relentless-questioner/references/adaptive_question_trees.md +102 -84
  31. package/.editorconfig +19 -19
  32. package/.github/copilot-instructions.md +1 -0
  33. package/.github/workflows/ci.yml +56 -0
  34. package/.gitignore +25 -23
  35. package/AGENTS.md +102 -102
  36. package/LICENSE +21 -21
  37. package/README.md +154 -154
  38. package/bin/azcodr.js +228 -223
  39. package/data/.gitkeep +0 -0
  40. package/docs/knowledge/ubiquitous_language.md +18 -18
  41. package/docs/rules/agentic_configuration.md +259 -256
  42. package/docs/rules/api_architecture.md +179 -179
  43. package/docs/rules/authentication.md +76 -76
  44. package/docs/rules/authorization.md +75 -75
  45. package/docs/rules/caching.md +69 -69
  46. package/docs/rules/clean_code.md +62 -62
  47. package/docs/rules/cloud_native.md +41 -41
  48. package/docs/rules/cqrs.md +203 -203
  49. package/docs/rules/database_design.md +125 -125
  50. package/docs/rules/database_operations.md +69 -69
  51. package/docs/rules/design_patterns.md +98 -98
  52. package/docs/rules/devops_ci_cd.md +76 -76
  53. package/docs/rules/domain_driven_design.md +122 -122
  54. package/docs/rules/error_handling.md +52 -52
  55. package/docs/rules/feature_flags.md +59 -59
  56. package/docs/rules/frontend_architecture.md +157 -157
  57. package/docs/rules/multitenancy_architecture.md +98 -98
  58. package/docs/rules/product_ownership.md +127 -127
  59. package/docs/rules/project_management.md +49 -49
  60. package/docs/rules/relentless_questioning.md +52 -48
  61. package/docs/rules/requirements_engineering.md +98 -98
  62. package/docs/rules/security_compliance.md +53 -53
  63. package/docs/rules/server_driven_ui.md +88 -88
  64. package/docs/rules/test_driven_development.md +185 -184
  65. package/docs/rules/transactional_email.md +27 -27
  66. package/docs/rules/type_safety.md +65 -65
  67. package/docs/rules/ui_ux_architecture.md +150 -150
  68. package/docs/rules/workflow_state_machines.md +117 -117
  69. package/lib/index.d.ts +134 -123
  70. package/lib/index.js +5 -5
  71. package/lib/scaffold.js +399 -248
  72. package/memory.md +36 -289
  73. package/package.json +62 -59
  74. package/scripts/test_coverage.js +38 -0
  75. package/scripts/validate.js +246 -0
@@ -1,79 +1,79 @@
1
- # {{PROJECT_NAME}}
2
-
3
- > **{{PROJECT_TAGLINE_OR_MISSION}}**
4
-
5
- ---
6
-
7
- ## ๐ŸŒŸ Architecture & Stack
8
-
9
- - **Architecture:** Hexagonal (Ports & Adapters) with strict systemic atomicity and zero-downtime database patterns.
10
- - **Language & Runtime:** {{LANGUAGE_AND_RUNTIME}}
11
- - **Package Manager & Build:** {{PACKAGE_MANAGER_AND_BUILD_TOOL}}
12
- - **Primary Transport:** {{TRANSPORT_PROTOCOL_AND_FRAMEWORK}}
13
- - **Persistence Engine:** {{DATABASE_ENGINE}} (Migrations via {{MIGRATION_TOOL}})
14
- - **Multi-Tenancy Isolation:** {{TENANCY_ISOLATION_MODEL}}
15
- - **Dynamic Extensibility:** Common Expression Language (CEL) / JSON Schema Draft 2020-12
16
- - **Observability:** OpenTelemetry (OTel) OTLP export over gRPC/HTTP
17
- - **Security & DevSecOps:** Semgrep SAST, Gitleaks, Trivy scanning, CycloneDX SBOM
18
-
19
- ---
20
-
21
- ## ๐Ÿ—‚๏ธ Project Structure
22
-
23
- ```
24
- .
25
- โ”œโ”€โ”€ specs/ # Canonical contract specifications
26
- โ”‚ โ”œโ”€โ”€ openapi/ # OpenAPI 3.1 REST specifications
27
- โ”‚ โ”œโ”€โ”€ protobuf/ # Protocol Buffers v3 definitions
28
- โ”‚ โ”œโ”€โ”€ schemas/ # Universal JSON Schema Draft 2020-12
29
- โ”‚ โ””โ”€โ”€ tokens/ # W3C DTCG Design Tokens
30
- โ”œโ”€โ”€ src/ # Hexagonal Application Source
31
- โ”‚ โ”œโ”€โ”€ domain/ # Core Invariant Domain (Entities, Value Objects)
32
- โ”‚ โ”œโ”€โ”€ ports/ # Primary (Use Cases) and Secondary (Repositories) Ports
33
- โ”‚ โ””โ”€โ”€ adapters/ # Ingress (HTTP/gRPC) and Egress (SQL/Broker) Adapters
34
- โ”œโ”€โ”€ tests/
35
- โ”‚ โ”œโ”€โ”€ unit/ # Fast unit tests using test doubles
36
- โ”‚ โ”œโ”€โ”€ integration/ # Adapter tests with transactional rollback
37
- โ”‚ โ”œโ”€โ”€ contracts/ # Consumer contract tests (Pact)
38
- โ”‚ โ””โ”€โ”€ acceptance/ # BDD Gherkin / Cucumber features
39
- โ”œโ”€โ”€ deploy/ # OCI Distroless Dockerfiles & Compose manifests
40
- โ”œโ”€โ”€ docs/rules/ # 28 cohesive single-responsibility architectural rules
41
- โ”œโ”€โ”€ memory.md # Master memory hub & Lightweight ADR ledger
42
- โ””โ”€โ”€ AGENTS.md # Lean agentic directives (< 120 lines)
43
- ```
44
-
45
- ---
46
-
47
- ## โšก Quickstart & Development
48
-
49
- ### 1. Prerequisites
50
- - {{PREREQUISITES_LIST}}
51
- - Docker & Docker Compose
52
-
53
- ### 2. Environment Setup
54
- ```bash
55
- cp .env.example .env
56
- ```
57
-
58
- ### 3. Install Dependencies
59
- ```bash
60
- {{INSTALL_COMMAND}}
61
- ```
62
-
63
- ### 4. Run Development Environment
64
- ```bash
65
- {{DEV_RUN_COMMAND}}
66
- ```
67
-
68
- ### 5. Run Tests & Verification
69
- ```bash
70
- {{TEST_COMMAND}}
71
- ```
72
-
73
- ---
74
-
75
- ## ๐Ÿ›๏ธ Architecture Governance & Decisions
76
-
77
- This project is governed by the **28 Cohesive Domain Rules** located in `docs/rules/` and Architectural Decision Records in `memory.md`:
78
- - **ADR Ledger:** See `memory.md` for project-specific Architectural Decision Records.
79
- - **Architectural Rules:** See `docs/rules/` for TDD, Clean Code, Multi-Tenancy, Database Design, and DevSecOps directives.
1
+ # {{PROJECT_NAME}}
2
+
3
+ > **{{PROJECT_TAGLINE_OR_MISSION}}**
4
+
5
+ ---
6
+
7
+ ## ๐ŸŒŸ Architecture & Stack
8
+
9
+ - **Architecture:** Hexagonal (Ports & Adapters) with strict systemic atomicity and zero-downtime database patterns.
10
+ - **Language & Runtime:** {{LANGUAGE_AND_RUNTIME}}
11
+ - **Package Manager & Build:** {{PACKAGE_MANAGER_AND_BUILD_TOOL}}
12
+ - **Primary Transport:** {{TRANSPORT_PROTOCOL_AND_FRAMEWORK}}
13
+ - **Persistence Engine:** {{DATABASE_ENGINE}} (Migrations via {{MIGRATION_TOOL}})
14
+ - **Multi-Tenancy Isolation:** {{TENANCY_ISOLATION_MODEL}}
15
+ - **Dynamic Extensibility:** Common Expression Language (CEL) / JSON Schema Draft 2020-12
16
+ - **Observability:** OpenTelemetry (OTel) OTLP export over gRPC/HTTP
17
+ - **Security & DevSecOps:** Semgrep SAST, Gitleaks, Trivy scanning, CycloneDX SBOM
18
+
19
+ ---
20
+
21
+ ## ๐Ÿ—‚๏ธ Project Structure
22
+
23
+ ```
24
+ .
25
+ โ”œโ”€โ”€ specs/ # Canonical contract specifications
26
+ โ”‚ โ”œโ”€โ”€ openapi/ # OpenAPI 3.1 REST specifications
27
+ โ”‚ โ”œโ”€โ”€ protobuf/ # Protocol Buffers v3 definitions
28
+ โ”‚ โ”œโ”€โ”€ schemas/ # Universal JSON Schema Draft 2020-12
29
+ โ”‚ โ””โ”€โ”€ tokens/ # W3C DTCG Design Tokens
30
+ โ”œโ”€โ”€ src/ # Hexagonal Application Source
31
+ โ”‚ โ”œโ”€โ”€ domain/ # Core Invariant Domain (Entities, Value Objects)
32
+ โ”‚ โ”œโ”€โ”€ ports/ # Primary (Use Cases) and Secondary (Repositories) Ports
33
+ โ”‚ โ””โ”€โ”€ adapters/ # Ingress (HTTP/gRPC) and Egress (SQL/Broker) Adapters
34
+ โ”œโ”€โ”€ tests/
35
+ โ”‚ โ”œโ”€โ”€ unit/ # Fast unit tests using test doubles
36
+ โ”‚ โ”œโ”€โ”€ integration/ # Adapter tests with transactional rollback
37
+ โ”‚ โ”œโ”€โ”€ contracts/ # Consumer contract tests (Pact)
38
+ โ”‚ โ””โ”€โ”€ acceptance/ # BDD Gherkin / Cucumber features
39
+ โ”œโ”€โ”€ deploy/ # OCI Distroless Dockerfiles & Compose manifests
40
+ โ”œโ”€โ”€ docs/rules/ # 28 cohesive single-responsibility architectural rules
41
+ โ”œโ”€โ”€ memory.md # Master memory hub & Lightweight ADR ledger
42
+ โ””โ”€โ”€ AGENTS.md # Lean agentic directives (< 120 lines)
43
+ ```
44
+
45
+ ---
46
+
47
+ ## โšก Quickstart & Development
48
+
49
+ ### 1. Prerequisites
50
+ - {{PREREQUISITES_LIST}}
51
+ - Docker & Docker Compose
52
+
53
+ ### 2. Environment Setup
54
+ ```bash
55
+ cp .env.example .env
56
+ ```
57
+
58
+ ### 3. Install Dependencies
59
+ ```bash
60
+ {{INSTALL_COMMAND}}
61
+ ```
62
+
63
+ ### 4. Run Development Environment
64
+ ```bash
65
+ {{DEV_RUN_COMMAND}}
66
+ ```
67
+
68
+ ### 5. Run Tests & Verification
69
+ ```bash
70
+ {{TEST_COMMAND}}
71
+ ```
72
+
73
+ ---
74
+
75
+ ## ๐Ÿ›๏ธ Architecture Governance & Decisions
76
+
77
+ This project is governed by the **28 Cohesive Domain Rules** located in `docs/rules/` and Architectural Decision Records in `memory.md`:
78
+ - **ADR Ledger:** See `memory.md` for project-specific Architectural Decision Records.
79
+ - **Architectural Rules:** See `docs/rules/` for TDD, Clean Code, Multi-Tenancy, Database Design, and DevSecOps directives.
@@ -1,136 +1,255 @@
1
- #!/usr/bin/env bash
2
- # ==============================================================================
3
- # bootstrap_workspace.sh
4
- # Topology-Aware Deterministic Scaffolder (Strict YAGNI, Zero Speculative Bloat)
5
- # ==============================================================================
6
-
7
- set -euo pipefail
8
-
9
- WORKSPACE_ROOT="${1:-$(pwd)}"
10
- TOPOLOGY="${2:-backend}"
11
- LANGUAGE="${3:-generic}"
12
-
13
- echo "๐Ÿš€ Initializing Topology-Aware Workspace in: ${WORKSPACE_ROOT}"
14
- echo "๐Ÿ—๏ธ Target Topology: ${TOPOLOGY}"
15
- echo "๐Ÿ“ฆ Target Language Profile: ${LANGUAGE}"
16
- echo "--------------------------------------------------------------"
17
-
18
- # Helper to create leaf directory with .gitkeep to ensure Git tracks empty structures
19
- create_leaf() {
20
- local dir="$1"
21
- mkdir -p "${dir}"
22
- if [[ -z "$(ls -A "${dir}" 2>/dev/null)" ]]; then
23
- touch "${dir}/.gitkeep"
24
- fi
25
- }
26
-
27
- case "${TOPOLOGY}" in
28
- extension)
29
- echo "1. Scaffolding Browser Extension Source Tree (src/)..."
30
- create_leaf "${WORKSPACE_ROOT}/src/background"
31
- create_leaf "${WORKSPACE_ROOT}/src/content"
32
- create_leaf "${WORKSPACE_ROOT}/src/popup"
33
- create_leaf "${WORKSPACE_ROOT}/src/shared"
34
- create_leaf "${WORKSPACE_ROOT}/public"
35
-
36
- echo "2. Scaffolding Extension Test Suites (tests/)..."
37
- create_leaf "${WORKSPACE_ROOT}/tests/unit"
38
- create_leaf "${WORKSPACE_ROOT}/tests/e2e"
39
- ;;
40
-
41
- game|engine)
42
- echo "1. Scaffolding Game/Engine Source Tree (src/)..."
43
- create_leaf "${WORKSPACE_ROOT}/src/core"
44
- create_leaf "${WORKSPACE_ROOT}/src/ecs"
45
- create_leaf "${WORKSPACE_ROOT}/src/renderer"
46
- create_leaf "${WORKSPACE_ROOT}/src/assets"
47
-
48
- echo "2. Scaffolding Game/Engine Test Suites (tests/)..."
49
- create_leaf "${WORKSPACE_ROOT}/tests/unit"
50
- create_leaf "${WORKSPACE_ROOT}/tests/benchmarks"
51
- ;;
52
-
53
- cli)
54
- echo "1. Scaffolding CLI Source Tree (src/)..."
55
- create_leaf "${WORKSPACE_ROOT}/src/cmd"
56
- create_leaf "${WORKSPACE_ROOT}/src/core"
57
- create_leaf "${WORKSPACE_ROOT}/src/io"
58
-
59
- echo "2. Scaffolding CLI Test Suites (tests/)..."
60
- create_leaf "${WORKSPACE_ROOT}/tests/unit"
61
- create_leaf "${WORKSPACE_ROOT}/tests/integration"
62
- ;;
63
-
64
- backend|web|saas)
65
- echo "1. Scaffolding Backend / Enterprise Source Tree (src/)..."
66
- create_leaf "${WORKSPACE_ROOT}/src/domain/entities"
67
- create_leaf "${WORKSPACE_ROOT}/src/domain/value_objects"
68
- create_leaf "${WORKSPACE_ROOT}/src/domain/services"
69
- create_leaf "${WORKSPACE_ROOT}/src/ports/primary"
70
- create_leaf "${WORKSPACE_ROOT}/src/ports/secondary"
71
- create_leaf "${WORKSPACE_ROOT}/src/adapters/primary"
72
- create_leaf "${WORKSPACE_ROOT}/src/adapters/secondary"
73
-
74
- echo "2. Scaffolding Specifications (specs/)..."
75
- create_leaf "${WORKSPACE_ROOT}/specs/openapi"
76
- create_leaf "${WORKSPACE_ROOT}/specs/tokens"
77
-
78
- echo "3. Scaffolding Backend Test Suites (tests/)..."
79
- create_leaf "${WORKSPACE_ROOT}/tests/unit"
80
- create_leaf "${WORKSPACE_ROOT}/tests/integration"
81
- create_leaf "${WORKSPACE_ROOT}/tests/contracts"
82
- create_leaf "${WORKSPACE_ROOT}/tests/acceptance"
83
-
84
- echo "4. Scaffolding Deployment Infrastructure (deploy/)..."
85
- create_leaf "${WORKSPACE_ROOT}/deploy/docker"
86
- create_leaf "${WORKSPACE_ROOT}/deploy/compose"
87
-
88
- TOKEN_SPEC="${WORKSPACE_ROOT}/specs/tokens/tokens.json"
89
- if [[ ! -f "${TOKEN_SPEC}" ]]; then
90
- cat << 'EOF' > "${TOKEN_SPEC}"
91
- {
92
- "color": {
93
- "brand": {
94
- "primary": { "$value": "#2563eb", "$type": "color" },
95
- "secondary": { "$value": "#475569", "$type": "color" },
96
- "accent": { "$value": "#f59e0b", "$type": "color" }
97
- }
98
- },
99
- "dimension": {
100
- "radius": {
101
- "base": { "$value": "6px", "$type": "dimension" }
102
- }
103
- }
104
- }
105
- EOF
106
- fi
107
- ;;
108
-
109
- *)
110
- echo "1. Scaffolding Generic / Library Source Tree (src/)..."
111
- create_leaf "${WORKSPACE_ROOT}/src"
112
- create_leaf "${WORKSPACE_ROOT}/tests/unit"
113
- ;;
114
- esac
115
-
116
- # Deterministically generate boundary verification smoke test script (Phase 5 requirement)
117
- SMOKE_TEST="${WORKSPACE_ROOT}/scripts/smoke_test.sh"
118
- if [[ ! -f "${SMOKE_TEST}" ]]; then
119
- echo "5. Generating boundary smoke test verification script (scripts/smoke_test.sh)..."
120
- mkdir -p "${WORKSPACE_ROOT}/scripts"
121
- cat << 'EOF' > "${SMOKE_TEST}"
122
- #!/usr/bin/env bash
123
- # ==============================================================================
124
- # Boundary Verification Smoke Test (Phase 5 Verification Gate)
125
- # ==============================================================================
126
- set -euo pipefail
127
-
128
- echo "Running boundary smoke verification..."
129
- # Extend with project-specific runtime health checks (e.g. ping health endpoint, CLI --help)
130
- echo "โœ… Boundary smoke verification passed!"
131
- EOF
132
- chmod +x "${SMOKE_TEST}"
133
- fi
134
-
135
- echo "--------------------------------------------------------------"
136
- echo "โœ… Topology '${TOPOLOGY}' scaffolded with strict YAGNI (0 speculative folders)!"
1
+ #!/usr/bin/env bash
2
+ # ==============================================================================
3
+ # bootstrap_workspace.sh
4
+ # Topology-Aware Deterministic Scaffolder (Strict YAGNI, Zero Speculative Bloat)
5
+ # ==============================================================================
6
+
7
+ set -euo pipefail
8
+
9
+ WORKSPACE_ROOT="${1:-$(pwd)}"
10
+ TOPOLOGY="${2:-backend}"
11
+ LANGUAGE="${3:-generic}"
12
+
13
+ echo "๐Ÿš€ Initializing Topology-Aware Workspace in: ${WORKSPACE_ROOT}"
14
+ echo "๐Ÿ—๏ธ Target Topology: ${TOPOLOGY}"
15
+ echo "๐Ÿ“ฆ Target Language Profile: ${LANGUAGE}"
16
+ echo "--------------------------------------------------------------"
17
+
18
+ # Helper to create leaf directory with .gitkeep to ensure Git tracks empty structures
19
+ create_leaf() {
20
+ local dir="$1"
21
+ mkdir -p "${dir}"
22
+ if [[ -z "$(ls -A "${dir}" 2>/dev/null)" ]]; then
23
+ touch "${dir}/.gitkeep"
24
+ fi
25
+ }
26
+
27
+ case "${TOPOLOGY}" in
28
+ extension)
29
+ echo "1. Scaffolding Browser Extension Source Tree (src/)..."
30
+ create_leaf "${WORKSPACE_ROOT}/src/background"
31
+ create_leaf "${WORKSPACE_ROOT}/src/content"
32
+ create_leaf "${WORKSPACE_ROOT}/src/popup"
33
+ create_leaf "${WORKSPACE_ROOT}/src/shared"
34
+ create_leaf "${WORKSPACE_ROOT}/public"
35
+
36
+ echo "2. Scaffolding Extension Test Suites (tests/)..."
37
+ create_leaf "${WORKSPACE_ROOT}/tests/unit"
38
+ create_leaf "${WORKSPACE_ROOT}/tests/e2e"
39
+ ;;
40
+
41
+ game|engine)
42
+ echo "1. Scaffolding Game/Engine Source Tree (src/)..."
43
+ create_leaf "${WORKSPACE_ROOT}/src/core"
44
+ create_leaf "${WORKSPACE_ROOT}/src/ecs"
45
+ create_leaf "${WORKSPACE_ROOT}/src/renderer"
46
+ create_leaf "${WORKSPACE_ROOT}/src/assets"
47
+
48
+ echo "2. Scaffolding Game/Engine Test Suites (tests/)..."
49
+ create_leaf "${WORKSPACE_ROOT}/tests/unit"
50
+ create_leaf "${WORKSPACE_ROOT}/tests/benchmarks"
51
+ ;;
52
+
53
+ cli)
54
+ echo "1. Scaffolding CLI Source Tree (src/)..."
55
+ create_leaf "${WORKSPACE_ROOT}/src/cmd"
56
+ create_leaf "${WORKSPACE_ROOT}/src/core"
57
+ create_leaf "${WORKSPACE_ROOT}/src/io"
58
+
59
+ echo "2. Scaffolding CLI Test Suites (tests/)..."
60
+ create_leaf "${WORKSPACE_ROOT}/tests/unit"
61
+ create_leaf "${WORKSPACE_ROOT}/tests/integration"
62
+ ;;
63
+
64
+ web|saas|fullstack)
65
+ echo "1. Scaffolding Backend / Enterprise Source Tree (src/)..."
66
+ create_leaf "${WORKSPACE_ROOT}/src/domain/entities"
67
+ create_leaf "${WORKSPACE_ROOT}/src/domain/value_objects"
68
+ create_leaf "${WORKSPACE_ROOT}/src/domain/services"
69
+ create_leaf "${WORKSPACE_ROOT}/src/ports/primary"
70
+ create_leaf "${WORKSPACE_ROOT}/src/ports/secondary"
71
+ create_leaf "${WORKSPACE_ROOT}/src/adapters/primary"
72
+ create_leaf "${WORKSPACE_ROOT}/src/adapters/secondary"
73
+
74
+ echo "2. Scaffolding Web Frontend Client Source Tree (client/)..."
75
+ create_leaf "${WORKSPACE_ROOT}/client/src/components/layout"
76
+ create_leaf "${WORKSPACE_ROOT}/client/src/components/ui"
77
+ create_leaf "${WORKSPACE_ROOT}/client/src/pages"
78
+ create_leaf "${WORKSPACE_ROOT}/client/src/hooks"
79
+ create_leaf "${WORKSPACE_ROOT}/client/src/services"
80
+ create_leaf "${WORKSPACE_ROOT}/client/public"
81
+
82
+ echo "3. Scaffolding Specifications (specs/)..."
83
+ create_leaf "${WORKSPACE_ROOT}/specs/openapi"
84
+ create_leaf "${WORKSPACE_ROOT}/specs/tokens"
85
+
86
+ echo "4. Scaffolding Fullstack Test Suites (tests/)..."
87
+ create_leaf "${WORKSPACE_ROOT}/tests/unit"
88
+ create_leaf "${WORKSPACE_ROOT}/tests/integration"
89
+ create_leaf "${WORKSPACE_ROOT}/tests/contracts"
90
+ create_leaf "${WORKSPACE_ROOT}/tests/client"
91
+ create_leaf "${WORKSPACE_ROOT}/tests/acceptance"
92
+
93
+ echo "5. Scaffolding Deployment Infrastructure (deploy/)..."
94
+ create_leaf "${WORKSPACE_ROOT}/deploy/docker"
95
+ create_leaf "${WORKSPACE_ROOT}/deploy/compose"
96
+
97
+ TOKEN_SPEC="${WORKSPACE_ROOT}/specs/tokens/tokens.json"
98
+ if [[ ! -f "${TOKEN_SPEC}" ]]; then
99
+ cat << 'EOF' > "${TOKEN_SPEC}"
100
+ {
101
+ "color": {
102
+ "brand": {
103
+ "primary": { "$value": "#2563eb", "$type": "color" },
104
+ "secondary": { "$value": "#475569", "$type": "color" },
105
+ "accent": { "$value": "#f59e0b", "$type": "color" }
106
+ }
107
+ },
108
+ "dimension": {
109
+ "radius": {
110
+ "base": { "$value": "6px", "$type": "dimension" }
111
+ }
112
+ }
113
+ }
114
+ EOF
115
+ fi
116
+ ;;
117
+
118
+ backend)
119
+ echo "1. Scaffolding Headless Backend Source Tree (src/)..."
120
+ create_leaf "${WORKSPACE_ROOT}/src/domain/entities"
121
+ create_leaf "${WORKSPACE_ROOT}/src/domain/value_objects"
122
+ create_leaf "${WORKSPACE_ROOT}/src/domain/services"
123
+ create_leaf "${WORKSPACE_ROOT}/src/ports/primary"
124
+ create_leaf "${WORKSPACE_ROOT}/src/ports/secondary"
125
+ create_leaf "${WORKSPACE_ROOT}/src/adapters/primary"
126
+ create_leaf "${WORKSPACE_ROOT}/src/adapters/secondary"
127
+
128
+ echo "2. Scaffolding Specifications (specs/)..."
129
+ create_leaf "${WORKSPACE_ROOT}/specs/openapi"
130
+ create_leaf "${WORKSPACE_ROOT}/specs/tokens"
131
+
132
+ echo "3. Scaffolding Backend Test Suites (tests/)..."
133
+ create_leaf "${WORKSPACE_ROOT}/tests/unit"
134
+ create_leaf "${WORKSPACE_ROOT}/tests/integration"
135
+ create_leaf "${WORKSPACE_ROOT}/tests/contracts"
136
+ create_leaf "${WORKSPACE_ROOT}/tests/acceptance"
137
+
138
+ echo "4. Scaffolding Deployment Infrastructure (deploy/)..."
139
+ create_leaf "${WORKSPACE_ROOT}/deploy/docker"
140
+ create_leaf "${WORKSPACE_ROOT}/deploy/compose"
141
+
142
+ TOKEN_SPEC="${WORKSPACE_ROOT}/specs/tokens/tokens.json"
143
+ if [[ ! -f "${TOKEN_SPEC}" ]]; then
144
+ cat << 'EOF' > "${TOKEN_SPEC}"
145
+ {
146
+ "color": {
147
+ "brand": {
148
+ "primary": { "$value": "#2563eb", "$type": "color" },
149
+ "secondary": { "$value": "#475569", "$type": "color" },
150
+ "accent": { "$value": "#f59e0b", "$type": "color" }
151
+ }
152
+ },
153
+ "dimension": {
154
+ "radius": {
155
+ "base": { "$value": "6px", "$type": "dimension" }
156
+ }
157
+ }
158
+ }
159
+ EOF
160
+ fi
161
+ ;;
162
+
163
+ frontend)
164
+ echo "1. Scaffolding Frontend Client Source Tree (src/)..."
165
+ create_leaf "${WORKSPACE_ROOT}/src/components/layout"
166
+ create_leaf "${WORKSPACE_ROOT}/src/components/ui"
167
+ create_leaf "${WORKSPACE_ROOT}/src/pages"
168
+ create_leaf "${WORKSPACE_ROOT}/src/hooks"
169
+ create_leaf "${WORKSPACE_ROOT}/src/services"
170
+ create_leaf "${WORKSPACE_ROOT}/public"
171
+
172
+ echo "2. Scaffolding Specifications (specs/)..."
173
+ create_leaf "${WORKSPACE_ROOT}/specs/tokens"
174
+
175
+ echo "3. Scaffolding Frontend Test Suites (tests/)..."
176
+ create_leaf "${WORKSPACE_ROOT}/tests/unit"
177
+ create_leaf "${WORKSPACE_ROOT}/tests/acceptance"
178
+ ;;
179
+
180
+ *)
181
+ echo "1. Scaffolding Generic / Library Source Tree (src/)..."
182
+ create_leaf "${WORKSPACE_ROOT}/src"
183
+ create_leaf "${WORKSPACE_ROOT}/tests/unit"
184
+ ;;
185
+ esac
186
+
187
+ # Ensure memory.md in fresh projects starts with a clean ADR slate (ADR-001)
188
+ MEMORY_FILE="${WORKSPACE_ROOT}/memory.md"
189
+ if [[ -f "${MEMORY_FILE}" ]]; then
190
+ if grep -qE "ADR-00[1-9]|ADR-0[1-9][0-9]|#### ADR-" "${MEMORY_FILE}"; then
191
+ if ! grep -q "No decisions recorded yet" "${MEMORY_FILE}"; then
192
+ echo "๐Ÿงน Sanitizing memory.md: Resetting legacy template ADRs to clean slate (ADR-001)..."
193
+ cat << 'EOF' > "${MEMORY_FILE}"
194
+ # Workspace Memory, Architecture Decisions & Knowledge Hub
195
+
196
+ > **Core Purpose:** Authoritative persistent memory ledger for the workspace repository (`./`), maintaining Lightweight Architectural Decision Records (ADRs), system topologies, and living domain contracts.
197
+
198
+ ---
199
+
200
+ ## 1. Quick Navigation & Knowledge Repositories
201
+
202
+ - ๐Ÿ“– **[Living Ubiquitous Language Glossary](./docs/knowledge/ubiquitous_language.md)**: Authoritative, single-name domain vocabulary contract.
203
+ - ๐Ÿ“œ **[Lightweight ADR Master Index](#adr-master-index)**: Summary of all architectural decisions and direct links to governing rules.
204
+
205
+ ---
206
+
207
+ ## 2. Consolidated Architectural Decision Records (ADRs)
208
+
209
+ ### ADR Master Index
210
+
211
+ | ID | Title | Date | Status | Governing Rule / Skill |
212
+ |---|---|---|---|---|
213
+ | *(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)* |
214
+
215
+ ---
216
+
217
+ ### Lightweight Decision Summaries
218
+
219
+ <!--
220
+ Record project Architectural Decision Records (ADRs) below as decisions are finalized.
221
+ Format:
222
+
223
+ #### ADR-001: [Imperative Title]
224
+ - **Date:** YYYY-MM-DD | **Status:** ACCEPTED
225
+ - **Context:** Problem space, constraints, and operational context requiring a decision.
226
+ - **Decision:** Chosen architecture, invariants, and implementation patterns.
227
+ - **Consequences:** Positive benefits and deliberate trade-offs accepted.
228
+ - **Enforced In:** Relevant rule files in docs/rules/ or code paths.
229
+ -->
230
+ EOF
231
+ fi
232
+ fi
233
+ fi
234
+
235
+ # Deterministically generate boundary verification smoke test script (Phase 5 requirement)
236
+ SMOKE_TEST="${WORKSPACE_ROOT}/scripts/smoke_test.sh"
237
+ if [[ ! -f "${SMOKE_TEST}" ]]; then
238
+ echo "5. Generating boundary smoke test verification script (scripts/smoke_test.sh)..."
239
+ mkdir -p "${WORKSPACE_ROOT}/scripts"
240
+ cat << 'EOF' > "${SMOKE_TEST}"
241
+ #!/usr/bin/env bash
242
+ # ==============================================================================
243
+ # Boundary Verification Smoke Test (Phase 5 Verification Gate)
244
+ # ==============================================================================
245
+ set -euo pipefail
246
+
247
+ echo "Running boundary smoke verification..."
248
+ # Extend with project-specific runtime health checks (e.g. ping health endpoint, CLI --help)
249
+ echo "โœ… Boundary smoke verification passed!"
250
+ EOF
251
+ chmod +x "${SMOKE_TEST}"
252
+ fi
253
+
254
+ echo "--------------------------------------------------------------"
255
+ echo "โœ… Topology '${TOPOLOGY}' scaffolded with strict YAGNI (0 speculative folders)!"