Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

These guidelines help contributors, human and otherwise, understand and work effectively on this repository.

We also encourage reading [`docs/developer_guide.md`](/docs/developer_guide.md) for further useful information. For deeper understanding of the "brains" of `stackql`, it is worthwhile to consult [the omnisdk developer invariants](https://github.com/stackql-labs/omnisdk/blob/main/docs/developer/invariants.md) and linked documents from there.
We also encourage reading [`docs/developer_guide.md`](/docs/developer_guide.md) for further useful information. For deeper understanding of the "brains" of `stackql`, it is worthwhile to consult [the omnisdk developer guide](https://github.com/stackql-labs/omnisdk/blob/main/docs/developer/developer_guide.md) and linked documents from there.

We have upgraded to golang `>= 1.27.3` in order to take advantage of [time simulation and other capabilities in `testing/synctest`](https://go.dev/blog/testing-time).

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ StackQL is a standalone application that can be used in client mode (via __`exec

StackQL parses SQL statements and transpiles them into API requests to the (cloud) resource provider. The API calls are then executed and the results are returned to the user.

StackQL provider interfaces are canonically defined in OpenAPI extensions to the providers' specification. These definitions are then used to generate the SQL schema and the API client. The source for the provider definitions are stored in the [__StackQL Registry__][registry]. The semantics of provider interactions are defined in the [`omnisdk` library](https://github.com/stackql-labs/omnisdk). For more detail on nuts and bolts, please see [the local `AGENTS.md` file](/AGENTS.md) and [the `omnisdk` developer invariants](https://github.com/stackql-labs/omnisdk/blob/main/docs/developer/invariants.md).
StackQL provider interfaces are canonically defined in OpenAPI extensions to the providers' specification. These definitions are then used to generate the SQL schema and the API client. The source for the provider definitions are stored in the [__StackQL Registry__][registry]. The semantics of provider interactions are defined in the [`omnisdk` library](https://github.com/stackql-labs/omnisdk). For more detail on nuts and bolts, please see [the local `AGENTS.md` file](/AGENTS.md) and [the `omnisdk` developer guide](https://github.com/stackql-labs/omnisdk/blob/main/docs/developer/developer_guide.md).

<details>
<summary><b>StackQL Context Diagram</b></summary>
Expand Down
8 changes: 4 additions & 4 deletions docs/mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ The HTTP listener is registered for `Stop()`. Stopping the server or cancelling

### Credential (re)sourcing (`--env.file` + `reload_credentials`)

`--env.file` is a root flag: it nominates a dotenv-style file that every stackql entrypoint (`exec`, `shell`, `srv`, `mcp`) sources into the process environment at startup. For the MCP server it additionally acts as a mutable credential store: a process env block is fixed at spawn, so a stdio server launched without credential vars (eg by Claude Desktop) can only pick them up from such a file, re-sourced on each `reload_credentials` tool call.
`--env.file` is a root flag: it nominates a credential file that every stackql entrypoint (`exec`, `shell`, `srv`, `mcp`) sources into the process environment at startup. For the MCP server it additionally acts as a mutable credential store: a process env block is fixed at spawn, so a stdio server launched without credential vars (eg by Claude Desktop) can only pick them up from such a file, re-sourced on each `reload_credentials` tool call.

```bash

Expand All @@ -102,14 +102,14 @@ The HTTP listener is registered for `Stop()`. Stopping the server or cancelling
Semantics:

- Sourced at startup (if the file exists) and again on every `reload_credentials` call; only keys with non-empty values are set, nothing is ever unset.
- An absent file is created at startup as an empty commented dotenv file (`0600` on unix, parent directories included), so packaged installs (eg MCPB bundles in Claude Desktop) can pass the flag unconditionally; an existing file is never touched, so bundle updates cannot wipe populated credentials.
- An absent file is created at startup in the format selected by its suffix (`0600` on unix, parent directories included), so packaged installs (eg MCPB bundles in Claude Desktop) can pass the flag unconditionally; an existing file is never touched, so bundle updates cannot wipe populated credentials.
- The file may be created, updated or rotated at any time while the server runs.
- `reload_credentials` runs three ordered phases: re-source the file, invalidate auth contexts registered lazily from provider documents (contexts supplied via `--auth` are retained), then report every installed provider against the now-current environment. The report is identical before and after a provider's first query; the optional `provider` argument filters it, and an unknown provider name is the only scoped error.
- Each report row carries variable names, per-provider status (`ok`, `unresolved`, `not_checked`) and `changed` (whether the resolved credential material differs from before the reload); secret values are never returned, logged or audited. A second reload against an unchanged file is idempotent (`changed: false` throughout). Without `--env.file` it degrades to a pure status probe; a configured file that has gone missing is an explicit error naming the path.
- Credentials resolve automatically at query time, so no reload is ever required before querying. Credential resolution failures on the query tools name the provider and the recovery sequence (fix the env file, call `reload_credentials`, retry); `changed: false` after a failure means the file was not updated.
- Reload semantics are per process. In a replicated stateless HTTP deployment an in-band reload mutates one replica only; rotation there belongs at the deployment layer (redeploy, shared secret store, file watcher).

File format: one `KEY=VALUE` per line; `#` comments, blank lines, `export ` prefixes, surrounding quotes and CRLF are tolerated.
Files ending in `.toml`, `.yaml`, `.yml`, `.yalm`, or `.json` must contain a flat mapping with string keys and scalar values. A structured null becomes the text `null`. Other suffixes use dotenv syntax with one `KEY=VALUE` per line. Dotenv supports `#` comments, blank lines, `export ` prefixes, surrounding quotes, and CRLF.

Note for Claude Desktop on Windows: `setx` writes the registry, not running processes, and Claude Desktop passes its own (stale) environment to MCP subprocesses; `--env.file` avoids restarts entirely.

Expand Down Expand Up @@ -190,7 +190,7 @@ Tools also carry a `title` and every MCP behavioural hint as an explicit boolean
| `run_lifecycle_operation` | KV | Execute a stackql `EXEC` lifecycle operation. Returns `{messages, timestamp}`. Gated by the server [mode](#server-modes). |
| `list_registry` | Table | Providers (and their versions) available in the configured registry. Optional `provider` lists versions for that provider. |
| `pull_provider` | KV | Install a provider from the registry into the local approot cache. Requires `provider`; `version` optional. Local cache write only. |
| `reload_credentials` | Table | Live-reload credentials: re-source the [`--env.file`](#credential-resourcing---envfile--reload_credentials) dotenv file into the process environment, invalidate cached auth contexts and report resolution status (with a `changed` flag) for every installed provider. Never returns secret values. Optional `provider` filters the report. Recovery and rotation only, never a pre-query step. Allowed in every mode. |
| `reload_credentials` | Table | Live-reload credentials: re-source the [`--env.file`](#credential-resourcing---envfile--reload_credentials) file into the process environment, invalidate cached auth contexts and report resolution status (with a `changed` flag) for every installed provider. Never returns secret values. Optional `provider` filters the report. Recovery and rotation only, never a pre-query step. Allowed in every mode. |
| `query_library_search` | Table | Search the curated query library by natural-language `intent` (optional `provider` / `service` / `tags` filters). Consult before composing SQL from scratch. Read-only, no credentials. |
| `query_library_get` | KV | Retrieve one library entry by `id`; with `params` the server validates them and returns rendered SQL plus the tool to execute it with. Read-only, no credentials. |

Expand Down
19 changes: 19 additions & 0 deletions docs/provider_sessions.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,25 @@ snapshot. Updating credentials affects subsequent queries, not queries already r
binding/tuning changes start a new governor generation. Aliases cover document-driven metadata,
reads, mutations and legacy EXEC; they do not extend native built-in or IaC resource addresses.

Use the canonical provider name to set defaults for the current session.

```sql
SET "$.tuning_by_provider.google" = '{"page_limit":3}';
SET "$.params_by_provider.google" = '{"maxResults":"200"}';
```

Page limits resolve from alias `tuning.page_limit`, then canonical provider tuning, then
`--http.response.pageLimit`. Zero inherits and a negative value removes the cap.
For reads that declare a `maxResults` query parameter, precedence is explicit SQL, alias
`params.maxResults`, canonical provider parameters, then `--http.response.maxResults`.
Use `UNSET` on either canonical configuration path to restore its inherited defaults.

With an OmniSDK build that supports `proxy_port`, set it in canonical tuning or the alias's
`tuning` object. A positive value replaces the port on the proxy selected by the HTTP transport.
Zero inherits and `-1` restores the transport's original port. The transport still selects which
requests use a proxy, including any `NO_PROXY` exclusions. The root `--http.proxy.port` flag
continues to configure the registry transport.

## Typed dereferencing and expressions

Use `$name` without single quotes, including for string variables. Resolution replaces AST nodes
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/stackql/stackql
go 1.27.3

require (
github.com/BurntSushi/toml v1.4.0
github.com/DATA-DOG/go-sqlmock v1.5.1
github.com/Masterminds/semver v1.4.2
github.com/PaesslerAG/gval v1.0.0
Expand All @@ -24,7 +25,7 @@ require (
github.com/spf13/cobra v1.10.2
github.com/spf13/pflag v1.0.10
github.com/spf13/viper v1.10.1
github.com/stackql-labs/omnisdk v0.1.13-alpha01
github.com/stackql-labs/omnisdk v0.1.13-beta01
github.com/stackql/go-suffix-map v0.0.1-alpha02
github.com/stackql/psql-wire v0.1.2-beta02
github.com/stackql/stackql-parser v0.0.17-alpha05
Expand All @@ -49,7 +50,6 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.0.0 // indirect
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c // indirect
github.com/apache/arrow-go/v18 v18.0.0 // indirect
github.com/aws/aws-sdk-go-v2 v1.41.5 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ github.com/spf13/viper v1.10.1 h1:nuJZuYpG7gTj/XqiUwg8bA0cp1+M2mC3J4g5luUYBKk=
github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU=
github.com/spiffe/go-spiffe/v2 v2.7.0 h1:uXe1MflJoHw58wAUvxVlcM7WpKtijWG7I1UidcGh6g4=
github.com/spiffe/go-spiffe/v2 v2.7.0/go.mod h1:47Q0Q9/AqGha8QLHp+kxpH4Wca7X7EnOtlIJy3mxZ3U=
github.com/stackql-labs/omnisdk v0.1.13-alpha01 h1:iEmWSXYIRMNBhextyZdr8lCwP2X8kn2WY6c9PU1XOr4=
github.com/stackql-labs/omnisdk v0.1.13-alpha01/go.mod h1:G6qZy+6Vbuy9sSfws6erzpbbuThI+cD/uXDQPgQkRBI=
github.com/stackql-labs/omnisdk v0.1.13-beta01 h1:ck+fgCAAvlt6tXk986BHVAfHkcZBTDSJpAombF+lcLk=
github.com/stackql-labs/omnisdk v0.1.13-beta01/go.mod h1:G6qZy+6Vbuy9sSfws6erzpbbuThI+cD/uXDQPgQkRBI=
github.com/stackql/go-suffix-map v0.0.1-alpha02 h1:JI4aiq/OfHW4a/BiNqK31NbyaR94zlUOhGZof3G/OUo=
github.com/stackql/go-suffix-map v0.0.1-alpha02/go.mod h1:6BSMz4K/gIYfqdVRb7V8xL165wiPYyCjD9Kx7hLMd9Y=
github.com/stackql/psql-wire v0.1.2-beta02 h1:7DfliBpyyCaUHVJ1Jxk37q3zVwVLyh6+FCHeM0/gbAQ=
Expand Down
Loading
Loading