@pixel613/spec 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 +21 -0
- package/README.md +174 -0
- package/dist/bin/pxs.d.ts +2 -0
- package/dist/bin/pxs.js +5 -0
- package/dist/bin/pxs.js.map +1 -0
- package/dist/src/backends/claude.d.ts +9 -0
- package/dist/src/backends/claude.js +80 -0
- package/dist/src/backends/claude.js.map +1 -0
- package/dist/src/backends/codex.d.ts +9 -0
- package/dist/src/backends/codex.js +72 -0
- package/dist/src/backends/codex.js.map +1 -0
- package/dist/src/backends/factory.d.ts +2 -0
- package/dist/src/backends/factory.js +14 -0
- package/dist/src/backends/factory.js.map +1 -0
- package/dist/src/backends/interface.d.ts +15 -0
- package/dist/src/backends/interface.js +2 -0
- package/dist/src/backends/interface.js.map +1 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +79 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/commands/clarify.d.ts +5 -0
- package/dist/src/commands/clarify.js +46 -0
- package/dist/src/commands/clarify.js.map +1 -0
- package/dist/src/commands/implement.d.ts +9 -0
- package/dist/src/commands/implement.js +244 -0
- package/dist/src/commands/implement.js.map +1 -0
- package/dist/src/commands/init.d.ts +6 -0
- package/dist/src/commands/init.js +177 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/new.d.ts +5 -0
- package/dist/src/commands/new.js +143 -0
- package/dist/src/commands/new.js.map +1 -0
- package/dist/src/commands/refine.d.ts +8 -0
- package/dist/src/commands/refine.js +158 -0
- package/dist/src/commands/refine.js.map +1 -0
- package/dist/src/commands/review.d.ts +4 -0
- package/dist/src/commands/review.js +70 -0
- package/dist/src/commands/review.js.map +1 -0
- package/dist/src/commands/status.d.ts +1 -0
- package/dist/src/commands/status.js +53 -0
- package/dist/src/commands/status.js.map +1 -0
- package/dist/src/discovery/project.d.ts +7 -0
- package/dist/src/discovery/project.js +90 -0
- package/dist/src/discovery/project.js.map +1 -0
- package/dist/src/git/operations.d.ts +10 -0
- package/dist/src/git/operations.js +56 -0
- package/dist/src/git/operations.js.map +1 -0
- package/dist/src/parsers/arguments.d.ts +18 -0
- package/dist/src/parsers/arguments.js +43 -0
- package/dist/src/parsers/arguments.js.map +1 -0
- package/dist/src/parsers/plan.d.ts +23 -0
- package/dist/src/parsers/plan.js +117 -0
- package/dist/src/parsers/plan.js.map +1 -0
- package/dist/src/parsers/spec.d.ts +10 -0
- package/dist/src/parsers/spec.js +46 -0
- package/dist/src/parsers/spec.js.map +1 -0
- package/dist/src/state/manager.d.ts +24 -0
- package/dist/src/state/manager.js +103 -0
- package/dist/src/state/manager.js.map +1 -0
- package/dist/src/state/types.d.ts +47 -0
- package/dist/src/state/types.js +21 -0
- package/dist/src/state/types.js.map +1 -0
- package/dist/src/utils/display.d.ts +7 -0
- package/dist/src/utils/display.js +42 -0
- package/dist/src/utils/display.js.map +1 -0
- package/dist/src/utils/prompt.d.ts +31 -0
- package/dist/src/utils/prompt.js +81 -0
- package/dist/src/utils/prompt.js.map +1 -0
- package/package.json +52 -0
- package/templates/agents-md-snippet.md +20 -0
- package/templates/architectures/clean/csharp-aspnet.md +56 -0
- package/templates/architectures/clean/go-gin.md +50 -0
- package/templates/architectures/clean/go-std.md +49 -0
- package/templates/architectures/clean/python-fastapi.md +49 -0
- package/templates/architectures/clean/typescript-express.md +60 -0
- package/templates/architectures/clean/typescript-nestjs.md +61 -0
- package/templates/architectures/ddd/csharp-aspnet.md +55 -0
- package/templates/architectures/ddd/go-gin.md +53 -0
- package/templates/architectures/ddd/python-fastapi.md +52 -0
- package/templates/architectures/ddd/typescript-nestjs.md +62 -0
- package/templates/architectures/hexagonal/csharp-aspnet.md +45 -0
- package/templates/architectures/hexagonal/go-gin.md +47 -0
- package/templates/architectures/hexagonal/python-fastapi.md +43 -0
- package/templates/architectures/hexagonal/typescript-nestjs.md +44 -0
- package/templates/architectures/layered/csharp-aspnet.md +45 -0
- package/templates/architectures/layered/go-gin.md +41 -0
- package/templates/architectures/layered/python-fastapi.md +42 -0
- package/templates/architectures/layered/typescript-nestjs.md +48 -0
- package/templates/architectures/modular/csharp-aspnet.md +45 -0
- package/templates/architectures/modular/go-gin.md +47 -0
- package/templates/architectures/modular/python-fastapi.md +45 -0
- package/templates/architectures/modular/typescript-nestjs.md +48 -0
- package/templates/claude-commands/sf.clarify.md +18 -0
- package/templates/claude-commands/sf.implement.md +79 -0
- package/templates/claude-commands/sf.new.md +22 -0
- package/templates/claude-commands/sf.refine.md +47 -0
- package/templates/claude-commands/sf.review.md +17 -0
- package/templates/claude-commands/sf.status.md +12 -0
- package/templates/workflow/config.yaml +17 -0
- package/templates/workflow/prompts/clarify.md +39 -0
- package/templates/workflow/prompts/final-review.md +30 -0
- package/templates/workflow/prompts/implement-tdd.md +35 -0
- package/templates/workflow/prompts/implement.md +43 -0
- package/templates/workflow/prompts/refine.md +52 -0
- package/templates/workflow/prompts/review.md +34 -0
- package/templates/workflow/prompts/test.md +14 -0
- package/templates/workflow/templates/spec-template.md +13 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Architecture: Hexagonal / Ports & Adapters (Python + FastAPI)
|
|
2
|
+
|
|
3
|
+
## Directory Structure
|
|
4
|
+
```
|
|
5
|
+
src/
|
|
6
|
+
├── core/
|
|
7
|
+
│ ├── domain/
|
|
8
|
+
│ │ ├── entities/order.py
|
|
9
|
+
│ │ └── errors.py
|
|
10
|
+
│ └── ports/
|
|
11
|
+
│ ├── inbound/create_order_port.py # ABC interfaces
|
|
12
|
+
│ └── outbound/order_repository.py # ABC interfaces
|
|
13
|
+
├── application/
|
|
14
|
+
│ └── services/order_service.py # Implements inbound ports
|
|
15
|
+
├── adapters/
|
|
16
|
+
│ ├── inbound/
|
|
17
|
+
│ │ └── http/
|
|
18
|
+
│ │ ├── order_router.py
|
|
19
|
+
│ │ └── dependencies.py
|
|
20
|
+
│ └── outbound/
|
|
21
|
+
│ ├── persistence/order_repository.py
|
|
22
|
+
│ └── messaging/event_publisher.py
|
|
23
|
+
└── main.py
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Dependency Rule
|
|
27
|
+
- core → depends on nothing, pure Python ABCs and dataclasses
|
|
28
|
+
- application → implements inbound ports, depends only on core
|
|
29
|
+
- adapters → implement outbound ports or call inbound ports
|
|
30
|
+
|
|
31
|
+
## Conventions
|
|
32
|
+
- Ports defined as Abstract Base Classes in core/ports/
|
|
33
|
+
- FastAPI dependency injection wires adapters to ports
|
|
34
|
+
- Pydantic for DTOs at adapter boundary
|
|
35
|
+
|
|
36
|
+
## File Naming
|
|
37
|
+
- snake_case: order_service.py
|
|
38
|
+
- Test files: test_order_service.py
|
|
39
|
+
|
|
40
|
+
## Testing
|
|
41
|
+
- core: pure unit tests (pytest)
|
|
42
|
+
- application: mock outbound ports
|
|
43
|
+
- adapters: integration tests per adapter
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Architecture: Hexagonal / Ports & Adapters (NestJS)
|
|
2
|
+
|
|
3
|
+
## Directory Structure
|
|
4
|
+
```
|
|
5
|
+
src/
|
|
6
|
+
├── core/
|
|
7
|
+
│ ├── domain/
|
|
8
|
+
│ │ ├── entities/order.entity.ts
|
|
9
|
+
│ │ └── value-objects/money.vo.ts
|
|
10
|
+
│ └── ports/
|
|
11
|
+
│ ├── inbound/create-order.port.ts # Driving ports (use case interfaces)
|
|
12
|
+
│ └── outbound/order.repository.port.ts # Driven ports
|
|
13
|
+
├── application/
|
|
14
|
+
│ └── services/order.service.ts # Implements inbound ports
|
|
15
|
+
├── adapters/
|
|
16
|
+
│ ├── inbound/
|
|
17
|
+
│ │ ├── http/order.controller.ts # REST adapter
|
|
18
|
+
│ │ └── grpc/order.grpc.ts # gRPC adapter
|
|
19
|
+
│ └── outbound/
|
|
20
|
+
│ ├── persistence/order.repository.ts # DB adapter
|
|
21
|
+
│ └── messaging/event.publisher.ts # Message queue adapter
|
|
22
|
+
└── app.module.ts
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Dependency Rule
|
|
26
|
+
- core (domain + ports) → depends on nothing, defines all interfaces
|
|
27
|
+
- application → implements inbound ports, depends on core only
|
|
28
|
+
- adapters → implement outbound ports or call inbound ports
|
|
29
|
+
|
|
30
|
+
## Conventions
|
|
31
|
+
- Inbound ports = use case interfaces (what the app can do)
|
|
32
|
+
- Outbound ports = infrastructure interfaces (what the app needs)
|
|
33
|
+
- Adapters are interchangeable (swap DB, swap transport)
|
|
34
|
+
- NestJS modules wire adapters to ports via DI
|
|
35
|
+
|
|
36
|
+
## File Naming
|
|
37
|
+
- kebab-case: create-order.port.ts
|
|
38
|
+
- Port: *.port.ts
|
|
39
|
+
- Adapter suffix indicates type: *.controller.ts, *.repository.ts
|
|
40
|
+
|
|
41
|
+
## Testing
|
|
42
|
+
- core: pure unit tests
|
|
43
|
+
- application: mock outbound ports
|
|
44
|
+
- adapters: integration tests per adapter
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Architecture: Layered / Three-Tier (C# + ASP.NET Core)
|
|
2
|
+
|
|
3
|
+
## Project Structure
|
|
4
|
+
```
|
|
5
|
+
src/
|
|
6
|
+
├── Controllers/
|
|
7
|
+
│ ├── OrderController.cs
|
|
8
|
+
│ └── AuthController.cs
|
|
9
|
+
├── Services/
|
|
10
|
+
│ ├── IOrderService.cs
|
|
11
|
+
│ ├── OrderService.cs
|
|
12
|
+
│ └── IAuthService.cs
|
|
13
|
+
├── Repositories/
|
|
14
|
+
│ ├── IOrderRepository.cs
|
|
15
|
+
│ ├── OrderRepository.cs
|
|
16
|
+
│ └── ApplicationDbContext.cs
|
|
17
|
+
├── Models/
|
|
18
|
+
│ ├── Order.cs
|
|
19
|
+
│ └── User.cs
|
|
20
|
+
├── DTOs/
|
|
21
|
+
│ ├── CreateOrderDto.cs
|
|
22
|
+
│ └── LoginDto.cs
|
|
23
|
+
├── Middleware/
|
|
24
|
+
│ └── ExceptionHandlerMiddleware.cs
|
|
25
|
+
└── Program.cs
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Layer Dependencies
|
|
29
|
+
- Controllers → Services → Repositories → Database
|
|
30
|
+
- Each layer only depends on the layer directly below
|
|
31
|
+
|
|
32
|
+
## Conventions
|
|
33
|
+
- Interface-based DI for Services and Repositories
|
|
34
|
+
- EF Core for data access
|
|
35
|
+
- DTOs at controller boundary
|
|
36
|
+
- Middleware for cross-cutting concerns
|
|
37
|
+
|
|
38
|
+
## File Naming
|
|
39
|
+
- PascalCase: OrderService.cs
|
|
40
|
+
- Interface prefix: IOrderService.cs
|
|
41
|
+
|
|
42
|
+
## Testing
|
|
43
|
+
- Services: unit tests (xUnit + NSubstitute)
|
|
44
|
+
- Controllers: unit tests with mocked services
|
|
45
|
+
- Repositories: integration tests (WebApplicationFactory)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Architecture: Layered / Three-Tier (Go + Gin)
|
|
2
|
+
|
|
3
|
+
## Directory Structure
|
|
4
|
+
```
|
|
5
|
+
internal/
|
|
6
|
+
├── handler/
|
|
7
|
+
│ ├── order_handler.go
|
|
8
|
+
│ ├── auth_handler.go
|
|
9
|
+
│ ├── middleware/
|
|
10
|
+
│ └── router.go
|
|
11
|
+
├── service/
|
|
12
|
+
│ ├── order_service.go
|
|
13
|
+
│ └── auth_service.go
|
|
14
|
+
├── repository/
|
|
15
|
+
│ ├── order_repo.go
|
|
16
|
+
│ └── user_repo.go
|
|
17
|
+
├── model/
|
|
18
|
+
│ ├── order.go
|
|
19
|
+
│ └── user.go
|
|
20
|
+
└── config/
|
|
21
|
+
└── env.go
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Layer Dependencies
|
|
25
|
+
- Handler → Service → Repository → Database
|
|
26
|
+
- Each layer only depends on the layer directly below
|
|
27
|
+
|
|
28
|
+
## Conventions
|
|
29
|
+
- Handlers handle HTTP concerns (Gin context)
|
|
30
|
+
- Services contain business logic, accept/return domain models
|
|
31
|
+
- Repositories handle data access
|
|
32
|
+
- Interfaces defined at consumer side for testability
|
|
33
|
+
|
|
34
|
+
## File Naming
|
|
35
|
+
- snake_case: order_service.go
|
|
36
|
+
- Test files: order_service_test.go
|
|
37
|
+
|
|
38
|
+
## Testing
|
|
39
|
+
- services: unit tests with mocked repositories
|
|
40
|
+
- handlers: HTTP tests (httptest)
|
|
41
|
+
- repositories: integration tests
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Architecture: Layered / Three-Tier (Python + FastAPI)
|
|
2
|
+
|
|
3
|
+
## Directory Structure
|
|
4
|
+
```
|
|
5
|
+
src/
|
|
6
|
+
├── routers/
|
|
7
|
+
│ ├── order_router.py
|
|
8
|
+
│ └── auth_router.py
|
|
9
|
+
├── services/
|
|
10
|
+
│ ├── order_service.py
|
|
11
|
+
│ └── auth_service.py
|
|
12
|
+
├── repositories/
|
|
13
|
+
│ ├── order_repository.py
|
|
14
|
+
│ └── user_repository.py
|
|
15
|
+
├── models/
|
|
16
|
+
│ ├── order.py
|
|
17
|
+
│ └── user.py
|
|
18
|
+
├── schemas/
|
|
19
|
+
│ ├── order_schema.py # Pydantic models
|
|
20
|
+
│ └── auth_schema.py
|
|
21
|
+
├── config.py
|
|
22
|
+
└── main.py
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Layer Dependencies
|
|
26
|
+
- Routers → Services → Repositories → Database
|
|
27
|
+
- Each layer only depends on the layer directly below
|
|
28
|
+
|
|
29
|
+
## Conventions
|
|
30
|
+
- FastAPI dependency injection for wiring
|
|
31
|
+
- Pydantic schemas at router boundary
|
|
32
|
+
- Services contain business logic
|
|
33
|
+
- Repositories handle SQLAlchemy queries
|
|
34
|
+
|
|
35
|
+
## File Naming
|
|
36
|
+
- snake_case: order_service.py
|
|
37
|
+
- Test files: test_order_service.py
|
|
38
|
+
|
|
39
|
+
## Testing
|
|
40
|
+
- services: unit tests (pytest + mock)
|
|
41
|
+
- routers: HTTP tests (TestClient)
|
|
42
|
+
- repositories: integration tests
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Architecture: Layered / Three-Tier (NestJS)
|
|
2
|
+
|
|
3
|
+
## Directory Structure
|
|
4
|
+
```
|
|
5
|
+
src/
|
|
6
|
+
├── controllers/
|
|
7
|
+
│ ├── order.controller.ts
|
|
8
|
+
│ └── auth.controller.ts
|
|
9
|
+
├── services/
|
|
10
|
+
│ ├── order.service.ts
|
|
11
|
+
│ └── auth.service.ts
|
|
12
|
+
├── repositories/
|
|
13
|
+
│ ├── order.repository.ts
|
|
14
|
+
│ └── user.repository.ts
|
|
15
|
+
├── entities/
|
|
16
|
+
│ ├── order.entity.ts
|
|
17
|
+
│ └── user.entity.ts
|
|
18
|
+
├── dtos/
|
|
19
|
+
│ ├── create-order.dto.ts
|
|
20
|
+
│ └── login.dto.ts
|
|
21
|
+
├── guards/
|
|
22
|
+
├── interceptors/
|
|
23
|
+
├── pipes/
|
|
24
|
+
└── app.module.ts
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Layer Dependencies
|
|
28
|
+
- Controllers → Services → Repositories → Database
|
|
29
|
+
- Each layer only depends on the layer directly below
|
|
30
|
+
|
|
31
|
+
## Conventions
|
|
32
|
+
- Controllers handle HTTP, validate input via DTOs + Pipes
|
|
33
|
+
- Services contain business logic
|
|
34
|
+
- Repositories handle data access (TypeORM/Prisma/MikroORM)
|
|
35
|
+
- NestJS DI wires everything together
|
|
36
|
+
|
|
37
|
+
## File Naming
|
|
38
|
+
- kebab-case: order.service.ts, create-order.dto.ts
|
|
39
|
+
- Controller: *.controller.ts
|
|
40
|
+
- Service: *.service.ts
|
|
41
|
+
- Repository: *.repository.ts
|
|
42
|
+
- Entity: *.entity.ts
|
|
43
|
+
|
|
44
|
+
## Testing
|
|
45
|
+
- services: unit tests with mocked repositories
|
|
46
|
+
- controllers: unit tests with mocked services
|
|
47
|
+
- repositories: integration tests
|
|
48
|
+
- E2E: supertest
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Architecture: Modular Monolith (C# + ASP.NET Core)
|
|
2
|
+
|
|
3
|
+
## Project Structure
|
|
4
|
+
```
|
|
5
|
+
src/
|
|
6
|
+
├── Modules/
|
|
7
|
+
│ ├── Order/
|
|
8
|
+
│ │ ├── OrderModule.cs
|
|
9
|
+
│ │ ├── Controllers/OrderController.cs
|
|
10
|
+
│ │ ├── Services/OrderService.cs
|
|
11
|
+
│ │ ├── Repositories/OrderRepository.cs
|
|
12
|
+
│ │ ├── Models/Order.cs
|
|
13
|
+
│ │ ├── DTOs/CreateOrderDto.cs
|
|
14
|
+
│ │ └── Events/OrderCreatedEvent.cs
|
|
15
|
+
│ ├── Payment/
|
|
16
|
+
│ │ └── ...
|
|
17
|
+
│ └── User/
|
|
18
|
+
│ └── ...
|
|
19
|
+
├── Shared/
|
|
20
|
+
│ ├── Database/ApplicationDbContext.cs
|
|
21
|
+
│ ├── Events/IEventBus.cs
|
|
22
|
+
│ └── Middleware/
|
|
23
|
+
└── Program.cs
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Module Boundaries
|
|
27
|
+
- Each module is self-contained with controllers, services, repositories
|
|
28
|
+
- Modules communicate via events or explicit interfaces
|
|
29
|
+
- No direct database access across module boundaries
|
|
30
|
+
- Shared for cross-cutting concerns only
|
|
31
|
+
|
|
32
|
+
## Conventions
|
|
33
|
+
- Each module has a registration extension method (AddOrderModule)
|
|
34
|
+
- Inter-module communication via MediatR notifications
|
|
35
|
+
- Each module owns its EF Core configurations
|
|
36
|
+
- Modules register their own DI services
|
|
37
|
+
|
|
38
|
+
## File Naming
|
|
39
|
+
- PascalCase: OrderService.cs
|
|
40
|
+
- One module = one folder under Modules/
|
|
41
|
+
|
|
42
|
+
## Testing
|
|
43
|
+
- Per-module unit tests (xUnit)
|
|
44
|
+
- Integration tests per module
|
|
45
|
+
- Cross-module E2E tests
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Architecture: Modular Monolith (Go + Gin)
|
|
2
|
+
|
|
3
|
+
## Directory Structure
|
|
4
|
+
```
|
|
5
|
+
internal/
|
|
6
|
+
├── modules/
|
|
7
|
+
│ ├── order/
|
|
8
|
+
│ │ ├── handler.go
|
|
9
|
+
│ │ ├── service.go
|
|
10
|
+
│ │ ├── repository.go
|
|
11
|
+
│ │ ├── model.go
|
|
12
|
+
│ │ ├── events.go
|
|
13
|
+
│ │ └── routes.go
|
|
14
|
+
│ ├── payment/
|
|
15
|
+
│ │ └── ...
|
|
16
|
+
│ └── user/
|
|
17
|
+
│ └── ...
|
|
18
|
+
├── shared/
|
|
19
|
+
│ ├── database/
|
|
20
|
+
│ ├── events/event_bus.go
|
|
21
|
+
│ └── middleware/
|
|
22
|
+
├── config/
|
|
23
|
+
│ └── env.go
|
|
24
|
+
└── cmd/
|
|
25
|
+
└── main.go
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Module Boundaries
|
|
29
|
+
- Each module is a Go package with its own handler, service, repository
|
|
30
|
+
- Modules communicate via events or explicit function calls
|
|
31
|
+
- No direct database access across module boundaries
|
|
32
|
+
- Shared package for cross-cutting concerns
|
|
33
|
+
|
|
34
|
+
## Conventions
|
|
35
|
+
- Each module registers its own routes via a Setup function
|
|
36
|
+
- Inter-module communication via event bus
|
|
37
|
+
- Each module owns its database tables
|
|
38
|
+
- Module interfaces defined per module
|
|
39
|
+
|
|
40
|
+
## File Naming
|
|
41
|
+
- snake_case: order_service.go
|
|
42
|
+
- One module = one package under modules/
|
|
43
|
+
|
|
44
|
+
## Testing
|
|
45
|
+
- Per-module unit tests
|
|
46
|
+
- Integration tests per module
|
|
47
|
+
- Cross-module E2E tests
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Architecture: Modular Monolith (Python + FastAPI)
|
|
2
|
+
|
|
3
|
+
## Directory Structure
|
|
4
|
+
```
|
|
5
|
+
src/
|
|
6
|
+
├── modules/
|
|
7
|
+
│ ├── order/
|
|
8
|
+
│ │ ├── router.py
|
|
9
|
+
│ │ ├── service.py
|
|
10
|
+
│ │ ├── repository.py
|
|
11
|
+
│ │ ├── models.py
|
|
12
|
+
│ │ ├── schemas.py
|
|
13
|
+
│ │ └── events.py
|
|
14
|
+
│ ├── payment/
|
|
15
|
+
│ │ └── ...
|
|
16
|
+
│ └── user/
|
|
17
|
+
│ └── ...
|
|
18
|
+
├── shared/
|
|
19
|
+
│ ├── database/connection.py
|
|
20
|
+
│ ├── events/event_bus.py
|
|
21
|
+
│ └── middleware/
|
|
22
|
+
├── config.py
|
|
23
|
+
└── main.py
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Module Boundaries
|
|
27
|
+
- Each module is a Python package with its own router, service, repository
|
|
28
|
+
- Modules communicate via events or explicit imports of public APIs
|
|
29
|
+
- No direct database access across module boundaries
|
|
30
|
+
- Shared package for cross-cutting concerns
|
|
31
|
+
|
|
32
|
+
## Conventions
|
|
33
|
+
- Each module registers its own FastAPI router
|
|
34
|
+
- Inter-module communication via event bus
|
|
35
|
+
- Each module owns its SQLAlchemy models
|
|
36
|
+
- Public API defined in module __init__.py
|
|
37
|
+
|
|
38
|
+
## File Naming
|
|
39
|
+
- snake_case: order_service.py
|
|
40
|
+
- One module = one package under modules/
|
|
41
|
+
|
|
42
|
+
## Testing
|
|
43
|
+
- Per-module unit tests (pytest)
|
|
44
|
+
- Integration tests per module
|
|
45
|
+
- Cross-module E2E tests
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Architecture: Modular Monolith (NestJS)
|
|
2
|
+
|
|
3
|
+
## Directory Structure
|
|
4
|
+
```
|
|
5
|
+
src/
|
|
6
|
+
├── modules/
|
|
7
|
+
│ ├── order/
|
|
8
|
+
│ │ ├── order.module.ts
|
|
9
|
+
│ │ ├── order.controller.ts
|
|
10
|
+
│ │ ├── order.service.ts
|
|
11
|
+
│ │ ├── order.repository.ts
|
|
12
|
+
│ │ ├── entities/order.entity.ts
|
|
13
|
+
│ │ ├── dtos/create-order.dto.ts
|
|
14
|
+
│ │ └── events/order-created.event.ts
|
|
15
|
+
│ ├── payment/
|
|
16
|
+
│ │ ├── payment.module.ts
|
|
17
|
+
│ │ └── ...
|
|
18
|
+
│ └── user/
|
|
19
|
+
│ ├── user.module.ts
|
|
20
|
+
│ └── ...
|
|
21
|
+
├── shared/
|
|
22
|
+
│ ├── shared.module.ts
|
|
23
|
+
│ ├── database/
|
|
24
|
+
│ ├── events/event-bus.ts
|
|
25
|
+
│ └── guards/
|
|
26
|
+
└── app.module.ts
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Module Boundaries
|
|
30
|
+
- Each module is self-contained with its own controller, service, repository, entities
|
|
31
|
+
- Modules communicate via events or explicit public APIs (exported services)
|
|
32
|
+
- No direct database access across module boundaries
|
|
33
|
+
- Shared module for truly cross-cutting concerns only
|
|
34
|
+
|
|
35
|
+
## Conventions
|
|
36
|
+
- Module exports define the public API
|
|
37
|
+
- Inter-module communication via EventEmitter or message bus
|
|
38
|
+
- Each module owns its database tables
|
|
39
|
+
- NestJS DI scoped per module
|
|
40
|
+
|
|
41
|
+
## File Naming
|
|
42
|
+
- kebab-case: order.service.ts, create-order.dto.ts
|
|
43
|
+
- One module = one directory under modules/
|
|
44
|
+
|
|
45
|
+
## Testing
|
|
46
|
+
- Per-module unit tests
|
|
47
|
+
- Integration tests per module
|
|
48
|
+
- Cross-module E2E tests
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run requirement clarification on a spec
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Parse $ARGUMENTS:
|
|
6
|
+
- First word not starting with @ or / is <name>
|
|
7
|
+
- @ prefixed = agent, / prefixed = skill
|
|
8
|
+
- Remaining = supplementary instructions
|
|
9
|
+
|
|
10
|
+
Read `.workflow/specs/<name>.md`.
|
|
11
|
+
|
|
12
|
+
Analyze spec, identify requirements that can be further clarified.
|
|
13
|
+
Present as numbered questions, wait for user answers.
|
|
14
|
+
Update spec based on answers.
|
|
15
|
+
|
|
16
|
+
{If @agent present, involve corresponding agent}
|
|
17
|
+
{If /skill present, use corresponding MCP/skill to assist}
|
|
18
|
+
{Supplementary instructions}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Implement code task by task
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Parse $ARGUMENTS:
|
|
6
|
+
- First word not starting with @, /, or -- is <name>
|
|
7
|
+
- --backend claude|codex
|
|
8
|
+
- --test [tdd] [intg]: test strategy
|
|
9
|
+
- @ prefixed = agent, / prefixed = skill
|
|
10
|
+
- Remaining = supplementary instructions
|
|
11
|
+
|
|
12
|
+
Read `.workflow/state.yaml` to confirm current status.
|
|
13
|
+
Read `.workflow/plans/<name>.md` to get task list.
|
|
14
|
+
|
|
15
|
+
## Pre-flight
|
|
16
|
+
If first run (phase = ready_to_implement):
|
|
17
|
+
1. Create new branch: `git checkout -b <type>/<name>` (branch name MUST be English)
|
|
18
|
+
2. Update state.yaml phase to implementing
|
|
19
|
+
|
|
20
|
+
## Execution Loop
|
|
21
|
+
For the next pending task:
|
|
22
|
+
|
|
23
|
+
1. Read the task spec
|
|
24
|
+
2. First scan codebase to understand relevant existing modules, design patterns, utility functions
|
|
25
|
+
3. Prioritize reusing existing code; implement with minimal changes (don't over-engineer)
|
|
26
|
+
4. Follow git commit convention (refer to CLAUDE.md; default is conventional commits)
|
|
27
|
+
5. On completion: `git add -A && git commit -m "<type>(<name>): task-N <title>"` (commit message MUST be English, no Co-Authored-By trailer)
|
|
28
|
+
|
|
29
|
+
### Testing (based on --test parameter)
|
|
30
|
+
- `--test tdd`: TDD mode
|
|
31
|
+
- Write failing tests first → confirm FAIL
|
|
32
|
+
- Write minimum code → confirm PASS
|
|
33
|
+
- Refactor → confirm still PASS
|
|
34
|
+
- `git add -A && git commit -m "test(<name>): task-N <title>"`
|
|
35
|
+
- `--test tdd intg`: TDD + integration tests
|
|
36
|
+
- Same as above, but tests include integration tests
|
|
37
|
+
- `--test intg`: Post-hoc integration tests
|
|
38
|
+
- Generate integration tests after implementation
|
|
39
|
+
- `git add -A && git commit -m "test(<name>): task-N <title>"`
|
|
40
|
+
- `--test` (no value): Post-hoc unit tests
|
|
41
|
+
- Generate unit tests after implementation
|
|
42
|
+
- `git add -A && git commit -m "test(<name>): task-N <title>"`
|
|
43
|
+
- No --test: don't generate tests
|
|
44
|
+
|
|
45
|
+
### AI Review
|
|
46
|
+
1. Extract git diff for this task
|
|
47
|
+
2. Review against task spec
|
|
48
|
+
3. Label issues by severity (Critical / Warning / Info)
|
|
49
|
+
4. Save review to `.workflow/reviews/<name>-task-N.md`
|
|
50
|
+
|
|
51
|
+
### Present to User
|
|
52
|
+
- Changed file list
|
|
53
|
+
- AI review summary
|
|
54
|
+
- Condensed diff
|
|
55
|
+
- Options: [approve] [request-change] [add-test] [skip]
|
|
56
|
+
|
|
57
|
+
### Handle User Choice
|
|
58
|
+
- approve: update state.yaml, task status = complete
|
|
59
|
+
- request-change: read feedback, reset commits, re-implement
|
|
60
|
+
- add-test: generate tests, commit, re-review
|
|
61
|
+
- skip: update state.yaml, task status = skipped
|
|
62
|
+
|
|
63
|
+
### All Tasks Complete
|
|
64
|
+
Present task summary.
|
|
65
|
+
|
|
66
|
+
#### Final Code Review
|
|
67
|
+
Before presenting merge options (skip if `--skip-review` was passed):
|
|
68
|
+
1. Get full branch diff: `git diff $(git merge-base main HEAD)..HEAD`
|
|
69
|
+
2. Read spec and plan files
|
|
70
|
+
3. Perform comprehensive review of all changes as a whole
|
|
71
|
+
4. If @agents or /skills were specified, involve them in the review
|
|
72
|
+
5. Save review to `.workflow/reviews/<name>-final.md`
|
|
73
|
+
6. Present review findings to user
|
|
74
|
+
|
|
75
|
+
Options: [merge] [squash-merge] [keep-branch]
|
|
76
|
+
|
|
77
|
+
{@agent instructions}
|
|
78
|
+
{/skill instructions}
|
|
79
|
+
{Supplementary instructions}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Create a new spec file
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Create a spec based on user input.
|
|
6
|
+
|
|
7
|
+
Parse $ARGUMENTS:
|
|
8
|
+
- First word is the feature name <name> (MUST be English, kebab-case. If user provides Chinese, translate to English)
|
|
9
|
+
- If `--jira <tickets...>` present, read each ticket's content via Jira MCP (supports multiple, space-separated)
|
|
10
|
+
- If `--desc` present, following text is the description
|
|
11
|
+
- If `-i` present, enter interactive Q&A
|
|
12
|
+
- Remaining text is treated as feature description
|
|
13
|
+
|
|
14
|
+
Steps:
|
|
15
|
+
1. Check if `.workflow/specs/<name>.md` already exists; if so, ask to confirm overwrite
|
|
16
|
+
2. Generate spec based on input method:
|
|
17
|
+
- No extra args: copy `.workflow/templates/spec-template.md` to `.workflow/specs/<name>.md`
|
|
18
|
+
- Has description text: expand into complete spec
|
|
19
|
+
- Has --jira: read Jira content and convert to spec
|
|
20
|
+
- Has -i: ask questions step by step to generate spec
|
|
21
|
+
3. Display generated spec content
|
|
22
|
+
4. Prompt user they can manually edit then run `/pxs:refine <name>`
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Refine spec and decompose implementation plan
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Parse $ARGUMENTS:
|
|
6
|
+
- First word not starting with @ or / is <name>
|
|
7
|
+
- @ prefixed words are agent references
|
|
8
|
+
- / prefixed words are skill/MCP references
|
|
9
|
+
- --skip-clarify skips requirement clarification
|
|
10
|
+
- Remaining text is supplementary instructions
|
|
11
|
+
|
|
12
|
+
Read `.workflow/specs/<name>.md`.
|
|
13
|
+
|
|
14
|
+
## Phase 1: Requirement Clarification
|
|
15
|
+
Unless --skip-clarify is present:
|
|
16
|
+
1. Analyze spec, identify ambiguous or incomplete requirements
|
|
17
|
+
2. Present as numbered questions with suggested options
|
|
18
|
+
3. Wait for user answers
|
|
19
|
+
4. Follow up if needed (max 3 rounds)
|
|
20
|
+
5. If spec is sufficiently clear, inform user and proceed to next phase
|
|
21
|
+
|
|
22
|
+
{If @agent present, involve corresponding agent in requirement analysis}
|
|
23
|
+
{If /skill present, use corresponding MCP/skill to assist analysis}
|
|
24
|
+
|
|
25
|
+
## Phase 2: Refine Spec
|
|
26
|
+
1. First scan codebase to understand existing architecture, modules, design patterns, infrastructure
|
|
27
|
+
2. Refine spec based on confirmed requirements and codebase analysis
|
|
28
|
+
3. Prioritize reusing existing modules; design for minimal change
|
|
29
|
+
4. Add technical details, architecture decisions (with rationale and alternatives), API design, file paths, acceptance criteria
|
|
30
|
+
5. Each architecture suggestion includes justification (why needed, existing alternatives, cost of introduction)
|
|
31
|
+
6. Overwrite `.workflow/specs/<name>.md`
|
|
32
|
+
7. Present refined spec to user for confirmation
|
|
33
|
+
8. User approves to continue; otherwise modify based on feedback
|
|
34
|
+
|
|
35
|
+
## Phase 3: Decompose Plan
|
|
36
|
+
1. Determine feature type (feat/fix/refactor/docs/chore)
|
|
37
|
+
2. Decompose requirements into independently completable tasks
|
|
38
|
+
3. Each task lists: title, affected files, description, dependencies, complexity, acceptance criteria
|
|
39
|
+
4. Generate `.workflow/plans/<name>.md`
|
|
40
|
+
5. Present plan to user:
|
|
41
|
+
- Type and branch naming
|
|
42
|
+
- Each task's content
|
|
43
|
+
6. User approve → update `.workflow/state.yaml`
|
|
44
|
+
7. User edit → wait for modifications
|
|
45
|
+
8. User re-split → re-decompose based on feedback
|
|
46
|
+
|
|
47
|
+
{Supplementary instructions: $REMAINING_TEXT}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: View review records
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Parse $ARGUMENTS:
|
|
6
|
+
- First word not starting with @, /, or -- is <name>
|
|
7
|
+
- --step N: view specific task review
|
|
8
|
+
- --summary: all tasks summary
|
|
9
|
+
- @ prefixed = agent, / prefixed = skill
|
|
10
|
+
|
|
11
|
+
Read `.workflow/state.yaml`.
|
|
12
|
+
|
|
13
|
+
- No options: show current pending review or most recent review
|
|
14
|
+
- --step N: read `.workflow/reviews/<name>-task-N.md` and display
|
|
15
|
+
- --summary: list all tasks' review status
|
|
16
|
+
|
|
17
|
+
{If @agent /skill present, they can provide supplementary analysis on existing reviews}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: View workflow status
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Parse $ARGUMENTS:
|
|
6
|
+
- Has value → show specific feature status
|
|
7
|
+
- No value → list all features
|
|
8
|
+
|
|
9
|
+
Read `.workflow/state.yaml`.
|
|
10
|
+
|
|
11
|
+
- No args: list all features with name, type, phase, task progress, branch
|
|
12
|
+
- Has <name>: show detailed status for that feature, including each task's status
|