synthesisui 0.16.469 → 0.16.470
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/commands/gaps.js +19 -3
- package/dist/commands/import.js +11 -0
- package/dist/commands/status.js +25 -6
- package/package.json +1 -1
package/dist/commands/gaps.js
CHANGED
|
@@ -28,10 +28,13 @@ export async function gaps(opts) {
|
|
|
28
28
|
let ledger;
|
|
29
29
|
/** A régua única - ver `describeValueRuler`. Ausente num censo medido antes de 0.16.308. */
|
|
30
30
|
let values;
|
|
31
|
+
/** A cobertura por componente - existe em todo estilo, inclusive os que não vestem classe. */
|
|
32
|
+
let coverage;
|
|
31
33
|
try {
|
|
32
34
|
const census = JSON.parse(raw);
|
|
33
35
|
ledger = census.ledger;
|
|
34
36
|
values = census.values?.classes ?? undefined;
|
|
37
|
+
coverage = census.coverage ?? undefined;
|
|
35
38
|
}
|
|
36
39
|
catch {
|
|
37
40
|
console.log(body(`${path} is not readable JSON.`));
|
|
@@ -47,7 +50,7 @@ export async function gaps(opts) {
|
|
|
47
50
|
return;
|
|
48
51
|
}
|
|
49
52
|
if (opts.brief)
|
|
50
|
-
return brief(ledger, values);
|
|
53
|
+
return brief(ledger, values, coverage);
|
|
51
54
|
for (const line of describeTriage(triageLedger(ledger, opts.cli), values))
|
|
52
55
|
console.log(body(line));
|
|
53
56
|
/**
|
|
@@ -111,10 +114,23 @@ export async function gaps(opts) {
|
|
|
111
114
|
* resolver o valor que carrega dois nomes dele. Um link sem consequência dita é um link que
|
|
112
115
|
* espera para sempre.
|
|
113
116
|
*/
|
|
114
|
-
async function brief(ledger, values) {
|
|
117
|
+
async function brief(ledger, values, coverage) {
|
|
115
118
|
const places = ledger.unread.length;
|
|
116
|
-
|
|
119
|
+
/**
|
|
120
|
+
* SEM A CONTA POR CLASSE, A COBERTURA POR COMPONENTE - rodadas 8 e 9, 27/09.
|
|
121
|
+
*
|
|
122
|
+
* `values` só existe quando algum componente veste classe. CSS Modules, `style={{ }}` e SCSS não
|
|
123
|
+
* vestem, e o `brief` saía com o título e mais nada. `coverage` existe nos três, e é a mesma
|
|
124
|
+
* pergunta ("quanto do que você escreveu chegou") numa unidade que eles têm.
|
|
125
|
+
*/
|
|
126
|
+
if (!values) {
|
|
127
|
+
console.log(bodyWrapped(coverage && coverage.components > 0
|
|
128
|
+
? `We read ${paint.blue(paint.strong(`${coverage.read} of your ${coverage.components} components`))} - ${coverage.declarations} style ${coverage.declarations === 1 ? "declaration" : "declarations"} between them.`
|
|
129
|
+
: "This measurement carries no coverage number, so there is none to show rather than a zero.").join("\n"));
|
|
130
|
+
if (places > 0)
|
|
131
|
+
console.log(bodyWrapped(paint.dim(`What we did not read sits in ${places} ${places === 1 ? "place" : "places"} - \`synthesisui gaps\` lists each one with the file and the line.`)).join("\n"));
|
|
117
132
|
return;
|
|
133
|
+
}
|
|
118
134
|
const decisions = values.seen - values.structure;
|
|
119
135
|
const closed = values.interpreted + values.answered;
|
|
120
136
|
const pct = decisions > 0 ? Math.round((closed / decisions) * 100) : 0;
|
package/dist/commands/import.js
CHANGED
|
@@ -4990,6 +4990,8 @@ export async function runImport(opts) {
|
|
|
4990
4990
|
await writeFile(out, `${JSON.stringify(census, null, 2)}\n`, "utf8");
|
|
4991
4991
|
const token = await readToken();
|
|
4992
4992
|
if (!token) {
|
|
4993
|
+
/** A medição está salva, e o sistema não existe: quem chamou não pode ler "enviado". */
|
|
4994
|
+
process.exitCode = 1;
|
|
4993
4995
|
console.log("");
|
|
4994
4996
|
console.log(body("To turn this into a system on your account:"));
|
|
4995
4997
|
console.log(body(` ${paint.strong("synthesisui login")}`));
|
|
@@ -5002,6 +5004,7 @@ export async function runImport(opts) {
|
|
|
5002
5004
|
// a 401 that describes the wrong problem entirely.
|
|
5003
5005
|
const creds = await readCredentials();
|
|
5004
5006
|
if (creds && !sameRegistry(creds.registry, base)) {
|
|
5007
|
+
process.exitCode = 1;
|
|
5005
5008
|
console.log("");
|
|
5006
5009
|
console.log(body(`You are logged in to ${paint.strong(creds.registry ?? "another registry")}, and this would go to ${paint.strong(base)}.`));
|
|
5007
5010
|
console.log(body(`Your measurement is saved at ${out}. Either name the one you meant:`));
|
|
@@ -5055,6 +5058,14 @@ export async function runImport(opts) {
|
|
|
5055
5058
|
}),
|
|
5056
5059
|
}).catch(() => null);
|
|
5057
5060
|
if (!res || !res.ok) {
|
|
5061
|
+
/**
|
|
5062
|
+
* NADA FOI CRIADO, e o código de saída tem que dizer isso - rodadas 6 a 10, 27/09.
|
|
5063
|
+
*
|
|
5064
|
+
* Os quatro ramos abaixo (sessão vencida, limite do plano, recusa, rede) terminavam em `return`
|
|
5065
|
+
* e o processo saía com 0. Um agente que confia no código de saída lia "enviado". Fica aqui, uma
|
|
5066
|
+
* vez, antes dos ramos, para que um ramo novo não nasça esquecendo.
|
|
5067
|
+
*/
|
|
5068
|
+
process.exitCode = 1;
|
|
5058
5069
|
const refusal = res
|
|
5059
5070
|
? await res
|
|
5060
5071
|
.json()
|
package/dist/commands/status.js
CHANGED
|
@@ -51,6 +51,30 @@ export async function status(opts) {
|
|
|
51
51
|
// sem _synthesisui: tratado abaixo
|
|
52
52
|
}
|
|
53
53
|
console.log(section("Status"));
|
|
54
|
+
/**
|
|
55
|
+
* A CONTA, ANTES DE TUDO - rodadas 6 a 10, 27/09. Este comando só falava dela quando NÃO havia
|
|
56
|
+
* login, e o agente ia ler `~/.synthesisui/credentials.json` para saber em qual conta estava. O
|
|
57
|
+
* arquivo não guarda conta nenhuma: quem sabe é o servidor, pelo mesmo bearer. O token não aparece.
|
|
58
|
+
*/
|
|
59
|
+
const token = await readToken();
|
|
60
|
+
const base = resolveRegistry(opts.registry);
|
|
61
|
+
if (!token) {
|
|
62
|
+
console.log(body(paint.dim("Not logged in, so this is the local half. `synthesisui login` adds what the platform knows.")));
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
const who = await fetch(`${base}/api/auth/get-session`, {
|
|
66
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
67
|
+
})
|
|
68
|
+
.then(async (r) => r.ok ? (await r.json()) : null)
|
|
69
|
+
.then((j) => ({ reached: true, email: j?.user?.email ?? null }))
|
|
70
|
+
.catch(() => ({ reached: false, email: null }));
|
|
71
|
+
console.log(body(who.email
|
|
72
|
+
? `Logged in as ${paint.strong(who.email)} on ${base}.`
|
|
73
|
+
: who.reached
|
|
74
|
+
? `The saved login is no longer accepted by ${base}. \`synthesisui login\` signs in again.`
|
|
75
|
+
: `Logged in on ${base}, and the account could not be confirmed - the registry did not answer.`));
|
|
76
|
+
}
|
|
77
|
+
console.log("");
|
|
54
78
|
if (installed.length === 0) {
|
|
55
79
|
/**
|
|
56
80
|
* NADA INSTALADO NÃO SIGNIFICA NADA A OFERECER, e mandar `list` era o conselho da outra pessoa.
|
|
@@ -128,13 +152,8 @@ export async function status(opts) {
|
|
|
128
152
|
* A ÚNICA PERGUNTA QUE O DISCO NÃO SABE: existe medição mais nova do que a minha? Sem login isso
|
|
129
153
|
* simplesmente não é dito - e não é um erro, porque tudo acima continua verdadeiro.
|
|
130
154
|
*/
|
|
131
|
-
|
|
132
|
-
if (!token) {
|
|
133
|
-
console.log("");
|
|
134
|
-
console.log(body(paint.dim("Not logged in, so this is the local half. `synthesisui login` adds what the platform knows.")));
|
|
155
|
+
if (!token)
|
|
135
156
|
return;
|
|
136
|
-
}
|
|
137
|
-
const base = resolveRegistry(opts.registry);
|
|
138
157
|
const owned = installed.find((ds) => !ds.adopted);
|
|
139
158
|
if (!owned)
|
|
140
159
|
return;
|
package/package.json
CHANGED