add: persistent tasks source pref. and runner.toml lsp#76
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
runner | 4e3a4f5 | Commit Preview URL Branch Preview URL |
Jul 01 2026, 05:53 PM |
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
🚫 Excluded labels (none allowed) (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis PR adds a feature-gated Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant Editor
participant runner_lsp as runner lsp
participant Diagnostics
participant Resolver
participant SchemaIndex
Editor->>runner_lsp: didOpen / didChange runner.toml
runner_lsp->>Diagnostics: compute(text, index)
Diagnostics->>Resolver: validate_config(config)
Resolver-->>Diagnostics: diagnostics result
Diagnostics-->>runner_lsp: publishDiagnostics payload
runner_lsp-->>Editor: publishDiagnostics notification
Editor->>runner_lsp: hover / completion request
runner_lsp->>SchemaIndex: look up section/field docs
SchemaIndex-->>runner_lsp: schema-backed hover/completion data
runner_lsp-->>Editor: Hover / CompletionItem[]
Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 7 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (7 passed)
Comment |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
A task name that exists under more than one source (e.g. a package.json script *and* a turbo task) had no persistent, declarative way to choose which one wins — only per-invocation knobs (package.json:build, --pm bun, --runner turbo). The only file knob, [task_runner].prefer, accepted task runners only (not package managers) and *restricted* candidates, so prefer = ["turbo"] hard-rejected a package.json script instead of ranking it. Add a [tasks] section: - [tasks].prefer: rank-only global order over sources. Labels may be task runners, package managers (bun/npm/... -> package.json; deno -> deno.json then package.json), or source names. Never hard-rejects unlisted sources. - [tasks.overrides]: per-task pins (build = "turbo", dev = "bun") that beat the global order for those names. Both ride the existing select_task_entry/source_priority machinery, so an explicit source:task qualifier, --runner, or --pm/RUNNER_PM still outranks the file. Deprecate [task_runner].prefer in favor of [tasks].prefer: it keeps its original restrictive behavior for existing configs but emits a migration warning (superseded when [tasks] is also set), is flagged deprecated in the committed JSON Schema, and is dropped from the `config init` scaffold.
Build with `--features lsp` to get a stdio LSP for runner.toml, exposed as the `runner lsp` subcommand (gated like `man`/`schema`). It reuses the CLI's own internals so editor feedback never drifts from `runner` itself: - diagnostics: the exact `runner config validate` pipeline (TOML parse, unknown keys, resolver field/policy validation) plus the deprecation hints, mapped to buffer ranges and tagged (DEPRECATED) where appropriate; - hover: section/field docs sourced from the generated JSON Schema, i.e. the RunnerConfig doc comments; - completion: section names, field names, and value sets — schema enums plus the code-driven label vocabulary ([tasks] runner/PM/source labels, booleans). Dependencies (lsp-server, lsp-types) and the lsp module are feature-gated, so default builds are unchanged. The server is small and synchronous (full-text sync, one tiny document at a time). `runner lsp` is intercepted before project detection / config load so it starts even when the on-disk file is invalid — exactly when its diagnostics are most useful. To enable reuse, `config::collect_unknown_keys`, `config::deprecation_warnings` (factored out of `config::load`), and `cmd::schema::config_schema` are now pub(crate).
CI's `dprint check` formats Cargo.toml via tombi and Rust via nightly rustfmt. Two files drifted from that: the `lsp` feature's dependency array wasn't alphabetically sorted, and a `format!` string in the deprecation warning wrapped past the nightly-rustfmt width. No behavior change.
2e642db to
4ed3264
Compare
Ship the runner.toml language server (`runner lsp`) in default builds rather than gating it behind an opt-in feature — editor support should work out of the box. `default` now includes `lsp` (which pulls in `schema`). The feature itself is unchanged and can still be disabled with --no-default-features.
132c963 to
c09591c
Compare
- lsp completion: surface `tasks.overrides` in header completion (nested object-typed fields, not just top-level sections); quote string-typed value completions (`pm.node`, `tasks.prefer`, ...) so they insert valid TOML instead of a bare word, while booleans stay unquoted. - lsp diagnostics: anchor `[tasks.overrides]` resolver errors to the offending entry (`"task": ...`), not the section header. - lsp text: `line_range` now strips a trailing `\r` on CRLF buffers. - config: the `[task_runner].prefer` deprecation warning now names whichever `[tasks]` knob actually superseded it (`prefer` vs `overrides`) instead of always claiming `tasks.prefer` is set. - resolver: `[tasks].prefer = ["nx"]` (a label recognized but resolving to no `TaskSource`) no longer looks unset and wrongly falls back to the deprecated, more restrictive `[task_runner].prefer`. - schema: `[tasks].prefer`/`[tasks.overrides]` values are constrained to the closed label vocabulary via a new shared `types::task_source_labels()`, instead of open strings. - README: drop the stale `--features lsp` install note now that `lsp` ships by default.
lsp-types 0.95 dropped its `url`/`serde_derive` deps in favor of its own `Uri` (backed by `fluent-uri`), replacing `lsp_types::Url`. Migrate `cmd::lsp::mod` off `Url` onto `Uri`, and adjust the one `.path()` call site: `fluent_uri`'s `Path` needs `.as_str()` where `url::Url::path()` returned `&str` directly.
`--dir` was the only flag using clap's native `env = "RUNNER_DIR"` attribute instead of the repo's pattern (manual `env_suffix()`-styled help + env fallback at the call site). That both skipped the cyan styling every other `[env: VAR]` suffix gets and leaked the variable's current value into the help text (`[env: RUNNER_DIR=]` when set but empty). Give it a `DIR_HELP` string like `PM_HELP`/`RUNNER_HELP` and drop the native `env` attribute — `configured_project_dir` already reads `$RUNNER_DIR` independently, so behavior is unchanged. `-k/--keep-going` and `-K/--kill-on-fail` are genuinely backed by `RUNNER_KEEP_GOING`/`RUNNER_KILL_ON_FAIL` at the resolver layer (`resolve_failure_policy`), but their help text never said so, unlike every sibling env-backed flag. Add the missing `[env: ...]` suffixes.
[tasks] source preference + runner.toml language serverrunner.toml lsp
`quiet` was added after doctor v3 shipped, so requiring it in the current schema made older v3 payloads fail validation. Keep the field emitted and typed, but optional in the generated schema, and refresh the example plus release note wording.
- `build-packages.ts` now detects non-CI runs (`GITHUB_ACTIONS` unset): it builds the host target's tarball on demand with `cargo bbr` when the download is missing, and treats every other target's missing tarball as skippable rather than a hard failure. A bare `build-packages` now "just works" on any dev machine instead of erroring on absent cross-platform artifacts. - Rename the CI dist artifact `npm-dist` -> `dist` (release.yml upload, npm-release.yml download, CHANGELOG note) now that release.yml is its sole producer and the `npm-` prefix is stale.
|
Follow-up issue for Rust state duplication / schema drift cleanup: #77 |
Two related changes: a persistent way to choose which source runs an ambiguous task, and an editor language server that surfaces config validation/docs.
[tasks]— persistent task-source preferenceA task name can exist under more than one source (e.g. a
package.jsonscript and aturbotask). Previously the only way to pick the winner was per-invocation (package.json:build,--pm bun,--runner turbo); the only file knob,[task_runner].prefer, accepted task runners only (not package managers) and restricted candidates — soprefer = ["turbo"]hard-rejected apackage.jsonscript instead of ranking it.New
[tasks]section:[tasks].prefer— rank-only global order. Labels may be task runners, package managers (bun/npm/… →package.json;deno→deno.jsonthenpackage.json), or source names. Never hard-rejects an unlisted source — it only reorders ties.[tasks.overrides]— per-task pins that beat the global order for specific names.select_task_entry/source_prioritymachinery, so an explicitsource:taskqualifier,--runner, or--pm/RUNNER_PMstill outranks the file.Deprecates
[task_runner].preferin favour of[tasks].prefer: existing configs keep working (with their original restrictive behaviour) and now emit a migration warning; when both are set,[tasks]wins. The key is flagged"deprecated": truein the committed JSON Schema and dropped from theconfig initscaffold.runner lsp— language server forrunner.tomlBuilt with
--features lsp(gated likeman/schema), exposed asrunner lspover stdio. Reuses the CLI's own internals so editor feedback can't drift fromrunneritself:runner config validatepipeline (TOML parse, unknown keys, resolver field/policy validation) plus deprecation hints, mapped to buffer ranges and taggedDEPRECATEDwhere appropriate;RunnerConfigdoc comments — single source of truth);[tasks]runner/PM/source label vocabulary and booleans).runner lspis intercepted before project detection / config load, so it starts even when the on-disk file is currently invalid — exactly when its diagnostics matter most. The server is small and synchronous (full-text sync, one tiny document at a time). New deps (lsp-server,lsp-types) and thelspmodule are feature-gated; default builds are unchanged. To enable reuse,config::collect_unknown_keys,config::deprecation_warnings(factored out ofconfig::load), andcmd::schema::config_schemaare nowpub(crate).Testing
--all-features; clippy clean (--all-featuresand default,-D warnings);cargo fmt+dprintclean; JSON Schema regenerated with no drift.[tasks].prefer, pins override the order, legacy[task_runner].preferstill works with a deprecation warning; and the LSP binary driven through a real stdio session emits correctly-anchored diagnostics and hover, with a clean shutdown.Notes
runner.toml. Natural follow-ups: project-aware completion of real task names for[tasks.overrides]keys, and hover/diagnostics in task files (justfile/package.json).