From 99aacab4bb1d53db6ccd7a74c66e07651e7286fd Mon Sep 17 00:00:00 2001 From: Michiel De Smet Date: Wed, 25 Mar 2026 15:29:38 -0700 Subject: [PATCH 1/4] feat(dbt-tools): build entire project when no --model flag given `altimate-dbt build` without arguments now builds the whole project via `unsafeBuildProjectImmediately`, replacing the need for the separate `build-project` command. Updated all dbt skill references accordingly. Co-Authored-By: Claude Sonnet 4.6 --- .opencode/skills/dbt-analyze/SKILL.md | 2 +- .../skills/dbt-analyze/references/altimate-dbt-commands.md | 4 ++-- .../skills/dbt-develop/references/altimate-dbt-commands.md | 4 ++-- .opencode/skills/dbt-docs/references/altimate-dbt-commands.md | 4 ++-- .opencode/skills/dbt-test/references/altimate-dbt-commands.md | 4 ++-- .../dbt-troubleshoot/references/altimate-dbt-commands.md | 4 ++-- packages/dbt-tools/src/commands/build.ts | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.opencode/skills/dbt-analyze/SKILL.md b/.opencode/skills/dbt-analyze/SKILL.md index f993e17974..d300284e86 100644 --- a/.opencode/skills/dbt-analyze/SKILL.md +++ b/.opencode/skills/dbt-analyze/SKILL.md @@ -111,7 +111,7 @@ If no manifest is available: 1. Run `lineage_check` on the changed SQL 2. Show column-level data flow 3. Note: downstream impact requires a manifest -4. Suggest: `altimate-dbt build-project` to generate one +4. Suggest: `altimate-dbt build` to generate one ## Common Mistakes diff --git a/.opencode/skills/dbt-analyze/references/altimate-dbt-commands.md b/.opencode/skills/dbt-analyze/references/altimate-dbt-commands.md index 6dbb8e9731..6bad491756 100644 --- a/.opencode/skills/dbt-analyze/references/altimate-dbt-commands.md +++ b/.opencode/skills/dbt-analyze/references/altimate-dbt-commands.md @@ -20,10 +20,10 @@ altimate-dbt info # Project name, adapter, root ## Build & Run ```bash -altimate-dbt build --model [--downstream] # compile + run + test +altimate-dbt build # full project build (compile + run + test) +altimate-dbt build --model [--downstream] # build a single model altimate-dbt run --model [--downstream] # materialize only altimate-dbt test --model # run tests only -altimate-dbt build-project # full project build ``` ## Compile diff --git a/.opencode/skills/dbt-develop/references/altimate-dbt-commands.md b/.opencode/skills/dbt-develop/references/altimate-dbt-commands.md index 6dbb8e9731..6bad491756 100644 --- a/.opencode/skills/dbt-develop/references/altimate-dbt-commands.md +++ b/.opencode/skills/dbt-develop/references/altimate-dbt-commands.md @@ -20,10 +20,10 @@ altimate-dbt info # Project name, adapter, root ## Build & Run ```bash -altimate-dbt build --model [--downstream] # compile + run + test +altimate-dbt build # full project build (compile + run + test) +altimate-dbt build --model [--downstream] # build a single model altimate-dbt run --model [--downstream] # materialize only altimate-dbt test --model # run tests only -altimate-dbt build-project # full project build ``` ## Compile diff --git a/.opencode/skills/dbt-docs/references/altimate-dbt-commands.md b/.opencode/skills/dbt-docs/references/altimate-dbt-commands.md index 6dbb8e9731..6bad491756 100644 --- a/.opencode/skills/dbt-docs/references/altimate-dbt-commands.md +++ b/.opencode/skills/dbt-docs/references/altimate-dbt-commands.md @@ -20,10 +20,10 @@ altimate-dbt info # Project name, adapter, root ## Build & Run ```bash -altimate-dbt build --model [--downstream] # compile + run + test +altimate-dbt build # full project build (compile + run + test) +altimate-dbt build --model [--downstream] # build a single model altimate-dbt run --model [--downstream] # materialize only altimate-dbt test --model # run tests only -altimate-dbt build-project # full project build ``` ## Compile diff --git a/.opencode/skills/dbt-test/references/altimate-dbt-commands.md b/.opencode/skills/dbt-test/references/altimate-dbt-commands.md index 6dbb8e9731..6bad491756 100644 --- a/.opencode/skills/dbt-test/references/altimate-dbt-commands.md +++ b/.opencode/skills/dbt-test/references/altimate-dbt-commands.md @@ -20,10 +20,10 @@ altimate-dbt info # Project name, adapter, root ## Build & Run ```bash -altimate-dbt build --model [--downstream] # compile + run + test +altimate-dbt build # full project build (compile + run + test) +altimate-dbt build --model [--downstream] # build a single model altimate-dbt run --model [--downstream] # materialize only altimate-dbt test --model # run tests only -altimate-dbt build-project # full project build ``` ## Compile diff --git a/.opencode/skills/dbt-troubleshoot/references/altimate-dbt-commands.md b/.opencode/skills/dbt-troubleshoot/references/altimate-dbt-commands.md index 6dbb8e9731..6bad491756 100644 --- a/.opencode/skills/dbt-troubleshoot/references/altimate-dbt-commands.md +++ b/.opencode/skills/dbt-troubleshoot/references/altimate-dbt-commands.md @@ -20,10 +20,10 @@ altimate-dbt info # Project name, adapter, root ## Build & Run ```bash -altimate-dbt build --model [--downstream] # compile + run + test +altimate-dbt build # full project build (compile + run + test) +altimate-dbt build --model [--downstream] # build a single model altimate-dbt run --model [--downstream] # materialize only altimate-dbt test --model # run tests only -altimate-dbt build-project # full project build ``` ## Compile diff --git a/packages/dbt-tools/src/commands/build.ts b/packages/dbt-tools/src/commands/build.ts index 07432ea4ad..5d796c764f 100644 --- a/packages/dbt-tools/src/commands/build.ts +++ b/packages/dbt-tools/src/commands/build.ts @@ -2,7 +2,7 @@ import type { DBTProjectIntegrationAdapter, CommandProcessResult } from "@altima export async function build(adapter: DBTProjectIntegrationAdapter, args: string[]) { const model = flag(args, "model") - if (!model) return { error: "Missing --model" } + if (!model) return project(adapter) const downstream = args.includes("--downstream") const result = await adapter.unsafeBuildModelImmediately({ plusOperatorLeft: "", From a885a7e55e899b9458f0298c528aee35648c1652 Mon Sep 17 00:00:00 2001 From: Michiel De Smet Date: Wed, 25 Mar 2026 16:58:33 -0700 Subject: [PATCH 2/4] test(dbt-tools): add unit tests for build command routing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Covers: no-model → project build, --model → single model, --downstream flag. Co-Authored-By: Claude Sonnet 4.6 --- packages/dbt-tools/test/build.test.ts | 47 +++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 packages/dbt-tools/test/build.test.ts diff --git a/packages/dbt-tools/test/build.test.ts b/packages/dbt-tools/test/build.test.ts new file mode 100644 index 0000000000..586c1b1f19 --- /dev/null +++ b/packages/dbt-tools/test/build.test.ts @@ -0,0 +1,47 @@ +import { describe, test, expect, mock } from "bun:test" +import { build, project } from "../src/commands/build" +import type { DBTProjectIntegrationAdapter } from "@altimateai/dbt-integration" + +function makeAdapter(overrides: Partial = {}): DBTProjectIntegrationAdapter { + return { + unsafeBuildModelImmediately: mock(() => Promise.resolve({ stdout: "model built", stderr: "" })), + unsafeBuildProjectImmediately: mock(() => Promise.resolve({ stdout: "project built", stderr: "" })), + unsafeRunModelImmediately: mock(() => Promise.resolve({ stdout: "", stderr: "" })), + unsafeRunModelTestImmediately: mock(() => Promise.resolve({ stdout: "", stderr: "" })), + dispose: mock(() => Promise.resolve()), + ...overrides, + } as unknown as DBTProjectIntegrationAdapter +} + +describe("build command", () => { + test("build without --model builds entire project", async () => { + const adapter = makeAdapter() + const result = await build(adapter, []) + expect(adapter.unsafeBuildProjectImmediately).toHaveBeenCalledTimes(1) + expect(adapter.unsafeBuildModelImmediately).not.toHaveBeenCalled() + expect(result).toEqual({ stdout: "project built" }) + }) + + test("build --model builds single model", async () => { + const adapter = makeAdapter() + const result = await build(adapter, ["--model", "orders"]) + expect(adapter.unsafeBuildModelImmediately).toHaveBeenCalledTimes(1) + expect(adapter.unsafeBuildModelImmediately).toHaveBeenCalledWith({ + plusOperatorLeft: "", + modelName: "orders", + plusOperatorRight: "", + }) + expect(adapter.unsafeBuildProjectImmediately).not.toHaveBeenCalled() + expect(result).toEqual({ stdout: "model built" }) + }) + + test("build --model --downstream sets plusOperatorRight", async () => { + const adapter = makeAdapter() + await build(adapter, ["--model", "orders", "--downstream"]) + expect(adapter.unsafeBuildModelImmediately).toHaveBeenCalledWith({ + plusOperatorLeft: "", + modelName: "orders", + plusOperatorRight: "+", + }) + }) +}) From b00c1cd40eff6e472d5b0c4003af70b3ff7f7dbe Mon Sep 17 00:00:00 2001 From: anandgupta42 Date: Thu, 26 Mar 2026 12:05:39 -0700 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20address=20code=20review=20=E2=80=94?= =?UTF-8?q?=20remove=20`build-project`=20command,=20update=20help=20text,?= =?UTF-8?q?=20add=20stderr=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove `build-project` from command map and switch case in `index.ts` (now redundant since `build` without `--model` does the same thing) - Update `build` help text to reflect optional `--model` - Remove unused `project` import from `build.test.ts` - Add test for `format()` stderr error path - Fix comment alignment in all 5 `altimate-dbt-commands.md` reference files Co-Authored-By: Claude Opus 4.6 (1M context) --- .../dbt-analyze/references/altimate-dbt-commands.md | 2 +- .../dbt-develop/references/altimate-dbt-commands.md | 2 +- .../dbt-docs/references/altimate-dbt-commands.md | 2 +- .../dbt-test/references/altimate-dbt-commands.md | 2 +- .../references/altimate-dbt-commands.md | 2 +- packages/dbt-tools/src/index.ts | 6 +----- packages/dbt-tools/test/build.test.ts | 12 +++++++++++- 7 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.opencode/skills/dbt-analyze/references/altimate-dbt-commands.md b/.opencode/skills/dbt-analyze/references/altimate-dbt-commands.md index 6bad491756..8109ac84d2 100644 --- a/.opencode/skills/dbt-analyze/references/altimate-dbt-commands.md +++ b/.opencode/skills/dbt-analyze/references/altimate-dbt-commands.md @@ -20,7 +20,7 @@ altimate-dbt info # Project name, adapter, root ## Build & Run ```bash -altimate-dbt build # full project build (compile + run + test) +altimate-dbt build # full project build (compile + run + test) altimate-dbt build --model [--downstream] # build a single model altimate-dbt run --model [--downstream] # materialize only altimate-dbt test --model # run tests only diff --git a/.opencode/skills/dbt-develop/references/altimate-dbt-commands.md b/.opencode/skills/dbt-develop/references/altimate-dbt-commands.md index 6bad491756..8109ac84d2 100644 --- a/.opencode/skills/dbt-develop/references/altimate-dbt-commands.md +++ b/.opencode/skills/dbt-develop/references/altimate-dbt-commands.md @@ -20,7 +20,7 @@ altimate-dbt info # Project name, adapter, root ## Build & Run ```bash -altimate-dbt build # full project build (compile + run + test) +altimate-dbt build # full project build (compile + run + test) altimate-dbt build --model [--downstream] # build a single model altimate-dbt run --model [--downstream] # materialize only altimate-dbt test --model # run tests only diff --git a/.opencode/skills/dbt-docs/references/altimate-dbt-commands.md b/.opencode/skills/dbt-docs/references/altimate-dbt-commands.md index 6bad491756..8109ac84d2 100644 --- a/.opencode/skills/dbt-docs/references/altimate-dbt-commands.md +++ b/.opencode/skills/dbt-docs/references/altimate-dbt-commands.md @@ -20,7 +20,7 @@ altimate-dbt info # Project name, adapter, root ## Build & Run ```bash -altimate-dbt build # full project build (compile + run + test) +altimate-dbt build # full project build (compile + run + test) altimate-dbt build --model [--downstream] # build a single model altimate-dbt run --model [--downstream] # materialize only altimate-dbt test --model # run tests only diff --git a/.opencode/skills/dbt-test/references/altimate-dbt-commands.md b/.opencode/skills/dbt-test/references/altimate-dbt-commands.md index 6bad491756..8109ac84d2 100644 --- a/.opencode/skills/dbt-test/references/altimate-dbt-commands.md +++ b/.opencode/skills/dbt-test/references/altimate-dbt-commands.md @@ -20,7 +20,7 @@ altimate-dbt info # Project name, adapter, root ## Build & Run ```bash -altimate-dbt build # full project build (compile + run + test) +altimate-dbt build # full project build (compile + run + test) altimate-dbt build --model [--downstream] # build a single model altimate-dbt run --model [--downstream] # materialize only altimate-dbt test --model # run tests only diff --git a/.opencode/skills/dbt-troubleshoot/references/altimate-dbt-commands.md b/.opencode/skills/dbt-troubleshoot/references/altimate-dbt-commands.md index 6bad491756..8109ac84d2 100644 --- a/.opencode/skills/dbt-troubleshoot/references/altimate-dbt-commands.md +++ b/.opencode/skills/dbt-troubleshoot/references/altimate-dbt-commands.md @@ -20,7 +20,7 @@ altimate-dbt info # Project name, adapter, root ## Build & Run ```bash -altimate-dbt build # full project build (compile + run + test) +altimate-dbt build # full project build (compile + run + test) altimate-dbt build --model [--downstream] # build a single model altimate-dbt run --model [--downstream] # materialize only altimate-dbt test --model # run tests only diff --git a/packages/dbt-tools/src/index.ts b/packages/dbt-tools/src/index.ts index 24cb8a9ce5..ff7fdd9d3c 100644 --- a/packages/dbt-tools/src/index.ts +++ b/packages/dbt-tools/src/index.ts @@ -11,10 +11,9 @@ const USAGE = { info: "Get project info (paths, targets, version)", compile: "Compile a model (Jinja to SQL) --model ", "compile-query": "Compile a raw query --query [--model ]", - build: "Build a model --model [--downstream]", + build: "Build project, or a single model with --model [--downstream]", run: "Run a model --model [--downstream]", test: "Test a model --model ", - "build-project": "Build entire project", execute: "Execute SQL --query [--model ] [--limit ]", columns: "Get columns of model --model ", "columns-source": "Get columns of source --source --table ", @@ -171,9 +170,6 @@ async function main() { case "test": result = await (await import("./commands/build")).test(adapter, rest) break - case "build-project": - result = await (await import("./commands/build")).project(adapter) - break case "execute": result = await (await import("./commands/execute")).execute(adapter, rest) break diff --git a/packages/dbt-tools/test/build.test.ts b/packages/dbt-tools/test/build.test.ts index 586c1b1f19..27fb116f1e 100644 --- a/packages/dbt-tools/test/build.test.ts +++ b/packages/dbt-tools/test/build.test.ts @@ -1,5 +1,5 @@ import { describe, test, expect, mock } from "bun:test" -import { build, project } from "../src/commands/build" +import { build } from "../src/commands/build" import type { DBTProjectIntegrationAdapter } from "@altimateai/dbt-integration" function makeAdapter(overrides: Partial = {}): DBTProjectIntegrationAdapter { @@ -44,4 +44,14 @@ describe("build command", () => { plusOperatorRight: "+", }) }) + + test("build surfaces stderr as error", async () => { + const adapter = makeAdapter({ + unsafeBuildProjectImmediately: mock(() => + Promise.resolve({ stdout: "partial output", stderr: "compilation error" }), + ), + }) + const result = await build(adapter, []) + expect(result).toEqual({ error: "compilation error", stdout: "partial output" }) + }) }) From 1afbecb969f4c2e7e970ad5c2ec161416e65cbc4 Mon Sep 17 00:00:00 2001 From: anandgupta42 Date: Thu, 26 Mar 2026 12:06:06 -0700 Subject: [PATCH 4/4] fix: add missing `fullOutput` field to satisfy `CommandProcessResult` type Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/dbt-tools/test/build.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dbt-tools/test/build.test.ts b/packages/dbt-tools/test/build.test.ts index 27fb116f1e..f73a89af9b 100644 --- a/packages/dbt-tools/test/build.test.ts +++ b/packages/dbt-tools/test/build.test.ts @@ -48,7 +48,7 @@ describe("build command", () => { test("build surfaces stderr as error", async () => { const adapter = makeAdapter({ unsafeBuildProjectImmediately: mock(() => - Promise.resolve({ stdout: "partial output", stderr: "compilation error" }), + Promise.resolve({ stdout: "partial output", stderr: "compilation error", fullOutput: "" }), ), }) const result = await build(adapter, [])