@fusebase/harness-lead 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.5 — 2026-12-04
4
+
5
+ - `lead commands [--json]`: the /lead commands with their argument and options (mode auto/approve/readonly, watch start/stop/interval, delegate check, qa milestone, activity analyze) as data, for interfaces that offer them in a menu. A test keeps it equal to `references/help.md`. Allowed in readonly mode.
6
+ - `lead suggest [--json]`: the command a person would most likely type next, from the next step of `status` (`/lead init`, `/lead plan`, `/lead task T-003`, `/lead qa T-005` …), with up to four other options as buttons. Interfaces offer it as a suggestion in the field; nothing runs by itself. Read-only.
7
+
3
8
  ## 0.3.4 — 2026-12-04
4
9
 
5
10
  - `lead mode readonly`: lead reads and reports and changes nothing in the project. The CLI refuses every command that writes (exit 3, an allow-list, so a new command is refused until listed): task and board changes, `scaffold`, `spec`, `install`/`update`, `adopt --write`, `waves --write`, `sync-plan` without `--preview`, `watch` start/stop/ack/probe shadow. Reads, previews, `watch probe report|--dry`, the switches (`enable`, `mode`, `use`) and the local notes (`improve`, `activity`) still work. The session-start hook and the skill tell the agent to stay read-only. Editing files by the agent's own tools is held by those instructions, not by the CLI.
