@4xeoz/re-entry 0.2.2 → 0.2.3
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/package.json +1 -1
- package/src/main.mjs +8 -1
- package/src/terminal-ui.mjs +8 -0
package/package.json
CHANGED
package/src/main.mjs
CHANGED
|
@@ -248,7 +248,8 @@ async function connect(flags, ui, options = {}) {
|
|
|
248
248
|
const credentialFile = flags["credential-file"] ?? defaultCredentialFile();
|
|
249
249
|
const store = new LocalConnectorCredentialStore({ filename: credentialFile });
|
|
250
250
|
const current = await store.load();
|
|
251
|
-
|
|
251
|
+
const currentIsValid = current && Date.parse(current.connector_expires_at) > Date.now();
|
|
252
|
+
if (currentIsValid && current.receiver_origin === receiver) {
|
|
252
253
|
if (ui.interactive) {
|
|
253
254
|
ui.success("Already connected", `${current.connector_id} · ${current.receiver_origin}`);
|
|
254
255
|
ui.info("Next", "run `re-entry start` to wait for approved work");
|
|
@@ -262,6 +263,10 @@ async function connect(flags, ui, options = {}) {
|
|
|
262
263
|
return current;
|
|
263
264
|
}
|
|
264
265
|
|
|
266
|
+
if (currentIsValid && ui.interactive) {
|
|
267
|
+
ui.warning("Receiver changed", `${current.receiver_origin} → ${receiver}; approve this Mac again`);
|
|
268
|
+
}
|
|
269
|
+
|
|
265
270
|
if (ui.interactive) {
|
|
266
271
|
ui.step("Re-entry", receiver);
|
|
267
272
|
ui.step("This Mac", flags["device-name"] ?? defaultDeviceName());
|
|
@@ -390,6 +395,7 @@ async function install(flags, ui) {
|
|
|
390
395
|
ui.info("Setup", "choose a workspace, approve this Mac, then leave the Connector running");
|
|
391
396
|
}
|
|
392
397
|
const runtimeFlags = await withWorkspaceDirectory(flags, ui);
|
|
398
|
+
if (ui.interactive) ui.info("Receiver", runtimeFlags.receiver ?? DEFAULT_RECEIVER_ORIGIN);
|
|
393
399
|
const readiness = inspectReadiness(runtimeFlags);
|
|
394
400
|
showReadiness(readiness, ui);
|
|
395
401
|
const credentials = await connect(runtimeFlags, ui, { quietHeader: true });
|
|
@@ -404,6 +410,7 @@ async function install(flags, ui) {
|
|
|
404
410
|
ui.stopWait("Installed", "Re-entry will start automatically when you log in");
|
|
405
411
|
ui.success("Account", credentials.connector_id);
|
|
406
412
|
ui.info("Logs", service.stdoutPath);
|
|
413
|
+
ui.info("Commands", "status to inspect · stop to pause · uninstall to remove local setup");
|
|
407
414
|
ui.info("You are done", "the Connector now waits in the background");
|
|
408
415
|
} else {
|
|
409
416
|
process.stdout.write(`${JSON.stringify({
|
package/src/terminal-ui.mjs
CHANGED
|
@@ -15,6 +15,12 @@ const REENTRY_ASCII = [
|
|
|
15
15
|
" | _ <| |__|_____| | |___| |\\ | |___| _ < | |",
|
|
16
16
|
" |_| \\_\\_____| |_____|_| \\_|_____|_| \\_\\ |_|",
|
|
17
17
|
];
|
|
18
|
+
const REENTRY_PANEL = [
|
|
19
|
+
" +-----------------------------------------------+",
|
|
20
|
+
" | RE-ENTRY |",
|
|
21
|
+
" | LOCAL CONNECTOR |",
|
|
22
|
+
" +-----------------------------------------------+",
|
|
23
|
+
];
|
|
18
24
|
|
|
19
25
|
/**
|
|
20
26
|
* Small dependency-free terminal presentation for the Local Connector CLI.
|
|
@@ -50,6 +56,8 @@ export function createTerminalUi(options = {}) {
|
|
|
50
56
|
write("");
|
|
51
57
|
for (const line of REENTRY_ASCII) write(style(line, BOLD));
|
|
52
58
|
write("");
|
|
59
|
+
for (const line of REENTRY_PANEL) write(style(line, BOLD));
|
|
60
|
+
write("");
|
|
53
61
|
write(` ${style("RE-ENTRY", BOLD)} ${style("LOCAL CONNECTOR", DIM)}`);
|
|
54
62
|
write(` ${style(title, BOLD)}`);
|
|
55
63
|
if (subtitle) write(` ${style(subtitle, DIM)}`);
|