mainflow 0.31.0-alpha.1 → 0.32.0-beta.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
@@ -2,10 +2,10 @@
2
2
  import { B as parseRef, H as refExample, V as parseUntil, Y as stampMs, k as UNTIL_FORMS } from "./dist-IdbnCDqM.js";
3
3
  import { B as checkHubName, H as loadHub, J as TASK_FILE, Q as nodeStorage, S as readSession, V as HubError, X as nowMinute, Y as requireSlug, _ as untilState, at as findHubRoot, ct as DATA_DIR, d as retroReportFromReceiver, f as receiverFromEnv, g as initHub, l as migrateHub, lt as WriteError, p as RETRY_RULES, q as MAINLINE_FILE, u as retroReport, v as duplicateClaimLines, x as loadSessions, y as sessionBriefing, z as applyOperation } from "./host-CdB_vDY_.js";
4
4
  import { t as listProgress } from "./progress-1BfPg2zN.js";
5
- import { C as syncSettings, D as syncPaths, S as hubName, _ as readRemote, a as remoteMode, b as ENV, c as planFetch, d as DaemonRunning, f as DaemonUnavailable, g as silentHint, h as readDaemon, i as queuedCount, l as planFlush, m as probeDaemon, n as hubWriter, o as fetchDenial, p as callDaemon, r as writtenLines, s as hookAnswer, t as CONFIRM_MS, u as startDaemon, v as ServerApi, w as SETTINGS_FILE, x as earlierToken, y as ServerError } from "./operation-BmysMg4R.js";
5
+ import { C as syncSettings, D as syncPaths, S as hubName, _ as readRemote, a as remoteMode, b as ENV, c as planFetch, d as DaemonRunning, f as DaemonUnavailable, g as silentHint, h as readDaemon, i as queuedCount, l as planFlush, m as probeDaemon, n as hubWriter, o as fetchDenial, p as callDaemon, r as writtenLines, s as hookAnswer, t as CONFIRM_MS, u as startDaemon, v as ServerApi, w as SETTINGS_FILE, x as earlierToken, y as ServerError } from "./operation-CuWhNoIa.js";
6
6
  import { COMMAND_SPECS, OPTIONS } from "./facts.js";
7
7
  import { hookFallback, parsePayload, runHook } from "./hooks.js";
8
- import { c as watchHubGone, l as CLI_VERSION, r as launchUi, s as startUiInBackground } from "./launch-D1zaGo7W.js";
8
+ import { c as watchHubGone, l as CLI_VERSION, r as launchUi, s as startUiInBackground } from "./launch-Bmzqx-TI.js";
9
9
  import { randomBytes } from "node:crypto";
10
10
  import { existsSync, readFileSync, readdirSync, realpathSync, rmSync, statSync } from "node:fs";
11
11
  import { basename, isAbsolute, join, relative, resolve, sep } from "node:path";
