inplan 0.3.4 → 0.3.5

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.
@@ -1682,7 +1682,22 @@ ${body.replace(/\s*$/, "")}
1682
1682
  return { ok: false };
1683
1683
  }
1684
1684
  });
1685
- electron.ipcMain.handle("app:restart", () => {
1685
+ electron.ipcMain.handle("app:restart", async () => {
1686
+ const file = session?.paths.file;
1687
+ if (file) {
1688
+ const r = await runCli(["launch-editor", file], void 0, 2e4);
1689
+ let launched = false;
1690
+ try {
1691
+ launched = JSON.parse(r.stdout.trim() || "{}").status === "launched";
1692
+ } catch {
1693
+ }
1694
+ if (launched) {
1695
+ electron.app.exit(0);
1696
+ return;
1697
+ }
1698
+ process.stderr.write(`[inplan] restart: launch-editor failed (${r.code}): ${r.stderr.trim() || r.stdout.trim()}
1699
+ `);
1700
+ }
1686
1701
  electron.app.relaunch();
1687
1702
  electron.app.exit(0);
1688
1703
  });
package/bin/cli.js CHANGED
@@ -2880,7 +2880,8 @@ function resolveBundledApp() {
2880
2880
  return { appMain, error: "Electron's binary isn't installed \u2014 its download was likely blocked (proxy/AV), and path.txt is missing" };
2881
2881
  }
2882
2882
  function spawnApp(file) {
2883
- const env = { ...process.env, INPLAN_CLI: process.argv[1] ?? "" };
2883
+ const { ELECTRON_RUN_AS_NODE: _runAsNode, ...inherited } = process.env;
2884
+ const env = { ...inherited, INPLAN_CLI: process.argv[1] ?? "" };
2884
2885
  const override = process.env.INPLAN_APP_CMD;
2885
2886
  if (override) {
2886
2887
  const child = spawn3(override, [file], { detached: true, stdio: "ignore", shell: true, env });
@@ -4658,6 +4659,25 @@ async function main() {
4658
4659
  doLogout();
4659
4660
  return;
4660
4661
  }
4662
+ if (cmd === "launch-editor") {
4663
+ const target = argv[1] ? resolve3(argv[1]) : "";
4664
+ if (!target || !existsSync11(target)) {
4665
+ output({ status: "launch_failed", message: `file not found: ${target || "(none)"}` });
4666
+ process.exitCode = 1;
4667
+ return;
4668
+ }
4669
+ const pid = spawnApp(target);
4670
+ if (pid === null) {
4671
+ output({ status: "launch_failed", message: "the editor could not be started" });
4672
+ process.exitCode = 1;
4673
+ return;
4674
+ }
4675
+ const p = docPaths(target);
4676
+ mkdirSync10(p.controlDir, { recursive: true });
4677
+ await new FsControlChannel(p).append({ actor: "agent", type: LogEventType.EditorPid, payload: { pid, v: CONTROL_LOG_VERSION } });
4678
+ output({ status: "launched", pid });
4679
+ return;
4680
+ }
4661
4681
  if (cmd === "update") {
4662
4682
  const updArgs = argv.slice(1);
4663
4683
  const pkg = getFlag(updArgs, "pkg") ?? UPDATE_PKG;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inplan",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "inplan — a Markdown editor for human ⇄ coding-agent planning. CLI + desktop editor.",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "repository": {