strata-cli 0.1.20 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28b84442e2989e729c2f9241c4af084eed8b346f62267d00c7bc27f3a4cb7d5d
4
- data.tar.gz: b3e436e5055ea145a030bd88e27fb7b11ec1f6965886a65cb94aeee26ba34f5f
3
+ metadata.gz: 55ce87ef5e374c4b0a1c60a5e23081596108a353bc543272a7aa2b749fd56930
4
+ data.tar.gz: 27bc1dab19e8dbc6efb1256b25c36389a182157dad90bd9fdfd14f9c73f648af
5
5
  SHA512:
6
- metadata.gz: 022cb33cdb574fd26548b9239ea39520e196f019a5f5d1808e84acf19e15f22a92d7acf550b70d729a799d4a389e48cd66950fa616809afbb96f569f87c00720
7
- data.tar.gz: f3bd0b00b86ddae87a55262f15d49665606fde89211d3bd2fc5ec9ca33233b998253e5f949d170052a3c8d7ee210c5f6187ed38ed9603487cd5c218fdd9ed89b
6
+ metadata.gz: 9e9824b911b205b5876c1c104cfa2c187c7d768197b87ffda5bf3d891bfd2abc9140309b422c173fe8d964a9fa4939aa331bdc6e8412e25b0e6a37d172e4453e
7
+ data.tar.gz: 0bc343e01fac99afacc7bb5e3c188d530c7b7ceafa359c0c269d38c32e536b837bca2038b95ad2962672c5ebcc961eb7a972f72fee91abc5a3707c22ebf64a49
data/CHANGELOG.md CHANGED
@@ -1,5 +1,61 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.22] - 2026-11-05
4
+
5
+ ### Fixed
6
+
7
+ The local semantic audit added in 0.1.16 mirrors the server's deploy-time
8
+ validations. Several of its checks rejected models the server accepts, which blocked
9
+ `strata audit` -- and `strata deploy`, which runs it first.
10
+
11
+ - **A table name reused in a second datasource**: the audit resolved a relationship's tables by name across the whole project, so two datasources declaring the same table collided and whichever file was read last won. A valid join in the other datasource failed with "is not in datasource ... (tables can only join within one datasource)", and the same join defined in both datasources failed as a duplicate. Table names are unique per datasource on the server, so both are now scoped to the relationship's own datasource. This is what hot-tier routing looks like, where one table is defined in a hot and a cold datasource.
12
+ - **Datasource references that differ only in case**: `datasource: TPCDS` in a relationship file and `tpcds` in a table file resolved to different strings and compared as different datasources. An upper-case key in `datasources.yml` was also rejected outright as "not found", though the server resolves it. Both now match case-insensitively, as the server does.
13
+ - **Measures written across lines**: the aggregate-function check was missing the server's `/m` flag, so any measure written as a YAML block scalar (`sql: |`) or spanning lines was reported as having no aggregation function.
14
+ - **Quoted identifiers on backtick warehouses**: expressions were always parsed with ANSI double quotes, so on MySQL, BigQuery, ClickHouse and Databricks a backtick-quoted column read as no column at all and dimensions were rejected for not referencing one. The parser now takes the adapter's own identifier quote.
15
+ - **`join` and `cardinality` casing**: `join: Inner` and `cardinality: Many_To_One` were rejected. The server downcases and strips both before validating, and defaults a missing `join` to `inner`.
16
+ - **Explicitly empty keys**: `snapshot:`, `display_type:` and `join:` left blank were rejected; the server treats nil as absent.
17
+ - **Tables with no fields**: `fields` was required and `fields: []` rejected, though the server accepts a table that declares none. It now warns instead.
18
+ - **`.yaml` model files**: only `.yml` was ever read, so a `tbl.*.yaml` was reported as a stray file to delete, never validated, invisible to relationship checks, and left out of the deploy archive -- even though the server deploys `tbl.*.{yml,yaml}`.
19
+
20
+ ### Added
21
+
22
+ The deployer silently swallows a number of mistakes: the deploy goes green and the
23
+ model differs from the YAML. Those are the ones worth catching locally, so these are
24
+ errors even though the server accepts them.
25
+
26
+ - **Measure-only keys on a dimension**: `snapshot`, `exclusion_type`, `exclusions` and `inclusions` apply to measures only, but all four are columns on the shared `fields` table and the deployer writes them to a dimension untyped -- `snapshot: ending` stores `0`, which reads back as `beginning`, and shows up as `snapshot: 0` in field JSON. Reported once, naming the keys, instead of as several misleading enum errors.
27
+ - **`exclusions` without `exclusion_type`**: the rules are stored, never validated and never applied, so the measure aggregates at the grain the rules existed to prevent; under row-level security the query then fails with an internal "Exclusion dim ids are not cached" error.
28
+ - **Unknown table-level keys**: the deployer slices a `tbl` file down to the keys it reads, so anything else is dropped. In particular `snapshot_date:` -- which this project's own table template suggested until now -- deployed a table with no snapshot date at all.
29
+ - **`lookup: "no"` and friends**: these land on boolean columns, and `ActiveModel::Type::Boolean` casts everything outside its `FALSE_VALUES` to **true**, so a quoted `"no"`, `"No"` or a bare `n` silently stores the opposite of what was written. Bare `no` is fine, so this is a one-character quoting difference that inverts join handling and is invisible in a diff. The error now says so.
30
+ - **Table template**: `table.table_name.yml` suggested `snapshot_date:`, but the deployer reads `snapshot:`. Corrected in `AGENTS.md` in 0.1.18 and missed here.
31
+
32
+ ### Changed
33
+
34
+ - **`strata audit connections` still fails on an unreachable warehouse; `strata audit all` now warns.** The server only checks that a datasource's config can build an adapter and never requires the warehouse to be reachable from this machine, so a warehouse behind a VPN or an IP allow-list no longer blocks a deploy that would have worked. Running `connections` is an explicit request to test them, so there it is still an error.
35
+
36
+ ## [0.1.21] - 2026-11-04
37
+
38
+ ### Added
39
+
40
+ - **Default server URL**: commands fall back to `https://app.strata.do` when no `server:` is configured, so `strata deploy` no longer stops to prompt for one.
41
+ - **`-s, --server URL` on `strata init`** (alongside the existing flag on `project sample`), written into `project.yml`. Other commands read it from there; use `-e ENVIRONMENT` with per-environment `server:` blocks to target more than one server.
42
+
43
+ ### Removed
44
+
45
+ - **`strata init --source`**: it could never do what it claimed. The clone was gated on a `git_url` field the server does not return (the column is `git`), so the repository was never cloned, and the full project URL was written into `project.yml` as `server:`, breaking every later deploy. Its documented GitHub-URL example raised a `TypeError`. To work on an existing project, clone its repository and run `strata deploy`, or use `strata project link PROJECT_ID`. `-s` now means `--server`.
46
+
47
+ ### Changed
48
+
49
+ - `strata init` requires `PROJECT_NAME`, and its `--api-key` is purely an optional convenience for scripted setups — browser sign-in on the first `strata deploy` is now the only interactive auth path.
50
+ - `strata project sample` writes the chosen server to `project.yml` instead of `.strata`, where `project.yml` silently overrode it.
51
+
52
+ ### Fixed
53
+
54
+ - **A datasource whose file lives where the server runs no longer fails the audit.** The sample project points DuckDB at `/data/tpcds.duckdb`, which ships inside the Strata image, so the connection could never be opened from a laptop and `strata deploy` refused to run. `strata audit` now reports such a connection as unchecked and names it, instead of failing — the server validates it for real when the model deploys. This replaces a hardcoded skip that disabled connection auditing entirely for one repository, and `strata datasource test` now explains the same situation when it fails.
55
+ - A blank `server:` key in `project.yml` no longer wins the config merge and blank out the default.
56
+ - Saving a server URL to `project.yml` rewrote every `server:` line, including the indented per-environment ones. It now only replaces the root key.
57
+ - Documentation links point at `https://strata.do/docs/...` instead of the old `developer-docs` path.
58
+
3
59
  ## [0.1.20] - 2026-09-30
