azcodr 2.3.0 → 2.4.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/.github/workflows/ci.yml +13 -0
- package/.github/workflows/publish.yml +7 -0
- package/CODE_OF_CONDUCT.md +122 -0
- package/CONTRIBUTING.md +6 -0
- package/README.md +69 -0
- package/lib/cli-boundaries.d.ts +18 -0
- package/lib/cli-boundaries.d.ts.map +1 -0
- package/lib/cli-boundaries.js +46 -0
- package/lib/cli-boundaries.js.map +1 -0
- package/lib/cli-parse.d.ts +2 -1
- package/lib/cli-parse.d.ts.map +1 -1
- package/lib/cli-parse.js +15 -3
- package/lib/cli-parse.js.map +1 -1
- package/lib/cli.d.ts +3 -0
- package/lib/cli.d.ts.map +1 -1
- package/lib/cli.js +18 -4
- package/lib/cli.js.map +1 -1
- package/memory.md +16 -0
- package/package.json +8 -2
- package/src/cli-boundaries.ts +67 -0
- package/src/cli-parse.ts +19 -5
- package/src/cli.ts +20 -4
package/.github/workflows/ci.yml
CHANGED
|
@@ -54,6 +54,13 @@ jobs:
|
|
|
54
54
|
node --version
|
|
55
55
|
npm --version
|
|
56
56
|
|
|
57
|
+
- name: Verify TypeScript Compilation & lib/ Parity
|
|
58
|
+
shell: bash
|
|
59
|
+
run: |
|
|
60
|
+
npm run build
|
|
61
|
+
git diff --exit-code lib/
|
|
62
|
+
npm run typecheck
|
|
63
|
+
|
|
57
64
|
- name: Run Syntax & Lint Checks
|
|
58
65
|
run: npm run lint
|
|
59
66
|
|
|
@@ -84,6 +91,12 @@ jobs:
|
|
|
84
91
|
- name: Verify Coverage Gates
|
|
85
92
|
run: npm run test:coverage
|
|
86
93
|
|
|
94
|
+
- name: Verify Mutation Score Gate (100% Mutant Kill)
|
|
95
|
+
run: npm run test:mutation
|
|
96
|
+
|
|
97
|
+
- name: Verify Empirical Drift Benchmark
|
|
98
|
+
run: node benchmark/run-benchmark.js
|
|
99
|
+
|
|
87
100
|
- name: Upload Coverage Report
|
|
88
101
|
uses: actions/upload-artifact@v4
|
|
89
102
|
if: always()
|
|
@@ -43,6 +43,13 @@ jobs:
|
|
|
43
43
|
node --version
|
|
44
44
|
npm --version
|
|
45
45
|
|
|
46
|
+
- name: Verify TypeScript Compilation & lib/ Parity
|
|
47
|
+
shell: bash
|
|
48
|
+
run: |
|
|
49
|
+
npm run build
|
|
50
|
+
git diff --exit-code lib/
|
|
51
|
+
npm run typecheck
|
|
52
|
+
|
|
46
53
|
# Re-run the full gate on the exact release tag. prepublishOnly also runs
|
|
47
54
|
# on `npm publish`, but failing fast here avoids building a tarball at all.
|
|
48
55
|
- name: Run Syntax & Lint Checks
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
|
31
|
+
any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
[prosubodh+conduct@gmail.com](mailto:prosubodh+conduct@gmail.com).
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
|
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
+
unprofessional or unwelcome in the community.
|
|
78
|
+
|
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
|
82
|
+
|
|
83
|
+
### 2. Warning
|
|
84
|
+
|
|
85
|
+
**Community Impact**: A violation through a single incident or series of
|
|
86
|
+
actions.
|
|
87
|
+
|
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
+
like social media. Violating these terms may lead to a temporary or
|
|
93
|
+
permanent ban.
|
|
94
|
+
|
|
95
|
+
### 3. Temporary Ban
|
|
96
|
+
|
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
|
98
|
+
sustained inappropriate behavior.
|
|
99
|
+
|
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
+
communication with the community for a specified period of time. No public or
|
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
+
Violating these terms may lead to a permanent ban.
|
|
105
|
+
|
|
106
|
+
### 4. Permanent Ban
|
|
107
|
+
|
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
+
|
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
|
113
|
+
community.
|
|
114
|
+
|
|
115
|
+
## Attribution
|
|
116
|
+
|
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
|
|
118
|
+
version 2.1, available at
|
|
119
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).
|
|
120
|
+
|
|
121
|
+
Community Impact Guidelines were inspired by
|
|
122
|
+
[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
package/CONTRIBUTING.md
CHANGED
|
@@ -77,3 +77,9 @@ Every contribution must preserve these core invariants:
|
|
|
77
77
|
2. Follow Conventional Commits: `feat(...)`, `fix(...)`, `docs(...)`, `test(...)`.
|
|
78
78
|
3. Ensure all tests and validation pass locally (`npm run prepublishOnly`).
|
|
79
79
|
4. Submit your pull request with a concise summary and verification evidence.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 📜 Code of Conduct
|
|
84
|
+
|
|
85
|
+
All contributors and maintainers are expected to abide by our [Code of Conduct](./CODE_OF_CONDUCT.md). Please report any violations to `prosubodh+conduct@gmail.com`.
|
package/README.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# azcodr: Enterprise Architecture & Agentic Engineering Starter Template
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/azcodr)
|
|
4
|
+
[](https://jsr.io/@azcodr/azcodr)
|
|
5
|
+
[](https://github.com/prosubodh/azcodr/actions/workflows/ci.yml)
|
|
6
|
+
[](https://github.com/prosubodh/azcodr)
|
|
7
|
+
[](https://github.com/prosubodh/azcodr)
|
|
8
|
+
[](https://www.npmjs.com/package/azcodr)
|
|
9
|
+
[](./LICENSE)
|
|
10
|
+
|
|
3
11
|
> **Production-oriented architecture governance and topology-scoped scaffolding for AI-assisted development (early release).**
|
|
4
12
|
> *AI agents move fast. Architecture drifts. Azcodr turns architectural intent into executable constraints your agent cannot skip.*
|
|
5
13
|
|
|
@@ -24,6 +32,67 @@
|
|
|
24
32
|
|
|
25
33
|
---
|
|
26
34
|
|
|
35
|
+
## ⚡ 60-Second Demo: See Drift Prevention in Action
|
|
36
|
+
|
|
37
|
+
Azcodr turns architectural philosophy into machine-checked constraints your agent cannot skip.
|
|
38
|
+
|
|
39
|
+
### 1. Standalone Architectural Check
|
|
40
|
+
Run the validator on any repository without scaffolding:
|
|
41
|
+
```bash
|
|
42
|
+
npx azcodr check
|
|
43
|
+
```
|
|
44
|
+
```text
|
|
45
|
+
🔍 Validating Architecture & Agent Invariants in: ./
|
|
46
|
+
--------------------------------------------------------------
|
|
47
|
+
1. Root Config & Symlinks -> PASS
|
|
48
|
+
2. Progressive Disclosure Rules -> PASS (28 rules verified)
|
|
49
|
+
3. Specialized Skills (.agents) -> PASS (6 skills active)
|
|
50
|
+
4. Markdown Cross-References -> PASS (0 broken links)
|
|
51
|
+
5. Memory & ADR Ledger -> PASS (16 ADRs verified)
|
|
52
|
+
6. ADR Index Consistency -> PASS
|
|
53
|
+
🎉 SUCCESS: All architectural invariants are healthy! (0 warnings)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 2. Real-Time PreToolUse Guard: Refactor-Before-Add
|
|
57
|
+
When an AI coding agent attempts to dump new logic into a file already exceeding 300 lines, Azcodr's agent hook intercepts the tool call at runtime before it touches the disk:
|
|
58
|
+
```text
|
|
59
|
+
🚨 TOOL USE BLOCKED: Refactor-Before-Add Violation
|
|
60
|
+
File 'src/auth.ts' has 315 lines (limit: 300).
|
|
61
|
+
Mutations that add code are blocked.
|
|
62
|
+
Extract strategy classes or helper modules to reduce file size before adding new features.
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 3. Zero-Dependency Boundary & Cycle Enforcement
|
|
66
|
+
Inspect dependency cycles and layer boundaries on demand without third-party linters:
|
|
67
|
+
```bash
|
|
68
|
+
npx azcodr boundaries [directory]
|
|
69
|
+
```
|
|
70
|
+
```text
|
|
71
|
+
🔍 Inspecting Architectural Boundaries in: ./src
|
|
72
|
+
--------------------------------------------------------------
|
|
73
|
+
🚨 ARCHITECTURAL VIOLATIONS DETECTED (2):
|
|
74
|
+
- Circular Dependency: src/billing.ts -> src/tenant.ts -> src/billing.ts
|
|
75
|
+
- Layer Boundary Breach: src/domain/payment.ts illegally imports src/infrastructure/db.ts (domain -> infrastructure)
|
|
76
|
+
Action Required: Invert dependencies via Ports or extract shared modules.
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 4. Empirical Benchmark Proof (3 Arms, 10 Sequential Tickets)
|
|
80
|
+
In an automated empirical trial across 10 sequential tickets with 3 architectural traps ([`benchmark/RESULTS.md`](https://github.com/prosubodh/azcodr/blob/main/benchmark/RESULTS.md)):
|
|
81
|
+
|
|
82
|
+
| Metric | Arm A (Control) | Arm B (Hooks Only) | Arm C (Full Azcodr) |
|
|
83
|
+
|---|:---:|:---:|:---:|
|
|
84
|
+
| **Files >300 Lines** | 1 (365 lines in `auth.ts`) | **0** (Modularized) | **0** (Modularized) |
|
|
85
|
+
| **Circular Dependency Cycles** | 1 (`billing <-> tenant`) | 1 (`billing <-> tenant`) | **0** (Decoupled Port) |
|
|
86
|
+
| **Layer Boundary Breaches** | 1 (`domain -> infra`) | 1 (`domain -> infra`) | **0** (Hexagonal Port) |
|
|
87
|
+
| **Overall Drift Reduction** | ❌ FAILED | ❌ FAILED | ✅ **100% DRIFT-FREE** |
|
|
88
|
+
|
|
89
|
+
Run the empirical benchmark yourself:
|
|
90
|
+
```bash
|
|
91
|
+
node benchmark/run-benchmark.js
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
27
96
|
## 🗂️ Workspace Architecture
|
|
28
97
|
|
|
29
98
|
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BoundaryReport } from './boundaries.js';
|
|
2
|
+
import type { CliParsedOptions } from './cli-parse.js';
|
|
3
|
+
export interface BoundaryIo {
|
|
4
|
+
out: (msg: string) => void;
|
|
5
|
+
err: (msg: string) => void;
|
|
6
|
+
exit: (code: number) => void | number;
|
|
7
|
+
cwd: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function resolveBoundaryTarget(targetDir: string | null, cwd: string): string;
|
|
10
|
+
export declare function formatBoundaryReport(targetDir: string, report: BoundaryReport, out: (msg: string) => void): void;
|
|
11
|
+
export declare function handleBoundariesCommand(parsed: CliParsedOptions, io: BoundaryIo): Promise<void | number>;
|
|
12
|
+
declare const _default: {
|
|
13
|
+
resolveBoundaryTarget: typeof resolveBoundaryTarget;
|
|
14
|
+
formatBoundaryReport: typeof formatBoundaryReport;
|
|
15
|
+
handleBoundariesCommand: typeof handleBoundariesCommand;
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
18
|
+
//# sourceMappingURL=cli-boundaries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-boundaries.d.ts","sourceRoot":"","sources":["../src/cli-boundaries.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3B,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3B,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,CAAC;IACtC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAMnF;AAcD,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GACzB,IAAI,CASN;AAED,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,gBAAgB,EACxB,EAAE,EAAE,UAAU,GACb,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CASxB;;;;;;AAED,wBAIE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import { inspectBoundaries } from './boundaries.js';
|
|
4
|
+
export function resolveBoundaryTarget(targetDir, cwd) {
|
|
5
|
+
if (targetDir) {
|
|
6
|
+
return path.resolve(cwd, targetDir);
|
|
7
|
+
}
|
|
8
|
+
const defaultSrc = path.join(cwd, 'src');
|
|
9
|
+
return fs.existsSync(defaultSrc) ? defaultSrc : cwd;
|
|
10
|
+
}
|
|
11
|
+
function printViolations(report, out) {
|
|
12
|
+
const total = report.cycles.length + report.violations.length;
|
|
13
|
+
out(`🚨 ARCHITECTURAL VIOLATIONS DETECTED (${total}):`);
|
|
14
|
+
for (const cycle of report.cycles) {
|
|
15
|
+
out(` - Circular Dependency: ${cycle.join(' -> ')}`);
|
|
16
|
+
}
|
|
17
|
+
for (const v of report.violations) {
|
|
18
|
+
out(` - Layer Boundary Breach: ${v.file} illegally imports ${v.importedFile} (${v.fromLayer} -> ${v.toLayer})`);
|
|
19
|
+
}
|
|
20
|
+
out(' Action Required: Invert dependencies via Ports or extract shared modules.\n');
|
|
21
|
+
}
|
|
22
|
+
export function formatBoundaryReport(targetDir, report, out) {
|
|
23
|
+
out(`\n🔍 Inspecting Architectural Boundaries in: ${targetDir}`);
|
|
24
|
+
out('--------------------------------------------------------------');
|
|
25
|
+
if (report.ok) {
|
|
26
|
+
out(`✅ Analyzed ${report.moduleCount} modules: 0 circular cycles, 0 boundary violations.`);
|
|
27
|
+
out('🎉 SUCCESS: Architecture is clean and drift-free! (0 violations)\n');
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
printViolations(report, out);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export async function handleBoundariesCommand(parsed, io) {
|
|
34
|
+
const targetDir = resolveBoundaryTarget(parsed.targetDir, io.cwd);
|
|
35
|
+
const report = inspectBoundaries(targetDir);
|
|
36
|
+
if (!parsed.silent) {
|
|
37
|
+
formatBoundaryReport(targetDir, report, io.out);
|
|
38
|
+
}
|
|
39
|
+
return io.exit(report.ok ? 0 : 1);
|
|
40
|
+
}
|
|
41
|
+
export default {
|
|
42
|
+
resolveBoundaryTarget,
|
|
43
|
+
formatBoundaryReport,
|
|
44
|
+
handleBoundariesCommand
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=cli-boundaries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-boundaries.js","sourceRoot":"","sources":["../src/cli-boundaries.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAWpD,MAAM,UAAU,qBAAqB,CAAC,SAAwB,EAAE,GAAW;IACzE,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IACtC,CAAC;IACD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACzC,OAAO,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC;AACtD,CAAC;AAED,SAAS,eAAe,CAAC,MAAsB,EAAE,GAA0B;IACzE,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC;IAC9D,GAAG,CAAC,yCAAyC,KAAK,IAAI,CAAC,CAAC;IACxD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClC,GAAG,CAAC,6BAA6B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACzD,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,UAAU,EAAE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adding a flag cannot
|
|
5
5
|
* raise the complexity of the parser itself.
|
|
6
6
|
*/
|
|
7
|
-
export type CliCommand = 'scaffold' | 'check';
|
|
7
|
+
export type CliCommand = 'scaffold' | 'check' | 'boundaries';
|
|
8
8
|
export interface CliParsedOptions {
|
|
9
9
|
command: CliCommand;
|
|
10
10
|
targetDir: string | null;
|
|
@@ -18,6 +18,7 @@ export interface CliParsedOptions {
|
|
|
18
18
|
export type BooleanFlagKey = 'force' | 'noGit' | 'dryRun' | 'silent';
|
|
19
19
|
export declare function emptyOptions(): Omit<CliParsedOptions, 'terminal' | 'message'>;
|
|
20
20
|
export declare const CHECK_COMMANDS: Set<string>;
|
|
21
|
+
export declare const BOUNDARY_COMMANDS: Set<string>;
|
|
21
22
|
export declare const BOOLEAN_FLAGS: Map<string, BooleanFlagKey>;
|
|
22
23
|
export interface ArgOutcome {
|
|
23
24
|
terminal: 'help' | 'version' | 'unknown-flag' | 'extra-arg' | null;
|
package/lib/cli-parse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-parse.d.ts","sourceRoot":"","sources":["../src/cli-parse.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"cli-parse.d.ts","sourceRoot":"","sources":["../src/cli-parse.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,OAAO,GAAG,YAAY,CAAC;AAE7D,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,UAAU,CAAC;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc,GAAG,WAAW,GAAG,IAAI,CAAC;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAErE,wBAAgB,YAAY,IAAI,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,SAAS,CAAC,CAS7E;AAED,eAAO,MAAM,cAAc,aAA0C,CAAC;AACtE,eAAO,MAAM,iBAAiB,aAAgD,CAAC;AAE/E,eAAO,MAAM,aAAa,6BAQxB,CAAC;AAEH,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc,GAAG,WAAW,GAAG,IAAI,CAAC;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAwBD,wBAAgB,QAAQ,CACtB,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,SAAS,CAAC,EACrD,GAAG,EAAE,MAAM,GACV,UAAU,CAuBZ;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,gBAAgB,CAStE;;;;;;;;AAED,wBAAoF"}
|
package/lib/cli-parse.js
CHANGED
|
@@ -15,6 +15,7 @@ export function emptyOptions() {
|
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
export const CHECK_COMMANDS = new Set(['check', 'validate', 'audit']);
|
|
18
|
+
export const BOUNDARY_COMMANDS = new Set(['boundaries', 'boundary', 'cycles']);
|
|
18
19
|
export const BOOLEAN_FLAGS = new Map([
|
|
19
20
|
['-f', 'force'],
|
|
20
21
|
['--force', 'force'],
|
|
@@ -31,6 +32,19 @@ function checkSpecialFlag(arg) {
|
|
|
31
32
|
return 'version';
|
|
32
33
|
return null;
|
|
33
34
|
}
|
|
35
|
+
function checkCommandKeyword(arg, state) {
|
|
36
|
+
if (state.targetDir !== null || state.command !== 'scaffold')
|
|
37
|
+
return false;
|
|
38
|
+
if (CHECK_COMMANDS.has(arg)) {
|
|
39
|
+
state.command = 'check';
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
if (BOUNDARY_COMMANDS.has(arg)) {
|
|
43
|
+
state.command = 'boundaries';
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
34
48
|
export function applyArg(state, arg) {
|
|
35
49
|
const special = checkSpecialFlag(arg);
|
|
36
50
|
if (special !== null)
|
|
@@ -46,10 +60,8 @@ export function applyArg(state, arg) {
|
|
|
46
60
|
message: `Unknown argument '${arg}'. Run 'npx azcodr --help' for available options.`
|
|
47
61
|
};
|
|
48
62
|
}
|
|
49
|
-
if (
|
|
50
|
-
state.command = 'check';
|
|
63
|
+
if (checkCommandKeyword(arg, state))
|
|
51
64
|
return { terminal: null };
|
|
52
|
-
}
|
|
53
65
|
if (!state.targetDir) {
|
|
54
66
|
state.targetDir = arg;
|
|
55
67
|
return { terminal: null };
|
package/lib/cli-parse.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-parse.js","sourceRoot":"","sources":["../src/cli-parse.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH,MAAM,UAAU,YAAY;IAC1B,OAAO;QACL,OAAO,EAAE,UAAU;QACnB,SAAS,EAAE,IAAI;QACf,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,KAAK;KACd,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"cli-parse.js","sourceRoot":"","sources":["../src/cli-parse.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH,MAAM,UAAU,YAAY;IAC1B,OAAO;QACL,OAAO,EAAE,UAAU;QACnB,SAAS,EAAE,IAAI;QACf,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ACrC,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;YAC9B,OAAO,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;QAC5E,CAAC;IACH,CAAC;IACD,OAAO,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AAC1D,CAAC;AAED,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC"}
|
package/lib/cli.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ScaffoldOptions, ScaffoldResult } from './scaffold.js';
|
|
2
|
+
import type { CliParsedOptions } from './cli-parse.js';
|
|
2
3
|
import { askQuestion } from './cli-target.js';
|
|
3
4
|
export declare function printHelp(out?: (msg: string) => void): void;
|
|
4
5
|
export declare function printVersion(out?: (msg: string) => void): void;
|
|
@@ -20,6 +21,7 @@ export interface CliIo {
|
|
|
20
21
|
errors: number;
|
|
21
22
|
warnings: number;
|
|
22
23
|
}>;
|
|
24
|
+
boundaries?: (parsed: CliParsedOptions, io: any) => Promise<void | number>;
|
|
23
25
|
}
|
|
24
26
|
export interface NormalizedCliIo {
|
|
25
27
|
out: (msg: string) => void;
|
|
@@ -39,6 +41,7 @@ export interface NormalizedCliIo {
|
|
|
39
41
|
errors: number;
|
|
40
42
|
warnings: number;
|
|
41
43
|
}>;
|
|
44
|
+
boundariesFn: (parsed: CliParsedOptions, io: any) => Promise<void | number>;
|
|
42
45
|
}
|
|
43
46
|
export declare function runCli(rawArgs?: string[], io?: CliIo): Promise<void | number>;
|
|
44
47
|
export declare function main(): Promise<void>;
|
package/lib/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mapp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B,EACzC,EAAE,GAAE,KAAU,GACb,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CA2BxB;AAED,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAO1C;AAED,OAAO,EAAE,WAAW,EAAE,CAAC;;;;;;;;AAEvB,wBAME"}
|
package/lib/cli.js
CHANGED
|
@@ -4,6 +4,7 @@ import process from 'node:process';
|
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
5
|
import { scaffold, getTemplateDir } from './scaffold.js';
|
|
6
6
|
import { validate, createSilentReporter } from './validate.js';
|
|
7
|
+
import { handleBoundariesCommand } from './cli-boundaries.js';
|
|
7
8
|
import { parseArgs } from './cli-parse.js';
|
|
8
9
|
import { askQuestion, resolveTargetDir, ensureWritableTarget } from './cli-target.js';
|
|
9
10
|
const pkg = JSON.parse(fs.readFileSync(path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'package.json'), 'utf-8'));
|
|
@@ -15,10 +16,12 @@ Enterprise Multi-Tenant Architecture & Agentic Engineering Starter Template
|
|
|
15
16
|
Usage:
|
|
16
17
|
npx azcodr [directory] [options]
|
|
17
18
|
npx azcodr check [directory] [options]
|
|
19
|
+
npx azcodr boundaries [directory] [options]
|
|
18
20
|
|
|
19
21
|
Commands:
|
|
20
|
-
[directory]
|
|
21
|
-
check [directory]
|
|
22
|
+
[directory] Scaffold azcodr template into directory (default: current directory)
|
|
23
|
+
check [directory] Validate architecture and governance rules (alias: validate, audit)
|
|
24
|
+
boundaries [directory] Inspect dependency cycles and layer boundaries (alias: boundary, cycles)
|
|
22
25
|
|
|
23
26
|
Options:
|
|
24
27
|
-d, --dry-run Simulate scaffolding without modifying filesystem
|
|
@@ -31,6 +34,7 @@ Options:
|
|
|
31
34
|
Examples:
|
|
32
35
|
npx azcodr my-project
|
|
33
36
|
npx azcodr check
|
|
37
|
+
npx azcodr boundaries ./src
|
|
34
38
|
npx azcodr check ./existing-repo
|
|
35
39
|
npx azcodr . --dry-run
|
|
36
40
|
`);
|
|
@@ -54,7 +58,8 @@ function normalizeIo(io) {
|
|
|
54
58
|
cwd: io.cwd ?? process.cwd(),
|
|
55
59
|
templateDir: io.templateDir ?? getTemplateDir(),
|
|
56
60
|
scaffoldFn: io.scaffold ?? scaffold,
|
|
57
|
-
validateFn: io.validate ?? validate
|
|
61
|
+
validateFn: io.validate ?? validate,
|
|
62
|
+
boundariesFn: io.boundaries ?? handleBoundariesCommand
|
|
58
63
|
};
|
|
59
64
|
}
|
|
60
65
|
function outBanner(fullIo) {
|
|
@@ -77,7 +82,13 @@ async function handleCheckCommand(parsed, fullIo) {
|
|
|
77
82
|
const checkDir = parsed.targetDir ? path.resolve(fullIo.cwd, parsed.targetDir) : fullIo.cwd;
|
|
78
83
|
const reporter = parsed.silent ? createSilentReporter() : undefined;
|
|
79
84
|
const result = await fullIo.validateFn(checkDir, reporter);
|
|
80
|
-
|
|
85
|
+
if (result.errors !== 0)
|
|
86
|
+
return fullIo.exit(1);
|
|
87
|
+
const srcDir = path.join(checkDir, 'src');
|
|
88
|
+
if (fs.existsSync(srcDir)) {
|
|
89
|
+
return fullIo.boundariesFn({ ...parsed, targetDir: srcDir }, fullIo);
|
|
90
|
+
}
|
|
91
|
+
return fullIo.exit(0);
|
|
81
92
|
}
|
|
82
93
|
function reportDryRun(result, out) {
|
|
83
94
|
for (const action of result.actions) {
|
|
@@ -163,6 +174,9 @@ export async function runCli(rawArgs = process.argv.slice(2), io = {}) {
|
|
|
163
174
|
if (parsed.command === 'check') {
|
|
164
175
|
return handleCheckCommand(parsed, fullIo);
|
|
165
176
|
}
|
|
177
|
+
if (parsed.command === 'boundaries') {
|
|
178
|
+
return fullIo.boundariesFn(parsed, fullIo);
|
|
179
|
+
}
|
|
166
180
|
if (!parsed.silent) {
|
|
167
181
|
outBanner(fullIo);
|
|
168
182
|
}
|
package/lib/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../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AY;IACZ,WAAW;CACZ,CAAC"}
|
package/memory.md
CHANGED
|
@@ -33,6 +33,8 @@
|
|
|
33
33
|
| [ADR-014](./memory.md#adr-014-author-in-typescript-with-tsc-compilation-to-native-esm) | Author in TypeScript with tsc compilation to native ESM | 2026-10-07 | ACCEPTED | [`type_safety.md`](./docs/rules/type_safety.md) |
|
|
34
34
|
| [ADR-015](./memory.md#adr-015-consolidate-testing-on-jest-with-typescript-test-migration) | Consolidate testing on Jest with TypeScript test migration | 2026-10-08 | ACCEPTED | [`test_driven_development.md`](./docs/rules/test_driven_development.md) |
|
|
35
35
|
| [ADR-016](./memory.md#adr-016-standalone-architectural-validator-agent-runtime-hooks-boundary-engine--empirical-benchmark) | Standalone Architectural Validator, Agent Runtime Hooks, Boundary Engine & Empirical Benchmark | 2026-10-08 | ACCEPTED | [`agentic_configuration.md`](./docs/rules/agentic_configuration.md) |
|
|
36
|
+
| [ADR-017](./memory.md#adr-017-continuous-mutation-and-benchmark-ci-gates-oss-governance-and-reference-example) | Continuous Mutation & Benchmark CI Gates, OSS Governance & Reference Example | 2026-10-08 | ACCEPTED | [`devops_ci_cd.md`](./docs/rules/devops_ci_cd.md) |
|
|
37
|
+
| [ADR-018](./memory.md#adr-018-first-class-architectural-boundary-and-cycle-inspection-cli-subcommand) | First-Class Architectural Boundary and Cycle Inspection CLI Subcommand | 2026-10-08 | ACCEPTED | [`clean_code.md`](./docs/rules/clean_code.md) |
|
|
36
38
|
|
|
37
39
|
---
|
|
38
40
|
|
|
@@ -87,6 +89,20 @@
|
|
|
87
89
|
- **Consequences:** ✅ Existing codebases can run `npx azcodr check` without scaffolding. ✅ Agent sessions enforce Refactor-Before-Add and RED-before-GREEN TDD at the prompt boundary. ✅ Structural circular dependencies and layer breaches are machine-checked with zero third-party dependencies. ✅ Empirical drift prevention benchmark is fully specified, reproducible, and automated. ✅ 100.00% lines, functions, branches, and statements coverage verified across both source and scripts.
|
|
88
90
|
- **Enforced In:** `src/validate.ts`, `src/agent-guard*.ts`, `src/boundaries.ts`, `benchmark/`, `tests/cli-check.test.ts`, `tests/agent-guard.test.ts`, `tests/boundaries.test.ts`, `tests/benchmark.test.ts`
|
|
89
91
|
|
|
92
|
+
#### ADR-017: Continuous Mutation and Benchmark CI Gates, OSS Governance and Reference Example
|
|
93
|
+
- **Date:** 2026-10-08 | **Status:** ACCEPTED
|
|
94
|
+
- **Context:** Following the implementation of the empirical benchmark and native mutation testing harness (ADR-016), three operational gaps were identified: (1) Mutation score (100%) and empirical drift-reduction benchmark assertions ran only as manual workstation commands, risking silent regression during PR merges without automated CI enforcement. (2) Open-source project governance remained incomplete without an explicit Code of Conduct (Contributor Covenant v2.1) beside `SECURITY.md` and `CONTRIBUTING.md`. (3) Prospective adopters lacked a concrete, standalone reference application demonstrating how Azcodr boundary enforcement and Clean Architecture operate in a real downstream project.
|
|
95
|
+
- **Decision:** (1) Automate mutation testing (`npm run test:mutation`) and empirical drift-reduction benchmark execution (`node benchmark/run-benchmark.js`) directly within `.github/workflows/ci.yml` under the Node 24 coverage gate job, ensuring 100% mutant kill score and zero drift are verified on every push and PR. Relocate `mutation-test.js` to `benchmark/mutation-test.js` to keep `scripts/` dedicated solely to template validation. (2) Adopt the Contributor Covenant Code of Conduct v2.1 in `CODE_OF_CONDUCT.md`, reference it in `CONTRIBUTING.md`, and include it in `package.json` package files. (3) Author a standalone, zero-dependency reference implementation in `examples/clean-architecture-todo/` adhering strictly to Clean/Hexagonal Architecture (domain entity invariants, ports, use cases, and in-memory adapter), backed by regression test `tests/example-project.test.ts`. (4) Add official shields.io badges in `README.md` reflecting live npm version, JSR scope, CI passing status, 100% test coverage, 100% mutation score, and 0 dependencies.
|
|
96
|
+
- **Consequences:** ✅ Every PR and push automatically verifies 100% mutation resistance and benchmark assertions. ✅ Full open-source governance compliance achieved (`SECURITY.md`, `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`). ✅ Concrete, working reference example proves downstream architectural boundaries and Clean Code limits. ✅ 100.00% lines, functions, statements, and branches coverage maintained across all 40 test suites and 489 tests.
|
|
97
|
+
- **Enforced In:** `.github/workflows/ci.yml`, `benchmark/mutation-test.js`, `CODE_OF_CONDUCT.md`, `examples/clean-architecture-todo/`, `tests/example-project.test.ts`, `README.md`, `package.json`
|
|
98
|
+
|
|
99
|
+
#### ADR-018: First-Class Architectural Boundary and Cycle Inspection CLI Subcommand
|
|
100
|
+
- **Date:** 2026-10-08 | **Status:** ACCEPTED
|
|
101
|
+
- **Context:** Following the implementation of the zero-dependency boundary and cycle engine (`src/boundaries.ts`, ADR-016), inspecting dependency cycles and Clean Architecture layer breaches required either running the empirical benchmark or importing the internal TypeScript engine programmatically. Users and CI pipelines lacked a direct, dedicated CLI entry point (`npx azcodr boundaries [dir]`) to run boundary and circular dependency inspections as a standalone architectural linter.
|
|
102
|
+
- **Decision:** (1) Integrate a dedicated `boundaries` subcommand (with aliases `boundary`, `cycles`) into `src/cli-parse.ts` and `src/cli.ts`. (2) Implement `src/cli-boundaries.ts` to inspect target directories, format colorized/iconographic violation reports, handle silent execution (`--silent`), and resolve target paths (defaulting to `./src` if present, with fallback to current working directory). (3) Author Outside-In TDD test suite `tests/cli-boundaries.test.ts` covering parse argument recognition, target resolution, cycle detection, breach reporting, silent mode, and child-process execution. (4) Maintain Clean Code limits (all files ≤ 300 lines, functions ≤ 30 lines, complexity ≤ 10) and 100.00% full-spectrum statement, branch, function, and line coverage across all 41 test suites.
|
|
103
|
+
- **Consequences:** ✅ Developers and CI workflows can run `npx azcodr boundaries [dir]` or `npx azcodr cycles [dir]` directly without third-party lint dependencies. ✅ Fast, zero-dependency static analysis catches circular imports and Hexagonal layer breaches. ✅ 100.00% lines, functions, statements, and branches coverage preserved across 41 test suites and 501 tests.
|
|
104
|
+
- **Enforced In:** `src/cli-boundaries.ts`, `src/cli-parse.ts`, `src/cli.ts`, `tests/cli-boundaries.test.ts`, `README.md`
|
|
105
|
+
|
|
90
106
|
#### ADR-011: The Bash Scaffolder Refuses Protected Targets
|
|
91
107
|
- **Date:** 2026-10-07 | **Status:** ACCEPTED
|
|
92
108
|
- **Context:** ADR-010 closed the protected-target hole for the Node scaffolder (`lib/scaffold.js`), but the same hole existed in `.agents/skills/lets-build/scripts/bootstrap_workspace.sh`, which runs with no guard at all: invoked with `/` or `~` as the workspace root it would create `src/`, `tests/`, `deploy/`, `specs/` trees there. Its blast radius is smaller than the Node scaffolder's (every file write is create-only — `tokens.json` and `smoke_test.sh` are written only if absent, and `memory.md` is append-only since ADR-009 — except the explicit `AZCODR_RESET_MEMORY=1` reset), so this is pollution rather than destruction. Pollution of `/` or `~` is still unacceptable for a script agents run autonomously.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azcodr",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Enterprise Architecture & Agentic Engineering Starter Template",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
".editorconfig",
|
|
32
32
|
"LICENSE",
|
|
33
33
|
"SECURITY.md",
|
|
34
|
-
"CONTRIBUTING.md"
|
|
34
|
+
"CONTRIBUTING.md",
|
|
35
|
+
"CODE_OF_CONDUCT.md"
|
|
35
36
|
],
|
|
36
37
|
"keywords": [
|
|
37
38
|
"starter-template",
|
|
@@ -63,6 +64,7 @@
|
|
|
63
64
|
"lint": "eslint .",
|
|
64
65
|
"typecheck": "tsc --noEmit",
|
|
65
66
|
"validate": "node scripts/validate-cli.js",
|
|
67
|
+
"test:mutation": "node benchmark/mutation-test.js",
|
|
66
68
|
"prepublishOnly": "npm run build && npm run lint && npm run test:coverage && npm run validate"
|
|
67
69
|
},
|
|
68
70
|
"devDependencies": {
|
|
@@ -72,5 +74,9 @@
|
|
|
72
74
|
"jest": "29.7.0",
|
|
73
75
|
"ts-jest": "29.2.6",
|
|
74
76
|
"typescript": "5.7.3"
|
|
77
|
+
},
|
|
78
|
+
"overrides": {
|
|
79
|
+
"braces": "3.0.3",
|
|
80
|
+
"sprintf-js": "1.1.3"
|
|
75
81
|
}
|
|
76
82
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import { inspectBoundaries } from './boundaries.js';
|
|
4
|
+
import type { BoundaryReport } from './boundaries.js';
|
|
5
|
+
import type { CliParsedOptions } from './cli-parse.js';
|
|
6
|
+
|
|
7
|
+
export interface BoundaryIo {
|
|
8
|
+
out: (msg: string) => void;
|
|
9
|
+
err: (msg: string) => void;
|
|
10
|
+
exit: (code: number) => void | number;
|
|
11
|
+
cwd: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function resolveBoundaryTarget(targetDir: string | null, cwd: string): string {
|
|
15
|
+
if (targetDir) {
|
|
16
|
+
return path.resolve(cwd, targetDir);
|
|
17
|
+
}
|
|
18
|
+
const defaultSrc = path.join(cwd, 'src');
|
|
19
|
+
return fs.existsSync(defaultSrc) ? defaultSrc : cwd;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function printViolations(report: BoundaryReport, out: (msg: string) => void): void {
|
|
23
|
+
const total = report.cycles.length + report.violations.length;
|
|
24
|
+
out(`🚨 ARCHITECTURAL VIOLATIONS DETECTED (${total}):`);
|
|
25
|
+
for (const cycle of report.cycles) {
|
|
26
|
+
out(` - Circular Dependency: ${cycle.join(' -> ')}`);
|
|
27
|
+
}
|
|
28
|
+
for (const v of report.violations) {
|
|
29
|
+
out(` - Layer Boundary Breach: ${v.file} illegally imports ${v.importedFile} (${v.fromLayer} -> ${v.toLayer})`);
|
|
30
|
+
}
|
|
31
|
+
out(' Action Required: Invert dependencies via Ports or extract shared modules.\n');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function formatBoundaryReport(
|
|
35
|
+
targetDir: string,
|
|
36
|
+
report: BoundaryReport,
|
|
37
|
+
out: (msg: string) => void
|
|
38
|
+
): void {
|
|
39
|
+
out(`\n🔍 Inspecting Architectural Boundaries in: ${targetDir}`);
|
|
40
|
+
out('--------------------------------------------------------------');
|
|
41
|
+
if (report.ok) {
|
|
42
|
+
out(`✅ Analyzed ${report.moduleCount} modules: 0 circular cycles, 0 boundary violations.`);
|
|
43
|
+
out('🎉 SUCCESS: Architecture is clean and drift-free! (0 violations)\n');
|
|
44
|
+
} else {
|
|
45
|
+
printViolations(report, out);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export async function handleBoundariesCommand(
|
|
50
|
+
parsed: CliParsedOptions,
|
|
51
|
+
io: BoundaryIo
|
|
52
|
+
): Promise<void | number> {
|
|
53
|
+
const targetDir = resolveBoundaryTarget(parsed.targetDir, io.cwd);
|
|
54
|
+
const report = inspectBoundaries(targetDir);
|
|
55
|
+
|
|
56
|
+
if (!parsed.silent) {
|
|
57
|
+
formatBoundaryReport(targetDir, report, io.out);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return io.exit(report.ok ? 0 : 1);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default {
|
|
64
|
+
resolveBoundaryTarget,
|
|
65
|
+
formatBoundaryReport,
|
|
66
|
+
handleBoundariesCommand
|
|
67
|
+
};
|
package/src/cli-parse.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* raise the complexity of the parser itself.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
export type CliCommand = 'scaffold' | 'check';
|
|
8
|
+
export type CliCommand = 'scaffold' | 'check' | 'boundaries';
|
|
9
9
|
|
|
10
10
|
export interface CliParsedOptions {
|
|
11
11
|
command: CliCommand;
|
|
@@ -32,6 +32,7 @@ export function emptyOptions(): Omit<CliParsedOptions, 'terminal' | 'message'> {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export const CHECK_COMMANDS = new Set(['check', 'validate', 'audit']);
|
|
35
|
+
export const BOUNDARY_COMMANDS = new Set(['boundaries', 'boundary', 'cycles']);
|
|
35
36
|
|
|
36
37
|
export const BOOLEAN_FLAGS = new Map<string, BooleanFlagKey>([
|
|
37
38
|
['-f', 'force'],
|
|
@@ -54,6 +55,22 @@ function checkSpecialFlag(arg: string): 'help' | 'version' | null {
|
|
|
54
55
|
return null;
|
|
55
56
|
}
|
|
56
57
|
|
|
58
|
+
function checkCommandKeyword(
|
|
59
|
+
arg: string,
|
|
60
|
+
state: Omit<CliParsedOptions, 'terminal' | 'message'>
|
|
61
|
+
): boolean {
|
|
62
|
+
if (state.targetDir !== null || state.command !== 'scaffold') return false;
|
|
63
|
+
if (CHECK_COMMANDS.has(arg)) {
|
|
64
|
+
state.command = 'check';
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
if (BOUNDARY_COMMANDS.has(arg)) {
|
|
68
|
+
state.command = 'boundaries';
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
|
|
57
74
|
export function applyArg(
|
|
58
75
|
state: Omit<CliParsedOptions, 'terminal' | 'message'>,
|
|
59
76
|
arg: string
|
|
@@ -71,10 +88,7 @@ export function applyArg(
|
|
|
71
88
|
message: `Unknown argument '${arg}'. Run 'npx azcodr --help' for available options.`
|
|
72
89
|
};
|
|
73
90
|
}
|
|
74
|
-
if (
|
|
75
|
-
state.command = 'check';
|
|
76
|
-
return { terminal: null };
|
|
77
|
-
}
|
|
91
|
+
if (checkCommandKeyword(arg, state)) return { terminal: null };
|
|
78
92
|
if (!state.targetDir) {
|
|
79
93
|
state.targetDir = arg;
|
|
80
94
|
return { terminal: null };
|
package/src/cli.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
5
5
|
import { scaffold, getTemplateDir } from './scaffold.js';
|
|
6
6
|
import type { ScaffoldOptions, ScaffoldResult } from './scaffold.js';
|
|
7
7
|
import { validate, createSilentReporter } from './validate.js';
|
|
8
|
+
import { handleBoundariesCommand } from './cli-boundaries.js';
|
|
8
9
|
import { parseArgs } from './cli-parse.js';
|
|
9
10
|
import type { CliParsedOptions } from './cli-parse.js';
|
|
10
11
|
import { askQuestion, resolveTargetDir, ensureWritableTarget } from './cli-target.js';
|
|
@@ -28,10 +29,12 @@ Enterprise Multi-Tenant Architecture & Agentic Engineering Starter Template
|
|
|
28
29
|
Usage:
|
|
29
30
|
npx azcodr [directory] [options]
|
|
30
31
|
npx azcodr check [directory] [options]
|
|
32
|
+
npx azcodr boundaries [directory] [options]
|
|
31
33
|
|
|
32
34
|
Commands:
|
|
33
|
-
[directory]
|
|
34
|
-
check [directory]
|
|
35
|
+
[directory] Scaffold azcodr template into directory (default: current directory)
|
|
36
|
+
check [directory] Validate architecture and governance rules (alias: validate, audit)
|
|
37
|
+
boundaries [directory] Inspect dependency cycles and layer boundaries (alias: boundary, cycles)
|
|
35
38
|
|
|
36
39
|
Options:
|
|
37
40
|
-d, --dry-run Simulate scaffolding without modifying filesystem
|
|
@@ -44,6 +47,7 @@ Options:
|
|
|
44
47
|
Examples:
|
|
45
48
|
npx azcodr my-project
|
|
46
49
|
npx azcodr check
|
|
50
|
+
npx azcodr boundaries ./src
|
|
47
51
|
npx azcodr check ./existing-repo
|
|
48
52
|
npx azcodr . --dry-run
|
|
49
53
|
`);
|
|
@@ -63,6 +67,7 @@ export interface CliIo {
|
|
|
63
67
|
templateDir?: string;
|
|
64
68
|
scaffold?: (options?: ScaffoldOptions) => ScaffoldResult;
|
|
65
69
|
validate?: (workspaceRoot: string, reporter?: any) => { errors: number; warnings: number } | Promise<{ errors: number; warnings: number }>;
|
|
70
|
+
boundaries?: (parsed: CliParsedOptions, io: any) => Promise<void | number>;
|
|
66
71
|
}
|
|
67
72
|
|
|
68
73
|
export interface NormalizedCliIo {
|
|
@@ -75,6 +80,7 @@ export interface NormalizedCliIo {
|
|
|
75
80
|
templateDir: string;
|
|
76
81
|
scaffoldFn: (options?: ScaffoldOptions) => ScaffoldResult;
|
|
77
82
|
validateFn: (workspaceRoot: string, reporter?: any) => { errors: number; warnings: number } | Promise<{ errors: number; warnings: number }>;
|
|
83
|
+
boundariesFn: (parsed: CliParsedOptions, io: any) => Promise<void | number>;
|
|
78
84
|
}
|
|
79
85
|
|
|
80
86
|
function defaultStreams(io: CliIo) {
|
|
@@ -94,7 +100,8 @@ function normalizeIo(io: CliIo): NormalizedCliIo {
|
|
|
94
100
|
cwd: io.cwd ?? process.cwd(),
|
|
95
101
|
templateDir: io.templateDir ?? getTemplateDir(),
|
|
96
102
|
scaffoldFn: io.scaffold ?? scaffold,
|
|
97
|
-
validateFn: io.validate ?? validate
|
|
103
|
+
validateFn: io.validate ?? validate,
|
|
104
|
+
boundariesFn: io.boundaries ?? handleBoundariesCommand
|
|
98
105
|
};
|
|
99
106
|
}
|
|
100
107
|
|
|
@@ -123,7 +130,13 @@ async function handleCheckCommand(
|
|
|
123
130
|
const checkDir = parsed.targetDir ? path.resolve(fullIo.cwd, parsed.targetDir) : fullIo.cwd;
|
|
124
131
|
const reporter = parsed.silent ? createSilentReporter() : undefined;
|
|
125
132
|
const result = await fullIo.validateFn(checkDir, reporter);
|
|
126
|
-
|
|
133
|
+
if (result.errors !== 0) return fullIo.exit(1);
|
|
134
|
+
|
|
135
|
+
const srcDir = path.join(checkDir, 'src');
|
|
136
|
+
if (fs.existsSync(srcDir)) {
|
|
137
|
+
return fullIo.boundariesFn({ ...parsed, targetDir: srcDir }, fullIo);
|
|
138
|
+
}
|
|
139
|
+
return fullIo.exit(0);
|
|
127
140
|
}
|
|
128
141
|
|
|
129
142
|
function reportDryRun(result: ScaffoldResult, out: (msg: string) => void): void {
|
|
@@ -228,6 +241,9 @@ export async function runCli(
|
|
|
228
241
|
if (parsed.command === 'check') {
|
|
229
242
|
return handleCheckCommand(parsed, fullIo);
|
|
230
243
|
}
|
|
244
|
+
if (parsed.command === 'boundaries') {
|
|
245
|
+
return fullIo.boundariesFn(parsed, fullIo);
|
|
246
|
+
}
|
|
231
247
|
|
|
232
248
|
if (!parsed.silent) {
|
|
233
249
|
outBanner(fullIo);
|