mainflow 0.13.0 → 0.13.1

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/cli.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { $ as setFindingStatus, A as addAction, C as setCriterionText, D as updateTask, E as supersedeDecision, F as setSessionArchived, J as createFinding, K as appendOps, L as setSessionStatus, M as handoffSession, O as sessionBriefing, P as readSession, Q as setFindingArchived, S as setCriterion, V as updateAction, X as planIssue, Y as createIssue, Z as reopenIssue, _ as createTask, b as setArchived, ct as TASK_FILE, et as setIssueArchived, f as acceptDecision, g as createMainline, h as createDecision, l as migrateHub, m as addRepo, nt as loadHub, p as addHub, pt as findHubRoot, q as closeIssue, st as MAINLINE_FILE, tt as HubError, ut as WriteError, v as dropChecklistItem, w as setMainlineStatus, x as setChecklistItem, y as initHub, z as startSession } from "./host-daQGe7no.js";
2
+ import { $ as setFindingStatus, A as addAction, C as setCriterionText, D as updateTask, E as supersedeDecision, F as setSessionArchived, J as createFinding, K as appendOps, L as setSessionStatus, M as handoffSession, O as sessionBriefing, P as readSession, Q as setFindingArchived, S as setCriterion, V as updateAction, X as planIssue, Y as createIssue, Z as reopenIssue, _ as createTask, b as setArchived, ct as TASK_FILE, et as setIssueArchived, f as acceptDecision, g as createMainline, h as createDecision, l as migrateHub, m as addRepo, nt as loadHub, p as addHub, pt as findHubRoot, q as closeIssue, st as MAINLINE_FILE, tt as HubError, ut as WriteError, v as dropChecklistItem, w as setMainlineStatus, x as setChecklistItem, y as initHub, z as startSession } from "./host-mlpW8M1s.js";
3
3
  import { N as parseRef, P as refExample } from "./dist-BQmXEfAf.js";
4
4
  import { t as listProgress } from "./progress-1BfPg2zN.js";
5
5
  import { COMMAND_SPECS, OPTIONS } from "./facts.js";
6
6
  import { runHook } from "./hooks.js";
7
- import { l as CLI_VERSION, r as launchUi, s as startUiInBackground } from "./launch-JK8l8BYu.js";
7
+ import { l as CLI_VERSION, r as launchUi, s as startUiInBackground } from "./launch-CJYDVfE9.js";
8
8
  import { readFileSync, realpathSync } from "node:fs";
9
9
  import { join, relative } from "node:path";
10
10
  import { fileURLToPath } from "node:url";
package/dist/hooks.js CHANGED
@@ -1,4 +1,4 @@
1
- import { G as mayDecorate, H as decorateReply, I as setSessionInfo, L as setSessionStatus, O as sessionBriefing, P as readSession, R as settleSession, U as endsWithMarker, W as headerLine, dt as DATA_DIR, ft as currentBranch, i as hostName, j as ensureSession, k as turnReminder, mt as worktreesOf, nt as loadHub, pt as findHubRoot, tt as HubError } from "./host-daQGe7no.js";
1
+ import { G as mayDecorate, H as decorateReply, I as setSessionInfo, L as setSessionStatus, O as sessionBriefing, P as readSession, R as settleSession, U as endsWithMarker, W as headerLine, dt as DATA_DIR, ft as currentBranch, i as hostName, j as ensureSession, k as turnReminder, mt as worktreesOf, nt as loadHub, pt as findHubRoot, tt as HubError } from "./host-mlpW8M1s.js";
2
2
  import { appendFileSync, existsSync, readFileSync } from "node:fs";
3
3
  import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
4
4
  //#region src/hooks.ts
