Companion editor and linter workflow plan (adotenv-lint 0.4.0 and adotenv-lsp 0.8.0)
Status: Planned. Tracking issues:
#277 (adotenv-lint 0.4.0)
and #278 (adotenv-lsp 0.8.0).
Scope and invariants
Section titled “Scope and invariants”This cycle focuses on companion editor and CI workflow capabilities across two
sequenced minor releases while keeping adotenv, adotenv-process, and
adotenv-cli unchanged on 1.8.x:
- Track 1 (
adotenv-lint 0.4.0,#277): enrich the shared schema model with key metadata, zero-new-dependencystdvalue shapes and literal bounds, value-safeMissingKeyplaceholder fixes, SARIF 2.1.0 output, and--explain <rule>. - Track 2 (
adotenv-lsp 0.8.0,#278): adopt publishedadotenv-lint 0.4.0(folding in PR #276’s post-0.7.2fixes), surface schema metadata, deprecation tags, andMissingKeyquick fixes, add dialect-accuratesemanticTokens/fullandfoldingRange, and support bounded live reload of configured/discovered.adotenv-lint.tomland[schema] examplefiles.
Invariants preserved across both tracks:
adotenvcore stays untouched (1.8.1), dependency-free,no_std/alloccompatible, and Rust 1.81 MSRV.adotenv-lintandadotenv-lsppreserve Rust 1.81 MSRV,forbid(unsafe_code), semver-checked0.xlines, zero new runtime dependencies for schema shapes, and linear-time bounded reads on untrusted configs and documents.- Diagnostics, schema findings, hover text, SARIF reports, and placeholder
fixes remain strictly value-free:
MissingKeyfixes insertKEY=with an empty value and never copy values from.env.example.
Track 1: adotenv-lint 0.4.0 (#277)
Section titled “Track 1: adotenv-lint 0.4.0 (#277)”1. Schema metadata and deprecation rule
Section titled “1. Schema metadata and deprecation rule”- Add optional
description: Option<String>anddeprecated: Option<String>(or boolean/message form in TOML[schema.keys.<KEY>]) onKeySchema, withwith_description/with_deprecatedbuilders and per-key merge parity inLintConfig::apply. - Add
Rule::DeprecatedKey(deprecated-key, defaultwarningwhen aSchemamarks a declared key deprecated; configurable asoff,warning, orerrorin[rules]). Findings report the key and optional deprecation note without including document values.
2. Zero-new-dependency ValueShape variants and literal bounds
Section titled “2. Zero-new-dependency ValueShape variants and literal bounds”- Extend
#[non_exhaustive] ValueShapeusingstd-only, linear-time validation (no new crate dependencies; preservingDebug,Clone,PartialEq,Eq,Hash,Default):ValueShape::IpAddr(std::net::IpAddr)ValueShape::Host(RFC 1123 hostname or IP address)ValueShape::SocketAddr(std::net::SocketAddr)ValueShape::Email(practical linear-time RFC-stylelocal@domaincheck without ASCII whitespace or control characters)
- Add optional literal bounds on
KeySchemaand[schema.keys.*]:prefix: Option<String>,suffix: Option<String>,min_len: Option<usize>, andmax_len: Option<usize>(validated for contradiction such asmin_len > max_lenduring config loading; non-empty bounds follow existingallow_emptyrules).
3. Value-safe MissingKey placeholder fixes
Section titled “3. Value-safe MissingKey placeholder fixes”- Add
Fix::InsertEmpty { key: String }backed byadotenv::Edit::Insertwith an empty value""(never copying.env.examplevalues) and attach it toRule::MissingKeyfindings. - Classification and batching policy:
- Explicit single-fix application (
apply_fix/apply_fix_with_options) appliesFix::InsertEmptydirectly throughVerifiedEditswhile honoringEditOptionsbounds. - Default batch application (
apply_batch/apply_batch_with_options) and CLIadotenv-lint --fixremain style-only (renames, sort, format) by default so routine style fixes never inject emptyKEY=stubs silently. - Opt-in scaffolding via CLI
--fix-missing(with--fix) and an explicit batch option/helper appliesFix::InsertEmptyinsertions cleanly ahead of sort/format stages in one verified pipeline.
- Explicit single-fix application (
4. CLI CI and DX ergonomics
Section titled “4. CLI CI and DX ergonomics”- Add
--format=sarif(OutputFormat::Sarif) emitting SARIF 2.1.0 JSON for GitHub Code Scanning and IDE problem matchers (including rule metadata, levels mapped fromRuleSeverity, UTF-8/line-column regions, and strictly value-free messages with control/Bidi escaping where needed). - Add
--explain <rule>(and--list-rules) printing an offline reference for each rule’s identifier, default severity, autofix support, and TOML/CLI configuration keys.
Track 2: adotenv-lsp 0.8.0 (#278)
Section titled “Track 2: adotenv-lsp 0.8.0 (#278)”Built on published adotenv-lint 0.4.0 and including PR #276’s post-0.7.2
audit fixes (no separate 0.7.3 patch release):
1. Schema-rich editor UX and MissingKey quick fixes
Section titled “1. Schema-rich editor UX and MissingKey quick fixes”- Enrich
hoverandcompletionwith value-freeKeySchemametadata:description, expectedValueShapeand literal bounds (prefix,suffix,min_len,max_len), required/optional status, and deprecation notice, applying existing control/Bidi/Markdown escaping. - Emit
DiagnosticTag::DEPRECATEDondeprecated-keydiagnostics andCompletionItemTag::DEPRECATEDon deprecated keys in completion. - Wire
Fix::InsertEmptyinto explicitquickfixcode actions (Add 'KEY=' placeholderand a multi-keyAdd all missing keysquick fix when multiple required keys are missing), while keepingsource.fixAllstrictly style-only so save-on-fix never inserts empty stubs unexpectedly. AdvertisecodeActionProviderwhenever either fixable style rules or an active schema withmissing-keyis configured.
2. Dialect-accurate semantic tokens and folding ranges
Section titled “2. Dialect-accurate semantic tokens and folding ranges”- Add
ParsedDocument::semantic_tokens(and statelesssemantic_tokens) plustextDocument/semanticTokens/fullin the stdio server, usingDocumentspans andadotenv’s active dialect to classifyexportkeywords, declarations/keys (withdeclarationanddeprecatedmodifiers),=/:operators, values,$VAR/${VAR}/$(...)references, and comments under the negotiatedpositionEncoding(utf-16,utf-8,utf-32) withlimit_error()enforcement. - Add
ParsedDocument::folding_ranges(and statelessfolding_ranges) plustextDocument/foldingRangefor multiline quoted values and contiguous comment blocks.
3. Live config and .env.example reload
Section titled “3. Live config and .env.example reload”- Active automatically whenever the stdio server is launched with
--config <path>or--discover-lint-config(preserving zero implicit filesystem reads when neither flag is passed). - After
initialized, whenInitializeParams.capabilities.workspace .didChangeWatchedFiles.dynamicRegistration == true, issue a non-blockingclient/registerCapabilityrequest watching the active config file and configured[schema] examplefile (updating registrations ifschema.examplechanges on reload). - Also react to client-sent
workspace/didChangeWatchedFilesandtextDocument/didSavenotifications matching the active config or example URI so clients without dynamic registration still reload directly. - Enforce the existing
min(--max-input-bytes, 4 MiB)regular-file cap on config reloads and--max-input-bytesregular-file cap on[schema] examplereloads. - On invalid, oversized, or unreadable reload: retain the last-known-good
policy, emit a
window/showMessage(Warning) notification, and recover automatically on the next valid save. If a discovered.adotenv-lint.tomlis deleted under--discover-lint-config, re-run ancestor discovery (falling back to parser-only policy if none remains); under explicit--config, retain last-known-good and warn. Republish versioned diagnostics for all open buffers whenever the active policy changes.
Release sequencing and verification checklist
Section titled “Release sequencing and verification checklist”- Implement, review/audit, run
--in-diffremote mutation sweeps (1 worker, 8 GiB cap; see Heavy validation), and publish Track 1 (adotenv-lint 0.4.0) first via.github/workflows/release.yml(publish_linter=true). - Verify
adotenv-lint 0.4.0on crates.io, docs.rs, GitHub Releases (4-way SHA-256 + Sigstore attestation), andcargo semver-checks. - Implement Track 2 (
adotenv-lsp 0.8.0) on top of publishedadotenv-lint 0.4.0, run full audit +--in-diffremote mutation sweeps, and publish Track 2 (adotenv-lsp 0.8.0) viarelease.yml(publish_lsp=true). - Verify
adotenv-lsp 0.8.0on crates.io, docs.rs, GitHub Releases (4-way SHA-256 + Sigstore attestation), CI (MSRV 1.81,--no-default-features,cargo semver-checks), andDocsheadless-browser smoke.