@@ -21,7 +21,7 @@ async function syncRun(root) {
21
21
  const settings = syncSettings(root);
22
22
  if (!settings) {
23
23
  const earlier = earlierToken(root);
24
- console.error(earlier ? `✗ ${earlier}` : `✗ no sync server: set ${ENV.url}, ${ENV.clientId} and ${ENV.clientSecret}, or url, clientId and clientSecret in .mainflow/${SETTINGS_FILE}`);
24
+ console.error(earlier ? `✗ ${earlier}` : `✗ no service token for the sync server: set ${ENV.clientId} and ${ENV.clientSecret}, or clientId and clientSecret in .mainflow/${SETTINGS_FILE}`);
25
25
  return 1;
26
26
  }
27
27
  const running = await probeDaemon(root);
package/dist/facts.d.ts CHANGED
@@ -342,7 +342,7 @@ export declare const COMMAND_SPECS: {
342
342
  };
343
343
  readonly sync: {
344
344
  readonly usage: 'sync';
345
- readonly summary: `Keep .mainflow/ in step with the hub on the sync server until stopped: pull its changes, send every local change. The server and its Cloudflare Access service token come from MAINFLOW_SYNC_URL, MAINFLOW_SYNC_CLIENT_ID and MAINFLOW_SYNC_CLIENT_SECRET, or url, clientId and clientSecret in .mainflow/local/sync.json. On connecting it downloads only the files that differ from the versions it last synced; with MAINFLOW_SYNC_ON_DEMAND=1, or onDemand: true in sync.json, it leaves the artifacts of done and dropped mainlines on the server until they are used (sync fetch). While it runs, or with a server and token set, every mainflow write is applied here and put in the outbox, which it sends in order; a writing command waits up to 15 s for the server's answer`;
345
+ readonly summary: `Keep .mainflow/ in step with the hub on the sync server until stopped: pull its changes, send every local change. The server is https://mainflow-sync.carlos209310.space unless MAINFLOW_SYNC_URL, or url in .mainflow/local/sync.json, names another; its Cloudflare Access service token comes from MAINFLOW_SYNC_CLIENT_ID and MAINFLOW_SYNC_CLIENT_SECRET, or clientId and clientSecret in the same file. On connecting it downloads only the files that differ from the versions it last synced; with MAINFLOW_SYNC_ON_DEMAND=1, or onDemand: true in sync.json, it leaves the artifacts of done and dropped mainlines on the server until they are used (sync fetch). While it runs, or with a service token set, every mainflow write is applied here and put in the outbox, which it sends in order; a writing command waits up to 15 s for the server's answer`;
346
346
  readonly args: 0;
347
347
  readonly needsHub: true;
348
348
  };
package/dist/facts.js CHANGED
@@ -332,7 +332,7 @@ const COMMAND_SPECS = {
332
332
  },
333
333
  sync: {
334
334
  usage: "sync",
335
- summary: `Keep .mainflow/ in step with the hub on the sync server until stopped: pull its changes, send every local change. The server and its Cloudflare Access service token come from MAINFLOW_SYNC_URL, MAINFLOW_SYNC_CLIENT_ID and MAINFLOW_SYNC_CLIENT_SECRET, or url, clientId and clientSecret in .mainflow/local/sync.json. On connecting it downloads only the files that differ from the versions it last synced; with MAINFLOW_SYNC_ON_DEMAND=1, or onDemand: true in sync.json, it leaves the artifacts of done and dropped mainlines on the server until they are used (sync fetch). While it runs, or with a server and token set, every mainflow write is applied here and put in the outbox, which it sends in order; a writing command waits up to 15 s for the server's answer`,
335
+ summary: `Keep .mainflow/ in step with the hub on the sync server until stopped: pull its changes, send every local change. The server is https://mainflow-sync.carlos209310.space unless MAINFLOW_SYNC_URL, or url in .mainflow/local/sync.json, names another; its Cloudflare Access service token comes from MAINFLOW_SYNC_CLIENT_ID and MAINFLOW_SYNC_CLIENT_SECRET, or clientId and clientSecret in the same file. On connecting it downloads only the files that differ from the versions it last synced; with MAINFLOW_SYNC_ON_DEMAND=1, or onDemand: true in sync.json, it leaves the artifacts of done and dropped mainlines on the server until they are used (sync fetch). While it runs, or with a service token set, every mainflow write is applied here and put in the outbox, which it sends in order; a writing command waits up to 15 s for the server's answer`,
336
336
  args: 0,
337
337
  needsHub: true
338
338
  },
package/dist/hooks.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { $ as describeRequest, j as configSchema } from "./dist-IdbnCDqM.js";
2
2
  import { D as endsWithMarker, E as decorateReply, H as loadHub, O as headerLine, S as readSession, T as matchGrants, V as HubError, Z as readYaml, at as findHubRoot, b as turnReminder, ct as DATA_DIR, i as hostName, it as currentBranch, k as mayDecorate, ot as worktreesOf, w as grantScope, x as loadSessions, y as sessionBriefing } from "./host-CdB_vDY_.js";
3
- import { n as hubWriter, r as writtenLines } from "./operation-BmysMg4R.js";
3
+ import { n as hubWriter, r as writtenLines } from "./operation-CuWhNoIa.js";
4
4
  import { resolveFixed, scanCommand, scopedCwd } from "./grant-commands.js";
5
5
  import { appendFileSync, existsSync, readFileSync } from "node:fs";
6
6
  import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
@@ -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-DlOY5qEU.js");
179
+ const { serveUi } = await import("./ui-rwBrbIIF.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-D1zaGo7W.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-Bmzqx-TI.js";
2
2
  export { PORT_SPAN, choosePort, launchUi, networkProbe, portCandidates, readUiRecord, startUiInBackground, watchHubGone };
@@ -72,8 +72,6 @@ const ARTIFACT = /^mainlines\/([^/]+)\/(?:tasks\/[^/]+\/)?artifacts\/./;
72
72
  * may stay on the server until it is used, when its mainline is closed (docs/sync.md "按需下載").
73
73
  */
74
74
  const artifactOf = (path) => ARTIFACT.exec(path)?.[1] ?? null;
75
- //#endregion
76
- //#region ../sync/dist/settings.js
77
75
  const ENV = {
78
76
  url: "MAINFLOW_SYNC_URL",
79
77
  clientId: "MAINFLOW_SYNC_CLIENT_ID",
@@ -104,15 +102,16 @@ function stored(root) {
104
102
  }
105
103
  }
106
104
  /**
107
- * The sync settings of the hub at `root`, or null when the server or either half of the token is missing. Each value
108
- * comes from its environment variable, or from sync.json when the variable is unset or empty.
105
+ * The sync settings of the hub at `root`, or null when either half of the token is missing. Each value comes from its
106
+ * environment variable, or from sync.json when the variable is unset or empty; the server is DEFAULT_SYNC_URL when
107
+ * neither names one.
109
108
  */
110
109
  function syncSettings(root, env = process.env) {
111
110
  const saved = stored(root);
112
- const url = env[ENV.url] || text(saved.url);
111
+ const url = env[ENV.url] || text(saved.url) || "https://mainflow-sync.carlos209310.space";
113
112
  const clientId = env[ENV.clientId] || text(saved.clientId);
114
113
  const clientSecret = env[ENV.clientSecret] || text(saved.clientSecret);
115
- if (!url || !clientId || !clientSecret) return null;
114
+ if (!clientId || !clientSecret) return null;
116
115
  const onDemand = env[ENV.onDemand] ? ON.has(env[ENV.onDemand].trim().toLowerCase()) : saved.onDemand === true;
117
116
  return {
118
117
  url: url.replace(/\/+$/, ""),
@@ -1,8 +1,8 @@
1
1
  import { j as configSchema } from "./dist-IdbnCDqM.js";
2
2
  import { A as attributeTrace, C as transcriptPath, G as linksInto, H as loadHub, K as refIndex, M as transcriptTitle, S as readSession, U as dependencyGraph, W as mainlineEdges, Z as readYaml, a as openInApp, ct as DATA_DIR, h as setArchivedMany, j as traceTranscript, lt as WriteError, m as ARCHIVE_KINDS, st as ConflictError, x as loadSessions } from "./host-CdB_vDY_.js";
3
3
  import { t as listProgress } from "./progress-1BfPg2zN.js";
4
- import { D as syncPaths, E as isSynced, T as SYNC_DIR, a as remoteMode, f as DaemonUnavailable, h as readDaemon, n as hubWriter, p as callDaemon, r as writtenLines } from "./operation-BmysMg4R.js";
5
- import { l as CLI_VERSION } from "./launch-D1zaGo7W.js";
4
+ import { D as syncPaths, E as isSynced, T as SYNC_DIR, a as remoteMode, f as DaemonUnavailable, h as readDaemon, n as hubWriter, p as callDaemon, r as writtenLines } from "./operation-CuWhNoIa.js";
5
+ import { l as CLI_VERSION } from "./launch-Bmzqx-TI.js";
6
6
  import { createRequire } from "node:module";
7
7
  import { closeSync, existsSync, lstatSync, openSync, readFileSync, readSync, realpathSync, statSync, watch } from "node:fs";
8
8
  import { basename, dirname, extname, join, normalize, relative, resolve, sep } from "node:path";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mainflow",
3
- "version": "0.31.0-alpha.1",
3
+ "version": "0.32.0-beta.1",
4
4
  "description": "本機多 AI 協作的主脈絡任務管理:CLI 與介面",
5
5
  "license": "MIT",
6
6
  "type": "module",