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.
@@ -109,6 +109,17 @@ body {
109
109
  .ap-switch-input:checked ~ .ap-switch-track .ap-switch-thumb { transform: translateX(14px); }
110
110
  .ap-switch-input:focus-visible ~ .ap-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
111
111
  .ap-switch.disabled .ap-switch-track { cursor: default; }
112
+ /* Accept/reject variant (the per-hunk review switch + the tri-state all-control): on = green/✓
113
+ (accepted), off = red/✗ (rejected). The ✓/✗ glyphs sit on the track and show on the side
114
+ opposite the thumb (✓ left = accept side, ✗ right = reject side). */
115
+ .ap-switch--accept .ap-switch-input:not(:checked) ~ .ap-switch-track { background: var(--danger); }
116
+ .ap-sw-yes, .ap-sw-no { position: absolute; top: 0; height: 100%; display: flex; align-items: center; font-size: 10px; line-height: 1; color: #fbfaf6; pointer-events: none; transition: opacity 0.15s ease; }
117
+ .ap-sw-yes { left: 5px; }
118
+ .ap-sw-no { right: 5px; }
119
+ .ap-switch--accept .ap-sw-yes { opacity: 0; }
120
+ .ap-switch--accept .ap-sw-no { opacity: 1; }
121
+ .ap-switch--accept .ap-switch-input:checked ~ .ap-switch-track .ap-sw-yes { opacity: 1; }
122
+ .ap-switch--accept .ap-switch-input:checked ~ .ap-switch-track .ap-sw-no { opacity: 0; }
112
123
  .ap-profile-edit { gap: 6px; padding: 8px 10px 4px; }
113
124
  .ap-profile-input { font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--bg); color: var(--fg); }
114
125
  .ap-profile-input:focus { outline: none; border-color: var(--accent); }
@@ -123,7 +134,9 @@ body {
123
134
  .ap-agent-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
124
135
  .ap-agent-local { background: #2bb673; } /* agent on your machine */
125
136
  .ap-agent-off { background: var(--danger); } /* no agent connected */
126
- .ap-agent-pie { width: 13px; height: 13px; border-radius: 50%; flex: 0 0 auto; }
137
+ .ap-agent-pie { position: relative; width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto; }
138
+ /* Green "connected" core; only the thin outer band of .ap-agent-pie shows the usage conic. */
139
+ .ap-agent-pie-core { position: absolute; inset: 16%; border-radius: 50%; background: var(--accent); }
127
140
  /* Anchor to the trigger's RIGHT edge (it sits on the right of the topbar) so the 220px menu opens
128
141
  leftward and stays on-screen — left:0 made it overflow off the right of the viewport, clipping the
129
142
  item labels. Mirrors .ap-profile-menu. */
@@ -180,6 +193,8 @@ body {
180
193
  /* banner */
181
194
  .ap-banner { background: var(--accent-soft); border-bottom: 1px solid var(--line); padding: 9px 14px; display: flex; gap: 10px; align-items: center; }
182
195
  .ap-banner-reload { background: #f6ecdd; }
196
+ /* Archived/read-only doc notice — muted amber, no action (view + download only). */
197
+ .ap-banner--readonly { background: #f6ecdd; color: var(--amber); font-size: 13px; }
183
198
 
184
199
  /* main layout */
185
200
  .ap-main { flex: 1; display: flex; min-height: 0; position: relative; }
@@ -242,6 +257,16 @@ body {
242
257
  .ap-muted { color: var(--muted); }
243
258
  .ap-row { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
244
259
 
260
+ /* Composer audience switch: conversation (talk to the agent) ⇄ memo (the agent ignores it). A small
261
+ two-icon pill; the active side is filled with the accent, the other is muted. Margin-right pushes
262
+ the Comment/cancel buttons to the right. */
263
+ .ap-agent-toggle { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface, #fff); margin-right: auto; }
264
+ .ap-agent-opt { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 22px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--ink-faint, #a8a08c); cursor: pointer; transition: background 0.12s ease, color 0.12s ease; }
265
+ .ap-agent-opt svg { width: 14px; height: 14px; }
266
+ .ap-agent-opt:hover:not(:disabled):not(.active) { color: var(--accent); background: var(--accent-soft); }
267
+ .ap-agent-opt.active { background: var(--accent); color: #fbfaf6; }
268
+ .ap-agent-opt:disabled { opacity: 0.5; cursor: default; }
269
+
245
270
  textarea, input[type="text"], input[type="email"], input[type="number"], select {
246
271
  font: inherit; color: var(--fg); background: var(--bg);
247
272
  border: 1px solid var(--line-strong); border-radius: 7px; padding: 7px 9px;
@@ -331,6 +356,7 @@ input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outlin
331
356
  .ap-newdoc-path input { flex: 1; }
332
357
  .ap-newdoc-actions { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 4px; }
333
358
  .ap-quit-title { font-weight: 600; font-size: 15px; margin-bottom: 12px; }
359
+ .ap-quit-body { font-size: 13px; line-height: 1.5; margin: 0 0 14px; color: var(--ink-soft, inherit); }
334
360
  .ap-quit-opts { display: flex; flex-direction: column; gap: 9px; margin-bottom: 16px; }
335
361
  .ap-quit-opt { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
336
362
  .ap-quit-actions { display: flex; justify-content: flex-end; gap: 10px; align-items: center; }
@@ -446,20 +472,23 @@ input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outlin
446
472
  .ap-hunk-edit { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line-strong); background: var(--bg); border-radius: 6px; padding: 2px; cursor: pointer; color: var(--muted); }
447
473
  .ap-hunk-edit:hover, .ap-hunk-edit.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
448
474
  .ap-hunk-edit svg { width: 13px; height: 13px; display: block; }
449
- /* Tri-state accept/reject-all switch: two end buttons + a thumb that sits L/centre/R. */
450
- .ap-tri { display: inline-flex; align-items: center; gap: 6px; }
451
- .ap-tri-end { font: inherit; font-size: 12px; border: 1px solid var(--line-strong); background: var(--bg); border-radius: 6px; padding: 3px 9px; cursor: pointer; color: var(--muted); }
452
- .ap-tri-end:disabled { opacity: 0.5; cursor: default; }
453
- .ap-tri-accept[aria-pressed="true"] { background: #2e9e5b; border-color: #2e9e5b; color: #fbfaf6; }
454
- .ap-tri-reject[aria-pressed="true"] { background: var(--danger); border-color: var(--danger); color: #fbfaf6; }
455
- .ap-tri-track { position: relative; width: 34px; height: 18px; border-radius: 999px; background: var(--line-strong); flex: 0 0 auto; }
456
- .ap-tri-thumb { position: absolute; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: left 0.15s ease; }
457
- .ap-tri--accept .ap-tri-track { background: #2e9e5b; }
458
- .ap-tri--reject .ap-tri-track { background: var(--danger); }
459
- .ap-tri--accept .ap-tri-thumb { left: 2px; }
460
- .ap-tri--mixed .ap-tri-thumb { left: 10px; }
461
- .ap-tri--reject .ap-tri-thumb { left: 18px; }
462
- .ap-tri.disabled { opacity: 0.5; }
475
+ /* Tri-state accept/reject-all toggle — a single click-to-cycle control reusing the per-hunk
476
+ switch's track/thumb/glyphs (accept = thumb-right/green/✓, reject = thumb-left/red/✗,
477
+ mixed = centre/neutral with no glyph), so it matches the per-hunk switch exactly. */
478
+ .ap-tri { display: inline-flex; align-items: center; border: none; background: none; padding: 0; margin: 0; cursor: pointer; }
479
+ .ap-tri:disabled, .ap-tri.disabled { opacity: 0.5; cursor: default; }
480
+ .ap-tri:focus-visible .ap-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
481
+ .ap-tri--accept .ap-switch-track { background: var(--accent); }
482
+ .ap-tri--reject .ap-switch-track { background: var(--danger); }
483
+ .ap-tri--mixed .ap-switch-track { background: var(--line-strong); }
484
+ .ap-tri--accept .ap-switch-thumb { transform: translateX(14px); }
485
+ .ap-tri--reject .ap-switch-thumb { transform: translateX(0); }
486
+ .ap-tri--mixed .ap-switch-thumb { transform: translateX(7px); }
487
+ .ap-tri--accept .ap-sw-yes { opacity: 1; }
488
+ .ap-tri--accept .ap-sw-no { opacity: 0; }
489
+ .ap-tri--reject .ap-sw-yes { opacity: 0; }
490
+ .ap-tri--reject .ap-sw-no { opacity: 1; }
491
+ .ap-tri--mixed .ap-sw-yes, .ap-tri--mixed .ap-sw-no { opacity: 0; }
463
492
  .ap-ihunk-del { background: #fbeae6; padding: 3px 12px; }
464
493
  .ap-ihunk-del :where(p, h1, h2, h3, h4, li, blockquote) { text-decoration: line-through; }
465
494
  .ap-ihunk-add { background: #e9f3ec; padding: 3px 12px; }
@@ -11,8 +11,8 @@
11
11
  content="default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' inplan-plugin:; connect-src 'self' inplan-plugin: ws://127.0.0.1:* ws://localhost:*; frame-src https://inplan.ai http://127.0.0.1:* http://localhost:*"
12
12
  />
13
13
  <title>inplan</title>
14
- <script type="module" crossorigin src="./assets/index-B5mCdcn1.js"></script>
15
- <link rel="stylesheet" crossorigin href="./assets/index-Hw2I1zYD.css">
14
+ <script type="module" crossorigin src="./assets/index-BDWDaguV.js"></script>
15
+ <link rel="stylesheet" crossorigin href="./assets/index-Ch7xZBdu.css">
16
16
  </head>
17
17
  <body>
18
18
  <div id="root"></div>
package/bin/cli.js CHANGED
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/cli.ts
4
- import { spawn as spawn2 } from "child_process";
4
+ import { spawn as spawn3 } from "child_process";
5
5
  import { createHash as createHash4 } from "crypto";
6
6
  import { createRequire } from "module";
7
7
  import { appendFileSync as appendFileSync2, copyFileSync, existsSync as existsSync9, mkdirSync as mkdirSync8, readdirSync as readdirSync2, readFileSync as readFileSync9, realpathSync, renameSync, statSync as statSync2, writeFileSync as writeFileSync8 } from "fs";
8
8
  import { homedir as homedir6 } from "os";
9
9
  import { basename as basename3, dirname as dirname9, isAbsolute as isAbsolute2, join as join9, relative as relative4, resolve as resolve3 } from "path";
10
- import { fileURLToPath as fileURLToPath2 } from "url";
10
+ import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "url";
11
11
 
12
- // ../core/dist/chunk-RMG4JQWQ.js
12
+ // ../core/dist/chunk-2A42CIA7.js
13
13
  function isReply(c) {
14
14
  return c.parentId !== void 0;
15
15
  }
@@ -859,6 +859,103 @@ async function remoteBackend(docId, consumerId = "cli-agent") {
859
859
  };
860
860
  }
861
861
 
862
+ // src/cliLogin.ts
863
+ import { createServer } from "http";
864
+ import { spawn } from "child_process";
865
+ import { randomBytes } from "crypto";
866
+ var DEFAULT_WEB_ORIGIN = process.env.INPLAN_WEB_URL || "https://inplan.ai";
867
+ var DEFAULT_TIMEOUT_MS = 3 * 6e4;
868
+ var MAX_BODY_BYTES = 64 * 1024;
869
+ function openInBrowser(url) {
870
+ const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
871
+ const args = process.platform === "win32" ? ["/c", "start", "", url] : [url];
872
+ try {
873
+ const child = spawn(cmd, args, { detached: true, stdio: "ignore" });
874
+ child.on("error", () => {
875
+ });
876
+ child.unref();
877
+ } catch {
878
+ }
879
+ }
880
+ function isHandoff(v) {
881
+ if (typeof v !== "object" || v === null) return false;
882
+ const o = v;
883
+ return typeof o.state === "string" && typeof o.url === "string" && typeof o.anon === "string" && typeof o.refresh === "string" && (o.email === void 0 || typeof o.email === "string");
884
+ }
885
+ function browserLogin(opts = {}) {
886
+ const webOrigin = (opts.webOrigin ?? DEFAULT_WEB_ORIGIN).replace(/\/$/, "");
887
+ const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
888
+ const open = opts.open ?? openInBrowser;
889
+ const state = randomBytes(16).toString("hex");
890
+ return new Promise((resolve4, reject) => {
891
+ let settled = false;
892
+ const finish = (fn) => {
893
+ if (settled) return;
894
+ settled = true;
895
+ clearTimeout(timer);
896
+ server.close();
897
+ fn();
898
+ };
899
+ const cors = (req, res) => {
900
+ res.setHeader("Access-Control-Allow-Origin", req.headers.origin || webOrigin);
901
+ res.setHeader("Vary", "Origin");
902
+ res.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
903
+ res.setHeader("Access-Control-Allow-Headers", "content-type");
904
+ };
905
+ const server = createServer((req, res) => {
906
+ const url = req.url ?? "";
907
+ if (req.method === "OPTIONS" && url.startsWith("/cb")) {
908
+ cors(req, res);
909
+ res.writeHead(204).end();
910
+ return;
911
+ }
912
+ if (req.method !== "POST" || !url.startsWith("/cb")) {
913
+ res.writeHead(404).end();
914
+ return;
915
+ }
916
+ cors(req, res);
917
+ let body = "";
918
+ let tooBig = false;
919
+ req.on("data", (chunk) => {
920
+ body += chunk.toString("utf8");
921
+ if (body.length > MAX_BODY_BYTES) {
922
+ tooBig = true;
923
+ req.destroy();
924
+ }
925
+ });
926
+ req.on("end", () => {
927
+ if (tooBig) {
928
+ res.writeHead(413).end();
929
+ return;
930
+ }
931
+ let parsed;
932
+ try {
933
+ parsed = JSON.parse(body);
934
+ } catch {
935
+ res.writeHead(400).end();
936
+ return;
937
+ }
938
+ if (!isHandoff(parsed) || parsed.state !== state) {
939
+ res.writeHead(403).end();
940
+ return;
941
+ }
942
+ res.writeHead(200, { "content-type": "text/plain" }).end("inplan: signed in \u2014 you can close this tab.");
943
+ const { url: projUrl, anon, refresh, email } = parsed;
944
+ finish(() => resolve4({ url: projUrl, anonKey: anon, refreshToken: refresh, ...email ? { email } : {} }));
945
+ });
946
+ });
947
+ server.on("error", (err) => finish(() => reject(err)));
948
+ const timer = setTimeout(() => finish(() => reject(new Error("login timed out \u2014 no response from the browser"))), timeoutMs);
949
+ if (typeof timer.unref === "function") timer.unref();
950
+ server.listen(0, "127.0.0.1", () => {
951
+ const { port } = server.address();
952
+ const target = `${webOrigin}/cli-auth?port=${port}&state=${state}`;
953
+ opts.onUrl?.(target);
954
+ open(target);
955
+ });
956
+ });
957
+ }
958
+
862
959
  // src/cliProfile.ts
863
960
  import { existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as readFileSync7, writeFileSync as writeFileSync6 } from "fs";
864
961
  import { homedir as homedir4 } from "os";
@@ -920,7 +1017,7 @@ async function resolveIdentity(file) {
920
1017
  }
921
1018
 
922
1019
  // src/update.ts
923
- import { spawn } from "child_process";
1020
+ import { spawn as spawn2 } from "child_process";
924
1021
  var UPDATE_PKG = process.env.INPLAN_PKG || "inplan";
925
1022
  function compareVersions(a, b) {
926
1023
  const parts = (v) => v.split("-")[0].split(".").map((n) => Number.parseInt(n, 10) || 0);
@@ -948,7 +1045,7 @@ async function checkForUpdate(opts) {
948
1045
  }
949
1046
  function selfUpdate(pkg) {
950
1047
  return new Promise((resolve4) => {
951
- const child = spawn("npm", ["install", "-g", `${pkg}@latest`], { stdio: ["ignore", "pipe", "pipe"] });
1048
+ const child = spawn2("npm", ["install", "-g", `${pkg}@latest`], { stdio: ["ignore", "pipe", "pipe"] });
952
1049
  let output2 = "";
953
1050
  child.stdout?.on("data", (d) => output2 += d);
954
1051
  child.stderr?.on("data", (d) => output2 += d);
@@ -1278,13 +1375,13 @@ function spawnApp(file) {
1278
1375
  const env = { ...process.env, INPLAN_CLI: process.argv[1] ?? "" };
1279
1376
  const override = process.env.INPLAN_APP_CMD;
1280
1377
  if (override) {
1281
- const child = spawn2(override, [file], { detached: true, stdio: "ignore", shell: true, env });
1378
+ const child = spawn3(override, [file], { detached: true, stdio: "ignore", shell: true, env });
1282
1379
  child.unref();
1283
1380
  return child.pid ?? null;
1284
1381
  }
1285
1382
  const bundled = resolveBundledApp();
1286
1383
  if ("electron" in bundled) {
1287
- const child = spawn2(bundled.electron, [bundled.appMain, file], { detached: true, stdio: "ignore", env });
1384
+ const child = spawn3(bundled.electron, [bundled.appMain, file], { detached: true, stdio: "ignore", env });
1288
1385
  child.unref();
1289
1386
  return child.pid ?? null;
1290
1387
  }
@@ -1449,14 +1546,26 @@ async function doLogin(args) {
1449
1546
  const url = getFlag(args, "url") ?? process.env.INPLAN_SUPABASE_URL;
1450
1547
  const anonKey = getFlag(args, "anon") ?? process.env.INPLAN_SUPABASE_ANON_KEY;
1451
1548
  const refreshToken = getFlag(args, "refresh") ?? process.env.INPLAN_REFRESH_TOKEN;
1452
- if (!url || !anonKey || !refreshToken) {
1453
- process.stderr.write("usage: inplan login --url <url> --anon <anon-key> --refresh <refresh-token> [--email <e>]\n");
1454
- process.exit(64);
1455
- }
1456
1549
  const email = getFlag(args, "email");
1457
- saveAuth({ url, anonKey, refreshToken, ...email ? { email } : {} });
1458
- await persistCloudIdentity();
1459
- output({ status: "logged_in", url, ...email ? { email } : {} });
1550
+ if (url && anonKey && refreshToken) {
1551
+ saveAuth({ url, anonKey, refreshToken, ...email ? { email } : {} });
1552
+ await persistCloudIdentity();
1553
+ output({ status: "logged_in", url, ...email ? { email } : {} });
1554
+ return;
1555
+ }
1556
+ try {
1557
+ const auth = await browserLogin({ onUrl: (u) => process.stderr.write(`Opening your browser to sign in:
1558
+ ${u}
1559
+ If it didn't open, paste that URL into your browser.
1560
+ `) });
1561
+ saveAuth(auth);
1562
+ await persistCloudIdentity();
1563
+ output({ status: "logged_in", url: auth.url, ...auth.email ? { email: auth.email } : {} });
1564
+ } catch (e) {
1565
+ process.stderr.write(`inplan login: ${e instanceof Error ? e.message : String(e)}
1566
+ `);
1567
+ process.exit(1);
1568
+ }
1460
1569
  }
1461
1570
  async function persistCloudIdentity() {
1462
1571
  try {
@@ -2007,13 +2116,40 @@ async function doUpload(file, args) {
2007
2116
  const repo = getFlag(args, "repo") ?? prov.repo;
2008
2117
  const path = getFlag(args, "path") ?? prov.path;
2009
2118
  const title = firstHeading(body) ?? basename3(path);
2010
- const { data: doc, error: de } = await s.db.from("documents").insert({ org_id: pick.org_id, owner_id: s.session.user.id, title, repo, path, body }).select("id").single();
2011
- if (de || !doc) {
2119
+ const { data: res, error: de } = await s.db.rpc("create_document", {
2120
+ p_org: pick.org_id,
2121
+ p_repo: repo,
2122
+ p_path: path,
2123
+ p_title: title,
2124
+ p_body: body,
2125
+ p_draft_pending: false,
2126
+ p_evict_lru: hasFlag(args, "evict-lru")
2127
+ });
2128
+ const out0 = res;
2129
+ if (de || !out0) {
2012
2130
  process.stderr.write(`inplan upload: ${de?.message ?? "could not create the cloud document"}
2013
2131
  `);
2014
2132
  process.exit(1);
2015
2133
  }
2016
- const cloudDocId = doc.id;
2134
+ if (out0.status === "limit") {
2135
+ output({ status: "limit", limit: out0.limit ?? 0, lru: { id: out0.lru_id ?? "", title: out0.lru_title ?? "" } });
2136
+ return;
2137
+ }
2138
+ let cloudDocId;
2139
+ if (out0.status === "exists") {
2140
+ const { data: ex } = await s.db.from("documents").select("id").eq("org_id", pick.org_id).eq("repo", repo).eq("path", path).maybeSingle();
2141
+ const exId = ex?.id;
2142
+ if (!exId) {
2143
+ process.stderr.write("inplan upload: a document already exists at this path but could not be resolved\n");
2144
+ process.exit(1);
2145
+ }
2146
+ cloudDocId = exId;
2147
+ } else if (out0.status === "created" && out0.id) {
2148
+ cloudDocId = out0.id;
2149
+ } else {
2150
+ process.stderr.write("inplan upload: could not create the cloud document\n");
2151
+ process.exit(1);
2152
+ }
2017
2153
  const status = {
2018
2154
  location: "cloud",
2019
2155
  cloudDocId,
@@ -2091,7 +2227,7 @@ async function main() {
2091
2227
  );
2092
2228
  if (!cmd || !["open", "wait", "signal", "message", "relay", "status", "promote", "demote", "upload"].includes(cmd)) {
2093
2229
  process.stderr.write(
2094
- 'usage: inplan <open|wait|signal> <file|--remote DOC_ID> [--model NAME] [--cursor N] [--confirmed-comment-deletion=a,b] [--done] [--reload]\n inplan message <file> "your message" (relay a note to the editor status bar)\n inplan relay [--hook <kind> | --text <s> [--activity]] (agent-hook \u2192 editor; resolves the active doc)\n inplan status <file>\n inplan upload <file> [--org <slug>] [--repo <name>] [--path <p>] (Collaborate on Cloud)\n inplan promote <file> --cloud-doc <docId> [--locator org/repo/path]\n inplan demote <file>\n inplan login --url <url> --anon <anon-key> --refresh <refresh-token> [--email <e>]\n inplan whoami | logout\n'
2230
+ 'usage: inplan <open|wait|signal> <file|--remote DOC_ID> [--model NAME] [--cursor N] [--confirmed-comment-deletion=a,b] [--done] [--reload]\n inplan message <file> "your message" (relay a note to the editor status bar)\n inplan relay [--hook <kind> | --text <s> [--activity]] (agent-hook \u2192 editor; resolves the active doc)\n inplan status <file>\n inplan upload <file> [--org <slug>] [--repo <name>] [--path <p>] [--evict-lru] (Collaborate on Cloud)\n inplan promote <file> --cloud-doc <docId> [--locator org/repo/path]\n inplan demote <file>\n inplan login (opens the browser to sign in; or --url <url> --anon <key> --refresh <token> for scripts)\n inplan whoami | logout\n'
2095
2231
  );
2096
2232
  process.exit(64);
2097
2233
  }
@@ -2196,13 +2332,25 @@ async function main() {
2196
2332
  }
2197
2333
  await waitCycle(fsBackend(file), explicitCursor, confirmed, model, gate);
2198
2334
  }
2199
- main().catch((err) => {
2200
- process.stderr.write(`inplan: ${err.message}
2335
+ function isProgramEntry() {
2336
+ const argv1 = process.argv[1];
2337
+ if (!argv1) return false;
2338
+ try {
2339
+ return import.meta.url === pathToFileURL2(realpathSync(argv1)).href;
2340
+ } catch {
2341
+ return import.meta.url === pathToFileURL2(argv1).href;
2342
+ }
2343
+ }
2344
+ if (isProgramEntry()) {
2345
+ main().catch((err) => {
2346
+ process.stderr.write(`inplan: ${err.message}
2201
2347
  `);
2202
- process.exit(1);
2203
- });
2348
+ process.exit(1);
2349
+ });
2350
+ }
2204
2351
  export {
2205
2352
  activeDocForCwd,
2353
+ doUpload,
2206
2354
  notesFromHook,
2207
2355
  transcriptTextBlocks
2208
2356
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inplan",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
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": {