larats 1.0.1 → 1.1.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/README.md +63 -15
- package/dist/index.js +1176 -289
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
- package/dist/index.cjs +0 -1744
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -2
- package/dist/index.d.ts +0 -2
package/README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# LaraTS ⚡
|
|
2
2
|
|
|
3
3
|
> **Smart Architecture Visualizer & Contextual Module Scaffolder CLI**
|
|
4
|
-
> Tailor-made for **Laravel**
|
|
4
|
+
> Tailor-made for **Laravel**, **TypeScript**, and **JavaScript (Node.js)** projects.
|
|
5
5
|
|
|
6
|
+
[](https://www.npmjs.com/package/larats)
|
|
7
|
+
[](https://github.com/SidiqFatuh187/Larats/actions/workflows/ci.yml)
|
|
6
8
|
[](https://opensource.org/licenses/MIT)
|
|
7
|
-
[](https://nodejs.org)
|
|
8
10
|
[](https://www.typescriptlang.org/)
|
|
9
11
|
[](#-strict-security--safety-guarantees)
|
|
10
12
|
|
|
@@ -12,7 +14,7 @@
|
|
|
12
14
|
|
|
13
15
|
## 💡 What is LaraTS?
|
|
14
16
|
|
|
15
|
-
When codebases grow large, developers often struggle to understand the architecture or keep module structures consistent across teams. **LaraTS** solves this with
|
|
17
|
+
When codebases grow large, developers often struggle to understand the architecture or keep module structures consistent across teams. **LaraTS** solves this with three core pillars:
|
|
16
18
|
|
|
17
19
|
1. 🔍 **Architecture Scanner & Visualizer (`scan`)**: Instantly scans your repository, categorizes layers (Models, Controllers, Services, Actions, Filament Resources, Routes, etc.), and generates a clean `ARCHITECTURE.md` with an interactive **Mermaid.js flowchart** and directory tree.
|
|
18
20
|
2. 🏗️ **Contextual Module Scaffolder (`scaffold` / `make`)**: Quickly generates cohesive feature modules with clean, production-ready boilerplate code tailored to your exact stack (Laravel or TypeScript).
|
|
@@ -28,9 +30,12 @@ Run instantly without installation via `npx`:
|
|
|
28
30
|
# Interactive menu mode
|
|
29
31
|
npx larats
|
|
30
32
|
|
|
31
|
-
#
|
|
33
|
+
# Scan architecture & display terminal pipeline
|
|
32
34
|
npx larats scan
|
|
33
35
|
|
|
36
|
+
# Open interactive Mermaid diagram in your browser
|
|
37
|
+
npx larats view
|
|
38
|
+
|
|
34
39
|
# Or scaffold a new module directly
|
|
35
40
|
npx larats scaffold Payment
|
|
36
41
|
```
|
|
@@ -42,20 +47,52 @@ npm install -g larats
|
|
|
42
47
|
larats
|
|
43
48
|
```
|
|
44
49
|
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 👀 How to View Your Project Architecture
|
|
54
|
+
|
|
55
|
+
LaraTS makes your codebase architecture visible in 4 convenient ways:
|
|
56
|
+
|
|
57
|
+
1. 🌐 **Interactive Local Browser (`larats view` / `larats scan --view`)**:
|
|
58
|
+
Spawns a local browser tab displaying the interactive Mermaid flowchart, component counts, and directory tree.
|
|
59
|
+
```bash
|
|
60
|
+
npx larats view
|
|
61
|
+
# or scan and open viewer immediately
|
|
62
|
+
npx larats scan --view
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
2. 📟 **Terminal Architecture Pipeline**:
|
|
66
|
+
Every time you run `larats scan`, LaraTS prints an ASCII pipeline of your request lifecycle directly in the terminal:
|
|
67
|
+
```text
|
|
68
|
+
Client ──> Routes [4] ──> Controllers [4] ──> Services [2] ──> Models [6] ──> Database
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
3. 🐙 **GitHub & GitLab Native Preview**:
|
|
72
|
+
Commit and push `ARCHITECTURE.md` to your repository. GitHub natively renders Mermaid.js flowcharts into interactive graphics directly on the web page.
|
|
73
|
+
|
|
74
|
+
4. 💻 **VS Code & Cursor**:
|
|
75
|
+
Open `ARCHITECTURE.md` and press `Ctrl+Shift+V` (`Cmd+Shift+V` on macOS) to open the built-in Markdown Preview.
|
|
76
|
+
|
|
77
|
+
5. 📄 **Standalone HTML Export (`--html`)**:
|
|
78
|
+
Generate a self-contained `ARCHITECTURE.html` file that can be opened in any web browser without any server:
|
|
79
|
+
```bash
|
|
80
|
+
npx larats scan --html
|
|
81
|
+
```
|
|
45
82
|
---
|
|
46
83
|
|
|
47
84
|
## ✨ Key Features
|
|
48
85
|
|
|
49
86
|
### 1. 🔍 Auto-Detection & Safe Scanner
|
|
50
|
-
LaraTS inspects
|
|
51
|
-
- **Laravel**: Detects Laravel version, Filament Admin panel, Livewire, Inertia.js, Sanctum, and Modular architecture.
|
|
52
|
-
- **TypeScript**: Detects Express, NestJS, Fastify, Next.js, React, Prisma ORM, TypeORM, Drizzle, Monorepos, and Modular setups.
|
|
87
|
+
LaraTS safely inspects root manifest files (`package.json`, `composer.json`, `tsconfig.json`) solely to detect your framework and architectural stack, without parsing application logic or reading `.env*` secrets:
|
|
88
|
+
- **Laravel**: Detects Laravel version (10.x vs 11+), Filament Admin panel, Livewire, Inertia.js, Sanctum, and Modular architecture (`app/Modules/`, `modules/`, `Modules/`).
|
|
89
|
+
- **TypeScript**: Detects Express, NestJS, Fastify, Next.js, React, Prisma ORM, TypeORM, Drizzle, Monorepos (`apps/*/src`, `packages/*/src`), and Modular setups (`src/modules/`).
|
|
53
90
|
|
|
54
91
|
When you run `larats scan`:
|
|
55
92
|
- Indexes architectural components (Counts and samples).
|
|
56
93
|
- Builds a clean, high-level directory tree.
|
|
57
|
-
- Generates an interactive **Mermaid.js flowchart (`flowchart TD`)** showing the entire request lifecycle across layers.
|
|
58
|
-
- Outputs a
|
|
94
|
+
- Generates an interactive **Mermaid.js flowchart (`flowchart TD`)** showing the entire request lifecycle across layers, dynamically adapting to CLI applications or web services.
|
|
95
|
+
- Outputs a deterministic, diff-friendly `ARCHITECTURE.md` file.
|
|
59
96
|
|
|
60
97
|
### 2. 🏗️ Contextual Module Scaffolder
|
|
61
98
|
Create new features in seconds with consistent boilerplate:
|
|
@@ -88,10 +125,10 @@ LaraTS will **NEVER** silently overwrite your existing code. If a target file al
|
|
|
88
125
|
LaraTS was engineered from the ground up for strict security:
|
|
89
126
|
- **100% Offline & Local**: Zero network calls, telemetry, or third-party tracking.
|
|
90
127
|
- **Strict Ignore List (`SAFE_IGNORE_LIST`)**:
|
|
91
|
-
- Never reads or includes `**/node_modules/**`, `**/vendor/**`, `**/.git/**`, `**/storage/**`, `**/dist/**`,
|
|
92
|
-
- Never
|
|
93
|
-
- Never indexes lock/log files: `**/*.log`, `**/*.lock`, `package-lock.json`, `pnpm-lock.yaml`, `composer.lock`.
|
|
94
|
-
- **
|
|
128
|
+
- Never reads or includes `**/node_modules/**`, `**/vendor/**`, `**/.git/**`, `**/storage/**`, `**/dist/**`, `build/**`, `out/**`, `tmp/**`.
|
|
129
|
+
- Never touches keys or cloud secrets: `**/.env*`, `**/*.pem`, `**/*.key`, `**/*.p12`, `**/*.jks`, `**/*.keystore`, `**/.aws/**`, `**/.ssh/**`, `**/secrets/**`, `**/credentials*.json`, `**/*service-account*.json`, `**/id_rsa*`, `**/id_ed25519*`, `**/id_ecdsa*`.
|
|
130
|
+
- Never indexes lock/log files: `**/*.log`, `**/*.lock`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`, `composer.lock`.
|
|
131
|
+
- **Manifest & Structure Only**: Scanner safely inspects package manifests (`package.json`, `composer.json`) solely to identify framework and ORM types, and relative file paths to categorize layers. It never reads private configuration values, `.env*` secrets, or internal application logic.
|
|
95
132
|
|
|
96
133
|
---
|
|
97
134
|
|
|
@@ -104,19 +141,22 @@ USAGE:
|
|
|
104
141
|
|
|
105
142
|
COMMANDS:
|
|
106
143
|
scan Scan repository & generate ARCHITECTURE.md
|
|
144
|
+
view, preview Open interactive architecture diagram in local browser
|
|
107
145
|
scaffold, make [name] Scaffold a new module or feature with clean boilerplate
|
|
108
146
|
info Show detected project type & architectural flavor
|
|
109
147
|
help Display help message
|
|
110
148
|
|
|
111
149
|
OPTIONS:
|
|
112
|
-
-o, --output <file> Output
|
|
150
|
+
-o, --output <file> Output path for scan (default: ARCHITECTURE.md)
|
|
151
|
+
--view Open local browser viewer immediately after scanning
|
|
152
|
+
-t, --tree Print directory tree in terminal
|
|
153
|
+
--html Also export standalone ARCHITECTURE.html
|
|
113
154
|
-m, --modular Enforce modular directory structure
|
|
114
155
|
-s, --standard Enforce standard/layered directory structure
|
|
115
156
|
--dry-run Simulate generation without writing files
|
|
116
157
|
-f, --force Overwrite files if they already exist
|
|
117
158
|
-v, --version Display CLI version
|
|
118
159
|
-h, --help Display help message
|
|
119
|
-
```
|
|
120
160
|
|
|
121
161
|
### Examples
|
|
122
162
|
|
|
@@ -133,6 +173,14 @@ larats scaffold Order --dry-run
|
|
|
133
173
|
|
|
134
174
|
---
|
|
135
175
|
|
|
176
|
+
## ⚠️ Limitations & Notes
|
|
177
|
+
|
|
178
|
+
- **Express Boilerplate**: For TypeScript projects, the scaffolder generates Express-compatible controllers and routers. If using NestJS, Fastify, or Next.js, use the generated domain logic (DTOs, Repositories, Services) and adapt HTTP routing accordingly.
|
|
179
|
+
- **Route Registration**: LaraTS does not automatically alter your main entrypoint files (`routes/api.php`, `src/app.ts`). Recommended mounting code is displayed in next steps upon scaffold completion.
|
|
180
|
+
- **Conventions**: Module and component detection relies on standard industry conventions (`app/Modules/`, `src/modules/`, `apps/*/src/`, etc.). Non-standard custom layouts may fall back to generic source classification.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
136
184
|
## 🛠️ Development & Contributing
|
|
137
185
|
|
|
138
186
|
```bash
|