synthesisui 0.16.259 → 0.16.260
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/dist/doctor/architecture.js +44 -5
- package/package.json +1 -1
|
@@ -115,6 +115,38 @@ export function architectureRule(a) {
|
|
|
115
115
|
evidence: `${a.evidence.join("/")} under ${a.root}, holding ${a.files} component file${a.files === 1 ? "" : "s"}`,
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* A ESTRUTURA, ESCRITA - as pastas que a forma tem, na ordem em que ela as usa.
|
|
120
|
+
*
|
|
121
|
+
* Uma opção que diz só o nome da forma e um número não é uma escolha de
|
|
122
|
+
* organização: "escada atômica, 6 arquivos" não diz a ninguém o que ele está
|
|
123
|
+
* escolhendo. O dono leu duas opções assim e a pergunta ficou ilegível (19/08).
|
|
124
|
+
* Então cada opção mostra a árvore, e ela é medida - `evidence` são os diretórios
|
|
125
|
+
* que fizeram a leitura.
|
|
126
|
+
*/
|
|
127
|
+
export function describeShape(a) {
|
|
128
|
+
return `${a.root}/${a.evidence.length > 0 ? `{${a.evidence.join(", ")}}` : ""}`;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* QUAIS FORMAS SÃO OPÇÃO, E QUAIS SÃO NOTA DE PÉ - decidido pela escala.
|
|
132
|
+
*
|
|
133
|
+
* Duas formas só são uma escolha quando as duas governam código de verdade. No
|
|
134
|
+
* monorepo do dono a segunda tinha 6 arquivos contra 780 da primeira - duas ordens
|
|
135
|
+
* de magnitude -, e oferecê-las lado a lado transformou um fato ("existe um canto
|
|
136
|
+
* organizado assim") numa pergunta que sugere que as duas disputam o repositório.
|
|
137
|
+
*
|
|
138
|
+
* O corte é um DÉCIMO da dominante: abaixo dele a forma continua verdadeira e é
|
|
139
|
+
* dita, mas não pede decisão. Um décimo e não um número redondo qualquer porque é
|
|
140
|
+
* a fronteira entre "convive" e "um canto".
|
|
141
|
+
*/
|
|
142
|
+
export const MINOR_SHARE = 0.1;
|
|
143
|
+
export function splitByWeight(found) {
|
|
144
|
+
if (found.length === 0)
|
|
145
|
+
return { options: [], notes: [] };
|
|
146
|
+
const top = found[0].files;
|
|
147
|
+
const options = found.filter((a) => a.files >= top * MINOR_SHARE);
|
|
148
|
+
return { options, notes: found.filter((a) => !options.includes(a)) };
|
|
149
|
+
}
|
|
118
150
|
/**
|
|
119
151
|
* One line naming what was found, and the choice it leaves open.
|
|
120
152
|
*
|
|
@@ -125,10 +157,17 @@ export function describeChoice(found) {
|
|
|
125
157
|
if (found.length === 0)
|
|
126
158
|
return null;
|
|
127
159
|
if (found.length === 1) {
|
|
128
|
-
return `One shape, read off your directories: ${found[0].kind}
|
|
160
|
+
return `One shape, read off your directories: ${found[0].kind} in \`${describeShape(found[0])}\`.`;
|
|
161
|
+
}
|
|
162
|
+
const { options, notes } = splitByWeight(found);
|
|
163
|
+
const say = (a) => `${a.kind} in \`${describeShape(a)}\` (${a.files} files)`;
|
|
164
|
+
/**
|
|
165
|
+
* Uma dominante e o resto em cantos: isto não é uma pergunta sobre o retrato, é
|
|
166
|
+
* uma pergunta sobre a REGRA daqui em diante - e a skill é quem a faz.
|
|
167
|
+
*/
|
|
168
|
+
if (options.length === 1) {
|
|
169
|
+
return `One shape governs this code: ${say(options[0])}. Also here, and staying true without deciding anything: ${notes.map(say).join(", ")}.`;
|
|
129
170
|
}
|
|
130
|
-
const list =
|
|
131
|
-
|
|
132
|
-
.join(", ");
|
|
133
|
-
return `${found.length} shapes, and none of them is a mistake: ${list}. A library organised atomically inside a monorepo whose apps are organised by feature is two true answers. Pick which one has PRIORITY - it becomes the rule every prompt reads, and the others stay true without deciding.`;
|
|
171
|
+
const list = options.map(say).join(", ");
|
|
172
|
+
return `${options.length} shapes govern real code, and none of them is a mistake: ${list}.${notes.length > 0 ? ` Smaller corners, reported and not asked about: ${notes.map(say).join(", ")}.` : ""} Pick which one has PRIORITY - it becomes the rule every prompt reads, and the others stay true without deciding.`;
|
|
134
173
|
}
|
package/package.json
CHANGED