inplan 0.1.14 → 0.1.16
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/app/main/index.js
CHANGED
|
@@ -515,6 +515,8 @@ class Session {
|
|
|
515
515
|
complete(content) {
|
|
516
516
|
writeFileSync$1(this.paths.file, content);
|
|
517
517
|
writeFileSync$1(this.paths.canonicalPath, content);
|
|
518
|
+
this.pendingDirty = false;
|
|
519
|
+
this.pendingContent = content;
|
|
518
520
|
}
|
|
519
521
|
/** The parked Review-mode proposal, if one is pending (the file exists ⇔ undecided). */
|
|
520
522
|
pendingProposal() {
|
|
@@ -967,12 +969,31 @@ async function readProfile() {
|
|
|
967
969
|
async function collaborateOnCloud() {
|
|
968
970
|
if (!session) return;
|
|
969
971
|
if (session.hasUnsaved) session.complete(session.pending);
|
|
970
|
-
const
|
|
972
|
+
const file = session.paths.file;
|
|
973
|
+
let r = await runCli(["upload", file]);
|
|
971
974
|
let out = {};
|
|
972
975
|
try {
|
|
973
976
|
out = JSON.parse(r.stdout.trim() || "{}");
|
|
974
977
|
} catch {
|
|
975
978
|
}
|
|
979
|
+
if (out.status === "limit") {
|
|
980
|
+
const lruTitle = out.lru?.title?.trim() || "your least-recently-used document";
|
|
981
|
+
const choice = dialog.showMessageBoxSync(win, {
|
|
982
|
+
type: "question",
|
|
983
|
+
buttons: ["Deactivate & upload", "Cancel"],
|
|
984
|
+
defaultId: 0,
|
|
985
|
+
cancelId: 1,
|
|
986
|
+
message: "Document limit reached",
|
|
987
|
+
detail: `You’re at your ${out.limit ?? ""}-document limit. Deactivate the least-recently-used “${lruTitle}” to make room?`
|
|
988
|
+
});
|
|
989
|
+
if (choice !== 0) return;
|
|
990
|
+
r = await runCli(["upload", file, "--evict-lru"]);
|
|
991
|
+
try {
|
|
992
|
+
out = JSON.parse(r.stdout.trim() || "{}");
|
|
993
|
+
} catch {
|
|
994
|
+
out = {};
|
|
995
|
+
}
|
|
996
|
+
}
|
|
976
997
|
if (out.status !== "uploaded" || !out.cloudDocId) {
|
|
977
998
|
dialog.showMessageBoxSync(win, { type: "error", message: "Couldn't move this plan to the cloud.", detail: r.stderr.trim() || "Are you signed in? Run `inplan login`." });
|
|
978
999
|
return;
|
|
@@ -1038,6 +1059,7 @@ async function refreshPluginAndView(file) {
|
|
|
1038
1059
|
else win.webContents.send("doc:navigated", session.load());
|
|
1039
1060
|
}
|
|
1040
1061
|
function quitNow(reason) {
|
|
1062
|
+
if (session?.hasUnsaved) session.complete(session.pending);
|
|
1041
1063
|
if (quitFallbackTimer) {
|
|
1042
1064
|
clearTimeout(quitFallbackTimer);
|
|
1043
1065
|
quitFallbackTimer = null;
|
|
@@ -1224,7 +1246,7 @@ ${body.replace(/\s*$/, "")}
|
|
|
1224
1246
|
}
|
|
1225
1247
|
});
|
|
1226
1248
|
ipcMain.handle("app:quit", (_e, content, opts) => {
|
|
1227
|
-
|
|
1249
|
+
session?.complete(content);
|
|
1228
1250
|
if (opts.startBuild && session) session.setSettings({ ...session.getSettings(), agentMode: "implementation" });
|
|
1229
1251
|
quitNow(opts.startBuild ? "completed" : "window_closed");
|
|
1230
1252
|
});
|