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:
@@ -90,11 +90,10 @@ Options:
|
||||
-m, --move-interval <seconds> Idle time before a sweep fires. Default: 240.
|
||||
-c, --check-interval <seconds> Cursor poll cadence. Default: 10.
|
||||
-d, --step-delay <ms> Pause between synthetic steps. Default: 50.
|
||||
-n, --step-count <count> Steps per sweep. Default: 250.
|
||||
-s, --step-size <pixels> Pixels moved per step. Default: 1.
|
||||
-p, --pattern <name> Movement strategy. Default: line.
|
||||
One of: line, diagonal, jitter, walk, arc,
|
||||
figureEight.
|
||||
figureEight. Each pattern defines its own
|
||||
size and speed.
|
||||
-V, --verbose Log every sweep, interrupt, and bounds event
|
||||
(default prints only the startup banner).
|
||||
|
||||
@@ -150,8 +149,6 @@ doesn't set.
|
||||
"moveInterval": 240,
|
||||
"checkInterval": 10,
|
||||
"stepDelay": 50,
|
||||
"stepCount": 250,
|
||||
"stepSize": 1,
|
||||
"pattern": "line",
|
||||
"verbose": false
|
||||
}
|
||||
@@ -159,9 +156,13 @@ doesn't set.
|
||||
|
||||
All keys are optional; supply only the ones you want to override. Keys
|
||||
and units mirror the CLI flags exactly: `moveInterval` and
|
||||
`checkInterval` are seconds, `stepDelay` is milliseconds, `stepCount` is
|
||||
a step count, `stepSize` is pixels-per-step, `pattern` is a movement
|
||||
strategy name, `verbose` is a boolean.
|
||||
`checkInterval` are seconds, `stepDelay` is milliseconds, `pattern` is a
|
||||
movement strategy name, `verbose` is a boolean.
|
||||
|
||||
> The obsolete `stepCount` / `stepSize` keys (removed in 1.3.0) are
|
||||
> tolerated for backward compatibility: they're ignored with a one-line
|
||||
> notice rather than rejected, so a config seeded by an older install keeps
|
||||
> working. Sweep size and step count are now properties of each pattern.
|
||||
|
||||
### Editing
|
||||
|
||||
@@ -241,8 +242,6 @@ Defaults live in `src/config.ts` as `DEFAULT_CONFIG`:
|
||||
| `moveInterval` | `4 * 60_000` | `-m`, `--move-interval` | Idle time (ms) required before a synthetic sweep fires. |
|
||||
| `checkInterval` | `10_000` | `-c`, `--check-interval` | How often (ms) the main loop polls the cursor for real activity. |
|
||||
| `stepDelay` | `50` | `-d`, `--step-delay` | Pause (ms) between individual synthetic steps in a sweep. |
|
||||
| `stepCount` | `250` | `-n`, `--step-count` | Number of steps per sweep. |
|
||||
| `stepSize` | `1` | `-s`, `--step-size` | Pixels moved per step. |
|
||||
| `pattern` | `"line"` | `-p`, `--pattern` | Movement strategy name (see Movement strategies below). |
|
||||
|
||||
`-m` and `-c` are accepted in seconds at the CLI; `resolveConfig` converts
|
||||
@@ -287,20 +286,22 @@ grabbing the mouse. `line` uses the `abort` policy and is unaffected.
|
||||
|
||||
`config.pattern` selects one of the generators in `src/strategies.ts`:
|
||||
|
||||
| Name | Motion | Bounds |
|
||||
| ------------- | ------------------------------------------------------------- | --------- |
|
||||
| `line` | Straight horizontal sweep (the original behavior). | `abort` |
|
||||
| `diagonal` | Straight line on both axes toward the roomiest corner. | `clamp` |
|
||||
| `jitter` | Small random hops within a local radius that scales with reach. | `clamp` |
|
||||
| `walk` | Cumulative random walk; bounces off the screen edges. | `reflect` |
|
||||
| `arc` | Smooth quadratic-Bézier curve to a random on-screen point. | `clamp` |
|
||||
| `figureEight` | Traces a figure-eight (lemniscate) and returns to the start. | `clamp` |
|
||||
| Name | Motion | Steps | Size | Bounds |
|
||||
| ------------- | ------------------------------------------------------------- | ----- | -------- | --------- |
|
||||
| `line` | Straight horizontal sweep (the original behavior). | 250 | 250px | `abort` |
|
||||
| `diagonal` | Straight line on both axes toward the roomiest corner. | 250 | 250px/axis | `clamp` |
|
||||
| `jitter` | Small random hops within a tight radius of the start. | 80 | 30px radius | `clamp` |
|
||||
| `walk` | Cumulative random walk; bounces off the screen edges. | 200 | ±4px/step | `reflect` |
|
||||
| `arc` | Smooth quadratic-Bézier curve to a random on-screen point. | 120 | ~300px | `clamp` |
|
||||
| `figureEight` | Traces a figure-eight (lemniscate) and returns to the start. | 90 | ~250px wide | `clamp` |
|
||||
|
||||
`stepCount` is the number of steps; `stepSize` is how many pixels each step
|
||||
travels (so total reach is `stepCount * stepSize`). With the default
|
||||
`stepSize` of 1, `line` produces the identical 1px-per-step path it always
|
||||
has. To add a pattern, write one pure generator and register it — the
|
||||
executor supplies bounds, pacing, interrupt, and restore for free.
|
||||
Each pattern owns its geometry — how many steps it takes and how far it
|
||||
reaches — as constants in `src/strategies.ts`. Those are properties of the
|
||||
pattern, not user preferences, so there is no knob for sweep size or step
|
||||
count; `stepDelay` (the per-step pause) is the only pacing lever, and it
|
||||
scales every pattern's total duration. To add a pattern, write one pure
|
||||
generator and register it — the executor supplies bounds, pacing, interrupt,
|
||||
and restore for free.
|
||||
|
||||
### Why `mouse.config.autoDelayMs = 0`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user