4
60
 
5
61
  ### Changed
data/README.md CHANGED
@@ -52,22 +52,26 @@ Use `strata datasource meta DS_KEY TABLE_NAME --agent` for column metadata when
52
52
  <details>
53
53
  <summary><strong>Project Management</strong></summary>
54
54
 
55
- ### `strata init [PROJECT_NAME]`
55
+ ### `strata init PROJECT_NAME`
56
56
 
57
- Initialize a new Strata project or clone from an existing repository.
57
+ Initialize a new Strata project.
58
58
 
59
59
  **Options:**
60
60
  - `-d, --datasource ADAPTER` - Add datasource adapters (repeatable)
61
- - `-s, --source URL` - Clone existing project from URL
62
- - `-a, --api-key KEY` - API key (required with `--source`)
61
+ - `-s, --server URL` - Server URL, written to `project.yml` (default `https://app.strata.do`)
62
+ - `-a, --api-key KEY` - API key, for scripted setups (optional — the first deploy signs you in via browser)
63
63
 
64
64
  **Examples:**
65
65
  ```bash
66
66
  strata init my-project
67
67
  strata init my-project -d postgres -d snowflake
68
- strata init --source https://github.com/org/project.git --api-key YOUR_KEY
68
+ strata init my-project --server http://localhost:8080
69
69
  ```
