mainflow 0.43.0-alpha.3 → 0.43.0-alpha.4

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
@@ -1822,8 +1822,8 @@ function fail(message) {
1822
1822
  console.error(message);
1823
1823
  return 1;
1824
1824
  }
1825
- /** How the executor runs this CLI inside a hub; used in the texts hooks inject. */
1826
- const CLI = "pnpm exec mainflow";
1825
+ /** How the executor runs this CLI inside a hub, the global install; used in the texts hooks inject. */
1826
+ const CLI = "mainflow";
1827
1827
  /** The session a command acts on: an explicit argument, then --session, then MAINFLOW_SESSION set by the SessionStart hook. */
1828
1828
  function sessionOf(opts, arg) {
1829
1829
  const id = arg ?? opts.session ?? process.env.MAINFLOW_SESSION;
package/dist/hooks.js CHANGED
@@ -137,8 +137,11 @@ const WRITE_TOOLS = /* @__PURE__ */ new Set([
137
137
  "MultiEdit",
138
138
  "NotebookEdit"
139
139
  ]);
140
- /** A Bash command that runs the mainflow CLI: by the form the hook texts give, or as a `mainflow` command word that starts a command, not one that is only an argument. */
141
- const isMainflowCommand = (command, cli) => command.includes(cli) || /(?:^|[;&|(])\s*mainflow\s+\S|(?:\.bin|mainflow\/dist)\/(?:cli\.js|mainflow)\b/.test(command);
140
+ /**
141
+ * A Bash command that runs the mainflow CLI: the form the hook texts give, or a `mainflow` command word, starting a
142
+ * command after any variable assignments; one that is only an argument or part of a path does not count.
143
+ */
144
+ const isMainflowCommand = (command, cli) => new RegExp(`(?:^|[;&|(])\\s*(?:\\w+=\\S*\\s+)*${cli.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\s+\\S`).test(command) || /(?:^|[;&|(])\s*(?:\w+=\S*\s+)*(?:pnpm\s+exec\s+|npx\s+)?mainflow\s+\S|(?:\.bin|mainflow\/dist)\/(?:cli\.js|mainflow)\b/.test(command);
142
145
  /** Whether `path` is a file of a hub registered on this machine: it lies in that hub's data directory. */
143
146
  const inHubData = (path, env) => hubHoldingFile(path, env) !== null;
144
147
  /** A user record that holds what the user typed; tool results come back as user records too, but carry only tool_result blocks. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mainflow",
3
- "version": "0.43.0-alpha.3",
3
+ "version": "0.43.0-alpha.4",
4
4
  "description": "本機多 AI 協作的主脈絡任務管理:CLI 與介面",
5
5
  "license": "MIT",
6
6
  "type": "module",