Add loop mode (--loop): repeat movement until user activity
Introduce a continuous "loop" setting so a triggered sweep keeps the
cursor moving until the user moves the mouse (or Ctrl+C), instead of
firing a single sweep.
- strategies.ts: add optional `loopPath` to MovementStrategy; give `line`
and `diagonal` infinite loop generators that pick a direction once and
ramp forever (4px/step). Their finite `path` and declared `bounds` are
unchanged, so single-sweep behavior is identical.
- executor.ts: add ExecuteOptions { restore?, bounds?, loop? }. Omitting
options reproduces the original single-sweep contract exactly.
- keeper.ts: in loop mode, run an infinite loopPath once (stopped only by
interruption) or chain a finite path cycle after cycle; force `reflect`
bounds for every pattern and suppress the between-cycle restore, so
line/diagonal bounce edge-to-edge instead of stopping at the first edge.
- config plumbing: new boolean `loop` through config.default.json,
config.ts, configFile.ts, cli.ts (-l/--loop), and move.ts, mirroring
the existing `verbose` precedence.
- docs: README loop-mode section + usage/validation updates; CHANGELOG
Unreleased entry.
- tests: loopPath generators, executor options (bounds override, loop
selection, restore suppression), config/configFile loop plumbing, and
keeper-level loop behavior (ramps far vs. bounded single-sweep, chained
cycles). 79 pass.
This commit is contained in:
@@ -98,6 +98,17 @@ describe("loadConfigFile (explicit path)", () => {
|
||||
expect(() => loadConfigFile(path)).toThrow(/'verbose'.*boolean/);
|
||||
});
|
||||
|
||||
test("accepts a boolean loop", () => {
|
||||
const path = writeFixture("loop.json", JSON.stringify({ loop: true }));
|
||||
const result = loadConfigFile(path);
|
||||
expect(result!.loop).toBe(true);
|
||||
});
|
||||
|
||||
test("throws when loop is the wrong type", () => {
|
||||
const path = writeFixture("loop-bad.json", JSON.stringify({ loop: "yes" }));
|
||||
expect(() => loadConfigFile(path)).toThrow(/'loop'.*boolean/);
|
||||
});
|
||||
|
||||
test("accepts a known pattern", () => {
|
||||
const path = writeFixture("pattern.json", JSON.stringify({ pattern: "arc" }));
|
||||
const result = loadConfigFile(path);
|
||||
|
||||
Reference in New Issue
Block a user