ai-spector 0.1.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/README.md +169 -0
- package/_templates/basic_design/db-design-template.md +177 -0
- package/_templates/basic_design/detail-api-template.md +278 -0
- package/_templates/basic_design/detail-screen-template.md +281 -0
- package/_templates/basic_design/list-api-template.md +130 -0
- package/_templates/basic_design/list-screen-template.md +242 -0
- package/_templates/detail_design/common/architecture-overview-template.md +302 -0
- package/_templates/detail_design/common/deployment-infrastructure-template.md +461 -0
- package/_templates/detail_design/common/error-handling-patterns-template.md +460 -0
- package/_templates/detail_design/common/integration-patterns-template.md +410 -0
- package/_templates/detail_design/common/performance-standards-template.md +406 -0
- package/_templates/detail_design/common/security-patterns-template.md +395 -0
- package/_templates/detail_design/feature-detail-design-template.md +773 -0
- package/_templates/detail_design/feature-list-template.md +39 -0
- package/_templates/srs/1-introduction.md +58 -0
- package/_templates/srs/2-overall-description.md +91 -0
- package/_templates/srs/3-use-case-detail-template.md +142 -0
- package/_templates/srs/3-use-cases.md +53 -0
- package/_templates/srs/4-system-feature-detail-template.md +131 -0
- package/_templates/srs/4-system-features-list-template.md +39 -0
- package/_templates/srs/5-data-requirements.md +59 -0
- package/_templates/srs/6-external-interfaces.md +56 -0
- package/_templates/srs/7-quality-attributes.md +74 -0
- package/_templates/srs/8-internationalization.md +36 -0
- package/_templates/srs/9-other-requirements.md +46 -0
- package/assets/cursor/commands/analyze.md +39 -0
- package/assets/cursor/commands/generate-detail-design.md +35 -0
- package/assets/cursor/commands/generate-srs.md +38 -0
- package/assets/cursor/skills/spec-writer/SKILL.md +33 -0
- package/assets/workflow/config/analyze.graphify.json +36 -0
- package/assets/workflow/config/completeness-rules.detail-design.json +57 -0
- package/assets/workflow/config/completeness-rules.srs.json +72 -0
- package/assets/workflow/config/dag.detail-design.json +64 -0
- package/assets/workflow/config/dag.srs.json +87 -0
- package/assets/workflow/state/state.template.json +26 -0
- package/assets/workflow/templates/basic_design/db-design-template.md +177 -0
- package/assets/workflow/templates/basic_design/detail-api-template.md +278 -0
- package/assets/workflow/templates/basic_design/detail-screen-template.md +281 -0
- package/assets/workflow/templates/basic_design/list-api-template.md +130 -0
- package/assets/workflow/templates/basic_design/list-screen-template.md +242 -0
- package/assets/workflow/templates/detail_design/common/architecture-overview-template.md +302 -0
- package/assets/workflow/templates/detail_design/common/deployment-infrastructure-template.md +461 -0
- package/assets/workflow/templates/detail_design/common/error-handling-patterns-template.md +460 -0
- package/assets/workflow/templates/detail_design/common/integration-patterns-template.md +410 -0
- package/assets/workflow/templates/detail_design/common/performance-standards-template.md +406 -0
- package/assets/workflow/templates/detail_design/common/security-patterns-template.md +395 -0
- package/assets/workflow/templates/detail_design/feature-detail-design-template.md +773 -0
- package/assets/workflow/templates/detail_design/feature-list-template.md +39 -0
- package/assets/workflow/templates/srs/1-introduction.md +58 -0
- package/assets/workflow/templates/srs/2-overall-description.md +91 -0
- package/assets/workflow/templates/srs/3-use-case-detail-template.md +142 -0
- package/assets/workflow/templates/srs/3-use-cases.md +53 -0
- package/assets/workflow/templates/srs/4-system-feature-detail-template.md +131 -0
- package/assets/workflow/templates/srs/4-system-features-list-template.md +39 -0
- package/assets/workflow/templates/srs/5-data-requirements.md +59 -0
- package/assets/workflow/templates/srs/6-external-interfaces.md +56 -0
- package/assets/workflow/templates/srs/7-quality-attributes.md +74 -0
- package/assets/workflow/templates/srs/8-internationalization.md +36 -0
- package/assets/workflow/templates/srs/9-other-requirements.md +46 -0
- package/bin/spec-writer.js +56 -0
- package/package.json +25 -0
- package/src/cli/helpers/fs.js +50 -0
- package/src/cli/init.js +178 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# Database Design: <Project Name>
|
|
2
|
+
|
|
3
|
+
> This document explains the database structure and purpose of each table, helping developers, QA, and DBAs understand data relationships and design rationale.
|
|
4
|
+
|
|
5
|
+
**Source Requirements:** SRS Section 5 (Data Requirements)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Overview
|
|
10
|
+
|
|
11
|
+
**Database Management System:** <PostgreSQL/MySQL/Other>
|
|
12
|
+
|
|
13
|
+
**Purpose:**
|
|
14
|
+
> Describe the main purpose of the database and what business flows it supports.
|
|
15
|
+
|
|
16
|
+
**Source Requirements:**
|
|
17
|
+
> Reference SRS sections that informed this design.
|
|
18
|
+
- SRS Section 4: <Functional Requirements>
|
|
19
|
+
- SRS Section 5: <Data Requirements>
|
|
20
|
+
- SRS Section 7: <Quality Attributes>
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 2. Entity-Relationship Diagram
|
|
25
|
+
|
|
26
|
+
> Provide a visual representation of tables and their relationships.
|
|
27
|
+
|
|
28
|
+
```mermaid
|
|
29
|
+
erDiagram
|
|
30
|
+
ENTITY1 ||--o{ ENTITY2 : "relationship"
|
|
31
|
+
ENTITY1 {
|
|
32
|
+
int id PK
|
|
33
|
+
string name
|
|
34
|
+
datetime created_at
|
|
35
|
+
}
|
|
36
|
+
ENTITY2 {
|
|
37
|
+
int id PK
|
|
38
|
+
int entity1_id FK
|
|
39
|
+
string description
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 3. Table List and Roles
|
|
46
|
+
|
|
47
|
+
| Table Name | Purpose | Main Relationships |
|
|
48
|
+
|------------|---------|-------------------|
|
|
49
|
+
| `<table_name>` | <Purpose description> | <Relationship description> |
|
|
50
|
+
| `<table_name>` | <Purpose description> | <Relationship description> |
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 4. Detailed Table Descriptions
|
|
55
|
+
|
|
56
|
+
### 4.1 `<table_name>`
|
|
57
|
+
|
|
58
|
+
**Purpose:**
|
|
59
|
+
> Describe what this table stores and its role in the system.
|
|
60
|
+
|
|
61
|
+
**Primary Key:** `<field_name>` (<data_type>)
|
|
62
|
+
|
|
63
|
+
**Key Fields:**
|
|
64
|
+
|
|
65
|
+
| Field Name | Data Type | Constraints | Description |
|
|
66
|
+
|------------|-----------|-------------|-------------|
|
|
67
|
+
| `<field_name>` | `<type>` | `<UNIQUE/NOT NULL/CHECK>` | <Description> |
|
|
68
|
+
| `<field_name>` | `<type>` | `<constraints>` | <Description> |
|
|
69
|
+
|
|
70
|
+
**Important Design Decisions:**
|
|
71
|
+
- <Decision 1 and rationale>
|
|
72
|
+
- <Decision 2 and rationale>
|
|
73
|
+
|
|
74
|
+
**Foreign Keys:**
|
|
75
|
+
- `<field_name>` → `<referenced_table>.<referenced_field>` (<relationship description>)
|
|
76
|
+
|
|
77
|
+
**Indexes:**
|
|
78
|
+
- `<index_name>` on `<field_name>` (<purpose>)
|
|
79
|
+
|
|
80
|
+
**Business Rules:**
|
|
81
|
+
- <Business rule 1>
|
|
82
|
+
- <Business rule 2>
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### 4.2 `<table_name>`
|
|
87
|
+
|
|
88
|
+
**Purpose:**
|
|
89
|
+
> Describe what this table stores.
|
|
90
|
+
|
|
91
|
+
**Primary Key:** `<field_name>` (<data_type>)
|
|
92
|
+
|
|
93
|
+
**Key Fields:**
|
|
94
|
+
|
|
95
|
+
| Field Name | Data Type | Constraints | Description |
|
|
96
|
+
|------------|-----------|-------------|-------------|
|
|
97
|
+
| `<field_name>` | `<type>` | `<constraints>` | <Description> |
|
|
98
|
+
|
|
99
|
+
**Foreign Keys:**
|
|
100
|
+
- `<field_name>` → `<referenced_table>.<referenced_field>`
|
|
101
|
+
|
|
102
|
+
**Indexes:**
|
|
103
|
+
- `<index_name>` on `<field_name>`
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 5. Relationships Summary
|
|
108
|
+
|
|
109
|
+
> Document all relationships between tables.
|
|
110
|
+
|
|
111
|
+
| From Table | Relationship Type | To Table | Description |
|
|
112
|
+
|------------|-------------------|----------|-------------|
|
|
113
|
+
| `<table1>` | One-to-Many | `<table2>` | <Description> |
|
|
114
|
+
| `<table1>` | Many-to-Many | `<table2>` | <Description> |
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## 6. Data Integrity Rules
|
|
119
|
+
|
|
120
|
+
**Constraints:**
|
|
121
|
+
- <Constraint 1>
|
|
122
|
+
- <Constraint 2>
|
|
123
|
+
|
|
124
|
+
**Validation Rules:**
|
|
125
|
+
- <Validation rule 1>
|
|
126
|
+
- <Validation rule 2>
|
|
127
|
+
|
|
128
|
+
**Referential Integrity:**
|
|
129
|
+
- <Cascade/restrict/set null behavior>
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## 7. Performance Considerations
|
|
134
|
+
|
|
135
|
+
**Indexes:**
|
|
136
|
+
> List indexes for query optimization.
|
|
137
|
+
|
|
138
|
+
| Index Name | Table | Fields | Purpose |
|
|
139
|
+
|------------|-------|--------|---------|
|
|
140
|
+
| `<index_name>` | `<table>` | `<fields>` | <Purpose> |
|
|
141
|
+
|
|
142
|
+
**Query Optimization Notes:**
|
|
143
|
+
- <Note 1>
|
|
144
|
+
- <Note 2>
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## 8. Security Considerations
|
|
149
|
+
|
|
150
|
+
**Access Control:**
|
|
151
|
+
- <Access control requirement 1>
|
|
152
|
+
- <Access control requirement 2>
|
|
153
|
+
|
|
154
|
+
**Data Protection:**
|
|
155
|
+
- <Protection measure 1>
|
|
156
|
+
- <Protection measure 2>
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## 9. Future Extensions
|
|
161
|
+
|
|
162
|
+
> Document potential future enhancements or changes.
|
|
163
|
+
|
|
164
|
+
- <Extension 1>
|
|
165
|
+
- <Extension 2>
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## 10. Notes
|
|
170
|
+
|
|
171
|
+
**Migration Strategy:**
|
|
172
|
+
> Reference migration tool or approach (e.g., Flyway, Liquibase).
|
|
173
|
+
|
|
174
|
+
**Testing Considerations:**
|
|
175
|
+
- <Testing note 1>
|
|
176
|
+
- <Testing note 2>
|
|
177
|
+
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
# API Detail: <Project Name>
|
|
2
|
+
|
|
3
|
+
> This document specifies detailed request/response schemas, path/query parameters, and error handling for each API endpoint. For the endpoint list and overview, see the API List document.
|
|
4
|
+
|
|
5
|
+
**Source Requirements:** SRS Section 4 (System Features), Section 6.2 (Software Interfaces)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Detailed Endpoint Specifications
|
|
10
|
+
|
|
11
|
+
### 1.1 `POST /resource`
|
|
12
|
+
|
|
13
|
+
**Summary:** <Brief description>
|
|
14
|
+
|
|
15
|
+
**Operation ID:** `createResource`
|
|
16
|
+
|
|
17
|
+
**Source Requirement:** SRS Section <X.X> - <Feature Name>
|
|
18
|
+
|
|
19
|
+
**Authentication:** Required
|
|
20
|
+
|
|
21
|
+
**Request:**
|
|
22
|
+
|
|
23
|
+
**Headers:**
|
|
24
|
+
```
|
|
25
|
+
Authorization: Bearer <token>
|
|
26
|
+
Content-Type: application/json
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Body Schema:**
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"field1": "<type>",
|
|
33
|
+
"field2": "<type>",
|
|
34
|
+
"field3": "<type>"
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Field Descriptions:**
|
|
39
|
+
|
|
40
|
+
| Field | Type | Required | Validation | Description |
|
|
41
|
+
|-------|------|----------|------------|-------------|
|
|
42
|
+
| `field1` | `<type>` | Yes | <Validation rules> | <Description> |
|
|
43
|
+
| `field2` | `<type>` | No | <Validation rules> | <Description> |
|
|
44
|
+
|
|
45
|
+
**Example Request:**
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"field1": "value1",
|
|
49
|
+
"field2": "value2"
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Responses:**
|
|
54
|
+
|
|
55
|
+
**201 Created:**
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"id": 123,
|
|
59
|
+
"status": "success",
|
|
60
|
+
"message": "<Message>"
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**400 Bad Request:**
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"error": "validation_error",
|
|
68
|
+
"message": "<Error message>",
|
|
69
|
+
"details": [
|
|
70
|
+
{
|
|
71
|
+
"field": "field1",
|
|
72
|
+
"message": "<Field-specific error>"
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**401 Unauthorized:**
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"error": "unauthorized",
|
|
82
|
+
"message": "Authentication required"
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**500 Internal Server Error:**
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"error": "internal_error",
|
|
90
|
+
"message": "<Error message>"
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
### 1.2 `GET /resource/{id}`
|
|
97
|
+
|
|
98
|
+
**Summary:** <Brief description>
|
|
99
|
+
|
|
100
|
+
**Operation ID:** `getResource`
|
|
101
|
+
|
|
102
|
+
**Source Requirement:** SRS Section <X.X>
|
|
103
|
+
|
|
104
|
+
**Authentication:** Required
|
|
105
|
+
|
|
106
|
+
**Path Parameters:**
|
|
107
|
+
|
|
108
|
+
| Parameter | Type | Required | Description |
|
|
109
|
+
|-----------|------|----------|-------------|
|
|
110
|
+
| `id` | integer | Yes | Resource identifier |
|
|
111
|
+
|
|
112
|
+
**Query Parameters:**
|
|
113
|
+
|
|
114
|
+
| Parameter | Type | Required | Description |
|
|
115
|
+
|-----------|------|----------|-------------|
|
|
116
|
+
| `include` | string | No | Related resources to include |
|
|
117
|
+
| `fields` | string | No | Fields to return |
|
|
118
|
+
|
|
119
|
+
**Responses:**
|
|
120
|
+
|
|
121
|
+
**200 OK:**
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"id": 123,
|
|
125
|
+
"field1": "value1",
|
|
126
|
+
"field2": "value2",
|
|
127
|
+
"created_at": "2025-01-01T00:00:00Z"
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**404 Not Found:**
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"error": "not_found",
|
|
135
|
+
"message": "Resource not found"
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
### 1.3 `PUT /resource/{id}`
|
|
142
|
+
|
|
143
|
+
**Summary:** <Brief description>
|
|
144
|
+
|
|
145
|
+
**Operation ID:** `updateResource`
|
|
146
|
+
|
|
147
|
+
**Authentication:** Required
|
|
148
|
+
|
|
149
|
+
**Path Parameters:**
|
|
150
|
+
- `id`: Resource identifier
|
|
151
|
+
|
|
152
|
+
**Request Body:**
|
|
153
|
+
> Similar structure to POST
|
|
154
|
+
|
|
155
|
+
**Responses:**
|
|
156
|
+
> Similar structure to GET/POST
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
### 1.4 `DELETE /resource/{id}`
|
|
161
|
+
|
|
162
|
+
**Summary:** <Brief description>
|
|
163
|
+
|
|
164
|
+
**Operation ID:** `deleteResource`
|
|
165
|
+
|
|
166
|
+
**Authentication:** Required
|
|
167
|
+
|
|
168
|
+
**Path Parameters:**
|
|
169
|
+
- `id`: Resource identifier
|
|
170
|
+
|
|
171
|
+
**Responses:**
|
|
172
|
+
|
|
173
|
+
**204 No Content:**
|
|
174
|
+
> Success response with no body
|
|
175
|
+
|
|
176
|
+
**404 Not Found:**
|
|
177
|
+
> Error response
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## 2. Data Models
|
|
182
|
+
|
|
183
|
+
### 2.1 Resource Model
|
|
184
|
+
|
|
185
|
+
**Description:** <Description of the data model>
|
|
186
|
+
|
|
187
|
+
**Schema:**
|
|
188
|
+
```json
|
|
189
|
+
{
|
|
190
|
+
"id": "integer",
|
|
191
|
+
"field1": "string",
|
|
192
|
+
"field2": "integer",
|
|
193
|
+
"created_at": "datetime",
|
|
194
|
+
"updated_at": "datetime"
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Field Details:**
|
|
199
|
+
|
|
200
|
+
| Field | Type | Description | Constraints |
|
|
201
|
+
|-------|------|-------------|-------------|
|
|
202
|
+
| `id` | integer | Unique identifier | Auto-generated |
|
|
203
|
+
| `field1` | string | <Description> | Max 255 chars |
|
|
204
|
+
| `field2` | integer | <Description> | Min 0, Max 100 |
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## 3. Error Handling
|
|
209
|
+
|
|
210
|
+
**Standard Error Response Format:**
|
|
211
|
+
```json
|
|
212
|
+
{
|
|
213
|
+
"error": "<error_code>",
|
|
214
|
+
"message": "<Human-readable message>",
|
|
215
|
+
"details": {
|
|
216
|
+
"<additional_info>": "<value>"
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**Error Codes:**
|
|
222
|
+
|
|
223
|
+
| Code | HTTP Status | Description |
|
|
224
|
+
|------|-------------|-------------|
|
|
225
|
+
| `validation_error` | 400 | Request validation failed |
|
|
226
|
+
| `unauthorized` | 401 | Authentication required |
|
|
227
|
+
| `forbidden` | 403 | Insufficient permissions |
|
|
228
|
+
| `not_found` | 404 | Resource not found |
|
|
229
|
+
| `conflict` | 409 | Resource conflict |
|
|
230
|
+
| `internal_error` | 500 | Server error |
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## 4. Rate Limiting
|
|
235
|
+
|
|
236
|
+
**Limits:**
|
|
237
|
+
- <Limit description>
|
|
238
|
+
|
|
239
|
+
**Headers:**
|
|
240
|
+
```
|
|
241
|
+
X-RateLimit-Limit: <number>
|
|
242
|
+
X-RateLimit-Remaining: <number>
|
|
243
|
+
X-RateLimit-Reset: <timestamp>
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Response when limit exceeded:**
|
|
247
|
+
```json
|
|
248
|
+
{
|
|
249
|
+
"error": "rate_limit_exceeded",
|
|
250
|
+
"message": "Too many requests",
|
|
251
|
+
"retry_after": 60
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## 5. Webhooks (if applicable)
|
|
258
|
+
|
|
259
|
+
**Events:**
|
|
260
|
+
- `<event_name>`: <Description>
|
|
261
|
+
|
|
262
|
+
**Payload Format:**
|
|
263
|
+
```json
|
|
264
|
+
{
|
|
265
|
+
"event": "<event_name>",
|
|
266
|
+
"timestamp": "<ISO 8601>",
|
|
267
|
+
"data": {
|
|
268
|
+
"<resource_data>": "..."
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## 6. Future Enhancements
|
|
276
|
+
|
|
277
|
+
- <Enhancement 1>
|
|
278
|
+
- <Enhancement 2>
|