package/dist/lead.mjs CHANGED
@@ -7549,7 +7549,7 @@ var TEMPLATES = {
7549
7549
  "workspace-crew.md": "---\nname: crew-lead\ndescription: Run the lead workflow. Use only when the user invokes /crew-lead or $crew-lead.\n---\n<!-- evercrew:workspace-entry -->\nFollow the adjacent `../lead/SKILL.md` entry point as if the user invoked lead. Pass through the request and its arguments.\n",
7550
7550
  "workspace-entry.md": "---\nname: lead\ndescription: Run lead for this project or show the workspace overview. Use when the user types /lead or $lead, asks to use lead, or asks for an overview of all workspace projects.\n---\n<!-- evercrew:workspace-entry -->\nIf the session context already names the lead launcher and kit, use them and skip the next two steps. Otherwise find the nearest `.lead/lead.mjs` from the directory this conversation started in. Preserve that starting directory as `--cwd` on the first call. Run `node <launcher> kit-path`, then read `skills/lead/SKILL.md` from the returned kit directory and follow it. References are relative to that kit directory. Keep the same session ID throughout this conversation. The launcher and kit path are local setup, not product state.\n",
7551
7551
  "workspace-goal.md": "---\nname: lead-goal\ndescription: Record lead activity and keep the heartbeat for an active Cursor goal.\n---\n<!-- evercrew:workspace-entry -->\nRun `node .lead/lead.mjs kit-path` from the lead workspace or target checkout, then read `skills/lead-goal/SKILL.md` from the returned kit directory. Use the same repository scope and session ID as lead.\n",
7552
- "workspace-launcher.mjs": "#!/usr/bin/env node\n// evercrew:workspace-entry\n// Portable entry point. The runtime belongs to the workspace or to the user's npm cache.\nimport { spawnSync } from 'node:child_process';\nimport { existsSync, mkdirSync, realpathSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { dirname, join, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst args = process.argv.slice(2);\nconst here = dirname(dirname(fileURLToPath(import.meta.url)));\nconst hook = args[0] === 'stop-check' || args[0] === 'session-start';\nconst cwdFlag = args.indexOf('--cwd');\nconst cwd = cwdFlag >= 0 && args[cwdFlag + 1] ? resolve(args[cwdFlag + 1]) : process.cwd();\nconst cli = (kit) => join(kit, 'dist/lead.mjs');\n\nfunction workspaceKit(start) {\n let dir = realpathSync(start);\n while (true) {\n if (existsSync(join(dir, '.lead/workspace.yml'))) {\n const kit = join(dir, '.lead/workspace-kit');\n if (existsSync(cli(kit))) return kit;\n if (hook) return;\n throw new Error(`The lead workspace at ${dir} has no runtime. Deploy its kit first.`);\n }\n if (dirname(dir) === dir) return;\n dir = dirname(dir);\n }\n}\n\nfunction run(bin, argv, diagnosticsOnly = false) {\n const result = spawnSync(bin, argv, { stdio: diagnosticsOnly ? ['inherit', 2, 2] : 'inherit', env: bin === 'npm' ? { ...process.env, 'npm_config_@fusebase:registry': 'https://registry.npmjs.org/' } : process.env });\n if (result.error) throw result.error;\n return result.status ?? 1;\n}\n\nfunction main() {\n const shared = workspaceKit(cwd) ?? workspaceKit(here);\n const installed = join(here, 'node_modules/@fusebase/harness-lead');\n const cache = join(process.env.XDG_CACHE_HOME || join(homedir(), '.cache'), 'harness-lead', 'standalone');\n const cached = join(cache, 'node_modules/@fusebase/harness-lead');\n let kit = shared ?? (existsSync(cli(cached)) ? cached : installed);\n if (!shared && (args[0] === 'update' || !existsSync(cli(kit)))) {\n if (hook) return 0;\n if (args[0] === 'update' && args.length > 1) throw new Error('Standalone launcher update refreshes the user cache. Run the chosen kit directly for an explicit source.');\n mkdirSync(cache, { recursive: true });\n const status = run('npm', ['install', '--prefix', cache, '--no-save', '--no-package-lock', '--ignore-scripts', '--no-audit', '--no-fund',\n args[0] === 'update' ? '@fusebase/harness-lead@latest' : '@fusebase/harness-lead@0.3.4'], true);\n if (status || !existsSync(cli(cached))) return status || 1;\n kit = cached;\n if (args[0] === 'update') return run(process.execPath, [cli(kit), 'version']);\n }\n if (args[0] === 'kit-path') {\n console.log(realpathSync(kit));\n return 0;\n }\n return run(process.execPath, [cli(kit), ...args]);\n}\n\ntry { process.exitCode = main(); }\ncatch (error) {\n if (!hook) console.error(`lead: ${error.message}`);\n process.exitCode = hook ? 0 : 1;\n}\n",
7552
+ "workspace-launcher.mjs": "#!/usr/bin/env node\n// evercrew:workspace-entry\n// Portable entry point. The runtime belongs to the workspace or to the user's npm cache.\nimport { spawnSync } from 'node:child_process';\nimport { existsSync, mkdirSync, realpathSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { dirname, join, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst args = process.argv.slice(2);\nconst here = dirname(dirname(fileURLToPath(import.meta.url)));\nconst hook = args[0] === 'stop-check' || args[0] === 'session-start';\nconst cwdFlag = args.indexOf('--cwd');\nconst cwd = cwdFlag >= 0 && args[cwdFlag + 1] ? resolve(args[cwdFlag + 1]) : process.cwd();\nconst cli = (kit) => join(kit, 'dist/lead.mjs');\n\nfunction workspaceKit(start) {\n let dir = realpathSync(start);\n while (true) {\n if (existsSync(join(dir, '.lead/workspace.yml'))) {\n const kit = join(dir, '.lead/workspace-kit');\n if (existsSync(cli(kit))) return kit;\n if (hook) return;\n throw new Error(`The lead workspace at ${dir} has no runtime. Deploy its kit first.`);\n }\n if (dirname(dir) === dir) return;\n dir = dirname(dir);\n }\n}\n\nfunction run(bin, argv, diagnosticsOnly = false) {\n const result = spawnSync(bin, argv, { stdio: diagnosticsOnly ? ['inherit', 2, 2] : 'inherit', env: bin === 'npm' ? { ...process.env, 'npm_config_@fusebase:registry': 'https://registry.npmjs.org/' } : process.env });\n if (result.error) throw result.error;\n return result.status ?? 1;\n}\n\nfunction main() {\n const shared = workspaceKit(cwd) ?? workspaceKit(here);\n const installed = join(here, 'node_modules/@fusebase/harness-lead');\n const cache = join(process.env.XDG_CACHE_HOME || join(homedir(), '.cache'), 'harness-lead', 'standalone');\n const cached = join(cache, 'node_modules/@fusebase/harness-lead');\n let kit = shared ?? (existsSync(cli(cached)) ? cached : installed);\n if (!shared && (args[0] === 'update' || !existsSync(cli(kit)))) {\n if (hook) return 0;\n if (args[0] === 'update' && args.length > 1) throw new Error('Standalone launcher update refreshes the user cache. Run the chosen kit directly for an explicit source.');\n mkdirSync(cache, { recursive: true });\n const status = run('npm', ['install', '--prefix', cache, '--no-save', '--no-package-lock', '--ignore-scripts', '--no-audit', '--no-fund',\n args[0] === 'update' ? '@fusebase/harness-lead@latest' : '@fusebase/harness-lead@0.3.5'], true);\n if (status || !existsSync(cli(cached))) return status || 1;\n kit = cached;\n if (args[0] === 'update') return run(process.execPath, [cli(kit), 'version']);\n }\n if (args[0] === 'kit-path') {\n console.log(realpathSync(kit));\n return 0;\n }\n return run(process.execPath, [cli(kit), ...args]);\n}\n\ntry { process.exitCode = main(); }\ncatch (error) {\n if (!hook) console.error(`lead: ${error.message}`);\n process.exitCode = hook ? 0 : 1;\n}\n",
7553
7553
  "backlog-index.md": '# <Project> Backlog\n\n[One Pager](one-pager.md)\n\n## Reviewed backlog\n\n<!-- evercrew:view kind="proposals" -->\n<!-- /evercrew:view -->\n\n## Needs triage\n\n<!-- For each candidate, link the task note and record what needs clarification. -->\n\n## Triage decisions\n\n<!-- Link source evidence and explain why an item was linked, completed, deferred or superseded. -->\n\n## History\n\n<!-- Link the complete source reconciliation, including repeated entries. -->\n',
7554
7554
  "one-pager.md": '---\nmilestones:\n - id: mvp\n title: MVP\n shows: ""\n status: current\n---\n# <Project> \u2014 One Pager\n\n## Status now\n\n<!-- 3\u20134 sentences, written by a human. -->\n\n**What to show.**\n\n**What landed.**\n\n**Evidence.** <!-- Add the date, source revision, checks and open verification. -->\n\n<!-- evercrew:view kind="stats" -->\n<!-- /evercrew:view -->\n\n## Needs attention\n\n<!-- Decisions and immediate checks. Link the evidence and name the owner when known. -->\n\n## Product bet\n\n<!-- One sentence. -->\n\n## Research\n\nConclusions only. The long note is [the research](spec/01-research.md).\n\n<!-- Paste ### Conclusions from spec/01-research.md. Do not paste the rest. -->\n\n## Readiness\n\n<!-- evercrew:view kind="readiness" -->\n<!-- /evercrew:view -->\n\n## Roadmap\n\n<!-- evercrew:view kind="order" -->\n<!-- /evercrew:view -->\n\n## Next 3 steps\n\n<!-- evercrew:view kind="next-steps" -->\n<!-- /evercrew:view -->\n\n## Inbox triage\n\nTick an item when the team agrees to take it into the plan. Review higher priorities first, then use list order within each priority.\n\n<!-- Example: add real rows and remove this comment.\n:::checklist[Take into the plan]\n::check[:badge[Feature request]{tone="info"} :badge[High]{tone="danger"} Task summary \xB7 [Task note](tasks/T-001-example.md)]{done="false"}\n:::\n-->\n\n## Next versions (do not promise on a demo)\n\n## Reference\n\n- [Execution board](board.md)\n- [Backlog and triage decisions](backlog.md)\n<!-- Link history, architecture and QA evidence once available. -->\n',
7555
7555
  "task-note.md": "# <Task summary>\n\n## Links\n\n<!-- Fill the links or document permitted exceptions before publishing. -->\n\n- [Epic](https://example.invalid/epic)\n- [Jira Story](https://example.invalid/story)\n- [Proposal](https://example.invalid/proposal)\n- [Mockup](https://example.invalid/mockup)\n- [One Pager](https://example.invalid/one-pager)\n\n## Goal\n\n<!-- Describe the user need and intended outcome. -->\n\n## User flow\n\n<!-- Add a Mermaid diagram covering the requested path. -->\n\n## Technical design\n\n<!-- Describe changes, interfaces, and relevant constraints. -->\n\n## Decisions\n\n<!-- Record agreed decisions and tradeoffs. -->\n\n## Acceptance criteria\n\n<!-- State observable checks and expected results. -->\n\n## Out of scope\n\n<!-- Name exclusions or say whether there are none. -->\n"
@@ -8297,7 +8297,7 @@ function ensureCodexHooks(root) {
8297
8297
  }
8298
8298
 
8299
8299
  // src/install.ts
8300
- var VERSION = true ? "0.3.4" : "dev";
8300
+ var VERSION = true ? "0.3.5" : "dev";
8301
8301
  var LOCK_PATH = ".lead/kit.lock";
8302
8302
  var SKILLS = ["lead", "crew-lead", "lead-goal"];
8303
8303
  var SKILL_DIRS = [".agents/skills", ".claude/skills"];
@@ -9266,6 +9266,76 @@ function writeEntrypoints(root) {
9266
9266
  }
9267
9267
  }
