vibe-arch 0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 vibe-arch contributors
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,472 @@
1
+ # vibe-arch β€” AI Architecture Context Manager πŸš€
2
+
3
+ **The Multi-Platform AI Architecture Context Manager for Vibe Coding.**
4
+
5
+ **vibe-arch** is a universal tool designed to help AI agents (Claude, Gemini, GPT, etc.) perfectly understand your project's architecture and write code strictly within your defined rules. Say goodbye to repeatedly explaining complex guidelines in your promptsβ€”this tool dynamically injects the optimal context into the AI in real time.
6
+
7
+ ---
8
+
9
+ ## πŸ“¦ Installation
10
+
11
+ ### npm (Recommended)
12
+
13
+ ```bash
14
+ npm install -g vibe-arch
15
+ ```
16
+
17
+ ### Local Installation
18
+
19
+ ```bash
20
+ git clone https://github.com/vibe-arch/vibe-arch.git
21
+ cd vibe-arch
22
+ npm install
23
+ npm run build
24
+ npm install -g .
25
+ ```
26
+
27
+ ### Verify Installation
28
+
29
+ ```bash
30
+ vibe-arch --help
31
+ ```
32
+
33
+ ---
34
+
35
+ ## πŸ”‘ Setup: OpenAI API Key (Optional)
36
+
37
+ If you want better, context-aware architecture recommendations, set your OpenAI API key:
38
+
39
+ ```bash
40
+ # Windows
41
+ setx OPENAI_API_KEY "sk-your-api-key-here"
42
+
43
+ # macOS/Linux
44
+ export OPENAI_API_KEY="sk-your-api-key-here"
45
+ ```
46
+
47
+ **No API key? No problem!** The tool can still analyze your project structure and fall back to local logic to select the best architecture automatically.
48
+
49
+ ---
50
+
51
+ ## ✨ Key Features
52
+
53
+ - 🧠 **AI-Driven Deep Scan:** Comprehensively analyzes your project structure to provide context, helping AI (Gemini/Claude) deduce the optimal architecture.
54
+ - πŸ“‚ **Flexible Metadata Storage:** Choose between **Inline** injection (metadata inside source code) or **Sidecar** mirroring (metadata kept in a separate directory).
55
+ - πŸ—οΈ **Architecture Guardrails:** Supports Hexagonal, Clean, MVC, Layered, and **Modular** patterns, synchronizing AI context in real time.
56
+ - πŸ“– **AI Behavior Guide:** Automatically generates instructions that force the AI to read the top metadata (`@arch`) before modifying any file.
57
+ - πŸ› οΈ **Background Monitoring:** Runs as a daemon to inject architecture info in real time without hogging your terminal.
58
+
59
+ ---
60
+
61
+ ## πŸ“„ Man Page
62
+
63
+ ### NAME
64
+
65
+ vibe-arch β€” Real-time architecture context and metadata management tool for AI agents
66
+
67
+ ### SYNOPSIS
68
+
69
+ vibe-arch <command> [directory] [options]
70
+
71
+ ### DESCRIPTION
72
+
73
+ vibe-arch defines your project's architectural rules and manages metadata
74
+ via source code comments (Inline) or a mirrored directory (Sidecar),
75
+ ensuring AI agents are instantly aware of constraints in real time.
76
+
77
+ ### COMMANDS
78
+
79
+ init [dir]
80
+ Comprehensively analyzes the project structure to generate AI prompts.
81
+ Interactively completes the .arch-spec.json configuration based on AI judgment.
82
+ [Options: --arch, --lang, --injection, --yes]
83
+
84
+ update [dir]
85
+ Synchronizes all source files according to the configured architecture rules.
86
+ Injects comments at the top of files (Inline) or bulk creates/updates
87
+ metadata documents in the arch/ folder (Sidecar).
88
+ [Options: (none)]
89
+
90
+ start [dir]
91
+ Starts the background monitoring daemon. Detects file changes in real time
92
+ and instantly updates architecture metadata and AI context files (e.g., CLAUDE.md).
93
+ [Options: (none)]
94
+
95
+ stop [dir]
96
+ Safely stops the running background daemon and cleans up PID files.
97
+ [Options: (none)]
98
+
99
+ status [dir]
100
+ Reports the daemon's running status and the project's current architecture
101
+ coverage (Health) along with visual graphs.
102
+ [Options: (none)]
103
+
104
+ logs [dir]
105
+ Outputs the tail of the daemon execution logs.
106
+ [Options: --lines]
107
+
108
+ ### OPTIONS
109
+
110
+ --arch <pattern>
111
+ Specifies the architecture pattern to analyze (hexagonal, clean, mvc, layered, modular).
112
+ (init command only)
113
+
114
+ --lang <language>
115
+ Specifies the primary language of the project (typescript, java, python, go, etc.).
116
+ (init command only)
117
+
118
+ --injection <mode>
119
+ Specifies the metadata storage method (inline, sidecar, disabled). Default is inline.
120
+ (init command only)
121
+
122
+ -y, --yes
123
+ Runs in non-interactive mode. Automatically completes setup with defaults,
124
+ optimized for AI agent execution environments.
125
+ (init command only)
126
+
127
+ --lines <n>
128
+ Specifies the number of log lines to output when using the logs command. Default is 50.
129
+ (logs command only)
130
+
131
+ ### FILES
132
+
133
+ .arch-spec.json
134
+ The core configuration file containing the project's architecture rules and layer definitions.
135
+
136
+ CLAUDE.md, GEMINI.md, AI.md
137
+ Architecture guideline files provided to AI agents in real time.
138
+
139
+ arch/
140
+ The folder used in Sidecar mode to store metadata by mirroring the source code structure.
141
+
142
+ ---
143
+
144
+ ## πŸ’‘ Examples
145
+
146
+ ### 1️⃣ **Initializing a New Project**
147
+
148
+ #### Scenario: Starting a React project and preparing it for AI collaboration
149
+
150
+ ```bash
151
+ # Interactive mode: Make all choices manually
152
+ $ vibe-arch init
153
+
154
+ [vibe-arch] Analyzing Project: /my-react-app
155
+
156
+ How would you like to define the architecture pattern?
157
+ ❯ πŸ€– Let AI recommend (requires OPENAI_API_KEY)
158
+ πŸ“‹ Choose manually
159
+
160
+ (Selected: AI recommend)
161
+ [vibe-arch] Calling AI for architecture recommendation...
162
+
163
+ βœ… AI recommends: modular
164
+
165
+ Use modular architecture? (Y/n) (Y)
166
+
167
+ ? Where should architecture metadata be stored?
168
+ ❯ πŸ“ Inline (at the top of each source file)
169
+ πŸ“ Sidecar (mirroring structure in /arch directory)
170
+ 🚫 Disabled (no per-file metadata)
171
+
172
+ βœ… [SUCCESS] Initialized with modular architecture!
173
+
174
+ # Generated files:
175
+ # βœ“ .arch-spec.json
176
+ # βœ“ CLAUDE.md
177
+ # βœ“ GEMINI.md
178
+ # βœ“ AI.md
179
+ ```
180
+
181
+ ---
182
+
183
+ #### Scenario: Automated initialization in a CI/CD pipeline (GitHub Actions)
184
+
185
+ ```bash
186
+ # Non-interactive mode: Complete setup in a single line
187
+ $ vibe-arch init -y --arch modular --injection sidecar
188
+
189
+ [vibe-arch] Analyzing Project: /project
190
+ [vibe-arch] Analyzing project for optimal architecture...
191
+ [vibe-arch] Selected: modular
192
+
193
+ βœ… [SUCCESS] Initialized with modular architecture!
194
+ ```
195
+
196
+ ---
197
+
198
+ #### Scenario: Forcing a Hexagonal architecture on an existing project
199
+
200
+ ```bash
201
+ # Specify the pattern explicitly
202
+ $ vibe-arch init /path/to/project --arch hexagonal --lang typescript
203
+
204
+ [vibe-arch] Analyzing Project: /path/to/project
205
+ [vibe-arch] Selected: hexagonal
206
+
207
+ ? Where should architecture metadata be stored?
208
+ ❯ πŸ“ Inline (at the top of each source file)
209
+ πŸ“ Sidecar (mirroring structure in /arch directory)
210
+
211
+ βœ… [SUCCESS] Initialized with hexagonal architecture!
212
+ ```
213
+
214
+ ---
215
+
216
+ ### 2️⃣ **Bulk Syncing Architecture Metadata**
217
+
218
+ #### Scenario: You added new files and want to apply architecture metadata across the board
219
+
220
+ ```bash
221
+ $ vibe-arch update
222
+
223
+ [vibe-arch] Bulk updating architecture metadata for all source files...
224
+ βœ… [vibe-arch] Successfully synced 42 files.
225
+
226
+ # Result:
227
+ # - src/components/Button.tsx β†’ @arch metadata added
228
+ # - src/services/api.ts β†’ @arch metadata added
229
+ # - src/utils/helpers.ts β†’ @arch metadata added
230
+ # ... (All 42 files processed)
231
+
232
+ # CLAUDE.md is also automatically updated!
233
+ ```
234
+
235
+ ---
236
+
237
+ ### 3️⃣ **Starting the Background Daemon (Real-time Watcher)**
238
+
239
+ #### Scenario: Developing in Cursor IDE and wanting metadata injected automatically upon file creation
240
+
241
+ ```bash
242
+ # Start the daemon (Runs in the background, frees your terminal)
243
+ $ vibe-arch start
244
+
245
+ [vibe-arch] Daemon started. PID: 2840
246
+ [vibe-arch] Log: ~/.vibe-arch/logs/project_key.log
247
+
248
+ # Works silently in the background:
249
+ # - Detects file creation β†’ Injects @arch metadata
250
+ # - Detects file modifications β†’ Updates CLAUDE.md
251
+ # - Detects rule violations β†’ Writes to logs
252
+ ```
253
+
254
+ ---
255
+
256
+ ### 4️⃣ **Checking Daemon Status**
257
+
258
+ #### Scenario: Verifying if the daemon is running properly
259
+
260
+ ```bash
261
+ $ vibe-arch status
262
+
263
+ [vibe-arch] Daemon Status
264
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
265
+ βœ… Running (PID: 2840)
266
+ πŸ“Š Architecture: modular
267
+ πŸ“ Coverage: 38/42 files (90%)
268
+
269
+ Architecture Breakdown:
270
+ 🧩 modular β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘ 28 files
271
+ πŸ“š shared β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 5 files
272
+ 🎯 app β–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 5 files
273
+
274
+ Last Updated: 2 seconds ago
275
+ ```
276
+
277
+ ---
278
+
279
+ ### 5️⃣ **Viewing Daemon Logs**
280
+
281
+ #### Scenario: Something seems wrong, or a new file wasn't processed
282
+
283
+ ```bash
284
+ # Check the last 100 lines of the log
285
+ $ vibe-arch logs --lines 100
286
+
287
+ [2026-03-15T10:23:45.123Z] [vibe-arch] File created: src/components/Modal.tsx
288
+ [2026-03-15T10:23:46.456Z] [vibe-arch] Injected @arch metadata
289
+ [2026-03-15T10:24:12.789Z] [vibe-arch] File modified: src/services/auth.ts
290
+ [2026-03-15T10:24:13.012Z] [vibe-arch] Updated CLAUDE.md
291
+ [2026-03-15T10:25:01.345Z] [vibe-arch] Daemon health check: OK
292
+ ...
293
+ ```
294
+
295
+ ---
296
+
297
+ ### 6️⃣ **Stopping the Daemon**
298
+
299
+ #### Scenario: Wrapping up work and shutting down the watcher
300
+
301
+ ```bash
302
+ $ vibe-arch stop
303
+
304
+ [vibe-arch] Stopping daemon (PID: 2840)
305
+ [vibe-arch] Cleanup complete.
306
+
307
+ # When you need it again:
308
+ $ vibe-arch start
309
+ ```
310
+
311
+ ---
312
+
313
+ ## 🎯 **Real-world Workflows**
314
+
315
+ ### The Ultimate Developer Workflow
316
+
317
+ #### **Step 1: Project Setup (One-time)**
318
+
319
+ ```bash
320
+ # Create a new project
321
+ $npx create-react-app my-app$ cd my-app
322
+
323
+ # Install vibe-arch
324
+ $ npm install vibe-arch
325
+
326
+ # Initialize architecture (Interactive)
327
+ $ vibe-arch init
328
+ β†’ AI recommends "modular"
329
+ β†’ Choose "Inline" metadata
330
+
331
+ βœ… .arch-spec.json generated
332
+ βœ… CLAUDE.md generated
333
+ ```
334
+
335
+ #### **Step 2: Start Background Watcher**
336
+
337
+ ```bash
338
+ $ vibe-arch start
339
+
340
+ βœ… Background file monitoring started
341
+ ```
342
+
343
+ #### **Step 3: Daily Development (Automated)**
344
+
345
+ ```
346
+ (Writing code in Cursor IDE)
347
+ β†’ Create a new component file
348
+ β†’ vibe-arch detects it automatically
349
+ β†’ @arch metadata injected instantly
350
+ β†’ CLAUDE.md refreshed
351
+ β†’ Claude uses the latest architecture context βœ…
352
+ ```
353
+
354
+ #### **Step 4: AI Code Generation / Review**
355
+
356
+ ```bash
357
+ # Prompting Claude:
358
+
359
+ "Can you understand the structure of src/components/Button.tsx and add the following feature?"
360
+
361
+ (Claude reads the @arch metadata)
362
+ β†’ Understands this file belongs to the "presentation" layer
363
+ β†’ Knows it can only communicate with the "business" layer
364
+ β†’ Knows direct access to the "persistence" layer is forbidden
365
+ β†’ Generates code maintaining the correct architecture βœ…
366
+ ```
367
+
368
+ ---
369
+
370
+ ### CI/CD Pipeline Example
371
+
372
+ #### **Automated Context Sync in GitHub Actions**
373
+
374
+ ```yaml
375
+ name: Sync vibe-arch Metadata
376
+
377
+ on:
378
+ push:
379
+ branches: [main]
380
+
381
+ jobs:
382
+ arch-setup:
383
+ runs-on: ubuntu-latest
384
+ permissions:
385
+ contents: write # ⚠️ Required to push changes back to the repo
386
+ steps:
387
+ - uses: actions/checkout@v3
388
+
389
+ - uses: actions/setup-node@v3
390
+ with:
391
+ node-version: "18"
392
+
393
+ - name: Install vibe-arch
394
+ run: npm install -g vibe-arch
395
+
396
+ - name: Sync architecture metadata
397
+ env:
398
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
399
+ run: vibe-arch init -y --injection sidecar
400
+
401
+ - name: Commit and Push changes
402
+ run: |
403
+ git config --local user.email "action@github.com"
404
+ git config --local user.name "GitHub Action"
405
+ git add .arch-spec.json CLAUDE.md GEMINI.md AI.md arch/
406
+ git commit -m "chore: update architecture metadata [skip ci]" || echo "No changes to commit"
407
+ git push
408
+ ```
409
+
410
+ ---
411
+
412
+ ### Team Collaboration Example
413
+
414
+ #### **Pre-Review Health Check**
415
+
416
+ ```bash
417
+ $ vibe-arch status
418
+
419
+ βœ… Running (PID: 2840)
420
+ πŸ“Š Architecture: hexagonal
421
+ πŸ“ Coverage: 95/100 files (95%)
422
+
423
+ # β†’ "Great! Most files have metadata.
424
+ # We can easily verify architecture rules during PR reviews."
425
+ ```
426
+
427
+ ---
428
+
429
+ ## πŸš€ **More Use Cases**
430
+
431
+ | Scenario | Recommended Command |
432
+ | :-------------------------------------------------- | :---------------------------- |
433
+ | Onboarding a new team member to the architecture | Show them `CLAUDE.md` |
434
+ | Bulk applying metadata to a legacy codebase | `vibe-arch update` |
435
+ | Real-time context syncing during active development | `vibe-arch start` |
436
+ | Checking architecture coverage before deployment | `vibe-arch status` |
437
+ | Making data-driven architecture decisions | `vibe-arch logs --lines 1000` |
438
+
439
+ ---
440
+
441
+ ## 🀝 Contributing
442
+
443
+ We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to contribute.
444
+
445
+ ### Ways to Contribute
446
+
447
+ - πŸ› Report bugs via [GitHub Issues](https://github.com/vibe-arch/vibe-arch/issues)
448
+ - πŸ’‘ Suggest improvements and new features
449
+ - πŸ“ Improve documentation
450
+ - πŸ’» Submit code improvements via Pull Requests
451
+ - 🌍 Help translate or localize for other languages
452
+
453
+ ---
454
+
455
+ ## πŸ“ž Support
456
+
457
+ - πŸ“– **Documentation**: Check [README.md](README.md) and [Examples](#-examples)
458
+ - πŸ› **Report Issues**: [GitHub Issues](https://github.com/vibe-arch/vibe-arch/issues)
459
+ - πŸ’¬ **Discussions**: [GitHub Discussions](https://github.com/vibe-arch/vibe-arch/discussions)
460
+ - πŸ“§ **Email**: Open an issue if you need to reach out privately
461
+
462
+ ---
463
+
464
+ ## πŸ“Š Version History
465
+
466
+ See [CHANGELOG.md](CHANGELOG.md) for detailed version history and changes.
467
+
468
+ ---
469
+
470
+ ## πŸ“„ License
471
+
472
+ MIT License.