compounding-loop 0.1.0 → 0.2.0

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.
Files changed (71) hide show
  1. package/README.md +36 -6
  2. package/dist/cli/checkLanes.js +60 -0
  3. package/dist/cli/checkLanes.js.map +1 -0
  4. package/dist/cli/doctor.js +54 -0
  5. package/dist/cli/doctor.js.map +1 -0
  6. package/dist/cli/index.js +87 -3
  7. package/dist/cli/index.js.map +1 -1
  8. package/dist/cli/init.js +2 -1
  9. package/dist/cli/init.js.map +1 -1
  10. package/dist/cli/laneStatus.js +52 -0
  11. package/dist/cli/laneStatus.js.map +1 -0
  12. package/dist/cli/lanesInit.js +56 -0
  13. package/dist/cli/lanesInit.js.map +1 -0
  14. package/dist/cli/lock.js +42 -0
  15. package/dist/cli/lock.js.map +1 -0
  16. package/dist/cli/loops.js +23 -3
  17. package/dist/cli/loops.js.map +1 -1
  18. package/dist/cli/new.js +5 -5
  19. package/dist/cli/new.js.map +1 -1
  20. package/dist/cli/run.js +104 -16
  21. package/dist/cli/run.js.map +1 -1
  22. package/dist/core/doctor.js +49 -0
  23. package/dist/core/doctor.js.map +1 -0
  24. package/dist/core/laneStatus.js +82 -0
  25. package/dist/core/laneStatus.js.map +1 -0
  26. package/dist/core/lanes.js +139 -0
  27. package/dist/core/lanes.js.map +1 -0
  28. package/dist/core/lanesInit.js +143 -0
  29. package/dist/core/lanesInit.js.map +1 -0
  30. package/dist/core/runPrompt.js +1 -1
  31. package/dist/core/table.js +20 -1
  32. package/dist/core/table.js.map +1 -1
  33. package/dist/server/data.js +20 -6
  34. package/dist/server/data.js.map +1 -1
  35. package/dist/server/events.js +1 -0
  36. package/dist/server/events.js.map +1 -1
  37. package/dist/server/health.js +65 -5
  38. package/dist/server/health.js.map +1 -1
  39. package/dist/server/loops.js +6 -3
  40. package/dist/server/loops.js.map +1 -1
  41. package/dist/server/this-repo.json +371 -0
  42. package/dist/web/assets/index-B16QCSnY.css +2 -0
  43. package/dist/web/assets/index-CS82DKbF.js +49 -0
  44. package/dist/web/index.html +3 -3
  45. package/method/COMPOUNDING_LOOP.md +34 -0
  46. package/method/example/K-0002.md +16 -0
  47. package/method/example/K-0003.md +16 -0
  48. package/package.json +6 -1
  49. package/plugin/.claude-plugin/plugin.json +1 -1
  50. package/runners/github-actions/lanes.yml +103 -0
  51. package/runners/local/README.md +2 -1
  52. package/runners/local/launchd.plist +36 -0
  53. package/runners/routine/README.md +38 -1
  54. package/runners/routine/control-room-prompt.md +16 -0
  55. package/runners/routine/lane-prompt.md +12 -0
  56. package/runners/routine/prompt.md +1 -1
  57. package/templates/chrome-extension/extension/icons/icon128.png +0 -0
  58. package/templates/chrome-extension/extension/icons/icon16.png +0 -0
  59. package/templates/chrome-extension/extension/icons/icon48.png +0 -0
  60. package/templates/chrome-extension/extension/manifest.json +19 -3
  61. package/templates/chrome-extension/gitignore +1 -1
  62. package/templates/lanes/README.md +23 -0
  63. package/templates/lanes/ci-check-lanes.yml +38 -0
  64. package/templates/lanes/claude-section.md +17 -0
  65. package/templates/lanes/control-room.md +3 -0
  66. package/templates/lanes/outbox.md +5 -0
  67. package/templates/lanes/task.md +36 -0
  68. package/templates/static-site/.ai/loop-prompt.md +1 -1
  69. package/templates/static-site/gitignore +1 -1
  70. package/dist/web/assets/index-BDdtnG33.js +0 -49
  71. package/dist/web/assets/index-D3-N8DN4.css +0 -2
package/README.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # Compounding Loop
2
2
 
3
- **Write the brief, check back tomorrow.** Unattended, verified Claude Code build loops with a local dashboard.
3
+ **Write the brief, check back tomorrow.** Several unattended Claude Code lanes, one repo, each lane owning its own paths so they do not step on each other, every round verified by your own tests. Local dashboard included.
4
4
 
5
5
  ```sh
6
6
  npx compounding-loop init
7
7
  ```
8
8
 