9268
9268
 
9269
+ // src/commands.ts
9270
+ var COMMANDS = [
9271
+ { name: "", summary: "state and next step \u2014 answer in plain words" },
9272
+ { name: "status", summary: "state, plus a live check of every delegated task" },
9273
+ { name: "", arg: "<url>", summary: "a teams.microsoft.com/l/message, Discord, or Slack message URL only" },
9274
+ { name: "init", summary: "set up lead in this repo" },
9275
+ { name: "plan", summary: "spec by stages (research or reverse \u2192 flows \u2192 mockups \u2192 acceptance) \u2192 architecture \u2192 tasks" },
9276
+ { name: "reverse", arg: "<x>", summary: "study a running product in Docker and write how it works" },
9277
+ { name: "task", arg: "[id]", summary: "work on a task (checks and independent review included)" },
9278
+ { name: "qa", arg: "<id>", summary: "independent re-check of a task (browser QA when configured)", options: [{ name: "milestone", summary: "QA of the whole milestone" }] },
9279
+ { name: "sync", summary: "mirror work/ to FuseBase notes and Jira (when configured)" },
9280
+ { name: "delegate", summary: "hand a task to a service, or check one already handed off", options: [{ name: "check", summary: "check the tasks already handed off" }] },
9281
+ {
9282
+ name: "watch",
9283
+ summary: "clock for delegated tasks: start, stop, interval 15m|30m|1h",
9284
+ options: [
9285
+ { name: "start", summary: "start the clock" },
9286
+ { name: "stop", summary: "stop the clock" },
9287
+ { name: "interval 15m", summary: "check every 15 minutes" },
9288
+ { name: "interval 30m", summary: "check every 30 minutes" },
9289
+ { name: "interval 1h", summary: "check every hour" }
9290
+ ]
9291
+ },
9292
+ { name: "how", summary: "how to work with lead: the scheme and where you are needed" },
9293
+ { name: "improve", summary: "notes this project collected: where lead stopped, asked, or could have avoided it" },
9294
+ { name: "activity", summary: "agent run log (.lead/activity/*.jsonl); `activity analyze` summarises waits and tasks", options: [{ name: "analyze", summary: "summarise waits and tasks" }] },
9295
+ { name: "score", summary: "sample past runs, apply rubrics, or review recurring findings (references/score.md)" },
9296
+ { name: "help", summary: "this list" },
9297
+ {
9298
+ name: "mode",
9299
+ summary: "auto, approve or readonly: whether a step inside the plan runs, waits, or nothing is changed (local, not in git)",
9300
+ options: [
9301
+ { name: "auto", summary: "carry out the procedure and say what was done" },
9302
+ { name: "approve", summary: "ask before each step" },
9303
+ { name: "readonly", summary: "read and report, change nothing" }
9304
+ ]
9305
+ },
9306
+ { name: "enable", summary: "turn lead on for you in this repo (off by default; local, not in git)" },
9307
+ { name: "disable", summary: "turn it off again" }
9308
+ ];
9309
+ function suggest(next) {
9310
+ const task = (id2) => `/lead task ${id2}`;
9311
+ const each = (ids, label) => ids.slice(0, 4).map((id2) => ({ command: task(id2), label: label(id2) }));
9312
+ const one = (command) => ({ command, reason: next.reason, options: [] });
9313
+ switch (next.kind) {
9314
+ case "init":
9315
+ return one("/lead init");
9316
+ case "plan":
9317
+ case "milestone_done":
9318
+ return one("/lead plan");
9319
+ case "confirm_spec":
9320
+ return { ...one("/lead plan"), options: [{ command: "/lead plan", label: "Confirm the spec" }] };
9321
+ case "continue_task":
9322
+ return one(task(next.task));
9323
+ case "resume":
9324
+ return { command: task(next.tasks[0]), reason: next.reason, options: each(next.tasks, (id2) => `Continue ${id2}`) };
9325
+ case "answer":
9326
+ return { command: task(next.tasks[0]), reason: next.reason, options: each(next.tasks, (id2) => `Answer ${id2}`) };
9327
+ case "task":
9328
+ return { command: task(next.tasks[0]), reason: next.reason, options: each(next.tasks, (id2) => `Start ${id2}`) };
9329
+ case "review":
9330
+ return { command: `/lead qa ${next.tasks[0]}`, reason: next.reason, options: [...next.tasks.slice(0, 3).map((id2) => ({ command: `/lead qa ${id2}`, label: `Re-check ${id2}` })), { command: "/lead status", label: "Status of merges" }] };
9331
+ case "choose_project":
9332
+ case "mark_merged":
9333
+ case "adopted_project":
9334
+ case "fix":
9335
+ return one("/lead");
9336
+ }
9337
+ }
9338
+
9269
9339
  // src/cli.ts
