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
@@ -0,0 +1,200 @@
1
+ name: Publish
2
+
3
+ on:
4
+ release:
5
+ types: [ published ]
6
+ workflow_dispatch:
7
+ inputs:
8
+ dry-run:
9
+ description: "Verify the publishable tarball without uploading"
10
+ type: boolean
11
+ default: true
12
+
13
+ # Least privilege: read the repo, write only the npm registry.
14
+ permissions:
15
+ contents: read
16
+ id-token: write # npm trusted publishing / provenance attestation
17
+
18
+ # Never let two release runs race the same version.
19
+ concurrency:
20
+ group: publish-${{ github.ref }}
21
+ cancel-in-progress: false
22
+
23
+ jobs:
24
+ verify:
25
+ name: Verify Release Before Publishing
26
+ runs-on: ubuntu-24.04
27
+ timeout-minutes: 15
28
+ steps:
29
+ - name: Checkout Repository
30
+ uses: actions/checkout@v7
31
+
32
+ - name: Setup Node.js 24.x
33
+ uses: actions/setup-node@v7
34
+ with:
35
+ node-version: 24.x
36
+ registry-url: https://registry.npmjs.org
37
+
38
+ - name: Install dependencies
39
+ run: npm ci
40
+
41
+ - name: Verify Environment
42
+ run: |
43
+ node --version
44
+ npm --version
45
+
46
+ # Re-run the full gate on the exact release tag. prepublishOnly also runs
47
+ # on `npm publish`, but failing fast here avoids building a tarball at all.
48
+ - name: Run Syntax & Lint Checks
49
+ run: npm run lint
50
+
51
+ - name: Run Test Suite
52
+ run: npm test
53
+
54
+ - name: Verify Coverage Gates
55
+ run: npm run test:coverage
56
+
57
+ - name: Validate Agentic Architecture
58
+ run: npm run validate
59
+
60
+ - name: Verify version matches the release tag
61
+ if: github.event_name == 'release'
62
+ run: |
63
+ set -euo pipefail
64
+ pkg_version="$(node -p "require('./package.json').version")"
65
+ tag_version="${GITHUB_REF_NAME#v}"
66
+ if [ "$pkg_version" != "$tag_version" ]; then
67
+ echo "::error::package.json version ($pkg_version) does not match release tag ($GITHUB_REF_NAME)"
68
+ exit 1
69
+ fi
70
+ echo "version $pkg_version matches tag $GITHUB_REF_NAME"
71
+
72
+ - name: Inspect the publishable tarball
73
+ run: |
74
+ set -euo pipefail
75
+ npm pack --dry-run
76
+ # Prove the tarball actually carries the files the package promises,
77
+ # rather than trusting the files[] allowlist to be correct.
78
+ # npm writes UTF-16LE on Windows, so parse it as text, not via require.
79
+ npm pack --json > pack.json
80
+ node -e '
81
+ const fs = require("fs");
82
+ let raw = fs.readFileSync("pack.json", "utf-8");
83
+ if (raw.charCodeAt(0) === 0xFEFF) raw = raw.slice(1);
84
+ // npm writes UTF-16LE on Windows, so utf-8 decoding yields NUL
85
+ // padding. Detect it and re-read. Use an escape, never a literal
86
+ // NUL byte: an embedded 0x00 makes git classify this file as
87
+ // binary, which breaks the workflow.
88
+ if (raw.indexOf(String.fromCharCode(0)) !== -1) {
89
+ raw = fs.readFileSync("pack.json", "utf16le");
90
+ if (raw.charCodeAt(0) === 0xFEFF) raw = raw.slice(1);
91
+ }
92
+ const meta = JSON.parse(raw)[0];
93
+ const files = new Set(meta.files.map((f) => f.path));
94
+ const required = [
95
+ "package.json", "README.md", "LICENSE",
96
+ "bin/azcodr.js", "lib/index.js", "lib/index.d.ts", "lib/scaffold.js",
97
+ "scripts/validate.js", "scripts/validate-cli.js"
98
+ ];
99
+ const missing = required.filter((f) => !files.has(f));
100
+ if (missing.length) {
101
+ console.error("::error::missing from tarball: " + missing.join(", "));
102
+ process.exit(1);
103
+ }
104
+ console.log("tarball contains all " + required.length + " required paths");
105
+ '
106
+
107
+ - name: Install the packed tarball and smoke-test the CLI
108
+ run: |
109
+ set -euo pipefail
110
+ # The highest-value missing check: the published artifact must be
111
+ # runnable, not just constructible.
112
+ npm pack > /dev/null
113
+ mkdir -p /tmp/smoke && cd /tmp/smoke
114
+ npm init -y > /dev/null 2>&1
115
+ npm install "$GITHUB_WORKSPACE"/*.tgz --no-audit --no-fund
116
+ npx azcodr --version
117
+ npx azcodr --help > /dev/null
118
+ node -e '
119
+ const api = require("azcodr");
120
+ const required = ["scaffold", "copyTemplate", "validateTarget", "ERROR_CODES", "ScaffoldError"];
121
+ const missing = required.filter((k) => !(k in api));
122
+ if (missing.length) { console.error("missing exports: " + missing.join(", ")); process.exit(1); }
123
+ if (api.ERROR_CODES.E_GIT_BLOCKED !== "Blocked git subcommand") {
124
+ console.error("error-code contract changed unexpectedly");
125
+ process.exit(1);
126
+ }
127
+ console.log("programmatic API surface verified");
128
+ '
129
+
130
+ - name: Scaffold a real project from the packed tarball
131
+ run: |
132
+ set -euo pipefail
133
+ cd /tmp/smoke
134
+ npx azcodr ./generated --force --no-git
135
+ cd ./generated
136
+ npm run validate
137
+
138
+ publish-npm:
139
+ name: Publish to npm
140
+ needs: verify
141
+ runs-on: ubuntu-24.04
142
+ timeout-minutes: 15
143
+ steps:
144
+ - name: Checkout Repository
145
+ uses: actions/checkout@v7
146
+
147
+ - name: Setup Node.js 24.x
148
+ uses: actions/setup-node@v7
149
+ with:
150
+ node-version: 24.x
151
+ registry-url: https://registry.npmjs.org
152
+
153
+ - name: Verify the working tree is clean
154
+ run: |
155
+ set -euo pipefail
156
+ # Publishing from a dirty tree ships files that are not in any tag and
157
+ # cannot be reproduced later.
158
+ if [ -n "$(git status --porcelain)" ]; then
159
+ echo "::error::working tree is dirty; refusing to publish"
160
+ git status --porcelain
161
+ exit 1
162
+ fi
163
+
164
+ - name: Install dependencies
165
+ run: npm ci
166
+
167
+ - name: Re-run the publish gate
168
+ # prepublishOnly fires on npm publish: lint -> coverage -> validate.
169
+ run: npm run lint && npm run test:coverage && npm run validate
170
+
171
+ - name: Dry run (no upload)
172
+ if: inputs.dry-run == true
173
+ run: npm publish --dry-run --access public
174
+
175
+ - name: Publish to npm
176
+ if: inputs.dry-run != true
177
+ run: npm publish --access public --provenance
178
+ env:
179
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
180
+
181
+ publish-jsr:
182
+ name: Publish to JSR
183
+ needs: verify
184
+ # Requires a native ESM entrypoint. The npm package is CommonJS, which JSR
185
+ # explicitly forbids ("You cannot publish CommonJS modules"). Disabled with
186
+ # a stated reason rather than failing every release.
187
+ if: false
188
+ runs-on: ubuntu-24.04
189
+ timeout-minutes: 15
190
+ steps:
191
+ - name: Checkout Repository
192
+ uses: actions/checkout@v7
193
+
194
+ - name: Setup Deno
195
+ uses: denoland/setup-deno@v2
196
+ with:
197
+ deno-version: v2.x
198
+
199
+ - name: Publish to JSR
200
+ run: npx jsr publish
package/.gitignore CHANGED
@@ -1,25 +1,40 @@
1
- # Node dependencies
2
- node_modules/
3
- npm-debug.log*
4
- yarn-debug.log*
5
- yarn-error.log*
6
- *.log
7
- *.log.*
8
-
9
- # Test coverage
10
- coverage/
11
-
12
- # Pack tarballs
13
- *.tgz
14
-
15
- # OS files
16
- .DS_Store
17
- Thumbs.db
18
-
19
- # Local environment
20
- .env
21
- .env.local
22
- .env.*.local
23
-
24
- # Case-insensitive filesystem parity (agents.md is generated/symlinked on Linux, native on macOS/Windows)
25
- agents.md
1
+ # Node dependencies
2
+ node_modules/
3
+ npm-debug.log*
4
+ yarn-debug.log*
5
+ yarn-error.log*
6
+ *.log
7
+ *.log.*
8
+
9
+ # Test coverage
10
+ coverage/
11
+
12
+ # Pack tarballs
13
+ *.tgz
14
+
15
+ # OS files
16
+ .DS_Store
17
+ Thumbs.db
18
+
19
+ # Local environment
20
+ .env
21
+ .env.local
22
+ .env.*.local
23
+ # npm auto-excludes .npmrc when packing, but git does not: a local
24
+ # .npmrc holding _authToken is committable and would leak a registry credential.
25
+ .npmrc
26
+ .envrc
27
+
28
+ # Local databases (data/ ships in the tarball as a placeholder)
29
+ *.db
30
+ *.db-journal
31
+ *.sqlite
32
+ *.sqlite3
33
+
34
+ # Agent scratch space
35
+ .tmp/
36
+ .tmp-scratch/
37
+ opencode.json
38
+
39
+ # Case-insensitive filesystem parity (agents.md is generated/symlinked on Linux, native on macOS/Windows)
40
+ agents.md
package/AGENTS.md CHANGED
@@ -1,102 +1,103 @@
1
- # AGENTS.md
2
-
3
- > **azcodr: Enterprise Architecture & Agentic Engineering Starter Template**
4
- > **Workspace Mission:** Problem-first, topology-aligned production architectures governed by strict systemic atomicity, 100% open-source standards, true incremental TDD nano-cycles, and zero speculative bloat.
5
- > **Runtime & Tools:** Node.js (`>=18.0.0`), npm (`>=10.0.0`) | `npm test` (test runner), `npm run test:coverage` (100% gate), `npm run lint`, `npm run validate`.
6
- > **Rule Zero:** Assume nothing. Every action must be grounded in verified evidence from this workspace or direct instructions from the user.
7
- > **Atomicity Mandate:** All rules, skills, code units, migrations, and transactions must be strictly atomic (indivisible, self-contained, composable with full ACID safety).
8
- > **Architecture Mandate:** Architecture emerges strictly from problem constraints and execution targets (Problem-First; zero tool/platform bias). Match architectural style to problem topology (Hexagonal for backends, Platform Scripting for extensions, Data-Oriented Design for game engines, Command Pipeline for CLIs, Game Loop for canvas games).
9
-
10
- ---
11
-
12
- ## 1. Zero-Assumption Operating Framework
13
- ### Core Principles
14
- 1. **No External Assumptions:** You have no prior knowledge of external setups, hidden tools, libraries, or unverified conventions outside this workspace.
15
- 2. **Ground Truth Only:** A statement is only true if proven by a workspace file, verified command output, or direct user instruction.
16
- 3. **Unknown Until Verified:** If something is not explicitly written in the workspace or stated by the user, treat it as unknown.
17
- 4. **Strict Open Standards:** Standardize on open-source solutions and open specs (Semgrep, Trivy, Gitleaks, OpenTelemetry, OPA, OCI, Wasm, CloudEvents).
18
- 5. **Problem-First & Topology Alignment:** Problem domain and operational constraints (latency budget, GC tolerance, memory, execution environment) strictly dictate the architectural style and toolchain. Never select tools before defining the problem space.
19
- 6. **Evolutionary Architecture & Refactor-Before-Add:** As complexity grows, code must graduate across explicit architectural tipping points. Refactor structure first under existing green tests before implementing new features. Never append code into rotting files.
20
- 7. **True Incremental TDD & Nano-Cycles:** Never dump test suites in batches ("Test-First Waterfall"). Follow Uncle Bob's Three Laws: write one micro-assertion at a time, verify RED failure output, write minimal code to turn GREEN, and refactor under green.
21
- 8. **Systemic Atomicity:** Every skill, rule, database transaction, and refactoring step must be atomic (Single Responsibility, zero side-effects, full rollback).
22
- 9. **Workspace Sovereignty:** Total containment within the local workspace root (`./`). Zero interference from global configs, tools, or sibling projects.
23
- 10. **Continuous Learning:** Ingest all verified defects, lessons, and architectural invariants directly into domain rules and `memory.md`.
24
-
25
- ### The 5 Core Branch Questions
26
- Before acting on any decision branch, answer:
27
- 1. **Current State:** What do workspace files currently show? (Inspect before assuming).
28
- 2. **Target Goal:** Is the goal clear, bounded, and explicit? (Stop & ask if ambiguous).
29
- 3. **Tools & Setup:** Are tools defined in workspace configs? (Never assume commands exist).
30
- 4. **Impact & Risk:** Have all references, callers, and side effects been traced?
31
- 5. **Verification:** How will we prove it works with tests or build commands?
32
-
33
- ### Conflict Resolution & Order of Authority
34
- 1. **User Request (Current Session)** ➔ 2. **Workspace Configurations** (lockfiles, linters, scripts) ➔ 3. **Existing Code Patterns** ➔ 4. **Direct Confirmation (Stop & Ask)**.
35
-
36
- ### Action Boundaries
37
- - **ALWAYS:** Read files before editing; verify commands before running; verify results with evidence.
38
- - **ASK FIRST:** Adding/removing external dependencies; deleting/renaming files; changing DB schemas or build scripts; modifying existing tests.
39
- - **NEVER:** Guess paths, flags, or signatures; silently ignore errors; bypass unresolved questions.
40
- ---
41
-
42
- ## 2. Execution Lifecycle
43
-
44
- Progress all tasks systematically through the unified **Agent Cognitive & Agile Domain Lifecycle**, seamlessly interlocking the 5 agent operational disciplines with the 5-phase domain engineering pipeline:
45
- ```
46
- 1. DISCOVER / REQUIREMENTS ──► Read-only inspection; Problem Space & operational constraints; INVEST stories & Gherkin.
47
- 2. INTERROGATE / DOMAIN ──► Relentless questioning; Ubiquitous Language, Aggregate invariants & state machines.
48
- 3. PLAN / OUTER TDD ──► Minimal blast radius; failing Outer Acceptance Test (UI/API RED).
49
- 4. EXECUTE / INNER TDD ──► Incremental nano-cycles (Uncle Bob's 3 Laws: 1 micro-assertion RED ➔ MINIMAL pass GREEN ➔ REFACTOR).
50
- 5. VERIFY / DoD & PROOF ──► Outer test turns GREEN; boundary smoke tests & 100.00% test coverage.
51
- ```
52
- ---
53
-
54
- ## 3. Progressive Disclosure: Specialized Domain Rules
55
-
56
- To prevent context bloat and keep prompt overhead minimal, detailed engineering and architectural standards are decoupled into dedicated reference files. **Read these files on demand when working in the relevant domain:**
57
-
58
- | Domain | Rule Reference File | When to Consult |
59
- |---|---|---|
60
- | **TDD & Isolation** | [docs/rules/test_driven_development.md](./docs/rules/test_driven_development.md) | Outside-In TDD, Uncle Bob's 3 Laws, 100% coverage, test isolation & DB rollback. |
61
- | **Clean Code** | [docs/rules/clean_code.md](./docs/rules/clean_code.md) | Naming, small functions, CQS, SLAP, DRY, DbC, zero side-effects. |
62
- | **Design Patterns** | [docs/rules/design_patterns.md](./docs/rules/design_patterns.md) | Adapter, Factory, Strategy, Result `<T, E>`, and GoF pattern catalog. |
63
- | **Type Safety** | [docs/rules/type_safety.md](./docs/rules/type_safety.md) | Compiler strictness, branded nominal types, type discriminators across polyglot languages. |
64
- | **Authentication** | [docs/rules/authentication.md](./docs/rules/authentication.md) | In-memory access tokens, refresh token rotation (RTR), WebAuthn passkeys. |
65
- | **Authorization** | [docs/rules/authorization.md](./docs/rules/authorization.md) | CASL, OPA Rego policy engines, OpenFGA ReBAC, server guards. |
66
- | **Multi-Tenancy** | [docs/rules/multitenancy_architecture.md](./docs/rules/multitenancy_architecture.md) | Tenant context, 4 isolation models, RLS, dynamic schemas, pluggable logic & YAGNI gates. |
67
- | **API Architecture** | [docs/rules/api_architecture.md](./docs/rules/api_architecture.md) | HTTP status codes, sync vs async (202), `_actions`, idempotency keys, cursor pagination, OCC, versioning. |
68
- | **Server-Driven UI** | [docs/rules/server_driven_ui.md](./docs/rules/server_driven_ui.md) | Backend-driven layout schemas, multi-renderer component registries, DTCG tokens & YAGNI gate. |
69
- | **Database Design** | [docs/rules/database_design.md](./docs/rules/database_design.md) | Relational integrity, FKs, CHECK constraints, Canonical 6 audit fields, ACID transactions, Outbox CDC. |
70
- | **Database Operations** | [docs/rules/database_operations.md](./docs/rules/database_operations.md) | Zero-downtime expand-contract migrations, N+1 elimination, DataLoader, indexing, pooling, PITR. |
71
- | **Caching** | [docs/rules/caching.md](./docs/rules/caching.md) | Cache Port semantics, Cache-Aside, jittered TTLs, XFetch stampede defense & YAGNI gate. |
72
- | **Security & Compliance** | [docs/rules/security_compliance.md](./docs/rules/security_compliance.md) | OWASP Top 10 defenses, rate limiting, crypto, SOC 2 Type II, ISO 27001, GDPR data erasure. |
73
- | **DevOps & CI/CD** | [docs/rules/devops_ci_cd.md](./docs/rules/devops_ci_cd.md) | Shift-left trunk-based CI, OCI distroless containers, Secretlint/Trivy DevSecOps, zero-downtime CD. |
74
- | **Cloud-Native 12-Factor** | [docs/rules/cloud_native.md](./docs/rules/cloud_native.md) | 12-Factor (2026 Edition), OpenTelemetry (OTel), stateless isolates. |
75
- | **Error Architecture** | [docs/rules/error_handling.md](./docs/rules/error_handling.md) | Fail-fast schema validation, structured OTel/Pino tracing, RFC 7807 envelopes. |
76
- | **Feature Flags** | [docs/rules/feature_flags.md](./docs/rules/feature_flags.md) | OpenFeature standard, Flipt/Unleash backends, targeting, kill switches & YAGNI gate. |
77
- | **Transactional Email** | [docs/rules/transactional_email.md](./docs/rules/transactional_email.md) | Declarative templates (MJML/JSON), safe interpolation, SMTP integration testing. |
78
- | **UI/UX Architecture** | [docs/rules/ui_ux_architecture.md](./docs/rules/ui_ux_architecture.md) | Design triage gate, persistent app shell, collapsible sidebar, dual-experience portals, dev persona. |
79
- | **Frontend Architecture** | [docs/rules/frontend_architecture.md](./docs/rules/frontend_architecture.md) | Accessible headless primitives, WCAG 2.2 AA, server cache sync, form validation, 5-tier state, URL navigation. |
80
- | **Requirements Engineering** | [docs/rules/requirements_engineering.md](./docs/rules/requirements_engineering.md) | User stories vs requirements, 3 C's, INVEST vertical cake slicing, Gherkin. |
81
- | **Product Ownership** | [docs/rules/product_ownership.md](./docs/rules/product_ownership.md) | Product Backlog Management, OKRs, Kano/MoSCoW/RICE, Product Value, empiricism. |
82
- | **Project Management** | [docs/rules/project_management.md](./docs/rules/project_management.md) | Work-In-Progress limits (WIP = 1), SMART developer tasks, Definition of Done. |
83
- | **Domain-Driven Design** | [docs/rules/domain_driven_design.md](./docs/rules/domain_driven_design.md) | Ubiquitous Language, Bounded Contexts, Aggregates, Capability Mapping. |
84
- | **CQRS & Projections** | [docs/rules/cqrs.md](./docs/rules/cqrs.md) | Evolutionary CQRS spectrum, YAGNI defense, read projections, outbox CDC. |
85
- | **Workflow State Machines** | [docs/rules/workflow_state_machines.md](./docs/rules/workflow_state_machines.md) | Configurable workflows, in-aggregate invariant FSMs, transition guards & audit logs & YAGNI gate. |
86
- | **Agentic Governance** | [docs/rules/agentic_configuration.md](./docs/rules/agentic_configuration.md) | Progressive disclosure, ADR ledger, workspace sovereignty, continuous learning, YAGNI gate triad. |
87
- | **Relentless Questioning** | [docs/rules/relentless_questioning.md](./docs/rules/relentless_questioning.md) | Dynamic context-aware interrogation loops, adaptive decision trees. |
88
- ---
89
-
90
- ## 4. Agent Configuration & Workspace Architecture
91
- - **Progressive Disclosure Principle:** Never load all documentation upfront. Rely on the table above to pull specialized instructions only when performing relevant tasks.
92
- - **Nested AGENTS.md for Monorepos:** In multi-package workspaces (e.g. `apps/backend`, `apps/frontend`), place package-specific conventions in nested `AGENTS.md` files scoped strictly to those subtrees.
93
- - **Specialized Skills Catalog:** On-demand multi-step workflows are encapsulated under `.agents/skills/`:
94
- - [`agentic-architect`](.agents/skills/agentic-architect/SKILL.md): Authoring, auditing, and modularizing agent configurations and skills.
95
- - [`product-analyst`](.agents/skills/product-analyst/SKILL.md): Aligning OKRs, backlog ordering (Kano/MoSCoW/RICE), INVEST stories, and Gherkin criteria.
96
- - [`compliance-audit`](.agents/skills/compliance-audit/SKILL.md): Conducting SOC 2, ISO 27001, and OWASP audits using open-source scanners.
97
- - [`clean-code-refactor`](.agents/skills/clean-code-refactor/SKILL.md): Refactoring code smells with Clean Code, SOLID, and design patterns.
98
- - [`lets-build`](.agents/skills/lets-build/SKILL.md): Conducting architecture interviews to finalize stack, frameworks, package managers, and bootstrapping projects.
99
- - [`relentless-questioner`](.agents/skills/relentless-questioner/SKILL.md): Dynamic context-aware interrogation loops before planning and coding.
100
- - **Relentless Skill Architecture Inquiry:** Never author or update skills on assumptions. Interrogate all 7 inquiry branches (placement, trigger intent, domain truth, gotchas/anti-patterns, determinism, progressive bloat, verification loop) defined in [docs/rules/agentic_configuration.md](./docs/rules/agentic_configuration.md) before writing `SKILL.md`.
101
- - **Workspace Memory & Knowledge Hub:** Consult [`memory.md`](./memory.md) for ADRs, and [`docs/knowledge/ubiquitous_language.md`](./docs/knowledge/ubiquitous_language.md) for domain glossaries.
102
- - **Harness Parity & Symlinks:** `AGENTS.md`, `CLAUDE.md`, `agents.md`, `GEMINI.md`, `.cursorrules`, `.windsurfrules`, and `.github/copilot-instructions.md` must remain identical via filesystem symbolic links to eliminate configuration divergence across different agent harnesses.
1
+ # AGENTS.md
2
+
3
+ > **azcodr: Enterprise Architecture & Agentic Engineering Starter Template**
4
+ > **Workspace Mission:** Problem-first, topology-aligned production architectures governed by strict systemic atomicity, 100% open-source standards, true incremental TDD nano-cycles, and zero speculative bloat.
5
+ > **Runtime & Tools:** Node.js (`>=22.8.0`), npm (`>=10.0.0`) | `npm test` (test runner), `npm run test:coverage` (coverage gate), `npm run lint`, `npm run validate`.
6
+ > **Node floor rationale:** `>=22.8.0` is the first release with the native coverage-threshold flags `scripts/test_coverage.js` requires. Node 18 (EOL 2025-04-30) and 20 (EOL 2026-04-30) no longer receive security patches.
7
+ > **Rule Zero:** Assume nothing. Every action must be grounded in verified evidence from this workspace or direct instructions from the user.
8
+ > **Atomicity Mandate:** All rules, skills, code units, migrations, and transactions must be strictly atomic (indivisible, self-contained, composable with full ACID safety).
9
+ > **Architecture Mandate:** Architecture emerges strictly from problem constraints and execution targets (Problem-First; zero tool/platform bias). Match architectural style to problem topology (Hexagonal for backends, Platform Scripting for extensions, Data-Oriented Design for game engines, Command Pipeline for CLIs, Game Loop for canvas games).
10
+
11
+ ---
12
+
13
+ ## 1. Zero-Assumption Operating Framework
14
+ ### Core Principles
15
+ 1. **No External Assumptions:** You have no prior knowledge of external setups, hidden tools, libraries, or unverified conventions outside this workspace.
16
+ 2. **Ground Truth Only:** A statement is only true if proven by a workspace file, verified command output, or direct user instruction.
17
+ 3. **Unknown Until Verified:** If something is not explicitly written in the workspace or stated by the user, treat it as unknown.
18
+ 4. **Strict Open Standards:** Standardize on open-source solutions and open specs (Semgrep, Trivy, Gitleaks, OpenTelemetry, OPA, OCI, Wasm, CloudEvents).
19
+ 5. **Problem-First & Topology Alignment:** Problem domain and operational constraints (latency budget, GC tolerance, memory, execution environment) strictly dictate the architectural style and toolchain. Never select tools before defining the problem space.
20
+ 6. **Evolutionary Architecture & Refactor-Before-Add:** As complexity grows, code must graduate across explicit architectural tipping points. Refactor structure first under existing green tests before implementing new features. Never append code into rotting files.
21
+ 7. **True Incremental TDD & Nano-Cycles:** Never dump test suites in batches ("Test-First Waterfall"). Follow Uncle Bob's Three Laws: write one micro-assertion at a time, verify RED failure output, write minimal code to turn GREEN, and refactor under green.
22
+ 8. **Systemic Atomicity:** Every skill, rule, database transaction, and refactoring step must be atomic (Single Responsibility, zero side-effects, full rollback).
23
+ 9. **Workspace Sovereignty:** Total containment within the local workspace root (`./`). Zero interference from global configs, tools, or sibling projects.
24
+ 10. **Continuous Learning:** Ingest all verified defects, lessons, and architectural invariants directly into domain rules and `memory.md`.
25
+
26
+ ### The 5 Core Branch Questions
27
+ Before acting on any decision branch, answer:
28
+ 1. **Current State:** What do workspace files currently show? (Inspect before assuming).
29
+ 2. **Target Goal:** Is the goal clear, bounded, and explicit? (Stop & ask if ambiguous).
30
+ 3. **Tools & Setup:** Are tools defined in workspace configs? (Never assume commands exist).
31
+ 4. **Impact & Risk:** Have all references, callers, and side effects been traced?
32
+ 5. **Verification:** How will we prove it works with tests or build commands?
33
+
34
+ ### Conflict Resolution & Order of Authority
35
+ 1. **User Request (Current Session)** ➔ 2. **Workspace Configurations** (lockfiles, linters, scripts) ➔ 3. **Existing Code Patterns** ➔ 4. **Direct Confirmation (Stop & Ask)**.
36
+
37
+ ### Action Boundaries
38
+ - **ALWAYS:** Read files before editing; verify commands before running; verify results with evidence.
39
+ - **ASK FIRST:** Adding/removing external dependencies; deleting/renaming files; changing DB schemas or build scripts; modifying existing tests.
40
+ - **NEVER:** Guess paths, flags, or signatures; silently ignore errors; bypass unresolved questions.
41
+ ---
42
+
43
+ ## 2. Execution Lifecycle
44
+
45
+ Progress all tasks systematically through the unified **Agent Cognitive & Agile Domain Lifecycle**, seamlessly interlocking the 5 agent operational disciplines with the 5-phase domain engineering pipeline:
46
+ ```
47
+ 1. DISCOVER / REQUIREMENTS ──► Read-only inspection; Problem Space & operational constraints; INVEST stories & Gherkin.
48
+ 2. INTERROGATE / DOMAIN ──► Relentless questioning; Ubiquitous Language, Aggregate invariants & state machines.
49
+ 3. PLAN / OUTER TDD ──► Minimal blast radius; failing Outer Acceptance Test (UI/API RED).
50
+ 4. EXECUTE / INNER TDD ──► Incremental nano-cycles (Uncle Bob's 3 Laws: 1 micro-assertion RED ➔ MINIMAL pass GREEN ➔ REFACTOR).
51
+ 5. VERIFY / DoD & PROOF ──► Outer test turns GREEN; boundary smoke tests & 100.00% test coverage.
52
+ ```
53
+ ---
54
+
55
+ ## 3. Progressive Disclosure: Specialized Domain Rules
56
+
57
+ To prevent context bloat and keep prompt overhead minimal, detailed engineering and architectural standards are decoupled into dedicated reference files. **Read these files on demand when working in the relevant domain:**
58
+
59
+ | Domain | Rule Reference File | When to Consult |
60
+ |---|---|---|
61
+ | **TDD & Isolation** | [docs/rules/test_driven_development.md](./docs/rules/test_driven_development.md) | Outside-In TDD, Uncle Bob's 3 Laws, 100% coverage, test isolation & DB rollback. |
62
+ | **Clean Code** | [docs/rules/clean_code.md](./docs/rules/clean_code.md) | Naming, small functions, CQS, SLAP, DRY, DbC, zero side-effects. |
63
+ | **Design Patterns** | [docs/rules/design_patterns.md](./docs/rules/design_patterns.md) | Adapter, Factory, Strategy, Result `<T, E>`, and GoF pattern catalog. |
64
+ | **Type Safety** | [docs/rules/type_safety.md](./docs/rules/type_safety.md) | Compiler strictness, branded nominal types, type discriminators across polyglot languages. |
65
+ | **Authentication** | [docs/rules/authentication.md](./docs/rules/authentication.md) | In-memory access tokens, refresh token rotation (RTR), WebAuthn passkeys. |
66
+ | **Authorization** | [docs/rules/authorization.md](./docs/rules/authorization.md) | CASL, OPA Rego policy engines, OpenFGA ReBAC, server guards. |
67
+ | **Multi-Tenancy** | [docs/rules/multitenancy_architecture.md](./docs/rules/multitenancy_architecture.md) | Tenant context, 4 isolation models, RLS, dynamic schemas, pluggable logic & YAGNI gates. |
68
+ | **API Architecture** | [docs/rules/api_architecture.md](./docs/rules/api_architecture.md) | HTTP status codes, sync vs async (202), `_actions`, idempotency keys, cursor pagination, OCC, versioning. |
69
+ | **Server-Driven UI** | [docs/rules/server_driven_ui.md](./docs/rules/server_driven_ui.md) | Backend-driven layout schemas, multi-renderer component registries, DTCG tokens & YAGNI gate. |
70
+ | **Database Design** | [docs/rules/database_design.md](./docs/rules/database_design.md) | Relational integrity, FKs, CHECK constraints, Canonical 6 audit fields, ACID transactions, Outbox CDC. |
71
+ | **Database Operations** | [docs/rules/database_operations.md](./docs/rules/database_operations.md) | Zero-downtime expand-contract migrations, N+1 elimination, DataLoader, indexing, pooling, PITR. |
72
+ | **Caching** | [docs/rules/caching.md](./docs/rules/caching.md) | Cache Port semantics, Cache-Aside, jittered TTLs, XFetch stampede defense & YAGNI gate. |
73
+ | **Security & Compliance** | [docs/rules/security_compliance.md](./docs/rules/security_compliance.md) | OWASP Top 10 defenses, rate limiting, crypto, SOC 2 Type II, ISO 27001, GDPR data erasure. |
74
+ | **DevOps & CI/CD** | [docs/rules/devops_ci_cd.md](./docs/rules/devops_ci_cd.md) | Shift-left trunk-based CI, OCI distroless containers, Secretlint/Trivy DevSecOps, zero-downtime CD. |
75
+ | **Cloud-Native 12-Factor** | [docs/rules/cloud_native.md](./docs/rules/cloud_native.md) | 12-Factor (2026 Edition), OpenTelemetry (OTel), stateless isolates. |
76
+ | **Error Architecture** | [docs/rules/error_handling.md](./docs/rules/error_handling.md) | Fail-fast schema validation, structured OTel/Pino tracing, RFC 9457 envelopes. |
77
+ | **Feature Flags** | [docs/rules/feature_flags.md](./docs/rules/feature_flags.md) | OpenFeature standard, Flipt/Unleash backends, targeting, kill switches & YAGNI gate. |
78
+ | **Transactional Email** | [docs/rules/transactional_email.md](./docs/rules/transactional_email.md) | Declarative templates (MJML/JSON), safe interpolation, SMTP integration testing. |
79
+ | **UI/UX Architecture** | [docs/rules/ui_ux_architecture.md](./docs/rules/ui_ux_architecture.md) | Design triage gate, persistent app shell, collapsible sidebar, dual-experience portals, dev persona. |
80
+ | **Frontend Architecture** | [docs/rules/frontend_architecture.md](./docs/rules/frontend_architecture.md) | Accessible headless primitives, WCAG 2.2 AA, server cache sync, form validation, 5-tier state, URL navigation. |
81
+ | **Requirements Engineering** | [docs/rules/requirements_engineering.md](./docs/rules/requirements_engineering.md) | User stories vs requirements, 3 C's, INVEST vertical cake slicing, Gherkin. |
82
+ | **Product Ownership** | [docs/rules/product_ownership.md](./docs/rules/product_ownership.md) | Product Backlog Management, OKRs, Kano/MoSCoW/RICE, Product Value, empiricism. |
83
+ | **Project Management** | [docs/rules/project_management.md](./docs/rules/project_management.md) | Work-In-Progress limits (WIP = 1), SMART developer tasks, Definition of Done. |
84
+ | **Domain-Driven Design** | [docs/rules/domain_driven_design.md](./docs/rules/domain_driven_design.md) | Ubiquitous Language, Bounded Contexts, Aggregates, Capability Mapping. |
85
+ | **CQRS & Projections** | [docs/rules/cqrs.md](./docs/rules/cqrs.md) | Evolutionary CQRS spectrum, YAGNI defense, read projections, outbox CDC. |
86
+ | **Workflow State Machines** | [docs/rules/workflow_state_machines.md](./docs/rules/workflow_state_machines.md) | Configurable workflows, in-aggregate invariant FSMs, transition guards & audit logs & YAGNI gate. |
87
+ | **Agentic Governance** | [docs/rules/agentic_configuration.md](./docs/rules/agentic_configuration.md) | Progressive disclosure, ADR ledger, workspace sovereignty, continuous learning, YAGNI gate triad. |
88
+ | **Relentless Questioning** | [docs/rules/relentless_questioning.md](./docs/rules/relentless_questioning.md) | Dynamic context-aware interrogation loops, adaptive decision trees. |
89
+ ---
90
+
91
+ ## 4. Agent Configuration & Workspace Architecture
92
+ - **Progressive Disclosure Principle:** Never load all documentation upfront. Rely on the table above to pull specialized instructions only when performing relevant tasks.
93
+ - **Nested AGENTS.md for Monorepos:** In multi-package workspaces (e.g. `apps/backend`, `apps/frontend`), place package-specific conventions in nested `AGENTS.md` files scoped strictly to those subtrees.
94
+ - **Specialized Skills Catalog:** On-demand multi-step workflows are encapsulated under `.agents/skills/`:
95
+ - [`agentic-architect`](.agents/skills/agentic-architect/SKILL.md): Authoring, auditing, and modularizing agent configurations and skills.
96
+ - [`product-analyst`](.agents/skills/product-analyst/SKILL.md): Aligning OKRs, backlog ordering (Kano/MoSCoW/RICE), INVEST stories, and Gherkin criteria.
97
+ - [`compliance-audit`](.agents/skills/compliance-audit/SKILL.md): Conducting SOC 2, ISO 27001, and OWASP audits using open-source scanners.
98
+ - [`clean-code-refactor`](.agents/skills/clean-code-refactor/SKILL.md): Refactoring code smells with Clean Code, SOLID, and design patterns.
99
+ - [`lets-build`](.agents/skills/lets-build/SKILL.md): Conducting architecture interviews to finalize stack, frameworks, package managers, and bootstrapping projects.
100
+ - [`relentless-questioner`](.agents/skills/relentless-questioner/SKILL.md): Dynamic context-aware interrogation loops before planning and coding.
101
+ - **Relentless Skill Architecture Inquiry:** Never author or update skills on assumptions. Interrogate all 7 inquiry branches (placement, trigger intent, domain truth, gotchas/anti-patterns, determinism, progressive bloat, verification loop) defined in [docs/rules/agentic_configuration.md](./docs/rules/agentic_configuration.md) before writing `SKILL.md`.
102
+ - **Workspace Memory & Knowledge Hub:** Consult [`memory.md`](./memory.md) for ADRs, and [`docs/knowledge/ubiquitous_language.md`](./docs/knowledge/ubiquitous_language.md) for domain glossaries.
103
+ - **Harness Parity & Symlinks:** `AGENTS.md`, `CLAUDE.md`, `agents.md`, `GEMINI.md`, `.cursorrules`, `.windsurfrules`, and `.github/copilot-instructions.md` must remain identical via filesystem symbolic links to eliminate configuration divergence across different agent harnesses.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Subodh Khanal
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Subodh Khanal
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.