azcodr 1.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.
- package/.agents/skills/agentic-architect/SKILL.md +118 -0
- package/.agents/skills/agentic-architect/references/agents_md_template.md +59 -0
- package/.agents/skills/agentic-architect/references/refinement_workflow.md +32 -0
- package/.agents/skills/agentic-architect/references/skill_architecture_inquiry.md +63 -0
- package/.agents/skills/agentic-architect/references/skill_template.md +55 -0
- package/.agents/skills/agentic-architect/scripts/validate_agentic_configs.sh +163 -0
- package/.agents/skills/clean-code-refactor/SKILL.md +91 -0
- package/.agents/skills/clean-code-refactor/references/clean_code_smells.md +27 -0
- package/.agents/skills/clean-code-refactor/references/design_patterns_ts.md +65 -0
- package/.agents/skills/compliance-audit/SKILL.md +120 -0
- package/.agents/skills/compliance-audit/references/owasp_top10_controls.md +16 -0
- package/.agents/skills/compliance-audit/references/soc2_iso_controls.md +28 -0
- package/.agents/skills/lets-build/SKILL.md +164 -0
- package/.agents/skills/lets-build/references/architecture_interview_matrix.md +188 -0
- package/.agents/skills/lets-build/references/hexagonal_bootstrap_scaffolds.md +113 -0
- package/.agents/skills/lets-build/references/project_readme_template.md +79 -0
- package/.agents/skills/lets-build/scripts/bootstrap_workspace.sh +68 -0
- package/.agents/skills/merge-ai/SKILL.md +90 -0
- package/.agents/skills/merge-ai/scripts/audit_divergence.sh +108 -0
- package/.agents/skills/merge-ai/scripts/resolve_repo.sh +177 -0
- package/.agents/skills/product-analyst/SKILL.md +143 -0
- package/.agents/skills/product-analyst/references/backlog_ordering_techniques.md +107 -0
- package/.agents/skills/product-analyst/references/gherkin_patterns.md +46 -0
- package/.agents/skills/product-analyst/references/invest_checklist.md +38 -0
- package/.agents/skills/product-analyst/references/okr_alignment_guide.md +76 -0
- package/.agents/skills/product-analyst/references/smart_tasks.md +59 -0
- package/.agents/skills/relentless-questioner/SKILL.md +120 -0
- package/.agents/skills/relentless-questioner/references/adaptive_question_trees.md +84 -0
- package/.gitignore +20 -0
- package/AGENTS.md +119 -0
- package/LICENSE +21 -0
- package/README.md +184 -0
- package/bin/azcodr.js +151 -0
- package/docs/knowledge/dos_and_donts.md +540 -0
- package/docs/knowledge/issue_log.md +25 -0
- package/docs/knowledge/knowledge_graph.md +188 -0
- package/docs/knowledge/lessons_learned.md +107 -0
- package/docs/knowledge/ubiquitous_language.md +23 -0
- package/docs/rules/accessibility.md +31 -0
- package/docs/rules/advanced_api_patterns.md +104 -0
- package/docs/rules/agentic_configuration.md +168 -0
- package/docs/rules/api_versioning.md +128 -0
- package/docs/rules/application_security.md +23 -0
- package/docs/rules/architecture_decision_records.md +42 -0
- package/docs/rules/authentication.md +76 -0
- package/docs/rules/authorization.md +75 -0
- package/docs/rules/caching.md +52 -0
- package/docs/rules/clean_code.md +25 -0
- package/docs/rules/cloud_native.md +43 -0
- package/docs/rules/compliance.md +25 -0
- package/docs/rules/container_infrastructure.md +32 -0
- package/docs/rules/continuous_deployment.md +24 -0
- package/docs/rules/continuous_integration.md +20 -0
- package/docs/rules/continuous_learning.md +29 -0
- package/docs/rules/database_integrity.md +88 -0
- package/docs/rules/database_migrations.md +41 -0
- package/docs/rules/database_operations.md +27 -0
- package/docs/rules/database_performance.md +44 -0
- package/docs/rules/database_transactions.md +81 -0
- package/docs/rules/design_patterns.md +40 -0
- package/docs/rules/devsecops.md +33 -0
- package/docs/rules/domain_driven_design.md +84 -0
- package/docs/rules/domain_expertise.md +42 -0
- package/docs/rules/error_handling.md +39 -0
- package/docs/rules/feature_flags.md +42 -0
- package/docs/rules/gof_design_patterns_reference.md +70 -0
- package/docs/rules/multitenancy_isolation.md +86 -0
- package/docs/rules/product_ownership.md +150 -0
- package/docs/rules/project_management.md +66 -0
- package/docs/rules/react.md +88 -0
- package/docs/rules/relentless_questioning.md +48 -0
- package/docs/rules/requirements_engineering.md +113 -0
- package/docs/rules/rest_api_conventions.md +62 -0
- package/docs/rules/server_driven_ui.md +71 -0
- package/docs/rules/tenant_dynamic_schemas.md +88 -0
- package/docs/rules/tenant_pluggable_logic.md +59 -0
- package/docs/rules/test_driven_development.md +106 -0
- package/docs/rules/test_isolation.md +26 -0
- package/docs/rules/transactional_email.md +20 -0
- package/docs/rules/typescript.md +55 -0
- package/docs/rules/ui_navigation.md +20 -0
- package/docs/rules/ui_ux_architecture.md +168 -0
- package/docs/rules/upstream_synchronization.md +66 -0
- package/docs/rules/workflow_state_machines.md +118 -0
- package/docs/rules/workspace_isolation.md +25 -0
- package/lib/index.js +5 -0
- package/lib/scaffold.js +177 -0
- package/memory.md +262 -0
- package/package.json +49 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
> **Operating Framework & Agent Directives**
|
|
4
|
+
> **Rule Zero:** Assume nothing. Every action must be grounded in verified evidence from this workspace or direct instructions from the user.
|
|
5
|
+
> **Open-Source Mandate:** Always utilize 100% open-source tools, frameworks, libraries, and packages across all architectural domains.
|
|
6
|
+
> **Atomicity Mandate:** All rules, skills, code units, migrations, and transactions must be strictly atomic (indivisible, self-contained, and composable with full ACID safety).
|
|
7
|
+
> **Agnostic Mandate:** Decouple domain core from transient technologies, languages, and stacks (Hexagonal Ports & Adapters; zero language bias).
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 1. Zero-Assumption Operating Framework
|
|
12
|
+
### Core Principles
|
|
13
|
+
1. **No External Assumptions:** You have no prior knowledge of external setups, hidden tools, libraries, or unverified conventions outside this workspace.
|
|
14
|
+
2. **Ground Truth Only:** A statement is only true if proven by a workspace file, verified command output, or direct user instruction.
|
|
15
|
+
3. **Unknown Until Verified:** If something is not explicitly written in the workspace or stated by the user, treat it as unknown.
|
|
16
|
+
4. **Strict Open Standards:** Standardize on open-source solutions and open specs (Semgrep, Trivy, Gitleaks, OpenTelemetry, OPA, OCI, Wasm, CloudEvents).
|
|
17
|
+
5. **Universal Agnosticism:** Core business rules are technology-, language-, and stack-agnostic; runtimes connect via swappable adapters with zero language bias.
|
|
18
|
+
6. **Systemic Atomicity:** Every skill, rule, database transaction, and refactoring step must be atomic (Single Responsibility, zero side-effects, full rollback).
|
|
19
|
+
7. **Workspace Sovereignty:** Total containment within the local workspace root (`./`). Zero interference from global configs, tools, or sibling projects.
|
|
20
|
+
8. **Continuous Learning:** Log all defects, DO's/DONT's, and lessons into `docs/knowledge/` and `memory.md`, dynamically updating atomic rules.
|
|
21
|
+
|
|
22
|
+
### The 5 Core Branch Questions
|
|
23
|
+
Before acting on any decision branch, answer:
|
|
24
|
+
1. **Current State:** What do workspace files currently show? (Inspect before assuming).
|
|
25
|
+
2. **Target Goal:** Is the goal clear, bounded, and explicit? (Stop & ask if ambiguous).
|
|
26
|
+
3. **Tools & Setup:** Are tools defined in workspace configs? (Never assume commands exist).
|
|
27
|
+
4. **Impact & Risk:** Have all references, callers, and side effects been traced?
|
|
28
|
+
5. **Verification:** How will we prove it works with tests or build commands?
|
|
29
|
+
|
|
30
|
+
### Conflict Resolution & Order of Authority
|
|
31
|
+
1. **User Request (Current Session)** ā 2. **Workspace Configurations** (lockfiles, linters, scripts) ā 3. **Existing Code Patterns** ā 4. **Direct Confirmation (Stop & Ask)**.
|
|
32
|
+
|
|
33
|
+
### Action Boundaries
|
|
34
|
+
- **ALWAYS:** Read files before editing; verify commands before running; verify results with evidence.
|
|
35
|
+
- **ASK FIRST:** Adding/removing external dependencies; deleting/renaming files; changing DB schemas or build scripts; modifying existing tests.
|
|
36
|
+
- **NEVER:** Guess paths, flags, or signatures; silently ignore errors; bypass unresolved questions.
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 2. Execution Lifecycle
|
|
40
|
+
|
|
41
|
+
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:
|
|
42
|
+
```
|
|
43
|
+
1. DISCOVER / REQUIREMENTS āāāŗ Read-only inspection; INVEST user stories & executable Gherkin scenarios.
|
|
44
|
+
2. INTERROGATE / DOMAIN āāāŗ Relentless questioning; Ubiquitous Language & domain invariants.
|
|
45
|
+
3. PLAN / OUTER TDD āāāŗ Minimal blast radius; failing Outer Acceptance Test (UI/API RED).
|
|
46
|
+
4. EXECUTE / INNER TDD āāāŗ Surgical edits; Inner TDD collaborator discovery (RED-GREEN-REFACTOR).
|
|
47
|
+
5. VERIFY / DoD & PROOF āāāŗ Outer test turns GREEN; boundary smoke tests & 100.00% test coverage.
|
|
48
|
+
```
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 3. Progressive Disclosure: Specialized Domain Rules
|
|
52
|
+
|
|
53
|
+
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:**
|
|
54
|
+
|
|
55
|
+
| Domain | Rule Reference File | When to Consult |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| **TDD Double Loop** | [docs/rules/test_driven_development.md](./docs/rules/test_driven_development.md) | Outside-In TDD (London School), collaborator discovery, mock ownership. |
|
|
58
|
+
| **Test Coverage & Isolation** | [docs/rules/test_isolation.md](./docs/rules/test_isolation.md) | 100.00% full-stack coverage, status codes, transactional DB rollback. |
|
|
59
|
+
| **Clean Code** | [docs/rules/clean_code.md](./docs/rules/clean_code.md) | Naming, small functions, CQS, SLAP, DRY, DbC, zero side-effects. |
|
|
60
|
+
| **Design Patterns** | [docs/rules/design_patterns.md](./docs/rules/design_patterns.md) | Adapter, Factory, Facade, Strategy, and Result `<T, E>` pattern. |
|
|
61
|
+
| **GoF Design Patterns** | [docs/rules/gof_design_patterns_reference.md](./docs/rules/gof_design_patterns_reference.md) | Complete reference of all 23 GoF patterns across OOP and functional paradigms. |
|
|
62
|
+
| **Type Safety** | [docs/rules/typescript.md](./docs/rules/typescript.md) | Compiler strictness, branded nominal types, type safety, static sound invariants. |
|
|
63
|
+
| **ADRs** | [docs/rules/architecture_decision_records.md](./docs/rules/architecture_decision_records.md) | Authoring Lightweight Architectural Decision Records in `memory.md`. |
|
|
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 Isolation** | [docs/rules/multitenancy_isolation.md](./docs/rules/multitenancy_isolation.md) | Tenant context resolution, 4 universal data isolation models, RLS/interceptor safety. |
|
|
67
|
+
| **REST API Conventions** | [docs/rules/rest_api_conventions.md](./docs/rules/rest_api_conventions.md) | Standard HTTP status codes, enumeration masking, subresource endpoints. |
|
|
68
|
+
| **Advanced API Patterns** | [docs/rules/advanced_api_patterns.md](./docs/rules/advanced_api_patterns.md) | Allowed Actions (`_actions`), Idempotency keys, cursor pagination, OCC. |
|
|
69
|
+
| **API Versioning** | [docs/rules/api_versioning.md](./docs/rules/api_versioning.md) | URI versioning (`/v1/`), RFC 8594 Sunset/Deprecation headers, 90-day window. |
|
|
70
|
+
| **Tenant Dynamic Schemas** | [docs/rules/tenant_dynamic_schemas.md](./docs/rules/tenant_dynamic_schemas.md) | Hybrid core + JSON/document storage, JSON Schema Draft 2020-12, meta-schemas. |
|
|
71
|
+
| **Tenant Pluggable Logic** | [docs/rules/tenant_pluggable_logic.md](./docs/rules/tenant_pluggable_logic.md) | Common Expression Language (CEL), Wasm sandboxing, durable workflows (Temporal/BPMN). |
|
|
72
|
+
| **Server-Driven UI** | [docs/rules/server_driven_ui.md](./docs/rules/server_driven_ui.md) | Client-agnostic layout schemas, multi-renderer component registries, DTCG tokens. |
|
|
73
|
+
| **Database Transactions** | [docs/rules/database_transactions.md](./docs/rules/database_transactions.md) | ACID atomicity, isolation levels, defensive timeouts, transactional outbox. |
|
|
74
|
+
| **Database Migrations** | [docs/rules/database_migrations.md](./docs/rules/database_migrations.md) | Declarative/versioned migrations (Atlas/Flyway), zero-downtime expand-contract. |
|
|
75
|
+
| **Database Integrity** | [docs/rules/database_integrity.md](./docs/rules/database_integrity.md) | Foreign keys, domain CHECK constraints, interval EXCLUDE, soft-delete indexes. |
|
|
76
|
+
| **Database Operations** | [docs/rules/database_operations.md](./docs/rules/database_operations.md) | Continuous PITR, autovacuum/defrag tuning, connection pooling, role separation. |
|
|
77
|
+
| **Database Performance** | [docs/rules/database_performance.md](./docs/rules/database_performance.md) | Eliminating N+1 queries, DataLoader batching, composite tenant indexes. |
|
|
78
|
+
| **Caching** | [docs/rules/caching.md](./docs/rules/caching.md) | Cache Port semantics, Cache-Aside, jittered TTLs, XFetch stampede defense. |
|
|
79
|
+
| **Application Security** | [docs/rules/application_security.md](./docs/rules/application_security.md) | OWASP Top 10 defenses, cryptographic rigor, token bucket rate limiting. |
|
|
80
|
+
| **Regulatory Compliance** | [docs/rules/compliance.md](./docs/rules/compliance.md) | SOC 2 Type II controls, ISO/IEC 27001 ISMS, GDPR data erasure rights. |
|
|
81
|
+
| **DevSecOps** | [docs/rules/devsecops.md](./docs/rules/devsecops.md) | Secretlint pre-commit gating, CycloneDX SBOM generation, Trivy/Grype scanning. |
|
|
82
|
+
| **Error Architecture** | [docs/rules/error_handling.md](./docs/rules/error_handling.md) | Fail-fast schema validation, structured OTel/Pino tracing, RFC 7807 envelopes. |
|
|
83
|
+
| **Feature Flags** | [docs/rules/feature_flags.md](./docs/rules/feature_flags.md) | OpenFeature standard, Flipt/Unleash backends, targeting, kill switches. |
|
|
84
|
+
| **Continuous Integration** | [docs/rules/continuous_integration.md](./docs/rules/continuous_integration.md) | Shift-left automated pipelines, trunk-based development, build caching. |
|
|
85
|
+
| **Continuous Deployment** | [docs/rules/continuous_deployment.md](./docs/rules/continuous_deployment.md) | Zero-downtime rollouts, Cosign container signing, container minimization. |
|
|
86
|
+
| **Container Infrastructure** | [docs/rules/container_infrastructure.md](./docs/rules/container_infrastructure.md) | Unified gateway, minimal OCI distroless/scratch containers, non-root user security. |
|
|
87
|
+
| **Transactional Email** | [docs/rules/transactional_email.md](./docs/rules/transactional_email.md) | Declarative templates (MJML/JSON), safe interpolation, SMTP integration testing. |
|
|
88
|
+
| **Accessibility** | [docs/rules/accessibility.md](./docs/rules/accessibility.md) | WCAG 2.2 AA compliance, accessible primitives, focus trapping, ARIA live regions. |
|
|
89
|
+
| **UI Navigation** | [docs/rules/ui_navigation.md](./docs/rules/ui_navigation.md) | Bidirectional URL state synchronization, deep linking, search params. |
|
|
90
|
+
| **UI/UX Architecture** | [docs/rules/ui_ux_architecture.md](./docs/rules/ui_ux_architecture.md) | Design triage, persistent app shell, collapsible sidebar, dual-experience portals. |
|
|
91
|
+
| **React & Frontend** | [docs/rules/react.md](./docs/rules/react.md) | Modern React, shadcn/ui, TanStack Query, React Hook Form, and Zod validation. |
|
|
92
|
+
| **Requirements Engineering** | [docs/rules/requirements_engineering.md](./docs/rules/requirements_engineering.md) | User stories vs requirements, 3 C's, INVEST vertical cake slicing, Gherkin. |
|
|
93
|
+
| **Product Ownership** | [docs/rules/product_ownership.md](./docs/rules/product_ownership.md) | Product Backlog Management, OKRs, Kano/MoSCoW/RICE, Product Value, empiricism. |
|
|
94
|
+
| **Domain-Driven Design** | [docs/rules/domain_driven_design.md](./docs/rules/domain_driven_design.md) | Ubiquitous Language, Bounded Contexts, Value Objects, Aggregates. |
|
|
95
|
+
| **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. |
|
|
96
|
+
| **Cloud-Native 12-Factor** | [docs/rules/cloud_native.md](./docs/rules/cloud_native.md) | 12-Factor (2026 Edition), OpenTelemetry (OTel), stateless isolates. |
|
|
97
|
+
| **Agentic Config & Skills** | [docs/rules/agentic_configuration.md](./docs/rules/agentic_configuration.md) | Progressive disclosure architecture, skill inquiry branches, refinement loop. |
|
|
98
|
+
| **Project Management** | [docs/rules/project_management.md](./docs/rules/project_management.md) | Work-In-Progress limits (WIP = 1), SMART developer tasks, Definition of Done. |
|
|
99
|
+
| **Domain Modeling** | [docs/rules/domain_expertise.md](./docs/rules/domain_expertise.md) | Business capabilities, Aggregate Root invariants, Ubiquitous Language. |
|
|
100
|
+
| **Relentless Questioning** | [docs/rules/relentless_questioning.md](./docs/rules/relentless_questioning.md) | Dynamic context-aware interrogation loops, adaptive decision trees. |
|
|
101
|
+
| **Workspace Isolation** | [docs/rules/workspace_isolation.md](./docs/rules/workspace_isolation.md) | Strict workspace sovereignty, zero global contamination, local ground truth. |
|
|
102
|
+
| **Continuous Learning** | [docs/rules/continuous_learning.md](./docs/rules/continuous_learning.md) | Automated defect post-mortems, DO's/DONT's logging, dynamic rule updates. |
|
|
103
|
+
| **Upstream Sync** | [docs/rules/upstream_synchronization.md](./docs/rules/upstream_synchronization.md) | Syncing generic AI knowledge to upstream baselines; zero domain contamination. |
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 4. Agent Configuration & Workspace Architecture
|
|
107
|
+
- **Progressive Disclosure Principle:** Never load all documentation upfront. Rely on the table above to pull specialized instructions only when performing relevant tasks.
|
|
108
|
+
- **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.
|
|
109
|
+
- **Specialized Skills Catalog:** On-demand multi-step workflows are encapsulated under `.agents/skills/`:
|
|
110
|
+
- [`agentic-architect`](.agents/skills/agentic-architect/SKILL.md): Authoring, auditing, and modularizing agent configurations and skills.
|
|
111
|
+
- [`product-analyst`](.agents/skills/product-analyst/SKILL.md): Aligning OKRs, backlog ordering (Kano/MoSCoW/RICE), INVEST stories, and Gherkin criteria.
|
|
112
|
+
- [`compliance-audit`](.agents/skills/compliance-audit/SKILL.md): Conducting SOC 2, ISO 27001, and OWASP audits using open-source scanners.
|
|
113
|
+
- [`clean-code-refactor`](.agents/skills/clean-code-refactor/SKILL.md): Refactoring code smells with Clean Code, SOLID, and design patterns.
|
|
114
|
+
- [`lets-build`](.agents/skills/lets-build/SKILL.md): Conducting architecture interviews to finalize stack, frameworks, package managers, and bootstrapping projects.
|
|
115
|
+
- [`relentless-questioner`](.agents/skills/relentless-questioner/SKILL.md): Dynamic context-aware interrogation loops before planning and coding.
|
|
116
|
+
- [`merge-ai`](.agents/skills/merge-ai/SKILL.md): Auditing, filtering, and merging generic rules and skills to upstream baseline.
|
|
117
|
+
- **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`.
|
|
118
|
+
- **Workspace Memory & Knowledge Hub:** Consult [`memory.md`](./memory.md) for ADRs, and [`docs/knowledge/`](./docs/knowledge/knowledge_graph.md) for system topologies, issue logs, and DO's/DONT's.
|
|
119
|
+
- **Harness Parity & Symlinks:** `AGENTS.md`, `CLAUDE.md`, and `agents.md` must remain identical via filesystem symbolic links to eliminate configuration divergence across different agent harnesses.
|
package/LICENSE
ADDED
|
@@ -0,0 +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.
|
package/README.md
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# azcodr: Enterprise Multi-Tenant Architecture & Agentic Engineering
|
|
2
|
+
|
|
3
|
+
> **Production-ready, battle-tested multi-tenant enterprise architecture governed by strict systemic atomicity, 100% open-source standards, universal technology and language agnosticism, progressive disclosure agentic directives, and zero-downtime database patterns.**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## š Architectural Pillars
|
|
8
|
+
|
|
9
|
+
1. **Systemic Atomicity**: Every rule, skill, database transaction, and code unit adheres to the Single Responsibility Principle (SRP)āindivisible, self-contained, orthogonal, and composable with zero conjunction naming.
|
|
10
|
+
2. **Universal Technology & Stack Agnosticism**: Core business capabilities adhere strictly to Hexagonal (Ports & Adapters) architecture with zero runtime, language, or vendor lock-in. Runtimes, databases, and transports connect via interchangeable polyglot adapters with zero primary language bias.
|
|
11
|
+
3. **100% Open-Source & Open Standards**: Standardized exclusively on open-source solutions and vendor-neutral specifications (OpenTelemetry, OPA, OpenFGA, Protocol Buffers, OpenAPI 3.1, JSON Schema Draft 2020-12, CloudEvents, Semgrep, Trivy, Gitleaks, Cosign).
|
|
12
|
+
4. **Zero-Assumption Framework**: Ground truth is established solely through workspace configurations, code evidence, or direct user confirmation.
|
|
13
|
+
5. **Hardened Multi-Tenancy**: 4 interchangeable isolation models (AST query interceptor filtering, schema-per-tenant, database-per-tenant, transparent storage proxy) backed by transaction-scoped session context.
|
|
14
|
+
6. **Dynamic Extensibility Without Code Branching**:
|
|
15
|
+
- Custom tables and columns via hybrid core relational/document models and validated JSON Schema.
|
|
16
|
+
- Pluggable business logic via Common Expression Language (CEL), GoF Strategy registries, and WebAssembly (Wasm) micro-sandboxes.
|
|
17
|
+
- Tenant lifecycles via durable workflows (Temporal / BPMN 2.0 / statecharts).
|
|
18
|
+
- Server-Driven UI (SDUI) component registries and W3C Design Tokens Community Group (DTCG) theming.
|
|
19
|
+
7. **Resilient Database Architecture**: Full ACID atomicity, Transactional Outbox pattern eliminating dual-writes, declarative expand-contract zero-downtime migrations, and continuous Point-In-Time Recovery (PITR).
|
|
20
|
+
8. **Workspace Knowledge Hub & Token Economy**: In-workspace system knowledge graphs, defect post-mortems, and Lightweight Architectural Decision Records (ADRs) to eliminate repetitive token-expensive discovery loops.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## šļø Workspace Architecture
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
.
|
|
28
|
+
āāā .agents/
|
|
29
|
+
ā āāā skills/ # Specialized on-demand agentic workflows
|
|
30
|
+
ā āāā agentic-architect/ # Authoring & auditing agent configurations
|
|
31
|
+
ā āāā clean-code-refactor/ # Refactoring code smells with GoF & Clean Code
|
|
32
|
+
ā āāā compliance-audit/ # SOC 2, ISO 27001 & OWASP open-source audits
|
|
33
|
+
ā āāā lets-build/ # Architecture interview & project bootstrapper
|
|
34
|
+
ā āāā merge-ai/ # Auditing & merging generic AI knowledge to upstream
|
|
35
|
+
ā āāā product-analyst/ # INVEST user stories & Gherkin criteria
|
|
36
|
+
ā āāā relentless-questioner/ # Context-aware dynamic interrogation loop
|
|
37
|
+
āāā docs/
|
|
38
|
+
ā āāā knowledge/ # Institutional knowledge & token economy
|
|
39
|
+
ā ā āāā dos_and_donts.md # Consolidated DO's and DONT's directory
|
|
40
|
+
ā ā āāā issue_log.md # Defect post-mortems & preventing rules
|
|
41
|
+
ā ā āāā knowledge_graph.md # Visual topologies & fast-lookup matrices
|
|
42
|
+
ā ā āāā lessons_learned.md # Strategic architectural takeaways
|
|
43
|
+
ā ā āāā ubiquitous_language.md # Living Ubiquitous Language glossary template
|
|
44
|
+
ā āāā rules/ # 47 atomic single-responsibility domain rules
|
|
45
|
+
āāā AGENTS.md # Lean root agentic configuration (< 120 lines)
|
|
46
|
+
āāā CLAUDE.md -> AGENTS.md # Filesystem symlink for harness parity
|
|
47
|
+
āāā agents.md -> AGENTS.md # Filesystem symlink for harness parity
|
|
48
|
+
āāā memory.md # Master memory hub & Lightweight ADR ledger
|
|
49
|
+
āāā README.md # Project documentation
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## š Progressive Disclosure Rules Catalog (`docs/rules/`)
|
|
55
|
+
|
|
56
|
+
The architecture enforces 47 atomic, single-responsibility domain rules. Read on demand to prevent prompt context bloat:
|
|
57
|
+
|
|
58
|
+
| Domain | Rule Reference File | Key Focus & Invariants |
|
|
59
|
+
|---|---|---|
|
|
60
|
+
| **TDD Double Loop** | [`test_driven_development.md`](./docs/rules/test_driven_development.md) | Outside-In TDD (London School), collaborator discovery, mock ownership. |
|
|
61
|
+
| **Test Coverage & Isolation** | [`test_isolation.md`](./docs/rules/test_isolation.md) | 100.00% full-stack coverage, status codes, transactional DB rollback. |
|
|
62
|
+
| **Clean Code** | [`clean_code.md`](./docs/rules/clean_code.md) | Naming, small functions (< 30 lines), CQS, SLAP, DRY, DbC, zero side-effects. |
|
|
63
|
+
| **Design Patterns** | [`design_patterns.md`](./docs/rules/design_patterns.md) | Adapter, Factory, Facade, Strategy, and Result `<T, E>` pattern. |
|
|
64
|
+
| **GoF Design Patterns** | [`gof_design_patterns_reference.md`](./docs/rules/gof_design_patterns_reference.md) | Complete reference of all 23 GoF patterns across OOP and functional paradigms. |
|
|
65
|
+
| **Type Safety** | [`typescript.md`](./docs/rules/typescript.md) | Compiler strictness, branded nominal types, type safety, static sound invariants. |
|
|
66
|
+
| **ADRs** | [`architecture_decision_records.md`](./docs/rules/architecture_decision_records.md) | Authoring Lightweight Architectural Decision Records in `memory.md`. |
|
|
67
|
+
| **Authentication** | [`authentication.md`](./docs/rules/authentication.md) | In-memory access tokens, refresh token rotation (RTR), WebAuthn passkeys. |
|
|
68
|
+
| **Authorization** | [`authorization.md`](./docs/rules/authorization.md) | CASL, OPA Rego policy engines, OpenFGA ReBAC, server guards. |
|
|
69
|
+
| **Multi-Tenancy Isolation** | [`multitenancy_isolation.md`](./docs/rules/multitenancy_isolation.md) | Tenant context resolution, 4 universal data isolation models, RLS/interceptor safety. |
|
|
70
|
+
| **REST API Conventions** | [`rest_api_conventions.md`](./docs/rules/rest_api_conventions.md) | Standard HTTP status codes, enumeration masking, subresource endpoints. |
|
|
71
|
+
| **Advanced API Patterns** | [`advanced_api_patterns.md`](./docs/rules/advanced_api_patterns.md) | Allowed Actions (`_actions`), Idempotency keys, cursor pagination, OCC. |
|
|
72
|
+
| **API Versioning** | [`api_versioning.md`](./docs/rules/api_versioning.md) | URI versioning (`/v1/`), RFC 8594 Sunset/Deprecation headers, 90-day window. |
|
|
73
|
+
| **Tenant Dynamic Schemas** | [`tenant_dynamic_schemas.md`](./docs/rules/tenant_dynamic_schemas.md) | Hybrid core + JSON/document storage, JSON Schema Draft 2020-12, meta-schemas. |
|
|
74
|
+
| **Tenant Pluggable Logic** | [`tenant_pluggable_logic.md`](./docs/rules/tenant_pluggable_logic.md) | Common Expression Language (CEL), Wasm sandboxing, durable workflows (Temporal/BPMN). |
|
|
75
|
+
| **Server-Driven UI** | [`server_driven_ui.md`](./docs/rules/server_driven_ui.md) | Client-agnostic layout schemas, multi-renderer component registries, DTCG tokens. |
|
|
76
|
+
| **Database Transactions** | [`database_transactions.md`](./docs/rules/database_transactions.md) | ACID atomicity, isolation levels, defensive timeouts, transactional outbox. |
|
|
77
|
+
| **Database Migrations** | [`database_migrations.md`](./docs/rules/database_migrations.md) | Declarative/versioned migrations (Atlas/Flyway), zero-downtime expand-contract. |
|
|
78
|
+
| **Database Integrity** | [`database_integrity.md`](./docs/rules/database_integrity.md) | Foreign keys, domain CHECK constraints, interval EXCLUDE, soft-delete indexes. |
|
|
79
|
+
| **Database Operations** | [`database_operations.md`](./docs/rules/database_operations.md) | Continuous PITR, autovacuum/defrag tuning, connection pooling, role separation. |
|
|
80
|
+
| **Database Performance** | [`database_performance.md`](./docs/rules/database_performance.md) | Eliminating N+1 queries, DataLoader batching, composite tenant indexes. |
|
|
81
|
+
| **Caching** | [`caching.md`](./docs/rules/caching.md) | Cache Port semantics, Cache-Aside, jittered TTLs, XFetch stampede defense. |
|
|
82
|
+
| **Application Security** | [`application_security.md`](./docs/rules/application_security.md) | OWASP Top 10 defenses, cryptographic rigor, token bucket rate limiting. |
|
|
83
|
+
| **Regulatory Compliance** | [`compliance.md`](./docs/rules/compliance.md) | SOC 2 Type II controls, ISO/IEC 27001 ISMS, GDPR data erasure rights. |
|
|
84
|
+
| **DevSecOps** | [`devsecops.md`](./docs/rules/devsecops.md) | Secretlint pre-commit gating, CycloneDX SBOM generation, Trivy/Grype scanning. |
|
|
85
|
+
| **Error Architecture** | [`error_handling.md`](./docs/rules/error_handling.md) | Fail-fast schema validation, structured OTel/Pino tracing, RFC 7807 envelopes. |
|
|
86
|
+
| **Feature Flags** | [`feature_flags.md`](./docs/rules/feature_flags.md) | OpenFeature standard, Flipt/Unleash backends, targeting, kill switches. |
|
|
87
|
+
| **Continuous Integration** | [`continuous_integration.md`](./docs/rules/continuous_integration.md) | Shift-left automated pipelines, trunk-based development, build caching. |
|
|
88
|
+
| **Continuous Deployment** | [`continuous_deployment.md`](./docs/rules/continuous_deployment.md) | Zero-downtime rollouts, Cosign container signing, container minimization. |
|
|
89
|
+
| **Container Infrastructure** | [`container_infrastructure.md`](./docs/rules/container_infrastructure.md) | Unified gateway, minimal OCI distroless/scratch containers, non-root user security. |
|
|
90
|
+
| **Transactional Email** | [`transactional_email.md`](./docs/rules/transactional_email.md) | Declarative templates (MJML/JSON), safe interpolation, SMTP integration testing. |
|
|
91
|
+
| **Accessibility** | [`accessibility.md`](./docs/rules/accessibility.md) | WCAG 2.2 AA compliance, accessible primitives, focus trapping, ARIA live regions. |
|
|
92
|
+
| **UI Navigation** | [`ui_navigation.md`](./docs/rules/ui_navigation.md) | Bidirectional URL state synchronization, deep linking, search params. |
|
|
93
|
+
| **UI/UX Architecture** | [`ui_ux_architecture.md`](./docs/rules/ui_ux_architecture.md) | Design triage, persistent app shell, collapsible sidebar, dual-experience portals. |
|
|
94
|
+
| **React & Frontend** | [`react.md`](./docs/rules/react.md) | Modern React, shadcn/ui, TanStack Query, React Hook Form, and Zod validation. |
|
|
95
|
+
| **Requirements Engineering** | [`requirements_engineering.md`](./docs/rules/requirements_engineering.md) | User stories vs requirements, 3 C's, INVEST vertical cake slicing, Gherkin. |
|
|
96
|
+
| **Product Ownership** | [`product_ownership.md`](./docs/rules/product_ownership.md) | Product Backlog Management, OKRs, Kano/MoSCoW/RICE, Product Value, empiricism. |
|
|
97
|
+
| **Domain-Driven Design** | [`domain_driven_design.md`](./docs/rules/domain_driven_design.md) | Ubiquitous Language, Bounded Contexts, Value Objects, Aggregates. |
|
|
98
|
+
| **Workflow State Machines** | [`workflow_state_machines.md`](./docs/rules/workflow_state_machines.md) | Configurable workflows, in-aggregate invariant FSMs, transition guards & audit logs. |
|
|
99
|
+
| **Cloud-Native 12-Factor** | [`cloud_native.md`](./docs/rules/cloud_native.md) | 12-Factor (2026 Edition), OpenTelemetry (OTel), stateless isolates. |
|
|
100
|
+
| **Agentic Config & Skills** | [`agentic_configuration.md`](./docs/rules/agentic_configuration.md) | Progressive disclosure architecture, skill inquiry branches, refinement loop. |
|
|
101
|
+
| **Project Management** | [`project_management.md`](./docs/rules/project_management.md) | Work-In-Progress limits (WIP = 1), SMART developer tasks, Definition of Done. |
|
|
102
|
+
| **Domain Modeling** | [`domain_expertise.md`](./docs/rules/domain_expertise.md) | Business capabilities, Aggregate Root invariants, Ubiquitous Language. |
|
|
103
|
+
| **Relentless Questioning** | [`relentless_questioning.md`](./docs/rules/relentless_questioning.md) | Dynamic context-aware interrogation loops, adaptive decision trees. |
|
|
104
|
+
| **Workspace Isolation** | [`workspace_isolation.md`](./docs/rules/workspace_isolation.md) | Strict workspace sovereignty, zero global contamination, local ground truth. |
|
|
105
|
+
| **Continuous Learning** | [`continuous_learning.md`](./docs/rules/continuous_learning.md) | Automated defect post-mortems, DO's/DONT's logging, dynamic rule updates. |
|
|
106
|
+
| **Upstream Sync** | [`upstream_synchronization.md`](./docs/rules/upstream_synchronization.md) | Syncing generic AI knowledge to upstream baselines; zero domain contamination. |
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## š ļø Specialized Skills Catalog (`.agents/skills/`)
|
|
111
|
+
|
|
112
|
+
- [`agentic-architect`](.agents/skills/agentic-architect/SKILL.md): Authoring, auditing, and modularizing agent configurations and skills.
|
|
113
|
+
- [`clean-code-refactor`](.agents/skills/clean-code-refactor/SKILL.md): Refactoring code smells with Clean Code, SOLID, and modern design patterns.
|
|
114
|
+
- [`compliance-audit`](.agents/skills/compliance-audit/SKILL.md): Conducting SOC 2, ISO 27001, and OWASP audits using open-source scanners.
|
|
115
|
+
- [`lets-build`](.agents/skills/lets-build/SKILL.md): Conducting architecture interviews to finalize stack, frameworks, package managers, and bootstrapping projects.
|
|
116
|
+
- [`merge-ai`](.agents/skills/merge-ai/SKILL.md): Auditing, filtering, and merging generic rules and skills to upstream baseline.
|
|
117
|
+
- [`product-analyst`](.agents/skills/product-analyst/SKILL.md): Aligning OKRs, backlog ordering (Kano/MoSCoW/RICE), INVEST stories, and Gherkin criteria.
|
|
118
|
+
- [`relentless-questioner`](.agents/skills/relentless-questioner/SKILL.md): Dynamic context-aware interrogation loops before planning and coding.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## š Starting a New Project with `/lets-build`
|
|
123
|
+
|
|
124
|
+
This repository serves as an **enterprise architectural starter template**. When beginning a new software project:
|
|
125
|
+
|
|
126
|
+
### Step 1: Initialize Workspace with npx
|
|
127
|
+
Pull and scaffold the complete enterprise architectural template into your project directory using `npx`:
|
|
128
|
+
```bash
|
|
129
|
+
npx azcodr my-new-project
|
|
130
|
+
cd my-new-project
|
|
131
|
+
```
|
|
132
|
+
*(Or run `npx azcodr` directly inside your target directory).*
|
|
133
|
+
|
|
134
|
+
### Step 2: Invoke the `/lets-build` Skill
|
|
135
|
+
In your AI coding assistant (Google Antigravity, Claude Code, Cursor, or OpenHands), trigger the workflow:
|
|
136
|
+
```
|
|
137
|
+
/lets-build
|
|
138
|
+
```
|
|
139
|
+
*(Or simply prompt: "Let's build a new project from this template.")*
|
|
140
|
+
|
|
141
|
+
### Step 3: The Relentless Architectural Interview
|
|
142
|
+
The agent will execute a deep research loop and systematically interrogate you across all **18 systemic dimensions** (with zero assumptions) to lock in your desired technical stack:
|
|
143
|
+
|
|
144
|
+
1. **Domain, Scale & Performance**: Problem domain, p95/p99 latency budgets, peak throughput (RPS), and regulatory standards (SOC 2, ISO 27001, GDPR).
|
|
145
|
+
2. **Language & Runtime**: Go, Rust, Python, TypeScript, Java/Kotlin, C# (.NET), Elixir, or Polyglot microservices.
|
|
146
|
+
3. **Package Manager & Toolchain**: `go modules`, `cargo`, `uv`/`poetry`, `pnpm`, `gradle`, or `dotnet CLI`.
|
|
147
|
+
4. **Transport & Network**: REST (OpenAPI 3.1), gRPC (Protobuf v3 via `buf`), GraphQL, or Event-Driven.
|
|
148
|
+
5. **Transport Framework**: Gin, Axum, FastAPI, Fastify, Spring Boot, or ASP.NET Core.
|
|
149
|
+
6. **Database Engine**: PostgreSQL, MySQL, SQLite, CockroachDB, MongoDB, or Hybrid.
|
|
150
|
+
7. **Database Migrations**: Declarative schema migrations (**Atlas**) vs versioned SQL (**Flyway**, **Goose**).
|
|
151
|
+
8. **Multi-Tenancy Isolation**: AST query interceptor, Database RLS, Schema-per-tenant, or DB-per-tenant.
|
|
152
|
+
9. **Dynamic Schemas**: Universal **JSON Schema Draft 2020-12** in semi-structured columns vs EAV.
|
|
153
|
+
10. **Pluggable Logic & Workflows**: Common Expression Language (CEL), WebAssembly (Extism) sandboxing, and Temporal.io / BPMN 2.0.
|
|
154
|
+
11. **Authentication & Identity**: OIDC, OAuth 2.1, Passkeys (FIDO2/WebAuthn), PASETO, or JWT JWKS.
|
|
155
|
+
12. **Authorization Engine**: Open Policy Agent (OPA Rego via HTTP/Wasm), OpenFGA (Zanzibar ReBAC), or Cerbos.
|
|
156
|
+
13. **Frontend / Client**: Web (React, Vue, Svelte), Mobile (Flutter, Native), Server-Driven UI (SDUI), and W3C DTCG Design Tokens.
|
|
157
|
+
14. **Caching & Locks**: Redis, Valkey, Dragonfly, Memcached, or local LRU with XFetch stampede defense.
|
|
158
|
+
15. **Event Streaming**: Apache Kafka, NATS JetStream, RabbitMQ, SQS with Transactional Outbox.
|
|
159
|
+
16. **Observability**: OpenTelemetry OTLP traces/metrics/logs over gRPC/HTTP with W3C trace context.
|
|
160
|
+
17. **DevSecOps & Verification**: Semgrep SAST, Gitleaks, Trivy scanning, CycloneDX SBOM, Cosign, and Outside-In TDD (100% coverage gates).
|
|
161
|
+
18. **Deployment Target**: Minimal OCI Distroless/Scratch, Docker Compose, Kubernetes, and OpenTofu IaC.
|
|
162
|
+
|
|
163
|
+
### Step 4: Blueprint Synthesis & Explicit Approval
|
|
164
|
+
The agent consolidates all your choices into a formal **Architectural Specification & Technology Blueprint** and records a formal ADR in [`memory.md`](./memory.md).
|
|
165
|
+
**The agent will stop and ask for your explicit confirmation before generating any code.**
|
|
166
|
+
|
|
167
|
+
### Step 5: Deterministic Project Bootstrapping
|
|
168
|
+
Once confirmed, the agent automatically executes:
|
|
169
|
+
1. Directory scaffolding following **Hexagonal Architecture** (`src/domain/`, `src/ports/`, `src/adapters/`, `specs/`, `tests/`, `deploy/`).
|
|
170
|
+
2. Canonical contract generation (`specs/openapi/`, `specs/protobuf/`, `specs/schemas/`, `specs/tokens/`).
|
|
171
|
+
3. Build manifests, strict linter/formatter configurations, multi-stage Dockerfiles, and Compose environments.
|
|
172
|
+
4. Domain entities, primary/secondary port interfaces, and initial adapter stubs.
|
|
173
|
+
5. **Project-Specific README Generation**: Completely replaces the starter template `README.md` with clean, project-specific documentation (mission, stack highlights, quickstart setup, build/test commands, and directory structure), preserving links to `docs/rules/`.
|
|
174
|
+
6. Deterministic validation via `validate_agentic_configs.sh` and initial compiler/test suite execution.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## šļø Workspace Memory & Knowledge Hub
|
|
179
|
+
|
|
180
|
+
- šŗļø **[System Knowledge Graph](./docs/knowledge/knowledge_graph.md)**: Visual subsystem topologies and entity-relationship models.
|
|
181
|
+
- š **[Consolidated DO's & DONT's](./docs/knowledge/dos_and_donts.md)**: High-impact engineering invariants and anti-patterns to avoid.
|
|
182
|
+
- š **[Coding Issue Log](./docs/knowledge/issue_log.md)**: Defect post-mortems and preventative rules.
|
|
183
|
+
- š” **[Institutional Lessons Learned](./docs/knowledge/lessons_learned.md)**: Strategic engineering insights.
|
|
184
|
+
- š **[Lightweight ADR Ledger](./memory.md)**: Formal Architectural Decision Records.
|
package/bin/azcodr.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const readline = require('node:readline');
|
|
6
|
+
const { scaffold, getTemplateDir } = require('../lib/scaffold.js');
|
|
7
|
+
const pkg = require('../package.json');
|
|
8
|
+
|
|
9
|
+
const args = process.argv.slice(2);
|
|
10
|
+
|
|
11
|
+
function printHelp() {
|
|
12
|
+
console.log(`
|
|
13
|
+
azcodr v${pkg.version}
|
|
14
|
+
Enterprise Multi-Tenant Architecture & Agentic Engineering Starter Template
|
|
15
|
+
|
|
16
|
+
Usage:
|
|
17
|
+
npx azcodr [directory] [options]
|
|
18
|
+
|
|
19
|
+
Arguments:
|
|
20
|
+
directory Target directory to scaffold (default: current directory)
|
|
21
|
+
|
|
22
|
+
Options:
|
|
23
|
+
-f, --force Overwrite existing files in target directory without confirmation
|
|
24
|
+
--no-git Do not initialize a git repository
|
|
25
|
+
-v, --version Display version number
|
|
26
|
+
-h, --help Display this help message
|
|
27
|
+
|
|
28
|
+
Examples:
|
|
29
|
+
npx azcodr my-project
|
|
30
|
+
npx azcodr . --force
|
|
31
|
+
`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function printVersion() {
|
|
35
|
+
console.log(pkg.version);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function askQuestion(query) {
|
|
39
|
+
const rl = readline.createInterface({
|
|
40
|
+
input: process.stdin,
|
|
41
|
+
output: process.stdout
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
return new Promise((resolve) => {
|
|
45
|
+
rl.question(query, (answer) => {
|
|
46
|
+
rl.close();
|
|
47
|
+
resolve(answer.trim());
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function main() {
|
|
53
|
+
let targetDir = null;
|
|
54
|
+
let force = false;
|
|
55
|
+
let noGit = false;
|
|
56
|
+
|
|
57
|
+
for (let i = 0; i < args.length; i++) {
|
|
58
|
+
const arg = args[i];
|
|
59
|
+
if (arg === '-h' || arg === '--help') {
|
|
60
|
+
printHelp();
|
|
61
|
+
process.exit(0);
|
|
62
|
+
} else if (arg === '-v' || arg === '--version') {
|
|
63
|
+
printVersion();
|
|
64
|
+
process.exit(0);
|
|
65
|
+
} else if (arg === '-f' || arg === '--force') {
|
|
66
|
+
force = true;
|
|
67
|
+
} else if (arg === '--no-git') {
|
|
68
|
+
noGit = true;
|
|
69
|
+
} else if (!arg.startsWith('-')) {
|
|
70
|
+
if (!targetDir) {
|
|
71
|
+
targetDir = arg;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
console.log('\nš azcodr - Enterprise Multi-Tenant Architecture & Agentic Engineering\n');
|
|
77
|
+
|
|
78
|
+
if (!targetDir) {
|
|
79
|
+
if (process.stdin.isTTY) {
|
|
80
|
+
const answer = await askQuestion('? Where would you like to initialize your project? (./) ');
|
|
81
|
+
targetDir = answer || '.';
|
|
82
|
+
} else {
|
|
83
|
+
targetDir = '.';
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const resolvedTarget = path.resolve(process.cwd(), targetDir);
|
|
88
|
+
const templateDir = getTemplateDir();
|
|
89
|
+
|
|
90
|
+
if (resolvedTarget === templateDir) {
|
|
91
|
+
console.error(`ā Error: Cannot scaffold into the template directory itself: ${resolvedTarget}`);
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const fs = require('node:fs');
|
|
96
|
+
if (fs.existsSync(resolvedTarget)) {
|
|
97
|
+
const entries = fs.readdirSync(resolvedTarget);
|
|
98
|
+
if (entries.length > 0 && !force) {
|
|
99
|
+
if (process.stdin.isTTY) {
|
|
100
|
+
const confirm = await askQuestion(
|
|
101
|
+
`ā ļø Target directory '${targetDir}' is not empty (${entries.length} items). Continue? (y/N) `
|
|
102
|
+
);
|
|
103
|
+
if (confirm.toLowerCase() !== 'y' && confirm.toLowerCase() !== 'yes') {
|
|
104
|
+
console.log('Scaffolding aborted.');
|
|
105
|
+
process.exit(0);
|
|
106
|
+
}
|
|
107
|
+
force = true;
|
|
108
|
+
} else {
|
|
109
|
+
console.error(
|
|
110
|
+
`ā Error: Target directory '${resolvedTarget}' is not empty. Use --force to proceed.`
|
|
111
|
+
);
|
|
112
|
+
process.exit(1);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
console.log(`š¦ Scaffolding azcodr into: ${resolvedTarget}`);
|
|
118
|
+
|
|
119
|
+
try {
|
|
120
|
+
const result = scaffold({
|
|
121
|
+
targetDir: resolvedTarget,
|
|
122
|
+
force,
|
|
123
|
+
noGit,
|
|
124
|
+
templateDir
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
console.log(' ā
Progressive disclosure rules copied (docs/rules/)');
|
|
128
|
+
console.log(' ā
Workspace knowledge hub and ADR ledger copied (docs/knowledge/, memory.md)');
|
|
129
|
+
console.log(' ā
Specialized agentic skills copied (.agents/skills/)');
|
|
130
|
+
console.log(' ā
Agent directives and harness symlinks established (AGENTS.md, CLAUDE.md, agents.md)');
|
|
131
|
+
if (result.gitInitialized) {
|
|
132
|
+
console.log(' ā
Git repository initialized');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
console.log('\nš azcodr initialized successfully!\n');
|
|
136
|
+
console.log('Next steps:');
|
|
137
|
+
if (targetDir !== '.' && targetDir !== './') {
|
|
138
|
+
console.log(` 1. cd ${targetDir}`);
|
|
139
|
+
}
|
|
140
|
+
console.log(' 2. Open the project in your AI coding assistant (Antigravity, Claude Code, Cursor, OpenHands)');
|
|
141
|
+
console.log(' 3. Run /lets-build to start the architectural interview and scaffold your application stack!\n');
|
|
142
|
+
} catch (err) {
|
|
143
|
+
console.error(`\nā Scaffolding failed: ${err.message}\n`);
|
|
144
|
+
process.exit(1);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
main().catch((err) => {
|
|
149
|
+
console.error('Unexpected error:', err);
|
|
150
|
+
process.exit(1);
|
|
151
|
+
});
|