synthesisui 0.16.28 → 0.16.29
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/sync.js +33 -1
- package/package.json +1 -1
package/dist/commands/sync.js
CHANGED
|
@@ -2,8 +2,27 @@ import { readdir, readFile } from "node:fs/promises";
|
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
import { readToken, resolveRegistry } from "../config.js";
|
|
4
4
|
import { readEvents } from "../doctor/ledger.js";
|
|
5
|
-
import { readRequests } from "../doctor/requests.js";
|
|
5
|
+
import { closeRequest, readRequests } from "../doctor/requests.js";
|
|
6
6
|
import { body, section } from "../output.js";
|
|
7
|
+
/**
|
|
8
|
+
* What each decision means ON THIS MACHINE - the card decides, the sync
|
|
9
|
+
* enacts. The web never touches the local file; this line is printed right
|
|
10
|
+
* after `closeRequest` runs here, so the person knows what happened and what
|
|
11
|
+
* (if anything) is theirs to do next.
|
|
12
|
+
*/
|
|
13
|
+
export function decisionLine(d, slug) {
|
|
14
|
+
const note = d.note ? ` - "${d.note}"` : "";
|
|
15
|
+
switch (d.status) {
|
|
16
|
+
case "authored":
|
|
17
|
+
return ` ✓ ${d.id} authored on the platform${note}. Get it: npx synthesisui@latest upgrade ${slug}`;
|
|
18
|
+
case "declined":
|
|
19
|
+
return ` ✕ ${d.id} declined${note}. The boundary stands - the system stays without it.`;
|
|
20
|
+
case "platform":
|
|
21
|
+
return ` → ${d.id} routed to the synthesisui team${note}. It is their queue now.`;
|
|
22
|
+
default:
|
|
23
|
+
return ` · ${d.id} answered${note}.`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
7
26
|
/**
|
|
8
27
|
* `synthesisui sync` - the ledger travels, because a person said so.
|
|
9
28
|
*
|
|
@@ -92,6 +111,19 @@ export async function sync(opts) {
|
|
|
92
111
|
const out = (await res.json());
|
|
93
112
|
console.log(section("Sync"));
|
|
94
113
|
console.log(body(`${out.eventsReceived} checks sent, ${out.eventsNew} new. ${out.requestsNow} open request${out.requestsNow === 1 ? "" : "s"}.`));
|
|
114
|
+
// Decisions travel BACK: the owner answered on the card, and this - the
|
|
115
|
+
// person's own sync, on their machine - is what closes the local file.
|
|
116
|
+
// Nobody hunts an id: deciding on the card and running sync is the whole
|
|
117
|
+
// gesture.
|
|
118
|
+
const decisions = out.decisions ?? [];
|
|
119
|
+
if (decisions.length > 0) {
|
|
120
|
+
console.log("");
|
|
121
|
+
console.log(body("Answered on the platform, closed here:"));
|
|
122
|
+
for (const d of decisions) {
|
|
123
|
+
await closeRequest(root, d.id);
|
|
124
|
+
console.log(body(decisionLine(d, slug)));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
95
127
|
console.log("");
|
|
96
128
|
console.log(body(`The record lives on your system's overview:`));
|
|
97
129
|
console.log(body(` ${base}/dashboard/mine/${slug}`));
|
package/package.json
CHANGED