musubix 3.4.3 → 3.4.7
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/AGENTS.md +949 -0
- package/.github/prompts/sdd-change-apply.prompt.md +283 -0
- package/.github/prompts/sdd-change-archive.prompt.md +241 -0
- package/.github/prompts/sdd-change-init.prompt.md +269 -0
- package/.github/prompts/sdd-design.prompt.md +250 -0
- package/.github/prompts/sdd-implement.prompt.md +387 -0
- package/.github/prompts/sdd-requirements.prompt.md +193 -0
- package/.github/prompts/sdd-review.prompt.md +155 -0
- package/.github/prompts/sdd-security.prompt.md +228 -0
- package/.github/prompts/sdd-steering.prompt.md +269 -0
- package/.github/prompts/sdd-tasks.prompt.md +255 -0
- package/.github/prompts/sdd-test.prompt.md +230 -0
- package/.github/prompts/sdd-validate.prompt.md +304 -0
- package/.github/skills/musubix-adr-generation/SKILL.md +209 -0
- package/.github/skills/musubix-best-practices/SKILL.md +315 -0
- package/.github/skills/musubix-c4-design/SKILL.md +162 -0
- package/.github/skills/musubix-code-generation/SKILL.md +237 -0
- package/.github/skills/musubix-domain-inference/SKILL.md +196 -0
- package/.github/skills/musubix-ears-validation/SKILL.md +161 -0
- package/.github/skills/musubix-sdd-workflow/SKILL.md +217 -0
- package/.github/skills/musubix-technical-writing/SKILL.md +444 -0
- package/.github/skills/musubix-test-generation/SKILL.md +212 -0
- package/.github/skills/musubix-traceability/SKILL.md +141 -0
- package/AGENTS.md +1134 -0
- package/LICENSE +21 -0
- package/README.ja.md +313 -0
- package/README.md +315 -50
- package/bin/musubix-mcp.js +15 -0
- package/bin/musubix.js +9 -1
- package/docs/API-REFERENCE.md +1425 -0
- package/docs/GITHUB-ACTIONS-NPM-SETUP.md +132 -0
- package/docs/INSTALL-GUIDE.ja.md +459 -0
- package/docs/INSTALL-GUIDE.md +459 -0
- package/docs/MIGRATION-v3.0.md +324 -0
- package/docs/MUSUBI-enhancement_roadmap_20260105.md +651 -0
- package/docs/MUSUBIX-v3.0-User-Guide.md +1357 -0
- package/docs/MUSUBIXv2.2.0-Manual-outline.md +136 -0
- package/docs/MUSUBIXv2.2.0-Manual.md +3123 -0
- package/docs/MUSUBIXv2.3.5-Refactering.md +1310 -0
- package/docs/MUSUBIv1.6.1-enhancement_roadmap_20260105.md +291 -0
- package/docs/MUSUBIv2.2.0-USERGUIDE.md +2079 -0
- package/docs/ROADMAP-v1.5.md +116 -0
- package/docs/SwarmCoding.md +1284 -0
- package/docs/Test-prompt.md +105 -0
- package/docs/USER-GUIDE-v1.8.0.md +2371 -0
- package/docs/USER-GUIDE.ja.md +2147 -0
- package/docs/USER-GUIDE.md +3022 -0
- package/docs/YATA-GLOBAL-GUIDE.ja.md +750 -0
- package/docs/YATA-GLOBAL-GUIDE.md +595 -0
- package/docs/YATA-LOCAL-GUIDE.ja.md +989 -0
- package/docs/YATA-LOCAL-GUIDE.md +730 -0
- package/docs/adr/0001-real-time-pattern-learning-architecture-for-v1-5-0.md +75 -0
- package/docs/adr/0002-pattern-sharing-protocol-for-cross-team-collaborat.md +79 -0
- package/docs/adr/0003-owl-2-rl-implementation-strategy-for-advanced-infe.md +90 -0
- package/docs/adr/ADR-v3.4.0-001-deep-research-architecture.md +217 -0
- package/docs/adr/ADR-v3.4.0-002-search-provider-selection.md +308 -0
- package/docs/adr/ADR-v3.4.0-003-lm-api-integration.md +475 -0
- package/docs/enterprise-knowledge-management.md +1737 -0
- package/docs/evolution-from-musubi-to-musubix.md +2170 -0
- package/docs/getting-started-with-sdd.md +1602 -0
- package/docs/moodle-refactering-codegraph-musubix.md +391 -0
- package/docs/moodle-refactering-codegraph.md +278 -0
- package/docs/overview/MUSUBIX-CodeGraph.md +322 -0
- package/docs/overview/MUSUBIX-Core.md +671 -0
- package/docs/overview/MUSUBIX-Decisions.md +494 -0
- package/docs/overview/MUSUBIX-FormalVerify.md +566 -0
- package/docs/overview/MUSUBIX-Knowledge.md +1231 -0
- package/docs/overview/MUSUBIX-Learning.md +837 -0
- package/docs/overview/MUSUBIX-MCP-Server.md +535 -0
- package/docs/overview/MUSUBIX-Overview.md +264 -0
- package/docs/overview/MUSUBIX-Phase1-Complete.md +271 -0
- package/docs/overview/MUSUBIX-Phase2-Complete.md +310 -0
- package/docs/overview/MUSUBIX-Policy.md +477 -0
- package/docs/overview/MUSUBIX-Roadmap-v2.md +399 -0
- package/docs/overview/MUSUBIX-Security-Plan.md +939 -0
- package/docs/overview/MUSUBIX-Security-v2.1.md +668 -0
- package/docs/overview/MUSUBIX-Security.md +891 -0
- package/docs/overview/MUSUBIX-YATA.md +666 -0
- package/docs/overview/MUSUBIX-v2.2.0-Advanced-Learning.md +513 -0
- package/docs/overview/Neuro-SymbolicAI.md +159 -0
- package/docs/packages/knowledge.md +594 -0
- package/docs/qiita-linux-kernel-knowledge-graph.md +596 -0
- package/package.json +58 -51
- package/scripts/generate-quality-gate-report.ts +106 -0
- package/scripts/postinstall.js +94 -0
- package/steering/.musubi-version +1 -0
- package/steering/product.ja.md +572 -0
- package/steering/project.yml +66 -0
- package/steering/rules/constitution.md +491 -0
- package/steering/structure.ja.md +503 -0
- package/steering/tech.ja.md +208 -0
- package/dist/index.d.ts +0 -25
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -74
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
# Project Structure
|
|
2
|
+
|
|
3
|
+
**Project**: MUSUBIX
|
|
4
|
+
**Last Updated**: 2026-01-04
|
|
5
|
+
**Version**: 1.1.15
|
|
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,208 @@
|
|
|
1
|
+
# Technology Stack
|
|
2
|
+
|
|
3
|
+
**Project**: MUSUBIX
|
|
4
|
+
**Last Updated**: 2026-01-04
|
|
5
|
+
**Version**: 1.1.15
|
|
6
|
+
**Status**: Production Ready
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
MUSUBIXはニューロシンボリックAIコーディングシステムであり、LLM(Large Language Model)とシンボリック推論(知識グラフ)を統合しています。
|
|
13
|
+
|
|
14
|
+
## Core Technologies
|
|
15
|
+
|
|
16
|
+
| カテゴリ | 技術 | バージョン | 状態 |
|
|
17
|
+
|---------|------|-----------|------|
|
|
18
|
+
| 言語 | TypeScript | 5.3+ | ✅ 採用 |
|
|
19
|
+
| ランタイム | Node.js | 20.0.0+ | ✅ 採用 |
|
|
20
|
+
| パッケージマネージャ | npm | 10.0.0+ | ✅ 採用 |
|
|
21
|
+
| ビルドシステム | tsc | 5.3+ | ✅ 採用 |
|
|
22
|
+
| テストフレームワーク | Vitest | 4.0+ | ✅ 採用 |
|
|
23
|
+
| リンター | ESLint | 9.0+ | ✅ 採用 |
|
|
24
|
+
|
|
25
|
+
## Architecture
|
|
26
|
+
|
|
27
|
+
### パッケージ構成(モノレポ)
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
packages/
|
|
31
|
+
├── core/ # @nahisaho/musubix-core (v1.1.15)
|
|
32
|
+
├── mcp-server/ # @nahisaho/musubix-mcp-server (v1.1.15)
|
|
33
|
+
├── yata-client/ # @nahisaho/musubix-yata-client (v1.1.15)
|
|
34
|
+
└── musubi/ # @nahisaho/musubi (v1.1.15) - Alias wrapper
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Core Package モジュール
|
|
38
|
+
|
|
39
|
+
| モジュール | 役割 | 主要機能 |
|
|
40
|
+
|-----------|------|---------|
|
|
41
|
+
| `auth/` | 認証・認可 | JWT/OAuth管理 |
|
|
42
|
+
| `cli/` | CLIインターフェース | コマンドライン処理 |
|
|
43
|
+
| `codegen/` | コード生成・解析 | テンプレート生成、静的解析、セキュリティスキャン |
|
|
44
|
+
| `design/` | 設計 | パターン検出、C4モデル、ADR生成 |
|
|
45
|
+
| `error/` | エラーハンドリング | 構造化エラー、リカバリー |
|
|
46
|
+
| `explanation/` | 説明生成 | 推論グラフ、可視化 |
|
|
47
|
+
| `learning/` | 自己学習 | フィードバック収集、パターン抽出 |
|
|
48
|
+
| `requirements/` | 要件分析 | EARS検証、オントロジーマッピング |
|
|
49
|
+
| `traceability/` | トレーサビリティ | アーティファクト追跡、カバレッジ分析 |
|
|
50
|
+
| `validators/` | 検証 | EARS検証器 |
|
|
51
|
+
|
|
52
|
+
## Domain Support
|
|
53
|
+
|
|
54
|
+
| カテゴリ | ドメイン数 | コンポーネント数 |
|
|
55
|
+
|---------|-----------|-----------------|
|
|
56
|
+
| 合計 | 62 | ~430 |
|
|
57
|
+
|
|
58
|
+
### 対応ドメイン一覧
|
|
59
|
+
|
|
60
|
+
- **汎用**: general
|
|
61
|
+
- **業種特化**: healthcare, banking, insurance, realestate, hotel, restaurant, retail, ecommerce, logistics, manufacturing, construction, agriculture, agritech
|
|
62
|
+
- **専門サービス**: legal, accounting, hr, recruitment, marketing, crm
|
|
63
|
+
- **教育・学習**: education, elearning, library
|
|
64
|
+
- **エンターテイメント**: game, music, media, cinema, museum, streaming, podcast, news
|
|
65
|
+
- **交通・物流**: travel, aviation, railway, shipping, vehicle, parking
|
|
66
|
+
- **通信・IT**: telecom, iot, security
|
|
67
|
+
- **医療・福祉**: pharmacy, veterinary, caregiving, childcare
|
|
68
|
+
- **イベント・冠婚葬祭**: event, ticketing, wedding, funeral
|
|
69
|
+
- **その他**: fitness, sports, beauty, petcare, rental, laundry, subscription, crowdfunding, auction, charity, government, election, survey, energy, environment, archive, social, property, warehouse
|
|
70
|
+
|
|
71
|
+
## Key Features
|
|
72
|
+
|
|
73
|
+
### 1. EARS検証器(Symbolic Reasoning)
|
|
74
|
+
|
|
75
|
+
5つのEARSパターンをサポート(**Markdownブロッククォート形式対応** v1.1.9+):
|
|
76
|
+
|
|
77
|
+
| パターン | 構文 | 信頼度ボーナス |
|
|
78
|
+
|---------|------|---------------|
|
|
79
|
+
| Event-driven | `WHEN <trigger>, THE <system> SHALL <action>` | +0.25 |
|
|
80
|
+
| State-driven | `WHILE <state>, THE <system> SHALL <action>` | +0.25 |
|
|
81
|
+
| Unwanted | `THE <system> SHALL NOT <behavior>` | +0.20 |
|
|
82
|
+
| Optional | `WHERE <feature>, THE <system> SHALL <action>` | +0.20 |
|
|
83
|
+
| Ubiquitous | `THE <system> SHALL <action>` | +0.00 |
|
|
84
|
+
|
|
85
|
+
**最適化機能**:
|
|
86
|
+
- 早期終了(高信頼度≥0.85で即座にマッチ)
|
|
87
|
+
- 事前チェック("shall"キーワードの存在確認)
|
|
88
|
+
|
|
89
|
+
### 2. トレーサビリティ管理
|
|
90
|
+
|
|
91
|
+
**カバレッジ計算(重み付け平均)**:
|
|
92
|
+
- 要件: 30%
|
|
93
|
+
- 設計: 20%
|
|
94
|
+
- コード: 30%
|
|
95
|
+
- テスト: 20%
|
|
96
|
+
|
|
97
|
+
**最適化機能**:
|
|
98
|
+
- リンクインデックス(O(1)検索)
|
|
99
|
+
- アーティファクト型インデックス
|
|
100
|
+
|
|
101
|
+
### 3. アーティファクトステータス
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
type ArtifactStatus =
|
|
105
|
+
| 'draft' // 初期作成状態
|
|
106
|
+
| 'active' // アクティブ開発中
|
|
107
|
+
| 'approved' // レビュー承認済み
|
|
108
|
+
| 'implemented' // コード実装完了
|
|
109
|
+
| 'verified' // テスト・検証完了
|
|
110
|
+
| 'deprecated' // 非推奨
|
|
111
|
+
| 'deleted'; // 削除予定
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 4. ニューロシンボリック統合ルール(REQ-INT-002)
|
|
115
|
+
|
|
116
|
+
| シンボリック結果 | ニューラル信頼度 | 最終決定 |
|
|
117
|
+
|-----------------|-----------------|---------|
|
|
118
|
+
| invalid | - | ニューラル結果を棄却 |
|
|
119
|
+
| valid | ≥0.8 | ニューラル結果を採用 |
|
|
120
|
+
| valid | <0.8 | シンボリック結果を優先 |
|
|
121
|
+
|
|
122
|
+
## Development Commands
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# 依存関係インストール
|
|
126
|
+
npm install
|
|
127
|
+
|
|
128
|
+
# 全パッケージビルド
|
|
129
|
+
npm run build
|
|
130
|
+
|
|
131
|
+
# テスト実行
|
|
132
|
+
npm run test
|
|
133
|
+
|
|
134
|
+
# コード品質
|
|
135
|
+
npm run lint
|
|
136
|
+
npm run typecheck
|
|
137
|
+
|
|
138
|
+
# クリーンアップ
|
|
139
|
+
npm run clean
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Performance Benchmarks
|
|
143
|
+
|
|
144
|
+
| 機能 | 処理速度 | 備考 |
|
|
145
|
+
|------|---------|------|
|
|
146
|
+
| EARS検証(単一要件) | <1ms | 早期終了最適化 |
|
|
147
|
+
| パターンマッチング | <5ms | 信頼度計算含む |
|
|
148
|
+
| トレーサビリティリンク検索 | O(1) | インデックス利用 |
|
|
149
|
+
| C4モデル生成 | <10ms | 11要素、6関係 |
|
|
150
|
+
| 全テスト(459件) | ~1.0s | Vitest実行 |
|
|
151
|
+
|
|
152
|
+
## Self-Learning System (v1.1.10)
|
|
153
|
+
|
|
154
|
+
### ベストプラクティスCLI
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# 一覧表示
|
|
158
|
+
npx musubix learn bp-list
|
|
159
|
+
|
|
160
|
+
# 詳細表示(コード例付き)
|
|
161
|
+
npx musubix learn bp-show BP-CODE-001
|
|
162
|
+
|
|
163
|
+
# カテゴリ別フィルタ
|
|
164
|
+
npx musubix learn best-practices --category code
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### 学習済みパターン(17件)
|
|
168
|
+
|
|
169
|
+
| ID | 名称 | 信頼度 | ソース |
|
|
170
|
+
|----|------|--------|--------|
|
|
171
|
+
| BP-CODE-001 | Entity Input DTO | 95% | P07-08 |
|
|
172
|
+
| BP-CODE-002 | Date-based ID Format | 90% | P07-08 |
|
|
173
|
+
| BP-CODE-003 | Value Objects | 90% | P08 |
|
|
174
|
+
| BP-CODE-004 | Function-based Value Objects | 95% | P13-14 |
|
|
175
|
+
| BP-CODE-005 | Result Type | 95% | P13-14 |
|
|
176
|
+
| BP-DESIGN-001 | Status Transition Map | 95% | P08, P13-14 |
|
|
177
|
+
| BP-DESIGN-002 | Repository Async Pattern | 85% | P08 |
|
|
178
|
+
| BP-DESIGN-003 | Service Layer with DI | 90% | P07-08 |
|
|
179
|
+
| BP-DESIGN-004 | Optimistic Locking | 90% | P10 |
|
|
180
|
+
| BP-DESIGN-005 | AuditService | 85% | P09-10 |
|
|
181
|
+
| BP-DESIGN-006 | Entity Counter Reset | 95% | P13-14 |
|
|
182
|
+
| BP-DESIGN-007 | Expiry Time Logic | 90% | P14 |
|
|
183
|
+
| BP-TEST-001 | Test Counter Reset | 95% | P07 |
|
|
184
|
+
| BP-TEST-002 | Verify API Before Test | 80% | P08 |
|
|
185
|
+
| BP-TEST-003 | Vitest ESM Configuration | 85% | P07 |
|
|
186
|
+
| BP-TEST-004 | Result Type Test Pattern | 95% | P13-14 |
|
|
187
|
+
| BP-TEST-005 | Status Transition Testing | 90% | P14 |
|
|
188
|
+
|
|
189
|
+
### コード生成テンプレート(12タイプ)
|
|
190
|
+
|
|
191
|
+
| タイプ | 説明 | 追加バージョン |
|
|
192
|
+
|--------|------|----------------|
|
|
193
|
+
| class | クラス定義 | v1.0.0 |
|
|
194
|
+
| interface | インターフェース | v1.0.0 |
|
|
195
|
+
| function | 関数 | v1.0.0 |
|
|
196
|
+
| module | モジュール | v1.0.0 |
|
|
197
|
+
| test | テストファイル | v1.0.0 |
|
|
198
|
+
| api-endpoint | APIエンドポイント | v1.0.0 |
|
|
199
|
+
| model | データモデル | v1.0.0 |
|
|
200
|
+
| repository | リポジトリ | v1.0.0 |
|
|
201
|
+
| service | サービス層 | v1.0.0 |
|
|
202
|
+
| controller | コントローラ | v1.0.0 |
|
|
203
|
+
| value-object | Value Object (function-based) | v1.1.10 |
|
|
204
|
+
| entity | エンティティ (status transition, counter reset) | v1.1.10 |
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
*Last Updated: 2026-01-04 by MUSUBIX v1.1.15*
|