musubix 1.0.1 → 1.0.3

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.
@@ -0,0 +1,503 @@
1
+ # Project Structure
2
+
3
+ **Project**: MUSUBIX
4
+ **Last Updated**: 2026-01-01
5
+ **Version**: 1.0
6
+
7
+ ---
8
+
9
+ ## Architecture Pattern
10
+
11
+ **Primary Pattern**: {{ARCHITECTURE_PATTERN}}
12
+
13
+ > [Description of the architecture pattern used in this project]
14
+ > Examples: Monorepo with Library-First, Microservices, Modular Monolith, Serverless
15
+
16
+ ---
17
+
18
+ ## Architecture Layers (Language-Agnostic)
19
+
20
+ The following layer definitions apply regardless of programming language:
21
+
22
+ ### Layer 1: Domain / Core
23
+
24
+ **Purpose**: Business logic and domain models
25
+ **Rules**:
26
+
27
+ - MUST NOT depend on any other layer
28
+ - Contains: Entities, Value Objects, Domain Services, Domain Events
29
+ - No framework dependencies, no I/O
30
+
31
+ **Language Examples**:
32
+ | Language | Location | Pattern |
33
+ |----------|----------|---------|
34
+ | TypeScript | `lib/{feature}/domain/` | Classes/Types |
35
+ | Rust | `{crate}/src/domain/` | Structs + Traits |
36
+ | Python | `src/{pkg}/domain/` | Dataclasses |
37
+ | Go | `internal/domain/` | Structs + Interfaces |
38
+ | Java | `src/main/.../domain/` | Classes + Records |
39
+
40
+ ### Layer 2: Application / Use Cases
41
+
42
+ **Purpose**: Orchestrate domain logic, implement use cases
43
+ **Rules**:
44
+
45
+ - Depends only on Domain layer
46
+ - Contains: Application Services, Commands, Queries, DTOs
47
+ - No direct I/O (uses ports/interfaces)
48
+
49
+ **Language Examples**:
50
+ | Language | Location | Pattern |
51
+ |----------|----------|---------|
52
+ | TypeScript | `lib/{feature}/application/` | Service classes |
53
+ | Rust | `{crate}/src/application/` | Impl blocks |
54
+ | Python | `src/{pkg}/application/` | Service functions |
55
+ | Go | `internal/app/` | Service structs |
56
+ | Java | `src/main/.../application/` | @Service classes |
57
+
58
+ ### Layer 3: Infrastructure / Adapters
59
+
60
+ **Purpose**: External integrations (DB, APIs, messaging)
61
+ **Rules**:
62
+
63
+ - Depends on Application layer (implements ports)
64
+ - Contains: Repositories, API Clients, Message Publishers
65
+ - All I/O operations here
66
+
67
+ **Language Examples**:
68
+ | Language | Location | Pattern |
69
+ |----------|----------|---------|
70
+ | TypeScript | `lib/{feature}/infrastructure/` | Repository impls |
71
+ | Rust | `{crate}/src/infrastructure/` | Trait impls |
72
+ | Python | `src/{pkg}/infrastructure/` | Repository classes |
73
+ | Go | `internal/infra/` | Interface impls |
74
+ | Java | `src/main/.../infrastructure/` | @Repository classes |
75
+
76
+ ### Layer 4: Interface / Presentation
77
+
78
+ **Purpose**: Entry points (CLI, API, Web UI)
79
+ **Rules**:
80
+
81
+ - Depends on Application layer
82
+ - Contains: Controllers, CLI handlers, API routes
83
+ - Input validation and response formatting
84
+
85
+ **Language Examples**:
86
+ | Language | Location | Pattern |
87
+ |----------|----------|---------|
88
+ | TypeScript | `app/api/` or `cli/` | Route handlers |
89
+ | Rust | `{crate}/src/api/` or `cli/` | Axum handlers |
90
+ | Python | `src/{pkg}/api/` or `cli/` | FastAPI routes |
91
+ | Go | `cmd/` or `internal/api/` | HTTP handlers |
92
+ | Java | `src/main/.../api/` | @RestController |
93
+
94
+ ### Layer Dependency Rules
95
+
96
+ ```
97
+ ┌─────────────────────────────────────────┐
98
+ │ Interface / Presentation │ ← Entry points
99
+ ├─────────────────────────────────────────┤
100
+ │ Application / Use Cases │ ← Orchestration
101
+ ├─────────────────────────────────────────┤
102
+ │ Infrastructure / Adapters │ ← I/O & External
103
+ ├─────────────────────────────────────────┤
104
+ │ Domain / Core │ ← Pure business logic
105
+ └─────────────────────────────────────────┘
106
+
107
+ Dependency Direction: ↓ (outer → inner)
108
+ Domain layer has NO dependencies
109
+ ```
110
+
111
+ ---
112
+
113
+ ## Directory Organization
114
+
115
+ ### Root Structure
116
+
117
+ ```
118
+ MUSUBIX/
119
+ ├── lib/ # Reusable libraries (Article I: Library-First)
120
+ ├── app/ # Application code (Next.js, etc.)
121
+ ├── api/ # API routes/controllers
122
+ ├── components/ # UI components
123
+ ├── services/ # Business logic services
124
+ ├── tests/ # Test suites
125
+ ├── docs/ # Documentation
126
+ ├── storage/ # SDD artifacts
127
+ │ ├── specs/ # Requirements, design, tasks
128
+ │ ├── changes/ # Delta specifications (brownfield)
129
+ │ └── validation/ # Validation reports
130
+ ├── steering/ # Project memory (this directory)
131
+ │ ├── structure.md # This file
132
+ │ ├── tech.md # Technology stack
133
+ │ ├── product.md # Product context
134
+ │ └── rules/ # Constitutional governance
135
+ ├── templates/ # Document templates
136
+ └── [Other directories]
137
+ ```
138
+
139
+ ---
140
+
141
+ ## Library-First Pattern (Article I)
142
+
143
+ All features begin as independent libraries in `lib/`.
144
+
145
+ ### Library Structure
146
+
147
+ Each library follows this structure:
148
+
149
+ ```
150
+ lib/{{feature}}/
151
+ ├── src/
152
+ │ ├── index.ts # Public API exports
153
+ │ ├── service.ts # Business logic
154
+ │ ├── repository.ts # Data access
155
+ │ ├── types.ts # TypeScript types
156
+ │ ├── errors.ts # Custom errors
157
+ │ └── validators.ts # Input validation
158
+ ├── tests/
159
+ │ ├── service.test.ts # Unit tests
160
+ │ ├── repository.test.ts # Integration tests (real DB)
161
+ │ └── integration.test.ts # E2E tests
162
+ ├── cli.ts # CLI interface (Article II)
163
+ ├── package.json # Library metadata
164
+ ├── tsconfig.json # TypeScript config
165
+ └── README.md # Library documentation
166
+ ```
167
+
168
+ ### Library Guidelines
169
+
170
+ - **Independence**: Libraries MUST NOT depend on application code
171
+ - **Public API**: All exports via `src/index.ts`
172
+ - **Testing**: Independent test suite
173
+ - **CLI**: All libraries expose CLI interface (Article II)
174
+
175
+ ---
176
+
177
+ ## Application Structure
178
+
179
+ ### Application Organization
180
+
181
+ ```
182
+ app/
183
+ ├── (auth)/ # Route groups (Next.js App Router)
184
+ │ ├── login/
185
+ │ │ └── page.tsx
186
+ │ └── register/
187
+ │ └── page.tsx
188
+ ├── dashboard/
189
+ │ └── page.tsx
190
+ ├── api/ # API routes
191
+ │ ├── auth/
192
+ │ │ └── route.ts
193
+ │ └── users/
194
+ │ └── route.ts
195
+ ├── layout.tsx # Root layout
196
+ └── page.tsx # Home page
197
+ ```
198
+
199
+ ### Application Guidelines
200
+
201
+ - **Library Usage**: Applications import from `lib/` modules
202
+ - **Thin Controllers**: API routes delegate to library services
203
+ - **No Business Logic**: Business logic belongs in libraries
204
+
205
+ ---
206
+
207
+ ## Component Organization
208
+
209
+ ### UI Components
210
+
211
+ ```
212
+ components/
213
+ ├── ui/ # Base UI components (shadcn/ui)
214
+ │ ├── button.tsx
215
+ │ ├── input.tsx
216
+ │ └── card.tsx
217
+ ├── auth/ # Feature-specific components
218
+ │ ├── LoginForm.tsx
219
+ │ └── RegisterForm.tsx
220
+ ├── dashboard/
221
+ │ └── StatsCard.tsx
222
+ └── shared/ # Shared components
223
+ ├── Header.tsx
224
+ └── Footer.tsx
225
+ ```
226
+
227
+ ### Component Guidelines
228
+
229
+ - **Composition**: Prefer composition over props drilling
230
+ - **Types**: All props typed with TypeScript
231
+ - **Tests**: Component tests with React Testing Library
232
+
233
+ ---
234
+
235
+ ## Database Organization
236
+
237
+ ### Schema Organization
238
+
239
+ ```
240
+ prisma/
241
+ ├── schema.prisma # Prisma schema
242
+ ├── migrations/ # Database migrations
243
+ │ ├── 001_create_users_table/
244
+ │ │ └── migration.sql
245
+ │ └── 002_create_sessions_table/
246
+ │ └── migration.sql
247
+ └── seed.ts # Database seed data
248
+ ```
249
+
250
+ ### Database Guidelines
251
+
252
+ - **Migrations**: All schema changes via migrations
253
+ - **Naming**: snake_case for tables and columns
254
+ - **Indexes**: Index foreign keys and frequently queried columns
255
+
256
+ ---
257
+
258
+ ## Test Organization
259
+
260
+ ### Test Structure
261
+
262
+ ```
263
+ tests/
264
+ ├── unit/ # Unit tests (per library)
265
+ │ └── auth/
266
+ │ └── service.test.ts
267
+ ├── integration/ # Integration tests (real services)
268
+ │ └── auth/
269
+ │ └── login.test.ts
270
+ ├── e2e/ # End-to-end tests
271
+ │ └── auth/
272
+ │ └── user-flow.test.ts
273
+ └── fixtures/ # Test data and fixtures
274
+ └── users.ts
275
+ ```
276
+
277
+ ### Test Guidelines
278
+
279
+ - **Test-First**: Tests written BEFORE implementation (Article III)
280
+ - **Real Services**: Integration tests use real DB/cache (Article IX)
281
+ - **Coverage**: Minimum 80% coverage
282
+ - **Naming**: `*.test.ts` for unit, `*.integration.test.ts` for integration
283
+
284
+ ---
285
+
286
+ ## Documentation Organization
287
+
288
+ ### Documentation Structure
289
+
290
+ ```
291
+ docs/
292
+ ├── architecture/ # Architecture documentation
293
+ │ ├── c4-diagrams/
294
+ │ └── adr/ # Architecture Decision Records
295
+ ├── api/ # API documentation
296
+ │ ├── openapi.yaml
297
+ │ └── graphql.schema
298
+ ├── guides/ # Developer guides
299
+ │ ├── getting-started.md
300
+ │ └── contributing.md
301
+ └── runbooks/ # Operational runbooks
302
+ ├── deployment.md
303
+ └── troubleshooting.md
304
+ ```
305
+
306
+ ---
307
+
308
+ ## SDD Artifacts Organization
309
+
310
+ ### Storage Directory
311
+
312
+ ```
313
+ storage/
314
+ ├── specs/ # Specifications
315
+ │ ├── auth-requirements.md
316
+ │ ├── auth-design.md
317
+ │ ├── auth-tasks.md
318
+ │ └── payment-requirements.md
319
+ ├── changes/ # Delta specifications (brownfield)
320
+ │ ├── add-2fa.md
321
+ │ └── upgrade-jwt.md
322
+ ├── features/ # Feature tracking
323
+ │ ├── auth.json
324
+ │ └── payment.json
325
+ └── validation/ # Validation reports
326
+ ├── auth-validation-report.md
327
+ └── payment-validation-report.md
328
+ ```
329
+
330
+ ---
331
+
332
+ ## Naming Conventions
333
+
334
+ ### File Naming
335
+
336
+ - **TypeScript**: `PascalCase.tsx` for components, `camelCase.ts` for utilities
337
+ - **React Components**: `PascalCase.tsx` (e.g., `LoginForm.tsx`)
338
+ - **Utilities**: `camelCase.ts` (e.g., `formatDate.ts`)
339
+ - **Tests**: `*.test.ts` or `*.spec.ts`
340
+ - **Constants**: `SCREAMING_SNAKE_CASE.ts` (e.g., `API_ENDPOINTS.ts`)
341
+
342
+ ### Directory Naming
343
+
344
+ - **Features**: `kebab-case` (e.g., `user-management/`)
345
+ - **Components**: `kebab-case` or `PascalCase` (consistent within project)
346
+
347
+ ### Variable Naming
348
+
349
+ - **Variables**: `camelCase`
350
+ - **Constants**: `SCREAMING_SNAKE_CASE`
351
+ - **Types/Interfaces**: `PascalCase`
352
+ - **Enums**: `PascalCase`
353
+
354
+ ---
355
+
356
+ ## Integration Patterns
357
+
358
+ ### Library → Application Integration
359
+
360
+ ```typescript
361
+ // ✅ CORRECT: Application imports from library
362
+ import { AuthService } from '@/lib/auth';
363
+
364
+ const authService = new AuthService(repository);
365
+ const result = await authService.login(credentials);
366
+ ```
367
+
368
+ ```typescript
369
+ // ❌ WRONG: Library imports from application
370
+ // Libraries must NOT depend on application code
371
+ import { AuthContext } from '@/app/contexts/auth'; // Violation!
372
+ ```
373
+
374
+ ### Service → Repository Pattern
375
+
376
+ ```typescript
377
+ // Service layer (business logic)
378
+ export class AuthService {
379
+ constructor(private repository: UserRepository) {}
380
+
381
+ async login(credentials: LoginRequest): Promise<LoginResponse> {
382
+ // Business logic here
383
+ const user = await this.repository.findByEmail(credentials.email);
384
+ // ...
385
+ }
386
+ }
387
+
388
+ // Repository layer (data access)
389
+ export class UserRepository {
390
+ constructor(private prisma: PrismaClient) {}
391
+
392
+ async findByEmail(email: string): Promise<User | null> {
393
+ return this.prisma.user.findUnique({ where: { email } });
394
+ }
395
+ }
396
+ ```
397
+
398
+ ---
399
+
400
+ ## Deployment Structure
401
+
402
+ ### Deployment Units
403
+
404
+ **Projects** (independently deployable):
405
+
406
+ 1. MUSUBIX - Main application
407
+
408
+ > ⚠️ **Simplicity Gate (Article VII)**: Maximum 3 projects initially.
409
+ > If adding more projects, document justification in Phase -1 Gate approval.
410
+
411
+ ### Environment Structure
412
+
413
+ ```
414
+ environments/
415
+ ├── development/
416
+ │ └── .env.development
417
+ ├── staging/
418
+ │ └── .env.staging
419
+ └── production/
420
+ └── .env.production
421
+ ```
422
+
423
+ ---
424
+
425
+ ## Multi-Language Support
426
+
427
+ ### Language Policy
428
+
429
+ - **Primary Language**: English
430
+ - **Documentation**: English first (`.md`), then Japanese (`.ja.md`)
431
+ - **Code Comments**: English
432
+ - **UI Strings**: i18n framework
433
+
434
+ ### i18n Organization
435
+
436
+ ```
437
+ locales/
438
+ ├── en/
439
+ │ ├── common.json
440
+ │ └── auth.json
441
+ └── ja/
442
+ ├── common.json
443
+ └── auth.json
444
+ ```
445
+
446
+ ---
447
+
448
+ ## Version Control
449
+
450
+ ### Branch Organization
451
+
452
+ - `main` - Production branch
453
+ - `develop` - Development branch
454
+ - `feature/*` - Feature branches
455
+ - `hotfix/*` - Hotfix branches
456
+ - `release/*` - Release branches
457
+
458
+ ### Commit Message Convention
459
+
460
+ ```
461
+ <type>(<scope>): <subject>
462
+
463
+ <body>
464
+
465
+ <footer>
466
+ ```
467
+
468
+ **Types**: `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`
469
+
470
+ **Example**:
471
+
472
+ ```
473
+ feat(auth): implement user login (REQ-AUTH-001)
474
+
475
+ Add login functionality with email and password authentication.
476
+ Session created with 24-hour expiry.
477
+
478
+ Closes REQ-AUTH-001
479
+ ```
480
+
481
+ ---
482
+
483
+ ## Constitutional Compliance
484
+
485
+ This structure enforces:
486
+
487
+ - **Article I**: Library-first pattern in `lib/`
488
+ - **Article II**: CLI interfaces per library
489
+ - **Article III**: Test structure supports Test-First
490
+ - **Article VI**: Steering files maintain project memory
491
+
492
+ ---
493
+
494
+ ## Changelog
495
+
496
+ ### Version 1.1 (Planned)
497
+
498
+ - [Future changes]
499
+
500
+ ---
501
+
502
+ **Last Updated**: 2026-01-01
503
+ **Maintained By**: {{MAINTAINER}}
@@ -0,0 +1,42 @@
1
+ # Technology Stack
2
+
3
+ **Project**: MUSUBIX
4
+ **Last Updated**: 2026-01-01
5
+ **Status**: Technology stack to be determined
6
+
7
+ ---
8
+
9
+ ## Overview
10
+
11
+ The technology stack for this project has not yet been decided. This document will be updated once the technical decisions are made.
12
+
13
+ ## Decision Criteria
14
+
15
+ When selecting technologies, consider:
16
+
17
+ 1. **Application Type**: What type of application is being built?
18
+ 2. **Performance Requirements**: What are the performance constraints?
19
+ 3. **Team Expertise**: What technologies is the team familiar with?
20
+ 4. **Ecosystem**: What libraries and tools are available?
21
+ 5. **Long-term Maintainability**: How well-supported is the technology?
22
+
23
+ ## Candidates Under Consideration
24
+
25
+ | Aspect | Options | Decision |
26
+ |--------|---------|----------|
27
+ | Primary Language | TBD | ⏳ Pending |
28
+ | Web Framework | TBD | ⏳ Pending |
29
+ | Database | TBD | ⏳ Pending |
30
+ | Hosting | TBD | ⏳ Pending |
31
+
32
+ ## Next Steps
33
+
34
+ 1. [ ] Define functional requirements
35
+ 2. [ ] Identify performance constraints
36
+ 3. [ ] Evaluate team skills
37
+ 4. [ ] Create proof-of-concept
38
+ 5. [ ] Make final decision and update this document
39
+
40
+ ---
41
+
42
+ *Run `musubi steering` to update this document after decisions are made.*