9
- ![The Compounding Loop dashboard showing five finished loops](docs/assets/dashboard.png)
9
+ [![npm](https://img.shields.io/npm/v/compounding-loop)](https://www.npmjs.com/package/compounding-loop) [![CI](https://github.com/Minntooos/Compounding-Loop/actions/workflows/ci.yml/badge.svg)](https://github.com/Minntooos/Compounding-Loop/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
10
+
11
+ **[Live demo](https://minntooos.github.io/Compounding-Loop/)**: the dashboard on the real five-site data, in your browser.
12
+
13
+ ![The Compounding Loop fleet screen: six loops, one with lanes](docs/assets/screens/fleet-light-laptop.png)
14
+
15
+ ![A loop's detail screen in the dark theme](docs/assets/screens/loop-dark-laptop.png)
16
+
17
+ **Lanes:** each lane is a scheduled run that owns a set of paths (`.ai/lanes.json`). `loop check-lanes` fails any commit that touches files outside its lane, so parallel runs do not collide. This repo is the proof: five lanes (core, kit, server, web, docs) built and documented it by pushing to one `main`. See [Lanes](docs/lanes.md).
10
18
 
11
19
  Most agent tools show a demo. This one ships with proof: the method in this repo built five live sites, 215 pages in all, with nobody watching, and made **verification** the product. A round only counts when the repo's own tests pass and a reviewer that did not write the code has checked the diff.
12
20
 
@@ -57,6 +65,8 @@ npx compounding-loop run # one round now
57
65
  npx compounding-loop dashboard # the local dashboard
58
66
  ```
59
67
 
68
+ Several lanes in one repo (needs an `IDEA.md` brief first): `npx compounding-loop init --lanes core,web,docs`, then `npx compounding-loop run --lane core`. Check ownership with `npx compounding-loop check-lanes`. Details: [Lanes](docs/lanes.md).
69
+
60
70
  Already have a repo? `npx compounding-loop init` adds the method to it without overwriting anything. Details: [Getting started](docs/getting-started.md).
61
71
 
62
72
  ## Just loop the agent?
@@ -75,17 +85,37 @@ An honest comparison with `while true; do claude -p "keep going"; done`:
75
85
 
76
86
  If your task is one afternoon of work and you are at the keyboard, a plain loop is fine. This pays off for work that runs for days.
77
87
 
88
+ ## How it differs from other tools
89
+
90
+ These tools solve a neighbouring problem: running several agents side by side while you watch. Compounding Loop is for work that runs unattended and has to prove itself. Descriptions come from each project's own page (checked 2026-10-08).
91
+
92
+ | Tool | What it is for | Where Compounding Loop differs |
93
+ |---|---|---|
94
+ | [Claude Squad](https://github.com/smtg-ai/claude-squad) | A terminal app that manages several agents, each in its own tmux session and git worktree; an experimental `-y` flag auto-accepts prompts. | Squad isolates work by branch. We isolate by path ownership on one `main`, and a round only counts when your tests and a reviewer pass. |
95
+ | [Parallel Code](https://github.com/johannesjo/parallel-code) | Runs several agents at once, each in its own git worktree; you merge the branch back yourself. | Interactive and merge-driven. We are scheduled, and the agent never marks itself done. |
96
+ | [Agent Orchestrator](https://github.com/ComposioHQ/agent-orchestrator) | A local desktop workspace where an orchestrator delegates work to agents on separate branches and worktrees, shown on a Kanban board. | A desktop planner. We are a plain-file method (task file, notes, handoffs) you can read in git. |
97
+ | [Vibe Kanban](https://github.com/BloopAI/vibe-kanban) | Plan issues on a kanban board, then run coding agents in workspaces with a branch and a terminal. Its page says it is sunsetting. | We have no board; the contract is a file of checkable commands. |
98
+ | [Claude Code agent teams](https://code.claude.com/docs/en/agent-teams) | Experimental, off by default: a lead session coordinates teammates with a shared task list and messages. Needs an interactive session (not `claude -p`). | Teams are live and interactive. Lanes are scheduled, unattended and leave a git trail. They can be combined. |
99
+
100
+ If you work at the keyboard and want to watch agents in parallel, those tools are a good fit.
101
+
78
102
  ## Docs
79
103
 
80
- [Getting started](docs/getting-started.md) · [Concepts](docs/concepts.md) · [Runners](docs/runners.md) · [Dashboard](docs/dashboard.md) · [Templates](docs/templates.md) · [FAQ](docs/faq.md) · [Troubleshooting](docs/troubleshooting.md) · [Contributing](CONTRIBUTING.md)
104
+ [Getting started](docs/getting-started.md) · [Lanes](docs/lanes.md) · [Concepts](docs/concepts.md) · [Runners](docs/runners.md) · [Dashboard](docs/dashboard.md) · [Templates](docs/templates.md) · [FAQ](docs/faq.md) · [Troubleshooting](docs/troubleshooting.md) · [Contributing](CONTRIBUTING.md)
81
105
 
82
106
  ## FAQ
83
107
 
84
- **What does it cost?** The tool is free and MIT licensed. Your Claude Code plan pays for the runs; the budget (`Run: N / LIMIT`) caps how many happen.
108
+ **Isn't this cron + `claude -p`?** Partly, and the table above shows what is added: your checks decide when a round is done, a fresh reviewer attacks the diff, each run writes a handoff and notes the next run reads, a run budget stops runaway loops, and lanes keep parallel runs out of each other's files.
109
+
110
+ **What does it cost (plan usage vs API)?** The tool is free and MIT licensed. Runs use whatever your Claude Code login uses: plan usage on a subscription, or API billing if you authenticate with a key. The `Run: N / LIMIT` budget caps how many runs happen. More lanes means more runs, so cost scales with lanes times runs.
111
+
112
+ **Why not agent teams?** Agent teams are experimental, off by default and need an interactive session ([docs](https://code.claude.com/docs/en/agent-teams)). Lanes are for scheduled runs nobody is watching. Use teams when you are at the keyboard; use lanes when you are away.
113
+
114
+ **What happens when it goes wrong?** A red round is discarded and logged under Tried. The same failure twice triggers the stuck protocol, then a `BLOCKED.md` appears in your dashboard inbox. When the run budget is reached the lane stops. Everything is a git commit, so it is reversible. See [Troubleshooting](docs/troubleshooting.md).
85
115
 
86
- **Is it safe?** The dashboard binds to loopback, there is no telemetry and no call home, and tokens come from your environment or `gh` and are never stored. The loop works on branches or `main` as you configure; read [SECURITY.md](SECURITY.md).
116
+ **Is my code sent anywhere?** Only what Claude Code and git already send. Compounding Loop has no telemetry and no call home, the dashboard binds to loopback, and tokens come from your environment or `gh` and are never stored. See [SECURITY.md](SECURITY.md).
87
117
 
88
- **What won't it do?** It will not publish, spend money, create accounts or change repo settings on its own, and it stops and asks (`BLOCKED.md`) rather than guess when the brief contradicts reality.
118
+ **What won't it do?** It will not publish, spend money, create accounts or change repo settings on its own, and it stops and asks (`BLOCKED.md`) rather than guess.
89
119
 
90
120
  **Does it need a GitHub login?** Only to create a private repo with `loop new`; `--dry-run` and every test work offline.
91
121
 
@@ -0,0 +1,60 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { readFile } from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import { promisify } from 'node:util';
5
+ import { checkCommitFiles, parseLaneTrailer, parseLanesConfig } from '../core/lanes.js';
6
+ const execFileAsync = promisify(execFile);
7
+ // core.quotepath=false keeps non-ASCII names readable in git's output.
8
+ const git = async (cwd, ...args) => (await execFileAsync('git', ['-c', 'core.quotepath=false', ...args], { cwd, maxBuffer: 64 * 1024 * 1024 })).stdout;
9
+ const RECORD = '\u001e';
10
+ /** Checks every commit in `range` (default: the last 50 commits) against `.ai/lanes.json`. */
11
+ export async function runCheckLanes(dir, range) {
12
+ const text = await readFile(path.join(dir, '.ai', 'lanes.json'), 'utf8').catch(() => undefined);
13
+ if (text === undefined)
14
+ throw new Error('No .ai/lanes.json here. Create one with `loop init --lanes a,b,c`.');
15
+ const { config, errors } = parseLanesConfig(text);
16
+ if (!config)
17
+ throw new Error(`.ai/lanes.json is invalid:\n- ${errors.join('\n- ')}`);
18
+ if (!range && !(await git(dir, 'rev-parse', '--verify', '--quiet', 'HEAD').then(() => true, () => false))) {
19
+ return { checked: 0, untagged: [], skipped: [], problems: [] };
20
+ }
21
+ const log = await git(dir, 'log', '--no-merges', `--format=${RECORD}%H%n%B`, ...(range ? [range] : ['-n', '50'])).catch((error) => {
22
+ throw new Error(`git could not read ${range ?? 'the history'}: ${error instanceof Error ? error.message.split('\n')[0] : String(error)}. Check the range (for example origin/main..HEAD).`);
23
+ });
24
+ const result = { checked: 0, untagged: [], skipped: [], problems: [] };
25
+ const shallow = (await git(dir, 'rev-parse', '--is-shallow-repository')).trim() === 'true';
26
+ for (const record of log.split(RECORD).filter((r) => r.trim() !== '')) {
27
+ const [hash = '', ...body] = record.split('\n');
28
+ const short = hash.slice(0, 7);
29
+ result.checked++;
30
+ const lane = parseLaneTrailer(body.join('\n'));
31
+ if (!lane) {
32
+ result.untagged.push(short);
33
+ continue;
34
+ }
35
+ // Without its parent, a shallow clone's oldest commit would look like it added every file.
36
+ if (shallow && (await git(dir, 'rev-list', '--parents', '-n', '1', hash)).trim().split(' ').length === 1) {
37
+ result.skipped.push(short);
38
+ continue;
39
+ }
40
+ const files = (await git(dir, 'diff-tree', '-z', '--no-commit-id', '--name-only', '-r', '--root', hash)).split('\0').filter(Boolean);
41
+ for (const violation of checkCommitFiles(config, lane, files))
42
+ result.problems.push(`${short} (Lane: ${lane}): ${violation.message}`);
43
+ }
44
+ return result;
45
+ }
46
+ export function formatLaneCheck(result) {
47
+ const lines = [`Checked ${result.checked} commit(s).`];
48
+ if (result.checked === 0)
49
+ lines.push('Nothing to check: no commits in the range (or no commits yet). If you passed --range, is it right (for example origin/main..HEAD)?');
50
+ if (result.skipped.length > 0)
51
+ lines.push(`${result.skipped.length} skipped because this is a shallow clone (${result.skipped.join(', ')}). Use fetch-depth: 0 to check them.`);
52
+ if (result.untagged.length > 0)
53
+ lines.push(`${result.untagged.length} without a Lane: trailer (not an error): ${result.untagged.join(', ')}`);
54
+ if (result.problems.length === 0)
55
+ lines.push('All lane-tagged commits stayed in their lane.');
56
+ else
57
+ lines.push(...result.problems.map((p) => `FAIL ${p}`));
58
+ return lines.join('\n');
59
+ }
60
+ //# sourceMappingURL=checkLanes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkLanes.js","sourceRoot":"","sources":["../../src/cli/checkLanes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAExF,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC1C,uEAAuE;AACvE,MAAM,GAAG,GAAG,KAAK,EAAE,GAAW,EAAE,GAAG,IAAc,EAAE,EAAE,CAAC,CAAC,MAAM,aAAa,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,sBAAsB,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,GAAG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AC,EAAE,CAAC,CAAC;IAC9I,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;;QACzF,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5D,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { readdir } from 'node:fs/promises';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { promisify } from 'node:util';
6
+ import { doctorPassed, evaluateDoctor, formatDoctor } from '../core/doctor.js';
7
+ import { resolveInvocation } from './run.js';
8
+ const execFileAsync = promisify(execFile);
9
+ /** Runs `command args` and reports success plus its first output; never throws. */
10
+ export async function probe(command, args) {
11
+ try {
12
+ const invocation = await resolveInvocation(command, args);
13
+ const { stdout, stderr } = await execFileAsync(invocation.command, invocation.args, { timeout: 15_000 });
14
+ return { ok: true, output: stdout.trim() || stderr.trim() };
15
+ }
16
+ catch (error) {
17
+ return { ok: false, output: error instanceof Error ? error.message : String(error) };
18
+ }
19
+ }
20
+ /** Folders where Playwright keeps downloaded browsers, most specific first. */
21
+ export function playwrightCacheDirs(env, platform, home) {
22
+ const custom = env.PLAYWRIGHT_BROWSERS_PATH;
23
+ if (custom && custom !== '0')
24
+ return [custom];
25
+ if (platform === 'win32')
26
+ return [path.win32.join(env.LOCALAPPDATA ?? path.win32.join(home, 'AppData', 'Local'), 'ms-playwright')];
27
+ if (platform === 'darwin')
28
+ return [path.posix.join(home, 'Library', 'Caches', 'ms-playwright')];
29
+ return [path.posix.join(home, '.cache', 'ms-playwright'), '/opt/pw-browsers'];
30
+ }
31
+ export async function findChromium(dirs, list = (dir) => readdir(dir)) {
32
+ for (const dir of dirs) {
33
+ const found = (await list(dir).catch(() => [])).find((name) => /^chromium(?:_headless_shell)?-\d+$/.test(name));
34
+ if (found)
35
+ return path.join(dir, found);
36
+ }
37
+ return undefined;
38
+ }
39
+ export async function gatherDoctorInput() {
40
+ const gh = await probe('gh', ['--version']);
41
+ const [git, claude, ghAuth, chromium] = await Promise.all([
42
+ probe('git', ['--version']),
43
+ probe('claude', ['--version']),
44
+ gh.ok ? probe('gh', ['auth', 'status']) : Promise.resolve({ ok: false, output: 'gh missing' }),
45
+ findChromium(playwrightCacheDirs(process.env, process.platform, os.homedir())),
46
+ ]);
47
+ return { nodeVersion: process.version, git, gh, ghAuth, claude, chromium };
48
+ }
49
+ /** `loop doctor`: prints the report and returns whether every required tool is present. */
50
+ export async function runDoctor(gather = gatherDoctorInput) {
51
+ const checks = evaluateDoctor(await gather());
52
+ return { report: formatDoctor(checks), passed: doctorPassed(checks) };
53
+ }
54
+ //# sourceMappingURL=doctor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAsC,MAAM,mBAAmB,CAAC;AACnH,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,mFAAmF;AACnF,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,OAAe,EAAE,IAAc;IACzD,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC,OA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CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC7E,CAAC;AAED,2FAA2F;AAC3F,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,MAAM,GAA+B,iBAAiB;IACpF,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,MAAM,EAAE,CAAC,CAAC;IAC9C,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;AACxE,CAAC"}
package/dist/cli/index.js CHANGED
@@ -1,6 +1,10 @@
1
1
  import { Command } from 'commander';
2
2
  import { readFileSync } from 'node:fs';
3
3
  import path from 'node:path';
4
+ import { formatLaneCheck, runCheckLanes } from './checkLanes.js';
5
+ import { runDoctor } from './doctor.js';
6
+ import { runAddLanes } from './lanesInit.js';
7
+ import { parseLaneList } from '../core/lanesInit.js';
4
8
  import { DEFAULT_PORT, runDashboard } from './dashboard.js';
5
9
  import { realGh } from './gh.js';
6
10
  import { runInit } from './init.js';
@@ -18,8 +22,15 @@ program
18
22
  .argument('[dir]', 'target repo folder', '.')
19
23
  .option('--force', 'skip the brief check and overwrite existing kit files')
20
24
  .option('--dry-run', 'show what would be written without writing')
25
+ .option('--lanes <names>', 'also set up parallel lanes, e.g. --lanes core,web,docs (writes .ai/lanes.json and per-lane files)')
21
26
  .action(async (dir, options) => {
22
- const result = await runInit(path.resolve(dir), { force: Boolean(options.force), dryRun: Boolean(options.dryRun) });
27
+ const laneList = options.lanes === undefined ? undefined : parseLaneList(options.lanes);
28
+ if (laneList?.error) {
29
+ console.error(laneList.error);
30
+ process.exitCode = 1;
31
+ return;
32
+ }
33
+ const result = await runInit(path.resolve(dir), { force: Boolean(options.force), dryRun: Boolean(options.dryRun), ...(laneList && { skipTask: true }) });
23
34
  if (result.refused) {
24
35
  console.error(result.refused);
25
36
  process.exitCode = 1;
@@ -31,6 +42,43 @@ program
31
42
  console.error('warning: the Operating Card was NOT installed, so CLAUDE.md is unchanged.');
32
43
  for (const rel of result.missing)
33
44
  console.error(`warning: ${rel} is not in this package yet; used a built-in fallback or skipped it`);
45
+ if (laneList) {
46
+ try {
47
+ const lanes = await runAddLanes(path.resolve(dir), laneList.names.map((name) => ({ name, owns: [`${name}/**`] })), { force: Boolean(options.force), dryRun: Boolean(options.dryRun), existingOk: true });
48
+ for (const action of lanes.actions)
49
+ console.log(`${action.kind.padEnd(9)} ${action.dest}${action.reason ? ` (${action.reason})` : ''}`);
50
+ for (const rel of lanes.missing)
51
+ console.error(`warning: ${rel} is not in this package yet; used a built-in fallback`);
52
+ console.log('Each lane owns `<name>/**` for now: edit "owns" in .ai/lanes.json to match your folders, then run `loop check-lanes`.');
53
+ }
54
+ catch (error) {
55
+ fail(error);
56
+ }
57
+ }
58
+ });
59
+ const lanesCommand = program.command('lanes').description('Manage parallel lanes (see .ai/lanes.json)');
60
+ lanesCommand
61
+ .command('add')
62
+ .description('Add a lane that owns the given path globs, with its task file and outbox')
63
+ .argument('<name>', 'lane name: lowercase letters, digits, dashes')
64
+ .requiredOption('--owns <globs...>', 'path globs this lane owns, e.g. --owns "src/api/**" "tests/api/**"')
65
+ .option('--cron <cron>', 'cron expression for the lane (default: next staggered hourly minute)')
66
+ .option('--dir <dir>', 'repo folder', '.')
67
+ .option('--dry-run', 'show what would be written without writing')
68
+ .action(async (name, options) => {
69
+ try {
70
+ const parsed = parseLaneList(name);
71
+ if (parsed.error || parsed.names.length !== 1)
72
+ throw new Error(parsed.error ?? 'Add one lane at a time.');
73
+ const lanes = await runAddLanes(path.resolve(options.dir), [{ name, owns: options.owns, ...(options.cron && { cron: options.cron }) }], { force: false, dryRun: Boolean(options.dryRun) });
74
+ for (const action of lanes.actions)
75
+ console.log(`${action.kind.padEnd(9)} ${action.dest}${action.reason ? ` (${action.reason})` : ''}`);
76
+ for (const rel of lanes.missing)
77
+ console.error(`warning: ${rel} is not in this package yet; used a built-in fallback`);
78
+ }
79
+ catch (error) {
80
+ fail(error);
81
+ }
34
82
  });
35
83
  program
36
84
  .command('new')
@@ -87,13 +135,17 @@ program
87
135
  .argument('[answer]', 'your answer; omit with --accept to take the agent\'s best guess')
88
136
  .option('--accept', 'accept the best guess in BLOCKED.md')
89
137
  .option('--dir <dir>', 'loop folder', '.')
138
+ .option('--push', 'push the commit so the loop restarts without another step')
90
139
  .option('--dry-run', 'show the question and answer without writing')
91
140
  .action(async (answer, options) => {
92
141
  try {
93
142
  if (!options.accept && !answer)
94
143
  throw new Error('Pass an answer, or --accept to take the best guess.');
95
- const result = await runAnswer(path.resolve(options.dir), options.accept ? 'accept' : (answer ?? ''), { dryRun: Boolean(options.dryRun) });
96
- console.log(`Question: ${result.question}\nAnswer: ${result.answer}${options.dryRun ? '\n(dry run: nothing written)' : '\nCommitted. Push to restart the loop.'}`);
144
+ const result = await runAnswer(path.resolve(options.dir), options.accept ? 'accept' : (answer ?? ''), { dryRun: Boolean(options.dryRun), push: Boolean(options.push) });
145
+ const ending = options.dryRun ? '\n(dry run: nothing written)' : result.pushed ? '\nCommitted and pushed. The loop restarts on its next run.' : result.pushed === false ? `\nCommitted, but the push failed: ${result.pushError}\nFix that (for a rejected push: \`git pull --rebase && git push\`) to restart the loop.` : '\nCommitted. Push (or use --push next time) to restart the loop.';
146
+ console.log(`Question: ${result.question}\nAnswer: ${result.answer}${ending}`);
147
+ if (result.pushed === false)
148
+ process.exitCode = 1;
97
149
  }
98
150
  catch (error) {
99
151
  fail(error);
@@ -106,10 +158,12 @@ program
106
158
  .option('--dry-run', 'print the prompt and stop; never starts claude')
107
159
  .option('--skip-permissions', 'pass --dangerously-skip-permissions to claude (you accept the risk)')
108
160
  .option('--model <model>', 'model for this round')
161
+ .option('--lane <name>', 'run as this lane from .ai/lanes.json (own task file, outbox and session lock)')
109
162
  .action(async (dir, options) => {
110
163
  try {
111
164
  const result = await runRound(path.resolve(dir), {
112
165
  dryRun: Boolean(options.dryRun), skipPermissions: Boolean(options.skipPermissions), ...(options.model && { model: options.model }),
166
+ ...(options.lane && { lane: options.lane }),
113
167
  });
114
168
  if (result.skipped)
115
169
  console.log(result.skipped);
@@ -140,5 +194,35 @@ program
140
194
  fail(error);
141
195
  }
142
196
  });
197
+ program
198
+ .command('check-lanes')
199
+ .description('Fail if a commit with a "Lane: <name>" trailer touched files outside its lane (see .ai/lanes.json)')
200
+ .argument('[dir]', 'repo folder', '.')
201
+ .option('--range <range>', 'commits to check, e.g. origin/main..HEAD (default: the last 50)')
202
+ .action(async (dir, options) => {
203
+ try {
204
+ const result = await runCheckLanes(path.resolve(dir), options.range);
205
+ console.log(formatLaneCheck(result));
206
+ if (result.problems.length > 0)
207
+ process.exitCode = 1;
208
+ }
209
+ catch (error) {
210
+ fail(error);
211
+ }
212
+ });
213
+ program
214
+ .command('doctor')
215
+ .description('Check that node, git, gh, claude and Playwright Chromium are installed, and say how to fix what is not')
216
+ .action(async () => {
217
+ try {
218
+ const { report, passed } = await runDoctor();
219
+ console.log(report);
220
+ if (!passed)
221
+ process.exitCode = 1;
222
+ }
223
+ catch (error) {
224
+ fail(error);
225
+ }
226
+ });
143
227
  await program.parseAsync();
144
228
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,MAAM,EA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AAC,aAAa,CAAC;KACtB,WAAW,CAAC,oGAAoG,CAAC;KACjH,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,CAAC;KACrC,MAAM,CAAC,iBAAiB,EAAE,iEAAiE,CAAC;KAC5F,MAAM,CAAC,KAAK,EAAE,GAAW,EAAE,OAA2B,EAAE,EAAE;IACzD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QACrE,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;QACrC,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,KAAK,CAAC,CAAC;IACd,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,wGAAwG,CAAC;KACrH,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,EAAE,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpB,IAAI,CAAC,MAAM;YAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,KAAK,CAAC,CAAC;IACd,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC"}
package/dist/cli/init.js CHANGED
@@ -40,7 +40,8 @@ export async function loadKit(root = packageRoot) {
40
40
  return { files, card, missing };
41
41
  }
42
42
  export async function runInit(target, options, kit) {
43
- const loaded = kit ?? (await loadKit());
43
+ const loadedKit = kit ?? (await loadKit());
44
+ const loaded = options.skipTask ? { ...loadedKit, files: loadedKit.files.filter((f) => f.dest !== '.ai/task.md') } : loadedKit;
44
45
  const brief = await readIfExists(path.join(target, 'IDEA.md'));
45
46
  const blocker = options.force ? undefined : briefBlocker(brief);
46
47
  if (blocker)
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAiC,MAAM,iBAAiB,CAAC;AAExF,kGAAkG;AAClG,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE7E,MAAM,cAAc,GAAG,6LAA6L,CAAC;AACrN,MAAM,YAAY,GAAG,4FAA4F,CAAC;AAClH,MAAM,aAAa,GAAG,0NAA0N,CAAC;AAEjP,KAAK,UAAU,YAAY,CAAC,IAAY;IACtC,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AASD,uFAAuF;AACvF,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAI,GAAW,WAAW;IACtD,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,IAAI,GAAG,KAAK,EAAE,GAAW,EAAE,QAAiB,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;QAC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AE,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { readFile, stat } from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import { promisify } from 'node:util';
5
+ import { deriveLaneState, stallMinutesFor, parseOutbox, summarizeOutboxes } from '../core/laneStatus.js';
6
+ import { parseLanesConfig } from '../core/lanes.js';
7
+ import { parseLockTime, parseRunCounter } from '../core/repo.js';
8
+ const execFileAsync = promisify(execFile);
9
+ const read = (file) => readFile(file, 'utf8').catch(() => undefined);
10
+ const exists = (file) => stat(file).then(() => true, () => false);
11
+ async function lastCommitOf(dir, lane) {
12
+ try {
13
+ // Lane names are validated to [a-z0-9-], so they are safe inside the regex. Round 1 commits have only the `<lane>: ` subject prefix.
14
+ const { stdout } = await execFileAsync('git', ['log', '-1', `--grep=^Lane: ${lane}$`, `--grep=^${lane}: `, '--format=%H%x1f%s%x1f%cI'], {
15
+ cwd: dir,
16
+ env: { ...process.env, GIT_CEILING_DIRECTORIES: path.dirname(path.resolve(dir)) },
17
+ });
18
+ const [sha, subject, at] = stdout.trim().split('\u001f');
19
+ return sha && subject !== undefined && at ? { sha, subject, at: new Date(at).toISOString() } : undefined;
20
+ }
21
+ catch {
22
+ return undefined;
23
+ }
24
+ }
25
+ /** One status per lane in `.ai/lanes.json`; undefined when the folder is not a laned loop. */
26
+ export async function readLaneStatuses(dir, now = new Date()) {
27
+ const text = await read(path.join(dir, '.ai', 'lanes.json'));
28
+ const config = text === undefined ? undefined : parseLanesConfig(text).config;
29
+ if (!config)
30
+ return undefined;
31
+ const outboxes = new Map();
32
+ const partial = await Promise.all(config.lanes.map(async ({ name, cron }) => {
33
+ const laneDir = path.join(dir, '.ai', 'lanes', name);
34
+ outboxes.set(name, parseOutbox(name, (await read(path.join(laneDir, 'outbox.md'))) ?? ''));
35
+ const lockText = await read(path.join(laneDir, 'session.lock'));
36
+ const lockAt = lockText === undefined ? undefined : parseLockTime(lockText);
37
+ const lastCommit = await lastCommitOf(dir, name);
38
+ const counter = parseRunCounter((await read(path.join(laneDir, 'task.md'))) ?? '');
39
+ const state = deriveLaneState({
40
+ hasDone: (await exists(path.join(laneDir, 'DONE.md'))) || (await exists(path.join(dir, 'DONE.md'))),
41
+ hasBlocked: (await exists(path.join(laneDir, 'BLOCKED.md'))) || (await exists(path.join(dir, 'BLOCKED.md'))),
42
+ stallMinutes: stallMinutesFor(cron),
43
+ ...(lockAt && { lockAt }),
44
+ ...(lastCommit && { lastCommitAt: new Date(lastCommit.at) }),
45
+ }, now);
46
+ return { name, state, run: counter?.run ?? 0, limit: counter?.limit ?? 0, ...(lastCommit && { lastCommit }), locked: lockAt !== undefined && state === 'building' };
47
+ }));
48
+ const commitTimes = new Map(partial.flatMap((l) => (l.lastCommit ? [[l.name, l.lastCommit.at.slice(0, 16) + ':00.000Z']] : [])));
49
+ const { unanswered, waitingOn } = summarizeOutboxes(outboxes, commitTimes);
50
+ return partial.map((lane) => ({ ...lane, ...(waitingOn.has(lane.name) && { waitingOn: waitingOn.get(lane.name) }), unanswered: unanswered.get(lane.name) ?? [] }));
51
+ }
52
+ //# sourceMappingURL=laneStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"laneStatus.js","sourceRoot":"","sources":["../../src/cli/laneStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,iBAAiB,EAAsB,MAAM,uBAAuB,CAAC;AAC7H,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGjE,MAAM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AAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1I,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,iBAAiB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAC3E,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAa,EAAE,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;AACjL,CAAC"}
@@ -0,0 +1,56 @@
1
+ import { mkdir, readFile, writeFile } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { parseLanesConfig } from '../core/lanes.js';
4
+ import { addLanes, FALLBACK_LANE_TEMPLATES, planLanes, staggeredCron } from '../core/lanesInit.js';
5
+ import { packageRoot } from './init.js';
6
+ const readIfExists = (file) => readFile(file, 'utf8').catch(() => undefined);
7
+ /** Reads `templates/lanes/{task,outbox,control-room,claude-section}.md` from the package, with built-in fallbacks. */
8
+ export async function loadLaneTemplates(root = packageRoot) {
9
+ const missing = [];
10
+ const read = async (name, fallback) => {
11
+ const text = await readIfExists(path.join(root, 'templates', 'lanes', name));
12
+ if (text === undefined)
13
+ missing.push(`templates/lanes/${name}`);
14
+ return text ?? fallback;
15
+ };
16
+ const templates = {
17
+ task: await read('task.md', FALLBACK_LANE_TEMPLATES.task),
18
+ outbox: await read('outbox.md', FALLBACK_LANE_TEMPLATES.outbox),
19
+ controlRoom: await read('control-room.md', FALLBACK_LANE_TEMPLATES.controlRoom),
20
+ claudeSection: await read('claude-section.md', FALLBACK_LANE_TEMPLATES.claudeSection),
21
+ };
22
+ return { templates, missing };
23
+ }
24
+ /** Adds lanes to the repo at `target` (creating `.ai/lanes.json` if needed) and writes their files. */
25
+ export async function runAddLanes(target, additions, options, root = packageRoot) {
26
+ const configText = await readIfExists(path.join(target, '.ai', 'lanes.json'));
27
+ let existing;
28
+ if (configText !== undefined) {
29
+ const parsed = parseLanesConfig(configText);
30
+ if (!parsed.config)
31
+ throw new Error(`.ai/lanes.json is invalid, so lanes cannot be added:\n- ${parsed.errors.join('\n- ')}`);
32
+ existing = parsed.config;
33
+ }
34
+ const fresh = options.existingOk ? additions.filter((l) => !existing?.lanes.some((e) => e.name === l.name)) : additions;
35
+ const config = addLanes(existing, fresh.map((l, i) => ({ ...l, cron: l.cron ?? staggeredCron((existing?.lanes.length ?? 0) + i) })));
36
+ const { templates, missing } = await loadLaneTemplates(root);
37
+ const current = new Map();
38
+ const dests = ['.ai/lanes.json', '.ai/control-room.md', 'CLAUDE.md', 'AGENTS.md', ...additions.flatMap((l) => [`.ai/lanes/${l.name}/task.md`, `.ai/lanes/${l.name}/outbox.md`])];
39
+ for (const dest of dests) {
40
+ const text = await readIfExists(path.join(target, ...dest.split('/')));
41
+ if (text !== undefined)
42
+ current.set(dest, text);
43
+ }
44
+ const actions = planLanes({ config, newLanes: additions.map((l) => l.name), templates, existing: current, force: options.force });
45
+ if (!options.dryRun) {
46
+ for (const action of actions) {
47
+ if (action.content === undefined)
48
+ continue;
49
+ const file = path.join(target, ...action.dest.split('/'));
50
+ await mkdir(path.dirname(file), { recursive: true });
51
+ await writeFile(file, action.content);
52
+ }
53
+ }
54
+ return { actions, missing };
55
+ }
56
+ //# sourceMappingURL=lanesInit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lanesInit.js","sourceRoot":"","sources":["../../src/cli/lanesInit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,gB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,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { rmSync } from 'node:fs';
2
+ import { mkdir, writeFile } from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ /**
5
+ * Holds a session lock file (one UTC timestamp line) while `fn` runs, and removes it when `fn` succeeds, throws,
6
+ * or the process gets Ctrl-C / SIGTERM, so a crashed round never blocks the next one for 90 minutes.
7
+ * On a signal the lock is kept until `fn` settles (the terminal also signals the `claude` child, which needs a moment
8
+ * to stop) or `graceMs` passes, so a second session cannot start while the first is still writing.
9
+ */
10
+ export async function withSessionLock(lockFile, fn, options = {}) {
11
+ const exit = options.exit ?? ((code) => process.exit(code));
12
+ await mkdir(path.dirname(lockFile), { recursive: true });
13
+ await writeFile(lockFile, `${(options.now ?? (() => new Date()))().toISOString()}\n`);
14
+ const release = () => rmSync(lockFile, { force: true });
15
+ const graceMs = options.graceMs ?? 10_000;
16
+ let finished;
17
+ const settled = new Promise((resolve) => { finished = resolve; });
18
+ let signalled = false;
19
+ const onSignal = (code) => () => {
20
+ if (signalled) {
21
+ release();
22
+ exit(code);
23
+ return;
24
+ } // a second Ctrl-C means "now"
25
+ signalled = true;
26
+ const grace = new Promise((resolve) => setTimeout(resolve, graceMs).unref());
27
+ void Promise.race([settled, grace]).finally(() => { release(); exit(code); });
28
+ };
29
+ const handlers = { SIGINT: onSignal(130), SIGTERM: onSignal(143), SIGHUP: onSignal(129) };
30
+ for (const [signal, handler] of Object.entries(handlers))
31
+ process.on(signal, handler);
32
+ try {
33
+ return await fn();
34
+ }
35
+ finally {
36
+ finished();
37
+ for (const [signal, handler] of Object.entries(handlers))
38
+ process.off(signal, handler);
39
+ release();
40
+ }
41
+ }
42
+ //# sourceMappingURL=lock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lock.js","sourceRoot":"","sources":["../../src/cli/lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,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