70
70
 
71
+ To work on a project that already exists on the server, clone its repository — `project.yml`
72
+ carries both the server URL and the project ID — then run `strata deploy`. Use
73
+ `strata project link PROJECT_ID` to point an existing local project at a server project.
74
+
71
75
  ### `strata project link PROJECT_ID`
72
76
 
73
77
  Link local project to an existing project on the Strata server.
@@ -83,7 +87,7 @@ Clone the Strata TPC-DS sample project and set it up interactively. Prompts for
83
87
 
84
88
  **Options:**
85
89
  - `-a, --api-key KEY` - API key (optional — skips browser sign-in when paired with `--server`)
86
- - `-s, --server URL` - Server URL (optional — prompted if omitted)
90
+ - `-s, --server URL` - Server URL (optional — prompted if omitted, default `https://app.strata.do`)
87
91
 
88
92
  **Examples:**
89
93
  ```bash
@@ -306,6 +310,19 @@ List all supported data warehouse adapters.
306
310
 
307
311
  ## Configuration
308
312
 
313
+ ### Server URL
314
+
315
+ The server URL lives in `project.yml`. `strata init` and `strata project sample` accept
316
+ `-s, --server URL` and write it there; every other command reads it, so the flag is set once:
317
+
318
+ 1. `server:` under the selected environment in `project.yml` (`-e ENVIRONMENT`)
319
+ 2. `server:` at the root of `project.yml`, then `.strata`
320
+ 3. `https://app.strata.do` — the default when nothing above is set
321
+
322
+ To deploy to more than one server, give `project.yml` a block per environment and select it
323
+ with `-e ENVIRONMENT` (see [Multi-Environment Configuration](#configuration)) rather than
324
+ passing a URL per command.
325
+
309
326
  ### Project Configuration (`project.yml`)
310
327
 
311
328
  Main project configuration file:
@@ -328,10 +345,10 @@ project_id: 123 # Auto-populated after first deployment
328
345
  server: https://dev.strata.example.com
329
346
 
330
347
  staging:
331
- server: https://staging.strata.com
348
+ server: https://staging.strata.do
332
349
 
333
350
  production:
334
- server: https://app.strata.com
351
+ server: https://app.strata.do
335
352
  ```
336
353
 
337
354
  `.strata` — API keys per environment (**never committed**):
@@ -464,7 +481,7 @@ Run `strata ds auth my_bigquery` and give the service account JSON keyfile path:
464
481
  ## Security
465
482
 
466
483
  - ✅ Credentials stored in `.strata` with restrictive permissions (0600)
467
- - ✅ API keys never required on the command line — browser sign-in or the `.strata` file supplies them (optional `--api-key` flags exist on `init --source` and `project sample` for scripting)
484
+ - ✅ API keys never required on the command line — browser sign-in or the `.strata` file supplies them (optional `--api-key` flags exist on `init` and `project sample` for scripting)
468
485
  - ✅ File paths validated to prevent path traversal attacks
469
486
  - ✅ Git commit hashes validated before use
470
487
  - ✅ YAML files loaded safely to prevent code execution
@@ -7,13 +7,21 @@ module Strata
7
7
  class Configuration
8
8
  STRATA_CONFIG_FILE = ".strata"
9
9
  PROJECT_CONFIG_FILE = "project.yml"
10
+ DEFAULT_SERVER = "https://app.strata.do"
10
11
 
11
12
  DEFAULT = {
12
13
  "api_key" => "",
13
- "server" => "",
14
+ "server" => DEFAULT_SERVER,
14
15
  "log_level" => "info"
15
16
  }.freeze
16
17
 
18
+ # Normalizes a configured or user-supplied server URL, falling back to
19
+ # the hosted default when it is missing or blank.
20
+ def self.resolve_server(value)
21
+ value = DEFAULT_SERVER if value.nil? || value.to_s.strip.empty?
22
+ value.to_s.strip.delete_suffix("/")
23
+ end
24
+
17
25
  attr_reader :data
18
26
 
19
27
  def initialize
@@ -94,6 +102,8 @@ module Strata
94
102
  project_data = load_yaml_file(project_config_file_path)
95
103
 
96
104
  @data = DEFAULT.merge(strata_data).merge(project_data)
105
+ # project.yml ships a blank `server:` key, which would otherwise win the merge.
106
+ @data["server"] = DEFAULT_SERVER if @data["server"].to_s.strip.empty?
97
107
 
98
108
  @api_key = @data["api_key"]
99
109
  @server = @data["server"]
@@ -1,19 +1,20 @@
1
- Initialize a new Strata project or clone from an existing repository.
1
+ Initialize a new Strata project.
2
2
 
3
3
  Creates an AGENTS.md in the project so a coding agent (Claude Code, Codex, Cursor)
4
4
  can build the semantic model for you:
5
- https://strata.do/developer-docs/developer-guide/cli/building-your-model
5
+ https://strata.do/docs/cli/building-your-model
6
6
 
7
- PROJECT_NAME is optional when using --source option. If provided, creates a new project
8
- with that name. If using --source, clones the existing project from the URL.
7
+ PROJECT_NAME is required and becomes the project directory and uid.
9
8
 
10
9
  Options:
11
10
 
12
11
  -d, --datasource ADAPTER Add one or more datasource adapters (repeatable)
13
12
 
14
- -s, --source URL URL of existing project to clone
13
+ -s, --server URL Strata server URL, written to project.yml.
14
+ Defaults to https://app.strata.do
15
15
 
16
- -a, --api-key KEY API key (required when using --source)
16
+ -a, --api-key KEY API key, for scripted setups. Optional — the first
17
+ `strata deploy` signs you in via the browser.
17
18
 
18
19
  Examples:
19
20
 
@@ -21,4 +22,4 @@ Examples:
21
22
 
22
23
  strata init my-project -d postgres -d snowflake
23
24
 
24
- strata init --source https://github.com/org/project.git --api-key YOUR_KEY
25
+ strata init my-project --server http://localhost:8080
@@ -3,60 +3,23 @@
3
3
  require_relative "group"
4
4
  require_relative "datasource"
5
5
  require_relative "../helpers/project_helper"
6
- require_relative "../api/connection_error_handler"
7
- require_relative "../api/response_error_handler"
8
6
  require_relative "../output"
9
7
  require_relative "../utils/git"
10
8
  require_relative "../helpers/prompts"
11
- require "faraday"
12
- require "json"
13
- require "uri"
14
9
 
15
10
  module Strata
16
11
  module CLI
17
12
  module Generators
18
13
  class Project < Group
19
- include API::ConnectionErrorHandler
20
- include API::ResponseErrorHandler
21
-
22
- argument :name, type: :string, required: false, desc: "The name of the project. Optional when using --source."
14
+ argument :name, type: :string, required: false, desc: "The name of the project."
23
15
  class_option :datasource, type: :string, repeatable: true
24
- class_option :source, type: :string
16
+ class_option :server, type: :string
25
17
  class_option :api_key, type: :string
26
18
  class_option :verbose, type: :boolean, default: false, desc: "Show detailed init output (file-by-file actions)."
27
19
 
28
20
  desc "Generates a new Strata project."
29
21
 
30
- def validate_options
31
- if options.key?(:source)
32
- unless options.key?(:api_key)
33
- raise Strata::CommandError,
34
- "API key is required when using --source option. Use --api-key option."
35
- end
36
- else
37
- unless @name && !@name.to_s.strip.empty?
38
- raise Strata::CommandError,
39
- "PROJECT_NAME is required when not using --source option."
40
- end
41
- end
42
- end
43
-
44
- def fetch_and_clone_if_available
45
- return unless options.key?(:source)
46
-
47
- project_info = fetch_project_info
48
- @project_id = project_info["id"]
49
- @project_info = project_info
50
-
51
- return unless project_info["git_url"] && !project_info["git_url"].empty?
52
-
53
- @cloned_from_git = true
54
- clone_project(project_info["git_url"])
55
- end
56
-
57
22
  def create_project_structure
58
- return if cloned_from_git?
59
-
60
23
  empty_directory uid unless existing_directory?
61
24
  empty_directory File.join(uid, "models")
62
25
  empty_directory File.join(uid, "tests")
@@ -67,30 +30,14 @@ module Strata
67
30
  end
68
31
 
69
32
  def create_project_file
70
- return if cloned_from_git?
71
-
72
33
  template "project.yml", "#{uid}/project.yml"
73
34
  end
74
35
 
75
- def persist_project_id_if_needed
76
- # Persist project_id after project.yml exists (either from clone or creation)
77
- return unless @project_id
78
-
79
- project_yml_path = File.join(uid, "project.yml")
80
- return unless File.exist?(project_yml_path)
81
-
82
- persist_project_id_to_project_yml
83
- end
84
-
85
36
  def create_agents_file
86
- return if cloned_from_git?
87
-
88
37
  copy_file "AGENTS.md", "#{uid}/AGENTS.md"
89
38
  end
90
39
 
91
40
  def create_datasources_file
92
- return if cloned_from_git?
93
-
94
41
  template "datasources.yml", "#{uid}/datasources.yml"
95
42
 
96
43
  return unless options.key?(:datasource)
@@ -103,8 +50,6 @@ module Strata
103
50
  end
104
51
 
105
52
  def initialize_git
106
- return if cloned_from_git?
107
-
108
53
  inside uid do
109
54
  run "git init", verbose: false, capture: true
110
55
  create_file ".gitignore", ".strata\n"
@@ -112,7 +57,6 @@ module Strata
112
57
  end
113
58
 
114
59
  def setup_datasource
115
- return if cloned_from_git?
116
60
  return if options.key?(:datasource)
117
61
  return if existing_directory?
118
62
 
@@ -129,8 +73,6 @@ module Strata
129
73
  end
130
74
 
131
75
  def initial_commit
132
- return if cloned_from_git?
133
-
134
76
  inside uid do
135
77
  case Utils::Git.initial_commit("chore: initialize Strata project")
136
78
  when :committed
@@ -151,83 +93,18 @@ module Strata
151
93
 
152
94
  private
153
95
 
154
- def cloned_from_git?
155
- @cloned_from_git ||= false
156
- end
157
-
158
96
  def existing_directory?
159
97
  File.directory?(name.to_s)
160
98
  end
161
99
 
162
- def fetch_project_info
163
- conn = Faraday.new(url: options[:source]) do |f|
164
- f.request :authorization, "Bearer", options[:api_key]
165
- f.response :json
166
- end
167
-
168
- response = with_connection_error_handling(options[:source]) do
169
- conn.get
170
- end
171
-
172
- unless response.success?
173
- raise Strata::CommandError,
174
- response_error_message(
175
- response,
176
- default_message: "Failed to fetch project info from #{options[:source]}. Status: #{response.status}."
177
- )
178
- end
179
-
180
- response.body
181
- end
182
-
183
- def clone_project(git_url)
184
- Output.print_status(:clone, "Cloning project from #{git_url}", type: :success, context: self)
185
- run "git clone #{git_url} #{uid}", verbose: false, capture: true
186
-
187
- raise Strata::CommandError, "Failed to clone repository from #{git_url}" unless File.directory?(uid)
188
-
189
- Output.print_status(:success, "Project cloned successfully", type: :success, context: self)
190
- end
191
-
192
- def persist_project_id_to_project_yml
193
- return unless @project_id
194
-
195
- project_yml_path = File.join(uid, "project.yml")
196
- Helpers::ProjectHelper.persist_project_id_to_yml(@project_id, project_yml_path: project_yml_path)
197
- end
198
-
199
100
  def uid
200
- @uid ||= if options.key?(:source) && @project_info
201
- @project_info["uid"] || options[:source].split("/").last
202
- elsif existing_directory?
203
- name.to_s
204
- else
205
- Utils.url_safe_str(name)
206
- end
207
- end
208
-
209
- def name
210
- # Use name from server if available (when using --source), otherwise use argument
211
- return @project_info["name"] if options.key?(:source) && @project_info
212
-
213
- @name
101
+ @uid ||= existing_directory? ? name.to_s : Utils.url_safe_str(name)
214
102
  end
215
103
 
216
- def description
217
- return @project_info["description"] if options.key?(:source) && @project_info
218
-
219
- nil
220
- end
221
-
222
- def production_branch
223
- if options.key?(:source) && @project_info && @project_info["production_branch"]
224
- return @project_info["production_branch"]
225
- end
226
-
227
- "main"
104
+ # Written into project.yml so deploy/branch/cache just read it.
105
+ def server
106
+ @server ||= Configuration.resolve_server(options[:server])
228
107
  end
229
-
230
- attr_reader :project_id
231
108
  end
232
109
  end
233
110
  end
@@ -312,7 +312,7 @@ If referenced measures are not joinable in **one universe** from that host table
312
312
 
313
313
  **Use calculations (compound measures), not shared measure names** across unrelated facts.
314
314
 
315
- **Automatic data blending** merges results on shared **dimensions** (often via `extended_blend_group`) — not by reusing the same measure name on multiple fact tables. See [extended blending](https://strata.do/developer-docs/developer-guide/semantic-model/expressions/extended-blending) and the [glossary](https://strata.do/developer-docs/developer-guide/getting-started/glossary).
315
+ **Automatic data blending** merges results on shared **dimensions** (often via `extended_blend_group`) — not by reusing the same measure name on multiple fact tables. See [extended blending](https://strata.do/docs/semantic-model/extended-blending-groups) and the [glossary](https://strata.do/docs/getting-started/glossary).
316
316
 
317
317
  ---
318
318
 
@@ -348,7 +348,7 @@ fields:
348
348
 
349
349
  When users group by a time period, the engine picks the last (`ending`) or first (`beginning`) snapshot in each bucket — not a sum of every row in the period.
350
350
 
351
- More detail: [snapshot measures](https://strata.do/developer-docs/developer-guide/semantic-model/fields/measures/snapshot)
351
+ More detail: [snapshot measures](https://strata.do/docs/semantic-model/fields/measures/snapshot)
352
352
 
353
353
  ---
354
354
 
@@ -375,7 +375,7 @@ More detail: [snapshot measures](https://strata.do/developer-docs/developer-guid
375
375
 
376
376
  Inner: `sum(hours)` per `(day, account)`. Outer: median of those account totals per `day`.
377
377
 
378
- More detail: [inclusions](https://strata.do/developer-docs/developer-guide/advanced/inclusions)
378
+ More detail: [inclusions](https://strata.do/docs/advanced/inclusions)
379
379
 
380
380
  ---
381
381
 
@@ -404,7 +404,7 @@ More detail: [inclusions](https://strata.do/developer-docs/developer-guide/advan
404
404
 
405
405
  `Return Status` will not appear in the grouping set for this measure even if the user adds it to the query; other dimensions still group normally.
406
406
 
407
- More detail: [exclusions](https://strata.do/developer-docs/developer-guide/advanced/exclusions)
407
+ More detail: [exclusions](https://strata.do/docs/advanced/exclusions)
408
408
 
409
409
  ---
410
410
 
@@ -425,14 +425,14 @@ More detail: [exclusions](https://strata.do/developer-docs/developer-guide/advan
425
425
 
426
426
  | Feature | Use when |
427
427
  |---------|----------|
428
- | [Compound measures](https://strata.do/developer-docs/developer-guide/semantic-model/fields/measures/compound) | Formula across named measures; host table sets dimensionality |
429
- | [Snapshot measures](https://strata.do/developer-docs/developer-guide/semantic-model/fields/measures/snapshot) | Period-boundary state (inventory, balances) — see [Snapshot measures](#snapshot-measures) |
430
- | [Inclusions](https://strata.do/developer-docs/developer-guide/advanced/inclusions) | Median/percentile/avg needing intermediate grain — see [Inclusion measures](#inclusion-measures) |
431
- | [Exclusions](https://strata.do/developer-docs/developer-guide/advanced/exclusions) | Control grouping and filters per dimension — see [Exclusion measures](#exclusion-measures) |
428
+ | [Compound measures](https://strata.do/docs/semantic-model/fields/measures/compound) | Formula across named measures; host table sets dimensionality |
429
+ | [Snapshot measures](https://strata.do/docs/semantic-model/fields/measures/snapshot) | Period-boundary state (inventory, balances) — see [Snapshot measures](#snapshot-measures) |
430
+ | [Inclusions](https://strata.do/docs/advanced/inclusions) | Median/percentile/avg needing intermediate grain — see [Inclusion measures](#inclusion-measures) |
431
+ | [Exclusions](https://strata.do/docs/advanced/exclusions) | Control grouping and filters per dimension — see [Exclusion measures](#exclusion-measures) |
432
432
  | Table `cost` | Lower cost = preferred table when multiple tables can answer; use for rollup vs detail routing |
433
- | [Partitions](https://strata.do/developer-docs/developer-guide/advanced/partitions) | Table only has subset of data — `between` (date range) or `in_list`; planner routes when partition matches |
434
- | [Extended blending](https://strata.do/developer-docs/developer-guide/semantic-model/expressions/extended-blending) | Blend dimensions across tables in same datasource — not duplicate measure names |
435
- | [Imports](https://strata.do/developer-docs/developer-guide/semantic-model/imports) | Reuse field definitions across `tbl` files |
433
+ | [Partitions](https://strata.do/docs/semantic-model/partitions) | Table only has subset of data — `between` (date range) or `in_list`; planner routes when partition matches |
434
+ | [Extended blending](https://strata.do/docs/semantic-model/extended-blending-groups) | Blend dimensions across tables in same datasource — not duplicate measure names |
435
+ | [Imports](https://strata.do/docs/semantic-model/imports) | Reuse field definitions across `tbl` files |
436
436
 
437
437
  ---
438
438
 
@@ -474,7 +474,7 @@ Deploy **migration files and updated YAML in the same deployment**. Update `tbl.
474
474
 
475
475
  **Agents:** propose migration YAML under `migrations/` and matching model edits; do **not** run interactive `strata create migration`. Flag renames for human review and confirm branch strategy.
476
476
 
477
- More detail: [migrations](https://strata.do/developer-docs/developer-guide/cli/migrations)
477
+ More detail: [migrations](https://strata.do/docs/cli/migrations)
478
478
 
479
479
  ---
480
480
 
@@ -482,30 +482,30 @@ More detail: [migrations](https://strata.do/developer-docs/developer-guide/cli/m
482
482
 
483
483
  **Primary:** this `AGENTS.md` — follow inline rules first.
484
484
 
485
- **Optional bulk load:** fetch https://strata.do/developer-docs/llms.txt when implementing a topic not fully covered here (complete Strata doc export for AI agents).
485
+ **Optional bulk load:** fetch https://strata.do/docs/llms.txt when implementing a topic not fully covered here (complete Strata doc export for AI agents).
486
486
 
487
487
  **Curated links** (use for examples and edge cases after reading the matching section above):
488
488
 
489
489
  | Topic | URL |
490
490
  |-------|-----|
491
- | Semantic model overview | https://strata.do/developer-docs/developer-guide/semantic-model |
492
- | Core concepts | https://strata.do/developer-docs/developer-guide/getting-started/concepts |
493
- | Glossary | https://strata.do/developer-docs/developer-guide/getting-started/glossary |
494
- | Tables | https://strata.do/developer-docs/developer-guide/semantic-model/tables |
495
- | Fields | https://strata.do/developer-docs/developer-guide/semantic-model/fields |
496
- | Expressions (SQL) | https://strata.do/developer-docs/developer-guide/semantic-model/expressions/sql |
497
- | Relationships | https://strata.do/developer-docs/developer-guide/semantic-model/relationships/cardinality |
498
- | Imports | https://strata.do/developer-docs/developer-guide/semantic-model/imports |
499
- | Compound measures | https://strata.do/developer-docs/developer-guide/semantic-model/fields/measures/compound |
500
- | Snapshot measures | https://strata.do/developer-docs/developer-guide/semantic-model/fields/measures/snapshot |
501
- | Inclusions | https://strata.do/developer-docs/developer-guide/advanced/inclusions |
502
- | Exclusions | https://strata.do/developer-docs/developer-guide/advanced/exclusions |
503
- | Partitions | https://strata.do/developer-docs/developer-guide/advanced/partitions |
504
- | Cost optimization | https://strata.do/developer-docs/developer-guide/advanced/cost-optimization |
505
- | Extended blending | https://strata.do/developer-docs/developer-guide/semantic-model/expressions/extended-blending |
506
- | CLI audit | https://strata.do/developer-docs/developer-guide/cli/audit |
507
- | CLI deployment | https://strata.do/developer-docs/developer-guide/cli/deployment |
508
- | CLI migrations | https://strata.do/developer-docs/developer-guide/cli/migrations |
509
- | Star schema example | https://strata.do/developer-docs/developer-guide/examples/patterns/star-schema |
510
- | TPC-DS tutorial | https://strata.do/developer-docs/developer-guide/examples/tpcds-tutorial |
511
- | AI agents and Strata | https://strata.do/developer-docs/developer-guide/api/ai-agents |
491
+ | Semantic model overview | https://strata.do/docs/semantic-model |
492
+ | Core concepts | https://strata.do/docs/getting-started/concepts |
493
+ | Glossary | https://strata.do/docs/getting-started/glossary |
494
+ | Tables | https://strata.do/docs/semantic-model/tables |
495
+ | Fields | https://strata.do/docs/semantic-model/fields |
496
+ | Expressions (SQL) | https://strata.do/docs/semantic-model/expressions/sql |
497
+ | Relationships | https://strata.do/docs/semantic-model/relationships/cardinality |
498
+ | Imports | https://strata.do/docs/semantic-model/imports |
499
+ | Compound measures | https://strata.do/docs/semantic-model/fields/measures/compound |
500
+ | Snapshot measures | https://strata.do/docs/semantic-model/fields/measures/snapshot |
501
+ | Inclusions | https://strata.do/docs/advanced/inclusions |
502
+ | Exclusions | https://strata.do/docs/advanced/exclusions |
503
+ | Partitions | https://strata.do/docs/semantic-model/partitions |
504
+ | Cost optimization | https://strata.do/docs/advanced/cost-optimization |
505
+ | Extended blending | https://strata.do/docs/semantic-model/extended-blending-groups |
506
+ | CLI audit | https://strata.do/docs/cli/audit |
507
+ | CLI deployment | https://strata.do/docs/cli/deployment |
508
+ | CLI migrations | https://strata.do/docs/cli/migrations |
509
+ | Star schema example | https://strata.do/docs/examples/patterns/star-schema |
510
+ | TPC-DS tutorial | https://strata.do/docs/examples/tpcds-tutorial |
511
+ | AI agents and Strata | https://strata.do/docs/api/ai-agents |
@@ -10,7 +10,7 @@ uid: <%= uid %>
10
10
  description: Your projects description
11
11
 
12
12
  # Target Strata server (default environment, typically dev)
13
- server: <%= options[:source] %>
13
+ server: <%= server %>
14
14
 
15
15
  # Alternatively, you can configure multiple environments (different Strata server instances).
16
16
  # Each environment represents a separate Strata cluster (dev, staging, production).
@@ -19,7 +19,7 @@ server: <%= options[:source] %>
19
19
  # dev:
20
20
  # server: http://localhost:8080
21
21
  # prod:
22
- # server: https://app.strata.com
22
+ # server: https://app.strata.do
23
23
 
24
24
  # Project ID will be automatically set after first deployment.
25
25
  # WARNING: Do not change this project_id. It links this project to the Strata server.
@@ -26,7 +26,7 @@ cost: 10
26
26
  # Optional: If this is a snapshot table like an inventory table, you can
27
27
  # set the snapshot date dimension here. This will allow the creation of
28
28
  # snapshot measures on this table.
29
- # snapshot_date: <snapshot dimension name>
29
+ # snapshot: <snapshot dimension name>
30
30
 
31
31
  # Optional: Tag table for additional metadata.
32
32
  # tags:
@@ -79,6 +79,22 @@ module Strata
79
79
  # don't need special handling - no file lock issues
80
80
  end
81
81
 
82
+ # A file based datasource can name a path that only exists where the server runs:
83
+ # the sample project's /data/tpcds.duckdb ships inside the Strata image. There is
84
+ # nothing to open from here, so the CLI cannot verify the connection - the server
85
+ # does, when the model deploys. A remote URL is not this case; httpfs opens one
86
+ # from anywhere, so a broken URL should still be reported.
87
+ def local_file_missing?(config)
88
+ return false unless config.is_a?(Hash)
89
+
90
+ file = config["file"].to_s.strip
91
+ # No file key at all belongs to the adapter's own required param check, and
92
+ # :memory: connects without touching the disk.
93
+ return false if file.empty? || file.casecmp(":memory:").zero? || file.include?("://")
94
+
95
+ !File.exist?(file)
96
+ end
97
+
82
98
  def ensure_adapter_driver_gems!(adapter_sym)
83
99
  required = ADAPTER_DRIVER_GEMS.fetch(adapter_sym, [])
84
100
  return if required.empty?
@@ -137,8 +153,9 @@ module Strata
137
153
 
138
154
  normalized = value.to_s.downcase.strip
139
155
 
140
- # Match by key first
141
- return value if datasources.key?(normalized)
156
+ datasources.each_key do |key|
157
+ return key if key.to_s.downcase.strip == normalized
158
+ end
142
159
 
143
160
  # Match by name (case-insensitive)
144
161
  datasources.each do |key, config|
@@ -54,8 +54,9 @@ module Strata
54
54
  project_yml_content = File.read(project_yml_path)
55
55
 
56
56
  begin
57
- if /^server:\s*.+$/m.match?(project_yml_content)
58
- updated_content = project_yml_content.gsub(/^(\s*)server:\s*.+$/, "\\1server: #{server}")
57
+ # Root key only -- an indented `server:` belongs to a per-environment block.
58
+ if /^server:/.match?(project_yml_content)
59
+ updated_content = project_yml_content.sub(/^server:.*$/, "server: #{server}")
59
60
  File.write(project_yml_path, updated_content)
60
61
  else
61
62
  File.open(project_yml_path, "a") do |f|
@@ -5,7 +5,7 @@ module Strata
5
5
  module Prompts
6
6
  # Docs. This URL is printed by the CLI and baked into every shipped gem —
7
7
  # strata-docs has no redirects plugin, so renaming that page 404s old binaries.
8
- DOCS_BUILD_MODEL_URL = "https://strata.do/developer-docs/developer-guide/cli/building-your-model"
8
+ DOCS_BUILD_MODEL_URL = "https://strata.do/docs/cli/building-your-model"
9
9
 
10
10
  # Shown after 'strata init' and 'strata datasource add'. %s is the agent hint.
11
11
  MSG_AGENTS_MD_PRESENT = "AGENTS.md in this project tells it Strata's rules."
@@ -76,7 +76,7 @@ module Strata
76
76
  (operation == "swap") ? "post (after deployment)" : "pre (before deployment)"
77
77
  end
78
78
 
79
- # dir is the project root — 'strata init --source' clones repos without an AGENTS.md.
79
+ # dir is the project root — 'strata project sample' clones a repo that may lack an AGENTS.md.
80
80
  def build_model_next_steps(dir = ".")
81
81
  hint = File.exist?(File.join(dir, "AGENTS.md")) ? MSG_AGENTS_MD_PRESENT : MSG_AGENTS_MD_MISSING
82
82
  format(MSG_BUILD_MODEL_NEXT_STEPS, hint)