Skip to content

Environment variable names in completion and hover#12

Merged
gandarfh merged 1 commit into
mainfrom
feat/env-vars-completion
Jun 10, 2026
Merged

Environment variable names in completion and hover#12
gandarfh merged 1 commit into
mainfrom
feat/env-vars-completion

Conversation

@gandarfh

Copy link
Copy Markdown
Member

What

The server accepts --db <path> (the app's SQLite database) and enriches completion and hover with the variable names of the active environment. Completion inside {{ now offers block aliases plus env keys (secret ones labeled); hovering a bare {{KEY}} that matches an active-environment variable says so, with a secret note when applicable.

Privacy invariant

The server reads key and is_secret only — never value, secret or not. Values belong to the execution path; this process has no keychain access by design and now provably never selects the value column either.

Implementation

  • bin/env_store.ml: lazy read-only caqti connection, one query per request (reads measured in the tens of microseconds; the active environment can change while the server runs, so no caching). Missing --db or a failed read degrades to the previous behavior.
  • Analyze.completion_at/hover_at take the env names as input data, keeping the library pure — the IO shell supplies them.

Tests

48 checks. New: completion appends env keys with the secret flag, hover marks a secret env var, and a third integration session spawns the binary with --db pointing at a fixture database created by the test (schema mirroring the app's environments/env_variables), asserting env keys and the secret detail arrive over the protocol.

@gandarfh
gandarfh merged commit 63f0dee into main Jun 10, 2026
6 checks passed
@gandarfh
gandarfh deleted the feat/env-vars-completion branch June 10, 2026 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant