archspec 1.0.2 → 1.1.0
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/index.js +206 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -12,12 +12,15 @@ if (command === "init") {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
function init() {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
createFolder("implementation");
|
|
18
|
-
createFolder("execution");
|
|
15
|
+
createFolderWithFiles("architecture", architectureTemplates);
|
|
16
|
+
console.log("Architecture folder initialized.");
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
// createFolder("architecture");
|
|
19
|
+
// createFolder("governance");
|
|
20
|
+
// createFolder("implementation");
|
|
21
|
+
// createFolder("execution");
|
|
22
|
+
|
|
23
|
+
// console.log("Governance structure initialized.");
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
function createFolder(name) {
|
|
@@ -30,3 +33,201 @@ function createFolder(name) {
|
|
|
30
33
|
console.log(`Folder already exists: ${name}`);
|
|
31
34
|
}
|
|
32
35
|
}
|
|
36
|
+
|
|
37
|
+
const architectureTemplates = {
|
|
38
|
+
"README.md": `# Architecture Governance
|
|
39
|
+
|
|
40
|
+
This directory defines how architecture is created and maintained.
|
|
41
|
+
|
|
42
|
+
## Source of Truth
|
|
43
|
+
- \`architecture.decisions.md\` is the ONLY source of truth.
|
|
44
|
+
- \`architecture.md\` is a GENERATED artifact and must never be edited manually.
|
|
45
|
+
|
|
46
|
+
## Core Rules
|
|
47
|
+
1. All architectural changes are expressed as Decisions.
|
|
48
|
+
2. Each Decision belongs to exactly ONE layer.
|
|
49
|
+
3. Only Decisions with \`Status: approved\` are applied.
|
|
50
|
+
4. Agents may NOT edit \`architecture.md\`.
|
|
51
|
+
5. \`architecture.md\` can be deleted and regenerated at any time.
|
|
52
|
+
|
|
53
|
+
## Layers (Fixed)
|
|
54
|
+
The system uses a bottom-up, layered architecture:
|
|
55
|
+
|
|
56
|
+
1. Infra
|
|
57
|
+
2. DAL
|
|
58
|
+
3. Services
|
|
59
|
+
4. Controllers
|
|
60
|
+
5. Routes
|
|
61
|
+
6. API Service
|
|
62
|
+
7. FE Services
|
|
63
|
+
8. Context
|
|
64
|
+
9. Components
|
|
65
|
+
|
|
66
|
+
These layers are fixed and must not be renamed or reordered.
|
|
67
|
+
|
|
68
|
+
## Workflow
|
|
69
|
+
1. Layer agent proposes a Decision (\`Status: proposed\`)
|
|
70
|
+
2. Human reviews and approves the Decision
|
|
71
|
+
3. Writer agent regenerates \`architecture.md\` from decisions
|
|
72
|
+
|
|
73
|
+
If it is not a Decision, it is not architecture.
|
|
74
|
+
|
|
75
|
+
## Operation
|
|
76
|
+
|
|
77
|
+
For daily usage and workflow, see:
|
|
78
|
+
|
|
79
|
+
- \`flow.md\` – Implementation decision lifecycle
|
|
80
|
+
- \`agent-prompts.md\` – Agent definitions
|
|
81
|
+
- \`init.md\` – Initial setup instructions
|
|
82
|
+
`,
|
|
83
|
+
|
|
84
|
+
"flow.md": `## The daily workflow (this is the loop)
|
|
85
|
+
|
|
86
|
+
### Step A – Propose
|
|
87
|
+
|
|
88
|
+
* Run a **layer agent**
|
|
89
|
+
* It appends a \`Status: proposed\` decision to \`architecture.decisions.md\`
|
|
90
|
+
|
|
91
|
+
### Step B – Validate
|
|
92
|
+
|
|
93
|
+
* Run **Architect Agent**
|
|
94
|
+
* Fix or clarify decision if blocked
|
|
95
|
+
|
|
96
|
+
### Step C – Approve (YOU)
|
|
97
|
+
|
|
98
|
+
* Change **one word**:
|
|
99
|
+
|
|
100
|
+
Status: approved
|
|
101
|
+
|
|
102
|
+
### Step D – Generate
|
|
103
|
+
|
|
104
|
+
* Run **Writer Agent**
|
|
105
|
+
* \`architecture.md\` is regenerated fully
|
|
106
|
+
|
|
107
|
+
That’s it.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Hard rules (do not break these)
|
|
112
|
+
|
|
113
|
+
* ❌ No agent edits \`architecture.md\`
|
|
114
|
+
* ❌ No decision spans multiple layers
|
|
115
|
+
* ❌ No prose inside decisions
|
|
116
|
+
* ❌ No incremental edits to architecture.md
|
|
117
|
+
* ✅ Delete + regenerate is always safe
|
|
118
|
+
|
|
119
|
+
If these rules hold → system is deterministic.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Mental model (for Cursor usage)
|
|
124
|
+
|
|
125
|
+
* \`architecture.decisions.md\` = config
|
|
126
|
+
* Writer agent = compiler
|
|
127
|
+
* \`architecture.md\` = build artifact
|
|
128
|
+
* You = approver of intent
|
|
129
|
+
* Cursor = execution environment
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
### Final checkpoint
|
|
134
|
+
|
|
135
|
+
If you can:
|
|
136
|
+
|
|
137
|
+
* delete \`architecture.md\`
|
|
138
|
+
* regenerate it
|
|
139
|
+
* get the same result
|
|
140
|
+
|
|
141
|
+
✅ You’ve set it up correctly.
|
|
142
|
+
`,
|
|
143
|
+
|
|
144
|
+
"init.md": `# Cursor Setup: Deterministic Bottom-Up Architecture
|
|
145
|
+
|
|
146
|
+
## 1. Create the files (once)
|
|
147
|
+
|
|
148
|
+
/architecture
|
|
149
|
+
├─ architecture.decisions.md ← ONLY editable truth
|
|
150
|
+
├─ architecture.md ← GENERATED, read-only
|
|
151
|
+
└─ README.md ← rules
|
|
152
|
+
|
|
153
|
+
## 2. Initialize architecture.decisions.md
|
|
154
|
+
|
|
155
|
+
Paste this exactly:
|
|
156
|
+
|
|
157
|
+
# Architecture Decisions
|
|
158
|
+
|
|
159
|
+
## Rules
|
|
160
|
+
- Decisions are the ONLY source of truth
|
|
161
|
+
- architecture.md is generated, never edited
|
|
162
|
+
- Every decision belongs to exactly ONE layer
|
|
163
|
+
- Only decisions with Status: approved are applied
|
|
164
|
+
|
|
165
|
+
## Layers (fixed)
|
|
166
|
+
- Infra
|
|
167
|
+
- DAL
|
|
168
|
+
- Services
|
|
169
|
+
- Controllers
|
|
170
|
+
- Routes
|
|
171
|
+
- API Service
|
|
172
|
+
- FE Services
|
|
173
|
+
- Context
|
|
174
|
+
- Components
|
|
175
|
+
`,
|
|
176
|
+
|
|
177
|
+
"agents-prompts.md": `# Architecture Agent Prompts
|
|
178
|
+
|
|
179
|
+
This document defines the exact prompts used to operate the architecture system in this repository.
|
|
180
|
+
|
|
181
|
+
These prompts are part of the architecture governance.
|
|
182
|
+
They must remain stable and should not be casually modified.
|
|
183
|
+
|
|
184
|
+
(Full prompt templates should be pasted here.)
|
|
185
|
+
`,
|
|
186
|
+
|
|
187
|
+
"architecture.decisions.md": `# Architecture Decisions
|
|
188
|
+
|
|
189
|
+
## Rules
|
|
190
|
+
- Decisions are the ONLY source of truth
|
|
191
|
+
- architecture.md is generated, never edited
|
|
192
|
+
- Every decision belongs to exactly ONE layer
|
|
193
|
+
- Only decisions with Status: approved are applied
|
|
194
|
+
|
|
195
|
+
## Layers (fixed)
|
|
196
|
+
- Infra
|
|
197
|
+
- DAL
|
|
198
|
+
- Services
|
|
199
|
+
- Controllers
|
|
200
|
+
- Routes
|
|
201
|
+
- API Service
|
|
202
|
+
- FE Services
|
|
203
|
+
- Context
|
|
204
|
+
- Components
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Infra
|
|
209
|
+
|
|
210
|
+
## DAL
|
|
211
|
+
|
|
212
|
+
## Services
|
|
213
|
+
|
|
214
|
+
## Controllers
|
|
215
|
+
|
|
216
|
+
## Routes
|
|
217
|
+
|
|
218
|
+
## API Service
|
|
219
|
+
|
|
220
|
+
## FE Services
|
|
221
|
+
|
|
222
|
+
## Context
|
|
223
|
+
|
|
224
|
+
## Components
|
|
225
|
+
`,
|
|
226
|
+
|
|
227
|
+
"architecture.md": `<!-- GENERATED FILE – DO NOT EDIT -->
|
|
228
|
+
|
|
229
|
+
# Architecture
|
|
230
|
+
|
|
231
|
+
This file is generated from architecture.decisions.md
|
|
232
|
+
`
|
|
233
|
+
};
|