@@ -1218,28 +1218,41 @@ function requireServes(root, serves) {
1218
1218
  const isOpen$1 = (a) => a.status === "todo" || a.status === "doing";
1219
1219
  /**
1220
1220
  * The previous session's unfinished actions, numbered after `existing`, with the previous session marked
1221
- * handed-off. Runs inside the caller's lock.
1221
+ * handed-off. Each carried action is dropped in the previous session with a note naming its new reference,
1222
+ * so the work stays open in one place only and the old session still shows where it went. Runs inside the
1223
+ * caller's lock.
1222
1224
  */
1223
- function takeUnfinished(root, from, existing) {
1225
+ function takeUnfinished(root, from, to, existing) {
1224
1226
  const previousFile = requireSession(root, from);
1225
1227
  const previous = readYaml(previousFile, sessionSchema).data;
1226
1228
  const ids = [...existing];
1227
- const carried = previous.actions.filter(isOpen$1).map((a) => {
1229
+ const carried = [];
1230
+ const at = nowMinute();
1231
+ const left = previous.actions.map((a) => {
1232
+ if (!isOpen$1(a)) return a;
1228
1233
  const id = nextId("a", ids);
1229
1234
  ids.push(id);
1230
- return {
1235
+ carried.push({
1231
1236
  ...a,
1232
1237
  id
1238
+ });
1239
+ const handedOff = `handed off to ${to}#${id}`;
1240
+ return {
1241
+ ...a,
1242
+ status: "dropped",
1243
+ note: a.note ? `${a.note}; ${handedOff}` : handedOff,
1244
+ doneAt: at
1233
1245
  };
1234
1246
  });
1235
1247
  writeAtomic(previousFile, toYaml(validate(sessionSchema, {
1236
1248
  ...previous,
1237
- status: "handed-off"
1249
+ status: "handed-off",
1250
+ actions: left
1238
1251
  }, previousFile)));
1239
1252
  return carried;
1240
1253
  }
1241
1254
  /**
1242
- * Start a session. Taking over from another session copies its unfinished actions into this one and marks
1255
+ * Start a session. Taking over from another session moves its unfinished actions into this one and marks
1243
1256
  * the other session handed-off, so the queue continues where it stopped.
1244
1257
  */
1245
1258
  function startSession(root, input) {
@@ -1249,7 +1262,7 @@ function startSession(root, input) {
1249
1262
  const file = sessionFile(root, id);
1250
1263
  if (existsSync(file)) throw new WriteError(`session ${id} already exists`);
1251
1264
  if (input.delegatedFrom) requireSession(root, input.delegatedFrom);
1252
- const carried = input.handoffFrom ? takeUnfinished(root, input.handoffFrom, []) : [];
1265
+ const carried = input.handoffFrom ? takeUnfinished(root, input.handoffFrom, id, []) : [];
1253
1266
  const session = validate(sessionSchema, {
1254
1267
  id,
1255
1268
  agent: input.agent,
@@ -1302,7 +1315,7 @@ function handoffSession(root, id, from) {
1302
1315
  const open = session.actions.filter(isOpen$1);
1303
1316
  if (open.length > 0) throw new WriteError(`session ${id} has unfinished actions (${open.map((a) => a.id).join(", ")}); finish or drop them before taking over from ${from}`);
1304
1317
  if (!readYaml(requireSession(root, from), sessionSchema).data.actions.some(isOpen$1)) throw new WriteError(`session ${from} has no unfinished actions to take over`);
1305
- const carried = takeUnfinished(root, from, session.actions.map((a) => a.id));
1318
+ const carried = takeUnfinished(root, from, id, session.actions.map((a) => a.id));
1306
1319
  const next = validate(sessionSchema, {
1307
1320
  ...session,
1308
1321
  status: "active",
package/dist/host.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as openInApp, c as syncHost, i as hostName, n as DEFAULT_UI_PORT, o as removeHostLink, r as caddySites, s as siteBlock, t as APP_BUNDLE_ID } from "./host-daQGe7no.js";
1
+ import { a as openInApp, c as syncHost, i as hostName, n as DEFAULT_UI_PORT, o as removeHostLink, r as caddySites, s as siteBlock, t as APP_BUNDLE_ID } from "./host-mlpW8M1s.js";
2
2
  export { APP_BUNDLE_ID, DEFAULT_UI_PORT, caddySites, hostName, openInApp, removeHostLink, siteBlock, syncHost };
@@ -1,4 +1,4 @@
1
- import { c as syncHost, dt as DATA_DIR, i as hostName, n as DEFAULT_UI_PORT, o as removeHostLink, ut as WriteError } from "./host-daQGe7no.js";
1
+ import { c as syncHost, dt as DATA_DIR, i as hostName, n as DEFAULT_UI_PORT, o as removeHostLink, ut as WriteError } from "./host-mlpW8M1s.js";
2
2
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
3
  import { join } from "node:path";
4
4
  import { spawn, spawnSync } from "node:child_process";
@@ -176,7 +176,7 @@ async function launchUi(root, hub, configured, options) {
176
176
  }
177
177
  let server;
178
178
  if (!reuse) {
179
- const { serveUi } = await import("./ui-BoBBdpZH.js");
179
+ const { serveUi } = await import("./ui-BbIFSMKR.js");
180
180
  server = await serveUi(root, choice.port);
181
181
  writeUiRecord(root, {
182
182
  port: choice.port,
package/dist/launch.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as portCandidates, c as watchHubGone, i as networkProbe, n as choosePort, o as readUiRecord, r as launchUi, s as startUiInBackground, t as PORT_SPAN } from "./launch-JK8l8BYu.js";
1
+ import { a as portCandidates, c as watchHubGone, i as networkProbe, n as choosePort, o as readUiRecord, r as launchUi, s as startUiInBackground, t as PORT_SPAN } from "./launch-CJYDVfE9.js";
2
2
  export { PORT_SPAN, choosePort, launchUi, networkProbe, portCandidates, readUiRecord, startUiInBackground, watchHubGone };
@@ -1,6 +1,6 @@
1
- import { B as transcriptPath, D as updateTask, F as setSessionArchived, N as loadSessions, P as readSession, Q as setFindingArchived, S as setCriterion, T as setMainlineTitle, a as openInApp, at as linksInto, b as setArchived, d as setArchivedMany, dt as DATA_DIR, et as setIssueArchived, it as mainlineEdges, lt as ConflictError, nt as loadHub, ot as refIndex, rt as dependencyGraph, u as ARCHIVE_KINDS, ut as WriteError, w as setMainlineStatus, x as setChecklistItem } from "./host-daQGe7no.js";
1
+ import { B as transcriptPath, D as updateTask, F as setSessionArchived, N as loadSessions, P as readSession, Q as setFindingArchived, S as setCriterion, T as setMainlineTitle, a as openInApp, at as linksInto, b as setArchived, d as setArchivedMany, dt as DATA_DIR, et as setIssueArchived, it as mainlineEdges, lt as ConflictError, nt as loadHub, ot as refIndex, rt as dependencyGraph, u as ARCHIVE_KINDS, ut as WriteError, w as setMainlineStatus, x as setChecklistItem } from "./host-mlpW8M1s.js";
2
2
  import { t as listProgress } from "./progress-1BfPg2zN.js";
3
- import { l as CLI_VERSION } from "./launch-JK8l8BYu.js";
3
+ import { l as CLI_VERSION } from "./launch-CJYDVfE9.js";
4
4
  import { createRequire } from "node:module";
5
5
  import { closeSync, existsSync, openSync, readFileSync, readSync, statSync, watch } from "node:fs";
6
6
  import { basename, dirname, extname, join, normalize, relative, sep } from "node:path";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mainflow",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "本機多 AI 協作的主脈絡任務管理:CLI 與介面",
5
5
  "license": "MIT",
6
6
  "type": "module",