archspec 1.6.3 → 1.6.4
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/lib/init.js +5 -2
- package/lib/templates/execution.js +136 -0
- package/lib/templates/implementation.js +355 -0
- package/package.json +1 -1
package/lib/init.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
const createFolderWithFiles = require("./createFolderWithFiles");
|
|
2
2
|
const architectureTemplates = require("./templates/architecture");
|
|
3
3
|
const governanceTemplates = require("./templates/governance");
|
|
4
|
-
|
|
4
|
+
const implementationTemplates = require("./templates/implementation");
|
|
5
|
+
const executionTemplates = require("./templates/execution");
|
|
5
6
|
|
|
6
7
|
function init() {
|
|
7
8
|
createFolderWithFiles("architecture", architectureTemplates);
|
|
8
9
|
createFolderWithFiles("governance", governanceTemplates);
|
|
9
|
-
|
|
10
|
+
createFolderWithFiles("implementation", implementationTemplates);
|
|
11
|
+
createFolderWithFiles("execution", executionTemplates);
|
|
12
|
+
console.log("Architecture, Governance, Implementation and Execution folders initialized.");
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
module.exports = init;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
const executionTemplates = {
|
|
2
|
+
"README.md": `# Execution
|
|
3
|
+
|
|
4
|
+
This directory defines how approved implementation decisions are executed.
|
|
5
|
+
|
|
6
|
+
Execution does NOT define architecture.
|
|
7
|
+
Execution does NOT define implementation structure.
|
|
8
|
+
|
|
9
|
+
Execution translates approved decisions into:
|
|
10
|
+
|
|
11
|
+
- Phased delivery
|
|
12
|
+
- Tasks
|
|
13
|
+
- Testing
|
|
14
|
+
- Operational tracking
|
|
15
|
+
|
|
16
|
+
If it is not tied to an approved decision, it must not be executed.
|
|
17
|
+
`,
|
|
18
|
+
|
|
19
|
+
"execution-plan.md": `# Execution Plan
|
|
20
|
+
|
|
21
|
+
## Phase 1 – Backend Core
|
|
22
|
+
|
|
23
|
+
Layers:
|
|
24
|
+
- Infra (Node + TS config)
|
|
25
|
+
- DAL
|
|
26
|
+
- Services
|
|
27
|
+
- Controllers
|
|
28
|
+
- Routes
|
|
29
|
+
|
|
30
|
+
Deliverables:
|
|
31
|
+
- Server starts successfully
|
|
32
|
+
- SQLite DB connected
|
|
33
|
+
- Endpoints respond correctly
|
|
34
|
+
|
|
35
|
+
Testing Requirements:
|
|
36
|
+
- Unit tests for Services
|
|
37
|
+
- Integration tests for Controllers
|
|
38
|
+
- Route-level tests using supertest
|
|
39
|
+
- Prisma schema migration verified
|
|
40
|
+
|
|
41
|
+
Completion Criteria:
|
|
42
|
+
- \`npm test\` passes
|
|
43
|
+
- All endpoints reachable
|
|
44
|
+
|
|
45
|
+
## Phase 2 – Frontend Core
|
|
46
|
+
|
|
47
|
+
Layers:
|
|
48
|
+
- Infra (Vite config)
|
|
49
|
+
- API Service
|
|
50
|
+
- FE Services
|
|
51
|
+
- Context
|
|
52
|
+
- Components
|
|
53
|
+
|
|
54
|
+
Testing Requirements:
|
|
55
|
+
- Unit tests for FE Services
|
|
56
|
+
- Context tests
|
|
57
|
+
- Component tests (React Testing Library)
|
|
58
|
+
|
|
59
|
+
Completion Criteria:
|
|
60
|
+
- UI renders
|
|
61
|
+
- Data loads
|
|
62
|
+
- Form submission works
|
|
63
|
+
|
|
64
|
+
## Phase 3 – E2E
|
|
65
|
+
|
|
66
|
+
- Playwright or Cypress
|
|
67
|
+
- Full user flow:
|
|
68
|
+
- Fetch random question
|
|
69
|
+
- Submit answer
|
|
70
|
+
- Reload page
|
|
71
|
+
- Verify persisted data appears
|
|
72
|
+
`,
|
|
73
|
+
|
|
74
|
+
"test-strategy.md": `# Test Strategy
|
|
75
|
+
|
|
76
|
+
## Backend
|
|
77
|
+
- Jest
|
|
78
|
+
- supertest
|
|
79
|
+
- SQLite test DB
|
|
80
|
+
|
|
81
|
+
## Frontend
|
|
82
|
+
- Vitest
|
|
83
|
+
- React Testing Library
|
|
84
|
+
|
|
85
|
+
## E2E
|
|
86
|
+
- Playwright
|
|
87
|
+
|
|
88
|
+
All implementation phases must include:
|
|
89
|
+
- Passing unit tests
|
|
90
|
+
- No console errors
|
|
91
|
+
- No TypeScript errors
|
|
92
|
+
`,
|
|
93
|
+
|
|
94
|
+
"open-questions.md": `Example Structure:
|
|
95
|
+
|
|
96
|
+
# Open Questions Log
|
|
97
|
+
|
|
98
|
+
## Q-001
|
|
99
|
+
Context: API Service
|
|
100
|
+
Question: Should base URL differ between dev and prod?
|
|
101
|
+
Status: Open
|
|
102
|
+
|
|
103
|
+
## Q-002
|
|
104
|
+
Context: DAL
|
|
105
|
+
Question: Should timestamps be ISO strings or Date objects?
|
|
106
|
+
Status: Open
|
|
107
|
+
|
|
108
|
+
-----
|
|
109
|
+
|
|
110
|
+
Add REAL open questions below, following the above structure EXACLY
|
|
111
|
+
`,
|
|
112
|
+
|
|
113
|
+
"agents-prompts.md": `You are the Implementation Execution Agent.
|
|
114
|
+
|
|
115
|
+
Your job is to implement the project according to:
|
|
116
|
+
|
|
117
|
+
- architecture/architecture.md
|
|
118
|
+
- implementation/implementation.md
|
|
119
|
+
- execution/execution-plan.md
|
|
120
|
+
- execution/test-strategy.md
|
|
121
|
+
|
|
122
|
+
Rules:
|
|
123
|
+
- If any ambiguity or missing detail appears, append question to open-questions.md instead of guessing.
|
|
124
|
+
- Do NOT guess missing requirements
|
|
125
|
+
- Implement phase-by-phase
|
|
126
|
+
- After completing each phase, ensure all defined tests pass
|
|
127
|
+
- Add unit tests for each implemented layer
|
|
128
|
+
- Add integration tests where applicable
|
|
129
|
+
- Add E2E tests in final phase
|
|
130
|
+
- Do NOT modify architecture or implementation documents
|
|
131
|
+
- Stop after each phase and report status
|
|
132
|
+
`
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
module.exports = executionTemplates;
|
|
136
|
+
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
const implementationTemplates = {
|
|
2
|
+
"current-project-desc.md": `# Current Project Description`,
|
|
3
|
+
"README.md": `# Implementation Governance
|
|
4
|
+
|
|
5
|
+
This directory defines how stack-specific implementation decisions are created and maintained.
|
|
6
|
+
|
|
7
|
+
## Relationship to Architecture
|
|
8
|
+
- Layer structure and responsibilities are inherited from \`/architecture\`.
|
|
9
|
+
- Implementation decisions may not redefine, rename, reorder, or remove architectural layers.
|
|
10
|
+
- Implementation must respect all approved architectural boundaries.
|
|
11
|
+
|
|
12
|
+
## Source of Truth
|
|
13
|
+
- \`implementation.decisions.md\` is the ONLY source of truth for stack-specific realization.
|
|
14
|
+
- \`implementation.md\` is a GENERATED artifact and must never be edited manually.
|
|
15
|
+
|
|
16
|
+
## Core Rules
|
|
17
|
+
1. All implementation changes are expressed as Decisions.
|
|
18
|
+
2. Each Decision belongs to exactly ONE layer (as defined in \`/architecture\`).
|
|
19
|
+
3. Only Decisions with \`Status: approved\` are applied.
|
|
20
|
+
4. Agents may NOT edit \`implementation.md\`.
|
|
21
|
+
5. \`implementation.md\` can be deleted and regenerated at any time.
|
|
22
|
+
|
|
23
|
+
## Scope of Implementation Decisions
|
|
24
|
+
Implementation decisions define how architectural layers are realized in this project and may specify:
|
|
25
|
+
- Frameworks and libraries
|
|
26
|
+
- Folder structure and file organization
|
|
27
|
+
- Dependency injection patterns
|
|
28
|
+
- Validation libraries
|
|
29
|
+
- Transport clients
|
|
30
|
+
- Testing frameworks
|
|
31
|
+
- Tooling and build configuration
|
|
32
|
+
|
|
33
|
+
Implementation decisions may NOT:
|
|
34
|
+
- Change layer responsibilities
|
|
35
|
+
- Introduce, remove, or rename architectural layers
|
|
36
|
+
- Modify dependency direction between layers
|
|
37
|
+
- Override approved architectural decisions
|
|
38
|
+
|
|
39
|
+
## Workflow
|
|
40
|
+
1. Layer implementation agent proposes a Decision (\`Status: proposed\`)
|
|
41
|
+
2. Human reviews and approves the Decision
|
|
42
|
+
3. Implementation writer agent regenerates \`implementation.md\`
|
|
43
|
+
|
|
44
|
+
If it is not a Decision, it is not implementation.
|
|
45
|
+
|
|
46
|
+
## Operation
|
|
47
|
+
|
|
48
|
+
For daily usage and workflow, see:
|
|
49
|
+
|
|
50
|
+
- \`flow.md\` – Implementation decision lifecycle
|
|
51
|
+
- \`agent-prompts.md\` – Agent definitions
|
|
52
|
+
- \`init.md\` – Initial setup instructions
|
|
53
|
+
|
|
54
|
+
## Project Context
|
|
55
|
+
|
|
56
|
+
This implementation system operates within the context of the current project description.
|
|
57
|
+
|
|
58
|
+
See:
|
|
59
|
+
|
|
60
|
+
- \`current-project-desc.md\` – Functional description and goals of this project
|
|
61
|
+
|
|
62
|
+
All implementation decisions must align with this document while respecting architectural boundaries.
|
|
63
|
+
`,
|
|
64
|
+
|
|
65
|
+
"flow.md": `
|
|
66
|
+
## The daily workflow (this is the loop)
|
|
67
|
+
|
|
68
|
+
### Step A – Propose
|
|
69
|
+
|
|
70
|
+
* Run a **layer agent**
|
|
71
|
+
* It appends a \`Status: proposed\` decision to \`implementation.decisions.md\`
|
|
72
|
+
|
|
73
|
+
### Step B – Validate
|
|
74
|
+
|
|
75
|
+
* Run **Implementation Validator Agent**
|
|
76
|
+
* Fix or clarify decision if blocked
|
|
77
|
+
|
|
78
|
+
### Step C – Approve (YOU)
|
|
79
|
+
|
|
80
|
+
* Change **one word**:
|
|
81
|
+
|
|
82
|
+
\`Status: approved\`
|
|
83
|
+
|
|
84
|
+
### Step D – Generate
|
|
85
|
+
|
|
86
|
+
* Run **Writer Agent**
|
|
87
|
+
* \`implementation.md\` is regenerated fully
|
|
88
|
+
|
|
89
|
+
That’s it.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Hard rules (do not break these)
|
|
94
|
+
|
|
95
|
+
* ❌ No agent edits \`implementation.md\`
|
|
96
|
+
* ❌ No decision spans multiple layers
|
|
97
|
+
* ❌ No prose inside decisions
|
|
98
|
+
* ❌ No incremental edits to implementation.md
|
|
99
|
+
* ✅ Delete + regenerate is always safe
|
|
100
|
+
|
|
101
|
+
If these rules hold → system is deterministic.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Mental model (for Cursor usage)
|
|
106
|
+
|
|
107
|
+
* \`implementation.decisions.md\` = **config**
|
|
108
|
+
* Writer agent = **compiler**
|
|
109
|
+
* \`implementation.md\` = **build artifact**
|
|
110
|
+
* You = **approver of intent**
|
|
111
|
+
* Cursor = **execution environment**
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
<!-- ## Optional (but powerful, later)
|
|
116
|
+
|
|
117
|
+
* Add Decision IDs enforcement
|
|
118
|
+
* Add a script that deletes + regenerates implementation.md
|
|
119
|
+
* Add a CI check that fails if implementation.md is edited manually -->
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
### Final checkpoint
|
|
124
|
+
|
|
125
|
+
If you can:
|
|
126
|
+
|
|
127
|
+
* delete \`implementation.md\`
|
|
128
|
+
* regenerate it
|
|
129
|
+
* get the same result
|
|
130
|
+
|
|
131
|
+
✅ You’ve set it up correctly.
|
|
132
|
+
`,
|
|
133
|
+
|
|
134
|
+
"init.md": `# Cursor Setup: Deterministic Bottom-Up Architecture
|
|
135
|
+
|
|
136
|
+
## 1. Create the files (once)
|
|
137
|
+
|
|
138
|
+
In your repo root:
|
|
139
|
+
|
|
140
|
+
/implementation
|
|
141
|
+
├─ implementation.decisions.md ← ONLY editable implementation truth
|
|
142
|
+
├─ implementation.md ← GENERATED, read-only
|
|
143
|
+
├─ README.md ← governance
|
|
144
|
+
└─ agent-prompts.md ← implementation agents
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## 2. Initialize \`implementation.decisions.md\`
|
|
149
|
+
|
|
150
|
+
Paste this exactly:
|
|
151
|
+
|
|
152
|
+
Paste this exactly, until the line \`-- END OF PASTING --\`:
|
|
153
|
+
|
|
154
|
+
# Implementation Decisions
|
|
155
|
+
|
|
156
|
+
## Rules
|
|
157
|
+
- Decisions are the ONLY source of truth
|
|
158
|
+
- implementation.md is generated, never edited
|
|
159
|
+
- Every decision belongs to exactly ONE layer
|
|
160
|
+
- Only decisions with Status: approved are applied
|
|
161
|
+
|
|
162
|
+
## Layers (fixed)
|
|
163
|
+
{
|
|
164
|
+
TAKE LAYERS FROM architecture/README.md > Layers (Fixed)
|
|
165
|
+
write each layer in a new line by order with ## before the name
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
-- END OF PASTING --
|
|
169
|
+
|
|
170
|
+
This file is **the system state**.
|
|
171
|
+
|
|
172
|
+
### Mapping for creating identical prompts from agents-prompts.md:
|
|
173
|
+
same as Mapping for creating identical prompts from architecture/agents-prompts.md, just replace the 'D-' with 'I-',
|
|
174
|
+
example:
|
|
175
|
+
- DAL → \`I-DAL-XXX\`
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## 3. Create Cursor Agents Prompts (THIS IS KEY)
|
|
180
|
+
|
|
181
|
+
- Create prompt for **one agent per layer**
|
|
182
|
+
- follow instructions in implementation/agents-prompts.md
|
|
183
|
+
`,
|
|
184
|
+
|
|
185
|
+
"implementation.md": `<!-- GENERATED FILE – DO NOT EDIT -->
|
|
186
|
+
|
|
187
|
+
# Implementation
|
|
188
|
+
|
|
189
|
+
This file is generated from implementation.decisions.md
|
|
190
|
+
`,
|
|
191
|
+
|
|
192
|
+
"implementation.decisions.md": `# Implementation Decisions
|
|
193
|
+
|
|
194
|
+
## Rules
|
|
195
|
+
- Decisions are the ONLY source of truth
|
|
196
|
+
- implementation.md is generated, never edited
|
|
197
|
+
- Every decision belongs to exactly ONE layer
|
|
198
|
+
- Only decisions with Status: approved are applied
|
|
199
|
+
|
|
200
|
+
## Layers (fixed)
|
|
201
|
+
- Infra
|
|
202
|
+
- DAL
|
|
203
|
+
- Services
|
|
204
|
+
- Controllers
|
|
205
|
+
- Routes
|
|
206
|
+
- API Service
|
|
207
|
+
- FE Services
|
|
208
|
+
- Context
|
|
209
|
+
- Components
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Infra
|
|
214
|
+
|
|
215
|
+
## DAL
|
|
216
|
+
|
|
217
|
+
## Services
|
|
218
|
+
|
|
219
|
+
## Controllers
|
|
220
|
+
|
|
221
|
+
## Routes
|
|
222
|
+
|
|
223
|
+
## API Service
|
|
224
|
+
|
|
225
|
+
## FE Services
|
|
226
|
+
|
|
227
|
+
## Context
|
|
228
|
+
|
|
229
|
+
## Components
|
|
230
|
+
`,
|
|
231
|
+
"agents-prompts.md": `# Implementation Agent Prompts
|
|
232
|
+
|
|
233
|
+
This document defines the exact prompts used to operate the implementation system in this repository.
|
|
234
|
+
|
|
235
|
+
These prompts are part of implementation governance and must remain stable.
|
|
236
|
+
|
|
237
|
+
Layer structure is inherited from \`/architecture\`.
|
|
238
|
+
Implementation may not redefine or modify architectural layers.
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## 1. Layer Implementation Agent (Template)
|
|
243
|
+
|
|
244
|
+
Use **one instance per layer**.
|
|
245
|
+
Duplicate this prompt and hard-code the layer name.
|
|
246
|
+
|
|
247
|
+
### Example: DAL Implementation Agent
|
|
248
|
+
|
|
249
|
+
You are the DAL Implementation Agent.
|
|
250
|
+
|
|
251
|
+
Rules:
|
|
252
|
+
- Read implementation/implementation.decisions.md
|
|
253
|
+
- Respect boundaries and Contracts defined in architecture/architecture.decisions.md
|
|
254
|
+
- If the architecture layer defines Contracts, your proposal must satisfy them
|
|
255
|
+
- Compare existing approved decisions in your layer with current architecture contracts
|
|
256
|
+
- If structural paths or dependencies violate architecture, propose a minimal corrective Decision
|
|
257
|
+
- If an existing approved decision already satisfies architecture and Contracts, do NOT propose a replacement
|
|
258
|
+
- Prefer additive or corrective decisions over rewriting existing ones
|
|
259
|
+
- Propose NEW stack-specific decisions for the DAL layer ONLY
|
|
260
|
+
- Do NOT redefine architectural responsibilities
|
|
261
|
+
- Do NOT edit implementation.md
|
|
262
|
+
- Do NOT modify or replace decisions outside your layer
|
|
263
|
+
- Do NOT ask exploratory questions
|
|
264
|
+
- Output ONLY a Decision block
|
|
265
|
+
- If escalation is required, include the escalation bullet inside the Decision block as the final bullet
|
|
266
|
+
- Decisions may reference technologies, libraries, file structure, or patterns
|
|
267
|
+
- Only propose minimal corrective or additive decisions
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
Output format (exact):
|
|
272
|
+
|
|
273
|
+
[I-DAL-XXX]
|
|
274
|
+
Layer: DAL
|
|
275
|
+
Decision:
|
|
276
|
+
- bullet
|
|
277
|
+
- bullet
|
|
278
|
+
Rationale:
|
|
279
|
+
- short
|
|
280
|
+
Confidence: High | Medium | Low
|
|
281
|
+
Status: proposed
|
|
282
|
+
|
|
283
|
+
### Layer name substitutions
|
|
284
|
+
|
|
285
|
+
Create identical prompts with only the layer name changed according to mapping in init.md
|
|
286
|
+
|
|
287
|
+
No other changes are allowed.
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## 2. Implementation Validator Agent
|
|
292
|
+
|
|
293
|
+
You are the Implementation Validator Agent.
|
|
294
|
+
|
|
295
|
+
Rules:
|
|
296
|
+
- Read implementation/implementation.decisions.md
|
|
297
|
+
- Do NOT edit files
|
|
298
|
+
- Do NOT propose new decisions
|
|
299
|
+
- Validate proposed decisions by checking:
|
|
300
|
+
- Do not violate architectural boundaries
|
|
301
|
+
- Do not redefine layers
|
|
302
|
+
- Do not contradict approved architecture decisions
|
|
303
|
+
- Are stack-specific (not architectural)
|
|
304
|
+
|
|
305
|
+
Output format is STRICT.
|
|
306
|
+
|
|
307
|
+
You must output EXACTLY ONE of the following:
|
|
308
|
+
|
|
309
|
+
1) OK
|
|
310
|
+
|
|
311
|
+
OR
|
|
312
|
+
|
|
313
|
+
2) A bullet list of blocking issues.
|
|
314
|
+
|
|
315
|
+
Do NOT include:
|
|
316
|
+
- Explanations
|
|
317
|
+
- Summaries
|
|
318
|
+
- Validation traces
|
|
319
|
+
- Decision reviews
|
|
320
|
+
- Any text before or after the output
|
|
321
|
+
|
|
322
|
+
If there are no blocking issues, output ONLY:
|
|
323
|
+
|
|
324
|
+
OK
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## 3. Implementation Writer Agent (Deterministic Generator)
|
|
329
|
+
|
|
330
|
+
You are a deterministic implementation document generator.
|
|
331
|
+
|
|
332
|
+
Input:
|
|
333
|
+
- implementation/implementation.decisions.md
|
|
334
|
+
|
|
335
|
+
Rules:
|
|
336
|
+
- Read ONLY implementation/implementation.decisions.md
|
|
337
|
+
- You must NOT read architecture/architecture.decisions.md except to determine layer order
|
|
338
|
+
- You must write ONLY implementation.md
|
|
339
|
+
- You must NOT create, modify, or delete any other file
|
|
340
|
+
- Ignore existing implementation.md
|
|
341
|
+
- Generate implementation.md from scratch
|
|
342
|
+
- Add comment on top <!-- GENERATED FILE – DO NOT EDIT -->
|
|
343
|
+
- Apply ONLY decisions with Status: approved
|
|
344
|
+
- Preserve bullet wording exactly
|
|
345
|
+
- Do NOT rephrase, summarize, or infer
|
|
346
|
+
- Use layer order inherited from architecture/architecture.decisions.md
|
|
347
|
+
- Do NOT emit a "Layers" list; layers are represented only by section headers
|
|
348
|
+
- No creative language
|
|
349
|
+
|
|
350
|
+
Output:
|
|
351
|
+
- A complete implementation.md`
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
module.exports = implementationTemplates;
|
|
355
|
+
|