Skip to content
Open
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 .opencode/skills/dbt-analyze/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ altimate-dbt info # Project name, adapter, root
## Build & Run

```bash
altimate-dbt build --model <name> [--downstream] # compile + run + test
altimate-dbt build # full project build (compile + run + test)
altimate-dbt build --model <name> [--downstream] # build a single model
altimate-dbt run --model <name> [--downstream] # materialize only
altimate-dbt test --model <name> # run tests only
altimate-dbt build-project # full project build
```

## Compile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ altimate-dbt info # Project name, adapter, root
## Build & Run

```bash
altimate-dbt build --model <name> [--downstream] # compile + run + test
altimate-dbt build # full project build (compile + run + test)
altimate-dbt build --model <name> [--downstream] # build a single model
altimate-dbt run --model <name> [--downstream] # materialize only
altimate-dbt test --model <name> # run tests only
altimate-dbt build-project # full project build
```

## Compile
Expand Down
4 changes: 2 additions & 2 deletions .opencode/skills/dbt-docs/references/altimate-dbt-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ altimate-dbt info # Project name, adapter, root
## Build & Run

```bash
altimate-dbt build --model <name> [--downstream] # compile + run + test
altimate-dbt build # full project build (compile + run + test)
altimate-dbt build --model <name> [--downstream] # build a single model
altimate-dbt run --model <name> [--downstream] # materialize only
altimate-dbt test --model <name> # run tests only
altimate-dbt build-project # full project build
```

## Compile
Expand Down
4 changes: 2 additions & 2 deletions .opencode/skills/dbt-test/references/altimate-dbt-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ altimate-dbt info # Project name, adapter, root
## Build & Run

```bash
altimate-dbt build --model <name> [--downstream] # compile + run + test
altimate-dbt build # full project build (compile + run + test)
altimate-dbt build --model <name> [--downstream] # build a single model
altimate-dbt run --model <name> [--downstream] # materialize only
altimate-dbt test --model <name> # run tests only
altimate-dbt build-project # full project build
```

## Compile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ altimate-dbt info # Project name, adapter, root
## Build & Run

```bash
altimate-dbt build --model <name> [--downstream] # compile + run + test
altimate-dbt build # full project build (compile + run + test)
altimate-dbt build --model <name> [--downstream] # build a single model
altimate-dbt run --model <name> [--downstream] # materialize only
altimate-dbt test --model <name> # run tests only
altimate-dbt build-project # full project build
```

## Compile
Expand Down
2 changes: 1 addition & 1 deletion packages/dbt-tools/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: "",
Expand Down
47 changes: 47 additions & 0 deletions packages/dbt-tools/test/build.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { describe, test, expect, mock } from "bun:test"
import { build, project } from "../src/commands/build"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove unused project import.

project is imported but never used in this file.

Suggested fix
-import { build, project } from "../src/commands/build"
+import { build } from "../src/commands/build"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { build, project } from "../src/commands/build"
import { build } from "../src/commands/build"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/dbt-tools/test/build.test.ts` at line 2, The import statement
imports an unused symbol "project" from "../src/commands/build"; remove
"project" from the import so only "build" is imported (i.e., change `import {
build, project } ...` to `import { build } ...`), then run tests/lint to confirm
the unused-import error is resolved.

import type { DBTProjectIntegrationAdapter } from "@altimateai/dbt-integration"

function makeAdapter(overrides: Partial<DBTProjectIntegrationAdapter> = {}): 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 <name> 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 <name> --downstream sets plusOperatorRight", async () => {
const adapter = makeAdapter()
await build(adapter, ["--model", "orders", "--downstream"])
expect(adapter.unsafeBuildModelImmediately).toHaveBeenCalledWith({
plusOperatorLeft: "",
modelName: "orders",
plusOperatorRight: "+",
})
})
})
Loading