larats 0.0.0-stage → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +159 -2
- package/dist/index.cjs +1744 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1721 -0
- package/dist/index.js.map +1 -0
- package/package.json +57 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sidiq Fatuh
|
|
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.
|
|
22
|
+
|
package/README.md
CHANGED
|
@@ -1,3 +1,160 @@
|
|
|
1
|
-
#
|
|
1
|
+
# LaraTS ⚡
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **Smart Architecture Visualizer & Contextual Module Scaffolder CLI**
|
|
4
|
+
> Tailor-made for **Laravel** & **TypeScript** (Node.js / Express / React / Monorepo) projects.
|
|
5
|
+
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://nodejs.org)
|
|
8
|
+
[](https://www.typescriptlang.org/)
|
|
9
|
+
[](#-strict-security--safety-guarantees)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 💡 What is LaraTS?
|
|
14
|
+
|
|
15
|
+
When codebases grow large, developers often struggle to understand the architecture or keep module structures consistent across teams. **LaraTS** solves this with two core capabilities:
|
|
16
|
+
|
|
17
|
+
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
|
+
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).
|
|
19
|
+
3. 🔒 **100% Local & Secure**: No data ever leaves your computer. Sensitive files (`.env`, private keys, vendor folders) are strictly excluded.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 🚀 Quick Start
|
|
24
|
+
|
|
25
|
+
Run instantly without installation via `npx`:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Interactive menu mode
|
|
29
|
+
npx larats
|
|
30
|
+
|
|
31
|
+
# Or scan architecture directly
|
|
32
|
+
npx larats scan
|
|
33
|
+
|
|
34
|
+
# Or scaffold a new module directly
|
|
35
|
+
npx larats scaffold Payment
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Or install globally:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install -g larats
|
|
42
|
+
larats
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## ✨ Key Features
|
|
48
|
+
|
|
49
|
+
### 1. 🔍 Auto-Detection & Safe Scanner
|
|
50
|
+
LaraTS inspects configuration files to detect your stack:
|
|
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.
|
|
53
|
+
|
|
54
|
+
When you run `larats scan`:
|
|
55
|
+
- Indexes architectural components (Counts and samples).
|
|
56
|
+
- 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 comprehensive `ARCHITECTURE.md` file.
|
|
59
|
+
|
|
60
|
+
### 2. 🏗️ Contextual Module Scaffolder
|
|
61
|
+
Create new features in seconds with consistent boilerplate:
|
|
62
|
+
|
|
63
|
+
- **Laravel Options**:
|
|
64
|
+
- `Model`: Eloquent model with `$table`, `$fillable`, and `$casts`.
|
|
65
|
+
- `Controller`: Resourceful API Controller with Dependency-Injected Service.
|
|
66
|
+
- `Service`: Encapsulated business logic service (`getAll`, `getById`, `create`, `update`, `delete`).
|
|
67
|
+
- `Action`: Single-responsibility invokable class (`execute` method).
|
|
68
|
+
- `FormRequest`: Authorization and validation rules.
|
|
69
|
+
- `Migration`: Timestamped schema migration.
|
|
70
|
+
- **Structure choices**: Modular Domain (`app/Modules/<Name>`) or Standard Laravel (`app/Models`, `app/Http/Controllers`, etc.).
|
|
71
|
+
|
|
72
|
+
- **TypeScript Options**:
|
|
73
|
+
- `Controller`: Express request handler with error handling.
|
|
74
|
+
- `Service`: Business logic service.
|
|
75
|
+
- `Repository`: Data access layer interface and implementation.
|
|
76
|
+
- `Route`: Express router connected to controller actions.
|
|
77
|
+
- `DTO / Schema`: Strongly-typed TypeScript interfaces and payloads.
|
|
78
|
+
- `Barrel Export`: Automatic `index.ts` export for modular cohesion.
|
|
79
|
+
- **Structure choices**: Feature Module (`src/modules/<name>/...`) or Layered structure (`src/controllers/`, `src/services/`, etc.).
|
|
80
|
+
|
|
81
|
+
### 3. 🛡️ Anti-Overwrite Protection
|
|
82
|
+
LaraTS will **NEVER** silently overwrite your existing code. If a target file already exists, LaraTS skips it and alerts you. You can only overwrite files by explicitly providing `--force`.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 🔒 Strict Security & Safety Guarantees
|
|
87
|
+
|
|
88
|
+
LaraTS was engineered from the ground up for strict security:
|
|
89
|
+
- **100% Offline & Local**: Zero network calls, telemetry, or third-party tracking.
|
|
90
|
+
- **Strict Ignore List (`SAFE_IGNORE_LIST`)**:
|
|
91
|
+
- Never reads or includes `**/node_modules/**`, `**/vendor/**`, `**/.git/**`, `**/storage/**`, `**/dist/**`, `**/build/**`.
|
|
92
|
+
- Never exposes environment files: `**/.env*`, `**/*.pem`, `**/*.key`, `**/*.pfx`, `**/*.cert`.
|
|
93
|
+
- Never indexes lock/log files: `**/*.log`, `**/*.lock`, `package-lock.json`, `pnpm-lock.yaml`, `composer.lock`.
|
|
94
|
+
- **Metadata Only**: Scanner only analyzes file paths and relative folder structures; no private application configurations or secrets are extracted.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 💻 CLI Usage & Commands
|
|
99
|
+
|
|
100
|
+
```text
|
|
101
|
+
USAGE:
|
|
102
|
+
$ npx larats [command] [options]
|
|
103
|
+
$ larats [command] [options]
|
|
104
|
+
|
|
105
|
+
COMMANDS:
|
|
106
|
+
scan Scan repository & generate ARCHITECTURE.md
|
|
107
|
+
scaffold, make [name] Scaffold a new module or feature with clean boilerplate
|
|
108
|
+
info Show detected project type & architectural flavor
|
|
109
|
+
help Display help message
|
|
110
|
+
|
|
111
|
+
OPTIONS:
|
|
112
|
+
-o, --output <file> Output markdown path for scan (default: ARCHITECTURE.md)
|
|
113
|
+
-m, --modular Enforce modular directory structure
|
|
114
|
+
-s, --standard Enforce standard/layered directory structure
|
|
115
|
+
--dry-run Simulate generation without writing files
|
|
116
|
+
-f, --force Overwrite files if they already exist
|
|
117
|
+
-v, --version Display CLI version
|
|
118
|
+
-h, --help Display help message
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Examples
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Scan and save to custom documentation path
|
|
125
|
+
larats scan --output docs/ARCHITECTURE.md
|
|
126
|
+
|
|
127
|
+
# Scaffold a 'Payment' module with modular structure
|
|
128
|
+
larats scaffold Payment --modular
|
|
129
|
+
|
|
130
|
+
# Dry-run test scaffolding without writing files
|
|
131
|
+
larats scaffold Order --dry-run
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 🛠️ Development & Contributing
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Clone repository
|
|
140
|
+
git clone https://github.com/SidiqFatuh187/Larats.git
|
|
141
|
+
cd Larats
|
|
142
|
+
|
|
143
|
+
# Install dependencies
|
|
144
|
+
npm install
|
|
145
|
+
|
|
146
|
+
# Run test suite
|
|
147
|
+
npm test
|
|
148
|
+
|
|
149
|
+
# Build distribution bundle
|
|
150
|
+
npm run build
|
|
151
|
+
|
|
152
|
+
# Run local build
|
|
153
|
+
node dist/index.js
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## 📄 License
|
|
159
|
+
|
|
160
|
+
Licensed under the [MIT License](LICENSE).
|