Remove stepCount/stepSize; patterns own their geometry
The stepCount and stepSize knobs were two controls for one quantity users actually care about (reach), and the number of steps is an implementation detail nobody meaningfully tunes. Each pattern has a natural size and resolution — a jitter is inherently small, an arc a broad curve — so those now live as constants in each strategy rather than as global config. - strategies.ts: each pattern defines its own step count and size; MoveContext drops `config` down to pure geometry (start/width/height/rng), and the module no longer imports Config at all (dissolving the type-only-import cycle workaround). line stays byte-for-byte: 250 one-pixel steps. - executor.ts: executePath takes `config` for pacing (stepDelay); the path itself needs nothing from it. - config.ts / cli.ts / move.ts / config.default.json: drop stepCount and stepSize from the type, seed, validation, resolver, CLI flags (-n, -s), and help. stepDelay stays as the one pacing lever. - configFile.ts: tolerate the removed keys instead of rejecting them — every pre-1.3.0 install seeded stepCount, so a hard "unknown key" failure on upgrade is avoided. They're ignored with a one-line stderr notice; genuine unknown keys still error. The -n/--step-count CLI flag (shipped since 1.0.0) is now an unknown option; config files degrade gracefully, command lines don't. Stays in the unpushed 1.3.0 release. 64 tests pass.
This commit is contained in:
+8
-3
@@ -23,6 +23,7 @@
|
||||
* without every rounded step being misread as "the user moved the mouse".
|
||||
*/
|
||||
|
||||
import type { Config } from "./config.ts";
|
||||
import type { Device, Point } from "./device.ts";
|
||||
import type { BoundsPolicy, MoveContext, MovementStrategy } from "./strategies.ts";
|
||||
|
||||
@@ -138,21 +139,25 @@ function timestamp(): string {
|
||||
* Contract, per step:
|
||||
* 1. Resolve the ideal target to an on-screen integer (bounds policy).
|
||||
* An `abort`-policy out-of-bounds target ends the sweep (`aborted`).
|
||||
* 2. Command the cursor there and sleep `stepDelay` — also the user's
|
||||
* interrupt window.
|
||||
* 2. Command the cursor there and sleep `config.stepDelay` — also the
|
||||
* user's interrupt window.
|
||||
* 3. Re-read the cursor. If it isn't at the point we just commanded, the
|
||||
* user moved it: return `interrupted` without restoring.
|
||||
*
|
||||
* On a clean run the cursor is restored to `ctx.start` so the next
|
||||
* idle-check sees no net movement, and `completed` is returned.
|
||||
*
|
||||
* `config` supplies only the pacing (`stepDelay`); a strategy's geometry is
|
||||
* entirely self-contained, so the path itself needs nothing from it.
|
||||
*/
|
||||
export async function executePath(
|
||||
strategy: MovementStrategy,
|
||||
ctx: MoveContext,
|
||||
device: Device,
|
||||
log: Logger,
|
||||
config: Config,
|
||||
): Promise<SweepOutcome> {
|
||||
const { start, width, height, config } = ctx;
|
||||
const { start, width, height } = ctx;
|
||||
|
||||
log.event(`Simulating activity (${strategy.name}) at ${timestamp()}...`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user