9270
9340
  import { execFileSync as execFileSync6, spawnSync as spawnSync4 } from "node:child_process";
9271
9341
  import { existsSync as existsSync31, mkdtempSync as mkdtempSync3, rmSync as rmSync6 } from "node:fs";
@@ -9300,6 +9370,8 @@ var READS = /* @__PURE__ */ new Set([
9300
9370
  "--help",
9301
9371
  "version",
9302
9372
  "how",
9373
+ "commands",
9374
+ "suggest",
9303
9375
  "status",
9304
9376
  "check",
9305
9377
  "projects",
@@ -11686,6 +11758,8 @@ Usage: node .lead/lead.mjs <command> [options]
11686
11758
  install <repo> [--keep-modified] copy kit files into a repo (run from the kit)
11687
11759
  update [--from GIT_URL|PATH] [--force] fetch the latest npm package and update kit files
11688
11760
  how how to work with lead: the scheme, where a person is needed
11761
+ commands [--json] the /lead commands with their options, for an interface menu
11762
+ suggest [--json] the command a person would most likely type next, and other options
11689
11763
  enable | disable | enabled turn lead's hooks on or off for you in this repo (local, not in git)
11690
11764
  mode [auto|approve|clear] how lead treats a step inside the plan (local, not in git)
11691
11765
  adopt --input FILE --id ID --home REPO [--flag KEY] [--write] [--force] [--json]
@@ -11753,7 +11827,7 @@ function main(argv, out = (s) => console.log(s)) {
11753
11827
  const session = hookInput.session_id ?? str2(flags.session) ?? process.env.LEAD_SESSION;
11754
11828
  let scope;
11755
11829
  let sharedKit;
11756
- if (cmd && !["help", "--help", "version", "how", "install"].includes(cmd)) {
11830
+ if (cmd && !["help", "--help", "version", "how", "install", "commands"].includes(cmd)) {
11757
11831
  try {
11758
11832
  const runningKit = kitRoot();
11759
11833
  const deployed = basename3(runningKit) === "workspace-kit" && basename3(dirname6(runningKit)) === ".lead";
@@ -11868,6 +11942,16 @@ ${entry.source}:${entry.line}
11868
11942
  case "version":
11869
11943
  out(VERSION);
11870
11944
  return 0;
11945
+ case "suggest": {
11946
+ const gctx = loadContext(cwd, project);
11947
+ const g = suggest(status(gctx, { session, isMerged: gitMergedChecker(gctx.root) }).next);
11948
+ if (flags.json) out(JSON.stringify(g, null, 2));
11949
+ else {
11950
+ out(`${g.command} \u2014 ${g.reason}`);
11951
+ for (const o of g.options) out(` ${o.command} ${o.label}`);
11952
+ }
11953
+ return 0;
11954
+ }
11871
11955
  case "status": {
11872
11956
  const sctx = loadContext(cwd, project);
11873
11957
  const s = status(sctx, { session, isMerged: gitMergedChecker(sctx.root) });
@@ -12358,6 +12442,10 @@ start the builder with: ${r.launch}`);
12358
12442
  case "how":
12359
12443
  out(TEMPLATES["how.md"].trim());
12360
12444
  return 0;
12445
+ case "commands":
12446
+ if (flags.json) out(JSON.stringify({ version: VERSION, prefix: "/lead", commands: COMMANDS }, null, 2));
12447
+ else for (const c of COMMANDS) out(`/lead${c.name ? ` ${c.name}` : ""}${c.arg ? ` ${c.arg}` : ""} \u2014 ${c.summary}${c.options ? ` (${c.options.map((o) => o.name).join(", ")})` : ""}`);
12448
+ return 0;
12361
12449
  case "adopt": {
12362
12450
  const root = repoRoot(cwd);
12363
12451
  const input = typeof flags.input === "string" ? flags.input : "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fusebase/harness-lead",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "type": "module",
5
5
  "description": "Dev-loop kit for coding agents: plan, clean room, tasks and waves as Markdown in your repo.",
6
6
  "license": "UNLICENSED",